From 0e097903c44e2abed23d2d810a70bae9f57e3493 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 2 Jan 2023 19:39:35 +0100 Subject: [PATCH] - got rid of a large chunk of picnum accesses in Exhumed. --- source/games/exhumed/src/anims.cpp | 2 +- source/games/exhumed/src/anubis.cpp | 2 +- source/games/exhumed/src/bubbles.cpp | 2 +- source/games/exhumed/src/exhumed.h | 7 +++++++ source/games/exhumed/src/fish.cpp | 2 +- source/games/exhumed/src/grenade.cpp | 2 +- source/games/exhumed/src/lavadude.cpp | 2 +- source/games/exhumed/src/lion.cpp | 2 +- source/games/exhumed/src/mummy.cpp | 2 +- source/games/exhumed/src/queen.cpp | 10 +++++----- source/games/exhumed/src/rat.cpp | 2 +- source/games/exhumed/src/rex.cpp | 2 +- source/games/exhumed/src/roach.cpp | 2 +- source/games/exhumed/src/scorp.cpp | 2 +- source/games/exhumed/src/set.cpp | 2 +- source/games/exhumed/src/spider.cpp | 2 +- source/games/exhumed/src/wasp.cpp | 2 +- 17 files changed, 27 insertions(+), 20 deletions(-) diff --git a/source/games/exhumed/src/anims.cpp b/source/games/exhumed/src/anims.cpp index 17c7864e4..51d995743 100644 --- a/source/games/exhumed/src/anims.cpp +++ b/source/games/exhumed/src/anims.cpp @@ -101,7 +101,7 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, const FName seqFile, int seqInde pActor->spr.cstat = 0; pActor->clipdist = 2.5; pActor->spr.scale = DVector2(nScale, nScale); - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.Angles.Yaw = nullAngle; pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index d8dd3e819..55cd998c0 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -68,7 +68,7 @@ void BuildAnubis(DExhumedActor* ap, const DVector3& pos, sectortype* pSector, DA ap->spr.xoffset = 0; ap->spr.shade = -12; ap->spr.yoffset = 0; - ap->spr.picnum = 1; + setvalidpic(ap); ap->spr.pal = ap->sector()->ceilingpal; ap->clipdist = 15; ap->spr.Angles.Yaw = nAngle; diff --git a/source/games/exhumed/src/bubbles.cpp b/source/games/exhumed/src/bubbles.cpp index e89713f3c..ca7225bd5 100644 --- a/source/games/exhumed/src/bubbles.cpp +++ b/source/games/exhumed/src/bubbles.cpp @@ -64,7 +64,7 @@ static DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector, cons pActor->spr.scale = DVector2(0.625, 0.625); pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.Angles.Yaw = nAngle; pActor->vel.X = 0; pActor->vel.Y = 0; diff --git a/source/games/exhumed/src/exhumed.h b/source/games/exhumed/src/exhumed.h index dade56257..51837cc38 100644 --- a/source/games/exhumed/src/exhumed.h +++ b/source/games/exhumed/src/exhumed.h @@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "exhumedactor.h" #include "serialize_obj.h" #include "texturemanager.h" +#include "texinfo.h" #include "player.h" BEGIN_PS_NS @@ -86,6 +87,12 @@ void menu_DoPlasma(); void DoEnergyTile(); void InitEnergyTile(); +void setvalidpic(DExhumedActor* actor) +{ + // all we want here is setting it to something that passes renderer validation. This is never used to draw the sprite. + actor->spr.setspritetexture(tileGetTextureID(1)); +} + extern int EndLevel; extern int32_t g_commandSetup; extern int32_t g_noSetup; diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index 6ea9f6193..3ae0bc9b4 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -66,7 +66,7 @@ void BuildFishLimb(DExhumedActor* pActor, int anim) //getSequence(pChunkActor->nSeqFile, pChunkActor->nCount)->getFirstTexID(); - pChunkActor->spr.picnum = anim; + setvalidpic(pChunkActor); pChunkActor->spr.lotag = runlist_HeadRun() + 1; pChunkActor->clipdist = 0; diff --git a/source/games/exhumed/src/grenade.cpp b/source/games/exhumed/src/grenade.cpp index 18d551507..31941bc43 100644 --- a/source/games/exhumed/src/grenade.cpp +++ b/source/games/exhumed/src/grenade.cpp @@ -129,7 +129,7 @@ void BuildGrenade(int nPlayer) pActor->spr.shade = -64; pActor->spr.scale = DVector2(0.3125, 0.3125); pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.pal = 0; pActor->clipdist = 7.5; pActor->spr.xoffset = 0; diff --git a/source/games/exhumed/src/lavadude.cpp b/source/games/exhumed/src/lavadude.cpp index 85e76597e..06156f61d 100644 --- a/source/games/exhumed/src/lavadude.cpp +++ b/source/games/exhumed/src/lavadude.cpp @@ -51,7 +51,7 @@ DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, double height) pLimbActor->spr.xoffset = 0; pLimbActor->spr.yoffset = 0; pLimbActor->spr.scale = DVector2(1.40625, 1.40625); - pLimbActor->spr.picnum = (move & 3) % 3; + pLimbActor->spr.detail = (move & 3) % 3; pLimbActor->spr.hitag = 0; pLimbActor->spr.lotag = runlist_HeadRun() + 1; pLimbActor->clipdist = 0; diff --git a/source/games/exhumed/src/lion.cpp b/source/games/exhumed/src/lion.cpp index 64b79efd8..85a4e73f8 100644 --- a/source/games/exhumed/src/lion.cpp +++ b/source/games/exhumed/src/lion.cpp @@ -59,7 +59,7 @@ void BuildLion(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, pActor->clipdist = 15; pActor->spr.shade = -12; pActor->spr.scale = DVector2(0.625, 0.625); - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.pal = pActor->sector()->ceilingpal; pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; diff --git a/source/games/exhumed/src/mummy.cpp b/source/games/exhumed/src/mummy.cpp index 85c05c0be..1a3f886e5 100644 --- a/source/games/exhumed/src/mummy.cpp +++ b/source/games/exhumed/src/mummy.cpp @@ -67,7 +67,7 @@ void BuildMummy(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; pActor->spr.Angles.Yaw = nAngle; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.hitag = 0; pActor->spr.lotag = runlist_HeadRun() + 1; pActor->spr.extra = -1; diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index cce4fc8af..63192e212 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -430,7 +430,7 @@ void BuildTail() pTailActor->spr.cstat = 0; pTailActor->clipdist = 25; pTailActor->spr.scale = DVector2(1.25, 1.25); - pTailActor->spr.picnum = 1; + setvalidpic(pTailActor); pTailActor->spr.pal = pTailActor->sector()->ceilingpal; pTailActor->spr.xoffset = 0; pTailActor->spr.yoffset = 0; @@ -475,8 +475,8 @@ void BuildQueenEgg(int nQueen, int nVal) pActor2->spr.xoffset = 0; pActor2->spr.yoffset = 0; pActor2->spr.shade = -12; - pActor2->spr.picnum = 1; - pActor2->spr.Angles.Yaw = pActor->spr.Angles.Yaw + RandomAngle9() - DAngle45; + setvalidpic(pActor2); + pActor2->spr.Angles.Yaw = pActor->spr.Angles.Yaw + RandomAngle9() - DAngle45; pActor2->backuppos(); if (!nVal) @@ -757,7 +757,7 @@ void BuildQueenHead(int nQueen) pActor2->clipdist = 17.5; pActor2->spr.scale = DVector2(1.25, 1.25); pActor2->spr.cstat = 0; - pActor2->spr.picnum = 1; + setvalidpic(pActor2); pActor2->spr.shade = -12; pActor2->spr.pal = 0; pActor2->spr.xoffset = 0; @@ -1182,7 +1182,7 @@ void BuildQueen(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, pActor->spr.scale = DVector2(1.25, 1.25); pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.Angles.Yaw = nAngle; pActor->vel.X = 0; pActor->vel.Y = 0; diff --git a/source/games/exhumed/src/rat.cpp b/source/games/exhumed/src/rat.cpp index c54db1548..4e673515d 100644 --- a/source/games/exhumed/src/rat.cpp +++ b/source/games/exhumed/src/rat.cpp @@ -90,7 +90,7 @@ void BuildRat(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D pActor->spr.shade = -12; pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.pal = pActor->sector()->ceilingpal; pActor->clipdist = 7.5; pActor->spr.Angles.Yaw = nAngle; diff --git a/source/games/exhumed/src/rex.cpp b/source/games/exhumed/src/rex.cpp index 1b57c195d..b01bc9168 100644 --- a/source/games/exhumed/src/rex.cpp +++ b/source/games/exhumed/src/rex.cpp @@ -61,7 +61,7 @@ void BuildRex(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D pActor->clipdist = 20; pActor->spr.shade = -12; pActor->spr.scale = DVector2(1, 1); - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.pal = pActor->sector()->ceilingpal; pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; diff --git a/source/games/exhumed/src/roach.cpp b/source/games/exhumed/src/roach.cpp index 6a7b479cf..81aaf3d10 100644 --- a/source/games/exhumed/src/roach.cpp +++ b/source/games/exhumed/src/roach.cpp @@ -58,7 +58,7 @@ void BuildRoach(int nType, DExhumedActor* pActor, const DVector3& pos, sectortyp pActor->spr.shade = -12; pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.pal = pActor->sector()->ceilingpal; pActor->clipdist = 15; pActor->spr.Angles.Yaw = angle; diff --git a/source/games/exhumed/src/scorp.cpp b/source/games/exhumed/src/scorp.cpp index b0a35f1ca..e90c664a0 100644 --- a/source/games/exhumed/src/scorp.cpp +++ b/source/games/exhumed/src/scorp.cpp @@ -62,7 +62,7 @@ void BuildScorp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, pActor->clipdist = 17.5; pActor->spr.shade = -12; pActor->spr.scale = DVector2(1.25, 1.25); - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.pal = pActor->sector()->ceilingpal; pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index baf010ff8..4373f176a 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -70,7 +70,7 @@ void BuildSet(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, D pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; pActor->spr.Angles.Yaw = nAngle; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.hitag = 0; pActor->spr.lotag = runlist_HeadRun() + 1; pActor->spr.extra = -1; diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index ba582c2fc..78e87e0d3 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -68,7 +68,7 @@ DExhumedActor* BuildSpider(DExhumedActor* spp, const DVector3& pos, sectortype* spp->spr.xoffset = 0; spp->spr.yoffset = 0; spp->spr.Angles.Yaw = nAngle; - spp->spr.picnum = 1; + setvalidpic(spp); spp->spr.hitag = 0; spp->spr.lotag = runlist_HeadRun() + 1; spp->spr.extra = -1; diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index 94614d171..1c9f121d7 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -70,7 +70,7 @@ DExhumedActor* BuildWasp(DExhumedActor* pActor, const DVector3& pos, sectortype* pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; - pActor->spr.picnum = 1; + setvalidpic(pActor); pActor->spr.Angles.Yaw = nAngle; pActor->vel.X = 0; pActor->vel.Y = 0;