diff --git a/src/command.c b/src/command.c index b42b73a5c..eda7c0e67 100644 --- a/src/command.c +++ b/src/command.c @@ -102,6 +102,14 @@ CV_PossibleValue_t gpdifficulty_cons_t[] = { {KARTGP_MASTER, "Master"}, {0, NULL} }; +CV_PossibleValue_t descriptiveinput_cons_t[] = { + {0, "Emulator"}, + {1, "Modern"}, + {2, "6Bt. (Match)"}, + {3, "6Bt. (LB LT)"}, + {4, "6Bt. (LT RT)"}, + {5, "6bt. (LB RB)"}, +}; // Filter consvars by EXECVERSION // First implementation is 2 (1.0.2), so earlier configs default at 1 (1.0.0) diff --git a/src/command.h b/src/command.h index eabbc1b1b..98c9f4830 100644 --- a/src/command.h +++ b/src/command.h @@ -233,7 +233,7 @@ extern CV_PossibleValue_t CV_TrueFalse[]; // SRB2kart // the KARTSPEED and KARTGP were previously defined here, but moved to doomstat to avoid circular dependencies -extern CV_PossibleValue_t kartspeed_cons_t[], dummykartspeed_cons_t[], gpdifficulty_cons_t[]; +extern CV_PossibleValue_t kartspeed_cons_t[], dummykartspeed_cons_t[], gpdifficulty_cons_t[], descriptiveinput_cons_t[]; extern consvar_t cv_cheats; extern consvar_t cv_execversion; diff --git a/src/cvars.cpp b/src/cvars.cpp index 7537ba2ca..f292b6f1f 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -334,16 +334,6 @@ consvar_t cv_soundvolume = Player("soundvolume", "80").min_max(0, 100); consvar_t cv_discordstreamer = Player("discordstreamer", "Off").on_off(); #endif -consvar_t cv_descriptiveinput = Player("descriptiveinput", "Modern") - .values({ - {0, "Emulator"}, - {1, "Modern"}, - {2, "6Bt. (LB LT)"}, - {3, "6Bt. (LT RT)"}, - {4, "6bt. (LB RB)"}, - } -); // Display bound controls instead of Saturn buttons - consvar_t cv_drawdist = Player("drawdist", "Normal").values({ {3072, "Shortest"}, {4096, "Shorter"}, @@ -989,6 +979,7 @@ consvar_t cv_dummymenuplayer = MenuDummy("dummymenuplayer", "P1").onchange(Dummy consvar_t cv_dummyprofileautoroulette = MenuDummy("dummyprofileautoroulette", "Off").on_off(); consvar_t cv_dummyprofilefov = MenuDummy("dummyprofilefov", "100").min_max(70, 110); consvar_t cv_dummyprofilelitesteer = MenuDummy("dummyprofilelitesteer", "Off").on_off(); +consvar_t cv_dummyprofiledescriptiveinput = Player("dummyprofiledescriptiveinput", "Modern").values(descriptiveinput_cons_t); consvar_t cv_dummyprofileautoring = MenuDummy("dummyprofileautoring", "Off").on_off(); consvar_t cv_dummyprofilekickstart = MenuDummy("dummyprofilekickstart", "Off").on_off(); consvar_t cv_dummyprofilename = MenuDummy("dummyprofilename", ""); @@ -1123,6 +1114,14 @@ consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS] = { Player("cam4_height", "95").floating_point(), }; +consvar_t cv_descriptiveinput[MAXSPLITSCREENPLAYERS] = { + Player("descriptiveinput", "Modern").values(descriptiveinput_cons_t), + Player("descriptiveinput2", "Modern").values(descriptiveinput_cons_t), + Player("descriptiveinput3", "Modern").values(descriptiveinput_cons_t), + Player("descriptiveinput4", "Modern").values(descriptiveinput_cons_t), +}; + + void CV_CamRotate_OnChange(void); void CV_CamRotate2_OnChange(void); void CV_CamRotate3_OnChange(void); diff --git a/src/g_game.h b/src/g_game.h index 5d33303c8..221643c04 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -105,6 +105,8 @@ extern consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_descriptiveinput[MAXSPLITSCREENPLAYERS]; + extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; // mouseaiming (looking up/down with the mouse or keyboard) diff --git a/src/k_menu.h b/src/k_menu.h index 116caa793..7f49fa60f 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1124,6 +1124,7 @@ extern consvar_t cv_dummyprofileplayername; extern consvar_t cv_dummyprofilekickstart; extern consvar_t cv_dummyprofileautoroulette; extern consvar_t cv_dummyprofilelitesteer; +extern consvar_t cv_dummyprofiledescriptiveinput; extern consvar_t cv_dummyprofileautoring; extern consvar_t cv_dummyprofilerumble; extern consvar_t cv_dummyprofilefov; diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 750ea395b..7fec31182 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -5094,7 +5094,7 @@ void M_DrawProfileControls(void) V_DrawMenuString(x, y+2, (i == itemOn ? highlightflags : 0), currentMenu->menuitems[i].text); if (currentMenu->menuitems[i].status & IT_CVAR) // not the proper way to check but this menu only has normal onoff cvars. - { + { // (bitch you thought - Tyron 2024-09-22) INT32 w; consvar_t *cv = currentMenu->menuitems[i].itemaction.cvar; diff --git a/src/k_profiles.cpp b/src/k_profiles.cpp index f054e84d3..0098a0a86 100644 --- a/src/k_profiles.cpp +++ b/src/k_profiles.cpp @@ -82,6 +82,7 @@ profile_t* PR_MakeProfile( newprofile->kickstartaccel = false; newprofile->autoroulette = false; newprofile->litesteer = false; + newprofile->descriptiveinput = 1; newprofile->autoring = false; newprofile->rumble = true; newprofile->fov = atoi(cv_dummyprofilefov.defaultvalue); @@ -104,6 +105,7 @@ profile_t* PR_MakeProfileFromPlayer(const char *prname, const char *pname, const newprofile->kickstartaccel = cv_kickstartaccel[pnum].value; newprofile->autoroulette = cv_autoroulette[pnum].value; newprofile->litesteer = cv_litesteer[pnum].value; + newprofile->descriptiveinput = cv_descriptiveinput[pnum].value; newprofile->autoring = cv_autoring[pnum].value; newprofile->rumble = cv_rumble[pnum].value; newprofile->fov = cv_fov[pnum].value / FRACUNIT; @@ -301,6 +303,7 @@ void PR_SaveProfiles(void) jsonprof.preferences.kickstartaccel = cprof->kickstartaccel; jsonprof.preferences.autoroulette = cprof->autoroulette; jsonprof.preferences.litesteer = cprof->litesteer; + jsonprof.preferences.descriptiveinput = cprof->descriptiveinput; jsonprof.preferences.autoring = cprof->autoring; jsonprof.preferences.rumble = cprof->rumble; jsonprof.preferences.fov = cprof->fov; @@ -486,6 +489,7 @@ void PR_LoadProfiles(void) newprof->kickstartaccel = jsprof.preferences.kickstartaccel; newprof->autoroulette = jsprof.preferences.autoroulette; newprof->litesteer = jsprof.preferences.litesteer; + newprof->descriptiveinput = jsprof.preferences.descriptiveinput; newprof->autoring = jsprof.preferences.autoring; newprof->rumble = jsprof.preferences.rumble; newprof->fov = jsprof.preferences.fov; @@ -568,6 +572,7 @@ static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum) CV_StealthSetValue(&cv_kickstartaccel[playernum], p->kickstartaccel); CV_StealthSetValue(&cv_autoroulette[playernum], p->autoroulette); CV_StealthSetValue(&cv_litesteer[playernum], p->litesteer); + CV_StealthSetValue(&cv_descriptiveinput[playernum], p->descriptiveinput); CV_StealthSetValue(&cv_autoring[playernum], p->autoring); CV_StealthSetValue(&cv_rumble[playernum], p->rumble); CV_StealthSetValue(&cv_fov[playernum], p->fov); @@ -581,11 +586,16 @@ static void PR_ApplyProfile_Memory(UINT8 profilenum, UINT8 playernum) // set memory cvar CV_StealthSetValue(&cv_lastprofile[playernum], profilenum); + CONS_Printf("Applying profile memory %d to player %d", profilenum, playernum); + // If we're doing this on P1, also change current profile. if (playernum == 0) { CV_StealthSetValue(&cv_currprofile, profilenum); + CONS_Printf(" and swapping currprofile"); } + + CONS_Printf("\n"); } void PR_ApplyProfile(UINT8 profilenum, UINT8 playernum) diff --git a/src/k_profiles.h b/src/k_profiles.h index 988101f98..fea61ebf8 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -46,6 +46,7 @@ struct ProfilePreferencesJson bool kickstartaccel; bool autoroulette; bool litesteer; + uint8_t descriptiveinput; bool autoring; bool rumble; uint8_t fov; @@ -56,6 +57,7 @@ struct ProfilePreferencesJson kickstartaccel, autoroulette, litesteer, + descriptiveinput, autoring, rumble, fov @@ -162,6 +164,7 @@ struct profile_t boolean kickstartaccel; // cv_kickstartaccel boolean autoroulette; // cv_autoroulette boolean litesteer; // cv_litesteer + UINT8 descriptiveinput; // cv_descriptiveinput boolean autoring; // cv_autoring boolean rumble; // cv_rumble UINT8 fov; // cv_fov diff --git a/src/menus/options-hud-1.c b/src/menus/options-hud-1.c index a977881d5..35eb45895 100644 --- a/src/menus/options-hud-1.c +++ b/src/menus/options-hud-1.c @@ -13,8 +13,6 @@ #include "../r_main.h" // cv_showhud #include "../v_video.h" // cv_constextsize -extern consvar_t cv_descriptiveinput; - menuitem_t OPTIONS_HUD[] = { @@ -39,12 +37,6 @@ menuitem_t OPTIONS_HUD[] = {IT_SPACE | IT_NOTHING, NULL, NULL, NULL, {NULL}, 0, 0}, - {IT_STRING | IT_CVAR, "Use Button Names", "Choose which controller prompts to show. \"Emulator\" = ignore your mapped controls.", - NULL, {.cvar = &cv_descriptiveinput}, 0, 0}, - - {IT_SPACE | IT_NOTHING, NULL, NULL, - NULL, {NULL}, 0, 0}, - {IT_STRING | IT_SUBMENU, "Online Chat Options...", "Visual options for the online chat box.", NULL, {.submenu = &OPTIONS_HUDOnlineDef}, 0, 0}, }; diff --git a/src/menus/options-profiles-1.c b/src/menus/options-profiles-1.c index e7c31449c..047ad6148 100644 --- a/src/menus/options-profiles-1.c +++ b/src/menus/options-profiles-1.c @@ -102,6 +102,7 @@ void M_StartEditProfile(INT32 c) CV_StealthSetValue(&cv_dummyprofilekickstart, optionsmenu.profile->kickstartaccel); CV_StealthSetValue(&cv_dummyprofileautoroulette, optionsmenu.profile->autoroulette); CV_StealthSetValue(&cv_dummyprofilelitesteer, optionsmenu.profile->litesteer); + CV_StealthSetValue(&cv_dummyprofiledescriptiveinput, optionsmenu.profile->descriptiveinput); CV_StealthSetValue(&cv_dummyprofileautoring, optionsmenu.profile->autoring); CV_StealthSetValue(&cv_dummyprofilerumble, optionsmenu.profile->rumble); CV_StealthSetValue(&cv_dummyprofilefov, optionsmenu.profile->fov); @@ -113,6 +114,7 @@ void M_StartEditProfile(INT32 c) CV_StealthSetValue(&cv_dummyprofilekickstart, 0); // off CV_StealthSetValue(&cv_dummyprofileautoroulette, 0); // off CV_StealthSetValue(&cv_dummyprofilelitesteer, 1); // on + CV_StealthSetValue(&cv_dummyprofiledescriptiveinput, 1); // Modern CV_StealthSetValue(&cv_dummyprofileautoring, 0); // on CV_StealthSetValue(&cv_dummyprofilerumble, 1); // on CV_StealthSetValue(&cv_dummyprofilefov, 90); diff --git a/src/menus/options-profiles-edit-1.c b/src/menus/options-profiles-edit-1.c index 8bdd552c2..97b2b2c16 100644 --- a/src/menus/options-profiles-edit-1.c +++ b/src/menus/options-profiles-edit-1.c @@ -98,6 +98,7 @@ static void M_ProfileEditApply(void) optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; optionsmenu.profile->litesteer = cv_dummyprofilelitesteer.value; + optionsmenu.profile->descriptiveinput = cv_dummyprofiledescriptiveinput.value; optionsmenu.profile->autoring = cv_dummyprofileautoring.value; optionsmenu.profile->rumble = cv_dummyprofilerumble.value; optionsmenu.profile->fov = cv_dummyprofilefov.value; diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index 69deb89df..7f5e6e18f 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -99,6 +99,9 @@ menuitem_t OPTIONS_ProfileControls[] = { {IT_STRING | IT_CALL, "TRY MAPPINGS", "Test your controls.", NULL, {.routine = M_ProfileTryController}, 0, 0}, + {IT_STRING2 | IT_CVAR, "Show Button Names", "Change how help text displays your controls.", + NULL, {.cvar = &cv_dummyprofiledescriptiveinput}, 0, 0}, + {IT_STRING | IT_CALL, "RESET TO DEFAULT", "Reset all controls back to default.", NULL, {.routine = M_ProfileDefaultControls}, 0, 0}, diff --git a/src/v_draw.cpp b/src/v_draw.cpp index d822617e8..191aaa737 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -229,37 +229,65 @@ Draw::TextElement& Draw::TextElement::parse(std::string_view raw) } else if (auto it = translation.find(code); it != translation.end()) // This represents a gamecontrol, turn into Saturn button or generic button. { + + UINT8 localplayer = 0; + UINT8 indexedplayer = as_.value_or(stplyr - players); + for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + if (g_localplayers[i] == indexedplayer) + { + localplayer = i; + break; + } + } + // This isn't how v_video.cpp checks for buttons and I don't know why. - if (cv_descriptiveinput.value && ((it->second & 0xF0) != 0x80)) // Should we do game control translation? + if (cv_descriptiveinput[localplayer].value && ((it->second & 0xF0) != 0x80)) // Should we do game control translation? { if (auto id = inputdefinition.find(it->second & (~0xB0)); id != inputdefinition.end()) // This is a game control, do descriptive input translation! { // Grab our local controls - if pid set in the call to parse(), use stplyr's controls - UINT8 localplayer = 0; - UINT8 indexedplayer = as_.value_or(stplyr - players); - for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - if (g_localplayers[i] == indexedplayer) - { - localplayer = i; - break; - } - } - INT32 bind = G_FindPlayerBindForGameControl(localplayer, id->second); // EXTRA: descriptiveinput values above 1 translate binds back to Saturn buttons, // with various modes for various fucked up 6bt pads std::unordered_map saturnconfig = {}; - switch (cv_descriptiveinput.value) + switch (cv_descriptiveinput[localplayer].value) { case 2: + { + INT32 leftbumper = G_FindPlayerBindForGameControl(localplayer, gc_l); + INT32 rightbumper = G_FindPlayerBindForGameControl(localplayer, gc_r); + + if (leftbumper == KEY_JOY1+9 && rightbumper == KEY_AXIS1+8) + { + saturnconfig = saturntype1; // LB LT + // CONS_Printf("Saturn type 1\n"); + } + else if (leftbumper == KEY_AXIS1+8 && rightbumper == KEY_AXIS1+9) + { + saturnconfig = saturntype2; // LT RT + // CONS_Printf("Saturn type 2\n"); + } + else if (leftbumper == KEY_JOY1+9 && rightbumper == KEY_JOY1+10) + { + saturnconfig = saturntype3; // LB RB + // CONS_Printf("Saturn type 3\n"); + } + else + { + saturnconfig = saturntype1; // :( ??? + // CONS_Printf("Unknown, falling back to type 1\n"); + } + break; + } + case 3: saturnconfig = saturntype1; break; - case 3: + case 4: saturnconfig = saturntype2; break; - case 4: + case 5: saturnconfig = saturntype3; break; } diff --git a/src/v_draw.hpp b/src/v_draw.hpp index e10faf733..e99e80fee 100644 --- a/src/v_draw.hpp +++ b/src/v_draw.hpp @@ -24,8 +24,6 @@ #include "typedef.h" #include "v_video.h" -extern consvar_t cv_descriptiveinput; - namespace srb2 {