diff options
author | Andrei Prykhodko | 2018-06-30 08:56:05 +0300 |
---|---|---|
committer | Andrei Prykhodko | 2018-06-30 08:56:05 +0300 |
commit | 4938a33fbbdfd4d78571700792fb56e08dde62b9 (patch) | |
tree | 3250b262cd3f8b19e3efee5b911d72b052868f6a | |
parent | f9489be3a9058d8dd22c59af77a450a7b81d56cd (diff) | |
download | scummvm-rg350-4938a33fbbdfd4d78571700792fb56e08dde62b9.tar.gz scummvm-rg350-4938a33fbbdfd4d78571700792fb56e08dde62b9.tar.bz2 scummvm-rg350-4938a33fbbdfd4d78571700792fb56e08dde62b9.zip |
PINK: added pre-loading of global pda page sprites
-rw-r--r-- | engines/pink/objects/actions/action_cel.h | 3 | ||||
-rw-r--r-- | engines/pink/objects/actors/actor.cpp | 10 | ||||
-rw-r--r-- | engines/pink/objects/actors/actor.h | 2 | ||||
-rw-r--r-- | engines/pink/objects/pages/pda_page.cpp | 4 |
4 files changed, 16 insertions, 3 deletions
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h index 62a4c45f95..b1fa1b6235 100644 --- a/engines/pink/objects/actions/action_cel.h +++ b/engines/pink/objects/actions/action_cel.h @@ -38,6 +38,8 @@ public: bool initPalette(Director *director) override; + void loadDecoder(); + void start() override; void end() override; @@ -57,7 +59,6 @@ public: protected: virtual void onStart() = 0; - void loadDecoder(); void closeDecoder(); void setFrame(uint frame); diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp index 2725338580..0c327aee03 100644 --- a/engines/pink/objects/actors/actor.cpp +++ b/engines/pink/objects/actors/actor.cpp @@ -22,7 +22,7 @@ #include "pink/constants.h" #include "pink/cursor_mgr.h" -#include "pink/objects/actions/action.h" +#include "pink/objects/actions/action_cel.h" #include "pink/objects/actors/actor.h" #include "pink/objects/actors/lead_actor.h" #include "pink/objects/pages/game_page.h" @@ -79,6 +79,14 @@ bool Actor::initPalette(Director *director) { return false; } +void Actor::preloadSprites() { + for (uint i = 0; i < _actions.size(); ++i) { + ActionCEL *cel = dynamic_cast<ActionCEL*>(_actions[i]); + if (cel) + cel->loadDecoder(); + } +} + void Actor::toConsole() { debug("Actor: _name = %s", _name.c_str()); for (uint i = 0; i < _actions.size(); ++i) { diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h index 294beb99b6..47f5bc50d0 100644 --- a/engines/pink/objects/actors/actor.h +++ b/engines/pink/objects/actors/actor.h @@ -50,6 +50,8 @@ public: virtual void init(bool paused); bool initPalette(Director *director); + void preloadSprites(); + void toConsole() override; bool isPlaying() { return !_isActionEnded; } diff --git a/engines/pink/objects/pages/pda_page.cpp b/engines/pink/objects/pages/pda_page.cpp index f8d7e17bbf..a6fa9b1338 100644 --- a/engines/pink/objects/pages/pda_page.cpp +++ b/engines/pink/objects/pages/pda_page.cpp @@ -36,8 +36,10 @@ PDAPage PDAPage::create(const Common::String &pageName, PDAMgr &pdaMgr) { } Array<Actor *> PDAPage::takeActors() { + for (uint i = 0; i < _actors.size(); ++i) { + _actors[i]->preloadSprites(); + } Array<Actor *> actorsCopy = _actors; - _actors.clear(); return actorsCopy; } |