Commit d595a39d authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Duke3d: fix issue with Polymer lights sometimes not appearing after the player dies and respawns

Fixes terminx/eduke32#188
parent b4d1041f
...@@ -707,13 +707,16 @@ static void A_DeleteLight(int32_t s) ...@@ -707,13 +707,16 @@ static void A_DeleteLight(int32_t s)
practor[s].lightptr = NULL; practor[s].lightptr = NULL;
} }
void G_Polymer_UnInit(void) void G_DeleteAllLights(void)
{ {
int32_t i; for (int i=0; i<MAXSPRITES; i++)
for (i=0; i<MAXSPRITES; i++)
A_DeleteLight(i); A_DeleteLight(i);
} }
void G_Polymer_UnInit(void)
{
G_DeleteAllLights();
}
#endif #endif
// deletesprite() game wrapper // deletesprite() game wrapper
......
...@@ -402,6 +402,7 @@ void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt); ...@@ -402,6 +402,7 @@ void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt);
int G_SetInterpolation(int32_t *posptr); int G_SetInterpolation(int32_t *posptr);
void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio); void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio);
void G_DeleteAllLights(void);
void G_ClearCameraView(DukePlayer_t *ps); void G_ClearCameraView(DukePlayer_t *ps);
void G_DoInterpolations(int smoothRatio); void G_DoInterpolations(int smoothRatio);
void G_MoveWorld(void); void G_MoveWorld(void);
......
...@@ -1940,6 +1940,7 @@ int G_EnterLevel(int gameMode) ...@@ -1940,6 +1940,7 @@ int G_EnterLevel(int gameMode)
G_DoLoadScreen("Loading map . . .", -1); G_DoLoadScreen("Loading map . . .", -1);
G_UpdateScreenArea(); G_UpdateScreenArea();
G_DeleteAllLights();
ud.screen_size = ssize; ud.screen_size = ssize;
...@@ -2077,7 +2078,6 @@ int G_EnterLevel(int gameMode) ...@@ -2077,7 +2078,6 @@ int G_EnterLevel(int gameMode)
videoClearViewableArea(0L); videoClearViewableArea(0L);
G_DrawBackground(); G_DrawBackground();
G_DrawRooms(myconnectindex,65536); G_DrawRooms(myconnectindex,65536);
if (g_netClient || g_netServer) // [75] : Initialize map states after map load if (g_netClient || g_netServer) // [75] : Initialize map states after map load
{ {
Net_InitMapStateHistory(); Net_InitMapStateHistory();
......
...@@ -2182,14 +2182,9 @@ static void sv_preactorsave(void) { sv_prepareactors(actor); } ...@@ -2182,14 +2182,9 @@ static void sv_preactorsave(void) { sv_prepareactors(actor); }
static void sv_postactordata(void) static void sv_postactordata(void)
{ {
sv_restoreactors(actor); sv_restoreactors(actor);
for (int i = 0; i < MAXSPRITES; i++)
{
#ifdef POLYMER #ifdef POLYMER
practor[i].lightptr = NULL; G_DeleteAllLights();
practor[i].lightId = -1;
#endif #endif
}
} }
static void sv_preanimateptrsave() static void sv_preanimateptrsave()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment