Skip to content

Commit

Permalink
Add 'AddDialogues' in MAPINFO to additively add Strife NPC dialogs wi…
Browse files Browse the repository at this point in the history
…thout overwriting each other.
  • Loading branch information
nashmuhandes authored and coelckers committed Jul 25, 2021
1 parent bfe13da commit 1046dae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/gamedata/gi.cpp
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/gamedata/gi.h
Expand Up @@ -192,6 +192,7 @@ struct gameinfo_t
FString mMapArrow, mCheatMapArrow;
FString mEasyKey, mCheatKey;
FString Dialogue;
TArray<FString> AddDialogues;
FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont;
Expand Down
18 changes: 18 additions & 0 deletions src/maploader/strifedialogue.cpp
Expand Up @@ -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 };
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 1046dae

Please sign in to comment.