Skip to content

Commit

Permalink
PINK: add proper implementation of Actor init function
Browse files Browse the repository at this point in the history
  • Loading branch information
voltya authored and sev- committed Jun 28, 2018
1 parent 44efa90 commit f7693d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions engines/pink/objects/actors/actor.cpp
Expand Up @@ -58,15 +58,16 @@ void Actor::saveState(Archive &archive) {
archive.writeString(actionName);
}

void Actor::init(bool unk) {
void Actor::init(bool paused) {
if (!_action)
_action = findAction(kIdleAction);

if (!_action) {
_isActionEnded = 1;
} else {
_isActionEnded = 0;
_action->start(unk);
_action->start();
_action->pause(paused);
}
}

Expand Down Expand Up @@ -168,7 +169,7 @@ void Actor::setAction(Action *newAction) {
_action = newAction;
if (newAction) {
_isActionEnded = 0;
_action->start(0);
_action->start();
}
}

Expand Down
2 changes: 1 addition & 1 deletion engines/pink/objects/actors/actor.h
Expand Up @@ -47,7 +47,7 @@ class Actor : public NamedObject {
void loadState(Archive &archive);
void saveState(Archive &archive);

virtual void init(bool unk);
virtual void init(bool paused);
bool initPallete(Director *director);

void toConsole() override ;
Expand Down
2 changes: 1 addition & 1 deletion engines/pink/objects/handlers/handler_timer.cpp
Expand Up @@ -65,7 +65,7 @@ void HandlerTimerActions::handle(Actor *actor) {
uint index = rnd.getRandomNumber(_actions.size() - 1);
Action *action = actor->findAction(_actions[index]);
assert(action);
actor->setAction(action, 0);
actor->setAction(action);
}
}

Expand Down
6 changes: 3 additions & 3 deletions engines/pink/objects/walk/walk_mgr.cpp
Expand Up @@ -71,7 +71,7 @@ void WalkMgr::start(WalkLocation *destination) {
WalkShortestPath path(this);
WalkLocation *nextLocation = path.next(currentLocation, _destination);
initNextWayPoint(nextLocation);
_leadActor->setAction(getWalkAction(), 0);
_leadActor->setAction(getWalkAction());
}
}

Expand Down Expand Up @@ -106,7 +106,7 @@ WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locat
Coordinates coords;
ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));

action->start(0);
action->start();
CelDecoder *decoder = action->getDecoder();

coords.x = decoder->getX() + decoder->getWidth() / 2;
Expand All @@ -132,7 +132,7 @@ void WalkMgr::update() {
WalkLocation *next = path.next(findLocation(_current.name), _destination);
if (next) {
initNextWayPoint(next);
_leadActor->setAction(getWalkAction(), 0);
_leadActor->setAction(getWalkAction());
} else
end();

Expand Down

0 comments on commit f7693d3

Please sign in to comment.