aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-05-18 15:30:31 +0000
committerTravis Howell2005-05-18 15:30:31 +0000
commitb6da09d4fe2ef34628247df06a37c6b82e2dc356 (patch)
tree31c88210a75f54c4c6c86e87f44d07754c01af1b
parent4aac7819d19251b99493570df72646d90ac19abf (diff)
downloadscummvm-rg350-b6da09d4fe2ef34628247df06a37c6b82e2dc356.tar.gz
scummvm-rg350-b6da09d4fe2ef34628247df06a37c6b82e2dc356.tar.bz2
scummvm-rg350-b6da09d4fe2ef34628247df06a37c6b82e2dc356.zip
Add some differences in C64 maniac.
svn-id: r18166
-rw-r--r--scumm/intern.h14
-rw-r--r--scumm/object.cpp6
-rw-r--r--scumm/room.cpp6
-rw-r--r--scumm/script_c64.cpp126
4 files changed, 137 insertions, 15 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 04cd4c59ea..af19d825d2 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -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 {
diff --git a/scumm/object.cpp b/scumm/object.cpp
index c3dc557bb8..be6c6ed5e3 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -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;
diff --git a/scumm/room.cpp b/scumm/room.cpp
index 429d6fa7b9..6b8675b8b5 100644
--- a/scumm/room.cpp
+++ b/scumm/room.cpp
@@ -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);
diff --git a/scumm/script_c64.cpp b/scumm/script_c64.cpp
index 24dcf54431..9a0570b97d 100644
--- a/scumm/script_c64.cpp
+++ b/scumm/script_c64.cpp
@@ -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