GOB: Move keyPressed() to Util

This commit is contained in:
Sven Hesse 2011-09-03 17:21:25 +02:00
parent dbb70e3d6f
commit 26dd2f5f60
4 changed files with 14 additions and 15 deletions

View File

@ -362,8 +362,6 @@ protected:
void oGeisha_caress2(OpGobParams &params);
int16 loadSound(int16 slot);
bool keyPressed();
};
class Inter_v2 : public Inter_v1 {

View File

@ -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);
}

View File

@ -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;

View File

@ -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);