From 4dcde5dde7765508c8c4d90b4771e28df398a279 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Wed, 30 Oct 2019 00:17:43 +0900 Subject: [PATCH] Fix air meter in status bar --- source/exhumed/src/player.cpp | 14 +++++++------- source/exhumed/src/status.cpp | 16 ++++++---------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index b00f61745..11f3dee60 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -609,6 +609,7 @@ void RestartPlayer(short nPlayer) PlayerList[nPlayer].field_3C = 0; PlayerList[nPlayer].nAir = 100; + airpages = 0; if (levelnum <= kMap20) { @@ -1503,19 +1504,16 @@ loc_1AB8E: // if underwater if (var_5C) { + airpages = 1; if (PlayerList[nPlayer].nMaskAmount > 0) { if (nPlayer == nLocalPlayer) { BuildStatusAnim(132, 0); } - airpages = 0; D3PlayFX(StaticSound[kSound30], nPlayerSprite); PlayerList[nPlayer].nAir = 100; - - DoBubbles(nPlayer); - SetAirFrame(); } else { @@ -1523,9 +1521,6 @@ loc_1AB8E: if (PlayerList[nPlayer].nAir > 0) { D3PlayFX(StaticSound[kSound25], nPlayerSprite); - - DoBubbles(nPlayer); - SetAirFrame(); } else { @@ -1553,6 +1548,9 @@ loc_1AB8E: } } } + + DoBubbles(nPlayer); + SetAirFrame(); } else { @@ -1598,6 +1596,8 @@ loc_1AB8E: nBreathTimer[nPlayer] = 1; } + airpages = 0; + nBreathTimer[nPlayer]--; if (nBreathTimer[nPlayer] <= 0) { diff --git a/source/exhumed/src/status.cpp b/source/exhumed/src/status.cpp index 7ae7914a0..4b32705e4 100644 --- a/source/exhumed/src/status.cpp +++ b/source/exhumed/src/status.cpp @@ -303,18 +303,14 @@ void SetAirFrame() { airframe = PlayerList[nLocalPlayer].nAir / airperline; - if (airframe < nAirFrames) - { - if (airframe < 0) { - airframe = 0; - } - } - else + if (airframe >= nAirFrames) { airframe = nAirFrames - 1; } - - airpages = numpages; + else if (airframe < 0) + { + airframe = 0; + } } void SetCounter(short nVal) @@ -695,7 +691,7 @@ void DrawStatus() if (airpages) { seq_DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0); - airpages--; + // airpages--; } // draw compass