summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle_anim_sound_tasks.c25
-rw-r--r--src/battle_controller_link_opponent.c2
-rw-r--r--src/battle_controller_link_partner.c2
-rw-r--r--src/battle_controller_opponent.c2
-rw-r--r--src/battle_controller_player.c2
-rw-r--r--src/battle_controller_player_partner.c2
-rw-r--r--src/battle_controller_recorded_opponent.c2
-rw-r--r--src/battle_controller_recorded_player.c2
-rw-r--r--src/intro.c2
-rw-r--r--src/pokeball.c14
-rw-r--r--src/pokemon_summary_screen.c4
-rw-r--r--src/sound.c66
12 files changed, 65 insertions, 60 deletions
diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c
index 6068b0f33..435c5dcdc 100644
--- a/src/battle_anim_sound_tasks.c
+++ b/src/battle_anim_sound_tasks.c
@@ -168,7 +168,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId)
}
if (species != SPECIES_NONE)
- PlayCry3(species, pan, 3);
+ PlayCry3(species, pan, CRY_MODE_HIGH_PITCH);
DestroyAnimVisualTask(taskId);
}
@@ -219,10 +219,10 @@ void SoundTask_PlayDoubleCry(u8 taskId)
if (species != SPECIES_NONE)
{
- if (gBattleAnimArgs[1] == 0xFF)
- PlayCry3(species, pan, 9);
- else
- PlayCry3(species, pan, 7);
+ if (gBattleAnimArgs[1] == DOUBLE_CRY_GROWL)
+ PlayCry3(species, pan, CRY_MODE_GROWL_1);
+ else // DOUBLE_CRY_ROAR
+ PlayCry3(species, pan, CRY_MODE_ROAR_1);
gTasks[taskId].func = SoundTask_PlayDoubleCry_Step;
}
@@ -243,19 +243,19 @@ static void SoundTask_PlayDoubleCry_Step(u8 taskId)
}
else
{
- if (gTasks[taskId].data[0] == 0xFF)
+ if (gTasks[taskId].data[0] == DOUBLE_CRY_GROWL)
{
if (!IsCryPlaying())
{
- PlayCry3(species, pan, 10);
+ PlayCry3(species, pan, CRY_MODE_GROWL_2);
DestroyAnimVisualTask(taskId);
}
}
- else
+ else // DOUBLE_CRY_ROAR
{
if (!IsCryPlaying())
{
- PlayCry3(species, pan, 8);
+ PlayCry3(species, pan, CRY_MODE_ROAR_2);
DestroyAnimVisualTask(taskId);
}
}
@@ -302,10 +302,11 @@ static void SoundTask_PlayCryWithEcho_Step(u8 taskId)
u16 species = gTasks[taskId].data[1];
s8 pan = gTasks[taskId].data[2];
+ // Note the cases are not in order of execution
switch (gTasks[taskId].data[9])
{
case 2:
- PlayCry6(species, pan, 4);
+ PlayCry6(species, pan, CRY_MODE_ECHO_END);
gTasks[taskId].data[9]++;
break;
case 1:
@@ -322,9 +323,9 @@ static void SoundTask_PlayCryWithEcho_Step(u8 taskId)
break;
default:
if (gTasks[taskId].data[10] == 0)
- PlayCry6(species, pan, 6);
+ PlayCry6(species, pan, CRY_MODE_ECHO_START);
else
- PlayCry3(species, pan, 6);
+ PlayCry3(species, pan, CRY_MODE_ECHO_START);
DestroyAnimVisualTask(taskId);
break;
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c
index 1660f6ec1..e45b0c64b 100644
--- a/src/battle_controller_link_opponent.c
+++ b/src/battle_controller_link_opponent.c
@@ -1681,7 +1681,7 @@ static void LinkOpponentHandleFaintingCry(void)
{
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, 25, 5);
+ PlayCry3(species, 25, CRY_MODE_FAINT);
LinkOpponentBufferExecCompleted();
}
diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c
index a9240b0ac..ac6559687 100644
--- a/src/battle_controller_link_partner.c
+++ b/src/battle_controller_link_partner.c
@@ -1513,7 +1513,7 @@ static void LinkPartnerHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, -25, 5);
+ PlayCry3(species, -25, CRY_MODE_FAINT);
LinkPartnerBufferExecCompleted();
}
diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c
index ac330be76..d0aaf01fa 100644
--- a/src/battle_controller_opponent.c
+++ b/src/battle_controller_opponent.c
@@ -1847,7 +1847,7 @@ static void OpponentHandleFaintingCry(void)
{
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, 25, 5);
+ PlayCry3(species, 25, CRY_MODE_FAINT);
OpponentBufferExecCompleted();
}
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index f4e47b434..34559541e 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -2926,7 +2926,7 @@ static void PlayerHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, -25, 5);
+ PlayCry3(species, -25, CRY_MODE_FAINT);
PlayerBufferExecCompleted();
}
diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c
index 91fea6cde..863cdbdea 100644
--- a/src/battle_controller_player_partner.c
+++ b/src/battle_controller_player_partner.c
@@ -1763,7 +1763,7 @@ static void PlayerPartnerHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, -25, 5);
+ PlayCry3(species, -25, CRY_MODE_FAINT);
PlayerPartnerBufferExecCompleted();
}
diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c
index c6e649508..5394250ee 100644
--- a/src/battle_controller_recorded_opponent.c
+++ b/src/battle_controller_recorded_opponent.c
@@ -1621,7 +1621,7 @@ static void RecordedOpponentHandleFaintingCry(void)
{
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, 25, 5);
+ PlayCry3(species, 25, CRY_MODE_FAINT);
RecordedOpponentBufferExecCompleted();
}
diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c
index 93d059fe9..d634fca5d 100644
--- a/src/battle_controller_recorded_player.c
+++ b/src/battle_controller_recorded_player.c
@@ -1644,7 +1644,7 @@ static void RecordedPlayerHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
- PlayCry3(species, -25, 5);
+ PlayCry3(species, -25, CRY_MODE_FAINT);
RecordedPlayerBufferExecCompleted();
}
diff --git a/src/intro.c b/src/intro.c
index 5cf99c97e..00cb42ac2 100644
--- a/src/intro.c
+++ b/src/intro.c
@@ -1925,7 +1925,7 @@ static void Task_Scene3_Groudon(u8 taskId)
tScreenX = 80;
tScreenY = 41;
tDelay = 16;
- PlayCryInternal(SPECIES_GROUDON, 0, 100, 10, 0);
+ PlayCryInternal(SPECIES_GROUDON, 0, 100, 10, CRY_MODE_NORMAL);
tState++;
}
break;
diff --git a/src/pokeball.c b/src/pokeball.c
index 11f03eefe..4e7386f4f 100644
--- a/src/pokeball.c
+++ b/src/pokeball.c
@@ -641,7 +641,7 @@ static void SpriteCB_BallThrow_Shake(struct Sprite *sprite)
#define tCryTaskSpecies data[0]
#define tCryTaskPan data[1]
#define tCryTaskWantedCry data[2]
-#define tCryTaskBattler data[3]
+#define tCryTaskBattler data[3]
#define tCryTaskMonSpriteId data[4]
#define tCryTaskMonPtr1 data[5]
#define tCryTaskMonPtr2 data[6]
@@ -666,9 +666,9 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
break;
case 1:
if (ShouldPlayNormalMonCry(mon) == TRUE)
- PlayCry3(species, pan, 0);
+ PlayCry3(species, pan, CRY_MODE_NORMAL);
else
- PlayCry3(species, pan, 11);
+ PlayCry3(species, pan, CRY_MODE_WEAK);
gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE;
DestroyTask(taskId);
break;
@@ -681,9 +681,9 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
if (gTasks[taskId].tCryTaskFrames == 0)
{
if (ShouldPlayNormalMonCry(mon) == TRUE)
- PlayCry4(species, pan, 1);
+ PlayCry4(species, pan, CRY_MODE_DOUBLES);
else
- PlayCry4(species, pan, 12);
+ PlayCry4(species, pan, CRY_MODE_WEAK_DOUBLES);
gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE;
DestroyTask(taskId);
@@ -720,9 +720,9 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
break;
}
if (ShouldPlayNormalMonCry(mon) == TRUE)
- PlayCry4(species, pan, 0);
+ PlayCry4(species, pan, CRY_MODE_NORMAL);
else
- PlayCry4(species, pan, 11);
+ PlayCry4(species, pan, CRY_MODE_WEAK);
gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE;
DestroyTask(taskId);
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index 5a4858620..ca31a0045 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -3929,9 +3929,9 @@ static void PlayMonCry(void)
if (!summary->isEgg)
{
if (ShouldPlayNormalMonCry(&sMonSummaryScreen->currentMon) == TRUE)
- PlayCry3(summary->species2, 0, 0);
+ PlayCry3(summary->species2, 0, CRY_MODE_NORMAL);
else
- PlayCry3(summary->species2, 0, 11);
+ PlayCry3(summary->species2, 0, CRY_MODE_WEAK);
}
}
diff --git a/src/sound.c b/src/sound.c
index 8c3cd3997..ee5113f89 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -26,7 +26,7 @@ static u16 sFanfareCounter;
bool8 gDisableMusic;
extern struct ToneData gCryTable[];
-extern struct ToneData gCryTable2[];
+extern struct ToneData gCryTable_Reverse[];
static void Task_Fanfare(u8 taskId);
static void CreateFanfareTask(void);
@@ -303,21 +303,21 @@ bool8 IsBGMStopped(void)
void PlayCry1(u16 species, s8 pan)
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 85);
- PlayCryInternal(species, pan, CRY_VOLUME, 10, 0);
+ PlayCryInternal(species, pan, CRY_VOLUME, 10, CRY_MODE_NORMAL);
gPokemonCryBGMDuckingCounter = 2;
RestoreBGMVolumeAfterPokemonCry();
}
void PlayCry2(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)
{
- if (mode == 1)
+ if (mode == CRY_MODE_DOUBLES)
{
- PlayCryInternal(species, pan, CRY_VOLUME, 10, 1);
+ PlayCryInternal(species, pan, CRY_VOLUME, 10, mode);
}
else
{
@@ -330,9 +330,9 @@ void PlayCry3(u16 species, s8 pan, u8 mode)
void PlayCry4(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, 10, mode);
}
else
{
@@ -344,9 +344,9 @@ void PlayCry4(u16 species, s8 pan, u8 mode)
void PlayCry6(u16 species, s8 pan, u8 mode) // not present in R/S
{
- if (mode == 1)
+ if (mode == CRY_MODE_DOUBLES)
{
- PlayCryInternal(species, pan, CRY_VOLUME, 10, 1);
+ PlayCryInternal(species, pan, CRY_VOLUME, 10, mode);
}
else
{
@@ -366,7 +366,7 @@ void PlayCry5(u16 species, u8 mode)
void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
{
- bool32 v0;
+ bool32 reverse;
u32 release;
u32 length;
u32 pitch;
@@ -375,76 +375,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_END:
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:
+ case CRY_MODE_ECHO_START:
release = 220;
pitch = 15555;
chorus = 192;
volume = 70;
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;
}
@@ -463,26 +467,26 @@ 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;
switch (table)
{
case 0:
gMPlay_PokemonCry = SetPokemonCryTone(
- v0 ? &gCryTable2[(128 * 0) + index] : &gCryTable[(128 * 0) + index]);
+ reverse ? &gCryTable_Reverse[(128 * 0) + index] : &gCryTable[(128 * 0) + index]);
break;
case 1:
gMPlay_PokemonCry = SetPokemonCryTone(
- v0 ? &gCryTable2[(128 * 1) + index] : &gCryTable[(128 * 1) + index]);
+ reverse ? &gCryTable_Reverse[(128 * 1) + index] : &gCryTable[(128 * 1) + index]);
break;
case 2:
gMPlay_PokemonCry = SetPokemonCryTone(
- v0 ? &gCryTable2[(128 * 2) + index] : &gCryTable[(128 * 2) + index]);
+ reverse ? &gCryTable_Reverse[(128 * 2) + index] : &gCryTable[(128 * 2) + index]);
break;
case 3:
gMPlay_PokemonCry = SetPokemonCryTone(
- v0 ? &gCryTable2[(128 * 3) + index] : &gCryTable[(128 * 3) + index]);
+ reverse ? &gCryTable_Reverse[(128 * 3) + index] : &gCryTable[(128 * 3) + index]);
break;
}
}