Add 'AddDialogues' in MAPINFO to additively add Strife NPC dialogs without overwriting each other.

This commit is contained in:
nashmuhandes 2021-05-28 19:01:49 +08:00 committed by Christoph Oelckers
parent 868220107b
commit 08fc91fe3e
3 changed files with 20 additions and 0 deletions

View file

@ -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")

View file

@ -192,6 +192,7 @@ struct gameinfo_t
FString mMapArrow, mCheatMapArrow;
FString mEasyKey, mCheatKey;
FString Dialogue;
TArray<FString> AddDialogues;
FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont;

View file

@ -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;
}
}