Add some differences in C64 maniac.

svn-id: r18166
This commit is contained in:
Travis Howell 2005-05-18 15:30:31 +00:00
parent 4aac7819d1
commit b6da09d4fe
4 changed files with 137 additions and 15 deletions

View File

@ -397,7 +397,21 @@ protected:
virtual void executeOpcode(byte i);
virtual const char *getOpcodeDesc(byte i);
virtual void ifStateCommon(byte type);
virtual void ifNotStateCommon(byte type);
virtual void setStateCommon(byte type);
virtual void clearStateCommon(byte type);
/* Version 2 script opcodes */
void o_loadSound();
void o_move();
void o_isEqual();
void o_loadScript();
void o_unknown53();
void o_cursorCommand();
void o_lights();
void o_subtract();
};
class ScummEngine_v6 : public ScummEngine {

View File

@ -704,7 +704,11 @@ void ScummEngine_v4::setupRoomObject(ObjectData *od, const byte *room, const byt
if (_features & GF_OLD_BUNDLE)
ptr -= 2;
od->obj_nr = READ_LE_UINT16(ptr + 6);
if (_gameId == GID_MANIAC && _platform == Common::kPlatformC64) {
od->obj_nr = *(ptr + 7);
} else {
od->obj_nr = READ_LE_UINT16(ptr + 6);
}
od->x_pos = *(ptr + 9) * 8;
od->y_pos = ((*(ptr + 10)) & 0x7F) * 8;

View File

@ -183,9 +183,11 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
_egoPositioned = false;
runEntryScript();
if (_version <= 2)
if (_gameId == GID_MANIAC && _platform == Common::kPlatformC64) {
runScript(18, 0, 0, 0);
} else if (_version <= 2) {
runScript(5, 0, 0, 0);
else if (_version >= 5 && _version <= 6) {
} else if (_version >= 5 && _version <= 6) {
if (a && !_egoPositioned) {
int x, y;
getObjectXYPos(objectNr, x, y);

View File

@ -51,12 +51,12 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_assignVarWordIndirect),
OPCODE(o2_setObjPreposition),
/* 0C */
OPCODE(o2_resourceRoutines),
OPCODE(o_loadSound),
OPCODE(o5_walkActorToActor),
OPCODE(o2_putActorAtObject),
OPCODE(o2_ifNotState08),
/* 10 */
OPCODE(o5_getObjectOwner),
OPCODE(o5_breakHere),
OPCODE(o2_animateActor),
OPCODE(o2_panCameraTo),
OPCODE(o2_actorOps),
@ -68,7 +68,7 @@ void ScummEngine_c64::setupOpcodes() {
/* 18 */
OPCODE(o5_jumpRelative),
OPCODE(o2_doSentence),
OPCODE(o5_move),
OPCODE(o_move),
OPCODE(o2_setBitVar),
/* 1C */
OPCODE(o5_startSound),
@ -82,13 +82,13 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_getActorY),
/* 24 */
OPCODE(o2_loadRoomWithEgo),
OPCODE(o2_drawObject),
OPCODE(o5_loadRoom),
OPCODE(o5_setVarRange),
OPCODE(o2_setState04),
/* 28 */
OPCODE(o5_equalZero),
OPCODE(o2_setOwnerOf),
OPCODE(o2_addIndirect),
OPCODE(o2_delay),
OPCODE(o5_delayVariable),
/* 2C */
OPCODE(o2_assignVarByte),
@ -126,12 +126,12 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o5_increment),
OPCODE(o2_clearState08),
/* 48 */
OPCODE(o5_isEqual),
OPCODE(o_isEqual),
OPCODE(o5_faceActor),
OPCODE(o2_chainScript),
OPCODE(o2_setObjPreposition),
/* 4C */
OPCODE(o2_waitForSentence),
OPCODE(o_loadScript),
OPCODE(o5_walkActorToActor),
OPCODE(o2_putActorAtObject),
OPCODE(o2_ifState08),
@ -139,7 +139,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_pickupObject),
OPCODE(o2_animateActor),
OPCODE(o5_actorFollowCamera),
OPCODE(o2_actorOps),
OPCODE(o_unknown53),
/* 54 */
OPCODE(o5_setObjectName),
OPCODE(o2_actorFromPos),
@ -156,7 +156,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_walkActorTo),
OPCODE(o2_ifNotState02),
/* 60 */
OPCODE(o2_cursorCommand),
OPCODE(o_cursorCommand),
OPCODE(o2_putActor),
OPCODE(o2_stopScript),
OPCODE(o5_getActorFacing),
@ -174,9 +174,9 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_getObjPreposition),
OPCODE(o5_putActorInRoom),
OPCODE(o2_dummy),
OPCODE(o2_ifState04),
OPCODE(o2_ifState08),
/* 70 */
OPCODE(o2_lights),
OPCODE(o_lights),
OPCODE(o5_getActorCostume),
OPCODE(o5_loadRoom),
OPCODE(o2_roomOps),
@ -334,7 +334,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_getObjPreposition),
OPCODE(o5_putActorInRoom),
OPCODE(o2_dummy),
OPCODE(o2_ifState04),
OPCODE(o2_ifNotState08),
/* F0 */
OPCODE(o2_lights),
OPCODE(o5_getActorCostume),
@ -375,6 +375,108 @@ const char *ScummEngine_c64::getOpcodeDesc(byte i) {
return _opcodesC64[i].desc;
}
void ScummEngine_c64::setStateCommon(byte type) {
int obj = fetchScriptByte();
putState(obj, getState(obj) | type);
}
void ScummEngine_c64::clearStateCommon(byte type) {
int obj = fetchScriptByte();
putState(obj, getState(obj) & ~type);
}
void ScummEngine_c64::ifStateCommon(byte type) {
int obj = fetchScriptByte();
if ((getState(obj) & type) == 0)
o5_jumpRelative();
else
ignoreScriptWord();
}
void ScummEngine_c64::ifNotStateCommon(byte type) {
int obj = fetchScriptByte();
if ((getState(obj) & type) != 0)
o5_jumpRelative();
else
ignoreScriptWord();
}
void ScummEngine_c64::o_loadSound() {
int resid = fetchScriptByte();
ensureResourceLoaded(rtSound, resid);
}
void ScummEngine_c64::o_move() {
getResultPos();
setResult(getVarOrDirectByte(PARAM_1));
}
void ScummEngine_c64::o_isEqual() {
int16 a, b;
int var;
var = fetchScriptByte();
a = readVar(var);
b = getVarOrDirectByte(PARAM_1);
if (b == a)
ignoreScriptWord();
else
o5_jumpRelative();
}
void ScummEngine_c64::o_loadScript() {
int resid = fetchScriptByte();
ensureResourceLoaded(rtScript, resid);
}
void ScummEngine_c64::o_unknown53() {
debug(0, "o_unknown53 (%d)", fetchScriptByte());
}
void ScummEngine_c64::o_cursorCommand() {
// TODO
byte state = fetchScriptByte();
debug(0, "o_cursorCommand (%d)", state);
if (state == 1) {
_userPut = 1;
_cursor.state = 1;
} else {
_userPut = 0;
_cursor.state = 0;
}
}
void ScummEngine_c64::o_lights() {
int a;
a = getVarOrDirectByte(PARAM_1);
// Convert older light mode values into
// equivalent values.of later games
// 0 Darkness
// 1 Flashlight
// 2 Lighted area
if (a == 2)
VAR(VAR_CURRENT_LIGHTS) = 11;
else if (a == 1)
VAR(VAR_CURRENT_LIGHTS) = 4;
else
VAR(VAR_CURRENT_LIGHTS) = 0;
_fullRedraw = 1;
}
void ScummEngine_c64::o_subtract() {
int a;
getResultPos();
a = getVarOrDirectByte(PARAM_1);
_scummVars[_resultVarNumber] -= a;
}
#undef PARAM_1
#undef PARAM_2
#undef PARAM_3