Disambiguate cry functions

This commit is contained in:
GriffinR 2021-11-07 13:54:44 -05:00
parent 54b254a829
commit c4169cfd29
31 changed files with 125 additions and 102 deletions

View File

@ -8500,11 +8500,11 @@ Move_BLAZE_KICK:
Move_HYPER_VOICE: Move_HYPER_VOICE:
loadspritegfx ANIM_TAG_THIN_RING loadspritegfx ANIM_TAG_THIN_RING
createvisualtask SoundTask_PlayCryWithEcho, 5, 0 createvisualtask SoundTask_PlayCryWithEcho, 5, FALSE
call HyperVoiceEffect call HyperVoiceEffect
waitforvisualfinish waitforvisualfinish
delay 8 delay 8
createvisualtask SoundTask_PlayCryWithEcho, 5, 1 createvisualtask SoundTask_PlayCryWithEcho, 5, TRUE
call HyperVoiceEffect call HyperVoiceEffect
waitforvisualfinish waitforvisualfinish
end end

View File

@ -38,4 +38,11 @@
#define DOUBLE_CRY_ROAR 2 #define DOUBLE_CRY_ROAR 2
#define DOUBLE_CRY_GROWL 255 #define DOUBLE_CRY_GROWL 255
#define CRY_PRIORITY_NORMAL 10
#define CRY_PRIORITY_AMBIENT 1
// Cry volume was changed from 125 in R/S to 120 for FRLG/Em, but was (accidentally?) not updated outside of sound.c
#define CRY_VOLUME 120
#define CRY_VOLUME_RS 125
#endif // GUARD_CONSTANTS_SOUND_H #endif // GUARD_CONSTANTS_SOUND_H

View File

@ -25,12 +25,12 @@ bool8 IsBGMPausedOrStopped(void);
void FadeInBGM(u8 speed); void FadeInBGM(u8 speed);
void FadeOutBGM(u8 speed); void FadeOutBGM(u8 speed);
bool8 IsBGMStopped(void); bool8 IsBGMStopped(void);
void PlayCry1(u16 species, s8 pan); void PlayCry_Normal(u16 species, s8 pan);
void PlayCry2(u16 species, s8 pan, s8 volume, u8 priority); void PlayCry_NormalNoDucking(u16 species, s8 pan, s8 volume, u8 priority);
void PlayCry3(u16 species, s8 pan, u8 mode); void PlayCry_ByMode(u16 species, s8 pan, u8 mode);
void PlayCry4(u16 species, s8 pan, u8 mode); void PlayCry_ReleaseDouble(u16 species, s8 pan, u8 mode);
void PlayCry5(u16 species, u8 mode); void PlayCry_Script(u16 species, u8 mode);
void PlayCry6(u16 species, s8 pan, u8 mode); void PlayCry_DuckNoRestore(u16 species, s8 pan, u8 mode);
void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode); void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode);
bool8 IsCryFinished(void); bool8 IsCryFinished(void);
void StopCryAndClearCrySongs(void); void StopCryAndClearCrySongs(void);

View File

@ -168,7 +168,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId)
} }
if (species != SPECIES_NONE) if (species != SPECIES_NONE)
PlayCry3(species, pan, CRY_MODE_HIGH_PITCH); PlayCry_ByMode(species, pan, CRY_MODE_HIGH_PITCH);
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
} }
@ -220,9 +220,9 @@ void SoundTask_PlayDoubleCry(u8 taskId)
if (species != SPECIES_NONE) if (species != SPECIES_NONE)
{ {
if (gBattleAnimArgs[1] == DOUBLE_CRY_GROWL) if (gBattleAnimArgs[1] == DOUBLE_CRY_GROWL)
PlayCry3(species, pan, CRY_MODE_GROWL_1); PlayCry_ByMode(species, pan, CRY_MODE_GROWL_1);
else // DOUBLE_CRY_ROAR else // DOUBLE_CRY_ROAR
PlayCry3(species, pan, CRY_MODE_ROAR_1); PlayCry_ByMode(species, pan, CRY_MODE_ROAR_1);
gTasks[taskId].func = SoundTask_PlayDoubleCry_Step; gTasks[taskId].func = SoundTask_PlayDoubleCry_Step;
} }
@ -247,7 +247,7 @@ static void SoundTask_PlayDoubleCry_Step(u8 taskId)
{ {
if (!IsCryPlaying()) if (!IsCryPlaying())
{ {
PlayCry3(species, pan, CRY_MODE_GROWL_2); PlayCry_ByMode(species, pan, CRY_MODE_GROWL_2);
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
} }
} }
@ -255,7 +255,7 @@ static void SoundTask_PlayDoubleCry_Step(u8 taskId)
{ {
if (!IsCryPlaying()) if (!IsCryPlaying())
{ {
PlayCry3(species, pan, CRY_MODE_ROAR_2); PlayCry_ByMode(species, pan, CRY_MODE_ROAR_2);
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
} }
} }
@ -275,12 +275,18 @@ void SoundTask_WaitForCry(u8 taskId)
} }
} }
#define tSpecies data[1]
#define tPan data[2]
#define tState data[9]
#define tLastCry data[10] // If it's not the last cry, don't try to restore the BGM, because another is coming
void SoundTask_PlayCryWithEcho(u8 taskId) void SoundTask_PlayCryWithEcho(u8 taskId)
{ {
u16 species; u16 species;
s8 pan; s8 pan;
gTasks[taskId].data[10] = gBattleAnimArgs[0]; gTasks[taskId].tLastCry = gBattleAnimArgs[0];
pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER); pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
if (IsContest()) if (IsContest())
@ -288,8 +294,8 @@ void SoundTask_PlayCryWithEcho(u8 taskId)
else else
species = gAnimBattlerSpecies[gBattleAnimAttacker]; species = gAnimBattlerSpecies[gBattleAnimAttacker];
gTasks[taskId].data[1] = species; gTasks[taskId].tSpecies = species;
gTasks[taskId].data[2] = pan; gTasks[taskId].tPan = pan;
if (species != SPECIES_NONE) if (species != SPECIES_NONE)
gTasks[taskId].func = SoundTask_PlayCryWithEcho_Step; gTasks[taskId].func = SoundTask_PlayCryWithEcho_Step;
@ -299,39 +305,44 @@ void SoundTask_PlayCryWithEcho(u8 taskId)
static void SoundTask_PlayCryWithEcho_Step(u8 taskId) static void SoundTask_PlayCryWithEcho_Step(u8 taskId)
{ {
u16 species = gTasks[taskId].data[1]; u16 species = gTasks[taskId].tSpecies;
s8 pan = gTasks[taskId].data[2]; s8 pan = gTasks[taskId].tPan;
// Note the cases are not in order of execution // Note the cases are not in order of execution
switch (gTasks[taskId].data[9]) switch (gTasks[taskId].tState)
{ {
case 2: case 2:
PlayCry6(species, pan, CRY_MODE_ECHO_END); PlayCry_DuckNoRestore(species, pan, CRY_MODE_ECHO_END);
gTasks[taskId].data[9]++; gTasks[taskId].tState++;
break; break;
case 1: case 1:
case 3: case 3:
case 4: case 4:
gTasks[taskId].data[9]++; gTasks[taskId].tState++;
break; break;
case 5: case 5:
if (IsCryPlaying()) if (IsCryPlaying())
break; break;
case 0: case 0:
StopCryAndClearCrySongs(); StopCryAndClearCrySongs();
gTasks[taskId].data[9]++; gTasks[taskId].tState++;
break; break;
default: default:
if (gTasks[taskId].data[10] == 0) if (!gTasks[taskId].tLastCry)
PlayCry6(species, pan, CRY_MODE_ECHO_START); PlayCry_DuckNoRestore(species, pan, CRY_MODE_ECHO_START);
else else
PlayCry3(species, pan, CRY_MODE_ECHO_START); PlayCry_ByMode(species, pan, CRY_MODE_ECHO_START);
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
break; break;
} }
} }
#undef tSpecies
#undef tPan
#undef tState
#undef tLastCry
void SoundTask_PlaySE1WithPanning(u8 taskId) void SoundTask_PlaySE1WithPanning(u8 taskId)
{ {
u16 songId = gBattleAnimArgs[0]; u16 songId = gBattleAnimArgs[0];

View File

@ -1681,7 +1681,7 @@ static void LinkOpponentHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, 25, CRY_MODE_FAINT); PlayCry_ByMode(species, 25, CRY_MODE_FAINT);
LinkOpponentBufferExecCompleted(); LinkOpponentBufferExecCompleted();
} }

View File

@ -1513,7 +1513,7 @@ static void LinkPartnerHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, -25, CRY_MODE_FAINT); PlayCry_ByMode(species, -25, CRY_MODE_FAINT);
LinkPartnerBufferExecCompleted(); LinkPartnerBufferExecCompleted();
} }

View File

@ -1847,7 +1847,7 @@ static void OpponentHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, 25, CRY_MODE_FAINT); PlayCry_ByMode(species, 25, CRY_MODE_FAINT);
OpponentBufferExecCompleted(); OpponentBufferExecCompleted();
} }

View File

@ -2926,7 +2926,7 @@ static void PlayerHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, -25, CRY_MODE_FAINT); PlayCry_ByMode(species, -25, CRY_MODE_FAINT);
PlayerBufferExecCompleted(); PlayerBufferExecCompleted();
} }

View File

@ -1763,7 +1763,7 @@ static void PlayerPartnerHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, -25, CRY_MODE_FAINT); PlayCry_ByMode(species, -25, CRY_MODE_FAINT);
PlayerPartnerBufferExecCompleted(); PlayerPartnerBufferExecCompleted();
} }

View File

@ -1621,7 +1621,7 @@ static void RecordedOpponentHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, 25, CRY_MODE_FAINT); PlayCry_ByMode(species, 25, CRY_MODE_FAINT);
RecordedOpponentBufferExecCompleted(); RecordedOpponentBufferExecCompleted();
} }

View File

@ -1644,7 +1644,7 @@ static void RecordedPlayerHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, -25, CRY_MODE_FAINT); PlayCry_ByMode(species, -25, CRY_MODE_FAINT);
RecordedPlayerBufferExecCompleted(); RecordedPlayerBufferExecCompleted();
} }

View File

@ -616,7 +616,7 @@ static void SafariHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry1(species, 25); PlayCry_Normal(species, 25);
SafariBufferExecCompleted(); SafariBufferExecCompleted();
} }

View File

@ -1415,7 +1415,9 @@ static void WallyHandleFaintingCry(void)
{ {
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry1(species, 25); // Seems that it doesn't bother using CRY_MODE_FAINT because
// Wally's Pokémon during the tutorial is never intended to faint.
PlayCry_Normal(species, 25);
WallyBufferExecCompleted(); WallyBufferExecCompleted();
} }

View File

@ -1578,7 +1578,7 @@ static void SpriteCB_WinnerMonSlideIn(struct Sprite *sprite)
{ {
if (++sprite->data[0] == 10) if (++sprite->data[0] == 10)
{ {
PlayCry1(sprite->data[1], 0); PlayCry_Normal(sprite->data[1], 0);
sprite->data[1] = 0; sprite->data[1] = 0;
} }
} }

View File

@ -1094,7 +1094,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
case T_EVOSTATE_INTRO_CRY: case T_EVOSTATE_INTRO_CRY:
if (!IsTextPrinterActive(0)) if (!IsTextPrinterActive(0))
{ {
PlayCry1(gTasks[taskId].tPreEvoSpecies, 0); PlayCry_Normal(gTasks[taskId].tPreEvoSpecies, 0);
gTasks[taskId].tState++; gTasks[taskId].tState++;
} }
break; break;

View File

@ -2565,15 +2565,17 @@ bool8 FldEff_FieldMoveShowMon(void)
return FALSE; return FALSE;
} }
#define SHOW_MON_CRY_NO_DUCKING (1 << 31)
bool8 FldEff_FieldMoveShowMonInit(void) bool8 FldEff_FieldMoveShowMonInit(void)
{ {
struct Pokemon *pokemon; struct Pokemon *pokemon;
u32 flag = gFieldEffectArguments[0] & 0x80000000; bool32 noDucking = gFieldEffectArguments[0] & SHOW_MON_CRY_NO_DUCKING;
pokemon = &gPlayerParty[(u8)gFieldEffectArguments[0]]; pokemon = &gPlayerParty[(u8)gFieldEffectArguments[0]];
gFieldEffectArguments[0] = GetMonData(pokemon, MON_DATA_SPECIES); gFieldEffectArguments[0] = GetMonData(pokemon, MON_DATA_SPECIES);
gFieldEffectArguments[1] = GetMonData(pokemon, MON_DATA_OT_ID); gFieldEffectArguments[1] = GetMonData(pokemon, MON_DATA_OT_ID);
gFieldEffectArguments[2] = GetMonData(pokemon, MON_DATA_PERSONALITY); gFieldEffectArguments[2] = GetMonData(pokemon, MON_DATA_PERSONALITY);
gFieldEffectArguments[0] |= flag; gFieldEffectArguments[0] |= noDucking;
FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON); FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON);
FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON_INIT);
return FALSE; return FALSE;
@ -2913,17 +2915,17 @@ static bool8 SlideIndoorBannerOffscreen(struct Task *task)
static u8 InitFieldMoveMonSprite(u32 species, u32 otId, u32 personality) static u8 InitFieldMoveMonSprite(u32 species, u32 otId, u32 personality)
{ {
u16 v0; bool16 noDucking;
u8 monSprite; u8 monSprite;
struct Sprite *sprite; struct Sprite *sprite;
v0 = (species & 0x80000000) >> 16; noDucking = (species & SHOW_MON_CRY_NO_DUCKING) >> 16;
species &= 0x7fffffff; species &= ~SHOW_MON_CRY_NO_DUCKING;
monSprite = CreateMonSprite_FieldMove(species, otId, personality, 320, 80, 0); monSprite = CreateMonSprite_FieldMove(species, otId, personality, 320, 80, 0);
sprite = &gSprites[monSprite]; sprite = &gSprites[monSprite];
sprite->callback = SpriteCallbackDummy; sprite->callback = SpriteCallbackDummy;
sprite->oam.priority = 0; sprite->oam.priority = 0;
sprite->sSpecies = species; sprite->sSpecies = species;
sprite->data[6] = v0; sprite->data[6] = noDucking;
return monSprite; return monSprite;
} }
@ -2935,13 +2937,9 @@ static void SpriteCB_FieldMoveMonSlideOnscreen(struct Sprite *sprite)
sprite->sOnscreenTimer = 30; sprite->sOnscreenTimer = 30;
sprite->callback = SpriteCB_FieldMoveMonWaitAfterCry; sprite->callback = SpriteCB_FieldMoveMonWaitAfterCry;
if (sprite->data[6]) if (sprite->data[6])
{ PlayCry_NormalNoDucking(sprite->sSpecies, 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
PlayCry2(sprite->sSpecies, 0, 0x7d, 0xa);
}
else else
{ PlayCry_Normal(sprite->sSpecies, 0);
PlayCry1(sprite->sSpecies, 0);
}
} }
} }
@ -3021,7 +3019,7 @@ static void SurfFieldEffect_ShowMon(struct Task *task)
objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
if (ObjectEventCheckHeldMovementStatus(objectEvent)) if (ObjectEventCheckHeldMovementStatus(objectEvent))
{ {
gFieldEffectArguments[0] = task->tMonId | 0x80000000; gFieldEffectArguments[0] = task->tMonId | SHOW_MON_CRY_NO_DUCKING;
FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT); FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT);
task->tState++; task->tState++;
} }

View File

@ -983,7 +983,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
if (currMon->species != SPECIES_EGG) if (currMon->species != SPECIES_EGG)
{ {
StopCryAndClearCrySongs(); StopCryAndClearCrySongs();
PlayCry1(currMon->species, 0); PlayCry_Normal(currMon->species, 0);
} }
HallOfFame_PrintMonInfo(currMon, 0, 14); HallOfFame_PrintMonInfo(currMon, 0, 14);

View File

@ -1925,7 +1925,7 @@ static void Task_Scene3_Groudon(u8 taskId)
tScreenX = 80; tScreenX = 80;
tScreenY = 41; tScreenY = 41;
tDelay = 16; tDelay = 16;
PlayCryInternal(SPECIES_GROUDON, 0, 100, 10, CRY_MODE_NORMAL); PlayCryInternal(SPECIES_GROUDON, 0, 100, CRY_PRIORITY_NORMAL, CRY_MODE_NORMAL);
tState++; tState++;
} }
break; break;
@ -2127,7 +2127,7 @@ static void Task_Scene3_Kyogre(u8 taskId)
{ {
tDelay = 1; tDelay = 1;
tState++; tState++;
PlayCryInternal(SPECIES_KYOGRE, 0, 120, 10, 0); PlayCryInternal(SPECIES_KYOGRE, 0, 120, CRY_PRIORITY_NORMAL, CRY_MODE_NORMAL);
} }
} }
break; break;

View File

@ -1254,7 +1254,7 @@ static void PlayAmbientCry(void)
return; return;
pan = (Random() % 88) + 212; pan = (Random() % 88) + 212;
volume = (Random() % 30) + 50; volume = (Random() % 30) + 50;
PlayCry2(sAmbientCrySpecies, pan, volume, 1); PlayCry_NormalNoDucking(sAmbientCrySpecies, pan, volume, CRY_PRIORITY_AMBIENT);
} }
void UpdateAmbientCry(s16 *state, u16 *delayCounter) void UpdateAmbientCry(s16 *state, u16 *delayCounter)

View File

@ -665,10 +665,11 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
gTasks[taskId].tCryTaskState = wantedCry + 1; gTasks[taskId].tCryTaskState = wantedCry + 1;
break; break;
case 1: case 1:
// Play single cry
if (ShouldPlayNormalMonCry(mon) == TRUE) if (ShouldPlayNormalMonCry(mon) == TRUE)
PlayCry3(species, pan, CRY_MODE_NORMAL); PlayCry_ByMode(species, pan, CRY_MODE_NORMAL);
else else
PlayCry3(species, pan, CRY_MODE_WEAK); PlayCry_ByMode(species, pan, CRY_MODE_WEAK);
gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE;
DestroyTask(taskId); DestroyTask(taskId);
break; break;
@ -680,10 +681,11 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
case 20: case 20:
if (gTasks[taskId].tCryTaskFrames == 0) if (gTasks[taskId].tCryTaskFrames == 0)
{ {
// Play first doubles cry
if (ShouldPlayNormalMonCry(mon) == TRUE) if (ShouldPlayNormalMonCry(mon) == TRUE)
PlayCry4(species, pan, CRY_MODE_DOUBLES); PlayCry_ReleaseDouble(species, pan, CRY_MODE_DOUBLES);
else else
PlayCry4(species, pan, CRY_MODE_WEAK_DOUBLES); PlayCry_ReleaseDouble(species, pan, CRY_MODE_WEAK_DOUBLES);
gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE;
DestroyTask(taskId); DestroyTask(taskId);
@ -719,10 +721,11 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
gTasks[taskId].tCryTaskFrames--; gTasks[taskId].tCryTaskFrames--;
break; break;
} }
// Play second doubles cry
if (ShouldPlayNormalMonCry(mon) == TRUE) if (ShouldPlayNormalMonCry(mon) == TRUE)
PlayCry4(species, pan, CRY_MODE_NORMAL); PlayCry_ReleaseDouble(species, pan, CRY_MODE_NORMAL);
else else
PlayCry4(species, pan, CRY_MODE_WEAK); PlayCry_ReleaseDouble(species, pan, CRY_MODE_WEAK);
gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE;
DestroyTask(taskId); DestroyTask(taskId);

View File

@ -945,7 +945,7 @@ static void SpriteCB_MonJumpForPokeblock(struct Sprite* sprite)
// Play cry at jump peak // Play cry at jump peak
if (sprite->sSpeed == 0) if (sprite->sSpeed == 0)
PlayCry1(sprite->sSpecies, 0); PlayCry_Normal(sprite->sSpecies, 0);
if (sprite->sSpeed == 9) if (sprite->sSpeed == 9)
sprite->callback = SpriteCallbackDummy; sprite->callback = SpriteCallbackDummy;

View File

@ -3309,7 +3309,7 @@ static void Task_LoadInfoScreen(u8 taskId)
if (!gTasks[taskId].tSkipCry) if (!gTasks[taskId].tSkipCry)
{ {
StopCryAndClearCrySongs(); StopCryAndClearCrySongs();
PlayCry2(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 125, 10); PlayCry_NormalNoDucking(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
} }
else else
{ {
@ -4010,7 +4010,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
case 6: case 6:
if (!gPaletteFade.active) if (!gPaletteFade.active)
{ {
PlayCry1(NationalPokedexNumToSpecies(dexNum), 0); PlayCry_Normal(NationalPokedexNumToSpecies(dexNum), 0);
gTasks[taskId].tPalTimer = 0; gTasks[taskId].tPalTimer = 0;
gTasks[taskId].func = Task_HandleCaughtMonPageInput; gTasks[taskId].func = Task_HandleCaughtMonPageInput;
} }

View File

@ -345,7 +345,7 @@ void CryScreenPlayButton(u16 species)
static void PlayCryScreenCry(u16 species) static void PlayCryScreenCry(u16 species)
{ {
PlayCry2(species, 0, 125, 10); PlayCry_NormalNoDucking(species, 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
sDexCryScreen->cryState = 1; sDexCryScreen->cryState = 1;
} }

View File

@ -6690,14 +6690,14 @@ void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry,
{ {
// No animation, only check if cry needs to be played // No animation, only check if cry needs to be played
if (!noCry) if (!noCry)
PlayCry1(species, pan); PlayCry_Normal(species, pan);
sprite->callback = SpriteCallbackDummy; sprite->callback = SpriteCallbackDummy;
} }
else else
{ {
if (!noCry) if (!noCry)
{ {
PlayCry1(species, pan); PlayCry_Normal(species, pan);
if (HasTwoFramesAnimation(species)) if (HasTwoFramesAnimation(species))
StartSpriteAnim(sprite, 1); StartSpriteAnim(sprite, 1);
} }

View File

@ -3929,9 +3929,9 @@ static void PlayMonCry(void)
if (!summary->isEgg) if (!summary->isEgg)
{ {
if (ShouldPlayNormalMonCry(&sMonSummaryScreen->currentMon) == TRUE) if (ShouldPlayNormalMonCry(&sMonSummaryScreen->currentMon) == TRUE)
PlayCry3(summary->species2, 0, CRY_MODE_NORMAL); PlayCry_ByMode(summary->species2, 0, CRY_MODE_NORMAL);
else else
PlayCry3(summary->species2, 0, CRY_MODE_WEAK); PlayCry_ByMode(summary->species2, 0, CRY_MODE_WEAK);
} }
} }

View File

@ -3064,7 +3064,7 @@ static void SpriteCB_ChasesAway_Rayquaza(struct Sprite *sprite)
ChasesAway_SetRayquazaAnim(sprite, 3, 48, 16); ChasesAway_SetRayquazaAnim(sprite, 3, 48, 16);
sprite->x2 = 1; sprite->x2 = 1;
gSprites[sprite->sTailSpriteId].x2 = 1; gSprites[sprite->sTailSpriteId].x2 = 1;
PlayCry1(SPECIES_RAYQUAZA, 0); PlayCry_Normal(SPECIES_RAYQUAZA, 0);
CreateTask(Task_ChasesAway_AnimateRing, 0); CreateTask(Task_ChasesAway_AnimateRing, 0);
} }
else else

View File

@ -4449,13 +4449,13 @@ static void SetBallStuck(struct Sprite *sprite)
if (sRoulette->useTaillow) if (sRoulette->useTaillow)
{ {
if (sprite->sStuckOnWheelLeft) if (sprite->sStuckOnWheelLeft)
PlayCry1(SPECIES_TAILLOW, -63); PlayCry_Normal(SPECIES_TAILLOW, -63);
else else
PlayCry1(SPECIES_TAILLOW, 63); PlayCry_Normal(SPECIES_TAILLOW, 63);
} }
else else
{ {
PlayCry1(SPECIES_SHROOMISH, -63); PlayCry_Normal(SPECIES_SHROOMISH, -63);
} }
slotsToSkip = 2; slotsToSkip = 2;
@ -4719,9 +4719,9 @@ static void SpriteCB_Taillow_FlyIn(struct Sprite *sprite)
{ {
m4aSongNumStartOrChange(SE_TAILLOW_WING_FLAP); m4aSongNumStartOrChange(SE_TAILLOW_WING_FLAP);
if (sRoulette->ball->sStuckOnWheelLeft == 0) if (sRoulette->ball->sStuckOnWheelLeft == 0)
PlayCry1(SPECIES_TAILLOW, 63); PlayCry_Normal(SPECIES_TAILLOW, 63);
else else
PlayCry1(SPECIES_TAILLOW, -63); PlayCry_Normal(SPECIES_TAILLOW, -63);
StartSpriteAnim(sprite, sRoulette->ball->sStuckOnWheelLeft + 2); StartSpriteAnim(sprite, sRoulette->ball->sStuckOnWheelLeft + 2);
sprite->data[1] = 45; sprite->data[1] = 45;
sprite->callback = SpriteCB_Taillow_PickUpBall; sprite->callback = SpriteCB_Taillow_PickUpBall;

View File

@ -2026,7 +2026,7 @@ bool8 ScrCmd_playmoncry(struct ScriptContext *ctx)
u16 species = VarGet(ScriptReadHalfword(ctx)); u16 species = VarGet(ScriptReadHalfword(ctx));
u16 mode = VarGet(ScriptReadHalfword(ctx)); u16 mode = VarGet(ScriptReadHalfword(ctx));
PlayCry5(species, mode); PlayCry_Script(species, mode);
return FALSE; return FALSE;
} }

View File

@ -54,8 +54,6 @@ static const struct Fanfare sFanfares[] = {
[FANFARE_REGISTER_MATCH_CALL] = { MUS_REGISTER_MATCH_CALL, 135 }, [FANFARE_REGISTER_MATCH_CALL] = { MUS_REGISTER_MATCH_CALL, 135 },
}; };
#define CRY_VOLUME 120 // was 125 in R/S
void InitMapMusic(void) void InitMapMusic(void)
{ {
gDisableMusic = FALSE; gDisableMusic = FALSE;
@ -300,66 +298,69 @@ bool8 IsBGMStopped(void)
return FALSE; return FALSE;
} }
void PlayCry1(u16 species, s8 pan) void PlayCry_Normal(u16 species, s8 pan)
{ {
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85); m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, CRY_MODE_NORMAL); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, CRY_MODE_NORMAL);
gPokemonCryBGMDuckingCounter = 2; gPokemonCryBGMDuckingCounter = 2;
RestoreBGMVolumeAfterPokemonCry(); RestoreBGMVolumeAfterPokemonCry();
} }
void PlayCry2(u16 species, s8 pan, s8 volume, u8 priority) void PlayCry_NormalNoDucking(u16 species, s8 pan, s8 volume, u8 priority)
{ {
PlayCryInternal(species, pan, volume, priority, CRY_MODE_NORMAL); PlayCryInternal(species, pan, volume, priority, CRY_MODE_NORMAL);
} }
void PlayCry3(u16 species, s8 pan, u8 mode) // Assuming it's not CRY_MODE_DOUBLES, this is equivalent to PlayCry_Normal except it allows other modes.
void PlayCry_ByMode(u16 species, s8 pan, u8 mode)
{ {
if (mode == CRY_MODE_DOUBLES) if (mode == CRY_MODE_DOUBLES)
{ {
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
} }
else else
{ {
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85); m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
gPokemonCryBGMDuckingCounter = 2; gPokemonCryBGMDuckingCounter = 2;
RestoreBGMVolumeAfterPokemonCry(); RestoreBGMVolumeAfterPokemonCry();
} }
} }
void PlayCry4(u16 species, s8 pan, u8 mode) // Used when releasing multiple Pokémon at once in battle.
void PlayCry_ReleaseDouble(u16 species, s8 pan, u8 mode)
{ {
if (mode == CRY_MODE_DOUBLES) if (mode == CRY_MODE_DOUBLES)
{ {
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
} }
else else
{ {
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85); m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
} }
} }
void PlayCry6(u16 species, s8 pan, u8 mode) // not present in R/S // Duck the BGM but don't restore it. Not present in R/S
void PlayCry_DuckNoRestore(u16 species, s8 pan, u8 mode)
{ {
if (mode == CRY_MODE_DOUBLES) if (mode == CRY_MODE_DOUBLES)
{ {
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
} }
else else
{ {
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85); m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode); PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
gPokemonCryBGMDuckingCounter = 2; gPokemonCryBGMDuckingCounter = 2;
} }
} }
void PlayCry5(u16 species, u8 mode) void PlayCry_Script(u16 species, u8 mode)
{ {
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85); m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, 0, CRY_VOLUME, 10, mode); PlayCryInternal(species, 0, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
gPokemonCryBGMDuckingCounter = 2; gPokemonCryBGMDuckingCounter = 2;
RestoreBGMVolumeAfterPokemonCry(); RestoreBGMVolumeAfterPokemonCry();
} }
@ -470,25 +471,26 @@ void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
index = species % 128; index = species % 128;
table = species / 128; table = species / 128;
#define GET_CRY(speciesIndex, tableId, reversed) \
((reversed) ? &gCryTable_Reverse[(128 * (tableId)) + (speciesIndex)] : &gCryTable[(128 * (tableId)) + (speciesIndex)])
switch (table) switch (table)
{ {
case 0: case 0:
gMPlay_PokemonCry = SetPokemonCryTone( gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 0, reverse));
reverse ? &gCryTable_Reverse[(128 * 0) + index] : &gCryTable[(128 * 0) + index]);
break; break;
case 1: case 1:
gMPlay_PokemonCry = SetPokemonCryTone( gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 1, reverse));
reverse ? &gCryTable_Reverse[(128 * 1) + index] : &gCryTable[(128 * 1) + index]);
break; break;
case 2: case 2:
gMPlay_PokemonCry = SetPokemonCryTone( gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 2, reverse));
reverse ? &gCryTable_Reverse[(128 * 2) + index] : &gCryTable[(128 * 2) + index]);
break; break;
case 3: case 3:
gMPlay_PokemonCry = SetPokemonCryTone( gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 3, reverse));
reverse ? &gCryTable_Reverse[(128 * 3) + index] : &gCryTable[(128 * 3) + index]);
break; break;
} }
#undef GET_CRY
} }
bool8 IsCryFinished(void) bool8 IsCryFinished(void)

View File

@ -532,7 +532,7 @@ static void Task_WaitForStarterSprite(u8 taskId)
static void Task_AskConfirmStarter(u8 taskId) static void Task_AskConfirmStarter(u8 taskId)
{ {
PlayCry1(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0); PlayCry_Normal(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0);
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, FONT_NORMAL, gText_ConfirmStarterChoice, 0, 1, 0, NULL); AddTextPrinterParameterized(0, FONT_NORMAL, gText_ConfirmStarterChoice, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);

View File

@ -3398,7 +3398,7 @@ static bool8 AnimateTradeSequenceCable(void)
DrawTextOnTradeWindow(0, gStringVar4, 0); DrawTextOnTradeWindow(0, gStringVar4, 0);
if (sTradeData->monSpecies[TRADE_PLAYER] != SPECIES_EGG) if (sTradeData->monSpecies[TRADE_PLAYER] != SPECIES_EGG)
PlayCry1(sTradeData->monSpecies[TRADE_PLAYER], 0); PlayCry_Normal(sTradeData->monSpecies[TRADE_PLAYER], 0);
sTradeData->state = TS_STATE_BYE_BYE; sTradeData->state = TS_STATE_BYE_BYE;
sTradeData->timer = 0; sTradeData->timer = 0;
@ -3869,7 +3869,7 @@ static bool8 AnimateTradeSequenceWireless(void)
DrawTextOnTradeWindow(0, gStringVar4, 0); DrawTextOnTradeWindow(0, gStringVar4, 0);
if (sTradeData->monSpecies[TRADE_PLAYER] != SPECIES_EGG) if (sTradeData->monSpecies[TRADE_PLAYER] != SPECIES_EGG)
PlayCry1(sTradeData->monSpecies[TRADE_PLAYER], 0); PlayCry_Normal(sTradeData->monSpecies[TRADE_PLAYER], 0);
sTradeData->state = TS_STATE_BYE_BYE; sTradeData->state = TS_STATE_BYE_BYE;
sTradeData->timer = 0; sTradeData->timer = 0;