From 24d8b20124dd65ed6c081995c150d4120628f757 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 26 Mar 2023 22:20:16 +0100 Subject: [PATCH] GT_TUTORIAL - Replaces `tutorialmode`. - Forces gamespeed to Easy, with no POSITION. - Laps are currently disabled as well, but this can be changed if necessary. - Hides Free Play. - Does not count as a played round (except for Chao Keys). `tutorialmap` has also been removed. This will be replaced in a later commit with something that plays nicer with Ring Racers' existing systems. --- src/d_main.c | 3 --- src/d_netcmd.c | 2 -- src/deh_soc.c | 5 ----- src/doomstat.h | 13 ++++++------- src/f_finale.c | 6 +++--- src/g_game.c | 35 ++++++++++++++++++++++++----------- src/k_grandprix.c | 6 ++++++ src/k_hud.c | 2 +- src/lua_script.c | 6 ------ src/r_main.c | 2 +- 10 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index b754523c7..266158368 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1049,9 +1049,6 @@ void D_ClearState(void) if (rendermode != render_none) V_SetPaletteLump("PLAYPAL"); - // The title screen is obviously not a tutorial! (Unless I'm mistaken) - tutorialmode = false; - cursongcredit.def = NULL; S_StopSounds(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7ce3e42f7..53e9e9a7f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3016,8 +3016,6 @@ static void Command_Map_f(void) } } - tutorialmode = false; // warping takes us out of tutorial mode - D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, fromlevelselect); Z_Free(realmapname); diff --git a/src/deh_soc.c b/src/deh_soc.c index c96bbbaac..ad3d46145 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3211,11 +3211,6 @@ void readmaincfg(MYFILE *f, boolean mainfile) bootmap = Z_StrDup(word2); //titlechanged = true; } - else if (fastcmp(word, "TUTORIALMAP")) - { - Z_Free(tutorialmap); - tutorialmap = Z_StrDup(word2); - } else if (fastcmp(word, "PODIUMMAP")) { Z_Free(podiummap); diff --git a/src/doomstat.h b/src/doomstat.h index b17efb095..6a31180a9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -222,9 +222,6 @@ extern char * titlemap; extern boolean hidetitlepics; extern char * bootmap; //bootmap for loading a map on startup -extern char * tutorialmap; // map to load for tutorial -extern boolean tutorialmode; // are we in a tutorial right now? - extern char * podiummap; // map to load for podium extern boolean looptitle; @@ -499,6 +496,7 @@ enum GameType GT_BATTLE, GT_SPECIAL, GT_VERSUS, + GT_TUTORIAL, GT_FIRSTFREESLOT, GT_LASTFREESLOT = 127, // Previously (GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1) - it would be necessary to rewrite VOTEMODIFIER_ENCORE to go higher than this. @@ -578,10 +576,11 @@ enum GameTypeRules enum TypeOfLevel { // Gametypes - TOL_RACE = 0x0001, ///< Race - TOL_BATTLE = 0x0002, ///< Battle - TOL_BOSS = 0x0004, ///< Boss (variant of battle, but forbidden) - TOL_SPECIAL = 0x0008, ///< Special Stage (variant of race, but forbidden) + TOL_RACE = 0x0001, ///< Race + TOL_BATTLE = 0x0002, ///< Battle + TOL_BOSS = 0x0004, ///< Boss (variant of battle, but forbidden) + TOL_SPECIAL = 0x0008, ///< Special Stage (variant of race, but forbidden) + TOL_TUTORIAL = 0x0010, ///< Tutorial (variant of race, but forbidden) // Modifiers TOL_TV = 0x0100 ///< Midnight Channel specific: draw TV like overlay on HUD diff --git a/src/f_finale.c b/src/f_finale.c index a39d020c0..160ddc27b 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2826,7 +2826,7 @@ static boolean F_GetTextPromptTutorialTag(char *tag, INT32 length) INT32 gcs = 0; boolean suffixed = true; - if (!tag || !tag[0] || !tutorialmode) + if (!tag || !tag[0] || gametype == GT_TUTORIAL) return false; /* @@ -2859,7 +2859,7 @@ static boolean F_GetTextPromptTutorialTag(char *tag, INT32 length) void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum) { INT32 nosuffixpromptnum = INT32_MAX, nosuffixpagenum = INT32_MAX; - INT32 tutorialpromptnum = (tutorialmode) ? TUTORIAL_PROMPT-1 : 0; + INT32 tutorialpromptnum = (gametype == GT_TUTORIAL) ? TUTORIAL_PROMPT-1 : 0; boolean suffixed = false, found = false; char suffixedtag[33]; @@ -2871,7 +2871,7 @@ void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum strncpy(suffixedtag, tag, 33); suffixedtag[32] = 0; - if (tutorialmode) + if (gametype == GT_TUTORIAL) suffixed = F_GetTextPromptTutorialTag(suffixedtag, 33); for (*promptnum = 0 + tutorialpromptnum; *promptnum < MAX_PROMPTS; (*promptnum)++) diff --git a/src/g_game.c b/src/g_game.c index 9e6b2cb72..5cb9d13f0 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -166,9 +166,6 @@ char * titlemap = NULL; boolean hidetitlepics = false; char * bootmap = NULL; //bootmap for loading a map on startup -char * tutorialmap = NULL; // map to load for tutorial -boolean tutorialmode = false; // are we in a tutorial right now? - char * podiummap = NULL; // map to load for podium boolean looptitle = true; @@ -3359,6 +3356,17 @@ static gametype_t defaultgametypes[] = 0, 0, }, + + // GT_TUTORIAL + { + "Tutorial", + "GT_TUTORIAL", + GTR_NOMP|GTR_NOCUPSELECT|GTR_NOPOSITION, + TOL_TUTORIAL, + int_none, + 0, + 0, + }, }; gametype_t *gametypes[MAXGAMETYPES+1] = @@ -3367,6 +3375,7 @@ gametype_t *gametypes[MAXGAMETYPES+1] = &defaultgametypes[GT_BATTLE], &defaultgametypes[GT_SPECIAL], &defaultgametypes[GT_VERSUS], + &defaultgametypes[GT_TUTORIAL], }; // @@ -3502,6 +3511,7 @@ tolinfo_t TYPEOFLEVEL[NUMTOLNAMES] = { {"BATTLE",TOL_BATTLE}, {"BOSS",TOL_BOSS}, {"SPECIAL",TOL_SPECIAL}, + {"TUTORIAL",TOL_TUTORIAL}, {"TV",TOL_TV}, {NULL, 0} }; @@ -4207,16 +4217,19 @@ static void G_DoCompleted(void) if (legitimateexit && !demo.playback && !mapreset) // (yes you're allowed to unlock stuff this way when the game is modified) { - UINT8 roundtype = GDGT_CUSTOM; + if (gametype != GT_TUTORIAL) + { + UINT8 roundtype = GDGT_CUSTOM; - if (gametype == GT_RACE) - roundtype = GDGT_RACE; - else if (gametype == GT_BATTLE) - roundtype = (battleprisons ? GDGT_PRISONS : GDGT_BATTLE); - else if (gametype == GT_SPECIAL || gametype == GT_VERSUS) - roundtype = GDGT_SPECIAL; + if (gametype == GT_RACE) + roundtype = GDGT_RACE; + else if (gametype == GT_BATTLE) + roundtype = (battleprisons ? GDGT_PRISONS : GDGT_BATTLE); + else if (gametype == GT_SPECIAL || gametype == GT_VERSUS) + roundtype = GDGT_SPECIAL; - gamedata->roundsplayed[roundtype]++; + gamedata->roundsplayed[roundtype]++; + } gamedata->pendingkeyrounds++; // Done before forced addition of PF_NOCONTEST to make UCRP_NOCONTEST harder to achieve diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 213e108b5..73cc0d27b 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -715,6 +715,12 @@ boolean K_CanChangeRules(boolean allowdemos) return false; } + if (gametype == GT_TUTORIAL) + { + // Tutorials are locked down. + return false; + } + if (!allowdemos && demo.playback) { // We've already got our important settings! diff --git a/src/k_hud.c b/src/k_hud.c index 229cadcfb..639d8ac9b 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -5181,7 +5181,7 @@ void K_drawKartHUD(void) V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); // Draw FREE PLAY. - if (islonesome && K_Cooperative() == false) + if (islonesome && K_Cooperative() == false && gametype != GT_TUTORIAL) K_drawKartFreePlay(); if (r_splitscreen == 0 && (stplyr->pflags & PF_WRONGWAY) && ((leveltime / 8) & 1)) diff --git a/src/lua_script.c b/src/lua_script.c index 6e34c9fbf..3a12c177b 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -216,12 +216,6 @@ int LUA_PushGlobals(lua_State *L, const char *word) } else if (fastcmp(word,"bootmap")) { lua_pushstring(L, bootmap); return 1; - } else if (fastcmp(word,"tutorialmap")) { - lua_pushstring(L, tutorialmap); - return 1; - } else if (fastcmp(word,"tutorialmode")) { - lua_pushboolean(L, tutorialmode); - return 1; } else if (fastcmp(word,"podiummap")) { lua_pushstring(L, podiummap); return 1; diff --git a/src/r_main.c b/src/r_main.c index 5731f7695..c8cfe4fb5 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1407,7 +1407,7 @@ boolean R_ViewpointHasChasecam(player_t *player) } } - if (player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN || tutorialmode) + if (player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN) chasecam = true; // force chasecam on else if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off