aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-26 07:47:31 -0400
committerPaul Gilbert2016-08-26 07:47:31 -0400
commit41ee7dd3717e8ff5451314fe62468ae64e8879c3 (patch)
treea4ccef80ac473336728b371e0e321e97213b7242
parente40caf40a17e50d9cab698eb9b806302e106f179 (diff)
downloadscummvm-rg350-41ee7dd3717e8ff5451314fe62468ae64e8879c3.tar.gz
scummvm-rg350-41ee7dd3717e8ff5451314fe62468ae64e8879c3.tar.bz2
scummvm-rg350-41ee7dd3717e8ff5451314fe62468ae64e8879c3.zip
TITANIC: Implemented more game classes
-rw-r--r--engines/titanic/carry/nose.cpp25
-rw-r--r--engines/titanic/carry/nose.h3
-rw-r--r--engines/titanic/core/saveable_object.cpp6
-rw-r--r--engines/titanic/game/code_wheel.cpp66
-rw-r--r--engines/titanic/game/code_wheel.h7
-rw-r--r--engines/titanic/game/no_nut_bowl.cpp21
-rw-r--r--engines/titanic/game/no_nut_bowl.h4
-rw-r--r--engines/titanic/game/nose_holder.cpp79
-rw-r--r--engines/titanic/game/nose_holder.h8
-rw-r--r--engines/titanic/game/nut_replacer.cpp16
-rw-r--r--engines/titanic/game/nut_replacer.h3
-rw-r--r--engines/titanic/moves/pan_from_pel.cpp20
-rw-r--r--engines/titanic/moves/pan_from_pel.h6
13 files changed, 251 insertions, 13 deletions
diff --git a/engines/titanic/carry/nose.cpp b/engines/titanic/carry/nose.cpp
index 4f3afe24ac..a08d02a88c 100644
--- a/engines/titanic/carry/nose.cpp
+++ b/engines/titanic/carry/nose.cpp
@@ -21,9 +21,15 @@
*/
#include "titanic/carry/nose.h"
+#include "titanic/game/head_slot.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CNose, CHeadPiece)
+ ON_MESSAGE(ChangeSeasonMsg)
+ ON_MESSAGE(UseWithOtherMsg)
+END_MESSAGE_MAP()
+
CNose::CNose() : CHeadPiece() {
}
@@ -37,4 +43,23 @@ void CNose::load(SimpleFile *file) {
CHeadPiece::load(file);
}
+bool CNose::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
+ // WORKAROUND: Redundant code in original skipped
+ return true;
+}
+
+bool CNose::UseWithOtherMsg(CUseWithOtherMsg *msg) {
+ CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
+ if (!slot)
+ return CCarry::UseWithOtherMsg(msg);
+
+ petMoveToHiddenRoom();
+ _flag = false;
+ CAddHeadPieceMsg addMsg(getName());
+ if (addMsg._value != "NULL")
+ addMsg.execute("NoseSlot");
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/nose.h b/engines/titanic/carry/nose.h
index b688da231a..6e5be30df2 100644
--- a/engines/titanic/carry/nose.h
+++ b/engines/titanic/carry/nose.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CNose : public CHeadPiece {
+ DECLARE_MESSAGE_MAP;
+ bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
+ bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CNose();
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 5fc2d7e738..6abf9c407a 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -165,6 +165,8 @@
#include "titanic/game/music_room_stop_phonograph_button.h"
#include "titanic/game/music_system_lock.h"
#include "titanic/game/nav_helmet.h"
+#include "titanic/game/nav_helmet_on.h"
+#include "titanic/game/nav_helmet_off.h"
#include "titanic/game/navigation_computer.h"
#include "titanic/game/no_nut_bowl.h"
#include "titanic/game/nose_holder.h"
@@ -575,6 +577,8 @@ DEFFN(CMusicRoomPhonograph);
DEFFN(CMusicRoomStopPhonographButton);
DEFFN(CMusicSystemLock);
DEFFN(CNavHelmet);
+DEFFN(CNavHelmetOn);
+DEFFN(CNavHelmetOff);
DEFFN(CNavigationComputer);
DEFFN(CNoNutBowl);
DEFFN(CNoseHolder);
@@ -1162,6 +1166,8 @@ void CSaveableObject::initClassList() {
ADDFN(CMusicRoomStopPhonographButton, CEjectPhonographButton);
ADDFN(CMusicSystemLock, CDropTarget);
ADDFN(CNavHelmet, CGameObject);
+ ADDFN(CNavHelmetOn, CGameObject);
+ ADDFN(CNavHelmetOff, CGameObject);
ADDFN(CNavigationComputer, CGameObject);
ADDFN(CNoNutBowl, CBackground);
ADDFN(CNoseHolder, CDropTarget);
diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp
index d8ce48e390..94ee25435a 100644
--- a/engines/titanic/game/code_wheel.cpp
+++ b/engines/titanic/game/code_wheel.cpp
@@ -24,13 +24,20 @@
namespace Titanic {
-CodeWheel::CodeWheel() : CBomb(), _field108(0), _field10C(4), _field110(0) {
+BEGIN_MESSAGE_MAP(CodeWheel, CBomb)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(MouseButtonUpMsg)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
+CodeWheel::CodeWheel() : CBomb(), _field108(0), _state(4), _field110(0) {
}
void CodeWheel::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field108, indent);
- file->writeNumberLine(_field10C, indent);
+ file->writeNumberLine(_state, indent);
file->writeNumberLine(_field110, indent);
CBomb::save(file, indent);
@@ -39,10 +46,63 @@ void CodeWheel::save(SimpleFile *file, int indent) {
void CodeWheel::load(SimpleFile *file) {
file->readNumber();
_field108 = file->readNumber();
- _field10C = file->readNumber();
+ _state = file->readNumber();
_field110 = file->readNumber();
CBomb::load(file);
}
+bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ static const int START_FRAMES[15] = {
+ 0, 5, 10, 15, 19, 24, 28, 33, 38, 42, 47, 52, 57, 61, 66
+ };
+ static const int END_FRAMES[15] = {
+ 5, 10, 15, 19, 24, 28, 33, 38, 42, 47, 52, 57, 61, 66, 70
+ };
+
+ int yp = _bounds.top + _bounds.height() / 2;
+ if (msg->_mousePos.y > yp) {
+ if (_state == _field108)
+ _field110 = true;
+
+ _state = (_state + 1) % 15;
+ playMovie(START_FRAMES[_state], END_FRAMES[_state],
+ MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
+ } else {
+ if (_state == _field108)
+ _field110 = true;
+
+ playMovie(START_FRAMES[14 - _state] + 68, END_FRAMES[14 - _state] + 68,
+ MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
+
+ _state = (_state <= 0) ? 14 : _state - 1;
+ }
+
+ playSound("z#59.wav");
+ return true;
+}
+
+bool CodeWheel::EnterViewMsg(CEnterViewMsg *msg) {
+ loadFrame(24);
+ _state = 4;
+ return true;
+}
+
+bool CodeWheel::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ return true;
+}
+
+bool CodeWheel::MovieEndMsg(CMovieEndMsg *msg) {
+ sleep(200);
+ CStatusChangeMsg changeMsg;
+ changeMsg._newStatus = 0;
+ if (_field110)
+ changeMsg._newStatus = -1;
+ if (_field108 == _state)
+ changeMsg._newStatus = 1;
+ changeMsg.execute("Bomb");
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h
index 63af97c6fb..e38a45b631 100644
--- a/engines/titanic/game/code_wheel.h
+++ b/engines/titanic/game/code_wheel.h
@@ -28,9 +28,14 @@
namespace Titanic {
class CodeWheel : public CBomb {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
private:
int _field108;
- int _field10C;
+ int _state;
int _field110;
public:
CLASSDEF;
diff --git a/engines/titanic/game/no_nut_bowl.cpp b/engines/titanic/game/no_nut_bowl.cpp
index 47f9d7901e..8c0a95ac9a 100644
--- a/engines/titanic/game/no_nut_bowl.cpp
+++ b/engines/titanic/game/no_nut_bowl.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CNoNutBowl, CBackground)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(ReplaceBowlAndNutsMsg)
+ ON_MESSAGE(NutPuzzleMsg)
+END_MESSAGE_MAP()
+
void CNoNutBowl::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CBackground::save(file, indent);
@@ -34,4 +40,19 @@ void CNoNutBowl::load(SimpleFile *file) {
CBackground::load(file);
}
+bool CNoNutBowl::ActMsg(CActMsg *msg) {
+ return true;
+}
+
+bool CNoNutBowl::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) {
+ setVisible(false);
+ return true;
+}
+
+bool CNoNutBowl::NutPuzzleMsg(CNutPuzzleMsg *msg) {
+ if (msg->_value == "NutsGone")
+ setVisible(true);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/no_nut_bowl.h b/engines/titanic/game/no_nut_bowl.h
index 548b324869..cd8bc65179 100644
--- a/engines/titanic/game/no_nut_bowl.h
+++ b/engines/titanic/game/no_nut_bowl.h
@@ -28,6 +28,10 @@
namespace Titanic {
class CNoNutBowl : public CBackground {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
+ bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg);
+ bool NutPuzzleMsg(CNutPuzzleMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/game/nose_holder.cpp b/engines/titanic/game/nose_holder.cpp
index cd9433ee9c..ac6c10dafd 100644
--- a/engines/titanic/game/nose_holder.cpp
+++ b/engines/titanic/game/nose_holder.cpp
@@ -24,7 +24,16 @@
namespace Titanic {
-CNoseHolder::CNoseHolder() : CDropTarget(), _field118(0), _field11C(0) {
+BEGIN_MESSAGE_MAP(CNoseHolder, CDropTarget)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(FrameMsg)
+ ON_MESSAGE(LeaveViewMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
+CNoseHolder::CNoseHolder() : CDropTarget(), _dragObject(nullptr),
+ _field11C(0) {
}
void CNoseHolder::save(SimpleFile *file, int indent) {
@@ -41,4 +50,72 @@ void CNoseHolder::load(SimpleFile *file) {
CDropTarget::load(file);
}
+bool CNoseHolder::ActMsg(CActMsg *msg) {
+ if (msg->_action == "Sneeze" && !_itemName.empty() && _fieldF4) {
+ CProximity prox;
+ prox._positioningMode = POSMODE_VECTOR;
+ playSound("z#35.wav", prox);
+
+ if (getView() == findView()) {
+ setVisible(true);
+ playMovie(1, 13, MOVIE_NOTIFY_OBJECT);
+ }
+ }
+
+ return true;
+}
+
+bool CNoseHolder::FrameMsg(CFrameMsg *msg) {
+ if (!_dragObject) {
+ CGameObject *dragObj = getDraggingObject();
+ if (!dragObj)
+ return false;
+
+ if (!dragObj->isEquals("Feathers") || getView() != findView())
+ return false;
+
+ _dragObject = dragObj;
+ }
+
+ if (_dragObject) {
+ if (!checkPoint(Point(_dragObject->_bounds.left,
+ _dragObject->_bounds.top))) {
+ _field11C = false;
+ } else if (!_field11C) {
+ CActMsg actMsg("Sneeze");
+ actMsg.execute(this);
+ _field11C = true;
+ }
+ }
+
+ return true;
+}
+
+bool CNoseHolder::LeaveViewMsg(CLeaveViewMsg *msg) {
+ _field11C = false;
+ _dragObject = nullptr;
+ if (_fieldF4) {
+ loadFrame(_dropFrame);
+ setVisible(false);
+ }
+
+ return true;
+}
+
+bool CNoseHolder::MovieEndMsg(CMovieEndMsg *msg) {
+ if (_fieldF4) {
+ loadFrame(_dropFrame);
+ setVisible(false);
+ }
+
+ return true;
+}
+
+bool CNoseHolder::EnterViewMsg(CEnterViewMsg *msg) {
+ if (_fieldF4)
+ setVisible(false);
+
+ return CDropTarget::EnterViewMsg(msg);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/nose_holder.h b/engines/titanic/game/nose_holder.h
index b8cca95869..7b3fbba625 100644
--- a/engines/titanic/game/nose_holder.h
+++ b/engines/titanic/game/nose_holder.h
@@ -28,8 +28,14 @@
namespace Titanic {
class CNoseHolder : public CDropTarget {
+ DECLARE_MESSAGE_MAP;
+ bool ActMsg(CActMsg *msg);
+ bool FrameMsg(CFrameMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
private:
- int _field118;
+ CGameObject *_dragObject;
int _field11C;
public:
CLASSDEF;
diff --git a/engines/titanic/game/nut_replacer.cpp b/engines/titanic/game/nut_replacer.cpp
index 9a73355c91..6b05d1d0e9 100644
--- a/engines/titanic/game/nut_replacer.cpp
+++ b/engines/titanic/game/nut_replacer.cpp
@@ -24,6 +24,11 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CNutReplacer, CGameObject)
+ ON_MESSAGE(ReplaceBowlAndNutsMsg)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
void CNutReplacer::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGameObject::save(file, indent);
@@ -34,4 +39,15 @@ void CNutReplacer::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CNutReplacer::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) {
+ setVisible(true);
+ playMovie(MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
+ return true;
+}
+
+bool CNutReplacer::MovieEndMsg(CMovieEndMsg *msg) {
+ setVisible(false);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/nut_replacer.h b/engines/titanic/game/nut_replacer.h
index ead9713801..e2eed4e247 100644
--- a/engines/titanic/game/nut_replacer.h
+++ b/engines/titanic/game/nut_replacer.h
@@ -28,6 +28,9 @@
namespace Titanic {
class CNutReplacer : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/moves/pan_from_pel.cpp b/engines/titanic/moves/pan_from_pel.cpp
index fccc643ec5..ca48e888c1 100644
--- a/engines/titanic/moves/pan_from_pel.cpp
+++ b/engines/titanic/moves/pan_from_pel.cpp
@@ -24,23 +24,33 @@
namespace Titanic {
-CPanFromPel::CPanFromPel() : CMovePlayerTo(), _fieldC8(0) {
+BEGIN_MESSAGE_MAP(CPanFromPel, CMovePlayerTo)
+ ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
+CPanFromPel::CPanFromPel() : CMovePlayerTo(), _closeLeft(false) {
}
void CPanFromPel::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldC8, indent);
- file->writeQuotedLine(_string1, indent);
+ file->writeNumberLine(_closeLeft, indent);
+ file->writeQuotedLine(_target, indent);
CMovePlayerTo::save(file, indent);
}
void CPanFromPel::load(SimpleFile *file) {
file->readNumber();
- _fieldC8 = file->readNumber();
- _string1 = file->readString();
+ _closeLeft = file->readNumber();
+ _target = file->readString();
CMovePlayerTo::load(file);
}
+bool CPanFromPel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ CActMsg actMsg(_closeLeft ? "CloseLeft" : "CloseRight");
+ actMsg.execute(_target);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/moves/pan_from_pel.h b/engines/titanic/moves/pan_from_pel.h
index c81be9f338..0a01aefea3 100644
--- a/engines/titanic/moves/pan_from_pel.h
+++ b/engines/titanic/moves/pan_from_pel.h
@@ -28,9 +28,11 @@
namespace Titanic {
class CPanFromPel : public CMovePlayerTo {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
protected:
- int _fieldC8;
- CString _string1;
+ bool _closeLeft;
+ CString _target;
public:
CLASSDEF;
CPanFromPel();