From 55f688b13f2ede3541003790ae2da12f4dd2507f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 08:00:50 +1000 Subject: [PATCH] - SW: Rename `q16horz` to `q16horiz` and `q16aimvel` to `q16horz` for consistency and to avoid confusion down the track. --- source/core/packet.h | 2 +- source/sw/src/input.cpp | 18 +++++++++--------- source/sw/src/network.cpp | 12 ++++++------ source/sw/src/player.cpp | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/core/packet.h b/source/core/packet.h index 2727a960b..15f0afb0d 100644 --- a/source/core/packet.h +++ b/source/core/packet.h @@ -173,7 +173,7 @@ struct InputPacket int16_t fvel; fix16_t q16avel; fix16_t q16horz; - fix16_t q16aimvel; // only used by SW + fix16_t q16horiz; // only used by SW fix16_t q16ang; // only used by SW // Making this a union lets some constructs fail. Since these names are transitional only the added memory use doesn't really matter. diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 06e386318..05d610851 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -75,7 +75,7 @@ double elapsedInputTicks; double scaleAdjustmentToInterval(double x) { return x * (120 / synctics) / (1000.0 / elapsedInputTicks); } void DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel); -void DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel); +void DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16horz); void GameInterface::ResetFollowPos(bool) @@ -195,7 +195,7 @@ getinput(InputPacket *loc, SWBOOL tied) keymove = 0; int32_t svel = 0, vel = 0; - fix16_t q16aimvel = 0, q16angvel = 0; + fix16_t q16horz = 0, q16angvel = 0; if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) { @@ -209,14 +209,14 @@ getinput(InputPacket *loc, SWBOOL tied) } if (mouseaim) - q16aimvel = fix16_ssub(q16aimvel, fix16_from_float(info.mousey / aimvelScale)); + q16horz = fix16_ssub(q16horz, fix16_from_float(info.mousey / aimvelScale)); else vel -= (info.mousey * ticrateScale) * 8.f; if (in_mouseflip) - q16aimvel = -q16aimvel; + q16horz = -q16horz; - q16aimvel -= fix16_from_dbl(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale)); + q16horz -= fix16_from_dbl(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale)); svel -= info.dx * keymove; vel -= info.dz * keymove; @@ -276,13 +276,13 @@ getinput(InputPacket *loc, SWBOOL tied) vel += -keymove; q16angvel = fix16_clamp(q16angvel, -fix16_from_int(MAXANGVEL), fix16_from_int(MAXANGVEL)); - q16aimvel = fix16_clamp(q16aimvel, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); + q16horz = fix16_clamp(q16horz, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); void DoPlayerTeleportPause(PLAYERp pp); if (PedanticMode) { q16angvel = fix16_floor(q16angvel); - q16aimvel = fix16_floor(q16aimvel); + q16horz = fix16_floor(q16horz); } else { @@ -291,7 +291,7 @@ getinput(InputPacket *loc, SWBOOL tied) if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) DoPlayerTurn(pp, &pp->camq16ang, q16angvel); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, &pp->camq16horiz, q16aimvel); + DoPlayerHorizon(pp, &pp->camq16horiz, q16horz); pp->oq16ang += pp->camq16ang - prevcamq16ang; pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; } @@ -315,7 +315,7 @@ getinput(InputPacket *loc, SWBOOL tied) } loc->q16avel += q16angvel; - loc->q16aimvel += q16aimvel; + loc->q16horz += q16horz; if (!CommEnabled) { diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index e1fa0c5f9..673c7cb0c 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -80,9 +80,9 @@ typedef struct int32_t fvel; int32_t svel; fix16_t q16avel; - fix16_t q16aimvel; - fix16_t q16ang; fix16_t q16horz; + fix16_t q16ang; + fix16_t q16horiz; int32_t bits; } SW_AVERAGE_PACKET; @@ -200,9 +200,9 @@ UpdateInputs(void) AveragePacket.fvel += loc.fvel; AveragePacket.svel += loc.svel; AveragePacket.q16avel += loc.q16avel; - AveragePacket.q16aimvel += loc.q16aimvel; + AveragePacket.q16horz += loc.q16horz; AveragePacket.q16ang = Player[myconnectindex].camq16ang; - AveragePacket.q16horz = Player[myconnectindex].camq16horiz; + AveragePacket.q16horiz = Player[myconnectindex].camq16horiz; SET(AveragePacket.bits, loc.bits); Bmemset(&loc, 0, sizeof(loc)); @@ -222,9 +222,9 @@ UpdateInputs(void) loc.fvel = AveragePacket.fvel / MovesPerPacket; loc.svel = AveragePacket.svel / MovesPerPacket; loc.q16avel = fix16_div(AveragePacket.q16avel, fix16_from_int(MovesPerPacket)); - loc.q16aimvel = fix16_div(AveragePacket.q16aimvel, fix16_from_int(MovesPerPacket)); + loc.q16horz = fix16_div(AveragePacket.q16horz, fix16_from_int(MovesPerPacket)); loc.q16ang = AveragePacket.q16ang; - loc.q16horz = AveragePacket.q16horz; + loc.q16horiz = AveragePacket.q16horiz; loc.bits = AveragePacket.bits; memset(&AveragePacket, 0, sizeof(AveragePacket)); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index bfe7944e6..a186c6695 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1911,7 +1911,7 @@ PlayerAutoLook(PLAYERp pp) extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; void -DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) +DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16horz) { int i; #define HORIZ_SPEED (16) @@ -1922,7 +1922,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) if (!PedanticMode && (pq16horiz == &pp->q16horiz)) { SET(pp->Flags2, PF2_INPUT_CAN_AIM); - pp->q16horiz = pp->input.q16horz; + pp->q16horiz = pp->input.q16horiz; if ((pp == &Player[myconnectindex]) || (pp == ppp)) // No coop view? pp->oq16horiz = pp->q16horiz; return; @@ -1932,9 +1932,9 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) if (cl_slopetilting) PlayerAutoLook(pp); - if (q16aimvel) + if (q16horz) { - pp->q16horizbase += q16aimvel; + pp->q16horizbase += q16horz; SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); } @@ -2717,7 +2717,7 @@ DoPlayerMove(PLAYERp pp) DoPlayerSetWadeDepth(pp); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA)) { @@ -2925,7 +2925,7 @@ DoPlayerMoveBoat(PLAYERp pp) OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); } void DoTankTreads(PLAYERp pp) @@ -3404,7 +3404,7 @@ DoPlayerMoveTank(PLAYERp pp) OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); DoTankTreads(pp); } @@ -3421,7 +3421,7 @@ DoPlayerMoveTurret(PLAYERp pp) OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->sop->xmid, pp->sop->ymid); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); } void @@ -3998,7 +3998,7 @@ DoPlayerClimb(PLAYERp pp) sp->z = pp->posz + PLAYER_HEIGHT; changespritesect(pp->PlayerSprite, pp->cursectnum); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); if (FAF_ConnectArea(pp->cursectnum)) { @@ -7426,7 +7426,7 @@ void ChopsCheck(PLAYERp pp) { if (!M_Active() && !TEST(pp->Flags, PF_DEAD) && !pp->sop_riding && numplayers <= 1) { - if ((pp->input.bits|pp->input.fvel|pp->input.svel|pp->input.q16avel|pp->input.q16aimvel) || + if ((pp->input.bits|pp->input.fvel|pp->input.svel|pp->input.q16avel|pp->input.q16horz) || TEST(pp->Flags, PF_CLIMBING|PF_FALLING|PF_DIVING)) { // Hit a input key or other reason to stop chops