From 0c397033f1387d39ca9f2b254b473565a411f024 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 8 Oct 2023 09:15:32 +0200 Subject: [PATCH] added the remaining needed GetChars calls. --- source/core/defparser.cpp | 50 ++++++++++++------------- source/core/g_mapinfo.cpp | 10 ++--- source/core/gameconfigfile.cpp | 8 ++-- source/core/gamecontrol.cpp | 22 +++++------ source/core/initfs.cpp | 34 ++++++++--------- source/core/mainloop.cpp | 12 +++--- source/core/maphack.cpp | 6 +-- source/core/mapinfo.cpp | 8 ++-- source/core/mapinfo.h | 8 ++-- source/core/menu/loadsavemenu.cpp | 2 +- source/core/menu/razemenu.cpp | 28 +++++++------- source/core/menu/usermap.cpp | 8 ++-- source/core/music/s_advsound.cpp | 4 +- source/core/precache.cpp | 2 +- source/core/quotes.cpp | 10 ++--- source/core/r_data/gldefs.cpp | 8 ++-- source/core/raze_music.cpp | 12 +++--- source/core/raze_sound.cpp | 4 +- source/core/razefont.cpp | 4 +- source/core/rts.cpp | 6 +-- source/core/savegamehelp.cpp | 32 ++++++++-------- source/core/screenjob.cpp | 6 +-- source/core/screenshot.cpp | 10 ++--- source/core/searchpaths.cpp | 40 ++++++++++---------- source/core/secrets.cpp | 4 +- source/core/statistics.cpp | 22 +++++------ source/core/textures/hightile.cpp | 2 +- source/core/textures/skytexture.cpp | 4 +- source/core/textures/tilesetbuilder.cpp | 34 ++++++++--------- source/core/textures/tiletexture.cpp | 4 +- source/core/thingdef_properties.cpp | 11 +++--- source/core/zcc_compile_raze.cpp | 2 +- source/games/blood/src/barf.cpp | 2 +- source/games/blood/src/blood.cpp | 10 ++--- source/games/blood/src/d_menu.cpp | 2 +- source/games/blood/src/db.cpp | 6 +-- source/games/blood/src/levels.cpp | 20 +++++----- source/games/blood/src/sound.cpp | 6 +-- source/games/blood/src/view.cpp | 2 +- source/games/duke/src/gamedef.cpp | 2 +- source/games/duke/src/premap.cpp | 10 ++--- source/games/duke/src/sounds.cpp | 29 +++++++------- source/games/duke/src/vmexports.cpp | 2 +- source/games/exhumed/src/2d.cpp | 4 +- source/games/exhumed/src/gameloop.cpp | 4 +- source/games/exhumed/src/init.cpp | 4 +- source/games/exhumed/src/movie.cpp | 4 +- source/games/exhumed/src/player.cpp | 2 +- source/games/exhumed/src/ramses.cpp | 2 +- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/sound.cpp | 2 +- source/games/exhumed/src/view.cpp | 2 +- source/games/sw/src/game.cpp | 12 +++--- source/games/sw/src/scrip2.cpp | 6 +-- source/games/sw/src/serp.cpp | 2 +- source/games/sw/src/sounds.cpp | 10 ++--- source/games/sw/src/sprite.cpp | 2 +- source/games/sw/src/sumo.cpp | 8 ++-- source/games/sw/src/zilla.cpp | 2 +- 59 files changed, 289 insertions(+), 287 deletions(-) diff --git a/source/core/defparser.cpp b/source/core/defparser.cpp index e8db92104..412b4f309 100644 --- a/source/core/defparser.cpp +++ b/source/core/defparser.cpp @@ -225,7 +225,7 @@ static void processTileImport(FScanner& sc, const char* cmd, FScriptPosition& po imp.alphacut = clamp(imp.alphacut, 0, 255); - if (imp.fn.IsNotEmpty() && tileImportFromTexture(sc, imp.fn, imp.tile, imp.alphacut, imp.istexture) < 0) return; + if (imp.fn.IsNotEmpty() && tileImportFromTexture(sc, imp.fn.GetChars(), imp.tile, imp.alphacut, imp.istexture) < 0) return; tbuild->tile[imp.tile].extinfo.picanm.sf |= imp.flags; if (imp.surface != INT_MAX) tbuild->tile[imp.tile].extinfo.surftype = imp.surface; @@ -328,7 +328,7 @@ static void parseDefine(FScanner& sc, FScriptPosition& pos) FString name; if (!sc.GetString(name)) return; if (!sc.GetNumber()) return; - sc.AddSymbol(name, sc.Number); + sc.AddSymbol(name.GetChars(), sc.Number); } //=========================================================================== @@ -389,7 +389,7 @@ static void parseTexturePaletteBlock(FScanner& sc, int tile) { if ((unsigned)pal >= MAXREALPAL) pos.Message(MSG_ERROR, "texture (%d): invalid palette number %d ", tile, pal); else if (fn.IsEmpty()) pos.Message(MSG_ERROR, "texture (%d): missing file name in palette definition", tile); - else if (!fileSystem.FileExists(fn)) pos.Message(MSG_ERROR, "texture (%d): file '%s' not found in palette definition", tile, fn.GetChars()); + else if (!fileSystem.FileExists(fn.GetChars())) pos.Message(MSG_ERROR, "texture (%d): file '%s' not found in palette definition", tile, fn.GetChars()); else { if (xsiz > 0 && ysiz > 0) @@ -399,7 +399,7 @@ static void parseTexturePaletteBlock(FScanner& sc, int tile) xscale = 1.0f / xscale; yscale = 1.0f / yscale; - tileSetHightileReplacement(sc, tile, pal, fn, alphacut, xscale, yscale, specpower, specfactor, indexed); + tileSetHightileReplacement(sc, tile, pal, fn.GetChars(), alphacut, xscale, yscale, specpower, specfactor, indexed); } } } @@ -426,7 +426,7 @@ static void parseTextureSpecialBlock(FScanner& sc, int tile, int pal) if ((unsigned)tile < MAXUSERTILES) { if (fn.IsEmpty()) pos.Message(MSG_ERROR, "texture (%d): missing file name for layer definition", tile); - else if (!fileSystem.FileExists(fn)) pos.Message(MSG_ERROR, "texture (%d): file '%s' not found in layer definition", tile, fn.GetChars()); + else if (!fileSystem.FileExists(fn.GetChars())) pos.Message(MSG_ERROR, "texture (%d): file '%s' not found in layer definition", tile, fn.GetChars()); else { if (pal == DETAILPAL) @@ -435,7 +435,7 @@ static void parseTextureSpecialBlock(FScanner& sc, int tile, int pal) yscale = 1.0f / yscale; } - tileSetHightileReplacement(sc, tile, pal, fn, -1.f, xscale, yscale, specpower, specfactor); + tileSetHightileReplacement(sc, tile, pal, fn.GetChars(), -1.f, xscale, yscale, specpower, specfactor); } } } @@ -912,7 +912,7 @@ static void parseVoxel(FScanner& sc, FScriptPosition& pos) pos.Message(MSG_ERROR, "Maximum number of voxels (%d) already defined.", MAXVOXELS); error = true; } - else if (voxDefine(tbuild->nextvoxid, fn)) + else if (voxDefine(tbuild->nextvoxid, fn.GetChars())) { pos.Message(MSG_ERROR, "Unable to load voxel file \"%s\"", fn.GetChars()); error = true; @@ -1058,7 +1058,7 @@ static void parseMusic(FScanner& sc, FScriptPosition& pos) if (sc.Compare("id")) sc.GetString(id); else if (sc.Compare("file")) sc.GetString(file); } - SetMusicReplacement(id, file); + SetMusicReplacement(id.GetChars(), file.GetChars()); } //=========================================================================== @@ -1129,7 +1129,7 @@ static void parseRffDefineId(FScanner& sc, FScriptPosition& pos) if (!sc.GetNumber(resID)) return; if (!sc.GetString()) return; resName.AppendFormat(".%s", resType.GetChars()); - fileSystem.CreatePathlessCopy(resName, resID, 0); + fileSystem.CreatePathlessCopy(resName.GetChars(), resID, 0); } //=========================================================================== @@ -1231,7 +1231,7 @@ static void parseHighpalookup(FScanner& sc, FScriptPosition& pos) { pos.Message(MSG_ERROR, "highpalookup: missing file name"); } - else if (!fileSystem.FileExists(fn)) + else if (!fileSystem.FileExists(fn.GetChars())) { pos.Message(MSG_ERROR, "highpalookup: file %s not found", fn.GetChars()); } @@ -1262,7 +1262,7 @@ static void parseDefineModel(FScanner& sc, FScriptPosition& pos) if (!sc.GetFloat(scale, true)) return; if (!sc.GetNumber(shadeoffs, true)) return; - mdglobal.lastmodelid = modelManager.LoadModel(modelfn); + mdglobal.lastmodelid = modelManager.LoadModel(modelfn.GetChars()); if (mdglobal.lastmodelid < 0) { pos.Message(MSG_WARNING, "definemodel: unable to load model file '%s'", modelfn.GetChars()); @@ -1300,7 +1300,7 @@ static void parseDefineModelFrame(FScanner& sc, FScriptPosition& pos) } for (int i = firsttile; i <= lasttile && ok; i++) { - int err = (modelManager.DefineFrame(mdglobal.lastmodelid, framename, i, max(0, mdglobal.modelskin), 0.0f, 0)); + int err = (modelManager.DefineFrame(mdglobal.lastmodelid, framename.GetChars(), i, max(0, mdglobal.modelskin), 0.0f, 0)); if (err < 0) ok = false; if (err == -2) pos.Message(MSG_ERROR, "Invalid tile number %d", i); else if (err == -3) pos.Message(MSG_ERROR, "Invalid frame name '%s'", framename.GetChars()); @@ -1330,7 +1330,7 @@ static void parseDefineModelAnim(FScanner& sc, FScriptPosition& pos) pos.Message(MSG_WARNING, "definemodelframe: Ignoring animation definition outside model."); return; } - int err = (modelManager.DefineAnimation(mdglobal.lastmodelid, startframe, endframe, (int32_t)(dfps * (65536.0 * .001)), flags)); + int err = (modelManager.DefineAnimation(mdglobal.lastmodelid, startframe.GetChars(), endframe.GetChars(), (int32_t)(dfps * (65536.0 * .001)), flags)); if (err == -2) pos.Message(MSG_ERROR, "Invalid start frame name %s", startframe.GetChars()); else if (err == -3) pos.Message(MSG_ERROR, "Invalid end frame name %s", endframe.GetChars()); } @@ -1352,9 +1352,9 @@ static void parseDefineModelSkin(FScanner& sc, FScriptPosition& pos) if (mdglobal.seenframe) { mdglobal.modelskin = ++mdglobal.lastmodelskin; } mdglobal.seenframe = 0; - if (!fileSystem.FileExists(skinfn)) return; + if (!fileSystem.FileExists(skinfn.GetChars())) return; - int err = (modelManager.DefineSkin(mdglobal.lastmodelid, skinfn, palnum, max(0, mdglobal.modelskin), 0, 0.0f, 1.0f, 1.0f, 0)); + int err = (modelManager.DefineSkin(mdglobal.lastmodelid, skinfn.GetChars(), palnum, max(0, mdglobal.modelskin), 0, 0.0f, 1.0f, 1.0f, 0)); if (err == -2) pos.Message(MSG_ERROR, "Invalid skin file name %s", skinfn.GetChars()); else if (err == -3) pos.Message(MSG_ERROR, "Invalid palette %d", palnum); } @@ -1441,7 +1441,7 @@ static bool parseModelFrameBlock(FScanner& sc, FixedBitArray<1024>& usedframes) } for (int i = starttile; i <= endtile && ok; i++) { - int res = modelManager.DefineFrame(mdglobal.lastmodelid, framename, i, max(0, mdglobal.modelskin), smoothduration, pal); + int res = modelManager.DefineFrame(mdglobal.lastmodelid, framename.GetChars(), i, max(0, mdglobal.modelskin), smoothduration, pal); if (res < 0) { ok = false; @@ -1484,7 +1484,7 @@ static bool parseModelAnimBlock(FScanner& sc) return false; } - int res = modelManager.DefineAnimation(mdglobal.lastmodelid, startframe, endframe, (int)(fps * (65536.0 * .001)), flags); + int res = modelManager.DefineAnimation(mdglobal.lastmodelid, startframe.GetChars(), endframe.GetChars(), (int)(fps * (65536.0 * .001)), flags); if (res < 0) { if (res == -2) pos.Message(MSG_ERROR, "Invalid start frame name %s", startframe.GetChars()); @@ -1527,14 +1527,14 @@ static bool parseModelSkinBlock(FScanner& sc, int pal) if (mdglobal.seenframe) mdglobal.modelskin = ++mdglobal.lastmodelskin; mdglobal.seenframe = 0; - if (!fileSystem.FileExists(filename)) + if (!fileSystem.FileExists(filename.GetChars())) { pos.Message(MSG_ERROR, "%s: file not found", filename.GetChars()); return false; } if (pal == DETAILPAL) param = 1.f / param; - int res = modelManager.DefineSkin(mdglobal.lastmodelid, filename, pal, max(0, mdglobal.modelskin), surface, param, specpower, specfactor, flags); + int res = modelManager.DefineSkin(mdglobal.lastmodelid, filename.GetChars(), pal, max(0, mdglobal.modelskin), surface, param, specpower, specfactor, flags); if (res < 0) { if (res == -2) pos.Message(MSG_ERROR, "Invalid skin filename %s", filename.GetChars()); @@ -1602,7 +1602,7 @@ static void parseModel(FScanner& sc, FScriptPosition& pos) if (sc.StartBraces(&blockend)) return; - mdglobal.lastmodelid = modelManager.LoadModel(modelfn); + mdglobal.lastmodelid = modelManager.LoadModel(modelfn.GetChars()); if (mdglobal.lastmodelid < 0) { pos.Message(MSG_WARNING, "Unable to load model file '%s'", modelfn.GetChars()); @@ -1695,14 +1695,14 @@ static bool parseDefineQAVInterpolateIgnoreBlock(FScanner& sc, const int res_id, if (temparray.Size() == 2) { // Test if keywords 'first' and 'last' have been used.' - output.Push(temparray[0].CompareNoCase("first") == 0 ? 0 : atoi(temparray[0])); - output.Push(temparray[1].CompareNoCase("last") == 0 ? maxvalue : atoi(temparray[1])); + output.Push(temparray[0].CompareNoCase("first") == 0 ? 0 : atoi(temparray[0].GetChars())); + output.Push(temparray[1].CompareNoCase("last") == 0 ? maxvalue : atoi(temparray[1].GetChars())); } } else { // We just have a number. Convert the string into an int and push it twice to the output array. - auto tempvalue = atoi(input); + auto tempvalue = atoi(input.GetChars()); for (auto i = 0; i < 2; i++) output.Push(tempvalue); } if (output.Size() != 2 || output[0] > output[1] || output[0] < 0 || output[1] > maxvalue) @@ -1801,7 +1801,7 @@ static void parseDefineQAV(FScanner& sc, FScriptPosition& pos) // Test file's validity. FixPathSeperator(fn); - auto lump = fileSystem.FindFile(fn); + auto lump = fileSystem.FindFile(fn.GetChars()); if (lump < 0) { pos.Message(MSG_ERROR, "defineqav (%d): file '%s' could not be found", res_id, fn.GetChars()); @@ -1829,7 +1829,7 @@ static void parseDefineQAV(FScanner& sc, FScriptPosition& pos) if (!interpolate) gi->RemoveQAVInterpProps(res_id); // Add new file to filesystem. - fileSystem.CreatePathlessCopy(fn, res_id, 0); + fileSystem.CreatePathlessCopy(fn.GetChars(), res_id, 0); } //=========================================================================== diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index 4759a6844..c22f87e8d 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -245,7 +245,7 @@ void FMapInfoParser::ParseConstants() FString cname = sc.String; ParseAssign(); sc.MustGetNumber(true); - sc.AddSymbol(cname, sc.Number); + sc.AddSymbol(cname.GetChars(), sc.Number); } while (sc.CheckString(",")); } @@ -1141,7 +1141,7 @@ CCMD(mapinfo) } for (auto& map : mapList) { - int lump = fileSystem.FindFile(map->fileName); + int lump = fileSystem.FindFile(map->fileName.GetChars()); if (lump >= 0) { Printf("map %s \"%s\"\n{\n", map->labelName.GetChars(), map->DisplayName()); @@ -1354,13 +1354,13 @@ MapRecord *FMapInfoParser::ParseMapHeader(MapRecord &defaultinfo) } else { - map = FindMapByName(mapname); + map = FindMapByName(mapname.GetChars()); if (!map) { map = AllocateMap(); *map = defaultinfo; DefaultExtension(mapname, ".map"); - map->SetFileName(mapname); + map->SetFileName(mapname.GetChars()); } } @@ -1374,7 +1374,7 @@ MapRecord *FMapInfoParser::ParseMapHeader(MapRecord &defaultinfo) if (map != &sink && map->name.IsEmpty()) sc.ScriptError("Missing level name"); sc.UnGet(); } - if (map->levelNumber <= 0) map->levelNumber = GetDefaultLevelNum(map->labelName); + if (map->levelNumber <= 0) map->levelNumber = GetDefaultLevelNum(map->labelName.GetChars()); return map; } diff --git a/source/core/gameconfigfile.cpp b/source/core/gameconfigfile.cpp index 5815ad84b..a135419d7 100644 --- a/source/core/gameconfigfile.cpp +++ b/source/core/gameconfigfile.cpp @@ -63,14 +63,14 @@ FGameConfigFile::FGameConfigFile () OkayToWrite = false; // Do not allow saving of the config before DoKeySetup() bModSetup = false; pathname = GetConfigPath (true); - ChangePathName (pathname); + ChangePathName (pathname.GetChars()); LoadConfigFile (); // If zdoom.ini was read from the program directory, switch // to the user directory now. If it was read from the user // directory, this effectively does nothing. pathname = GetConfigPath (false); - ChangePathName (pathname); + ChangePathName (pathname.GetChars()); // Set default IWAD search paths if none present if (!SetSection ("GameSearch.Directories")) @@ -371,7 +371,7 @@ void FGameConfigFile::DoGameSetup (const char *gamename) while (NextInSection (key, value)) { FStringf cmd("alias %s \"%s\"", key, value); - C_DoCommand(cmd); + C_DoCommand(cmd.GetChars()); } } } @@ -635,7 +635,7 @@ void G_SaveConfig() { if (!GameConfig) return; GameConfig->ArchiveGlobalData(); - GameConfig->ArchiveGameData(GameName); + GameConfig->ArchiveGameData(GameName.GetChars()); GameConfig->WriteConfigFile(); delete GameConfig; GameConfig = nullptr; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 144dd990d..db4a38fe7 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -475,7 +475,7 @@ void UserConfig::ProcessOptions() void CheckUserMap() { if (userConfig.CommandMap.IsEmpty()) return; - if (FindMapByName(userConfig.CommandMap)) + if (FindMapByName(userConfig.CommandMap.GetChars())) { return; // we already got a record for this map so no need for further checks. } @@ -484,7 +484,7 @@ void CheckUserMap() startupMap.Substitute("\\", "/"); NormalizeFileName(startupMap); - if (!fileSystem.FileExists(startupMap)) + if (!fileSystem.FileExists(startupMap.GetChars())) { Printf(PRINT_HIGH, "Level \"%s\" not found.\n", startupMap.GetChars()); startupMap = ""; @@ -800,7 +800,7 @@ static TArray SetupGame() for (unsigned i = 0; i < groups.Size(); ++i) { FString& basename = groups[i].FileInfo.name; - if (stricmp(basename, defaultiwad) == 0) + if (stricmp(basename.GetChars(), defaultiwad) == 0) { pick = i; break; @@ -814,7 +814,7 @@ static TArray SetupGame() { WadStuff stuff; stuff.Name = found.FileInfo.name; - stuff.Path = ExtractFileBase(found.FileName); + stuff.Path = ExtractFileBase(found.FileName.GetChars()); wads.Push(stuff); } @@ -832,7 +832,7 @@ static TArray SetupGame() autoloadbrightmaps = !!(flags & 4); autoloadwidescreen = !!(flags & 8); // The newly selected IWAD becomes the new default - defaultiwad = groups[pick].FileInfo.name; + defaultiwad = groups[pick].FileInfo.name.GetChars(); } groupno = pick; } @@ -869,7 +869,7 @@ static TArray SetupGame() if (ugroup.FileInfo.defname.IsNotEmpty()) selectedDef = ugroup.FileInfo.defname; // CVAR has priority. This also overwrites the global variable each time. Init here is lazy so this is ok. - if (ugroup.FileInfo.rtsname.IsNotEmpty() && **rtsname == 0) RTS_Init(ugroup.FileInfo.rtsname); + if (ugroup.FileInfo.rtsname.IsNotEmpty() && **rtsname == 0) RTS_Init(ugroup.FileInfo.rtsname.GetChars()); // For the game filter the last non-empty one wins. if (ugroup.FileInfo.gamefilter.IsNotEmpty()) LumpFilter = ugroup.FileInfo.gamefilter; @@ -1041,7 +1041,7 @@ int RunGame() if (logfile.IsNotEmpty()) { - execLogfile(logfile); + execLogfile(logfile.GetChars()); } I_DetectOS(); userConfig.ProcessOptions(); @@ -1096,7 +1096,7 @@ int RunGame() am_nameontop->SetGenericRepDefault(true, CVAR_Bool); // Blood and RR show the map name on the top of the screen by default. } - G_ReadConfig(currentGame); + G_ReadConfig(currentGame.GetChars()); V_InitFontColors(); InitLanguages(); @@ -1119,7 +1119,7 @@ int RunGame() if (userConfig.CommandName.IsNotEmpty()) { - playername = userConfig.CommandName; + playername = userConfig.CommandName.GetChars(); } GameTicRate = 30; CheckUserMap(); @@ -1317,7 +1317,7 @@ FString G_GetDemoPath() FString path = M_GetDemoPath(); path << LumpFilter << '/'; - CreatePath(path); + CreatePath(path.GetChars()); return path; } @@ -1642,7 +1642,7 @@ void I_UpdateWindowTitle() // Strip out any color escape sequences before setting a window title TArray copy(titlestr.Len() + 1); - const char* srcp = titlestr; + const char* srcp = titlestr.GetChars(); char* dstp = copy.Data(); while (*srcp != 0) diff --git a/source/core/initfs.cpp b/source/core/initfs.cpp index b1ef4889c..a250ffe6b 100644 --- a/source/core/initfs.cpp +++ b/source/core/initfs.cpp @@ -107,7 +107,7 @@ static std::vector ParseGameInfo(std::vector& pwads, c } else { - pos += D_AddFile(pwads, checkpath, true, pos, GameConfig); + pos += D_AddFile(pwads, checkpath.GetChars(), true, pos, GameConfig); } } while (sc.CheckToken(',')); } @@ -214,13 +214,13 @@ std::vector GetGameFronUserFiles() if (userConfig.AddFilesPre) for (auto& file : *userConfig.AddFilesPre) { - D_AddFile(Files, file, true, -1, GameConfig); + D_AddFile(Files, file.GetChars(), true, -1, GameConfig); } if (userConfig.AddFiles) { for (auto& file : *userConfig.AddFiles) { - D_AddFile(Files, file, true, -1, GameConfig); + D_AddFile(Files, file.GetChars(), true, -1, GameConfig); } // Finally, if the last entry in the chain is a directory, it's being considered the mod directory, and all GRPs inside need to be loaded, too. @@ -228,14 +228,14 @@ std::vector GetGameFronUserFiles() { auto fn = (*userConfig.AddFiles)[userConfig.AddFiles->NumArgs() - 1]; bool isdir = false; - if (DirEntryExists(fn, &isdir) && isdir) + if (DirEntryExists(fn.GetChars(), &isdir) && isdir) { // Insert the GRPs before this entry itself. std::string lastfn = std::move(Files.back()); Files.pop_back(); for (auto ext : validexts) { - D_AddDirectory(Files, fn, ext, GameConfig); + D_AddDirectory(Files, fn.GetChars(), ext, GameConfig); } Files.push_back(std::move(lastfn)); } @@ -271,7 +271,7 @@ static void DeleteStuff(FileSystem &fileSystem, const TArray& deletelum auto fname = fileSystem.GetFileFullName(i, false); if (cf >= 1 && cf <= numgamefiles && !str.CompareNoCase(fname)) { - fileSystem.RenameFile(i, renameTo); + fileSystem.RenameFile(i, renameTo.GetChars()); } } } @@ -344,15 +344,15 @@ void InitFileSystem(TArray& groups) // This can be overridden via command line switch if needed. if (!grp.FileInfo.loaddirectory && grp.FileName.IsNotEmpty()) { - D_AddFile(Files, grp.FileName, true, -1, GameConfig); - fn = ExtractFilePath(grp.FileName); + D_AddFile(Files, grp.FileName.GetChars(), true, -1, GameConfig); + fn = ExtractFilePath(grp.FileName.GetChars()); if (fn.Len() > 0 && fn.Back() != '/') fn += '/'; } for (auto& fname : grp.FileInfo.loadfiles) { FString newname = fn + fname; - D_AddFile(Files, newname, true, -1, GameConfig); + D_AddFile(Files, newname.GetChars(), true, -1, GameConfig); } bool insert = (!insertdirectoriesafter && &grp == &groups[0]) || (insertdirectoriesafter && &grp == &groups.Last()); @@ -363,10 +363,10 @@ void InitFileSystem(TArray& groups) // Do this only if explicitly requested because this severely limits the usability of GRP files. if (insertdirectoriesafter && userConfig.AddFilesPre) for (auto& file : *userConfig.AddFilesPre) { - D_AddFile(Files, file, true, -1, GameConfig); + D_AddFile(Files, file.GetChars(), true, -1, GameConfig); } - D_AddFile(Files, fn, true, -1, GameConfig); + D_AddFile(Files, fn.GetChars(), true, -1, GameConfig); } i--; } @@ -381,19 +381,19 @@ void InitFileSystem(TArray& groups) while (lastpos < LumpFilter.Len() && (len = strcspn(LumpFilter.GetChars() + lastpos, ".")) > 0) { auto file = LumpFilter.Left(len + lastpos) + ".Autoload"; - D_AddConfigFiles(Files, file, "*.grp", GameConfig); + D_AddConfigFiles(Files, file.GetChars(), "*.grp", GameConfig); lastpos += len + 1; } if (!insertdirectoriesafter && userConfig.AddFilesPre) for (auto& file : *userConfig.AddFilesPre) { - D_AddFile(Files, file, true, -1, GameConfig); + D_AddFile(Files, file.GetChars(), true, -1, GameConfig); } if (userConfig.AddFiles) { for (auto& file : *userConfig.AddFiles) { - D_AddFile(Files, file, true, -1, GameConfig); + D_AddFile(Files, file.GetChars(), true, -1, GameConfig); } // Finally, if the last entry in the chain is a directory, it's being considered the mod directory, and all GRPs inside need to be loaded, too. @@ -401,14 +401,14 @@ void InitFileSystem(TArray& groups) { auto fname = (*userConfig.AddFiles)[userConfig.AddFiles->NumArgs() - 1]; bool isdir = false; - if (DirEntryExists(fname, &isdir) && isdir) + if (DirEntryExists(fname.GetChars(), &isdir) && isdir) { // Insert the GRPs before this entry itself. std::string lastfn = std::move(Files.back()); Files.pop_back(); for (auto ext : validexts) { - D_AddDirectory(Files, fname, ext, GameConfig); + D_AddDirectory(Files, fname.GetChars(), ext, GameConfig); } Files.push_back(std::move(lastfn)); } @@ -430,7 +430,7 @@ void InitFileSystem(TArray& groups) lfi.embeddings = { "blood.rff", "sounds.rff" }; } - lfi.dotFilter = LumpFilter; + lfi.dotFilter = LumpFilter.GetChars(); if (isDukeEngine()) lfi.gameTypeFilter.push_back("DukeEngine"); if (isDukeLike()) lfi.gameTypeFilter.push_back("DukeLike"); diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 52ea8351f..4e98e15c8 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -139,8 +139,8 @@ void G_BuildTiccmd(ticcmd_t* cmd) { sendsave = false; Net_WriteByte(DEM_SAVEGAME); - Net_WriteString(savegamefile); - Net_WriteString(savedescription); + Net_WriteString(savegamefile.GetChars()); + Net_WriteString(savedescription.GetChars()); savegamefile = ""; } cmd->ucmd = {}; @@ -188,7 +188,7 @@ static void GameTicker() C_FlushDisplay(); if (BackupSaveGame.IsNotEmpty() && cl_resumesavegame) { - DoLoadGame(BackupSaveGame); + DoLoadGame(BackupSaveGame.GetChars()); } else { @@ -253,7 +253,7 @@ static void GameTicker() break; case ga_savegame: - G_DoSaveGame(true, false, savegamefile, savedescription); + G_DoSaveGame(true, false, savegamefile.GetChars(), savedescription.GetChars()); gameaction = ga_nothing; savegamefile = ""; savedescription = ""; @@ -726,10 +726,10 @@ void MainLoop () if (userConfig.CommandMap.IsNotEmpty()) { - auto maprecord = FindMapByName(userConfig.CommandMap); + auto maprecord = FindMapByName(userConfig.CommandMap.GetChars()); if (maprecord == nullptr) { - maprecord = SetupUserMap(userConfig.CommandMap, g_gameType & GAMEFLAG_DUKE? "dethtoll.mid" : nullptr); + maprecord = SetupUserMap(userConfig.CommandMap.GetChars(), g_gameType & GAMEFLAG_DUKE? "dethtoll.mid" : nullptr); } userConfig.CommandMap = ""; if (maprecord) diff --git a/source/core/maphack.cpp b/source/core/maphack.cpp index a0fd212ea..7b00914f0 100644 --- a/source/core/maphack.cpp +++ b/source/core/maphack.cpp @@ -287,16 +287,16 @@ void loadMapHack(const char* filename, const uint8_t* md4, SpawnSpriteDef& sprit { internal.AppendFormat("%02x", md4[j]); } - LoadMapHack(internal + ".mhk", sprites); + LoadMapHack((internal + ".mhk").GetChars(), sprites); FString hack = StripExtension(filename) + ".mhk"; - if (LoadMapHack(hack, sprites)) + if (LoadMapHack(hack.GetChars(), sprites)) { for (auto& mhk : usermaphacks) { if (!memcmp(md4, mhk.md4, 16)) { - LoadMapHack(mhk.mhkfile, sprites); + LoadMapHack(mhk.mhkfile.GetChars(), sprites); } } } diff --git a/source/core/mapinfo.cpp b/source/core/mapinfo.cpp index d0d059542..3978c91ca 100644 --- a/source/core/mapinfo.cpp +++ b/source/core/mapinfo.cpp @@ -59,7 +59,7 @@ CCMD(listmaps) { for (auto& map : mapList) { - int lump = fileSystem.FindFile(map->fileName); + int lump = fileSystem.FindFile(map->fileName.GetChars()); if (lump >= 0) { int rfnum = fileSystem.GetFileContainer(lump); @@ -156,7 +156,7 @@ MapRecord* FindNextMap(MapRecord* thismap) { MapRecord* next = nullptr; if (!thismap->NextMap.Compare("-")) return nullptr; // '-' means to forcibly end the game here. - if (thismap->NextMap.IsNotEmpty()) next = FindMapByName(thismap->NextMap); + if (thismap->NextMap.IsNotEmpty()) next = FindMapByName(thismap->NextMap.GetChars()); if (!next) next = FindMapByLevelNum(thismap->levelNumber + 1); return next; } @@ -165,7 +165,7 @@ MapRecord* FindNextSecretMap(MapRecord* thismap) { MapRecord* next = nullptr; if (!thismap->NextSecret.Compare("-")) return nullptr; // '-' means to forcibly end the game here. - if (thismap->NextSecret.IsNotEmpty()) next = FindMapByName(thismap->NextSecret); + if (thismap->NextSecret.IsNotEmpty()) next = FindMapByName(thismap->NextSecret.GetChars()); return next? next : FindNextMap(thismap); } @@ -182,7 +182,7 @@ void ReplaceMusics(bool namehack) { FString mapname = pair->Key; FString music = pair->Value; - SetMusicForMap(mapname, music, namehack); + SetMusicForMap(mapname.GetChars(), music.GetChars(), namehack); } musicReplacements.Clear(); } diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 5dc943224..27a7f06e3 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -158,18 +158,18 @@ struct MapRecord const char* LabelName() const { if (flags & MI_USERMAP) return GStrings("MNU_USERMAP"); - return labelName; + return labelName.GetChars(); } const char *DisplayName() const { - if (name.IsEmpty()) return labelName; - return GStrings.localize(name); + if (name.IsEmpty()) return labelName.GetChars(); + return GStrings.localize(name.GetChars()); } void SetName(const char *n) { name = n; name.StripRight(); - name = FStringTable::MakeMacro(name); + name = FStringTable::MakeMacro(name.GetChars()); } void SetFileName(const char* n) { diff --git a/source/core/menu/loadsavemenu.cpp b/source/core/menu/loadsavemenu.cpp index 24d966d9c..e5e32986e 100644 --- a/source/core/menu/loadsavemenu.cpp +++ b/source/core/menu/loadsavemenu.cpp @@ -117,7 +117,7 @@ void FSavegameManager::PerformSaveGame(const char *f, const char *s) FString FSavegameManager::BuildSaveName(const char* fn, int slot) { - return G_BuildSaveName(FStringf("%s%04d", fn, slot)); + return G_BuildSaveName(FStringf("%s%04d", fn, slot).GetChars()); } //============================================================================= diff --git a/source/core/menu/razemenu.cpp b/source/core/menu/razemenu.cpp index 29b82ea25..790e61058 100644 --- a/source/core/menu/razemenu.cpp +++ b/source/core/menu/razemenu.cpp @@ -102,7 +102,7 @@ static bool DoStartGame(FNewGameStartup& gs) return false; } - map = FindMapByName(vol->startmap); + map = FindMapByName(vol->startmap.GetChars()); if (!map) return false; } else @@ -156,7 +156,7 @@ bool M_SetSpecialMenu(FName& menu, int param) M_ClearMenus(); int ep = NewGameStartupInfo.Episode; auto vol = FindVolume(ep); - if (vol) STAT_StartNewGame(vol->name, NewGameStartupInfo.Skill); + if (vol) STAT_StartNewGame(vol->name.GetChars(), NewGameStartupInfo.Skill); } return false; @@ -236,7 +236,7 @@ CCMD(menu_quit) FString EndString; EndString << GStrings("CONFIRM_QUITMSG") << "\n\n" << GStrings("PRESSYN"); - DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, EndString, 0, false, NAME_None, []() + DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, EndString.GetChars(), 0, false, NAME_None, []() { M_ClearMenus(); gi->ExitFromMenu(); @@ -261,7 +261,7 @@ CCMD(menu_endgame) M_StartControlPanel(true); FString tempstring; tempstring << GStrings("ENDGAME") << "\n\n" << GStrings("PRESSYN"); - DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []() + DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring.GetChars(), 0, false, NAME_None, []() { STAT_Cancel(); M_ClearMenus(); @@ -301,7 +301,7 @@ CCMD(quicksave) // [mxd]. Just save the game, no questions asked. if (!saveloadconfirmation) { - G_SaveGame(savegameManager.quickSaveSlot->Filename, savegameManager.quickSaveSlot->SaveTitle); + G_SaveGame(savegameManager.quickSaveSlot->Filename.GetChars(), savegameManager.quickSaveSlot->SaveTitle.GetChars()); return; } @@ -309,10 +309,10 @@ CCMD(quicksave) tempstring.Substitute("%s", slot->SaveTitle.GetChars()); M_StartControlPanel(true); - DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []() + DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring.GetChars(), 0, false, NAME_None, []() { M_ClearMenus(); - G_SaveGame(savegameManager.quickSaveSlot->Filename, savegameManager.quickSaveSlot->SaveTitle); + G_SaveGame(savegameManager.quickSaveSlot->Filename.GetChars(), savegameManager.quickSaveSlot->SaveTitle.GetChars()); }); M_ActivateMenu(newmenu); @@ -345,7 +345,7 @@ CCMD(quickload) // [mxd]. Just load the game, no questions asked. if (!saveloadconfirmation) { - G_LoadGame(savegameManager.quickSaveSlot->Filename); + G_LoadGame(savegameManager.quickSaveSlot->Filename.GetChars()); return; } FString tempstring = GStrings("QLPROMPT"); @@ -353,10 +353,10 @@ CCMD(quickload) M_StartControlPanel(true); - DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []() + DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring.GetChars(), 0, false, NAME_None, []() { M_ClearMenus(); - G_LoadGame(savegameManager.quickSaveSlot->Filename); + G_LoadGame(savegameManager.quickSaveSlot->Filename.GetChars()); }); M_ActivateMenu(newmenu); } @@ -416,7 +416,7 @@ static void BuildEpisodeMenu() { bool isShareware = ((g_gameType & GAMEFLAG_DUKE) && (g_gameType & GAMEFLAG_SHAREWARE) && (vol.flags & VF_SHAREWARELOCK)); auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing, vol.name[0], - vol.name, ld->mFont, CR_UNTRANSLATED, int(isShareware), NAME_Skillmenu, vol.index); // font colors are not used, so hijack one for the shareware flag. + vol.name.GetChars(), ld->mFont, CR_UNTRANSLATED, int(isShareware), NAME_Skillmenu, vol.index); // font colors are not used, so hijack one for the shareware flag. y += ld->mLinespacing; ld->mItems.Push(it); @@ -424,7 +424,7 @@ static void BuildEpisodeMenu() if (vol.subtitle.IsNotEmpty()) { auto item = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing * 6 / 10, 1, - vol.subtitle, SmallFont, CR_GRAY, false, NAME_None, vol.index); + vol.subtitle.GetChars(), SmallFont, CR_GRAY, false, NAME_None, vol.index); y += ld->mLinespacing * 6 / 10; ld->mItems.Push(item); textadded = true; @@ -466,7 +466,7 @@ static void BuildEpisodeMenu() { if (gSkillNames[i].IsNotEmpty()) { - auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing, gSkillNames[i][0], gSkillNames[i], ld->mFont, CR_UNTRANSLATED, 0, NAME_Startgame, i); + auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing, gSkillNames[i][0], gSkillNames[i].GetChars(), ld->mFont, CR_UNTRANSLATED, 0, NAME_Startgame, i); y += ld->mLinespacing; ld->mItems.Push(it); addedSkills++; @@ -661,7 +661,7 @@ CCMD(reset2defaults) CCMD(reset2saved) { GameConfig->DoGlobalSetup(); - GameConfig->DoGameSetup(currentGame); + GameConfig->DoGameSetup(currentGame.GetChars()); } CCMD(menu_main) diff --git a/source/core/menu/usermap.cpp b/source/core/menu/usermap.cpp index dc7ec239c..8cf320e1e 100644 --- a/source/core/menu/usermap.cpp +++ b/source/core/menu/usermap.cpp @@ -72,7 +72,7 @@ void InsertMap(int lumpnum) current->entries.Last().filename = fileSystem.GetFileFullName(lumpnum); current->entries.Last().container = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum)); current->entries.Last().size = fileSystem.FileLength(lumpnum); - auto mapinfo = FindMapByName(StripExtension(path.Last())); + auto mapinfo = FindMapByName(StripExtension(path.Last().GetChars()).GetChars()); if (mapinfo) current->entries.Last().info = mapinfo->name; } @@ -80,7 +80,7 @@ bool ValidateMap(int lumpnum) { FString filename = fileSystem.GetFileFullName(lumpnum); - if (fileSystem.FindFile(filename) != lumpnum) return false; + if (fileSystem.FindFile(filename.GetChars()) != lumpnum) return false; auto fr = fileSystem.OpenFileReader(lumpnum); uint8_t check[4]; fr.Read(&check, 4); @@ -143,7 +143,7 @@ void ReadUserMaps() void LoadMapPreview(FUsermapEntry* entry) { if (entry->wallsread) return; - entry->walls = loadMapWalls(entry->filename); + entry->walls = loadMapWalls(entry->filename.GetChars()); } void UnloadMapPreviews(FUsermapDirectory* dir) @@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION(_UsermapMenu, StartMap) } NewGameStartupInfo.Episode = -1; NewGameStartupInfo.Level = -1; - NewGameStartupInfo.Map = SetupUserMap(entry->filename, g_gameType & GAMEFLAG_DUKE ? "dethtoll.mid" : nullptr); + NewGameStartupInfo.Map = SetupUserMap(entry->filename.GetChars(), g_gameType & GAMEFLAG_DUKE ? "dethtoll.mid" : nullptr); M_SetMenu(NAME_Skillmenu, INT_MAX); return 0; } diff --git a/source/core/music/s_advsound.cpp b/source/core/music/s_advsound.cpp index af240d3ea..a632819a2 100644 --- a/source/core/music/s_advsound.cpp +++ b/source/core/music/s_advsound.cpp @@ -241,7 +241,7 @@ static void S_AddSNDINFO (int lump) sc.MustGetString(); int mlump = fileSystem.FindFile(sc.String); if (mlump < 0) - mlump = fileSystem.FindFile(FStringf("music/%s", sc.String)); + mlump = fileSystem.FindFile(FStringf("music/%s", sc.String).GetChars()); if (mlump >= 0) { // do not set the alias if a later WAD defines its own music of this name @@ -583,7 +583,7 @@ static void S_AddSNDINFO (int lump) } sc.MustGetString (); - S_AddSound (name, sc.String, &sc); + S_AddSound (name.GetChars(), sc.String, &sc); } } diff --git a/source/core/precache.cpp b/source/core/precache.cpp index d871fd0b5..76a67c2cf 100644 --- a/source/core/precache.cpp +++ b/source/core/precache.cpp @@ -151,7 +151,7 @@ void precacheMarkedTiles() decltype(cachetexmap)::Pair* pair2; while (it2.NextPair(pair2)) { - auto tex = TexMan.FindGameTexture(pair2->Key, ETextureType::Any); + auto tex = TexMan.FindGameTexture(pair2->Key.GetChars(), ETextureType::Any); if (tex) PrecacheTex(tex, 0); } diff --git a/source/core/quotes.cpp b/source/core/quotes.cpp index c70c2b0ac..395914ee4 100644 --- a/source/core/quotes.cpp +++ b/source/core/quotes.cpp @@ -44,7 +44,7 @@ void Quotes::MakeStringLabel(FString "e) { // Only prepend a quote if the string is localizable. - if (quote.Len() > 0 && quote[0] != '$' && GStrings[quote]) quote.Insert(0, "$"); + if (quote.Len() > 0 && quote[0] != '$' && GStrings[quote.GetChars()]) quote.Insert(0, "$"); } void Quotes::InitializeQuote(int num, const char *text, bool fromscript) @@ -59,9 +59,9 @@ void Quotes::InitializeQuote(int num, const char *text, bool fromscript) void Quotes::AppendQuote(int dst, int src, int len) { // This needs to apply the localization because the combined string is not localizable anymore. - if (quotes[dst][0] == '$') quotes[dst] = GStrings.localize(quotes[dst]); - if (len < 0) quotes[dst] << GStrings.localize(quotes[src]); - else quotes[dst] += FString(GStrings.localize(quotes[src]), len); + if (quotes[dst][0] == '$') quotes[dst] = GStrings.localize(quotes[dst].GetChars()); + if (len < 0) quotes[dst] << GStrings.localize(quotes[src].GetChars()); + else quotes[dst] += FString(GStrings.localize(quotes[src].GetChars()), len); } void Quotes::FormatQuote(int dst, const char* fmt, ...) @@ -73,7 +73,7 @@ void Quotes::FormatQuote(int dst, const char* fmt, ...) void Quotes::Substitute(int dst, const char* text, const char* replc) { - if (quotes[dst][0] == '$') quotes[dst] = GStrings.localize(quotes[dst]); + if (quotes[dst][0] == '$') quotes[dst] = GStrings.localize(quotes[dst].GetChars()); quotes[dst].Substitute(text, replc); } diff --git a/source/core/r_data/gldefs.cpp b/source/core/r_data/gldefs.cpp index 3cb46da56..28bda4e4c 100644 --- a/source/core/r_data/gldefs.cpp +++ b/source/core/r_data/gldefs.cpp @@ -78,7 +78,7 @@ static void do_uniform_set(float value, ExtraUniformCVARData* data) for (unsigned int i = 0; i < PostProcessShaders.Size(); i++) { PostProcessShader& shader = PostProcessShaders[i]; - if (strcmp(shader.Name, data->Shader) == 0) + if (shader.Name.Compare(data->Shader) == 0) { data->vec4 = shader.Uniforms[data->Uniform].Values; } @@ -1559,7 +1559,7 @@ class GLDefsParser } sc.MustGetString(); cvarname = sc.String; - cvar = FindCVar(cvarname, NULL); + cvar = FindCVar(cvarname.GetChars(), NULL); UCVarValue oldval; UCVarValue val; @@ -1577,7 +1577,7 @@ class GLDefsParser { if (!cvar) { - cvar = C_CreateCVar(cvarname, cvartype, cvarflags); + cvar = C_CreateCVar(cvarname.GetChars(), cvartype, cvarflags); } else if (cvar && (((cvar->GetFlags()) & CVAR_MOD) == CVAR_MOD)) { @@ -1598,7 +1598,7 @@ class GLDefsParser oldval.Float = cvar->GetGenericRep(CVAR_Float).Float; oldextra = (ExtraUniformCVARData*)cvar->GetExtraDataPointer(); delete cvar; - cvar = C_CreateCVar(cvarname, cvartype, cvarflags); + cvar = C_CreateCVar(cvarname.GetChars(), cvartype, cvarflags); } shaderdesc.Uniforms[uniformName].Values[0] = oldval.Float; diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index c3499d843..f96f751a6 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -101,7 +101,7 @@ int LookupMusic(const char* fn, bool onlyextended) if (mus_extendedlookup || onlyextended) { FString name = StripExtension(fn); - int l = fileSystem.FindFileWithExtensions(name, knownMusicExts, countof(knownMusicExts)); + int l = fileSystem.FindFileWithExtensions(name.GetChars(), knownMusicExts, countof(knownMusicExts)); if (l >= 0 || onlyextended) return l; } return fileSystem.CheckNumForFullName(fn, true, FileSys::ns_music); @@ -128,7 +128,7 @@ FileReader OpenMusic(const char* musicname) if (mus.IsNotEmpty()) { // Load an external file. - reader.OpenFile(mus); + reader.OpenFile(mus.GetChars()); } if (!reader.isOpen()) { @@ -141,13 +141,13 @@ FileReader OpenMusic(const char* musicname) auto rfn = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum)); auto rfbase = ExtractFileBase(rfn); FStringf aliasMusicname("music/%s/%s", rfbase.GetChars(), musicname); - int newlumpnum = LookupMusic(aliasMusicname); + int newlumpnum = LookupMusic(aliasMusicname.GetChars()); if (newlumpnum >= 0) lumpnum = newlumpnum; } // Always look in the 'music' subfolder as well. This gets used by multiple setups to store ripped CD tracks. FStringf aliasMusicname("music/%s", musicname); - int newlumpnum = LookupMusic(aliasMusicname, lumpnum >= 0); + int newlumpnum = LookupMusic(aliasMusicname.GetChars(), lumpnum >= 0); if (newlumpnum >= 0) lumpnum = newlumpnum; } @@ -155,7 +155,7 @@ FileReader OpenMusic(const char* musicname) { // Some Shadow Warrior distributions have the music in a subfolder named 'classic'. Check that, too. FStringf aliasMusicname("classic/music/%s", musicname); - lumpnum = fileSystem.FindFile(aliasMusicname); + lumpnum = fileSystem.FindFile(aliasMusicname.GetChars()); } if (lumpnum > -1) { @@ -223,7 +223,7 @@ void Mus_Serialize(FSerializer &arc) FString music = mus_playing.name; if (music.IsEmpty()) music = mus_playing.LastSong; - arc.AddString("music", music); + arc.AddString("music", music.GetChars()); } else arc("music", mus_playing.LastSong); diff --git a/source/core/raze_sound.cpp b/source/core/raze_sound.cpp index 2ee89551b..4af1311b9 100644 --- a/source/core/raze_sound.cpp +++ b/source/core/raze_sound.cpp @@ -157,10 +157,10 @@ int S_LookupSound(const char* fn) if (snd_extendedlookup) { auto newfn = StripExtension(fn); - int lump = fileSystem.FindFileWithExtensions(newfn, sndformats, countof(sndformats)); + int lump = fileSystem.FindFileWithExtensions(newfn.GetChars(), sndformats, countof(sndformats)); if (lump >= 0) return lump; newfn = "sound/" + newfn; - lump = fileSystem.FindFileWithExtensions(newfn, sndformats, countof(sndformats)); + lump = fileSystem.FindFileWithExtensions(newfn.GetChars(), sndformats, countof(sndformats)); if (lump >= 0) return lump; } return fileSystem.FindFile(fn); diff --git a/source/core/razefont.cpp b/source/core/razefont.cpp index cc873cc18..7d3421e65 100644 --- a/source/core/razefont.cpp +++ b/source/core/razefont.cpp @@ -205,7 +205,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, PickBigFont, PickBigFont_) PARAM_PROLOGUE; PARAM_STRING(text); //PARAM_POINTER(cr, int); - ACTION_RETURN_POINTER(PickBigFont(text)); + ACTION_RETURN_POINTER(PickBigFont(text.GetChars())); } FFont* PickSmallFont(const char* txt) @@ -228,5 +228,5 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, PickSmallFont, PickSmallFont_) PARAM_PROLOGUE; PARAM_STRING(text); //PARAM_POINTER(cr, int); - ACTION_RETURN_POINTER(PickSmallFont(text)); + ACTION_RETURN_POINTER(PickSmallFont(text.GetChars())); } diff --git a/source/core/rts.cpp b/source/core/rts.cpp index 32a6f409d..f9e3f9108 100644 --- a/source/core/rts.cpp +++ b/source/core/rts.cpp @@ -82,7 +82,7 @@ bool RTS_IsInitialized() { if (LumpInfo.Size() > 0) return true; if (RTSName.IsEmpty()) return false; - auto fr = fileSystem.OpenFileReader(RTSName); + auto fr = fileSystem.OpenFileReader(RTSName.GetChars()); RTSName = ""; // don't try ever again. if (!fr.isOpen()) return false; RTSFile.Resize((unsigned)fr.GetLength()); @@ -120,8 +120,8 @@ bool RTS_IsInitialized() if (li.size > 0) { FStringf rts("rts%02d", i); - int lump = fileSystem.AddFromBuffer(rts, "rts", (char*)RTSFile.Data() + li.position, li.size, -1, 0); - li.sid = soundEngine->AddSoundLump(rts, lump, 0, -1); + int lump = fileSystem.AddFromBuffer(rts.GetChars(), "rts", (char*)RTSFile.Data() + li.position, li.size, -1, 0); + li.sid = soundEngine->AddSoundLump(rts.GetChars(), lump, 0, -1); } } return false; diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index f4690093a..f15f071d6 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -167,7 +167,7 @@ bool ReadSavegame(const char* name) } // Load the savegame. - loadMapBackup(currentLevel->fileName); + loadMapBackup(currentLevel->fileName.GetChars()); SerializeSession(arc); g_nextskill = gi->GetCurrentSkill(); arc.Close(); @@ -214,9 +214,9 @@ bool WriteSavegame(const char* filename, const char *name) .AddString("Map Name", lev->DisplayName()) .AddString("Creation Time", myasctime()) .AddString("Title", name) - .AddString("Map File", lev->fileName) - .AddString("Map Label", lev->labelName) - .AddString("Map Time", timeStr); + .AddString("Map File", lev->fileName.GetChars()) + .AddString("Map Label", lev->labelName.GetChars()) + .AddString("Map Time", timeStr.GetChars()); const char *fn = lev->fileName.GetChars(); if (*fn == '/') fn++; @@ -243,7 +243,7 @@ bool WriteSavegame(const char* filename, const char *name) // put some basic info into the PNG so that this isn't lost when the image gets extracted. M_AppendPNGText(&savepic, "Software", buf); M_AppendPNGText(&savepic, "Title", name); - M_AppendPNGText(&savepic, "Current Map", lev->labelName); + M_AppendPNGText(&savepic, "Current Map", lev->labelName.GetChars()); M_FinishPNG(&savepic); auto picdata = savepic.GetBuffer(); @@ -371,7 +371,7 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu) } SaveVersion = savesig.currentsavever; - MapRecord *curLevel = FindMapByName(label); + MapRecord *curLevel = FindMapByName(label.GetChars()); // If the map does not exist, check if it's a user map. if (!curLevel) @@ -380,7 +380,7 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu) if (!formenu) { curLevel->name = ""; - curLevel->SetFileName(filename); + curLevel->SetFileName(filename.GetChars()); } } if (!curLevel) return 0; @@ -397,7 +397,7 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu) auto ggfn = ExtractFileBase(fileSystem.GetResourceFileName(1), true); if (gamegrp.CompareNoCase(ggfn) == 0) { - return G_CheckSaveGameWads(gamegrp, mapgrp, false) ? 1 : -2; + return G_CheckSaveGameWads(gamegrp.GetChars(), mapgrp.GetChars(), false) ? 1 : -2; } else { @@ -782,7 +782,7 @@ void G_DoLoadGame() gamestate = GS_HIDECONSOLE; } - DoLoadGame(savename); + DoLoadGame(savename.GetChars()); BackupSaveGame = savename; } @@ -831,7 +831,7 @@ void startSaveGame(int player, uint8_t** stream, bool skip) { // Paths sent over the network will be valid for the system that sent // the save command. For other systems, the path needs to be changed. - savegamefile = G_BuildSaveName(ExtractFileBase(savegamefile, true)); + savegamefile = G_BuildSaveName(ExtractFileBase(savegamefile.GetChars(), true).GetChars()); } gameaction = ga_savegame; } @@ -878,11 +878,11 @@ void M_Autosave() num.Int = nextautosave; autosavenum->ForceSet(num, CVAR_Int); - auto Filename = G_BuildSaveName(FStringf("auto%04d", nextautosave)); + auto Filename = G_BuildSaveName(FStringf("auto%04d", nextautosave).GetChars()); readableTime = myasctime(); FStringf SaveTitle("Autosave %s", readableTime); nextautosave = (nextautosave + 1) % count; - G_DoSaveGame(false, false, Filename, SaveTitle); + G_DoSaveGame(false, false, Filename.GetChars(), SaveTitle.GetChars()); } CCMD(autosave) @@ -909,11 +909,11 @@ CCMD(rotatingquicksave) quicksavenum->ForceSet(num, CVAR_Int); FSaveGameNode sg; - auto Filename = G_BuildSaveName(FStringf("quick%04d", nextquicksave)); + auto Filename = G_BuildSaveName(FStringf("quick%04d", nextquicksave).GetChars()); readableTime = myasctime(); FStringf SaveTitle("Quicksave %s", readableTime); nextquicksave = (nextquicksave + 1) % count; - G_SaveGame(Filename, SaveTitle); + G_SaveGame(Filename.GetChars(), SaveTitle.GetChars()); } @@ -938,7 +938,7 @@ UNSAFE_CCMD(load) return; } FString fname = G_BuildSaveName(argv[1]); - G_LoadGame(fname); + G_LoadGame(fname.GetChars()); } //========================================================================== @@ -957,7 +957,7 @@ UNSAFE_CCMD(save) return; } FString fname = G_BuildSaveName(argv[1]); - G_SaveGame(fname, argv.argc() > 2 ? argv[2] : argv[1]); + G_SaveGame(fname.GetChars(), argv.argc() > 2 ? argv[2] : argv[1]); } diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 794b44dbc..0c2917713 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -127,7 +127,7 @@ bool CreateCutscene(CutsceneDef* cs, DObject* runner, MapRecord* map, bool trans 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()) @@ -173,7 +173,7 @@ void ShowScoreboard(int numplayers, const CompletionFunc& completion_) Printf("Created runner at %p\n", cutscene.runner); GC::WriteBarrier(cutscene.runner); - const char* qname = globalCutscenes.MPSummaryScreen; + const char* qname = globalCutscenes.MPSummaryScreen.GetChars(); auto func = LookupFunction(qname); if (func->Proto->ArgumentTypes.Size() != 2) I_Error("Bad map-cutscene function %s. Must receive precisely two arguments.", qname); if (func->Proto->ArgumentTypes[0] != cutscene.runnerclasstype && func->Proto->ArgumentTypes[1] != TypeSInt32) @@ -234,7 +234,7 @@ void ShowIntermission(MapRecord* fromMap, MapRecord* toMap, SummaryInfo* info, C } if ((!cl_noexitscreens && fromMap) || (!cl_nostartscreens && (g_gameType & GAMEFLAG_PSEXHUMED))) - CallCreateSummaryFunction(globalCutscenes.SummaryScreen, runner, fromMap, info, toMap); + CallCreateSummaryFunction(globalCutscenes.SummaryScreen.GetChars(), runner, fromMap, info, toMap); if (toMap) { diff --git a/source/core/screenshot.cpp b/source/core/screenshot.cpp index 5e18e5730..f872004fb 100644 --- a/source/core/screenshot.cpp +++ b/source/core/screenshot.cpp @@ -54,7 +54,7 @@ static FileWriter *opennextfile(const char *fn) { name.Format(fn, count++); } while (FileExists(name)); - return FileWriter::Open(name); + return FileWriter::Open(name.GetChars()); } @@ -70,7 +70,7 @@ static void WritePNGfile(FileWriter* file, const uint8_t* buffer, const PalEntry { FStringf software(GAMENAME " %s", GetVersionString()); if (!M_CreatePNG(file, buffer, palette, color_type, width, height, pitch, gamma) || - !M_AppendPNGText(file, "Software", software) || + !M_AppendPNGText(file, "Software", software.GetChars()) || !M_FinishPNG(file)) { Printf("Failed writing screenshot\n"); @@ -101,13 +101,13 @@ static int SaveScreenshot() autoname += '/'; } } - autoname = NicePath(autoname); - CreatePath(autoname); + autoname = NicePath(autoname.GetChars()); + CreatePath(autoname.GetChars()); if (**screenshotname) autoname << screenshotname; else autoname << currentGame; autoname << "_%04d.png"; - FileWriter *fil = opennextfile(autoname); + FileWriter *fil = opennextfile(autoname.GetChars()); if (fil == nullptr) { diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index cc5d906a0..ac6a1396e 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -59,7 +59,7 @@ void AddSearchPath(TArray& searchpaths, const char* path) { auto fpath = M_GetNormalizedPath(path); if (fpath.Len() > 1 && fpath.Back() == '/') fpath.Truncate(fpath.Len() - 1); - if (DirExists(fpath)) + if (DirExists(fpath.GetChars())) { if (searchpaths.Find(fpath) == searchpaths.Size()) searchpaths.Push(fpath); @@ -162,14 +162,14 @@ void G_AddExternalSearchPaths(TArray &searchpaths) if (I_QueryPathKey(entry.regPath, entry.regKey, buf)) { FixPathSeperator(buf); - if (!entry.subpaths) AddSearchPath(searchpaths, buf); + if (!entry.subpaths) AddSearchPath(searchpaths, buf.GetChars()); else { FString path; for (int i = 0; entry.subpaths[i]; i++) { path.Format("%s%s", buf.GetChars(), entry.subpaths[i]); - AddSearchPath(searchpaths, path); + AddSearchPath(searchpaths, path.GetChars()); } } } @@ -187,11 +187,11 @@ void CollectSubdirectories(TArray &searchpath, const char *dirmatch) { FString dirpath = MakeUTF8(dirmatch); // convert into clean UTF-8 dirpath.Truncate(dirpath.Len() - 2); // remove the '/*' - FString AbsPath = M_GetNormalizedPath(dirpath); - if (DirExists(AbsPath)) + FString AbsPath = M_GetNormalizedPath(dirpath.GetChars()); + if (DirExists(AbsPath.GetChars())) { FileSys::FileList list; - if (FileSys::ScanDirectory(list, AbsPath, "*", true)) + if (FileSys::ScanDirectory(list, AbsPath.GetChars(), "*", true)) { for (auto& entry : list) { @@ -238,11 +238,11 @@ TArray CollectSearchPaths() // A path ending with "/*" means to add all subdirectories. if (nice[nice.Len()-2] == '/' && nice[nice.Len()-1] == '*') { - CollectSubdirectories(searchpaths, nice); + CollectSubdirectories(searchpaths, nice.GetChars()); } else { - AddSearchPath(searchpaths, nice); + AddSearchPath(searchpaths, nice.GetChars()); } } } @@ -292,7 +292,7 @@ TArray CollectAllFilesInSearchPath() { // If the user specified a file on the command line, insert that first, if found. FileReader fr; - if (fr.OpenFile(userConfig.gamegrp)) + if (fr.OpenFile(userConfig.gamegrp.GetChars())) { FileEntry fe = { userConfig.gamegrp, (size_t)fr.GetLength(), 0, 0, index++ }; filelist.Push(fe); @@ -302,10 +302,10 @@ TArray CollectAllFilesInSearchPath() auto paths = CollectSearchPaths(); for(auto &path : paths) { - if (DirExists(path)) + if (DirExists(path.GetChars())) { FileSys::FileList list; - if (FileSys::ScanDirectory(list, path, "*", true)) + if (FileSys::ScanDirectory(list, path.GetChars(), "*", true)) { for (auto& entry : list) { @@ -314,7 +314,7 @@ TArray CollectAllFilesInSearchPath() filelist.Reserve(1); auto& flentry = filelist.Last(); flentry.FileName = entry.FilePath.c_str(); - GetFileInfo(flentry.FileName, &flentry.FileLength, &flentry.FileTime); + GetFileInfo(flentry.FileName.GetChars(), &flentry.FileLength, &flentry.FileTime); flentry.Index = index++; // to preserve order when working on the list. } @@ -339,7 +339,7 @@ static TArray LoadCRCCache(void) try { - if (sc.OpenFile(cachepath)) + if (sc.OpenFile(cachepath.GetChars())) { while (sc.GetString()) { @@ -372,7 +372,7 @@ void SaveCRCs(TArray& crclist) { auto cachepath = M_GetAppDataPath(true) + "/grpcrccache.txt"; - FileWriter* fw = FileWriter::Open(cachepath); + FileWriter* fw = FileWriter::Open(cachepath.GetChars()); if (fw) { for (auto& crc : crclist) @@ -648,9 +648,9 @@ TArray ParseAllGrpInfos(TArray& filelist) { // parse it. FileReader fr; - if (fr.OpenFile(entry.FileName)) + if (fr.OpenFile(entry.FileName.GetChars())) { - auto g = ParseGrpInfo(entry.FileName, fr, CRCMap); + auto g = ParseGrpInfo(entry.FileName.GetChars(), fr, CRCMap); groups.Append(g); } } @@ -677,7 +677,7 @@ void GetCRC(FileEntry *entry, TArray &CRCCache) } } FileReader f; - if (f.OpenFile(entry->FileName)) + if (f.OpenFile(entry->FileName.GetChars())) { TArray buffer(65536, 1); uint32_t crcval = 0; @@ -779,7 +779,7 @@ TArray GrpScan() { if (strcmp(ext, fn.GetChars() + fn.Len() - 4) == 0) { - auto resf = FResourceFile::OpenResourceFile(fe->FileName, true); + auto resf = FResourceFile::OpenResourceFile(fe->FileName.GetChars(), true); if (resf) { for (auto grp : contentGroupList) @@ -787,7 +787,7 @@ TArray GrpScan() bool ok = true; for (auto &lump : grp->mustcontain) { - if (!resf->FindLump(lump)) + if (!resf->FindLump(lump.GetChars())) { ok = false; break; @@ -871,7 +871,7 @@ TArray GrpScan() fg.FileName = entry->FileName; for (auto addon : addonList) { - if (CheckAddon(addon, grp, entry->FileName)) + if (CheckAddon(addon, grp, entry->FileName.GetChars())) { foundGames.Reserve(1); auto& fga = foundGames.Last(); diff --git a/source/core/secrets.cpp b/source/core/secrets.cpp index 55c68bcec..1bbebf0ac 100644 --- a/source/core/secrets.cpp +++ b/source/core/secrets.cpp @@ -86,7 +86,7 @@ CCMD(secret) { if (readbuffer[0] == '[') { - inlevel = !strnicmp(readbuffer, maphdr, maphdr.Len()); + inlevel = !strnicmp(readbuffer, maphdr.GetChars(), maphdr.Len()); if (!foundsome) { FString levelname; @@ -114,7 +114,7 @@ CCMD(secret) // line complete so print it. linebuild.Substitute("\r", ""); linebuild.StripRight(" \t\n"); - PrintSecretString(linebuild, thislevel); + PrintSecretString(linebuild.GetChars(), thislevel); linebuild = ""; } } diff --git a/source/core/statistics.cpp b/source/core/statistics.cpp index 1f59cd2e8..78c81ac2b 100644 --- a/source/core/statistics.cpp +++ b/source/core/statistics.cpp @@ -202,7 +202,7 @@ int compare_episode_names(const void *a, const void *b) FStatistics *A = (FStatistics*)a; FStatistics *B = (FStatistics*)b; - return strnatcasecmp(A->epi_header, B->epi_header); + return strnatcasecmp(A->epi_header.GetChars(), B->epi_header.GetChars()); } int compare_level_names(const void *a, const void *b) @@ -298,7 +298,7 @@ static FStatistics *GetStatisticsList(TArray &statlist, const char { for(unsigned int i=0;i= 0) { int file = fileSystem.GetFileContainer(lump); fn = fileSystem.GetResourceFileName(file); } - FString section = ExtractFileBase(fn) + "." + ExtractFileBase(LevelData[0].Levelname); + FString section = ExtractFileBase(fn) + "." + ExtractFileBase(LevelData[0].Levelname.GetChars()); section.ToUpper(); - FStatistics* sl = GetStatisticsList(EpisodeStatistics, section, StartEpisode); + FStatistics* sl = GetStatisticsList(EpisodeStatistics, section.GetChars(), StartEpisode.GetChars()); int statvals[] = { 0,0,0,0, 0 }; FString infostring; @@ -452,15 +452,15 @@ void STAT_Update(bool endofgame) } infostring.Format("%4d/%4d, %3d/%3d, %2d", statvals[0], statvals[1], statvals[2], statvals[3], validlevels); - FSessionStatistics* es = StatisticsEntry(sl, infostring, statvals[4]); + FSessionStatistics* es = StatisticsEntry(sl, infostring.GetChars(), statvals[4]); for (unsigned i = 0; i < LevelData.Size(); i++) { - FString lsection = ExtractFileBase(LevelData[i].Levelname); + FString lsection = ExtractFileBase(LevelData[i].Levelname.GetChars()); lsection.ToUpper(); infostring.Format("%4d/%4d, %3d/%3d", LevelData[i].killcount, LevelData[i].totalkills, LevelData[i].secretcount, LevelData[i].totalsecrets); if (LevelData[i].supersecrets > 0) infostring.AppendFormat(":%d", LevelData[i].supersecrets); - LevelStatEntry(es, lsection, infostring, LevelData[i].leveltime); + LevelStatEntry(es, lsection.GetChars(), infostring.GetChars(), LevelData[i].leveltime); } SaveStatistics(statfile, EpisodeStatistics); LevelData.Clear(); @@ -548,14 +548,14 @@ FString GetStatString() CCMD(printstats) { - if (*StartEpisode == 0 || *LevelName == 0) return; + if (StartEpisode.IsEmpty() || LevelName.IsEmpty()) return; StoreLevelStats(); // Refresh the current level's results. Printf("%s", GetStatString().GetChars()); } ADD_STAT(statistics) { - if (*StartEpisode == 0 || *LevelName == 0) return ""; + if (StartEpisode.IsEmpty() || LevelName.IsEmpty()) return ""; StoreLevelStats(); // Refresh the current level's results. return GetStatString(); } diff --git a/source/core/textures/hightile.cpp b/source/core/textures/hightile.cpp index 0c1757803..7fd051486 100644 --- a/source/core/textures/hightile.cpp +++ b/source/core/textures/hightile.cpp @@ -290,7 +290,7 @@ int tileSetSkybox(int tilenum, int palnum, FString* facenames, bool indexed) FGameTexture *faces[6]; for (int i = 0; i < 6; i++) { - FTextureID texid = TexMan.CheckForTexture(facenames[i], ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup); + FTextureID texid = TexMan.CheckForTexture(facenames[i].GetChars(), ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup); if (!texid.isValid()) { Printf("%s: Skybox image for tile %d does not exist or is invalid\n", facenames[i].GetChars(), tilenum); diff --git a/source/core/textures/skytexture.cpp b/source/core/textures/skytexture.cpp index 552a0e823..fadc923a3 100644 --- a/source/core/textures/skytexture.cpp +++ b/source/core/textures/skytexture.cpp @@ -59,7 +59,7 @@ FGameTexture* GetSkyTexture(FTextureID baseid, int lognumtiles, const int16_t *t { synthname += 'A' + tilemap[i]; }; - auto tex = TexMan.FindGameTexture(synthname); + auto tex = TexMan.FindGameTexture(synthname.GetChars()); if (tex) return tex; auto basetex = TexMan.GetGameTexture(baseid); auto scalex = basetex->GetScaleX(); @@ -76,7 +76,7 @@ FGameTexture* GetSkyTexture(FTextureID baseid, int lognumtiles, const int16_t *t build[i].OriginX = tilewidth * i; build[i].Translation = GPalette.GetTranslation(GetTranslationType(remap), GetTranslationIndex(remap)); } - auto tt = MakeGameTexture(new FImageTexture(new FMultiPatchTexture(tilewidth*numtiles, basetex->GetTexelHeight(), build, false, false)), synthname, ETextureType::Override); + auto tt = MakeGameTexture(new FImageTexture(new FMultiPatchTexture(tilewidth*numtiles, basetex->GetTexelHeight(), build, false, false)), synthname.GetChars(), ETextureType::Override); tt->SetScale(scalex, scaley); tt->SetUpscaleFlag(basetex->GetUpscaleFlag(), true); TexMan.AddGameTexture(tt, true); diff --git a/source/core/textures/tilesetbuilder.cpp b/source/core/textures/tilesetbuilder.cpp index 1307ae46f..8a4dbfc56 100644 --- a/source/core/textures/tilesetbuilder.cpp +++ b/source/core/textures/tilesetbuilder.cpp @@ -117,13 +117,13 @@ static void LoadDefinitions(TilesetBuildInfo& info) // otherwise the default rules inherited from older ports apply. if (userConfig.UserDef.IsNotEmpty()) { - loaddefinitionsfile(info, userConfig.UserDef, false); + loaddefinitionsfile(info, userConfig.UserDef.GetChars(), false); } else { - if (fileSystem.FileExists(razedefsfile)) + if (fileSystem.FileExists(razedefsfile.GetChars())) { - loaddefinitionsfile(info, razedefsfile, true); + loaddefinitionsfile(info, razedefsfile.GetChars(), true); } else if (fileSystem.FileExists(defsfile)) { @@ -135,14 +135,14 @@ static void LoadDefinitions(TilesetBuildInfo& info) { for (auto& m : *userConfig.AddDefs) { - loaddefinitionsfile(info, m, false); + loaddefinitionsfile(info, m.GetChars(), false); } userConfig.AddDefs.reset(); } if (GameStartupInfo.def.IsNotEmpty()) { - loaddefinitionsfile(info, GameStartupInfo.def); // Stuff from gameinfo. + loaddefinitionsfile(info, GameStartupInfo.def.GetChars()); // Stuff from gameinfo. } // load the widescreen replacements last. This ensures that mods still get the correct CRCs for their own tile replacements. @@ -206,7 +206,7 @@ void TilesetBuildInfo::MakeCanvas(int tilenum, int width, int height) { auto ftex = new FCanvasTexture(width * 4, height * 4); ftex->aspectRatio = (float)width / height; - auto canvas = MakeGameTexture(ftex, FStringf("#%05d", tilenum), ETextureType::Any); + auto canvas = MakeGameTexture(ftex, FStringf("#%05d", tilenum).GetChars(), ETextureType::Any); canvas->SetSize(width * 4, height * 4); canvas->SetDisplaySize((float)width, (float)height); canvas->GetTexture()->SetSize(width * 4, height * 4); @@ -223,7 +223,7 @@ static void GenerateRotations(int firsttileid, const char* basename, int tile, i for (int rotation = 0; rotation < numrotations; rotation++) { FStringf str("%s@%c%x", basename, frame + 'A', rotation + 1); - TexMan.AddAlias(str, FSetTextureID(firsttileid + tile)); + TexMan.AddAlias(str.GetChars(), FSetTextureID(firsttileid + tile)); tile++; } } @@ -235,7 +235,7 @@ static void GenerateRotations(int firsttileid, const char* basename, int tile, i for (int frame = 0; frame < numframes; frame++) { FStringf str("%s@%c%x", basename, frame + 'A', rotation + 1); - TexMan.AddAlias(str, FSetTextureID(firsttileid + tile)); + TexMan.AddAlias(str.GetChars(), FSetTextureID(firsttileid + tile)); tile += order; } } @@ -249,14 +249,14 @@ static void CompleteRotations(int firsttileid, const char* basename, const char* for (int frame = 0; frame < numframes; frame++) { FStringf str("%s@%c%x", getname, frame + 'A', rotation + 1); - auto texid = TexMan.CheckForTexture(str, ETextureType::Any); + auto texid = TexMan.CheckForTexture(str.GetChars(), ETextureType::Any); if (frame == 0 && !texid.isValid()) { // rotation does not exist for the first frame -> we reached the end. return; } str.Format("%s@%c%x", basename, frame + 'A', rotation + 1); - TexMan.AddAlias(str, texid); + TexMan.AddAlias(str.GetChars(), texid); } } } @@ -266,13 +266,13 @@ static void SubstituteRotations(int firsttileid, const char* basename, int numfr for (int frame = 0; frame < numframes; frame++) { FStringf str("%s@%c%x", basename, frame + 'A', srcrot); - auto texid = TexMan.CheckForTexture(str, ETextureType::Any); + auto texid = TexMan.CheckForTexture(str.GetChars(), ETextureType::Any); if (!texid.isValid()) { continue; } str.Format("%s@%c%x", basename, frame + 'A', destrot); - TexMan.AddAlias(str, texid); + TexMan.AddAlias(str.GetChars(), texid); } } @@ -322,13 +322,13 @@ void LoadAliases(int firsttileid, int maxarttile) sc.ScriptMessage("%d: Bad order\n", order); continue; } - GenerateRotations(firsttileid, basename, tile, numframes, numrotations, order); + GenerateRotations(firsttileid, basename.GetChars(), tile, numframes, numrotations, order); if (sc.CheckString(",")) { sc.MustGetString(); if (sc.String[0] != '@') { - CompleteRotations(firsttileid, basename, sc.String, numframes, numrotations); + CompleteRotations(firsttileid, basename.GetChars(), sc.String, numframes, numrotations); } else { @@ -340,7 +340,7 @@ void LoadAliases(int firsttileid, int maxarttile) sc.MustGetStringName("="); sc.MustGetString(); int srcrot = (int)strtoll(sc.String + 1, nullptr, 10); - SubstituteRotations(firsttileid, basename, numframes, destrot, srcrot); + SubstituteRotations(firsttileid, basename.GetChars(), numframes, destrot, srcrot); } while (sc.CheckString(",")); } } @@ -414,7 +414,7 @@ void ConstructTileset() if (info.tile[i].imported == nullptr || i == 0) { ftex = nulltex->GetTexture(); - gtex = MakeGameTexture(ftex, tname, ETextureType::Null); + gtex = MakeGameTexture(ftex, tname.GetChars(), ETextureType::Null); } else { @@ -426,7 +426,7 @@ void ConstructTileset() { if (info.tile[i].imported) ftex = info.tile[i].imported->GetTexture(); else ftex = new FImageTexture(info.tile[i].tileimage); - gtex = MakeGameTexture(ftex, tname, i == 0? ETextureType::FirstDefined : ETextureType::Any); + gtex = MakeGameTexture(ftex, tname.GetChars(), i == 0? ETextureType::FirstDefined : ETextureType::Any); gtex->SetOffsets(info.tile[i].leftOffset, info.tile[i].topOffset); } if (info.tile[i].extinfo.picanm.sf & PICANM_NOFULLBRIGHT_BIT) diff --git a/source/core/textures/tiletexture.cpp b/source/core/textures/tiletexture.cpp index 68fd4197b..860836e96 100644 --- a/source/core/textures/tiletexture.cpp +++ b/source/core/textures/tiletexture.cpp @@ -437,7 +437,7 @@ int CountTiles(const char* fn, const uint8_t* RawData) static void AddArtFile(const FString& filename) { - FileReader fr = fileSystem.OpenFileReader(filename); + FileReader fr = fileSystem.OpenFileReader(filename.GetChars()); if (fr.isOpen()) { TArray artdata(fr.GetLength(), true); @@ -449,7 +449,7 @@ static void AddArtFile(const FString& filename) artdata.Delete(0, 8); } // Only load the data if the header is present - if (CountTiles(filename, artdata.Data()) > 0) + if (CountTiles(filename.GetChars(), artdata.Data()) > 0) { // The texture manager already has a store for Build ART files, so let's use it. :) auto& store = TexMan.GetNewBuildTileData(); diff --git a/source/core/thingdef_properties.cpp b/source/core/thingdef_properties.cpp index dcd0f616c..c487ad153 100644 --- a/source/core/thingdef_properties.cpp +++ b/source/core/thingdef_properties.cpp @@ -138,20 +138,21 @@ void ModActorFlag(DCoreActor *actor, FFlagDef *fd, bool set) // //========================================================================== -bool ModActorFlag(DCoreActor *actor, const FString &flagname, bool set, bool printerror) +bool ModActorFlag(DCoreActor *actor, const FString &flagnames, bool set, bool printerror) { bool found = false; if (actor != NULL) { + auto flagname = flagnames.GetChars(); const char *dot = strchr(flagname, '.'); FFlagDef *fd; PClassActor* cls = static_cast(actor->GetClass()); if (dot != NULL) { - FString part1(flagname.GetChars(), dot - flagname); - fd = FindFlag(cls, part1, dot + 1); + FString part1(flagname, dot - flagname); + fd = FindFlag(cls, part1.GetChars(), dot + 1); } else { @@ -169,7 +170,7 @@ bool ModActorFlag(DCoreActor *actor, const FString &flagname, bool set, bool pri } else if (printerror) { - DPrintf(DMSG_ERROR, "ACS/DECORATE: '%s' is not a flag in '%s'\n", flagname.GetChars(), cls->TypeName.GetChars()); + DPrintf(DMSG_ERROR, "ACS/DECORATE: '%s' is not a flag in '%s'\n", flagname, cls->TypeName.GetChars()); } } @@ -217,7 +218,7 @@ INTBOOL CheckActorFlag(DCoreActor *owner, const char *flagname, bool printerror) if (dot != NULL) { FString part1(flagname, dot-flagname); - fd = FindFlag (cls, part1, dot+1); + fd = FindFlag (cls, part1.GetChars(), dot+1); } else { diff --git a/source/core/zcc_compile_raze.cpp b/source/core/zcc_compile_raze.cpp index 1e8406ae1..bb589514f 100644 --- a/source/core/zcc_compile_raze.cpp +++ b/source/core/zcc_compile_raze.cpp @@ -542,7 +542,7 @@ void ZCCRazeCompiler::ProcessDefaultProperty(PClassActor *cls, ZCC_PropertyStmt } - FPropertyInfo *property = FindProperty(propname); + FPropertyInfo *property = FindProperty(propname.GetChars()); if (property != nullptr && property->category != CAT_INFO) { diff --git a/source/games/blood/src/barf.cpp b/source/games/blood/src/barf.cpp index 078587189..638be5396 100644 --- a/source/games/blood/src/barf.cpp +++ b/source/games/blood/src/barf.cpp @@ -683,7 +683,7 @@ void ParseScript(int lumpnum) // check if this was defined via command prompt arguments for (int i = 0; i < nCmdDefines; i++) { - if (stricmp(gCmdDefines[i]._text, char256_1) == 0) { // string is equivalent + if (gCmdDefines[i]._text.CompareNoCase(char256_1) == 0) { // string is equivalent bGotDefine = true; break; } diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index bea08303c..cb13e1f84 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -280,11 +280,11 @@ void StartLevel(MapRecord* level, bool newgame) //drawLoadingScreen(); BloodSpawnSpriteDef sprites; DVector3 startpos; - dbLoadMap(currentLevel->fileName, startpos, &startang, &startsector, nullptr, sprites); + dbLoadMap(currentLevel->fileName.GetChars(), startpos, &startang, &startsector, nullptr, sprites); auto startangle = mapangle(startang); - SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); - STAT_NewLevel(currentLevel->fileName); - TITLE_InformName(currentLevel->name); + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name.GetChars()); + STAT_NewLevel(currentLevel->fileName.GetChars()); + TITLE_InformName(currentLevel->name.GetChars()); wsrand(dbReadMapCRC(currentLevel->LabelName())); gHitInfo.hitSector = nullptr; gHitInfo.hitWall = nullptr; @@ -750,7 +750,7 @@ DEFINE_ACTION_FUNCTION(_Blood, sndStartSampleNamed) PARAM_STRING(id); PARAM_INT(vol); PARAM_INT(chan); - sndStartSample(id, vol, chan); + sndStartSample(id.GetChars(), vol, chan); return 0; } diff --git a/source/games/blood/src/d_menu.cpp b/source/games/blood/src/d_menu.cpp index 20a2de58f..6c0c3f1d6 100644 --- a/source/games/blood/src/d_menu.cpp +++ b/source/games/blood/src/d_menu.cpp @@ -185,7 +185,7 @@ DEFINE_ACTION_FUNCTION(_ImageScrollerPageQavDrawer, LoadQav) { PARAM_PROLOGUE; PARAM_STRING(str); - auto qav = new CGameMenuItemQAV(160, 100, str, false, true); + auto qav = new CGameMenuItemQAV(160, 100, str.GetChars(), false, true); ACTION_RETURN_POINTER(qav); } diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 995320694..293567110 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -96,7 +96,7 @@ unsigned int dbReadMapCRC(const char* pPath) { FString mapname = pPath; DefaultExtension(mapname, ".map"); - auto fr = fileSystem.OpenFileReader(mapname); + auto fr = fileSystem.OpenFileReader(mapname.GetChars()); if (!fr.isOpen()) { @@ -153,7 +153,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur FString mapname = pPath; DefaultExtension(mapname, ".map"); - auto fr = fileSystem.OpenFileReader(mapname); + auto fr = fileSystem.OpenFileReader(mapname.GetChars()); if (!fr.isOpen()) { @@ -615,7 +615,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur uint8_t md4[16]; md4once(buffer.data(), (unsigned)buffer.size(), md4); PostProcessLevel(md4, mapname, sprites); - loadMapHack(mapname, md4, sprites); + loadMapHack(mapname.GetChars(), md4, sprites); if (CalcCRC32(buffer.data(), (unsigned)buffer.size() - 4) != nCRC) { diff --git a/source/games/blood/src/levels.cpp b/source/games/blood/src/levels.cpp index 6ac1e46c0..44f7c4b1d 100644 --- a/source/games/blood/src/levels.cpp +++ b/source/games/blood/src/levels.cpp @@ -65,7 +65,7 @@ static IniFile* levelInitINI(const char* pzIni) static void levelLoadMapInfo(IniFile* pIni, MapRecord* pLevelInfo, const char* pzSection, int epinum, int mapnum, int* nextmap, int* nextsecret) { char buffer[16]; - pLevelInfo->SetName(pIni->GetKeyString(pzSection, "Title", pLevelInfo->labelName)); + pLevelInfo->SetName(pIni->GetKeyString(pzSection, "Title", pLevelInfo->labelName.GetChars())); pLevelInfo->Author = pIni->GetKeyString(pzSection, "Author", ""); pLevelInfo->music = pIni->GetKeyString(pzSection, "Song", ""); if (pLevelInfo->music.IsNotEmpty()) DefaultExtension(pLevelInfo->music, ".mid"); @@ -102,14 +102,14 @@ static const char* DefFile(void) FString ext = fn.Right(4); if (ext.CompareNoCase(".ini") == 0) { - if (fileSystem.CheckNumForFullName(fn) != i) continue; + if (fileSystem.CheckNumForFullName(fn.GetChars()) != i) continue; if (found == -1) { - IniFile inif(fn); + IniFile inif(fn.GetChars()); for (int j = 1; j <= 6; j++) { FStringf key("Episode%d", j); - if (inif.SectionExists(key)) + if (inif.SectionExists(key.GetChars())) { found = i; break; @@ -139,18 +139,18 @@ static FString cleanPath(const char* pth) { FString path = pth; FixPathSeperator(path); - if (fileSystem.FileExists(path)) return path; + if (fileSystem.FileExists(path.GetChars())) return path; if (path.Len() > 3 && path[1] == ':' && isalpha((uint8_t)path[0]) && path[2] == '/') { path = path.Mid(3); - if (fileSystem.FileExists(path)) return path; + if (fileSystem.FileExists(path.GetChars())) return path; } // optionally strip the first path component to account for poor logic of the DOS EXE. auto pos = path.IndexOf("/"); if (pos >= 0) { auto npath = path.Mid(pos + 1); - if (fileSystem.FileExists(npath)) return npath; + if (fileSystem.FileExists(npath.GetChars())) return npath; } return path; } @@ -182,7 +182,7 @@ void levelLoadDefaults(void) CutsceneDef& csB = cluster->outro; FString ep_str = pIni->GetKeyString(buffer, "Title", buffer); ep_str.StripRight(); - cluster->name = volume->name = FStringTable::MakeMacro(ep_str); + cluster->name = volume->name = FStringTable::MakeMacro(ep_str.GetChars()); if (i > 1) volume->flags |= VF_SHAREWARELOCK; if (pIni->GetKeyInt(buffer, "BloodBathOnly", 0)) volume->flags |= VF_HIDEFROMSP; @@ -274,10 +274,10 @@ void levelTryPlayMusic() else { buffer = currentLevel->music; - if (Mus_Play(buffer, true)) return; + if (Mus_Play(buffer.GetChars(), true)) return; if (buffer.IsNotEmpty()) DefaultExtension(buffer, ".mid"); } - if (!Mus_Play(buffer, true)) + if (!Mus_Play(buffer.GetChars(), true)) { Mus_Play("", true); } diff --git a/source/games/blood/src/sound.cpp b/source/games/blood/src/sound.cpp index ecabae534..bd77fae7c 100644 --- a/source/games/blood/src/sound.cpp +++ b/source/games/blood/src/sound.cpp @@ -80,13 +80,13 @@ static void S_AddBloodSFX(int lumpnum) ByteSwapSFX(sfx); FStringf rawname("%s.raw", sfx->rawName); - auto rawlump = fileSystem.FindFile(rawname); + auto rawlump = fileSystem.FindFile(rawname.GetChars()); if (rawlump != -1) { if (!sfxnum.isvalid()) { - sfxnum = soundEngine->AddSoundLump(FStringf("SfxSound@%04d", resid), rawlump, 0, resid, 6); // use a generic name here in case sound replacements are being used. + sfxnum = soundEngine->AddSoundLump(FStringf("SfxSound@%04d", resid).GetChars(), rawlump, 0, resid, 6); // use a generic name here in case sound replacements are being used. soundfx = soundEngine->GetWritableSfx(sfxnum); } if (sfx->format < 5 || sfx->format > 12) @@ -231,7 +231,7 @@ void sndStartWavDisk(const char* pzFile, int nVolume, int nChannel) { FString name = pzFile; FixPathSeperator(name); - return sndStartSample(name, nVolume, nChannel); + return sndStartSample(name.GetChars(), nVolume, nChannel); } void sndKillAllSounds(void) diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index cff8a1626..4aefbe342 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -743,7 +743,7 @@ void viewDrawScreen(bool sceneonly) else if (pPlayer->pnum != myconnectindex) { FStringf gTempStr("] %s [", PlayerName(pPlayer->pnum)); - viewDrawText(OriginalSmallFont, gTempStr, 160, 10, 0, 0, 1, 0); + viewDrawText(OriginalSmallFont, gTempStr.GetChars(), 160, 10, 0, 0, 1, 0); } if (cl_interpolate) { diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 60c2c1067..661361c53 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -3228,7 +3228,7 @@ void loadcons() if (userConfig.AddCons) for (FString& m : *userConfig.AddCons.get()) { - comp.compilecon(m); + comp.compilecon(m.GetChars()); } ScriptCode.ShrinkToFit(); labels.ShrinkToFit(); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 8166ff309..103efaaf6 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -1062,12 +1062,12 @@ static int LoadTheMap(MapRecord *mi, DDukePlayer*p, int gamemode) sectortype* sect; SpawnSpriteDef sprites; DVector3 pos; - loadMap(mi->fileName, isShareware(), &pos, &lbang, §, sprites); + loadMap(mi->fileName.GetChars(), isShareware(), &pos, &lbang, §, sprites); p->cursector = sect; - SECRET_SetMapName(mi->DisplayName(), mi->name); - STAT_NewLevel(mi->fileName); - TITLE_InformName(mi->name); + SECRET_SetMapName(mi->DisplayName(), mi->name.GetChars()); + STAT_NewLevel(mi->fileName.GetChars()); + TITLE_InformName(mi->name.GetChars()); auto actorlist = spawnactors(sprites); @@ -1266,7 +1266,7 @@ int setnextmap(bool checksecretexit) if (map) { // If the map doesn't exist, abort with a meaningful message instead of crashing. - if (fileSystem.FindFile(map->fileName) < 0) + if (fileSystem.FindFile(map->fileName.GetChars()) < 0) { I_Error("Trying to open non-existent %s", map->fileName.GetChars()); } diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 28a9f86fa..44565a1a7 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -173,7 +173,7 @@ int S_DefineSound(unsigned index, const char *filename, int minpitch, int maxpit if (!s_index.isvalid()) { // If the slot isn't defined, give it a meaningful name containing the index. - s_index = soundEngine->FindSoundTentative(FStringf("ConSound@%04d", index)); + s_index = soundEngine->FindSoundTentative(FStringf("ConSound@%04d", index).GetChars()); } auto sfx = soundEngine->GetWritableSfx(s_index); @@ -215,14 +215,14 @@ int S_DefineSound(unsigned index, const char *filename, int minpitch, int maxpit FString fn = filename; fn.Substitute("\\\\", "\\"); FixPathSeperator(fn); - sfx->lumpnum = S_LookupSound(fn); + sfx->lumpnum = S_LookupSound(fn.GetChars()); // For World Tour allow falling back on the classic sounds if the Oggs cannot be found if (isWorldTour() && sfx->lumpnum == -1) { fn.ToLower(); fn.Substitute("sound/", ""); fn.Substitute(".ogg", ".voc"); - sfx->lumpnum = S_LookupSound(fn); + sfx->lumpnum = S_LookupSound(fn.GetChars()); } if (minpitch != 0 || maxpitch != 0) { @@ -657,13 +657,13 @@ static void MusPlay(const char* music, bool loop) { FString alternative = music; alternative.Substitute(".ogg", ".mid"); - int num = fileSystem.FindFile(alternative); + int num = fileSystem.FindFile(alternative.GetChars()); if (num >= 0) { int file = fileSystem.GetFileContainer(num); if (file == 1) { - Mus_Play(alternative, loop); + Mus_Play(alternative.GetChars(), loop); return; } } @@ -675,14 +675,14 @@ static void MusPlay(const char* music, bool loop) { FString alternative = music; alternative.Substitute(".ogg", ".mid"); - Mus_Play(alternative, loop); + Mus_Play(alternative.GetChars(), loop); } } void S_PlayLevelMusic(MapRecord *mi) { if (isRR() && mi->music.IsEmpty() && mus_redbook && !cd_disabled) return; - MusPlay(mi->music, true); + MusPlay(mi->music.GetChars(), true); } void S_PlaySpecialMusic(unsigned int m) @@ -691,7 +691,7 @@ void S_PlaySpecialMusic(unsigned int m) auto& musicfn = specialmusic[m]; if (musicfn.IsNotEmpty()) { - MusPlay(musicfn, true); + MusPlay(musicfn.GetChars(), true); } } @@ -714,10 +714,10 @@ void S_PlayRRMusic(int newTrack) g_cdTrack = 2; FStringf filename("redneck%s%02d.ogg", isRRRA()? "rides" : "", g_cdTrack); - if (Mus_Play(filename, false)) return; + if (Mus_Play(filename.GetChars(), false)) return; filename.Format("track%02d.ogg", g_cdTrack); - if (Mus_Play(filename, false)) return; + if (Mus_Play(filename.GetChars(), false)) return; } // If none of the tracks managed to start, disable the CD music for this session so that regular music can play if defined. cd_disabled = true; @@ -747,7 +747,7 @@ void S_WorldTourMappingsForOldSounds() fname.ToLower(); fname.Substitute("sound/", ""); fname.Substitute(".ogg", ".voc"); - int lump = fileSystem.FindFile(fname); // in this case we absolutely do not want the extended lookup that's optionally performed by S_LookupSound. + int lump = fileSystem.FindFile(fname.GetChars()); // in this case we absolutely do not want the extended lookup that's optionally performed by S_LookupSound. if (lump >= 0) { auto newsfx = soundEngine->AllocateSound(); @@ -825,16 +825,17 @@ int StartCommentary(int tag, DDukeActor* actor) { if (wt_commentary && Commentaries.Size() > (unsigned)tag && Commentaries[tag].IsNotEmpty()) { - FSoundID id = soundEngine->FindSound(Commentaries[tag]); + auto sname = Commentaries[tag].GetChars(); + FSoundID id = soundEngine->FindSound(sname); if (!id.isvalid()) { - int lump = fileSystem.FindFile(Commentaries[tag]); + int lump = fileSystem.FindFile(sname); if (lump < 0) { Commentaries[tag] = ""; return false; } - id = FSoundID(soundEngine->AddSoundLump(Commentaries[tag], lump, 0)); + id = FSoundID(soundEngine->AddSoundLump(sname, lump, 0)); } StopCommentary(); MuteSounds(); diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index 089d0aa59..27f80c865 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -1139,7 +1139,7 @@ DEFINE_ACTION_FUNCTION(_DukePlayer, GetGameVar) PARAM_SELF_STRUCT_PROLOGUE(DDukePlayer); PARAM_STRING(name); PARAM_INT(def); - ACTION_RETURN_INT(GetGameVar(name, def, self->GetActor(), self->GetPlayerNum()).safeValue()); + ACTION_RETURN_INT(GetGameVar(name.GetChars(), def, self->GetActor(), self->GetPlayerNum()).safeValue()); } void dukeplayer_backuppos(DDukePlayer* self) diff --git a/source/games/exhumed/src/2d.cpp b/source/games/exhumed/src/2d.cpp index 0e8f444db..62753c156 100644 --- a/source/games/exhumed/src/2d.cpp +++ b/source/games/exhumed/src/2d.cpp @@ -304,7 +304,7 @@ void TextOverlay::Create(const FString& text, int pal) { lastclock = 0; FString ttext = GStrings(text); - font = PickSmallFont(ttext); + font = PickSmallFont(ttext.GetChars()); screentext = ttext.Split("\n"); ComputeCinemaText(); } @@ -343,7 +343,7 @@ void TextOverlay::DisplayText() while (i < screentext.Size() && y <= 199) { if (y >= -10) - DrawText(twod, font, CR_NATIVEPAL, nLeft[i], y, screentext[i], DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, TRANSLATION(Translation_BasePalettes, currentCinemaPalette), TAG_DONE); + DrawText(twod, font, CR_NATIVEPAL, nLeft[i], y, screentext[i].GetChars(), DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, TRANSLATION(Translation_BasePalettes, currentCinemaPalette), TAG_DONE); i++; y += 10; diff --git a/source/games/exhumed/src/gameloop.cpp b/source/games/exhumed/src/gameloop.cpp index fa37ebfc7..41e85ddde 100644 --- a/source/games/exhumed/src/gameloop.cpp +++ b/source/games/exhumed/src/gameloop.cpp @@ -128,8 +128,8 @@ void GameInterface::NextLevel(MapRecord *map, int skill) nBestLevel = map->levelNumber - 1; } - STAT_NewLevel(currentLevel->labelName); - TITLE_InformName(currentLevel->name); + STAT_NewLevel(currentLevel->labelName.GetChars()); + TITLE_InformName(currentLevel->name.GetChars()); } //--------------------------------------------------------------------------- diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 826d53781..d03d323d1 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -159,7 +159,7 @@ uint8_t LoadLevel(MapRecord* map) SpawnSpriteDef spawned; DVector3 initpos; int16_t mapang; - loadMap(currentLevel->fileName, 0, &initpos, &mapang, &initsect, spawned); + loadMap(currentLevel->fileName.GetChars(), 0, &initpos, &mapang, &initsect, spawned); auto actors = spawnactors(spawned); g_visibility = 1024; @@ -197,7 +197,7 @@ void InitLevel(MapRecord* map) totalmoves = 0; GrabPalette(); - if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level + if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music.GetChars(), true); // Allow non-CD music if defined for the current level playCDtrack(map->cdSongId, true); setLevelStarted(currentLevel); } diff --git a/source/games/exhumed/src/movie.cpp b/source/games/exhumed/src/movie.cpp index b2055a1af..3f08d12a5 100644 --- a/source/games/exhumed/src/movie.cpp +++ b/source/games/exhumed/src/movie.cpp @@ -238,7 +238,7 @@ public: int IdentifyLMF(const FString* fn) { - auto fp = fileSystem.OpenFileReader(*fn); + auto fp = fileSystem.OpenFileReader(fn->GetChars()); if (!fp.isOpen()) return false; char buffer[4]; fp.Read(buffer, 4); @@ -249,7 +249,7 @@ DEFINE_ACTION_FUNCTION(_LMFDecoder, Create) { PARAM_PROLOGUE; PARAM_STRING(fn); - ACTION_RETURN_POINTER(new LMFPlayer(fn)); + ACTION_RETURN_POINTER(new LMFPlayer(fn.GetChars())); } DEFINE_ACTION_FUNCTION_NATIVE(_LMFDecoder, Identify, IdentifyLMF) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 6b6d99444..01e642f6e 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -494,7 +494,7 @@ static void pickupMessage(int no) if (no != -1) { FStringf label("TXT_EX_PICKUP%d", no + 1); - auto str = GStrings[label]; + auto str = GStrings[label.GetChars()]; if (str) Printf(PRINT_NOTIFY, "%s\n", str); } } diff --git a/source/games/exhumed/src/ramses.cpp b/source/games/exhumed/src/ramses.cpp index ccbd8d3bb..9f3056f5f 100644 --- a/source/games/exhumed/src/ramses.cpp +++ b/source/games/exhumed/src/ramses.cpp @@ -137,7 +137,7 @@ void InitSpiritHead() lNextStateChange = PlayClock; lHeadStartClock = PlayClock; - auto headfd = fileSystem.OpenFileReader(currentLevel->ex_ramses_pup); + auto headfd = fileSystem.OpenFileReader(currentLevel->ex_ramses_pup.GetChars()); if (!headfd.isOpen()) { memset(cPupData, 0, sizeof(cPupData)); diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index 08baccb36..581f6da38 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -166,7 +166,7 @@ static void fixSeqs() static int addSeq(const char *seqName) { const FStringf seqfilename("%s.seq", seqName); - const auto hFile = fileSystem.ReopenFileReader(fileSystem.FindFile(seqfilename), true); + const auto hFile = fileSystem.ReopenFileReader(fileSystem.FindFile(seqfilename.GetChars()), true); if (!hFile.isOpen()) { diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 4121764a9..8ed78be35 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -172,7 +172,7 @@ int LoadSound(const char* name) if (sndid.isvalid()) return sndid.index() - 1; FStringf filename("%s.voc", nname); - auto lump = S_LookupSound(filename); + auto lump = S_LookupSound(filename.GetChars()); if (lump > 0) { auto check = fileSystem.ReadFile(lump); diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 515d6a491..652e1f580 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -224,7 +224,7 @@ void DrawView(double interpfrac, bool sceneonly) if (bSubTitles) { subtitleOverlay.Start(I_GetTimeNS() * (120. / 1'000'000'000)); - subtitleOverlay.ReadyCinemaText(currentLevel->ex_ramses_text); + subtitleOverlay.ReadyCinemaText(currentLevel->ex_ramses_text.GetChars()); } inputState.ClearAllInput(); gameInput.Clear(); diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 7f7a2a722..bb4780c38 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -463,13 +463,13 @@ void InitLevel(MapRecord *maprec) sectortype* cursect; SpawnSpriteDef sprites; DVector3 ppos; - loadMap(maprec->fileName, SW_SHAREWARE ? 1 : 0, &ppos, &ang, &cursect, sprites); + loadMap(maprec->fileName.GetChars(), SW_SHAREWARE ? 1 : 0, &ppos, &ang, &cursect, sprites); spawnactors(sprites); getPlayer(0)->cursector = cursect; - SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); - STAT_NewLevel(currentLevel->fileName); - TITLE_InformName(currentLevel->name); + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name.GetChars()); + STAT_NewLevel(currentLevel->fileName.GetChars()); + TITLE_InformName(currentLevel->name.GetChars()); auto vissect = §or[0]; // hack alert! if (vissect->extra != -1) @@ -536,7 +536,7 @@ void InitRunLevel(void) if (currentLevel) { - PlaySong(currentLevel->music, currentLevel->cdSongId); + PlaySong(currentLevel->music.GetChars(), currentLevel->cdSongId); } InitPrediction(getPlayer(myconnectindex)); @@ -681,7 +681,7 @@ void GameInterface::LevelCompleted(MapRecord* map, int skill) if (map == nullptr) { FinishAnim = false; - PlaySong(ThemeSongs[0], ThemeTrack[0]); + PlaySong(ThemeSongs[0].GetChars(), ThemeTrack[0]); if (isShareware()) { PlayOrderSound(); diff --git a/source/games/sw/src/scrip2.cpp b/source/games/sw/src/scrip2.cpp index 310bad39d..37fce6a2f 100644 --- a/source/games/sw/src/scrip2.cpp +++ b/source/games/sw/src/scrip2.cpp @@ -652,7 +652,7 @@ void LoadCustomInfoFromScript(const char *filename) if (in == -1) break; if (name.IsNotEmpty()) { - quoteMgr.InitializeQuote(QUOTE_INVENTORY + in, name); + quoteMgr.InitializeQuote(QUOTE_INVENTORY + in, name.GetChars()); } if (amt >= 0) { @@ -728,7 +728,7 @@ void LoadCustomInfoFromScript(const char *filename) if (maxammo >= 0) DamageData[id].max_ammo = maxammo; if (name.IsNotEmpty()) { - quoteMgr.InitializeQuote(QUOTE_WPNFIST + in, name); + quoteMgr.InitializeQuote(QUOTE_WPNFIST + in, name.GetChars()); } if (wpickup >= 0) DamageData[id].weapon_pickup = wpickup; } @@ -736,7 +736,7 @@ void LoadCustomInfoFromScript(const char *filename) { if (ammo.IsNotEmpty()) { - quoteMgr.InitializeQuote(QUOTE_AMMOFIST + in, ammo); + quoteMgr.InitializeQuote(QUOTE_AMMOFIST + in, ammo.GetChars()); } if (pickup >= 0) DamageData[id].ammo_pickup = pickup; } diff --git a/source/games/sw/src/serp.cpp b/source/games/sw/src/serp.cpp index 1a4f9f135..ebd11cf2d 100644 --- a/source/games/sw/src/serp.cpp +++ b/source/games/sw/src/serp.cpp @@ -790,7 +790,7 @@ int DoDeathSpecial(DSWActor* actor) if (!SW_SHAREWARE) { // Resume the regular music - in a hack-free fashion. - PlaySong(currentLevel->music, currentLevel->cdSongId); + PlaySong(currentLevel->music.GetChars(), currentLevel->cdSongId); } BossSpriteNum[0] = nullptr; diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 08a41d8b8..3317ea017 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -858,10 +858,10 @@ bool PlaySong(const char* song_file_name, int cdaudio_track, bool isThemeTrack) if (cdaudio_track >= 0 && (mus_redbook || !song_file_name || *song_file_name == 0)) { FStringf trackname("shadow%02d.ogg", cdaudio_track); - if (!Mus_Play(trackname, true)) + if (!Mus_Play(trackname.GetChars(), true)) { trackname.Format("track%02d.ogg", cdaudio_track); - if (!Mus_Play(trackname, true)) + if (!Mus_Play(trackname.GetChars(), true)) { Printf("Can't find CD track %i!\n", cdaudio_track); } @@ -876,10 +876,10 @@ bool PlaySong(const char* song_file_name, int cdaudio_track, bool isThemeTrack) { // try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing if mus_redbook is off.) FStringf trackname("shadow%02d.ogg", cdaudio_track); - if (!Mus_Play(trackname, true)) + if (!Mus_Play(trackname.GetChars(), true)) { trackname.Format("track%02d.ogg", cdaudio_track); - if (!Mus_Play(trackname, true)) return false; + if (!Mus_Play(trackname.GetChars(), true)) return false; } } return true; @@ -928,7 +928,7 @@ DEFINE_ACTION_FUNCTION(_SW, PlaySong) { PARAM_PROLOGUE; PARAM_INT(song); - PlaySong(ThemeSongs[song], ThemeTrack[song], true); + PlaySong(ThemeSongs[song].GetChars(), ThemeTrack[song], true); return 0; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index d4164ac19..fe7af042c 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -5161,7 +5161,7 @@ KeyMain: Printf(PRINT_NONOTIFY, TEXTCOLOR_SAPPHIRE "%s\n", msg.GetChars()); if (hud_messages) { - strncpy(pp->cookieQuote, msg, 255); + strncpy(pp->cookieQuote, msg.GetChars(), 255); pp->cookieQuote[255] = 0; pp->cookieTime = 540; } diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index 8191a02c5..a8a22befe 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -678,7 +678,7 @@ int DoSumoDeathMelt(DSWActor* actor) if (!SW_SHAREWARE) { // Resume the regular music - in a hack-free fashion. - PlaySong(currentLevel->music, currentLevel->cdSongId); + PlaySong(currentLevel->music.GetChars(), currentLevel->cdSongId); } BossSpriteNum[1] = nullptr; // Sprite is gone, set it back to keep it valid! @@ -745,7 +745,7 @@ void BossHealthMeter(void) bosswasseen[0] = true; if (!SW_SHAREWARE) { - PlaySong(ThemeSongs[2], ThemeTrack[2], true); + PlaySong(ThemeSongs[2].GetChars(), ThemeTrack[2], true); } } else if (i == 1 && !bosswasseen[1]) @@ -753,7 +753,7 @@ void BossHealthMeter(void) bosswasseen[1] = true; if (!SW_SHAREWARE) { - PlaySong(ThemeSongs[3], ThemeTrack[3], true); + PlaySong(ThemeSongs[3].GetChars(), ThemeTrack[3], true); } } else if (i == 2 && !bosswasseen[2]) @@ -761,7 +761,7 @@ void BossHealthMeter(void) bosswasseen[2] = true; if (!SW_SHAREWARE) { - PlaySong(ThemeSongs[4], ThemeTrack[4], true); + PlaySong(ThemeSongs[4].GetChars(), ThemeTrack[4], true); } } } diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index b650b3b87..e1c1cd8e3 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -716,7 +716,7 @@ int DoZillaDeathMelt(DSWActor* actor) if (!SW_SHAREWARE) { // Resume the regular music - in a hack-free fashion. - PlaySong(currentLevel->music, currentLevel->cdSongId); + PlaySong(currentLevel->music.GetChars(), currentLevel->cdSongId); } //KeepActorOnFloor(actor);