Merge pull request #1318 from GriffinRichards/bardmoves

Minor bard music clean up
This commit is contained in:
GriffinR 2021-02-01 14:59:45 -05:00 committed by GitHub
commit 90513a9d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 891 additions and 896 deletions

View File

@ -1,9 +1,6 @@
#ifndef GUARD_BARD_MUSIC_H #ifndef GUARD_BARD_MUSIC_H
#define GUARD_BARD_MUSIC_H #define GUARD_BARD_MUSIC_H
// Exported type declarations
struct BardSound struct BardSound
{ {
/*0x00*/ u8 var00; /*0x00*/ u8 var00;
@ -34,12 +31,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"
@ -10,9 +8,9 @@
#include "data/bard_music/default_sound.h" #include "data/bard_music/default_sound.h"
#include "data/bard_music/length_table.h" #include "data/bard_music/length_table.h"
s16 CalcWordPitch(int arg0, int songPos) static s16 CalcWordPitch(int arg0, int songPos)
{ {
return gBardSoundPitchTables[arg0][songPos]; return sBardSoundPitchTables[arg0][songPos];
} }
const struct BardSound *GetWordSounds(u16 word) const struct BardSound *GetWordSounds(u16 word)
@ -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

@ -1,182 +1,186 @@
#ifndef GUARD_WORD_PITCH_H #ifndef GUARD_WORD_PITCH_H
#define GUARD_WORD_PITCH_H #define GUARD_WORD_PITCH_H
const s16 gUnknown_0860A1C0[] = { #define PITCH_END 0x1800
-0x300, 0x1800
static const s16 sPitch1_0[] = {
-0x300, PITCH_END
}; };
const s16 gUnknown_0860A1C4[] = { static const s16 sPitch1_1[] = {
0x0900, 0x1800 0x0900, PITCH_END
}; };
const s16 gUnknown_0860A1C8[] = { static const s16 sPitch1_2[] = {
0x0100, 0x1800 0x0100, PITCH_END
}; };
const s16 gUnknown_0860A1CC[] = { static const s16 sPitch1_3[] = {
0x0400, 0x1800 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A1D0[] = { static const s16 sPitch1_4[] = {
0x0b00, 0x1800 0x0b00, PITCH_END
}; };
const s16 gUnknown_0860A1D4[] = { static const s16 sPitch2_0[] = {
-0x300, -0x100, 0x1800 -0x300, -0x100, PITCH_END
}; };
const s16 gUnknown_0860A1DA[] = { static const s16 sPitch2_1[] = {
-0x300, 0x0200, 0x1800 -0x300, 0x0200, PITCH_END
}; };
const s16 gUnknown_0860A1E0[] = { static const s16 sPitch2_2[] = {
0x0200, 0x0400, 0x1800 0x0200, 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A1E6[] = { static const s16 sPitch2_3[] = {
0x0600, 0x0800, 0x1800 0x0600, 0x0800, PITCH_END
}; };
const s16 gUnknown_0860A1EC[] = { static const s16 sPitch2_4[] = {
0x0900, 0x0800, 0x1800 0x0900, 0x0800, PITCH_END
}; };
const s16 gUnknown_0860A1F2[] = { static const s16 sPitch3_0[] = {
-0x300, -0x100, -0x300, 0x1800 -0x300, -0x100, -0x300, PITCH_END
}; };
const s16 gUnknown_0860A1FA[] = { static const s16 sPitch3_1[] = {
0x0400, -0x300, 0x0400, 0x1800 0x0400, -0x300, 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A202[] = { static const s16 sPitch3_2[] = {
0x0900, 0x0800, 0x0600, 0x1800 0x0900, 0x0800, 0x0600, PITCH_END
}; };
const s16 gUnknown_0860A20A[] = { static const s16 sPitch3_3[] = {
0x0100, 0x0200, 0x0400, 0x1800 0x0100, 0x0200, 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A212[] = { static const s16 sPitch3_4[] = {
0x0600, 0x1000, 0x0d00, 0x1800 0x0600, 0x1000, 0x0d00, PITCH_END
}; };
const s16 gUnknown_0860A21A[] = { static const s16 sPitch4_0[] = {
0x0400, 0x0900, 0x0400, 0x0900, 0x1800 0x0400, 0x0900, 0x0400, 0x0900, PITCH_END
}; };
const s16 gUnknown_0860A224[] = { static const s16 sPitch4_1[] = {
0x0900, 0x0400, 0x0d00, 0x0400, 0x1800 0x0900, 0x0400, 0x0d00, 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A22E[] = { static const s16 sPitch4_2[] = {
0x0100, 0x0200, 0x0400, 0x0600, 0x1800 0x0100, 0x0200, 0x0400, 0x0600, PITCH_END
}; };
const s16 gUnknown_0860A238[] = { static const s16 sPitch4_3[] = {
0x0800, 0x0600, 0x0400, 0x0200, 0x1800 0x0800, 0x0600, 0x0400, 0x0200, PITCH_END
}; };
const s16 gUnknown_0860A242[] = { static const s16 sPitch4_4[] = {
0x0f00, 0x0d00, 0x0b00, 0x0a00, 0x1800 0x0f00, 0x0d00, 0x0b00, 0x0a00, PITCH_END
}; };
const s16 gUnknown_0860A24C[] = { static const s16 sPitch5_0[] = {
-0x300, -0x100, 0x0100, 0x0200, 0x0400, 0x1800 -0x300, -0x100, 0x0100, 0x0200, 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A258[] = { static const s16 sPitch5_1[] = {
0x0900, 0x0800, 0x0600, 0x0400, 0x0200, 0x1800 0x0900, 0x0800, 0x0600, 0x0400, 0x0200, PITCH_END
}; };
const s16 gUnknown_0860A264[] = { static const s16 sPitch5_2[] = {
0x0100, 0x0400, 0x0900, 0x0400, 0x0100, 0x1800 0x0100, 0x0400, 0x0900, 0x0400, 0x0100, PITCH_END
}; };
const s16 gUnknown_0860A270[] = { static const s16 sPitch5_3[] = {
0x0900, 0x0400, 0x0900, 0x0400, -0x300, 0x1800 0x0900, 0x0400, 0x0900, 0x0400, -0x300, PITCH_END
}; };
const s16 gUnknown_0860A27C[] = { static const s16 sPitch5_4[] = {
0x0b00, 0x0800, 0x0400, 0x0400, 0x0600, 0x1800 0x0b00, 0x0800, 0x0400, 0x0400, 0x0600, PITCH_END
}; };
const s16 gUnknown_0860A288[] = { static const s16 sPitch6_0[] = {
-0x300, -0x100, 0x0100, 0x0200, 0x0400, 0x0600, 0x1800 -0x300, -0x100, 0x0100, 0x0200, 0x0400, 0x0600, PITCH_END
}; };
const s16 gUnknown_0860A296[] = { static const s16 sPitch6_1[] = {
0x0800, 0x0600, 0x0400, 0x0200, 0x0100, -0x100, 0x1800 0x0800, 0x0600, 0x0400, 0x0200, 0x0100, -0x100, PITCH_END
}; };
const s16 gUnknown_0860A2A4[] = { static const s16 sPitch6_2[] = {
0x0100, 0x0200, 0x0400, 0x0100, 0x0200, 0x1000, 0x1800 0x0100, 0x0200, 0x0400, 0x0100, 0x0200, 0x1000, PITCH_END
}; };
const s16 gUnknown_0860A2B2[] = { static const s16 sPitch6_3[] = {
0x0400, -0x300, 0x0900, 0x0400, 0x0900, 0x0400, 0x1800 0x0400, -0x300, 0x0900, 0x0400, 0x0900, 0x0400, PITCH_END
}; };
const s16 gUnknown_0860A2C0[] = { static const s16 sPitch6_4[] = {
0x0800, 0x0900, 0x0800, 0x0900, 0x0800, 0x0900, 0x1800 0x0800, 0x0900, 0x0800, 0x0900, 0x0800, 0x0900, PITCH_END
}; };
const s16 gUnknown_0860A2CE[] = { static const s16 sPitch7_0[] = {
0x0200, 0x0100, 0x0200, 0x0100, 0x0200, 0x0400, 0x0200, 0x1800 0x0200, 0x0100, 0x0200, 0x0100, 0x0200, 0x0400, 0x0200, PITCH_END
}; };
const s16 gUnknown_0860A2DE[] = { static const s16 sPitch7_1[] = {
0x0100, 0x0100, -0x100, -0x100, -0x300, 0x0400, -0x300, 0x1800 0x0100, 0x0100, -0x100, -0x100, -0x300, 0x0400, -0x300, PITCH_END
}; };
const s16 gUnknown_0860A2EE[] = { static const s16 sPitch7_2[] = {
0x0800, 0x0900, 0x0b00, 0x0d00, 0x0e00, 0x0d00, 0x0b00, 0x1800 0x0800, 0x0900, 0x0b00, 0x0d00, 0x0e00, 0x0d00, 0x0b00, PITCH_END
}; };
const s16 gUnknown_0860A2FE[] = { static const s16 sPitch7_3[] = {
0x0800, 0x0600, 0x0400, 0x0200, 0x0d00, 0x0b00, 0x0900, 0x1800 0x0800, 0x0600, 0x0400, 0x0200, 0x0d00, 0x0b00, 0x0900, PITCH_END
}; };
const s16 gUnknown_0860A30E[] = { static const s16 sPitch7_4[] = {
0x0300, 0x0400, 0x0600, 0x0800, 0x0700, 0x0800, 0x0400, 0x1800 0x0300, 0x0400, 0x0600, 0x0800, 0x0700, 0x0800, 0x0400, PITCH_END
}; };
const s16 *const gBardSoundPitchTables[] = { // Only sPitch7_# are used below
gUnknown_0860A1C0, // This table is always indexed with (x + 30), where x is some value 0 - 4
gUnknown_0860A1C4, static const s16 *const sBardSoundPitchTables[] = {
gUnknown_0860A1C8, sPitch1_0,
gUnknown_0860A1CC, sPitch1_1,
gUnknown_0860A1D0, sPitch1_2,
gUnknown_0860A1D4, sPitch1_3,
gUnknown_0860A1DA, sPitch1_4,
gUnknown_0860A1E0, sPitch2_0,
gUnknown_0860A1E6, sPitch2_1,
gUnknown_0860A1EC, sPitch2_2,
gUnknown_0860A1F2, sPitch2_3,
gUnknown_0860A1FA, sPitch2_4,
gUnknown_0860A202, sPitch3_0,
gUnknown_0860A20A, sPitch3_1,
gUnknown_0860A212, sPitch3_2,
gUnknown_0860A21A, sPitch3_3,
gUnknown_0860A224, sPitch3_4,
gUnknown_0860A22E, sPitch4_0,
gUnknown_0860A238, sPitch4_1,
gUnknown_0860A242, sPitch4_2,
gUnknown_0860A24C, sPitch4_3,
gUnknown_0860A258, sPitch4_4,
gUnknown_0860A264, sPitch5_0,
gUnknown_0860A270, sPitch5_1,
gUnknown_0860A27C, sPitch5_2,
gUnknown_0860A288, sPitch5_3,
gUnknown_0860A296, sPitch5_4,
gUnknown_0860A2A4, sPitch6_0,
gUnknown_0860A2B2, sPitch6_1,
gUnknown_0860A2C0, sPitch6_2,
gUnknown_0860A2CE, sPitch6_3,
gUnknown_0860A2DE, sPitch6_4,
gUnknown_0860A2EE, sPitch7_0,
gUnknown_0860A2FE, sPitch7_1,
gUnknown_0860A30E sPitch7_2,
sPitch7_3,
sPitch7_4
}; };

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;