[Scummvm-git-logs] scummvm master -> 90e4e8a06403dc54b862cc08676718a29fdf6f94

dreammaster dreammaster at scummvm.org
Tue Feb 21 03:15:05 CET 2017


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:
90e4e8a064 TITANIC: Initial cleanup & renamings for bridge controls


Commit: 90e4e8a06403dc54b862cc08676718a29fdf6f94
    https://github.com/scummvm/scummvm/commit/90e4e8a06403dc54b862cc08676718a29fdf6f94
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-20T21:15:00-05:00

Commit Message:
TITANIC: Initial cleanup & renamings for bridge controls

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/core/game_object.h
    engines/titanic/game/captains_wheel.cpp
    engines/titanic/game/captains_wheel.h
    engines/titanic/game/wheel_button.cpp
    engines/titanic/game/wheel_button.h
    engines/titanic/game/wheel_hotspot.cpp
    engines/titanic/game/wheel_hotspot.h
    engines/titanic/star_control/star_control.cpp
    engines/titanic/star_control/star_control.h
    engines/titanic/star_control/star_field.cpp
    engines/titanic/star_control/star_field.h


diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 549cadf..314746e 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1643,9 +1643,9 @@ void CGameObject::starFn1(int v) {
 		starControl->fn1(v);
 }
 
-bool CGameObject::starFn2() {
+bool CGameObject::starIsSolved() const {
 	CStarControl *starControl = getStarControl();
-	return starControl ? starControl->fn4() : false;
+	return starControl ? starControl->isSolved() : false;
 }
 
 /*------------------------------------------------------------------------*/
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index a1e2c35..b214cf8 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -946,7 +946,11 @@ public:
 	CStarControl *getStarControl() const;
 
 	void starFn1(int v);
-	bool starFn2();
+
+	/**
+	 * Returns true if the starmap puzzle has been solved
+	 */
+	bool starIsSolved() const;
 
 	/*--- CTrueTalkManager Methods ---*/
 
diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp
index 7a21047..eabee7e 100644
--- a/engines/titanic/game/captains_wheel.cpp
+++ b/engines/titanic/game/captains_wheel.cpp
@@ -34,17 +34,17 @@ BEGIN_MESSAGE_MAP(CCaptainsWheel, CBackground)
 END_MESSAGE_MAP()
 
 CCaptainsWheel::CCaptainsWheel() : CBackground(),
-	_fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0),
-	_fieldF0(0), _fieldF4(0) {
+		_stopEnabled(false), _fieldE4(0), _fieldE8(0),
+		_cruiseEnabled(false), _goEnabled(false), _fieldF4(0) {
 }
 
 void CCaptainsWheel::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldE0, indent);
+	file->writeNumberLine(_stopEnabled, indent);
 	file->writeNumberLine(_fieldE4, indent);
 	file->writeNumberLine(_fieldE8, indent);
-	file->writeNumberLine(_fieldEC, indent);
-	file->writeNumberLine(_fieldF0, indent);
+	file->writeNumberLine(_cruiseEnabled, indent);
+	file->writeNumberLine(_goEnabled, indent);
 	file->writeNumberLine(_fieldF4, indent);
 
 	CBackground::save(file, indent);
@@ -52,19 +52,19 @@ void CCaptainsWheel::save(SimpleFile *file, int indent) {
 
 void CCaptainsWheel::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldE0 = file->readNumber();
+	_stopEnabled = file->readNumber();
 	_fieldE4 = file->readNumber();
 	_fieldE8 = file->readNumber();
-	_fieldEC = file->readNumber();
-	_fieldF0 = file->readNumber();
+	_cruiseEnabled = file->readNumber();
+	_goEnabled = file->readNumber();
 	_fieldF4 = file->readNumber();
 
 	CBackground::load(file);
 }
 
 bool CCaptainsWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
-	if (_fieldE0) {
-		_fieldE0 = false;
+	if (_stopEnabled) {
+		_stopEnabled = false;
 		CTurnOff offMsg;
 		offMsg.execute(this);
 		playMovie(162, 168, 0);
@@ -76,8 +76,8 @@ bool CCaptainsWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 }
 
 bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) {
-	if (_fieldE0) {
-		_fieldE0 = false;
+	if (_stopEnabled) {
+		_stopEnabled = false;
 		CTurnOff offMsg;
 		offMsg.execute(this);
 		playMovie(162, 168, MOVIE_WAIT_FOR_FINISH);
@@ -88,19 +88,19 @@ bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) {
 
 bool CCaptainsWheel::ActMsg(CActMsg *msg) {
 	if (msg->_action == "Spin") {
-		if (_fieldE0) {
+		if (_stopEnabled) {
 			CTurnOn onMsg;
 			onMsg.execute("RatchetySound");
 			playMovie(8, 142, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH);
 		}
 	} else if (msg->_action == "Honk") {
-		if (_fieldE0) {
+		if (_stopEnabled) {
 			playMovie(150, 160, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH);
 		}
 	} else if (msg->_action == "Go") {
-		if (!_fieldE0) {
+		if (!_stopEnabled) {
 			incTransitions();
-			_fieldE0 = false;
+			_stopEnabled = false;
 			_fieldE4 = 1;
 
 			CTurnOff offMsg;
@@ -108,9 +108,9 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) {
 			playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH);
 		}
 	} else if (msg->_action == "Cruise") {
-		if (_fieldE0) {
+		if (_stopEnabled) {
 			incTransitions();
-			_fieldE0 = false;
+			_stopEnabled = false;
 			_fieldE4 = 2;
 
 			CTurnOff offMsg;
@@ -124,9 +124,9 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) {
 		volumeMsg.execute("EngineSounds");
 		CTurnOn onMsg;
 		onMsg.execute("EngineSounds");
-		_fieldF0 = 1;
+		_goEnabled = true;
 	} else if (msg->_action == "ClearDestin") {
-		_fieldF0 = 0;
+		_goEnabled = false;
 	}
 
 	return true;
@@ -152,17 +152,17 @@ bool CCaptainsWheel::TurnOn(CTurnOn *msg) {
 	signalMsg.execute("WheelSpin");
 	signalMsg.execute("SeagullHorn");
 
-	if (_fieldE0) {
+	if (_stopEnabled) {
 		signalMsg.execute("WheelStopButt");
 		signalMsg.execute("StopHotSpot");
 	}
 
-	if (_fieldEC) {
+	if (_cruiseEnabled) {
 		signalMsg.execute("WheelCruiseButt");
 		signalMsg.execute("CruiseHotSpot");
 	}
 
-	if (_fieldF0) {
+	if (_goEnabled) {
 		signalMsg.execute("WheelGoButt");
 		signalMsg.execute("GoHotSpot");
 	}
@@ -172,7 +172,7 @@ bool CCaptainsWheel::TurnOn(CTurnOn *msg) {
 
 bool CCaptainsWheel::MovieEndMsg(CMovieEndMsg *msg) {
 	if (msg->_endFrame == 8) {
-		_fieldE0 = true;
+		_stopEnabled = true;
 		CTurnOn onMsg;
 		onMsg.execute(this);
 	}
@@ -185,7 +185,7 @@ bool CCaptainsWheel::MovieEndMsg(CMovieEndMsg *msg) {
 	if (msg->_endFrame == 168) {
 		switch (_fieldE4) {
 		case 1: {
-			CActMsg actMsg(starFn2() ? "GoEnd" : "Go");
+			CActMsg actMsg(starIsSolved() ? "GoEnd" : "Go");
 			actMsg.execute("GoSequence");
 			break;
 		}
diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h
index 3aca45c..a8a8553 100644
--- a/engines/titanic/game/captains_wheel.h
+++ b/engines/titanic/game/captains_wheel.h
@@ -36,11 +36,11 @@ class CCaptainsWheel : public CBackground {
 	bool TurnOn(CTurnOn *msg);
 	bool MovieEndMsg(CMovieEndMsg *msg);
 public:
-	int _fieldE0;
+	bool _stopEnabled;
 	int _fieldE4;
 	int _fieldE8;
-	int _fieldEC;
-	int _fieldF0;
+	bool _cruiseEnabled;
+	bool _goEnabled;
 	int _fieldF4;
 public:
 	CLASSDEF;
diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp
index 730a5d9..71532e5 100644
--- a/engines/titanic/game/wheel_button.cpp
+++ b/engines/titanic/game/wheel_button.cpp
@@ -31,33 +31,33 @@ BEGIN_MESSAGE_MAP(CWheelButton, CBackground)
 END_MESSAGE_MAP()
 
 CWheelButton::CWheelButton() : CBackground(),
-	_fieldE0(false), _timerId(0), _fieldE8(0) {
+	_blinking(false), _timerId(0), _unused5(0) {
 }
 
 void CWheelButton::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldE0, indent);
+	file->writeNumberLine(_blinking, indent);
 	file->writeNumberLine(_timerId, indent);
-	file->writeNumberLine(_fieldE8, indent);
+	file->writeNumberLine(_unused5, indent);
 
 	CBackground::save(file, indent);
 }
 
 void CWheelButton::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldE0 = file->readNumber();
+	_blinking = file->readNumber();
 	_timerId = file->readNumber();
-	_fieldE8 = file->readNumber();
+	_unused5 = file->readNumber();
 
 	CBackground::load(file);
 }
 
 bool CWheelButton::SignalObject(CSignalObject *msg) {
-	bool oldFlag = _fieldE0;
-	_fieldE0 = msg->_numValue != 0;
+	bool oldBlinking = _blinking;
+	_blinking = msg->_numValue != 0;
 
-	if (oldFlag != _fieldE0) {
-		if (_fieldE0) {
+	if (oldBlinking != _blinking) {
+		if (_blinking) {
 			_timerId = addTimer(500, 500);
 		} else {
 			stopAnimTimer(_timerId);
diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h
index 2725e60..7bdcece 100644
--- a/engines/titanic/game/wheel_button.h
+++ b/engines/titanic/game/wheel_button.h
@@ -33,9 +33,9 @@ class CWheelButton : public CBackground {
 	bool TimerMsg(CTimerMsg *msg);
 	bool LeaveViewMsg(CLeaveViewMsg *msg);
 public:
-	bool _fieldE0;
+	bool _blinking;
 	int _timerId;
-	int _fieldE8;
+	int _unused5;
 public:
 	CLASSDEF;
 	CWheelButton();
diff --git a/engines/titanic/game/wheel_hotspot.cpp b/engines/titanic/game/wheel_hotspot.cpp
index aeca713..aec1c8b 100644
--- a/engines/titanic/game/wheel_hotspot.cpp
+++ b/engines/titanic/game/wheel_hotspot.cpp
@@ -31,36 +31,36 @@ END_MESSAGE_MAP()
 
 void CWheelHotSpot::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldE0, indent);
-	file->writeNumberLine(_fieldE4, indent);
+	file->writeNumberLine(_active, indent);
+	file->writeNumberLine(_action, indent);
 
 	CBackground::save(file, indent);
 }
 
 void CWheelHotSpot::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldE0 = file->readNumber();
-	_fieldE4 = file->readNumber();
+	_active = file->readNumber();
+	_action = (WheelHotspotAction)file->readNumber();
 
 	CBackground::load(file);
 }
 
 bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
-	if (_fieldE0) {
+	if (_active) {
 		CActMsg actMsg;
 
-		switch (_fieldE4) {
-		case 1:
+		switch (_action) {
+		case WH_STOP:
 			actMsg._action = "Stop";
 			actMsg.execute("CaptainsWheel");
 			break;
 
-		case 2:
+		case WH_CRUISE:
 			actMsg._action = "Cruise";
 			actMsg.execute("CaptainsWheel");
 			break;
 
-		case 3:
+		case WH_GO:
 			actMsg._action = "Go";
 			actMsg.execute("CaptainsWheel");
 			break;
@@ -68,7 +68,7 @@ bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 		default:
 			break;
 		}
-	} else if (_fieldE4 == 3) {
+	} else if (_action == WH_GO) {
 		petDisplayMessage(GO_WHERE);
 	}
 
@@ -76,7 +76,7 @@ bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 }
 
 bool CWheelHotSpot::SignalObject(CSignalObject *msg) {
-	_fieldE0 = msg->_numValue != 0;
+	_active = msg->_numValue != 0;
 	return true;
 }
 
diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h
index e9071a2..41da0fb 100644
--- a/engines/titanic/game/wheel_hotspot.h
+++ b/engines/titanic/game/wheel_hotspot.h
@@ -27,16 +27,20 @@
 
 namespace Titanic {
 
+enum WheelHotspotAction {
+	WH_NONE = 0, WH_STOP = 1, WH_CRUISE = 2, WH_GO = 3
+};
+
 class CWheelHotSpot : public CBackground {
 	DECLARE_MESSAGE_MAP;
 	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 	bool SignalObject(CSignalObject *msg);
 public:
-	int _fieldE0;
-	int _fieldE4;
+	bool _active;
+	WheelHotspotAction _action;
 public:
 	CLASSDEF;
-	CWheelHotSpot() : CBackground(), _fieldE0(0), _fieldE4(0) {}
+	CWheelHotSpot() : CBackground(), _active(false), _action(WH_NONE) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index dcb0042..a1c4f33 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -133,8 +133,8 @@ void CStarControl::fn1(int action) {
 	// TODO
 }
 
-bool CStarControl::fn4() {
-	return _starField.get6();
+bool CStarControl::isSolved() const {
+	return _starField.isSolved();
 }
 
 bool CStarControl::canSetStarDestination() const {
diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h
index bf964b7..0ee7c65 100644
--- a/engines/titanic/star_control/star_control.h
+++ b/engines/titanic/star_control/star_control.h
@@ -69,7 +69,11 @@ public:
 	virtual void draw(CScreenManager *screenManager);
 
 	void fn1(int action);
-	bool fn4();
+
+	/**
+	 * Returns true if the starfield puzzle has been solved
+	 */
+	bool isSolved() const;
 
 	/**
 	 * Returns true if a star destination can be set
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 0dbc5fd..7502f84 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -26,7 +26,7 @@
 namespace Titanic {
 
 CStarField::CStarField() : _val1(0), _val2(0), _val3(0), _val4(true),
-	_val5(0), _val6(false) {
+	_val5(0), _isSolved(false) {
 }
 
 void CStarField::load(SimpleFile *file) {
@@ -36,7 +36,7 @@ void CStarField::load(SimpleFile *file) {
 	_val2 = file->readNumber();
 	_val3 = file->readNumber();
 	_val4 = file->readNumber();
-	_val6 = file->readNumber();
+	_isSolved = file->readNumber();
 }
 
 void CStarField::save(SimpleFile *file, int indent) {
@@ -46,7 +46,7 @@ void CStarField::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(_val2, indent);
 	file->writeNumberLine(_val3, indent);
 	file->writeNumberLine(_val4, indent);
-	file->writeNumberLine(_val6, indent);
+	file->writeNumberLine(_isSolved, indent);
 }
 
 bool CStarField::initDocument() {
@@ -119,12 +119,12 @@ int CStarField::get5() const {
 	return _val5;
 }
 
-void CStarField::update6() {
-	_val6 = _sub8._field8 == 2;
+void CStarField::setSolved() {
+	_isSolved = _sub8._field8 == 2;
 }
 
-int CStarField::get6() const {
-	return _val6;
+bool CStarField::isSolved() const {
+	return _isSolved;
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index 91cefbb..41f0189 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -44,7 +44,7 @@ private:
 	int _val3;
 	bool _val4;
 	int _val5;
-	bool _val6;
+	bool _isSolved;
 public:
 	CStarField();
 
@@ -77,8 +77,16 @@ public:
 	bool set4(bool val);
 	int get88() const;
 	int get5() const;
-	void update6();
-	int get6() const;
+
+	/**
+	 * Sets the flag that the starfield has been solved
+	 */
+	void setSolved();
+
+	/**
+	 * Returns true if the starfield puzzle has been solved
+	 */
+	bool isSolved() const;
 };
 
 } // End of namespace Titanic





More information about the Scummvm-git-logs mailing list