[Scummvm-cvs-logs] SF.net SVN: scummvm: [26220] scummvm/trunk/engines/gob

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Mar 18 19:10:35 CET 2007


Revision: 26220
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26220&view=rev
Author:   fingolfin
Date:     2007-03-18 11:10:34 -0700 (Sun, 18 Mar 2007)

Log Message:
-----------
GOB: use EventManager::getMousePos and some cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/gob/init.cpp
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/util.h

Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp	2007-03-18 17:58:26 UTC (rev 26219)
+++ scummvm/trunk/engines/gob/init.cpp	2007-03-18 18:10:34 UTC (rev 26220)
@@ -69,7 +69,6 @@
 		warning("cleanup: Allocated sprites left: %d", _vm->_global->_sprAllocated);
 
 	_vm->_snd->stopSound(0);
-	_vm->_util->keyboard_release();
 }
 
 void Init::initGame(char *totName) {

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2007-03-18 17:58:26 UTC (rev 26219)
+++ scummvm/trunk/engines/gob/util.cpp	2007-03-18 18:10:34 UTC (rev 26220)
@@ -33,8 +33,6 @@
 namespace Gob {
 
 Util::Util(GobEngine *vm) : _vm(vm) {
-	_mouseX = 0;
-	_mouseY = 0;
 	_mouseButtons = 0;
 	for (int i = 0; i < KEYBUFSIZE; i++)
 		_keyBuffer[i] = 0;
@@ -67,7 +65,7 @@
 
 
 void Util::initInput(void) {
-	_mouseX = _mouseY = _mouseButtons = 0;
+	_mouseButtons = 0;
 	_keyBufferHead = _keyBufferTail = 0;
 }
 
@@ -144,10 +142,6 @@
 	Common::EventManager *eventMan = g_system->getEventManager();
 	while (eventMan->pollEvent(event)) {
 		switch (event.type) {
-		case Common::EVENT_MOUSEMOVE:
-			_mouseX = event.mouse.x;
-			_mouseY = event.mouse.y;
-			break;
 		case Common::EVENT_LBUTTONDOWN:
 			_mouseButtons |= 1;
 			break;
@@ -175,8 +169,9 @@
 }
 
 void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
-	*pX = _mouseX;
-	*pY = _mouseY;
+	Common::Point mouse = g_system->getEventManager()->getMousePos();
+	*pX = mouse.x;
+	*pY = mouse.y;
 
 	if (pButtons != 0)
 		*pButtons = _mouseButtons;
@@ -211,27 +206,17 @@
 }
 
 void Util::waitMouseUp(void) {
-	int16 x;
-	int16 y;
-	int16 buttons;
-
 	do {
 		processInput();
-		getMouseState(&x, &y, &buttons);
-		if (buttons != 0) delay(10);
-	} while (buttons != 0);
+		if (_mouseButtons != 0) delay(10);
+	} while (_mouseButtons != 0);
 }
 
 void Util::waitMouseDown(void) {
-	int16 x;
-	int16 y;
-	int16 buttons;
-
 	do {
 		processInput();
-		getMouseState(&x, &y, &buttons);
-		if (buttons == 0) delay(10);
-	} while (buttons == 0);
+		if (_mouseButtons == 0) delay(10);
+	} while (_mouseButtons == 0);
 }
 
 /* NOT IMPLEMENTED */
@@ -437,11 +422,11 @@
 	delete list;
 }
 
-const char Util::trStr1[] =
+static const char trStr1[] =
     "       '   + - :0123456789: <=>  abcdefghijklmnopqrstuvwxyz      abcdefghijklmnopqrstuvwxyz     ";
-const char Util::trStr2[] =
+static const char trStr2[] =
     " ueaaaaceeeiii     ooouu        aioun                                                           ";
-const char Util::trStr3[] = "                                ";
+static const char trStr3[] = "                                ";
 
 void Util::prepareStr(char *str) {
 	uint16 i;
@@ -490,8 +475,6 @@
 	} while (buttons != 0);
 }
 
-void Util::keyboard_release(void) {;}
-
 void Util::forceMouseUp(void) {
 	_vm->_game->_mouseButtons = 0;
 	_mouseButtons = 0;

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2007-03-18 17:58:26 UTC (rev 26219)
+++ scummvm/trunk/engines/gob/util.h	2007-03-18 18:10:34 UTC (rev 26220)
@@ -61,9 +61,6 @@
 	void waitMouseUp(void);
 	void waitMouseDown(void);
 
-	void keyboard_init(void);
-	void keyboard_release(void);
-
 	void clearPalette(void);
 
 	void asm_setPaletteBlock(char *tmpPalBuffer, int16 start, int16 end);
@@ -86,14 +83,10 @@
 	void forceMouseUp(void);
 	void setScrollOffset(int16 x = -1, int16 y = -1);
 
-	static const char trStr1[];
-	static const char trStr2[];
-	static const char trStr3[];
-
 	Util(GobEngine *vm);
 
 protected:
-	int16 _mouseX, _mouseY, _mouseButtons;
+	int16 _mouseButtons;
 	int16 _keyBuffer[KEYBUFSIZE], _keyBufferHead, _keyBufferTail;
 	GobEngine *_vm;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list