diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 77abc9f10..ab3fde3a9 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -59,11 +59,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) sethorizon(&pPlayer->horizon.horiz, input.q16horz, &pPlayer->input.actions, scaleAdjust); } - // temporary vals to pass through to playerProcessHelpers(). - fixed_t horiz = 0; - fixed_t target = 0; - double adjust = 0; - playerProcessHelpers(&pPlayer->q16ang, &pPlayer->angAdjust, &pPlayer->angTarget, &horiz, &adjust, &target, scaleAdjust); + playerProcessHelpers(&pPlayer->q16ang, &pPlayer->angAdjust, &pPlayer->angTarget, scaleAdjust); pPlayer->horizon.processhelpers(scaleAdjust); UpdatePlayerSpriteAngle(pPlayer); } diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index f277015e3..d9460e4f9 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1568,72 +1568,6 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn // //--------------------------------------------------------------------------- -void sethorizon2(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, double const scaleAdjust) -{ - // Calculate adjustment as true pitch (Fixed point math really sucks...) - double horizAngle = HorizToPitch(*q16horiz); - - if (q16horz) - { - *actions &= ~SB_CENTERVIEW; - horizAngle += FixedToFloat(q16horz); - } - - // this is the locked type - if (*actions & (SB_AIM_UP|SB_AIM_DOWN)) - { - *actions &= ~SB_CENTERVIEW; - double const amount = HorizToPitch(250. / GameTicRate); - - if (*actions & SB_AIM_DOWN) - horizAngle -= scaleAdjust * amount; - - if (*actions & SB_AIM_UP) - horizAngle += scaleAdjust * amount; - } - - // this is the unlocked type - if (*actions & (SB_LOOK_UP|SB_LOOK_DOWN)) - { - *actions |= SB_CENTERVIEW; - double const amount = HorizToPitch(500. / GameTicRate); - - if (*actions & SB_LOOK_DOWN) - horizAngle -= scaleAdjust * amount; - - if (*actions & SB_LOOK_UP) - horizAngle += scaleAdjust * amount; - } - - // clamp horizAngle after processing - horizAngle = clamp(horizAngle, -90, 90); - - // return to center if conditions met. - if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN))) - { - if (abs(horizAngle) > 0.1375) - { - // move horizAngle back to 0 - horizAngle += -scaleAdjust * horizAngle * (9. / GameTicRate); - } - else - { - // not looking anymore because horizAngle is back at 0 - horizAngle = 0; - *actions &= ~SB_CENTERVIEW; - } - } - - // clamp before returning - *q16horiz = clamp(PitchToHoriz(horizAngle), gi->playerHorizMin(), gi->playerHorizMax()); -} - -//--------------------------------------------------------------------------- -// -// Player's horizon function, called from game's ticker or from gi->GetInput() as required. -// -//--------------------------------------------------------------------------- - static double const aimamount = HorizToPitch(250. / GameTicRate); static double const lookamount = HorizToPitch(500. / GameTicRate); @@ -1789,40 +1723,13 @@ void playerSetAngle(fixed_t* q16ang, fixed_t* helper, double adjustment) } } -void playerAddHoriz2(fixed_t* q16horiz, double* helper, double adjustment) -{ - if (!cl_syncinput) - { - *helper += adjustment; - } - else - { - *q16horiz += FloatToFixed(adjustment); - } -} - -void playerSetHoriz2(fixed_t* q16horiz, fixed_t* helper, double adjustment) -{ - if (!cl_syncinput) - { - // Add slight offset if adjustment is coming in as absolute 0. - if (adjustment == 0) adjustment += (1. / (FRACUNIT >> 1)); - - *helper = FloatToFixed(adjustment); - } - else - { - *q16horiz = FloatToFixed(adjustment); - } -} - //--------------------------------------------------------------------------- // // Player's ticrate helper processor. // //--------------------------------------------------------------------------- -void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget, fixed_t* q16horiz, double* horizAdjust, fixed_t* horizTarget, double const scaleAdjust) +void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget, double const scaleAdjust) { // Process angle amendments from the game's ticker. if (*angTarget) @@ -1840,21 +1747,4 @@ void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget { *q16ang = (*q16ang + FloatToFixed(scaleAdjust * *angAdjust)) & 0x7FFFFFF; } - - // Process horizon amendments from the game's ticker. - if (*horizTarget) - { - fixed_t horizDelta = *horizTarget - *q16horiz; - *q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta); - - if (abs(*q16horiz - *horizTarget) < FRACUNIT) - { - *q16horiz = *horizTarget; - *horizTarget = 0; - } - } - else if (*horizAdjust) - { - *q16horiz += FloatToFixed(scaleAdjust * *horizAdjust); - } } diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index d9f3b8238..56fac6c63 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -144,13 +144,10 @@ struct PlayerHorizon void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1); void sethorizon(fixedhoriz* horiz, fixed_t const q16horz, ESyncBits* actions, double const scaleAdjust); -void sethorizon2(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, double const scaleAdjust); void applylook(fixed_t* q16ang, fixed_t* q16look_ang, fixed_t* q16rotscrnang, fixed_t* spin, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching); void playerAddAngle(fixed_t* q16ang, double* helper, double adjustment); void playerSetAngle(fixed_t* q16ang, fixed_t* helper, double adjustment); -void playerAddHoriz2(fixed_t* q16horiz, double* helper, double adjustment); -void playerSetHoriz2(fixed_t* q16horiz, fixed_t* helper, double adjustment); -void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget, fixed_t* q16horiz, double* horizAdjust, fixed_t* horizTarget, double const scaleAdjust); +void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget, double const scaleAdjust); struct UserConfig { diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index a4cd2459e..491f9a5d8 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -132,11 +132,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) sethorizon(&pPlayer->horizon.horiz, input.q16horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); } - // temporary vals to pass through to playerProcessHelpers(). - fixed_t horiz = 0; - fixed_t target = 0; - double adjust = 0; - playerProcessHelpers(&pPlayer->q16angle, &pPlayer->angAdjust, &pPlayer->angTarget, &horiz, &adjust, &target, scaleAdjust); + playerProcessHelpers(&pPlayer->q16angle, &pPlayer->angAdjust, &pPlayer->angTarget, scaleAdjust); pPlayer->horizon.processhelpers(scaleAdjust); UpdatePlayerSpriteAngle(pPlayer); } diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 9b1f1fb80..995370800 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -926,11 +926,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) sethorizon(&p->horizon.horiz, input.q16horz, &p->sync.actions, scaleAdjust); } - // temporary vals to pass through to playerProcessHelpers(). - fixed_t horiz = 0; - fixed_t target = 0; - double adjust = 0; - playerProcessHelpers(&p->q16ang, &p->angAdjust, &p->angTarget, &horiz, &adjust, &target, scaleAdjust); + playerProcessHelpers(&p->q16ang, &p->angAdjust, &p->angTarget, scaleAdjust); p->horizon.processhelpers(scaleAdjust); } diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index fdff8152c..94ce42ea0 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -230,11 +230,7 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) DoPlayerTurnTurret(pp, input.q16avel); } - // temporary vals to pass through to playerProcessHelpers(). - fixed_t horiz = 0; - fixed_t target = 0; - double adjust = 0; - playerProcessHelpers(&pp->q16ang, &pp->angAdjust, &pp->angTarget, &horiz, &adjust, &target, scaleAdjust); + playerProcessHelpers(&pp->q16ang, &pp->angAdjust, &pp->angTarget, scaleAdjust); pp->horizon.processhelpers(scaleAdjust); }