diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index b0802a976..73fd7516a 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -645,6 +645,7 @@ MapFlagHandlers[] = { "sw_bossmeter_sumo", MITYPE_SETFLAGG,LEVEL_SW_BOSSMETER_SUMO, 0, GAMEFLAG_SW }, { "sw_bossmeter_zilla", MITYPE_SETFLAGG,LEVEL_SW_BOSSMETER_ZILLA, 0, GAMEFLAG_SW }, { "sw_deathexit_serpent", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_SERPENT, 0, GAMEFLAG_SW }, + { "sw_deathexit_serpent_next", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_SERPENT | LEVEL_SW_DEATHEXIT_SERPENT_NEXT, 0, GAMEFLAG_SW }, { "sw_deathexit_sumo", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_SUMO, 0, GAMEFLAG_SW }, { "sw_deathexit_zilla", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_ZILLA, 0, GAMEFLAG_SW }, { "sw_spawnmines", MITYPE_SETFLAGG,LEVEL_SW_SPAWNMINES, 0, GAMEFLAG_SW }, diff --git a/source/core/maphack.cpp b/source/core/maphack.cpp index 70f5a37df..3f08ca67c 100644 --- a/source/core/maphack.cpp +++ b/source/core/maphack.cpp @@ -38,6 +38,7 @@ #include "c_dispatch.h" #include "md4.h" #include "hw_sections.h" +#include "mapinfo.h" static TArray usermaphacks; TArray blockingpairs[MAXWALLS]; @@ -249,6 +250,10 @@ static int32_t LoadMapHack(const char *filename) } } } + else if (sc.Compare("sw_serp_continue")) // This is a hack for SW's Last Warrior mod to continue from L4 to L5. + { + currentLevel->gameflags |= LEVEL_SW_DEATHEXIT_SERPENT_NEXT; + } else if (sc.Compare("angleoff") || sc.Compare("angoff")) { diff --git a/source/core/mapinfo.cpp b/source/core/mapinfo.cpp index 17039c045..18ab9011b 100644 --- a/source/core/mapinfo.cpp +++ b/source/core/mapinfo.cpp @@ -71,6 +71,7 @@ CCMD(listmaps) MapRecord *FindMapByName(const char *nm) { + if (!nm || !*nm) return nullptr; for (auto& map : mapList) { if (map->labelName.CompareNoCase(nm) == 0) diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 4909670c2..22a0d250c 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -51,8 +51,9 @@ enum EMapGameFlags LEVEL_SW_DEATHEXIT_SERPENT = 1024, LEVEL_SW_DEATHEXIT_SUMO = 2048, LEVEL_SW_DEATHEXIT_ZILLA = 4096, + LEVEL_SW_DEATHEXIT_SERPENT_NEXT = 8192, - LEVEL_WT_BOSSSPAWN = 8192, + LEVEL_WT_BOSSSPAWN = 16384, }; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 0a4ee7215..21cdffe39 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -7202,7 +7202,7 @@ domovethings(void) { FinishTimer = 0; MapRecord *map = nullptr; - if (FinishAnim == ANIM_SUMO) + if (FinishAnim == ANIM_SUMO || FinishAnim == ANIM_SERP) { map = FindNextMap(currentLevel); } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index f9f344d28..c23942464 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -5327,8 +5327,13 @@ ActorHealth(short SpriteNum, short amt) if (u->Health < u->MaxHealth/2) { FinishAnim = ANIM_SERP; - ChangeLevel(nullptr, g_nextskill); - return true; + // Hack for Last Warrior which apparently needs to continue with the next level here. + if (!(currentLevel->gameflags & LEVEL_SW_DEATHEXIT_SERPENT_NEXT)) + { + ChangeLevel(nullptr, g_nextskill); + return true; + } + else FinishTimer = 1; } } diff --git a/wadsrc/static/engine/compatibility/745182e393945e0d308e8e0a5ee80c3c.mhk b/wadsrc/static/engine/compatibility/745182e393945e0d308e8e0a5ee80c3c.mhk new file mode 100644 index 000000000..a3906bbb4 --- /dev/null +++ b/wadsrc/static/engine/compatibility/745182e393945e0d308e8e0a5ee80c3c.mhk @@ -0,0 +1,2 @@ +// SW's Last Warrior level 4. Do not make the serpent's death end the game. The menu has no second episode so this needs to continue. +sw_serp_continue