From cbf5fb0beee0e0157c2d9a8e4cac2d35106e5c34 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Aug 2016 23:07:24 -0400 Subject: TITANIC: Move BilgeSuccUBus & ParrotSuccUBus to npcs/ folder --- engines/titanic/core/saveable_object.cpp | 4 +- engines/titanic/game/bilge_succubus.cpp | 467 ------------------------ engines/titanic/game/bilge_succubus.h | 65 ---- engines/titanic/game/parrot/parrot_succubus.cpp | 49 --- engines/titanic/game/parrot/parrot_succubus.h | 54 --- engines/titanic/module.mk | 4 +- engines/titanic/npcs/bilge_succubus.cpp | 467 ++++++++++++++++++++++++ engines/titanic/npcs/bilge_succubus.h | 65 ++++ engines/titanic/npcs/parrot_succubus.cpp | 49 +++ engines/titanic/npcs/parrot_succubus.h | 54 +++ 10 files changed, 639 insertions(+), 639 deletions(-) delete mode 100644 engines/titanic/game/bilge_succubus.cpp delete mode 100644 engines/titanic/game/bilge_succubus.h delete mode 100644 engines/titanic/game/parrot/parrot_succubus.cpp delete mode 100644 engines/titanic/game/parrot/parrot_succubus.h create mode 100644 engines/titanic/npcs/bilge_succubus.cpp create mode 100644 engines/titanic/npcs/bilge_succubus.h create mode 100644 engines/titanic/npcs/parrot_succubus.cpp create mode 100644 engines/titanic/npcs/parrot_succubus.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 62cee47045..080c34b08b 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -92,7 +92,7 @@ #include "titanic/game/bar_menu.h" #include "titanic/game/bar_menu_button.h" #include "titanic/game/belbot_get_light.h" -#include "titanic/game/bilge_succubus.h" +#include "titanic/npcs/bilge_succubus.h" #include "titanic/game/bomb.h" #include "titanic/game/bottom_of_well_monitor.h" #include "titanic/game/bowl_unlocker.h" @@ -228,7 +228,7 @@ #include "titanic/game/parrot/parrot_nut_bowl_actor.h" #include "titanic/game/parrot/parrot_nut_eater.h" #include "titanic/game/parrot/parrot_perch_holder.h" -#include "titanic/game/parrot/parrot_succubus.h" +#include "titanic/npcs/parrot_succubus.h" #include "titanic/game/parrot/parrot_trigger.h" #include "titanic/game/parrot/player_meets_parrot.h" #include "titanic/game/pet/pet.h" diff --git a/engines/titanic/game/bilge_succubus.cpp b/engines/titanic/game/bilge_succubus.cpp deleted file mode 100644 index 88ddf70741..0000000000 --- a/engines/titanic/game/bilge_succubus.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/* 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/bilge_succubus.h" -#include "titanic/carry/chicken.h" -#include "titanic/core/view_item.h" -#include "titanic/pet_control/pet_control.h" - -namespace Titanic { - -BEGIN_MESSAGE_MAP(CBilgeSuccUBus, CSuccUBus) - ON_MESSAGE(FrameMsg) - ON_MESSAGE(PETReceiveMsg) - ON_MESSAGE(PETDeliverMsg) - ON_MESSAGE(MovieEndMsg) - ON_MESSAGE(MouseButtonDownMsg) - ON_MESSAGE(SubAcceptCCarryMsg) - ON_MESSAGE(EnterViewMsg) - ON_MESSAGE(LeaveViewMsg) - ON_MESSAGE(TrueTalkGetStateValueMsg) - ON_MESSAGE(TurnOn) - ON_MESSAGE(TurnOff) -END_MESSAGE_MAP() - -CBilgeSuccUBus::CBilgeSuccUBus() : CSuccUBus(), - _bilgeStartFrame1(-1), _bilgeEndFrame1(-1), - _bilgeStartFrame2(-1), _bilgeEndFrame2(-1) { -} - -void CBilgeSuccUBus::save(SimpleFile *file, int indent) { - file->writeNumberLine(1, indent); - file->writeNumberLine(_bilgeStartFrame1, indent); - file->writeNumberLine(_bilgeEndFrame1, indent); - file->writeNumberLine(_bilgeStartFrame2, indent); - file->writeNumberLine(_bilgeEndFrame2, indent); - - CSuccUBus::save(file, indent); -} - -void CBilgeSuccUBus::load(SimpleFile *file) { - file->readNumber(); - _bilgeStartFrame1 = file->readNumber(); - _bilgeEndFrame1 = file->readNumber(); - _bilgeStartFrame2 = file->readNumber(); - _bilgeEndFrame2 = file->readNumber(); - - CSuccUBus::load(file); -} - -bool CBilgeSuccUBus::FrameMsg(CFrameMsg *msg) { - return true; -} - -bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { - CPetControl *pet = getPetControl(); - - if (_v2) { - if (_startFrame4 >= 0) - playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE); - if (_startFrame5 >= 0) - playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE); - - playSound("z#28.wav", 70); - } else if (!_enabled) { - petDisplayMessage(2, "The Succ-U-Bus is in Standby, or \"Off\" mode at present."); - return false; - } else if (!pet) { - return false; - } else { - uint roomFlags = pet->getRoomFlags(); - CGameObject *mailObject = findMailByFlags( - _v3 && compareRoomNameTo("Titania") ? 3 : _field140, - roomFlags); - - if (mailObject) { - _mailP = mailObject; - if (_startFrame4 >= 0) - playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE); - } else { - petDisplayMessage(2, "There is currently nothing to deliver."); - } - } - - return true; -} - -bool CBilgeSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) { - CPetControl *pet = getPetControl(); - if (!_enabled || !pet) - return true; - - uint petRoomFlags = pet->getRoomFlags(); - CGameObject *mailObject = findMail(petRoomFlags); - - if (!mailObject) { - petDisplayMessage(2, "There is currently nothing in the tray to send."); - return true; - } - - _field19C = 0; - _mailP = mailObject; - - uint roomFlags = _roomFlags; - if (!pet->testRooms5(roomFlags) || - getPassengerClass() > pet->getMailDest(roomFlags)) { - roomFlags = pet->getSpecialRoomFlags("BilgeRoom"); - _field19C = 1; - } - - _isChicken = mailObject->getName() == "Chicken"; - _isFeathers = mailObject->getName() == "Feathers"; - _field158 = 0; - - if (_v2) { - if (_isFeathers) { - startTalking(this, 230022); - _field158 = 1; - - if (_startFrame3 >= 0) - playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT); - - if (_bilgeStartFrame1 >= 0) { - playMovie(_startFrame12, _endFrame12, MOVIE_GAMESTATE); - playMovie(_bilgeStartFrame2, _bilgeEndFrame2, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(_bilgeStartFrame1, _bilgeEndFrame1, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - inc54(); - } - } else { - startTalking(this, 230012); - _field158 = 2; - if (_startFrame3 >= 0) - playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - if (_startFrame4 >= 0) - playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - if (_startFrame5 >= 0) - playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE); - } - } else { - if (_isFeathers) { - startTalking(this, 230022); - _field158 = 3; - - if (_startFrame3 >= 0) - playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - if (_startFrame4 >= 0) - playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - if (_startFrame5 >= 0) - playMovie(_startFrame5, _endFrame5, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - } else { - removeMail(petRoomFlags, roomFlags); - startTalking(this, 230012); - if (_startFrame3 >= 0) { - _field158 = 4; - playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - } - } - } - - return true; -} - -bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { - CPetControl *pet = getPetControl(); - - if (msg->_endFrame == _endFrame12) { - if (_startFrame10 >= 0) - playSound("z#27.wav"); - } else if (msg->_endFrame == _endFrame10) { - if (_startFrame11 >= 0) - playSound("z#30.wav"); - } else { - if (_endFrame9 == _endFrame10 && pet) { - if (_v2) { - startTalking(this, getRandomNumber(1) ? 230062 : 230063); - } else if (!findMail(pet->getRoomFlags())) { - switch (getRandomNumber(4)) { - case 0: - startTalking(this, 230001); - break; - case 1: - startTalking(this, 230002); - break; - case 2: - startTalking(this, 230003); - break; - default: - break; - } - } - } - - if (msg->_endFrame == _endFrame3) { - switch (_field158) { - case 1: - stopSound(_soundHandle); - _soundHandle = playSound("z#3.wav"); - break; - case 2: - stopSound(_soundHandle); - _soundHandle = playSound("z#12.wav"); - break; - case 3: - if (_isChicken) { - startTalking(this, 230018); - _isChicken = false; - } else { - startTalking(this, 230013); - } - break; - case 4: - startTalking(this, 230017); - break; - default: - break; - } - - CSUBTransition transMsg; - transMsg.execute(this); - - } else if (msg->_endFrame == _bilgeEndFrame2) { - playSound("z#25.wav", 70); - playSound("z#24.wav", 70); - - } else if (msg->_endFrame == _endFrame4) { - if (_mailP) { - _mailP->petAddToInventory(); - CVisibleMsg visibleMsg(true); - visibleMsg.execute(_mailP); - - _mailP = nullptr; - petSetArea(PET_INVENTORY); - - CSUBTransition transMsg; - transMsg.execute(this); - } - - } else if (msg->_endFrame == _bilgeEndFrame1) { - changeView("BilgeRoomWith.Node 1.N", ""); - _v2 = 0; - resetMail(); - - if (_mailP) { - _mailP->petAddToInventory(); - CVisibleMsg visibleMsg(true); - visibleMsg.execute(_mailP); - - _mailP = nullptr; - petSetArea(PET_INVENTORY); - } - - startTalking(this, 150); - CBodyInBilgeRoomMsg bodyMsg; - bodyMsg.execute("Service Elevator Entity"); - dec54(); - _field158 = 0; - - } else { - _field158 = 0; - } - } - - return true; -} - -bool CBilgeSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (_enabled) { - switch (getRandomNumber(4)) { - case 0: - case 4: { - _enabled = false; - CTurnOff offMsg; - offMsg.execute(this); - break; - } - - case 1: - startTalking(this, 230055); - break; - - case 2: - startTalking(this, 230067); - break; - - case 3: - startTalking(this, 230045); - break; - - default: - break; - } - } else { - CTurnOn onMsg; - onMsg.execute(this); - _enabled = true; - } - - return true; -} - -bool CBilgeSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { - CPetControl *pet = getPetControl(); - if (!msg->_item) - return false; - - CCarry *item = dynamic_cast(msg->_item); - if (!_enabled || !pet || !item) { - item->petAddToInventory(); - return true; - } - - uint petRoomFlags = pet->getRoomFlags(); - if (mailExists(petRoomFlags)) { - petDisplayMessage(2, "The Succ-U-Bus is a Single Entity Delivery Device."); - item->petAddToInventory(); - return true; - } - - petContainerRemove(item); - pet->phonographAction(""); - playSound("z#23.wav"); - - CChicken *chicken = dynamic_cast(item); - bool chickenFlag = chicken ? chicken->_string6 == "None" : false; - - if (chickenFlag) { - if (_startFrame2 >= 0) { - startTalking(this, 70219); - playMovie(_startFrame2, _endFrame2, 0); - } - - if (_startFrame3 >= 0) { - _field158 = 5; - playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT); - } - - CViewItem *view = parseView(item->_fullViewName); - if (view) { - item->setVisible(false); - setPosition(item->_origPos); - item->moveUnder(view); - - CSUBTransition transMsg; - transMsg.execute(this); - } else { - return false; - } - } else { - item->addMail(petRoomFlags); - if (_startFrame2 >= 0) - playMovie(_startFrame2, _endFrame2, 0); - - petSetArea(PET_REMOTE); - CSUBTransition transMsg; - transMsg.execute(this); - } - - return true; -} - -bool CBilgeSuccUBus::EnterViewMsg(CEnterViewMsg *msg) { - petSetRemoteTarget(); - _mailP = nullptr; - - if (_startFrame8 >= 0) - loadFrame(_startFrame8); - - return true; -} - -bool CBilgeSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) { - petDisplayMessage(2, ""); - petClear(); - - if (_soundHandle != -1) { - stopSound(_soundHandle); - _soundHandle = -1; - } - - if (_enabled) { - _enabled = false; - if (_startFrame10 >= 0) - playSound("z#27.wav"); - } - - performAction(true); - CSUBTransition transMsg; - transMsg.execute(this); - - return true; -} - -bool CBilgeSuccUBus::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) { - if (msg->_stateNum == 1) - msg->_stateVal = _enabled; - - return true; -} - -bool CBilgeSuccUBus::TurnOn(CTurnOn *msg) { - CPetControl *pet = getPetControl(); - - if (pet) { - if (_startFrame9 >= 0) { - playMovie(_startFrame9, _endFrame9, MOVIE_NOTIFY_OBJECT); - playSound("z#26.wav"); - } - - if (mailExists(pet->getRoomFlags()) && _startFrame2 >= 0) - playMovie(_startFrame2, _endFrame2, 0); - - _enabled = true; - CSUBTransition transMsg; - transMsg.execute(this); - - endTalking(this, true); - petSetArea(PET_REMOTE); - petHighlightGlyph(16); - } - - return true; -} - -bool CBilgeSuccUBus::TurnOff(CTurnOff *msg) { - CPetControl *pet = getPetControl(); - - if (pet && mailExists(pet->getRoomFlags()) && _startFrame12 >= 0) - playMovie(_startFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT); - else if (_endFrame12 >= 0) - playMovie(_endFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT); - - if (_soundHandle != -1) { - stopSound(_soundHandle); - _soundHandle = -1; - } - - if (_startFrame10 >= 0) - playMovie(_startFrame10, _endFrame10, MOVIE_NOTIFY_OBJECT); - - _enabled = false; - performAction(true); - - CSUBTransition transMsg; - transMsg.execute(this); - - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/bilge_succubus.h b/engines/titanic/game/bilge_succubus.h deleted file mode 100644 index 754949a306..0000000000 --- a/engines/titanic/game/bilge_succubus.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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_BILGE_SUCCUBUS_H -#define TITANIC_BILGE_SUCCUBUS_H - -#include "titanic/npcs/succubus.h" - -namespace Titanic { - -class CBilgeSuccUBus : public CSuccUBus { - DECLARE_MESSAGE_MAP; - bool FrameMsg(CFrameMsg *msg); - bool PETReceiveMsg(CPETReceiveMsg *msg); - bool PETDeliverMsg(CPETDeliverMsg *msg); - bool MovieEndMsg(CMovieEndMsg *msg); - bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); - bool SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg); - bool EnterViewMsg(CEnterViewMsg *msg); - bool LeaveViewMsg(CLeaveViewMsg *msg); - bool TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg); - bool TurnOn(CTurnOn *msg); - bool TurnOff(CTurnOff *msg); -public: - int _bilgeStartFrame1; - int _bilgeEndFrame1; - int _bilgeStartFrame2; - int _bilgeEndFrame2; -public: - CLASSDEF; - CBilgeSuccUBus(); - - /** - * 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_BILGE_SUCCUBUS_H */ diff --git a/engines/titanic/game/parrot/parrot_succubus.cpp b/engines/titanic/game/parrot/parrot_succubus.cpp deleted file mode 100644 index 02a29b748e..0000000000 --- a/engines/titanic/game/parrot/parrot_succubus.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* 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/parrot/parrot_succubus.h" - -namespace Titanic { - -CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0), - _field1EC(0), _field1F0(376), _field1F4(393) { -} - -void CParrotSuccUBus::save(SimpleFile *file, int indent) { - file->writeNumberLine(1, indent); - file->writeNumberLine(_field1DC, indent); - file->writeQuotedLine(_string3, indent); - file->writeNumberLine(_field1EC, indent); - - CSuccUBus::save(file, indent); -} - -void CParrotSuccUBus::load(SimpleFile *file) { - file->readNumber(); - _field1DC = file->readNumber(); - _string3 = file->readString(); - _field1EC = file->readNumber(); - - CSuccUBus::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_succubus.h b/engines/titanic/game/parrot/parrot_succubus.h deleted file mode 100644 index 6f5d9e602a..0000000000 --- a/engines/titanic/game/parrot/parrot_succubus.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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_PARROT_SUCCUBUS_H -#define TITANIC_PARROT_SUCCUBUS_H - -#include "titanic/npcs/succubus.h" - -namespace Titanic { - -class CParrotSuccUBus : public CSuccUBus { -public: - int _field1DC; - CString _string3; - int _field1EC; - int _field1F0; - int _field1F4; -public: - CLASSDEF; - CParrotSuccUBus(); - - /** - * 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_PARROT_SUCCUBUS_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 5c041174a2..34d93b6411 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -81,7 +81,6 @@ MODULE_OBJS := \ game/arb_background.o \ game/arboretum_gate.o \ game/auto_animate.o \ - game/bilge_succubus.o \ game/bar_menu.o \ game/bar_menu_button.o \ game/bar_bell.o \ @@ -221,7 +220,6 @@ MODULE_OBJS := \ game/parrot/parrot_nut_bowl_actor.o \ game/parrot/parrot_nut_eater.o \ game/parrot/parrot_perch_holder.o \ - game/parrot/parrot_succubus.o \ game/parrot/parrot_trigger.o \ game/parrot/player_meets_parrot.o \ game/pet/pet.o \ @@ -343,6 +341,7 @@ MODULE_OBJS := \ moves/trip_down_canal.o \ npcs/barbot.o \ npcs/bellbot.o \ + npcs/bilge_succubus.o \ npcs/callbot.o \ npcs/character.o \ npcs/deskbot.o \ @@ -351,6 +350,7 @@ MODULE_OBJS := \ npcs/maitre_d.o \ npcs/mobile.o \ npcs/parrot.o \ + npcs/parrot_succubus.o \ npcs/robot_controller.o \ npcs/starlings.o \ npcs/succubus.o \ diff --git a/engines/titanic/npcs/bilge_succubus.cpp b/engines/titanic/npcs/bilge_succubus.cpp new file mode 100644 index 0000000000..16064bf212 --- /dev/null +++ b/engines/titanic/npcs/bilge_succubus.cpp @@ -0,0 +1,467 @@ +/* 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/npcs/bilge_succubus.h" +#include "titanic/carry/chicken.h" +#include "titanic/core/view_item.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBilgeSuccUBus, CSuccUBus) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(PETReceiveMsg) + ON_MESSAGE(PETDeliverMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(SubAcceptCCarryMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(TrueTalkGetStateValueMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + +CBilgeSuccUBus::CBilgeSuccUBus() : CSuccUBus(), + _bilgeStartFrame1(-1), _bilgeEndFrame1(-1), + _bilgeStartFrame2(-1), _bilgeEndFrame2(-1) { +} + +void CBilgeSuccUBus::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_bilgeStartFrame1, indent); + file->writeNumberLine(_bilgeEndFrame1, indent); + file->writeNumberLine(_bilgeStartFrame2, indent); + file->writeNumberLine(_bilgeEndFrame2, indent); + + CSuccUBus::save(file, indent); +} + +void CBilgeSuccUBus::load(SimpleFile *file) { + file->readNumber(); + _bilgeStartFrame1 = file->readNumber(); + _bilgeEndFrame1 = file->readNumber(); + _bilgeStartFrame2 = file->readNumber(); + _bilgeEndFrame2 = file->readNumber(); + + CSuccUBus::load(file); +} + +bool CBilgeSuccUBus::FrameMsg(CFrameMsg *msg) { + return true; +} + +bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { + CPetControl *pet = getPetControl(); + + if (_v2) { + if (_startFrame4 >= 0) + playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE); + if (_startFrame5 >= 0) + playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE); + + playSound("z#28.wav", 70); + } else if (!_enabled) { + petDisplayMessage(2, "The Succ-U-Bus is in Standby, or \"Off\" mode at present."); + return false; + } else if (!pet) { + return false; + } else { + uint roomFlags = pet->getRoomFlags(); + CGameObject *mailObject = findMailByFlags( + _v3 && compareRoomNameTo("Titania") ? 3 : _field140, + roomFlags); + + if (mailObject) { + _mailP = mailObject; + if (_startFrame4 >= 0) + playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE); + } else { + petDisplayMessage(2, "There is currently nothing to deliver."); + } + } + + return true; +} + +bool CBilgeSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) { + CPetControl *pet = getPetControl(); + if (!_enabled || !pet) + return true; + + uint petRoomFlags = pet->getRoomFlags(); + CGameObject *mailObject = findMail(petRoomFlags); + + if (!mailObject) { + petDisplayMessage(2, "There is currently nothing in the tray to send."); + return true; + } + + _field19C = 0; + _mailP = mailObject; + + uint roomFlags = _roomFlags; + if (!pet->testRooms5(roomFlags) || + getPassengerClass() > pet->getMailDest(roomFlags)) { + roomFlags = pet->getSpecialRoomFlags("BilgeRoom"); + _field19C = 1; + } + + _isChicken = mailObject->getName() == "Chicken"; + _isFeathers = mailObject->getName() == "Feathers"; + _field158 = 0; + + if (_v2) { + if (_isFeathers) { + startTalking(this, 230022); + _field158 = 1; + + if (_startFrame3 >= 0) + playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT); + + if (_bilgeStartFrame1 >= 0) { + playMovie(_startFrame12, _endFrame12, MOVIE_GAMESTATE); + playMovie(_bilgeStartFrame2, _bilgeEndFrame2, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_bilgeStartFrame1, _bilgeEndFrame1, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + inc54(); + } + } else { + startTalking(this, 230012); + _field158 = 2; + if (_startFrame3 >= 0) + playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + if (_startFrame4 >= 0) + playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + if (_startFrame5 >= 0) + playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE); + } + } else { + if (_isFeathers) { + startTalking(this, 230022); + _field158 = 3; + + if (_startFrame3 >= 0) + playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + if (_startFrame4 >= 0) + playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + if (_startFrame5 >= 0) + playMovie(_startFrame5, _endFrame5, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } else { + removeMail(petRoomFlags, roomFlags); + startTalking(this, 230012); + if (_startFrame3 >= 0) { + _field158 = 4; + playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + } + } + + return true; +} + +bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { + CPetControl *pet = getPetControl(); + + if (msg->_endFrame == _endFrame12) { + if (_startFrame10 >= 0) + playSound("z#27.wav"); + } else if (msg->_endFrame == _endFrame10) { + if (_startFrame11 >= 0) + playSound("z#30.wav"); + } else { + if (_endFrame9 == _endFrame10 && pet) { + if (_v2) { + startTalking(this, getRandomNumber(1) ? 230062 : 230063); + } else if (!findMail(pet->getRoomFlags())) { + switch (getRandomNumber(4)) { + case 0: + startTalking(this, 230001); + break; + case 1: + startTalking(this, 230002); + break; + case 2: + startTalking(this, 230003); + break; + default: + break; + } + } + } + + if (msg->_endFrame == _endFrame3) { + switch (_field158) { + case 1: + stopSound(_soundHandle); + _soundHandle = playSound("z#3.wav"); + break; + case 2: + stopSound(_soundHandle); + _soundHandle = playSound("z#12.wav"); + break; + case 3: + if (_isChicken) { + startTalking(this, 230018); + _isChicken = false; + } else { + startTalking(this, 230013); + } + break; + case 4: + startTalking(this, 230017); + break; + default: + break; + } + + CSUBTransition transMsg; + transMsg.execute(this); + + } else if (msg->_endFrame == _bilgeEndFrame2) { + playSound("z#25.wav", 70); + playSound("z#24.wav", 70); + + } else if (msg->_endFrame == _endFrame4) { + if (_mailP) { + _mailP->petAddToInventory(); + CVisibleMsg visibleMsg(true); + visibleMsg.execute(_mailP); + + _mailP = nullptr; + petSetArea(PET_INVENTORY); + + CSUBTransition transMsg; + transMsg.execute(this); + } + + } else if (msg->_endFrame == _bilgeEndFrame1) { + changeView("BilgeRoomWith.Node 1.N", ""); + _v2 = 0; + resetMail(); + + if (_mailP) { + _mailP->petAddToInventory(); + CVisibleMsg visibleMsg(true); + visibleMsg.execute(_mailP); + + _mailP = nullptr; + petSetArea(PET_INVENTORY); + } + + startTalking(this, 150); + CBodyInBilgeRoomMsg bodyMsg; + bodyMsg.execute("Service Elevator Entity"); + dec54(); + _field158 = 0; + + } else { + _field158 = 0; + } + } + + return true; +} + +bool CBilgeSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_enabled) { + switch (getRandomNumber(4)) { + case 0: + case 4: { + _enabled = false; + CTurnOff offMsg; + offMsg.execute(this); + break; + } + + case 1: + startTalking(this, 230055); + break; + + case 2: + startTalking(this, 230067); + break; + + case 3: + startTalking(this, 230045); + break; + + default: + break; + } + } else { + CTurnOn onMsg; + onMsg.execute(this); + _enabled = true; + } + + return true; +} + +bool CBilgeSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { + CPetControl *pet = getPetControl(); + if (!msg->_item) + return false; + + CCarry *item = dynamic_cast(msg->_item); + if (!_enabled || !pet || !item) { + item->petAddToInventory(); + return true; + } + + uint petRoomFlags = pet->getRoomFlags(); + if (mailExists(petRoomFlags)) { + petDisplayMessage(2, "The Succ-U-Bus is a Single Entity Delivery Device."); + item->petAddToInventory(); + return true; + } + + petContainerRemove(item); + pet->phonographAction(""); + playSound("z#23.wav"); + + CChicken *chicken = dynamic_cast(item); + bool chickenFlag = chicken ? chicken->_string6 == "None" : false; + + if (chickenFlag) { + if (_startFrame2 >= 0) { + startTalking(this, 70219); + playMovie(_startFrame2, _endFrame2, 0); + } + + if (_startFrame3 >= 0) { + _field158 = 5; + playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT); + } + + CViewItem *view = parseView(item->_fullViewName); + if (view) { + item->setVisible(false); + setPosition(item->_origPos); + item->moveUnder(view); + + CSUBTransition transMsg; + transMsg.execute(this); + } else { + return false; + } + } else { + item->addMail(petRoomFlags); + if (_startFrame2 >= 0) + playMovie(_startFrame2, _endFrame2, 0); + + petSetArea(PET_REMOTE); + CSUBTransition transMsg; + transMsg.execute(this); + } + + return true; +} + +bool CBilgeSuccUBus::EnterViewMsg(CEnterViewMsg *msg) { + petSetRemoteTarget(); + _mailP = nullptr; + + if (_startFrame8 >= 0) + loadFrame(_startFrame8); + + return true; +} + +bool CBilgeSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) { + petDisplayMessage(2, ""); + petClear(); + + if (_soundHandle != -1) { + stopSound(_soundHandle); + _soundHandle = -1; + } + + if (_enabled) { + _enabled = false; + if (_startFrame10 >= 0) + playSound("z#27.wav"); + } + + performAction(true); + CSUBTransition transMsg; + transMsg.execute(this); + + return true; +} + +bool CBilgeSuccUBus::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) { + if (msg->_stateNum == 1) + msg->_stateVal = _enabled; + + return true; +} + +bool CBilgeSuccUBus::TurnOn(CTurnOn *msg) { + CPetControl *pet = getPetControl(); + + if (pet) { + if (_startFrame9 >= 0) { + playMovie(_startFrame9, _endFrame9, MOVIE_NOTIFY_OBJECT); + playSound("z#26.wav"); + } + + if (mailExists(pet->getRoomFlags()) && _startFrame2 >= 0) + playMovie(_startFrame2, _endFrame2, 0); + + _enabled = true; + CSUBTransition transMsg; + transMsg.execute(this); + + endTalking(this, true); + petSetArea(PET_REMOTE); + petHighlightGlyph(16); + } + + return true; +} + +bool CBilgeSuccUBus::TurnOff(CTurnOff *msg) { + CPetControl *pet = getPetControl(); + + if (pet && mailExists(pet->getRoomFlags()) && _startFrame12 >= 0) + playMovie(_startFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT); + else if (_endFrame12 >= 0) + playMovie(_endFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT); + + if (_soundHandle != -1) { + stopSound(_soundHandle); + _soundHandle = -1; + } + + if (_startFrame10 >= 0) + playMovie(_startFrame10, _endFrame10, MOVIE_NOTIFY_OBJECT); + + _enabled = false; + performAction(true); + + CSUBTransition transMsg; + transMsg.execute(this); + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/bilge_succubus.h b/engines/titanic/npcs/bilge_succubus.h new file mode 100644 index 0000000000..754949a306 --- /dev/null +++ b/engines/titanic/npcs/bilge_succubus.h @@ -0,0 +1,65 @@ +/* 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_BILGE_SUCCUBUS_H +#define TITANIC_BILGE_SUCCUBUS_H + +#include "titanic/npcs/succubus.h" + +namespace Titanic { + +class CBilgeSuccUBus : public CSuccUBus { + DECLARE_MESSAGE_MAP; + bool FrameMsg(CFrameMsg *msg); + bool PETReceiveMsg(CPETReceiveMsg *msg); + bool PETDeliverMsg(CPETDeliverMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg); + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); +public: + int _bilgeStartFrame1; + int _bilgeEndFrame1; + int _bilgeStartFrame2; + int _bilgeEndFrame2; +public: + CLASSDEF; + CBilgeSuccUBus(); + + /** + * 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_BILGE_SUCCUBUS_H */ diff --git a/engines/titanic/npcs/parrot_succubus.cpp b/engines/titanic/npcs/parrot_succubus.cpp new file mode 100644 index 0000000000..49c4afa1f1 --- /dev/null +++ b/engines/titanic/npcs/parrot_succubus.cpp @@ -0,0 +1,49 @@ +/* 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/npcs/parrot_succubus.h" + +namespace Titanic { + +CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0), + _field1EC(0), _field1F0(376), _field1F4(393) { +} + +void CParrotSuccUBus::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field1DC, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_field1EC, indent); + + CSuccUBus::save(file, indent); +} + +void CParrotSuccUBus::load(SimpleFile *file) { + file->readNumber(); + _field1DC = file->readNumber(); + _string3 = file->readString(); + _field1EC = file->readNumber(); + + CSuccUBus::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/parrot_succubus.h b/engines/titanic/npcs/parrot_succubus.h new file mode 100644 index 0000000000..6f5d9e602a --- /dev/null +++ b/engines/titanic/npcs/parrot_succubus.h @@ -0,0 +1,54 @@ +/* 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_PARROT_SUCCUBUS_H +#define TITANIC_PARROT_SUCCUBUS_H + +#include "titanic/npcs/succubus.h" + +namespace Titanic { + +class CParrotSuccUBus : public CSuccUBus { +public: + int _field1DC; + CString _string3; + int _field1EC; + int _field1F0; + int _field1F4; +public: + CLASSDEF; + CParrotSuccUBus(); + + /** + * 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_PARROT_SUCCUBUS_H */ -- cgit v1.2.3