added a third batch of GetChars call to FStrings.

This commit is contained in:
Christoph Oelckers 2023-10-07 23:03:40 +02:00
commit c94c63110e
31 changed files with 216 additions and 217 deletions

View file

@ -238,7 +238,7 @@ bool CreateCutscene(CutsceneDef* cs, DObject* runner, level_info_t* map)
return true; // play nothing but return as being validated
if (cs->function.IsNotEmpty())
{
CallCreateMapFunction(cs->function, runner, map);
CallCreateMapFunction(cs->function.GetChars(), runner, map);
return true;
}
else if (cs->video.IsNotEmpty())
@ -270,7 +270,7 @@ void G_DeferedInitNew (const char *mapname, int newskill)
void G_DeferedInitNew (FNewGameStartup *gs)
{
if (gs->hasPlayerClass) playerclass = gs->PlayerClass;
if (gs->hasPlayerClass) playerclass = gs->PlayerClass.GetChars();
d_mapname = AllEpisodes[gs->Episode].mEpisodeMap;
d_skill = gs->Skill;
CheckWarpTransMap (d_mapname, true);
@ -418,7 +418,7 @@ UNSAFE_CCMD (open)
{
d_mapname = "file:";
d_mapname += argv[1];
if (!P_CheckMapData(d_mapname))
if (!P_CheckMapData(d_mapname.GetChars()))
{
Printf ("No map %s\n", d_mapname.GetChars());
}
@ -515,7 +515,7 @@ void G_DoNewGame (void)
{
gameskill = d_skill;
}
G_InitNew (d_mapname, false);
G_InitNew (d_mapname.GetChars(), false);
gameaction = ga_nothing;
}
@ -574,8 +574,8 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
auto redirectmap = FindLevelInfo(mapname);
if (redirectmap->RedirectCVAR != NAME_None)
redirectmap = redirectmap->CheckLevelRedirect();
if (redirectmap && redirectmap->MapName.GetChars()[0])
mapname = redirectmap->MapName;
if (redirectmap && redirectmap->MapName.IsNotEmpty())
mapname = redirectmap->MapName.GetChars();
}
G_VerifySkill();
@ -738,7 +738,7 @@ void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags,
{
FString reallevelname = levelname;
CheckWarpTransMap(reallevelname, true);
nextinfo = FindLevelInfo (reallevelname, false);
nextinfo = FindLevelInfo (reallevelname.GetChars(), false);
if (nextinfo != NULL)
{
level_info_t *nextredir = nextinfo->CheckLevelRedirect();
@ -803,7 +803,7 @@ void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags,
staticEventManager.WorldUnloaded(nextlevel);
unloading = false;
STAT_ChangeLevel(nextlevel, this);
STAT_ChangeLevel(nextlevel.GetChars(), this);
if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
{
@ -850,7 +850,7 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, ChangeLevel)
PARAM_INT(position);
PARAM_INT(inflags);
PARAM_INT(nextSkill);
self->ChangeLevel(levelname, position, inflags, nextSkill);
self->ChangeLevel(levelname.GetChars(), position, inflags, nextSkill);
return 0;
}
@ -861,13 +861,13 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, ChangeLevel)
const char *FLevelLocals::GetSecretExitMap()
{
const char *nextmap = NextMap;
const char *nextmap = NextMap.GetChars();
if (NextSecretMap.Len() > 0)
{
if (NextSecretMap.Compare("enDSeQ", 6) == 0 || P_CheckMapData(NextSecretMap))
if (NextSecretMap.Compare("enDSeQ", 6) == 0 || P_CheckMapData(NextSecretMap.GetChars()))
{
nextmap = NextSecretMap;
nextmap = NextSecretMap.GetChars();
}
}
return nextmap;
@ -882,7 +882,7 @@ const char *FLevelLocals::GetSecretExitMap()
void FLevelLocals::ExitLevel (int position, bool keepFacing)
{
flags3 |= LEVEL3_EXITNORMALUSED;
ChangeLevel(NextMap, position, keepFacing ? CHANGELEVEL_KEEPFACING : 0);
ChangeLevel(NextMap.GetChars(), position, keepFacing ? CHANGELEVEL_KEEPFACING : 0);
}
static void LevelLocals_ExitLevel(FLevelLocals *self, int position, bool keepFacing)
@ -935,7 +935,7 @@ DIntermissionController* FLevelLocals::CreateIntermission()
thiscluster = FindClusterInfo (cluster);
bool endgame = strncmp (nextlevel, "enDSeQ", 6) == 0;
bool endgame = strncmp (nextlevel.GetChars(), "enDSeQ", 6) == 0;
if (endgame)
{
FName endsequence = ENamedName(strtoll(nextlevel.GetChars()+6, NULL, 16));
@ -956,11 +956,11 @@ DIntermissionController* FLevelLocals::CreateIntermission()
auto ext = info->ExitMapTexts.CheckKey(flags3 & LEVEL3_EXITSECRETUSED ? NAME_Secret : NAME_Normal);
if (ext != nullptr && (ext->mDefined & FExitText::DEF_TEXT))
{
controller = F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic : gameinfo.finaleMusic,
controller = F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic.GetChars() : gameinfo.finaleMusic.GetChars(),
ext->mDefined & FExitText::DEF_MUSIC ? ext->mOrder : gameinfo.finaleOrder,
-1, 0,
ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop : gameinfo.FinaleFlat,
ext->mText,
ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop.GetChars() : gameinfo.FinaleFlat.GetChars(),
ext->mText.GetChars(),
false,
ext->mDefined & FExitText::DEF_PIC,
ext->mDefined & FExitText::DEF_LOOKUP,
@ -968,9 +968,9 @@ DIntermissionController* FLevelLocals::CreateIntermission()
}
else if (!(info->flags2 & LEVEL2_NOCLUSTERTEXT))
{
controller = F_StartFinale(thiscluster->MessageMusic, thiscluster->musicorder,
controller = F_StartFinale(thiscluster->MessageMusic.GetChars(), thiscluster->musicorder,
thiscluster->cdtrack, thiscluster->cdid,
thiscluster->FinaleFlat, thiscluster->ExitText,
thiscluster->FinaleFlat.GetChars(), thiscluster->ExitText.GetChars(),
thiscluster->flags & CLUSTER_EXITTEXTINLUMP,
thiscluster->flags & CLUSTER_FINALEPIC,
thiscluster->flags & CLUSTER_LOOKUPEXITTEXT,
@ -989,11 +989,11 @@ DIntermissionController* FLevelLocals::CreateIntermission()
{
if ((ext->mDefined & FExitText::DEF_TEXT))
{
controller = F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic : gameinfo.finaleMusic,
controller = F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic.GetChars() : gameinfo.finaleMusic.GetChars(),
ext->mDefined & FExitText::DEF_MUSIC ? ext->mOrder : gameinfo.finaleOrder,
-1, 0,
ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop : gameinfo.FinaleFlat,
ext->mText,
ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop.GetChars() : gameinfo.FinaleFlat.GetChars(),
ext->mText.GetChars(),
false,
ext->mDefined & FExitText::DEF_PIC,
ext->mDefined & FExitText::DEF_LOOKUP,
@ -1002,7 +1002,7 @@ DIntermissionController* FLevelLocals::CreateIntermission()
return controller;
}
nextcluster = FindClusterInfo (FindLevelInfo (nextlevel)->cluster);
nextcluster = FindClusterInfo (FindLevelInfo (nextlevel.GetChars())->cluster);
if (nextcluster->cluster != cluster && !(info->flags2 & LEVEL2_NOCLUSTERTEXT))
{
@ -1010,9 +1010,9 @@ DIntermissionController* FLevelLocals::CreateIntermission()
// than the current one and we're not in deathmatch.
if (nextcluster->EnterText.IsNotEmpty())
{
controller = F_StartFinale (nextcluster->MessageMusic, nextcluster->musicorder,
controller = F_StartFinale (nextcluster->MessageMusic.GetChars(), nextcluster->musicorder,
nextcluster->cdtrack, nextcluster->cdid,
nextcluster->FinaleFlat, nextcluster->EnterText,
nextcluster->FinaleFlat.GetChars(), nextcluster->EnterText.GetChars(),
nextcluster->flags & CLUSTER_ENTERTEXTINLUMP,
nextcluster->flags & CLUSTER_FINALEPIC,
nextcluster->flags & CLUSTER_LOOKUPENTERTEXT,
@ -1020,9 +1020,9 @@ DIntermissionController* FLevelLocals::CreateIntermission()
}
else if (thiscluster->ExitText.IsNotEmpty())
{
controller = F_StartFinale (thiscluster->MessageMusic, thiscluster->musicorder,
controller = F_StartFinale (thiscluster->MessageMusic.GetChars(), thiscluster->musicorder,
thiscluster->cdtrack, nextcluster->cdid,
thiscluster->FinaleFlat, thiscluster->ExitText,
thiscluster->FinaleFlat.GetChars(), thiscluster->ExitText.GetChars(),
thiscluster->flags & CLUSTER_EXITTEXTINLUMP,
thiscluster->flags & CLUSTER_FINALEPIC,
thiscluster->flags & CLUSTER_LOOKUPEXITTEXT,
@ -1128,9 +1128,9 @@ void G_DoCompleted (void)
statusScreen = WI_Start (&staticWmInfo);
}
bool endgame = strncmp(nextlevel, "enDSeQ", 6) == 0;
bool endgame = strncmp(nextlevel.GetChars(), "enDSeQ", 6) == 0;
intermissionScreen = primaryLevel->CreateIntermission();
auto nextinfo = !playinter || endgame? nullptr : FindLevelInfo(nextlevel, false);
auto nextinfo = !playinter || endgame? nullptr : FindLevelInfo(nextlevel.GetChars(), false);
RunIntermission(primaryLevel->info, nextinfo, intermissionScreen, statusScreen, [=](bool)
{
if (!endgame) primaryLevel->WorldDone();
@ -1155,7 +1155,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
uint32_t langtable[2] = {};
wminfo.finished_ep = cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(info->PName, ETextureType::MiscPatch);
wminfo.LName0 = TexMan.CheckForTexture(info->PName.GetChars(), ETextureType::MiscPatch);
wminfo.thisname = info->LookupLevelName(&langtable[0]); // re-get the name so we have more info about its origin.
if (!wminfo.LName0.isValid() || !(info->flags3 & LEVEL3_HIDEAUTHORNAME)) wminfo.thisauthor = info->AuthorName;
wminfo.current = MapName;
@ -1171,8 +1171,8 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
}
else
{
level_info_t *nextinfo = FindLevelInfo (nextlevel, false);
if (nextinfo == NULL || strncmp (nextlevel, "enDSeQ", 6) == 0)
level_info_t *nextinfo = FindLevelInfo (nextlevel.GetChars(), false);
if (nextinfo == NULL || strncmp (nextlevel.GetChars(), "enDSeQ", 6) == 0)
{
wminfo.next = "";
wminfo.LName1.SetInvalid();
@ -1182,7 +1182,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
else
{
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName.GetChars(), ETextureType::MiscPatch);
wminfo.nextname = nextinfo->LookupLevelName(&langtable[1]);
if (!wminfo.LName1.isValid() || !(nextinfo->flags3 & LEVEL3_HIDEAUTHORNAME)) wminfo.nextauthor = nextinfo->AuthorName;
}
@ -1210,7 +1210,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
CheckWarpTransMap (wminfo.next, true);
nextlevel = wminfo.next;
wminfo.next_ep = FindLevelInfo (wminfo.next)->cluster - 1;
wminfo.next_ep = FindLevelInfo (wminfo.next.GetChars())->cluster - 1;
wminfo.totalkills = killed_monsters;
wminfo.maxkills = total_monsters;
wminfo.maxitems = total_items;
@ -1411,7 +1411,7 @@ void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool au
// a flat. The data is in the WAD only because
// we look for an actual index, instead of simply
// setting one.
skyflatnum = TexMan.GetTextureID (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
skyflatnum = TexMan.GetTextureID (gameinfo.SkyFlatName.GetChars(), ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// [RH] Set up details about sky rendering
InitSkyMap (this);
@ -1804,19 +1804,19 @@ void FLevelLocals::Init()
ImpactDecalCount = 0;
frozenstate = 0;
info = FindLevelInfo (MapName);
info = FindLevelInfo (MapName.GetChars());
skyspeed1 = info->skyspeed1;
skyspeed2 = info->skyspeed2;
skytexture1 = TexMan.GetTextureID(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
skytexture2 = TexMan.GetTextureID(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
skytexture1 = TexMan.GetTextureID(info->SkyPic1.GetChars(), ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
skytexture2 = TexMan.GetTextureID(info->SkyPic2.GetChars(), ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
fadeto = info->fadeto;
cdtrack = info->cdtrack;
cdid = info->cdid;
FromSnapshot = false;
if (fadeto == 0)
{
if (strnicmp (info->FadeTable, "COLORMAP", 8) != 0)
if (strnicmp (info->FadeTable.GetChars(), "COLORMAP", 8) != 0)
{
flags |= LEVEL_HASFADETABLE;
}
@ -1962,7 +1962,7 @@ void G_WriteVisited(FSerializer &arc)
{
if (wi.flags & LEVEL_VISITED)
{
arc.AddString(nullptr, wi.MapName);
arc.AddString(nullptr, wi.MapName.GetChars());
}
}
arc.EndArray();
@ -1980,9 +1980,8 @@ void G_WriteVisited(FSerializer &arc)
{
if (playeringame[i])
{
FString key;
key.Format("%d", i);
arc(key, players[i].cls);
FStringf key("%d", i);
arc(key.GetChars(), players[i].cls);
}
}
arc.EndObject();
@ -2012,7 +2011,7 @@ void G_ReadSnapshots(FResourceFile *resf)
{
ptrdiff_t maplen = ptr - name;
FString mapname(name, (size_t)maplen);
i = FindLevelInfo(mapname);
i = FindLevelInfo(mapname.GetChars());
if (i != nullptr)
{
i->Snapshot = resl->GetRawData();
@ -2045,7 +2044,7 @@ void G_ReadVisited(FSerializer &arc)
{
FString str;
arc(nullptr, str);
auto i = FindLevelInfo(str);
auto i = FindLevelInfo(str.GetChars());
if (i != nullptr) i->flags |= LEVEL_VISITED;
}
arc.EndArray();
@ -2057,9 +2056,8 @@ void G_ReadVisited(FSerializer &arc)
{
for (int i = 0; i < MAXPLAYERS; ++i)
{
FString key;
key.Format("%d", i);
arc(key, players[i].cls);
FStringf key("%d", i);
arc(key.GetChars(), players[i].cls);
}
arc.EndObject();
}
@ -2091,7 +2089,7 @@ void P_WriteACSDefereds (FSerializer &arc)
{
if (wi.deferred.Size() > 0)
{
arc(wi.MapName, wi.deferred);
arc(wi.MapName.GetChars(), wi.deferred);
}
}
}
@ -2319,9 +2317,9 @@ void FLevelLocals::SetInterMusic(const char *nextmap)
{
auto mus = info->MapInterMusic.CheckKey(nextmap);
if (mus != nullptr)
S_ChangeMusic(mus->first, mus->second);
S_ChangeMusic(mus->first.GetChars(), mus->second);
else if (info->InterMusic.IsNotEmpty())
S_ChangeMusic(info->InterMusic, info->intermusicorder);
S_ChangeMusic(info->InterMusic.GetChars(), info->intermusicorder);
else
S_ChangeMusic(gameinfo.intermissionMusic.GetChars(), gameinfo.intermissionOrder);
}
@ -2330,7 +2328,7 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_STRING(map);
self->SetInterMusic(map);
self->SetInterMusic(map.GetChars());
return 0;
}
@ -2437,7 +2435,7 @@ int IsPointInMap(FLevelLocals *Level, double x, double y, double z)
void FLevelLocals::SetMusic()
{
S_ChangeMusic(Music, musicorder);
S_ChangeMusic(Music.GetChars(), musicorder);
}
@ -2464,6 +2462,6 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, GetEpisodeName)
// This will need some heuristics to assign a proper episode to each existing level.
// Stuff for later. for now this just checks the STAT module for the currently running episode,
// which should be fine unless cheating.
ACTION_RETURN_STRING(GStrings.localize(STAT_EpisodeName()));
ACTION_RETURN_STRING(GStrings.localize(STAT_EpisodeName().GetChars()));
}