mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 15:11:04 +00:00
- Duke: Clean up player/actor accesses in playerCrouch()
.
This commit is contained in:
parent
2197128dc4
commit
443b66ea9d
4 changed files with 8 additions and 8 deletions
|
@ -103,7 +103,7 @@ int endoflevel(DDukePlayer* const p);
|
||||||
void playerisdead(DDukePlayer* const p, int psectlotag, double fz, double cz);
|
void playerisdead(DDukePlayer* const p, int psectlotag, double fz, double cz);
|
||||||
void footprints(DDukePlayer* const p);
|
void footprints(DDukePlayer* const p);
|
||||||
int makepainsounds(DDukePlayer* const p, int type);
|
int makepainsounds(DDukePlayer* const p, int type);
|
||||||
void playerCrouch(int snum);
|
void playerCrouch(DDukePlayer* const p);
|
||||||
void playerJump(int snum, double fz, double cz);
|
void playerJump(int snum, double fz, double cz);
|
||||||
|
|
||||||
void checklook(int snum, ESyncBits actions);
|
void checklook(int snum, ESyncBits actions);
|
||||||
|
|
|
@ -673,15 +673,15 @@ int timedexit(DDukePlayer* const p)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void playerCrouch(int snum)
|
void playerCrouch(DDukePlayer* const p)
|
||||||
{
|
{
|
||||||
const auto p = getPlayer(snum);
|
|
||||||
const auto pact = p->GetActor();
|
const auto pact = p->GetActor();
|
||||||
const auto nVelMoveDown = abs(p->cmd.ucmd.vel.Z * (p->cmd.ucmd.vel.Z < 0));
|
const auto nVelMoveDown = abs(p->cmd.ucmd.vel.Z * (p->cmd.ucmd.vel.Z < 0));
|
||||||
constexpr double vel = 8 + 3;
|
constexpr double vel = 8 + 3;
|
||||||
SetGameVarID(g_iReturnVarID, 0, pact, snum);
|
|
||||||
OnEvent(EVENT_CROUCH, snum, pact, -1);
|
SetGameVarID(g_iReturnVarID, 0, pact, p->pnum);
|
||||||
if (GetGameVarID(g_iReturnVarID, pact, snum).value() == 0)
|
OnEvent(EVENT_CROUCH, p->pnum, pact, -1);
|
||||||
|
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() == 0)
|
||||||
{
|
{
|
||||||
pact->spr.pos.Z += clamp(vel * !!(p->cmd.ucmd.actions & SB_CROUCH) + vel * nVelMoveDown, -vel, vel);
|
pact->spr.pos.Z += clamp(vel * !!(p->cmd.ucmd.actions & SB_CROUCH) + vel * nVelMoveDown, -vel, vel);
|
||||||
p->crack_time = CRACK_TIME;
|
p->crack_time = CRACK_TIME;
|
||||||
|
|
|
@ -767,7 +767,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
|
||||||
|
|
||||||
if ((actions & SB_CROUCH) || p->cmd.ucmd.vel.Z < 0)
|
if ((actions & SB_CROUCH) || p->cmd.ucmd.vel.Z < 0)
|
||||||
{
|
{
|
||||||
playerCrouch(snum);
|
playerCrouch(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// jumping
|
// jumping
|
||||||
|
|
|
@ -1283,7 +1283,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
|
||||||
|
|
||||||
if (((actions & SB_CROUCH) || p->cmd.ucmd.vel.Z < 0) && !p->OnMotorcycle)
|
if (((actions & SB_CROUCH) || p->cmd.ucmd.vel.Z < 0) && !p->OnMotorcycle)
|
||||||
{
|
{
|
||||||
playerCrouch(snum);
|
playerCrouch(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((actions & SB_JUMP) == 0 && !p->OnMotorcycle && p->jumping_toggle == 1)
|
if ((actions & SB_JUMP) == 0 && !p->OnMotorcycle && p->jumping_toggle == 1)
|
||||||
|
|
Loading…
Reference in a new issue