diff options
author | Nipun Garg | 2019-07-10 20:18:20 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:16 +0200 |
commit | 9d9a1b6c0f1dfd16cf7a9f6d3d94d45ecf10cf98 (patch) | |
tree | def33bca9637d3ea33fe2df389627cffb72d9aef | |
parent | a8b4749c7eb8ab9471fecc7ab0e7aa20470c1e30 (diff) | |
download | scummvm-rg350-9d9a1b6c0f1dfd16cf7a9f6d3d94d45ecf10cf98.tar.gz scummvm-rg350-9d9a1b6c0f1dfd16cf7a9f6d3d94d45ecf10cf98.tar.bz2 scummvm-rg350-9d9a1b6c0f1dfd16cf7a9f6d3d94d45ecf10cf98.zip |
HDB: Add readConfig(), writeConfig() and Cheating
-rw-r--r-- | engines/hdb/hdb.cpp | 4 | ||||
-rw-r--r-- | engines/hdb/hdb.h | 10 | ||||
-rw-r--r-- | engines/hdb/menu.cpp | 85 | ||||
-rw-r--r-- | engines/hdb/menu.h | 26 |
4 files changed, 124 insertions, 1 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index fa54390965..51a8a1d35c 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -56,6 +56,8 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst _window = new Window; _rnd = new Common::RandomSource("hdb"); + _cheating = false; + _currentMapname[0] = _currentLuaName[0] = 0; _lastMapname[0] = _lastLuaName[0] = 0; _inMapName[0] = 0; @@ -233,6 +235,8 @@ bool HDBGame::restartMap() { _ai->getPlayerXY(&x, &y); _map->centerMapXY(x + 16, y + 16); + warning("STUB: Cheating - Lua Validation"); + return true; } diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index f09b81de39..a690be2400 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -31,6 +31,7 @@ #include "common/str.h" #include "common/random.h" #include "common/savefile.h" +#include "common/config-manager.h" #include "graphics/surface.h" #include "graphics/thumbnail.h" @@ -235,6 +236,13 @@ public: void setStarsMonkeystone14(int32 value) { _monkeystone14 = value; } void setStarsMonkeystone21(int32 value) { _monkeystone21 = value; } + void setCheatingOn() { + _cheating = true; + } + bool getCheatingOn() { + return _cheating; + } + bool _gameShutdown; Graphics::PixelFormat _format; @@ -254,6 +262,7 @@ private: GameState _gameState; int _actionMode; // 0 or 1 int _pauseFlag; + bool _cheating; char _currentMapname[64]; char _lastMapname[64]; @@ -275,7 +284,6 @@ private: int slot; } _saveInfo, _loadInfo; - }; extern HDBGame *g_hdb; diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp index 995950d35a..a19e9b33da 100644 --- a/engines/hdb/menu.cpp +++ b/engines/hdb/menu.cpp @@ -66,6 +66,91 @@ bool Menu::init() { return true; } +void Menu::readConfig() { + warning("STUB: readConfig: Music Config not implemented"); + + if (ConfMan.hasKey(CONFIG_MSTONE7)) { + g_hdb->setStarsMonkeystone7(ConfMan.getInt(CONFIG_MSTONE7)); + } else { + ConfMan.setInt(CONFIG_MSTONE7, STARS_MONKEYSTONE_7_FAKE); + } + + if (ConfMan.hasKey(CONFIG_MSTONE14)) { + g_hdb->setStarsMonkeystone14(ConfMan.getInt(CONFIG_MSTONE14)); + } else { + ConfMan.setInt(CONFIG_MSTONE14, STARS_MONKEYSTONE_14_FAKE); + } + + if (ConfMan.hasKey(CONFIG_MSTONE21)) { + g_hdb->setStarsMonkeystone21(ConfMan.getInt(CONFIG_MSTONE21)); + } else { + ConfMan.setInt(CONFIG_MSTONE21, STARS_MONKEYSTONE_21_FAKE); + } + + if (ConfMan.hasKey(CONFIG_KEY_UP)) { + _keyAssignUp = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_UP); + g_hdb->_input->assignKey(0, _keyAssignUp); + } else { + ConfMan.setInt(CONFIG_KEY_UP, _keyAssignUp); + } + + if (ConfMan.hasKey(CONFIG_KEY_DOWN)) { + _keyAssignDown = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_DOWN); + g_hdb->_input->assignKey(1, _keyAssignDown); + } else { + ConfMan.setInt(CONFIG_KEY_DOWN, _keyAssignDown); + } + + if (ConfMan.hasKey(CONFIG_KEY_LEFT)) { + _keyAssignLeft = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_LEFT); + g_hdb->_input->assignKey(2, _keyAssignLeft); + } else { + ConfMan.setInt(CONFIG_KEY_LEFT, _keyAssignLeft); + } + + if (ConfMan.hasKey(CONFIG_KEY_RIGHT)) { + _keyAssignRight = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_RIGHT); + g_hdb->_input->assignKey(3, _keyAssignRight); + } else { + ConfMan.setInt(CONFIG_KEY_RIGHT, _keyAssignRight); + } + + if (ConfMan.hasKey(CONFIG_KEY_USE)) { + _keyAssignUse = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_USE); + g_hdb->_input->assignKey(4, _keyAssignUse); + } else { + ConfMan.setInt(CONFIG_KEY_USE, _keyAssignUse); + } + + if (ConfMan.hasKey(CONFIG_CHEAT)) { + g_hdb->setCheatingOn(); + } + + ConfMan.flushToDisk(); +} + +void Menu::writeConfig() { + warning("STUB: writeConfig: Music Config not implemented"); + + int value; + + value = g_hdb->getStarsMonkeystone7(); + ConfMan.setInt(CONFIG_MSTONE7, value); + value = g_hdb->getStarsMonkeystone14(); + ConfMan.setInt(CONFIG_MSTONE14, value); + value = g_hdb->getStarsMonkeystone21(); + ConfMan.setInt(CONFIG_MSTONE21, value); + + ConfMan.setInt(CONFIG_KEY_UP, _keyAssignUp); + ConfMan.setInt(CONFIG_KEY_DOWN, _keyAssignDown); + ConfMan.setInt(CONFIG_KEY_LEFT, _keyAssignLeft); + ConfMan.setInt(CONFIG_KEY_RIGHT, _keyAssignRight); + ConfMan.setInt(CONFIG_KEY_USE, _keyAssignUse); + + if (g_hdb->getCheatingOn()) + ConfMan.set(CONFIG_CHEAT, "1"); +} + void Menu::startMenu() { debug(9, "STUB: Start Menu"); } diff --git a/engines/hdb/menu.h b/engines/hdb/menu.h index 4adfa2c9df..7dcf9fcb80 100644 --- a/engines/hdb/menu.h +++ b/engines/hdb/menu.h @@ -32,7 +32,30 @@ namespace HDB { #define STARS_MONKEYSTONE_21 0x77ace3 // <same> for the Monkeystone #21 #define STARS_MONKEYSTONE_21_FAKE 0x3548fe // fake value that means it hasn't been unlocked +#define CONFIG_MUSICVOL "music_volume" +#define CONFIG_SOUNDVOL "sound_volume" +#define CONFIG_MSTONE7 "hdb_memory_heap" +#define CONFIG_MSTONE14 "lua_stack_offset" +#define CONFIG_MSTONE21 "fmod_mix_timer" +#define CONFIG_SOUNDCACHE "sound_cache_max" +#define CONFIG_GFXCACHE "gfx_cache_max" +#define CONFIG_CHEAT "hypercheat" + +#define CONFIG_KEY_UP "keyup" +#define CONFIG_KEY_DOWN "keydown" +#define CONFIG_KEY_LEFT "keyleft" +#define CONFIG_KEY_RIGHT "keyright" +#define CONFIG_KEY_USE "keyuse" +#define CONFIG_VOICES "voices" + enum { + kStarRedX = 70, + kStarRedY = 20, + kStarGreenX = 70, + kStarGreenY = 100, + kStarBlueX = 70, + kStarBlueY = 180, + kMenuX = 48 * 8, kMenuY = 80, @@ -129,6 +152,9 @@ public: bool init(); + void readConfig(); + void writeConfig(); + void startMenu(); void changeToMenu(); // Changing from Intro to Menu void drawMenu(); |