From cc5bff6c9c3e16a9bad6d8dc3f362248596934d8 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 16 Jun 2019 13:29:33 +0300 Subject: [PATCH] - exported unconditional level exit to ZScript Exit_Normal and Exit_Secret specials imply addition conditions to make a decision about proceeding to the next map A few scriptified actors require a bypass of these conditions in order to work properly --- src/g_level.cpp | 27 +++++++++++++++++++++++++++ wadsrc/static/zscript/base.zs | 2 ++ 2 files changed, 29 insertions(+) diff --git a/src/g_level.cpp b/src/g_level.cpp index 0475571f7..4e253df01 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -744,12 +744,39 @@ void FLevelLocals::ExitLevel (int position, bool keepFacing) ChangeLevel(NextMap, position, keepFacing ? CHANGELEVEL_KEEPFACING : 0); } +static void LevelLocals_ExitLevel(FLevelLocals *self, int position, bool keepFacing) +{ + self->ExitLevel(position, keepFacing); +} + +DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, ExitLevel, LevelLocals_ExitLevel) +{ + PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals); + PARAM_INT(position); + PARAM_INT(keepFacing); + self->ExitLevel(position, keepFacing); + return 0; +} + void FLevelLocals::SecretExitLevel (int position) { flags3 |= LEVEL3_EXITSECRETUSED; ChangeLevel(GetSecretExitMap(), position, 0); } +static void LevelLocals_SecretExitLevel(FLevelLocals *self, int position) +{ + self->SecretExitLevel(position); +} + +DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, SecretExitLevel, LevelLocals_SecretExitLevel) +{ + PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals); + PARAM_INT(position); + self->SecretExitLevel(position); + return 0; +} + //========================================================================== // // diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 3d1af52a3..792f105f5 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -784,6 +784,8 @@ struct LevelLocals native native play bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = 0 /*Floor.crushDoom*/); native play bool CreateFloor(sector sec, int floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false); + native void ExitLevel(int position, bool keepFacing); + native void SecretExitLevel(int position); } struct StringTable native