mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
A couple of tweaks against accidental overwriting of maps.
- first, fix a bug where git-svn-id: https://svn.eduke32.com/eduke32@2095 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3dd39c118d
commit
004b98e2b3
3 changed files with 37 additions and 6 deletions
|
@ -114,6 +114,7 @@ const char *mapster32_fullpath;
|
||||||
char *testplay_addparam = 0;
|
char *testplay_addparam = 0;
|
||||||
|
|
||||||
static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH];
|
static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH];
|
||||||
|
extern char levelname[BMAX_PATH]; // in astub.c XXX: clean up this mess!!!
|
||||||
|
|
||||||
static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL;
|
static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL;
|
||||||
static int32_t numdirs=0, numfiles=0;
|
static int32_t numdirs=0, numfiles=0;
|
||||||
|
@ -142,6 +143,7 @@ typedef struct
|
||||||
|
|
||||||
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);
|
static int32_t restore_highlighted_map(mapinfofull_t *mapinfo);
|
||||||
|
static const char *GetSaveBoardFilename(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static char scantoasc[128] =
|
static char scantoasc[128] =
|
||||||
|
@ -6656,6 +6658,8 @@ 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);
|
||||||
|
|
||||||
showframe(1);
|
showframe(1);
|
||||||
bflushchars();
|
bflushchars();
|
||||||
bad = 1;
|
bad = 1;
|
||||||
|
@ -6710,6 +6714,7 @@ CANCEL:
|
||||||
reset_default_mapstate();
|
reset_default_mapstate();
|
||||||
|
|
||||||
Bstrcpy(boardfilename,"newboard.map");
|
Bstrcpy(boardfilename,"newboard.map");
|
||||||
|
ExtLoadMap(boardfilename);
|
||||||
#if M32_UNDO
|
#if M32_UNDO
|
||||||
map_undoredo_free();
|
map_undoredo_free();
|
||||||
#endif
|
#endif
|
||||||
|
@ -7054,6 +7059,27 @@ static int32_t ask_above_or_below(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// get the file name of the file that would be written if SaveBoard(NULL, 0) was called
|
||||||
|
static const char *GetSaveBoardFilename(void)
|
||||||
|
{
|
||||||
|
const char *fn = boardfilename, *f;
|
||||||
|
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
// flags: 1:no ExSaveMap (backup.map) and no taglabels saving
|
// flags: 1:no ExSaveMap (backup.map) and no taglabels saving
|
||||||
const char *SaveBoard(const char *fn, uint32_t flags)
|
const char *SaveBoard(const char *fn, uint32_t flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@ static int32_t g_fillCurSector = 0;
|
||||||
|
|
||||||
static char g_modDir[BMAX_PATH];
|
static char g_modDir[BMAX_PATH];
|
||||||
char defsfilename[BMAX_PATH] = "duke3d.def";
|
char defsfilename[BMAX_PATH] = "duke3d.def";
|
||||||
|
char levelname[BMAX_PATH];
|
||||||
|
|
||||||
// static char *startwin_labeltext = "Starting Mapster32...";
|
// static char *startwin_labeltext = "Starting Mapster32...";
|
||||||
static char *setupfilename = "mapster32.cfg";
|
static char *setupfilename = "mapster32.cfg";
|
||||||
|
@ -805,7 +806,7 @@ static void MultiPskyInit(void)
|
||||||
void ExtLoadMap(const char *mapname)
|
void ExtLoadMap(const char *mapname)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
int32_t sky=-1;
|
int32_t sky=LA;
|
||||||
|
|
||||||
getmessageleng = 0;
|
getmessageleng = 0;
|
||||||
getmessagetimeoff = 0;
|
getmessagetimeoff = 0;
|
||||||
|
@ -7552,6 +7553,7 @@ static void Keys2d(void)
|
||||||
{
|
{
|
||||||
g_fillCurSector = !g_fillCurSector;
|
g_fillCurSector = !g_fillCurSector;
|
||||||
message("Fill currently pointed-at sector: %s", ONOFF(g_fillCurSector));
|
message("Fill currently pointed-at sector: %s", ONOFF(g_fillCurSector));
|
||||||
|
keystatus[KEYSC_TAB] = 0;
|
||||||
}
|
}
|
||||||
else if (eitherSHIFT)
|
else if (eitherSHIFT)
|
||||||
{
|
{
|
||||||
|
@ -11048,11 +11050,15 @@ static void Keys2d3d(void)
|
||||||
i = CheckMapCorruption(4, 0);
|
i = CheckMapCorruption(4, 0);
|
||||||
if (i<4)
|
if (i<4)
|
||||||
{
|
{
|
||||||
SaveBoard(levelname, 0);
|
Bsprintf(tempbuf, "Save to %s?", levelname);
|
||||||
|
if (!AskIfSure(tempbuf))
|
||||||
|
{
|
||||||
|
SaveBoard(levelname, 0);
|
||||||
|
|
||||||
message("Board saved");
|
message("Board saved to %s", levelname);
|
||||||
asksave = 0;
|
asksave = 0;
|
||||||
lastsave=totalclock;
|
lastsave=totalclock;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
message("Map is heavily corrupted, not saving. See OSD for details.");
|
message("Map is heavily corrupted, not saving. See OSD for details.");
|
||||||
|
|
|
@ -52,7 +52,6 @@ static char autospritehelp=0, autosecthelp=0;
|
||||||
static char tempbuf[1024];
|
static char tempbuf[1024];
|
||||||
static int32_t numsprite[MAXTILES], multisprite[MAXTILES];
|
static int32_t numsprite[MAXTILES], multisprite[MAXTILES];
|
||||||
static char lo[64];
|
static char lo[64];
|
||||||
static char levelname[BMAX_PATH];
|
|
||||||
static int16_t curwall=0, curwallnum=0;
|
static int16_t curwall=0, curwallnum=0;
|
||||||
static int16_t /*cursearchsprite=0,*/ cursearchspritenum=0, cursector_lotag=0, cursectornum=0;
|
static int16_t /*cursearchsprite=0,*/ cursearchspritenum=0, cursector_lotag=0, cursectornum=0;
|
||||||
static int16_t search_lotag=0,search_hitag=0;
|
static int16_t search_lotag=0,search_hitag=0;
|
||||||
|
|
Loading…
Reference in a new issue