[Scummvm-git-logs] scummvm master -> 41ee7dd3717e8ff5451314fe62468ae64e8879c3

dreammaster dreammaster at scummvm.org
Fri Aug 26 13:47:41 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
41ee7dd371 TITANIC: Implemented more game classes


Commit: 41ee7dd3717e8ff5451314fe62468ae64e8879c3
    https://github.com/scummvm/scummvm/commit/41ee7dd3717e8ff5451314fe62468ae64e8879c3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-26T07:47:31-04:00

Commit Message:
TITANIC: Implemented more game classes

Changed paths:
    engines/titanic/carry/nose.cpp
    engines/titanic/carry/nose.h
    engines/titanic/core/saveable_object.cpp
    engines/titanic/game/code_wheel.cpp
    engines/titanic/game/code_wheel.h
    engines/titanic/game/no_nut_bowl.cpp
    engines/titanic/game/no_nut_bowl.h
    engines/titanic/game/nose_holder.cpp
    engines/titanic/game/nose_holder.h
    engines/titanic/game/nut_replacer.cpp
    engines/titanic/game/nut_replacer.h
    engines/titanic/moves/pan_from_pel.cpp
    engines/titanic/moves/pan_from_pel.h



diff --git a/engines/titanic/carry/nose.cpp b/engines/titanic/carry/nose.cpp
index 4f3afe2..a08d02a 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 b688da2..6e5be30 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 5fc2d7e..6abf9c4 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 d8ce48e..94ee254 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 63af97c..e38a45b 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 47f9d79..8c0a95a 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 548b324..cd8bc65 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 cd9433e..ac6c10d 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 b8cca95..7b3fbba 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 9a73355..6b05d1d 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 ead9713..e2eed4e 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 fccc643..ca48e88 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 c81be9f..0a01aef 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();





More information about the Scummvm-git-logs mailing list