WIP: First-time tutorial prompt

This commit is contained in:
mazmazz 2018-11-10 02:30:21 -05:00
parent a542006ae8
commit 28238c41df
3 changed files with 27 additions and 0 deletions

View File

@ -719,6 +719,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_crosshair2);
CV_RegisterVar(&cv_alwaysfreelook);
CV_RegisterVar(&cv_alwaysfreelook2);
CV_RegisterVar(&cv_postfirsttime);
// g_input.c
CV_RegisterVar(&cv_sideaxis);

View File

@ -55,6 +55,7 @@ extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard di
extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu
extern consvar_t cv_postfirsttime;
extern consvar_t cv_crosshair, cv_crosshair2;
extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove;
extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_mousemove2;

View File

@ -441,6 +441,9 @@ static CV_PossibleValue_t serversort_cons_t[] = {
};
consvar_t cv_serversort = {"serversort", "Ping", CV_HIDEN | CV_CALL, serversort_cons_t, M_SortServerList, 0, NULL, NULL, 0, 0, NULL};
// first time memory
consvar_t cv_postfirsttime = {"postfirsttime", "No", CV_HIDEN | CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
// autorecord demos for time attack
static consvar_t cv_autorecord = {"autorecord", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -6141,6 +6144,8 @@ static void M_StartTutorial(INT32 choice)
if (!tutorialmap)
return; // no map to go to, don't bother
CV_SetValue(&cv_postfirsttime, 1);
tutorialmode = true; // turn on tutorial mode
emeralds = 0;
@ -6757,6 +6762,20 @@ static void M_HandleLoadSave(INT32 choice)
}
}
static void M_TutorialResponse(INT32 ch)
{
CV_SetValue(&cv_postfirsttime, 1);
if (ch != 'y' && ch != KEY_ENTER)
{
return;
// copypasta from M_LoadGame
M_ReadSaveStrings();
M_SetupNextMenu(&SP_LoadDef);
}
else
M_StartTutorial(0);
}
//
// Selected from SRB2 menu
//
@ -6764,6 +6783,12 @@ static void M_LoadGame(INT32 choice)
{
(void)choice;
if (tutorialmap && !cv_postfirsttime.value)
{
M_StartMessage("Do you want to play a brief Tutorial?\n(Press 'Y' to go, or 'N' to skip)", M_TutorialResponse, MM_YESNO);
return;
}
M_ReadSaveStrings();
M_SetupNextMenu(&SP_LoadDef);
}