summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2017-06-14 22:01:02 -0400
committerGitHub <noreply@github.com>2017-06-14 22:01:02 -0400
commit817f20d2275d29a2d1976fa2e1281a15b0c45630 (patch)
tree91ee5276494ed423b3c3cd1344a9d0444a418dee /src
parentdaf3212ee1f2e790441c6c4651559c8aee5472b2 (diff)
parent07080a6e5921f7844decac66ac36e2a5296ff778 (diff)
Merge pull request #320 from ProjectRevoTPP/master
finish decompiling player_pc.c
Diffstat (limited to 'src')
-rw-r--r--src/battle_2.c8
-rw-r--r--src/battle_interface.c4
-rw-r--r--src/battle_party_menu.c2
-rw-r--r--src/birch_pc.c105
-rw-r--r--src/credits.c2
-rwxr-xr-xsrc/decoration.c20
-rw-r--r--src/easy_chat.c2
-rw-r--r--src/main_menu.c8
-rw-r--r--src/menu.c18
-rw-r--r--src/menu_cursor.c4
-rw-r--r--src/party_menu.c4
-rw-r--r--src/player_pc.c1121
-rw-r--r--src/pokedex.c22
-rw-r--r--src/script_menu.c4
-rw-r--r--src/script_pokemon_util_80C4BF0.c16
-rw-r--r--src/shop.c2
-rw-r--r--src/start_menu.c2
-rw-r--r--src/strings.c2
-rw-r--r--src/tv.c4
-rw-r--r--src/wallclock.c2
20 files changed, 931 insertions, 421 deletions
diff --git a/src/battle_2.c b/src/battle_2.c
index 498fcec31..c147bdb95 100644
--- a/src/battle_2.c
+++ b/src/battle_2.c
@@ -238,7 +238,7 @@ extern void dp01_build_cmdbuf_x2E_a(u8 a, u8 b);
extern void dp01_build_cmdbuf_x2F_2F_2F_2F(u8 a);
extern void dp01_build_cmdbuf_x30_TODO(u8 a, u8 *b, u8 c);
extern void dp01_battle_side_mark_buffer_for_execution();
-extern u8 sub_8090D90();
+extern u8 GetNationalPokedexFlag();
extern void sub_800C704(u8, u8, u8);
extern u8 sub_8018324();
extern u8 sub_801A02C();
@@ -2021,14 +2021,14 @@ void sub_8011384(void)
}
if (battle_side_get_owner(gUnknown_02024A60) == 1
&& !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_LINK)))
- sub_8090D90(SpeciesToNationalPokedexNum(gBattleMons[gUnknown_02024A60].species), 2);
+ GetNationalPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gUnknown_02024A60].species), 2);
}
else
{
if (battle_side_get_owner(gUnknown_02024A60) == 1
&& !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_LINK)))
{
- sub_8090D90(SpeciesToNationalPokedexNum(gBattleMons[gUnknown_02024A60].species), 2);
+ GetNationalPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gUnknown_02024A60].species), 2);
dp01_build_cmdbuf_x04_4_4_4(0);
dp01_battle_side_mark_buffer_for_execution(gUnknown_02024A60);
}
@@ -2183,7 +2183,7 @@ void bc_801362C(void)
{
if (battle_side_get_owner(gUnknown_02024A60) == 1
&& !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_LINK)))
- sub_8090D90(SpeciesToNationalPokedexNum(gBattleMons[gUnknown_02024A60].species), 2);
+ GetNationalPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gUnknown_02024A60].species), 2);
}
gUnknown_030042D4 = sub_8011970;
}
diff --git a/src/battle_interface.c b/src/battle_interface.c
index 0fd9462cc..c5d07e8e9 100644
--- a/src/battle_interface.c
+++ b/src/battle_interface.c
@@ -9,6 +9,7 @@
#include "songs.h"
#include "battle.h"
#include "palette.h"
+#include "pokedex.h"
#include "battle_interface.h"
struct UnknownStruct5
@@ -84,7 +85,6 @@ extern const u16 gBattleInterfaceStatusIcons_DynPal[];
#define MACRO1(n) ((n) - (n) / 8 * 8) + 64 * ((n) / 8)
extern int sub_8040D3C();
-extern u8 sub_8090D90();
extern void load_gfxc_health_bar();
static void sub_8043D5C(struct Sprite *);
@@ -2506,7 +2506,7 @@ static void sub_8045458(u8 a, u8 b)
if (battle_side_get_owner(r4) != 0)
{
u16 species = GetMonData(&gEnemyParty[gUnknown_02024A6A[r4]], MON_DATA_SPECIES);
- if (sub_8090D90(SpeciesToNationalPokedexNum(species), 1) != 0)
+ if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(species), 1) != 0)
{
r4 = gSprites[a].data5;
if (b != 0)
diff --git a/src/battle_party_menu.c b/src/battle_party_menu.c
index 359517ecd..514ef9ca7 100644
--- a/src/battle_party_menu.c
+++ b/src/battle_party_menu.c
@@ -467,7 +467,7 @@ static void Task_BattlePartyMenuShift(u8 taskId)
static void Task_BattlePartyMenuCancel(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
sub_806E7D0(gTasks[taskId].data[4], sBattlePartyPopupMenus);
gTasks[taskId].data[4] = gTasks[taskId].data[5];
sub_806D538(0, 0);
diff --git a/src/birch_pc.c b/src/birch_pc.c
index 89eafc0ce..f01107b3d 100644
--- a/src/birch_pc.c
+++ b/src/birch_pc.c
@@ -9,31 +9,31 @@ extern u16 gSpecialVar_0x8004;
extern u16 gSpecialVar_0x8005;
extern u16 gSpecialVar_0x8006;
-extern const u8 gUnknown_081C4520[];
-extern const u8 gUnknown_081C456A[];
-extern const u8 gUnknown_081C45B0[];
-extern const u8 gUnknown_081C45F9[];
-extern const u8 gUnknown_081C4648[];
-extern const u8 gUnknown_081C467E[];
-extern const u8 gUnknown_081C46B9[];
-extern const u8 gUnknown_081C46FE[];
-extern const u8 gUnknown_081C4747[];
-extern const u8 gUnknown_081C4780[];
-extern const u8 gUnknown_081C47DF[];
-extern const u8 gUnknown_081C4828[];
-extern const u8 gUnknown_081C4863[];
-extern const u8 gUnknown_081C489C[];
-extern const u8 gUnknown_081C48EB[];
-extern const u8 gUnknown_081C4936[];
-extern const u8 gUnknown_081C49A2[];
-extern const u8 gUnknown_081C4A06[];
-extern const u8 gUnknown_081C4A4F[];
-extern const u8 gUnknown_081C4A91[];
-extern const u8 gUnknown_081C4ADA[];
+extern const u8 gBirchDexRatingText_LessThan10[];
+extern const u8 gBirchDexRatingText_LessThan20[];
+extern const u8 gBirchDexRatingText_LessThan30[];
+extern const u8 gBirchDexRatingText_LessThan40[];
+extern const u8 gBirchDexRatingText_LessThan50[];
+extern const u8 gBirchDexRatingText_LessThan60[];
+extern const u8 gBirchDexRatingText_LessThan70[];
+extern const u8 gBirchDexRatingText_LessThan80[];
+extern const u8 gBirchDexRatingText_LessThan90[];
+extern const u8 gBirchDexRatingText_LessThan100[];
+extern const u8 gBirchDexRatingText_LessThan110[];
+extern const u8 gBirchDexRatingText_LessThan120[];
+extern const u8 gBirchDexRatingText_LessThan130[];
+extern const u8 gBirchDexRatingText_LessThan140[];
+extern const u8 gBirchDexRatingText_LessThan150[];
+extern const u8 gBirchDexRatingText_LessThan160[];
+extern const u8 gBirchDexRatingText_LessThan170[];
+extern const u8 gBirchDexRatingText_LessThan180[];
+extern const u8 gBirchDexRatingText_LessThan190[];
+extern const u8 gBirchDexRatingText_LessThan200[];
+extern const u8 gBirchDexRatingText_DexCompleted[];
bool16 ScriptGetPokedexInfo(void)
{
- if (!gSpecialVar_0x8004)
+ if (gSpecialVar_0x8004 == 0) // is national dex not present?
{
gSpecialVar_0x8005 = GetHoennPokedexCount(0);
gSpecialVar_0x8006 = GetHoennPokedexCount(1);
@@ -47,65 +47,66 @@ bool16 ScriptGetPokedexInfo(void)
return IsNationalPokedexEnabled();
}
+// This shows your Hoenn Pokedex rating and not your National Dex.
const u8 *GetPokedexRatingText(u16 count)
{
if (count < 10)
- return gUnknown_081C4520;
+ return gBirchDexRatingText_LessThan10;
if (count < 20)
- return gUnknown_081C456A;
+ return gBirchDexRatingText_LessThan20;
if (count < 30)
- return gUnknown_081C45B0;
+ return gBirchDexRatingText_LessThan30;
if (count < 40)
- return gUnknown_081C45F9;
+ return gBirchDexRatingText_LessThan40;
if (count < 50)
- return gUnknown_081C4648;
+ return gBirchDexRatingText_LessThan50;
if (count < 60)
- return gUnknown_081C467E;
+ return gBirchDexRatingText_LessThan60;
if (count < 70)
- return gUnknown_081C46B9;
+ return gBirchDexRatingText_LessThan70;
if (count < 80)
- return gUnknown_081C46FE;
+ return gBirchDexRatingText_LessThan80;
if (count < 90)
- return gUnknown_081C4747;
+ return gBirchDexRatingText_LessThan90;
if (count < 100)
- return gUnknown_081C4780;
+ return gBirchDexRatingText_LessThan100;
if (count < 110)
- return gUnknown_081C47DF;
+ return gBirchDexRatingText_LessThan110;
if (count < 120)
- return gUnknown_081C4828;
+ return gBirchDexRatingText_LessThan120;
if (count < 130)
- return gUnknown_081C4863;
+ return gBirchDexRatingText_LessThan130;
if (count < 140)
- return gUnknown_081C489C;
+ return gBirchDexRatingText_LessThan140;
if (count < 150)
- return gUnknown_081C48EB;
+ return gBirchDexRatingText_LessThan150;
if (count < 160)
- return gUnknown_081C4936;
+ return gBirchDexRatingText_LessThan160;
if (count < 170)
- return gUnknown_081C49A2;
+ return gBirchDexRatingText_LessThan170;
if (count < 180)
- return gUnknown_081C4A06;
+ return gBirchDexRatingText_LessThan180;
if (count < 190)
- return gUnknown_081C4A4F;
+ return gBirchDexRatingText_LessThan190;
if (count < 200)
- return gUnknown_081C4A91;
+ return gBirchDexRatingText_LessThan200;
if (count == 200)
{
- if (sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
- || sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1))
- return gUnknown_081C4A91;
- return gUnknown_081C4ADA;
+ if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
+ || GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200.
+ return gBirchDexRatingText_LessThan200;
+ return gBirchDexRatingText_DexCompleted;
}
if (count == 201)
{
- if (sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
- && sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1))
- return gUnknown_081C4A91;
- return gUnknown_081C4ADA;
+ if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
+ && GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200.
+ return gBirchDexRatingText_LessThan200;
+ return gBirchDexRatingText_DexCompleted;
}
if (count == 202)
- return gUnknown_081C4ADA;
- return gUnknown_081C4520;
+ return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210.
+ return gBirchDexRatingText_LessThan10;
}
void ShowPokedexRatingMessage(void)
diff --git a/src/credits.c b/src/credits.c
index 5af2d1e3c..c8de577fc 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -1585,7 +1585,7 @@ static void sub_81458DC(void) {
for (dexNum = 1, seenTypesCount = 0; dexNum < 386; dexNum++)
{
- if (sub_8090D90(dexNum, 1))
+ if (GetNationalPokedexFlag(dexNum, 1))
{
unk201C000->unk90[seenTypesCount] = dexNum;
seenTypesCount++;
diff --git a/src/decoration.c b/src/decoration.c
index a2b0dcd31..d33931206 100755
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -1616,7 +1616,7 @@ void sub_80FE394(void)
void gpu_pal_decompress_alloc_tag_and_upload(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 10, 9);
MenuFillWindowRectWithBlankTile(2, 15, 27, 18);
FreeSpritePaletteByTag(6);
@@ -1683,7 +1683,7 @@ void sub_80FE528(u8 taskId) // PrintDecorationCategorySelectionMenuStrings
void sub_80FE5AC(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 29, 19);
sub_80FE528(taskId);
InitMenu(0, 1, 1, 9, gUnknown_020388F6, 13);
@@ -1720,7 +1720,7 @@ void sub_80FE604(u8 taskId)
gTasks[taskId].func = sub_80FE868;
} else
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 14, 19);
DisplayItemMessageOnField(taskId, gSecretBaseText_NoDecors, sub_80FE418, 0);
}
@@ -1749,7 +1749,7 @@ void sub_80FE728(u8 taskId)
void sub_80FE758(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 14, 19);
if (gTasks[taskId].data[11] != 2)
{
@@ -1777,7 +1777,7 @@ void sub_80FE7D4(u8 *dest, u8 decClass)
void sub_80FE7EC(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 29, 19);
sub_80FEC94(taskId);
@@ -1850,7 +1850,7 @@ void sub_80FE948(u8 taskId)
}
if (gMain.newKeys & A_BUTTON)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
gUnknown_020388F5 = gUnknown_020388F2 + gUnknown_020388F4;
if (gUnknown_020388F5 == gUnknown_020388D5)
@@ -1862,7 +1862,7 @@ void sub_80FE948(u8 taskId)
}
} else if (gMain.newKeys & B_BUTTON)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
gUnknown_083EC634[gTasks[taskId].data[11]].func2(taskId);
}
@@ -2050,7 +2050,7 @@ void sub_80FEF74(void)
sub_80F9520(gUnknown_020388F7, 8);
DestroyVerticalScrollIndicator(0);
DestroyVerticalScrollIndicator(1);
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 14, 19);
}
@@ -2080,7 +2080,7 @@ void sub_80FEFF4(u8 taskId)
void sub_80FF034(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 14, 19);
sub_80FE5AC(taskId);
}
@@ -3705,7 +3705,7 @@ void sub_8100E70(u8 taskId)
data[2] = 1;
data[6] = 1;
data[5] = 1;
- sub_8072DEC();
+ HandleDestroyMenuCursors();
}
break;
case 1:
diff --git a/src/easy_chat.c b/src/easy_chat.c
index b0168d3bc..e43ba751f 100644
--- a/src/easy_chat.c
+++ b/src/easy_chat.c
@@ -471,7 +471,7 @@ static u16 sub_80EB9D8(void) {
{
const u16 dexNum = SpeciesToNationalPokedexNum(*speciesList);
- const u8 local2 = sub_8090D90(dexNum, 0);
+ const u8 local2 = GetNationalPokedexFlag(dexNum, 0);
if (local2)
{
diff --git a/src/main_menu.c b/src/main_menu.c
index b2d08698b..ac26d604d 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -945,14 +945,14 @@ static void Task_NewGameSpeech16(u8 taskId)
switch (GenderMenuProcessInput())
{
case MALE:
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
gSaveBlock2.playerGender = MALE;
MenuZeroFillWindowRect(2, 4, 8, 9);
gTasks[taskId].func = Task_NewGameSpeech19;
break;
case FEMALE:
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
gSaveBlock2.playerGender = FEMALE;
MenuZeroFillWindowRect(2, 4, 8, 9);
@@ -1048,7 +1048,7 @@ static void Task_NewGameSpeech21(u8 taskId)
case 2:
case 3:
case 4:
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
MenuZeroFillWindowRect(2, 1, 22, 12);
SetPresetPlayerName(selection);
@@ -1060,7 +1060,7 @@ static void Task_NewGameSpeech21(u8 taskId)
gTasks[taskId].func = Task_NewGameSpeech22;
break;
case -1: //B button
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
MenuZeroFillWindowRect(2, 1, 22, 12);
gTasks[taskId].func = Task_NewGameSpeech14; //Go back to gender menu
diff --git a/src/menu.c b/src/menu.c
index 3acac88a0..0d5c0b7d2 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -54,7 +54,7 @@ void CloseMenu(void)
MenuZeroFillScreen();
sub_8064E2C();
ScriptContext2_Disable();
- sub_8072DEC();
+ HandleDestroyMenuCursors();
}
void AppendToList(u8 *list, u8 *pindex, u32 value)
@@ -270,14 +270,14 @@ s8 ProcessMenuInput(void)
{
PlaySE(SE_SELECT);
if (gMenu.menu_field_7)
- sub_8072DEC();
+ HandleDestroyMenuCursors();
return gMenu.cursorPos;
}
if (gMain.newKeys & B_BUTTON)
{
if (gMenu.menu_field_7)
- sub_8072DEC();
+ HandleDestroyMenuCursors();
return -1;
}
@@ -305,14 +305,14 @@ s8 ProcessMenuInputNoWrap(void)
{
PlaySE(SE_SELECT);
if (gMenu.menu_field_7)
- sub_8072DEC();
+ HandleDestroyMenuCursors();
return gMenu.cursorPos;
}
if (gMain.newKeys & B_BUTTON)
{
if (gMenu.menu_field_7)
- sub_8072DEC();
+ HandleDestroyMenuCursors();
return -1;
}
@@ -517,7 +517,7 @@ s8 sub_80727CC(void)
if (gMain.newKeys & A_BUTTON)
{
if (gMenu.menu_field_7)
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
return GetMenuCursorPos();
}
@@ -525,7 +525,7 @@ s8 sub_80727CC(void)
if (gMain.newKeys & B_BUTTON)
{
if (gMenu.menu_field_7)
- sub_8072DEC();
+ HandleDestroyMenuCursors();
return -1;
}
@@ -731,7 +731,7 @@ void sub_8072DDC(u8 a1)
sub_8072DCC(8 * a1);
}
-void sub_8072DEC(void)
+void HandleDestroyMenuCursors(void)
{
- sub_814A7FC();
+ DestroyMenuCursor();
}
diff --git a/src/menu_cursor.c b/src/menu_cursor.c
index fa28332df..cfb38ca47 100644
--- a/src/menu_cursor.c
+++ b/src/menu_cursor.c
@@ -45,7 +45,7 @@ u8 sub_814A5C0(u8 a1, u16 a2, u8 a3, u16 a4, u8 a5)
struct Sprite *v10;
if (gUnknown_0203A3D0 != 0x40 || gUnknown_0203A3D1 != 0x40)
- sub_814A7FC();
+ DestroyMenuCursor();
v9 = 1;
if (a2 == 0xFFFF)
@@ -120,7 +120,7 @@ u8 unref_sub_814A7AC(u8 a1, u16 a2, u8 a3)
return sub_814A758(a1, val1, val2, a3);
}
-void sub_814A7FC(void)
+void DestroyMenuCursor(void)
{
if (gUnknown_0203A3D0 != 0x40)
{
diff --git a/src/party_menu.c b/src/party_menu.c
index ee6bcf2a9..b08180645 100644
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -1286,7 +1286,7 @@ void DoPPRecoveryItemEffect(u8 taskId, u16 b, TaskFunc c)
void ItemUseMoveMenu_HandleMoveSelection(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(19, 10, 29, 19);
sub_806D5A4();
gTasks[taskId].data[11] = GetMenuCursorPos();
@@ -1295,7 +1295,7 @@ void ItemUseMoveMenu_HandleMoveSelection(u8 taskId)
void ItemUseMoveMenu_HandleCancel(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(19, 10, 29, 19);
if (gMain.inBattle)
gTasks[ewram1C000.unk4].func = SetUpBattlePokemonMenu;
diff --git a/src/player_pc.c b/src/player_pc.c
index c012afb02..f39d812b6 100644
--- a/src/player_pc.c
+++ b/src/player_pc.c
@@ -12,75 +12,156 @@
#include "string_util.h"
#include "strings.h"
#include "task.h"
+#include "songs.h"
+#include "name_string_util.h"
+#include "mail.h"
+#include "rom4.h"
+
+// task defines
+#define PAGE_INDEX data[0]
+#define ITEMS_ABOVE_TOP data[1]
+#define NUM_ITEMS data[2]
+#define NUM_QUANTITY_ROLLER data[3]
+#define NUM_PAGE_ITEMS data[4]
+// not used
+#define CURRENT_ITEM_STORAGE_MENU data[6]
+// not used
+#define SWAP_ITEM_INDEX data[8]
+#define SWITCH_MODE_ACTIVE data[9]
#define NEW_GAME_PC_ITEMS(i, type) ((u16)(gNewGamePCItems + type)[i * 2])
-// type as in define above
+// defined and used in the above macro
enum
{
ITEM_ID,
- QUANTITY,
+ QUANTITY
};
+// player PC menu options
+enum
+{
+ PLAYERPC_MENU_ITEMSTORAGE,
+ PLAYERPC_MENU_MAILBOX,
+ PLAYERPC_MENU_DECORATION,
+ PLAYERPC_MENU_TURNOFF
+};
+
+// item storage menus
+enum
+{
+ ITEMPC_MENU_WITHDRAW,
+ ITEMPC_MENU_DEPOSIT,
+ ITEMPC_MENU_TOSS,
+ ITEMPC_MENU_EXIT
+};
+
+// special item description handlers
+enum
+{
+ ITEMPC_SWITCH_WHICH_ITEM = 0xFFF7,
+ ITEMPC_OKAY_TO_THROW_AWAY,
+ ITEMPC_TOO_IMPORTANT,
+ ITEMPC_NO_MORE_ROOM,
+ ITEMPC_THREW_AWAY_ITEM,
+ ITEMPC_HOW_MANY_TO_TOSS,
+ ITEMPC_WITHDREW_THING,
+ ITEMPC_HOW_MANY_TO_WITHDRAW,
+ ITEMPC_GO_BACK_TO_PREV
+};
+
+struct MailboxStruct
+{
+ /*0x00*/ u8 cursorPos;
+ /*0x01*/ u8 pageItems; // number of items (not including Cancel) on the current page.
+ /*0x02*/ u8 itemsAbove; // number of items above the top item on the page.
+ /*0x03*/ u8 count; // total number of items in mailbox storage.
+};
+
+extern struct MailboxStruct gMailboxInfo;
+
extern void DisplayItemMessageOnField(u8, const u8*, TaskFunc, u16);
extern void DoPlayerPCDecoration(u8);
extern void BuyMenuFreeMemory(void);
extern void DestroyVerticalScrollIndicator(u8);
-extern u8 sub_813AF3C(void);
-extern void sub_813AF78(void);
-extern void sub_813B108(u8);
-extern void sub_813B174(u8);
extern void sub_80A6A30(void);
extern u8 sub_807D770(void);
-extern void sub_813AE6C(u8, u8);
-extern void sub_813AD58(u16);
-extern void sub_813AE0C(u8);
extern void sub_80F996C(u8);
extern void sub_80A418C(u16, enum StringConvertMode, int, int, int);
extern void sub_80F98DC(int);
extern void sub_80A4164(u8 *, u16, enum StringConvertMode, u8);
extern void CreateVerticalScrollIndicators(u32, u32, u32); // unknown args
+extern void sub_80F944C(void);
+extern void LoadScrollIndicatorPalette(void);
+extern void ClearMailStruct(struct MailStruct *);
+extern void sub_808B020(void);
extern u16 gNewGamePCItems[];
+extern u16 gUnknown_08406334[3];
-extern u8 *gUnknown_02039314;
-extern struct MenuAction gUnknown_08406298[];
+extern u8 *gPcItemMenuOptionOrder;
+extern struct MenuAction gPCText_PlayerPCOptionsText[];
-extern u8 gUnknown_084062B8[];
-extern u8 gUnknown_084062BC[];
+extern u8 gBedroomPC_OptionOrder[];
+extern u8 gPlayerPC_OptionOrder[];
extern u8 gUnknown_0840632A[];
extern u8 gUnknown_08406327[];
extern u8 gUnknown_08406330[];
extern u8 gUnknown_0840631E[];
extern u8 gUnknown_08406318[];
+extern u8 gUnknown_0840633A[];
-extern u8 gUnknown_030007B4;
-extern u8 unk_201FE00[];
+extern u8 gPcItemMenuOptionsNum;
+extern u8 gUnknown_02038561;
extern u8 gUnknown_08152850;
extern u8 gUnknown_08152C75;
-extern u32 gUnknown_08406288[];
-extern const struct MenuAction gUnknown_084062C0[];
+extern void (*gUnknown_0300485C)(void);
+
+extern u32 gPCText_OptionDescList[];
+extern const struct MenuAction gPCText_ItemPCOptionsText[];
+extern const struct MenuAction gUnknown_084062F8[];
extern const struct YesNoFuncTable gUnknown_084062E0;
+extern const struct YesNoFuncTable gUnknown_084062E8;
void InitPlayerPCMenu(u8 taskId);
void PlayerPCProcessMenuInput(u8 taskId);
void InitItemStorageMenu(u8);
void ItemStorageMenuPrint(u8 *);
void ItemStorageMenuProcessInput(u8);
-void sub_813A280(u8);
-void sub_813A240(u8);
-void sub_813A4B4(u8);
-void sub_813A468(u8);
-void HandleQuantityRolling(u8);
-void sub_813A6FC(u8);
-void sub_813A794(u8);
-void sub_813A8F0(u8);
-void sub_813A984(u8);
-void sub_813A9EC(u8);
-void sub_813AA30(u8, u8);
-void sub_813ABE8(u8);
+void ItemStorage_ProcessInput(u8);
+void ItemStorage_SetItemAndMailCount(u8);
+void ItemStorage_DoItemAction(u8);
+void ItemStorage_GoBackToPlayerPCMenu(u8);
+void ItemStorage_HandleQuantityRolling(u8);
+void ItemStorage_DoItemWithdraw(u8);
+void ItemStorage_DoItemToss(u8);
+void ItemStorage_HandleRemoveItem(u8);
+void ItemStorage_WaitPressHandleResumeProcessInput(u8);
+void ItemStorage_HandleResumeProcessInput(u8);
+void ItemStorage_DoItemSwap(u8, bool8);
+void ItemStorage_DrawItemList(u8);
+void ItemStorage_PrintItemPcResponse(u16);
+void ItemStorage_DrawBothListAndDescription(u8);
+void ItemStorage_GoBackToItemPCMenu(u8, u8);
+void ItemStorage_LoadPalette(void);
+u8 GetMailboxMailCount(void);
+void Mailbox_UpdateMailList(void);
+void Mailbox_DrawMailboxMenu(u8);
+void Mailbox_ProcessInput(u8);
+void sub_813B27C(void);
+void sub_813B294(u8);
+void sub_813B320(u8);
+void sub_813B348(u8);
+void sub_813B3A0(u8);
+void sub_813B454(u8);
+void sub_813B4F0(void);
+void sub_813B554(u8);
+void sub_813B66C(u8);
+void sub_813B718(u8);
+void Mailbox_Cancel(u8);
+void sub_813B758(u8);
void NewGameInitPCItems(void)
{
@@ -94,55 +175,49 @@ void NewGameInitPCItems(void)
void BedroomPC(void)
{
- u8 taskId;
-
- gUnknown_02039314 = gUnknown_084062B8;
- gUnknown_030007B4 = 4;
- taskId = CreateTask(TaskDummy, 0);
- DisplayItemMessageOnField(taskId, gOtherText_WhatWillYouDo, InitPlayerPCMenu, 0);
+ gPcItemMenuOptionOrder = gBedroomPC_OptionOrder;
+ gPcItemMenuOptionsNum = 4;
+ DisplayItemMessageOnField(CreateTask(TaskDummy, 0), gOtherText_WhatWillYouDo, InitPlayerPCMenu, 0);
}
void PlayerPC(void)
{
- u8 taskId;
-
- gUnknown_02039314 = gUnknown_084062BC;
- gUnknown_030007B4 = 3;
- taskId = CreateTask(TaskDummy, 0);
- DisplayItemMessageOnField(taskId, gOtherText_WhatWillYouDo, InitPlayerPCMenu, 0);
+ gPcItemMenuOptionOrder = gPlayerPC_OptionOrder;
+ gPcItemMenuOptionsNum = 3;
+ DisplayItemMessageOnField(CreateTask(TaskDummy, 0), gOtherText_WhatWillYouDo, InitPlayerPCMenu, 0);
}
void InitPlayerPCMenu(u8 taskId)
{
- MenuDrawTextWindow(0, 0, 10, gUnknown_030007B4 * 2 + 1);
- PrintMenuItemsReordered(1, 1, gUnknown_030007B4, gUnknown_08406298, gUnknown_02039314);
- InitMenu(0, 1, 1, gUnknown_030007B4, 0, 9);
+ MenuDrawTextWindow(0, 0, 10, gPcItemMenuOptionsNum * 2 + 1);
+ PrintMenuItemsReordered(1, 1, gPcItemMenuOptionsNum, gPCText_PlayerPCOptionsText, gPcItemMenuOptionOrder);
+ InitMenu(0, 1, 1, gPcItemMenuOptionsNum, 0, 9);
gTasks[taskId].func = PlayerPCProcessMenuInput;
}
void PlayerPCProcessMenuInput(u8 taskId)
{
- if (gMain.newAndRepeatedKeys & 0x40)
+ if (gMain.newAndRepeatedKeys & DPAD_UP)
{
- PlaySE(5);
+ PlaySE(SE_SELECT);
MoveMenuCursor(-1);
}
- else if (gMain.newAndRepeatedKeys & 0x80)
+ else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
{
- PlaySE(5);
+ PlaySE(SE_SELECT);
MoveMenuCursor(1);
}
- else if (gMain.newKeys & 0x1)
+ else if (gMain.newKeys & A_BUTTON)
{
- sub_8072DEC();
- PlaySE(5);
- gUnknown_08406298[gUnknown_02039314[GetMenuCursorPos()]].func(taskId);
+ HandleDestroyMenuCursors();
+ PlaySE(SE_SELECT);
+ gPCText_PlayerPCOptionsText[gPcItemMenuOptionOrder[GetMenuCursorPos()]].func(taskId);
}
- else if (gMain.newKeys & 0x2)
+ else if (gMain.newKeys & B_BUTTON)
{
- sub_8072DEC();
- PlaySE(5);
- gUnknown_08406298[gUnknown_030007B4[gUnknown_02039314 - 1]].func(taskId);
+ HandleDestroyMenuCursors();
+ PlaySE(SE_SELECT);
+ gPCText_PlayerPCOptionsText[gPcItemMenuOptionsNum[gPcItemMenuOptionOrder - 1]].func(taskId); // run EXIT.
}
}
@@ -160,17 +235,18 @@ void PlayerPC_ItemStorage(u8 taskId)
void PlayerPC_Mailbox(u8 taskId)
{
MenuZeroFillWindowRect(0, 0, 10, 9);
- unk_201FE00[3] = sub_813AF3C();
- if (!unk_201FE00[3])
+ gMailboxInfo.count = GetMailboxMailCount();
+
+ if (gMailboxInfo.count == 0)
DisplayItemMessageOnField(taskId, gOtherText_NoMailHere, ReshowPlayerPC, 0);
else
{
- unk_201FE00[0] = 0;
- unk_201FE00[2] = 0;
- sub_813AF78();
- sub_813A240(taskId);
- sub_813B108(taskId);
- gTasks[taskId].func = sub_813B174;
+ gMailboxInfo.cursorPos = 0;
+ gMailboxInfo.itemsAbove = 0;
+ Mailbox_UpdateMailList();
+ ItemStorage_SetItemAndMailCount(taskId);
+ Mailbox_DrawMailboxMenu(taskId);
+ gTasks[taskId].func = Mailbox_ProcessInput;
}
}
@@ -182,13 +258,14 @@ void PlayerPC_Decoration(u8 var)
void PlayerPC_TurnOff(u8 taskId)
{
- if (gUnknown_030007B4 == 4)
+ if (gPcItemMenuOptionsNum == 4) // if the option count is 4, we are at the bedroom PC and not player PC, so do gender specific handling.
{
MenuZeroFillWindowRect(0, 0, 0x1D, 0x13);
- if (!gSaveBlock2.playerGender)
- ScriptContext1_SetupScript(&gUnknown_08152850); // male
+
+ if (gSaveBlock2.playerGender == MALE)
+ ScriptContext1_SetupScript(&gUnknown_08152850);
else
- ScriptContext1_SetupScript(&gUnknown_08152C75); // female
+ ScriptContext1_SetupScript(&gUnknown_08152C75);
}
else
{
@@ -202,9 +279,9 @@ void InitItemStorageMenu(u8 var)
{
MenuZeroFillWindowRect(0, 0, 10, 9);
MenuDrawTextWindow(0, 0, 11, 9);
- PrintMenuItems(1, 1, 4, gUnknown_084062C0);
+ PrintMenuItems(1, 1, 4, gPCText_ItemPCOptionsText);
InitMenu(0, 1, 1, 4, var, 10);
- ItemStorageMenuPrint((u8 *)gUnknown_08406288[var]);
+ ItemStorageMenuPrint((u8 *)gPCText_OptionDescList[var]);
}
void ItemStorageMenuPrint(u8 *textPtr)
@@ -215,28 +292,28 @@ void ItemStorageMenuPrint(u8 *textPtr)
void ItemStorageMenuProcessInput(u8 var)
{
- if (gMain.newAndRepeatedKeys & 0x40)
+ if (gMain.newAndRepeatedKeys & DPAD_UP)
{
- PlaySE(5);
+ PlaySE(SE_SELECT);
MoveMenuCursor(-1);
- ItemStorageMenuPrint((u8 *)gUnknown_08406288[GetMenuCursorPos()]);
+ ItemStorageMenuPrint((u8 *)gPCText_OptionDescList[GetMenuCursorPos()]);
}
- else if (gMain.newAndRepeatedKeys & 0x80)
+ else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
{
- PlaySE(5);
+ PlaySE(SE_SELECT);
MoveMenuCursor(1);
- ItemStorageMenuPrint((u8 *)gUnknown_08406288[GetMenuCursorPos()]);
+ ItemStorageMenuPrint((u8 *)gPCText_OptionDescList[GetMenuCursorPos()]);
}
- else if (gMain.newKeys & 0x1)
+ else if (gMain.newKeys & A_BUTTON)
{
- PlaySE(5);
- gUnknown_084062C0[GetMenuCursorPos()].func(var);
+ PlaySE(SE_SELECT);
+ gPCText_ItemPCOptionsText[GetMenuCursorPos()].func(var);
}
- else if (gMain.newKeys & 0x2)
+ else if (gMain.newKeys & B_BUTTON)
{
- sub_8072DEC();
- PlaySE(5);
- gUnknown_084062C0[3].func(var);
+ HandleDestroyMenuCursors();
+ PlaySE(SE_SELECT);
+ gPCText_ItemPCOptionsText[ITEMPC_MENU_EXIT].func(var);
}
}
@@ -271,23 +348,21 @@ void sub_813A0F8(void)
void ItemStorage_Withdraw(u8 taskId)
{
- u8 var;
- u16 * data = gTasks[taskId].data;
+ s16 *data = gTasks[taskId].data;
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 11, 9);
- var = CountUsedPCItemSlots();
- data[2] = var;
+ NUM_ITEMS = CountUsedPCItemSlots();
- if (var)
+ if (NUM_ITEMS != 0)
{
MenuZeroFillWindowRect(0, 14, 29, 19);
- data[6] = 0;
- data[0] = 0;
- data[1] = 0;
- sub_813A240(taskId);
- sub_813AE6C(taskId, 0);
- gTasks[taskId].func = sub_813A280;
+ CURRENT_ITEM_STORAGE_MENU = ITEMPC_MENU_WITHDRAW;
+ PAGE_INDEX = 0;
+ ITEMS_ABOVE_TOP = 0;
+ ItemStorage_SetItemAndMailCount(taskId);
+ ItemStorage_GoBackToItemPCMenu(taskId, 0);
+ gTasks[taskId].func = ItemStorage_ProcessInput;
}
else
DisplayItemMessageOnField(taskId, gOtherText_NoItems, PlayerPC_ItemStorage, 0);
@@ -295,23 +370,21 @@ void ItemStorage_Withdraw(u8 taskId)
void ItemStorage_Toss(u8 taskId)
{
- u8 var;
- u16 * data = gTasks[taskId].data;
+ s16 *data = gTasks[taskId].data;
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 11, 9);
- var = CountUsedPCItemSlots();
- data[2] = var;
+ NUM_ITEMS = CountUsedPCItemSlots();
- if (var)
+ if (NUM_ITEMS)
{
MenuZeroFillWindowRect(0, 14, 29, 19);
- data[6] = 2;
- data[0] = 0;
- data[1] = 0;
- sub_813A240(taskId);
- sub_813AE6C(taskId, 2);
- gTasks[taskId].func = sub_813A280;
+ CURRENT_ITEM_STORAGE_MENU = ITEMPC_MENU_TOSS;
+ PAGE_INDEX = 0;
+ ITEMS_ABOVE_TOP = 0;
+ ItemStorage_SetItemAndMailCount(taskId);
+ ItemStorage_GoBackToItemPCMenu(taskId, 2);
+ gTasks[taskId].func = ItemStorage_ProcessInput;
}
else
DisplayItemMessageOnField(taskId, gOtherText_NoItems, PlayerPC_ItemStorage, 0);
@@ -319,477 +392,478 @@ void ItemStorage_Toss(u8 taskId)
void ItemStorage_Exit(u8 var)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 11, 9);
ReshowPlayerPC(var);
}
-void sub_813A240(u8 taskId)
+void ItemStorage_SetItemAndMailCount(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- if (data[2] > 7)
- data[4] = 8;
+ if (NUM_ITEMS > 7) // we have a full page, so set the num of page items appropriately.
+ NUM_PAGE_ITEMS = 8;
else
- data[4] = data[2] + 1;
+ NUM_PAGE_ITEMS = NUM_ITEMS + 1; // there are not enough items to fill a full page; take the # of items and add 1 for the cancel button.
- if (unk_201FE00[3] > 7)
- unk_201FE00[1] = 8;
+ if (gMailboxInfo.count > 7)
+ gMailboxInfo.pageItems = 8;
else
- unk_201FE00[1] = unk_201FE00[3] + 1;
+ gMailboxInfo.pageItems = gMailboxInfo.count + 1;
}
-void sub_813A280(u8 taskId)
+void ItemStorage_ProcessInput(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- s16 var;
+ s16 trueIndex;
if (gMain.newAndRepeatedKeys & DPAD_UP)
{
- if(data[0])
+ if(PAGE_INDEX != 0) // did the cursor move physically upwards?
{
- PlaySE(5);
- data[0] = MoveMenuCursor(-1);
- var = data[1] + data[0];
- if (!data[9])
+ PlaySE(SE_SELECT);
+ PAGE_INDEX = MoveMenuCursor(-1);
+ trueIndex = ITEMS_ABOVE_TOP + PAGE_INDEX;
+ if (SWITCH_MODE_ACTIVE == FALSE) // are we not currently switching items?
{
- if (var == data[2])
+ if (trueIndex == NUM_ITEMS) // if the cursor is on top of cancel, print the go back to prev description.
{
- sub_813AD58(0xFFFF);
+ ItemStorage_PrintItemPcResponse(ITEMPC_GO_BACK_TO_PREV);
}
else
{
- sub_813AD58(gSaveBlock1.pcItems[var].itemId);
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[trueIndex].itemId);
}
}
}
- else // _0813A2E4
+ else // the page cursor is at the top. but we may not be at the top of the true index list, so do another check.
{
- if (!data[1])
+ if (ITEMS_ABOVE_TOP == 0) // did the cursor not move due to being at the top of the list?
return;
- PlaySE(5);
- data[1]--;
- sub_813AE0C(taskId);
- // probably further down
- if (data[9])
- MoveMenuCursor(0);
+
+ PlaySE(SE_SELECT);
+ ITEMS_ABOVE_TOP--;
+ ItemStorage_DrawBothListAndDescription(taskId);
+
+ if (SWITCH_MODE_ACTIVE != FALSE)
+ MoveMenuCursor(0); // don't move the cursor. it's at the top of the page index, but not the true index.
}
}
else if(gMain.newAndRepeatedKeys & DPAD_DOWN) // _0813A306
{
- if(data[0] != data[4] - 1)
+ if(PAGE_INDEX != NUM_PAGE_ITEMS - 1)
{
- PlaySE(5);
- data[0] = MoveMenuCursor(1);
- var = data[1] + data[0];
+ PlaySE(SE_SELECT);
+ PAGE_INDEX = MoveMenuCursor(1);
+ trueIndex = ITEMS_ABOVE_TOP + PAGE_INDEX;
- if(data[9])
+ if(SWITCH_MODE_ACTIVE != FALSE)
return;
- if (var == data[2])
- sub_813AD58(0xFFFF); // probably further down
+ if (trueIndex == NUM_ITEMS)
+ ItemStorage_PrintItemPcResponse(ITEMPC_GO_BACK_TO_PREV); // probably further down
else
- sub_813AD58(gSaveBlock1.pcItems[var].itemId);
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[trueIndex].itemId);
}
- else if(data[1] + data[0] != data[2])
+ else if(ITEMS_ABOVE_TOP + PAGE_INDEX != NUM_ITEMS)
{
- PlaySE(5);
- data[1]++;
- sub_813AE0C(taskId);
+ PlaySE(SE_SELECT);
+ ITEMS_ABOVE_TOP++;
+ ItemStorage_DrawBothListAndDescription(taskId);
- if (data[9])
+ if (SWITCH_MODE_ACTIVE != FALSE)
MoveMenuCursor(0);
}
}
else if(gMain.newKeys & SELECT_BUTTON) // _0813A3A0
{
- if (!data[9])
+ if (SWITCH_MODE_ACTIVE == FALSE)
{
- if (data[0] + data[1] != data[2])
+ if (PAGE_INDEX + ITEMS_ABOVE_TOP != NUM_ITEMS) // you cannot swap the Cancel button.
{
- PlaySE(5);
- data[9] = 1;
- data[8] = data[1] + data[0];
- sub_813AD58(0xFFF7);
+ PlaySE(SE_SELECT);
+ SWITCH_MODE_ACTIVE = TRUE;
+ SWAP_ITEM_INDEX = ITEMS_ABOVE_TOP + PAGE_INDEX;
+ ItemStorage_PrintItemPcResponse(ITEMPC_SWITCH_WHICH_ITEM);
}
// _0813A3DC
- sub_813ABE8(taskId);
+ ItemStorage_DrawItemList(taskId);
}
else // _0813A3E8
{
- PlaySE(5); // merging?
- sub_813AA30(taskId, 0);
- sub_813AE0C(taskId);
+ PlaySE(SE_SELECT);
+ ItemStorage_DoItemSwap(taskId, FALSE);
+ ItemStorage_DrawBothListAndDescription(taskId);
}
}
else if(gMain.newKeys & A_BUTTON)
{
- PlaySE(5);
- if(!data[9])
+ PlaySE(SE_SELECT);
+ if(SWITCH_MODE_ACTIVE == FALSE)
{
- if(data[1] + data[0] != data[2])
+ if(ITEMS_ABOVE_TOP + PAGE_INDEX != NUM_ITEMS)
{
- sub_813A4B4(taskId);
+ ItemStorage_DoItemAction(taskId);
}
else
{
- sub_813A468(taskId);
+ ItemStorage_GoBackToPlayerPCMenu(taskId);
}
}
else
{
- sub_813AA30(taskId, 0);
- sub_813AE0C(taskId);
+ ItemStorage_DoItemSwap(taskId, FALSE);
+ ItemStorage_DrawBothListAndDescription(taskId);
}
}
else if(gMain.newKeys & B_BUTTON)
{
- PlaySE(5);
- if(!data[9])
+ PlaySE(SE_SELECT);
+ if(SWITCH_MODE_ACTIVE == FALSE)
{
- sub_8072DEC();
- sub_813A468(taskId);
+ HandleDestroyMenuCursors();
+ ItemStorage_GoBackToPlayerPCMenu(taskId);
}
else
{
- sub_813AA30(taskId, 1);
- sub_813AE0C(taskId);
+ ItemStorage_DoItemSwap(taskId, TRUE);
+ ItemStorage_DrawBothListAndDescription(taskId);
}
}
}
-void sub_813A468(u8 taskId)
+void ItemStorage_GoBackToPlayerPCMenu(u8 taskId)
{
BuyMenuFreeMemory();
DestroyVerticalScrollIndicator(0);
DestroyVerticalScrollIndicator(1);
MenuZeroFillWindowRect(0, 0, 29, 19);
MenuDisplayMessageBox();
- InitItemStorageMenu(gTasks[taskId].data[6]);
+ InitItemStorageMenu(gTasks[taskId].CURRENT_ITEM_STORAGE_MENU);
gTasks[taskId].func = ItemStorageMenuProcessInput;
}
-void sub_813A4B4(u8 taskId)
+void ItemStorage_DoItemAction(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- u8 var = data[0] + data[1];
+ u8 trueIndex = PAGE_INDEX + ITEMS_ABOVE_TOP;
sub_80F996C(0);
sub_80F996C(1);
- if(!data[6])
+ if(CURRENT_ITEM_STORAGE_MENU == ITEMPC_MENU_WITHDRAW)
{
- if(gSaveBlock1.pcItems[var].quantity == 1)
+ if(gSaveBlock1.pcItems[trueIndex].quantity == 1)
{
- data[3] = 1;
- sub_813A6FC(taskId);
+ NUM_QUANTITY_ROLLER = 1;
+ ItemStorage_DoItemWithdraw(taskId);
return;
}
else // _0813A50C
{
- sub_813AD58(0xFFFE);
+ ItemStorage_PrintItemPcResponse(ITEMPC_HOW_MANY_TO_WITHDRAW);
}
}
- else if(gSaveBlock1.pcItems[var].quantity == 1) // _0813A518
+ else if(gSaveBlock1.pcItems[trueIndex].quantity == 1) // _0813A518
{
- data[3] = 1;
- sub_813A794(taskId);
+ NUM_QUANTITY_ROLLER = 1;
+ ItemStorage_DoItemToss(taskId);
return;
}
else
{
- sub_813AD58(0xFFFC);
+ ItemStorage_PrintItemPcResponse(ITEMPC_HOW_MANY_TO_TOSS);
}
- data[3] = 1;
+ NUM_QUANTITY_ROLLER = 1;
MenuDrawTextWindow(6, 8, 13, 11);
- sub_80A418C(data[3], STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3);
- gTasks[taskId].func = HandleQuantityRolling;
+ sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3);
+ gTasks[taskId].func = ItemStorage_HandleQuantityRolling;
}
-void HandleQuantityRolling(u8 taskId)
+void ItemStorage_HandleQuantityRolling(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- u8 var = data[0] + data[1];
+ u8 trueIndex = PAGE_INDEX + ITEMS_ABOVE_TOP;
if(gMain.newAndRepeatedKeys & DPAD_UP)
{
- if(data[3] != gSaveBlock1.pcItems[var].quantity)
- data[3]++;
+ if(NUM_QUANTITY_ROLLER != gSaveBlock1.pcItems[trueIndex].quantity)
+ NUM_QUANTITY_ROLLER++;
else
- data[3] = 1; // you are at the max amount of items you have when you press Up, set your quantity back to 1.
+ NUM_QUANTITY_ROLLER = 1; // you are at the max amount of items you have when you press Up, set your quantity back to 1.
- sub_80A418C(data[3], STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
+ sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
}
else if(gMain.newAndRepeatedKeys & DPAD_DOWN)
{
- if(data[3] != 1)
- data[3]--;
+ if(NUM_QUANTITY_ROLLER != 1)
+ NUM_QUANTITY_ROLLER--;
else
- data[3] = gSaveBlock1.pcItems[var].quantity; // you are at 0 when you press down, set your quantity to the amount you have.
+ NUM_QUANTITY_ROLLER = gSaveBlock1.pcItems[trueIndex].quantity; // you are at 0 when you press down, set your quantity to the amount you have.
- sub_80A418C(data[3], STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
+ sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
}
else if(gMain.newAndRepeatedKeys & DPAD_LEFT) // reduce by 10.
{
- data[3] -= 10;
+ NUM_QUANTITY_ROLLER -= 10;
- if(data[3] <= 0)
- data[3] = 1; // dont underflow or allow 0!
+ if(NUM_QUANTITY_ROLLER <= 0)
+ NUM_QUANTITY_ROLLER = 1; // dont underflow or allow 0!
- sub_80A418C(data[3], STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
+ sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
}
else if(gMain.newAndRepeatedKeys & DPAD_RIGHT) // add 10.
{
- data[3] += 10;
+ NUM_QUANTITY_ROLLER += 10;
- if(data[3] > gSaveBlock1.pcItems[var].quantity)
- data[3] = gSaveBlock1.pcItems[var].quantity; // dont overflow!
+ if(NUM_QUANTITY_ROLLER > gSaveBlock1.pcItems[trueIndex].quantity)
+ NUM_QUANTITY_ROLLER = gSaveBlock1.pcItems[trueIndex].quantity; // dont overflow!
- sub_80A418C(data[3], STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
+ sub_80A418C(NUM_QUANTITY_ROLLER, STR_CONV_MODE_RIGHT_ALIGN, 8, 9, 3); // print quantity?
}
else if(gMain.newKeys & A_BUTTON) // confirm quantity.
{
- PlaySE(5);
+ PlaySE(SE_SELECT);
MenuZeroFillWindowRect(6, 6, 0xD, 0xB);
- if(!data[6])
- sub_813A6FC(taskId);
+ if(CURRENT_ITEM_STORAGE_MENU == ITEMPC_MENU_WITHDRAW)
+ ItemStorage_DoItemWithdraw(taskId);
else
- sub_813A794(taskId);
+ ItemStorage_DoItemToss(taskId);
}
else if(gMain.newKeys & B_BUTTON) // cancel quantity.
{
- PlaySE(5);
+ PlaySE(SE_SELECT);
MenuZeroFillWindowRect(6, 6, 0xD, 0xB);
sub_80F98DC(0);
sub_80F98DC(1);
- sub_813AD58(gSaveBlock1.pcItems[data[1] + data[0]].itemId); // why not use var?
- gTasks[taskId].func = sub_813A280;
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[ITEMS_ABOVE_TOP + PAGE_INDEX].itemId); // why not use trueIndex?
+ gTasks[taskId].func = ItemStorage_ProcessInput;
}
}
-void sub_813A6FC(u8 taskId)
+void ItemStorage_DoItemWithdraw(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- u8 var = data[0] + data[1];
+ u8 trueIndex = PAGE_INDEX + ITEMS_ABOVE_TOP;
- if(AddBagItem(gSaveBlock1.pcItems[var].itemId, data[3]) == TRUE) // add item works.
+ if(AddBagItem(gSaveBlock1.pcItems[trueIndex].itemId, NUM_QUANTITY_ROLLER) == TRUE) // add item works.
{
- CopyItemName(gSaveBlock1.pcItems[var].itemId, gStringVar1);
- ConvertIntToDecimalStringN(gStringVar2, data[3], 0, 3);
- sub_813AD58(0xFFFD);
- gTasks[taskId].func = sub_813A8F0;
+ CopyItemName(gSaveBlock1.pcItems[trueIndex].itemId, gStringVar1);
+ ConvertIntToDecimalStringN(gStringVar2, NUM_QUANTITY_ROLLER, 0, 3);
+ ItemStorage_PrintItemPcResponse(ITEMPC_WITHDREW_THING);
+ gTasks[taskId].func = ItemStorage_HandleRemoveItem;
}
- else // cannot add item. inventory full?
+ else
{
- data[3] = 0;
- sub_813AD58(0xFFFA);
- gTasks[taskId].func = sub_813A984;
+ NUM_QUANTITY_ROLLER = 0;
+ ItemStorage_PrintItemPcResponse(ITEMPC_NO_MORE_ROOM);
+ gTasks[taskId].func = ItemStorage_WaitPressHandleResumeProcessInput;
}
}
-void sub_813A794(u8 taskId)
+void ItemStorage_DoItemToss(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- u8 var = data[0] + data[1];
+ u8 var = PAGE_INDEX + ITEMS_ABOVE_TOP;
if(ItemId_GetImportance(gSaveBlock1.pcItems[var].itemId) == FALSE)
{
CopyItemName(gSaveBlock1.pcItems[var].itemId, gStringVar1);
- ConvertIntToDecimalStringN(gStringVar2, data[3], 0, 3);
- sub_813AD58(65528);
+ ConvertIntToDecimalStringN(gStringVar2, NUM_QUANTITY_ROLLER, 0, 3);
+ ItemStorage_PrintItemPcResponse(ITEMPC_OKAY_TO_THROW_AWAY);
DisplayYesNoMenu(7, 6, 1);
sub_80F914C(taskId, &gUnknown_084062E0);
}
else
{
- data[3] = 0;
- sub_813AD58(65529);
- gTasks[taskId].func = sub_813A8F0;
+ NUM_QUANTITY_ROLLER = 0;
+ ItemStorage_PrintItemPcResponse(ITEMPC_TOO_IMPORTANT);
+ gTasks[taskId].func = ItemStorage_HandleRemoveItem;
}
}
-void sub_813A83C(u8 taskId)
+void ItemStorage_ResumeInputFromYesToss(u8 taskId)
{
MenuZeroFillWindowRect(0x6, 0x6, 0xD, 0xB);
- sub_813AD58(0xFFFB);
- gTasks[taskId].func = sub_813A8F0;
+ ItemStorage_PrintItemPcResponse(ITEMPC_THREW_AWAY_ITEM);
+ gTasks[taskId].func = ItemStorage_HandleRemoveItem;
}
-void sub_813A878(u8 taskId)
+void ItemStorage_ResumeInputFromNoToss(u8 taskId)
{
s16 *data = gTasks[taskId].data;
MenuZeroFillWindowRect(0x6, 0x6, 0xD, 0xB);
- InitMenu(0, 16, 2, data[4], data[0], 0xD);
+ InitMenu(0, 16, 2, NUM_PAGE_ITEMS, PAGE_INDEX, 0xD);
sub_80F98DC(0);
sub_80F98DC(1);
- sub_813AD58(gSaveBlock1.pcItems[data[1] + data[0]].itemId);
- gTasks[taskId].func = sub_813A280;
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[ITEMS_ABOVE_TOP + PAGE_INDEX].itemId);
+ gTasks[taskId].func = ItemStorage_ProcessInput;
}
-void sub_813A8F0(u8 taskId)
+void ItemStorage_HandleRemoveItem(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- u16 var;
- u8 usedItemSlots;
+ s16 oldNumItems;
- if(gMain.newKeys & 0x1 || gMain.newKeys == 0x2)
+ if(gMain.newKeys & A_BUTTON || gMain.newKeys == B_BUTTON)
{
- RemovePCItem(data[0] + data[1], data[3]);
- var = data[2];
- usedItemSlots = CountUsedPCItemSlots();
- data[2] = usedItemSlots;
+ RemovePCItem(PAGE_INDEX + ITEMS_ABOVE_TOP, NUM_QUANTITY_ROLLER);
+ oldNumItems = NUM_ITEMS;
+ NUM_ITEMS = CountUsedPCItemSlots();
- if((s16)var != usedItemSlots && (s16)var < data[4] + data[1] && data[1] != 0)
- data[1]--;
+ if(oldNumItems != NUM_ITEMS && oldNumItems < NUM_PAGE_ITEMS + ITEMS_ABOVE_TOP && ITEMS_ABOVE_TOP != 0)
+ ITEMS_ABOVE_TOP--;
- sub_813A240(taskId);
- sub_813A9EC(taskId);
- InitMenu(0, 16, 2, data[4], data[0], 0xD);
+ ItemStorage_SetItemAndMailCount(taskId);
+ ItemStorage_HandleResumeProcessInput(taskId);
+ InitMenu(0, 16, 2, NUM_PAGE_ITEMS, PAGE_INDEX, 0xD);
}
}
-void sub_813A984(u8 taskId)
+void ItemStorage_WaitPressHandleResumeProcessInput(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- if(gMain.newKeys & 0x1 || gMain.newKeys == 2)
+ if(gMain.newKeys & A_BUTTON || gMain.newKeys == B_BUTTON)
{
- sub_813AD58(gSaveBlock1.pcItems[data[1] + data[0]].itemId);
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[ITEMS_ABOVE_TOP + PAGE_INDEX].itemId);
sub_80F98DC(0);
sub_80F98DC(1);
- gTasks[taskId].func = sub_813A280;
+ gTasks[taskId].func = ItemStorage_ProcessInput;
}
}
-void sub_813A9EC(u8 taskId)
+void ItemStorage_HandleResumeProcessInput(u8 taskId)
{
MenuZeroFillWindowRect(0x6, 0x6, 0xD, 0xB);
sub_80F98DC(0);
sub_80F98DC(1);
- sub_813AE0C(taskId);
- gTasks[taskId].func = sub_813A280;
+ ItemStorage_DrawBothListAndDescription(taskId);
+ gTasks[taskId].func = ItemStorage_ProcessInput;
}
-void sub_813AA30(u8 taskId, u8 arg)
+void ItemStorage_DoItemSwap(u8 taskId, bool8 switchModeDisabled)
{
s16 *data = gTasks[taskId].data;
- u8 var = data[1] + data[0];
+ u8 trueIndex = ITEMS_ABOVE_TOP + PAGE_INDEX;
- data[9] = 0;
+ SWITCH_MODE_ACTIVE = FALSE;
- if((u8)data[2] > var && (u8)data[8] != var && arg == 0)
+ if((u8)NUM_ITEMS > trueIndex && (u8)SWAP_ITEM_INDEX != trueIndex && switchModeDisabled == FALSE)
{
- struct ItemSlot itemSlot = gSaveBlock1.pcItems[data[8]]; // backup the itemSlot before swapping the two.
+ struct ItemSlot itemSlot = gSaveBlock1.pcItems[SWAP_ITEM_INDEX]; // backup the itemSlot before swapping the two.
- gSaveBlock1.pcItems[data[8]] = gSaveBlock1.pcItems[var];
- gSaveBlock1.pcItems[var] = itemSlot;
+ gSaveBlock1.pcItems[SWAP_ITEM_INDEX] = gSaveBlock1.pcItems[trueIndex];
+ gSaveBlock1.pcItems[trueIndex] = itemSlot;
return;
}
- else if(var == data[2])
+ else if(trueIndex == NUM_ITEMS)
{
- sub_813AD58(0xFFFF);
+ ItemStorage_PrintItemPcResponse(ITEMPC_GO_BACK_TO_PREV);
}
else
{
- sub_813AD58(gSaveBlock1.pcItems[var].itemId);
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[trueIndex].itemId);
}
/*
THEORY: This check produces essentially dead code, but it might have been working in an earlier build
in which case it allows a programmer to easily duplicate items without the use of a debug menu.
+ This gets the page index of the swap index for some reason. It is currently unknown what it would have been used
+ for, but perhaps it was used to increase the quantity of the item without a debug menu.
With the removal of a lot of the debug menus close to release, a programmer may have added this to
help test things with a low key (such as planting a lot of duplicated berries, which requires this lazy "cheat")
without bringing the relevent debug menus back. The commented out line is intentionally left in below to show
what it may have looked like.
*/
- if(data[8] - data[1] > 0) { // this check is arbitrary and used to generate the correct assembly using the subtraction, which is what matters. the 0 check doesn't.
- //gSaveBlock1.pcItems[data[8]].quantity += 100;
- gSaveBlock1.pcItems[data[8]].quantity += 0; // do not enforce item cap.
+ if(SWAP_ITEM_INDEX - ITEMS_ABOVE_TOP <= 0) { // this check is arbitrary and used to generate the correct assembly using the subtraction, which is what matters. the 0 check doesn't.
+ //gSaveBlock1.pcItems[SWAP_ITEM_INDEX].quantity += 100;
+ gSaveBlock1.pcItems[SWAP_ITEM_INDEX].quantity += 0; // do not enforce item cap.
}
}
-void sub_813AAC4(u16 arg1, enum StringConvertMode arg2, u8 arg3, u8 arg4, int arg5)
+void ItemStorage_DrawItemQuantity(u16 arg1, enum StringConvertMode arg2, u8 arg3, u8 arg4, int isSwapSelected)
{
sub_80A4164(gStringVar1, arg1, arg2, arg4);
- if(arg5)
+ if(isSwapSelected != FALSE)
MenuPrint(gUnknown_0840632A, 0x1A, arg3);
else
MenuPrint(gUnknown_08406327, 0x1A, arg3);
}
-void sub_813AB10(u8 var)
+void ItemStorage_DrawItemVoidQuantity(u8 var)
{
MenuPrint(gUnknown_08406330, 0x19, var);
}
-void sub_813AB28(struct ItemSlot *itemSlot, u8 var, int var2)
+void ItemStorage_DrawItemName(struct ItemSlot *itemSlot, u8 var, int isSwapSelected)
{
CopyItemName(itemSlot->itemId, gStringVar1);
- if(var2)
+ if(isSwapSelected != FALSE)
MenuPrint(gUnknown_0840631E, 16, var);
else
MenuPrint(gUnknown_08406318, 16, var);
}
-void sub_813AB64(struct ItemSlot *itemSlot, u8 var, int var2)
+void ItemStorage_DrawNormalItemEntry(struct ItemSlot *itemSlot, u8 var, int var2)
{
- sub_813AB28(itemSlot, var, var2);
- sub_813AAC4(itemSlot->quantity, STR_CONV_MODE_RIGHT_ALIGN, var, 3, var2);
+ ItemStorage_DrawItemName(itemSlot, var, var2);
+ ItemStorage_DrawItemQuantity(itemSlot->quantity, STR_CONV_MODE_RIGHT_ALIGN, var, 3, var2);
}
-void sub_813AB90(struct ItemSlot *itemSlot, u8 var, int var2)
+void ItemStorage_DrawKeyItemEntry(struct ItemSlot *itemSlot, u8 var, int var2)
{
- sub_813AB28(itemSlot, var, var2);
- sub_813AB10(var);
+ ItemStorage_DrawItemName(itemSlot, var, var2);
+ ItemStorage_DrawItemVoidQuantity(var);
}
-void sub_813ABAC(struct ItemSlot *itemSlot, u8 var, int var2)
+void ItemStorage_DrawTMHMEntry(struct ItemSlot *itemSlot, u8 var, int var2)
{
- sub_813AB28(itemSlot, var, var2);
+ ItemStorage_DrawItemName(itemSlot, var, var2);
if(itemSlot->itemId < ITEM_HM01)
- sub_813AAC4(itemSlot->quantity, STR_CONV_MODE_RIGHT_ALIGN, var, 3, var2);
+ ItemStorage_DrawItemQuantity(itemSlot->quantity, STR_CONV_MODE_RIGHT_ALIGN, var, 3, var2);
else
- sub_813AB10(var); // key items do not have a quantity.
+ ItemStorage_DrawItemVoidQuantity(var); // HMs do not have a quantity.
}
-void sub_813ABE8(u8 taskId)
+void ItemStorage_DrawItemList(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- u16 i;
int tempArg;
- u16 j = 0;
+ u16 i;
+ u16 yCoord = 0;
// r5 is i and is unsigned 16-bit.
- for(i = data[1]; i < data[1] + data[4]; i++)
+ for(i = ITEMS_ABOVE_TOP; i < ITEMS_ABOVE_TOP + NUM_PAGE_ITEMS; i++)
{
- j = (i - data[1]) * 2;
+ yCoord = (i - ITEMS_ABOVE_TOP) * 2;
- if(i != data[2])
+ if(i != NUM_ITEMS)
{
tempArg = 0;
- if(data[9] != 0 && i == data[8])
+ if(SWITCH_MODE_ACTIVE != FALSE && i == SWAP_ITEM_INDEX)
tempArg = 1;
switch(GetPocketByItemId(gSaveBlock1.pcItems[i].itemId) - 1)
{
- case 0:
- case 1:
- case 3:
- sub_813AB64((struct ItemSlot *)&gSaveBlock1.pcItems[i], j + 2, tempArg);
- break;
- case 4:
- sub_813AB90((struct ItemSlot *)&gSaveBlock1.pcItems[i], j + 2, tempArg);
- break;
- case 2:
- sub_813ABAC((struct ItemSlot *)&gSaveBlock1.pcItems[i], j + 2, tempArg);
- break;
+ case 0:
+ case 1:
+ case 3:
+ ItemStorage_DrawNormalItemEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
+ break;
+ case 4:
+ ItemStorage_DrawKeyItemEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
+ break;
+ case 2:
+ ItemStorage_DrawTMHMEntry((struct ItemSlot *)&gSaveBlock1.pcItems[i], yCoord + 2, tempArg);
+ break;
}
}
else
@@ -799,24 +873,459 @@ void sub_813ABE8(u8 taskId)
}
beforeLabel:
- if(i - data[1] < 8)
- MenuFillWindowRectWithBlankTile(16, j + 4, 0x1C, 0x12);
+ if(i - ITEMS_ABOVE_TOP < 8)
+ MenuFillWindowRectWithBlankTile(16, yCoord + 4, 0x1C, 0x12);
- switch(data[1])
+ switch(ITEMS_ABOVE_TOP)
{
default:
CreateVerticalScrollIndicators(0, 0xB8, 8);
break;
weirdCase:
- sub_8072A18(gOtherText_CancelNoTerminator, 0x80, (j + 2) * 8, 0x68, 1);
+ sub_8072A18(gOtherText_CancelNoTerminator, 0x80, (yCoord + 2) * 8, 0x68, 1);
goto beforeLabel;
case 0:
DestroyVerticalScrollIndicator(0);
break;
}
- if(data[1] + data[4] <= data[2])
+ if(ITEMS_ABOVE_TOP + NUM_PAGE_ITEMS <= NUM_ITEMS)
CreateVerticalScrollIndicators(1, 0xB8, 0x98);
else
DestroyVerticalScrollIndicator(1);
}
+
+void ItemStorage_PrintItemPcResponse(u16 itemId)
+{
+ u8 *string;
+
+ switch(itemId)
+ {
+ case ITEMPC_GO_BACK_TO_PREV:
+ string = (u8 *)gMenuText_GoBackToPrev;
+ break;
+ case ITEMPC_HOW_MANY_TO_WITHDRAW:
+ string = (u8 *)gOtherText_HowManyToWithdraw;
+ break;
+ case ITEMPC_WITHDREW_THING:
+ string = (u8 *)gOtherText_WithdrewThing;
+ break;
+ case ITEMPC_HOW_MANY_TO_TOSS:
+ string = (u8 *)gOtherText_HowManyToToss;
+ break;
+ case ITEMPC_THREW_AWAY_ITEM:
+ string = (u8 *)gOtherText_ThrewAwayItem;
+ break;
+ case ITEMPC_NO_MORE_ROOM:
+ string = (u8 *)gOtherText_NoMoreRoom;
+ break;
+ case ITEMPC_TOO_IMPORTANT:
+ string = (u8 *)gOtherText_TooImportant;
+ break;
+ case ITEMPC_OKAY_TO_THROW_AWAY:
+ string = (u8 *)gOtherText_OkayToThrowAwayPrompt;
+ break;
+ case ITEMPC_SWITCH_WHICH_ITEM:
+ string = (u8 *)gOtherText_SwitchWhichItem;
+ break;
+ default:
+ string = ItemId_GetDescription(itemId);
+ break;
+ }
+
+ sub_8072AB0(string, 8, 0x68, 0x68, 0x30, 1);
+}
+
+void ItemStorage_DrawBothListAndDescription(u8 taskId)
+{
+ s16 *data = gTasks[taskId].data;
+ s16 trueIndex = ITEMS_ABOVE_TOP + PAGE_INDEX;
+
+ ItemStorage_DrawItemList(taskId);
+
+ if(SWITCH_MODE_ACTIVE == FALSE)
+ {
+ if(trueIndex == NUM_ITEMS)
+ ItemStorage_PrintItemPcResponse(ITEMPC_GO_BACK_TO_PREV);
+ else
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[trueIndex].itemId);
+ }
+}
+
+void ItemStorage_GoBackToItemPCMenu(u8 taskId, u8 var)
+{
+ s16 *data = gTasks[taskId].data;
+
+ sub_80F944C();
+ LoadScrollIndicatorPalette();
+ ItemStorage_LoadPalette();
+ MenuDrawTextWindow(0xF, 0, 0x1D, 0x13);
+ MenuDrawTextWindow(0, 0xC, 0xE, 0x13);
+ MenuDrawTextWindow(0, 0, 0xB, 3);
+ ItemStorage_PrintItemPcResponse(gSaveBlock1.pcItems[0].itemId);
+ MenuPrint(gPCText_ItemPCOptionsText[var].text, 1, 1);
+ ItemStorage_DrawItemList(taskId);
+ InitMenu(0, 0x10, 2, NUM_PAGE_ITEMS, PAGE_INDEX, 0xD);
+}
+
+void ItemStorage_LoadPalette(void)
+{
+ u16 arr[3];
+
+ memcpy(arr, gUnknown_08406334, sizeof(arr));
+ LoadPalette(&arr[2], 0xDF, 2);
+ LoadPalette(&arr[1], 0xD1, 2);
+ LoadPalette(&arr[0], 0xD8, 2);
+}
+
+u8 GetMailboxMailCount(void)
+{
+ u8 i, j;
+
+ for(i = 0, j = 6; j < 16; j++)
+ if(gSaveBlock1.mail[j].itemId != 0)
+ i++;
+
+ return i;
+}
+
+void Mailbox_UpdateMailList(void)
+{
+ struct MailStruct mailBuffer;
+ u8 i, j;
+
+ for (i=6; i<15; i++)
+ {
+ for (j=i+1; j<16; j++)
+ {
+ if (gSaveBlock1.mail[i].itemId == 0)
+ {
+ mailBuffer = gSaveBlock1.mail[i];
+ gSaveBlock1.mail[i] = gSaveBlock1.mail[j];
+ gSaveBlock1.mail[j] = mailBuffer;
+ }
+ }
+ }
+}
+
+// WWHHHHHYYYYYYYY SOMEBODY PLEASE FIX THIS
+void Mailbox_DrawMailList(u8 taskId) // taskId is unused
+{
+ u16 yCoord = 0;
+ u16 i = gMailboxInfo.itemsAbove;
+ register struct MailboxStruct *tempMailbox asm("r1") = &gMailboxInfo;
+ register struct MailboxStruct *mailbox asm("r6");
+
+ if(i < i + tempMailbox->pageItems)
+ {
+ mailbox = tempMailbox;
+ goto forJump;
+ for(; i < mailbox->itemsAbove + mailbox->pageItems; i++)
+ {
+ forJump:
+ yCoord = (i - mailbox->itemsAbove) * 2;
+ MenuFillWindowRectWithBlankTile(0x15, yCoord + 2, 0x1C, yCoord + 3);
+
+ if(i != mailbox->count)
+ {
+ StringCopy(gStringVar1, (u8 *)gSaveBlock1.mail[i + 6].playerName);
+ SanitizeNameString(gStringVar1);
+ MenuPrint(gStringVar1, 0x15, yCoord + 2);
+ }
+ else
+ {
+ goto weirdCase; // again, what???
+ }
+ }
+ }
+
+beforeLabel:
+ if(i - gMailboxInfo.itemsAbove != 8)
+ MenuFillWindowRectWithBlankTile(0x15, yCoord + 4, 0x1C, 0x12);
+
+ switch(gMailboxInfo.itemsAbove)
+ {
+ default:
+ CreateVerticalScrollIndicators(0, 0xC8, 8);
+ break;
+weirdCase:
+ MenuPrint(gOtherText_CancelNoTerminator, 0x15, yCoord + 2);
+ goto beforeLabel;
+ case 0:
+ DestroyVerticalScrollIndicator(0);
+ break;
+ }
+
+ if(gMailboxInfo.itemsAbove + gMailboxInfo.pageItems <= gMailboxInfo.count)
+ CreateVerticalScrollIndicators(1, 0xC8, 0x98);
+ else
+ DestroyVerticalScrollIndicator(1);
+}
+
+void Mailbox_DrawMailboxMenu(u8 taskId)
+{
+ sub_80F944C();
+ LoadScrollIndicatorPalette();
+ MenuZeroFillWindowRect(0, 0, 0x1D, 0x13);
+ MenuDrawTextWindow(0, 0, 0x8, 0x3);
+ MenuPrint(gPCText_Mailbox, 1, 1);
+ MenuDrawTextWindow(0x14, 0, 0x1D, 0x13);
+ Mailbox_DrawMailList(taskId);
+ InitMenu(0, 0x15, 2, gMailboxInfo.pageItems, gMailboxInfo.cursorPos, 8);
+}
+
+// Mailbox_ProcessInput
+void Mailbox_ProcessInput(u8 taskId)
+{
+ if(!gPaletteFade.active)
+ {
+ if(gMain.newAndRepeatedKeys & DPAD_UP)
+ {
+ if(gMailboxInfo.cursorPos != 0)
+ {
+ PlaySE(5);
+ gMailboxInfo.cursorPos = MoveMenuCursor(-1);
+ }
+ else if(gMailboxInfo.itemsAbove != 0)
+ {
+ PlaySE(5);
+ gMailboxInfo.itemsAbove--;
+ Mailbox_DrawMailList(taskId);
+ }
+ }
+ else if(gMain.newAndRepeatedKeys & DPAD_DOWN)
+ {
+ if(gMailboxInfo.cursorPos != gMailboxInfo.pageItems - 1)
+ {
+ PlaySE(5);
+ gMailboxInfo.cursorPos = MoveMenuCursor(1);
+ }
+ else if(gMailboxInfo.itemsAbove + gMailboxInfo.cursorPos != gMailboxInfo.count)
+ {
+ PlaySE(5);
+ gMailboxInfo.itemsAbove++;
+ Mailbox_DrawMailList(taskId);
+ }
+ }
+ else if(gMain.newKeys & A_BUTTON)
+ {
+ HandleDestroyMenuCursors();
+ PlaySE(5);
+
+ if(gMailboxInfo.itemsAbove + gMailboxInfo.cursorPos == gMailboxInfo.count)
+ {
+ sub_813B320(taskId);
+ }
+ else
+ {
+ sub_813B27C();
+ gTasks[taskId].func = sub_813B294;
+ }
+ }
+ else if(gMain.newKeys & B_BUTTON)
+ {
+ HandleDestroyMenuCursors();
+ PlaySE(5);
+ sub_813B320(taskId);
+ }
+ }
+}
+
+void sub_813B27C(void)
+{
+ BuyMenuFreeMemory();
+ DestroyVerticalScrollIndicator(0);
+ DestroyVerticalScrollIndicator(1);
+}
+
+void sub_813B294(u8 taskId)
+{
+ MenuZeroFillWindowRect(0, 0, 0x1D, 0x13);
+ StringCopy(gStringVar1, gSaveBlock1.mail[gMailboxInfo.itemsAbove + 6 + gMailboxInfo.cursorPos].playerName);
+ SanitizeNameString(gStringVar1);
+ StringExpandPlaceholders(gStringVar4, gOtherText_WhatWillYouDoMail);
+ DisplayItemMessageOnField(taskId, gStringVar4, sub_813B348, 0);
+}
+
+void sub_813B300(u8 taskId)
+{
+ MenuZeroFillWindowRect(0, 0, 0x1D, 0x13);
+ ReshowPlayerPC(taskId);
+}
+
+void sub_813B320(u8 taskId)
+{
+ sub_813B27C();
+ gTasks[taskId].func = sub_813B300;
+}
+
+void sub_813B348(u8 taskId)
+{
+ MenuDrawTextWindow(0, 0, 0xC, 0x9);
+ PrintMenuItems(1, 1, 4, gUnknown_084062F8);
+ InitMenu(0, 1, 1, 4, 0, 0xB);
+ gTasks[taskId].func = sub_813B3A0;
+}
+
+void sub_813B3A0(u8 taskId)
+{
+ if(gMain.newAndRepeatedKeys & DPAD_UP)
+ {
+ PlaySE(5);
+ MoveMenuCursor(-1);
+ }
+ else if(gMain.newAndRepeatedKeys & DPAD_DOWN)
+ {
+ PlaySE(5);
+ MoveMenuCursor(1);
+ }
+ else if(gMain.newKeys & A_BUTTON)
+ {
+ PlaySE(5);
+ gUnknown_084062F8[GetMenuCursorPos()].func(taskId);
+ }
+ else if(gMain.newKeys & B_BUTTON)
+ {
+ PlaySE(5);
+ Mailbox_Cancel(taskId);
+ }
+}
+
+void Mailbox_Read(u8 taskId)
+{
+ fade_screen(1, 0);
+ gTasks[taskId].func = sub_813B454;
+}
+
+void sub_813B454(u8 taskId)
+{
+ if(!gPaletteFade.active)
+ {
+ HandleReadMail(&gSaveBlock1.mail[gMailboxInfo.itemsAbove + 6 + gMailboxInfo.cursorPos], sub_813B4F0, 1);
+ DestroyTask(taskId);
+ }
+}
+
+void sub_813B4A0(u8 taskId)
+{
+ if(sub_807D770() == TRUE)
+ gTasks[taskId].func = Mailbox_ProcessInput;
+}
+
+void sub_813B4D0(void)
+{
+ Mailbox_DrawMailboxMenu(CreateTask(sub_813B4A0, 0));
+ pal_fill_black();
+}
+
+void sub_813B4F0(void)
+{
+ gUnknown_0300485C = sub_813B4D0;
+ SetMainCallback2(c2_exit_to_overworld_2_switch);
+}
+
+void Mailbox_MoveToBag(u8 taskId)
+{
+ HandleDestroyMenuCursors();
+ StringCopy(gStringVar1, gOtherText_MoveToBag);
+ MenuPrint(gUnknown_0840633A, 1, 3);
+ DisplayItemMessageOnField(taskId, gOtherText_MessageWillBeLost, sub_813B554, 0);
+}
+
+void sub_813B554(u8 taskId)
+{
+ DisplayYesNoMenu(0x14, 0x8, 0x1);
+ sub_80F914C(taskId, &gUnknown_084062E8);
+}
+
+void sub_813B578(u8 taskId)
+{
+ struct MailStruct *mail = &gSaveBlock1.mail[gMailboxInfo.itemsAbove + 6 + gMailboxInfo.cursorPos];
+
+ MenuZeroFillWindowRect(0x14, 8, 0x1A, 0xD);
+
+ if(AddBagItem(mail->itemId, 1) == FALSE)
+ {
+ DisplayItemMessageOnField(taskId, gOtherText_BagIsFull, sub_813B758, 0);
+ }
+ else
+ {
+ DisplayItemMessageOnField(taskId, gOtherText_MailWasReturned, sub_813B758, 0);
+ ClearMailStruct(mail);
+ Mailbox_UpdateMailList();
+
+ gMailboxInfo.count--;
+
+ if(gMailboxInfo.count < gMailboxInfo.pageItems + gMailboxInfo.itemsAbove && gMailboxInfo.itemsAbove != 0)
+ gMailboxInfo.itemsAbove--;
+
+ ItemStorage_SetItemAndMailCount(taskId);
+ }
+}
+
+void sub_813B610(u8 taskId)
+{
+ MenuZeroFillWindowRect(0x14, 0x8, 0x1A, 0xD);
+ sub_813B758(taskId);
+}
+
+void Mailbox_Give(u8 taskId)
+{
+ if(CalculatePlayerPartyCount() == 0)
+ sub_813B718(taskId);
+ else
+ {
+ fade_screen(1, 0);
+ gTasks[taskId].func = sub_813B66C;
+ }
+}
+
+void sub_813B66C(u8 taskId)
+{
+ if(!gPaletteFade.active)
+ {
+ SetMainCallback2(sub_808B020);
+ gUnknown_02038561 = 3;
+ DestroyTask(taskId);
+ }
+}
+
+void sub_813B6A4(void)
+{
+ u8 taskId = CreateTask(sub_813B4A0, 0);
+ u8 oldCount = gMailboxInfo.count;
+
+ gMailboxInfo.count = GetMailboxMailCount();
+ Mailbox_UpdateMailList();
+
+ if(oldCount != gMailboxInfo.count && gMailboxInfo.count < gMailboxInfo.pageItems + gMailboxInfo.itemsAbove && gMailboxInfo.itemsAbove != 0) // did the count update?
+ gMailboxInfo.itemsAbove--;
+
+ ItemStorage_SetItemAndMailCount(taskId);
+ Mailbox_DrawMailboxMenu(taskId);
+ pal_fill_black();
+}
+
+void sub_813B6F8(void)
+{
+ gUnknown_0300485C = sub_813B6A4;
+ SetMainCallback2(c2_exit_to_overworld_2_switch);
+}
+
+void sub_813B718(u8 taskId)
+{
+ DisplayItemMessageOnField(taskId, gOtherText_NoPokemon, sub_813B758, 0);
+}
+
+void Mailbox_Cancel(u8 taskId)
+{
+ HandleDestroyMenuCursors();
+ MenuZeroFillWindowRect(0, 0, 0xC, 0x9);
+ sub_813B758(taskId);
+}
+
+void sub_813B758(u8 taskId)
+{
+ Mailbox_DrawMailboxMenu(taskId);
+ gTasks[taskId].func = Mailbox_ProcessInput;
+}
diff --git a/src/pokedex.c b/src/pokedex.c
index 97bac3390..3d8b152ae 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -849,8 +849,8 @@ void SortPokedex(u8 dexMode, u8 sortMode)
{
vars[2] = HoennToNationalOrder(i + 1);
gPokedexView->unk0[i].dexNum = vars[2];
- gPokedexView->unk0[i].seen = sub_8090D90(vars[2], 0);
- gPokedexView->unk0[i].owned = sub_8090D90(vars[2], 1);
+ gPokedexView->unk0[i].seen = GetNationalPokedexFlag(vars[2], 0);
+ gPokedexView->unk0[i].owned = GetNationalPokedexFlag(vars[2], 1);
if (gPokedexView->unk0[i].seen)
gPokedexView->unk60C = i + 1;
}
@@ -864,14 +864,14 @@ void SortPokedex(u8 dexMode, u8 sortMode)
for (i = 0; i < vars[0]; i++)
{
vars[2] = i + 1;
- if (sub_8090D90(vars[2], 0))
+ if (GetNationalPokedexFlag(vars[2], 0))
r10 = 1;
if (r10)
{
asm(""); //Needed to match for some reason
gPokedexView->unk0[r5].dexNum = vars[2];
- gPokedexView->unk0[r5].seen = sub_8090D90(vars[2], 0);
- gPokedexView->unk0[r5].owned = sub_8090D90(vars[2], 1);
+ gPokedexView->unk0[r5].seen = GetNationalPokedexFlag(vars[2], 0);
+ gPokedexView->unk0[r5].owned = GetNationalPokedexFlag(vars[2], 1);
if (gPokedexView->unk0[r5].seen)
gPokedexView->unk60C = r5 + 1;
r5++;
@@ -885,11 +885,11 @@ void SortPokedex(u8 dexMode, u8 sortMode)
{
vars[2] = gPokedexOrder_Alphabetical[i];
- if (NationalToHoennOrder(vars[2]) <= vars[0] && sub_8090D90(vars[2], 0))
+ if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 0))
{
gPokedexView->unk0[gPokedexView->unk60C].dexNum = vars[2];
gPokedexView->unk0[gPokedexView->unk60C].seen = 1;
- gPokedexView->unk0[gPokedexView->unk60C].owned = sub_8090D90(vars[2], 1);
+ gPokedexView->unk0[gPokedexView->unk60C].owned = GetNationalPokedexFlag(vars[2], 1);
gPokedexView->unk60C++;
}
}
@@ -899,7 +899,7 @@ void SortPokedex(u8 dexMode, u8 sortMode)
{
vars[2] = gPokedexOrder_Weight[i];
- if (NationalToHoennOrder(vars[2]) <= vars[0] && sub_8090D90(vars[2], 1))
+ if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1))
{
gPokedexView->unk0[gPokedexView->unk60C].dexNum = vars[2];
gPokedexView->unk0[gPokedexView->unk60C].seen = 1;
@@ -913,7 +913,7 @@ void SortPokedex(u8 dexMode, u8 sortMode)
{
vars[2] = gPokedexOrder_Weight[i];
- if (NationalToHoennOrder(vars[2]) <= vars[0] && sub_8090D90(vars[2], 1))
+ if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1))
{
gPokedexView->unk0[gPokedexView->unk60C].dexNum = vars[2];
gPokedexView->unk0[gPokedexView->unk60C].seen = 1;
@@ -927,7 +927,7 @@ void SortPokedex(u8 dexMode, u8 sortMode)
{
vars[2] = gPokedexOrder_Height[i];
- if (NationalToHoennOrder(vars[2]) <= vars[0] && sub_8090D90(vars[2], 1))
+ if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1))
{
gPokedexView->unk0[gPokedexView->unk60C].dexNum = vars[2];
gPokedexView->unk0[gPokedexView->unk60C].seen = 1;
@@ -941,7 +941,7 @@ void SortPokedex(u8 dexMode, u8 sortMode)
{
vars[2] = gPokedexOrder_Height[i];
- if (NationalToHoennOrder(vars[2]) <= vars[0] && sub_8090D90(vars[2], 1))
+ if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1))
{
gPokedexView->unk0[gPokedexView->unk60C].dexNum = vars[2];
gPokedexView->unk0[gPokedexView->unk60C].seen = 1;
diff --git a/src/script_menu.c b/src/script_menu.c
index 50941f9ac..d6e328eb4 100644
--- a/src/script_menu.c
+++ b/src/script_menu.c
@@ -684,7 +684,7 @@ void sub_80B52B4(u8 taskId)
{
gScriptResult = var;
}
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(gTasks[taskId].data[0], gTasks[taskId].data[1], gTasks[taskId].data[2], gTasks[taskId].data[3]);
DestroyTask(taskId);
EnableBothScriptContexts();
@@ -847,7 +847,7 @@ void sub_80B5684(u8 taskId)
{
gScriptResult = var;
}
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(gTasks[taskId].data[0], gTasks[taskId].data[1], gTasks[taskId].data[2], gTasks[taskId].data[3]);
DestroyTask(taskId);
EnableBothScriptContexts();
diff --git a/src/script_pokemon_util_80C4BF0.c b/src/script_pokemon_util_80C4BF0.c
index d111cf8f6..abc4dbc9e 100644
--- a/src/script_pokemon_util_80C4BF0.c
+++ b/src/script_pokemon_util_80C4BF0.c
@@ -560,16 +560,16 @@ u8 ScriptGiveMon(u16 species, u8 var, u16 item, u32 var3, u32 var4, u8 var5)
nationalSpecies = SpeciesToNationalPokedexNum(species);
// nested if check to fool compiler
- if(sentToPc < 2)
+ switch(sentToPc)
{
- if(sentToPc >= 0)
- {
- // set both the seen and caught flags
- sub_8090D90(nationalSpecies, 2);
- sub_8090D90(nationalSpecies, 3);
- }
+ case 0:
+ case 1:
+ GetNationalPokedexFlag(nationalSpecies, 2);
+ GetNationalPokedexFlag(nationalSpecies, 3);
+ return sentToPc;
+ default:
+ return sentToPc;
}
- return sentToPc;
}
u8 ScriptGiveEgg(u16 value)
diff --git a/src/shop.c b/src/shop.c
index 81c403e92..cd39b075a 100644
--- a/src/shop.c
+++ b/src/shop.c
@@ -154,7 +154,7 @@ void sub_80B2F30(u8 taskId)
void HandleShopMenuQuit(u8 taskId)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
MenuZeroFillWindowRect(0, 0, 11, 8);
sub_80BE3BC(); // in tv.s?
ScriptContext2_Disable();
diff --git a/src/start_menu.c b/src/start_menu.c
index a3258bab1..80080cd43 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -399,7 +399,7 @@ static u8 StartMenu_PlayerCallback(void)
//When player selects SAVE
static u8 StartMenu_SaveCallback(void)
{
- sub_8072DEC();
+ HandleDestroyMenuCursors();
gCallback_03004AE8 = SaveCallback1;
return 0;
}
diff --git a/src/strings.c b/src/strings.c
index f41af082c..fa083f00d 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -1149,7 +1149,7 @@ const u8 gOtherText_OkayToThrowAwayPrompt[] = _("Willst du wirklich\n{STR_VAR_2}
const u8 gOtherText_DadsAdvice[] = _("VATI sagt immer...\n{PLAYER}, dies ist weder der rechte\lOrt noch der rechte Zeitpunkt dafür!{PAUSE_UNTIL_PRESS}");
const u8 gOtherText_CantGetOffBike[] = _("Du kannst hier nicht vom RAD steigen.{PAUSE_UNTIL_PRESS}");
const u8 gOtherText_ItemfinderResponding[] = _("Oh!\nDas Gerät zeigt etwas an!\pHier muss ein Item vergraben sein!{PAUSE_UNTIL_PRESS}");
-const u8 gOtherText_ItemfinderItemUnderfoot[] = _("Das Gerät macht direkt unter\ndeinen Füßen etwas aus!{PAUSE_UNTIL_PRESS}");
+const u8 gOtherText_ItemfinderItemUnderfoot[] = _("Das Gerät macht direkt unter\ndeinen Füßen etwas aus!{PAUSE_UNTIL_PRESS}");
const u8 gOtherText_NoResponse[] = _("... ... ... ... Nichts!\nKeine Anzeige.{PAUSE_UNTIL_PRESS}");
const u8 gOtherText_Coins3[] = _("Deine MÜNZEN:\n{STR_VAR_1}{PAUSE_UNTIL_PRESS}");
const u8 gOtherText_BootedTM[] = _("Eine TM wurde aktiviert.");
diff --git a/src/tv.c b/src/tv.c
index 33f4e5b9a..76d9d1836 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -1774,7 +1774,7 @@ u16 sub_80BF674(u16 species)
u16 cspecies;
rspecies = (Random() % (NUM_SPECIES - 1)) + 1;
cspecies = rspecies;
- while ((s8)sub_8090D90(SpeciesToNationalPokedexNum(cspecies), 0) != 1 || cspecies == species) {
+ while ((s8)GetNationalPokedexFlag(SpeciesToNationalPokedexNum(cspecies), 0) != 1 || cspecies == species) {
if (cspecies == SPECIES_BULBASAUR)
cspecies = NUM_SPECIES - 1;
else
@@ -2718,7 +2718,7 @@ void sub_80C03A8(u8 showidx) {
}
void sub_80C03C8(u16 species, u8 showidx) {
- if (!sub_8090D90(SpeciesToNationalPokedexNum(species), 0)) {
+ if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(species), 0) == 0) {
gSaveBlock1.tvShows[showidx].common.var01 = 0;
}
}
diff --git a/src/wallclock.c b/src/wallclock.c
index 0b9948adc..d55d14edb 100644
--- a/src/wallclock.c
+++ b/src/wallclock.c
@@ -434,7 +434,7 @@ static void Task_SetClock4(u8 taskId)
return;
case -1: //B button
case 1: //NO
- sub_8072DEC();
+ HandleDestroyMenuCursors();
PlaySE(SE_SELECT);
MenuZeroFillWindowRect(23, 8, 29, 13);
MenuZeroFillWindowRect(2, 16, 27, 19);