From a0d14a08320166437585548f2ddabc03e5faef7e Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 29 May 2006 12:45:11 +0000 Subject: Fix Commodore 64 versions svn-id: r22732 --- engines/scumm/actor.cpp | 6 +++--- engines/scumm/base-costume.cpp | 2 +- engines/scumm/boxes.cpp | 10 +++++----- engines/scumm/cursor.cpp | 2 +- engines/scumm/gfx.cpp | 8 ++++---- engines/scumm/object.cpp | 10 +++++----- engines/scumm/palette.cpp | 2 +- engines/scumm/plugin.cpp | 4 +++- engines/scumm/resource_v2.cpp | 5 ++++- engines/scumm/room.cpp | 12 ++++++------ engines/scumm/saveload.cpp | 2 +- engines/scumm/script.cpp | 2 +- engines/scumm/script_v5.cpp | 2 +- engines/scumm/scumm.cpp | 39 ++++++++++++++++++--------------------- engines/scumm/string.cpp | 2 +- engines/scumm/verbs.cpp | 2 +- 16 files changed, 56 insertions(+), 54 deletions(-) (limited to 'engines') diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 2574ab1bec..bee2d7688e 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -831,14 +831,14 @@ void Actor::showActor() { // an internal variable. Emulate this to prevent overwriting script vars... // Maniac NES (V1), however, DOES have a ScummVar for VAR_TALK_ACTOR int ScummEngine::getTalkingActor() { - if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES)) + if (_game.id == GID_MANIAC && _game.version <= 1 && !(_game.platform == Common::kPlatformNES)) return _V1TalkingActor; else return VAR(VAR_TALK_ACTOR); } void ScummEngine::setTalkingActor(int value) { - if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES)) + if (_game.id == GID_MANIAC && _game.version <= 1 && !(_game.platform == Common::kPlatformNES)) _V1TalkingActor = value; else VAR(VAR_TALK_ACTOR) = value; @@ -1549,7 +1549,7 @@ void Actor::setActorCostume(int c) { // V1 zak uses palette[] as a dynamic costume color array. - if (_vm->_game.version == 1) + if (_vm->_game.version <= 1) return; if (_vm->_game.features & GF_NEW_COSTUMES) { diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index 913b462574..ee0589275a 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -43,7 +43,7 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const _numStrips = numStrips; - if (_vm->_game.version == 1) { + if (_vm->_game.version <= 1) { _xmove = 0; _ymove = 0; } else if (_vm->_game.features & GF_OLD_BUNDLE) { diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index 2fccfd23a8..bb5f490f8c 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -110,7 +110,7 @@ byte ScummEngine::getMaskFromBox(int box) { if (_game.version == 8) return (byte) FROM_LE_32(ptr->v8.mask); - else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) + else if (_game.version == 0) return ptr->c64.mask; else if (_game.version <= 2) return ptr->v2.mask; @@ -144,7 +144,7 @@ byte ScummEngine::getBoxFlags(int box) { return 0; if (_game.version == 8) return (byte) FROM_LE_32(ptr->v8.flags); - else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) + else if (_game.version == 0) return 0; else if (_game.version <= 2) return ptr->v2.flags; @@ -406,7 +406,7 @@ Box *ScummEngine::getBoxBaseAddr(int box) { box--; checkRange(ptr[0] - 1, 0, box, "Illegal box %d"); - if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) + if (_game.version == 0) return (Box *)(ptr + box * SIZEOF_BOX_C64 + 1); else if (_game.version <= 2) return (Box *)(ptr + box * SIZEOF_BOX_V2 + 1); @@ -516,7 +516,7 @@ void ScummEngine::getBoxCoordinates(int boxnum, BoxCoords *box) { SWAP(box->ul, box->ur); SWAP(box->ll, box->lr); } - } else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) { + } else if (_game.version == 0) { box->ul.x = bp->c64.x1 * 8; box->ul.y = bp->c64.y1 * 2; box->ur.x = bp->c64.x2 * 8; @@ -745,7 +745,7 @@ int ScummEngine::getPathToDestBox(byte from, byte to) { boxm = getBoxMatrixBaseAddr(); - if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) { + if (_game.version == 0) { // Skip up to the matrix data for box 'from' for (i = 0; i < from; i++) { while (*boxm != 0xFF) diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 2371ce860c..7a7e36fcca 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -367,7 +367,7 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor)); - if (_game.version == 1) + if (_game.version <= 1) color = default_v1_cursor_colors[idx]; else color = default_cursor_colors[idx]; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 663edcdf30..a0ff7a8a37 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -222,7 +222,7 @@ void Gdi::init() { } void Gdi::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) { - if (_vm->_game.version == 1) { + if (_vm->_game.version <= 1) { if (_vm->_game.platform == Common::kPlatformNES) { decodeNESGfx(roomptr); } else { @@ -1404,7 +1404,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi _objectMode = (flag & dbObjectMode) == dbObjectMode; - if (_objectMode && _vm->_game.version == 1) { + if (_objectMode && _vm->_game.version <= 1) { if (_vm->_game.platform == Common::kPlatformNES) { decodeNESObject(ptr, x, y, width, height); } else { @@ -1484,7 +1484,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi else dstPtr = (byte *)vs->pixels + y * vs->pitch + (x + k) * 8; - if (_vm->_game.version == 1) { + if (_vm->_game.version <= 1) { if (_vm->_game.platform == Common::kPlatformNES) { mask_ptr = getMaskBuffer(x + k, y, 1); drawStripNES(dstPtr, mask_ptr, vs->pitch, stripnr, y, height); @@ -1535,7 +1535,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi if (_vm->_game.version == 8 || _vm->_game.heversion >= 60) transpStrip = true; - if (_vm->_game.version == 1) { + if (_vm->_game.version <= 1) { mask_ptr = getMaskBuffer(x + k, y, 1); if (_vm->_game.platform == Common::kPlatformNES) { drawStripNESMask(mask_ptr, stripnr, y, height); diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index a8cf836a21..5f4501ecac 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -338,7 +338,7 @@ int ScummEngine::findObject(int x, int y) { if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable)) continue; - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { + if (_game.version == 0) { if (_objs[i].flags == 0 && _objs[i].state & 0x2) continue; } else { @@ -642,7 +642,7 @@ void ScummEngine_v3old::resetRoomObjects() { for (i = 0; i < _numObjectsInRoom; i++) { od = &_objs[findLocalObjectSlot()]; - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && READ_LE_UINT16(ptr) == defaultPtr) + if (_game.version == 0 && READ_LE_UINT16(ptr) == defaultPtr) od->OBIMoffset = 0; else od->OBIMoffset = READ_LE_UINT16(ptr); @@ -994,7 +994,7 @@ const byte *ScummEngine::getObjOrActorName(int obj) { byte *objptr; int i; - if (obj < _numActors && !(_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC)) + if (obj < _numActors && _game.version >= 1) return derefActor(obj, "getObjOrActorName")->getActorName(); for (i = 0; i < _numNewNames; i++) { @@ -1011,7 +1011,7 @@ const byte *ScummEngine::getObjOrActorName(int obj) { if (_game.features & GF_SMALL_HEADER) { byte offset = 0; - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) + if (_game.version == 0) offset = *(objptr + 13); else if (_game.version <= 2) offset = *(objptr + 14); @@ -1098,7 +1098,7 @@ const byte *ScummEngine::getOBIMFromObjectData(const ObjectData &od) { const byte *ptr; // For objects without image in C64 version of Maniac Mansion - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && od.OBIMoffset == 0) + if (_game.version == 0 && od.OBIMoffset == 0) return NULL; if (od.fl_object_index) { diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 1ab065394c..fe6ea4702d 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -32,7 +32,7 @@ namespace Scumm { void ScummEngine::resetPalette() { - if (_game.version == 1) { + if (_game.version <= 1) { if (_game.platform == Common::kPlatformC64) { setC64Palette(); } else if (_game.platform == Common::kPlatformNES) { diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp index af27c7f36c..a4147f3732 100644 --- a/engines/scumm/plugin.cpp +++ b/engines/scumm/plugin.cpp @@ -1077,7 +1077,9 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com return false; } - if (file == "00.LFL") { + if (file == "maniac1.d64" || file == "zak1.d64") { + // TODO + } else if (file == "00.LFL" || file == "maniac1.d64" || file == "zak1.d64") { // Used in V1, V2, V3 games. if (g->version > 3) return false; diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp index f10ee8555a..e1a12aac86 100644 --- a/engines/scumm/resource_v2.cpp +++ b/engines/scumm/resource_v2.cpp @@ -191,7 +191,10 @@ void ScummEngine_v2::readIndexFile() { break; case 0x132: printf("C64 V1 game detected\n"); - assert(_game.version == 1); + if (_game.id == GID_MANIAC) + assert(_game.version == 0); + else + assert(_game.version == 1); readClassicIndexFile(); break; default: diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 5a657e216c..23189a82d0 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -197,7 +197,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { _egoPositioned = false; runEntryScript(); - if ((_game.version <= 2) && !(_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)) { + if (_game.version >= 1 && _game.version <= 2) { runScript(5, 0, 0, 0); } else if (_game.version >= 5 && _game.version <= 6) { if (a && !_egoPositioned) { @@ -582,7 +582,7 @@ void ScummEngine_v3old::setupRoomSubBlocks() { // rmhd = (const RoomHeader *)(roomptr + 4); - if (_game.version == 1) { + if (_game.version <= 1) { if (_game.platform == Common::kPlatformNES) { _roomWidth = READ_LE_UINT16(&(rmhd->old.width)) * 8; _roomHeight = READ_LE_UINT16(&(rmhd->old.height)) * 8; @@ -605,7 +605,7 @@ void ScummEngine_v3old::setupRoomSubBlocks() { // // Find the room image data // - if (_game.version == 1) { + if (_game.version <= 1) { _IM00_offs = 0; } else { _IM00_offs = READ_LE_UINT16(roomptr + 0x0A); @@ -708,7 +708,7 @@ void ScummEngine_v3old::resetRoomSubBlocks() { error("Room %d: data not found (" __FILE__ ":%d)", _roomResource, __LINE__); // Reset room color for V1 zak - if (_game.version == 1) + if (_game.version <= 1) _roomPalette[0] = 0; // @@ -725,7 +725,7 @@ void ScummEngine_v3old::resetRoomSubBlocks() { byte numOfBoxes = 0; int size; - if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) { + if (_game.version == 0) { // Count number of boxes while (*ptr != 0xFF) { numOfBoxes++; @@ -750,7 +750,7 @@ void ScummEngine_v3old::resetRoomSubBlocks() { } ptr += size; - if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) { + if (_game.version == 0) { const byte *tmp = ptr; size = 0; diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 98ef6a3694..6f548ff499 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -334,7 +334,7 @@ bool ScummEngine::loadState(int slot, bool compat) { // Reset the palette. resetPalette(); - if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version == 1) + if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version <= 1) resetV1ActorTalkColor(); // Load the static room data diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index f3915ea4e1..cc37099be9 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -156,7 +156,7 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) { objptr = getOBCDFromObject(obj); assert(objptr); - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) + if (_game.version == 0) verbptr = objptr + 14; else if (_game.version <= 2) verbptr = objptr + 15; diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 8c8b62f738..b8f94afc30 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -1110,7 +1110,7 @@ void ScummEngine_v5::o5_saveLoadGame() { byte slot = (a & 0x1F) + 1; byte result = 0; - if ((_game.id == GID_MANIAC) && (_game.version == 1)) { + if ((_game.id == GID_MANIAC) && (_game.version <= 1)) { // Convert older load/save screen // 1 Load // 2 Save diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 7704a0a2c1..8ed72f0a93 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -608,7 +608,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) } // Do some render mode restirctions - if (_game.version == 1) + if (_game.version <= 1) _renderMode = Common::kRenderDefault; switch (_renderMode) { @@ -1107,7 +1107,7 @@ void ScummEngine::setupCostumeRenderer() { if (_game.features & GF_NEW_COSTUMES) { _costumeRenderer = new AkosRenderer(this); _costumeLoader = new AkosCostumeLoader(this); - } else if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { + } else if (_game.version == 0) { _costumeRenderer = new C64CostumeRenderer(this); _costumeLoader = new C64CostumeLoader(this); } else if (_game.platform == Common::kPlatformNES) { @@ -1125,11 +1125,10 @@ void ScummEngine::resetScumm() { _tempMusic = 0; debug(9, "resetScumm"); - if ((_game.id == GID_MANIAC) && (_game.version == 1) && !(_game.platform == Common::kPlatformNES)) { - if (_game.platform == Common::kPlatformC64) - initScreens(8, 144); - else - initScreens(16, 152); + if (_game.version == 0) { + initScreens(8, 144); + } else if ((_game.id == GID_MANIAC) && (_game.version <= 1) && !(_game.platform == Common::kPlatformNES)) { + initScreens(16, 152); } else if (_game.version >= 7 || _game.heversion >= 71) { initScreens(0, _screenHeight); } else { @@ -1166,11 +1165,11 @@ void ScummEngine::resetScumm() { _actors[i].initActor(1); // this is from IDB - if ((_game.version == 1) || (_game.id == GID_MANIAC && (_game.features & GF_DEMO))) + if ((_game.version <= 1) || (_game.id == GID_MANIAC && (_game.features & GF_DEMO))) _actors[i].setActorCostume(i); } - if (_game.id == GID_MANIAC && _game.version == 1) { + if (_game.id == GID_MANIAC && _game.version <= 1) { resetV1ActorTalkColor(); } else if (_game.id == GID_MANIAC && _game.version == 2 && (_game.features & GF_DEMO)) { // HACK Some palette changes needed for demo script @@ -1818,9 +1817,16 @@ void ScummEngine::scummLoop_updateScummVars() { if (_game.version <= 7) VAR(VAR_HAVE_MSG) = _haveMsg; - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { - // TODO - } else if (_game.version <= 2) { + if (_game.version >= 3) { + VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x; + VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y; + VAR(VAR_MOUSE_X) = _mouse.x; + VAR(VAR_MOUSE_Y) = _mouse.y; + if (VAR_DEBUGMODE != 0xFF) { + // This is NOT for the Mac version of Indy3/Loom + VAR(VAR_DEBUGMODE) = _debugMode; + } + } else if (_game.version >= 1) { VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x / 8; VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y / 2; @@ -1830,15 +1836,6 @@ void ScummEngine::scummLoop_updateScummVars() { if (VAR(VAR_VIRT_MOUSE_X) < 0) VAR(VAR_VIRT_MOUSE_X) = 0; } - } else { - VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x; - VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y; - VAR(VAR_MOUSE_X) = _mouse.x; - VAR(VAR_MOUSE_Y) = _mouse.y; - if (VAR_DEBUGMODE != 0xFF) { - // This is NOT for the Mac version of Indy3/Loom - VAR(VAR_DEBUGMODE) = _debugMode; - } } } diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index ae795a0657..86d011f109 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -553,7 +553,7 @@ void ScummEngine::CHARSET_1() { _charset->_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2; } - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { + if (_game.version == 0) { break; } else if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) { _charset->_nextTop += _string[0].height; diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 669e2f26cb..6462526fe6 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -332,7 +332,7 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) { object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset); if (object > 0) { - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { + if (_game.version == 0) { if (_activeInventory != object) { _activeInventory = object; } else if (_activeVerb != 3 && _activeVerb != 13) { -- cgit v1.2.3