Add profile # and player name on the card

This commit is contained in:
SinnamonLat 2022-02-20 15:23:08 +01:00
parent 87dfa790cb
commit 5801d67706
7 changed files with 46 additions and 1 deletions

View file

@ -290,6 +290,9 @@ void HU_Init(void)
PR ("PINGN");
REG;
PR ("PRFN");
REG;
DIG (3);
ADIM (KART);

View file

@ -66,6 +66,7 @@ enum
X (TALLNUM),
X (NIGHTSNUM),
X (PINGNUM),
X (PROFNUM),
X (KART),
X (GM),

View file

@ -1121,6 +1121,14 @@ static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
// Card bottom to overlay the skin preview
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, cardbot, colormap);
// Profile number & player name
if (p != NULL)
{
V_DrawProfileNum(x + 37 + 10, y + 131, 0, PR_GetProfileNum(p));
V_DrawCenteredThinString(x, y + 151, V_GRAYMAP|V_6WIDTHSPACE, p->playername);
}
}
void M_DrawCharacterSelect(void)

View file

@ -154,3 +154,15 @@ void PR_ApplyProfile(UINT8 profilenum, UINT8 playernum)
// set controls...
memcpy(&gamecontrol[playernum], p->controls, sizeof(gamecontroldefault));
}
UINT8 PR_GetProfileNum(profile_t *p)
{
UINT8 i;
for (i = 0; i < MAXPROFILES+1; i++)
{
profile_t *comp = PR_GetProfile(i);
if (comp == p)
return i;
}
return 0;
}

View file

@ -108,6 +108,8 @@ void PR_LoadProfiles(void);
// Applies the given profile's settings to the given player.
void PR_ApplyProfile(UINT8 profilenum, UINT8 playernum);
// PR_GetProfileNum(profile_t *p)
// Gets the profile's index # in profilesList
UINT8 PR_GetProfileNum(profile_t *p);
#endif

View file

@ -2650,6 +2650,23 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
} while (--digits);
}
void V_DrawProfileNum(INT32 x, INT32 y, INT32 flags, UINT8 num)
{
UINT8 digits = 3;
INT32 w = fontv[PROFNUM_FONT].font[0]->width;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
// draw the number
do
{
x -= (w-1);
V_DrawScaledPatch(x, y, flags, fontv[PROFNUM_FONT].font[num % 10]);
num /= 10;
} while (--digits);
}
// Draws a number using the PING font thingy.
// TODO: Merge number drawing functions into one with "font name" selection.

View file

@ -316,6 +316,8 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
// This is a separate function because IMO lua should have access to it as well.
void V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *colormap);
void V_DrawProfileNum(INT32 x, INT32 y, INT32 flags, UINT8 num);
#define V_DrawCreditString( x,y,option,string ) \
V__DrawOneScaleString (x,y,FRACUNIT,option,NULL,CRED_FONT,string)