mirror of
https://github.com/pret/pokepinballrs.git
synced 2026-03-21 17:24:13 -05:00
Defaults for Packed OAM data & other packed OAM readability. (#200)
* Oam data defaulting & readability * .
This commit is contained in:
parent
e4f20ce73b
commit
fecffc2c90
|
|
@ -1,4 +1,13 @@
|
|||
.macro packed_sprite_oam x, y, affineMode, objMode, mosaic, bpp, shape, matrixNum, hFlip, vFlip, size, tileNum, priority, paletteNum
|
||||
.4byte ( ((\y) & 0xFF) | (((\affineMode) & 0x3) << 8) | (((\objMode) & 0x3) << 10) | (((\mosaic) & 0x1) << 12) | (((\bpp) & 0x1) << 13) | (((\shape) & 0x3) << 14) | (((\x) & 0x1FF) << 16) | (((\matrixNum) & 0x7) << 25) | (((\hFlip) & 0x1) << 28) | (((\vFlip) & 0x1) << 29) | (((\size) & 0x3) << 30) )
|
||||
.macro packed_sprite_oam x, y, affineMode=0x0, objMode=0x0, mosaic=0x0, bpp=0x0, shape=-1, matrixNum=0x0, hFlip=0x0, vFlip=0x0, size=-1, tileNum, priority=0x0, paletteNum, spriteSize=
|
||||
.set __shape, (\shape)
|
||||
.set __size, (\size)
|
||||
|
||||
/* If spriteSize text is provided, derive shape/size from it */
|
||||
.ifnb \spriteSize
|
||||
.set __shape, ((\spriteSize) & 0x3)
|
||||
.set __size, (((\spriteSize) >> 2) & 0x3)
|
||||
.endif
|
||||
|
||||
.4byte ( ((\y) & 0xFF) | (((\affineMode) & 0x3) << 8) | (((\objMode) & 0x3) << 10) | (((\mosaic) & 0x1) << 12) | (((\bpp) & 0x1) << 13) | (((__shape) & 0x3) << 14) | (((\x) & 0x1FF) << 16) | (((\matrixNum) & 0x7) << 25) | (((\hFlip) & 0x1) << 28) | (((\vFlip) & 0x1) << 29) | (((__size) & 0x3) << 30) )
|
||||
.2byte ( ((\tileNum) & 0x3FF) | (((\priority) & 0x3) << 10) | (((\paletteNum) & 0xF) << 12) )
|
||||
.endm
|
||||
|
|
|
|||
10519
data/rom_2.s
10519
data/rom_2.s
File diff suppressed because it is too large
Load Diff
46
include/gba/oam_types.h
Normal file
46
include/gba/oam_types.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef GUARD_OAM_TYPES_H
|
||||
#define GUARD_OAM_TYPES_H
|
||||
|
||||
#define ST_OAM_OBJ_NORMAL 0
|
||||
#define ST_OAM_OBJ_BLEND 1
|
||||
#define ST_OAM_OBJ_WINDOW 2
|
||||
|
||||
#define ST_OAM_AFFINE_OFF 0
|
||||
#define ST_OAM_AFFINE_NORMAL 1
|
||||
#define ST_OAM_AFFINE_ERASE 2
|
||||
#define ST_OAM_AFFINE_DOUBLE 3
|
||||
|
||||
#define ST_OAM_AFFINE_ON_MASK 1
|
||||
#define ST_OAM_AFFINE_DOUBLE_MASK 2
|
||||
|
||||
#define ST_OAM_4BPP 0
|
||||
#define ST_OAM_8BPP 1
|
||||
|
||||
#define ST_OAM_SQUARE 0
|
||||
#define ST_OAM_H_RECTANGLE 1
|
||||
#define ST_OAM_V_RECTANGLE 2
|
||||
|
||||
#define ST_OAM_SIZE_0 0
|
||||
#define ST_OAM_SIZE_1 1
|
||||
#define ST_OAM_SIZE_2 2
|
||||
#define ST_OAM_SIZE_3 3
|
||||
|
||||
#define SPRITE_SIZE_8x8 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_16x16 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_32x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_SQUARE))
|
||||
#define SPRITE_SIZE_64x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_SQUARE))
|
||||
|
||||
#define SPRITE_SIZE_16x8 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x8 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x16 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
#define SPRITE_SIZE_64x32 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_H_RECTANGLE))
|
||||
|
||||
#define SPRITE_SIZE_8x16 ((ST_OAM_SIZE_0 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_8x32 ((ST_OAM_SIZE_1 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_16x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
#define SPRITE_SIZE_32x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_V_RECTANGLE))
|
||||
|
||||
#define SPRITE_SIZE(dim) (SPRITE_SIZE_##dim >> 2)
|
||||
#define SPRITE_SHAPE(dim) (SPRITE_SIZE_##dim & 0xFF)
|
||||
|
||||
#endif // GUARD_OAM_TYPES_H
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
#define GUARD_GBA_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "oam_types.h"
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
|
|
@ -68,25 +69,6 @@ struct OamData
|
|||
/*0x06*/ u16 affineParam;
|
||||
};
|
||||
|
||||
#define ST_OAM_OBJ_NORMAL 0
|
||||
#define ST_OAM_OBJ_BLEND 1
|
||||
#define ST_OAM_OBJ_WINDOW 2
|
||||
|
||||
#define ST_OAM_AFFINE_OFF 0
|
||||
#define ST_OAM_AFFINE_NORMAL 1
|
||||
#define ST_OAM_AFFINE_ERASE 2
|
||||
#define ST_OAM_AFFINE_DOUBLE 3
|
||||
|
||||
#define ST_OAM_AFFINE_ON_MASK 1
|
||||
#define ST_OAM_AFFINE_DOUBLE_MASK 2
|
||||
|
||||
#define ST_OAM_4BPP 0
|
||||
#define ST_OAM_8BPP 1
|
||||
|
||||
#define ST_OAM_SQUARE 0
|
||||
#define ST_OAM_H_RECTANGLE 1
|
||||
#define ST_OAM_V_RECTANGLE 2
|
||||
|
||||
struct BgAffineSrcData
|
||||
{
|
||||
s32 texX;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user