[Scummvm-git-logs] scummvm master -> 35a3389cead91fc600dabe518fcee985aa46fd30

whiterandrek whiterandrek at gmail.com
Sat Jun 30 14:56:32 CEST 2018


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ef9892dbd4 PINK: implemented Inc/Dec Countries/Domains commands
5f0fec7de2 PINK: fixed various PDA bugs
d0adf31467 PINK: removed unnecessary function
516fbe05b3 PINK: fixed DecrementDomain command
35a3389cea PINK: fixed ActionPlayWithSfx


Commit: ef9892dbd4c15f30586c8532e4e6ab56215b1582
    https://github.com/scummvm/scummvm/commit/ef9892dbd4c15f30586c8532e4e6ab56215b1582
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-30T12:54:52+03:00

Commit Message:
PINK: implemented Inc/Dec Countries/Domains commands

Changed paths:
    engines/pink/constants.h
    engines/pink/pda_mgr.cpp
    engines/pink/pda_mgr.h


diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index abf7ba8..ce0e6a9 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -198,12 +198,16 @@ static const char * const kTrueValue = "TRUE";
 static const char * const kCountryWheel = "CountryWheel";
 static const char * const kDomainWheel = "DomainWheel";
 
+static const char * const kLocator = "Locator";
+
 static const char * const kPreviousPageButton = "PreviousPageButton";
 static const char * const kDomainButton = "DomainButton";
 static const char * const kNavigatorButton = "NavigatorButton";
 
 static const char * const kNavigatePage = "NAVIGATE";
 
+static const char * const kSfx = "SFX";
+
 } // End of namespace Pink
 
 #endif
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index ddf5eb0..01a4d2d 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -55,18 +55,38 @@ void PDAMgr::execute(const Command &command) {
 	case Command::kGoToPage:
 		goToPage(command.arg);
 		break;
-	case Command::kGoToPreviousPage: {
+	case Command::kGoToPreviousPage:
 		assert(_previousPages.size() >= 2);
 		_previousPages.pop();
 		goToPage(_previousPages.pop());
 		break;
-	}
 	case Command::kGoToDomain:
 		goToPage(Common::String::format("%.6s", _page->getName().c_str()));
 		break;
 	case Command::kGoToHelp:
 		warning("Command GoToHelp is not supported and won't be");
 		break;
+	case Command::kNavigateToDomain:
+		goToPage(Common::String(g_countries[_countryIndex]) += g_domains[_domainIndex]);
+		break;
+	case Command::kIncrementCountry:
+		_countryIndex = (_countryIndex + 1) % 6;
+		updateWheels(1);
+		updateLocator();
+		break;
+	case Command::kDecrementCountry:
+		_countryIndex = (_countryIndex + 5) % 6;
+		updateWheels(1);
+		updateLocator();
+		break;
+	case Command::kIncrementDomain:
+		_domainIndex = (_domainIndex + 1) % 8;
+		updateWheels(1);
+		break;
+	case Command::kDecrementDomain:
+		_domainIndex = (_domainIndex + 6) % 8;
+		updateWheels(1);
+		break;
 	case Command::kClose:
 		close();
 		break;
@@ -157,7 +177,7 @@ void PDAMgr::initPerilButtons() {
 		else
 			domainButton->setAction(kIdleAction);
 	}
-
+	updateLocator();
 }
 
 Actor *PDAMgr::findGlobalActor(const Common::String &actorName) {
@@ -168,9 +188,22 @@ Actor *PDAMgr::findGlobalActor(const Common::String &actorName) {
 	return nullptr;
 }
 
-void PDAMgr::updateWheels() {
-	_page->findActor(kCountryWheel)->setAction(g_countries[_countryIndex]);
-	_page->findActor(kDomainWheel)->setAction(g_domains[_domainIndex]);
+void PDAMgr::updateWheels(bool playSfx) {
+	Actor *wheel = _page->findActor(kCountryWheel);
+	if (playSfx && wheel->getAction()->getName() != g_countries[_countryIndex]) {
+		wheel->setAction(Common::String(g_countries[_countryIndex]) + kSfx);
+		dynamic_cast<ActionCEL*>(wheel->getAction())->update();
+		dynamic_cast<ActionCEL*>(wheel->getAction())->update(); // hack
+	}
+	wheel->setAction(g_countries[_countryIndex]);
+
+	wheel = _page->findActor(kDomainWheel);
+	if (playSfx && wheel->getAction()->getName() != g_domains[_domainIndex]) {
+		wheel->setAction(Common::String(g_domains[_domainIndex]) + kSfx);
+		dynamic_cast<ActionCEL*>(wheel->getAction())->update();
+		dynamic_cast<ActionCEL*>(wheel->getAction())->update(); // hack
+	}
+	wheel->setAction(g_domains[_domainIndex]);
 }
 
 bool PDAMgr::isNavigate(const Common::String &name) {
@@ -181,4 +214,10 @@ bool PDAMgr::isDomain(const Common::String &name) {
 	return name.size() == 6;
 }
 
+void PDAMgr::updateLocator() {
+	Actor *locator = findGlobalActor(kLocator);
+	if (locator)
+		locator->setAction(g_countries[_countryIndex]);
+}
+
 } // End of namespace Pink
diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h
index 0ae16e8..a81ea73 100644
--- a/engines/pink/pda_mgr.h
+++ b/engines/pink/pda_mgr.h
@@ -64,7 +64,8 @@ private:
 
 	void initPerilButtons();
 
-	void updateWheels();
+	void updateWheels(bool playSfx = 0);
+	void updateLocator();
 
 	Actor *findGlobalActor(const Common::String &actorName);
 


Commit: 5f0fec7de2f9f2df3124aaa2388edbc3d03d2e37
    https://github.com/scummvm/scummvm/commit/5f0fec7de2f9f2df3124aaa2388edbc3d03d2e37
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-30T15:18:03+03:00

Commit Message:
PINK: fixed various PDA bugs

Changed paths:
    engines/pink/objects/actions/action_cel.cpp
    engines/pink/objects/actions/action_cel.h
    engines/pink/objects/pages/pda_page.cpp
    engines/pink/objects/pages/pda_page.h
    engines/pink/pda_mgr.cpp
    engines/pink/pda_mgr.h


diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 600eb88..5abc978 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 07e16e7..2a88350 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 e8d4ae9..ac69c38 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 79da57c..76cc058 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 01a4d2d..411649b 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 a81ea73..f234407 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;


Commit: d0adf31467fb2deea9a18f296f32d30cb7b6ed16
    https://github.com/scummvm/scummvm/commit/d0adf31467fb2deea9a18f296f32d30cb7b6ed16
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-30T15:30:36+03:00

Commit Message:
PINK: removed unnecessary function

Changed paths:
    engines/pink/objects/actors/actor.cpp
    engines/pink/objects/actors/actor.h


diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 0c327ae..34af26f 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -79,14 +79,6 @@ 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 47f5bc5..294beb9 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -50,8 +50,6 @@ public:
 	virtual void init(bool paused);
 	bool initPalette(Director *director);
 
-	void preloadSprites();
-
 	void toConsole() override;
 
 	bool isPlaying() { return !_isActionEnded; }


Commit: 516fbe05b3a2aad921222f9c503f16c6f9aab765
    https://github.com/scummvm/scummvm/commit/516fbe05b3a2aad921222f9c503f16c6f9aab765
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-30T15:31:01+03:00

Commit Message:
PINK: fixed DecrementDomain command

Changed paths:
    engines/pink/pda_mgr.cpp


diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index 411649b..fbe6f4a 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -82,7 +82,7 @@ void PDAMgr::execute(const Command &command) {
 		updateWheels(1);
 		break;
 	case Command::kDecrementDomain:
-		_domainIndex = (_domainIndex + 6) % 8;
+		_domainIndex = (_domainIndex + 7) % 8;
 		updateWheels(1);
 		break;
 	case Command::kClose:


Commit: 35a3389cead91fc600dabe518fcee985aa46fd30
    https://github.com/scummvm/scummvm/commit/35a3389cead91fc600dabe518fcee985aa46fd30
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-06-30T15:54:37+03:00

Commit Message:
PINK: fixed ActionPlayWithSfx

Changed paths:
    engines/pink/objects/actions/action_play_with_sfx.cpp
    engines/pink/pda_mgr.cpp


diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index e50c2f8..be3f0ca 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -57,6 +57,7 @@ void ActionPlayWithSfx::update() {
 	} else
 		ActionPlay::update();
 
+	currFrame++;
 	for (uint i = 0; i < _sfxArray.size(); ++i) {
 		if (_sfxArray[i]->getFrame() == currFrame)
 			_sfxArray[i]->play();
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index fbe6f4a..9b856da 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -172,7 +172,6 @@ void PDAMgr::updateWheels(bool playSfx) {
 	Actor *wheel = _page->findActor(kCountryWheel);
 	if (playSfx && wheel->getAction()->getName() != g_countries[_countryIndex]) {
 		wheel->setAction(Common::String(g_countries[_countryIndex]) + kSfx);
-		dynamic_cast<ActionCEL*>(wheel->getAction())->update();
 		dynamic_cast<ActionCEL*>(wheel->getAction())->update(); // hack
 	}
 	wheel->setAction(g_countries[_countryIndex]);
@@ -180,7 +179,6 @@ void PDAMgr::updateWheels(bool playSfx) {
 	wheel = _page->findActor(kDomainWheel);
 	if (playSfx && wheel->getAction()->getName() != g_domains[_domainIndex]) {
 		wheel->setAction(Common::String(g_domains[_domainIndex]) + kSfx);
-		dynamic_cast<ActionCEL*>(wheel->getAction())->update();
 		dynamic_cast<ActionCEL*>(wheel->getAction())->update(); // hack
 	}
 	wheel->setAction(g_domains[_domainIndex]);





More information about the Scummvm-git-logs mailing list