Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions main/midnight/Source/panels/panel_dedication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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 ),
Expand Down
4 changes: 2 additions & 2 deletions main/midnight/Source/panels/panel_map_detailed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions main/midnight/Source/panels/panel_splashscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -183,7 +183,7 @@ void panel_splashscreen::complete()

this->scheduleOnce([&](float)
{
if ( !mr->config->skip_dedication ) {
if ( SETTINGS(bumpDedication()) ) {
mr->panels->setPanelMode(MODE_DEDICATION, TRANSITION_FADEIN );
} else {
mr->panels->showMainMenu();
Expand Down
4 changes: 2 additions & 2 deletions main/midnight/Source/system/moonring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions main/midnight/Source/system/panelmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 ) {
Expand Down
71 changes: 48 additions & 23 deletions main/midnight/Source/system/settingsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -158,6 +176,9 @@ bool settingsmanager::Save ( void )

// version 14
ar << FROM_ENUM(current_scenario);

// version 15
ar << dedication_screen_count;

ar.Close();

Expand Down Expand Up @@ -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();

Expand Down
8 changes: 7 additions & 1 deletion main/midnight/Source/system/settingsmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -135,6 +137,7 @@ class settingsmanager : public ringcontroller
bool Save ( void );
bool Load ( void );
bool bumpAdvert();
bool bumpDedication();

public:
// not stored
Expand Down Expand Up @@ -196,4 +199,7 @@ class settingsmanager : public ringcontroller

// version 14
CF_SCENARIO current_scenario;

// version 15
int dedication_screen_count;
};
8 changes: 4 additions & 4 deletions main/midnight/Source/system/storymanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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() ;
Expand Down Expand Up @@ -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();
Expand Down