aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhitertandrek2018-03-20 17:13:47 +0200
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit2e3e07b8582a6d4bc54e263b334d3d26e8caa994 (patch)
tree88058ebd7e9c0e044d26ba4559cc6e3fc728e6be
parenta49b399fbdbea1864dad20a793931bbb45f04e1c (diff)
downloadscummvm-rg350-2e3e07b8582a6d4bc54e263b334d3d26e8caa994.tar.gz
scummvm-rg350-2e3e07b8582a6d4bc54e263b334d3d26e8caa994.tar.bz2
scummvm-rg350-2e3e07b8582a6d4bc54e263b334d3d26e8caa994.zip
PINK: added some methods to Actor
-rw-r--r--engines/pink/actors/actor.cpp34
-rw-r--r--engines/pink/actors/actor.h7
2 files changed, 27 insertions, 14 deletions
diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp
index f92c1cb833..fefe1f9834 100644
--- a/engines/pink/actors/actor.cpp
+++ b/engines/pink/actors/actor.cpp
@@ -40,7 +40,7 @@ Sequencer *Actor::getSequencer() {
return _page->getSequencer();
}
-Action *Actor::findAction(Common::String &name) {
+Action *Actor::findAction(const Common::String &name) {
return *Common::find_if(_actions.begin(), _actions.end(), [&name]
(Action* action) {
return name == action->getName();
@@ -51,27 +51,39 @@ GamePage *Actor::getPage() const {
return _page;
}
-void Actor::setIdleAction(bool unk) {
- assert(_action == nullptr);
-
- uint i;
- for (i = 0; i < _actions.size(); ++i) {
- if (_action[i].getName() == "Idle") {
- _action = _actions[i];
- break;
- }
+void Actor::init(bool unk) {
+ if (!_action) {
+ _action = findAction({"Idle"});
}
+
if (!_action) {
_isActionEnd = 1;
}
else {
_isActionEnd = 0;
- //call action virt method
+ _action->play(unk);
}
}
+void Actor::hide() {
+ setAction({"Hide"});
+}
+
void Actor::endAction() {
_isActionEnd = 1;
}
+void Actor::setAction(const Common::String &name) {
+ Action *newAction = findAction(name);
+ if (_action) {
+ _isActionEnd = 1;
+ _action->end();
+ }
+ if (newAction) {
+ _isActionEnd = 0;
+ _action = newAction;
+ _action->play(0);
+ }
+}
+
} // End of namespace Pink
diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h
index 4e494bddf5..54661bd48c 100644
--- a/engines/pink/actors/actor.h
+++ b/engines/pink/actors/actor.h
@@ -40,14 +40,15 @@ public:
{};
virtual void deserialize(Archive &archive);
- Action *findAction(Common::String &name);
-
Sequencer *getSequencer();
GamePage *getPage() const;
- void setIdleAction(bool unk);
+ void init(bool unk);
+ void hide();
void endAction();
+ Action *findAction(const Common::String &name);
+ void setAction(const Common::String &name);
protected:
GamePage *_page;