Skip to content

Commit

Permalink
libcommon: Kludge around a compatibility issue with Hexen's MAPINFO
Browse files Browse the repository at this point in the history
MAPINFO in the commercial versions of the Hexen IWADs contain a bunch
of broken definitions. As later definitions now replace earlier ones
(a change from ZDoom), these broken defs will now override the earlier
"good" defs.

For now we'll kludge around this issue by patching such defs with the
original/expected values.

Todo: Determine how ZDoom behaves and replicate that behavior.
Todo for later: Isolate this compatibility swamp by moving the MAPINFO
parser to load time translator plugin.
  • Loading branch information
danij-deng committed Jul 26, 2014
1 parent 6c69cc6 commit c9099bb
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions doomsday/plugins/common/src/p_start.cpp
Expand Up @@ -252,10 +252,21 @@ static void readMapInfoDefinitions()
// Read the primary MAPINFO (from the IWAD).
AutoStr *sourceFile = sc_FileScripts? Str_Appendf(AutoStr_New(), "%sMAPINFO.txt", sc_ScriptsDir)
: AutoStr_FromText("Lumps:MAPINFO");
AutoStr *buffer = M_ReadFileIntoString(sourceFile, 0);
dd_bool sourceIsCustom;
AutoStr *buffer = M_ReadFileIntoString(sourceFile, &sourceIsCustom);
if(buffer && !Str_IsEmpty(buffer))
{
readOneMapInfoDefinition(parser, *buffer, Str_Text(sourceFile));

// MAPINFO in the Hexen IWAD contains a bunch of broken definitions.
// As later map definitions now replace earlier ones, these broken defs
// override the earlier "good" defs. For now we'll kludge around this
// issue by patching the effected defs with the expected values.
if(!sourceIsCustom && (gameModeBits & (GM_HEXEN|GM_HEXEN_V10)))
{
MapInfo *info = hexDefs.getMapInfo(de::Uri("Maps:MAP07", RC_NULL));
info->set("warpTrans", "@wt:6");
}
}
else
{
Expand Down Expand Up @@ -386,9 +397,9 @@ static void readMapInfoDefinitions()
for(HexDefs::MapInfos::const_iterator i = hexDefs.mapInfos.begin(); i != hexDefs.mapInfos.end(); ++i)
{
MapInfo const &info = i->second;
LOG_RES_MSG("MAPINFO %s { title: \"%s\" hub: %i map: %s warp: %i }")
LOG_RES_MSG("MAPINFO %s { title: \"%s\" hub: %i map: %s warp: %i nextMap: %s }")
<< i->first.c_str() << info.gets("title")
<< info.geti("hub") << info.gets("map") << info.geti("warpTrans");
<< info.geti("hub") << info.gets("map") << info.geti("warpTrans") << info.gets("nextMap");
}
#endif
}
Expand Down

1 comment on commit c9099bb

@danij-deng
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemingly, ZDoom does not handle the compatibility discrepancy case described in the commit description at all. Surely there must be mods out there that depend on this?

Please sign in to comment.