From 0b5aa22ed66b6580ef0b6fce7aa7e52bc5141a1f Mon Sep 17 00:00:00 2001 From: Kermalis <29823718+Kermalis@users.noreply.github.com> Date: Tue, 18 Mar 2025 00:32:36 -0400 Subject: [PATCH 1/2] Match RockSmashMoveAction + cleans --- asm/code_8098468.s | 2 +- include/code_800558C.h | 7 +- include/code_800C9CC.h | 8 +- include/code_800D090.h | 2 +- include/code_800ED38.h | 7 + include/code_800F958.h | 1 + include/code_80118A4.h | 17 +- include/code_803D110.h | 13 + include/code_803E46C.h | 4 +- include/code_803E724.h | 1 + include/code_8041AD0.h | 1 + include/code_8042B34.h | 3 +- include/code_8044CC8.h | 3 + include/code_805D8C8.h | 1 - include/code_8066D04.h | 6 + include/code_8069E0C.h | 6 + include/code_807E5AC.h | 6 + include/cpu.h | 2 + include/debug.h | 2 - include/def_filearchives.h | 24 ++ include/dungeon.h | 2 + include/dungeon_items.h | 2 +- include/dungeon_main.h | 4 +- include/dungeon_misc.h | 9 +- include/dungeon_move.h | 5 +- include/dungeon_music.h | 19 +- include/file_system.h | 31 +- include/friend_areas_map.h | 22 +- include/friend_areas_map_util.h | 14 + include/global.h | 3 + include/items.h | 2 + include/math.h | 3 + include/reg_control.h | 1 - include/status_checks_1.h | 3 +- include/structs/axdata.h | 4 +- include/structs/str_202ED28.h | 1 + include/structs/str_dungeon_8042F6C.h | 6 +- include/structs/str_file_system.h | 26 ++ include/structs/str_text.h | 44 +- include/tile_types.h | 3 +- include/world_map.h | 2 +- src/bg_palette_buffer.c | 10 + src/code_800558C.c | 72 ++-- src/code_8009804.c | 81 ++-- src/code_800C9CC.c | 4 +- src/code_800D090.c | 4 - src/code_800DAC0.c | 8 +- src/code_800ED38.c | 21 +- src/code_800F034.c | 4 +- src/code_80118A4.c | 3 - src/code_8012A18.c | 5 +- src/code_801D014.c | 9 +- src/code_803D110.c | 107 +++-- src/code_803E46C.c | 20 +- src/code_803E724.c | 74 ++-- src/code_8040094.c | 4 +- src/code_8040094_1.c | 27 +- src/code_8041AD0.c | 10 +- src/code_804267C.c | 2 +- src/code_8042B34.c | 35 +- src/code_8044CC8.c | 9 +- src/code_8048480.c | 12 +- src/code_8066D04.c | 65 ++- src/code_8069E0C.c | 5 +- src/code_806FDF4.c | 2 +- src/code_807CD9C.c | 8 +- src/code_807E1A0.c | 4 +- src/code_807E5AC.c | 10 +- src/code_8085E98.c | 4 +- src/code_80861A8.c | 9 +- src/code_8099360.c | 23 +- src/cpu.c | 12 +- src/data/friend_areas_map.h | 503 ++++++++++++++++++++++ src/debug.c | 5 +- src/dungeon.c | 31 +- src/dungeon_ai_leader.c | 4 +- src/dungeon_cutscenes.c | 2 +- src/dungeon_generation.c | 4 +- src/dungeon_items.c | 2 +- src/dungeon_main.c | 14 +- src/dungeon_map.c | 2 +- src/dungeon_map_access.c | 31 +- src/dungeon_menu_items.c | 13 +- src/dungeon_menu_moves.c | 12 +- src/dungeon_menu_others.c | 11 +- src/dungeon_menu_recruitment.c | 10 +- src/dungeon_menu_stairs.c | 15 +- src/dungeon_menu_team.c | 11 +- src/dungeon_menu_tile.c | 12 +- src/dungeon_message.c | 31 +- src/dungeon_misc.c | 19 +- src/dungeon_move.c | 2 +- src/dungeon_music.c | 51 +-- src/dungeon_serializer.c | 6 +- src/dungeon_util.c | 17 +- src/dungeon_util_1.c | 6 +- src/file_system.c | 10 +- src/friend_areas_map.c | 595 ++------------------------ src/friend_areas_map_util.c | 50 +-- src/friend_rescue.c | 2 +- src/ground_main.c | 2 +- src/ground_map.c | 3 +- src/ground_map_2.c | 5 +- src/ground_script_2.c | 2 +- src/ground_sprite.c | 6 +- src/items.c | 4 +- src/libisagbprn.c | 5 +- src/load_screen.c | 3 +- src/main_loops.c | 68 +-- src/math.c | 1 - src/move_actions.c | 2 +- src/moves.c | 12 +- src/other_menus1.c | 2 +- src/pokemon.c | 20 +- src/quick_save_read.c | 4 +- src/reg_control.c | 31 +- src/status_actions.c | 35 +- src/text.c | 15 +- src/tile_types.c | 2 +- src/trap.c | 5 +- src/world_map.c | 145 +++---- sym_ewram.txt | 6 +- 122 files changed, 1413 insertions(+), 1421 deletions(-) create mode 100644 include/code_800ED38.h create mode 100644 include/code_803D110.h create mode 100644 include/code_8066D04.h create mode 100644 include/code_8069E0C.h create mode 100644 include/code_807E5AC.h create mode 100644 include/def_filearchives.h create mode 100644 include/friend_areas_map_util.h create mode 100644 include/structs/str_file_system.h create mode 100644 src/data/friend_areas_map.h diff --git a/asm/code_8098468.s b/asm/code_8098468.s index e775a7b4a..05fcd1ab7 100644 --- a/asm/code_8098468.s +++ b/asm/code_8098468.s @@ -511,7 +511,7 @@ _080988F8: ldr r0, _08098978 ldr r0, [r0] bl IncrementPlayTime - bl sub_800CB20 + bl WaitForNextFrameAndAdvanceRNG bl LoadBufferedInputs bl nullsub_120 bl sub_80A5E70 diff --git a/include/code_800558C.h b/include/code_800558C.h index 057c1bd31..fbf51943e 100644 --- a/include/code_800558C.h +++ b/include/code_800558C.h @@ -1,9 +1,8 @@ #ifndef GUARD_CODE_800558C_H #define GUARD_CODE_800558C_H -#include "structs/rgb.h" #include "structs/axdata.h" -#include "file_system.h" +#include "structs/rgb.h" typedef struct Palette256 { @@ -23,6 +22,10 @@ struct EfoFileData /* 0x1C */ s32 tileCount; }; +extern bool8 gUnknown_2026E38; +extern u32 *gUnknown_2026E3C; +extern s16 gUnknown_2026E4E; + extern s16 *gUnknown_203B078; void nullsub_7(s16 *); diff --git a/include/code_800C9CC.h b/include/code_800C9CC.h index 6fcbb5e94..0f8263cb1 100644 --- a/include/code_800C9CC.h +++ b/include/code_800C9CC.h @@ -1,11 +1,11 @@ -#ifndef GUARD_CODE_800D090_H -#define GUARD_CODE_800D090_H +#ifndef GUARD_CODE_800C9CC_H +#define GUARD_CODE_800C9CC_H #include "input.h" void ReadKeyInput(Inputs *); void xxx_call_update_bg_sound_input(void); -void sub_800CB20(void); +void WaitForNextFrameAndAdvanceRNG(void); -#endif // GUARD_CODE_800D090_H \ No newline at end of file +#endif // GUARD_CODE_800C9CC_H diff --git a/include/code_800D090.h b/include/code_800D090.h index 7196e804e..aa5841cba 100644 --- a/include/code_800D090.h +++ b/include/code_800D090.h @@ -3,4 +3,4 @@ void sprintfStatic(char *buffer, const char *text, ...); -#endif \ No newline at end of file +#endif // GUARD_CODE_800D090_H diff --git a/include/code_800ED38.h b/include/code_800ED38.h new file mode 100644 index 000000000..7436d728d --- /dev/null +++ b/include/code_800ED38.h @@ -0,0 +1,7 @@ +#ifndef GUARD_CODE_800ED38_H +#define GUARD_CODE_800ED38_H + +void sub_800EE5C(s32 r0); +void sub_800EF64(void); + +#endif // GUARD_CODE_800ED38_H diff --git a/include/code_800F958.h b/include/code_800F958.h index 96dcda691..b957687e4 100644 --- a/include/code_800F958.h +++ b/include/code_800F958.h @@ -4,5 +4,6 @@ #include "structs/str_position.h" void AddPokemonDungeonSprite(s32 id, s16 species, DungeonPos *pos, u32 priority); +void UpdateDungeonPokemonSprite(s32 id, s32 species, s32 status, u32 visible); #endif // GUARD_CODE_800F958_H diff --git a/include/code_80118A4.h b/include/code_80118A4.h index 4136d450e..e63c623bc 100644 --- a/include/code_80118A4.h +++ b/include/code_80118A4.h @@ -2,20 +2,25 @@ #define GUARD_CODE_80118A4_H void FadeOutAllMusic(u16); +void PlayAcceptSoundEffect(void); +void PlayCancelSoundEffect(void); +void PlayCursorUpDownSoundEffect(void); void PlayMenuSoundEffect(u32); void PlaySound(u16); +void StopAllMusic_1(void); +void sub_8011760(void); +void sub_80117AC(void); void sub_801180C(void); void sub_8011830(void); void sub_8011860(void); void xxx_call_fade_in_new_bgm(u16 songIndex, u16 speed); void xxx_call_fade_out_bgm(u16 speed); -void xxx_call_start_bg_music(void); -void xxx_call_stop_bgm(void); -void xxx_call_stop_fanfare_se(u16 songIndex); -void StopAllMusic_1(void); -void xxx_call_start_new_bgm(u16 songIndex); +void xxx_call_fade_out_fanfare_se(u16 songIndex, u16 speed); void xxx_call_queue_bgm(u16 songIndex); void xxx_call_play_fanfare_se(u16 songIndex, u16 volume); -void xxx_call_fade_out_fanfare_se(u16 songIndex, u16 speed); +void xxx_call_start_bg_music(void); +void xxx_call_start_new_bgm(u16 songIndex); +void xxx_call_stop_bgm(void); +void xxx_call_stop_fanfare_se(u16 songIndex); #endif // GUARD_CODE_80118A4_H diff --git a/include/code_803D110.h b/include/code_803D110.h new file mode 100644 index 000000000..d4f4e948a --- /dev/null +++ b/include/code_803D110.h @@ -0,0 +1,13 @@ +#ifndef GUARD_CODE_803D110_H +#define GUARD_CODE_803D110_H + +void nullsub_56(void); +void ShowDungeonNameBanner_Async(void); +void sub_803DF60(void); +void sub_803E02C(void); +void sub_803E13C(void); +void sub_803E178(void); +void sub_803E214(void); +void sub_803E250(void); + +#endif // GUARD_CODE_803D110_H diff --git a/include/code_803E46C.h b/include/code_803E46C.h index 9588788e4..dce842980 100644 --- a/include/code_803E46C.h +++ b/include/code_803E46C.h @@ -1,6 +1,8 @@ #ifndef GUARD_CODE_803E46C_H #define GUARD_CODE_803E46C_H +extern u8 gUnknown_203B40D; + void DungeonRunFrameActions(u32); -#endif +#endif // GUARD_CODE_803E46C_H diff --git a/include/code_803E724.h b/include/code_803E724.h index 026600408..069ead6bc 100644 --- a/include/code_803E724.h +++ b/include/code_803E724.h @@ -3,6 +3,7 @@ #include "structs/str_position.h" +void sub_803EAF0(u32 kind, u8 *name); bool8 sub_803F428(DungeonPos *pos); #endif // GUARD_CODE_803E724_H \ No newline at end of file diff --git a/include/code_8041AD0.h b/include/code_8041AD0.h index 0a0a1ac18..0cf28f73a 100644 --- a/include/code_8041AD0.h +++ b/include/code_8041AD0.h @@ -4,6 +4,7 @@ #include "structs/dungeon_entity.h" #include "structs/str_damage.h" +u32 EntityGetStatusSprites(Entity *entity); void sub_80420E8(Entity *pokemon, DamageStruct *dmgStruct); void sub_80421C0(Entity *pokemon, u16); diff --git a/include/code_8042B34.h b/include/code_8042B34.h index 9dcbda0f1..0ade61727 100644 --- a/include/code_8042B34.h +++ b/include/code_8042B34.h @@ -1,6 +1,7 @@ #ifndef GUARD_CODE_8042B34_H #define GUARD_CODE_8042B34_H +bool8 sub_8043CE4(s32 dungeonId); void sub_8043D50(s32 *a0, s32 *a1); -#endif // GUARD_CODE_8042B34_H \ No newline at end of file +#endif // GUARD_CODE_8042B34_H diff --git a/include/code_8044CC8.h b/include/code_8044CC8.h index b75cfe009..c5bcecc20 100644 --- a/include/code_8044CC8.h +++ b/include/code_8044CC8.h @@ -11,4 +11,7 @@ typedef struct unkStruct_202EE44 extern unkStruct_202EE44 gDungeonSubMenu[10]; +void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); +void SetActionUnusableInDungeonSubMenu(u16 actionId); + #endif // GUARD_CODE_8044CC8_H diff --git a/include/code_805D8C8.h b/include/code_805D8C8.h index b3ea45e5b..574feeb93 100644 --- a/include/code_805D8C8.h +++ b/include/code_805D8C8.h @@ -5,7 +5,6 @@ void CloseAllSpriteFiles(void); -void OpenDungeonPaletteFile(void); void CloseDungeonPaletteFile(void); void LoadDungeonPokemonSprites(void); void LoadDungeonActivePokemonSprites(void); diff --git a/include/code_8066D04.h b/include/code_8066D04.h new file mode 100644 index 000000000..227aa9bf3 --- /dev/null +++ b/include/code_8066D04.h @@ -0,0 +1,6 @@ +#ifndef GUARD_CODE_8066D04_H +#define GUARD_CODE_8066D04_H + +void HandleSetItemAction(Entity *, bool8); + +#endif // GUARD_CODE_8066D04_H diff --git a/include/code_8069E0C.h b/include/code_8069E0C.h new file mode 100644 index 000000000..fc2ce989c --- /dev/null +++ b/include/code_8069E0C.h @@ -0,0 +1,6 @@ +#ifndef GUARD_CODE_8069E0C_H +#define GUARD_CODE_8069E0C_H + +void sub_806C51C(Entity *entity); + +#endif // GUARD_CODE_8069E0C_H diff --git a/include/code_807E5AC.h b/include/code_807E5AC.h new file mode 100644 index 000000000..756818a83 --- /dev/null +++ b/include/code_807E5AC.h @@ -0,0 +1,6 @@ +#ifndef GUARD_CODE_807E5AC_H +#define GUARD_CODE_807E5AC_H + +void sub_807FA9C(void); + +#endif // GUARD_CODE_807E5AC_H diff --git a/include/cpu.h b/include/cpu.h index fe6f43027..b06c36a20 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -1,6 +1,8 @@ #ifndef GUARD_CPU_H #define GUARD_CPU_H +extern u16 gRawKeyInput; + void CpuClear(void *, s32); void CpuCopy(void *dest, const void *src, s32 size); void nullsub_23(bool8); diff --git a/include/debug.h b/include/debug.h index 2f670f3ae..34329236b 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,8 +1,6 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#include "gba/gba.h" - // size: 0xC typedef struct DebugLocation { diff --git a/include/def_filearchives.h b/include/def_filearchives.h new file mode 100644 index 000000000..6e64122fd --- /dev/null +++ b/include/def_filearchives.h @@ -0,0 +1,24 @@ +#ifndef GUARD_DEF_FILEARCHIVES_H +#define GUARD_DEF_FILEARCHIVES_H + +#include "structs/str_file_system.h" + +// dungeon_sbin.s +extern const FileArchive gDungeonFileArchive; + +// effect_sbin.s +extern const FileArchive gEffectFileArchive; + +// monster_sbin.c +extern const FileArchive gMonsterFileArchive; + +// ornament_sbin.s +extern const FileArchive gOrnamentFileArchive; + +// system_sbin.s +extern const FileArchive gSystemFileArchive; + +// titlemenu_sbin.s +extern const FileArchive gTitleMenuFileArchive; + +#endif // GUARD_DEF_FILEARCHIVES_H diff --git a/include/dungeon.h b/include/dungeon.h index a6138569a..5108ac7b7 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -46,6 +46,8 @@ s16 GetRandomMovementChance(u8 dungeon); void PrintYellowDungeonNametoBuffer(u8 *buffer, DungeonLocation *dungeonLocation); void PrintDungeonLocationtoBuffer(u8 *buffer, DungeonLocation *dungeonLocation); +void sub_80901D8(DungeonLocation *param_1, DungeonLocation *param_2); +u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bool32 param_5_); u32 sub_80908D8(DungeonLocation *dungeon); u8 sub_8090910(DungeonLocation *dungeon, u32 param_2); bool8 IsNotValidDungeon(u8 dungeon); diff --git a/include/dungeon_items.h b/include/dungeon_items.h index 0322425d5..26b0a8b6b 100644 --- a/include/dungeon_items.h +++ b/include/dungeon_items.h @@ -31,4 +31,4 @@ bool8 PlayerHasItemWithFlag(s32 itemFlag); void CleanUpInventoryItems(void); void ClearUnpaidFlagFromAllItems(void); -#endif +#endif // GUARD_DUNGEON_ITEMS_H diff --git a/include/dungeon_main.h b/include/dungeon_main.h index 5067e39e3..33a51ce27 100644 --- a/include/dungeon_main.h +++ b/include/dungeon_main.h @@ -17,6 +17,6 @@ void sub_805EFB4(Entity *a0, bool8 a1); void sub_805F02C(void); ActionContainer *GetLeaderActionContainer(void); u16 GetLeaderActionId(void); -bool8 DungeonGiveNameToRecruitedMon(u8 *a0); +bool8 DungeonGiveNameToRecruitedMon(u8 *name); -#endif +#endif // GUARD_DUNGEON_MAIN_H diff --git a/include/dungeon_misc.h b/include/dungeon_misc.h index 3473128b6..c4197dae5 100644 --- a/include/dungeon_misc.h +++ b/include/dungeon_misc.h @@ -36,14 +36,14 @@ void sub_8068BDC(bool8 a0); void sub_8068F28(void); void sub_8068F80(void); void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3); -void sub_80694C0(Entity *target,s32 x,int y,char param_4); +void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4); void sub_80695EC(Entity *param_1,int x,int y); Entity * sub_8069660(Entity *target); Entity * sub_80696A8(Entity *target); Entity * sub_80696FC(Entity *target); Entity * sub_806977C(Entity *target); void sub_8069844(struct unkStruct_808FF20 *param_1, Entity *target); -u32 sub_8069D18(DungeonPos *pos,Entity *entity); +bool8 sub_8069D18(DungeonPos *pos,Entity *entity); void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target); void TargetTileInFront(Entity *pokemon); void sub_8069E0C(Entity *pokemon); @@ -70,10 +70,11 @@ void sub_806A898(Entity *entity, bool8 r7, bool8 showRunAwayEffect); void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect); void sub_806A974(void); void sub_806A9B4(Entity *entity, s32 moveIndex); -bool8 sub_806AA0C(s16 _species, bool32 _a1); +// s16 memes +//bool8 sub_806AA0C(s16 _species, bool32 _a1); void sub_806AA70(void); void sub_806AB2C(void); void EndAbilityImmuneStatus(Entity *attacker, Entity *target); void MarkLastUsedMonMove(Entity *entity, Move *move); -#endif +#endif // GUARD_DUNGEON_MISC_H diff --git a/include/dungeon_move.h b/include/dungeon_move.h index ccb15e650..5613f2aa9 100644 --- a/include/dungeon_move.h +++ b/include/dungeon_move.h @@ -4,6 +4,9 @@ #include "structs/str_pokemon.h" #include "structs/str_moves.h" +extern s32 gUnknown_202F208; +extern s32 gUnknown_202F224; + bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move); -#endif +#endif // GUARD_DUNGEON_MOVE_H diff --git a/include/dungeon_music.h b/include/dungeon_music.h index 53a70f40e..c6a983a9f 100644 --- a/include/dungeon_music.h +++ b/include/dungeon_music.h @@ -1,16 +1,21 @@ #ifndef GUARD_DUNGEON_MUSIC_H #define GUARD_DUNGEON_MUSIC_H -void PlaySoundEffect(u32 songIndex); -void StopSoundEffect(u32 songIndex); -bool8 IsFanfareSEPlaying_2(u16 songIndex); -void DungeonStartNewBGM(u16 songIndex); +u16 DungeonGetCurrentBGSong(void); void DungeonFadeInNewBGM(u16 songIndex, u32 fadeInSpeed); void DungeonFadeOutBGM(u16 speed); +void DungeonStartNewBGM(u16 songIndex); void DungeonStopBGM(void); -u16 DungeonGetCurrentBGSong(void); +bool8 IsFanfareSEPlaying_2(u16 songIndex); +void PlayDungeonCursorSE(bool8 checkMenuEntriesCount); +void PlayDungeonStartButtonSE(void); +void PlaySoundEffect(u32 songIndex); void StopDungeonBGM(void); +void StopSoundEffect(u32 songIndex); +void sub_8083AB0(s16 param_0, Entity *target, Entity *entity); +bool8 sub_8083C24(void); +bool8 sub_8083C50(void); +bool8 sub_8083C88(u8); void UpdateDungeonMusic(void); -#endif - +#endif // GUARD_DUNGEON_MUSIC_H diff --git a/include/file_system.h b/include/file_system.h index a6c4e91b3..2b917cce2 100644 --- a/include/file_system.h +++ b/include/file_system.h @@ -1,34 +1,7 @@ #ifndef GUARD_FILE_SYSTEM_H #define GUARD_FILE_SYSTEM_H -// size: 0x8 -typedef struct File -{ - /* 0x0 */ char *name; - /* 0x4 */ const void *data; -} File; - -// size: 0x8 -typedef struct OpenedFile -{ - /* 0x0 */ const File *file; - /* 0x4 */ const void *data; -} OpenedFile; - -// size: 0x10 -typedef struct FileArchive -{ - /* 0x0 */ char magic[8]; - /* 0x8 */ s32 count; - /* 0xC */ const File *entries; -} FileArchive; - -// size: 0x8 -typedef struct UnkFileStruct -{ - /* 0x0 */ u32 unk0; - /* 0x4 */ u32 unk4; -} UnkFileStruct; +#include "structs/str_file_system.h" OpenedFile *Call_OpenFileAndGetFileDataPtr(const u8 *filename, const FileArchive *arc); void CloseFile(OpenedFile *openedFile); @@ -39,6 +12,4 @@ OpenedFile *OpenFileAndGetFileDataPtr(const u8 *filename, const FileArchive *arc u32 sub_800A8F8(u32 value); -extern const FileArchive gMonsterFileArchive; // monster_sbin.c - #endif //GUARD_FILE_SYSTEM_H diff --git a/include/friend_areas_map.h b/include/friend_areas_map.h index 2559c92ad..78fbccb4c 100644 --- a/include/friend_areas_map.h +++ b/include/friend_areas_map.h @@ -1,12 +1,10 @@ #ifndef GUARD_FRIEND_AREAS_MAP_H #define GUARD_FRIEND_AREAS_MAP_H -#include "file_system.h" -#include "code_8004AA0.h" -#include "menu_input.h" -#include "structs/axdata.h" -#include "structs/str_position.h" #include "constants/direction.h" +#include "structs/menu.h" +#include "structs/axdata.h" +#include "code_8004AA0.h" #define MAX_AREAS_PER_LOCATION 8 @@ -104,18 +102,8 @@ struct struct_unk800F990 u8 unkC; }; -void ShowFriendAreasMap(struct struct_unk800F990 *param_1); +void ShowFriendAreasMap_Async(struct struct_unk800F990 *param_1); void PrintFriendAreaNameInMap(u8 *strBuffer, u8 index); bool8 IsFriendAreaShownOnMap(u8 friendAreaId); -void FriendAreasMap_UpdateMonSpritePosition(void); -void FriendAreasMap_UpdateBg(void); -void FriendAreasMap_HideTextWindowAndArrows(void); -void FriendAreasMap_RunFrameActions(void); -void FriendAreasMap_ShowDirectionArrows(void); -void FriendAreasMap_PrintCurrAreaName(void); -void FriendAreasMap_PrintAvailableSubAreas(void); -void FriendAreasMap_CloseFiles(void); -void FriendAreasMap_InitGfx(void); - -#endif +#endif // GUARD_FRIEND_AREAS_MAP_H diff --git a/include/friend_areas_map_util.h b/include/friend_areas_map_util.h new file mode 100644 index 000000000..f27803100 --- /dev/null +++ b/include/friend_areas_map_util.h @@ -0,0 +1,14 @@ +#ifndef GUARD_FRIEND_AREAS_MAP_UTIL_H +#define GUARD_FRIEND_AREAS_MAP_UTIL_H + +void FriendAreasMap_CloseFiles(void); +void FriendAreasMap_HideTextWindowAndArrows(void); +void FriendAreasMap_InitGfx(void); +void FriendAreasMap_PrintAvailableSubAreas(void); +void FriendAreasMap_PrintCurrAreaName(void); +void FriendAreasMap_RunFrameActions(void); +void FriendAreasMap_ShowDirectionArrows(void); +void FriendAreasMap_UpdateBg(void); +void FriendAreasMap_UpdateMonSpritePosition(void); + +#endif // GUARD_FRIEND_AREAS_MAP_UTIL_H diff --git a/include/global.h b/include/global.h index 100e30a63..19f3d9f3d 100644 --- a/include/global.h +++ b/include/global.h @@ -1,6 +1,9 @@ #ifndef GUARD_GLOBAL_H #define GUARD_GLOBAL_H +#include +#include +#include #include #include "config.h" // We need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" diff --git a/include/items.h b/include/items.h index fae2e3148..46510507b 100644 --- a/include/items.h +++ b/include/items.h @@ -81,8 +81,10 @@ s32 SaveTeamInventory(u8 *, u32 size); +s32 GetItemPossessionCount(u8 id); s32 WriteHighDecimal(s32, u8 *strbuf, u8); u32 sub_80913E0(Item* slot, u32 a2, STATUSTEXTS(statuses)); +u8 sub_8091E94(s32 a0, s32 a1, s32 a2); static inline void ZeroOutItem(Item *item) { diff --git a/include/math.h b/include/math.h index 824152262..fd88f0767 100644 --- a/include/math.h +++ b/include/math.h @@ -2,8 +2,11 @@ #define GUARD_MATH_H #include "gba/types.h" +#include "structs/str_position.h" #include "number_util.h" +s32 Atan2_4096(PixelPos *a); + /** * This function computes the cosine of of `x` using a lookup table. The period of * the function is `4096`, and the range is `[-256, 256]`. diff --git a/include/reg_control.h b/include/reg_control.h index d87c4ccd1..3762d8c8a 100644 --- a/include/reg_control.h +++ b/include/reg_control.h @@ -5,7 +5,6 @@ typedef void (*IntrCallback)(void); extern IntrCallback gIntrCallbacks[6]; -void AckInterrupt(u16); bool8 EnableInterrupts(void); bool8 DisableInterrupts(void); diff --git a/include/status_checks_1.h b/include/status_checks_1.h index 3706cdbcd..572d67d2a 100644 --- a/include/status_checks_1.h +++ b/include/status_checks_1.h @@ -8,5 +8,6 @@ bool8 HasNegativeStatus(Entity *pokemon); bool8 IsSleeping(Entity *pokemon); bool8 HasLowHealth(Entity *pokemon); s32 sub_8070828(Entity *pokemon, bool8 displayMessage); +void sub_80709C8(u8 *buffer, EntityInfo *entityInfo); -#endif +#endif // GUARD_STATUS_CHECKS_1_H diff --git a/include/structs/axdata.h b/include/structs/axdata.h index d722174d8..02e771233 100644 --- a/include/structs/axdata.h +++ b/include/structs/axdata.h @@ -1,7 +1,7 @@ #ifndef GUARD_AXDATA_H #define GUARD_AXDATA_H -#include "file_system.h" +#include "structs/str_file_system.h" #include "structs/str_position.h" // size: 0x8 @@ -83,7 +83,7 @@ typedef struct axmain struct axObject { /* 0x0 */ axdata axdata; - /* 0x3C */ OpenedFile *spriteFile; // This might be a unkStruct_202EE8C instead and unkStruct_202EE8C.unk0 might be a OpenedFile* etc. See sub_8010F28 + /* 0x3C */ OpenedFile *spriteFile; // This might be a unkStruct_202EE8C instead and unkStruct_202EE8C.unk0 might be a OpenedFile* etc. See friend_areas_map_util.AnimateSprites() s16 unk40_maybeAnimTimer; u8 unk42_animId1; u8 unk43_animId2; diff --git a/include/structs/str_202ED28.h b/include/structs/str_202ED28.h index 889f837a5..208a8cf63 100644 --- a/include/structs/str_202ED28.h +++ b/include/structs/str_202ED28.h @@ -1,6 +1,7 @@ #ifndef GUARD_STR_202ED28_H #define GUARD_STR_202ED28_H +#include "structs/sprite_oam.h" #include "structs/str_position.h" struct unkStruct_202ED28 diff --git a/include/structs/str_dungeon_8042F6C.h b/include/structs/str_dungeon_8042F6C.h index 68195575a..ef2042fca 100644 --- a/include/structs/str_dungeon_8042F6C.h +++ b/include/structs/str_dungeon_8042F6C.h @@ -24,13 +24,13 @@ typedef struct UnkStruct_RunDungeon PokemonStruct1 unk1C; u8 *unk74; Dungeon *unk78; - s16 unk7C; + s16 unk7C; // Set to 5 if the dungeon was skipped (quicksave read failed) u8 unk7E; DungeonLocation unk80; WonderMailSub unk84; } UnkStruct_RunDungeon; // TODO: This func should not be in a structs include file -void RunDungeon(UnkStruct_RunDungeon *r8); +void RunDungeon_Async(UnkStruct_RunDungeon *r8); -#endif // GUARD_STR_DUNGEON_8042F6C_H \ No newline at end of file +#endif // GUARD_STR_DUNGEON_8042F6C_H diff --git a/include/structs/str_file_system.h b/include/structs/str_file_system.h new file mode 100644 index 000000000..428531726 --- /dev/null +++ b/include/structs/str_file_system.h @@ -0,0 +1,26 @@ +#ifndef GUARD_STR_FILE_SYSTEM_H +#define GUARD_STR_FILE_SYSTEM_H + +// size: 0x8 +typedef struct File +{ + /* 0x0 */ char *name; + /* 0x4 */ const void *data; +} File; + +// size: 0x10 +typedef struct FileArchive +{ + /* 0x0 */ char magic[8]; + /* 0x8 */ s32 count; + /* 0xC */ const File *entries; +} FileArchive; + +// size: 0x8 +typedef struct OpenedFile +{ + /* 0x0 */ const File *file; + /* 0x4 */ const void *data; +} OpenedFile; + +#endif // GUARD_STR_FILE_SYSTEM_H diff --git a/include/structs/str_text.h b/include/structs/str_text.h index 2befd0e4f..ddf0ce496 100644 --- a/include/structs/str_text.h +++ b/include/structs/str_text.h @@ -4,28 +4,28 @@ // size: 0x48 typedef struct Window { - s16 x; - s16 y; - s16 width; - s16 height; - s16 unk8; - s32 type; - u32 unk10; - u32 unk14; - u32 *unk18; - u32 *unk1C; - s32 unk20; - s32 unk24; - u32 *unk28; // Somewhere in VRAM - s32 unk2C; - u32 *unk30; // Somewhere in VRAM? - u32 *unk34; - s32 unk38; - u32 *unk3C; - u32 *unk40; - u8 unk44; - bool8 unk45; - u8 unk46; + /* 0x0 */ s16 x; + /* 0x2 */ s16 y; + /* 0x4 */ s16 width; + /* 0x6 */ s16 height; + /* 0x8 */ s16 unk8; + /* 0xC */ s32 type; + /* 0x10 */ u32 unk10; + /* 0x14 */ u32 unk14; + /* 0x18 */ u32 *unk18; + /* 0x1C */ u32 *unk1C; + /* 0x20 */ s32 unk20; + /* 0x24 */ s32 unk24; + /* 0x28 */ u32 *unk28; // Somewhere in VRAM + /* 0x2C */ s32 unk2C; + /* 0x30 */ u32 *unk30; // Somewhere in VRAM? + /* 0x34 */ u32 *unk34; + /* 0x38 */ s32 unk38; + /* 0x3C */ u32 *unk3C; + /* 0x40 */ u32 *unk40; + /* 0x44 */ u8 unk44; + /* 0x45 */ bool8 unk45; + /* 0x46 */ u8 unk46; } Window; // size: 0x4 diff --git a/include/tile_types.h b/include/tile_types.h index 46f765829..fda2acf81 100644 --- a/include/tile_types.h +++ b/include/tile_types.h @@ -9,8 +9,9 @@ extern const u8 gDungeonWaterType[76]; +bool8 sub_804AD34(DungeonPos *pos); void sub_804AE84(DungeonPos *pos); bool8 IsTileGround(Tile *tile); bool8 IsWaterTileset(); -#endif // GUARD_TILE_TYPES_H \ No newline at end of file +#endif // GUARD_TILE_TYPES_H diff --git a/include/world_map.h b/include/world_map.h index 37d821373..a6220e0e3 100644 --- a/include/world_map.h +++ b/include/world_map.h @@ -52,6 +52,6 @@ struct UnkStruct_sub_8010268 u8 unkB4; }; -void ShowWorldMap(struct UnkStruct_sub_8010268 *r5); +void ShowWorldMap_Async(struct UnkStruct_sub_8010268 *r5); #endif diff --git a/src/bg_palette_buffer.c b/src/bg_palette_buffer.c index c47699ca6..d80e27d21 100644 --- a/src/bg_palette_buffer.c +++ b/src/bg_palette_buffer.c @@ -21,6 +21,7 @@ void InitBGPaletteBuffer(void) } } +// arm9.bin::020011A0 void SetBGPaletteBufferColorRGB(s32 index, const RGB *color, s32 brightnessRaw, const RGB *ramp) { s32 brightness = brightnessRaw; @@ -44,30 +45,37 @@ void SetBGPaletteBufferColorRGB(s32 index, const RGB *color, s32 brightnessRaw, ramp[color->b].b * brightness / 256 & 0x1F); } +// arm9.bin::02001130 void SetBGPaletteBufferColorArray(s32 index, const RGB *color32) { sBGPaletteRowDirty[index / BG_PALETTE_ROW_SIZE] = TRUE; sBGPaletteBuffer[index] = RGB2(color32->r >> 3, color32->g >> 3, color32->b >> 3); } +// arm9.bin::020010EC void SetBGPaletteBufferColor(s32 index, u16 *color) { sBGPaletteRowDirty[index / BG_PALETTE_ROW_SIZE] = TRUE; sBGPaletteBuffer[index] = *color; } +// arm9.bin::02000FC8 void nullsub_4(s32 index, const RGB *colorArray, s32 brightness, const RGB *ramp) { } +// arm9.bin::02000F58 void nullsub_5(s32 index, const RGB *colorArray) { } +#if (GAME_VERSION == VERSION_RED) UNUSED static void nullsub_143(void) { } +#endif +// arm9.bin::02000E9C void TransferBGPaletteBuffer(void) { u32 i; @@ -89,4 +97,6 @@ void TransferBGPaletteBuffer(void) paletteBufferIndex += BG_PALETTE_ROW_SIZE; } while (paletteBufferIndex < BG_PALETTE_BUFFER_SIZE); + + // NDS version has a second loop for the 2nd screen (0x5000400 dest instead) } diff --git a/src/code_800558C.c b/src/code_800558C.c index 6a7adcfb5..6442c8a7d 100644 --- a/src/code_800558C.c +++ b/src/code_800558C.c @@ -6,19 +6,19 @@ #include "math.h" #include "sprite.h" -EWRAM_DATA u8 gUnknown_2026E38 = 0; -EWRAM_DATA u32 *gUnknown_2026E3C = 0; -EWRAM_DATA s32 gUnknown_2026E40 = 0; -EWRAM_DATA s32 gUnknown_2026E44 = 0; -EWRAM_DATA s32 gUnknown_2026E48 = 0; -EWRAM_DATA bool8 gUnknown_2026E4C = 0; -EWRAM_DATA u16 gUnknown_2026E4E = 0; -EWRAM_DATA bool32 gUnknown_2026E50 = 0; -EWRAM_DATA bool32 gUnknown_2026E54 = 0; -EWRAM_DATA u32 *gUnknown_2026E58 = NULL; -UNUSED EWRAM_DATA static u32 sUnused0 = 0; -EWRAM_DATA static s16 gUnknown_2026E60[324] = {0}; -EWRAM_DATA static s16 gUnknown_20270E8[324] = {0}; +EWRAM_DATA bool8 gUnknown_2026E38 = FALSE; +EWRAM_DATA u32 *gUnknown_2026E3C = NULL; +static EWRAM_DATA s32 sUnknown_2026E40 = 0; // Read from but never written to +static EWRAM_DATA s32 sUnknown_2026E44 = 0; // Read from but never written to +static EWRAM_DATA s32 sUnknown_2026E48 = 0; // Read from but never written to +static EWRAM_DATA bool8 sUnknown_2026E4C = FALSE; +EWRAM_DATA s16 gUnknown_2026E4E = 0; +static EWRAM_DATA bool32 sUnknown_2026E50 = FALSE; +static EWRAM_DATA bool32 sUnknown_2026E54 = FALSE; +static EWRAM_DATA u32 *sUnknown_2026E58 = NULL; +UNUSED static EWRAM_DATA u32 sUnused0 = 0; +static EWRAM_DATA s16 sUnknown_2026E60[324] = {0}; // These might be [2][162] +static EWRAM_DATA s16 sUnknown_20270E8[324] = {0}; EWRAM_INIT s16 *gUnknown_203B078 = NULL; @@ -198,12 +198,12 @@ UNUSED static void nullsub_151(void) void sub_80057E8(void) { - gUnknown_2026E4C = TRUE; - gUnknown_2026E54 = FALSE; - gUnknown_2026E50 = 1; - gUnknown_2026E58 = NULL; + sUnknown_2026E4C = TRUE; + sUnknown_2026E54 = FALSE; + sUnknown_2026E50 = TRUE; + sUnknown_2026E58 = NULL; gUnknown_2026E3C = NULL; - gUnknown_2026E38 = 0; + gUnknown_2026E38 = FALSE; gUnknown_2026E4E = 0x60C; gUnknown_203B078 = NULL; } @@ -214,16 +214,16 @@ void sub_8005838(s32 *a0, u8 kind) s16 *r3; s32 i; - if (!gUnknown_2026E4C) + if (!sUnknown_2026E4C) kind = 0; - r3 = !gUnknown_2026E54 ? gUnknown_2026E60 : gUnknown_20270E8; + r3 = !sUnknown_2026E54 ? sUnknown_2026E60 : sUnknown_20270E8; r2 = gUnknown_203B078; if (r2 == NULL) r2 = (void *) &gUnknown_80B83EA; - gUnknown_2026E58 = (void *) r3; + sUnknown_2026E58 = (void *) r3; switch (kind) { case 0: @@ -504,9 +504,9 @@ void sub_8005838(s32 *a0, u8 kind) s32 j, k; - val1 = gUnknown_2026E40; - val2 = gUnknown_2026E44; - val3 = gUnknown_2026E48; + val1 = sUnknown_2026E40; + val2 = sUnknown_2026E44; + val3 = sUnknown_2026E48; spC = 0x400 / (val3 / 256 + 1); iVar11 = val2 / 256; @@ -545,10 +545,10 @@ void sub_8005838(s32 *a0, u8 kind) if (j >= 160) continue; - if (gUnknown_2026E54 == 0) - gUnknown_2026E60[j * 2 + 1] = uVar7; + if (!sUnknown_2026E54) + sUnknown_2026E60[j * 2 + 1] = uVar7; else - gUnknown_20270E8[j * 2 + 1] = uVar7; + sUnknown_20270E8[j * 2 + 1] = uVar7; } for (; k > r8; k--) { @@ -557,10 +557,10 @@ void sub_8005838(s32 *a0, u8 kind) if (k >= 160) continue; - if (gUnknown_2026E54 == 0) - gUnknown_2026E60[k * 2 + 1] = uVar7; + if (!sUnknown_2026E54) + sUnknown_2026E60[k * 2 + 1] = uVar7; else - gUnknown_20270E8[k * 2 + 1] = uVar7; + sUnknown_20270E8[k * 2 + 1] = uVar7; } } } @@ -571,17 +571,17 @@ void sub_8005838(s32 *a0, u8 kind) UNUSED static void sub_80060A8(void) { - gUnknown_2026E3C = gUnknown_2026E58; - gUnknown_2026E54 = !gUnknown_2026E54; - gUnknown_2026E50 = !gUnknown_2026E50; + gUnknown_2026E3C = sUnknown_2026E58; + sUnknown_2026E54 = !sUnknown_2026E54; + sUnknown_2026E50 = !sUnknown_2026E50; gUnknown_2026E38 = FALSE; } void sub_80060EC(void) { - gUnknown_2026E3C = gUnknown_2026E58; - gUnknown_2026E54 = !gUnknown_2026E54; - gUnknown_2026E50 = !gUnknown_2026E50; + gUnknown_2026E3C = sUnknown_2026E58; + sUnknown_2026E54 = !sUnknown_2026E54; + sUnknown_2026E50 = !sUnknown_2026E50; SetBldAlphaReg((gUnknown_2026E4E & 0x1F00) >> 8, gUnknown_2026E4E & 0x1F); gUnknown_2026E38 = TRUE; } diff --git a/src/code_8009804.c b/src/code_8009804.c index 79d5a623c..3315e577f 100644 --- a/src/code_8009804.c +++ b/src/code_8009804.c @@ -1,19 +1,12 @@ #include "global.h" #include "globaldata.h" #include "bg_palette_buffer.h" +#include "code_800558C.h" #include "code_8009804.h" #include "cpu.h" +#include "def_filearchives.h" #include "file_system.h" #include "text.h" -#include "code_800558C.h" - -extern const struct FileArchive gSystemFileArchive; // 8300500 - -EWRAM_DATA RGB gFontPalette[128] = {0}; -EWRAM_DATA static u8 gUnknown_202D238[4] = {0}; -EWRAM_DATA static s32 gUnknown_202D23C = 0; -EWRAM_DATA static struct unkStruct_202D240 gUnknown_202D240[8] = {0}; -EWRAM_DATA u32 gUnknown_202D2A0 = 0; struct FontData { @@ -21,11 +14,17 @@ struct FontData u8 dataArray[0]; }; -// Only written to. -EWRAM_INIT static bool8 gUnknown_203B090 = FALSE; +EWRAM_DATA RGB gFontPalette[128] = {0}; +static EWRAM_DATA u8 sUnknown_202D238[4] = {0}; +static EWRAM_DATA s32 sUnknown_202D23C = 0; +static EWRAM_DATA struct unkStruct_202D240 sUnknown_202D240[8] = {0}; +/*static [.s file not finished yet]*/ EWRAM_DATA u32 gUnknown_202D2A0 = 0; -#define OAM_DUMMY 0xA000A0 // y set to 160 - DISPLAY_HEIGHT +static EWRAM_INIT bool8 sUnknown_203B090 = FALSE; // Only written to. +#define OAM_DUMMY 0xA000A0 // y set to 160 (DISPLAY_HEIGHT) + +// arm9.bin::0200A178 void InitGraphics(void) { s32 i; @@ -39,7 +38,7 @@ void InitGraphics(void) register const FileArchive *sysFileArchieve asm("r4"); #endif // NONMATCHING - gUnknown_203B090 = TRUE; + sUnknown_203B090 = TRUE; dest = (u32 *)VRAM; for (i = 0; i < VRAM_SIZE / sizeof(*dest); i++) { *dest++ = 0; @@ -68,6 +67,8 @@ void InitGraphics(void) CpuCopy((u32 *)(VRAM + 0x17e00), font->dataArray, i * 32); CloseFile(file); + // TODO: Lots missing here from NDS. + InitFontPalette(); file = OpenFileAndGetFileDataPtr("fontsppa", sysFileArchieve); rgbColors = (RGB *)file->data; @@ -79,6 +80,7 @@ void InitGraphics(void) TransferBGPaletteBuffer(); } +// arm9.bin::0200A100 void InitFontPalette(void) { OpenedFile *fontpalFile; @@ -99,6 +101,7 @@ void InitFontPalette(void) CloseFile(fontpalFile); } +// arm9.bin::0200A00C void vram_related_8009804(void) { u32 i; @@ -133,52 +136,60 @@ void vram_related_8009804(void) *dest++ = OAM_DUMMY; } +// Extra func in NDS here: +// arm9.bin::02009FC4 + +// arm9.bin::02009F70 void sub_80098A0(void) { - gUnknown_202D23C = 0; - gUnknown_202D238[0] = 0; - gUnknown_202D238[1] = 0; - gUnknown_202D238[2] = 0; - gUnknown_202D238[3] = 0; + sUnknown_202D23C = 0; + sUnknown_202D238[0] = 0; + sUnknown_202D238[1] = 0; + sUnknown_202D238[2] = 0; + sUnknown_202D238[3] = 0; } +// arm9.bin::02009F18 void sub_80098BC(u32 *r0, const u32 *r1, u32 r2) { - if (gUnknown_202D23C < 8) { - gUnknown_202D240[gUnknown_202D23C].unk0 = r0; - gUnknown_202D240[gUnknown_202D23C].unk4 = r1; - gUnknown_202D240[gUnknown_202D23C].size = r2; - gUnknown_202D23C++; + if (sUnknown_202D23C < 8) { + sUnknown_202D240[sUnknown_202D23C].unk0 = r0; + sUnknown_202D240[sUnknown_202D23C].unk4 = r1; + sUnknown_202D240[sUnknown_202D23C].size = r2; + sUnknown_202D23C++; } } +// The below func has a sibling in the NDS version. +// arm9.bin::02009F04 and arm9.bin::02009EF0 + void sub_80098F8(u32 r0) { - gUnknown_202D238[r0] = 1; + sUnknown_202D238[r0] = 1; } void sub_8009908(void) { s32 i; - for (i = 0; i < gUnknown_202D23C; i++) - CpuCopy(gUnknown_202D240[i].unk0, gUnknown_202D240[i].unk4, gUnknown_202D240[i].size); + for (i = 0; i < sUnknown_202D23C; i++) + CpuCopy(sUnknown_202D240[i].unk0, sUnknown_202D240[i].unk4, sUnknown_202D240[i].size); - gUnknown_202D23C = 0; - if (gUnknown_202D238[0] != 0) { - gUnknown_202D238[0] = 0; + sUnknown_202D23C = 0; + if (sUnknown_202D238[0] != 0) { + sUnknown_202D238[0] = 0; CpuCopy(BG_SCREEN_ADDR(12), gBgTilemaps[0], BG_SCREEN_SIZE); } - if (gUnknown_202D238[1] != 0) { - gUnknown_202D238[1] = 0; + if (sUnknown_202D238[1] != 0) { + sUnknown_202D238[1] = 0; CpuCopy(BG_SCREEN_ADDR(13), gBgTilemaps[1], BG_SCREEN_SIZE); } - if (gUnknown_202D238[2] != 0) { - gUnknown_202D238[2] = 0; + if (sUnknown_202D238[2] != 0) { + sUnknown_202D238[2] = 0; CpuCopy(BG_SCREEN_ADDR(14), gBgTilemaps[2], BG_SCREEN_SIZE); } - if (gUnknown_202D238[3] != 0) { - gUnknown_202D238[3] = 0; + if (sUnknown_202D238[3] != 0) { + sUnknown_202D238[3] = 0; CpuCopy(BG_SCREEN_ADDR(15), gBgTilemaps[3], BG_SCREEN_SIZE); } } diff --git a/src/code_800C9CC.c b/src/code_800C9CC.c index 2287df3b2..c460c1cec 100644 --- a/src/code_800C9CC.c +++ b/src/code_800C9CC.c @@ -1,13 +1,13 @@ #include "global.h" #include "code_800C9CC.h" +#include "cpu.h" #include "random.h" #include "reg_control.h" // Todo: Figure out if this file could be merged with bg_control and cpu? EWRAM_INIT u32 gUnknown_203B0B8 = {0}; -extern u16 gRawKeyInput; -void sub_800CB20(void) +void WaitForNextFrameAndAdvanceRNG(void) { sub_800BA5C(); gUnknown_203B0B8++; diff --git a/src/code_800D090.c b/src/code_800D090.c index ee9d0c8e2..28550b514 100644 --- a/src/code_800D090.c +++ b/src/code_800D090.c @@ -1,7 +1,3 @@ -#include -#include -#include "gba/gba.h" -#include "config.h" #include "global.h" #include "music.h" diff --git a/src/code_800DAC0.c b/src/code_800DAC0.c index 2525ca6c9..b1d1406f9 100644 --- a/src/code_800DAC0.c +++ b/src/code_800DAC0.c @@ -2,8 +2,10 @@ #include "bg_control.h" #include "code_800558C.h" #include "code_800DAC0.h" -#include "code_80118A4.h" #include "code_800E9A8.h" +#include "code_80118A4.h" +#include "code_803E724.h" +#include "def_filearchives.h" #include "file_system.h" #include "main_loops.h" #include "memory.h" @@ -21,13 +23,11 @@ extern s32 sub_800E2C0(u32); extern u32 sub_800E900(void); extern void sub_8009BE4(void); extern void sub_800F204(void); -extern void sub_803EAF0(u32, u32); extern struct unkStruct_800F18C *sub_800F18C(s32); extern void sub_800DCA8(struct unkStruct_203B0CC_sub *); extern u8 gefob000_string[]; extern u8 gefob001_string[]; -extern struct FileArchive gEffectFileArchive; extern void sub_800F034(void); extern void sub_800ED38(u32); @@ -137,7 +137,7 @@ void sub_800DC14(s32 param_1) sub_8009BE4(); if (sub_8000728() == 1) { LoadDungeonMapPalette(); - sub_803EAF0(0,0); + sub_803EAF0(0, NULL); sub_800CD64(0x8000,0); } } diff --git a/src/code_800ED38.c b/src/code_800ED38.c index b5a549ce3..6bd3b4b74 100644 --- a/src/code_800ED38.c +++ b/src/code_800ED38.c @@ -1,15 +1,18 @@ #include "global.h" +#include "bg_control.h" +#include "code_800558C.h" +#include "code_8009804.h" +#include "code_800C9CC.h" #include "code_800E9E4.h" -#include "dungeon_pokemon_sprites.h" +#include "code_800ED38.h" +#include "code_803E724.h" #include "dungeon_message.h" +#include "dungeon_pokemon_sprites.h" #include "file_system.h" #include "main_loops.h" #include "memory.h" #include "sprite.h" -#include "code_800C9CC.h" -#include "code_800558C.h" -#include "bg_control.h" -#include "code_8009804.h" +#include "text.h" struct unkStruct_203B0D0_sub { @@ -42,6 +45,8 @@ void sub_800F204(OpenedFile *file); void sub_800F13C(s32, OpenedFile *, unkStruct_80B9CC4 *); void sub_800F15C(s32); +extern void sub_809971C(u16 a0, const RGB *a1, int a2); + void sub_800ED38(s32 r0) { if(gUnknown_203B0D0 == 0) @@ -205,10 +210,6 @@ void sub_800EF40(u8 r0, u8 r1) sub_800EE5C(ret); } -extern void xxx_call_update_bg_vram(void); -extern void sub_803EAF0(u32 a0, u8 *a1); -extern void sub_809971C(u16 a0, const RGB *a1, int a2); - void sub_800EF64(void) { s32 i; @@ -246,7 +247,7 @@ void sub_800EF64(void) sub_800CD64(0, TRUE); sub_8052210(0); sub_803EAF0(5, NULL); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); xxx_call_update_bg_vram(); } sub_8009A1C(sub->fileData, sub->unkC, sub->unk10, sub->unk14); diff --git a/src/code_800F034.c b/src/code_800F034.c index 6f08b8b99..559fa596f 100644 --- a/src/code_800F034.c +++ b/src/code_800F034.c @@ -1,7 +1,7 @@ #include "global.h" #include "globaldata.h" -#include #include "code_800E9E4.h" +#include "def_filearchives.h" #include "file_system.h" #include "memory.h" @@ -21,8 +21,6 @@ extern struct unkStruct_203B0D4 *gUnknown_203B0D4; ALIGNED(4) static const u8 gUnknown_80CE77C[] = "efob%03d"; ALIGNED(4) static const u8 gUnknown_80CE788[] = "efbg%03d"; -extern struct FileArchive gEffectFileArchive; - void sub_800F034(void) { s32 index; if(gUnknown_203B0D4 == NULL) diff --git a/src/code_80118A4.c b/src/code_80118A4.c index 9a9993696..7ada63dd5 100644 --- a/src/code_80118A4.c +++ b/src/code_80118A4.c @@ -16,9 +16,6 @@ EWRAM_DATA s16 gUnknown_202DE20 = {0}; EWRAM_DATA s16 gUnknown_202DE22 = {0}; EWRAM_DATA s16 gUnknown_202DE24 = {0}; -extern bool8 sub_80111C4(); -extern void sub_8010F28(); - void sub_8011760(void) { if (sub_80023E4(13)) diff --git a/src/code_8012A18.c b/src/code_8012A18.c index 82a67d061..cacdb37d9 100644 --- a/src/code_8012A18.c +++ b/src/code_8012A18.c @@ -7,8 +7,7 @@ #include "string_format.h" #include "game_options.h" #include "sprite.h" - -extern void xxx_call_update_bg_vram(); +#include "text.h" void sub_8012A18() { @@ -17,7 +16,7 @@ void sub_8012A18() nullsub_8(gGameOptionsRef->unkA); sub_8005180(); sub_80060EC(); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); // Input related CopySpritesToOam(); sub_8005304(); diff --git a/src/code_801D014.c b/src/code_801D014.c index cd4b767d6..69a1cea41 100644 --- a/src/code_801D014.c +++ b/src/code_801D014.c @@ -1,16 +1,15 @@ #include "global.h" #include "globaldata.h" +#include "constants/friend_area.h" #include "bg_palette_buffer.h" #include "code_800D090.h" -#include "string_format.h" -#include "iq_skill_menu.h" #include "code_801D014.h" #include "code_80227B8.h" #include "code_8023868.h" #include "code_8024458.h" #include "code_80958E8.h" #include "common_strings.h" -#include "constants/friend_area.h" +#include "def_filearchives.h" #include "event_flag.h" #include "friend_area.h" #include "friend_area_action_menu.h" @@ -19,11 +18,13 @@ #include "ground_main.h" #include "ground_map_1.h" #include "input.h" +#include "iq_skill_menu.h" #include "memory.h" #include "menu_input.h" #include "options_menu1.h" #include "party_list_menu.h" #include "rescue_team_info.h" +#include "string_format.h" #include "text.h" #include "wigglytuff_shop2.h" #include "wonder_mail_802C4C8.h" @@ -32,8 +33,6 @@ static EWRAM_INIT struct unk_203B250 *sUnknown_203B250 = {NULL}; static EWRAM_INIT u32 sUnknown_203B254 = {0}; -extern const struct FileArchive gTitleMenuFileArchive; - #include "data/code_801D014.h" static void LoadTeamRankBadge(u32, u32, u32); diff --git a/src/code_803D110.c b/src/code_803D110.c index 762afb0d9..b67ab5c7a 100644 --- a/src/code_803D110.c +++ b/src/code_803D110.c @@ -1,22 +1,22 @@ #include "global.h" -#include "dungeon.h" -#include "pokemon.h" -#include "file_system.h" -#include "code_803E46C.h" -#include "code_8009804.h" -#include "cpu.h" -#include "dungeon_random.h" -#include "bg_palette_buffer.h" -#include "code_800D090.h" -#include "pokemon_3.h" -#include "game_options.h" -#include "text.h" #include "constants/dungeon.h" #include "structs/str_202ED28.h" #include "structs/str_202EDE8.h" +#include "bg_palette_buffer.h" +#include "code_8009804.h" +#include "code_800D090.h" +#include "code_803D110.h" +#include "code_803E46C.h" +#include "cpu.h" +#include "def_filearchives.h" +#include "dungeon.h" +#include "dungeon_random.h" +#include "file_system.h" +#include "game_options.h" +#include "pokemon.h" +#include "pokemon_3.h" +#include "text.h" -extern void sub_803E13C(void); -extern void sub_80901D8(DungeonLocation *param_1,DungeonLocation *param_2); extern s32 sub_80902C8(u8 dungeon); extern void sub_808E9C4(UnkDungeonGlobal_unk1CD98 *r0, s16 r1); extern bool8 sub_80848EC(void); @@ -34,7 +34,6 @@ extern const u32 gUnknown_80F6120[]; extern const u16 gUnknown_80F5F70[]; extern RGB gUnknown_202ECA4[]; -extern struct FileArchive gDungeonFileArchive; extern OpenedFile *gDungeonNameBannerPalette; extern OpenedFile *gDungeonNameBannerFontFile; extern OpenedFile *gUnknown_202ECA0; @@ -42,7 +41,6 @@ extern OpenedFile *gUnknown_202EC9C; extern OpenedFile *gUnknown_202EC98; extern OpenedFile *gUnknown_202EC94; extern s32 gDungeonNameBannerFont; -extern u8 gUnknown_20274A5; struct UnkDungeonFileData { @@ -62,17 +60,47 @@ struct UnkDataFileStruct }; // Very similar to unkChar struct -struct UnkStruct_sub_803DC6C +typedef struct UnkStruct_sub_803DC6C { u8 *unk0; u16 unk4; u8 unk6; +} UnkStruct_sub_803DC6C; + +extern u32 gUnknown_202EDD0; +extern s32 gUnknown_202EDD4; +extern s32 gDungeonBrightness; + +extern SpriteOAM gUnknown_202EDC0; +extern SpriteOAM gUnknown_202EDB8; + +extern const DungeonPos gUnknown_80F61EC[2][6]; + +struct Unk80F6224Struct +{ + s32 shape; + s32 size; + s32 tileNum; }; +struct FileStruct2 +{ + s32 count; + u8 array[0]; +}; + +struct FileStruct +{ + struct FileStruct2 *ptr; + struct u8 *ptr2; +}; + +extern const struct Unk80F6224Struct gUnknown_80F621C[2][6]; + s32 sub_803DC14(const u8 *dungName, s32 strWidth, s32 a2); s32 CalcStringWidth(const u8 *dungName); s32 sub_803DC6C(u32 chr, s32 strWidth, s32 a2); -struct UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr); +static UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr); void sub_803DD30(u8 *a0, u32 *a1); void sub_803D4D0(void) @@ -272,7 +300,7 @@ struct DungeonNamePaletteFileData RGB pal[16]; }; -void ShowDungeonNameBanner(void) +void ShowDungeonNameBanner_Async(void) { u8 text[100]; s32 var; @@ -355,7 +383,7 @@ s32 sub_803DC6C(u32 chr, s32 strWidth, s32 a2) const u32 *constData; u32 sp[72]; s32 r9; - struct UnkStruct_sub_803DC6C *strPtr = sub_803DEC8(chr); + UnkStruct_sub_803DC6C *strPtr = sub_803DEC8(chr); sub_803DD30(strPtr->unk0, sp); r9 = strPtr->unk6; @@ -480,11 +508,11 @@ s32 CalcStringWidth(const u8 *dungName) return w; } -struct UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr) +static UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr) { s32 r2, r4; - struct UnkStruct_sub_803DC6C *ret; - struct UnkStruct_sub_803DC6C *strPtr = *((struct UnkStruct_sub_803DC6C **) gDungeonNameBannerFontFile->data); + UnkStruct_sub_803DC6C *ret; + UnkStruct_sub_803DC6C *strPtr = *((UnkStruct_sub_803DC6C **) gDungeonNameBannerFontFile->data); // Fakematch? Or just magic numbers which will make more sense once this file is documented? if (chr > 63487 && chr < 65535) { @@ -521,18 +549,6 @@ struct UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr) return ret; }; -struct FileStruct2 -{ - s32 count; - u8 array[0]; -}; - -struct FileStruct -{ - struct FileStruct2 *ptr; - struct u8 *ptr2; -}; - void sub_803DF60(void) { u8 *vram; @@ -662,26 +678,9 @@ void sub_803E214(void) CloseFile(gUnknown_202ECA0); } -void nullsub_56(void) {} - -extern u8 gUnknown_203B40D; -extern u32 gUnknown_202EDD0; -extern s32 gUnknown_202EDD4; -extern s32 gDungeonBrightness; - -extern SpriteOAM gUnknown_202EDC0; -extern SpriteOAM gUnknown_202EDB8; - -extern const DungeonPos gUnknown_80F61EC[2][6]; - -struct Unk80F6224Struct +void nullsub_56(void) { - s32 shape; - s32 size; - s32 tileNum; -}; - -extern const struct Unk80F6224Struct gUnknown_80F621C[2][6]; +} void sub_803E250(void) { diff --git a/src/code_803E46C.c b/src/code_803E46C.c index c1cf6c4dc..b46c936f0 100644 --- a/src/code_803E46C.c +++ b/src/code_803E46C.c @@ -1,12 +1,13 @@ #include "global.h" #include "structs/str_dungeon.h" -#include "code_803E46C.h" #include "code_8004AA0.h" #include "code_800558C.h" #include "code_8009804.h" #include "code_800C9CC.h" #include "code_80118A4.h" +#include "code_803E46C.h" #include "code_803E668.h" +#include "code_803E724.h" #include "dungeon_map.h" #include "bg_palette_buffer.h" #include "bg_control.h" @@ -15,6 +16,7 @@ #include "input.h" #include "play_time.h" #include "sprite.h" +#include "text.h" EWRAM_INIT u8 gUnknown_203B40C = 0; EWRAM_INIT u8 gUnknown_203B40D = 0; @@ -31,14 +33,12 @@ void sub_803F580(s32); void sub_806CC10(); void sub_804522C(); void sub_803F9CC(); -extern void xxx_call_update_bg_vram(void); void sub_803ECE0(); void sub_803EDF0(); void sub_800E90C(); void sub_8042E5C(); void sub_800F7D0(DungeonPos *); void sub_803E874(s32, s32); -void sub_803EAF0(s32, s32); void DungeonRunFrameActions(u32 a0) { @@ -95,7 +95,7 @@ void sub_803E490(u32 unused) gDungeonFramesCounter++; IncrementPlayTime(gPlayTimeRef); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); CopySpritesToOam(); nullsub_13(); @@ -127,7 +127,7 @@ void sub_803E668(u32 unused) sub_80060EC(); gDungeonFramesCounter++; IncrementPlayTime(gPlayTimeRef); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); CopySpritesToOam(); nullsub_13(); @@ -144,11 +144,11 @@ void sub_803E668(u32 unused) gUnknown_202EDD4--; } -void sub_803E708(s32 a0, u32 a1) +void sub_803E708(s32 numFrames, u32 a1) { - while (a0 != 0) { + while (numFrames != 0) { DungeonRunFrameActions(a1); - a0--; + numFrames--; } } @@ -179,7 +179,7 @@ void sub_803E748(void) { if(index2 <= 0) { index2 = 0; - sub_803EAF0(1, 0); + sub_803EAF0(1, NULL); gDungeon->unk181e8.unk18217 = index2; } } @@ -214,7 +214,7 @@ void sub_803E7C8(void) if(index2 <= 0) { index2 = 0; - sub_803EAF0(1, 0); + sub_803EAF0(1, NULL); gDungeon->unk181e8.unk18217 = index2; } } diff --git a/src/code_803E724.c b/src/code_803E724.c index 64a70a270..ee4bbcbad 100644 --- a/src/code_803E724.c +++ b/src/code_803E724.c @@ -25,6 +25,7 @@ #include "constants/status.h" #include "code_803E724.h" #include "structs/str_202EDE8.h" +#include "dungeon_music.h" extern s32 gDungeonBrightness; extern u32 gUnknown_202EDD0; @@ -52,15 +53,11 @@ extern const s32 gUnknown_80F6520[]; extern const u16 gUnknown_80F64D8[][9]; extern const u16 gUnknown_80F6544[][9]; -extern u8 gUnknown_20274A5; - extern s32 gDungeonFramesCounter; -extern void PlayDungeonStartButtonSE(void); extern void ShowWholeRevealedDungeonMap(void); extern void sub_80400D4(void); extern void sub_8041888(u8 param_1); -extern void ShowDungeonMapAtPos(s32, s32); void sub_803EC94(void); s32 sub_803EF90(s32 a0, u8 a1); @@ -261,21 +258,23 @@ static const struct WindowTemplates gUnknown_80F63D0 = } }; -void sub_803EAF0(u32 a0, u8 *a1) +// kind==8 uses the `name` param. +void sub_803EAF0(u32 kind, u8 *name) { - if (a0 == gUnknown_202EDD0) + if (kind == gUnknown_202EDD0) return; - switch (a0) { - case 1: - if (gUnknown_203B40C != 0) { + switch (kind) { + case 1: { + if (gUnknown_203B40C != 0) sub_8052210(0); - } + ResetUnusedInputStruct(); sub_803EC94(); ShowWindows(NULL, TRUE, TRUE); break; - case 0: + } + case 0: { sub_803EC94(); ShowWindows(NULL, TRUE, TRUE); if (gUnknown_203B40C != 0) { @@ -283,64 +282,75 @@ void sub_803EAF0(u32 a0, u8 *a1) UpdateBgTilemapForDungeonMap(FALSE); } break; - case 3: + } + case 3: { ShowWindows(&gUnknown_80F62B0, TRUE, TRUE); - if (gUnknown_203B40C != 0) { + if (gUnknown_203B40C != 0) UpdateBgTilemapForDungeonMap(TRUE); - } break; - case 6: - if (gUnknown_203B40C != 0) { + } + case 6: { + if (gUnknown_203B40C != 0) sub_8052210(0); - } + ResetUnusedInputStruct(); ShowWindows(&gUnknown_80F6310, TRUE, TRUE); break; - case 7: - if (gUnknown_203B40C != 0) { + } + case 7: { + if (gUnknown_203B40C != 0) sub_8052210(0); - } + ResetUnusedInputStruct(); ShowWindows(&gUnknown_80F6370, TRUE, TRUE); break; + } case 2: - case 4: - if (gUnknown_203B40C != 0) { + case 4: { + if (gUnknown_203B40C != 0) sub_8052210(0); - } + ResetUnusedInputStruct(); sub_803EC94(); ShowWindows(NULL, TRUE, TRUE); break; - case 5: - if (gUnknown_203B40C != 0) { + } + case 5: { + if (gUnknown_203B40C != 0) sub_8052210(0); - } + ShowWindows(NULL, TRUE, TRUE); break; - case 8: + } + case 8: { if (gUnknown_203B40C != 0) { PlayDungeonStartButtonSE(); sub_8052210(0); } - CreateConfirmNameMenu(2, a1); + + CreateConfirmNameMenu(2, name); break; - case 9: + } + case 9: { if (gUnknown_203B40C != 0) { sub_8052210(0); PlayDungeonStartButtonSE(); } + ResetUnusedInputStruct(); ShowWindows(&gUnknown_80F63D0, FALSE, TRUE); break; - case 10: + } + case 10: { PlayDungeonStartButtonSE(); break; - case 150: // Dummy case put here to match, any value >= 150 works + } + case 150: { // Dummy case put here to match, any value >= 150 works break; + } } - gUnknown_202EDD0 = a0; + gUnknown_202EDD0 = kind; } void sub_803EC94(void) diff --git a/src/code_8040094.c b/src/code_8040094.c index 278031a6e..554ce0f0c 100644 --- a/src/code_8040094.c +++ b/src/code_8040094.c @@ -2,6 +2,7 @@ #include "code_800558C.h" #include "code_800C9CC.h" #include "code_80118A4.h" +#include "def_filearchives.h" #include "dungeon_message.h" #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" @@ -12,7 +13,6 @@ extern s32 gUnknown_80F6568[]; extern const char gUnknown_80F6604; // "zmappat" -extern struct FileArchive gDungeonFileArchive; extern void sub_803F7BC(void); @@ -49,7 +49,7 @@ void sub_8040094(u8 r0) sub_803F7BC(); sub_80060EC(); IncrementPlayTime(gPlayTimeRef); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); xxx_call_update_bg_sound_input(); UpdateDungeonMusic(); diff --git a/src/code_8040094_1.c b/src/code_8040094_1.c index 7fc3c1646..25e02a212 100644 --- a/src/code_8040094_1.c +++ b/src/code_8040094_1.c @@ -1,20 +1,24 @@ #include "global.h" #include "globaldata.h" -#include "dungeon_message.h" -#include "dungeon_random.h" +#include "constants/move_id.h" +#include "constants/type.h" +#include "constants/weather.h" #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" -#include "dungeon_music.h" -#include "dungeon.h" +#include "code_800558C.h" #include "code_8009804.h" #include "code_800E9E4.h" -#include "dungeon_util.h" +#include "code_800ED38.h" +#include "code_803E46C.h" #include "code_804267C.h" -#include "weather.h" +#include "dungeon.h" +#include "dungeon_message.h" +#include "dungeon_move.h" +#include "dungeon_music.h" +#include "dungeon_random.h" +#include "dungeon_util.h" #include "tile_types.h" -#include "constants/move_id.h" -#include "constants/weather.h" -#include "constants/type.h" +#include "weather.h" struct UnkStruct_8040094 { @@ -30,9 +34,7 @@ extern u8 sub_800EC94(s32 param_1); extern s32 sub_800E710(s32 a0, u16 a1); extern void sub_800569C(DungeonPos *, axdata *, u8); extern void sub_800EEC8(u16 r0); -extern void sub_800EF64(void); extern void sub_8042DD4(s32 a0, Entity *a1, s32 a2); -extern void DungeonRunFrameActions(u32); extern u8 sub_800EA44(s32 species, u16 a2); extern s32 sub_800E790(s32 species, u16 a2); extern void sub_806CDD4(Entity *entity, u8, u32 direction); @@ -53,10 +55,7 @@ extern bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move); extern bool8 IsSleeping(Entity *pokemon); extern void sub_80421C0(Entity *pokemon, u16); -extern u8 gUnknown_203B40D; -extern s16 gUnknown_2026E4E; extern s32 gDungeonBrightness; -extern s32 gUnknown_202F224; extern const u8 *const gPtrMagnitudeMessage; extern const s32 gUnknown_8106A8C[]; diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index 267899ace..5f6d9ad44 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -1,12 +1,14 @@ #include "global.h" #include "math.h" +#include "code_800558C.h" +#include "code_800DAC0.h" #include "code_800E9A8.h" +#include "code_800ED38.h" #include "code_803E46C.h" #include "code_803E724.h" +#include "code_8041AD0.h" #include "code_804267C.h" #include "code_806CD90.h" -#include "code_8041AD0.h" -#include "code_800DAC0.h" #include "dungeon_config.h" #include "constants/direction.h" #include "constants/status.h" @@ -41,14 +43,10 @@ extern void PlaySoundEffect(u32); void EntityUpdateStatusSprites(Entity *entity); extern s32 gDungeonBrightness; -extern u8 gUnknown_203B40D; -extern s16 gUnknown_2026E4E; extern void sub_800DBBC(void); extern void sub_803EA10(void); extern void sub_8042E98(void); -extern void sub_800EE5C(u32); -extern void sub_800EF64(void); void sub_804178C(u8 param_1); u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2); diff --git a/src/code_804267C.c b/src/code_804267C.c index 57c523a34..698c8c56a 100644 --- a/src/code_804267C.c +++ b/src/code_804267C.c @@ -1,5 +1,6 @@ #include "global.h" #include "code_800DAC0.h" +#include "code_800ED38.h" #include "code_8041AD0.h" #include "code_804267C.h" #include "code_803E46C.h" @@ -37,7 +38,6 @@ extern u32 sub_8041764(unkStruct_80416E0 *, bool8); extern void sub_8005700(DungeonPos *a0, struct axObject *a1); extern u32 sub_800E49C(); extern void sub_800EF40(u8 r0, u8 r1); -extern void sub_800EF64(void); void sub_8042390(Entity *entity, Item *item) { diff --git a/src/code_8042B34.c b/src/code_8042B34.c index 4fcad96d3..d00038383 100644 --- a/src/code_8042B34.c +++ b/src/code_8042B34.c @@ -4,7 +4,10 @@ #include "structs/rgb.h" #include "structs/sprite_oam.h" #include "structs/str_dungeon_8042F6C.h" +#include "code_800558C.h" +#include "code_803D110.h" #include "code_803E46C.h" +#include "code_803E724.h" #include "code_800E9E4.h" #include "code_800DAC0.h" #include "code_800E9A8.h" @@ -42,9 +45,10 @@ #include "dungeon_config.h" #include "dungeon_map.h" #include "dungeon_items.h" +#include "dungeon_misc.h" +#include "code_8042B34.h" +#include "code_800ED38.h" -extern void sub_800EE5C(s32); -extern void sub_800EF64(void); extern void sub_800F15C(s32); struct UnkStruct_203B414 @@ -258,25 +262,18 @@ extern void sub_8041888(u8 param_1); extern void sub_803D4AC(void); extern void sub_804513C(void); extern void sub_8043CD8(void); -extern void sub_803E250(void); extern void sub_803E830(void); -extern void sub_803E214(void); -extern void nullsub_56(void); extern void sub_8068F28(void); extern void sub_806C1D8(void); extern void IncrementThievingSuccesses(void); -extern void sub_803E13C(void); extern void sub_80841EC(void); extern void sub_8084424(void); extern void sub_8086130(void); extern void FreeDungeonPokemonSprites(void); -extern void sub_803DF60(void); -extern void sub_803E02C(void); extern void sub_80847D4(void); extern void sub_8043D60(void); extern void sub_806890C(void); extern void sub_80840A4(void); -extern void sub_803E178(void); extern void sub_80848F0(void); extern void IncrementAdventureFloorsExplored(void); extern void sub_806AB2C(void); @@ -315,22 +312,14 @@ extern void sub_806A974(void); extern void sub_806CF60(void); extern void sub_8068F80(void); extern bool8 sub_8044B28(void); -extern bool8 sub_8083C24(void); -extern bool8 sub_8083C88(u8 param_1); extern bool8 sub_8043ED0(bool8); -extern void ShowDungeonNameBanner(void); -extern void sub_803EAF0(u32, u32); extern void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect); extern void sub_803F4A0(Entity *a0); -extern void sub_8083AB0(s16 param_0, Entity * target, Entity * entity); -extern bool8 sub_8083C50(void); -extern void sub_8068FE0(Entity *, u32, Entity *r2); extern void ResetMonEntityData(EntityInfo *, u32); extern s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints); extern bool8 IsKeepMoney(u8 dungeon); extern void sub_8042B0C(Entity *); -extern s16 gUnknown_2026E4E; extern u8 gUnknown_202F32C; extern u8 gUnknown_202F1A8; extern s32 gDungeonBrightness; @@ -356,7 +345,7 @@ extern OpenedFile *gDungeonNameBannerPalette; // This functions is the main 'loop' when the player is in a Dungeon. It runs from the moment the player enters a dungeon, until they leave(by completing or by fainting). // arm9.bin::0206A848 -void RunDungeon(UnkStruct_RunDungeon *r8) +void RunDungeon_Async(UnkStruct_RunDungeon *r8) { bool8 check; Entity *leader; @@ -492,7 +481,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8) } } - while (1) { + while (TRUE) { sub_8098080(); nullsub_16(); sub_80521D0(); @@ -583,10 +572,10 @@ void RunDungeon(UnkStruct_RunDungeon *r8) sub_803E178(); gDungeonBrightness = 0; SetDungeonMapToNotShown(); - sub_803EAF0(4, 0); + sub_803EAF0(4, NULL); sub_8052210(0); sub_803F27C(r6); - ShowDungeonNameBanner(); + ShowDungeonNameBanner_Async(); if (!r6) { GenerateFloor(); @@ -653,7 +642,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8) sub_803E7C8(); } sub_8040094(0); - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); InitDungeonMap(r6); ShowWholeRevealedDungeonMap(); gDungeon->unkB8 = NULL; @@ -739,7 +728,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8) } SetDungeonMapToNotShown(); - sub_803EAF0(1, 0); + sub_803EAF0(1, NULL); gDungeon->unk181e8.unk18219 = 0; gDungeon->unk181e8.unk18218 = 1; if (gDungeon->unk3 == 0 diff --git a/src/code_8044CC8.c b/src/code_8044CC8.c index 27e8a4746..82db49574 100644 --- a/src/code_8044CC8.c +++ b/src/code_8044CC8.c @@ -1,11 +1,12 @@ #include "global.h" #include "constants/dungeon_action.h" +#include "structs/str_item_text.h" +#include "code_8044CC8.h" +#include "dungeon_generation.h" +#include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_util.h" -#include "dungeon_generation.h" -#include "code_8044CC8.h" #include "items.h" -#include "structs/str_item_text.h" // size: 0x8 typedef struct unkStr_80F7C54 @@ -25,8 +26,6 @@ extern const unkStr_80F7C54 gUnknown_80F7C54[65]; extern u8 *gUnknown_80F91EC[]; extern bool8 sub_8045888(Entity *); extern u8 GetFloorType(void); -void AddItemToDungeonAt(DungeonPos *, Item *, u32); -bool8 RemoveItemFromDungeonAt(DungeonPos *, u32); Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3) { diff --git a/src/code_8048480.c b/src/code_8048480.c index 7ac03bd5f..bfbe110db 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -29,6 +29,8 @@ #include "dungeon_config.h" #include "dungeon_menu_team.h" #include "dungeon_menu_moves.h" +#include "dungeon_misc.h" +#include "code_803E724.h" extern s16 gTypeGummiIQBoost[NUM_TYPES][NUMBER_OF_GUMMIS]; @@ -67,13 +69,11 @@ extern u8 *gUnknown_80F9BD8[]; #include "data/code_8048480.h" extern void sub_8078B5C(Entity *, Entity *, u32, u32, u32); -extern u8 sub_806A538(s32); extern void sub_8051E7C(Entity *pokemon); extern void sub_8045BF8(u8 *, Item *); extern void ActionShowMoveInfo(ActionContainer *); extern void ActionLinkMoves(ActionContainer *); extern void sub_8044DF0(Entity *, u32, u32); -extern void sub_803EAF0(u32, u32); extern void SetLeaderActionToNothing(bool8); extern void sub_8044E24(Entity *, u32, u32); extern void sub_804245C(Entity *, Item *); @@ -933,22 +933,22 @@ bool8 sub_8048B9C(Entity *entity, Item *item) ActionShowMoveInfo(entityActionPtr); } else if (entityActionPtr->action == ACTION_LINK_MOVES) { - sub_803EAF0(0,0); + sub_803EAF0(0, NULL); ActionLinkMoves(entityActionPtr); SetLeaderActionToNothing(TRUE); ret = TRUE; } else if (entityActionPtr->action == ACTION_DELINK_MOVES) { - sub_803EAF0(0,0); + sub_803EAF0(0, NULL); ActionDelinkMoves(entityActionPtr,0); SetLeaderActionToNothing(TRUE); } else if ((entityActionPtr->action == ACTION_SET_MOVE) || (entityActionPtr->action == ACTION_UNSET_MOVE)) { - sub_803EAF0(0,0); + sub_803EAF0(0, NULL); ActionSetOrUnsetMove(entityActionPtr, FALSE); } else if (entityActionPtr->action == ACTION_SWITCH_AI_MOVE) { - sub_803EAF0(0,0); + sub_803EAF0(0, NULL); ActionToggleMoveUsableForAi(entityActionPtr); } diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 9a240b9a2..7dad6e2df 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -1,39 +1,43 @@ #include "global.h" #include "globaldata.h" -#include "code_8045A00.h" -#include "dungeon_message.h" -#include "code_807CD9C.h" +#include "constants/dungeon.h" +#include "constants/item.h" +#include "constants/move_id.h" +#include "code_803E46C.h" +#include "code_803E724.h" #include "code_8041AD0.h" +#include "code_8044CC8.h" +#include "code_8045A00.h" +#include "code_8066D04.h" #include "code_806CD90.h" +#include "code_8077274_1.h" +#include "code_807CD9C.h" +#include "code_8084778.h" +#include "dungeon_ai_targeting.h" +#include "dungeon_capabilities.h" +#include "dungeon_engine.h" +#include "dungeon_items.h" +#include "dungeon_leader.h" #include "dungeon_map_access.h" +#include "dungeon_message.h" +#include "dungeon_misc.h" +#include "dungeon_move.h" #include "dungeon_movement.h" #include "dungeon_music.h" -#include "position_util.h" -#include "dungeon_util.h" -#include "items.h" -#include "input.h" -#include "text.h" -#include "code_803E46C.h" -#include "string_format.h" -#include "friend_area.h" -#include "dungeon_leader.h" -#include "status_checks_1.h" -#include "dungeon_ai_targeting.h" -#include "dungeon_engine.h" -#include "dungeon_move.h" -#include "dungeon_items.h" #include "dungeon_random.h" -#include "code_8077274_1.h" -#include "code_8084778.h" -#include "pokemon.h" -#include "trap.h" -#include "moves.h" -#include "pokemon_3.h" +#include "dungeon_util.h" +#include "friend_area.h" +#include "input.h" +#include "items.h" #include "menu_input.h" -#include "dungeon_capabilities.h" -#include "constants/item.h" -#include "constants/dungeon.h" -#include "constants/move_id.h" +#include "moves.h" +#include "pokemon.h" +#include "pokemon_3.h" +#include "position_util.h" +#include "status_checks_1.h" +#include "string_format.h" +#include "text.h" +#include "trap.h" extern u8 *gUnknown_80F8BE0[]; extern u8 *gUnknown_80FF76C[]; @@ -77,13 +81,10 @@ extern const u8 *const gMonParalyzed; extern const u8 *const gUnknown_80FC690; extern s32 gDungeonSubMenuItemsCount; -extern u32 gUnknown_202F208; extern void sub_8071DA4(Entity *); extern void sub_806A1B0(Entity *); -extern void sub_806A9B4(Entity *, u32); extern void sub_8057588(Entity * pokemon, u8 param_2); -extern void sub_8068FE0(Entity *, u32, Entity *r2); extern bool8 sub_806A58C(s16 a0); extern bool8 sub_806A564(s16 r0); extern void sub_8045C08(u8 *buffer, Item *item); @@ -91,8 +92,6 @@ extern bool8 sub_8045888(Entity *); extern Item *sub_8044D90(Entity *, s32, u32); void sub_8045BF8(u8 *, Item *); u8 sub_8048D50(); -void SetActionUnusableInDungeonSubMenu(u16 param_1); -void AddActionToDungeonSubMenu(u16 param_1, u8 param_2); void sub_8044DF0(); void sub_8042208(Entity *pokemon, u8 r1); void sub_803E708(); @@ -895,7 +894,6 @@ void sub_8067904(Entity *entity, u16 moveId) extern void sub_80684C4(void); void sub_8045064(void); -extern void PlayDungeonCursorSE(u8 param_1); extern void sub_8068344(void); bool8 CanSubMenuItemBeChosen(s32 param_1); void sub_8068310(s32 n, PokemonStruct1 **monPtrs); @@ -907,7 +905,6 @@ void PlayDungeonConfirmationSE(void); void PlayDungeonCancelSE(void); void sub_806806C(PokemonStruct1 *a0); void CreateDungeonMenuSubWindow(WindowTemplates *a0, s32 a1); -extern void sub_803EAF0(u32, u8 *); extern const s32 gUnknown_8106E80[]; extern MenuInputStruct gDungeonMenu; diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index 3f134482f..e00ca610b 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -2,6 +2,7 @@ #include "code_800F958.h" #include "code_803E46C.h" #include "code_803E668.h" +#include "code_8041AD0.h" #include "code_8045A00.h" #include "code_805D8C8.h" #include "code_804267C.h" @@ -38,6 +39,7 @@ #include "structs/str_806B7F8.h" #include "structs/str_202ED28.h" #include "dungeon_config.h" +#include "dungeon_misc.h" extern void sub_8042900(Entity *r0); extern void sub_8042968(Entity *r0); @@ -62,12 +64,9 @@ extern u8 GetRandomFloorItem(s32 a0); extern void DeletePokemonDungeonSprite(s32 id); extern void sub_80429E8(Entity *r0); extern s32 sub_803DA20(s32 param_1); -extern void sub_80694C0(Entity *, s32, s32, u32); extern s32 gDungeonFramesCounter; extern void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, DungeonPos *statusOffsets, u32 a3); extern void sub_8005700(DungeonPos *a0, struct axObject *a1); -u32 EntityGetStatusSprites(Entity *entity); -void UpdateDungeonPokemonSprite(int id, short species, int status, char visible); extern void sub_8042EC8(Entity *a0, s32 a1); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index c4ed20b67..5c55d96ec 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -1,6 +1,7 @@ #include "global.h" #include "constants/type.h" #include "structs/str_pokemon.h" +#include "dungeon_main.h" #include "dungeon_misc.h" #include "code_80118A4.h" #include "code_803E668.h" @@ -39,7 +40,6 @@ extern u8 *gUnknown_80FA120[]; extern u8 *gUnknown_80FA090[]; u8 sub_806B8CC(); -bool8 DungeonGiveNameToRecruitedMon(u8 *a0); void sub_8083D88(); u8 sub_808529C(s32); void nullsub_96(Entity *pokemon,Entity *target); diff --git a/src/code_807CD9C.c b/src/code_807CD9C.c index 8ff8df2f6..85ef2cc49 100644 --- a/src/code_807CD9C.c +++ b/src/code_807CD9C.c @@ -13,6 +13,7 @@ #include "dungeon_generation.h" #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_map.h" #include "dungeon_map_access.h" #include "dungeon_util.h" #include "math.h" @@ -24,6 +25,8 @@ #include "code_803E668.h" #include "weather.h" #include "dungeon_config.h" +#include "dungeon_misc.h" +#include "dungeon_items.h" extern u32 gDungeonFramesCounter; @@ -53,7 +56,6 @@ extern struct DungeonPos *gUnknown_8107178[3]; extern void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5); // TODO: param_4 should be s16 extern void sub_804216C(Entity *pokemon, Entity *target, u32 r2); -extern void RemoveItemFromDungeonAt(DungeonPos *, u32); extern void sub_804218C(Entity *pokemon, Entity *target); EWRAM_INIT u32 gUnknown_203B444[3] = {0x28, 0x28, 0x50}; @@ -65,7 +67,6 @@ void sub_8049ED4(); void sub_806A5B8(Entity *); u8 sub_8045888(Entity *); void sub_807EC28(u32); -void sub_80694C0(Entity *, s32, s32, s32); void sub_807D068(Entity *, DungeonPos *); u8 sub_8044B28(void); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); @@ -74,9 +75,6 @@ void sub_807BB78(Entity *pokemon); extern void sub_803F580(u32); bool8 sub_808384C(DungeonPos *, DungeonPos *); u8 sub_8083660(DungeonPos *); -void AddItemToDungeonAt(DungeonPos *, Item *, u32); -void sub_80462AC(Entity * ,u32, u32, u8, u32); -extern void ShowDungeonMapAtPos(s32, s32); void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) { diff --git a/src/code_807E1A0.c b/src/code_807E1A0.c index 73b77fcae..bf803f2e4 100644 --- a/src/code_807E1A0.c +++ b/src/code_807E1A0.c @@ -1,5 +1,5 @@ #include "global.h" - +#include "dungeon_misc.h" #include "code_804267C.h" #include "code_8045A00.h" #include "dungeon_message.h" @@ -18,10 +18,8 @@ extern u8 UseAttack(Entity *); extern void sub_805E804(void); void sub_806A2BC(Entity *pokemon, u8 param_2); extern u8 sub_8044B28(void); -extern void sub_8068FE0(Entity *, u32, Entity *r2); extern void nullsub_93(DungeonPos *); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); -extern void sub_80694C0(Entity *, s32, s32, u32); extern void sub_807EC28(bool8); extern void sub_806A5B8(Entity *); diff --git a/src/code_807E5AC.c b/src/code_807E5AC.c index df43219a5..8567c4638 100644 --- a/src/code_807E5AC.c +++ b/src/code_807E5AC.c @@ -26,6 +26,7 @@ #include "code_805D8C8.h" #include "code_803E668.h" #include "code_8045A00.h" +#include "dungeon_items.h" #include "move_util.h" #include "moves.h" #include "code_80450F8.h" @@ -33,12 +34,13 @@ #include "constants/ability.h" #include "constants/monster.h" #include "constants/type.h" +#include "dungeon_misc.h" +#include "code_807E5AC.h" -extern u8 gUnknown_203B40D; extern OpenedFile *gUnknown_202ECA0; +extern SpriteOAM gUnknown_202EDC0; extern void sub_804178C(u32); -extern bool8 RemoveItemFromDungeonAt(DungeonPos *, u32); extern void sub_80429D8(Entity *r0); extern s32 GetMonsterApparentID(Entity *pokemon, s32 id); extern void sub_803E874(bool8 r10, s32 r9); @@ -46,7 +48,6 @@ extern void GetWeatherName(u8 *dst, u8 weatherId); extern s32 CalculateStatusTurns(Entity *target, const s16 *turnRange, bool8 factorCurerSkills); extern void sub_80838EC(u8 *a); extern bool8 sub_8044B28(void); -extern void AddItemToDungeonAt(DungeonPos *, Item *, u32); void sub_807E7FC(bool8 arg0); void sub_807EFFC(bool8 arg0); @@ -623,7 +624,6 @@ extern void sub_806A5B8(Entity *); extern bool8 sub_8045888(Entity *ent); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); extern void sub_807D068(Entity *, DungeonPos *); -extern void sub_80694C0(Entity *target,s32 x,int y,char param_4); void sub_807F9BC(Entity *entity); @@ -872,8 +872,6 @@ void sub_807FA18(void) } } -extern SpriteOAM gUnknown_202EDC0; - void sub_807FA9C(void) { s32 x, y; diff --git a/src/code_8085E98.c b/src/code_8085E98.c index ec0886d27..e68112acb 100644 --- a/src/code_8085E98.c +++ b/src/code_8085E98.c @@ -5,15 +5,13 @@ #include "dungeon_util.h" #include "items.h" #include "code_800DAC0.h" - +#include "code_800ED38.h" #include "structs/sprite_oam.h" #include "structs/str_dungeon.h" extern const unkStruct_2039DB0 gUnknown_8107374; -void sub_800EF64(void); -void sub_800EE5C(s32); void sub_8085F44(s32); bool8 sub_800E90C(DungeonPos *); void sub_8088EE8(void); diff --git a/src/code_80861A8.c b/src/code_80861A8.c index 076532e8c..b25216b8a 100644 --- a/src/code_80861A8.c +++ b/src/code_80861A8.c @@ -1,12 +1,14 @@ #include "global.h" #include "constants/direction.h" -#include "code_80861A8.h" +#include "structs/sprite_oam.h" #include "code_800DAC0.h" +#include "code_800ED38.h" +#include "code_803E46C.h" #include "code_803E668.h" #include "code_806CD90.h" +#include "code_80861A8.h" #include "dungeon_music.h" #include "dungeon_util.h" -#include "structs/sprite_oam.h" extern const unkStruct_2039DB0 gUnknown_8107380; @@ -18,9 +20,6 @@ extern const u8 *gUnknown_810671C[]; static void sub_80861EC(Entity *); -void sub_800EE5C(s32); -void sub_800EF64(); -void DungeonRunFrameActions(s32); s32 sub_800E700(s32); void sub_800569C(DungeonPos *, axdata *, u8); void sub_8085F44(s32); diff --git a/src/code_8099360.c b/src/code_8099360.c index 5ef1880b7..617bd7409 100644 --- a/src/code_8099360.c +++ b/src/code_8099360.c @@ -1,9 +1,11 @@ #include "global.h" -#include "file_system.h" -#include "event_flag.h" +#include "code_800558C.h" #include "code_80A26CC.h" +#include "def_filearchives.h" +#include "event_flag.h" +#include "file_system.h" +#include "text.h" -extern struct FileArchive gSystemFileArchive; extern const u8 gUnknown_811601C[]; extern u8 gUnknown_20398B8; @@ -60,7 +62,6 @@ void sub_80993E4(void) { file or spend time decomping so here it is in asm(); */ -void sub_8099648(void); NAKED UNUSED static void sub_80993F0(void) @@ -286,7 +287,7 @@ UNUSED static void sub_80993F0(void) " bl sub_8099BE4\n" " bl sub_8099744\n" " bl sub_8011860\n" -" bl sub_800CB20\n" +" bl WaitForNextFrameAndAdvanceRNG\n" " bl LoadBufferedInputs\n" " bl nullsub_120\n" " bl sub_80A5E70\n" @@ -327,17 +328,18 @@ UNUSED static void sub_80993F0(void) void sub_809965C(void); -void sub_8099648(void) { +void sub_8099648(void) +{ sub_8003600(); sub_809965C(); } -void nullsub_103(void) { - return; +void nullsub_103(void) +{ } -void sub_809965C(void) { - +void sub_809965C(void) +{ OpenedFile *temp; sub_8099690(0); @@ -347,4 +349,3 @@ void sub_809965C(void) { sub_800388C(0x1f0, temp->data, 0x10); CloseFile(temp); } - diff --git a/src/cpu.c b/src/cpu.c index 713af6c5a..815c4ec15 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -1,5 +1,6 @@ #include "global.h" #include "bg_control.h" +#include "code_800558C.h" #include "cpu.h" EWRAM_DATA u32 gUnknown_202D800 = {0}; @@ -16,9 +17,6 @@ static EWRAM_INIT u16 sBldCntTable[] = { (0), }; -extern u16 *gUnknown_2026E3C; -extern u8 gUnknown_2026E38; - void sub_800CDA8(u32 r0) { gUnknown_202D800 = r0; @@ -79,10 +77,10 @@ void VBlank_CB(void) REG_WINOUT = WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WIN01_BG3 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG0; REG_BLDCNT = gBldCnt; REG_BLDALPHA = gBldAlpha; - if (gUnknown_2026E38 != 0) { - DmaSet(0, &gUnknown_2026E3C[2], REG_ADDR_WIN0H, 0xA2600002); - REG_WIN0H = gUnknown_2026E3C[0]; - REG_WIN1H = gUnknown_2026E3C[1]; + if (gUnknown_2026E38) { + DmaSet(0, &gUnknown_2026E3C[1], REG_ADDR_WIN0H, 0xA2600002); + REG_WIN0H = ((u16 *)gUnknown_2026E3C)[0]; + REG_WIN1H = ((u16 *)gUnknown_2026E3C)[1]; REG_WIN0V = DISPLAY_HEIGHT; REG_WIN1V = DISPLAY_HEIGHT; } diff --git a/src/data/friend_areas_map.h b/src/data/friend_areas_map.h new file mode 100644 index 000000000..89b6d9d91 --- /dev/null +++ b/src/data/friend_areas_map.h @@ -0,0 +1,503 @@ +#define NO_AREA NUM_FRIEND_AREAS + 5 + + // ななし means 'without name' +#define DUMMY_LOCATION \ +{ \ + .name = _("ななし"), \ + .pos = { 0, 0 }, \ + .areasIds = { NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA }, \ + .adjacentLocations = { -1, -1, -1, -1, -1, -1, -1, -1 }, \ +} + +// The second set is all dummies, maybe it was used for testing purposes? +static const struct FriendAreaLocationInfo sFriendAreaLocations[2][NUM_FRIEND_AREA_LOCATIONS] = +{ + { + [LOCATION_MOUNTAIN_RANGE] = + { + .name = "Mountain Range", + .pos = {0x1C5, 0x71}, + .areasIds = {MT_DEEPGREEN, MT_CLEFT, MT_MOONVIEW, MT_DISCIPLINE, DARKNESS_RIDGE, RAINBOW_PEAK, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_EASTERN_FOREST, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_MARSH, + [DIRECTION_WEST] = LOCATION_PLAINS, + [DIRECTION_SOUTHWEST] = LOCATION_RIVER, + }, + }, + [LOCATION_GLACIER] = + { + .name = "Glacier", + .pos = {0x1CD, 0x1C}, + .areasIds = {FRIGID_CAVERN, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_NORTHERN_LAKES, + [DIRECTION_SOUTHWEST] = LOCATION_MARSH, + }, + }, + [LOCATION_PLAINS] = + { + .name = "Plains", + .pos = {0x161, 0x78}, + .areasIds = {BEAU_PLAINS, SKY_BLUE_PLAINS, SACRED_FIELD, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_TEAM_BASE, + [DIRECTION_SOUTHEAST] = LOCATION_RIVER, + [DIRECTION_EAST] = 0, + [DIRECTION_NORTHEAST] = LOCATION_MARSH, + [DIRECTION_NORTH] = LOCATION_CAVE, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_POND, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_SOUTH_PLAINS] = + { + .name = "South Plains", + .pos = {0x162, 0x12D}, + .areasIds = {SAFARI, WILD_PLAINS, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = LOCATION_BADLANDS, + [DIRECTION_NORTH] = LOCATION_JUNGLE, + [DIRECTION_NORTHWEST] = LOCATION_RELICS, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_BADLANDS] = + { + .name = "Badlands", + .pos = {0x194, 0x102}, + .areasIds = {RAVAGED_FIELD, MAGNETIC_QUARRY, THUNDER_MEADOW, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_DESERT, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = LOCATION_EASTERN_LAKES, + [DIRECTION_NORTH] = LOCATION_EASTERN_PONDS, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_JUNGLE, + [DIRECTION_SOUTHWEST] = LOCATION_SOUTH_PLAINS, + }, + }, + [LOCATION_EASTERN_FOREST] = + { + .name = "Eastern Forest", + .pos = {0x1C7, 0x9D}, + .areasIds = {MIST_RISE_FOREST, FLYAWAY_FOREST, OVERGROWN_FOREST, ENERGETIC_FOREST, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_EASTERN_LAKES, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = 0, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_RIVER, + [DIRECTION_SOUTHWEST] = LOCATION_EASTERN_PONDS, + }, + }, + [LOCATION_WESTERN_FOREST] = + { + .name = "Western Forest", + .pos = {0x108, 0x9D}, + .areasIds = {MUSHROOM_FOREST, HEALING_FOREST, TRANSFORM_FOREST, SECRETIVE_FOREST, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_VOLCANO, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = LOCATION_TEAM_BASE, + [DIRECTION_NORTHEAST] = LOCATION_POND, + [DIRECTION_NORTH] = LOCATION_NORTHERN_ISLES, + [DIRECTION_NORTHWEST] = LOCATION_BEACH, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_RIVER] = + { + .name = "River", + .pos = {0x197, 0xA0}, + .areasIds = {RUB_A_DUB_RIVER, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_EASTERN_PONDS, + [DIRECTION_SOUTHEAST] = LOCATION_EASTERN_LAKES, + [DIRECTION_EAST] = LOCATION_EASTERN_FOREST, + [DIRECTION_NORTHEAST] = LOCATION_MOUNTAIN_RANGE, + [DIRECTION_NORTH] = LOCATION_MARSH, + [DIRECTION_NORTHWEST] = LOCATION_PLAINS, + [DIRECTION_WEST] = LOCATION_TEAM_BASE, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_EASTERN_PONDS] = + { + .name = "Eastern Ponds", + .pos = {0x198, 0xCF}, + .areasIds = {TADPOLE_POND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_BADLANDS, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = LOCATION_EASTERN_LAKES, + [DIRECTION_NORTHEAST] = LOCATION_EASTERN_FOREST, + [DIRECTION_NORTH] = LOCATION_RIVER, + [DIRECTION_NORTHWEST] = LOCATION_TEAM_BASE, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = LOCATION_JUNGLE, + }, + }, + [LOCATION_POND] = + { + .name = "Pond", + .pos = {0x133, 0x79}, + .areasIds = {TURTLESHELL_POND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_TEAM_BASE, + [DIRECTION_EAST] = LOCATION_PLAINS, + [DIRECTION_NORTHEAST] = LOCATION_CAVE, + [DIRECTION_NORTH] = LOCATION_RUINS, + [DIRECTION_NORTHWEST] = LOCATION_NORTHERN_ISLES, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = LOCATION_WESTERN_FOREST, + }, + }, + [LOCATION_NORTHERN_LAKES] = + { + .name = "Northern Lakes", + .pos = {0x182, 0x1D}, + .areasIds = {MYSTIC_LAKE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_MARSH, + [DIRECTION_EAST] = 1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_RUINS, + [DIRECTION_SOUTHWEST] = LOCATION_CAVE, + }, + }, + [LOCATION_EASTERN_LAKES] = + { + .name = "Eastern Lakes", + .pos = {0x1C6, 0xD0}, + .areasIds = {WATERFALL_LAKE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = LOCATION_EASTERN_FOREST, + [DIRECTION_NORTHWEST] = LOCATION_RIVER, + [DIRECTION_WEST] = LOCATION_EASTERN_PONDS, + [DIRECTION_SOUTHWEST] = LOCATION_BADLANDS, + }, + }, + [LOCATION_MARSH] = + { + .name = "Marsh", + .pos = {0x1A2, 0x46}, + .areasIds = {PEANUT_SWAMP, POISON_SWAMP, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_RIVER, + [DIRECTION_SOUTHEAST] = LOCATION_MOUNTAIN_RANGE, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = 1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_NORTHERN_LAKES, + [DIRECTION_WEST] = LOCATION_CAVE, + [DIRECTION_SOUTHWEST] = LOCATION_PLAINS, + }, + }, + [LOCATION_CAVE] = + { + .name = "Cave", + .pos = {0x160, 0x47}, + .areasIds = {ECHO_CAVE, DRAGON_CAVE, BOULDER_CAVE, CRYPTIC_CAVE, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_PLAINS, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = LOCATION_MARSH, + [DIRECTION_NORTHEAST] = LOCATION_NORTHERN_LAKES, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_RUINS, + [DIRECTION_WEST] = LOCATION_NORTHERN_ISLES, + [DIRECTION_SOUTHWEST] = LOCATION_POND, + }, + }, + [LOCATION_JUNGLE] = + { + .name = "Jungle", + .pos = {0x163, 0x104}, + .areasIds = {JUNGLE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_SOUTH_PLAINS, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = LOCATION_BADLANDS, + [DIRECTION_NORTHEAST] = LOCATION_EASTERN_PONDS, + [DIRECTION_NORTH] = LOCATION_TEAM_BASE, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_RELICS, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_RUINS] = + { + .name = "Ruins", + .pos = {0x136, 0x1C}, + .areasIds = {DECREPIT_LAB, POWER_PLANT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_POND, + [DIRECTION_SOUTHEAST] = LOCATION_CAVE, + [DIRECTION_EAST] = LOCATION_NORTHERN_LAKES, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_NORTHERN_SEA, + [DIRECTION_SOUTHWEST] = LOCATION_NORTHERN_ISLES, + }, + }, + [LOCATION_VOLCANO] = + { + .name = "Volcano", + .pos = {0x107, 0xCB}, + .areasIds = {SCORCHED_PLAINS, CRATER, VOLCANIC_PIT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_RELICS, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = LOCATION_TEAM_BASE, + [DIRECTION_NORTH] = LOCATION_WESTERN_FOREST, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = LOCATION_SOUTHERN_SEA, + }, + }, + [LOCATION_DESERT] = + { + .name = "Desert", + .pos = {0x1C4, 0x12D}, + .areasIds = {FURNACE_DESERT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_BADLANDS, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_RELICS] = + { + .name = "Relics", + .pos = {0x131, 0x105}, + .areasIds = {ANCIENT_RELIC, AGED_CHAMBER_AN, AGED_CHAMBER_O_EXCLAIM, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_SOUTH_PLAINS, + [DIRECTION_EAST] = LOCATION_JUNGLE, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_VOLCANO, + [DIRECTION_WEST] = LOCATION_SOUTHERN_SEA, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_SKY] = + { + .name = "Sky", + .pos = {0x2F, 0x15}, + .areasIds = {STRATOS_LOOKOUT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_WESTERN_ISLES, + [DIRECTION_SOUTHEAST] = LOCATION_BEACH, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_NORTHERN_ISLES] = + { + .name = "Northern Isles", + .pos = {0x107, 0x47}, + .areasIds = {LEGENDARY_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = 6, + [DIRECTION_SOUTHEAST] = 9, + [DIRECTION_EAST] = 0xD, + [DIRECTION_NORTHEAST] = 0xF, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = 0x18, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_SOUTHERN_ISLES] = + { + .name = "Southern Isles", + .pos = {0x5D, 0x10C}, + .areasIds = {SOUTHERN_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = LOCATION_SOUTHERN_SEA, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_SOUTHWEST_ISLES, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_SOUTHWEST_ISLES] = + { + .name = "Southwest Isles", + .pos = {0x2D, 0xCB}, + .areasIds = {ENCLOSED_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_SOUTHERN_ISLES, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = LOCATION_WESTERN_ISLES, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_WESTERN_ISLES] = + { + .name = "Western Isles", + .pos = {0x2D, 0x70}, + .areasIds = {FINAL_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_SOUTHWEST_ISLES, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = LOCATION_BEACH, + [DIRECTION_NORTH] = LOCATION_SKY, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_NORTHERN_SEA] = + { + .name = "Northern Sea", + .pos = {0xD0, 0x16}, + .areasIds = {BOUNTIFUL_SEA, SERENE_SEA, DEEP_SEA_CURRENT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_NORTHERN_ISLES, + [DIRECTION_EAST] = LOCATION_RUINS, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = LOCATION_BEACH, + }, + }, + [LOCATION_SOUTHERN_SEA] = + { + .name = "Southern Sea", + .pos = {0xB2, 0x10D}, + .areasIds = {TREASURE_SEA, DEEP_SEA_FLOOR, SEAFLOOR_CAVE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = -1, + [DIRECTION_EAST] = LOCATION_RELICS, + [DIRECTION_NORTHEAST] = LOCATION_VOLCANO, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = -1, + [DIRECTION_WEST] = LOCATION_SOUTHERN_ISLES, + [DIRECTION_SOUTHWEST] = -1, + }, + }, + [LOCATION_BEACH] = + { + .name = "Beach", + .pos = {0x81, 0x42}, + .areasIds = {SHALLOW_BEACH, ICE_FLOE_BEACH, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = -1, + [DIRECTION_SOUTHEAST] = LOCATION_WESTERN_FOREST, + [DIRECTION_EAST] = -1, + [DIRECTION_NORTHEAST] = LOCATION_NORTHERN_SEA, + [DIRECTION_NORTH] = -1, + [DIRECTION_NORTHWEST] = LOCATION_SKY, + [DIRECTION_WEST] = -1, + [DIRECTION_SOUTHWEST] = LOCATION_WESTERN_ISLES, + }, + }, + [LOCATION_TEAM_BASE] = + { + .name = _("$t"), + .pos = {0x163, 0xA1}, + .areasIds = {FRIEND_AREA_NONE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, + .adjacentLocations = { + [DIRECTION_SOUTH] = LOCATION_JUNGLE, + [DIRECTION_SOUTHEAST] = LOCATION_EASTERN_PONDS, + [DIRECTION_EAST] = LOCATION_RIVER, + [DIRECTION_NORTHEAST] = -1, + [DIRECTION_NORTH] = LOCATION_PLAINS, + [DIRECTION_NORTHWEST] = LOCATION_POND, + [DIRECTION_WEST] = LOCATION_WESTERN_FOREST, + [DIRECTION_SOUTHWEST] = LOCATION_VOLCANO, + }, + }, + [LOCATION_UNUSED_28] = DUMMY_LOCATION, + [LOCATION_UNUSED_29] = DUMMY_LOCATION, + [LOCATION_UNUSED_30] = DUMMY_LOCATION, + [LOCATION_UNUSED_31] = DUMMY_LOCATION, + }, + { + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + DUMMY_LOCATION, + } +}; diff --git a/src/debug.c b/src/debug.c index 7c3b310e6..805565f8d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,7 +1,4 @@ -#include -#include -#include "gba/gba.h" -#include "config.h" +#include "global.h" #include "debug.h" extern void Hang(); diff --git a/src/dungeon.c b/src/dungeon.c index 2595455cb..e44686859 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,15 +1,16 @@ #include "global.h" -#include "dungeon.h" -#include "code_800D090.h" -#include "pokemon.h" -#include "moves.h" -#include "random.h" -#include "code_8092334.h" -#include "pokemon_mid.h" -#include "string_format.h" #include "constants/dungeon.h" -#include "constants/type.h" #include "constants/monster.h" +#include "constants/type.h" +#include "code_800D090.h" +#include "code_8092334.h" +#include "dungeon.h" +#include "items.h" +#include "moves.h" +#include "pokemon.h" +#include "pokemon_mid.h" +#include "random.h" +#include "string_format.h" extern const char gUnknown_8108F10[]; extern const char gUnknown_8108F18[]; @@ -42,11 +43,8 @@ extern u8 *gUnknown_8115E28[]; extern u8 *gUnknown_8115E80[]; extern u8 gUnknown_8108F50[]; -void sub_80901D8(DungeonLocation *param_1,DungeonLocation *param_2); -s32 sub_8091E94(s32 a1, s32 a2, s32 a3); // items.c -void sub_8090888(u8 *param_1, u8 *param_2); -bool8 sub_8090820(u16 moveID); -s32 GetItemPossessionCount(u8 id); +static void sub_8090888(u8 *param_1, u8 *param_2); +static bool8 sub_8090820(u16 moveID); const u8 *GetDungeonName1(u8 dungeon) { @@ -204,6 +202,7 @@ static inline void AddNewLine(const u8 *str, u8 *buffer, u8 *newLine) FormatString(str, buffer, newLine, 0); } +// I think this checks if the dungeon HM requirement is met u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bool32 param_5_) { s32 maxPartyMembers, i; @@ -384,7 +383,7 @@ u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bo } } -bool8 sub_8090820(u16 moveID) +static bool8 sub_8090820(u16 moveID) { s32 speciesId, moveIndex; @@ -402,7 +401,7 @@ bool8 sub_8090820(u16 moveID) return FALSE; } -void sub_8090888(u8 *param_1, u8 *param_2) +static void sub_8090888(u8 *param_1, u8 *param_2) { s32 iVar3 = 0; diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index 9dd5ea6b2..b177210cf 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -5,6 +5,7 @@ #include "code_8041AD0.h" #include "code_804267C.h" #include "code_8045A00.h" +#include "code_8066D04.h" #include "dungeon_message.h" #include "code_8077274_1.h" #include "code_807CD9C.h" @@ -32,6 +33,7 @@ #include "status_checks_1.h" #include "trap.h" #include "dungeon_config.h" +#include "dungeon_misc.h" extern u8 gUnknown_202F221; extern u8 gUnknown_202F222; @@ -73,12 +75,10 @@ void HandleGiveItemAction(Entity *); void HandleTakeItemAction(Entity *); void HandleUseItemAction(Entity *); void sub_8066FA4(Entity *); -void HandleSetItemAction(Entity *,bool8); void HandleUnsetItemAction(Entity *,bool8); extern u8 sub_8044B28(void); extern u8 UseAttack(Entity *); void sub_806A1E8(Entity *pokemon); -extern void sub_80694C0(Entity *, s32, s32, u32); bool8 sub_804AE08(DungeonPos *pos); void HandlePickUpAIAction(Entity *pokemon); void HandleThrowItemAIAction(Entity *pokemon); diff --git a/src/dungeon_cutscenes.c b/src/dungeon_cutscenes.c index e7d67616a..8b29baaca 100644 --- a/src/dungeon_cutscenes.c +++ b/src/dungeon_cutscenes.c @@ -18,6 +18,7 @@ #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" +#include "dungeon_misc.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util_1.h" @@ -363,7 +364,6 @@ struct Zapdos2 extern const struct Zapdos1 gUnknown_810744C; extern struct Zapdos2 gUnknown_8107464; -extern void sub_8068FE0(Entity *, u32, u32); extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); diff --git a/src/dungeon_generation.c b/src/dungeon_generation.c index a1559dbf1..a382f6dca 100644 --- a/src/dungeon_generation.c +++ b/src/dungeon_generation.c @@ -1,4 +1,5 @@ #include "global.h" +#include "def_filearchives.h" #include "dungeon_generation.h" #include "file_system.h" #include "tile_types.h" @@ -17,11 +18,10 @@ #include "structs/map.h" #include "structs/str_806B7F8.h" #include "dungeon_config.h" +#include "dungeon_items.h" extern const u8 gUnknown_80F6DCC[]; -extern struct FileArchive gDungeonFileArchive; -extern void AddItemToDungeonAt(DungeonPos *, Item *, u32); extern s32 sub_803DA20(s16 species); extern void sub_8049840(void); extern void sub_80429FC(DungeonPos *r0); diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 0ccc45613..42dacad74 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -26,6 +26,7 @@ #include "math.h" #include "code_80450F8.h" #include "structs/str_item_text.h" +#include "code_803E46C.h" extern SpriteOAM gUnknown_202EDC0; @@ -57,7 +58,6 @@ extern void sub_80855E4(void *); extern void PlaySoundEffect(u32); extern void sub_804178C(u32); extern void sub_804219C(PixelPos *pos); -extern void DungeonRunFrameActions(u32); extern bool8 sub_8045888(Entity *); extern u32 GetRandomFloorItem(u32); diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 804f6c260..a6d676507 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -20,11 +20,13 @@ #include "code_8045A00.h" #include "string_format.h" #include "code_803E46C.h" +#include "code_803E724.h" #include "code_801602C.h" #include "code_800D090.h" #include "trap.h" #include "charge_move.h" #include "dungeon_map_access.h" +#include "dungeon_misc.h" #include "status_checks_1.h" #include "game_options.h" #include "weather.h" @@ -41,6 +43,7 @@ #include "pokemon_3.h" #include "text.h" #include "code_806CD90.h" +#include "code_8066D04.h" #include "code_8044CC8.h" #include "code_801B3C0.h" #include "dungeon_capabilities.h" @@ -58,13 +61,11 @@ #include "structs/struct_sub80095e4.h" #include "structs/str_text.h" -extern void HandleSetItemAction(Entity *,bool8); extern void HandleUnsetItemAction(Entity *,bool8); extern bool8 sub_8048A68(Entity *param_1,Item *item); extern bool8 sub_8048950(Entity *param_1,Item *item); extern bool8 sub_8048B9C(Entity *param_1,Item *item); extern Item *sub_8044D90(Entity *, s32, u32); -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); extern void sub_806A6E8(Entity *); @@ -95,13 +96,10 @@ extern bool8 sub_8071A8C(Entity *pokemon); extern void GetWeatherName(u8 *dst, u8 weatherId); extern bool8 sub_8070F14(Entity * pokemon, s32 direction); extern Entity *sub_80696A8(Entity *a0); -extern u8 sub_806A538(s32); -extern void sub_803EAF0(u32, u8 *); extern void sub_803F508(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); extern void sub_807EC28(bool8); -extern void PlayDungeonCursorSE(u8 param_1); extern const u8 *GetCurrentDungeonName(void); extern Entity *gLeaderPointer; @@ -1637,10 +1635,10 @@ static void PrintOnMainMenu(bool8 printAll) } } -bool8 DungeonGiveNameToRecruitedMon(u8 *a0) +bool8 DungeonGiveNameToRecruitedMon(u8 *name) { s32 r4; - sub_803EAF0(8, a0); + sub_803EAF0(8, name); do { DungeonRunFrameActions(0xE); @@ -1650,7 +1648,7 @@ bool8 DungeonGiveNameToRecruitedMon(u8 *a0) CleanConfirmNameMenu(); DungeonRunFrameActions(0xE); sub_803EAF0(0, NULL); - if (r4 == 3 && *a0 != 0) + if (r4 == 3 && *name != '\0') return TRUE; return FALSE; diff --git a/src/dungeon_map.c b/src/dungeon_map.c index 5de20775c..1465ecbac 100644 --- a/src/dungeon_map.c +++ b/src/dungeon_map.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "def_filearchives.h" #include "dungeon_map.h" #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" @@ -19,7 +20,6 @@ #include "constants/dungeon.h" #include "constants/trap.h" -extern struct FileArchive gDungeonFileArchive; extern DungeonPos gPlayerDotMapPosition; extern s32 gUnknown_202EDD0; diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 85b325ea7..0ec4b24dd 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -1,20 +1,22 @@ #include "global.h" -#include "dungeon_map_access.h" -#include "code_8004AA0.h" #include "constants/walkable_tile.h" -#include "decompress.h" -#include "dungeon_map_access.h" #include "structs/str_dungeon.h" -#include "tile_types.h" +#include "code_8042B34.h" +#include "code_8004AA0.h" +#include "code_8009804.h" +#include "decompress.h" +#include "def_filearchives.h" +#include "dungeon_engine.h" +#include "dungeon_leader.h" +#include "dungeon_map.h" +#include "dungeon_map_access.h" +#include "dungeon_movement.h" +#include "dungeon_util.h" +#include "dungeon_visibility.h" +#include "game_options.h" #include "random.h" #include "text.h" -#include "dungeon_engine.h" -#include "dungeon_movement.h" -#include "dungeon_leader.h" -#include "dungeon_util.h" -#include "code_8009804.h" -#include "game_options.h" -#include "dungeon_visibility.h" +#include "tile_types.h" extern const Tile gOtherOobTile; extern const Tile gWaterOobTile; @@ -25,7 +27,6 @@ extern u8 gUnknown_80F6A1C[]; extern u8 gUnknown_80F6A34[]; extern u8 gUnknown_80F6A40[]; extern u8 gUnknown_8108EC0[]; -extern const struct FileArchive gDungeonFileArchive; extern const s16 gUnknown_80F6A4A[]; extern const s16 gUnknown_80F6C06[]; @@ -36,10 +37,6 @@ EWRAM_DATA Tile gOutOfBoundsTileData = {0}; EWRAM_INIT const Tile *gCurTilesetOobTile = {NULL}; -extern u8 sub_8043CE4(u32); -extern void ShowDungeonMapAtPos(s32, s32); -extern int sprintf(char *, const char *, ...); - const Tile *GetTile(s32 x, s32 y) { if (x >= 0 && y >= 0 && x < DUNGEON_MAX_SIZE_X && y < DUNGEON_MAX_SIZE_Y) diff --git a/src/dungeon_menu_items.c b/src/dungeon_menu_items.c index 848c3cec6..405ebe5da 100644 --- a/src/dungeon_menu_items.c +++ b/src/dungeon_menu_items.c @@ -18,6 +18,7 @@ #include "code_8045A00.h" #include "string_format.h" #include "code_803E46C.h" +#include "code_803E724.h" #include "trap.h" #include "dungeon_map_access.h" #include "status_checks_1.h" @@ -30,7 +31,6 @@ #include "code_801B3C0.h" #include "dungeon_capabilities.h" -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); extern void sub_806A2BC(Entity *a0, u8 a1); @@ -40,21 +40,16 @@ extern Item *sub_8044D90(Entity *, s32, u32); extern bool8 sub_8070F14(Entity * pokemon, s32 direction); bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); extern Entity *sub_80696A8(Entity *a0); -extern u8 sub_806A538(s32); -extern void sub_803EAF0(u32, u8 *); extern void sub_803F508(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); extern void sub_807EC28(bool8); -extern void PlayDungeonCursorSE(u8 param_1); extern u8 *GetDungeonSubMenuItemString(s32 param_1); extern bool8 CanSubMenuItemBeChosen(s32 param_1); extern s32 gDungeonSubMenuItemsCount; extern const u8 gUnknown_8106B50[]; extern void DungeonShowWindows(WindowTemplates *a0, u8 a1); extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3); -extern void AddActionToDungeonSubMenu(u16 param_1, u8 param_2); -extern void SetActionUnusableInDungeonSubMenu(u16 param_1); extern u16 sub_8044DC8(Item *param_1); extern bool8 sub_8046F00(Item *item); extern void sub_8045064(void); @@ -349,7 +344,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1) // Hm... int newAction = sUnknownActionUnk4.actionUseIndex - 0x90; a0Info->action.actionParameters[0].actionUseIndex = newAction; - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); inputAction = 0; break; } @@ -357,7 +352,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1) s32 teamId; if (ShowDungeonToWhichMonMenu(&teamId, WHICH_MENU_ITEMS) != NULL) { a0Info->action.actionParameters[1].actionUseIndex = teamId; - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); inputAction = 0; break; } @@ -365,7 +360,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1) SetLeaderActionToNothing(1); } else { - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); inputAction = 0; break; } diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index ec55f194f..20faefb39 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -17,6 +17,7 @@ #include "code_8045A00.h" #include "string_format.h" #include "code_803E46C.h" +#include "code_803E724.h" #include "status_checks_1.h" #include "dungeon_leader.h" #include "tile_types.h" @@ -28,17 +29,12 @@ #include "code_8044CC8.h" #include "move_util.h" -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void PlayDungeonCursorSE(u8 param_1); extern u8 *GetDungeonSubMenuItemString(s32 param_1); extern bool8 CanSubMenuItemBeChosen(s32 param_1); extern void sub_8045064(void); -extern void sub_803EAF0(u32, u8 *); extern void sub_803E708(s32 a0, s32 a1); -extern void AddActionToDungeonSubMenu(u16 param_1, u8 param_2); -extern void SetActionUnusableInDungeonSubMenu(u16 param_1); extern void DungeonShowWindows(WindowTemplates *a0, u8 a1); extern s32 GetTeamMemberEntityIndex(Entity *pokemon); extern void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3); @@ -712,7 +708,7 @@ static void ShowMovesInfoWindow(Move *moves, s32 firstMoveId, s32 movesCount) } } - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } static const WindowHeader sStatusDescriptionHeader = { @@ -1005,7 +1001,7 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP sChosenMoveSlotId = gDungeonMenu.menuIndex; if (inputAction == 2) { - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); sub_803E708(8, 0x1B); ASM_MATCH_TRICK(sChosenMoveSlotId); ShowMovesInfoWindow(moves, sChosenMoveSlotId, MAX_MON_MOVES); @@ -1050,7 +1046,7 @@ bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBP AddMenuCursorSprite(&gDungeonMenu); DungeonRunFrameActions(0x1b); - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); if (inputAction == 1) continue; if (gDungeonMenu.menuIndex == 1) { diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index abd6c8536..9bbc7d63d 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -7,6 +7,8 @@ #include "text.h" #include "menu_input.h" #include "input.h" +#include "code_803D110.h" +#include "code_803E724.h" #include "code_8044CC8.h" #include "dungeon_action.h" #include "dungeon_util.h" @@ -19,21 +21,16 @@ #include "post_office_guide2.h" #include "dungeon_main.h" #include "dungeon_map.h" +#include "dungeon_music.h" +#include "code_803E46C.h" -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void PlayDungeonCursorSE(u8 param_1); -extern void sub_803EAF0(u32, u8 *); extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void DungeonRunFrameActions(u32 a0); extern void DungeonShowWindows(WindowTemplates *a0, bool8 a1); -extern void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); extern void sub_8045064(void); extern bool8 IsBossFight(void); extern u16 GetLeaderActionId(void); -extern void sub_803E13C(void); -extern void sub_8083AB0(s16 param_0, Entity * target, Entity * entity); extern MenuInputStruct gDungeonMenu; diff --git a/src/dungeon_menu_recruitment.c b/src/dungeon_menu_recruitment.c index d2406bb34..1893604d0 100644 --- a/src/dungeon_menu_recruitment.c +++ b/src/dungeon_menu_recruitment.c @@ -1,5 +1,8 @@ #include "global.h" #include "globaldata.h" +#include "code_800D090.h" +#include "code_803E46C.h" +#include "code_803E724.h" #include "dungeon_menu_recruitment.h" #include "dungeon.h" #include "text.h" @@ -10,19 +13,14 @@ #include "pokemon_3.h" #include "sprite.h" #include "exclusive_pokemon.h" +#include "dungeon_music.h" -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void PlayDungeonCursorSE(u8 param_1); -extern void sub_803EAF0(u32, u8 *); extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void DungeonRunFrameActions(u32 a0); extern void DungeonShowWindows(const WindowTemplates *a0, bool8 a1); -extern void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); extern u16 GetLeaderActionId(void); extern u32 sub_8014140(s32 a0, const void *a1); -extern void sprintfStatic(char *buffer, const char *text, ...); extern u8 sub_806F9BC(s32); extern bool8 sub_80860A8(u8 id); extern bool8 sub_806A564(s32 r0); diff --git a/src/dungeon_menu_stairs.c b/src/dungeon_menu_stairs.c index 182faa68d..57d88d8fb 100644 --- a/src/dungeon_menu_stairs.c +++ b/src/dungeon_menu_stairs.c @@ -1,5 +1,8 @@ #include "global.h" #include "globaldata.h" +#include "code_803E46C.h" +#include "code_803E724.h" +#include "code_8044CC8.h" #include "dungeon_menu_stairs.h" #include "dungeon_menu_team.h" #include "dungeon_menu_moves.h" @@ -8,23 +11,18 @@ #include "text.h" #include "menu_input.h" #include "input.h" -#include "code_8044CC8.h" #include "dungeon_action.h" #include "dungeon_util.h" #include "dungeon_map_access.h" #include "code_8045A00.h" #include "code_8097DD0.h" #include "dungeon_generation.h" +#include "dungeon_music.h" -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void PlayDungeonCursorSE(u8 param_1); -extern void sub_803EAF0(u32, u8 *); extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void DungeonRunFrameActions(u32 a0); extern void DungeonShowWindows(WindowTemplates *a0, bool8 a1); -extern void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); extern void sub_8045064(void); extern u8 GetFloorType(void); @@ -120,7 +118,7 @@ void ShowDungeonStairsMenu(Entity *mon) break; } - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } static void ShowAndPrintOnStairsMenu(DungeonPos *pos, WindowTemplates *windows, WindowHeader *header) @@ -238,6 +236,5 @@ static void ShowStairsDescription(DungeonPos *pos) } } - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } - diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index 387830490..7f4714f45 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -17,10 +17,12 @@ #include "moves.h" #include "items.h" #include "dungeon_music.h" +#include "dungeon_misc.h" #include "dungeon_ai_movement.h" #include "code_8045A00.h" #include "string_format.h" #include "code_803E46C.h" +#include "code_803E724.h" #include "code_801602C.h" #include "code_800D090.h" #include "dungeon_map_access.h" @@ -50,10 +52,8 @@ extern bool8 sub_8048A68(Entity *param_1,Item *item); extern bool8 sub_8048950(Entity *param_1,Item *item); extern bool8 sub_8048B9C(Entity *param_1,Item *item); extern Item *sub_8044D90(Entity *, s32, u32); -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void PlayDungeonCursorSE(u8 param_1); extern void sub_806A6E8(Entity *); extern void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); bool8 sub_807EF48(void); @@ -98,8 +98,6 @@ extern bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4) extern bool8 sub_8070F14(Entity * pokemon, s32 direction); bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); extern Entity *sub_80696A8(Entity *a0); -extern u8 sub_806A538(s32); -extern void sub_803EAF0(u32, u8 *); extern void sub_803F508(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); @@ -110,8 +108,6 @@ extern s32 gDungeonSubMenuItemsCount; extern const u8 gUnknown_8106B50[]; extern void DungeonShowWindows(WindowTemplates *a0, u8 a1); extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3); -extern void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); -extern void SetActionUnusableInDungeonSubMenu(u16 param_1); extern u16 sub_8044DC8(Item *param_1); extern bool8 sub_8046F00(Item *item); extern void sub_8045064(void); @@ -123,7 +119,6 @@ extern u32 sub_8014140(s32 a0, const void *a1); extern char* sub_808E4FC(s32 a1); extern char* sub_808E51C(s32 a1); extern void sub_8045C18(u8 *buffer, Item *item); -extern bool32 sub_8069D18(DungeonPos *a0, Entity *a1); extern u8 gUnknown_202EE00; extern Entity *gLeaderPointer; @@ -1557,7 +1552,7 @@ Entity *ShowDungeonToWhichMonMenu(s32 *teamId, s32 caseId) DungeonRunFrameActions(0x1B); sub_804AA60(); sub_806A2BC(GetLeader(), 0); - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); sub_803E708(4, 0x3E); if (bPress) { return NULL; diff --git a/src/dungeon_menu_tile.c b/src/dungeon_menu_tile.c index 79d5bea00..923a50ad5 100644 --- a/src/dungeon_menu_tile.c +++ b/src/dungeon_menu_tile.c @@ -1,5 +1,7 @@ #include "global.h" #include "globaldata.h" +#include "code_803E46C.h" +#include "code_803E724.h" #include "dungeon_menu_tile.h" #include "dungeon_menu_team.h" #include "dungeon_menu_moves.h" @@ -15,16 +17,12 @@ #include "code_8045A00.h" #include "trap.h" #include "code_8097DD0.h" +#include "dungeon_music.h" -extern void PlayDungeonStartButtonSE(void); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); -extern void PlayDungeonCursorSE(u8 param_1); -extern void sub_803EAF0(u32, u8 *); extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void DungeonRunFrameActions(u32 a0); extern void DungeonShowWindows(WindowTemplates *a0, bool8 a1); -extern void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); extern void sub_8045064(void); extern MenuInputStruct gDungeonMenu; @@ -115,7 +113,7 @@ void ShowDungeonTileMenu(Entity *mon) break; } - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } static void ShowAndPrintOnTileMenu(DungeonPos *pos, WindowTemplates *windows, WindowHeader *header) @@ -237,5 +235,5 @@ static void ShowTileDescription(DungeonPos *pos) } } - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } diff --git a/src/dungeon_message.c b/src/dungeon_message.c index 69220ffc1..041c5ba04 100644 --- a/src/dungeon_message.c +++ b/src/dungeon_message.c @@ -21,6 +21,7 @@ #include "exclusive_pokemon.h" #include "dungeon_leader.h" #include "text.h" +#include "dungeon_music.h" void sub_80526D0(s32 r0); static void PutStringsOnMessageLog(void); @@ -33,14 +34,12 @@ static bool8 sub_8052DC0(Entity *); extern bool8 sub_8045888(Entity *pokemon); extern void sub_805E804(void); -extern void sub_803EAF0(s32, s32); extern void sub_8083E28(void); extern u32 sub_8014140(s32 a0, const void *a1); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); extern void sub_8007334(s32 a0); extern void sub_80087EC(s32 a0, s32 a1, s32 a2, s32 a3, s32 a4); -extern void PlayDungeonCursorSE(u8 param_1); extern u32 gUnknown_202EDD0; extern u8 gUnknown_203B40C; @@ -88,7 +87,7 @@ void sub_8052210(bool8 a0) gDungeon->unk1BDD4.unk1C06C = 0; if (a0 && gUnknown_202EDD0 == 3) { - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); DungeonRunFrameActions(11); } } @@ -233,7 +232,7 @@ void xxx_draw_string_80524F0(void) case 1: if (sub_800EC74()) break; - sub_803EAF0(3, 0); + sub_803EAF0(3, NULL); // fall through case 2: { struct UnkDrawStringStruct sp; @@ -292,7 +291,7 @@ void xxx_draw_string_80524F0(void) if (strPtr->unk1C05E == 0 && strPtr->unk1C064 != 0 && --strPtr->unk1C064 == 0) { strPtr->unk1C06C = 0; - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); sub_8052210(FALSE); } } @@ -343,7 +342,7 @@ void DisplayDungeonMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const u8 sub_8052740(10); } - sub_803EAF0(2, 0); + sub_803EAF0(2, NULL); sub_8052210(FALSE); monPortraitPtr = NULL; @@ -377,10 +376,10 @@ void DisplayDungeonMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const u8 sub_805E804(); LoadDungeonMapPalette(); if (gShowDungeonMap) { - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } else { - sub_803EAF0(1, 0); + sub_803EAF0(1, NULL); } } @@ -496,7 +495,7 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo) } sub_8052740(10); - sub_803EAF0(2, 0); + sub_803EAF0(2, NULL); sub_8052210(FALSE); CreateDialogueBoxAndPortrait(dialogueInfo->str, 0, monPortraitPtr, gUnknown_80F7AEA[dialogueInfo->unk0]); PRINT_STRING_WAIT_PRESS(&chosenMenuIndex); @@ -507,7 +506,7 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo) if (dialogueInfo->unk0 != 1 && dialogueInfo->unk0 != 3) { LoadDungeonMapPalette(); - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); } sub_803E708(8, 9); } @@ -518,7 +517,7 @@ bool32 DisplayDungeonYesNoMessage(struct MonDialogueSpriteInfo *monSpriteInfo, c s32 chosenMenuIndex; sub_8052740(10); - sub_803EAF0(2, 0); + sub_803EAF0(2, NULL); sub_8052210(FALSE); monPortraitPtr = NULL; @@ -553,7 +552,7 @@ bool32 DisplayDungeonYesNoMessage(struct MonDialogueSpriteInfo *monSpriteInfo, c } LoadDungeonMapPalette(); - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); if (chosenMenuIndex == 1) return TRUE; @@ -567,7 +566,7 @@ s32 DisplayDungeonMenuMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const s32 chosenMenuIndex; sub_8052740(10); - sub_803EAF0(2, 0); + sub_803EAF0(2, NULL); sub_8052210(FALSE); monPortraitPtr = NULL; @@ -596,7 +595,7 @@ s32 DisplayDungeonMenuMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const } LoadDungeonMapPalette(); - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); return chosenMenuIndex; } @@ -860,7 +859,7 @@ bool32 DisplayMessageLog(void) MenuInputStructSub menuInput; sub_801317C(&menuInput); - sub_803EAF0(9, 0); + sub_803EAF0(9, NULL); do { DungeonRunFrameActions(13); unkRet = sub_8008D8C(0); @@ -906,7 +905,7 @@ bool32 DisplayMessageLog(void) } } - sub_803EAF0(0, 0); + sub_803EAF0(0, NULL); return TRUE; } diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 792ea3872..311b556a9 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -1,6 +1,7 @@ #include "global.h" #include "globaldata.h" #include "dungeon_misc.h" +#include "dungeon_music.h" #include "structs/str_dungeon.h" #include "dungeon_util.h" #include "dungeon_util_1.h" @@ -45,17 +46,16 @@ #include "position_util.h" #include "dungeon_ai_movement.h" #include "code_803E46C.h" +#include "def_filearchives.h" +#include "code_803D110.h" static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); -extern s32 sprintf(char *, const char *, ...); extern bool8 IsLevelResetTo1(u8 dungeon); extern void xxx_pokemonstruct_index_to_pokemon2_808DE30(void* r0, u32 r1); extern void DeletePokemonDungeonSprite(s32 id); -extern void sub_803E178(void); extern void sub_806C264(s32 teamIndex, EntityInfo *entInfo); -extern void sub_8083AB0(s16 param_0, Entity * target, Entity * entity); extern bool8 sub_806A58C(s16 r0); extern void sub_8084E00(Entity *entity, u8 param_2, u8 param_3); extern void sub_8078084(Entity * pokemon); @@ -88,8 +88,6 @@ extern s32 sub_803DA20(s32 param_1); extern s32 gDungeonFramesCounter; extern void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, DungeonPos *statusOffsets, u32 a3); extern void sub_8005700(DungeonPos *a0, struct axObject *a1); -extern u32 EntityGetStatusSprites(Entity *entity); -extern void UpdateDungeonPokemonSprite(int id, short species, int status, char visible); extern void sub_8042EC8(Entity *a0, s32 a1); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); @@ -98,8 +96,6 @@ extern void ShowWholeRevealedDungeonMap(void); extern void sub_806B678(void); extern void EntityUpdateStatusSprites(Entity *); extern Entity *sub_80696A8(Entity *a0); -extern int sprintf(char *, const char *, ...); -extern const struct FileArchive gDungeonFileArchive; extern u8 *gUnknown_80FE168[]; extern u8 *gUnknown_80FE134[]; @@ -134,7 +130,6 @@ extern DungeonPos gPlayerDotMapPosition; extern DungeonPos gUnknown_202EE0C; extern u8 gUnknown_202F32C; -bool8 sub_806A538(s16 r0); bool8 sub_806A564(s16 r0); static bool8 sub_806A5A4(s16 r0); @@ -704,7 +699,7 @@ void sub_8068FE0(Entity *entity, s32 param_2, Entity *param_3) sub_8045ACC(); } -void sub_80694C0(Entity *target,s32 x,int y,char param_4) +void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4) { Tile *tile; Tile *tile2; @@ -1070,14 +1065,14 @@ void sub_8069844(struct unkStruct_808FF20 *param_1, Entity *target) return; } -u32 sub_8069D18(DungeonPos *pos,Entity *entity) +bool8 sub_8069D18(DungeonPos *pos,Entity *entity) { EntityInfo *info; info = GetEntInfo(entity); - pos->x = (entity->pos).x + gAdjacentTileOffsets[(info->action).direction].x; - pos->y = (entity->pos).y + gAdjacentTileOffsets[(info->action).direction].y; + pos->x = entity->pos.x + gAdjacentTileOffsets[info->action.direction].x; + pos->y = entity->pos.y + gAdjacentTileOffsets[info->action.direction].y; return info->action.direction & 1; } diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 504ba78e1..978263f47 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -40,6 +40,7 @@ #include "code_8041AD0.h" #include "code_800E9E4.h" #include "dungeon_config.h" +#include "code_800ED38.h" extern void sub_80429C8(Entity *r0); extern bool8 sub_8045888(Entity *r0); @@ -2264,7 +2265,6 @@ struct UnkStruct_sub_800E308_1 }; extern s32 sub_800E308(struct UnkStruct_sub_800E308_1 *, DungeonPos *); -extern void sub_800EF64(void); s32 sub_8056564(Entity *entity, DungeonPos *pos, Move *move, s32 r4) { diff --git a/src/dungeon_music.c b/src/dungeon_music.c index 4f6d5ec31..53b3b6a54 100644 --- a/src/dungeon_music.c +++ b/src/dungeon_music.c @@ -1,15 +1,15 @@ #include "global.h" -#include "code_80118A4.h" #include "constants/bg_music.h" -#include "dungeon.h" -#include "music.h" #include "structs/menu.h" #include "structs/str_dungeon.h" +#include "code_80118A4.h" +#include "dungeon.h" #include "dungeon_music.h" #include "dungeon_util.h" +#include "music.h" +#include "status_checks_1.h" #include "text_util.h" - extern MenuInputStruct gDungeonMenu; extern u8 *gUnknown_80FE6F4[]; @@ -19,13 +19,11 @@ extern u8 gUnknown_810AC68; // 0x8 extern u8 gUnknown_810AC64; // 0x8 extern u8 gUnknown_810AC66; // 0x8 -extern void sub_80709C8(u8 *buffer, EntityInfo *entityInfo); - // Dungeon Music Player adds in this flag to tell // the system to fade in rather than immediately playing #define DUNGEON_MUSIC_FADE_IN 0x8000 -void sub_8083AB0(s16 param_0, Entity * target, Entity * entity) +void sub_8083AB0(s16 param_0, Entity *target, Entity *entity) { u8 *defPtr; u8 *attackPtr; @@ -96,53 +94,40 @@ void sub_8083AB0(s16 param_0, Entity * target, Entity * entity) bool8 sub_8083C24(void) { - UnkDungeonGlobal_unk1CE98_sub *temp; + UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98; - temp = &gDungeon->unk1CE98; + if (temp->moveID < 0x226) + return TRUE; - if (temp->moveID < 0x226) { - return TRUE; - } - else { return FALSE; - } } bool8 sub_8083C50(void) { - UnkDungeonGlobal_unk1CE98_sub *temp; + UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98; - temp = &gDungeon->unk1CE98; + if (temp->moveID == 0x227 || temp->moveID == 0x22A || temp->moveID == 0x228) + return TRUE; - if ((temp->moveID == 0x227) || (temp->moveID == 0x22A) || (temp->moveID == 0x228)) { - return TRUE; - } - else { return FALSE; - } } bool8 sub_8083C88(u8 param_1) { - UnkDungeonGlobal_unk1CE98_sub *temp; + UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98; - temp = &gDungeon->unk1CE98; + if ((!HasCheckpoint(gDungeon->unk644.dungeonLocation.id) && (gDungeon->unk644.unk18 != 0 || param_1 != 0)) + || temp->moveID != 0x227) { + return TRUE; + } - if ((!HasCheckpoint(gDungeon->unk644.dungeonLocation.id) && - ((gDungeon->unk644.unk18 != 0) || (param_1 != 0))) || - (temp->moveID != 0x227)) { - return TRUE; - } - else { return FALSE; - } } void PlayDungeonCursorSE(bool8 checkMenuEntriesCount) { - if ((!checkMenuEntriesCount) || (gDungeonMenu.unk1A > 1)) { - PlayFanfareSE(0x12d,MAX_VOLUME); - } + if (!checkMenuEntriesCount || gDungeonMenu.unk1A > 1) + PlayFanfareSE(0x12d,MAX_VOLUME); } void PlayDungeonConfirmationSE(void) diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index 01694763f..97409ddba 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -1,16 +1,17 @@ #include "global.h" #include "globaldata.h" +#include "structs/str_dungeon.h" #include "code_800F958.h" #include "code_80450F8.h" #include "code_8045A00.h" #include "code_805D8C8.h" #include "code_806CD90.h" +#include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_serializer.h" #include "dungeon_util.h" #include "pokemon.h" -#include "structs/str_dungeon.h" extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; @@ -133,9 +134,6 @@ static void WriteWeather(DataSerializer *seri, Weather *src); static Entity* sub_80828E0(s16 id, s16 apparentID, s32 index); static Entity* sub_8082A08(s32 id, s32 apparentID, s32 index); -// These externs are from other files -extern void AddItemToDungeonAt(DungeonPos *, Item *, u32); - void SaveDungeonState(u8 *buffer, u32 bufLen) { DataSerializer seri; diff --git a/src/dungeon_util.c b/src/dungeon_util.c index fc06a04a2..56d64ace0 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -1,20 +1,17 @@ #include "global.h" -#include "dungeon_util.h" - -#include "dungeon_map_access.h" #include "structs/str_dungeon.h" #include "structs/str_traps.h" +#include "code_800F958.h" +#include "code_8041AD0.h" +#include "code_8069E0C.h" +#include "code_807E5AC.h" +#include "dungeon_items.h" +#include "dungeon_map_access.h" +#include "dungeon_util.h" extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; -u32 EntityGetStatusSprites(Entity *entity); -void UpdateDungeonPokemonSprite(int id, short species, int status, char visible); - -void sub_806C51C(Entity *entity); -extern void sub_80462AC(Entity * ,u32, u32, u32, u32); -extern void sub_807FA9C(); - const DungeonPos gAdjacentTileOffsets[] = { {0, 1}, {1, 1}, diff --git a/src/dungeon_util_1.c b/src/dungeon_util_1.c index 158e129fd..47465fbe3 100644 --- a/src/dungeon_util_1.c +++ b/src/dungeon_util_1.c @@ -1,6 +1,6 @@ #include "global.h" #include "dungeon_util_1.h" - +#include "dungeon_misc.h" #include "code_803E46C.h" #include "code_803E668.h" #include "code_80450F8.h" @@ -22,10 +22,6 @@ extern s32 GetCameraYPos(void); extern void sub_803F4A0(u32); extern void sub_803F878(s32, s32); -extern void sub_8068FE0(Entity *, u32, Entity*); -extern void sub_80694C0(Entity *, s32, s32, u32); - - Entity *xxx_call_GetLeader(void) { return GetLeader(); diff --git a/src/file_system.c b/src/file_system.c index c79e6e7fb..32ede7242 100644 --- a/src/file_system.c +++ b/src/file_system.c @@ -2,6 +2,13 @@ #include "decompress.h" #include "file_system.h" +// size: 0x8 +typedef struct UnkFileStruct +{ + /* 0x0 */ u32 unk0; + /* 0x4 */ u32 unk4; +} UnkFileStruct; + EWRAM_DATA u32 gUnknown_202D2A4 = {0}; EWRAM_DATA OpenedFile gFileCache[64] = {0}; @@ -9,9 +16,6 @@ static EWRAM_INIT u32 sFileCacheCursorPosition = {0}; #include "data/file_system.h" -// ??? -extern s32 sprintf(char *, const char *, ...); - UNUSED static void FP48_16_Log(UnkFileStruct *r0, s32 r1) { s32 temp; diff --git a/src/friend_areas_map.c b/src/friend_areas_map.c index 9fd1d79c0..e35bea7e5 100644 --- a/src/friend_areas_map.c +++ b/src/friend_areas_map.c @@ -1,561 +1,44 @@ #include "global.h" #include "globaldata.h" -#include "friend_areas_map.h" -#include "sprite.h" -#include "code_8004AA0.h" -#include "input.h" -#include "text.h" -#include "code_8009804.h" -#include "bg_palette_buffer.h" -#include "string_format.h" -#include "code_800D090.h" -#include "friend_area.h" -#include "bg_control.h" -#include "code_800558C.h" -#include "code_80118A4.h" -#include "code_800C9CC.h" -#include "pokemon.h" -#include "decompress.h" #include "constants/friend_area.h" - -extern u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bool32 param_5_); -extern void sub_801178C(void); -extern void sub_80117C4(void); -extern void PlayCancelSoundEffect(void); -extern void PlayAcceptSoundEffect(void); -extern void PlayCursorUpDownSoundEffect(void); -extern s32 sprintf(char *, const char *, ...); -extern void sub_800CB20(void); -extern void xxx_call_update_bg_sound_input(void); -extern void CopyDungeonName1toBuffer(u8 *buffer, DungeonLocation *dungeonLocation); -extern s32 Atan2_4096(PixelPos *a); -extern void sub_80117AC(void); -extern void sub_8011760(void); +#include "bg_control.h" +#include "bg_palette_buffer.h" +#include "code_8004AA0.h" +#include "code_800558C.h" +#include "code_8009804.h" +#include "code_800C9CC.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "decompress.h" +#include "friend_area.h" +#include "friend_areas_map.h" +#include "friend_areas_map_util.h" +#include "input.h" +#include "math.h" +#include "menu_input.h" +#include "pokemon.h" +#include "sprite.h" +#include "string_format.h" +#include "text.h" EWRAM_INIT struct FriendAreasMap *gFriendAreasMapPtr = NULL; EWRAM_DATA static u8 sCurrDirection = 0; EWRAM_DATA static u8 sHeldDpadCounter = 0; -extern const FileArchive gTitleMenuFileArchive; +#include "data/friend_areas_map.h" -static void MoveToNewLocation(s32 destLocationId, s32 direction, s32 nFrames); +static s32 ChooseLocation_Async(s32 *newLocationId, s32 *newDirection); +static bool8 ChooseAreaInLocation_Async(void); +static void FriendAreasMap_FadeOut_Async(void); static u8 GetChosenDirection(void); -static s32 ChooseLocation(s32 *newLocationId, s32 *newDirection); -static bool8 ChooseAreaInLocation(void); -static void FadeFromFriendAreasMap(void); static void InitMapLocations(u8 startingFriendAreaId); +static void MoveToNewLocation_Async(s32 destLocationId, s32 direction, s32 nFrames); -extern u16 gUnknown_2026E4E; - -#define NO_AREA NUM_FRIEND_AREAS + 5 - - // ななし means 'without name' -#define DUMMY_LOCATION \ -{ \ - .name = _("ななし"), \ - .pos = {0, 0}, \ - .areasIds = {NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, \ - .adjacentLocations = {-1, -1, -1, -1, -1, -1, -1, -1}, \ -} - -// The second set is all dummies, maybe it was used for testing purposes? -static const struct FriendAreaLocationInfo sFriendAreaLocations[2][NUM_FRIEND_AREA_LOCATIONS] = -{ - { - [LOCATION_MOUNTAIN_RANGE] = - { - .name = "Mountain Range", - .pos = {0x1C5, 0x71}, - .areasIds = {MT_DEEPGREEN, MT_CLEFT, MT_MOONVIEW, MT_DISCIPLINE, DARKNESS_RIDGE, RAINBOW_PEAK, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_EASTERN_FOREST, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_MARSH, - [DIRECTION_WEST] = LOCATION_PLAINS, - [DIRECTION_SOUTHWEST] = LOCATION_RIVER, - }, - }, - [LOCATION_GLACIER] = - { - .name = "Glacier", - .pos = {0x1CD, 0x1C}, - .areasIds = {FRIGID_CAVERN, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_NORTHERN_LAKES, - [DIRECTION_SOUTHWEST] = LOCATION_MARSH, - }, - }, - [LOCATION_PLAINS] = - { - .name = "Plains", - .pos = {0x161, 0x78}, - .areasIds = {BEAU_PLAINS, SKY_BLUE_PLAINS, SACRED_FIELD, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_TEAM_BASE, - [DIRECTION_SOUTHEAST] = LOCATION_RIVER, - [DIRECTION_EAST] = 0, - [DIRECTION_NORTHEAST] = LOCATION_MARSH, - [DIRECTION_NORTH] = LOCATION_CAVE, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_POND, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_SOUTH_PLAINS] = - { - .name = "South Plains", - .pos = {0x162, 0x12D}, - .areasIds = {SAFARI, WILD_PLAINS, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = LOCATION_BADLANDS, - [DIRECTION_NORTH] = LOCATION_JUNGLE, - [DIRECTION_NORTHWEST] = LOCATION_RELICS, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_BADLANDS] = - { - .name = "Badlands", - .pos = {0x194, 0x102}, - .areasIds = {RAVAGED_FIELD, MAGNETIC_QUARRY, THUNDER_MEADOW, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_DESERT, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = LOCATION_EASTERN_LAKES, - [DIRECTION_NORTH] = LOCATION_EASTERN_PONDS, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_JUNGLE, - [DIRECTION_SOUTHWEST] = LOCATION_SOUTH_PLAINS, - }, - }, - [LOCATION_EASTERN_FOREST] = - { - .name = "Eastern Forest", - .pos = {0x1C7, 0x9D}, - .areasIds = {MIST_RISE_FOREST, FLYAWAY_FOREST, OVERGROWN_FOREST, ENERGETIC_FOREST, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_EASTERN_LAKES, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = 0, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_RIVER, - [DIRECTION_SOUTHWEST] = LOCATION_EASTERN_PONDS, - }, - }, - [LOCATION_WESTERN_FOREST] = - { - .name = "Western Forest", - .pos = {0x108, 0x9D}, - .areasIds = {MUSHROOM_FOREST, HEALING_FOREST, TRANSFORM_FOREST, SECRETIVE_FOREST, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_VOLCANO, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = LOCATION_TEAM_BASE, - [DIRECTION_NORTHEAST] = LOCATION_POND, - [DIRECTION_NORTH] = LOCATION_NORTHERN_ISLES, - [DIRECTION_NORTHWEST] = LOCATION_BEACH, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_RIVER] = - { - .name = "River", - .pos = {0x197, 0xA0}, - .areasIds = {RUB_A_DUB_RIVER, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_EASTERN_PONDS, - [DIRECTION_SOUTHEAST] = LOCATION_EASTERN_LAKES, - [DIRECTION_EAST] = LOCATION_EASTERN_FOREST, - [DIRECTION_NORTHEAST] = LOCATION_MOUNTAIN_RANGE, - [DIRECTION_NORTH] = LOCATION_MARSH, - [DIRECTION_NORTHWEST] = LOCATION_PLAINS, - [DIRECTION_WEST] = LOCATION_TEAM_BASE, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_EASTERN_PONDS] = - { - .name = "Eastern Ponds", - .pos = {0x198, 0xCF}, - .areasIds = {TADPOLE_POND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_BADLANDS, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = LOCATION_EASTERN_LAKES, - [DIRECTION_NORTHEAST] = LOCATION_EASTERN_FOREST, - [DIRECTION_NORTH] = LOCATION_RIVER, - [DIRECTION_NORTHWEST] = LOCATION_TEAM_BASE, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = LOCATION_JUNGLE, - }, - }, - [LOCATION_POND] = - { - .name = "Pond", - .pos = {0x133, 0x79}, - .areasIds = {TURTLESHELL_POND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_TEAM_BASE, - [DIRECTION_EAST] = LOCATION_PLAINS, - [DIRECTION_NORTHEAST] = LOCATION_CAVE, - [DIRECTION_NORTH] = LOCATION_RUINS, - [DIRECTION_NORTHWEST] = LOCATION_NORTHERN_ISLES, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = LOCATION_WESTERN_FOREST, - }, - }, - [LOCATION_NORTHERN_LAKES] = - { - .name = "Northern Lakes", - .pos = {0x182, 0x1D}, - .areasIds = {MYSTIC_LAKE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_MARSH, - [DIRECTION_EAST] = 1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_RUINS, - [DIRECTION_SOUTHWEST] = LOCATION_CAVE, - }, - }, - [LOCATION_EASTERN_LAKES] = - { - .name = "Eastern Lakes", - .pos = {0x1C6, 0xD0}, - .areasIds = {WATERFALL_LAKE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = LOCATION_EASTERN_FOREST, - [DIRECTION_NORTHWEST] = LOCATION_RIVER, - [DIRECTION_WEST] = LOCATION_EASTERN_PONDS, - [DIRECTION_SOUTHWEST] = LOCATION_BADLANDS, - }, - }, - [LOCATION_MARSH] = - { - .name = "Marsh", - .pos = {0x1A2, 0x46}, - .areasIds = {PEANUT_SWAMP, POISON_SWAMP, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_RIVER, - [DIRECTION_SOUTHEAST] = LOCATION_MOUNTAIN_RANGE, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = 1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_NORTHERN_LAKES, - [DIRECTION_WEST] = LOCATION_CAVE, - [DIRECTION_SOUTHWEST] = LOCATION_PLAINS, - }, - }, - [LOCATION_CAVE] = - { - .name = "Cave", - .pos = {0x160, 0x47}, - .areasIds = {ECHO_CAVE, DRAGON_CAVE, BOULDER_CAVE, CRYPTIC_CAVE, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_PLAINS, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = LOCATION_MARSH, - [DIRECTION_NORTHEAST] = LOCATION_NORTHERN_LAKES, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_RUINS, - [DIRECTION_WEST] = LOCATION_NORTHERN_ISLES, - [DIRECTION_SOUTHWEST] = LOCATION_POND, - }, - }, - [LOCATION_JUNGLE] = - { - .name = "Jungle", - .pos = {0x163, 0x104}, - .areasIds = {JUNGLE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_SOUTH_PLAINS, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = LOCATION_BADLANDS, - [DIRECTION_NORTHEAST] = LOCATION_EASTERN_PONDS, - [DIRECTION_NORTH] = LOCATION_TEAM_BASE, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_RELICS, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_RUINS] = - { - .name = "Ruins", - .pos = {0x136, 0x1C}, - .areasIds = {DECREPIT_LAB, POWER_PLANT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_POND, - [DIRECTION_SOUTHEAST] = LOCATION_CAVE, - [DIRECTION_EAST] = LOCATION_NORTHERN_LAKES, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_NORTHERN_SEA, - [DIRECTION_SOUTHWEST] = LOCATION_NORTHERN_ISLES, - }, - }, - [LOCATION_VOLCANO] = - { - .name = "Volcano", - .pos = {0x107, 0xCB}, - .areasIds = {SCORCHED_PLAINS, CRATER, VOLCANIC_PIT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_RELICS, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = LOCATION_TEAM_BASE, - [DIRECTION_NORTH] = LOCATION_WESTERN_FOREST, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = LOCATION_SOUTHERN_SEA, - }, - }, - [LOCATION_DESERT] = - { - .name = "Desert", - .pos = {0x1C4, 0x12D}, - .areasIds = {FURNACE_DESERT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_BADLANDS, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_RELICS] = - { - .name = "Relics", - .pos = {0x131, 0x105}, - .areasIds = {ANCIENT_RELIC, AGED_CHAMBER_AN, AGED_CHAMBER_O_EXCLAIM, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_SOUTH_PLAINS, - [DIRECTION_EAST] = LOCATION_JUNGLE, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_VOLCANO, - [DIRECTION_WEST] = LOCATION_SOUTHERN_SEA, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_SKY] = - { - .name = "Sky", - .pos = {0x2F, 0x15}, - .areasIds = {STRATOS_LOOKOUT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_WESTERN_ISLES, - [DIRECTION_SOUTHEAST] = LOCATION_BEACH, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_NORTHERN_ISLES] = - { - .name = "Northern Isles", - .pos = {0x107, 0x47}, - .areasIds = {LEGENDARY_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = 6, - [DIRECTION_SOUTHEAST] = 9, - [DIRECTION_EAST] = 0xD, - [DIRECTION_NORTHEAST] = 0xF, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = 0x18, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_SOUTHERN_ISLES] = - { - .name = "Southern Isles", - .pos = {0x5D, 0x10C}, - .areasIds = {SOUTHERN_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = LOCATION_SOUTHERN_SEA, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_SOUTHWEST_ISLES, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_SOUTHWEST_ISLES] = - { - .name = "Southwest Isles", - .pos = {0x2D, 0xCB}, - .areasIds = {ENCLOSED_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_SOUTHERN_ISLES, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = LOCATION_WESTERN_ISLES, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_WESTERN_ISLES] = - { - .name = "Western Isles", - .pos = {0x2D, 0x70}, - .areasIds = {FINAL_ISLAND, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_SOUTHWEST_ISLES, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = LOCATION_BEACH, - [DIRECTION_NORTH] = LOCATION_SKY, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_NORTHERN_SEA] = - { - .name = "Northern Sea", - .pos = {0xD0, 0x16}, - .areasIds = {BOUNTIFUL_SEA, SERENE_SEA, DEEP_SEA_CURRENT, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_NORTHERN_ISLES, - [DIRECTION_EAST] = LOCATION_RUINS, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = LOCATION_BEACH, - }, - }, - [LOCATION_SOUTHERN_SEA] = - { - .name = "Southern Sea", - .pos = {0xB2, 0x10D}, - .areasIds = {TREASURE_SEA, DEEP_SEA_FLOOR, SEAFLOOR_CAVE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = -1, - [DIRECTION_EAST] = LOCATION_RELICS, - [DIRECTION_NORTHEAST] = LOCATION_VOLCANO, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = -1, - [DIRECTION_WEST] = LOCATION_SOUTHERN_ISLES, - [DIRECTION_SOUTHWEST] = -1, - }, - }, - [LOCATION_BEACH] = - { - .name = "Beach", - .pos = {0x81, 0x42}, - .areasIds = {SHALLOW_BEACH, ICE_FLOE_BEACH, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = -1, - [DIRECTION_SOUTHEAST] = LOCATION_WESTERN_FOREST, - [DIRECTION_EAST] = -1, - [DIRECTION_NORTHEAST] = LOCATION_NORTHERN_SEA, - [DIRECTION_NORTH] = -1, - [DIRECTION_NORTHWEST] = LOCATION_SKY, - [DIRECTION_WEST] = -1, - [DIRECTION_SOUTHWEST] = LOCATION_WESTERN_ISLES, - }, - }, - [LOCATION_TEAM_BASE] = - { - .name = _("$t"), - .pos = {0x163, 0xA1}, - .areasIds = {FRIEND_AREA_NONE, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA, NO_AREA}, - .adjacentLocations = { - [DIRECTION_SOUTH] = LOCATION_JUNGLE, - [DIRECTION_SOUTHEAST] = LOCATION_EASTERN_PONDS, - [DIRECTION_EAST] = LOCATION_RIVER, - [DIRECTION_NORTHEAST] = -1, - [DIRECTION_NORTH] = LOCATION_PLAINS, - [DIRECTION_NORTHWEST] = LOCATION_POND, - [DIRECTION_WEST] = LOCATION_WESTERN_FOREST, - [DIRECTION_SOUTHWEST] = LOCATION_VOLCANO, - }, - }, - [LOCATION_UNUSED_28] = DUMMY_LOCATION, - [LOCATION_UNUSED_29] = DUMMY_LOCATION, - [LOCATION_UNUSED_30] = DUMMY_LOCATION, - [LOCATION_UNUSED_31] = DUMMY_LOCATION, - }, - { - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - DUMMY_LOCATION, - } -}; - -void ShowFriendAreasMap(struct struct_unk800F990 *param_1) +void ShowFriendAreasMap_Async(struct struct_unk800F990 *param_1) { gFriendAreasMapPtr = param_1->friendAreasMapPtr; gUnknown_2026E4E = 0x1010; - sub_80095CC(0,0x14); + sub_80095CC(0, 20); UpdateFadeInTile(2); gFriendAreasMapPtr->locationsInfo = sFriendAreaLocations[0]; gFriendAreasMapPtr->unk4A2C = param_1->unk5; @@ -567,16 +50,17 @@ void ShowFriendAreasMap(struct struct_unk800F990 *param_1) sCurrDirection = 0xff; sHeldDpadCounter = 0; sub_8011760(); - while (1) { + + while (TRUE) { s32 newLocationId = 0; s32 newDirection = 0; - s32 inputRet = ChooseLocation(&newLocationId, &newDirection); + s32 inputRet = ChooseLocation_Async(&newLocationId, &newDirection); if (inputRet == 1) { - MoveToNewLocation(newLocationId, newDirection, 50); + MoveToNewLocation_Async(newLocationId, newDirection, 50); } else if (inputRet == 2) { - if (!ChooseAreaInLocation()) + if (!ChooseAreaInLocation_Async()) continue; param_1->unkC = gFriendAreasMapPtr->chosenFriendAreaId; break; @@ -586,16 +70,16 @@ void ShowFriendAreasMap(struct struct_unk800F990 *param_1) param_1->unkC = 0; break; } - MoveToNewLocation(gFriendAreasMapPtr->locationIdOnBPress, DIRECTION_SOUTH, 10); + MoveToNewLocation_Async(gFriendAreasMapPtr->locationIdOnBPress, DIRECTION_SOUTH, 10); } } - FadeFromFriendAreasMap(); + FriendAreasMap_FadeOut_Async(); FriendAreasMap_CloseFiles(); nullsub_16(); } -static s32 ChooseLocation(s32 *newLocationId, s32 *newDirection) +static s32 ChooseLocation_Async(s32 *newLocationId, s32 *newDirection) { s32 ret = 0; @@ -636,16 +120,18 @@ static s32 ChooseLocation(s32 *newLocationId, s32 *newDirection) return ret; } -static bool8 ChooseAreaInLocation(void) +static bool8 ChooseAreaInLocation_Async(void) { bool8 ret = FALSE; FriendAreasMap_PrintAvailableSubAreas(); - while (1) { + + while (TRUE) { MenuInputStruct *menuPtr = &gFriendAreasMapPtr->menu; AddMenuCursorSprite(menuPtr); FriendAreasMap_RunFrameActions(); + if (gRealInputs.repeated & DPAD_DOWN) { MoveMenuCursorDown(menuPtr); PlayCursorUpDownSoundEffect(); @@ -670,12 +156,13 @@ static bool8 ChooseAreaInLocation(void) return ret; } -static void FadeFromFriendAreasMap(void) +static void FriendAreasMap_FadeOut_Async(void) { s32 i; FriendAreasMap_HideTextWindowAndArrows(); sub_80117AC(); + for (i = 0; i < 60; i++) { gFriendAreasMapPtr->brightness -= 2; FriendAreasMap_RunFrameActions(); @@ -884,7 +371,7 @@ static u8 GetChosenDirection(void) return 0xFF; } -static void MoveToNewLocation(s32 destLocationId, s32 direction, s32 nFrames) +static void MoveToNewLocation_Async(s32 destLocationId, s32 direction, s32 nFrames) { s32 i, currLocationId; DungeonPos startingPos, dstPos; diff --git a/src/friend_areas_map_util.c b/src/friend_areas_map_util.c index 031996473..64d76f578 100644 --- a/src/friend_areas_map_util.c +++ b/src/friend_areas_map_util.c @@ -1,30 +1,27 @@ #include "global.h" #include "globaldata.h" -#include "friend_areas_map.h" -#include "sprite.h" -#include "code_8004AA0.h" -#include "input.h" -#include "text.h" -#include "code_8009804.h" -#include "bg_palette_buffer.h" -#include "string_format.h" -#include "code_800D090.h" -#include "friend_area.h" -#include "bg_control.h" -#include "code_800558C.h" -#include "game_options.h" -#include "play_time.h" -#include "code_80118A4.h" -#include "code_800C9CC.h" -#include "pokemon.h" -#include "decompress.h" #include "constants/direction.h" - -extern void sub_800CB20(void); -extern void xxx_call_update_bg_sound_input(void); -extern s32 sprintf(char *, const char *, ...); - -extern const FileArchive gTitleMenuFileArchive; +#include "bg_control.h" +#include "bg_palette_buffer.h" +#include "code_8004AA0.h" +#include "code_800558C.h" +#include "code_8009804.h" +#include "code_800C9CC.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "decompress.h" +#include "def_filearchives.h" +#include "friend_area.h" +#include "friend_areas_map.h" +#include "friend_areas_map_util.h" +#include "game_options.h" +#include "input.h" +#include "menu_input.h" +#include "play_time.h" +#include "pokemon.h" +#include "sprite.h" +#include "string_format.h" +#include "text.h" static inline bool8 CheckAxFlag8000(axdata *ptr) { @@ -58,7 +55,7 @@ static const DungeonPos gUnknown_80D40C4[] = void FriendAreasMap_InitGfx(void) { - u8 filename[0xC]; + u8 filename[12]; s32 i, size; PokemonStruct1 *pokeStruct = GetPlayerPokemonStruct(); @@ -383,7 +380,7 @@ void FriendAreasMap_RunFrameActions(void) sub_8005180(); sub_80060EC(); IncrementPlayTime(gPlayTimeRef); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); CopySpritesToOam(); sub_8005304(); @@ -394,4 +391,3 @@ void FriendAreasMap_RunFrameActions(void) sub_8011860(); ResetSprites(FALSE); } - diff --git a/src/friend_rescue.c b/src/friend_rescue.c index 75426d02e..f7dac8798 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "code_800D090.h" #include "code_80118A4.h" #include "string_format.h" #include "code_801B3C0.h" @@ -307,7 +308,6 @@ extern u32 sub_8023CE8(void); extern bool8 sub_8031D70(u32 mailIndex, s32); extern u32 GetDungeonTeamRankPts(DungeonLocation *, u32); -extern void sprintfStatic(char *buffer, const char *text, ...); u32 CreateFriendRescueMenu(void) { diff --git a/src/ground_main.c b/src/ground_main.c index 889b308d2..4be5ba8d7 100644 --- a/src/ground_main.c +++ b/src/ground_main.c @@ -92,7 +92,7 @@ void sub_8098BDC(void) sub_8099744(); sub_8011860(); IncrementPlayTime(gPlayTimeRef); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); nullsub_120(); sub_80A5E70(); diff --git a/src/ground_map.c b/src/ground_map.c index d12193986..fd8b6c72a 100644 --- a/src/ground_map.c +++ b/src/ground_map.c @@ -111,6 +111,7 @@ static void GroundMap_GetFirstStationScript(ScriptInfoSmall *script, s16 r1) GroundMap_GetStationScript(script, r1, 0, 0); } +// overlay_0000.bin::02155DD0 void GroundMap_ExecuteEvent(s16 scriptIndex, u32 param_2) { ScriptInfoSmall script; @@ -120,7 +121,7 @@ void GroundMap_ExecuteEvent(s16 scriptIndex, u32 param_2) index_s32 = scriptIndex; iVar2 = param_2; - Log(0,gUnknown_8117594, index_s32, iVar2); // "GroundMap ExecuteEvent %3d %d + Log(0, gUnknown_8117594, index_s32, iVar2); // "GroundMap ExecuteEvent %3d %d GetFunctionScript(NULL, &script, index_s32); if (iVar2 != 0) script.state = 5; diff --git a/src/ground_map_2.c b/src/ground_map_2.c index 4e3732615..67af26f74 100644 --- a/src/ground_map_2.c +++ b/src/ground_map_2.c @@ -1,11 +1,10 @@ #include "global.h" -#include "memory.h" +#include "code_800558C.h" #include "debug.h" #include "event_flag.h" #include "ground_map.h" #include "ground_map_2.h" - -extern u16 gUnknown_2026E4E; +#include "memory.h" IWRAM_INIT unkStruct_3001B74 *gUnknown_3001B74 = {NULL}; IWRAM_INIT unkStruct_3001B70 *gUnknown_3001B78 = {NULL}; diff --git a/src/ground_script_2.c b/src/ground_script_2.c index 229b1c653..c973ff38f 100644 --- a/src/ground_script_2.c +++ b/src/ground_script_2.c @@ -1,5 +1,5 @@ -#include "debug.h" #include "global.h" +#include "debug.h" #include "event_flag.h" #include "ground_map_1.h" #include "ground_script.h" diff --git a/src/ground_sprite.c b/src/ground_sprite.c index 029fec8c4..19887845b 100644 --- a/src/ground_sprite.c +++ b/src/ground_sprite.c @@ -3,6 +3,7 @@ #include "code_800558C.h" #include "code_800DAC0.h" #include "debug.h" +#include "def_filearchives.h" #include "file_system.h" #include "ground_map_1.h" #include "ground_sprite.h" @@ -22,11 +23,6 @@ EWRAM_DATA u32 gUnknown_2039DD4 = {0}; EWRAM_INIT OpenedFile *gUnknown_203B4B4 = {NULL}; -// dungeon_sbin.s -extern const struct FileArchive gDungeonFileArchive; -// monster_sbin.s -// ornament_sbin.s -extern const struct FileArchive gOrnamentFileArchive; // data_8115F5C.s extern const u8 gUnknown_81177CC[]; extern const u8 gUnknown_81177D8[]; diff --git a/src/items.c b/src/items.c index f45e6e3eb..dfdd5dc1a 100644 --- a/src/items.c +++ b/src/items.c @@ -2,6 +2,7 @@ #include "code_8097DD0.h" #include "constants/colors.h" #include "constants/type.h" +#include "def_filearchives.h" #include "items.h" #include "moves.h" #include "random.h" @@ -11,9 +12,7 @@ #include "text_util.h" #include "text.h" #include "string_format.h" -#include -extern struct FileArchive gSystemFileArchive; extern const char gItemParaFileName[]; extern const char gUnknown_8109794[]; extern const char gUnknown_81097A4[]; @@ -33,7 +32,6 @@ EWRAM_DATA ItemDataEntry *gItemParametersData = {0}; EWRAM_DATA TeamInventory gTeamInventory = {0}; EWRAM_INIT TeamInventory *gTeamInventoryRef = {NULL}; -extern u8 sub_8091E94(s32 a1, s32 a2, s32 a3); extern void SortKecleonShopInventory(); bool8 AddKecleonWareItem(u8); diff --git a/src/libisagbprn.c b/src/libisagbprn.c index e0e979e95..158b0455d 100644 --- a/src/libisagbprn.c +++ b/src/libisagbprn.c @@ -1,7 +1,4 @@ -#include -#include -#include "gba/gba.h" -#include "config.h" +#include "global.h" #define AGB_PRINT_FLUSH_ADDR 0x9FE209D #define AGB_PRINT_STRUCT_ADDR 0x9FE20F8 diff --git a/src/load_screen.c b/src/load_screen.c index acc17b55f..cc25b37e2 100644 --- a/src/load_screen.c +++ b/src/load_screen.c @@ -21,8 +21,7 @@ #include "save.h" #include "text_util.h" #include "text.h" - -extern const struct FileArchive gTitleMenuFileArchive; +#include "def_filearchives.h" struct LoadScreen { diff --git a/src/main_loops.c b/src/main_loops.c index e0d9d5b4d..66e14a2bf 100644 --- a/src/main_loops.c +++ b/src/main_loops.c @@ -19,6 +19,7 @@ #include "code_80A26CC.h" #include "cpu.h" #include "debug.h" +#include "def_filearchives.h" #include "event_flag.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -48,7 +49,6 @@ typedef struct unkTalkTable s16 species; } unkTalkTable; -extern u16 gUnknown_2026E4E; static EWRAM_DATA s32 sTitleBrightness = 0; // NDS=210FAC0 // TODO: I think there's a 2nd s32 here for the bottom screen TitleBrightness. @@ -69,10 +69,10 @@ static void NDS_LoadOverlay_GroundMain(); static u32 sub_80009D0(u32 param_1); /* static */ // TODO: Uncomment void sub_80011E8(u8 *param_1); -static void xxx_dungeon_8001340(UnkStruct_RunDungeon *r0); +static void LoadAndRunDungeon_Async(UnkStruct_RunDungeon *r0); /* static */ // TODO: Uncomment u32 xxx_script_related_8001334(u32 r0); -static void xxx_update_stuff(u32 r0); +static void MainLoops_RunFrameActions(u32 unused); extern u32 xxx_script_related_8098468(u32); @@ -143,13 +143,13 @@ void GameLoop(void) SetBGPaletteBufferColorRGB(i, &((RGB*)sTitlePaletteFile->data)[i], sTitleBrightness, NULL); } - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); } if (tmp3) { PrepareSavePakRead(); while ((tmp3 = ReadSavePak())) - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); FinishReadSavePak(); } @@ -171,13 +171,13 @@ void GameLoop(void) } if (!flag) { - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); continue; } } SetUpMenu(); - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); nextMenu = UpdateMenu(); CleanUpMenu(); @@ -200,7 +200,7 @@ void GameLoop(void) SetBGPaletteBufferColorRGB(i, &((RGB*)sTitlePaletteFile->data)[i], sTitleBrightness, NULL); } - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); } CloseFile(sTitlePaletteFile); @@ -233,7 +233,7 @@ void GameLoop(void) } // arm9.bin::0200E02C -static void xxx_update_stuff(u32 r0) +static void MainLoops_RunFrameActions(u32 unused) { DrawDialogueBoxString(); sub_8005838(NULL, 0); @@ -241,7 +241,7 @@ static void xxx_update_stuff(u32 r0) sub_8005180(); sub_80060EC(); sub_8011860(); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); CopySpritesToOam(); sub_8005304(); @@ -375,7 +375,7 @@ s32 sub_8000728(void) // arm9.bin::0200DB58 /* static */ // TODO: uncomment -void QuickSave(u32 mode) +void QuickSave_Async(u32 mode) { s32 saveStatus; s32 counter; @@ -401,13 +401,13 @@ void QuickSave(u32 mode) CreateDialogueBoxAndPortrait(sSaveTextQuicksaving, 0, 0, 0x20); while (TRUE) { - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); if (saveStatus < SAVE_COMPLETED) { sub_8014490(); - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); ShowWindows(NULL, TRUE, TRUE); - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); break; } @@ -489,7 +489,7 @@ void QuickSave(u32 mode) // arm9.bin::0200D998 /*static*/ // TODO: Uncomment -void sub_80008C0(u32 errorKind) +void sub_80008C0_Async(u32 errorKind) { s32 saveStatus = SAVE_COMPLETED; s32 counter = 0; @@ -533,7 +533,7 @@ void sub_80008C0(u32 errorKind) } while (TRUE) { - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); if (saveStatus < 0) break; @@ -567,9 +567,9 @@ void sub_80008C0(u32 errorKind) } sub_8014490(); - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); ShowWindows(NULL ,TRUE, TRUE); - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); } // https://decomp.me/scratch/dlKUt (66.34%) @@ -613,7 +613,7 @@ static u32 sub_80009D0(u32 param_1) " bl SetScriptVarValue\n" " bl sub_8096BD0\n" " movs r0, 0x3\n" -" bl QuickSave\n" +" bl QuickSave_Async\n" " b _08000A3A\n" "_08000A24:\n" " movs r3, 0x1\n" @@ -656,7 +656,7 @@ static u32 sub_80009D0(u32 param_1) " mov r1, sp\n" " strb r0, [r1, 0x5]\n" " mov r0, sp\n" -" bl ShowFriendAreasMap\n" +" bl ShowFriendAreasMap_Async\n" " ldr r0, [sp, 0x8]\n" " bl MemoryFree\n" " mov r0, sp\n" @@ -764,7 +764,7 @@ static u32 sub_80009D0(u32 param_1) " add r4, sp, 0x168\n" " str r0, [r4]\n" " adds r0, r5, 0\n" -" bl ShowWorldMap\n" +" bl ShowWorldMap_Async\n" " ldr r0, [r4]\n" " bl MemoryFree\n" " add r0, sp, 0x16C\n" @@ -1037,7 +1037,7 @@ static u32 sub_80009D0(u32 param_1) " movs r7, 0xB\n" " bl sub_8096BD0\n" " movs r0, 0x1\n" -" bl sub_80008C0\n" +" bl sub_80008C0_Async\n" " b _08000D98\n" "_08000D8E:\n" " cmp r5, 0x1\n" @@ -1099,7 +1099,7 @@ static u32 sub_80009D0(u32 param_1) " cmp r6, 0x3F\n" " bne _08000E0C\n" " movs r0, 0\n" -" bl QuickSave\n" +" bl QuickSave_Async\n" " b _08000E1E\n" "_08000E0C:\n" " adds r0, r6, 0\n" @@ -1108,7 +1108,7 @@ static u32 sub_80009D0(u32 param_1) " cmp r0, 0\n" " bne _08000E1E\n" " movs r0, 0\n" -" bl QuickSave\n" +" bl QuickSave_Async\n" "_08000E1E:\n" " ldr r0, _08000E70\n" " movs r4, 0x1\n" @@ -1120,7 +1120,7 @@ static u32 sub_80009D0(u32 param_1) " add r0, sp, 0x174\n" " bl sub_80011E8\n" " adds r0, r5, 0\n" -" bl SaveLoadRelated_8000EDC\n" +" bl LoadAndRunQuickSaveDungeon_Async\n" " add r4, sp, 0x1EC\n" " movs r0, 0\n" " ldrsh r1, [r4, r0]\n" @@ -1201,8 +1201,11 @@ static u32 sub_80009D0(u32 param_1) " bx r1"); } +// This func is probably used for running the dungeon in general (and updating RNG mechanics), not just quicksave. +// More documentation needed to be sure +// It'd also be cool to see what happens if a quicksave load fails and the dungeon is skipped entirely /* static */ // TODO: Uncomment -void SaveLoadRelated_8000EDC(UnkStruct_RunDungeon *param_1) +void LoadAndRunQuickSaveDungeon_Async(UnkStruct_RunDungeon *param_1) { u8 quickSaveValid; s32 quickSaveStatus; @@ -1216,7 +1219,7 @@ void SaveLoadRelated_8000EDC(UnkStruct_RunDungeon *param_1) sub_8014144(); sub_8043D50(&local_1c, &local_18); - param_1->unk74 = MemoryAlloc(local_1c, 7); // size: 0x4800 + param_1->unk74 = MemoryAlloc(local_1c, 7); // size: 0x4800 param_1->unk78 = MemoryAlloc(local_18, 7); // size: sizeof(Dungeon) if (param_1->unk8) { @@ -1225,7 +1228,7 @@ void SaveLoadRelated_8000EDC(UnkStruct_RunDungeon *param_1) while (TRUE) { if (!ReadQuickSave()) break; - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); } quickSaveValid = IsQuickSaveValid(); @@ -1246,7 +1249,7 @@ void SaveLoadRelated_8000EDC(UnkStruct_RunDungeon *param_1) } if (quickSaveValid) { - xxx_dungeon_8001340(param_1); + LoadAndRunDungeon_Async(param_1); sub_8099648(); SetWindowBGColor(); sub_8099690(0); @@ -1274,7 +1277,7 @@ void SaveLoadRelated_8000EDC(UnkStruct_RunDungeon *param_1) MemoryFree(param_1->unk74); } - xxx_update_stuff(0); + MainLoops_RunFrameActions(0); } FinishQuickSaveWrite(); } @@ -1436,6 +1439,7 @@ static void NDS_LoadOverlay_GroundMain() static void nullsub_2(UnkStruct_RunDungeon *r0) { // (not a nullsub in the NDS) + // Probably loads the dungeon overlay? } // arm9.bin::0200CAD0 @@ -1446,10 +1450,10 @@ u32 xxx_script_related_8001334(u32 r0) } // arm9.bin::0200CA1C -static void xxx_dungeon_8001340(UnkStruct_RunDungeon *r0) +static void LoadAndRunDungeon_Async(UnkStruct_RunDungeon *r0) { nullsub_2(r0); - RunDungeon(r0); + RunDungeon_Async(r0); NDS_LoadOverlay_GroundMain(); } diff --git a/src/math.c b/src/math.c index c1d730efc..2ac98872d 100644 --- a/src/math.c +++ b/src/math.c @@ -3,7 +3,6 @@ #include "math.h" #include "data/math.h" -#include "structs/str_position.h" static void F48_16_UDiv(s48_16 *, s48_16 *, s48_16 *); static void F48_16_UMul(s48_16 *, s48_16 *, s48_16 *); diff --git a/src/move_actions.c b/src/move_actions.c index 1047ef507..c1e561fba 100644 --- a/src/move_actions.c +++ b/src/move_actions.c @@ -33,6 +33,7 @@ #include "tile_types.h" #include "weather.h" #include "dungeon_config.h" +#include "dungeon_misc.h" extern const u8 *const gUnknown_80FD350; extern const u8 *const gUnknown_80FD370; @@ -111,7 +112,6 @@ extern u32 gUnknown_202F21C; extern bool8 gUnknown_202F220; extern void sub_806A5B8(Entity *entity); -extern void sub_80694C0(Entity *, s32, s32, u32); void sub_8075900(Entity *pokemon, u8 r1); extern u8 sub_8044B28(void); extern void sub_807EC28(bool8); diff --git a/src/moves.c b/src/moves.c index c6e946551..26ffa0f9d 100644 --- a/src/moves.c +++ b/src/moves.c @@ -1,12 +1,13 @@ #include "global.h" -#include "code_800D090.h" -#include "string_format.h" -#include "code_8092334.h" -#include "code_8097DD0.h" #include "constants/colors.h" #include "constants/monster.h" +#include "code_800D090.h" +#include "code_8092334.h" +#include "code_8097DD0.h" +#include "def_filearchives.h" #include "memory.h" #include "moves.h" +#include "string_format.h" #include "text_util.h" #include "text.h" @@ -33,9 +34,6 @@ extern const u8* gPtrTypeText; // "Type" extern const u8 *gRangeNames[]; extern const u8* gUnknown_810CF00; -// system_sbin.s -extern const struct FileArchive gSystemFileArchive; - static void CopyAndResetMove(Move *, Move *); static bool8 sub_80933D8(s32, Move *); static s32 unk_FindMarkedMoveInLinkedSequences44(Move [MAX_MON_MOVES][MAX_MON_MOVES]); diff --git a/src/other_menus1.c b/src/other_menus1.c index 60001409f..5abc97426 100644 --- a/src/other_menus1.c +++ b/src/other_menus1.c @@ -209,7 +209,7 @@ void sub_80373C4(void) { sub_8005838(NULL, 0); sub_80060EC(); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); TransferBGPaletteBuffer(); xxx_call_update_bg_vram(); diff --git a/src/pokemon.c b/src/pokemon.c index f7855d4af..0c2690687 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1,21 +1,20 @@ #include "global.h" #include "globaldata.h" -#include "pokemon.h" -#include "code_800D090.h" -#include "code_8097DD0.h" #include "constants/colors.h" #include "constants/monster.h" #include "constants/tactic.h" +#include "code_800D090.h" +#include "code_8097DD0.h" +#include "cpu.h" #include "decompress.h" +#include "def_filearchives.h" +#include "exclusive_pokemon.h" #include "file_system.h" +#include "friend_area.h" +#include "moves.h" +#include "pokemon.h" #include "pokemon_3.h" #include "text_util.h" -#include "moves.h" -#include "friend_area.h" -#include "exclusive_pokemon.h" -#include "cpu.h" - -extern struct FileArchive gSystemFileArchive; static EWRAM_DATA MonsterDataEntry *gMonsterParameters = {0}; static EWRAM_DATA OpenedFile *gMonsterParametersFile = {0}; @@ -47,7 +46,6 @@ extern s16 gBlastBurnIQReq; // 0x14d extern s16 gVoltTackleIQReq; // 0x14d extern char* gFormattedStatusNames[]; -extern int sprintf(char *, const char *, ...); extern u32 ReturnIntFromChar(u8 r0); extern void xxx_pokemon2_to_pokemonstruct_808DF44(PokemonStruct1*, PokemonStruct2*); @@ -1311,8 +1309,6 @@ char* sub_808E51C(s32 a1) return statuses[0]->desc; } -extern const struct FileArchive gDungeonFileArchive; - struct ShadowSpriteFlags { u32 shape; u32 size; diff --git a/src/quick_save_read.c b/src/quick_save_read.c index f9fff3920..c186528c9 100644 --- a/src/quick_save_read.c +++ b/src/quick_save_read.c @@ -5,7 +5,7 @@ #include "quick_save_read.h" #include "save.h" -static EWRAM_INIT QuickSaveRead *sQuickSaveRead = {NULL}; +static EWRAM_INIT QuickSaveRead *sQuickSaveRead = { NULL }; #include "data/quick_save_read.h" @@ -58,7 +58,7 @@ bool8 IsQuickSaveValid(void) void FinishQuickSaveRead(void) { - if (sQuickSaveRead != NULL){ + if (sQuickSaveRead != NULL) { MemoryFree(sQuickSaveRead); sQuickSaveRead = 0; } diff --git a/src/reg_control.c b/src/reg_control.c index d490cc591..92dc4ea9b 100644 --- a/src/reg_control.c +++ b/src/reg_control.c @@ -30,15 +30,15 @@ EWRAM_INIT s16 gUnknown_203B0AE = {-1}; EWRAM_INIT s16 gUnknown_203B0B0 = {-1}; // Written to but never read EWRAM_INIT s16 gUnknown_203B0B2 = {-1}; // Written to but never read -// code_800D090.c +// code_800D090.s extern void sub_800D6AC(void); extern void sub_800D7D0(void); static void UpdateBGControlRegisters(void); -void VBlankIntr(void); -void VCountIntr(void); -void UnusedIntrFunc(void); -void Timer3Intr(void); +static void VBlankIntr(void); +static void VCountIntr(void); +static void UnusedIntrFunc(void); +static void Timer3Intr(void); static const IntrCallback sInitialIntrTable[6] = { @@ -106,7 +106,7 @@ bool8 DisableInterrupts(void) return TRUE; } -bool8 sub_800B650(void) +UNUSED static bool8 sub_800B650(void) { if (!gInterruptsEnabled) return FALSE; @@ -117,7 +117,7 @@ bool8 sub_800B650(void) return TRUE; } -void AckInterrupt(u16 flag) +static void AckInterrupt(u16 flag) { if (!gInterruptsEnabled) return; @@ -154,8 +154,7 @@ IntrCallback SetInterruptCallback(u32 index, IntrCallback new_callback) return old_callback; } -// Unused? -s32 sub_800B720(s32 a0, IntrCallback a1) +UNUSED static s32 sub_800B720(s32 a0, IntrCallback a1) { s32 r2; s32 i; @@ -200,8 +199,7 @@ s32 sub_800B720(s32 a0, IntrCallback a1) return gUnknown_203B0A8; } -// Unused? -void sub_800B850(s16 a0) +UNUSED static void sub_800B850(s16 a0) { s32 r2; unkStruct_202D648 *r4; @@ -232,11 +230,11 @@ void sub_800B850(s16 a0) EnableInterrupts(); } -void UnusedIntrFunc(void) +static void UnusedIntrFunc(void) { } -void VBlankIntr(void) +static void VBlankIntr(void) { s32 index; @@ -256,13 +254,13 @@ void VBlankIntr(void) gUnknown_203B0B2 = -1; REG_DISPSTAT = DISPSTAT_VBLANK_INTR | DISPSTAT_VCOUNT_INTR; - if (gUnknown_203B099 == 0) + if (!gUnknown_203B099) UpdateSound(); AckInterrupt(INTR_FLAG_VBLANK); } -void VCountIntr(void) +static void VCountIntr(void) { s32 sVar2 = (vs16) REG_VCOUNT; @@ -286,6 +284,7 @@ void VCountIntr(void) AckInterrupt(INTR_FLAG_VCOUNT); } +// This func waits for vblank and may update sound/input void sub_800BA5C(void) { if (gUnknown_203B09A) { @@ -324,7 +323,7 @@ void xxx_update_bg_sound_input(void) } } -void Timer3Intr(void) +static void Timer3Intr(void) { if (gIntrCallbacks[4]) gIntrCallbacks[4](); diff --git a/src/status_actions.c b/src/status_actions.c index 1f714d7de..d702569e7 100644 --- a/src/status_actions.c +++ b/src/status_actions.c @@ -3,6 +3,7 @@ #include "charge_move.h" #include "code_8045A00.h" #include "dungeon_message.h" +#include "dungeon_move.h" #include "code_806CD90.h" #include "code_8077274_1.h" #include "code_807CD9C.h" @@ -17,6 +18,7 @@ #include "dungeon_engine.h" #include "dungeon_items.h" #include "dungeon_map_access.h" +#include "dungeon_misc.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" #include "dungeon_visibility.h" @@ -38,7 +40,6 @@ extern void sub_807F43C(Entity *, Entity *); extern void HandleOneRoomOrb(Entity *, Entity *); extern u32 GetRandomFloorItem(u32); extern void sub_80464C8(Entity *, DungeonPos *, Item *); -extern void sub_8068FE0(Entity *, u32, Entity *r2); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); extern void sub_807FC3C(DungeonPos *, u32, u32); extern void sub_8042A64(DungeonPos *); @@ -58,8 +59,6 @@ extern void sub_806BB6C(Entity *, s32); extern void HandleSwitcherOrb(Entity *, Entity *, u32); extern u32 HandleDamagingMove(Entity *, Entity *, Move *, s24_8, u32); extern void sub_806A6E8(Entity *); -extern u8 sub_8069D18(DungeonPos *); -extern u8 sub_804AD34(DungeonPos *); // TODO include dungeon_ai.h when SqueezedStatusTarget is figured out extern void LowerDefenseStageTarget(Entity *, Entity *, s32, s32, u8, bool8); @@ -113,7 +112,6 @@ extern u8 *gUnknown_80FD3F0[]; extern u32 gUnknown_8106A50; extern u8 *gUnknown_80FDCA0[]; extern u8 *gUnknown_80FDC9C[]; -extern u32 gUnknown_202F224; extern u32 gUnknown_8106A8C[]; extern u8 *gUnknown_80FC5A8[]; extern u8 *gPtrForecastPreventsTypeSwitchMessage[]; @@ -603,9 +601,9 @@ bool8 StruggleMoveAction(Entity * pokemon, Entity * target, Move * move, s32 par bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; - if (RollSecondaryEffect(pokemon,0) != 0) { + if (RollSecondaryEffect(pokemon, 0) != 0) { entityHP = GetEntInfo(pokemon)->maxHPStat; if (entityHP < 0) { entityHP = entityHP + 3; @@ -614,40 +612,39 @@ bool8 StruggleMoveAction(Entity * pokemon, Entity * target, Move * move, s32 par if (newHP < 1) { newHP = 1; } - sub_806F370(pokemon,pokemon,newHP,0,0,0,sub_8057600(move,param_4),0,1,0); + sub_806F370(pokemon, pokemon, newHP, 0, 0, 0, sub_8057600(move, param_4), 0, 1, 0); } } return flag; } -bool8 RockSmashMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +// overlay_0005.bin::0216AF44 +bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { DungeonPos pos; bool8 flag = FALSE; - if (sub_8069D18(&pos) != 0) { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD430); // Can't use that diagonally! + if (sub_8069D18(&pos, target)) { + TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FD430); // Can't use that diagonally! } else { - ASM_MATCH_TRICK(target); flag = sub_804AD34(&pos); - if (flag) { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD3F0); // It dug the wall in front! - } - else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD40C); // Can't use that here! - } + if (flag) + TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FD3F0); // It dug the wall in front! + else + TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FD40C); // Can't use that here! } + return flag; } -bool8 sub_805BA44(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 sub_805BA44(Entity *pokemon, Entity *target, Move *move, s32 param_4) { sub_807D3CC(pokemon); return TRUE; } -bool8 ThiefAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) +bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { EntityInfo *pokemonInfo1; EntityInfo *pokemonInfo2; diff --git a/src/text.c b/src/text.c index 12ab3d8b5..4224739bb 100644 --- a/src/text.c +++ b/src/text.c @@ -1,13 +1,14 @@ #include "global.h" #include "globaldata.h" +#include "structs/str_text.h" #include "bg_palette_buffer.h" -#include "text.h" -#include "decompress.h" #include "code_8009804.h" #include "code_800558C.h" #include "cpu.h" -#include "structs/str_text.h" +#include "decompress.h" +#include "def_filearchives.h" #include "file_system.h" +#include "text.h" struct CharMapStruct { @@ -15,9 +16,6 @@ struct CharMapStruct struct unkChar *unk4; }; -// system_sbin.s -extern const struct FileArchive gSystemFileArchive; - EWRAM_DATA Window gWindows[MAX_WINDOWS] = {0}; EWRAM_DATA static struct CharMapStruct *sCharmaps[2] = {NULL}; EWRAM_DATA static s16 sCharacterSpacing = 0; @@ -264,13 +262,16 @@ void SetCharacterMask(int a0) sTextShadowMask = retval; } +// arm9.bin::020052E4 void ShowWindows(const WindowTemplates *winTemplates, bool8 a1, bool8 a2) { DungeonPos positionModifier = {0, 0}; ShowWindowsInternal(winTemplates, a1, a2, &positionModifier); } -// https://decomp.me/scratch/xF5Y1 +// red https://decomp.me/scratch/EN6n0 (includes removed code from pmd-blue) +// blue https://decomp.me/scratch/1y9BG +// arm9.bin::020051B0 static void ShowWindowsInternal(const WindowTemplates *winTemplates, bool8 a1, bool8 a2, DungeonPos *positionModifier) { s32 i; diff --git a/src/tile_types.c b/src/tile_types.c index 3ee74f822..de3da2c1c 100644 --- a/src/tile_types.c +++ b/src/tile_types.c @@ -2,6 +2,7 @@ #include "tile_types.h" #include "code_806CD90.h" #include "structs/str_dungeon.h" +#include "dungeon_map.h" #include "dungeon_map_access.h" #include "dungeon_util.h" @@ -84,7 +85,6 @@ const u8 gDungeonWaterType[76] = { DUNGEON_WATER_TYPE_NONE, }; -extern void ShowDungeonMapAtPos(s32, s32); extern void sub_8049BB0(s32, s32); void sub_8042A14(DungeonPos *); diff --git a/src/trap.c b/src/trap.c index 963be294b..c511807fa 100644 --- a/src/trap.c +++ b/src/trap.c @@ -14,6 +14,7 @@ #include "constants/type.h" #include "dungeon_engine.h" #include "dungeon_items.h" +#include "dungeon_map.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" @@ -26,6 +27,7 @@ #include "structs/str_dungeon.h" #include "structs/str_806B7F8.h" #include "dungeon_config.h" +#include "dungeon_misc.h" extern u8 *gTrapNames[]; extern u8 *gUnknown_80FC5FC[]; @@ -56,14 +58,11 @@ extern u8 *gUnknown_80FED08[]; extern u32 gUnknown_8106A4C; extern u32 gUnknown_8106A50; -void sub_806A9B4(Entity *, u32); -void ShowDungeonMapAtPos(s32, s32); s16 sub_803D970(u32); bool8 sub_806AA0C(s32, s32); void sub_80421EC(DungeonPos *, u32); bool8 sub_8045888(Entity *); u8 GetFloorType(void); -void sub_8068FE0(Entity *, u32, Entity *); void sub_8045BF8(u8 *, Item *); void DealDamageToEntity(Entity *,s16,u32,u32); void sub_806F480(Entity *, u32); diff --git a/src/world_map.c b/src/world_map.c index 67f3d3cb4..e4a39f00e 100644 --- a/src/world_map.c +++ b/src/world_map.c @@ -1,41 +1,31 @@ #include "global.h" #include "globaldata.h" -#include "world_map.h" -#include "sprite.h" -#include "code_8004AA0.h" -#include "input.h" -#include "text.h" -#include "code_8009804.h" -#include "bg_palette_buffer.h" -#include "string_format.h" -#include "code_800D090.h" -#include "friend_area.h" #include "bg_control.h" +#include "bg_palette_buffer.h" +#include "code_8004AA0.h" #include "code_800558C.h" -#include "code_80118A4.h" +#include "code_8009804.h" #include "code_800C9CC.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "decompress.h" +#include "def_filearchives.h" +#include "dungeon.h" +#include "friend_area.h" #include "game_options.h" +#include "input.h" +#include "math.h" #include "play_time.h" #include "pokemon.h" -#include "decompress.h" +#include "sprite.h" +#include "string_format.h" +#include "text.h" +#include "world_map.h" -extern const FileArchive gTitleMenuFileArchive; - -extern u16 gUnknown_2026E4E; - -extern u32 sub_809034C(u8 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bool32 param_5_); extern void sub_801178C(void); extern void sub_80117C4(void); -extern void PlayCancelSoundEffect(void); -extern void PlayAcceptSoundEffect(void); -extern void PlayCursorUpDownSoundEffect(void); -extern s32 sprintf(char *, const char *, ...); -extern void sub_800CB20(void); -extern void xxx_call_update_bg_sound_input(void); +extern void WaitForNextFrameAndAdvanceRNG(void); extern void CopyDungeonName1toBuffer(u8 *buffer, DungeonLocation *dungeonLocation); -extern s32 Atan2_4096(PixelPos *a); -extern void sub_80117AC(void); -extern void sub_8011760(void); static EWRAM_INIT struct WorldMap *sWorldMapPtr = NULL; static EWRAM_INIT WindowTemplates sWorldMapWindows = { @@ -63,21 +53,21 @@ static void ClearWindows(void); static void AnimateSprites(bool8 a0); static bool8 FadeScreen(void); static void nullsub_24(void); -static void RunFrameActions(void); +static void WorldMap_RunFrameActions(void); static void UpdateMonSpritePosition(void); static void UpdateBg(void); static void sub_8010494(struct UnkStruct_sub_8010494 *r9); -static void AnimateMonPath(u8 id1, u8 id2); +static void AnimateMonPath_Async(u8 id1, u8 id2); static void sub_801059C(void); -static bool8 ShowYesNoWindow(u8 *str); -static void PrintDialogueMessage(const u8 *text); -static void FadeFromWorldMap(void); +static bool8 PlayerEnterDungeonPrompt_Async(u8 *str); +static void PrintDialogueMessage_Async(const u8 *text); +static void FadeFromWorldMap_Async(void); static void CloseFiles(void); static void PrintDungeonName(DungeonLocation *dungLocation); // Code is very similar to the functions in friend_areas_map_util.c -void ShowWorldMap(struct UnkStruct_sub_8010268 *r5) +void ShowWorldMap_Async(struct UnkStruct_sub_8010268 *r5) { s32 i, speciesId, var; u8 text[1000]; @@ -89,14 +79,17 @@ void ShowWorldMap(struct UnkStruct_sub_8010268 *r5) sub_801059C(); sub_8010494(&r5->unk4); sub_801178C(); - for (i = 0; i < 60; i++) { - RunFrameActions(); - } - AnimateMonPath(r5->unk4.unk0.id, r5->unk4.unk4.id); + + // 60 frame delay + for (i = 0; i < 60; i++) + WorldMap_RunFrameActions(); + + AnimateMonPath_Async(r5->unk4.unk0.id, r5->unk4.unk4.id); PrintDungeonName(&r5->unk4.unk4); - for (i = 0; i < 60; i++) { - RunFrameActions(); - } + + // 60 frame delay + for (i = 0; i < 60; i++) + WorldMap_RunFrameActions(); if (r5->unk4.unk10) { speciesId = r5->unk4.unk1C; @@ -111,11 +104,11 @@ void ShowWorldMap(struct UnkStruct_sub_8010268 *r5) r5->unkB4 = 1; } else if (var == 1) { - PrintDialogueMessage(text); + PrintDialogueMessage_Async(text); r5->unkB4 = 0; } else if (var == 2) { - if (ShowYesNoWindow(text)) { + if (PlayerEnterDungeonPrompt_Async(text)) { r5->unkB4 = 1; } else { @@ -123,7 +116,7 @@ void ShowWorldMap(struct UnkStruct_sub_8010268 *r5) } } - FadeFromWorldMap(); + FadeFromWorldMap_Async(); CloseFiles(); nullsub_16(); } @@ -197,7 +190,7 @@ static const DungeonPos gDungeonCoordinates[] = }; // Heavy math function. -static void AnimateMonPath(u8 id1, u8 id2) +static void AnimateMonPath_Async(u8 id1, u8 id2) { s32 i, valMax, r3; PixelPos pixelPos; @@ -222,7 +215,7 @@ static void AnimateMonPath(u8 id1, u8 id2) sWorldMapPtr->monSpritePos.y = ((((pos2.y - pos1.y) * (i << 8)) / valMax) / 256) + pos1.y; UpdateMonSpritePosition(); UpdateBg(); - RunFrameActions(); + WorldMap_RunFrameActions(); if (gRealInputs.pressed & A_BUTTON) break; if (gRealInputs.pressed & B_BUTTON) @@ -232,7 +225,7 @@ static void AnimateMonPath(u8 id1, u8 id2) sWorldMapPtr->monSpritePos = pos2; UpdateMonSpritePosition(); UpdateBg(); - RunFrameActions(); + WorldMap_RunFrameActions(); } static void sub_8010494(struct UnkStruct_sub_8010494 *r9) @@ -273,7 +266,7 @@ static char *const gUnknown_80D4014[] = "wmp2mcc", "wmp2cani", "wmp2pal", - "wmp2fon1", + "wmp2fon1", // Maybe blue uses this? }; static void sub_801059C(void) @@ -385,7 +378,7 @@ static void nullsub_24(void) } -static void FadeFromWorldMap(void) +static void FadeFromWorldMap_Async(void) { s32 i; @@ -393,7 +386,7 @@ static void FadeFromWorldMap(void) sub_80117C4(); for (i = 0; i < 60; i++) { sWorldMapPtr->brightness -= 2; - RunFrameActions(); + WorldMap_RunFrameActions(); } } @@ -402,7 +395,7 @@ static void ClearWindows(void) ShowWindows(NULL, TRUE, TRUE); } -static void RunFrameActions(void) +static void WorldMap_RunFrameActions(void) { SetBG2RegOffsets(sWorldMapPtr->bgPos.x, sWorldMapPtr->bgPos.y); SetBG3RegOffsets(sWorldMapPtr->bgPos.x, sWorldMapPtr->bgPos.y); @@ -413,7 +406,7 @@ static void RunFrameActions(void) sub_8005180(); sub_80060EC(); IncrementPlayTime(gPlayTimeRef); - sub_800CB20(); + WaitForNextFrameAndAdvanceRNG(); LoadBufferedInputs(); CopySpritesToOam(); sub_8005304(); @@ -512,42 +505,44 @@ static void PrintDungeonName(DungeonLocation *dungLocation) sub_80073E0(0); } -static void PrintDialogueMessage(const u8 *text) +static void PrintDialogueMessage_Async(const u8 *text) { s32 i, a; + CreateMenuDialogueBoxAndPortrait(text, NULL, 0, NULL, NULL, 3, 0, NULL, 0x301); + do { DrawDialogueBoxString(); - RunFrameActions(); + WorldMap_RunFrameActions(); } while (sub_80144A4(&a) != 0); - for (i = 0; i < 10; i++) { - RunFrameActions(); - } + for (i = 0; i < 10; i++) + WorldMap_RunFrameActions(); } -static bool8 ShowYesNoWindow(u8 *str) +static bool8 PlayerEnterDungeonPrompt_Async(u8 *str) { - s32 r2, i; + s32 height, i; MenuInputStruct menuInput; - r2 = 0; + height = 0; for (i = 0; str[i] != '\0'; i++) { - if (str[i] == '\n') { - r2 += 12; - } + if (str[i] == '\n') + height += 12; } - r2 += 11; - r2 /= 8; + height += 11; + height /= 8; - sWorldMapWindows.id[0].pos.y = 19 - r2; - sWorldMapWindows.id[0].unk10 = r2; - sWorldMapWindows.id[0].height = r2; - sWorldMapWindows.id[1].pos.y = 14 - r2; + sWorldMapWindows.id[0].pos.y = 19 - height; + sWorldMapWindows.id[0].unk10 = height; + sWorldMapWindows.id[0].height = height; + sWorldMapWindows.id[1].pos.y = 14 - height; ShowWindows(&sWorldMapWindows, TRUE, TRUE); + sub_80073B8(0); PrintFormattedStringOnWindow(4, 0, str, 0, '\0'); sub_80073E0(0); + sub_80073B8(1); PrintFormattedStringOnWindow(10, 0, "Yes", 1, '\0'); PrintFormattedStringOnWindow(10, 12, "No", 1, '\0'); @@ -569,9 +564,11 @@ static bool8 ShowYesNoWindow(u8 *str) menuInput.unk8.y = 8; sub_80137B0(&menuInput, 24); sub_801317C(&menuInput.unk28); - while (1) { + + while (TRUE) { AddMenuCursorSprite(&menuInput); - RunFrameActions(); + WorldMap_RunFrameActions(); + if (gRealInputs.repeated & DPAD_DOWN) { MoveMenuCursorDown(&menuInput); PlayCursorUpDownSoundEffect(); @@ -586,12 +583,9 @@ static bool8 ShowYesNoWindow(u8 *str) } } - if (menuInput.menuIndex == 0) { - return TRUE; - } - else { - return FALSE; - } + if (menuInput.menuIndex == 0) + return TRUE; // Yes + return FALSE; } static UNUSED void GetDungeonCoords(u8 id, DungeonPos *pos) @@ -599,4 +593,3 @@ static UNUSED void GetDungeonCoords(u8 id, DungeonPos *pos) pos->x = gDungeonCoordinates[id].x; pos->y = gDungeonCoordinates[id].y; } - diff --git a/sym_ewram.txt b/sym_ewram.txt index 2c18c4f95..3d71fa257 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -67,11 +67,11 @@ gUnknown_202DCF8: /* 202DCF8 (sub_80001E8 - sub_800D9B8) */ .include "src/rescue_password_menu.o" .space 0x2 -gDungeonNameBannerPalette: /* 202EC88 (ShowDungeonNameBanner - xxx_dungeon_8042F6C) */ +gDungeonNameBannerPalette: /* 202EC88 (ShowDungeonNameBanner_Async - xxx_dungeon_8042F6C) */ .space 0x4 -gDungeonNameBannerFontFile: /* 202EC8C (ShowDungeonNameBanner - sub_803DEC8) */ +gDungeonNameBannerFontFile: /* 202EC8C (ShowDungeonNameBanner_Async - sub_803DEC8) */ .space 0x4 -gDungeonNameBannerFont: /* 202EC90 (ShowDungeonNameBanner - sub_803DEC8) */ +gDungeonNameBannerFont: /* 202EC90 (ShowDungeonNameBanner_Async - sub_803DEC8) */ .space 0x4 gUnknown_202EC94: /* 202EC94 (sub_803DF60 - sub_803ECE0) */ From 0886d6367621af044c84034afac6f10bc48fd8c7 Mon Sep 17 00:00:00 2001 From: Kermalis <29823718+Kermalis@users.noreply.github.com> Date: Tue, 18 Mar 2025 01:30:17 -0400 Subject: [PATCH 2/2] Fix SHIT --- src/ground_script.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ground_script.c b/src/ground_script.c index 5a22751df..bc0729a7b 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -155,7 +155,6 @@ s32 GetScriptVarValue(u8 *localVarBuf, s32 varId); s32 GetScriptVarArrayValue(u8 *localVarBuf, s32 varId, s32 idx); void SetScriptVarValue(u8 *localVarBuf, s32 varId, s32 val); void SetScriptVarArrayValue(u8 *localVarBuf, s32 varId, s32 idx, s32 val); -u32 sub_809034C(s32 dungeonIndex, s32 speciesId_, u8 *buffer, bool32 param_4_, bool32 param_5_); unkStruct_203B480 * GetMailatIndex(u8 index); u8 sub_80990EC(struct unkStruct_20398C8 *param_1, s32 param_2);