aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-12-19 11:59:32 +0100
committerWillem Jan Palenstijn2015-12-23 21:35:29 +0100
commitdf1376983d9181a5b08011bf3b5b4d8684d06b38 (patch)
tree5f7fb10b94ab183b7d8864e7941254c74014d913
parent567ed6a57a2b7c5a05361ac476de7f8a88fa0181 (diff)
downloadscummvm-rg350-df1376983d9181a5b08011bf3b5b4d8684d06b38.tar.gz
scummvm-rg350-df1376983d9181a5b08011bf3b5b4d8684d06b38.tar.bz2
scummvm-rg350-df1376983d9181a5b08011bf3b5b4d8684d06b38.zip
LAB: Simplify code related to _keyBuf handling
-rw-r--r--engines/lab/eventman.cpp11
-rw-r--r--engines/lab/eventman.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp
index 0aa801fe2d..7f0ddb8e18 100644
--- a/engines/lab/eventman.cpp
+++ b/engines/lab/eventman.cpp
@@ -116,12 +116,13 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) {
_lastButtonHit = nullptr;
_screenButtonList = nullptr;
_hitButton = nullptr;
+ _mousePos = Common::Point(0, 0);
+
_nextKeyIn = 0;
_nextKeyOut = 0;
- _mousePos = Common::Point(0, 0);
for (int i = 0; i < 64; i++)
- _keyBuf[i] = 0;
+ _keyBuf[i] = Common::KEYCODE_INVALID;
}
@@ -260,8 +261,7 @@ void EventManager::processInput() {
break;
default: {
- int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F)
- - ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26);
+ int n = (_nextKeyIn + 1) % 64;
if (n != _nextKeyOut) {
_keyBuf[_nextKeyIn] = event.kbd.keycode;
_nextKeyIn = n;
@@ -286,8 +286,7 @@ uint16 EventManager::getNextChar() {
processInput();
if (_nextKeyIn != _nextKeyOut) {
chr = _keyBuf[_nextKeyOut];
- _nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F)
- - ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26);
+ _nextKeyOut = (_nextKeyOut + 1) % 64;
}
return chr;
diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h
index 342f8599c1..6563467eb8 100644
--- a/engines/lab/eventman.h
+++ b/engines/lab/eventman.h
@@ -77,7 +77,7 @@ private:
uint16 _nextKeyIn;
uint16 _nextKeyOut;
- uint16 _keyBuf[64];
+ Common::KeyCode _keyBuf[64];
Button *_hitButton;
Button *_lastButtonHit;