diff options
-rw-r--r-- | engines/zvision/action_node.cpp | 13 | ||||
-rw-r--r-- | engines/zvision/action_node.h | 19 | ||||
-rw-r--r-- | engines/zvision/actions.cpp | 1 | ||||
-rw-r--r-- | engines/zvision/module.mk | 1 | ||||
-rw-r--r-- | engines/zvision/timer_node.cpp | 46 | ||||
-rw-r--r-- | engines/zvision/timer_node.h | 53 |
6 files changed, 102 insertions, 31 deletions
diff --git a/engines/zvision/action_node.cpp b/engines/zvision/action_node.cpp index 8e354606f8..eeb8930924 100644 --- a/engines/zvision/action_node.cpp +++ b/engines/zvision/action_node.cpp @@ -28,19 +28,6 @@ namespace ZVision { -TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) - : Control(engine, key), _timeLeft(timeInSeconds * 1000) { -} -bool TimerNode::process(uint32 deltaTimeInMillis) { - _timeLeft -= deltaTimeInMillis; - - if (_timeLeft <= 0) { - _engine->getScriptManager()->setStateValue(_key, 0); - return true; - } - - return false; -} } // End of namespace ZVision diff --git a/engines/zvision/action_node.h b/engines/zvision/action_node.h index b0b8cae4b1..c9beb7b38e 100644 --- a/engines/zvision/action_node.h +++ b/engines/zvision/action_node.h @@ -29,24 +29,7 @@ namespace ZVision { -class ZVision; - -class TimerNode : public Control { -public: - 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 deltaTimeInMillis The number of milliseconds that have passed since last frame - * @return If true, the node can be deleted after process() finishes - */ - bool process(uint32 deltaTimeInMillis); - -private: - uint32 _timeLeft; -}; + } // End of namespace ZVision diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index d039f04d95..0265ebd410 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -33,6 +33,7 @@ #include "zvision/action_node.h" #include "zvision/zork_raw.h" #include "zvision/zork_avi_decoder.h" +#include "zvision/timer_node.h" namespace ZVision { diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk index 7412ad8916..48b8a66077 100644 --- a/engines/zvision/module.mk +++ b/engines/zvision/module.mk @@ -21,6 +21,7 @@ MODULE_OBJS := \ script_manager.o \ scripts.o \ single_value_container.o \ + timer_node.o \ utility.o \ video.o \ zvision.o \ diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp new file mode 100644 index 0000000000..c9ef9d29d1 --- /dev/null +++ b/engines/zvision/timer_node.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/scummsys.h" + +#include "zvision/timer_node.h" +#include "zvision/zvision.h" +#include "zvision/script_manager.h" + +namespace ZVision { + +TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) + : Control(engine, key), _timeLeft(timeInSeconds * 1000) { +} + +bool TimerNode::process(uint32 deltaTimeInMillis) { + _timeLeft -= deltaTimeInMillis; + + if (_timeLeft <= 0) { + _engine->getScriptManager()->setStateValue(_key, 0); + return true; + } + + return false; +} + +} // End of namespace ZVision diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h new file mode 100644 index 0000000000..d692f1f0ca --- /dev/null +++ b/engines/zvision/timer_node.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef ZVISION_TIMER_NODE_H +#define ZVISION_TIMER_NODE_H + +#include "common/types.h" + +#include "zvision/control.h" + +namespace ZVision { + +class ZVision; + +class TimerNode : public Control { +public: + 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 deltaTimeInMillis The number of milliseconds that have passed since last frame + * @return If true, the node can be deleted after process() finishes + */ + bool process(uint32 deltaTimeInMillis); + +private: + uint32 _timeLeft; +}; + +} // End of namespace ZVision + +#endif |