diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 25 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.h | 7 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 8 | ||||
-rw-r--r-- | engines/titanic/npcs/deskbot.cpp | 122 | ||||
-rw-r--r-- | engines/titanic/npcs/deskbot.h | 2 | ||||
-rw-r--r-- | engines/titanic/npcs/true_talk_npc.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 6 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms.cpp | 9 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms.h | 7 |
11 files changed, 196 insertions, 32 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 00a7328443..eaf1dfe9a8 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -26,6 +26,7 @@ #include "titanic/core/room_item.h" #include "titanic/npcs/true_talk_npc.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/star_control/star_control.h" #include "titanic/support/files_manager.h" #include "titanic/support/screen_manager.h" #include "titanic/support/video_surface.h" @@ -624,6 +625,10 @@ void CGameObject::petDisplayMsg(const CString &msg) const { pet->displayMessage(msg); } +void CGameObject::displayMessage(const CString &msg) const { + petDisplayMsg(msg); +} + CGameObject *CGameObject::getMailManFirstObject() const { CMailMan *mailMan = getMailMan(); return mailMan ? mailMan->getFirstObject() : nullptr; @@ -720,6 +725,12 @@ void CGameObject::dec54() { getGameManager()->dec54(); } +void CGameObject::petAddRoom(int roomNum) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->addRoom(roomNum); +} + void CGameObject::lockMouse() { CGameManager *gameMan = getGameManager(); gameMan->lockInputHandler(); @@ -827,6 +838,17 @@ CMailMan *CGameObject::getMailMan() const { return dynamic_cast<CMailMan *>(getDontSaveChild(CMailMan::_type)); } +CStarControl *CGameObject::getStarControl() const { + CStarControl *starControl = static_cast<CStarControl *>(getDontSaveChild(CStarControl::_type)); + if (!starControl) { + CViewItem *view = getGameManager()->getView(); + if (view) + starControl = starControl = static_cast<CStarControl *>(view->findChildInstanceOf(CStarControl::_type)); + } + + return starControl; +} + CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { CProjectItem *root = getRoot(); if (!root) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index f389815a99..22c62a809d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -35,9 +35,13 @@ namespace Titanic { enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 }; enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 }; -class CVideoSurface; +class CMailMan; +class CMusicRoom; +class CRoomItem; +class CStarControl; class CMouseDragStartMsg; class CTrueTalkNPC; +class CVideoSurface; class OSMovie; class CGameObject : public CNamedItem { @@ -125,6 +129,11 @@ protected: void dec54(); /** + * Adds a room to the room list + */ + void petAddRoom(int roomNum); + + /** * Locks/hides the mouse */ void lockMouse(); @@ -195,11 +204,16 @@ protected: int compareRoomNameTo(const CString &name); /** - * Display a message in the PET - */ + * Display a message in the PET + */ void petDisplayMsg(const CString &msg) const; /** + * Display a message + */ + void displayMessage(const CString &msg) const; + + /** * Gets the first object under the system MailMan */ CGameObject *getMailManFirstObject() const; @@ -309,6 +323,11 @@ protected: CMailMan *getMailMan() const; /** + * Returns the star control + */ + CStarControl *getStarControl() const; + + /** * Returns a child of the Dont Save area of the project of the given class */ CTreeItem *getDontSaveChild(ClassDef *classDef) const; diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index fd7586b819..c0d37d14d0 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -24,19 +24,14 @@ #define TITANIC_TREE_ITEM_H #include "titanic/core/message_target.h" +#include "titanic/support/simple_file.h" namespace Titanic { class CGameManager; -class CDontSaveFileItem; -class CMailMan; -class CMessage; -class CMusicRoom; class CNamedItem; -class CPetControl; class CProjectItem; class CScreenManager; -class CRoomItem; class CViewItem; class CTreeItem: public CMessageTarget { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index f592434152..d456714179 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -269,9 +269,9 @@ MESSAGE2(CMovieFrameMsg, int, value1, 0, int, value2, 0); MESSAGE0(CMusicHasStartedMsg); MESSAGE0(CMusicHasStoppedMsg); MESSAGE0(CMusicSettingChangedMsg); -MESSAGE2(CNPCPlayAnimationMsg, void *, data, nullptr, int, value2, 0); -MESSAGE1(CNPCPlayIdleAnimationMsg, void *, value, 0); -MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, void *, value3, nullptr); +MESSAGE2(CNPCPlayAnimationMsg, const char *const *, names, nullptr, int, value2, 0); +MESSAGE1(CNPCPlayIdleAnimationMsg, const char *const *, names, 0); +MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, const char *const *, names, nullptr); MESSAGE0(CNPCQueueIdleAnimMsg); MESSAGE1(CNutPuzzleMsg, CString, value, ""); MESSAGE1(COnSummonBotMsg, int, value, 0); @@ -344,7 +344,7 @@ MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFrame, 0, uint, endFrame, 0); MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); MESSAGE2(CTrueTalkGetStateValueMsg, int, stateNum, 0, int, stateVal, -1000); -MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, dialogueId, 0); MESSAGE3(CTrueTalkNotifySpeechStartedMsg, uint, soundId, 0, uint, dialogueId, 0, int, value, 0); MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0); MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 548738d930..18c1e2a137 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -21,9 +21,20 @@ */ #include "titanic/npcs/deskbot.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +static const char *const TALKING_NAMES[] = { + "NeutralTalking", "HandFidget1", "HandFidget2", "LookingAround", + "FriendlyTalking", "MoreRudeness", "HandUp", "TapFingers", + "WaveOn", "WaveArmsAround", "HandsOverEdge" +}; + +static const char *const IDLE_NAMES[] = { + "WaveOn", "HandFidget1", "HandFidget2", "TapFingers", "HandsOverEdge" +}; + BEGIN_MESSAGE_MAP(CDeskbot, CTrueTalkNPC) ON_MESSAGE(TurnOn) ON_MESSAGE(EnterViewMsg) @@ -41,7 +52,7 @@ END_MESSAGE_MAP() int CDeskbot::_v1; int CDeskbot::_v2; -CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _field10C(0) { +CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _classNum(0) { } void CDeskbot::save(SimpleFile *file, int indent) const { @@ -49,7 +60,7 @@ void CDeskbot::save(SimpleFile *file, int indent) const { file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); file->writeNumberLine(_deskbotActive, indent); - file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_classNum, indent); CTrueTalkNPC::save(file, indent); } @@ -59,7 +70,7 @@ void CDeskbot::load(SimpleFile *file) { _v1 = file->readNumber(); _v2 = file->readNumber(); _deskbotActive = file->readNumber(); - _field10C = file->readNumber(); + _classNum = file->readNumber(); CTrueTalkNPC::load(file); } @@ -98,12 +109,12 @@ bool CDeskbot::ActMsg(CActMsg *msg) { bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { bool flag = false; if (_npcFlags & NPCFLAG_10000) { - if (_field10C) { + if (_classNum) { setPetArea(PET_ROOMS); dec54(); unlockMouse(); playSound("z#47.wav", 100, 0, 0); - _field10C = false; + _classNum = false; } _npcFlags &= ~NPCFLAG_10000; @@ -161,39 +172,126 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { setPetArea(PET_CONVERSATION); playClip("ReprogramPETInHand", 4); _npcFlags |= NPCFLAG_10000; - _field10C = msg->_param1; + _classNum = msg->_param1; - switch (_field10C) { + switch (_classNum) { case 1: petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely."); - + setPassengerClass(_classNum); + petAddRoom(_classNum); break; case 2: petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy."); + setPassengerClass(_classNum); + petAddRoom(_classNum); + break; + case 3: + setPassengerClass(3); + petAddRoom(_classNum); + break; + default: break; } + + case 20: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(4); + } + break; + + case 21: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(3); + } + break; + + case 22: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(2); + } + break; + + case 23: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(1); + } + break; + + case 26: + _npcFlags |= NPCFLAG_80000; + CTurnOff turnOff; + turnOff.execute(this); + lockMouse(); + break; } return true; } bool CDeskbot::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) { - // TODO + if (msg->_value2 != 2) + msg->_names = TALKING_NAMES; + return true; } bool CDeskbot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) { - // TODO + msg->_names = IDLE_NAMES; return true; } bool CDeskbot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) { - // TODO + if (_npcFlags & NPCFLAG_40000) + return true; + + CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(msg); + switch (msg->_dialogueId) { + case 41684: + case 41686: + case 41787: + case 41788: + case 41789: + lockMouse(); + break; + default: + break; + } + return true; } bool CDeskbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { - // TODO + if (_npcFlags & NPCFLAG_40000) + return true; + + CTurnOff turnOff; + CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); + + switch (msg->_dialogueId) { + case 41684: + case 41787: + case 41788: + case 41789: + _npcFlags |= NPCFLAG_80000; + turnOff.execute(this); + + case 41686: + _npcFlags |= NPCFLAG_100000; + turnOff.execute(this); + break; + + default: + break; + } + return true; } diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 8425f58f95..3e155f6788 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -45,7 +45,7 @@ private: static int _v2; public: bool _deskbotActive; - int _field10C; + int _classNum; public: CLASSDEF CDeskbot(); diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index ba2de20de9..32c6412fef 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -111,8 +111,8 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs CNPCPlayTalkingAnimationMsg msg1(_soundId, 0, 0); msg1.execute(this); - if (msg1._value3) { - CNPCPlayAnimationMsg msg2(msg1._value3, msg1._value1); + if (msg1._names) { + CNPCPlayAnimationMsg msg2(msg1._names, msg1._value1); msg2.execute(this); } } @@ -151,8 +151,8 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { CNPCPlayTalkingAnimationMsg msg1(ticks, ticks > 1000 ? 2 : 1, 0); msg1.execute(this); - if (msg1._value3) { - CNPCPlayAnimationMsg msg2(msg1._value3, msg1._value1); + if (msg1._names) { + CNPCPlayAnimationMsg msg2(msg1._names, msg1._value1); msg2.execute(this); } @@ -173,8 +173,8 @@ bool CTrueTalkNPC::TimerMsg(CTimerMsg *msg) { CNPCPlayIdleAnimationMsg idleMsg; if (idleMsg.execute(this)) { - if (idleMsg._value) { - CNPCPlayAnimationMsg animMsg(idleMsg._value, 0); + if (idleMsg._names) { + CNPCPlayAnimationMsg animMsg(idleMsg._names, 0); animMsg.execute(this); } diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 1fd6549f9b..92ec3d6b03 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -516,4 +516,12 @@ CString CPetControl::getFullViewName() { return gameManager ? gameManager->getFullViewName() : CString(); } +void CPetControl::addRoom(int roomNum) { + _rooms.addRoom(roomNum); +} + +int CPetControl::roomFn2(int val) { + return _rooms.fn2(val); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 23b4f61721..1eedc0382f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -293,6 +293,12 @@ public: * room.node.view tuplet form */ CString getFullViewName(); + + /** + * Adds a room to the room list + */ + void addRoom(int roomNum); + int roomFn2(int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index acf9acfe24..a14258ebbf 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -202,6 +202,11 @@ int CPetRooms::fn1() { return 0; } +int CPetRooms::fn2(int val) { + warning("TODO: CPetRooms::fn2"); + return 0; +} + void CPetRooms::areaChanged(PetArea area) { if (_petControl && _petControl->_currentArea == area) _petControl->makeDirty(); @@ -221,4 +226,8 @@ CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { } } +void CPetRooms::addRoom(int roomNum) { + warning("TODO: CPetRooms::addRoom"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 522a1e2399..515c9fb10d 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -147,6 +147,13 @@ public: virtual CPetText *getText(); virtual CGameObject *getBackground(int index); + + /** + * Adds a room to the room list + */ + void addRoom(int roomNum); + + int fn2(int val); }; } // End of namespace Titanic |