diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index ae24da31c..786e12f65 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegamehelp.h" #include "blood.h" +#include "texids.h" BEGIN_BLD_NS @@ -3944,7 +3945,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) if (GetExtInfo(actorHit->spr.spritetexture()).surftype == kSurfFlesh) { - missileActor->spr.picnum = 2123; + missileActor->spr.setspritetexture(aTexIds[kTexFLESHHIT]); missileActor->SetTarget(actorHit); missileActor->xspr.TargetPos.Z = (missileActor->spr.pos.Z - actorHit->spr.pos.Z); missileActor->xspr.goalAng = (missileActor->spr.pos.XY() - actorHit->spr.pos.XY()).Angle() - actorHit->spr.Angles.Yaw; diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index 1fb67edcf..fc0fd2246 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -166,7 +166,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF vect.Z = pt.Y; pNSprite->pos = pTSprite->pos + vect; - pNSprite->picnum = 1720; + pNSprite->setspritetexture(aTexIds[kTexATOMEFFECT]); pNSprite->shade = -128; } break; @@ -186,7 +186,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->scale = DVector2(0.375, 0.375); else pNSprite->scale = DVector2(1, 1); - pNSprite->picnum = 3558; + pNSprite->setspritetexture(aTexIds[kTexFLAGHAVE]); return pNSprite; } case kViewEffectTesla: @@ -199,7 +199,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->shade = -128; pNSprite->scale = pTSprite->scale; - pNSprite->picnum = 2135; + pNSprite->setspritetexture(aTexIds[kTexTESLAEFFECT]); break; } case kViewEffectShoot: @@ -211,7 +211,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->shade = -128; pNSprite->pal = 0; pNSprite->scale = DVector2(1, 1); - pNSprite->picnum = 2605; + pNSprite->setspritetexture(aTexIds[kTexSHOOTEFFECT]); return pNSprite; } case kViewEffectReflectiveBall: @@ -224,7 +224,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->pal = 0; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->scale = DVector2(1, 1); - pNSprite->picnum = 2089; + pNSprite->setspritetexture(aTexIds[kTexBALLEFFECT]); break; } case kViewEffectPhase: @@ -240,7 +240,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->pal = 0; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->scale = DVector2(0.375, 0.375); - pNSprite->picnum = 626; + pNSprite->setspritetexture(aTexIds[kTexPHASEEFFECT]); break; } case kViewEffectTrail: @@ -287,7 +287,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->shade = -128; pNSprite->pos.Z = pTSprite->pos.Z; - pNSprite->picnum = 908; + pNSprite->setspritetexture(aTexIds[kTexFLAMEEFFECT]); pNSprite->statnum = kStatDecoration; s = (pTTex->GetDisplayWidth() * pTSprite->scale.X) / 64.; pNSprite->scale = DVector2(s, s); @@ -303,9 +303,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF GetSpriteExtents(pTSprite, &top, &bottom); pNSprite->pos.Z = top; if (IsDudeSprite(pTSprite)) - pNSprite->picnum = 672; + pNSprite->setspritetexture(aTexIds[kTexBIGSMOKEEFFECT]); else - pNSprite->picnum = 754; + pNSprite->setspritetexture(aTexIds[kTexSMALLSMOKEEFFECT]); pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->shade = 8; pNSprite->scale = pTSprite->scale; @@ -321,9 +321,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF GetSpriteExtents(pTSprite, &top, &bottom); pNSprite->pos.Z = bottom; if (pTSprite->type >= kDudeBase && pTSprite->type < kDudeMax) - pNSprite->picnum = 672; + pNSprite->setspritetexture(aTexIds[kTexBIGSMOKEEFFECT]); else - pNSprite->picnum = 754; + pNSprite->setspritetexture(aTexIds[kTexSMALLSMOKEEFFECT]); pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->shade = 8; pNSprite->scale = pTSprite->scale; @@ -338,7 +338,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF double top, bottom; GetSpriteExtents(pTSprite, &top, &bottom); pNSprite->pos.Z = top; - pNSprite->picnum = 2101; + pNSprite->setspritetexture(aTexIds[kTexTORCHEFFECT]); pNSprite->shade = -128; s = (pTTex->GetDisplayWidth() * pTSprite->scale.X) / 32.; pNSprite->scale = DVector2(s, s); @@ -353,7 +353,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF double top, bottom; GetSpriteExtents(pTSprite, &top, &bottom); pNSprite->pos.Z = bottom; - pNSprite->picnum = 2101; + pNSprite->setspritetexture(aTexIds[kTexTORCHEFFECT]); pNSprite->shade = -128; s = (pTTex->GetDisplayWidth() * pTSprite->scale.X) / 32.; pNSprite->scale = DVector2(s, s); @@ -389,7 +389,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->scale.Y = pTSprite->scale.Y * 0.25; pNSprite->setspritetexture(pTSprite->spritetexture()); if (!VanillaMode() && (pTSprite->type == kThingDroppedLifeLeech)) // fix shadow for thrown lifeleech - pNSprite->picnum = 800; + pNSprite->setspritetexture(aTexIds[kTexICONLEECH]); pNSprite->pal = 5; auto tex = TexMan.GetGameTexture(pNSprite->spritetexture()); double height = tex->GetDisplayHeight(); @@ -408,7 +408,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->pos.Z = pTSprite->pos.Z; pNSprite->scale = pTSprite->scale; - pNSprite->picnum = 2427; + pNSprite->setspritetexture(aTexIds[kTexHALOEFFECT]); break; } case kViewEffectCeilGlow: @@ -420,7 +420,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF sectortype* pSector = pTSprite->sectp; pNSprite->pos = { pTSprite->pos.X, pTSprite->pos.Y, pSector->ceilingz }; - pNSprite->picnum = 624; + pNSprite->setspritetexture(aTexIds[kTexGLOWEFFECT]); pNSprite->shade = int(pTSprite->pos.Z - pSector->ceilingz) - 64; pNSprite->pal = 2; pNSprite->scale = DVector2(1, 1); @@ -437,7 +437,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF sectortype* pSector = pTSprite->sectp; pNSprite->pos = { pTSprite->pos.X, pTSprite->pos.Y, pSector->floorz }; - pNSprite->picnum = 624; + pNSprite->setspritetexture(aTexIds[kTexGLOWEFFECT]); uint8_t nShade = (uint8_t)clamp(pSector->floorz - pTSprite->pos.Z, 0., 255.); pNSprite->shade = nShade - 32; pNSprite->pal = 2; @@ -458,7 +458,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP; pNSprite->shade = ClipLow(pTSprite->shade - 32, -128); pNSprite->scale = DVector2(pTSprite->scale.X, 1); - pNSprite->picnum = 775; + pNSprite->setspritetexture(aTexIds[kTexSAWBLOOD]); break; } case kViewEffectShowWeapon: @@ -888,13 +888,13 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA, if (pTSprite->type == kTrapSawCircular) { if (owneractor->xspr.state) { if (owneractor->xspr.data1) { - pTSprite->picnum = 772; + pTSprite->setspritetexture(aTexIds[kTexCIRCLESAW1]); if (owneractor->xspr.data2) viewAddEffect(tsprites, nTSprite, kViewEffectSpear); } } - else if (owneractor->xspr.data1) pTSprite->picnum = 773; - else pTSprite->picnum = 656; + else if (owneractor->xspr.data1) pTSprite->setspritetexture(aTexIds[kTexCIRCLESAW2]); + else pTSprite->setspritetexture(aTexIds[kTexCIRCLESAWOFF]); } break; diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 91da4863d..39120b6e2 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -586,6 +586,7 @@ void GameInterface::loadPalette(void) void GameInterface::app_init() { mirrortile = tileGetTextureID(504); + InitTextureIDs(); GC::AddMarkerFunc(markgcroots); diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index ad0cc9047..4b56ed048 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -92,7 +92,7 @@ void FlareBurst(DBloodActor* actor, sectortype*) // 2 for (int i = 0; i < 8; i++) { auto spawnedactor = actSpawnSprite(actor, 5); - spawnedactor->spr.picnum = 2424; + spawnedactor->spr.setspritetexture(aTexIds[kTexFLAREBURST]); spawnedactor->spr.shade = -128; spawnedactor->spr.scale = DVector2(0.5, 0.5); spawnedactor->spr.type = kMissileFlareAlt; @@ -556,12 +556,12 @@ void sleeveStopBouncing(DBloodActor* actor) case FX_37: case FX_38: case FX_39: - actor->spr.picnum = 2465; + actor->spr.setspritetexture(aTexIds[kTexBULLETCASE]); break; case FX_40: case FX_41: case FX_42: - actor->spr.picnum = 2464; + actor->spr.setspritetexture(aTexIds[kTexSHELLCASE]); break; } diff --git a/source/games/blood/src/namelist.h b/source/games/blood/src/namelist.h index a96f6408f..5d85ef30d 100644 --- a/source/games/blood/src/namelist.h +++ b/source/games/blood/src/namelist.h @@ -196,3 +196,23 @@ x(ICONSHOTGUN, 559) x(ICONTOMMY, 558) x(ICONTESLA, 539) x(ICONLEECH, 800) + +x(FLESHHIT, 2123) +x(ATOMEFFECT, 1720) +x(TESLAEFFECT, 2135) +x(SHOOTEFFECT, 2605) +x(BALLEFFECT, 2089) +x(PHASEEFFECT, 626) +x(FLAMEEFFECT, 908) +x(BIGSMOKEEFFECT, 672) +x(SMALLSMOKEEFFECT, 754) +x(TORCHEFFECT, 2101) +x(HALOEFFECT, 2427) +x(GLOWEFFECT, 624) +x(SAWBLOOD, 775) +x(CIRCLESAW1, 772) +x(CIRCLESAW2, 773) +x(CIRCLESAWOFF, 656) +x(FLAREBURST, 2424) +x(BULLETCASE, 2465) +x(SHELLCASE, 2464) diff --git a/source/games/blood/src/texids.cpp b/source/games/blood/src/texids.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/source/games/blood/src/texids.h b/source/games/blood/src/texids.h new file mode 100644 index 000000000..ba1ff71ca --- /dev/null +++ b/source/games/blood/src/texids.h @@ -0,0 +1,30 @@ +#pragma once +#include "textureid.h" + +#define x(a) kTex##a, + +enum ETextureIDs +{ + #include "texidsdef.h" + TEXID_COUNT +}; +#undef x + +inline FTextureID aTexIds[TEXID_COUNT]; + +#define x(a) #a, + +inline const char* const texlistnames[] = +{ + #include "texidsdef.h" +}; +#undef x + + +inline void InitTextureIDs() +{ + for(int i = 0; i < TEXID_COUNT; i++) + { + aTexIds[i] = TexMan.CheckForTexture(texlistnames[i], ETextureType::Any); + } +} \ No newline at end of file diff --git a/source/games/blood/src/texidsdef.h b/source/games/blood/src/texidsdef.h new file mode 100644 index 000000000..ed9690d73 --- /dev/null +++ b/source/games/blood/src/texidsdef.h @@ -0,0 +1,22 @@ +// list of textures that get referenced directly in game code. +x(FLESHHIT) +x(ATOMEFFECT) +x(TESLAEFFECT) +x(SHOOTEFFECT) +x(BALLEFFECT) +x(PHASEEFFECT) +x(FLAMEEFFECT) +x(BIGSMOKEEFFECT) +x(SMALLSMOKEEFFECT) +x(TORCHEFFECT) +x(HALOEFFECT) +x(GLOWEFFECT) +x(SAWBLOOD) +x(CIRCLESAW1) +x(CIRCLESAW2) +x(CIRCLESAWOFF) +x(FLAREBURST) +x(BULLETCASE) +x(SHELLCASE) +x(FLAGHAVE) +x(ICONLEECH) \ No newline at end of file