From ade1a805153089a4b57b957e76b4ca98dc9c9d52 Mon Sep 17 00:00:00 2001
From: Mitchell Richters <mjr4077au@gmail.com>
Date: Sat, 7 Nov 2020 18:25:06 +1100
Subject: [PATCH] - gameinput.cpp: Remove crouch bool from `applylook()` since
 we can now just rely in the actions bitfield that's already incoming as
 required and default `scaleAdjust` in the prototype to `1`.

---
 source/blood/src/controls.cpp      | 2 +-
 source/blood/src/player.cpp        | 4 ++--
 source/core/gameinput.cpp          | 4 ++--
 source/core/gameinput.h            | 4 ++--
 source/exhumed/src/input.cpp       | 2 +-
 source/exhumed/src/player.cpp      | 4 ++--
 source/games/duke/src/input.cpp    | 2 +-
 source/games/duke/src/player_d.cpp | 4 ++--
 source/games/duke/src/player_r.cpp | 4 ++--
 source/sw/src/player.cpp           | 2 +-
 10 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp
index 324d90090..6888bbba4 100644
--- a/source/blood/src/controls.cpp
+++ b/source/blood/src/controls.cpp
@@ -54,7 +54,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
         // Perform unsynchronised angle/horizon if not dead.
         if (gView->pXSprite->health != 0)
         {
-            applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
+            applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust);
             sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
         }
 
diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp
index 661e90a44..d024b2a0f 100644
--- a/source/blood/src/player.cpp
+++ b/source/blood/src/player.cpp
@@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
 
     if (cl_syncinput)
     {
-        applylook(&pPlayer->angle, pInput->avel, &pInput->actions, 1, pPlayer->posture != 0);
+        applylook(&pPlayer->angle, pInput->avel, &pInput->actions);
         UpdatePlayerSpriteAngle(pPlayer);
     }
 
@@ -1569,7 +1569,7 @@ void ProcessInput(PLAYER *pPlayer)
 
     if (cl_syncinput)
     {
-        sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions, 1);
+        sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions);
     }
 
     int nSector = pSprite->sectnum;
diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp
index 431b8c720..0e771b16e 100644
--- a/source/core/gameinput.cpp
+++ b/source/core/gameinput.cpp
@@ -298,7 +298,7 @@ void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double
 //
 //---------------------------------------------------------------------------
 
-void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching)
+void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust)
 {
 	// return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit
 	angle->rotscrnang -= bamlook(xs_CRoundToInt(scaleAdjust * angle->rotscrnang.asbam() * (15. / GameTicRate)));
@@ -335,7 +335,7 @@ void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double
 	if (angle->spin.asbam() < 0)
 	{
 		// return spin to 0
-		lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!crouching ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
+		lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
 		angle->spin += add;
 		if (angle->spin.asbam() > 0)
 		{
diff --git a/source/core/gameinput.h b/source/core/gameinput.h
index 3e82f6054..a0252e0cd 100644
--- a/source/core/gameinput.h
+++ b/source/core/gameinput.h
@@ -193,5 +193,5 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl
 FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def);
 
 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, float const horz, ESyncBits* actions, double const scaleAdjust);
-void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
+void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust = 1);
+void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust = 1);
diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp
index b53770bb7..2158f9c35 100644
--- a/source/exhumed/src/input.cpp
+++ b/source/exhumed/src/input.cpp
@@ -124,7 +124,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
     {
         if (!nFreeze)
         {
-            applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
+            applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
             sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
         }
 
diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp
index 632d46a59..f3725f8e0 100644
--- a/source/exhumed/src/player.cpp
+++ b/source/exhumed/src/player.cpp
@@ -921,7 +921,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
             if (cl_syncinput)
             {
                 Player* pPlayer = &PlayerList[nPlayer];
-                applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080);
+                applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions);
                 UpdatePlayerSpriteAngle(pPlayer);
             }
 
@@ -2640,7 +2640,7 @@ loc_1BD2E:
                 if (cl_syncinput)
                 {
                     Player* pPlayer = &PlayerList[nPlayer];
-                    sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions, 1);
+                    sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions);
                 }
             }
             else // else, player's health is less than 0
diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp
index b3724a219..20ab0129f 100644
--- a/source/games/duke/src/input.cpp
+++ b/source/games/duke/src/input.cpp
@@ -887,7 +887,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
 			// Do these in the same order as the old code.
 			calcviewpitch(p, scaleAdjust);
 			processavel(p, &input.avel);
-			applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust, p->sync.actions & SB_CROUCH);
+			applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust);
 			sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
 		}
 
diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp
index 6a2066a29..4d721ed50 100644
--- a/source/games/duke/src/player_d.cpp
+++ b/source/games/duke/src/player_d.cpp
@@ -2892,7 +2892,7 @@ void processinput_d(int snum)
 		// may still be needed later for demo recording
 
 		processavel(p, &sb_avel);
-		applylook(&p->angle, sb_avel, &p->sync.actions, 1, actions & SB_CROUCH);
+		applylook(&p->angle, sb_avel, &p->sync.actions);
 	}
 
 	if (p->spritebridge == 0)
@@ -3126,7 +3126,7 @@ HORIZONLY:
 
 	if (cl_syncinput)
 	{
-		sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions, 1);
+		sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
 	}
 
 	checkhardlanding(p);
diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp
index cb12bf079..ba97ad276 100644
--- a/source/games/duke/src/player_r.cpp
+++ b/source/games/duke/src/player_r.cpp
@@ -3635,7 +3635,7 @@ void processinput_r(int snum)
 		// may still be needed later for demo recording
 
 		processavel(p, &sb_avel);
-		applylook(&p->angle, sb_avel, &p->sync.actions, 1, actions & SB_CROUCH);
+		applylook(&p->angle, sb_avel, &p->sync.actions);
 		apply_seasick(p, 1);
 	}
 
@@ -3998,7 +3998,7 @@ HORIZONLY:
 
 	if (cl_syncinput)
 	{
-		sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions, 1);
+		sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
 	}
 
 	checkhardlanding(p);
diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp
index ff715be03..90eb5b50d 100644
--- a/source/sw/src/player.cpp
+++ b/source/sw/src/player.cpp
@@ -1521,7 +1521,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
 void
 DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust)
 {
-    applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust, pp->input.actions & SB_CROUCH);
+    applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust);
     UpdatePlayerSpriteAngle(pp);
 }