diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b7ece1f81..75a62f596 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5721,6 +5721,8 @@ void HWR_LoadLevel(void) // shader recompilation is done in the cvar callback static void HWR_TogglePaletteRendering(void) { + V_ResetPaletteCVars(); // dont carry over changed palettes + // which state should we go to? if (HWR_ShouldUsePaletteRendering()) { diff --git a/src/p_setup.c b/src/p_setup.c index 32f77658d..2582261e9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3018,7 +3018,10 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) // Reset the palette now all fades have been done if (rendermode != render_none) + { + //V_ResetPaletteCVars(); // dont carry over changed palettes V_SetPaletteLump(GetPalette()); // Set the level palette + } // Print "SPEEDING OFF TO [ZONE] [ACT 1]..." /*if (rendermode != render_none) diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 73f6635e3..d6805cf21 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -134,7 +134,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) if (!first_init) { - if (!gllogstream) + if (!gllogstream) { gllogdir = D_Home(); @@ -147,7 +147,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) gllogstream = fopen("./ogllog.txt", "wt"); #endif } - + gl_version = pglGetString(GL_VERSION); gl_renderer = pglGetString(GL_RENDERER); gl_extensions = pglGetString(GL_EXTENSIONS); @@ -220,7 +220,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) } SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); - + // The screen textures need to be flushed if the width or height change so that they be remade for the correct size if (screen_width != w || screen_height != h) { @@ -310,7 +310,7 @@ void OglSdlFinishUpdate(boolean waitvbl) #if defined (__unix__) #ifdef USE_FBO_OGL - if (loaded_config == true) + if (loaded_config) xwaylandcrap = false; #endif #endif diff --git a/src/v_video.c b/src/v_video.c index 2552244c4..34bc9f296 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -139,7 +139,7 @@ static boolean InitCube(void) float globalgammamul, globalgammaoffs; boolean doinggamma; - if (loaded_config == false) + if (!loaded_config) return false; #define diffcons(cv) (strcmp(cv.string, cv.defaultvalue)) @@ -586,7 +586,7 @@ void V_SetPaletteLump(const char *pal) static void CV_palette_OnChange(void) { - if (loaded_config == false) + if (!loaded_config) return; // reload palette // recalculate Color Cube @@ -594,6 +594,19 @@ static void CV_palette_OnChange(void) V_SetPalette(0); } +void V_ResetPaletteCVars(void) +{ + if (!loaded_config) + return; + +#define diffcons(cv) (strcmp(cv.string, cv.defaultvalue)) + if diffcons(cv_palette) + CV_StealthSetValue(&cv_palette, atoi(cv_palette.defaultvalue)); + if diffcons(cv_palettenum) + CV_StealthSetValue(&cv_palettenum, atoi(cv_palettenum.defaultvalue)); +#undef diffcons +} + static void CV_constextsize_OnChange(void) { con_recalc = true; diff --git a/src/v_video.h b/src/v_video.h index c8eca1069..c8f614afc 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -60,6 +60,8 @@ void V_SetPalette(INT32 palettenum); void V_SetPaletteLump(const char *pal); +void V_ResetPaletteCVars(void); + const char *R_GetPalname(UINT16 num); const char *GetPalette(void);