Use mockup design for cards, allow moving around and getting out of the profile menu. Still can't make/edit profiles

This commit is contained in:
SinnamonLat 2022-02-16 10:29:01 +01:00
parent aea066b70f
commit c44300d39f
5 changed files with 95 additions and 12 deletions

View file

@ -599,6 +599,8 @@ extern struct optionsmenu_s {
// profile garbage
boolean profilemenu; // In profile menu. (Used to know when to get the "PROFILE SETUP" button away....
boolean resetprofilemenu; // Reset button behaviour when exiting
SINT8 profilen; // # of the selected profile.
profile_t *profile; // Pointer to the profile we're editing
// for video mode testing:

View file

@ -2020,19 +2020,21 @@ void M_DrawProfileSelect(void)
INT32 i;
patch_t *card = W_CachePatchName("PR_CARD", PU_CACHE);
patch_t *cardbot = W_CachePatchName("PR_CARDB", PU_CACHE);
patch_t *pwrlv = W_CachePatchName("PR_PWR", PU_CACHE);
INT32 x = 160;
INT32 y = 75 + menutransition.tics*16;
INT32 x = 160 - optionsmenu.profilen*(128 + 128/8) + optionsmenu.offset;
INT32 y = 35 + menutransition.tics*16;
M_DrawOptionsCogs();
M_DrawMenuTooltips();
M_DrawOptionsMovingButton();
for (i=0; i < MAXPROFILES; i++)
for (i=0; i < MAXPROFILES+1; i++) // +1 because the default profile does not count
{
profile_t *p = PR_GetProfile(i);
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLACK, GTC_CACHE);
INT32 skinnum = -1;
INT32 powerlevel = -1;
char pname[PROFILENAMELEN+1] = "empty";
if (p != NULL)
@ -2040,20 +2042,32 @@ void M_DrawProfileSelect(void)
colormap = R_GetTranslationColormap(TC_DEFAULT, p->color, GTC_CACHE);
strcpy(pname, p->profilename);
skinnum = R_SkinAvailable(p->skinname);
powerlevel = 1000; // Test
}
// Card
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, card, colormap);
if (skinnum > -1)
M_DrawCharacterSprite(x, y+104, skinnum, 0, colormap);
// Draw pwlv if we can
if (powerlevel > -1)
{
V_DrawFixedPatch((x+30)*FRACUNIT, (y+84)*FRACUNIT, FRACUNIT, 0, pwrlv, colormap);
V_DrawCenteredKartString(x+30, y+87, 0, va("%d\n", powerlevel));
}
V_DrawCenteredGamemodeString(x, y+16, V_ALLOWLOWERCASE, 0, pname);
if (skinnum > -1)
{
M_DrawCharacterSprite(x-22, y+119, skinnum, V_FLIP, colormap);
V_DrawMappedPatch(x+14, y+66, 0, faceprefix[skinnum][FACE_RANK], colormap);
}
V_DrawCenteredGamemodeString(x, y+24, 0, 0, pname);
// Card bottom to overlay the skin preview
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, cardbot, colormap);
x += 96;
x += 128 + 128/8;
}
}

View file

@ -3100,8 +3100,13 @@ boolean M_OptionsQuit(void)
optionsmenu.toptx = 140-1;
optionsmenu.topty = 70+1;
optionsmenu.profilemenu = false;
optionsmenu.profile = NULL;
// Reset button behaviour because profile menu is different, since of course it is.
if (optionsmenu.resetprofilemenu)
{
optionsmenu.profilemenu = false;
optionsmenu.profile = NULL;
optionsmenu.resetprofilemenu = false;
}
return true; // Always allow quitting, duh.
}
@ -3128,9 +3133,16 @@ void M_OptionsTick(void)
else
{
// I don't like this, it looks like shit but it needs to be done..........
optionsmenu.toptx = 160;
optionsmenu.topty = 50;
if (optionsmenu.profilemenu)
{
optionsmenu.toptx = 420;
optionsmenu.topty = 70+1;
}
else
{
optionsmenu.toptx = 160;
optionsmenu.topty = 50;
}
}
// Handle the background stuff:
@ -3279,7 +3291,44 @@ void M_VideoModeMenu(INT32 choice)
void M_HandleProfileSelect(INT32 ch)
{
const UINT8 pid = 0;
(void) ch;
if (menucmd[pid].dpad_lr > 0)
{
optionsmenu.profilen++;
optionsmenu.offset += (128 + 128/8);
if (optionsmenu.profilen > MAXPROFILES)
{
optionsmenu.profilen = 0;
optionsmenu.offset -= (128 + 128/8)*(MAXPROFILES+1);
}
S_StartSound(NULL, sfx_menu1);
M_SetMenuDelay(pid);
}
else if (menucmd[pid].dpad_lr < 0)
{
optionsmenu.profilen--;
optionsmenu.offset -= (128 + 128/8);
if (optionsmenu.profilen < 0)
{
optionsmenu.profilen = MAXPROFILES;
optionsmenu.offset += (128 + 128/8)*(MAXPROFILES+1);
}
S_StartSound(NULL, sfx_menu1);
M_SetMenuDelay(pid);
}
else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y))
{
optionsmenu.resetprofilemenu = true;
M_GoBack(0);
}
}
// special menuitem key handler for video mode list

View file

@ -2544,6 +2544,18 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con
V_DrawThinStringAtFixed(x, y, option, string);
}
void V_DrawCenteredKartString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_KartStringWidth(string, option)/2;
V_DrawKartString(x, y, option, string);
}
void V_DrawRightAlignedKartString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_KartStringWidth(string, option);
V_DrawKartString(x, y, option, string);
}
void V_DrawCenteredGamemodeString(INT32 x, INT32 y, INT32 option, const UINT8 *colormap, const char *string)
{
x -= V_GamemodeStringWidth(string, option)/2;

View file

@ -326,6 +326,12 @@ void V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *colorm
#define V_DrawKartString( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT,option,NULL,KART_FONT,string)
#define V_KartStringWidth( string,option ) \
V__IntegerStringWidth ( FRACUNIT,option,KART_FONT,string )
void V_DrawCenteredKartString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedKartString(INT32 x, INT32 y, INT32 option, const char *string);
#define V_DrawGamemodeString( x,y,option,cm,string ) \
V__DrawDupxString (x,y,FRACUNIT,option,cm,GM_FONT,string)