Permalink
Browse files

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.
  • Loading branch information...
lolbot-iichan committed Aug 26, 2018
1 parent 522df14 commit f49d7f66a21587d944a0a694bccb52bb944c1019
Showing with 50 additions and 0 deletions.
  1. +50 −0 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"
@@ -1019,6 +1020,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
//////////////////////////////////////////////////////////////////////////

0 comments on commit f49d7f6

Please sign in to comment.