diff options
author | Strangerke | 2019-11-01 22:55:23 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 |
commit | 2eec117a5cf9f33cd14f581f01d1c615d837b9df (patch) | |
tree | 95e4d5461f187c9e7626926e383e0b8ec8cd882f | |
parent | 3112d2e7d96d5294875bdd2c72e6a563a634db50 (diff) | |
download | scummvm-rg350-2eec117a5cf9f33cd14f581f01d1c615d837b9df.tar.gz scummvm-rg350-2eec117a5cf9f33cd14f581f01d1c615d837b9df.tar.bz2 scummvm-rg350-2eec117a5cf9f33cd14f581f01d1c615d837b9df.zip |
GRIFFON: Get rid of config.h/cpp
-rw-r--r-- | engines/griffon/config.cpp | 70 | ||||
-rw-r--r-- | engines/griffon/config.h | 56 | ||||
-rw-r--r-- | engines/griffon/dialogs.cpp | 2 | ||||
-rw-r--r-- | engines/griffon/griffon.cpp | 25 | ||||
-rw-r--r-- | engines/griffon/griffon.h | 11 | ||||
-rw-r--r-- | engines/griffon/module.mk | 1 |
6 files changed, 35 insertions, 130 deletions
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp deleted file mode 100644 index 5b9b39644e..0000000000 --- a/engines/griffon/config.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * - * Originally written by Syn9 in FreeBASIC with SDL - * http://syn9.thehideoutgames.com/index_backup.php - * - * Ported to plain C for GCW-Zero handheld by Dmitry Smagin - * http://github.com/dmitrysmagin/griffon_legend - * - * - * Programming/Graphics: Daniel "Syn9" Kennedy - * Music/Sound effects: David Turner - * - * Beta testing and gameplay design help: - * Deleter, Cha0s, Aether Fox, and Kiz - * - */ - -#include "griffon/config.h" -#include "common/config-manager.h" - -namespace Griffon { - -CONFIG config; - -void loadConfig(CONFIG *config) { - bool mute = false; - config->music = config->effects = false; - - if (ConfMan.hasKey("mute")) - mute = ConfMan.getBool("mute"); - - if (!mute) { - config->music = !ConfMan.getBool("music_mute"); - config->effects = !ConfMan.getBool("sfx_mute"); - } - - config->musicVol = ConfMan.getInt("music_volume"); - config->effectsVol = ConfMan.getInt("sfx_volume"); -} - -void saveConfig(CONFIG *config) { - ConfMan.setBool("mute", !(config->music || config->effectsVol)); - ConfMan.setBool("music_mute", !config->music); - ConfMan.setBool("sfx_mute", !config->effects); - ConfMan.setInt("music_volume", config->musicVol); - ConfMan.setInt("sfx_volume", config->effectsVol); - - ConfMan.flushToDisk(); -} - -} // end of namespace Griffon diff --git a/engines/griffon/config.h b/engines/griffon/config.h deleted file mode 100644 index 0c46e62537..0000000000 --- a/engines/griffon/config.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * - * Originally written by Syn9 in FreeBASIC with SDL - * http://syn9.thehideoutgames.com/index_backup.php - * - * Ported to plain C for GCW-Zero handheld by Dmitry Smagin - * http://github.com/dmitrysmagin/griffon_legend - * - * - * Programming/Graphics: Daniel "Syn9" Kennedy - * Music/Sound effects: David Turner - * - * Beta testing and gameplay design help: - * Deleter, Cha0s, Aether Fox, and Kiz - * - */ - -#ifndef GRIFFON_CONFIG_H -#define GRIFFON_CONFIG_H - -namespace Griffon { - -struct CONFIG { - bool music; - int musicVol; - bool effects; - int effectsVol; -}; - -extern CONFIG config; - -void loadConfig(CONFIG *config); -void saveConfig(CONFIG *config); - -} // end of namespace Griffon - -#endif diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp index fbcabc7ed9..da42494eae 100644 --- a/engines/griffon/dialogs.cpp +++ b/engines/griffon/dialogs.cpp @@ -446,7 +446,7 @@ void GriffonEngine::configMenu() { config.effects = false; break; case 13: - saveConfig(&config); + saveConfig(); // no break on purpose case 14: exitMenu = true; diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp index 653c899cb7..b5460f836b 100644 --- a/engines/griffon/griffon.cpp +++ b/engines/griffon/griffon.cpp @@ -65,7 +65,6 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) { // Synchronize the sound settings from ScummVM syncSoundSettings(); - loadConfig(&config); } GriffonEngine::~GriffonEngine() { @@ -74,6 +73,30 @@ GriffonEngine::~GriffonEngine() { void GriffonEngine::syncSoundSettings() { Engine::syncSoundSettings(); + + bool mute = false; + config.music = config.effects = false; + + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + + if (!mute) { + config.music = !ConfMan.getBool("music_mute"); + config.effects = !ConfMan.getBool("sfx_mute"); + } + + config.musicVol = ConfMan.getInt("music_volume"); + config.effectsVol = ConfMan.getInt("sfx_volume"); +} + +void GriffonEngine::saveConfig() { + ConfMan.setBool("mute", !(config.music || config.effectsVol)); + ConfMan.setBool("music_mute", !config.music); + ConfMan.setBool("sfx_mute", !config.effects); + ConfMan.setInt("music_volume", config.musicVol); + ConfMan.setInt("sfx_volume", config.effectsVol); + + ConfMan.flushToDisk(); } Common::Error GriffonEngine::run() { diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h index dc6867b189..cfdbd62a24 100644 --- a/engines/griffon/griffon.h +++ b/engines/griffon/griffon.h @@ -302,6 +302,13 @@ struct AttackOffsetStruct { bool completed; }; +struct CONFIG { + bool music; + int musicVol; + bool effects; + int effectsVol; +}; + class GriffonEngine : public Engine { public: GriffonEngine(OSystem *syst); @@ -520,11 +527,13 @@ private: bool _saidLocked; bool _saidJammed; - // ysort int _ysort[2401], _lasty, _firsty; bool _pmenu; + + CONFIG config; + void saveConfig(); }; } diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk index 857fcd7667..0c6edeb0ae 100644 --- a/engines/griffon/module.mk +++ b/engines/griffon/module.mk @@ -2,7 +2,6 @@ MODULE := engines/griffon MODULE_OBJS := \ combat.o \ - config.o \ console.o \ cutscenes.o \ detection.o \ |