summaryrefslogtreecommitdiff
path: root/include/sprite.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sprite.h')
-rw-r--r--include/sprite.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/include/sprite.h b/include/sprite.h
index 5fa85ee21..27e5dc852 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -4,28 +4,30 @@
#include "global.h"
#define MAX_SPRITES 64
+#define SPRITE_INVALID_TAG 0xFFFF
struct SpriteSheet
{
- const u8 *data; // Raw uncompressed pixel data
+ const void *data; // Raw uncompressed pixel data
u16 size;
u16 tag;
};
struct CompressedSpriteSheet
{
- const u8 *data; // LZ77 compressed pixel data
+ const u32 *data; // LZ77 compressed pixel data
u16 size; // Uncompressed size of pixel data
u16 tag;
};
struct SpriteFrameImage
{
- const u8 *data;
+ const void *data;
u16 size;
};
#define obj_frame_tiles(ptr) {.data = (u8 *)ptr, .size = sizeof ptr}
+#define overworld_frame(ptr, width, height, frame) {.data = (u8 *)ptr + (width * height * frame * 64)/2, .size = (width * height * 64)/2}
struct SpritePalette
{
@@ -35,7 +37,7 @@ struct SpritePalette
struct CompressedSpritePalette
{
- const u8 *data; // LZ77 compressed palette data
+ const u32 *data; // LZ77 compressed palette data
u16 tag;
};
@@ -102,6 +104,12 @@ struct AffineAnimJumpCmd
u16 target;
};
+struct AffineAnimEndCmdAlt
+{
+ s16 type;
+ u16 val;
+};
+
union AffineAnimCmd
{
s16 type;
@@ -126,6 +134,8 @@ union AffineAnimCmd
{.loop = {.type = AFFINEANIMCMDTYPE_LOOP, .count = _count}}
#define AFFINEANIMCMD_JUMP(_target) \
{.jump = {.type = AFFINEANIMCMDTYPE_JUMP, .target = _target}}
+#define AFFINEANIMCMD_END_ALT(_val) \
+ {.end = {.type = AFFINEANIMCMDTYPE_END, .val = _val}}
struct AffineAnimState
{
@@ -163,6 +173,8 @@ struct SubspriteTable
struct Sprite;
+typedef void (*SpriteCallback)(struct Sprite *);
+
struct SpriteTemplate
{
u16 tileTag;
@@ -171,7 +183,7 @@ struct SpriteTemplate
const union AnimCmd *const *anims;
const struct SpriteFrameImage *images;
const union AffineAnimCmd *const *affineAnims;
- void (*callback)(struct Sprite *);
+ SpriteCallback callback;
};
struct Sprite
@@ -182,7 +194,7 @@ struct Sprite
/*0x10*/ const union AffineAnimCmd *const *affineAnims;
/*0x14*/ const struct SpriteTemplate *template;
/*0x18*/ const struct SubspriteTable *subspriteTables;
- /*0x1C*/ void (*callback)(struct Sprite *);
+ /*0x1C*/ SpriteCallback callback;
/*0x20*/ struct Coords16 pos1;
/*0x24*/ struct Coords16 pos2;
@@ -232,14 +244,12 @@ struct OamMatrix
s16 d;
};
-typedef void (*SpriteCallback)(struct Sprite *);
-
extern const struct OamData gDummyOamData;
extern const union AnimCmd *const gDummySpriteAnimTable[];
extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[];
extern s16 gSpriteCoordOffsetX;
extern s16 gSpriteCoordOffsetY;
-
+extern const struct SpriteTemplate gDummySpriteTemplate;
extern struct Sprite gSprites[];
void ResetSpriteData(void);