[Scummvm-cvs-logs] scummvm master -> 0a709d955da76df038a87a792d1759e43d718591

digitall dgturner at iee.org
Mon Nov 12 00:15:37 CET 2012


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

Summary:
535180dc7b TONY: Remove unused functions from Input class.
659a4b8b14 TONY: Remove further unused code from Input class.
0a709d955d TONY: Replace Input class internal buffers with Common standard.


Commit: 535180dc7b6439882d387b6f3f2de2eb3bd7ca5f
    https://github.com/scummvm/scummvm/commit/535180dc7b6439882d387b6f3f2de2eb3bd7ca5f
Author: D G Turner (digitall at scummvm.org)
Date: 2012-11-11T15:13:47-08:00

Commit Message:
TONY: Remove unused functions from Input class.

Changed paths:
    engines/tony/input.cpp
    engines/tony/input.h



diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp
index b96ccaf..a01208e 100644
--- a/engines/tony/input.cpp
+++ b/engines/tony/input.cpp
@@ -101,14 +101,6 @@ void RMInput::poll() {
 	}
 }
 
-bool RMInput::mouseLeft() {
-	return _leftButton;
-}
-
-bool RMInput::mouseRight() {
-	return _rightButton;
-}
-
 /**
  * Return true if a key has been pressed
  */
diff --git a/engines/tony/input.h b/engines/tony/input.h
index d07eaef..5d84b98 100644
--- a/engines/tony/input.h
+++ b/engines/tony/input.h
@@ -62,12 +62,6 @@ public:
 	RMPoint mousePos();
 
 	/**
-	 * Current status of the mouse buttons
-	 */
-	bool mouseLeft();
-	bool mouseRight();
-
-	/**
 	 * Events of mouse clicks
 	 */
 	bool mouseLeftClicked();


Commit: 659a4b8b14a8379cb672b5953ac79f69a9ec5f48
    https://github.com/scummvm/scummvm/commit/659a4b8b14a8379cb672b5953ac79f69a9ec5f48
Author: D G Turner (digitall at scummvm.org)
Date: 2012-11-11T15:14:02-08:00

Commit Message:
TONY: Remove further unused code from Input class.

Changed paths:
    engines/tony/input.cpp
    engines/tony/input.h



diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp
index a01208e..553a3f7 100644
--- a/engines/tony/input.cpp
+++ b/engines/tony/input.cpp
@@ -33,21 +33,14 @@ namespace Tony {
 
 RMInput::RMInput() {
 	// Setup mouse fields
-	_clampMouse = false;
 	_mousePos.set(0, 0);
-	_leftButton = _rightButton = false;
 	_leftClickMouse = _leftReleaseMouse = false;
 	_rightClickMouse = _rightReleaseMouse = false;
 
-	Common::fill((byte *)&_event, (byte *)&_event + sizeof(Common::Event), 0);
-
 	// Setup keyboard fields
 	Common::fill(&_keyDown[0], &_keyDown[350], 0);
 }
 
-RMInput::~RMInput() {
-}
-
 void RMInput::poll() {
 	_leftClickMouse = _leftReleaseMouse = _rightClickMouse = _rightReleaseMouse = false;
 
@@ -62,16 +55,12 @@ void RMInput::poll() {
 			_mousePos.set(_event.mouse.x, _event.mouse.y);
 
 			if (_event.type == Common::EVENT_LBUTTONDOWN) {
-				_leftButton = true;
 				_leftClickMouse = true;
 			} else if (_event.type == Common::EVENT_LBUTTONUP) {
-				_leftButton = false;
 				_leftReleaseMouse = true;
 			} else if (_event.type == Common::EVENT_RBUTTONDOWN) {
-				_rightButton = true;
 				_rightClickMouse = true;
 			} else if (_event.type == Common::EVENT_RBUTTONUP) {
-				_rightButton = false;
 				_rightReleaseMouse = true;
 			} else
 				continue;
@@ -130,10 +119,6 @@ bool RMInput::mouseRightClicked() {
 	return _rightClickMouse;
 }
 
-bool RMInput::mouseBothClicked() {
-	return _leftClickMouse && _rightClickMouse;
-}
-
 bool RMInput::mouseLeftReleased() {
 	return _leftReleaseMouse;
 }
@@ -142,8 +127,4 @@ bool RMInput::mouseRightReleased() {
 	return _rightReleaseMouse;
 }
 
-bool RMInput::mouseBothReleased() {
-	return _leftReleaseMouse && _rightReleaseMouse;
-}
-
 } // End of namespace Tony
diff --git a/engines/tony/input.h b/engines/tony/input.h
index 5d84b98..1672747 100644
--- a/engines/tony/input.h
+++ b/engines/tony/input.h
@@ -40,8 +40,6 @@ private:
 
 	// Mouse related fields
 	RMPoint _mousePos;
-	bool _clampMouse;
-	bool _leftButton, _rightButton;
 	bool _leftClickMouse, _leftReleaseMouse, _rightClickMouse, _rightReleaseMouse;
 
 	// Keyboard related fields
@@ -49,7 +47,6 @@ private:
 
 public:
 	RMInput();
-	~RMInput();
 
 	/**
 	 * Polling (must be performed once per frame)
@@ -66,10 +63,8 @@ public:
 	 */
 	bool mouseLeftClicked();
 	bool mouseRightClicked();
-	bool mouseBothClicked();
 	bool mouseLeftReleased();
 	bool mouseRightReleased();
-	bool mouseBothReleased();
 
 	/**
 	 * Returns true if the given key is pressed


Commit: 0a709d955da76df038a87a792d1759e43d718591
    https://github.com/scummvm/scummvm/commit/0a709d955da76df038a87a792d1759e43d718591
Author: D G Turner (digitall at scummvm.org)
Date: 2012-11-11T15:14:17-08:00

Commit Message:
TONY: Replace Input class internal buffers with Common standard.

The mouse position is now represented internally by Common::Point and
the keyDown buffer is an array of Common::Keycode values for depressed
keys.

Changed paths:
    engines/tony/input.cpp
    engines/tony/input.h



diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp
index 553a3f7..36a9082 100644
--- a/engines/tony/input.cpp
+++ b/engines/tony/input.cpp
@@ -32,13 +32,8 @@
 namespace Tony {
 
 RMInput::RMInput() {
-	// Setup mouse fields
-	_mousePos.set(0, 0);
 	_leftClickMouse = _leftReleaseMouse = false;
 	_rightClickMouse = _rightReleaseMouse = false;
-
-	// Setup keyboard fields
-	Common::fill(&_keyDown[0], &_keyDown[350], 0);
 }
 
 void RMInput::poll() {
@@ -52,7 +47,7 @@ void RMInput::poll() {
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONDOWN:
 		case Common::EVENT_RBUTTONUP:
-			_mousePos.set(_event.mouse.x, _event.mouse.y);
+			_mousePos = _event.mouse;
 
 			if (_event.type == Common::EVENT_LBUTTONDOWN) {
 				_leftClickMouse = true;
@@ -76,12 +71,17 @@ void RMInput::poll() {
 				g_vm->_debugger->onFrame();
 			} else {
 				// Flag the given key as being down
-				_keyDown[(int)_event.kbd.keycode] = true;
+				_keyDown.push_back(_event.kbd.keycode);
 			}
 			return;
 
 		case Common::EVENT_KEYUP:
-			_keyDown[(int)_event.kbd.keycode] = false;
+			for (int i = 0; i < _keyDown.size(); i++) {
+				if (_keyDown[i] == _event.kbd.keycode) {
+					_keyDown.remove_at(i);
+					break;
+				}
+			}
 			return;
 
 		default:
@@ -96,16 +96,21 @@ void RMInput::poll() {
 bool RMInput::getAsyncKeyState(Common::KeyCode kc) {
 	// The act of testing for a particular key automatically clears the state, to prevent
 	// the same key being registered in multiple different frames
-	bool result = _keyDown[(int)kc];
-	_keyDown[(int)kc] = false;
-	return result;
+	for (int i = 0; i < _keyDown.size(); i++) {
+		if (_keyDown[i] == kc) {
+			_keyDown.remove_at(i);
+			return true;
+		}
+	}
+	return false;
 }
 
 /**
  * Reading of the mouse
  */
 RMPoint RMInput::mousePos() {
-	return _mousePos;
+	RMPoint p(_mousePos.x, _mousePos.y);
+	return p;
 }
 
 /**
diff --git a/engines/tony/input.h b/engines/tony/input.h
index 1672747..274aa8c 100644
--- a/engines/tony/input.h
+++ b/engines/tony/input.h
@@ -30,6 +30,9 @@
 #define TONY_INPUT_H
 
 #include "common/events.h"
+#include "common/rect.h"
+#include "common/array.h"
+#include "common/keyboard.h"
 #include "tony/utils.h"
 
 namespace Tony {
@@ -39,11 +42,11 @@ private:
 	Common::Event _event;
 
 	// Mouse related fields
-	RMPoint _mousePos;
+	Common::Point _mousePos;
 	bool _leftClickMouse, _leftReleaseMouse, _rightClickMouse, _rightReleaseMouse;
 
 	// Keyboard related fields
-	bool _keyDown[350];
+	Common::Array<Common::KeyCode> _keyDown;
 
 public:
 	RMInput();






More information about the Scummvm-git-logs mailing list