Fix Commodore 64 versions

svn-id: r22732
This commit is contained in:
Travis Howell 2006-05-29 12:45:11 +00:00
parent 5fa3985bcb
commit a0d14a0832
16 changed files with 56 additions and 54 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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)

View File

@ -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];

View File

@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -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;

View File

@ -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) {