diff options
Diffstat (limited to 'engines/titanic/moves')
-rw-r--r-- | engines/titanic/moves/call_pellerator.cpp | 82 | ||||
-rw-r--r-- | engines/titanic/moves/call_pellerator.h | 53 | ||||
-rw-r--r-- | engines/titanic/moves/exit_pellerator.cpp | 86 | ||||
-rw-r--r-- | engines/titanic/moves/exit_pellerator.h | 6 |
4 files changed, 224 insertions, 3 deletions
diff --git a/engines/titanic/moves/call_pellerator.cpp b/engines/titanic/moves/call_pellerator.cpp new file mode 100644 index 0000000000..0dd8195277 --- /dev/null +++ b/engines/titanic/moves/call_pellerator.cpp @@ -0,0 +1,82 @@ +/* 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/moves/call_pellerator.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CCallPellerator, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +void CCallPellerator::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CCallPellerator::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CCallPellerator::EnterViewMsg(CEnterViewMsg *msg) { + petSetArea(PET_REMOTE); + petHighlightGlyph(1); + CString name = getFullViewName(); + + if (name == "TopOfWell.Node 6.S") { + petDisplayMessage(2, "You are standing outside the Pellerator."); + } + + petSetRemoteTarget(); + return true; +} + +bool CCallPellerator::LeaveViewMsg(CLeaveViewMsg *msg) { + petClear(); + return true; +} + +bool CCallPellerator::PETActivateMsg(CPETActivateMsg *msg) { + CString name = getFullViewName(); + + if (msg->_name == "Pellerator") { + if (petDoorOrBellbotPresent()) { + petDisplayMessage("I'm sorry, you cannot enter this pellerator at present as a bot is in the way."); + } else if (name == "Bar.Node 1.S") { + changeView("Pellerator.Node 1.S"); + } else { + changeView("Pellerator.Node 1.N"); + } + } + + return true; +} + +bool CCallPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/call_pellerator.h b/engines/titanic/moves/call_pellerator.h new file mode 100644 index 0000000000..3a1ef3823a --- /dev/null +++ b/engines/titanic/moves/call_pellerator.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 TITANIC_CALL_PELLERATOR_H +#define TITANIC_CALL_PELLERATOR_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/pet_messages.h" + +namespace Titanic { + +class CCallPellerator : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool PETActivateMsg(CPETActivateMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CALL_PELLERATOR_H */ diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp index 68a2a8da91..12ca2c1e3c 100644 --- a/engines/titanic/moves/exit_pellerator.cpp +++ b/engines/titanic/moves/exit_pellerator.cpp @@ -21,9 +21,16 @@ */ #include "titanic/moves/exit_pellerator.h" +#include "titanic/game/transport/pellerator.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CExitPellerator, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(ChangeSeasonMsg) +END_MESSAGE_MAP() + CExitPelleratorStatics *CExitPellerator::_statics; void CExitPellerator::init() { @@ -38,7 +45,7 @@ void CExitPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_statics->_v1, indent); file->writeNumberLine(_statics->_v2, indent); - file->writeNumberLine(_statics->_v3, indent); + file->writeNumberLine(_statics->_isWinter, indent); CGameObject::save(file, indent); } @@ -47,9 +54,84 @@ void CExitPellerator::load(SimpleFile *file) { file->readNumber(); _statics->_v1 = file->readString(); _statics->_v2 = file->readNumber(); - _statics->_v3 = file->readNumber(); + _statics->_isWinter = file->readNumber(); CGameObject::load(file); } +bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CString name = getName(); + + if (name == "ExitPellerator") { + if (_statics->_v2 != 2) { + switch (getRandomNumber(2)) { + case 0: + CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle); + break; + case 1: + CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle); + break; + default: + CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle); + break; + } + } + + switch (_statics->_v2) { + case 0: + changeView("PromenadeDeck.Node 1.W"); + break; + case 1: + changeView("MusicRoomLobby.Node 1.S"); + break; + case 4: + changeView("TopOfWell.Node 6.N"); + break; + case 5: + changeView("1stClassRestaurant.Lobby Node.E"); + break; + case 6: + changeView(_statics->_isWinter ? "FrozenArboretum.Node 4.S" : "Arboretum.Node 4.W"); + break; + default: + petDisplayMessage(2, "Please exit from the other side."); + CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle); + + } + } else if (name == "ExitPellerator2") { + if (_statics->_v2 == 2) { + switch (getRandomNumber(2)) { + case 0: + CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle); + break; + case 1: + CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle); + break; + default: + CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle); + break; + } + } + + if (_statics->_v2 == 2) { + changeView("Bar.Node 1.N"); + } else { + petDisplayMessage(2, "Please exit from the other side."); + CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle); + } + } + + return true; +} + +bool CExitPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { + _statics->_v2 = msg->_newStatus; + return true; +} + +bool CExitPellerator::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + _statics->_isWinter = msg->_season == "Winter"; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h index 280d1e9a6c..8819d64355 100644 --- a/engines/titanic/moves/exit_pellerator.h +++ b/engines/titanic/moves/exit_pellerator.h @@ -30,10 +30,14 @@ namespace Titanic { struct CExitPelleratorStatics { CString _v1; int _v2; - int _v3; + bool _isWinter; }; class CExitPellerator : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); private: static CExitPelleratorStatics *_statics; public: |