diff --git a/config.cpp b/config.cpp index 8da0e9a7..39789751 100644 --- a/config.cpp +++ b/config.cpp @@ -1118,6 +1118,10 @@ EX void initConfig() { -> editable("YASC codes", 'Y') -> help("YASC codes: Sides-Entity-Restrict-Threat-Wall"); + param_b(display_semicasual, "semicasual", false) + -> editable("semicasual", 'S') + -> help("display save/load counts in exit screen"); + param_b(vid.relative_font, "relative_font", true) -> editable("set relative font size", 'r') -> help("Font size is set as a relation to screen size.") @@ -2519,6 +2523,7 @@ EX void configureInterface() { add_edit(less_in_portrait); add_edit(display_yasc_codes); + if(casual) add_edit(display_semicasual); add_edit(vid.orbmode); add_edit(zh_ascii); diff --git a/quit.cpp b/quit.cpp index 9a5db8f9..5ed3712f 100644 --- a/quit.cpp +++ b/quit.cpp @@ -34,9 +34,9 @@ EX string getgametime_s(int timespent IS(getgametime())) { return hr::format("%d:%02d", timespent/60, timespent % 60); } -EX bool display_yasc_codes; +EX bool display_yasc_codes, display_semicasual; -string formatted_yasc_code() { +EX string formatted_yasc_code() { if(yasc_code < 100000) return its(yasc_code); int y = yasc_code; string out; @@ -56,6 +56,10 @@ string timeline() { if(display_yasc_codes) s += XLAT(" YASC code: ") + formatted_yasc_code(); } + if(casual && loadcount >= 0 && display_semicasual) { + ld val = exp(load_branching/scores::BRANCH_SCALE); + s += XLAT(" saves: %1 loads: %2 branching: %3", its(savecount), its(loadcount), val < 1e6 ? format("%.0f", val) : format("%.4g", val)); + } return s; } diff --git a/system.cpp b/system.cpp index 5815cb6b..f63c9f80 100644 --- a/system.cpp +++ b/system.cpp @@ -63,6 +63,10 @@ EX int savecount; EX int save_turns; EX bool doCross = false; +EX int loadcount; +EX int current_loadcount; +EX int load_branching; + EX bool gamegen_failure; EX eLand top_land; @@ -392,6 +396,8 @@ EX void initgame() { sagephase = 0; hardcoreAt = 0; timerstopped = false; savecount = 0; savetime = 0; + loadcount = 0; current_loadcount = 0; load_branching = 0; + tortoise::last21tort = 0; cheater = 0; if(autocheat) cheater = 1; @@ -459,7 +465,7 @@ EX namespace scores { /** \brief the amount of boxes reserved for each hr::score item */ #define MAXBOX 500 /** \brief currently used boxes in hr::score */ -#define POSSCORE 418 +#define POSSCORE 421 /** \brief a struct to keep local score from an earlier game */ struct score { /** \brief version used */ @@ -973,6 +979,10 @@ EX void applyBoxes() { applyBoxNum(asteroids_generated); applyBoxNum(asteroid_orbs_generated); + applyBoxNum(loadcount, "load count"); + applyBoxNum(load_branching, "load branching"); + applyBoxNum(current_loadcount, "current load count"); + if(POSSCORE != boxid) printf("ERROR: %d boxes\n", boxid); if(isize(invorb)) { println(hlog, "ERROR: Orbs not taken into account"); exit(1); } } @@ -990,6 +1000,9 @@ void loadBox() { #if HDR constexpr int MODECODE_BOX = 387; +constexpr int CURRENT_LOADCOUNT_BOX = 420; +constexpr int LOADCOUNT_BOX = 418; +constexpr ld BRANCH_SCALE = 100000.0; #endif modecode_t fill_modecode() { @@ -1263,6 +1276,7 @@ EX void loadsave() { using namespace scores; for(int i=0; i= 0) { + loadcount += current_loadcount; + load_branching += BRANCH_SCALE * log(1 + current_loadcount); + current_loadcount = 0; + } } #endif @@ -1406,10 +1430,7 @@ EX void stop_game() { if(dual::split(stop_game)) return; DEBBI(DF_INIT, ("stop_game")); achievement_final(true); -#if CAP_SAVE - if(!casual) - saveStats(); -#endif + save_if_needed(); for(int i=0; iland), int(turncount - save_turns), formatted_yasc_code().c_str(), yasc_message.c_str()); + fclose(f); + } + } if(!casual) saveStats(); #endif + } + +EX void finishAll() { + achievement_final(!items[itOrbSafety]); + + save_if_needed(); clearMemory(); #if !ISMOBILE quit_all();