aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/action_node.cpp9
-rw-r--r--engines/zvision/action_node.h20
2 files changed, 18 insertions, 11 deletions
diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp
index 1a51690b3f..f51801a75d 100644
--- a/engines/zvision/action_node.cpp
+++ b/engines/zvision/action_node.cpp
@@ -28,14 +28,15 @@
namespace ZVision {
-NodeTimer::NodeTimer(uint32 key, uint timeInSeconds)
- : _key(key), _timeLeft(timeInSeconds * 1000) {}
+TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds)
+ : _engine(engine), _key(key), _timeLeft(timeInSeconds * 1000) {
+}
-bool NodeTimer::process(ZVision *engine, uint32 deltaTimeInMillis) {
+bool TimerNode::process(uint32 deltaTimeInMillis) {
_timeLeft -= deltaTimeInMillis;
if (_timeLeft <= 0) {
- engine->getScriptManager()->setStateValue(_key, 0);
+ _engine->getScriptManager()->setStateValue(_key, 0);
return true;
}
diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h
index 5b4430c3a4..9a5ca0be0b 100644
--- a/engines/zvision/action_node.h
+++ b/engines/zvision/action_node.h
@@ -32,23 +32,29 @@ class ZVision;
class ActionNode {
public:
virtual ~ActionNode() {}
- virtual bool process(ZVision *engine, uint32 deltaTimeInMillis) = 0;
+ /**
+ * Processes the node given the deltaTime since last frame
+ *
+ * @param deltaTimeInMillis The number of milliseconds that have passed since last frame
+ * @return If true, the node can be deleted after process() finishes
+ */
+ virtual bool process(uint32 deltaTimeInMillis) = 0;
};
-class NodeTimer : public ActionNode {
+class TimerNode : public ActionNode {
public:
- NodeTimer(uint32 key, uint timeInSeconds);
+ TimerNode(ZVision *engine, uint32 key, uint timeInSeconds);
/**
* Decrement the timer by the delta time. If the timer is finished, set the status
* in _globalState and let this node be deleted
*
- * @param engine Pointer to the ZVision instance
- * @param deltaTimeInMillis Amount of time that has passed since the last frame
- * @return Node should be deleted after this (true) or kept (false)
+ * @param deltaTimeInMillis The number of milliseconds that have passed since last frame
+ * @return If true, the node can be deleted after process() finishes
*/
- bool process(ZVision *engine, uint32 deltaTimeInMillis);
+ bool process(uint32 deltaTimeInMillis);
private:
+ ZVision *_engine;
uint32 _key;
uint32 _timeLeft;
};