summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-08-28 19:18:03 -0400
committerGitHub <noreply@github.com>2020-08-28 19:18:03 -0400
commita9719c92bfa4c6b6dcf57e9516f184721152ad80 (patch)
tree46357034b009d503c77cac264a39ca816363d750 /src
parent09cfed64b5a10a51ca246ce7a4f57b95cf4b4456 (diff)
parent028502fce5c2565c372c3b28760c44bc313cf59f (diff)
Merge pull request #1160 from kiliwily/master2
add MAX_LEVEL_UP_MOVES macro
Diffstat (limited to 'src')
-rw-r--r--src/move_relearner.c24
-rw-r--r--src/pokemon.c8
2 files changed, 17 insertions, 15 deletions
diff --git a/src/move_relearner.c b/src/move_relearner.c
index 5f2123362..3e7caf133 100644
--- a/src/move_relearner.c
+++ b/src/move_relearner.c
@@ -150,20 +150,22 @@
#define JAM_HEART_EMPTY 2
#define JAM_HEART_FULL 3
+#define MAX_RELEARNER_MOVES (MAX_LEVEL_UP_MOVES > 25 ? MAX_LEVEL_UP_MOVES : 25)
+
static EWRAM_DATA struct
{
u8 state;
- u8 heartSpriteIds[16]; /*0x001*/
- u16 movesToLearn[25]; /*0x01A*/
- u8 partyMon; /*0x044*/
- u8 moveSlot; /*0x045*/
- struct ListMenuItem menuItems[25]; /*0x0E8*/
- u8 numMenuChoices; /*0x110*/
- u8 numToShowAtOnce; /*0x111*/
- u8 moveListMenuTask; /*0x112*/
- u8 moveListScrollArrowTask; /*0x113*/
- u8 moveDisplayArrowTask; /*0x114*/
- u16 scrollOffset; /*0x116*/
+ u8 heartSpriteIds[16]; /*0x001*/
+ u16 movesToLearn[MAX_RELEARNER_MOVES]; /*0x01A*/
+ u8 partyMon; /*0x044*/
+ u8 moveSlot; /*0x045*/
+ struct ListMenuItem menuItems[MAX_RELEARNER_MOVES]; /*0x0E8*/
+ u8 numMenuChoices; /*0x110*/
+ u8 numToShowAtOnce; /*0x111*/
+ u8 moveListMenuTask; /*0x112*/
+ u8 moveListScrollArrowTask; /*0x113*/
+ u8 moveDisplayArrowTask; /*0x114*/
+ u16 scrollOffset; /*0x116*/
} *sMoveRelearnerStruct = {0};
static EWRAM_DATA struct {
diff --git a/src/pokemon.c b/src/pokemon.c
index 7cde8e0a6..188624d6a 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -6138,7 +6138,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
for (i = 0; i < MAX_MON_MOVES; i++)
learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
- for (i = 0; i < 20; i++)
+ for (i = 0; i < MAX_LEVEL_UP_MOVES; i++)
{
u16 moveLevel;
@@ -6171,7 +6171,7 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves)
u8 numMoves = 0;
int i;
- for (i = 0; i < 20 && gLevelUpLearnsets[species][i] != LEVEL_UP_END; i++)
+ for (i = 0; i < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][i] != LEVEL_UP_END; i++)
moves[numMoves++] = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID;
return numMoves;
@@ -6180,7 +6180,7 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves)
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
{
u16 learnedMoves[MAX_MON_MOVES];
- u16 moves[20];
+ u16 moves[MAX_LEVEL_UP_MOVES];
u8 numMoves = 0;
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
@@ -6192,7 +6192,7 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
for (i = 0; i < MAX_MON_MOVES; i++)
learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
- for (i = 0; i < 20; i++)
+ for (i = 0; i < MAX_LEVEL_UP_MOVES; i++)
{
u16 moveLevel;