aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/init.cpp1
-rw-r--r--engines/gob/util.cpp39
-rw-r--r--engines/gob/util.h9
3 files changed, 12 insertions, 37 deletions
diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp
index 81ad101ce9..21f8ed36f8 100644
--- a/engines/gob/init.cpp
+++ b/engines/gob/init.cpp
@@ -69,7 +69,6 @@ void Init::cleanup(void) {
warning("cleanup: Allocated sprites left: %d", _vm->_global->_sprAllocated);
_vm->_snd->stopSound(0);
- _vm->_util->keyboard_release();
}
void Init::initGame(char *totName) {
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 007ec7af22..fc85cf3e73 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -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 @@ bool Util::getKeyFromBuffer(int16& key) {
void Util::initInput(void) {
- _mouseX = _mouseY = _mouseButtons = 0;
+ _mouseButtons = 0;
_keyBufferHead = _keyBufferTail = 0;
}
@@ -144,10 +142,6 @@ void Util::processInput() {
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::processInput() {
}
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 @@ uint32 Util::getTimeKey(void) {
}
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 @@ void Util::deleteList(List * list) {
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 @@ void Util::waitMouseRelease(char drawMouse) {
} while (buttons != 0);
}
-void Util::keyboard_release(void) {;}
-
void Util::forceMouseUp(void) {
_vm->_game->_mouseButtons = 0;
_mouseButtons = 0;
diff --git a/engines/gob/util.h b/engines/gob/util.h
index de9e6224b9..40e9f6bb51 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -61,9 +61,6 @@ public:
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 @@ public:
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;