Duke3d: hoist checks for ST_2_UNDERWATER outside of loops in SE_14_SUBWAY_CAR processing

This commit is contained in:
Richard C. Gobeille 2020-04-29 22:11:46 -07:00 committed by Christoph Oelckers
parent 45fd214ffe
commit 23909f8ca1

View file

@ -6416,15 +6416,9 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
m = (pSprite->xvel*sintable[(pSprite->ang+512)&2047])>>14; m = (pSprite->xvel*sintable[(pSprite->ang+512)&2047])>>14;
x = (pSprite->xvel*sintable[pSprite->ang&2047])>>14; x = (pSprite->xvel*sintable[pSprite->ang&2047])>>14;
for (TRAVERSE_CONNECT(playerNum)) if (sector[pSprite->sectnum].lotag != ST_2_UNDERWATER)
{ {
auto const pPlayer = g_player[playerNum].ps; for (TRAVERSE_CONNECT(playerNum))
// might happen when squished into void space
if (pPlayer->cursectnum < 0)
break;
if (sector[pPlayer->cursectnum].lotag != ST_2_UNDERWATER)
{ {
if (g_playerSpawnPoints[playerNum].sect == pSprite->sectnum) if (g_playerSpawnPoints[playerNum].sect == pSprite->sectnum)
{ {
@ -6432,6 +6426,12 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
g_playerSpawnPoints[playerNum].pos.y += x; g_playerSpawnPoints[playerNum].pos.y += x;
} }
auto const pPlayer = g_player[playerNum].ps;
// might happen when squished into void space
if (pPlayer->cursectnum < 0)
break;
if (pSprite->sectnum == pPlayer->cursectnum if (pSprite->sectnum == pPlayer->cursectnum
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
|| (pData[9] >= 0 && pData[9] == pPlayer->cursectnum) || (pData[9] >= 0 && pData[9] == pPlayer->cursectnum)
@ -6450,11 +6450,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
pPlayer->q16ang &= 0x7FFFFFF; pPlayer->q16ang &= 0x7FFFFFF;
if (sprite[pPlayer->i].extra <= 0) if (sprite[pPlayer->i].extra <= 0)
{ sprite[pPlayer->i].pos.vec2 = pPlayer->pos.vec2;
sprite[pPlayer->i].x = pPlayer->pos.x;
sprite[pPlayer->i].y = pPlayer->pos.y;
}
}
} }
} }
@ -6463,12 +6459,10 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
while (j >= 0) while (j >= 0)
{ {
// KEEPINSYNC2 // KEEPINSYNC2
// XXX: underwater check? if (sprite[j].statnum != STAT_PLAYER
if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != ST_2_UNDERWATER && && (sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT || sprite[j].lotag == SE_50_SPOT_LIGHT))
(sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT||sprite[j].lotag == SE_50_SPOT_LIGHT))
&& sprite[j].picnum != LOCATORS) && sprite[j].picnum != LOCATORS)
{ {
if (move_rotfixed_sprite(j, pSprite - sprite, pData[2])) if (move_rotfixed_sprite(j, pSprite - sprite, pData[2]))
rotatepoint(pSprite->pos.vec2, sprite[j].pos.vec2, q, &sprite[j].pos.vec2); rotatepoint(pSprite->pos.vec2, sprite[j].pos.vec2, q, &sprite[j].pos.vec2);
@ -6476,7 +6470,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
sprite[j].y += x; sprite[j].y += x;
sprite[j].ang += q; sprite[j].ang += q;
} }
j = nextspritesect[j]; j = nextspritesect[j];
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -6490,6 +6483,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
} }
#endif #endif
} }
}
A_MoveSector(spriteNum); A_MoveSector(spriteNum);
setsprite(spriteNum,&pSprite->pos); setsprite(spriteNum,&pSprite->pos);