Merge with master

This commit is contained in:
DizzyEggg 2020-03-13 23:02:17 +01:00
commit cf4d5f6e59
35 changed files with 90 additions and 83 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
*.gba *.gba
*.sgm *.sgm
*.sa1 *.sa1
*.ss[0-9]
*.sg1 *.sg1
*.1bpp *.1bpp
*.4bpp *.4bpp

View File

@ -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. 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 echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc
export DEVKITARM=$DEVKITPRO/devkitARM export DEVKITARM=$DEVKITPRO/devkitARM
echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc

View File

@ -5,72 +5,72 @@
.align 2 .align 2
gFont8LatinGlyphs:: @ 862BAE4 gFont8LatinGlyphs:: @ 862BAE4
.incbin "data/graphics/fonts/font8.latfont" .incbin "graphics/fonts/font8.latfont"
.align 2 .align 2
gFont8LatinGlyphWidths:: @ 8633AE4 gFont8LatinGlyphWidths:: @ 8633AE4
.include "data/graphics/fonts/font8_latin_widths.inc" .include "graphics/fonts/font8_latin_widths.inc"
.align 2 .align 2
gFont0LatinGlyphs:: @ 8633CE4 gFont0LatinGlyphs:: @ 8633CE4
.incbin "data/graphics/fonts/font0.latfont" .incbin "graphics/fonts/font0.latfont"
.align 2 .align 2
gFont0LatinGlyphWidths:: @ 863BCE4 gFont0LatinGlyphWidths:: @ 863BCE4
.include "data/graphics/fonts/font0_latin_widths.inc" .include "graphics/fonts/font0_latin_widths.inc"
.align 2 .align 2
gFont7LatinGlyphs:: @ 863BEE4 gFont7LatinGlyphs:: @ 863BEE4
.incbin "data/graphics/fonts/font7.latfont" .incbin "graphics/fonts/font7.latfont"
.align 2 .align 2
gFont7LatinGlyphWidths:: @ 8643EE4 gFont7LatinGlyphWidths:: @ 8643EE4
.include "data/graphics/fonts/font7_latin_widths.inc" .include "graphics/fonts/font7_latin_widths.inc"
.align 2 .align 2
gFont2LatinGlyphs:: @ 86440E4 gFont2LatinGlyphs:: @ 86440E4
.incbin "data/graphics/fonts/font2.latfont" .incbin "graphics/fonts/font2.latfont"
.align 2 .align 2
gFont2LatinGlyphWidths:: @ 864C0E4 gFont2LatinGlyphWidths:: @ 864C0E4
.include "data/graphics/fonts/font2_latin_widths.inc" .include "graphics/fonts/font2_latin_widths.inc"
.align 2 .align 2
gFont1LatinGlyphs:: @ 864C2E4 gFont1LatinGlyphs:: @ 864C2E4
.incbin "data/graphics/fonts/font1.latfont" .incbin "graphics/fonts/font1.latfont"
.align 2 .align 2
gFont1LatinGlyphWidths:: @ 86542E4 gFont1LatinGlyphWidths:: @ 86542E4
.include "data/graphics/fonts/font1_latin_widths.inc" .include "graphics/fonts/font1_latin_widths.inc"
.align 2 .align 2
gFont0JapaneseGlyphs:: @ 86544E4 gFont0JapaneseGlyphs:: @ 86544E4
.incbin "data/graphics/fonts/font0.hwjpnfont" .incbin "graphics/fonts/font0.hwjpnfont"
.align 2 .align 2
gFont1JapaneseGlyphs:: @ 86584E4 gFont1JapaneseGlyphs:: @ 86584E4
.incbin "data/graphics/fonts/font1.hwjpnfont" .incbin "graphics/fonts/font1.hwjpnfont"
.align 2 .align 2
gUnusedJapaneseFireRedLeafGreenMaleFontGlyphs:: @ 865C4E4 gUnusedJapaneseFireRedLeafGreenMaleFontGlyphs:: @ 865C4E4
.incbin "data/graphics/fonts/unused_frlg_male.fwjpnfont" .incbin "graphics/fonts/unused_frlg_male.fwjpnfont"
.align 2 .align 2
gUnusedJapaneseFireRedLeafGreenMaleFontGlyphWidths:: @ 86644E4 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 .align 2
gUnusedJapaneseFireRedLeafGreenFemaleFontGlyphs:: @ 86646E4 gUnusedJapaneseFireRedLeafGreenFemaleFontGlyphs:: @ 86646E4
.incbin "data/graphics/fonts/unused_frlg_female.fwjpnfont" .incbin "graphics/fonts/unused_frlg_female.fwjpnfont"
.align 2 .align 2
gUnusedJapaneseFireRedLeafGreenFemaleFontGlyphWidths:: @ 866C6E4 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 .align 2
gFont2JapaneseGlyphs:: @ 866C8E4 gFont2JapaneseGlyphs:: @ 866C8E4
.incbin "data/graphics/fonts/font2.fwjpnfont" .incbin "graphics/fonts/font2.fwjpnfont"
.align 2 .align 2
gFont2JapaneseGlyphWidths:: @ 86748E4 gFont2JapaneseGlyphWidths:: @ 86748E4
.include "data/graphics/fonts/font2_japanese_widths.inc" .include "graphics/fonts/font2_japanese_widths.inc"

View File

@ -45,10 +45,10 @@ const u8 gFontHalfRowOffsets[] =
0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00 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 gDownArrowTiles[] = INCBIN_U8("graphics/fonts/down_arrow.4bpp");
const u8 gDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS.4bpp"); const u8 gDarkDownArrowTiles[] = INCBIN_U8("graphics/fonts/down_arrow_RS.4bpp");
const u8 gUnusedFRLGBlankedDownArrow[] = INCBIN_U8("data/graphics/fonts/unused_frlg_blanked_down_arrow.4bpp"); const u8 gUnusedFRLGBlankedDownArrow[] = INCBIN_U8("graphics/fonts/unused_frlg_blanked_down_arrow.4bpp");
const u8 gUnusedFRLGDownArrow[] = INCBIN_U8("data/graphics/fonts/unused_frlg_down_arrow.4bpp"); const u8 gUnusedFRLGDownArrow[] = INCBIN_U8("graphics/fonts/unused_frlg_down_arrow.4bpp");
const u8 gDownArrowYCoords[] = { 0x0, 0x1, 0x2, 0x1 }; const u8 gDownArrowYCoords[] = { 0x0, 0x1, 0x2, 0x1 };
const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2, 0x4, 0x0 }; const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2, 0x4, 0x0 };
@ -82,7 +82,7 @@ const struct KeypadIcon gKeypadIcons[] =
{ 0x22, 0x8, 0xC } { 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[] = const struct FontInfo gFontInfos[] =
{ {
@ -112,7 +112,7 @@ const u8 gMenuCursorDimensions[][2] =
{ 0x0, 0x0 } { 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 u16 gFont8LatinGlyphs[];
extern const u8 gFont8LatinGlyphWidths[]; extern const u8 gFont8LatinGlyphWidths[];

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 297 B

View File

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -1,6 +1,6 @@
CASTFORMGFXDIR := graphics/pokemon/castform CASTFORMGFXDIR := graphics/pokemon/castform
TILESETGFXDIR := data/tilesets TILESETGFXDIR := data/tilesets
FONTGFXDIR := data/graphics/fonts FONTGFXDIR := graphics/fonts
INTERFACEGFXDIR := graphics/interface INTERFACEGFXDIR := graphics/interface
BTLANMSPRGFXDIR := graphics/battle_anims/sprites BTLANMSPRGFXDIR := graphics/battle_anims/sprites
UNUSEDGFXDIR := graphics/unused UNUSEDGFXDIR := graphics/unused

View File

@ -3031,16 +3031,16 @@ static void Cmd_seteffectwithchance(void)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
{ {
gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN); gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN);
SetMoveEffect(0, MOVE_EFFECT_CERTAIN); SetMoveEffect(FALSE, MOVE_EFFECT_CERTAIN);
} }
else if (Random() % 100 < percentChance else if (Random() % 100 < percentChance
&& gBattleScripting.moveEffect && gBattleScripting.moveEffect
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
{ {
if (percentChance >= 100) if (percentChance >= 100)
SetMoveEffect(0, MOVE_EFFECT_CERTAIN); SetMoveEffect(FALSE, MOVE_EFFECT_CERTAIN);
else else
SetMoveEffect(0, 0); SetMoveEffect(FALSE, 0);
} }
else else
{ {

View File

@ -1677,7 +1677,7 @@ u8 DoBattlerEndTurnEffects(void)
if (!(gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)) if (!(gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION))
{ {
gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER; gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER;
SetMoveEffect(1, 0); SetMoveEffect(TRUE, 0);
if (gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION) if (gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
BattleScriptExecute(BattleScript_ThrashConfuses); BattleScriptExecute(BattleScript_ThrashConfuses);
effect++; effect++;
@ -4521,7 +4521,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{ {
gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH;
BattleScriptPushCursor(); BattleScriptPushCursor();
SetMoveEffect(0, 0); SetMoveEffect(FALSE, 0);
BattleScriptPop(); BattleScriptPop();
} }
break; break;

View File

@ -107,13 +107,13 @@ void Task_ActuallyToss(u8);
void ItemMenu_Cancel(u8); void ItemMenu_Cancel(u8);
void sub_81AD350(u8); void sub_81AD350(u8);
void BagMenu_PrintItemCantBeHeld(u8); void BagMenu_PrintItemCantBeHeld(u8);
void bag_menu_AddMoney_window(void); void DisplayCurrentMoneyWindow(void);
void sub_81AD680(u8); void DisplaySellItemPriceAndConfirm(u8);
void sub_81AD730(u8); void sub_81AD730(u8);
void sub_81AD6E4(u8); void sub_81AD6E4(u8);
void bag_menu_remove_money_window(void); void bag_menu_remove_money_window(void);
void bag_menu_RemoveBagItem_message_window(u8); void bag_menu_RemoveBagItem_message_window(u8);
void sub_81AD794(u8); void Task_BuyHowManyDialogueHandleInput(u8);
void sub_81AD8C8(u8); void sub_81AD8C8(u8);
void sub_81AD9C0(u8); void sub_81AD9C0(u8);
void sub_81ADB14(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 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] = { static const u8 sFontColorTable[][3] = {
// bgColor, textColor, shadowColor // bgColor, textColor, shadowColor
@ -556,6 +556,8 @@ void vblank_cb_bag_menu(void)
TransferPlttBuffer(); TransferPlttBuffer();
} }
#define tItemCount data[8]
void CB2_Bag(void) void CB2_Bag(void)
{ {
while(sub_81221EC() != TRUE && SetupBagMenu() != TRUE && sub_81221AC() != TRUE) {}; while(sub_81221EC() != TRUE && SetupBagMenu() != TRUE && sub_81221AC() != TRUE) {};
@ -636,7 +638,7 @@ bool8 SetupBagMenu(void)
taskId = sub_81AB1F0(gBagPositionStruct.location); taskId = sub_81AB1F0(gBagPositionStruct.location);
gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]); gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
gTasks[taskId].data[3] = 0; gTasks[taskId].data[3] = 0;
gTasks[taskId].data[8] = 0; gTasks[taskId].tItemCount = 0;
gMain.state++; gMain.state++;
break; break;
case 15: case 15:
@ -867,7 +869,7 @@ void PrintItemQuantityPlusGFX(u8 rboxId, s32 item_index_in_pocket, u8 a)
else else
{ {
if (gSaveBlock1Ptr->registeredItem && gSaveBlock1Ptr->registeredItem == itemId) 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; s16* data = gTasks[taskId].data;
BagMenu_RemoveSomeWindow(); BagMenu_RemoveSomeWindow();
data[8] = 1; tItemCount = 1;
if (data[2] == 1) if (data[2] == 1)
{ {
BagMenu_TossItems(taskId); BagMenu_TossItems(taskId);
@ -1683,7 +1685,7 @@ void BagMenu_TossItems(u8 taskId)
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar1); 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); StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems);
FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(1, PIXEL_FILL(0));
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 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; 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) else if (gMain.newKeys & A_BUTTON)
{ {
@ -1726,7 +1728,7 @@ void BagMenu_ConfirmToss(u8 taskId)
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar1); 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); StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s);
FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(1, PIXEL_FILL(0));
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 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)) if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
RemoveBagItem(gSpecialVar_ItemId, data[8]); RemoveBagItem(gSpecialVar_ItemId, tItemCount);
DestroyListMenuTask(data[0], scrollPos, cursorPos); DestroyListMenuTask(data[0], scrollPos, cursorPos);
UpdatePocketItemList(gBagPositionStruct.pocket); UpdatePocketItemList(gBagPositionStruct.pocket);
SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket); SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket);
@ -1924,11 +1926,11 @@ void DisplaySellItemAskString(u8 taskId)
} }
else else
{ {
data[8] = 1; tItemCount = 1;
if (data[2] == 1) if (data[2] == 1)
{ {
bag_menu_AddMoney_window(); DisplayCurrentMoneyWindow();
sub_81AD680(taskId); DisplaySellItemPriceAndConfirm(taskId);
} }
else else
{ {
@ -1939,11 +1941,11 @@ void DisplaySellItemAskString(u8 taskId)
} }
} }
void sub_81AD680(u8 taskId) void DisplaySellItemPriceAndConfirm(u8 taskId)
{ {
s16* data = gTasks[taskId].data; 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); StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1);
DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD6E4); DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD6E4);
} }
@ -1968,24 +1970,24 @@ void sub_81AD730(u8 taskId)
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
u8 windowId = BagMenu_AddWindow(8); u8 windowId = BagMenu_AddWindow(8);
PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]); PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
bag_menu_AddMoney_window(); DisplayCurrentMoneyWindow();
gTasks[taskId].func = sub_81AD794; gTasks[taskId].func = Task_BuyHowManyDialogueHandleInput;
} }
void sub_81AD794(u8 taskId) void Task_BuyHowManyDialogueHandleInput(u8 taskId)
{ {
s16* data = gTasks[taskId].data; 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) else if (gMain.newKeys & A_BUTTON)
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
BagMenu_RemoveWindow(8); BagMenu_RemoveWindow(8);
sub_81AD680(taskId); DisplaySellItemPriceAndConfirm(taskId);
} }
else if (gMain.newKeys & B_BUTTON) else if (gMain.newKeys & B_BUTTON)
{ {
@ -2003,7 +2005,7 @@ void BagMenu_ConfirmSell(u8 taskId)
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar2); 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); StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2);
DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD8C8); DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD8C8);
} }
@ -2015,8 +2017,8 @@ void sub_81AD8C8(u8 taskId)
u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]; u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket];
PlaySE(SE_REGI); PlaySE(SE_REGI);
RemoveBagItem(gSpecialVar_ItemId, data[8]); RemoveBagItem(gSpecialVar_ItemId, tItemCount);
AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]); AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
DestroyListMenuTask(data[0], scrollPos, cursorPos); DestroyListMenuTask(data[0], scrollPos, cursorPos);
UpdatePocketItemList(gBagPositionStruct.pocket); UpdatePocketItemList(gBagPositionStruct.pocket);
SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket); SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket);
@ -2041,7 +2043,7 @@ void DisplayDepositItemAskString(u8 taskId)
{ {
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
data[8] = 1; tItemCount = 1;
if (data[2] == 1) if (data[2] == 1)
{ {
sub_81ADB14(taskId); sub_81ADB14(taskId);
@ -2061,9 +2063,9 @@ void sub_81ADA7C(u8 taskId)
{ {
s16* data = gTasks[taskId].data; 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) 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); BagMenu_Print(1, 1, gText_CantStoreImportantItems, 3, 1, 0, 0, 0, 0);
gTasks[taskId].func = sub_81ADC0C; gTasks[taskId].func = sub_81ADC0C;
} }
else if (AddPCItem(gSpecialVar_ItemId, data[8]) == TRUE) else if (AddPCItem(gSpecialVar_ItemId, tItemCount) == TRUE)
{ {
CopyItemName(gSpecialVar_ItemId, gStringVar1); 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); StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s);
BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
gTasks[taskId].func = Task_ActuallyToss; gTasks[taskId].func = Task_ActuallyToss;
@ -2201,6 +2203,8 @@ void Task_WallyTutorialBagMenu(u8 taskId)
} }
} }
#undef tItemCount
void unknown_ItemMenu_Show(u8 taskId) void unknown_ItemMenu_Show(u8 taskId)
{ {
gSpecialVar_0x8005 = gSpecialVar_ItemId; 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); AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, sFontColorTable[h], speed, str);
} }
//Unused
u8 sub_81AE124(u8 a) u8 sub_81AE124(u8 a)
{ {
return gBagMenu->windowPointers[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); 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); u8 windowId = BagMenu_AddWindow(9);
PrintMoneyAmountInMoneyBoxWithBorder(windowId, 1, 14, GetMoney(&gSaveBlock1Ptr->money)); PrintMoneyAmountInMoneyBoxWithBorder(windowId, 1, 14, GetMoney(&gSaveBlock1Ptr->money));

View File

@ -36,6 +36,7 @@
#include "trig.h" #include "trig.h"
#include "walda_phrase.h" #include "walda_phrase.h"
#include "window.h" #include "window.h"
#include "constants/items.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/moves.h" #include "constants/moves.h"
#include "constants/rgb.h" #include "constants/rgb.h"
@ -231,7 +232,7 @@ struct PokemonStorageSystemData
struct Sprite *field_D94; struct Sprite *field_D94;
struct Sprite *field_D98[2]; struct Sprite *field_D98[2];
u16 *field_DA0; u16 *field_DA0;
struct PokemonMarkMenu field_DA4; struct PokemonMarkMenu markMenu;
struct UnkPSSStruct_2002370 field_1E5C; struct UnkPSSStruct_2002370 field_1E5C;
struct Pokemon movingMon; struct Pokemon movingMon;
struct Pokemon field_2108; struct Pokemon field_2108;
@ -367,7 +368,7 @@ enum
{ {
MODE_PARTY, MODE_PARTY,
MODE_BOX, MODE_BOX,
MODE_2, MODE_MOVE,
}; };
enum enum
@ -454,7 +455,7 @@ EWRAM_DATA static u8 sCurrentBoxOption = 0;
EWRAM_DATA static u8 gUnknown_02039D0E = 0; EWRAM_DATA static u8 gUnknown_02039D0E = 0;
EWRAM_DATA static u8 sWhichToReshow = 0; EWRAM_DATA static u8 sWhichToReshow = 0;
EWRAM_DATA static u8 sLastUsedBox = 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 struct Pokemon gUnknown_02039D14 = {0};
EWRAM_DATA static s8 sBoxCursorArea = 0; EWRAM_DATA static s8 sBoxCursorArea = 0;
EWRAM_DATA static s8 sBoxCursorPosition = 0; EWRAM_DATA static s8 sBoxCursorPosition = 0;
@ -2165,7 +2166,7 @@ static void Cb2_EnterPSS(u8 boxOption)
{ {
sPSSData->boxOption = boxOption; sPSSData->boxOption = boxOption;
sPSSData->isReshowingPSS = FALSE; sPSSData->isReshowingPSS = FALSE;
gUnknown_02039D12 = 0; sMovingItemId = ITEM_NONE;
sPSSData->state = 0; sPSSData->state = 0;
sPSSData->taskId = CreateTask(Cb_InitPSS, 3); sPSSData->taskId = CreateTask(Cb_InitPSS, 3);
sLastUsedBox = StorageGetCurrentBox(); sLastUsedBox = StorageGetCurrentBox();
@ -2227,7 +2228,7 @@ static void sub_80C7F1C(void)
gUnknown_02039D0E = 0; gUnknown_02039D0E = 0;
} }
static void sub_80C7F4C(void) static void SetMonIconTransparency(void)
{ {
if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS)
{ {
@ -2321,9 +2322,9 @@ static void Cb_InitPSS(u8 taskId)
if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS)
{ {
sPSSData->field_DA4.baseTileTag = TAG_TILE_D; sPSSData->markMenu.baseTileTag = TAG_TILE_D;
sPSSData->field_DA4.basePaletteTag = TAG_PAL_DACE; sPSSData->markMenu.basePaletteTag = TAG_PAL_DACE;
sub_811F90C(&sPSSData->field_DA4); sub_811F90C(&sPSSData->markMenu);
sub_811FA90(); sub_811FA90();
} }
else else
@ -2333,7 +2334,7 @@ static void Cb_InitPSS(u8 taskId)
} }
break; break;
case 10: case 10:
sub_80C7F4C(); SetMonIconTransparency();
if (!sPSSData->isReshowingPSS) if (!sPSSData->isReshowingPSS)
{ {
BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK);
@ -3178,7 +3179,7 @@ static void Cb_ShowMarkMenu(u8 taskId)
{ {
case 0: case 0:
PrintStorageActionText(PC_TEXT_MARK_POKE); PrintStorageActionText(PC_TEXT_MARK_POKE);
sPSSData->field_DA4.markings = sPSSData->cursorMonMarkings; sPSSData->markMenu.markings = sPSSData->cursorMonMarkings;
sub_811FAA4(sPSSData->cursorMonMarkings, 0xb0, 0x10); sub_811FAA4(sPSSData->cursorMonMarkings, 0xb0, 0x10);
sPSSData->state++; sPSSData->state++;
break; break;
@ -3187,7 +3188,7 @@ static void Cb_ShowMarkMenu(u8 taskId)
{ {
sub_811FAF8(); sub_811FAF8();
ClearBottomWindow(); ClearBottomWindow();
SetMonMarkings(sPSSData->field_DA4.markings); SetMonMarkings(sPSSData->markMenu.markings);
RefreshCursorMonData(); RefreshCursorMonData();
SetPSSCallback(Cb_MainPSS); SetPSSCallback(Cb_MainPSS);
} }
@ -3863,9 +3864,9 @@ static void Cb_ChangeScreen(u8 taskId)
u8 screenChangeType = sPSSData->screenChangeType; u8 screenChangeType = sPSSData->screenChangeType;
if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE) if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE)
gUnknown_02039D12 = GetMovingItem(); sMovingItemId = GetMovingItem();
else else
gUnknown_02039D12 = 0; sMovingItemId = ITEM_NONE;
switch (screenChangeType) switch (screenChangeType)
{ {
@ -4496,9 +4497,9 @@ static void sub_80CAEAC(void)
sub_80D0D8C(CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); 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); sub_80CFE54(3);
} }
} }
@ -5077,7 +5078,7 @@ static void sub_80CBF14(u8 mode, u8 position)
case MODE_BOX: case MODE_BOX:
sPSSData->field_B04 = &sPSSData->boxMonsSprites[position]; sPSSData->field_B04 = &sPSSData->boxMonsSprites[position];
break; break;
case MODE_2: case MODE_MOVE:
sPSSData->field_B04 = &sPSSData->movingMonSprite; sPSSData->field_B04 = &sPSSData->movingMonSprite;
break; break;
default: default:
@ -6388,7 +6389,7 @@ static void sub_80CE250(void)
u8 mode; u8 mode;
if (sIsMonBeingMoved) if (sIsMonBeingMoved)
mode = MODE_2; mode = MODE_MOVE;
else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY)
mode = MODE_PARTY; mode = MODE_PARTY;
else else
@ -6756,7 +6757,7 @@ static void sub_80CEB40(void)
// fallthrough // fallthrough
case CURSOR_AREA_BUTTONS: case CURSOR_AREA_BUTTONS:
case CURSOR_AREA_BOX: case CURSOR_AREA_BOX:
SetCursorMonData(NULL, MODE_2); SetCursorMonData(NULL, MODE_MOVE);
break; break;
case CURSOR_AREA_IN_BOX: case CURSOR_AREA_IN_BOX:
SetCursorMonData(GetBoxedMonPtr(StorageGetCurrentBox(), sBoxCursorPosition), MODE_BOX); SetCursorMonData(GetBoxedMonPtr(StorageGetCurrentBox(), sBoxCursorPosition), MODE_BOX);

View File

@ -6,7 +6,7 @@
ALIGNED(4) ALIGNED(4)
static const u8 sUnknown_08616124[] = {1, 2, 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); static void DecompressGlyphFont6(u16);