Change mouse cv vars temporarily alongside control scheme

This commit is contained in:
mazmazz 2018-11-12 17:24:46 -05:00
parent 44b42af22b
commit acd922886a
6 changed files with 38 additions and 1 deletions

View File

@ -739,6 +739,9 @@ void D_StartTitle(void)
if (tutorialmode && tutorialgcs)
{
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
CV_SetValue(&cv_usemouse, tutorialusemouse);
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
CV_SetValue(&cv_mousemove, tutorialmousemove);
M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls",
M_TutorialSaveControlResponse, MM_YESNO);
}

View File

@ -1809,7 +1809,12 @@ static void Command_Map_f(void)
fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP)));
if (tutorialmode && tutorialgcs)
{
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
CV_SetValue(&cv_usemouse, tutorialusemouse);
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
CV_SetValue(&cv_mousemove, tutorialmousemove);
}
tutorialmode = false; // warping takes us out of tutorial mode
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect);

View File

@ -132,6 +132,9 @@ extern INT16 bootmap; //bootmap for loading a map on startup
extern INT16 tutorialmap; // map to load for tutorial
extern boolean tutorialmode; // are we in a tutorial right now?
extern INT32 tutorialgcs; // which control scheme is loaded?
extern INT32 tutorialusemouse; // store cv_usemouse user value
extern INT32 tutorialfreelook; // store cv_alwaysfreelook user value
extern INT32 tutorialmousemove; // store cv_mousemove user value
extern boolean looptitle;

View File

@ -130,6 +130,9 @@ INT16 bootmap; //bootmap for loading a map on startup
INT16 tutorialmap = 0; // map to load for tutorial
boolean tutorialmode = false; // are we in a tutorial right now?
INT32 tutorialgcs = gcs_custom; // which control scheme is loaded?
INT32 tutorialusemouse = 0; // store cv_usemouse user value
INT32 tutorialfreelook = 0; // store cv_alwaysfreelook user value
INT32 tutorialmousemove = 0; // store cv_mousemove user value
boolean looptitle = false;

View File

@ -6139,6 +6139,9 @@ void M_TutorialSaveControlResponse(INT32 ch)
if (ch == 'y' || ch == KEY_ENTER)
{
G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gclist_tutorial, num_gclist_tutorial);
CV_SetValue(&cv_usemouse, 1);
CV_SetValue(&cv_alwaysfreelook, 0);
CV_SetValue(&cv_mousemove, 0);
S_StartSound(NULL, sfx_itemup);
}
else
@ -6153,7 +6156,15 @@ static void M_TutorialControlResponse(INT32 ch)
if (ch == 'y' || ch == KEY_ENTER)
{
tutorialgcs = gcs_fps;
tutorialusemouse = cv_usemouse.value;
tutorialfreelook = cv_alwaysfreelook.value;
tutorialmousemove = cv_mousemove.value;
G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gclist_tutorial, num_gclist_tutorial);
CV_Set(&cv_usemouse, cv_usemouse->defaultvalue);
CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook->defaultvalue);
CV_Set(&cv_mousemove, cv_mousemove->defaultvalue);
//S_StartSound(NULL, sfx_itemup);
}
else

View File

@ -539,7 +539,19 @@ void M_SaveConfig(const char *filename)
// FIXME: save key aliases if ever implemented..
CV_SaveVariables(f);
if (tutorialmode && tutorialgcs)
{
CV_SetValue(&cv_usemouse, tutorialusemouse);
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
CV_SetValue(&cv_mousemove, tutorialmousemove);
CV_SaveVariables(f);
CV_Set(&cv_usemouse, cv_usemouse->defaultvalue);
CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook->defaultvalue);
CV_Set(&cv_mousemove, cv_mousemove->defaultvalue);
}
else
CV_SaveVariables(f);
if (!dedicated)
{
if (tutorialmode && tutorialgcs)