[Scummvm-git-logs] scummvm master -> 6c4bdd7e794bf1bb023cb925bea4fa84278569e7

dreammaster dreammaster at scummvm.org
Mon Feb 20 03:31:42 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:
6c4bdd7e79 TITANIC: Fixes and cleanup for CodeWheel


Commit: 6c4bdd7e794bf1bb023cb925bea4fa84278569e7
    https://github.com/scummvm/scummvm/commit/6c4bdd7e794bf1bb023cb925bea4fa84278569e7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-19T21:31:37-05:00

Commit Message:
TITANIC: Fixes and cleanup for CodeWheel

Changed paths:
    engines/titanic/game/code_wheel.cpp
    engines/titanic/game/code_wheel.h


diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp
index ebffd3b..eee6e99 100644
--- a/engines/titanic/game/code_wheel.cpp
+++ b/engines/titanic/game/code_wheel.cpp
@@ -32,15 +32,15 @@ BEGIN_MESSAGE_MAP(CodeWheel, CBomb)
 	ON_MESSAGE(MovieEndMsg)
 END_MESSAGE_MAP()
 
-CodeWheel::CodeWheel() : CBomb(), _field108(0), _state(4),
-		_field110(0), _field114(0), _field118(0) {
+CodeWheel::CodeWheel() : CBomb(), _correctValue(0), _value(4),
+		_isCorrect(0), _field114(0), _field118(0) {
 }
 
 void CodeWheel::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_field108, indent);
-	file->writeNumberLine(_state, indent);
-	file->writeNumberLine(_field110, indent);
+	file->writeNumberLine(_correctValue, indent);
+	file->writeNumberLine(_value, indent);
+	file->writeNumberLine(_isCorrect, indent);
 	if (g_vm->isGerman()) {
 		file->writeNumberLine(_field114, indent);
 		file->writeNumberLine(_field118, indent);
@@ -51,9 +51,9 @@ void CodeWheel::save(SimpleFile *file, int indent) {
 
 void CodeWheel::load(SimpleFile *file) {
 	file->readNumber();
-	_field108 = file->readNumber();
-	_state = file->readNumber();
-	_field110 = file->readNumber();
+	_correctValue = file->readNumber();
+	_value = file->readNumber();
+	_isCorrect = file->readNumber();
 	if (g_vm->isGerman()) {
 		_field114 = file->readNumber();
 		_field118 = file->readNumber();
@@ -71,21 +71,23 @@ bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 	};
 
 	int yp = _bounds.top + _bounds.height() / 2;
+	_isCorrect = false;
+
 	if (msg->_mousePos.y > yp) {
-		if (_state == _field108)
-			_field110 = true;
+		if (_value == _correctValue)
+			_isCorrect = true;
 
-		_state = (_state + 1) % 15;
-		playMovie(START_FRAMES[_state], END_FRAMES[_state],
+		_value = (_value + 1) % 15;
+		playMovie(START_FRAMES[_value], END_FRAMES[_value],
 			MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT);
 	} else {
-		if (_state == _field108)
-			_field110 = true;
+		if (_value == _correctValue)
+			_isCorrect = true;
 
-		playMovie(START_FRAMES[14 - _state] + 68, END_FRAMES[14 - _state] + 68,
+		playMovie(START_FRAMES[14 - _value] + 68, END_FRAMES[14 - _value] + 68,
 			MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT);
 
-		_state = (_state <= 0) ? 14 : _state - 1;
+		_value = (_value <= 0) ? 14 : _value - 1;
 	}
 
 	playSound("z#59.wav");
@@ -94,7 +96,7 @@ bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 
 bool CodeWheel::EnterViewMsg(CEnterViewMsg *msg) {
 	loadFrame(24);
-	_state = 4;
+	_value = 4;
 	return true;
 }
 
@@ -106,9 +108,9 @@ bool CodeWheel::MovieEndMsg(CMovieEndMsg *msg) {
 	sleep(200);
 	CStatusChangeMsg changeMsg;
 	changeMsg._newStatus = 0;
-	if (_field110)
+	if (!_isCorrect)
 		changeMsg._newStatus = -1;
-	if (_field108 == _state)
+	if (_value == _correctValue)
 		changeMsg._newStatus = 1;
 	changeMsg.execute("Bomb");
 
diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h
index de246f5..ac654ff 100644
--- a/engines/titanic/game/code_wheel.h
+++ b/engines/titanic/game/code_wheel.h
@@ -34,9 +34,9 @@ class CodeWheel : public CBomb {
 	bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
 	bool MovieEndMsg(CMovieEndMsg *msg);
 private:
-	int _field108;
-	int _state;
-	int _field110;
+	int _correctValue;
+	int _value;
+	bool _isCorrect;
 	// German specific fields
 	int _field114;
 	int _field118;





More information about the Scummvm-git-logs mailing list