aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects/actions/action_cel.cpp
diff options
context:
space:
mode:
authorwhiterandrek2018-06-03 14:24:59 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commitda0adc92a2cc1af0da78a4e612f382e1e5b42bd0 (patch)
tree773ba0a3694c59516b9c38cc3133d3508909eb2f /engines/pink/objects/actions/action_cel.cpp
parent442f725a5d2d36183fdc41d7b050beb4aa4fd8fa (diff)
downloadscummvm-rg350-da0adc92a2cc1af0da78a4e612f382e1e5b42bd0.tar.gz
scummvm-rg350-da0adc92a2cc1af0da78a4e612f382e1e5b42bd0.tar.bz2
scummvm-rg350-da0adc92a2cc1af0da78a4e612f382e1e5b42bd0.zip
PINK: reformat Action's code
Diffstat (limited to 'engines/pink/objects/actions/action_cel.cpp')
-rw-r--r--engines/pink/objects/actions/action_cel.cpp47
1 files changed, 25 insertions, 22 deletions
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 0881542155..e6f262f390 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -34,13 +34,29 @@ namespace Pink {
ActionCEL::ActionCEL()
: _decoder(nullptr) {}
+ActionCEL::~ActionCEL() {
+ end();
+}
+
void ActionCEL::deserialize(Archive &archive) {
Action::deserialize(archive);
_fileName = archive.readString();
_z = archive.readDWORD();
}
-void ActionCEL::start(bool unk) {
+bool ActionCEL::initPalette(Director *director) {
+ if (!_decoder)
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ if (_decoder->getCurFrame() == -1) {
+ _decoder->decodeNextFrame();
+ _decoder->rewind();
+ }
+ debug("%u", _decoder->isPaused());
+ director->setPallette(_decoder->getPalette());
+ return true;
+}
+
+void ActionCEL::start() {
if (!_decoder)
_decoder = _actor->getPage()->loadCel(_fileName);
_actor->getPage()->getGame()->getDirector()->addSprite(this);
@@ -54,23 +70,6 @@ void ActionCEL::end() {
_decoder = nullptr;
}
-uint32 ActionCEL::getZ() {
- return _z;
-}
-
-CelDecoder *ActionCEL::getDecoder() {
- return _decoder;
-}
-
-bool ActionCEL::initPalette(Director *director) {
- _decoder = _actor->getPage()->loadCel(_fileName);
- _decoder->decodeNextFrame();
- _decoder->rewind();
- director->setPallette(_decoder->getPalette());
-
- return 1;
-}
-
void ActionCEL::update() {
if (_decoder->endOfVideo()) {
_decoder->stop();
@@ -78,12 +77,16 @@ void ActionCEL::update() {
}
}
-ActionCEL::~ActionCEL() {
- end();
-}
-
void ActionCEL::pause(bool paused) {
_decoder->pauseVideo(paused);
}
+uint32 ActionCEL::getZ() {
+ return _z;
+}
+
+CelDecoder *ActionCEL::getDecoder() {
+ return _decoder;
+}
+
} // End of namespace Pink