From 42389133d3759cee01ca3137bad90bfaa0066872 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Sep 2022 08:09:26 +0200 Subject: [PATCH] - function separators. Also removing some dead code. --- source/games/exhumed/src/aistuff.h | 1 - source/games/exhumed/src/anims.cpp | 36 +++ source/games/exhumed/src/anubis.cpp | 24 ++ source/games/exhumed/src/bubbles.cpp | 44 +++- source/games/exhumed/src/bullet.cpp | 53 +++++ source/games/exhumed/src/cheats.cpp | 52 +++++ source/games/exhumed/src/d_menu.cpp | 12 + source/games/exhumed/src/engine.h | 2 - source/games/exhumed/src/enginesubs.cpp | 6 + source/games/exhumed/src/exhumed.cpp | 85 ++++++- source/games/exhumed/src/fish.cpp | 58 ++++- source/games/exhumed/src/gameloop.cpp | 18 ++ source/games/exhumed/src/grenade.cpp | 48 ++++ source/games/exhumed/src/gun.cpp | 78 +++++++ source/games/exhumed/src/init.cpp | 53 ++++- source/games/exhumed/src/input.cpp | 12 + source/games/exhumed/src/items.cpp | 84 ++++++- source/games/exhumed/src/light.cpp | 38 +++- source/games/exhumed/src/lighting.cpp | 92 +++++++- source/games/exhumed/src/map.cpp | 12 + source/games/exhumed/src/menu.cpp | 12 + source/games/exhumed/src/move.cpp | 162 +++++++++++++- source/games/exhumed/src/movie.cpp | 17 ++ source/games/exhumed/src/mummy.cpp | 38 +++- source/games/exhumed/src/object.cpp | 284 ++++++++++++++++++++++-- source/games/exhumed/src/osdcmds.cpp | 30 +++ source/games/exhumed/src/player.cpp | 130 +++++++++++ source/games/exhumed/src/queen.cpp | 138 ++++++++++++ source/games/exhumed/src/ra.cpp | 42 ++++ source/games/exhumed/src/ramses.cpp | 7 +- source/games/exhumed/src/random.cpp | 24 ++ source/games/exhumed/src/rat.cpp | 48 ++++ source/games/exhumed/src/rex.cpp | 30 +++ source/games/exhumed/src/roach.cpp | 31 ++- source/games/exhumed/src/runlist.cpp | 156 +++++++++++++ source/games/exhumed/src/save.cpp | 6 + source/games/exhumed/src/scorp.cpp | 36 +++ source/games/exhumed/src/sequence.cpp | 77 ++++++- source/games/exhumed/src/set.cpp | 42 ++++ source/games/exhumed/src/snake.cpp | 53 +++++ source/games/exhumed/src/spider.cpp | 30 +++ source/games/exhumed/src/status.cpp | 24 ++ source/games/exhumed/src/switch.cpp | 132 +++++++++++ source/games/exhumed/src/view.cpp | 39 +++- source/games/exhumed/src/view.h | 2 - source/games/exhumed/src/wasp.cpp | 30 +++ 46 files changed, 2364 insertions(+), 64 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 2bf72d737..bc6271a89 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -206,7 +206,6 @@ extern TObjPtr nChunkSprite[]; extern TObjPtr nBodySprite[]; void MoveThings(); -void ResetMoveFifo(); void InitChunks(); void InitPushBlocks(); void Gravity(DExhumedActor* actor); diff --git a/source/games/exhumed/src/anims.cpp b/source/games/exhumed/src/anims.cpp index 0b917f736..58bfded34 100644 --- a/source/games/exhumed/src/anims.cpp +++ b/source/games/exhumed/src/anims.cpp @@ -30,6 +30,12 @@ int nPreMagicSeq = -1; int nSavePointSeq = -1; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeAnim(FSerializer& arc) { if (arc.BeginObject("anims")) @@ -60,6 +66,12 @@ void DestroyAnim(DExhumedActor* pActor) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildAnim(DExhumedActor* pActor, int val, int val2, const DVector3& pos, sectortype* pSector, int nRepeat, int nFlag) { if (pActor == nullptr) { @@ -115,6 +127,12 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, int val, int val2, const DVector return pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIAnim::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -214,6 +232,12 @@ void AIAnim::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIAnim::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -224,6 +248,12 @@ void AIAnim::Draw(RunListEvent* ev) ev->pTSprite->ownerActor = nullptr; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildExplosion(DExhumedActor* pActor) { auto pSector = pActor->sector(); @@ -242,6 +272,12 @@ void BuildExplosion(DExhumedActor* pActor) BuildAnim(nullptr, edx, 0, pActor->spr.pos, pActor->sector(), pActor->spr.xrepeat, 4); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildSplash(DExhumedActor* pActor, sectortype* pSector) { int nRepeat, nSound; diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index 136c39c82..9a1600b04 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -43,6 +43,12 @@ static const actionSeq AnubisSeq[] = { { 43, 1 }, }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildAnubis(DExhumedActor* ap, const DVector3& pos, sectortype* pSector, DAngle nAngle, uint8_t bIsDrummer) { if (ap == nullptr) @@ -104,6 +110,12 @@ void BuildAnubis(DExhumedActor* ap, const DVector3& pos, sectortype* pSector, DA nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIAnubis::Tick(RunListEvent* ev) { auto ap = ev->pObjActor; @@ -334,6 +346,12 @@ void AIAnubis::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIAnubis::Draw(RunListEvent* ev) { auto ap = ev->pObjActor; @@ -353,6 +371,12 @@ void AIAnubis::RadialDamage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIAnubis::Damage(RunListEvent* ev) { auto ap = ev->pObjActor; diff --git a/source/games/exhumed/src/bubbles.cpp b/source/games/exhumed/src/bubbles.cpp index dc53d141d..17da3192d 100644 --- a/source/games/exhumed/src/bubbles.cpp +++ b/source/games/exhumed/src/bubbles.cpp @@ -25,6 +25,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyBubble(DExhumedActor* pActor) { runlist_DoSubRunRec(pActor->spr.lotag - 1); @@ -33,6 +39,12 @@ void DestroyBubble(DExhumedActor* pActor) DeleteActor(pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector) { int nSize = RandomSize(3); @@ -72,7 +84,13 @@ DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector) return pActor; } -void AIBubble::Tick(RunListEvent* ev) +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void AIBubble::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; if (!pActor) return; @@ -103,6 +121,12 @@ void AIBubble::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIBubble::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -113,6 +137,12 @@ void AIBubble::Draw(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoBubbleMachines() { ExhumedStatIterator it(kStatBubbleMachine); @@ -129,6 +159,12 @@ void DoBubbleMachines() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildBubbleMachine(DExhumedActor* pActor) { pActor->nFrame = 75; @@ -138,6 +174,12 @@ void BuildBubbleMachine(DExhumedActor* pActor) ChangeActorStat(pActor, kStatBubbleMachine); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoBubbles(int nPlayer) { sectortype* pSector; diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 88d1c9967..d78e21a16 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -127,6 +127,12 @@ bulletInfo BulletInfo[] = { }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitBullets() { BulletList.Clear(); @@ -141,6 +147,12 @@ int GrabBullet() return grabbed; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyBullet(int nBullet) { DExhumedActor* pActor = BulletList[nBullet].pActor; @@ -155,6 +167,12 @@ void DestroyBullet(int nBullet) BulletList.Release(nBullet); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void IgniteSprite(DExhumedActor* pActor) { pActor->spr.hitag += 2; @@ -169,6 +187,12 @@ void IgniteSprite(DExhumedActor* pActor) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActor* pHitActor, const DVector3& pos, sectortype* pSector) { assert(pSector != nullptr); @@ -279,6 +303,11 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int MoveBullet(int nBullet) { @@ -511,6 +540,12 @@ HITSPRITE: return nVal; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetBulletEnemy(int nBullet, DExhumedActor* pEnemy) { if (nBullet >= 0) { @@ -518,6 +553,12 @@ void SetBulletEnemy(int nBullet, DExhumedActor* pEnemy) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, double fZOffset, DAngle nAngle, DExhumedActor* pTarget, int nDoubleDamage, int nPitch) { Bullet sBullet; @@ -748,6 +789,12 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, double fZOffset, DA return pBulletActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIBullet::Tick(RunListEvent* ev) { int nBullet = RunData[ev->nRun].nObjIndex; @@ -787,6 +834,12 @@ void AIBullet::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIBullet::Draw(RunListEvent* ev) { int nBullet = RunData[ev->nRun].nObjIndex; diff --git a/source/games/exhumed/src/cheats.cpp b/source/games/exhumed/src/cheats.cpp index a13d720a3..de96e2a14 100644 --- a/source/games/exhumed/src/cheats.cpp +++ b/source/games/exhumed/src/cheats.cpp @@ -43,6 +43,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static const char* GodCheat(int nPlayer, int state) { if (state == -1) @@ -57,6 +63,12 @@ static const char* GodCheat(int nPlayer, int state) return GStrings(PlayerList[nPlayer].invincibility ? "TXT_EX_DEITYON" : "TXT_EX_DEITYOFF"); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static const char* SlipCheat() { if (bSlipMode == false) @@ -72,6 +84,11 @@ static const char* SlipCheat() } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- const char* GameInterface::GenericCheat(int player, int cheat) { @@ -94,6 +111,12 @@ const char* GameInterface::GenericCheat(int player, int cheat) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static bool HollyCheat(cheatseq_t* c) { // Do the closest thing to this cheat that's available. @@ -115,6 +138,12 @@ static bool LiteCheat(cheatseq_t* c) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static bool SnakeCheat(cheatseq_t* c) { if (!nNetPlayerCount) @@ -132,6 +161,12 @@ static bool SnakeCheat(cheatseq_t* c) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static bool SphereCheat(cheatseq_t* c) { Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_FULLMAP")); @@ -140,6 +175,12 @@ static bool SphereCheat(cheatseq_t* c) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static cheatseq_t excheats[] = { {"holly", nullptr, HollyCheat, 0}, {"kimberly", nullptr, KimberlyCheat, 0}, @@ -155,6 +196,12 @@ static cheatseq_t excheats[] = { }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static void cmd_Give(int player, uint8_t** stream, bool skip) { int type = ReadByte(stream); @@ -217,6 +264,11 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void InitCheats() { diff --git a/source/games/exhumed/src/d_menu.cpp b/source/games/exhumed/src/d_menu.cpp index 176770f23..4dc258228 100644 --- a/source/games/exhumed/src/d_menu.cpp +++ b/source/games/exhumed/src/d_menu.cpp @@ -45,6 +45,12 @@ void GameInterface::MenuOpened() StopLocalSound(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::MenuSound(EMenuSounds snd) { switch (snd) @@ -67,6 +73,12 @@ void GameInterface::MenuSound(EMenuSounds snd) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSavegameInfo GameInterface::GetSaveSig() { return { SAVESIG_PS, MINSAVEVER_PS, SAVEVER_PS }; diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 3cde828d1..1f02bccd4 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -61,8 +61,6 @@ extern DAngle inita; extern sectortype* initsectp; extern int nCurChunkNum; -extern int movefifoend; -extern int movefifopos; // all static counters combined in an array for easier maintenance. enum ECounter diff --git a/source/games/exhumed/src/enginesubs.cpp b/source/games/exhumed/src/enginesubs.cpp index e6c7ea0a1..5ef1c3c82 100644 --- a/source/games/exhumed/src/enginesubs.cpp +++ b/source/games/exhumed/src/enginesubs.cpp @@ -34,6 +34,12 @@ void resettiming() lastTic = -1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void precache() { if (!r_precache) return; diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 9ab9224ef..2c06f33ac 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -177,6 +177,12 @@ int nTimeLimit; int bVanilla = 0; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DebugOut(const char *fmt, ...) { #ifdef _DEBUG @@ -195,6 +201,12 @@ void DoClockBeep() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoRedAlert(int nVal) { if (nVal) @@ -214,6 +226,12 @@ void DoRedAlert(int nVal) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DrawClock() { int ebp = 49; @@ -245,6 +263,12 @@ void DrawClock() DoEnergyTile(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + double calc_interpfrac() { return bRecord || bPlayback || nFreeze != 0 || paused || cl_capfps || !cl_interpolate || EndLevel ? 1. : I_GetTimeFrac(); @@ -259,6 +283,12 @@ void DoGameOverScene(bool finallevel) }); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameMove(void) { FixPalette(); @@ -324,6 +354,12 @@ static int SelectAltWeapon(int weap2) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::Ticker() { @@ -475,12 +511,24 @@ void GameInterface::Ticker() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void LevelFinished() { NextMap = FindNextMap(currentLevel); EndLevel = 13; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + #define x(a, b) registerName(#a, b); static void SetTileNames() { @@ -493,6 +541,12 @@ static void SetTileNames() } #undef x +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::app_init() { GC::AddMarkerFunc(markgcroots); @@ -523,7 +577,13 @@ void GameInterface::app_init() enginecompatibility_mode = ENGINECOMPATIBILITY_19950829; } -void DeleteActor(DExhumedActor* actor) +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void DeleteActor(DExhumedActor* actor) { if (!actor) { @@ -538,6 +598,11 @@ void DeleteActor(DExhumedActor* actor) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void CopyTileToBitmap(int nSrcTile, int nDestTile, int xPos, int yPos) { @@ -576,6 +641,12 @@ void CopyTileToBitmap(int nSrcTile, int nDestTile, int xPos, int yPos) TileFiles.InvalidateTile(nDestTile); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void EraseScreen(int nVal) { // There's no other values than 0 ever coming through here. @@ -605,6 +676,12 @@ std::pair GameInterface::GetCoordinates() } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DExhumedActor::Serialize(FSerializer& arc) { Super::Serialize(arc); @@ -625,6 +702,12 @@ void DExhumedActor::Serialize(FSerializer& arc) ("vec", vec); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeState(FSerializer& arc) { if (arc.BeginObject("state")) diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index 91d501d52..368ef1654 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -39,6 +39,11 @@ static actionSeq FishSeq[] = { }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void BuildFishLimb(DExhumedActor* pActor, int anim) { @@ -77,6 +82,12 @@ void BuildBlood(const DVector3& pos, sectortype* pSector) BuildAnim(nullptr, kSeqFish, 36, pos, pSector, 75, 128); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIFishLimb::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -129,6 +140,12 @@ void AIFishLimb::Tick(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIFishLimb::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -137,6 +154,11 @@ void AIFishLimb::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, nSeq, pActor->nFrame, 1); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void BuildFish(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle) { @@ -182,6 +204,12 @@ void BuildFish(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void IdleFish(DExhumedActor* pActor, int edx) { pActor->spr.angle += DAngle180 + DAngle45 - RandomAngle9(); @@ -206,6 +234,12 @@ void IdleFish(DExhumedActor* pActor, int edx) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyFish(DExhumedActor* pActor) { runlist_DoSubRunRec(pActor->spr.intowner); @@ -214,7 +248,11 @@ void DestroyFish(DExhumedActor* pActor) DeleteActor(pActor); } - +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void AIFish::Draw(RunListEvent* ev) { @@ -227,6 +265,12 @@ void AIFish::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIFish::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -248,6 +292,12 @@ void AIFish::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIFish::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -296,6 +346,12 @@ void AIFish::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIFish::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; diff --git a/source/games/exhumed/src/gameloop.cpp b/source/games/exhumed/src/gameloop.cpp index 21ec92da9..2141a2ef8 100644 --- a/source/games/exhumed/src/gameloop.cpp +++ b/source/games/exhumed/src/gameloop.cpp @@ -62,6 +62,12 @@ void DoTitle(CompletionFunc completion); +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::Render() { drawtime.Reset(); @@ -117,6 +123,12 @@ void GameInterface::DrawBackground() DrawRel(kTile3512 + ((dword_9AB5F + 2) & 3), 270, 150, 0); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::NextLevel(MapRecord *map, int skill) { InitLevel(map); @@ -159,6 +171,12 @@ DEFINE_ACTION_FUNCTION(DMapScreen, SetNextLevel) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::LevelCompleted(MapRecord *to_map, int skill) { Mus_Stop(); diff --git a/source/games/exhumed/src/grenade.cpp b/source/games/exhumed/src/grenade.cpp index 81575f410..a5db3a486 100644 --- a/source/games/exhumed/src/grenade.cpp +++ b/source/games/exhumed/src/grenade.cpp @@ -28,6 +28,12 @@ BEGIN_PS_NS +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyGrenade(DExhumedActor* pActor) { runlist_DoSubRunRec(pActor->nPhase); @@ -37,6 +43,12 @@ void DestroyGrenade(DExhumedActor* pActor) DeleteActor(pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BounceGrenade(DExhumedActor* pActor, DAngle nAngle) { pActor->nTurn >>= 1; @@ -45,6 +57,12 @@ void BounceGrenade(DExhumedActor* pActor, DAngle nAngle) D3PlayFX(StaticSound[kSound3], pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ThrowGrenade(int nPlayer, double dz, int push1) { if (PlayerList[nPlayer].pPlayerGrenade == nullptr) @@ -95,6 +113,12 @@ void ThrowGrenade(int nPlayer, double dz, int push1) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildGrenade(int nPlayer) { auto pActor = insertActor(PlayerList[nPlayer].pPlayerViewSect, 201); @@ -135,6 +159,12 @@ void BuildGrenade(int nPlayer) PlayerList[nPlayer].pPlayerGrenade = pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ExplodeGrenade(DExhumedActor* pActor) { int var_28, var_20; @@ -196,6 +226,12 @@ void ExplodeGrenade(DExhumedActor* pActor) DestroyGrenade(pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIGrenade::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -206,6 +242,12 @@ void AIGrenade::Draw(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIGrenade::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -328,6 +370,12 @@ void AIGrenade::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIGrenade::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 54f76d25c..d5ede337e 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -51,6 +51,12 @@ static const uint8_t nMinAmmo[] = { 0, 24, 51, 50, 1, 0, 0 }; int isRed = 0; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeGun(FSerializer& arc) { if (arc.BeginObject("gun")) @@ -62,6 +68,12 @@ void SerializeGun(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void RestoreMinAmmo(int nPlayer) { for (int i = 0; i < kMaxWeapons; i++) @@ -81,6 +93,12 @@ void RestoreMinAmmo(int nPlayer) CheckClip(nPlayer); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void FillWeapons(int nPlayer) { PlayerList[nPlayer].nPlayerWeapons = 0xFFFF; // turn on all bits @@ -95,6 +113,12 @@ void FillWeapons(int nPlayer) CheckClip(nPlayer); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ResetPlayerWeapons(int nPlayer) { for (int i = 0; i < kMaxWeapons; i++) @@ -115,6 +139,12 @@ void InitWeapons() for (auto& p : PlayerList) p.pPlayerGrenade = nullptr; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetNewWeapon(int nPlayer, int nWeapon) { if (nWeapon == kWeaponMummified) @@ -156,6 +186,12 @@ void SetNewWeapon(int nPlayer, int nWeapon) PlayerList[nPlayer].nNextWeapon = nWeapon; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetNewWeaponImmediate(int nPlayer, int nWeapon) { SetNewWeapon(nPlayer, nWeapon); @@ -173,6 +209,12 @@ void SetNewWeaponIfBetter(int nPlayer, int nWeapon) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SelectNewWeapon(int nPlayer) { int nWeapon = kWeaponRing; // start at the highest weapon number @@ -201,6 +243,12 @@ void SelectNewWeapon(int nPlayer) SetNewWeapon(nPlayer, nWeapon); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void StopFiringWeapon(int nPlayer) { PlayerList[nPlayer].bIsFiring = false; @@ -217,6 +265,12 @@ void SetWeaponStatus(int nPlayer) { } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + uint8_t WeaponCanFire(int nPlayer) { int nWeapon = PlayerList[nPlayer].nCurrentWeapon; @@ -241,6 +295,12 @@ void ResetSwordSeqs() WeaponInfo[kWeaponSword].b[3] = 7; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector) { auto pActor = PlayerList[nPlayer].pActor; @@ -270,6 +330,12 @@ Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector) return c; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void CheckClip(int nPlayer) { if (PlayerList[nPlayer].nPlayerClip <= 0) @@ -285,6 +351,12 @@ void CheckClip(int nPlayer) PlayerList[nPlayer].nPistolClip = PlayerList[nPlayer].nAmmo[kWeaponPistol] % 6; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void MoveWeapons(int nPlayer) { static int dword_96E22 = 0; @@ -866,6 +938,12 @@ loc_flag: } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DrawWeapons(double interpfrac) { if (bCamera) { diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 80a494e08..16ad74f52 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -45,9 +45,6 @@ sectortype* initsectp; int nCurChunkNum = 0; -int movefifoend; -int movefifopos; - int Counters[kNumCounters]; @@ -86,6 +83,12 @@ static TArray spawnactors(SpawnSpriteDef& sprites) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + uint8_t LoadLevel(MapRecord* map) { if (map->gameflags & LEVEL_EX_COUNTDOWN) @@ -163,6 +166,12 @@ uint8_t LoadLevel(MapRecord* map) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitLevel(MapRecord* map) { StopCD(); @@ -182,16 +191,20 @@ void InitLevel(MapRecord* map) ResetEngine(); totalmoves = 0; GrabPalette(); - ResetMoveFifo(); lPlayerXVel = 0; lPlayerYVel = 0; - movefifopos = movefifoend; if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level playCDtrack(map->cdSongId, true); setLevelStarted(currentLevel); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitNewGame() { bCamera = false; @@ -208,6 +221,12 @@ void InitNewGame() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b) { for(auto& wal1 : wallsofsector(pSectorA)) @@ -247,6 +266,12 @@ void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) { static const DVector3 nulvec = {0,0,0}; @@ -717,6 +742,12 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) DeleteActor(pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ExamineSprites(TArray& actors) { nNetStartSprites = 0; @@ -755,6 +786,12 @@ void ExamineSprites(TArray& actors) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void LoadObjects(TArray& actors) { runlist_InitRun(); @@ -814,6 +851,12 @@ void LoadObjects(TArray& actors) nCamerapos = initpos; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeInit(FSerializer& arc) { if (arc.BeginObject("init")) diff --git a/source/games/exhumed/src/input.cpp b/source/games/exhumed/src/input.cpp index 806c87e20..4024cd32a 100644 --- a/source/games/exhumed/src/input.cpp +++ b/source/games/exhumed/src/input.cpp @@ -27,6 +27,12 @@ BEGIN_PS_NS PlayerInput sPlayerInput[kMaxPlayers]; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkInput() { for (auto& p : sPlayerInput) @@ -43,6 +49,12 @@ void ClearSpaceBar(int nPlayer) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet) { if (paused || M_Active()) diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index 13ff85f05..24caf7235 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -101,6 +101,12 @@ const int16_t nItemMagic[] = { 500, 1000, 100, 500, 400, 200, 700, 0 }; TArray Regenerates; // must handle read barriers manually! int nMagicCount; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkItems() { GC::MarkArray(Regenerates); @@ -117,6 +123,12 @@ void SerializeItems(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildItemAnim(DExhumedActor* pActor) { int nItem = pActor->spr.statnum - 906; @@ -141,6 +153,12 @@ void BuildItemAnim(DExhumedActor* pActor) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyItemAnim(DExhumedActor* actor) { if (actor && actor->spr.intowner >= 0) @@ -152,6 +170,12 @@ void ItemFlash() TintPalette(16, 16, 16); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void FillItems(int nPlayer) { for (int i = 0; i < 6; i++) @@ -171,6 +195,12 @@ void FillItems(int nPlayer) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static bool UseEye(int nPlayer) { if (PlayerList[nPlayer].nInvisible >= 0) @@ -192,6 +222,12 @@ static bool UseEye(int nPlayer) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static bool UseMask(int nPlayer) { PlayerList[nPlayer].nMaskAmount = 1350; @@ -204,6 +240,12 @@ static bool UseMask(int nPlayer) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + bool UseTorch(int nPlayer) { if (!PlayerList[nPlayer].nTorch) @@ -215,6 +257,12 @@ bool UseTorch(int nPlayer) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + bool UseHeart(int nPlayer) { if (PlayerList[nPlayer].nHealth < kMaxHealth) { @@ -230,7 +278,12 @@ bool UseHeart(int nPlayer) return false; } +//--------------------------------------------------------------------------- +// // invincibility +// +//--------------------------------------------------------------------------- + bool UseScarab(int nPlayer) { if (PlayerList[nPlayer].invincibility >= 0 && PlayerList[nPlayer].invincibility < 900) @@ -257,6 +310,12 @@ static bool UseHand(int nPlayer) return true; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void UseItem(int nPlayer, int nItem) { bool didit = false; @@ -308,7 +367,12 @@ void UseItem(int nPlayer, int nItem) PlayerList[nPlayer].nItem = nItem; } -// TODO - bool return type? +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int GrabItem(int nPlayer, int nItem) { if (PlayerList[nPlayer].items[nItem] >= 5) { @@ -324,6 +388,12 @@ int GrabItem(int nPlayer, int nItem) return 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DropMagic(DExhumedActor* pActor) { if (lFinaleStart) { @@ -358,6 +428,12 @@ void InitItems() nMagicCount = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void StartRegenerate(DExhumedActor* pActor) { auto pos = Regenerates.Find(pActor); @@ -388,6 +464,12 @@ void StartRegenerate(DExhumedActor* pActor) Regenerates.Push(pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoRegenerates() { for(unsigned i = 0; i < Regenerates.Size(); i++) diff --git a/source/games/exhumed/src/light.cpp b/source/games/exhumed/src/light.cpp index f71c83acd..5683d8b2d 100644 --- a/source/games/exhumed/src/light.cpp +++ b/source/games/exhumed/src/light.cpp @@ -53,8 +53,12 @@ int nPalDelay; int nPalDiff; int bGreenPal = 0; -// keep a local copy of the palette that would have been sent to the VGA display adapter -uint8_t vgaPalette[768]; + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int LoadPaletteLookups() { @@ -87,6 +91,12 @@ int LoadPaletteLookups() return 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetGreenPal() { bGreenPal = 1; @@ -102,6 +112,12 @@ int HavePLURemap() return bGreenPal || bTorch; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + uint8_t RemapPLU(uint8_t pal) { if (bGreenPal) @@ -130,6 +146,12 @@ uint8_t RemapPLU(uint8_t pal) return pal; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GrabPalette() { nPalDiff = 0; @@ -141,6 +163,12 @@ void GrabPalette() videoTintBlood(0, 0, 0); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void FixPalette() { if (!nPalDiff) { @@ -179,6 +207,12 @@ void FixPalette() videoTintBlood(rtint, gtint, btint); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void TintPalette(int r, int g, int b) { if (bCamera) { diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index 23f410200..841d9dc0f 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -96,6 +96,12 @@ int nGlowCount; int bDoFlicks = 0; int bDoGlows = 0; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkLighting() { for (int i = 0; i < kMaxFlashes; i++) @@ -106,6 +112,12 @@ size_t MarkLighting() return kMaxFlashes; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSerializer& Serialize(FSerializer& arc, const char* keyname, Flash& w, Flash* def) { if (arc.BeginObject(keyname)) @@ -183,7 +195,12 @@ void SerializeLighting(FSerializer& arc) } } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int GrabFlash() { int nFlash = sFlash.Get(); @@ -206,6 +223,12 @@ int GrabFlash() return nLastFlash; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitLights() { int i; @@ -226,6 +249,12 @@ void InitLights() nLastFlash = -1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddFlash(sectortype* pSector, const DVector3& pos, int val) { int var_28 = 0; @@ -372,6 +401,12 @@ void AddFlash(sectortype* pSector, const DVector3& pos, int val) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void UndoFlashes() { int var_24 = 0; // CHECKME - Watcom error "initializer for variable var_24 may not execute @@ -507,6 +542,12 @@ loc_1868A: } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddGlow(sectortype* pSector, int nVal) { if (nGlowCount >= kMaxGlows) { @@ -521,7 +562,12 @@ void AddGlow(sectortype* pSector, int nVal) nGlowCount++; } -// ok +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddFlicker(sectortype* pSector, int nVal) { if (nFlickerCount >= kMaxFlickers) { @@ -540,6 +586,12 @@ void AddFlicker(sectortype* pSector, int nVal) nFlickerCount++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoGlows() { bDoGlows++; @@ -573,6 +625,12 @@ void DoGlows() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoFlickers() { bDoFlicks ^= 1; @@ -617,6 +675,12 @@ void DoFlickers() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddFlow(sectortype* pSector, int nSpeed, int b, DAngle nAngle) { if (nFlowCount >= kMaxFlows || b >= 2) @@ -638,6 +702,12 @@ void AddFlow(sectortype* pSector, int nSpeed, int b, DAngle nAngle) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddFlow(walltype* pWall, int nSpeed, int b) { if (nFlowCount >= kMaxFlows || b < 2) @@ -659,6 +729,12 @@ void AddFlow(walltype* pWall, int nSpeed, int b) sFlowInfo[nFlow].type = b; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoFlows() { for (int i = 0; i < nFlowCount; i++) @@ -705,6 +781,12 @@ void DoLights() DoFlows(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetTorch(int nPlayer, int bTorchOnOff) { if (bTorchOnOff == bTorch) { @@ -730,6 +812,12 @@ void SetTorch(int nPlayer, int bTorchOnOff) StatusMessage(150, GStrings(buf)); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildFlash(int nPlayer, int nVal) { if (nPlayer == nLocalPlayer) diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index adb2a737e..747b63480 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -30,6 +30,12 @@ BEGIN_PS_NS bool bShowTowers = false; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GrabMap() { for(auto&sec: sector) @@ -54,6 +60,12 @@ void DrawMap(double const interpfrac) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) { auto cangvect = cang.ToVector(); diff --git a/source/games/exhumed/src/menu.cpp b/source/games/exhumed/src/menu.cpp index 2e67e6c9d..3d3a627bf 100644 --- a/source/games/exhumed/src/menu.cpp +++ b/source/games/exhumed/src/menu.cpp @@ -55,6 +55,12 @@ int word_9AB5B = 0; int keytimer = 0; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + unsigned int menu_RandomBit2() { unsigned int result = nRandom & 1; @@ -71,6 +77,12 @@ unsigned int menu_RandomBit2() return result; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitEnergyTile() { word_9AB5B = 0; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 97771d904..ad47399d1 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -53,6 +53,12 @@ Collision loHit, hiHit; // think this belongs in init.c? +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkMove() { GC::MarkArray(nBodySprite, 50); @@ -90,6 +96,12 @@ void SerializeMove(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void MoveThings() { thinktime.Reset(); @@ -131,17 +143,11 @@ void MoveThings() thinktime.Unclock(); } -void ResetMoveFifo() -{ - movefifoend = 0; - movefifopos = 0; -} - -// not used -void clipwall() -{ - -} +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int BelowNear(DExhumedActor* pActor, double walldist) { @@ -213,6 +219,12 @@ int BelowNear(DExhumedActor* pActor, double walldist) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + Collision movespritez(DExhumedActor* pActor, double z, double height, double clipdist) { auto pSector = pActor->sector(); @@ -382,6 +394,12 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli return nRet; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + double GetActorHeight(DExhumedActor* actor) { return tileHeight(actor->spr.picnum) * actor->spr.yrepeat * REPEAT_SCALE; @@ -393,6 +411,12 @@ DExhumedActor* insertActor(sectortype* s, int st) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flordist, unsigned int clipmask) { bTouchFloor = false; @@ -463,6 +487,12 @@ Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flo return nRet; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void Gravity(DExhumedActor* pActor) { if (pActor->sector()->Flag & kSectUnderwater) @@ -512,6 +542,12 @@ Collision MoveCreature(DExhumedActor* pActor) return movespritevel(pActor, pActor->vel, 256., -20, CLIPMASK0); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + Collision MoveCreatureWithCaution(DExhumedActor* pActor) { auto oldv = pActor->spr.pos; @@ -542,6 +578,12 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor) return result; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DAngle GetAngleToSprite(DExhumedActor* a1, DExhumedActor* a2) { if (!a1 || !a2) @@ -550,6 +592,12 @@ DAngle GetAngleToSprite(DExhumedActor* a1, DExhumedActor* a2) return VecToAngle(a2->spr.pos - a1->spr.pos); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + double PlotCourseToSprite(DExhumedActor* pActor1, DExhumedActor* pActor2) { if (pActor1 == nullptr || pActor2 == nullptr) @@ -561,6 +609,12 @@ double PlotCourseToSprite(DExhumedActor* pActor1, DExhumedActor* pActor2) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage) { int var_18 = !dontengage; @@ -606,6 +660,12 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage) return pPlayerActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void CheckSectorFloor(sectortype* pSector, double z, DVector2& xy) { int nSpeed = pSector->Speed; @@ -626,6 +686,12 @@ void CheckSectorFloor(sectortype* pSector, double z, DVector2& xy) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitPushBlocks() { nPushBlocks = 0; @@ -641,6 +707,12 @@ int GrabPushBlock() return nPushBlocks++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void CreatePushBlock(sectortype* pSector) { int nBlock = GrabPushBlock(); @@ -680,6 +752,12 @@ void CreatePushBlock(sectortype* pSector) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel) { if (pSector == nullptr) { @@ -871,6 +949,12 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel) initsectp = pActor->sector(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetQuake(DExhumedActor* pActor, int nVal) { for (int i = 0; i < nTotalPlayers; i++) @@ -889,7 +973,13 @@ void SetQuake(DExhumedActor* pActor, int nVal) } } -Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int threshold, int zbob, DAngle push1) +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int threshold, int zbob, DAngle push1) { int nClipType = pActor->spr.statnum != 107; @@ -951,6 +1041,12 @@ DAngle GetWallNormal(walltype* pWall) return (VecToAngle(pWall->delta()) + DAngle90).Normalized360(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DVector3 WheresMyMouth(int nPlayer, sectortype **sectnum) { auto pActor = PlayerList[nPlayer].pActor; @@ -966,6 +1062,12 @@ DVector3 WheresMyMouth(int nPlayer, sectortype **sectnum) return pos; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitChunks() { nCurChunkNum = 0; @@ -978,6 +1080,12 @@ void InitChunks() nChunkTotal = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* GrabBodyGunSprite() { DExhumedActor* pActor = nBodyGunSprite[nCurBodyGunNum]; @@ -1007,6 +1115,12 @@ DExhumedActor* GrabBodyGunSprite() return pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* GrabBody() { DExhumedActor* pActor = nullptr; @@ -1036,6 +1150,12 @@ DExhumedActor* GrabBody() return pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* GrabChunkSprite() { DExhumedActor* pActor = nChunkSprite[nCurChunkNum]; @@ -1065,6 +1185,12 @@ DExhumedActor* GrabChunkSprite() return pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial) { auto pActor = GrabChunkSprite(); @@ -1108,6 +1234,12 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial) return pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AICreatureChunk::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1181,6 +1313,12 @@ void AICreatureChunk::Tick(RunListEvent* ev) pActor->spr.lotag = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy) { if (*ppEnemy) diff --git a/source/games/exhumed/src/movie.cpp b/source/games/exhumed/src/movie.cpp index bbbe08fd0..0248c92be 100644 --- a/source/games/exhumed/src/movie.cpp +++ b/source/games/exhumed/src/movie.cpp @@ -92,6 +92,12 @@ public: return false; } + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + int ReadFrame(FileReader& fp) { nFrame++; @@ -187,6 +193,11 @@ public: } } + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- static bool StreamCallbackFunc(SoundStream* stream, void* buff, int len, void* userdata) { @@ -220,6 +231,12 @@ public: } }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int IdentifyLMF(const FString* fn) { auto fp = fileSystem.OpenFileReader(*fn); diff --git a/source/games/exhumed/src/mummy.cpp b/source/games/exhumed/src/mummy.cpp index f67c03d1c..a63942d20 100644 --- a/source/games/exhumed/src/mummy.cpp +++ b/source/games/exhumed/src/mummy.cpp @@ -37,6 +37,12 @@ static actionSeq MummySeq[] = { }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildMummy(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle) { if (pActor == nullptr) @@ -83,6 +89,12 @@ void BuildMummy(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void CheckMummyRevive(DExhumedActor* pActor) { ExhumedStatIterator it(102); @@ -109,6 +121,12 @@ void CheckMummyRevive(DExhumedActor* pActor) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIMummy::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -390,6 +408,12 @@ void AIMummy::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIMummy::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -400,6 +424,12 @@ void AIMummy::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIMummy::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -412,7 +442,13 @@ void AIMummy::RadialDamage(RunListEvent* ev) Damage(ev); } -void AIMummy::Damage(RunListEvent* ev) +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void AIMummy::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; if (!pActor) return; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 9b9c0fb54..860285347 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -175,6 +175,12 @@ int nFinaleStage; int nDronePitch = 0; int nSmokeSparks = 0; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSerializer& Serialize(FSerializer& arc, const char* keyname, Trail& w, Trail* def) { if (arc.BeginObject(keyname)) @@ -338,7 +344,12 @@ void SerializeObjects(FSerializer& arc) } } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitObjects() { sTrap.Clear(); @@ -362,7 +373,12 @@ void InitElev() Elevator.Clear(); } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildWallSprite(sectortype* pSector) { auto wal = pSector->firstWall(); @@ -375,7 +391,12 @@ DExhumedActor* BuildWallSprite(sectortype* pSector) return pActor; } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* FindWallSprites(sectortype* pSector) { double min_x = DBL_MAX; @@ -443,6 +464,12 @@ DExhumedActor* FindWallSprites(sectortype* pSector) return pAct; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int BuildElevF(int nChannel, sectortype* pSector, DExhumedActor* nWallSprite, int arg_4, int arg_5, int nCount, ...) { auto ElevCount = Elevator.Reserve(1); @@ -482,6 +509,12 @@ int BuildElevF(int nChannel, sectortype* pSector, DExhumedActor* nWallSprite, in return ElevCount; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int BuildElevC(int arg1, int nChannel, sectortype* pSector, DExhumedActor* nWallSprite, int speed1, int speed2, int nCount, ...) { int edi = speed1; @@ -529,9 +562,12 @@ int BuildElevC(int arg1, int nChannel, sectortype* pSector, DExhumedActor* nWall return ElevCount; } -// TODO - tidy me up -// RENAME param A - not always Z -// Confirmed 100% correct with original .exe +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static double LongSeek(double* pZVal, double a2, double a3, double a4) { double v4 = a2 - *pZVal; @@ -553,7 +589,12 @@ static double LongSeek(double* pZVal, double a2, double a3, double a4) return v4; } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int CheckSectorSprites(sectortype* pSector, int nVal) { int b = 0; @@ -599,7 +640,12 @@ int CheckSectorSprites(sectortype* pSector, int nVal) return b; } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void MoveSectorSprites(sectortype* pSector, double z) { double newz = pSector->floorz; @@ -617,6 +663,12 @@ void MoveSectorSprites(sectortype* pSector, double z) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void StartElevSound(DExhumedActor* pActor, int nVal) { int nSound; @@ -631,6 +683,12 @@ void StartElevSound(DExhumedActor* pActor, int nVal) D3PlayFX(StaticSound[nSound], pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIElev::ProcessChannel(RunListEvent* ev) { int nRun = ev->nRun; @@ -712,6 +770,12 @@ void AIElev::ProcessChannel(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIElev::Tick(RunListEvent* ev) { int nRun = ev->nRun; @@ -838,12 +902,17 @@ void AIElev::Tick(RunListEvent* ev) } -// done void InitWallFace() { WallFace.Clear(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...) { auto WallFaceCount = WallFace.Reserve(1); @@ -871,6 +940,12 @@ int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...) return WallFaceCount; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIWallFace::ProcessChannel(RunListEvent* ev) { int nWallFace = RunData[ev->nRun].nObjIndex; @@ -886,24 +961,33 @@ void AIWallFace::ProcessChannel(RunListEvent* ev) } } -// done +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitPoint() { PointList.Clear(); } -// done int GrabPoint() { return PointList.Reserve(1); } -// done void InitSlide() { SlideData.Clear(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p2ndLastWall, walltype* pWall2, walltype* pWall3, walltype* pWall4) { auto nSlide = SlideData.Reserve(1); @@ -987,6 +1071,12 @@ int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p return nSlide; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISlide::ProcessChannel(RunListEvent* ev) { int nRun = ev->nRun; @@ -1014,6 +1104,12 @@ void AISlide::ProcessChannel(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISlide::Tick(RunListEvent* ev) { int nRun = ev->nRun; @@ -1128,6 +1224,12 @@ void AISlide::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx) { int var_14 = edx; @@ -1190,6 +1292,12 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx) return nTrap; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AITrap::ProcessChannel(RunListEvent* ev) { int nChannel = ev->nParam & 0x3FFF; @@ -1205,6 +1313,12 @@ void AITrap::ProcessChannel(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AITrap::Tick(RunListEvent* ev) { int nTrap = RunData[ev->nRun].nObjIndex; @@ -1277,6 +1391,12 @@ void AITrap::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int BuildArrow(DExhumedActor* nSprite, int nVal) { return BuildTrap(nSprite, 0, -1, nVal); @@ -1287,6 +1407,12 @@ int BuildFireBall(DExhumedActor* nSprite, int a, int b) return BuildTrap(nSprite, 1, a, b); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal) { auto pSpark = insertActor(pActor->sector(), 0); @@ -1348,6 +1474,12 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal) return pSpark; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISpark::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1397,6 +1529,12 @@ void AISpark::Tick(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DimLights() { static int word_96786 = 0; @@ -1421,6 +1559,12 @@ void DimLights() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoFinale() { static int dword_96788 = 0; @@ -1487,6 +1631,12 @@ void DoFinale() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildEnergyBlock(sectortype* pSector) { DVector2 apos(0, 0); @@ -1530,7 +1680,12 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector) return pActor; } -// TODO - tidy +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void KillCreatures() { signed int v0; @@ -1558,6 +1713,12 @@ void KillCreatures() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ExplodeEnergyBlock(DExhumedActor* pActor) { auto pSector = pActor->sector(); @@ -1653,6 +1814,12 @@ void ExplodeEnergyBlock(DExhumedActor* pActor) ChangeActorStat(pActor, 0); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIEnergyBlock::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1682,6 +1849,12 @@ void AIEnergyBlock::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIEnergyBlock::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1713,6 +1886,12 @@ void AIEnergyBlock::RadialDamage(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag) { ChangeActorStat(pActor, ObjectStatnum[nOjectType]); @@ -1773,7 +1952,12 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag) return pActor; } +//--------------------------------------------------------------------------- +// // in-game destructable wall mounted screen +// +//--------------------------------------------------------------------------- + void ExplodeScreen(DExhumedActor* pActor) { pActor->spr.pos.Z -= GetActorHeight(pActor) * 0.5; @@ -1786,6 +1970,12 @@ void ExplodeScreen(DExhumedActor* pActor) PlayFX2(StaticSound[kSound78], pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIObject::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1897,6 +2087,12 @@ void AIObject::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIObject::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1928,6 +2124,12 @@ void AIObject::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIObject::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -1941,6 +2143,12 @@ void AIObject::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIObject::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -2008,6 +2216,12 @@ void BuildDrip(DExhumedActor* pActor) pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoDrips() { for (unsigned i = 0; i < sDrip.Size(); i++) @@ -2049,6 +2263,12 @@ void DoDrips() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SnapBobs(sectortype* pSectorA, sectortype* pSectorB) { int select1 = -1; @@ -2089,6 +2309,12 @@ void SnapBobs(sectortype* pSectorA, sectortype* pSectorB) sBob[select1].nPhase = sBob[select2].nPhase; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddSectorBob(sectortype* pSector, int nHitag, int bx) { auto nBobs = sBob.Reserve(1); @@ -2113,6 +2339,12 @@ void AddSectorBob(sectortype* pSector, int nHitag, int bx) pSector->Flag |= 0x0010; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int FindTrail(int nVal) { for (unsigned i = 0; i < sTrail.Size(); i++) @@ -2128,7 +2360,12 @@ int FindTrail(int nVal) return nTrails; } -// ok ? +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ProcessTrailSprite(DExhumedActor* pActor, int nLotag, int nHitag) { auto nPoint = sTrailPoint.Reserve(1); @@ -2186,7 +2423,12 @@ void ProcessTrailSprite(DExhumedActor* pActor, int nLotag, int nHitag) DeleteActor(pActor); } -// ok? +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AddMovingSector(sectortype* pSector, int lotag, int hitag, int flags) { CreatePushBlock(pSector); @@ -2218,6 +2460,12 @@ void AddMovingSector(sectortype* pSector, int lotag, int hitag, int flags) pSector->floorstat |= CSTAT_SECTOR_ALIGN; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DoMovingSects() { for (unsigned i = 0; i < sMoveSect.Size(); i++) @@ -2305,6 +2553,12 @@ void DoMovingSects() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void PostProcess() { for (unsigned i = 0; i < sMoveSect.Size(); i++) diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 42653964e..9f56d1d28 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -33,6 +33,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang, int horz) { Player *nPlayer = &PlayerList[nLocalPlayer]; @@ -51,6 +57,12 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang, int h } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static int osdcmd_doors(CCmdFuncPtr parm) { for (int i = 0; i < kMaxChannels; i++) @@ -66,6 +78,12 @@ static int osdcmd_doors(CCmdFuncPtr parm) return CCMD_OK; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static int osdcmd_spawn(CCmdFuncPtr parm) { if (parm->numparms != 1) return CCMD_SHOWHELP; @@ -89,6 +107,12 @@ static int osdcmd_spawn(CCmdFuncPtr parm) return CCMD_OK; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::ToggleThirdPerson() { if (gamestate != GS_LEVEL) return; @@ -106,6 +130,12 @@ void GameInterface::ToggleThirdPerson() } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int32_t registerosdcommands(void) { //if (VOLUMEONE) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index f9f400002..2528aec72 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -88,6 +88,12 @@ int nNetStartSprites; int nCurStartSprite; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkPlayers() { for (auto& p : PlayerList) @@ -101,6 +107,12 @@ size_t MarkPlayers() return 5 * kMaxPlayers; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetSavePoint(int nPlayer, const DVector3& pos, sectortype* pSector, DAngle nAngle) { PlayerList[nPlayer].sPlayerSave.pos = pos; @@ -108,6 +120,12 @@ void SetSavePoint(int nPlayer, const DVector3& pos, sectortype* pSector, DAngle PlayerList[nPlayer].sPlayerSave.nAngle = nAngle; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void feebtag(const DVector3& pos, sectortype* pSector, DExhumedActor **nSprite, int nVal2, double deflen) { *nSprite = nullptr; @@ -155,6 +173,12 @@ void feebtag(const DVector3& pos, sectortype* pSector, DExhumedActor **nSprite, } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitPlayer() { for (int i = 0; i < kMaxPlayers; i++) { @@ -169,6 +193,12 @@ void InitPlayerKeys(int nPlayer) PlayerList[nPlayer].keys = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitPlayerInventory(int nPlayer) { memset(&PlayerList[nPlayer], 0, sizeof(Player)); @@ -199,11 +229,23 @@ void InitPlayerInventory(int nPlayer) PlayerList[nPlayer].nPlayerColor = pixels[tileWidth(nPlayer + kTile3571) * tileHeight(nPlayer + kTile3571) / 2]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int GetPlayerFromActor(DExhumedActor* pActor) { return RunData[pActor->spr.intowner].nObjIndex; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void RestartPlayer(int nPlayer) { auto plr = &PlayerList[nPlayer]; @@ -399,6 +441,12 @@ void RestartPlayer(int nPlayer) nQuake[nPlayer] = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int GrabPlayer() { if (PlayerCount >= kMaxPlayers) { @@ -408,6 +456,12 @@ int GrabPlayer() return PlayerCount++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void StartDeathSeq(int nPlayer, int nVal) { FreeRa(nPlayer); @@ -500,6 +554,12 @@ void StartDeathSeq(int nPlayer, int nVal) PlayerList[nPlayer].ototalvel = PlayerList[nPlayer].totalvel = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount) { if (!nAmmoAmount) { @@ -529,6 +589,12 @@ int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount) return 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SetPlayerMummified(int nPlayer, int bIsMummified) { DExhumedActor* pActor = PlayerList[nPlayer].pActor; @@ -552,6 +618,12 @@ void SetPlayerMummified(int nPlayer, int bIsMummified) PlayerList[nPlayer].nSeqSize = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ShootStaff(int nPlayer) { PlayerList[nPlayer].nAction = 15; @@ -559,6 +631,12 @@ void ShootStaff(int nPlayer) PlayerList[nPlayer].nSeq = kSeqJoe; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void PlayAlert(const char *str) { StatusMessage(300, str); @@ -566,6 +644,12 @@ void PlayAlert(const char *str) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static void pickupMessage(int no) { no = nItemText[no]; @@ -577,12 +661,24 @@ static void pickupMessage(int no) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void UpdatePlayerSpriteAngle(Player* pPlayer) { inita = pPlayer->angle.ang; if (pPlayer->pActor) pPlayer->pActor->spr.angle = inita; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIPlayer::Draw(RunListEvent* ev) { int nPlayer = RunData[ev->nRun].nObjIndex; @@ -592,6 +688,12 @@ void AIPlayer::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, SeqOffsets[PlayerList[nPlayer].nSeq] + PlayerSeq[nAction].a, PlayerList[nPlayer].nSeqSize, PlayerSeq[nAction].b); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIPlayer::RadialDamage(RunListEvent* ev) { int nPlayer = RunData[ev->nRun].nObjIndex; @@ -608,6 +710,12 @@ void AIPlayer::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIPlayer::Damage(RunListEvent* ev) { int nDamage = ev->nDamage; @@ -712,6 +820,12 @@ void AIPlayer::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectortype* spr_sect) { auto pPlayerActor = PlayerList[nPlayer].pActor; @@ -773,6 +887,12 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort return false; } +//--------------------------------------------------------------------------- +// +// this function is pure spaghetti madness... :( +// +//--------------------------------------------------------------------------- + void AIPlayer::Tick(RunListEvent* ev) { int var_48 = 0; @@ -2551,6 +2671,11 @@ sectdone: MoveWeapons(nPlayer); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player* def) { @@ -2643,6 +2768,11 @@ void SerializePlayer(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- DEFINE_FIELD_X(ExhumedPlayer, Player, nHealth); DEFINE_FIELD_X(ExhumedPlayer, Player, nLives); diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index dca99d6ce..20add8ca2 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -123,6 +123,12 @@ sectortype* MoveQS[25]; DAngle MoveQA[25]; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkQueen() { GC::Mark(QueenList[0].pActor); @@ -137,6 +143,12 @@ size_t MarkQueen() return 4 + 2 * kMaxEggs; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSerializer& Serialize(FSerializer& arc, const char* keyname, Queen& w, Queen* def) { if (arc.BeginObject(keyname)) @@ -213,6 +225,12 @@ void SerializeQueen(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitQueens() { QueenCount = 1; @@ -238,6 +256,12 @@ void BlowChunks(DExhumedActor* pActor) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyEgg(int nEgg) { DExhumedActor* pActor = QueenEgg[nEgg].pActor; @@ -265,6 +289,12 @@ void DestroyEgg(int nEgg) QueenEgg.Release(nEgg); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroyAllEggs() { for (int i = 0; i < kMaxEggs; i++) @@ -281,6 +311,12 @@ void SetHeadVel(DExhumedActor* pActor) pActor->vel.XY() = pActor->spr.angle.ToVector() * 1024 * (1 << nVelShift); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + Collision QueenAngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int threshold, DAngle val2) { DAngle nAngle; @@ -335,6 +371,12 @@ Collision QueenAngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int thr return movesprite(pActor, vec, zz * 16 + BobVal(bobangle) * 2, 0, CLIPMASK1); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int DestroyTailPart() { if (!QueenHead.nIndex2) { @@ -357,6 +399,12 @@ int DestroyTailPart() return 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildTail() { auto head = QueenHead.pActor; @@ -398,6 +446,12 @@ void BuildTail() QueenHead.nIndex2 = 7; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildQueenEgg(int nQueen, int nVal) { int nEgg = GrabEgg(); @@ -463,6 +517,12 @@ void BuildQueenEgg(int nQueen, int nVal) QueenEgg[nEgg].nRun = runlist_AddRunRec(NewRun, nEgg, 0x1D0000); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenEgg::Tick(RunListEvent* ev) { int nEgg = RunData[ev->nRun].nObjIndex; @@ -617,6 +677,12 @@ void AIQueenEgg::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenEgg::RadialDamage(RunListEvent* ev) { int nEgg = RunData[ev->nRun].nObjIndex; @@ -632,6 +698,12 @@ void AIQueenEgg::RadialDamage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenEgg::Damage(RunListEvent* ev) { int nEgg = RunData[ev->nRun].nObjIndex; @@ -646,6 +718,12 @@ void AIQueenEgg::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenEgg::Draw(RunListEvent* ev) { int nEgg = RunData[ev->nRun].nObjIndex; @@ -653,6 +731,12 @@ void AIQueenEgg::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, SeqOffsets[kSeqQueenEgg] + EggSeq[pEgg->nAction].a, pEgg->nFrame, EggSeq[pEgg->nAction].b); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildQueenHead(int nQueen) { DExhumedActor* pActor = QueenList[nQueen].pActor; @@ -699,6 +783,12 @@ void BuildQueenHead(int nQueen) QueenHead.nIndex2 = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenHead::Tick(RunListEvent* ev) { DExhumedActor* pActor = QueenHead.pActor; @@ -976,6 +1066,12 @@ void AIQueenHead::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenHead::RadialDamage(RunListEvent* ev) { if (ev->pRadialActor->spr.statnum != 121 && (QueenHead.pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0) @@ -985,6 +1081,12 @@ void AIQueenHead::RadialDamage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenHead::Damage(RunListEvent* ev) { DExhumedActor* pActor = QueenHead.pActor; @@ -1020,6 +1122,12 @@ void AIQueenHead::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueenHead::Draw(RunListEvent* ev) { int nHead = RunData[ev->nRun].nObjIndex; @@ -1043,6 +1151,12 @@ void AIQueenHead::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, nSeq, QueenHead.nFrame, edx); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildQueen(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle, int nChannel) { QueenCount--; @@ -1107,6 +1221,12 @@ void SetQueenSpeed(DExhumedActor* pActor, int nSpeed) pActor->VelFromAngle(-(2 - nSpeed)); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueen::Tick(RunListEvent* ev) { int nQueen = RunData[ev->nRun].nObjIndex; @@ -1365,6 +1485,12 @@ void AIQueen::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueen::RadialDamage(RunListEvent* ev) { int nQueen = RunData[ev->nRun].nObjIndex; @@ -1379,6 +1505,12 @@ void AIQueen::RadialDamage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueen::Damage(RunListEvent* ev) { int nQueen = RunData[ev->nRun].nObjIndex; @@ -1436,6 +1568,12 @@ void AIQueen::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIQueen::Draw(RunListEvent* ev) { int nQueen = RunData[ev->nRun].nObjIndex; diff --git a/source/games/exhumed/src/ra.cpp b/source/games/exhumed/src/ra.cpp index e4e26932d..d10abfafc 100644 --- a/source/games/exhumed/src/ra.cpp +++ b/source/games/exhumed/src/ra.cpp @@ -37,6 +37,12 @@ static actionSeq RaSeq[] = { {2, 0} }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkRa() { for (auto& r : Ra) @@ -47,6 +53,12 @@ size_t MarkRa() return 2 * kMaxPlayers; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSerializer& Serialize(FSerializer& arc, const char* keyname, RA& w, RA* def) { if (arc.BeginObject(keyname)) @@ -69,6 +81,12 @@ void SerializeRa(FSerializer& arc) arc.Array("ra", Ra, PlayerCount); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void FreeRa(int nPlayer) { int nRun = Ra[nPlayer].nRun; @@ -83,6 +101,12 @@ void FreeRa(int nPlayer) Ra[nPlayer] = {}; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildRa(int nPlayer) { auto pPlayerActor = PlayerList[nPlayer].pActor; @@ -119,6 +143,12 @@ void InitRa() memset(Ra, 0, sizeof(RA) * kMaxPlayers); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void MoveRaToEnemy(int nPlayer) { DExhumedActor* pTarget = Ra[nPlayer].pTarget; @@ -170,6 +200,12 @@ void MoveRaToEnemy(int nPlayer) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRa::Tick(RunListEvent* ev) { int nPlayer = RunData[ev->nRun].nObjIndex; @@ -293,6 +329,12 @@ void AIRa::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRa::Draw(RunListEvent* ev) { int nPlayer = RunData[ev->nRun].nObjIndex; diff --git a/source/games/exhumed/src/ramses.cpp b/source/games/exhumed/src/ramses.cpp index adf3b2c50..1f54f5844 100644 --- a/source/games/exhumed/src/ramses.cpp +++ b/source/games/exhumed/src/ramses.cpp @@ -191,8 +191,13 @@ void CopyHeadToWorkTile(int nTile) } } +//--------------------------------------------------------------------------- +// // This is based on BuildGDX's version of this function which was a lot less cryptic than PCExhumed's. -void DoSpiritHead() +// +//--------------------------------------------------------------------------- + +void DoSpiritHead() { static int dimSectCount = 0; auto pSpiritSpr = pSpiritSprite; diff --git a/source/games/exhumed/src/random.cpp b/source/games/exhumed/src/random.cpp index 394ea88a8..14f291da3 100644 --- a/source/games/exhumed/src/random.cpp +++ b/source/games/exhumed/src/random.cpp @@ -25,6 +25,12 @@ int randA = 0; int randB = 0x11111111; int randC = 0x1010101; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeRand(FSerializer& arc) { if (arc.BeginObject("rand")) @@ -36,6 +42,12 @@ void SerializeRand(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitRandom() { randA = 0; @@ -52,6 +64,12 @@ int RandomBit() return (((randA == 0) & randC) | (randB & randA)) & 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + uint8_t RandomByte() { uint8_t randByte = RandomBit() << 7; @@ -65,6 +83,12 @@ uint8_t RandomByte() return randByte; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + uint16_t RandomWord() { uint16_t randWord = RandomByte() << 8; diff --git a/source/games/exhumed/src/rat.cpp b/source/games/exhumed/src/rat.cpp index 43822e265..6bfa35023 100644 --- a/source/games/exhumed/src/rat.cpp +++ b/source/games/exhumed/src/rat.cpp @@ -37,6 +37,12 @@ static actionSeq RatSeq[] = { {0, 1} }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeRat(FSerializer& arc) { if (arc.BeginObject("rat")) @@ -48,6 +54,12 @@ void SerializeRat(FSerializer& arc) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitRats() { nMinChunk = 9999; @@ -72,6 +84,12 @@ void SetRatVel(DExhumedActor* pActor) pActor->VelFromAngle(-2); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildRat(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle) { if (pActor == nullptr) @@ -120,6 +138,12 @@ void BuildRat(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x240000); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* FindFood(DExhumedActor* pActor) { auto pSector = pActor->sector(); @@ -153,6 +177,12 @@ DExhumedActor* FindFood(DExhumedActor* pActor) return nullptr; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRat::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -162,6 +192,12 @@ void AIRat::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRat::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -177,6 +213,12 @@ void AIRat::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRat::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -187,6 +229,12 @@ void AIRat::Draw(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRat::Tick(RunListEvent* ev) { constexpr double CHECK_DIST = 50/16.; diff --git a/source/games/exhumed/src/rex.cpp b/source/games/exhumed/src/rex.cpp index 5064e4781..a9c94d873 100644 --- a/source/games/exhumed/src/rex.cpp +++ b/source/games/exhumed/src/rex.cpp @@ -37,6 +37,12 @@ static actionSeq RexSeq[] = { {28, 1} }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildRex(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle, int nChannel) { if (pActor == nullptr) @@ -87,6 +93,12 @@ void BuildRex(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRex::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -101,6 +113,12 @@ void AIRex::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRex::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -141,6 +159,12 @@ void AIRex::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRex::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -152,6 +176,12 @@ void AIRex::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRex::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; diff --git a/source/games/exhumed/src/roach.cpp b/source/games/exhumed/src/roach.cpp index c4ec31889..432ea646d 100644 --- a/source/games/exhumed/src/roach.cpp +++ b/source/games/exhumed/src/roach.cpp @@ -34,7 +34,12 @@ static actionSeq RoachSeq[] = { {42, 1} }; -// TODO - make nType a bool? +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildRoach(int nType, DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle angle) { if (pActor == nullptr) @@ -89,6 +94,12 @@ void BuildRoach(int nType, DExhumedActor* pActor, const DVector3& pos, sectortyp nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GoRoach(DExhumedActor* pActor) { pActor->vel.XY() = pActor->spr.angle.ToVector() * (512 - 128); @@ -104,6 +115,12 @@ void AIRoach::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRoach::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -113,6 +130,12 @@ void AIRoach::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRoach::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -173,6 +196,12 @@ void AIRoach::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIRoach::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; diff --git a/source/games/exhumed/src/runlist.cpp b/source/games/exhumed/src/runlist.cpp index f5bb7ebb8..011f2d641 100644 --- a/source/games/exhumed/src/runlist.cpp +++ b/source/games/exhumed/src/runlist.cpp @@ -181,6 +181,12 @@ int runlist_GrabRun() return RunData.Get(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_FreeRun(int nRun) { assert(nRun >= 0 && nRun < kMaxRuns); @@ -194,6 +200,12 @@ int runlist_FreeRun(int nRun) return 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_HeadRun() { int nRun = runlist_GrabRun(); @@ -204,6 +216,12 @@ int runlist_HeadRun() return nRun; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_InitRun() { int i; @@ -231,6 +249,12 @@ void runlist_InitRun() pRadialActor = nullptr; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_UnlinkRun(int nRun) { if (!(nRun >= 0 && nRun < kMaxRuns)) return; @@ -252,6 +276,12 @@ void runlist_UnlinkRun(int nRun) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_InsertRun(int RunLst, int RunNum) { if (!(RunLst >= 0 && RunLst < kMaxRuns)) return; @@ -268,6 +298,12 @@ void runlist_InsertRun(int RunLst, int RunNum) RunData[RunLst].next = RunNum; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_AddRunRec(int nIndex, int nObject, int nAIType) { int nRun = runlist_GrabRun(); @@ -305,6 +341,12 @@ int runlist_AddRunRec(int nIndex, RunStruct* other) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_DoSubRunRec(int RunPtr) { if (!(RunPtr >= 0 && RunPtr < kMaxRuns)) return; @@ -313,6 +355,12 @@ void runlist_DoSubRunRec(int RunPtr) runlist_FreeRun(RunPtr); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_CleanRunRecs() { int nextPtr = RunChain; @@ -337,6 +385,12 @@ void runlist_CleanRunRecs() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_SubRunRec(int RunPtr) { if (!(RunPtr >= 0 && RunPtr < kMaxRuns)) return; @@ -344,6 +398,12 @@ void runlist_SubRunRec(int RunPtr) RunData[RunPtr].nAIType = -totalmoves; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_SendMessage(int nRun, int nObject, void(ExhumedAI::* func)(RunListEvent*), RunListEvent* ev) { int nFunc = RunData[nRun].nAIType >> 16; @@ -367,6 +427,12 @@ void runlist_SendMessage(int nRun, int nObject, void(ExhumedAI::* func)(RunListE (ais[nFunc]->*func)(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ExplodeSignalRun() { int nextPtr = RunChain; @@ -397,6 +463,12 @@ void runlist_ExplodeSignalRun() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_PushMoveRun(int eax) { if (nStackCount < kMaxRunStack) @@ -406,6 +478,12 @@ void runlist_PushMoveRun(int eax) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_PopMoveRun() { if (nStackCount <= 0) { @@ -417,6 +495,12 @@ int runlist_PopMoveRun() return sRunStack[nStackCount]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_SignalRun(int NxtPtr, int edx, void(ExhumedAI::* func)(RunListEvent*), RunListEvent* ev) { if (NxtPtr == RunChain && word_966BE != 0) { @@ -459,6 +543,12 @@ void runlist_SignalRun(int NxtPtr, int edx, void(ExhumedAI::* func)(RunListEvent } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_InitChan() { ChannelList = -1; @@ -473,6 +563,12 @@ void runlist_InitChan() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ChangeChannel(int eax, int nVal) { if (sRunChannels[eax].b < 0) @@ -486,6 +582,12 @@ void runlist_ChangeChannel(int eax, int nVal) sRunChannels[eax].d |= 2; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ReadyChannel(int eax) { if (sRunChannels[eax].b < 0) @@ -498,6 +600,12 @@ void runlist_ReadyChannel(int eax) sRunChannels[eax].d |= 1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ProcessChannels() { int v0; @@ -553,6 +661,12 @@ void runlist_ProcessChannels() } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_FindChannel(int ax) { for (int i = 0; i < kMaxChannels; i++) @@ -567,6 +681,12 @@ int runlist_FindChannel(int ax) return -1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_AllocChannel(int a) { if (a) @@ -582,12 +702,24 @@ int runlist_AllocChannel(int a) return runlist_FindChannel(a); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ExecObjects() { runlist_ProcessChannels(); runlist_SignalRun(RunChain, 0, &ExhumedAI::Tick); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag) { double zListA[8]; @@ -1465,6 +1597,12 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_ProcessWallTag(walltype* pWall, int nLotag, int nHitag) { auto& wal = *pWall; @@ -1585,6 +1723,12 @@ void runlist_ProcessWallTag(walltype* pWall, int nLotag, int nHitag) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int runlist_CheckRadialDamage(DExhumedActor* pActor) { if (pActor == pRadialActor) { @@ -1659,6 +1803,12 @@ int runlist_CheckRadialDamage(DExhumedActor* pActor) return edi; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_RadialDamageEnemy(DExhumedActor* pActor, int nDamage, int nRadius) { if (!nRadius) { @@ -1677,6 +1827,12 @@ void runlist_RadialDamageEnemy(DExhumedActor* pActor, int nDamage, int nRadius) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, int nDamage) { if (pActor->spr.statnum >= kMaxStatus) { diff --git a/source/games/exhumed/src/save.cpp b/source/games/exhumed/src/save.cpp index daa2c987b..7cfcb9b4b 100644 --- a/source/games/exhumed/src/save.cpp +++ b/source/games/exhumed/src/save.cpp @@ -49,6 +49,12 @@ void SerializeView(FSerializer& arc); void SerializeQueen(FSerializer& arc); void SerializeRat(FSerializer& arc); +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void GameInterface::SerializeGameState(FSerializer& arc) { if (arc.BeginObject("exhumed")) diff --git a/source/games/exhumed/src/scorp.cpp b/source/games/exhumed/src/scorp.cpp index 267dbdb7f..a13126ac8 100644 --- a/source/games/exhumed/src/scorp.cpp +++ b/source/games/exhumed/src/scorp.cpp @@ -38,6 +38,12 @@ static actionSeq ScorpSeq[] = { {53, 1} }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildScorp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle, int nChannel) { if (pActor == nullptr) @@ -87,6 +93,12 @@ void BuildScorp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIScorp::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -97,6 +109,12 @@ void AIScorp::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, SeqOffsets[kSeqScorp] + ScorpSeq[nAction].a, pActor->nFrame, ScorpSeq[nAction].b); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIScorp::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -107,6 +125,12 @@ void AIScorp::RadialDamage(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIScorp::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -163,6 +187,12 @@ void AIScorp::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIScorp::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -394,6 +424,12 @@ void AIScorp::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode) { auto pActor = ev->pObjActor; diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index 7cf864566..5c8292598 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -151,6 +151,12 @@ const char *SeqNames[kMaxSEQFiles] = int16_t SeqOffsets[kMaxSEQFiles]; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int seq_ReadSequence(const char *seqName) { int i; @@ -295,6 +301,12 @@ int seq_ReadSequence(const char *seqName) return nSeqs; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int seq_GetFirstSeqPicnum(int nSeq) { int i = SeqOffsets[nSeq]; @@ -305,6 +317,12 @@ int seq_GetFirstSeqPicnum(int nSeq) return i; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void seq_LoadSequences() { int i; @@ -359,11 +377,23 @@ void seq_LoadSequences() } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int16_t seq_GetFrameFlag(int16_t val, int16_t nFrame) { return FrameFlag[SeqBase[val] + nFrame]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void seq_DrawPilotLightSeq(double xOffset, double yOffset) { auto pSect = PlayerList[nLocalPlayer].pPlayerViewSect; @@ -390,12 +420,11 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset) } } -/* - 6 parameters - - arg0 - shade? - -*/ +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs, int nShade, int nPal, bool align) { @@ -444,6 +473,12 @@ int seq_GetFrameSound(int val, int edx) return FrameSound[SeqBase[val] + edx]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t bx) { assert(nSeq >= 0); // TEMP @@ -461,12 +496,24 @@ void seq_MoveSequence(DExhumedActor* actor, int16_t nSeq, int16_t bx) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int seq_GetSeqPicnum2(int16_t nSeq, int16_t nFrame) { int16_t nBase = FrameBase[SeqBase[nSeq] + nFrame]; return ChunkPict[nBase]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx) { edx += SeqOffsets[nSeq]; @@ -476,6 +523,12 @@ int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx) return ChunkPict[c]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal) { tspritetype* pTSprite = mytspriteArray->get(nSprite); @@ -524,6 +577,12 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal) return ChunkPict[nFrameBase]; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx) { tspritetype* pTSprite = mytspriteArray->get(nSprite); @@ -642,6 +701,12 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx) return nPict; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void SerializeSequence(FSerializer& arc) { if (arc.BeginObject("sequence")) diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index df33ec7ec..cb1b4964c 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -39,6 +39,12 @@ static actionSeq SetSeq[] = { {74, 1} }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildSet(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle, int nChannel) { if (pActor == nullptr) @@ -91,6 +97,12 @@ void BuildSet(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D nCreaturesTotal++; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildSoul(DExhumedActor* pSet) { auto pActor = insertActor(pSet->sector(), 0); @@ -121,6 +133,12 @@ void BuildSoul(DExhumedActor* pSet) pActor->spr.intowner = runlist_AddRunRec(NewRun, pActor, 0x230000); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISoul::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -156,6 +174,12 @@ void AISoul::Tick(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISet::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -170,6 +194,12 @@ void AISet::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISet::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -209,6 +239,12 @@ void AISet::Damage(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISet::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -219,6 +255,12 @@ void AISet::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISet::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor; diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 5d1060a8c..d8808cca1 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -33,6 +33,12 @@ FreeListArray SnakeList; int16_t nPlayerSnake[kMaxPlayers]; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + size_t MarkSnake() { for (int i = 0; i < kMaxSnakes; i++) @@ -43,6 +49,12 @@ size_t MarkSnake() return kMaxSnakes * (1 + kSnakeSprites); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSerializer& Serialize(FSerializer& arc, const char* keyname, Snake& w, Snake* def) { if (arc.BeginObject(keyname)) @@ -65,6 +77,11 @@ void SerializeSnake(FSerializer& arc) arc.Array("playersnake", nPlayerSnake, PlayerCount); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void InitSnakes() { @@ -77,6 +94,12 @@ int GrabSnake() return SnakeList.Get(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DestroySnake(int nSnake) { int nRun = SnakeList[nSnake].nRun; @@ -101,6 +124,12 @@ void DestroySnake(int nSnake) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer) { int nDamage = BulletInfo[kWeaponStaff].nDamage; @@ -124,6 +153,12 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer) StopActorSound(pActor); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void BuildSnake(int nPlayer, double zVal) { zVal -= 5; @@ -236,6 +271,12 @@ void BuildSnake(int nPlayer, double zVal) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* FindSnakeEnemy(int nSnake) { int nPlayer = SnakeList[nSnake].nSnakePlayer; @@ -286,6 +327,12 @@ DExhumedActor* FindSnakeEnemy(int nSnake) return pEnemy; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISnake::Tick(RunListEvent* ev) { int nSnake = RunData[ev->nRun].nObjIndex; @@ -371,6 +418,12 @@ void AISnake::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISnake::Draw(RunListEvent* ev) { int nSnake = RunData[ev->nRun].nObjIndex; diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index b37cc1dfe..fe1735f5c 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -36,6 +36,12 @@ static actionSeq SpiderSeq[] = { }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildSpider(DExhumedActor* spp, const DVector3& pos, sectortype* pSector, DAngle nAngle) { if (spp == nullptr) @@ -85,6 +91,12 @@ DExhumedActor* BuildSpider(DExhumedActor* spp, const DVector3& pos, sectortype* return spp; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISpider::Tick(RunListEvent* ev) { auto spp = ev->pObjActor; @@ -329,6 +341,12 @@ void AISpider::Tick(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISpider::Draw(RunListEvent* ev) { auto spp = ev->pObjActor; @@ -339,6 +357,12 @@ void AISpider::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, SeqOffsets[kSeqSpider] + SpiderSeq[nAction].a, spp->nFrame, SpiderSeq[nAction].b); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISpider::RadialDamage(RunListEvent* ev) { auto spp = ev->pObjActor; @@ -351,6 +375,12 @@ void AISpider::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISpider::Damage(RunListEvent* ev) { auto spp = ev->pObjActor; diff --git a/source/games/exhumed/src/status.cpp b/source/games/exhumed/src/status.cpp index 0500a16d1..5ea50c1d9 100644 --- a/source/games/exhumed/src/status.cpp +++ b/source/games/exhumed/src/status.cpp @@ -77,6 +77,12 @@ struct ChunkFrame } }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DEFINE_ACTION_FUNCTION(_ChunkFrame, GetChunkFrame) { PARAM_SELF_STRUCT_PROLOGUE(ChunkFrame); @@ -118,6 +124,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Exhumed, SizeOfStatusSequence, SizeOfStatusSequen ACTION_RETURN_INT(SeqSize[nStatusSeqOffset + s1]); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void UpdateFrame() { auto tex = tileGetTexture(nBackgroundPic); @@ -133,6 +145,12 @@ void UpdateFrame() twod->AddFlatFill(viewport3d.Left() - 3, viewport3d.Bottom(), viewport3d.Right(), viewport3d.Bottom() + 3, tex, 0, 1, 0xff2a2a2a); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void StatusMessage(int messageTime, const char* fmt, ...) { va_list ap; @@ -142,6 +160,12 @@ void StatusMessage(int messageTime, const char* fmt, ...) va_end(ap); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DrawStatusBar() { if (hud_size <= Hud_Stbar) diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index 952f2957d..6d3a92fdf 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -53,6 +53,12 @@ struct Switch TArray LinkMap; Switch SwitchData[kMaxSwitches]; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + FSerializer& Serialize(FSerializer& arc, const char* keyname, Link& w, Link* def) { arc.Array(keyname, w.v, 8); @@ -85,6 +91,12 @@ void SerializeSwitch(FSerializer& arc) ("linkmap", LinkMap); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitLink() { LinkMap.Clear(); @@ -117,6 +129,12 @@ int BuildLink(int nCount, ...) return LinkCount; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void InitSwitch() { SwitchCount = kMaxSwitches; @@ -136,6 +154,12 @@ std::pair BuildSwReady(int nChannel, int nLink) return { SwitchCount, 0x10000 }; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWReady::Process(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -151,6 +175,12 @@ void AISWReady::Process(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + std::pair BuildSwPause(int nChannel, int nLink, int ebx) { for (int i = kMaxSwitches - 1; i >= SwitchCount; i--) @@ -174,6 +204,12 @@ std::pair BuildSwPause(int nChannel, int nLink, int ebx) return { SwitchCount, 0x20000 }; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPause::ProcessChannel(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -184,6 +220,12 @@ void AISWPause::ProcessChannel(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPause::Tick(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -203,6 +245,12 @@ void AISWPause::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPause::Process(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -234,6 +282,12 @@ void AISWPause::Process(RunListEvent* ev) SwitchData[nSwitch].nWaitTimer = eax; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + std::pair BuildSwStepOn(int nChannel, int nLink, sectortype* pSector) { if (SwitchCount <= 0 || nLink < 0 || pSector == nullptr) @@ -249,6 +303,12 @@ std::pair BuildSwStepOn(int nChannel, int nLink, sectortype* pSector) return { nSwitch , 0x30000 }; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWStepOn::ProcessChannel(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -274,6 +334,12 @@ void AISWStepOn::ProcessChannel(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWStepOn::TouchFloor(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -298,6 +364,12 @@ void AISWStepOn::TouchFloor(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + std::pair BuildSwNotOnPause(int nChannel, int nLink, sectortype* pSector, int ecx) { if (SwitchCount <= 0 || nLink < 0 || pSector == nullptr) @@ -315,6 +387,12 @@ std::pair BuildSwNotOnPause(int nChannel, int nLink, sectortype* pSect return { nSwitch, 0x40000 }; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWNotOnPause::ProcessChannel(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -335,6 +413,12 @@ void AISWNotOnPause::ProcessChannel(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWNotOnPause::Tick(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -352,6 +436,12 @@ void AISWNotOnPause::Tick(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWNotOnPause::Process(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -376,6 +466,12 @@ void AISWNotOnPause::Process(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWNotOnPause::TouchFloor(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -384,6 +480,12 @@ void AISWNotOnPause::TouchFloor(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + std::pair BuildSwPressSector(int nChannel, int nLink, sectortype* pSector, int keyMask) { if (SwitchCount <= 0 || nLink < 0 || pSector == nullptr) @@ -400,6 +502,12 @@ std::pair BuildSwPressSector(int nChannel, int nLink, sectortype* pSec return { nSwitch, 0x50000 }; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPressSector::ProcessChannel(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -425,6 +533,12 @@ void AISWPressSector::ProcessChannel(RunListEvent* ev) SwitchData[nSwitch].nRun2 = runlist_AddRunRec(pSector->lotag - 1, &RunData[ev->nRun]); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPressSector::Use(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -450,6 +564,12 @@ void AISWPressSector::Use(RunListEvent* ev) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + std::pair BuildSwPressWall(int nChannel, int nLink, walltype* pWall) { if (SwitchCount <= 0 || nLink < 0 || !pWall) { @@ -467,6 +587,12 @@ std::pair BuildSwPressWall(int nChannel, int nLink, walltype* pWall) return { SwitchCount, 0x60000 }; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPressWall::Process(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; @@ -488,6 +614,12 @@ void AISWPressWall::Process(RunListEvent* ev) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AISWPressWall::Use(RunListEvent* ev) { int nSwitch = RunData[ev->nRun].nObjIndex; diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 43e0f5e39..f6f9c7514 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -52,7 +52,12 @@ bool bCamera = false; // We cannot drag these through the entire event system... :( tspriteArray* mytspriteArray; -// NOTE - not to be confused with Ken's analyzesprites() +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + static void analyzesprites(tspriteArray& tsprites, const DVector3& view, double const interpfrac) { mytspriteArray = &tsprites; @@ -161,16 +166,26 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& view, double } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void ResetView() { EraseScreen(0); -#ifdef USE_OPENGL videoTintBlood(0, 0, 0); -#endif } static TextOverlay subtitleOverlay; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void DrawView(double interpfrac, bool sceneonly) { DExhumedActor* pEnemy = nullptr; @@ -391,6 +406,12 @@ void DrawView(double interpfrac, bool sceneonly) flash = 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + bool GameInterface::GenerateSavePic() { DrawView(65536, true); @@ -403,13 +424,11 @@ void GameInterface::processSprites(tspriteArray& tsprites, int viewx, int viewy, } -void NoClip() -{ -} - -void Clip() -{ -} +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- void SerializeView(FSerializer& arc) { diff --git a/source/games/exhumed/src/view.h b/source/games/exhumed/src/view.h index d3f6c303e..5770874a5 100644 --- a/source/games/exhumed/src/view.h +++ b/source/games/exhumed/src/view.h @@ -28,8 +28,6 @@ extern bool bCamera; void DrawStatusBar(); void DrawView(double interpfrac, bool sceneonly = false); void ResetView(); -void NoClip(); -void Clip(); extern int16_t dVertPan[]; extern double nQuake[]; diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index 06a31adf9..ba384c4e7 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -39,6 +39,12 @@ void SetWaspVel(DExhumedActor* pActor) pActor->VelFromAngle(); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + DExhumedActor* BuildWasp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, DAngle nAngle, bool bEggWasp) { if (pActor == nullptr) @@ -111,6 +117,12 @@ DExhumedActor* BuildWasp(DExhumedActor* pActor, const DVector3& pos, sectortype* return pActor; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIWasp::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -121,6 +133,12 @@ void AIWasp::Draw(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIWasp::RadialDamage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -133,6 +151,12 @@ void AIWasp::RadialDamage(RunListEvent* ev) Damage(ev); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIWasp::Damage(RunListEvent* ev) { auto pActor = ev->pObjActor; @@ -181,6 +205,12 @@ void AIWasp::Damage(RunListEvent* ev) return; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void AIWasp::Tick(RunListEvent* ev) { auto pActor = ev->pObjActor;