- removed 8 character limit for map names.

This commit is contained in:
Christoph Oelckers 2014-05-14 00:52:16 +02:00
commit a375454474
8 changed files with 66 additions and 56 deletions

View file

@ -71,9 +71,10 @@ extern TMap<int, FString> HexenMusic;
static int FindWadLevelInfo (const char *name)
{
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
if (!strnicmp (name, wadlevelinfos[i].mapname, 8))
{
if (!wadlevelinfos[i].MapName.CompareNoCase(name))
return i;
}
return -1;
}
@ -144,7 +145,7 @@ bool CheckWarpTransMap (FString &mapname, bool substitute)
level_info_t *lev = FindLevelByWarpTrans (atoi (&mapname[4]));
if (lev != NULL)
{
mapname = lev->mapname;
mapname = lev->MapName;
return true;
}
else if (substitute)
@ -224,12 +225,12 @@ void P_RemoveDefereds (void)
void level_info_t::Reset()
{
mapname[0] = 0;
MapName = "";
MapBackground = "";
levelnum = 0;
PName = "";
nextmap[0] = 0;
secretmap[0] = 0;
NextMap = "";
NextSecretMap = "";
SkyPic1 = SkyPic2 = "-NOFLAT-";
cluster = 0;
partime = 0;
@ -262,7 +263,7 @@ void level_info_t::Reset()
compatmask = compatmask2 = 0;
Translator = "";
RedirectType = 0;
RedirectMap[0] = 0;
RedirectMapName = "";
EnterPic = "";
ExitPic = "";
InterMusic = "";
@ -299,17 +300,17 @@ FString level_info_t::LookupLevelName()
char checkstring[32];
// Strip out the header from the localized string
if (mapname[0] == 'E' && mapname[2] == 'M')
if (MapName.Len() > 3 && MapName[0] == 'E' && MapName[2] == 'M')
{
mysnprintf (checkstring, countof(checkstring), "%s: ", mapname);
mysnprintf (checkstring, countof(checkstring), "%s: ", MapName);
}
else if (mapname[0] == 'M' && mapname[1] == 'A' && mapname[2] == 'P')
else if (MapName.Len() > 3 && MapName[0] == 'M' && MapName[1] == 'A' && MapName[2] == 'P')
{
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(mapname + 3));
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[3]));
}
else if (mapname[0] == 'L' && mapname[1] == 'E' && mapname[2] == 'V' && mapname[3] == 'E' && mapname[4] == 'L')
else if (MapName.Len() > 5 && MapName[0] == 'L' && MapName[1] == 'E' && MapName[2] == 'V' && MapName[3] == 'E' && MapName[4] == 'L')
{
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(mapname + 5));
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5]));
}
thename = strstr (lookedup, checkstring);
if (thename == NULL)
@ -372,9 +373,9 @@ level_info_t *level_info_t::CheckLevelRedirect ()
if (playeringame[i] && players[i].mo->FindInventory (type))
{
// check for actual presence of the map.
if (P_CheckMapData(RedirectMap))
if (P_CheckMapData(RedirectMapName))
{
return FindLevelInfo(RedirectMap);
return FindLevelInfo(RedirectMapName);
}
break;
}
@ -391,7 +392,7 @@ level_info_t *level_info_t::CheckLevelRedirect ()
bool level_info_t::isValid()
{
return mapname[0] != 0 || this == &TheDefaultLevelInfo;
return MapName.Len() != 0 || this == &TheDefaultLevelInfo;
}
//==========================================================================
@ -764,29 +765,27 @@ void FMapInfoParser::ParseCluster()
//
//==========================================================================
void FMapInfoParser::ParseNextMap(char *mapname)
void FMapInfoParser::ParseNextMap(FString &mapname)
{
if (sc.CheckNumber())
{
if (HexenHack)
{
mysnprintf (mapname, 9, "&wt@%02d", sc.Number);
mapname.Format("&wt@%02d", sc.Number);
}
else
{
mysnprintf (mapname, 9, "MAP%02d", sc.Number);
mapname.Format("MAP%02d", sc.Number);
}
}
else
{
*mapname = 0;
sc.MustGetString();
strncpy (mapname, sc.String, 8);
mapname[8] = 0;
mapname = sc.String;
FName seq = CheckEndSequence();
if (seq != NAME_None)
{
mysnprintf(mapname, 11, "enDSeQ%04x", int(seq));
mapname.Format("enDSeQ%04x", int(seq));
}
}
}
@ -807,19 +806,19 @@ DEFINE_MAP_OPTION(levelnum, true)
DEFINE_MAP_OPTION(next, true)
{
parse.ParseAssign();
parse.ParseNextMap(info->nextmap);
parse.ParseNextMap(info->NextMap);
}
DEFINE_MAP_OPTION(secretnext, true)
{
parse.ParseAssign();
parse.ParseNextMap(info->secretmap);
parse.ParseNextMap(info->NextSecretMap);
}
DEFINE_MAP_OPTION(secret, true) // Just an alias for secretnext, for Vavoom compatibility
{
parse.ParseAssign();
parse.ParseNextMap(info->secretmap);
parse.ParseNextMap(info->NextSecretMap);
}
DEFINE_MAP_OPTION(cluster, true)
@ -1072,7 +1071,7 @@ DEFINE_MAP_OPTION(redirect, true)
parse.sc.MustGetString();
info->RedirectType = parse.sc.String;
parse.ParseComma();
parse.ParseLumpOrTextureName(info->RedirectMap);
parse.ParseNextMap(info->RedirectMapName);
}
DEFINE_MAP_OPTION(sndseq, true)
@ -1522,8 +1521,8 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
}
uppercopy (levelinfo->mapname, mapname);
levelinfo->mapname[8] = 0;
levelinfo->MapName = mapname;
levelinfo->MapName.ToUpper();
sc.MustGetString ();
if (sc.String[0] == '$')
{
@ -1543,7 +1542,7 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
// Set up levelnum now so that you can use Teleport_NewMap specials
// to teleport to maps with standard names without needing a levelnum.
levelinfo->levelnum = GetDefaultLevelNum(levelinfo->mapname);
levelinfo->levelnum = GetDefaultLevelNum(levelinfo->MapName);
// Does this map have a song defined via SNDINFO's $map command?
// Set that as this map's default music if it does.