From 060562c2773cdfc28b78d1c08977070d94673ec2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 21 Dec 2002 12:34:17 +0000 Subject: partial checkin of patch #655594 (handling Y/N questions); cleanup svn-id: r6042 --- scumm/dialogs.h | 13 +++++++++---- scumm/gfx.cpp | 5 ++++- scumm/resource.cpp | 9 +++------ scumm/scumm.h | 3 +-- scumm/string.cpp | 4 +++- scumm/vars.cpp | 1 + 6 files changed, 21 insertions(+), 14 deletions(-) (limited to 'scumm') diff --git a/scumm/dialogs.h b/scumm/dialogs.h index abe21082d2..4232d514c7 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -120,10 +120,8 @@ public: { close(); } virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers) { - if (ascii == ' ') // Close pause dialog if space key is pressed - close(); - else - ScummDialog::handleKeyDown(ascii, keycode, modifiers); + setResult(ascii); + close(); } protected: void setInfoText (const String& message); @@ -132,6 +130,13 @@ protected: class PauseDialog : public InfoDialog { public: PauseDialog(NewGui *gui, Scumm *scumm); + virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers) + { + if (ascii == ' ') // Close pause dialog if space key is pressed + close(); + else + ScummDialog::handleKeyDown(ascii, keycode, modifiers); + } }; #ifdef _WIN32_WCE diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 65d4aa07be..ba4dacba5d 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -410,7 +410,10 @@ void Gdi::drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b) if (height > _vm->_realHeight) height = _vm->_realHeight; - assert(_vm->_screenTop >= 0); + // Normally, _vm->_screenTop should always be >= 0, but for some old save games + // it is not, hence we check & correct it here. + if (_vm->_screenTop < 0) + _vm->_screenTop = 0; ptr = vs->screenPtr + (x + vs->xstart) + (_vm->_screenTop + t) * _vm->_realWidth; _vm->_system->copy_rect(ptr, _vm->_realWidth, x, vs->topline + t, w, height); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 34524a5128..5551d00f0f 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -54,7 +54,7 @@ void Scumm::openRoom(int room) } /* Either xxx.lfl or monkey.xxx file name */ - while (!_resFilePrefix) { + while (1) { if (_features & GF_SMALL_NAMES) roomlimit = 98; else @@ -64,7 +64,7 @@ void Scumm::openRoom(int room) else room_offs = room ? _roomFileOffsets[room] : 0; - if (room_offs == (int)0xFFFFFFFF) + if (room_offs == -1) break; if (room_offs != 0 && room != 0) { @@ -96,10 +96,7 @@ void Scumm::openRoom(int room) } } else { sprintf(buf, "%.2d.lfl", room); - if (_features & GF_OLD_BUNDLE) - _encbyte = 0xFF; - else - _encbyte = 0; + _encbyte = (_features & GF_USE_KEY) ? 0xFF : 0; } if (openResourceFile(buf)) { diff --git a/scumm/scumm.h b/scumm/scumm.h index eed9c89e43..66ef16f676 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -533,7 +533,6 @@ public: /* Should be in Resource class */ byte _encbyte; File _fileHandle; - char *_resFilePrefix, *_resFilePath; uint32 _fileOffset; char *_exe_name; // This is the name we use for opening resource files char *_game_name; // This is the game the user calls it, so use for saving @@ -578,7 +577,6 @@ public: void nukeCharset(int i); int _lastLoadedRoom, _roomResource; - byte _resFilePathId, _fileReadFailed; byte *findResourceData(uint32 tag, byte *ptr); int getResourceDataSize(byte *ptr); @@ -952,6 +950,7 @@ public: #endif /* Scumm Vars */ + byte VAR_KEYPRESS; byte VAR_EGO; byte VAR_CAMERA_POS_X; byte VAR_HAVE_MSG; diff --git a/scumm/string.cpp b/scumm/string.cpp index 328cd4ef14..0803f5102f 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -423,7 +423,9 @@ void Scumm::unkMessage2() _string[3].color = 4; InfoDialog* dialog = new InfoDialog(_newgui, this, (char*)buf); - runDialog (dialog); + // FIXME: I know this is the right thing to do for MI1 and MI2. For + // all other games it's just a guess. + _vars[VAR_KEYPRESS] = runDialog (dialog); delete dialog; _messagePtr = tmp; diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 4b7d32861e..2393ad68dd 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -26,6 +26,7 @@ void Scumm::setupScummVars() { + VAR_KEYPRESS = 0; VAR_EGO = 1; VAR_CAMERA_POS_X = 2; VAR_HAVE_MSG = 3; -- cgit v1.2.3