Document entry-routines for playing Pokemon cries

This commit is contained in:
Rachel 2024-01-26 21:14:32 -08:00
parent 825e3f3cc4
commit 620cab7dc0
8 changed files with 98 additions and 48 deletions

View File

@ -3,8 +3,20 @@
enum PokemonCryMod {
POKECRY_NORMAL = 0,
POKECRY_PINCH_NORMAL = 11,
POKECRY_HALF_DURATION,
POKECRY_FIELD_EVENT,
POKECRY_MID_MOVE,
POKECRY_HYPERVOICE_1,
POKECRY_FAINT,
POKECRY_HYPERVOICE_2,
POKECRY_HOWL_1,
POKECRY_HOWL_2,
POKECRY_UPROAR_1,
POKECRY_UPROAR_2,
POKECRY_PINCH_NORMAL,
POKECRY_PINCH_HALF_DURATION,
POKECRY_POKEDEX_CHORUS,
POKECRY_POKEDEX,
};
#endif // POKEPLATINUM_CONSTANTS_SOUND_H

View File

@ -1,6 +1,8 @@
#ifndef POKEPLATINUM_POKEMON_H
#define POKEPLATINUM_POKEMON_H
#include "constants/sound.h"
#include "struct_decls/struct_02002F38_decl.h"
#include "struct_decls/struct_02006C24_decl.h"
#include "struct_defs/sprite_animation_frame.h"
@ -919,8 +921,36 @@ BOOL Pokemon_SetRotomForm(Pokemon *mon, int monForm, int moveSlot);
*/
void Pokemon_LoadLevelUpMovesOf(int monSpecies, int monForm, u16 *monLevelUpMoves);
void sub_02077D3C(ChatotCry *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7);
void sub_02077DB4(ChatotCry *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8);
/**
* @brief Play a Pokemon's cry, according to the given species and form number.
*
* @param chatotCry Chatot cry data from the save block. Only used
* if the Pokemon itself is Chatot.
* @param crymod Modification to apply to the Pokemon's cry.
* @param species
* @param form
* @param pan
* @param volume
* @param forceDefaultChatot If TRUE, force usage of Chatot's default cry.
* @param heapID
*/
void Pokemon_PlayCry(ChatotCry *chatotCry, enum PokemonCryMod crymod, u16 species, int form, int pan, int volume, int forceDefaultChatot, int heapID);
/**
* @brief Play a Pokemon's cry, according to the given species and form number.
*
* @param chatotCry Chatot cry data from the save block. Only used
* if the Pokemon itself is Chatot.
* @param crymod Modification to apply to the Pokemon's cry.
* @param species
* @param form
* @param pan
* @param volume
* @param forceDefaultChatot If TRUE, force usage of Chatot's default cry.
* @param heapID
* @param delay Number of frames until playback will begin.
*/
void Pokemon_PlayDelayedCry(ChatotCry *chatotCry, enum PokemonCryMod crymod, u16 species, int form, int pan, int volume, int forceDefaultChatot, int heapID, u8 delay);
BOOL sub_02077E3C(Pokemon *mon);
void Pokemon_SetCatchData(Pokemon *mon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
void sub_02077EE4(Pokemon *mon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);

View File

@ -3836,7 +3836,7 @@ static void ov12_022230D4 (UnkStruct_ov12_0221FCDC * param0)
v3 = param0->unk_BC->unk_D8[param0->unk_BC->unk_14];
v4 = param0->unk_BC->unk_E8[param0->unk_BC->unk_14];
sub_02077D3C(param0->unk_BC->unk_10C, v0, v3, v4, v1, v2, param0->unk_BC->unk_118, param0->unk_00);
Pokemon_PlayCry(param0->unk_BC->unk_10C, v0, v3, v4, v1, v2, param0->unk_BC->unk_118, param0->unk_00);
}
static void ov12_02223134 (UnkStruct_ov12_0221FCDC * param0)

View File

@ -1625,7 +1625,7 @@ static void ov16_0225E4E8 (SysTask * param0, void * param1)
{
u8 v4;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v4, v0->unk_16, v0->unk_1C);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_11), v0->unk_18, v0->unk_16, v0->unk_2C, 117, 127, NULL, 5, v4);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_11), v0->unk_18, v0->unk_16, v0->unk_2C, 117, 127, NULL, 5, v4);
}
if ((v0->unk_1C == 1) || (v0->unk_1C == 3)) {
@ -1668,7 +1668,7 @@ static void ov16_0225E4E8 (SysTask * param0, void * param1)
u8 v5;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v5, v0->unk_16, v0->unk_1C);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_11), v0->unk_18, v0->unk_16, v0->unk_2C, -117, 127, NULL, 5, v5);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_11), v0->unk_18, v0->unk_16, v0->unk_2C, -117, 127, NULL, 5, v5);
}
if ((v0->unk_1C == 0) || (v0->unk_1C == 2)) {
@ -1752,7 +1752,7 @@ static void ov16_0225E894 (SysTask * param0, void * param1)
u8 v4;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v4, v0->unk_16, v0->unk_1C);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_11), v0->unk_18, v0->unk_16, v0->unk_2C, 117, 127, NULL, 5, v4);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_11), v0->unk_18, v0->unk_16, v0->unk_2C, 117, 127, NULL, 5, v4);
}
sub_0200D4C4(v0->unk_0C->unk_00, (24 * 8), (8 * 11));
@ -1913,7 +1913,7 @@ static void ov16_0225EA80 (SysTask * param0, void * param1)
u8 v4;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v4, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v4);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v4);
}
} else {
sub_02007B98(v0->unk_04->unk_20, 1);
@ -1922,7 +1922,7 @@ static void ov16_0225EA80 (SysTask * param0, void * param1)
u8 v5;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v5, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v5);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v5);
}
}
@ -1942,7 +1942,7 @@ static void ov16_0225EA80 (SysTask * param0, void * param1)
u8 v6;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v6, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v6);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v6);
}
} else {
sub_02007B98(v0->unk_04->unk_20, 1);
@ -1951,7 +1951,7 @@ static void ov16_0225EA80 (SysTask * param0, void * param1)
u8 v7;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v7, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v7);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v7);
}
}
@ -2109,7 +2109,7 @@ static void ov16_0225F0C0 (SysTask * param0, void * param1)
u8 v6;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v6, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v6);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v6);
}
} else {
sub_02007B98(v0->unk_04->unk_20, 1);
@ -2118,7 +2118,7 @@ static void ov16_0225F0C0 (SysTask * param0, void * param1)
u8 v7;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v7, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v7);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v7);
}
}
@ -2137,7 +2137,7 @@ static void ov16_0225F0C0 (SysTask * param0, void * param1)
u8 v8;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v8, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v8);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, 117, 127, NULL, 5, v8);
}
} else {
sub_02007B98(v0->unk_04->unk_20, 1);
@ -2146,7 +2146,7 @@ static void ov16_0225F0C0 (SysTask * param0, void * param1)
u8 v9;
PokeSprite_LoadCryDelay(v0->unk_04->unk_1A0, &v9, v0->unk_86, v0->unk_82);
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v9);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_81), v0->unk_88, v0->unk_86, v0->unk_97, -117, 127, NULL, 5, v9);
}
}
@ -4911,7 +4911,7 @@ static void ov16_02262A9C (SysTask * param0, void * param1)
v7 = -117;
}
sub_02077DB4(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_65), 5, v0->unk_68, v0->unk_6B, v7, 127, v0->unk_72, 5, 0);
Pokemon_PlayDelayedCry(BattleSystem_ChatotVoice(v0->unk_00, v0->unk_65), 5, v0->unk_68, v0->unk_6B, v7, 127, v0->unk_72, 5, 0);
v0->unk_66++;
}
case 5:

View File

@ -1088,7 +1088,7 @@ static void ov17_02248AA4 (SysTask * param0, void * param1)
if (v0->unk_04 >= FX32_ONE) {
v2 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_SPECIES, NULL);
v3 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_FORM, NULL);
sub_02077D3C(v0->unk_00->unk_00->unk_14C[v0->unk_0E], 0, v2, v3, 0, 127, NULL, 22);
Pokemon_PlayCry(v0->unk_00->unk_00->unk_14C[v0->unk_0E], 0, v2, v3, 0, 127, NULL, 22);
v0->unk_0C++;
}
break;

View File

@ -679,7 +679,7 @@ static void ov17_0225266C (SysTask * param0, void * param1)
v1 = Pokemon_GetValue(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_SPECIES, NULL);
v2 = Pokemon_GetValue(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_FORM, NULL);
sub_02077D3C(v0->unk_00->unk_00->unk_14C[v0->unk_11], 0, v1, v2, 0, 127, NULL, 24);
Pokemon_PlayCry(v0->unk_00->unk_00->unk_14C[v0->unk_11], 0, v1, v2, 0, 127, NULL, 24);
}
v0->unk_10++;
break;

View File

@ -1,6 +1,14 @@
#include <nitro.h>
#include <string.h>
#include "consts/generated/c/gender.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/pokemon.h"
#include "constants/sound.h"
#include "constants/species.h"
#include "inlines.h"
#include "struct_decls/struct_02002F38_decl.h"
@ -49,12 +57,6 @@
#include "unk_02092494.h"
#include "flags.h"
#include "consts/generated/c/gender.h"
#include "constants/pokemon.h"
#include "constants/species.h"
#include "constants/items.h"
#include "constants/moves.h"
// Columns: Spicy, Dry, Sweet, Bitter, Sour
// TODO enum here?
static const s8 sNatureFlavorAffinities[][5] = {
@ -4172,40 +4174,44 @@ void Pokemon_LoadLevelUpMovesOf(int monSpecies, int monForm, u16 *monLevelUpMove
NARC_ReadWholeMemberByIndexPair(monLevelUpMoves, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, monSpecies);
}
void sub_02077D3C(ChatotCry *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7)
void Pokemon_PlayCry(ChatotCry *chatotCry, enum PokemonCryMod crymod, u16 species, int form, int pan, int volume, int forceDefaultChatot, int heapID)
{
if (monSpecies == SPECIES_CHATOT) {
if (Sound_CanPlayChatotCry(param1) == 0) {
Sound_FlagDefaultChatotCry(1);
Sound_PlayPokemonCry(param1, monSpecies, param4, param5, param7, param3);
if (species == SPECIES_CHATOT) {
if (Sound_CanPlayChatotCry(crymod) == FALSE) {
Sound_FlagDefaultChatotCry(TRUE);
Sound_PlayPokemonCry(crymod, species, pan, volume, heapID, form);
} else {
if (param6) {
Sound_FlagDefaultChatotCry(1);
if (forceDefaultChatot) {
Sound_FlagDefaultChatotCry(TRUE);
}
Sound_PlayChatotCry(param0, NULL, param5, param4);
Sound_PlayChatotCry(chatotCry, NULL, volume, pan);
}
} else {
Sound_PlayPokemonCry(param1, monSpecies, param4, param5, param7, param3);
return;
}
Sound_PlayPokemonCry(crymod, species, pan, volume, heapID, form);
}
void sub_02077DB4(ChatotCry *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8)
void Pokemon_PlayDelayedCry(ChatotCry *chatotCry, enum PokemonCryMod crymod, u16 species, int form, int pan, int volume, int forceDefaultChatot, int heapID, u8 delay)
{
if (monSpecies == SPECIES_CHATOT) {
if (Sound_CanPlayChatotCry(param1) == 0) {
Sound_FlagDefaultChatotCry(1);
Sound_PlayDelayedPokemonCry(param1, monSpecies, param4, param5, param7, param8, param3);
if (species == SPECIES_CHATOT) {
if (Sound_CanPlayChatotCry(crymod) == FALSE) {
Sound_FlagDefaultChatotCry(TRUE);
Sound_PlayDelayedPokemonCry(crymod, species, pan, volume, heapID, delay, form);
} else {
if (param6) {
Sound_FlagDefaultChatotCry(1);
if (forceDefaultChatot) {
Sound_FlagDefaultChatotCry(TRUE);
}
Sound_PlayDelayedChatotCry(param0, NULL, param5, param4, param8);
Sound_PlayDelayedChatotCry(chatotCry, NULL, volume, pan, delay);
}
} else {
Sound_PlayDelayedPokemonCry(param1, monSpecies, param4, param5, param7, param8, param3);
return;
}
Sound_PlayDelayedPokemonCry(crymod, species, pan, volume, heapID, delay, form);
}
BOOL sub_02077E3C(Pokemon *mon)

View File

@ -1,6 +1,8 @@
#include <nitro.h>
#include <string.h>
#include "constants/species.h"
#include "struct_decls/sys_task.h"
#include "struct_defs/chatot_cry.h"
@ -522,8 +524,8 @@ BOOL Sound_PlayPokemonCry (int param0, u16 param1, int param2, int param3, int p
}
if (v2 != 494) {
if ((v2 > 495) || (v2 == 0)) {
v2 = 1;
if ((v2 > MAX_SPECIES) || (v2 == 0)) {
v2 = SPECIES_BULBASAUR;
}
}
@ -552,7 +554,7 @@ BOOL Sound_PlayPokemonCry (int param0, u16 param1, int param2, int param3, int p
sub_02004C4C(15);
}
if (v2 == 441) {
if (v2 == SPECIES_CHATOT) {
switch (param0) {
case 0:
case 1: