From 7fcf1c94a1f9cc4624911b65d7e63c6f55fc95e0 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 5 Jan 2021 17:04:46 +1100 Subject: [PATCH] - Exhumed: Minor fixes to panning code. * Stop panning if underwater. * Remove overload from PlayerHorizon from d32dcd5f8eb54720719d521b44d81bfcc7a2bf61 that was causing problems for other games. * Remove static bool `plrFalling` also from d32dcd5f8eb54720719d521b44d81bfcc7a2bf61 and add `bIsFalling` to `Player` struct, hooking up with save code as well. --- source/core/gameinput.h | 12 ------------ source/exhumed/src/player.cpp | 14 +++++++------- source/exhumed/src/player.h | 1 + 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 26d61fb77..357febc07 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -39,18 +39,6 @@ struct PlayerHorizon } } - void addadjustment(fixed_t value) - { - if (!SyncInput()) - { - adjustment += value; - } - else - { - horiz += q16horiz(value); - } - } - void resetadjustment() { adjustment = 0; diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index fa1e78fb6..2ecc79293 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -1167,29 +1167,28 @@ void FuncPlayer(int a, int nDamage, int nRun) } sectdone: - static bool plrFalling = false; - if (!PlayerList[nPlayer].horizon.horiz.asbuild() || plrFalling) + if (!bUnderwater || !PlayerList[nPlayer].horizon.horiz.asbuild() || PlayerList[nPlayer].bIsFalling) { // Calculate base pan amount based on how much the player is falling. fixed_t dVertPan = (spr_z - sprite[nPlayerSprite].z) << 9; - if (dVertPan != 0) + if (!bUnderwater && dVertPan != 0) { fixed_t adjustment; if (dVertPan >= IntToFixed(4)) - adjustment = IntToFixed(4); + adjustment = 4; else if (dVertPan <= -IntToFixed(4)) - adjustment = -IntToFixed(4); + adjustment = -4; else adjustment = dVertPan << 1; PlayerList[nPlayer].horizon.addadjustment(adjustment); - plrFalling = true; + PlayerList[nPlayer].bIsFalling = true; } else { sPlayerInput[nPlayer].actions |= SB_CENTERVIEW; - plrFalling = false; + PlayerList[nPlayer].bIsFalling = false; } } @@ -2854,6 +2853,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player* ("field38", w.field_38) ("field3a", w.field_3A) ("field3c", w.field_3C) + ("bIsFalling", w.bIsFalling) ("seq", w.nSeq) ("horizon", w.horizon) ("angle", w.angle) diff --git a/source/exhumed/src/player.h b/source/exhumed/src/player.h index 254796ae0..d0d915757 100644 --- a/source/exhumed/src/player.h +++ b/source/exhumed/src/player.h @@ -71,6 +71,7 @@ struct Player short field_3A; short field_3C; short nRun; + bool bIsFalling; PlayerHorizon horizon; PlayerAngle angle;