aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2010-11-29 20:55:31 +0000
committerBastien Bouclet2010-11-29 20:55:31 +0000
commit34981c61b6c97281c6a7e4895d6ebbfdf97e00a6 (patch)
treeab69f63eb996233151163a253ea32de9f676c136 /engines/mohawk
parent92d74fa56df2583ad01616c2afa394baf2ea5a9f (diff)
downloadscummvm-rg350-34981c61b6c97281c6a7e4895d6ebbfdf97e00a6.tar.gz
scummvm-rg350-34981c61b6c97281c6a7e4895d6ebbfdf97e00a6.tar.bz2
scummvm-rg350-34981c61b6c97281c6a7e4895d6ebbfdf97e00a6.zip
MOHAWK: Fix Myst opcode 14
svn-id: r54616
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst.cpp4
-rw-r--r--engines/mohawk/myst.h3
-rw-r--r--engines/mohawk/myst_areas.cpp8
-rw-r--r--engines/mohawk/myst_areas.h1
-rw-r--r--engines/mohawk/myst_scripts.cpp7
-rw-r--r--engines/mohawk/myst_scripts_selenitic.cpp26
-rw-r--r--engines/mohawk/myst_scripts_selenitic.h20
7 files changed, 32 insertions, 37 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 10cca563bf..2ebbb7be10 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -908,14 +908,14 @@ void MohawkEngine_Myst::drawResourceImages() {
_gfx->updateScreen();
}
-void MohawkEngine_Myst::redrawResource(MystResource *_resource) {
+void MohawkEngine_Myst::redrawResource(MystResourceType8 *_resource) {
_resource->drawConditionalDataToScreen(_scriptParser->getVar(_resource->getType8Var()));
}
void MohawkEngine_Myst::redrawArea(uint16 var) {
for (uint16 i = 0; i < _resources.size(); i++)
if (_resources[i]->type == 8 && _resources[i]->getType8Var() == var)
- redrawResource(_resources[i]);
+ redrawResource(static_cast<MystResourceType8 *>(_resources[i]));
}
MystResource *MohawkEngine_Myst::loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent) {
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 9010e5be72..dc578eecd7 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -44,6 +44,7 @@ class MystConsole;
class MystSaveLoad;
class MystOptionsDialog;
class MystResource;
+class MystResourceType8;
// Engine Debug Flags
enum {
@@ -196,7 +197,7 @@ public:
MystResource *loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent);
void setResourceEnabled(uint16 resourceId, bool enable);
void redrawArea(uint16 var);
- void redrawResource(MystResource *_resource);
+ void redrawResource(MystResourceType8 *_resource);
void setCacheState(bool state) { _cache.enabled = state; }
bool getCacheState(void) { return _cache.enabled; }
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 9ce5c9b296..3e938b3e78 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -98,13 +98,7 @@ MystResourceType5::MystResourceType5(MohawkEngine_Myst *vm, Common::SeekableRead
}
void MystResourceType5::handleMouseUp(Common::Point *mouse) {
-
- MystResource *invoking = this;
- while (invoking->_parent) {
- invoking = invoking->_parent;
- }
-
- _vm->_scriptParser->runScript(_script, invoking);
+ _vm->_scriptParser->runScript(_script, this);
}
// In Myst/Making of Myst, the paths are hardcoded ala Windows style without extension. Convert them.
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index e28b683eb6..f3b78427ca 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -41,7 +41,6 @@ public:
bool contains(Common::Point point) { return _rect.contains(point); }
virtual void drawDataToScreen() {}
- virtual void drawConditionalDataToScreen(uint16 state) {}
virtual void handleAnimation() {}
virtual Common::Rect getRect() { return _rect; }
bool isEnabled();
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index eafa097894..dc3e705d36 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -325,8 +325,6 @@ void MystScriptParser::opcode_4(uint16 op, uint16 var, uint16 argc, uint16 *argv
unknown(op, var, argc, argv);
}
-// TODO: Work out difference between Opcode 6, 7 & 8...
-
void MystScriptParser::o_6_changeCard(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
varUnusedCheck(op, var);
@@ -343,6 +341,8 @@ void MystScriptParser::o_6_changeCard(uint16 op, uint16 var, uint16 argc, uint16
unknown(op, var, argc, argv);
}
void MystScriptParser::opcode_9(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ // If movie has sound, pause background music
+
varUnusedCheck(op, var);
if (argc == 0 || argc == 1) {
@@ -373,7 +373,8 @@ void MystScriptParser::o_14_drawAreaState(uint16 op, uint16 var, uint16 argc, ui
debugC(kDebugScript, "Opcode %d: drawAreaState, state: %d", op, argv[0]);
debugC(kDebugScript, "\tVar: %d", var);
- _invokingResource->drawConditionalDataToScreen(argv[0]);
+ MystResourceType8 *parent = static_cast<MystResourceType8 *>(_invokingResource->_parent);
+ parent->drawConditionalDataToScreen(argv[0]);
}
void MystScriptParser::o_15_redrawAreaForVar(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
diff --git a/engines/mohawk/myst_scripts_selenitic.cpp b/engines/mohawk/myst_scripts_selenitic.cpp
index 04b34fe79c..3d0f83f6fe 100644
--- a/engines/mohawk/myst_scripts_selenitic.cpp
+++ b/engines/mohawk/myst_scripts_selenitic.cpp
@@ -922,19 +922,19 @@ void MystScriptParser_Selenitic::o_203_soundReceiver_init(uint16 op, uint16 var,
g_opcode203Parameters.enabled = true;
uint16 *selenitic_vars = _vm->_saveLoad->_v->selenitic_vars;
- _sound_receiver_right_button = _vm->_resources[0];
- _sound_receiver_left_button = _vm->_resources[1];
- _sound_receiver_sigma_button = _vm->_resources[2];
- _sound_receiver_sources[4] = _vm->_resources[3];
- _sound_receiver_sources[3] = _vm->_resources[4];
- _sound_receiver_sources[2] = _vm->_resources[5];
- _sound_receiver_sources[1] = _vm->_resources[6];
- _sound_receiver_sources[0] = _vm->_resources[7];
+ _sound_receiver_right_button = static_cast<MystResourceType8 *>(_vm->_resources[0]);
+ _sound_receiver_left_button = static_cast<MystResourceType8 *>(_vm->_resources[1]);
+ _sound_receiver_sigma_button = static_cast<MystResourceType8 *>(_vm->_resources[2]);
+ _sound_receiver_sources[4] = static_cast<MystResourceType8 *>(_vm->_resources[3]);
+ _sound_receiver_sources[3] = static_cast<MystResourceType8 *>(_vm->_resources[4]);
+ _sound_receiver_sources[2] = static_cast<MystResourceType8 *>(_vm->_resources[5]);
+ _sound_receiver_sources[1] = static_cast<MystResourceType8 *>(_vm->_resources[6]);
+ _sound_receiver_sources[0] = static_cast<MystResourceType8 *>(_vm->_resources[7]);
_sound_receiver_viewer = static_cast<MystResourceType8 *>(_vm->_resources[8]);
- _sound_receiver_angle_1 = _vm->_resources[10];
- _sound_receiver_angle_2 = _vm->_resources[11];
- _sound_receiver_angle_3 = _vm->_resources[12];
- _sound_receiver_angle_4 = _vm->_resources[13];
+ _sound_receiver_angle_1 = static_cast<MystResourceType8 *>(_vm->_resources[10]);
+ _sound_receiver_angle_2 = static_cast<MystResourceType8 *>(_vm->_resources[11]);
+ _sound_receiver_angle_3 = static_cast<MystResourceType8 *>(_vm->_resources[12]);
+ _sound_receiver_angle_4 = static_cast<MystResourceType8 *>(_vm->_resources[13]);
uint16 current_source = selenitic_vars[7];
_sound_receiver_position = &selenitic_vars[8 + current_source];
@@ -974,7 +974,7 @@ void MystScriptParser_Selenitic::o_204_soundLock_init(uint16 op, uint16 var, uin
}
} else if (_vm->_resources[i]->type == 8) {
if (_vm->_resources[i]->getType8Var() == 28) {
- _sound_lock_button = _vm->_resources[i];
+ _sound_lock_button = static_cast<MystResourceType8 *>(_vm->_resources[i]);
}
}
}
diff --git a/engines/mohawk/myst_scripts_selenitic.h b/engines/mohawk/myst_scripts_selenitic.h
index 33eb2977b6..05c0233d45 100644
--- a/engines/mohawk/myst_scripts_selenitic.h
+++ b/engines/mohawk/myst_scripts_selenitic.h
@@ -78,20 +78,20 @@ private:
DECLARE_OPCODE(opcode_206);
bool _sound_receiver_sigma_pressed; // 6
- MystResource *_sound_receiver_sources[5]; // 92 -> 108
- MystResource *_sound_receiver_current_source; // 112
+ MystResourceType8 *_sound_receiver_sources[5]; // 92 -> 108
+ MystResourceType8 *_sound_receiver_current_source; // 112
uint16 *_sound_receiver_position; // 116
uint16 _sound_receiver_direction; // 120
uint16 _sound_receiver_speed; // 122
uint32 _sound_receiver_start_time; //124
MystResourceType8 *_sound_receiver_viewer; // 128
- MystResource *_sound_receiver_right_button; // 132
- MystResource *_sound_receiver_left_button; // 136
- MystResource *_sound_receiver_angle_1; // 140
- MystResource *_sound_receiver_angle_2; // 144
- MystResource *_sound_receiver_angle_3; // 148
- MystResource *_sound_receiver_angle_4; // 152
- MystResource *_sound_receiver_sigma_button; // 156
+ MystResourceType8 *_sound_receiver_right_button; // 132
+ MystResourceType8 *_sound_receiver_left_button; // 136
+ MystResourceType8 *_sound_receiver_angle_1; // 140
+ MystResourceType8 *_sound_receiver_angle_2; // 144
+ MystResourceType8 *_sound_receiver_angle_3; // 148
+ MystResourceType8 *_sound_receiver_angle_4; // 152
+ MystResourceType8 *_sound_receiver_sigma_button; // 156
bool _maze_runner_door_opened; //160
@@ -101,7 +101,7 @@ private:
MystResourceType10 *_sound_lock_slider_3; // 172
MystResourceType10 *_sound_lock_slider_4; // 176
MystResourceType10 *_sound_lock_slider_5; // 180
- MystResource *_sound_lock_button; // 184
+ MystResourceType8 *_sound_lock_button; // 184
void sound_receiver_left_right(uint direction);
void sound_receiver_update();