From b520d38bc0c8d1796ba29436c4acd08f652de513 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 14 May 2021 18:34:42 +0200 Subject: [PATCH] - removed the native implementation od Exhumed's status bar. --- source/core/gamecontrol.cpp | 2 + source/games/exhumed/src/status.cpp | 876 +--------------------------- wadsrc/static/zscript/razebase.zs | 3 - 3 files changed, 15 insertions(+), 866 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index d4649d006..06f596919 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -829,10 +829,12 @@ void CreateStatusBar() StatusBar->SetSize(0, 320, 200); InitStatusBar(); // this is for comparing the scriptification with the C++ versions + /* stbarclass = PClass::FindClass("NativeExhumedStatusBar"); StatusBar2 = static_cast(stbarclass->CreateNew()); StatusBar2->SetSize(0, 320, 200); StatusBar2->Release(); + */ } diff --git a/source/games/exhumed/src/status.cpp b/source/games/exhumed/src/status.cpp index fe6095fa3..8305c74a8 100644 --- a/source/games/exhumed/src/status.cpp +++ b/source/games/exhumed/src/status.cpp @@ -1,32 +1,35 @@ //------------------------------------------------------------------------- /* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 sirlemonhead, Nuke.YKT -This file is part of PCExhumed. -PCExhumed is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. +Copyright (C) 2020-2021 Christoph Oelckers + +This file is part of Raze. + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- + #include "ns.h" #include "engine.h" #include "player.h" -#include "aistuff.h" #include "status.h" #include "exhumed.h" #include "sequence.h" #include "names.h" #include "view.h" #include "v_2ddrawer.h" -#include "multipatchtexture.h" -#include "texturemanager.h" #include "statusbar.h" #include "v_draw.h" #include "automap.h" @@ -115,857 +118,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Exhumed, SizeOfStatusSequence, SizeOfStatusSequen ACTION_RETURN_INT(SeqSize[nStatusSeqOffset + s1]); } -class DNativeExhumedStatusBar : public DBaseStatusBar -{ - DECLARE_CLASS(DNativeExhumedStatusBar, DBaseStatusBar) - HAS_OBJECT_POINTERS - - TObjPtr textfont, numberFont; - int keyanims[4]; - int airframe, lungframe; - - int nSelectedItem; - int nHealthLevel; - int nMagicLevel; - int nMeterRange; - int nHurt; - int nHealthFrame; - int nMagicFrame; - int nItemAltSeq; - int nItemSeq; - int nItemFrames; - int nItemFrame; - - - int nCounter; - int nCounterDest; - int nDigit[3]; - int ammodelay; - int nLastWeapon; - - enum EConst - { - KeySeq = 36, - }; - -public: - DNativeExhumedStatusBar() - { - textfont = Create(SmallFont, 1, Off, 1, 1); - numberFont = Create(BigFont, 0, Off, 1, 1); - - int nPicNum = seq_GetSeqPicnum(kSeqStatus, 1, 0); - nMeterRange = tileHeight(nPicNum); - Reset(); - } - - void Reset() - { - airframe = lungframe = nHurt = nHealthFrame = nMagicFrame = nItemAltSeq = nItemFrames = nItemFrame = nCounter = 0; - - nDigit[0] = nDigit[1] = nDigit[2] = 0; - nHealthLevel = -1; - nMagicLevel = -1; - nSelectedItem = -1; - nItemSeq = -1; - ammodelay = 3; - nLastWeapon = -1; - SetCounter(0); - } - -private: - - //--------------------------------------------------------------------------- - // - // draws a sequence animation to the status bar - // - //--------------------------------------------------------------------------- - - void DrawStatusSequence(short nSequence, uint16_t edx, double ebx, double xoffset = 0) - { - edx += SeqBase[nSequence]; - - short nFrameBase = FrameBase[edx]; - int16_t nFrameSize = FrameSize[edx]; - - while (1) - { - nFrameSize--; - if (nFrameSize < 0) - break; - - int flags = 0; - - double x = ChunkXpos[nFrameBase] + xoffset; - double y = ChunkYpos[nFrameBase] + ebx; - - if (hud_size <= Hud_StbarOverlay) - { - x += 161; - y += 100; - } - else - { - if (x < 0) - { - x += 160; - flags |= DI_SCREEN_LEFT_BOTTOM; - } - else if (x > 0) - { - x -= 159; // graphics do not match up precisely. - flags |= DI_SCREEN_RIGHT_BOTTOM; - } - y -= 100; - } - - int tile = ChunkPict[nFrameBase]; - - short chunkFlag = ChunkFlag[nFrameBase]; - - if (chunkFlag & 3) - { - // This is hard to align with bad offsets, so skip that treatment for mirrored elements. - flags |= DI_ITEM_RELCENTER; - } - else - { - x -= tileWidth(tile) * .5; - y -= tileHeight(tile) * .5; - flags |= DI_ITEM_OFFSETS; - } - - if (chunkFlag & 1) - flags |= DI_MIRROR; - if (chunkFlag & 2) - flags |= DI_MIRRORY; - - DrawGraphic(tileGetTexture(tile), x, y, flags, 1, -1, -1, 1, 1); - nFrameBase++; - } - } - - //--------------------------------------------------------------------------- - // - // draws a sequence animation to the status bar - // - //--------------------------------------------------------------------------- - - FGameTexture * GetStatusSequencePic(short nSequence, uint16_t edx) - { - edx += SeqBase[nSequence]; - int nFrameBase = FrameBase[edx]; - return tileGetTexture(ChunkPict[nFrameBase]); - } - - int GetStatusSequenceTile(short nSequence, uint16_t edx) - { - edx += SeqBase[nSequence]; - int nFrameBase = FrameBase[edx]; - return ChunkPict[nFrameBase]; - } - - //--------------------------------------------------------------------------- - // - // Frag display - very ugly and may have to be redone if multiplayer support gets added. - // - //--------------------------------------------------------------------------- - - void DrawMulti() - { - char stringBuf[30]; - if (nNetPlayerCount) - { - BeginHUD(320, 200, 1); - - int shade; - - if ((PlayClock / 120) & 1) { - shade = -100; - } - else { - shade = 127; - } - - int nTile = kTile3593; - - int xx = 320 / (nTotalPlayers + 1); - int x = xx - 160; - - for (int i = 0; i < nTotalPlayers; i++) - { - DrawGraphic(tileGetTexture(nTile), x, 7, DI_ITEM_CENTER, 1, -1, -1, 1, 1); - - if (i != nLocalPlayer) { - shade = -100; - } - - sprintf(stringBuf, "%d", nPlayerScore[i]); - SBar_DrawString(this, textfont, stringBuf, x, 0, DI_ITEM_TOP|DI_TEXT_ALIGN_CENTER, i != nLocalPlayer ? CR_UNTRANSLATED : CR_GOLD, 1, -1, 0, 1, 1); - x += xx; - nTile++; - } - - if (nNetTime >= 0) - { - int y = 0; - - if (nNetTime) - { - int v12 = (nNetTime + 29) / 30 % 60; - int v13 = (nNetTime + 29) / 1800; - nNetTime += 29; - - sprintf(stringBuf, "%d.%02d", v13, v12); - - y += 20; - nNetTime -= 29; - SBar_DrawString(this, textfont, stringBuf, 0, 10, DI_ITEM_TOP | DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, -1, 0, 1, 1); - } - } - - } - } - - //========================================================================== - // - // Fullscreen HUD variant #1 - // - //========================================================================== - - int ItemTimer(int num, int plr) - { - switch (num) { - case 1: //Scarab item - return (PlayerList[plr].invincibility * 100) / 900; - case 3: //Hand item - return (PlayerList[plr].nDouble * 100) / 1350; - case 5: //Mask - return (PlayerList[plr].nMaskAmount * 100) / 1350; - case 4: //Invisible - return (PlayerList[plr].nInvisible * 100) / 900; - case 2: //Torch - return (PlayerList[plr].nTorch * 100) / 900; - } - - return -1; - } - - void DrawHUD2() - { - BeginHUD(320, 200, 1); - - auto pp = &PlayerList[nLocalPlayer]; - - FString format; - FGameTexture* img; - double imgScale; - double baseScale = numberFont->mFont->GetHeight() * 0.75; - - - // - // Health - // - img = GetStatusSequencePic(nStatusSeqOffset + 125, 0); - imgScale = baseScale / img->GetDisplayHeight(); - DrawGraphic(img, 1.5, -1, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale); - - if (!althud_flashing || pp->nHealth > 150 || (PlayClock & 32)) - { - int s = -8; - if (althud_flashing && pp->nHealth > 800) - s += bsin(PlayClock << 5, -10); - int intens = clamp(255 - 4 * s, 0, 255); - auto pe = PalEntry(255, intens, intens, intens); - format.Format("%d", pp->nHealth >> 3); - SBar_DrawString(this, numberFont, format, 13, -numberFont->mFont->GetHeight()+3, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } - - // - // Air - // - if (SectFlag[nPlayerViewSect[nLocalPlayer]] & kSectUnderwater) - { - img = GetStatusSequencePic(nStatusSeqOffset + 133, airframe); - imgScale = baseScale / img->GetDisplayHeight(); - DrawGraphic(img, -4, -22, DI_ITEM_RIGHT_BOTTOM, 1., -1, -1, imgScale, imgScale); - } - - // - // Magic - // - if (nItemSeq >= 0) - { - int tile = GetStatusSequenceTile(nItemSeq + nStatusSeqOffset, nItemFrame); - int tile2 = tile; - if (tile2 > 744 && tile2 < 751) tile2 = 744; - - imgScale = baseScale / tileHeight(tile2); - DrawGraphic(tileGetTexture(tile), 70, -1, DI_ITEM_CENTER_BOTTOM, 1., -1, -1, imgScale, imgScale); - - - - format.Format("%d", pp->nMagic / 10); - - short nItem = PlayerList[nLocalPlayer].nItem; - int timer = ItemTimer(nItem, nLocalPlayer); - if (timer > 0) - { - format.AppendFormat("/%d", timer); - } - SBar_DrawString(this, numberFont, format, 79.5, -numberFont->mFont->GetHeight() + 3, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } - // - // Weapon - // - const short ammo_sprites[] = { -1, -1 }; - - int weapon = pp->nCurrentWeapon; - int wicon = 0;// ammo_sprites[weapon]; - int ammo = nCounterDest;// pp->WpnAmmo[weapon]; - if (ammo > 0) // wicon > 0 - { - format.Format("%d", ammo); - img = tileGetTexture(wicon); - imgScale = baseScale / img->GetDisplayHeight(); - auto imgX = 21.125; - auto strlen = format.Len(); - - if (strlen > 1) - { - imgX += (imgX * 0.855) * (strlen - 1); - } - - if ((!althud_flashing || PlayClock & 32 || ammo > 10))// (DamageData[weapon].max_ammo / 10))) - { - SBar_DrawString(this, numberFont, format, -3, -numberFont->mFont->GetHeight()+3, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } - - //DrawGraphic(img, -imgX, -1, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, imgScale, imgScale); - } - -#if 0 - // - // Selected inventory item - // - img = tileGetTexture(icons[pp->InventoryNum]); - imgScale = baseScale / img->GetDisplayHeight(); - int x = 165; - DrawGraphic(img, x, -1, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, imgScale, imgScale); - - PlayerUpdateInventoryState(pp, x + 3.0, -18.0, 1, 1); - PlayerUpdateInventoryPercent(pp, x + 3.5, -20.5, 1, 1); -#endif - - - // - // keys - // - - uint16_t nKeys = PlayerList[nLocalPlayer].keys; - - int val = 675; - int x = -134; - - for (int i = 0; i < 4; i++) - { - if (nKeys & 0x1000) - { - auto tex = tileGetTexture(val); - if (tex && tex->isValid()) - { - DrawGraphic(tex, x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1); - } - } - - nKeys >>= 1; - val += 4; - x += 20; - } - } - - - - //--------------------------------------------------------------------------- - // - // draw the full status bar - // - //--------------------------------------------------------------------------- - - void DrawStatus() - { - if (hud_size <= Hud_StbarOverlay) - { - // draw the main bar itself - BeginStatusBar(320, 200, 40); - if (hud_size == Hud_StbarOverlay) Set43ClipRect(); - DrawGraphic(tileGetTexture(kTileStatusBar), 160, 200, DI_ITEM_CENTER_BOTTOM, 1, -1, -1, 1, 1); - twod->ClearClipRect(); - } - else if (hud_size == Hud_Mini) - { - auto lh = TexMan.GetGameTextureByName("hud_l"); - auto rh = TexMan.GetGameTextureByName("hud_r"); - BeginHUD(320, 200, 1); - if (lh) DrawGraphic(lh, 0, 0, DI_ITEM_LEFT_BOTTOM | DI_SCREEN_LEFT_BOTTOM, 1, -1, -1, 1, 1); - if (rh) DrawGraphic(rh, 0, 0, DI_ITEM_RIGHT_BOTTOM | DI_SCREEN_RIGHT_BOTTOM, 1, -1, -1, 1, 1); - } - else if (hud_size == Hud_full) - { - DrawHUD2(); - return; - } - - for (int i = 0; i < 4; i++) - { - if (PlayerList[nLocalPlayer].keys & (4096 << i)) - { - DrawStatusSequence(nStatusSeqOffset + KeySeq + 2 * i, keyanims[i], 0.5, 0.5); - } - } - - if (/*!bFullScreen &&*/ nNetTime) - { - DrawStatusSequence(nStatusSeqOffset + 127, 0, 0); - DrawStatusSequence(nStatusSeqOffset + 129, nMagicFrame, nMagicLevel); - DrawStatusSequence(nStatusSeqOffset + 131, 0, 0); // magic pool frame (bottom) - - DrawStatusSequence(nStatusSeqOffset + 128, 0, 0); - DrawStatusSequence(nStatusSeqOffset + 1, nHealthFrame, nHealthLevel); - DrawStatusSequence(nStatusSeqOffset + 125, 0, 0); // draw ankh on health pool - DrawStatusSequence(nStatusSeqOffset + 130, 0, 0); // draw health pool frame (top) - - if (nItemSeq >= 0) { - DrawStatusSequence(nItemSeq + nStatusSeqOffset, nItemFrame, 1); - } - - // 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); - } - - if (nSelectedItem >= 0) - { - int count = PlayerList[nLocalPlayer].items[nSelectedItem]; - DrawStatusSequence(nStatusSeqOffset + 156 + 2* count, 0, 0); - } - - short nLives = PlayerList[nLocalPlayer].nLives; - DrawStatusSequence(nStatusSeqOffset + 145 + (2 * nLives), 0, 0); - - if (nHurt > 0) DrawStatusSequence(nStatusSeqOffset + 4, nHurt - 1, 0); - - // draw compass - if (hud_size <= Hud_StbarOverlay) DrawStatusSequence(nStatusSeqOffset + 35, ((inita + 128) & kAngleMask) >> 8, 0, 0.5); - - //if (hud_size < Hud_full) - { - // draw ammo count - DrawStatusSequence(nStatusSeqOffset + 44, nDigit[2], 0, 0.5); - DrawStatusSequence(nStatusSeqOffset + 45, nDigit[1], 0, 0.5); - DrawStatusSequence(nStatusSeqOffset + 46, nDigit[0], 0, 0.5); - } - } - - DrawMulti(); - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void PrintLevelStats(int bottomy) - { - FLevelStats stats{}; - stats.fontscale = 1.; - stats.spacing = SmallFont->GetHeight(); - stats.screenbottomspace = bottomy; - stats.font = SmallFont; - stats.letterColor = CR_RED; - stats.standardColor = CR_UNTRANSLATED; - stats.time = Scale(PlayClock, 1000, 120); - - if (automapMode == am_full) - { - DBaseStatusBar::PrintAutomapInfo(stats, true); - } - else if (hud_stats) - { - - stats.completeColor = CR_DARKGREEN; - stats.kills = nCreaturesKilled; - stats.maxkills = nCreaturesTotal; - stats.frags = -1; - stats.secrets = 0; - stats.maxsecrets = 0; - - DBaseStatusBar::PrintLevelStats(stats); - } - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetItemSeq() - { - static const int nItemSeqOffset[] = { 91, 72, 76, 79, 68, 87, 83 }; - - short nItem = PlayerList[nLocalPlayer].nItem; - if (nItem < 0) - { - nItemSeq = -1; - return; - } - - if (nItemMagic[nItem] <= PlayerList[nLocalPlayer].nMagic) nItemAltSeq = 0; - else nItemAltSeq = 2; - - nItemFrame = 0; - nItemSeq = nItemSeqOffset[nItem] + nItemAltSeq; - nItemFrames = SeqSize[nItemSeq + nStatusSeqOffset]; - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetMagicFrame() - { - int magicperline = 1000 / nMeterRange; - - int newMagicLevel = (1000 - PlayerList[nLocalPlayer].nMagic) / magicperline; - newMagicLevel = clamp(newMagicLevel, 0, nMeterRange - 1); - if (newMagicLevel != nMagicLevel) SetItemSeq(); - nMagicLevel = newMagicLevel; - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetHealthFrame() - { - if (nHurt) - { - nHurt++; - if (nHurt > SeqSize[nStatusSeqOffset + 4]) nHurt = 0; - } - - int healthperline = 800 / nMeterRange; - - int newHealthLevel = (800 - PlayerList[nLocalPlayer].nHealth) / healthperline; - newHealthLevel = clamp(newHealthLevel, 0, nMeterRange - 1); - if (newHealthLevel > nHealthLevel) nHurt = 1; - nHealthLevel = newHealthLevel; - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetCounter(int nVal) - { - if (nVal <= 999) - { - if (nVal < 0) { - nVal = 0; - } - } - else { - nVal = 999; - } - - nCounterDest = nVal; - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetCounterImmediate(int nVal) - { - SetCounter(nVal); - nCounter = nCounterDest; - - SetCounterDigits(); - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetCounterDigits() - { - nDigit[2] = 3 * (nCounter / 100 % 10); - nDigit[1] = 3 * (nCounter / 10 % 10); - nDigit[0] = 3 * (nCounter % 10); - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void UpdateCounter() - { - int nWeapon = PlayerList[nLocalPlayer].nCurrentWeapon; - - if (nWeapon < 0) - { - SetCounterImmediate(0); - } - else - { - int thiscount; - - if (nWeapon >= kWeaponSword && nWeapon <= kWeaponRing) - thiscount = PlayerList[nLocalPlayer].nAmmo[nWeapon]; - else - thiscount = 0; - - if (nWeapon != nLastWeapon) SetCounterImmediate(thiscount); - else SetCounter(thiscount); - } - nLastWeapon = nWeapon; - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void MoveStatus() - { - if (nItemSeq >= 0) - { - nItemFrame++; - - if (nItemFrame >= nItemFrames) - { - if (nItemSeq == 67) { - SetItemSeq(); - } - else - { - nItemSeq -= nItemAltSeq; - - if (nItemAltSeq || totalmoves & 0x1F) - { - if (nItemSeq < 2) { - nItemAltSeq = 0; - } - } - else - { - nItemAltSeq = 1; - } - - nItemFrame = 0; - nItemSeq += nItemAltSeq; - nItemFrames = SeqSize[nStatusSeqOffset + nItemSeq]; - } - } - } - - nHealthFrame++; - if (nHealthFrame >= SeqSize[nStatusSeqOffset + 1]) nHealthFrame = 0; - - nMagicFrame++; - if (nMagicFrame >= SeqSize[nStatusSeqOffset + 129]) nMagicFrame = 0; - - if (nCounter == nCounterDest) - { - nCounter = nCounterDest; - ammodelay = 3; - return; - } - else - { - ammodelay--; - if (ammodelay > 0) { - return; - } - } - - int eax = nCounterDest - nCounter; - - if (eax <= 0) - { - if (eax >= -30) - { - for (int i = 0; i < 3; i++) - { - nDigit[i]--; - - if (nDigit[i] < 0) - { - nDigit[i] += 30; - } - - if (nDigit[i] < 27) { - break; - } - } - } - else - { - nCounter += (nCounterDest - nCounter) >> 1; - SetCounterDigits(); - return; - } - } - else - { - if (eax <= 30) - { - for (int i = 0; i < 3; i++) - { - nDigit[i]++; - - if (nDigit[i] <= 27) { - break; - } - - if (nDigit[i] >= 30) { - nDigit[i] -= 30; - } - } - } - else - { - nCounter += (nCounterDest - nCounter) >> 1; - SetCounterDigits(); - return; - } - } - - if (!(nDigit[0] % 3)) { - nCounter = nDigit[0] / 3 + 100 * (nDigit[2] / 3) + 10 * (nDigit[1] / 3); - } - - eax = nCounterDest - nCounter; - if (eax < 0) { - eax = -eax; - } - - ammodelay = 4 - (eax >> 1); - if (ammodelay < 1) { - ammodelay = 1; - } - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void SetPlayerItem() - { - if (nSelectedItem != PlayerList[nLocalPlayer].nItem) - { - nSelectedItem = PlayerList[nLocalPlayer].nItem; - SetItemSeq(); - } - } - - //--------------------------------------------------------------------------- - // - // - // - //--------------------------------------------------------------------------- - - void Tick() override - { - SetMagicFrame(); - SetHealthFrame(); - SetPlayerItem(); - UpdateCounter(); - MoveStatus(); - for (int i = 0; i < 4; i++) - { - int seq = nStatusSeqOffset + KeySeq + 2 * i; - if (PlayerList[nLocalPlayer].keys & (4096 << i)) - { - if (keyanims[i] < SeqSize[seq] - 1) - { - seq_MoveSequence(-1, seq, 0); // this plays the pickup sound. - keyanims[i]++; - } - } - else - { - 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; - } - } - - -public: - void UpdateStatusBar() - { - Tick(); // temporary. - - if (hud_size <= Hud_full) - { - DrawStatus(); - } - PrintLevelStats(hud_size == Hud_Nothing ? 0 : hud_size == Hud_full? 22 : 40); - } -}; - -IMPLEMENT_CLASS(DNativeExhumedStatusBar, false, true) -IMPLEMENT_POINTERS_START(DNativeExhumedStatusBar) -IMPLEMENT_POINTER(textfont) -IMPLEMENT_POINTER(numberFont) -IMPLEMENT_POINTERS_END - void UpdateFrame() { auto tex = tileGetTexture(nBackgroundPic); @@ -990,7 +142,6 @@ void StatusMessage(int messageTime, const char* fmt, ...) va_end(ap); } -CVAR(Bool, sb_native, false, 0) void DrawStatusBar() { if (nFreeze == 2) return; // Hide when Ramses is talking. @@ -1003,8 +154,7 @@ void DrawStatusBar() info.maxkills = nCreaturesTotal; // got no secrets in the game info.time = Scale(PlayClock, 1000, 120); - if (!sb_native) UpdateStatusBar(&info); - else StatusBar2->UpdateStatusBar(); + UpdateStatusBar(&info); if (nSnakeCam >= 0) { diff --git a/wadsrc/static/zscript/razebase.zs b/wadsrc/static/zscript/razebase.zs index df1f770ae..5eaffef1a 100644 --- a/wadsrc/static/zscript/razebase.zs +++ b/wadsrc/static/zscript/razebase.zs @@ -256,8 +256,5 @@ class DukeStatusBar : DukeCommonStatusBar native class RedneckStatusBar : DukeCommonStatusBar native {} -class NativeExhumedStatusBar : BaseStatusBar native -{} - class SWStatusBar : BaseStatusBar native {}