From 01d6fe2685cfff65e553cd9801acad2fa1680d26 Mon Sep 17 00:00:00 2001 From: Kermalis <29823718+Kermalis@users.noreply.github.com> Date: Sat, 26 Aug 2023 13:56:46 -0400 Subject: [PATCH] Clean menu_input --- include/code_800558C_1.h | 1 + include/code_80118A4.h | 16 + include/gulpin_shop.h | 7 +- include/text_util.h | 1 + src/adventure_log.c | 2 +- src/code_2.c | 3 +- src/code_800558C_1.c | 6 +- src/code_800DAC0.c | 2 +- src/code_80118A4.c | 55 +- src/code_8012A18.c | 4 +- src/code_8012A18_1.c | 3 - src/code_801AFA4.c | 2 +- src/code_801B3C0.c | 3 +- src/code_801C620.c | 3 +- src/code_801D760.c | 2 +- src/code_801EE10_1.c | 2 +- src/code_801EE10_mid.c | 2 +- src/code_8021774.c | 2 +- src/code_8021774_pre.c | 2 +- src/code_8023144.c | 2 +- src/code_8031D70.c | 2 +- src/code_8040094.c | 3 +- src/dungeon_music.c | 3 +- src/felicity_bank.c | 2 +- src/friend_area_action_menu_1.c | 2 +- src/friend_list_menu.c | 2 +- src/friend_rescue.c | 4 +- src/ground_main.c | 3 +- src/gulpin_shop.c | 6 +- src/gulpin_shop_1.c | 3 +- src/hints_menu.c | 4 +- src/kecleon_bros.c | 5 +- src/luminous_cave.c | 6 +- src/mailbox.c | 3 +- src/makuhita_dojo.c | 3 +- src/menu_input.c | 1023 +++++++++++++++---------------- src/options_menu.c | 2 +- src/other_menus.c | 4 +- src/party_list_menu.c | 2 +- src/pelipper_board.c | 2 +- src/personality_test.c | 3 +- src/pokemon_news.c | 2 +- src/post_office_guide.c | 2 +- src/save.c | 5 +- src/text_util.c | 6 +- src/thank_you_wonder_mail.c | 3 +- src/trade_items_menu.c | 3 +- src/wigglytuff_shop.c | 2 +- src/wonder_mail.c | 3 +- src/wonder_mail_2_1.c | 2 +- src/wonder_mail_2_mid.c | 4 +- src/wonder_mail_3.c | 3 +- src/wonder_mail_3_mid.c | 3 +- src/wonder_mail_4.c | 2 +- src/wonder_mail_5.c | 2 +- src/wonder_mail_802DF88.c | 2 +- src/wonder_mail_main_menu.c | 3 +- 57 files changed, 603 insertions(+), 651 deletions(-) create mode 100644 include/code_80118A4.h diff --git a/include/code_800558C_1.h b/include/code_800558C_1.h index fd9e18903..05c624d10 100644 --- a/include/code_800558C_1.h +++ b/include/code_800558C_1.h @@ -1,6 +1,7 @@ #ifndef GUARD_CODE_800558C_1_H #define GUARD_CODE_800558C_1_H +void nullsub_7(s16 *); void nullsub_10(bool8); void nullsub_12(void); void nullsub_13(void); diff --git a/include/code_80118A4.h b/include/code_80118A4.h new file mode 100644 index 000000000..308c910e6 --- /dev/null +++ b/include/code_80118A4.h @@ -0,0 +1,16 @@ +#ifndef GUARD_CODE_80118A4_H +#define GUARD_CODE_80118A4_H + +void FadeOutAllMusic(u16); +void PlayMenuSoundEffect(u32); +void PlaySound(u16); +void sub_801180C(void); +void sub_8011830(void); +void sub_8011860(void); +void xxx_call_fade_in_new_bgm(u16, u16); +void xxx_call_fade_out_bgm(u16); +void xxx_call_start_bg_music(void); +void xxx_call_stop_bgm(void); +void xxx_call_stop_fanfare_se(u16); + +#endif // GUARD_CODE_80118A4_H \ No newline at end of file diff --git a/include/gulpin_shop.h b/include/gulpin_shop.h index 48ce06f20..6bf6c5a60 100644 --- a/include/gulpin_shop.h +++ b/include/gulpin_shop.h @@ -1,5 +1,10 @@ #ifndef GUARD_GULPIN_SHOP_H -#define GUARD_GULPIN_SHOP_H +#define GUARD_GULPIN_SHOP_H + +#include "constants/move.h" +#include "file_system.h" +#include "menu.h" +#include "text.h" // size: 0x18C struct GulpinShopWork diff --git a/include/text_util.h b/include/text_util.h index cbd3d882d..3ae9b7653 100644 --- a/include/text_util.h +++ b/include/text_util.h @@ -11,5 +11,6 @@ u8 sub_8092354(u8 index); u8 sub_8092364(u8 index); void CopyAbilityNametoBuffer(char *buffer, u8 index); u8 *GetAbilityDescription(u8 index); +u32 ReturnIntFromChar2(u8); #endif diff --git a/src/adventure_log.c b/src/adventure_log.c index fa883a647..741cfcd49 100644 --- a/src/adventure_log.c +++ b/src/adventure_log.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "code_80130A8.h" #include "constants/input.h" #include "memory.h" @@ -42,7 +43,6 @@ const u8 fill_adven[] = "pksdir0"; void sub_8032084(); void DisplayAdventureLog(); -extern void PlayMenuSoundEffect(u32); extern bool8 sub_8097710(u8); extern s16 sub_80978B8(); diff --git a/src/code_2.c b/src/code_2.c index a09664f83..277a76897 100644 --- a/src/code_2.c +++ b/src/code_2.c @@ -20,8 +20,8 @@ #include "cpu.h" #include "code_8094F88.h" #include "sprite.h" +#include "code_80118A4.h" -extern void sub_801180C(void); extern void NDS_LoadOverlay_GroundMain(void); extern void sub_8014144(void); extern void sub_8097670(void); @@ -48,7 +48,6 @@ extern void xxx_draw_string_80144C4(void); extern void sub_8005838(u32, u32); extern void nullsub_8(u32); extern void sub_80060EC(void); -extern void sub_8011860(void); extern void sub_800CB20(void); extern void TransferBGPaletteBuffer(void); extern void xxx_call_update_bg_vram(void); diff --git a/src/code_800558C_1.c b/src/code_800558C_1.c index cee2eace0..90d741544 100644 --- a/src/code_800558C_1.c +++ b/src/code_800558C_1.c @@ -28,8 +28,10 @@ void sub_8005770(s32 param_1, u8 *RGBArray, s32 a1, u8 *a2) } } -void nullsub_7(void) -{} +// Maybe struct Position +void nullsub_7(s16 *a0) +{ +} void nullsub_8(void) {} diff --git a/src/code_800DAC0.c b/src/code_800DAC0.c index 40b6deddb..1e6ab3da4 100644 --- a/src/code_800DAC0.c +++ b/src/code_800DAC0.c @@ -1,5 +1,6 @@ #include "global.h" #include "code_800DAC0.h" +#include "code_80118A4.h" #include "file_system.h" #include "memory.h" @@ -50,7 +51,6 @@ extern void sub_803EAF0(u32, u32); extern void sub_800CD64(u32, u32); extern struct unkStruct_800F18C *sub_800F18C(s32); extern void sub_800DCA8(struct unkStruct_203B0CC_sub *); -extern void PlaySound(u16); extern u8 gefob000_string[]; extern u8 gefob001_string[]; diff --git a/src/code_80118A4.c b/src/code_80118A4.c index 4fce8effc..735333137 100644 --- a/src/code_80118A4.c +++ b/src/code_80118A4.c @@ -1,6 +1,7 @@ #include #include #include "global.h" +#include "code_80118A4.h" #include "music.h" #include "constants/bg_music.h" #include "play_time.h" @@ -10,13 +11,11 @@ #include "game_options.h" #include "sprite.h" -void xxx_call_stop_bgm(void); - extern bool8 sub_80023E4(u8); -extern void xxx_call_stop_fanfare_se(u16 r0); extern struct GameOptions *gGameOptionsRef; +// size: 0x4DD8 struct UnkBgStruct { u8 padding[0x4c4b]; @@ -24,8 +23,8 @@ struct UnkBgStruct u8 padding2[0x17A]; u32 *unk4dcc; u32 unk4dd0; - s16 xoffset; - s16 yoffset; + /* 0x4DD4 */ s16 xoffset; + /* 0x4DD6 */ s16 yoffset; }; extern struct UnkBgStruct *gUnknown_203B0E4; @@ -43,7 +42,6 @@ extern void xxx_call_update_bg_vram(void); extern void sub_8009908(void); extern void xxx_call_update_bg_sound_input(void); extern void sub_80060EC(void); -extern void sub_8011860(void); extern void sub_800CB20(void); extern void sub_8004AF0(u8, u32 *r1, u32, u32, u32 *r2, u32); extern u8 sub_80111C4(); @@ -77,15 +75,15 @@ void sub_801169C(void) void sub_8011760(void) { - if(sub_80023E4(0xD)) + if (sub_80023E4(13)) StartNewBGM(MUS_WORLD_CALAMITY); - else if(sub_80023E4(0xC)) + else if (sub_80023E4(12)) StartNewBGM(MUS_POKEMON_SQUARE); } void sub_801178C(void) { - if(sub_80023E4(0xD)) + if (sub_80023E4(13)) StartNewBGM(MUS_WORLD_CALAMITY); else StartNewBGM(MUS_POKEMON_SQUARE); @@ -93,13 +91,13 @@ void sub_801178C(void) void sub_80117AC(void) { - if(!sub_80023E4(0xD)) - FadeOutBGM(0x1E); + if (!sub_80023E4(13)) + FadeOutBGM(30); } void sub_80117C4(void) { - FadeOutBGM(0x1E); + FadeOutBGM(30); } // Some sound effect @@ -143,18 +141,14 @@ void xxx_call_start_bg_music(void) void sub_8011860(void) { - if(gUnknown_202DE20 > 0) - { + if (gUnknown_202DE20 > 0) gUnknown_202DE20--; - } - if(gUnknown_202DE22 > 0) - { + + if (gUnknown_202DE22 > 0) gUnknown_202DE22--; - } - if(gUnknown_202DE24 > 0) - { + + if (gUnknown_202DE24 > 0) gUnknown_202DE24--; - } } void StopAllMusic_1(void) @@ -196,14 +190,13 @@ void xxx_call_fade_out_bgm(u16 speed) FadeOutBGM(speed); } -u32 IsEqualtoBGTrack(u16 songIndex) +bool8 IsEqualtoBGTrack(u16 songIndex) { u32 currBGSong; currBGSong = GetCurrentBGSong(); - if(songIndex == STOP_BGM) + if (songIndex == STOP_BGM) return currBGSong != STOP_BGM; - return currBGSong == songIndex; } @@ -232,23 +225,25 @@ bool8 IsFanfareSEPlaying_1(u16 songIndex) return IsFanfareSEPlaying(songIndex); } -void PlayMenuSoundEffect(u32 r0) +void PlayMenuSoundEffect(u32 a0) { - if(gUnknown_202DE20 > 0) + if (gUnknown_202DE20 > 0) return; - PlayFanfareSE(gUnknown_80D4144[r0], MAX_VOLUME); + + PlayFanfareSE(gUnknown_80D4144[a0], MAX_VOLUME); gUnknown_202DE20 = 4; } void sub_8011A04(void) { - if(gUnknown_202DE22 > 0) + if (gUnknown_202DE22 > 0) return; + gUnknown_202DE22 = 3; PlayFanfareSE(305, MAX_VOLUME); } -void sub_8011A2C(u32 r0) +UNUSED static void sub_8011A2C(u32 a0) { - gUnknown_202DE1C = r0; + gUnknown_202DE1C = a0; } diff --git a/src/code_8012A18.c b/src/code_8012A18.c index d4b24b84d..c98cbd46d 100644 --- a/src/code_8012A18.c +++ b/src/code_8012A18.c @@ -1,10 +1,10 @@ #include "global.h" #include "code_800558C.h" -#include "input.h" +#include "code_80118A4.h" #include "game_options.h" +#include "input.h" #include "sprite.h" -extern void sub_8011860(); extern void xxx_draw_string_80144C4(); extern void nullsub_8(u8); extern void sub_800CB20(); diff --git a/src/code_8012A18_1.c b/src/code_8012A18_1.c index 8bfc38cbc..3fadc67cd 100644 --- a/src/code_8012A18_1.c +++ b/src/code_8012A18_1.c @@ -48,9 +48,6 @@ enum MENU_ACTION_NO, }; -extern u32 ReturnIntFromChar2(u8); - - s32 sub_8015FEC(u8 *buffer, s32 size) { struct unkChar *iVar2; diff --git a/src/code_801AFA4.c b/src/code_801AFA4.c index f4716c5ec..9cf65cf05 100644 --- a/src/code_801AFA4.c +++ b/src/code_801AFA4.c @@ -7,6 +7,7 @@ #include "pokemon.h" #include "gulpin_shop.h" #include "code_80130A8.h" +#include "code_80118A4.h" extern void sub_8092C84(u8 *, u16); extern void sub_8099690(u32); @@ -33,7 +34,6 @@ extern void unk_CopyMoves4To8(struct Move *, struct Move *); extern bool8 IsHMItem(u8); extern void sub_801B178(void); extern void sub_8094060(void *, struct Move *); -extern void PlaySound(u32); extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); extern u32 sub_801E8C0(void); diff --git a/src/code_801B3C0.c b/src/code_801B3C0.c index c2860279b..ec900ce93 100644 --- a/src/code_801B3C0.c +++ b/src/code_801B3C0.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "code_801B3C0.h" #include "constants/colors.h" #include "text1.h" @@ -67,7 +68,6 @@ extern struct UnkTextStruct2 gUnknown_80DBA70; extern void sub_801BB5C(void); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_801B748(u32); -extern void PlayMenuSoundEffect(u32); extern void sub_8013F84(void); extern s32 sub_80913E0(struct Item *, u32, struct subStruct_203B240 **); extern void sub_80140B4(struct UnkTextStruct2 *); @@ -83,7 +83,6 @@ extern void sub_801B760(void); extern void sub_801B874(void); extern u32 sub_8001784(u32, u32, u16); extern void sub_800199C(u32, u32, u32, u32); -extern void PlaySound(u32); extern s32 sub_808D544(u32); void sub_801B480(void); diff --git a/src/code_801C620.c b/src/code_801C620.c index e8c56b672..450691618 100644 --- a/src/code_801C620.c +++ b/src/code_801C620.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "code_801C620.h" #include "constants/item.h" #include "constants/iq_skill.h" @@ -152,7 +153,6 @@ extern void sub_801CC38(void); extern void sub_80140B4(struct UnkTextStruct2 *); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); extern void sub_8013F84(void); -extern void PlayMenuSoundEffect(u32); extern char * GetIQSkillDescription(u8 r0); extern s32 GetNumAvailableIQSkills(u8 *param_1, s32 pokeIQ); extern char * GetIQSkillName(u8 r0); @@ -170,7 +170,6 @@ void sub_801C6E4(void); void sub_801C848(void); u32 sub_801C308(u8); -extern void PlaySound(u32); void ToggleIQSkill(u8 *param_1, u32 skillIndex); s32 sub_801C390(void); void sub_801C3F8(void); diff --git a/src/code_801D760.c b/src/code_801D760.c index c63394b02..0e10d1d1a 100644 --- a/src/code_801D760.c +++ b/src/code_801D760.c @@ -16,6 +16,7 @@ #include "code_800D090.h" #include "menu_input.h" #include "code_8021774.h" +#include "code_80118A4.h" struct unkStruct_203B258 { @@ -31,7 +32,6 @@ extern struct unkStruct_203B258 *gUnknown_203B258; extern struct UnkTextStruct2 gUnknown_80DBF88; extern struct UnkTextStruct2 gUnknown_80DBF70; -extern void PlayMenuSoundEffect(u32); extern void sub_801DB54(); extern void sub_801DBD4(); diff --git a/src/code_801EE10_1.c b/src/code_801EE10_1.c index 0c2e4fa46..af575b31d 100644 --- a/src/code_801EE10_1.c +++ b/src/code_801EE10_1.c @@ -8,6 +8,7 @@ #include "text2.h" #include "text_util.h" #include "menu_input.h" +#include "code_80118A4.h" struct unkStruct_203B2AC { @@ -52,7 +53,6 @@ extern bool8 sub_80023E4(u32); extern void sub_808FF20(u32 *, struct PokemonStruct *, bool8); extern void CreatePokemonInfoTabScreen(u32, s16, u32 *, u32 *, u32); extern void sub_802452C(void); -extern void PlayMenuSoundEffect(u32); bool8 ComparePokemonNames(s16 a1, s16 a2); void sub_8024588(void); diff --git a/src/code_801EE10_mid.c b/src/code_801EE10_mid.c index 571575089..4e7dfdaf4 100644 --- a/src/code_801EE10_mid.c +++ b/src/code_801EE10_mid.c @@ -11,6 +11,7 @@ #include "sprite.h" #include "code_80130A8.h" #include "code_801EE10_mid.h" +#include "code_80118A4.h" extern struct unkStruct_203B270 *gUnknown_203B270; @@ -56,7 +57,6 @@ extern u8 gAvailablePokemonNames[]; extern u8 gUnknown_80DC310[]; extern u8 gUnknown_80DC2DC[]; -extern void PlayMenuSoundEffect(u32); extern void sub_80140B4(struct UnkTextStruct2 *); extern void sub_801F918(s32); extern void sub_801FA58(void); diff --git a/src/code_8021774.c b/src/code_8021774.c index d7a39a3b8..f385b92bf 100644 --- a/src/code_8021774.c +++ b/src/code_8021774.c @@ -10,6 +10,7 @@ #include "code_800D090.h" #include "menu_input.h" #include "code_8021774.h" +#include "code_80118A4.h" struct unkStruct_203B28C { @@ -54,7 +55,6 @@ extern void sub_8092578(u8 *buffer, u8 index, u8 r2); extern void sub_8021878(void); extern void sub_8021894(void); -extern void PlayMenuSoundEffect(u32); extern void sub_8021A60(void); void sub_8021820(void); u8 sub_80023E4(u32); diff --git a/src/code_8021774_pre.c b/src/code_8021774_pre.c index 72ceb6765..d0e47fffa 100644 --- a/src/code_8021774_pre.c +++ b/src/code_8021774_pre.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "code_801EE10_mid.h" #include "code_8021774_pre.h" #include "constants/friend_area.h" @@ -35,7 +36,6 @@ extern struct UnkTextStruct2 gUnknown_80DC464; u8 sub_8021700(u32 mode); s32 sub_8021664(void); extern void sub_8021410(void); -extern void PlayMenuSoundEffect(u32); bool8 sub_80211AC(u32 param_1, u32 param_2) { diff --git a/src/code_8023144.c b/src/code_8023144.c index b2ebdb39f..387a724ae 100644 --- a/src/code_8023144.c +++ b/src/code_8023144.c @@ -16,6 +16,7 @@ #include "kecleon_bros.h" #include "code_80130A8.h" #include "code_801B3C0.h" +#include "code_80118A4.h" struct unkStruct_3001B5C { @@ -52,7 +53,6 @@ extern u8 sub_8023704(u8); extern void sub_8023420(void); extern void sub_80234BC(void); extern u32 sub_80236A4(void); -extern void PlayMenuSoundEffect(u32); extern u8 gUnknown_80DC5EC[]; diff --git a/src/code_8031D70.c b/src/code_8031D70.c index 1bde2d795..4f963fbc8 100644 --- a/src/code_8031D70.c +++ b/src/code_8031D70.c @@ -9,6 +9,7 @@ #include "pokemon.h" #include "code_8094F88.h" #include "menu_input.h" +#include "code_80118A4.h" struct unkStruct_203B334 { @@ -48,7 +49,6 @@ ALIGNED(4) const u8 gUnknown_80E1FDC[] = "Password"; ALIGNED(4) static const u8 fill0[] = "pksdir0"; extern void sub_803D2C0(u8 *, struct unkStruct_203B480 *); -extern void PlayMenuSoundEffect(u32); void sub_8031E00(void); void sub_8031E58(void); diff --git a/src/code_8040094.c b/src/code_8040094.c index c979d12ac..98cf46d10 100644 --- a/src/code_8040094.c +++ b/src/code_8040094.c @@ -1,5 +1,5 @@ #include "global.h" - +#include "code_80118A4.h" #include "code_80521D0.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" @@ -19,7 +19,6 @@ extern void sub_80060EC(void); extern void sub_800CB20(void); extern void LoadBufferedInputs(void); extern void xxx_call_update_bg_sound_input(void); -extern void sub_8011860(void); extern void sub_803F580(u32); extern void sub_8049ED4(); diff --git a/src/dungeon_music.c b/src/dungeon_music.c index da2ea13bd..3e5a4b51d 100644 --- a/src/dungeon_music.c +++ b/src/dungeon_music.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "constants/bg_music.h" #include "dungeon.h" #include "music.h" @@ -26,8 +27,6 @@ extern u8 gUnknown_810AC64; // 0x8 extern u8 gUnknown_810AC66; // 0x8 extern void sub_80709C8(u8 *buffer, struct EntityInfo *entityInfo); -void FadeOutAllMusic(u16); -void xxx_call_stop_bgm(void); // Dungeon Music Player adds in this flag to tell // the system to fade in rather than immediately playing diff --git a/src/felicity_bank.c b/src/felicity_bank.c index f48c8f97c..b04767e6e 100644 --- a/src/felicity_bank.c +++ b/src/felicity_bank.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "code_80130A8.h" #include "felicity_bank.h" #include "memory.h" @@ -28,7 +29,6 @@ extern u8 gFelicitySavings[]; extern u8 gFelicityMoney[]; extern u8 gUnknown_80DB738; -extern void PlaySound(u32); extern void sub_801645C(); extern void sub_80169BC(); extern void sub_8016B00(); diff --git a/src/friend_area_action_menu_1.c b/src/friend_area_action_menu_1.c index 46df1c084..cb7de6cdf 100644 --- a/src/friend_area_action_menu_1.c +++ b/src/friend_area_action_menu_1.c @@ -11,6 +11,7 @@ #include "code_80130A8.h" #include "code_801EE10_1.h" #include "code_801B3C0.h" +#include "code_80118A4.h" extern struct unkStruct_203B2BC *gUnknown_203B2BC; extern struct TeamInventory *gTeamInventoryRef; @@ -19,7 +20,6 @@ extern u32 sub_801EF38(u8 r0); extern void sub_801F214(); extern void SetFriendAreaActionMenuState(u32); -extern void PlaySound(u32); extern void nullsub_104(); extern void sub_8099690(u32); diff --git a/src/friend_list_menu.c b/src/friend_list_menu.c index 2959a3758..27405ae49 100644 --- a/src/friend_list_menu.c +++ b/src/friend_list_menu.c @@ -13,6 +13,7 @@ #include "code_801EE10_1.h" #include "code_8012A18_1.h" #include "code_801B3C0.h" +#include "code_80118A4.h" // there might be more overlap with unkStruct_203B2BC // I was working on the moves and put the data that seemed to correspond to that @@ -119,7 +120,6 @@ extern s16 sub_80A5728(void); extern u8 sub_8002658(s16); extern bool8 sub_8024108(u32); extern void sub_801F1B0(u32, u32); -extern void PlaySound(u32); extern void sub_8024458(s16, u32); extern void sub_801BEEC(s16); extern void nullsub_104(void); diff --git a/src/friend_rescue.c b/src/friend_rescue.c index 1a53edcea..980212976 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -20,6 +20,7 @@ #include "code_801C620.h" #include "code_801B3C0.h" #include "cpu.h" +#include "code_80118A4.h" extern void SetFriendRescueMenuState(u32); extern struct PokemonStruct *GetPlayerPokemonStruct(void); @@ -281,7 +282,6 @@ extern void sub_802F2C0(void); extern void sub_8030DE4(void); extern void sub_802453C(void); extern u8 sub_800D588(void); -extern void sub_8011830(void); extern void sub_80151C0(u32, u8 *); extern u32 sub_801D008(void); extern u32 sub_8023CE8(void); @@ -303,8 +303,6 @@ extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void MemoryFill8(u8 *dest, u8 value, s32 size); extern void ResetUnusedInputStruct(void); extern void sprintfStatic(char *buffer, const char *text, ...); -extern void xxx_call_start_bg_music(void); - u32 CreateFriendRescueMenu(void) { diff --git a/src/ground_main.c b/src/ground_main.c index 6aae81407..ba5fc7611 100644 --- a/src/ground_main.c +++ b/src/ground_main.c @@ -4,6 +4,7 @@ #include "debug.h" #include "code_80A26CC.h" #include "event_flag.h" +#include "code_80118A4.h" EWRAM_DATA u32 gUnknown_20398A8 = {0}; EWRAM_DATA u32 gUnknown_20398AC = {0}; @@ -49,7 +50,6 @@ extern void sub_809CA20(); extern void sub_80A6E80(); extern void sub_8099BE4(); extern void sub_8099744(); -extern void sub_8011860(); extern void sub_800CB20(); extern void nullsub_120(); extern void sub_80A5E70(); @@ -78,7 +78,6 @@ extern void sub_80961B4(); extern void ClearAllItems_8091FB4(); extern const char *sub_80A2B18(s16); extern void ChooseKecleonShopInventory(u32); -extern void FadeOutAllMusic(u16); extern u8 sub_809C730(); extern s16 sub_80A2750(s16); diff --git a/src/gulpin_shop.c b/src/gulpin_shop.c index 71e8c2c54..e297a0b95 100644 --- a/src/gulpin_shop.c +++ b/src/gulpin_shop.c @@ -1,12 +1,13 @@ #include "global.h" +#include "code_80118A4.h" #include "code_80130A8.h" +#include "gulpin_shop.h" #include "pokemon.h" #include "memory.h" +#include "menu_input.h" #include "moves.h" #include "text1.h" #include "text2.h" -#include "gulpin_shop.h" -#include "menu_input.h" extern struct GulpinShopWork *gGulpinShopWork; extern const struct UnkTextStruct2 gUnknown_80DC11C; @@ -38,7 +39,6 @@ extern void sub_801F280(u32); extern void sub_801F808(u16 *); extern u32 sub_801F890(void); extern void sub_801F8D0(void); -extern void PlaySound(u32); void SetGulpinShopState(u32); u32 CreateGulpinShop(s32 isAsleep, s16 pokeSpecies, struct Move *moves) diff --git a/src/gulpin_shop_1.c b/src/gulpin_shop_1.c index 8ea2ebf15..8ecaf3841 100644 --- a/src/gulpin_shop_1.c +++ b/src/gulpin_shop_1.c @@ -11,6 +11,7 @@ #include "felicity_bank.h" #include "code_80130A8.h" #include "code_801EE10_1.h" +#include "code_80118A4.h" // size: 0x1E0 struct unkStruct_203B27C @@ -84,8 +85,6 @@ extern u8 gUnknown_80DC438[]; extern u8 gUnknown_80DC448[]; extern u8 gUnknown_202E128[]; -void PlayMenuSoundEffect(u32); -void PlaySound(u32); bool8 sub_8021178(void); void CreateGulpinShopMenu(void); void sub_8020950(void); diff --git a/src/hints_menu.c b/src/hints_menu.c index a9e4a625a..9da423af8 100644 --- a/src/hints_menu.c +++ b/src/hints_menu.c @@ -1,9 +1,10 @@ #include "global.h" +#include "code_80118A4.h" #include "memory.h" +#include "menu_input.h" #include "text1.h" #include "text2.h" #include "input.h" -#include "menu_input.h" #define MAX_HINTS 5 @@ -44,7 +45,6 @@ extern struct Hints gGameHints[MAX_HINTS]; extern u8 gUnknown_80DC0D4[MAX_HINTS]; extern void sub_801E714(void); -extern void PlayMenuSoundEffect(u32); extern void sub_801E714(void); extern void sub_801E76C(void); extern void DisplayChosenHint(void); diff --git a/src/kecleon_bros.c b/src/kecleon_bros.c index 5d8fab94f..e2105c2e2 100644 --- a/src/kecleon_bros.c +++ b/src/kecleon_bros.c @@ -1,5 +1,6 @@ #include "global.h" #include "code_800D090.h" +#include "code_80118A4.h" #include "code_80130A8.h" #include "code_801B3C0.h" #include "constants/input.h" @@ -58,10 +59,6 @@ extern const u8 gTeamToolboxB[]; // code_8098BDC.s extern void sub_8099690(u32); -// code_80118A4.c -extern void PlayMenuSoundEffect(u32); -extern void PlaySound(u16 songIndex); - void sub_8018D30(void); void sub_80194F8(void); void sub_80195C0(void); diff --git a/src/luminous_cave.c b/src/luminous_cave.c index 1e8d92f41..be176eadc 100644 --- a/src/luminous_cave.c +++ b/src/luminous_cave.c @@ -14,6 +14,7 @@ #include "code_80130A8.h" #include "code_8012A18_1.h" #include "code_801B3C0.h" +#include "code_80118A4.h" struct unkStruct_203B2B0 { @@ -186,11 +187,7 @@ extern void LuminousCave_AdvancetoFallbackState(void); extern void sub_8024804(void); extern void UpdateLuminousCaveDialogue(void); -void xxx_call_fade_out_bgm(u16 speed); -void xxx_call_stop_fanfare_se(u16 songIndex); -void xxx_call_fade_in_new_bgm(u16 songIndex, u16 speed); void sub_80977D0(void); -void PlaySound(u32); void sub_8024CFC(void); void sub_8025254(void); void sub_8024D48(void); @@ -200,7 +197,6 @@ void sub_8024E30(void); void sub_801AEE4(u32, u32); void sub_808F734(struct PokemonStruct *, s16); extern void sub_8099690(u32); -extern void PlayMenuSoundEffect(u32); extern void sub_808F468(struct PokemonStruct *, u8 *, u32); bool8 LuminousCave_HasOnly1Member(void); diff --git a/src/mailbox.c b/src/mailbox.c index 3b271c278..7fcffdb3b 100644 --- a/src/mailbox.c +++ b/src/mailbox.c @@ -7,6 +7,7 @@ #include "mailbox.h" #include "wonder_mail.h" #include "menu_input.h" +#include "code_80118A4.h" EWRAM_DATA_2 struct unkStruct_203B304 *gUnknown_203B304 = {0}; @@ -105,8 +106,6 @@ extern void sub_8096D24(void); extern void ResetMailboxSlot(u8); extern void ReceivePKMNNews(u8); extern void sub_8096078(void); -extern void PlayMenuSoundEffect(u32); -extern void PlaySound(u32); extern void sub_802BEDC(void); extern u8 sub_802BE74(void); extern u8 HasNoAcceptedJobs(void); diff --git a/src/makuhita_dojo.c b/src/makuhita_dojo.c index 959554fce..4062ade05 100644 --- a/src/makuhita_dojo.c +++ b/src/makuhita_dojo.c @@ -1,5 +1,6 @@ #include "global.h" #include "code_800D090.h" +#include "code_80118A4.h" #include "code_80130A8.h" #include "constants/colors.h" #include "constants/input.h" @@ -79,8 +80,6 @@ extern u8 sub_80A2740(s32 r0); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern bool8 IsMazeCompleted(s32); -extern void PlayMenuSoundEffect(u32); -extern void PlaySound(u16); extern void PrintColoredPokeNameToBuffer(u8 *, struct PokemonStruct *, s32); extern void PrintYellowDungeonNametoBuffer(u8 *, struct DungeonLocation *); diff --git a/src/menu_input.c b/src/menu_input.c index f53a0a5dc..df8f4318a 100644 --- a/src/menu_input.c +++ b/src/menu_input.c @@ -1,236 +1,228 @@ #include "global.h" +#include "code_800558C_1.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "code_80130A8.h" #include "constants/colors.h" #include "constants/input.h" +#include "menu_input.h" +#include "sprite.h" +#include "text_util.h" #include "text1.h" #include "text2.h" #include "util.h" -#include "code_800D090.h" -#include "menu_input.h" -#include "code_80130A8.h" -#include "sprite.h" -extern u8 gUnknown_80D4828[]; +// data_80D47B8.s +extern const u8 gUnknown_80D4828[]; -extern void PlayMenuSoundEffect(u32); +// text.s extern s32 sub_8008ED0(const u8 *); -void sub_8012EBC(struct MenuStruct *param_1); -extern void sub_8013134(struct MenuInputStruct *, u32, u32); extern s16 sub_8009614(u32, u32); -extern u32 ReturnIntFromChar2(u8); -extern void nullsub_7(u16 *); -extern void PlayMenuSoundEffect(u32); -void sub_801332C(s16 *); -void sub_8013470(struct MenuInputStruct *); +static void sub_8013134(struct MenuInputStruct *, u32, u32); +static void sub_801332C(s16 *); +static void sub_8013470(struct MenuInputStruct *); -const u32 gDefaultMenuTextColors[] = { COLOR_WHITE_2, COLOR_RED, COLOR_RED }; +const u32 gDefaultMenuTextColors[3] = { COLOR_WHITE_2, COLOR_RED, COLOR_RED }; u32 sub_8012A64(struct MenuInputStructSub *r0, s32 r1) { - if(r0 == NULL) - { + if (r0 == NULL) return sub_8012AE8(); - } - if(r1 != -1) - { + + if (r1 != -1) nullsub_34(r0); - } - if(r0->a_button != 0) - { + + if (r0->a_button != 0) { r0->a_button = 0; return INPUT_A_BUTTON; } - else if(r0->b_button == 0) - { + + if (r0->b_button == 0) return sub_8012AE8(); - } - else - { - r0->b_button = 0; - return INPUT_B_BUTTON; - } + + r0->b_button = 0; + return INPUT_B_BUTTON; } s32 GetKeyPress(struct MenuInputStruct *r0) { - if(r0 != NULL) - { - if(r0->unk28.a_button != 0) - { + if (r0 != NULL) { + if (r0->unk28.a_button != 0) return INPUT_A_BUTTON; - } - if(r0->unk28.b_button != 0) - { + + if (r0->unk28.b_button != 0) return INPUT_B_BUTTON; - } - if(r0->unk28.dpad_left != 0) - { + + if (r0->unk28.dpad_left != 0) return INPUT_DPAD_LEFT; - } - if(r0->unk28.dpad_right != 0) - { + + if (r0->unk28.dpad_right != 0) return INPUT_DPAD_RIGHT; - } } + return sub_8012AE8(); } s32 sub_8012AE8(void) { - if ((gRealInputs.held & R_BUTTON) != 0) { - if ((gRealInputs.pressed & A_BUTTON) != 0) { - return INPUT_R_A_BUTTONS; + if (gRealInputs.held & R_BUTTON) { + if (gRealInputs.pressed & A_BUTTON) + return INPUT_R_A_BUTTONS; + + if (gRealInputs.repeated & DPAD_UP) + return INPUT_R_DPAD_UP_BUTTONS; + + if (gRealInputs.repeated & DPAD_DOWN) + return INPUT_R_DPAD_DOWN_BUTTONS; + + if (gRealInputs.repeated & DPAD_LEFT) + return INPUT_R_DPAD_LEFT_BUTTONS; + + if (gRealInputs.repeated & DPAD_RIGHT) + return INPUT_R_DPAD_RIGHT_BUTTONS; + + if (gRealInputs.repeated & R_BUTTON) + return INPUT_R_BUTTON; } - if ((gRealInputs.repeated & DPAD_UP) != 0) { - return INPUT_R_DPAD_UP_BUTTONS; + else { + if (gRealInputs.pressed & A_BUTTON) + return INPUT_A_BUTTON; + + if (gRealInputs.pressed & B_BUTTON) + return INPUT_B_BUTTON; + + if (gRealInputs.pressed & SELECT_BUTTON) + return INPUT_SELECT_BUTTON; + + if (gRealInputs.pressed & START_BUTTON) + return INPUT_START_BUTTON; + + if (gRealInputs.repeated & DPAD_UP) + return INPUT_DPAD_UP; + + if (gRealInputs.repeated & DPAD_DOWN) + return INPUT_DPAD_DOWN; + + if (gRealInputs.repeated & DPAD_LEFT) + return INPUT_DPAD_LEFT; + + if (gRealInputs.repeated & DPAD_RIGHT) + return INPUT_DPAD_RIGHT; + + if (gRealInputs.repeated & L_BUTTON) + return INPUT_L_BUTTON; } - if ((gRealInputs.repeated & DPAD_DOWN) != 0) { - return INPUT_R_DPAD_DOWN_BUTTONS; - } - if ((gRealInputs.repeated & DPAD_LEFT) != 0) { - return INPUT_R_DPAD_LEFT_BUTTONS; - } - if ((gRealInputs.repeated & DPAD_RIGHT) != 0) { - return INPUT_R_DPAD_RIGHT_BUTTONS; - } - if ((gRealInputs.repeated & R_BUTTON) != 0) { - return INPUT_R_BUTTON; - } - } - else - { - if ((gRealInputs.pressed & A_BUTTON) != 0) { - return INPUT_A_BUTTON; - } - if ((gRealInputs.pressed & B_BUTTON) != 0) { - return INPUT_B_BUTTON; - } - if ((gRealInputs.pressed & SELECT_BUTTON) != 0) { - return INPUT_SELECT_BUTTON; - } - if ((gRealInputs.pressed & START_BUTTON) != 0) { - return INPUT_START_BUTTON; - } - if ((gRealInputs.repeated & DPAD_UP) != 0) { - return INPUT_DPAD_UP; - } - if ((gRealInputs.repeated & DPAD_DOWN) != 0) { - return INPUT_DPAD_DOWN; - } - if ((gRealInputs.repeated & DPAD_LEFT) != 0) { - return INPUT_DPAD_LEFT; - } - if ((gRealInputs.repeated & DPAD_RIGHT) != 0) { - return INPUT_DPAD_RIGHT; - } - if ((gRealInputs.repeated & L_BUTTON) != 0) { - return INPUT_L_BUTTON; - } - } - return INPUT_NONE; + + return INPUT_NONE; } -void sub_8012BC4(u32 x, u32 y, s32 n, s32 len, u32 color, u32 param_6) +void sub_8012BC4(u32 x, u32 y, s32 n, s32 len, u32 color, u32 a5) { - s32 iVar1; - u32 uVar2; - struct unkChar *iVar3; - s32 counter; - s32 *piVar3; - s32 *piVar4; - s32 total_x; - s32 decimal [8]; - - total_x = 0; - ConvertToDecimal(decimal,n,len); - counter = len - 1; - if (0 < counter) { - piVar3 = &decimal[counter]; - if(*piVar3 == 0) - { - do { - *piVar3 = 0xff; - piVar3--; - counter--; - if (counter <= 0) break; - } while(*piVar3 == 0); - } - } + s32 iVar1; + u32 uVar2; + struct unkChar *iVar3; + s32 counter; + s32 *piVar3; + s32 *piVar4; + s32 total_x; + s32 decimal[8]; - counter = 0; - if ((counter < len) && (decimal[0] != 0xFF)) { - piVar4 = &decimal[0]; - do { - iVar1 = *piVar4; - piVar4++; - uVar2 = ReturnIntFromChar2(iVar1 + 0x30); - iVar3 = GetCharacter(uVar2); - total_x += iVar3->unk6; - xxx_call_draw_char(x - total_x,y,uVar2,color,param_6); - counter++; - if (counter >= len) { - break; - } - } while (*piVar4 != 0xff); - } + total_x = 0; + + ConvertToDecimal(decimal, n, len); + + counter = len - 1; + if (counter > 0) { + piVar3 = &decimal[counter]; + if (*piVar3 == 0) { + do { + *piVar3 = 0xFF; + piVar3--; + counter--; + if (counter <= 0) + break; + } while(*piVar3 == 0); + } + } + + counter = 0; + if (counter < len && decimal[0] != 0xFF) { + piVar4 = &decimal[0]; + do { + iVar1 = *piVar4; + piVar4++; + uVar2 = ReturnIntFromChar2(iVar1 + 0x30); + iVar3 = GetCharacter(uVar2); + total_x += iVar3->unk6; + xxx_call_draw_char(x - total_x, y, uVar2, color, a5); + counter++; + if (counter >= len) + break; + } while (*piVar4 != 0xff); + } } -void sub_8012C60(u32 x,u32 y,u32 param_3,u32 color,u32 param_5) +void sub_8012C60(u32 x, u32 y, u32 a2, u32 color, u32 a4) { - u32 add_x; - struct unkChar *iVar3; - u32 uVar2; - - uVar2 = ReturnIntFromChar2(param_3); - iVar3 = GetCharacter(uVar2); - if (iVar3->unk6 < 0xc) { - add_x = ((0xc - iVar3->unk6) / 2); - } - else { - add_x = 0; - } - xxx_call_draw_char(x + add_x,y,uVar2,color,param_5); + u32 add_x; + struct unkChar *iVar3; + u32 uVar2; + + uVar2 = ReturnIntFromChar2(a2); + iVar3 = GetCharacter(uVar2); + + if (iVar3->unk6 < 12) + add_x = ((12 - iVar3->unk6) / 2); + else + add_x = 0; + + xxx_call_draw_char(x + add_x, y, uVar2, color, a4); } -void sub_8012CAC(struct UnkTextStruct2 *param_1, const struct MenuItem *param_2) +void sub_8012CAC(struct UnkTextStruct2 *a0, const struct MenuItem *a1) { - s16 length; - int r5; - int r6; - int r7; - s32 iVar4; -#ifndef NONMATCHING - register s32 r0 asm("r0"); -#else - s32 r0; -#endif - - r7 = 0; - r6 = 0; - if (param_2->text != NULL) { - r5 = 0x10000; - r0 = r5; - do { - r0 = r5; - r5 = r5 + 0x10000; - r7 = r0 >> 0x10; - length = sub_8008ED0(param_2->text); - if (length > r6) { - r6 = length; - } - param_2++; - } while (param_2->text != NULL); - } - if (r6 < 0) - iVar4 = r6 + 7; - else - iVar4 = r6; - param_1->unkC = (iVar4 >> 3) + 2; - sub_8012D08(param_1, r7); + s16 length; + int r5; + int r6; + int r7; + s32 iVar4; + #ifndef NONMATCHING + register s32 r0 asm("r0"); + #else + s32 r0; + #endif + + r7 = 0; + r6 = 0; + + if (a1->text != NULL) { + r5 = 0x10000; // s16 memes? + r0 = r5; + do { + r0 = r5; + r5 = r5 + 0x10000; + r7 = r0 >> 0x10; + length = sub_8008ED0(a1->text); + + if (length > r6) + r6 = length; + + a1++; + } while (a1->text != NULL); + } + + if (r6 < 0) + iVar4 = r6 + 7; + else + iVar4 = r6; + + a0->unkC = (iVar4 >> 3) + 2; + sub_8012D08(a0, r7); } NAKED -void sub_8012D08(struct UnkTextStruct2 *param_1, s32 param_2) +void sub_8012D08(struct UnkTextStruct2 *a0, s32 a1) { asm_unified( "\tpush {r4,lr}\n" @@ -258,7 +250,7 @@ void sub_8012D08(struct UnkTextStruct2 *param_1, s32 param_2) // https://decomp.me/scratch/QadfW (200 - 90% matched) - Seth NAKED -void sub_8012D34(struct UnkTextStruct2 *param_1, s32 param_2) +void sub_8012D34(struct UnkTextStruct2 *a0, s32 a1) { asm_unified( "\tpush {r4,lr}\n" @@ -284,96 +276,99 @@ void sub_8012D34(struct UnkTextStruct2 *param_1, s32 param_2) "\tbx r0"); } -void sub_8012D60(struct MenuStruct *param_1,const struct MenuItem *menuItems,u32 *colorArray,u16 *param_4,s32 menuAction, - s32 index) +void sub_8012D60(struct MenuStruct *param_1, const struct MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index) { - const u8 *textPtr; - s32 counter; - s32 menuIndex; - s32 iVar1; - - counter = 0; - menuIndex = -1; - iVar1 = 0; - param_1->index = index; - param_1->menuItems = menuItems; - param_1->menuTextColorArray = colorArray; - if (colorArray == NULL) { - param_1->menuTextColorArray = gDefaultMenuTextColors; - } - param_1->unkC = param_4; - textPtr = menuItems->text; - if(textPtr) - { - while (textPtr != 0) { - if ((0 <= menuAction) && (menuAction == menuItems->menuAction)) { - menuIndex = counter; + const u8 *textPtr; + s32 counter; + s32 menuIndex; + s32 iVar1; + + counter = 0; + menuIndex = -1; + iVar1 = 0; + param_1->index = index; + param_1->menuItems = menuItems; + param_1->menuTextColorArray = colorArray; + + if (colorArray == NULL) + param_1->menuTextColorArray = gDefaultMenuTextColors; + + param_1->unkC = param_4; + textPtr = menuItems->text; + + if (textPtr) { + while (textPtr != 0) { + if (menuAction >= 0 && menuAction == menuItems->menuAction) + menuIndex = counter; + + if (*menuItems->text == '*') + iVar1 = counter; + + menuItems++; + counter++; + textPtr = menuItems->text; } - if (*menuItems->text == '*') { - iVar1 = counter; - } - menuItems++; - counter++; - textPtr = menuItems->text; - } - } - if (menuIndex < 0) { - menuIndex = iVar1; - } - sub_8013134(¶m_1->input,counter,index); - param_1->input.menuIndex = menuIndex; - sub_80137B0(¶m_1->input,0); - param_1->unk4C = TRUE; - param_1->unk4D = TRUE; - param_1->unk4E = TRUE; - param_1->menuAction = -1; + } + + if (menuIndex < 0) + menuIndex = iVar1; + + sub_8013134(¶m_1->input, counter, index); + param_1->input.menuIndex = menuIndex; + sub_80137B0(¶m_1->input, 0); + + param_1->unk4C = TRUE; + param_1->unk4D = TRUE; + param_1->unk4E = TRUE; + param_1->menuAction = -1; } -void sub_8012E04(struct MenuStruct *param_1,const struct MenuItem *menuItems,u32 *colorArray,u16 *param_4,s32 menuAction, - s32 index) +void sub_8012E04(struct MenuStruct *param_1, const struct MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index) { - const u8 *textPtr; - s32 counter; - const struct MenuItem *menuItemPtr; - s32 iVar1; - s32 menuIndex; - - counter = 0; - menuIndex = -1; - iVar1 = 0; - textPtr = menuItems->text; - if (textPtr) { - menuItemPtr = menuItems; - while (textPtr != NULL) { - if ((0 <= menuAction) && (menuAction == menuItemPtr->menuAction)) { - menuIndex = counter; - } - if (*menuItemPtr->text == '*') { - iVar1 = counter; - } - menuItemPtr++; - counter++; - textPtr = menuItemPtr->text; + const u8 *textPtr; + s32 counter; + const struct MenuItem *menuItemPtr; + s32 iVar1; + s32 menuIndex; + + counter = 0; + menuIndex = -1; + iVar1 = 0; + textPtr = menuItems->text; + + if (textPtr) { + menuItemPtr = menuItems; + while (textPtr != NULL) { + if (menuAction >= 0 && menuAction == menuItemPtr->menuAction) + menuIndex = counter; + + if (*menuItemPtr->text == '*') + iVar1 = counter; + + menuItemPtr++; + counter++; + textPtr = menuItemPtr->text; + } } - } - - if (menuIndex < 0) { - menuIndex = iVar1; - } - sub_8013134(¶m_1->input,counter,index); - param_1->input.menuIndex = menuIndex; - sub_80137B0(¶m_1->input,0); - param_1->index = index; - param_1->menuTextColorArray = colorArray; - if (colorArray == NULL) { - param_1->menuTextColorArray = gDefaultMenuTextColors; - } - param_1->unkC = param_4; - param_1->menuItems = menuItems; - param_1->unk4E = FALSE; - param_1->unk4C = TRUE; - param_1->unk4D = TRUE; - param_1->menuAction = -1; + + if (menuIndex < 0) + menuIndex = iVar1; + + sub_8013134(¶m_1->input, counter, index); + param_1->input.menuIndex = menuIndex; + sub_80137B0(¶m_1->input, 0); + + param_1->index = index; + param_1->menuTextColorArray = colorArray; + if (colorArray == NULL) + param_1->menuTextColorArray = gDefaultMenuTextColors; + + param_1->unkC = param_4; + param_1->menuItems = menuItems; + param_1->unk4E = FALSE; + param_1->unk4C = TRUE; + param_1->unk4D = TRUE; + param_1->menuAction = -1; } void sub_8012EA4(struct MenuStruct *param_1, bool8 r1) @@ -385,173 +380,169 @@ void sub_8012EA4(struct MenuStruct *param_1, bool8 r1) void sub_8012EBC(struct MenuStruct *param_1) { - s32 x; - s32 y; - u32 color; - const u8 *textPtr; - const struct MenuItem *menuItemsPtr; - u16 *_puVar2; - const u32 *colorArray; - s32 counter; - s32 index; - struct UnkTextStruct2 textStack[4]; - u8 buffer [256]; - struct UnkTextStruct1 *ptr_text; - struct UnkTextStruct2 *ptr_text2; - - if (param_1->unk4D) { - sub_80073B8(param_1->index); - index = param_1->index; - ptr_text = &gUnknown_2027370[index]; - if ((ptr_text->unkC) == 6) { - ptr_text2 = &textStack[index]; - sub_8006518(textStack); - x = sub_8008ED0(param_1->unk0); - xxx_format_and_draw((((ptr_text2->unk14[2]) * 8 - x) /2) + 8, - 0,param_1->unk0, param_1->index, 0); - } - colorArray = param_1->menuTextColorArray; - menuItemsPtr = param_1->menuItems; - _puVar2 = param_1->unkC; - counter = 0; - if (menuItemsPtr->text != NULL) { - do { - textPtr = menuItemsPtr->text; - if (*textPtr == '*') { - textPtr++; + s32 x; + s32 y; + u32 color; + const u8 *textPtr; + const struct MenuItem *menuItemsPtr; + u16 *_puVar2; + const u32 *colorArray; + s32 counter; + s32 index; + struct UnkTextStruct2 textStack[4]; + u8 buffer[256]; + struct UnkTextStruct1 *ptr_text; + struct UnkTextStruct2 *ptr_text2; + + if (param_1->unk4D) { + sub_80073B8(param_1->index); + index = param_1->index; + ptr_text = &gUnknown_2027370[index]; + + if (ptr_text->unkC == 6) { + ptr_text2 = &textStack[index]; + sub_8006518(textStack); + x = sub_8008ED0(param_1->unk0); + xxx_format_and_draw(((ptr_text2->unk14[2] * 8 - x) / 2) + 8, 0, param_1->unk0, param_1->index, 0); } - if (_puVar2 != NULL) { - color = colorArray[*_puVar2]; - _puVar2++; + + colorArray = param_1->menuTextColorArray; + menuItemsPtr = param_1->menuItems; + _puVar2 = param_1->unkC; + counter = 0; + + if (menuItemsPtr->text != NULL) { + do { + textPtr = menuItemsPtr->text; + if (*textPtr == '*') + textPtr++; + + if (_puVar2 != NULL) { + color = colorArray[*_puVar2]; + _puVar2++; + } + else if (menuItemsPtr->menuAction < 0) + color = colorArray[1]; // Color the action red + else + color = colorArray[0]; // Use the default white + + sprintfStatic(buffer,gUnknown_80D4828, color, textPtr); + y = sub_8013800(¶m_1->input, counter); + xxx_format_and_draw(8, y, buffer, param_1->index, 0); + menuItemsPtr++; + counter++; + } while (menuItemsPtr->text != NULL); } - else if (menuItemsPtr->menuAction < 0) { - // Color the action red - color = colorArray[1]; - } - else { - // Use the default white - color = colorArray[0]; - } - sprintfStatic(buffer,gUnknown_80D4828,color,textPtr); - y = sub_8013800(¶m_1->input,counter); - xxx_format_and_draw(8,y,buffer,param_1->index,0); - menuItemsPtr++; - counter++; - } while (menuItemsPtr->text != NULL); + + sub_80073E0(param_1->index); + param_1->unk4D = FALSE; } - sub_80073E0(param_1->index); - param_1->unk4D = FALSE; - } - if (param_1->unk4E) { - if (param_1->unk4C) { - AddMenuCursorSprite(¶m_1->input); + + if (param_1->unk4E) { + if (param_1->unk4C) + AddMenuCursorSprite(¶m_1->input); + else + sub_8013660(¶m_1->input); } - else { - sub_8013660(¶m_1->input); - } - } } bool8 sub_8012FD8(struct MenuStruct *param_1) { - u32 prevMenuIndex; - s32 index; - const struct MenuItem *item; - - prevMenuIndex = param_1->input.menuIndex; - if (param_1->unk4C) { - switch(GetKeyPress(¶m_1->input)) - { - case INPUT_DPAD_DOWN: - MoveMenuCursorDown(¶m_1->input); - if (prevMenuIndex != param_1->input.menuIndex) { - PlayMenuSoundEffect(3); - } - break; - case INPUT_DPAD_UP: - MoveMenuCursorUp(¶m_1->input); - if (prevMenuIndex != param_1->input.menuIndex) { - PlayMenuSoundEffect(3); - } - break; - case INPUT_A_BUTTON: - index = sub_80137A8(¶m_1->input); - item = ¶m_1->menuItems[index]; - if ((-1 < item->menuAction) && - ((param_1->unkC == NULL || (param_1->unkC[index] != 1)))) { - param_1->menuAction = item->menuAction; - ++param_1; --param_1; - param_1->unk4C = FALSE; - param_1->input.unk24 = 0; - } - else - { - PlayMenuSoundEffect(2); + u32 prevMenuIndex; + s32 index; + const struct MenuItem *item; + + prevMenuIndex = param_1->input.menuIndex; + + if (param_1->unk4C) { + switch (GetKeyPress(¶m_1->input)) { + case INPUT_DPAD_DOWN: + MoveMenuCursorDown(¶m_1->input); + if (prevMenuIndex != param_1->input.menuIndex) + PlayMenuSoundEffect(3); break; - } - if ((param_1->unkC != NULL) && (param_1->unkC[index] == 2)) { - PlayMenuSoundEffect(2); - } - else - PlayMenuSoundEffect(0); - break; - case INPUT_B_BUTTON: - if (-1 < param_1->menuItems[param_1->input.unk1A].menuAction) { - param_1->menuAction = param_1->menuItems[param_1->input.unk1A].menuAction; - param_1->unk4C = FALSE; - PlayMenuSoundEffect(1); - } - break; + case INPUT_DPAD_UP: + MoveMenuCursorUp(¶m_1->input); + if (prevMenuIndex != param_1->input.menuIndex) + PlayMenuSoundEffect(3); + break; + case INPUT_A_BUTTON: + index = sub_80137A8(¶m_1->input); + item = ¶m_1->menuItems[index]; + + if (item->menuAction > -1 && (param_1->unkC == NULL || param_1->unkC[index] != 1)) { + param_1->menuAction = item->menuAction; + ++param_1; --param_1; + param_1->unk4C = FALSE; + param_1->input.unk24 = 0; + } + else { + PlayMenuSoundEffect(2); + break; + } + + if (param_1->unkC != NULL && param_1->unkC[index] == 2) + PlayMenuSoundEffect(2); + else + PlayMenuSoundEffect(0); + break; + case INPUT_B_BUTTON: + if (param_1->menuItems[param_1->input.unk1A].menuAction > -1) { + param_1->menuAction = param_1->menuItems[param_1->input.unk1A].menuAction; + param_1->unk4C = FALSE; + PlayMenuSoundEffect(1); + } + break; + } } - } - sub_8012EBC(param_1); - return param_1->unk4C; + + sub_8012EBC(param_1); + return param_1->unk4C; } bool8 sub_80130A8(struct MenuStruct *param_1) { - s32 index; - s32 menuAction; - const struct MenuItem *menuItem; - - if (param_1->unk4C) { + s32 index; + const struct MenuItem *menuItem; - switch(GetKeyPress(¶m_1->input)) - { - case INPUT_A_BUTTON: - index = sub_80137A8(¶m_1->input); - menuItem = ¶m_1->menuItems[index]; - param_1->menuAction = menuItem->menuAction; - param_1->unk4C = FALSE; - param_1->input.unk24 = 0; - PlayMenuSoundEffect(0); - break; - case INPUT_B_BUTTON: - if(menuAction = param_1->menuItems[param_1->input.unk1A].menuAction, -1 < menuAction) { - param_1->menuAction = menuAction; - param_1->unk4C = FALSE; - PlayMenuSoundEffect(0); - } - break; + if (param_1->unk4C) { + switch (GetKeyPress(¶m_1->input)) + { + case INPUT_A_BUTTON: + index = sub_80137A8(¶m_1->input); + menuItem = ¶m_1->menuItems[index]; + param_1->menuAction = menuItem->menuAction; + param_1->unk4C = FALSE; + param_1->input.unk24 = 0; + PlayMenuSoundEffect(0); + break; + case INPUT_B_BUTTON: + if (param_1->menuItems[param_1->input.unk1A].menuAction > -1) { + param_1->menuAction = param_1->menuItems[param_1->input.unk1A].menuAction; + param_1->unk4C = FALSE; + PlayMenuSoundEffect(0); + } + break; + } } - } - sub_8012EBC(param_1); - return param_1->unk4C; + + sub_8012EBC(param_1); + return param_1->unk4C; } bool8 sub_8013114(struct MenuStruct *param_1, s32 *menuAction) { - if(param_1->unk4C){ + if (param_1->unk4C) return TRUE; - } - if (menuAction != NULL){ + + if (menuAction != NULL) *menuAction = param_1->menuAction; - } + return FALSE; } -void sub_8013134(struct MenuInputStruct *param_1, u32 menuItemCounter, u32 index) { - +static void sub_8013134(struct MenuInputStruct *param_1, u32 menuItemCounter, u32 index) +{ struct UnkTextStruct1 *temp; temp = &gUnknown_2027370[index]; @@ -563,15 +554,10 @@ void sub_8013134(struct MenuInputStruct *param_1, u32 menuItemCounter, u32 index param_1->unk1E = 0; param_1->unk4 = 0; - if(temp->unkC == 6) - { - param_1->unk6 = 0x10; - } + if (temp->unkC == 6) + param_1->unk6 = 16; else - { - param_1->unk6 = 0x2; - } - + param_1->unk6 = 2; param_1->unkC = 0; param_1->unkE = 0; @@ -681,7 +667,7 @@ void nullsub_34(struct MenuInputStructSub *a0) } // Maybe struct Position -void sub_801332C(s16 *a0) +static void sub_801332C(s16 *a0) { struct SpriteOAM sp = {}; struct SpriteOAM* ptr; @@ -747,7 +733,7 @@ void sub_801332C(s16 *a0) AddSprite(&sp, 0xFF, NULL, NULL); } -void sub_8013470(struct MenuInputStruct *a0) +static void sub_8013470(struct MenuInputStruct *a0) { struct SpriteOAM sp = {}; register struct SpriteOAM* ptr asm("r3"); @@ -873,8 +859,7 @@ void sub_8013470(struct MenuInputStruct *a0) void sub_8013660(struct MenuInputStruct *param_1) { - if (0 < param_1->unk1A) - { + if (0 < param_1->unk1A) { UpdateMenuCursorSpriteCoords(param_1); sub_801332C(¶m_1->unk8); } @@ -894,33 +879,31 @@ void UpdateMenuCursorSpriteCoords(struct MenuInputStruct *param_1) void MoveMenuCursorDown(struct MenuInputStruct *param_1) { param_1->unk24 = 0; - if (param_1->unk1A < 1) { + + if (param_1->unk1A < 1) param_1->menuIndex = 0; - } else { param_1->menuIndex++; - if (param_1->menuIndex >= param_1->unk1A) { + + if (param_1->menuIndex >= param_1->unk1A) param_1->menuIndex = 0; - } } } void sub_80136E0(struct MenuInputStruct *param_1, u8 param_2) { param_1->unk24 = 0; - if (param_1->unk1A < 1) { + + if (param_1->unk1A < 1) param_1->menuIndex = 0; - } else { param_1->menuIndex++; + if (param_1->menuIndex >= param_1->unk1A) { - if (param_2 != 0) { - param_1->menuIndex = 0; - } + if (param_2 != 0) + param_1->menuIndex = 0; else - { param_1->menuIndex = param_1->unk1A - 1; - } } } } @@ -928,47 +911,44 @@ void sub_80136E0(struct MenuInputStruct *param_1, u8 param_2) void MoveMenuCursorUp(struct MenuInputStruct *param_1) { param_1->unk24 = 0; - if (param_1->unk1A < 1) { + + if (param_1->unk1A < 1) param_1->menuIndex = 0; - } else { param_1->menuIndex--; - if (param_1->menuIndex < 0) { - param_1->menuIndex = param_1->unk1A + -1; - } + + if (param_1->menuIndex < 0) + param_1->menuIndex = param_1->unk1A - 1; } } void sub_8013744(struct MenuInputStruct *param_1, u8 param_2) { param_1->unk24 = 0; - if (param_1->unk1A < 1) { + + if (param_1->unk1A < 1) param_1->menuIndex = 0; - } else { param_1->menuIndex--; + if (param_1->menuIndex < 0) { - if (param_2 != 0) { - param_1->menuIndex = param_1->unk1A + -1; - } - else { + if (param_2 != 0) + param_1->menuIndex = param_1->unk1A - 1; + else param_1->menuIndex = 0; - } } } } void sub_8013780(struct MenuInputStruct *param_1, s32 param_2) { - if (param_2 < 0) { + if (param_2 < 0) param_1->menuIndex = 0; - } - else if (param_2 >= param_1->unk1A) { + else if (param_2 >= param_1->unk1A) param_1->menuIndex = param_1->unk1A - 1; - } - else { + else param_1->menuIndex = param_2; - } + param_1->unk24 = 0; } @@ -986,22 +966,18 @@ void sub_80137B0(struct MenuInputStruct *param_1, s32 param_2) s32 iVar2; #endif - if (param_2 >= 1) { + if (param_2 >= 1) iVar2 = param_2 << 8; - } - else - { + else { if (gUnknown_2027370[param_1->unk0].unkC == 6) - { - iVar1 = 0x10; - } + iVar1 = 16; else - { iVar1 = 0; - } - iVar2 = (gUnknown_2027370[param_1->unk0].unk6 * 8 - iVar1); + + iVar2 = gUnknown_2027370[param_1->unk0].unk6 * 8 - iVar1; iVar2 <<= 8; } + param_1->unk10 = iVar2 / param_1->unk1C; } @@ -1017,10 +993,10 @@ s32 sub_8013800(struct MenuInputStruct *param_1, s32 param_2) iVar2 = param_1->unk6; iVar1 = param_2 * param_1->unk10; - if (iVar1 < 0) { + if (iVar1 < 0) iVar1 = iVar1 + 0xff; - } - return (iVar2 + (iVar1 >> 8)); + + return iVar2 + (iVar1 >> 8); } void sub_8013818(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4) @@ -1032,9 +1008,10 @@ void sub_8013818(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_1->unk24 = 0; param_1->menuIndex = 0; param_1->unk1E = 0; + sub_801317C(¶m_1->unk28); sub_8013984(param_1); - sub_80137F8(param_1,0xC); + sub_80137F8(param_1, 12); } @@ -1047,19 +1024,19 @@ void sub_8013848(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_1->unk24 = 0; param_1->menuIndex = 0; param_1->unk1E = 0; + sub_801317C(¶m_1->unk28); sub_8013984(param_1); - sub_80137F8(param_1,0x18); + sub_80137F8(param_1, 24); } void sub_8013878(struct MenuInputStruct *param_1, s32 param_2) { - if (param_2 < 0) { + if (param_2 < 0) param_2 = 0; - } - else if (param_2 >= param_1->unk22) { - param_2 = param_1->unk22 + -1; - } + else if (param_2 >= param_1->unk22) + param_2 = param_1->unk22 - 1; + param_1->unk1E = param_2 / param_1->unk1C; param_1->menuIndex = param_2 % param_1->unk1C; param_1->unk24 = 0; @@ -1074,18 +1051,17 @@ bool8 sub_80138B8(struct MenuInputStruct *param_1, bool8 param_2) sVar1 = param_1->unk1E; oldIndex = param_1->menuIndex; AddMenuCursorSprite(param_1); - if(param_2) - { - switch(GetKeyPress(param_1)) - { + + if (param_2) { + switch (GetKeyPress(param_1)) { case INPUT_DPAD_UP: MoveMenuCursorUp(param_1); - if(oldIndex != param_1->menuIndex) + if (oldIndex != param_1->menuIndex) PlayMenuSoundEffect(3); break; case INPUT_DPAD_DOWN: MoveMenuCursorDown(param_1); - if(oldIndex != param_1->menuIndex) + if (oldIndex != param_1->menuIndex) PlayMenuSoundEffect(3); break; case INPUT_DPAD_LEFT: @@ -1096,14 +1072,12 @@ bool8 sub_80138B8(struct MenuInputStruct *param_1, bool8 param_2) break; } } + if (sVar1 != param_1->unk1E) { PlayMenuSoundEffect(4); return TRUE; } - else - { - return FALSE; - } + return FALSE; } bool8 sub_8013938(struct MenuInputStruct *param_1) @@ -1114,8 +1088,8 @@ bool8 sub_8013938(struct MenuInputStruct *param_1) param_1->unk1A = 0; param_1->unk14 = 0; AddMenuCursorSprite(param_1); - switch(GetKeyPress(param_1)) - { + + switch (GetKeyPress(param_1)) { case INPUT_DPAD_LEFT: sub_8013A7C(param_1); break; @@ -1123,17 +1097,15 @@ bool8 sub_8013938(struct MenuInputStruct *param_1) sub_8013A54(param_1); break; } + if (sVar1 != param_1->unk1E) { PlayMenuSoundEffect(4); return TRUE; } - else - { - return FALSE; - } + return FALSE; } -void sub_8013984(struct MenuInputStruct * param_1) +void sub_8013984(struct MenuInputStruct *param_1) { s32 iVar2; s32 iVar4; @@ -1141,64 +1113,57 @@ void sub_8013984(struct MenuInputStruct * param_1) iVar4 = param_1->unk0; ptr = &gUnknown_2027370[iVar4]; - if (param_1->unk1C == 0) { + + if (param_1->unk1C == 0) param_1->unk1C++; - } + param_1->unk20 = param_1->unk22 / param_1->unk1C; - iVar2 = (param_1->unk22 % param_1->unk1C); - if (iVar2 != 0) { + iVar2 = param_1->unk22 % param_1->unk1C; + if (iVar2 != 0) param_1->unk20++; - } - if (param_1->unk1E > param_1->unk20 - 1) { + + if (param_1->unk1E > param_1->unk20 - 1) param_1->unk1E = param_1->unk20 - 1; - } - if ((param_1->unk1E != param_1->unk20 - 1) || (param_1->unk22 % param_1->unk1C == 0)) - { + + if (param_1->unk1E != param_1->unk20 - 1 || param_1->unk22 % param_1->unk1C == 0) param_1->unk1A = param_1->unk1C; - } else - { param_1->unk1A = param_1->unk22 % param_1->unk1C; - } - if (param_1->menuIndex > param_1->unk1A - 1) { + + if (param_1->menuIndex > param_1->unk1A - 1) param_1->menuIndex = param_1->unk1A - 1; - } + param_1->unk4 = 0; - if (ptr->unkC == 6) { - param_1->unk6 = 0x10; - } - else { + + if (ptr->unkC == 6) + param_1->unk6 = 16; + else param_1->unk6 = 0; - } - if (param_1->unk20 < 2) { + + if (param_1->unk20 < 2) param_1->unkC = 0; - } - else { - param_1->unkC = (ptr->unk0 + ptr->unk4 + -2) * 8; - } - param_1->unkE = ((ptr->unk2) + 1) * 8 + -2; + else + param_1->unkC = (ptr->unk0 + ptr->unk4 - 2) * 8; + + param_1->unkE = (ptr->unk2 + 1) * 8 - 2; } void sub_8013A54(struct MenuInputStruct *param_1) { - if (param_1->unk1E < param_1->unk20 - 1) { - param_1->unk1E++; - } - else - { - param_1->unk1E = 0; - } - sub_8013984(param_1); + if (param_1->unk1E < param_1->unk20 - 1) + param_1->unk1E++; + else + param_1->unk1E = 0; + + sub_8013984(param_1); } void sub_8013A7C(struct MenuInputStruct *param_1) { - if (param_1->unk1E < 1) { - param_1->unk1E = param_1->unk20 - 1; - } - else - { - param_1->unk1E--; - } - sub_8013984(param_1); + if (param_1->unk1E < 1) + param_1->unk1E = param_1->unk20 - 1; + else + param_1->unk1E--; + + sub_8013984(param_1); } diff --git a/src/options_menu.c b/src/options_menu.c index 9008e8edf..fcf306914 100644 --- a/src/options_menu.c +++ b/src/options_menu.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_80118A4.h" #include "code_80130A8.h" #include "constants/colors.h" #include "constants/input.h" @@ -54,7 +55,6 @@ extern const char *gUnknown_80D4928[]; extern s32 sub_8008ED0(u8 *); extern void CreateOthersMenu(void); -void PlayMenuSoundEffect(u32); void CreateOptionsMenu(void); void nullsub_38(void); extern void SetOptionsMenuState(u32); diff --git a/src/other_menus.c b/src/other_menus.c index 1e6d4373a..5057077c4 100644 --- a/src/other_menus.c +++ b/src/other_menus.c @@ -12,6 +12,7 @@ #include "pokemon.h" #include "code_8094F88.h" #include "sprite.h" +#include "code_80118A4.h" struct unkStruct_203B35C { @@ -444,7 +445,6 @@ extern u32 sub_8037C10(u32); extern void sub_8037748(void); extern void sub_80371B8(void); extern void sub_8037900(void); -extern void PlayMenuSoundEffect(u32); extern u32 sub_8037798(void); extern void sub_8005838(u32, u32); extern void sub_80060EC(); @@ -456,11 +456,9 @@ extern void xxx_call_update_bg_sound_input(); extern s32 sub_8037D64(u32 mode, void *, void *); extern s32 sub_80381F4(u32 mode, void *, void *); extern void sub_8037810(void); -extern void sub_8011830(void); extern s32 sub_8037B28(u32); s32 sub_8035D3C(void); extern s32 sub_8035D74(void); -extern void xxx_call_start_bg_music(void); extern void xxx_draw_string_80144C4(void); void sub_8036FDC(s32 param_1) diff --git a/src/party_list_menu.c b/src/party_list_menu.c index 6399ab55a..ca0a365e1 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -14,6 +14,7 @@ #include "kecleon_bros.h" #include "code_80130A8.h" #include "code_801B3C0.h" +#include "code_80118A4.h" struct unkStruct_203B2B8 { @@ -163,7 +164,6 @@ ALIGNED(4) static const u8 fill0[] = "pksdir0"; extern u32 sub_8026F04(struct PokemonStruct *); extern void sub_8026074(s32); -extern void PlaySound(u32); bool8 CanTakePokemonHeldItem(struct PokemonStruct *r0); extern bool8 sub_80023E4(u8); extern struct PokemonStruct *sub_808D3F8(void); diff --git a/src/pelipper_board.c b/src/pelipper_board.c index 73fa67457..0ba24684c 100644 --- a/src/pelipper_board.c +++ b/src/pelipper_board.c @@ -11,6 +11,7 @@ #include "menu_input.h" #include "team_inventory.h" #include "pelipper_board.h" +#include "code_80118A4.h" EWRAM_DATA_2 struct unkStruct_203B308 *gPelipperBoard = {0}; @@ -92,7 +93,6 @@ extern void ResetPelipperBoardSlot(u8); extern void sub_80965F4(void); extern void sub_802C2D4(void); extern u32 sub_802C1E4(u32); -extern void PlaySound(u32); extern u8 sub_802C26C(void); extern u8 HasNoAcceptedJobs(void); extern bool8 IsMailinJobSlot(struct WonderMail *mail); diff --git a/src/personality_test.c b/src/personality_test.c index 8589aaf72..c05375849 100644 --- a/src/personality_test.c +++ b/src/personality_test.c @@ -14,6 +14,7 @@ #include "menu_input.h" #include "code_80130A8.h" #include "code_8012A18_1.h" +#include "code_80118A4.h" enum { @@ -50,8 +51,6 @@ extern void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray); extern void RedrawPartnerSelectionMenu(void); -extern void PlayMenuSoundEffect(u32); - extern u32 sub_80095E4(s16, u32); extern struct GameOptions *gGameOptionsRef; diff --git a/src/pokemon_news.c b/src/pokemon_news.c index c605d89dc..b53bcd2bb 100644 --- a/src/pokemon_news.c +++ b/src/pokemon_news.c @@ -8,6 +8,7 @@ #include "save.h" #include "menu_input.h" #include "code_80130A8.h" +#include "code_80118A4.h" struct unkStruct_203B2CC { @@ -153,7 +154,6 @@ extern u16 gUnknown_203B2DC; extern s32 GetNumPKMNNews(void); extern void sub_802B880(void); extern void CreatePKMNNewsMenu(void); -extern void PlayMenuSoundEffect(u32); extern void sub_802BCC4(void); extern void sub_802BB14(u32); extern u8 HasNoMailinMailbox(void); diff --git a/src/post_office_guide.c b/src/post_office_guide.c index 5884fe0e0..7aedc418e 100644 --- a/src/post_office_guide.c +++ b/src/post_office_guide.c @@ -9,6 +9,7 @@ #include "code_8094F88.h" #include "menu_input.h" #include "code_80130A8.h" +#include "code_80118A4.h" struct PostOfficeHelper { @@ -177,7 +178,6 @@ extern u8 gUnknown_202DE58[]; extern u8 gUnknown_202E5D8[]; extern u8 gAvailablePokemonNames[]; -extern void PlayMenuSoundEffect(u32); extern void sub_8031A84(); extern void DisplayMissionObjectives(); extern u8 *GetCurrentMissionText(s16 r0); diff --git a/src/save.c b/src/save.c index 0bf2be77c..c90b5ea55 100644 --- a/src/save.c +++ b/src/save.c @@ -10,6 +10,7 @@ #include "exclusive_pokemon.h" #include "game_options.h" #include "code_80130A8.h" +#include "code_80118A4.h" EWRAM_DATA_2 u32 gUnknown_203B17C = {0}; EWRAM_DATA_2 char *gUnknown_203B180 = {0}; @@ -141,7 +142,6 @@ ALIGNED(4) static const char fill_save7[] = _("pksdir0"); extern bool8 sub_800DAB0(u16, u8*, s32); extern bool8 sub_800DAB4(u16, u8*, s32); extern bool8 sub_800DAB8(void); -extern void sub_8011830(void); extern void sub_80140DC(); extern void sub_8014114(); extern u32 SaveRecruitedPokemon(u8 *, u32); @@ -168,9 +168,6 @@ extern void sub_80974E8(void); extern void ResetNumAdventures(void); extern void sub_80993D8(void); -extern void xxx_call_start_bg_music(void); - - u32 sub_8011C1C(void) { return gUnknown_203B17C; diff --git a/src/text_util.c b/src/text_util.c index 1c3042ccf..fb85c31c2 100644 --- a/src/text_util.c +++ b/src/text_util.c @@ -1,4 +1,5 @@ #include "global.h" +#include "text_util.h" #define NUM_POKEMON_TYPES 18 @@ -107,8 +108,7 @@ u32 ReturnIntFromChar2(u8 r0) return r0; } -// Unused -void sub_8092290(u8 *buffer, u8 *string) +UNUSED static void sub_8092290(u8 *buffer, u8 *string) { while( *string != '\0' ) { *buffer++ = ReturnIntFromChar2(*string++); @@ -116,7 +116,7 @@ void sub_8092290(u8 *buffer, u8 *string) *buffer = 0; // append a 0 } -void sub_80922B4(u8 *buffer, u8 *string, s32 size) +void sub_80922B4(u8 *buffer, const u8 *string, s32 size) { while(1) { diff --git a/src/thank_you_wonder_mail.c b/src/thank_you_wonder_mail.c index 2b4d74865..2491eb539 100644 --- a/src/thank_you_wonder_mail.c +++ b/src/thank_you_wonder_mail.c @@ -18,6 +18,7 @@ #include "code_801C620.h" #include "code_801B3C0.h" #include "cpu.h" +#include "code_80118A4.h" extern struct WonderMailStruct_203B2C4 *gUnknown_203B2C4; @@ -216,9 +217,7 @@ extern void SetThankYouMailMenuState(u32); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_802F204(struct unkStruct_802F204 *, u32); extern void sub_80151C0(u32, u8 *); -extern void xxx_call_start_bg_music(void); extern void sub_803092C(void); -extern void sub_8011830(void); extern s32 sub_8037B28(u32); extern u32 sub_8030894(void); extern u32 sub_801D008(void); diff --git a/src/trade_items_menu.c b/src/trade_items_menu.c index 4f6395300..afaea47cd 100644 --- a/src/trade_items_menu.c +++ b/src/trade_items_menu.c @@ -13,6 +13,7 @@ #include "text1.h" #include "text2.h" #include "cpu.h" +#include "code_80118A4.h" EWRAM_DATA_2 struct TradeItemsMenu *gTradeItemsMenu = {0}; @@ -88,8 +89,6 @@ extern void sub_8035C1C(); extern u32 sub_801D008(); extern s32 sub_8037B28(u32); -extern void sub_8011830(void); -extern void xxx_call_start_bg_music(void); extern s32 sub_80381F4(u32, void *, void *); extern s32 sub_8037D64(u32, void *, void *); diff --git a/src/wigglytuff_shop.c b/src/wigglytuff_shop.c index 7c9cc1eea..1c9a1e7cb 100644 --- a/src/wigglytuff_shop.c +++ b/src/wigglytuff_shop.c @@ -13,6 +13,7 @@ #include "code_8021774_pre.h" #include "code_801EE10_mid.h" #include "code_8021774.h" +#include "code_80118A4.h" extern struct UnkTextStruct2 gUnknown_80DC534; extern struct UnkTextStruct2 gUnknown_80DC564; @@ -38,7 +39,6 @@ extern const u8 *gUnknown_80D4978[]; u8 sub_8021700(u32); void sub_8092578(u8 *buffer, u8 index, u8 r2); extern void sub_8022380(void); -extern void PlaySound(u32); bool8 sub_8023144(s32 param_1, s32 index, struct UnkTextStruct2_sub *sub, u32 param_4); void sub_8023354(u8 param_1); extern bool8 sub_80023E4(u32); diff --git a/src/wonder_mail.c b/src/wonder_mail.c index 93f3cbef6..29c2e8168 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -15,6 +15,7 @@ #include "main_menu.h" #include "code_801EE10_1.h" #include "cpu.h" +#include "code_80118A4.h" extern struct WonderMailStruct_203B2C0 *gUnknown_203B2C0; @@ -61,10 +62,8 @@ extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); extern void sub_80306A8(u32, u32, u32, u32); extern s32 sub_8037B28(u32); -extern void sub_8011830(void); extern void sub_8031D70(u8, u32); extern void sub_80151C0(u32, u8 *); -extern void xxx_call_start_bg_music(void); extern u32 sub_8023CE8(void); extern u32 sub_8030894(void); extern void sub_8030F58(u32); diff --git a/src/wonder_mail_2_1.c b/src/wonder_mail_2_1.c index 1fd17dd7a..c8344c7b2 100644 --- a/src/wonder_mail_2_1.c +++ b/src/wonder_mail_2_1.c @@ -9,6 +9,7 @@ #include "code_802C39C.h" #include "menu_input.h" #include "wonder_mail_2_1.h" +#include "code_80118A4.h" extern struct unkStruct_203B2F0 *gUnknown_203B2F0; extern struct unkStruct_203B2E8* gUnknown_203B2E8; @@ -103,7 +104,6 @@ extern void CreateRescueTitle(struct unkStruct_802C39C *); extern void sub_802C6DC(void); extern void DrawJobListMenu(void); -extern void PlayMenuSoundEffect(u32); extern bool8 IsPelipperBoardSlotEmpty(u8); extern void SetJobListState(u32); extern void sub_802CC00(void); diff --git a/src/wonder_mail_2_mid.c b/src/wonder_mail_2_mid.c index e5abb6b34..9a5981ce5 100644 --- a/src/wonder_mail_2_mid.c +++ b/src/wonder_mail_2_mid.c @@ -9,13 +9,13 @@ #include "pokemon_mail.h" #include "wonder_mail.h" #include "code_802C39C.h" -#include "menu_input.h" +#include "menu_input.h" +#include "code_80118A4.h" bool8 IsMailSlotEmpty(u8); extern s32 CountPelipperBoardSlots(void); extern void sub_802C328(void); extern void DrawPelipperBoardJobMenu(void); -extern void PlayMenuSoundEffect(u32); extern u8 HasNoPelipperBoardJobs(void); extern struct WonderMail *GetPelipperBoardSlotInfo(u32); diff --git a/src/wonder_mail_3.c b/src/wonder_mail_3.c index 13d3422db..ded2caabc 100644 --- a/src/wonder_mail_3.c +++ b/src/wonder_mail_3.c @@ -12,6 +12,7 @@ #include "code_80958E8.h" #include "wonder_mail_2_1.h" #include "code_80130A8.h" +#include "code_80118A4.h" const struct UnkTextStruct2 gUnknown_80DFDD4 = { @@ -150,7 +151,6 @@ extern void CreateRescueTitle(struct unkStruct_802C39C *); extern u8 gUnknown_80DFDBC[]; extern void sub_802CF5C(void); extern void sub_802CFD0(void); -extern void PlayMenuSoundEffect(u32); extern void sub_802DF24(void); extern void SetJobListState(u32); @@ -159,7 +159,6 @@ extern void ResetJobSlot(u8); extern u8 HasNoAcceptedJobs(void); u32 sub_802C598(u8 param_1); extern void sub_802C688(void); -extern void PlaySound(u32); extern u8 GetPelipperBoardSlotIndex(void); extern struct UnkTextStruct2 gUnknown_80DFD8C; diff --git a/src/wonder_mail_3_mid.c b/src/wonder_mail_3_mid.c index 4ce0fa7e7..5e45adb5b 100644 --- a/src/wonder_mail_3_mid.c +++ b/src/wonder_mail_3_mid.c @@ -11,6 +11,7 @@ #include "menu_input.h" #include "code_802C39C.h" #include "code_80130A8.h" +#include "code_80118A4.h" struct unkStruct_803B344 { @@ -121,9 +122,7 @@ extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_802F6FC(void); extern void ProceedToNextRewardSceneState(void); -extern void PlayMenuSoundEffect(u32); extern void sub_802F300(void); -extern void PlaySound(u32); extern s32 sub_808D544(u32); extern u32 sub_801B60C(u32, u8, u8); extern void sub_8092578(u8 *buffer, u8 index, u8 r2); diff --git a/src/wonder_mail_4.c b/src/wonder_mail_4.c index ba0c04fa5..d884485fd 100644 --- a/src/wonder_mail_4.c +++ b/src/wonder_mail_4.c @@ -10,6 +10,7 @@ #include "constants/wonder_mail.h" #include "code_802C39C.h" #include "menu_input.h" +#include "code_80118A4.h" struct unkStruct_203B320 { @@ -80,7 +81,6 @@ extern s32 sub_8030A74(void); extern void sub_80308A0(void); extern void sub_803092C(void); -extern void PlayMenuSoundEffect(u32); extern void CreateRescueTitle(struct unkStruct_802C39C *); u32 sub_80306A8(u32 wonderMailType, u32 r1, struct UnkTextStruct2_sub *r2, u32 r3) diff --git a/src/wonder_mail_5.c b/src/wonder_mail_5.c index 4b4e974d1..75b18f059 100644 --- a/src/wonder_mail_5.c +++ b/src/wonder_mail_5.c @@ -10,6 +10,7 @@ #include "code_800D090.h" #include "code_802C39C.h" #include "menu_input.h" +#include "code_80118A4.h" struct unkStruct_203B324 { @@ -49,7 +50,6 @@ const u8 gUnknown_80E0938[] = "%-4d"; static const u8 wonder_mail_fill[] = "pksdir0"; extern void sub_8030DD4(void); -extern void PlayMenuSoundEffect(u32); extern void CreateRescueDescription(struct unkStruct_802C39C *); void sub_8030E2C(void); diff --git a/src/wonder_mail_802DF88.c b/src/wonder_mail_802DF88.c index c316d62f3..60c10bd84 100644 --- a/src/wonder_mail_802DF88.c +++ b/src/wonder_mail_802DF88.c @@ -7,6 +7,7 @@ #include "text1.h" #include "text2.h" #include "code_80130A8.h" +#include "code_80118A4.h" struct unkStruct_203B2FC { @@ -104,7 +105,6 @@ const struct UnkTextStruct2 gUnknown_80E0264 = static const u8 wonder_mail_802DF88_fill1[] = "pksdir0"; extern void CreateRescueDescription(struct unkStruct_802C39C *); -extern void PlayMenuSoundEffect(u32); extern void sub_802DC28(u32); extern void sub_802F2C0(void); extern void sub_802DC28(u32); diff --git a/src/wonder_mail_main_menu.c b/src/wonder_mail_main_menu.c index 553385538..75bc644fe 100644 --- a/src/wonder_mail_main_menu.c +++ b/src/wonder_mail_main_menu.c @@ -12,6 +12,7 @@ #include "code_801C620.h" #include "code_801B3C0.h" #include "cpu.h" +#include "code_80118A4.h" #define SELECT_WONDER_MAIL_MODE_MAIN_SCREEN 0 #define SEND_WONDER_MAIL_MAIN_SCREEN 1 @@ -134,9 +135,7 @@ extern void sub_8031E10(void); extern u8 sub_800D588(void); extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); -extern void sub_8011830(void); extern void sub_80151C0(u32, u8 *); -extern void xxx_call_start_bg_music(void); extern void sub_802EF48(void); extern void sub_802D098(struct WonderMail *);