From bc20fda6041244d83775f6e3084f74ebe81a5fda Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 04:03:16 -0500 Subject: Use GET_UNOWN_LETTER macro --- include/pokemon.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index addf580e9..0320da1f2 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -238,6 +238,15 @@ struct Evolution u16 targetSpecies; }; +#define NUM_UNOWN_FORMS 28 + +#define GET_UNOWN_LETTER(personality) (( \ + ((personality & 0x03000000) >> 18) \ + | ((personality & 0x00030000) >> 12) \ + | ((personality & 0x00000300) >> 6) \ + | ((personality & 0x00000003) >> 0) \ +) % NUM_UNOWN_FORMS) + extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; -- cgit v1.2.3 From cf9f8d01c513f13b014da3fe3995aef3071e542b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 05:49:20 -0500 Subject: Add misc item data constants --- include/constants/items.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/constants/items.h b/include/constants/items.h index 95c6aacfe..21f0608a7 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -490,6 +490,8 @@ #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 @@ -506,6 +508,21 @@ #define GOOD_ROD 1 #define SUPER_ROD 2 +// Secondary IDs for bikes +#define MACH_BIKE 0 +#define ACRO_BIKE 1 + +// Item type IDs (used to determine the exit callback) +#define ITEM_USE_MAIL 0 +#define ITEM_USE_PARTY_MENU 1 +#define ITEM_USE_FIELD 2 +#define ITEM_USE_PBLOCK_CASE 3 +#define ITEM_USE_BAG_MENU 4 // No exit callback, stays in bag menu + +// Item battle usage IDs (only checked to see if nonzero) +#define ITEM_B_USE_MEDICINE 1 +#define ITEM_B_USE_OTHER 2 + // Check if the item is one that can be used on a Pokemon. #define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2) -- cgit v1.2.3 From 305ebdbc4a41960faa4fdde2422b443036f1edad Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 12:36:36 -0500 Subject: Parentheses for GET_UNOWN_LETTER --- include/pokemon.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index 0320da1f2..0ff635a3f 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -240,11 +240,11 @@ struct Evolution #define NUM_UNOWN_FORMS 28 -#define GET_UNOWN_LETTER(personality) (( \ - ((personality & 0x03000000) >> 18) \ - | ((personality & 0x00030000) >> 12) \ - | ((personality & 0x00000300) >> 6) \ - | ((personality & 0x00000003) >> 0) \ +#define GET_UNOWN_LETTER(personality) (( \ + (((personality) & 0x03000000) >> 18) \ + | (((personality) & 0x00030000) >> 12) \ + | (((personality) & 0x00000300) >> 6) \ + | (((personality) & 0x00000003) >> 0) \ ) % NUM_UNOWN_FORMS) extern u8 gPlayerPartyCount; -- cgit v1.2.3 From 752982552e212dcb33d57c66342f87eba3ce9089 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 13:39:18 -0500 Subject: Add FIRST_BALL, some FIRST_BERRY_INDEX usage --- include/constants/items.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'include') 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 -- cgit v1.2.3