From a35ce6ecdf4074e8b0b3675b390f9ac63d80757b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 3 May 2020 11:12:05 +0200 Subject: [PATCH] Give a define for all dex interface sprites for easier editing --- src/pokedex.c | 306 +++++++++++++++++++++++++------------------------- 1 file changed, 154 insertions(+), 152 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index 0805485537..c3d38681cf 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -666,10 +666,12 @@ static const union AnimCmd *const sSpriteAnimTable_DexListStartMenuCursor[] = sSpriteAnim_DexListStartMenuCursor }; +#define TAG_DEX_INTERFACE 4096 // Tile and pal tag used for all interface sprites. + static const struct SpriteTemplate sScrollBarSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_ScrollBar, .anims = sSpriteAnimTable_ScrollBar, .images = NULL, @@ -679,8 +681,8 @@ static const struct SpriteTemplate sScrollBarSpriteTemplate = static const struct SpriteTemplate sScrollArrowSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_ScrollArrow, .anims = sSpriteAnimTable_ScrollArrow, .images = NULL, @@ -690,8 +692,8 @@ static const struct SpriteTemplate sScrollArrowSpriteTemplate = static const struct SpriteTemplate sInterfaceTextSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_InterfaceText, .anims = sSpriteAnimTable_InterfaceText, .images = NULL, @@ -701,8 +703,8 @@ static const struct SpriteTemplate sInterfaceTextSpriteTemplate = static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_RotatingPokeBall, .anims = sSpriteAnimTable_RotatingPokeBall, .images = NULL, @@ -712,8 +714,8 @@ static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate = static const struct SpriteTemplate sSeenOwnTextSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_SeenOwnText, .anims = sSpriteAnimTable_SeenOwnText, .images = NULL, @@ -723,8 +725,8 @@ static const struct SpriteTemplate sSeenOwnTextSpriteTemplate = static const struct SpriteTemplate sHoennNationalTextSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_InterfaceText, .anims = sSpriteAnimTable_HoennNationalText, .images = NULL, @@ -734,8 +736,8 @@ static const struct SpriteTemplate sHoennNationalTextSpriteTemplate = static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_Dex8x16, .anims = sSpriteAnimTable_HoennSeenOwnNumber, .images = NULL, @@ -745,8 +747,8 @@ static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate = static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_Dex8x16, .anims = sSpriteAnimTable_NationalSeenOwnNumber, .images = NULL, @@ -756,8 +758,8 @@ static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate = static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_Dex8x16, .anims = sSpriteAnimTable_DexListStartMenuCursor, .images = NULL, @@ -767,13 +769,13 @@ static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate = static const struct CompressedSpriteSheet sInterfaceSpriteSheet[] = { - {gPokedexInterface_Gfx, 0x2000, 4096}, + {gPokedexInterface_Gfx, 0x2000, TAG_DEX_INTERFACE}, {0} }; static const struct SpritePalette sInterfaceSpritePalette[] = { - {gPokedexBgHoenn_Pal, 4096}, + {gPokedexBgHoenn_Pal, TAG_DEX_INTERFACE}, {0} }; @@ -893,7 +895,7 @@ static const struct BgTemplate sInfoScreen_BgTemplate[] = static const struct WindowTemplate sInfoScreen_WindowTemplates[] = { - [WIN_INFO] = + [WIN_INFO] = { .bg = 2, .tilemapLeft = 0, @@ -903,7 +905,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 0, .baseBlock = 1, }, - [WIN_FOOTPRINT] = + [WIN_FOOTPRINT] = { .bg = 2, .tilemapLeft = 25, @@ -913,7 +915,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 15, .baseBlock = 641, }, - [WIN_CRY_WAVE] = + [WIN_CRY_WAVE] = { .bg = 0, .tilemapLeft = 0, @@ -923,7 +925,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 8, .baseBlock = 645, }, - [WIN_VU_METER] = + [WIN_VU_METER] = { .bg = 2, .tilemapLeft = 18, @@ -960,7 +962,7 @@ static const struct BgTemplate sNewEntryInfoScreen_BgTemplate[] = static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = { - [WIN_INFO] = + [WIN_INFO] = { .bg = 2, .tilemapLeft = 0, @@ -970,7 +972,7 @@ static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = .paletteNum = 0, .baseBlock = 1, }, - [WIN_FOOTPRINT] = + [WIN_FOOTPRINT] = { .bg = 2, .tilemapLeft = 25, @@ -1012,21 +1014,21 @@ static const u8 sLetterSearchRanges[][4] = static const struct SearchMenuTopBarItem sSearchMenuTopBarItems[SEARCH_TOPBAR_COUNT] = { - [SEARCH_TOPBAR_SEARCH] = + [SEARCH_TOPBAR_SEARCH] = { .description = gText_SearchForPkmnBasedOnParameters, .highlightX = 0, .highlightY = 0, .highlightWidth = 5, }, - [SEARCH_TOPBAR_SHIFT] = + [SEARCH_TOPBAR_SHIFT] = { .description = gText_SwitchPokedexListings, .highlightX = 6, .highlightY = 0, .highlightWidth = 5, }, - [SEARCH_TOPBAR_CANCEL] = + [SEARCH_TOPBAR_CANCEL] = { .description = gText_ReturnToPokedex, .highlightX = 12, @@ -1037,7 +1039,7 @@ static const struct SearchMenuTopBarItem sSearchMenuTopBarItems[SEARCH_TOPBAR_CO static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { .description = gText_ListByFirstLetter, .titleBgX = 0, @@ -1047,7 +1049,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 2, .selectionBgWidth = 12, }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { .description = gText_ListByBodyColor, .titleBgX = 0, @@ -1057,7 +1059,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 4, .selectionBgWidth = 12, }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { .description = gText_ListByType, .titleBgX = 0, @@ -1067,7 +1069,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 6, .selectionBgWidth = 6, }, - [SEARCH_TYPE_RIGHT] = + [SEARCH_TYPE_RIGHT] = { .description = gText_ListByType, .titleBgX = 0, @@ -1077,7 +1079,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 6, .selectionBgWidth = 6, }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { .description = gText_SelectPokedexListingMode, .titleBgX = 0, @@ -1087,7 +1089,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 8, .selectionBgWidth = 12, }, - [SEARCH_MODE] = + [SEARCH_MODE] = { .description = gText_SelectPokedexMode, .titleBgX = 0, @@ -1097,7 +1099,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 10, .selectionBgWidth = 12, }, - [SEARCH_OK] = + [SEARCH_OK] = { .description = gText_ExecuteSearchSwitch, .titleBgX = 0, @@ -1112,52 +1114,52 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = // Left, Right, Up, Down static const u8 sSearchMovementMap_SearchNatDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, SEARCH_COLOR }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { - 0xFF, - 0xFF, - SEARCH_NAME, + 0xFF, + 0xFF, + SEARCH_NAME, SEARCH_TYPE_LEFT }, - [SEARCH_TYPE_LEFT] = - { - 0xFF, - SEARCH_TYPE_RIGHT, - SEARCH_COLOR, - SEARCH_ORDER - }, - [SEARCH_TYPE_RIGHT] = - { SEARCH_TYPE_LEFT, - 0xFF, - SEARCH_COLOR, - SEARCH_ORDER - }, - [SEARCH_ORDER] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - 0xFF, - SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_TYPE_RIGHT, + SEARCH_COLOR, + SEARCH_ORDER + }, + [SEARCH_TYPE_RIGHT] = + { SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_COLOR, + SEARCH_ORDER + }, + [SEARCH_ORDER] = + { + 0xFF, + 0xFF, + SEARCH_TYPE_LEFT, SEARCH_MODE }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, SEARCH_OK }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_MODE, + 0xFF, + 0xFF, + SEARCH_MODE, 0xFF }, }; @@ -1165,53 +1167,53 @@ static const u8 sSearchMovementMap_SearchNatDex[SEARCH_COUNT][4] = // Left, Right, Up, Down static const u8 sSearchMovementMap_ShiftNatDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_RIGHT] = + [SEARCH_TYPE_RIGHT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, SEARCH_MODE }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, SEARCH_OK }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_MODE, + 0xFF, + 0xFF, + SEARCH_MODE, 0xFF }, }; @@ -1219,52 +1221,52 @@ static const u8 sSearchMovementMap_ShiftNatDex[SEARCH_COUNT][4] = // Left, Right, Up, Down static const u8 sSearchMovementMap_SearchHoennDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, SEARCH_COLOR }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { - 0xFF, - 0xFF, - SEARCH_NAME, + 0xFF, + 0xFF, + SEARCH_NAME, SEARCH_TYPE_LEFT }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - SEARCH_TYPE_RIGHT, - SEARCH_COLOR, + 0xFF, + SEARCH_TYPE_RIGHT, + SEARCH_COLOR, SEARCH_ORDER }, - [SEARCH_TYPE_RIGHT] = - { SEARCH_TYPE_LEFT, - 0xFF, - SEARCH_COLOR, + [SEARCH_TYPE_RIGHT] = + { SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_COLOR, SEARCH_ORDER }, [SEARCH_ORDER] = { - 0xFF, - 0xFF, - SEARCH_TYPE_LEFT, + 0xFF, + 0xFF, + SEARCH_TYPE_LEFT, SEARCH_OK }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, 0xFF }, }; @@ -1272,53 +1274,53 @@ static const u8 sSearchMovementMap_SearchHoennDex[SEARCH_COUNT][4] = // Left, Right, Up, Down static const u8 sSearchMovementMap_ShiftHoennDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, [SEARCH_COLOR] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_RIGHT] = + [SEARCH_TYPE_RIGHT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, SEARCH_OK }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, 0xFF }, }; @@ -2838,7 +2840,7 @@ static void CreateInterfaceSprites(u8 page) spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 48, 1); digitNum = (sPokedexView->seenCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - + // Owned value - 100s drawNextDigit = FALSE; spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 80, 1); @@ -3898,7 +3900,7 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) u8 row = i * 7 + 1; u32 newPalette; - do + do { if (i == a || i == 3) newPalette = 0x2000;