From 71f4946879c2da8fe9ec855250689a2492cdc863 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 13 May 2021 13:16:40 +0200 Subject: [PATCH] - Exhumed: changed lung display as well. --- source/games/exhumed/src/input.cpp | 4 --- source/games/exhumed/src/items.cpp | 1 - source/games/exhumed/src/player.cpp | 18 ---------- source/games/exhumed/src/status.cpp | 53 +++++++++++++++++------------ source/games/exhumed/src/status.h | 1 - 5 files changed, 31 insertions(+), 46 deletions(-) diff --git a/source/games/exhumed/src/input.cpp b/source/games/exhumed/src/input.cpp index 83e5abc6f..1801b721c 100644 --- a/source/games/exhumed/src/input.cpp +++ b/source/games/exhumed/src/input.cpp @@ -84,10 +84,6 @@ void SendInput() void CheckKeys2() { - if (PlayerList[nLocalPlayer].nHealth <= 0) - { - SetAirFrame(); - } } diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index 2d79cf90b..47355b984 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -208,7 +208,6 @@ static bool UseMask(short nPlayer) if (nPlayer == nLocalPlayer) { - SetAirFrame(); D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].nSprite); } return true; diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 7afc49a6e..e1542c109 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1271,10 +1271,6 @@ sectdone: airpages = 1; if (PlayerList[nPlayer].nMaskAmount > 0) { - if (nPlayer == nLocalPlayer) { - BuildStatusAnim(132, 0); - } - D3PlayFX(StaticSound[kSound30], nPlayerSprite); PlayerList[nPlayer].nAir = 100; @@ -1314,15 +1310,9 @@ sectdone: } DoBubbles(nPlayer); - SetAirFrame(); } else { - if (nPlayer == nLocalPlayer) - { - BuildStatusAnim(132, 0); - } - airpages = 0; } } @@ -1366,17 +1356,11 @@ sectdone: if (nBreathTimer[nPlayer] <= 0) { nBreathTimer[nPlayer] = 90; - if (nPlayer == nLocalPlayer) - { - // animate lungs - BuildStatusAnim(132, 0); - } } if (PlayerList[nPlayer].nAir < 100) { PlayerList[nPlayer].nAir = 100; - SetAirFrame(); } } @@ -1802,8 +1786,6 @@ do_default_b: PlayerList[nPlayer].nAir = 100; // TODO - constant } - SetAirFrame(); - if (nBreathTimer[nPlayer] < 89) { D3PlayFX(StaticSound[kSound13], nPlayerSprite); diff --git a/source/games/exhumed/src/status.cpp b/source/games/exhumed/src/status.cpp index 6099d3320..82df0f236 100644 --- a/source/games/exhumed/src/status.cpp +++ b/source/games/exhumed/src/status.cpp @@ -54,9 +54,7 @@ short nMagicFrame; short nMaskY; int magicperline; -int airperline; int healthperline; -int nAirFrames; int nCounter; int nCounterDest; @@ -68,8 +66,6 @@ short nDigit[3]; short nItemFrame; short nMeterRange; -short airframe; - int16_t nFirstAnim; int16_t nLastAnim; short nItemAltSeq; @@ -129,8 +125,6 @@ void InitStatus() nMeterRange = tileHeight(nPicNum); magicperline = 1000 / nMeterRange; healthperline = 800 / nMeterRange; - nAirFrames = SeqSize[nStatusSeqOffset + 133]; - airperline = 100 / nAirFrames; nCounter = 0; nCounterDest = 0; @@ -214,7 +208,6 @@ void RefreshStatus() SetPlayerItem(nLocalPlayer, nPlayerItem[nLocalPlayer]); SetHealthFrame(0); SetMagicFrame(); - SetAirFrame(); } void MoveStatusAnims() @@ -295,20 +288,6 @@ void SetHealthFrame(short nVal) } } -void SetAirFrame() -{ - airframe = PlayerList[nLocalPlayer].nAir / airperline; - - if (airframe >= nAirFrames) - { - airframe = nAirFrames - 1; - } - else if (airframe < 0) - { - airframe = 0; - } -} - void SetCounter(short nVal) { if (nVal <= 999) @@ -516,6 +495,7 @@ class DExhumedStatusBar : public DBaseStatusBar TObjPtr textfont, numberFont; int keyanims[4]; + int airframe, lungframe; enum EConst { @@ -896,11 +876,15 @@ private: // draws health level dots, animates breathing lungs and other things DrawStatusAnims(); - // draw the blue air level meter when underwater (but not responsible for animating the breathing lungs otherwise) + // draw the blue air level meter when underwater if (SectFlag[nPlayerViewSect[nLocalPlayer]] & kSectUnderwater) { DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0, 0.5); } + else + { + DrawStatusSequence(nStatusSeqOffset + 132, lungframe, 0); + } // draw compass @@ -978,6 +962,30 @@ private: keyanims[i] = 0; } } + + if (SectFlag[nPlayerViewSect[nLocalPlayer]] & kSectUnderwater) + { + + int nAirFrames = SeqSize[nStatusSeqOffset + 133]; + int airperline = 100 / nAirFrames; + + airframe = PlayerList[nLocalPlayer].nAir / airperline; + + if (airframe >= nAirFrames) + { + airframe = nAirFrames - 1; + } + else if (airframe < 0) + { + airframe = 0; + } + lungframe = 0; + } + else + { + int size = SeqSize[nStatusSeqOffset + 132]; + if (++lungframe == size) lungframe = 0; + } } @@ -985,6 +993,7 @@ public: void UpdateStatusBar() { Tick(); // temporary. + if (hud_size <= Hud_full) { DrawStatus(); diff --git a/source/games/exhumed/src/status.h b/source/games/exhumed/src/status.h index 8536652dd..099e37bb6 100644 --- a/source/games/exhumed/src/status.h +++ b/source/games/exhumed/src/status.h @@ -30,7 +30,6 @@ void InitStatus(); void SetPlayerItem(short nPlayer, short nItem); void SetMagicFrame(); void SetHealthFrame(short nVal); -void SetAirFrame(); void MoveStatus(); void DrawSnakeCamStatus(); void DrawStatus();