diff --git a/src/cvars.cpp b/src/cvars.cpp index 4a2fa9948..5737da301 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",