diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 11f25991e7f..b2e237e7b6a 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 4ad1d4884b0..e626d78ef98 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 c92b908846d..4ec718da4c9 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];