diff options
author | garak <garakmon@gmail.com> | 2018-09-24 08:40:33 -0400 |
---|---|---|
committer | garak <garakmon@gmail.com> | 2018-09-24 08:40:33 -0400 |
commit | 72f9afcbf4a81909019f21acad0484b72ed217f6 (patch) | |
tree | bc7e9a48b8056e28403e251dab7ac64f649ad9e4 /src/item_menu.c | |
parent | 3964dbd4822f1b22bbc696add7e56ff0c5b2caea (diff) | |
parent | 7ceabffc842dfdf127fd594055f895a0803f54f6 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/item_menu.c')
-rwxr-xr-x | src/item_menu.c | 245 |
1 files changed, 209 insertions, 36 deletions
diff --git a/src/item_menu.c b/src/item_menu.c index d134e6375..0cdedec97 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -149,14 +149,57 @@ void sub_81AD6FC(u8 taskId); // .rodata -const struct BgTemplate gUnknown_08613F90[3] = { - {0, 0, 31, 0, 0, 1, 0}, - {1, 0, 30, 0, 0, 0, 0}, - {2, 3, 29, 0, 0, 2, 0} +const struct BgTemplate gUnknown_08613F90[3] = +{ + { + .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, + }, }; -const struct ListMenuTemplate gUnknown_08613F9C = { - NULL, bag_menu_change_item_callback, sub_81AB520, 0, 0, 0, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 7, 0 +const struct ListMenuTemplate gUnknown_08613F9C = +{ + .items = NULL, + .moveCursorFunc = bag_menu_change_item_callback, + .itemPrintFunc = sub_81AB520, + .totalItems = 0, + .maxShowed = 0, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 1, + .fillValue = 0, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 7, + .cursorKind = 0 }; const struct MenuAction gUnknown_08613FB4[] = { @@ -221,27 +264,157 @@ const u8 gUnknown_08614164[][3] = { {0, 14, 10} }; -const struct WindowTemplate gUnknown_08614174[] = { - {0, 14, 2, 15, 16, 1, 0x27}, - {0, 0, 13, 14, 6, 1, 0x117}, - {0, 4, 1, 8, 2, 1, 0x1A1}, - {0, 1, 13, 5, 6, 12, 0x16B}, - {0, 7, 13, 4, 6, 12, 0x189}, - {1, 2, 15, 27, 4, 15, 0x1B1}, - {0xFF, 0, 0, 0, 0, 0, 0} +const struct WindowTemplate gUnknown_08614174[] = +{ + { + .priority = 0, + .tilemapLeft = 14, + .tilemapTop = 2, + .width = 15, + .height = 16, + .paletteNum = 1, + .baseBlock = 0x27, + }, + { + .priority = 0, + .tilemapLeft = 0, + .tilemapTop = 13, + .width = 14, + .height = 6, + .paletteNum = 1, + .baseBlock = 0x117, + }, + { + .priority = 0, + .tilemapLeft = 4, + .tilemapTop = 1, + .width = 8, + .height = 2, + .paletteNum = 1, + .baseBlock = 0x1A1, + }, + { + .priority = 0, + .tilemapLeft = 1, + .tilemapTop = 13, + .width = 5, + .height = 6, + .paletteNum = 12, + .baseBlock = 0x16B, + }, + { + .priority = 0, + .tilemapLeft = 7, + .tilemapTop = 13, + .width = 4, + .height = 6, + .paletteNum = 12, + .baseBlock = 0x189, + }, + { + .priority = 1, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 27, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x1B1, + }, + DUMMY_WIN_TEMPLATE, }; -const struct WindowTemplate gUnknown_086141AC[] = { - {1, 22, 17, 7, 2, 15, 0x21D}, - {1, 22, 15, 7, 4, 15, 0x21D}, - {1, 15, 15, 14, 4, 15, 0x21D}, - {1, 15, 13, 14, 6, 15, 0x21D}, - {1, 2, 15, 27, 4, 15, 0x1B1}, - {1, 24, 15, 5, 4, 15, 0x21D}, - {1, 21, 9, 5, 4, 15, 0x21D}, - {1, 24, 17, 5, 2, 15, 0x21D}, - {1, 18, 11, 10, 2, 15, 0x245}, - {1, 1, 1, 10, 2, 15, 0x231} +const struct WindowTemplate gUnknown_086141AC[] = +{ + { + .priority = 1, + .tilemapLeft = 22, + .tilemapTop = 17, + .width = 7, + .height = 2, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 22, + .tilemapTop = 15, + .width = 7, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 15, + .tilemapTop = 15, + .width = 14, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 15, + .tilemapTop = 13, + .width = 14, + .height = 6, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 27, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x1B1, + }, + { + .priority = 1, + .tilemapLeft = 24, + .tilemapTop = 15, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 21, + .tilemapTop = 9, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 24, + .tilemapTop = 17, + .width = 5, + .height = 2, + .paletteNum = 15, + .baseBlock = 0x21D, + }, + { + .priority = 1, + .tilemapLeft = 18, + .tilemapTop = 11, + .width = 10, + .height = 2, + .paletteNum = 15, + .baseBlock = 0x245, + }, + { + .priority = 1, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 10, + .height = 2, + .paletteNum = 15, + .baseBlock = 0x231, + }, }; // .text @@ -675,7 +848,7 @@ void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a) } itemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, item_index_in_pocket); itemQuantity = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, item_index_in_pocket); - if ((u16)(itemId - ITEM_HM01) <= 7) + if (itemId >= ITEM_HM01 && itemId <= ITEM_HM08) BlitBitmapToWindow(rboxId, gBagMenuHMIcon_Gfx, 8, a - 1, 16, 16); if (gUnknown_0203CE58.pocket == 3) { @@ -701,10 +874,10 @@ void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a) void bag_menu_print_description_box_text(int a) { - u8* str; + const u8 *str; if (a != -2) { - str = (u8*)ItemId_GetDescription(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a)); + str = ItemId_GetDescription(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a)); } else { @@ -884,7 +1057,7 @@ void sub_81ABC54(u8 a, s16 b) u8 r3 = (gUnknown_0203CE58.pocket == 3) ? 3 : 2; ConvertIntToDecimalStringN(gStringVar1, b, 2, r3); StringExpandPlaceholders(gStringVar4, gText_xVar1); - PrintTextOnWindow(a, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0); + AddTextPrinterParameterized(a, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0); } void sub_81ABCC0(int a, int b, int c) @@ -892,7 +1065,7 @@ void sub_81ABCC0(int a, int b, int c) u8 r3 = (gUnknown_0203CE58.pocket == 3) ? 3 : 2; ConvertIntToDecimalStringN(gStringVar1, b, 2, r3); StringExpandPlaceholders(gStringVar4, gText_xVar1); - PrintTextOnWindow(a, 1, gStringVar4, 0, 1, -1, 0); + AddTextPrinterParameterized(a, 1, gStringVar4, 0, 1, -1, 0); PrintMoneyAmount(a, 0x26, 1, c, 0); } @@ -1012,7 +1185,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) ClearWindowTilemap(1); DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); schedule_bg_copy_tilemap_to_vram(0); - gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = 1; + gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE; sub_81AB824(); } pocketId = gUnknown_0203CE58.pocket; @@ -1369,7 +1542,7 @@ void Task_HandleInBattleItemMenuInput(u8 taskId) { if (sub_81221EC() != TRUE) { - s8 r4 = ProcessMenuInputNoWrapAround(); + s8 r4 = Menu_ProcessInputNoWrapAround(); switch (r4) { case -2: @@ -2103,9 +2276,9 @@ void setup_bag_menu_textboxes(void) InitWindows(gUnknown_08614174); DeactivateAllTextPrinters(); - LoadUserWindowBorderGfx(0, 1, -32); - LoadMessageBoxGfx(0, 10, -48); - sub_819A2BC(-64, 1); + LoadUserWindowBorderGfx(0, 1, 0xE0); + LoadMessageBoxGfx(0, 10, 0xD0); + sub_819A2BC(0xC0, 1); LoadPalette(&gUnknown_0860F074, 0xF0, 0x20); for (i = 0; i < 3; i++) { @@ -2118,7 +2291,7 @@ void setup_bag_menu_textboxes(void) void bag_menu_print(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 h) { - AddTextPrinterParameterized2(windowId, fontId, left, top, letterSpacing, lineSpacing, gUnknown_08614164[h], speed, str); + AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, gUnknown_08614164[h], speed, str); } u8 sub_81AE124(u8 a) |