Add a warning when calling {save,load}mapstate from EVENT_ANIMATESPRITES (forgotten from earlier changes).

git-svn-id: https://svn.eduke32.com/eduke32@1956 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-08-03 17:22:46 +00:00
parent aa8b2e4e05
commit 54f345f78f
4 changed files with 28 additions and 2 deletions

View file

@ -9147,8 +9147,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
if (!tp) goto OUTOFMEM;
Bmemcpy(tp, parm->raw+ofs, slen);
// explicitly typed space at beginning of command (really? not eaten by OSD
// code?) or M32script call from 'special functions' menu
// M32script call from 'special functions' menu
dontsavehist = (slen==0 || tp[0]==' ');
// needed so that subsequent commands won't execute old stuff.

View file

@ -3771,6 +3771,15 @@ static int32_t C_ParseCommand(int32_t loop)
case CON_FLASH:
case CON_SAVEMAPSTATE:
case CON_LOADMAPSTATE:
if (tw != CON_FLASH)
{
if (g_currentEvent == EVENT_ANIMATESPRITES)
{
initprintf("%s:%d: warning: found `%s' inside EVENT_ANIMATESPRITES\n",
g_szScriptFileName,g_lineNumber,tempbuf);
g_numCompilerWarnings++;
}
}
continue;
case CON_DRAGPOINT:

View file

@ -51,6 +51,8 @@ int32_t g_errorLineNum;
int32_t g_tw;
extern int32_t ticrandomseed;
int32_t g_currentEventExec = -1;
GAMEEXEC_STATIC void VM_Execute(int32_t loop);
#include "gamestructures.c"
@ -95,6 +97,7 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0],
&sprite[iActor], 0 };
g_currentEventExec = iEventID;
insptr = apScriptGameEvent[iEventID];
Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t));
@ -113,6 +116,8 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t));
insptr = oinsptr;
g_currentEventExec = -1;
}
}
@ -4958,6 +4963,12 @@ void G_SaveMapState(mapstate_t *save)
Bmemcpy(&save->numsectors,&numsectors,sizeof(numsectors));
Bmemcpy(&save->sector[0],&sector[0],sizeof(sectortype)*MAXSECTORS);
Bmemcpy(&save->sprite[0],&sprite[0],sizeof(spritetype)*MAXSPRITES);
if (g_currentEventExec == EVENT_ANIMATESPRITES)
initprintf("Line %d: savemapstate called from EVENT_ANIMATESPRITES. WHY?\n", g_errorLineNum);
else
for (i=0; i<MAXSPRITES; i++)
spriteext[i].tspr = NULL;
Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES);
Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect));
Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect));
@ -5085,6 +5096,11 @@ void G_RestoreMapState(mapstate_t *save)
Bmemcpy(&sector[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 (g_currentEventExec == EVENT_ANIMATESPRITES)
initprintf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n",g_errorLineNum);
else
for (i=0; i<MAXSPRITES; i++)
spriteext[i].tspr = NULL;
Bmemcpy(&headspritesect[0],&save->headspritesect[0],sizeof(headspritesect));
Bmemcpy(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect));
Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect));

View file

@ -121,6 +121,8 @@ extern int32_t g_tw;
extern int32_t ticrandomseed;
extern vmstate_t vm;
extern int32_t g_currentEventExec;
void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist);
void A_Fall(int32_t iActor);
int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_t *day);