diff --git a/src/doomstat.h b/src/doomstat.h index b5b2984407cc7cf03d213de8cb70f3bab720fc88..936d622610df83c4940d628b43c820880b68e7d0 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -249,6 +249,7 @@ extern textprompt_t *textprompts[MAX_PROMPTS]; // For the Custom Exit linedef. extern INT16 nextmapoverride; extern UINT8 skipstats; +extern UINT8 luakeepcutscenes; extern INT16 nextgametype; extern UINT32 ssspheres; // Total # of spheres in a level diff --git a/src/g_game.c b/src/g_game.c index 1c186ae03149780b254c72f5243ed3d551350e52..b73be39b21298402a38ff2f98468aa9bb6cc91a2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3159,6 +3159,7 @@ void G_DoReborn(INT32 playernum) nextmapoverride = gamemap; countdown2 = TICRATE; skipstats = 2; + luakeepcutscenes = 0; for (i = 0; i < MAXPLAYERS; i++) { @@ -4209,7 +4210,7 @@ void G_AfterIntermission(void) if ((gametyperules & GTR_CUTSCENES) && mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking - && skipstats <= 1 + && (skipstats <= 1 || luakeepcutscenes > 0) && (gamecomplete || !(marathonmode & MA_NOCUTSCENES)) && stagefailed == false) { diff --git a/src/lua_baselib.c b/src/lua_baselib.c index ecd1ee55e648019fb883917ca361cc45ba8847b2..ab12a301f9b7d0f899104c80cd2c49b42d32550d 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -4171,26 +4171,44 @@ static int lib_gSetCustomExitVars(lua_State *L) // LUA EXTENSION: Custom exit like support // Supported: - // G_SetCustomExitVars(); [reset to defaults] - // G_SetCustomExitVars(int) [nextmap override only] - // G_SetCustomExitVars(nil, int) [skipstats only] - // G_SetCustomExitVars(int, int) [both of the above] - // G_SetCustomExitVars(int, int, int) [nextmapoverride, skipstats and nextgametype] + // G_SetCustomExitVars(); [reset to defaults] + // G_SetCustomExitVars(int) [nextmap override only] + // G_SetCustomExitVars(nil, int) [skipstats only] + // G_SetCustomExitVars(int, int) [both of the above] + // G_SetCustomExitVars(int, int, int) [nextmapoverride, skipstats and nextgametype] + // G_SetCustomExitVars(int, int, int, int) [nextmapoverride, skipstats, nextgametype and keepcutscenes] nextmapoverride = 0; skipstats = 0; nextgametype = -1; + luakeepcutscenes = 0; if (n >= 1) { nextmapoverride = (INT16)luaL_optinteger(L, 1, 0); skipstats = (INT16)luaL_optinteger(L, 2, 0); nextgametype = (INT16)luaL_optinteger(L, 3, -1); + luakeepcutscenes = (INT16)luaL_optinteger(L, 4, 0); } return 0; } +// Another Lua function that doesn't actually exist, but since lib_gSetCustomExitVars exists... +// The get counterpart would have been useful as well. +// Gets nextmapoverride, skipstats and nextgametype for any other use +static int lib_gGetCustomExitVars(lua_State* L) +{ + NOHUD + INLEVEL + + lua_pushinteger(L, nextmapoverride); + lua_pushinteger(L, skipstats); + lua_pushinteger(L, nextgametype); + lua_pushinteger(L, luakeepcutscenes); + return 4; +} + static int lib_gEnoughPlayersFinished(lua_State *L) { INLEVEL @@ -4632,6 +4650,7 @@ static luaL_Reg lib[] = { {"G_FindMapByNameOrCode",lib_gFindMapByNameOrCode}, {"G_DoReborn",lib_gDoReborn}, {"G_SetCustomExitVars",lib_gSetCustomExitVars}, + {"G_GetCustomExitVars", lib_gGetCustomExitVars}, {"G_EnoughPlayersFinished",lib_gEnoughPlayersFinished}, {"G_ExitLevel",lib_gExitLevel}, {"G_IsSpecialStage",lib_gIsSpecialStage}, diff --git a/src/p_setup.c b/src/p_setup.c index c2b8f2db2e367cc23fcdb704f23fe572360eea81..9d6fcca007096349e60dcac397faf6814a21fbf5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8120,6 +8120,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) R_PrecacheLevel(); nextmapoverride = 0; + luakeepcutscenes = 0; skipstats = 0; levelloading = false;