Synced sound.c

This commit is contained in:
Eduardo Quezada
2022-07-29 16:17:40 -04:00
parent 78e3780fa4
commit dfe6c6885c
64 changed files with 643 additions and 599 deletions
+2 -2
View File
@@ -1857,7 +1857,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
{
if (tableId == gMovesWithQuietBGM[i])
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 128);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 128);
break;
}
}
@@ -2127,7 +2127,7 @@ static void ScriptCmd_end(void)
if (!continuousAnim)
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
ResetSpritePriorityOfAllVisibleBattlers();
UpdateOamPriorityInAllHealthboxes(1);
gAnimScriptActive = FALSE;
+10 -9
View File
@@ -4,6 +4,7 @@
#include "battle_anim.h"
#include "task.h"
#include "constants/battle_anim.h"
#include "constants/sound.h"
static void sub_80DCE78(u8 taskId);
static void sub_80DCEE4(u8 taskId);
@@ -142,7 +143,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId)
else
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
if (species != SPECIES_NONE)
PlayCry3(species, pan, 3);
PlayCry_ByMode(species, pan, CRY_MODE_HIGH_PITCH);
DestroyAnimVisualTask(taskId);
}
@@ -177,10 +178,10 @@ void SoundTask_PlayDoubleCry(u8 taskId)
gTasks[taskId].data[2] = pan;
if (species != SPECIES_NONE)
{
if (gBattleAnimArgs[1] == TAIL_SENTINEL)
PlayCry3(species, pan, 9);
else
PlayCry3(species, pan, 7);
if (gBattleAnimArgs[1] == DOUBLE_CRY_GROWL)
PlayCry_ByMode(species, pan, CRY_MODE_GROWL_1);
else // DOUBLE_CRY_ROAR
PlayCry_ByMode(species, pan, CRY_MODE_ROAR_1);
gTasks[taskId].func = sub_80DD270;
}
else
@@ -202,13 +203,13 @@ static void sub_80DD270(u8 taskId)
{
if (!IsCryPlaying())
{
PlayCry3(species, pan, 10);
PlayCry_ByMode(species, pan, CRY_MODE_GROWL_2);
DestroyAnimVisualTask(taskId);
}
}
else if (!IsCryPlaying())
{
PlayCry3(species, pan, 8);
PlayCry_ByMode(species, pan, CRY_MODE_ROAR_2);
DestroyAnimVisualTask(taskId);
}
}
@@ -232,7 +233,7 @@ void sub_80DD334(u8 taskId)
gTasks[taskId].data[2] = pan;
if (species != SPECIES_NONE)
{
PlayCry3(species, pan, 4);
PlayCry_ByMode(species, pan, CRY_MODE_ECHO_START);
gTasks[taskId].func = sub_80DD390;
}
else
@@ -253,7 +254,7 @@ static void sub_80DD390(u8 taskId)
u16 species = gTasks[taskId].data[1];
s8 pan = gTasks[taskId].data[2];
PlayCry3(species, pan, 6);
PlayCry_ByMode(species, pan, CRY_MODE_ECHO_END);
DestroyAnimVisualTask(taskId);
}
}
+4 -3
View File
@@ -13,6 +13,7 @@
#include "battle_message.h"
#include "constants/battle_anim.h"
#include "constants/songs.h"
#include "constants/sound.h"
#include "constants/trainers.h"
static void LinkOpponentHandleGetMonData(void);
@@ -231,7 +232,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
}
else
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3;
gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd;
@@ -366,7 +367,7 @@ static void SwitchIn_HandleSoundAndEnd(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs())
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
LinkOpponentBufferExecCompleted();
}
}
@@ -1512,7 +1513,7 @@ static void LinkOpponentHandleFaintingCry(void)
{
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, 25, 5);
PlayCry_ByMode(species, 25, CRY_MODE_FAINT);
LinkOpponentBufferExecCompleted();
}
+2 -1
View File
@@ -12,6 +12,7 @@
#include "battle_message.h"
#include "constants/battle_anim.h"
#include "constants/songs.h"
#include "constants/sound.h"
static void LinkPartnerHandleGetMonData(void);
static void LinkPartnerHandleGetRawMonData(void);
@@ -1425,7 +1426,7 @@ static void LinkPartnerHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, -25, 5);
PlayCry_ByMode(species, -25, CRY_MODE_FAINT);
LinkPartnerBufferExecCompleted();
}
+4 -3
View File
@@ -19,6 +19,7 @@
#include "constants/battle_anim.h"
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/sound.h"
static void OpponentHandleGetMonData(void);
static void OpponentHandleGetRawMonData(void);
@@ -233,7 +234,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
m4aMPlayContinue(&gMPlayInfo_BGM);
else
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3;
gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd;
}
@@ -372,7 +373,7 @@ static void SwitchIn_HandleSoundAndEnd(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs())
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
OpponentBufferExecCompleted();
}
}
@@ -1611,7 +1612,7 @@ static void OpponentHandleFaintingCry(void)
{
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
PlayCry3(species, 25, 5);
PlayCry_ByMode(species, 25, CRY_MODE_FAINT);
OpponentBufferExecCompleted();
}
+5 -4
View File
@@ -22,6 +22,7 @@
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/sound.h"
static void PlayerHandleGetMonData(void);
static void PlayerHandleSetMonData(void);
@@ -898,7 +899,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
m4aMPlayContinue(&gMPlayInfo_BGM);
else
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
if (IsDoubleBattle())
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK);
@@ -955,7 +956,7 @@ static void SwitchIn_HandleSoundAndEnd(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive
&& !IsCryPlayingOrClearCrySongs())
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
PlayerBufferExecCompleted();
}
@@ -984,7 +985,7 @@ void Task_PlayerController_RestoreBgmAfterCry(u8 taskId)
{
if (!IsCryPlayingOrClearCrySongs())
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
DestroyTask(taskId);
}
}
@@ -2687,7 +2688,7 @@ static void PlayerHandlePlayFanfare(void)
static void PlayerHandleFaintingCry(void)
{
PlayCry3(GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES), -25, 5);
PlayCry_ByMode(GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES), -25, CRY_MODE_FAINT);
PlayerBufferExecCompleted();
}
+1 -3
View File
@@ -3214,9 +3214,7 @@ static void Cmd_getexp(void)
else
{
// music change in wild battle after fainting a poke
if (!(gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_POKEDUDE))
&& gBattleMons[0].hp != 0
&& !gBattleStruct->wildVictorySong)
if (!(gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_POKEDUDE)) && gBattleMons[0].hp != 0 && !gBattleStruct->wildVictorySong)
{
BattleStopLowHpSound();
PlayBGM(MUS_VICTORY_WILD);
+2 -1
View File
@@ -14,6 +14,7 @@
#include "quest_log.h"
#include "constants/maps.h"
#include "constants/field_weather.h"
#include "constants/sound.h"
#if defined(FIRERED)
#define TITLE_TEXT gString_PokemonFireRed_Staff
@@ -1190,7 +1191,7 @@ static bool32 DoCreditsMonScene(void)
{
HideBg(2);
ShowBg(1);
PlayCry2(GetCreditsMonSpecies(sCreditsMgr->whichMon), 0, 125, 10);
PlayCry_NormalNoDucking(GetCreditsMonSpecies(sCreditsMgr->whichMon), 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
sCreditsMgr->creditsMonTimer = 128;
sCreditsMgr->subseqno++;
}
+2 -2
View File
@@ -8,7 +8,7 @@
#include "scanline_effect.h"
#include "strings.h"
#include "task.h"
#include "constants/fanfares.h"
#include "constants/sound.h"
struct Diploma
{
@@ -148,7 +148,7 @@ static void Task_DiplomaInit(u8 taskId)
{
break;
}
PlayFanfareByFanfareNum(FANFARE_05);
PlayFanfareByFanfareNum(FANFARE_OBTAIN_BADGE);
gTasks[taskId].func = Task_WaitForExit;
}
gDiploma->callbackStep++;
+3 -3
View File
@@ -13,7 +13,7 @@
#include "task.h"
#include "text_window.h"
#include "constants/songs.h"
#include "constants/fanfares.h"
#include "constants/sound.h"
#include "constants/items.h"
struct DodrioStruct
@@ -1204,7 +1204,7 @@ static void sub_8151D98(void)
}
else if (gUnknown_203F3E0->unk154 == 1)
{
PlayFanfareByFanfareNum(FANFARE_10); // MUS_TOO_BAD
PlayFanfareByFanfareNum(FANFARE_TOO_BAD);
gUnknown_203F3E0->unk154 = 2;
}
}
@@ -1262,7 +1262,7 @@ static void sub_8151E94(void)
}
else if (gUnknown_203F3E0->unk154 == 1)
{
PlayFanfareByFanfareNum(FANFARE_10); // MUS_TOO_BAD
PlayFanfareByFanfareNum(FANFARE_TOO_BAD);
gUnknown_203F3E0->unk154 = 2;
}
}
+2 -1
View File
@@ -27,6 +27,7 @@
#include "constants/event_object_movement.h"
#include "constants/metatile_behaviors.h"
#include "constants/songs.h"
#include "constants/sound.h"
extern struct CompressedSpritePalette gMonPaletteTable[]; // Intentionally declared (incorrectly) without const in order to match
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
@@ -2935,7 +2936,7 @@ static void SpriteCB_FieldMoveMonSlideOnscreen(struct Sprite * sprite)
sprite->callback = SpriteCB_FieldMoveMonWaitAfterCry;
if (sprite->data[6])
{
PlayCry2(sprite->data[0], 0, 0x7d, 0xa);
PlayCry_NormalNoDucking(sprite->data[0], 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
}
else
{
+2 -2
View File
@@ -907,7 +907,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
if (IsCryPlayingOrClearCrySongs())
{
StopCryAndClearCrySongs();
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
}
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
}
@@ -917,7 +917,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
if (IsCryPlayingOrClearCrySongs())
{
StopCryAndClearCrySongs();
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
}
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
}
+2 -2
View File
@@ -60,7 +60,7 @@ u8 RunHelpSystemCallback(void)
m4aMPlayStop(&gMPlayInfo_SE2);
PlaySE(SE_HELP_OPEN);
if (!gDisableHelpSystemVolumeReduce)
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x80);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x80);
SaveCallbacks();
sInHelpSystem = 1;
sVideoState.state = 1;
@@ -122,7 +122,7 @@ u8 RunHelpSystemCallback(void)
break;
case 7:
if (!gDisableHelpSystemVolumeReduce)
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
RestoreMapTextColors();
RestoreGPURegs();
sVideoState.state = 8;
+2 -1
View File
@@ -14,6 +14,7 @@
#include "util.h"
#include "trig.h"
#include "constants/songs.h"
#include "constants/sound.h"
struct IntroSequenceData;
@@ -2205,7 +2206,7 @@ static void SpriteCB_NidorinoRearsUp(struct Sprite * sprite)
}
break;
case 1:
PlayCry3(SPECIES_NIDORINO, 0x3F, 1);
PlayCry_ByMode(SPECIES_NIDORINO, 0x3F, CRY_MODE_DOUBLES);
sprite->data[1] = 0;
sprite->data[0]++;
break;
+2 -2
View File
@@ -31,7 +31,7 @@
#include "teachy_tv.h"
#include "tm_case.h"
#include "vs_seeker.h"
#include "constants/fanfares.h"
#include "constants/sound.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/moves.h"
@@ -386,7 +386,7 @@ void FieldUseFunc_PokeFlute(u8 taskId)
static void sub_80A1648(u8 taskId)
{
PlayFanfareByFanfareNum(FANFARE_POKEFLUTE);
PlayFanfareByFanfareNum(FANFARE_POKE_FLUTE);
gTasks[taskId].func = sub_80A1674;
}
+2 -1
View File
@@ -50,6 +50,7 @@
#include "constants/maps.h"
#include "constants/region_map_sections.h"
#include "constants/songs.h"
#include "constants/sound.h"
#define PLAYER_LINK_STATE_IDLE 0x80
#define PLAYER_LINK_STATE_BUSY 0x81
@@ -1141,7 +1142,7 @@ static void PlayAmbientCry(void)
if (gDisableMapMusicChangeOnMapLoad == MUSIC_DISABLE_KEEP)
return;
PlayCry2(sAmbientCrySpecies, pan, volume, 1);
PlayCry_NormalNoDucking(sAmbientCrySpecies, pan, volume, CRY_PRIORITY_AMBIENT);
}
void UpdateAmbientCry(s16 *state, u16 *delayCounter)
+2 -1
View File
@@ -67,6 +67,7 @@
#include "constants/pokemon.h"
#include "constants/quest_log.h"
#include "constants/songs.h"
#include "constants/sound.h"
#define PARTY_PAL_SELECTED (1 << 0)
#define PARTY_PAL_FAINTED (1 << 1)
@@ -5083,7 +5084,7 @@ static void ItemUseCB_RareCandyStep(u8 taskId, UNUSED TaskFunc func)
GetMonLevelUpWindowStats(mon, &ptr->data[NUM_STATS]);
gPartyMenuUseExitCallback = TRUE;
ItemUse_SetQuestLogEvent(QL_EVENT_USED_ITEM, mon, gSpecialVar_ItemId, 0xFFFF);
PlayFanfareByFanfareNum(0);
PlayFanfareByFanfareNum(FANFARE_LEVEL_UP);
UpdateMonDisplayInfoAfterRareCandy(gPartyMenu.slotId, mon);
RemoveBagItem(gSpecialVar_ItemId, 1);
GetMonNickname(mon, gStringVar1);
+8 -7
View File
@@ -12,6 +12,7 @@
#include "link.h"
#include "battle_gfx_sfx_util.h"
#include "constants/songs.h"
#include "constants/sound.h"
#define tFrames data[0]
#define tPan data[1]
@@ -681,9 +682,9 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
break;
case 1:
if (ShouldPlayNormalPokeCry(mon) == TRUE)
PlayCry3(species, pan, 0);
PlayCry_ByMode(species, pan, CRY_MODE_NORMAL);
else
PlayCry3(species, pan, 11);
PlayCry_ByMode(species, pan, CRY_MODE_WEAK);
DestroyTask(taskId);
break;
@@ -696,9 +697,9 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
if (gTasks[taskId].tCryTaskFrames == 0)
{
if (ShouldPlayNormalPokeCry(mon) == TRUE)
PlayCry4(species, pan, 1);
PlayCry_ReleaseDouble(species, pan, 1);
else
PlayCry4(species, pan, 12);
PlayCry_ReleaseDouble(species, pan, 12);
DestroyTask(taskId);
}
@@ -734,9 +735,9 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
}
if (ShouldPlayNormalPokeCry(mon) == TRUE)
PlayCry4(species, pan, 0);
PlayCry_ReleaseDouble(species, pan, 0);
else
PlayCry4(species, pan, 11);
PlayCry_ReleaseDouble(species, pan, 11);
DestroyTask(taskId);
break;
@@ -784,7 +785,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
}
else
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 128);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 128);
}
}
+5 -4
View File
@@ -17,6 +17,7 @@
#include "trainer_pokemon_sprites.h"
#include "decompress.h"
#include "constants/songs.h"
#include "constants/sound.h"
#include "pokedex_area_markers.h"
#include "field_specials.h"
@@ -1751,7 +1752,7 @@ static void Task_DexScreen_CategorySubmenu(u8 taskId)
CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(0);
PlayCry2(sPokedexScreenData->dexSpecies, 0, 125, 10);
PlayCry_NormalNoDucking(sPokedexScreenData->dexSpecies, 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
sPokedexScreenData->data[0] = 0;
sPokedexScreenData->state = 17;
}
@@ -1927,7 +1928,7 @@ static void Task_DexScreen_ShowMonPage(u8 taskId)
CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(0);
PlayCry2(sPokedexScreenData->dexSpecies, 0, 125, 10);
PlayCry_NormalNoDucking(sPokedexScreenData->dexSpecies, 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
sPokedexScreenData->state = 4;
break;
case 4:
@@ -3295,7 +3296,7 @@ static u8 DexScreen_PageNumberToRenderablePages(u16 page)
void DexScreen_InputHandler_StartToCry(void)
{
if (JOY_NEW(START_BUTTON))
PlayCry2(sPokedexScreenData->dexSpecies, 0, 125, 10);
PlayCry_NormalNoDucking(sPokedexScreenData->dexSpecies, 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
}
u8 DexScreen_RegisterMonToPokedex(u16 species)
@@ -3413,7 +3414,7 @@ static void Task_DexScreen_RegisterMonToPokedex(u8 taskId)
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(0);
PlayCry2(sPokedexScreenData->dexSpecies, 0, 125, 10);
PlayCry_NormalNoDucking(sPokedexScreenData->dexSpecies, 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
sPokedexScreenData->data[0] = 0;
sPokedexScreenData->state = 11;
}
+3 -2
View File
@@ -33,6 +33,7 @@
#include "battle_interface.h"
#include "mon_markings.h"
#include "pokemon_storage_system.h"
#include "constants/sound.h"
// needs conflicting header to match (curIndex is s8 in the function, but has to be defined as u8 here)
extern s16 SeekToNextMonInBox(struct BoxPokemon * boxMons, u8 curIndex, u8 maxIndex, u8 flags);
@@ -5181,9 +5182,9 @@ static void PokeSum_TryPlayMonCry(void)
if (!GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_IS_EGG))
{
if (ShouldPlayNormalPokeCry(&sMonSummaryScreen->currentMon) == TRUE)
PlayCry3(GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_SPECIES2), 0, 0);
PlayCry_ByMode(GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_SPECIES2), 0, CRY_MODE_NORMAL);
else
PlayCry3(GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_SPECIES2), 0, 11);
PlayCry_ByMode(GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_SPECIES2), 0, CRY_MODE_WEAK);
}
}
+2 -2
View File
@@ -40,7 +40,7 @@ bool32 RunSaveFailedScreen(void)
case 0:
if (!sIsInSaveFailedScreen)
return FALSE;
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 128);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 128);
SaveCallbacks();
sSaveFailedScreenState = 1;
break;
@@ -95,7 +95,7 @@ bool32 RunSaveFailedScreen(void)
sSaveFailedScreenState = 8;
break;
case 8:
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
RestoreMapTextColors();
RestoreGPURegs();
RestoreCallbacks();
+3 -2
View File
@@ -34,6 +34,7 @@
#include "fieldmap.h"
#include "field_door.h"
#include "constants/event_objects.h"
#include "constants/sound.h"
extern u16 (*const gSpecials[])(void);
extern u16 (*const gSpecialsEnd[])(void);
@@ -1523,7 +1524,7 @@ bool8 ScrCmd_showmonpic(struct ScriptContext * ctx)
u8 y = ScriptReadByte(ctx);
ScriptMenu_ShowPokemonPic(species, x, y);
PlayCry7(species, 0);
PlayCry_Script(species, CRY_MODE_NORMAL);
return FALSE;
}
@@ -2085,7 +2086,7 @@ bool8 ScrCmd_playmoncry(struct ScriptContext * ctx)
u16 species = VarGet(ScriptReadHalfword(ctx));
u16 mode = VarGet(ScriptReadHalfword(ctx));
PlayCry7(species, mode);
PlayCry_Script(species, mode);
return FALSE;
}
+87 -81
View File
@@ -5,7 +5,7 @@
#include "quest_log.h"
#include "m4a.h"
#include "constants/songs.h"
#include "constants/fanfares.h"
#include "constants/sound.h"
#include "task.h"
struct Fanfare
@@ -38,24 +38,7 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_SE3;
extern struct ToneData gCryTable[];
extern struct ToneData gCryTable2[];
static const struct Fanfare sFanfares[] = {
[FANFARE_00] = { MUS_LEVEL_UP, 80 },
[FANFARE_01] = { MUS_OBTAIN_ITEM, 160 },
[FANFARE_02] = { MUS_EVOLVED, 220 },
[FANFARE_03] = { MUS_OBTAIN_TMHM, 220 },
[FANFARE_04] = { MUS_HEAL, 160 },
[FANFARE_05] = { MUS_OBTAIN_BADGE, 340 },
[FANFARE_06] = { MUS_MOVE_DELETED, 180 },
[FANFARE_07] = { MUS_OBTAIN_BERRY, 120 },
[FANFARE_08] = { MUS_SLOTS_JACKPOT, 250 },
[FANFARE_09] = { MUS_SLOTS_WIN, 150 },
[FANFARE_10] = { MUS_TOO_BAD, 160 },
[FANFARE_POKEFLUTE] = { MUS_POKE_FLUTE, 450 },
[FANFARE_KEY_ITEM] = { MUS_OBTAIN_KEY_ITEM, 170 },
[FANFARE_DEX_EVAL] = { MUS_DEX_RATING, 196 }
};
extern struct ToneData gCryTable_Reverse[];
extern u16 SpeciesToCryId(u16);
@@ -64,7 +47,22 @@ static void CreateFanfareTask(void);
static void Task_DuckBGMForPokemonCry(u8 taskId);
static void RestoreBGMVolumeAfterPokemonCry(void);
#define CRY_VOLUME 120 // was 125 in R/S
static const struct Fanfare sFanfares[] = {
[FANFARE_LEVEL_UP] = { MUS_LEVEL_UP, 80 },
[FANFARE_OBTAIN_ITEM] = { MUS_OBTAIN_ITEM, 160 },
[FANFARE_EVOLVED] = { MUS_EVOLVED, 220 },
[FANFARE_OBTAIN_TMHM] = { MUS_OBTAIN_TMHM, 220 },
[FANFARE_HEAL] = { MUS_HEAL, 160 },
[FANFARE_OBTAIN_BADGE] = { MUS_OBTAIN_BADGE, 340 },
[FANFARE_MOVE_DELETED] = { MUS_MOVE_DELETED, 180 },
[FANFARE_OBTAIN_BERRY] = { MUS_OBTAIN_BERRY, 120 },
[FANFARE_SLOTS_JACKPOT] = { MUS_SLOTS_JACKPOT, 250 },
[FANFARE_SLOTS_WIN] = { MUS_SLOTS_WIN, 150 },
[FANFARE_TOO_BAD] = { MUS_TOO_BAD, 160 },
[FANFARE_POKE_FLUTE] = { MUS_POKE_FLUTE, 450 },
[FANFARE_KEY_ITEM] = { MUS_OBTAIN_KEY_ITEM, 170 },
[FANFARE_DEX_EVAL] = { MUS_DEX_RATING, 196 }
};
void InitMapMusic(void)
{
@@ -168,6 +166,7 @@ void FadeOutAndFadeInNewMapMusic(u16 songNum, u8 fadeOutSpeed, u8 fadeInSpeed)
sMapMusicFadeInSpeed = fadeInSpeed;
}
// Unused
static void FadeInNewMapMusic(u16 songNum, u8 speed)
{
FadeInNewBGM(songNum, speed);
@@ -191,7 +190,6 @@ bool8 IsNotWaitingForBGMStop(void)
void PlayFanfareByFanfareNum(u8 fanfareNum)
{
u16 songNum;
if(gQuestLogState == QL_STATE_PLAYBACK)
{
sFanfareCounter = 0xFF;
@@ -223,6 +221,7 @@ bool8 WaitFanfare(bool8 stop)
}
}
// Unused
void StopFanfareByFanfareNum(u8 fanfareNum)
{
m4aSongNumStop(sFanfares[fanfareNum].songNum);
@@ -231,7 +230,7 @@ void StopFanfareByFanfareNum(u8 fanfareNum)
void PlayFanfare(u16 songNum)
{
s32 i;
for (i = 0; (u32)i < 14; i++)
for (i = 0; (u32)i < ARRAY_COUNT(sFanfares); i++)
{
if (sFanfares[i].songNum == songNum)
{
@@ -241,6 +240,8 @@ void PlayFanfare(u16 songNum)
}
}
// songNum is not in sFanfares
// Play first fanfare in table instead
PlayFanfareByFanfareNum(0);
CreateFanfareTask();
}
@@ -275,11 +276,11 @@ void FadeInNewBGM(u16 songNum, u8 speed)
{
if (gDisableMusic)
songNum = 0;
if (songNum == 0xFFFF)
if (songNum == MUS_NONE)
songNum = 0;
m4aSongNumStart(songNum);
m4aMPlayImmInit(&gMPlayInfo_BGM);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0);
m4aSongNumStop(songNum);
m4aMPlayFadeIn(&gMPlayInfo_BGM, speed);
}
@@ -317,54 +318,54 @@ bool8 IsBGMStopped(void)
void PlayCry_Normal(u16 species, s8 pan)
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, 0);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, CRY_MODE_NORMAL);
gPokemonCryBGMDuckingCounter = 2;
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, 0);
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 == 1)
if (mode == CRY_MODE_DOUBLES)
{
PlayCryInternal(species, pan, CRY_VOLUME, 10, 1);
PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
}
else
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
gPokemonCryBGMDuckingCounter = 2;
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 == 1)
if (mode == CRY_MODE_DOUBLES)
{
PlayCryInternal(species, pan, CRY_VOLUME, 10, 1);
PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
}
else
{
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 85);
PlayCryInternal(species, pan, CRY_VOLUME, 10, mode);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, pan, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
}
}
// PlayCry5 and 6 are not in FR/LG.
void PlayCry7(u16 species, u8 mode) // exclusive to FR/LG
void PlayCry_Script(u16 species, u8 mode)
{
if (!QL_IS_PLAYBACK_STATE)
if (!QL_IS_PLAYBACK_STATE) // This check is exclusive to FR/LG
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 85);
PlayCryInternal(species, 0, CRY_VOLUME, 10, mode);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
PlayCryInternal(species, 0, CRY_VOLUME, CRY_PRIORITY_NORMAL, mode);
}
gPokemonCryBGMDuckingCounter = 2;
RestoreBGMVolumeAfterPokemonCry();
@@ -372,7 +373,7 @@ void PlayCry7(u16 species, u8 mode) // exclusive to FR/LG
void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
{
bool32 v0;
bool32 reverse;
u32 release;
u32 length;
u32 pitch;
@@ -381,76 +382,80 @@ void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
u8 table;
species--;
// Set default values
// May be overridden depending on mode.
length = 140;
v0 = FALSE;
reverse = FALSE;
release = 0;
pitch = 15360;
chorus = 0;
switch (mode)
{
case 0:
case CRY_MODE_NORMAL:
break;
case 1:
case CRY_MODE_DOUBLES:
length = 20;
release = 225;
break;
case 2:
case CRY_MODE_ENCOUNTER:
release = 225;
pitch = 15600;
chorus = 20;
volume = 90;
break;
case 3:
case CRY_MODE_HIGH_PITCH:
length = 50;
release = 200;
pitch = 15800;
chorus = 20;
volume = 90;
break;
case 4:
case CRY_MODE_ECHO_START:
length = 25;
v0 = TRUE;
reverse = TRUE;
release = 100;
pitch = 15600;
chorus = 192;
volume = 90;
break;
case 5:
case CRY_MODE_FAINT:
release = 200;
pitch = 14440;
break;
case 6: // _08072044
case CRY_MODE_ECHO_END:
release = 220;
pitch = 15555;
chorus = 192;
volume = 90; // FR/LG changed this from 70 to 90
break;
case 7:
case CRY_MODE_ROAR_1:
length = 10;
release = 100;
pitch = 14848;
break;
case 8:
case CRY_MODE_ROAR_2:
length = 60;
release = 225;
pitch = 15616;
break;
case 9:
case CRY_MODE_GROWL_1:
length = 15;
v0 = TRUE;
reverse = TRUE;
release = 125;
pitch = 15200;
break;
case 10:
case CRY_MODE_GROWL_2:
length = 100;
release = 225;
pitch = 15200;
break;
case 12:
case CRY_MODE_WEAK_DOUBLES:
length = 20;
release = 225;
case 11:
// fallthrough
case CRY_MODE_WEAK:
pitch = 15000;
break;
}
@@ -469,28 +474,29 @@ void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
// If you wish to expand pokemon, you need to
// append new cases to the switch.
species = SpeciesToCryId(species);
index = species & 0x7F;
index = species % 128;
table = species / 128;
#define GET_CRY(speciesIndex, tableId, reversed) \
((reversed) ? &gCryTable_Reverse[(128 * (tableId)) + (speciesIndex)] : &gCryTable[(128 * (tableId)) + (speciesIndex)])
switch (table)
{
case 0:
gMPlay_PokemonCry = SetPokemonCryTone(
v0 ? &gCryTable2[(128 * 0) + index] : &gCryTable[(128 * 0) + index]);
gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 0, reverse));
break;
case 1:
gMPlay_PokemonCry = SetPokemonCryTone(
v0 ? &gCryTable2[(128 * 1) + index] : &gCryTable[(128 * 1) + index]);
gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 1, reverse));
break;
case 2:
gMPlay_PokemonCry = SetPokemonCryTone(
v0 ? &gCryTable2[(128 * 2) + index] : &gCryTable[(128 * 2) + index]);
gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 2, reverse));
break;
case 3:
gMPlay_PokemonCry = SetPokemonCryTone(
v0 ? &gCryTable2[(128 * 3) + index] : &gCryTable[(128 * 3) + index]);
gMPlay_PokemonCry = SetPokemonCryTone(GET_CRY(index, 3, reverse));
break;
}
#undef GET_CRY
}
bool8 IsCryFinished(void)
@@ -548,7 +554,7 @@ static void Task_DuckBGMForPokemonCry(u8 taskId)
if (!IsPokemonCryPlaying(gMPlay_PokemonCry))
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
DestroyTask(taskId);
}
}
@@ -563,14 +569,14 @@ void PlayBGM(u16 songNum)
{
if (gDisableMusic)
songNum = 0;
if (songNum == 0xFFFF)
if (songNum == MUS_NONE)
songNum = 0;
m4aSongNumStart(songNum);
}
void PlaySE(u16 songNum)
{
if(gDisableMapMusicChangeOnMapLoad == 0 && gQuestLogState != QL_STATE_PLAYBACK)
if (gDisableMapMusicChangeOnMapLoad == 0 && gQuestLogState != QL_STATE_PLAYBACK)
m4aSongNumStart(songNum);
}
@@ -579,28 +585,28 @@ void PlaySE12WithPanning(u16 songNum, s8 pan)
m4aSongNumStart(songNum);
m4aMPlayImmInit(&gMPlayInfo_SE1);
m4aMPlayImmInit(&gMPlayInfo_SE2);
m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE1, TRACKS_ALL, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE2, TRACKS_ALL, pan);
}
void PlaySE1WithPanning(u16 songNum, s8 pan)
{
m4aSongNumStart(songNum);
m4aMPlayImmInit(&gMPlayInfo_SE1);
m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE1, TRACKS_ALL, pan);
}
void PlaySE2WithPanning(u16 songNum, s8 pan)
{
m4aSongNumStart(songNum);
m4aMPlayImmInit(&gMPlayInfo_SE2);
m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE2, TRACKS_ALL, pan);
}
void SE12PanpotControl(s8 pan)
{
m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE1, TRACKS_ALL, pan);
m4aMPlayPanpotControl(&gMPlayInfo_SE2, TRACKS_ALL, pan);
}
bool8 IsSEPlaying(void)
@@ -633,11 +639,11 @@ bool8 IsSpecialSEPlaying(void)
void SetBGMVolume_SuppressHelpSystemReduction(u16 volume)
{
gDisableHelpSystemVolumeReduce = TRUE;
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, volume);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, volume);
}
void BGMVolumeMax_EnableHelpSystemReduction(void)
{
gDisableHelpSystemVolumeReduce = FALSE;
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 256);
}