mirror of https://github.com/pret/pokeemerald.git
Merge pull request #1232 from Kurausukun/match_m4a
[LEAK INFORMED] Match FadeOutBody
This commit is contained in:
commit
585f313c64
20
src/m4a.c
20
src/m4a.c
|
@ -643,28 +643,17 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
||||||
s32 i;
|
s32 i;
|
||||||
struct MusicPlayerTrack *track;
|
struct MusicPlayerTrack *track;
|
||||||
u16 fadeOV;
|
u16 fadeOV;
|
||||||
#ifdef NONMATCHING
|
|
||||||
u16 mask;
|
|
||||||
#else
|
|
||||||
register u16 mask asm("r2");
|
|
||||||
#endif // NONMATCHING
|
|
||||||
|
|
||||||
if (mplayInfo->fadeOI == 0)
|
if (mplayInfo->fadeOI == 0)
|
||||||
return;
|
return;
|
||||||
|
if (--mplayInfo->fadeOC != 0)
|
||||||
mplayInfo->fadeOC--;
|
|
||||||
mask = 0xFFFF;
|
|
||||||
|
|
||||||
if (mplayInfo->fadeOC != 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mplayInfo->fadeOC = mplayInfo->fadeOI;
|
mplayInfo->fadeOC = mplayInfo->fadeOI;
|
||||||
|
|
||||||
if (mplayInfo->fadeOV & FADE_IN)
|
if (mplayInfo->fadeOV & FADE_IN)
|
||||||
{
|
{
|
||||||
mplayInfo->fadeOV += (4 << FADE_VOL_SHIFT);
|
if ((u16)(mplayInfo->fadeOV += (4 << FADE_VOL_SHIFT)) >= (64 << FADE_VOL_SHIFT))
|
||||||
|
|
||||||
if ((u16)(mplayInfo->fadeOV & mask) >= (64 << FADE_VOL_SHIFT))
|
|
||||||
{
|
{
|
||||||
mplayInfo->fadeOV = (64 << FADE_VOL_SHIFT);
|
mplayInfo->fadeOV = (64 << FADE_VOL_SHIFT);
|
||||||
mplayInfo->fadeOI = 0;
|
mplayInfo->fadeOI = 0;
|
||||||
|
@ -672,11 +661,8 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mplayInfo->fadeOV -= (4 << FADE_VOL_SHIFT);
|
if ((s16)(mplayInfo->fadeOV -= (4 << FADE_VOL_SHIFT)) <= 0)
|
||||||
|
|
||||||
if ((s16)(mplayInfo->fadeOV & mask) <= 0)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++)
|
for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
Loading…
Reference in New Issue