aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/util.cpp
diff options
context:
space:
mode:
authorDavid Corrales2007-05-26 20:23:24 +0000
committerDavid Corrales2007-05-26 20:23:24 +0000
commit3646c968c9578c2a94d65ebd5fb06ec835f8c51d (patch)
tree8b57b339ebb31a1d7a67f1678aa5dc5c7759070a /engines/gob/util.cpp
parentd1f56d93f934150f4b579c2e90564e2bf035f113 (diff)
parentac45c5b33d834acbc9718f89be76e49d403a4d2c (diff)
downloadscummvm-rg350-3646c968c9578c2a94d65ebd5fb06ec835f8c51d.tar.gz
scummvm-rg350-3646c968c9578c2a94d65ebd5fb06ec835f8c51d.tar.bz2
scummvm-rg350-3646c968c9578c2a94d65ebd5fb06ec835f8c51d.zip
Merged the fs branch with trunk. r26472:26948
svn-id: r26949
Diffstat (limited to 'engines/gob/util.cpp')
-rw-r--r--engines/gob/util.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index e2ef60d5e2..ad10381dac 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -82,7 +82,7 @@ void Util::initInput(void) {
void Util::processInput(bool scroll) {
Common::Event event;
Common::EventManager *eventMan = g_system->getEventManager();
- int16 x, y;
+ int16 x = 0, y = 0;
bool hasMove = false;
while (eventMan->pollEvent(event)) {
@@ -112,7 +112,7 @@ void Util::processInput(bool scroll) {
_fastMode ^= 2;
break;
}
- addKeyToBuffer(event.kbd.keycode);
+ addKeyToBuffer(event.kbd.ascii);
break;
case Common::EVENT_KEYUP:
break;
@@ -125,8 +125,13 @@ void Util::processInput(bool scroll) {
}
_vm->_global->_speedFactor = MIN(_fastMode + 1, 3);
- if (scroll && hasMove)
+ if (scroll && hasMove) {
+ if (y >= (200 - _vm->_video->_splitHeight2)) {
+ y = 200 - _vm->_video->_splitHeight2 - 1;
+ _vm->_util->setMousePos(x, y);
+ }
_vm->_game->evaluateScroll(x, y);
+ }
}
void Util::clearKeyBuf(void) {
@@ -171,16 +176,16 @@ int16 Util::translateKey(int16 key) {
{274, 0x5000}, // Down arrow
{275, 0x4D00}, // Right arrow
{276, 0x4B00}, // Left arrow
- {282, 0x3B00}, // F1
- {283, 0x3C00}, // F2
- {284, 0x3D00}, // F3
- {285, 0x3E00}, // F4
- {286, 0x011B}, // F5
- {287, 0x4000}, // F6
- {288, 0x4100}, // F7
- {289, 0x4200}, // F8
- {290, 0x4300}, // F9
- {291, 0x4400} // F10
+ {315, 0x3B00}, // F1
+ {316, 0x3C00}, // F2
+ {317, 0x3D00}, // F3
+ {318, 0x3E00}, // F4
+ {319, 0x011B}, // F5
+ {320, 0x4000}, // F6
+ {321, 0x4100}, // F7
+ {322, 0x4200}, // F8
+ {323, 0x4300}, // F9
+ {324, 0x4400} // F10
};
for (int i = 0; i < ARRAYSIZE(keys); i++)
@@ -261,7 +266,10 @@ void Util::waitMouseRelease(char drawMouse) {
} while (buttons != 0);
}
-void Util::forceMouseUp(void) {
+void Util::forceMouseUp(bool onlyWhenSynced) {
+ if (onlyWhenSynced && (_vm->_game->_mouseButtons != _mouseButtons))
+ return;
+
_vm->_game->_mouseButtons = 0;
_mouseButtons = 0;
}
@@ -385,6 +393,11 @@ void Util::cutFromStr(char *str, int16 from, int16 cutlen) {
} while (str[i] != 0);
}
+void Util::replaceChar(char *str, char c1, char c2) {
+ while ((str = strchr(str, c1)))
+ *str = c2;
+}
+
static const char trStr1[] =
" ' + - :0123456789: <=> abcdefghijklmnopqrstuvwxyz "
"abcdefghijklmnopqrstuvwxyz ";