- removed 8 character limit for map names.

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

View file

@ -506,12 +506,14 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
if (nextredir != NULL)
{
nextinfo = nextredir;
levelname = nextinfo->mapname;
}
}
nextlevel = nextinfo->MapName;
}
else
{
nextlevel = levelname;
}
if (levelname != NULL) nextlevel = levelname;
if (nextSkill != -1)
NextSkill = nextSkill;
@ -673,7 +675,7 @@ void G_DoCompleted (void)
}
else
{
wminfo.next = nextinfo->mapname;
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->PName, FTexture::TEX_MiscPatch)];
}
}
@ -1271,8 +1273,8 @@ void G_InitLevelLocals ()
level.musicorder = info->musicorder;
level.LevelName = level.info->LookupLevelName();
level.NextMap = info->nextmap;
level.NextSecretMap = info->secretmap;
level.NextMap = info->NextMap;
level.NextSecretMap = info->NextSecretMap;
compatflags.Callback();
compatflags2.Callback();
@ -1616,7 +1618,7 @@ static void writeMapName (FArchive &arc, const char *name)
static void writeSnapShot (FArchive &arc, level_info_t *i)
{
arc << i->snapshotVer;
writeMapName (arc, i->mapname);
writeMapName (arc, i->MapName);
i->snapshot->Serialize (arc);
}
@ -1654,7 +1656,7 @@ void G_WriteSnapshots (FILE *file)
{
arc = new FPNGChunkArchive (file, VIST_ID);
}
writeMapName (*arc, wadlevelinfos[i].mapname);
writeMapName (*arc, wadlevelinfos[i].MapName);
}
}
@ -1793,7 +1795,7 @@ CCMD(listsnapshots)
{
unsigned int comp, uncomp;
snapshot->GetSizes(comp, uncomp);
Printf("%s (%u -> %u bytes)\n", wadlevelinfos[i].mapname, comp, uncomp);
Printf("%s (%u -> %u bytes)\n", wadlevelinfos[i].MapName.GetChars(), comp, uncomp);
}
}
}
@ -1805,7 +1807,7 @@ CCMD(listsnapshots)
static void writeDefereds (FArchive &arc, level_info_t *i)
{
writeMapName (arc, i->mapname);
writeMapName (arc, i->MapName);
arc << i->defered;
}
@ -1917,11 +1919,11 @@ CCMD(listmaps)
for(unsigned i = 0; i < wadlevelinfos.Size(); i++)
{
level_info_t *info = &wadlevelinfos[i];
MapData *map = P_OpenMapData(info->mapname, true);
MapData *map = P_OpenMapData(info->MapName, true);
if (map != NULL)
{
Printf("%s: '%s' (%s)\n", info->mapname, info->LookupLevelName().GetChars(),
Printf("%s: '%s' (%s)\n", info->MapName.GetChars(), info->LookupLevelName().GetChars(),
Wads.GetWadName(Wads.GetLumpFile(map->lumpnum)));
delete map;
}

View file

@ -83,7 +83,7 @@ struct FMapInfoParser
void ParseLumpOrTextureName(FString &name);
void ParseCluster();
void ParseNextMap(char *mapname);
void ParseNextMap(FString &mapname);
level_info_t *ParseMapHeader(level_info_t &defaultinfo);
void ParseMapDefinition(level_info_t &leveldef);
void ParseGameInfo();
@ -269,9 +269,9 @@ struct level_info_t
{
int levelnum;
char mapname[9];
char nextmap[11];
char secretmap[11];
FString MapName;
FString NextMap;
FString NextSecretMap;
FString PName;
FString SkyPic1;
FString SkyPic2;
@ -313,7 +313,7 @@ struct level_info_t
// Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one.
FName RedirectType;
char RedirectMap[9];
FString RedirectMapName;
FString EnterPic;
FString ExitPic;

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.

View file

@ -8942,7 +8942,7 @@ static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, c
def->playernum = -1;
}
i->defered = def;
DPrintf ("%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->mapname);
DPrintf ("%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->MapName.GetChars());
}
}

View file

@ -863,7 +863,7 @@ FUNC(LS_Teleport_NewMap)
if (info && CheckIfExitIsGood (it, info))
{
G_ChangeLevel(info->mapname, arg1, arg2 ? CHANGELEVEL_KEEPFACING : 0);
G_ChangeLevel(info->MapName, arg1, arg2 ? CHANGELEVEL_KEEPFACING : 0);
return true;
}
}
@ -1648,7 +1648,7 @@ FUNC(LS_ACS_Execute)
}
else if ((info = FindLevelByNum(arg1)) != NULL)
{
mapname = info->mapname;
mapname = info->MapName;
}
else
{
@ -1671,7 +1671,7 @@ FUNC(LS_ACS_ExecuteAlways)
}
else if ((info = FindLevelByNum(arg1)) != NULL)
{
mapname = info->mapname;
mapname = info->MapName;
}
else
{
@ -1718,7 +1718,7 @@ FUNC(LS_ACS_Suspend)
if (arg1 == 0)
P_SuspendScript (arg0, level.MapName);
else if ((info = FindLevelByNum (arg1)) )
P_SuspendScript (arg0, info->mapname);
P_SuspendScript (arg0, info->MapName);
return true;
}
@ -1731,7 +1731,7 @@ FUNC(LS_ACS_Terminate)
if (arg1 == 0)
P_TerminateScript (arg0, level.MapName);
else if ((info = FindLevelByNum (arg1)) )
P_TerminateScript (arg0, info->mapname);
P_TerminateScript (arg0, info->MapName);
return true;
}

View file

@ -272,11 +272,12 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
FString fmt;
int lump_wad;
int lump_map;
int lump_name;
int lump_name = -1;
// Check for both *.wad and *.map in order to load Build maps
// as well. The higher one will take precedence.
lump_name = Wads.CheckNumForName(mapname);
// Names with more than 8 characters will only be checked as .wad and .map.
if (strlen(mapname) <= 8) lump_name = Wads.CheckNumForName(mapname);
fmt.Format("maps/%s.wad", mapname);
lump_wad = Wads.CheckNumForFullName(fmt);
fmt.Format("maps/%s.map", mapname);

View file

@ -349,7 +349,14 @@ FString &FString::AppendCStrPart (const char *tail, size_t tailLen)
return *this;
}
void FString::Truncate (long newlen)
FString &FString::CopyCStrPart(const char *tail, size_t tailLen)
{
ReallocBuffer(tailLen);
StrCopy(Chars, tail, tailLen);
return *this;
}
void FString::Truncate(long newlen)
{
if (newlen >= 0 && newlen < (long)Len())
{

View file

@ -167,6 +167,7 @@ public:
FString &operator += (char tail);
FString &operator += (const FName &name) { return *this += name.GetChars(); }
FString &AppendCStrPart (const char *tail, size_t tailLen);
FString &CopyCStrPart(const char *tail, size_t tailLen);
FString &operator << (const FString &tail) { return *this += tail; }
FString &operator << (const char *tail) { return *this += tail; }