- 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.
This commit is contained in:
Mitchell Richters 2020-09-16 20:08:56 +10:00
parent eb0bd9638b
commit 9c56dfffe0
3 changed files with 6 additions and 10 deletions

View file

@ -106,10 +106,6 @@ static void GetInputInternal(ControlInfo* const hidInput)
static int32_t lastInputClock; // MED static int32_t lastInputClock; // MED
int32_t const elapsedTics = gFrameClock - lastInputClock; 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; lastInputClock = gFrameClock;
if (turnLeft || turnRight) if (turnLeft || turnRight)
@ -138,14 +134,14 @@ static void GetInputInternal(ControlInfo* const hidInput)
input.fvel -= xs_CRoundToInt(scaleAdjust * (hidInput->dz * keyMove)); input.fvel -= xs_CRoundToInt(scaleAdjust * (hidInput->dz * keyMove));
if (mouseaim) if (mouseaim)
input.q16horz += FloatToFixed(hidInput->mousey / mlookScale); input.q16horz += FloatToFixed(hidInput->mousey);
else else
input.fvel -= xs_CRoundToInt(hidInput->mousey * 64.); input.fvel -= xs_CRoundToInt(hidInput->mousey * 64.);
if (!in_mouseflip) if (!in_mouseflip)
input.q16horz = -input.q16horz; 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.fvel = clamp(gInput.fvel + input.fvel, -2048, 2048);
gInput.svel = clamp(gInput.svel + input.svel, -2048, 2048); gInput.svel = clamp(gInput.svel + input.svel, -2048, 2048);

View file

@ -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 = 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) if (pPlayer->q16look > 0)
{ {
@ -1375,7 +1375,7 @@ void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust
} }
else else
{ {
pPlayer->q16horiz = 0; pPlayer->q16horiz = clamp(pPlayer->q16horiz + q16horz, IntToFixed(-179), IntToFixed(119));
} }
} }

View file

@ -109,8 +109,8 @@ struct PLAYER
int zWeapon; int zWeapon;
int zWeaponVel; int zWeaponVel;
fixed_t q16look; fixed_t q16look;
int q16horiz; // horiz fixed_t q16horiz; // horiz
int q16slopehoriz; // horizoff fixed_t q16slopehoriz; // horizoff
int slope; int slope;
bool isUnderwater; bool isUnderwater;
bool hasKey[8]; bool hasKey[8];