diff --git a/src/p_setup.c b/src/p_setup.c index fa2960ad9..2fd8b84af 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1435,7 +1435,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]); @@ -1476,7 +1476,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]); @@ -3039,6 +3039,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 0971bd5e3..0de389a73 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 @@ -1360,11 +1359,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) @@ -1545,13 +1539,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 @@ -1631,7 +1625,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) } } } - + return (INT32)mapnum; }