mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Catch all unconditional cv_playercolor[] visuals
Resolves #704 Now converts to skin prefcolor in: - Player menu party - Challenges menu - Why it's done on this branch - want to avoid merge conflicts - Gamepad indicator - Actually fixes a bug at the same time for skins with nonstandard startcolors
This commit is contained in:
parent
1ce41bdfb4
commit
3e901b312c
4 changed files with 58 additions and 43 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "i_joy.h" // JOYAXISRANGE
|
||||
#include "r_draw.h" // GTC_ macros for assigning gamepad indicator colors
|
||||
#include "v_video.h" // V_GetColor for assigning gamepad indictaor colors
|
||||
#include "r_skins.h" // skins[].prefcolor for assigning gamepad indicator colors
|
||||
#include "z_zone.h"
|
||||
|
||||
// current state of the keys
|
||||
|
|
@ -206,7 +207,6 @@ void G_SetDeviceForPlayer(INT32 player, INT32 device)
|
|||
void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player)
|
||||
{
|
||||
INT32 device;
|
||||
INT32 skin;
|
||||
UINT16 skincolor;
|
||||
UINT8 *colormap;
|
||||
byteColor_t byte_color;
|
||||
|
|
@ -220,15 +220,24 @@ void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player)
|
|||
return;
|
||||
}
|
||||
|
||||
skin = cv_skin[player].value;
|
||||
skincolor = cv_playercolor[player].value;
|
||||
colormap = R_GetTranslationColormap(skin, skincolor, GTC_MENUCACHE);
|
||||
if (skincolor == SKINCOLOR_NONE)
|
||||
{
|
||||
INT32 skin = cv_skin[player].value;
|
||||
if (skin == -1)
|
||||
skin = 0;
|
||||
skincolor = skins[skin].prefcolor;
|
||||
}
|
||||
|
||||
// We use TC_DEFAULT here rather than player skin because...
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, skincolor, GTC_MENUCACHE);
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ...we're grabbing the same index as a reference point across remaps!
|
||||
byte_color = V_GetColor(colormap[104]).s;
|
||||
|
||||
I_SetGamepadIndicatorColor(device, byte_color.red, byte_color.green, byte_color.blue);
|
||||
|
|
|
|||
|
|
@ -1142,6 +1142,9 @@ void M_HandleImageDef(INT32 choice);
|
|||
#define recommendedflags V_GREENMAP
|
||||
#define warningflags V_GRAYMAP
|
||||
|
||||
// For some menu highlights
|
||||
UINT16 M_GetCvPlayerColor(UINT8 pnum);
|
||||
|
||||
void M_UpdateMenuBGImage(boolean forceReset);
|
||||
void M_DrawMenuBackground(void);
|
||||
void M_DrawMenuForeground(void);
|
||||
|
|
|
|||
|
|
@ -231,6 +231,22 @@ void M_DrawMenuBackground(void)
|
|||
}
|
||||
}
|
||||
|
||||
UINT16 M_GetCvPlayerColor(UINT8 pnum)
|
||||
{
|
||||
if (pnum >= MAXSPLITSCREENPLAYERS)
|
||||
return SKINCOLOR_NONE;
|
||||
|
||||
UINT16 color = cv_playercolor[pnum].value;
|
||||
if (color != SKINCOLOR_NONE)
|
||||
return color;
|
||||
|
||||
INT32 skin = R_SkinAvailable(cv_skin[pnum].string);
|
||||
if (skin == -1)
|
||||
return SKINCOLOR_NONE;
|
||||
|
||||
return skins[skin].prefcolor;
|
||||
}
|
||||
|
||||
static void M_DrawMenuParty(void)
|
||||
{
|
||||
const INT32 PLATTER_WIDTH = 19;
|
||||
|
|
@ -253,6 +269,18 @@ static void M_DrawMenuParty(void)
|
|||
x = 2;
|
||||
y = BASEVIDHEIGHT - small->height - 2;
|
||||
|
||||
// Despite the work put into it, can't use M_GetCvPlayerColor directly - we need to reference skin always.
|
||||
#define grab_skin_and_colormap(pnum) \
|
||||
{ \
|
||||
skin = R_SkinAvailable(cv_skin[pnum].string); \
|
||||
color = cv_playercolor[pnum].value; \
|
||||
if (skin == -1) \
|
||||
skin = 0; \
|
||||
if (color == SKINCOLOR_NONE) \
|
||||
color = skins[skin].prefcolor; \
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE); \
|
||||
}
|
||||
|
||||
switch (setup_numplayers)
|
||||
{
|
||||
case 1:
|
||||
|
|
@ -260,9 +288,7 @@ static void M_DrawMenuParty(void)
|
|||
x -= 8;
|
||||
V_DrawScaledPatch(x, y, 0, small);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[0].string);
|
||||
color = cv_playercolor[0].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(0);
|
||||
|
||||
V_DrawMappedPatch(x + 22, y + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
break;
|
||||
|
|
@ -273,15 +299,11 @@ static void M_DrawMenuParty(void)
|
|||
V_DrawScaledPatch(x, y, 0, small);
|
||||
V_DrawScaledPatch(x + PLATTER_OFFSET, y - PLATTER_STAGGER, 0, small);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[1].string);
|
||||
color = cv_playercolor[1].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(1);
|
||||
|
||||
V_DrawMappedPatch(x + PLATTER_OFFSET + 22, y - PLATTER_STAGGER + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[0].string);
|
||||
color = cv_playercolor[0].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(0);
|
||||
|
||||
V_DrawMappedPatch(x + 22, y + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
break;
|
||||
|
|
@ -291,21 +313,15 @@ static void M_DrawMenuParty(void)
|
|||
V_DrawScaledPatch(x, y, 0, large);
|
||||
V_DrawScaledPatch(x + PLATTER_OFFSET, y - PLATTER_STAGGER, 0, small);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[1].string);
|
||||
color = cv_playercolor[1].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(1);
|
||||
|
||||
V_DrawMappedPatch(x + PLATTER_OFFSET + 22, y - PLATTER_STAGGER + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[0].string);
|
||||
color = cv_playercolor[0].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(0);
|
||||
|
||||
V_DrawMappedPatch(x + 12, y - 2, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[2].string);
|
||||
color = cv_playercolor[2].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(2);
|
||||
|
||||
V_DrawMappedPatch(x + 22, y + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
break;
|
||||
|
|
@ -315,27 +331,19 @@ static void M_DrawMenuParty(void)
|
|||
V_DrawScaledPatch(x, y, 0, large);
|
||||
V_DrawScaledPatch(x + PLATTER_OFFSET, y - PLATTER_STAGGER, 0, large);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[1].string);
|
||||
color = cv_playercolor[1].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(1);
|
||||
|
||||
V_DrawMappedPatch(x + PLATTER_OFFSET + 12, y - PLATTER_STAGGER - 2, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[0].string);
|
||||
color = cv_playercolor[0].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(0);
|
||||
|
||||
V_DrawMappedPatch(x + 12, y - 2, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[3].string);
|
||||
color = cv_playercolor[3].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(3);
|
||||
|
||||
V_DrawMappedPatch(x + PLATTER_OFFSET + 22, y - PLATTER_STAGGER + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
|
||||
skin = R_SkinAvailable(cv_skin[2].string);
|
||||
color = cv_playercolor[2].value;
|
||||
colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
|
||||
grab_skin_and_colormap(2);
|
||||
|
||||
V_DrawMappedPatch(x + 22, y + 8, 0, faceprefix[skin][FACE_MINIMAP], colormap);
|
||||
break;
|
||||
|
|
@ -346,6 +354,8 @@ static void M_DrawMenuParty(void)
|
|||
}
|
||||
}
|
||||
|
||||
#undef grab_skin_and_color
|
||||
|
||||
x += PLATTER_WIDTH;
|
||||
y += small->height;
|
||||
V_DrawScaledPatch(x + 16, y - 12, 0, W_CachePatchName(va("OPPRNK0%d", setup_numplayers % 10), PU_CACHE));
|
||||
|
|
@ -5476,7 +5486,7 @@ drawborder:
|
|||
buffer[7] = (skullAnimCounter/5) ? '2' : '1';
|
||||
pat = W_CachePatchName(buffer, PU_CACHE);
|
||||
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, cv_playercolor[0].value, GTC_MENUCACHE);
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, M_GetCvPlayerColor(0), GTC_MENUCACHE);
|
||||
|
||||
V_DrawFixedPatch(
|
||||
x*FRACUNIT, y*FRACUNIT,
|
||||
|
|
@ -5877,7 +5887,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
|
|||
}
|
||||
else
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, cv_playercolor[0].value, GTC_MENUCACHE);
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, M_GetCvPlayerColor(0), GTC_MENUCACHE);
|
||||
V_DrawFixedPatch((x+40)<<FRACBITS, ((y+25)<<FRACBITS),
|
||||
FRACUNIT/2, 0,
|
||||
W_CachePatchName("K_LAPE02", PU_CACHE),
|
||||
|
|
|
|||
|
|
@ -559,14 +559,7 @@ void M_ChallengesTick(void)
|
|||
|
||||
if (bombcolor == SKINCOLOR_NONE)
|
||||
{
|
||||
bombcolor = cv_playercolor[0].value;
|
||||
if (bombcolor == SKINCOLOR_NONE)
|
||||
{
|
||||
INT32 psk = R_SkinAvailable(cv_skin[0].string);
|
||||
if (psk == -1)
|
||||
psk = 0;
|
||||
bombcolor = skins[psk].prefcolor;
|
||||
}
|
||||
bombcolor = M_GetCvPlayerColor(0);
|
||||
}
|
||||
|
||||
i = (ref->majorunlock && M_RandomChance(FRACUNIT/2)) ? 1 : 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue