From c3fcff96124190e847e714fbed23c60c1785c169 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sat, 31 Aug 2013 23:42:56 -0500 Subject: ZVISION: Move TimerNode to it's own file --- engines/zvision/timer_node.h | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 engines/zvision/timer_node.h (limited to 'engines/zvision/timer_node.h') 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 -- cgit v1.2.3 From ac578bf9b7b9c58dbaad58c874517b7af45dfa3f Mon Sep 17 00:00:00 2001 From: richiesams Date: Tue, 3 Sep 2013 23:57:19 -0500 Subject: ZVISION: Implement TimerNode serialization --- engines/zvision/timer_node.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/zvision/timer_node.h') diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index d692f1f0ca..21c344bb15 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -43,6 +43,9 @@ public: * @return If true, the node can be deleted after process() finishes */ bool process(uint32 deltaTimeInMillis); + void serialize(Common::WriteStream *stream); + void deserialize(Common::SeekableReadStream *stream); + inline bool needsSerialization() { return true; } private: uint32 _timeLeft; -- cgit v1.2.3 From 1f9ba897b8aa8afe776928ecd5ca480b8b2fc3a8 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 18:00:57 -0500 Subject: ZVISION: Convert _timeLeft to a signed int This allows time decrementing to go negative instead of wrapping to UINT_MAX. Which makes comparisons easier. --- engines/zvision/timer_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/timer_node.h') diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index 21c344bb15..4bc8397ff0 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -48,7 +48,7 @@ public: inline bool needsSerialization() { return true; } private: - uint32 _timeLeft; + int32 _timeLeft; }; } // End of namespace ZVision -- cgit v1.2.3 From bad28dc15872e208bf21f1e6fa2ab906bca598c4 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 1 Oct 2013 20:08:41 -0500 Subject: ZVISION: Standardize includes order and format Format is: common/scummsys.h (Only if a .cpp file) header file for this file (Only if a .cpp file) zengine includes other includes, grouped by module --- engines/zvision/timer_node.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/zvision/timer_node.h') diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index 4bc8397ff0..32dca71548 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -23,8 +23,6 @@ #ifndef ZVISION_TIMER_NODE_H #define ZVISION_TIMER_NODE_H -#include "common/types.h" - #include "zvision/control.h" namespace ZVision { -- cgit v1.2.3