mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Let lib_gExitLevel call lib_gSetCustomExitVars, for reduced code duplication.
This commit is contained in:
parent
0e34e7f32f
commit
42a9e66883
1 changed files with 12 additions and 27 deletions
|
@ -1897,32 +1897,6 @@ static int lib_gDoReborn(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_gExitLevel(lua_State *L)
|
|
||||||
{
|
|
||||||
int n = lua_gettop(L); // Num arguments
|
|
||||||
NOHUD
|
|
||||||
|
|
||||||
// LUA EXTENSION: Custom exit like support
|
|
||||||
// Supported:
|
|
||||||
// G_ExitLevel(); [no modifications]
|
|
||||||
// G_ExitLevel(int) [nextmap override only]
|
|
||||||
// G_ExitLevel(bool) [skipstats only]
|
|
||||||
// G_ExitLevel(int, bool) [both of the above]
|
|
||||||
if (n >= 1)
|
|
||||||
{
|
|
||||||
if (lua_isnumber(L, 1) || n >= 2)
|
|
||||||
{
|
|
||||||
nextmapoverride = (INT16)luaL_checknumber(L, 1);
|
|
||||||
lua_pop(L, 1); // pop nextmapoverride; skipstats now 1 if available
|
|
||||||
}
|
|
||||||
skipstats = lua_optboolean(L, 1);
|
|
||||||
}
|
|
||||||
// ---
|
|
||||||
|
|
||||||
G_ExitLevel();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Another Lua function that doesn't actually exist!
|
// 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.
|
// 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)
|
static int lib_gSetCustomExitVars(lua_State *L)
|
||||||
|
@ -1955,6 +1929,17 @@ static int lib_gSetCustomExitVars(lua_State *L)
|
||||||
return 0;
|
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();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_gIsSpecialStage(lua_State *L)
|
static int lib_gIsSpecialStage(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 mapnum = luaL_optinteger(L, 1, gamemap);
|
INT32 mapnum = luaL_optinteger(L, 1, gamemap);
|
||||||
|
@ -2211,8 +2196,8 @@ 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_ExitLevel",lib_gExitLevel},
|
|
||||||
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
||||||
|
{"G_ExitLevel",lib_gExitLevel},
|
||||||
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
{"G_IsSpecialStage",lib_gIsSpecialStage},
|
||||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||||
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
||||||
|
|
Loading…
Reference in a new issue