- ported the scuba mask drawers to texture IDs.

These were also the last places in Duke using tileWidth and tileHeight.
This commit is contained in:
Christoph Oelckers 2022-12-31 19:34:46 +01:00
parent ef81e713e2
commit 34160a4354
6 changed files with 29 additions and 20 deletions

View file

@ -54,13 +54,12 @@
F2DDrawer twodpsp;
void hud_drawsprite(double sx, double sy, double sz, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha)
void hud_drawsprite(double sx, double sy, double sz, double a, FTextureID texid, int dashade, int dapalnum, int dastat, double alpha)
{
sz *= 1. / 65536.;
alpha *= (dastat & RS_TRANS1)? glblend[0].def[!!(dastat & RS_TRANS2)].alpha : 1.;
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
auto tex = tileGetTexture(picnum, true);
auto tex = TexMan.GetGameTexture(texid, true);
DrawTexture(&twodpsp, tex, sx, sy,
DTA_ScaleX, sz, DTA_ScaleY, sz,
@ -81,6 +80,11 @@ void hud_drawsprite(double sx, double sy, double sz, double a, int picnum, int d
TAG_DONE);
}
void hud_drawsprite(double sx, double sy, double sz, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha)
{
hud_drawsprite(sx, sy, sz / 65536., a, tileGetTextureID(picnum), dashade, dapalnum, dastat, alpha);
}
//==========================================================================
//

View file

@ -6,6 +6,7 @@ extern F2DDrawer twodpsp;
void DrawRateStuff();
void hud_drawsprite(double sx, double sy, double sz, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha = 1);
void hud_drawsprite(double sx, double sy, double sz, double a, FTextureID texid, int dashade, int dapalnum, int dastat, double alpha = 1);
// orientation bits for hud_drawsprite.
enum {

View file

@ -24,14 +24,6 @@ inline void spritetypebase::setspritetexture(FTextureID tex)
picnum = legacyTileNum(tex);
}
//[[deprecated]]
inline int tileForName(const char* name)
{
auto texid = TexMan.CheckForTexture(name, ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnAll);
if (!texid.isValid()) return -1;
return legacyTileNum(texid);
}
//[[deprecated]]
inline int tileWidth(int num)
{

View file

@ -144,9 +144,12 @@ void displaymasks_d(int snum, int p, double interpfrac)
{
if (ps[snum].scuba_on)
{
int y = 200 - tileHeight(DTILE_SCUBAMASK);
hud_drawsprite(44, y, 65536, 0, DTILE_SCUBAMASK, 0, p, 2 + 16);
hud_drawsprite((320 - 43), y, 65536, 0, DTILE_SCUBAMASK, 0, p, 2 + 4 + 16);
auto scuba0 = TexMan.CheckForTexture("SCUBAMASK", ETextureType::Any);
auto tex0 = TexMan.GetGameTexture(scuba0);
double y = 200 - tex0->GetDisplayHeight();
hud_drawsprite(44, y, 1., 0, scuba0, 0, p, 2 + 16);
hud_drawsprite((320 - 43), y, 1, 0, scuba0, 0, p, 2 + 4 + 16);
}
}

View file

@ -69,15 +69,20 @@ void displaymasks_r(int snum, int p, double interpfrac)
{
if (ps[snum].scuba_on)
{
auto scuba0 = TexMan.CheckForTexture("SCUBAMASK0", ETextureType::Any);
auto scuba3 = TexMan.CheckForTexture("SCUBAMASK3", ETextureType::Any);
auto scuba4 = TexMan.CheckForTexture("SCUBAMASK4", ETextureType::Any);
auto tex0 = TexMan.GetGameTexture(scuba0);
auto tex4 = TexMan.GetGameTexture(scuba4);
//int pin = 0;
// to get the proper clock value with regards to interpolation we have add a interpfrac based offset to the value.
double interpclock = PlayClock + TICSPERFRAME * interpfrac;
int pin = RS_STRETCH;
hud_drawsprite((320 - (tileWidth(RTILE_SCUBAMASK) >> 1) - 15), (200 - (tileHeight(RTILE_SCUBAMASK) >> 1) + BobVal(interpclock) * 16), 49152, 0, RTILE_SCUBAMASK, 0, p, 2 + 16 + pin);
hud_drawsprite((320 - tileWidth(RTILE_SCUBAMASK + 4)), (200 - tileHeight(RTILE_SCUBAMASK + 4)), 65536, 0, RTILE_SCUBAMASK + 4, 0, p, 2 + 16 + pin);
hud_drawsprite(tileWidth(RTILE_SCUBAMASK + 4), (200 - tileHeight(RTILE_SCUBAMASK + 4)), 65536, 0, RTILE_SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin);
hud_drawsprite(35, (-1), 65536, 0, RTILE_SCUBAMASK + 3, 0, p, 2 + 16 + pin);
hud_drawsprite(285, 200, 65536, -180, RTILE_SCUBAMASK + 3, 0, p, 2 + 16 + pin);
hud_drawsprite((320 - (tex0->GetDisplayWidth() * 0.5) - 15), (200 - (tex0->GetDisplayHeight() * 0.5) + BobVal(interpclock) * 16), 0.75, 0, scuba0, 0, p, 2 + 16 + pin);
hud_drawsprite((320 - tex4->GetDisplayWidth()), (200 - tex4->GetDisplayHeight()), 1., 0, scuba4, 0, p, 2 + 16 + pin);
hud_drawsprite(tex4->GetDisplayWidth(), (200 - tex4->GetDisplayHeight()), 1., 0, scuba4, 0, p, 2 + 4 + 16 + pin);
hud_drawsprite(35, (-1), 1., 0, scuba3, 0, p, 2 + 16 + pin);
hud_drawsprite(285, 200, 1., -180, scuba3, 0, p, 2 + 16 + pin);
}
}

View file

@ -1000,7 +1000,11 @@ x(KNEE, 3340)
x(SHOTGUN, 3350)
x(HANDTHROW, 3360)
x(SHOTGUNSHELLS, 3372)
x(SCUBAMASK, 3374)
x(SCUBAMASK0, 3374)
x(SCUBAMASK1, 3375)
x(SCUBAMASK2, 3376)
x(SCUBAMASK3, 3377)
x(SCUBAMASK4, 3378)
x(CHAINGUN, 3380)
x(SHRINKER, 3384)
x(CIRCLESTUCK, 3388)