From 16cee1148b85fe52405cfdc5af08093485b87f97 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 25 Sep 2020 00:09:31 +1000 Subject: [PATCH] - Duke: Change a few ps[] to use the p alias available following changes in f4fff5ee3001177c9c6a0d76632c14dad6843dfe. --- source/games/duke/src/input.cpp | 10 +++++----- source/games/duke/src/player.cpp | 20 ++++++++++---------- source/games/duke/src/player_d.cpp | 4 ++-- source/games/duke/src/player_r.cpp | 4 ++-- source/games/duke/src/premap.cpp | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 6ed72818e..320325979 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -67,7 +67,7 @@ void hud_input(int snum) i = p->aim_mode; p->aim_mode = !PlayerInput(snum, SB_AIMMODE); if (p->aim_mode < i) - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; // Backup weapon here as hud_input() is the first function where any one of the weapon variables can change. backupweapon(p); @@ -483,7 +483,7 @@ void hud_input(int snum) OnEvent(EVENT_TURNAROUND, -1, snum, -1); if (GetGameVarID(g_iReturnVarID, -1, snum) != 0) { - ps[snum].sync.actions &= ~SB_TURNAROUND; + p->sync.actions &= ~SB_TURNAROUND; } } } @@ -963,7 +963,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle) loc.q16avel = input.q16avel = 0; } - if (p->newowner == -1 && !(ps[playerNum].sync.actions & SB_CENTERVIEW)) + if (p->newowner == -1 && !(p->sync.actions & SB_CENTERVIEW)) { loc.q16horz = clamp(loc.q16horz + input.q16horz, IntToFixed(-MAXHORIZVEL), IntToFixed(MAXHORIZVEL)); } @@ -1025,8 +1025,8 @@ static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput) // Do these in the same order as the old code. calcviewpitch(p, scaleAdjust); processq16avel(p, &input.q16avel); - applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, input.q16avel, &ps[myconnectindex].sync.actions, scaleAdjust, p->crouch_toggle || ps[myconnectindex].sync.actions & SB_CROUCH); - sethorizon(&p->q16horiz, input.q16horz, &ps[myconnectindex].sync.actions, scaleAdjust); + applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, input.q16avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH); + sethorizon(&p->q16horiz, input.q16horz, &p->sync.actions, scaleAdjust); } playerProcessHelpers(&p->q16ang, &p->angAdjust, &p->angTarget, &p->q16horiz, &p->horizAdjust, &p->horizTarget, scaleAdjust); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 779ab6274..94115c9d3 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -165,7 +165,7 @@ void forceplayerangle(int snum) n = 128 - (krand() & 255); playerAddHoriz(&p->q16horiz, &p->horizAdjust, 64); - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; p->setlookang(n >> 1); p->setrotscrnang(n >> 1); } @@ -407,7 +407,7 @@ void dokneeattack(int snum, int pi, const std::initializer_list & respawnli { p->knee_incs++; playerAddHoriz(&p->q16horiz, &p->horizAdjust, -48); - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; if (p->knee_incs > 15) { p->knee_incs = 0; @@ -961,11 +961,11 @@ void playerCenterView(int snum) OnEvent(EVENT_RETURNTOCENTER, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; } else { - ps[snum].sync.actions &= ~SB_CENTERVIEW; + p->sync.actions &= ~SB_CENTERVIEW; } } @@ -976,11 +976,11 @@ void playerLookUp(int snum, ESyncBits actions) OnEvent(EVENT_LOOKUP, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; } else { - ps[snum].sync.actions &= ~SB_LOOK_UP; + p->sync.actions &= ~SB_LOOK_UP; } } @@ -991,11 +991,11 @@ void playerLookDown(int snum, ESyncBits actions) OnEvent(EVENT_LOOKDOWN, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; } else { - ps[snum].sync.actions &= ~SB_LOOK_DOWN; + p->sync.actions &= ~SB_LOOK_DOWN; } } @@ -1006,7 +1006,7 @@ void playerAimUp(int snum, ESyncBits actions) OnEvent(EVENT_AIMUP, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0) { - ps[snum].sync.actions &= ~SB_AIM_UP; + p->sync.actions &= ~SB_AIM_UP; } } @@ -1017,7 +1017,7 @@ void playerAimDown(int snum, ESyncBits actions) OnEvent(EVENT_AIMDOWN, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0) { - ps[snum].sync.actions &= ~SB_AIM_DOWN; + p->sync.actions &= ~SB_AIM_DOWN; } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index cba8ba845..089870db4 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2840,7 +2840,7 @@ void processinput_d(int snum) // may still be needed later for demo recording processq16avel(p, &sb_avel); - applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &ps[snum].sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); + applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); } if (p->spritebridge == 0) @@ -3072,7 +3072,7 @@ HORIZONLY: if (cl_syncinput) { - sethorizon(&p->q16horiz, PlayerHorizon(snum), &ps[snum].sync.actions, 1); + sethorizon(&p->q16horiz, PlayerHorizon(snum), &p->sync.actions, 1); } checkhardlanding(p); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 50a54f2a7..6ef71f6e4 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3741,7 +3741,7 @@ void processinput_r(int snum) // may still be needed later for demo recording processq16avel(p, &sb_avel); - applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &ps[snum].sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); + applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); apply_seasick(p, 1); } @@ -4097,7 +4097,7 @@ HORIZONLY: if (cl_syncinput) { - sethorizon(&p->q16horiz, PlayerHorizon(snum), &ps[snum].sync.actions, 1); + sethorizon(&p->q16horiz, PlayerHorizon(snum), &p->sync.actions, 1); } checkhardlanding(p); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 4d6a3ab8b..4503b20a6 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -119,7 +119,7 @@ void resetplayerstats(int snum) p->bobcounter = 0; p->on_ground = 0; p->player_par = 0; - ps[snum].sync.actions |= SB_CENTERVIEW; + p->sync.actions |= SB_CENTERVIEW; p->airleft = 15*26; p->rapid_fire_hold = 0; p->toggle_key_flag = 0;