From 08fc91fe3e3d7297c4f157e3d9e2aaf7df309e03 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Fri, 28 May 2021 19:01:49 +0800 Subject: [PATCH] Add 'AddDialogues' in MAPINFO to additively add Strife NPC dialogs without overwriting each other. --- src/gamedata/gi.cpp | 1 + src/gamedata/gi.h | 1 + src/maploader/strifedialogue.cpp | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index 9e5bd537b..4524929ab 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -438,6 +438,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass") GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.) GAMEINFOKEY_STRING(Dialogue, "dialogue") + GAMEINFOKEY_STRINGARRAY(AddDialogues, "adddialogues", 0, false) GAMEINFOKEY_STRING(statusscreen_single, "statscreen_single") GAMEINFOKEY_STRING(statusscreen_coop, "statscreen_coop") GAMEINFOKEY_STRING(statusscreen_dm, "statscreen_dm") diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index 0d5f259a8..466c323d5 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -192,6 +192,7 @@ struct gameinfo_t FString mMapArrow, mCheatMapArrow; FString mEasyKey, mCheatKey; FString Dialogue; + TArray AddDialogues; FGIFont mStatscreenMapNameFont; FGIFont mStatscreenFinishedFont; FGIFont mStatscreenEnteringFont; diff --git a/src/maploader/strifedialogue.cpp b/src/maploader/strifedialogue.cpp index 748c3dc7f..afebd177a 100644 --- a/src/maploader/strifedialogue.cpp +++ b/src/maploader/strifedialogue.cpp @@ -105,6 +105,20 @@ void MapLoader::LoadStrifeConversations (MapData *map, const char *mapname) } else { + // additive dialogues via MAPINFO + bool addedDialogues = false; + for (const FString addd : gameinfo.AddDialogues) + { + if (!LoadScriptFile(addd, true, 0)) + { + continue; + } + else + { + addedDialogues = true; + } + } + if (strnicmp (mapname, "MAP", 3) == 0) { char scriptname_b[9] = { 'S','C','R','I','P','T',mapname[3],mapname[4],0 }; @@ -121,6 +135,10 @@ void MapLoader::LoadStrifeConversations (MapData *map, const char *mapname) { if (LoadScriptFile(gameinfo.Dialogue, false, 0)) { + if (addedDialogues) + { + Printf(TEXTCOLOR_RED "Warning! Dialogue was mixed with AddDialogues! Previous AddDialogues have been overwritten\n"); + } return; } }