Skip to content

Commit

Permalink
MapInfoParser|libcommon: MapInfo records the 'secretNextMap'
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jul 26, 2014
1 parent 6f92082 commit b9bd0f3
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions doomsday/plugins/common/src/mapinfo.cpp
Expand Up @@ -84,7 +84,8 @@ void MapInfo::resetToDefaults()
addText ("map", "Maps:"); // URI. Unknown.
addNumber ("hub", 0);
addNumber ("warpTrans", 0);
addText ("nextMap", ""); // URI. None. (If scheme is "@wt" then the path is a warp trans number).
addText ("nextMap", ""); // URI. None. (If scheme is "@wt" then the path is a warp trans number).
addText ("secretNextMap", ""); // URI. None. (If scheme is "@wt" then the path is a warp trans number).
addNumber ("cdTrack", 1);
addText ("title", "Untitled");
addText ("sky1Material", defaultSkyMaterial());
Expand Down Expand Up @@ -321,7 +322,7 @@ DENG2_PIMPL(MapInfoParser)
}

/**
* @param isSecret @c true= this is the secret next map (from ZDoom) and should be ignored.
* @param isSecret @c true= this is the secret next map (from ZDoom).
*/
void parseMapNext(MapInfo &mapInfo, bool isSecret = false)
{
Expand Down Expand Up @@ -359,21 +360,15 @@ DENG2_PIMPL(MapInfoParser)
{
mapUri = de::Uri(Str_Text(tok), RC_NULL);
if(mapUri.scheme().isEmpty()) mapUri.setScheme("Maps");
if(!isSecret)
{
mapInfo.set("nextMap", mapUri.compose());
}
mapInfo.set((isSecret? "secretNextMap" : "nextMap"), mapUri.compose());
}
else
{
if(mapNumber < 1)
{
throw ParseError(String("Invalid map number '%1' on line #%2").arg(mapNumber).arg(lexer.lineNumber()));
}
if(!isSecret)
{
mapInfo.set("nextMap", String("@wt:%1").arg(mapNumber - 1));
}
mapInfo.set((isSecret? "secretNextMap" : "nextMap"), String("@wt:%1").arg(mapNumber - 1));
}
}

Expand Down Expand Up @@ -730,7 +725,6 @@ DENG2_PIMPL(MapInfoParser)
}
if(!Str_CompareIgnoreCase(lexer.token(), "secretnext")) // ZDoom
{
LOG_WARNING("MAPINFO Map.secretNext is not supported.");
parseMapNext(*info, true/*is-secret*/);
continue;
}
Expand Down Expand Up @@ -1148,6 +1142,11 @@ void HexDefs::translateMapWarpNumbers()
{
info.set("nextMap", translateMapWarpNumber(nextMap.path().toStringRef().toInt()).compose());
}
de::Uri secretNextMap(info.gets("secretNextMap", ""), RC_NULL);
if(!secretNextMap.scheme().compareWithoutCase("@wt"))
{
info.set("secretNextMap", translateMapWarpNumber(secretNextMap.path().toStringRef().toInt()).compose());
}
}
}

Expand Down

0 comments on commit b9bd0f3

Please sign in to comment.