From 9cb1390c2636f6b586b0f6dfca6573bc05dc6592 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 07:49:21 -0500 Subject: TITANIC: Implemented CClickResponder and descendents --- engines/titanic/game/desk_click_responder.cpp | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 engines/titanic/game/desk_click_responder.cpp (limited to 'engines/titanic/game/desk_click_responder.cpp') diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp new file mode 100644 index 0000000000..312fe564af --- /dev/null +++ b/engines/titanic/game/desk_click_responder.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/desk_click_responder.h" + +namespace Titanic { + +void CDeskClickResponder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + + CClickResponder::save(file, indent); +} + +void CDeskClickResponder::load(SimpleFile *file) { + file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic -- cgit v1.2.3 From 5ccc0a66da38d23520234e7060efaf966d3345b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jun 2016 19:53:16 -0400 Subject: TITANIC: Removed const modifier from all saveable objects Turns out that CGameObject::save regenerates the _movieRangeInfo list. So the const suffix can no longer be used for the entire hierarchy --- engines/titanic/game/desk_click_responder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/game/desk_click_responder.cpp') diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp index 312fe564af..d9b2cb64b4 100644 --- a/engines/titanic/game/desk_click_responder.cpp +++ b/engines/titanic/game/desk_click_responder.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CDeskClickResponder::save(SimpleFile *file, int indent) const { +void CDeskClickResponder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldD4, indent); file->writeNumberLine(_fieldD8, indent); -- cgit v1.2.3 From cd8415cfd6e51ef8ab2d4e51ddb4a120253e3b96 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Aug 2016 23:52:58 -0400 Subject: TITANIC: Implementing game classes --- engines/titanic/game/desk_click_responder.cpp | 29 +++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'engines/titanic/game/desk_click_responder.cpp') diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp index d9b2cb64b4..2cd5d1e83b 100644 --- a/engines/titanic/game/desk_click_responder.cpp +++ b/engines/titanic/game/desk_click_responder.cpp @@ -21,13 +21,19 @@ */ #include "titanic/game/desk_click_responder.h" +#include "titanic/titanic.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CDeskClickResponder, CClickResponder) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + void CDeskClickResponder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldD4, indent); - file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_ticks, indent); CClickResponder::save(file, indent); } @@ -35,9 +41,28 @@ void CDeskClickResponder::save(SimpleFile *file, int indent) { void CDeskClickResponder::load(SimpleFile *file) { file->readNumber(); _fieldD4 = file->readNumber(); - _fieldD8 = file->readNumber(); + _ticks = file->readNumber(); CClickResponder::load(file); } +bool CDeskClickResponder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + _fieldD4 = (_fieldD4 + 1) % 3; + if (_fieldD4) + return CClickResponder::MouseButtonDownMsg(msg); + + uint ticks = g_vm->_events->getTicksCount(); + if (!_ticks || ticks > (_ticks + 4000)) { + playSound("a#22.wav"); + _ticks = ticks; + } + + return true; +} + +bool CDeskClickResponder::LoadSuccessMsg(CLoadSuccessMsg *msg) { + _ticks = 0; + return true; +} + } // End of namespace Titanic -- cgit v1.2.3 From 8b3829549a2c82a09f7475c35173238f7470d587 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Aug 2016 20:22:41 -0400 Subject: TITANIC: Cleanup of engine references --- engines/titanic/game/desk_click_responder.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/titanic/game/desk_click_responder.cpp') diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp index 2cd5d1e83b..0650b3a1f5 100644 --- a/engines/titanic/game/desk_click_responder.cpp +++ b/engines/titanic/game/desk_click_responder.cpp @@ -21,7 +21,6 @@ */ #include "titanic/game/desk_click_responder.h" -#include "titanic/titanic.h" namespace Titanic { @@ -51,7 +50,7 @@ bool CDeskClickResponder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_fieldD4) return CClickResponder::MouseButtonDownMsg(msg); - uint ticks = g_vm->_events->getTicksCount(); + uint ticks = getTicksCount(); if (!_ticks || ticks > (_ticks + 4000)) { playSound("a#22.wav"); _ticks = ticks; -- cgit v1.2.3