Skip to content

Commit

Permalink
- Exhumed: Fix moving block sound setup to match PowerslaveGDX.
Browse files Browse the repository at this point in the history
* Setup we had looked wrong by comparison, and it eliminates the last goto in the player tick code!
  • Loading branch information
mjr4077au committed Mar 24, 2023
1 parent 62de240 commit 7fe8269
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions source/games/exhumed/src/player.cpp
Expand Up @@ -752,7 +752,7 @@ void AIPlayer::Damage(RunListEvent* ev)
//
//---------------------------------------------------------------------------

bool CheckMovingBlocks(Player* const pPlayer, Collision& nMove, DVector3& spr_pos, sectortype* spr_sect)
static void CheckMovingBlocks(Player* const pPlayer, Collision& nMove, DVector3& spr_pos, sectortype* spr_sect)
{
const auto pPlayerActor = pPlayer->pActor;
const double zz = pPlayerActor->vel.Z;
Expand Down Expand Up @@ -788,10 +788,10 @@ bool CheckMovingBlocks(Player* const pPlayer, Collision& nMove, DVector3& spr_po
setsectinterpolate(sect);
MoveSector(sect, nMyAngle, vel);

if (pPlayer->nPlayerPushSound <= -1)
if (pPlayer->nPlayerPushSound == -1)
{
pPlayer->nPlayerPushSound = 1;
int nBlock = pPlayer->pPlayerPushSect->extra;
const int nBlock = pPlayer->pPlayerPushSect->extra;
pPlayer->nPlayerPushSound = nBlock;
DExhumedActor* pBlockActor = sBlockInfo[nBlock].pActor;

D3PlayFX(StaticSound[kSound23], pBlockActor, 0x4000);
Expand All @@ -803,11 +803,18 @@ bool CheckMovingBlocks(Player* const pPlayer, Collision& nMove, DVector3& spr_po
}

movesprite(pPlayerActor, vel, zz, -20, CLIPMASK0);
return true;
}
else if (pPlayer->nPlayerPushSound != -1)
{
if (pPlayer->pPlayerPushSect != nullptr)
{
StopActorSound(sBlockInfo[pPlayer->pPlayerPushSect->extra].pActor);
}

pPlayer->nPlayerPushSound = -1;
}
}
}
return false;
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1324,22 +1331,9 @@ void AIPlayer::Tick(RunListEvent* ev)
}
}

if (CheckMovingBlocks(pPlayer, nMove, spr_pos, spr_sect))
goto sectdone;
}

// loc_1AB46:
if (pPlayer->nPlayerPushSound > -1)
{
if (pPlayer->pPlayerPushSect != nullptr)
{
StopActorSound(sBlockInfo[pPlayer->pPlayerPushSect->extra].pActor);
}

pPlayer->nPlayerPushSound = -1;
CheckMovingBlocks(pPlayer, nMove, spr_pos, spr_sect);
}

sectdone:
if (!pPlayer->bPlayerPan && !pPlayer->bLockPan)
{
pPlayer->nDestVertPan = maphoriz((pPlayerActor->spr.pos.Z - spr_pos.Z) * 2.);
Expand Down

0 comments on commit 7fe8269

Please sign in to comment.