Document bard music (#2053)

* Missing bard song limit constants
* Index bard sound arrays with word constants
* Document bard music
This commit is contained in:
GriffinR
2025-01-17 12:54:38 -05:00
committed by GitHub
parent b5b0ffd511
commit 2f67b17571
32 changed files with 6946 additions and 6841 deletions

View File

@@ -1,41 +1,49 @@
#ifndef GUARD_BARD_MUSIC_H
#define GUARD_BARD_MUSIC_H
#define BARD_SOUND_MAX_LENGTH 6
// The maximum number of BardSoundTemplates/BardSounds there can be for each easy chat word.
#define MAX_BARD_SOUNDS_PER_WORD 6
struct BardSound
// The number of pitch tables there are for each pitch table size (see sPitchTables).
#define NUM_BARD_PITCH_TABLES_PER_SIZE 5
// This struct describes which phoneme song to play for the sound, and whether to
// make any adjustments to its length or volume. Very few sounds make any adjustments.
struct BardSoundTemplate
{
/*0x00*/ u8 songLengthId;
/*0x01*/ s8 songLengthOffset;
/*0x02*/ u16 unused;
/*0x04*/ s16 volume;
/*0x06*/ u16 unused2;
u8 songId;
s8 lengthAdjustment;
u16 unused; // Only set on EC_WORD_WAAAH, and never read.
s16 volume;
};
struct BardPhoneme
// This is the length and pitch to play the phoneme song at.
// These will be calculated in 'CalcWordSounds'.
struct BardSound
{
/*0x00*/ u16 length;
/*0x02*/ u16 pitch;
u16 length;
u16 pitch;
};
struct BardSong
{
/*0x00*/ u8 currWord;
/*0x01*/ u8 currPhoneme;
/*0x02*/ u8 phonemeTimer;
/*0x03*/ u8 state;
/*0x04*/ s16 length;
/*0x06*/ u16 volume;
/*0x08*/ s16 pitch;
/*0x0A*/ s16 voiceInflection;
/*0x0C*/ u16 lyrics[BARD_SOUND_MAX_LENGTH];
/*0x18*/ struct BardPhoneme phonemes[BARD_SOUND_MAX_LENGTH];
/*0x30*/ const struct BardSound *sound;
u8 lyricsIndex;
u8 soundIndex;
u8 timer;
u8 state;
s16 length; // Length of the sound for the word currently being sung (i.e. the sum of 'length' in all the current word's phonemes).
u16 volume;
s16 pitch;
s16 voiceInflection;
u16 lyrics[NUM_BARD_SONG_WORDS];
struct BardSound sounds[MAX_BARD_SOUNDS_PER_WORD];
const struct BardSoundTemplate *soundTemplates;
};
extern const u16 gNumBardWords_Species;
extern const u16 gNumBardWords_Moves;
const struct BardSound *GetWordSounds(u16 word);
void GetWordPhonemes(struct BardSong *song, u16 word);
const struct BardSoundTemplate *GetWordSoundTemplates(u16 easyChatWord);
void CalcWordSounds(struct BardSong *song, u16 pitchTableIndex);
#endif //GUARD_BARD_MUSIC_H

View File

@@ -114,7 +114,7 @@
#define FEMALE 1
#define GENDER_COUNT 2
#define BARD_SONG_LENGTH 6
#define NUM_BARD_SONG_WORDS 6
#define NUM_STORYTELLER_TALES 4
#define NUM_TRADER_ITEMS 4
#define GIDDY_MAX_TALES 10

View File

@@ -489,6 +489,8 @@
#define MUS_RG_SLOW_PALLET 557 // MUS_RG_SLOWMASARA
#define MUS_RG_TEACHY_TV_MENU 558 // MUS_RG_TVNOIZE
// These PH_* constants are phoneme sounds used by the "bard" NPC (see src/bard_music.c and src/mauville_old_man.c).
// Each comes in a triplet of PH_*_BLEND, PH_*_HELD, and PH_*_SOLO, and the name of each triplet incorporates the English phonetic sound it represents.
#define PH_TRAP_BLEND 559
#define PH_TRAP_HELD 560
#define PH_TRAP_SOLO 561
@@ -545,4 +547,10 @@
#define MUS_NONE 0xFFFF
#define FIRST_PHONEME_SONG PH_TRAP_BLEND
#define LAST_PHONEME_SONG PH_NURSE_SOLO
#define NUM_PHONEME_SONGS (LAST_PHONEME_SONG - FIRST_PHONEME_SONG + 1)
#define PHONEME_ID(song) ((song) - FIRST_PHONEME_SONG)
#define PHONEME_ID_NONE 0xFF
#endif // GUARD_CONSTANTS_SONGS_H

View File

@@ -649,8 +649,8 @@ struct MauvilleManBard
{
/*0x00*/ u8 id;
/*0x01*/ //u8 padding1;
/*0x02*/ u16 songLyrics[BARD_SONG_LENGTH];
/*0x0E*/ u16 temporaryLyrics[BARD_SONG_LENGTH];
/*0x02*/ u16 songLyrics[NUM_BARD_SONG_WORDS];
/*0x0E*/ u16 newSongLyrics[NUM_BARD_SONG_WORDS];
/*0x1A*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x22*/ u8 filler_2DB6[0x3];
/*0x25*/ u8 playerTrainerId[TRAINER_ID_LENGTH];