MOHAWK: Fix Myst opcode 14

svn-id: r54616
This commit is contained in:
Bastien Bouclet 2010-11-29 20:55:31 +00:00
parent 92d74fa56d
commit 34981c61b6
7 changed files with 32 additions and 37 deletions

View file

@ -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) {

View file

@ -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; }

View file

@ -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.

View file

@ -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();

View file

@ -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) {

View file

@ -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]);
}
}
}

View file

@ -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();