Menus/Accessibility: add FOV option, 70 to 110

Adds FOV to profiles json
This commit is contained in:
James R 2024-03-04 22:11:19 -08:00
parent 6ff9fee9fc
commit df2e4f57fd
7 changed files with 22 additions and 2 deletions

View file

@ -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", "");

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -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",