aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/console.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2018-05-27 20:39:26 +0200
committerBastien Bouclet2018-06-13 07:55:55 +0200
commit13b3371f1af143a319656bf476712abf41ee613b (patch)
treeae4c51e877e2627358c12a6431931c56bd905d1c /engines/mohawk/console.cpp
parente3972150482531fdeea16609680fa6db1209c6ac (diff)
downloadscummvm-rg350-13b3371f1af143a319656bf476712abf41ee613b.tar.gz
scummvm-rg350-13b3371f1af143a319656bf476712abf41ee613b.tar.bz2
scummvm-rg350-13b3371f1af143a319656bf476712abf41ee613b.zip
MOHAWK: MYST: Extract a Card class out of the main engine class
This is to allow having multiple cards loaded at the same time in the future.
Diffstat (limited to 'engines/mohawk/console.cpp')
-rw-r--r--engines/mohawk/console.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index f24df96b55..2251ce097f 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -36,6 +36,7 @@
#ifdef ENABLE_MYST
#include "mohawk/myst.h"
#include "mohawk/myst_areas.h"
+#include "mohawk/myst_card.h"
#include "mohawk/myst_graphics.h"
#include "mohawk/myst_scripts.h"
#include "mohawk/myst_sound.h"
@@ -88,7 +89,7 @@ bool MystConsole::Cmd_ChangeCard(int argc, const char **argv) {
}
bool MystConsole::Cmd_CurCard(int argc, const char **argv) {
- debugPrintf("Current Card: %d\n", _vm->getCurCard());
+ debugPrintf("Current Card: %d\n", _vm->getCard()->getId());
return true;
}
@@ -210,8 +211,8 @@ bool MystConsole::Cmd_DrawRect(int argc, const char **argv) {
_vm->_gfx->drawRect(Common::Rect((uint16)atoi(argv[1]), (uint16)atoi(argv[2]), (uint16)atoi(argv[3]), (uint16)atoi(argv[4])), kRectEnabled);
} else if (argc == 2) {
uint16 resourceId = (uint16)atoi(argv[1]);
- if (resourceId < _vm->_resources.size())
- _vm->_resources[resourceId]->drawBoundingRect();
+ if (resourceId < _vm->getCard()->_resources.size())
+ _vm->getCard()->_resources[resourceId]->drawBoundingRect();
}
return false;
@@ -223,7 +224,7 @@ bool MystConsole::Cmd_SetResourceEnable(int argc, const char **argv) {
return true;
}
- _vm->setResourceEnabled((uint16)atoi(argv[1]), atoi(argv[2]) == 1);
+ _vm->getCard()->setResourceEnabled((uint16)atoi(argv[1]), atoi(argv[2]) == 1);
return true;
}
@@ -316,10 +317,10 @@ bool MystConsole::Cmd_Cache(int argc, const char **argv) {
}
bool MystConsole::Cmd_Resources(int argc, const char **argv) {
- debugPrintf("Resources in card %d:\n", _vm->getCurCard());
+ debugPrintf("Resources in card %d:\n", _vm->getCard()->getId());
- for (uint i = 0; i < _vm->_resources.size(); i++) {
- debugPrintf("#%2d %s\n", i, _vm->_resources[i]->describe().c_str());
+ for (uint i = 0; i < _vm->getCard()->_resources.size(); i++) {
+ debugPrintf("#%2d %s\n", i, _vm->getCard()->_resources[i]->describe().c_str());
}
return true;
@@ -343,10 +344,13 @@ bool MystConsole::Cmd_QuickTest(int argc, const char **argv) {
_vm->doFrame();
- int16 resIndex = _vm->_rnd->getRandomNumber(_vm->_resources.size()) - 1;
- if (resIndex >= 0 && _vm->_resources[resIndex]->isEnabled()) {
- _vm->_resources[resIndex]->handleMouseDown();
- _vm->_resources[resIndex]->handleMouseUp();
+ {
+ MystCardPtr card = _vm->getCardPtr();
+ int16 resIndex = _vm->_rnd->getRandomNumber(card->_resources.size()) - 1;
+ if (resIndex >= 0 && _vm->getCard()->_resources[resIndex]->isEnabled()) {
+ card->_resources[resIndex]->handleMouseDown();
+ card->_resources[resIndex]->handleMouseUp();
+ }
}
_vm->doFrame();