mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Display number of savegames to be deleted before removing, automatically remove old savegames from the install dir in EDUKE32_STANDALONE builds. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@6754 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8b80937424
commit
ae0b6e87be
4 changed files with 39 additions and 6 deletions
|
@ -6195,6 +6195,10 @@ int app_main(int argc, char const * const * argv)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EDUKE32_STANDALONE
|
||||
G_DeleteOldSaves();
|
||||
#endif
|
||||
|
||||
G_ExtPreInit(argc, argv);
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
|
|
@ -175,7 +175,7 @@ static void Menu_DrawCursorText(int32_t x, int32_t y, int32_t h, int32_t ydim_up
|
|||
}
|
||||
|
||||
extern int32_t g_quitDeadline;
|
||||
|
||||
static size_t g_oldSaveCnt;
|
||||
|
||||
|
||||
|
||||
|
@ -335,7 +335,11 @@ static MenuLink_t MEO_MAIN_NEWGAME_NETWORK = { MENU_NETWORK, MA_Advance, };
|
|||
MAKE_MENU_TOP_ENTRYLINK( s_SaveGame, MEF_MainMenu, MAIN_SAVEGAME, MENU_SAVE );
|
||||
MAKE_MENU_TOP_ENTRYLINK( s_LoadGame, MEF_MainMenu, MAIN_LOADGAME, MENU_LOAD );
|
||||
MAKE_MENU_TOP_ENTRYLINK( s_Options, MEF_MainMenu, MAIN_OPTIONS, MENU_OPTIONS );
|
||||
MAKE_MENU_TOP_ENTRYLINK( "Help", MEF_MainMenu, MAIN_HELP, MENU_STORY );
|
||||
#ifdef EDUKE32_STANDALONE
|
||||
MAKE_MENU_TOP_ENTRYLINK( "Read me!", MEF_MainMenu, MAIN_HELP, MENU_STORY );
|
||||
#else
|
||||
MAKE_MENU_TOP_ENTRYLINK("Help", MEF_MainMenu, MAIN_HELP, MENU_STORY);
|
||||
#endif
|
||||
#ifndef EDUKE32_SIMPLE_MENU
|
||||
MAKE_MENU_TOP_ENTRYLINK( s_Credits, MEF_MainMenu, MAIN_CREDITS, MENU_CREDITS );
|
||||
#endif
|
||||
|
@ -2357,11 +2361,19 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
|
|||
|
||||
case MENU_SAVECLEANVERIFY:
|
||||
fade_screen_black(1);
|
||||
mgametextcenter(origin.x, origin.y + (90<<16), "Delete obsolete saves?"
|
||||
|
||||
if (g_oldSaveCnt)
|
||||
{
|
||||
Bsprintf(tempbuf, "Delete %zu obsolete saves?\nThis action cannot be undone."
|
||||
#ifndef EDUKE32_ANDROID_MENU
|
||||
"\n(Y/N)"
|
||||
"\n(Y/N)"
|
||||
#endif
|
||||
);
|
||||
, g_oldSaveCnt);
|
||||
}
|
||||
else
|
||||
Bsprintf(tempbuf, "No obsolete saves found!");
|
||||
|
||||
mgametextcenter(origin.x, origin.y + (90<<16), tempbuf);
|
||||
break;
|
||||
|
||||
case MENU_LOADVERIFY:
|
||||
|
@ -2403,7 +2415,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
|
|||
{
|
||||
fade_screen_black(1);
|
||||
menusave_t & msv = cm == MENU_LOADDELVERIFY ? g_menusaves[M_LOAD.currentEntry] : g_menusaves[M_SAVE.currentEntry-1];
|
||||
Bsprintf(tempbuf, "Delete saved game:\n\"%s\""
|
||||
Bsprintf(tempbuf, "Delete saved game:\n\"%s\"?"
|
||||
#ifndef EDUKE32_ANDROID_MENU
|
||||
"\n(Y/N)"
|
||||
#endif
|
||||
|
@ -3057,6 +3069,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
|
|||
}
|
||||
else if (entry == &ME_SAVESETUP_CLEANUP)
|
||||
{
|
||||
g_oldSaveCnt = G_CountOldSaves();
|
||||
Menu_Change(MENU_SAVECLEANVERIFY);
|
||||
}
|
||||
else if (entry == &ME_COLCORR_RESET)
|
||||
|
|
|
@ -506,6 +506,21 @@ void G_DeleteOldSaves(void)
|
|||
}
|
||||
}
|
||||
|
||||
size_t G_CountOldSaves(void)
|
||||
{
|
||||
ReadSaveGameHeaders();
|
||||
|
||||
size_t bad = 0;
|
||||
for (size_t x = 0; x < g_numinternalsaves; ++x)
|
||||
{
|
||||
menusave_t const & msv = g_internalsaves[x];
|
||||
if (msv.isOldVer || msv.isUnreadable)
|
||||
++bad;
|
||||
}
|
||||
|
||||
return bad;
|
||||
}
|
||||
|
||||
int32_t G_SavePlayer(savebrief_t & sv, bool isAutoSave)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
|
|
|
@ -117,6 +117,7 @@ int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t
|
|||
void sv_freemem();
|
||||
void G_DeleteSave(savebrief_t const & sv);
|
||||
void G_DeleteOldSaves(void);
|
||||
size_t G_CountOldSaves(void);
|
||||
int32_t G_SavePlayer(savebrief_t & sv, bool isAutoSave);
|
||||
int32_t G_LoadPlayer(savebrief_t & sv);
|
||||
int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh);
|
||||
|
|
Loading…
Reference in a new issue