diff options
author | lolbot-iichan | 2018-08-27 01:00:01 +0300 |
---|---|---|
committer | Filippos Karapetis | 2020-01-11 18:05:39 +0200 |
commit | 46f523d773676a29f18bf0333d646d1d0d6557b5 (patch) | |
tree | 4dba095873b39d7920e0e79214b01937519bde58 /engines/wintermute/ad/ad_actor.cpp | |
parent | 755d6deb171c46bbf1fa328b90ce1f097a9d58e9 (diff) | |
download | scummvm-rg350-46f523d773676a29f18bf0333d646d1d0d6557b5.tar.gz scummvm-rg350-46f523d773676a29f18bf0333d646d1d0d6557b5.tar.bz2 scummvm-rg350-46f523d773676a29f18bf0333d646d1d0d6557b5.zip |
WINTERMUTE: Add FoxTail actor walking methods
There are two new methods: immidiate stop and changing walking speed
For stopping, I'm reusing turnTo() code to finalize moving.
I talked to FoxTail devs about what SetSpeedWalkAnim actually does and answer was to set animation delays with given number of milliseconds.
Diffstat (limited to 'engines/wintermute/ad/ad_actor.cpp')
-rw-r--r-- | engines/wintermute/ad/ad_actor.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index 75e7c45d7e..a598581632 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.cpp @@ -34,6 +34,7 @@ #include "engines/wintermute/ad/ad_waypoint_group.h" #include "engines/wintermute/ad/ad_path.h" #include "engines/wintermute/ad/ad_sentence.h" +#include "engines/wintermute/base/base_frame.h" #include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/base/base_region.h" @@ -919,7 +920,7 @@ void AdActor::getNextStep() { ////////////////////////////////////////////////////////////////////////// void AdActor::initLine(const BasePoint &startPt, const BasePoint &endPt) { - _pFCount = MAX((abs(endPt.x - startPt.x)) , (abs(endPt.y - startPt.y))); + _pFCount = MAX((abs(endPt.x - startPt.x)), (abs(endPt.y - startPt.y))); _pFStepX = (double)(endPt.x - startPt.x) / _pFCount; _pFStepY = (double)(endPt.y - startPt.y) / _pFCount; @@ -1022,6 +1023,55 @@ bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, return STATUS_OK; } +#ifdef ENABLE_FOXTAIL + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] StopWalking + // Used to stop Leah in one scene only at rabbit_run.script in action() + // Let's just call turnTo() for current direction to finalize movement + // Return value is never used + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "StopWalking") == 0) { + stack->correctParams(0); + turnTo(_dir); + stack->pushNULL(); + + return STATUS_OK; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] SetSpeedWalkAnim + // Used to set Leah speed at leah.script in SetSpeed() + // Modifies walking animations interframe delays + // Takes integer parameter: + // 10 on state.ultra_super_mega_fast_walk cheat code + // 40 on "Fast" settings + // 70 on "Normal" settings + // 90 on "Slow" settings + // Return value is never used + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "SetSpeedWalkAnim") == 0) { + stack->correctParams(1); + int speedWalk = stack->pop()->getInt(); + for (uint32 dir = 0; dir < NUM_DIRECTIONS; dir++) { + AdSpriteSet *anim = getAnimByName(_walkAnimName); + if (anim != nullptr) { + BaseSprite *item = anim->getSprite((TDirection)dir); + if (item != nullptr) { + for (uint32 i = 0; i < item->_frames.size(); i++) { + BaseFrame *frame = item->_frames[i]; + if (frame != nullptr) { + frame->_delay = speedWalk; + } + } + } + } + } + stack->pushNULL(); + + return STATUS_OK; + } +#endif + ////////////////////////////////////////////////////////////////////////// // MergeAnims ////////////////////////////////////////////////////////////////////////// |