Index gBardSounds_Moves and gBardSounds_Pokemon with constants

This commit is contained in:
GriffinR 2021-01-28 15:42:51 -05:00
parent 8fe4d004e3
commit 89b85a49ec
6 changed files with 779 additions and 785 deletions

View File

@ -34,12 +34,8 @@ struct BardSong
/*0x30*/ const struct BardSound *sound; /*0x30*/ const struct BardSound *sound;
}; };
// Exported RAM declarations extern const u16 gNumBardWords_Species;
extern const u16 gNumBardWords_Moves;
// Exported ROM declarations
extern const u16 gNumSpeciesNames;
extern const u16 gUnknown_085FA1D4;
const struct BardSound *GetWordSounds(u16 word); const struct BardSound *GetWordSounds(u16 word);
void GetWordPhonemes(struct BardSong *song, u16 word); void GetWordPhonemes(struct BardSong *song, u16 word);

View File

@ -127,7 +127,7 @@ u8 * CopyEasyChatWord(u8 *dest, u16 word);
bool32 sub_811F8D8(int word); bool32 sub_811F8D8(int word);
void InitializeEasyChatWordArray(u16 *words, u16 length); void InitializeEasyChatWordArray(u16 *words, u16 length);
u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows); u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows);
bool8 ECWord_CheckIfOutsideOfValidRange(u16 word); bool8 IsBardWordInvalid(u16 word);
u16 GetRandomEasyChatWordFromGroup(u16 group); u16 GetRandomEasyChatWordFromGroup(u16 group);
u16 GetNewHipsterPhraseToTeach(void); u16 GetNewHipsterPhraseToTeach(void);
u16 EasyChat_GetNumWordsInGroup(u8); u16 EasyChat_GetNumWordsInGroup(u8);

View File

@ -1,5 +1,3 @@
// Includes
#include "global.h" #include "global.h"
#include "bard_music.h" #include "bard_music.h"
#include "constants/easy_chat.h" #include "constants/easy_chat.h"
@ -21,7 +19,7 @@ const struct BardSound *GetWordSounds(u16 word)
u32 subword; u32 subword;
const struct BardSound (*ptr)[6]; const struct BardSound (*ptr)[6];
if (ECWord_CheckIfOutsideOfValidRange(word)) if (IsBardWordInvalid(word))
{ {
return gBardSound_InvalidWord; return gBardSound_InvalidWord;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4876,7 +4876,7 @@ bool8 sub_811EAA4(u16 easyChatWord)
} }
} }
bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord) bool8 IsBardWordInvalid(u16 easyChatWord)
{ {
int numWordsInGroup; int numWordsInGroup;
u8 groupId = EC_GROUP(easyChatWord); u8 groupId = EC_GROUP(easyChatWord);
@ -4888,11 +4888,11 @@ bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord)
{ {
case EC_GROUP_POKEMON: case EC_GROUP_POKEMON:
case EC_GROUP_POKEMON_2: case EC_GROUP_POKEMON_2:
numWordsInGroup = gNumSpeciesNames; numWordsInGroup = gNumBardWords_Species;
break; break;
case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_1:
case EC_GROUP_MOVE_2: case EC_GROUP_MOVE_2:
numWordsInGroup = gUnknown_085FA1D4; numWordsInGroup = gNumBardWords_Moves;
break; break;
default: default:
numWordsInGroup = gEasyChatGroups[groupId].numWords; numWordsInGroup = gEasyChatGroups[groupId].numWords;