diff options
author | Travis Howell | 2007-02-25 07:23:52 +0000 |
---|---|---|
committer | Travis Howell | 2007-02-25 07:23:52 +0000 |
commit | 19d2310b716fe01e711d23b61563fb25d025003b (patch) | |
tree | a4bf97bdd2505c1abfea8bb2789454130c249341 /engines | |
parent | 87832481de03ee60726620b0a4f78710c077462d (diff) | |
download | scummvm-rg350-19d2310b716fe01e711d23b61563fb25d025003b.tar.gz scummvm-rg350-19d2310b716fe01e711d23b61563fb25d025003b.tar.bz2 scummvm-rg350-19d2310b716fe01e711d23b61563fb25d025003b.zip |
Add support for using disks images for Apple II version of Maniac Mansion.
svn-id: r25846
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/actor.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/file.cpp | 57 | ||||
-rw-r--r-- | engines/scumm/file.h | 7 | ||||
-rw-r--r-- | engines/scumm/gfx.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/palette.cpp | 5 | ||||
-rw-r--r-- | engines/scumm/plugin.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/resource_v2.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/script_v2.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 16 |
10 files changed, 78 insertions, 22 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 4efadf3d64..013f279369 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1742,7 +1742,7 @@ void ScummEngine::resetV1ActorTalkColor() { int i; for (i = 1; i < _numActors; i++) { - if (_game.platform == Common::kPlatformC64) { + if (_game.version == 0) { _actors[i]->_talkColor = c64MMActorTalkColor[i]; } else { _actors[i]->_talkColor = v1MMActorTalkColor[i]; diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 0d580a327c..3702fb69dd 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -25,6 +25,8 @@ #include "common/util.h" #include "common/md5.h" +#include "scumm/scumm.h" + using Common::File; namespace Scumm { @@ -1481,13 +1483,14 @@ static const int zakResourcesPerFile[59] = { }; -ScummC64File::ScummC64File(const char *disk1, const char *disk2, bool maniac) : _stream(0), _buf(0), _maniac(maniac) { +ScummC64File::ScummC64File(const char *disk1, const char *disk2, GameSettings game) : _stream(0), _buf(0) { _disk1 = disk1; _disk2 = disk2; + _game = game; _openedDisk = 0; - if (maniac) { + if (_game.id == GID_MANIAC) { _numGlobalObjects = 256; _numRooms = 55; _numCostumes = 25; @@ -1559,7 +1562,12 @@ bool ScummC64File::open(const Common::String &filename, AccessMode mode) { // check signature openDisk(1); - File::seek(0); + + if (_game.platform == Common::kPlatformApple2GS) { + File::seek(142080); + } else { + File::seek(0); + } signature = fileReadUint16LE(); if (signature != 0x0A31) { @@ -1570,11 +1578,19 @@ bool ScummC64File::open(const Common::String &filename, AccessMode mode) { extractIndex(0); // Fill in resource arrays openDisk(2); - File::seek(0); - signature = fileReadUint16LE(); - if (signature != 0x0132) - error("Error: signature not found in disk 2!\n"); + if (_game.platform == Common::kPlatformApple2GS) { + File::seek(143104); + signature = fileReadUint16LE(); + if (signature != 0x0032) + error("Error: signature not found in disk 2!\n"); + } else { + File::seek(0); + signature = fileReadUint16LE(); + if (signature != 0x0132) + error("Error: signature not found in disk 2!\n"); + } + return true; } @@ -1585,13 +1601,22 @@ uint16 ScummC64File::extractIndex(Common::WriteStream *out) { uint16 reslen = 0; openDisk(1); - File::seek(0); + + if (_game.platform == Common::kPlatformApple2GS) { + File::seek(142080); + } else { + File::seek(0); + } // skip signature fileReadUint16LE(); // write expected signature - reslen += write_word(out, 0x0132); + if (_game.platform == Common::kPlatformApple2GS) { + reslen += write_word(out, 0x0132); + } else { + reslen += write_word(out, 0x0032); + } // copy object flags for (i = 0; i < _numGlobalObjects; i++) @@ -1647,7 +1672,13 @@ bool ScummC64File::generateIndex() { } uint16 ScummC64File::extractResource(Common::WriteStream *out, int res) { - const int SectorOffset[36] = { + const int AppleSectorOffset[36] = { + 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256, + 272, 288, 304, 320, 336, 352, 368, + 384, 400, 416, 432, 448, 464, + 480, 496, 512, 528, 544, 560 + }; + const int C64SectorOffset[36] = { 0, 0, 21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336, 357, 376, 395, 414, 433, 452, 471, @@ -1659,7 +1690,11 @@ uint16 ScummC64File::extractResource(Common::WriteStream *out, int res) { openDisk(_roomDisks[res]); - File::seek((SectorOffset[_roomTracks[res]] + _roomSectors[res]) * 256); + if (_game.platform == Common::kPlatformApple2GS) { + File::seek((AppleSectorOffset[_roomTracks[res]] + _roomSectors[res]) * 256); + } else { + File::seek((C64SectorOffset[_roomTracks[res]] + _roomSectors[res]) * 256); + } for (i = 0; i < _resourcesPerFile[res]; i++) { uint16 len = fileReadUint16LE(); diff --git a/engines/scumm/file.h b/engines/scumm/file.h index 7a0ea8ae72..82864c900b 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -25,6 +25,8 @@ #include "common/file.h" +#include "scumm/plugin.h" + namespace Scumm { class BaseScummFile : public Common::File { @@ -116,7 +118,8 @@ private: byte *_buf; - bool _maniac; + GameSettings _game; + Common::String _disk1, _disk2; int _openedDisk; @@ -139,7 +142,7 @@ private: uint16 fileReadUint16LE(); public: - ScummC64File(const char *disk1, const char *disk2, bool maniac); + ScummC64File(const char *disk1, const char *disk2, GameSettings game); void setEnc(byte value); bool open(const Common::String &filename, AccessMode mode = kFileReadMode); diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index d0350aef40..9426d8dbde 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -1235,13 +1235,13 @@ void ScummEngine_v5::drawFlashlight() { _flashlight.isDrawn = true; } -// C64 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses +// V0 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses // an internal variable. Emulate this to prevent overwriting script vars... // And V6 games do not use the "lights" at all. There, the whole screen is // always visible, and actors are always colored, so we fake the correct // light value for it. int ScummEngine::getCurrentLights() const { - if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) + if (_game.id == GID_MANIAC && _game.version == 0) return _currentLights; else if (_game.version >= 6) return LIGHTMODE_room_lights_on | LIGHTMODE_actor_use_colors; diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 3bd7202ac5..c8bff3d504 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -440,7 +440,7 @@ void ScummEngine_v2::processKeyboard(int lastKeyHit) { confirmRestartDialog(); } else { - if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && lastKeyHit == 27) || + if ((_game.version == 0 && lastKeyHit == 27) || (VAR_CUTSCENEEXIT_KEY != 0xFF && lastKeyHit == 314+VAR(VAR_CUTSCENEEXIT_KEY))) { abortCutscene(); } else { diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index a288951281..b276c2bb84 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -33,7 +33,10 @@ namespace Scumm { void ScummEngine::resetPalette() { if (_game.version <= 1) { - if (_game.platform == Common::kPlatformC64) { + if (_game.platform == Common::kPlatformApple2GS) { + // TODO: unique palette? + setC64Palette(); + } else if (_game.platform == Common::kPlatformC64) { setC64Palette(); } else if (_game.platform == Common::kPlatformNES) { setNESPalette(); diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp index 69b4aefdbb..4079373a85 100644 --- a/engines/scumm/plugin.cpp +++ b/engines/scumm/plugin.cpp @@ -206,6 +206,7 @@ static const ObsoleteGameID obsoleteGameIDsTable[] = { // only a single unique variant. This is used to help the detector quickly // decide whether it has to worry about distinguishing multiple variants or not. static const GameSettings gameVariantsTable[] = { + {"maniac", "Apple II", 0, GID_MANIAC, 0, 0, MDT_PCSPK, 0, Common::kPlatformApple2GS}, {"maniac", "C64", 0, GID_MANIAC, 0, 0, MDT_PCSPK, 0, Common::kPlatformC64}, {"maniac", "V1", "v1", GID_MANIAC, 1, 0, MDT_PCSPK, 0, Common::kPlatformPC}, {"maniac", "NES", 0, GID_MANIAC, 1, 0, MDT_NONE, 0, Common::kPlatformNES}, @@ -400,6 +401,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "maniac", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 }, { "maniac", "%02d.MAN", kGenRoomNum, UNK_LANG, UNK, "Demo" }, { "maniac", "maniac1.d64", kGenUnchanged, UNK_LANG, Common::kPlatformC64, "C64" }, // ... and maniac2.d64 + { "maniac", "maniac1.dsk", kGenUnchanged, UNK_LANG, Common::kPlatformApple2GS, "Apple II" }, // ... and maniac2.dsk { "maniac", "Maniac Mansion (E).prg", kGenUnchanged, Common::EN_GRB, Common::kPlatformNES, "NES" }, { "maniac", "Maniac Mansion (F).prg", kGenUnchanged, Common::FR_FRA, Common::kPlatformNES, "NES" }, { "maniac", "Maniac Mansion (SW).prg", kGenUnchanged, Common::SE_SWE, Common::kPlatformNES, "NES" }, @@ -1241,7 +1243,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com return false; } - if (file == "maniac1.d64" || file == "zak1.d64") { + if (file == "maniac1.d64" || file == "maniac1.dsk" || file == "zak1.d64") { // TODO } else if (file == "00.LFL") { // Used in V1, V2, V3 games. diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp index 32d4685f6d..2a20c8c1d5 100644 --- a/engines/scumm/resource_v2.cpp +++ b/engines/scumm/resource_v2.cpp @@ -33,7 +33,7 @@ void ScummEngine_v2::readClassicIndexFile() { int i; if (_game.id == GID_MANIAC) { - if (_game.platform == Common::kPlatformC64) { + if (_game.version == 0) { _numGlobalObjects = 256; _numRooms = 55; _numCostumes = 25; diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index 2fff7379db..d28e90b12f 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -1617,6 +1617,7 @@ void ScummEngine_v2::o2_dummy() { } void ScummEngine_v2::o2_switchCostumeSet() { + printf("o2_switchCostumeSet\n"); // NES version of maniac uses this to switch between the two // groups of costumes it has if (_game.platform == Common::kPlatformNES) diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 04ba1d27a8..e153b5efe6 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -981,6 +981,18 @@ int ScummEngine::init() { _filenamePattern.pattern = "%.2d.LFL"; _filenamePattern.genMethod = kGenRoomNum; + } else if (_game.platform == Common::kPlatformApple2GS) { + // Read data from Apple II disk images. + const char *tmpBuf1, *tmpBuf2; + assert(_game.id == GID_MANIAC); + tmpBuf1 = "maniac1.dsk"; + tmpBuf2 = "maniac2.dsk"; + + _fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game); + _containerFile = tmpBuf1; + + _filenamePattern.pattern = "%.2d.LFL"; + _filenamePattern.genMethod = kGenRoomNum; } else if (_game.platform == Common::kPlatformC64) { // Read data from C64 disk images. const char *tmpBuf1, *tmpBuf2; @@ -993,7 +1005,7 @@ int ScummEngine::init() { tmpBuf2 = "zak2.d64"; } - _fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game.id == GID_MANIAC); + _fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game); _containerFile = tmpBuf1; _filenamePattern.pattern = "%.2d.LFL"; @@ -1560,7 +1572,7 @@ void ScummEngine::setupMusic(int midi) { // Init iMuse if (_game.version >= 7) { // Setup for digital iMuse is performed in another place - } else if (_game.platform == Common::kPlatformC64) { + } else if (_game.platform == Common::kPlatformApple2GS || _game.platform == Common::kPlatformC64) { // TODO _musicEngine = NULL; } else if (_game.platform == Common::kPlatformNES) { |