2018-08-15 06:56:11 +02:00
|
|
|
#include "global.h"
|
2018-08-30 20:10:57 +02:00
|
|
|
#include "battle_pyramid_bag.h"
|
2018-08-15 06:56:11 +02:00
|
|
|
#include "main.h"
|
|
|
|
#include "battle_controllers.h"
|
|
|
|
#include "bg.h"
|
|
|
|
#include "field_effect.h"
|
|
|
|
#include "field_weather.h"
|
|
|
|
#include "gpu_regs.h"
|
|
|
|
#include "malloc.h"
|
|
|
|
#include "menu.h"
|
2018-08-30 15:01:07 +02:00
|
|
|
#include "overworld.h"
|
2018-08-15 06:56:11 +02:00
|
|
|
#include "menu_helpers.h"
|
|
|
|
#include "overworld.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "party_menu.h"
|
|
|
|
#include "scanline_effect.h"
|
|
|
|
#include "script.h"
|
|
|
|
#include "task.h"
|
2018-08-30 15:01:07 +02:00
|
|
|
#include "decompress.h"
|
|
|
|
#include "graphics.h"
|
|
|
|
#include "string_util.h"
|
|
|
|
#include "list_menu.h"
|
|
|
|
#include "strings.h"
|
|
|
|
#include "item.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "item_menu.h"
|
|
|
|
#include "mail.h"
|
|
|
|
#include "item_use.h"
|
|
|
|
#include "event_data.h"
|
|
|
|
#include "text_window.h"
|
|
|
|
#include "international_string_util.h"
|
2018-08-30 20:10:57 +02:00
|
|
|
#include "item_icon.h"
|
2018-08-30 15:01:07 +02:00
|
|
|
#include "constants/items.h"
|
2018-08-15 06:56:11 +02:00
|
|
|
#include "constants/rgb.h"
|
2018-08-30 15:01:07 +02:00
|
|
|
#include "constants/songs.h"
|
2018-08-15 06:56:11 +02:00
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
EWRAM_DATA struct PyramidBagResources *gPyramidBagResources = NULL;
|
|
|
|
EWRAM_DATA struct PyramidBagCursorData gPyramidBagCursorData = {0};
|
|
|
|
|
2018-08-30 15:01:07 +02:00
|
|
|
// This file's functions.
|
2018-08-30 20:10:57 +02:00
|
|
|
static void Task_HandlePyramidBagInput(u8 taskId);
|
|
|
|
static void sub_81C4F44(u8 taskId);
|
|
|
|
static void sub_81C5B4C(u8 taskId);
|
|
|
|
static void Task_BeginItemSwap(u8 taskId);
|
|
|
|
static void sub_81C5D20(u8 taskId);
|
|
|
|
static void sub_81C674C(u8 taskId);
|
|
|
|
static void HandleMenuActionInput(u8 taskId);
|
|
|
|
static void HandleFewMenuActionsInput(u8 taskId);
|
|
|
|
static void sub_81C66EC(u8 taskId);
|
|
|
|
static void SetTaskToMainPyramidBagInputHandler(u8 taskId);
|
|
|
|
static void sub_81C6350(u8 taskId);
|
|
|
|
static void sub_81C64B4(u8 taskId);
|
|
|
|
static void sub_81C65CC(u8 taskId);
|
|
|
|
static void sub_81C66AC(u8 taskId);
|
|
|
|
static void PerformItemSwap(u8 taskId);
|
|
|
|
static void Task_ItemSwapHandleInput(u8 taskId);
|
|
|
|
static void sub_81C6A14(u8 taskId);
|
|
|
|
static void SetBagItemsListTemplate(void);
|
|
|
|
static void sub_81C504C(void);
|
|
|
|
static void sub_81C51DC(void);
|
|
|
|
static void AddScrollArrow(void);
|
|
|
|
static void sub_81C56F8(void);
|
|
|
|
static void sub_81C5A20(void);
|
|
|
|
static void sub_81C6BD8(void);
|
|
|
|
static void sub_81C6EF4(void);
|
|
|
|
static void sub_81C700C(void);
|
|
|
|
static void sub_81C6E98(void);
|
|
|
|
static void sub_81C6F20(void);
|
|
|
|
static void sub_81C6404(void);
|
|
|
|
static void sub_81C6E1C(void);
|
|
|
|
static bool8 sub_81C5238(void);
|
|
|
|
static bool8 sub_81C5078(void);
|
|
|
|
static void ShowItemImage(u16 itemId, u8 itemSpriteArrayId);
|
|
|
|
static void PyramidBag_CopyItemName(u8 *dst, u16 itemId);
|
|
|
|
static void sub_81C6FF8(u8 arg0);
|
|
|
|
static void PrintItemDescription(s32 listMenuId);
|
|
|
|
static void sub_81C5AB8(u8 y, u8 arg1);
|
|
|
|
static void PrintOnWindow_Font1(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId);
|
|
|
|
static void PrintOnWindow_Font7(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId);
|
|
|
|
static u8 sub_81C6D24(u8 windowArrayId);
|
|
|
|
static void sub_81C6D6C(u8 windowArrayId);
|
|
|
|
static void sub_81C5EAC(u8 windowId);
|
|
|
|
static void sub_81C5F08(u8 windowId, u8 horizontalCount, u8 verticalCount);
|
2018-08-30 21:28:03 +02:00
|
|
|
static bool8 IsValidMenuAction(s8 arg0);
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6DAC(u8 taskId, const struct YesNoFuncTable *yesNoTable);
|
|
|
|
static void sub_81C6CEC(u8 windowId);
|
|
|
|
static void sub_81C704C(u8 y);
|
|
|
|
static void sub_81C7028(bool8 invisible);
|
|
|
|
static void sub_81C6F68(struct Sprite *sprite);
|
|
|
|
static void BagAction_UseOnField(u8 taskId);
|
|
|
|
static void BagAction_Toss(u8 taskId);
|
|
|
|
static void BagAction_Give(u8 taskId);
|
|
|
|
static void BagAction_Cancel(u8 taskId);
|
|
|
|
static void BagAction_UseInBattle(u8 taskId);
|
|
|
|
static void PyramidBagMoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list);
|
|
|
|
static void PrintItemQuantity(u8 windowId, s32 itemIndex, u8 y);
|
|
|
|
static void TossItem(u8 taskId);
|
|
|
|
static void DontTossItem(u8 taskId);
|
|
|
|
|
|
|
|
// Const rom data.
|
|
|
|
static const struct BgTemplate gUnknown_0861F2B4[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.bg = 0,
|
|
|
|
.charBaseIndex = 0,
|
|
|
|
.mapBaseIndex = 31,
|
|
|
|
.screenSize = 0,
|
|
|
|
.paletteMode = 0,
|
|
|
|
.priority = 1,
|
|
|
|
.baseTile = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.bg = 1,
|
|
|
|
.charBaseIndex = 0,
|
|
|
|
.mapBaseIndex = 30,
|
|
|
|
.screenSize = 0,
|
|
|
|
.paletteMode = 0,
|
|
|
|
.priority = 0,
|
|
|
|
.baseTile = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.bg = 2,
|
|
|
|
.charBaseIndex = 3,
|
|
|
|
.mapBaseIndex = 29,
|
|
|
|
.screenSize = 0,
|
|
|
|
.paletteMode = 0,
|
|
|
|
.priority = 2,
|
|
|
|
.baseTile = 0
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct ListMenuTemplate gUnknown_0861F2C0 =
|
|
|
|
{
|
|
|
|
.items = NULL,
|
|
|
|
.moveCursorFunc = PyramidBagMoveCursorFunc,
|
|
|
|
.itemPrintFunc = PrintItemQuantity,
|
|
|
|
.totalItems = 0,
|
|
|
|
.maxShowed = 0,
|
|
|
|
.windowId = 0,
|
|
|
|
.header_X = 0,
|
|
|
|
.item_X = 8,
|
|
|
|
.cursor_X = 0,
|
|
|
|
.upText_Y = 1,
|
|
|
|
.cursorPal = 2,
|
|
|
|
.fillValue = 0,
|
|
|
|
.cursorShadowPal = 3,
|
|
|
|
.lettersSpacing = 0,
|
|
|
|
.itemVerticalPadding = 0,
|
|
|
|
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
|
|
|
.fontId = 7,
|
|
|
|
.cursorKind = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ACTION_USE_FIELD 0
|
|
|
|
#define ACTION_TOSS 1
|
|
|
|
#define ACTION_GIVE 2
|
|
|
|
#define ACTION_CANCEL 3
|
|
|
|
#define ACTION_USE_BATTLE 4
|
|
|
|
#define ACTION_DUMMY 5
|
|
|
|
|
|
|
|
static const struct MenuAction sMenuActions[] =
|
|
|
|
{
|
|
|
|
[ACTION_USE_FIELD] = { gMenuText_Use, BagAction_UseOnField },
|
|
|
|
[ACTION_TOSS] = { gMenuText_Toss, BagAction_Toss },
|
|
|
|
[ACTION_GIVE] = { gMenuText_Give, BagAction_Give },
|
|
|
|
[ACTION_CANCEL] = { gText_Cancel2, BagAction_Cancel },
|
|
|
|
[ACTION_USE_BATTLE] = { gMenuText_Use, BagAction_UseInBattle },
|
|
|
|
[ACTION_DUMMY] = { gText_EmptyString2, NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
static const u8 sFieldMenuActionIds[] = {ACTION_USE_FIELD, ACTION_GIVE, ACTION_TOSS, ACTION_CANCEL};
|
|
|
|
static const u8 gUnknown_0861F30C[] = {ACTION_TOSS, ACTION_CANCEL};
|
|
|
|
static const u8 sBattleMenuActionIds[] = {ACTION_USE_BATTLE, ACTION_CANCEL};
|
|
|
|
static const u8 gUnknown_0861F310[] = {ACTION_CANCEL};
|
|
|
|
|
|
|
|
static const struct YesNoFuncTable sYesNoTossFuncions =
|
|
|
|
{
|
|
|
|
TossItem, DontTossItem
|
|
|
|
};
|
|
|
|
|
|
|
|
static const u8 sColorTable[][3] =
|
|
|
|
{
|
|
|
|
{0, 2, 3},
|
|
|
|
{0, 3, 1},
|
|
|
|
{1, 2, 3},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct WindowTemplate gUnknown_0861F328[] =
|
|
|
|
{
|
2018-09-02 17:26:23 +02:00
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 0,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 14,
|
|
|
|
.tilemapTop = 2,
|
|
|
|
.width = 15,
|
|
|
|
.height = 16,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 30
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 0,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 0,
|
|
|
|
.tilemapTop = 13,
|
|
|
|
.width = 14,
|
|
|
|
.height = 6,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 270
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 2,
|
|
|
|
.tilemapTop = 15,
|
|
|
|
.width = 27,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 354
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 24,
|
|
|
|
.tilemapTop = 17,
|
|
|
|
.width = 5,
|
|
|
|
.height = 2,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 462
|
|
|
|
},
|
2018-08-30 20:10:57 +02:00
|
|
|
DUMMY_WIN_TEMPLATE,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct WindowTemplate gUnknown_0861F350[] =
|
|
|
|
{
|
2018-09-02 17:26:23 +02:00
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 22,
|
|
|
|
.tilemapTop = 17,
|
|
|
|
.width = 7,
|
|
|
|
.height = 2,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 472
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 22,
|
|
|
|
.tilemapTop = 15,
|
|
|
|
.width = 7,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 472
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 15,
|
|
|
|
.tilemapTop = 15,
|
|
|
|
.width = 14,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 472
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 15,
|
|
|
|
.tilemapTop = 13,
|
|
|
|
.width = 14,
|
|
|
|
.height = 6,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 472
|
|
|
|
},
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
.bg = 1,
|
2018-09-02 17:26:23 +02:00
|
|
|
.tilemapLeft = 24,
|
|
|
|
.tilemapTop = 15,
|
|
|
|
.width = 5,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 15,
|
|
|
|
.baseBlock = 472
|
|
|
|
},
|
2018-08-30 20:10:57 +02:00
|
|
|
};
|
|
|
|
|
2018-09-06 02:24:11 +02:00
|
|
|
static const struct OamData gOamData_861F378 =
|
|
|
|
{
|
|
|
|
.y = 0,
|
|
|
|
.affineMode = 1,
|
|
|
|
.objMode = 0,
|
|
|
|
.mosaic = 0,
|
|
|
|
.bpp = 0,
|
|
|
|
.shape = 0,
|
|
|
|
.x = 0,
|
|
|
|
.matrixNum = 0,
|
|
|
|
.size = 3,
|
|
|
|
.tileNum = 0,
|
|
|
|
.priority = 1,
|
|
|
|
.paletteNum = 0,
|
|
|
|
.affineParam = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const union AnimCmd gSpriteAnim_861F380[] =
|
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 4),
|
|
|
|
ANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const union AnimCmd * const gSpriteAnimTable_861F388[] =
|
|
|
|
{
|
|
|
|
gSpriteAnim_861F380,
|
2018-08-30 20:10:57 +02:00
|
|
|
};
|
|
|
|
|
2018-09-06 02:24:11 +02:00
|
|
|
static const union AffineAnimCmd gSpriteAffineAnim_861F38C[] =
|
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const union AffineAnimCmd gSpriteAffineAnim_861F39C[] =
|
|
|
|
{
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 254, 2),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 2, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 254, 4),
|
|
|
|
AFFINEANIMCMD_FRAME(0, 0, 2, 2),
|
|
|
|
AFFINEANIMCMD_END,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const union AffineAnimCmd * const gSpriteAffineAnimTable_861F3C4[] =
|
|
|
|
{
|
|
|
|
gSpriteAffineAnim_861F38C,
|
|
|
|
gSpriteAffineAnim_861F39C,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct CompressedSpriteSheet gUnknown_0861F3CC = {gBattleFrontierGfx_PyramidBag, 0x0800, 0x1024};
|
|
|
|
|
|
|
|
static const struct SpriteTemplate gUnknown_0861F3D4 =
|
|
|
|
{
|
|
|
|
.tileTag = 0x1024,
|
|
|
|
.paletteTag = 0x1024,
|
|
|
|
.oam = &gOamData_861F378,
|
|
|
|
.anims = gSpriteAnimTable_861F388,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gSpriteAffineAnimTable_861F3C4,
|
|
|
|
.callback = SpriteCallbackDummy
|
|
|
|
};
|
2018-08-15 06:56:11 +02:00
|
|
|
|
2018-08-30 15:01:07 +02:00
|
|
|
// code
|
2018-08-15 06:56:11 +02:00
|
|
|
void sub_81C4EEC(void)
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.cursorPosition = 0;
|
|
|
|
gPyramidBagCursorData.scrollPosition = 0;
|
2018-08-15 06:56:11 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
void CB2_PyramidBagMenuFromStartMenu(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
sub_81C4F98(0, CB2_ReturnToFieldWithOpenMenu);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C4F10(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C4F24(void)
|
|
|
|
{
|
|
|
|
ScriptContext2_Enable();
|
|
|
|
FadeScreen(1, 0);
|
|
|
|
CreateTask(sub_81C4F44, 10);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C4F44(u8 taskId)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
{
|
|
|
|
overworld_free_bg_tilemaps();
|
|
|
|
gFieldCallback2 = hm_add_c3_without_phase_2;
|
|
|
|
sub_81C4F98(3, CB2_ReturnToField);
|
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C4F84(void)
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
sub_81C4F98(4, gPyramidBagCursorData.callback);
|
2018-08-15 06:56:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C4F98(u8 a0, void (*callback)(void))
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources = AllocZeroed(sizeof(*gPyramidBagResources));
|
2018-08-15 06:56:11 +02:00
|
|
|
|
|
|
|
if (a0 != 4)
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.unk4 = a0;
|
2018-08-15 06:56:11 +02:00
|
|
|
|
|
|
|
if (callback != NULL)
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.callback = callback;
|
2018-08-15 06:56:11 +02:00
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->callback2 = NULL;
|
|
|
|
gPyramidBagResources->unk814 = 0xFF;
|
2018-09-06 18:37:45 +02:00
|
|
|
gPyramidBagResources->scrollIndicatorsTaskId = 0xFF;
|
2018-08-30 15:01:07 +02:00
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
memset(gPyramidBagResources->itemsSpriteIds, 0xFF, sizeof(gPyramidBagResources->itemsSpriteIds));
|
|
|
|
memset(gPyramidBagResources->windowIds, 0xFF, sizeof(gPyramidBagResources->windowIds));
|
2018-08-15 06:56:11 +02:00
|
|
|
|
|
|
|
SetMainCallback2(sub_81C504C);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C501C(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
RunTasks();
|
|
|
|
AnimateSprites();
|
|
|
|
BuildOamBuffer();
|
|
|
|
do_scheduled_bg_tilemap_copies_to_vram();
|
|
|
|
UpdatePaletteFade();
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5038(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
LoadOam();
|
|
|
|
ProcessSpriteCopyRequests();
|
|
|
|
TransferPlttBuffer();
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C504C(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
while (sub_81221EC() != TRUE && sub_81C5078() != TRUE && sub_81221AC() != TRUE);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static bool8 sub_81C5078(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
switch (gMain.state)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
SetVBlankHBlankCallbacksToNull();
|
|
|
|
clear_scheduled_bg_copies_to_vram();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
ScanlineEffect_Stop();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
FreeAllSpritePalettes();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ResetPaletteFade();
|
|
|
|
gPaletteFade.bufferTransferDisabled = TRUE;
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
ResetSpriteData();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (!sub_81221AC())
|
|
|
|
{
|
|
|
|
ResetTasks();
|
|
|
|
}
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
sub_81C51DC();
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->state = 0;
|
2018-08-15 06:56:11 +02:00
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
if (sub_81C5238())
|
|
|
|
{
|
|
|
|
gMain.state++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
sub_81C6BD8();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
sub_81C5924();
|
|
|
|
sub_81C59BC();
|
|
|
|
sub_81C5A20();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 10:
|
2018-08-30 15:01:07 +02:00
|
|
|
SetBagItemsListTemplate();
|
2018-08-15 06:56:11 +02:00
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
sub_81C56F8();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
sub_81C6EF4();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 13:
|
2018-08-30 20:10:57 +02:00
|
|
|
AddScrollArrow();
|
2018-08-15 06:56:11 +02:00
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
sub_81C700C();
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
BlendPalettes(0xFFFFFFFF, 0x10, 0);
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
|
|
|
|
gPaletteFade.bufferTransferDisabled = FALSE;
|
|
|
|
gMain.state++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SetVBlankCallback(sub_81C5038);
|
|
|
|
SetMainCallback2(sub_81C501C);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C51DC(void)
|
2018-08-15 06:56:11 +02:00
|
|
|
{
|
|
|
|
ResetVramOamAndBgCntRegs();
|
|
|
|
ResetBgsAndClearDma3BusyFlags(0);
|
|
|
|
InitBgsFromTemplates(0, gUnknown_0861F2B4, ARRAY_COUNT(gUnknown_0861F2B4));
|
2018-08-30 20:10:57 +02:00
|
|
|
SetBgTilemapBuffer(2, gPyramidBagResources->tilemapBuffer);
|
2018-08-15 06:56:11 +02:00
|
|
|
ResetAllBgsCoordinates();
|
|
|
|
schedule_bg_copy_tilemap_to_vram(2);
|
|
|
|
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 |
|
2018-08-30 15:01:07 +02:00
|
|
|
DISPCNT_OBJ_1D_MAP |
|
2018-08-15 06:56:11 +02:00
|
|
|
DISPCNT_OBJ_ON);
|
|
|
|
ShowBg(0);
|
|
|
|
ShowBg(1);
|
|
|
|
ShowBg(2);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
}
|
2018-08-30 15:01:07 +02:00
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static bool8 sub_81C5238(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
switch (gPyramidBagResources->state)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
reset_temp_tile_data_buffers();
|
|
|
|
decompress_and_copy_tile_data_to_vram(2, gBagScreen_Gfx, 0, 0, 0);
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->state++;
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (free_temp_tile_data_buffers_if_possible() != TRUE)
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
LZDecompressWram(gUnknown_08D9AE04, gPyramidBagResources->tilemapBuffer);
|
|
|
|
gPyramidBagResources->state++;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
LoadCompressedPalette(gUnknown_08D9AF44, 0, 0x20);
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->state++;
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
LoadCompressedObjectPic(&gUnknown_0861F3CC);
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->state++;
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sub_81C6E98();
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->state++;
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
LoadListMenuArrowsGfx();
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->state = 0;
|
2018-08-30 15:01:07 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void SetBagItemsListTemplate(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
u16 *pyramidItems = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
for (i = 0; i < gPyramidBagResources->listMenuCount - 1; i++)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
PyramidBag_CopyItemName(gPyramidBagResources->itemStrings[i], pyramidItems[i]);
|
|
|
|
gPyramidBagResources->bagListItems[i].name = gPyramidBagResources->itemStrings[i];
|
|
|
|
gPyramidBagResources->bagListItems[i].id = i;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
2018-08-30 20:10:57 +02:00
|
|
|
StringCopy(gPyramidBagResources->itemStrings[i], gText_CloseBag);
|
|
|
|
gPyramidBagResources->bagListItems[i].name = gPyramidBagResources->itemStrings[i];
|
|
|
|
gPyramidBagResources->bagListItems[i].id = LIST_B_PRESSED;
|
2018-08-30 15:01:07 +02:00
|
|
|
gMultiuseListMenuTemplate = gUnknown_0861F2C0;
|
2018-08-30 20:10:57 +02:00
|
|
|
gMultiuseListMenuTemplate.totalItems = gPyramidBagResources->listMenuCount;
|
|
|
|
gMultiuseListMenuTemplate.items = gPyramidBagResources->bagListItems;
|
|
|
|
gMultiuseListMenuTemplate.maxShowed = gPyramidBagResources->listMenuMaxShown;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PyramidBag_CopyItemName(u8 *dst, u16 itemId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (ItemId_GetPocket(itemId) == POCKET_BERRIES)
|
|
|
|
{
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, ITEM_TO_BERRY(itemId), STR_CONV_MODE_LEADING_ZEROS, 2);
|
|
|
|
CopyItemName(itemId, gStringVar2);
|
|
|
|
StringExpandPlaceholders(dst, gText_UnkF908Var1Clear7Var2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CopyItemName(itemId, dst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PyramidBagMoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (onInit != TRUE)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_81C6F20();
|
|
|
|
}
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->unk814 == 0xFF)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
sub_81C6FF8(gPyramidBagResources->unk815 ^ 1);
|
2018-08-30 15:01:07 +02:00
|
|
|
if (itemIndex != LIST_B_PRESSED)
|
2018-08-30 20:10:57 +02:00
|
|
|
ShowItemImage(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][itemIndex], gPyramidBagResources->unk815);
|
2018-08-30 15:01:07 +02:00
|
|
|
else
|
2018-08-30 20:10:57 +02:00
|
|
|
ShowItemImage(0xFFFF, gPyramidBagResources->unk815);
|
|
|
|
gPyramidBagResources->unk815 ^= 1;
|
2018-08-30 15:01:07 +02:00
|
|
|
PrintItemDescription(itemIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PrintItemQuantity(u8 windowId, s32 itemIndex, u8 y)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s32 xAlign;
|
|
|
|
if (itemIndex == LIST_B_PRESSED)
|
|
|
|
return;
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->unk814 != 0xFF)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->unk814 == (u8)(itemIndex))
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C5AB8(y, 1);
|
|
|
|
else
|
|
|
|
sub_81C5AB8(y, 0xFF);
|
|
|
|
}
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1,
|
|
|
|
gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode][itemIndex],
|
|
|
|
STR_CONV_MODE_RIGHT_ALIGN,
|
|
|
|
2);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_xVar1);
|
|
|
|
xAlign = GetStringRightAlignXOffset(7, gStringVar4, 0x77);
|
|
|
|
PrintOnWindow_Font7(windowId, gStringVar4, xAlign, y, 0, 0, TEXT_SPEED_FF, 0);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PrintItemDescription(s32 listMenuId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
const u8 *desc;
|
|
|
|
if (listMenuId != LIST_B_PRESSED)
|
|
|
|
{
|
|
|
|
desc = ItemId_GetDescription(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][listMenuId]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
StringCopy(gStringVar1, gReturnToXStringsTable2[gPyramidBagCursorData.unk4]);
|
2018-08-30 15:01:07 +02:00
|
|
|
StringExpandPlaceholders(gStringVar4, gText_ReturnToVar1);
|
|
|
|
desc = gStringVar4;
|
|
|
|
}
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
PrintOnWindow_Font1(1, desc, 3, 0, 0, 1, 0, 0);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void AddScrollArrow(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-09-06 18:37:45 +02:00
|
|
|
if (gPyramidBagResources->scrollIndicatorsTaskId == 0xFF)
|
|
|
|
gPyramidBagResources->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(2, 172, 12, 148, gPyramidBagResources->listMenuCount - gPyramidBagResources->listMenuMaxShown, 0xB5E, 0xB5E, &gPyramidBagCursorData.scrollPosition);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void RemoveScrollArrow(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-09-06 18:37:45 +02:00
|
|
|
if (gPyramidBagResources->scrollIndicatorsTaskId != 0xFF)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-09-06 18:37:45 +02:00
|
|
|
RemoveScrollIndicatorArrowPair(gPyramidBagResources->scrollIndicatorsTaskId);
|
|
|
|
gPyramidBagResources->scrollIndicatorsTaskId = 0xFF;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C56F8(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u8 taskId = CreateTask(Task_HandlePyramidBagInput, 0);
|
|
|
|
s16 *data = gTasks[taskId].data;
|
2018-08-30 20:10:57 +02:00
|
|
|
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gPyramidBagCursorData.scrollPosition, gPyramidBagCursorData.cursorPosition);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void SwapItems(u8 id1, u8 id2)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u16 temp;
|
|
|
|
u16 *itemIds = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
|
|
|
|
SWAP(itemIds[id1], itemIds[id2], temp);
|
|
|
|
SWAP(quantities[id1], quantities[id2], temp);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void MovePyramidBagItemSlotInList(u8 from, u8 to)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u16 *itemIds = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
|
|
|
|
if (from != to)
|
|
|
|
{
|
|
|
|
s16 i;
|
|
|
|
u16 firstSlotItemId = itemIds[from];
|
|
|
|
u8 firstSlotQuantity = quantities[from];
|
|
|
|
|
|
|
|
if (to > from)
|
|
|
|
{
|
|
|
|
to--;
|
|
|
|
for (i = from; i < to; i++)
|
|
|
|
{
|
|
|
|
itemIds[i] = itemIds[i + 1];
|
|
|
|
quantities[i] = quantities[i + 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = from; i > to; i--)
|
|
|
|
{
|
|
|
|
itemIds[i] = itemIds[i - 1];
|
|
|
|
quantities[i] = quantities[i - 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
itemIds[to] = firstSlotItemId;
|
|
|
|
quantities[to] = firstSlotQuantity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void CompactItems(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u8 i, j;
|
|
|
|
u16 *itemIds = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
|
|
|
|
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
|
|
|
|
{
|
|
|
|
if (itemIds[i] == 0 || quantities[i] == 0)
|
|
|
|
{
|
|
|
|
itemIds[i] = 0;
|
|
|
|
quantities[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT - 1; i++)
|
|
|
|
{
|
|
|
|
for (j = i + 1; j < PYRAMID_BAG_ITEMS_COUNT; j++)
|
|
|
|
{
|
|
|
|
if (itemIds[i] == 0 || quantities[i] == 0)
|
|
|
|
SwapItems(i, j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C5924(void)
|
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
u16 *itemIds = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode];
|
|
|
|
|
|
|
|
CompactItems();
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->listMenuCount = 0;
|
2018-08-30 15:01:07 +02:00
|
|
|
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
|
|
|
|
{
|
|
|
|
if (itemIds[i] != 0)
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->listMenuCount++;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->listMenuCount++;
|
|
|
|
if (gPyramidBagResources->listMenuCount > 8)
|
|
|
|
gPyramidBagResources->listMenuMaxShown = 8;
|
2018-08-30 15:01:07 +02:00
|
|
|
else
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->listMenuMaxShown = gPyramidBagResources->listMenuCount;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C59BC(void)
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagCursorData.scrollPosition != 0 && gPyramidBagCursorData.scrollPosition + gPyramidBagResources->listMenuMaxShown > gPyramidBagResources->listMenuCount)
|
|
|
|
gPyramidBagCursorData.scrollPosition = gPyramidBagResources->listMenuCount - gPyramidBagResources->listMenuMaxShown;
|
|
|
|
if (gPyramidBagCursorData.scrollPosition + gPyramidBagCursorData.cursorPosition >= gPyramidBagResources->listMenuCount)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->listMenuCount == 0)
|
|
|
|
gPyramidBagCursorData.cursorPosition = 0;
|
2018-08-30 15:01:07 +02:00
|
|
|
else
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.cursorPosition = gPyramidBagResources->listMenuCount - 1;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5A20(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagCursorData.cursorPosition > 4)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
for (i = 0; i <= gPyramidBagCursorData.cursorPosition - 4; i++)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagCursorData.scrollPosition + gPyramidBagResources->listMenuMaxShown == gPyramidBagResources->listMenuCount)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
// daycare.c sends its regards.
|
|
|
|
break;
|
|
|
|
}
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.cursorPosition--;
|
|
|
|
gPyramidBagCursorData.scrollPosition++;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5A98(u8 listMenuTaskId, u8 arg1)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u8 y = ListMenuGetYCoordForPrintingArrowCursor(listMenuTaskId);
|
|
|
|
sub_81C5AB8(y, arg1);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5AB8(u8 y, u8 arg1)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (arg1 == 0xFF)
|
|
|
|
FillWindowPixelRect(0, 0, 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
|
|
|
|
else
|
|
|
|
PrintOnWindow_Font1(0, gText_SelectorArrow2, 0, y, 0, 0, 0, arg1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C5B14(u8 taskId)
|
|
|
|
{
|
|
|
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
|
|
|
gTasks[taskId].func = sub_81C5B4C;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5B4C(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
DestroyListMenuTask(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
|
|
|
if (gPyramidBagResources->callback2 != NULL)
|
|
|
|
SetMainCallback2(gPyramidBagResources->callback2);
|
2018-08-30 15:01:07 +02:00
|
|
|
else
|
2018-08-30 20:10:57 +02:00
|
|
|
SetMainCallback2(gPyramidBagCursorData.callback);
|
|
|
|
RemoveScrollArrow();
|
2018-08-30 15:01:07 +02:00
|
|
|
ResetSpriteData();
|
|
|
|
FreeAllSpritePalettes();
|
|
|
|
FreeAllWindowBuffers();
|
2018-08-30 20:10:57 +02:00
|
|
|
Free(gPyramidBagResources);
|
2018-08-30 15:01:07 +02:00
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void Task_HandlePyramidBagInput(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
if (sub_81221EC() != TRUE && !gPaletteFade.active)
|
|
|
|
{
|
|
|
|
if (gMain.newKeys & SELECT_BUTTON)
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagCursorData.unk4 != 2)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
|
|
|
if (gPyramidBagCursorData.scrollPosition + gPyramidBagCursorData.cursorPosition != gPyramidBagResources->listMenuCount - 1)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
Task_BeginItemSwap(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s32 listId = ListMenuHandleInputGetItemId(data[0]);
|
2018-08-30 20:10:57 +02:00
|
|
|
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
2018-08-30 15:01:07 +02:00
|
|
|
switch (listId)
|
|
|
|
{
|
|
|
|
case LIST_NOTHING_CHOSEN:
|
|
|
|
break;
|
|
|
|
case LIST_B_PRESSED:
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
gSpecialVar_ItemId = 0;
|
|
|
|
sub_81C5B14(taskId);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
gSpecialVar_ItemId = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][listId];
|
|
|
|
data[1] = listId;
|
|
|
|
data[2] = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode][listId];
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagCursorData.unk4 == 2)
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C674C(taskId);
|
|
|
|
else
|
|
|
|
sub_81C5D20(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5D20(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
RemoveScrollArrow();
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C5A98(data[0], 1);
|
2018-08-30 20:10:57 +02:00
|
|
|
switch (gPyramidBagCursorData.unk4)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
default:
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->menuActionIds = sFieldMenuActionIds;
|
|
|
|
gPyramidBagResources->menuActionsCount = ARRAY_COUNT(sFieldMenuActionIds);
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (ItemId_GetBattleUsage(gSpecialVar_ItemId))
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->menuActionIds = sBattleMenuActionIds;
|
|
|
|
gPyramidBagResources->menuActionsCount = ARRAY_COUNT(sBattleMenuActionIds);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->menuActionIds = gUnknown_0861F310;
|
|
|
|
gPyramidBagResources->menuActionsCount = ARRAY_COUNT(gUnknown_0861F310);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->menuActionIds = gUnknown_0861F30C;
|
|
|
|
gPyramidBagResources->menuActionsCount = ARRAY_COUNT(gUnknown_0861F30C);
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected);
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->menuActionsCount == 1)
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C5EAC(sub_81C6D24(0));
|
2018-08-30 20:10:57 +02:00
|
|
|
else if (gPyramidBagResources->menuActionsCount == 2)
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C5EAC(sub_81C6D24(1));
|
|
|
|
else
|
|
|
|
sub_81C5F08(sub_81C6D24(2), 2, 2);
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->menuActionsCount == 4)
|
|
|
|
gTasks[taskId].func = HandleMenuActionInput;
|
2018-08-30 15:01:07 +02:00
|
|
|
else
|
2018-08-30 20:10:57 +02:00
|
|
|
gTasks[taskId].func = HandleFewMenuActionsInput;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5EAC(u8 windowId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
AddItemMenuActionTextPrinters(windowId, 7, 8, 1, 0, 0x10, gPyramidBagResources->menuActionsCount, sMenuActions, gPyramidBagResources->menuActionIds);
|
|
|
|
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, gPyramidBagResources->menuActionsCount, 0);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C5F08(u8 windowId, u8 horizontalCount, u8 verticalCount)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
sub_8198DBC(windowId, 7, 8, 1, 0x38, horizontalCount, verticalCount, sMenuActions, gPyramidBagResources->menuActionIds);
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_8199944(windowId, 0x38, horizontalCount, verticalCount, 0);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void HandleFewMenuActionsInput(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (sub_81221EC() != TRUE)
|
|
|
|
{
|
2018-11-05 21:45:54 +01:00
|
|
|
s32 id = Menu_ProcessInputNoWrap();
|
2018-08-30 15:01:07 +02:00
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case -2:
|
|
|
|
break;
|
|
|
|
case -1:
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
sMenuActions[ACTION_CANCEL].func.void_u8(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
if (sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8 != NULL)
|
|
|
|
sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void HandleMenuActionInput(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (sub_81221EC() != TRUE)
|
|
|
|
{
|
|
|
|
s8 id = GetMenuCursorPos();
|
|
|
|
if (gMain.newKeys & DPAD_UP)
|
|
|
|
{
|
2018-08-30 21:28:03 +02:00
|
|
|
if (id > 0 && IsValidMenuAction(id - 2))
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_8199134(0, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gMain.newKeys & DPAD_DOWN)
|
|
|
|
{
|
2018-08-30 21:28:03 +02:00
|
|
|
if (id < gPyramidBagResources->menuActionsCount - 2 && IsValidMenuAction(id + 2))
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_8199134(0, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
|
|
|
|
{
|
2018-08-30 21:28:03 +02:00
|
|
|
if (id & 1 && IsValidMenuAction(id - 1))
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_8199134(-1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
|
|
|
|
{
|
2018-08-30 21:28:03 +02:00
|
|
|
if (!(id & 1) && IsValidMenuAction(id + 1))
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_8199134(1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gMain.newKeys & A_BUTTON)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
if (sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8 != NULL)
|
|
|
|
sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
else if (gMain.newKeys & B_BUTTON)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
sMenuActions[ACTION_CANCEL].func.void_u8(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 21:28:03 +02:00
|
|
|
static bool8 IsValidMenuAction(s8 actionTableId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (actionTableId < 0)
|
2018-08-30 15:01:07 +02:00
|
|
|
return FALSE;
|
2018-08-30 20:10:57 +02:00
|
|
|
else if (actionTableId > gPyramidBagResources->menuActionsCount)
|
2018-08-30 15:01:07 +02:00
|
|
|
return FALSE;
|
2018-08-30 20:10:57 +02:00
|
|
|
else if (gPyramidBagResources->menuActionIds[actionTableId] == ACTION_DUMMY)
|
2018-08-30 15:01:07 +02:00
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C61A8(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
if (gPyramidBagResources->menuActionsCount == 1)
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C6D6C(0);
|
2018-08-30 20:10:57 +02:00
|
|
|
else if (gPyramidBagResources->menuActionsCount == 2)
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C6D6C(1);
|
|
|
|
else
|
|
|
|
sub_81C6D6C(2);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void BagAction_UseOnField(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u8 pocketId = ItemId_GetPocket(gSpecialVar_ItemId);
|
|
|
|
|
|
|
|
if (pocketId == POCKET_KEY_ITEMS
|
|
|
|
|| pocketId == POCKET_POKE_BALLS
|
|
|
|
|| pocketId == POCKET_TM_HM
|
|
|
|
|| ItemIsMail(gSpecialVar_ItemId) == TRUE)
|
|
|
|
{
|
|
|
|
sub_81C61A8();
|
|
|
|
DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, sub_81C6714);
|
|
|
|
}
|
|
|
|
else if (ItemId_GetFieldFunc(gSpecialVar_ItemId) != NULL)
|
|
|
|
{
|
|
|
|
sub_81C61A8();
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(0);
|
|
|
|
ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void BagAction_Cancel(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
sub_81C61A8();
|
|
|
|
PrintItemDescription(data[1]);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(0);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
sub_81C5A98(data[0], 0);
|
2018-08-30 20:10:57 +02:00
|
|
|
SetTaskToMainPyramidBagInputHandler(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void SetTaskToMainPyramidBagInputHandler(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
AddScrollArrow();
|
2018-08-30 15:01:07 +02:00
|
|
|
gTasks[taskId].func = Task_HandlePyramidBagInput;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void BagAction_Toss(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
sub_81C61A8();
|
|
|
|
data[8] = 1;
|
|
|
|
if (data[2] == 1)
|
|
|
|
{
|
|
|
|
sub_81C6350(taskId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s);
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
|
|
|
|
sub_81C6404();
|
|
|
|
gTasks[taskId].func = sub_81C64B4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6350(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
|
|
|
ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 2);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems);
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
|
2018-08-30 20:10:57 +02:00
|
|
|
sub_81C6DAC(taskId, &sYesNoTossFuncions);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void DontTossItem(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
PrintItemDescription(data[1]);
|
|
|
|
sub_81C5A98(data[0], 0);
|
2018-08-30 20:10:57 +02:00
|
|
|
SetTaskToMainPyramidBagInputHandler(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6404(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s32 x;
|
|
|
|
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, 1, STR_CONV_MODE_LEADING_ZEROS, 2);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_xVar1);
|
|
|
|
sub_81C6CEC(3);
|
|
|
|
x = GetStringCenterAlignXOffset(1, gStringVar4, 0x28);
|
2018-09-08 23:38:30 +02:00
|
|
|
AddTextPrinterParameterized(3, 1, gStringVar4, x, 2, 0, NULL);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C645C(s16 value)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s32 x;
|
|
|
|
|
|
|
|
ConvertIntToDecimalStringN(gStringVar1, value, STR_CONV_MODE_LEADING_ZEROS, 2);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_xVar1);
|
|
|
|
x = GetStringCenterAlignXOffset(1, gStringVar4, 0x28);
|
2018-09-08 23:38:30 +02:00
|
|
|
AddTextPrinterParameterized(3, 1, gStringVar4, x, 2, 0, NULL);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C64B4(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
|
|
|
|
{
|
|
|
|
sub_81C645C(data[8]);
|
|
|
|
}
|
|
|
|
else if (gMain.newKeys & A_BUTTON)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_8198070(3, 0);
|
|
|
|
ClearWindowTilemap(3);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
sub_81C6350(taskId);
|
|
|
|
}
|
|
|
|
else if (gMain.newKeys & B_BUTTON)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_8198070(3, 0);
|
|
|
|
ClearWindowTilemap(3);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
2018-08-30 20:10:57 +02:00
|
|
|
DontTossItem(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void TossItem(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
|
|
|
ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 2);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s);
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
|
|
|
|
gTasks[taskId].func = sub_81C65CC;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C65CC(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
2018-08-30 20:10:57 +02:00
|
|
|
u16 *scrollOffset = &gPyramidBagCursorData.scrollPosition;
|
|
|
|
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
|
2018-08-30 15:01:07 +02:00
|
|
|
|
|
|
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
RemovePyramidBagItem(gSpecialVar_ItemId, data[8]);
|
|
|
|
DestroyListMenuTask(data[0], scrollOffset, selectedRow);
|
|
|
|
sub_81C5924();
|
|
|
|
sub_81C59BC();
|
|
|
|
SetBagItemsListTemplate();
|
|
|
|
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollOffset, *selectedRow);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(0);
|
2018-08-30 20:10:57 +02:00
|
|
|
SetTaskToMainPyramidBagInputHandler(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void BagAction_Give(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
sub_81C61A8();
|
|
|
|
if (ItemIsMail(gSpecialVar_ItemId) == TRUE)
|
|
|
|
{
|
|
|
|
DisplayItemMessageInBattlePyramid(taskId, gText_CantWriteMail, sub_81C66EC);
|
|
|
|
}
|
|
|
|
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
|
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->callback2 = sub_81B7F60;
|
2018-08-30 15:01:07 +02:00
|
|
|
sub_81C5B14(taskId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sub_81C66AC(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C66AC(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_Var1CantBeHeld);
|
|
|
|
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C66EC);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C66EC(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (gMain.newKeys & A_BUTTON)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
sub_81C6714(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C6714(u8 taskId)
|
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
|
|
|
sub_81C6E1C();
|
|
|
|
PrintItemDescription(data[1]);
|
|
|
|
sub_81C5A98(data[0], 0);
|
2018-08-30 20:10:57 +02:00
|
|
|
SetTaskToMainPyramidBagInputHandler(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C674C(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (!itemid_80BF6D8_mail_related(gSpecialVar_ItemId))
|
|
|
|
DisplayItemMessageInBattlePyramid(taskId, gText_CantWriteMail, sub_81C66EC);
|
|
|
|
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
|
|
|
|
sub_81C5B14(taskId);
|
|
|
|
else
|
|
|
|
sub_81C66AC(taskId);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void BagAction_UseInBattle(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
if (ItemId_GetBattleFunc(gSpecialVar_ItemId) != NULL)
|
|
|
|
{
|
|
|
|
sub_81C61A8();
|
|
|
|
ItemId_GetBattleFunc(gSpecialVar_ItemId)(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void Task_BeginItemSwap(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
data[1] = gPyramidBagCursorData.scrollPosition + gPyramidBagCursorData.cursorPosition;
|
|
|
|
gPyramidBagResources->unk814 = data[1];
|
2018-08-30 15:01:07 +02:00
|
|
|
ListMenuSetUnkIndicatorsStructField(data[0], 0x10, 1);
|
|
|
|
CopyItemName(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][data[1]], gStringVar1);
|
|
|
|
StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where);
|
|
|
|
FillWindowPixelBuffer(1, 0);
|
|
|
|
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
|
|
|
|
sub_81C5A98(data[0], 1);
|
|
|
|
sub_81C704C(data[1]);
|
2018-08-30 20:10:57 +02:00
|
|
|
gTasks[taskId].func = Task_ItemSwapHandleInput;
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void Task_ItemSwapHandleInput(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
|
|
|
if (sub_81221EC() != TRUE)
|
|
|
|
{
|
|
|
|
if (gMain.newKeys & SELECT_BUTTON)
|
|
|
|
{
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
|
|
|
PerformItemSwap(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s32 id = ListMenuHandleInputGetItemId(data[0]);
|
2018-08-30 20:10:57 +02:00
|
|
|
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
|
|
|
sub_81C7028(FALSE);
|
|
|
|
sub_81C704C(gPyramidBagCursorData.cursorPosition);
|
2018-08-30 15:01:07 +02:00
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case LIST_NOTHING_CHOSEN:
|
|
|
|
break;
|
|
|
|
case LIST_B_PRESSED:
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
if (gMain.newKeys & A_BUTTON)
|
2018-08-30 20:10:57 +02:00
|
|
|
PerformItemSwap(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
else
|
|
|
|
sub_81C6A14(taskId);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PlaySE(SE_SELECT);
|
2018-08-30 20:10:57 +02:00
|
|
|
PerformItemSwap(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PerformItemSwap(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
2018-08-30 20:10:57 +02:00
|
|
|
u16 *scrollOffset = &gPyramidBagCursorData.scrollPosition;
|
|
|
|
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
|
2018-08-30 15:01:07 +02:00
|
|
|
u16 var = *scrollOffset + *selectedRow;
|
|
|
|
|
|
|
|
if (data[1] == var || data[1] == var - 1)
|
|
|
|
{
|
|
|
|
sub_81C6A14(taskId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MovePyramidBagItemSlotInList(data[1], var);
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->unk814 = 0xFF;
|
|
|
|
sub_81C7028(TRUE);
|
2018-08-30 15:01:07 +02:00
|
|
|
DestroyListMenuTask(data[0], scrollOffset, selectedRow);
|
|
|
|
if (data[1] < var)
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.cursorPosition--;
|
2018-08-30 15:01:07 +02:00
|
|
|
SetBagItemsListTemplate();
|
|
|
|
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollOffset, *selectedRow);
|
2018-08-30 20:10:57 +02:00
|
|
|
SetTaskToMainPyramidBagInputHandler(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6A14(u8 taskId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
s16 *data = gTasks[taskId].data;
|
2018-08-30 20:10:57 +02:00
|
|
|
u16 *scrollOffset = &gPyramidBagCursorData.scrollPosition;
|
|
|
|
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
|
2018-08-30 15:01:07 +02:00
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagResources->unk814 = 0xFF;
|
|
|
|
sub_81C7028(TRUE);
|
2018-08-30 15:01:07 +02:00
|
|
|
DestroyListMenuTask(data[0], scrollOffset, selectedRow);
|
|
|
|
if (data[1] < *scrollOffset + *selectedRow)
|
2018-08-30 20:10:57 +02:00
|
|
|
gPyramidBagCursorData.cursorPosition--;
|
2018-08-30 15:01:07 +02:00
|
|
|
SetBagItemsListTemplate();
|
|
|
|
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollOffset, *selectedRow);
|
2018-08-30 20:10:57 +02:00
|
|
|
SetTaskToMainPyramidBagInputHandler(taskId);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C6A94(void)
|
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
struct Pokemon *party = gPlayerParty;
|
|
|
|
u16 *newItems = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
|
|
|
|
u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
|
|
|
|
u16 heldItem;
|
|
|
|
|
|
|
|
memcpy(newItems, gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
|
|
|
|
memcpy(newQuantities, gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
heldItem = GetMonData(&party[i], MON_DATA_HELD_ITEM);
|
|
|
|
if (heldItem != 0 && !AddBagItem(heldItem, 1))
|
|
|
|
{
|
|
|
|
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
|
|
|
|
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
|
|
|
|
Free(newItems);
|
|
|
|
Free(newQuantities);
|
|
|
|
gSpecialVar_Result = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
heldItem = 0;
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
SetMonData(&party[i], MON_DATA_HELD_ITEM, &heldItem);
|
|
|
|
}
|
|
|
|
gSpecialVar_Result = 0;
|
|
|
|
Free(newItems);
|
|
|
|
Free(newQuantities);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6BD8(void)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
InitWindows(gUnknown_0861F328);
|
|
|
|
DeactivateAllTextPrinters();
|
|
|
|
LoadUserWindowBorderGfx(0, 0x1, 0xE0);
|
|
|
|
LoadMessageBoxGfx(0, 0xA, 0xD0);
|
|
|
|
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
FillWindowPixelBuffer(i, 0);
|
|
|
|
|
|
|
|
PutWindowTilemap(0);
|
|
|
|
PutWindowTilemap(1);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(0);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PrintOnWindow_Font1(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-09-08 23:38:30 +02:00
|
|
|
AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, sColorTable[colorTableId], speed, src);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void PrintOnWindow_Font7(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-09-08 23:38:30 +02:00
|
|
|
AddTextPrinterParameterized4(windowId, 7, x, y, letterSpacing, lineSpacing, sColorTable[colorTableId], speed, src);
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6CEC(u8 windowId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
|
|
|
SetWindowBorderStyle(windowId, 0, 1, 0xE);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static u8 sub_81C6D08(u8 windowArrayId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
return gPyramidBagResources->windowIds[windowArrayId];
|
2018-08-30 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static u8 sub_81C6D24(u8 windowArrayId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
|
2018-08-30 15:01:07 +02:00
|
|
|
if (*windowId == 0xFF)
|
|
|
|
{
|
|
|
|
*windowId = AddWindow(&gUnknown_0861F350[windowArrayId]);
|
|
|
|
SetWindowBorderStyle(*windowId, FALSE, 1, 0xE);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
}
|
|
|
|
return *windowId;
|
|
|
|
}
|
|
|
|
|
2018-08-30 20:10:57 +02:00
|
|
|
static void sub_81C6D6C(u8 windowArrayId)
|
2018-08-30 15:01:07 +02:00
|
|
|
{
|
2018-08-30 20:10:57 +02:00
|
|
|
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
|
2018-08-30 15:01:07 +02:00
|
|
|
if (*windowId != 0xFF)
|
|
|
|
{
|
|
|
|
sub_8198070(*windowId, FALSE);
|
|
|
|
ClearWindowTilemap(*windowId);
|
|
|
|
RemoveWindow(*windowId);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
*windowId = 0xFF;
|
|
|
|
}
|
|
|
|
}
|
2018-08-30 20:10:57 +02:00
|
|
|
|
|
|
|
static void sub_81C6DAC(u8 taskId, const struct YesNoFuncTable *yesNoTable)
|
|
|
|
{
|
|
|
|
CreateYesNoMenuWithCallbacks(taskId, &gUnknown_0861F350[4], 1, 0, 2, 1, 0xE, yesNoTable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId))
|
|
|
|
{
|
|
|
|
FillWindowPixelBuffer(2, 0x11);
|
2018-11-06 18:30:21 +01:00
|
|
|
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback);
|
2018-08-30 20:10:57 +02:00
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C6E1C(void)
|
|
|
|
{
|
|
|
|
sub_8197DF8(2, FALSE);
|
|
|
|
ClearWindowTilemap(2);
|
|
|
|
schedule_bg_copy_tilemap_to_vram(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ITEM_IMAGE_TAG 0x1024
|
|
|
|
|
|
|
|
static void sub_81C6E38(u8 itemSpriteArrayId)
|
|
|
|
{
|
|
|
|
u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[itemSpriteArrayId];
|
|
|
|
if (*spriteId != 0xFF)
|
|
|
|
{
|
|
|
|
FreeSpriteTilesByTag(ITEM_IMAGE_TAG + itemSpriteArrayId);
|
|
|
|
FreeSpritePaletteByTag(ITEM_IMAGE_TAG + itemSpriteArrayId);
|
|
|
|
FreeSpriteOamMatrix(&gSprites[*spriteId]);
|
|
|
|
DestroySprite(&gSprites[*spriteId]);
|
|
|
|
*spriteId = 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C6E98(void)
|
|
|
|
{
|
|
|
|
struct SpritePalette spritePalette;
|
|
|
|
u16 *palPtr = Alloc(0x40);
|
|
|
|
|
|
|
|
LZDecompressWram(gUnknown_08D9ADD0, palPtr);
|
|
|
|
spritePalette.data = palPtr + (gSaveBlock2Ptr->frontier.lvlMode * 16);
|
|
|
|
spritePalette.tag = ITEM_IMAGE_TAG;
|
|
|
|
LoadSpritePalette(&spritePalette);
|
|
|
|
Free(palPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C6EF4(void)
|
|
|
|
{
|
|
|
|
u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[0];
|
|
|
|
*spriteId = CreateSprite(&gUnknown_0861F3D4, 0x44, 0x38, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C6F20(void)
|
|
|
|
{
|
|
|
|
struct Sprite *sprite = &gSprites[gPyramidBagResources->itemsSpriteIds[0]];
|
|
|
|
if (sprite->affineAnimEnded)
|
|
|
|
{
|
|
|
|
StartSpriteAffineAnim(sprite, 1);
|
|
|
|
sprite->callback = sub_81C6F68;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C6F68(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->affineAnimEnded)
|
|
|
|
{
|
|
|
|
StartSpriteAffineAnim(sprite, 0);
|
|
|
|
sprite->callback = SpriteCallbackDummy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ShowItemImage(u16 itemId, u8 itemSpriteArrayId)
|
|
|
|
{
|
|
|
|
u8 itemSpriteId;
|
|
|
|
u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[itemSpriteArrayId + 1];
|
|
|
|
if (*spriteId == 0xFF)
|
|
|
|
{
|
|
|
|
FreeSpriteTilesByTag(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId);
|
|
|
|
FreeSpritePaletteByTag(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId);
|
|
|
|
itemSpriteId = AddItemIconSprite(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId, ITEM_IMAGE_TAG + 1 + itemSpriteArrayId, itemId);
|
|
|
|
if (itemSpriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
*spriteId = itemSpriteId;
|
|
|
|
gSprites[itemSpriteId].pos2.x = 24;
|
|
|
|
gSprites[itemSpriteId].pos2.y = 88;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C6FF8(u8 itemSpriteArrayId)
|
|
|
|
{
|
|
|
|
sub_81C6E38(itemSpriteArrayId + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C700C(void)
|
|
|
|
{
|
|
|
|
sub_8122344(&gPyramidBagResources->itemsSpriteIds[3], 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C7028(bool8 invisible)
|
|
|
|
{
|
|
|
|
sub_81223FC(&gPyramidBagResources->itemsSpriteIds[3], 8, invisible);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_81C704C(u8 y)
|
|
|
|
{
|
|
|
|
sub_8122448(&gPyramidBagResources->itemsSpriteIds[3], 8 | 0x80, 120, (y + 1) * 16);
|
|
|
|
}
|