forked from danenders/pkedx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bard_music.c
63 lines (57 loc) · 1.5 KB
/
bard_music.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "global.h"
#include "bard_music.h"
#include "easy_chat.h"
#include "data/bard_music/bard_sounds.h"
#include "data/bard_music/word_pitch.h"
#include "data/bard_music/default_sound.h"
#include "data/bard_music/length_table.h"
static s16 CalcWordPitch(int arg0, int songPos)
{
return sBardSoundPitchTables[arg0][songPos];
}
const struct BardSound *GetWordSounds(u16 word)
{
u32 category;
u32 subword;
const struct BardSound (*ptr)[6];
if (IsBardWordInvalid(word))
{
return gBardSound_InvalidWord;
}
category = EC_GROUP(word);
subword = EC_INDEX(word);
switch (category)
{
case EC_GROUP_POKEMON:
case EC_GROUP_POKEMON_NATIONAL:
ptr = gBardSounds_Pokemon;
break;
case EC_GROUP_MOVE_1:
case EC_GROUP_MOVE_2:
ptr = gBardSounds_Moves;
break;
default:
ptr = gBardSoundsTable[category];
break;
}
ptr += subword;
return *ptr;
}
void GetWordPhonemes(struct BardSong *song, u16 word)
{
int i;
const struct BardSound *sound;
song->length = 0;
for (i = 0; i < 6; i ++)
{
sound = &song->sound[i];
if (sound->var00 != 0xFF)
{
song->phonemes[i].length = sound->var01 + gBardSoundLengthTable[sound->var00];
song->phonemes[i].pitch = CalcWordPitch(word + 30, i);
song->length += song->phonemes[i].length;
}
}
song->currPhoneme = 0;
song->voiceInflection = 0;
}