2017-09-18 18:36:05 +02:00
|
|
|
#ifndef GUARD_BG_H
|
|
|
|
#define GUARD_BG_H
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2018-12-26 13:05:02 +01:00
|
|
|
BG_ATTR_CHARBASEINDEX = 1,
|
|
|
|
BG_ATTR_MAPBASEINDEX,
|
|
|
|
BG_ATTR_SCREENSIZE,
|
|
|
|
BG_ATTR_PALETTEMODE,
|
|
|
|
BG_ATTR_MOSAIC,
|
|
|
|
BG_ATTR_WRAPAROUND,
|
|
|
|
BG_ATTR_PRIORITY,
|
|
|
|
BG_ATTR_METRIC,
|
|
|
|
BG_ATTR_TYPE,
|
|
|
|
BG_ATTR_BASETILE,
|
2017-09-18 18:36:05 +02:00
|
|
|
};
|
|
|
|
|
2021-09-24 20:30:15 +02:00
|
|
|
enum {
|
|
|
|
BG_TYPE_NORMAL,
|
|
|
|
BG_TYPE_AFFINE,
|
|
|
|
BG_TYPE_NONE = 0xFFFF
|
|
|
|
};
|
|
|
|
|
2021-11-04 04:02:06 +01:00
|
|
|
// Modes for ChangeBgX / ChangeBgY
|
2021-10-14 18:12:16 +02:00
|
|
|
enum {
|
|
|
|
BG_COORD_SET,
|
|
|
|
BG_COORD_ADD,
|
|
|
|
BG_COORD_SUB,
|
|
|
|
};
|
|
|
|
|
2017-09-18 18:36:05 +02:00
|
|
|
struct BgTemplate
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
u16 bg:2; // 0x1, 0x2 -> 0x3
|
|
|
|
u16 charBaseIndex:2; // 0x4, 0x8 -> 0xC
|
|
|
|
u16 mapBaseIndex:5; // 0x10, 0x20, 0x40, 0x80, 0x100 -> 0x1F0
|
|
|
|
u16 screenSize:2; // 0x200, 0x400 -> 0x600
|
|
|
|
u16 paletteMode:1; // 0x800
|
|
|
|
u16 priority:2; // 0x1000, 0x2000 > 0x3000
|
|
|
|
u16 baseTile:10;
|
2017-09-18 18:36:05 +02:00
|
|
|
};
|
|
|
|
|
2017-09-19 14:27:46 +02:00
|
|
|
void ResetBgs(void);
|
|
|
|
u8 GetBgMode(void);
|
|
|
|
void ResetBgControlStructs(void);
|
|
|
|
void Unused_ResetBgControlStruct(u8 bg);
|
|
|
|
u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode);
|
|
|
|
void SetTextModeAndHideBgs(void);
|
|
|
|
bool8 IsInvalidBg(u8 bg);
|
2021-09-24 20:30:15 +02:00
|
|
|
int BgTileAllocOp(int bg, int offset, int count, int mode);
|
2017-09-18 18:36:05 +02:00
|
|
|
void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable);
|
|
|
|
void InitBgsFromTemplates(u8 bgMode, const struct BgTemplate *templates, u8 numTemplates);
|
2017-09-19 14:27:46 +02:00
|
|
|
void InitBgFromTemplate(const struct BgTemplate *template);
|
|
|
|
void SetBgMode(u8 bgMode);
|
|
|
|
u16 LoadBgTiles(u8 bg, const void* src, u16 size, u16 destOffset);
|
|
|
|
u16 LoadBgTilemap(u8 bg, const void *src, u16 size, u16 destOffset);
|
|
|
|
u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset);
|
|
|
|
bool8 IsDma3ManagerBusyWithBgCopy(void);
|
|
|
|
void ShowBg(u8 bg);
|
|
|
|
void HideBg(u8 bg);
|
2017-09-18 18:36:05 +02:00
|
|
|
void SetBgAttribute(u8 bg, u8 attributeId, u8 value);
|
|
|
|
u16 GetBgAttribute(u8 bg, u8 attributeId);
|
2018-12-17 23:00:08 +01:00
|
|
|
s32 ChangeBgX(u8 bg, s32 value, u8 op);
|
|
|
|
s32 GetBgX(u8 bg);
|
|
|
|
s32 ChangeBgY(u8 bg, s32 value, u8 op);
|
2021-05-27 14:32:09 +02:00
|
|
|
s32 ChangeBgY_ScreenOff(u8 bg, s32 value, u8 op);
|
2018-12-17 23:00:08 +01:00
|
|
|
s32 GetBgY(u8 bg);
|
2019-01-25 23:32:45 +01:00
|
|
|
void SetBgAffine(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle);
|
2017-09-19 14:27:46 +02:00
|
|
|
u8 Unused_AdjustBgMosaic(u8 a1, u8 a2);
|
2017-09-18 18:36:05 +02:00
|
|
|
void SetBgTilemapBuffer(u8 bg, void *tilemap);
|
|
|
|
void UnsetBgTilemapBuffer(u8 bg);
|
2017-09-19 14:27:46 +02:00
|
|
|
void* GetBgTilemapBuffer(u8 bg);
|
2017-09-18 18:36:05 +02:00
|
|
|
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset);
|
|
|
|
void CopyBgTilemapBufferToVram(u8 bg);
|
2018-05-01 15:33:13 +02:00
|
|
|
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height);
|
2018-08-25 19:59:47 +02:00
|
|
|
void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette);
|
2021-10-29 17:51:47 +02:00
|
|
|
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, s16 tileOffset, s16 palette2);
|
2017-09-19 14:27:46 +02:00
|
|
|
void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height);
|
|
|
|
void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette);
|
|
|
|
void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, s16 tileNumDelta);
|
|
|
|
u16 GetBgMetricTextMode(u8 bg, u8 whichMetric);
|
|
|
|
u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric);
|
|
|
|
u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32 screenHeight);
|
2018-11-25 20:16:41 +01:00
|
|
|
void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2);
|
2017-09-19 14:27:46 +02:00
|
|
|
bool32 IsInvalidBg32(u8 bg);
|
|
|
|
bool32 IsTileMapOutsideWram(u8 bg);
|
2017-09-18 18:36:05 +02:00
|
|
|
|
|
|
|
#endif // GUARD_BG_H
|