diff options
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 3 | ||||
-rw-r--r-- | engines/titanic/npcs/parrot.cpp | 50 | ||||
-rw-r--r-- | engines/titanic/npcs/parrot.h | 7 |
4 files changed, 35 insertions, 28 deletions
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f718ba79b3..5e8c138984 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -424,6 +424,9 @@ CSaveableObject *ClassDef::create() { CSaveableObject::ClassListMap *CSaveableObject::_classList; CSaveableObject::ClassDefList *CSaveableObject::_classDefs; +ClassDef **types[1000]; +static int tctr = 0; + #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } \ ClassDef *T::_type #define ADDFN(CHILD, PARENT) \ diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index a40477a702..22069c912d 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -87,6 +87,7 @@ class CRoomItem; class CNodeItem; class CViewItem; class CMusicPlayer; +class CMovePlayerTo; class CMessage : public CSaveableObject { private: @@ -274,7 +275,7 @@ MESSAGE0(CNPCQueueIdleAnimMsg); MESSAGE1(CNutPuzzleMsg, CString, value, ""); MESSAGE1(COnSummonBotMsg, int, value, 0); MESSAGE0(COpeningCreditsMsg); -MESSAGE1(CPanningAwayFromParrotMsg, CTreeItem *, target, nullptr); +MESSAGE1(CPanningAwayFromParrotMsg, CMovePlayerTo *, target, nullptr); MESSAGE2(CParrotSpeakMsg, CString, target, "", CString, action, ""); MESSAGE2(CParrotTriesChickenMsg, int, value1, 0, int, value2, 0); MESSAGE1(CPhonographPlayMsg, int, value, 0); diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index e9aeba11cd..ac33277849 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -57,11 +57,11 @@ CParrot::CParrot() : CTrueTalkNPC() { _field118 = 1; _field11C = 25; _field120 = 0; - _field124 = 73; - _field128 = 58; + _newXp = 73; + _newXc = 58; _field12C = 0; _field130 = 0; - _field134 = nullptr; + _panTarget = nullptr; _field138 = 851; _field13C = 851; _field140 = 265; @@ -127,8 +127,8 @@ void CParrot::save(SimpleFile *file, int indent) { file->writeNumberLine(_field118, indent); file->writeNumberLine(_field11C, indent); file->writeNumberLine(_field120, indent); - file->writeNumberLine(_field124, indent); - file->writeNumberLine(_field128, indent); + file->writeNumberLine(_newXp, indent); + file->writeNumberLine(_newXc, indent); file->writeNumberLine(_field12C, indent); file->writeNumberLine(_field130, indent); file->writeNumberLine(_v4, indent); @@ -151,8 +151,8 @@ void CParrot::load(SimpleFile *file) { _field118 = file->readNumber(); _field11C = file->readNumber(); _field120 = file->readNumber(); - _field124 = file->readNumber(); - _field128 = file->readNumber(); + _newXp = file->readNumber(); + _newXc = file->readNumber(); _field12C = file->readNumber(); _field130 = file->readNumber(); _v4 = file->readNumber(); @@ -219,10 +219,10 @@ bool CParrot::MovieEndMsg(CMovieEndMsg *msg) { CActMsg actMsg1("LoseParrot"); actMsg1.execute("ParrotLobbyController"); - if (_field134) { + if (_panTarget) { CActMsg actMsg2("PanAwayFromParrot"); - actMsg2.execute(_field134); - _field134 = nullptr; + actMsg2.execute(_panTarget); + _panTarget = nullptr; } else { CActMsg actMsg2("Shut"); actMsg2.execute("ParrotCage"); @@ -243,7 +243,7 @@ bool CParrot::MovieEndMsg(CMovieEndMsg *msg) { int xp = _bounds.left + _bounds.width() / 2; if (_npcFlags & NPCFLAG_100000) { - if ((xp - _field128) > 32) { + if ((xp - _newXc) > 32) { setPosition(Point(_bounds.left - 40, _bounds.top)); playClip("Walk Left Loop", MOVIE_NOTIFY_OBJECT); movieEvent(236); @@ -253,7 +253,7 @@ bool CParrot::MovieEndMsg(CMovieEndMsg *msg) { _npcFlags = (_npcFlags & ~NPCFLAG_40000) | NPCFLAG_80000; } } else { - if ((_field128 - xp) > 32) { + if ((_newXc - xp) > 32) { playClip("Walk Right Loop", MOVIE_NOTIFY_OBJECT); movieEvent(244); } else { @@ -348,7 +348,7 @@ bool CParrot::EnterViewMsg(CEnterViewMsg *msg) { }; if (!_v4) { - setPosition(Point(_field124, _bounds.top)); + setPosition(Point(_newXp, _bounds.top)); _field118 = 1; _npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000); loadFrame(0); @@ -564,7 +564,7 @@ bool CParrot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) { } bool CParrot::FrameMsg(CFrameMsg *msg) { - if (compareViewNameTo("ParrotLobby.Node 1.N")) + if (!compareViewNameTo("ParrotLobby.Node 1.N")) return false; if (_v4) return true; @@ -574,12 +574,14 @@ bool CParrot::FrameMsg(CFrameMsg *msg) { int xp = _bounds.left + _bounds.width() / 2; if ((_npcFlags & NPCFLAG_400000) && !hasActiveMovie()) { - _field128 = xp - (_field124 + _bounds.width() / 2); + _newXc = _newXp + _bounds.width() / 2; + int xDiff = ABS(xp - _newXc); - if (xp < 64) { - if (_field134) { + if (xDiff < 64) { + if (_panTarget) { CActMsg actMsg("PanAwayFromParrot"); - actMsg.execute(_field134); + actMsg.execute(_panTarget); + _panTarget = nullptr; } _npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 @@ -601,14 +603,14 @@ bool CParrot::FrameMsg(CFrameMsg *msg) { return false; } - _field128 = CLIP((int)pt.x, 230, 480); + _newXc = CLIP((int)pt.x, 230, 480); if ((_npcFlags & NPCFLAG_10000) || hasActiveMovie()) return true; - if (_field128 > 64) { + if (_newXc > 64) { _npcFlags |= NPCFLAG_10000 | NPCFLAG_20000; - if (_field128 >= xp) { + if (_newXc >= xp) { setPosition(Point(_bounds.left + 30, _bounds.top)); _npcFlags |= NPCFLAG_200000; playClip("Walk Right Intro", MOVIE_NOTIFY_OBJECT); @@ -731,16 +733,16 @@ bool CParrot::PanningAwayFromParrotMsg(CPanningAwayFromParrotMsg *msg) { if (_v4) { CActMsg actMsg("PanAwayFromParrot"); actMsg.execute(msg->_target); - _field134 = 0; + _panTarget = nullptr; } else if (_v2) { - _field134 = msg->_target; + _panTarget = msg->_target; loadMovie("z168.avi", false); stopMovie(); playClip("Take Off", MOVIE_NOTIFY_OBJECT); _npcFlags |= NPCFLAG_2000000; } else { _npcFlags |= NPCFLAG_400000; - _field134 = msg->_target; + _panTarget = msg->_target; stopMovie(); } diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h index 93e0643857..54b16deea7 100644 --- a/engines/titanic/npcs/parrot.h +++ b/engines/titanic/npcs/parrot.h @@ -24,6 +24,7 @@ #define TITANIC_PARROT_H #include "titanic/npcs/true_talk_npc.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { @@ -57,11 +58,11 @@ private: int _field118; int _field11C; int _field120; - int _field124; - int _field128; + int _newXp; + int _newXc; int _field12C; int _field130; - CTreeItem *_field134; + CMovePlayerTo *_panTarget; int _field138; int _field13C; int _field140; |