- 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() void CheckKeys2()
{ {
if (PlayerList[nLocalPlayer].nHealth <= 0)
{
SetAirFrame();
}
} }

View file

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

View file

@ -1271,10 +1271,6 @@ sectdone:
airpages = 1; airpages = 1;
if (PlayerList[nPlayer].nMaskAmount > 0) if (PlayerList[nPlayer].nMaskAmount > 0)
{ {
if (nPlayer == nLocalPlayer) {
BuildStatusAnim(132, 0);
}
D3PlayFX(StaticSound[kSound30], nPlayerSprite); D3PlayFX(StaticSound[kSound30], nPlayerSprite);
PlayerList[nPlayer].nAir = 100; PlayerList[nPlayer].nAir = 100;
@ -1314,15 +1310,9 @@ sectdone:
} }
DoBubbles(nPlayer); DoBubbles(nPlayer);
SetAirFrame();
} }
else else
{ {
if (nPlayer == nLocalPlayer)
{
BuildStatusAnim(132, 0);
}
airpages = 0; airpages = 0;
} }
} }
@ -1366,17 +1356,11 @@ sectdone:
if (nBreathTimer[nPlayer] <= 0) if (nBreathTimer[nPlayer] <= 0)
{ {
nBreathTimer[nPlayer] = 90; nBreathTimer[nPlayer] = 90;
if (nPlayer == nLocalPlayer)
{
// animate lungs
BuildStatusAnim(132, 0);
}
} }
if (PlayerList[nPlayer].nAir < 100) if (PlayerList[nPlayer].nAir < 100)
{ {
PlayerList[nPlayer].nAir = 100; PlayerList[nPlayer].nAir = 100;
SetAirFrame();
} }
} }
@ -1802,8 +1786,6 @@ do_default_b:
PlayerList[nPlayer].nAir = 100; // TODO - constant PlayerList[nPlayer].nAir = 100; // TODO - constant
} }
SetAirFrame();
if (nBreathTimer[nPlayer] < 89) if (nBreathTimer[nPlayer] < 89)
{ {
D3PlayFX(StaticSound[kSound13], nPlayerSprite); D3PlayFX(StaticSound[kSound13], nPlayerSprite);

View file

@ -54,9 +54,7 @@ short nMagicFrame;
short nMaskY; short nMaskY;
int magicperline; int magicperline;
int airperline;
int healthperline; int healthperline;
int nAirFrames;
int nCounter; int nCounter;
int nCounterDest; int nCounterDest;
@ -68,8 +66,6 @@ short nDigit[3];
short nItemFrame; short nItemFrame;
short nMeterRange; short nMeterRange;
short airframe;
int16_t nFirstAnim; int16_t nFirstAnim;
int16_t nLastAnim; int16_t nLastAnim;
short nItemAltSeq; short nItemAltSeq;
@ -129,8 +125,6 @@ void InitStatus()
nMeterRange = tileHeight(nPicNum); nMeterRange = tileHeight(nPicNum);
magicperline = 1000 / nMeterRange; magicperline = 1000 / nMeterRange;
healthperline = 800 / nMeterRange; healthperline = 800 / nMeterRange;
nAirFrames = SeqSize[nStatusSeqOffset + 133];
airperline = 100 / nAirFrames;
nCounter = 0; nCounter = 0;
nCounterDest = 0; nCounterDest = 0;
@ -214,7 +208,6 @@ void RefreshStatus()
SetPlayerItem(nLocalPlayer, nPlayerItem[nLocalPlayer]); SetPlayerItem(nLocalPlayer, nPlayerItem[nLocalPlayer]);
SetHealthFrame(0); SetHealthFrame(0);
SetMagicFrame(); SetMagicFrame();
SetAirFrame();
} }
void MoveStatusAnims() 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) void SetCounter(short nVal)
{ {
if (nVal <= 999) if (nVal <= 999)
@ -516,6 +495,7 @@ class DExhumedStatusBar : public DBaseStatusBar
TObjPtr<DHUDFont*> textfont, numberFont; TObjPtr<DHUDFont*> textfont, numberFont;
int keyanims[4]; int keyanims[4];
int airframe, lungframe;
enum EConst enum EConst
{ {
@ -896,11 +876,15 @@ private:
// draws health level dots, animates breathing lungs and other things // draws health level dots, animates breathing lungs and other things
DrawStatusAnims(); 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) if (SectFlag[nPlayerViewSect[nLocalPlayer]] & kSectUnderwater)
{ {
DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0, 0.5); DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0, 0.5);
} }
else
{
DrawStatusSequence(nStatusSeqOffset + 132, lungframe, 0);
}
// draw compass // draw compass
@ -978,6 +962,30 @@ private:
keyanims[i] = 0; 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() void UpdateStatusBar()
{ {
Tick(); // temporary. Tick(); // temporary.
if (hud_size <= Hud_full) if (hud_size <= Hud_full)
{ {
DrawStatus(); DrawStatus();

View file

@ -30,7 +30,6 @@ void InitStatus();
void SetPlayerItem(short nPlayer, short nItem); void SetPlayerItem(short nPlayer, short nItem);
void SetMagicFrame(); void SetMagicFrame();
void SetHealthFrame(short nVal); void SetHealthFrame(short nVal);
void SetAirFrame();
void MoveStatus(); void MoveStatus();
void DrawSnakeCamStatus(); void DrawSnakeCamStatus();
void DrawStatus(); void DrawStatus();