diff options
author | whiterandrek | 2018-06-09 15:57:45 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | fb8d8c1f570b9e6da55cf21eb6d176335a65f25c (patch) | |
tree | 6109f31f5555de94bd600caf3b0559aaa0de5c29 | |
parent | bfd1b62063040c970894fbf81d9dca9c3d4088d0 (diff) | |
download | scummvm-rg350-fb8d8c1f570b9e6da55cf21eb6d176335a65f25c.tar.gz scummvm-rg350-fb8d8c1f570b9e6da55cf21eb6d176335a65f25c.tar.bz2 scummvm-rg350-fb8d8c1f570b9e6da55cf21eb6d176335a65f25c.zip |
PINK: remove redundant adding sprite to scene, which doesn't need to be drawn
-rw-r--r-- | engines/pink/objects/actions/action.cpp | 4 | ||||
-rw-r--r-- | engines/pink/objects/actions/action.h | 2 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_cel.cpp | 12 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_cel.h | 2 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_mgr.cpp | 17 | ||||
-rw-r--r-- | engines/pink/objects/walk/walk_mgr.h | 12 |
6 files changed, 30 insertions, 19 deletions
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp index 34106f7ee6..107cff5eeb 100644 --- a/engines/pink/objects/actions/action.cpp +++ b/engines/pink/objects/actions/action.cpp @@ -37,6 +37,10 @@ bool Action::initPalette(Director *director) { void Action::pause(bool paused) {} +Coordinates Action::getCoordinates() { + return Coordinates(); +} + Actor *Action::getActor() const { return _actor; } diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h index 40287026fa..a6e36dbf20 100644 --- a/engines/pink/objects/actions/action.h +++ b/engines/pink/objects/actions/action.h @@ -24,6 +24,7 @@ #define PINK_ACTION_H #include "pink/objects/object.h" +#include "pink/objects/walk/walk_mgr.h" namespace Pink { @@ -41,6 +42,7 @@ public: virtual void pause(bool paused); + virtual Coordinates getCoordinates(); Actor *getActor() const; protected: diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp index a5f0e1f610..4596d5d1b5 100644 --- a/engines/pink/objects/actions/action_cel.cpp +++ b/engines/pink/objects/actions/action_cel.cpp @@ -88,4 +88,16 @@ CelDecoder *ActionCEL::getDecoder() { return _decoder; } +Coordinates ActionCEL::getCoordinates() { + if (!_decoder) + _decoder = _actor->getPage()->loadCel(_fileName); + + Coordinates coords; + coords.x = _decoder->getX() + _decoder->getWidth() / 2; + coords.y = _decoder->getY() + _decoder->getHeight() / 2; + coords.z = getZ(); + + return coords; +} + } // End of namespace Pink diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h index 2623c55c16..355323da45 100644 --- a/engines/pink/objects/actions/action_cel.h +++ b/engines/pink/objects/actions/action_cel.h @@ -45,6 +45,8 @@ public: void pause(bool paused) override; + Coordinates getCoordinates() override; + uint32 getZ(); CelDecoder *getDecoder(); diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp index e1c787d66c..c7c06ec474 100644 --- a/engines/pink/objects/walk/walk_mgr.cpp +++ b/engines/pink/objects/walk/walk_mgr.cpp @@ -102,20 +102,9 @@ double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *sec (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y)); } -WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) { - Coordinates coords; - ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName)); - - action->start(); - CelDecoder *decoder = action->getDecoder(); - - coords.x = decoder->getX() + decoder->getWidth() / 2; - coords.y = decoder->getY() + decoder->getHeight() / 2; - coords.z = action->getZ(); - - action->end(); - - return coords; +Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) { + Action *action = _leadActor->findAction(locationName); + return action->getCoordinates(); } void WalkMgr::setCurrentWayPoint(WalkLocation *location) { diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h index 2decdd861c..cb6b68c31c 100644 --- a/engines/pink/objects/walk/walk_mgr.h +++ b/engines/pink/objects/walk/walk_mgr.h @@ -25,6 +25,7 @@ #include "pink/objects/object.h" #include "pink/objects/walk/walk_shortest_path.h" +#include "pink/utils.h" namespace Pink { @@ -32,6 +33,12 @@ class WalkLocation; class LeadActor; class WalkAction; +struct Coordinates { + int x; + int y; + int z; +}; + class WalkMgr : public Object { public: WalkMgr(); @@ -49,11 +56,6 @@ public: void saveState(Archive &archive); private: - struct Coordinates { - int x; - int y; - int z; - }; struct WayPoint { Common::String name; Coordinates coord; |