- some texture name cleanup

This commit is contained in:
Christoph Oelckers 2022-12-13 21:14:38 +01:00
parent cebab8f85d
commit 8208c7fc0b
14 changed files with 43 additions and 55 deletions

View file

@ -706,8 +706,13 @@ DEFINE_ACTION_FUNCTION(_Blood, OriginalLoadScreen)
static int bLoadScreenCrcMatch = -1;
if (bLoadScreenCrcMatch == -1)
{
auto tex = tileGetTexture(kLoadScreen)->GetTexture()->GetImage(); // if this is invalid we have a bigger problem on our hand than the inevitable crash.
bLoadScreenCrcMatch = tileGetCRC32(tex) == kLoadScreenCRC;
auto gtex = TexMan.FindGameTexture("LOADSCREEN", ETextureType::Any);
if (gtex)
{
auto img = gtex->GetTexture()->GetImage();
bLoadScreenCrcMatch = tileGetCRC32(img) == kLoadScreenCRC;
}
else bLoadScreenCrcMatch = true; // if the LOADSCREEN texture is invalid, allow the widescreen fallback.
}
ACTION_RETURN_INT(bLoadScreenCrcMatch);
}

View file

@ -792,7 +792,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
auto actor = gPlayer[i].actor;
auto vect = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
DrawTexture(twod, tileGetTexture(actor->spr.picnum, true), vect.X, vect.Y, DTA_ClipLeft, viewport3d.Left(), DTA_ClipTop, viewport3d.Top(), DTA_ScaleX, czoom * (2. / 3.), DTA_ScaleY, czoom * (2. / 3.), DTA_CenterOffset, true,
DrawTexture(twod, TexMan.GetGameTexture(actor->spr.spritetexture(), true), vect.X, vect.Y, DTA_ClipLeft, viewport3d.Left(), DTA_ClipTop, viewport3d.Top(), DTA_ScaleX, czoom * (2. / 3.), DTA_ScaleY, czoom * (2. / 3.), DTA_CenterOffset, true,
DTA_ClipRight, viewport3d.Right(), DTA_ClipBottom, viewport3d.Bottom(), DTA_Alpha, (actor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT ? 0.5 : 1.), DTA_TranslationIndex, TRANSLATION(Translation_Remap, actor->spr.pal), TAG_DONE);
}
}

View file

@ -162,7 +162,7 @@ void addtorch(sectortype* sect, int shade, int lotag)
void addlightning(sectortype* sect, int shade)
{
if (lightnincnt >= 64)
I_Error("Too many lightnin effects");
I_Error("Too many lightning effects");
lightninsector[lightnincnt] = sect;
lightninsectorshade[lightnincnt] = shade;
@ -479,7 +479,7 @@ void thunder(void)
}
if (!winderflash && isRR())
{
auto tex = tileGetTexture(RTILE_CATACOMB); // this cannot be easily generalized. :(
auto tex = tileGetTexture(RTILE_CURTAINS); // this cannot be easily generalized. :(
if (tex->isSeen(true))
{
if (krand() > 65000)

View file

@ -126,13 +126,17 @@ void GameInterface::DrawPlayerSprite(const DVector2& origin, bool onteam)
{
int mclock = I_GetBuildTime();
int color = TRANSLATION(Translation_Remap, playercolor2lookup(playercolor));
int tile = isRR() ? 3845 + 36 - ((((8 - (mclock >> 4))) & 7) * 5) : 1441 - ((((4 - (mclock >> 4))) & 3) * 5);
auto tex = tileGetTexture(tile);
auto basetex = TexMan.CheckForTexture("PLAYERWALK", ETextureType::Any);
if (!basetex.isValid()) return;
// these are normal in-game animations. Duke has 4 frames, RR has 8, each with 5 rotations that must have consecutive IDs.
int tileofs = isRR() ? 35 - ((((8 - (mclock >> 4))) & 7) * 5) : 15 - ((((4 - (mclock >> 4))) & 3) * 5);
auto tex = TexMan.GetGameTexture(basetex + tileofs);
if (!tex) return;
double x = origin.X + 250, y = origin.Y + tex->GetDisplayHeight() * (isRR()? 0.25 : 0.5);
double scale = isRR() ? 0.375 : 0.75;
double scaley = isRR() ? 0.3 : 0.75;
DrawTexture(twod, tex, x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, color, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
DrawTexture(twod, tex, x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, color, DTA_ScaleX, scale, DTA_ScaleY, scaley, TAG_DONE);
}
END_DUKE_NS

View file

@ -162,13 +162,7 @@ void SetDispatcher()
int TILE_APLAYER;
int TILE_DRONE;
int TILE_SCREENBORDER;
int TILE_VIEWBORDER;
int TILE_APLAYERTOP;
int TILE_CAMCORNER;
int TILE_CAMLIGHT;
int TILE_STATIC;
int TILE_BOTTOMSTATUSBAR;
int TILE_THREEDEE;
int TILE_INGAMEDUKETHREEDEE;
int TILE_FIRE;

View file

@ -280,13 +280,7 @@ void initactorflags_d()
TILE_APLAYER = DTILE_APLAYER;
TILE_DRONE = DTILE_DRONE;
TILE_SCREENBORDER = DTILE_BIGHOLE;
TILE_VIEWBORDER = DTILE_VIEWBORDER;
TILE_APLAYERTOP = DTILE_APLAYERTOP;
TILE_CAMCORNER = DTILE_CAMCORNER;
TILE_CAMLIGHT = DTILE_CAMLIGHT;
TILE_STATIC = DTILE_STATIC;
TILE_BOTTOMSTATUSBAR = isWorldTour()? DTILE_WIDESCREENSTATUSBAR : DTILE_BOTTOMSTATUSBAR;
TILE_FIRE = DTILE_FIRE;
TILE_WATERBUBBLE = DTILE_WATERBUBBLE;
TILE_BLOODPOOL = DTILE_BLOODPOOL;

View file

@ -275,13 +275,7 @@ void initactorflags_r()
TILE_APLAYER = RTILE_APLAYER;
TILE_DRONE = RTILE_DRONE;
TILE_SCREENBORDER = isRRRA()? 7629 : RTILE_BIGHOLE;
TILE_VIEWBORDER = RTILE_VIEWBORDER;
TILE_APLAYERTOP = RTILE_APLAYERTOP;
TILE_CAMCORNER = RTILE_CAMCORNER;
TILE_CAMLIGHT = RTILE_CAMLIGHT;
TILE_STATIC = RTILE_STATIC;
TILE_BOTTOMSTATUSBAR = RTILE_BOTTOMSTATUSBAR;
TILE_FIRE = RTILE_FIRE;
TILE_WATERBUBBLE = RTILE_WATERBUBBLE;
TILE_BLOODPOOL = RTILE_BLOODPOOL;

View file

@ -311,26 +311,34 @@ void drawoverlays(double interpfrac)
void cameratext(DDukeActor *cam)
{
static FTextureID texids[4];
static const char* texs[] = { "CAMCORNER", "CAMCORNER2", "CAMLIGHT", "STATIC" };
if (!texids[0].isValid())
{
for (int i = 0; i < 4; i++) texids[i] = TexMan.CheckForTexture(texs[i], ETextureType::Any);
}
auto drawitem = [=](int tile, double x, double y, bool flipx, bool flipy)
{
DrawTexture(twod, tileGetTexture(tile), x, y, DTA_ViewportX, viewport3d.Left(), DTA_ViewportY, viewport3d.Top(), DTA_ViewportWidth, viewport3d.Width(),
DrawTexture(twod, texids[tile], false, x, y, DTA_ViewportX, viewport3d.Left(), DTA_ViewportY, viewport3d.Top(), DTA_ViewportWidth, viewport3d.Width(),
DTA_ViewportHeight, viewport3d.Height(), DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_CenterOffsetRel, 2, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE);
};
if (!cam->temp_data[0])
{
drawitem(TILE_CAMCORNER, 24, 33, false, false);
drawitem(TILE_CAMCORNER + 1, 320 - 26, 33, false, false);
drawitem(TILE_CAMCORNER + 1, 24, 163, true, true);
drawitem(TILE_CAMCORNER + 1, 320 - 26, 163, false, true);
drawitem(0, 24, 33, false, false);
drawitem(1, 320 - 26, 33, false, false);
drawitem(1, 24, 163, true, true);
drawitem(1, 320 - 26, 163, false, true);
if (PlayClock & 16)
drawitem(TILE_CAMLIGHT, 46, 32, false, false);
drawitem(2, 46, 32, false, false);
}
else
{
for (int x = -64; x < 394; x += 64)
for (int y = 0; y < 200; y += 64)
drawitem(TILE_STATIC, x, y, !!(PlayClock & 8), !!(PlayClock & 16));
drawitem(3, x, y, !!(PlayClock & 8), !!(PlayClock & 16));
}
}

View file

@ -444,6 +444,7 @@ x(FEM7, 1395)
x(APLAYERTOP, 1400)
x(APLAYER, 1405)
x(PLAYERONWATER, 1420)
x(PLAYERWALK, 1426)
x(DUKELYINGDEAD, 1518)
x(DUKETORSO, 1520)
x(DUKEGUN, 1528)
@ -618,6 +619,7 @@ x(ACCESS_ICON, 2471)
x(DIGITALNUM, 2472)
x(DUKECAR, 2491)
x(CAMCORNER, 2482)
x(CAMCORNER2, 2483)
x(CAMLIGHT, 2484)
x(LOGO, 2485)
x(TITLE, 2486)
@ -737,6 +739,7 @@ x(BONUSSCREEN2_O2, 3247)
x(BONUSSCREEN2_O3, 3248)
x(BONUSSCREEN2_O4, 3249)
x(VIEWBORDER, 3250)
x(VIEWEDGE, 3251)
x(VICTORY1, 3260)
x(VICTORY2, 3261)
x(VICTORY3, 3262)

View file

@ -590,6 +590,7 @@ x(HOLODUKE_ICON, 1655)
x(ACCESS_ICON, 1656)
x(DIGITALNUM, 1657)
x(CAMCORNER, 1667)
x(CAMCORNER2, 1668)
x(CAMLIGHT, 1669)
x(LOGO, 1670)
x(TITLE, 1671)
@ -765,12 +766,13 @@ x(CACTUSDEBRIS1, 2460)
x(CACTUSDEBRIS2, 2465)
x(BONUSSCREEN, 2510)
x(VIEWBORDER, 2520)
x(VIEWEDGE, 2521)
x(VICTORY1, 2530)
x(ORDERING, 2531)
x(TEXTSTORY, 2541)
x(LOADSCREEN, 2542)
y(RRTILE2560, 2560)
y(CATACOMB, 2562)
y(CURTAINS, 2562)
y(RRTILE2564, 2564)
y(RRTILE2573, 2573)
y(RRTILE2574, 2574)
@ -1093,6 +1095,7 @@ y(RRTILE3827, 3827)
y(RRTILE3837, 3837)
x(APLAYERTOP, 3840)
x(APLAYER, 3845)
x(PLAYERWALK, 3846)
x(PLAYERONWATER, 3860)
x(DUKELYINGDEAD, 3998)
x(DUKEGUN, 4041)
@ -1541,6 +1544,7 @@ x(RABBIT, 7280)
x(RABBITJIBA, 7387)
x(RABBITJIBB, 7392)
x(RABBITJIBC, 7397)
x(RRRABORDER, 7629)
x(ROCK, 8035)
x(ROCK2, 8036)
x(LEVELMAP01, 8624)

View file

@ -5,13 +5,7 @@ BEGIN_DUKE_NS
// These are all globally accessed tiles.
extern int TILE_APLAYER;
extern int TILE_DRONE;
extern int TILE_SCREENBORDER;
extern int TILE_VIEWBORDER;
extern int TILE_APLAYERTOP;
extern int TILE_CAMCORNER;
extern int TILE_CAMLIGHT;
extern int TILE_STATIC;
extern int TILE_BOTTOMSTATUSBAR;
extern int TILE_FIRE;
extern int TILE_WATERBUBBLE;
extern int TILE_BLOODPOOL;

View file

@ -176,12 +176,6 @@ static void cachegoodsprites(void)
{
int i;
tloadtile(DTILE_BOTTOMSTATUSBAR);
if (ud.multimode > 1)
{
tloadtile(DTILE_FRAGBAR);
}
for(i=DTILE_FOOTPRINTS;i<DTILE_FOOTPRINTS+3;i++)
tloadtile(i);

View file

@ -322,12 +322,6 @@ static void cachegoodsprites(void)
{
int i;
tloadtile(RTILE_BOTTOMSTATUSBAR);
if (ud.multimode > 1)
{
tloadtile(RTILE_FRAGBAR);
}
for (i = RTILE_FOOTPRINTS; i < RTILE_FOOTPRINTS + 3; i++)
tloadtile(i);

View file

@ -50,7 +50,7 @@ BEGIN_DUKE_NS
void UpdateFrame()
{
auto tex = tileGetTexture(TILE_SCREENBORDER);
auto tex = TexMan.FindGameTexture(isRRRA()? "RRRABORDER" : "BIGHOLE", ETextureType::Any);
if (tex != nullptr && tex->isValid())
{
// Backdrop.
@ -74,8 +74,8 @@ void UpdateFrame()
// Border.
if (hud_size < Hud_Stbar)
{
auto vb = tileGetTexture(TILE_VIEWBORDER);
auto ve = tileGetTexture(TILE_VIEWBORDER + 1);
auto vb = TexMan.FindGameTexture("VIEWBORDER", ETextureType::Any);
auto ve = TexMan.FindGameTexture("VIEWEDGE", ETextureType::Any);
int x1 = viewport3d.Left() - 4;
int y1 = viewport3d.Top() - 4;
int x2 = viewport3d.Right() + 4;