- Exhumed: Minor fixes to panning code.

* Stop panning if underwater.
* Remove overload from PlayerHorizon from d32dcd5f8e that was causing problems for other games.
* Remove static bool `plrFalling` also from d32dcd5f8e and add `bIsFalling` to `Player` struct, hooking up with save code as well.
This commit is contained in:
Mitchell Richters 2021-01-05 17:04:46 +11:00
parent 726c51bf63
commit 7fcf1c94a1
3 changed files with 8 additions and 19 deletions

View file

@ -39,18 +39,6 @@ struct PlayerHorizon
}
}
void addadjustment(fixed_t value)
{
if (!SyncInput())
{
adjustment += value;
}
else
{
horiz += q16horiz(value);
}
}
void resetadjustment()
{
adjustment = 0;

View file

@ -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)

View file

@ -71,6 +71,7 @@ struct Player
short field_3A;
short field_3C;
short nRun;
bool bIsFalling;
PlayerHorizon horizon;
PlayerAngle angle;