diff options
author | Max Horn | 2011-04-05 11:51:14 +0200 |
---|---|---|
committer | Max Horn | 2011-04-05 15:18:09 +0200 |
commit | f19b27388cb5e07b307eed21a1302d961c01ba1c (patch) | |
tree | 9573ba0075746084544b63bb4edfa6eb14a98257 | |
parent | fb5330384708a345d0c3728691d3ea36295b29d0 (diff) | |
download | scummvm-rg350-f19b27388cb5e07b307eed21a1302d961c01ba1c.tar.gz scummvm-rg350-f19b27388cb5e07b307eed21a1302d961c01ba1c.tar.bz2 scummvm-rg350-f19b27388cb5e07b307eed21a1302d961c01ba1c.zip |
SCUMM: Split ScummEngine::generateFilename, move HE specifics to class ScummEngine_v60he
-rw-r--r-- | engines/scumm/detection.cpp | 122 | ||||
-rw-r--r-- | engines/scumm/he/intern_he.h | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 2 |
3 files changed, 70 insertions, 56 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index f7ae50cc63..f0f9c7c9bc 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -77,8 +77,6 @@ Common::String ScummEngine::generateFilename(const int room) const { snprintf(buf, sizeof(buf), "disk%02d.lec", diskNumber); } } else { - char id = 0; - switch (_filenamePattern.genMethod) { case kGenDiskNum: snprintf(buf, sizeof(buf), _filenamePattern.pattern, diskNumber); @@ -88,59 +86,6 @@ Common::String ScummEngine::generateFilename(const int room) const { snprintf(buf, sizeof(buf), _filenamePattern.pattern, room); break; - case kGenHEMac: - case kGenHEMacNoParens: - case kGenHEPC: - if (room < 0) { - id = '0' - room; - } else if (_game.heversion >= 98) { - int disk = 0; - if (_heV7DiskOffsets) - disk = _heV7DiskOffsets[room]; - - switch (disk) { - case 2: - id = 'b'; - // Special cases for Blue's games, which share common (b) files - if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO)) - strcpy(buf, "Blue'sBirthday.(b)"); - else if (_game.id == GID_TREASUREHUNT) - strcpy(buf, "Blue'sTreasureHunt.(b)"); - else - snprintf(buf, sizeof(buf), "%s.(b)", _filenamePattern.pattern); - break; - case 1: - id = 'a'; - snprintf(buf, sizeof(buf), "%s.(a)", _filenamePattern.pattern); - break; - default: - id = '0'; - snprintf(buf, sizeof(buf), "%s.he0", _filenamePattern.pattern); - } - } else if (_game.heversion >= 70) { - id = (room == 0) ? '0' : '1'; - } else { - id = diskNumber + '0'; - } - - if (_filenamePattern.genMethod == kGenHEPC) { - // For HE >= 98, we already called snprintf above. - if (_game.heversion < 98 || room < 0) - 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; - case kGenUnchanged: strncpy(buf, _filenamePattern.pattern, sizeof(buf)); break; @@ -153,6 +98,73 @@ Common::String ScummEngine::generateFilename(const int room) const { return buf; } +Common::String ScummEngine_v60he::generateFilename(const int room) const { + char buf[128]; + char id = 0; + + switch (_filenamePattern.genMethod) { + case kGenHEMac: + case kGenHEMacNoParens: + case kGenHEPC: + if (room < 0) { + id = '0' - room; + } else if (_game.heversion >= 98) { + int disk = 0; + if (_heV7DiskOffsets) + disk = _heV7DiskOffsets[room]; + + switch (disk) { + case 2: + id = 'b'; + // Special cases for Blue's games, which share common (b) files + if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO)) + strcpy(buf, "Blue'sBirthday.(b)"); + else if (_game.id == GID_TREASUREHUNT) + strcpy(buf, "Blue'sTreasureHunt.(b)"); + else + snprintf(buf, sizeof(buf), "%s.(b)", _filenamePattern.pattern); + break; + case 1: + id = 'a'; + snprintf(buf, sizeof(buf), "%s.(a)", _filenamePattern.pattern); + break; + default: + id = '0'; + snprintf(buf, sizeof(buf), "%s.he0", _filenamePattern.pattern); + } + } else if (_game.heversion >= 70) { + id = (room == 0) ? '0' : '1'; + } else { + const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; + id = diskNumber + '0'; + } + + if (_filenamePattern.genMethod == kGenHEPC) { + // For HE >= 98, we already called snprintf above. + if (_game.heversion < 98 || room < 0) + 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 original method + return ScummEngine::generateFilename(room); + } + + return buf; +} + static Common::String generateFilenameForDetection(const char *pattern, FilenameGenMethod genMethod) { char buf[128]; diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index c0eaf7352b..92a8ca9309 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -67,6 +67,8 @@ public: ScummEngine_v60he(OSystem *syst, const DetectorResult &dr); ~ScummEngine_v60he(); + virtual Common::String generateFilename(const int room) const; + virtual void resetScumm(); protected: diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 23e6b7b256..f26385a21e 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -613,7 +613,7 @@ public: FilenamePattern _filenamePattern; - Common::String generateFilename(const int room) const; + virtual Common::String generateFilename(const int room) const; protected: Common::KeyState _keyPressed; |