[Scummvm-cvs-logs] scummvm master -> 04242118ca7bca31aa9659ffceaf80702bc90fb8

dreammaster dreammaster at scummvm.org
Sat Aug 20 21:11:14 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:
04242118ca TITANIC: Implemented more game classes


Commit: 04242118ca7bca31aa9659ffceaf80702bc90fb8
    https://github.com/scummvm/scummvm/commit/04242118ca7bca31aa9659ffceaf80702bc90fb8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-20T15:11:07-04:00

Commit Message:
TITANIC: Implemented more game classes

Changed paths:
    engines/titanic/game/sgt/sgt_navigation.cpp
    engines/titanic/game/sgt/sgt_navigation.h
    engines/titanic/moves/enter_exit_first_class_state.cpp
    engines/titanic/moves/enter_exit_first_class_state.h
    engines/titanic/moves/enter_exit_mini_lift.cpp
    engines/titanic/moves/enter_exit_mini_lift.h
    engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
    engines/titanic/moves/enter_exit_sec_class_mini_lift.h
    engines/titanic/moves/enter_exit_view.cpp
    engines/titanic/moves/enter_exit_view.h
    engines/titanic/moves/enter_sec_class_state.cpp
    engines/titanic/moves/enter_sec_class_state.h
    engines/titanic/support/string.cpp
    engines/titanic/support/string.h



diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp
index d0c3084..7bb64f9 100644
--- a/engines/titanic/game/sgt/sgt_navigation.cpp
+++ b/engines/titanic/game/sgt/sgt_navigation.cpp
@@ -36,18 +36,18 @@ void CSGTNavigation::deinit() {
 
 void CSGTNavigation::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_statics->_v1, indent);
-	file->writeQuotedLine(_statics->_v2, indent);
-	file->writeQuotedLine(_statics->_v3, indent);
+	file->writeNumberLine(_statics->_changeViewFlag, indent);
+	file->writeQuotedLine(_statics->_destView, indent);
+	file->writeQuotedLine(_statics->_destRoom, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CSGTNavigation::load(SimpleFile *file) {
 	file->readNumber();
-	_statics->_v1 = file->readNumber();
-	_statics->_v2 = file->readString();
-	_statics->_v3 = file->readString();
+	_statics->_changeViewFlag = file->readNumber();
+	_statics->_destView = file->readString();
+	_statics->_destRoom = file->readString();
 
 	CGameObject::load(file);
 }
diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h
index 6d24fe6..ed58d91 100644
--- a/engines/titanic/game/sgt/sgt_navigation.h
+++ b/engines/titanic/game/sgt/sgt_navigation.h
@@ -28,13 +28,13 @@
 namespace Titanic {
 
 struct CSGTNavigationStatics {
-	int _v1;
-	CString _v2;
-	CString _v3;
+	bool _changeViewFlag;
+	CString _destView;
+	CString _destRoom;
 };
 
 class CSGTNavigation : public CGameObject {
-private:
+protected:
 	static CSGTNavigationStatics *_statics;
 public:
 	CLASSDEF;
diff --git a/engines/titanic/moves/enter_exit_first_class_state.cpp b/engines/titanic/moves/enter_exit_first_class_state.cpp
index 0e2c6c0..34e9984 100644
--- a/engines/titanic/moves/enter_exit_first_class_state.cpp
+++ b/engines/titanic/moves/enter_exit_first_class_state.cpp
@@ -24,26 +24,44 @@
 
 namespace Titanic {
 
-CString *CEnterExitFirstClassState::_v1;
-
-void CEnterExitFirstClassState::init() {
-	_v1 = new CString();
-}
-
-void CEnterExitFirstClassState::deinit() {
-	delete _v1;
-}
+BEGIN_MESSAGE_MAP(CEnterExitFirstClassState, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
 
 void CEnterExitFirstClassState::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(*_v1, indent);
+	file->writeQuotedLine(_viewName, indent);
 	CGameObject::save(file, indent);
 }
 
 void CEnterExitFirstClassState::load(SimpleFile *file) {
 	file->readNumber();
-	*_v1 = file->readString();
+	_viewName = file->readString();
 	CGameObject::load(file);
 }
 
+bool CEnterExitFirstClassState::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	switch (getPassengerClass()) {
+	case 1:
+		if (compareRoomNameTo("1stClassLobby")) {
+			_viewName = getRoomNodeName() + ".E";
+			changeView(_viewName);
+		} else if (compareRoomNameTo("1stClassState")) {
+			changeView(_viewName);
+		}
+		break;
+
+	case 2:
+		petDisplayMessage(1, "This room is reserved for the exclusive use of first class passengeres."
+			" That does not currently include you");
+		break;
+
+	default:
+		petDisplayMessage("No losers.");
+		break;
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/enter_exit_first_class_state.h b/engines/titanic/moves/enter_exit_first_class_state.h
index a08de07..fe63e55 100644
--- a/engines/titanic/moves/enter_exit_first_class_state.h
+++ b/engines/titanic/moves/enter_exit_first_class_state.h
@@ -28,18 +28,10 @@
 namespace Titanic {
 
 class CEnterExitFirstClassState : public CGameObject {
-public:
-	static CString *_v1;
-
-	/**
-	 * Initialize static data
-	 */
-	static void init();
-
-	/**
-	 * De-initialize static data
-	 */
-	static void deinit();
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+private:
+	CString _viewName;
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/moves/enter_exit_mini_lift.cpp b/engines/titanic/moves/enter_exit_mini_lift.cpp
index eb56bdb..e626d70 100644
--- a/engines/titanic/moves/enter_exit_mini_lift.cpp
+++ b/engines/titanic/moves/enter_exit_mini_lift.cpp
@@ -21,23 +21,52 @@
  */
 
 #include "titanic/moves/enter_exit_mini_lift.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CEnterExitMiniLift, CSGTNavigation)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
 void CEnterExitMiniLift::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeNumberLine(_fieldBC, indent);
-	file->writeNumberLine(_fieldC0, indent);
-	
+	file->writeNumberLine(_destRoomNum, indent);
+
 	CSGTNavigation::save(file, indent);
 }
 
 void CEnterExitMiniLift::load(SimpleFile *file) {
 	file->readNumber();
 	_fieldBC = file->readNumber();
-	_fieldC0 = file->readNumber();
+	_destRoomNum = file->readNumber();
 
 	CSGTNavigation::load(file);
 }
 
+bool CEnterExitMiniLift::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (compareRoomNameTo("SgtLobby")) {
+		_statics->_destView = getRoomNodeName() + ".S";
+		_statics->_destRoom = "SgtLobby";
+		changeView("SGTLittleLift.Node 1.E");
+
+		CPetControl *pet = getPetControl();
+		if (pet)
+			pet->setRoomsRoomNum(_destRoomNum);
+	} else if (compareRoomNameTo("SGTLittleLift")) {
+		if (_statics->_changeViewFlag) {
+			changeView(_statics->_destView);
+		}
+	}
+
+	return true;
+}
+
+bool CEnterExitMiniLift::EnterViewMsg(CEnterViewMsg *msg) {
+	_cursorId = _statics->_changeViewFlag ? CURSOR_MOVE_FORWARD : CURSOR_INVALID;
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/enter_exit_mini_lift.h b/engines/titanic/moves/enter_exit_mini_lift.h
index 26f3dba..f2671a8 100644
--- a/engines/titanic/moves/enter_exit_mini_lift.h
+++ b/engines/titanic/moves/enter_exit_mini_lift.h
@@ -28,12 +28,15 @@
 namespace Titanic {
 
 class CEnterExitMiniLift : public CSGTNavigation {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool EnterViewMsg(CEnterViewMsg *msg);
 private:
 	int _fieldBC;
-	int _fieldC0;
+	int _destRoomNum;
 public:
 	CLASSDEF;
-	CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _fieldC0(1) {}
+	CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _destRoomNum(1) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
index b571a25..c7e16ef 100644
--- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
+++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
@@ -21,9 +21,15 @@
  */
 
 #include "titanic/moves/enter_exit_sec_class_mini_lift.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CEnterExitSecClassMiniLift, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
+
 CEnterExitSecClassMiniLiftStatics *CEnterExitSecClassMiniLift::_statics;
 
 void CEnterExitSecClassMiniLift::init() {
@@ -36,20 +42,53 @@ void CEnterExitSecClassMiniLift::deinit() {
 
 void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(_statics->_v1, indent);
-	file->writeNumberLine(_statics->_v2, indent);
-	file->writeNumberLine(_value, indent);
+	file->writeQuotedLine(_statics->_viewName, indent);
+	file->writeNumberLine(_statics->_state, indent);
+	file->writeNumberLine(_roomNum, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CEnterExitSecClassMiniLift::load(SimpleFile *file) {
 	file->readNumber();
-	_statics->_v1 = file->readString();
-	_statics->_v2 = file->readNumber();
-	_value = file->readNumber();
+	_statics->_viewName = file->readString();
+	_statics->_state = file->readNumber();
+	_roomNum = file->readNumber();
 
 	CGameObject::load(file);
 }
 
+bool CEnterExitSecClassMiniLift::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (compareRoomNameTo("2ndClassLobby")) {
+		_statics->_viewName = getRoomNodeName() + ".W";
+		changeView("SecClassLittleLift.Node 1.E");
+		_statics->_state = 1;
+		
+		CPetControl *pet = getPetControl();
+		if (pet) {
+			pet->setRoomsRoomNum(_roomNum);
+			pet->setRooms1CC(1);
+		}
+	} else if (compareRoomNameTo("SecClassLittleLift")) {
+		if (_statics->_state == 1) {
+			changeView(_statics->_viewName);
+		}
+	}
+
+	return true;
+}
+
+bool CEnterExitSecClassMiniLift::StatusChangeMsg(CStatusChangeMsg *msg) {
+	_statics->_state = msg->_newStatus;
+	if (msg->_newStatus == 3)
+		_statics->_state = 2;
+
+	CPetControl *pet = getPetControl();
+	if (pet)
+		pet->setRooms1CC(_statics->_state);
+
+	_cursorId = _statics->_state == 1 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID;
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h
index 10c7edc..839d2c0 100644
--- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h
+++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h
@@ -28,19 +28,22 @@
 namespace Titanic {
 
 struct CEnterExitSecClassMiniLiftStatics {
-	CString _v1;
-	int _v2;
+	CString _viewName;
+	int _state;
 
-	CEnterExitSecClassMiniLiftStatics() : _v2(1) {}
+	CEnterExitSecClassMiniLiftStatics() : _state(1) {}
 };
 
 class CEnterExitSecClassMiniLift : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
 private:
 	static CEnterExitSecClassMiniLiftStatics *_statics;
-	int _value;
+	int _roomNum;
 public:
 	CLASSDEF;
-	CEnterExitSecClassMiniLift() : CGameObject(), _value(0) {}
+	CEnterExitSecClassMiniLift() : CGameObject(), _roomNum(0) {}
 	static void init();
 	static void deinit();
 	
diff --git a/engines/titanic/moves/enter_exit_view.cpp b/engines/titanic/moves/enter_exit_view.cpp
index 825156a..6778ebb 100644
--- a/engines/titanic/moves/enter_exit_view.cpp
+++ b/engines/titanic/moves/enter_exit_view.cpp
@@ -24,30 +24,55 @@
 
 namespace Titanic {
 
-CEnterExitView::CEnterExitView() : CGameObject(), _fieldBC(0),
-	_fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) {
+BEGIN_MESSAGE_MAP(CEnterExitView, CGameObject)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(LeaveViewMsg)
+	ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
+CEnterExitView::CEnterExitView() : CGameObject(), _leaveEndFrame(0),
+	_leaveStartFrame(0), _enterEndFrame(0), _enterStartFrame(0), 
+	_visibleAfterMovie(true) {
 }
 
 void CEnterExitView::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldBC, indent);
-	file->writeNumberLine(_fieldC0, indent);
-	file->writeNumberLine(_fieldC4, indent);
-	file->writeNumberLine(_fieldC8, indent);
-	file->writeNumberLine(_fieldCC, indent);
+	file->writeNumberLine(_leaveEndFrame, indent);
+	file->writeNumberLine(_leaveStartFrame, indent);
+	file->writeNumberLine(_enterEndFrame, indent);
+	file->writeNumberLine(_enterStartFrame, indent);
+	file->writeNumberLine(_visibleAfterMovie, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CEnterExitView::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldBC = file->readNumber();
-	_fieldC0 = file->readNumber();
-	_fieldC4 = file->readNumber();
-	_fieldC8 = file->readNumber();
-	_fieldCC = file->readNumber();
+	_leaveEndFrame = file->readNumber();
+	_leaveStartFrame = file->readNumber();
+	_enterEndFrame = file->readNumber();
+	_enterStartFrame = file->readNumber();
+	_visibleAfterMovie = file->readNumber();
 
 	CGameObject::load(file);
 }
 
+bool CEnterExitView::EnterViewMsg(CEnterViewMsg *msg) {
+	setVisible(true);
+	playMovie(_enterStartFrame, _enterEndFrame, MOVIE_NOTIFY_OBJECT);
+	return true;
+}
+
+bool CEnterExitView::LeaveViewMsg(CLeaveViewMsg *msg) {
+	setVisible(true);
+	playMovie(_leaveStartFrame, _leaveEndFrame, MOVIE_NOTIFY_OBJECT);
+	return true;
+}
+
+bool CEnterExitView::MovieEndMsg(CMovieEndMsg *msg) {
+	if (!_visibleAfterMovie)
+		setVisible(false);
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/enter_exit_view.h b/engines/titanic/moves/enter_exit_view.h
index 4a3f1a9..67aa564 100644
--- a/engines/titanic/moves/enter_exit_view.h
+++ b/engines/titanic/moves/enter_exit_view.h
@@ -28,12 +28,16 @@
 namespace Titanic {
 
 class CEnterExitView : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool LeaveViewMsg(CLeaveViewMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
 public:
-	int _fieldBC;
-	int _fieldC0;
-	int _fieldC4;
-	int _fieldC8;
-	int _fieldCC;
+	int _leaveEndFrame;
+	int _leaveStartFrame;
+	int _enterEndFrame;
+	int _enterStartFrame;
+	bool _visibleAfterMovie;
 public:
 	CLASSDEF;
 	CEnterExitView();
diff --git a/engines/titanic/moves/enter_sec_class_state.cpp b/engines/titanic/moves/enter_sec_class_state.cpp
index dced724..406803b 100644
--- a/engines/titanic/moves/enter_sec_class_state.cpp
+++ b/engines/titanic/moves/enter_sec_class_state.cpp
@@ -21,23 +21,88 @@
  */
 
 #include "titanic/moves/enter_sec_class_state.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CEnterSecClassState, CGameObject)
+	ON_MESSAGE(MouseButtonDownMsg)
+	ON_MESSAGE(StatusChangeMsg)
+	ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
 void CEnterSecClassState::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_value1, indent);
-	file->writeNumberLine(_value2, indent);
+	file->writeNumberLine(_mode, indent);
+	file->writeNumberLine(_soundHandle, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CEnterSecClassState::load(SimpleFile *file) {
 	file->readNumber();
-	_value1 = file->readNumber();
-	_value2 = file->readNumber();
+	_mode = file->readNumber();
+	_soundHandle = file->readNumber();
 
 	CGameObject::load(file);
 }
 
+bool CEnterSecClassState::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+	if (getPassengerClass() > 2) {
+		playSound("b#105.wav");
+		petDisplayMessage(1, "Passengers of your class are not permitted to enter this area.");
+	} else if (!compareRoomNameTo("SecClassLittleLift") || _mode == 2)  {
+		CActMsg actMsg(getFullViewName().deleteRight(3) + ".S");
+		actMsg.execute("SecClassRoomLeaver");
+		changeView("secClassState.Node 01.N");
+	}
+
+	return true;
+}
+
+bool CEnterSecClassState::StatusChangeMsg(CStatusChangeMsg *msg) {
+	stopSound(_soundHandle);
+
+	if (msg->_newStatus == _mode || (_mode == 2 && msg->_newStatus == 3)) {
+		if (_mode == 2) {
+			_soundHandle = queueSound("b#36.wav", _soundHandle);
+		} else {
+			_soundHandle = queueSound("b#31.wav", _soundHandle);
+		}
+		if (msg->_newStatus == 3)
+			msg->_newStatus == 2;
+	} else {
+		changeView("SecClassLittleLift.Node 1.N");
+		if (msg->_newStatus == 1) {
+			_soundHandle = queueSound("b#32.wav", _soundHandle);
+		} else if (msg->_newStatus == 2) {
+			_soundHandle = queueSound("b#25.wav", _soundHandle);
+		} else if (msg->_newStatus == 3) {
+			_soundHandle = queueSound("b#33.wav", _soundHandle);
+			msg->_newStatus = 2;
+		}
+	}
+
+	if (msg->_newStatus != 3) {
+		if (msg->_newStatus == 2 && _mode == 1)
+			playMovie(0, 10, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+		else if (msg->_newStatus == 1)
+			playMovie(11, 21, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+	}
+
+	_cursorId = msg->_newStatus == 2 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID;
+	_mode = msg->_newStatus;
+	return true;
+}
+
+bool CEnterSecClassState::MovieEndMsg(CMovieEndMsg *msg) {
+	CPetControl *pet = getPetControl();
+	if (pet) {
+		pet->setRooms1CC(_mode);
+		pet->resetRoomsHighlight();
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/moves/enter_sec_class_state.h b/engines/titanic/moves/enter_sec_class_state.h
index c3e3cab..2b1bcaa 100644
--- a/engines/titanic/moves/enter_sec_class_state.h
+++ b/engines/titanic/moves/enter_sec_class_state.h
@@ -28,11 +28,15 @@
 namespace Titanic {
 
 class CEnterSecClassState : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+	bool StatusChangeMsg(CStatusChangeMsg *msg);
+	bool MovieEndMsg(CMovieEndMsg *msg);
 public:
-	int _value1, _value2;
+	int _mode, _soundHandle;
 public:
 	CLASSDEF;
-	CEnterSecClassState() : CGameObject(), _value1(0), _value2(0) {}
+	CEnterSecClassState() : CGameObject(), _mode(1), _soundHandle(0) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp
index 1400c25..9961cfc 100644
--- a/engines/titanic/support/string.cpp
+++ b/engines/titanic/support/string.cpp
@@ -58,6 +58,10 @@ CString CString::mid(uint start) const {
 	return mid(start, strSize - start);
 }
 
+CString CString::deleteRight(uint count) const {
+	return (count >= size()) ? CString() : left(size() - count);
+}
+
 int CString::indexOf(char c) const {
 	const char *charP = strchr(c_str(), c);
 	return charP ? charP - c_str() : -1;
diff --git a/engines/titanic/support/string.h b/engines/titanic/support/string.h
index 487c138..71242c0 100644
--- a/engines/titanic/support/string.h
+++ b/engines/titanic/support/string.h
@@ -75,6 +75,12 @@ public:
 	CString mid(uint start) const;
 
 	/**
+	 * Returns a substring consisting of the entire string
+	 * except for a specified number of characters at the end
+	 */
+	CString deleteRight(uint count) const;
+
+	/**
 	 * Returns the index of the first occurance of a given character
 	 */
 	int indexOf(char c) const;






More information about the Scummvm-git-logs mailing list