diff --git a/src/k_menu.h b/src/k_menu.h index b4a69c861..97035862d 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -597,6 +597,10 @@ extern struct optionsmenu_s { INT16 toptx; INT16 topty; + // profile garbage + boolean profilemenu; // In profile menu. (Used to know when to get the "PROFILE SETUP" button away.... + profile_t *profile; // Pointer to the profile we're editing + // for video mode testing: INT32 vidm_testingmode; INT32 vidm_previousmode; @@ -624,6 +628,7 @@ void M_HandleItemToggles(INT32 choice); // For item toggling void M_EraseData(INT32 choice); // For data erasing // profile selection menu +void M_ProfileSelectInit(INT32 choice); void M_HandleProfileSelect(INT32 ch); // video modes menu (resolution) diff --git a/src/k_menudef.c b/src/k_menudef.c index c75354eb3..91e0eceb1 100644 --- a/src/k_menudef.c +++ b/src/k_menudef.c @@ -367,8 +367,8 @@ menu_t PLAY_MP_RoomSelectDef = { menuitem_t OPTIONS_Main[] = { - {IT_STRING | IT_SUBMENU, "Profile Setup", "Remap keys & buttons to your likings.", - NULL, &OPTIONS_ProfilesDef, 0, 0}, + {IT_STRING | IT_CALL, "Profile Setup", "Remap keys & buttons to your likings.", + NULL, M_ProfileSelectInit, 0, 0}, {IT_STRING | IT_SUBMENU, "Video Options", "Change video settings such as the resolution.", NULL, &OPTIONS_VideoDef, 0, 0}, diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 29cc158ee..ff289835a 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -754,6 +754,43 @@ static void M_DrawCharSelectCircle(setup_player_t *p, INT16 x, INT16 y) } } +static void M_DrawCharacterSprite(INT16 x, INT16 y, SINT8 skin, INT32 addflags, UINT8 *colormap) +{ + UINT8 spr; + spritedef_t *sprdef; + spriteframe_t *sprframe; + patch_t *sprpatch; + + UINT32 flags = 0; + UINT32 frame; + + spr = P_GetSkinSprite2(&skins[skin], SPR2_FSTN, NULL); + sprdef = &skins[skin].sprites[spr]; + + if (!sprdef->numframes) // No frames ?? + return; // Can't render! + + frame = states[S_KART_FAST].frame & FF_FRAMEMASK; + if (frame >= sprdef->numframes) // Walking animation missing + frame = 0; // Try to use standing frame + + sprframe = &sprdef->spriteframes[frame]; + sprpatch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE); + + if (sprframe->flip & 1) // Only for first sprite + flags |= V_FLIP; // This sprite is left/right flipped! + + if (skins[skin].flags & SF_HIRES) + { + V_DrawFixedPatch(x<gridx][p->gridy].skinlist[p->clonenum]; UINT8 color = p->color; UINT8 *colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE); + INT32 flags = 0; - if (skin != -1) - { - UINT8 spr; - spritedef_t *sprdef; - spriteframe_t *sprframe; - patch_t *sprpatch; + // Flip for left-side players + if (!(num & 1)) + flags ^= V_FLIP; - UINT32 flags = 0; - UINT32 frame; - - spr = P_GetSkinSprite2(&skins[skin], SPR2_FSTN, NULL); - sprdef = &skins[skin].sprites[spr]; - - if (!sprdef->numframes) // No frames ?? - return; // Can't render! - - frame = states[S_KART_FAST].frame & FF_FRAMEMASK; - if (frame >= sprdef->numframes) // Walking animation missing - frame = 0; // Try to use standing frame - - sprframe = &sprdef->spriteframes[frame]; - sprpatch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE); - - if (sprframe->flip & 1) // Only for first sprite - flags |= V_FLIP; // This sprite is left/right flipped! - - // Flip for left-side players - if (!(num & 1)) - flags ^= V_FLIP; - - if (skins[skin].flags & SF_HIRES) - { - V_DrawFixedPatch(x<color, GTC_CACHE); strcpy(pname, p->profilename); + skinnum = R_SkinAvailable(p->skinname); } + // Card V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, card, colormap); - V_DrawCenteredGamemodeString(x, y+18, 0, 0, pname); - CONS_Printf("pname %s\n", pname); + if (skinnum > -1) + M_DrawCharacterSprite(x, y+104, skinnum, 0, colormap); + + V_DrawCenteredGamemodeString(x, y+16, V_ALLOWLOWERCASE, 0, pname); + + // Card bottom to overlay the skin preview + V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, cardbot, colormap); x += 96; } diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 05b980146..f32b192aa 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -1146,6 +1146,11 @@ static void M_HandleMenuInput(void) return; } + if (menucmd[pid].delay > 0) + { + return; + } + // Handle menu-specific input handling. If this returns true, we skip regular input handling. if (currentMenu->inputroutine) { @@ -1154,12 +1159,6 @@ static void M_HandleMenuInput(void) return; } } - - if (menucmd[pid].delay > 0) - { - return; - } - routine = currentMenu->menuitems[itemOn].itemaction; // Handle menuitems which need a specific key handling @@ -3101,6 +3100,9 @@ boolean M_OptionsQuit(void) optionsmenu.toptx = 140-1; optionsmenu.topty = 70+1; + optionsmenu.profilemenu = false; + optionsmenu.profile = NULL; + return true; // Always allow quitting, duh. } @@ -3125,6 +3127,8 @@ 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; } @@ -3142,47 +3146,56 @@ void M_OptionsTick(void) boolean M_OptionsInputs(INT32 ch) { - switch (ch) + const UINT8 pid = 0; + (void)ch; + + if (menucmd[pid].dpad_ud > 0) { - case KEY_DOWNARROW: - { - optionsmenu.offset += 48; - M_NextOpt(); - S_StartSound(NULL, sfx_menu1); + M_SetMenuDelay(pid); + optionsmenu.offset += 48; + M_NextOpt(); + S_StartSound(NULL, sfx_menu1); - if (itemOn == 0) - optionsmenu.offset -= currentMenu->numitems*48; + if (itemOn == 0) + optionsmenu.offset -= currentMenu->numitems*48; - return true; - } - case KEY_UPARROW: - { - optionsmenu.offset -= 48; - M_PrevOpt(); - S_StartSound(NULL, sfx_menu1); - - if (itemOn == currentMenu->numitems-1) - optionsmenu.offset += currentMenu->numitems*48; - - return true; - } - case KEY_ENTER: - { - - if (currentMenu->menuitems[itemOn].status & IT_TRANSTEXT) - return true; // No. - - optionsmenu.optx = 140; - optionsmenu.opty = 70; // Default position for the currently selected option. - - return false; // Don't eat. - } + return true; } + else if (menucmd[pid].dpad_ud < 0) + { + M_SetMenuDelay(pid); + optionsmenu.offset -= 48; + M_PrevOpt(); + S_StartSound(NULL, sfx_menu1); + if (itemOn == currentMenu->numitems-1) + optionsmenu.offset += currentMenu->numitems*48; + + + return true; + } + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { + + if (currentMenu->menuitems[itemOn].status & IT_TRANSTEXT) + return true; // No. + + optionsmenu.optx = 140; + optionsmenu.opty = 70; // Default position for the currently selected option. + return false; // Don't eat. + } return false; } +void M_ProfileSelectInit(INT32 choice) +{ + (void)choice; + optionsmenu.profilemenu = true; + + M_SetupNextMenu(&OPTIONS_ProfilesDef, false); +} + // setup video mode menu void M_VideoModeMenu(INT32 choice) { @@ -3272,52 +3285,72 @@ void M_HandleProfileSelect(INT32 ch) // special menuitem key handler for video mode list void M_HandleVideoModes(INT32 ch) { - if (optionsmenu.vidm_testingmode > 0) switch (ch) + + const UINT8 pid = 0; + (void)ch; + + if (optionsmenu.vidm_testingmode > 0) { // change back to the previous mode quickly - case KEY_ESCAPE: + if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y)) + { setmodeneeded = optionsmenu.vidm_previousmode + 1; optionsmenu.vidm_testingmode = 0; - break; - - case KEY_ENTER: + } + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { S_StartSound(NULL, sfx_menu1); optionsmenu.vidm_testingmode = 0; // stop testing + } } - else switch (ch) + else { - case KEY_DOWNARROW: + if (menucmd[pid].dpad_ud < 0) + { S_StartSound(NULL, sfx_menu1); if (++optionsmenu.vidm_selected >= optionsmenu.vidm_nummodes) optionsmenu.vidm_selected = 0; - break; - case KEY_UPARROW: + M_SetMenuDelay(pid); + } + + else if (menucmd[pid].dpad_ud > 0) + { S_StartSound(NULL, sfx_menu1); if (--optionsmenu.vidm_selected < 0) optionsmenu.vidm_selected = optionsmenu.vidm_nummodes - 1; - break; - case KEY_LEFTARROW: + M_SetMenuDelay(pid); + } + + else if (menucmd[pid].dpad_lr < 0) + { S_StartSound(NULL, sfx_menu1); optionsmenu.vidm_selected -= optionsmenu.vidm_column_size; if (optionsmenu.vidm_selected < 0) optionsmenu.vidm_selected = (optionsmenu.vidm_column_size*3) + optionsmenu.vidm_selected; if (optionsmenu.vidm_selected >= optionsmenu.vidm_nummodes) optionsmenu.vidm_selected = optionsmenu.vidm_nummodes - 1; - break; - case KEY_RIGHTARROW: + M_SetMenuDelay(pid); + } + + else if (menucmd[pid].dpad_lr > 0) + { S_StartSound(NULL, sfx_menu1); optionsmenu.vidm_selected += optionsmenu.vidm_column_size; if (optionsmenu.vidm_selected >= (optionsmenu.vidm_column_size*3)) optionsmenu.vidm_selected %= optionsmenu.vidm_column_size; if (optionsmenu.vidm_selected >= optionsmenu.vidm_nummodes) optionsmenu.vidm_selected = optionsmenu.vidm_nummodes - 1; - break; - case KEY_ENTER: + M_SetMenuDelay(pid); + } + + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { + M_SetMenuDelay(pid); S_StartSound(NULL, sfx_menu1); if (vid.modenum == optionsmenu.modedescs[optionsmenu.vidm_selected].modenum) SCR_SetDefaultMode(); @@ -3328,17 +3361,16 @@ void M_HandleVideoModes(INT32 ch) if (!setmodeneeded) // in case the previous setmode was not finished setmodeneeded = optionsmenu.modedescs[optionsmenu.vidm_selected].modenum + 1; } - break; + } - case KEY_ESCAPE: // this one same as M_Responder + else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y)) + { + M_SetMenuDelay(pid); if (currentMenu->prevMenu) M_SetupNextMenu(currentMenu->prevMenu, false); else M_ClearMenus(true); - break; - - default: - break; + } } } @@ -3349,86 +3381,103 @@ void M_HandleItemToggles(INT32 choice) INT16 next; UINT8 i; boolean exitmenu = false; + const UINT8 pid = 0; - switch (choice) + (void) choice; + + + if (menucmd[pid].dpad_lr > 0) { - case KEY_RIGHTARROW: - S_StartSound(NULL, sfx_menu1); - column++; - if (((column*height)+row) >= currentMenu->numitems) - column = 0; - next = min(((column*height)+row), currentMenu->numitems-1); - itemOn = next; - break; + S_StartSound(NULL, sfx_menu1); + column++; + if (((column*height)+row) >= currentMenu->numitems) + column = 0; + next = min(((column*height)+row), currentMenu->numitems-1); + itemOn = next; - case KEY_LEFTARROW: - S_StartSound(NULL, sfx_menu1); + M_SetMenuDelay(pid); + } + + else if (menucmd[pid].dpad_lr < 0) + { + S_StartSound(NULL, sfx_menu1); + column--; + if (column < 0) + column = width-1; + if (((column*height)+row) >= currentMenu->numitems) column--; - if (column < 0) - column = width-1; - if (((column*height)+row) >= currentMenu->numitems) - column--; - next = max(((column*height)+row), 0); - if (next >= currentMenu->numitems) - next = currentMenu->numitems-1; - itemOn = next; - break; + next = max(((column*height)+row), 0); + if (next >= currentMenu->numitems) + next = currentMenu->numitems-1; + itemOn = next; - case KEY_DOWNARROW: - S_StartSound(NULL, sfx_menu1); - row = (row+1) % height; - if (((column*height)+row) >= currentMenu->numitems) - row = 0; - next = min(((column*height)+row), currentMenu->numitems-1); - itemOn = next; - break; + M_SetMenuDelay(pid); + } - case KEY_UPARROW: - S_StartSound(NULL, sfx_menu1); - row = (row-1) % height; - if (row < 0) - row = height-1; - if (((column*height)+row) >= currentMenu->numitems) - row--; - next = max(((column*height)+row), 0); - if (next >= currentMenu->numitems) - next = currentMenu->numitems-1; - itemOn = next; - break; + else if (menucmd[pid].dpad_ud > 0) + { + S_StartSound(NULL, sfx_menu1); + row = (row+1) % height; + if (((column*height)+row) >= currentMenu->numitems) + row = 0; + next = min(((column*height)+row), currentMenu->numitems-1); + itemOn = next; - case KEY_ENTER: + M_SetMenuDelay(pid); + } + + else if (menucmd[pid].dpad_ud < 0) + { + S_StartSound(NULL, sfx_menu1); + row = (row-1) % height; + if (row < 0) + row = height-1; + if (((column*height)+row) >= currentMenu->numitems) + row--; + next = max(((column*height)+row), 0); + if (next >= currentMenu->numitems) + next = currentMenu->numitems-1; + itemOn = next; + + M_SetMenuDelay(pid); + } + + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { + M_SetMenuDelay(pid); #ifdef ITEMTOGGLEBOTTOMRIGHT - if (currentMenu->menuitems[itemOn].mvar1 == 255) + if (currentMenu->menuitems[itemOn].mvar1 == 255) + { + //S_StartSound(NULL, sfx_s26d); + if (!shitsfree) { - //S_StartSound(NULL, sfx_s26d); - if (!shitsfree) - { - shitsfree = TICRATE; - S_StartSound(NULL, sfx_itfree); - } + shitsfree = TICRATE; + S_StartSound(NULL, sfx_itfree); } - else + } + else #endif - if (currentMenu->menuitems[itemOn].mvar1 == 0) + if (currentMenu->menuitems[itemOn].mvar1 == 0) + { + INT32 v = cv_sneaker.value; + S_StartSound(NULL, sfx_s1b4); + for (i = 0; i < NUMKARTRESULTS-1; i++) { - INT32 v = cv_sneaker.value; - S_StartSound(NULL, sfx_s1b4); - for (i = 0; i < NUMKARTRESULTS-1; i++) - { - if (KartItemCVars[i]->value == v) - CV_AddValue(KartItemCVars[i], 1); - } + if (KartItemCVars[i]->value == v) + CV_AddValue(KartItemCVars[i], 1); } - else - { - S_StartSound(NULL, sfx_s1ba); - CV_AddValue(KartItemCVars[currentMenu->menuitems[itemOn].mvar1-1], 1); - } - break; + } + else + { + S_StartSound(NULL, sfx_s1ba); + CV_AddValue(KartItemCVars[currentMenu->menuitems[itemOn].mvar1-1], 1); + } + } - case KEY_ESCAPE: - exitmenu = true; - break; + else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y)) + { + M_SetMenuDelay(pid); + exitmenu = true; } if (exitmenu) @@ -3499,41 +3548,46 @@ void M_ExtrasTick(void) boolean M_ExtrasInputs(INT32 ch) { - switch (ch) + const UINT8 pid = 0; + (void) ch; + + if (menucmd[pid].dpad_ud > 0) { - case KEY_DOWNARROW: - { - extrasmenu.offset += 48; - M_NextOpt(); - S_StartSound(NULL, sfx_menu1); + extrasmenu.offset += 48; + M_NextOpt(); + S_StartSound(NULL, sfx_menu1); - if (itemOn == 0) - extrasmenu.offset -= currentMenu->numitems*48; + if (itemOn == 0) + extrasmenu.offset -= currentMenu->numitems*48; - return true; - } - case KEY_UPARROW: - { - extrasmenu.offset -= 48; - M_PrevOpt(); - S_StartSound(NULL, sfx_menu1); + M_SetMenuDelay(pid); + return true; + } - if (itemOn == currentMenu->numitems-1) - extrasmenu.offset += currentMenu->numitems*48; + else if (menucmd[pid].dpad_ud < 0) + { + extrasmenu.offset -= 48; + M_PrevOpt(); + S_StartSound(NULL, sfx_menu1); - return true; - } - case KEY_ENTER: - { + if (itemOn == currentMenu->numitems-1) + extrasmenu.offset += currentMenu->numitems*48; - if (currentMenu->menuitems[itemOn].status & IT_TRANSTEXT) - return true; // No. + M_SetMenuDelay(pid); + return true; + } - extrasmenu.extx = 140; - extrasmenu.exty = 70; // Default position for the currently selected option. + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { - return false; // Don't eat. - } + if (currentMenu->menuitems[itemOn].status & IT_TRANSTEXT) + return true; // No. + + extrasmenu.extx = 140; + extrasmenu.exty = 70; // Default position for the currently selected option. + + M_SetMenuDelay(pid); + return false; // Don't eat. } return false; } @@ -3634,36 +3688,35 @@ void M_PauseTick(void) boolean M_PauseInputs(INT32 ch) { + const UINT8 pid = 0; + (void) ch; + if (pausemenu.closing) return true; // Don't allow inputs. - switch (ch) + if (menucmd[pid].dpad_ud < 0) { - - case KEY_UPARROW: - { - pausemenu.offset -= 50; // Each item is spaced by 50 px - S_StartSound(NULL, sfx_menu1); - M_PrevOpt(); - return true; - } - - case KEY_DOWNARROW: - { - pausemenu.offset += 50; // Each item is spaced by 50 px - S_StartSound(NULL, sfx_menu1); - M_NextOpt(); - return true; - } - - case KEY_ESCAPE: - { - M_QuitPauseMenu(); - return true; - } - + M_SetMenuDelay(pid); + pausemenu.offset -= 50; // Each item is spaced by 50 px + S_StartSound(NULL, sfx_menu1); + M_PrevOpt(); + return true; } + else if (menucmd[pid].dpad_ud > 0) + { + pausemenu.offset += 50; // Each item is spaced by 50 px + S_StartSound(NULL, sfx_menu1); + M_NextOpt(); + M_SetMenuDelay(pid); + return true; + } + + else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y)) + { + M_QuitPauseMenu(); + return true; + } return false; } @@ -3914,9 +3967,12 @@ void M_ReplayHut(INT32 choice) // key handler void M_HandleReplayHutList(INT32 choice) { - switch (choice) + + const UINT8 pid = 0; + (void) choice; + + if (menucmd[pid].dpad_ud > 0) { - case KEY_UPARROW: if (dir_on[menudepthleft]) dir_on[menudepthleft]--; else @@ -3925,9 +3981,10 @@ void M_HandleReplayHutList(INT32 choice) S_StartSound(NULL, sfx_menu1); extrasmenu.replayScrollTitle = 0; extrasmenu.replayScrollDelay = TICRATE; extrasmenu.replayScrollDir = 1; - break; + } - case KEY_DOWNARROW: + else if (menucmd[pid].dpad_ud < 0) + { if (dir_on[menudepthleft] < sizedirmenu-1) dir_on[menudepthleft]++; else @@ -3936,13 +3993,15 @@ void M_HandleReplayHutList(INT32 choice) S_StartSound(NULL, sfx_menu1); extrasmenu.replayScrollTitle = 0; extrasmenu.replayScrollDelay = TICRATE; extrasmenu.replayScrollDir = 1; - break; + } - case KEY_ESCAPE: + else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y)) + { M_QuitReplayHut(); - break; + } - case KEY_ENTER: + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE]) { case EXT_FOLDER: @@ -4028,8 +4087,6 @@ void M_HandleReplayHutList(INT32 choice) break; } } - - break; } } @@ -4252,8 +4309,11 @@ static boolean M_ChangeStringAddons(INT32 choice) void M_HandleAddons(INT32 choice) { + const UINT8 pid = 0; boolean exitmenu = false; // exit to previous menu + (void) choice; + if (M_ChangeStringAddons(choice)) { char *tempname = NULL; @@ -4270,116 +4330,122 @@ void M_HandleAddons(INT32 choice) #endif } - switch (choice) + if (menucmd[pid].dpad_ud < 0) { - case KEY_DOWNARROW: - if (dir_on[menudepthleft] < sizedirmenu-1) - dir_on[menudepthleft]++; - S_StartSound(NULL, sfx_menu1); - break; - case KEY_UPARROW: - if (dir_on[menudepthleft]) - dir_on[menudepthleft]--; - S_StartSound(NULL, sfx_menu1); - break; - case KEY_PGDN: + if (dir_on[menudepthleft] < sizedirmenu-1) + dir_on[menudepthleft]++; + S_StartSound(NULL, sfx_menu1); + } + else if (menucmd[pid].dpad_ud > 0) + { + if (dir_on[menudepthleft]) + dir_on[menudepthleft]--; + S_StartSound(NULL, sfx_menu1); + } + + else if (M_MenuButtonPressed(pid, MBT_L)) + { + UINT8 i; + for (i = numaddonsshown; i && (dir_on[menudepthleft] < sizedirmenu-1); i--) + dir_on[menudepthleft]++; + + S_StartSound(NULL, sfx_menu1); + } + + else if (M_MenuButtonPressed(pid, MBT_R)) + { + UINT8 i; + for (i = numaddonsshown; i && (dir_on[menudepthleft]); i--) + dir_on[menudepthleft]--; + + S_StartSound(NULL, sfx_menu1); + } + + else if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X)) + { + boolean refresh = true; + if (!dirmenu[dir_on[menudepthleft]]) + S_StartSound(NULL, sfx_s26d); + else + { + switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE]) { - UINT8 i; - for (i = numaddonsshown; i && (dir_on[menudepthleft] < sizedirmenu-1); i--) - dir_on[menudepthleft]++; - } - S_StartSound(NULL, sfx_menu1); - break; - case KEY_PGUP: - { - UINT8 i; - for (i = numaddonsshown; i && (dir_on[menudepthleft]); i--) - dir_on[menudepthleft]--; - } - S_StartSound(NULL, sfx_menu1); - break; - case KEY_ENTER: - { - boolean refresh = true; - if (!dirmenu[dir_on[menudepthleft]]) - S_StartSound(NULL, sfx_s26d); - else - { - switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE]) + case EXT_FOLDER: + strcpy(&menupath[menupathindex[menudepthleft]],dirmenu[dir_on[menudepthleft]]+DIR_STRING); + if (menudepthleft) { - case EXT_FOLDER: - strcpy(&menupath[menupathindex[menudepthleft]],dirmenu[dir_on[menudepthleft]]+DIR_STRING); - if (menudepthleft) - { - menupathindex[--menudepthleft] = strlen(menupath); - menupath[menupathindex[menudepthleft]] = 0; + menupathindex[--menudepthleft] = strlen(menupath); + menupath[menupathindex[menudepthleft]] = 0; - if (!preparefilemenu(false, false)) - { - S_StartSound(NULL, sfx_s224); - M_StartMessage(va("%c%s\x80\nThis folder is empty.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING); - menupath[menupathindex[++menudepthleft]] = 0; - - if (!preparefilemenu(true, false)) - { - UNEXIST; - return; - } - } - else - { - S_StartSound(NULL, sfx_menu1); - dir_on[menudepthleft] = 1; - } - refresh = false; - } - else - { - S_StartSound(NULL, sfx_s26d); - M_StartMessage(va("%c%s\x80\nThis folder is too deep to navigate to!\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING); - menupath[menupathindex[menudepthleft]] = 0; - } - break; - case EXT_UP: - S_StartSound(NULL, sfx_menu1); + if (!preparefilemenu(false, false)) + { + S_StartSound(NULL, sfx_s224); + M_StartMessage(va("%c%s\x80\nThis folder is empty.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING); menupath[menupathindex[++menudepthleft]] = 0; - if (!preparefilemenu(false, false)) + + if (!preparefilemenu(true, false)) { UNEXIST; return; } - break; - case EXT_TXT: - M_StartMessage(va("%c%s\x80\nThis file may not be a console script.\nAttempt to run anyways? \n\n(Press 'Y' to confirm)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),M_AddonExec,MM_YESNO); - break; - case EXT_CFG: - M_AddonExec(KEY_ENTER); - break; - case EXT_LUA: - case EXT_SOC: - case EXT_WAD: -#ifdef USE_KART - case EXT_KART: -#endif - case EXT_PK3: - COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); - break; - default: - S_StartSound(NULL, sfx_s26d); + } + else + { + S_StartSound(NULL, sfx_menu1); + dir_on[menudepthleft] = 1; + } + refresh = false; } - } - if (refresh) - refreshdirmenu |= REFRESHDIR_NORMAL; + else + { + S_StartSound(NULL, sfx_s26d); + M_StartMessage(va("%c%s\x80\nThis folder is too deep to navigate to!\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING); + menupath[menupathindex[menudepthleft]] = 0; + } + break; + + case EXT_UP: + S_StartSound(NULL, sfx_menu1); + menupath[menupathindex[++menudepthleft]] = 0; + if (!preparefilemenu(false, false)) + { + UNEXIST; + return; + } + break; + + case EXT_TXT: + M_StartMessage(va("%c%s\x80\nThis file may not be a console script.\nAttempt to run anyways? \n\n(Press 'Y' to confirm)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),M_AddonExec,MM_YESNO); + break; + + case EXT_CFG: + M_AddonExec(KEY_ENTER); + break; + + case EXT_LUA: + case EXT_SOC: + case EXT_WAD: +#ifdef USE_KART + case EXT_KART: +#endif + case EXT_PK3: + COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); + break; + + default: + S_StartSound(NULL, sfx_s26d); } - break; - case KEY_ESCAPE: - exitmenu = true; - break; - - default: - break; + if (refresh) + refreshdirmenu |= REFRESHDIR_NORMAL; + } } + else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y)) + { + exitmenu = true; + } + + if (exitmenu) { closefilemenu(true); diff --git a/src/k_profiles.c b/src/k_profiles.c index 979c7da83..678766a7d 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -16,14 +16,15 @@ static profile_t profilesList[MAXPROFILES+1]; // +1 because we're gonna add a default "GUEST' profile. static UINT8 numprofiles = 0; // # of loaded profiles -profile_t PR_MakeProfile(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, INT32 controlarray[num_gamecontrols][MAXINPUTMAPPING]) +profile_t PR_MakeProfile(const char *prname, const char *pname, const char *sname, const UINT16 col, const char *fname, UINT16 fcol, INT32 controlarray[num_gamecontrols][MAXINPUTMAPPING]) { profile_t new; new.version = PROFILEVER; strcpy(new.profilename, prname); - + + strcpy(new.skinname, sname); strcpy(new.playername, pname); new.color = col; @@ -36,10 +37,10 @@ profile_t PR_MakeProfile(const char *prname, const char *pname, const UINT16 col return new; } -profile_t PR_MakeProfileFromPlayer(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, UINT8 pnum) +profile_t PR_MakeProfileFromPlayer(const char *prname, const char *pname, const char *sname, const UINT16 col, const char *fname, UINT16 fcol, UINT8 pnum) { // Generate profile using the player's gamecontrol, as we set them directly when making profiles from menus. - profile_t new = PR_MakeProfile(prname, pname, col, fname, fcol, gamecontrol[pnum]); + profile_t new = PR_MakeProfile(prname, pname, sname, col, fname, fcol, gamecontrol[pnum]); // Player bound cvars: new.kickstartaccel = cv_kickstartaccel[pnum].value; @@ -85,7 +86,7 @@ void PR_SaveProfiles(void) void PR_LoadProfiles(void) { //FILE *f = NULL; - profile_t dprofile = PR_MakeProfile(PROFILEDEFAULTNAME, PROFILEDEFAULTPNAME, PROFILEDEFAULTCOLOR, PROFILEDEFAULTFOLLOWER, PROFILEDEFAULTFOLLOWERCOLOR, gamecontroldefault); + profile_t dprofile = PR_MakeProfile(PROFILEDEFAULTNAME, PROFILEDEFAULTPNAME, PROFILEDEFAULTSKIN, PROFILEDEFAULTCOLOR, PROFILEDEFAULTFOLLOWER, PROFILEDEFAULTFOLLOWERCOLOR, gamecontroldefault); PR_AddProfile(dprofile); /*f = fopen(PROFILESFILE, "r"); diff --git a/src/k_profiles.h b/src/k_profiles.h index 7611fa43f..fb68d3f85 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -30,7 +30,7 @@ #define MAXPROFILES 16 #define PROFILESFILE "kartprofiles.cfg" -#define PROFILEDEFAULTNAME "GUEST" +#define PROFILEDEFAULTNAME "guest" #define PROFILEDEFAULTPNAME "Player" #define PROFILEDEFAULTSKIN "sonic" #define PROFILEDEFAULTCOLOR SKINCOLOR_SAPPHIRE @@ -52,6 +52,7 @@ typedef struct profile_s // Player data char playername[MAXPLAYERNAME+1]; // Player name + char skinname[SKINNAMESIZE+1]; // Default Skin UINT16 color; // Default player coloUr. ...But for consistency we'll name it color. char follower[SKINNAMESIZE+1]; // Follower UINT16 followercolor; // Follower color @@ -70,12 +71,12 @@ typedef struct profile_s // PR_MakeProfile // Makes a profile from the supplied profile name, player name, colour, follower, followercolour and controls. // The consvar values are left untouched. -profile_t PR_MakeProfile(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, INT32 controlarray[num_gamecontrols][MAXINPUTMAPPING]); +profile_t PR_MakeProfile(const char *prname, const char *pname, const char *sname, const UINT16 col, const char *fname, UINT16 fcol, INT32 controlarray[num_gamecontrols][MAXINPUTMAPPING]); // PR_MakeProfileFromPlayer // Makes a profile_t from the supplied profile name, player name, colour, follower and followercolour. // The last argument is a player number to read cvars from; as for convenience, cvars will be set directly when making a profile (since loading another one will overwrite them, this will be inconsequential) -profile_t PR_MakeProfileFromPlayer(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, UINT8 pnum); +profile_t PR_MakeProfileFromPlayer(const char *prname, const char *pname, const char *sname, const UINT16 col, const char *fname, UINT16 fcol, UINT8 pnum); // PR_AddProfile(profile_t p) // Adds a profile to profilesList and increments numprofiles.