mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Exhumed: Change doPlayerMovingBlocks()
to do an early return instead of nested branches.
This commit is contained in:
parent
838aebdfb7
commit
b6c3753d3a
1 changed files with 26 additions and 34 deletions
|
@ -1263,46 +1263,38 @@ static void doPlayerMovingBlocks(Player* const pPlayer, const Collision& nMove,
|
||||||
nNormal = nMove.hitWall->normalAngle();
|
nNormal = nMove.hitWall->normalAngle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// moving blocks - move this to a separate function!
|
if (!sect)
|
||||||
if (sect != nullptr)
|
|
||||||
{
|
{
|
||||||
const auto nDiff = absangle(nNormal, pPlayerActor->spr.Angles.Yaw + DAngle180);
|
return;
|
||||||
|
}
|
||||||
|
else if ((sect->hitag == 45) && bTouchFloor && absangle(nNormal, pPlayerActor->spr.Angles.Yaw + DAngle180) <= DAngle45)
|
||||||
|
{
|
||||||
|
pPlayer->pPlayerPushSect = sect;
|
||||||
|
DVector2 vel = pPlayer->vel;
|
||||||
|
const auto nMyAngle = vel.Angle().Normalized360();
|
||||||
|
|
||||||
if ((sect->hitag == 45) && bTouchFloor && nDiff <= DAngle45)
|
setsectinterpolate(sect);
|
||||||
|
MoveSector(sect, nMyAngle, vel);
|
||||||
|
|
||||||
|
if (pPlayer->nPlayerPushSound == -1)
|
||||||
{
|
{
|
||||||
pPlayer->pPlayerPushSect = sect;
|
pPlayer->nPlayerPushSound = sect->extra;
|
||||||
|
D3PlayFX(StaticSound[kSound23], sBlockInfo[pPlayer->nPlayerPushSound].pActor, 0x4000);
|
||||||
DVector2 vel = pPlayer->vel;
|
|
||||||
auto nMyAngle = vel.Angle().Normalized360();
|
|
||||||
|
|
||||||
setsectinterpolate(sect);
|
|
||||||
MoveSector(sect, nMyAngle, vel);
|
|
||||||
|
|
||||||
if (pPlayer->nPlayerPushSound == -1)
|
|
||||||
{
|
|
||||||
const int nBlock = pPlayer->pPlayerPushSect->extra;
|
|
||||||
pPlayer->nPlayerPushSound = nBlock;
|
|
||||||
DExhumedActor* pBlockActor = sBlockInfo[nBlock].pActor;
|
|
||||||
|
|
||||||
D3PlayFX(StaticSound[kSound23], pBlockActor, 0x4000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPlayerActor->spr.pos = spr_pos;
|
|
||||||
ChangeActorSect(pPlayerActor, spr_sect);
|
|
||||||
}
|
|
||||||
|
|
||||||
movesprite(pPlayerActor, vel, spr_vel.Z, -20, CLIPMASK0);
|
|
||||||
}
|
}
|
||||||
else if (pPlayer->nPlayerPushSound != -1)
|
else
|
||||||
{
|
{
|
||||||
if (pPlayer->pPlayerPushSect != nullptr)
|
pPlayerActor->spr.pos = spr_pos;
|
||||||
{
|
ChangeActorSect(pPlayerActor, spr_sect);
|
||||||
StopActorSound(sBlockInfo[pPlayer->pPlayerPushSect->extra].pActor);
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->nPlayerPushSound = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
movesprite(pPlayerActor, vel, spr_vel.Z, -20, CLIPMASK0);
|
||||||
|
}
|
||||||
|
else if (pPlayer->nPlayerPushSound != -1)
|
||||||
|
{
|
||||||
|
if (pPlayer->pPlayerPushSect != nullptr)
|
||||||
|
StopActorSound(sBlockInfo[pPlayer->pPlayerPushSect->extra].pActor);
|
||||||
|
|
||||||
|
pPlayer->nPlayerPushSound = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue