Skip to content

Commit

Permalink
update palette offset enum
Browse files Browse the repository at this point in the history
  • Loading branch information
red031000 committed Dec 15, 2023
1 parent e18f0bc commit 01d1300
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion arm9/overlays/19/src/overlay_19.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void ov19_02252440(struct BgConfig * bgConfig)
InitBgFromTemplate(bgConfig, GF_BG_LYR_SUB_0, &ov19_02252508, GF_BG_TYPE_TEXT);
GfGfxLoader_LoadCharData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0010_NCGR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0, TRUE, HEAP_ID_8);
GfGfxLoader_LoadScrnData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0011_NSCR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0, TRUE, HEAP_ID_8);
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0012_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_OFFSET_0, 0x20, HEAP_ID_8);
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0012_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_0_OFFSET, 0x20, HEAP_ID_8);
GXS_SetVisibleWnd(GX_WNDMASK_NONE);
GXS_SetVisiblePlane(GX_PLANEMASK_BG0);
}
Expand Down
22 changes: 11 additions & 11 deletions arm9/overlays/59/src/ov59_Intro.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ void ov59_IntroSetupBg(ov59_IntroOverlayData *data)

sub_0200CD68(data->bgConfig, 0, 994, 4, 0, data->heapId);
LoadUserFrameGfx1(data->bgConfig, GF_BG_LYR_MAIN_0, 985, 3, 0, data->heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_5, data->heapId);
LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_6, data->heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_5_OFFSET, data->heapId);
LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_6_OFFSET, data->heapId);

struct BgTemplate bgTemplateSub = ov59_021D9EBC;
bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7800;
Expand Down Expand Up @@ -1026,8 +1026,8 @@ void ov59_LoadInitialTilemap(ov59_IntroOverlayData *data)
mainPal = NARC_intro_main_background_pearl_NCLR;
subPal = NARC_intro_sub_background_pearl_NCLR;
}
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, mainPal, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_0, 0x60, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, subPal, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_OFFSET_0, 0xa0, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, mainPal, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_0_OFFSET, 0x60, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, subPal, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_0_OFFSET, 0xa0, data->heapId);
ov59_LoadMainScrnData(data);
ov59_LoadCharDataFromIndex(data);
ov59_LoadSubScrnData(data);
Expand All @@ -1051,14 +1051,14 @@ void ov59_LoadCharDataFromIndex(ov59_IntroOverlayData *data)
if (data->spriteDataIndex0 != 0 && data->spriteDataIndex0 < 12)
{
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex0].charNum, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0, FALSE, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex0].palNum, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_7, 0x20, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex0].palNum, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_7_OFFSET, 0x20, data->heapId);
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO, NARC_intro_character_screen_NSCR, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0, FALSE, data->heapId);
ov59_TilemapChangePalette(data, GF_BG_LYR_MAIN_1, 7);
}
if (data->spriteDataIndex1 != 0 && data->spriteDataIndex1 < 12)
{
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex1].charNum, data->bgConfig, GF_BG_LYR_MAIN_2, 0, 0, FALSE, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex1].palNum, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_8, 0x20, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex1].palNum, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_8_OFFSET, 0x20, data->heapId);
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO, NARC_intro_character_screen_NSCR, data->bgConfig, GF_BG_LYR_MAIN_2, 0, 0, FALSE, data->heapId);
ov59_TilemapChangePalette(data, GF_BG_LYR_MAIN_2, 8);
}
Expand Down Expand Up @@ -1100,16 +1100,16 @@ void ov59_DrawMunchlax(ov59_IntroOverlayData *data)
ov59_TilemapChangePalette(data, GF_BG_LYR_MAIN_2, 9);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_2, 32, 0, data->heapId);
BG_LoadCharTilesData(data->bgConfig, GF_BG_LYR_MAIN_2, charData, 0xc80, 1);
BG_LoadPlttData(GF_BG_LYR_MAIN_2, plttData, 32, GF_PAL_SLOT_OFFSET_8); //r2 and r3 regswap
BG_LoadPlttData(GF_BG_LYR_MAIN_2, ov59_021D9ED8, 32, GF_PAL_SLOT_OFFSET_9);
BG_LoadPlttData(GF_BG_LYR_MAIN_2, plttData, 32, GF_PAL_SLOT_8_OFFSET); //r2 and r3 regswap
BG_LoadPlttData(GF_BG_LYR_MAIN_2, ov59_021D9ED8, 32, GF_PAL_SLOT_9_OFFSET);

FillBgTilemapRect(data->bgConfig, GF_BG_LYR_SUB_1, 0, 0, 0, 32, 24, 10);
LoadRectToBgTilemapRect(data->bgConfig, GF_BG_LYR_SUB_1, src, 11, 7, 10, 10);
ov59_TilemapChangePalette(data, GF_BG_LYR_SUB_1, 10);
BG_ClearCharDataRange(GF_BG_LYR_SUB_1, 32, 0, data->heapId);
BG_LoadCharTilesData(data->bgConfig, GF_BG_LYR_SUB_1, charData, 0xc80, 1);
BG_LoadPlttData(GF_BG_LYR_SUB_1, plttData, 32, GF_PAL_SLOT_OFFSET_10);
BG_LoadPlttData(GF_BG_LYR_SUB_1, ov59_021D9ED8, 32, GF_PAL_SLOT_OFFSET_10);
BG_LoadPlttData(GF_BG_LYR_SUB_1, plttData, 32, GF_PAL_SLOT_10_OFFSET);
BG_LoadPlttData(GF_BG_LYR_SUB_1, ov59_021D9ED8, 32, GF_PAL_SLOT_10_OFFSET);
FreeToHeap(plttData);
FreeToHeap(charData);
FreeToHeap(src);
Expand Down Expand Up @@ -1271,7 +1271,7 @@ void ov59_LoadPokeballButton(ov59_IntroOverlayData *data)
{
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0038_NSCR, data->bgConfig, GF_BG_LYR_SUB_2, 0, 0, FALSE, data->heapId);
ov59_TilemapChangePalette(data, GF_BG_LYR_SUB_2, 9);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0039_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_OFFSET_7, 0x60, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0039_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_7_OFFSET, 0x60, data->heapId);
BG_ClearCharDataRange(GF_BG_LYR_SUB_2, 0x20, 0, data->heapId);
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, NARC_intro_pokeball_button_1_NCGR, data->bgConfig, GF_BG_LYR_SUB_2, 0x20, 0, FALSE, data->heapId);
}
Expand Down
4 changes: 2 additions & 2 deletions arm9/overlays/59/src/ov59_TV.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ void ov59_TVSetupGraphics(ov59_TVOverlayData *data)
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0000_NCGR, data->bgConfig, GF_BG_LYR_MAIN_3, 0, 0, FALSE, data->heapId);
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0003_NSCR, data->bgConfig, GF_BG_LYR_MAIN_3, 0, 0, FALSE, data->heapId);

GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0006_NCLR, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_0, 0, data->heapId);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0006_NCLR, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_0_OFFSET, 0, data->heapId);

LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, data->heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, data->heapId);

BG_SetMaskColor(GF_BG_LYR_MAIN_0, 0);
BG_SetMaskColor(GF_BG_LYR_SUB_0, 0);
Expand Down
2 changes: 1 addition & 1 deletion arm9/src/bg_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ void BG_LoadPlttData(u32 location, void *plttData, u32 size, enum GFPalSlotOffse
}

void BG_SetMaskColor(u8 bgId, u16 value) {
BG_LoadPlttData(bgId, &value, sizeof(u16), GF_PAL_SLOT_OFFSET_0);
BG_LoadPlttData(bgId, &value, sizeof(u16), GF_PAL_SLOT_0_OFFSET);
}

static u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 size) {
Expand Down
2 changes: 1 addition & 1 deletion arm9/src/blackout_src.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void Blackout_InitDisplays(BgConfig *bgConfig) {
GfGfx_SetBanks(&Blackout_GraphicsBanks);
SetBothScreensModesAndDisable(&Blackout_GraphicsModes);
InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_3, &Blackout_BgTemplate, GF_BG_TYPE_TEXT);
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_FONT, NARC_font_narc_0006_NCLR, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_13, 0x20, HEAP_ID_FIELD);
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_FONT, NARC_font_narc_0006_NCLR, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_13_OFFSET, 0x20, HEAP_ID_FIELD);
}

/*static*/ void Blackout_DrawMessage(FieldSystem *fieldSystem, TaskManager *taskManager) {
Expand Down
2 changes: 1 addition & 1 deletion arm9/src/communication_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void ShowCommunicationError(HeapID heapId, u32 error, u32 errorCode) {
InitBgFromTemplate(bgConfig, 0, &sCommunicationErrorBgTemplate, GX_BGMODE_0);
BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_0);
LoadUserFrameGfx1(bgConfig, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, heapId);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heapId);
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
Expand Down
2 changes: 1 addition & 1 deletion arm9/src/error_message_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void PrintErrorMessageAndReset()

LoadUserFrameGfx1(ptr, GF_BG_LYR_MAIN_0, 503, 2, 0, HEAP_ID_DEFAULT);

LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, HEAP_ID_DEFAULT);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, HEAP_ID_DEFAULT);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_DEFAULT);
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
Expand Down
4 changes: 2 additions & 2 deletions arm9/src/save_data_read_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void ShowSaveDataReadError(HeapID heapId)
InitBgFromTemplate(bg_config, 0, &sSaveDataReadErrorBgTemplate, 0);
BgClearTilemapBufferAndCommit(bg_config, GF_BG_LYR_MAIN_0);
LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, heapId);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heapId);
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
Expand Down Expand Up @@ -156,7 +156,7 @@ void ShowGBACartRemovedError(HeapID heapId)
InitBgFromTemplate(bg_config, 0, &sSaveDataReadErrorBgTemplate, 0);
BgClearTilemapBufferAndCommit(bg_config, GF_BG_LYR_MAIN_0);
LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, heapId);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heapId);
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
Expand Down
2 changes: 1 addition & 1 deletion arm9/src/save_data_write_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void ShowSaveDataWriteError(HeapID heapId, u32 err_no)
InitBgFromTemplate(bg_config, 0, &sSaveDataWriteErrorBgTemplate, 0);
BgClearTilemapBufferAndCommit(bg_config, GF_BG_LYR_MAIN_0);
LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, heapId);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heapId);
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
Expand Down
4 changes: 2 additions & 2 deletions arm9/src/text_02054590.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ void sub_02054590(enum GFPalLoadLocation location, u32 param1)
{
ResetAllTextPrinters();
}
LoadFontPal0(location, GF_PAL_SLOT_OFFSET_13, HEAP_ID_4);
LoadFontPal1(location, GF_PAL_SLOT_OFFSET_12, HEAP_ID_4);
LoadFontPal0(location, GF_PAL_SLOT_13_OFFSET, HEAP_ID_4);
LoadFontPal1(location, GF_PAL_SLOT_12_OFFSET, HEAP_ID_4);
}

void sub_020545B8(struct BgConfig *param0, struct Window *param1, u32 param2)
Expand Down
2 changes: 1 addition & 1 deletion arm9/src/wfc_user_info_warning.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ShowWFCUserInfoWarning(HeapID heapId, u32 a1)
InitBgFromTemplate(bg_config, 0, &sWFCWarningMsgBgTemplate, 0);
BgClearTilemapBufferAndCommit(bg_config, GF_BG_LYR_MAIN_0);
LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, heapId);
LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_1_OFFSET, heapId);
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heapId);
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
Expand Down
32 changes: 16 additions & 16 deletions include/bg_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ enum GFPalLoadLocation {
};

enum GFPalSlotOffset {
GF_PAL_SLOT_OFFSET_0 = 0x00,
GF_PAL_SLOT_OFFSET_1 = 0x20,
GF_PAL_SLOT_OFFSET_2 = 0x40,
GF_PAL_SLOT_OFFSET_3 = 0x60,
GF_PAL_SLOT_OFFSET_4 = 0x80,
GF_PAL_SLOT_OFFSET_5 = 0xA0,
GF_PAL_SLOT_OFFSET_6 = 0xC0,
GF_PAL_SLOT_OFFSET_7 = 0xE0,
GF_PAL_SLOT_OFFSET_8 = 0x100,
GF_PAL_SLOT_OFFSET_9 = 0x120,
GF_PAL_SLOT_OFFSET_10 = 0x140,
GF_PAL_SLOT_OFFSET_11 = 0x160,
GF_PAL_SLOT_OFFSET_12 = 0x180,
GF_PAL_SLOT_OFFSET_13 = 0x1A0,
GF_PAL_SLOT_OFFSET_14 = 0X1C0,
GF_PAL_SLOT_OFFSET_15 = 0X1E0
GF_PAL_SLOT_0_OFFSET = 0x00,
GF_PAL_SLOT_1_OFFSET = 0x20,
GF_PAL_SLOT_2_OFFSET = 0x40,
GF_PAL_SLOT_3_OFFSET = 0x60,
GF_PAL_SLOT_4_OFFSET = 0x80,
GF_PAL_SLOT_5_OFFSET = 0xA0,
GF_PAL_SLOT_6_OFFSET = 0xC0,
GF_PAL_SLOT_7_OFFSET = 0xE0,
GF_PAL_SLOT_8_OFFSET = 0x100,
GF_PAL_SLOT_9_OFFSET = 0x120,
GF_PAL_SLOT_10_OFFSET = 0x140,
GF_PAL_SLOT_11_OFFSET = 0x160,
GF_PAL_SLOT_12_OFFSET = 0x180,
GF_PAL_SLOT_13_OFFSET = 0x1A0,
GF_PAL_SLOT_14_OFFSET = 0X1C0,
GF_PAL_SLOT_15_OFFSET = 0X1E0
};

enum GFBgType {
Expand Down

0 comments on commit 01d1300

Please sign in to comment.