diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 801442b6f..c861bba71 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -129,7 +129,6 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt } } - static int comparePolygons(const void *p1, const void *p2) { const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1; @@ -378,8 +377,8 @@ void HWR_RenderBatches(void) currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba || currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level || - currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start || - currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end || + currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start || + currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end || currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional) { changeState = true; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0e0658567..906ac9161 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5570,8 +5570,6 @@ static void HWR_RenderFrame(player_t *player, boolean skybox) // Clear view, set viewport (glViewport), set perspective... HWR_ClearView(); - ST_doPaletteStuff(); - // Draw the sky background. HWR_DrawSkyBackground(); if (skybox) @@ -5728,6 +5726,7 @@ void HWR_LoadLevel(boolean reloadinggamestate) static void HWR_TogglePaletteRendering(void) { V_ResetPaletteCVars(); // dont carry over changed palettes + ST_ResetPaletteStuff(); // which state should we go to? if (HWR_ShouldUsePaletteRendering()) diff --git a/src/st_stuff.c b/src/st_stuff.c index 4f5401aae..7e4dd8840 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -167,48 +167,50 @@ boolean ST_SameTeam(player_t *a, player_t *b) static boolean st_stopped = true; -void ST_Ticker(void) -{ - if (st_stopped) - return; -} - // 0 is default, any others are special palettes. INT32 st_palette = 0; -void ST_doPaletteStuff(void) +void ST_ResetPaletteStuff(void) { - INT32 palette; + st_palette = 0; + V_SetPalette(0); +} - if (stplyr && stplyr->flashcount) - palette = stplyr->flashpal; - else - palette = 0; +static void ST_doPaletteStuff(void) +{ + INT32 palette = 0; #ifdef HWRENDER if (rendermode == render_opengl && !HWR_PalRenderFlashpal()) - palette = 0; // Don't set the palette to a flashpal in OpenGL's truecolor mode + return; #endif - palette = min(max(palette, 0), 13); + if (stplyr && stplyr->flashcount) + palette = CLAMP(stplyr->flashpal, 0, 13); if (palette != st_palette) { st_palette = palette; -#ifdef HWRENDER - if (rendermode == render_soft || (rendermode == render_opengl && HWR_PalRenderFlashpal())) -#else - if (rendermode != render_none) -#endif + if (!splitscreen) { - //V_SetPaletteLump(GetPalette()); // Reset the palette -- is this needed? - if (!splitscreen) - V_SetPalette(palette); + V_SetPalette(palette); } } } +void ST_Ticker(void) +{ + if (st_stopped) + return; + + // Do red-/gold-shifts from damage/items + //25/08/99: Hurdler: palette changes is done for all players, + // not only player1! That's why this part + // of code is moved somewhere else. + ST_doPaletteStuff(); +} + void ST_UnloadGraphics(void) { Patch_FreeTag(PU_HUDGFX); @@ -306,9 +308,7 @@ static inline void ST_Stop(void) void ST_Start(void) { - if (!st_stopped) - ST_Stop(); - + ST_Stop(); ST_InitData(); if (!dedicated) @@ -757,15 +757,6 @@ void ST_Drawer(void) if (vid.recalc) st_palette = -1; - // Do red-/gold-shifts from damage/items -#ifdef HWRENDER - //25/08/99: Hurdler: palette changes is done for all players, - // not only player1! That's why this part - // of code is moved somewhere else. - if (rendermode == render_soft || (rendermode == render_opengl && HWR_PalRenderFlashpal())) -#endif - if (rendermode != render_none) ST_doPaletteStuff(); - if (st_overlay) { if (renderisnewtic) diff --git a/src/st_stuff.h b/src/st_stuff.h index 54d2483ee..d0ed92b1a 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -28,6 +28,8 @@ extern tic_t directortoggletimer; // Called by main loop. void ST_Ticker(void); +void ST_ResetPaletteStuff(void); + // Called when naming a replay. void ST_DrawDemoTitleEntry(void); @@ -56,8 +58,6 @@ void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 play void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum); void ST_ReloadSkinFaceGraphics(void); -void ST_doPaletteStuff(void); - // return if player a is in the same team as player b boolean ST_SameTeam(player_t *a, player_t *b);