mzm/include/oam.h

77 lines
1.7 KiB
C
Raw Normal View History

2022-01-29 01:22:52 +01:00
#ifndef OAM_H
#define OAM_H
2022-01-28 11:26:42 +01:00
#include "types.h"
2022-07-22 01:04:48 +02:00
// Attribute 0
#define OBJ_ROTATION_SCALING 0x100
#define OBJ_DOUBLE_SIZE 0x200
#define OBJ_DISABLE 0x200
#define OBJ_MODE_SEMI_TRANSPARENT 0x400
#define OBJ_MODE_OBJ_WINDOW 0x800
#define OBJ_MOSAIC 0x1000
#define OBJ_COLOR_256_1 0x2000
#define OBJ_SHAPE_HORIZONTAL 0x4000
#define OBJ_SHAPE_VERTICAL 0x8000
// Attribute 1
#define OBJ_X_FLIP 0x1000
#define OBJ_Y_FLIP 0x2000
#define OBJ_SIZE_16x16 0x4000
#define OBJ_SIZE_32x8 0x4000
#define OBJ_SIZE_8x32 0x4000
#define OBJ_SIZE_32x32 0x8000
#define OBJ_SIZE_32x16 0x8000
#define OBJ_SIZE_16x32 0x8000
#define OBJ_SIZE_64x64 0xC000
#define OBJ_SIZE_64x32 0xC000
#define OBJ_SIZE_32x64 0xC000
// Attribute 2
#define OBJ_SPRITE_OAM 0x8000 // Not sure what this is, sprite OAM doesn't work without it
2022-01-29 01:22:52 +01:00
2022-03-19 11:52:39 +01:00
struct FrameData {
2022-08-06 16:55:58 +02:00
const u16* pFrame;
2022-03-08 17:13:10 +01:00
u8 timer;
2022-01-29 01:22:52 +01:00
};
2022-09-08 18:28:27 +02:00
union OamData {
struct {
/*0x00*/ u32 y:8;
2022-09-14 12:39:29 +02:00
u32 affineMode:2; // 0x1, 0x2 -> 0x4
2022-09-08 18:28:27 +02:00
u32 objMode:2; // 0x4, 0x8 -> 0xC
u32 mosaic:1; // 0x10
u32 bpp:1; // 0x20
u32 shape:2; // 0x40, 0x80 -> 0xC0
2022-09-14 12:39:29 +02:00
/*0x01*/ u32 x:9;
2022-11-15 22:28:24 +01:00
u32 matrixNum:3;
2022-09-08 21:38:44 +02:00
u32 xFlip:1;
u32 yFlip:1;
2022-09-08 18:28:27 +02:00
u32 size:2; // 0x4000, 0x8000 -> 0xC000
2022-09-14 12:39:29 +02:00
/*0x02*/ u16 tileNum:10; // 0x3FF
2022-09-08 18:28:27 +02:00
u16 priority:2; // 0x400, 0x800 -> 0xC00
u16 paletteNum:4;
2022-09-14 12:39:29 +02:00
/*0x03*/ u16 fractional:8;
2022-09-08 18:28:27 +02:00
u16 integer:7;
u16 sign:1;
2022-11-24 17:54:36 +01:00
} split;
2022-09-08 18:28:27 +02:00
struct {
u16 attr0;
u16 attr1;
u16 attr2;
u16 affineParam;
} all;
2022-01-29 01:22:52 +01:00
};
2023-01-31 16:44:13 +01:00
extern u8 gNextOamSlot;
2023-01-29 23:15:41 +01:00
extern union OamData gOamData[160];
#endif /* OAM_H */