aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2011-09-03 17:21:25 +0200
committerSven Hesse2011-09-03 18:00:09 +0200
commit26dd2f5f603b10b3b54664b6589c8feb6c4f7b82 (patch)
treea0333c3dd368f8f107fcbcb6ff6f3ae5f220d44b /engines/gob
parentdbb70e3d6f3b6ce5ff0497dbded420783edb3256 (diff)
downloadscummvm-rg350-26dd2f5f603b10b3b54664b6589c8feb6c4f7b82.tar.gz
scummvm-rg350-26dd2f5f603b10b3b54664b6589c8feb6c4f7b82.tar.bz2
scummvm-rg350-26dd2f5f603b10b3b54664b6589c8feb6c4f7b82.zip
GOB: Move keyPressed() to Util
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/inter.h2
-rw-r--r--engines/gob/inter_geisha.cpp14
-rw-r--r--engines/gob/util.cpp12
-rw-r--r--engines/gob/util.h1
4 files changed, 14 insertions, 15 deletions
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index c84cc384ce..d1c28fcb2f 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -362,8 +362,6 @@ protected:
void oGeisha_caress2(OpGobParams &params);
int16 loadSound(int16 slot);
-
- bool keyPressed();
};
class Inter_v2 : public Inter_v1 {
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index 6c3e97c2a7..d72dd798a4 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -82,18 +82,6 @@ void Inter_Geisha::oGeisha_loadCursor(OpFuncParams &params) {
o1_loadCursor(params);
}
-bool Inter_Geisha::keyPressed() {
- int16 key = _vm->_util->checkKey();
- if (key)
- return true;
-
- int16 x, y;
- MouseButtons buttons;
-
- _vm->_util->getMouseState(&x, &y, &buttons);
- return buttons != kMouseButtonsNone;
-}
-
struct TOTTransition {
const char *to;
const char *from;
@@ -134,7 +122,7 @@ void Inter_Geisha::oGeisha_loadTot(OpFuncParams &params) {
}
if (needWait)
- while (!keyPressed())
+ while (!_vm->_util->keyPressed())
_vm->_util->longDelay(1);
}
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 58dfc9c7ad..7f9c6131fd 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -257,6 +257,18 @@ bool Util::checkKey(int16 &key) {
return true;
}
+bool Util::keyPressed() {
+ int16 key = checkKey();
+ if (key)
+ return true;
+
+ int16 x, y;
+ MouseButtons buttons;
+
+ getMouseState(&x, &y, &buttons);
+ return buttons != kMouseButtonsNone;
+}
+
void Util::getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons) {
Common::Point mouse = g_system->getEventManager()->getMousePos();
*pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX;
diff --git a/engines/gob/util.h b/engines/gob/util.h
index 7c1e44c0f6..4228dac768 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -108,6 +108,7 @@ public:
int16 getKey();
int16 checkKey();
bool checkKey(int16 &key);
+ bool keyPressed();
void getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons);
void setMousePos(int16 x, int16 y);