aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2005-09-14 08:20:37 +0000
committerTravis Howell2005-09-14 08:20:37 +0000
commitadeb1a6c11350ff07ebf8987001e3145959f5877 (patch)
tree476af18444425935e9a21391d4f17bee950550c7 /scumm
parentb02a983c85cc3d92a70298762f695d30f22bbf0f (diff)
downloadscummvm-rg350-adeb1a6c11350ff07ebf8987001e3145959f5877.tar.gz
scummvm-rg350-adeb1a6c11350ff07ebf8987001e3145959f5877.tar.bz2
scummvm-rg350-adeb1a6c11350ff07ebf8987001e3145959f5877.zip
Selection screen partly working in C64 maniac.
svn-id: r18818
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h9
-rw-r--r--scumm/room.cpp1
-rw-r--r--scumm/script_c64.cpp66
-rw-r--r--scumm/scumm.cpp1
-rw-r--r--scumm/scumm.h2
-rw-r--r--scumm/verbs.cpp14
6 files changed, 86 insertions, 7 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index eff620d4f1..36e40c7562 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -408,7 +408,16 @@ protected:
virtual int getVarOrDirectWord(byte mask);
virtual uint fetchScriptWord();
+ virtual void ifStateCommon(byte type);
+ virtual void ifNotStateCommon(byte type);
+ virtual void setStateCommon(byte type);
+ virtual void clearStateCommon(byte type);
+
+ int getObjectFlag();
+
/* Version C64 script opcodes */
+ void o_setState08();
+ void o_clearState08();
void o_stopCurrentScript();
void o_loadSound();
void o_animateActor();
diff --git a/scumm/room.cpp b/scumm/room.cpp
index f5baf849f3..faa4e502ee 100644
--- a/scumm/room.cpp
+++ b/scumm/room.cpp
@@ -107,6 +107,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
res.increaseResourceCounter();
+ _activeObject = 0;
_currentRoom = room;
VAR(VAR_ROOM) = room;
diff --git a/scumm/script_c64.cpp b/scumm/script_c64.cpp
index 02aa72bc7f..ed448be35c 100644
--- a/scumm/script_c64.cpp
+++ b/scumm/script_c64.cpp
@@ -61,10 +61,10 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o2_panCameraTo),
OPCODE(o_unknown13),
/* 14 */
- OPCODE(o5_print),
+ OPCODE(o_print_c64),
OPCODE(o2_actorFromPos),
OPCODE(o5_getRandomNr),
- OPCODE(o2_clearState08),
+ OPCODE(o_clearState08),
/* 18 */
OPCODE(o_jumpRelative),
OPCODE(o_stopCurrentScript),
@@ -144,7 +144,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o5_setObjectName),
OPCODE(o2_actorFromPos),
OPCODE(o5_getActorMoving),
- OPCODE(o2_clearState08),
+ OPCODE(o_clearState08),
/* 58 */
OPCODE(o_beginOverride),
OPCODE(o_stopCurrentScript),
@@ -182,7 +182,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o5_getObjectOwner),
/* 74 */
OPCODE(o5_getDist),
- OPCODE(o5_printEgo),
+ OPCODE(o_printEgo_c64),
OPCODE(o2_walkActorToObject),
OPCODE(o2_clearState04),
/* 78 */
@@ -224,7 +224,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o5_print),
OPCODE(o2_actorFromPos),
OPCODE(o_stopCurrentScript),
- OPCODE(o2_setState08),
+ OPCODE(o_setState08),
/* 98 */
OPCODE(o2_restart),
OPCODE(o_stopCurrentScript),
@@ -304,7 +304,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o5_setObjectName),
OPCODE(o2_actorFromPos),
OPCODE(o5_getActorMoving),
- OPCODE(o2_setState08),
+ OPCODE(o_setState08),
/* D8 */
OPCODE(o_stopCurrentScript),
OPCODE(o_stopCurrentScript),
@@ -383,6 +383,58 @@ const char *ScummEngine_c64::getOpcodeDesc(byte i) {
return _opcodesC64[i].desc;
}
+int ScummEngine_c64::getObjectFlag() {
+ if (_opcode & 0x40)
+ return _activeObject;
+ return fetchScriptByte();
+}
+
+void ScummEngine_c64::setStateCommon(byte type) {
+ int obj = getObjectFlag();
+ putState(obj, getState(obj) | type);
+}
+
+void ScummEngine_c64::clearStateCommon(byte type) {
+ int obj = getObjectFlag();
+ putState(obj, getState(obj) & ~type);
+}
+
+void ScummEngine_c64::ifStateCommon(byte type) {
+ int obj = getObjectFlag();
+
+ if ((getState(obj) & type) == 0) {
+ o_jumpRelative();
+ } else {
+ fetchScriptByte();
+ fetchScriptByte();
+ }
+}
+
+void ScummEngine_c64::ifNotStateCommon(byte type) {
+ int obj = getObjectFlag();
+
+ if ((getState(obj) & type) != 0) {
+ o_jumpRelative();
+ } else {
+ fetchScriptByte();
+ fetchScriptByte();
+ }
+}
+
+void ScummEngine_c64::o_setState08() {
+ int obj = getObjectFlag();
+ putState(obj, getState(obj) | 0x08);
+ markObjectRectAsDirty(obj);
+ clearDrawObjectQueue();
+}
+
+void ScummEngine_c64::o_clearState08() {
+ int obj = getObjectFlag();
+ putState(obj, getState(obj) & ~0x08);
+ markObjectRectAsDirty(obj);
+ clearDrawObjectQueue();
+}
+
void ScummEngine_c64::o_stopCurrentScript() {
int script;
@@ -535,7 +587,7 @@ void ScummEngine_c64::o_getActorBitVar() {
}
void ScummEngine_c64::o_print_c64() {
- _actorToPrintStrFor = getVarOrDirectByte(PARAM_1);
+ _actorToPrintStrFor = fetchScriptByte();
decodeParseString();
warning("STUB: o_print_c64()");
}
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 0989e63827..5243881736 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -985,6 +985,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_numObjectsInRoom = 0;
_userPut = 0;
_userState = 0;
+ _activeObject = 0;
_resourceHeaderSize = 8;
_saveLoadFlag = 0;
_saveLoadSlot = 0;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 389ca67f01..99072f8910 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -810,6 +810,8 @@ protected:
int8 _userPut;
uint16 _userState;
+ int _activeObject;
+
virtual void handleMouseOver(bool updateInventory);
void redrawVerbs();
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index a940ac489b..520fc9d371 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -385,6 +385,20 @@ void ScummEngine::checkExecVerbs() {
if (VAR_MOUSE_STATE != 0xFF)
VAR(VAR_MOUSE_STATE) = _mouseAndKeyboardStat;
+ if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) {
+ // TODO
+
+ int object = findObject(_mouse.x, _mouse.y);
+ if (object) {
+ _activeObject = object;
+ runObjectScript(object, 15, false, false, NULL);
+ } else {
+
+ }
+
+ return;
+ }
+
if (_mouseAndKeyboardStat < MBS_MAX_KEY) {
/* Check keypresses */
vs = &_verbs[1];