[Scummvm-git-logs] scummvm master -> b90816e8119e12c8823d7c6a1333d1eeb57f06fd

whiterandrek whiterandrek at gmail.com
Tue Jul 17 19:04:36 CEST 2018


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

Summary:
b90816e811 PINK: fixed position of some sprites in PDA


Commit: b90816e8119e12c8823d7c6a1333d1eeb57f06fd
    https://github.com/scummvm/scummvm/commit/b90816e8119e12c8823d7c6a1333d1eeb57f06fd
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2018-07-17T20:04:28+03:00

Commit Message:
PINK: fixed position of some sprites in PDA

Changed paths:
    engines/pink/objects/actions/action_cel.cpp
    engines/pink/objects/actions/action_cel.h
    engines/pink/objects/actors/pda_button_actor.cpp
    engines/pink/objects/actors/pda_button_actor.h


diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 383f4ac..8737c38 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -55,10 +55,6 @@ bool ActionCEL::initPalette(Director *director) {
 
 void ActionCEL::start() {
 	loadDecoder();
-
-	Common::Point point = _decoder.getCenter();
-	_bounds = Common::Rect::center(point.x, point.y, _decoder.getWidth(), _decoder.getHeight());
-
 	_decoder.start();
 	this->onStart();
 	_actor->getPage()->getGame()->getDirector()->addSprite(this);
@@ -84,8 +80,11 @@ Coordinates ActionCEL::getCoordinates() {
 }
 
 void ActionCEL::loadDecoder() {
-	if (!_decoder.isVideoLoaded())
+	if (!_decoder.isVideoLoaded()) {
 		_decoder.loadStream(_actor->getPage()->getResourceStream(_fileName));
+		Common::Point point = _decoder.getCenter();
+		_bounds = Common::Rect::center(point.x, point.y, _decoder.getWidth(), _decoder.getHeight());
+	}
 }
 
 void ActionCEL::setFrame(uint frame) {
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 729ad69..b2e4ef2 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -54,14 +54,15 @@ public:
 
 	void setCenter(const Common::Point &center);
 
+
+	void loadDecoder();
+
 protected:
 	virtual void onStart() = 0;
 
 	void decodeNext();
 	void setFrame(uint frame);
 
-	void loadDecoder();
-
 	CelDecoder _decoder;
 	Common::String _fileName;
 	Common::Rect _bounds;
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 10dd563..f919702 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -25,7 +25,7 @@
 #include "pink/pink.h"
 #include "pink/objects/pages/page.h"
 #include "pink/objects/actors/pda_button_actor.h"
-#include "pink/objects/actions/action.h"
+#include "pink/objects/actions/action_cel.h"
 
 namespace Pink {
 
@@ -78,4 +78,19 @@ bool PDAButtonActor::isActive() {
 	return _action && _action->getName() != "Inactive";
 }
 
+void PDAButtonActor::init(bool paused) {
+	if (_x != -1 && _y != -1) {
+		for (uint i = 0; i < _actions.size(); ++i) {
+			ActionCEL *action = dynamic_cast<ActionCEL*>(_actions[i]);
+			assert(action);
+			action->loadDecoder();
+			Common::Point center;
+			center.x = _x + action->getDecoder()->getWidth() / 2;
+			center.y = _y + action->getDecoder()->getHeight() / 2;
+			action->setCenter(center);
+		}
+	}
+	Actor::init(paused);
+}
+
 } // End of namespace Pink
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index d2c8b24..dce9007 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -54,6 +54,8 @@ public:
 
 	void toConsole() override;
 
+	void init(bool paused) override;
+
 	void onMouseOver(const Common::Point point, CursorMgr *mgr) override;
 
 	void onLeftClickMessage() override;





More information about the Scummvm-git-logs mailing list