[Scummvm-cvs-logs] scummvm master -> 6a9923ec07d019cbbf8c35e36030391dac256e79

dreammaster dreammaster at scummvm.org
Sat Aug 13 05:53:24 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:
6a9923ec07 TITANIC: Implemented some game object classes


Commit: 6a9923ec07d019cbbf8c35e36030391dac256e79
    https://github.com/scummvm/scummvm/commit/6a9923ec07d019cbbf8c35e36030391dac256e79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-12T23:53:18-04:00

Commit Message:
TITANIC: Implemented some game object classes

Changed paths:
    engines/titanic/carry/auditory_centre.cpp
    engines/titanic/carry/auditory_centre.h
    engines/titanic/game/annoy_barbot.cpp
    engines/titanic/game/annoy_barbot.h
    engines/titanic/game/auto_animate.cpp
    engines/titanic/game/auto_animate.h
    engines/titanic/game/bar_bell.cpp
    engines/titanic/game/bar_bell.h
    engines/titanic/messages/auto_sound_event.cpp
    engines/titanic/messages/auto_sound_event.h



diff --git a/engines/titanic/carry/auditory_centre.cpp b/engines/titanic/carry/auditory_centre.cpp
index d88989a..0bda975 100644
--- a/engines/titanic/carry/auditory_centre.cpp
+++ b/engines/titanic/carry/auditory_centre.cpp
@@ -24,6 +24,10 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CAuditoryCentre, CBrain)
+	ON_MESSAGE(PuzzleSolvedMsg)
+END_MESSAGE_MAP()
+
 void CAuditoryCentre::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CBrain::save(file, indent);
@@ -34,4 +38,10 @@ void CAuditoryCentre::load(SimpleFile *file) {
 	CBrain::load(file);
 }
 
+bool CAuditoryCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
+	_fieldE0 = 1;
+	setVisible(true);
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h
index 743f8f2..6f24e86 100644
--- a/engines/titanic/carry/auditory_centre.h
+++ b/engines/titanic/carry/auditory_centre.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CAuditoryCentre : public CBrain {
+	DECLARE_MESSAGE_MAP;
+	bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/annoy_barbot.cpp b/engines/titanic/game/annoy_barbot.cpp
index d69d9ff..8b22f9c 100644
--- a/engines/titanic/game/annoy_barbot.cpp
+++ b/engines/titanic/game/annoy_barbot.cpp
@@ -26,6 +26,10 @@ namespace Titanic {
 
 int CAnnoyBarbot::_v1;
 
+BEGIN_MESSAGE_MAP(CAnnoyBarbot, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
 void CAnnoyBarbot::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeNumberLine(_v1, indent);
@@ -38,4 +42,13 @@ void CAnnoyBarbot::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CAnnoyBarbot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if ((++_v1 % 3) == 1) {
+		CActMsg actMsg("GoRingBell");
+		actMsg.execute("Barbot");
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h
index 955a82b..0ccfe43 100644
--- a/engines/titanic/game/annoy_barbot.h
+++ b/engines/titanic/game/annoy_barbot.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CAnnoyBarbot : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 private:
 	static int _v1;
 public:
diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp
index 172b8c4..16e6e56 100644
--- a/engines/titanic/game/auto_animate.cpp
+++ b/engines/titanic/game/auto_animate.cpp
@@ -24,24 +24,44 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CAutoAnimate, CBackground)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(InitializeAnimMsg)
+END_MESSAGE_MAP()
+
 void CAutoAnimate::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldE0, indent);
+	file->writeNumberLine(_enabled, indent);
 	file->writeNumberLine(_fieldE4, indent);
-	file->writeNumberLine(_fieldE8, indent);
+	file->writeNumberLine(_repeat, indent);
 	CBackground::save(file, indent);
 }
 
 void CAutoAnimate::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldE0 = file->readNumber();
+	_enabled = file->readNumber();
 	_fieldE4 = file->readNumber();
-	_fieldE8 = file->readNumber();
+	_repeat = file->readNumber();
 	CBackground::load(file);
 }
 
 bool CAutoAnimate::EnterViewMsg(CEnterViewMsg *msg) {
-	warning("CAutoAnimate::handleEvent");
+	if (_enabled) {
+		uint flags = _repeat ? MOVIE_REPEAT : 0;
+		if (_startFrame != _endFrame)
+			playMovie(_startFrame, _endFrame, flags);
+		else
+			playMovie(flags);
+
+		if (!_fieldE4)
+			_enabled = false;
+	}
+
+	return true;
+}
+
+bool CAutoAnimate::InitializeAnimMsg(CInitializeAnimMsg *msg) {
+	_enabled = true;
 	return true;
 }
 
diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h
index 7bca808..735aba9 100644
--- a/engines/titanic/game/auto_animate.h
+++ b/engines/titanic/game/auto_animate.h
@@ -29,14 +29,16 @@
 namespace Titanic {
 
 class CAutoAnimate : public CBackground {
+	DECLARE_MESSAGE_MAP;
 	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool InitializeAnimMsg(CInitializeAnimMsg *msg);
 private:
-	int _fieldE0;
+	bool _enabled;
 	int _fieldE4;
-	int _fieldE8;
+	bool _repeat;
 public:
 	CLASSDEF;
-	CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {}
+	CAutoAnimate() : CBackground(), _enabled(true), _fieldE4(1), _repeat(false) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp
index b33ee1c..207644a 100644
--- a/engines/titanic/game/bar_bell.cpp
+++ b/engines/titanic/game/bar_bell.cpp
@@ -24,15 +24,22 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CBarBell, CGameObject)
+	ON_MESSAGE(EnterRoomMsg)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(MouseButtonUpMsg)
+	ON_MESSAGE(ActMsg)
+END_MESSAGE_MAP()
+
 CBarBell::CBarBell() : CGameObject(), _fieldBC(0),
-	_fieldC0(65), _fieldC4(0), _fieldC8(0), _fieldCC(0) {
+	_volume(65), _soundVal3(0), _fieldC8(0), _fieldCC(0) {
 }
 
 void CBarBell::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeNumberLine(_fieldBC, indent);
-	file->writeNumberLine(_fieldC0, indent);
-	file->writeNumberLine(_fieldC4, indent);
+	file->writeNumberLine(_volume, indent);
+	file->writeNumberLine(_soundVal3, indent);
 	file->writeNumberLine(_fieldC8, indent);
 	file->writeNumberLine(_fieldCC, indent);
 
@@ -42,8 +49,8 @@ void CBarBell::save(SimpleFile *file, int indent) {
 void CBarBell::load(SimpleFile *file) {
 	file->readNumber();
 	_fieldBC = file->readNumber();
-	_fieldC0 = file->readNumber();
-	_fieldC4 = file->readNumber();
+	_volume = file->readNumber();
+	_soundVal3 = file->readNumber();
 	_fieldC8 = file->readNumber();
 	_fieldCC = file->readNumber();
 
@@ -55,4 +62,70 @@ bool CBarBell::EnterRoomMsg(CEnterRoomMsg *msg) {
 	return true;
 }
 
+bool CBarBell::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if ((_fieldC8 % 3) == 2) {
+		switch (_fieldBC) {
+		case 0:
+		case 1:
+		case 5:
+			playSound("c#54.wav", _volume, _soundVal3);
+			break;
+
+		case 2:
+			playSound("c#52.wav", _volume, _soundVal3);
+			break;
+
+		case 3:
+			playSound("c#53.wav", _volume, _soundVal3);
+			break;
+
+		case 4:
+			playSound("c#55.wav", _volume, _soundVal3);
+			break;
+
+		default:
+			playSound("c#51.wav", _volume, _soundVal3);
+			break;
+		}
+	} else if (_fieldBC >= 5) {
+		if (_fieldBC == 6) {
+			CActMsg actMsg("BellRing3");
+			actMsg.execute("Barbot");
+		}
+
+		playSound("c#51.wav", _volume, _soundVal3);
+	} else {
+		if (_fieldBC == 3) {
+			CActMsg actMsg("BellRing1");
+			actMsg.execute("Barbot");
+		} else if (_fieldBC == 4) {
+			CActMsg actMsg("BellRing2");
+			actMsg.execute("Barbot");
+		}
+
+		playSound("c#54.wav", _volume, _soundVal3);
+	}
+
+	return true;
+}
+
+bool CBarBell::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+	if (!_fieldBC) {
+		CTurnOn onMsg;
+		onMsg.execute("Barbot");
+	}
+
+	++_fieldBC;
+	return 2;
+}
+
+bool CBarBell::ActMsg(CActMsg *msg) {
+	if (msg->_action == "ResetCount") {
+		_fieldBC = 0;
+		++_fieldC8;
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h
index 5d1d2c5..b50fe50 100644
--- a/engines/titanic/game/bar_bell.h
+++ b/engines/titanic/game/bar_bell.h
@@ -29,11 +29,15 @@
 namespace Titanic {
 
 class CBarBell : public CGameObject {
+	DECLARE_MESSAGE_MAP;
 	bool EnterRoomMsg(CEnterRoomMsg *msg);
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+	bool ActMsg(CActMsg *msg);
 public:
 	int _fieldBC;
-	int _fieldC0;
-	int _fieldC4;
+	int _volume;
+	int _soundVal3;
 	int _fieldC8;
 	int _fieldCC;
 public:
diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp
index baa11c7..bc2cd7d 100644
--- a/engines/titanic/messages/auto_sound_event.cpp
+++ b/engines/titanic/messages/auto_sound_event.cpp
@@ -24,7 +24,11 @@
 
 namespace Titanic {
 
-CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(70) {
+BEGIN_MESSAGE_MAP(CAutoSoundEvent, CGameObject)
+	ON_MESSAGE(FrameMsg)
+END_MESSAGE_MAP()
+
+CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(0xFFFFFF) {
 }
 
 void CAutoSoundEvent::save(SimpleFile *file, int indent) {
@@ -43,4 +47,11 @@ void CAutoSoundEvent::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CAutoSoundEvent::FrameMsg(CFrameMsg *msg) {
+	if (_value1 >= 0)
+		_value1 = (_value1 + 1) & _value2;
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h
index eb1c11c..d889767 100644
--- a/engines/titanic/messages/auto_sound_event.h
+++ b/engines/titanic/messages/auto_sound_event.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CAutoSoundEvent : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool FrameMsg(CFrameMsg *msg);
 public:
 	int _value1;
 	int _value2;






More information about the Scummvm-git-logs mailing list