mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
PINK: remove redundant adding sprite to scene, which doesn't need to be drawn
This commit is contained in:
parent
bfd1b62063
commit
fb8d8c1f57
@ -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;
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
|
||||
void pause(bool paused) override;
|
||||
|
||||
Coordinates getCoordinates() override;
|
||||
|
||||
uint32 getZ();
|
||||
CelDecoder *getDecoder();
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user