Factor out code for launching EVENT_GAME and EVENT_PREGAME.

git-svn-id: https://svn.eduke32.com/eduke32@6081 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-03-20 20:29:57 +00:00
parent 06a38e3873
commit af66b8a99f

View file

@ -8249,13 +8249,9 @@ void G_RefreshLights(void)
#endif #endif
} }
void G_MoveWorld(void) static void G_DoEventGame(int nEventID)
{ {
extern double g_moveActorsTime; if (VM_HaveEvent(nEventID))
VM_OnEvent(EVENT_PREWORLD, -1, -1);
if (VM_HaveEvent(EVENT_PREGAME))
{ {
int statNum = 0; int statNum = 0;
@ -8275,13 +8271,22 @@ void G_MoveWorld(void)
int32_t playerDist; int32_t playerDist;
int const playerNum = A_FindPlayer(&sprite[spriteNum], &playerDist); int const playerNum = A_FindPlayer(&sprite[spriteNum], &playerDist);
VM_OnEventWithDist_(EVENT_PREGAME, spriteNum, playerNum, playerDist); VM_OnEventWithDist_(nEventID, spriteNum, playerNum, playerDist);
spriteNum = nextSprite; spriteNum = nextSprite;
} }
} }
while (statNum < MAXSTATUS); while (statNum < MAXSTATUS);
} }
}
void G_MoveWorld(void)
{
extern double g_moveActorsTime;
VM_OnEvent(EVENT_PREWORLD, -1, -1);
G_DoEventGame(EVENT_PREGAME);
G_MoveZombieActors(); //ST 2 G_MoveZombieActors(); //ST 2
G_MoveWeapons(); //ST 4 G_MoveWeapons(); //ST 4
@ -8306,34 +8311,7 @@ void G_MoveWorld(void)
VM_OnEvent(EVENT_WORLD, -1, -1); VM_OnEvent(EVENT_WORLD, -1, -1);
if (VM_HaveEvent(EVENT_GAME)) G_DoEventGame(EVENT_GAME);
{
int statNum = 0;
do
{
int spriteNum = headspritestat[statNum++];
while (spriteNum >= 0)
{
if (A_CheckSpriteFlags(spriteNum, SFLAG_NOEVENTCODE))
{
spriteNum = nextspritestat[spriteNum];
continue;
}
int32_t playerDist;
int const nextSprite = nextspritestat[spriteNum];
int const playerNum = A_FindPlayer(&sprite[spriteNum], &playerDist);
VM_OnEventWithDist_(EVENT_GAME, spriteNum, playerNum, playerDist);
spriteNum = nextSprite;
}
}
while (statNum < MAXSTATUS);
}
G_RefreshLights(); G_RefreshLights();
G_DoSectorAnimations(); G_DoSectorAnimations();