mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
Make Polymer declare a callback function G_Polymer_UnInit() that is called
whenever we change to another renderer etc. and define it for the game and editor. The purpose of the function is to clean up references to Polymer resources like lights. This fixes 1) all lights becoming spot lights in the game and 2) an issue with maphack lights in the editor (can't recall which exactly). git-svn-id: https://svn.eduke32.com/eduke32@2006 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ea171d5230
commit
a145cc93bc
4 changed files with 32 additions and 12 deletions
|
@ -287,6 +287,9 @@ typedef struct s_pranimatespritesinfo {
|
|||
int32_t x, y, a, smoothratio;
|
||||
} _pranimatespritesinfo;
|
||||
|
||||
// this one has to be provided by the application
|
||||
extern void G_Polymer_UnInit(void);
|
||||
|
||||
// EXTERNAL FUNCTIONS
|
||||
int32_t polymer_init(void);
|
||||
void polymer_uninit(void);
|
||||
|
|
|
@ -15698,7 +15698,10 @@ int32_t setrendermode(int32_t renderer)
|
|||
renderer = 3;
|
||||
}
|
||||
else if (rendmode==4) // going from Polymer to another renderer
|
||||
{
|
||||
G_Polymer_UnInit();
|
||||
polymer_uninit();
|
||||
}
|
||||
# else
|
||||
else renderer = 3;
|
||||
# endif
|
||||
|
|
|
@ -484,6 +484,23 @@ ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype)
|
|||
|
||||
int32_t block_deletesprite = 0;
|
||||
|
||||
#ifdef POLYMER
|
||||
static void A_DeletePolymerLight(int32_t s)
|
||||
{
|
||||
polymer_deletelight(actor[s].lightId);
|
||||
actor[s].lightId = -1;
|
||||
actor[s].lightptr = NULL;
|
||||
}
|
||||
|
||||
void G_Polymer_UnInit(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
A_DeletePolymerLight(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
// all calls to deletesprite() from the game are wrapped by this function
|
||||
void A_DeleteSprite(int32_t s)
|
||||
{
|
||||
|
@ -506,9 +523,7 @@ void A_DeleteSprite(int32_t s)
|
|||
#ifdef POLYMER
|
||||
if (getrendermode() == 4 && actor[s].lightptr != NULL)
|
||||
{
|
||||
polymer_deletelight(actor[s].lightId);
|
||||
actor[s].lightId = -1;
|
||||
actor[s].lightptr = NULL;
|
||||
A_DeletePolymerLight(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -8111,9 +8126,7 @@ void G_MoveWorld(void)
|
|||
{
|
||||
if (actor[i].lightptr != NULL)
|
||||
{
|
||||
polymer_deletelight(actor[i].lightId);
|
||||
actor[i].lightId = -1;
|
||||
actor[i].lightptr = NULL;
|
||||
A_DeletePolymerLight(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -8123,9 +8136,7 @@ void G_MoveWorld(void)
|
|||
{
|
||||
if (!(--actor[i].lightcount))
|
||||
{
|
||||
polymer_deletelight(actor[i].lightId);
|
||||
actor[i].lightId = -1;
|
||||
actor[i].lightptr = NULL;
|
||||
A_DeletePolymerLight(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8173,9 +8184,7 @@ void G_MoveWorld(void)
|
|||
{
|
||||
if (actor[i].lightptr != NULL)
|
||||
{
|
||||
polymer_deletelight(actor[i].lightId);
|
||||
actor[i].lightId = -1;
|
||||
actor[i].lightptr = NULL;
|
||||
A_DeletePolymerLight(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -316,6 +316,11 @@ static void DeletePolymerLights(void)
|
|||
spritelightptr[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void G_Polymer_UnInit(void)
|
||||
{
|
||||
DeletePolymerLights();
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int32_t mskip;
|
||||
|
|
Loading…
Reference in a new issue