mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Mapster32: factor out some code (3x) into GetSaveBoardFilename().
git-svn-id: https://svn.eduke32.com/eduke32@3046 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
13599f56b8
commit
9d0bffebde
3 changed files with 11 additions and 36 deletions
|
@ -178,6 +178,7 @@ extern const char *ExtGetSectorType(int32_t lotag);
|
||||||
|
|
||||||
extern int32_t LoadBoard(const char *filename, uint32_t flags);
|
extern int32_t LoadBoard(const char *filename, uint32_t flags);
|
||||||
extern const char *SaveBoard(const char *fn, uint32_t flags);
|
extern const char *SaveBoard(const char *fn, uint32_t flags);
|
||||||
|
extern const char *GetSaveBoardFilename(const char *fn);
|
||||||
|
|
||||||
#define CORRUPT_SECTOR (1<<17)
|
#define CORRUPT_SECTOR (1<<17)
|
||||||
#define CORRUPT_WALL (1<<18)
|
#define CORRUPT_WALL (1<<18)
|
||||||
|
|
|
@ -157,7 +157,6 @@ int32_t g_doScreenShot;
|
||||||
static int32_t backup_highlighted_map(mapinfofull_t *mapinfo);
|
static int32_t backup_highlighted_map(mapinfofull_t *mapinfo);
|
||||||
static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal);
|
static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal);
|
||||||
static void SaveBoardAndPrintMessage(const char *fn);
|
static void SaveBoardAndPrintMessage(const char *fn);
|
||||||
static const char *GetSaveBoardFilename(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static char scantoasc[128] =
|
static char scantoasc[128] =
|
||||||
|
@ -7298,7 +7297,7 @@ CANCEL:
|
||||||
#else
|
#else
|
||||||
_printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (Q)uit");
|
_printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (Q)uit");
|
||||||
#endif
|
#endif
|
||||||
printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(), 0);
|
printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(NULL), 0);
|
||||||
|
|
||||||
showframe(1);
|
showframe(1);
|
||||||
bflushchars();
|
bflushchars();
|
||||||
|
@ -7703,10 +7702,13 @@ static void SaveBoardAndPrintMessage(const char *fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the file name of the file that would be written if SaveBoard(NULL, 0) was called
|
// get the file name of the file that would be written if SaveBoard(fn, 0) was called
|
||||||
static const char *GetSaveBoardFilename(void)
|
const char *GetSaveBoardFilename(const char *fn)
|
||||||
{
|
{
|
||||||
const char *fn = boardfilename, *f;
|
const char *f;
|
||||||
|
|
||||||
|
if (!fn)
|
||||||
|
fn = boardfilename;
|
||||||
|
|
||||||
if (pathsearchmode)
|
if (pathsearchmode)
|
||||||
f = fn;
|
f = fn;
|
||||||
|
@ -7727,27 +7729,11 @@ static const char *GetSaveBoardFilename(void)
|
||||||
// flags: 1:no ExtSaveMap (backup.map) and no taglabels saving
|
// flags: 1:no ExtSaveMap (backup.map) and no taglabels saving
|
||||||
const char *SaveBoard(const char *fn, uint32_t flags)
|
const char *SaveBoard(const char *fn, uint32_t flags)
|
||||||
{
|
{
|
||||||
const char *f;
|
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
|
const char *f = GetSaveBoardFilename(fn);
|
||||||
|
|
||||||
saveboard_savedtags = 0;
|
saveboard_savedtags = 0;
|
||||||
|
|
||||||
if (!fn)
|
|
||||||
fn = boardfilename;
|
|
||||||
|
|
||||||
if (pathsearchmode)
|
|
||||||
f = fn;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// virtual filesystem mode can't save to directories so drop the file into
|
|
||||||
// the current directory
|
|
||||||
f = Bstrrchr(fn, '/');
|
|
||||||
if (!f)
|
|
||||||
f = fn;
|
|
||||||
else
|
|
||||||
f++;
|
|
||||||
}
|
|
||||||
|
|
||||||
saveboard_fixedsprites = ExtPreSaveMap();
|
saveboard_fixedsprites = ExtPreSaveMap();
|
||||||
ret = saveboard(f, &startpos, startang, startsectnum);
|
ret = saveboard(f, &startpos, startang, startsectnum);
|
||||||
if ((flags&1)==0)
|
if ((flags&1)==0)
|
||||||
|
@ -7756,10 +7742,7 @@ const char *SaveBoard(const char *fn, uint32_t flags)
|
||||||
saveboard_savedtags = !taglab_save(f);
|
saveboard_savedtags = !taglab_save(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
return (ret==0) ? f : NULL;
|
||||||
return f;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// flags: 1: for running on Mapster32 init
|
// flags: 1: for running on Mapster32 init
|
||||||
|
|
|
@ -11097,16 +11097,7 @@ static void Keys2d3d(void)
|
||||||
if (totalclock < (lastsave + 120*10) || !AskIfSure("Are you sure you want to load the last saved map?"))
|
if (totalclock < (lastsave + 120*10) || !AskIfSure("Are you sure you want to load the last saved map?"))
|
||||||
{
|
{
|
||||||
int32_t sposx=pos.x,sposy=pos.y,sposz=pos.z,sang=ang;
|
int32_t sposx=pos.x,sposy=pos.y,sposz=pos.z,sang=ang;
|
||||||
char *f;
|
const char *f = GetSaveBoardFilename(levelname);
|
||||||
|
|
||||||
if (pathsearchmode) f = levelname;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// virtual filesystem mode can't save to directories so drop the file into
|
|
||||||
// the current directory
|
|
||||||
f = Bstrrchr(levelname, '/');
|
|
||||||
if (!f) f = levelname; else f++;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastsave=totalclock;
|
lastsave=totalclock;
|
||||||
// sectorhighlightstat = -1;
|
// sectorhighlightstat = -1;
|
||||||
|
|
Loading…
Reference in a new issue