diff --git a/src/p_setup.c b/src/p_setup.c index 2400bc2e0..e6e46edd6 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1444,7 +1444,7 @@ static void P_LoadRawSideDefs2(void *data) // encore mode colormaps! // do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code. // do this for both the start and fade colormaps. - + color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); @@ -1485,7 +1485,7 @@ static void P_LoadRawSideDefs2(void *data) col = msd->bottomtexture; // do the exact same thing as above here. - + color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); @@ -3047,6 +3047,11 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) // Clear pointers that would be left dangling by the purge R_FlushTranslationColormapCache(); +#ifdef HWRENDER + // Delete light table textures + HWR_ClearLightTables(); +#endif + Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1); #if defined (WALLSPLATS) || defined (FLOORSPLATS) diff --git a/src/r_data.c b/src/r_data.c index ddac60598..6b4bef3d0 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -28,7 +28,6 @@ #ifdef HWRENDER #include "hardware/hw_main.h" -#include "hardware/hw_glob.h" // HWR_ClearLightTables #endif #ifdef _WIN32 @@ -1266,11 +1265,6 @@ void R_ClearColormaps(void) foundcolormaps[i] = LUMPERROR; memset(extra_colormaps, 0, sizeof (extra_colormaps)); - -#ifdef HWRENDER - if (rendermode == render_opengl) - HWR_ClearLightTables(); -#endif } /*INT32 R_ColormapNumForName(char *name) @@ -1451,13 +1445,13 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) extra_colormaps[mapnum].fadestart = (UINT16)fadestart; extra_colormaps[mapnum].fadeend = (UINT16)fadeend; extra_colormaps[mapnum].fog = fog; - + if (rendermode != render_none) - { + { double r, g, b, cbrightness; int p; lighttable_t *colormap_p; - + // Initialise the map and delta arrays // map[i] stores an RGB color (as double) for index i, // which is then converted to SRB2's palette later @@ -1537,7 +1531,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) } } } - + return (INT32)mapnum; }