From a662a3bd12801c863c665b206338203d9d85a0a1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 2 Jan 2023 22:20:03 +0100 Subject: [PATCH] - another bunch of picnums in Blood removed. 4 remaining after this. --- source/games/blood/src/aiunicult.cpp | 2 +- source/games/blood/src/animatesprite.cpp | 2 +- source/games/blood/src/blood.cpp | 6 +++--- source/games/blood/src/fx.cpp | 7 ++++--- source/games/blood/src/gib.cpp | 11 ++++++----- source/games/blood/src/misc.h | 1 - source/games/blood/src/namelist.h | 2 ++ source/games/blood/src/nnexts.cpp | 4 ++-- source/games/blood/src/player.h | 3 ++- source/games/blood/src/preload.cpp | 12 ++++++------ source/games/blood/src/qav.cpp | 2 +- source/games/blood/src/seq.cpp | 4 ++-- source/games/blood/src/texidsdef.h | 4 +++- 13 files changed, 33 insertions(+), 27 deletions(-) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 809af3843..ac73d8dfa 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -331,7 +331,7 @@ static void ThrowThing(DBloodActor* actor, bool impact) DBloodActor* spawned = nullptr; if ((spawned = actFireThing(actor, 0., 0., (dv.Z / 32768.) - zThrow, curWeapon, dist * (2048. / 64800))) == nullptr) return; - if (pThinkInfo->picno < 0 && spawned->spr.type != kModernThingThrowableRock) spawned->spr.picnum = 0; + if (pThinkInfo->picno < 0 && spawned->spr.type != kModernThingThrowableRock) spawned->spr.setspritetexture(FNullTextureID()); spawned->SetOwner(actor); diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index 50a4ab04e..600a7f00d 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -720,7 +720,7 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA, break; case kDecorationTorch: if (!owneractor->hasX() || owneractor->xspr.state == 1) { - pTSprite->picnum++; + pTSprite->setspritetexture(pTSprite->spritetexture() + 1); viewAddEffect(tsprites, nTSprite, kViewEffectTorchHigh); } else { diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 39120b6e2..56d864f3a 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -750,12 +750,12 @@ DEFINE_ACTION_FUNCTION(_Blood, PowerupIcon) { PARAM_PROLOGUE; PARAM_INT(pwup); - int tile = -1; + FTextureID tile = FNullTextureID(); if (pwup >= 0 && pwup < (int)countof(gPowerUpInfo)) { - tile = gPowerUpInfo[pwup].picnum; + tile = gPowerUpInfo[pwup].textureID(); } - FGameTexture* tex = tileGetTexture(tile); + FGameTexture* tex = TexMan.GetGameTexture(tile); ACTION_RETURN_INT(tex ? tex->GetID().GetIndex() : -1); } diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index 7fa226f23..288ec4f81 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -39,12 +39,13 @@ struct FXDATA { int32_t gravity; int32_t drag; // air drag int32_t defangle; - int16_t picnum; + int16_t picno; uint8_t xrepeat; uint8_t yrepeat; ESpriteFlags cstat; int8_t shade; uint8_t pal; + FTextureID textureID() const { return tileGetTextureID(picno); } }; FXDATA gFXData[] = { @@ -166,7 +167,7 @@ DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, const DVector3& p auto actor = actSpawnSprite(pSector, pos, 1, 0); actor->spr.type = nFx; - actor->spr.picnum = pFX->picnum; + actor->spr.setspritetexture(pFX->textureID()); actor->spr.cstat |= pFX->cstat; actor->spr.shade = pFX->shade; actor->spr.pal = pFX->pal; @@ -370,7 +371,7 @@ void fxPrecache() { for (int i = 0; i < kFXMax; i++) { - tilePrecacheTile(gFXData[i].picnum, 0, 0); + tilePrecacheTile(gFXData[i].textureID(), 0, 0); if (gFXData[i].seq) seqPrecacheId(gFXData[i].seq, 0); } diff --git a/source/games/blood/src/gib.cpp b/source/games/blood/src/gib.cpp index 2f8e64ba3..ccf7d01a6 100644 --- a/source/games/blood/src/gib.cpp +++ b/source/games/blood/src/gib.cpp @@ -44,10 +44,11 @@ struct GIBFX struct GIBTHING { int type; - int Kills; + int picno; int chance; int atc; int at10; + FTextureID textureID() const { return tileGetTextureID(picno); } }; struct GIBLIST @@ -369,8 +370,8 @@ void GibThing(DBloodActor* actor, GIBTHING* pGThing, DVector3* pPos, DVector3* p auto gibactor = actSpawnThing(pSector, gPos, pGThing->type); if (!gibactor) return; - if (pGThing->Kills > -1) - gibactor->spr.picnum = pGThing->Kills; + if (pGThing->textureID().isValid()) + gibactor->spr.setspritetexture(pGThing->textureID()); if (pVel) { gibactor->vel = *pVel + DVector3(Random2F(pGThing->atc, 4), Random2F(pGThing->atc, 4), -RandomF(pGThing->at10, 8)); @@ -521,8 +522,8 @@ void gibPrecache() { for (int j = 0; j < gibList[i].atc; j++) { - if (pThing[j].Kills >= 0) - tilePrecacheTile(pThing[j].Kills, -1, 0); + if (pThing[j].textureID().isValid()) + tilePrecacheTile(pThing[j].textureID(), -1, 0); } } } diff --git a/source/games/blood/src/misc.h b/source/games/blood/src/misc.h index 0d23f7196..86e194af4 100644 --- a/source/games/blood/src/misc.h +++ b/source/games/blood/src/misc.h @@ -96,7 +96,6 @@ enum SurfaceType { extern int nPrecacheCount; inline FTextureID mirrortile; -void tilePrecacheTile(int nTile, int nType, int palette); void tilePrecacheTile(FTextureID nTile, int nType, int palette); int tileGetSurfType(CollisionBase& hit); diff --git a/source/games/blood/src/namelist.h b/source/games/blood/src/namelist.h index 5d85ef30d..b2da96044 100644 --- a/source/games/blood/src/namelist.h +++ b/source/games/blood/src/namelist.h @@ -216,3 +216,5 @@ x(CIRCLESAWOFF, 656) x(FLAREBURST, 2424) x(BULLETCASE, 2465) x(SHELLCASE, 2464) +x(WATERDRIP, 1147) +x(BLOODDRIP, 1160) diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 3bc33fc15..a85141f3e 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -3974,7 +3974,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH switch (cond) { case 24: return condCmp(GetExtInfo(actor->spr.spritetexture()).surftype, arg1, arg2, cmpOp); - case 25: return condCmp(actor->spr.picnum, arg1, arg2, cmpOp); + case 25: return condCmp(legacyTileNum(actor->spr.spritetexture()), arg1, arg2, cmpOp); case 26: return condCmp(actor->spr.pal, arg1, arg2, cmpOp); case 27: return condCmp(actor->spr.shade, arg1, arg2, cmpOp); case 28: return (arg3) ? condCmp((actor->spr.cstat & ESpriteFlags::FromInt(arg3)), arg1, arg2, cmpOp) : (actor->spr.cstat & ESpriteFlags::FromInt(arg1)); @@ -7212,7 +7212,7 @@ void usePictureChanger(DBloodActor* sourceactor, int objType, sectortype* targSe break; case OBJ_SPRITE: if (valueIsBetween(sourceactor->xspr.data1, -1, 32767)) - objActor->spr.picnum = sourceactor->xspr.data1; + objActor->spr.setspritetexture(tileGetTextureID(sourceactor->xspr.data1)); if (sourceactor->xspr.data2 >= 0) objActor->spr.shade = (sourceactor->xspr.data2 > 127) ? 127 : sourceactor->xspr.data2; else if (sourceactor->xspr.data2 < -1) objActor->spr.shade = (sourceactor->xspr.data2 < -127) ? -127 : sourceactor->xspr.data2; diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index 6a5205b5a..c396d18d6 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -190,10 +190,11 @@ struct AMMOINFO struct POWERUPINFO { - int16_t picnum; + int16_t picno; bool pickupOnce; int bonusTime; int maxTime; + FTextureID textureID() const { return tileGetTextureID(picno); } }; void playerResetPosture(PLAYER* pPlayer); diff --git a/source/games/blood/src/preload.cpp b/source/games/blood/src/preload.cpp index 3d7163065..1b32df7c9 100644 --- a/source/games/blood/src/preload.cpp +++ b/source/games/blood/src/preload.cpp @@ -42,10 +42,10 @@ void gibPrecache(); // //--------------------------------------------------------------------------- -void tilePrecacheTile(int nTile, int nType, int palette) +void tilePrecacheTile(FTextureID nTex, int nType, int palette) { - auto nTex = tileGetTextureID(nTile); int n = 1; + if (!nTex.isValid()) return; switch (GetExtInfo(nTex).picanm.extra & 7) { case 0: @@ -194,7 +194,7 @@ void PrecacheThing(DBloodActor* actor) //case kThingObjectExplode: weird that only gib object is precached and this one is not break; } - tilePrecacheTile(actor->spr.picnum, -1, palette); + tilePrecacheTile(actor->spr.spritetexture(), -1, palette); } //--------------------------------------------------------------------------- @@ -222,7 +222,7 @@ void PreloadCache() PrecacheThing(actor); break; default: - tilePrecacheTile(actor->spr.picnum, -1, actor->spr.pal); + tilePrecacheTile(actor->spr.spritetexture(), -1, actor->spr.pal); break; } } @@ -233,8 +233,8 @@ void PreloadCache() seqPrecacheId(i, 0); } - tilePrecacheTile(1147, -1, 0); // water drip - tilePrecacheTile(1160, -1, 0); // blood drip + tilePrecacheTile(aTexIds[kTexWATERDRIP], -1, 0); // water drip + tilePrecacheTile(aTexIds[kTexBLOODDRIP], -1, 0); // blood drip // Player SEQs seqPrecacheId(dudeInfo[31].seqStartID + 6, 0); diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 760fa6b5f..9db8b230c 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -65,7 +65,7 @@ static void qavInitTileFinderMap() return prevFrame->tiles[i].texid == thisFrame->tiles[i].texid ? &prevFrame->tiles[i] : nullptr; }); - // Interpolate between frames if the picnum is valid. This can be problematic if tile indices change between frames. + // Interpolate between frames if the tilenum is valid. This can be problematic if tile indices change between frames. qavPrevTileFinders.Insert("index", [](FRAMEINFO* const thisFrame, FRAMEINFO* const prevFrame, const int i) -> TILE_FRAME* { return prevFrame->tiles[i].texid.isValid() ? &prevFrame->tiles[i] : nullptr; }); diff --git a/source/games/blood/src/seq.cpp b/source/games/blood/src/seq.cpp index 490dfcd62..8f37b135a 100644 --- a/source/games/blood/src/seq.cpp +++ b/source/games/blood/src/seq.cpp @@ -111,7 +111,7 @@ void Seq::Precache(int palette) if ((version & 0xff00) != 0x300) I_Error("Obsolete sequence version"); for (int i = 0; i < nFrames; i++) - tilePrecacheTile(seqGetTile(&frames[i]), -1, palette); + tilePrecacheTile(seqGetTexture(&frames[i]), -1, palette); } void seqPrecacheId(int id, int palette) @@ -252,7 +252,7 @@ void UpdateSprite(DBloodActor* actor, SEQFRAME* pFrame) || (pFrame->scaley && pFrame->scaley != int(actor->spr.scale.Y * INV_REPEAT_SCALE))) actor->spr.flags |= 4; } - actor->spr.picnum = seqGetTile(pFrame); + actor->spr.setspritetexture(seqGetTexture(pFrame)); if (pFrame->palette) actor->spr.pal = pFrame->palette; actor->spr.shade = pFrame->shade; diff --git a/source/games/blood/src/texidsdef.h b/source/games/blood/src/texidsdef.h index ed9690d73..551aa110b 100644 --- a/source/games/blood/src/texidsdef.h +++ b/source/games/blood/src/texidsdef.h @@ -19,4 +19,6 @@ x(FLAREBURST) x(BULLETCASE) x(SHELLCASE) x(FLAGHAVE) -x(ICONLEECH) \ No newline at end of file +x(ICONLEECH) +x(WATERDRIP) +x(BLOODDRIP)