diff options
author | Andrei Prykhodko | 2018-06-30 15:18:03 +0300 |
---|---|---|
committer | Andrei Prykhodko | 2018-06-30 15:18:03 +0300 |
commit | 5f0fec7de2f9f2df3124aaa2388edbc3d03d2e37 (patch) | |
tree | 37b8c7d29ab9d71c13b68e32d37e083a945efa8b /engines/pink | |
parent | ef9892dbd4c15f30586c8532e4e6ab56215b1582 (diff) | |
download | scummvm-rg350-5f0fec7de2f9f2df3124aaa2388edbc3d03d2e37.tar.gz scummvm-rg350-5f0fec7de2f9f2df3124aaa2388edbc3d03d2e37.tar.bz2 scummvm-rg350-5f0fec7de2f9f2df3124aaa2388edbc3d03d2e37.zip |
PINK: fixed various PDA bugs
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/objects/actions/action_cel.cpp | 1 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_cel.h | 4 | ||||
-rw-r--r-- | engines/pink/objects/pages/pda_page.cpp | 9 | ||||
-rw-r--r-- | engines/pink/objects/pages/pda_page.h | 1 | ||||
-rw-r--r-- | engines/pink/pda_mgr.cpp | 44 | ||||
-rw-r--r-- | engines/pink/pda_mgr.h | 4 |
6 files changed, 16 insertions, 47 deletions
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp index 600eb88e27..5abc9787b9 100644 --- a/engines/pink/objects/actions/action_cel.cpp +++ b/engines/pink/objects/actions/action_cel.cpp @@ -65,6 +65,7 @@ void ActionCEL::start() { void ActionCEL::end() { _actor->getPage()->getGame()->getDirector()->removeSprite(this); + _decoder.close(); } void ActionCEL::pause(bool paused) { diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h index 07e16e7c03..2a88350458 100644 --- a/engines/pink/objects/actions/action_cel.h +++ b/engines/pink/objects/actions/action_cel.h @@ -38,8 +38,6 @@ public: bool initPalette(Director *director) override; - void loadDecoder(); - void start() override; void end() override; @@ -62,6 +60,8 @@ protected: void setFrame(uint frame); void decodeNext(); + void loadDecoder(); + CelDecoder _decoder; Common::String _fileName; Common::Rect _bounds; diff --git a/engines/pink/objects/pages/pda_page.cpp b/engines/pink/objects/pages/pda_page.cpp index e8d4ae94f5..ac69c38cb2 100644 --- a/engines/pink/objects/pages/pda_page.cpp +++ b/engines/pink/objects/pages/pda_page.cpp @@ -34,13 +34,4 @@ PDAPage PDAPage::create(const Common::String &pageName, PDAMgr &pdaMgr) { return page; } -Array<Actor *> PDAPage::takeActors() { - for (uint i = 0; i < _actors.size(); ++i) { - _actors[i]->preloadSprites(); - } - Array<Actor *> actorsCopy = _actors; - _actors.clear(); - return actorsCopy; -} - } // End of namespace Pink diff --git a/engines/pink/objects/pages/pda_page.h b/engines/pink/objects/pages/pda_page.h index 79da57c985..76cc05810e 100644 --- a/engines/pink/objects/pages/pda_page.h +++ b/engines/pink/objects/pages/pda_page.h @@ -32,7 +32,6 @@ class PDAMgr; class PDAPage : public Page { public: static PDAPage create(const Common::String &pageName, PDAMgr &pdaMgr); - Array<Actor *> takeActors(); private: PDAPage(const Common::String &name) { _name = name; } diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp index 01a4d2dc11..411649b2f8 100644 --- a/engines/pink/pda_mgr.cpp +++ b/engines/pink/pda_mgr.cpp @@ -33,13 +33,11 @@ static const char * const g_countries[] = {"BRI", "EGY", "BHU", "AUS", "IND", "C static const char * const g_domains[] = {"NAT", "CLO", "HIS", "REL", "PLA", "ART", "FOO", "PEO"}; PDAMgr::PDAMgr(Pink::PinkEngine *game) - : _game(game), _page(nullptr), _cursorMgr(game, nullptr), - _countryIndex(0), _domainIndex(0) {} + : _game(game), _page(nullptr), _globalPage(nullptr), + _cursorMgr(game, nullptr), _countryIndex(0), _domainIndex(0) {} PDAMgr::~PDAMgr() { - for (uint i = 0; i < _globalActors.size(); ++i) { - delete _globalActors[i]; - } + delete _globalPage; delete _page; } @@ -107,10 +105,6 @@ void PDAMgr::goToPage(const Common::String &pageName) { _page->init(); - for (uint i = 0; i < _globalActors.size(); ++i) { - _globalActors[i]->setPage(_page); - } - _previousPages.push(_page->getName()); if (_game->isPeril()) @@ -135,37 +129,31 @@ void PDAMgr::onMouseMove(Common::Point point) { } void PDAMgr::close() { - for (uint i = 0; i < _globalActors.size(); ++i) { - delete _globalActors[i]; - } - _globalActors.clear(); - + delete _globalPage; delete _page; + _globalPage = nullptr; _page = nullptr; _lead->onPDAClose(); } void PDAMgr::loadGlobal() { - if (!_globalActors.empty()) + if (_globalPage) return; - PDAPage globalPage = PDAPage::create("GLOBAL", *this); - _globalActors = globalPage.takeActors(); - for (uint i = 0; i < _globalActors.size(); ++i) { - _globalActors[i]->init(0); - } + _globalPage = new PDAPage(PDAPage::create("GLOBAL", *this)); + _globalPage->init(); } void PDAMgr::initPerilButtons() { - Actor *prevPageButton = findGlobalActor(kPreviousPageButton); + Actor *prevPageButton = _globalPage->findActor(kPreviousPageButton); if (_previousPages.size() < 2) prevPageButton->setAction(kInactiveAction); else prevPageButton->setAction(kIdleAction); - Actor *navigatorButton = findGlobalActor(kNavigatorButton); - Actor *domainButton = findGlobalActor(kDomainButton); + Actor *navigatorButton = _globalPage->findActor(kNavigatorButton); + Actor *domainButton = _globalPage->findActor(kDomainButton); if (isNavigate(_page->getName())) { navigatorButton->setAction(kInactiveAction); domainButton->setAction(kInactiveAction); @@ -180,14 +168,6 @@ void PDAMgr::initPerilButtons() { updateLocator(); } -Actor *PDAMgr::findGlobalActor(const Common::String &actorName) { - for (uint i = 0; i < _globalActors.size(); ++i) { - if (_globalActors[i]->getName() == actorName) - return _globalActors[i]; - } - return nullptr; -} - void PDAMgr::updateWheels(bool playSfx) { Actor *wheel = _page->findActor(kCountryWheel); if (playSfx && wheel->getAction()->getName() != g_countries[_countryIndex]) { @@ -215,7 +195,7 @@ bool PDAMgr::isDomain(const Common::String &name) { } void PDAMgr::updateLocator() { - Actor *locator = findGlobalActor(kLocator); + Actor *locator = _globalPage->findActor(kLocator); if (locator) locator->setAction(g_countries[_countryIndex]); } diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h index a81ea7359d..f2344071c9 100644 --- a/engines/pink/pda_mgr.h +++ b/engines/pink/pda_mgr.h @@ -67,8 +67,6 @@ private: void updateWheels(bool playSfx = 0); void updateLocator(); - Actor *findGlobalActor(const Common::String &actorName); - static bool isNavigate(const Common::String &name); static bool isDomain(const Common::String &name); @@ -76,8 +74,8 @@ private: PinkEngine *_game; LeadActor *_lead; PDAPage *_page; + PDAPage *_globalPage; CursorMgr _cursorMgr; - Array<Actor *> _globalActors; Common::String _savedPage; Common::Stack<Common::String> _previousPages; uint _countryIndex; |