mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Optimize A_Execute() control flow
git-svn-id: https://svn.eduke32.com/eduke32@7635 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
de695f22bc
commit
078ef9b871
1 changed files with 43 additions and 46 deletions
|
@ -6523,27 +6523,27 @@ void VM_UpdateAnim(int spriteNum, int32_t *pData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NORECURSE
|
// NORECURSE
|
||||||
void A_Execute(int spriteNum, int playerNum, int playerDist)
|
void A_Execute(int const spriteNum, int const playerNum, int const playerDist)
|
||||||
{
|
{
|
||||||
// for some reason this is faster than using the C++ syntax; e.g vm = vmstate_t{ ... }
|
// for some reason this is faster than using the C++ syntax; e.g vm = vmstate_t{ ... }
|
||||||
vmstate_t const tempvm
|
vmstate_t const tempvm
|
||||||
= { spriteNum, playerNum, playerDist, 0, &sprite[spriteNum], &actor[spriteNum].t_data[0], g_player[playerNum].ps, &actor[spriteNum] };
|
= { spriteNum, playerNum, playerDist, 0, &sprite[spriteNum], &actor[spriteNum].t_data[0], g_player[playerNum].ps, &actor[spriteNum] };
|
||||||
vm = tempvm;
|
vm = tempvm;
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifndef NETCODE_DISABLE
|
||||||
int32_t killit=0;
|
if (g_netClient)
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (g_netClient && A_CheckSpriteFlags(spriteNum, SFLAG_NULL))
|
|
||||||
{
|
{
|
||||||
A_DeleteSprite(spriteNum);
|
#if 0
|
||||||
return;
|
if (A_CheckSpriteFlags(spriteNum, SFLAG_NULL))
|
||||||
}
|
{
|
||||||
*/
|
A_DeleteSprite(spriteNum);
|
||||||
|
return;
|
||||||
if (g_netClient) // [75] The server should not overwrite its own randomseed
|
}
|
||||||
|
#endif
|
||||||
|
// [75] The server should not overwrite its own randomseed
|
||||||
randomseed = ticrandomseed;
|
randomseed = ticrandomseed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned)vm.pSprite->sectnum >= MAXSECTORS))
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.pSprite->sectnum >= MAXSECTORS))
|
||||||
{
|
{
|
||||||
|
@ -6576,21 +6576,39 @@ void A_Execute(int spriteNum, int playerNum, int playerDist)
|
||||||
g_actorCalls[picnum]++;
|
g_actorCalls[picnum]++;
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
if (killit)
|
if (!killit)
|
||||||
#else
|
#else
|
||||||
if (vm.flags & VM_KILL)
|
if ((vm.flags & VM_KILL) == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
VM_DeleteSprite(spriteNum, playerNum);
|
VM_Move();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VM_Move();
|
if (vm.pSprite->statnum == STAT_ACTOR)
|
||||||
|
{
|
||||||
|
if (A_CheckEnemySprite(vm.pSprite))
|
||||||
|
{
|
||||||
|
if (vm.pSprite->xrepeat > 60 || (ud.respawn_monsters == 1 && vm.pSprite->extra <= 0))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (EDUKE32_PREDICT_FALSE(ud.respawn_items == 1 && (vm.pSprite->cstat & 32768)))
|
||||||
|
return;
|
||||||
|
|
||||||
if (vm.pSprite->statnum != STAT_ACTOR)
|
if (A_CheckSpriteFlags(vm.spriteNum, SFLAG_USEACTIVATOR) && sector[vm.pSprite->sectnum].lotag & 16384)
|
||||||
{
|
changespritestat(vm.spriteNum, STAT_ZOMBIEACTOR);
|
||||||
|
else if (vm.pActor->timetosleep > 1)
|
||||||
|
vm.pActor->timetosleep--;
|
||||||
|
else if (vm.pActor->timetosleep == 1)
|
||||||
|
{
|
||||||
|
// hack for 1.3D fire sprites
|
||||||
#ifndef EDUKE32_STANDALONE
|
#ifndef EDUKE32_STANDALONE
|
||||||
if (vm.pSprite->statnum == STAT_STANDABLE)
|
if (!IONMAIDEN && EDUKE32_PREDICT_FALSE(g_scriptVersion == 13 && (vm.pSprite->picnum == FIRE || vm.pSprite->picnum == FIRE2)))
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
changespritestat(vm.spriteNum, STAT_ZOMBIEACTOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifndef EDUKE32_STANDALONE
|
||||||
|
else if (!IONMAIDEN && vm.pSprite->statnum == STAT_STANDABLE)
|
||||||
{
|
{
|
||||||
switch (DYNAMICTILEMAP(vm.pSprite->picnum))
|
switch (DYNAMICTILEMAP(vm.pSprite->picnum))
|
||||||
{
|
{
|
||||||
|
@ -6609,34 +6627,13 @@ void A_Execute(int spriteNum, int playerNum, int playerDist)
|
||||||
vm.pActor->timetosleep--;
|
vm.pActor->timetosleep--;
|
||||||
else if (vm.pActor->timetosleep == 1)
|
else if (vm.pActor->timetosleep == 1)
|
||||||
changespritestat(vm.spriteNum, STAT_ZOMBIEACTOR);
|
changespritestat(vm.spriteNum, STAT_ZOMBIEACTOR);
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (A_CheckEnemySprite(vm.pSprite))
|
|
||||||
{
|
|
||||||
if (vm.pSprite->xrepeat > 60 || (ud.respawn_monsters == 1 && vm.pSprite->extra <= 0))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (EDUKE32_PREDICT_FALSE(ud.respawn_items == 1 && (vm.pSprite->cstat & 32768)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (A_CheckSpriteFlags(vm.spriteNum, SFLAG_USEACTIVATOR) && sector[vm.pSprite->sectnum].lotag & 16384)
|
|
||||||
changespritestat(vm.spriteNum, STAT_ZOMBIEACTOR);
|
|
||||||
else if (vm.pActor->timetosleep > 1)
|
|
||||||
vm.pActor->timetosleep--;
|
|
||||||
else if (vm.pActor->timetosleep == 1)
|
|
||||||
{
|
|
||||||
// hack for 1.3D fire sprites
|
|
||||||
#ifndef EDUKE32_STANDALONE
|
|
||||||
if (EDUKE32_PREDICT_FALSE(g_scriptVersion == 13 && (vm.pSprite->picnum == FIRE || vm.pSprite->picnum == FIRE2)))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
changespritestat(vm.spriteNum, STAT_ZOMBIEACTOR);
|
|
||||||
}
|
}
|
||||||
|
else VM_DeleteSprite(spriteNum, playerNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_SaveMapState(void)
|
void G_SaveMapState(void)
|
||||||
|
|
Loading…
Reference in a new issue