Skip to content

Commit

Permalink
Match graphics declarations with externs
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyEggg committed Jan 10, 2025
1 parent 1c765d1 commit db99b86
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 66 deletions.
88 changes: 44 additions & 44 deletions include/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define GUARD_GRAPHICS_H

// overworld
extern const u32 gMessageBox_Gfx[];
extern const u8 gMessageBox_Gfx[];
extern const u16 gMessageBox_Pal[];

// pokeballs
Expand Down Expand Up @@ -3286,17 +3286,17 @@ extern const u32 gBattleTerrainPalette_StadiumWallace[];
extern const u32 gPokedexInterface_Gfx[];
extern const u16 gPokedexBgHoenn_Pal[];
extern const u32 gPokedexMenu_Gfx[];
extern const u8 gPokedexList_Tilemap[];
extern const u8 gPokedexListUnderlay_Tilemap[];
extern const u8 gPokedexStartMenuMain_Tilemap[];
extern const u8 gPokedexStartMenuSearchResults_Tilemap[];
extern const u32 gPokedexList_Tilemap[];
extern const u32 gPokedexListUnderlay_Tilemap[];
extern const u32 gPokedexStartMenuMain_Tilemap[];
extern const u32 gPokedexStartMenuSearchResults_Tilemap[];
extern const u16 gPokedexSearchResults_Pal[];
extern const u16 gPokedexBgNational_Pal[];
extern const u8 gPokedexInfoScreen_Tilemap[];
extern const u8 gPokedexCryScreen_Tilemap[];
extern const u8 gPokedexSizeScreen_Tilemap[];
extern const u8 gPokedexScreenSelectBarMain_Tilemap[];
extern const u8 gPokedexScreenSelectBarSubmenu_Tilemap[];
extern const u32 gPokedexInfoScreen_Tilemap[];
extern const u32 gPokedexCryScreen_Tilemap[];
extern const u32 gPokedexSizeScreen_Tilemap[];
extern const u32 gPokedexScreenSelectBarMain_Tilemap[];
extern const u32 gPokedexScreenSelectBarSubmenu_Tilemap[];
extern const u16 gPokedexCaughtScreen_Pal[];
extern const u32 gPokedexSearchMenu_Gfx[];
extern const u32 gPokedexSearchMenuHoenn_Tilemap[];
Expand Down Expand Up @@ -3893,7 +3893,7 @@ extern const u32 gIntroGroudon_Gfx[];
extern const u32 gIntroGroudon_Tilemap[];
extern const u32 gIntroLegendBg_Gfx[];
extern const u32 gIntroGroudonBg_Tilemap[];
extern const u8 ALIGNED(2) gIntro3Bg_Pal[0x200];
extern const u16 gIntro3Bg_Pal[16][16];
extern const u32 gIntroKyogre_Gfx[];
extern const u32 gIntroKyogre_Tilemap[];
extern const u32 gIntroKyogreBg_Tilemap[];
Expand Down Expand Up @@ -4066,9 +4066,9 @@ extern const u8 gHealthboxElementsGfxTable[][32];
extern const u16 gNamingScreenMenu_Pal[6][16];
extern const u32 gNamingScreenMenu_Gfx[];
extern const u32 gNamingScreenBackground_Tilemap[];
extern const u8 gNamingScreenKeyboardUpper_Tilemap[];
extern const u8 gNamingScreenKeyboardLower_Tilemap[];
extern const u8 gNamingScreenKeyboardSymbols_Tilemap[];
extern const u32 gNamingScreenKeyboardUpper_Tilemap[];
extern const u32 gNamingScreenKeyboardLower_Tilemap[];
extern const u32 gNamingScreenKeyboardSymbols_Tilemap[];
extern const u32 gNamingScreenPageSwapFrame_Gfx[];
extern const u32 gNamingScreenBackButton_Gfx[];
extern const u32 gNamingScreenOKButton_Gfx[];
Expand Down Expand Up @@ -4791,7 +4791,7 @@ extern const u32 gContestAudienceTilemap[];
extern const u32 gContestInterfaceAudiencePalette[];
extern const u32 gContestInterfaceTilemap[];
extern const u32 gContestCurtainTilemap[];
extern const u32 gContestSliderHeart_Gfx[];
extern const u8 gContestSliderHeart_Gfx[];
extern const u32 gContestNextTurnGfx[];
extern const u16 gContestPal[];
extern const u32 gContestFaces_Gfx[];
Expand All @@ -4817,11 +4817,11 @@ extern const u16 gUsePokeblockGraph_Pal[];
extern const u16 gUsePokeblockNatureWin_Pal[];

// Berry blender
extern const u32 gBerryBlenderPlayerArrow_Gfx[];
extern const u32 gBerryBlenderStart_Gfx[];
extern const u32 gBerryBlenderScoreSymbols_Gfx[];
extern const u32 gBerryBlenderParticles_Gfx[];
extern const u32 gBerryBlenderCountdownNumbers_Gfx[];
extern const u8 gBerryBlenderPlayerArrow_Gfx[];
extern const u8 gBerryBlenderStart_Gfx[];
extern const u8 gBerryBlenderScoreSymbols_Gfx[];
extern const u8 gBerryBlenderParticles_Gfx[];
extern const u8 gBerryBlenderCountdownNumbers_Gfx[];
extern const u16 gBerryBlenderMiscPalette[];
extern const u16 gBerryBlenderArrowPalette[];
extern const u32 gBerryBlenderCenter_Gfx[];
Expand Down Expand Up @@ -5042,30 +5042,30 @@ extern const u16 gMailPalette_Tropic[];
extern const u16 gMailPalette_Dream[];
extern const u16 gMailPalette_Fab[];
extern const u16 gMailPalette_Retro[];
extern const u8 gMailTiles_Orange[];
extern const u8 gMailTilemap_Orange[];
extern const u8 gMailTiles_Harbor[];
extern const u8 gMailTilemap_Harbor[];
extern const u8 gMailTiles_Glitter[];
extern const u8 gMailTilemap_Glitter[];
extern const u8 gMailTiles_Mech[];
extern const u8 gMailTilemap_Mech[];
extern const u8 gMailTiles_Wood[];
extern const u8 gMailTilemap_Wood[];
extern const u8 gMailTiles_Wave[];
extern const u8 gMailTilemap_Wave[];
extern const u8 gMailTiles_Bead[];
extern const u8 gMailTilemap_Bead[];
extern const u8 gMailTiles_Shadow[];
extern const u8 gMailTilemap_Shadow[];
extern const u8 gMailTiles_Tropic[];
extern const u8 gMailTilemap_Tropic[];
extern const u8 gMailTiles_Dream[];
extern const u8 gMailTilemap_Dream[];
extern const u8 gMailTiles_Fab[];
extern const u8 gMailTilemap_Fab[];
extern const u8 gMailTiles_Retro[];
extern const u8 gMailTilemap_Retro[];
extern const u32 gMailTiles_Orange[];
extern const u32 gMailTilemap_Orange[];
extern const u32 gMailTiles_Harbor[];
extern const u32 gMailTilemap_Harbor[];
extern const u32 gMailTiles_Glitter[];
extern const u32 gMailTilemap_Glitter[];
extern const u32 gMailTiles_Mech[];
extern const u32 gMailTilemap_Mech[];
extern const u32 gMailTiles_Wood[];
extern const u32 gMailTilemap_Wood[];
extern const u32 gMailTiles_Wave[];
extern const u32 gMailTilemap_Wave[];
extern const u32 gMailTiles_Bead[];
extern const u32 gMailTilemap_Bead[];
extern const u32 gMailTiles_Shadow[];
extern const u32 gMailTilemap_Shadow[];
extern const u32 gMailTiles_Tropic[];
extern const u32 gMailTilemap_Tropic[];
extern const u32 gMailTiles_Dream[];
extern const u32 gMailTilemap_Dream[];
extern const u32 gMailTiles_Fab[];
extern const u32 gMailTilemap_Fab[];
extern const u32 gMailTiles_Retro[];
extern const u32 gMailTilemap_Retro[];

extern const u8 gMonMarkingsMenu_Gfx[];
extern const u16 gMonMarkingsMenu_Pal[];
Expand Down
2 changes: 1 addition & 1 deletion src/data/graphics/intro_scene.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const u16 gIntroGameFreakTextFade_Pal[] = INCBIN_U16("graphics/intro/scene_1/text.gbapal"); // game freak text blue fade
const u16 gIntroPlayer_Pal[] = INCBIN_U16("graphics/intro/scene_2/player.gbapal");
const u16 gIntro3Bg_Pal[] = INCBIN_U16("graphics/intro/scene_3/bg.gbapal");
const u16 gIntro3Bg_Pal[16][16] = INCBIN_U16("graphics/intro/scene_3/bg.gbapal");
const u16 gIntroVolbeat_Pal[] = INCBIN_U16("graphics/intro/scene_2/volbeat.gbapal");
const u16 gIntroTorchic_Pal[] = INCBIN_U16("graphics/intro/scene_2/torchic.gbapal");
const u16 gIntroManectric_Pal[] = INCBIN_U16("graphics/intro/scene_2/manectric.gbapal");
Expand Down
11 changes: 6 additions & 5 deletions src/graphics.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "global.h"
#include "graphics.h"

const u32 gBattleTextboxTiles[] = INCBIN_U32("graphics/battle_interface/textbox.4bpp.lz");
const u32 gBattleTextboxPalette[] = INCBIN_U32("graphics/battle_interface/textbox.gbapal.lz");
Expand Down Expand Up @@ -354,7 +355,7 @@ const u16 gBattleInterface_BallStatusBarPal[] = INCBIN_U16("graphics/battle_inte

const u16 gBattleInterface_BallDisplayPal[] = INCBIN_U16("graphics/battle_interface/ball_display.gbapal");

const u8 gHealthboxElementsGfxTable[] = INCBIN_U8("graphics/battle_interface/hpbar.4bpp",
const u8 gHealthboxElementsGfxTable[][32] = INCBIN_U8("graphics/battle_interface/hpbar.4bpp",
"graphics/battle_interface/expbar.4bpp",
"graphics/battle_interface/status.4bpp",
"graphics/battle_interface/misc.4bpp",
Expand Down Expand Up @@ -971,7 +972,7 @@ const u16 gTilesetAnims_BattleDomePals0_3[] = INCBIN_U16("graphics/battle_fronti

static const u16 sUnused0[] = {0x13F, 0x119, 0x113, 0x10E};

const u16 gBattlePyramidFloor_Pal[] = INCBIN_U16("graphics/battle_frontier/pyramid_floor.gbapal");
const u16 gBattlePyramidFloor_Pal[][16] = INCBIN_U16("graphics/battle_frontier/pyramid_floor.gbapal");

const u32 gMultiBattleIntroBg_Opponent_Tilemap[] = INCBIN_U32("graphics/battle_frontier/multi_battle_intro_bg_opponent.bin.lz");
const u32 gMultiBattleIntroBg_Player_Tilemap[] = INCBIN_U32("graphics/battle_frontier/multi_battle_intro_bg_player.bin.lz");
Expand Down Expand Up @@ -1514,12 +1515,12 @@ const u16 gTitleScreenPressStartPal[] = INCBIN_U16("graphics/title_screen/p
const u32 gTitleScreenPressStartGfx[] = INCBIN_U32("graphics/title_screen/press_start.4bpp.lz");
const u32 gTitleScreenPokemonLogoTilemap[] = INCBIN_U32("graphics/title_screen/pokemon_logo.bin.lz");

const u16 gFrontierPassBg_Pal[] = INCBIN_U16("graphics/frontier_pass/bg.gbapal"); // 8 x 16
const u16 gFrontierPassBg_Pal[][16] = INCBIN_U16("graphics/frontier_pass/bg.gbapal"); // 8 x 16
const u32 gFrontierPassBg_Gfx[] = INCBIN_U32("graphics/frontier_pass/bg.4bpp.lz");
const u32 gFrontierPassMapAndCard_Gfx[] = INCBIN_U32("graphics/frontier_pass/map_and_card.8bpp.lz");
const u32 gFrontierPassBg_Tilemap[] = INCBIN_U32("graphics/frontier_pass/bg.bin.lz");
const u16 gFrontierPassCancelButton_Tilemap[] = INCBIN_U16("graphics/frontier_pass/cancel.bin");
const u16 gFrontierPassCancelButtonHighlighted_Tilemap[] = INCBIN_U16("graphics/frontier_pass/cancel_highlighted.bin");
const u32 gFrontierPassCancelButton_Tilemap[] = INCBIN_U32("graphics/frontier_pass/cancel.bin");
const u32 gFrontierPassCancelButtonHighlighted_Tilemap[] = INCBIN_U32("graphics/frontier_pass/cancel_highlighted.bin");

// Berry Crush
const u16 gBerryCrush_Crusher_Pal[] = INCBIN_U16("graphics/berry_crush/crusher.gbapal");
Expand Down
29 changes: 16 additions & 13 deletions src/intro.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,12 +1866,15 @@ static void Task_Scene3_StartGroudon(u8 taskId)
#define tTrigIdx data[6] // Re-used
#define tPalIdx data[7]

// Treats gIntro3Bg_Pal as u8* and iterates by 1
#define INTRO3_RAW_PTR(palId)(((void *) &gIntro3Bg_Pal) + palId)

static void Task_Scene3_Groudon(u8 taskId)
{
s16 *data = gTasks[taskId].data;

tTimer++;
if ((u16)(tState - 1) < 7 && tTimer % 2 == 0)
if ((tState >= 1 && tState <= 7) && tTimer % 2 == 0)
tYShake ^= 3;
PanFadeAndZoomScreen(tScreenX, tScreenY + tYShake, tZoom, 0);
switch (tState)
Expand All @@ -1890,7 +1893,7 @@ static void Task_Scene3_Groudon(u8 taskId)
if (--tDelay == 0)
{
tDelay = 2;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(tPalIdx), &gPlttBufferFaded[BG_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
tPalIdx += 2;
if (tPalIdx == 0x1EC)
tState++;
Expand All @@ -1907,7 +1910,7 @@ static void Task_Scene3_Groudon(u8 taskId)
if (--tDelay == 0)
{
tDelay = 2;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(tPalIdx), &gPlttBufferFaded[BG_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
tPalIdx -= 2;
if (tPalIdx == 0x1E0)
{
Expand Down Expand Up @@ -2149,7 +2152,7 @@ static void Task_Scene3_Kyogre(u8 taskId)
if (--tDelay == 0)
{
tDelay = 4;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(2) + 15], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(tPalIdx), &gPlttBufferFaded[BG_PLTT_ID(2) + 15], PLTT_SIZEOF(1));
tPalIdx -= 2;
if (tPalIdx == 0x1E0)
tState++;
Expand All @@ -2167,7 +2170,7 @@ static void Task_Scene3_Kyogre(u8 taskId)
if (--tDelay == 0)
{
tDelay = 4;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(2) + 15], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(tPalIdx), &gPlttBufferFaded[BG_PLTT_ID(2) + 15], PLTT_SIZEOF(1));
tPalIdx += 2;
if (tPalIdx == 0x1EE)
{
Expand Down Expand Up @@ -2498,7 +2501,7 @@ static void SpriteCB_Lightning(struct Sprite *sprite)
sprite->sPalIdx = 0x1C2;
sprite->sState++;
case 1:
CpuCopy16(&gIntro3Bg_Pal[sprite->sPalIdx], &gPlttBufferFaded[BG_PLTT_ID(5) + 13], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(sprite->sPalIdx), &gPlttBufferFaded[BG_PLTT_ID(5) + 13], PLTT_SIZEOF(1));
sprite->sPalIdx += 2;
if (sprite->sPalIdx != 0x1CE)
break;
Expand All @@ -2509,7 +2512,7 @@ static void SpriteCB_Lightning(struct Sprite *sprite)
if (--sprite->sDelay == 0)
{
sprite->sDelay = 4;
CpuCopy16(&gIntro3Bg_Pal[sprite->sPalIdx], &gPlttBufferFaded[BG_PLTT_ID(5) + 13], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(sprite->sPalIdx), &gPlttBufferFaded[BG_PLTT_ID(5) + 13], PLTT_SIZEOF(1));
sprite->sPalIdx -= 2;
if (sprite->sPalIdx == 0x1C0)
DestroySprite(sprite);
Expand Down Expand Up @@ -2612,7 +2615,7 @@ static void Task_RayquazaAttack(u8 taskId)
case 0:
if ((data[2] & 1) != 0)
{
CpuCopy16(&gIntro3Bg_Pal[0x1A2 + data[1] * 2], &gPlttBufferFaded[BG_PLTT_ID(5) + 14], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(0x1A2 + data[1] * 2), &gPlttBufferFaded[BG_PLTT_ID(5) + 14], PLTT_SIZEOF(1));
data[1]++;
}
if (data[1] == 6)
Expand All @@ -2627,7 +2630,7 @@ static void Task_RayquazaAttack(u8 taskId)
{
if ((data[2] & 1) != 0)
{
CpuCopy16(&gIntro3Bg_Pal[0x1A2 + data[1] * 2], &gPlttBufferFaded[BG_PLTT_ID(5) + 8], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(0x1A2 + data[1] * 2), &gPlttBufferFaded[BG_PLTT_ID(5) + 8], PLTT_SIZEOF(1));
data[1]++;
}
if (data[1] == 6)
Expand All @@ -2646,7 +2649,7 @@ static void Task_RayquazaAttack(u8 taskId)
{
if ((data[2] & 1) != 0)
{
CpuCopy16(&gIntro3Bg_Pal[0x182 + data[1] * 2], &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(0x182 + data[1] * 2), &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
data[1]++;
}
if (data[1] == 6)
Expand All @@ -2670,9 +2673,9 @@ static void Task_RayquazaAttack(u8 taskId)
if (--data[3] != 0)
{
BlendPalette(BG_PLTT_ID(5), 16, data[3], RGB(9, 10, 10));
CpuCopy16(&gIntro3Bg_Pal[428], &gPlttBufferFaded[BG_PLTT_ID(5) + 14], PLTT_SIZEOF(1));
CpuCopy16(&gIntro3Bg_Pal[428], &gPlttBufferFaded[BG_PLTT_ID(5) + 8], PLTT_SIZEOF(1));
CpuCopy16(&gIntro3Bg_Pal[396], &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(428), &gPlttBufferFaded[BG_PLTT_ID(5) + 14], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(428), &gPlttBufferFaded[BG_PLTT_ID(5) + 8], PLTT_SIZEOF(1));
CpuCopy16(INTRO3_RAW_PTR(396), &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ struct MailLayout
struct MailGraphics
{
const u16 *palette;
const u8 *tiles;
const u8 *tileMap;
const u32 *tiles;
const u32 *tileMap;
u32 unused;
u16 textColor;
u16 textShadow;
Expand Down
2 changes: 1 addition & 1 deletion src/naming_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ static void PrintKeyboardKeys(u8 window, u8 page)
PutWindowTilemap(window);
}

static const u8 *const sNextKeyboardPageTilemaps[] =
static const u32 *const sNextKeyboardPageTilemaps[] =
{
[KBPAGE_SYMBOLS] = gNamingScreenKeyboardUpper_Tilemap,
[KBPAGE_LETTERS_UPPER] = gNamingScreenKeyboardLower_Tilemap, // lower
Expand Down

0 comments on commit db99b86

Please sign in to comment.