From fdcef19d85b5e2e66662beef13296712df523aac Mon Sep 17 00:00:00 2001 From: Kermalis <29823718+Kermalis@users.noreply.github.com> Date: Wed, 20 Sep 2023 22:26:35 -0400 Subject: [PATCH] Split+data code_8023144/code_80227B8 --- asm/code_801EE10_1.s | 154 ---- asm/code_8023144.s | 382 -------- data/data_80DC464.s | 188 ---- include/adventure_log.h | 2 +- include/charge_move.h | 2 +- include/code_80130A8.h | 2 +- include/code_801B3C0.h | 4 +- include/code_801B60C.h | 2 +- include/code_801BEEC.h | 2 +- include/code_801C244.h | 2 +- include/code_801C620.h | 4 +- include/code_801C8C4.h | 2 +- include/code_801D014.h | 2 +- include/code_801D9E4.h | 2 +- include/code_801EE10.h | 2 +- include/code_80227B8.h | 36 + include/code_8023144.h | 38 +- include/code_8024458.h | 2 +- include/code_80521D0.h | 2 +- include/code_806CD90.h | 2 +- include/code_80869E4.h | 2 +- include/code_8094F88.h | 2 +- include/code_8097670.h | 2 +- include/code_8097DD0.h | 2 +- include/constants/input.h | 7 +- include/constants/item.h | 2 + include/constants/mailbox.h | 4 +- include/constants/monster.h | 2 +- include/constants/move.h | 36 - include/credits1.h | 2 +- include/debug_menu1.h | 2 +- include/debug_menu2.h | 2 +- include/debug_menu3.h | 2 +- include/debug_menu4.h | 2 +- include/dungeon.h | 2 +- include/dungeon_action.h | 2 +- include/dungeon_ai.h | 2 +- include/dungeon_ai_attack.h | 2 +- include/dungeon_ai_item_weight.h | 2 +- include/dungeon_ai_items.h | 4 +- include/dungeon_ai_leader.h | 2 +- include/dungeon_ai_movement.h | 2 +- include/dungeon_ai_targeting.h | 2 +- include/dungeon_capabilities.h | 2 +- include/dungeon_items.h | 2 +- include/dungeon_leader.h | 2 +- include/dungeon_map_access.h | 2 +- include/dungeon_movement.h | 2 +- include/dungeon_pokemon_attributes.h | 2 +- include/dungeon_pokemon_sprites.h | 2 +- include/dungeon_range.h | 2 +- include/dungeon_util.h | 4 +- include/dungeon_util_1.h | 2 +- include/dungeon_visibility.h | 2 +- include/felicity_bank.h | 2 +- include/friend_area_action_menu.h | 2 +- include/gulpin_shop.h | 2 +- include/gulpin_shop_801FB50.h | 2 +- include/items.h | 87 +- include/kangaskhan_storage1.h | 2 +- include/kangaskhan_storage2.h | 2 +- include/kecleon_bros1.h | 2 +- include/kecleon_bros2.h | 2 +- include/kecleon_bros3.h | 2 +- include/kecleon_bros4.h | 2 +- include/luminous_cave.h | 2 +- include/mailbox.h | 2 +- include/main_menu1.h | 2 +- include/main_menu2.h | 2 +- include/makuhita_dojo1.h | 2 +- include/makuhita_dojo2.h | 2 +- include/menu.h | 2 +- include/menu_input.h | 2 +- include/move_util.h | 2 +- include/moves.h | 2 +- include/other_menus1.h | 2 +- include/party_list_menu.h | 2 +- include/personality_test.h | 2 +- include/pokemon.h | 163 +--- include/position_util.h | 2 +- include/post_office_guide2.h | 2 +- include/rescue_password_menu.h | 2 +- include/save.h | 11 +- include/sprite.h | 2 +- include/status.h | 2 +- include/status_actions.h | 2 +- include/status_checks.h | 2 +- include/status_checks_1.h | 2 +- include/{ => structs}/dungeon_entity.h | 6 +- include/{ => structs}/map.h | 4 +- .../str_dungeon.h} | 14 +- include/structs/str_items.h | 88 ++ include/structs/str_moves.h | 42 + include/structs/str_pokemon.h | 167 ++++ .../{position.h => structs/str_position.h} | 6 +- include/{text.h => structs/str_text.h} | 6 +- include/{ => structs}/subStruct_203B240.h | 8 +- include/targeting.h | 2 +- include/targeting_flags.h | 2 +- include/text1.h | 2 +- include/text2.h | 2 +- include/tile_types.h | 2 +- include/trade_items_menu.h | 2 +- include/trap.h | 2 +- include/type_effectiveness.h | 2 +- include/weather.h | 2 +- include/wigglytuff_shop1.h | 2 +- include/wigglytuff_shop2.h | 2 +- include/wigglytuff_shop3.h | 2 +- include/wonder_mail.h | 2 +- include/wonder_mail_2_1.h | 2 +- include/wonder_mail_3.h | 2 +- ld_script.txt | 7 +- src/code_801D014.c | 2 +- src/code_801EE10_mid.c | 8 +- src/code_80227B8.c | 852 ++++++++++++++++++ src/code_8023144.c | 702 +++++++-------- src/code_8023144_pre.c | 140 --- src/code_8023868.c | 2 +- src/code_8031D70.c | 2 +- src/code_8040094.c | 4 +- src/code_8041AD0.c | 30 +- src/code_80428A0.c | 4 +- src/code_8045A00.c | 4 +- src/code_8048480.c | 6 +- src/code_8057824.c | 6 +- src/code_8057824_1.c | 4 +- src/code_805A120.c | 4 +- src/code_805D8C8.c | 4 +- src/code_8069E0C.c | 4 +- src/code_806CD90.c | 2 +- src/code_806E8B0.c | 2 +- src/code_8073CF0.c | 2 +- src/code_8077274_1.c | 4 +- src/code_807CD9C.c | 2 +- src/code_807E5AC.c | 2 +- src/code_808417C.c | 2 +- src/code_80848F0.c | 2 +- src/code_80869E4.c | 2 +- src/code_8086A3C.c | 4 +- src/code_809447C.c | 2 +- src/code_80958E8.c | 4 +- src/data/code_80227B8.h | 90 ++ src/data/code_8023144.h | 23 + src/dungeon_action.c | 4 +- src/dungeon_ai.c | 4 +- src/dungeon_ai_attack.c | 2 +- src/dungeon_ai_items.c | 6 +- src/dungeon_ai_movement.c | 4 +- src/dungeon_ai_targeting.c | 4 +- src/dungeon_capabilities.c | 2 +- src/dungeon_engine.c | 4 +- src/dungeon_items.c | 2 +- src/dungeon_leader.c | 2 +- src/dungeon_map_access.c | 2 +- src/dungeon_map_access_1.c | 2 +- src/dungeon_movement.c | 4 +- src/dungeon_music.c | 2 +- src/dungeon_pokemon_attributes.c | 2 +- src/dungeon_range.c | 4 +- src/dungeon_util.c | 2 +- src/dungeon_util_1.c | 2 +- src/exclusive_pokemon.c | 4 +- src/items.c | 2 +- src/move_checks.c | 2 +- src/move_effects_target.c | 4 +- src/move_util.c | 2 +- src/other_menus1.c | 2 +- src/other_menus2.c | 2 +- src/party_list_menu.c | 3 +- src/pokemon_3.c | 6 +- src/pokemon_mid.c | 2 +- src/rescue_password_menu.c | 2 +- src/status.c | 4 +- src/status_actions.c | 4 +- src/status_checks_1.c | 2 +- src/tile_types.c | 2 +- src/trap.c | 2 +- src/type_effectiveness.c | 2 +- src/weather.c | 2 +- src/wigglytuff_shop2.c | 4 +- src/wigglytuff_shop3.c | 4 +- sym_ewram2.txt | 14 +- sym_iwram.txt | 4 +- 184 files changed, 1862 insertions(+), 1834 deletions(-) delete mode 100644 asm/code_801EE10_1.s delete mode 100644 asm/code_8023144.s delete mode 100644 data/data_80DC464.s create mode 100644 include/code_80227B8.h rename include/{ => structs}/dungeon_entity.h (99%) rename include/{ => structs}/map.h (95%) rename include/{dungeon_global_data.h => structs/str_dungeon.h} (97%) create mode 100644 include/structs/str_items.h create mode 100644 include/structs/str_moves.h create mode 100644 include/structs/str_pokemon.h rename include/{position.h => structs/str_position.h} (68%) rename include/{text.h => structs/str_text.h} (94%) rename include/{ => structs}/subStruct_203B240.h (55%) create mode 100644 src/code_80227B8.c delete mode 100644 src/code_8023144_pre.c create mode 100644 src/data/code_80227B8.h create mode 100644 src/data/code_8023144.h diff --git a/asm/code_801EE10_1.s b/asm/code_801EE10_1.s deleted file mode 100644 index 7d5c77ecd..000000000 --- a/asm/code_801EE10_1.s +++ /dev/null @@ -1,154 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_8023758 -sub_8023758: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - ldr r3, _080237DC - ldr r2, [r3] - ldr r1, [r2, 0x8] - lsls r0, r1, 1 - adds r0, 0xA - adds r2, r0 - mov r9, r2 - movs r2, 0 - subs r1, 0x1 - cmp r2, r1 - bge _080237CC -_08023778: - mov r5, r9 - ldr r0, [r3] - ldr r0, [r0, 0x8] - subs r7, r0, 0x1 - adds r0, r2, 0x1 - mov r8, r0 - cmp r7, r2 - ble _080237BE -_08023788: - subs r6, r5, 0x2 - movs r1, 0 - ldrsh r0, [r6, r1] - movs r1, 0x1 - str r2, [sp] - bl GetAlphabetParentNo - adds r4, r0, 0 - movs r1, 0 - ldrsh r0, [r5, r1] - movs r1, 0x1 - bl GetAlphabetParentNo - lsls r4, 16 - lsls r0, 16 - ldr r2, [sp] - cmp r4, r0 - ble _080237B6 - movs r0, 0 - ldrsh r1, [r5, r0] - ldrh r0, [r6] - strh r0, [r5] - strh r1, [r6] -_080237B6: - adds r5, r6, 0 - subs r7, 0x1 - cmp r7, r2 - bgt _08023788 -_080237BE: - mov r2, r8 - ldr r3, _080237DC - ldr r0, [r3] - ldr r0, [r0, 0x8] - subs r0, 0x1 - cmp r2, r0 - blt _08023778 -_080237CC: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_080237DC: .4byte gUnknown_3001B5C - thumb_func_end sub_8023758 - - thumb_func_start sub_80237E0 -sub_80237E0: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - ldr r3, _08023864 - ldr r2, [r3] - ldr r1, [r2, 0x8] - lsls r0, r1, 1 - adds r0, 0xA - adds r2, r0 - mov r9, r2 - movs r2, 0 - subs r1, 0x1 - cmp r2, r1 - bge _08023854 -_08023800: - mov r5, r9 - ldr r0, [r3] - ldr r0, [r0, 0x8] - subs r7, r0, 0x1 - adds r0, r2, 0x1 - mov r8, r0 - cmp r7, r2 - ble _08023846 -_08023810: - subs r6, r5, 0x2 - movs r1, 0 - ldrsh r0, [r6, r1] - movs r1, 0 - str r2, [sp] - bl GetAlphabetParentNo - adds r4, r0, 0 - movs r1, 0 - ldrsh r0, [r5, r1] - movs r1, 0 - bl GetAlphabetParentNo - lsls r4, 16 - lsls r0, 16 - ldr r2, [sp] - cmp r4, r0 - ble _0802383E - movs r0, 0 - ldrsh r1, [r5, r0] - ldrh r0, [r6] - strh r0, [r5] - strh r1, [r6] -_0802383E: - adds r5, r6, 0 - subs r7, 0x1 - cmp r7, r2 - bgt _08023810 -_08023846: - mov r2, r8 - ldr r3, _08023864 - ldr r0, [r3] - ldr r0, [r0, 0x8] - subs r0, 0x1 - cmp r2, r0 - blt _08023800 -_08023854: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08023864: .4byte gUnknown_3001B5C - thumb_func_end sub_80237E0 \ No newline at end of file diff --git a/asm/code_8023144.s b/asm/code_8023144.s deleted file mode 100644 index 04ae5a9fd..000000000 --- a/asm/code_8023144.s +++ /dev/null @@ -1,382 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_8022A10 -sub_8022A10: - push {r4-r7,lr} - sub sp, 0x8 - ldr r1, _08022A2C - ldr r0, [r1] - ldr r0, [r0] - adds r4, r1, 0 - cmp r0, 0x16 - bls _08022A22 - b _08022D1E -_08022A22: - lsls r0, 2 - ldr r1, _08022A30 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08022A2C: .4byte gUnknown_203B294 -_08022A30: .4byte _08022A34 - .align 2, 0 -_08022A34: - .4byte _08022A90 - .4byte _08022AAA - .4byte _08022AB2 - .4byte _08022AE0 - .4byte _08022B10 - .4byte _08022B1A - .4byte _08022B24 - .4byte _08022B34 - .4byte _08022B44 - .4byte _08022B54 - .4byte _08022B64 - .4byte _08022C28 - .4byte _08022CA0 - .4byte _08022CA8 - .4byte _08022CB0 - .4byte _08022CB8 - .4byte _08022CC0 - .4byte _08022CC8 - .4byte _08022CD8 - .4byte _08022CE8 - .4byte _08022CF8 - .4byte _08022D14 - .4byte _08022D1E -_08022A90: - ldr r0, [r4] - ldr r0, [r0, 0x48] - cmp r0, 0 - beq _08022A9C - movs r0, 0x5 - b _08022A9E -_08022A9C: - movs r0, 0x1 -_08022A9E: - movs r1, 0x3 - movs r2, 0 - movs r3, 0xA - bl sub_801A5D8 - b _08022D22 -_08022AAA: - movs r0, 0x1 - bl sub_801A8D0 - b _08022D22 -_08022AB2: - bl sub_801A9E0 - ldr r0, _08022ADC - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x54 - adds r1, r2, 0 - adds r1, 0xF8 - movs r4, 0x9C - lsls r4, 1 - adds r3, r2, r4 - adds r2, 0xF4 - ldr r2, [r2] - str r2, [sp] - movs r2, 0x2 - str r2, [sp, 0x4] - movs r2, 0 - bl sub_8012D60 - b _08022D22 - .align 2, 0 -_08022ADC: .4byte gUnknown_203B294 -_08022AE0: - bl sub_801A9E0 - ldr r4, _08022B08 - ldr r0, [r4] - adds r0, 0x54 - movs r1, 0 - bl sub_8012EA4 - ldr r0, [r4] - adds r0, 0xA4 - ldr r1, _08022B0C - movs r2, 0x3 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0 - movs r3, 0 - bl sub_8012D60 - b _08022D22 - .align 2, 0 -_08022B08: .4byte gUnknown_203B294 -_08022B0C: .4byte gUnknown_80DC584 -_08022B10: - ldr r0, [r4] - adds r0, 0x50 - bl sub_801B3C0 - b _08022D22 -_08022B1A: - ldr r0, _08022B20 - b _08022D00 - .align 2, 0 -_08022B20: .4byte gUnknown_80DC5F4 -_08022B24: - ldr r0, _08022B2C - ldr r3, _08022B30 - b _08022D02 - .align 2, 0 -_08022B2C: .4byte gUnknown_80DC618 -_08022B30: .4byte 0x00000101 -_08022B34: - ldr r0, _08022B3C - ldr r3, _08022B40 - b _08022D02 - .align 2, 0 -_08022B3C: .4byte gUnknown_80DC674 -_08022B40: .4byte 0x00000101 -_08022B44: - ldr r0, _08022B4C - ldr r3, _08022B50 - b _08022D02 - .align 2, 0 -_08022B4C: .4byte gUnknown_80DC6CC -_08022B50: .4byte 0x00000101 -_08022B54: - ldr r0, _08022B5C - ldr r3, _08022B60 - b _08022D02 - .align 2, 0 -_08022B5C: .4byte gUnknown_80DC728 -_08022B60: .4byte 0x00000101 -_08022B64: - ldr r7, _08022B68 - b _08022B78 - .align 2, 0 -_08022B68: .4byte gUnknown_203B294 -_08022B6C: - ldr r1, [r4] - ldr r0, [r1, 0x40] - adds r0, 0x1 - str r0, [r1, 0x40] - cmp r0, 0x17 - bgt _08022C10 -_08022B78: - movs r5, 0 - movs r6, 0 - movs r3, 0 - ldr r2, [r4] - ldr r0, [r2, 0x38] - cmp r5, r0 - bge _08022BA4 - ldrb r1, [r2, 0x8] - b _08022B9C -_08022B8A: - adds r3, 0x1 - ldr r2, [r4] - ldr r0, [r2, 0x38] - cmp r3, r0 - bge _08022BA4 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r3 - ldrb r1, [r0] -_08022B9C: - ldr r0, [r2, 0x40] - cmp r1, r0 - bne _08022B8A - movs r5, 0x1 -_08022BA4: - movs r3, 0 - ldr r2, [r4] - ldr r0, [r2, 0x3C] - cmp r3, r0 - bge _08022BCE - adds r0, r2, 0 - adds r0, 0x20 - b _08022BC4 -_08022BB4: - adds r3, 0x1 - ldr r2, [r4] - ldr r0, [r2, 0x3C] - cmp r3, r0 - bge _08022BCE - adds r0, r2, 0 - adds r0, 0x20 - adds r0, r3 -_08022BC4: - ldrb r1, [r0] - ldr r0, [r2, 0x40] - cmp r1, r0 - bne _08022BB4 - movs r6, 0x1 -_08022BCE: - cmp r5, r6 - beq _08022B6C - ldr r1, [r7] - movs r0, 0xA - str r0, [r1, 0x4] - ldr r0, [r1, 0x40] - lsls r0, 24 - lsrs r0, 24 - bl GetIQSkillName - adds r1, r0, 0 - ldr r0, _08022C18 - bl strcpy - movs r0, 0xCB - bl PlaySound - ldr r0, _08022C1C - movs r1, 0 - movs r2, 0 - ldr r3, _08022C20 - bl sub_80141B4 - ldr r1, [r7] - ldr r0, [r1, 0x40] - adds r0, 0x1 - str r0, [r1, 0x40] - ldr r0, _08022C24 - ldr r0, [r0] - ldr r0, [r0, 0x40] - cmp r0, 0x17 - bgt _08022C10 - b _08022D22 -_08022C10: - movs r0, 0xB - bl sub_8022924 - b _08022D22 - .align 2, 0 -_08022C18: .4byte gUnknown_202DEA8 -_08022C1C: .4byte gUnknown_80DC788 -_08022C20: .4byte 0x00000101 -_08022C24: .4byte gUnknown_203B294 -_08022C28: - ldr r1, [r4] - movs r0, 0x16 - str r0, [r1, 0x4] - bl nullsub_104 - ldr r0, [r4] - adds r0, 0x46 - ldrh r0, [r0] - cmp r0, 0x8 - bhi _08022C98 - lsls r0, 2 - ldr r1, _08022C48 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08022C48: .4byte _08022C4C - .align 2, 0 -_08022C4C: - .4byte _08022C70 - .4byte _08022C78 - .4byte _08022C80 - .4byte _08022C98 - .4byte _08022C88 - .4byte _08022C98 - .4byte _08022C98 - .4byte _08022C98 - .4byte _08022C90 -_08022C70: - movs r0, 0x16 - bl sub_8022924 - b _08022D22 -_08022C78: - movs r0, 0xD - bl sub_8022924 - b _08022D22 -_08022C80: - movs r0, 0xE - bl sub_8022924 - b _08022D22 -_08022C88: - movs r0, 0xF - bl sub_8022924 - b _08022D22 -_08022C90: - movs r0, 0x10 - bl sub_8022924 - b _08022D22 -_08022C98: - movs r0, 0xC - bl sub_8022924 - b _08022D22 -_08022CA0: - ldr r0, _08022CA4 - b _08022D00 - .align 2, 0 -_08022CA4: .4byte gUnknown_80DC7B4 -_08022CA8: - ldr r0, _08022CAC - b _08022D00 - .align 2, 0 -_08022CAC: .4byte gUnknown_80DC7FC -_08022CB0: - ldr r0, _08022CB4 - b _08022D00 - .align 2, 0 -_08022CB4: .4byte gUnknown_80DC81C -_08022CB8: - ldr r0, _08022CBC - b _08022D00 - .align 2, 0 -_08022CBC: .4byte gUnknown_80DC844 -_08022CC0: - ldr r0, _08022CC4 - b _08022D00 - .align 2, 0 -_08022CC4: .4byte gUnknown_80DC864 -_08022CC8: - ldr r1, [r4] - movs r0, 0x16 - str r0, [r1, 0x4] - ldr r0, _08022CD4 - b _08022D00 - .align 2, 0 -_08022CD4: .4byte gUnknown_80DC88C -_08022CD8: - ldr r1, [r4] - movs r0, 0x16 - str r0, [r1, 0x4] - ldr r0, _08022CE4 - b _08022D00 - .align 2, 0 -_08022CE4: .4byte gUnknown_80DC8AC -_08022CE8: - ldr r1, [r4] - movs r0, 0x16 - str r0, [r1, 0x4] - ldr r0, _08022CF4 - b _08022D00 - .align 2, 0 -_08022CF4: .4byte gUnknown_80DC8C8 -_08022CF8: - ldr r1, [r4] - movs r0, 0x16 - str r0, [r1, 0x4] - ldr r0, _08022D0C -_08022D00: - ldr r3, _08022D10 -_08022D02: - movs r1, 0 - movs r2, 0 - bl sub_80141B4 - b _08022D22 - .align 2, 0 -_08022D0C: .4byte gUnknown_80DC8DC -_08022D10: .4byte 0x00000301 -_08022D14: - ldr r0, [r4] - ldr r0, [r0, 0x4C] - bl sub_801AFA4 - b _08022D22 -_08022D1E: - bl sub_801A928 -_08022D22: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8022A10 - - .align 2,0 diff --git a/data/data_80DC464.s b/data/data_80DC464.s deleted file mode 100644 index 4e248f016..000000000 --- a/data/data_80DC464.s +++ /dev/null @@ -1,188 +0,0 @@ - .section .rodata - -@ code_8023144 -.string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC584 -gUnknown_80DC584: @ 80DC584 - .4byte Yes_80DC5A0 - .byte 0x02, 0x00, 0x00, 0x00 - .4byte No_80DC59C - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00 - - .global No_80DC59C - No_80DC59C: - .string "No\0" - .align 2,0 - .global Yes_80DC5A0 - Yes_80DC5A0: - .string "Yes\0" - .align 2,0 - - .global gUnknown_80DC5A4 -gUnknown_80DC5A4: @ 80DC5A4 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC5BC -gUnknown_80DC5BC: @ 80DC5BC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC5D4 -gUnknown_80DC5D4: @ 80DC5D4 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x0b, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC5EC -gUnknown_80DC5EC: @ 80DC5EC - .byte 0x81, 0x48 - .byte 0x81, 0x48 - .byte 0x81, 0x48 - .byte 0x00, 0x00 - - .global gUnknown_80DC5F4 -gUnknown_80DC5F4: @ 80DC5F4 - .string "It doesn{APOSTROPHE}t appear to be hungry.\0" - .align 2,0 - - .global gUnknown_80DC618 -gUnknown_80DC618: @ 80DC618 - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "This Gummi looks like a big favorite!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC674 -gUnknown_80DC674: @ 80DC674 - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "This Gummi looks like a favorite!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC6CC -gUnknown_80DC6CC: @ 80DC6CC - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "It doesn{APOSTROPHE}t seem to dislike this Gummi.\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC728 -gUnknown_80DC728: @ 80DC728 - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "It appears to be just a little satisfied.\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC788 -gUnknown_80DC788: @ 80DC788 - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ helped it learn how to\n" - .string "use {ARG_MOVE_ITEM_1}!\0" - .align 2,0 - - .global gUnknown_80DC7B4 -gUnknown_80DC7B4: @ 80DC7B4 - .string "Yes! {ARG_POKEMON_1} grew explosively!\n" - .string "Attack{COMMA} Defense{COMMA} and so on rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC7FC -gUnknown_80DC7FC: @ 80DC7FC - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Attack rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC81C -gUnknown_80DC81C: @ 80DC81C - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Special Attack rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC844 -gUnknown_80DC844: @ 80DC844 - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Defense rose by 1!\0" - .align 2,0 - - - .global gUnknown_80DC864 -gUnknown_80DC864: @ 80DC864 - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Special Defense rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC88C -gUnknown_80DC88C: @ 80DC88C - .string "You don{APOSTROPHE}t have any Gummis.\0" - .align 2,0 - - .global gUnknown_80DC8AC -gUnknown_80DC8AC: @ 80DC8AC - .string "You don{APOSTROPHE}t have an item.\0" - .align 2,0 - - .global gUnknown_80DC8C8 -gUnknown_80DC8C8: @ 80DC8C8 - .string "The Gummi is gone!\0" - .align 2,0 - - .global gUnknown_80DC8DC -gUnknown_80DC8DC: @ 80DC8DC - .string "The item is gone!\0" - .align 2,0 - - .global gUnknown_80DC8F0 -gUnknown_80DC8F0: @ 80DC8F0 - .string "Give\0" - .align 2,0 - - .global gUnknown_80DC8F8 -gUnknown_80DC8F8: @ 80DC8F8 - .string "Use\0" - .align 2,0 - -@ code_8023144 #2 -.string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC904 -gUnknown_80DC904: @ 80DC904 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC91C -gUnknown_80DC91C: @ 80DC91C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x0f, 0x00, 0x0e, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC934 -gUnknown_80DC934: @ 80DC934 - .string "Pokémon\0" - .align 2,0 - - .global gUnknown_80DC93C -gUnknown_80DC93C: @ 80DC93C - .string "{COLOR_2}%c%s{END_COLOR_TEXT_2}\0" \ No newline at end of file diff --git a/include/adventure_log.h b/include/adventure_log.h index adc46347b..a2fef9277 100644 --- a/include/adventure_log.h +++ b/include/adventure_log.h @@ -2,7 +2,7 @@ #define GUARD_ADVENTURE_LOG_H #include "input.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xA0 typedef struct AdventureLog diff --git a/include/charge_move.h b/include/charge_move.h index 6f745c7b4..32d632909 100644 --- a/include/charge_move.h +++ b/include/charge_move.h @@ -1,7 +1,7 @@ #ifndef GUARD_CHARGE_MOVE_H #define GUARD_CHARGE_MOVE_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 MoveMatchesChargingStatus(Entity *pokemon, Move *move); // checkCharge = Check for the move named Charge. diff --git a/include/code_80130A8.h b/include/code_80130A8.h index 315ad5b27..81f3a9824 100644 --- a/include/code_80130A8.h +++ b/include/code_80130A8.h @@ -3,7 +3,7 @@ #include "file_system.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // code_80130A8.s extern void sub_8013F84(void); diff --git a/include/code_801B3C0.h b/include/code_801B3C0.h index ca7410c06..6ab0d10f7 100644 --- a/include/code_801B3C0.h +++ b/include/code_801B3C0.h @@ -3,8 +3,8 @@ #include "input.h" #include "items.h" -#include "subStruct_203B240.h" -#include "text.h" +#include "structs/subStruct_203B240.h" +#include "structs/str_text.h" // size: 0x94 typedef struct unkStruct_203B230 diff --git a/include/code_801B60C.h b/include/code_801B60C.h index 78920cea8..407dfabd8 100644 --- a/include/code_801B60C.h +++ b/include/code_801B60C.h @@ -3,7 +3,7 @@ #include "items.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x154 typedef struct unkStruct_203B234 diff --git a/include/code_801BEEC.h b/include/code_801BEEC.h index f3517efa7..a12baee52 100644 --- a/include/code_801BEEC.h +++ b/include/code_801BEEC.h @@ -4,7 +4,7 @@ #include "constants/iq_skill.h" #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x124 struct unkStruct_203B238 diff --git a/include/code_801C244.h b/include/code_801C244.h index ee6efc886..3c78d407d 100644 --- a/include/code_801C244.h +++ b/include/code_801C244.h @@ -4,7 +4,7 @@ #include "constants/iq_skill.h" #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xC4 struct unkStruct_203B23C diff --git a/include/code_801C620.h b/include/code_801C620.h index 71eac44e9..f9623bd2b 100644 --- a/include/code_801C620.h +++ b/include/code_801C620.h @@ -2,8 +2,8 @@ #define GUARD_CODE_801C620_H #include "menu.h" -#include "subStruct_203B240.h" -#include "text.h" +#include "structs/subStruct_203B240.h" +#include "structs/str_text.h" // size: 0x94 struct unkStruct_203B240 diff --git a/include/code_801C8C4.h b/include/code_801C8C4.h index e0b67a5d4..65a3e1b3e 100644 --- a/include/code_801C8C4.h +++ b/include/code_801C8C4.h @@ -3,7 +3,7 @@ #include "constants/item.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x554 struct unkStruct_203B244 diff --git a/include/code_801D014.h b/include/code_801D014.h index 82f7189c6..ab29a0ff5 100644 --- a/include/code_801D014.h +++ b/include/code_801D014.h @@ -3,7 +3,7 @@ #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x118 struct unk_203B250 diff --git a/include/code_801D9E4.h b/include/code_801D9E4.h index 5d2a87d9e..a08365796 100644 --- a/include/code_801D9E4.h +++ b/include/code_801D9E4.h @@ -2,7 +2,7 @@ #define GUARD_CODE_801D9E4_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xA0 struct unkStruct_203B258 diff --git a/include/code_801EE10.h b/include/code_801EE10.h index ec613bf49..c67fe4299 100644 --- a/include/code_801EE10.h +++ b/include/code_801EE10.h @@ -5,7 +5,7 @@ #include "input.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size 0xBC typedef struct unkStruct_203B270 diff --git a/include/code_80227B8.h b/include/code_80227B8.h new file mode 100644 index 000000000..62eba30d9 --- /dev/null +++ b/include/code_80227B8.h @@ -0,0 +1,36 @@ +#ifndef GUARD_CODE_80227B8_H +#define GUARD_CODE_80227B8_H + +#include "constants/iq_skill.h" +#include "items.h" +#include "menu.h" +#include "pokemon.h" +#include "structs/str_text.h" + +// size: 0x1A8 +typedef struct unkStruct_203B294 +{ + /* 0x0 */ s32 state; + /* 0x4 */ s32 fallbackState; + /* 0x8 */ u8 iqSkillPreGummi[NUM_IQ_SKILLS]; + /* 0x20 */ u8 iqSkillPostGummi[NUM_IQ_SKILLS]; + /* 0x38 */ s32 availIQSkillPreGummi; + /* 0x3C */ s32 availIQSkillPostGummi; + s32 unk40; // Gummi eaten flag? + /* 0x44 */ Gummi gummi; + /* 0x48 */ PokemonStruct1 *pokeStruct; + /* 0x4C */ u32 itemIndex; + /* 0x50 */ Item item; + MenuStruct unk54; + MenuStruct unkA4; + /* 0xF4 */ u32 menuAction; + MenuItem unkF8[8]; + u16 unk138[8]; + UnkTextStruct2 unk148[4]; +} unkStruct_203B294; + +bool8 sub_80227B8(PokemonStruct1 *pkmn); +u32 sub_8022860(void); +void sub_8022908(void); + +#endif // GUARD_CODE_80227B8_H \ No newline at end of file diff --git a/include/code_8023144.h b/include/code_8023144.h index 66c250ac0..772b0fd2e 100644 --- a/include/code_8023144.h +++ b/include/code_8023144.h @@ -1,59 +1,29 @@ #ifndef GUARD_CODE_8023144_H #define GUARD_CODE_8023144_H -#include "constants/iq_skill.h" #include "input.h" -#include "items.h" -#include "menu.h" -#include "pokemon.h" -#include "text.h" - -// size: 0x1A8 -typedef struct unkStruct_203B294 -{ - /* 0x0 */ s32 state; - /* 0x4 */ s32 fallbackState; - u8 iqSkillPreGummi[NUM_IQ_SKILLS]; - u8 iqSkillPostGummi[NUM_IQ_SKILLS]; - u32 availIQSkillPreGummi; - u32 availIQSkillPostGummi; - u32 unk40; // Gummi eaten flag? - Gummi gummi; - /* 0x48 */ PokemonStruct1 *pokeStruct; - u32 itemIndex; - Item item; - MenuStruct unk54; - MenuStruct unkA4; - u32 menuAction; - MenuItem unkF8[0x8]; - u16 unk138[0x8]; - UnkTextStruct2 unk148[4]; -} unkStruct_203B294; +#include "structs/str_text.h" // size: 0x3FC typedef struct unkStruct_3001B5C { u8 unk0; u32 unk4; - u32 unk8; + s32 unk8; s16 unkC[2]; u32 unk10; u8 fill14[0x354 - 0x14]; u8 unk354; u8 fill355[0x35C - 0x355]; - MenuInputStruct input; + /* 0x35C */ MenuInputStruct input; u32 unk390; UnkTextStruct2 *unk394; UnkTextStruct2 unk398[4]; u8 unk3F8[4]; } unkStruct_3001B5C; -bool8 sub_80227B8(PokemonStruct1 *pokeStruct); -u32 sub_8022860(void); -void sub_8022908(void); - bool8 sub_8023144(s32, s32 index, UnkTextStruct2_sub *sub, u32); -u32 sub_8023278(u8); +u32 sub_8023278(bool8); s16 sub_802331C(void); void sub_8023354(bool8 cursorSprite); void sub_80233A0(void); diff --git a/include/code_8024458.h b/include/code_8024458.h index 3c271f455..8cbf206c3 100644 --- a/include/code_8024458.h +++ b/include/code_8024458.h @@ -2,7 +2,7 @@ #define GUARD_CODE_8024458_H #include "input.h" -#include "text.h" +#include "structs/str_text.h" struct unkStruct_203B2AC { diff --git a/include/code_80521D0.h b/include/code_80521D0.h index 008c54f13..bc98b6563 100644 --- a/include/code_80521D0.h +++ b/include/code_80521D0.h @@ -1,7 +1,7 @@ #ifndef GUARD_CODE_80521D0_H #define GUARD_CODE_80521D0_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" void SendMessage(Entity *pokemon, const char message[]); diff --git a/include/code_806CD90.h b/include/code_806CD90.h index 3a172ea7b..d578aa839 100644 --- a/include/code_806CD90.h +++ b/include/code_806CD90.h @@ -1,7 +1,7 @@ #ifndef GUARD_CODE_806CD90_H #define GUARD_CODE_806CD90_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" void sub_806CC10(void); void sub_806CC70(void); diff --git a/include/code_80869E4.h b/include/code_80869E4.h index 3aad7eed3..64ca99035 100644 --- a/include/code_80869E4.h +++ b/include/code_80869E4.h @@ -1,7 +1,7 @@ #ifndef GUARD_CODE_80869E4_H #define GUARD_CODE_80869E4_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" // size: 0x8 typedef struct unkStruct_202F3D0 diff --git a/include/code_8094F88.h b/include/code_8094F88.h index 726599afc..8a450601c 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -2,7 +2,7 @@ #define GUARD_CODE_8094F88_H #include "code_8092334.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "items.h" #include "pokemon.h" diff --git a/include/code_8097670.h b/include/code_8097670.h index 887bedd59..aa640196e 100644 --- a/include/code_8097670.h +++ b/include/code_8097670.h @@ -1,7 +1,7 @@ #ifndef GUARD_CODE_8097670_H #define GUARD_CODE_8097670_H -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" // size: 0xC4 struct unkStruct_203B494 diff --git a/include/code_8097DD0.h b/include/code_8097DD0.h index 11c718a73..6a8ae9003 100644 --- a/include/code_8097DD0.h +++ b/include/code_8097DD0.h @@ -1,7 +1,7 @@ #ifndef GUARD_CODE_8097DD0_H #define GUARD_CODE_8097DD0_H -#include "subStruct_203B240.h" +#include "structs/subStruct_203B240.h" extern u32 sub_8097DF0(u8 *, struct subStruct_203B240 **); diff --git a/include/constants/input.h b/include/constants/input.h index e7d42ad79..4cf5ca76e 100644 --- a/include/constants/input.h +++ b/include/constants/input.h @@ -12,14 +12,11 @@ #define INPUT_DPAD_DOWN 8 #define INPUT_DPAD_LEFT 9 #define INPUT_DPAD_RIGHT 10 - -// When R button is pressed in combination with other keys +// When R button is pressed in combination with other keys: #define INPUT_R_A_BUTTONS 11 #define INPUT_R_DPAD_UP_BUTTONS 12 #define INPUT_R_DPAD_DOWN_BUTTONS 13 #define INPUT_R_DPAD_LEFT_BUTTONS 14 #define INPUT_R_DPAD_RIGHT_BUTTONS 15 - -#endif // GUARD_CONSTANTS_INPUT_H - +#endif // GUARD_CONSTANTS_INPUT_H \ No newline at end of file diff --git a/include/constants/item.h b/include/constants/item.h index 54712661a..104c3d441 100644 --- a/include/constants/item.h +++ b/include/constants/item.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_ITEM_H #define GUARD_CONSTANTS_ITEM_H +// Cannot include enums in this file since it's used by the data_item and data_monster assemblers + #define MAX_KECLEON_ITEM_SHOP_ITEMS 8 #define MAX_KECLEON_WARE_SHOP_ITEMS 4 diff --git a/include/constants/mailbox.h b/include/constants/mailbox.h index f6d1d3fcc..db5153151 100644 --- a/include/constants/mailbox.h +++ b/include/constants/mailbox.h @@ -6,12 +6,12 @@ enum JOB_LIST_MAIL_TYPES { - MAIL_TYPE_NONE = 0, + MAIL_TYPE_NONE, MAIL_TYPE_UNK1, MAIL_TYPE_UNK2, MAIL_TYPE_UNK3, MAIL_TYPE_UNK4, - MAIL_TYPE_SUSPENDED_JOB = 5, + MAIL_TYPE_SUSPENDED_JOB, MAIL_TYPE_TAKEN_JOB, MAIL_TYPE_UNK7, MAIL_TYPE_UNK8, diff --git a/include/constants/monster.h b/include/constants/monster.h index 3d4c09296..9664c990a 100644 --- a/include/constants/monster.h +++ b/include/constants/monster.h @@ -428,6 +428,6 @@ #define MONSTER_RAYQUAZA_CUTSCENE 423 #define NUM_MONSTERS MONSTER_JIRACHI -#define MONSTER_MAX MONSTER_RAYQUAZA_CUTSCENE +#define MONSTER_MAX (MONSTER_RAYQUAZA_CUTSCENE + 1) #endif // GUARD_CONSTANTS_MONSTER_H \ No newline at end of file diff --git a/include/constants/move.h b/include/constants/move.h index 62fba6d03..b5b09e6ef 100644 --- a/include/constants/move.h +++ b/include/constants/move.h @@ -34,42 +34,6 @@ enum AccuracyType NUM_ACCURACY_TYPES }; -// size: 0x24 -typedef struct MoveDataEntry -{ - /* 0x0 */ u8 *name; - /* 0x4 */ s16 basePower; - /* 0x6 */ u8 type; - // Determines the range of moves. - /* 0x8 */ u16 targetingFlags[2]; // 0 for player and 1 for AI - // The AI consider certain moves to have different range than they actually do. - /* 0xC */ u8 basePP; - /* 0xD */ u8 aiWeight; - // There are multiple accuracy values. These are define with the AccuracyType enum. - /* 0xE */ u8 accuracy[NUM_ACCURACY_TYPES]; - /* 0x11 */ u8 numberOfChainedHits; // Maximum number of times the move will hit. Used for multi-hit moves like Fury Attack. - /* 0x12 */ u8 maxUpgradeLevel; - /* 0x13 */ u8 critChance; - /* 0x14 */ bool8 affectedByMagicCoat; // If true, this move is reflected by Magic Coat. - /* 0x15 */ bool8 isSnatchable; - /* 0x16 */ bool8 usesMouth; // If true, this move can't be used with the Muzzled status. - /* 0x17 */ bool8 cannotHitFrozen; // Used by Status Checker to determine if a move can be used on a frozen target. - /* 0x18 */ bool8 ignoresTaunted; - /* 0x19 */ u8 rangeID; - /* 0x1C */ u8 *description; - /* 0x20 */ u8 *useText; // The text displayed when this move is used. -} MoveDataEntry; - -// size: 0x8 -typedef struct Move -{ - u8 moveFlags; - u8 moveFlags2; - u16 id; - u8 PP; - u8 ginseng; // How much the move is boosted by Ginsengs. -} Move; - enum TargetingFlag { TARGETING_FLAG_TARGET_OTHER = 0x0, diff --git a/include/credits1.h b/include/credits1.h index eecd55d44..83217ad18 100644 --- a/include/credits1.h +++ b/include/credits1.h @@ -1,7 +1,7 @@ #ifndef GUARD_CREDITS1_H #define GUARD_CREDITS1_H -#include "text.h" +#include "structs/str_text.h" // size: 0x6C typedef struct Credits1Work diff --git a/include/debug_menu1.h b/include/debug_menu1.h index cec60adc3..bc27efef2 100644 --- a/include/debug_menu1.h +++ b/include/debug_menu1.h @@ -2,7 +2,7 @@ #define GUARD_DEBUG_MENU1_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x1A4 struct DebugMenu diff --git a/include/debug_menu2.h b/include/debug_menu2.h index b941db0d8..b42ab1ca3 100644 --- a/include/debug_menu2.h +++ b/include/debug_menu2.h @@ -2,7 +2,7 @@ #define GUARD_DEBUG_MENU2_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x138 typedef struct unkStruct_203B3F0 diff --git a/include/debug_menu3.h b/include/debug_menu3.h index 232271bbe..df9b4531d 100644 --- a/include/debug_menu3.h +++ b/include/debug_menu3.h @@ -2,7 +2,7 @@ #define GUARD_DEBUG_MENU3_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xFC typedef struct unkStruct_203B3F4 diff --git a/include/debug_menu4.h b/include/debug_menu4.h index 095e8338d..2b2dbb230 100644 --- a/include/debug_menu4.h +++ b/include/debug_menu4.h @@ -3,7 +3,7 @@ #include "pokemon.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x140 typedef struct unkStruct_203B3F8 diff --git a/include/dungeon.h b/include/dungeon.h index f1ed51a9b..e88ff9324 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_H #define GUARD_DUNGEON_H -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" // size: 0x8 typedef struct DungeonName diff --git a/include/dungeon_action.h b/include/dungeon_action.h index 2e606d346..c9127eda6 100644 --- a/include/dungeon_action.h +++ b/include/dungeon_action.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_ACTION_H #define GUARD_DUNGEON_ACTION_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" void ClearMonsterActionFields(ActionContainer *actionPointer); void SetMonsterActionFields(ActionContainer *actionPointer, u16 action); diff --git a/include/dungeon_ai.h b/include/dungeon_ai.h index bf2597573..4e2716ff4 100644 --- a/include/dungeon_ai.h +++ b/include/dungeon_ai.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_AI_H #define GUARD_DUNGEON_AI_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" u32 sub_8075818(Entity *entity); void sub_8075900(Entity *pokemon, u8 r1); diff --git a/include/dungeon_ai_attack.h b/include/dungeon_ai_attack.h index 00f3eae60..95a5f84ab 100644 --- a/include/dungeon_ai_attack.h +++ b/include/dungeon_ai_attack.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_AI_ATTACK_H #define GUARD_DUNGEON_AI_ATTACK_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" #define RANGED_ATTACK_RANGE 10 diff --git a/include/dungeon_ai_item_weight.h b/include/dungeon_ai_item_weight.h index a612a98d5..ff33d993f 100644 --- a/include/dungeon_ai_item_weight.h +++ b/include/dungeon_ai_item_weight.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_AI_ITEM_WEIGHT_H #define GUARD_DUNGEON_AI_ITEM_WEIGHT_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" u32 EvaluateItem(Entity *targetPokemon, Item *item, u32 itemTargetFlags); bool8 CanTargetAdjacentPokemon(Entity *pokemon); diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h index 10f9a0e17..bafbac478 100644 --- a/include/dungeon_ai_items.h +++ b/include/dungeon_ai_items.h @@ -1,8 +1,8 @@ #ifndef GUARD_DUNGEON_AI_ITEMS_H #define GUARD_DUNGEON_AI_ITEMS_H -#include "dungeon_entity.h" -#include "position.h" +#include "structs/dungeon_entity.h" +#include "structs/str_position.h" void DecideUseItem(Entity *pokemon); void FindStraightThrowableTargets(Entity *pokemon, s32 thrownAIFlag, Item *item, bool8 ignoreRollChance); diff --git a/include/dungeon_ai_leader.h b/include/dungeon_ai_leader.h index a62688e4d..a66e5804e 100644 --- a/include/dungeon_ai_leader.h +++ b/include/dungeon_ai_leader.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_AI_LEADER_H #define GUARD_DUNGEON_AI_LEADER_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 TargetLeader(Entity *pokemon); Entity* GetLeaderIfVisible(Entity *pokemon); diff --git a/include/dungeon_ai_movement.h b/include/dungeon_ai_movement.h index dd8e877fd..5324a3f3c 100644 --- a/include/dungeon_ai_movement.h +++ b/include/dungeon_ai_movement.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_AI_MOVEMENT_H #define GUARD_DUNGEON_AI_MOVEMENT_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" void MoveIfPossible(Entity *pokemon, bool8 showRunAwayEffect); bool8 CanTakeItem(Entity *pokemon); diff --git a/include/dungeon_ai_targeting.h b/include/dungeon_ai_targeting.h index f0509ea61..6cb73fe22 100644 --- a/include/dungeon_ai_targeting.h +++ b/include/dungeon_ai_targeting.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_AI_TARGETING_H #define GUARD_DUNGEON_AI_TARGETING_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 CanAttackInDirection(Entity *pokemon, s32 direction); bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront); diff --git a/include/dungeon_capabilities.h b/include/dungeon_capabilities.h index fa0ee214d..9d0948fa6 100644 --- a/include/dungeon_capabilities.h +++ b/include/dungeon_capabilities.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_CAPABILITIES_H #define GUARD_DUNGEON_CAPABILITIES_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 CannotMove(Entity *pokemon, bool8 checkBlinker); bool8 sub_8070BC0(Entity* entity); diff --git a/include/dungeon_items.h b/include/dungeon_items.h index 3931919d2..a9cab2bc3 100644 --- a/include/dungeon_items.h +++ b/include/dungeon_items.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_ITEMS_H #define GUARD_DUNGEON_ITEMS_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 HasHeldItem(Entity *pokemon, u8 id); diff --git a/include/dungeon_leader.h b/include/dungeon_leader.h index a7cdf8598..abd4dedb0 100644 --- a/include/dungeon_leader.h +++ b/include/dungeon_leader.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_LEADER_H #define GUARD_DUNGEON_LEADER_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" Entity* GetLeader(void); EntityInfo* GetLeaderInfo(void); diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index c57be0e4b..931ace038 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_MAP_ACCESS_H #define GUARD_DUNGEON_MAP_ACCESS_H -#include "map.h" +#include "structs/map.h" typedef struct unkStruct_202F190 { diff --git a/include/dungeon_movement.h b/include/dungeon_movement.h index 89052c951..e206c26fb 100644 --- a/include/dungeon_movement.h +++ b/include/dungeon_movement.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_MOVEMENT #define GUARD_DUNGEON_MOVEMENT -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" u8 GetCrossableTerrain(s16 species); u8 sub_807034C(s16 id, struct Tile *tile); diff --git a/include/dungeon_pokemon_attributes.h b/include/dungeon_pokemon_attributes.h index 47d70b072..93a97cc89 100644 --- a/include/dungeon_pokemon_attributes.h +++ b/include/dungeon_pokemon_attributes.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_POKEMON_ATTRIBUTES_H #define GUARD_DUNGEON_POKEMON_ATTRIBUTES_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 HasSafeguardStatus(Entity * param_1, Entity * param_2, bool8 displayMessage); bool8 sub_80717A4(Entity *pokemon, u16 moveID); diff --git a/include/dungeon_pokemon_sprites.h b/include/dungeon_pokemon_sprites.h index 62da2adfe..79fbcc670 100644 --- a/include/dungeon_pokemon_sprites.h +++ b/include/dungeon_pokemon_sprites.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_POKEMON_SPRITES_H #define GUARD_DUNGEON_POKEMON_SPRITES_H -#include "position.h" +#include "structs/str_position.h" // size: 0x8 typedef struct DungeonPokemonStatusSprite diff --git a/include/dungeon_range.h b/include/dungeon_range.h index 7cb1b1cc6..905163fb5 100644 --- a/include/dungeon_range.h +++ b/include/dungeon_range.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_RANGE_H #define GUARD_DUNGEON_RANGE_H -#include "position.h" +#include "structs/str_position.h" bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2); bool8 IsPositionInSight(Position *pos1, Position *pos2); diff --git a/include/dungeon_util.h b/include/dungeon_util.h index 73e01a0aa..ebe1b74d3 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -2,8 +2,8 @@ #define GUARD_DUNGEON_UTIL_H #include "constants/direction.h" -#include "dungeon_entity.h" -#include "position.h" +#include "structs/dungeon_entity.h" +#include "structs/str_position.h" extern const Position gAdjacentTileOffsets[NUM_DIRECTIONS]; diff --git a/include/dungeon_util_1.h b/include/dungeon_util_1.h index 61d791807..d6aad4754 100644 --- a/include/dungeon_util_1.h +++ b/include/dungeon_util_1.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_UTIL_1_H #define GUARD_DUNGEON_UTIL_1_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" Entity *xxx_call_GetLeader(void); Entity *GetPartnerEntity(void); diff --git a/include/dungeon_visibility.h b/include/dungeon_visibility.h index 15bd0df65..935735e6f 100644 --- a/include/dungeon_visibility.h +++ b/include/dungeon_visibility.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_VISIBILITY_H #define GUARD_DUNGEON_VISIBILITY_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 CanSeeTarget(Entity *entity, Entity *targetEntity); bool8 CanTargetEntity(Entity *entity, Entity *targetEntity); diff --git a/include/felicity_bank.h b/include/felicity_bank.h index 87a5c9903..bba4b7168 100644 --- a/include/felicity_bank.h +++ b/include/felicity_bank.h @@ -3,7 +3,7 @@ #include "file_system.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" #define FELICITY_BANK_ACTION_WITHDRAW 0 #define FELICITY_BANK_ACTION_DEPOSIT 1 diff --git a/include/friend_area_action_menu.h b/include/friend_area_action_menu.h index cb1b1f252..3441fe650 100644 --- a/include/friend_area_action_menu.h +++ b/include/friend_area_action_menu.h @@ -5,7 +5,7 @@ #include "items.h" #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" enum FriendAreaActionMenuStates { diff --git a/include/gulpin_shop.h b/include/gulpin_shop.h index c108eab7c..a9409134a 100644 --- a/include/gulpin_shop.h +++ b/include/gulpin_shop.h @@ -4,7 +4,7 @@ #include "constants/move.h" #include "file_system.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x18C typedef struct GulpinShopWork diff --git a/include/gulpin_shop_801FB50.h b/include/gulpin_shop_801FB50.h index 68bc30ff6..b31c4a851 100644 --- a/include/gulpin_shop_801FB50.h +++ b/include/gulpin_shop_801FB50.h @@ -5,7 +5,7 @@ #include "file_system.h" #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x1E0 typedef struct unkStruct_203B27C diff --git a/include/items.h b/include/items.h index 764025f98..712921a61 100644 --- a/include/items.h +++ b/include/items.h @@ -1,89 +1,10 @@ #ifndef GUARD_ITEMS_H #define GUARD_ITEMS_H -#include "constants/item.h" #include "code_8092334.h" -#include "subStruct_203B240.h" - -// size: 0x20 -typedef struct ItemDataEntry -{ - /* 0x0 */ u8 *name; - /* 0x4 */ u32 buyPrice; - /* 0x8 */ u32 sellPrice; - /* 0xC */ u8 category; - /* 0xD */ u8 icon; - /* 0x10 */ u8 *description; - // Determines how the AI can use the item. - // Index 0: Item can be used on self. - // Index 1: Item can be thrown at allies. - // Index 2: Item can be thrown at enemies. - /* 0x14 */ bool8 aiFlags[3]; - /* 0x18 */ s16 moveID; - /* 0x1A */ u8 order; // Numbered order they are in storage - /* 0x1B */ u8 spawnAmountRange[2]; - /* 0x1D */ u8 palette; - /* 0x1E */ u8 actionType; -} ItemDataEntry; - -// size: 0x4 -typedef struct Item -{ - /* 0x0 */ u8 flags; - /* 0x1 */ u8 quantity; - /* 0x2 */ u8 id; -} Item; - -// size: 0x4 -typedef struct BulkItem -{ - /* 0x0 */ u8 id; - /* 0x1 */ u8 quantity; -} BulkItem; - -// size: 0x4 -typedef struct Gummi -{ - /* 0x0 */ s16 boostAmount; - /* 0x2 */ u16 flags; -} Gummi; - -// size: 0xC -typedef struct unkStruct_8090F58 -{ - u32 unk0; - u8 unk4; - u8 unk5; - s16 unk6; - u8 unk8; -} unkStruct_8090F58; - -// size: 0x268 -typedef struct TeamInventory -{ - /* 0x0 */ Item teamItems[INVENTORY_SIZE]; - /* 0x50 */ u16 teamStorage[STORAGE_SIZE]; - /* 0x230 */ BulkItem kecleonShopItems[MAX_KECLEON_ITEM_SHOP_ITEMS]; - /* 0x250 */ BulkItem kecleonWareItems[MAX_KECLEON_WARE_SHOP_ITEMS]; - /* 0x260 */ s32 teamMoney; - /* 0x264 */ s32 teamSavings; -} TeamInventory; - -enum ItemFlag -{ - ITEM_FLAG_EXISTS = 1 << 0, - ITEM_FLAG_IN_SHOP = 1 << 1, // in a Kecleon shop - ITEM_FLAG_UNPAID = 1 << 2, // Picked up in Kecleon shop but not paid for yet - ITEM_FLAG_STICKY = 1 << 3, - ITEM_FLAG_SET = 1 << 4 // This item can be thrown by pressing L+R instead of having to go to the bag menu. -}; - -enum ItemAIFlag -{ - ITEM_AI_FLAG_TARGET_SELF, - ITEM_AI_FLAG_TARGET_ALLY, - ITEM_AI_FLAG_TARGET_ENEMY -}; +#include "structs/str_items.h" +#include "structs/str_pokemon.h" +#include "structs/subStruct_203B240.h" extern TeamInventory *gTeamInventoryRef; @@ -143,6 +64,8 @@ bool8 IsHMItem(u8 id); bool8 IsEdibleItem(u8 id); u8 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1); bool8 IsInvalidItemReward(u8 itemID); +bool8 HasGummiItem(void); +void GetGummiItemStatBoost(PokemonStruct1* pokemon, u8 id, bool8 checkBoostFlags, Gummi *gummi); void RestoreHeldItem(unkStruct_8094924 *, BulkItem *); void SaveHeldItem(unkStruct_8094924 *, BulkItem *); diff --git a/include/kangaskhan_storage1.h b/include/kangaskhan_storage1.h index 70e5f460b..973f93d01 100644 --- a/include/kangaskhan_storage1.h +++ b/include/kangaskhan_storage1.h @@ -4,7 +4,7 @@ #include "file_system.h" #include "items.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" enum KangaskhanStorageStates { diff --git a/include/kangaskhan_storage2.h b/include/kangaskhan_storage2.h index 73acd94d9..2bbaf45b4 100644 --- a/include/kangaskhan_storage2.h +++ b/include/kangaskhan_storage2.h @@ -3,7 +3,7 @@ #include "items.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x150 typedef struct unkStruct_203B20C diff --git a/include/kecleon_bros1.h b/include/kecleon_bros1.h index 6983967e4..28cbb234a 100644 --- a/include/kecleon_bros1.h +++ b/include/kecleon_bros1.h @@ -4,7 +4,7 @@ #include "file_system.h" #include "items.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" enum KecleonStoreStates { diff --git a/include/kecleon_bros2.h b/include/kecleon_bros2.h index ac806b8c8..12bafad76 100644 --- a/include/kecleon_bros2.h +++ b/include/kecleon_bros2.h @@ -2,7 +2,7 @@ #define GUARD_KECLEON_BROS2_H #include "input.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xA0 typedef struct unkStruct_203B214 diff --git a/include/kecleon_bros3.h b/include/kecleon_bros3.h index 8bfaf7218..d4f6bb67c 100644 --- a/include/kecleon_bros3.h +++ b/include/kecleon_bros3.h @@ -2,7 +2,7 @@ #define GUARD_KECLEON_BROS3_H #include "input.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xA0 typedef struct unkStruct_203B21C diff --git a/include/kecleon_bros4.h b/include/kecleon_bros4.h index 473169fac..dd31848f7 100644 --- a/include/kecleon_bros4.h +++ b/include/kecleon_bros4.h @@ -3,7 +3,7 @@ #include "constants/item.h" #include "input.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xF4 typedef struct unkStruct_203B224 diff --git a/include/luminous_cave.h b/include/luminous_cave.h index 7ea21ffbf..49ce0c5c5 100644 --- a/include/luminous_cave.h +++ b/include/luminous_cave.h @@ -5,7 +5,7 @@ #include "items.h" #include "menu.h" #include "pokemon_3.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x174 typedef struct LuminousCaveWork diff --git a/include/mailbox.h b/include/mailbox.h index 6b7d83086..1e20d269c 100644 --- a/include/mailbox.h +++ b/include/mailbox.h @@ -2,7 +2,7 @@ #define GUARD_MAILBOX_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" #include "constants/mailbox.h" #include "code_802C39C.h" diff --git a/include/main_menu1.h b/include/main_menu1.h index 419b88081..c18c90768 100644 --- a/include/main_menu1.h +++ b/include/main_menu1.h @@ -2,7 +2,7 @@ #define GUARD_MAIN_MENU1_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x8 typedef struct unkStruct_8035D94 diff --git a/include/main_menu2.h b/include/main_menu2.h index 6ce11f33d..529b13d61 100644 --- a/include/main_menu2.h +++ b/include/main_menu2.h @@ -2,7 +2,7 @@ #define GUARD_MAIN_MENU2_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x1A8 typedef struct MainMenu2Work diff --git a/include/makuhita_dojo1.h b/include/makuhita_dojo1.h index a5b1cabb0..76ef805b6 100644 --- a/include/makuhita_dojo1.h +++ b/include/makuhita_dojo1.h @@ -3,7 +3,7 @@ #include "file_system.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" enum MakuhitaDojoInitMode { diff --git a/include/makuhita_dojo2.h b/include/makuhita_dojo2.h index ad3d11b56..e50c338fb 100644 --- a/include/makuhita_dojo2.h +++ b/include/makuhita_dojo2.h @@ -3,7 +3,7 @@ #include "constants/dungeon.h" #include "input.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xD0 typedef struct MakuhitaDojoWork2 diff --git a/include/menu.h b/include/menu.h index 5ed4f66b7..bd0de04cf 100644 --- a/include/menu.h +++ b/include/menu.h @@ -3,7 +3,7 @@ #include "input.h" #include "sprite_oam.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x8 typedef struct MenuItem diff --git a/include/menu_input.h b/include/menu_input.h index 8dcb2919a..dc14e0a30 100644 --- a/include/menu_input.h +++ b/include/menu_input.h @@ -2,7 +2,7 @@ #define GUARD_MENU_INPUT_H #include "menu.h" -#include "text.h" +#include "structs/str_text.h" u32 sub_8012A64(MenuInputStructSub *r0, s32 r1); s32 GetKeyPress(MenuInputStruct *r0); diff --git a/include/move_util.h b/include/move_util.h index e72ae901c..931fef8ab 100644 --- a/include/move_util.h +++ b/include/move_util.h @@ -1,7 +1,7 @@ #ifndef GUARD_MOVE_UTIL_H #define GUARD_MOVE_UTIL_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" u32 sub_8057144(Entity * pokemon); bool8 sub_80571F0(Entity * pokemon, Move *move); diff --git a/include/moves.h b/include/moves.h index 9301f937b..ca21c661a 100644 --- a/include/moves.h +++ b/include/moves.h @@ -5,7 +5,7 @@ #include "constants/move.h" #include "constants/move_id.h" #include "pokemon.h" -#include "subStruct_203B240.h" +#include "structs/subStruct_203B240.h" // size: 0x8 typedef struct MoveLearnset diff --git a/include/other_menus1.h b/include/other_menus1.h index f2e6f49e2..bd91a1266 100644 --- a/include/other_menus1.h +++ b/include/other_menus1.h @@ -6,7 +6,7 @@ #include "menu.h" #include "pokemon.h" #include "sprite_oam.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x504 typedef struct unkStruct_203B35C diff --git a/include/party_list_menu.h b/include/party_list_menu.h index 8e2394b4c..3887cf815 100644 --- a/include/party_list_menu.h +++ b/include/party_list_menu.h @@ -5,7 +5,7 @@ #include "items.h" #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x280 typedef struct unkStruct_203B2B8 diff --git a/include/personality_test.h b/include/personality_test.h index 339595cce..d75755e07 100644 --- a/include/personality_test.h +++ b/include/personality_test.h @@ -3,7 +3,7 @@ #include "constants/personality_test.h" #include "input.h" -#include "text.h" +#include "structs/str_text.h" // Definitely wrong but need to figure out better structure later struct FaceData diff --git a/include/pokemon.h b/include/pokemon.h index 60f06b73b..eee2502e5 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -1,177 +1,18 @@ #ifndef GUARD_POKEMON_H #define GUARD_POKEMON_H -#include "dungeon_global_data.h" +#include "constants/move.h" #include "file_system.h" #include "items.h" -#include "constants/move.h" - +#include "structs/str_pokemon.h" #define OFFENSE_NRM 0 #define OFFENSE_SP 1 -// size: 0x4 -typedef struct Offense -{ - /* 0x0 */ u8 att[2]; // Atk, SpAtk - /* 0x2 */ u8 def[2]; // Def, SpDef -} Offense; - -// size: 0x4 -typedef struct unkPokeSubStruct_C -{ - u8 level; - u8 fill1[3]; -} unkPokeSubStruct_C; - enum PokemonUnk0Flags { FLAG_ON_TEAM = 2, }; -// size: 0x58 -typedef struct PokemonStruct1 -{ - u16 unk0; // Probably a union: Sometimes ldrh and sometimes ldrb. Recruited?? - /* 0x2 */ bool8 isTeamLeader; - /* 0x3 */ u8 level; - /* 0x4 */ DungeonLocation dungeonLocation; - /* 0x8 */ s16 speciesNum; - unkPokeSubStruct_C unkC[2]; - /* 0x14 */ s16 IQ; - /* 0x16 */ u16 pokeHP; - /* 0x18 */ Offense offense; - /* 0x1C */ u32 currExp; - /* 0x20 */ u32 IQSkills; - /* 0x24 */ u8 tacticIndex; - /* 0x28 */ BulkItem heldItem; - /* 0x2C */ Move moves[MAX_MON_MOVES]; - /* 0x4C */ u8 name[POKEMON_NAME_LENGTH]; -} PokemonStruct1; - -// size: 0x4 -typedef struct unkStruct_808E6F4 -{ - s16 unk0; - u8 unk2; -} unkStruct_808E6F4; - -// size: 0x4 -typedef struct EvolveStage -{ - /* 0x0 */ s16 speciesNum; - /* 0x2 */ u8 level; -} EvolveStage; - -// size: 0x24 -typedef struct unkStruct_8094184 -{ - /* 0x0 */ Move moves[MAX_MON_MOVES]; - u8 unk20; -} unkStruct_8094184; - -// size: 0x64 -typedef struct PokemonStruct2 -{ - u16 unk0; // corresponds to unk0 in PokemonStruct - /* 0x2 */ bool8 isTeamLeader; - /* 0x3 */ u8 level; - /* 0x4 */ DungeonLocation dungeonLocation; - /* 0x8 */ u16 IQ; - s16 unkA; - u16 unkC; - /* 0xE */ s16 speciesNum; - u16 unk10; // pokeHP - u16 unk12; // pokeHP - /* 0x14 */ Offense offense; // offense (other offset) - /* 0x18 */ u32 currExp; - /* 0x1C */ unkStruct_8094184 moves; - /* 0x40 */ Item itemSlot; // heldItem - u32 unk44; // some struct - u32 unk48; // some struct (same type as 44) - /* 0x4C */ u32 IQSkills; // unk20 - /* 0x50 */ u8 tacticIndex; - unkStruct_808E6F4 unk54; - /* 0x58 */ u8 name[POKEMON_NAME_LENGTH]; // name (other offset) -} PokemonStruct2; - -// size: 0x90E8 -typedef struct unkStruct_203B45C -{ - /* 0x0 */ PokemonStruct1 pokemon[NUM_MONSTERS]; - /* 0x8DF8 */ PokemonStruct2 pokemon2[4]; - /* 0x8F88 */ PokemonStruct1 team[MAX_TEAM_MEMBERS]; -} unkStruct_203B45C; - -// size: 0x4 -typedef struct PreEvolution -{ - /* 0x0 */ s16 evolveFrom; - /* 0x2 */ u16 evolveType; -} PreEvolution; - -// size: 0x4 -typedef struct EvolutionRequirements -{ - /* 0x0 */ s16 mainRequirement; - /* 0x2 */ u16 additionalRequirement; -} EvolutionRequirements; - -// size: 0x8 -typedef struct unkEvolve -{ - /* 0x0 */ PreEvolution preEvolution; - /* 0x4 */ EvolutionRequirements evolutionRequirements; -} unkEvolve; - -// size: 0x48 -typedef struct MonsterDataEntry -{ - /* 0x0 */ u8* species; - /* 0x4 */ u8* category; - /* 0x8 */ u8 overworldPalette; - /* 0x9 */ u8 bodySize; - /* 0xC */ s32 movementSpeed; - /* 0x10 */ u16 dialogueSprites; // Bitwise flags for whether a dialogue sprite/portrait is available for each emotion. - bool8 unk12; - /* 0x13 */ u8 types[2]; - /* 0x15 */ u8 movementType; - /* 0x16 */ u8 friendArea; - /* 0x17 */ u8 abilities[2]; - /* 0x19 */ u8 shadowSize; - u8 fill1A; // 0 for all Pokémon. - /* 0x1B */ u8 regenSpeed; // 100 for all Pokémon. - /* 0x1C */ bool8 canMove; // Set to false for Pokémon who don't move unless they're the leader, like Kakuna. - /* 0x1D */ u8 chanceAsleep; - /* 0x1E */ u16 baseHP; - /* 0x20 */ s32 expYield; - /* 0x24 */ u16 baseAtkSpAtk[2]; - /* 0x28 */ u16 baseDefSpDef[2]; - /* 0x2C */ u16 weight; - /* 0x2E */ u16 size; - u8 unk30; // 10 for all Pokémon. - u8 unk31; // 10 for all Pokémon. - u8 unk32; // 24 for all Pokémon. - /* 0x33 */ bool8 toolboxEnabled; // If false, the AI can't use items. Doesn't seem to be used, as it's true for all Pokémon. - /* 0x34 */ PreEvolution preEvolution; - /* 0x38 */ EvolutionRequirements evolutionRequirements; - /* 0x3C */ s16 dexInternal[2]; // dexNo and internalNo - /* 0x40 */ s16 recruitRate; - /* 0x42 */ s16 alphabetParent[2]; // alphabetNo and parentNo -} MonsterDataEntry; - -// size: 0xC | https://www.pokecommunity.com/showthread.php?t=407371 -typedef struct LevelData -{ - /* 0x0 */ s32 expRequired; - /* 0x4 */ u8 gainHP; - /* 0x5 */ u8 gainUnused; - /* 0x6 */ u8 gainAtt; - /* 0x7 */ u8 gainSPAtt; - /* 0x8 */ u8 gainDef; - /* 0x9 */ u8 gainSPDef; - u16 fillA; -} LevelData; - // size: 0x1A4 typedef struct unkStruct_808E218_arg { diff --git a/include/position_util.h b/include/position_util.h index eeb6cf82e..03d5f9e29 100644 --- a/include/position_util.h +++ b/include/position_util.h @@ -1,7 +1,7 @@ #ifndef GUARD_POSITION_UTIL_H #define GUARD_POSITION_UTIL_H -#include "position.h" +#include "structs/str_position.h" s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos); s32 GetDistance(Position *pos1, Position *pos2); diff --git a/include/post_office_guide2.h b/include/post_office_guide2.h index 06b1a6f46..f06409d80 100644 --- a/include/post_office_guide2.h +++ b/include/post_office_guide2.h @@ -2,7 +2,7 @@ #define GUARD_POST_OFFICE_GUIDE2_H #include "input.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x78 typedef struct unkStruct_203B330 diff --git a/include/rescue_password_menu.h b/include/rescue_password_menu.h index 5883102fa..c87598d19 100644 --- a/include/rescue_password_menu.h +++ b/include/rescue_password_menu.h @@ -3,7 +3,7 @@ #include "menu.h" #include "sprite.h" -#include "text.h" +#include "structs/str_text.h" // Similar to unkStruct_203B360 struct RescuePasswordMenu diff --git a/include/save.h b/include/save.h index f351fccfe..6ba2fe0e9 100644 --- a/include/save.h +++ b/include/save.h @@ -23,9 +23,9 @@ enum READ_SAVE_CHECKSUM_ERROR }; - -struct UnkStruct_sub_8011DAC { - // size: 0x57D4 +// size: 0x57D4 +struct UnkStruct_sub_8011DAC +{ u8 fill000[0x4]; u8 unk004[0x400]; u8 gameInternalName[0x10]; // has "POKE_DUNGEON__05" @@ -45,8 +45,9 @@ struct UnkStruct_sub_8011DAC { u8 unk448[0x538C]; }; - -struct UnkStruct_203B184 { +// size: 0x5C +struct UnkStruct_203B184 +{ /* 0x0 */ TeamInventory *MoneyItems; /* 0x4 */ unkStruct_203B45C *recruitedPokemon; /* 0x8 */ unkStruct_203B480 *unk8; diff --git a/include/sprite.h b/include/sprite.h index 1bf4e163a..573edc194 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -3,7 +3,7 @@ #include "axdata.h" #include "ground_sprite.h" -#include "position.h" +#include "structs/str_position.h" #include "sprite_oam.h" // size: 0x8 diff --git a/include/status.h b/include/status.h index 011a987f3..98b290e79 100644 --- a/include/status.h +++ b/include/status.h @@ -1,7 +1,7 @@ #ifndef GUARD_STATUS_H #define GUARD_STATUS_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" #define FLASH_FIRE_STATUS_NONE 0 #define FLASH_FIRE_STATUS_MAXED 1 diff --git a/include/status_actions.h b/include/status_actions.h index 953bf93c8..174642611 100644 --- a/include/status_actions.h +++ b/include/status_actions.h @@ -2,7 +2,7 @@ #define GUARD_STATUS_ACTIONS_H #include "constants/move.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 sub_805B668(Entity *pokemon, Entity *target, Move *move, s32 param_4); bool8 sub_805B734(Entity *pokemon, Entity *target); diff --git a/include/status_checks.h b/include/status_checks.h index 9de47e033..3bf06b6ef 100644 --- a/include/status_checks.h +++ b/include/status_checks.h @@ -1,7 +1,7 @@ #ifndef GUARD_STATUS_CHECKS_H #define GUARD_STATUS_CHECKS_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" extern const s16 gConfusedAttackChance; diff --git a/include/status_checks_1.h b/include/status_checks_1.h index 68b94027d..c44cfbe97 100644 --- a/include/status_checks_1.h +++ b/include/status_checks_1.h @@ -1,7 +1,7 @@ #ifndef GUARD_STATUS_CHECKS_1_H #define GUARD_STATUS_CHECKS_1_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" bool8 HasNegativeStatus(Entity *pokemon); bool8 IsSleeping(Entity *pokemon); diff --git a/include/dungeon_entity.h b/include/structs/dungeon_entity.h similarity index 99% rename from include/dungeon_entity.h rename to include/structs/dungeon_entity.h index 76f7ff7e7..3c6602677 100644 --- a/include/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -2,10 +2,10 @@ #define GUARD_DUNGEON_ENTITY_H #include "constants/global.h" -#include "constants/move.h" -#include "items.h" -#include "position.h" +#include "structs/str_position.h" #include "sprite.h" +#include "structs/str_items.h" +#include "structs/str_moves.h" #define MAX_STAT_STAGE 20 #define STAT_MULTIPLIER_THRESHOLD 63 diff --git a/include/map.h b/include/structs/map.h similarity index 95% rename from include/map.h rename to include/structs/map.h index 2ce5f1397..dda57e86f 100644 --- a/include/map.h +++ b/include/structs/map.h @@ -1,8 +1,8 @@ #ifndef GUARD_MAP_H #define GUARD_MAP_H -#include "dungeon_entity.h" -#include "position.h" +#include "structs/dungeon_entity.h" +#include "structs/str_position.h" #define MAX_ROOM_COUNT 24 // Empirical max, not sure if the code supports any more. #define CORRIDOR_ROOM 0xFF diff --git a/include/dungeon_global_data.h b/include/structs/str_dungeon.h similarity index 97% rename from include/dungeon_global_data.h rename to include/structs/str_dungeon.h index d41e27026..bb65b6992 100644 --- a/include/dungeon_global_data.h +++ b/include/structs/str_dungeon.h @@ -1,12 +1,12 @@ -#ifndef GUARD_DUNGEON_DATA_H -#define GUARD_DUNGEON_DATA_H +#ifndef GUARD_STR_DUNGEON_H +#define GUARD_STR_DUNGEON_H #include "global.h" #include "constants/monster.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" #include "file_system.h" -#include "map.h" -#include "position.h" +#include "structs/map.h" +#include "structs/str_position.h" #include "sprite.h" #define DUNGEON_MAX_SIZE_X 56 @@ -202,7 +202,7 @@ typedef struct Dungeon /* 0x17B38 */ u32 unk17B38; /* 0x17B3C */ u32 unk17B3C; u8 fill17B40[0x17B44 - 0x17B40]; - /* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX + 1]; + /* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX]; /* 0x181E4 */ OpenedFile *paletFile; /* 0x181E8 */ Position cameraPos; /* 0x181EC */ Position cameraPosMirror; @@ -236,4 +236,4 @@ typedef struct Dungeon extern Dungeon *gDungeon; -#endif +#endif // GUARD_STR_DUNGEON_H \ No newline at end of file diff --git a/include/structs/str_items.h b/include/structs/str_items.h new file mode 100644 index 000000000..ab1933e6e --- /dev/null +++ b/include/structs/str_items.h @@ -0,0 +1,88 @@ +#ifndef GUARD_STR_ITEMS_H +#define GUARD_STR_ITEMS_H + +#include "constants/item.h" + +// size: 0x20 +typedef struct ItemDataEntry +{ + /* 0x0 */ u8 *name; + /* 0x4 */ u32 buyPrice; + /* 0x8 */ u32 sellPrice; + /* 0xC */ u8 category; + /* 0xD */ u8 icon; + /* 0x10 */ u8 *description; + // Determines how the AI can use the item. + // Index 0: Item can be used on self. + // Index 1: Item can be thrown at allies. + // Index 2: Item can be thrown at enemies. + /* 0x14 */ bool8 aiFlags[3]; + /* 0x18 */ s16 moveID; + /* 0x1A */ u8 order; // Numbered order they are in storage + /* 0x1B */ u8 spawnAmountRange[2]; + /* 0x1D */ u8 palette; + /* 0x1E */ u8 actionType; +} ItemDataEntry; + +// size: 0x4 +typedef struct Item +{ + /* 0x0 */ u8 flags; + /* 0x1 */ u8 quantity; + /* 0x2 */ u8 id; +} Item; + +// size: 0x4 +typedef struct BulkItem +{ + /* 0x0 */ u8 id; + /* 0x1 */ u8 quantity; +} BulkItem; + +// size: 0x4 +typedef struct Gummi +{ + /* 0x0 */ s16 boostAmount; + /* 0x2 */ u16 flags; +} Gummi; + +// size: 0xC +typedef struct unkStruct_8090F58 +{ + u32 unk0; + u8 unk4; + u8 unk5; + s16 unk6; + u8 unk8; +} unkStruct_8090F58; + +// size: 0x268 +typedef struct TeamInventory +{ + /* 0x0 */ Item teamItems[INVENTORY_SIZE]; + /* 0x50 */ u16 teamStorage[STORAGE_SIZE]; + /* 0x230 */ BulkItem kecleonShopItems[MAX_KECLEON_ITEM_SHOP_ITEMS]; + /* 0x250 */ BulkItem kecleonWareItems[MAX_KECLEON_WARE_SHOP_ITEMS]; + /* 0x260 */ s32 teamMoney; + /* 0x264 */ s32 teamSavings; +} TeamInventory; + +// TODO: These should be in constants/ + +enum ItemFlag +{ + ITEM_FLAG_EXISTS = 1 << 0, + ITEM_FLAG_IN_SHOP = 1 << 1, // in a Kecleon shop + ITEM_FLAG_UNPAID = 1 << 2, // Picked up in Kecleon shop but not paid for yet + ITEM_FLAG_STICKY = 1 << 3, + ITEM_FLAG_SET = 1 << 4 // This item can be thrown by pressing L+R instead of having to go to the bag menu. +}; + +enum ItemAIFlag +{ + ITEM_AI_FLAG_TARGET_SELF, + ITEM_AI_FLAG_TARGET_ALLY, + ITEM_AI_FLAG_TARGET_ENEMY +}; + +#endif // GUARD_STR_ITEMS_H \ No newline at end of file diff --git a/include/structs/str_moves.h b/include/structs/str_moves.h new file mode 100644 index 000000000..68b63ca97 --- /dev/null +++ b/include/structs/str_moves.h @@ -0,0 +1,42 @@ +#ifndef GUARD_STR_MOVES_H +#define GUARD_STR_MOVES_H + +#include "constants/move.h" + +// size: 0x24 +typedef struct MoveDataEntry +{ + /* 0x0 */ u8 *name; + /* 0x4 */ s16 basePower; + /* 0x6 */ u8 type; + // Determines the range of moves. + /* 0x8 */ u16 targetingFlags[2]; // 0 for player and 1 for AI + // The AI consider certain moves to have different range than they actually do. + /* 0xC */ u8 basePP; + /* 0xD */ u8 aiWeight; + // There are multiple accuracy values. These are define with the AccuracyType enum. + /* 0xE */ u8 accuracy[NUM_ACCURACY_TYPES]; + /* 0x11 */ u8 numberOfChainedHits; // Maximum number of times the move will hit. Used for multi-hit moves like Fury Attack. + /* 0x12 */ u8 maxUpgradeLevel; + /* 0x13 */ u8 critChance; + /* 0x14 */ bool8 affectedByMagicCoat; // If true, this move is reflected by Magic Coat. + /* 0x15 */ bool8 isSnatchable; + /* 0x16 */ bool8 usesMouth; // If true, this move can't be used with the Muzzled status. + /* 0x17 */ bool8 cannotHitFrozen; // Used by Status Checker to determine if a move can be used on a frozen target. + /* 0x18 */ bool8 ignoresTaunted; + /* 0x19 */ u8 rangeID; + /* 0x1C */ u8 *description; + /* 0x20 */ u8 *useText; // The text displayed when this move is used. +} MoveDataEntry; + +// size: 0x8 +typedef struct Move +{ + u8 moveFlags; + u8 moveFlags2; + u16 id; + u8 PP; + u8 ginseng; // How much the move is boosted by Ginsengs. +} Move; + +#endif // GUARD_STR_MOVES_H \ No newline at end of file diff --git a/include/structs/str_pokemon.h b/include/structs/str_pokemon.h new file mode 100644 index 000000000..b09029254 --- /dev/null +++ b/include/structs/str_pokemon.h @@ -0,0 +1,167 @@ +#ifndef GUARD_STR_POKEMON_H +#define GUARD_STR_POKEMON_H + +#include "constants/monster.h" +#include "structs/str_dungeon.h" +#include "structs/str_items.h" +#include "structs/str_moves.h" + +// size: 0x4 +typedef struct Offense +{ + /* 0x0 */ u8 att[2]; // Atk, SpAtk + /* 0x2 */ u8 def[2]; // Def, SpDef +} Offense; + +// size: 0x4 +typedef struct unkPokeSubStruct_C +{ + u8 level; + u8 fill1[3]; +} unkPokeSubStruct_C; + +// size: 0x58 +typedef struct PokemonStruct1 +{ + u16 unk0; // Probably a union: Sometimes ldrh and sometimes ldrb. Recruited?? + /* 0x2 */ bool8 isTeamLeader; + /* 0x3 */ u8 level; + /* 0x4 */ DungeonLocation dungeonLocation; + /* 0x8 */ s16 speciesNum; + unkPokeSubStruct_C unkC[2]; + /* 0x14 */ s16 IQ; + /* 0x16 */ u16 pokeHP; + /* 0x18 */ Offense offense; + /* 0x1C */ u32 currExp; + /* 0x20 */ u32 IQSkills; + /* 0x24 */ u8 tacticIndex; + /* 0x28 */ BulkItem heldItem; + /* 0x2C */ Move moves[MAX_MON_MOVES]; + /* 0x4C */ u8 name[POKEMON_NAME_LENGTH]; +} PokemonStruct1; + +// size: 0x4 +typedef struct unkStruct_808E6F4 +{ + s16 unk0; + u8 unk2; +} unkStruct_808E6F4; + +// size: 0x4 +typedef struct EvolveStage +{ + /* 0x0 */ s16 speciesNum; + /* 0x2 */ u8 level; +} EvolveStage; + +// size: 0x24 +typedef struct unkStruct_8094184 +{ + /* 0x0 */ Move moves[MAX_MON_MOVES]; + u8 unk20; +} unkStruct_8094184; + +// size: 0x64 +typedef struct PokemonStruct2 +{ + u16 unk0; // corresponds to unk0 in PokemonStruct + /* 0x2 */ bool8 isTeamLeader; + /* 0x3 */ u8 level; + /* 0x4 */ DungeonLocation dungeonLocation; + /* 0x8 */ u16 IQ; + s16 unkA; + u16 unkC; + /* 0xE */ s16 speciesNum; + u16 unk10; // pokeHP + u16 unk12; // pokeHP + /* 0x14 */ Offense offense; // offense (other offset) + /* 0x18 */ u32 currExp; + /* 0x1C */ unkStruct_8094184 moves; + /* 0x40 */ Item itemSlot; // heldItem + u32 unk44; // some struct + u32 unk48; // some struct (same type as 44) + /* 0x4C */ u32 IQSkills; // unk20 + /* 0x50 */ u8 tacticIndex; + unkStruct_808E6F4 unk54; + /* 0x58 */ u8 name[POKEMON_NAME_LENGTH]; // name (other offset) +} PokemonStruct2; + +// size: 0x90E8 +typedef struct unkStruct_203B45C +{ + /* 0x0 */ PokemonStruct1 pokemon[NUM_MONSTERS]; + /* 0x8DF8 */ PokemonStruct2 pokemon2[4]; + /* 0x8F88 */ PokemonStruct1 team[MAX_TEAM_MEMBERS]; +} unkStruct_203B45C; + +// size: 0x4 +typedef struct PreEvolution +{ + /* 0x0 */ s16 evolveFrom; + /* 0x2 */ u16 evolveType; +} PreEvolution; + +// size: 0x4 +typedef struct EvolutionRequirements +{ + /* 0x0 */ s16 mainRequirement; + /* 0x2 */ u16 additionalRequirement; +} EvolutionRequirements; + +// size: 0x8 +typedef struct unkEvolve +{ + /* 0x0 */ PreEvolution preEvolution; + /* 0x4 */ EvolutionRequirements evolutionRequirements; +} unkEvolve; + +// size: 0x48 +typedef struct MonsterDataEntry +{ + /* 0x0 */ u8* species; + /* 0x4 */ u8* category; + /* 0x8 */ u8 overworldPalette; + /* 0x9 */ u8 bodySize; + /* 0xC */ s32 movementSpeed; + /* 0x10 */ u16 dialogueSprites; // Bitwise flags for whether a dialogue sprite/portrait is available for each emotion. + bool8 unk12; + /* 0x13 */ u8 types[2]; + /* 0x15 */ u8 movementType; + /* 0x16 */ u8 friendArea; + /* 0x17 */ u8 abilities[2]; + /* 0x19 */ u8 shadowSize; + u8 fill1A; // 0 for all Pokémon. + /* 0x1B */ u8 regenSpeed; // 100 for all Pokémon. + /* 0x1C */ bool8 canMove; // Set to false for Pokémon who don't move unless they're the leader, like Kakuna. + /* 0x1D */ u8 chanceAsleep; + /* 0x1E */ u16 baseHP; + /* 0x20 */ s32 expYield; + /* 0x24 */ u16 baseAtkSpAtk[2]; + /* 0x28 */ u16 baseDefSpDef[2]; + /* 0x2C */ u16 weight; + /* 0x2E */ u16 size; + u8 unk30; // 10 for all Pokémon. + u8 unk31; // 10 for all Pokémon. + u8 unk32; // 24 for all Pokémon. + /* 0x33 */ bool8 toolboxEnabled; // If false, the AI can't use items. Doesn't seem to be used, as it's true for all Pokémon. + /* 0x34 */ PreEvolution preEvolution; + /* 0x38 */ EvolutionRequirements evolutionRequirements; + /* 0x3C */ s16 dexInternal[2]; // dexNo and internalNo + /* 0x40 */ s16 recruitRate; + /* 0x42 */ s16 alphabetParent[2]; // alphabetNo and parentNo +} MonsterDataEntry; + +// size: 0xC | https://www.pokecommunity.com/showthread.php?t=407371 +typedef struct LevelData +{ + /* 0x0 */ s32 expRequired; + /* 0x4 */ u8 gainHP; + /* 0x5 */ u8 gainUnused; + /* 0x6 */ u8 gainAtt; + /* 0x7 */ u8 gainSPAtt; + /* 0x8 */ u8 gainDef; + /* 0x9 */ u8 gainSPDef; + u16 fillA; +} LevelData; + +#endif // GUARD_STR_POKEMON_H \ No newline at end of file diff --git a/include/position.h b/include/structs/str_position.h similarity index 68% rename from include/position.h rename to include/structs/str_position.h index f2be31c70..cfd0f7701 100644 --- a/include/position.h +++ b/include/structs/str_position.h @@ -1,5 +1,5 @@ -#ifndef GUARD_POSITION_H -#define GUARD_POSITION_H +#ifndef GUARD_STR_POSITION_H +#define GUARD_STR_POSITION_H // size: 0x4 typedef struct Position @@ -15,4 +15,4 @@ typedef struct Position32 /* 0x4 */ s32 y; } Position32; -#endif // GUARD_POSITION_H \ No newline at end of file +#endif // GUARD_STR_POSITION_H \ No newline at end of file diff --git a/include/text.h b/include/structs/str_text.h similarity index 94% rename from include/text.h rename to include/structs/str_text.h index c1fdee4a9..d30e4756c 100644 --- a/include/text.h +++ b/include/structs/str_text.h @@ -1,5 +1,5 @@ -#ifndef GUARD_TEXT_H -#define GUARD_TEXT_H +#ifndef GUARD_STR_TEXT_H +#define GUARD_STR_TEXT_H // size: 0x48 typedef struct UnkTextStruct1 @@ -58,4 +58,4 @@ typedef struct UnkTextStruct2 const u8 *unk14; } UnkTextStruct2; -#endif // GUARD_TEXT_H \ No newline at end of file +#endif // GUARD_STR_TEXT_H \ No newline at end of file diff --git a/include/subStruct_203B240.h b/include/structs/subStruct_203B240.h similarity index 55% rename from include/subStruct_203B240.h rename to include/structs/subStruct_203B240.h index 882102e1f..422c6b4de 100644 --- a/include/subStruct_203B240.h +++ b/include/structs/subStruct_203B240.h @@ -1,11 +1,11 @@ #ifndef GUARD_SUBSTRUCT_203B240_H #define GUARD_SUBSTRUCT_203B240_H +// size: 0x8 struct subStruct_203B240 { - char * pokeName; - char * unk4; + u8 *pokeName; + u8 *unk4; }; - -#endif +#endif // GUARD_SUBSTRUCT_203B240_H \ No newline at end of file diff --git a/include/targeting.h b/include/targeting.h index 647e7291a..e4602f3fb 100644 --- a/include/targeting.h +++ b/include/targeting.h @@ -1,7 +1,7 @@ #ifndef GUARD_TARGETING_H #define GUARD_TARGETING_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" void TargetTileInFront(Entity *pokemon); diff --git a/include/targeting_flags.h b/include/targeting_flags.h index eddbe8d71..7960d5c0a 100644 --- a/include/targeting_flags.h +++ b/include/targeting_flags.h @@ -2,7 +2,7 @@ #define GUARD_TARGETING_FLAGS_H #include "constants/move.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI); diff --git a/include/text1.h b/include/text1.h index 4b7acb1f8..fa1e70186 100644 --- a/include/text1.h +++ b/include/text1.h @@ -1,7 +1,7 @@ #ifndef GUARD_TEXT1_H #define GUARD_TEXT1_H -#include "text.h" +#include "structs/str_text.h" extern UnkTextStruct1 gUnknown_2027370[4]; extern UnkTextStruct2 gUnknown_202AFC0[4]; diff --git a/include/text2.h b/include/text2.h index 9520dfe35..2b526dbed 100644 --- a/include/text2.h +++ b/include/text2.h @@ -1,7 +1,7 @@ #ifndef GUARD_TEXT2_H #define GUARD_TEXT2_H -#include "text.h" +#include "structs/str_text.h" // size: 0x10 struct unkShiftData diff --git a/include/tile_types.h b/include/tile_types.h index e83466f19..0c7edcd75 100644 --- a/include/tile_types.h +++ b/include/tile_types.h @@ -1,7 +1,7 @@ #ifndef GUARD_TILE_TYPES_H #define GUARD_TILE_TYPES_H -#include "map.h" +#include "structs/map.h" #define DUNGEON_WATER_TYPE_NONE 0 #define DUNGEON_WATER_TYPE_LAVA 1 diff --git a/include/trade_items_menu.h b/include/trade_items_menu.h index f55cf086a..b409692e3 100644 --- a/include/trade_items_menu.h +++ b/include/trade_items_menu.h @@ -1,7 +1,7 @@ #ifndef GUARD_TRADE_ITEMS_MENU_H #define GUARD_TRADE_ITEMS_MENU_H -#include "text.h" +#include "structs/str_text.h" #include "items.h" #include "menu.h" diff --git a/include/trap.h b/include/trap.h index 67db9287d..6781e9fc2 100644 --- a/include/trap.h +++ b/include/trap.h @@ -1,7 +1,7 @@ #ifndef GUARD_TRAP_H #define GUARD_TRAP_H -#include "position.h" +#include "structs/str_position.h" bool8 CanLayTrap(Position *pos); diff --git a/include/type_effectiveness.h b/include/type_effectiveness.h index 61d7975a7..3cb0a0778 100644 --- a/include/type_effectiveness.h +++ b/include/type_effectiveness.h @@ -1,7 +1,7 @@ #ifndef GUARD_TYPE_EFFECTIVENESS_H #define GUARD_TYPE_EFFECTIVENESS_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" s32 WeightWeakTypePicker(Entity *user, Entity *target, u8 moveType); diff --git a/include/weather.h b/include/weather.h index 9b45f9883..f1a0407ac 100644 --- a/include/weather.h +++ b/include/weather.h @@ -1,7 +1,7 @@ #ifndef GUARD_WEATHER_H #define GUARD_WEATHER_H -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" u8 GetApparentWeather(Entity *pokemon); diff --git a/include/wigglytuff_shop1.h b/include/wigglytuff_shop1.h index f58172469..86cf59dbc 100644 --- a/include/wigglytuff_shop1.h +++ b/include/wigglytuff_shop1.h @@ -3,7 +3,7 @@ #include "constants/friend_area.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" typedef struct WigglytuffShop1Work { diff --git a/include/wigglytuff_shop2.h b/include/wigglytuff_shop2.h index ea7442c8e..68a73faa8 100644 --- a/include/wigglytuff_shop2.h +++ b/include/wigglytuff_shop2.h @@ -2,7 +2,7 @@ #define GUARD_WIGGLYTUFF_SHOP2_H #include "input.h" -#include "text.h" +#include "structs/str_text.h" typedef struct WigglytuffShop2Work { diff --git a/include/wigglytuff_shop3.h b/include/wigglytuff_shop3.h index bf971dc98..7525511ae 100644 --- a/include/wigglytuff_shop3.h +++ b/include/wigglytuff_shop3.h @@ -3,7 +3,7 @@ #include "file_system.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" enum WigglytuffStates { diff --git a/include/wonder_mail.h b/include/wonder_mail.h index 8794f94f5..e30e7a595 100644 --- a/include/wonder_mail.h +++ b/include/wonder_mail.h @@ -7,7 +7,7 @@ #include "items.h" #include "menu.h" #include "pokemon.h" -#include "text.h" +#include "structs/str_text.h" // size: 0x28 typedef struct unkStruct_802F204 diff --git a/include/wonder_mail_2_1.h b/include/wonder_mail_2_1.h index 660d1506f..8a5be2d8c 100644 --- a/include/wonder_mail_2_1.h +++ b/include/wonder_mail_2_1.h @@ -5,7 +5,7 @@ #include "constants/mailbox.h" #include "input.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" // size: 0xA8 struct unkStruct_203B2E8 diff --git a/include/wonder_mail_3.h b/include/wonder_mail_3.h index 9bc3bc55c..4aa751a4c 100644 --- a/include/wonder_mail_3.h +++ b/include/wonder_mail_3.h @@ -4,7 +4,7 @@ #include "code_802C39C.h" #include "input.h" #include "menu.h" -#include "text.h" +#include "structs/str_text.h" #include "wonder_mail.h" // size: 0xB4 diff --git a/ld_script.txt b/ld_script.txt index d4b0e54a8..ae7a88863 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -121,10 +121,8 @@ SECTIONS { src/wigglytuff_shop1.o(.text); src/wigglytuff_shop2.o(.text); src/wigglytuff_shop3.o(.text); - src/code_8023144_pre.o(.text); - asm/code_8023144.o(.text); + src/code_80227B8.o(.text); src/code_8023144.o(.text); - asm/code_801EE10_1.o(.text); asm/code_8023868.o(.text); src/code_8023868.o(.text); src/code_8024458.o(.text); @@ -437,7 +435,8 @@ SECTIONS { src/wigglytuff_shop1.o(.rodata); src/wigglytuff_shop2.o(.rodata); src/wigglytuff_shop3.o(.rodata); - data/data_80DC464.o(.rodata); + src/code_80227B8.o(.rodata); + src/code_8023144.o(.rodata); src/code_8023868.o(.rodata); src/code_8024458.o(.rodata); src/luminous_cave.o(.rodata); diff --git a/src/code_801D014.c b/src/code_801D014.c index f8b6a17d7..62011ec3d 100644 --- a/src/code_801D014.c +++ b/src/code_801D014.c @@ -4,7 +4,7 @@ #include "code_80130A8.h" #include "code_801BEEC.h" #include "code_801D014.h" -#include "code_8023144.h" +#include "code_80227B8.h" #include "code_8023868.h" #include "code_8024458.h" #include "code_8096AF8.h" diff --git a/src/code_801EE10_mid.c b/src/code_801EE10_mid.c index 6ff2742a7..387cc8b43 100644 --- a/src/code_801EE10_mid.c +++ b/src/code_801EE10_mid.c @@ -7,7 +7,7 @@ #include "moves.h" #include "code_801EE10.h" #include "menu_input.h" -#include "subStruct_203B240.h" +#include "structs/subStruct_203B240.h" #include "sprite.h" #include "code_80130A8.h" #include "code_801EE10_mid.h" @@ -333,9 +333,9 @@ void sub_801F930(void) void sub_801F9A4(void) { - char **name; - switch(gUnknown_203B278->state) - { + u8 **name; + + switch (gUnknown_203B278->state) { case 0: sub_8008C54(gUnknown_203B278->unk5C); gUnknown_203B278->unk8 = gUnknown_203B278->moveIDs[gUnknown_203B278->unk28.unk1E]; diff --git a/src/code_80227B8.c b/src/code_80227B8.c new file mode 100644 index 000000000..ebdc1628e --- /dev/null +++ b/src/code_80227B8.c @@ -0,0 +1,852 @@ +#include "global.h" +#include "code_80130A8.h" +#include "code_801AFA4.h" +#include "code_801B3C0.h" +#include "code_80227B8.h" +#include "code_8098BDC.h" +#include "common_strings.h" +#include "constants/colors.h" +#include "kecleon_bros4.h" +#include "memory.h" +#include "menu_input.h" +#include "pokemon_3.h" +#include "text1.h" +#include "text2.h" + +extern u8 gUnknown_202DE58[]; +extern u8 gAvailablePokemonNames[]; // 202DF98 + +static EWRAM_DATA_2 unkStruct_203B294 *sUnknown_203B294 = {0}; + +#include "data/code_80227B8.h" + +static void sub_8022924(s32 newState); +static void sub_802293C(void); +static void sub_8022A10(void); +static void sub_8022D2C(void); +static void sub_8022E78(void); +static void sub_8022EF4(void); +static void sub_8023068(void); +static void sub_80230E8(void); +static void sub_8023104(void); +static void sub_8023120(void); + +bool8 sub_80227B8(PokemonStruct1 *pkmn) +{ + ResetUnusedInputStruct(); + sub_800641C(NULL, TRUE, TRUE); + + sUnknown_203B294 = MemoryAlloc(sizeof(unkStruct_203B294), 8); + sUnknown_203B294->menuAction = 0; + sUnknown_203B294->pokeStruct = pkmn; + + if (pkmn != NULL) { + PrintColoredPokeNameToBuffer(gAvailablePokemonNames, pkmn, COLOR_WHITE_2); + PrintColoredPokeNameToBuffer(gAvailablePokemonNames + 80, pkmn, COLOR_YELLOW); + + if (HasGummiItem()) + sub_8022924(0); + else + sub_8022924(17); + } + else { + strcpy(gAvailablePokemonNames, sTripleQuestionMark); + strcpy(gAvailablePokemonNames + 80, sTripleQuestionMark); + + if (GetNumberOfFilledInventorySlots() == 0) + sub_8022924(18); + else + sub_8022924(00); + } + + return TRUE; +} + +u32 sub_8022860(void) +{ + switch (sUnknown_203B294->state) { + case 0: + case 1: + sub_8022E78(); + break; + case 2: + sub_8022EF4(); + break; + case 3: + sub_8023068(); + break; + case 4: + sub_80230E8(); + break; + case 0x15: + sub_8023104(); + break; + case 0x16: + return 3; + default: + sub_8023120(); + break; + } + return 0; +} + +void sub_8022908(void) +{ + if (sUnknown_203B294) { + MemoryFree(sUnknown_203B294); + sUnknown_203B294 = NULL; + } +} + +static void sub_8022924(s32 newState) +{ + sUnknown_203B294->state = newState; + sub_802293C(); + sub_8022A10(); +} + +static void sub_802293C(void) +{ + s32 i; + + sub_8006518(sUnknown_203B294->unk148); + + switch (sUnknown_203B294->state) { + case 2: + sub_8022D2C(); + sUnknown_203B294->unk148[2] = sUnknown_80DC5BC; + sub_8012CAC(&sUnknown_203B294->unk148[2], sUnknown_203B294->unkF8); + sUnknown_203B294->unk148[2].unkC = 6; + break; + case 3: + sUnknown_203B294->unk148[1] = sUnknown_80DC5D4; + break; + default: + for (i = 0; i < 4; i++) + sUnknown_203B294->unk148[i] = sUnknown_80DC5A4; + break; + case 10 ... 16: + break; + } + + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B294->unk148, TRUE, TRUE); +} + +#ifdef NONMATCHING // 90.42%. Functionally equivalent but code is placed in the wrong location: https://decomp.me/scratch/HzklC +static void sub_8022A10(void) +{ + s32 r3; + bool8 r5; + bool8 r6; + + switch (sUnknown_203B294->state) { + case 0: + if (sUnknown_203B294->pokeStruct != NULL) + sub_801A5D8(5, 3, NULL, 10); + else + sub_801A5D8(1, 3, NULL, 10); + break; + case 1: + sub_801A8D0(TRUE); + break; + case 2: + sub_801A9E0(); + sub_8012D60(&sUnknown_203B294->unk54, sUnknown_203B294->unkF8, 0, sUnknown_203B294->unk138, sUnknown_203B294->menuAction, 2); + break; + case 3: + sub_801A9E0(); + sub_8012EA4(&sUnknown_203B294->unk54, FALSE); + sub_8012D60(&sUnknown_203B294->unkA4, sUnknown_80DC584, 0, 0, 3, 1); + break; + case 4: + sub_801B3C0(&sUnknown_203B294->item); + break; + case 5: + sub_80141B4(sDoesNotAppearHungry, 0, 0, 0x301); + break; + case 6: + sub_80141B4(sFmtGummiBigFav, 0, 0, 0x101); + break; + case 7: + sub_80141B4(sFmtGummiFav, 0, 0, 0x101); + break; + case 8: + sub_80141B4(sFmtGummiOkay, 0, 0, 0x101); + break; + case 9: + sub_80141B4(sFmtGummiSatisfied, 0, 0, 0x101); + break; + case 10: + while (++sUnknown_203B294->unk40 < NUM_IQ_SKILLS) { + r5 = FALSE; + r6 = FALSE; + + for (r3 = 0; r3 < sUnknown_203B294->availIQSkillPreGummi; r3++) { + if (sUnknown_203B294->iqSkillPreGummi[r3] == sUnknown_203B294->unk40) { + r5 = TRUE; + break; + } + } + + for (r3 = 0; r3 < sUnknown_203B294->availIQSkillPostGummi; r3++) { + if (sUnknown_203B294->iqSkillPostGummi[r3] == sUnknown_203B294->unk40) { + r6 = TRUE; + break; + } + } + + if (r5 != r6) { + sUnknown_203B294->fallbackState = 10; + strcpy(gUnknown_202DEA8, GetIQSkillName(sUnknown_203B294->unk40)); + PlaySound(203); + sub_80141B4(sFmtIQHelpedLearn, 0, 0, 0x101); + sUnknown_203B294->unk40++; + break; + } + } + if (sUnknown_203B294->unk40 >= NUM_IQ_SKILLS) + sub_8022924(11); + break; + case 11: + sUnknown_203B294->fallbackState = 22; + nullsub_104(); + + switch (sUnknown_203B294->gummi.flags) { + case 0: + sub_8022924(22); + break; + case 1: + sub_8022924(13); + break; + case 2: + sub_8022924(14); + break; + case 4: + sub_8022924(15); + break; + case 8: + sub_8022924(16); + break; + default: + sub_8022924(12); + break; + } + break; + case 12: + sub_80141B4(sFmtPlusEverything, 0, 0, 0x301); + break; + case 13: + sub_80141B4(sFmtPlusAtk, 0, 0, 0x301); + break; + case 14: + sub_80141B4(sFmtPlusSpAtk, 0, 0, 0x301); + break; + case 15: + sub_80141B4(sFmtPlusDef, 0, 0, 0x301); + break; + case 16: + sub_80141B4(sFmtPlusSpDef, 0, 0, 0x301); + break; + case 17: + sUnknown_203B294->fallbackState = 22; + sub_80141B4(sNoGummis, 0, 0, 0x301); + break; + case 18: + sUnknown_203B294->fallbackState = 22; + sub_80141B4(sNoItem, 0, 0, 0x301); + break; + case 19: + sUnknown_203B294->fallbackState = 22; + sub_80141B4(sGummiGone, 0, 0, 0x301); + break; + case 20: + sUnknown_203B294->fallbackState = 22; + sub_80141B4(sItemGone, 0, 0, 0x301); + break; + case 21: + sub_801AFA4(sUnknown_203B294->itemIndex); + break; + case 22: + default: + sub_801A928(); + break; + } +} +#else +NAKED static void sub_8022A10(void) +{ + asm_unified( + "\tpush {r4-r7,lr}\n" + "\tsub sp, 0x8\n" + "\tldr r1, _08022A2C\n" + "\tldr r0, [r1]\n" + "\tldr r0, [r0]\n" + "\tadds r4, r1, 0\n" + "\tcmp r0, 0x16\n" + "\tbls _08022A22\n" + "\tb _08022D1E\n" +"_08022A22:\n" + "\tlsls r0, 2\n" + "\tldr r1, _08022A30\n" + "\tadds r0, r1\n" + "\tldr r0, [r0]\n" + "\tmov pc, r0\n" + "\t.align 2, 0\n" +"_08022A2C: .4byte sUnknown_203B294\n" +"_08022A30: .4byte _08022A34\n" + "\t.align 2, 0\n" +"_08022A34:\n" + "\t.4byte _08022A90\n" + "\t.4byte _08022AAA\n" + "\t.4byte _08022AB2\n" + "\t.4byte _08022AE0\n" + "\t.4byte _08022B10\n" + "\t.4byte _08022B1A\n" + "\t.4byte _08022B24\n" + "\t.4byte _08022B34\n" + "\t.4byte _08022B44\n" + "\t.4byte _08022B54\n" + "\t.4byte _08022B64\n" + "\t.4byte _08022C28\n" + "\t.4byte _08022CA0\n" + "\t.4byte _08022CA8\n" + "\t.4byte _08022CB0\n" + "\t.4byte _08022CB8\n" + "\t.4byte _08022CC0\n" + "\t.4byte _08022CC8\n" + "\t.4byte _08022CD8\n" + "\t.4byte _08022CE8\n" + "\t.4byte _08022CF8\n" + "\t.4byte _08022D14\n" + "\t.4byte _08022D1E\n" +"_08022A90:\n" + "\tldr r0, [r4]\n" + "\tldr r0, [r0, 0x48]\n" + "\tcmp r0, 0\n" + "\tbeq _08022A9C\n" + "\tmovs r0, 0x5\n" + "\tb _08022A9E\n" +"_08022A9C:\n" + "\tmovs r0, 0x1\n" +"_08022A9E:\n" + "\tmovs r1, 0x3\n" + "\tmovs r2, 0\n" + "\tmovs r3, 0xA\n" + "\tbl sub_801A5D8\n" + "\tb _08022D22\n" +"_08022AAA:\n" + "\tmovs r0, 0x1\n" + "\tbl sub_801A8D0\n" + "\tb _08022D22\n" +"_08022AB2:\n" + "\tbl sub_801A9E0\n" + "\tldr r0, _08022ADC\n" + "\tldr r2, [r0]\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0x54\n" + "\tadds r1, r2, 0\n" + "\tadds r1, 0xF8\n" + "\tmovs r4, 0x9C\n" + "\tlsls r4, 1\n" + "\tadds r3, r2, r4\n" + "\tadds r2, 0xF4\n" + "\tldr r2, [r2]\n" + "\tstr r2, [sp]\n" + "\tmovs r2, 0x2\n" + "\tstr r2, [sp, 0x4]\n" + "\tmovs r2, 0\n" + "\tbl sub_8012D60\n" + "\tb _08022D22\n" + "\t.align 2, 0\n" +"_08022ADC: .4byte sUnknown_203B294\n" +"_08022AE0:\n" + "\tbl sub_801A9E0\n" + "\tldr r4, _08022B08\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x54\n" + "\tmovs r1, 0\n" + "\tbl sub_8012EA4\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0xA4\n" + "\tldr r1, _08022B0C\n" + "\tmovs r2, 0x3\n" + "\tstr r2, [sp]\n" + "\tmovs r2, 0x1\n" + "\tstr r2, [sp, 0x4]\n" + "\tmovs r2, 0\n" + "\tmovs r3, 0\n" + "\tbl sub_8012D60\n" + "\tb _08022D22\n" + "\t.align 2, 0\n" +"_08022B08: .4byte sUnknown_203B294\n" +"_08022B0C: .4byte sUnknown_80DC584\n" +"_08022B10:\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x50\n" + "\tbl sub_801B3C0\n" + "\tb _08022D22\n" +"_08022B1A:\n" + "\tldr r0, _08022B20\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022B20: .4byte sDoesNotAppearHungry\n" +"_08022B24:\n" + "\tldr r0, _08022B2C\n" + "\tldr r3, _08022B30\n" + "\tb _08022D02\n" + "\t.align 2, 0\n" +"_08022B2C: .4byte sFmtGummiBigFav\n" +"_08022B30: .4byte 0x00000101\n" +"_08022B34:\n" + "\tldr r0, _08022B3C\n" + "\tldr r3, _08022B40\n" + "\tb _08022D02\n" + "\t.align 2, 0\n" +"_08022B3C: .4byte sFmtGummiFav\n" +"_08022B40: .4byte 0x00000101\n" +"_08022B44:\n" + "\tldr r0, _08022B4C\n" + "\tldr r3, _08022B50\n" + "\tb _08022D02\n" + "\t.align 2, 0\n" +"_08022B4C: .4byte sFmtGummiOkay\n" +"_08022B50: .4byte 0x00000101\n" +"_08022B54:\n" + "\tldr r0, _08022B5C\n" + "\tldr r3, _08022B60\n" + "\tb _08022D02\n" + "\t.align 2, 0\n" +"_08022B5C: .4byte sFmtGummiSatisfied\n" +"_08022B60: .4byte 0x00000101\n" +"_08022B64:\n" + "\tldr r7, _08022B68\n" + "\tb _08022B78\n" + "\t.align 2, 0\n" +"_08022B68: .4byte sUnknown_203B294\n" +"_08022B6C:\n" + "\tldr r1, [r4]\n" + "\tldr r0, [r1, 0x40]\n" + "\tadds r0, 0x1\n" + "\tstr r0, [r1, 0x40]\n" + "\tcmp r0, 0x17\n" + "\tbgt _08022C10\n" +"_08022B78:\n" + "\tmovs r5, 0\n" + "\tmovs r6, 0\n" + "\tmovs r3, 0\n" + "\tldr r2, [r4]\n" + "\tldr r0, [r2, 0x38]\n" + "\tcmp r5, r0\n" + "\tbge _08022BA4\n" + "\tldrb r1, [r2, 0x8]\n" + "\tb _08022B9C\n" +"_08022B8A:\n" + "\tadds r3, 0x1\n" + "\tldr r2, [r4]\n" + "\tldr r0, [r2, 0x38]\n" + "\tcmp r3, r0\n" + "\tbge _08022BA4\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0x8\n" + "\tadds r0, r3\n" + "\tldrb r1, [r0]\n" +"_08022B9C:\n" + "\tldr r0, [r2, 0x40]\n" + "\tcmp r1, r0\n" + "\tbne _08022B8A\n" + "\tmovs r5, 0x1\n" +"_08022BA4:\n" + "\tmovs r3, 0\n" + "\tldr r2, [r4]\n" + "\tldr r0, [r2, 0x3C]\n" + "\tcmp r3, r0\n" + "\tbge _08022BCE\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0x20\n" + "\tb _08022BC4\n" +"_08022BB4:\n" + "\tadds r3, 0x1\n" + "\tldr r2, [r4]\n" + "\tldr r0, [r2, 0x3C]\n" + "\tcmp r3, r0\n" + "\tbge _08022BCE\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0x20\n" + "\tadds r0, r3\n" +"_08022BC4:\n" + "\tldrb r1, [r0]\n" + "\tldr r0, [r2, 0x40]\n" + "\tcmp r1, r0\n" + "\tbne _08022BB4\n" + "\tmovs r6, 0x1\n" +"_08022BCE:\n" + "\tcmp r5, r6\n" + "\tbeq _08022B6C\n" + "\tldr r1, [r7]\n" + "\tmovs r0, 0xA\n" + "\tstr r0, [r1, 0x4]\n" + "\tldr r0, [r1, 0x40]\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tbl GetIQSkillName\n" + "\tadds r1, r0, 0\n" + "\tldr r0, _08022C18\n" + "\tbl strcpy\n" + "\tmovs r0, 0xCB\n" + "\tbl PlaySound\n" + "\tldr r0, _08022C1C\n" + "\tmovs r1, 0\n" + "\tmovs r2, 0\n" + "\tldr r3, _08022C20\n" + "\tbl sub_80141B4\n" + "\tldr r1, [r7]\n" + "\tldr r0, [r1, 0x40]\n" + "\tadds r0, 0x1\n" + "\tstr r0, [r1, 0x40]\n" + "\tldr r0, _08022C24\n" + "\tldr r0, [r0]\n" + "\tldr r0, [r0, 0x40]\n" + "\tcmp r0, 0x17\n" + "\tbgt _08022C10\n" + "\tb _08022D22\n" +"_08022C10:\n" + "\tmovs r0, 0xB\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" + "\t.align 2, 0\n" +"_08022C18: .4byte gUnknown_202DEA8\n" +"_08022C1C: .4byte sFmtIQHelpedLearn\n" +"_08022C20: .4byte 0x00000101\n" +"_08022C24: .4byte sUnknown_203B294\n" +"_08022C28:\n" + "\tldr r1, [r4]\n" + "\tmovs r0, 0x16\n" + "\tstr r0, [r1, 0x4]\n" + "\tbl nullsub_104\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x46\n" + "\tldrh r0, [r0]\n" + "\tcmp r0, 0x8\n" + "\tbhi _08022C98\n" + "\tlsls r0, 2\n" + "\tldr r1, _08022C48\n" + "\tadds r0, r1\n" + "\tldr r0, [r0]\n" + "\tmov pc, r0\n" + "\t.align 2, 0\n" +"_08022C48: .4byte _08022C4C\n" + "\t.align 2, 0\n" +"_08022C4C:\n" + "\t.4byte _08022C70\n" + "\t.4byte _08022C78\n" + "\t.4byte _08022C80\n" + "\t.4byte _08022C98\n" + "\t.4byte _08022C88\n" + "\t.4byte _08022C98\n" + "\t.4byte _08022C98\n" + "\t.4byte _08022C98\n" + "\t.4byte _08022C90\n" +"_08022C70:\n" + "\tmovs r0, 0x16\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" +"_08022C78:\n" + "\tmovs r0, 0xD\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" +"_08022C80:\n" + "\tmovs r0, 0xE\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" +"_08022C88:\n" + "\tmovs r0, 0xF\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" +"_08022C90:\n" + "\tmovs r0, 0x10\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" +"_08022C98:\n" + "\tmovs r0, 0xC\n" + "\tbl sub_8022924\n" + "\tb _08022D22\n" +"_08022CA0:\n" + "\tldr r0, _08022CA4\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CA4: .4byte sFmtPlusEverything\n" +"_08022CA8:\n" + "\tldr r0, _08022CAC\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CAC: .4byte sFmtPlusAtk\n" +"_08022CB0:\n" + "\tldr r0, _08022CB4\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CB4: .4byte sFmtPlusSpAtk\n" +"_08022CB8:\n" + "\tldr r0, _08022CBC\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CBC: .4byte sFmtPlusDef\n" +"_08022CC0:\n" + "\tldr r0, _08022CC4\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CC4: .4byte sFmtPlusSpDef\n" +"_08022CC8:\n" + "\tldr r1, [r4]\n" + "\tmovs r0, 0x16\n" + "\tstr r0, [r1, 0x4]\n" + "\tldr r0, _08022CD4\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CD4: .4byte sNoGummis\n" +"_08022CD8:\n" + "\tldr r1, [r4]\n" + "\tmovs r0, 0x16\n" + "\tstr r0, [r1, 0x4]\n" + "\tldr r0, _08022CE4\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CE4: .4byte sNoItem\n" +"_08022CE8:\n" + "\tldr r1, [r4]\n" + "\tmovs r0, 0x16\n" + "\tstr r0, [r1, 0x4]\n" + "\tldr r0, _08022CF4\n" + "\tb _08022D00\n" + "\t.align 2, 0\n" +"_08022CF4: .4byte sGummiGone\n" +"_08022CF8:\n" + "\tldr r1, [r4]\n" + "\tmovs r0, 0x16\n" + "\tstr r0, [r1, 0x4]\n" + "\tldr r0, _08022D0C\n" +"_08022D00:\n" + "\tldr r3, _08022D10\n" +"_08022D02:\n" + "\tmovs r1, 0\n" + "\tmovs r2, 0\n" + "\tbl sub_80141B4\n" + "\tb _08022D22\n" + "\t.align 2, 0\n" +"_08022D0C: .4byte sItemGone\n" +"_08022D10: .4byte 0x00000301\n" +"_08022D14:\n" + "\tldr r0, [r4]\n" + "\tldr r0, [r0, 0x4C]\n" + "\tbl sub_801AFA4\n" + "\tb _08022D22\n" +"_08022D1E:\n" + "\tbl sub_801A928\n" +"_08022D22:\n" + "\tadd sp, 0x8\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0"); +} +#endif // NONMATCHING + +static void sub_8022D2C(void) +{ + s32 index; + s32 loopMax = 0; + + MemoryFill16(sUnknown_203B294->unk138, 0, sizeof(sUnknown_203B294->unk138)); + + if (sUnknown_203B294->pokeStruct) { + sUnknown_203B294->unkF8[loopMax].text = sGive; + sUnknown_203B294->unkF8[loopMax].menuAction = 5; + if (!IsGummiItem(sUnknown_203B294->item.id)) + sUnknown_203B294->unk138[loopMax] = 1; + + loopMax++; + } + else { + if (GetItemCategory(sUnknown_203B294->item.id) == CATEGORY_TMS_HMS) { + sUnknown_203B294->unkF8[loopMax].text = sUse; + sUnknown_203B294->unkF8[loopMax].menuAction = 6; + loopMax++; + } + + sUnknown_203B294->unkF8[loopMax].text = gCommonTrash[0]; + sUnknown_203B294->unkF8[loopMax].menuAction = 4; + loopMax++; + } + + sUnknown_203B294->unkF8[loopMax].text = gCommonInfo[0]; + sUnknown_203B294->unkF8[loopMax].menuAction = 7; + + loopMax++; + sUnknown_203B294->unkF8[loopMax].text = NULL; + sUnknown_203B294->unkF8[loopMax].menuAction = 1; + + for (index = 0; index < loopMax; index++) { + if (sUnknown_203B294->unk138[index] == 0) { + if (sUnknown_203B294->unkF8[index].menuAction == sUnknown_203B294->menuAction) + return; + } + } + + for (index = 0; index < loopMax; index++) { + if (sUnknown_203B294->unk138[index] == 0) { + sUnknown_203B294->menuAction = sUnknown_203B294->unkF8[index].menuAction; + break; + } + } +} + +static void sub_8022E78(void) +{ + switch (sub_801A6E8(TRUE)) { + case 3: + sUnknown_203B294->itemIndex = sub_801A8AC(); + sUnknown_203B294->item = gTeamInventoryRef->teamItems[sUnknown_203B294->itemIndex]; + sub_8022924(2); + break; + case 4: + sUnknown_203B294->itemIndex = sub_801A8AC(); + sUnknown_203B294->item = gTeamInventoryRef->teamItems[sUnknown_203B294->itemIndex]; + sub_8099690(0); + sub_8022924(4); + break; + case 2: + sub_8022924(22); + break; + } +} + +static void sub_8022EF4(void) +{ + s32 menuAction; + s32 boostAmount; + + menuAction = 0; + sub_801A6E8(FALSE); + + if (sub_8012FD8(&sUnknown_203B294->unk54) == 0) { + sub_8013114(&sUnknown_203B294->unk54, &menuAction); + if (menuAction != 1) + sUnknown_203B294->menuAction = menuAction; + } + + switch (menuAction) { + case 1: + sub_8022924(1); + break; + case 2: + case 3: + break; + case 5: + sUnknown_203B294->availIQSkillPreGummi = GetNumAvailableIQSkills(sUnknown_203B294->iqSkillPreGummi, sUnknown_203B294->pokeStruct->IQ); + GetGummiItemStatBoost(sUnknown_203B294->pokeStruct, sUnknown_203B294->item.id, FALSE, &sUnknown_203B294->gummi); + sUnknown_203B294->availIQSkillPostGummi = GetNumAvailableIQSkills(sUnknown_203B294->iqSkillPostGummi, sUnknown_203B294->pokeStruct->IQ); + sUnknown_203B294->unk40 = 1; + boostAmount = sUnknown_203B294->gummi.boostAmount; + + sub_8090E14(gUnknown_202DE58, &gTeamInventoryRef->teamItems[sUnknown_203B294->itemIndex], NULL); + + if (boostAmount != -1) + ShiftItemsDownFrom(sUnknown_203B294->itemIndex); + + sub_8099690(0); + sUnknown_203B294->fallbackState = 10; + + switch (boostAmount + 1) { + case 1: + sub_8022924(6); + break; + case 2: + sub_8022924(7); + break; + case 3: + sub_8022924(8); + break; + case 4: + sub_8022924(9); + break; + default: + case 0: + sUnknown_203B294->fallbackState = 22; + sub_8022924(5); + break; + } + break; + case 6: + sub_8022924(21); + break; + case 4: + sub_8022924(3); + break; + case 7: + sub_8099690(0); + sub_8022924(4); + break; + } +} + +static void sub_8023068(void) +{ + s32 menuAction; + + menuAction = 0; + sub_801A6E8(FALSE); + sub_8012FD8(&sUnknown_203B294->unk54); + + if (sub_8012FD8(&sUnknown_203B294->unkA4) == 0) + sub_8013114(&sUnknown_203B294->unkA4, &menuAction); + + switch (menuAction) { + case 1: + case 3: + sub_8022924(1); + break; + case 2: + ShiftItemsDownFrom(sUnknown_203B294->itemIndex); + if (GetNumberOfFilledInventorySlots() == 0) { + sub_8099690(0); + sub_801A928(); + sub_8022924(20); + } + else + sub_8022924(1); + break; + } +} + +static void sub_80230E8(void) +{ + switch (sub_801B410()) { + case 2: + case 3: + sub_801B450(); + sub_8022924(1); + case 1: + case 0: + break; + } +} + +static void sub_8023104(void) +{ + switch (sub_801B00C()) { + case 2: + case 3: + sub_801B048(); + sub_8022924(1); + case 1: + case 0: + break; + } +} + +static void sub_8023120(void) +{ + s32 temp; + + if (sub_80144A4(&temp) == 0) + sub_8022924(sUnknown_203B294->fallbackState); +} \ No newline at end of file diff --git a/src/code_8023144.c b/src/code_8023144.c index 2a557c721..831bd8733 100644 --- a/src/code_8023144.c +++ b/src/code_8023144.c @@ -1,322 +1,79 @@ #include "global.h" #include "code_800D090.h" #include "code_80118A4.h" -#include "code_80130A8.h" -#include "code_801AFA4.h" -#include "code_801B3C0.h" #include "code_8023144.h" -#include "code_8098BDC.h" -#include "common_strings.h" #include "constants/colors.h" #include "constants/input.h" -#include "constants/iq_skill.h" #include "exclusive_pokemon.h" #include "friend_area.h" -#include "items.h" -#include "kecleon_bros4.h" #include "memory.h" #include "menu_input.h" -#include "pokemon.h" #include "pokemon_3.h" #include "text1.h" #include "text2.h" -IWRAM_DATA unkStruct_3001B5C *gUnknown_3001B5C; -unkStruct_203B294 *gUnknown_203B294; +static EWRAM_DATA_2 u32 gUnknown_203B298 = {0}; +static EWRAM_DATA_2 u16 gUnknown_203B29C = {0}; +static EWRAM_DATA_2 u16 gUnknown_203B29E = {0}; -extern u32 gUnknown_203B298; -extern u16 gUnknown_203B29C; -extern u16 gUnknown_203B29E; -extern UnkTextStruct2 gUnknown_80DC91C; -extern UnkTextStruct2 gUnknown_80DC904; +static IWRAM_DATA unkStruct_3001B5C *gUnknown_3001B5C = {0}; -void sub_8023758(void); -void sub_80237E0(void); -extern void sub_8023730(void); -extern u8 sub_8023704(u8); -extern void sub_8023420(void); -extern void sub_80234BC(void); -extern u32 sub_80236A4(void); +#include "data/code_8023144.h" +static void sub_8023420(void); +static void sub_80234BC(void); +static u32 sub_80236A4(void); +static bool8 sub_8023704(u8 unused); +static void sub_8023730(void); +static void sub_8023758(void); +static void sub_80237E0(void); -extern u8 gUnknown_80DC934[]; - -extern void sub_8008C54(u32); -extern u8 gUnknown_80DC93C[]; - -extern u8 gUnknown_80DC5EC[]; -extern u8 gUnknown_202DE58[]; -extern u8 gUnknown_80DC8F0[]; -extern u8 gUnknown_80DC8F8[]; -extern void sub_8022924(s32); - -void GetGummiItemStatBoost(PokemonStruct1* pokemon, u8 id, bool8 checkBoostFlags, Gummi *gummi); - -extern void sub_801A928(void); - -void sub_8022D2C(void) { - s32 index; - s32 loopMax = 0; - MemoryFill16(gUnknown_203B294->unk138, 0, sizeof(gUnknown_203B294->unk138)); - if(gUnknown_203B294->pokeStruct) - { - gUnknown_203B294->unkF8[loopMax].text = gUnknown_80DC8F0; - gUnknown_203B294->unkF8[loopMax].menuAction = 5; - if(!IsGummiItem(gUnknown_203B294->item.id)) - { - gUnknown_203B294->unk138[loopMax] = 1; - } - loopMax += 1; - } - else { - if(GetItemCategory(gUnknown_203B294->item.id) == CATEGORY_TMS_HMS) - { - gUnknown_203B294->unkF8[loopMax].text = gUnknown_80DC8F8; - gUnknown_203B294->unkF8[loopMax].menuAction = 6; - loopMax += 1; - } - gUnknown_203B294->unkF8[loopMax].text = *gCommonTrash; - gUnknown_203B294->unkF8[loopMax].menuAction = 4; - loopMax += 1; - } - gUnknown_203B294->unkF8[loopMax].text = *gCommonInfo; - gUnknown_203B294->unkF8[loopMax].menuAction = 7; - loopMax += 1; - gUnknown_203B294->unkF8[loopMax].text = NULL; - gUnknown_203B294->unkF8[loopMax].menuAction = 1; - - for(index = 0; index < loopMax; index++) - { - if(gUnknown_203B294->unk138[index] == 0) - { - if(gUnknown_203B294->unkF8[index].menuAction == gUnknown_203B294->menuAction) - return; - } - } - - for(index = 0; index < loopMax; index++) - { - if(gUnknown_203B294->unk138[index] == 0) - { - gUnknown_203B294->menuAction = gUnknown_203B294->unkF8[index].menuAction; - break; - } - } -} - -void sub_8022E78(void) -{ - switch(sub_801A6E8(TRUE)) - { - case 3: - gUnknown_203B294->itemIndex = sub_801A8AC(); - gUnknown_203B294->item = gTeamInventoryRef->teamItems[gUnknown_203B294->itemIndex]; - sub_8022924(2); - break; - case 4: - gUnknown_203B294->itemIndex = sub_801A8AC(); - gUnknown_203B294->item = gTeamInventoryRef->teamItems[gUnknown_203B294->itemIndex]; - sub_8099690(0); - sub_8022924(4); - break; - case 2: - sub_8022924(0x16); - break; - } -} - -void sub_8022EF4(void) +bool8 sub_8023144(s32 a0, s32 index, UnkTextStruct2_sub *sub, u32 a3) { - s32 menuAction; - s32 boostAmount; - - menuAction = 0; - sub_801A6E8(FALSE); - if (sub_8012FD8(&gUnknown_203B294->unk54) == 0) { - sub_8013114(&gUnknown_203B294->unk54,&menuAction); - if(menuAction != 1) gUnknown_203B294->menuAction = menuAction; - } + u8 param_1_u8 = a0; - switch(menuAction) - { - case 1: - sub_8022924(1); - break; - case 2: - case 3: - break; - case 5: - gUnknown_203B294->availIQSkillPreGummi = GetNumAvailableIQSkills(gUnknown_203B294->iqSkillPreGummi, gUnknown_203B294->pokeStruct->IQ); - GetGummiItemStatBoost(gUnknown_203B294->pokeStruct, gUnknown_203B294->item.id, FALSE, &gUnknown_203B294->gummi); - gUnknown_203B294->availIQSkillPostGummi = GetNumAvailableIQSkills(gUnknown_203B294->iqSkillPostGummi, gUnknown_203B294->pokeStruct->IQ); - gUnknown_203B294->unk40 = 1; - boostAmount = gUnknown_203B294->gummi.boostAmount; + if (sub_8023704(param_1_u8)) + return FALSE; - sub_8090E14(gUnknown_202DE58, &gTeamInventoryRef->teamItems[gUnknown_203B294->itemIndex], NULL); - - if(boostAmount != -1) - ShiftItemsDownFrom(gUnknown_203B294->itemIndex); + if (gUnknown_3001B5C == NULL) + gUnknown_3001B5C = MemoryAlloc(sizeof(unkStruct_3001B5C), 8); - sub_8099690(0); - gUnknown_203B294->fallbackState = 0xA; + gUnknown_3001B5C->unk0 = param_1_u8; + gUnknown_3001B5C->unk4 = gUnknown_203B298; - switch(boostAmount + 1) - { - case 1: - sub_8022924(6); - break; - case 2: - sub_8022924(7); - break; - case 3: - sub_8022924(8); - break; - case 4: - sub_8022924(9); - break; - default: - case 0: - gUnknown_203B294->fallbackState = 0x16; - sub_8022924(5); - break; - } - break; - case 6: - sub_8022924(0x15); - break; - case 4: - sub_8022924(3); - break; - case 7: - sub_8099690(0); - sub_8022924(4); - break; - } + gUnknown_3001B5C->unk390 = index; + gUnknown_3001B5C->unk394 = &gUnknown_3001B5C->unk398[index]; + sub_8006518(gUnknown_3001B5C->unk398); + gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = sUnknown_80DC91C; + + gUnknown_3001B5C->unk394->unk14 = gUnknown_3001B5C->unk3F8; + + if (sub != NULL) + gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390].unk8 = *sub; + + sub_8012D08(gUnknown_3001B5C->unk394, a3); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); + sub_8013818(&gUnknown_3001B5C->input, sub_80236A4(), a3, index); + gUnknown_3001B5C->input.menuIndex = gUnknown_203B29C; + gUnknown_3001B5C->input.unk1E = gUnknown_203B29E; + sub_8013984(&gUnknown_3001B5C->input); + sub_8023420(); + sub_80234BC(); + return TRUE; } -void sub_8023068(void) -{ - s32 menuAction; - - menuAction = 0; - sub_801A6E8(FALSE); - sub_8012FD8(&gUnknown_203B294->unk54); - if (sub_8012FD8(&gUnknown_203B294->unkA4) == 0) { - sub_8013114(&gUnknown_203B294->unkA4,&menuAction); - } - - switch(menuAction) - { - case 1: - case 3: - sub_8022924(1); - break; - case 2: - ShiftItemsDownFrom(gUnknown_203B294->itemIndex); - if (GetNumberOfFilledInventorySlots() == 0) { - sub_8099690(0); - sub_801A928(); - sub_8022924(0x14); - } - else { - sub_8022924(1); - } - break; - } -} - -void sub_80230E8(void) -{ - switch(sub_801B410()) - { - case 2: - case 3: - sub_801B450(); - sub_8022924(1); - case 1: - case 0: - break; - } -} - -void sub_8023104(void) -{ - switch(sub_801B00C()) - { - case 2: - case 3: - sub_801B048(); - sub_8022924(1); - case 1: - case 0: - break; - } -} - -void sub_8023120(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - sub_8022924(gUnknown_203B294->fallbackState); - } -} - - - -// THIS IS A NEW FILE: - - - - - - -bool8 sub_8023144(s32 param_1, s32 index, UnkTextStruct2_sub *sub, u32 param_4) -{ - u8 param_1_u8 = param_1; - - if (sub_8023704(param_1_u8)) - return 0; - - if (gUnknown_3001B5C == NULL) - gUnknown_3001B5C = MemoryAlloc(sizeof(unkStruct_3001B5C), 8); - - gUnknown_3001B5C->unk0 = param_1_u8; - gUnknown_3001B5C->unk4 = gUnknown_203B298; - - gUnknown_3001B5C->unk390 = index; - gUnknown_3001B5C->unk394 = &gUnknown_3001B5C->unk398[index]; - sub_8006518(gUnknown_3001B5C->unk398); - gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = gUnknown_80DC91C; - - gUnknown_3001B5C->unk394->unk14 = gUnknown_3001B5C->unk3F8; - - if (sub != NULL) - gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390].unk8 = *sub; - - sub_8012D08(gUnknown_3001B5C->unk394,param_4); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); - sub_8013818(&gUnknown_3001B5C->input,sub_80236A4(),param_4,index); - gUnknown_3001B5C->input.menuIndex = gUnknown_203B29C; - gUnknown_3001B5C->input.unk1E = gUnknown_203B29E; - sub_8013984(&gUnknown_3001B5C->input); - sub_8023420(); - sub_80234BC(); - return 1; -} - -u32 sub_8023278(u8 param_1) +u32 sub_8023278(bool8 a0) { s32 iVar3; u32 temp; - if (param_1 == 0) { + if (!a0) { sub_8013660(&gUnknown_3001B5C->input); return 0; } - switch(GetKeyPress(&gUnknown_3001B5C->input)) - { + + switch (GetKeyPress(&gUnknown_3001B5C->input)) { case INPUT_B_BUTTON: PlayMenuSoundEffect(1); return 2; @@ -325,18 +82,18 @@ u32 sub_8023278(u8 param_1) return 3; case INPUT_SELECT_BUTTON: PlayMenuSoundEffect(5); - if (temp = gUnknown_3001B5C->unk4, iVar3 = 1, temp < 2) { + if (temp = gUnknown_3001B5C->unk4, iVar3 = 1, temp < 2) iVar3 = temp + 1; - } + gUnknown_3001B5C->unk4 = iVar3; sub_80236A4(); break; default: - if (sub_80138B8(&gUnknown_3001B5C->input, 1) == 0) { + if (sub_80138B8(&gUnknown_3001B5C->input, 1) == 0) return 0; - } break; } + sub_8023420(); sub_80234BC(); return 1; @@ -344,7 +101,7 @@ u32 sub_8023278(u8 param_1) s16 sub_802331C(void) { - return gUnknown_3001B5C->unkC[gUnknown_3001B5C->input.unk1E * gUnknown_3001B5C->input.unk1C + gUnknown_3001B5C->input.menuIndex]; + return gUnknown_3001B5C->unkC[(gUnknown_3001B5C->input.unk1E * gUnknown_3001B5C->input.unk1C) + gUnknown_3001B5C->input.menuIndex]; } void sub_8023354(bool8 cursorSprite) @@ -365,7 +122,7 @@ void sub_80233A0(void) gUnknown_203B298 = gUnknown_3001B5C->unk4; gUnknown_203B29C = gUnknown_3001B5C->input.menuIndex; gUnknown_203B29E = gUnknown_3001B5C->input.unk1E; - gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = gUnknown_80DC904; + gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = sUnknown_80DC904; ResetUnusedInputStruct(); sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); MemoryFree(gUnknown_3001B5C); @@ -374,74 +131,74 @@ void sub_80233A0(void) } NAKED // sub_80095E4 memes -void sub_8023420(void) +static void sub_8023420(void) { asm_unified( - "\tpush {r4,r5,lr}\n" - "\tldr r4, _080234A8\n" - "\tldr r0, [r4]\n" - "\tmovs r1, 0xFE\n" - "\tlsls r1, 2\n" - "\tadds r0, r1\n" - "\tmovs r2, 0\n" - "\tmovs r1, 0x1\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tldr r1, _080234AC\n" - "\tadds r0, r1\n" - "\tstrb r2, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r1, 0x1\n" - "\tadds r0, r1\n" - "\tmovs r1, 0xC\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tldr r1, _080234B0\n" - "\tadds r0, r1\n" - "\tstrb r2, [r0]\n" - "\tldr r0, [r4]\n" - "\tldr r2, _080234B4\n" - "\tadds r0, r2\n" - "\tmovs r1, 0\n" - "\tldrsh r0, [r0, r1]\n" - "\tmovs r1, 0xC\n" - "\tbl sub_80095E4\n" - "\tadds r0, 0x2\n" - "\tldr r3, [r4]\n" - "\tmovs r2, 0xE4\n" - "\tlsls r2, 2\n" - "\tadds r5, r3, r2\n" - "\tldr r2, [r5]\n" - "\tlsls r1, r2, 1\n" - "\tadds r1, r2\n" - "\tlsls r1, 3\n" - "\tadds r1, r3, r1\n" - "\tldr r2, _080234B8\n" - "\tadds r1, r2\n" - "\tlsls r0, 16\n" - "\tlsrs r0, 16\n" - "\tstrh r0, [r1]\n" - "\tldr r2, [r5]\n" - "\tlsls r1, r2, 1\n" - "\tadds r1, r2\n" - "\tlsls r1, 3\n" - "\tadds r3, r1\n" - "\tmovs r1, 0xEA\n" - "\tlsls r1, 2\n" - "\tadds r3, r1\n" - "\tstrh r0, [r3]\n" - "\tbl ResetUnusedInputStruct\n" - "\tldr r0, [r4]\n" - "\tmovs r2, 0xE6\n" - "\tlsls r2, 2\n" - "\tadds r0, r2\n" - "\tmovs r1, 0x1\n" - "\tmovs r2, 0x1\n" - "\tbl sub_800641C\n" - "\tpop {r4,r5}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.align 2, 0\n" + "\tpush {r4,r5,lr}\n" + "\tldr r4, _080234A8\n" + "\tldr r0, [r4]\n" + "\tmovs r1, 0xFE\n" + "\tlsls r1, 2\n" + "\tadds r0, r1\n" + "\tmovs r2, 0\n" + "\tmovs r1, 0x1\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tldr r1, _080234AC\n" + "\tadds r0, r1\n" + "\tstrb r2, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r1, 0x1\n" + "\tadds r0, r1\n" + "\tmovs r1, 0xC\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tldr r1, _080234B0\n" + "\tadds r0, r1\n" + "\tstrb r2, [r0]\n" + "\tldr r0, [r4]\n" + "\tldr r2, _080234B4\n" + "\tadds r0, r2\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r0, r1]\n" + "\tmovs r1, 0xC\n" + "\tbl sub_80095E4\n" + "\tadds r0, 0x2\n" + "\tldr r3, [r4]\n" + "\tmovs r2, 0xE4\n" + "\tlsls r2, 2\n" + "\tadds r5, r3, r2\n" + "\tldr r2, [r5]\n" + "\tlsls r1, r2, 1\n" + "\tadds r1, r2\n" + "\tlsls r1, 3\n" + "\tadds r1, r3, r1\n" + "\tldr r2, _080234B8\n" + "\tadds r1, r2\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tstrh r0, [r1]\n" + "\tldr r2, [r5]\n" + "\tlsls r1, r2, 1\n" + "\tadds r1, r2\n" + "\tlsls r1, 3\n" + "\tadds r3, r1\n" + "\tmovs r1, 0xEA\n" + "\tlsls r1, 2\n" + "\tadds r3, r1\n" + "\tstrh r0, [r3]\n" + "\tbl ResetUnusedInputStruct\n" + "\tldr r0, [r4]\n" + "\tmovs r2, 0xE6\n" + "\tlsls r2, 2\n" + "\tadds r0, r2\n" + "\tmovs r1, 0x1\n" + "\tmovs r2, 0x1\n" + "\tbl sub_800641C\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" "_080234A8: .4byte gUnknown_3001B5C\n" "_080234AC: .4byte 0x000003f9\n" "_080234B0: .4byte 0x000003fb\n" @@ -449,7 +206,7 @@ void sub_8023420(void) "_080234B8: .4byte 0x000003a6"); } -void sub_80234BC(void) +static void sub_80234BC(void) { u8 cVar2; u32 y; @@ -457,83 +214,236 @@ void sub_80234BC(void) s32 iVar4; s32 species; u32 color; - s32 index; - u8 buffer2 [256]; - u8 buffer1 [100]; + s32 i; + u8 buffer2[256]; + u8 buffer1[100]; unkStruct_8092638 auStack_2c; sub_8008C54(gUnknown_3001B5C->unk390); sub_80073B8(gUnknown_3001B5C->unk390); - xxx_call_draw_string(10,0,gUnknown_80DC934,gUnknown_3001B5C->unk390,0); // Pokemon - sub_8012BC4(gUnknown_3001B5C->unk3F8[2] * 8 + 4,0, - gUnknown_3001B5C->input.unk1E + 1,2,7,gUnknown_3001B5C->unk390); - for(index = 0; index < gUnknown_3001B5C->input.unk1A; index++) - { - y = sub_8013800(&gUnknown_3001B5C->input,index); - species = gUnknown_3001B5C->unkC[(gUnknown_3001B5C->input.unk1E * gUnknown_3001B5C->input.unk1C + index)]; - sub_8092638(GetFriendArea(species),&auStack_2c,FALSE,FALSE); + xxx_call_draw_string(10, 0, sPokemon, gUnknown_3001B5C->unk390, 0); + + sub_8012BC4((gUnknown_3001B5C->unk3F8[2] * 8) + 4, 0, gUnknown_3001B5C->input.unk1E + 1, 2, 7, gUnknown_3001B5C->unk390); + + for (i = 0; i < gUnknown_3001B5C->input.unk1A; i++) { + y = sub_8013800(&gUnknown_3001B5C->input, i); + species = gUnknown_3001B5C->unkC[(gUnknown_3001B5C->input.unk1E * gUnknown_3001B5C->input.unk1C) + i]; + sub_8092638(GetFriendArea(species), &auStack_2c, FALSE, FALSE); color = COLOR_WHITE_2; - if (auStack_2c.hasFriendArea) { + if (auStack_2c.hasFriendArea) color = HasRecruitedMon(species) ? COLOR_CYAN : COLOR_GREEN; - } - iVar4 = GetDexInternalNo(species,0); - cVar2 = (iVar4 % 10) + 0x30; - sub_8012C60(0x14,y,cVar2,color,gUnknown_3001B5C->unk390); + + iVar4 = GetDexInternalNo(species, 0); + cVar2 = (iVar4 % 10) + 48; + sub_8012C60(20, y, cVar2, color, gUnknown_3001B5C->unk390); + if (9 < iVar4) { iVar4 /= 10; - cVar2 = (iVar4 % 10) + 0x30; - sub_8012C60(0xd,y,cVar2,color,gUnknown_3001B5C->unk390); + cVar2 = (iVar4 % 10) + 48; + sub_8012C60(13, y, cVar2, color, gUnknown_3001B5C->unk390); + if (9 < iVar4) { uVar3 = iVar4 / 10; - cVar2 = (uVar3 % 10) + 0x30; - sub_8012C60(6,y,cVar2,color,gUnknown_3001B5C->unk390); + cVar2 = (uVar3 % 10) + 48; + sub_8012C60(6, y, cVar2, color, gUnknown_3001B5C->unk390); } } + sub_808D930(buffer1,species); - sprintfStatic(buffer2,gUnknown_80DC93C,color,buffer1); // {COLOR_2}%c%s - xxx_call_draw_string(0x24,y,buffer2,gUnknown_3001B5C->unk390,0); + sprintfStatic(buffer2, sFmtColoredString, color, buffer1); + xxx_call_draw_string(36, y, buffer2, gUnknown_3001B5C->unk390, 0); } + sub_80073E0(gUnknown_3001B5C->unk390); } -u32 sub_80236A4(void) +static u32 sub_80236A4(void) { s32 index; gUnknown_3001B5C->unk8 = 0; - for(index = 0; index < 0x1a8; index++) - { - if ((sub_8098134((s16)index)) && - ((s16)index == GetBaseSpeciesNoUnown(index))) { + + for (index = 0; index < MONSTER_MAX; index++) { + if (sub_8098134(index) && (s16)index == GetBaseSpeciesNoUnown(index)) gUnknown_3001B5C->unkC[gUnknown_3001B5C->unk8++] = index; - } } + sub_8023730(); return gUnknown_3001B5C->unk8; } -bool8 sub_8023704(u8 unused) +static bool8 sub_8023704(u8 unused) { s32 index; - for(index = 0; index < 0x1a8; index++) - { - if (sub_8098134((s16)index)) + for (index = 0; index < MONSTER_MAX; index++) { + if (sub_8098134(index)) return FALSE; } + return TRUE; } -void sub_8023730(void) +static void sub_8023730(void) { - switch(gUnknown_3001B5C->unk4) - { + switch (gUnknown_3001B5C->unk4) { case 1: sub_8023758(); break; case 2: sub_80237E0(); break; - } } + +// 41.34%. Similar to SortbyAlphabetNo: https://decomp.me/scratch/Wmgj6 +NAKED static void sub_8023758(void) +{ + asm_unified( + "\tpush {r4-r7,lr}\n" + "\tmov r7, r9\n" + "\tmov r6, r8\n" + "\tpush {r6,r7}\n" + "\tsub sp, 0x4\n" + "\tldr r3, _080237DC\n" + "\tldr r2, [r3]\n" + "\tldr r1, [r2, 0x8]\n" + "\tlsls r0, r1, 1\n" + "\tadds r0, 0xA\n" + "\tadds r2, r0\n" + "\tmov r9, r2\n" + "\tmovs r2, 0\n" + "\tsubs r1, 0x1\n" + "\tcmp r2, r1\n" + "\tbge _080237CC\n" +"_08023778:\n" + "\tmov r5, r9\n" + "\tldr r0, [r3]\n" + "\tldr r0, [r0, 0x8]\n" + "\tsubs r7, r0, 0x1\n" + "\tadds r0, r2, 0x1\n" + "\tmov r8, r0\n" + "\tcmp r7, r2\n" + "\tble _080237BE\n" +"_08023788:\n" + "\tsubs r6, r5, 0x2\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r6, r1]\n" + "\tmovs r1, 0x1\n" + "\tstr r2, [sp]\n" + "\tbl GetAlphabetParentNo\n" + "\tadds r4, r0, 0\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r5, r1]\n" + "\tmovs r1, 0x1\n" + "\tbl GetAlphabetParentNo\n" + "\tlsls r4, 16\n" + "\tlsls r0, 16\n" + "\tldr r2, [sp]\n" + "\tcmp r4, r0\n" + "\tble _080237B6\n" + "\tmovs r0, 0\n" + "\tldrsh r1, [r5, r0]\n" + "\tldrh r0, [r6]\n" + "\tstrh r0, [r5]\n" + "\tstrh r1, [r6]\n" +"_080237B6:\n" + "\tadds r5, r6, 0\n" + "\tsubs r7, 0x1\n" + "\tcmp r7, r2\n" + "\tbgt _08023788\n" +"_080237BE:\n" + "\tmov r2, r8\n" + "\tldr r3, _080237DC\n" + "\tldr r0, [r3]\n" + "\tldr r0, [r0, 0x8]\n" + "\tsubs r0, 0x1\n" + "\tcmp r2, r0\n" + "\tblt _08023778\n" +"_080237CC:\n" + "\tadd sp, 0x4\n" + "\tpop {r3,r4}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_080237DC: .4byte gUnknown_3001B5C"); +} + + // SIMILAR TO ABOVE: https://decomp.me/scratch/BG2JR +NAKED static void sub_80237E0(void) +{ + asm_unified( + "\tpush {r4-r7,lr}\n" + "\tmov r7, r9\n" + "\tmov r6, r8\n" + "\tpush {r6,r7}\n" + "\tsub sp, 0x4\n" + "\tldr r3, _08023864\n" + "\tldr r2, [r3]\n" + "\tldr r1, [r2, 0x8]\n" + "\tlsls r0, r1, 1\n" + "\tadds r0, 0xA\n" + "\tadds r2, r0\n" + "\tmov r9, r2\n" + "\tmovs r2, 0\n" + "\tsubs r1, 0x1\n" + "\tcmp r2, r1\n" + "\tbge _08023854\n" +"_08023800:\n" + "\tmov r5, r9\n" + "\tldr r0, [r3]\n" + "\tldr r0, [r0, 0x8]\n" + "\tsubs r7, r0, 0x1\n" + "\tadds r0, r2, 0x1\n" + "\tmov r8, r0\n" + "\tcmp r7, r2\n" + "\tble _08023846\n" +"_08023810:\n" + "\tsubs r6, r5, 0x2\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r6, r1]\n" + "\tmovs r1, 0\n" + "\tstr r2, [sp]\n" + "\tbl GetAlphabetParentNo\n" + "\tadds r4, r0, 0\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r5, r1]\n" + "\tmovs r1, 0\n" + "\tbl GetAlphabetParentNo\n" + "\tlsls r4, 16\n" + "\tlsls r0, 16\n" + "\tldr r2, [sp]\n" + "\tcmp r4, r0\n" + "\tble _0802383E\n" + "\tmovs r0, 0\n" + "\tldrsh r1, [r5, r0]\n" + "\tldrh r0, [r6]\n" + "\tstrh r0, [r5]\n" + "\tstrh r1, [r6]\n" +"_0802383E:\n" + "\tadds r5, r6, 0\n" + "\tsubs r7, 0x1\n" + "\tcmp r7, r2\n" + "\tbgt _08023810\n" +"_08023846:\n" + "\tmov r2, r8\n" + "\tldr r3, _08023864\n" + "\tldr r0, [r3]\n" + "\tldr r0, [r0, 0x8]\n" + "\tsubs r0, 0x1\n" + "\tcmp r2, r0\n" + "\tblt _08023800\n" +"_08023854:\n" + "\tadd sp, 0x4\n" + "\tpop {r3,r4}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_08023864: .4byte gUnknown_3001B5C"); +} \ No newline at end of file diff --git a/src/code_8023144_pre.c b/src/code_8023144_pre.c deleted file mode 100644 index 85a386a5c..000000000 --- a/src/code_8023144_pre.c +++ /dev/null @@ -1,140 +0,0 @@ -#include "global.h" -#include "constants/colors.h" -#include "constants/input.h" -#include "constants/iq_skill.h" -#include "memory.h" -#include "menu.h" -#include "pokemon.h" -#include "pokemon_3.h" -#include "text1.h" -#include "input.h" -#include "items.h" -#include "menu_input.h" -#include "code_8023144.h" -#include "text2.h" - -unkStruct_203B294 *gUnknown_203B294; -extern u8 gAvailablePokemonNames[]; -extern u8 gUnknown_80DC5EC[]; -extern u8 HasGummiItem(void); -extern void sub_8022924(s32); -extern void sub_8022E78(void); -extern void sub_8022EF4(void); -extern void sub_8023068(void); -extern void sub_80230E8(void); -extern void sub_8023120(void); -extern void sub_8023104(void); -extern void sub_802293C(void); -extern void sub_8022A10(void); -extern void sub_8022D2C(void); - -extern UnkTextStruct2 gUnknown_80DC5A4; -extern UnkTextStruct2 gUnknown_80DC5D4; -extern UnkTextStruct2 gUnknown_80DC5BC; - -bool8 sub_80227B8(PokemonStruct1 *pokeStruct) -{ - ResetUnusedInputStruct(); - sub_800641C(NULL, TRUE, TRUE); - gUnknown_203B294 = MemoryAlloc(sizeof(unkStruct_203B294), 8); - gUnknown_203B294->menuAction = 0; - gUnknown_203B294->pokeStruct = pokeStruct; - if(pokeStruct != NULL) - { - PrintColoredPokeNameToBuffer(gAvailablePokemonNames, pokeStruct, COLOR_WHITE_2); - PrintColoredPokeNameToBuffer(gAvailablePokemonNames + 0x50, pokeStruct, COLOR_YELLOW); - if(HasGummiItem()) - { - sub_8022924(0x0); - } - else - { - sub_8022924(0x11); - } - } - else { - strcpy(gAvailablePokemonNames, gUnknown_80DC5EC); - strcpy(gAvailablePokemonNames + 0x50, gUnknown_80DC5EC); - if(GetNumberOfFilledInventorySlots() == 0) - { - sub_8022924(0x12); - - } - else { - sub_8022924(0x0); - } - } - return TRUE; -} - -u32 sub_8022860(void) -{ - switch(gUnknown_203B294->state) { - case 0: - case 1: - sub_8022E78(); - break; - case 2: - sub_8022EF4(); - break; - case 3: - sub_8023068(); - break; - case 4: - sub_80230E8(); - break; - case 0x15: - sub_8023104(); - break; - case 0x16: - return 3; - default: - sub_8023120(); - break; - } - return 0; -} - -void sub_8022908(void) -{ - if(gUnknown_203B294) - { - MemoryFree(gUnknown_203B294); - gUnknown_203B294 = NULL; - } -} - -void sub_8022924(s32 newState) -{ - gUnknown_203B294->state = newState; - sub_802293C(); - sub_8022A10(); -} - -void sub_802293C(void) { - s32 index; - sub_8006518(gUnknown_203B294->unk148); - switch(gUnknown_203B294->state) - { - case 2: - sub_8022D2C(); - gUnknown_203B294->unk148[2] = gUnknown_80DC5BC; - sub_8012CAC(&gUnknown_203B294->unk148[2], gUnknown_203B294->unkF8); - gUnknown_203B294->unk148[2].unkC = 6; - break; - case 3: - gUnknown_203B294->unk148[1] = gUnknown_80DC5D4; - break; - default: - for(index = 0; index < 4; index++) - { - gUnknown_203B294->unk148[index] = gUnknown_80DC5A4; - } - break; - case 0xA ... 0x10: - break; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B294->unk148, TRUE, TRUE); - -} diff --git a/src/code_8023868.c b/src/code_8023868.c index 33e3d0c2a..bb7468d0f 100644 --- a/src/code_8023868.c +++ b/src/code_8023868.c @@ -3,7 +3,7 @@ #include "code_8023868.h" #include "pokemon.h" #include "pokemon_mid.h" -#include "text.h" +#include "structs/str_text.h" #include "text_util.h" //static // MAKE STATIC WHEN code_8023868.s IS DONE diff --git a/src/code_8031D70.c b/src/code_8031D70.c index 0ee4fd371..918172eb1 100644 --- a/src/code_8031D70.c +++ b/src/code_8031D70.c @@ -5,7 +5,7 @@ #include "memory.h" #include "text1.h" #include "text2.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "pokemon.h" #include "code_8094F88.h" #include "menu_input.h" diff --git a/src/code_8040094.c b/src/code_8040094.c index 83b43865c..9e53e91be 100644 --- a/src/code_8040094.c +++ b/src/code_8040094.c @@ -3,8 +3,8 @@ #include "code_800C9CC.h" #include "code_80118A4.h" #include "code_80521D0.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_music.h" #include "file_system.h" diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index a8e53af12..22af484e0 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -3,8 +3,8 @@ #include "constants/direction.h" #include "constants/status.h" #include "constants/type.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" #include "items.h" @@ -208,18 +208,18 @@ void EntityUpdateStatusSprites(Entity *entity) void sub_8041AD0(Entity *pokemon) { - sub_804151C(pokemon, 0xA2 << 1, 1); + sub_804151C(pokemon, 324, 1); } void sub_8041AE0(Entity *pokemon) { - sub_804151C(pokemon, 0x143, 1); + sub_804151C(pokemon, 323, 1); } void sub_8041AF4(Entity *pokemon) { - sub_804151C(pokemon, 0x25, 1); - sub_80421C0(pokemon, 0x197); + sub_804151C(pokemon, 37, 1); + sub_80421C0(pokemon, 407); } void nullsub_57(void) @@ -228,7 +228,7 @@ void nullsub_57(void) void sub_8041B18(Entity *pokemon) { - sub_804151C(pokemon, 0x141, 1); + sub_804151C(pokemon, 321, 1); } void nullsub_58(void) @@ -259,7 +259,7 @@ void nullsub_61(void) void sub_8041B5C(Entity *pokemon) { - sub_804151C(pokemon, 0x171, 1); + sub_804151C(pokemon, 369, 1); } void nullsub_62(Entity *pokemon) @@ -268,7 +268,7 @@ void nullsub_62(Entity *pokemon) void sub_8041B74(Entity *pokemon) { - sub_804151C(pokemon, 0x171, 0); + sub_804151C(pokemon, 369, 0); } void nullsub_63(void) @@ -281,7 +281,7 @@ void nullsub_64(void) void sub_8041B90(Entity *pokemon) { - sub_804151C(pokemon, 0xD6 << 1, 0); + sub_804151C(pokemon, 428, 0); } void nullsub_65(void) @@ -303,7 +303,7 @@ void nullsub_67(void) void sub_8041BBC(Entity *pokemon) { - sub_804151C(pokemon, 0xD4 << 1, 1); + sub_804151C(pokemon, 424, 1); } void nullsub_68(void) @@ -316,12 +316,12 @@ void sub_8041BD0(Entity *pokemon, u8 r1) { return; } - sub_80421C0(pokemon, 0x1a5); + sub_80421C0(pokemon, 421); } void sub_8041BE8(Entity *pokemon) { - sub_80421C0(pokemon, 0xCB << 1); + sub_80421C0(pokemon, 406); } void sub_8041BF8(Entity *pokemon) @@ -331,12 +331,12 @@ void sub_8041BF8(Entity *pokemon) void sub_8041C08(Entity *pokemon) { - sub_804151C(pokemon, 0x1a7, 1); + sub_804151C(pokemon, 423, 1); } void sub_8041C1C(Entity *pokemon) { - sub_804151C(pokemon, 0x1a7, 1); + sub_804151C(pokemon, 423, 1); } void nullsub_69(void) diff --git a/src/code_80428A0.c b/src/code_80428A0.c index 4b4e88b71..6d605ee95 100644 --- a/src/code_80428A0.c +++ b/src/code_80428A0.c @@ -1,6 +1,6 @@ #include "global.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" extern void sub_804151C(Entity *r0, u32 r1, u8 r2); extern void sub_803E708(u32 r0, u32 r1); diff --git a/src/code_8045A00.c b/src/code_8045A00.c index 9d35d8626..98f40c2cc 100644 --- a/src/code_8045A00.c +++ b/src/code_8045A00.c @@ -1,11 +1,11 @@ #include "global.h" #include "constants/item.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_util.h" #include "dungeon_random.h" #include "items.h" -#include "map.h" +#include "structs/map.h" extern u8 *gUnknown_80FE6F4[]; extern struct unkStruct_8090F58 gUnknown_80F699C; diff --git a/src/code_8048480.c b/src/code_8048480.c index c5013179e..f58c96e44 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -5,9 +5,9 @@ #include "constants/status.h" #include "constants/type.h" #include "dungeon_action.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" #include "dungeon_util.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "move_effects_target.h" #include "dungeon_capabilities.h" #include "dungeon_pokemon_attributes.h" @@ -17,7 +17,7 @@ #include "code_8077274_1.h" #include "code_80521D0.h" #include "pokemon.h" -#include "position.h" +#include "structs/str_position.h" #include "status.h" extern u8 gAvailablePokemonNames[]; diff --git a/src/code_8057824.c b/src/code_8057824.c index 27703acdd..4443fb012 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -3,14 +3,14 @@ #include "constants/status.h" #include "constants/weather.h" #include "charge_move.h" -#include "dungeon_global_data.h" -#include "dungeon_entity.h" +#include "structs/str_dungeon.h" +#include "structs/dungeon_entity.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util.h" #include "code_8077274_1.h" #include "code_808417C.h" -#include "map.h" +#include "structs/map.h" #include "moves.h" #include "move_effects_target.h" #include "pokemon.h" diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index b449246f4..59f77a2d3 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -5,8 +5,8 @@ #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" -#include "dungeon_global_data.h" -#include "dungeon_entity.h" +#include "structs/str_dungeon.h" +#include "structs/dungeon_entity.h" #include "dungeon_leader.h" #include "dungeon_map_access.h" #include "dungeon_music.h" diff --git a/src/code_805A120.c b/src/code_805A120.c index e2f59063a..73e02a4d5 100644 --- a/src/code_805A120.c +++ b/src/code_805A120.c @@ -6,8 +6,8 @@ #include "constants/targeting.h" #include "constants/type.h" #include "constants/weather.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_ai_targeting.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_items.h" diff --git a/src/code_805D8C8.c b/src/code_805D8C8.c index 5e22c7704..b2c205f94 100644 --- a/src/code_805D8C8.c +++ b/src/code_805D8C8.c @@ -1,6 +1,6 @@ #include "global.h" #include "code_805D8C8.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_util.h" // monster_sbin.s @@ -129,7 +129,7 @@ void CloseAllSpriteFiles(void) { s32 i; - for (i = 0; i <= MONSTER_MAX; i++) { + for (i = 0; i < MONSTER_MAX; i++) { if (gDungeon->sprites[i] != NULL) { CloseFile(gDungeon->sprites[i]); gDungeon->sprites[i] = NULL; diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index c0419cc04..30fa57885 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -4,8 +4,8 @@ #include "constants/status.h" #include "constants/type.h" #include "constants/weather.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util.h" diff --git a/src/code_806CD90.c b/src/code_806CD90.c index 273647b98..d6a479ab4 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -3,7 +3,7 @@ #include "code_806CD90.h" #include "constants/direction.h" #include "constants/status.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_util.h" #include "pokemon.h" #include "pokemon_mid.h" diff --git a/src/code_806E8B0.c b/src/code_806E8B0.c index 80ad86f6d..5dad07aa2 100644 --- a/src/code_806E8B0.c +++ b/src/code_806E8B0.c @@ -1,6 +1,6 @@ #include "global.h" #include "constants/ability.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_pokemon_attributes.h" #include "status_checks_1.h" #include "text_util.h" diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index b69c2ddcc..ed619e5c1 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -1,5 +1,5 @@ #include "global.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" extern void sub_8067110(Entity *); extern void sub_80671A0(Entity *); diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index e83d7b160..a6695c4d7 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -8,8 +8,8 @@ #include "constants/item.h" #include "constants/status.h" #include "constants/type.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" diff --git a/src/code_807CD9C.c b/src/code_807CD9C.c index 3251c4dab..183c97985 100644 --- a/src/code_807CD9C.c +++ b/src/code_807CD9C.c @@ -2,7 +2,7 @@ #include "constants/ability.h" #include "constants/type.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_leader.h" #include "dungeon_util.h" #include "code_80521D0.h" diff --git a/src/code_807E5AC.c b/src/code_807E5AC.c index acb2fcd9f..ddd05fcd8 100644 --- a/src/code_807E5AC.c +++ b/src/code_807E5AC.c @@ -1,5 +1,5 @@ #include "global.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" void sub_807FC3C(Position *pos, u32 param_2, u32 param_3) { diff --git a/src/code_808417C.c b/src/code_808417C.c index 99577cbc9..11db9facc 100644 --- a/src/code_808417C.c +++ b/src/code_808417C.c @@ -1,7 +1,7 @@ #include "global.h" #include "constants/ability.h" #include "constants/iq_skill.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util.h" diff --git a/src/code_80848F0.c b/src/code_80848F0.c index 79baac250..455a4130e 100644 --- a/src/code_80848F0.c +++ b/src/code_80848F0.c @@ -1,5 +1,5 @@ #include "global.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_music.h" #include "exclusive_pokemon.h" diff --git a/src/code_80869E4.c b/src/code_80869E4.c index 027ec7546..9e9b198aa 100644 --- a/src/code_80869E4.c +++ b/src/code_80869E4.c @@ -2,7 +2,7 @@ #include "code_806CD90.h" #include "code_80869E4.h" #include "constants/direction.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_util_1.h" #include "random.h" diff --git a/src/code_8086A3C.c b/src/code_8086A3C.c index c7b17fea0..28eca49e8 100644 --- a/src/code_8086A3C.c +++ b/src/code_8086A3C.c @@ -4,8 +4,8 @@ #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/monster.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_music.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" diff --git a/src/code_809447C.c b/src/code_809447C.c index c7741de53..f6e1fd923 100644 --- a/src/code_809447C.c +++ b/src/code_809447C.c @@ -3,7 +3,7 @@ #include "code_8092334.h" #include "code_809447C.h" #include "dungeon.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "items.h" #include "moves.h" #include "text_util.h" diff --git a/src/code_80958E8.c b/src/code_80958E8.c index ee0953b18..ac25ec345 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -101,14 +101,14 @@ bool8 ValidateWonderMail(WonderMail *data) if(data->clientSpecies == MONSTER_NONE) return FALSE; - if(data->clientSpecies > MONSTER_MAX) + if(data->clientSpecies >= MONSTER_MAX) return FALSE; if(data->clientSpecies != GetBaseSpecies(data->clientSpecies)) return FALSE; if(!sub_803C0DC(data->clientSpecies)) return FALSE; - if(data->targetSpecies > MONSTER_MAX) + if(data->targetSpecies >= MONSTER_MAX) return FALSE; if(data->targetSpecies != GetBaseSpecies(data->targetSpecies)) return FALSE; diff --git a/src/data/code_80227B8.h b/src/data/code_80227B8.h new file mode 100644 index 000000000..e62ee24a9 --- /dev/null +++ b/src/data/code_80227B8.h @@ -0,0 +1,90 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const MenuItem sUnknown_80DC584[3] = +{ + {"Yes", 2}, + {"No", 3}, + {NULL, 1}, +}; + +static const UnkTextStruct2 sUnknown_80DC5A4 = +{ + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; +static const UnkTextStruct2 sUnknown_80DC5BC = +{ + 0, 0, 0, 0, + 3, + 20, 4, + 6, 3, + 3, 0, + NULL +}; +static const UnkTextStruct2 sUnknown_80DC5D4 = +{ + 0, 0, 0, 0, + 3, + 20, 11, + 6, 3, + 3, 0, + NULL +}; + +ALIGNED(4) static const u8 sTripleQuestionMark[] = _("???"); +ALIGNED(4) static const u8 sDoesNotAppearHungry[] = _("It doesn{APOSTROPHE}t appear to be hungry."); + +ALIGNED(4) static const u8 sFmtGummiBigFav[] = _( + "{ARG_POKEMON_1} took the Gummi and ate it.\n" + "This Gummi looks like a big favorite!\n" + "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!"); + +ALIGNED(4) static const u8 sFmtGummiFav[] = _( + "{ARG_POKEMON_1} took the Gummi and ate it.\n" + "This Gummi looks like a favorite!\n" + "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!"); + +ALIGNED(4) static const u8 sFmtGummiOkay[] = _( + "{ARG_POKEMON_1} took the Gummi and ate it.\n" + "It doesn{APOSTROPHE}t seem to dislike this Gummi.\n" + "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!"); + +ALIGNED(4) static const u8 sFmtGummiSatisfied[] = _( + "{ARG_POKEMON_1} took the Gummi and ate it.\n" + "It appears to be just a little satisfied.\n" + "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!"); + +ALIGNED(4) static const u8 sFmtIQHelpedLearn[] = _( + "{ARG_POKEMON_1}{APOSTROPHE}s IQ helped it learn how to\n" + "use {ARG_MOVE_ITEM_1}!"); + +ALIGNED(4) static const u8 sFmtPlusEverything[] = _( + "Yes! {ARG_POKEMON_1} grew explosively!\n" + "Attack{COMMA} Defense{COMMA} and so on rose by 1!"); + +ALIGNED(4) static const u8 sFmtPlusAtk[] = _( + "Yes!\n" + "{ARG_POKEMON_1}{APOSTROPHE}s Attack rose by 1!"); + +ALIGNED(4) static const u8 sFmtPlusSpAtk[] = _( + "Yes!\n" + "{ARG_POKEMON_1}{APOSTROPHE}s Special Attack rose by 1!"); + +ALIGNED(4) static const u8 sFmtPlusDef[] = _( + "Yes!\n" + "{ARG_POKEMON_1}{APOSTROPHE}s Defense rose by 1!"); + +ALIGNED(4) static const u8 sFmtPlusSpDef[] = _( + "Yes!\n" + "{ARG_POKEMON_1}{APOSTROPHE}s Special Defense rose by 1!"); + +ALIGNED(4) static const u8 sNoGummis[] = _("You don{APOSTROPHE}t have any Gummis."); +ALIGNED(4) static const u8 sNoItem[] = _("You don{APOSTROPHE}t have an item."); +ALIGNED(4) static const u8 sGummiGone[] = _("The Gummi is gone!"); +ALIGNED(4) static const u8 sItemGone[] = _("The item is gone!"); +ALIGNED(4) static const u8 sGive[] = _("Give"); +ALIGNED(4) static const u8 sUse[] = _("Use"); \ No newline at end of file diff --git a/src/data/code_8023144.h b/src/data/code_8023144.h new file mode 100644 index 000000000..49276ee82 --- /dev/null +++ b/src/data/code_8023144.h @@ -0,0 +1,23 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DC904 = +{ + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; +static const UnkTextStruct2 sUnknown_80DC91C = +{ + 0, 0, 0, 0, + 6, + 2, 2, + 15, 14, + 14, 0, + NULL +}; + +ALIGNED(4) static const u8 sPokemon[] = _("Pokémon"); +ALIGNED(4) static const u8 sFmtColoredString[] = _("{COLOR_2}%c%s{END_COLOR_TEXT_2}"); \ No newline at end of file diff --git a/src/dungeon_action.c b/src/dungeon_action.c index e121602f3..8f9c42c92 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -3,8 +3,8 @@ #include "constants/ability.h" #include "constants/dungeon_action.h" #include "dungeon_ai.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_leader.h" #include "dungeon_movement.h" #include "dungeon_util.h" diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index d09cab10c..253e53bb1 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -18,7 +18,7 @@ #include "dungeon_ai_movement.h" #include "dungeon_ai_targeting.h" #include "dungeon_capabilities.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_leader.h" #include "dungeon_map_access.h" @@ -27,7 +27,7 @@ #include "dungeon_util.h" #include "dungeon_util_1.h" #include "dungeon_visibility.h" -#include "map.h" +#include "structs/map.h" #include "pokemon.h" #include "status_checks.h" #include "targeting.h" diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index a576098d8..638c5a996 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -15,7 +15,7 @@ #include "dungeon_ai_targeting.h" #include "dungeon_ai_targeting.h" #include "dungeon_capabilities.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index ed3e84e1a..9f985f5bf 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -11,15 +11,15 @@ #include "dungeon_ai_items.h" #include "dungeon_ai_targeting.h" #include "dungeon_capabilities.h" -#include "dungeon_entity.h" -#include "dungeon_global_data.h" +#include "structs/dungeon_entity.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util.h" #include "dungeon_visibility.h" #include "items.h" -#include "position.h" +#include "structs/str_position.h" #include "position_util.h" #include "status.h" diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index 54caf261c..8b10caed5 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -10,7 +10,7 @@ #include "dungeon_ai_leader.h" #include "dungeon_ai_targeting.h" #include "dungeon_capabilities.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" @@ -18,7 +18,7 @@ #include "dungeon_range.h" #include "dungeon_util.h" #include "dungeon_visibility.h" -#include "map.h" +#include "structs/map.h" #include "number_util.h" #include "position_util.h" diff --git a/src/dungeon_ai_targeting.c b/src/dungeon_ai_targeting.c index 71c7104f4..6c450e6ec 100644 --- a/src/dungeon_ai_targeting.c +++ b/src/dungeon_ai_targeting.c @@ -10,14 +10,14 @@ #include "constants/targeting.h" #include "dungeon_engine.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util.h" -#include "map.h" +#include "structs/map.h" #include "tile_types.h" extern void ShowVisualFlags(Entity *r0); diff --git a/src/dungeon_capabilities.c b/src/dungeon_capabilities.c index 3b2836da5..51bbb62bc 100644 --- a/src/dungeon_capabilities.c +++ b/src/dungeon_capabilities.c @@ -13,7 +13,7 @@ #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" -#include "map.h" +#include "structs/map.h" const u8 gDirectionBitMasks_1[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index 92ab54603..782ab4d24 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -1,8 +1,8 @@ #include "global.h" -#include "dungeon_entity.h" +#include "structs/dungeon_entity.h" #include "dungeon_engine.h" #include "constants/dungeon.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_ai.h" #include "dungeon_leader.h" #include "dungeon_movement.h" diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 8878ec89b..baab94f97 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -2,7 +2,7 @@ #include "code_80869E4.h" #include "dungeon_items.h" #include "dungeon_capabilities.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_leader.h" #include "dungeon_random.h" #include "dungeon_util.h" diff --git a/src/dungeon_leader.c b/src/dungeon_leader.c index 0082bba4b..20db12ad8 100644 --- a/src/dungeon_leader.c +++ b/src/dungeon_leader.c @@ -1,5 +1,5 @@ #include "global.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_leader.h" #include "dungeon_util.h" diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 8282ddda3..122c1cb1e 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -3,7 +3,7 @@ #include "constants/walkable_tile.h" #include "decompress.h" #include "dungeon_map_access.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "tile_types.h" #include "random.h" #include "dungeon_engine.h" diff --git a/src/dungeon_map_access_1.c b/src/dungeon_map_access_1.c index fa3d1775a..7e6ef6c1e 100644 --- a/src/dungeon_map_access_1.c +++ b/src/dungeon_map_access_1.c @@ -1,7 +1,7 @@ #include "global.h" #include "code_8009804.h" #include "dungeon_engine.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "file_system.h" #include "random.h" diff --git a/src/dungeon_movement.c b/src/dungeon_movement.c index 0040a8464..08b90bd3b 100644 --- a/src/dungeon_movement.c +++ b/src/dungeon_movement.c @@ -1,5 +1,5 @@ #include "global.h" -#include "map.h" +#include "structs/map.h" #include "dungeon_movement.h" #include "constants/item.h" @@ -9,7 +9,7 @@ #include "constants/weather.h" #include "dungeon_engine.h" #include "dungeon_items.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" diff --git a/src/dungeon_music.c b/src/dungeon_music.c index ba3658cf8..5499750e8 100644 --- a/src/dungeon_music.c +++ b/src/dungeon_music.c @@ -3,7 +3,7 @@ #include "constants/bg_music.h" #include "dungeon.h" #include "music.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_music.h" #include "dungeon_util.h" #include "text_util.h" diff --git a/src/dungeon_pokemon_attributes.c b/src/dungeon_pokemon_attributes.c index 3275a7663..7b105e043 100644 --- a/src/dungeon_pokemon_attributes.c +++ b/src/dungeon_pokemon_attributes.c @@ -8,7 +8,7 @@ #include "constants/status.h" #include "constants/tactic.h" #include "constants/type.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_util.h" #include "dungeon_visibility.h" diff --git a/src/dungeon_range.c b/src/dungeon_range.c index 026e93ad5..34392f6ff 100644 --- a/src/dungeon_range.c +++ b/src/dungeon_range.c @@ -1,9 +1,9 @@ #include "global.h" #include "dungeon_range.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" -#include "map.h" +#include "structs/map.h" bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2) { diff --git a/src/dungeon_util.c b/src/dungeon_util.c index 99a6b7777..dd6fceb20 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -2,7 +2,7 @@ #include "dungeon_util.h" #include "dungeon_map_access.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" extern u8 gUnknown_202EE70[0x6]; extern u8 gUnknown_202EE76[0x10]; diff --git a/src/dungeon_util_1.c b/src/dungeon_util_1.c index f72a6c782..a63ca88fc 100644 --- a/src/dungeon_util_1.c +++ b/src/dungeon_util_1.c @@ -4,7 +4,7 @@ #include "constants/direction.h" #include "constants/dungeon.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_leader.h" #include "dungeon_util.h" #include "random.h" diff --git a/src/exclusive_pokemon.c b/src/exclusive_pokemon.c index 17106d6a2..caae7613f 100644 --- a/src/exclusive_pokemon.c +++ b/src/exclusive_pokemon.c @@ -250,7 +250,7 @@ void WriteExclusivePokemon(struct unkStruct_8094924 *r0) SaveIntegerBits(r0, gUnknown_203B498, 1); - for(index = 0; index < 424; index++) + for(index = 0; index < MONSTER_MAX; index++) { stack_0 = sub_8098134(index); SaveIntegerBits(r0, &stack_0, 1); @@ -285,7 +285,7 @@ void ReadExclusivePokemon(struct unkStruct_8094924 *r0) memset(gUnknown_203B498, 0, sizeof(struct ExclusivePokemonData)); RestoreIntegerBits(r0, gUnknown_203B498, 1); - for(index = 0; index < 424; index++) + for(index = 0; index < MONSTER_MAX; index++) { RestoreIntegerBits(r0, &stack_0, 1); if(stack_0) diff --git a/src/items.c b/src/items.c index 50d55ee68..77293bac8 100644 --- a/src/items.c +++ b/src/items.c @@ -925,7 +925,7 @@ bool8 IsGummiItem(u8 id) return TRUE; } -bool8 HasGummiItem() +bool8 HasGummiItem(void) { s32 i; for (i = 0; i < INVENTORY_SIZE; i++) { diff --git a/src/move_checks.c b/src/move_checks.c index 57825f325..3b6476f27 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -3,7 +3,7 @@ #include "constants/type.h" #include "constants/weather.h" #include "dungeon_engine.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" diff --git a/src/move_effects_target.c b/src/move_effects_target.c index f68e0461e..52f158e82 100644 --- a/src/move_effects_target.c +++ b/src/move_effects_target.c @@ -17,7 +17,7 @@ #include "dungeon_ai_movement.h" #include "dungeon_ai_targeting.h" #include "dungeon_capabilities.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_leader.h" #include "dungeon_map_access.h" @@ -26,7 +26,7 @@ #include "dungeon_util.h" #include "dungeon_util_1.h" #include "dungeon_visibility.h" -#include "map.h" +#include "structs/map.h" #include "move_effects_target.h" #include "pokemon.h" #include "status_checks.h" diff --git a/src/move_util.c b/src/move_util.c index 2d8343e48..6218ed275 100644 --- a/src/move_util.c +++ b/src/move_util.c @@ -8,7 +8,7 @@ #include "dungeon_util.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" extern bool8 sub_8044B28(void); diff --git a/src/other_menus1.c b/src/other_menus1.c index 1ef435a18..225fbf54d 100644 --- a/src/other_menus1.c +++ b/src/other_menus1.c @@ -7,7 +7,7 @@ #include "code_80130A8.h" #include "constants/communication_error_codes.h" #include "constants/main_menu.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "input.h" #include "items.h" #include "memory.h" diff --git a/src/other_menus2.c b/src/other_menus2.c index 0da04a099..e75c3c29c 100644 --- a/src/other_menus2.c +++ b/src/other_menus2.c @@ -2,7 +2,7 @@ #include "code_8094F88.h" #include "constants/communication_error_codes.h" #include "constants/dungeon.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "main_menu1.h" #include "memory.h" #include "other_menus1.h" diff --git a/src/party_list_menu.c b/src/party_list_menu.c index c4bc5f50f..5549a1bf6 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -6,7 +6,7 @@ #include "code_801BEEC.h" #include "code_801EE10.h" #include "code_801EE10_mid.h" -#include "code_8023144.h" +#include "code_80227B8.h" #include "code_8024458.h" #include "code_8098BDC.h" #include "common_strings.h" @@ -39,7 +39,6 @@ extern PokemonStruct1 *sub_808D3BC(void); extern bool8 sub_808D750(s16 index_); extern void sub_808ED00(void); bool8 sub_8026E88(PokemonStruct1 *r0); -bool8 HasGummiItem(); bool8 sub_8026EB8(PokemonStruct1 *r0); void sub_8026E08(u32 r0); void sub_8026DAC(u32 r0, BulkItem *item); diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 21ce326d1..ff5852d12 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -922,7 +922,7 @@ void sub_808F468(PokemonStruct1 *param_1, EvolveStatus *evolveStatus, u8 param_3 #endif evolveStatus->evolutionConditionStatus = 0; - for(index = MONSTER_BULBASAUR; index <= MONSTER_MAX; index++) + for(index = MONSTER_BULBASAUR; index < MONSTER_MAX; index++) { if ((s16)index == MONSTER_ALAKAZAM) { GetPokemonEvolveConditions(MONSTER_ALAKAZAM, &evolveConditions); @@ -933,11 +933,11 @@ void sub_808F468(PokemonStruct1 *param_1, EvolveStatus *evolveStatus, u8 param_3 if(((evolveConditions.preEvolution.evolveType != EVOLVE_TYPE_NONE) && (param_1->speciesNum == evolveConditions.preEvolution.evolveFrom))) break; }; - if (index == MONSTER_MAX + 1) { + if (index == MONSTER_MAX) { evolveStatus->evolutionConditionStatus = EVOLUTION_NO_MORE; } else { - for(index = MONSTER_BULBASAUR, defaultReason = EVOLUTION_LACK_ITEM; index <= MONSTER_MAX; index++) + for(index = MONSTER_BULBASAUR, defaultReason = EVOLUTION_LACK_ITEM; index < MONSTER_MAX; index++) { evolFlag = FALSE; index2 = (s16)index; diff --git a/src/pokemon_mid.c b/src/pokemon_mid.c index d108fe999..b965810ad 100644 --- a/src/pokemon_mid.c +++ b/src/pokemon_mid.c @@ -880,7 +880,7 @@ s32 sub_808E400(s32 _species, s16* _a2, s32 _a3, s32 _a4) register s16* a2 asm("r6"); i = 1; a2 = _a2; - for (i = 1; i <= MONSTER_MAX; i++) { + for (i = 1; i < MONSTER_MAX; i++) { register s32 current asm("r8") = (s16)i; if (species != GetPokemonEvolveFrom(i)) { continue; diff --git a/src/rescue_password_menu.c b/src/rescue_password_menu.c index 8f9828e06..e884a3973 100644 --- a/src/rescue_password_menu.c +++ b/src/rescue_password_menu.c @@ -635,7 +635,7 @@ u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, unkStruct_203B480 *param_3) { if ( (!sub_803D204(passwordBuffer, param_3)) || (WONDER_MAIL_TYPE_OKD < param_3->mailType) || (param_3->unk4.dungeon.floor >= GetDungeonFloorCount(param_3->unk4.dungeon.id)) || - (param_3->clientSpecies == MONSTER_NONE) || (MONSTER_MAX < param_3->clientSpecies) || + (param_3->clientSpecies == MONSTER_NONE) || (MONSTER_MAX - 1 < param_3->clientSpecies) || (IsInvalidItemReward(param_3->item.id))) { return PASSWORD_ENTRY_INCORRECT_PASSWORD; } diff --git a/src/status.c b/src/status.c index eb9139d51..29c7605f6 100644 --- a/src/status.c +++ b/src/status.c @@ -7,14 +7,14 @@ #include "dungeon_pokemon_attributes.h" #include "dungeon_ai_targeting.h" #include "dungeon_ai_movement.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_util.h" #include "dungeon_items.h" #include "code_808417C.h" #include "code_8077274_1.h" #include "dungeon_movement.h" -#include "map.h" +#include "structs/map.h" extern u8 gAvailablePokemonNames[]; extern u8 gUnknown_202DE58[]; diff --git a/src/status_actions.c b/src/status_actions.c index 0510282cc..532e772e8 100644 --- a/src/status_actions.c +++ b/src/status_actions.c @@ -12,13 +12,13 @@ #include "constants/weather.h" #include "dungeon_engine.h" #include "dungeon_ai_targeting.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" #include "dungeon_visibility.h" -#include "map.h" +#include "structs/map.h" #include "moves.h" #include "number_util.h" //#include "pokemon.h" // NOTE: overriding some of the funcs below... when fixed, uncomment this diff --git a/src/status_checks_1.c b/src/status_checks_1.c index b7098f578..efa6d8ffd 100644 --- a/src/status_checks_1.c +++ b/src/status_checks_1.c @@ -6,7 +6,7 @@ #include "constants/status.h" #include "constants/weather.h" #include "dungeon_engine.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" diff --git a/src/tile_types.c b/src/tile_types.c index 99e6265dd..81692b41f 100644 --- a/src/tile_types.c +++ b/src/tile_types.c @@ -1,7 +1,7 @@ #include "global.h" #include "tile_types.h" #include "code_806CD90.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "dungeon_util.h" diff --git a/src/trap.c b/src/trap.c index bfc27c148..768f38d1b 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3,7 +3,7 @@ #include "dungeon_map_access.h" #include "dungeon_util.h" -#include "map.h" +#include "structs/map.h" bool8 CanLayTrap(Position *pos) { diff --git a/src/type_effectiveness.c b/src/type_effectiveness.c index a2a68eac0..6c9aba7bb 100644 --- a/src/type_effectiveness.c +++ b/src/type_effectiveness.c @@ -4,7 +4,7 @@ #include "constants/ability.h" #include "constants/status.h" #include "constants/weather.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" #include "status.h" diff --git a/src/weather.c b/src/weather.c index d1699a4f7..1bdc3e3c9 100644 --- a/src/weather.c +++ b/src/weather.c @@ -4,7 +4,7 @@ #include "constants/item.h" #include "constants/move_id.h" #include "constants/weather.h" -#include "dungeon_global_data.h" +#include "structs/str_dungeon.h" #include "dungeon_items.h" #include "dungeon_random.h" #include "dungeon_util.h" diff --git a/src/wigglytuff_shop2.c b/src/wigglytuff_shop2.c index 473a5ae23..49ba357df 100644 --- a/src/wigglytuff_shop2.c +++ b/src/wigglytuff_shop2.c @@ -142,7 +142,7 @@ static void sub_8021A60(void) sWigglytuffShop2Work->unk30[index] = 0; } - for (index = 0; index <= MONSTER_MAX; index++) { + for (index = 0; index < MONSTER_MAX; index++) { s32 index2 = (s16)index; if (sWigglytuffShop2Work->friendArea == GetFriendArea(index2) && index2 == GetBaseSpeciesNoUnown(index2)) { @@ -152,7 +152,7 @@ static void sub_8021A60(void) } } - for (index = 0; index <= MONSTER_MAX; index++) { + for (index = 0; index < MONSTER_MAX; index++) { if (!sub_8098134(index)) continue; diff --git a/src/wigglytuff_shop3.c b/src/wigglytuff_shop3.c index a98776ae2..5d9e74749 100644 --- a/src/wigglytuff_shop3.c +++ b/src/wigglytuff_shop3.c @@ -266,7 +266,7 @@ static void UpdateWigglytuffDialogue(void) sub_8023144(0, 3, 0, 10); break; case WIGGLYTUFF_UNK17: - sub_8023354(1); + sub_8023354(TRUE); break; case DISPLAY_POKEMON_FRIEND_AREA_INFO: sub_8092638(sWigglytuffShop3Work->chosenFriendArea, &uStack_14, FALSE, FALSE); @@ -528,7 +528,7 @@ static void sub_8022668(void) static void sub_8022684(void) { - switch (sub_8023278(1)) { + switch (sub_8023278(TRUE)) { case 3: sWigglytuffShop3Work->chosenSpecies = sub_802331C(); sWigglytuffShop3Work->chosenFriendArea = GetFriendArea(sWigglytuffShop3Work->chosenSpecies); diff --git a/sym_ewram2.txt b/sym_ewram2.txt index cb615395a..7e81e5e71 100644 --- a/sym_ewram2.txt +++ b/sym_ewram2.txt @@ -182,18 +182,8 @@ gUnknown_203B278: /* 203B278 */ .include "src/wigglytuff_shop1.o" .include "src/wigglytuff_shop2.o" .include "src/wigglytuff_shop3.o" - -gUnknown_203B294: /* 203B294 (sub_80227B8 - sub_8023120) */ - .space 0x4 - -gUnknown_203B298: /* 203B298 (sub_8023144 - sub_80233A0) */ - .space 0x4 - -gUnknown_203B29C: /* 203B29C (sub_8023144 - sub_80233A0) */ - .space 0x2 - -gUnknown_203B29E: /* 203B29E (sub_8023144 - sub_80233A0) */ - .space 0x2 +.include "src/code_80227B8.o" +.include "src/code_8023144.o" gUnknown_203B2A0: /* 203B2A0 (sub_8023868 - sub_8023C60) */ .space 0x4 diff --git a/sym_iwram.txt b/sym_iwram.txt index 39a8e9b31..933b16300 100644 --- a/sym_iwram.txt +++ b/sym_iwram.txt @@ -26,9 +26,7 @@ gUnknown_3001B58: /* 3001B58 */ gUnknown_3001B5A: /* 3001B5A */ .space 0x2 -gUnknown_3001B5C: /* 3001B5C */ - .space 0x4 - +.include "src/code_8023144.o" .include "src/code_8023868.o" gUnknown_3001B64: /* 3001B64 */