Merge remote-tracking branch 'gzdoom/master' into merge-gzdoom
This commit is contained in:
commit
e75e5a387b
600 changed files with 40006 additions and 59374 deletions
|
|
@ -90,6 +90,7 @@
|
|||
#include "doommenu.h"
|
||||
#include "screenjob.h"
|
||||
#include "i_interface.h"
|
||||
#include "fs_findfile.h"
|
||||
|
||||
|
||||
static FRandom pr_dmspawn ("DMSpawn");
|
||||
|
|
@ -111,7 +112,6 @@ void G_DoAutoSave ();
|
|||
void G_DoQuickSave ();
|
||||
|
||||
void STAT_Serialize(FSerializer &file);
|
||||
bool WriteZip(const char *filename, TArray<FString> &filenames, TArray<FCompressedBuffer> &content);
|
||||
|
||||
CVARD_NAMED(Int, gameskill, skill, 2, CVAR_SERVERINFO|CVAR_LATCH, "sets the skill for the next newly started game")
|
||||
CVAR(Bool, save_formatted, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // use formatted JSON for saves (more readable but a larger files and a bit slower.
|
||||
|
|
@ -770,8 +770,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 = "";
|
||||
}
|
||||
if (SendItemUse == (const AActor *)1)
|
||||
|
|
@ -1142,8 +1142,8 @@ void G_Ticker ()
|
|||
{
|
||||
case ga_recordgame:
|
||||
G_CheckDemoStatus();
|
||||
G_RecordDemo(newdemoname);
|
||||
G_BeginRecording(newdemomap);
|
||||
G_RecordDemo(newdemoname.GetChars());
|
||||
G_BeginRecording(newdemomap.GetChars());
|
||||
[[fallthrough]];
|
||||
case ga_newgame2: // Silence GCC (see above)
|
||||
case ga_newgame:
|
||||
|
|
@ -1155,7 +1155,7 @@ void G_Ticker ()
|
|||
G_DoLoadGame ();
|
||||
break;
|
||||
case ga_savegame:
|
||||
G_DoSaveGame (true, false, savegamefile, savedescription);
|
||||
G_DoSaveGame (true, false, savegamefile, savedescription.GetChars());
|
||||
gameaction = ga_nothing;
|
||||
savegamefile = "";
|
||||
savedescription = "";
|
||||
|
|
@ -1177,7 +1177,7 @@ void G_Ticker ()
|
|||
G_DoWorldDone ();
|
||||
break;
|
||||
case ga_screenshot:
|
||||
M_ScreenShot (shotfile);
|
||||
M_ScreenShot (shotfile.GetChars());
|
||||
shotfile = "";
|
||||
gameaction = ga_nothing;
|
||||
break;
|
||||
|
|
@ -1471,7 +1471,7 @@ bool FLevelLocals::CheckSpot (int playernum, FPlayerStart *mthing)
|
|||
// return false;
|
||||
|
||||
players[playernum].mo->flags |= MF_SOLID;
|
||||
i = P_CheckPosition(players[playernum].mo, spot);
|
||||
i = P_CheckPosition(players[playernum].mo, spot.XY());
|
||||
players[playernum].mo->flags &= ~MF_SOLID;
|
||||
players[playernum].mo->SetZ(oldz); // [RH] Restore corpse's height
|
||||
if (!i)
|
||||
|
|
@ -1723,7 +1723,7 @@ void FLevelLocals::DoReborn (int playernum, bool freshbot)
|
|||
if (!multiplayer && !(flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn &&
|
||||
!G_SkillProperty(SKILLP_PlayerRespawn))
|
||||
{
|
||||
if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()))
|
||||
if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName))
|
||||
{ // Load game from the last point it was saved
|
||||
savename = BackupSaveName;
|
||||
gameaction = ga_autoloadgame;
|
||||
|
|
@ -1732,7 +1732,7 @@ void FLevelLocals::DoReborn (int playernum, bool freshbot)
|
|||
{ // Reload the level from scratch
|
||||
bool indemo = demoplayback;
|
||||
BackupSaveName = "";
|
||||
G_InitNew (MapName, false);
|
||||
G_InitNew (MapName.GetChars(), false);
|
||||
demoplayback = indemo;
|
||||
}
|
||||
}
|
||||
|
|
@ -1893,9 +1893,9 @@ bool G_CheckSaveGameWads (FSerializer &arc, bool printwarn)
|
|||
FString text;
|
||||
|
||||
arc("Game WAD", text);
|
||||
CheckSingleWad (text, printRequires, printwarn);
|
||||
CheckSingleWad (text.GetChars(), printRequires, printwarn);
|
||||
arc("Map WAD", text);
|
||||
CheckSingleWad (text, printRequires, printwarn);
|
||||
CheckSingleWad (text.GetChars(), printRequires, printwarn);
|
||||
|
||||
if (printRequires)
|
||||
{
|
||||
|
|
@ -1981,7 +1981,7 @@ void G_DoLoadGame ()
|
|||
LoadGameError("TXT_COULDNOTREAD");
|
||||
return;
|
||||
}
|
||||
FResourceLump *info = resfile->FindLump("info.json");
|
||||
auto info = resfile->FindLump("info.json");
|
||||
if (info == nullptr)
|
||||
{
|
||||
LoadGameError("TXT_NOINFOJSON");
|
||||
|
|
@ -2035,7 +2035,7 @@ void G_DoLoadGame ()
|
|||
message.Substitute("%e", FStringf("%d", SAVEVER));
|
||||
}
|
||||
message.Substitute("%d", FStringf("%d", SaveVersion));
|
||||
LoadGameError(message);
|
||||
LoadGameError(message.GetChars());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2107,7 +2107,7 @@ void G_DoLoadGame ()
|
|||
|
||||
// load a base level
|
||||
bool demoplaybacksave = demoplayback;
|
||||
G_InitNew(map, false);
|
||||
G_InitNew(map.GetChars(), false);
|
||||
demoplayback = demoplaybacksave;
|
||||
savegamerestore = false;
|
||||
|
||||
|
|
@ -2129,7 +2129,7 @@ void G_DoLoadGame ()
|
|||
{
|
||||
FString modelFilePath = smf.Left(smf.LastIndexOf("/")+1);
|
||||
FString modelFileName = smf.Right(smf.Len() - smf.Left(smf.LastIndexOf("/") + 1).Len());
|
||||
FindModel(modelFilePath, modelFileName);
|
||||
FindModel(modelFilePath.GetChars(), modelFileName.GetChars());
|
||||
}
|
||||
|
||||
// At this point, the GC threshold is likely a lot higher than the
|
||||
|
|
@ -2173,8 +2173,8 @@ void G_SaveGame (const char *filename, const char *description)
|
|||
CCMD(opensaves)
|
||||
{
|
||||
FString name = G_GetSavegamesFolder();
|
||||
CreatePath(name);
|
||||
I_OpenShellFolder(name);
|
||||
CreatePath(name.GetChars());
|
||||
I_OpenShellFolder(name.GetChars());
|
||||
}
|
||||
|
||||
CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
|
@ -2215,7 +2215,7 @@ void G_DoAutoSave ()
|
|||
num.Int = nextautosave;
|
||||
autosavenum->ForceSet (num, CVAR_Int);
|
||||
|
||||
file = G_BuildSaveName(FStringf("auto%02d", nextautosave));
|
||||
file = G_BuildSaveName(FStringf("auto%02d", nextautosave).GetChars());
|
||||
|
||||
// The hint flag is only relevant on the primary level.
|
||||
if (!(primaryLevel->flags2 & LEVEL2_NOAUTOSAVEHINT))
|
||||
|
|
@ -2230,7 +2230,7 @@ void G_DoAutoSave ()
|
|||
|
||||
readableTime = myasctime ();
|
||||
description.Format("Autosave %s", readableTime);
|
||||
G_DoSaveGame (false, false, file, description);
|
||||
G_DoSaveGame (false, false, file, description.GetChars());
|
||||
}
|
||||
|
||||
void G_DoQuickSave ()
|
||||
|
|
@ -2254,11 +2254,11 @@ void G_DoQuickSave ()
|
|||
num.Int = lastquicksave;
|
||||
quicksavenum->ForceSet (num, CVAR_Int);
|
||||
|
||||
file = G_BuildSaveName(FStringf("quick%02d", lastquicksave));
|
||||
file = G_BuildSaveName(FStringf("quick%02d", lastquicksave).GetChars());
|
||||
|
||||
readableTime = myasctime ();
|
||||
description.Format("Quicksave %s", readableTime);
|
||||
G_DoSaveGame (true, true, file, description);
|
||||
G_DoSaveGame (true, true, file, description.GetChars());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2284,7 +2284,7 @@ static void PutSaveComment (FSerializer &arc)
|
|||
|
||||
FString comment = myasctime();
|
||||
|
||||
arc.AddString("Creation Time", comment);
|
||||
arc.AddString("Creation Time", comment.GetChars());
|
||||
|
||||
// Get level name
|
||||
comment.Format("%s - %s\n", primaryLevel->MapName.GetChars(), primaryLevel->LevelName.GetChars());
|
||||
|
|
@ -2295,7 +2295,7 @@ static void PutSaveComment (FSerializer &arc)
|
|||
comment.AppendFormat("%s: %02d:%02d:%02d", time, levelTime/3600, (levelTime%3600)/60, levelTime%60);
|
||||
|
||||
// Write out the comment
|
||||
arc.AddString("Comment", comment);
|
||||
arc.AddString("Comment", comment.GetChars());
|
||||
}
|
||||
|
||||
static void PutSavePic (FileWriter *file, int width, int height)
|
||||
|
|
@ -2373,7 +2373,7 @@ void G_DoSaveGame (bool okForQuicksave, bool forceQuicksave, FString filename, c
|
|||
// 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", description);
|
||||
M_AppendPNGText(&savepic, "Current Map", primaryLevel->MapName);
|
||||
M_AppendPNGText(&savepic, "Current Map", primaryLevel->MapName.GetChars());
|
||||
M_FinishPNG(&savepic);
|
||||
|
||||
int ver = SAVEVER;
|
||||
|
|
@ -2381,7 +2381,7 @@ void G_DoSaveGame (bool okForQuicksave, bool forceQuicksave, FString filename, c
|
|||
.AddString("Engine", GAMESIG)
|
||||
("Save Version", ver)
|
||||
.AddString("Title", description)
|
||||
.AddString("Current Map", primaryLevel->MapName);
|
||||
.AddString("Current Map", primaryLevel->MapName.GetChars());
|
||||
|
||||
|
||||
PutSaveWads (savegameinfo);
|
||||
|
|
@ -2411,7 +2411,7 @@ void G_DoSaveGame (bool okForQuicksave, bool forceQuicksave, FString filename, c
|
|||
}
|
||||
|
||||
auto picdata = savepic.GetBuffer();
|
||||
FCompressedBuffer bufpng = { picdata->Size(), picdata->Size(), METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->Size())), (char*)&(*picdata)[0] };
|
||||
FCompressedBuffer bufpng = { picdata->Size(), picdata->Size(), FileSys::METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->Size())), (char*)&(*picdata)[0] };
|
||||
|
||||
savegame_content.Push(bufpng);
|
||||
savegame_filenames.Push("savepic.png");
|
||||
|
|
@ -2419,16 +2419,17 @@ void G_DoSaveGame (bool okForQuicksave, bool forceQuicksave, FString filename, c
|
|||
savegame_filenames.Push("info.json");
|
||||
savegame_content.Push(savegameglobals.GetCompressedOutput());
|
||||
savegame_filenames.Push("globals.json");
|
||||
|
||||
G_WriteSnapshots (savegame_filenames, savegame_content);
|
||||
|
||||
for (unsigned i = 0; i < savegame_content.Size(); i++)
|
||||
savegame_content[i].filename = savegame_filenames[i].GetChars();
|
||||
|
||||
bool succeeded = false;
|
||||
|
||||
if (WriteZip(filename, savegame_filenames, savegame_content))
|
||||
if (WriteZip(filename.GetChars(), savegame_content.Data(), savegame_content.Size()))
|
||||
{
|
||||
// Check whether the file is ok by trying to open it.
|
||||
FResourceFile *test = FResourceFile::OpenResourceFile(filename, true);
|
||||
FResourceFile *test = FResourceFile::OpenResourceFile(filename.GetChars(), true);
|
||||
if (test != nullptr)
|
||||
{
|
||||
delete test;
|
||||
|
|
@ -2597,7 +2598,7 @@ void G_BeginRecording (const char *startmap)
|
|||
|
||||
if (startmap == NULL)
|
||||
{
|
||||
startmap = primaryLevel->MapName;
|
||||
startmap = primaryLevel->MapName.GetChars();
|
||||
}
|
||||
demo_p = demobuffer;
|
||||
|
||||
|
|
@ -2863,7 +2864,7 @@ void G_DoPlayDemo (void)
|
|||
gameaction = ga_nothing;
|
||||
|
||||
// [RH] Allow for demos not loaded as lumps
|
||||
demolump = fileSystem.CheckNumForFullName (defdemoname, true);
|
||||
demolump = fileSystem.CheckNumForFullName (defdemoname.GetChars(), true);
|
||||
if (demolump >= 0)
|
||||
{
|
||||
int demolen = fileSystem.FileLength (demolump);
|
||||
|
|
@ -2875,7 +2876,7 @@ void G_DoPlayDemo (void)
|
|||
FixPathSeperator (defdemoname);
|
||||
DefaultExtension (defdemoname, ".lmp");
|
||||
FileReader fr;
|
||||
if (!fr.OpenFile(defdemoname))
|
||||
if (!fr.OpenFile(defdemoname.GetChars()))
|
||||
{
|
||||
I_Error("Unable to open demo '%s'", defdemoname.GetChars());
|
||||
}
|
||||
|
|
@ -2922,7 +2923,7 @@ void G_DoPlayDemo (void)
|
|||
demonew = true;
|
||||
if (mapname.Len() != 0)
|
||||
{
|
||||
G_InitNew (mapname, false);
|
||||
G_InitNew (mapname.GetChars(), false);
|
||||
}
|
||||
else if (primaryLevel->sectors.Size() == 0)
|
||||
{
|
||||
|
|
@ -3050,14 +3051,14 @@ bool G_CheckDemoStatus (void)
|
|||
formlen = demobuffer + 4;
|
||||
WriteLong (int(demo_p - demobuffer - 8), &formlen);
|
||||
|
||||
auto fw = FileWriter::Open(demoname);
|
||||
auto fw = FileWriter::Open(demoname.GetChars());
|
||||
bool saved = false;
|
||||
if (fw != nullptr)
|
||||
{
|
||||
const size_t size = demo_p - demobuffer;
|
||||
saved = fw->Write(demobuffer, size) == size;
|
||||
delete fw;
|
||||
if (!saved) remove(demoname);
|
||||
if (!saved) remove(demoname.GetChars());
|
||||
}
|
||||
M_Free (demobuffer);
|
||||
demorecording = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue