diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-01-19 13:39:18 -0500 |
---|---|---|
committer | GriffinR <griffin.g.richards@gmail.com> | 2021-01-19 13:39:18 -0500 |
commit | 752982552e212dcb33d57c66342f87eba3ce9089 (patch) | |
tree | 0790f0e7e7cc726d9e50e73b675d877c4b3741de | |
parent | 305ebdbc4a41960faa4fdde2422b443036f1edad (diff) |
Add FIRST_BALL, some FIRST_BERRY_INDEX usage
-rw-r--r-- | include/constants/items.h | 17 | ||||
-rwxr-xr-x | src/berry_crush.c | 2 | ||||
-rw-r--r-- | src/data/items.h | 48 | ||||
-rw-r--r-- | src/item.c | 4 | ||||
-rwxr-xr-x | src/item_menu.c | 2 |
5 files changed, 39 insertions, 34 deletions
diff --git a/include/constants/items.h b/include/constants/items.h index 21f0608a7..71338da8e 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -17,7 +17,11 @@ #define ITEM_LUXURY_BALL 11 #define ITEM_PREMIER_BALL 12 -#define LAST_BALL ITEM_PREMIER_BALL +// Note: If moving ball IDs around, updating FIRST_BALL/LAST_BALL is not sufficient +// Several places expect the ball IDs to be first and contiguous (e.g. gBattlescriptsForBallThrow and MON_DATA_POKEBALL) +// If adding new balls, it's easiest to insert them after the last ball and increment the below IDs (and removing ITEM_034 for example) +#define FIRST_BALL ITEM_MASTER_BALL +#define LAST_BALL ITEM_PREMIER_BALL // Pokemon Items #define ITEM_POTION 13 @@ -145,6 +149,8 @@ #define ITEM_FAB_MAIL 131 #define ITEM_RETRO_MAIL 132 +#define FIRST_MAIL_INDEX ITEM_ORANGE_MAIL + // Berries #define ITEM_CHERI_BERRY 133 #define ITEM_CHESTO_BERRY 134 @@ -189,6 +195,10 @@ #define ITEM_LANSAT_BERRY 173 #define ITEM_STARF_BERRY 174 #define ITEM_ENIGMA_BERRY 175 + +#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY +#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY + #define ITEM_0B0 176 #define ITEM_0B1 177 #define ITEM_0B2 178 @@ -467,9 +477,6 @@ #define ITEMS_COUNT 377 #define ITEM_FIELD_ARROW ITEMS_COUNT -#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY -#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY - // Range of berries given out by various NPCS #define FIRST_BERRY_MASTER_BERRY ITEM_POMEG_BERRY #define LAST_BERRY_MASTER_BERRY ITEM_NOMEL_BERRY @@ -490,8 +497,6 @@ #define ITEM_TO_BERRY(itemId)(((itemId - FIRST_BERRY_INDEX) + 1)) -#define FIRST_MAIL_INDEX ITEM_ORANGE_MAIL - #define NUM_TECHNICAL_MACHINES 50 #define NUM_HIDDEN_MACHINES 8 diff --git a/src/berry_crush.c b/src/berry_crush.c index 90bc7150d..2b16fcbec 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -877,7 +877,7 @@ void StartBerryCrush(MainCallback callback) static void GetBerryFromBag(void) { if (gSpecialVar_ItemId < FIRST_BERRY_INDEX || gSpecialVar_ItemId > LAST_BERRY_INDEX + 1) - gSpecialVar_ItemId = ITEM_CHERI_BERRY; + gSpecialVar_ItemId = FIRST_BERRY_INDEX; else RemoveBagItem(gSpecialVar_ItemId, 1); diff --git a/src/data/items.h b/src/data/items.h index 2230c3e2a..443c45f1a 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -20,10 +20,10 @@ const struct Item gItems[] = .price = 0, .description = sMasterBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_MASTER_BALL - 1, + .type = ITEM_MASTER_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_MASTER_BALL - 1, + .secondaryId = ITEM_MASTER_BALL - FIRST_BALL, }, [ITEM_ULTRA_BALL] = @@ -33,10 +33,10 @@ const struct Item gItems[] = .price = 1200, .description = sUltraBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_ULTRA_BALL - 1, + .type = ITEM_ULTRA_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_ULTRA_BALL - 1, + .secondaryId = ITEM_ULTRA_BALL - FIRST_BALL, }, [ITEM_GREAT_BALL] = @@ -46,10 +46,10 @@ const struct Item gItems[] = .price = 600, .description = sGreatBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_GREAT_BALL - 1, + .type = ITEM_GREAT_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_GREAT_BALL - 1, + .secondaryId = ITEM_GREAT_BALL - FIRST_BALL, }, [ITEM_POKE_BALL] = @@ -59,10 +59,10 @@ const struct Item gItems[] = .price = 200, .description = sPokeBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_POKE_BALL - 1, + .type = ITEM_POKE_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_POKE_BALL - 1, + .secondaryId = ITEM_POKE_BALL - FIRST_BALL, }, [ITEM_SAFARI_BALL] = @@ -72,10 +72,10 @@ const struct Item gItems[] = .price = 0, .description = sSafariBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_SAFARI_BALL - 1, + .type = ITEM_SAFARI_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_SAFARI_BALL - 1, + .secondaryId = ITEM_SAFARI_BALL - FIRST_BALL, }, [ITEM_NET_BALL] = @@ -85,10 +85,10 @@ const struct Item gItems[] = .price = 1000, .description = sNetBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_NET_BALL - 1, + .type = ITEM_NET_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_NET_BALL - 1, + .secondaryId = ITEM_NET_BALL - FIRST_BALL, }, [ITEM_DIVE_BALL] = @@ -98,10 +98,10 @@ const struct Item gItems[] = .price = 1000, .description = sDiveBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_DIVE_BALL - 1, + .type = ITEM_DIVE_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_DIVE_BALL - 1, + .secondaryId = ITEM_DIVE_BALL - FIRST_BALL, }, [ITEM_NEST_BALL] = @@ -111,10 +111,10 @@ const struct Item gItems[] = .price = 1000, .description = sNestBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_NEST_BALL - 1, + .type = ITEM_NEST_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_NEST_BALL - 1, + .secondaryId = ITEM_NEST_BALL - FIRST_BALL, }, [ITEM_REPEAT_BALL] = @@ -124,10 +124,10 @@ const struct Item gItems[] = .price = 1000, .description = sRepeatBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_REPEAT_BALL - 1, + .type = ITEM_REPEAT_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_REPEAT_BALL - 1, + .secondaryId = ITEM_REPEAT_BALL - FIRST_BALL, }, [ITEM_TIMER_BALL] = @@ -137,10 +137,10 @@ const struct Item gItems[] = .price = 1000, .description = sTimerBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_TIMER_BALL - 1, + .type = ITEM_TIMER_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_TIMER_BALL - 1, + .secondaryId = ITEM_TIMER_BALL - FIRST_BALL, }, [ITEM_LUXURY_BALL] = @@ -150,10 +150,10 @@ const struct Item gItems[] = .price = 1000, .description = sLuxuryBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_LUXURY_BALL - 1, + .type = ITEM_LUXURY_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_LUXURY_BALL - 1, + .secondaryId = ITEM_LUXURY_BALL - FIRST_BALL, }, [ITEM_PREMIER_BALL] = @@ -163,10 +163,10 @@ const struct Item gItems[] = .price = 200, .description = sPremierBallDesc, .pocket = POCKET_POKE_BALLS, - .type = ITEM_PREMIER_BALL - 1, + .type = ITEM_PREMIER_BALL - FIRST_BALL, .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = ITEM_PREMIER_BALL - 1, + .secondaryId = ITEM_PREMIER_BALL - FIRST_BALL, }, // Medicine diff --git a/src/item.c b/src/item.c index 0b6366048..91d2f1a0a 100644 --- a/src/item.c +++ b/src/item.c @@ -102,8 +102,8 @@ void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity) } else { - if (itemId >= ITEM_CHERI_BERRY && itemId <= ITEM_ENIGMA_BERRY) - GetBerryCountString(dst, gBerries[itemId - ITEM_CHERI_BERRY].name, quantity); + if (itemId >= FIRST_BERRY_INDEX && itemId <= LAST_BERRY_INDEX) + GetBerryCountString(dst, gBerries[itemId - FIRST_BERRY_INDEX].name, quantity); else StringCopy(dst, ItemId_GetName(itemId)); } diff --git a/src/item_menu.c b/src/item_menu.c index 5e68898ae..6857fb7c3 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -865,7 +865,7 @@ void GetItemName(s8 *dest, u16 itemId) } break; case BERRIES_POCKET: - ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_CHERI_BERRY + 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, itemId - FIRST_BERRY_INDEX + 1, STR_CONV_MODE_LEADING_ZEROS, 2); CopyItemName(itemId, gStringVar2); StringExpandPlaceholders(dest, gText_NumberVar1Clear7Var2); break; |