mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Document item menu
This commit is contained in:
parent
d391486247
commit
28a8fe191a
@ -29,7 +29,7 @@ enum {
|
|||||||
|
|
||||||
struct PyramidBagMenu
|
struct PyramidBagMenu
|
||||||
{
|
{
|
||||||
void (*exitCallback)(void);
|
void (*newScreenCallback)(void);
|
||||||
u8 tilemapBuffer[BG_SCREEN_SIZE];
|
u8 tilemapBuffer[BG_SCREEN_SIZE];
|
||||||
u8 spriteIds[PBAG_SPRITE_COUNT];
|
u8 spriteIds[PBAG_SPRITE_COUNT];
|
||||||
u8 windowIds[5];
|
u8 windowIds[5];
|
||||||
@ -49,7 +49,7 @@ struct PyramidBagMenu
|
|||||||
|
|
||||||
struct PyramidBagMenuState
|
struct PyramidBagMenuState
|
||||||
{
|
{
|
||||||
void (*callback)(void);
|
void (*exitCallback)(void);
|
||||||
u8 location;
|
u8 location;
|
||||||
u16 cursorPosition;
|
u16 cursorPosition;
|
||||||
u16 scrollPosition;
|
u16 scrollPosition;
|
||||||
@ -64,7 +64,7 @@ void CB2_ReturnToPyramidBagMenu(void);
|
|||||||
void UpdatePyramidBagList(void);
|
void UpdatePyramidBagList(void);
|
||||||
void UpdatePyramidBagCursorPos(void);
|
void UpdatePyramidBagCursorPos(void);
|
||||||
void sub_81C4EFC(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 Task_CloseBattlePyramidBagMessage(u8 taskId);
|
||||||
void TryStoreHeldItemsInPyramidBag(void);
|
void TryStoreHeldItemsInPyramidBag(void);
|
||||||
void ChooseItemsToTossFromPyramidBag(void);
|
void ChooseItemsToTossFromPyramidBag(void);
|
||||||
|
@ -16,9 +16,4 @@
|
|||||||
#define KEYITEMS_POCKET 4
|
#define KEYITEMS_POCKET 4
|
||||||
#define POCKETS_COUNT 5
|
#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
|
#endif // GUARD_ITEM_CONSTANTS_H
|
||||||
|
@ -199,9 +199,11 @@
|
|||||||
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
|
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
|
||||||
#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY
|
#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY
|
||||||
|
|
||||||
#define ITEM_0B0 176
|
#define ITEM_UNUSED_BERRY_1 176
|
||||||
#define ITEM_0B1 177
|
#define ITEM_UNUSED_BERRY_2 177
|
||||||
#define ITEM_0B2 178
|
#define ITEM_UNUSED_BERRY_3 178
|
||||||
|
|
||||||
|
#define MAX_BERRY_INDEX ITEM_UNUSED_BERRY_3
|
||||||
|
|
||||||
// Battle Held items
|
// Battle Held items
|
||||||
#define ITEM_BRIGHT_POWDER 179
|
#define ITEM_BRIGHT_POWDER 179
|
||||||
@ -531,6 +533,6 @@
|
|||||||
#define ITEM_B_USE_OTHER 2
|
#define ITEM_B_USE_OTHER 2
|
||||||
|
|
||||||
// Check if the item is one that can be used on a Pokemon.
|
// 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
|
#endif // GUARD_CONSTANTS_ITEMS_H
|
||||||
|
@ -584,9 +584,11 @@ extern const u8 SecretBase_EventScript_ShrubUseSecretPower[];
|
|||||||
extern const u8 TrainerHill_EventScript_TrainerBattle[];
|
extern const u8 TrainerHill_EventScript_TrainerBattle[];
|
||||||
|
|
||||||
// Item Use
|
// Item Use
|
||||||
extern u8 BerryTree_EventScript_ItemUsePlantBerry[];
|
extern const u8 BerryTree_EventScript_ItemUsePlantBerry[];
|
||||||
extern u8 BerryTree_EventScript_ItemUseWailmerPail[];
|
extern const u8 BerryTree_EventScript_ItemUseWailmerPail[];
|
||||||
extern u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[];
|
extern const u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[];
|
||||||
|
|
||||||
|
extern const u8 EventScript_SelectWithoutRegisteredItem[];
|
||||||
|
|
||||||
// overworld
|
// overworld
|
||||||
extern const u8 EventScript_WhiteOut[];
|
extern const u8 EventScript_WhiteOut[];
|
||||||
|
@ -1,107 +1,111 @@
|
|||||||
#ifndef GUARD_item_menu_H
|
#ifndef GUARD_ITEM_MENU_H
|
||||||
#define GUARD_item_menu_H
|
#define GUARD_ITEM_MENU_H
|
||||||
|
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "menu_helpers.h"
|
#include "menu_helpers.h"
|
||||||
|
|
||||||
#define ITEMMENULOCATION_FIELD 0
|
enum {
|
||||||
#define ITEMMENULOCATION_BATTLE 1
|
ITEMMENULOCATION_FIELD,
|
||||||
#define ITEMMENULOCATION_PARTY 2
|
ITEMMENULOCATION_BATTLE,
|
||||||
#define ITEMMENULOCATION_SHOP 3
|
ITEMMENULOCATION_PARTY,
|
||||||
#define ITEMMENULOCATION_BERRY_TREE 4
|
ITEMMENULOCATION_SHOP,
|
||||||
#define ITEMMENULOCATION_BERRY_BLENDER_CRUSH 5
|
ITEMMENULOCATION_BERRY_TREE,
|
||||||
#define ITEMMENULOCATION_ITEMPC 6
|
ITEMMENULOCATION_BERRY_BLENDER_CRUSH,
|
||||||
#define ITEMMENULOCATION_FAVOR_LADY 7
|
ITEMMENULOCATION_ITEMPC,
|
||||||
#define ITEMMENULOCATION_QUIZ_LADY 8
|
ITEMMENULOCATION_FAVOR_LADY,
|
||||||
#define ITEMMENULOCATION_APPRENTICE 9
|
ITEMMENULOCATION_QUIZ_LADY,
|
||||||
#define ITEMMENULOCATION_WALLY 10
|
ITEMMENULOCATION_APPRENTICE,
|
||||||
#define ITEMMENULOCATION_PCBOX 11
|
ITEMMENULOCATION_WALLY,
|
||||||
#define ITEMMENULOCATION_LAST 12
|
ITEMMENULOCATION_PCBOX,
|
||||||
|
ITEMMENULOCATION_LAST,
|
||||||
|
};
|
||||||
|
|
||||||
#define ITEMMENUACTION_USE 0
|
// Window IDs for the item menu
|
||||||
#define ITEMMENUACTION_TOSS 1
|
enum {
|
||||||
#define ITEMMENUACTION_REGISTER 2
|
ITEMWIN_1x1,
|
||||||
#define ITEMMENUACTION_GIVE 3
|
ITEMWIN_1x2,
|
||||||
#define ITEMMENUACTION_CANCEL 4
|
ITEMWIN_2x2,
|
||||||
#define ITEMMENUACTION_BATTLE_USE 5
|
ITEMWIN_2x3,
|
||||||
#define ITEMMENUACTION_CHECK 6
|
ITEMWIN_MESSAGE,
|
||||||
#define ITEMMENUACTION_WALK 7
|
ITEMWIN_YESNO_LOW,
|
||||||
#define ITEMMENUACTION_DESELECT 8
|
ITEMWIN_YESNO_HIGH,
|
||||||
#define ITEMMENUACTION_CHECK_TAG 9
|
ITEMWIN_QUANTITY,
|
||||||
#define ITEMMENUACTION_CONFIRM 10
|
ITEMWIN_QUANTITY_WIDE,
|
||||||
#define ITEMMENUACTION_SHOW 11
|
ITEMWIN_MONEY,
|
||||||
#define ITEMMENUACTION_GIVE_2 12
|
ITEMWIN_COUNT
|
||||||
#define ITEMMENUACTION_CONFIRM_2 13
|
};
|
||||||
#define ITEMMENUACTION_DUMMY 14
|
|
||||||
|
|
||||||
// Exported type declarations
|
#define ITEMMENU_SWAP_LINE_LENGTH 8 // Swap line is 8 sprites long
|
||||||
struct BagStruct
|
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 location;
|
||||||
u8 pocket;
|
u8 pocket;
|
||||||
u16 unk6;
|
u16 pocketSwitchArrowPos;
|
||||||
u16 cursorPosition[POCKETS_COUNT];
|
u16 cursorPosition[POCKETS_COUNT];
|
||||||
u16 scrollPosition[POCKETS_COUNT];
|
u16 scrollPosition[POCKETS_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct BagStruct gBagPositionStruct;
|
extern struct BagPosition gBagPosition;
|
||||||
|
|
||||||
struct BagMenuStruct
|
struct BagMenu
|
||||||
{
|
{
|
||||||
void (*exitCallback)(void);
|
void (*newScreenCallback)(void);
|
||||||
u8 tilemapBuffer[0x800];
|
u8 tilemapBuffer[BG_SCREEN_SIZE];
|
||||||
u8 spriteId[12];
|
u8 spriteIds[ITEMMENUSPRITE_COUNT];
|
||||||
u8 windowPointers[10];
|
u8 windowIds[ITEMWIN_COUNT];
|
||||||
u8 itemOriginalLocation;
|
u8 toSwapPos;
|
||||||
u8 pocketSwitchDisabled:4;
|
u8 pocketSwitchDisabled:4;
|
||||||
u8 itemIconSlot:2;
|
u8 itemIconSlot:2;
|
||||||
u8 inhibitItemDescriptionPrint:1;
|
u8 inhibitItemDescriptionPrint:1;
|
||||||
u8 hideCloseBagText:1;
|
u8 hideCloseBagText:1;
|
||||||
u8 filler3[2];
|
u8 unused1[2];
|
||||||
u8 pocketScrollArrowsTask;
|
u8 pocketScrollArrowsTask;
|
||||||
u8 pocketSwitchArrowsTask;
|
u8 pocketSwitchArrowsTask;
|
||||||
const u8* contextMenuItemsPtr;
|
const u8* contextMenuItemsPtr;
|
||||||
u8 contextMenuItemsBuffer[4];
|
u8 contextMenuItemsBuffer[4];
|
||||||
u8 contextMenuNumItems;
|
u8 contextMenuNumItems;
|
||||||
u8 numItemStacks[POCKETS_COUNT];
|
u8 numItemStacks[POCKETS_COUNT];
|
||||||
u8 numShownItems[6];
|
u8 numShownItems[POCKETS_COUNT];
|
||||||
s16 graphicsLoadState;
|
s16 graphicsLoadState;
|
||||||
u8 filler4[0xE];
|
u8 unused2[14];
|
||||||
u8 pocketNameBuffer[32][32];
|
u8 pocketNameBuffer[32][32];
|
||||||
u8 filler2[4];
|
u8 unused3[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct BagMenuStruct *gBagMenu;
|
extern struct BagMenu *gBagMenu;
|
||||||
|
|
||||||
// Exported RAM declarations
|
|
||||||
|
|
||||||
extern u16 gSpecialVar_ItemId;
|
extern u16 gSpecialVar_ItemId;
|
||||||
|
|
||||||
// Exported ROM declarations
|
|
||||||
void CB2_GoToItemDepositMenu(void);
|
void CB2_GoToItemDepositMenu(void);
|
||||||
void FavorLadyOpenBagMenu(void);
|
void FavorLadyOpenBagMenu(void);
|
||||||
void QuizLadyOpenBagMenu(void);
|
void QuizLadyOpenBagMenu(void);
|
||||||
void ApprenticeOpenBagMenu(void);
|
void ApprenticeOpenBagMenu(void);
|
||||||
void CB2_BagMenuFromBattle(void);
|
void CB2_BagMenuFromBattle(void);
|
||||||
void SetInitialScrollAndCursorPositions(u8 pocketId);
|
void UpdatePocketListPosition(u8 pocketId);
|
||||||
void CB2_ReturnToBagMenuPocket(void);
|
void CB2_ReturnToBagMenuPocket(void);
|
||||||
void CB2_BagMenuFromStartMenu(void);
|
void CB2_BagMenuFromStartMenu(void);
|
||||||
u8 GetItemListPosition(u8 pocketId);
|
u8 GetItemListPosition(u8 pocketId);
|
||||||
bool8 UseRegisteredKeyItemOnField(void);
|
bool8 UseRegisteredKeyItemOnField(void);
|
||||||
void CB2_GoToSellMenu(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 DoWallyTutorialBagMenu(void);
|
||||||
void ResetBagScrollPositions(void);
|
void ResetBagScrollPositions(void);
|
||||||
void ChooseBerryForMachine(void (*exitCallback)(void));
|
void ChooseBerryForMachine(void (*exitCallback)(void));
|
||||||
void CB2_ChooseBerry(void);
|
void CB2_ChooseBerry(void);
|
||||||
void Task_FadeAndCloseBagMenu(u8 taskId);
|
void Task_FadeAndCloseBagMenu(u8 taskId);
|
||||||
void BagMenu_YesNo(u8, u8, const struct YesNoFuncTable*);
|
void BagMenu_YesNo(u8 taskId, u8 windowType, const struct YesNoFuncTable* funcTable);
|
||||||
void BagMenu_InitListsMenu(u8 taskId);
|
|
||||||
void UpdatePocketItemList(u8 pocketId);
|
void UpdatePocketItemList(u8 pocketId);
|
||||||
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId));
|
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId));
|
||||||
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
|
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
|
||||||
|
void CloseItemMessage(u8 taskId);
|
||||||
|
|
||||||
|
#endif //GUARD_ITEM_MENU_H
|
||||||
|
|
||||||
#endif //GUARD_item_menu_H
|
|
||||||
|
@ -22,10 +22,4 @@ void FreeBerryTagSpritePalette(void);
|
|||||||
u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine);
|
u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine);
|
||||||
u8 CreateBerryFlavorCircleSprite(s16 x);
|
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
|
#endif // GUARD_ITEM_MENU_ICONS_H
|
||||||
|
@ -28,13 +28,13 @@ void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *templa
|
|||||||
bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1);
|
bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1);
|
||||||
u8 GetLRKeysPressed(void);
|
u8 GetLRKeysPressed(void);
|
||||||
u8 GetLRKeysPressedAndHeld(void);
|
u8 GetLRKeysPressedAndHeld(void);
|
||||||
bool8 sub_8122148(u16 itemId);
|
bool8 IsHoldingItemAllowed(u16 itemId);
|
||||||
bool8 IsWritingMailAllowed(u16 itemId);
|
bool8 IsWritingMailAllowed(u16 itemId);
|
||||||
bool8 MenuHelpers_LinkSomething(void);
|
bool8 MenuHelpers_LinkSomething(void);
|
||||||
bool8 MenuHelpers_CallLinkSomething(void);
|
bool8 MenuHelpers_CallLinkSomething(void);
|
||||||
void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount);
|
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_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 LoadListMenuSwapLineGfx(void);
|
||||||
void CreateSwapLineSprites(u8 *spriteIds, u8 count);
|
void CreateSwapLineSprites(u8 *spriteIds, u8 count);
|
||||||
void DestroySwapLineSprites(u8 *spriteIds, u8 count);
|
void DestroySwapLineSprites(u8 *spriteIds, u8 count);
|
||||||
|
@ -419,8 +419,8 @@ extern const u8 gText_FirmSlash[];
|
|||||||
|
|
||||||
// item menu screen text
|
// item menu screen text
|
||||||
extern const u8 gText_CloseBag[];
|
extern const u8 gText_CloseBag[];
|
||||||
extern const u8 gText_ClearTo11Var1Clear5Var2[];
|
extern const u8 gText_NumberItem_HM[];
|
||||||
extern const u8 gText_NumberVar1Clear7Var2[];
|
extern const u8 gText_NumberItem_TMBerry[];
|
||||||
extern const u8 gText_xVar1[];
|
extern const u8 gText_xVar1[];
|
||||||
extern const u8 gText_ReturnToVar1[];
|
extern const u8 gText_ReturnToVar1[];
|
||||||
extern const u8 gText_SelectorArrow2[];
|
extern const u8 gText_SelectorArrow2[];
|
||||||
@ -442,6 +442,7 @@ extern const u8 gText_CantStoreImportantItems[];
|
|||||||
extern const u8 gText_DepositedVar2Var1s[];
|
extern const u8 gText_DepositedVar2Var1s[];
|
||||||
extern const u8 gText_NoRoomForItems[];
|
extern const u8 gText_NoRoomForItems[];
|
||||||
extern const u8 gText_ThreeDashes[];
|
extern const u8 gText_ThreeDashes[];
|
||||||
|
extern const u8 *const gPocketNamesStringsTable[];
|
||||||
|
|
||||||
// party menu text
|
// party menu text
|
||||||
extern const u8 gText_PkmnHPRestoredByVar2[];
|
extern const u8 gText_PkmnHPRestoredByVar2[];
|
||||||
|
@ -411,20 +411,20 @@ static void Task_ChooseItemsToTossFromPyramidBag(u8 taskId)
|
|||||||
|
|
||||||
void CB2_ReturnToPyramidBagMenu(void)
|
void CB2_ReturnToPyramidBagMenu(void)
|
||||||
{
|
{
|
||||||
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.callback);
|
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.exitCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToBattlePyramidBagMenu(u8 location, void (*callback)(void))
|
void GoToBattlePyramidBagMenu(u8 location, void (*exitCallback)(void))
|
||||||
{
|
{
|
||||||
gPyramidBagMenu = AllocZeroed(sizeof(*gPyramidBagMenu));
|
gPyramidBagMenu = AllocZeroed(sizeof(*gPyramidBagMenu));
|
||||||
|
|
||||||
if (location != PYRAMIDBAG_LOC_PREV)
|
if (location != PYRAMIDBAG_LOC_PREV)
|
||||||
gPyramidBagMenuState.location = location;
|
gPyramidBagMenuState.location = location;
|
||||||
|
|
||||||
if (callback != NULL)
|
if (exitCallback != NULL)
|
||||||
gPyramidBagMenuState.callback = callback;
|
gPyramidBagMenuState.exitCallback = exitCallback;
|
||||||
|
|
||||||
gPyramidBagMenu->exitCallback = NULL;
|
gPyramidBagMenu->newScreenCallback = NULL;
|
||||||
gPyramidBagMenu->toSwapPos = POS_NONE;
|
gPyramidBagMenu->toSwapPos = POS_NONE;
|
||||||
gPyramidBagMenu->scrollIndicatorsTaskId = TASK_NONE;
|
gPyramidBagMenu->scrollIndicatorsTaskId = TASK_NONE;
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ static void CopyBagItemName(u8 *dst, u16 itemId)
|
|||||||
{
|
{
|
||||||
ConvertIntToDecimalStringN(gStringVar1, ITEM_TO_BERRY(itemId), STR_CONV_MODE_LEADING_ZEROS, 2);
|
ConvertIntToDecimalStringN(gStringVar1, ITEM_TO_BERRY(itemId), STR_CONV_MODE_LEADING_ZEROS, 2);
|
||||||
CopyItemName(itemId, gStringVar2);
|
CopyItemName(itemId, gStringVar2);
|
||||||
StringExpandPlaceholders(dst, gText_NumberVar1Clear7Var2);
|
StringExpandPlaceholders(dst, gText_NumberItem_TMBerry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -866,10 +866,13 @@ static void Task_ClosePyramidBag(u8 taskId)
|
|||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
DestroyListMenuTask(tListTaskId, &gPyramidBagMenuState.scrollPosition, &gPyramidBagMenuState.cursorPosition);
|
DestroyListMenuTask(tListTaskId, &gPyramidBagMenuState.scrollPosition, &gPyramidBagMenuState.cursorPosition);
|
||||||
if (gPyramidBagMenu->exitCallback != NULL)
|
|
||||||
SetMainCallback2(gPyramidBagMenu->exitCallback);
|
// If ready for a new screen (e.g. party menu for giving an item) go to that screen
|
||||||
|
// Otherwise exit the bag and use callback set up when the bag was first opened
|
||||||
|
if (gPyramidBagMenu->newScreenCallback != NULL)
|
||||||
|
SetMainCallback2(gPyramidBagMenu->newScreenCallback);
|
||||||
else
|
else
|
||||||
SetMainCallback2(gPyramidBagMenuState.callback);
|
SetMainCallback2(gPyramidBagMenuState.exitCallback);
|
||||||
RemoveScrollArrow();
|
RemoveScrollArrow();
|
||||||
ResetSpriteData();
|
ResetSpriteData();
|
||||||
FreeAllSpritePalettes();
|
FreeAllSpritePalettes();
|
||||||
@ -1249,7 +1252,7 @@ static void BagAction_Give(u8 taskId)
|
|||||||
}
|
}
|
||||||
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
|
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
|
||||||
{
|
{
|
||||||
gPyramidBagMenu->exitCallback = CB2_ChooseMonToGiveItem;
|
gPyramidBagMenu->newScreenCallback = CB2_ChooseMonToGiveItem;
|
||||||
CloseBattlePyramidBag(taskId);
|
CloseBattlePyramidBag(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -548,9 +548,9 @@ static void Task_HandleInput(u8 taskId)
|
|||||||
static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
|
static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
|
||||||
{
|
{
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
s16 currPocketPosition = gBagPositionStruct.scrollPosition[3] + gBagPositionStruct.cursorPosition[3];
|
s16 currPocketPosition = gBagPosition.scrollPosition[BERRIES_POCKET] + gBagPosition.cursorPosition[BERRIES_POCKET];
|
||||||
u32 newPocketPosition = currPocketPosition + toMove;
|
u32 newPocketPosition = currPocketPosition + toMove;
|
||||||
if (newPocketPosition < 46 && BagGetItemIdByPocketPosition(POCKET_BERRIES, newPocketPosition) != 0)
|
if (newPocketPosition < ITEM_TO_BERRY(MAX_BERRY_INDEX) && BagGetItemIdByPocketPosition(POCKET_BERRIES, newPocketPosition) != ITEM_NONE)
|
||||||
{
|
{
|
||||||
if (toMove < 0)
|
if (toMove < 0)
|
||||||
data[1] = 2;
|
data[1] = 2;
|
||||||
@ -566,8 +566,8 @@ static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
|
|||||||
|
|
||||||
static void HandleBagCursorPositionChange(s8 toMove)
|
static void HandleBagCursorPositionChange(s8 toMove)
|
||||||
{
|
{
|
||||||
u16 *scrollPos = &gBagPositionStruct.scrollPosition[3];
|
u16 *scrollPos = &gBagPosition.scrollPosition[BERRIES_POCKET];
|
||||||
u16 *cursorPos = &gBagPositionStruct.cursorPosition[3];
|
u16 *cursorPos = &gBagPosition.cursorPosition[BERRIES_POCKET];
|
||||||
if (toMove > 0)
|
if (toMove > 0)
|
||||||
{
|
{
|
||||||
if (*cursorPos < 4 || BagGetItemIdByPocketPosition(POCKET_BERRIES, *scrollPos + 8) == 0)
|
if (*cursorPos < 4 || BagGetItemIdByPocketPosition(POCKET_BERRIES, *scrollPos + 8) == 0)
|
||||||
|
@ -192,10 +192,9 @@ const u32 *const gItemIconTable[][2] =
|
|||||||
[ITEM_LANSAT_BERRY] = {gItemIcon_LansatBerry, gItemIconPalette_LansatBerry},
|
[ITEM_LANSAT_BERRY] = {gItemIcon_LansatBerry, gItemIconPalette_LansatBerry},
|
||||||
[ITEM_STARF_BERRY] = {gItemIcon_StarfBerry, gItemIconPalette_StarfBerry},
|
[ITEM_STARF_BERRY] = {gItemIcon_StarfBerry, gItemIconPalette_StarfBerry},
|
||||||
[ITEM_ENIGMA_BERRY] = {gItemIcon_EnigmaBerry, gItemIconPalette_EnigmaBerry},
|
[ITEM_ENIGMA_BERRY] = {gItemIcon_EnigmaBerry, gItemIconPalette_EnigmaBerry},
|
||||||
// ????????
|
[ITEM_UNUSED_BERRY_1] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
|
||||||
[ITEM_0B0] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
|
[ITEM_UNUSED_BERRY_2] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
|
||||||
[ITEM_0B1] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
|
[ITEM_UNUSED_BERRY_3] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
|
||||||
[ITEM_0B2] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
|
|
||||||
// Hold items
|
// Hold items
|
||||||
[ITEM_BRIGHT_POWDER] = {gItemIcon_BrightPowder, gItemIconPalette_BrightPowder},
|
[ITEM_BRIGHT_POWDER] = {gItemIcon_BrightPowder, gItemIconPalette_BrightPowder},
|
||||||
[ITEM_WHITE_HERB] = {gItemIcon_InBattleHerb, gItemIconPalette_WhiteHerb},
|
[ITEM_WHITE_HERB] = {gItemIcon_InBattleHerb, gItemIconPalette_WhiteHerb},
|
||||||
|
@ -2148,7 +2148,7 @@ const struct Item gItems[] =
|
|||||||
.battleUseFunc = ItemUseInBattle_EnigmaBerry,
|
.battleUseFunc = ItemUseInBattle_EnigmaBerry,
|
||||||
},
|
},
|
||||||
|
|
||||||
[ITEM_0B0] =
|
[ITEM_UNUSED_BERRY_1] =
|
||||||
{
|
{
|
||||||
.name = _("????????"),
|
.name = _("????????"),
|
||||||
.itemId = ITEM_NONE,
|
.itemId = ITEM_NONE,
|
||||||
@ -2159,7 +2159,7 @@ const struct Item gItems[] =
|
|||||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||||
},
|
},
|
||||||
|
|
||||||
[ITEM_0B1] =
|
[ITEM_UNUSED_BERRY_2] =
|
||||||
{
|
{
|
||||||
.name = _("????????"),
|
.name = _("????????"),
|
||||||
.itemId = ITEM_NONE,
|
.itemId = ITEM_NONE,
|
||||||
@ -2170,7 +2170,7 @@ const struct Item gItems[] =
|
|||||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||||
},
|
},
|
||||||
|
|
||||||
[ITEM_0B2] =
|
[ITEM_UNUSED_BERRY_3] =
|
||||||
{
|
{
|
||||||
.name = _("????????"),
|
.name = _("????????"),
|
||||||
.itemId = ITEM_NONE,
|
.itemId = ITEM_NONE,
|
||||||
|
@ -559,7 +559,7 @@ const u8 *const gBerryTreeObjectEventGraphicsIdTablePointers[] = {
|
|||||||
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
||||||
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
||||||
// 3 unused berries.
|
// 3 unused berries.
|
||||||
[ITEM_0B0 - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
[ITEM_UNUSED_BERRY_1 - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
||||||
[ITEM_0B1 - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
[ITEM_UNUSED_BERRY_2 - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
||||||
[ITEM_0B2 - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
[ITEM_UNUSED_BERRY_3 - FIRST_BERRY_INDEX] = gBerryTreeObjectEventGraphicsIdTable,
|
||||||
};
|
};
|
||||||
|
@ -867,7 +867,7 @@ static void InitDecorationItemsMenuScrollAndCursor(void)
|
|||||||
|
|
||||||
static void InitDecorationItemsMenuScrollAndCursor2(void)
|
static void InitDecorationItemsMenuScrollAndCursor2(void)
|
||||||
{
|
{
|
||||||
sub_8122298(&sDecorationsScrollOffset, &sDecorationsCursorPos, sDecorationItemsMenu->maxShownItems, sDecorationItemsMenu->numMenuItems, 8);
|
SetCursorScrollWithinListBounds(&sDecorationsScrollOffset, &sDecorationsCursorPos, sDecorationItemsMenu->maxShownItems, sDecorationItemsMenu->numMenuItems, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintDecorationItemMenuItems(u8 taskId)
|
static void PrintDecorationItemMenuItems(u8 taskId)
|
||||||
|
1961
src/item_menu.c
1961
src/item_menu.c
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,15 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TAG_BAG_GFX = 100,
|
||||||
|
TAG_ROTATING_BALL_GFX,
|
||||||
|
TAG_ITEM_ICON,
|
||||||
|
TAG_ITEM_ICON_ALT,
|
||||||
|
};
|
||||||
|
#define TAG_BERRY_CHECK_CIRCLE_GFX 10000
|
||||||
|
#define TAG_BERRY_PIC_PAL 30020
|
||||||
|
|
||||||
struct CompressedTilesPal
|
struct CompressedTilesPal
|
||||||
{
|
{
|
||||||
const u32 *tiles;
|
const u32 *tiles;
|
||||||
@ -128,7 +137,7 @@ const struct CompressedSpritePalette gBagPaletteTable =
|
|||||||
gBagPalette, TAG_BAG_GFX
|
gBagPalette, TAG_BAG_GFX
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteTemplate gBagSpriteTemplate =
|
static const struct SpriteTemplate sBagSpriteTemplate =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_BAG_GFX,
|
.tileTag = TAG_BAG_GFX,
|
||||||
.paletteTag = TAG_BAG_GFX,
|
.paletteTag = TAG_BAG_GFX,
|
||||||
@ -189,17 +198,17 @@ static const union AffineAnimCmd *const sRotatingBallAnimCmds_FullRotation[] =
|
|||||||
sSpriteAffineAnim_RotatingBallRotation2,
|
sSpriteAffineAnim_RotatingBallRotation2,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteSheet gRotatingBallTable =
|
static const struct SpriteSheet sRotatingBallTable =
|
||||||
{
|
{
|
||||||
gRotatingBall, 0x80, TAG_ROTATING_BALL_GFX
|
gRotatingBall, 0x80, TAG_ROTATING_BALL_GFX
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpritePalette gRotatingBallPaletteTable =
|
static const struct SpritePalette sRotatingBallPaletteTable =
|
||||||
{
|
{
|
||||||
gRotatingBall_Pal, TAG_ROTATING_BALL_GFX
|
gRotatingBall_Pal, TAG_ROTATING_BALL_GFX
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteTemplate gRotatingBallSpriteTemplate =
|
static const struct SpriteTemplate sRotatingBallSpriteTemplate =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_ROTATING_BALL_GFX,
|
.tileTag = TAG_ROTATING_BALL_GFX,
|
||||||
.paletteTag = TAG_ROTATING_BALL_GFX,
|
.paletteTag = TAG_ROTATING_BALL_GFX,
|
||||||
@ -262,7 +271,7 @@ static const struct SpriteFrameImage sBerryPicSpriteImageTable[] =
|
|||||||
|
|
||||||
static const struct SpriteTemplate gBerryPicSpriteTemplate =
|
static const struct SpriteTemplate gBerryPicSpriteTemplate =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_BERRY_PIC_TILE,
|
.tileTag = 0xFFFF,
|
||||||
.paletteTag = TAG_BERRY_PIC_PAL,
|
.paletteTag = TAG_BERRY_PIC_PAL,
|
||||||
.oam = &sBerryPicOamData,
|
.oam = &sBerryPicOamData,
|
||||||
.anims = sBerryPicSpriteAnimTable,
|
.anims = sBerryPicSpriteAnimTable,
|
||||||
@ -301,7 +310,7 @@ static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] =
|
|||||||
|
|
||||||
static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate =
|
static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_BERRY_PIC_TILE,
|
.tileTag = 0xFFFF,
|
||||||
.paletteTag = TAG_BERRY_PIC_PAL,
|
.paletteTag = TAG_BERRY_PIC_PAL,
|
||||||
.oam = &sBerryPicRotatingOamData,
|
.oam = &sBerryPicRotatingOamData,
|
||||||
.anims = sBerryPicSpriteAnimTable,
|
.anims = sBerryPicSpriteAnimTable,
|
||||||
@ -409,11 +418,11 @@ static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate =
|
|||||||
// code
|
// code
|
||||||
void RemoveBagSprite(u8 id)
|
void RemoveBagSprite(u8 id)
|
||||||
{
|
{
|
||||||
u8 *spriteId = &gBagMenu->spriteId[id];
|
u8 *spriteId = &gBagMenu->spriteIds[id];
|
||||||
if (*spriteId != SPRITE_NONE)
|
if (*spriteId != SPRITE_NONE)
|
||||||
{
|
{
|
||||||
FreeSpriteTilesByTag(id + 100);
|
FreeSpriteTilesByTag(id + TAG_BAG_GFX);
|
||||||
FreeSpritePaletteByTag(id + 100);
|
FreeSpritePaletteByTag(id + TAG_BAG_GFX);
|
||||||
FreeSpriteOamMatrix(&gSprites[*spriteId]);
|
FreeSpriteOamMatrix(&gSprites[*spriteId]);
|
||||||
DestroySprite(&gSprites[*spriteId]);
|
DestroySprite(&gSprites[*spriteId]);
|
||||||
*spriteId = SPRITE_NONE;
|
*spriteId = SPRITE_NONE;
|
||||||
@ -422,14 +431,14 @@ void RemoveBagSprite(u8 id)
|
|||||||
|
|
||||||
void AddBagVisualSprite(u8 bagPocketId)
|
void AddBagVisualSprite(u8 bagPocketId)
|
||||||
{
|
{
|
||||||
u8 *spriteId = &gBagMenu->spriteId[0];
|
u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_BAG];
|
||||||
*spriteId = CreateSprite(&gBagSpriteTemplate, 68, 66, 0);
|
*spriteId = CreateSprite(&sBagSpriteTemplate, 68, 66, 0);
|
||||||
SetBagVisualPocketId(bagPocketId, FALSE);
|
SetBagVisualPocketId(bagPocketId, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
|
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
|
||||||
{
|
{
|
||||||
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
|
struct Sprite *sprite = &gSprites[gBagMenu->spriteIds[ITEMMENUSPRITE_BAG]];
|
||||||
if (isSwitchingPockets)
|
if (isSwitchingPockets)
|
||||||
{
|
{
|
||||||
sprite->y2 = -5;
|
sprite->y2 = -5;
|
||||||
@ -458,7 +467,7 @@ static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
|
|||||||
|
|
||||||
void ShakeBagSprite(void)
|
void ShakeBagSprite(void)
|
||||||
{
|
{
|
||||||
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
|
struct Sprite *sprite = &gSprites[gBagMenu->spriteIds[ITEMMENUSPRITE_BAG]];
|
||||||
if (sprite->affineAnimEnded)
|
if (sprite->affineAnimEnded)
|
||||||
{
|
{
|
||||||
StartSpriteAffineAnim(sprite, 1);
|
StartSpriteAffineAnim(sprite, 1);
|
||||||
@ -477,10 +486,10 @@ static void SpriteCB_ShakeBagSprite(struct Sprite *sprite)
|
|||||||
|
|
||||||
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
|
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
|
||||||
{
|
{
|
||||||
u8 *spriteId = &gBagMenu->spriteId[1];
|
u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_BALL];
|
||||||
LoadSpriteSheet(&gRotatingBallTable);
|
LoadSpriteSheet(&sRotatingBallTable);
|
||||||
LoadSpritePalette(&gRotatingBallPaletteTable);
|
LoadSpritePalette(&sRotatingBallPaletteTable);
|
||||||
*spriteId = CreateSprite(&gRotatingBallSpriteTemplate, 16, 16, 0);
|
*spriteId = CreateSprite(&sRotatingBallSpriteTemplate, 16, 16, 0);
|
||||||
gSprites[*spriteId].data[0] = rotationDirection;
|
gSprites[*spriteId].data[0] = rotationDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,19 +519,20 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
|
|||||||
sprite->data[3]++;
|
sprite->data[3]++;
|
||||||
UpdateSwitchPocketRotatingBallCoords(sprite);
|
UpdateSwitchPocketRotatingBallCoords(sprite);
|
||||||
if (sprite->data[3] == 16)
|
if (sprite->data[3] == 16)
|
||||||
RemoveBagSprite(1);
|
RemoveBagSprite(ITEMMENUSPRITE_BALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBagItemIconSprite(u16 itemId, u8 id)
|
void AddBagItemIconSprite(u16 itemId, u8 id)
|
||||||
{
|
{
|
||||||
u8 *spriteId = &gBagMenu->spriteId[id + 2];
|
u8 *spriteId = &gBagMenu->spriteIds[id + ITEMMENUSPRITE_ITEM];
|
||||||
if (*spriteId == SPRITE_NONE)
|
if (*spriteId == SPRITE_NONE)
|
||||||
{
|
{
|
||||||
u8 iconSpriteId;
|
u8 iconSpriteId;
|
||||||
|
|
||||||
FreeSpriteTilesByTag(id + 102);
|
// Either TAG_ITEM_ICON or TAG_ITEM_ICON_ALT
|
||||||
FreeSpritePaletteByTag(id + 102);
|
FreeSpriteTilesByTag(id + TAG_ITEM_ICON);
|
||||||
iconSpriteId = AddItemIconSprite(id + 102, id + 102, itemId);
|
FreeSpritePaletteByTag(id + TAG_ITEM_ICON);
|
||||||
|
iconSpriteId = AddItemIconSprite(id + TAG_ITEM_ICON, id + TAG_ITEM_ICON, itemId);
|
||||||
if (iconSpriteId != MAX_SPRITES)
|
if (iconSpriteId != MAX_SPRITES)
|
||||||
{
|
{
|
||||||
*spriteId = iconSpriteId;
|
*spriteId = iconSpriteId;
|
||||||
@ -534,22 +544,22 @@ void AddBagItemIconSprite(u16 itemId, u8 id)
|
|||||||
|
|
||||||
void RemoveBagItemIconSprite(u8 id)
|
void RemoveBagItemIconSprite(u8 id)
|
||||||
{
|
{
|
||||||
RemoveBagSprite(id + 2);
|
RemoveBagSprite(id + ITEMMENUSPRITE_ITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateItemMenuSwapLine(void)
|
void CreateItemMenuSwapLine(void)
|
||||||
{
|
{
|
||||||
CreateSwapLineSprites(&gBagMenu->spriteId[4], 8);
|
CreateSwapLineSprites(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetItemMenuSwapLineInvisibility(bool8 invisible)
|
void SetItemMenuSwapLineInvisibility(bool8 invisible)
|
||||||
{
|
{
|
||||||
SetSwapLineSpritesInvisibility(&gBagMenu->spriteId[4], 8, invisible);
|
SetSwapLineSpritesInvisibility(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH, invisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateItemMenuSwapLinePos(u8 y)
|
void UpdateItemMenuSwapLinePos(u8 y)
|
||||||
{
|
{
|
||||||
UpdateSwapLineSpritesPos(&gBagMenu->spriteId[4], 136, 120, (y + 1) * 16);
|
UpdateSwapLineSpritesPos(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH | 0x80, 120, (y + 1) * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80D5018(void *mem0, void *mem1)
|
static void sub_80D5018(void *mem0, void *mem1)
|
||||||
|
@ -91,7 +91,7 @@ static const u8 sClockwiseDirections[] = {DIR_NORTH, DIR_EAST, DIR_SOUTH, DIR_WE
|
|||||||
static const struct YesNoFuncTable sUseTMHMYesNoFuncTable =
|
static const struct YesNoFuncTable sUseTMHMYesNoFuncTable =
|
||||||
{
|
{
|
||||||
.yesFunc = UseTMHM,
|
.yesFunc = UseTMHM,
|
||||||
.noFunc = BagMenu_InitListsMenu,
|
.noFunc = CloseItemMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define tEnigmaBerryType data[4]
|
#define tEnigmaBerryType data[4]
|
||||||
@ -104,12 +104,12 @@ static void SetUpItemUseCallback(u8 taskId)
|
|||||||
type = ItemId_GetType(gSpecialVar_ItemId) - 1;
|
type = ItemId_GetType(gSpecialVar_ItemId) - 1;
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
{
|
{
|
||||||
gBagMenu->exitCallback = sItemUseCallbacks[type];
|
gBagMenu->newScreenCallback = sItemUseCallbacks[type];
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gPyramidBagMenu->exitCallback = sItemUseCallbacks[type];
|
gPyramidBagMenu->newScreenCallback = sItemUseCallbacks[type];
|
||||||
CloseBattlePyramidBag(taskId);
|
CloseBattlePyramidBag(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ static void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyIte
|
|||||||
if (!isUsingRegisteredKeyItemOnField)
|
if (!isUsingRegisteredKeyItemOnField)
|
||||||
{
|
{
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, 1, gStringVar4, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage);
|
||||||
else
|
else
|
||||||
DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage);
|
DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage);
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ static void CB2_CheckMail(void)
|
|||||||
|
|
||||||
void ItemUseOutOfBattle_Mail(u8 taskId)
|
void ItemUseOutOfBattle_Mail(u8 taskId)
|
||||||
{
|
{
|
||||||
gBagMenu->exitCallback = CB2_CheckMail;
|
gBagMenu->newScreenCallback = CB2_CheckMail;
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ void ItemUseOutOfBattle_PokeblockCase(u8 taskId)
|
|||||||
}
|
}
|
||||||
else if (gTasks[taskId].tUsingRegisteredKeyItem != TRUE)
|
else if (gTasks[taskId].tUsingRegisteredKeyItem != TRUE)
|
||||||
{
|
{
|
||||||
gBagMenu->exitCallback = CB2_OpenPokeblockFromBag;
|
gBagMenu->newScreenCallback = CB2_OpenPokeblockFromBag;
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -647,7 +647,7 @@ void ItemUseOutOfBattle_CoinCase(u8 taskId)
|
|||||||
|
|
||||||
if (!gTasks[taskId].tUsingRegisteredKeyItem)
|
if (!gTasks[taskId].tUsingRegisteredKeyItem)
|
||||||
{
|
{
|
||||||
DisplayItemMessage(taskId, 1, gStringVar4, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -662,7 +662,7 @@ void ItemUseOutOfBattle_PowderJar(u8 taskId)
|
|||||||
|
|
||||||
if (!gTasks[taskId].tUsingRegisteredKeyItem)
|
if (!gTasks[taskId].tUsingRegisteredKeyItem)
|
||||||
{
|
{
|
||||||
DisplayItemMessage(taskId, 1, gStringVar4, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -676,7 +676,7 @@ void ItemUseOutOfBattle_Berry(u8 taskId)
|
|||||||
{
|
{
|
||||||
sItemUseOnFieldCB = ItemUseOnFieldCB_Berry;
|
sItemUseOnFieldCB = ItemUseOnFieldCB_Berry;
|
||||||
gFieldCallback = FieldCB_UseItemOnField;
|
gFieldCallback = FieldCB_UseItemOnField;
|
||||||
gBagMenu->exitCallback = CB2_ReturnToField;
|
gBagMenu->newScreenCallback = CB2_ReturnToField;
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -801,7 +801,7 @@ static void Task_ShowTMHMContainedMessage(u8 taskId)
|
|||||||
|
|
||||||
static void UseTMHMYesNo(u8 taskId)
|
static void UseTMHMYesNo(u8 taskId)
|
||||||
{
|
{
|
||||||
BagMenu_YesNo(taskId, 6, &sUseTMHMYesNoFuncTable);
|
BagMenu_YesNo(taskId, ITEMWIN_YESNO_HIGH, &sUseTMHMYesNoFuncTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UseTMHM(u8 taskId)
|
static void UseTMHM(u8 taskId)
|
||||||
@ -818,7 +818,7 @@ static void RemoveUsedItem(void)
|
|||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
{
|
{
|
||||||
UpdatePocketItemList(ItemId_GetPocket(gSpecialVar_ItemId));
|
UpdatePocketItemList(ItemId_GetPocket(gSpecialVar_ItemId));
|
||||||
SetInitialScrollAndCursorPositions(ItemId_GetPocket(gSpecialVar_ItemId));
|
UpdatePocketListPosition(ItemId_GetPocket(gSpecialVar_ItemId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -832,7 +832,7 @@ void ItemUseOutOfBattle_Repel(u8 taskId)
|
|||||||
if (VarGet(VAR_REPEL_STEP_COUNT) == 0)
|
if (VarGet(VAR_REPEL_STEP_COUNT) == 0)
|
||||||
gTasks[taskId].func = Task_StartUseRepel;
|
gTasks[taskId].func = Task_StartUseRepel;
|
||||||
else if (!InBattlePyramid())
|
else if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, 1, gText_RepelEffectsLingered, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gText_RepelEffectsLingered, CloseItemMessage);
|
||||||
else
|
else
|
||||||
DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, Task_CloseBattlePyramidBagMessage);
|
DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, Task_CloseBattlePyramidBagMessage);
|
||||||
}
|
}
|
||||||
@ -856,7 +856,7 @@ static void Task_UseRepel(u8 taskId)
|
|||||||
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
|
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
|
||||||
RemoveUsedItem();
|
RemoveUsedItem();
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, 1, gStringVar4, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage);
|
||||||
else
|
else
|
||||||
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
|
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
|
||||||
}
|
}
|
||||||
@ -868,7 +868,7 @@ static void Task_UsedBlackWhiteFlute(u8 taskId)
|
|||||||
{
|
{
|
||||||
PlaySE(SE_GLASS_FLUTE);
|
PlaySE(SE_GLASS_FLUTE);
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, 1, gStringVar4, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage);
|
||||||
else
|
else
|
||||||
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
|
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
|
||||||
}
|
}
|
||||||
@ -947,7 +947,7 @@ void ItemUseInBattle_PokeBall(u8 taskId)
|
|||||||
}
|
}
|
||||||
else if (!InBattlePyramid())
|
else if (!InBattlePyramid())
|
||||||
{
|
{
|
||||||
DisplayItemMessage(taskId, 1, gText_BoxFull, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gText_BoxFull, CloseItemMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
|
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
|
||||||
@ -985,7 +985,7 @@ void ItemUseInBattle_StatIncrease(u8 taskId)
|
|||||||
if (ExecuteTableBasedItemEffect(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE)
|
if (ExecuteTableBasedItemEffect(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE)
|
||||||
{
|
{
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, 1, gText_WontHaveEffect, BagMenu_InitListsMenu);
|
DisplayItemMessage(taskId, 1, gText_WontHaveEffect, CloseItemMessage);
|
||||||
else
|
else
|
||||||
DisplayItemMessageInBattlePyramid(taskId, gText_WontHaveEffect, Task_CloseBattlePyramidBagMessage);
|
DisplayItemMessageInBattlePyramid(taskId, gText_WontHaveEffect, Task_CloseBattlePyramidBagMessage);
|
||||||
}
|
}
|
||||||
@ -1000,12 +1000,12 @@ static void ItemUseInBattle_ShowPartyMenu(u8 taskId)
|
|||||||
{
|
{
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
{
|
{
|
||||||
gBagMenu->exitCallback = ChooseMonForInBattleItem;
|
gBagMenu->newScreenCallback = ChooseMonForInBattleItem;
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gPyramidBagMenu->exitCallback = ChooseMonForInBattleItem;
|
gPyramidBagMenu->newScreenCallback = ChooseMonForInBattleItem;
|
||||||
CloseBattlePyramidBag(taskId);
|
CloseBattlePyramidBag(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
src/menu.c
52
src/menu.c
@ -1097,32 +1097,32 @@ s8 Menu_ProcessInputNoWrapAround_other(void)
|
|||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs)
|
void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
for (i = 0; i < itemCount; i++)
|
for (i = 0; i < itemCount; i++)
|
||||||
{
|
{
|
||||||
AddTextPrinterParameterized(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL);
|
AddTextPrinterParameterized(windowId, fontId, menuActions[i].text, left, (lineHeight * i) + top, 0xFF, NULL);
|
||||||
}
|
}
|
||||||
CopyWindowToVram(windowId, 2);
|
CopyWindowToVram(windowId, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81987BC(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, u8 a6, u8 a7)
|
void sub_81987BC(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, u8 a6, u8 a7)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
for (i = 0; i < itemCount; i++)
|
for (i = 0; i < itemCount; i++)
|
||||||
{
|
{
|
||||||
AddTextPrinterParameterized5(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL, a6, a7);
|
AddTextPrinterParameterized5(windowId, fontId, menuActions[i].text, left, (lineHeight * i) + top, 0xFF, NULL, a6, a7);
|
||||||
}
|
}
|
||||||
CopyWindowToVram(windowId, 2);
|
CopyWindowToVram(windowId, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8198854(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs)
|
void sub_8198854(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions)
|
||||||
{
|
{
|
||||||
PrintTextArray(windowId, fontId, GetFontAttribute(fontId, 0), 1, lineHeight, itemCount, strs);
|
PrintTextArray(windowId, fontId, GetFontAttribute(fontId, 0), 1, lineHeight, itemCount, menuActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
|
void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
struct TextPrinterTemplate printer;
|
struct TextPrinterTemplate printer;
|
||||||
@ -1140,7 +1140,7 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
|
|||||||
|
|
||||||
for (i = 0; i < itemCount; i++)
|
for (i = 0; i < itemCount; i++)
|
||||||
{
|
{
|
||||||
printer.currentChar = strs[a8[i]].text;
|
printer.currentChar = menuActions[actionIds[i]].text;
|
||||||
printer.y = (lineHeight * i) + top;
|
printer.y = (lineHeight * i) + top;
|
||||||
printer.currentY = printer.y;
|
printer.currentY = printer.y;
|
||||||
AddTextPrinter(&printer, 0xFF, NULL);
|
AddTextPrinter(&printer, 0xFF, NULL);
|
||||||
@ -1149,9 +1149,9 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
|
|||||||
CopyWindowToVram(windowId, 2);
|
CopyWindowToVram(windowId, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81989B8(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a5)
|
void sub_81989B8(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds)
|
||||||
{
|
{
|
||||||
AddItemMenuActionTextPrinters(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 1, GetFontAttribute(fontId, FONTATTR_LETTER_SPACING), lineHeight, itemCount, strs, a5);
|
AddItemMenuActionTextPrinters(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 1, GetFontAttribute(fontId, FONTATTR_LETTER_SPACING), lineHeight, itemCount, menuActions, actionIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
||||||
@ -1224,7 +1224,7 @@ void sub_8198C78(void)
|
|||||||
RemoveWindow(sYesNoWindowId);
|
RemoveWindow(sYesNoWindowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7, const struct MenuAction *strs)
|
void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7, const struct MenuAction *menuActions)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 j;
|
u8 j;
|
||||||
@ -1232,18 +1232,18 @@ void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u
|
|||||||
{
|
{
|
||||||
for (j = 0; j < a6; j++)
|
for (j = 0; j < a6; j++)
|
||||||
{
|
{
|
||||||
AddTextPrinterParameterized(windowId, fontId, strs[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, 0xFF, NULL);
|
AddTextPrinterParameterized(windowId, fontId, menuActions[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, 0xFF, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CopyWindowToVram(windowId, 2);
|
CopyWindowToVram(windowId, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8198D54(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struct MenuAction *strs)
|
void sub_8198D54(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struct MenuAction *menuActions)
|
||||||
{
|
{
|
||||||
sub_8198C94(windowId, fontId, GetFontAttribute(fontId, 0), 0, a2, a3, a4, a5, strs);
|
sub_8198C94(windowId, fontId, GetFontAttribute(fontId, 0), 0, a2, a3, a4, a5, menuActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs, const u8 *strIds)
|
void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 j;
|
u8 j;
|
||||||
@ -1262,7 +1262,7 @@ void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth
|
|||||||
{
|
{
|
||||||
for (j = 0; j < horizontalCount; j++)
|
for (j = 0; j < horizontalCount; j++)
|
||||||
{
|
{
|
||||||
printer.currentChar = strs[strIds[(horizontalCount * i) + j]].text;
|
printer.currentChar = menuActions[actionIds[(horizontalCount * i) + j]].text;
|
||||||
printer.x = (optionWidth * j) + left;
|
printer.x = (optionWidth * j) + left;
|
||||||
printer.y = (GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT) * i) + top;
|
printer.y = (GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT) * i) + top;
|
||||||
printer.currentX = printer.x;
|
printer.currentX = printer.x;
|
||||||
@ -1275,9 +1275,9 @@ void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
static void PrintMenuActionGrid_TopLeft(u8 windowId, u8 fontId, u8 optionWidth, u8 unused, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs, const u8 *strIds)
|
static void PrintMenuActionGrid_TopLeft(u8 windowId, u8 fontId, u8 optionWidth, u8 unused, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds)
|
||||||
{
|
{
|
||||||
PrintMenuActionGrid(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, optionWidth, horizontalCount, verticalCount, strs, strIds);
|
PrintMenuActionGrid(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, optionWidth, horizontalCount, verticalCount, menuActions, actionIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight, u8 a6, u8 a7, u8 numChoices, u8 a9)
|
u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight, u8 a6, u8 a7, u8 numChoices, u8 a9)
|
||||||
@ -1597,19 +1597,19 @@ u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 itemCount, u8
|
|||||||
return InitMenuInUpperLeftCorner(windowId, itemCount, initialCursorPos, FALSE);
|
return InitMenuInUpperLeftCorner(windowId, itemCount, initialCursorPos, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs)
|
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *menuActions)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0; i < itemCount; i++)
|
for (i = 0; i < itemCount; i++)
|
||||||
{
|
{
|
||||||
AddTextPrinterParameterized(windowId, 1, strs[i].text, 8, (i * 16) + 1, 0xFF, NULL);
|
AddTextPrinterParameterized(windowId, 1, menuActions[i].text, 8, (i * 16) + 1, 0xFF, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyWindowToVram(windowId, 2);
|
CopyWindowToVram(windowId, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
|
void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
struct TextPrinterTemplate printer;
|
struct TextPrinterTemplate printer;
|
||||||
@ -1627,7 +1627,7 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
|
|||||||
|
|
||||||
for (i = 0; i < itemCount; i++)
|
for (i = 0; i < itemCount; i++)
|
||||||
{
|
{
|
||||||
printer.currentChar = strs[a8[i]].text;
|
printer.currentChar = menuActions[actionIds[i]].text;
|
||||||
printer.y = (i * 16) + 1;
|
printer.y = (i * 16) + 1;
|
||||||
printer.currentY = (i * 16) + 1;
|
printer.currentY = (i * 16) + 1;
|
||||||
AddTextPrinter(&printer, 0xFF, NULL);
|
AddTextPrinter(&printer, 0xFF, NULL);
|
||||||
@ -1661,19 +1661,19 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
|
|||||||
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos);
|
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs)
|
void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *menuActions)
|
||||||
{
|
{
|
||||||
u32 i, j;
|
u32 i, j;
|
||||||
|
|
||||||
for (i = 0; i < rows; i++)
|
for (i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < columns; j++)
|
for (j = 0; j < columns; j++)
|
||||||
AddTextPrinterParameterized(windowId, 1, strs[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL);
|
AddTextPrinterParameterized(windowId, 1, menuActions[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL);
|
||||||
}
|
}
|
||||||
CopyWindowToVram(windowId, 2);
|
CopyWindowToVram(windowId, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8)
|
void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *menuActions, const u8 *actionIds)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 j;
|
u8 j;
|
||||||
@ -1692,7 +1692,7 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
|
|||||||
{
|
{
|
||||||
for (j = 0; j < itemCount; j++)
|
for (j = 0; j < itemCount; j++)
|
||||||
{
|
{
|
||||||
printer.currentChar = strs[a8[(itemCount * i) + j]].text;
|
printer.currentChar = menuActions[actionIds[(itemCount * i) + j]].text;
|
||||||
printer.x = (a4 * j) + 8;
|
printer.x = (a4 * j) + 8;
|
||||||
printer.y = (16 * i) + 1;
|
printer.y = (16 * i) + 1;
|
||||||
printer.currentX = printer.x;
|
printer.currentX = printer.x;
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
static void Task_ContinueTaskAfterMessagePrints(u8 taskId);
|
static void Task_ContinueTaskAfterMessagePrints(u8 taskId);
|
||||||
static void Task_CallYesOrNoCallback(u8 taskId);
|
static void Task_CallYesOrNoCallback(u8 taskId);
|
||||||
|
|
||||||
EWRAM_DATA static struct YesNoFuncTable gUnknown_0203A138 = {0};
|
EWRAM_DATA static struct YesNoFuncTable sYesNo = {0};
|
||||||
EWRAM_DATA static u8 gUnknown_0203A140 = 0;
|
EWRAM_DATA static u8 sMessageWindowId = 0;
|
||||||
|
|
||||||
static TaskFunc gUnknown_0300117C;
|
static TaskFunc sMessageNextTask;
|
||||||
|
|
||||||
static const struct OamData sOamData_SwapLine =
|
static const struct OamData sOamData_SwapLine =
|
||||||
{
|
{
|
||||||
@ -122,17 +122,17 @@ void SetVBlankHBlankCallbacksToNull(void)
|
|||||||
SetHBlankCallback(NULL);
|
SetHBlankCallback(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc)
|
void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 tileNum, u8 paletteNum, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc)
|
||||||
{
|
{
|
||||||
gUnknown_0203A140 = windowId;
|
sMessageWindowId = windowId;
|
||||||
DrawDialogFrameWithCustomTileAndPalette(windowId, TRUE, arg2, arg3);
|
DrawDialogFrameWithCustomTileAndPalette(windowId, TRUE, tileNum, paletteNum);
|
||||||
|
|
||||||
if (string != gStringVar4)
|
if (string != gStringVar4)
|
||||||
StringExpandPlaceholders(gStringVar4, string);
|
StringExpandPlaceholders(gStringVar4, string);
|
||||||
|
|
||||||
gTextFlags.canABSpeedUpPrint = 1;
|
gTextFlags.canABSpeedUpPrint = 1;
|
||||||
AddTextPrinterParameterized2(windowId, fontId, gStringVar4, textSpeed, NULL, 2, 1, 3);
|
AddTextPrinterParameterized2(windowId, fontId, gStringVar4, textSpeed, NULL, 2, 1, 3);
|
||||||
gUnknown_0300117C = taskFunc;
|
sMessageNextTask = taskFunc;
|
||||||
gTasks[taskId].func = Task_ContinueTaskAfterMessagePrints;
|
gTasks[taskId].func = Task_ContinueTaskAfterMessagePrints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,20 +144,20 @@ bool16 RunTextPrintersRetIsActive(u8 textPrinterId)
|
|||||||
|
|
||||||
static void Task_ContinueTaskAfterMessagePrints(u8 taskId)
|
static void Task_ContinueTaskAfterMessagePrints(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!RunTextPrintersRetIsActive(gUnknown_0203A140))
|
if (!RunTextPrintersRetIsActive(sMessageWindowId))
|
||||||
gUnknown_0300117C(taskId);
|
sMessageNextTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data)
|
void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data)
|
||||||
{
|
{
|
||||||
gUnknown_0203A138 = *data;
|
sYesNo = *data;
|
||||||
gTasks[taskId].func = Task_CallYesOrNoCallback;
|
gTasks[taskId].func = Task_CallYesOrNoCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo)
|
void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo)
|
||||||
{
|
{
|
||||||
CreateYesNoMenu(template, tileStart, palette, 0);
|
CreateYesNoMenu(template, tileStart, palette, 0);
|
||||||
gUnknown_0203A138 = *yesNo;
|
sYesNo = *yesNo;
|
||||||
gTasks[taskId].func = Task_CallYesOrNoCallback;
|
gTasks[taskId].func = Task_CallYesOrNoCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,12 +167,12 @@ static void Task_CallYesOrNoCallback(u8 taskId)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gUnknown_0203A138.yesFunc(taskId);
|
sYesNo.yesFunc(taskId);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case MENU_B_PRESSED:
|
case MENU_B_PRESSED:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gUnknown_0203A138.noFunc(taskId);
|
sYesNo.noFunc(taskId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,11 +275,13 @@ u8 GetLRKeysPressedAndHeld(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_8122148(u16 itemId)
|
bool8 IsHoldingItemAllowed(u16 itemId)
|
||||||
{
|
{
|
||||||
|
// Enigma Berry can't be held in link areas
|
||||||
if (itemId != ITEM_ENIGMA_BERRY)
|
if (itemId != ITEM_ENIGMA_BERRY)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRADE_CENTER) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRADE_CENTER))
|
else if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRADE_CENTER)
|
||||||
|
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRADE_CENTER))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (InUnionRoom() != TRUE)
|
else if (InUnionRoom() != TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -356,33 +358,37 @@ void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
if (arg4 % 2 != 0)
|
if (maxShownItems % 2 != 0)
|
||||||
{
|
{
|
||||||
if ((*arg1) >= arg4 / 2)
|
// Is cursor at least halfway down visible list
|
||||||
|
if (*cursorPos >= maxShownItems / 2)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (*arg1) - (arg4 / 2); i++)
|
for (i = 0; i < *cursorPos - (maxShownItems / 2); i++)
|
||||||
{
|
{
|
||||||
if ((*arg0) + arg2 == arg3)
|
// Stop if reached end of list
|
||||||
|
if (*scrollOffset + shownItems == totalItems)
|
||||||
break;
|
break;
|
||||||
(*arg1)--;
|
(*cursorPos)--;
|
||||||
(*arg0)++;
|
(*scrollOffset)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((*arg1) >= (arg4 / 2) + 1)
|
// Is cursor at least halfway down visible list
|
||||||
|
if (*cursorPos >= (maxShownItems / 2) + 1)
|
||||||
{
|
{
|
||||||
for (i = 0; i <= (*arg1) - (arg4 / 2); i++)
|
for (i = 0; i <= *cursorPos - (maxShownItems / 2); i++)
|
||||||
{
|
{
|
||||||
if ((*arg0) + arg2 == arg3)
|
// Stop if reached end of list
|
||||||
|
if (*scrollOffset + shownItems == totalItems)
|
||||||
break;
|
break;
|
||||||
(*arg1)--;
|
(*cursorPos)--;
|
||||||
(*arg0)++;
|
(*scrollOffset)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4203,7 +4203,7 @@ static void CB2_ReturnToBagMenu(void)
|
|||||||
if (InBattlePyramid() == FALSE)
|
if (InBattlePyramid() == FALSE)
|
||||||
GoToBagMenu(ITEMMENULOCATION_LAST, POCKETS_COUNT, NULL);
|
GoToBagMenu(ITEMMENULOCATION_LAST, POCKETS_COUNT, NULL);
|
||||||
else
|
else
|
||||||
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.callback);
|
GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.exitCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetSacredAshCB(u8 taskId)
|
static void Task_SetSacredAshCB(u8 taskId)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
#include "battle_pyramid_bag.h"
|
#include "battle_pyramid_bag.h"
|
||||||
|
#include "item_menu.h"
|
||||||
|
|
||||||
ALIGNED(4)
|
ALIGNED(4)
|
||||||
const u8 gText_ExpandedPlaceholder_Empty[] = _("");
|
const u8 gText_ExpandedPlaceholder_Empty[] = _("");
|
||||||
@ -255,18 +256,18 @@ const u8 gText_ThePC[] = _("the PC");
|
|||||||
|
|
||||||
const u8 *const gBagMenu_ReturnToStrings[] =
|
const u8 *const gBagMenu_ReturnToStrings[] =
|
||||||
{
|
{
|
||||||
gText_TheField,
|
[ITEMMENULOCATION_FIELD] = gText_TheField,
|
||||||
gText_TheBattle,
|
[ITEMMENULOCATION_BATTLE] = gText_TheBattle,
|
||||||
gText_ThePokemonList,
|
[ITEMMENULOCATION_PARTY] = gText_ThePokemonList,
|
||||||
gText_TheShop,
|
[ITEMMENULOCATION_SHOP] = gText_TheShop,
|
||||||
gText_TheField,
|
[ITEMMENULOCATION_BERRY_TREE] = gText_TheField,
|
||||||
gText_TheField,
|
[ITEMMENULOCATION_BERRY_BLENDER_CRUSH] = gText_TheField,
|
||||||
gText_ThePC,
|
[ITEMMENULOCATION_ITEMPC] = gText_ThePC,
|
||||||
gText_TheField,
|
[ITEMMENULOCATION_FAVOR_LADY] = gText_TheField,
|
||||||
gText_TheField,
|
[ITEMMENULOCATION_QUIZ_LADY] = gText_TheField,
|
||||||
gText_TheField,
|
[ITEMMENULOCATION_APPRENTICE] = gText_TheField,
|
||||||
gText_TheBattle,
|
[ITEMMENULOCATION_WALLY] = gText_TheBattle,
|
||||||
gText_ThePC
|
[ITEMMENULOCATION_PCBOX] = gText_ThePC
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 *const gPyramidBagMenu_ReturnToStrings[] =
|
const u8 *const gPyramidBagMenu_ReturnToStrings[] =
|
||||||
@ -286,15 +287,15 @@ const u8 gText_KeyItemsPocket[] = _("KEY ITEMS");
|
|||||||
|
|
||||||
const u8 *const gPocketNamesStringsTable[] =
|
const u8 *const gPocketNamesStringsTable[] =
|
||||||
{
|
{
|
||||||
gText_ItemsPocket,
|
[ITEMS_POCKET] = gText_ItemsPocket,
|
||||||
gText_PokeBallsPocket,
|
[BALLS_POCKET] = gText_PokeBallsPocket,
|
||||||
gText_TMHMPocket,
|
[TMHM_POCKET] = gText_TMHMPocket,
|
||||||
gText_BerriesPocket,
|
[BERRIES_POCKET] = gText_BerriesPocket,
|
||||||
gText_KeyItemsPocket
|
[KEYITEMS_POCKET] = gText_KeyItemsPocket
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 gText_NumberVar1Clear7Var2[] = _("{NO}{STR_VAR_1}{CLEAR 0x07}{STR_VAR_2}");
|
const u8 gText_NumberItem_TMBerry[] = _("{NO}{STR_VAR_1}{CLEAR 0x07}{STR_VAR_2}");
|
||||||
const u8 gText_ClearTo11Var1Clear5Var2[] = _("{CLEAR_TO 0x11}{STR_VAR_1}{CLEAR 0x05}{STR_VAR_2}");
|
const u8 gText_NumberItem_HM[] = _("{CLEAR_TO 0x11}{STR_VAR_1}{CLEAR 0x05}{STR_VAR_2}");
|
||||||
const u8 gText_SizeSlash[] = _("SIZE /");
|
const u8 gText_SizeSlash[] = _("SIZE /");
|
||||||
const u8 gText_FirmSlash[] = _("FIRM /");
|
const u8 gText_FirmSlash[] = _("FIRM /");
|
||||||
const u8 gText_Var1DotVar2[] = _("{STR_VAR_1}.{STR_VAR_2}”");
|
const u8 gText_Var1DotVar2[] = _("{STR_VAR_1}.{STR_VAR_2}”");
|
||||||
|
Loading…
Reference in New Issue
Block a user