aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs/toltecs.cpp
diff options
context:
space:
mode:
authorBenjamin Haisch2010-06-18 14:18:44 +0000
committerWillem Jan Palenstijn2011-11-20 22:43:09 +0100
commit2acf1bf6f589f162908b456cb69cb03df6e798e7 (patch)
treeec6c1a91d4e93b93c9df6bca0f7e2125fa4ce6a1 /engines/toltecs/toltecs.cpp
parent8ea6831825f2d16ca03a8bc5be946465f9bb3fd9 (diff)
downloadscummvm-rg350-2acf1bf6f589f162908b456cb69cb03df6e798e7.tar.gz
scummvm-rg350-2acf1bf6f589f162908b456cb69cb03df6e798e7.tar.bz2
scummvm-rg350-2acf1bf6f589f162908b456cb69cb03df6e798e7.zip
TOLTECS: - Hopefully fixed a bug in findRectAtPoint which causes the game to crash before the first scene
- sfHandleInput
Diffstat (limited to 'engines/toltecs/toltecs.cpp')
-rw-r--r--engines/toltecs/toltecs.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index 2e4d4f6454..62bf250062 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -245,6 +245,7 @@ void ToltecsEngine::updateScreen() {
//printf("_guiHeight = %d\n", _guiHeight); fflush(stdout);
if (_screen->_guiRefresh && _guiHeight > 0 && _cameraHeight > 0) {
+ // Update the GUI when needed and it's visible
_system->copyRectToScreen((const byte *)_screen->_frontScreen + _cameraHeight * 640,
640, 0, _cameraHeight, 640, _guiHeight);
_screen->_guiRefresh = false;
@@ -263,6 +264,9 @@ void ToltecsEngine::updateInput() {
while (eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
+ _keyState = event.kbd;
+
+ //debug("key: flags = %02X; keycode = %d", _keyState.flags, _keyState.keycode);
// FIXME: This is just for debugging
switch (event.kbd.keycode) {
@@ -277,6 +281,9 @@ void ToltecsEngine::updateInput() {
}
break;
+ case Common::EVENT_KEYUP:
+ _keyState.reset();
+ break;
case Common::EVENT_QUIT:
quitGame();
break;
@@ -540,11 +547,12 @@ void ToltecsEngine::walk(byte *walkData) {
}
-int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize) {
+int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
+ byte *rectDataEnd) {
rectData += index * itemSize;
- while (1) {
+ while (rectData < rectDataEnd) {
int16 rectY = READ_LE_UINT16(rectData);
if (rectY == -10)
break;