From 827561911ac8ca8136ee062908717225947596ea Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 5 Apr 2011 12:10:05 +0200 Subject: SCUMM: Move _heV7DiskOffsets from ScummEngine to ScummEngine_v70he --- engines/scumm/detection.cpp | 50 +++++++++++++++++++++++++++++++++++++------- engines/scumm/he/intern_he.h | 3 +++ engines/scumm/scumm.cpp | 2 +- engines/scumm/scumm.h | 1 - 4 files changed, 47 insertions(+), 9 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index f0f9c7c9bc..87ec7b85a4 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -108,7 +108,44 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { case kGenHEPC: if (room < 0) { id = '0' - room; - } else if (_game.heversion >= 98) { + } else { + const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; + id = diskNumber + '0'; + } + + if (_filenamePattern.genMethod == kGenHEPC) { + snprintf(buf, sizeof(buf), "%s.he%c", _filenamePattern.pattern, id); + } else { + if (id == '3') { // special case for cursors + // For mac they're stored in game binary + strncpy(buf, _filenamePattern.pattern, sizeof(buf)); + } else { + if (_filenamePattern.genMethod == kGenHEMac) + snprintf(buf, sizeof(buf), "%s (%c)", _filenamePattern.pattern, id); + else + snprintf(buf, sizeof(buf), "%s %c", _filenamePattern.pattern, id); + } + } + + break; + + default: + // Fallback to parent method + return ScummEngine::generateFilename(room); + } + + return buf; +} + +Common::String ScummEngine_v70he::generateFilename(const int room) const { + char buf[128]; + char id = 0; + + switch (_filenamePattern.genMethod) { + case kGenHEMac: + case kGenHEMacNoParens: + case kGenHEPC: + if (_game.heversion >= 98 && room >= 0) { int disk = 0; if (_heV7DiskOffsets) disk = _heV7DiskOffsets[room]; @@ -132,11 +169,10 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { id = '0'; snprintf(buf, sizeof(buf), "%s.he0", _filenamePattern.pattern); } - } else if (_game.heversion >= 70) { - id = (room == 0) ? '0' : '1'; + } else if (room < 0) { + id = '0' - room; } else { - const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; - id = diskNumber + '0'; + id = (room == 0) ? '0' : '1'; } if (_filenamePattern.genMethod == kGenHEPC) { @@ -158,8 +194,8 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { break; default: - // Fallback to original method - return ScummEngine::generateFilename(room); + // Fallback to parent method + return ScummEngine_v60he::generateFilename(room); } return buf; diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 92a8ca9309..96807ccbd5 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -113,6 +113,7 @@ class ScummEngine_v70he : public ScummEngine_v60he { protected: ResExtractor *_resExtractor; + byte *_heV7DiskOffsets; byte *_heV7RoomOffsets; int32 _heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags, _heSndSoundFreq; @@ -124,6 +125,8 @@ public: ScummEngine_v70he(OSystem *syst, const DetectorResult &dr); ~ScummEngine_v70he(); + virtual Common::String generateFilename(const int room) const; + void restoreBackgroundHE(Common::Rect rect, int dirtybit = 0); protected: diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 7861807362..bd8b3e5759 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -201,7 +201,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _bootParam = 0; _dumpScripts = false; _debugMode = 0; - _heV7DiskOffsets = NULL; _heV7RoomIntOffsets = NULL; _objectOwnerTable = NULL; _objectRoomTable = NULL; @@ -788,6 +787,7 @@ ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr) else _resExtractor = new Win32ResExtractor(this); + _heV7DiskOffsets = NULL; _heV7RoomOffsets = NULL; _heSndSoundId = 0; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index f26385a21e..43c86cdc9f 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -773,7 +773,6 @@ public: protected: int _resourceHeaderSize; byte _resourceMapper[128]; - byte *_heV7DiskOffsets; uint32 *_heV7RoomIntOffsets; const byte *_resourceLastSearchBuf; // FIXME: need to put it to savefile? uint32 _resourceLastSearchSize; // FIXME: need to put it to savefile? -- cgit v1.2.3