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 83e5abc6f14..1801b721c8c 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 2d79cf90b8c..47355b98442 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 7afc49a6ee5..e1542c10989 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1271,10 +1271,6 @@ void FuncPlayer(int a, int nDamage, int nRun) 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 @@ void FuncPlayer(int a, int nDamage, int nRun) } DoBubbles(nPlayer); - SetAirFrame(); } else { - if (nPlayer == nLocalPlayer) - { - BuildStatusAnim(132, 0); - } - airpages = 0; } } @@ -1366,17 +1356,11 @@ void FuncPlayer(int a, int nDamage, int nRun) 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 @@ void FuncPlayer(int a, int nDamage, int nRun) 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 6099d3320b6..82df0f2360a 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 @@ class DExhumedStatusBar : public DBaseStatusBar // 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 @@ class DExhumedStatusBar : public DBaseStatusBar 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 @@ class DExhumedStatusBar : public DBaseStatusBar 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 8536652ddb7..099e37bb63d 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();