Add support for using disks images for Apple II version of Maniac Mansion.

svn-id: r25846
This commit is contained in:
Travis Howell 2007-02-25 07:23:52 +00:00
parent 87832481de
commit 19d2310b71
10 changed files with 78 additions and 22 deletions

View file

@ -1742,7 +1742,7 @@ void ScummEngine::resetV1ActorTalkColor() {
int i; int i;
for (i = 1; i < _numActors; i++) { for (i = 1; i < _numActors; i++) {
if (_game.platform == Common::kPlatformC64) { if (_game.version == 0) {
_actors[i]->_talkColor = c64MMActorTalkColor[i]; _actors[i]->_talkColor = c64MMActorTalkColor[i];
} else { } else {
_actors[i]->_talkColor = v1MMActorTalkColor[i]; _actors[i]->_talkColor = v1MMActorTalkColor[i];

View file

@ -25,6 +25,8 @@
#include "common/util.h" #include "common/util.h"
#include "common/md5.h" #include "common/md5.h"
#include "scumm/scumm.h"
using Common::File; using Common::File;
namespace Scumm { 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; _disk1 = disk1;
_disk2 = disk2; _disk2 = disk2;
_game = game;
_openedDisk = 0; _openedDisk = 0;
if (maniac) { if (_game.id == GID_MANIAC) {
_numGlobalObjects = 256; _numGlobalObjects = 256;
_numRooms = 55; _numRooms = 55;
_numCostumes = 25; _numCostumes = 25;
@ -1559,7 +1562,12 @@ bool ScummC64File::open(const Common::String &filename, AccessMode mode) {
// check signature // check signature
openDisk(1); openDisk(1);
File::seek(0);
if (_game.platform == Common::kPlatformApple2GS) {
File::seek(142080);
} else {
File::seek(0);
}
signature = fileReadUint16LE(); signature = fileReadUint16LE();
if (signature != 0x0A31) { if (signature != 0x0A31) {
@ -1570,11 +1578,19 @@ bool ScummC64File::open(const Common::String &filename, AccessMode mode) {
extractIndex(0); // Fill in resource arrays extractIndex(0); // Fill in resource arrays
openDisk(2); openDisk(2);
File::seek(0);
signature = fileReadUint16LE(); if (_game.platform == Common::kPlatformApple2GS) {
if (signature != 0x0132) File::seek(143104);
error("Error: signature not found in disk 2!\n"); 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; return true;
} }
@ -1585,13 +1601,22 @@ uint16 ScummC64File::extractIndex(Common::WriteStream *out) {
uint16 reslen = 0; uint16 reslen = 0;
openDisk(1); openDisk(1);
File::seek(0);
if (_game.platform == Common::kPlatformApple2GS) {
File::seek(142080);
} else {
File::seek(0);
}
// skip signature // skip signature
fileReadUint16LE(); fileReadUint16LE();
// write expected signature // 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 // copy object flags
for (i = 0; i < _numGlobalObjects; i++) for (i = 0; i < _numGlobalObjects; i++)
@ -1647,7 +1672,13 @@ bool ScummC64File::generateIndex() {
} }
uint16 ScummC64File::extractResource(Common::WriteStream *out, int res) { 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,
0, 21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336, 0, 21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336,
357, 376, 395, 414, 433, 452, 471, 357, 376, 395, 414, 433, 452, 471,
@ -1659,7 +1690,11 @@ uint16 ScummC64File::extractResource(Common::WriteStream *out, int res) {
openDisk(_roomDisks[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++) { for (i = 0; i < _resourcesPerFile[res]; i++) {
uint16 len = fileReadUint16LE(); uint16 len = fileReadUint16LE();

View file

@ -25,6 +25,8 @@
#include "common/file.h" #include "common/file.h"
#include "scumm/plugin.h"
namespace Scumm { namespace Scumm {
class BaseScummFile : public Common::File { class BaseScummFile : public Common::File {
@ -116,7 +118,8 @@ private:
byte *_buf; byte *_buf;
bool _maniac; GameSettings _game;
Common::String _disk1, _disk2; Common::String _disk1, _disk2;
int _openedDisk; int _openedDisk;
@ -139,7 +142,7 @@ private:
uint16 fileReadUint16LE(); uint16 fileReadUint16LE();
public: public:
ScummC64File(const char *disk1, const char *disk2, bool maniac); ScummC64File(const char *disk1, const char *disk2, GameSettings game);
void setEnc(byte value); void setEnc(byte value);
bool open(const Common::String &filename, AccessMode mode = kFileReadMode); bool open(const Common::String &filename, AccessMode mode = kFileReadMode);

View file

@ -1235,13 +1235,13 @@ void ScummEngine_v5::drawFlashlight() {
_flashlight.isDrawn = true; _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... // 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 // 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 // always visible, and actors are always colored, so we fake the correct
// light value for it. // light value for it.
int ScummEngine::getCurrentLights() const { int ScummEngine::getCurrentLights() const {
if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) if (_game.id == GID_MANIAC && _game.version == 0)
return _currentLights; return _currentLights;
else if (_game.version >= 6) else if (_game.version >= 6)
return LIGHTMODE_room_lights_on | LIGHTMODE_actor_use_colors; return LIGHTMODE_room_lights_on | LIGHTMODE_actor_use_colors;

View file

@ -440,7 +440,7 @@ void ScummEngine_v2::processKeyboard(int lastKeyHit) {
confirmRestartDialog(); confirmRestartDialog();
} else { } 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))) { (VAR_CUTSCENEEXIT_KEY != 0xFF && lastKeyHit == 314+VAR(VAR_CUTSCENEEXIT_KEY))) {
abortCutscene(); abortCutscene();
} else { } else {

View file

@ -33,7 +33,10 @@ namespace Scumm {
void ScummEngine::resetPalette() { void ScummEngine::resetPalette() {
if (_game.version <= 1) { 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(); setC64Palette();
} else if (_game.platform == Common::kPlatformNES) { } else if (_game.platform == Common::kPlatformNES) {
setNESPalette(); setNESPalette();

View file

@ -206,6 +206,7 @@ static const ObsoleteGameID obsoleteGameIDsTable[] = {
// only a single unique variant. This is used to help the detector quickly // 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. // decide whether it has to worry about distinguishing multiple variants or not.
static const GameSettings gameVariantsTable[] = { 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", "C64", 0, GID_MANIAC, 0, 0, MDT_PCSPK, 0, Common::kPlatformC64},
{"maniac", "V1", "v1", GID_MANIAC, 1, 0, MDT_PCSPK, 0, Common::kPlatformPC}, {"maniac", "V1", "v1", GID_MANIAC, 1, 0, MDT_PCSPK, 0, Common::kPlatformPC},
{"maniac", "NES", 0, GID_MANIAC, 1, 0, MDT_NONE, 0, Common::kPlatformNES}, {"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.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
{ "maniac", "%02d.MAN", kGenRoomNum, UNK_LANG, UNK, "Demo" }, { "maniac", "%02d.MAN", kGenRoomNum, UNK_LANG, UNK, "Demo" },
{ "maniac", "maniac1.d64", kGenUnchanged, UNK_LANG, Common::kPlatformC64, "C64" }, // ... and maniac2.d64 { "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 (E).prg", kGenUnchanged, Common::EN_GRB, Common::kPlatformNES, "NES" },
{ "maniac", "Maniac Mansion (F).prg", kGenUnchanged, Common::FR_FRA, 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" }, { "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; return false;
} }
if (file == "maniac1.d64" || file == "zak1.d64") { if (file == "maniac1.d64" || file == "maniac1.dsk" || file == "zak1.d64") {
// TODO // TODO
} else if (file == "00.LFL") { } else if (file == "00.LFL") {
// Used in V1, V2, V3 games. // Used in V1, V2, V3 games.

View file

@ -33,7 +33,7 @@ void ScummEngine_v2::readClassicIndexFile() {
int i; int i;
if (_game.id == GID_MANIAC) { if (_game.id == GID_MANIAC) {
if (_game.platform == Common::kPlatformC64) { if (_game.version == 0) {
_numGlobalObjects = 256; _numGlobalObjects = 256;
_numRooms = 55; _numRooms = 55;
_numCostumes = 25; _numCostumes = 25;

View file

@ -1617,6 +1617,7 @@ void ScummEngine_v2::o2_dummy() {
} }
void ScummEngine_v2::o2_switchCostumeSet() { void ScummEngine_v2::o2_switchCostumeSet() {
printf("o2_switchCostumeSet\n");
// NES version of maniac uses this to switch between the two // NES version of maniac uses this to switch between the two
// groups of costumes it has // groups of costumes it has
if (_game.platform == Common::kPlatformNES) if (_game.platform == Common::kPlatformNES)

View file

@ -979,6 +979,18 @@ int ScummEngine::init() {
_fileHandle = new ScummNESFile(); _fileHandle = new ScummNESFile();
_containerFile = _filenamePattern.pattern; _containerFile = _filenamePattern.pattern;
_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.pattern = "%.2d.LFL";
_filenamePattern.genMethod = kGenRoomNum; _filenamePattern.genMethod = kGenRoomNum;
} else if (_game.platform == Common::kPlatformC64) { } else if (_game.platform == Common::kPlatformC64) {
@ -993,7 +1005,7 @@ int ScummEngine::init() {
tmpBuf2 = "zak2.d64"; tmpBuf2 = "zak2.d64";
} }
_fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game.id == GID_MANIAC); _fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game);
_containerFile = tmpBuf1; _containerFile = tmpBuf1;
_filenamePattern.pattern = "%.2d.LFL"; _filenamePattern.pattern = "%.2d.LFL";
@ -1560,7 +1572,7 @@ void ScummEngine::setupMusic(int midi) {
// Init iMuse // Init iMuse
if (_game.version >= 7) { if (_game.version >= 7) {
// Setup for digital iMuse is performed in another place // 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 // TODO
_musicEngine = NULL; _musicEngine = NULL;
} else if (_game.platform == Common::kPlatformNES) { } else if (_game.platform == Common::kPlatformNES) {