more cleanup
This commit is contained in:
1 parent
7476dea308
commit
38c9cbc15b
7 files changed
+36
-28
No files matched your search
+10
-9
@@ -400,12 +400,12 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
|
||||
// Free the old colormap from memory.
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
// free references to the textures
|
||||
@@ -421,6 +421,12 @@ void HWR_FreeTextureCache(void)
|
||||
// free all patch colormaps after each level: must be done after ClearMipMapCache!
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
M_AATreeIterate(wadfiles[i]->hwrcache, FreeMipmapColormap);
|
||||
}
|
||||
|
||||
void HWR_FreeTextureCache(void)
|
||||
{
|
||||
// free references to the textures
|
||||
HWR_FreeMipmapCache();
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
@@ -430,20 +436,15 @@ void HWR_FreeTextureCache(void)
|
||||
gr_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_PrepLevelCache(size_t pnumtextures)
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
{
|
||||
// problem: the mipmap cache management hold a list of mipmaps.. but they are
|
||||
// reallocated on each level..
|
||||
//sub-optimal, but 1) just need re-download stuff in hardware cache VERY fast
|
||||
// 2) sprite/menu stuff mixed with level textures so can't do anything else
|
||||
|
||||
// we must free it since numtextures changed
|
||||
HWR_FreeTextureCache();
|
||||
|
||||
gr_numtextures = pnumtextures;
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
||||
if (gr_textures == NULL)
|
||||
I_Error("HWR_PrepLevelCache: can't alloc gr_textures");
|
||||
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -57,6 +57,7 @@ extern size_t addsubsector;
|
||||
// --------
|
||||
void HWR_InitTextureCache(void);
|
||||
void HWR_FreeTextureCache(void);
|
||||
void HWR_FreeMipmapCache(void);
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
|
||||
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
|
||||
|
||||
@@ -6441,6 +6441,7 @@ void HWR_Shutdown(void)
|
||||
{
|
||||
CONS_Printf("HWR_Shutdown()\n");
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreeMipmapCache();
|
||||
HWR_FreeTextureCache();
|
||||
HWD.pfnFlushScreenTextures();
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
extern boolean gr_maphasportals;
|
||||
|
||||
// hw_cache.c
|
||||
void HWR_PrepLevelCache(size_t pnumtextures);
|
||||
void HWR_LoadTextures(size_t pnumtextures);
|
||||
RGBA_t *HWR_GetTexturePalette(void);
|
||||
|
||||
// hw_trick.c
|
||||
|
||||
+15
-18
@@ -3145,16 +3145,8 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
// Correct missing sidedefs & deep water trick
|
||||
HWR_CorrectSWTricks();
|
||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering()) //unsure if this is the right place, but seems to work since we dont have HWR_LoadLevel like srb2
|
||||
HWR_SetMapPalette();
|
||||
}
|
||||
|
||||
if (rendermode == render_opengl)
|
||||
HWR_LoadLevel();
|
||||
#endif
|
||||
|
||||
// oh god I hope this helps
|
||||
@@ -3361,14 +3353,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
// clear special respawning que
|
||||
iquehead = iquetail = 0;
|
||||
|
||||
// preload graphics
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
HWR_PrepLevelCache(numtextures);
|
||||
}
|
||||
#endif
|
||||
|
||||
P_MapEnd();
|
||||
|
||||
// Remove the loading shit from the screen
|
||||
@@ -3426,6 +3410,19 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
void HWR_LoadLevel(void)
|
||||
{
|
||||
HWR_FreeMipmapCache();
|
||||
// Correct missing sidedefs & deep water trick
|
||||
HWR_CorrectSWTricks();
|
||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
HWR_SetMapPalette();
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// P_RunSOC
|
||||
//
|
||||
|
||||
@@ -60,6 +60,9 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
#ifdef HWRENDER
|
||||
void HWR_LoadLevel(void);
|
||||
#endif
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||
boolean P_AddWadFileLocal(const char *wadfilename);
|
||||
#ifdef DELFILE
|
||||
|
||||
@@ -533,6 +533,11 @@ void R_LoadTextures(void)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_LoadTextures(numtextures);
|
||||
#endif
|
||||
}
|
||||
|
||||
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
||||
|
||||
Reference in new issue
Block a user