aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhiterandrek2018-03-29 12:58:44 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit65eccb7ba7e0d93ed9afc58e6312ee4bd04aa21e (patch)
tree69289f945add832630ce3864fb3bb1dded165fc5
parentf9c94a40a43ae26ca493c06e9356a1757f5d4d02 (diff)
downloadscummvm-rg350-65eccb7ba7e0d93ed9afc58e6312ee4bd04aa21e.tar.gz
scummvm-rg350-65eccb7ba7e0d93ed9afc58e6312ee4bd04aa21e.tar.bz2
scummvm-rg350-65eccb7ba7e0d93ed9afc58e6312ee4bd04aa21e.zip
PINK: added basic ActionLoop implementation
-rw-r--r--engines/pink/objects/actions/action.h2
-rw-r--r--engines/pink/objects/actions/action_cel.cpp2
-rw-r--r--engines/pink/objects/actions/action_cel.h2
-rw-r--r--engines/pink/objects/actions/action_loop.cpp20
-rw-r--r--engines/pink/objects/actions/action_loop.h4
-rw-r--r--engines/pink/objects/actors/actor.cpp2
6 files changed, 25 insertions, 7 deletions
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 3b79be205f..f981b523d6 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -38,7 +38,7 @@ public:
virtual void update() {};
virtual void toConsole() {};
- virtual bool initPallete(Director *director) { return 0;}
+ virtual bool initPalette(Director *director) { return 0;}
protected:
Actor *_actor;
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 312ae31a1d..c8d9eb7864 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -63,7 +63,7 @@ CelDecoder *ActionCEL::getDecoder() {
return _decoder;
}
-bool ActionCEL::initPallete(Director *director) {
+bool ActionCEL::initPalette(Director *director) {
_decoder = _actor->getPage()->loadCel(_fileName);
_decoder->decodeNextFrame();
_decoder->rewind();
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 7c0f7505d4..43fe8476e0 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -41,7 +41,7 @@ public:
uint32 getZ();
CelDecoder *getDecoder();
- virtual bool initPallete(Director *director);
+ virtual bool initPalette(Director *director);
protected:
virtual void onStart() {} ;
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 25e4d668f8..81760c5125 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -22,8 +22,9 @@
#include "action_loop.h"
-#include <common/debug.h>
#include <pink/archive.h>
+#include <pink/objects/actors/actor.h>
+#include <pink/cel_decoder.h>
namespace Pink {
@@ -40,8 +41,8 @@ void ActionLoop::deserialize(Archive &archive) {
break;
default:
_style = kForward;
+ break;
}
- //_style = static_cast<Style>(style);
}
void ActionLoop::toConsole() {
@@ -50,4 +51,19 @@ void ActionLoop::toConsole() {
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
+void ActionLoop::update() {
+ // for now it supports only forward loop animation
+ if (_style == kForward) {
+ if (_decoder->endOfVideo()){
+ debug("ACTION LOOP : NEXT ITERATION");
+ _decoder->rewind();
+ }
+ }
+}
+
+void ActionLoop::onStart() {
+ ActionPlay::onStart();
+ _actor->endAction();
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index a031bd1537..b8f5be352f 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -31,8 +31,10 @@ class ActionLoop : public ActionPlay {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
-
+ virtual void update();
protected:
+ virtual void onStart();
+
enum Style {
kPingPong = 2,
kRandom = 3,
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index dc4e59f231..c6ea1dcb1c 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -116,7 +116,7 @@ bool Actor::isPlaying() {
bool Actor::initPallete(Director *director) {
for (int i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->initPallete(director))
+ if (_actions[i]->initPalette(director))
return true;
}
return false;