TWP: Fix break light animation

This commit is contained in:
scemino 2024-01-05 21:43:12 +01:00 committed by Eugene Sandulenko
parent 1b7f4ef586
commit 0f784c64ad
4 changed files with 12 additions and 8 deletions

View File

@ -160,7 +160,6 @@ void ReachAnim::update(float elapsed) {
break;
default:
break;
;
}
}
@ -181,7 +180,8 @@ void WalkTo::disable() {
if (_path.size() != 0) {
debug("actor walk cancelled");
}
_obj->play("stand");
if(_obj->isWalking())
_obj->play("stand");
}
static bool needsReachAnim(int verbId) {
@ -225,7 +225,7 @@ void WalkTo::actorArrived() {
}
if (needsReach)
_reach = new ReachAnim(_obj, noun1);
_obj->setReach(new ReachAnim(_obj, noun1));
else
_obj->execVerb();
}
@ -258,9 +258,10 @@ void WalkTo::update(float elapsed) {
}
}
if (_reach && _reach->isEnabled()) {
_reach->update(elapsed);
if (!_reach->isEnabled())
Motor* reach = _obj->getReach();
if (reach && reach->isEnabled()) {
reach->update(elapsed);
if (!reach->isEnabled())
disable();
}
}
@ -365,7 +366,7 @@ void Talking::say(const Common::String &text) {
setDuration(txt);
if(_obj->_sayNode) {
if (_obj->_sayNode) {
_obj->_sayNode->remove();
}
Text text2("sayline", txt, thCenter, tvCenter, SCREEN_WIDTH * 3.f / 4.f, _color);

View File

@ -219,7 +219,6 @@ private:
Common::Array<Math::Vector2d> _path;
int _facing = 0;
float _wsd;
ReachAnim *_reach = nullptr;
};
// Creates a talking animation for a specified object.

View File

@ -465,6 +465,7 @@ void Object::setAlphaTo(Motor *alphaTo) { SET_MOTOR(alphaTo); }
void Object::setRotateTo(Motor *rotateTo) { SET_MOTOR(rotateTo); }
void Object::setMoveTo(Motor *moveTo) { SET_MOTOR(moveTo); }
void Object::setWalkTo(Motor *walkTo) { SET_MOTOR(walkTo); }
void Object::setReach(Motor *reach) { SET_MOTOR(reach); }
void Object::setTalking(Motor *talking) { SET_MOTOR(talking); }
void Object::setBlink(Motor *blink) { SET_MOTOR(blink); }
void Object::setTurnTo(Motor *turnTo) { SET_MOTOR(turnTo); }

View File

@ -195,7 +195,9 @@ public:
void setRotateTo(Motor *rotateTo);
void setMoveTo(Motor *moveTo);
void setWalkTo(Motor *walkTo);
void setReach(Motor *reach);
Motor *getWalkTo() const { return _walkTo; }
Motor *getReach() const { return _reach; }
void walk(Math::Vector2d pos, int facing = 0);
void walk(Object* obj);
@ -276,6 +278,7 @@ private:
Motor *_rotateTo = nullptr;
Motor *_moveTo = nullptr;
Motor *_walkTo = nullptr;
Motor *_reach = nullptr;
Motor *_talking = nullptr;
Motor *_blink = nullptr;
Motor *_turnTo = nullptr;