aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/tinsel.cpp
diff options
context:
space:
mode:
authorMax Horn2009-11-02 21:56:29 +0000
committerMax Horn2009-11-02 21:56:29 +0000
commit5cf868b75711c69736d3b2eb6f1068bdc48349ae (patch)
tree1cc0ba610669f66f6b038dd5b668a496a50f09cc /engines/tinsel/tinsel.cpp
parent51933629d1f1a17839ddbb75b2b619effe117abb (diff)
downloadscummvm-rg350-5cf868b75711c69736d3b2eb6f1068bdc48349ae.tar.gz
scummvm-rg350-5cf868b75711c69736d3b2eb6f1068bdc48349ae.tar.bz2
scummvm-rg350-5cf868b75711c69736d3b2eb6f1068bdc48349ae.zip
TINSEL: Turn config code into a simple C++ class
svn-id: r45617
Diffstat (limited to 'engines/tinsel/tinsel.cpp')
-rw-r--r--engines/tinsel/tinsel.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 8b9a30d517..6a200b446d 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -152,12 +152,12 @@ void KeyboardProcess(CORO_PARAM, const void *) {
case Common::KEYCODE_LALT:
case Common::KEYCODE_RALT:
if (evt.type == Common::EVENT_KEYDOWN) {
- if (!bSwapButtons)
+ if (!_vm->_config->_swapButtons)
ProcessButEvent(PLR_DRAG2_START);
else
ProcessButEvent(PLR_DRAG1_START);
} else {
- if (!bSwapButtons)
+ if (!_vm->_config->_swapButtons)
ProcessButEvent(PLR_DRAG1_END);
else
ProcessButEvent(PLR_DRAG2_END);
@@ -273,7 +273,7 @@ static void SingleLeftProcess(CORO_PARAM, const void *) {
CORO_BEGIN_CODE(_ctx);
// Work out when to wait until
- _ctx->endTicks = DwGetCurrentTime() + (uint32)dclickSpeed;
+ _ctx->endTicks = DwGetCurrentTime() + (uint32)_vm->_config->_dclickSpeed;
// Timeout a double click (may not work once every 49 days!)
do {
@@ -323,7 +323,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
switch (type) {
case Common::EVENT_LBUTTONDOWN:
// left button press
- if (DwGetCurrentTime() - _ctx->lastLeftClick < (uint32)dclickSpeed) {
+ if (DwGetCurrentTime() - _ctx->lastLeftClick < (uint32)_vm->_config->_dclickSpeed) {
// Left button double-click
if (TinselV2) {
@@ -375,7 +375,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
g_scheduler->createProcess(PID_BTN_CLICK, SingleLeftProcess, NULL, 0);
}
} else
- _ctx->lastLeftClick -= dclickSpeed;
+ _ctx->lastLeftClick -= _vm->_config->_dclickSpeed;
if (TinselV2)
// Signal left drag end
@@ -388,7 +388,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
case Common::EVENT_RBUTTONDOWN:
// right button press
- if (DwGetCurrentTime() - _ctx->lastRightClick < (uint32)dclickSpeed) {
+ if (DwGetCurrentTime() - _ctx->lastRightClick < (uint32)_vm->_config->_dclickSpeed) {
// Right button double-click
if (TinselV2) {
PlayerEvent(PLR_NOEVENT, clickPos);
@@ -424,7 +424,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
if (_ctx->lastRWasDouble == false)
_ctx->lastRightClick = DwGetCurrentTime();
else
- _ctx->lastRightClick -= dclickSpeed;
+ _ctx->lastRightClick -= _vm->_config->_dclickSpeed;
if (TinselV2)
// Signal left drag end
@@ -820,6 +820,8 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc)
Engine(syst), _gameDescription(gameDesc) {
_vm = this;
+ _config = new Config(this);
+
// Register debug flags
Common::addDebugChannel(kTinselDebugAnimations, "animations", "Animations debugging");
Common::addDebugChannel(kTinselDebugActions, "actions", "Actions debugging");
@@ -894,6 +896,8 @@ TinselEngine::~TinselEngine() {
FreeGlobals();
delete _scheduler;
+ delete _config;
+
MemoryDeinit();
}
@@ -940,7 +944,7 @@ Common::Error TinselEngine::run() {
MemoryInit();
// load user configuration
- ReadConfig();
+ _vm->_config->readFromDisk();
#if 1
// FIXME: The following is taken from RestartGame().
@@ -958,7 +962,7 @@ Common::Error TinselEngine::run() {
#endif
// Load in text strings
- ChangeLanguage(g_language);
+ ChangeLanguage(_vm->_config->_language);
// Init palette and object managers, scheduler, keyboard and mouse
RestartDrivers();
@@ -1030,7 +1034,7 @@ Common::Error TinselEngine::run() {
}
// Write configuration
- WriteConfig();
+ _vm->_config->writeToDisk();
return Common::kNoError;
}
@@ -1172,7 +1176,7 @@ void TinselEngine::RestartDrivers() {
}
// Set midi volume
- SetMidiVolume(volMusic);
+ SetMidiVolume(_vm->_config->_musicVolume);
}
/**