diff --git a/src/k_menu.h b/src/k_menu.h index b273cc581..0f8e0b237 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -220,6 +220,13 @@ extern menu_t OPTIONS_HUDDef; extern menuitem_t OPTIONS_HUDOnline[]; extern menu_t OPTIONS_HUDOnlineDef; +extern menuitem_t OPTIONS_Gameplay[]; +extern menu_t OPTIONS_GameplayDef; + +extern menuitem_t OPTIONS_GameplayItems[]; +extern menu_t OPTIONS_GameplayItemsDef; + + // PAUSE extern menuitem_t PAUSE_Main[]; extern menu_t PAUSE_MainDef; @@ -500,6 +507,8 @@ boolean M_OptionsInputs(INT32 ch); boolean M_OptionsQuit(void); // resets buttons when you quit the options. +void M_HandleItemToggles(INT32 choice); // For item toggling + // video modes menu (resolution) void M_VideoModeMenu(INT32 choice); @@ -595,6 +604,7 @@ void M_DrawOptionsMovingButton(void); // for sick transitions... void M_DrawOptions(void); void M_DrawGenericOptions(void); void M_DrawVideoModes(void); +void M_DrawItemToggles(void); // Misc menus: #define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!" diff --git a/src/k_menudef.c b/src/k_menudef.c index 6abb80e56..8e2df8a5c 100644 --- a/src/k_menudef.c +++ b/src/k_menudef.c @@ -314,7 +314,7 @@ menuitem_t OPTIONS_Main[] = NULL, &OPTIONS_HUDDef, 0, 0}, {IT_STRING | IT_SUBMENU, "Gameplay Options", "Change various game related options", - NULL, NULL, 0, 0}, + NULL, &OPTIONS_GameplayDef, 0, 0}, {IT_STRING | IT_SUBMENU, "Server Options", "Change various specific options for your game server.", NULL, NULL, 0, 0}, @@ -553,7 +553,7 @@ menuitem_t OPTIONS_HUD[] = {IT_STRING | IT_CVAR | IT_CV_SLIDER, "Minimap Opacity", "Changes the opacity of the minimap.", NULL, &cv_kartminimap, 0, 0}, - {IT_STRING | IT_CVAR, "Speedometer Display", "Choose to what speed unit to display or toggle off the speedometer.", + {IT_STRING | IT_CVAR, "Speedometer", "Choose to what speed unit to display or toggle off the speedometer.", NULL, &cv_kartspeedometer, 0, 0}, {IT_STRING | IT_CVAR, "Display \"CHECK\"", "Displays an icon when a player is tailing you.", @@ -640,6 +640,102 @@ menu_t OPTIONS_HUDOnlineDef = { NULL, }; + +menuitem_t OPTIONS_Gameplay[] = +{ + + {IT_STRING | IT_CVAR, "Game Speed", "Change Game Speed for the next map.", + NULL, &cv_kartspeed, 0, 0}, + + {IT_STRING | IT_CVAR, "Base Lap Count", "Change how many laps must be completed per race.", + NULL, &cv_kartspeed, 0, 0}, + + {IT_STRING | IT_CVAR, "Frantic Items", "Make item odds crazier with more powerful items!", + NULL, &cv_kartfrantic, 0, 0}, + + {IT_STRING | IT_CVAR, "Encore Mode", "Forces Encore Mode on for the next map.", + NULL, &cv_kartencore, 0, 0}, + + {IT_STRING | IT_CVAR, "Exit Countdown", "How long players have to finish after 1st place finishes.", + NULL, &cv_countdowntime, 0, 0}, + + {IT_SPACE | IT_NOTHING, NULL, NULL, + NULL, NULL, 0, 0}, + + {IT_STRING | IT_CVAR, "Time Limit", "Change the time limit for Battle rounds.", + NULL, &cv_timelimit, 0, 0}, + + {IT_STRING | IT_CVAR, "Starting Bumpers", "Change how many bumpers player start with in Battle.", + NULL, &cv_kartbumpers, 0, 0}, + + {IT_STRING | IT_CVAR, "Karma Comeback", "Enable Karma Comeback in Battle mode.", + NULL, &cv_kartcomeback, 0, 0}, + + {IT_SPACE | IT_NOTHING, NULL, NULL, + NULL, NULL, 0, 0}, + + {IT_STRING | IT_SUBMENU, "Random Item Toggles...", "Change which items to enable for your games.", + NULL, &OPTIONS_GameplayItemsDef, 0, 0}, + +}; + +menu_t OPTIONS_GameplayDef = { + sizeof (OPTIONS_Gameplay) / sizeof (menuitem_t), + &OPTIONS_MainDef, + 0, + OPTIONS_Gameplay, + 48, 80, + 2, 10, + M_DrawGenericOptions, + M_OptionsTick, + NULL, + NULL, +}; + +menuitem_t OPTIONS_GameplayItems[] = +{ + // Mostly handled by the drawing function. + {IT_KEYHANDLER | IT_NOTHING, "Sneakers", NULL, NULL, M_HandleItemToggles, KITEM_SNEAKER, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Sneakers x3", NULL, NULL, M_HandleItemToggles, KRITEM_TRIPLESNEAKER, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Toggle All", NULL, NULL, M_HandleItemToggles, 0, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Rocket Sneakers", NULL, NULL, M_HandleItemToggles, KITEM_ROCKETSNEAKER, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Bananas", NULL, NULL, M_HandleItemToggles, KITEM_BANANA, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Bananas x3", NULL, NULL, M_HandleItemToggles, KRITEM_TRIPLEBANANA, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Bananas x10", NULL, NULL, M_HandleItemToggles, KRITEM_TENFOLDBANANA, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Eggman Monitors", NULL, NULL, M_HandleItemToggles, KITEM_EGGMAN, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Orbinauts", NULL, NULL, M_HandleItemToggles, KITEM_ORBINAUT, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Orbinauts x3", NULL, NULL, M_HandleItemToggles, KRITEM_TRIPLEORBINAUT, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Orbinauts x4", NULL, NULL, M_HandleItemToggles, KRITEM_QUADORBINAUT, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Mines", NULL, NULL, M_HandleItemToggles, KITEM_MINE, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Jawz", NULL, NULL, M_HandleItemToggles, KITEM_JAWZ, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Jawz x2", NULL, NULL, M_HandleItemToggles, KRITEM_DUALJAWZ, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Ballhogs", NULL, NULL, M_HandleItemToggles, KITEM_BALLHOG, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Self-Propelled Bombs", NULL, NULL, M_HandleItemToggles, KITEM_SPB, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Invinciblity", NULL, NULL, M_HandleItemToggles, KITEM_INVINCIBILITY, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Grow", NULL, NULL, M_HandleItemToggles, KITEM_GROW, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Shrink", NULL, NULL, M_HandleItemToggles, KITEM_SHRINK, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Thunder Shields", NULL, NULL, M_HandleItemToggles, KITEM_THUNDERSHIELD, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Bubble Shields", NULL, NULL, M_HandleItemToggles, KITEM_BUBBLESHIELD, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Flame Shields", NULL, NULL, M_HandleItemToggles, KITEM_FLAMESHIELD, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Hyudoros", NULL, NULL, M_HandleItemToggles, KITEM_HYUDORO, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Pogo Springs", NULL, NULL, M_HandleItemToggles, KITEM_POGOSPRING, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Super Rings", NULL, NULL, M_HandleItemToggles, KITEM_SUPERRING, 0}, + {IT_KEYHANDLER | IT_NOTHING, "Kitchen Sinks", NULL, NULL, M_HandleItemToggles, KITEM_KITCHENSINK, 0}, +}; + +menu_t OPTIONS_GameplayItemsDef = { + sizeof (OPTIONS_GameplayItems) / sizeof (menuitem_t), + &OPTIONS_GameplayDef, + 0, + OPTIONS_GameplayItems, + 0, 75, + 2, 10, + M_DrawItemToggles, + M_OptionsTick, + NULL, + NULL, +}; + // ------------------- // In-game/pause menus // ------------------- diff --git a/src/k_menudraw.c b/src/k_menudraw.c index ce26c9189..e8e242c87 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -1918,6 +1918,167 @@ void M_DrawVideoModes(void) W_CachePatchName("M_CURSOR", PU_CACHE)); } +// Gameplay Item Tggles: +static tic_t shitsfree = 0; + +void M_DrawItemToggles(void) +{ + const INT32 edges = 9; + const INT32 height = 3; + const INT32 spacing = 35; + const INT32 column = itemOn/height; + //const INT32 row = itemOn%height; + INT32 leftdraw, rightdraw, totaldraw; + INT32 x = currentMenu->x + menutransition.tics*64, y = currentMenu->y+(spacing/4); + INT32 onx = 0, ony = 0; + consvar_t *cv; + INT32 i, translucent, drawnum; + + M_DrawOptionsCogs(); + M_DrawMenuTooltips(); + M_DrawOptionsMovingButton(); + + // Find the available space around column + leftdraw = rightdraw = column; + totaldraw = 0; + for (i = 0; (totaldraw < edges*2 && i < edges*4); i++) + { + if (rightdraw+1 < (currentMenu->numitems/height)+1) + { + rightdraw++; + totaldraw++; + } + if (leftdraw-1 >= 0) + { + leftdraw--; + totaldraw++; + } + } + + for (i = leftdraw; i <= rightdraw; i++) + { + INT32 j; + + for (j = 0; j < height; j++) + { + const INT32 thisitem = (i*height)+j; + + if (thisitem >= currentMenu->numitems) + continue; + + if (thisitem == itemOn) + { + onx = x; + ony = y; + y += spacing; + continue; + } + + if (currentMenu->menuitems[thisitem].mvar1 == 0) + { + V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_CACHE)); + V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISTOGL", PU_CACHE)); + continue; + } + + cv = KartItemCVars[currentMenu->menuitems[thisitem].mvar1-1]; + translucent = (cv->value ? 0 : V_TRANSLUCENT); + + switch (currentMenu->menuitems[thisitem].mvar1) + { + case KRITEM_DUALSNEAKER: + case KRITEM_DUALJAWZ: + drawnum = 2; + break; + case KRITEM_TRIPLESNEAKER: + case KRITEM_TRIPLEBANANA: + case KRITEM_TRIPLEORBINAUT: + drawnum = 3; + break; + case KRITEM_QUADORBINAUT: + drawnum = 4; + break; + case KRITEM_TENFOLDBANANA: + drawnum = 10; + break; + default: + drawnum = 0; + break; + } + + if (cv->value) + V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_CACHE)); + else + V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBGD", PU_CACHE)); + + if (drawnum != 0) + { + V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISMUL", PU_CACHE)); + V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].mvar1, true), PU_CACHE)); + V_DrawString(x+24, y+31, V_ALLOWLOWERCASE|translucent, va("x%d", drawnum)); + } + else + V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].mvar1, true), PU_CACHE)); + + y += spacing; + } + + x += spacing; + y = currentMenu->y+(spacing/4); + } + + { + if (currentMenu->menuitems[itemOn].mvar1 == 0) + { + V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_CACHE)); + V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITTOGL", PU_CACHE)); + } + else + { + cv = KartItemCVars[currentMenu->menuitems[itemOn].mvar1-1]; + translucent = (cv->value ? 0 : V_TRANSLUCENT); + + switch (currentMenu->menuitems[itemOn].mvar1) + { + case KRITEM_DUALSNEAKER: + case KRITEM_DUALJAWZ: + drawnum = 2; + break; + case KRITEM_TRIPLESNEAKER: + case KRITEM_TRIPLEBANANA: + drawnum = 3; + break; + case KRITEM_TENFOLDBANANA: + drawnum = 10; + break; + default: + drawnum = 0; + break; + } + + if (cv->value) + V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_CACHE)); + else + V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBGD", PU_CACHE)); + + if (drawnum != 0) + { + V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITMUL", PU_CACHE)); + V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].mvar1, false), PU_CACHE)); + V_DrawScaledPatch(onx+27, ony+39, translucent, W_CachePatchName("K_ITX", PU_CACHE)); + V_DrawKartString(onx+37, ony+34, translucent, va("%d", drawnum)); + } + else + V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].mvar1, false), PU_CACHE)); + } + } + + if (shitsfree) + shitsfree--; + + V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y, highlightflags, va("* %s *", currentMenu->menuitems[itemOn].text)); +} + // // INGAME / PAUSE MENUS diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 6e043bbaf..b91276feb 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -3193,6 +3193,104 @@ void M_HandleVideoModes(INT32 ch) } } +void M_HandleItemToggles(INT32 choice) +{ + const INT32 width = 9, height = 3; + INT32 column = itemOn/height, row = itemOn%height; + INT16 next; + UINT8 i; + boolean exitmenu = false; + + switch (choice) + { + 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; + + case KEY_LEFTARROW: + S_StartSound(NULL, sfx_menu1); + 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; + + 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; + + 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; + + case KEY_ENTER: +#ifdef ITEMTOGGLEBOTTOMRIGHT + if (currentMenu->menuitems[itemOn].mvar1 == 255) + { + //S_StartSound(NULL, sfx_s26d); + if (!shitsfree) + { + shitsfree = TICRATE; + S_StartSound(NULL, sfx_itfree); + } + } + else +#endif + if (currentMenu->menuitems[itemOn].mvar1 == 0) + { + 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); + } + } + else + { + S_StartSound(NULL, sfx_s1ba); + CV_AddValue(KartItemCVars[currentMenu->menuitems[itemOn].mvar1-1], 1); + } + break; + + case KEY_ESCAPE: + exitmenu = true; + break; + } + + if (exitmenu) + { + if (currentMenu->prevMenu) + M_SetupNextMenu(currentMenu->prevMenu, false); + else + M_ClearMenus(true); + } +} + // ===================== // PAUSE / IN-GAME MENUS