Merge pull request #1130 from chocolate-doom/defaultsavename
default save name is map name and containing WAD file name
This commit is contained in:
commit
7f7a72d67a
5 changed files with 33 additions and 2 deletions
|
|
@ -49,6 +49,7 @@
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "m_controls.h"
|
#include "m_controls.h"
|
||||||
#include "p_saveg.h"
|
#include "p_saveg.h"
|
||||||
|
#include "p_setup.h"
|
||||||
|
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
|
|
||||||
|
|
@ -634,8 +635,19 @@ void M_DoSave(int slot)
|
||||||
//
|
//
|
||||||
static void SetDefaultSaveName(int slot)
|
static void SetDefaultSaveName(int slot)
|
||||||
{
|
{
|
||||||
M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE - 1,
|
// map from IWAD or PWAD?
|
||||||
"JOYSTICK SLOT %i", itemOn + 1);
|
if (W_IsIWADLump(maplumpinfo))
|
||||||
|
{
|
||||||
|
M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
|
||||||
|
"%s", maplumpinfo->name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
|
||||||
|
"%s: %s", W_WadNameForLump(maplumpinfo),
|
||||||
|
maplumpinfo->name);
|
||||||
|
}
|
||||||
|
M_ForceUppercase(savegamestrings[itemOn]);
|
||||||
joypadSave = false;
|
joypadSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -760,6 +760,9 @@ static void P_LoadReject(int lumpnum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pointer to the current map lump info struct
|
||||||
|
lumpinfo_t *maplumpinfo;
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_SetupLevel
|
// P_SetupLevel
|
||||||
//
|
//
|
||||||
|
|
@ -816,6 +819,8 @@ P_SetupLevel
|
||||||
|
|
||||||
lumpnum = W_GetNumForName (lumpname);
|
lumpnum = W_GetNumForName (lumpname);
|
||||||
|
|
||||||
|
maplumpinfo = lumpinfo[lumpnum];
|
||||||
|
|
||||||
leveltime = 0;
|
leveltime = 0;
|
||||||
|
|
||||||
// note: most of this ordering is important
|
// note: most of this ordering is important
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@
|
||||||
#ifndef __P_SETUP__
|
#ifndef __P_SETUP__
|
||||||
#define __P_SETUP__
|
#define __P_SETUP__
|
||||||
|
|
||||||
|
#include "w_wad.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern lumpinfo_t *maplumpinfo;
|
||||||
|
|
||||||
// NOT called by W_Ticker. Fixme.
|
// NOT called by W_Ticker. Fixme.
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -618,3 +618,12 @@ void W_Reload(void)
|
||||||
W_GenerateHashTable();
|
W_GenerateHashTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *W_WadNameForLump(const lumpinfo_t *lump)
|
||||||
|
{
|
||||||
|
return M_BaseName(lump->wad_file->path);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean W_IsIWADLump(const lumpinfo_t *lump)
|
||||||
|
{
|
||||||
|
return lump->wad_file == lumpinfo[0]->wad_file;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,4 +72,7 @@ extern unsigned int W_LumpNameHash(const char *s);
|
||||||
void W_ReleaseLumpNum(lumpindex_t lump);
|
void W_ReleaseLumpNum(lumpindex_t lump);
|
||||||
void W_ReleaseLumpName(const char *name);
|
void W_ReleaseLumpName(const char *name);
|
||||||
|
|
||||||
|
const char *W_WadNameForLump(const lumpinfo_t *lump);
|
||||||
|
boolean W_IsIWADLump(const lumpinfo_t *lump);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue