diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-08-28 19:37:20 -0400 |
---|---|---|
committer | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-08-28 19:37:20 -0400 |
commit | 6a2fbafd1407e479bbf0d8a5bfdd3734d105ef11 (patch) | |
tree | c50d9a967047882a7b0031365e51bf59ed59cab9 /src/engine | |
parent | 2885ae9185fa65e5c43229d23ac31a3f3c9a7a9d (diff) | |
parent | 51f791219e055aa4989c77e1373075bd71bf4b60 (diff) |
Merge branch 'master' of https://github.com/pret/pokeruby into refactor_src
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/sound.c | 59 |
1 files changed, 22 insertions, 37 deletions
diff --git a/src/engine/sound.c b/src/engine/sound.c index 8d23b7d7a..91f5e06a3 100644 --- a/src/engine/sound.c +++ b/src/engine/sound.c @@ -4,6 +4,7 @@ #include "battle.h" #include "m4a.h" #include "main.h" +#include "pokemon.h" #include "songs.h" #include "task.h" @@ -13,9 +14,6 @@ struct Fanfare u16 duration; }; -// FIXME: different prototype than definition -u32 SpeciesToCryId(u32); - extern u16 gBattleTypeFlags; static EWRAM_DATA struct MusicPlayerInfo *gMPlay_PokemonCry = NULL; @@ -355,21 +353,9 @@ void PlayCry5(u16 species, u8 mode) RestoreBGMVolumeAfterPokemonCry(); } -#define GET_CRY_PTR(a, b)\ -{\ - struct ToneData *tone;\ - if (v0)\ - tone = &a[index];\ - else\ - tone = &b[index];\ - gMPlay_PokemonCry = SetPokemonCryTone(tone);\ - break;\ -} - static void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode) { - u32 cryId; - u32 v0; + bool32 v0; u32 release; u32 length; u32 pitch; @@ -378,10 +364,7 @@ static void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode u8 table; species--; - - cryId = species; - - v0 = 0; + v0 = FALSE; release = 0; length = 140; pitch = 15360; @@ -427,26 +410,28 @@ static void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode SetPokemonCryChorus(chorus); SetPokemonCryPriority(priority); - asm(""); - asm(""); - asm(""); - asm(""); - asm(""); - asm(""); - asm(""); - - cryId = SpeciesToCryId(cryId); - index = 0x7F; - asm("" ::: "r0"); - index &= cryId; - table = cryId >> 7; + species = SpeciesToCryId(species); + index = species & 0x7F; + table = species >> 7; switch (table) { - case 0: GET_CRY_PTR(voicegroup_84537C0, voicegroup_8452590); - case 1: GET_CRY_PTR(voicegroup_8453DC0, voicegroup_8452B90); - case 2: GET_CRY_PTR(voicegroup_84543C0, voicegroup_8453190); - case 3: GET_CRY_PTR(voicegroup_84549C0, voicegroup_8453790); + case 0: + gMPlay_PokemonCry = SetPokemonCryTone( + v0 ? &voicegroup_84537C0[index] : &voicegroup_8452590[index]); + break; + case 1: + gMPlay_PokemonCry = SetPokemonCryTone( + v0 ? &voicegroup_8453DC0[index] : &voicegroup_8452B90[index]); + break; + case 2: + gMPlay_PokemonCry = SetPokemonCryTone( + v0 ? &voicegroup_84543C0[index] : &voicegroup_8453190[index]); + break; + case 3: + gMPlay_PokemonCry = SetPokemonCryTone( + v0 ? &voicegroup_84549C0[index] : &voicegroup_8453790[index]); + break; } } |