aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2006-04-23 21:56:09 +0000
committerMax Horn2006-04-23 21:56:09 +0000
commite0a5a2b89e3414f944e24d86a9bf2c8b20526a78 (patch)
tree911927e0bbea537b2ab929e016f5ab5e87b35d03 /engines/scumm
parent1a7b4a7d7c654fca8efad976ffb81bde0d16c15a (diff)
downloadscummvm-rg350-e0a5a2b89e3414f944e24d86a9bf2c8b20526a78.tar.gz
scummvm-rg350-e0a5a2b89e3414f944e24d86a9bf2c8b20526a78.tar.bz2
scummvm-rg350-e0a5a2b89e3414f944e24d86a9bf2c8b20526a78.zip
Fix access to .he3/.he4 files
svn-id: r22118
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/he/resource_he.cpp6
-rw-r--r--engines/scumm/he/sound_he.cpp5
-rw-r--r--engines/scumm/plugin.cpp7
3 files changed, 11 insertions, 7 deletions
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 11f25991e7..b2e237e7b6 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -159,7 +159,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
fi.file = new Common::File;
if (_fileName.empty()) { // We are running for the first time
- _fileName = _vm->generateFilename(3);
+ _fileName = _vm->generateFilename(-3);
}
@@ -1282,7 +1282,7 @@ int MacResExtractor::extractResource(int id, byte **buf) {
int size;
if (_fileName.empty()) { // We are running for the first time
- _fileName = _vm->generateFilename(3);
+ _fileName = _vm->generateFilename(-3);
// Some programs write it as .bin. Try that too
if (!in.exists(_fileName)) {
@@ -1637,6 +1637,8 @@ void ScummEngine_v70he::readRoomsOffsets() {
void ScummEngine_v70he::readGlobalObjects() {
int num = _fileHandle->readUint16LE();
assert(num == _numGlobalObjects);
+ assert(_objectStateTable);
+ assert(_objectOwnerTable);
_fileHandle->read(_objectStateTable, num);
_fileHandle->read(_objectOwnerTable, num);
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 4ad1d4884b..e626d78ef9 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -282,7 +282,7 @@ void SoundHE::setOverrideFreq(int freq) {
void SoundHE::setupHEMusicFile() {
int i, total_size;
Common::File musicFile;
- Common::String buf(_vm->generateFilename(4));
+ Common::String buf(_vm->generateFilename(-4));
if (musicFile.open(buf) == true) {
musicFile.seek(4, SEEK_SET);
@@ -475,7 +475,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
if (soundID > _vm->_numSounds) {
int music_offs;
Common::File musicFile;
- Common::String buf(_vm->generateFilename(4));
+ Common::String buf(_vm->generateFilename(-4));
if (musicFile.open(buf) == false) {
warning("playHESound: Can't open music file %s", buf.c_str());
@@ -634,6 +634,7 @@ void SoundHE::startHETalkSound(uint32 offset) {
if (ConfMan.getBool("speech_mute"))
return;
+ assert(_sfxFile);
if (!_sfxFile->isOpen()) {
error("startHETalkSound: Speech file is not open");
return;
diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp
index c92b908846..4ec718da4c 100644
--- a/engines/scumm/plugin.cpp
+++ b/engines/scumm/plugin.cpp
@@ -760,7 +760,7 @@ const MD5Table *findInMD5Table(const char *md5) {
}
Common::String ScummEngine::generateFilename(const int room) const {
- const int diskNumber = room ? res.roomno[rtRoom][room] : 0;
+ const int diskNumber = (room > 0) ? res.roomno[rtRoom][room] : 0;
char buf[128];
if (_game.version == 4) {
@@ -784,8 +784,9 @@ Common::String ScummEngine::generateFilename(const int room) const {
case kGenHEMac:
case kGenHEMacNoParens:
case kGenHEPC:
- // FIXME: Not sure if the following HE section is quite correct...
- if (_game.heversion >= 98) {
+ if (room < 0) {
+ id = '0' - room;
+ } else if (_game.heversion >= 98) {
int disk = 0;
if (_heV7DiskOffsets)
disk = _heV7DiskOffsets[room];