cache SRB2BACK patch on startup

this is used in a bunch of places while being pretty small, so just cache it on start
This commit is contained in:
Alug committed 2025-11-24 21:26:07 +01:00
1 parent 677b34c174
commit 30acdca9d3
6 files changed
+24 -22

No files matched your search

+3 -3
View File
@@ -46,6 +46,7 @@
#include "i_time.h"
#include "i_threads.h"
#include "i_video.h"
#include "hu_stuff.h"
#include "m_argv.h"
#include "m_menu.h"
#include "m_misc.h"
@@ -327,13 +328,12 @@ static void D_Renderview(void)
if (splitscreen == 2)
{
// V_DrawPatchFill, but for the fourth screen only
patch_t *pat = W_CachePatchName("SRB2BACK", PU_PATCH);
INT32 x, y, pw = SHORT(pat->width) * vid.dup, ph = SHORT(pat->height) * vid.dup;
INT32 x, y, pw = SHORT(srb2back->width) * vid.dup, ph = SHORT(srb2back->height) * vid.dup;
for (x = vid.width>>1; x < vid.width; x += pw)
{
for (y = vid.height>>1; y < vid.height; y += ph)
V_DrawScaledPatch(x, y, V_NOSCALESTART, pat);
V_DrawScaledPatch(x, y, V_NOSCALESTART, srb2back);
}
}
+1 -1
View File
@@ -538,7 +538,7 @@ static void loading_status(void)
x = BASEVIDWIDTH/2;
y = BASEVIDHEIGHT/2;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Black background to match fade in effect
//V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH)); // SRB2 background, ehhh too bright.
//V_DrawPatchFill(srb2back); // SRB2 background, ehhh too bright.
M_DrawTextBox(x-58, y-8, 13, 1);
V_DrawString(x-50, y, V_YELLOWMAP, "Loading...");
V_DrawRightAlignedString(x+50, y, V_YELLOWMAP, s);
+14 -8
View File
@@ -88,6 +88,8 @@ patch_t *ranknum[10] = {}; // rank numbers
patch_t *framecounter = NULL;
patch_t *frameslash = NULL; // framerate stuff. Used in screen.c
patch_t *srb2back = NULL;
static player_t *plr = NULL;
boolean chat_on = false; // entering a chat message?
static char w_chat_buf[HU_MAXMSGLEN + 1];
@@ -290,6 +292,7 @@ void HU_LoadGraphics(void)
return;
j = HU_FONTSTART;
for (i = 0; i < HU_FONTSIZE; i++, j++)
{
// cache the heads-up font for entire game execution
@@ -360,21 +363,21 @@ void HU_LoadGraphics(void)
cred_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
//cache numbers too!
// cache numbers too!
for (i = 0; i < 10; i++)
{
sprintf(buffer, "STTNUM%d", i);
tallnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "PINGN%d", i);
pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
pingnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "OPPRNK0%d", i);
ranknum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
ranknum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
// minus for negative tallnums
tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX);
songcreditbg = W_CachePatchName("K_SONGCR", PU_HUDGFX);
songcreditbg = (patch_t *)W_CachePatchName("K_SONGCR", PU_HUDGFX);
// cache ping gfx:
for (i = 0; i < 5; i++)
@@ -383,12 +386,15 @@ void HU_LoadGraphics(void)
pinggfx[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
pingmeasure[0] = W_CachePatchName("PINGD", PU_HUDGFX);
pingmeasure[1] = W_CachePatchName("PINGMS", PU_HUDGFX);
pingmeasure[0] = (patch_t *)W_CachePatchName("PINGD", PU_HUDGFX);
pingmeasure[1] = (patch_t *)W_CachePatchName("PINGMS", PU_HUDGFX);
// fps stuff
framecounter = W_CachePatchName("FRAMER", PU_HUDGFX);
frameslash = W_CachePatchName("FRAMESL", PU_HUDGFX);
framecounter = (patch_t *)W_CachePatchName("FRAMER", PU_HUDGFX);
frameslash = (patch_t *)W_CachePatchName("FRAMESL", PU_HUDGFX);
// idk where else to put this lul
srb2back = (patch_t *)W_CachePatchName("SRB2BACK", PU_HUDGFX);
}
// Initialise Heads up
+1
View File
@@ -90,6 +90,7 @@ extern patch_t *pinggfx[5];
extern patch_t *ranknum[10];
extern patch_t *framecounter;
extern patch_t *frameslash;
extern patch_t *srb2back;
extern patch_t *lt_font[LT_FONTSIZE];
extern patch_t *cred_font[CRED_FONTSIZE];
extern patch_t *rflagico;
+4 -4
View File
@@ -2350,7 +2350,7 @@ static void M_DrawGenericMenu(void)
static void M_DrawGenericBackgroundMenu(void)
{
V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH));
V_DrawPatchFill(srb2back);
M_DrawGenericMenu();
}
@@ -2923,7 +2923,7 @@ static void M_DrawMessageMenu(void)
// hack: draw RA background in RA menus
if (gamestate == GS_TIMEATTACK)
V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH));
V_DrawPatchFill(srb2back);
M_DrawTextBox(currentMenu->x, y - 8, (max+7)>>3, mlines);
@@ -4320,7 +4320,7 @@ static void M_DrawReplayHut(void)
static UINT16 replayhutmenuy = 0;
V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH));
V_DrawPatchFill(srb2back);
if (cv_vhseffect.value)
V_DrawVhsEffect(false);
@@ -5959,7 +5959,7 @@ void M_DrawTimeAttackMenu(void)
//S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH));
V_DrawPatchFill(srb2back);
M_DrawMenuTitle();
if (currentMenu == &SP_TimeAttackDef)
+1 -6
View File
@@ -61,8 +61,6 @@ typedef struct
static y_data_t data;
// graphics
static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK
static INT32 timer;
static INT32 intertic;
@@ -446,7 +444,7 @@ void Y_IntermissionDrawer(void)
|| (rendermode == render_opengl && cv_glscreentextures.value != 2) // use the neato kart bg for intermission on disabled screen textures
#endif
)
V_DrawPatchFill(bgtile); // use the neato kart bg for intermission on disabled screen textures
V_DrawPatchFill(srb2back); // use the neato kart bg for intermission on disabled screen textures
else
{
if (rendermode == render_soft)
@@ -788,9 +786,6 @@ void Y_StartIntermission(void)
break;
}
if (rendermode != render_none)
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH_LOWPRIORITY);
LUA_HUD_DestroyDrawList(luahuddrawlist_intermission);
luahuddrawlist_intermission = LUA_HUD_CreateDrawList();
}