add more purge tags refactor patch freeing and stuff

currently dies when adding a wad midgame and the loading into another map
This commit is contained in:
Alug committed 2025-04-16 15:56:41 +02:00
1 parent fe1579e960
commit 39f8fa8d34
29 files changed
+447 -314

No files matched your search

+1 -1
View File
@@ -1509,7 +1509,7 @@ static void CON_DrawConsole(void)
// draw console background
if (cons_backpic.value || con_forcepic)
{
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_PATCH_LOWPRIORITY);
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
+2 -2
View File
@@ -603,7 +603,7 @@ static boolean D_Display(void)
py = 4;
else
py = viewwindowy + 4;
patch = W_CachePatchName("M_PAUSE", PU_CACHE);
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - patch->width)/2, py, V_SNAPTOTOP, patch);
}
@@ -733,7 +733,7 @@ void D_SRB2Loop(void)
COM_ImmedExecute("cls;version");
if (rendermode == render_soft)
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, W_CachePatchNum(W_GetNumForName("KARTKREW"), PU_CACHE), NULL);
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, W_CachePatchNum(W_GetNumForName("KARTKREW"), PU_PATCH_LOWPRIORITY), NULL);
I_FinishUpdate(); // page flip or blit buffer
for (;;)
+20 -23
View File
@@ -164,8 +164,8 @@ static void F_SkyScroll(INT32 scrollspeed)
patch_t *pat, *pat2;
INT32 anim2 = 0;
pat = W_CachePatchName("TITLEBG1", PU_CACHE);
pat2 = W_CachePatchName("TITLEBG2", PU_CACHE);
pat = W_CachePatchName("TITLEBG1", PU_PATCH_LOWPRIORITY);
pat2 = W_CachePatchName("TITLEBG2", PU_PATCH_LOWPRIORITY);
w = (vid.width / vid.dupx)<<FRACBITS;
@@ -263,7 +263,7 @@ void F_IntroDrawer(void)
// DRAW A FULL PIC INSTEAD OF FLAT!
if (intro_scenenum == 0)
{
background = W_CachePatchName("KARTKREW", PU_CACHE);
background = W_CachePatchName("KARTKREW", PU_PATCH_LOWPRIORITY);
highres = true;
}
@@ -630,10 +630,10 @@ void F_CreditDrawer(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
// Draw background
V_DrawSciencePatch(0, 0 - FixedMul(32<<FRACBITS, FixedDiv(credbgtimer%TICRATE, TICRATE)), V_SNAPTOTOP, W_CachePatchName("CREDTILE", PU_CACHE), FRACUNIT);
V_DrawSciencePatch(0, 0 - FixedMul(32<<FRACBITS, FixedDiv(credbgtimer%TICRATE, TICRATE)), V_SNAPTOTOP, W_CachePatchName("CREDTILE", PU_PATCH_LOWPRIORITY), FRACUNIT);
V_DrawSciencePatch(0, 0 - FixedMul(40<<FRACBITS, FixedDiv(credbgtimer%(TICRATE/2), (TICRATE/2))), V_SNAPTOTOP, W_CachePatchName("CREDZIGZ", PU_CACHE), FRACUNIT);
V_DrawSciencePatch(320<<FRACBITS, 0 - FixedMul(40<<FRACBITS, FixedDiv(credbgtimer%(TICRATE/2), (TICRATE/2))), V_SNAPTOTOP|V_FLIP, W_CachePatchName("CREDZIGZ", PU_CACHE), FRACUNIT);
V_DrawSciencePatch(0, 0 - FixedMul(40<<FRACBITS, FixedDiv(credbgtimer%(TICRATE/2), (TICRATE/2))), V_SNAPTOTOP, W_CachePatchName("CREDZIGZ", PU_PATCH_LOWPRIORITY), FRACUNIT);
V_DrawSciencePatch(320<<FRACBITS, 0 - FixedMul(40<<FRACBITS, FixedDiv(credbgtimer%(TICRATE/2), (TICRATE/2))), V_SNAPTOTOP|V_FLIP, W_CachePatchName("CREDZIGZ", PU_PATCH_LOWPRIORITY), FRACUNIT);
// Draw pictures
for (i = 0; credits_pics[i].patch; i++)
@@ -647,7 +647,7 @@ void F_CreditDrawer(void)
sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics
}
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_CACHE), colormap);
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), colormap);
}
// Dim the background
@@ -846,9 +846,9 @@ void F_GameEvaluationDrawer(void)
patchname[4] = 'A'+(char)i;
if (emeralds & (1<<i))
V_DrawScaledPatch(x, y, 0, W_CachePatchName(patchname, PU_CACHE));
V_DrawScaledPatch(x, y, 0, W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY));
else
V_DrawTranslucentPatch(x, y, TRANSLEVEL, W_CachePatchName(patchname, PU_CACHE));
V_DrawTranslucentPatch(x, y, TRANSLEVEL, W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY));
eemeralds_cur += INTERVAL;
}
@@ -864,9 +864,6 @@ void F_GameEvaluationDrawer(void)
if (ALL7EMERALDS(emeralds))
++timesBeatenWithEmeralds;
/*if (ultimatemode)
++timesBeatenUltimate;*/
if (M_UpdateUnlockablesAndExtraEmblems(false))
S_StartSound(NULL, sfx_ncitem);
@@ -877,10 +874,10 @@ void F_GameEvaluationDrawer(void)
if (finalecount >= 5*TICRATE)
{
if (drawemblem)
V_DrawScaledPatch(120, 192, 0, W_CachePatchName("NWNGA0", PU_CACHE));
V_DrawScaledPatch(120, 192, 0, W_CachePatchName("NWNGA0", PU_PATCH_LOWPRIORITY));
if (drawchaosemblem)
V_DrawScaledPatch(200, 192, 0, W_CachePatchName("NWNGA0", PU_CACHE));
V_DrawScaledPatch(200, 192, 0, W_CachePatchName("NWNGA0", PU_PATCH_LOWPRIORITY));
V_DrawString(8, 16, V_YELLOWMAP, "Unlocked:");
@@ -975,10 +972,10 @@ void F_StartTitleScreen(void)
demoDelayLeft = demoDelayTime;
demoIdleLeft = demoIdleTime;
ttbanner = W_CachePatchName("TTKBANNR", PU_LEVEL);
ttkart = W_CachePatchName("TTKART", PU_LEVEL);
ttcheckers = W_CachePatchName("TTCHECK", PU_LEVEL);
ttkflash = W_CachePatchName("TTKFLASH", PU_LEVEL);
ttbanner = W_CachePatchName("TTKBANNR", PU_PATCH_LOWPRIORITY);
ttkart = W_CachePatchName("TTKART", PU_PATCH_LOWPRIORITY);
ttcheckers = W_CachePatchName("TTCHECK", PU_PATCH_LOWPRIORITY);
ttkflash = W_CachePatchName("TTKFLASH", PU_PATCH_LOWPRIORITY);
}
// (no longer) De-Demo'd Title Screen
@@ -1193,7 +1190,7 @@ void F_StartWaitingPlayers(void)
for (i = 0; i < 2; i++)
{
sprframe = &skins[randskin].spritedef.spriteframes[(6+(i*3)) & FF_FRAMEMASK];
driver[i] = W_CachePatchNum(sprframe->lumppat[1], PU_LEVEL);
driver[i] = W_CachePatchNum(sprframe->lumppat[1], PU_SPRITE);
}
}
@@ -1262,9 +1259,9 @@ void F_ContinueDrawer(void)
ncontinues = 20;
if (imcontinuing)
contsonic = W_CachePatchName("CONT2", PU_CACHE);
contsonic = W_CachePatchName("CONT2", PU_PATCH_LOWPRIORITY);
else
contsonic = W_CachePatchName("CONT1", PU_CACHE);
contsonic = W_CachePatchName("CONT1", PU_PATCH_LOWPRIORITY);
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawCenteredString(BASEVIDWIDTH/2, 100, 0, "CONTINUE?");
@@ -1489,10 +1486,10 @@ void F_CutsceneDrawer(void)
{
if (cutscenes[cutnum]->scene[scenenum].pichires[picnum])
V_DrawSmallScaledPatch(picxpos, picypos, 0,
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_CACHE));
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
else
V_DrawScaledPatch(picxpos,picypos, 0,
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_CACHE));
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH_LOWPRIORITY));
}
if (dofadenow && rendermode != render_none)
+3 -3
View File
@@ -369,7 +369,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
{
//x,y,dx,dy (like a divline)
line_t *line = lseg->linedef;
// portal check
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
{
@@ -380,7 +380,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
if (line2 >= 0) // found it!
gl_maphasportals = 1;
}
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
p1.y = FIXED_TO_FLOAT(lseg->side ? line->v2->y : line->v1->y);
p2.x = FIXED_TO_FLOAT(lseg->side ? line->v1->x : line->v2->x);
@@ -523,7 +523,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_CACHE)); // SRB2 background, ehhh too bright.
//V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH)); // 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);
+100 -35
View File
@@ -117,7 +117,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
//Hurdler: 25/04/2000: now support colormap in hardware mode
if (mipmap->colormap)
texel = mipmap->colormap[texel];
texel = mipmap->colormap->data[texel];
// hope compiler will get this switch out of the loops (dreams...)
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
@@ -314,9 +314,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
texture_t *texture;
texpatch_t *patch;
softwarepatch_t *realpatch;
UINT8 *pdata;
INT32 blockwidth, blockheight, blocksize;
UINT8 *colormap = colormaps;
INT32 i, idx;
boolean skyspecial = false; // poor hack for Legacy large skies..
@@ -326,9 +327,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
texture = textures[texnum];
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
gltex->mipmap.width = (UINT16)(texture->width);
gltex->mipmap.height = (UINT16)(texture->height);
gltex->mipmap.colormap = colormaps;
gltex->mipmap.format = textureformat;
// hack the Legacy skies..
@@ -340,11 +338,18 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
}
gltex->mipmap.width = (UINT16)(texture->width);
gltex->mipmap.height = (UINT16)(texture->height);
#ifdef GLENCORE
if (encoremap && !noencore)
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
colormap += COLORMAP_REMAPOFFSET;
#endif
gltex->mipmap.colormap = Z_Calloc(sizeof(*gltex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
gltex->mipmap.colormap->source = colormap;
M_Memcpy(gltex->mipmap.colormap->data, colormap, 256 * sizeof(UINT8));
blockwidth = texture->width;
blockheight = texture->height;
blocksize = (blockwidth * blockheight);
@@ -372,8 +377,12 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
// Composite the columns together.
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{
pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
realpatch = (softwarepatch_t *)pdata;
// If this patch has already been loaded, we just use it from the cache.
realpatch = (softwarepatch_t *)W_GetCachedPatchNumPwad(patch->wad, patch->lump);
// Otherwise, we load it here.
if (realpatch == NULL)
realpatch = (softwarepatch_t *)W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
if (realpatch != NULL)
{
@@ -399,7 +408,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
}
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
void HWR_MakePatch(const patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
{
if (glMipmap->width == 0)
{
@@ -440,17 +449,17 @@ static GLMapTexture_t *gl_textures; // For all textures
void HWR_FreeTextureData(patch_t *patch)
{
GLPatch_t *grPatch;
GLPatch_t *glPatch;
if (!patch || !patch->hardware)
return;
grPatch = patch->hardware;
glPatch = patch->hardware;
if (vid.glstate == VID_GL_LIBRARY_LOADED)
GL_DeleteTexture(grPatch->mipmap);
if (grPatch->mipmap->data)
Z_Free(grPatch->mipmap->data);
GL_DeleteTexture(glPatch->mipmap);
if (glPatch->mipmap->data)
Z_Free(glPatch->mipmap->data);
}
void HWR_FreeTexture(patch_t *patch)
@@ -486,7 +495,6 @@ void HWR_FreeTextureColormaps(patch_t *patch)
return;
pat = patch->hardware;
if (!pat)
return;
@@ -508,12 +516,19 @@ void HWR_FreeTextureColormaps(patch_t *patch)
// Set the first colormap to the one that comes after it.
next = pat->mipmap->nextcolormap;
if (!next)
break;
pat->mipmap->nextcolormap = next->nextcolormap;
// Free image data from memory.
if (next->data)
Z_Free(next->data);
if (next->colormap)
Z_Free(next->colormap);
next->data = NULL;
next->colormap = NULL;
GL_DeleteTexture(next);
// Free the old colormap mipmap from memory.
@@ -521,16 +536,30 @@ void HWR_FreeTextureColormaps(patch_t *patch)
}
}
static boolean FreeTextureCallback(void *mem)
{
patch_t *patch = (patch_t *)mem;
HWR_FreeTexture(patch);
return false;
}
static boolean FreeColormapsCallback(void *mem)
{
patch_t *patch = (patch_t *)mem;
HWR_FreeTextureColormaps(patch);
return false;
}
static void HWR_FreePatchCache(boolean freeall)
{
INT32 i;
boolean (*callback)(void *mem) = FreeTextureCallback;
for (i = 0; i < numwadfiles; i++)
{
INT32 j = 0;
for (; j < wadfiles[i]->numlumps; j++)
(freeall ? HWR_FreeTexture : HWR_FreeTextureColormaps)(wadfiles[i]->patchcache[j]);
}
if (!freeall)
callback = FreeColormapsCallback;
Z_IterateTags(PU_PATCH, PU_PATCH_ROTATED, callback);
//Z_IterateTags(PU_SPRITE, PU_HUDGFX, callback); // why would we want to free our hudgfx?
Z_IterateTags(PU_SPRITE, PU_SPRITE, callback);
}
// free all textures after each level
@@ -556,6 +585,7 @@ static void FreeMapTexture(GLMapTexture_t *tex)
GL_DeleteTexture(&tex->mipmap);
if (tex->mipmap.data)
Z_Free(tex->mipmap.data);
tex->mipmap.data = NULL;
}
void HWR_FreeMapTextures(void)
@@ -788,7 +818,7 @@ static void HWR_PrecacheLevelSprites(void)
#define cacheang(a) {\
lump = sf->lumppat[a];\
spritepatch = (patch_t *)W_CachePatchNum(lump, PU_CACHE);\
spritepatch = (patch_t *)W_CachePatchNum(lump, PU_SPRITE);\
if (spritepatch != NULL)\
HWR_GetPatch(spritepatch);\
}
@@ -831,10 +861,9 @@ void HWR_PrecacheLevel(void)
void HWR_LoadMapTextures(size_t pnumtextures)
{
// we must free it since numtextures changed
// we must free it since numtextures may have changed
HWR_FreeMapTextures();
// Why not Z_Malloc?
gl_numtextures = pnumtextures;
#ifdef GLENCORE
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
@@ -936,7 +965,7 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
continue;
flat[steppy] = glMipmap->colormap[flat[steppy]];
flat[steppy] = glMipmap->colormap->source[flat[steppy]];
}
#endif
}
@@ -946,6 +975,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
GLMipmap_t *glMipmap;
patch_t *patch;
UINT8 *colormap = colormaps;
if (flatlumpnum == LUMPERROR)
return;
@@ -953,12 +983,16 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
patch = HWR_GetCachedGLPatch(flatlumpnum);
glMipmap = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap;
glMipmap->colormap = colormaps;
if (!glMipmap->colormap)
{
#ifdef GLENCORE
if (!noencoremap && encoremap)
glMipmap->colormap += COLORMAP_REMAPOFFSET;
if (!noencoremap && encoremap)
colormap += COLORMAP_REMAPOFFSET;
#endif
glMipmap->colormap = Z_Calloc(sizeof(*glMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
glMipmap->colormap->source = colormap;
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
}
if (!glMipmap->downloaded && !glMipmap->data)
HWR_CacheFlat(glMipmap, flatlumpnum);
@@ -991,6 +1025,26 @@ static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *glMipmap)
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
}
// ----------------------+
// HWR_UpdatePatchMipmap : Updates a mipmap.
// ----------------------+
static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *glMipmap)
{
GLPatch_t *grPatch = patch->hardware;
HWR_MakePatch(patch, grPatch, glMipmap, true);
// If hardware does not have the texture, then call pfnSetTexture to upload it
// If it does have the texture, then call pfnUpdateTexture to update it
if (!glMipmap->downloaded)
GL_SetTexture(glMipmap);
else
GL_UpdateTexture(glMipmap);
HWR_SetCurrentTexture(glMipmap);
// The system-memory data can be purged now.
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
// -----------------+
@@ -1013,7 +1067,8 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
Patch_CreateGL(patch);
glPatch = patch->hardware;
if (colormap == colormaps || colormap == NULL)
// Blatant hack for encore colormapping aside...
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
{
// Load the default (green) color in hardware cache
HWR_GetPatch(patch);
@@ -1026,9 +1081,16 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
{
glMipmap = glMipmap->nextcolormap;
if (UNLIKELY(glMipmap->colormap == colormap))
if (UNLIKELY(glMipmap->colormap && glMipmap->colormap->source == colormap))
{
HWR_LoadPatchMipmap(patch, glMipmap);
if (memcmp(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
{
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
HWR_UpdatePatchMipmap(patch, glMipmap);
}
else
HWR_LoadPatchMipmap(patch, glMipmap);
return;
}
}
@@ -1044,7 +1106,10 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glMipmap->nextcolormap = newMipmap;
newMipmap->colormap = colormap;
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
newMipmap->colormap->source = colormap;
M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
HWR_LoadPatchMipmap(patch, newMipmap);
}
@@ -1061,7 +1126,7 @@ patch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
lumpcache_t *lumpcache = wadfiles[wadnum]->patchcache;
if (!lumpcache[lumpnum])
{
void *ptr = Z_Calloc(sizeof(patch_t), PU_CACHE, &lumpcache[lumpnum]);
void *ptr = Z_Calloc(sizeof(patch_t), PU_PATCH, &lumpcache[lumpnum]);
Patch_Create(NULL, 0, ptr);
Patch_AllocateHardwarePatch(ptr);
}
+22 -14
View File
@@ -23,31 +23,39 @@
typedef enum GLTextureFormat_e
{
GL_TEXFMT_P_8 = 0x01, /* 8-bit palette */
GL_TEXFMT_AP_88 = 0x02, /* 8-bit alpha, 8-bit palette */
GL_TEXFMT_P_8 = 0x01, /* 8-bit palette */
GL_TEXFMT_AP_88 = 0x02, /* 8-bit alpha, 8-bit palette */
GL_TEXFMT_RGBA = 0x10, /* 32 bit RGBA! */
GL_TEXFMT_RGBA = 0x10, /* 32 bit RGBA! */
GL_TEXFMT_ALPHA_8 = 0x20, /* (0..0xFF) alpha */
GL_TEXFMT_INTENSITY_8 = 0x21, /* (0..0xFF) intensity */
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
GL_TEXFMT_ALPHA_8 = 0x20, /* (0..0xFF) alpha */
GL_TEXFMT_INTENSITY_8 = 0x21, /* (0..0xFF) intensity */
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
} GLTextureFormat_t;
// Colormap structure for mipmaps.
struct GLColormap_s
{
const UINT8 *source;
UINT8 data[256];
};
typedef struct GLColormap_s GLColormap_t;
// Texture information (misleadingly named "mipmap" all over the code.)
// The *data pointer holds the address of the graphics data cached in heap memory.
// NULL if the texture is not in SRB2's heap cache.
struct GLMipmap_s
{
// for UpdateTexture
GLTextureFormat_t format;
void *data;
GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 width, height;
UINT32 flags;
UINT16 width, height;
UINT32 downloaded; // The GPU has this texture.
struct GLMipmap_s *nextcolormap;
const UINT8 *colormap;
struct GLMipmap_s *nextcolormap;
struct GLColormap_s *colormap;
};
typedef struct GLMipmap_s GLMipmap_t;
@@ -62,11 +70,11 @@ struct GLMapTexture_s
};
typedef struct GLMapTexture_s GLMapTexture_t;
// a cached patch as converted to hardware format
// Patch information for the hardware renderer.
struct GLPatch_s
{
float max_s,max_t;
GLMipmap_t *mipmap;
float max_s,max_t;
boolean notfound; // if the texture file was not found, mark it here (used in model texture loading)
};
typedef struct GLPatch_s GLPatch_t;
+8 -8
View File
@@ -712,7 +712,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
// top edge
if (clearlines > basewindowy - 8)
{
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_CACHE);
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
for (x = 0; x < baseviewwidth; x += 8)
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
0);
@@ -721,7 +721,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
// bottom edge
if (clearlines > basewindowy + baseviewheight)
{
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_CACHE);
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
for (x = 0; x < baseviewwidth; x += 8)
HWR_DrawPatch(patch, basewindowx + x,
basewindowy + baseviewheight, 0);
@@ -730,7 +730,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
// left edge
if (clearlines > basewindowy)
{
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_CACHE);
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
y += 8)
{
@@ -742,7 +742,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
// right edge
if (clearlines > basewindowy)
{
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_CACHE);
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
y += 8)
{
@@ -754,22 +754,22 @@ void HWR_DrawViewBorder(INT32 clearlines)
// Draw beveled corners.
if (clearlines > basewindowy - 8)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
PU_CACHE),
PU_PATCH),
basewindowx - 8, basewindowy - 8, 0);
if (clearlines > basewindowy - 8)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
PU_CACHE),
PU_PATCH),
basewindowx + baseviewwidth, basewindowy - 8, 0);
if (clearlines > basewindowy+baseviewheight)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
PU_CACHE),
PU_PATCH),
basewindowx - 8, basewindowy + baseviewheight, 0);
if (clearlines > basewindowy + baseviewheight)
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
PU_CACHE),
PU_PATCH),
basewindowx + baseviewwidth,
basewindowy + baseviewheight, 0);
}
+1
View File
@@ -40,6 +40,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
void GL_RenderSkyDome(gl_sky_t *sky);
void GL_UpdateTexture(GLMipmap_t *pTexInfo);
void GL_SetTexture(GLMipmap_t *pTexInfo);
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
+1 -1
View File
@@ -65,7 +65,7 @@ patch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
void HWR_GetPatch(patch_t *gpatch);
void HWR_GetMappedPatch(patch_t *gpatch, const UINT8 *colormap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
void HWR_MakePatch(const patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
void HWR_PrecacheLevel(void);
+7 -7
View File
@@ -844,7 +844,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
if (!M_PointInBox(segbbox,splat->v1.x,splat->v1.y) && !M_PointInBox(segbbox,splat->v2.x,splat->v2.y))
continue;
gpatch = W_CachePatchNum(splat->patch, PU_CACHE);
gpatch = W_CachePatchNum(splat->patch, PU_SPRITE);
HWR_GetPatch(gpatch);
wallVerts[0].x = wallVerts[3].x = FIXED_TO_FLOAT(splat->v1.x);
@@ -4903,7 +4903,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
vis->gpatch = (patch_t *)rotsprite;
else
#endif
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
vis->mobj = thing;
@@ -5071,15 +5071,15 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->z2 = z2;
vis->tz = tz;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
vis->gpatch = (patch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
vis->flip = flip;
vis->mobj = (mobj_t *)thing;
vis->colormap = colormaps;
vis->colormap = NULL;
#ifdef GLENCORE
if (encoremap && !(thing->flags & MF_DONTENCOREMAP))
vis->colormap += COLORMAP_REMAPOFFSET;
//if (encoremap && !(thing->flags & MF_DONTENCOREMAP))
//vis->colormap += COLORMAP_REMAPOFFSET;
#endif
// set top/bottom coords
@@ -5548,7 +5548,7 @@ static void HWR_RenderFrame(player_t *player, boolean skybox)
if (splitscreen == 2 && player == &players[displayplayers[2]])
{
// V_DrawPatchFill, but for the fourth screen only
patch_t *gpatch = W_CachePatchName("SRB2BACK", PU_CACHE);
patch_t *gpatch = W_CachePatchName("SRB2BACK", PU_PATCH);
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = (gpatch->width) * dupz, ph = (gpatch->height) * dupz;
+19 -8
View File
@@ -1086,14 +1086,22 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
{
glMipmap = glMipmap->nextcolormap;
if (glMipmap->colormap != colormap)
continue;
if (glMipmap->downloaded && glMipmap->data)
if (glMipmap->colormap && glMipmap->colormap->source == colormap)
{
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
return;
if (glMipmap->downloaded && glMipmap->data)
{
if (memcmp(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8)))
{
M_Memcpy(glMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
HWR_CreateBlendedTexture(patch, blendgpatch, glMipmap, skinnum, color);
GL_UpdateTexture(glMipmap);
}
else
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
return;
}
}
}
@@ -1108,7 +1116,10 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
if (newMipmap == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glMipmap->nextcolormap = newMipmap;
newMipmap->colormap = colormap;
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
newMipmap->colormap->source = colormap;
M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
HWR_CreateBlendedTexture(patch, blendgpatch, newMipmap, skinnum, color);
+22 -22
View File
@@ -191,7 +191,7 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
if (!gllogstream)
gllogstream = fopen("ogllog.txt", "w");
va_start(arglist, format);
vsnprintf(str, 4096, format, arglist);
va_end(arglist);
@@ -673,7 +673,7 @@ typedef enum
gluniform_light_dir,
gluniform_light_contrast,
gluniform_light_backlight,
// palette rendering
gluniform_palette_tex, // 1d texture containing a palette
gluniform_palette_lookup_tex, // 3d texture containing the rgb->index lookup table
@@ -743,7 +743,7 @@ void SetupGLFunc4(void)
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f");
pglClientActiveTexture = GetGLFunc("glClientActiveTexture");
pglMultiTexCoord2fv = GetGLFunc("glMultiTexCoord2fv");
/* 1.5 funcs */
pglGenBuffers = GetGLFunc("glGenBuffers");
pglBindBuffer = GetGLFunc("glBindBuffer");
@@ -753,7 +753,7 @@ void SetupGLFunc4(void)
/* 2.0 funcs */
pglBlendEquation = GetGLFunc("glBlendEquation");
pglStencilFuncSeparate = GetGLFunc("glStencilFuncSeparate");
pglStencilOpSeparate = GetGLFunc("glStencilOpSeparate");
@@ -809,7 +809,7 @@ boolean GL_InitShaders(void)
{
if (!pglUseProgram)
return false;
gl_fallback_shader.vertex_shader = Z_StrDup(GLSL_FALLBACK_VERTEX_SHADER);
gl_fallback_shader.fragment_shader = Z_StrDup(GLSL_FALLBACK_FRAGMENT_SHADER);
@@ -1643,7 +1643,7 @@ static void GL_AllocTextureBuffer(GLMipmap_t *pTexInfo)
// -----------------+
// UpdateTexture : Updates texture data.
// -----------------+
static void GL_UpdateTexture(GLMipmap_t *pTexInfo)
void GL_UpdateTexture(GLMipmap_t *pTexInfo)
{
// Upload a texture
GLuint num = pTexInfo->downloaded;
@@ -2024,7 +2024,7 @@ static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
pglDeleteShader(gl_vertShader);
if (frag_shader)
pglDeleteShader(gl_fragShader);
// couldn't link?
if (result != GL_TRUE)
{
@@ -2313,7 +2313,7 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
gltexformat = (Value == 32) ? GL_RGBA : GL_RGB5_A1;
GL_Flush();
break;
case HWD_SET_MSAA:
if (Value)
{
@@ -2623,7 +2623,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
scalex = hscale;
scaley = vscale;
scalez = hscale;
if (duration > 0.0 && tics >= 0.0) // don't interpolate if instantaneous or infinite in length
{
float newtime = (duration - tics); // + 1;
@@ -2692,7 +2692,7 @@ void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
if (pos->roll)
{
pglTranslatef(pos->centerx, pos->centery, 0);
@@ -2895,7 +2895,7 @@ INT32 GL_GetTextureUsed(void)
res += tmp->height*tmp->width*bpp;
tmp = tmp->next;
}
return res;
}
@@ -2913,8 +2913,8 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
16.0f, 16.0f, 6.0f,
16.0f, -16.0f, 6.0f
};
if (gl_enable_screen_textures != 2)
if (gl_enable_screen_textures != 2)
return;
// look for power of two that is large enough for the screen
@@ -3010,8 +3010,8 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
};
float fix[8];
if (gl_enable_screen_textures != 2)
if (gl_enable_screen_textures != 2)
return;
// look for power of two that is large enough for the screen
@@ -3039,7 +3039,7 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
GL_PreparePolygon(surf, surf ? polyflags : (PF_NoDepthTest));
if (!surf)
pglColor4ubv(white);
@@ -3078,7 +3078,7 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
1.0f, 1.0f
};
if (!gl_enable_screen_textures)
if (!gl_enable_screen_textures)
return;
// look for power of two that is large enough for the screen
@@ -3164,7 +3164,7 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
1.0f, -1.0f, 1.0f
};
if (gl_enable_screen_textures != 2)
if (gl_enable_screen_textures != 2)
return;
// look for power of two that is large enough for the screen
@@ -3261,7 +3261,7 @@ void GL_MakeScreenTexture(int tex)
{
INT32 texsizew = 512, texsizey = 512;
boolean firstTime = (screenTextures[tex] == 0);
if (!gl_enable_screen_textures)
return;
@@ -3301,7 +3301,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
float off[12];
float fix[8];
if (gl_enable_screen_textures != 2)
return;
@@ -3392,7 +3392,7 @@ void GL_SetPaletteLookup(UINT8 *lut)
{
internalFormat = GL_R8;
}
if (!paletteLookupTex)
pglGenTextures(1, &paletteLookupTex);
pglActiveTexture(GL_TEXTURE1);
@@ -3441,7 +3441,7 @@ void GL_ClearLightTables(void)
}
LightTablesTail = NULL;
// we no longer have a bound light table (if we had one), we just deleted it!
lt_downloaded = 0;
}
+7 -7
View File
@@ -8982,7 +8982,7 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
if (emblem->collected)
{
emblempic[curemb] = W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE);
emblempic[curemb] = W_CachePatchName(M_GetEmblemPatch(emblem), PU_PATCH);
emblemcol[curemb] = R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE);
if (++curemb == 3)
break;
@@ -9018,7 +9018,7 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
V_DrawRightAlignedString(workx, worky, splitflags, targettext);
workx -= 67;
V_DrawSmallScaledPatch(workx + 4, worky, splitflags, W_CachePatchName("NEEDIT", PU_CACHE));
V_DrawSmallScaledPatch(workx + 4, worky, splitflags, W_CachePatchName("NEEDIT", PU_PATCH));
break;
@@ -9546,11 +9546,11 @@ static void K_DrawDialSpeedometer(fixed_t speed,
if (rot)
{
dialpatch = W_CachePatchNameRotated("K_DSDIAL", rot, PU_STATIC);
dialpatch = W_CachePatchNameRotated("K_DSDIAL", rot, PU_PATCH);
}
else
{
dialpatch = W_CachePatchName("K_DSDIAL", PU_STATIC);
dialpatch = W_CachePatchName("K_DSDIAL", PU_PATCH);
}
if (colorized) // Colourized hud
@@ -10587,7 +10587,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
if (rot)
{
minimaphead = W_CachePatchNameRotated(skin->facemmap, rot, PU_STATIC);
minimaphead = W_CachePatchNameRotated(skin->facemmap, rot, PU_PATCH);
}
}
#endif
@@ -11629,8 +11629,8 @@ void K_drawKartHUD(void)
x += offs - frac;
}
V_DrawSciencePatch(x - (54*FRACUNIT), y, logoflags, W_CachePatchName("TTKBANNR", PU_CACHE), FRACUNIT/4);
V_DrawSciencePatch(x - (54*FRACUNIT), y + (25*FRACUNIT), logoflags, W_CachePatchName("TTKART", PU_CACHE), FRACUNIT/4);
V_DrawSciencePatch(x - (54*FRACUNIT), y, logoflags, W_CachePatchName("TTKBANNR", PU_PATCH), FRACUNIT/4);
V_DrawSciencePatch(x - (54*FRACUNIT), y + (25*FRACUNIT), logoflags, W_CachePatchName("TTKART", PU_PATCH), FRACUNIT/4);
}
else if (G_RaceGametype()) // Race-only elements
{
+3 -3
View File
@@ -396,7 +396,7 @@ static int libd_patchExists(lua_State *L)
static int libd_cachePatch(lua_State *L)
{
HUDONLY
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_STATIC), META_PATCH);
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
return 1;
}
@@ -406,7 +406,7 @@ static int libd_cachePatchRotated(lua_State *L)
HUDONLY
angle_t rollangle = luaL_checkangle(L, 2);
INT32 rot = R_GetRollAngle(rollangle);
LUA_PushUserdata(L, W_CachePatchNameRotated(luaL_checkstring(L, 1), rot, PU_STATIC), META_PATCH);
LUA_PushUserdata(L, W_CachePatchNameRotated(luaL_checkstring(L, 1), rot, PU_PATCH), META_PATCH);
return 1;
}
@@ -526,7 +526,7 @@ static int libd_getSpritePatch(lua_State *L)
#endif
// push both the patch and its "flip" value
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_SPRITE), META_PATCH);
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
return 2;
}
+123 -123
View File
@@ -5043,19 +5043,19 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv)
centerlump[1] = W_GetNumForName("M_THERMM");
cursorlump = W_GetNumForName("M_THERMO");
V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_CACHE));
V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump, PU_PATCH));
xx += p->width - p->leftoffset;
for (i = 0; i < 16; i++)
{
V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_CACHE));
V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH));
xx += 8;
}
V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_CACHE));
V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_PATCH));
xx = (cv->value - cv->PossibleValue[0].value) * (15*8) /
(cv->PossibleValue[1].value - cv->PossibleValue[0].value);
V_DrawScaledPatch((x + 8) + xx, y, 0, W_CachePatchNum(cursorlump, PU_CACHE));
V_DrawScaledPatch((x + 8) + xx, y, 0, W_CachePatchNum(cursorlump, PU_PATCH));
}
// A smaller 'Thermo', with range given as percents (0-100)
@@ -5067,18 +5067,18 @@ static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv, boolean ontop)
x = BASEVIDWIDTH - x - SLIDER_WIDTH;
p = W_CachePatchName("M_SLIDEL", PU_CACHE);
p = W_CachePatchName("M_SLIDEL", PU_PATCH);
V_DrawScaledPatch(x - 8, y, 0, p);
p = W_CachePatchName("M_SLIDEM", PU_CACHE);
p = W_CachePatchName("M_SLIDEM", PU_PATCH);
for (i = 0; i < SLIDER_RANGE; i++)
V_DrawScaledPatch (x+i*8, y, 0,p);
p = W_CachePatchName("M_SLIDER", PU_CACHE);
p = W_CachePatchName("M_SLIDER", PU_PATCH);
V_DrawScaledPatch(x+i*8, y, 0, p);
// draw the slider cursor
p = W_CachePatchName("M_SLIDEC", PU_CACHE);
p = W_CachePatchName("M_SLIDEC", PU_PATCH);
for (i = 0; cv->PossibleValue[i+1].strvalue; i++);
@@ -5174,10 +5174,10 @@ static void M_DrawMapEmblems(INT32 mapnum, INT32 x, INT32 y)
lasttype = curtype;
if (emblem->collected)
V_DrawSmallMappedPatch(x, y, 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE),
V_DrawSmallMappedPatch(x, y, 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_PATCH),
R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE));
else
V_DrawSmallScaledPatch(x, y, 0, W_CachePatchName("NEEDIT", PU_CACHE));
V_DrawSmallScaledPatch(x, y, 0, W_CachePatchName("NEEDIT", PU_PATCH));
emblem = M_GetLevelEmblems(-1);
x -= 8;
@@ -5188,7 +5188,7 @@ static void M_DrawMenuTitle(void)
{
if (currentMenu->menutitlepic)
{
patch_t *p = W_CachePatchName(currentMenu->menutitlepic, PU_CACHE);
patch_t *p = W_CachePatchName(currentMenu->menutitlepic, PU_PATCH);
if (p->height > 24) // title is larger than normal
{
@@ -5292,13 +5292,13 @@ static void M_DrawGenericMenu(void)
if (currentMenu->menuitems[i].status & IT_CENTER)
{
patch_t *p;
p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE);
p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
V_DrawScaledPatch((BASEVIDWIDTH - p->width)/2, y, 0, p);
}
else
{
V_DrawScaledPatch(x, y, 0,
W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH));
}
}
/* FALLTHRU */
@@ -5370,7 +5370,7 @@ static void M_DrawGenericMenu(void)
case IT_GRAYPATCH:
if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0])
V_DrawMappedPatch(x, y, 0,
W_CachePatchName(currentMenu->menuitems[i].patch,PU_CACHE), graymap);
W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH), graymap);
y += LINEHEIGHT;
break;
case IT_TRANSTEXT:
@@ -5403,12 +5403,12 @@ static void M_DrawGenericMenu(void)
|| ((currentMenu->menuitems[itemOn].status & IT_DISPLAY) == IT_NOTHING))
{
V_DrawScaledPatch(currentMenu->x + SKULLXOFF, cursory - 5, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
}
else
{
V_DrawScaledPatch(currentMenu->x - 24, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawString(currentMenu->x, cursory, MENUCAPS|highlightflags, currentMenu->menuitems[itemOn].text);
}
@@ -5435,7 +5435,7 @@ static void M_DrawGenericMenu(void)
static void M_DrawGenericBackgroundMenu(void)
{
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH));
M_DrawGenericMenu();
}
@@ -5557,7 +5557,7 @@ static void M_DrawGenericScrollMenu(void)
// DRAW THE SKULL CURSOR
V_DrawScaledPatch(currentMenu->x - 24, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
// dumb hack
// tooltips
@@ -5587,7 +5587,7 @@ static void M_DrawPauseMenu(void)
(currentMenu->y + MPauseMenu[mpause_discordrequests].alphaKey - 1) * FRACUNIT,
FRACUNIT,
0,
W_CachePatchName("K_REQUE2", PU_CACHE),
W_CachePatchName("K_REQUE2", PU_PATCH),
NULL
);
}
@@ -5617,7 +5617,7 @@ static void M_DrawCenteredMenu(void)
case IT_PATCH:
if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0])
{
patch_t *p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE);
patch_t *p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
if (currentMenu->menuitems[i].status & IT_CENTER)
{
@@ -5695,7 +5695,7 @@ static void M_DrawCenteredMenu(void)
case IT_GRAYPATCH:
if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0])
V_DrawMappedPatch(x, y, 0,
W_CachePatchName(currentMenu->menuitems[i].patch,PU_CACHE), graymap);
W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH), graymap);
y += LINEHEIGHT;
break;
}
@@ -5706,12 +5706,12 @@ static void M_DrawCenteredMenu(void)
|| ((currentMenu->menuitems[itemOn].status & IT_DISPLAY) == IT_NOTHING))
{
V_DrawScaledPatch(x + SKULLXOFF, cursory - 5, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
}
else
{
V_DrawScaledPatch(x - V_StringWidth(currentMenu->menuitems[itemOn].text, 0)/2 - 24, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawCenteredString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text);
}
}
@@ -6007,7 +6007,7 @@ static void M_DrawMessageMenu(void)
// hack: draw RA background in RA menus
if (gamestate == GS_TIMEATTACK)
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH));
M_DrawTextBox(currentMenu->x, y - 8, (max+7)>>3, mlines);
@@ -6073,7 +6073,7 @@ static void M_StopMessage(INT32 choice)
// You can even put multiple images in one menu!
static void M_DrawImageDef(void)
{
patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE);
patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text, PU_PATCH);
if (patch->width <= BASEVIDWIDTH)
V_DrawScaledPatch(0,0,0,patch);
else
@@ -6189,23 +6189,23 @@ static void M_AddonsInternal(void)
W_UnlockCachedPatch(addonsp[i]);
}
addonsp[EXT_FOLDER] = W_CachePatchName("M_FFLDR", PU_STATIC);
addonsp[EXT_UP] = W_CachePatchName("M_FBACK", PU_STATIC);
addonsp[EXT_NORESULTS] = W_CachePatchName("M_FNOPE", PU_STATIC);
addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_STATIC);
addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_STATIC);
addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_STATIC);
addonsp[EXT_FOLDER] = W_CachePatchName("M_FFLDR", PU_PATCH);
addonsp[EXT_UP] = W_CachePatchName("M_FBACK", PU_PATCH);
addonsp[EXT_NORESULTS] = W_CachePatchName("M_FNOPE", PU_PATCH);
addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_PATCH);
addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_PATCH);
addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_PATCH);
#ifdef USE_KART
addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_STATIC);
addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_PATCH);
#endif
addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_STATIC);
addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_STATIC);
addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_STATIC);
addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_STATIC);
addonsp[NUM_EXT+1] = W_CachePatchName("M_FSEL", PU_STATIC);
addonsp[NUM_EXT+2] = W_CachePatchName("M_FLOAD", PU_STATIC);
addonsp[NUM_EXT+3] = W_CachePatchName("M_FSRCH", PU_STATIC);
addonsp[NUM_EXT+4] = W_CachePatchName("M_FSAVE", PU_STATIC);
addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_PATCH);
addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_PATCH);
addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_PATCH);
addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_PATCH);
addonsp[NUM_EXT+1] = W_CachePatchName("M_FSEL", PU_PATCH);
addonsp[NUM_EXT+2] = W_CachePatchName("M_FLOAD", PU_PATCH);
addonsp[NUM_EXT+3] = W_CachePatchName("M_FSRCH", PU_PATCH);
addonsp[NUM_EXT+4] = W_CachePatchName("M_FSAVE", PU_PATCH);
MISC_AddonsDef.prevMenu = currentMenu;
M_SetupNextMenu(&MISC_AddonsDef);
@@ -7214,9 +7214,9 @@ static void DrawReplayHutReplayInfo(void)
//CONS_Printf("%d %s\n", demolist[dir_on[menudepthleft]].map, G_BuildMapName(demolist[dir_on[menudepthleft]].map));
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(demolist[dir_on[menudepthleft]].map)));
if (lumpnum != LUMPERROR)
patch = W_CachePatchNum(lumpnum, PU_CACHE);
patch = W_CachePatchNum(lumpnum, PU_PATCH);
else
patch = W_CachePatchName("M_NOLVL", PU_CACHE);
patch = W_CachePatchName("M_NOLVL", PU_PATCH);
if (!(demolist[dir_on[menudepthleft]].kartspeed & DF_ENCORE))
V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch);
@@ -7229,7 +7229,7 @@ static void DrawReplayHutReplayInfo(void)
{
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, W_CachePatchName("RUBYICON", PU_CACHE), NULL);
V_DrawFixedPatch((x+(w>>2))<<FRACBITS, ((y+(h>>2))<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTOTOP, W_CachePatchName("RUBYICON", PU_PATCH), NULL);
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
}
}
@@ -7307,7 +7307,7 @@ static void DrawReplayHutReplayInfo(void)
}
else
{
patch = W_CachePatchName("M_NOWANT", PU_CACHE);
patch = W_CachePatchName("M_NOWANT", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
demolist[dir_on[menudepthleft]].standings[0].color,
@@ -7329,7 +7329,7 @@ static void M_DrawReplayHut(void)
static UINT16 replayhutmenuy = 0;
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH));
if (cv_vhseffect.value)
V_DrawVhsEffect(false);
@@ -7414,7 +7414,7 @@ static void M_DrawReplayHut(void)
if (demolist[i].type == MD_SUBDIR)
{
localx += 8;
V_DrawScaledPatch(x - 4, localy, V_SNAPTOTOP|V_SNAPTOLEFT, W_CachePatchName(dirmenu[i][DIR_TYPE] == EXT_UP ? "M_RBACK" : "M_RFLDR", PU_CACHE));
V_DrawScaledPatch(x - 4, localy, V_SNAPTOTOP|V_SNAPTOLEFT, W_CachePatchName(dirmenu[i][DIR_TYPE] == EXT_UP ? "M_RBACK" : "M_RFLDR", PU_PATCH));
}
if (itemOn == replaylistitem && i == (INT16)dir_on[menudepthleft])
@@ -7462,7 +7462,7 @@ static void M_DrawReplayHut(void)
// Draw the cursor
V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawString(currentMenu->x, cursory, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[itemOn].text);
// Now draw some replay info!
@@ -7526,7 +7526,7 @@ static void M_DrawReplayStartMenu(void)
}
else
{
patch = W_CachePatchName("M_NORANK", PU_CACHE);
patch = W_CachePatchName("M_NORANK", PU_PATCH);
colormap = R_GetTranslationColormap(
TC_RAINBOW,
demolist[dir_on[menudepthleft]].standings[i].color,
@@ -7700,16 +7700,16 @@ static void M_DrawPlaybackMenu(void)
inactivemap = R_GetTranslationColormap(players[ply].skin, players[ply].skincolor, GTC_MENUCACHE);
}
else if (currentMenu->menuitems[i].patch && W_CheckNumForName(currentMenu->menuitems[i].patch) != LUMPERROR)
icon = W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE);
icon = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
else
icon = W_CachePatchName("PLAYRANK", PU_CACHE); // temp
icon = W_CachePatchName("PLAYRANK", PU_PATCH); // temp
}
else if (currentMenu->menuitems[i].status == IT_DISABLED)
continue;
else if (currentMenu->menuitems[i].patch && W_CheckNumForName(currentMenu->menuitems[i].patch) != LUMPERROR)
icon = W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE);
icon = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
else
icon = W_CachePatchName("PLAYRANK", PU_CACHE); // temp
icon = W_CachePatchName("PLAYRANK", PU_PATCH); // temp
if ((i == playback_fastforward && cv_playbackspeed.value > 1) || (i == playback_rewind && demo.rewinding))
V_DrawMappedPatch(currentMenu->x + currentMenu->menuitems[i].alphaKey, currentMenu->y, transmap|V_SNAPTOTOP, icon, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_JAWZ, GTC_MENUCACHE));
@@ -8344,13 +8344,13 @@ static void M_DrawEmblemHints(void)
if (emblem->collected)
{
collected = recommendedflags;
V_DrawMappedPatch(12, 12+(28*j), 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE),
V_DrawMappedPatch(12, 12+(28*j), 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_PATCH),
R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE));
}
else
{
collected = 0;
V_DrawScaledPatch(12, 12+(28*j), 0, W_CachePatchName("NEEDIT", PU_CACHE));
V_DrawScaledPatch(12, 12+(28*j), 0, W_CachePatchName("NEEDIT", PU_PATCH));
}
if (emblem->hint[0])
@@ -8874,7 +8874,7 @@ static void M_DrawStatsMaps(void)
V_DrawRightAlignedString(BASEVIDWIDTH-16, 50, recommendedflags|MENUCAPS, "(complete)");
V_DrawString(32, 50, MENUCAPS, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawSmallScaledPatch(20, 50, 0, W_CachePatchName("GOTITA", PU_STATIC));
V_DrawSmallScaledPatch(20, 50, 0, W_CachePatchName("GOTITA", PU_PATCH));
if (location)
V_DrawCharacter(10, y-(skullAnimCounter/5),
@@ -8945,10 +8945,10 @@ static void M_DrawStatsMaps(void)
exemblem = &extraemblems[i];
if (exemblem->collected)
V_DrawSmallMappedPatch(295, y, 0, W_CachePatchName(M_GetExtraEmblemPatch(exemblem), PU_CACHE),
V_DrawSmallMappedPatch(295, y, 0, W_CachePatchName(M_GetExtraEmblemPatch(exemblem), PU_PATCH),
R_GetTranslationColormap(TC_DEFAULT, M_GetExtraEmblemColor(exemblem), GTC_MENUCACHE));
else
V_DrawSmallScaledPatch(295, y, 0, W_CachePatchName("NEEDIT", PU_CACHE));
V_DrawSmallScaledPatch(295, y, 0, W_CachePatchName("NEEDIT", PU_PATCH));
V_DrawString(20, y, MENUCAPS, va("%s", exemblem->description));
}
@@ -9115,7 +9115,7 @@ void M_DrawTimeAttackMenu(void)
//S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH));
M_DrawMenuTitle();
if (currentMenu == &SP_TimeAttackDef)
@@ -9199,7 +9199,7 @@ void M_DrawTimeAttackMenu(void)
y = currentMenu->y;
// DRAW THE SKULL CURSOR
V_DrawScaledPatch(x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
V_DrawScaledPatch(x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_PATCH));
V_DrawString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text);
// Level record list
@@ -10247,12 +10247,12 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value)));
if (lumpnum != LUMPERROR)
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
PictureOfLevel = W_CachePatchNum(lumpnum, PU_PATCH);
else
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_PATCH);
}
else
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_PATCH);
w = PictureOfLevel->width/2;
i = PictureOfLevel->height/2;
@@ -10287,14 +10287,14 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
/*UINT8 *mappingforencore = NULL;
if ((lumpnum = W_CheckNumForName(va("%sE", mapname))) != LUMPERROR)
mappingforencore = W_CachePatchNum(lumpnum, PU_CACHE);*/
mappingforencore = W_CachePatchNum(lumpnum, PU_PATCH);*/
V_DrawFixedPatch((x+w)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, V_FLIP, PictureOfLevel, 0);
{
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+w/2)<<FRACBITS, ((y+i/2)<<FRACBITS) - (rubyheight<<1), FRACUNIT, 0, W_CachePatchName("RUBYICON", PU_CACHE), NULL);
V_DrawFixedPatch((x+w/2)<<FRACBITS, ((y+i/2)<<FRACBITS) - (rubyheight<<1), FRACUNIT, 0, W_CachePatchName("RUBYICON", PU_PATCH), NULL);
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
}
}
@@ -10326,12 +10326,12 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(i+1)));
if (lumpnum != LUMPERROR)
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
PictureOfLevel = W_CachePatchNum(lumpnum, PU_PATCH);
else
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_PATCH);
}
else
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_PATCH);
x -= horizspac + w/2;
@@ -10364,12 +10364,12 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(i+1)));
if (lumpnum != LUMPERROR)
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
PictureOfLevel = W_CachePatchNum(lumpnum, PU_PATCH);
else
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_PATCH);
}
else
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_PATCH);
V_DrawTinyScaledPatch(x, y, trans, PictureOfLevel);
@@ -10539,7 +10539,7 @@ Update the maxplayers label...
cursorframe += renderdeltatics / 4;
for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {}
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, 0, W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_CACHE), NULL);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, 0, W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_PATCH), NULL);
}
x += incrwidth;
@@ -10776,10 +10776,10 @@ static void M_DrawSetupMultiPlayerMenu(void)
INT32 tw = 0;
spritedef_t *sprdef;
spriteframe_t *sprframe;
patch_t *statbg = W_CachePatchName("K_STATBG", PU_CACHE);
patch_t *statlr = W_CachePatchName("K_STATLR", PU_CACHE);
patch_t *statud = W_CachePatchName("K_STATUD", PU_CACHE);
patch_t *statdot = W_CachePatchName("K_SDOT0", PU_CACHE);
patch_t *statbg = W_CachePatchName("K_STATBG", PU_PATCH);
patch_t *statlr = W_CachePatchName("K_STATLR", PU_PATCH);
patch_t *statud = W_CachePatchName("K_STATUD", PU_PATCH);
patch_t *statdot = W_CachePatchName("K_SDOT0", PU_PATCH);
patch_t *patch;
UINT8 frame;
UINT8 speed;
@@ -10957,17 +10957,17 @@ static void M_DrawSetupMultiPlayerMenu(void)
if (statdp == true)
{
//Background
V_DrawScaledPatch(statx - 50, staty + 4, 0, W_CachePatchName("K_STATNB", PU_CACHE));
V_DrawScaledPatch(statx - 50, staty + 4, 0, W_CachePatchName("K_STATNB", PU_PATCH));
//Speed
for (i = 0; i < GETSELECTEDSPEED; i++) // draw the stat bars
{
if (i == 0)
V_DrawScaledPatch(statx - 45, staty + 63, 0, W_CachePatchName("K_STATN1", PU_CACHE));
V_DrawScaledPatch(statx - 45, staty + 63, 0, W_CachePatchName("K_STATN1", PU_PATCH));
else if (i == GETSELECTEDSPEED -1 )
V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN3", PU_CACHE));
V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN3", PU_PATCH));
else
V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN2", PU_CACHE));
V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN2", PU_PATCH));
}
//Weight
@@ -10975,11 +10975,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
if (i == 0)
V_DrawScaledPatch(statx - 30, staty + 63, 0, W_CachePatchName("K_STATN4", PU_CACHE));
V_DrawScaledPatch(statx - 30, staty + 63, 0, W_CachePatchName("K_STATN4", PU_PATCH));
else if (i == GETSELECTEDWEIGHT -1)
V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN6", PU_CACHE));
V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN6", PU_PATCH));
else
V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN5", PU_CACHE));
V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN5", PU_PATCH));
}
}
@@ -11109,7 +11109,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_CACHE);
cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
}
@@ -11157,7 +11157,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_CACHE);
cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
}
}
@@ -11166,13 +11166,13 @@ static void M_DrawSetupMultiPlayerMenu(void)
INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin);
speed = skins[selectedskin].kartspeed;
weight = skins[selectedskin].kartweight;
statdot = W_CachePatchName("K_SDOT1", PU_CACHE);
statdot = W_CachePatchName("K_SDOT1", PU_PATCH);
if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, flashcol);
else
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, NULL);
statdot = W_CachePatchName("K_SDOT2", PU_CACHE); // coloured center
statdot = W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center
if (setupm_fakecolor)
V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<<FRACBITS) + (FRACUNIT>>1), (((staty+71) + (weight*4))<<FRACBITS), FRACUNIT>>1, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE));
}
@@ -11221,7 +11221,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_CACHE);
cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
}
}
@@ -11232,13 +11232,13 @@ static void M_DrawSetupMultiPlayerMenu(void)
speed = skins[setupm_fakeskin].kartspeed;
weight = skins[setupm_fakeskin].kartweight;
statdot = W_CachePatchName("K_SDOT1", PU_CACHE);
statdot = W_CachePatchName("K_SDOT1", PU_PATCH);
if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats
V_DrawFixedPatch(((BASEVIDWIDTH - mx - 80) + ((speed-1)*8))<<FRACBITS, ((my+76) + ((weight-1)*8))<<FRACBITS, FRACUNIT, 0, statdot, flashcol);
else
V_DrawFixedPatch(((BASEVIDWIDTH - mx - 80) + ((speed-1)*8))<<FRACBITS, ((my+76) + ((weight-1)*8))<<FRACBITS, FRACUNIT, 0, statdot, NULL);
statdot = W_CachePatchName("K_SDOT2", PU_CACHE); // coloured center
statdot = W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center
if (setupm_fakecolor)
V_DrawFixedPatch(((BASEVIDWIDTH - mx - 80) + ((speed-1)*8))<<FRACBITS, ((my+76) + ((weight-1)*8))<<FRACBITS, FRACUNIT, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE));
break;
@@ -11294,7 +11294,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
cursorframe += renderdeltatics / 4;
for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {}
cursor = W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_CACHE);
cursor = W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_PATCH);
if (col < 0)
col += numskins;
@@ -11388,7 +11388,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
sprframe = &sprdef->spriteframes[frame];
//minenice's speen css, it's a piece of shit but hey
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE);
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_PATCH);
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
//this is a very shitty solution for checking if a sprite needs flipping
@@ -11396,7 +11396,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
flags = V_FLIP; // This sprite is left/right flipped!
patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_CACHE);
patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
// draw box around guy
V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239);
@@ -12521,7 +12521,7 @@ static void M_DrawControl(void)
}
V_DrawScaledPatch(currentMenu->x - 20, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
}
#undef controlheight
@@ -12916,7 +12916,7 @@ static void M_DrawLocalSkinMenu(void)
sprframe = &sprdef->spriteframes[frame];
//minenice's speen css, it's a piece of shit but hey
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE);
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_PATCH);
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
//this is a very shitty solution for checking if a sprite needs flipping
@@ -12924,7 +12924,7 @@ static void M_DrawLocalSkinMenu(void)
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4)) {
flags = V_FLIP; // This sprite is left/right flipped!
}
patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_CACHE);
patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
// draw box around guy
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
@@ -12933,8 +12933,8 @@ static void M_DrawLocalSkinMenu(void)
UINT8 *colormap = R_GetTranslationColormap(skintodisplay, cv_playercolor.value, GTC_MENUCACHE);
colormap = R_GetLocalTranslationColormap(&skins[allskins[skintodisplay].localnum], (allskins[skintodisplay].localskin ? &localskins[allskins[skintodisplay].localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, allskins[skintodisplay].localskin);
V_DrawMappedPatch(mx, my+50, 0, W_CachePatchName(allskins[skintodisplay].facewant, PU_CACHE), colormap);
V_DrawMappedPatch(mx+8, my+85, 0, W_CachePatchName(allskins[skintodisplay].facerank, PU_CACHE), colormap);
V_DrawMappedPatch(mx, my+50, 0, W_CachePatchName(allskins[skintodisplay].facewant, PU_PATCH), colormap);
V_DrawMappedPatch(mx+8, my+85, 0, W_CachePatchName(allskins[skintodisplay].facerank, PU_PATCH), colormap);
V_DrawString(mx, my+108, V_ALLOWLOWERCASE, "Character");
if (strlen(allskins[skintodisplay].realname) > 10)
V_DrawThinString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, allskins[skintodisplay].realname);
@@ -13022,7 +13022,7 @@ static void M_DrawVideoMode(void)
j = OP_VideoModeDef.y + 14 + ((vidm_selected % vidm_column_size)*8);
V_DrawScaledPatch(i - 8, j, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
}
// Just M_DrawGenericScrollMenu but showing a backing behind the headers.
@@ -13135,7 +13135,7 @@ static void M_DrawColorMenu(void)
// DRAW THE SKULL CURSOR
V_DrawScaledPatch(currentMenu->x - 24, cursory, 0,
W_CachePatchName("M_CURSOR", PU_CACHE));
W_CachePatchName("M_CURSOR", PU_PATCH));
}
@@ -13296,14 +13296,14 @@ static void M_DrawMonitorToggles(void)
#ifdef ITEMTOGGLEBOTTOMRIGHT
if (currentMenu->menuitems[thisitem].alphaKey == 255)
{
V_DrawScaledPatch(x, y, V_TRANSLUCENT, W_CachePatchName("K_ISBG", PU_CACHE));
V_DrawScaledPatch(x, y, V_TRANSLUCENT, W_CachePatchName("K_ISBG", PU_PATCH));
continue;
}
#endif
if (currentMenu->menuitems[thisitem].alphaKey == 0)
{
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_CACHE));
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISTOGL", PU_CACHE));
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_PATCH));
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISTOGL", PU_PATCH));
continue;
}
@@ -13332,18 +13332,18 @@ static void M_DrawMonitorToggles(void)
}
if (cv->value)
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_CACHE));
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_PATCH));
else
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBGD", PU_CACHE));
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBGD", PU_PATCH));
if (drawnum != 0)
{
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISMUL", PU_CACHE));
V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_CACHE));
V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISMUL", PU_PATCH));
V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_PATCH));
V_DrawString(x+24, y+31, V_ALLOWLOWERCASE|translucent, va("x%d", drawnum));
}
else
V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_CACHE));
V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_PATCH));
y += spacing;
}
@@ -13356,7 +13356,7 @@ static void M_DrawMonitorToggles(void)
#ifdef ITEMTOGGLEBOTTOMRIGHT
if (currentMenu->menuitems[itemOn].alphaKey == 255)
{
V_DrawScaledPatch(onx-1, ony-2, V_TRANSLUCENT, W_CachePatchName("K_ITBG", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, V_TRANSLUCENT, W_CachePatchName("K_ITBG", PU_PATCH));
if (shitsfree)
{
INT32 trans = V_TRANSLUCENT;
@@ -13364,15 +13364,15 @@ static void M_DrawMonitorToggles(void)
trans = ((10-TICRATE)+shitsfree-1)<<V_ALPHASHIFT;
else if (shitsfree < 5)
trans = (10-shitsfree)<<V_ALPHASHIFT;
V_DrawScaledPatch(onx-1, ony-2, trans, W_CachePatchName("K_ITFREE", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, trans, W_CachePatchName("K_ITFREE", PU_PATCH));
}
}
else
#endif
if (currentMenu->menuitems[itemOn].alphaKey == 0)
{
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITTOGL", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_PATCH));
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITTOGL", PU_PATCH));
}
else
{
@@ -13397,19 +13397,19 @@ static void M_DrawMonitorToggles(void)
}
if (cv->value)
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_PATCH));
else
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBGD", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBGD", PU_PATCH));
if (drawnum != 0)
{
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITMUL", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_CACHE));
V_DrawScaledPatch(onx+27, ony+39, translucent, W_CachePatchName("K_ITX", PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITMUL", PU_PATCH));
V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_PATCH));
V_DrawScaledPatch(onx+27, ony+39, translucent, W_CachePatchName("K_ITX", PU_PATCH));
V_DrawKartString(onx+37, ony+34, translucent, va("%d", drawnum));
}
else
V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_CACHE));
V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_PATCH));
}
}
@@ -13571,7 +13571,7 @@ void M_QuitResponse(INT32 ch)
while (ptime > I_GetTime())
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
V_DrawSmallScaledPatch(0, 0, 0, W_CachePatchName("GAMEQUIT", PU_CACHE)); // Demo 3 Quit Screen Tails 06-16-2001
V_DrawSmallScaledPatch(0, 0, 0, W_CachePatchName("GAMEQUIT", PU_PATCH)); // Demo 3 Quit Screen Tails 06-16-2001
I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
@@ -13641,12 +13641,12 @@ static void M_DrawSticker(INT32 x, INT32 y, INT32 width, INT32 flags, boolean is
if (isSmall == true)
{
stickerEnd = W_CachePatchName("K_STIKE2", PU_CACHE);
stickerEnd = W_CachePatchName("K_STIKE2", PU_PATCH);
height = 6;
}
else
{
stickerEnd = W_CachePatchName("K_STIKEN", PU_CACHE);
stickerEnd = W_CachePatchName("K_STIKEN", PU_PATCH);
height = 11;
}
@@ -13676,12 +13676,12 @@ static void M_DrawDiscordRequests(void)
if (confirmAccept == true)
{
colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREEN, GTC_MENUCACHE);
hand = W_CachePatchName("K_LAPH02", PU_CACHE);
hand = W_CachePatchName("K_LAPH02", PU_PATCH);
}
else
{
colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_RED, GTC_MENUCACHE);
hand = W_CachePatchName("K_LAPH03", PU_CACHE);
hand = W_CachePatchName("K_LAPH03", PU_PATCH);
}
slide = confirmLength - confirmDelay;
@@ -13696,7 +13696,7 @@ static void M_DrawDiscordRequests(void)
colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_MENUCACHE);
}
V_DrawFixedPatch(56*FRACUNIT, 150*FRACUNIT, FRACUNIT, 0, W_CachePatchName("K_LAPE01", PU_CACHE), colormap);
V_DrawFixedPatch(56*FRACUNIT, 150*FRACUNIT, FRACUNIT, 0, W_CachePatchName("K_LAPE01", PU_PATCH), colormap);
if (hand != NULL)
{
+5 -1
View File
@@ -3056,6 +3056,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
HWR_ClearLightTables();
#endif
Patch_FreeTag(PU_PATCH_LOWPRIORITY);
//Patch_FreeTag(PU_PATCH_ROTATED); // we keep those ty!
Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1);
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
@@ -3347,6 +3349,8 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
//
// search for sprite replacements
//
Patch_FreeTag(PU_SPRITE);
Patch_FreeTag(PU_PATCH_ROTATED);
R_AddSpriteDefs(wadnum);
// Reload it all anyway, just in case they
@@ -3461,7 +3465,7 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
if (partadd_stage == 0)
{
// Flush and reload HUD graphics
ST_UnloadGraphics();
//ST_UnloadGraphics();
HU_LoadGraphics();
ST_LoadGraphics();
ST_ReloadSkinFaceGraphics();
+7 -2
View File
@@ -393,7 +393,12 @@ static UINT8 *R_GenerateTexture(size_t texnum)
// Composite the columns together.
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{
realpatch = (softwarepatch_t *)W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
// If this patch has already been loaded, we just use it from the cache.
realpatch = (softwarepatch_t *)W_GetCachedPatchNumPwad(patch->wad, patch->lump);
// Otherwise, we load it here.
if (realpatch == NULL)
realpatch = (softwarepatch_t *)W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
// Well, it's not valid...
if (realpatch == NULL)
@@ -1834,7 +1839,7 @@ static void R_PrecacheLevelSprites(void)
lump = sf->lumppat[a];\
if (devparm)\
spritememory += W_LumpLength(lump);\
W_CachePatchNum(lump, PU_CACHE);\
W_CachePatchNum(lump, PU_SPRITE);\
}
// see R_InitSprites for more about lumppat,lumpid
switch (sf->rotate)
+29 -10
View File
@@ -375,7 +375,7 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
// Frees a patch from memory.
//
void Patch_Free(patch_t *patch)
static void Patch_FreeData(patch_t *patch)
{
#ifdef HWRENDER
if (patch->hardware)
@@ -403,10 +403,30 @@ void Patch_Free(patch_t *patch)
Z_Free(patch->columnofs);
if (patch->columns)
Z_Free(patch->columns);
}
void Patch_Free(patch_t *patch)
{
Patch_FreeData(patch);
Z_Free(patch);
}
//
// Frees patches with a tag range.
//
static boolean Patch_FreeTagsCallback(void *mem)
{
patch_t *patch = (patch_t *)mem;
Patch_FreeData(patch);
return true;
}
void Patch_FreeTags(INT32 lowtag, INT32 hightag)
{
Z_IterateTags(lowtag, hightag, Patch_FreeTagsCallback);
}
#ifdef HWRENDER
//
// Allocates a hardware patch.
@@ -416,8 +436,8 @@ void *Patch_AllocateHardwarePatch(patch_t *patch)
{
if (!patch->hardware)
{
GLPatch_t *grPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, &patch->hardware);
grPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, &grPatch->mipmap);
GLPatch_t *glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, &patch->hardware);
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, &glPatch->mipmap);
}
return (void *)(patch->hardware);
}
@@ -428,10 +448,10 @@ void *Patch_AllocateHardwarePatch(patch_t *patch)
void *Patch_CreateGL(patch_t *patch)
{
GLPatch_t *grPatch = (GLPatch_t *)Patch_AllocateHardwarePatch(patch);
if (!grPatch->mipmap->data) // Run HWR_MakePatch in all cases, to recalculate some things
HWR_MakePatch(patch, grPatch, grPatch->mipmap, false);
return grPatch;
GLPatch_t *glPatch = (GLPatch_t *)Patch_AllocateHardwarePatch(patch);
if (!glPatch->mipmap->data) // Run HWR_MakePatch in all cases, to recalculate some things
HWR_MakePatch(patch, glPatch, glPatch->mipmap, false);
return glPatch;
}
#endif // HWRENDER
@@ -657,8 +677,7 @@ patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spri
if (lump == LUMPERROR)
return NULL;
patch = W_CachePatchNum(lump, PU_CACHE); // PU_SPRITE
//patch = W_CachePatchNum(lump, PU_SPRITE);
patch = W_CachePatchNum(lump, PU_SPRITE);
if (sprinfo->available)
{
@@ -837,7 +856,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
// make patch
rotated = (patch_t *)R_MaskedFlatToPatch(rawconv, width, height, 0, 0, &size);
//Z_ChangeTag(rotated, PU_LEVEL);
Z_ChangeTag(rotated, PU_PATCH_ROTATED);
Z_SetUser(rotated, (void **)(&rotsprite->patches[idx]));
Z_Free(rawconv);
+3
View File
@@ -42,6 +42,9 @@ typedef struct
patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest);
void Patch_Free(patch_t *patch);
#define Patch_FreeTag(tagnum) Patch_FreeTags(tagnum, tagnum)
void Patch_FreeTags(INT32 lowtag, INT32 hightag);
#ifdef HWRENDER
void *Patch_AllocateHardwarePatch(patch_t *patch);
void *Patch_CreateGL(patch_t *patch);
+1 -1
View File
@@ -171,7 +171,7 @@ static void R_DrawWallSplats(void)
mfloorclip = floorclip;
mceilingclip = ceilingclip;
patch = W_CachePatchNum(splat->patch, PU_CACHE);
patch = W_CachePatchNum(splat->patch, PU_SPRITE);
dc_texturemid = splat->top + (patch->height<<(FRACBITS-1)) - viewz;
if (splat->yoffset)
+1 -1
View File
@@ -142,7 +142,7 @@ void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, f
splat->flags = flags;
// bad.. but will be needed for drawing anyway..
patch = W_CachePatchNum(splat->patch, PU_CACHE);
patch = W_CachePatchNum(splat->patch, PU_SPRITE); // idk?
// offset needed by draw code for texture mapping
linelength = P_SegLength((seg_t *)wallline);
+2 -2
View File
@@ -1800,7 +1800,7 @@ static void R_ProjectSprite(mobj_t *thing)
vis->patch = rotsprite;
else
#endif
vis->patch = W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE);
vis->patch = W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE);
vis->precip = false;
@@ -1985,7 +1985,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
//Fab: lumppat is the lump number of the patch to use, this is different
// than lumpid for sprites-in-pwad : the graphics are patched
vis->patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
vis->patch = W_CachePatchNum(sprframe->lumppat[0], PU_SPRITE);
// specific translucency
if ((thing->blendmode != AST_COPY) && cv_translucency.value)
+5 -5
View File
@@ -211,7 +211,7 @@ void ST_doPaletteStuff(void)
void ST_UnloadGraphics(void)
{
Z_FreeTags(PU_HUDGFX, PU_HUDGFX);
Patch_FreeTag(PU_HUDGFX);
}
void ST_LoadGraphics(void)
@@ -249,7 +249,7 @@ void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skin
facerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
facewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
facemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
/*facerankprefix_name[skinnum] = rankstr;
facewantprefix_name[skinnum] = wantstr;
facemmapprefix_name[skinnum] = mmapstr;*/
@@ -260,7 +260,7 @@ void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32
localfacerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
localfacewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
localfacemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
/*localfacerankprefix_name[skinnum] = rankstr;
localfacewantprefix_name[skinnum] = wantstr;
localfacemmapprefix_name[skinnum] = mmapstr;*/
@@ -276,7 +276,7 @@ void ST_ReloadSkinFaceGraphics(void)
for (i = 0; i < numskins; i++)
ST_LoadFaceGraphics(skins[i].facerank, skins[i].facewant, skins[i].facemmap, i);
for (i = 0; i < numlocalskins; i++)
ST_LoadLocalFaceGraphics(localskins[i].facerank, localskins[i].facewant, localskins[i].facemmap, i);
}
@@ -432,7 +432,7 @@ static void ST_drawLevelTitle(void)
? BASEVIDHEIGHT/2
: 163;
INT32 lvlw;
if (!cv_stagetitle.value)
return;
+2 -2
View File
@@ -999,11 +999,11 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor)
{
if (skinnum < 0 || skinnum >= numskins || (skins[skinnum].flags & SF_HIRES))
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); // Draw a star
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_PATCH)); // Draw a star
else
{ // Find front angle of the first waiting frame of the character's actual sprites
spriteframe_t *sprframe = &skins[skinnum].spritedef.spriteframes[2 & FF_FRAMEMASK];
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);
// No variant for translucency
+12 -4
View File
@@ -1799,6 +1799,14 @@ void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag)
return W_CachePatchNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum),tag);
}
void *W_GetCachedPatchNumPwad(UINT16 wad, UINT16 lump)
{
if (!TestValidLump(wad, lump))
return NULL;
return wadfiles[wad]->patchcache[lump];
}
#ifdef ROTSPRITE
// Caches a rotsprite for patch rotation.
void *W_GetCachedRotPatchPwad(UINT16 wadnum, UINT16 lumpnum)
@@ -1828,7 +1836,7 @@ void W_UnlockCachedPatch(void *patch)
HWR_UnlockCachedPatch((GLPatch_t *)((patch_t *)patch)->hardware);
else
#endif
Z_ChangeTag(patch, PU_LEVEL);
Z_ChangeTag(patch, PU_PATCH);
}
void *W_CachePatchName(const char *name, INT32 tag)
@@ -1870,13 +1878,13 @@ void *W_CachePatchNameRotated(const char *name, INT32 rotationangle, INT32 tag)
{
INT32 xpivot = 0, ypivot = 0;
ptr = W_CachePatchNum(num, PU_STATIC); // PU_PATCH
ptr = W_CachePatchNum(num, PU_PATCH);
// >y pivot centered
// >x pivot not centered
// Why?
xpivot = SHORT(ptr->width) / 2;
ypivot = SHORT(ptr->height) / 2;
xpivot = ptr->width / 2;
ypivot = ptr->height / 2;
RotatedPatch_DoRotation(rspr, ptr, rotationangle, xpivot, ypivot, false);
}
+2
View File
@@ -216,6 +216,8 @@ void *W_CachePatchName(const char *name, INT32 tag);
void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag);
void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag);
void *W_GetCachedPatchNumPwad(UINT16 wad, UINT16 lump);
// Returns a Software patch.
void *W_CacheSoftwarePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag);
void *W_CacheSoftwarePatchNum(lumpnum_t lumpnum, INT32 tag);
+15 -15
View File
@@ -420,7 +420,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
if (pnum == whiteplayer)
{
UINT8 cursorframe = (intertic / 4) % 8;
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE));
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
}
STRBUFCPY(strtime, standings->name[i]);
@@ -856,7 +856,7 @@ void Y_StartIntermission(void)
break;
}
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
LUA_HUD_DestroyDrawList(luahuddrawlist_intermission);
luahuddrawlist_intermission = LUA_HUD_CreateDrawList();
@@ -922,7 +922,7 @@ static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch)
if (currentAnimFrame > tempFoundAnimVoteFrames - 1)
currentAnimFrame = 0;
patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_CACHE);
patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_PATCH);
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (background->width/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
(vid.height / vid.dupy) - background->height,
V_SNAPTOTOP|V_SNAPTOLEFT, background);
@@ -1187,7 +1187,7 @@ void Y_VoteDrawer(void)
if (!splitscreen && i == consoleplayer)
{
UINT8 cursorframe = (votetic / 4) % 8;
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE));
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
}
}
@@ -1466,15 +1466,15 @@ void Y_StartVote(void)
Y_AnimatedVoteScreenCheck();
widebgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCW" : "INTERSCW"), PU_STATIC);
bgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCR" : "INTERSCR"), PU_STATIC);
cursor = W_CachePatchName("M_CURSOR", PU_STATIC);
cursor1 = W_CachePatchName("P1CURSOR", PU_STATIC);
cursor2 = W_CachePatchName("P2CURSOR", PU_STATIC);
cursor3 = W_CachePatchName("P3CURSOR", PU_STATIC);
cursor4 = W_CachePatchName("P4CURSOR", PU_STATIC);
randomlvl = W_CachePatchName("RANDOMLV", PU_STATIC);
rubyicon = W_CachePatchName("RUBYICON", PU_STATIC);
widebgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCW" : "INTERSCW"), PU_PATCH);
bgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCR" : "INTERSCR"), PU_PATCH);
cursor = W_CachePatchName("M_CURSOR", PU_PATCH);
cursor1 = W_CachePatchName("P1CURSOR", PU_PATCH);
cursor2 = W_CachePatchName("P2CURSOR", PU_PATCH);
cursor3 = W_CachePatchName("P3CURSOR", PU_PATCH);
cursor4 = W_CachePatchName("P4CURSOR", PU_PATCH);
randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH);
rubyicon = W_CachePatchName("RUBYICON", PU_PATCH);
timer = cv_votetime.value*TICRATE;
pickedvote = -1;
@@ -1542,9 +1542,9 @@ void Y_StartVote(void)
// set up the pic
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
if (lumpnum != LUMPERROR)
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_STATIC);
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
else
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_STATIC);
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH);
}
voteclient.loaded = true;
+18 -13
View File
@@ -656,24 +656,29 @@ static void Command_Memfree_f(void)
Z_CheckHeap(-1);
CONS_Printf("\x82%s", M_GetText("Memory Info\n"));
CONS_Printf(M_GetText("Total heap used : %7s KB\n"), sizeu1(Z_TagsUsage(0, INT32_MAX)>>10));
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
CONS_Printf(M_GetText("Lua : %7s KB\n"), sizeu1(Z_TagUsage(PU_LUA)>>10));
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
CONS_Printf(M_GetText("All purgable : %7s KB\n"),
CONS_Printf(M_GetText("Total heap used : %7s KB\n"), sizeu1(Z_TagsUsage(0, INT32_MAX)>>10));
CONS_Printf(M_GetText("Static : %7s KB\n"), sizeu1(Z_TagUsage(PU_STATIC)>>10));
CONS_Printf(M_GetText("Lua : %7s KB\n"), sizeu1(Z_TagUsage(PU_LUA)>>10));
CONS_Printf(M_GetText("Static (sound) : %7s KB\n"), sizeu1(Z_TagUsage(PU_SOUND)>>10));
CONS_Printf(M_GetText("Static (music) : %7s KB\n"), sizeu1(Z_TagUsage(PU_MUSIC)>>10));
CONS_Printf(M_GetText("Patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_PATCH)>>10));
CONS_Printf(M_GetText("Patches (low priority) : %7s KB\n"), sizeu1(Z_TagUsage(PU_PATCH_LOWPRIORITY)>>10));
CONS_Printf(M_GetText("Patches (rotated) : %7s KB\n"), sizeu1(Z_TagUsage(PU_PATCH_ROTATED)>>10));
CONS_Printf(M_GetText("Sprites : %7s KB\n"), sizeu1(Z_TagUsage(PU_SPRITE)>>10));
CONS_Printf(M_GetText("HUD graphics : %7s KB\n"), sizeu1(Z_TagUsage(PU_HUDGFX)>>10));
CONS_Printf(M_GetText("Locked cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_CACHE)>>10));
CONS_Printf(M_GetText("Level : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVEL)>>10));
CONS_Printf(M_GetText("Special thinker : %7s KB\n"), sizeu1(Z_TagUsage(PU_LEVSPEC)>>10));
CONS_Printf(M_GetText("All purgable : %7s KB\n"),
sizeu1(Z_TagsUsage(PU_PURGELEVEL, INT32_MAX)>>10));
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none)
{
CONS_Printf(M_GetText("Patch info headers: %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
CONS_Printf(M_GetText("Patch info headers : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10));
CONS_Printf(M_GetText("Cached textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
CONS_Printf(M_GetText("Texture colormaps : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
CONS_Printf(M_GetText("All GPU textures : %7d KB\n"), HWR_GetTextureUsed()>>10);
}
#endif
+6 -1
View File
@@ -44,7 +44,12 @@ enum
PU_SOUND = 11, // static while playing
PU_MUSIC = 12, // static while playing
PU_HUDGFX = 13, // static until WAD added
PU_PATCH = 13, // static entire execution time
PU_PATCH_LOWPRIORITY = 14, // lower priority patch, static until level exited
PU_PATCH_ROTATED = 15, // rotated patch, static until level exited or WAD added
PU_SPRITE = 16, // sprite patch, static until WAD added
PU_HUDGFX = 17, // HUD patch, static until WAD added
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch