aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/myst_areas.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2018-05-28 20:22:29 +0200
committerBastien Bouclet2018-06-13 07:55:55 +0200
commit47ddd9c2144c236e2b3bc0dd0f8349ae8657efb7 (patch)
treed8cdf846dab9e4c4f62e3f19baa57db2b90e14fe /engines/mohawk/myst_areas.cpp
parentea60aef8a8018ac75ea9a5b507f4140eafe2d660 (diff)
downloadscummvm-rg350-47ddd9c2144c236e2b3bc0dd0f8349ae8657efb7.tar.gz
scummvm-rg350-47ddd9c2144c236e2b3bc0dd0f8349ae8657efb7.tar.bz2
scummvm-rg350-47ddd9c2144c236e2b3bc0dd0f8349ae8657efb7.zip
MOHAWK: MYST: Move the current stack id to ScriptParser
Diffstat (limited to 'engines/mohawk/myst_areas.cpp')
-rw-r--r--engines/mohawk/myst_areas.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 5fc6cbeed6..d03c78a497 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -94,8 +94,8 @@ void MystArea::handleMouseUp() {
break;
}
- _vm->_scriptParser->setInvokingResource(this);
- _vm->_scriptParser->runOpcode(opcode, 0);
+ _vm->_stack->setInvokingResource(this);
+ _vm->_stack->runOpcode(opcode, 0);
}
bool MystArea::canBecomeActive() {
@@ -104,7 +104,7 @@ bool MystArea::canBecomeActive() {
bool MystArea::unreachableZipDest() {
return (_flags & kMystZipModeEnableFlag)
- && !_vm->_gameState->isReachableZipDest(_vm->getCurStack() , _dest);
+ && !_vm->_gameState->isReachableZipDest(_vm->_stack->getStackId() , _dest);
}
bool MystArea::isEnabled() {
@@ -143,14 +143,14 @@ MystAreaAction::MystAreaAction(MohawkEngine_Myst *vm, ResourceType type, Common:
MystArea(vm, type, rlstStream, parent) {
debugC(kDebugResource, "\tResource Type 5 Script:");
- _script = vm->_scriptParser->readScript(rlstStream, kMystScriptNormal);
+ _script = vm->_stack->readScript(rlstStream, kMystScriptNormal);
}
void MystAreaAction::handleMouseUp() {
// Keep a reference to the stack so it is not freed if a script switches to another stack
- MystScriptParserPtr parser = _vm->_scriptParser;
+ MystScriptParserPtr stack = _vm->_stack;
- parser->runScript(_script, this);
+ stack->runScript(_script, this);
}
const Common::String MystAreaAction::describe() {
@@ -160,7 +160,7 @@ const Common::String MystAreaAction::describe() {
desc += " ops:";
for (uint i = 0; i < _script.size(); i++)
- desc += " " + _vm->_scriptParser->getOpcodeDesc(_script[i].opcode);
+ desc += " " + _vm->_stack->getOpcodeDesc(_script[i].opcode);
}
return desc;
@@ -320,7 +320,7 @@ void MystAreaActionSwitch::doSwitch(AreaHandler handler) {
else if (_subResources.size() != 0)
warning("Action switch resource with _numSubResources of %d, but no control variable", _subResources.size());
} else {
- uint16 varValue = _vm->_scriptParser->getVar(_actionSwitchVar);
+ uint16 varValue = _vm->_stack->getVar(_actionSwitchVar);
if (_subResources.size() == 1 && varValue != 0)
(_subResources[0]->*handler)();
@@ -404,7 +404,7 @@ void MystAreaImageSwitch::drawDataToScreen() {
} else if (_subImages.size() != 0)
warning("Image Switch resource with _numSubImages of %d, but no control variable", _subImages.size());
} else {
- uint16 varValue = _vm->_scriptParser->getVar(_imageSwitchVar);
+ uint16 varValue = _vm->_stack->getVar(_imageSwitchVar);
if (_subImages.size() == 1 && varValue != 0) {
subImageId = 0;
@@ -586,7 +586,7 @@ void MystAreaSlider::handleMouseUp() {
value = _pos.x;
}
- _vm->_scriptParser->setVarValue(_imageSwitchVar, value);
+ _vm->_stack->setVarValue(_imageSwitchVar, value);
MystAreaDrag::handleMouseUp();
}
@@ -714,32 +714,32 @@ void MystAreaDrag::handleMouseDown() {
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
setPositionClipping(mouse, _pos);
- _vm->_scriptParser->setInvokingResource(this);
- _vm->_scriptParser->runOpcode(_mouseDownOpcode, _imageSwitchVar);
+ _vm->_stack->setInvokingResource(this);
+ _vm->_stack->runOpcode(_mouseDownOpcode, _imageSwitchVar);
}
void MystAreaDrag::handleMouseUp() {
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
setPositionClipping(mouse, _pos);
- _vm->_scriptParser->setInvokingResource(this);
- _vm->_scriptParser->runOpcode(_mouseUpOpcode, _imageSwitchVar);
+ _vm->_stack->setInvokingResource(this);
+ _vm->_stack->runOpcode(_mouseUpOpcode, _imageSwitchVar);
}
void MystAreaDrag::handleMouseDrag() {
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
setPositionClipping(mouse, _pos);
- _vm->_scriptParser->setInvokingResource(this);
- _vm->_scriptParser->runOpcode(_mouseDragOpcode, _imageSwitchVar);
+ _vm->_stack->setInvokingResource(this);
+ _vm->_stack->runOpcode(_mouseDragOpcode, _imageSwitchVar);
}
const Common::String MystAreaDrag::describe() {
return Common::String::format("%s down: %s drag: %s up: %s",
MystAreaImageSwitch::describe().c_str(),
- _vm->_scriptParser->getOpcodeDesc(_mouseDownOpcode).c_str(),
- _vm->_scriptParser->getOpcodeDesc(_mouseDragOpcode).c_str(),
- _vm->_scriptParser->getOpcodeDesc(_mouseUpOpcode).c_str());
+ _vm->_stack->getOpcodeDesc(_mouseDownOpcode).c_str(),
+ _vm->_stack->getOpcodeDesc(_mouseDragOpcode).c_str(),
+ _vm->_stack->getOpcodeDesc(_mouseUpOpcode).c_str());
}
void MystAreaDrag::setPositionClipping(const Common::Point &mouse, Common::Point &dest) {
@@ -836,13 +836,13 @@ MystAreaHover::MystAreaHover(MohawkEngine_Myst *vm, ResourceType type, Common::S
void MystAreaHover::handleMouseEnter() {
// Pass along the enter opcode to the script parser
// The variable to use is stored in the dest field
- _vm->_scriptParser->runOpcode(_enterOpcode, _dest);
+ _vm->_stack->runOpcode(_enterOpcode, _dest);
}
void MystAreaHover::handleMouseLeave() {
// Pass along the leave opcode (with no parameters) to the script parser
// The variable to use is stored in the dest field
- _vm->_scriptParser->runOpcode(_leaveOpcode, _dest);
+ _vm->_stack->runOpcode(_leaveOpcode, _dest);
}
void MystAreaHover::handleMouseUp() {
@@ -854,8 +854,8 @@ void MystAreaHover::handleMouseUp() {
const Common::String MystAreaHover::describe() {
return Common::String::format("%s enter: %s leave: %s",
MystArea::describe().c_str(),
- _vm->_scriptParser->getOpcodeDesc(_enterOpcode).c_str(),
- _vm->_scriptParser->getOpcodeDesc(_leaveOpcode).c_str());
+ _vm->_stack->getOpcodeDesc(_enterOpcode).c_str(),
+ _vm->_stack->getOpcodeDesc(_leaveOpcode).c_str());
}
} // End of namespace Mohawk