mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-03 00:39:23 +00:00
Keep track of allocated sprite count
This commit is contained in:
+3
-1
@@ -16,7 +16,7 @@ private:
|
||||
bool _visibility;
|
||||
u16 *_gfx;
|
||||
|
||||
static bool _assigned[2][128];
|
||||
static u8 _assigned[2][128];
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
*/
|
||||
Sprite(bool top, SpriteSize size, SpriteColorFormat format, int x = 0, int y = 0, int priority = 0, int id = -1, int paletteAlpha = 15, int rotationIndex = -1, bool doubleSize = false, bool visible = true, bool vFlip = false, bool hFlip = false, bool mosaic = false);
|
||||
|
||||
Sprite(const Sprite &sprite);
|
||||
|
||||
~Sprite(void);
|
||||
|
||||
u16* gfx(void) const { return _gfx; }
|
||||
|
||||
+13
-4
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "tonccpy.h"
|
||||
|
||||
bool Sprite::_assigned[2][128] = {{false}, {false}};
|
||||
u8 Sprite::_assigned[2][128] = {{false}, {false}};
|
||||
|
||||
Sprite::Sprite(bool top, SpriteSize size, SpriteColorFormat format, int x, int y, int priority, int id,
|
||||
int paletteAlpha, int rotationIndex, bool doubleSize, bool visible, bool vFlip, bool hFlip, bool mosaic)
|
||||
@@ -44,7 +44,7 @@ Sprite::Sprite(bool top, SpriteSize size, SpriteColorFormat format, int x, int y
|
||||
}
|
||||
}
|
||||
|
||||
_assigned[top][_id] = true;
|
||||
_assigned[top][_id]++;
|
||||
|
||||
// Get the sprite width and height from the SpriteSize
|
||||
if(((_size >> 12) & 3) == OBJSHAPE_SQUARE) {
|
||||
@@ -98,9 +98,18 @@ Sprite::Sprite(bool top, SpriteSize size, SpriteColorFormat format, int x, int y
|
||||
vFlip, hFlip, mosaic);
|
||||
}
|
||||
|
||||
Sprite::Sprite(const Sprite &sprite) : _top(sprite._top), _oam(sprite._oam), _size(sprite._size), _format(sprite._format), _x(sprite._x), _y(sprite._y), _priority(sprite._priority),
|
||||
_id(sprite._id), _rotationIndex(sprite._rotationIndex), _paletteAlpha(sprite._paletteAlpha), _visibility(sprite._visibility) {
|
||||
_assigned[_top][_id]++;
|
||||
}
|
||||
|
||||
Sprite::~Sprite(void) {
|
||||
oamFreeGfx(_oam, _gfx);
|
||||
_assigned[_top][_id] = false;
|
||||
_assigned[_top][_id]--;
|
||||
if(!_assigned[_top][_id]) {
|
||||
oamFreeGfx(_oam, _gfx);
|
||||
oamClearSprite(_oam, _id);
|
||||
oamUpdate(_oam);
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite::rotation(int rotation) {
|
||||
|
||||
Reference in New Issue
Block a user