do palette stuff in st_ticker

cleanup and dont call it in normal ogl at all unless palette render with flashpals is enabled
inspired by Nyan-Doom/Woof
This commit is contained in:
Alug committed 2025-06-20 09:54:17 +02:00
1 parent 09507d635b
commit 707701f317
4 files changed
+30 -41

No files matched your search

+2 -3
View File
@@ -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;
+1 -2
View File
@@ -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())
+25 -34
View File
@@ -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)
+2 -2
View File
@@ -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);