Fix a potential issue with nested event execution

git-svn-id: https://svn.eduke32.com/eduke32@2655 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-05-15 23:39:48 +00:00
parent 245c8c1fef
commit 3548c50724
4 changed files with 94 additions and 92 deletions

View file

@ -10895,7 +10895,7 @@ int32_t G_DoMoveThings(void)
if (sprite[g_player[i].ps->i].pal != 1)
sprite[g_player[i].ps->i].pal = g_player[i].pcolor;
G_HandleSharedKeys(i);
P_HandleSharedKeys(i);
if (ud.pause_on == 0)
{

View file

@ -111,6 +111,9 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
iActor >= 0 ? &sprite[iActor] : NULL,
0 };
int32_t backupReturnVar = aGameVars[g_iReturnVarID].val.lValue;
int32_t backupEventExec = g_currentEventExec;
g_currentEventExec = iEventID;
insptr = apScriptGameEvent[iEventID];
@ -131,7 +134,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;
g_currentEventExec = backupEventExec;
aGameVars[g_iReturnVarID].val.lValue = backupReturnVar;
}
}

View file

@ -2468,7 +2468,7 @@ void allignwarpelevators(void)
}
}
void G_HandleSharedKeys(int32_t snum)
void P_HandleSharedKeys(int32_t snum)
{
int32_t i, k = 0, dainv;
uint32_t sb_snum = g_player[snum].sync->bits, j;
@ -2618,11 +2618,9 @@ void G_HandleSharedKeys(int32_t snum)
return; // is there significance to returning?
}
if (p->refresh_inventory)
{
sb_snum |= BIT(SK_INV_LEFT); // emulate move left...
}
if (p->newowner == -1)
if (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT) || TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT))
if (p->newowner == -1 && (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT) || TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT)))
{
p->invdisptime = GAMETICSPERSEC*2;

View file

@ -111,12 +111,12 @@ int32_t G_ActivateWarpElevators(int32_t s,int32_t d);
int32_t G_CheckActivatorMotion(int32_t lotag);
extern inline int32_t G_CheckPlayerInSector(int32_t sect);
void G_DoSectorAnimations(void);
void G_HandleSharedKeys(int32_t snum);
void G_OperateActivators(int32_t low,int32_t snum);
void G_OperateForceFields(int32_t s,int32_t low);
void G_OperateMasterSwitches(int32_t low);
void G_OperateRespawns(int32_t low);
void G_OperateSectors(int32_t sn,int32_t ii);
void P_HandleSharedKeys(int32_t snum);
int32_t GetAnimationGoal(const int32_t *animptr);
int32_t isanearoperator(int32_t lotag);
int32_t isanunderoperator(int32_t lotag);