mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-22 22:46:12 +00:00
profiles: start on edit menu (it does nothing)
This commit is contained in:
parent
c44300d39f
commit
8efba24df7
5 changed files with 190 additions and 40 deletions
12
src/k_menu.h
12
src/k_menu.h
|
|
@ -223,6 +223,9 @@ typedef enum
|
|||
extern menuitem_t OPTIONS_Profiles[];
|
||||
extern menu_t OPTIONS_ProfilesDef;
|
||||
|
||||
extern menuitem_t OPTIONS_EditProfile[];
|
||||
extern menu_t OPTIONS_EditProfileDef;
|
||||
|
||||
extern menuitem_t OPTIONS_Video[];
|
||||
extern menu_t OPTIONS_VideoDef;
|
||||
|
||||
|
|
@ -592,6 +595,8 @@ extern struct optionsmenu_s {
|
|||
|
||||
// For moving the button when we get into a submenu. it's smooth and cool! (normal x/y and target x/y.)
|
||||
// this is only used during menu transitions.
|
||||
|
||||
// For profiles specifically, this moves the card around since we don't have the rest of the menu displayed in that case.
|
||||
INT16 optx;
|
||||
INT16 opty;
|
||||
INT16 toptx;
|
||||
|
|
@ -601,6 +606,8 @@ extern struct optionsmenu_s {
|
|||
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.
|
||||
|
||||
boolean resetprofile; // After going back from the edit menu, this tells the profile select menu to kill the profile data after the transition.
|
||||
profile_t *profile; // Pointer to the profile we're editing
|
||||
|
||||
// for video mode testing:
|
||||
|
|
@ -620,6 +627,9 @@ extern struct optionsmenu_s {
|
|||
tic_t fade;
|
||||
} optionsmenu;
|
||||
|
||||
extern consvar_t cv_dummyprofilename;
|
||||
extern consvar_t cv_dummyprofileplayername;
|
||||
|
||||
void M_InitOptions(INT32 choice); // necessary for multiplayer since there's some options we won't want to access
|
||||
void M_OptionsTick(void);
|
||||
boolean M_OptionsInputs(INT32 ch);
|
||||
|
|
@ -632,6 +642,7 @@ void M_EraseData(INT32 choice); // For data erasing
|
|||
// profile selection menu
|
||||
void M_ProfileSelectInit(INT32 choice);
|
||||
void M_HandleProfileSelect(INT32 ch);
|
||||
boolean M_ProfileEditInputs(INT32 ch);
|
||||
|
||||
// video modes menu (resolution)
|
||||
void M_VideoModeMenu(INT32 choice);
|
||||
|
|
@ -772,6 +783,7 @@ void M_DrawOptionsMovingButton(void); // for sick transitions...
|
|||
void M_DrawOptions(void);
|
||||
void M_DrawGenericOptions(void);
|
||||
void M_DrawProfileSelect(void);
|
||||
void M_DrawEditProfile(void);
|
||||
void M_DrawVideoModes(void);
|
||||
void M_DrawItemToggles(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -430,6 +430,36 @@ menu_t OPTIONS_ProfilesDef = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
|
||||
menuitem_t OPTIONS_EditProfile[] = {
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, "Profile Name", "6-character long name to identify this Profile.",
|
||||
NULL, &cv_dummyprofilename, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, "Player Name", "Name displayed online when using this Profile.",
|
||||
NULL, &cv_dummyprofileplayername, 0, 0},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, "Character", "Default character and color for this Profile.",
|
||||
NULL, NULL, 0, 0},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, "Controls", "Select the button mappings for this Profile.",
|
||||
NULL, NULL, 0, 0},
|
||||
};
|
||||
|
||||
menu_t OPTIONS_EditProfileDef = {
|
||||
sizeof (OPTIONS_EditProfile) / sizeof (menuitem_t),
|
||||
&OPTIONS_ProfilesDef,
|
||||
0,
|
||||
OPTIONS_EditProfile,
|
||||
32, 80,
|
||||
SKINCOLOR_ULTRAMARINE, 0,
|
||||
2, 10,
|
||||
M_DrawEditProfile,
|
||||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
M_ProfileEditInputs,
|
||||
};
|
||||
|
||||
// video options menu...
|
||||
// options menu
|
||||
menuitem_t OPTIONS_Video[] =
|
||||
|
|
|
|||
142
src/k_menudraw.c
142
src/k_menudraw.c
|
|
@ -2014,61 +2014,127 @@ void M_DrawGenericOptions(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void M_DrawProfileCard(INT32 x, INT32 y, profile_t *p)
|
||||
{
|
||||
|
||||
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);
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLACK, GTC_CACHE);
|
||||
INT32 skinnum = -1;
|
||||
INT32 powerlevel = -1;
|
||||
|
||||
char pname[PROFILENAMELEN+1] = "empty";
|
||||
|
||||
if (p != NULL && p->version)
|
||||
{
|
||||
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);
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Draws profile selection
|
||||
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 - optionsmenu.profilen*(128 + 128/8) + optionsmenu.offset;
|
||||
INT32 y = 35 + menutransition.tics*16;
|
||||
|
||||
M_DrawOptionsCogs();
|
||||
M_DrawMenuTooltips();
|
||||
M_DrawOptionsMovingButton();
|
||||
|
||||
// This shouldn't be drawn when a profile is selected as optx/opty are used to move the card.
|
||||
if (optionsmenu.profile == NULL && menutransition.tics)
|
||||
M_DrawOptionsMovingButton();
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
// don't draw the card in this specific scenario
|
||||
if (!(menutransition.tics && optionsmenu.profile != NULL && optionsmenu.profilen == i))
|
||||
M_DrawProfileCard(x, y, p);
|
||||
|
||||
x += 128 + 128/8;
|
||||
}
|
||||
|
||||
// needs to be drawn since it happens on the transition
|
||||
if (optionsmenu.profile != NULL)
|
||||
M_DrawProfileCard(optionsmenu.optx, optionsmenu.opty, optionsmenu.profile);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Profile edition menu
|
||||
void M_DrawEditProfile(void)
|
||||
{
|
||||
|
||||
INT32 y = 40;
|
||||
INT32 x = 145;
|
||||
INT32 i;
|
||||
|
||||
M_DrawOptionsCogs();
|
||||
|
||||
// Tooltip
|
||||
// The text is slightly shifted hence why we don't just use M_DrawMenuTooltips()
|
||||
V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL);
|
||||
if (currentMenu->menuitems[itemOn].tooltip != NULL)
|
||||
{
|
||||
V_DrawCenteredThinString(BASEVIDWIDTH*2/3, 12, V_ALLOWLOWERCASE|V_6WIDTHSPACE, currentMenu->menuitems[itemOn].tooltip);
|
||||
}
|
||||
|
||||
// Draw the menu options...
|
||||
for (i = 0; i < currentMenu->numitems; i++)
|
||||
{
|
||||
switch (currentMenu->menuitems[i].status & IT_DISPLAY)
|
||||
{
|
||||
case IT_STRING:
|
||||
|
||||
UINT8 *colormap = NULL;
|
||||
if (i == itemOn)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE);
|
||||
|
||||
// Background
|
||||
V_DrawFill(0, y, 400 - (menutransition.tics*32), 24, itemOn == i ? 169 : 30); // 169 is the plague colourization
|
||||
// Text
|
||||
V_DrawGamemodeString(x + (menutransition.tics*32), y - 6, V_ALLOWLOWERCASE, colormap, currentMenu->menuitems[i].text);
|
||||
|
||||
|
||||
y += 42;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, draw the card ontop
|
||||
if (optionsmenu.profile != NULL)
|
||||
{
|
||||
M_DrawProfileCard(optionsmenu.optx, optionsmenu.opty, optionsmenu.profile);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the video modes list, a-la-Quake
|
||||
|
|
|
|||
|
|
@ -182,6 +182,9 @@ consvar_t cv_dummyip = CVAR_INIT ("dummyip", "", CV_HIDDEN, NULL, NULL);
|
|||
consvar_t cv_dummymenuplayer = CVAR_INIT ("dummymenuplayer", "P1", CV_HIDDEN|CV_CALL, dummymenuplayer_cons_t, Dummymenuplayer_OnChange);
|
||||
consvar_t cv_dummyspectate = CVAR_INIT ("dummyspectate", "Spectator", CV_HIDDEN, dummyspectate_cons_t, NULL);
|
||||
|
||||
consvar_t cv_dummyprofilename = CVAR_INIT ("dummyprofilename", "", CV_HIDDEN, NULL, NULL);
|
||||
consvar_t cv_dummyprofileplayername = CVAR_INIT ("dummyprofileplayername", "", CV_HIDDEN, NULL, NULL);
|
||||
|
||||
consvar_t cv_dummygpdifficulty = CVAR_INIT ("dummygpdifficulty", "Normal", CV_HIDDEN, dummygpdifficulty_cons_t, NULL);
|
||||
consvar_t cv_dummykartspeed = CVAR_INIT ("dummykartspeed", "Auto", CV_HIDDEN, dummykartspeed_cons_t, NULL);
|
||||
consvar_t cv_dummygpencore = CVAR_INIT ("dummygpdifficulty", "No", CV_HIDDEN, CV_YesNo, NULL);
|
||||
|
|
@ -3130,7 +3133,7 @@ void M_OptionsTick(void)
|
|||
{
|
||||
M_OptionsQuit(); // ...So now this is used here.
|
||||
}
|
||||
else
|
||||
else if (optionsmenu.profile == NULL) // Not currently editing a profile (otherwise we're using these variables for other purposes....)
|
||||
{
|
||||
// I don't like this, it looks like shit but it needs to be done..........
|
||||
if (optionsmenu.profilemenu)
|
||||
|
|
@ -3323,12 +3326,51 @@ void M_HandleProfileSelect(INT32 ch)
|
|||
S_StartSound(NULL, sfx_menu1);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
|
||||
else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X))
|
||||
{
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
optionsmenu.profile = PR_GetProfile(optionsmenu.profilen);
|
||||
|
||||
// This is now used to move the card we've selected.
|
||||
optionsmenu.optx = 160;
|
||||
optionsmenu.opty = 35;
|
||||
optionsmenu.toptx = 130/2;
|
||||
optionsmenu.topty = 0;
|
||||
|
||||
M_SetupNextMenu(&OPTIONS_EditProfileDef, false);
|
||||
}
|
||||
|
||||
else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y))
|
||||
{
|
||||
optionsmenu.resetprofilemenu = true;
|
||||
M_GoBack(0);
|
||||
}
|
||||
|
||||
if (menutransition.tics == 0 && optionsmenu.resetprofile)
|
||||
{
|
||||
optionsmenu.profile = NULL; // Make sure to reset that when transitions are done.'
|
||||
optionsmenu.resetprofile = false;
|
||||
}
|
||||
}
|
||||
|
||||
// For profile edit, just make sure going back resets the card to its position, the rest is taken care of automatically.
|
||||
boolean M_ProfileEditInputs(INT32 ch)
|
||||
{
|
||||
const UINT8 pid = 0;
|
||||
(void) ch;
|
||||
|
||||
if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y))
|
||||
{
|
||||
optionsmenu.toptx = 160;
|
||||
optionsmenu.topty = 35;
|
||||
optionsmenu.resetprofile = true; // Reset profile after the transition is done.
|
||||
|
||||
M_GoBack(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// special menuitem key handler for video mode list
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ boolean PR_AddProfile(profile_t p)
|
|||
|
||||
profile_t* PR_GetProfile(INT32 num)
|
||||
{
|
||||
if (num < numprofiles)
|
||||
if (num < MAXPROFILES+1)
|
||||
return &profilesList[num];
|
||||
else
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue