diff --git a/.gitignore b/.gitignore index 93385ea51..ebf507247 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.gba *.sgm *.sa1 +*.ss[0-9] *.sg1 *.1bpp *.4bpp diff --git a/INSTALL.md b/INSTALL.md index 6f5a2435d..c2d3f32da 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -14,7 +14,7 @@ Make sure that the `build-essential`, `git`, and `libpng-dev` packages are insta Install the **devkitARM** toolchain of [devkitPro](https://devkitpro.org/wiki/Getting_Started) and add its environment variables. For Windows versions without the Linux subsystem, the devkitPro [graphical installer](https://github.com/devkitPro/installer/releases) includes a preconfigured MSYS2 environment, thus the steps below are not required. - export DEVKITPRO=/opt/devkitpro + export DEVKITPRO=/opt/devkitPro echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc export DEVKITARM=$DEVKITPRO/devkitARM echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc diff --git a/data/fonts.s b/data/fonts.s index aa8423acf..facc882ac 100644 --- a/data/fonts.s +++ b/data/fonts.s @@ -5,72 +5,72 @@ .align 2 gFont8LatinGlyphs:: @ 862BAE4 - .incbin "data/graphics/fonts/font8.latfont" + .incbin "graphics/fonts/font8.latfont" .align 2 gFont8LatinGlyphWidths:: @ 8633AE4 - .include "data/graphics/fonts/font8_latin_widths.inc" + .include "graphics/fonts/font8_latin_widths.inc" .align 2 gFont0LatinGlyphs:: @ 8633CE4 - .incbin "data/graphics/fonts/font0.latfont" + .incbin "graphics/fonts/font0.latfont" .align 2 gFont0LatinGlyphWidths:: @ 863BCE4 - .include "data/graphics/fonts/font0_latin_widths.inc" + .include "graphics/fonts/font0_latin_widths.inc" .align 2 gFont7LatinGlyphs:: @ 863BEE4 - .incbin "data/graphics/fonts/font7.latfont" + .incbin "graphics/fonts/font7.latfont" .align 2 gFont7LatinGlyphWidths:: @ 8643EE4 - .include "data/graphics/fonts/font7_latin_widths.inc" + .include "graphics/fonts/font7_latin_widths.inc" .align 2 gFont2LatinGlyphs:: @ 86440E4 - .incbin "data/graphics/fonts/font2.latfont" + .incbin "graphics/fonts/font2.latfont" .align 2 gFont2LatinGlyphWidths:: @ 864C0E4 - .include "data/graphics/fonts/font2_latin_widths.inc" + .include "graphics/fonts/font2_latin_widths.inc" .align 2 gFont1LatinGlyphs:: @ 864C2E4 - .incbin "data/graphics/fonts/font1.latfont" + .incbin "graphics/fonts/font1.latfont" .align 2 gFont1LatinGlyphWidths:: @ 86542E4 - .include "data/graphics/fonts/font1_latin_widths.inc" + .include "graphics/fonts/font1_latin_widths.inc" .align 2 gFont0JapaneseGlyphs:: @ 86544E4 - .incbin "data/graphics/fonts/font0.hwjpnfont" + .incbin "graphics/fonts/font0.hwjpnfont" .align 2 gFont1JapaneseGlyphs:: @ 86584E4 - .incbin "data/graphics/fonts/font1.hwjpnfont" + .incbin "graphics/fonts/font1.hwjpnfont" .align 2 gUnusedJapaneseFireRedLeafGreenMaleFontGlyphs:: @ 865C4E4 - .incbin "data/graphics/fonts/unused_frlg_male.fwjpnfont" + .incbin "graphics/fonts/unused_frlg_male.fwjpnfont" .align 2 gUnusedJapaneseFireRedLeafGreenMaleFontGlyphWidths:: @ 86644E4 - .include "data/graphics/fonts/unused_japanese_frlg_male_font_widths.inc" + .include "graphics/fonts/unused_japanese_frlg_male_font_widths.inc" .align 2 gUnusedJapaneseFireRedLeafGreenFemaleFontGlyphs:: @ 86646E4 - .incbin "data/graphics/fonts/unused_frlg_female.fwjpnfont" + .incbin "graphics/fonts/unused_frlg_female.fwjpnfont" .align 2 gUnusedJapaneseFireRedLeafGreenFemaleFontGlyphWidths:: @ 866C6E4 - .include "data/graphics/fonts/unused_japanese_frlg_female_font_widths.inc" + .include "graphics/fonts/unused_japanese_frlg_female_font_widths.inc" .align 2 gFont2JapaneseGlyphs:: @ 866C8E4 - .incbin "data/graphics/fonts/font2.fwjpnfont" + .incbin "graphics/fonts/font2.fwjpnfont" .align 2 gFont2JapaneseGlyphWidths:: @ 86748E4 - .include "data/graphics/fonts/font2_japanese_widths.inc" + .include "graphics/fonts/font2_japanese_widths.inc" diff --git a/gflib/text.c b/gflib/text.c index 7e4fa7104..f7d71bd00 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -45,10 +45,10 @@ const u8 gFontHalfRowOffsets[] = 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00 }; -const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4bpp"); -const u8 gDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS.4bpp"); -const u8 gUnusedFRLGBlankedDownArrow[] = INCBIN_U8("data/graphics/fonts/unused_frlg_blanked_down_arrow.4bpp"); -const u8 gUnusedFRLGDownArrow[] = INCBIN_U8("data/graphics/fonts/unused_frlg_down_arrow.4bpp"); +const u8 gDownArrowTiles[] = INCBIN_U8("graphics/fonts/down_arrow.4bpp"); +const u8 gDarkDownArrowTiles[] = INCBIN_U8("graphics/fonts/down_arrow_RS.4bpp"); +const u8 gUnusedFRLGBlankedDownArrow[] = INCBIN_U8("graphics/fonts/unused_frlg_blanked_down_arrow.4bpp"); +const u8 gUnusedFRLGDownArrow[] = INCBIN_U8("graphics/fonts/unused_frlg_down_arrow.4bpp"); const u8 gDownArrowYCoords[] = { 0x0, 0x1, 0x2, 0x1 }; const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2, 0x4, 0x0 }; @@ -82,7 +82,7 @@ const struct KeypadIcon gKeypadIcons[] = { 0x22, 0x8, 0xC } }; -const u8 gKeypadIconTiles[] = INCBIN_U8("data/graphics/fonts/keypad_icons.4bpp"); +const u8 gKeypadIconTiles[] = INCBIN_U8("graphics/fonts/keypad_icons.4bpp"); const struct FontInfo gFontInfos[] = { @@ -112,7 +112,7 @@ const u8 gMenuCursorDimensions[][2] = { 0x0, 0x0 } }; -const u16 gFont9JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font9.hwjpnfont"); +const u16 gFont9JapaneseGlyphs[] = INCBIN_U16("graphics/fonts/font9.hwjpnfont"); extern const u16 gFont8LatinGlyphs[]; extern const u8 gFont8LatinGlyphWidths[]; diff --git a/data/graphics/fonts/down_arrow.png b/graphics/fonts/down_arrow.png similarity index 100% rename from data/graphics/fonts/down_arrow.png rename to graphics/fonts/down_arrow.png diff --git a/data/graphics/fonts/down_arrow_RS.png b/graphics/fonts/down_arrow_RS.png similarity index 100% rename from data/graphics/fonts/down_arrow_RS.png rename to graphics/fonts/down_arrow_RS.png diff --git a/data/graphics/fonts/font0_japanese.png b/graphics/fonts/font0_japanese.png similarity index 100% rename from data/graphics/fonts/font0_japanese.png rename to graphics/fonts/font0_japanese.png diff --git a/data/graphics/fonts/font0_latin.png b/graphics/fonts/font0_latin.png similarity index 100% rename from data/graphics/fonts/font0_latin.png rename to graphics/fonts/font0_latin.png diff --git a/data/graphics/fonts/font0_latin_widths.inc b/graphics/fonts/font0_latin_widths.inc similarity index 100% rename from data/graphics/fonts/font0_latin_widths.inc rename to graphics/fonts/font0_latin_widths.inc diff --git a/data/graphics/fonts/font1_japanese.png b/graphics/fonts/font1_japanese.png similarity index 100% rename from data/graphics/fonts/font1_japanese.png rename to graphics/fonts/font1_japanese.png diff --git a/data/graphics/fonts/font1_latin.png b/graphics/fonts/font1_latin.png similarity index 100% rename from data/graphics/fonts/font1_latin.png rename to graphics/fonts/font1_latin.png diff --git a/data/graphics/fonts/font1_latin_widths.inc b/graphics/fonts/font1_latin_widths.inc similarity index 100% rename from data/graphics/fonts/font1_latin_widths.inc rename to graphics/fonts/font1_latin_widths.inc diff --git a/data/graphics/fonts/font2_japanese.png b/graphics/fonts/font2_japanese.png similarity index 100% rename from data/graphics/fonts/font2_japanese.png rename to graphics/fonts/font2_japanese.png diff --git a/data/graphics/fonts/font2_japanese_widths.inc b/graphics/fonts/font2_japanese_widths.inc similarity index 100% rename from data/graphics/fonts/font2_japanese_widths.inc rename to graphics/fonts/font2_japanese_widths.inc diff --git a/data/graphics/fonts/font2_latin.png b/graphics/fonts/font2_latin.png similarity index 100% rename from data/graphics/fonts/font2_latin.png rename to graphics/fonts/font2_latin.png diff --git a/data/graphics/fonts/font2_latin_widths.inc b/graphics/fonts/font2_latin_widths.inc similarity index 100% rename from data/graphics/fonts/font2_latin_widths.inc rename to graphics/fonts/font2_latin_widths.inc diff --git a/data/graphics/fonts/font6_braille.png b/graphics/fonts/font6_braille.png similarity index 100% rename from data/graphics/fonts/font6_braille.png rename to graphics/fonts/font6_braille.png diff --git a/data/graphics/fonts/font7_latin.png b/graphics/fonts/font7_latin.png similarity index 100% rename from data/graphics/fonts/font7_latin.png rename to graphics/fonts/font7_latin.png diff --git a/data/graphics/fonts/font7_latin_widths.inc b/graphics/fonts/font7_latin_widths.inc similarity index 100% rename from data/graphics/fonts/font7_latin_widths.inc rename to graphics/fonts/font7_latin_widths.inc diff --git a/data/graphics/fonts/font8_latin.png b/graphics/fonts/font8_latin.png similarity index 100% rename from data/graphics/fonts/font8_latin.png rename to graphics/fonts/font8_latin.png diff --git a/data/graphics/fonts/font8_latin_widths.inc b/graphics/fonts/font8_latin_widths.inc similarity index 100% rename from data/graphics/fonts/font8_latin_widths.inc rename to graphics/fonts/font8_latin_widths.inc diff --git a/data/graphics/fonts/font9_japanese.png b/graphics/fonts/font9_japanese.png similarity index 100% rename from data/graphics/fonts/font9_japanese.png rename to graphics/fonts/font9_japanese.png diff --git a/data/graphics/fonts/keypad_icons.png b/graphics/fonts/keypad_icons.png similarity index 100% rename from data/graphics/fonts/keypad_icons.png rename to graphics/fonts/keypad_icons.png diff --git a/data/graphics/fonts/unused_frlg_blanked_down_arrow.png b/graphics/fonts/unused_frlg_blanked_down_arrow.png similarity index 100% rename from data/graphics/fonts/unused_frlg_blanked_down_arrow.png rename to graphics/fonts/unused_frlg_blanked_down_arrow.png diff --git a/data/graphics/fonts/unused_frlg_down_arrow.png b/graphics/fonts/unused_frlg_down_arrow.png similarity index 100% rename from data/graphics/fonts/unused_frlg_down_arrow.png rename to graphics/fonts/unused_frlg_down_arrow.png diff --git a/data/graphics/fonts/unused_japanese_frlg_female_font.png b/graphics/fonts/unused_japanese_frlg_female_font.png similarity index 100% rename from data/graphics/fonts/unused_japanese_frlg_female_font.png rename to graphics/fonts/unused_japanese_frlg_female_font.png diff --git a/data/graphics/fonts/unused_japanese_frlg_female_font_widths.inc b/graphics/fonts/unused_japanese_frlg_female_font_widths.inc similarity index 100% rename from data/graphics/fonts/unused_japanese_frlg_female_font_widths.inc rename to graphics/fonts/unused_japanese_frlg_female_font_widths.inc diff --git a/data/graphics/fonts/unused_japanese_frlg_male_font.png b/graphics/fonts/unused_japanese_frlg_male_font.png similarity index 100% rename from data/graphics/fonts/unused_japanese_frlg_male_font.png rename to graphics/fonts/unused_japanese_frlg_male_font.png diff --git a/data/graphics/fonts/unused_japanese_frlg_male_font_widths.inc b/graphics/fonts/unused_japanese_frlg_male_font_widths.inc similarity index 100% rename from data/graphics/fonts/unused_japanese_frlg_male_font_widths.inc rename to graphics/fonts/unused_japanese_frlg_male_font_widths.inc diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index b36cdac60..0d6cc81b5 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -1,6 +1,6 @@ CASTFORMGFXDIR := graphics/pokemon/castform TILESETGFXDIR := data/tilesets -FONTGFXDIR := data/graphics/fonts +FONTGFXDIR := graphics/fonts INTERFACEGFXDIR := graphics/interface BTLANMSPRGFXDIR := graphics/battle_anims/sprites UNUSEDGFXDIR := graphics/unused diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ecc255278..cdffeaf7f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3031,16 +3031,16 @@ static void Cmd_seteffectwithchance(void) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN); - SetMoveEffect(0, MOVE_EFFECT_CERTAIN); + SetMoveEffect(FALSE, MOVE_EFFECT_CERTAIN); } else if (Random() % 100 < percentChance && gBattleScripting.moveEffect && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { if (percentChance >= 100) - SetMoveEffect(0, MOVE_EFFECT_CERTAIN); + SetMoveEffect(FALSE, MOVE_EFFECT_CERTAIN); else - SetMoveEffect(0, 0); + SetMoveEffect(FALSE, 0); } else { diff --git a/src/battle_util.c b/src/battle_util.c index 1b8ad6fcf..4a404eebd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1677,7 +1677,7 @@ u8 DoBattlerEndTurnEffects(void) if (!(gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)) { gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER; - SetMoveEffect(1, 0); + SetMoveEffect(TRUE, 0); if (gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION) BattleScriptExecute(BattleScript_ThrashConfuses); effect++; @@ -4521,7 +4521,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; BattleScriptPushCursor(); - SetMoveEffect(0, 0); + SetMoveEffect(FALSE, 0); BattleScriptPop(); } break; diff --git a/src/item_menu.c b/src/item_menu.c index 9621ff1a3..fe381516c 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -107,13 +107,13 @@ void Task_ActuallyToss(u8); void ItemMenu_Cancel(u8); void sub_81AD350(u8); void BagMenu_PrintItemCantBeHeld(u8); -void bag_menu_AddMoney_window(void); -void sub_81AD680(u8); +void DisplayCurrentMoneyWindow(void); +void DisplaySellItemPriceAndConfirm(u8); void sub_81AD730(u8); void sub_81AD6E4(u8); void bag_menu_remove_money_window(void); void bag_menu_RemoveBagItem_message_window(u8); -void sub_81AD794(u8); +void Task_BuyHowManyDialogueHandleInput(u8); void sub_81AD8C8(u8); void sub_81AD9C0(u8); void sub_81ADB14(u8); @@ -257,7 +257,7 @@ const struct YesNoFuncTable sYesNoSellItemFunctions = {BagMenu_ConfirmSell, BagM const struct ScrollArrowsTemplate gBagScrollArrowsTemplate = {SCROLL_ARROW_LEFT, 0x1C, 16, SCROLL_ARROW_RIGHT, 100, 16, -1, -1, 0x6F, 0x6F, 0}; -const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp"); +const u8 gRegisteredSelect_Gfx[] = INCBIN_U8("graphics/interface/select_button.4bpp"); static const u8 sFontColorTable[][3] = { // bgColor, textColor, shadowColor @@ -556,6 +556,8 @@ void vblank_cb_bag_menu(void) TransferPlttBuffer(); } +#define tItemCount data[8] + void CB2_Bag(void) { while(sub_81221EC() != TRUE && SetupBagMenu() != TRUE && sub_81221AC() != TRUE) {}; @@ -636,7 +638,7 @@ bool8 SetupBagMenu(void) taskId = sub_81AB1F0(gBagPositionStruct.location); gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]); gTasks[taskId].data[3] = 0; - gTasks[taskId].data[8] = 0; + gTasks[taskId].tItemCount = 0; gMain.state++; break; case 15: @@ -867,7 +869,7 @@ void PrintItemQuantityPlusGFX(u8 rboxId, s32 item_index_in_pocket, u8 a) else { if (gSaveBlock1Ptr->registeredItem && gSaveBlock1Ptr->registeredItem == itemId) - BlitBitmapToWindow(rboxId, gUnknown_086140A4, 0x60, a - 1, 0x18, 16); + BlitBitmapToWindow(rboxId, gRegisteredSelect_Gfx, 0x60, a - 1, 0x18, 16); } } } @@ -1662,7 +1664,7 @@ void ItemMenu_Toss(u8 taskId) s16* data = gTasks[taskId].data; BagMenu_RemoveSomeWindow(); - data[8] = 1; + tItemCount = 1; if (data[2] == 1) { BagMenu_TossItems(taskId); @@ -1683,7 +1685,7 @@ void BagMenu_TossItems(u8 taskId) s16* data = gTasks[taskId].data; CopyItemName(gSpecialVar_ItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems); FillWindowPixelBuffer(1, PIXEL_FILL(0)); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); @@ -1703,9 +1705,9 @@ void Task_ChooseHowManyToToss(u8 taskId) { s16* data = gTasks[taskId].data; - if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) + if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE) { - PrintItemDepositAmount(gBagMenu->unk817, data[8]); + PrintItemDepositAmount(gBagMenu->unk817, tItemCount); } else if (gMain.newKeys & A_BUTTON) { @@ -1726,7 +1728,7 @@ void BagMenu_ConfirmToss(u8 taskId) s16* data = gTasks[taskId].data; CopyItemName(gSpecialVar_ItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s); FillWindowPixelBuffer(1, PIXEL_FILL(0)); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); @@ -1742,7 +1744,7 @@ void Task_ActuallyToss(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { PlaySE(SE_SELECT); - RemoveBagItem(gSpecialVar_ItemId, data[8]); + RemoveBagItem(gSpecialVar_ItemId, tItemCount); DestroyListMenuTask(data[0], scrollPos, cursorPos); UpdatePocketItemList(gBagPositionStruct.pocket); SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket); @@ -1924,11 +1926,11 @@ void DisplaySellItemAskString(u8 taskId) } else { - data[8] = 1; + tItemCount = 1; if (data[2] == 1) { - bag_menu_AddMoney_window(); - sub_81AD680(taskId); + DisplayCurrentMoneyWindow(); + DisplaySellItemPriceAndConfirm(taskId); } else { @@ -1939,11 +1941,11 @@ void DisplaySellItemAskString(u8 taskId) } } -void sub_81AD680(u8 taskId) +void DisplaySellItemPriceAndConfirm(u8 taskId) { s16* data = gTasks[taskId].data; - ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8], STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1); DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD6E4); } @@ -1968,24 +1970,24 @@ void sub_81AD730(u8 taskId) s16* data = gTasks[taskId].data; u8 windowId = BagMenu_AddWindow(8); - PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]); - bag_menu_AddMoney_window(); - gTasks[taskId].func = sub_81AD794; + PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount); + DisplayCurrentMoneyWindow(); + gTasks[taskId].func = Task_BuyHowManyDialogueHandleInput; } -void sub_81AD794(u8 taskId) +void Task_BuyHowManyDialogueHandleInput(u8 taskId) { s16* data = gTasks[taskId].data; - if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) + if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE) { - PrintItemSoldAmount(gBagMenu->unk818, data[8], (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]); + PrintItemSoldAmount(gBagMenu->unk818, tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount); } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); BagMenu_RemoveWindow(8); - sub_81AD680(taskId); + DisplaySellItemPriceAndConfirm(taskId); } else if (gMain.newKeys & B_BUTTON) { @@ -2003,7 +2005,7 @@ void BagMenu_ConfirmSell(u8 taskId) s16* data = gTasks[taskId].data; CopyItemName(gSpecialVar_ItemId, gStringVar2); - ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8], STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2); DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD8C8); } @@ -2015,8 +2017,8 @@ void sub_81AD8C8(u8 taskId) u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]; PlaySE(SE_REGI); - RemoveBagItem(gSpecialVar_ItemId, data[8]); - AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]); + RemoveBagItem(gSpecialVar_ItemId, tItemCount); + AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount); DestroyListMenuTask(data[0], scrollPos, cursorPos); UpdatePocketItemList(gBagPositionStruct.pocket); SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket); @@ -2041,7 +2043,7 @@ void DisplayDepositItemAskString(u8 taskId) { s16* data = gTasks[taskId].data; - data[8] = 1; + tItemCount = 1; if (data[2] == 1) { sub_81ADB14(taskId); @@ -2061,9 +2063,9 @@ void sub_81ADA7C(u8 taskId) { s16* data = gTasks[taskId].data; - if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) + if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE) { - PrintItemDepositAmount(gBagMenu->unk817, data[8]); + PrintItemDepositAmount(gBagMenu->unk817, tItemCount); } else if (gMain.newKeys & A_BUTTON) { @@ -2091,10 +2093,10 @@ void sub_81ADB14(u8 taskId) BagMenu_Print(1, 1, gText_CantStoreImportantItems, 3, 1, 0, 0, 0, 0); gTasks[taskId].func = sub_81ADC0C; } - else if (AddPCItem(gSpecialVar_ItemId, data[8]) == TRUE) + else if (AddPCItem(gSpecialVar_ItemId, tItemCount) == TRUE) { CopyItemName(gSpecialVar_ItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); gTasks[taskId].func = Task_ActuallyToss; @@ -2201,6 +2203,8 @@ void Task_WallyTutorialBagMenu(u8 taskId) } } +#undef tItemCount + void unknown_ItemMenu_Show(u8 taskId) { gSpecialVar_0x8005 = gSpecialVar_ItemId; @@ -2302,6 +2306,7 @@ void BagMenu_Print(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 le AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, sFontColorTable[h], speed, str); } +//Unused u8 sub_81AE124(u8 a) { return gBagMenu->windowPointers[a]; @@ -2359,7 +2364,7 @@ void BagMenu_YesNo(u8 a, u8 b, const struct YesNoFuncTable *funcTable) CreateYesNoMenuWithCallbacks(a, &gUnknown_086141AC[b], 1, 0, 2, 1, 14, funcTable); } -void bag_menu_AddMoney_window(void) +void DisplayCurrentMoneyWindow(void) { u8 windowId = BagMenu_AddWindow(9); PrintMoneyAmountInMoneyBoxWithBorder(windowId, 1, 14, GetMoney(&gSaveBlock1Ptr->money)); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index c99841ea2..1660316de 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -36,6 +36,7 @@ #include "trig.h" #include "walda_phrase.h" #include "window.h" +#include "constants/items.h" #include "constants/maps.h" #include "constants/moves.h" #include "constants/rgb.h" @@ -231,7 +232,7 @@ struct PokemonStorageSystemData struct Sprite *field_D94; struct Sprite *field_D98[2]; u16 *field_DA0; - struct PokemonMarkMenu field_DA4; + struct PokemonMarkMenu markMenu; struct UnkPSSStruct_2002370 field_1E5C; struct Pokemon movingMon; struct Pokemon field_2108; @@ -367,7 +368,7 @@ enum { MODE_PARTY, MODE_BOX, - MODE_2, + MODE_MOVE, }; enum @@ -454,7 +455,7 @@ EWRAM_DATA static u8 sCurrentBoxOption = 0; EWRAM_DATA static u8 gUnknown_02039D0E = 0; EWRAM_DATA static u8 sWhichToReshow = 0; EWRAM_DATA static u8 sLastUsedBox = 0; -EWRAM_DATA static u16 gUnknown_02039D12 = 0; +EWRAM_DATA static u16 sMovingItemId = 0; EWRAM_DATA static struct Pokemon gUnknown_02039D14 = {0}; EWRAM_DATA static s8 sBoxCursorArea = 0; EWRAM_DATA static s8 sBoxCursorPosition = 0; @@ -2165,7 +2166,7 @@ static void Cb2_EnterPSS(u8 boxOption) { sPSSData->boxOption = boxOption; sPSSData->isReshowingPSS = FALSE; - gUnknown_02039D12 = 0; + sMovingItemId = ITEM_NONE; sPSSData->state = 0; sPSSData->taskId = CreateTask(Cb_InitPSS, 3); sLastUsedBox = StorageGetCurrentBox(); @@ -2227,7 +2228,7 @@ static void sub_80C7F1C(void) gUnknown_02039D0E = 0; } -static void sub_80C7F4C(void) +static void SetMonIconTransparency(void) { if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { @@ -2321,9 +2322,9 @@ static void Cb_InitPSS(u8 taskId) if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - sPSSData->field_DA4.baseTileTag = TAG_TILE_D; - sPSSData->field_DA4.basePaletteTag = TAG_PAL_DACE; - sub_811F90C(&sPSSData->field_DA4); + sPSSData->markMenu.baseTileTag = TAG_TILE_D; + sPSSData->markMenu.basePaletteTag = TAG_PAL_DACE; + sub_811F90C(&sPSSData->markMenu); sub_811FA90(); } else @@ -2333,7 +2334,7 @@ static void Cb_InitPSS(u8 taskId) } break; case 10: - sub_80C7F4C(); + SetMonIconTransparency(); if (!sPSSData->isReshowingPSS) { BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); @@ -3178,7 +3179,7 @@ static void Cb_ShowMarkMenu(u8 taskId) { case 0: PrintStorageActionText(PC_TEXT_MARK_POKE); - sPSSData->field_DA4.markings = sPSSData->cursorMonMarkings; + sPSSData->markMenu.markings = sPSSData->cursorMonMarkings; sub_811FAA4(sPSSData->cursorMonMarkings, 0xb0, 0x10); sPSSData->state++; break; @@ -3187,7 +3188,7 @@ static void Cb_ShowMarkMenu(u8 taskId) { sub_811FAF8(); ClearBottomWindow(); - SetMonMarkings(sPSSData->field_DA4.markings); + SetMonMarkings(sPSSData->markMenu.markings); RefreshCursorMonData(); SetPSSCallback(Cb_MainPSS); } @@ -3863,9 +3864,9 @@ static void Cb_ChangeScreen(u8 taskId) u8 screenChangeType = sPSSData->screenChangeType; if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE) - gUnknown_02039D12 = GetMovingItem(); + sMovingItemId = GetMovingItem(); else - gUnknown_02039D12 = 0; + sMovingItemId = ITEM_NONE; switch (screenChangeType) { @@ -4496,9 +4497,9 @@ static void sub_80CAEAC(void) sub_80D0D8C(CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); } - if (gUnknown_02039D12 != 0) + if (sMovingItemId != ITEM_NONE) { - sub_80D0F38(gUnknown_02039D12); + sub_80D0F38(sMovingItemId); sub_80CFE54(3); } } @@ -5077,7 +5078,7 @@ static void sub_80CBF14(u8 mode, u8 position) case MODE_BOX: sPSSData->field_B04 = &sPSSData->boxMonsSprites[position]; break; - case MODE_2: + case MODE_MOVE: sPSSData->field_B04 = &sPSSData->movingMonSprite; break; default: @@ -6388,7 +6389,7 @@ static void sub_80CE250(void) u8 mode; if (sIsMonBeingMoved) - mode = MODE_2; + mode = MODE_MOVE; else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) mode = MODE_PARTY; else @@ -6756,7 +6757,7 @@ static void sub_80CEB40(void) // fallthrough case CURSOR_AREA_BUTTONS: case CURSOR_AREA_BOX: - SetCursorMonData(NULL, MODE_2); + SetCursorMonData(NULL, MODE_MOVE); break; case CURSOR_AREA_IN_BOX: SetCursorMonData(GetBoxedMonPtr(StorageGetCurrentBox(), sBoxCursorPosition), MODE_BOX); diff --git a/src/unk_text_util_2.c b/src/unk_text_util_2.c index 02648bf93..b1d2264e4 100644 --- a/src/unk_text_util_2.c +++ b/src/unk_text_util_2.c @@ -6,7 +6,7 @@ ALIGNED(4) static const u8 sUnknown_08616124[] = {1, 2, 4}; -static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("data/graphics/fonts/font6.fwjpnfont"); +static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("graphics/fonts/font6.fwjpnfont"); static void DecompressGlyphFont6(u16);