mirror of
https://github.com/pret/pokeruby.git
synced 2025-03-03 02:25:34 +00:00
fix PlayCryInternal (thanks, ProjectRevoTPP)
This commit is contained in:
parent
5c90a19682
commit
51f791219e
@ -576,6 +576,7 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum);
|
|||||||
u16 NationalToHoennOrder(u16);
|
u16 NationalToHoennOrder(u16);
|
||||||
u16 SpeciesToNationalPokedexNum(u16);
|
u16 SpeciesToNationalPokedexNum(u16);
|
||||||
u16 HoennToNationalOrder(u16);
|
u16 HoennToNationalOrder(u16);
|
||||||
|
u16 SpeciesToCryId(u16 species);
|
||||||
void DrawSpindaSpots(u16, u32, u8 *, u8);
|
void DrawSpindaSpots(u16, u32, u8 *, u8);
|
||||||
u8 sub_803FBBC(void);
|
u8 sub_803FBBC(void);
|
||||||
u8 sub_803FC58(u16);
|
u8 sub_803FC58(u16);
|
||||||
|
@ -457,7 +457,7 @@ u16 HoennToNationalOrder(u16 hoennNum)
|
|||||||
return gHoennToNationalOrder[hoennNum - 1];
|
return gHoennToNationalOrder[hoennNum - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 SpeciesToCryId(u16 species)
|
u16 SpeciesToCryId(u16 species)
|
||||||
{
|
{
|
||||||
if (species <= 250)
|
if (species <= 250)
|
||||||
return species;
|
return species;
|
||||||
|
59
src/sound.c
59
src/sound.c
@ -4,6 +4,7 @@
|
|||||||
#include "battle.h"
|
#include "battle.h"
|
||||||
#include "m4a.h"
|
#include "m4a.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "pokemon.h"
|
||||||
#include "songs.h"
|
#include "songs.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
@ -13,9 +14,6 @@ struct Fanfare
|
|||||||
u16 duration;
|
u16 duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: different prototype than definition
|
|
||||||
u32 SpeciesToCryId(u32);
|
|
||||||
|
|
||||||
extern u16 gBattleTypeFlags;
|
extern u16 gBattleTypeFlags;
|
||||||
|
|
||||||
static EWRAM_DATA struct MusicPlayerInfo *gMPlay_PokemonCry = NULL;
|
static EWRAM_DATA struct MusicPlayerInfo *gMPlay_PokemonCry = NULL;
|
||||||
@ -355,21 +353,9 @@ void PlayCry5(u16 species, u8 mode)
|
|||||||
RestoreBGMVolumeAfterPokemonCry();
|
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)
|
static void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
|
||||||
{
|
{
|
||||||
u32 cryId;
|
bool32 v0;
|
||||||
u32 v0;
|
|
||||||
u32 release;
|
u32 release;
|
||||||
u32 length;
|
u32 length;
|
||||||
u32 pitch;
|
u32 pitch;
|
||||||
@ -378,10 +364,7 @@ static void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode
|
|||||||
u8 table;
|
u8 table;
|
||||||
|
|
||||||
species--;
|
species--;
|
||||||
|
v0 = FALSE;
|
||||||
cryId = species;
|
|
||||||
|
|
||||||
v0 = 0;
|
|
||||||
release = 0;
|
release = 0;
|
||||||
length = 140;
|
length = 140;
|
||||||
pitch = 15360;
|
pitch = 15360;
|
||||||
@ -427,26 +410,28 @@ static void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode
|
|||||||
SetPokemonCryChorus(chorus);
|
SetPokemonCryChorus(chorus);
|
||||||
SetPokemonCryPriority(priority);
|
SetPokemonCryPriority(priority);
|
||||||
|
|
||||||
asm("");
|
species = SpeciesToCryId(species);
|
||||||
asm("");
|
index = species & 0x7F;
|
||||||
asm("");
|
table = species >> 7;
|
||||||
asm("");
|
|
||||||
asm("");
|
|
||||||
asm("");
|
|
||||||
asm("");
|
|
||||||
|
|
||||||
cryId = SpeciesToCryId(cryId);
|
|
||||||
index = 0x7F;
|
|
||||||
asm("" ::: "r0");
|
|
||||||
index &= cryId;
|
|
||||||
table = cryId >> 7;
|
|
||||||
|
|
||||||
switch (table)
|
switch (table)
|
||||||
{
|
{
|
||||||
case 0: GET_CRY_PTR(voicegroup_84537C0, voicegroup_8452590);
|
case 0:
|
||||||
case 1: GET_CRY_PTR(voicegroup_8453DC0, voicegroup_8452B90);
|
gMPlay_PokemonCry = SetPokemonCryTone(
|
||||||
case 2: GET_CRY_PTR(voicegroup_84543C0, voicegroup_8453190);
|
v0 ? &voicegroup_84537C0[index] : &voicegroup_8452590[index]);
|
||||||
case 3: GET_CRY_PTR(voicegroup_84549C0, voicegroup_8453790);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user