diff options
author | Andrew Kurushin | 2005-04-16 11:03:34 +0000 |
---|---|---|
committer | Andrew Kurushin | 2005-04-16 11:03:34 +0000 |
commit | f6d87c868949771f65d3996308b4dfde2357089e (patch) | |
tree | bb7c6f9e700b98eef74bf6f0041083820e1de3df | |
parent | 58298999f349831f18a3a4d33dac97215cffa334 (diff) | |
download | scummvm-rg350-f6d87c868949771f65d3996308b4dfde2357089e.tar.gz scummvm-rg350-f6d87c868949771f65d3996308b4dfde2357089e.tar.bz2 scummvm-rg350-f6d87c868949771f65d3996308b4dfde2357089e.zip |
fixed ram dialog crash
implemented: sfScriptSpecialWalk,sfScriptWalkRelative,sfScriptMoveRelative
svn-id: r17618
-rw-r--r-- | saga/script.h | 6 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 108 |
2 files changed, 86 insertions, 28 deletions
diff --git a/saga/script.h b/saga/script.h index 029f38a567..24577db51e 100644 --- a/saga/script.h +++ b/saga/script.h @@ -500,11 +500,11 @@ private: void sfSetPortrait(SCRIPTFUNC_PARAMS); void sfSetProtagPortrait(SCRIPTFUNC_PARAMS); void sfChainBgdAnim(SCRIPTFUNC_PARAMS); - void SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS); + void sfScriptSpecialWalk(SCRIPTFUNC_PARAMS); void sfPlaceActor(SCRIPTFUNC_PARAMS); void SF_checkUserInterrupt(SCRIPTFUNC_PARAMS); - void SF_walkRelative(SCRIPTFUNC_PARAMS); - void SF_moveRelative(SCRIPTFUNC_PARAMS); + void sfScriptWalkRelative(SCRIPTFUNC_PARAMS); + void sfScriptMoveRelative(SCRIPTFUNC_PARAMS); void SF_simulSpeech2(SCRIPTFUNC_PARAMS); void sfPlacard(SCRIPTFUNC_PARAMS); void sfPlacardOff(SCRIPTFUNC_PARAMS); diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 53bb5077e8..82efff070f 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -92,11 +92,11 @@ void Script::setupScriptFuncList(void) { OPCODE(sfSetPortrait), OPCODE(sfSetProtagPortrait), OPCODE(sfChainBgdAnim), - OPCODE(SF_scriptSpecialWalk), + OPCODE(sfScriptSpecialWalk), OPCODE(sfPlaceActor), OPCODE(SF_checkUserInterrupt), - OPCODE(SF_walkRelative), - OPCODE(SF_moveRelative), + OPCODE(sfScriptWalkRelative), + OPCODE(sfScriptMoveRelative), OPCODE(SF_simulSpeech2), OPCODE(sfPlacard), OPCODE(sfPlacardOff), @@ -392,8 +392,8 @@ void Script::sfKillActorThreads(SCRIPTFUNC_PARAMS) { for (threadIterator = _threadList.begin(); threadIterator != _threadList.end(); ++threadIterator) { anotherThread = threadIterator.operator->(); if ((anotherThread != thread) && (anotherThread->_threadVars[kThreadVarActor] == actorId)) { - thread->_flags &= ~kTFlagWaiting; - thread->_flags |= kTFlagAborted; + anotherThread->_flags &= ~kTFlagWaiting; + anotherThread->_flags |= kTFlagAborted; } } } @@ -968,13 +968,27 @@ void Script::sfChainBgdAnim(SCRIPTFUNC_PARAMS) { } // Script function #42 (0x2A) -void Script::SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS) { - thread->pop(); - thread->pop(); - thread->pop(); - thread->pop(); +// Param1: actor id +// Param2: actor x +// Param3: actor y +// Param4: frame seq +void Script::sfScriptSpecialWalk(SCRIPTFUNC_PARAMS) { + int16 actorId; + int16 walkFrameSequence; + Location actorLocation; + ActorData *actor; + + actorId = thread->pop(); + actorLocation.x = thread->pop(); + actorLocation.y = thread->pop(); + walkFrameSequence = thread->pop(); + + actor = _vm->_actor->getActor(actorId); + actorLocation.z = actor->location.z; + + _vm->_actor->actorWalkTo(actorId, actorLocation); - //debug(1, "stub: SF_scriptSpecialWalk(%d, %d, %d, %d)", param1, param2, param3, param4); + actor->walkFrameSequence = walkFrameSequence; } // Script function #43 (0x2B) nonblocking @@ -1040,25 +1054,69 @@ void Script::SF_checkUserInterrupt(SCRIPTFUNC_PARAMS) { } // Script function #45 (0x2D) -void Script::SF_walkRelative(SCRIPTFUNC_PARAMS) { - thread->pop(); - thread->pop(); - thread->pop(); - thread->pop(); - thread->pop(); +// Param1: actor id +// Param2: object id +// Param3: actor x +// Param4: actor y +// Param5: actor walk flag +void Script::sfScriptWalkRelative(SCRIPTFUNC_PARAMS) { + int16 actorId; + int16 objectId; + uint16 walkFlags; + Location actorLocation; + ActorData *actor; - //debug(1, "stub: SF_walkRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5); + actorId = thread->pop(); + objectId = thread->pop(); + actorLocation.x = thread->pop(); + actorLocation.y = thread->pop(); + walkFlags = thread->pop(); + + actor = _vm->_actor->getActor(actorId); + actorLocation.z = actor->location.z; + + _vm->_actor->realLocation(actorLocation, objectId, walkFlags); + + actor->flags &= ~kFollower; + + if (_vm->_actor->actorWalkTo(actorId, actorLocation) && !(walkFlags & kWalkAsync)) { + thread->waitWalk(actor); + } + + if (walkFlags & kWalkBackPedal) { + actor->actorFlags |= kActorBackwards; + } + + actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); } // Script function #46 (0x2E) -void Script::SF_moveRelative(SCRIPTFUNC_PARAMS) { - thread->pop(); - thread->pop(); - thread->pop(); - thread->pop(); - thread->pop(); +// Param1: actor id +// Param2: object id +// Param3: actor x +// Param4: actor y +// Param5: actor walk flag +void Script::sfScriptMoveRelative(SCRIPTFUNC_PARAMS) { + int16 actorId; + int16 objectId; + uint16 walkFlags; + Location actorLocation; + ActorData *actor; - //debug(1, "stub: SF_moveRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5); + actorId = thread->pop(); + objectId = thread->pop(); + actorLocation.x = thread->pop(); + actorLocation.y = thread->pop(); + walkFlags = thread->pop(); + + actor = _vm->_actor->getActor(actorId); + actorLocation.z = actor->location.z; + + _vm->_actor->realLocation(actorLocation, objectId, walkFlags); + + + actor->location = actorLocation; + actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); } // Script function #47 (0x2F) |