From f81c52b56e865d8ecc753a69a31a5148548320a6 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Mon, 12 Feb 2018 13:59:42 -0500 Subject: [PATCH] more fixes --- data/item_menu.s | 127 ------------ include/graphics.h | 6 +- include/pokemon_summary_screen.h | 2 +- include/strings.h | 56 ++--- ld_script.txt | 2 +- src/item_menu.c | 338 ++++++++++++++++++++----------- src/item_use.c | 2 +- 7 files changed, 256 insertions(+), 277 deletions(-) delete mode 100644 data/item_menu.s diff --git a/data/item_menu.s b/data/item_menu.s deleted file mode 100644 index 1b11c5e59..000000000 --- a/data/item_menu.s +++ /dev/null @@ -1,127 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_08613F90:: @ 8613F90 - .4byte 0x11F0, 0x1E1, 0x21DE - -@ possibly a struct -gUnknown_08613F9C:: @ 8613F9C - .4byte 0 - .4byte bag_menu_change_item_callback - .4byte sub_81AB520 - .4byte 0 - .4byte 0x80000 - .4byte 0x7003011 - -gUnknown_08613FB4:: @ 8613FB4 - .4byte gMenuText_Use, ItemMenu_UseOutOfBattle - .4byte gMenuText_Toss, ItemMenu_Toss - .4byte gMenuText_Register, ItemMenu_Register - .4byte gMenuText_Give, ItemMenu_Give - .4byte gText_Cancel2, ItemMenu_Cancel - .4byte gMenuText_Use, ItemMenu_UseInBattle - .4byte gMenuText_Check, ItemMenu_UseOutOfBattle - .4byte gMenuText_Walk, ItemMenu_UseOutOfBattle - .4byte gMenuText_Deselect, ItemMenu_Register - .4byte gMenuText_CheckTag, ItemMenu_CheckTag - .4byte gMenuText_Confirm, unknown_ItemMenu_Confirm - .4byte gMenuText_Show, unknown_ItemMenu_Show - .4byte gMenuText_Give2, unknown_ItemMenu_Give2 - .4byte gMenuText_Confirm, unknown_ItemMenu_Confirm2 - .4byte gText_EmptyString2, NULL - -gUnknown_0861402C:: @ 861402C - .byte 0, 3, 1, 4 - -gUnknown_08614030:: @ 8614030 - .byte 0, 2, 14, 4 - -gUnknown_08614034:: @ 8614034 - .byte 3, 14, 1, 4 - -gUnknown_08614038:: @ 8614038 - .byte 0, 3, 14, 4 - -gUnknown_0861403C:: @ 861403C - .byte 9, 14, 0, 3, 1, 4 - -gUnknown_08614042:: @ 8614042 - .byte 5, 4 - -gUnknown_08614044:: @ 8614044 - .byte 3, 4 - -gUnknown_08614046:: @ 8614046 - .byte 4 - -gUnknown_08614047:: @ 8614047 - .byte 10, 9, 14, 4 - -gUnknown_0861404B:: @ 861404B - .byte 11, 4 - -gUnknown_0861404D:: @ 861404D - .byte 12, 4 - -gUnknown_0861404F:: @ 861404F - .byte 13, 4 - - .align 2 -gUnknown_08614054:: @ 8614054 - .4byte unknown_item_menu_type - .4byte unknown_item_menu_type - .4byte item_menu_type_2 - .4byte display_sell_item_ask_str - .4byte unknown_ItemMenu_Confirm - .4byte unknown_item_menu_type - .4byte display_deposit_item_ask_str - .4byte unknown_item_menu_type - .4byte unknown_item_menu_type - .4byte unknown_item_menu_type - .4byte NULL - .4byte item_menu_type_b - - .align 2 -gUnknown_08614084:: @ 8614084 - .4byte BagMenuActuallyToss - .4byte BagMenuCancelToss - -gUnknown_0861408C:: @ 861408C - .4byte sub_81AD84C - .4byte sub_81AD6FC - -@ probably a struct -gUnknown_08614094:: @ 8614094 - .4byte 0x1101C00 - .4byte 0xFFFF1064 - .4byte 0x6FFFFF - .4byte 0x6F - -gUnknown_086140A4:: @ 86140A4 - .incbin "graphics/interface/select_button.4bpp" - -gUnknown_08614164:: @ 8614164 - .byte 0, 1, 3, 0, 1, 4, 0, 3, 6, 2, 1, 3, 0, 14, 10, 0 - -gUnknown_08614174:: @ 8614174 - window_template 0, 14, 2, 15, 16, 1, 0x27 - window_template 0, 0, 13, 14, 6, 1, 0x117 - window_template 0, 4, 1, 8, 2, 1, 0x1A1 - window_template 0, 1, 13, 5, 6, 12, 0x16B - window_template 0, 7, 13, 4, 6, 12, 0x189 - window_template 1, 2, 15, 27, 4, 15, 0x1B1 - null_window_template - -gUnknown_086141AC:: @ 86141AC - window_template 1, 22, 17, 7, 2, 15, 0x21D - window_template 1, 22, 15, 7, 4, 15, 0x21D - window_template 1, 15, 15, 14, 4, 15, 0x21D - window_template 1, 15, 13, 14, 6, 15, 0x21D - window_template 1, 2, 15, 27, 4, 15, 0x1B1 - window_template 1, 24, 15, 5, 4, 15, 0x21D - window_template 1, 21, 9, 5, 4, 15, 0x21D - window_template 1, 24, 17, 5, 2, 15, 0x21D - window_template 1, 18, 11, 10, 2, 15, 0x245 - window_template 1, 1, 1, 10, 2, 15, 0x231 diff --git a/include/graphics.h b/include/graphics.h index 8ed54bcfb..6e5de9ef4 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2721,8 +2721,8 @@ extern const u8 gFireRedMenuElements_Gfx[]; //item menu graphics extern const u8 gBagScreen_Gfx[]; -extern u16 gBagScreenFemale_Pal[]; -extern u16 gBagScreenMale_Pal[]; -extern u8 gBagMenuHMIcon_Gfx[]; +extern const u16 gBagScreenFemale_Pal[]; +extern const u16 gBagScreenMale_Pal[]; +extern const u8 gBagMenuHMIcon_Gfx[]; #endif //GUARD_GRAPHICS_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index a4e46dd6e..adadcea03 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -3,4 +3,4 @@ void sub_81C4F98(u8, void(*)(void)); -#endif // GUARD_POKEMON_SUMMARY_SCREEN_H \ No newline at end of file +#endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/include/strings.h b/include/strings.h index 4e96dc528..2bdeef8ca 100644 --- a/include/strings.h +++ b/include/strings.h @@ -134,6 +134,14 @@ extern const u8 gMenuText_Use[]; extern const u8 gMenuText_Toss[]; extern const u8 gMenuText_Give[]; extern const u8 gMenuText_Give2[]; +extern const u8 gMenuText_Register[]; +extern const u8 gMenuText_Check[]; +extern const u8 gMenuText_Walk[]; +extern const u8 gMenuText_Deselect[]; +extern const u8 gMenuText_CheckTag[]; +extern const u8 gMenuText_Confirm[]; +extern const u8 gMenuText_Show[]; +extern const u8 gMenuText_Give2[]; extern const u8 gText_Cancel2[]; @@ -240,29 +248,29 @@ extern const u8 gText_ThreeMarks[]; extern const u8 gText_FirmSlash[]; //item menu screen text -extern u8 gText_CloseBag[]; -extern u8 gText_ClearTo11Var1Clear5Var2[]; -extern u8 gText_UnkF908Var1Clear7Var2[]; -extern u8 gText_xVar1[]; -extern u8 gText_ReturnToVar1[]; -extern u8 gText_SelectorArrow2[]; -extern u8 gText_MoveVar1Where[]; -extern u8 gText_Var1IsSelected[]; -extern u8 gText_TossHowManyVar1s[]; -extern u8 gText_ConfirmTossItems[]; -extern u8 gText_ThrewAwayVar2Var1s[]; -extern u8 gText_CantWriteMail[]; -extern u8 gText_NoPokemon[]; -extern u8 gText_Var1CantBeHeld[]; -extern u8 gText_Var1CantBeHeldHere[]; -extern u8 gText_CantBuyKeyItem[]; -extern u8 gText_HowManyToSell[]; -extern u8 gText_ICanPayVar1[]; -extern u8 gText_TurnedOverVar1ForVar2[]; -extern u8 gText_DepositHowManyVar1[]; -extern u8 gText_CantStoreImportantItems[]; -extern u8 gText_DepositedVar2Var1s[]; -extern u8 gText_NoRoomForItems[]; -extern u8 gText_ThreeDashes[]; +extern const u8 gText_CloseBag[]; +extern const u8 gText_ClearTo11Var1Clear5Var2[]; +extern const u8 gText_UnkF908Var1Clear7Var2[]; +extern const u8 gText_xVar1[]; +extern const u8 gText_ReturnToVar1[]; +extern const u8 gText_SelectorArrow2[]; +extern const u8 gText_MoveVar1Where[]; +extern const u8 gText_Var1IsSelected[]; +extern const u8 gText_TossHowManyVar1s[]; +extern const u8 gText_ConfirmTossItems[]; +extern const u8 gText_ThrewAwayVar2Var1s[]; +extern const u8 gText_CantWriteMail[]; +extern const u8 gText_NoPokemon[]; +extern const u8 gText_Var1CantBeHeld[]; +extern const u8 gText_Var1CantBeHeldHere[]; +extern const u8 gText_CantBuyKeyItem[]; +extern const u8 gText_HowManyToSell[]; +extern const u8 gText_ICanPayVar1[]; +extern const u8 gText_TurnedOverVar1ForVar2[]; +extern const u8 gText_DepositHowManyVar1[]; +extern const u8 gText_CantStoreImportantItems[]; +extern const u8 gText_DepositedVar2Var1s[]; +extern const u8 gText_NoRoomForItems[]; +extern const u8 gText_ThreeDashes[]; #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index f9cb25225..2aebc9adb 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -522,7 +522,7 @@ SECTIONS { data/battle_frontier_1.o(.rodata); src/menu.o(.rodata); data/battle_frontier_2.o(.rodata); - data/item_menu.o(.rodata); + src/item_menu.o(.rodata); data/menu_indicators.o(.rodata); src/save_location.o(.rodata); data/item_icon.o(.rodata); diff --git a/src/item_menu.c b/src/item_menu.c index 112f6faad..3c1b88cd7 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -47,6 +47,208 @@ #include "menu_helpers.h" #include "window.h" +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); +void CB2_Bag(void); +bool8 setup_bag_menu(void); +void bag_menu_init_bgs(void); +bool8 load_bag_menu_graphics(void); +void setup_bag_menu_textboxes(void); +void allocate_bag_item_list_buffers(void); +void load_bag_item_list_buffers(u8); +void bag_menu_print_pocket_names(u8*, u8*); +void bag_menu_copy_pocket_name_to_window(u32); +void bag_menu_draw_pocket_indicator_square(u8, u8); +void AddBagVisualObject(u8); +void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void); +void bag_menu_add_list_scroll_arrow_indicators_maybe(void); +void bag_menu_prepare_tmhm_move_window(void); +bool8 IsWallysBag(void); +void Task_WallyTutorialBagMenu(u8); +void Task_BagMenu(u8); +void get_name(s8*, u16); +u16 ItemIdToBattleMoveId(u16); +void ShakeBagVisual(void); +u16 BagGetItemIdByPocketPosition(u8, u16); +void AddBagItemIconObject(u16, u8); +void bag_menu_print_description_box_text(int); +void bag_menu_print_cursor(u8, u8); +void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8); +bool8 itemid_is_unique(u16); +u16 BagGetQuantityByPocketPosition(u8, u16); +void sub_81AB89C(void); +void task_close_bag_menu_2(u8); +u8 AddItemMessageWindow(u8); +void bag_menu_RemoveBagItem_message_window(u8); +void set_callback3_to_bag(u8); +void sub_81ABC54(u8, s16); +u8 bag_menu_add_window(u8); +u8 GetSwitchBagPocketDirection(void); +void SwitchBagPocket(u8, s16, u16); +bool8 sub_81AC2C0(void); +void bag_menu_swap_items(u8); +void SetBagVisualPocketId(u8, u8); +void RemoveBagObject(u8); +void AddSwitchPocketRotatingBallObject(s16); +void sub_81AC10C(u8); +void sub_81AC3C0(u8); +void sub_81AC498(u8); +void sub_81AC590(u8); +void PrintTMHMMoveData(u16); +void sub_81ACAF8(u8); +void sub_81ACB54(u8, u8, u8); +void Task_HandleInBattleItemMenuInput(u8); +void Task_HandleOutOfBattleItemMenuInput(u8); +bool8 sub_81ACDFC(s8); +void bag_menu_remove_window(u8); +void bag_menu_print_there_is_no_pokemon(u8); +void Task_ChooseHowManyToToss(u8); +void BagMenuConfirmToss(u8); +void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*); +void Task_ActuallyToss(u8); +void ItemMenu_Cancel(u8); +void sub_81AD350(u8); +void bag_menu_print_cant_be_held_msg(u8); +void bag_menu_AddMoney_window(void); +void sub_81AD680(u8); +void sub_81AD730(u8); +void sub_81AD6E4(u8); +void bag_menu_remove_money_window(void); +void bag_menu_RemoveBagItem_message_window(u8); +void sub_81AD794(u8); +void sub_81AD8C8(u8); +void sub_81AD9C0(u8); +void sub_81ADB14(u8); +void sub_81ADA7C(u8); +void sub_81ADC0C(u8); +void bag_menu_leave_maybe_3(void); +void bag_menu_leave_maybe_2(void); +void bag_menu_leave_maybe(void); +void sub_81ABA6C(void); +void sub_81ABAC4(void); +void sub_81ABAE0(void); +u8 sub_81AB1F0(u8); +void sub_81AC23C(u8); +void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu*); +void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a); +void ItemMenu_UseOutOfBattle(u8 taskId); +void ItemMenu_Toss(u8 taskId); +void ItemMenu_Register(u8 taskId); +void ItemMenu_Give(u8 taskId); +void ItemMenu_Cancel(u8 taskId); +void ItemMenu_UseInBattle(u8 taskId); +void ItemMenu_CheckTag(u8 taskId); +void unknown_ItemMenu_Confirm(u8 taskId); +void unknown_ItemMenu_Show(u8 taskId); +void unknown_ItemMenu_Give2(u8 taskId); +void unknown_ItemMenu_Confirm2(u8 taskId); +void unknown_item_menu_type(u8 taskId); +void item_menu_type_2(u8 taskId); +void display_sell_item_ask_str(u8 taskId); +void unknown_ItemMenu_Confirm(u8 taskId); +void display_deposit_item_ask_str(u8 taskId); +void item_menu_type_b(u8 taskId); +void BagMenuActuallyToss(u8 taskId); +void BagMenuCancelToss(u8 taskId); +void sub_81AD84C(u8 taskId); +void sub_81AD6FC(u8 taskId); + +// .rodata + +const struct BgTemplate gUnknown_08613F90[3] = { + {0, 0, 31, 0, 0, 1, 0}, + {1, 0, 30, 0, 0, 0, 0}, + {2, 3, 29, 0, 0, 2, 0} +}; + +const struct ListMenuTemplate gUnknown_08613F9C = { + NULL, bag_menu_change_item_callback, sub_81AB520, 0, 0, 0, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 7, 0 +}; + +const struct MenuAction gUnknown_08613FB4[] = { + {gMenuText_Use, ItemMenu_UseOutOfBattle}, + {gMenuText_Toss, ItemMenu_Toss}, + {gMenuText_Register, ItemMenu_Register}, + {gMenuText_Give, ItemMenu_Give}, + {gText_Cancel2, ItemMenu_Cancel}, + {gMenuText_Use, ItemMenu_UseInBattle}, + {gMenuText_Check, ItemMenu_UseOutOfBattle}, + {gMenuText_Walk, ItemMenu_UseOutOfBattle}, + {gMenuText_Deselect, ItemMenu_Register}, + {gMenuText_CheckTag, ItemMenu_CheckTag}, + {gMenuText_Confirm, unknown_ItemMenu_Confirm}, + {gMenuText_Show, unknown_ItemMenu_Show}, + {gMenuText_Give2, unknown_ItemMenu_Give2}, + {gMenuText_Confirm, unknown_ItemMenu_Confirm2}, + {gText_EmptyString2, NULL} +}; + +const u8 gUnknown_0861402C[] = {0, 3, 1, 4}; +const u8 gUnknown_08614030[] = {0, 2, 14, 4}; +const u8 gUnknown_08614034[] = {3, 14, 1, 4}; +const u8 gUnknown_08614038[] = {0, 3, 14, 4}; +const u8 gUnknown_0861403C[] = {9, 14, 0, 3, 1, 4}; +const u8 gUnknown_08614042[] = {5, 4}; +const u8 gUnknown_08614044[] = {3, 4}; +const u8 gUnknown_08614046 = 4; +const u8 gUnknown_08614047[] = {10, 9, 14, 4}; +const u8 gUnknown_0861404B[] = {11, 4}; +const u8 gUnknown_0861404D[] = {12, 4}; +const u8 gUnknown_0861404F[] = {13, 4}; + +const TaskFunc gUnknown_08614054[] = { + unknown_item_menu_type, + unknown_item_menu_type, + item_menu_type_2, + display_sell_item_ask_str, + unknown_ItemMenu_Confirm, + unknown_item_menu_type, + display_deposit_item_ask_str, + unknown_item_menu_type, + unknown_item_menu_type, + unknown_item_menu_type, + NULL, + item_menu_type_b +}; + +const struct YesNoFuncTable gUnknown_08614084 = {BagMenuActuallyToss, BagMenuCancelToss}; + +const struct YesNoFuncTable gUnknown_0861408C = {sub_81AD84C, sub_81AD6FC}; + +const u16 gUnknown_08614094[] = {0x1C00, 0x110, 0x1064, -1, -1, 0x6F, 0x6F, 0}; + +const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp"); + +const u8 gUnknown_08614164[][3] = { + {0, 1, 3}, + {0, 1, 4}, + {0, 3, 6}, + {2, 1, 3}, + {0, 14, 10} +}; + +const struct WindowTemplate gUnknown_08614174[] = { + {0, 14, 2, 15, 16, 1, 0x27}, + {0, 0, 13, 14, 6, 1, 0x117}, + {0, 4, 1, 8, 2, 1, 0x1A1}, + {0, 1, 13, 5, 6, 12, 0x16B}, + {0, 7, 13, 4, 6, 12, 0x189}, + {1, 2, 15, 27, 4, 15, 0x1B1}, + {0xFF, 0, 0, 0, 0, 0, 0} +}; + +const struct WindowTemplate gUnknown_086141AC[] = { + {1, 22, 17, 7, 2, 15, 0x21D}, + {1, 22, 15, 7, 4, 15, 0x21D}, + {1, 15, 15, 14, 4, 15, 0x21D}, + {1, 15, 13, 14, 6, 15, 0x21D}, + {1, 2, 15, 27, 4, 15, 0x1B1}, + {1, 24, 15, 5, 4, 15, 0x21D}, + {1, 21, 9, 5, 4, 15, 0x21D}, + {1, 24, 17, 5, 2, 15, 0x21D}, + {1, 18, 11, 10, 2, 15, 0x245}, + {1, 1, 1, 10, 2, 15, 0x231} +}; + // .text struct BagStruct { @@ -76,7 +278,7 @@ struct UnkBagStruct { u8 filler3[2]; u8 unk81E; u8 unk81F; - u8* unk820; + const u8* unk820; u8 unk824; u8 unk825; u8 filler[2]; @@ -115,121 +317,17 @@ EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0; void (*gFieldCallback)(void); -void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); -void CB2_Bag(void); -bool8 setup_bag_menu(void); -void bag_menu_init_bgs(void); -bool8 load_bag_menu_graphics(void); -void setup_bag_menu_textboxes(void); -void allocate_bag_item_list_buffers(void); -void load_bag_item_list_buffers(u8); -void bag_menu_print_pocket_names(u8*, u8*); -void bag_menu_copy_pocket_name_to_window(u32); -void bag_menu_draw_pocket_indicator_square(u8, u8); -void AddBagVisualObject(u8); -void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void); -void bag_menu_add_list_scroll_arrow_indicators_maybe(void); -void bag_menu_prepare_tmhm_move_window(void); -bool8 IsWallysBag(void); -void Task_WallyTutorialBagMenu(u8); -void Task_BagMenu(u8); -void get_name(s8*, u16); -u16 ItemIdToBattleMoveId(u16); -void ShakeBagVisual(void); -u16 BagGetItemIdByPocketPosition(u8, u16); -void AddBagItemIconObject(u16, u8); -void bag_menu_print_description_box_text(int); -void bag_menu_print_cursor(u8, u8); -void bag_menu_print(u8, u8, u8*, u8, u8, u8, u8, u8, u8); -bool8 itemid_is_unique(u16); -u16 BagGetQuantityByPocketPosition(u8, u16); -void sub_81AB89C(void); -void task_close_bag_menu_2(u8); -u8 AddItemMessageWindow(u8); -void bag_menu_RemoveBagItem_message_window(u8); -void set_callback3_to_bag(u8); -void sub_81ABC54(u8, s16); -u8 bag_menu_add_window(u8); -u8 GetSwitchBagPocketDirection(void); -void SwitchBagPocket(u8, s16, u16); -bool8 sub_81AC2C0(void); -void bag_menu_swap_items(u8); -void SetBagVisualPocketId(u8, u8); -void RemoveBagObject(u8); -void AddSwitchPocketRotatingBallObject(s16); -void sub_81AC10C(u8); -void sub_81AC3C0(u8); -void sub_81AC498(u8); -void sub_81AC590(u8); -void PrintTMHMMoveData(u16); -void sub_81ACAF8(u8); -void sub_81ACB54(u8, u8, u8); -void Task_HandleInBattleItemMenuInput(u8); -void Task_HandleOutOfBattleItemMenuInput(u8); -bool8 sub_81ACDFC(s8); -void bag_menu_remove_window(u8); -void bag_menu_print_there_is_no_pokemon(u8); -void Task_ChooseHowManyToToss(u8); -void BagMenuConfirmToss(u8); -void bag_menu_yes_no(u8, u8, struct YesNoFuncTable*); -void Task_ActuallyToss(u8); -void ItemMenu_Cancel(u8); -void sub_81AD350(u8); -void bag_menu_print_cant_be_held_msg(u8); -void bag_menu_AddMoney_window(void); -void sub_81AD680(u8); -void sub_81AD730(u8); -void sub_81AD6E4(u8); -void bag_menu_remove_money_window(void); -void bag_menu_RemoveBagItem_message_window(u8); -void sub_81AD794(u8); -void sub_81AD8C8(u8); -void sub_81AD9C0(u8); -void sub_81ADB14(u8); -void sub_81ADA7C(u8); -void sub_81ADC0C(u8); -void bag_menu_leave_maybe_3(void); -void bag_menu_leave_maybe_2(void); -void bag_menu_leave_maybe(void); -void sub_81ABA6C(void); -void sub_81ABAC4(void); -void sub_81ABAE0(void); -u8 sub_81AB1F0(u8); -void sub_81AC23C(u8); - extern u8 *gPocketNamesStringsTable[]; -extern struct BgTemplate gUnknown_08613F90[]; extern u8 gUnknown_08D9A88C[]; extern struct CompressedSpriteSheet gUnknown_0857FB34; extern struct CompressedSpriteSheet gUnknown_0857FB3C; extern struct CompressedSpritePalette gUnknown_0857FB44; extern struct ListMenuTemplate gUnknown_08613F9C; extern u8 gMoveNames[][0xD]; -extern u8 gUnknown_086140A4[]; extern u8* gReturnToXStringsTable[]; -extern u32 gUnknown_08614094[]; extern u32 gUnknown_0203CE5E[]; -extern TaskFunc gUnknown_08614054[]; -extern u8 gUnknown_0861402C[]; -extern u8 gUnknown_08614030[]; -extern u8 gUnknown_08614034[]; -extern u8 gUnknown_08614038[]; -extern u8 gUnknown_0861403C[]; -extern u8 gUnknown_08614042[]; -extern u8 gUnknown_08614044[]; -extern u8 gUnknown_08614046[]; -extern u8 gUnknown_08614047[]; -extern u8 gUnknown_0861404B[]; -extern u8 gUnknown_0861404D[]; -extern u8 gUnknown_0861404F[]; -extern struct MenuAction gUnknown_08613FB4[]; -extern struct YesNoFuncTable gUnknown_08614084; extern u8 EventScript_2736B3[]; -extern struct YesNoFuncTable gUnknown_0861408C; -extern struct WindowTemplate gUnknown_08614174[]; extern u16 gUnknown_0860F074[]; -extern u8 gUnknown_08614164[][3]; -extern struct WindowTemplate gUnknown_086141AC[]; extern struct BattleMove gBattleMoves[]; void ResetBagScrollPositions(void) @@ -462,7 +560,7 @@ void bag_menu_init_bgs(void) SetBgTilemapBuffer(2, gUnknown_0203CE54->unk4); ResetAllBgsCoordinates(); schedule_bg_copy_tilemap_to_vram(2); - SetGpuReg(REG_OFFSET_DISPCNT, 0x1040); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); ShowBg(0); ShowBg(1); ShowBg(2); @@ -535,7 +633,7 @@ void load_bag_item_list_buffers(u8 pocketId) if (!gUnknown_0203CE54->unk81B_2) { - for (i = 0;i < gUnknown_0203CE54->unk829[pocketId] - 1; i++) + for (i = 0; i < gUnknown_0203CE54->unk829[pocketId] - 1; i++) { get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId); subBuffer = gUnknown_0203CE74->subBuffers; @@ -549,7 +647,7 @@ void load_bag_item_list_buffers(u8 pocketId) } else { - for (i = 0;i < gUnknown_0203CE54->unk829[pocketId]; i++) + for (i = 0; i < gUnknown_0203CE54->unk829[pocketId]; i++) { get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId); subBuffer = gUnknown_0203CE74->subBuffers; @@ -591,7 +689,7 @@ void get_name(s8 *dest, u16 itemId) } } -void bag_menu_change_item_callback(u32 a, u8 b) +void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu *unused) { if (b != 1) { @@ -802,7 +900,7 @@ u8 sub_81ABB2C(u8 a) return gUnknown_0203CE58.scrollPosition[a] + gUnknown_0203CE58.cursorPosition[a]; } -void DisplayItemMessage(u8 taskId, u8 fontId, u8 *str, void ( *callback)(u8 taskId)) +void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId)) { s16* data = gTasks[taskId].data; @@ -1325,7 +1423,7 @@ void sub_81AC644(u8 unused) } else { - gUnknown_0203CE54->unk820 = gUnknown_08614046; + gUnknown_0203CE54->unk820 = &gUnknown_08614046; gUnknown_0203CE54->unk828 = 1; } break; @@ -1341,7 +1439,7 @@ void sub_81AC644(u8 unused) } else { - gUnknown_0203CE54->unk820 = gUnknown_08614046; + gUnknown_0203CE54->unk820 = &gUnknown_08614046; gUnknown_0203CE54->unk828 = 1; } break; @@ -1353,7 +1451,7 @@ void sub_81AC644(u8 unused) } else { - gUnknown_0203CE54->unk820 = gUnknown_08614046; + gUnknown_0203CE54->unk820 = &gUnknown_08614046; gUnknown_0203CE54->unk828 = 1; } break; @@ -1365,7 +1463,7 @@ void sub_81AC644(u8 unused) } else { - gUnknown_0203CE54->unk820 = gUnknown_08614046; + gUnknown_0203CE54->unk820 = &gUnknown_08614046; gUnknown_0203CE54->unk828 = 1; } break; @@ -1378,7 +1476,7 @@ void sub_81AC644(u8 unused) { if (gUnknown_0203CE58.pocket == 4 || !sub_8122148(gSpecialVar_ItemId)) { - gUnknown_0203CE54->unk820 = gUnknown_08614046; + gUnknown_0203CE54->unk820 = &gUnknown_08614046; gUnknown_0203CE54->unk828 = 1; } else @@ -2213,7 +2311,7 @@ void setup_bag_menu_textboxes(void) copy_textbox_border_tile_patterns_to_vram(0, 10, -48); sub_819A2BC(-64, 1); LoadPalette(&gUnknown_0860F074, 0xF0, 0x20); - for (i = 0;i < 3; i++) + for (i = 0; i < 3; i++) { FillWindowPixelBuffer(i, 0); PutWindowTilemap(i); @@ -2222,7 +2320,7 @@ void setup_bag_menu_textboxes(void) schedule_bg_copy_tilemap_to_vram(1); } -void bag_menu_print(u8 a, u8 b, u8 *str, u8 c, u8 d, u8 e, u8 f, u8 g, u8 h) +void bag_menu_print(u8 a, u8 b, const u8 *str, u8 c, u8 d, u8 e, u8 f, u8 g, u8 h) { AddTextPrinterParameterized2(a, b, c, d, e, f, gUnknown_08614164[h], g, str); } @@ -2278,7 +2376,7 @@ void bag_menu_RemoveBagItem_message_window(u8 a) } } -void bag_menu_yes_no(u8 a, u8 b, struct YesNoFuncTable *funcTable) +void bag_menu_yes_no(u8 a, u8 b, const struct YesNoFuncTable *funcTable) { CreateYesNoMenuWithCallbacks(a, &gUnknown_086141AC[b], 1, 0, 2, 1, 14, funcTable); } @@ -2310,12 +2408,12 @@ void PrintTMHMMoveData(u16 itemId) { u8 i; u16 moveId; - u8* text; + const u8* text; FillWindowPixelBuffer(4, 0); if (itemId == ITEM_NONE) { - for (i = 0;i < 4; i++) + for (i = 0; i < 4; i++) bag_menu_print(4, 1, gText_ThreeDashes, 7, i * 12, 0, 0, -1, 4); CopyWindowToVram(4, 2); } diff --git a/src/item_use.c b/src/item_use.c index 1fdd925ac..11dca12fb 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -114,7 +114,7 @@ void sub_80FE024(u8 taskId); void sub_80FE124(u8 taskId); void sub_80FE164(u8 taskId); -void DisplayItemMessage(u8 taskId, u8 a, u8* str, void(*callback)(u8 taskId)); +void DisplayItemMessage(u8 taskId, u8 a, const u8* str, void(*callback)(u8 taskId)); void DisplayItemMessageInBattlePyramid(u8 taskId, u8* str, void(*callback)(u8 taskId)); void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId)); void sub_81C6714(u8 taskId);