mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-18 07:32:28 +00:00
- removed the last static character arrays from FLevelLocals.
This commit is contained in:
parent
e49e926bd9
commit
24886b6734
18 changed files with 61 additions and 74 deletions
|
@ -986,14 +986,10 @@ CCMD(nextmap)
|
|||
TEXTCOLOR_NORMAL " is for single-player only.\n");
|
||||
return;
|
||||
}
|
||||
char *next = NULL;
|
||||
|
||||
if (*level.nextmap)
|
||||
next = level.nextmap;
|
||||
|
||||
if (next != NULL && strncmp(next, "enDSeQ", 6))
|
||||
if (level.NextMap.Len() > 0 && level.NextMap.Compare("enDSeQ", 6))
|
||||
{
|
||||
G_DeferedInitNew(next);
|
||||
G_DeferedInitNew(level.NextMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1016,12 +1012,9 @@ CCMD(nextsecret)
|
|||
}
|
||||
char *next = NULL;
|
||||
|
||||
if (*level.secretmap)
|
||||
next = level.secretmap;
|
||||
|
||||
if (next != NULL && strncmp(next, "enDSeQ", 6))
|
||||
if (level.NextSecretMap.Len() > 0 && level.NextSecretMap.Compare("enDSeQ", 6))
|
||||
{
|
||||
G_DeferedInitNew(next);
|
||||
G_DeferedInitNew(level.NextSecretMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1107,8 +1100,8 @@ static void PrintSecretString(const char *string, bool thislevel)
|
|||
|
||||
CCMD(secret)
|
||||
{
|
||||
const char *mapname = argv.argc() < 2? level.mapname : argv[1];
|
||||
bool thislevel = !stricmp(mapname, level.mapname);
|
||||
const char *mapname = argv.argc() < 2? level.MapName.GetChars() : argv[1];
|
||||
bool thislevel = !stricmp(mapname, level.MapName);
|
||||
bool foundsome = false;
|
||||
|
||||
int lumpno=Wads.CheckNumForName("SECRETS");
|
||||
|
|
|
@ -2573,7 +2573,7 @@ static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int
|
|||
arg[i] = argval;
|
||||
}
|
||||
}
|
||||
P_StartScript(pawn, NULL, snum, level.mapname, arg, MIN<int>(countof(arg), argn), ACS_NET | always);
|
||||
P_StartScript(pawn, NULL, snum, level.MapName, arg, MIN<int>(countof(arg), argn), ACS_NET | always);
|
||||
}
|
||||
|
||||
void Net_SkipCommand (int type, BYTE **stream)
|
||||
|
|
|
@ -202,15 +202,13 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
|
|||
{
|
||||
sc.MustGetStringName("=");
|
||||
sc.MustGetString();
|
||||
strncpy(level.nextmap, sc.String, 8);
|
||||
level.nextmap[8]=0;
|
||||
level.NextMap = sc.String;
|
||||
}
|
||||
else if (sc.Compare("nextsecret"))
|
||||
{
|
||||
sc.MustGetStringName("=");
|
||||
sc.MustGetString();
|
||||
strncpy(level.secretmap, sc.String, 8);
|
||||
level.secretmap[8]=0;
|
||||
level.NextSecretMap = sc.String;
|
||||
}
|
||||
else if (sc.Compare("drown"))
|
||||
{
|
||||
|
|
|
@ -1621,7 +1621,7 @@ void G_DoReborn (int playernum, bool freshbot)
|
|||
{ // Reload the level from scratch
|
||||
bool indemo = demoplayback;
|
||||
BackupSaveName = "";
|
||||
G_InitNew (level.mapname, false);
|
||||
G_InitNew (level.MapName, false);
|
||||
demoplayback = indemo;
|
||||
// gameaction = ga_loadlevel;
|
||||
}
|
||||
|
@ -2027,7 +2027,7 @@ static void PutSaveComment (FILE *file)
|
|||
|
||||
// Get level name
|
||||
//strcpy (comment, level.level_name);
|
||||
mysnprintf(comment, countof(comment), "%s - %s", level.mapname, level.LevelName.GetChars());
|
||||
mysnprintf(comment, countof(comment), "%s - %s", level.MapName.GetChars(), level.LevelName.GetChars());
|
||||
len = (WORD)strlen (comment);
|
||||
comment[len] = '\n';
|
||||
|
||||
|
@ -2088,7 +2088,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
|
|||
M_AppendPNGText (stdfile, "Engine", GAMESIG);
|
||||
M_AppendPNGText (stdfile, "ZDoom Save Version", SAVESIG);
|
||||
M_AppendPNGText (stdfile, "Title", description);
|
||||
M_AppendPNGText (stdfile, "Current Map", level.mapname);
|
||||
M_AppendPNGText (stdfile, "Current Map", level.MapName);
|
||||
PutSaveWads (stdfile);
|
||||
PutSaveComment (stdfile);
|
||||
|
||||
|
@ -2289,7 +2289,7 @@ void G_BeginRecording (const char *startmap)
|
|||
|
||||
if (startmap == NULL)
|
||||
{
|
||||
startmap = level.mapname;
|
||||
startmap = level.MapName;
|
||||
}
|
||||
demo_p = demobuffer;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void AHeresiarch::Die (AActor *source, AActor *inflictor, int dmgflags)
|
|||
|
||||
if (script != 0)
|
||||
{
|
||||
P_StartScript (this, NULL, script, level.mapname, NULL, 0, 0);
|
||||
P_StartScript (this, NULL, script, level.MapName, NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -445,10 +445,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
|||
bglobal.Init ();
|
||||
}
|
||||
|
||||
if (mapname != level.mapname)
|
||||
{
|
||||
strcpy (level.mapname, mapname);
|
||||
}
|
||||
level.MapName = mapname;
|
||||
if (bTitleLevel)
|
||||
{
|
||||
gamestate = GS_TITLELEVEL;
|
||||
|
@ -491,9 +488,9 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
|
|||
{
|
||||
// end the game
|
||||
levelname = NULL;
|
||||
if (!strncmp(level.nextmap, "enDSeQ",6))
|
||||
if (!level.NextMap.Compare("enDSeQ",6))
|
||||
{
|
||||
levelname = level.nextmap; // If there is already an end sequence please leave it alone!
|
||||
nextlevel = level.NextMap; // If there is already an end sequence please leave it alone!
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -596,18 +593,18 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
|
|||
|
||||
const char *G_GetExitMap()
|
||||
{
|
||||
return level.nextmap;
|
||||
return level.NextMap;
|
||||
}
|
||||
|
||||
const char *G_GetSecretExitMap()
|
||||
{
|
||||
const char *nextmap = level.nextmap;
|
||||
const char *nextmap = level.NextMap;
|
||||
|
||||
if (level.secretmap[0] != 0)
|
||||
if (level.NextSecretMap.Len() > 0)
|
||||
{
|
||||
if (P_CheckMapData(level.secretmap))
|
||||
if (P_CheckMapData(level.NextSecretMap))
|
||||
{
|
||||
nextmap = level.secretmap;
|
||||
nextmap = level.NextSecretMap;
|
||||
}
|
||||
}
|
||||
return nextmap;
|
||||
|
@ -641,7 +638,7 @@ void G_DoCompleted (void)
|
|||
|
||||
if (gamestate == GS_TITLELEVEL)
|
||||
{
|
||||
strncpy (level.mapname, nextlevel, 255);
|
||||
level.MapName = nextlevel;
|
||||
G_DoLoadLevel (startpos, false);
|
||||
startpos = 0;
|
||||
viewactive = true;
|
||||
|
@ -650,20 +647,20 @@ void G_DoCompleted (void)
|
|||
|
||||
// [RH] Mark this level as having been visited
|
||||
if (!(level.flags & LEVEL_CHANGEMAPCHEAT))
|
||||
FindLevelInfo (level.mapname)->flags |= LEVEL_VISITED;
|
||||
FindLevelInfo (level.MapName)->flags |= LEVEL_VISITED;
|
||||
|
||||
if (automapactive)
|
||||
AM_Stop ();
|
||||
|
||||
wminfo.finished_ep = level.cluster - 1;
|
||||
wminfo.LName0 = TexMan[TexMan.CheckForTexture(level.info->PName, FTexture::TEX_MiscPatch)];
|
||||
wminfo.current = level.mapname;
|
||||
wminfo.current = level.MapName;
|
||||
|
||||
if (deathmatch &&
|
||||
(dmflags & DF_SAME_LEVEL) &&
|
||||
!(level.flags & LEVEL_CHANGEMAPCHEAT))
|
||||
{
|
||||
wminfo.next = level.mapname;
|
||||
wminfo.next = level.MapName;
|
||||
wminfo.LName1 = wminfo.LName0;
|
||||
}
|
||||
else
|
||||
|
@ -850,7 +847,7 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
"\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36"
|
||||
"\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"
|
||||
TEXTCOLOR_BOLD "%s - %s\n\n",
|
||||
level.mapname, level.LevelName.GetChars());
|
||||
level.MapName.GetChars(), level.LevelName.GetChars());
|
||||
|
||||
if (wipegamestate == GS_LEVEL)
|
||||
wipegamestate = GS_FORCEWIPE;
|
||||
|
@ -899,7 +896,7 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
}
|
||||
|
||||
level.maptime = 0;
|
||||
P_SetupLevel (level.mapname, position);
|
||||
P_SetupLevel (level.MapName, position);
|
||||
|
||||
AM_LevelInit();
|
||||
|
||||
|
@ -1056,7 +1053,7 @@ void G_DoWorldDone (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
strncpy (level.mapname, nextlevel, 255);
|
||||
level.MapName = nextlevel;
|
||||
}
|
||||
G_StartTravel ();
|
||||
G_DoLoadLevel (startpos, true);
|
||||
|
@ -1217,7 +1214,7 @@ void G_InitLevelLocals ()
|
|||
level.flags = 0;
|
||||
level.flags2 = 0;
|
||||
|
||||
info = FindLevelInfo (level.mapname);
|
||||
info = FindLevelInfo (level.MapName);
|
||||
|
||||
level.info = info;
|
||||
level.skyspeed1 = info->skyspeed1;
|
||||
|
@ -1274,10 +1271,8 @@ void G_InitLevelLocals ()
|
|||
level.musicorder = info->musicorder;
|
||||
|
||||
level.LevelName = level.info->LookupLevelName();
|
||||
strncpy (level.nextmap, info->nextmap, 10);
|
||||
level.nextmap[10] = 0;
|
||||
strncpy (level.secretmap, info->secretmap, 10);
|
||||
level.secretmap[10] = 0;
|
||||
level.NextMap = info->nextmap;
|
||||
level.NextSecretMap = info->secretmap;
|
||||
|
||||
compatflags.Callback();
|
||||
compatflags2.Callback();
|
||||
|
|
|
@ -391,9 +391,9 @@ struct FLevelLocals
|
|||
int levelnum;
|
||||
int lumpnum;
|
||||
FString LevelName;
|
||||
char mapname[256]; // the lump name (E1M1, MAP01, etc)
|
||||
char nextmap[11]; // go here when using the regular exit
|
||||
char secretmap[11]; // map to go to when used secret exit
|
||||
FString MapName; // the lump name (E1M1, MAP01, etc)
|
||||
FString NextMap; // go here when using the regular exit
|
||||
FString NextSecretMap; // map to go to when used secret exit
|
||||
EMapType maptype;
|
||||
|
||||
DWORD flags;
|
||||
|
|
|
@ -830,7 +830,7 @@ class CommandDrawString : public SBarInfoCommand
|
|||
if(level.lumpnum != cache)
|
||||
{
|
||||
cache = level.lumpnum;
|
||||
str = level.mapname;
|
||||
str = level.MapName;
|
||||
str.ToUpper();
|
||||
RealignString();
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ void ST_FormatMapName(FString &mapname, const char *mapnamecolor)
|
|||
|
||||
if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub))
|
||||
{
|
||||
mapname << level.mapname << ": ";
|
||||
mapname << level.MapName << ": ";
|
||||
}
|
||||
mapname << mapnamecolor << level.LevelName;
|
||||
}
|
||||
|
|
|
@ -6981,7 +6981,7 @@ scriptwait:
|
|||
break;
|
||||
|
||||
case PRINTNAME_LEVEL:
|
||||
work += level.mapname;
|
||||
work += level.MapName;
|
||||
break;
|
||||
|
||||
case PRINTNAME_SKILL:
|
||||
|
@ -8950,7 +8950,7 @@ EXTERN_CVAR (Bool, sv_cheats)
|
|||
|
||||
int P_StartScript (AActor *who, line_t *where, int script, const char *map, const int *args, int argcount, int flags)
|
||||
{
|
||||
if (map == NULL || 0 == strnicmp (level.mapname, map, 8))
|
||||
if (map == NULL || 0 == strnicmp (level.MapName, map, 8))
|
||||
{
|
||||
FBehavior *module = NULL;
|
||||
const ScriptPtr *scriptdata;
|
||||
|
@ -9003,17 +9003,17 @@ int P_StartScript (AActor *who, line_t *where, int script, const char *map, cons
|
|||
return false;
|
||||
}
|
||||
|
||||
void P_SuspendScript (int script, char *map)
|
||||
void P_SuspendScript (int script, const char *map)
|
||||
{
|
||||
if (strnicmp (level.mapname, map, 8))
|
||||
if (strnicmp (level.MapName, map, 8))
|
||||
addDefered (FindLevelInfo (map), acsdefered_t::defsuspend, script, NULL, 0, NULL);
|
||||
else
|
||||
SetScriptState (script, DLevelScript::SCRIPT_Suspended);
|
||||
}
|
||||
|
||||
void P_TerminateScript (int script, char *map)
|
||||
void P_TerminateScript (int script, const char *map)
|
||||
{
|
||||
if (strnicmp (level.mapname, map, 8))
|
||||
if (strnicmp (level.MapName, map, 8))
|
||||
addDefered (FindLevelInfo (map), acsdefered_t::defterminate, script, NULL, 0, NULL);
|
||||
else
|
||||
SetScriptState (script, DLevelScript::SCRIPT_PleaseRemove);
|
||||
|
|
|
@ -1644,7 +1644,7 @@ FUNC(LS_ACS_Execute)
|
|||
|
||||
if (arg1 == 0)
|
||||
{
|
||||
mapname = level.mapname;
|
||||
mapname = level.MapName;
|
||||
}
|
||||
else if ((info = FindLevelByNum(arg1)) != NULL)
|
||||
{
|
||||
|
@ -1667,7 +1667,7 @@ FUNC(LS_ACS_ExecuteAlways)
|
|||
|
||||
if (arg1 == 0)
|
||||
{
|
||||
mapname = level.mapname;
|
||||
mapname = level.MapName;
|
||||
}
|
||||
else if ((info = FindLevelByNum(arg1)) != NULL)
|
||||
{
|
||||
|
@ -1707,7 +1707,7 @@ FUNC(LS_ACS_ExecuteWithResult)
|
|||
int args[4] = { arg1, arg2, arg3, arg4 };
|
||||
int flags = (backSide ? ACS_BACKSIDE : 0) | ACS_ALWAYS | ACS_WANTRESULT;
|
||||
|
||||
return P_StartScript (it, ln, arg0, level.mapname, args, 4, flags);
|
||||
return P_StartScript (it, ln, arg0, level.MapName, args, 4, flags);
|
||||
}
|
||||
|
||||
FUNC(LS_ACS_Suspend)
|
||||
|
@ -1716,7 +1716,7 @@ FUNC(LS_ACS_Suspend)
|
|||
level_info_t *info;
|
||||
|
||||
if (arg1 == 0)
|
||||
P_SuspendScript (arg0, level.mapname);
|
||||
P_SuspendScript (arg0, level.MapName);
|
||||
else if ((info = FindLevelByNum (arg1)) )
|
||||
P_SuspendScript (arg0, info->mapname);
|
||||
|
||||
|
@ -1729,7 +1729,7 @@ FUNC(LS_ACS_Terminate)
|
|||
level_info_t *info;
|
||||
|
||||
if (arg1 == 0)
|
||||
P_TerminateScript (arg0, level.mapname);
|
||||
P_TerminateScript (arg0, level.MapName);
|
||||
else if ((info = FindLevelByNum (arg1)) )
|
||||
P_TerminateScript (arg0, info->mapname);
|
||||
|
||||
|
|
|
@ -3559,7 +3559,7 @@ void P_FreeExtraLevelData()
|
|||
//
|
||||
|
||||
// [RH] position indicates the start spot to spawn at
|
||||
void P_SetupLevel (char *lumpname, int position)
|
||||
void P_SetupLevel (const char *lumpname, int position)
|
||||
{
|
||||
cycle_t times[20];
|
||||
FMapThing *buildthings;
|
||||
|
|
|
@ -103,7 +103,7 @@ bool P_CheckMapData(const char * mapname);
|
|||
// [RH] The only parameter used is mapname, so I removed playermask and skill.
|
||||
// On September 1, 1998, I added the position to indicate which set
|
||||
// of single-player start spots should be spawned in the level.
|
||||
void P_SetupLevel (char *mapname, int position);
|
||||
void P_SetupLevel (const char *mapname, int position);
|
||||
|
||||
void P_FreeLevelData();
|
||||
void P_FreeExtraLevelData();
|
||||
|
|
|
@ -902,8 +902,8 @@ bool EV_TeleportSector (int tag, int source_tid, int dest_tid, bool fog, int gro
|
|||
#define ACS_NET 8
|
||||
|
||||
int P_StartScript (AActor *who, line_t *where, int script, const char *map, const int *args, int argcount, int flags);
|
||||
void P_SuspendScript (int script, char *map);
|
||||
void P_TerminateScript (int script, char *map);
|
||||
void P_SuspendScript (int script, const char *map);
|
||||
void P_TerminateScript (int script, const char *map);
|
||||
void P_DoDeferedScripts (void);
|
||||
|
||||
//
|
||||
|
|
|
@ -484,7 +484,7 @@ static bool Cht_ChangeStartSpot (cheatseq_t *cheat)
|
|||
{
|
||||
char cmd[64];
|
||||
|
||||
mysnprintf (cmd, countof(cmd), "changemap %s %c", level.mapname, cheat->Args[0]);
|
||||
mysnprintf (cmd, countof(cmd), "changemap %s %c", level.MapName.GetChars(), cheat->Args[0]);
|
||||
C_DoCommand (cmd);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -408,12 +408,13 @@ static void StoreLevelStats()
|
|||
{
|
||||
for(i=0;i<LevelData.Size();i++)
|
||||
{
|
||||
if (!stricmp(LevelData[i].levelname, level.mapname)) break;
|
||||
if (!stricmp(LevelData[i].levelname, level.MapName)) break;
|
||||
}
|
||||
if (i==LevelData.Size())
|
||||
{
|
||||
LevelData.Reserve(1);
|
||||
strcpy(LevelData[i].levelname, level.mapname);
|
||||
strncpy(LevelData[i].levelname, level.MapName, 8);
|
||||
LevelData[i].levelname[8] = 0;
|
||||
}
|
||||
LevelData[i].totalkills = level.total_monsters;
|
||||
LevelData[i].killcount = level.killed_monsters;
|
||||
|
|
|
@ -1061,11 +1061,7 @@ void DoomSpecificInfo (char *buffer, size_t bufflen)
|
|||
}
|
||||
else
|
||||
{
|
||||
char name[9];
|
||||
|
||||
strncpy (name, level.mapname, 8);
|
||||
name[8] = 0;
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nCurrent map: %s", name);
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nCurrent map: %s", level.MapName.GetChars());
|
||||
|
||||
if (!viewactive)
|
||||
{
|
||||
|
|
|
@ -252,9 +252,13 @@ public:
|
|||
|
||||
int Compare (const FString &other) const { return strcmp (Chars, other.Chars); }
|
||||
int Compare (const char *other) const { return strcmp (Chars, other); }
|
||||
int Compare(const FString &other, int len) const { return strncmp(Chars, other.Chars, len); }
|
||||
int Compare(const char *other, int len) const { return strncmp(Chars, other, len); }
|
||||
|
||||
int CompareNoCase (const FString &other) const { return stricmp (Chars, other.Chars); }
|
||||
int CompareNoCase (const char *other) const { return stricmp (Chars, other); }
|
||||
int CompareNoCase(const FString &other, int len) const { return strnicmp(Chars, other.Chars, len); }
|
||||
int CompareNoCase(const char *other, int len) const { return strnicmp(Chars, other, len); }
|
||||
|
||||
protected:
|
||||
const FStringData *Data() const { return (FStringData *)Chars - 1; }
|
||||
|
|
Loading…
Reference in a new issue