aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2005-10-02 13:21:49 +0000
committerTravis Howell2005-10-02 13:21:49 +0000
commit4d9a2cb884fa4ba6fdba26a09b352e176c879021 (patch)
treed22f9eb96db170657309f24f24753f1dececb3c6 /scumm
parent61cd3947aa9bb04ed7bbce168afa5b06c7e00690 (diff)
downloadscummvm-rg350-4d9a2cb884fa4ba6fdba26a09b352e176c879021.tar.gz
scummvm-rg350-4d9a2cb884fa4ba6fdba26a09b352e176c879021.tar.bz2
scummvm-rg350-4d9a2cb884fa4ba6fdba26a09b352e176c879021.zip
Basic verb display for C64 maniac.
svn-id: r18924
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h7
-rw-r--r--scumm/script_c64.cpp90
-rw-r--r--scumm/scumm.cpp8
-rw-r--r--scumm/verbs.cpp92
4 files changed, 158 insertions, 39 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 158035d1cc..58e2700e8d 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -395,9 +395,13 @@ protected:
const OpcodeEntryC64 *_opcodesC64;
+ int _currentAction;
+ int _currentMode;
public:
ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex);
+ virtual void scummInit();
+
protected:
virtual void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
@@ -408,7 +412,7 @@ protected:
virtual void setupScummVars();
virtual void decodeParseString();
- virtual void redrawVerbs();
+ void initC64Verbs();
virtual void checkExecVerbs();
virtual int getVarOrDirectWord(byte mask);
@@ -433,6 +437,7 @@ protected:
void o_lockActor();
void o_loadActor();
void o_loadRoom();
+ void o_loadRoomWithEgo();
void o_lockScript();
void o_loadScript();
void o_lockRoom();
diff --git a/scumm/script_c64.cpp b/scumm/script_c64.cpp
index f990df981f..ce2b7da045 100644
--- a/scumm/script_c64.cpp
+++ b/scumm/script_c64.cpp
@@ -322,7 +322,7 @@ void ScummEngine_c64::setupOpcodes() {
OPCODE(o_stopCurrentScript),
/* E4 */
OPCODE(o_unknown3),
- OPCODE(o2_loadRoomWithEgo),
+ OPCODE(o_loadRoomWithEgo),
OPCODE(o_stopCurrentScript),
OPCODE(o5_getActorFacing),
/* E8 */
@@ -533,6 +533,37 @@ void ScummEngine_c64::o_loadRoom() {
ensureResourceLoaded(rtRoom, resid);
}
+void ScummEngine_c64::o_loadRoomWithEgo() {
+ Actor *a;
+ int obj, room, x, y, dir;
+
+ obj = fetchScriptByte();
+ room = fetchScriptByte();
+
+ a = derefActor(VAR(VAR_EGO), "o_loadRoomWithEgo");
+
+ a->putActor(0, 0, room);
+ _egoPositioned = false;
+
+ startScene(a->_room, a, obj);
+
+ getObjectXYPos(obj, x, y, dir);
+ a->putActor(x, y, _currentRoom);
+ a->setDirection(dir + 180);
+
+ camera._dest.x = camera._cur.x = a->_pos.x;
+ setCameraAt(a->_pos.x, a->_pos.y);
+ setCameraFollows(a);
+
+ _fullRedraw = true;
+
+ resetSentence();
+
+ if (x >= 0 && y >= 0) {
+ a->startWalkActor(x, y, -1);
+ }
+}
+
void ScummEngine_c64::o_lockRoom() {
int resid = fetchScriptByte();
res.lock(rtRoom, resid);
@@ -547,17 +578,25 @@ void ScummEngine_c64::o_unlockRoom() {
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;
+ int state = 0;
+
+ _currentMode = fetchScriptByte();
+ switch (_currentMode) {
+ case 0:
+ state = 15;
+ break;
+ case 1:
+ state = 31;
+ break;
+ case 2:
+ break;
+ case 3:
+ state = 247;
+ break;
}
+
+ setUserState(state);
+ debug(0, "o_cursorCommand(%d)", _currentMode);
}
void ScummEngine_c64::o_lights() {
@@ -624,32 +663,27 @@ void ScummEngine_c64::o_nop() {
}
void ScummEngine_c64::o_setActorBitVar() {
- byte var = fetchScriptByte();
- byte a = getVarOrDirectByte(PARAM_1);
+ byte flag = getVarOrDirectByte(PARAM_1);
+ byte mask = getVarOrDirectByte(PARAM_2);
+ byte mod = getVarOrDirectByte(PARAM_3);
- int bit_var = var + a;
- int bit_offset = bit_var & 0x0f;
- bit_var >>= 4;
-
- //if (getVarOrDirectByte(PARAM_2))
- // _scummVars[bit_var] |= (1 << bit_offset);
+ //if (mod)
+ // _miscFlags[flag] |= mask;
//else
- // _scummVars[bit_var] &= ~(1 << bit_offset);
- warning("STUB: o_setActorBitVar(%d, %d, %d)", a, bit_var, bit_offset);
+ // _miscFlags[flag] &= ~mash;
+
+ warning("STUB: o_setActorBitVar(%d, %d, %d)", flag, mask, mod);
}
void ScummEngine_c64::o_getActorBitVar() {
getResultPos();
- byte var = fetchScriptByte();
- byte a = getVarOrDirectByte(PARAM_1);
+ byte flag = getVarOrDirectByte(PARAM_1);
+ byte mask = getVarOrDirectByte(PARAM_2);
- int bit_var = var + a;
- int bit_offset = bit_var & 0x0f;
- bit_var >>= 4;
+ //setResult((_miscFlags[flag] & mask) ? 1 : 0);
- //setResult((_scummVars[bit_var] & (1 << bit_offset)) ? 1 : 0);
setResult(0);
- warning("STUB: o_getActorBitVar(%d, %d, %d)", a, bit_var, bit_offset);
+ warning("STUB: o_getActorBitVar(%d, %d)", flag, mask);
}
void ScummEngine_c64::o_print_c64() {
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index b8136dbd8e..00c2ba6eb6 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -1426,6 +1426,9 @@ ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const Scum
ScummEngine_c64::ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex)
: ScummEngine_v2(detector, syst, gs, md5sum, substResFileNameIndex) {
+
+ _currentAction = 0;
+ _currentMode = 0;
}
ScummEngine_v6::ScummEngine_v6(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex)
@@ -1924,6 +1927,11 @@ void ScummEngine::scummInit() {
_lastSaveTime = _system->getMillis();
}
+void ScummEngine_c64::scummInit() {
+ ScummEngine::scummInit();
+ initC64Verbs();
+}
+
void ScummEngine_v2::scummInit() {
ScummEngine::scummInit();
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index e747647da2..d3c17657c6 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -37,6 +37,58 @@ enum {
kSentenceLine = 6
};
+struct VerbSettings {
+ int id;
+ int x_pos;
+ int y_pos;
+ const char *name;
+};
+
+static const VerbSettings C64VerbTable[] =
+{
+ { 1, 8, 0, "Open"},
+ { 2, 8, 1, "Close"},
+ { 3, 0, 2, "Give"},
+ { 4, 32, 0, "Turn On"},
+ { 5, 32, 1, "Turn Off"},
+ { 6, 32, 2, "Fix"},
+ { 7, 24, 0, "New Kid"},
+ { 8, 24, 1, "Unlock"},
+ { 9, 0, 0, "Push"},
+ {10, 0, 1, "Pull"},
+ {11, 24, 2, "Use"},
+ {12, 8, 2, "Read"},
+ {13, 15, 0, "Walk To"},
+ {14, 15, 1, "Pick Up"},
+ {15, 15, 2, "What Is"}
+};
+
+void ScummEngine_c64::initC64Verbs() {
+ VirtScreen *virt = &virtscr[kVerbVirtScreen];
+ VerbSlot *vs;
+ int i;
+
+ for (i = 1; i < 16; i++) {
+ vs = &_verbs[i];
+ vs->verbid = C64VerbTable[i - 1].id;
+ vs->color = 5;
+ vs->hicolor = 7;
+ vs->dimcolor = 11;
+ vs->type = kTextVerbType;
+ vs->charset_nr = _string[0]._default.charset;
+ vs->curmode = 1;
+ vs->saveid = 0;
+ vs->key = 0;
+ vs->center = 0;
+ vs->imgindex = 0;
+
+ vs->curRect.left = C64VerbTable[i - 1].x_pos * 8;
+ vs->curRect.top = C64VerbTable[i - 1].y_pos * 8 + virt->topline + 8;
+
+ loadPtrToResource(rtVerb, i, (const byte*)C64VerbTable[i - 1].name);
+ }
+}
+
void ScummEngine_v2::initV2MouseOver() {
int i;
int arrow_color, color, hi_color;
@@ -351,10 +403,6 @@ void ScummEngine::redrawVerbs() {
_verbMouseOver = verb;
}
-void ScummEngine_c64::redrawVerbs() {
- // TODO
-}
-
void ScummEngine::handleMouseOver(bool updateInventory) {
if (_completeScreenRedraw) {
verbMouseOver(0);
@@ -445,21 +493,45 @@ void ScummEngine::checkExecVerbs() {
}
void ScummEngine_c64::checkExecVerbs() {
+ Actor *a;
+ VirtScreen *zone = findVirtScreen(_mouse.y);
+
if (_userPut <= 0 || _mouseAndKeyboardStat == 0)
return;
- if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) {
+ if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
// TODO
+ } else if (_version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
+ // Click into V2 inventory
+ checkV2Inventory(_mouse.x, _mouse.y);
+ } else {
+ int over = findVerbAtPos(_mouse.x, _mouse.y);
+ if (over) {
+ _currentAction = _verbs[over].verbid;
+ return;
+ }
+
+ // HACK: Reset value
+ VAR(VAR_EGO) = 3;
int object = findObject(_mouse.x, _mouse.y);
if (object) {
_activeObject = object;
- runObjectScript(object, 15, false, false, NULL);
+ if (_currentMode == 3) {
+ int x, y, dir;
+ a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
+ getObjectXYPos(object, x, y, dir);
+ a->startWalkActor(x, y, dir);
+ }
+
+ int tmp = (_currentMode == 3) ? _currentAction : 15;
+ runObjectScript(object, tmp, false, false, NULL);
} else {
- Actor *a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
- int y = _mouse.y;
- int x = _mouse.x;
- a->startWalkActor(x, y, -1);
+ _activeObject = 0;
+ if (zone->number == kMainVirtScreen) {
+ a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
+ a->startWalkActor(_mouse.x, _mouse.y, -1);
+ }
}
}
}