aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2002-12-21 12:34:17 +0000
committerMax Horn2002-12-21 12:34:17 +0000
commit060562c2773cdfc28b78d1c08977070d94673ec2 (patch)
tree6b0836fd340d2fdebaddaf82abc28d56b15b89a3 /scumm
parent3b28dcbe3489d7459e58b63212b01118c0b10f9b (diff)
downloadscummvm-rg350-060562c2773cdfc28b78d1c08977070d94673ec2.tar.gz
scummvm-rg350-060562c2773cdfc28b78d1c08977070d94673ec2.tar.bz2
scummvm-rg350-060562c2773cdfc28b78d1c08977070d94673ec2.zip
partial checkin of patch #655594 (handling Y/N questions); cleanup
svn-id: r6042
Diffstat (limited to 'scumm')
-rw-r--r--scumm/dialogs.h13
-rw-r--r--scumm/gfx.cpp5
-rw-r--r--scumm/resource.cpp9
-rw-r--r--scumm/scumm.h3
-rw-r--r--scumm/string.cpp4
-rw-r--r--scumm/vars.cpp1
6 files changed, 21 insertions, 14 deletions
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;