From cef99818bb8a7cbf1987e2be5ee44679c12081f6 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 1 Feb 2013 13:05:13 +0000 Subject: [PATCH] NULL spriteext[].tpsr after each running EVENT_ANIMATESPRITES for a tsprite. Meaning that only *ettsprite[THISACTOR] makes sense from CON. It did before too, because .tspr was set before each event run (and not before all runs), only that it was never nulled, which was kind of untidy. git-svn-id: https://svn.eduke32.com/eduke32@3450 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 1 + polymer/eduke32/source/gameexec.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 8cf9a6828..dca44b23f 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -6232,6 +6232,7 @@ static void G_DoEventAnimSprites(int32_t j) { spriteext[ow].tspr = &tsprite[j]; VM_OnEvent(EVENT_ANIMATESPRITES, ow, myconnectindex, -1, 0); + spriteext[ow].tspr = NULL; } } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index a06e840a6..e47167a33 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5333,11 +5333,9 @@ void G_SaveMapState(mapstate_t *save) Bmemcpy(&save->sector[0],§or[0],sizeof(sectortype)*MAXSECTORS); Bmemcpy(&save->sprite[0],&sprite[0],sizeof(spritetype)*MAXSPRITES); + // If we're in EVENT_ANIMATESPRITES, we'll be saving pointer values to disk :-/ if (g_currentEventExec == EVENT_ANIMATESPRITES) initprintf("Line %d: savemapstate called from EVENT_ANIMATESPRITES. WHY?\n", g_errorLineNum); - else - for (i=0; ispriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES); save->numsprites = Numsprites; @@ -5433,11 +5431,15 @@ void G_RestoreMapState(mapstate_t *save) Bmemcpy(§or[0],&save->sector[0],sizeof(sectortype)*MAXSECTORS); Bmemcpy(&sprite[0],&save->sprite[0],sizeof(spritetype)*MAXSPRITES); Bmemcpy(&spriteext[0],&save->spriteext[0],sizeof(spriteext_t)*MAXSPRITES); + + // If we're restoring from EVENT_ANIMATESPRITES, all spriteext[].tspr + // will be overwritten, so NULL them. if (g_currentEventExec == EVENT_ANIMATESPRITES) + { initprintf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n",g_errorLineNum); - else for (i=0; inumsprites; tailspritefree = save->tailspritefree;