diff options
author | Max Horn | 2003-05-21 14:00:19 +0000 |
---|---|---|
committer | Max Horn | 2003-05-21 14:00:19 +0000 |
commit | e21604663fa71426bef8fad528626a4ef17d131a (patch) | |
tree | d6e434e74b556ec677740b74292c84dba947f422 /scumm | |
parent | 1294eb35c773c195633474dc2fbb8812f4b949a6 (diff) | |
download | scummvm-rg350-e21604663fa71426bef8fad528626a4ef17d131a.tar.gz scummvm-rg350-e21604663fa71426bef8fad528626a4ef17d131a.tar.bz2 scummvm-rg350-e21604663fa71426bef8fad528626a4ef17d131a.zip |
added v2 cutscene support (not quite complete; and crashes at some point in maniac because VAR_EGO contains a bogus value); cleanup
svn-id: r7781
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/gfx.cpp | 2 | ||||
-rw-r--r-- | scumm/intern.h | 3 | ||||
-rw-r--r-- | scumm/script.cpp | 1 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 74 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 4 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 4 | ||||
-rw-r--r-- | scumm/vars.cpp | 1 |
7 files changed, 69 insertions, 20 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 3d154a851d..ca8b4f20c2 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -2063,6 +2063,8 @@ void Scumm::setCameraAt(int pos_x, int pos_y) { } void Scumm::setCameraFollows(Actor *a) { + assert(a != NULL); + if (_features & GF_AFTER_V7) { byte oldfollow = camera._follows; int ax, ay; diff --git a/scumm/intern.h b/scumm/intern.h index b96f894133..96da9ddb4c 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -119,7 +119,7 @@ protected: void o5_notEqualZero(); void o5_oldRoomEffect(); void o5_or(); - void o5_overRide(); + void o5_beginOverride(); void o5_panCameraTo(); void o5_pickupObject(); void o5_pickupObjectOld(); @@ -220,6 +220,7 @@ protected: void o2_animateActor(); void o2_assignVarByte(); void o2_assignVarWordIndirect(); + void o2_beginOverride(); void o2_chainScript(); void o2_clearState01(); void o2_clearState02(); diff --git a/scumm/script.cpp b/scumm/script.cpp index be6963edf2..017a0e1fe9 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -1103,6 +1103,7 @@ void Scumm::beginOverride() { // why we record the current script position in vm.cutScenePtr). fetchScriptByte(); fetchScriptWord(); + VAR(VAR_OVERRIDE) = 0; } diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 2920610c1d..33b5d296ac 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -143,7 +143,7 @@ void Scumm_v2::setupOpcodes() { OPCODE(o5_getActorMoving), OPCODE(o2_setState02), /* 58 */ - OPCODE(beginOverride), + OPCODE(o2_beginOverride), OPCODE(o2_doSentence), OPCODE(o5_add), OPCODE(o2_setBitVar), @@ -852,9 +852,9 @@ void Scumm_v2::o2_doSentence() { warning("TODO o2_doSentence(%d, %d, %d): execute", st->verb, st->objectA, st->objectB); // FIXME / TODO: The following is hackish, and probably incomplete, but it works somewhat. - _scummVars[VAR_ACTIVE_VERB] = st->verb; - _scummVars[VAR_ACTIVE_OBJECT1] = st->objectA; - _scummVars[VAR_ACTIVE_OBJECT2] = st->objectB; + VAR(VAR_ACTIVE_VERB) = st->verb; + VAR(VAR_ACTIVE_OBJECT1) = st->objectA; + VAR(VAR_ACTIVE_OBJECT2) = st->objectB; runObjectScript(st->objectA, st->verb, 0, 0, NULL); break; @@ -863,9 +863,9 @@ void Scumm_v2::o2_doSentence() { _sentenceNum--; warning("TODO o2_doSentence(%d, %d, %d): print", st->verb, st->objectA, st->objectB); - _scummVars[VAR_SENTENCE_VERB] = st->verb; - _scummVars[VAR_SENTENCE_OBJECT1] = st->objectA; - _scummVars[VAR_SENTENCE_OBJECT2] = st->objectB; + VAR(VAR_SENTENCE_VERB) = st->verb; + VAR(VAR_SENTENCE_OBJECT1) = st->objectA; + VAR(VAR_SENTENCE_OBJECT2) = st->objectB; o2_drawSentence(); break; @@ -876,22 +876,22 @@ void Scumm_v2::o2_drawSentence() { ScummVM::Rect sentenceline; static char sentence[80]; byte *temp; - int slot = getVerbSlot(_scummVars[VAR_SENTENCE_VERB],0); + int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB),0); if (!(_userState & 32)) return; strcpy(sentence, (char*)getResourceAddress(rtVerb, slot)); - if (_scummVars[VAR_SENTENCE_OBJECT1] > 0) { - temp = getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT1]); + if (VAR(VAR_SENTENCE_OBJECT1) > 0) { + temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT1)); if (temp) { strcat(sentence, " "); strcat(sentence, (char*)temp); } } - if (_scummVars[VAR_SENTENCE_OBJECT2] > 0) { - temp = getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT2]); + if (VAR(VAR_SENTENCE_OBJECT2) > 0) { + temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT2)); if (temp) { strcat(sentence, " with "); strcat(sentence, (char*)temp); @@ -1152,13 +1152,55 @@ void Scumm_v2::o2_roomOps() { void Scumm_v2::o2_cutscene() { warning("TODO o2_cutscene()"); + + vm.cutSceneData[0] = _userState; + vm.cutSceneData[1] = VAR(VAR_CURSORSTATE); + vm.cutSceneData[2] = _currentRoom; + vm.cutSceneData[3] = camera._mode; + + VAR(VAR_CURSORSTATE) = 200; + + // TODO: some cursor command stuff (hide mouse etc maybe?) + _sentenceNum = 0; stopScript(SENTENCE_SCRIPT); resetSentence(); + + vm.cutScenePtr[0] = 0; } void Scumm_v2::o2_endCutscene() { warning("TODO o2_endCutscene()"); + + vm.cutSceneStackPointer = 0; + + VAR(VAR_OVERRIDE) = 0; + vm.cutSceneScript[0] = 0; + vm.cutScenePtr[0] = 0; + + VAR(VAR_CURSORSTATE) = vm.cutSceneData[1]; + + // TODO: some cursor command stuff (probably to reset it to the pre-cutscene state) + + if (_gameId == GID_MANIAC) { + camera._mode = vm.cutSceneData[3]; + if (camera._mode == CM_FOLLOW_ACTOR) { + actorFollowCamera(VAR(VAR_EGO)); + } else if (vm.cutSceneData[2] != _currentRoom) { + startScene(vm.cutSceneData[2], 0, 0); + } + } else { + actorFollowCamera(VAR(VAR_EGO)); + } +} + +void Scumm_v2::o2_beginOverride() { + vm.cutScenePtr[0] = _scriptPointer - _scriptOrgPointer; + vm.cutSceneScript[0] = _currentScript; + + // Skip the jump instruction following the override instruction + fetchScriptByte(); + fetchScriptWord(); } void Scumm_v2::o2_chainScript() { @@ -1236,7 +1278,7 @@ void Scumm_v2::o2_cursorCommand() { // TODO: Define the magic numbers int a2 = cmd >> 8; if (cmd & 0xFF) { // (?) - _scummVars[21] = cmd & 0xFF; + VAR(VAR_CURSORSTATE) = cmd & 0xFF; printf("Set cmd %d\n", cmd & 0xFF); } @@ -1280,8 +1322,8 @@ void Scumm_v2::o2_dummy() { } void Scumm_v2::resetSentence() { - _scummVars[VAR_SENTENCE_VERB] = _scummVars[VAR_BACKUP_VERB]; - _scummVars[VAR_SENTENCE_OBJECT1] = 0; - _scummVars[VAR_SENTENCE_OBJECT2] = 0; + VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB); + VAR(VAR_SENTENCE_OBJECT1) = 0; + VAR(VAR_SENTENCE_OBJECT2) = 0; _scummVars[29] = 0; } diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index b3cf4a1522..2a81d7d8b9 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -143,7 +143,7 @@ void Scumm_v5::setupOpcodes() { OPCODE(o5_getActorMoving), OPCODE(o5_or), /* 58 */ - OPCODE(o5_overRide), + OPCODE(o5_beginOverride), OPCODE(o5_doSentence), OPCODE(o5_add), OPCODE(o5_divide), @@ -1412,7 +1412,7 @@ void Scumm_v5::o5_or() { setResult(readVar(_resultVarNumber) | a); } -void Scumm_v5::o5_overRide() { +void Scumm_v5::o5_beginOverride() { if (fetchScriptByte() != 0) beginOverride(); else diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 1767704595..51cf6092db 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1316,6 +1316,7 @@ void Scumm::initRoomSubBlocks() { int ENCD_len = -1; if (_features & GF_AFTER_V2) { _ENCD_offs = READ_LE_UINT16(roomptr + 0x1A); + // TODO: determine v2 entry script length } else if (_features & GF_OLD_BUNDLE) { _ENCD_offs = READ_LE_UINT16(roomptr + 0x1B); // FIXME - the following is a hack which assumes that immediately after @@ -1759,7 +1760,8 @@ void Scumm::processKbd() { return; } - if (_lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY)) { + if (_lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY) || + (VAR(VAR_CUTSCENEEXIT_KEY) == 4 && _lastKeyHit == 27)) { if (_insaneState) { _videoFinished = true; } else diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 6e67414a3b..07772bc970 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -116,6 +116,7 @@ void Scumm_v2::setupScummVars() { VAR_VERB_ALLOWED = 18; VAR_ACTOR_RANGE_MIN = 19; VAR_ACTOR_RANGE_MAX = 20; + VAR_CURSORSTATE = 21; VAR_CAMERA_MIN_X = 23; VAR_CAMERA_MAX_X = 24; VAR_TIMER_NEXT = 25; |