diff --git a/src/deh_tables.c b/src/deh_tables.c index 30e14b67c..f2f819901 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -6254,7 +6254,9 @@ const char *COLOR_ENUMS[] = { "POSNUM_BEST5", "POSNUM_BEST6", - "INTERMISSION", + "INTERMISSION1", + "INTERMISSION2", + "INTERMISSION3", }; const char *const KARTHUD_LIST[] = { @@ -6927,6 +6929,7 @@ struct int_const_s const INT_CONST[] = { {"TC_BLINK",TC_BLINK}, {"TC_DASHMODE",TC_DASHMODE}, {"TC_HITLAG",TC_HITLAG}, + {"TC_INTERMISSION",TC_INTERMISSION}, // marathonmode flags {"MA_INIT",MA_INIT}, diff --git a/src/doomdef.h b/src/doomdef.h index dd5e5d95f..00b4ce048 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -426,8 +426,10 @@ typedef enum SKINCOLOR_POSNUM_BEST4, SKINCOLOR_POSNUM_BEST5, SKINCOLOR_POSNUM_BEST6, - - SKINCOLOR_INTERMISSION, + + SKINCOLOR_INTERMISSION1, + SKINCOLOR_INTERMISSION2, + SKINCOLOR_INTERMISSION3, SKINCOLOR_FIRSTFREESLOT, SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1, diff --git a/src/info.c b/src/info.c index a9ab0f118..1d2e52eff 100644 --- a/src/info.c +++ b/src/info.c @@ -30516,7 +30516,9 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Position Best 5", {152, 152, 153, 153, 154, 154, 155, 155, 156, 156, 157, 158, 159, 253, 254, 30}, SKINCOLOR_NONE, 0, 0, false, UINT16_MAX}, // SKINCOLOR_POSNUM_BEST5 {"Position Best 6", {181, 181, 182, 182, 183, 183, 184, 184, 185, 185, 186, 186, 187, 187, 29, 30}, SKINCOLOR_NONE, 0, 0, false, UINT16_MAX}, // SKINCOLOR_POSNUM_BEST6 - {"Intermission", {0,80,80,81,81,81,84,85,86,87,246,248,251,26,28,31}, SKINCOLOR_NONE, 0, 0, false, UINT16_MAX}, // SKINCOLOR_INTERMISSION + {"Intermission 1", { 0, 80, 80, 80, 81, 81, 81, 84, 84, 85, 86, 86, 87, 87, 246, 248}, SKINCOLOR_NONE, 0, 0, false, UINT16_MAX}, // SKINCOLOR_INTERMISSION1 + {"Intermission 2", { 0, 81, 81, 81, 88, 88, 88, 89, 89, 140, 140, 141, 141, 142, 142, 142}, SKINCOLOR_NONE, 0, 0, false, UINT16_MAX}, // SKINCOLOR_INTERMISSION2 + {"Intermission 3", { 0, 144, 144, 144, 129, 129, 129, 130, 130, 146, 147, 147, 14, 16, 17, 19}, SKINCOLOR_NONE, 0, 0, false, UINT16_MAX}, // SKINCOLOR_INTERMISSION3 }; /** Patches the mobjinfo, state, and skincolor tables. diff --git a/src/k_color.c b/src/k_color.c index 27d597f87..6f4b245ed 100644 --- a/src/k_color.c +++ b/src/k_color.c @@ -153,6 +153,66 @@ void K_HitlagColormap(UINT8 *dest_colormap) } } +/*-------------------------------------------------- + static void K_IntermissionColormap(UINT8 *dest_colormap) + + Turns warm colors tan, and cool colors steel-blue. +--------------------------------------------------*/ +static void K_IntermissionColormap(UINT8 *dest_colormap) +{ + RGBA_t color; + INT32 i; + + // for every colour in the palette, check its + for (i = 0; i < NUM_PALETTE_ENTRIES; i++) + { + color = V_GetColor(i); + + UINT8 lo = min(min(color.s.red, color.s.green), color.s.blue); + UINT8 hi = max(max(color.s.red, color.s.green), color.s.blue); + + double hue = 0.0; + if (lo != hi) + { + if (hi == color.s.red) + { + hue = (color.s.green - color.s.blue) / (hi - lo); + } + else if (hi == color.s.green) + { + hue = 2.0 + (color.s.blue - color.s.red) / (hi - lo); + } + else + { + hue = 4.0 + (color.s.red - color.s.green) / (hi - lo); + } + + if (hue < 0.0) + { + hue += 6.0; + } + } + + UINT16 skincolor = SKINCOLOR_INTERMISSION1; + const double blue_start = 3.0; + const double blue_end = 5.0; + const double green_buffer = 0.5; + if (hue > blue_start && hue < blue_end) + { + skincolor = SKINCOLOR_INTERMISSION3; + } + else if (hue > blue_start - green_buffer && hue < blue_start + green_buffer) + { + skincolor = SKINCOLOR_INTERMISSION2; + } + + INT32 lum = K_ColorRelativeLuminance(color.s.red, color.s.green, color.s.blue); + INT32 skincolor_index = ((255 - lum) * 15) / 255; + + dest_colormap[i] = skincolors[skincolor].ramp[skincolor_index]; + } +} + /*-------------------------------------------------- void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color) @@ -168,6 +228,11 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color) K_HitlagColormap(dest_colormap); return; } + else if (skinnum == TC_INTERMISSION) + { + K_IntermissionColormap(dest_colormap); + return; + } else if (skinnum == TC_BOSS || skinnum == TC_ALLWHITE || skinnum == TC_METALSONIC diff --git a/src/r_draw.c b/src/r_draw.c index 3142388b0..b236e749e 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -151,7 +151,8 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask; #define BLINK_TT_CACHE_INDEX (MAXSKINS + 5) #define DASHMODE_TT_CACHE_INDEX (MAXSKINS + 6) #define HITLAG_TT_CACHE_INDEX (MAXSKINS + 7) -#define TT_CACHE_SIZE (MAXSKINS + 8) +#define INTERMISSION_TT_CACHE_INDEX (MAXSKINS + 8) +#define TT_CACHE_SIZE (MAXSKINS + 9) #define SKIN_RAMP_LENGTH 16 #define DEFAULT_STARTTRANSCOLOR 96 @@ -172,6 +173,7 @@ static INT32 SkinToCacheIndex(INT32 skinnum) case TC_BLINK: return BLINK_TT_CACHE_INDEX; case TC_DASHMODE: return DASHMODE_TT_CACHE_INDEX; case TC_HITLAG: return HITLAG_TT_CACHE_INDEX; + case TC_INTERMISSION: return INTERMISSION_TT_CACHE_INDEX; default: break; } @@ -190,6 +192,7 @@ static INT32 CacheIndexToSkin(INT32 ttc) case BLINK_TT_CACHE_INDEX: return TC_BLINK; case DASHMODE_TT_CACHE_INDEX: return TC_DASHMODE; case HITLAG_TT_CACHE_INDEX: return TC_HITLAG; + case INTERMISSION_TT_CACHE_INDEX: return TC_INTERMISSION; default: break; } diff --git a/src/r_draw.h b/src/r_draw.h index 6b2fa4044..4b4df535c 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -132,6 +132,7 @@ enum TC_BLINK, // For item blinking, according to kart TC_DASHMODE, // For Metal Sonic's dashmode TC_HITLAG, // Damage hitlag effect + TC_INTERMISSION, // Intermission / menu background TC_DEFAULT }; diff --git a/src/y_inter.c b/src/y_inter.c index e0d1008da..022eca163 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1436,26 +1436,14 @@ void Y_IntermissionDrawer(void) // Scrolling marquee patch_t *rrmq = W_CachePatchName("R_RRMQ", PU_PATCH); - // Blending mask for the background - patch_t *mask = W_CachePatchName("R_MASK", PU_PATCH); - fixed_t mqloop = SHORT(rrmq->width)*FRACUNIT; fixed_t chkloop = SHORT(rbgchk->width)*FRACUNIT; - UINT8 *bgcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_INTERMISSION, GTC_CACHE); + UINT8 *bgcolor = R_GetTranslationColormap(TC_INTERMISSION, 0, GTC_CACHE); // Draw the background K_DrawMapThumbnail(0, 0, BASEVIDWIDTH<