Use the WAD name as base for the save file name

This commit is contained in:
Lephenixnoir 2021-09-19 16:18:20 +02:00
parent 03d6d06e8c
commit 3205bc21bd
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
4 changed files with 12 additions and 3 deletions

View File

@ -385,6 +385,7 @@ int CGD_EnableDemos = 0;
int CGD_SingleEpisodeUltimate = 0;
int CGD_2MBLineMemory = 0;
int CGD_Frameskip = 1;
const char *CGD_WADFileName = NULL;
/* Performance counters */
struct CGD_Perf CGD_Perf;
@ -694,6 +695,12 @@ int main(void)
if(CGD_2MBLineMemory)
CGD_2MBLineMemory = FindZeroedMemory((void *)0xac200000);
/* Remember WAD file name for saves and loads */
static char wad_name[32] = { 0 };
for (int i = 0; wads[choice].name[i] != '.'; i++)
wad_name[i] = wads[choice].name[i];
CGD_WADFileName = wad_name;
/* Setup access to WAD file */
#ifdef CG_EMULATOR
gWADmethod = CGDOOM_WAD_BFILE;

View File

@ -32,6 +32,8 @@ extern int CGD_EnableDemos;
extern int CGD_SingleEpisodeUltimate;
/* Skip this amount of frames after every rendered frame (default 1) */
extern int CGD_Frameskip;
/* WAD file name (without .wad), used to avoid save file conflicts */
extern const char *CGD_WADFileName;
// Global variables interfacing with Doom itself.

View File

@ -1007,7 +1007,7 @@ void G_DoSaveGame (void)
int length;
int i;
sprintf(name, SAVEGAMENAME "%d.dsg", savegameslot);
sprintf(name, "%s_%d.dsg", CGD_WADFileName, savegameslot);
description = savedescription;
save_p = savebuffer = screens[0];

View File

@ -467,7 +467,7 @@ void M_ReadSaveStrings(void)
for (i = 0;i < load_end;i++)
{
sprintf(name, SAVEGAMENAME "%d.dsg", i);
sprintf(name, "%s_%d.dsg", CGD_WADFileName, i);
memcpy(fc_path, u"\\\\fls0\\", 14);
for (j = 0; name[j]; j++)
fc_path[j+7] = name[j];
@ -538,7 +538,7 @@ void M_DrawSaveLoadBorder(int x,int y,int height,int count)
void M_LoadSelect(int choice)
{
char name[64];
sprintf(name, SAVEGAMENAME "%d.dsg", choice);
sprintf(name, "%s_%d.dsg", CGD_WADFileName, choice);
G_LoadGame (name);
M_ClearMenus ();
}