diff options
Diffstat (limited to 'engines/saga/sprite.h')
-rw-r--r-- | engines/saga/sprite.h | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/engines/saga/sprite.h b/engines/saga/sprite.h index b7365fd28f..f429d1f4e8 100644 --- a/engines/saga/sprite.h +++ b/engines/saga/sprite.h @@ -36,31 +36,28 @@ namespace Saga { #define DECODE_BUF_LEN 64000 struct SpriteInfo { - byte *decodedBuffer; + Common::Array<byte> decodedBuffer; int width; int height; int xAlign; int yAlign; -}; - -struct SpriteList { - int spriteListResourceId; - int spriteCount; - SpriteInfo *infoList; - void freeMem() { - for (int i = 0; i < spriteCount; i++) { - free(infoList[i].decodedBuffer); + byte * getBuffer() { + if (decodedBuffer.empty()) { + return NULL; + } else { + return &decodedBuffer.front(); } - free(infoList); - memset(this, 0, sizeof(*this)); } - SpriteList() { - memset(this, 0, sizeof(*this)); + SpriteInfo() : width(0), height(0), xAlign(0), yAlign(0) { } }; +class SpriteList : public Common::Array<SpriteInfo> { +// int spriteListResourceId; +}; + class Sprite { public: @@ -73,19 +70,19 @@ public: ~Sprite(); // draw scaled sprite using background scene mask - void drawOccluded(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth); + void drawOccluded(SpriteList &spriteList, uint spriteNumber, const Point &screenCoord, int scale, int depth); // draw scaled sprite using background scene mask - void draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale, bool clipToScene = false); + void draw(SpriteList &spriteList, uint spriteNumber, const Point &screenCoord, int scale, bool clipToScene = false); // main function void drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer, bool clipToScene = false); - void draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale, bool clipToScene = false); + void draw(SpriteList &spriteList, uint spriteNumber, const Rect &screenRect, int scale, bool clipToScene = false); void loadList(int resourceId, SpriteList &spriteList); // load or append spriteList - bool hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint); - void getScaledSpriteBuffer(SpriteList &spriteList, int spriteNumber, int scale, int &width, int &height, int &xAlign, int &yAlign, const byte *&buffer); + bool hitTest(SpriteList &spriteList, uint spriteNumber, const Point &screenCoord, int scale, const Point &testPoint); + void getScaledSpriteBuffer(SpriteList &spriteList, uint spriteNumber, int scale, int &width, int &height, int &xAlign, int &yAlign, const byte *&buffer); private: void decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t outLength); |