mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 05:41:02 +00:00
Merge branch 'lua-nextmapoverride' into 'next'
Lua: nextmapoverride & skipstats changing outside of G_ExitLevel See merge request STJr/SRB2!396
This commit is contained in:
commit
dd107724de
1 changed files with 23 additions and 5 deletions
|
@ -1916,17 +1916,19 @@ static int lib_gDoReborn(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_gExitLevel(lua_State *L)
|
// Another Lua function that doesn't actually exist!
|
||||||
|
// Sets nextmapoverride & skipstats without instantly ending the level, for instances where other sources should be exiting the level, like normal signposts.
|
||||||
|
static int lib_gSetCustomExitVars(lua_State *L)
|
||||||
{
|
{
|
||||||
int n = lua_gettop(L); // Num arguments
|
int n = lua_gettop(L); // Num arguments
|
||||||
NOHUD
|
NOHUD
|
||||||
|
|
||||||
// LUA EXTENSION: Custom exit like support
|
// LUA EXTENSION: Custom exit like support
|
||||||
// Supported:
|
// Supported:
|
||||||
// G_ExitLevel(); [no modifications]
|
// G_SetCustomExitVars(); [reset to defaults]
|
||||||
// G_ExitLevel(int) [nextmap override only]
|
// G_SetCustomExitVars(int) [nextmap override only]
|
||||||
// G_ExitLevel(bool) [skipstats only]
|
// G_SetCustomExitVars(bool) [skipstats only]
|
||||||
// G_ExitLevel(int, bool) [both of the above]
|
// G_SetCustomExitVars(int, bool) [both of the above]
|
||||||
if (n >= 1)
|
if (n >= 1)
|
||||||
{
|
{
|
||||||
if (lua_isnumber(L, 1) || n >= 2)
|
if (lua_isnumber(L, 1) || n >= 2)
|
||||||
|
@ -1936,8 +1938,23 @@ static int lib_gExitLevel(lua_State *L)
|
||||||
}
|
}
|
||||||
skipstats = lua_optboolean(L, 1);
|
skipstats = lua_optboolean(L, 1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextmapoverride = 0;
|
||||||
|
skipstats = false;
|
||||||
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_gExitLevel(lua_State *L)
|
||||||
|
{
|
||||||
|
int n = lua_gettop(L); // Num arguments
|
||||||
|
NOHUD
|
||||||
|
// Moved this bit to G_SetCustomExitVars
|
||||||
|
if (n >= 1) // Don't run the reset to defaults option
|
||||||
|
lib_gSetCustomExitVars(L);
|
||||||
G_ExitLevel();
|
G_ExitLevel();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2202,6 +2219,7 @@ static luaL_Reg lib[] = {
|
||||||
// g_game
|
// g_game
|
||||||
{"G_BuildMapName",lib_gBuildMapName},
|
{"G_BuildMapName",lib_gBuildMapName},
|
||||||
{"G_DoReborn",lib_gDoReborn},
|
{"G_DoReborn",lib_gDoReborn},
|
||||||
|
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
||||||
{"G_ExitLevel",lib_gExitLevel},
|
{"G_ExitLevel",lib_gExitLevel},
|
||||||
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
||||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||||
|
|
Loading…
Reference in a new issue