aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMarisa-Chan2013-10-25 20:42:14 +0000
committerMarisa-Chan2013-10-25 20:42:14 +0000
commit6d5e8cb10569eec6b42e41197227ed1652e57900 (patch)
treec3a2d67fbc3c6b149f7e1a8a1b15493277216358 /engines
parentc0a709dc23c689b094c2dab1038447267d6fb8bd (diff)
downloadscummvm-rg350-6d5e8cb10569eec6b42e41197227ed1652e57900.tar.gz
scummvm-rg350-6d5e8cb10569eec6b42e41197227ed1652e57900.tar.bz2
scummvm-rg350-6d5e8cb10569eec6b42e41197227ed1652e57900.zip
ZVISION: Replace disable/enable control functions by call to
getStateFlag.
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/animation_control.cpp4
-rw-r--r--engines/zvision/control.cpp18
-rw-r--r--engines/zvision/control.h7
-rw-r--r--engines/zvision/lever_control.cpp12
-rw-r--r--engines/zvision/push_toggle_control.cpp6
5 files changed, 8 insertions, 39 deletions
diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp
index 66eefd7ce6..3f9a2e9cc7 100644
--- a/engines/zvision/animation_control.cpp
+++ b/engines/zvision/animation_control.cpp
@@ -71,9 +71,6 @@ AnimationControl::~AnimationControl() {
}
bool AnimationControl::process(uint32 deltaTimeInMillis) {
- if (!_enabled) {
- return false;
- }
bool finished = false;
@@ -253,7 +250,6 @@ bool AnimationControl::process(uint32 deltaTimeInMillis) {
// Then disable the control. DON'T delete it. It can be re-used
if (finished) {
_engine->getScriptManager()->setStateValue(_animationKey, 2);
- disable();
_currentLoop = 0;
}
diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp
index bcbdabc143..0346228681 100644
--- a/engines/zvision/control.cpp
+++ b/engines/zvision/control.cpp
@@ -33,24 +33,6 @@
namespace ZVision {
-void Control::enable() {
- if (!_enabled) {
- _enabled = true;
- return;
- }
-
- debug("Control %u is already enabled", _key);
-}
-
-void Control::disable() {
- if (_enabled) {
- _enabled = false;
- return;
- }
-
- debug("Control %u is already disabled", _key);
-}
-
void Control::parseFlatControl(ZVision *engine) {
engine->getRenderManager()->getRenderTable()->setRenderState(RenderTable::FLAT);
}
diff --git a/engines/zvision/control.h b/engines/zvision/control.h
index ab55763a20..66fdbfee19 100644
--- a/engines/zvision/control.h
+++ b/engines/zvision/control.h
@@ -38,16 +38,14 @@ class ZVision;
class Control {
public:
- Control() : _engine(0), _key(0), _enabled(false) {}
- Control(ZVision *engine, uint32 key) : _engine(engine), _key(key), _enabled(false) {}
+ Control() : _engine(0), _key(0) {}
+ Control(ZVision *engine, uint32 key) : _engine(engine), _key(key) {}
virtual ~Control() {}
uint32 getKey() {
return _key;
}
- virtual void enable();
- virtual void disable();
virtual void focus() {}
virtual void unfocus() {}
/**
@@ -131,7 +129,6 @@ public:
protected:
ZVision *_engine;
uint32 _key;
- bool _enabled;
// Static member functions
public:
diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp
index b0f9417042..bd2c186ffe 100644
--- a/engines/zvision/lever_control.cpp
+++ b/engines/zvision/lever_control.cpp
@@ -191,9 +191,8 @@ void LeverControl::parseLevFile(const Common::String &fileName) {
}
void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
- if (!_enabled) {
+ if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return;
- }
if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) {
_mouseIsCaptured = true;
@@ -202,9 +201,8 @@ void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common
}
void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
- if (!_enabled) {
+ if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return;
- }
if (_mouseIsCaptured) {
_mouseIsCaptured = false;
@@ -217,9 +215,8 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common::
}
bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
- if (!_enabled) {
+ if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return false;
- }
bool cursorWasChanged = false;
@@ -248,9 +245,8 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common
}
bool LeverControl::process(uint32 deltaTimeInMillis) {
- if (!_enabled) {
+ if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return false;
- }
if (_isReturning) {
_accumulatedTime += deltaTimeInMillis;
diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp
index 21a1c41548..2cea5db2d2 100644
--- a/engines/zvision/push_toggle_control.cpp
+++ b/engines/zvision/push_toggle_control.cpp
@@ -73,9 +73,8 @@ PushToggleControl::~PushToggleControl() {
}
void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
- if (!_enabled) {
+ if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return;
- }
if (_hotspot.contains(backgroundImageSpacePos)) {
_engine->getScriptManager()->setStateValue(_key, 1);
@@ -83,9 +82,8 @@ void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Com
}
bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
- if (!_enabled) {
+ if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return false;
- }
if (_hotspot.contains(backgroundImageSpacePos)) {
_engine->getCursorManager()->changeCursor(_hoverCursor);