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.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 engines/zvision/timer_node.cpp (limited to 'engines/zvision/timer_node.cpp') 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 -- 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.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines/zvision/timer_node.cpp') diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp index c9ef9d29d1..81468dbb0b 100644 --- a/engines/zvision/timer_node.cpp +++ b/engines/zvision/timer_node.cpp @@ -22,6 +22,8 @@ #include "common/scummsys.h" +#include "common/stream.h" + #include "zvision/timer_node.h" #include "zvision/zvision.h" #include "zvision/script_manager.h" @@ -43,4 +45,13 @@ bool TimerNode::process(uint32 deltaTimeInMillis) { return false; } +void TimerNode::serialize(Common::WriteStream *stream) { + stream->writeUint32LE(_key); + stream->writeUint32LE(_timeLeft); +} + +void TimerNode::deserialize(Common::SeekableReadStream *stream) { + _timeLeft = stream->readUint32LE(); +} + } // 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.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines/zvision/timer_node.cpp') diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp index 81468dbb0b..55dfa51dfe 100644 --- a/engines/zvision/timer_node.cpp +++ b/engines/zvision/timer_node.cpp @@ -22,12 +22,14 @@ #include "common/scummsys.h" -#include "common/stream.h" - #include "zvision/timer_node.h" + #include "zvision/zvision.h" #include "zvision/script_manager.h" +#include "common/stream.h" + + namespace ZVision { TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) -- cgit v1.2.3