Profiles: Fix deficiencies with pre-existing color handling that was exacerbated by this branch

- Do not turn SKINCOLOR_NONE into prefcolor automatically anymore (removed PR_GetProfileColor)
- M_DrawProfileCard:
    - Handle SKINCOLOR_NONE into prefcolor directly
    - Profile Card should not turn NONE-green if skin uses different startcolor for remap
    - Do not attempt to draw Follower if simply not selected for this profile
This commit is contained in:
toaster 2023-04-23 23:23:27 +01:00
parent b30352022b
commit 317c30f7c1
4 changed files with 45 additions and 53 deletions

View file

@ -1704,22 +1704,34 @@ static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
if (p != NULL && p->version)
{
truecol = PR_GetProfileColor(p);
colormap = R_GetTranslationColormap(TC_DEFAULT, truecol, GTC_CACHE);
strcpy(pname, p->profilename);
truecol = p->color;
skinnum = R_SkinAvailable(p->skinname);
strcpy(pname, p->profilename);
}
// check setup_player for colormap for the card.
// we'll need to check again for drawing afterwards unfortunately.
if (sp->mdepth >= CSSTEP_CHARS)
{
truecol = PR_GetProfileColor(p);
colormap = R_GetTranslationColormap(skinnum, sp->color, GTC_MENUCACHE);
truecol = sp->color;
skinnum = setup_chargrid[sp->gridx][sp->gridy].skinlist[sp->clonenum];
}
if (truecol == SKINCOLOR_NONE)
{
if (skinnum >= 0)
{
truecol = skins[skinnum].prefcolor;
}
else
{
truecol = SKINCOLOR_RED;
}
}
// Card
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, greyedout ? V_TRANSLUCENT : 0, card, colormap);
{
colormap = R_GetTranslationColormap(TC_DEFAULT, truecol, GTC_CACHE);
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, greyedout ? V_TRANSLUCENT : 0, card, colormap);
}
if (greyedout)
return; // only used for profiles we can't select.
@ -1734,12 +1746,12 @@ static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
// check what setup_player is doing in priority.
if (sp->mdepth >= CSSTEP_CHARS)
{
skinnum = setup_chargrid[sp->gridx][sp->gridy].skinlist[sp->clonenum];
if (skinnum >= 0)
{
if (M_DrawCharacterSprite(x-22, y+119, skinnum, false, false, 0, colormap))
V_DrawMappedPatch(x+14, y+66, 0, faceprefix[skinnum][FACE_RANK], colormap);
UINT8 *ccolormap = R_GetTranslationColormap(skinnum, truecol, GTC_MENUCACHE);
if (M_DrawCharacterSprite(x-22, y+119, skinnum, false, false, 0, ccolormap))
V_DrawMappedPatch(x+14, y+66, 0, faceprefix[skinnum][FACE_RANK], ccolormap);
}
M_DrawCharSelectCircle(sp, x-22, y+104);
@ -1757,33 +1769,36 @@ static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
}
else if (skinnum > -1) // otherwise, read from profile.
{
UINT8 *ccolormap, *fcolormap;
UINT8 fln = K_FollowerAvailable(p->follower);
UINT16 col = K_GetEffectiveFollowerColor(
p->followercolor,
K_FollowerUsable(fln) ? &followers[fln] : 0,
p->color,
&skins[skinnum]
);
UINT8 *ccolormap;
INT32 fln = K_FollowerAvailable(p->follower);
if (R_SkinUsable(g_localplayers[0], skinnum, false))
ccolormap = colormap;
ccolormap = R_GetTranslationColormap(skinnum, truecol, GTC_MENUCACHE);
else
ccolormap = R_GetTranslationColormap(TC_BLINK, truecol, GTC_MENUCACHE);
fcolormap = R_GetTranslationColormap(
(K_FollowerUsable(fln) ? TC_DEFAULT : TC_BLINK),
col, GTC_MENUCACHE);
if (M_DrawCharacterSprite(x-22, y+119, skinnum, false, false, 0, ccolormap))
{
V_DrawMappedPatch(x+14, y+66, 0, faceprefix[skinnum][FACE_RANK], ccolormap);
}
if (M_DrawFollowerSprite(x-22 - 16, y+119, fln, false, 0, fcolormap, NULL))
if (fln >= 0)
{
patch_t *ico = W_CachePatchName(followers[fln].icon, PU_CACHE);
V_DrawMappedPatch(x+14+18, y+66, 0, ico, fcolormap);
UINT16 fcol = K_GetEffectiveFollowerColor(
p->followercolor,
&followers[fln],
p->color,
&skins[skinnum]
);
UINT8 *fcolormap = R_GetTranslationColormap(
(K_FollowerUsable(fln) ? TC_DEFAULT : TC_BLINK),
fcol, GTC_MENUCACHE);
if (M_DrawFollowerSprite(x-22 - 16, y+119, fln, false, 0, fcolormap, NULL))
{
patch_t *ico = W_CachePatchName(followers[fln].icon, PU_CACHE);
V_DrawMappedPatch(x+14+18, y+66, 0, ico, fcolormap);
}
}
}

View file

@ -439,29 +439,10 @@ void PR_LoadProfiles(void)
profilesList[PROFILE_GUEST] = dprofile;
}
skincolornum_t PR_GetProfileColor(profile_t *p)
{
if (p->color == SKINCOLOR_NONE)
{
// Get skin's prefcolor.
INT32 foundskin = R_SkinAvailable(p->skinname);
if (foundskin == -1)
{
// Return random default value
return SKINCOLOR_RED;
}
return skins[foundskin].prefcolor;
}
// Get exact color.
return p->color;
}
static void PR_ApplyProfile_Appearance(profile_t *p, UINT8 playernum)
{
CV_StealthSet(&cv_skin[playernum], p->skinname);
CV_StealthSetValue(&cv_playercolor[playernum], PR_GetProfileColor(p));
CV_StealthSetValue(&cv_playercolor[playernum], p->color);
CV_StealthSet(&cv_playername[playernum], p->playername);
// Followers

View file

@ -131,10 +131,6 @@ void PR_SaveProfiles(void);
// This also loads
void PR_LoadProfiles(void);
// PR_GetProfileColor(profile_t *p)
// Returns the profile's color, or the skin's prefcolor if set to none.
skincolornum_t PR_GetProfileColor(profile_t *p);
// PR_ApplyProfile(UINT8 profilenum, UINT8 playernum)
// Applies the given profile's settings to the given player.
void PR_ApplyProfile(UINT8 profilenum, UINT8 playernum);

View file

@ -196,7 +196,7 @@ static void M_SetupProfileGridPos(setup_player_t *p)
alt++;
p->clonenum = alt;
p->color = PR_GetProfileColor(pr);
p->color = pr->color;
}
static void M_SetupMidGameGridPos(setup_player_t *p, UINT8 num)