From 364c71cba82db68b8f26e3f1b893e81d9f6e4715 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 May 2023 12:23:16 +0200 Subject: [PATCH] - use texture names for the panel overlays. --- source/core/states.h | 1 - source/games/sw/src/conpic.h | 5 +++ source/games/sw/src/panel.cpp | 53 ++++++++++++++++--------------- source/games/sw/src/panel.h | 2 +- source/games/sw/src/spritenames.h | 3 -- 5 files changed, 34 insertions(+), 30 deletions(-) diff --git a/source/core/states.h b/source/core/states.h index 39b23d928..3f1ef3a99 100644 --- a/source/core/states.h +++ b/source/core/states.h @@ -58,7 +58,6 @@ struct FSpriteDef uint8_t numframes; uint16_t spriteframes; - FTextureID GetSpriteFrame(int frame, int rot, DAngle ang, bool* mirror, bool flipagain = false); }; extern TArray SpriteFrames; diff --git a/source/games/sw/src/conpic.h b/source/games/sw/src/conpic.h index b780981a4..76302a449 100644 --- a/source/games/sw/src/conpic.h +++ b/source/games/sw/src/conpic.h @@ -136,6 +136,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define SHOTGUN_RELOAD1 2211 #define SHOTGUN_RELOAD2 2212 +#define SHOTGUN2_REST 2227 +#define SHOTGUN2_RELOAD0 2227 +#define SHOTGUN2_RELOAD1 2226 +#define SHOTGUN2_RELOAD2 2225 + #define SHOTGUN_SHELL0 2180 #define SHOTGUN_SHELL1 2181 #define SHOTGUN_SHELL2 2182 diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 66dd9b850..b788937c4 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -1883,13 +1883,13 @@ void pUziOverlays(DPanelSprite* psp, short mode) switch (mode) { case 0: // At rest - psp->over[0].pic = UZI_COPEN; + psp->over[0].pic = TexMan.CheckForTexture("UZI_COPEN", ETextureType::Any); break; case 1: // Firing - psp->over[0].pic = UZI_CLIT; + psp->over[0].pic = TexMan.CheckForTexture("UZI_CLIT", ETextureType::Any); break; case 2: // Reloading - psp->over[0].pic = UZI_CRELOAD; + psp->over[0].pic = TexMan.CheckForTexture("UZI_CRELOAD", ETextureType::Any); psp->over[0].xoff = UZI_CHAMBERRELOAD_XOFF; psp->over[0].yoff = UZI_CHAMBERRELOAD_YOFF; break; @@ -3146,11 +3146,11 @@ bool pShotgunOverlays(DPanelSprite* psp) switch (psp->PlayerP->WpnShotgunType) { case 0: - psp->over[SHOTGUN_AUTO_NUM].pic = -1; + psp->over[SHOTGUN_AUTO_NUM].pic = FNullTextureID(); psp->over[SHOTGUN_AUTO_NUM].flags |= (psf_ShadeNone); return false; case 1: - psp->over[SHOTGUN_AUTO_NUM].pic = SHOTGUN_AUTO; + psp->over[SHOTGUN_AUTO_NUM].pic = TexMan.CheckForTexture("SHOTGUN_AUTO", ETextureType::Any); psp->over[SHOTGUN_AUTO_NUM].flags |= (psf_ShadeNone); return false; } @@ -3953,13 +3953,13 @@ void pHotHeadOverlays(DPanelSprite* psp, short mode) switch (mode) { case 0: // Great balls o' fire - psp->over[0].pic = HEAD_MODE1; + psp->over[0].pic = TexMan.CheckForTexture("HEAD_MODE1", ETextureType::Any); break; case 1: // Ring of fire - psp->over[0].pic = HEAD_MODE2; + psp->over[0].pic = TexMan.CheckForTexture("HEAD_MODE2", ETextureType::Any); break; case 2: // I love the smell of napalm in the morning - psp->over[0].pic = HEAD_MODE3; + psp->over[0].pic = TexMan.CheckForTexture("HEAD_MODE3", ETextureType::Any); break; } } @@ -4668,36 +4668,38 @@ bool pMicroOverlays(DPanelSprite* psp) switch (psp->PlayerP->WpnRocketType) { case 0: - psp->over[MICRO_SIGHT_NUM].pic = MICRO_SIGHT; - psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_1; + psp->over[MICRO_SIGHT_NUM].pic = TexMan.CheckForTexture("MICRO_SIGHT", ETextureType::Any); + psp->over[MICRO_SHOT_NUM].pic = TexMan.CheckForTexture("MICRO_SHOT_1", ETextureType::Any); psp->over[MICRO_SHOT_NUM].flags |= (psf_ShadeNone); - psp->over[MICRO_HEAT_NUM].pic = -1; + psp->over[MICRO_HEAT_NUM].pic = FNullTextureID(); return false; case 1: if (psp->PlayerP->WpnRocketHeat) { - psp->over[MICRO_SIGHT_NUM].pic = MICRO_SIGHT; - psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_1; + psp->over[MICRO_SIGHT_NUM].pic = TexMan.CheckForTexture("MICRO_SIGHT", ETextureType::Any); + psp->over[MICRO_SHOT_NUM].pic = TexMan.CheckForTexture("MICRO_SHOT_1", ETextureType::Any); psp->over[MICRO_SHOT_NUM].flags |= (psf_ShadeNone); - ASSERT(psp->PlayerP->WpnRocketHeat < 6); - - psp->over[MICRO_HEAT_NUM].pic = MICRO_HEAT + (5 - psp->PlayerP->WpnRocketHeat); + if (psp->PlayerP->WpnRocketHeat < 6) + { + static const char* heats[] = { "MICRO_HEAT0", "MICRO_HEAT1", "MICRO_HEAT2", "MICRO_HEAT3", "MICRO_HEAT4", "MICRO_HEAT5" }; + psp->over[MICRO_HEAT_NUM].pic = TexMan.CheckForTexture(heats[5 - psp->PlayerP->WpnRocketHeat], ETextureType::Any); + } } else { - psp->over[MICRO_SIGHT_NUM].pic = MICRO_SIGHT; - psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_1; + psp->over[MICRO_SIGHT_NUM].pic = TexMan.CheckForTexture("MICRO_SIGHT", ETextureType::Any); + psp->over[MICRO_SHOT_NUM].pic = TexMan.CheckForTexture("MICRO_SHOT_1", ETextureType::Any); psp->over[MICRO_SHOT_NUM].flags |= (psf_ShadeNone); - psp->over[MICRO_HEAT_NUM].pic = -1; + psp->over[MICRO_HEAT_NUM].pic = FNullTextureID(); } return false; case 2: - psp->over[MICRO_SIGHT_NUM].pic = -1; - psp->over[MICRO_HEAT_NUM].pic = -1; + psp->over[MICRO_SIGHT_NUM].pic = FNullTextureID(); + psp->over[MICRO_HEAT_NUM].pic = FNullTextureID(); - psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_20; + psp->over[MICRO_SHOT_NUM].pic = TexMan.CheckForTexture("MICRO_SHOT_20", ETextureType::Any); psp->over[MICRO_SHOT_NUM].flags |= (psf_ShadeNone); psp->over[MICRO_HEAT_NUM].flags |= (psf_ShadeNone); return true; @@ -7254,7 +7256,7 @@ DPanelSprite* pSpawnSprite(DSWPlayer* pp, PANEL_STATE* state, uint8_t priority, for (i = 0; i < SIZ(psp->over); i++) { psp->over[i].State = nullptr; - psp->over[i].pic = -1; + psp->over[i].pic = FNullTextureID(); psp->over[i].xoff = -1; psp->over[i].yoff = -1; } @@ -7532,13 +7534,14 @@ void pDisplaySprites(DSWPlayer* pp, double interpfrac) // do overlays (if any) for (i = 0; i < SIZ(psp->over); i++) { + FTextureID tex; // get pic from state if (psp->over[i].State) texnum = GetTextureFromSprite(psp->over[i].State->Sprite, 0); else // get pic from over variable - if (psp->over[i].pic >= 0) - texnum = tileGetTextureID(psp->over[i].pic); + if (psp->over[i].pic.Exists()) + texnum = psp->over[i].pic; else continue; diff --git a/source/games/sw/src/panel.h b/source/games/sw/src/panel.h index 8d97e3259..fe899ae36 100644 --- a/source/games/sw/src/panel.h +++ b/source/games/sw/src/panel.h @@ -99,8 +99,8 @@ struct PANEL_SPRITE_OVERLAY { PANEL_STATE* State; int flags; + FTextureID pic; short tics; - short pic; short xoff; // from panel sprite center x short yoff; // from panel sprite center y }; diff --git a/source/games/sw/src/spritenames.h b/source/games/sw/src/spritenames.h index 1f7aae998..6a58924da 100644 --- a/source/games/sw/src/spritenames.h +++ b/source/games/sw/src/spritenames.h @@ -436,9 +436,6 @@ x(BLOODYFIST_SWING0) x(BLOODYFIST_SWING1) x(BLOODYFIST_SWING2) x(FIST2_REST) -x(FIST2_SWING0) -x(FIST2_SWING1) -x(FIST2_SWING2) x(FIST2_SWING_ALT) x(FIST3_REST) x(FIST3_SWING0)