mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- Duke: Clean up player/actor accesses in playerJump()
.
This commit is contained in:
parent
f135097193
commit
2225fea10c
4 changed files with 11 additions and 14 deletions
|
@ -104,7 +104,7 @@ void playerisdead(DDukePlayer* const p, int psectlotag, double fz, double cz);
|
|||
void footprints(DDukePlayer* const p);
|
||||
int makepainsounds(DDukePlayer* const p, int type);
|
||||
void playerCrouch(DDukePlayer* const p);
|
||||
void playerJump(int snum, double fz, double cz);
|
||||
void playerJump(DDukePlayer* const p, double fz, double cz);
|
||||
|
||||
void checklook(int snum, ESyncBits actions);
|
||||
void playerCenterView(int snum);
|
||||
|
|
|
@ -688,23 +688,20 @@ void playerCrouch(DDukePlayer* const p)
|
|||
}
|
||||
}
|
||||
|
||||
void playerJump(int snum, double floorz, double ceilingz)
|
||||
void playerJump(DDukePlayer* const p, double floorz, double ceilingz)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
if (p->jumping_toggle == 0 && p->jumping_counter == 0)
|
||||
if (p->jumping_toggle == 0 && p->jumping_counter == 0 && (floorz - ceilingz) > 56)
|
||||
{
|
||||
if ((floorz - ceilingz) > 56)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_JUMP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
||||
const auto pact = p->GetActor();
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, p->pnum);
|
||||
OnEvent(EVENT_JUMP, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() == 0)
|
||||
{
|
||||
p->jumping_counter = 1;
|
||||
p->jumping_toggle = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -776,7 +776,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
|
|||
|
||||
else if ((actions & SB_JUMP))
|
||||
{
|
||||
playerJump(snum, floorz, ceilingz);
|
||||
playerJump(p, floorz, ceilingz);
|
||||
}
|
||||
|
||||
if (p->jumping_counter && (actions & SB_JUMP) == 0)
|
||||
|
|
|
@ -1291,7 +1291,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
|
|||
|
||||
else if ((actions & SB_JUMP) && !p->OnMotorcycle && p->jumping_toggle == 0)
|
||||
{
|
||||
playerJump(snum, floorz, ceilingz);
|
||||
playerJump(p, floorz, ceilingz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue