[Scummvm-cvs-logs] scummvm master -> 762f2487407b566978f2cf0f0eefd2440e8f7b87

urukgit urukgit at users.noreply.github.com
Fri Dec 20 10:35:30 CET 2013


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

Summary:
3b341cff79 AVALANCHE: Rework mouse handling in Nim.
762f248740 AVALANCHE: Fix drawing of the gameboard in Nim.


Commit: 3b341cff79f91c8b0605f09ad6881799683ed9e5
    https://github.com/scummvm/scummvm/commit/3b341cff79f91c8b0605f09ad6881799683ed9e5
Author: uruk (koppirnyo at gmail.com)
Date: 2013-12-20T01:32:07-08:00

Commit Message:
AVALANCHE: Rework mouse handling in Nim.

Changed paths:
    engines/avalanche/nim.cpp
    engines/avalanche/nim.h



diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp
index 6ea719f..2a1dd5e 100644
--- a/engines/avalanche/nim.cpp
+++ b/engines/avalanche/nim.cpp
@@ -47,8 +47,6 @@ void Nim::resetVariables() {
 	_row = 0;
 	_number = 0;
 	_squeak = false;
-	_mNum = 0;
-	_mRow = 0;
 	_lmo = false;
 
 	for (int i = 0; i < 3; i++) {
@@ -223,32 +221,35 @@ void Nim::blip() {
 	_vm->_sound->playNote(1771, 3);
 }
 
-bool Nim::checkMouse() {
-	Common::Point cursorPos = _vm->getMousePos();
-	_vm->_graphics->refreshScreen();
-	Common::Event event;
-	// This loop needs "some" revision!!!
-	while (_vm->getEvent(event)) {
+bool Nim::checkInput() {
+	while (!_vm->shouldQuit()) {
 		_vm->_graphics->refreshScreen();
-		if (event.type == Common::EVENT_LBUTTONUP) {
-			_mRow = (cursorPos.y / 2 - 38) / 35 - 1;
-			if ((_mRow < 0) || (_mRow > 2)) {
-				blip();
-				return false;
-			}
-			_mNum = _stones[_mRow] - ((cursorPos.x - 64) / 64);
-			if ((_mNum < 1) || (_mNum > _stones[_mRow])) {
-				blip();
-				return false;
+		Common::Event event;
+		while (_vm->getEvent(event)) {
+			if (event.type == Common::EVENT_LBUTTONUP) {
+				Common::Point cursorPos = _vm->getMousePos();
+
+				int8 mRow = (cursorPos.y / 2 - 38) / 35 - 1;
+				if ((mRow < 0) || (mRow > 2)) {
+					blip();
+					return false;
+				}
+
+				int8 mNum = _stones[mRow] - ((cursorPos.x - 64) / 64);
+				if ((mNum < 1) || (mNum > _stones[mRow])) {
+					blip();
+					return false;
+				}
+
+				_number = mNum;
+				_row = mRow;
+
+				return true;
 			}
-			return true;
 		}
 	}
-}
 
-void Nim::less() {
-	if (_number > 1)
-		_number--;
+
 }
 
 void Nim::takeSome() {
@@ -272,16 +273,14 @@ void Nim::takeSome() {
 		_vm->_graphics->drawRectangle(Common::Rect(63 + (sr - _number) * 64, 38 + 35 * (_row + 1), 54 + sr * 64, 63 + 35 * (_row + 1)), kColorBlue);
 		_vm->_graphics->refreshScreen();
 
-		bool clicked = false;
+		bool validInput = false;
 		do {
-			clicked = checkMouse();
-		} while (clicked == false);
+			validInput = checkInput();
+		} while (!validInput);
 		
 		_vm->_graphics->drawRectangle(Common::Rect(63 + (sr - _number) * 64, 38 + 35 * (_row + 1), 54 + sr * 64, 63 + 35 * (_row + 1)), kColorBlack);
 		_vm->_graphics->refreshScreen();
 
-		_number = _mNum;
-		_row = _mRow;
 		return;
 
 	} while (true);
diff --git a/engines/avalanche/nim.h b/engines/avalanche/nim.h
index 6afb915..7978737 100644
--- a/engines/avalanche/nim.h
+++ b/engines/avalanche/nim.h
@@ -51,7 +51,6 @@ private:
 	byte _row;
 	byte _number;
 	bool _squeak;
-	int8 _mNum, _mRow;
 	byte _playedNim; // How many times you've played Nim.
 
 	// Inner variables for dogFood(), find() and findAp().
@@ -65,8 +64,7 @@ private:
 	void startMove();
 	void showChanges();
 	void blip();
-	bool checkMouse();
-	void less();
+	bool checkInput();
 	void takeSome();
 	void endOfGame();
 	bool find(byte x); // This gives TRUE if there's a pile with x stones in.


Commit: 762f2487407b566978f2cf0f0eefd2440e8f7b87
    https://github.com/scummvm/scummvm/commit/762f2487407b566978f2cf0f0eefd2440e8f7b87
Author: uruk (koppirnyo at gmail.com)
Date: 2013-12-20T01:34:35-08:00

Commit Message:
AVALANCHE: Fix drawing of the gameboard in Nim.

Changed paths:
    engines/avalanche/nim.cpp



diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp
index 2a1dd5e..d47b4a5 100644
--- a/engines/avalanche/nim.cpp
+++ b/engines/avalanche/nim.cpp
@@ -191,7 +191,7 @@ void Nim::setup() {
 }
 
 void Nim::board() {
-	_vm->_graphics->drawFilledRectangle(Common::Rect(57, 75, 393, 200), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(57, 72, 393, 200), kColorBlack);
 	for (int i = 0; i < 3; i++)
 		for (int j = 0; j < _stones[i]; j++)
 			_vm->_graphics->drawNimStone(64 + j * 8 * 8, 75 + i * 35);






More information about the Scummvm-git-logs mailing list