Fix air meter in status bar

This commit is contained in:
nukeykt 2019-10-30 00:17:43 +09:00 committed by Christoph Oelckers
parent 308885d92c
commit 4dcde5dde7
2 changed files with 13 additions and 17 deletions

View File

@ -609,6 +609,7 @@ void RestartPlayer(short nPlayer)
PlayerList[nPlayer].field_3C = 0; PlayerList[nPlayer].field_3C = 0;
PlayerList[nPlayer].nAir = 100; PlayerList[nPlayer].nAir = 100;
airpages = 0;
if (levelnum <= kMap20) if (levelnum <= kMap20)
{ {
@ -1503,19 +1504,16 @@ loc_1AB8E:
// if underwater // if underwater
if (var_5C) if (var_5C)
{ {
airpages = 1;
if (PlayerList[nPlayer].nMaskAmount > 0) if (PlayerList[nPlayer].nMaskAmount > 0)
{ {
if (nPlayer == nLocalPlayer) { if (nPlayer == nLocalPlayer) {
BuildStatusAnim(132, 0); BuildStatusAnim(132, 0);
} }
airpages = 0;
D3PlayFX(StaticSound[kSound30], nPlayerSprite); D3PlayFX(StaticSound[kSound30], nPlayerSprite);
PlayerList[nPlayer].nAir = 100; PlayerList[nPlayer].nAir = 100;
DoBubbles(nPlayer);
SetAirFrame();
} }
else else
{ {
@ -1523,9 +1521,6 @@ loc_1AB8E:
if (PlayerList[nPlayer].nAir > 0) if (PlayerList[nPlayer].nAir > 0)
{ {
D3PlayFX(StaticSound[kSound25], nPlayerSprite); D3PlayFX(StaticSound[kSound25], nPlayerSprite);
DoBubbles(nPlayer);
SetAirFrame();
} }
else else
{ {
@ -1553,6 +1548,9 @@ loc_1AB8E:
} }
} }
} }
DoBubbles(nPlayer);
SetAirFrame();
} }
else else
{ {
@ -1598,6 +1596,8 @@ loc_1AB8E:
nBreathTimer[nPlayer] = 1; nBreathTimer[nPlayer] = 1;
} }
airpages = 0;
nBreathTimer[nPlayer]--; nBreathTimer[nPlayer]--;
if (nBreathTimer[nPlayer] <= 0) if (nBreathTimer[nPlayer] <= 0)
{ {

View File

@ -303,18 +303,14 @@ void SetAirFrame()
{ {
airframe = PlayerList[nLocalPlayer].nAir / airperline; airframe = PlayerList[nLocalPlayer].nAir / airperline;
if (airframe < nAirFrames) if (airframe >= nAirFrames)
{
if (airframe < 0) {
airframe = 0;
}
}
else
{ {
airframe = nAirFrames - 1; airframe = nAirFrames - 1;
} }
else if (airframe < 0)
airpages = numpages; {
airframe = 0;
}
} }
void SetCounter(short nVal) void SetCounter(short nVal)
@ -695,7 +691,7 @@ void DrawStatus()
if (airpages) if (airpages)
{ {
seq_DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0); seq_DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0);
airpages--; // airpages--;
} }
// draw compass // draw compass