mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- Duke: Clean up player/actor accesses in all input look functions.
This commit is contained in:
parent
8e2d4a3f52
commit
0e1520ab1f
4 changed files with 52 additions and 52 deletions
|
@ -106,12 +106,12 @@ int makepainsounds(DDukePlayer* const p, int type);
|
|||
void playerCrouch(DDukePlayer* const p);
|
||||
void playerJump(DDukePlayer* const p, double fz, double cz);
|
||||
|
||||
void checklook(int snum, ESyncBits actions);
|
||||
void playerCenterView(int snum);
|
||||
void playerLookUp(int snum, ESyncBits actions);
|
||||
void playerLookDown(int snum, ESyncBits actions);
|
||||
void playerAimUp(int snum, ESyncBits actions);
|
||||
void playerAimDown(int snum, ESyncBits actions);
|
||||
void checklook(DDukePlayer* const p, ESyncBits actions);
|
||||
void playerCenterView(DDukePlayer* const p);
|
||||
void playerLookUp(DDukePlayer* const p, ESyncBits actions);
|
||||
void playerLookDown(DDukePlayer* const p, ESyncBits actions);
|
||||
void playerAimUp(DDukePlayer* const p, ESyncBits actions);
|
||||
void playerAimDown(DDukePlayer* const p, ESyncBits actions);
|
||||
DDukeActor* aim(DDukeActor* s, int aang, bool force = true, bool* b = nullptr);
|
||||
DDukeActor* aim_(DDukeActor* actor, DDukeActor* weapon, double aimangle, bool* b = nullptr);
|
||||
void shoot(DDukeActor* actor, PClass* cls);
|
||||
|
|
|
@ -819,15 +819,15 @@ void DDukePlayer::playerweaponsway(double xvel)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void checklook(int snum, ESyncBits actions)
|
||||
void checklook(DDukePlayer* const p, ESyncBits actions)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
const auto pact = p->GetActor();
|
||||
|
||||
if ((actions & SB_LOOK_LEFT) && !p->OnMotorcycle)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKLEFT, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, p->pnum);
|
||||
OnEvent(EVENT_LOOKLEFT, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() != 0)
|
||||
{
|
||||
actions &= ~SB_LOOK_LEFT;
|
||||
}
|
||||
|
@ -835,9 +835,9 @@ void checklook(int snum, ESyncBits actions)
|
|||
|
||||
if ((actions & SB_LOOK_RIGHT) && !p->OnMotorcycle)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKRIGHT, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, p->pnum);
|
||||
OnEvent(EVENT_LOOKRIGHT, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() != 0)
|
||||
{
|
||||
actions &= ~SB_LOOK_RIGHT;
|
||||
}
|
||||
|
@ -850,16 +850,16 @@ void checklook(int snum, ESyncBits actions)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void playerCenterView(int snum)
|
||||
void playerCenterView(DDukePlayer* const p)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_RETURNTOCENTER, 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_RETURNTOCENTER, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() == 0)
|
||||
{
|
||||
p->cmd.ucmd.actions |= SB_CENTERVIEW;
|
||||
p->cmd.ucmd.ang.Pitch = nullAngle;
|
||||
setForcedSyncInput(snum);
|
||||
setForcedSyncInput(p->pnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -867,12 +867,12 @@ void playerCenterView(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
void playerLookUp(int snum, ESyncBits actions)
|
||||
void playerLookUp(DDukePlayer* const p, ESyncBits actions)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKUP, 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_LOOKUP, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() == 0)
|
||||
{
|
||||
p->cmd.ucmd.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
@ -882,12 +882,12 @@ void playerLookUp(int snum, ESyncBits actions)
|
|||
}
|
||||
}
|
||||
|
||||
void playerLookDown(int snum, ESyncBits actions)
|
||||
void playerLookDown(DDukePlayer* const p, ESyncBits actions)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKDOWN, 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_LOOKDOWN, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() == 0)
|
||||
{
|
||||
p->cmd.ucmd.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
@ -897,23 +897,23 @@ void playerLookDown(int snum, ESyncBits actions)
|
|||
}
|
||||
}
|
||||
|
||||
void playerAimUp(int snum, ESyncBits actions)
|
||||
void playerAimUp(DDukePlayer* const p, ESyncBits actions)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_AIMUP, 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_AIMUP, p->pnum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() != 0)
|
||||
{
|
||||
p->cmd.ucmd.actions &= ~SB_AIM_UP;
|
||||
}
|
||||
}
|
||||
|
||||
void playerAimDown(int snum, ESyncBits actions)
|
||||
void playerAimDown(DDukePlayer* const p, ESyncBits actions)
|
||||
{
|
||||
auto p = getPlayer(snum);
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_AIMDOWN, snum, p->GetActor(), -1); // due to a typo in WW2GI's CON files this is the same as EVENT_AIMUP.
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
||||
const auto pact = p->GetActor();
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, p->pnum);
|
||||
OnEvent(EVENT_AIMDOWN, p->pnum, pact, -1); // due to a typo in WW2GI's CON files this is the same as EVENT_AIMUP.
|
||||
if (GetGameVarID(g_iReturnVarID, pact, p->pnum).value() != 0)
|
||||
{
|
||||
p->cmd.ucmd.actions &= ~SB_AIM_DOWN;
|
||||
}
|
||||
|
|
|
@ -1671,7 +1671,7 @@ void processinput_d(int snum)
|
|||
|
||||
doubvel = TICSPERFRAME;
|
||||
|
||||
checklook(snum,actions);
|
||||
checklook(p, actions);
|
||||
p->Angles.doViewYaw(&p->cmd.ucmd);
|
||||
|
||||
p->updatecentering(snum);
|
||||
|
@ -1916,23 +1916,23 @@ HORIZONLY:
|
|||
// center_view
|
||||
if (actions & SB_CENTERVIEW || (p->hard_landing && (cl_dukepitchmode & kDukePitchLandingRecenter)))
|
||||
{
|
||||
playerCenterView(snum);
|
||||
playerCenterView(p);
|
||||
}
|
||||
else if ((actions & SB_LOOK_UP) == SB_LOOK_UP)
|
||||
{
|
||||
playerLookUp(snum, actions);
|
||||
playerLookUp(p, actions);
|
||||
}
|
||||
else if ((actions & SB_LOOK_DOWN) == SB_LOOK_DOWN)
|
||||
{
|
||||
playerLookDown(snum, actions);
|
||||
playerLookDown(p, actions);
|
||||
}
|
||||
else if ((actions & SB_LOOK_UP) == SB_AIM_UP)
|
||||
{
|
||||
playerAimUp(snum, actions);
|
||||
playerAimUp(p, actions);
|
||||
}
|
||||
else if ((actions & SB_LOOK_DOWN) == SB_AIM_DOWN)
|
||||
{ // aim_down
|
||||
playerAimDown(snum, actions);
|
||||
playerAimDown(p, actions);
|
||||
}
|
||||
|
||||
p->Angles.doPitchInput(&p->cmd.ucmd);
|
||||
|
|
|
@ -2482,7 +2482,7 @@ void processinput_r(int snum)
|
|||
|
||||
doubvel = TICSPERFRAME;
|
||||
|
||||
checklook(snum, actions);
|
||||
checklook(p, actions);
|
||||
p->Angles.doViewYaw(&p->cmd.ucmd);
|
||||
p->apply_seasick();
|
||||
|
||||
|
@ -2865,23 +2865,23 @@ HORIZONLY:
|
|||
|
||||
if (actions & SB_CENTERVIEW || (p->hard_landing && (cl_dukepitchmode & kDukePitchLandingRecenter)))
|
||||
{
|
||||
playerCenterView(snum);
|
||||
playerCenterView(p);
|
||||
}
|
||||
else if ((actions & SB_LOOK_UP) == SB_LOOK_UP)
|
||||
{
|
||||
playerLookUp(snum, actions);
|
||||
playerLookUp(p, actions);
|
||||
}
|
||||
else if ((actions & SB_LOOK_DOWN) == SB_LOOK_DOWN)
|
||||
{
|
||||
playerLookDown(snum, actions);
|
||||
playerLookDown(p, actions);
|
||||
}
|
||||
else if ((actions & SB_LOOK_UP) == SB_AIM_UP && !p->OnMotorcycle)
|
||||
{
|
||||
playerAimUp(snum, actions);
|
||||
playerAimUp(p, actions);
|
||||
}
|
||||
else if ((actions & SB_LOOK_DOWN) == SB_AIM_DOWN && !p->OnMotorcycle)
|
||||
{
|
||||
playerAimDown(snum, actions);
|
||||
playerAimDown(p, actions);
|
||||
}
|
||||
if (p->recoil && p->kickback_pic == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue