summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-06-10 11:01:29 -0500
committerMarcus Huderle <huderlem@gmail.com>2018-06-10 11:09:57 -0500
commit2e80477ea11c265e69658b852c57097fd8a21492 (patch)
tree3df0755d3a2468805117b4ff8f34d10f53df3734 /src
parentc5bcb67bb871a445b20bbc0c226bc290dc5ba6bc (diff)
Label move_tutor_menu.c
Diffstat (limited to 'src')
-rw-r--r--src/battle/battle_records.c2
-rw-r--r--src/berry_blender.c28
-rw-r--r--src/choose_party.c4
-rw-r--r--src/clear_save_data_menu.c2
-rw-r--r--src/debug/mori_debug_menu.c4
-rw-r--r--src/debug/sound_check_menu.c4
-rw-r--r--src/debug/start_menu_debug.c2
-rw-r--r--src/debug/watanabe_debug_menu.c2
-rw-r--r--src/decoration.c10
-rw-r--r--src/diploma.c2
-rw-r--r--src/easy_chat_2.c2
-rw-r--r--src/field_effect.c8
-rw-r--r--src/field_message_box.c2
-rw-r--r--src/field_screen_effect.c2
-rw-r--r--src/item_menu.c18
-rw-r--r--src/learn_move.c1066
-rw-r--r--src/link.c4
-rw-r--r--src/mail.c4
-rw-r--r--src/main_menu.c12
-rw-r--r--src/mauville_man.c2
-rw-r--r--src/menu.c22
-rw-r--r--src/money.c2
-rw-r--r--src/move_tutor_menu.c1063
-rw-r--r--src/mystery_event_menu.c8
-rw-r--r--src/overworld.c12
-rw-r--r--src/party_menu.c4
-rw-r--r--src/player_pc.c2
-rw-r--r--src/pokeblock.c6
-rw-r--r--src/pokemon_3.c12
-rw-r--r--src/pokemon_storage_system_4.c6
-rw-r--r--src/pokemon_summary_screen.c22
-rw-r--r--src/pokenav_before.c2
-rw-r--r--src/reset_rtc_screen.c8
-rw-r--r--src/roulette.c2
-rw-r--r--src/save_failed_screen.c2
-rw-r--r--src/script_menu.c2
-rw-r--r--src/secret_base.c4
-rw-r--r--src/start_menu.c8
-rw-r--r--src/starter_choose.c6
-rw-r--r--src/strings.c4
-rw-r--r--src/text.c12
-rw-r--r--src/trade.c4
-rw-r--r--src/trainer_card.c6
-rw-r--r--src/wallclock.c2
44 files changed, 1199 insertions, 1202 deletions
diff --git a/src/battle/battle_records.c b/src/battle/battle_records.c
index 4375fc32f..fed8d6575 100644
--- a/src/battle/battle_records.c
+++ b/src/battle/battle_records.c
@@ -335,7 +335,7 @@ static void PrintWinStreak(const u8 *str, u16 streak, u8 left, u8 top)
Menu_PrintText(str, left, top);
if (streak > 9999)
streak = 9999;
- sub_8072C14(gStringVar1, streak, 24, 1);
+ AlignInt1InMenuWindow(gStringVar1, streak, 24, 1);
Menu_PrintText(gOtherText_WinStreak, left + 7, top);
}
diff --git a/src/berry_blender.c b/src/berry_blender.c
index 50c9aa700..4531ea546 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -3014,24 +3014,24 @@ bool8 Blender_PrintBlendingResults(void)
textPtr[1] = CHAR_PERIOD;
textPtr[2] = CHAR_SPACE;
textPtr += 3;
- textPtr = sub_8072C74(textPtr, gLinkPlayers[place].name, 88, 0);
- sub_8072C74(textPtr, text[0], 157, 0);
+ textPtr = AlignStringInMenuWindow(textPtr, gLinkPlayers[place].name, 88, 0);
+ AlignStringInMenuWindow(textPtr, text[0], 157, 0);
Menu_PrintText(gBerryBlenderData->stringVar, 5, gUnknown_082165E9[gBerryBlenderData->playersNo] + (i * gUnknown_082165EE[gBerryBlenderData->playersNo]));
}
ConvertIntToDecimalStringN(text[0], gBerryBlenderData->max_RPM % 100, 2, 2);
textPtr = gBerryBlenderData->stringVar;
textPtr = StringCopy(textPtr, gOtherText_MaxSpeed);
- textPtr = sub_8072C14(textPtr, gBerryBlenderData->max_RPM / 100, 121, 1);
+ textPtr = AlignInt1InMenuWindow(textPtr, gBerryBlenderData->max_RPM / 100, 121, 1);
#ifdef ENGLISH
textPtr[0] = CHAR_SPACE;
textPtr[1] = CHAR_PERIOD;
textPtr[2] = CHAR_SPACE;
textPtr += 3;
- textPtr = sub_8072C74(textPtr, text[0], 142, 1);
+ textPtr = AlignStringInMenuWindow(textPtr, text[0], 142, 1);
#else
*textPtr++ = CHAR_COMMA;
- textPtr = sub_8072C74(textPtr, text[0], 136, 1);
+ textPtr = AlignStringInMenuWindow(textPtr, text[0], 136, 1);
#endif
StringCopy(textPtr, gOtherText_RPM);
Menu_PrintText(gBerryBlenderData->stringVar, 5, 13);
@@ -3045,13 +3045,13 @@ bool8 Blender_PrintBlendingResults(void)
textPtr = StringCopy(textPtr, gOtherText_RequiredTime);
#ifdef ENGLISH
- textPtr = sub_8072C74(textPtr, text[0], 102, 1);
+ textPtr = AlignStringInMenuWindow(textPtr, text[0], 102, 1);
#else
- textPtr = sub_8072C74(textPtr, text[0], 99, 1);
+ textPtr = AlignStringInMenuWindow(textPtr, text[0], 99, 1);
#endif
textPtr = StringAppend(textPtr, gOtherText_Min);
- textPtr = sub_8072C74(textPtr, text[1], 136, 1);
+ textPtr = AlignStringInMenuWindow(textPtr, text[1], 136, 1);
StringCopy(textPtr, gOtherText_Sec);
Menu_PrintText(gBerryBlenderData->stringVar, 5, 15);
@@ -3222,9 +3222,9 @@ static bool8 Blender_PrintBlendingRanking(void)
txtPtr = StringCopy(txtPtr, gLinkPlayers[place].name);
- txtPtr = sub_8072C14(txtPtr, gBerryBlenderData->scores[place][BLENDER_SCORE_BEST], 108, 1);
- txtPtr = sub_8072C14(txtPtr, gBerryBlenderData->scores[place][BLENDER_SCORE_GOOD], 132, 1);
- txtPtr = sub_8072C14(txtPtr, gBerryBlenderData->scores[place][BLENDER_SCORE_MISS], 156, 1);
+ txtPtr = AlignInt1InMenuWindow(txtPtr, gBerryBlenderData->scores[place][BLENDER_SCORE_BEST], 108, 1);
+ txtPtr = AlignInt1InMenuWindow(txtPtr, gBerryBlenderData->scores[place][BLENDER_SCORE_GOOD], 132, 1);
+ txtPtr = AlignInt1InMenuWindow(txtPtr, gBerryBlenderData->scores[place][BLENDER_SCORE_MISS], 156, 1);
Menu_PrintText(gBerryBlenderData->stringVar, 5, i * gUnknown_082165F3[gBerryBlenderData->playersNo] + 8);
}
@@ -3257,8 +3257,8 @@ void debug_sub_80524BC(void)
FreeAllSpritePalettes();
ResetTasks();
SetVBlankCallback(VBlankCB1_BerryBlender);
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
SeedRng(gMain.vblankCounter1);
REG_DISPCNT = 0x1540;
RunTasks();
@@ -3503,7 +3503,7 @@ void ShowBerryBlenderRecordWindow(void)
for (i = 0; i < 3; i++)
{
u32 record = gSaveBlock1.berryBlenderRecords[i];
- u8* txtPtr = sub_8072C14(text, record / 100, 18, 1);
+ u8* txtPtr = AlignInt1InMenuWindow(text, record / 100, 18, 1);
#ifdef ENGLISH
txtPtr[0] = CHAR_SPACE;
diff --git a/src/choose_party.c b/src/choose_party.c
index 6f1481c45..8aef949cb 100644
--- a/src/choose_party.c
+++ b/src/choose_party.c
@@ -230,7 +230,7 @@ static const struct MenuAction2 sBattleTowerEntryMenuItems[] =
{OtherText_Summary, BattleTowerEntryMenuCallback_Summary},
{OtherText_Enter2, BattleTowerEntryMenuCallback_Enter},
{OtherText_NoEntry, BattleTowerEntryMenuCallback_NoEntry},
- {gUnknownText_Exit, BattleTowerEntryMenuCallback_Exit},
+ {gOtherText_Exit, BattleTowerEntryMenuCallback_Exit},
};
static const u8 gUnknown_084017D0[] = {1, 0, 3};
@@ -780,7 +780,7 @@ static const struct MenuAction2 sDaycareStorageMenuItems[] =
{
{OtherText_Store, DaycareStorageMenuCallback_Store},
{OtherText_Summary, DaycareStorageMenuCallback_Summary},
- {gUnknownText_Exit, DaycareStorageMenuCallback_Exit},
+ {gOtherText_Exit, DaycareStorageMenuCallback_Exit},
};
static const u8 gUnknown_08401808[] = {0, 1, 2};
diff --git a/src/clear_save_data_menu.c b/src/clear_save_data_menu.c
index b7f648887..05130a214 100644
--- a/src/clear_save_data_menu.c
+++ b/src/clear_save_data_menu.c
@@ -134,7 +134,7 @@ static u8 InitClearSaveDataScreen(void)
ResetSpriteData();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, FADE_COLOR_WHITE);
ime = REG_IME;
diff --git a/src/debug/mori_debug_menu.c b/src/debug/mori_debug_menu.c
index 767f4cda0..4f798ecb3 100644
--- a/src/debug/mori_debug_menu.c
+++ b/src/debug/mori_debug_menu.c
@@ -2,7 +2,7 @@
#include "mori_debug_menu.h"
#include "data2.h"
#include "daycare.h"
-#include "learn_move.h"
+#include "move_tutor_menu.h"
#include "link.h"
#include "main.h"
#include "menu.h"
@@ -136,7 +136,7 @@ u8 MoriDebugMenu_10000Steps(void)
u8 MoriDebugMenu_MoveTutor(void)
{
- TeachMoveTutorMove();
+ DisplayMoveTutorMenu();
CloseMenu();
return 1;
}
diff --git a/src/debug/sound_check_menu.c b/src/debug/sound_check_menu.c
index 935f5cd67..1fcf52f38 100644
--- a/src/debug/sound_check_menu.c
+++ b/src/debug/sound_check_menu.c
@@ -133,7 +133,7 @@ void CB2_StartSoundCheckMenu(void)
ResetTasks();
ResetSpriteData();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
REG_WIN0H = WIN_RANGE(0, 0);
REG_WIN0V = WIN_RANGE(0, 0);
@@ -1218,7 +1218,7 @@ void Task_InitCryTest(u8 taskId)
u8 zero;
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
gSoundTestCryNum = 1;
ResetSpriteData();
FreeAllSpritePalettes();
diff --git a/src/debug/start_menu_debug.c b/src/debug/start_menu_debug.c
index b16b15a0a..1f0cb5f60 100644
--- a/src/debug/start_menu_debug.c
+++ b/src/debug/start_menu_debug.c
@@ -685,7 +685,7 @@ void DebugMenu_8077048(void)
u8 DebugMenu_807706C(void)
{
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
DebugMenu_8077004();
DebugMenu_807719C();
DebugMenu_80771EC();
diff --git a/src/debug/watanabe_debug_menu.c b/src/debug/watanabe_debug_menu.c
index 86b8f6b0b..ed6a1d18d 100644
--- a/src/debug/watanabe_debug_menu.c
+++ b/src/debug/watanabe_debug_menu.c
@@ -210,7 +210,7 @@ void debug_80C35DC(void)
LoadSpriteSheet(stru_83F8828);
LoadSpritePalette(stru_83F8838);
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
}
void debug_80C36F4(void)
diff --git a/src/decoration.c b/src/decoration.c
index 96cf61548..e31624540 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -1411,7 +1411,7 @@ const struct MenuAction2 gUnknown_083EC604[] = {
{SecretBaseText_Decorate, sub_80FF160},
{SecretBaseText_PutAway, sub_8100A0C},
{SecretBaseText_Toss, sub_8101700},
- {gUnknownText_Exit, gpu_pal_decompress_alloc_tag_and_upload}
+ {gOtherText_Exit, gpu_pal_decompress_alloc_tag_and_upload}
};
const u8 *const gUnknown_083EC624[] = {
@@ -1556,9 +1556,9 @@ void sub_80FE470(u8 decoCat, u8 left, u8 top, u8 palIdx) // PrintDecorationCateg
strptr[2] = palIdx;
strptr += 3;
strptr = StringCopy(strptr, gUnknown_083EC5E4[decoCat]);
- strptr = sub_8072C14(strptr, GetNumDecorationsInInventoryCategory(decoCat), 0x56, 1);
+ strptr = AlignInt1InMenuWindow(strptr, GetNumDecorationsInInventoryCategory(decoCat), 0x56, 1);
*strptr++ = 0xba;
- strptr = sub_8072C14(strptr, gDecorationInventories[decoCat].size, 0x68, 1);
+ strptr = AlignInt1InMenuWindow(strptr, gDecorationInventories[decoCat].size, 0x68, 1);
strptr[0] = EXT_CTRL_CODE_BEGIN;
strptr[1] = 5;
strptr[2] = v0;
@@ -1580,7 +1580,7 @@ void sub_80FE528(u8 taskId) // PrintDecorationCategorySelectionMenuStrings
sub_80FE470(decoCat, 1, 2 * decoCat + 1, 255); // Unselectable
}
}
- Menu_PrintText(gUnknownText_Exit, 1, 17);
+ Menu_PrintText(gOtherText_Exit, 1, 17);
}
void sub_80FE5AC(u8 taskId)
@@ -1806,7 +1806,7 @@ void sub_80FEABC(u8 taskId, u8 dummy1)
}
if (i == gUnknown_020388D5)
{
- sub_8072A18(gUnknownText_Exit, 0x08, 8 * ni, 0x68, 1);
+ sub_8072A18(gOtherText_Exit, 0x08, 8 * ni, 0x68, 1);
break;
}
if (gUnknown_020388D0[i])
diff --git a/src/diploma.c b/src/diploma.c
index a6026d423..5a1e1254b 100644
--- a/src/diploma.c
+++ b/src/diploma.c
@@ -69,7 +69,7 @@ void CB2_ShowDiploma(void)
FreeAllSpritePalettes();
LoadPalette(gDiplomaPalettes, 0, 64);
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
DisplayDiplomaText();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
diff --git a/src/easy_chat_2.c b/src/easy_chat_2.c
index 530c2ae5e..7cf4d87b9 100644
--- a/src/easy_chat_2.c
+++ b/src/easy_chat_2.c
@@ -1182,7 +1182,7 @@ void sub_80E9368(u8 a)
gEasyChatStruct->unk9F8E[2] = 1;
if (r4 != NULL)
{
- sub_8072C74(gEasyChatStruct->unk9F8E + 3, r4, 240, 2);
+ AlignStringInMenuWindow(gEasyChatStruct->unk9F8E + 3, r4, 240, 2);
Menu_PrintText(gEasyChatStruct->unk9F8E, 0, 0);
}
else
diff --git a/src/field_effect.c b/src/field_effect.c
index 93a97aa7f..8c00476d7 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -2438,8 +2438,8 @@ void sub_8088380(struct Task *task)
IntrCallback callback;
LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&callback);
SetVBlankCallback(callback);
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
FreeResourcesAndDestroySprite(&gSprites[task->data[15]]);
FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON);
DestroyTask(FindTaskIdByFunc(sub_8088120));
@@ -2561,8 +2561,8 @@ void sub_808862C(struct Task *task)
CpuFill32(0, (void *)VRAM + bg0cnt, 0x800);
LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&intrCallback);
SetVBlankCallback(intrCallback);
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
FreeResourcesAndDestroySprite(&gSprites[task->data[15]]);
FieldEffectActiveListRemove(FLDEFF_FIELD_MOVE_SHOW_MON);
DestroyTask(FindTaskIdByFunc(sub_808847C));
diff --git a/src/field_message_box.c b/src/field_message_box.c
index 5eec7a14b..44fd4ac49 100644
--- a/src/field_message_box.c
+++ b/src/field_message_box.c
@@ -20,7 +20,7 @@ void InitFieldMessageBox(void)
{
sMessageBoxMode = FIELD_MESSAGE_BOX_HIDDEN;
TextWindow_SetDlgFrameBaseTileNum(gMenuTextWindowContentTileOffset);
- Text_InitWindowWithTemplate(&gFieldMessageBoxWindow, &gWindowTemplate_81E6CE4);
+ Text_InitWindowWithTemplate(&gFieldMessageBoxWindow, &gMenuTextWindowTemplate);
}
static void Task_FieldMessageBox(u8 taskId)
diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c
index 61301c5a9..b314699c5 100644
--- a/src/field_screen_effect.c
+++ b/src/field_screen_effect.c
@@ -265,7 +265,7 @@ static void sub_80816A8(u8 taskId)
break;
case 5:
Menu_EraseWindowRect(0, 0, 29, 19);
- LoadFontDefaultPalette(&gWindowTemplate_81E6CE4);
+ LoadFontDefaultPalette(&gMenuTextWindowTemplate);
REG_WIN0H = 255;
REG_DISPCNT = data[6];
REG_BLDCNT = data[7];
diff --git a/src/item_menu.c b/src/item_menu.c
index da77760dd..5fbfb775e 100644
--- a/src/item_menu.c
+++ b/src/item_menu.c
@@ -1115,9 +1115,9 @@ static void sub_80A41E0(u8 *a, u16 b, const u8 *c, u16 d, u8 e)
a[1] = 0x13;
a[2] = 0x18;
a += 3;
- a = sub_8072C74(a, c, 0x78 - (e + 1) * 6, 0);
+ a = AlignStringInMenuWindow(a, c, 0x78 - (e + 1) * 6, 0);
*a++ = CHAR_MULT_SIGN;
- sub_8072C14(a, d, 0x78, 1);
+ AlignInt1InMenuWindow(a, d, 0x78, 1);
}
static u8 *sub_80A425C(u8 taskId, u8 *text, u8 c)
@@ -1145,7 +1145,7 @@ static bool8 sub_80A42B0(u8 itemPos, int b)
if (sReturnLocation == RETURN_TO_FIELD_5)
return TRUE;
r5 = itemPos * 2 + 2;
- sub_8072C74(gStringVar1, gOtherText_CloseBag, 0x78, 0);
+ AlignStringInMenuWindow(gStringVar1, gOtherText_CloseBag, 0x78, 0);
Menu_PrintText(gStringVar1, 14, r5);
ptr = gBGTilemapBuffers[2] + 14 + r5 * 32;
ptr[0] = 0x4F;
@@ -1179,9 +1179,9 @@ static void sub_80A4380(u16 a, int b, int c, int d)
r5 = i * 2 + 2;
text = gStringVar1;
text = sub_80A425C(a, text, i);
- text = sub_8072C74(text, ItemId_GetName(gCurrentBagPocketItemSlots[r4].itemId), 0x66, 0);
+ text = AlignStringInMenuWindow(text, ItemId_GetName(gCurrentBagPocketItemSlots[r4].itemId), 0x66, 0);
*text++ = CHAR_MULT_SIGN;
- sub_8072C14(text, gCurrentBagPocketItemSlots[r4].quantity, 0x78, 1);
+ AlignInt1InMenuWindow(text, gCurrentBagPocketItemSlots[r4].quantity, 0x78, 1);
Menu_PrintText(gStringVar1, 14, r5);
}
}
@@ -1203,9 +1203,9 @@ static void sub_80A444C(u16 a, int b, int c, int d)
text = gStringVar1;
text = sub_80A425C(a, text, i);
#if ENGLISH
- sub_8072C74(text, ItemId_GetName(gCurrentBagPocketItemSlots[slot].itemId), 0x60, 0);
+ AlignStringInMenuWindow(text, ItemId_GetName(gCurrentBagPocketItemSlots[slot].itemId), 0x60, 0);
#else
- sub_8072C74(text, ItemId_GetName(gCurrentBagPocketItemSlots[slot].itemId), 0x63, 0);
+ AlignStringInMenuWindow(text, ItemId_GetName(gCurrentBagPocketItemSlots[slot].itemId), 0x63, 0);
#endif
Menu_PrintText(gStringVar1, 14, r5);
if (gUnknown_02038558)
@@ -1272,7 +1272,7 @@ static void sub_80A4548(u16 a, int b, int c, int d)
text[2] = 0x18;
text += 3;
moveName = gMoveNames[ItemIdToBattleMoveId(gCurrentBagPocketItemSlots[r4].itemId)];
- sub_8072C74(text, moveName, 0x78, 0);
+ AlignStringInMenuWindow(text, moveName, 0x78, 0);
}
Menu_PrintText(gStringVar1, 14, sp10);
}
@@ -1450,7 +1450,7 @@ _080A4634:\n\
adds r0, r6, 0\n\
movs r2, 0x78\n\
movs r3, 0\n\
- bl sub_8072C74\n\
+ bl AlignStringInMenuWindow\n\
_080A46AE:\n\
ldr r0, _080A46F8 @ =gStringVar1\n\
movs r1, 0xE\n\
diff --git a/src/learn_move.c b/src/learn_move.c
deleted file mode 100644
index 17cdbf54e..000000000
--- a/src/learn_move.c
+++ /dev/null
@@ -1,1066 +0,0 @@
-#include "global.h"
-#include "contest.h"
-#include "data2.h"
-#include "field_fadetransition.h"
-#include "main.h"
-#include "menu.h"
-#include "menu_cursor.h"
-#include "learn_move.h"
-#include "palette.h"
-#include "pokemon.h"
-#include "pokemon_summary_screen.h"
-#include "overworld.h"
-#include "script.h"
-#include "constants/songs.h"
-#include "sound.h"
-#include "sprite.h"
-#include "string_util.h"
-#include "strings.h"
-#include "strings2.h"
-#include "task.h"
-#include "trig.h"
-#include "ewram.h"
-
-extern u16 gSpecialVar_0x8004;
-extern u16 gSpecialVar_0x8005;
-extern u8 gTileBuffer[];
-
-extern const struct WindowTemplate gWindowTemplate_81E6CE4;
-extern const struct WindowTemplate gWindowTemplate_81E7240;
-extern const u8 *const gContestEffectStrings[];
-extern const u8 *const gMoveDescriptions[];
-extern const u8 gTypeNames[][7];
-extern const u8 *const gUnknown_083CAF70[];
-
-#ifdef GERMAN
-extern const u8 deuOtherText_ForgotAndLearned[];
-#endif
-
-
-struct LearnMoveStruct
-{
- u8 state;
- u8 filler1;
- u8 unk2;
- u8 spriteIDs[20];
- u8 filler17[1];
- u8 unk18;
- u8 unk19;
- u8 numMenuChoices;
- u8 menuSelection;
- u8 unk1C;
- bool8 unk1D;
- u8 unk1E;
- u8 filler1F;
- /*0x020*/ u16 movesToLearn[20];
- u8 filler48[0x52-0x48];
- u8 moveNames[6][0x19];
- u8 fillerE8[0x2C3-0xE8];
- bool8 unk2C3;
- bool8 showContestInfo;
- /*0x2C5*/ u8 partyMon;
- u8 unk2C6;
-};
-
-static struct LearnMoveStruct *sLearnMoveStruct;
-
-const u16 gDexArrows_Pal[] = INCBIN_U16("graphics/pokedex/arrows.gbapal");
-
-const u8 gDexArrows_Gfx[] = INCBIN_U8("graphics/pokedex/arrows.4bpp");
-
-const u8 gUnknown_08402CF8[][4] =
-{
- { 0, 0, 9, 13},
- {10, 0, 29, 7},
- { 2, 14, 27, 19},
- {10, 8, 29, 13},
-};
-
-struct UnknownStruct1
-{
- const u8 *unk0;
- u8 unk4;
- u8 unk5;
- u8 unk6;
-};
-
-const struct UnknownStruct1 gUnknown_08402D08[][4] =
-{
- {
- {OtherText_Battle, 1, 1, 0},
- {OtherText_Power, 1, 4, 1},
- {OtherText_Accuracy, 1, 9, 2},
- {NULL, 0, 0, 0},
- },
- {
- {OtherText_Contest, 1, 1, 0},
- {OtherText_Appeal, 1, 4, 1},
- {OtherText_Jam, 1, 9, 2},
- {NULL, 0, 0, 0},
- },
-};
-
-// XXX: What are these for?
-const u32 unkDataFF00FFEF = 0xFF00FFEF;
-const u8 *const gTileBuffer_ = gTileBuffer;
-
-const struct OamData gOamData_8402D50 = {.shape = 0};
-const struct OamData gOamData_8402D58 = {.shape = 2};
-const struct OamData gOamData_8402D60 = {.shape = 1};
-
-const union AnimCmd gSpriteAnim_8402D68[] =
-{
- ANIMCMD_FRAME(2, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd gSpriteAnim_8402D70[] =
-{
- ANIMCMD_FRAME(0, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd *const gSpriteAnimTable_8402D78[] =
-{
- gSpriteAnim_8402D68,
- gSpriteAnim_8402D70,
-};
-
-const struct SpriteSheet gUnknown_08402D80 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525};
-const struct SpritePalette gUnknown_08402D88 = {gDexArrows_Pal, 5526};
-
-void sub_8133300(struct Sprite *);
-const struct SpriteTemplate gSpriteTemplate_8402D90 =
-{
- .tileTag = 5525,
- .paletteTag = 5526,
- .oam = &gOamData_8402D58,
- .anims = gSpriteAnimTable_8402D78,
- .images = NULL,
- .affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8133300,
-};
-
-const union AnimCmd gSpriteAnim_8402DA8[] =
-{
- ANIMCMD_FRAME(4, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd gSpriteAnim_8402DB0[] =
-{
- ANIMCMD_FRAME(6, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd *const gSpriteAnimTable_8402DB8[] =
-{
- gSpriteAnim_8402DA8,
- gSpriteAnim_8402DB0,
-};
-
-const struct SpriteTemplate gSpriteTemplate_8402DC0 =
-{
- .tileTag = 5525,
- .paletteTag = 5526,
- .oam = &gOamData_8402D60,
- .anims = gSpriteAnimTable_8402DB8,
- .images = NULL,
- .affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8133300,
-};
-
-const union AnimCmd gSpriteAnim_8402DD8[] =
-{
- ANIMCMD_FRAME(8, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd gSpriteAnim_8402DE0[] =
-{
- ANIMCMD_FRAME(9, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd gSpriteAnim_8402DE8[] =
-{
- ANIMCMD_FRAME(10, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd gSpriteAnim_8402DF0[] =
-{
- ANIMCMD_FRAME(11, 5),
- ANIMCMD_END,
-};
-
-const union AnimCmd *const gSpriteAnimTable_8402DF8[] =
-{
- gSpriteAnim_8402DD8,
- gSpriteAnim_8402DE0,
- gSpriteAnim_8402DE8,
- gSpriteAnim_8402DF0,
-};
-
-const struct SpriteTemplate gSpriteTemplate_8402E08 =
-{
- .tileTag = 5525,
- .paletteTag = 5526,
- .oam = &gOamData_8402D50,
- .anims = gSpriteAnimTable_8402DF8,
- .images = NULL,
- .affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8133300,
-};
-
-const u8 gString_AkitoMori[] = _("あきと"); // programmer Akito Mori?
-
-void sub_813269C(u8);
-void CB2_InitLearnMove(void);
-void CB2_LearnMove(void);
-void LearnMoveMain(void);
-void DrawLearnMoveMenuWindow(void);
-void sub_8133030(bool8);
-u8 sub_81330E8(void);
-void sub_8133140(u8);
-u8 sub_8133248(void);
-void ClearLearnMoveVars(void);
-void sub_8133358(void);
-void sub_8133558(void);
-void sub_813362C(void);
-void sub_8133800(void);
-void sub_8133AEC(bool8, int);
-void sub_8133CA4(void);
-
-void VBlankCB_LearnMove(void)
-{
- LoadOam();
- ProcessSpriteCopyRequests();
- TransferPlttBuffer();
-}
-
-void TeachMoveTutorMove(void)
-{
- ScriptContext2_Enable();
- CreateTask(sub_813269C, 10);
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
-}
-
-void sub_813269C(u8 taskId)
-{
- if (!gPaletteFade.active)
- {
- SetMainCallback2(CB2_InitLearnMove);
- gFieldCallback = sub_8080990;
- DestroyTask(taskId);
- }
-}
-
-void CB2_InitLearnMove(void)
-{
- REG_DISPCNT = 0;
- ResetSpriteData();
- FreeAllSpritePalettes();
- ResetTasks();
- sLearnMoveStruct = eLearnMoveStruct;
- ClearLearnMoveVars();
- sLearnMoveStruct->partyMon = gSpecialVar_0x8004;
- sub_8133558();
- SetVBlankCallback(VBlankCB_LearnMove);
-
- Text_LoadWindowTemplate(&gWindowTemplate_81E7240);
- InitMenuWindow(&gWindowTemplate_81E7240);
- Menu_EraseScreen();
-
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
- Menu_EraseScreen();
-
- REG_BG0VOFS = 0;
- REG_BG0VOFS = 0; // huh?
- REG_BG1HOFS = 0;
- REG_BG1HOFS = 0; // huh?
-
- LoadSpriteSheet(&gUnknown_08402D80);
- LoadSpritePalette(&gUnknown_08402D88);
- sub_8133358();
- FillPalette(0, 0, 2);
- RunTasks();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
- SetMainCallback2(CB2_LearnMove);
-}
-
-void sub_81327A4(void)
-{
- ResetSpriteData();
- FreeAllSpritePalettes();
- ResetTasks();
- sLearnMoveStruct = eLearnMoveStruct;
- sub_8133558();
- sLearnMoveStruct->unk2C6 = gSpecialVar_0x8005;
- SetVBlankCallback(VBlankCB_LearnMove);
-
- Text_LoadWindowTemplate(&gWindowTemplate_81E7240);
- InitMenuWindow(&gWindowTemplate_81E7240);
- Menu_EraseScreen();
-
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
- Menu_EraseScreen();
-
- REG_DISPCNT = 0x1340;
- REG_BG0VOFS = 0;
- REG_BG0HOFS = 0;
- REG_BG1HOFS = 0;
- REG_BG1HOFS = 0; // huh?
-
- LoadSpriteSheet(&gUnknown_08402D80);
- LoadSpritePalette(&gUnknown_08402D88);
- sub_8133358();
- FillPalette(0, 0, 2);
- RunTasks();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
- SetMainCallback2(CB2_LearnMove);
-}
-
-void CB2_LearnMove(void)
-{
- LearnMoveMain();
- if (sLearnMoveStruct->unk1D)
- {
- sLearnMoveStruct->unk1D = FALSE;
- MenuCursor_SetPos814AD7C(0x58, (sLearnMoveStruct->unk18 * 2 + 1) * 8);
- }
- if (sLearnMoveStruct->unk1E != 0)
- {
- sLearnMoveStruct->unk1E = 0;
- sub_8133800();
- }
- if (sLearnMoveStruct->unk2C3)
- {
- sub_8133AEC(sLearnMoveStruct->showContestInfo, 1);
- sLearnMoveStruct->unk2C3 = FALSE;
- }
- RunTasks();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
-}
-
-void sub_81328E8(const u8 *a)
-{
- StringExpandPlaceholders(gStringVar4, a);
- MenuPrintMessage(gStringVar4, 3, 15);
-}
-
-void LearnMoveMain(void)
-{
- switch (sLearnMoveStruct->state)
- {
- case 0:
- sLearnMoveStruct->state++;
- DrawLearnMoveMenuWindow();
- sub_8133030(FALSE);
- sub_8133800();
- gSprites[1].pos1.x = 0x48;
- sLearnMoveStruct->unk2C3 = TRUE;
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
- REG_DISPCNT = 0x1340;
- break;
- case 1:
- if (!gPaletteFade.active)
- sLearnMoveStruct->state = 4;
- break;
- case 2:
- sLearnMoveStruct->state++;
- break;
- case 3:
- sub_8133030(FALSE);
- sub_8133800();
- sLearnMoveStruct->unk2C3 = TRUE;
- sLearnMoveStruct->state++;
- gSprites[1].pos1.x = 0x48;
- break;
- case 4:
- if (sub_81330E8() == 0)
- sub_813362C();
- return;
- case 5:
- sub_8133140(0);
- sub_8133800();
- sLearnMoveStruct->unk2C3 = TRUE;
- gSprites[1].pos1.x = 0x48;
- sLearnMoveStruct->state++;
- break;
- case 6:
- if (sub_8133248() == 0)
- sub_813362C();
- break;
- case 8:
- if (Menu_UpdateWindowText())
- {
- DisplayYesNoMenu(21, 7, 1);
- sLearnMoveStruct->state++;
- }
- break;
- case 9:
- {
- s8 selection = Menu_ProcessInputNoWrap_();
-
- if (selection == 0)
- {
- sub_8133CA4();
- if (GiveMoveToMon(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->movesToLearn[sLearnMoveStruct->menuSelection]) != 0xFFFF)
- {
- sub_81328E8(gOtherText_PokeLearnedMove);
- gSpecialVar_0x8004 = 1;
- sLearnMoveStruct->state = 31;
- }
- else
- {
- sLearnMoveStruct->state = 16;
- }
- }
- else if (selection == -1 || selection == 1)
- {
- sub_8133CA4();
- if (sLearnMoveStruct->showContestInfo == FALSE)
- sLearnMoveStruct->state = 3;
- if (sLearnMoveStruct->showContestInfo == TRUE)
- sLearnMoveStruct->state = 5;
- }
- }
- break;
- case 12:
- if (Menu_UpdateWindowText())
- {
- DisplayYesNoMenu(21, 7, 1);
- sLearnMoveStruct->state++;
- }
- break;
- case 13:
- {
- s8 selection = Menu_ProcessInputNoWrap_();
-
- if (selection == 0)
- {
- sub_8133CA4();
- gSpecialVar_0x8004 = selection;
- sLearnMoveStruct->state = 14;
- }
- else if (selection == -1 || selection == 1)
- {
- sub_8133CA4();
- if (sLearnMoveStruct->showContestInfo == FALSE)
- sLearnMoveStruct->state = 3;
- if (sLearnMoveStruct->showContestInfo == TRUE)
- sLearnMoveStruct->state = 5;
- }
- }
- break;
- case 16:
- sub_81328E8(gOtherText_DeleteOlderMove);
- sLearnMoveStruct->state++;
- break;
- case 17:
- if (Menu_UpdateWindowText())
- {
- DisplayYesNoMenu(21, 7, 1);
- sLearnMoveStruct->state = 18;
- }
- break;
- case 18:
- {
- s8 var = Menu_ProcessInputNoWrap_();
-
- if (var == 0)
- {
- sub_8133CA4();
- sub_81328E8(gOtherText_WhichMoveToForget);
- sLearnMoveStruct->state = 19;
- }
- else if (var == -1 || var == 1)
- {
- sub_8133CA4();
- sLearnMoveStruct->state = 24;
- }
- }
- break;
- case 24:
- sub_81328E8(gOtherText_StopLearningMove);
- sLearnMoveStruct->state++;
- break;
- case 25:
- if (Menu_UpdateWindowText())
- {
- sLearnMoveStruct->state = 26;
- DisplayYesNoMenu(21, 7, 1);
- }
- break;
- case 26:
- {
- s8 var = Menu_ProcessInputNoWrap_();
-
- if (var == 0)
- {
- sub_8133CA4();
- sLearnMoveStruct->state = 27;
- }
- else if (var == -1 || var == 1)
- {
- sub_8133CA4();
-
- // What's the point? It gets set to 16, anyway.
- if (sLearnMoveStruct->showContestInfo == FALSE)
- sLearnMoveStruct->state = 3;
- if (sLearnMoveStruct->showContestInfo == TRUE)
- sLearnMoveStruct->state = 5;
- sLearnMoveStruct->state = 16;
- }
- }
- break;
- case 27:
- if (Menu_UpdateWindowText())
- {
- if (sLearnMoveStruct->showContestInfo == FALSE)
- sLearnMoveStruct->state = 3;
- if (sLearnMoveStruct->showContestInfo == TRUE)
- sLearnMoveStruct->state = 5;
- }
- break;
- case 19:
- if (Menu_UpdateWindowText())
- {
- sLearnMoveStruct->state = 20;
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
- }
- break;
- case 20:
- if (!gPaletteFade.active)
- {
- ShowSelectMovePokemonSummaryScreen(gPlayerParty, sLearnMoveStruct->partyMon, gPlayerPartyCount - 1, sub_81327A4, sLearnMoveStruct->movesToLearn[sLearnMoveStruct->menuSelection]);
- sLearnMoveStruct->state = 28;
- }
- break;
- case 21:
- if (Menu_UpdateWindowText())
- sLearnMoveStruct->state = 14;
- break;
- case 22:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
- break;
- case 14:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
- sLearnMoveStruct->state++;
- break;
- case 15:
- if (!gPaletteFade.active)
- SetMainCallback2(c2_exit_to_overworld_2_switch);
- break;
- case 28:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
- sLearnMoveStruct->state++;
- DrawLearnMoveMenuWindow();
- sub_8133800();
- if (sLearnMoveStruct->showContestInfo == FALSE)
- sub_8133030(TRUE);
- if (sLearnMoveStruct->showContestInfo == TRUE)
- {
- gSprites[1].pos1.x = 0x48;
- sub_8133140(1);
- }
- sub_8133AEC(sLearnMoveStruct->showContestInfo, 1);
- break;
- case 29:
- if (!gPaletteFade.active)
- {
- if (sLearnMoveStruct->unk2C6 == 4)
- {
- sLearnMoveStruct->state = 24;
- }
- else
- {
- u16 moveId = GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_MOVE1 + sLearnMoveStruct->unk2C6);
-
- StringCopy(gStringVar3, gMoveNames[moveId]);
- RemoveMonPPBonus(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->unk2C6);
- SetMonMoveSlot(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->movesToLearn[sLearnMoveStruct->menuSelection], sLearnMoveStruct->unk2C6);
- StringCopy(gStringVar2, gMoveNames[sLearnMoveStruct->movesToLearn[sLearnMoveStruct->menuSelection]]);
- sub_81328E8(gOtherText_ForgotMove123);
- sLearnMoveStruct->state = 30;
- gSpecialVar_0x8004 = 1;
- }
- }
- break;
- case 30:
- if (Menu_UpdateWindowText())
- {
-#ifdef ENGLISH
- sub_81328E8(gOtherText_ForgotOrDidNotLearnMove);
-#else
- sub_81328E8(deuOtherText_ForgotAndLearned);
-#endif
- sLearnMoveStruct->state = 31;
- PlayFanfare(BGM_FANFA1);
- }
- break;
- case 31:
- if (Menu_UpdateWindowText())
- {
- PlayFanfare(BGM_FANFA1);
- sLearnMoveStruct->state = 32;
- }
- break;
- case 32:
- if (IsFanfareTaskInactive())
- sLearnMoveStruct->state = 33;
- break;
- case 33:
- if (gMain.newKeys & A_BUTTON)
- {
- PlaySE(SE_SELECT);
- sLearnMoveStruct->state = 14;
- }
- break;
- }
-}
-
-void DrawLearnMoveMenuWindow(void)
-{
- u32 i;
-
- BasicInitMenuWindow(&gWindowTemplate_81E7240);
- for (i = 0; i < 4; i++)
- {
- Menu_DrawStdWindowFrame(
- gUnknown_08402CF8[i][0],
- gUnknown_08402CF8[i][1],
- gUnknown_08402CF8[i][2],
- gUnknown_08402CF8[i][3]);
- }
- BasicInitMenuWindow(&gWindowTemplate_81E6CE4);
-}
-
-void sub_8133030(bool8 a)
-{
- s32 i;
-
- gSprites[sLearnMoveStruct->spriteIDs[0]].invisible = FALSE;
- gSprites[sLearnMoveStruct->spriteIDs[1]].invisible = FALSE;
-
- for (i = 0; i < 16; i++)
- gSprites[sLearnMoveStruct->spriteIDs[i + 4]].invisible = TRUE;
-
- for (i = 0; gUnknown_08402D08[0][i].unk0 != NULL; i++)
- {
- sub_8072C74(gTileBuffer, gUnknown_08402D08[0][i].unk0, 64, 2);
- Menu_PrintText(gTileBuffer, gUnknown_08402D08[0][i].unk4, gUnknown_08402D08[0][i].unk5);
- }
-
- if (!a)
- sub_8072AB0(gOtherText_TeachWhichMove, 24, 120, 192, 32, 1);
-}
-
-u8 sub_81330E8(void)
-{
- u32 result = (gMain.newKeys & DPAD_LEFT) || (gMain.newKeys & DPAD_RIGHT);
-
- if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR
- && ((gMain.newKeys & L_BUTTON) || (gMain.newKeys & R_BUTTON)))
- result++;
-
- if (result != 0)
- {
- PlaySE(SE_SELECT);
- sLearnMoveStruct->state = 5;
- sLearnMoveStruct->showContestInfo = TRUE;
- }
-
- return result;
-}
-
-void sub_8133140(bool8 a)
-{
- s32 i;
-
- gSprites[sLearnMoveStruct->spriteIDs[0]].invisible = FALSE;
- gSprites[sLearnMoveStruct->spriteIDs[1]].invisible = FALSE;
-
- for (i = 0; i < 16; i++)
- gSprites[sLearnMoveStruct->spriteIDs[i + 4]].invisible = FALSE;
-
- for (i = 0; gUnknown_08402D08[0][i].unk0 != NULL; i++)
- {
- sub_8072C74(gTileBuffer, gUnknown_08402D08[1][i].unk0, 64, 2);
- Menu_PrintText(gTileBuffer, gUnknown_08402D08[1][i].unk4, gUnknown_08402D08[1][i].unk5);
- if (i != 0)
- {
- Menu_EraseWindowRect(
- gUnknown_08402D08[1][i].unk4,
- gUnknown_08402D08[1][i].unk5 + 2,
- gUnknown_08402D08[1][i].unk4 + 7,
- gUnknown_08402D08[1][i].unk5 + 3);
- }
- }
-
- if (!a)
- sub_8072AB0(gOtherText_TeachWhichMove, 24, 120, 192, 32, 1);
-}
-
-u8 sub_8133248(void)
-{
- u32 result = (gMain.newKeys & DPAD_LEFT) || (gMain.newKeys & DPAD_RIGHT);
-
- if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR
- && ((gMain.newKeys & L_BUTTON) || (gMain.newKeys & R_BUTTON)))
- result++;
-
- if (result != 0)
- {
- PlaySE(SE_SELECT);
- sLearnMoveStruct->state = 3;
- sLearnMoveStruct->showContestInfo = FALSE;
- }
-
- return result;
-}
-
-void ClearLearnMoveVars(void)
-{
- s32 i;
-
- sLearnMoveStruct->state = 0;
- sLearnMoveStruct->unk2 = 0;
- sLearnMoveStruct->unk19 = 0;
- sLearnMoveStruct->unk18 = 0;
- sLearnMoveStruct->unk1C = 0;
- sLearnMoveStruct->numMenuChoices = 0;
- sLearnMoveStruct->menuSelection = 0;
- sLearnMoveStruct->unk1D = FALSE;
- sLearnMoveStruct->unk1E = 0;
- sLearnMoveStruct->unk2C3 = FALSE;
- sLearnMoveStruct->showContestInfo = FALSE;
- for (i = 0; i < 20; i++)
- sLearnMoveStruct->movesToLearn[i] = 0;
-}
-
-void sub_8133300(struct Sprite *sprite)
-{
- s16 var = (sprite->data[1] * 10) & 0xFF;
-
- switch (sprite->data[0])
- {
- case 0:
- break;
- case 1:
- sprite->pos2.x = Sin(var, 3) * sprite->data[2];
- break;
- case 2:
- sprite->pos2.y = Sin(var, 1) * sprite->data[2];
- break;
- }
- sprite->data[1]++;
-}
-
-void sub_8133358(void)
-{
- s32 i;
-
- sLearnMoveStruct->spriteIDs[0] = CreateSprite(&gSpriteTemplate_8402D90, 8, 16, 0);
- gSprites[sLearnMoveStruct->spriteIDs[0]].data[0] = 1;
- gSprites[sLearnMoveStruct->spriteIDs[0]].data[2] = -1;
-
- sLearnMoveStruct->spriteIDs[1] = CreateSprite(&gSpriteTemplate_8402D90, 72, 16, 0);
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[1]], 1);
- gSprites[sLearnMoveStruct->spriteIDs[1]].data[0] = 1;
- gSprites[sLearnMoveStruct->spriteIDs[1]].data[2] = 1;
-
- sLearnMoveStruct->spriteIDs[2] = CreateSprite(&gSpriteTemplate_8402DC0, 160, 4, 0);
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[2]], 1);
- gSprites[sLearnMoveStruct->spriteIDs[2]].data[0] = 2;
- gSprites[sLearnMoveStruct->spriteIDs[2]].data[2] = -1;
-
- sLearnMoveStruct->spriteIDs[3] = CreateSprite(&gSpriteTemplate_8402DC0, 160, 60, 0);
- gSprites[sLearnMoveStruct->spriteIDs[3]].data[0] = 2;
- gSprites[sLearnMoveStruct->spriteIDs[3]].data[2] = 1;
-
- for (i = 0; i < 8; i++)
- {
- sLearnMoveStruct->spriteIDs[i + 4] = CreateSprite(&gSpriteTemplate_8402E08, (i - (i / 4) * 4) * 8 + 0x1C, (i / 4) * 8 + 0x34, 0);
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[i + 4]], 2);
- }
-
- for (i = 0; i < 8; i++)
- {
- sLearnMoveStruct->spriteIDs[i + 12] = CreateSprite(&gSpriteTemplate_8402E08, (i - (i / 4) * 4) * 8 + 0x1C, (i / 4) * 8 + 0x5C, 0);
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[i + 12]], 2);
- }
-
- for (i = 0; i < 20; i++)
- gSprites[sLearnMoveStruct->spriteIDs[i]].invisible = TRUE;
-
- CreateBlendedOutlineCursor(16, 0xFFFF, 12, 0x2D9F, 18);
-}
-
-void sub_8133558(void)
-{
- s32 i;
- u8 nickname[POKEMON_NAME_LENGTH + 1];
-
- sLearnMoveStruct->numMenuChoices = GetMoveRelearnerMoves(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->movesToLearn);
- for (i = 0; i < sLearnMoveStruct->numMenuChoices; i++)
- StringCopy(sLearnMoveStruct->moveNames[i], gMoveNames[sLearnMoveStruct->movesToLearn[i]]);
- GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_NICKNAME, nickname);
- StringCopy10(gStringVar1, nickname);
- StringCopy(sLearnMoveStruct->moveNames[sLearnMoveStruct->numMenuChoices], gUnknownText_Exit);
- sLearnMoveStruct->numMenuChoices++;
-}
-
-void sub_813360C(s8 delta)
-{
- sLearnMoveStruct->unk1C = sLearnMoveStruct->unk18;
- sLearnMoveStruct->unk18 += delta;
- sLearnMoveStruct->unk1D = TRUE;
-}
-
-void sub_813362C(void)
-{
- if (gMain.newAndRepeatedKeys & DPAD_UP)
- {
- if (sLearnMoveStruct->menuSelection != 0)
- {
- PlaySE(SE_SELECT);
- sLearnMoveStruct->menuSelection--;
- sLearnMoveStruct->unk2C3 = TRUE;
- if (sLearnMoveStruct->unk18 != 0)
- {
- sub_813360C(-1);
- }
- else if (sLearnMoveStruct->unk19 != 0)
- {
- sLearnMoveStruct->unk19--;
- sLearnMoveStruct->unk1E++;
- }
- }
- }
- else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
- {
- if (sLearnMoveStruct->menuSelection < sLearnMoveStruct->numMenuChoices - 1)
- {
- PlaySE(SE_SELECT);
- sLearnMoveStruct->menuSelection++;
- sLearnMoveStruct->unk2C3 = TRUE;
- if (sLearnMoveStruct->unk18 != 2)
- {
- sub_813360C(1);
- }
- else if (sLearnMoveStruct->unk19 != sLearnMoveStruct->numMenuChoices - 3)
- {
- sLearnMoveStruct->unk19++;
- sLearnMoveStruct->unk1E++;
- }
- }
- }
- else if (gMain.newKeys & A_BUTTON)
- {
- PlaySE(SE_SELECT);
- if (sLearnMoveStruct->menuSelection != sLearnMoveStruct->numMenuChoices - 1)
- {
- sLearnMoveStruct->state = 8;
- StringCopy(gStringVar2, sLearnMoveStruct->moveNames[sLearnMoveStruct->menuSelection]);
- StringExpandPlaceholders(gStringVar4, gOtherText_TeachSpecificMove);
- MenuPrintMessage(gStringVar4, 3, 15);
- }
- else
- {
- StringExpandPlaceholders(gStringVar4, gOtherText_GiveUpTeachingMove);
- MenuPrintMessage(gStringVar4, 3, 15);
- sLearnMoveStruct->state = 12;
- }
- }
- else if (gMain.newKeys & B_BUTTON)
- {
- PlaySE(SE_SELECT);
- sLearnMoveStruct->state = 12;
- StringExpandPlaceholders(gStringVar4, gOtherText_GiveUpTeachingMove);
- MenuPrintMessage(gStringVar4, 3, 15);
- }
- if (sLearnMoveStruct->numMenuChoices > 3)
- {
- gSprites[2].invisible = FALSE;
- gSprites[3].invisible = FALSE;
- if (sLearnMoveStruct->unk19 == 0)
- gSprites[2].invisible = TRUE;
- else if (sLearnMoveStruct->unk19 == sLearnMoveStruct->numMenuChoices - 3)
- gSprites[3].invisible = TRUE;
- }
-}
-
-void sub_8133800(void)
-{
- u8 r6 = sLearnMoveStruct->unk19;
- u8 *str = gTileBuffer;
- s32 i;
-
- for (i = 0; i < 3; i++)
- {
- if (r6 >= sLearnMoveStruct->numMenuChoices)
- {
- str = sub_8072C74(str, gEmptyString_81E72B0, 0x90, 0);
- }
- else if (r6 == sLearnMoveStruct->numMenuChoices - 1)
- {
- str = sub_8072C74(str, gUnknownText_Exit, 0x90, 0);
- }
- else
- {
- u16 moveId = sLearnMoveStruct->movesToLearn[r6];
-
- if (sLearnMoveStruct->showContestInfo)
- str = sub_8072C74(str, gUnknown_083CAF70[gContestMoves[moveId].contestCategory], 0x27, 0);
- else
- str = sub_8072C74(str, gTypeNames[gBattleMoves[moveId].type], 0x27, 0);
-
- str = sub_8072C74(str, sLearnMoveStruct->moveNames[r6], 0x72, 0);
-
- str[0] = CHAR_P;
- str[1] = CHAR_P;
- str[2] = CHAR_SLASH;
- str += 3;
-
- str = sub_8072C14(str, gBattleMoves[moveId].pp, 0x90, 0);
- }
- *str++ = CHAR_NEWLINE;
- r6++;
- }
- *str = EOS;
- Menu_PrintText(gTileBuffer, 11, 1);
- sub_813360C(0);
-}
-
-const u8 gUnknown_08402E24[7][3] =
-{
- {11, 1, 1},
- { 3, 6, 2},
- {24, 1, 3},
- { 3, 11, 4},
- { 5, 4, 5},
- { 3, 6, 6},
- { 3, 11, 7},
-};
-
-const u8 gUnknown_08402E39[] = {0, 1, 2, 3};
-const u8 gUnknown_08402E3D[] = {4, 5, 6};
-
-void PrintMoveInfo(u16 moveId, const u8 *b)
-{
- u8 str[0x34];
- u8 numHearts;
- u8 i;
-
- StringCopy(str, gExpandedPlaceholder_Empty);
- switch (b[2])
- {
- case 1:
- break;
- case 2:
- if (gBattleMoves[moveId].power < 2)
- sub_8072C74(str, gOtherText_ThreeDashes2, 32, 2);
- else
- sub_8072C14(str, gBattleMoves[moveId].power, 32, 2);
- Menu_PrintText(str, b[0], b[1]);
- break;
- case 4:
- if (gBattleMoves[moveId].accuracy == 0)
- sub_8072C74(str, gOtherText_ThreeDashes2, 32, 2);
- else
- sub_8072C14(str, gBattleMoves[moveId].accuracy, 32, 2);
- Menu_PrintText(str, b[0], b[1]);
- break;
- case 6:
- Menu_EraseWindowRect(b[0], b[1], b[0], b[1] + 1);
- numHearts = gContestEffects[gContestMoves[moveId].effect].appeal / 10;
- if (numHearts == 255)
- numHearts = 0;
- for (i = 0; i < 8; i++)
- {
- if (i < numHearts)
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[i + 4]], 1);
- else
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[i + 4]], 0);
- }
- break;
- case 7:
- Menu_EraseWindowRect(b[0], b[1], b[0], b[1] + 1);
- numHearts = gContestEffects[gContestMoves[moveId].effect].jam / 10;
- if (numHearts == 255)
- numHearts = 0;
- for (i = 0; i < 8; i++)
- {
- if (i < numHearts)
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[i + 12]], 3);
- else
- StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIDs[i + 12]], 2);
- }
- break;
- }
-}
-
-void sub_8133AEC(bool8 contestInfo, int unused)
-{
- u16 i;
-
- if (sLearnMoveStruct->menuSelection != sLearnMoveStruct->numMenuChoices - 1)
- {
- u16 moveId = sLearnMoveStruct->movesToLearn[sLearnMoveStruct->menuSelection];
-
- if (contestInfo)
- {
- for (i = 0; i < 16; i++)
- gSprites[sLearnMoveStruct->spriteIDs[i + 4]].invisible = FALSE;
- for (i = 0; i < 3; i++)
- PrintMoveInfo(moveId, gUnknown_08402E24[gUnknown_08402E3D[i]]);
- sub_8072AB0(gContestEffectStrings[gContestMoves[moveId].effect], 0x58, 0x48, 0x90, 32, 1);
- }
- else
- {
- u8 var;
-
- for (i = 0; i < 4; i++)
- PrintMoveInfo(moveId, gUnknown_08402E24[gUnknown_08402E39[i]]);
- var = sub_8072A18(gMoveDescriptions[moveId - 1], 0x58, 0x48, 0x90, 1);
- if (var < 2)
- {
- u8 r1 = var * 2 + 9;
-
- Menu_BlankWindowRect(11, r1, 28, 12);
- }
- }
- }
- else
- {
- if (contestInfo)
- {
- Menu_EraseWindowRect(gUnknown_08402E24[5][0], gUnknown_08402E24[5][1], gUnknown_08402E24[5][0], gUnknown_08402E24[5][1] + 1);
- Menu_EraseWindowRect(gUnknown_08402E24[6][0], gUnknown_08402E24[6][1], gUnknown_08402E24[6][0], gUnknown_08402E24[6][1] + 1);
- for (i = 0; i < 16; i++)
- gSprites[sLearnMoveStruct->spriteIDs[i + 4]].invisible = TRUE;
- }
- else
- {
- Menu_EraseWindowRect(gUnknown_08402E24[1][0], gUnknown_08402E24[1][1], gUnknown_08402E24[1][0] + 3, gUnknown_08402E24[1][1] + 1);
- Menu_EraseWindowRect(gUnknown_08402E24[3][0], gUnknown_08402E24[3][1], gUnknown_08402E24[3][0] + 3, gUnknown_08402E24[3][1] + 1);
- }
- Menu_EraseWindowRect(11, 9, 28, 12);
- }
-}
-
-void sub_8133CA4(void)
-{
- Menu_EraseWindowRect(21, 7, 27, 12);
- sub_8133AEC(sLearnMoveStruct->showContestInfo, 0);
-}
diff --git a/src/link.c b/src/link.c
index 8b168c0a2..a4bd87333 100644
--- a/src/link.c
+++ b/src/link.c
@@ -241,8 +241,8 @@ void LinkTestScreen(void)
FreeAllSpritePalettes();
ResetTasks();
SetVBlankCallback(VBlankCB_LinkTest);
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow((struct WindowTemplate *)&gMenuTextWindowTemplate);
ResetBlockSend();
gLinkType = 0x1111;
OpenLink();
diff --git a/src/mail.c b/src/mail.c
index ca698e23c..9833b1c2d 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -1124,8 +1124,8 @@ void debug_sub_810D388(void)
FreeAllSpritePalettes();
break;
case 4:
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
Menu_EraseScreen();
break;
case 5:
diff --git a/src/main_menu.c b/src/main_menu.c
index e574b7b0e..886995b16 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -233,7 +233,7 @@ u32 InitMainMenu(u8 a1)
ResetSpriteData();
FreeAllSpritePalettes();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4);
+ InitMenuWindow((struct WindowTemplate *)&gMenuTextWindowTemplate);
if (a1)
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
@@ -704,12 +704,12 @@ void PrintPlayTime(void)
#if defined(ENGLISH)
Menu_PrintText(gMainMenuString_Time, 16, 3);
FormatPlayTime(playTime, gSaveBlock2.playTimeHours, gSaveBlock2.playTimeMinutes, 1);
- sub_8072C74(alignedPlayTime, playTime, 48, 1);
+ AlignStringInMenuWindow(alignedPlayTime, playTime, 48, 1);
Menu_PrintText(alignedPlayTime, 22, 3);
#elif defined(GERMAN)
Menu_PrintTextPixelCoords(gMainMenuString_Time, 124, 24, TRUE);
FormatPlayTime(playTime, gSaveBlock2.playTimeHours, gSaveBlock2.playTimeMinutes, 1);
- sub_8072C74(alignedPlayTime, playTime, 40, 1);
+ AlignStringInMenuWindow(alignedPlayTime, playTime, 40, 1);
Menu_PrintText(alignedPlayTime, 23, 3);
#endif
}
@@ -719,7 +719,7 @@ void PrintPokedexCount(void)
u8 buffer[16];
Menu_PrintText(gMainMenuString_Pokedex, 2, 5);
- sub_8072C14(buffer, GetPokedexSeenCount(), 18, 0);
+ AlignInt1InMenuWindow(buffer, GetPokedexSeenCount(), 18, 0);
Menu_PrintText(buffer, 9, 5);
}
@@ -749,7 +749,7 @@ void PrintBadgeCount(void)
static void Task_NewGameSpeech1(u8 taskId)
{
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4);
+ InitMenuWindow((struct WindowTemplate *)&gMenuTextWindowTemplate);
REG_WIN0H = 0;
REG_WIN0V = 0;
REG_WININ = 0;
@@ -1372,7 +1372,7 @@ void CB_ContinueNewGameSpeechPart2()
AddBirchSpeechObjects(taskId);
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow((struct WindowTemplate *)&gWindowTemplate_81E6CE4);
+ InitMenuWindow((struct WindowTemplate *)&gMenuTextWindowTemplate);
if (gSaveBlock2.playerGender != MALE)
{
diff --git a/src/mauville_man.c b/src/mauville_man.c
index b3e13ef64..e22809242 100644
--- a/src/mauville_man.c
+++ b/src/mauville_man.c
@@ -689,7 +689,7 @@ static void Task_BardSong(u8 taskId)
{
case 0: // Initialize song
PrepareSongText();
- Text_InitWindowWithTemplate(gMenuWindowPtr, &gWindowTemplate_81E6CE4);
+ Text_InitWindowWithTemplate(gMenuWindowPtr, &gMenuTextWindowTemplate);
Text_InitWindow8002EB0(gMenuWindowPtr, gStringVar4, 2, 4, 15);
task->data[1] = 0;
task->data[2] = 0;
diff --git a/src/menu.c b/src/menu.c
index 60aaeba32..891644750 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -441,7 +441,7 @@ static u8 sub_80724F4(u8 left, u8 top, u8 menuItemCount, const struct MenuAction
maxWidth = 0;
for (i = 0; i < menuItemCount; i++)
{
- u8 width = (sub_8072CA4(menuItems[i].text) + 7) / 8;
+ u8 width = (GetStringWidthInMenuWindow(menuItems[i].text) + 7) / 8;
if (width > maxWidth)
maxWidth = width;
@@ -498,7 +498,7 @@ static void sub_8072620(u8 left, u8 top, u8 menuItemCount, const struct MenuActi
maxWidth = 0;
for (i = 0; i < menuItemCount; i++)
{
- u8 width = (sub_8072CA4(menuItems[i].text) + 7) / 8;
+ u8 width = (GetStringWidthInMenuWindow(menuItems[i].text) + 7) / 8;
if (width > maxWidth)
maxWidth = width;
@@ -733,11 +733,11 @@ void MenuPrint_RightAligned(const u8 *str, u8 left, u8 top)
Text_InitWindow8004D38(gMenuWindowPtr, str, gMenuTextTileOffset, left, top);
}
-void sub_8072B80(const u8 *a1, u8 a2, u8 a3, const u8 *a4)
+void sub_8072B80(const u8 *src, u8 a2, u8 a3, const u8 *a4)
{
u8 buffer[64];
u8 width = GetStringWidth(gMenuWindowPtr, a4);
- AlignString(gMenuWindowPtr, buffer, a1, width, 1);
+ AlignString(gMenuWindowPtr, buffer, src, width, 1);
Text_InitWindowAndPrintText(gMenuWindowPtr, buffer, gMenuTextTileOffset, a2, a3);
}
@@ -746,22 +746,22 @@ void sub_8072BD8(const u8 *a1, u8 a2, u8 a3, u16 a4)
Text_InitWindow8004DB0(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3, a4);
}
-u8 *sub_8072C14(u8 *a1, s32 a2, u8 a3, u8 a4)
+u8 *AlignInt1InMenuWindow(u8 *dest, s32 value, u8 alignAmount, u8 alignType)
{
- return AlignInt1(gMenuWindowPtr, a1, a2, a3, a4);
+ return AlignInt1(gMenuWindowPtr, dest, value, alignAmount, alignType);
}
-u8 *sub_8072C44(u8 *a1, s32 a2, u8 a3, u8 a4)
+u8 *AlignInt2InMenuWindow(u8 *dest, s32 value, u8 alignAmount, u8 alignType)
{
- return AlignInt2(gMenuWindowPtr, a1, a2, a3, a4);
+ return AlignInt2(gMenuWindowPtr, dest, value, alignAmount, alignType);
}
-u8 *sub_8072C74(u8 *a1, const u8 *a2, u8 a3, u8 a4)
+u8 *AlignStringInMenuWindow(u8 *dest, const u8 *src, u8 alignAmount, u8 alignType)
{
- return AlignString(gMenuWindowPtr, a1, a2, a3, a4);
+ return AlignString(gMenuWindowPtr, dest, src, alignAmount, alignType);
}
-u8 sub_8072CA4(const u8 *str)
+u8 GetStringWidthInMenuWindow(const u8 *str)
{
return GetStringWidth(gMenuWindowPtr, str);
}
diff --git a/src/money.c b/src/money.c
index 1081d5063..12a8b71ff 100644
--- a/src/money.c
+++ b/src/money.c
@@ -141,7 +141,7 @@ void PrintMoneyAmount(u32 amount, u8 size, u8 x, u8 y)
u8 stringWidth;
GetMoneyAmountText(buffer, amount, size);
- stringWidth = sub_8072CA4(buffer);
+ stringWidth = GetStringWidthInMenuWindow(buffer);
if (stringWidth >= (size + 1) * 8)
{
diff --git a/src/move_tutor_menu.c b/src/move_tutor_menu.c
new file mode 100644
index 000000000..7e1365391
--- /dev/null
+++ b/src/move_tutor_menu.c
@@ -0,0 +1,1063 @@
+#include "global.h"
+#include "contest.h"
+#include "data2.h"
+#include "ewram.h"
+#include "field_fadetransition.h"
+#include "main.h"
+#include "menu.h"
+#include "menu_cursor.h"
+#include "move_tutor_menu.h"
+#include "overworld.h"
+#include "palette.h"
+#include "pokemon.h"
+#include "pokemon_summary_screen.h"
+#include "script.h"
+#include "sound.h"
+#include "sprite.h"
+#include "string_util.h"
+#include "strings.h"
+#include "strings2.h"
+#include "task.h"
+#include "trig.h"
+#include "constants/songs.h"
+
+extern u16 gSpecialVar_0x8004;
+extern u16 gSpecialVar_0x8005;
+extern u8 gTileBuffer[];
+
+extern const struct WindowTemplate gMenuTextWindowTemplate;
+extern const struct WindowTemplate gMoveTutorMenuFramesWindowTemplate;
+extern const u8 *const gContestEffectStrings[];
+extern const u8 *const gMoveDescriptions[];
+extern const u8 gTypeNames[][7];
+extern const u8 *const gContestCategoryNames[];
+
+#ifdef GERMAN
+extern const u8 deuOtherText_ForgotAndLearned[];
+#endif
+
+static void InitMoveTutorMenuWaitFade(u8);
+static void CB2_InitMoveTutorMenu(void);
+static void CB2_MoveTutorMenu(void);
+static void MoveTutorMain(void);
+static void DrawLearnMoveMenuWindow(void);
+static void DrawBattleMoveInfoHeaders(bool8);
+static u8 ChangeToContestMoveInfoWindow(void);
+static void DrawContestMoveInfoHeaders(bool8);
+static u8 ChangeToBattleMoveInfoWindow(void);
+static void ResetMoveTutorMenu(void);
+static void InitMoveTutorMenuSprites(void);
+static void InitMoveTutorMenuStrings(void);
+static void HandleMoveTutorMenuInput(void);
+static void DrawMoveSelectionWindow(void);
+static void DrawMoveInfoWindow(bool8, int);
+static void RedrawMoveInfoWindow(void);
+static void UpdateMoveTutorMenuCursorPosition(struct Sprite *);
+
+struct MoveTutorMenu
+{
+ u8 state;
+ u8 filler1;
+ u8 unk2;
+ u8 spriteIDs[20];
+ u8 filler17;
+ u8 cursorPos;
+ u8 curMenuChoice;
+ u8 numMenuChoices;
+ u8 menuSelection;
+ u8 previousCursorPos;
+ bool8 redrawCursor;
+ bool8 redrawMoveSelectionWindow;
+ u16 movesToLearn[MAX_MOVE_TUTOR_MOVES];
+ u8 filler48[10];
+ u8 moveNames[6][25];
+ u8 fillerE8[475];
+ bool8 redrawMoveInfoWindow;
+ bool8 showContestInfo;
+ u8 partyMonIndex;
+ u8 forgetMoveIndex;
+};
+
+static struct MoveTutorMenu *sMoveTutorMenu;
+
+const u16 gMoveTutorMenuArrows_Pal[] = INCBIN_U16("graphics/move_tutor_menu/arrows.gbapal");
+
+const u8 gMoveTutorMenuArrows_Gfx[] = INCBIN_U8("graphics/move_tutor_menu/arrows.4bpp");
+
+const u8 gMoveTutorMenuWindowFrameDimensions[][4] =
+{
+ { 0, 0, 9, 13},
+ {10, 0, 29, 7},
+ { 2, 14, 27, 19},
+ {10, 8, 29, 13},
+};
+
+struct MoveTutorMoveInfoHeaders
+{
+ const u8 *text;
+ u8 left;
+ u8 right;
+ u8 index; // unused
+};
+
+const struct MoveTutorMoveInfoHeaders gMoveTutorMoveInfoHeaders[][4] =
+{
+ {
+ {OtherText_Battle, 1, 1, 0},
+ {OtherText_Power, 1, 4, 1},
+ {OtherText_Accuracy, 1, 9, 2},
+ {NULL, 0, 0, 0},
+ },
+ {
+ {OtherText_Contest, 1, 1, 0},
+ {OtherText_Appeal, 1, 4, 1},
+ {OtherText_Jam, 1, 9, 2},
+ {NULL, 0, 0, 0},
+ },
+};
+
+// XXX: What are these for?
+const u32 unkDataFF00FFEF = 0xFF00FFEF;
+const u8 *const gTileBuffer_ = gTileBuffer;
+
+const struct OamData gOamData_8402D50 = {.shape = 0};
+const struct OamData gOamData_8402D58 = {.shape = 2};
+const struct OamData gOamData_8402D60 = {.shape = 1};
+
+const union AnimCmd gSpriteAnim_8402D68[] =
+{
+ ANIMCMD_FRAME(2, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd gSpriteAnim_8402D70[] =
+{
+ ANIMCMD_FRAME(0, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd *const gSpriteAnimTable_8402D78[] =
+{
+ gSpriteAnim_8402D68,
+ gSpriteAnim_8402D70,
+};
+
+const struct SpriteSheet gMoveTutorMenuArrowsSpriteSheet = {gMoveTutorMenuArrows_Gfx, sizeof(gMoveTutorMenuArrows_Gfx), 5525};
+const struct SpritePalette gMoveTutorMenuArrowsPalette = {gMoveTutorMenuArrows_Pal, 5526};
+
+const struct SpriteTemplate gSpriteTemplate_8402D90 =
+{
+ .tileTag = 5525,
+ .paletteTag = 5526,
+ .oam = &gOamData_8402D58,
+ .anims = gSpriteAnimTable_8402D78,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = UpdateMoveTutorMenuCursorPosition,
+};
+
+const union AnimCmd gSpriteAnim_8402DA8[] =
+{
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd gSpriteAnim_8402DB0[] =
+{
+ ANIMCMD_FRAME(6, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd *const gSpriteAnimTable_8402DB8[] =
+{
+ gSpriteAnim_8402DA8,
+ gSpriteAnim_8402DB0,
+};
+
+const struct SpriteTemplate gSpriteTemplate_8402DC0 =
+{
+ .tileTag = 5525,
+ .paletteTag = 5526,
+ .oam = &gOamData_8402D60,
+ .anims = gSpriteAnimTable_8402DB8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = UpdateMoveTutorMenuCursorPosition,
+};
+
+const union AnimCmd gSpriteAnim_8402DD8[] =
+{
+ ANIMCMD_FRAME(8, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd gSpriteAnim_8402DE0[] =
+{
+ ANIMCMD_FRAME(9, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd gSpriteAnim_8402DE8[] =
+{
+ ANIMCMD_FRAME(10, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd gSpriteAnim_8402DF0[] =
+{
+ ANIMCMD_FRAME(11, 5),
+ ANIMCMD_END,
+};
+
+const union AnimCmd *const gSpriteAnimTable_8402DF8[] =
+{
+ gSpriteAnim_8402DD8,
+ gSpriteAnim_8402DE0,
+ gSpriteAnim_8402DE8,
+ gSpriteAnim_8402DF0,
+};
+
+const struct SpriteTemplate gSpriteTemplate_8402E08 =
+{
+ .tileTag = 5525,
+ .paletteTag = 5526,
+ .oam = &gOamData_8402D50,
+ .anims = gSpriteAnimTable_8402DF8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = UpdateMoveTutorMenuCursorPosition,
+};
+
+const u8 gString_AkitoMori[] = _("あきと"); // programmer Akito Mori?
+
+static void VBlankCB_MoveTutorMenu(void)
+{
+ LoadOam();
+ ProcessSpriteCopyRequests();
+ TransferPlttBuffer();
+}
+
+void DisplayMoveTutorMenu(void)
+{
+ ScriptContext2_Enable();
+ CreateTask(InitMoveTutorMenuWaitFade, 10);
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
+}
+
+static void InitMoveTutorMenuWaitFade(u8 taskId)
+{
+ if (!gPaletteFade.active)
+ {
+ SetMainCallback2(CB2_InitMoveTutorMenu);
+ gFieldCallback = sub_8080990;
+ DestroyTask(taskId);
+ }
+}
+
+static void CB2_InitMoveTutorMenu(void)
+{
+ REG_DISPCNT = 0;
+ ResetSpriteData();
+ FreeAllSpritePalettes();
+ ResetTasks();
+ sMoveTutorMenu = eMoveTutorMenu;
+ ResetMoveTutorMenu();
+ sMoveTutorMenu->partyMonIndex = gSpecialVar_0x8004;
+ InitMoveTutorMenuStrings();
+ SetVBlankCallback(VBlankCB_MoveTutorMenu);
+
+ Text_LoadWindowTemplate(&gMoveTutorMenuFramesWindowTemplate);
+ InitMenuWindow(&gMoveTutorMenuFramesWindowTemplate);
+ Menu_EraseScreen();
+
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
+ Menu_EraseScreen();
+
+ REG_BG0VOFS = 0;
+ REG_BG0VOFS = 0;
+ REG_BG1HOFS = 0;
+ REG_BG1HOFS = 0;
+
+ LoadSpriteSheet(&gMoveTutorMenuArrowsSpriteSheet);
+ LoadSpritePalette(&gMoveTutorMenuArrowsPalette);
+ InitMoveTutorMenuSprites();
+ FillPalette(0, 0, 2);
+ RunTasks();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+ SetMainCallback2(CB2_MoveTutorMenu);
+}
+
+void CB2_ReturnToMoveTutorMenu(void)
+{
+ ResetSpriteData();
+ FreeAllSpritePalettes();
+ ResetTasks();
+ sMoveTutorMenu = eMoveTutorMenu;
+ InitMoveTutorMenuStrings();
+ sMoveTutorMenu->forgetMoveIndex = gSpecialVar_0x8005;
+ SetVBlankCallback(VBlankCB_MoveTutorMenu);
+
+ Text_LoadWindowTemplate(&gMoveTutorMenuFramesWindowTemplate);
+ InitMenuWindow(&gMoveTutorMenuFramesWindowTemplate);
+ Menu_EraseScreen();
+
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
+ Menu_EraseScreen();
+
+ REG_DISPCNT = DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP;
+ REG_BG0VOFS = 0;
+ REG_BG0HOFS = 0;
+ REG_BG1HOFS = 0;
+ REG_BG1HOFS = 0;
+
+ LoadSpriteSheet(&gMoveTutorMenuArrowsSpriteSheet);
+ LoadSpritePalette(&gMoveTutorMenuArrowsPalette);
+ InitMoveTutorMenuSprites();
+ FillPalette(0, 0, 2);
+ RunTasks();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+ SetMainCallback2(CB2_MoveTutorMenu);
+}
+
+static void CB2_MoveTutorMenu(void)
+{
+ MoveTutorMain();
+ if (sMoveTutorMenu->redrawCursor)
+ {
+ sMoveTutorMenu->redrawCursor = FALSE;
+ MenuCursor_SetPos814AD7C(0x58, (sMoveTutorMenu->cursorPos * 2 + 1) * 8);
+ }
+ if (sMoveTutorMenu->redrawMoveSelectionWindow)
+ {
+ sMoveTutorMenu->redrawMoveSelectionWindow = 0;
+ DrawMoveSelectionWindow();
+ }
+ if (sMoveTutorMenu->redrawMoveInfoWindow)
+ {
+ DrawMoveInfoWindow(sMoveTutorMenu->showContestInfo, 1);
+ sMoveTutorMenu->redrawMoveInfoWindow = FALSE;
+ }
+ RunTasks();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+}
+
+static void PrintMainMoveTutorMenuText(const u8 *str)
+{
+ StringExpandPlaceholders(gStringVar4, str);
+ MenuPrintMessage(gStringVar4, 3, 15);
+}
+
+static void MoveTutorMain(void)
+{
+ switch (sMoveTutorMenu->state)
+ {
+ case 0:
+ sMoveTutorMenu->state++;
+ DrawLearnMoveMenuWindow();
+ DrawBattleMoveInfoHeaders(FALSE);
+ DrawMoveSelectionWindow();
+ gSprites[1].pos1.x = 0x48;
+ sMoveTutorMenu->redrawMoveInfoWindow = TRUE;
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
+ REG_DISPCNT = DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP;
+ break;
+ case 1:
+ if (!gPaletteFade.active)
+ sMoveTutorMenu->state = 4;
+ break;
+ case 2:
+ sMoveTutorMenu->state++;
+ break;
+ case 3:
+ DrawBattleMoveInfoHeaders(FALSE);
+ DrawMoveSelectionWindow();
+ sMoveTutorMenu->redrawMoveInfoWindow = TRUE;
+ sMoveTutorMenu->state++;
+ gSprites[1].pos1.x = 0x48;
+ break;
+ case 4:
+ if (!ChangeToContestMoveInfoWindow())
+ HandleMoveTutorMenuInput();
+ return;
+ case 5:
+ DrawContestMoveInfoHeaders(FALSE);
+ DrawMoveSelectionWindow();
+ sMoveTutorMenu->redrawMoveInfoWindow = TRUE;
+ gSprites[1].pos1.x = 0x48;
+ sMoveTutorMenu->state++;
+ break;
+ case 6:
+ if (!ChangeToBattleMoveInfoWindow())
+ HandleMoveTutorMenuInput();
+ break;
+ case 8:
+ if (Menu_UpdateWindowText())
+ {
+ DisplayYesNoMenu(21, 7, 1);
+ sMoveTutorMenu->state++;
+ }
+ break;
+ case 9:
+ {
+ s8 selection = Menu_ProcessInputNoWrap_();
+ if (selection == 0)
+ {
+ RedrawMoveInfoWindow();
+ if (GiveMoveToMon(&gPlayerParty[sMoveTutorMenu->partyMonIndex], sMoveTutorMenu->movesToLearn[sMoveTutorMenu->menuSelection]) != 0xFFFF)
+ {
+ PrintMainMoveTutorMenuText(gOtherText_PokeLearnedMove);
+ gSpecialVar_0x8004 = 1;
+ sMoveTutorMenu->state = 31;
+ }
+ else
+ {
+ sMoveTutorMenu->state = 16;
+ }
+ }
+ else if (selection == -1 || selection == 1)
+ {
+ RedrawMoveInfoWindow();
+ if (sMoveTutorMenu->showContestInfo == FALSE)
+ sMoveTutorMenu->state = 3;
+ if (sMoveTutorMenu->showContestInfo == TRUE)
+ sMoveTutorMenu->state = 5;
+ }
+ }
+ break;
+ case 12:
+ if (Menu_UpdateWindowText())
+ {
+ DisplayYesNoMenu(21, 7, 1);
+ sMoveTutorMenu->state++;
+ }
+ break;
+ case 13:
+ {
+ s8 selection = Menu_ProcessInputNoWrap_();
+
+ if (selection == 0)
+ {
+ RedrawMoveInfoWindow();
+ gSpecialVar_0x8004 = selection;
+ sMoveTutorMenu->state = 14;
+ }
+ else if (selection == -1 || selection == 1)
+ {
+ RedrawMoveInfoWindow();
+ if (sMoveTutorMenu->showContestInfo == FALSE)
+ sMoveTutorMenu->state = 3;
+ if (sMoveTutorMenu->showContestInfo == TRUE)
+ sMoveTutorMenu->state = 5;
+ }
+ }
+ break;
+ case 16:
+ PrintMainMoveTutorMenuText(gOtherText_DeleteOlderMove);
+ sMoveTutorMenu->state++;
+ break;
+ case 17:
+ if (Menu_UpdateWindowText())
+ {
+ DisplayYesNoMenu(21, 7, 1);
+ sMoveTutorMenu->state = 18;
+ }
+ break;
+ case 18:
+ {
+ s8 var = Menu_ProcessInputNoWrap_();
+
+ if (var == 0)
+ {
+ RedrawMoveInfoWindow();
+ PrintMainMoveTutorMenuText(gOtherText_WhichMoveToForget);
+ sMoveTutorMenu->state = 19;
+ }
+ else if (var == -1 || var == 1)
+ {
+ RedrawMoveInfoWindow();
+ sMoveTutorMenu->state = 24;
+ }
+ }
+ break;
+ case 24:
+ PrintMainMoveTutorMenuText(gOtherText_StopLearningMove);
+ sMoveTutorMenu->state++;
+ break;
+ case 25:
+ if (Menu_UpdateWindowText())
+ {
+ sMoveTutorMenu->state = 26;
+ DisplayYesNoMenu(21, 7, 1);
+ }
+ break;
+ case 26:
+ {
+ s8 var = Menu_ProcessInputNoWrap_();
+
+ if (var == 0)
+ {
+ RedrawMoveInfoWindow();
+ sMoveTutorMenu->state = 27;
+ }
+ else if (var == -1 || var == 1)
+ {
+ RedrawMoveInfoWindow();
+
+ // What's the point? It gets set to 16, anyway.
+ if (sMoveTutorMenu->showContestInfo == FALSE)
+ sMoveTutorMenu->state = 3;
+ if (sMoveTutorMenu->showContestInfo == TRUE)
+ sMoveTutorMenu->state = 5;
+ sMoveTutorMenu->state = 16;
+ }
+ }
+ break;
+ case 27:
+ if (Menu_UpdateWindowText())
+ {
+ if (sMoveTutorMenu->showContestInfo == FALSE)
+ sMoveTutorMenu->state = 3;
+ if (sMoveTutorMenu->showContestInfo == TRUE)
+ sMoveTutorMenu->state = 5;
+ }
+ break;
+ case 19:
+ if (Menu_UpdateWindowText())
+ {
+ sMoveTutorMenu->state = 20;
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
+ }
+ break;
+ case 20:
+ if (!gPaletteFade.active)
+ {
+ ShowSelectMovePokemonSummaryScreen(gPlayerParty, sMoveTutorMenu->partyMonIndex, gPlayerPartyCount - 1, CB2_ReturnToMoveTutorMenu, sMoveTutorMenu->movesToLearn[sMoveTutorMenu->menuSelection]);
+ sMoveTutorMenu->state = 28;
+ }
+ break;
+ case 21:
+ if (Menu_UpdateWindowText())
+ sMoveTutorMenu->state = 14;
+ break;
+ case 22:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
+ break;
+ case 14:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
+ sMoveTutorMenu->state++;
+ break;
+ case 15:
+ if (!gPaletteFade.active)
+ SetMainCallback2(c2_exit_to_overworld_2_switch);
+ break;
+ case 28:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
+ sMoveTutorMenu->state++;
+ DrawLearnMoveMenuWindow();
+ DrawMoveSelectionWindow();
+ if (sMoveTutorMenu->showContestInfo == FALSE)
+ DrawBattleMoveInfoHeaders(TRUE);
+ if (sMoveTutorMenu->showContestInfo == TRUE)
+ {
+ gSprites[1].pos1.x = 0x48;
+ DrawContestMoveInfoHeaders(TRUE);
+ }
+ DrawMoveInfoWindow(sMoveTutorMenu->showContestInfo, 1);
+ break;
+ case 29:
+ if (!gPaletteFade.active)
+ {
+ if (sMoveTutorMenu->forgetMoveIndex == 4)
+ {
+ sMoveTutorMenu->state = 24;
+ }
+ else
+ {
+ u16 moveId = GetMonData(&gPlayerParty[sMoveTutorMenu->partyMonIndex], MON_DATA_MOVE1 + sMoveTutorMenu->forgetMoveIndex);
+
+ StringCopy(gStringVar3, gMoveNames[moveId]);
+ RemoveMonPPBonus(&gPlayerParty[sMoveTutorMenu->partyMonIndex], sMoveTutorMenu->forgetMoveIndex);
+ SetMonMoveSlot(&gPlayerParty[sMoveTutorMenu->partyMonIndex], sMoveTutorMenu->movesToLearn[sMoveTutorMenu->menuSelection], sMoveTutorMenu->forgetMoveIndex);
+ StringCopy(gStringVar2, gMoveNames[sMoveTutorMenu->movesToLearn[sMoveTutorMenu->menuSelection]]);
+ PrintMainMoveTutorMenuText(gOtherText_ForgotMove123);
+ sMoveTutorMenu->state = 30;
+ gSpecialVar_0x8004 = 1;
+ }
+ }
+ break;
+ case 30:
+ if (Menu_UpdateWindowText())
+ {
+#ifdef GERMAN
+ PrintMainMoveTutorMenuText(deuOtherText_ForgotAndLearned);
+#else
+ PrintMainMoveTutorMenuText(gOtherText_ForgotOrDidNotLearnMove);
+#endif
+ sMoveTutorMenu->state = 31;
+ PlayFanfare(BGM_FANFA1);
+ }
+ break;
+ case 31:
+ if (Menu_UpdateWindowText())
+ {
+ PlayFanfare(BGM_FANFA1);
+ sMoveTutorMenu->state = 32;
+ }
+ break;
+ case 32:
+ if (IsFanfareTaskInactive())
+ sMoveTutorMenu->state = 33;
+ break;
+ case 33:
+ if (gMain.newKeys & A_BUTTON)
+ {
+ PlaySE(SE_SELECT);
+ sMoveTutorMenu->state = 14;
+ }
+ break;
+ }
+}
+
+static void DrawLearnMoveMenuWindow(void)
+{
+ u32 i;
+
+ BasicInitMenuWindow(&gMoveTutorMenuFramesWindowTemplate);
+ for (i = 0; i < 4; i++)
+ {
+ Menu_DrawStdWindowFrame(
+ gMoveTutorMenuWindowFrameDimensions[i][0],
+ gMoveTutorMenuWindowFrameDimensions[i][1],
+ gMoveTutorMenuWindowFrameDimensions[i][2],
+ gMoveTutorMenuWindowFrameDimensions[i][3]);
+ }
+ BasicInitMenuWindow(&gMenuTextWindowTemplate);
+}
+
+static void DrawBattleMoveInfoHeaders(bool8 noTeachMoveText)
+{
+ s32 i;
+
+ gSprites[sMoveTutorMenu->spriteIDs[0]].invisible = FALSE;
+ gSprites[sMoveTutorMenu->spriteIDs[1]].invisible = FALSE;
+
+ for (i = 0; i < 16; i++)
+ gSprites[sMoveTutorMenu->spriteIDs[i + 4]].invisible = TRUE;
+
+ for (i = 0; gMoveTutorMoveInfoHeaders[0][i].text != NULL; i++)
+ {
+ AlignStringInMenuWindow(gTileBuffer, gMoveTutorMoveInfoHeaders[0][i].text, 64, 2);
+ Menu_PrintText(gTileBuffer, gMoveTutorMoveInfoHeaders[0][i].left, gMoveTutorMoveInfoHeaders[0][i].right);
+ }
+
+ if (!noTeachMoveText)
+ sub_8072AB0(gOtherText_TeachWhichMove, 24, 120, 192, 32, 1);
+}
+
+static u8 ChangeToContestMoveInfoWindow(void)
+{
+ u32 result = (gMain.newKeys & DPAD_LEFT) || (gMain.newKeys & DPAD_RIGHT);
+
+ if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR
+ && ((gMain.newKeys & L_BUTTON) || (gMain.newKeys & R_BUTTON)))
+ result++;
+
+ if (result != 0)
+ {
+ PlaySE(SE_SELECT);
+ sMoveTutorMenu->state = 5;
+ sMoveTutorMenu->showContestInfo = TRUE;
+ }
+
+ return result;
+}
+
+static void DrawContestMoveInfoHeaders(bool8 noTeachMoveText)
+{
+ s32 i;
+
+ gSprites[sMoveTutorMenu->spriteIDs[0]].invisible = FALSE;
+ gSprites[sMoveTutorMenu->spriteIDs[1]].invisible = FALSE;
+
+ for (i = 0; i < 16; i++)
+ gSprites[sMoveTutorMenu->spriteIDs[i + 4]].invisible = FALSE;
+
+ for (i = 0; gMoveTutorMoveInfoHeaders[0][i].text != NULL; i++)
+ {
+ AlignStringInMenuWindow(gTileBuffer, gMoveTutorMoveInfoHeaders[1][i].text, 64, 2);
+ Menu_PrintText(gTileBuffer, gMoveTutorMoveInfoHeaders[1][i].left, gMoveTutorMoveInfoHeaders[1][i].right);
+ if (i != 0)
+ {
+ Menu_EraseWindowRect(
+ gMoveTutorMoveInfoHeaders[1][i].left,
+ gMoveTutorMoveInfoHeaders[1][i].right + 2,
+ gMoveTutorMoveInfoHeaders[1][i].left + 7,
+ gMoveTutorMoveInfoHeaders[1][i].right + 3);
+ }
+ }
+
+ if (!noTeachMoveText)
+ sub_8072AB0(gOtherText_TeachWhichMove, 24, 120, 192, 32, 1);
+}
+
+static u8 ChangeToBattleMoveInfoWindow(void)
+{
+ u32 result = (gMain.newKeys & DPAD_LEFT) || (gMain.newKeys & DPAD_RIGHT);
+
+ if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR
+ && ((gMain.newKeys & L_BUTTON) || (gMain.newKeys & R_BUTTON)))
+ result++;
+
+ if (result != 0)
+ {
+ PlaySE(SE_SELECT);
+ sMoveTutorMenu->state = 3;
+ sMoveTutorMenu->showContestInfo = FALSE;
+ }
+
+ return result;
+}
+
+static void ResetMoveTutorMenu(void)
+{
+ s32 i;
+
+ sMoveTutorMenu->state = 0;
+ sMoveTutorMenu->unk2 = 0;
+ sMoveTutorMenu->curMenuChoice = 0;
+ sMoveTutorMenu->cursorPos = 0;
+ sMoveTutorMenu->previousCursorPos = 0;
+ sMoveTutorMenu->numMenuChoices = 0;
+ sMoveTutorMenu->menuSelection = 0;
+ sMoveTutorMenu->redrawCursor = FALSE;
+ sMoveTutorMenu->redrawMoveSelectionWindow = 0;
+ sMoveTutorMenu->redrawMoveInfoWindow = FALSE;
+ sMoveTutorMenu->showContestInfo = FALSE;
+ for (i = 0; i < MAX_MOVE_TUTOR_MOVES; i++)
+ sMoveTutorMenu->movesToLearn[i] = 0;
+}
+
+static void UpdateMoveTutorMenuCursorPosition(struct Sprite *sprite)
+{
+ s16 var = (sprite->data[1] * 10) & 0xFF;
+
+ switch (sprite->data[0])
+ {
+ case 0:
+ break;
+ case 1:
+ sprite->pos2.x = Sin(var, 3) * sprite->data[2];
+ break;
+ case 2:
+ sprite->pos2.y = Sin(var, 1) * sprite->data[2];
+ break;
+ }
+ sprite->data[1]++;
+}
+
+static void InitMoveTutorMenuSprites(void)
+{
+ s32 i;
+
+ sMoveTutorMenu->spriteIDs[0] = CreateSprite(&gSpriteTemplate_8402D90, 8, 16, 0);
+ gSprites[sMoveTutorMenu->spriteIDs[0]].data[0] = 1;
+ gSprites[sMoveTutorMenu->spriteIDs[0]].data[2] = -1;
+
+ sMoveTutorMenu->spriteIDs[1] = CreateSprite(&gSpriteTemplate_8402D90, 72, 16, 0);
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[1]], 1);
+ gSprites[sMoveTutorMenu->spriteIDs[1]].data[0] = 1;
+ gSprites[sMoveTutorMenu->spriteIDs[1]].data[2] = 1;
+
+ sMoveTutorMenu->spriteIDs[2] = CreateSprite(&gSpriteTemplate_8402DC0, 160, 4, 0);
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[2]], 1);
+ gSprites[sMoveTutorMenu->spriteIDs[2]].data[0] = 2;
+ gSprites[sMoveTutorMenu->spriteIDs[2]].data[2] = -1;
+
+ sMoveTutorMenu->spriteIDs[3] = CreateSprite(&gSpriteTemplate_8402DC0, 160, 60, 0);
+ gSprites[sMoveTutorMenu->spriteIDs[3]].data[0] = 2;
+ gSprites[sMoveTutorMenu->spriteIDs[3]].data[2] = 1;
+
+ for (i = 0; i < 8; i++)
+ {
+ sMoveTutorMenu->spriteIDs[i + 4] = CreateSprite(&gSpriteTemplate_8402E08, (i - (i / 4) * 4) * 8 + 0x1C, (i / 4) * 8 + 0x34, 0);
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[i + 4]], 2);
+ }
+
+ for (i = 0; i < 8; i++)
+ {
+ sMoveTutorMenu->spriteIDs[i + 12] = CreateSprite(&gSpriteTemplate_8402E08, (i - (i / 4) * 4) * 8 + 0x1C, (i / 4) * 8 + 0x5C, 0);
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[i + 12]], 2);
+ }
+
+ for (i = 0; i < 20; i++)
+ gSprites[sMoveTutorMenu->spriteIDs[i]].invisible = TRUE;
+
+ CreateBlendedOutlineCursor(16, 0xFFFF, 12, 0x2D9F, 18);
+}
+
+static void InitMoveTutorMenuStrings(void)
+{
+ s32 i;
+ u8 nickname[POKEMON_NAME_LENGTH + 1];
+
+ sMoveTutorMenu->numMenuChoices = GetMoveTutorMoves(&gPlayerParty[sMoveTutorMenu->partyMonIndex], sMoveTutorMenu->movesToLearn);
+ for (i = 0; i < sMoveTutorMenu->numMenuChoices; i++)
+ StringCopy(sMoveTutorMenu->moveNames[i], gMoveNames[sMoveTutorMenu->movesToLearn[i]]);
+ GetMonData(&gPlayerParty[sMoveTutorMenu->partyMonIndex], MON_DATA_NICKNAME, nickname);
+ StringCopy10(gStringVar1, nickname);
+ StringCopy(sMoveTutorMenu->moveNames[sMoveTutorMenu->numMenuChoices], gOtherText_Exit);
+ sMoveTutorMenu->numMenuChoices++;
+}
+
+static void MoveCursorPos(s8 delta)
+{
+ sMoveTutorMenu->previousCursorPos = sMoveTutorMenu->cursorPos;
+ sMoveTutorMenu->cursorPos += delta;
+ sMoveTutorMenu->redrawCursor = TRUE;
+}
+
+static void HandleMoveTutorMenuInput(void)
+{
+ if (gMain.newAndRepeatedKeys & DPAD_UP)
+ {
+ if (sMoveTutorMenu->menuSelection != 0)
+ {
+ PlaySE(SE_SELECT);
+ sMoveTutorMenu->menuSelection--;
+ sMoveTutorMenu->redrawMoveInfoWindow = TRUE;
+ if (sMoveTutorMenu->cursorPos != 0)
+ {
+ MoveCursorPos(-1);
+ }
+ else if (sMoveTutorMenu->curMenuChoice != 0)
+ {
+ sMoveTutorMenu->curMenuChoice--;
+ sMoveTutorMenu->redrawMoveSelectionWindow++;
+ }
+ }
+ }
+ else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
+ {
+ if (sMoveTutorMenu->menuSelection < sMoveTutorMenu->numMenuChoices - 1)
+ {
+ PlaySE(SE_SELECT);
+ sMoveTutorMenu->menuSelection++;
+ sMoveTutorMenu->redrawMoveInfoWindow = TRUE;
+ if (sMoveTutorMenu->cursorPos != 2)
+ {
+ MoveCursorPos(1);
+ }
+ else if (sMoveTutorMenu->curMenuChoice != sMoveTutorMenu->numMenuChoices - 3)
+ {
+ sMoveTutorMenu->curMenuChoice++;
+ sMoveTutorMenu->redrawMoveSelectionWindow++;
+ }
+ }
+ }
+ else if (gMain.newKeys & A_BUTTON)
+ {
+ PlaySE(SE_SELECT);
+ if (sMoveTutorMenu->menuSelection != sMoveTutorMenu->numMenuChoices - 1)
+ {
+ sMoveTutorMenu->state = 8;
+ StringCopy(gStringVar2, sMoveTutorMenu->moveNames[sMoveTutorMenu->menuSelection]);
+ StringExpandPlaceholders(gStringVar4, gOtherText_TeachSpecificMove);
+ MenuPrintMessage(gStringVar4, 3, 15);
+ }
+ else
+ {
+ StringExpandPlaceholders(gStringVar4, gOtherText_GiveUpTeachingMove);
+ MenuPrintMessage(gStringVar4, 3, 15);
+ sMoveTutorMenu->state = 12;
+ }
+ }
+ else if (gMain.newKeys & B_BUTTON)
+ {
+ PlaySE(SE_SELECT);
+ sMoveTutorMenu->state = 12;
+ StringExpandPlaceholders(gStringVar4, gOtherText_GiveUpTeachingMove);
+ MenuPrintMessage(gStringVar4, 3, 15);
+ }
+ if (sMoveTutorMenu->numMenuChoices > 3)
+ {
+ gSprites[2].invisible = FALSE;
+ gSprites[3].invisible = FALSE;
+ if (sMoveTutorMenu->curMenuChoice == 0)
+ gSprites[2].invisible = TRUE;
+ else if (sMoveTutorMenu->curMenuChoice == sMoveTutorMenu->numMenuChoices - 3)
+ gSprites[3].invisible = TRUE;
+ }
+}
+
+static void DrawMoveSelectionWindow(void)
+{
+ u8 menuChoice = sMoveTutorMenu->curMenuChoice;
+ u8 *str = gTileBuffer;
+ s32 i;
+
+ for (i = 0; i < 3; i++)
+ {
+ if (menuChoice >= sMoveTutorMenu->numMenuChoices)
+ {
+ str = AlignStringInMenuWindow(str, gEmptyString_81E72B0, 0x90, 0);
+ }
+ else if (menuChoice == sMoveTutorMenu->numMenuChoices - 1)
+ {
+ str = AlignStringInMenuWindow(str, gOtherText_Exit, 0x90, 0);
+ }
+ else
+ {
+ u16 moveId = sMoveTutorMenu->movesToLearn[menuChoice];
+
+ if (sMoveTutorMenu->showContestInfo)
+ str = AlignStringInMenuWindow(str, gContestCategoryNames[gContestMoves[moveId].contestCategory], 0x27, 0);
+ else
+ str = AlignStringInMenuWindow(str, gTypeNames[gBattleMoves[moveId].type], 0x27, 0);
+
+ str = AlignStringInMenuWindow(str, sMoveTutorMenu->moveNames[menuChoice], 0x72, 0);
+
+ str[0] = CHAR_P;
+ str[1] = CHAR_P;
+ str[2] = CHAR_SLASH;
+ str += 3;
+
+ str = AlignInt1InMenuWindow(str, gBattleMoves[moveId].pp, 0x90, 0);
+ }
+ *str++ = CHAR_NEWLINE;
+ menuChoice++;
+ }
+ *str = EOS;
+ Menu_PrintText(gTileBuffer, 11, 1);
+ MoveCursorPos(0);
+}
+
+static const u8 sMoveInfoTextCoords[7][3] =
+{
+ {11, 1, 1},
+ { 3, 6, 2},
+ {24, 1, 3},
+ { 3, 11, 4},
+ { 5, 4, 5},
+ { 3, 6, 6},
+ { 3, 11, 7},
+};
+
+static const u8 sBattleMoveInfoCoordIds[] = {0, 1, 2, 3};
+static const u8 sContestMoveInfoCoordIds[] = {4, 5, 6};
+
+void PrintMoveInfo(u16 moveId, const u8 *moveInfoCoords)
+{
+ u8 str[0x34];
+ u8 numHearts;
+ u8 i;
+
+ StringCopy(str, gExpandedPlaceholder_Empty);
+ switch (moveInfoCoords[2])
+ {
+ case 1:
+ break;
+ case 2:
+ if (gBattleMoves[moveId].power < 2)
+ AlignStringInMenuWindow(str, gOtherText_ThreeDashes2, 32, 2);
+ else
+ AlignInt1InMenuWindow(str, gBattleMoves[moveId].power, 32, 2);
+ Menu_PrintText(str, moveInfoCoords[0], moveInfoCoords[1]);
+ break;
+ case 4:
+ if (gBattleMoves[moveId].accuracy == 0)
+ AlignStringInMenuWindow(str, gOtherText_ThreeDashes2, 32, 2);
+ else
+ AlignInt1InMenuWindow(str, gBattleMoves[moveId].accuracy, 32, 2);
+ Menu_PrintText(str, moveInfoCoords[0], moveInfoCoords[1]);
+ break;
+ case 6:
+ Menu_EraseWindowRect(moveInfoCoords[0], moveInfoCoords[1], moveInfoCoords[0], moveInfoCoords[1] + 1);
+ numHearts = gContestEffects[gContestMoves[moveId].effect].appeal / 10;
+ if (numHearts == 255)
+ numHearts = 0;
+ for (i = 0; i < 8; i++)
+ {
+ if (i < numHearts)
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[i + 4]], 1);
+ else
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[i + 4]], 0);
+ }
+ break;
+ case 7:
+ Menu_EraseWindowRect(moveInfoCoords[0], moveInfoCoords[1], moveInfoCoords[0], moveInfoCoords[1] + 1);
+ numHearts = gContestEffects[gContestMoves[moveId].effect].jam / 10;
+ if (numHearts == 255)
+ numHearts = 0;
+ for (i = 0; i < 8; i++)
+ {
+ if (i < numHearts)
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[i + 12]], 3);
+ else
+ StartSpriteAnim(&gSprites[sMoveTutorMenu->spriteIDs[i + 12]], 2);
+ }
+ break;
+ }
+}
+
+static void DrawMoveInfoWindow(bool8 contestInfo, int unused)
+{
+ u16 i;
+
+ if (sMoveTutorMenu->menuSelection != sMoveTutorMenu->numMenuChoices - 1)
+ {
+ u16 moveId = sMoveTutorMenu->movesToLearn[sMoveTutorMenu->menuSelection];
+
+ if (contestInfo)
+ {
+ for (i = 0; i < 16; i++)
+ gSprites[sMoveTutorMenu->spriteIDs[i + 4]].invisible = FALSE;
+ for (i = 0; i < 3; i++)
+ PrintMoveInfo(moveId, sMoveInfoTextCoords[sContestMoveInfoCoordIds[i]]);
+ sub_8072AB0(gContestEffectStrings[gContestMoves[moveId].effect], 0x58, 0x48, 0x90, 32, 1);
+ }
+ else
+ {
+ u8 var;
+
+ for (i = 0; i < 4; i++)
+ PrintMoveInfo(moveId, sMoveInfoTextCoords[sBattleMoveInfoCoordIds[i]]);
+ var = sub_8072A18(gMoveDescriptions[moveId - 1], 0x58, 0x48, 0x90, 1);
+ if (var < 2)
+ {
+ u8 r1 = var * 2 + 9;
+
+ Menu_BlankWindowRect(11, r1, 28, 12);
+ }
+ }
+ }
+ else
+ {
+ if (contestInfo)
+ {
+ Menu_EraseWindowRect(sMoveInfoTextCoords[5][0], sMoveInfoTextCoords[5][1], sMoveInfoTextCoords[5][0], sMoveInfoTextCoords[5][1] + 1);
+ Menu_EraseWindowRect(sMoveInfoTextCoords[6][0], sMoveInfoTextCoords[6][1], sMoveInfoTextCoords[6][0], sMoveInfoTextCoords[6][1] + 1);
+ for (i = 0; i < 16; i++)
+ gSprites[sMoveTutorMenu->spriteIDs[i + 4]].invisible = TRUE;
+ }
+ else
+ {
+ Menu_EraseWindowRect(sMoveInfoTextCoords[1][0], sMoveInfoTextCoords[1][1], sMoveInfoTextCoords[1][0] + 3, sMoveInfoTextCoords[1][1] + 1);
+ Menu_EraseWindowRect(sMoveInfoTextCoords[3][0], sMoveInfoTextCoords[3][1], sMoveInfoTextCoords[3][0] + 3, sMoveInfoTextCoords[3][1] + 1);
+ }
+ Menu_EraseWindowRect(11, 9, 28, 12);
+ }
+}
+
+static void RedrawMoveInfoWindow(void)
+{
+ Menu_EraseWindowRect(21, 7, 27, 12);
+ DrawMoveInfoWindow(sMoveTutorMenu->showContestInfo, 0);
+}
diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c
index 53659bdb4..b39804b79 100644
--- a/src/mystery_event_menu.c
+++ b/src/mystery_event_menu.c
@@ -47,8 +47,8 @@ void CB2_InitMysteryEventMenu(void)
FreeAllSpritePalettes();
ResetTasks();
SetVBlankCallback(VBlankCB);
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
Menu_EraseScreen();
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON;
REG_BLDCNT = 0;
@@ -394,8 +394,8 @@ void debug_sub_815D15C(void)
FreeAllSpritePalettes();
ResetTasks();
SetVBlankCallback(VBlankCB);
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
Menu_EraseScreen();
REG_DISPCNT = DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_MODE_0;
REG_BLDCNT = 0;
diff --git a/src/overworld.c b/src/overworld.c
index a85cde128..47e23ad35 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -1124,8 +1124,8 @@ void CB2_InitTestMenu(void)
ResetSpriteData();
ResetTasks();
ScanlineEffect_Stop();
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
debug_sub_8076B68();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
REG_IE |= 1;
@@ -1550,7 +1550,7 @@ bool32 sub_805483C(u8 *a1)
sub_8054814();
sub_8054C54();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
(*a1)++;
break;
case 5:
@@ -1616,7 +1616,7 @@ bool32 sub_805493C(u8 *a1, u32 a2)
sub_8054814();
sub_8054C54();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
(*a1)++;
break;
case 5:
@@ -1706,7 +1706,7 @@ bool32 sub_8054A9C(u8 *a1)
sub_8054814();
sub_8054C54();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
(*a1)++;
break;
case 4:
@@ -1772,7 +1772,7 @@ void sub_8054C2C(void)
sub_8054814();
sub_8054C54();
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
mapdata_load_assets_to_gpu_and_full_redraw();
}
diff --git a/src/party_menu.c b/src/party_menu.c
index 785d86007..a39300825 100644
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -3427,10 +3427,10 @@ void PartyMenuDoPrintHP(u8 monIndex, u8 b, u16 currentHP, u16 maxHP)
{
u32 *var;
register u8 *stringVar1 asm("r2") = gStringVar1;
- register u8 *textPtr asm("r2") = sub_8072C14(stringVar1, currentHP, 15, 1);
+ register u8 *textPtr asm("r2") = AlignInt1InMenuWindow(stringVar1, currentHP, 15, 1);
textPtr[0] = CHAR_SLASH;
- sub_8072C14(++textPtr, maxHP, 35, 1);
+ AlignInt1InMenuWindow(++textPtr, maxHP, 35, 1);
var = 0;
CpuFastSet(&var, gUnknown_02039460, 0x1000040);
diff --git a/src/player_pc.c b/src/player_pc.c
index 27427ecaa..e52666a50 100644
--- a/src/player_pc.c
+++ b/src/player_pc.c
@@ -135,7 +135,7 @@ static const struct MenuAction2 gPCText_ItemPCOptionsText[] =
{ PCText_WithdrawItem, ItemStorage_Withdraw },
{ PCText_DepositItem, ItemStorage_Deposit },
{ PCText_TossItem, ItemStorage_Toss },
- { gUnknownText_Exit, ItemStorage_Exit }
+ { gOtherText_Exit, ItemStorage_Exit }
};
static const struct YesNoFuncTable ResumeFromTossYesNoFuncList[] = // ResumeFromTossYesNoFuncList
diff --git a/src/pokeblock.c b/src/pokeblock.c
index 4087cbbb0..a24cb32cf 100644
--- a/src/pokeblock.c
+++ b/src/pokeblock.c
@@ -486,7 +486,7 @@ static void sub_810BB88(u8 a0)
y = (i - a0) << 1;
if (i == gUnknown_02039248.unk2)
{
- buf = sub_8072C74(gStringVar1, gContestStatsText_StowCase, 0x78, 0);
+ buf = AlignStringInMenuWindow(gStringVar1, gContestStatsText_StowCase, 0x78, 0);
Menu_PrintText(gStringVar1, 15, y + 1);
if (i != a0 + 8)
{
@@ -494,7 +494,7 @@ static void sub_810BB88(u8 a0)
}
break;
}
- buf = sub_8072C74(gStringVar1, gPokeblockNames[gSaveBlock1.pokeblocks[i].color], 0x5e, 0);
+ buf = AlignStringInMenuWindow(gStringVar1, gPokeblockNames[gSaveBlock1.pokeblocks[i].color], 0x5e, 0);
buf[0] = EXT_CTRL_CODE_BEGIN;
buf[1] = 0x14;
buf[2] = 0x06;
@@ -615,7 +615,7 @@ static void sub_810BDAC(bool8 flag)
BasicInitMenuWindow(&gWindowTemplate_81E6E34);
if (gUnknown_02039248.unk0 + gUnknown_02039248.unk1 != gUnknown_02039248.unk2)
{
- sub_8072C14(gStringVar1, sub_810C9E8(&gSaveBlock1.pokeblocks[gUnknown_02039248.unk0 + gUnknown_02039248.unk1]), 16, 1);
+ AlignInt1InMenuWindow(gStringVar1, sub_810C9E8(&gSaveBlock1.pokeblocks[gUnknown_02039248.unk0 + gUnknown_02039248.unk1]), 16, 1);
Menu_PrintText(gStringVar1, 11, 17);
}
else
diff --git a/src/pokemon_3.c b/src/pokemon_3.c
index abf1ef9c6..c6eda8bca 100644
--- a/src/pokemon_3.c
+++ b/src/pokemon_3.c
@@ -10,6 +10,7 @@
#include "link.h"
#include "m4a.h"
#include "main.h"
+#include "move_tutor_menu.h"
#include "pokemon.h"
#include "random.h"
#include "overworld.h"
@@ -993,18 +994,18 @@ u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm)
}
}
-u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
+u8 GetMoveTutorMoves(struct Pokemon *mon, u16 *moves)
{
- u16 learnedMoves[4];
+ u16 knownMoves[4];
u8 numMoves = 0;
u16 species = GetMonData(mon, MON_DATA_SPECIES, 0);
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
int i, j, k;
for (i = 0; i < 4; i++)
- learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
+ knownMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0);
- for (i = 0; i < 20; i++)
+ for (i = 0; i < MAX_MOVE_TUTOR_MOVES; i++)
{
u16 moveLevel;
@@ -1012,10 +1013,9 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
break;
moveLevel = gLevelUpLearnsets[species][i] & 0xFE00;
-
if (moveLevel <= (level << 9))
{
- for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
+ for (j = 0; j < 4 && knownMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++)
;
if (j == 4)
diff --git a/src/pokemon_storage_system_4.c b/src/pokemon_storage_system_4.c
index 00e7c10d2..2d156c159 100644
--- a/src/pokemon_storage_system_4.c
+++ b/src/pokemon_storage_system_4.c
@@ -912,7 +912,7 @@ void sub_809A23C(u8 boxId)
gPokemonStorageSystemPtr->unk_0d08 |= 0x10000 << tagIdx;
sub_809A1BC(gPokemonStorageSystemPtr->unk_08ca, gPokemonStorage.boxNames[boxId]);
LoadSpriteSheet(&spriteSheet);
- r6 = sub_809A6D0(sub_8072CA4(gPokemonStorage.boxNames[boxId]));
+ r6 = sub_809A6D0(GetStringWidthInMenuWindow(gPokemonStorage.boxNames[boxId]));
for (i = 0; i < 2; i++)
{
u8 spriteId = CreateSprite(&gSpriteTemplate_83BB2B8, r6 + i * 32, 0x1c, 23);
@@ -947,7 +947,7 @@ void sub_809A3D0(u8 boxId, s8 a1)
sub_809A1BC(gPokemonStorageSystemPtr->unk_08ca, gPokemonStorage.boxNames[boxId]);
LoadSpriteSheet(&spriteSheet);
LoadPalette(gUnknown_083BB0A8[gPokemonStorage.wallpaper[boxId]], r8, 0x04);
- x = sub_809A6D0(sub_8072CA4(gPokemonStorage.boxNames[boxId]));
+ x = sub_809A6D0(GetStringWidthInMenuWindow(gPokemonStorage.boxNames[boxId]));
x2 = x + a1 * 192;
for (i = 0; i < 2; i++)
{
@@ -2061,7 +2061,7 @@ void sub_809C04C(void *pokemon, u8 a1)
buf = gPokemonStorageSystemPtr->unk_1259 + 8;
buf[0] = 0x34; // LV
buf = gPokemonStorageSystemPtr->unk_1259 + 9;
- buf = sub_8072C14(buf, gPokemonStorageSystemPtr->unk_11f8, 0x22, STR_CONV_MODE_RIGHT_ALIGN);
+ buf = AlignInt1InMenuWindow(buf, gPokemonStorageSystemPtr->unk_11f8, 0x22, STR_CONV_MODE_RIGHT_ALIGN);
buf[0] = EXT_CTRL_CODE_BEGIN;
buf[1] = 0x11; // CLEAR
buf[2] = 8;
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index d369347fc..7fc422125 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -9,12 +9,12 @@
#include "event_data.h"
#include "ewram.h"
#include "item.h"
-#include "learn_move.h"
#include "link.h"
#include "m4a.h"
#include "main.h"
#include "menu.h"
#include "menu_helpers.h"
+#include "move_tutor_menu.h"
#include "overworld.h"
#include "palette.h"
#include "party_menu.h"
@@ -2577,9 +2577,9 @@ static void sub_809FF64(struct Pokemon *mon)
ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPEED));
sub_8072BD8(buffer, 27, 11, 18);
- buffer = sub_8072C14(buffer, GetMonData(mon, MON_DATA_HP), 24, 1);
+ buffer = AlignInt1InMenuWindow(buffer, GetMonData(mon, MON_DATA_HP), 24, 1);
*buffer++ = CHAR_SLASH;
- buffer = sub_8072C14(buffer, GetMonData(mon, MON_DATA_MAX_HP), 48, 1);
+ buffer = AlignInt1InMenuWindow(buffer, GetMonData(mon, MON_DATA_MAX_HP), 48, 1);
Menu_PrintTextPixelCoords(gStringVar1, 126, 56, 1);
}
@@ -2651,9 +2651,9 @@ static void sub_80A015C(struct Pokemon *mon)
maxPP = CalculatePPWithBonus(move, ppBonuses, i);
buffer = gStringVar1;
- buffer = sub_8072C14(buffer, curPP, 14, 1);
+ buffer = AlignInt1InMenuWindow(buffer, curPP, 14, 1);
*buffer++ = CHAR_SLASH;
- sub_8072C14(buffer, maxPP, 32, 1);
+ AlignInt1InMenuWindow(buffer, maxPP, 32, 1);
Menu_PrintText(gStringVar1, 25, (2 * i) + 4);
}
}
@@ -2687,9 +2687,9 @@ static void sub_80A029C(struct Pokemon *mon)
buffer = gStringVar1;
pp = gBattleMoves[move].pp;
- buffer = sub_8072C14(buffer, pp, 14, 1);
+ buffer = AlignInt1InMenuWindow(buffer, pp, 14, 1);
*buffer++ = CHAR_SLASH;
- buffer = sub_8072C14(buffer, pp, 32, 1);
+ buffer = AlignInt1InMenuWindow(buffer, pp, 32, 1);
Menu_PrintText(gStringVar1, 25, 12);
}
@@ -2769,26 +2769,26 @@ static void sub_80A04CC(u16 move)
if (gBattleMoves[move].power <= 1)
{
buffer = gStringVar1;
- buffer = sub_8072C74(buffer, gOtherText_ThreeDashes2, 21, 1);
+ buffer = AlignStringInMenuWindow(buffer, gOtherText_ThreeDashes2, 21, 1);
Menu_PrintText(gStringVar1, 7, 15);
}
else
{
buffer = gStringVar1;
- buffer = sub_8072C14(buffer, gBattleMoves[move].power, 21, 1);
+ buffer = AlignInt1InMenuWindow(buffer, gBattleMoves[move].power, 21, 1);
Menu_PrintText(gStringVar1, 7, 15);
}
if (gBattleMoves[move].accuracy == 0)
{
buffer = gStringVar1;
- buffer = sub_8072C74(buffer, gOtherText_ThreeDashes2, 21, 1);
+ buffer = AlignStringInMenuWindow(buffer, gOtherText_ThreeDashes2, 21, 1);
Menu_PrintText(gStringVar1, 7, 17);
}
else
{
buffer = gStringVar1;
- buffer = sub_8072C14(buffer, gBattleMoves[move].accuracy, 21, 1);
+ buffer = AlignInt1InMenuWindow(buffer, gBattleMoves[move].accuracy, 21, 1);
Menu_PrintText(gStringVar1, 7, 17);
}
}
diff --git a/src/pokenav_before.c b/src/pokenav_before.c
index 61baea929..49df4863e 100644
--- a/src/pokenav_before.c
+++ b/src/pokenav_before.c
@@ -3851,7 +3851,7 @@ void sub_80EF428(u8 a, u8 b)
}
tileBuffer = gUnknown_083DFEC8;
- sub_8072C74(&tileBuffer[0x800], pcText, 0xC0, 2);
+ AlignStringInMenuWindow(&tileBuffer[0x800], pcText, 0xC0, 2);
Menu_PrintText(&tileBuffer[0x800], 3, 17);
}
diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c
index d8c07f2bb..52ec0a919 100644
--- a/src/reset_rtc_screen.c
+++ b/src/reset_rtc_screen.c
@@ -278,10 +278,10 @@ void ResetRtcScreen_PrintTime(u8 x, u8 y, u16 days, u8 hours, u8 minutes, u8 sec
hours %= 24;
minutes %= 60;
seconds %= 60;
- sub_8072C44(gStringVar1, days, 24, 1);
+ AlignInt2InMenuWindow(gStringVar1, days, 24, 1);
dest = StringCopy(dest, gStringVar1);
dest = StringCopy(dest, gOtherText_Day);
- sub_8072C44(gStringVar1, hours, 18, 1);
+ AlignInt2InMenuWindow(gStringVar1, hours, 18, 1);
dest = StringCopy(dest, gStringVar1);
dest = StringCopy(dest, gUnknown_08376500);
dest = ConvertIntToDecimalStringN(dest, minutes, STR_CONV_MODE_LEADING_ZEROS, 2);
@@ -426,8 +426,8 @@ void CB2_InitResetRtcScreen(void)
ResetSpriteData();
ResetTasks();
ResetPaletteFade();
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
REG_DISPCNT = 4352;
SetVBlankCallback(VBlankCB_ResetRtcScreen);
SetMainCallback2(CB2_ResetRtcScreen);
diff --git a/src/roulette.c b/src/roulette.c
index 49627dade..ab60e089a 100644
--- a/src/roulette.c
+++ b/src/roulette.c
@@ -436,7 +436,7 @@ void sub_8115384(void)
break;
case 0x2:
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
LoadPalette(&gUnknown_083F86BC, 0x0, 0x1C0);
gMain.state++;
break;
diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c
index d73c90fb3..f5544bc65 100644
--- a/src/save_failed_screen.c
+++ b/src/save_failed_screen.c
@@ -122,7 +122,7 @@ static void CB2_SaveFailedScreen(void)
LoadPalette(&gBirchBagGrassPal, 0, sizeof(gBirchBagGrassPal));
LoadPalette(&gSaveFailedClockPal, 0x100, sizeof(gSaveFailedClockPal));
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
Menu_DrawStdWindowFrame(13, CLOCK_WIN_TOP, 16, CLOCK_WIN_TOP + 3); // clock window
Menu_DrawStdWindowFrame(1, MSG_WIN_TOP, 28, 19); // message window
Menu_PrintText(gSystemText_SaveFailedBackupCheck, 2, MSG_WIN_TOP + 1);
diff --git a/src/script_menu.c b/src/script_menu.c
index 615004be3..1a7489c82 100644
--- a/src/script_menu.c
+++ b/src/script_menu.c
@@ -622,7 +622,7 @@ bool8 ScriptMenu_MultichoiceWithDefault(u8 left, u8 top, u8 multichoiceId, u8 ig
static u16 GetStringWidthInTilesForScriptMenu(const u8 *str)
{
// each tile on screen is 8x8, so it needs the number of tiles and not pixels, hence the division by 8.
- return (Text_GetStringWidthFromWindowTemplate((struct WindowTemplate *)&gWindowTemplate_81E6CE4, str) + 7) / 8;
+ return (Text_GetStringWidthFromWindowTemplate((struct WindowTemplate *)&gMenuTextWindowTemplate, str) + 7) / 8;
}
static void DrawMultichoiceMenu(u8 left, u8 top, u8 count, const struct MenuAction *list, u8 ignoreBPress, u8 cursorPos)
diff --git a/src/secret_base.c b/src/secret_base.c
index 1a4b765a0..60ce80af5 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -98,7 +98,7 @@ const u8 gUnknown_083D1374[] = {
const struct MenuAction2 gUnknown_083D13D4[] = {
{SecretBaseText_DelRegist, sub_80BCA84},
- {gUnknownText_Exit, sub_80BCBF8}
+ {gOtherText_Exit, sub_80BCBF8}
};
const struct YesNoFuncTable gUnknown_083D13E4 = {
@@ -1011,7 +1011,7 @@ void sub_80BC6B0(u8 taskId)
if (n < 8)
{
Menu_BlankWindowRect(18, 2 * n + 2, 28, 2 * n + 3);
- Menu_PrintText(gUnknownText_Exit, 18, 2 * n + 2);
+ Menu_PrintText(gOtherText_Exit, 18, 2 * n + 2);
DestroyVerticalScrollIndicator(BOTTOM_ARROW);
if (n != 7)
Menu_BlankWindowRect(18, ((n << 25) + (1 << 26)) >> 24, 28, 18); // the shifts are needed to match
diff --git a/src/start_menu.c b/src/start_menu.c
index 5c437178c..2024ba89a 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -300,7 +300,7 @@ static void BuildStartMenuActions_Link(void)
//Show number of safari balls left
static void DisplaySafariBallsWindow(void)
{
- sub_8072C44(gStringVar1, gNumSafariBalls, 12, 1);
+ AlignInt2InMenuWindow(gStringVar1, gNumSafariBalls, 12, 1);
Menu_DrawStdWindowFrame(0, 0, 10, 5);
Menu_PrintText(gOtherText_SafariStock, 1, 1);
}
@@ -379,7 +379,7 @@ void CreateStartMenuTask(void (*func)(u8))
{
u8 taskId;
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
taskId = CreateTask(Task_StartMenu, 0x50);
SetTaskFuncWithFollowupFunc(taskId, Task_StartMenu, func);
}
@@ -865,8 +865,8 @@ static bool32 sub_80719FC(u8 *step)
ScanlineEffect_Clear();
break;
case 2:
- Text_LoadWindowTemplate(&gWindowTemplate_81E6CE4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ Text_LoadWindowTemplate(&gMenuTextWindowTemplate);
+ InitMenuWindow(&gMenuTextWindowTemplate);
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_BG0_ON;
break;
case 3:
diff --git a/src/starter_choose.c b/src/starter_choose.c
index 836925e77..4e430015e 100644
--- a/src/starter_choose.c
+++ b/src/starter_choose.c
@@ -295,7 +295,7 @@ void CB2_ChooseStarter(void)
LoadCompressedObjectPic(&gUnknown_083F77A4[0]);
LoadSpritePalettes(gUnknown_083F77B4);
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
savedIme = REG_IME;
@@ -534,7 +534,7 @@ static void CreateStarterPokemonLabel(u8 prevSelection, u8 selection)
AddTextColorCtrlCode(labelText, 0, 15, 8);
//Copy Pokemon name to label
- sub_8072C74(labelText + 5, gSpeciesNames[species], 0x6B, 1);
+ AlignStringInMenuWindow(labelText + 5, gSpeciesNames[species], 0x6B, 1);
Menu_PrintText(
labelText,
gStarterChoose_LabelCoords[selection][0],
@@ -663,7 +663,7 @@ _0810A8CA:\n\
adds r0, r7, 0\n\
movs r2, 0x70\n\
movs r3, 0x2\n\
- bl sub_8072C74\n\
+ bl AlignStringInMenuWindow\n\
adds r2, r5, 0x2\n\
lsls r2, 24\n\
lsrs r2, 24\n\
diff --git a/src/strings.c b/src/strings.c
index 0f599db72..cded04f96 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -159,7 +159,7 @@ const u8 OtherText_CheckTag[] = _("CHECK TAG");
const u8 OtherText_Confirm[] = _("CONFIRM");
const u8 gOtherText_Walk[] = _("WALK");
-const u8 gUnknownText_Exit[] = _("EXIT");
+const u8 gOtherText_Exit[] = _("EXIT");
const u8 gOtherText_CancelNoTerminator[] = _("CANCEL");
const u8 gOtherText_CancelWithTerminator[] = _("$CANCEL"); // with terminator at beginning?
@@ -1085,7 +1085,7 @@ const u8 OtherText_CheckTag[] = _("PRÜFEN");
const u8 OtherText_Confirm[] = _("O.K.");
const u8 gOtherText_Walk[] = _("LAUFEN");
-const u8 gUnknownText_Exit[] = _("BEENDEN");
+const u8 gOtherText_Exit[] = _("BEENDEN");
const u8 gOtherText_CancelNoTerminator[] = _("ZURÜCK");
const u8 gOtherText_CancelWithTerminator[] = _("$ZURÜCK");
diff --git a/src/text.c b/src/text.c
index 234e6085d..c2f78276b 100644
--- a/src/text.c
+++ b/src/text.c
@@ -618,7 +618,7 @@ const struct WindowTemplate gWindowTemplate_81E6CC8 =
BG_SCREEN_ADDR(15), // tilemap
};
-const struct WindowTemplate gWindowTemplate_81E6CE4 =
+const struct WindowTemplate gMenuTextWindowTemplate =
{
0, // BG number
2, // BG character base block
@@ -1647,7 +1647,7 @@ const struct WindowTemplate gWindowTemplate_81E7224 =
BG_SCREEN_ADDR(31), // tilemap
};
-const struct WindowTemplate gWindowTemplate_81E7240 =
+const struct WindowTemplate gMoveTutorMenuFramesWindowTemplate =
{
1, // BG number
2, // BG character base block
@@ -3458,7 +3458,7 @@ u8 *AlignInt1(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT
case 0:
ConvertIntToDecimalString(temp, value);
dest = StringCopy(dest, temp);
- dest[0] = 0xFC;
+ dest[0] = EXT_CTRL_CODE_BEGIN;
dest[1] = 19;
dest[2] = alignAmount;
dest += 3;
@@ -3469,7 +3469,7 @@ u8 *AlignInt1(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT
width = GetStringWidth(win, temp);
if (alignAmount > width)
{
- dest[0] = 0xFC;
+ dest[0] = EXT_CTRL_CODE_BEGIN;
dest[1] = 19;
dest[2] = alignAmount - width;
dest += 3;
@@ -3481,7 +3481,7 @@ u8 *AlignInt1(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT
width = GetStringWidth(win, temp);
if (alignAmount > width)
{
- dest[0] = 0xFC;
+ dest[0] = EXT_CTRL_CODE_BEGIN;
dest[1] = 19;
dest[2] = (alignAmount - width) / 2;
dest += 3;
@@ -3489,7 +3489,7 @@ u8 *AlignInt1(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT
dest = StringCopy(dest, temp);
if (alignAmount > width)
{
- dest[0] = 0xFC;
+ dest[0] = EXT_CTRL_CODE_BEGIN;
dest[1] = 19;
dest[2] = alignAmount;
dest += 3;
diff --git a/src/trade.c b/src/trade.c
index 4bed5d92b..8d7f5b1fc 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -1089,7 +1089,7 @@ static void sub_8047EC0(void)
ResetTasks();
sub_804A964(&gUnknown_03004824->unk_00c8, BG_SCREEN_ADDR(5));
SetVBlankCallback(sub_80489F4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
Text_LoadWindowTemplate(&gWindowTemplate_81E6F84);
Text_InitWindowWithTemplate(&gUnknown_03004824->window, &gWindowTemplate_81E6F84);
gUnknown_03004824->unk_007a = TextWindow_SetBaseTileNum(20);
@@ -1269,7 +1269,7 @@ static void sub_80484F4(void)
ResetTasks();
sub_804A964(&gUnknown_03004824->unk_00c8, BG_SCREEN_ADDR(5));
SetVBlankCallback(sub_80489F4);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
Text_LoadWindowTemplate(&gWindowTemplate_81E6F84);
Text_InitWindowWithTemplate(&gUnknown_03004824->window, &gWindowTemplate_81E6F84);
gUnknown_03004824->unk_007a = TextWindow_SetBaseTileNum(20);
diff --git a/src/trainer_card.c b/src/trainer_card.c
index 52be7b521..541a4a061 100644
--- a/src/trainer_card.c
+++ b/src/trainer_card.c
@@ -1452,7 +1452,7 @@ static void TrainerCard_Front_GetPlayTimeString(u8 *arg1, s16 colon)
playTimeMinutes = ewram0_2.displayedCard.playTimeMinutes;
}
FormatPlayTime(buffer, playTimeHours, playTimeMinutes, colon);
- sub_8072C74(arg1, buffer, 48, 1);
+ AlignStringInMenuWindow(arg1, buffer, 48, 1);
}
static void TrainerCard_PrintEasyChatPhrase(void)
@@ -1548,10 +1548,10 @@ static void TrainerCard_Back_PrintBattleTower(void)
if (ewram0_2.showBattleTowerStatus != 0)
{
- sub_8072C44(buffer, ewram0_2.displayedCard.battleTowerWins, 24, 1);
+ AlignInt2InMenuWindow(buffer, ewram0_2.displayedCard.battleTowerWins, 24, 1);
Menu_PrintTextPixelCoords(buffer, 112, 120, 0);
- sub_8072C44(buffer, ewram0_2.displayedCard.battleTowerLosses, 24, 1);
+ AlignInt2InMenuWindow(buffer, ewram0_2.displayedCard.battleTowerLosses, 24, 1);
Menu_PrintTextPixelCoords(buffer, 149, 120, 0);
}
}
diff --git a/src/wallclock.c b/src/wallclock.c
index e500a3777..bdef8e0f4 100644
--- a/src/wallclock.c
+++ b/src/wallclock.c
@@ -222,7 +222,7 @@ static void LoadWallClockGraphics(void)
LoadCompressedObjectPic(&gUnknown_083F7A90[0]);
LoadSpritePalettes(gUnknown_083F7AA0);
Text_LoadWindowTemplate(&gWindowTemplate_81E6C3C);
- InitMenuWindow(&gWindowTemplate_81E6CE4);
+ InitMenuWindow(&gMenuTextWindowTemplate);
}
static void WallClockInit(void)