Document return locations.

This commit is contained in:
Meowsy 2018-12-10 11:39:57 -05:00
parent 0aa41ad647
commit 2f008e866b
2 changed files with 27 additions and 13 deletions

View File

@ -3,6 +3,20 @@
#include "item.h" #include "item.h"
#define RETURN_LOCATION_FIELD 0
#define RETURN_LOCATION_BATTLE 1
#define RETURN_LOCATION_POKEMON_LIST 2
#define RETURN_LOCATION_SHOP 3
#define RETURN_LOCATION_FIELD_2 4
#define RETURN_LOCATION_FIELD_3 5
#define RETURN_LOCATION_PC 6
#define RETURN_LOCATION_FIELD_4 7
#define RETURN_LOCATION_FIELD_5 8
#define RETURN_LOCATION_FIELD_6 9
#define RETURN_LOCATION_BATTLE_2 10
#define RETURN_LOCATION_PC_2 11
#define RETURN_LOCATION_UNCHANGED 12
// Exported type declarations // Exported type declarations
struct BagStruct struct BagStruct
{ {

View File

@ -462,53 +462,53 @@ void ResetBagScrollPositions(void)
void CB2_BagMenuFromStartMenu(void) void CB2_BagMenuFromStartMenu(void)
{ {
GoToBagMenu(0, POCKETS_COUNT, CB2_ReturnToFieldWithOpenMenu); GoToBagMenu(RETURN_LOCATION_FIELD, POCKETS_COUNT, CB2_ReturnToFieldWithOpenMenu);
} }
void sub_81AABB0(void) void sub_81AABB0(void)
{ {
if (!InBattlePyramid()) if (!InBattlePyramid())
GoToBagMenu(1, POCKETS_COUNT, SetCB2ToReshowScreenAfterMenu2); GoToBagMenu(RETURN_LOCATION_BATTLE, POCKETS_COUNT, SetCB2ToReshowScreenAfterMenu2);
else else
sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2); sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2);
} }
void CB2_ChooseBerry(void) void CB2_ChooseBerry(void)
{ {
GoToBagMenu(4, BERRIES_POCKET, CB2_ReturnToFieldContinueScript); GoToBagMenu(RETURN_LOCATION_FIELD_2, BERRIES_POCKET, CB2_ReturnToFieldContinueScript);
} }
void sub_81AABF0(void(*callback)(void)) void sub_81AABF0(void(*callback)(void))
{ {
GoToBagMenu(5, BERRIES_POCKET, callback); GoToBagMenu(RETURN_LOCATION_FIELD_3, BERRIES_POCKET, callback);
} }
void CB2_GoToSellMenu(void) void CB2_GoToSellMenu(void)
{ {
GoToBagMenu(3, POCKETS_COUNT, CB2_ExitSellMenu); GoToBagMenu(RETURN_LOCATION_SHOP, POCKETS_COUNT, CB2_ExitSellMenu);
} }
void sub_81AAC14(void) void sub_81AAC14(void)
{ {
GoToBagMenu(6, POCKETS_COUNT, sub_816B31C); GoToBagMenu(RETURN_LOCATION_PC, POCKETS_COUNT, sub_816B31C);
} }
void sub_81AAC28(void) void sub_81AAC28(void)
{ {
GoToBagMenu(9, POCKETS_COUNT, bag_menu_leave_maybe_3); GoToBagMenu(RETURN_LOCATION_FIELD_6, POCKETS_COUNT, bag_menu_leave_maybe_3);
gSpecialVar_0x8005 = 0; gSpecialVar_0x8005 = 0;
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
} }
void sub_81AAC50(void) void sub_81AAC50(void)
{ {
GoToBagMenu(7, POCKETS_COUNT, bag_menu_leave_maybe_2); GoToBagMenu(RETURN_LOCATION_FIELD_4, POCKETS_COUNT, bag_menu_leave_maybe_2);
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
} }
void sub_81AAC70(void) void sub_81AAC70(void)
{ {
GoToBagMenu(8, POCKETS_COUNT, bag_menu_leave_maybe); GoToBagMenu(RETURN_LOCATION_FIELD_5, POCKETS_COUNT, bag_menu_leave_maybe);
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
} }
@ -522,11 +522,11 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)
} }
else else
{ {
if (bagMenuType != 12) if (bagMenuType != RETURN_LOCATION_UNCHANGED)
gUnknown_0203CE58.location = bagMenuType; gUnknown_0203CE58.location = bagMenuType;
if (postExitMenuMainCallback2) if (postExitMenuMainCallback2)
gUnknown_0203CE58.bagCallback = postExitMenuMainCallback2; gUnknown_0203CE58.bagCallback = postExitMenuMainCallback2;
if (pocketId <= POCKETS_COUNT - 1) if (pocketId < POCKETS_COUNT)
gUnknown_0203CE58.pocket = pocketId; gUnknown_0203CE58.pocket = pocketId;
temp = gUnknown_0203CE58.location - (POCKETS_COUNT - 1); temp = gUnknown_0203CE58.location - (POCKETS_COUNT - 1);
if (temp <= 1) if (temp <= 1)
@ -1842,7 +1842,7 @@ void ItemMenu_UseInBattle(u8 taskId)
void bag_menu_mail_related(void) void bag_menu_mail_related(void)
{ {
GoToBagMenu(12, POCKETS_COUNT, NULL); GoToBagMenu(RETURN_LOCATION_UNCHANGED, POCKETS_COUNT, NULL);
} }
void item_menu_type_2(u8 taskId) void item_menu_type_2(u8 taskId)
@ -2157,7 +2157,7 @@ void DoWallyTutorialBagMenu(void)
PrepareBagForWallyTutorial(); PrepareBagForWallyTutorial();
AddBagItem(ITEM_POTION, 1); AddBagItem(ITEM_POTION, 1);
AddBagItem(ITEM_POKE_BALL, 1); AddBagItem(ITEM_POKE_BALL, 1);
GoToBagMenu(10, ITEMS_POCKET, SetCB2ToReshowScreenAfterMenu2); GoToBagMenu(RETURN_LOCATION_BATTLE_2, ITEMS_POCKET, SetCB2ToReshowScreenAfterMenu2);
} }
void Task_WallyTutorialBagMenu(u8 taskId) void Task_WallyTutorialBagMenu(u8 taskId)