From fcfee9addcf89dde3fc6149816f4587dcaea1a4f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 21 Apr 2023 14:34:27 +1000 Subject: [PATCH] - Exhumed: Convert remainder of statusbar code and delete old system. --- source/games/exhumed/src/2d.cpp | 1 - source/games/exhumed/src/cheats.cpp | 1 - source/games/exhumed/src/exhumed.cpp | 2 - source/games/exhumed/src/gameloop.cpp | 1 - source/games/exhumed/src/gun.cpp | 1 - source/games/exhumed/src/init.cpp | 1 - source/games/exhumed/src/items.cpp | 1 - source/games/exhumed/src/menu.cpp | 1 - source/games/exhumed/src/move.cpp | 1 - source/games/exhumed/src/player.cpp | 2 - source/games/exhumed/src/sequence.cpp | 338 +----------------- source/games/exhumed/src/sequence.h | 93 ----- source/games/exhumed/src/snake.cpp | 1 - source/games/exhumed/src/status.cpp | 38 -- source/games/exhumed/src/status.h | 27 -- source/games/exhumed/src/view.cpp | 1 - .../zscript/games/exhumed/exhumedgame.zs | 2 - .../static/zscript/games/exhumed/ui/sbar.zs | 30 +- 18 files changed, 16 insertions(+), 526 deletions(-) delete mode 100644 source/games/exhumed/src/status.h diff --git a/source/games/exhumed/src/2d.cpp b/source/games/exhumed/src/2d.cpp index 97aa146ed..798acb3bf 100644 --- a/source/games/exhumed/src/2d.cpp +++ b/source/games/exhumed/src/2d.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "names.h" #include "engine.h" #include "c_bind.h" -#include "status.h" #include "sound.h" #include "names.h" #include "view.h" diff --git a/source/games/exhumed/src/cheats.cpp b/source/games/exhumed/src/cheats.cpp index a379fc2e4..93fcd5636 100644 --- a/source/games/exhumed/src/cheats.cpp +++ b/source/games/exhumed/src/cheats.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "player.h" #include "sound.h" #include "view.h" -#include "status.h" #include "version.h" #include "gamecvars.h" #include "savegamehelp.h" diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 72ab35768..03bf9dd66 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "player.h" #include "sound.h" #include "view.h" -#include "status.h" #include "version.h" #include "aistuff.h" #include "mapinfo.h" @@ -459,7 +458,6 @@ void GameInterface::app_init() InitFX(); seq_LoadSequences(); - InitStatus(); GrabPalette(); diff --git a/source/games/exhumed/src/gameloop.cpp b/source/games/exhumed/src/gameloop.cpp index 6ade4c483..6ef8d02ed 100644 --- a/source/games/exhumed/src/gameloop.cpp +++ b/source/games/exhumed/src/gameloop.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "player.h" #include "sound.h" #include "view.h" -#include "status.h" #include "version.h" #include "aistuff.h" #include "mapinfo.h" diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 9c868fcf0..35856f53d 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "player.h" #include "exhumed.h" #include "view.h" -#include "status.h" #include "sound.h" #include #include diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 9f4f4741d..c296c3ad9 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mapinfo.h" #include "gamecontrol.h" #include "v_video.h" -#include "status.h" #include #include #include "statusbar.h" diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index 6ba745d72..0cde5d972 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "player.h" #include "exhumed.h" #include "sound.h" -#include "status.h" #include "engine.h" #include "mapinfo.h" diff --git a/source/games/exhumed/src/menu.cpp b/source/games/exhumed/src/menu.cpp index 375ef0ffd..926283fb9 100644 --- a/source/games/exhumed/src/menu.cpp +++ b/source/games/exhumed/src/menu.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "names.h" #include "engine.h" #include "c_bind.h" -#include "status.h" #include "sound.h" #include "names.h" #include "view.h" diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 4a08d1824..7890bee08 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "aistuff.h" #include "player.h" #include "view.h" -#include "status.h" #include "sound.h" #include "mapinfo.h" #include diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index ad65ef48c..1e134e1fb 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "engine.h" #include "sequence.h" #include "view.h" -#include "status.h" #include "sound.h" #include "sound.h" #include "buildtiles.h" @@ -65,7 +64,6 @@ static constexpr int16_t nItemText[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; -extern int nStatusSeqOffset; int obobangle = 0, bobangle = 0; int nLocalPlayer = 0; Player PlayerList[kMaxPlayers]; diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index f4008abba..45d33b5d7 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -27,9 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include -// TEMP -#include - BEGIN_PS_NS enum @@ -40,30 +37,12 @@ enum kMaxSEQChunks = 21000 }; -int16_t sequences = 0; -int16_t frames = 0; -int16_t chunks = 0; int16_t nPilotLightFrame; int16_t nPilotLightCount; int16_t nShadowWidth = 1; int16_t nFlameHeight = 1; -static int16_t SeqBase[kMaxSequences]; -static int16_t SeqSize[kMaxSequences]; -static int16_t SeqFlag[kMaxSequences]; // not used at all. - -static int16_t FrameSound[kMaxSEQFrames]; -static int16_t FrameSize[kMaxSEQFrames]; -static int16_t FrameBase[kMaxSEQFrames]; -static int16_t FrameFlag[kMaxSEQFrames]; - -static int16_t ChunkYpos[kMaxSEQChunks]; -static int16_t ChunkXpos[kMaxSEQChunks]; -static int16_t ChunkPict[kMaxSEQChunks]; -static int16_t ChunkFlag[kMaxSEQChunks]; - - const char *SeqNames[kMaxSEQFiles] = { "rothands", @@ -146,131 +125,8 @@ const char *SeqNames[kMaxSEQFiles] = "rat" }; -static int16_t SeqOffsets[kMaxSEQFiles]; static TMap> FileSeqMap; - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFromId(const int nSeqFileId, const int nSeq) -{ - return SeqOffsets[nSeqFileId] + nSeq; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrame(const int nSeq, const int nFrame) -{ - return SeqBase[nSeq] + nFrame; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameCount(const int nSeq) -{ - return SeqSize[nSeq]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameChunk(const int nFrame) -{ - return FrameBase[nFrame]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameFlags(const int nFrame) -{ - return FrameFlag[nFrame]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameSound(const int nFrame) -{ - return FrameSound[nFrame]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameChunkCount(const int nFrame) -{ - return FrameSize[nFrame]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameChunkPosX(const int nChunk) -{ - return ChunkXpos[nChunk]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameChunkPosY(const int nChunk) -{ - return ChunkYpos[nChunk]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameChunkPicnum(const int nChunk) -{ - return ChunkPict[nChunk]; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -int getSeqFrameChunkFlags(const int nChunk) -{ - return ChunkFlag[nChunk]; -} - //--------------------------------------------------------------------------- // // @@ -451,185 +307,16 @@ int addSeq(const char *seqName) // //--------------------------------------------------------------------------- -int seq_ReadSequence(const char *seqName) -{ - const int16_t StartFrameCount = frames; - const FStringf seqfilename("%s.seq", seqName); - const auto hFile = fileSystem.ReopenFileReader(fileSystem.FindFile(seqfilename), true); - - if (!hFile.isOpen()) - { - Printf("Unable to open '%s'!\n", seqfilename.GetChars()); - return 0; - } - - uint16_t tag; - hFile.Read(&tag, sizeof(tag)); - if (tag < MAKE_ID('I', 'H', 0, 0) || (tag > MAKE_ID('I', 'H', 0, 0) && tag != MAKE_ID('D', 'S', 0, 0))) - { - Printf("Unsupported sequence version!\n"); - return 0; - } - - int16_t centerx, centery; // TODO - are global vars? - int16_t nSeqs; - hFile.Read(¢erx, sizeof(centerx)); - hFile.Read(¢ery, sizeof(centery)); - hFile.Read(&nSeqs, sizeof(nSeqs)); - - if (nSeqs <= 0 || sequences + nSeqs >= kMaxSequences) - { - if (nSeqs < 0) - { - Printf("Invalid sequence count!\n"); - return 0; - } - else { - I_Error("Not enough sequences available! Increase array!\n"); - } - } - - hFile.Read(&SeqBase[sequences], nSeqs * sizeof(SeqBase[0])); - hFile.Read(&SeqSize[sequences], nSeqs * sizeof(SeqSize[0])); - hFile.Read(&SeqFlag[sequences], nSeqs * sizeof(SeqFlag[0])); - - for (int i = 0; i < nSeqs; i++) - { - SeqBase[sequences + i] += frames; - } - - int16_t nFrames; - hFile.Read(&nFrames, sizeof(nFrames)); - - if (nFrames <= 0 || frames + nFrames >= kMaxSEQFrames) - { - if (nFrames < 0 ) - { - Printf("Invalid frame count!\n"); - return 0; - } - else { - I_Error("Not enough frames available! Increase FRAMEMAX!\n"); - } - } - - hFile.Read(&FrameBase[frames], nFrames * sizeof(FrameBase[0])); - hFile.Read(&FrameSize[frames], nFrames * sizeof(FrameSize[0])); - hFile.Read(&FrameFlag[frames], nFrames * sizeof(FrameFlag[0])); - memset(&FrameSound[frames], -1, nFrames * sizeof(FrameSound[0])); - - for (int i = 0; i < nFrames; i++) - { - FrameBase[frames + i] += chunks; - } - - int16_t nChunks; - hFile.Read(&nChunks, sizeof(nChunks)); - - if (nChunks < 0 || chunks + nChunks >= kMaxSEQChunks) - { - if (nChunks < 0 ) - { - Printf("Invalid chunk count!\n"); - return 0; - } - else { - I_Error("Not enough chunks available! Increase CHUNKMAX!\n"); - } - } - - hFile.Read(&ChunkXpos[chunks], nChunks * sizeof(ChunkXpos[0])); - hFile.Read(&ChunkYpos[chunks], nChunks * sizeof(ChunkYpos[0])); - hFile.Read(&ChunkPict[chunks], nChunks * sizeof(ChunkPict[0])); - hFile.Read(&ChunkFlag[chunks], nChunks * sizeof(ChunkFlag[0])); - - for (int i = 0; i < nChunks; i++) - { - ChunkXpos[chunks + i] -= centerx; - ChunkYpos[chunks + i] -= centery; - } - - sequences += nSeqs; - FrameBase[frames + nFrames] = chunks + nChunks; - frames += nFrames; - SeqBase[sequences] = frames; - chunks += nChunks; - - if (tag == MAKE_ID('D', 'S', 0, 0)) - { - int16_t var_20; - hFile.Read(&var_20, sizeof(var_20)); - TArray buffer(var_20 * 10, true); - memset(buffer.Data(), 0, var_20 * 10); - - for (int i = 0; i < var_20; i++) - { - hFile.Read(&buffer[i * 10], 8); - } - - int16_t var_24; - hFile.Read(&var_24, sizeof(var_24)); - - for (int i = 0; i < var_24; i++) - { - int16_t var_28, var_2C; - hFile.Read(&var_28, sizeof(var_28)); - hFile.Read(&var_2C, sizeof(var_2C)); - - int ndx = (var_2C & 0x1FF); - int hSound = 0; - if (ndx >= var_20) - { - Printf("bad sound index %d in %s, maximum is %d\n", ndx, seqfilename.GetChars(), var_20); - } - else - hSound = LoadSound(&buffer[ndx*10]); - - assert(StartFrameCount + var_28 < kMaxSEQFrames); - FrameSound[StartFrameCount + var_28] = hSound | (var_2C & 0xFE00); - } - } - - return nSeqs; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void seq_LoadSequences() { for (unsigned i = 0; i < kMaxSEQFiles; i++) { - SeqOffsets[i] = sequences; - - if (seq_ReadSequence(SeqNames[i]) == 0 || addSeq(SeqNames[i]) == 0) + if (addSeq(SeqNames[i]) == 0) { Printf("Error loading '%s'\n", SeqNames[i]); } } -#if 0 - FILE* f = fopen("seq.dump", "wb"); - - fwrite(SeqBase, 1, sizeof(SeqBase), f); - fwrite(SeqSize, 1, sizeof(SeqSize), f); - fwrite(SeqFlag, 1, sizeof(SeqFlag), f); - fwrite("++++++++++++++++", 1, 16, f); - fwrite(FrameSound, 1, sizeof(FrameSound), f); - fwrite("++++++++++++++++", 1, 16, f); - fwrite(FrameSize, 1, sizeof(FrameSize), f); - fwrite(FrameBase, 1, sizeof(FrameBase), f); - fwrite(FrameFlag, 1, sizeof(FrameFlag), f); - fwrite(ChunkYpos, 1, sizeof(ChunkYpos), f); - fwrite(ChunkXpos, 1, sizeof(ChunkXpos), f); - fwrite(ChunkPict, 1, sizeof(ChunkPict), f); - fwrite(ChunkFlag, 1, sizeof(ChunkFlag), f); - fclose(f); -#endif - nShadowPic = getSequence("shadow").getFirstPicnum(); nShadowWidth = tileWidth(nShadowPic); @@ -720,29 +407,6 @@ void seq_DrawGunSequence(const Seq& weapSeq, int16_t frameIndex, double xOffs, d // //--------------------------------------------------------------------------- -void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t nFrame) -{ - assert(nSeq >= 0); // TEMP - - int nSound = getSeqFrameSound(getSeqFrame(nSeq, nFrame)); - if (nSound == -1) { - return; - } - - if (actor) { - D3PlayFX(nSound, actor); - } - else { - PlayLocalSound(nSound, 0); - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex) { tspritetype* pTSprite = mytspriteArray->get(nSprite); diff --git a/source/games/exhumed/src/sequence.h b/source/games/exhumed/src/sequence.h index 3aa7414b7..ba00a82e5 100644 --- a/source/games/exhumed/src/sequence.h +++ b/source/games/exhumed/src/sequence.h @@ -21,87 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -enum { - kSeqRothands = 0, - kSeqSword, - kSeqPistol, - kSeqM60, - kSeqFlamer, - kSeqGrenade, - kSeqCobra, - kSeqBoneSaw, - kSeqScramble, - kSeqGlove, - kSeqMummy, - kSeqSkull, - kSeqPoof, - kSeqKapow, - kSeqFireball, - kSeqBubble, - kSeqSpider, - kSeqAnubis, - kSeqAnuBall, - kSeqFish, - kSeqSnakehed, - kSeqSnakBody, - kSeqWasp, - kSeqCobraPow, - kSeqScorp, - kSeqJoe, // player pic - kSeqStatus, - kSeqDead, - kSeqDeadEx, - kSeqAnuPoof, - kSeqSkulPoof, - kSeqBullet, - kSeqShadow, - kSeqGrenRoll, - kSeqGrenBoom, - kSeqSplash, - kSeqGrenPow, - kSeqSkulSrt, - kSeqFirePoof, - kSeqBloodHit, - kSeqLion, - kSeqItems, - kSeqLavag, - kSeqLsplash, - kSeqLavaShot, - kSeqSmokeBal, - kSeqFirePot, - kSeqRex, - kSeqSet, - kSeqQueen, - kSeqRoach, - kSeqHawk, - kSeqSetGhost, - kSeqSetGBlow, - kSeqBizzTail, - kSeqBizzPoof, - kSeqQueenEgg, - kSeqRoacShot, - kSeqBackgrnd, - kSeqScreens, - kSeqArrow, - kSeqFonts, - kSeqDrips, - kSeqFireTrap, - kSeqMagic2, - kSeqCreepy, - kSeqSlider, - kSeqRavolt, // 67 - kSeqEyeHit, - kSeqFont2, - kSeqSeeBubbl, - kSeqBlood, - kSeqDrum, - kSeqPoof2, - kSeqDeadBrn, // 74 - kSeqGrenBubb, - kSeqRochfire, - kSeqRat -}; - struct actionSeq { int16_t nSeqId; @@ -162,23 +81,11 @@ extern int16_t nPilotLightFrame; extern int16_t nPilotLightCount; void seq_LoadSequences(); -void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t nFrame); void seq_DrawGunSequence(const Seq& weapSeq, int16_t frameIndex, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false); void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags); void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex); void seq_DrawPilotLightSeq(double xOffset, double yOffset); -int getSeqFromId(const int nSeqFileId, const int nSeq = 0); -int getSeqFrame(const int nSeq, const int nFrame = 0); -int getSeqFrameCount(const int nSeq); -int getSeqFrameChunk(const int nFrame); -int getSeqFrameFlags(const int nFrame); -int getSeqFrameChunkCount(const int nFrame); -int getSeqFrameChunkPosX(const int nChunk); -int getSeqFrameChunkPosY(const int nChunk); -int getSeqFrameChunkPicnum(const int nChunk); -int getSeqFrameChunkFlags(const int nChunk); - TArray* getFileSeqs(const FName nSeqFile); inline const Seq& getSequence(const FName nSeqFile, const unsigned nSeqIndex = 0) diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 45f09751b..9b16527ac 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "engine.h" #include "exhumed.h" #include "aistuff.h" -#include "status.h" #include "player.h" #include "sequence.h" #include "sound.h" diff --git a/source/games/exhumed/src/status.cpp b/source/games/exhumed/src/status.cpp index fcf86788d..68f9b9601 100644 --- a/source/games/exhumed/src/status.cpp +++ b/source/games/exhumed/src/status.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" #include "engine.h" #include "player.h" -#include "status.h" #include "exhumed.h" #include "sequence.h" #include "names.h" @@ -40,43 +39,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS - - -// All this must be moved into the status bar once it is made persistent! -int nStatusSeqOffset; - -void InitStatus() -{ - nStatusSeqOffset = getSeqFromId(kSeqStatus); -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -DEFINE_ACTION_FUNCTION(_Exhumed, MoveStatusSequence) -{ - PARAM_PROLOGUE; - PARAM_INT(s1); - PARAM_INT(s2); - seq_MoveSequence(nullptr, nStatusSeqOffset + s1, s2); - ACTION_RETURN_INT(getSeqFrameCount(nStatusSeqOffset + s1)); -} - -int SizeOfStatusSequence(int s1) -{ - return getSeqFrameCount(nStatusSeqOffset + s1); -} - -DEFINE_ACTION_FUNCTION_NATIVE(_Exhumed, SizeOfStatusSequence, SizeOfStatusSequence) -{ - PARAM_PROLOGUE; - PARAM_INT(s1); - ACTION_RETURN_INT(getSeqFrameCount(nStatusSeqOffset + s1)); -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/exhumed/src/status.h b/source/games/exhumed/src/status.h deleted file mode 100644 index 1cf9bccc7..000000000 --- a/source/games/exhumed/src/status.h +++ /dev/null @@ -1,27 +0,0 @@ -//------------------------------------------------------------------------- -/* -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. -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. -*/ -//------------------------------------------------------------------------- - -#pragma once - -BEGIN_PS_NS - - -void InitStatus(); - -END_PS_NS - diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 4b25baea0..2c59fd497 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "gamefuncs.h" #include "names.h" #include "view.h" -#include "status.h" #include "exhumed.h" #include "player.h" #include "aistuff.h" diff --git a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs index 735de1ac1..1903dc9cd 100644 --- a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs +++ b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs @@ -8,8 +8,6 @@ struct Exhumed native native static void playCDTrack(int track, bool looped); native static void DrawPlasma(); native static Seq GetStatusSequence(int seqId); - native static int MoveStatusSequence(int s1, int s2); - native static int SizeOfStatusSequence(int s1); native static ExhumedPlayer GetViewPlayer(); native static int GetPistolClip(); native static int GetPlayerClip(); diff --git a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs index 177695036..05c8580d6 100644 --- a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs +++ b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs @@ -23,16 +23,16 @@ class ExhumedStatusBar : RazeStatusBar { HUDFont textfont, numberFont; - int keyanims[4]; + uint keyanims[4]; int airframe, lungframe; int nSelectedItem; int nHealthLevel; int nMagicLevel; int nMeterRange; - int nHurt; - int nHealthFrame; - int nMagicFrame; + uint nHurt; + uint nHealthFrame; + uint nMagicFrame; int nItemAltSeq; int nItemSeq; int nItemFrames; @@ -494,7 +494,7 @@ class ExhumedStatusBar : RazeStatusBar nItemFrame = 0; nItemSeq = nItemSeqOffset[nItem] + nItemAltSeq; - nItemFrames = Exhumed.SizeofStatusSequence(nItemSeq); + nItemFrames = Exhumed.GetStatusSequence(nItemSeq).Size(); } //--------------------------------------------------------------------------- @@ -524,7 +524,7 @@ class ExhumedStatusBar : RazeStatusBar if (nHurt) { nHurt++; - if (nHurt > Exhumed.SizeofStatusSequence(4)) nHurt = 0; + if (nHurt > Exhumed.GetStatusSequence(4).Size()) nHurt = 0; } int healthperline = 800 / nMeterRange; @@ -635,16 +635,16 @@ class ExhumedStatusBar : RazeStatusBar nItemFrame = 0; nItemSeq += nItemAltSeq; - nItemFrames = Exhumed.SizeofStatusSequence(nItemSeq); + nItemFrames = Exhumed.GetStatusSequence(nItemSeq).Size(); } } } nHealthFrame++; - if (nHealthFrame >= Exhumed.SizeofStatusSequence(1)) nHealthFrame = 0; + if (nHealthFrame >= Exhumed.GetStatusSequence(1).Size()) nHealthFrame = 0; nMagicFrame++; - if (nMagicFrame >= Exhumed.SizeofStatusSequence(129)) nMagicFrame = 0; + if (nMagicFrame >= Exhumed.GetStatusSequence(129).Size()) nMagicFrame = 0; if (nCounter == nCounterDest) { @@ -751,12 +751,13 @@ class ExhumedStatusBar : RazeStatusBar MoveStatus(pp); for (int i = 0; i < 4; i++) { - int seq = KeySeq + 2 * i; if (pp.keys & (4096 << i)) { - if (keyanims[i] < Exhumed.SizeofStatusSequence(seq) - 1) + let keySeq = Exhumed.GetStatusSequence(KeySeq + 2 * i); + + if (keyanims[i] < keySeq.Size() - 1) { - Exhumed.MoveStatusSequence(seq, 0); // this plays the pickup sound. + keySeq.getFrame(0).playSound(); // this plays the pickup sound. keyanims[i]++; } } @@ -768,8 +769,7 @@ class ExhumedStatusBar : RazeStatusBar if (pp.isUnderwater()) { - - int nAirFrames = Exhumed.SizeofStatusSequence(133); + int nAirFrames = Exhumed.GetStatusSequence(133).Size(); int airperline = 100 / nAirFrames; airframe = pp.nAir / airperline; @@ -786,7 +786,7 @@ class ExhumedStatusBar : RazeStatusBar } else { - int size = Exhumed.SizeofStatusSequence(132); + int size = Exhumed.GetStatusSequence(132).Size(); if (++lungframe == size) lungframe = 0; } }