From df2e4f57fd2f883e092d2d820f7806c9bc82b17b Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 4 Mar 2024 22:11:19 -0800 Subject: [PATCH 1/6] Menus/Accessibility: add FOV option, 70 to 110 Adds FOV to profiles json --- src/cvars.cpp | 1 + src/k_menu.h | 1 + src/k_profiles.cpp | 7 +++++++ src/k_profiles.h | 5 ++++- src/menus/options-profiles-1.c | 2 ++ src/menus/options-profiles-edit-1.c | 3 +++ src/menus/options-profiles-edit-accessibility.cpp | 5 ++++- 7 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/cvars.cpp b/src/cvars.cpp index 521fefb27..97e407b10 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -951,6 +951,7 @@ void Dummymenuplayer_OnChange(void); consvar_t cv_dummymenuplayer = MenuDummy("dummymenuplayer", "P1").onchange(Dummymenuplayer_OnChange).values({{0, "NOPE"}, {1, "P1"}, {2, "P2"}, {3, "P3"}, {4, "P4"}}); consvar_t cv_dummyprofileautoroulette = MenuDummy("dummyprofileautoroulette", "Off").on_off(); +consvar_t cv_dummyprofilefov = MenuDummy("dummyprofilefov", "90").min_max(70, 110); consvar_t cv_dummyprofilelitesteer = MenuDummy("dummyprofilelitesteer", "On").on_off(); consvar_t cv_dummyprofilekickstart = MenuDummy("dummyprofilekickstart", "Off").on_off(); consvar_t cv_dummyprofilename = MenuDummy("dummyprofilename", ""); diff --git a/src/k_menu.h b/src/k_menu.h index ae093bf1c..2088a8470 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1047,6 +1047,7 @@ extern consvar_t cv_dummyprofilekickstart; extern consvar_t cv_dummyprofileautoroulette; extern consvar_t cv_dummyprofilelitesteer; extern consvar_t cv_dummyprofilerumble; +extern consvar_t cv_dummyprofilefov; void M_ResetOptions(void); void M_InitOptions(INT32 choice); // necessary for multiplayer since there's some options we won't want to access diff --git a/src/k_profiles.cpp b/src/k_profiles.cpp index ccec96ad9..2e123c7e5 100644 --- a/src/k_profiles.cpp +++ b/src/k_profiles.cpp @@ -28,6 +28,8 @@ #include "k_color.h" #include "command.h" +extern "C" consvar_t cv_dummyprofilefov, cv_fov[MAXSPLITSCREENPLAYERS]; + CV_PossibleValue_t lastprofile_cons_t[] = {{-1, "MIN"}, {MAXPROFILES, "MAX"}, {0, NULL}}; // List of all the profiles. @@ -79,6 +81,7 @@ profile_t* PR_MakeProfile( newprofile->autoroulette = false; newprofile->litesteer = true; newprofile->rumble = true; + newprofile->fov = atoi(cv_dummyprofilefov.defaultvalue); // Copy from gamecontrol directly as we'll be setting controls up directly in the profile. memcpy(newprofile->controls, controlarray, sizeof(newprofile->controls)); @@ -98,6 +101,7 @@ profile_t* PR_MakeProfileFromPlayer(const char *prname, const char *pname, const newprofile->autoroulette = cv_autoroulette[pnum].value; newprofile->litesteer = cv_litesteer[pnum].value; newprofile->rumble = cv_rumble[pnum].value; + newprofile->fov = cv_fov[pnum].value / FRACUNIT; return newprofile; } @@ -292,6 +296,7 @@ void PR_SaveProfiles(void) jsonprof.preferences.autoroulette = cprof->autoroulette; jsonprof.preferences.litesteer = cprof->litesteer; jsonprof.preferences.rumble = cprof->rumble; + jsonprof.preferences.fov = cprof->fov; for (size_t j = 0; j < num_gamecontrols; j++) { @@ -456,6 +461,7 @@ void PR_LoadProfiles(void) newprof->autoroulette = jsprof.preferences.autoroulette; newprof->litesteer = jsprof.preferences.litesteer; newprof->rumble = jsprof.preferences.rumble; + newprof->fov = jsprof.preferences.fov; try { @@ -495,6 +501,7 @@ static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum) CV_StealthSetValue(&cv_autoroulette[playernum], p->autoroulette); CV_StealthSetValue(&cv_litesteer[playernum], p->litesteer); CV_StealthSetValue(&cv_rumble[playernum], p->rumble); + CV_StealthSetValue(&cv_fov[playernum], p->fov); // set controls... G_ApplyControlScheme(playernum, p->controls); diff --git a/src/k_profiles.h b/src/k_profiles.h index 2fb5cf9fa..fe5f02567 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -47,6 +47,7 @@ struct ProfilePreferencesJson bool autoroulette; bool litesteer; bool rumble; + uint8_t fov; tm test; NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT( @@ -54,7 +55,8 @@ struct ProfilePreferencesJson kickstartaccel, autoroulette, litesteer, - rumble + rumble, + fov ) }; @@ -153,6 +155,7 @@ struct profile_t boolean autoroulette; // cv_autoroulette boolean litesteer; // cv_litesteer boolean rumble; // cv_rumble + UINT8 fov; // cv_fov // Finally, control data itself INT32 controls[num_gamecontrols][MAXINPUTMAPPING]; // Lists of all the controls, defined the same way as default inputs in g_input.c diff --git a/src/menus/options-profiles-1.c b/src/menus/options-profiles-1.c index 7c82d12e5..8a81dadfb 100644 --- a/src/menus/options-profiles-1.c +++ b/src/menus/options-profiles-1.c @@ -93,6 +93,7 @@ void M_StartEditProfile(INT32 c) CV_StealthSetValue(&cv_dummyprofileautoroulette, optionsmenu.profile->autoroulette); CV_StealthSetValue(&cv_dummyprofilelitesteer, optionsmenu.profile->litesteer); CV_StealthSetValue(&cv_dummyprofilerumble, optionsmenu.profile->rumble); + CV_StealthSetValue(&cv_dummyprofilefov, optionsmenu.profile->fov); } else { @@ -102,6 +103,7 @@ void M_StartEditProfile(INT32 c) CV_StealthSetValue(&cv_dummyprofileautoroulette, 0); // off CV_StealthSetValue(&cv_dummyprofilelitesteer, 1); // on CV_StealthSetValue(&cv_dummyprofilerumble, 1); // on + CV_StealthSetValue(&cv_dummyprofilefov, 90); } // Setup greyout and stuff. diff --git a/src/menus/options-profiles-edit-1.c b/src/menus/options-profiles-edit-1.c index 9fe9997b3..65eca8819 100644 --- a/src/menus/options-profiles-edit-1.c +++ b/src/menus/options-profiles-edit-1.c @@ -90,15 +90,18 @@ static void M_ProfileEditApply(void) optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; optionsmenu.profile->litesteer = cv_dummyprofilelitesteer.value; optionsmenu.profile->rumble = cv_dummyprofilerumble.value; + optionsmenu.profile->fov = cv_dummyprofilefov.value; // If this profile is in-use by anyone, apply the changes immediately upon exiting. // Don't apply the profile itself as that would lead to issues mid-game. if (belongsto > -1 && belongsto < MAXSPLITSCREENPLAYERS) { + extern consvar_t cv_fov[MAXSPLITSCREENPLAYERS]; CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value); CV_SetValue(&cv_autoroulette[belongsto], cv_dummyprofileautoroulette.value); CV_SetValue(&cv_litesteer[belongsto], cv_dummyprofilelitesteer.value); CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value); + CV_SetValue(&cv_fov[belongsto], cv_dummyprofilefov.value); } // Reapply player 1's real profile. diff --git a/src/menus/options-profiles-edit-accessibility.cpp b/src/menus/options-profiles-edit-accessibility.cpp index ca031279c..1c8d6ca88 100644 --- a/src/menus/options-profiles-edit-accessibility.cpp +++ b/src/menus/options-profiles-edit-accessibility.cpp @@ -102,6 +102,9 @@ menuitem_t OPTIONS_ProfileAccessibility[] = { {IT_STRING | IT_CVAR, "Lite Steer", "Hold DOWN on d-pad/keyboard for shallow turns.", NULL, {.cvar = &cv_dummyprofilelitesteer}, 0, 0}, + {IT_STRING | IT_CVAR, "Field of View", "Higher FOV lets you see more.", + NULL, {.cvar = &cv_dummyprofilefov}, 0, 0}, + {IT_SPACE | IT_NOTHING, NULL, NULL, NULL, {NULL}, 0, 0}, @@ -129,7 +132,7 @@ menu_t OPTIONS_ProfileAccessibilityDef = { &OPTIONS_EditProfileDef, 0, OPTIONS_ProfileAccessibility, - 145, 52, + 145, 41, SKINCOLOR_ULTRAMARINE, 0, MBF_DRAWBGWHILEPLAYING, "FILE", From e5059bfced59b586112ac190e9635ec6fd661887 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 5 Mar 2024 00:15:07 -0800 Subject: [PATCH 2/6] Menus/Accessibility: Input Display Yes/No -> On/Off --- src/cvars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cvars.cpp b/src/cvars.cpp index 521fefb27..4a2fa9948 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -356,7 +356,7 @@ consvar_t cv_drawdist_precip = Player("drawdist_precip", "1024").values({ {0, "None"}, }); -consvar_t cv_drawinput = Player("drawinput", "No").yes_no(); +consvar_t cv_drawinput = Player("drawinput", "Off").on_off(); consvar_t cv_ffloorclip = Player("ffloorclip", "On").on_off(); consvar_t cv_fpscap = Player("fpscap", "Match refresh rate").values({ From e86ae4b22b052c19efca448fb91b62b109d1a18b Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 5 Mar 2024 02:56:34 -0800 Subject: [PATCH 3/6] G_AddGhost, G_GetStaffGhostBrief: fix bugged unlockables code This was causing the following crash: I_Error(): Ghost is not a record attack ghost DXD (ziptic = 1) --- src/g_demo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_demo.cpp b/src/g_demo.cpp index fbeb4d98d..444138b21 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -3591,7 +3591,7 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname) // Skip unlockables { UINT32 unlockables = READUINT32(p); - p += std::min(unlockables, MAXUNLOCKABLES); + p += unlockables; } p++; // mapmusrng @@ -3814,7 +3814,7 @@ staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer) // Skip unlockables { UINT32 unlockables = READUINT32(p); - p += std::min(unlockables, MAXUNLOCKABLES); + p += unlockables; } p++; // mapmusrng From 6023fa4825abefd851ec25a98c57bf2ca4c3899d Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 5 Mar 2024 14:48:09 -0600 Subject: [PATCH 4/6] Only record tumble time for machine local players --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 38f32762c..084b0c244 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8095,7 +8095,7 @@ void K_KartPlayerHUDUpdate(player_t *player) else player->karthud[khud_finish] = 0; - if (demo.playback == false && P_IsLocalPlayer(player) == true) + if (demo.playback == false && P_IsMachineLocalPlayer(player) == true) { if (player->tumbleBounces != 0 && gamedata->totaltumbletime != UINT32_MAX) { From 3386c70f9c73bec4883cf2853e2be4aeb5af6b93 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 5 Mar 2024 14:49:18 -0600 Subject: [PATCH 5/6] Record skin wins only for machine local players --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 7adfa49ea..13da816e4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1314,7 +1314,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags) PR_SaveProfiles(); } - if (P_IsLocalPlayer(player) && player->skin < numskins) + if (P_IsMachineLocalPlayer(player) && player->skin < numskins) { skins[player->skin].records.wins++; } From fb3beef84cec5f8ac0fef0bea88c6992b9e8efa7 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 5 Mar 2024 14:49:51 -0600 Subject: [PATCH 6/6] Only do replay save btn for machine-local players --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 13da816e4..179a2792a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1320,7 +1320,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags) } } - if (!demo.savebutton && P_IsLocalPlayer(player)) + if (!demo.savebutton && P_IsMachineLocalPlayer(player)) demo.savebutton = leveltime; } }