Add CRY_MODE constants
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
66
src/sound.c
66
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user