From 9c56dfffe0fec38942a226de71b2e50c0184fe38 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 16 Sep 2020 20:08:56 +1000 Subject: [PATCH] - Blood: Apply horizon input outside of `pPlayer->q16look` and fix some incorrectly declared types. * Looking up/down is a bit rough at first as q16look is disproportionate to where the player is currently looking. * Won't be an issue with a unified horizon algorithm in the backend. --- source/blood/src/controls.cpp | 8 ++------ source/blood/src/player.cpp | 4 ++-- source/blood/src/player.h | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index ed650be3b..497d147e4 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -106,10 +106,6 @@ static void GetInputInternal(ControlInfo* const hidInput) static int32_t lastInputClock; // MED int32_t const elapsedTics = gFrameClock - lastInputClock; - // Blood's q16mlook scaling is different from the other games, therefore use the below constant to attenuate - // the speed to match the other games. - float const mlookScale = 3.25f; - lastInputClock = gFrameClock; if (turnLeft || turnRight) @@ -138,14 +134,14 @@ static void GetInputInternal(ControlInfo* const hidInput) input.fvel -= xs_CRoundToInt(scaleAdjust * (hidInput->dz * keyMove)); if (mouseaim) - input.q16horz += FloatToFixed(hidInput->mousey / mlookScale); + input.q16horz += FloatToFixed(hidInput->mousey); else input.fvel -= xs_CRoundToInt(hidInput->mousey * 64.); if (!in_mouseflip) input.q16horz = -input.q16horz; - input.q16horz -= FloatToFixed(scaleAdjust * (hidInput->dpitch / mlookScale)); + input.q16horz -= FloatToFixed(scaleAdjust * hidInput->dpitch); gInput.fvel = clamp(gInput.fvel + input.fvel, -2048, 2048); gInput.svel = clamp(gInput.svel + input.svel, -2048, 2048); diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 1bf1b3e29..a2982cfc1 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -1363,7 +1363,7 @@ void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust pPlayer->q16look = max(pPlayer->q16look - FloatToFixed(scaleAdjust * 4.), IntToFixed(-60)); } - pPlayer->q16look = clamp(pPlayer->q16look + q16horz, IntToFixed(-60), IntToFixed(60)); + pPlayer->q16look = clamp(pPlayer->q16look, IntToFixed(-60), IntToFixed(60)); if (pPlayer->q16look > 0) { @@ -1375,7 +1375,7 @@ void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust } else { - pPlayer->q16horiz = 0; + pPlayer->q16horiz = clamp(pPlayer->q16horiz + q16horz, IntToFixed(-179), IntToFixed(119)); } } diff --git a/source/blood/src/player.h b/source/blood/src/player.h index 6aa96752a..0a4cdd947 100644 --- a/source/blood/src/player.h +++ b/source/blood/src/player.h @@ -109,8 +109,8 @@ struct PLAYER int zWeapon; int zWeaponVel; fixed_t q16look; - int q16horiz; // horiz - int q16slopehoriz; // horizoff + fixed_t q16horiz; // horiz + fixed_t q16slopehoriz; // horizoff int slope; bool isUnderwater; bool hasKey[8];