Skip to content

Commit

Permalink
- Exhumed: Just use pPlayer->nAction in player code, don't store on…
Browse files Browse the repository at this point in the history
… the stack.
  • Loading branch information
mjr4077au committed Mar 24, 2023
1 parent 0842ea3 commit a6cec3d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions source/games/exhumed/src/player.cpp
Expand Up @@ -942,11 +942,10 @@ void AIPlayer::Tick(RunListEvent* ev)

DExhumedActor* pDopple = pPlayer->pDoppleSprite;

int nAction = pPlayer->nAction;
int nActionB = pPlayer->nAction;

pPlayerActor->vel.XY() = pPlayer->vel;
pPlayerActor->spr.picnum = seq_GetSeqPicnum(pPlayer->nSeq, PlayerSeq[nHeightTemplate[nAction]].a, pPlayer->nSeqSize);
pPlayerActor->spr.picnum = seq_GetSeqPicnum(pPlayer->nSeq, PlayerSeq[nHeightTemplate[pPlayer->nAction]].a, pPlayer->nSeqSize);
pDopple->spr.picnum = pPlayerActor->spr.picnum;

if (pPlayer->nCurrentItem > -1)
Expand Down Expand Up @@ -1402,7 +1401,7 @@ void AIPlayer::Tick(RunListEvent* ev)
}
else if (bTouchFloor)
{
if (nAction < 6 || nAction > 8)
if (pPlayer->nAction < 6 || pPlayer->nAction > 8)
{
pPlayerActor->vel.Z = -14;
nActionB = 3;
Expand Down Expand Up @@ -1435,7 +1434,7 @@ void AIPlayer::Tick(RunListEvent* ev)
{
if (pPlayer->nHealth > 0)
{
pPlayerActor->viewzoffset += (nActionEyeLevel[nAction] - pPlayerActor->viewzoffset) * 0.5;
pPlayerActor->viewzoffset += (nActionEyeLevel[pPlayer->nAction] - pPlayerActor->viewzoffset) * 0.5;

if (bUnderwater)
{
Expand Down Expand Up @@ -1502,7 +1501,7 @@ void AIPlayer::Tick(RunListEvent* ev)
FireWeapon(nPlayer);
}

if (nAction != 15)
if (pPlayer->nAction != 15)
{
if (pPlayer->totalvel <= 1)
{
Expand All @@ -1516,9 +1515,8 @@ void AIPlayer::Tick(RunListEvent* ev)
}

// loc_1BF09
if (nActionB != nAction && nAction != 4)
if (nActionB != pPlayer->nAction && pPlayer->nAction != 4)
{
nAction = nActionB;
pPlayer->nAction = nActionB;
pPlayer->nSeqSize = 0;
}
Expand Down Expand Up @@ -1563,7 +1561,7 @@ void AIPlayer::Tick(RunListEvent* ev)
{
pPlayer->input.actions &= ~SB_OPEN;

if (nAction >= 16)
if (pPlayer->nAction >= 16)
{
if (nPlayer == nLocalPlayer)
{
Expand All @@ -1576,7 +1574,7 @@ void AIPlayer::Tick(RunListEvent* ev)

if (pPlayer->nLives && nNetTime)
{
if (nAction != 20)
if (pPlayer->nAction != 20)
{
pPlayerActor->spr.picnum = seq_GetSeqPicnum(kSeqJoe, 120, 0);
pPlayerActor->spr.cstat = 0;
Expand All @@ -1603,7 +1601,7 @@ void AIPlayer::Tick(RunListEvent* ev)
CheckAmbience(pLocalEyeSect);
}

int var_AC = SeqOffsets[pPlayer->nSeq] + PlayerSeq[nAction].a;
int var_AC = SeqOffsets[pPlayer->nSeq] + PlayerSeq[pPlayer->nAction].a;

seq_MoveSequence(pPlayerActor, var_AC, pPlayer->nSeqSize);
pPlayer->nSeqSize++;
Expand Down

0 comments on commit a6cec3d

Please sign in to comment.