Restrict control changes if tutorialgcs is active

This commit is contained in:
mazmazz 2018-11-12 16:56:06 -05:00
parent 45381058b3
commit 4986d5945b
3 changed files with 31 additions and 22 deletions

View File

@ -668,7 +668,6 @@ void D_AdvanceDemo(void)
void D_StartTitle(void)
{
INT32 i;
boolean tutorialpostprompt = false;
S_StopMusic();
@ -713,16 +712,6 @@ void D_StartTitle(void)
// reset modeattacking
modeattacking = ATTACKING_NONE;
// The title screen is obviously not a tutorial! (Unless I'm mistaken)
if (tutorialmode)
{
// check if retained controls are custom
tutorialpostprompt = (G_GetControlScheme(gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial) == gcs_custom
&& G_GetControlScheme(gamecontrol, gclist_tutorial, num_gclist_tutorial) != gcs_custom);
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
}
tutorialmode = false;
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
maptol = 0;
@ -746,9 +735,14 @@ void D_StartTitle(void)
if (rendermode != render_none)
V_SetPaletteLump("PLAYPAL");
if (tutorialpostprompt)
M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm, \nor any key to keep \nyour current controls.",
// The title screen is obviously not a tutorial! (Unless I'm mistaken)
if (tutorialmode && tutorialgcs)
{
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
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);
}
tutorialmode = false;
}
//

View File

@ -1808,7 +1808,7 @@ static void Command_Map_f(void)
else
fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP)));
if (tutorialmode)
if (tutorialmode && tutorialgcs)
G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gclist_tutorial, num_gclist_tutorial); // using gcs_custom as temp storage
tutorialmode = false; // warping takes us out of tutorial mode

View File

@ -6138,7 +6138,7 @@ void M_TutorialSaveControlResponse(INT32 ch)
{
if (ch == 'y' || ch == KEY_ENTER)
{
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], gclist_tutorial, num_gclist_tutorial);
G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gclist_tutorial, num_gclist_tutorial);
S_StartSound(NULL, sfx_itemup);
}
else
@ -6149,14 +6149,18 @@ static void M_TutorialControlResponse(INT32 ch)
{
if (ch != KEY_ESCAPE)
{
G_CopyControls(gamecontroldefault[gcs_custom], gamecontrol, NULL, 0);
G_CopyControls(gamecontroldefault[gcs_custom], gamecontrol, NULL, 0); // using gcs_custom as temp storage for old controls
if (ch == 'y' || ch == KEY_ENTER)
{
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], gclist_tutorial, num_gclist_tutorial);
tutorialgcs = gcs_fps;
G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gclist_tutorial, num_gclist_tutorial);
//S_StartSound(NULL, sfx_itemup);
}
else
{
tutorialgcs = gcs_custom;
S_StartSound(NULL, sfx_menu1);
}
M_StartTutorial(INT32_MAX);
}
@ -6172,11 +6176,11 @@ static void M_StartTutorial(INT32 choice)
if (choice != INT32_MAX && G_GetControlScheme(gamecontrol, gclist_tutorial_check, num_gclist_tutorial_check) == gcs_custom)
{
M_StartMessage("Do you want to try the \202recommended \202movement controls\x80?\n\nWe will set them just for this tutorial.\n\nPress 'Y' or 'Enter' to confirm, \nor any key to keep \nyour current controls.\n",M_TutorialControlResponse,MM_YESNO);
M_StartMessage("Do you want to try the \202recommended \202movement controls\x80?\n\nWe will set them just for this tutorial.\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls.\n",M_TutorialControlResponse,MM_YESNO);
return;
}
else if (choice != INT32_MAX)
G_CopyControls(gamecontroldefault[gcs_custom], gamecontrol, NULL, 0);
tutorialgcs = gcs_custom;
tutorialmode = true; // turn on tutorial mode
@ -9267,9 +9271,17 @@ static void M_DrawControl(void)
// draw title (or big pic)
M_DrawMenuTitle();
M_CentreText(30,
(setupcontrols_secondaryplayer ? "SET CONTROLS FOR SECONDARY PLAYER" :
"PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR"));
if (tutorialmode && tutorialgcs)
{
if ((gametic / TICRATE) % 2)
M_CentreText(30, "\202EXIT THE TUTORIAL TO CHANGE THE CONTROLS");
else
M_CentreText(30, "EXIT THE TUTORIAL TO CHANGE THE CONTROLS");
}
else
M_CentreText(30,
(setupcontrols_secondaryplayer ? "SET CONTROLS FOR SECONDARY PLAYER" :
"PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR"));
if (i)
V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A"); // up arrow
@ -9404,6 +9416,9 @@ static void M_ChangeControl(INT32 choice)
{
static char tmp[55];
if (tutorialmode && tutorialgcs) // don't allow control changes if temp control override is active
return;
controltochange = currentMenu->menuitems[choice].alphaKey;
sprintf(tmp, M_GetText("Hit the new key for\n%s\nESC for Cancel"),
currentMenu->menuitems[choice].text);