- Exhumed: changed lung display as well.

This commit is contained in:
Christoph Oelckers 2021-05-13 13:16:40 +02:00
parent 35c07500c3
commit 71f4946879
5 changed files with 31 additions and 46 deletions

View file

@ -84,10 +84,6 @@ void SendInput()
void CheckKeys2()
{
if (PlayerList[nLocalPlayer].nHealth <= 0)
{
SetAirFrame();
}
}

View file

@ -208,7 +208,6 @@ static bool UseMask(short nPlayer)
if (nPlayer == nLocalPlayer)
{
SetAirFrame();
D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].nSprite);
}
return true;

View file

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

View file

@ -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<DHUDFont*> 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();

View file

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