diff --git a/main/midnight/Source/panels/panel_dedication.cpp b/main/midnight/Source/panels/panel_dedication.cpp index 584b037f..816e5b8d 100644 --- a/main/midnight/Source/panels/panel_dedication.cpp +++ b/main/midnight/Source/panels/panel_dedication.cpp @@ -27,8 +27,8 @@ bool panel_dedication::init() // Background White setBackground(_clrWhite); - auto alpha = is(CONFIG(screentransitions)) ? alpha_zero : alpha_normal ; - f32 delay = is(CONFIG(screentransitions)) ? 1.0f : 3.0f ; + auto alpha = is(SETTINGS(screentransitions)) ? alpha_zero : alpha_normal ; + f32 delay = is(SETTINGS(screentransitions)) ? 1.0f : 3.0f ; // Dedication Image image = Sprite::create("misc/in-memory-of.png"); @@ -45,7 +45,7 @@ bool panel_dedication::init() void panel_dedication::startDedication() { - if ( is(CONFIG(screentransitions)) ) + if ( is(SETTINGS(screentransitions)) ) { image->runAction(Sequence::create( FadeIn::create( 3.0f ), diff --git a/main/midnight/Source/panels/panel_map_detailed.cpp b/main/midnight/Source/panels/panel_map_detailed.cpp index f4737e02..40c98ae7 100644 --- a/main/midnight/Source/panels/panel_map_detailed.cpp +++ b/main/midnight/Source/panels/panel_map_detailed.cpp @@ -120,7 +120,7 @@ bool panel_map_detailed::init() mapBuilder->screensize = size(ceil(getContentSize().width/RES(64)), ceil(getContentSize().height/RES(64))); - if ( mr->config->debug_map ) { + if ( CONFIG(debug_map) ) { mapBuilder->setFlags(mapflags::debug_map); mapBuilder->setFlags(mapflags::show_all_characters); mapBuilder->setFlags(mapflags::show_all_critters); @@ -351,7 +351,7 @@ void panel_map_detailed::addTouchListener() toolTip->setOpacity(ALPHA(alpha_zero)); auto tip = StringExtensions::toUpper(TME_GetLocationText(grid)); - if (mr->config->debug_map) { + if (CONFIG(debug_map)) { tip += StringUtils::format(" - (%d,%d)", grid.x, grid.y); } toolTip->setString(tip); diff --git a/main/midnight/Source/panels/panel_splashscreen.cpp b/main/midnight/Source/panels/panel_splashscreen.cpp index 86e57989..9b6f114e 100644 --- a/main/midnight/Source/panels/panel_splashscreen.cpp +++ b/main/midnight/Source/panels/panel_splashscreen.cpp @@ -174,7 +174,7 @@ void panel_splashscreen::complete() // we want at least 3 seconds of splash screen f32 delay = MAX(0,(f32)(MAX_SPLASHSCREEN_TIME-Duration) / 1000.0f); - if ( is(CONFIG(screentransitions)) ) { + if ( is(SETTINGS(screentransitions)) ) { loadingProgress->runAction( FadeOut::create(1.0) ); }else{ loadingProgress->setVisible(false); @@ -183,7 +183,8 @@ void panel_splashscreen::complete() this->scheduleOnce([&](float) { - if ( !mr->config->skip_dedication ) { + bool shouldShowDedication = SETTINGS(bumpDedication()); + if (shouldShowDedication) { mr->panels->setPanelMode(MODE_DEDICATION, TRANSITION_FADEIN ); } else { mr->panels->showMainMenu(); diff --git a/main/midnight/Source/system/moonring.h b/main/midnight/Source/system/moonring.h index e08b157b..8f78dd61 100644 --- a/main/midnight/Source/system/moonring.h +++ b/main/midnight/Source/system/moonring.h @@ -176,8 +176,8 @@ class moonring }; -#define CONFIG(x) (mr->settings->x) - +#define SETTINGS(x) (mr->settings->x) +#define CONFIG(x) (mr->config->x) #define COMPLAIN moonring::complain diff --git a/main/midnight/Source/system/panelmanager.cpp b/main/midnight/Source/system/panelmanager.cpp index ac49d110..d206c6d3 100644 --- a/main/midnight/Source/system/panelmanager.cpp +++ b/main/midnight/Source/system/panelmanager.cpp @@ -55,7 +55,7 @@ void panelmanager::setPanelMode ( panelmode_t mode, bool history ) void panelmanager::setPanelMode ( panelmode_t mode, transition_t transition, bool history ) { if ( mode == MODE_MAINMENU && currentmode != MODE_ADVERT) { - if ( CONFIG(bumpAdvert()) ) + if ( SETTINGS(bumpAdvert()) ) mode = MODE_ADVERT; } @@ -117,7 +117,7 @@ void panelmanager::returnToPrevious() void panelmanager::returnToPrevious( transition_t transition ) { - if ( isNot(CONFIG(screentransitions)) ) + if ( isNot(SETTINGS(screentransitions)) ) transition=TRANSITION_NONE; CustomDirector *director = (CustomDirector *)Director::getInstance(); @@ -171,7 +171,7 @@ void panelmanager::setCurrentPanel( uipanel* incomming, transition_t transition { //ui->hideKeyboardShortcuts(FALSE); - if ( isNot(CONFIG(screentransitions)) ) + if ( isNot(SETTINGS(screentransitions)) ) transition=TRANSITION_NONE; outgoing_panel = currentPanel(); @@ -235,7 +235,7 @@ void panelmanager::setCurrentPanel( uipanel* incomming, transition_t transition void panelmanager::pushCurrentPanel( uipanel* incomming, transition_t transition ) { - if ( isNot(CONFIG(screentransitions)) ) + if ( isNot(SETTINGS(screentransitions)) ) transition=TRANSITION_NONE; outgoing_panel = currentPanel(); @@ -309,7 +309,7 @@ void panelmanager::pushCurrentPanel( uipanel* incomming, transition_t transition void panelmanager::showMainMenu() { #if defined(_DEBUG_GAME_PANEL_) - if(!mr->config->start_on_panel.IsEmpty()) + if(!CONFIG(start_on_panel).IsEmpty()) { storyid_t story = mr->getCurrentStory(); if ( story != STORY_NONE ) { diff --git a/main/midnight/Source/system/settingsmanager.cpp b/main/midnight/Source/system/settingsmanager.cpp index ccaed3a6..45847fa2 100644 --- a/main/midnight/Source/system/settingsmanager.cpp +++ b/main/midnight/Source/system/settingsmanager.cpp @@ -13,33 +13,34 @@ using namespace chilli::lib ; settingsmanager::settingsmanager() : - tutorial(TOGGLE::ON) + approach_mode(CF_APPROACH::SWAP) + , autoapproach(TOGGLE::OFF) , autofight(TOGGLE::OFF) , autounhide(TOGGLE::OFF) - , nav_mode(CF_NAVIGATION::BOTH) - , screentransitions(TOGGLE::ON) - , flipscreen(TOGGLE::OFF) - , compass_delay(CF_COMPASS::NORMAL) - , think_paging_mode(CF_THINK_PAGING::SWIPE) - , night_confirm(TOGGLE::ON) - , night_display_fast(TOGGLE::OFF) - , night_battle_full(TOGGLE::ON) - , screen_mode(CF_SCREEN::FULL) - , keyboard_mode(CF_KEYBOARD::CLASSIC) - , fullscreensupported(true) - , cursor_size(CF_CURSOR::MEDIUM) - , game_difficulty(DF_NORMAL) - , movement_type(CF_MOVEMENT::ORIGINAL) #if defined(_LOM_) , autoseek(TOGGLE::OFF) #else , autoseek(TOGGLE::ON) #endif - , autoapproach(TOGGLE::OFF) - , approach_mode(CF_APPROACH::SWAP) - , firsttime(true) - , fey_recruit_mode(CF_FEY_RECRUIT::ON) + , compass_delay(CF_COMPASS::NORMAL) , current_scenario(CF_SCENARIO::DEFAULT) + , cursor_size(CF_CURSOR::MEDIUM) + , dedication_screen_count(0) + , screentransitions(TOGGLE::ON) + , fey_recruit_mode(CF_FEY_RECRUIT::ON) + , firsttime(true) + , flipscreen(TOGGLE::OFF) + , fullscreensupported(true) + , game_difficulty(DF_NORMAL) + , keyboard_mode(CF_KEYBOARD::CLASSIC) + , movement_type(CF_MOVEMENT::ORIGINAL) + , nav_mode(CF_NAVIGATION::BOTH) + , night_battle_full(TOGGLE::ON) + , night_confirm(TOGGLE::ON) + , night_display_fast(TOGGLE::OFF) + , screen_mode(CF_SCREEN::FULL) + , think_paging_mode(CF_THINK_PAGING::SWIPE) + , tutorial(TOGGLE::ON) { #if defined(_OS_DESKTOP_) @@ -74,19 +75,36 @@ settingsmanager::~settingsmanager() bool settingsmanager::bumpAdvert() { - bool showAdvert = false; + bool show = false; - if ( mr->config->skip_adverts ) { + if ( CONFIG(skip_adverts) ) { return false; } - showAdvert = advert_screen_count%ADVERT_FREQUENCY==(ADVERT_FREQUENCY-1); + show = advert_screen_count%ADVERT_FREQUENCY==(ADVERT_FREQUENCY-1); advert_screen_count++; Save(); - return showAdvert; + return show; +} + +bool settingsmanager::bumpDedication() +{ + bool show = false; + + if ( CONFIG(skip_dedication) ) { + return false; + } + + show = dedication_screen_count%DEDICATION_FREQUENCY==0; + + dedication_screen_count++; + + Save(); + + return show; } bool settingsmanager::Save ( void ) @@ -158,6 +176,9 @@ bool settingsmanager::Save ( void ) // version 14 ar << FROM_ENUM(current_scenario); + + // version 15 + ar << dedication_screen_count; ar.Close(); @@ -253,6 +274,10 @@ bool settingsmanager::Load ( void ) if ( version >= 14 ) { ar >> TO_ENUM(current_scenario, CF_SCENARIO); } + + if ( version >= 15 ) { + ar >> dedication_screen_count; + } ar.Close(); diff --git a/main/midnight/Source/system/settingsmanager.h b/main/midnight/Source/system/settingsmanager.h index 2d039376..3c04f664 100644 --- a/main/midnight/Source/system/settingsmanager.h +++ b/main/midnight/Source/system/settingsmanager.h @@ -17,15 +17,17 @@ #define FRONTEND_SAVE_GAME_VERSION 20 #define CONFIG_FILENAME "settings.cfg" -#define CONFIG_VERSION 14 +#define CONFIG_VERSION 15 #ifndef MX_DEBUG #define _SHOW_SPLASH_ #define _SHOW_DEDICATION_ #define ADVERT_FREQUENCY 16 + #define DEDICATION_FREQUENCY 8 #else #define _SHOW_SPLASH_ #define ADVERT_FREQUENCY 16 + #define DEDICATION_FREQUENCY 8 #define _USE_DEBUG_MENU_ #define _SHOW_GAME_VERSION_ //#define _DEBUG_LANDSCAPE_ @@ -135,6 +137,7 @@ class settingsmanager : public ringcontroller bool Save ( void ); bool Load ( void ); bool bumpAdvert(); + bool bumpDedication(); public: // not stored @@ -196,4 +199,7 @@ class settingsmanager : public ringcontroller // version 14 CF_SCENARIO current_scenario; + + // version 15 + int dedication_screen_count; }; diff --git a/main/midnight/Source/system/storymanager.cpp b/main/midnight/Source/system/storymanager.cpp index c1d3d507..1ae08f0b 100644 --- a/main/midnight/Source/system/storymanager.cpp +++ b/main/midnight/Source/system/storymanager.cpp @@ -224,7 +224,7 @@ bool storymanager::load ( storyid_t id ) bool storymanager::canUndo ( savemode_t mode ) { - if (undo_available == 0 && !mr->config->always_undo) { + if (undo_available == 0 && !CONFIG(always_undo)) { return false; } @@ -308,7 +308,7 @@ bool storymanager::undo ( savemode_t mode ) bool storymanager::cleanup ( void ) { - if ( mr->config->keep_full_save_history ) + if ( CONFIG(keep_full_save_history) ) return true; s32 undo_history = getUndoCount() ; @@ -397,8 +397,8 @@ u32 storymanager::getUndoCount() static UNDOHISTORY undo_history_mapping[] = { UH_NORMAL, UH_EASY, UH_MEDIUM, UH_HARD }; // config override - if(mr->config->undo_history != UH_NOTSET) { - return mr->config->undo_history; + if(CONFIG(undo_history) != UH_NOTSET) { + return CONFIG(undo_history); } auto difficulty = TME_GetDifficulty();