From 5aa27bad3bebc18ff1484e90bbd152e811f18766 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 13 Aug 2021 22:25:13 +0200 Subject: [PATCH] - flag SW's cutscenes as 'boss death only'. --- source/common/cutscenes/screenjob.cpp | 1 + source/core/cheats.cpp | 7 ++++++- source/core/g_mapinfo.cpp | 1 + source/core/gamecontrol.cpp | 1 + source/core/gamecontrol.h | 3 ++- source/core/mapinfo.h | 2 +- source/core/screenjob.cpp | 7 +++++-- source/games/sw/src/player.cpp | 2 +- source/games/sw/src/weapon.cpp | 2 +- wadsrc/static/filter/shadowwarrior.twindragon/rmapinfo.txt | 5 ----- wadsrc/static/filter/shadowwarrior/engine/rmapinfo.txt | 2 ++ 11 files changed, 21 insertions(+), 12 deletions(-) delete mode 100644 wadsrc/static/filter/shadowwarrior.twindragon/rmapinfo.txt diff --git a/source/common/cutscenes/screenjob.cpp b/source/common/cutscenes/screenjob.cpp index 9175a6f62..b14fa9398 100644 --- a/source/common/cutscenes/screenjob.cpp +++ b/source/common/cutscenes/screenjob.cpp @@ -51,6 +51,7 @@ #include "s_music.h" #include "m_argv.h" #include "i_interface.h" +#include "gamecontrol.h" CVAR(Bool, inter_subtitles, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); diff --git a/source/core/cheats.cpp b/source/core/cheats.cpp index bdbec4080..b3fe9fd4e 100644 --- a/source/core/cheats.cpp +++ b/source/core/cheats.cpp @@ -212,6 +212,7 @@ void CompleteLevel(MapRecord* map) gameaction = ga_completed; g_nextmap = !currentLevel || !(currentLevel->flags & MI_FORCEEOG)? map : nullptr; g_nextskill = -1; // This does not change the skill + g_bossexit = false; } //--------------------------------------------------------------------------- @@ -223,6 +224,7 @@ void CompleteLevel(MapRecord* map) void changeMap(int player, uint8_t** stream, bool skip) { int skill = (int8_t)ReadByte(stream); + int bossexit = (int8_t)ReadByte(stream); auto mapname = ReadStringConst(stream); if (skip) return; auto map = FindMapByName(mapname); @@ -231,6 +233,7 @@ void changeMap(int player, uint8_t** stream, bool skip) gameaction = ga_completed; g_nextmap = map; g_nextskill = skill; + g_bossexit = bossexit; } } @@ -251,10 +254,11 @@ void endScreenJob(int player, uint8_t** stream, bool skip) // //--------------------------------------------------------------------------- -void ChangeLevel(MapRecord* map, int skill) +void ChangeLevel(MapRecord* map, int skill, bool bossexit) { Net_WriteByte(DEM_CHANGEMAP); Net_WriteByte(skill); + Net_WriteByte(bossexit); Net_WriteString(map? map->labelName : nullptr); } @@ -268,6 +272,7 @@ void DeferredStartGame(MapRecord* map, int skill, bool nostopsound) { g_nextmap = map; g_nextskill = skill; + g_bossexit = false; gameaction = nostopsound? ga_newgamenostopsound : ga_newgame; } diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index 73fd7516a..e20eae815 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -649,6 +649,7 @@ MapFlagHandlers[] = { "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 }, + { "bossonlycutscene", MITYPE_SETFLAGG,LEVEL_BOSSONLYCUTSCENE, 0, -1 }, { NULL, MITYPE_IGNORE, 0, 0} }; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index b0c0ff4e9..10d3b55e1 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -122,6 +122,7 @@ gameaction_t gameaction = ga_nothing; // gameaction state MapRecord* g_nextmap; int g_nextskill; +int g_bossexit; FILE* hashfile; diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 5f3369a08..96ca7bd83 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -32,6 +32,7 @@ extern bool crouch_toggle; struct MapRecord; extern MapRecord* g_nextmap; extern int g_nextskill; +extern int g_bossexit; extern FMemArena dump; // this is for memory blocks than cannot be deallocated without some huge effort. Put them in here so that they do not register on shutdown. @@ -44,7 +45,7 @@ int GetAutomapZoom(int gZoom); void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, PalEntry color = 0xffffffff); void updatePauseStatus(); void DeferredStartGame(MapRecord* map, int skill, bool nostopsound = false); -void ChangeLevel(MapRecord* map, int skill); +void ChangeLevel(MapRecord* map, int skill, bool bossexit = false); void CompleteLevel(MapRecord* map); struct UserConfig diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 22a0d250c..26e0725ba 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -55,7 +55,7 @@ enum EMapGameFlags LEVEL_WT_BOSSSPAWN = 16384, - + LEVEL_BOSSONLYCUTSCENE = 32768, }; // These get filled in by the map definition parsers of the front ends. diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index dff5b473d..c0ac0722f 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -187,6 +187,9 @@ void ShowScoreboard(int numplayers, const CompletionFunc& completion_) void ShowIntermission(MapRecord* fromMap, MapRecord* toMap, SummaryInfo* info, CompletionFunc completion_) { + bool bossexit = g_bossexit; + g_bossexit = false; + completion = completion_; runner = CreateRunner(); GC::WriteBarrier(runner); @@ -200,7 +203,7 @@ void ShowIntermission(MapRecord* fromMap, MapRecord* toMap, SummaryInfo* info, C try { - if (fromMap) + if (fromMap && (!(fromMap->gameflags & LEVEL_BOSSONLYCUTSCENE) || bossexit)) { if (!CreateCutscene(&fromMap->outro, runner, fromMap, !!toMap)) { @@ -212,7 +215,7 @@ void ShowIntermission(MapRecord* fromMap, MapRecord* toMap, SummaryInfo* info, C if (fromMap || (g_gameType & GAMEFLAG_PSEXHUMED)) CallCreateSummaryFunction(globalCutscenes.SummaryScreen, runner, fromMap, info, toMap); - if (toMap) + if (toMap) { if (!CreateCutscene(&toMap->intro, runner, toMap, !!fromMap)) { diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 21cdffe39..cabde21c1 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -7206,7 +7206,7 @@ domovethings(void) { map = FindNextMap(currentLevel); } - ChangeLevel(map, g_nextskill); + ChangeLevel(map, g_nextskill, true); } } } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index c23942464..c4d7b8c91 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -5330,7 +5330,7 @@ ActorHealth(short SpriteNum, short amt) // 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); + ChangeLevel(nullptr, g_nextskill, true); return true; } else FinishTimer = 1; diff --git a/wadsrc/static/filter/shadowwarrior.twindragon/rmapinfo.txt b/wadsrc/static/filter/shadowwarrior.twindragon/rmapinfo.txt deleted file mode 100644 index babfd9e11..000000000 --- a/wadsrc/static/filter/shadowwarrior.twindragon/rmapinfo.txt +++ /dev/null @@ -1,5 +0,0 @@ - -map { 9 } -{ - sw_spawnmines -} \ No newline at end of file diff --git a/wadsrc/static/filter/shadowwarrior/engine/rmapinfo.txt b/wadsrc/static/filter/shadowwarrior/engine/rmapinfo.txt index 72ef780bc..ea455bbf0 100644 --- a/wadsrc/static/filter/shadowwarrior/engine/rmapinfo.txt +++ b/wadsrc/static/filter/shadowwarrior/engine/rmapinfo.txt @@ -25,6 +25,7 @@ map { 4 } } sw_bossmeter_serpent sw_deathexit_serpent + bossonlycutscene } map { 5 } @@ -40,6 +41,7 @@ map { 11 } } sw_bossmeter_sumo sw_deathexit_sumo + bossonlycutscene } map { 20 }