diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-08-03 02:17:01 -0400 |
---|---|---|
committer | GriffinR <griffin.g.richards@gmail.com> | 2021-08-10 22:13:02 -0400 |
commit | 28a8fe191af71a71d45afb93480dc59f98e790cf (patch) | |
tree | 7b996bdea556925c90e0c9b157f906c3c5d572dc /include | |
parent | d391486247cc9f29d85787d6711f7cb993cf6585 (diff) |
Document item menu
Diffstat (limited to 'include')
-rw-r--r-- | include/battle_pyramid_bag.h | 6 | ||||
-rw-r--r-- | include/constants/item.h | 5 | ||||
-rw-r--r-- | include/constants/items.h | 10 | ||||
-rw-r--r-- | include/event_scripts.h | 8 | ||||
-rw-r--r-- | include/item_menu.h | 118 | ||||
-rw-r--r-- | include/item_menu_icons.h | 6 | ||||
-rw-r--r-- | include/menu_helpers.h | 4 | ||||
-rw-r--r-- | include/strings.h | 5 |
8 files changed, 80 insertions, 82 deletions
diff --git a/include/battle_pyramid_bag.h b/include/battle_pyramid_bag.h index de571714c..b8b3eb20f 100644 --- a/include/battle_pyramid_bag.h +++ b/include/battle_pyramid_bag.h @@ -29,7 +29,7 @@ enum { struct PyramidBagMenu { - void (*exitCallback)(void); + void (*newScreenCallback)(void); u8 tilemapBuffer[BG_SCREEN_SIZE]; u8 spriteIds[PBAG_SPRITE_COUNT]; u8 windowIds[5]; @@ -49,7 +49,7 @@ struct PyramidBagMenu struct PyramidBagMenuState { - void (*callback)(void); + void (*exitCallback)(void); u8 location; u16 cursorPosition; u16 scrollPosition; @@ -64,7 +64,7 @@ void CB2_ReturnToPyramidBagMenu(void); void UpdatePyramidBagList(void); void UpdatePyramidBagCursorPos(void); void sub_81C4EFC(void); -void GoToBattlePyramidBagMenu(u8 a0, void (*callback)(void)); +void GoToBattlePyramidBagMenu(u8 location, void (*exitCallback)(void)); void Task_CloseBattlePyramidBagMessage(u8 taskId); void TryStoreHeldItemsInPyramidBag(void); void ChooseItemsToTossFromPyramidBag(void); diff --git a/include/constants/item.h b/include/constants/item.h index 3277f2379..a224291fa 100644 --- a/include/constants/item.h +++ b/include/constants/item.h @@ -16,9 +16,4 @@ #define KEYITEMS_POCKET 4 #define POCKETS_COUNT 5 -// The TM/HM pocket is the largest pocket, so the maximum amount of items -// in a pocket is its count + 1 for the cancel option -#define MAX_POCKET_ITEMS (BAG_TMHM_COUNT + 1) - - #endif // GUARD_ITEM_CONSTANTS_H diff --git a/include/constants/items.h b/include/constants/items.h index 8f77e80de..c596dd3b8 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -199,9 +199,11 @@ #define FIRST_BERRY_INDEX ITEM_CHERI_BERRY #define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY -#define ITEM_0B0 176 -#define ITEM_0B1 177 -#define ITEM_0B2 178 +#define ITEM_UNUSED_BERRY_1 176 +#define ITEM_UNUSED_BERRY_2 177 +#define ITEM_UNUSED_BERRY_3 178 + +#define MAX_BERRY_INDEX ITEM_UNUSED_BERRY_3 // Battle Held items #define ITEM_BRIGHT_POWDER 179 @@ -531,6 +533,6 @@ #define ITEM_B_USE_OTHER 2 // Check if the item is one that can be used on a Pokemon. -#define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2) +#define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= MAX_BERRY_INDEX) #endif // GUARD_CONSTANTS_ITEMS_H diff --git a/include/event_scripts.h b/include/event_scripts.h index 3340da6f5..c478f41f8 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -584,9 +584,11 @@ extern const u8 SecretBase_EventScript_ShrubUseSecretPower[]; extern const u8 TrainerHill_EventScript_TrainerBattle[]; // Item Use -extern u8 BerryTree_EventScript_ItemUsePlantBerry[]; -extern u8 BerryTree_EventScript_ItemUseWailmerPail[]; -extern u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[]; +extern const u8 BerryTree_EventScript_ItemUsePlantBerry[]; +extern const u8 BerryTree_EventScript_ItemUseWailmerPail[]; +extern const u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[]; + +extern const u8 EventScript_SelectWithoutRegisteredItem[]; // overworld extern const u8 EventScript_WhiteOut[]; diff --git a/include/item_menu.h b/include/item_menu.h index a99272b0c..fd576c3b5 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -1,107 +1,111 @@ -#ifndef GUARD_item_menu_H -#define GUARD_item_menu_H +#ifndef GUARD_ITEM_MENU_H +#define GUARD_ITEM_MENU_H #include "item.h" #include "menu_helpers.h" -#define ITEMMENULOCATION_FIELD 0 -#define ITEMMENULOCATION_BATTLE 1 -#define ITEMMENULOCATION_PARTY 2 -#define ITEMMENULOCATION_SHOP 3 -#define ITEMMENULOCATION_BERRY_TREE 4 -#define ITEMMENULOCATION_BERRY_BLENDER_CRUSH 5 -#define ITEMMENULOCATION_ITEMPC 6 -#define ITEMMENULOCATION_FAVOR_LADY 7 -#define ITEMMENULOCATION_QUIZ_LADY 8 -#define ITEMMENULOCATION_APPRENTICE 9 -#define ITEMMENULOCATION_WALLY 10 -#define ITEMMENULOCATION_PCBOX 11 -#define ITEMMENULOCATION_LAST 12 +enum { + ITEMMENULOCATION_FIELD, + ITEMMENULOCATION_BATTLE, + ITEMMENULOCATION_PARTY, + ITEMMENULOCATION_SHOP, + ITEMMENULOCATION_BERRY_TREE, + ITEMMENULOCATION_BERRY_BLENDER_CRUSH, + ITEMMENULOCATION_ITEMPC, + ITEMMENULOCATION_FAVOR_LADY, + ITEMMENULOCATION_QUIZ_LADY, + ITEMMENULOCATION_APPRENTICE, + ITEMMENULOCATION_WALLY, + ITEMMENULOCATION_PCBOX, + ITEMMENULOCATION_LAST, +}; -#define ITEMMENUACTION_USE 0 -#define ITEMMENUACTION_TOSS 1 -#define ITEMMENUACTION_REGISTER 2 -#define ITEMMENUACTION_GIVE 3 -#define ITEMMENUACTION_CANCEL 4 -#define ITEMMENUACTION_BATTLE_USE 5 -#define ITEMMENUACTION_CHECK 6 -#define ITEMMENUACTION_WALK 7 -#define ITEMMENUACTION_DESELECT 8 -#define ITEMMENUACTION_CHECK_TAG 9 -#define ITEMMENUACTION_CONFIRM 10 -#define ITEMMENUACTION_SHOW 11 -#define ITEMMENUACTION_GIVE_2 12 -#define ITEMMENUACTION_CONFIRM_2 13 -#define ITEMMENUACTION_DUMMY 14 +// Window IDs for the item menu +enum { + ITEMWIN_1x1, + ITEMWIN_1x2, + ITEMWIN_2x2, + ITEMWIN_2x3, + ITEMWIN_MESSAGE, + ITEMWIN_YESNO_LOW, + ITEMWIN_YESNO_HIGH, + ITEMWIN_QUANTITY, + ITEMWIN_QUANTITY_WIDE, + ITEMWIN_MONEY, + ITEMWIN_COUNT +}; -// Exported type declarations -struct BagStruct +#define ITEMMENU_SWAP_LINE_LENGTH 8 // Swap line is 8 sprites long +enum { + ITEMMENUSPRITE_BAG, + ITEMMENUSPRITE_BALL, + ITEMMENUSPRITE_ITEM, + ITEMMENUSPRITE_ITEM_ALT, // Need two when selecting new item + ITEMMENUSPRITE_SWAP_LINE, + ITEMMENUSPRITE_COUNT = ITEMMENUSPRITE_SWAP_LINE + ITEMMENU_SWAP_LINE_LENGTH, +}; + +struct BagPosition { - void (*bagCallback)(void); + void (*exitCallback)(void); u8 location; u8 pocket; - u16 unk6; + u16 pocketSwitchArrowPos; u16 cursorPosition[POCKETS_COUNT]; u16 scrollPosition[POCKETS_COUNT]; }; -extern struct BagStruct gBagPositionStruct; +extern struct BagPosition gBagPosition; -struct BagMenuStruct +struct BagMenu { - void (*exitCallback)(void); - u8 tilemapBuffer[0x800]; - u8 spriteId[12]; - u8 windowPointers[10]; - u8 itemOriginalLocation; + void (*newScreenCallback)(void); + u8 tilemapBuffer[BG_SCREEN_SIZE]; + u8 spriteIds[ITEMMENUSPRITE_COUNT]; + u8 windowIds[ITEMWIN_COUNT]; + u8 toSwapPos; u8 pocketSwitchDisabled:4; u8 itemIconSlot:2; u8 inhibitItemDescriptionPrint:1; u8 hideCloseBagText:1; - u8 filler3[2]; + u8 unused1[2]; u8 pocketScrollArrowsTask; u8 pocketSwitchArrowsTask; const u8* contextMenuItemsPtr; u8 contextMenuItemsBuffer[4]; u8 contextMenuNumItems; u8 numItemStacks[POCKETS_COUNT]; - u8 numShownItems[6]; + u8 numShownItems[POCKETS_COUNT]; s16 graphicsLoadState; - u8 filler4[0xE]; + u8 unused2[14]; u8 pocketNameBuffer[32][32]; - u8 filler2[4]; + u8 unused3[4]; }; -extern struct BagMenuStruct *gBagMenu; - -// Exported RAM declarations - +extern struct BagMenu *gBagMenu; extern u16 gSpecialVar_ItemId; -// Exported ROM declarations void CB2_GoToItemDepositMenu(void); void FavorLadyOpenBagMenu(void); void QuizLadyOpenBagMenu(void); void ApprenticeOpenBagMenu(void); void CB2_BagMenuFromBattle(void); -void SetInitialScrollAndCursorPositions(u8 pocketId); +void UpdatePocketListPosition(u8 pocketId); void CB2_ReturnToBagMenuPocket(void); void CB2_BagMenuFromStartMenu(void); u8 GetItemListPosition(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); -void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *exitCallback)()); void DoWallyTutorialBagMenu(void); void ResetBagScrollPositions(void); void ChooseBerryForMachine(void (*exitCallback)(void)); void CB2_ChooseBerry(void); void Task_FadeAndCloseBagMenu(u8 taskId); -void BagMenu_YesNo(u8, u8, const struct YesNoFuncTable*); -void BagMenu_InitListsMenu(u8 taskId); +void BagMenu_YesNo(u8 taskId, u8 windowType, const struct YesNoFuncTable* funcTable); void UpdatePocketItemList(u8 pocketId); void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId)); void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback); +void CloseItemMessage(u8 taskId); - - -#endif //GUARD_item_menu_H +#endif //GUARD_ITEM_MENU_H diff --git a/include/item_menu_icons.h b/include/item_menu_icons.h index 50e11dfd9..d01dcccf5 100644 --- a/include/item_menu_icons.h +++ b/include/item_menu_icons.h @@ -22,10 +22,4 @@ void FreeBerryTagSpritePalette(void); u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine); u8 CreateBerryFlavorCircleSprite(s16 x); -#define TAG_BAG_GFX 100 -#define TAG_ROTATING_BALL_GFX 101 -#define TAG_BERRY_CHECK_CIRCLE_GFX 10000 -#define TAG_BERRY_PIC_TILE 0xFFFF -#define TAG_BERRY_PIC_PAL 0x7544 - #endif // GUARD_ITEM_MENU_ICONS_H diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 9909437a2..b9b9e2d80 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -28,13 +28,13 @@ void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *templa bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1); u8 GetLRKeysPressed(void); u8 GetLRKeysPressedAndHeld(void); -bool8 sub_8122148(u16 itemId); +bool8 IsHoldingItemAllowed(u16 itemId); bool8 IsWritingMailAllowed(u16 itemId); bool8 MenuHelpers_LinkSomething(void); bool8 MenuHelpers_CallLinkSomething(void); void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount); void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItems); -void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4); +void SetCursorScrollWithinListBounds(u16 *scrollOffset, u16 *cursorPos, u8 shownItems, u8 totalItems, u8 maxShownItems); void LoadListMenuSwapLineGfx(void); void CreateSwapLineSprites(u8 *spriteIds, u8 count); void DestroySwapLineSprites(u8 *spriteIds, u8 count); diff --git a/include/strings.h b/include/strings.h index 9b3be0538..2357e3777 100644 --- a/include/strings.h +++ b/include/strings.h @@ -419,8 +419,8 @@ extern const u8 gText_FirmSlash[]; // item menu screen text extern const u8 gText_CloseBag[]; -extern const u8 gText_ClearTo11Var1Clear5Var2[]; -extern const u8 gText_NumberVar1Clear7Var2[]; +extern const u8 gText_NumberItem_HM[]; +extern const u8 gText_NumberItem_TMBerry[]; extern const u8 gText_xVar1[]; extern const u8 gText_ReturnToVar1[]; extern const u8 gText_SelectorArrow2[]; @@ -442,6 +442,7 @@ extern const u8 gText_CantStoreImportantItems[]; extern const u8 gText_DepositedVar2Var1s[]; extern const u8 gText_NoRoomForItems[]; extern const u8 gText_ThreeDashes[]; +extern const u8 *const gPocketNamesStringsTable[]; // party menu text extern const u8 gText_PkmnHPRestoredByVar2[]; |