diff options
author | Travis Howell | 2006-03-05 08:22:39 +0000 |
---|---|---|
committer | Travis Howell | 2006-03-05 08:22:39 +0000 |
commit | 7a9ed5425be0187d403394199e71c82136b29108 (patch) | |
tree | 6a5334e5c9534a6fb6c3715d6bde6704fdf556c7 | |
parent | 68bdc98e0b16fb80537cc2f461a7a58a25e0ec28 (diff) | |
download | scummvm-rg350-7a9ed5425be0187d403394199e71c82136b29108.tar.gz scummvm-rg350-7a9ed5425be0187d403394199e71c82136b29108.tar.bz2 scummvm-rg350-7a9ed5425be0187d403394199e71c82136b29108.zip |
Add German verbs and more work on input in C64 maniac
svn-id: r21089
-rw-r--r-- | engines/scumm/intern.h | 4 | ||||
-rw-r--r-- | engines/scumm/script_c64.cpp | 22 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 1 | ||||
-rw-r--r-- | engines/scumm/vars.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/verbs.cpp | 109 |
6 files changed, 105 insertions, 39 deletions
diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h index 7d5cdab07a..1845287532 100644 --- a/engines/scumm/intern.h +++ b/engines/scumm/intern.h @@ -300,6 +300,8 @@ protected: void initV2MouseOver(); void initNESMouseOver(); + void runObject(int obj, int entry); + /* Version 2 script opcodes */ void o2_actorFromPos(); void o2_actorOps(); @@ -397,7 +399,6 @@ protected: const OpcodeEntryC64 *_opcodesC64; - int _activeVerb; int _currentMode; public: ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); @@ -478,6 +479,7 @@ protected: void o_notEqualZero(); void o_equalZero(); void o_jumpRelative(); + void o_setOwnerOf(); }; class ScummEngine_v6 : public ScummEngine { diff --git a/engines/scumm/script_c64.cpp b/engines/scumm/script_c64.cpp index db4c6e70b7..ccea16e48c 100644 --- a/engines/scumm/script_c64.cpp +++ b/engines/scumm/script_c64.cpp @@ -87,7 +87,7 @@ void ScummEngine_c64::setupOpcodes() { OPCODE(o2_getActorY), /* 28 */ OPCODE(o_equalZero), - OPCODE(o2_setOwnerOf), + OPCODE(o_setOwnerOf), OPCODE(o2_delay), OPCODE(o_setActorBitVar), /* 2C */ @@ -167,7 +167,7 @@ void ScummEngine_c64::setupOpcodes() { OPCODE(o5_getActorFacing), /* 68 */ OPCODE(o5_isScriptRunning), - OPCODE(o2_setOwnerOf), + OPCODE(o_setOwnerOf), OPCODE(o_stopCurrentScript), OPCODE(o_setActorBitVar), /* 6C */ @@ -247,7 +247,7 @@ void ScummEngine_c64::setupOpcodes() { OPCODE(o2_getActorY), /* A8 */ OPCODE(o_notEqualZero), - OPCODE(o2_setOwnerOf), + OPCODE(o_setOwnerOf), OPCODE(o_stopCurrentScript), OPCODE(o_setActorBitVar), /* AC */ @@ -327,7 +327,7 @@ void ScummEngine_c64::setupOpcodes() { OPCODE(o5_getActorFacing), /* E8 */ OPCODE(o5_isScriptRunning), - OPCODE(o2_setOwnerOf), + OPCODE(o_setOwnerOf), OPCODE(o_stopCurrentScript), OPCODE(o_setActorBitVar), /* EC */ @@ -984,10 +984,22 @@ void ScummEngine_c64::o_jumpRelative() { _scriptPointer += offset; } +void ScummEngine_c64::o_setOwnerOf() { + int obj, owner; + + obj = getVarOrDirectWord(PARAM_1); + owner = getVarOrDirectByte(PARAM_2); + + if (obj == 0) + obj = _activeInventory; + + setOwnerOf(obj, owner); +} + void ScummEngine_c64::resetSentence() { - _activeVerb = 0; _activeInventory = 0; _activeObject = 0; + _activeVerb = 13; } #undef PARAM_1 diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index bc7460c405..22c10291c4 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -572,6 +572,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _userState = 0; _activeInventory = 0; _activeObject = 0; + _activeVerb = 0; _resourceHeaderSize = 8; _saveLoadFlag = 0; _saveLoadSlot = 0; @@ -1005,7 +1006,6 @@ ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const Scum ScummEngine_c64::ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v2(detector, syst, gs, md5sum, subst) { - _activeVerb = 0; _currentMode = 0; } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index ccbf679a76..bee33b8aaa 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -883,6 +883,7 @@ protected: int _activeInventory; int _activeObject; + int _activeVerb; virtual void handleMouseOver(bool updateInventory); virtual void redrawVerbs(); diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index c1a7bff5de..7514d737bc 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -109,12 +109,14 @@ void ScummEngine::setupScummVars() { } void ScummEngine_c64::setupScummVars() { - // TODO VAR_EGO = 0; VAR_CAMERA_POS_X = 2; VAR_HAVE_MSG = 3; VAR_ROOM = 4; + //VAR_ACTIVE_ACTOR = 5; VAR_OVERRIDE = 6; + //VAR_IS_SOUND_RUNNING = 8; + //VAR_ACTIVE_VERB = 9; VAR_CHARCOUNT = 10; // FIXME: Should be removed @@ -544,6 +546,8 @@ void ScummEngine_v8::setupScummVars() { #endif void ScummEngine_c64::initScummVars() { + _activeInventory = 0; + _activeObject = 0; _activeVerb = 13; VAR(VAR_EGO) = 3; diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index cdd47364e1..0768f55fcc 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -46,8 +46,7 @@ struct VerbSettings { const char *name; }; -static const VerbSettings C64VerbTable[] = -{ +static const VerbSettings C64VerbTable_English[] = { { 1, 8, 0, 0, "Open"}, { 2, 8, 1, 0, "Close"}, { 3, 0, 2, 4, "Give"}, @@ -65,6 +64,24 @@ static const VerbSettings C64VerbTable[] = {15, 15, 2, 0, "What Is"} }; +static const VerbSettings C64VerbTable_German[] = { + { 1, 6, 0, 0, "Zieh"}, + { 2, 6, 1, 0, "Druck"}, + { 3, 0, 2, 4, "Lies"}, + { 4, 29, 0, 0, "Schliess au"}, + { 5, 29, 1, 0, "Schalt ein"}, + { 6, 29, 2, 2, "Schalt aus"}, + { 7, 20, 0, 0, "Person"}, + { 8, 20, 1, 2, "Schliess"}, + { 9, 0, 0, 0, "Nimm"}, + {10, 0, 1, 0, "Gib"}, + {11, 20, 2, 255, "Reparier"}, + {12, 6, 2, 0, "Offne"}, + {13, 12, 0, 0, "Gehe zu"}, + {14, 12, 1, 0, "Was ist"}, + {15, 12, 2, 0, "Benutz"} +}; + void ScummEngine_c64::initC64Verbs() { VirtScreen *virt = &virtscr[kVerbVirtScreen]; VerbSlot *vs; @@ -72,7 +89,7 @@ void ScummEngine_c64::initC64Verbs() { for (i = 1; i < 16; i++) { vs = &_verbs[i]; - vs->verbid = C64VerbTable[i - 1].id; + vs->verbid = C64VerbTable_English[i - 1].id; vs->color = 5; vs->hicolor = 7; vs->dimcolor = 11; @@ -83,12 +100,17 @@ void ScummEngine_c64::initC64Verbs() { vs->key = 0; vs->center = 0; vs->imgindex = 0; - vs->prep = C64VerbTable[i - 1].prep; - - vs->curRect.left = C64VerbTable[i - 1].x_pos * 8; - vs->curRect.top = C64VerbTable[i - 1].y_pos * 8 + virt->topline + 8; + vs->prep = C64VerbTable_English[i - 1].prep; - loadPtrToResource(rtVerb, i, (const byte*)C64VerbTable[i - 1].name); + if (_language == Common::DE_DEU) { + vs->curRect.left = C64VerbTable_German[i - 1].x_pos * 8; + vs->curRect.top = C64VerbTable_German[i - 1].y_pos * 8 + virt->topline + 8; + loadPtrToResource(rtVerb, i, (const byte*)C64VerbTable_German[i - 1].name); + } else { + vs->curRect.left = C64VerbTable_English[i - 1].x_pos * 8; + vs->curRect.top = C64VerbTable_English[i - 1].y_pos * 8 + virt->topline + 8; + loadPtrToResource(rtVerb, i, (const byte*)C64VerbTable_English[i - 1].name); + } } } @@ -308,10 +330,19 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) { object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset); - if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { - _activeInventory = object; - } else if (object > 0) { - runInputScript(3, object, 0); + if (object > 0) { + if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { + if (_activeInventory != object) { + _activeInventory = object; + } else if (_activeVerb != 3 && _activeVerb != 13) { + if (_activeObject) + runObject(_activeObject, _activeVerb); + else + runObject(_activeInventory, _activeVerb); + } + } else { + runInputScript(3, object, 0); + } } } @@ -503,6 +534,19 @@ void ScummEngine::checkExecVerbs() { } } +void ScummEngine_v2::runObject(int obj, int entry) { + if (getVerbEntrypoint(obj, entry) != 0) { + runObjectScript(obj, entry, false, false, NULL); + } else { + VAR(9) = entry; + runScript(3, 0, 0, 0); + } + + _activeInventory = 0; + _activeObject = 0; + _activeVerb = 13; +} + void ScummEngine_c64::checkExecVerbs() { Actor *a; VirtScreen *zone = findVirtScreen(_mouse.y); @@ -526,32 +570,35 @@ void ScummEngine_c64::checkExecVerbs() { return; } - int object = findObject(_virtualMouse.x, _virtualMouse.y); - if (object) { - _activeObject = object; + int act = getActorFromPos(_virtualMouse.x, _virtualMouse.y); + int obj = findObject(_virtualMouse.x, _virtualMouse.y); + if (act != 0 && _activeVerb == 3 && _activeInventory != 0) { + VAR(5) = act; + runObject(_activeInventory, _activeVerb); + } else if (obj) { + if (_currentMode == 3 && _activeVerb != 13 && obj != _activeObject) { + _activeObject = obj; + return; + } + + _activeObject = obj; if (_currentMode == 3) { int x, y, dir; a = derefActor(VAR(VAR_EGO), "checkExecVerbs"); - getObjectXYPos(object, x, y, dir); + getObjectXYPos(obj, x, y, dir); a->startWalkActor(x, y, dir); } - int tmp = (_currentMode == 3) ? _activeVerb : 15; - if (getVerbEntrypoint(object, tmp) != 0) { - runObjectScript(object, tmp, false, false, NULL); - } else if (_activeVerb != 13 && _activeVerb != 15) { - VAR(9) = _activeVerb; - runScript(3, 0, 0, 0); - } - } else { - _activeInventory = 0; - _activeObject = 0; - _activeVerb = 13; - if (zone->number == kMainVirtScreen) { - a = derefActor(VAR(VAR_EGO), "checkExecVerbs"); - a->startWalkActor(_virtualMouse.x, _virtualMouse.y, -1); - } + int entry = (_currentMode == 3) ? _activeVerb : 15; + runObject(_activeObject, entry); + } else if (zone->number == kMainVirtScreen) { + a = derefActor(VAR(VAR_EGO), "checkExecVerbs"); + a->startWalkActor(_virtualMouse.x, _virtualMouse.y, -1); } + + _activeInventory = 0; + _activeObject = 0; + _activeVerb = 13; } } } |