From b051e142c1ef4333c01a5c801f4a7d4466ba3e70 Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Thu, 17 Jul 2025 19:47:09 +0200 Subject: [PATCH] Apply colormaps directly to sectors in kart maps, fixes Misty Maze + fix encore mapping not applying to fade color (Sunbeam Paradise) --- src/p_setup.c | 2 ++ src/p_spec.c | 4 +++- src/r_data.c | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index f0515c051..9f1400422 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1213,6 +1213,8 @@ static void P_LoadSidedefs(UINT8 *data) // SoM: R_CreateColormap will only create a colormap in software mode... // Perhaps we should just call it instead of doing the calculations here. sd->colormap_data = R_CreateColormapFromLinedef(msd->toptexture, msd->midtexture, msd->bottomtexture); + if (mapnamespace == MNS_SRB2KART) + sd->sector->extra_colormap = sd->sector->spawn_extra_colormap = sd->colormap_data; sd->toptexture = sd->midtexture = sd->bottomtexture = 0; break; diff --git a/src/p_spec.c b/src/p_spec.c index 5fb2c6418..9635baf15 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7784,7 +7784,9 @@ void P_SpawnSpecials(boolean fromnetsave) if (sectors[s].colormap_protected) continue; - if (!udmf) + if (mapnamespace == MNS_SRB2KART) + exc = lines[i].frontsector->extra_colormap; + else if (!udmf) exc = sides[lines[i].sidenum[0]].colormap_data; else { diff --git a/src/r_data.c b/src/r_data.c index 3e668fc45..0e9820e58 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -964,6 +964,14 @@ extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3) cr = pLocalPalette[j].s.red; cg = pLocalPalette[j].s.green; cb = pLocalPalette[j].s.blue; + + if (mapnamespace == MNS_SRB2KART) + { + j = encoremap[NearestColor((UINT8)cfr, (UINT8)cfg, (UINT8)cfb)]; + cfr = pLocalPalette[j].s.red; + cfg = pLocalPalette[j].s.green; + cfb = pLocalPalette[j].s.blue; + } } // Pack rgba values into combined var