summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/berry_powder.c2
-rw-r--r--src/coins.c6
-rw-r--r--src/fame_checker.c13
-rw-r--r--src/field_specials.c132
-rw-r--r--src/quest_log.c788
-rw-r--r--src/scrcmd.c20
-rw-r--r--src/script_menu.c1293
-rw-r--r--src/seagallop.c38
8 files changed, 1785 insertions, 507 deletions
diff --git a/src/berry_powder.c b/src/berry_powder.c
index 992e82522..f9d9f7dbb 100644
--- a/src/berry_powder.c
+++ b/src/berry_powder.c
@@ -111,7 +111,7 @@ void sub_815F094(void)
{
struct WindowTemplate template;
- if (sub_81119D4(sub_809D6D4) != TRUE)
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
{
template = SetWindowTemplateFields(0, 1, 1, 8, 3, 15, 32);
gUnknown_203F464 = AddWindow(&template);
diff --git a/src/coins.c b/src/coins.c
index 9de600e7f..2eaa31b2c 100644
--- a/src/coins.c
+++ b/src/coins.c
@@ -5,8 +5,6 @@
#include "text_window.h"
#include "strings.h"
-extern const u8 gUnknown_8417C2D[];
-
EWRAM_DATA static u8 sCoinsWindowId = 0;
#define MAX_COINS 9999
@@ -62,7 +60,7 @@ void PrintCoinsString_Parameterized(u8 windowId, u32 coinAmount, u8 x, u8 y, u8
void sub_80D0674(u8 windowId, u16 tileStart, u8 palette, u32 coinAmount)
{
DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, tileStart, palette);
- AddTextPrinterParameterized(windowId, 2, gUnknown_8417C2D, 0, 0, 0xFF, 0);
+ AddTextPrinterParameterized(windowId, 2, gText_Coins_2, 0, 0, 0xFF, 0);
PrintCoinsString_Parameterized(windowId, coinAmount, 0x10, 0xC, 0);
}
@@ -88,7 +86,7 @@ void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y)
PutWindowTilemap(sCoinsWindowId);
TextWindow_SetStdFrame0_WithPal(sCoinsWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(sCoinsWindowId, FALSE, 0x21D, 0xD);
- AddTextPrinterParameterized(sCoinsWindowId, 2, gUnknown_8417C2D, 0, 0, 0xFF, 0);
+ AddTextPrinterParameterized(sCoinsWindowId, 2, gText_Coins_2, 0, 0, 0xFF, 0);
PrintCoinsString(coinAmount);
}
diff --git a/src/fame_checker.c b/src/fame_checker.c
index 50a8aa0bc..8c8f5b4ea 100644
--- a/src/fame_checker.c
+++ b/src/fame_checker.c
@@ -26,6 +26,7 @@
#include "menu_indicators.h"
#include "text_window.h"
#include "fame_checker.h"
+#include "strings.h"
#include "constants/trainers.h"
#define SPRITETAG_SELECTOR_CURSOR 1000
@@ -124,18 +125,6 @@ static void Task_FCOpenOrCloseInfoBox(u8 taskId);
static void UpdateInfoBoxTilemap(u8 bg, s16 state);
static void PlaceListMenuCursor(bool8 isActive);
-extern const u8 gFameCheckerText_Cancel[];
-extern const u8 gFameCheckerText_ListMenuCursor[];
-extern const u8 gFameCheckerText_FameCheckerWillBeClosed[];
-extern const u8 gFameCheckerText_ClearTextbox[];
-extern const u8 gFameCheckerText_MainScreenUI[]; // "{KEYGFX_DPAD_ANY}PICK {KEYGFX_DPAD_UP_DOWN}SELECT {KEYGFX_A_BUTTON}OK$"
-extern const u8 gFameCheckerText_PickScreenUI[]; // "{KEYGFX_DPAD_ANY}PICK {KEYGFX_DPAD_UP_DOWN}SELECT {KEYGFX_B_BUTTON}CANCEL$"
-extern const u8 gFameCheckerText_FlavorTextUI[]; // "{KEYGFX_START_BUTTON}PICK {KEYGFX_A_BUTTON}READ {KEYGFX_B_BUTTON}CANCEL$"
-extern const u8 gFameCheckerOakName[]; // "OAK$"
-extern const u8 gFameCheckerDaisyName[]; // "DAISY$"
-extern const u8 gFameCheckerBillName[]; // "BILL$"
-extern const u8 gFameCheckerMrFujiName[]; // "FUJI$"
-
static const u16 sFameCheckerTilemap[] = INCBIN_U16("data/fame_checker/tilemap_845c600.bin");
static const u8 sQuestionMarkSpriteGfx[] = INCBIN_U8("data/fame_checker/img_845ce00.4bpp");
static const u8 sSpinningPokeballSpriteGfx[] = INCBIN_U8("data/fame_checker/img_845cf00.4bpp");
diff --git a/src/field_specials.c b/src/field_specials.c
index 867df4b94..617faa017 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -141,17 +141,17 @@ u8 Special_GetPlayerTrainerIdOnesDigit(void)
void Special_BufferBigGuyOrBigGirlString(void)
{
if (gSaveBlock2Ptr->playerGender == MALE)
- StringCopy(gStringVar1, gUnknown_8417FBB);
+ StringCopy(gStringVar1, gText_BigGuy);
else
- StringCopy(gStringVar1, gUnknown_8417FC3);
+ StringCopy(gStringVar1, gText_BigGirl);
}
void Special_BufferSonOrDaughterString(void)
{
if (gSaveBlock2Ptr->playerGender == MALE)
- StringCopy(gStringVar1, gUnknown_8417FD0);
+ StringCopy(gStringVar1, gText_Son);
else
- StringCopy(gStringVar1, gUnknown_8417FCC);
+ StringCopy(gStringVar1, gText_Daughter);
}
u8 Special_GetBattleOutcome(void)
@@ -729,22 +729,22 @@ static const struct WindowTemplate sElevatorCurrentFloorWindowTemplate = {
};
static const u8 *const sFloorNamePointers[] = {
- gUnknown_8418069,
- gUnknown_8418065,
- gUnknown_8418061,
- gUnknown_841805D,
- gUnknown_841803A,
- gUnknown_841803D,
- gUnknown_8418040,
- gUnknown_8418043,
- gUnknown_8418046,
- gUnknown_8418049,
- gUnknown_841804C,
- gUnknown_841804F,
- gUnknown_8418052,
- gUnknown_8418055,
- gUnknown_8418059,
- gUnknown_841806D
+ gText_B4F,
+ gText_B3F,
+ gText_B2F,
+ gText_B1F,
+ gText_1F,
+ gText_2F,
+ gText_3F,
+ gText_4F,
+ gText_5F,
+ gText_6F,
+ gText_7F,
+ gText_8F,
+ gText_9F,
+ gText_10F,
+ gText_11F,
+ gText_Rooftop
};
static const u8 sUnused_83F5B84[] = {
@@ -1064,12 +1064,12 @@ void Special_DrawElevatorCurrentFloorWindow(void)
{
const u8 *floorname;
u32 strwidth;
- if (sub_81119D4(sub_809D6D4) != TRUE)
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
{
sElevatorCurrentFloorWindowId = AddWindow(&sElevatorCurrentFloorWindowTemplate);
TextWindow_SetStdFrame0_WithPal(sElevatorCurrentFloorWindowId, 0x21D, 0xD0);
DrawStdFrameWithCustomTileAndPalette(sElevatorCurrentFloorWindowId, FALSE, 0x21D, 0xD);
- AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, 2, gUnknown_8418075, 0, 2, 0xFF, NULL);
+ AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, 2, gText_NowOn, 0, 2, 0xFF, NULL);
floorname = sFloorNamePointers[gSpecialVar_0x8005];
strwidth = GetStringWidth(2, floorname, 0);
AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, 2, floorname, 56 - strwidth, 16, 0xFF, NULL);
@@ -1137,7 +1137,7 @@ void Special_ListMenu(void)
{
u8 taskId;
struct Task * task;
- if (sub_81119D4(sub_809D6D4) != TRUE)
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
{
taskId = CreateTask(Task_CreateScriptListMenu, 8);
task = &gTasks[taskId];
@@ -1227,61 +1227,61 @@ void Special_ListMenu(void)
static const u8 *const sListMenuLabels[][12] = {
{
- gUnknown_8417FD9,
- gUnknown_8417FE6,
- gUnknown_8417FF3,
- gUnknown_8418000,
- gUnknown_841800D,
- gUnknown_8418017,
- gUnknown_8418022,
- gUnknown_841802F,
+ gText_BoulderBadge,
+ gText_CascadeBadge,
+ gText_ThunderBadge,
+ gText_RainbowBadge,
+ gText_SoulBadge,
+ gText_MarshBadge,
+ gText_VolcanoBadge,
+ gText_EarthBadge,
gOtherText_Exit,
}, {
- gUnknown_8418059,
- gUnknown_8418055,
- gUnknown_8418052,
- gUnknown_841804F,
- gUnknown_841804C,
- gUnknown_8418049,
- gUnknown_8418046,
- gUnknown_8418043,
- gUnknown_8418040,
- gUnknown_841803D,
- gUnknown_841803A,
+ gText_11F,
+ gText_10F,
+ gText_9F,
+ gText_8F,
+ gText_7F,
+ gText_6F,
+ gText_5F,
+ gText_4F,
+ gText_3F,
+ gText_2F,
+ gText_1F,
gOtherText_Exit,
}, {
- gUnknown_841805D,
- gUnknown_8418061,
- gUnknown_8418069,
+ gText_B1F,
+ gText_B2F,
+ gText_B4F,
gOtherText_Exit,
}, {
- gUnknown_8418046,
- gUnknown_8418043,
- gUnknown_8418040,
- gUnknown_841803D,
- gUnknown_841803A,
+ gText_5F,
+ gText_4F,
+ gText_3F,
+ gText_2F,
+ gText_1F,
gOtherText_Exit,
}, {
- gUnknown_841807D,
- gUnknown_841808E,
- gUnknown_841809C,
+ gText_LinkedGamePlay,
+ gText_DirectCorner,
+ gText_UnionRoom,
gOtherText_Quit,
}, {
- gUnknown_84180A7,
- gUnknown_84180BC,
- gUnknown_84180D0,
- gUnknown_84180E4,
- gUnknown_84180FA,
- gUnknown_841810D,
- gUnknown_841811D,
- gUnknown_841812F,
- gUnknown_8418142,
- gUnknown_8418152,
- gUnknown_8418163,
+ gText_Energypowder_50,
+ gText_EnergyRoot_80,
+ gText_HealPowder_50,
+ gText_RevivalHerb_300,
+ gText_Protein_1000,
+ gText_Iron_1000,
+ gText_Carbos_1000,
+ gText_Calcium_1000,
+ gText_Zinc_1000,
+ gText_HpUp_1000,
+ gText_PpUp_3000,
gOtherText_Exit,
}, {
- gUnknown_841806D,
- gUnknown_841805D,
+ gText_Rooftop,
+ gText_B1F,
gOtherText_Exit,
}
};
diff --git a/src/quest_log.c b/src/quest_log.c
index e1226c0b3..896a44d17 100644
--- a/src/quest_log.c
+++ b/src/quest_log.c
@@ -38,6 +38,7 @@
#include "quest_log_8150454.h"
#include "quest_log.h"
#include "new_menu_helpers.h"
+#include "strings.h"
u8 gUnknown_3005E88;
@@ -100,7 +101,7 @@ static EWRAM_DATA u8 gUnknown_203ADFE[3] = {0};
static EWRAM_DATA u16 *gUnknown_203AE04 = NULL;
static EWRAM_DATA u16 *gUnknown_203AE08 = NULL;
static EWRAM_DATA u16 *gUnknown_203AE0C[32] = {NULL};
-static EWRAM_DATA void (* gUnknown_203AE8C)(void) = NULL;
+static EWRAM_DATA void (* sQuestLogCB)(void) = NULL;
static EWRAM_DATA u16 *gUnknown_203AE90 = NULL;
static EWRAM_DATA struct UnkStruct_203AE94 gUnknown_203AE94 = {0};
static EWRAM_DATA struct UnkStruct_203AE98 gUnknown_203AE98[32] = {0};
@@ -135,17 +136,17 @@ static u16 QuestLog_GetSaneBoxCount(void);
static void sub_8111688(void);
static void sub_811175C(u8, struct UnkStruct_203AE98 *);
static void sub_81118F4(s8);
-static void sub_8111914(void);
-static void sub_8111984(void);
-static void sub_8111A34(u8);
+static void QuestLog_AdvancePlayhead(void);
+static void QuestLog_EndPlayback(void);
+static void Task_RunPlaybackCB(u8);
static void sub_8111AD8(void);
static void sub_8111B80(void);
static u8 sub_8111BD4(void);
static void sub_8111D10(void);
static void sub_8111D90(u8);
static void sub_8111E20(void);
-static void sub_8111E64(s8);
-static void sub_8111E84(void);
+static void QuestLog_SkipToEndOfPlayback(s8);
+static void QuestLog_WaitFadeAndCancelPlayback(void);
static bool8 sub_8111F60(void);
static void sub_8111F8C(u8);
static void sub_8111FCC(u8);
@@ -177,7 +178,7 @@ static bool8 sub_8113954(u16, u16 *);
static void sub_8113A1C(u16);
static void sub_811381C(void);
static bool8 sub_8113A44(u16, u16 *);
-static u16 *sub_8113A78(u16 *, u16 **);
+static u16 *QuestLog_SkipCommand(u16 *, u16 **);
static void sub_8113ABC(u16 *);
static bool8 sub_8113AE8(u16 *);
static bool8 sub_8113B44(u16 *);
@@ -437,9 +438,9 @@ void sub_811089C(void)
memset(gSaveBlock1Ptr->questLog, 0, sizeof(gSaveBlock1Ptr->questLog));
gUnknown_203ADF8 = 0;
gUnknown_203ADFA = 0;
- gUnknown_203AE8C = 0;
+ sQuestLogCB = NULL;
gUnknown_203AE08 = NULL;
- gUnknown_203AE04 = 0;
+ gUnknown_203AE04 = NULL;
sub_8113BD8();
sub_81138F8();
}
@@ -455,10 +456,10 @@ void sub_8110920(void)
gUnknown_203AE04 = NULL;
}
-void sub_811092C(void)
+void RunQuestLogCB(void)
{
- if (gUnknown_203AE8C)
- gUnknown_203AE8C();
+ if (sQuestLogCB != NULL)
+ sQuestLogCB();
}
bool8 sub_8110944(const void * a0, size_t a1)
@@ -485,9 +486,9 @@ void sub_81109CC(u8 a0)
{
gUnknown_203ADFA = a0;
if (a0 == 1)
- gUnknown_203AE8C = sub_8110A00;
+ sQuestLogCB = sub_8110A00;
else
- gUnknown_203AE8C = sub_8110A3C;
+ sQuestLogCB = sub_8110A3C;
}
static void sub_8110A00(void)
@@ -497,7 +498,7 @@ static void sub_8110A00(void)
gUnknown_3005E88 = 0;
sub_8110E3C();
gUnknown_203ADFA = 0;
- gUnknown_203AE8C = NULL;
+ sQuestLogCB = NULL;
}
}
@@ -813,13 +814,13 @@ static bool8 sub_8110E68(struct UnkStruct_203AE98 * a0)
return FALSE;
switch (a0[i].unk_6)
{
- case 0:
- case 1:
- gUnknown_203AE08 = sub_8113D48(gUnknown_203AE08, &a0[i]);
- break;
- default:
- gUnknown_203AE08 = sub_8113CC8(gUnknown_203AE08, &a0[i]);
- break;
+ case 0:
+ case 1:
+ gUnknown_203AE08 = sub_8113D48(gUnknown_203AE08, &a0[i]);
+ break;
+ default:
+ gUnknown_203AE08 = sub_8113CC8(gUnknown_203AE08, &a0[i]);
+ break;
}
if (gUnknown_203AE08 == NULL)
{
@@ -1176,29 +1177,29 @@ static void sub_811175C(u8 a0, struct UnkStruct_203AE98 * a1)
{
switch (r4[0] & 0xFFF)
{
- case 0:
- r4 = sub_8113D08(r4, &a1[r6]);
- r6++;
- break;
- case 1:
- case 2:
- r4 = sub_8113D94(r4, &a1[r6]);
- r6++;
- break;
- case 39:
- r4 = sub_8113C20(r4, &a1[r6]);
- r6++;
- break;
- case 41:
- r4 = sub_8113C8C(r4, &a1[r6]);
- r6++;
- break;
- default:
- r4 = sub_8113A78(r4, &gUnknown_203AE0C[r9]);
- if (r9 == 0)
- sub_8113ABC(gUnknown_203AE0C[0]);
- r9++;
- break;
+ case 0:
+ r4 = sub_8113D08(r4, &a1[r6]);
+ r6++;
+ break;
+ case 1:
+ case 2:
+ r4 = sub_8113D94(r4, &a1[r6]);
+ r6++;
+ break;
+ case 39:
+ r4 = sub_8113C20(r4, &a1[r6]);
+ r6++;
+ break;
+ case 41:
+ r4 = sub_8113C8C(r4, &a1[r6]);
+ r6++;
+ break;
+ default:
+ r4 = QuestLog_SkipCommand(r4, &gUnknown_203AE0C[r9]);
+ if (r9 == 0)
+ sub_8113ABC(gUnknown_203AE0C[0]);
+ r9++;
+ break;
}
if (r4 == NULL)
break;
@@ -1208,10 +1209,10 @@ static void sub_811175C(u8 a0, struct UnkStruct_203AE98 * a1)
static void sub_81118F4(s8 a0)
{
fade_screen(1, a0);
- gUnknown_203AE8C = sub_8111914;
+ sQuestLogCB = QuestLog_AdvancePlayhead;
}
-static void sub_8111914(void)
+static void QuestLog_AdvancePlayhead(void)
{
if (!gPaletteFade.active)
{
@@ -1224,12 +1225,12 @@ static void sub_8111914(void)
else
{
gUnknown_3005E88 = 0;
- sub_8111984();
+ QuestLog_EndPlayback();
}
}
}
-static void sub_8111984(void)
+static void QuestLog_EndPlayback(void)
{
ResetSpecialVars();
Save_ResetSaveCounters();
@@ -1238,15 +1239,15 @@ static void sub_8111984(void)
gFieldCallback2 = sub_8111F60;
FreeAllWindowBuffers();
gUnknown_203ADFA = 3;
- gUnknown_203AE8C = NULL;
+ sQuestLogCB = NULL;
}
void sub_81119C8(void)
{
- sub_8111914();
+ QuestLog_AdvancePlayhead();
}
-bool8 sub_81119D4(void (*a0)(void))
+bool8 QuestLog_SchedulePlaybackCB(void (*callback)(void))
{
u8 taskId;
@@ -1257,41 +1258,41 @@ bool8 sub_81119D4(void (*a0)(void))
break;
case 2:
gUnknown_3005E88 = 3;
- taskId = CreateTask(sub_8111A34, 80);
+ taskId = CreateTask(Task_RunPlaybackCB, 80);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
- SetWordTaskArg(taskId, 14, (u32)a0);
+ SetWordTaskArg(taskId, 14, (uintptr_t)callback);
return TRUE;
}
return FALSE;
}
-static void sub_8111A34(u8 taskId)
+static void Task_RunPlaybackCB(u8 taskId)
{
void (*routine)(void);
s16 *data = gTasks[taskId].data;
switch (data[1])
{
- case 0:
- if (++data[0] == 0x7F)
- {
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
- gUnknown_203AE94.unk_0_6 = 2;
- data[1]++;
- }
- break;
- case 1:
- if (!gPaletteFade.active)
- {
- gUnknown_3005E88 = 0;
- routine = (void (*)(void)) GetWordTaskArg(taskId, 14);
- if (routine != NULL)
- routine();
- DestroyTask(taskId);
- gUnknown_203AE8C = sub_8111914;
- }
- break;
+ case 0:
+ if (++data[0] == 0x7F)
+ {
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
+ gUnknown_203AE94.unk_0_6 = 2;
+ data[1]++;
+ }
+ break;
+ case 1:
+ if (!gPaletteFade.active)
+ {
+ gUnknown_3005E88 = 0;
+ routine = (void (*)(void)) GetWordTaskArg(taskId, 14);
+ if (routine != NULL)
+ routine();
+ DestroyTask(taskId);
+ sQuestLogCB = QuestLog_AdvancePlayhead;
+ }
+ break;
}
}
@@ -1384,7 +1385,7 @@ void sub_8111C68(void)
{
gUnknown_203AE94.unk_0_6 = 1;
gUnknown_3005E88 = 0;
- sub_8111E64(-3);
+ QuestLog_SkipToEndOfPlayback(-3);
}
}
}
@@ -1431,15 +1432,15 @@ static void sub_8111D90(u8 a0)
{
switch (i)
{
- default:
- y = 1;
- break;
- case 0:
- y = 0;
- break;
- case 5:
- y = 2;
- break;
+ default:
+ y = 1;
+ break;
+ case 0:
+ y = 0;
+ break;
+ case 5:
+ y = 2;
+ break;
}
// r6 = y * 32
@@ -1465,13 +1466,13 @@ static void sub_8111E20(void)
CopyWindowToVram(gUnknown_203ADFE[1], 1);
}
-static void sub_8111E64(s8 a0)
+static void QuestLog_SkipToEndOfPlayback(s8 a0)
{
fade_screen(1, a0);
- gUnknown_203AE8C = sub_8111E84;
+ sQuestLogCB = QuestLog_WaitFadeAndCancelPlayback;
}
-static void sub_8111E84(void)
+static void QuestLog_WaitFadeAndCancelPlayback(void)
{
if (!gPaletteFade.active)
{
@@ -1483,7 +1484,7 @@ static void sub_8111E84(void)
sub_811175C(gUnknown_203ADF8, gUnknown_203AE98);
}
gUnknown_3005E88 = 0;
- sub_8111984();
+ QuestLog_EndPlayback();
}
}
@@ -1563,46 +1564,46 @@ static void sub_81120AC(u8 taskId)
switch (data[0])
{
- case 0:
- gDisableMapMusicChangeOnMapLoad = 0;
- Overworld_PlaySpecialMapMusic();
- sub_811229C();
- FillWindowPixelRect(gUnknown_203ADFE[0], 0xF, 0, 0, gUnknown_845661C[0].width * 8, gUnknown_845661C[0].height * 8);
- data[0]++;
- break;
- case 1:
- if (sub_81121D8(taskId))
+ case 0:
+ gDisableMapMusicChangeOnMapLoad = 0;
+ Overworld_PlaySpecialMapMusic();
+ sub_811229C();
+ FillWindowPixelRect(gUnknown_203ADFE[0], 0xF, 0, 0, gUnknown_845661C[0].width * 8, gUnknown_845661C[0].height * 8);
+ data[0]++;
+ break;
+ case 1:
+ if (sub_81121D8(taskId))
+ {
+ for (i = 0; i < 3; i++)
{
- for (i = 0; i < 3; i++)
- {
- ClearWindowTilemap(gUnknown_203ADFE[i]);
- CopyWindowToVram(gUnknown_203ADFE[i], 1);
- RemoveWindow(gUnknown_203ADFE[i]);
- }
- data[1] = 0;
- data[0]++;
+ ClearWindowTilemap(gUnknown_203ADFE[i]);
+ CopyWindowToVram(gUnknown_203ADFE[i], 1);
+ RemoveWindow(gUnknown_203ADFE[i]);
}
- break;
- case 2:
- if (data[1] < 32)
- data[1]++;
- else
- data[0]++;
- break;
- default:
- if (gUnknown_203AE94.unk_0_6 == 1)
- sub_8098110(1);
- CpuCopy16(gUnknown_203AE90, gPlttBufferUnfaded, 0x400);
- Free(gUnknown_203AE90);
- gUnknown_203AE94 = (struct UnkStruct_203AE94){};
- sub_80696C0();
- ScriptContext2_Disable();
- gTextFlags.autoScroll = FALSE;
- gUnknown_2036E28 = 0;
- sub_8082740(0);
- gHelpSystemEnabled = TRUE;
- DestroyTask(taskId);
- break;
+ data[1] = 0;
+ data[0]++;
+ }
+ break;
+ case 2:
+ if (data[1] < 32)
+ data[1]++;
+ else
+ data[0]++;
+ break;
+ default:
+ if (gUnknown_203AE94.unk_0_6 == 1)
+ sub_8098110(1);
+ CpuCopy16(gUnknown_203AE90, gPlttBufferUnfaded, 0x400);
+ Free(gUnknown_203AE90);
+ gUnknown_203AE94 = (struct UnkStruct_203AE94){};
+ sub_80696C0();
+ ScriptContext2_Disable();
+ gTextFlags.autoScroll = FALSE;
+ gUnknown_2036E28 = 0;
+ sub_8082740(0);
+ gHelpSystemEnabled = TRUE;
+ DestroyTask(taskId);
+ break;
}
}
@@ -1643,7 +1644,7 @@ void sub_811231C(void)
sub_8110E68(gUnknown_203AE98);
sub_8110E3C();
gUnknown_203ADFA = 0;
- gUnknown_203AE8C = NULL;
+ sQuestLogCB = NULL;
gUnknown_203AE04 = NULL;
gUnknown_203AE08 = NULL;
gUnknown_3005E88 = 0;
@@ -1659,7 +1660,7 @@ void sub_8112364(void)
sub_8110E3C();
gUnknown_3005E88 = 0;
gUnknown_203ADFA = 0;
- gUnknown_203AE8C = NULL;
+ sQuestLogCB = NULL;
}
gUnknown_203AE04 = NULL;
gUnknown_203AE08 = NULL;
@@ -1834,14 +1835,14 @@ static void sub_8112888(u8 a0)
{
switch (a0)
{
- case 1:
- if (gUnknown_3005E88 == 1)
- gUnknown_3005E88 = 3;
- break;
- case 2:
- if (gUnknown_3005E88 == 3)
- gUnknown_3005E88 = 1;
- break;
+ case 1:
+ if (gUnknown_3005E88 == 1)
+ gUnknown_3005E88 = 3;
+ break;
+ case 2:
+ if (gUnknown_3005E88 == 3)
+ gUnknown_3005E88 = 1;
+ break;
}
}
@@ -1851,24 +1852,24 @@ void sub_81128BC(u8 a0)
switch (a0)
{
- case 1:
- if (r1 == 1)
- gUnknown_3005E88 = 3;
- else if (r1 == 2)
- {
- gUnknown_3005E94[sQuestLogIdx].unk_4 = gUnknown_203B01A;
- gUnknown_3005E94[sQuestLogIdx].unk_6 = 3;
- sQuestLogIdx++;
- gUnknown_203B01A = 0;
- gUnknown_3005E88 = 4;
- }
- break;
- case 2:
- if (r1 == 1)
- gUnknown_3005E88 = 1;
- else if (r1 == 2)
- gUnknown_3005E88 = 2;
- break;
+ case 1:
+ if (r1 == 1)
+ gUnknown_3005E88 = 3;
+ else if (r1 == 2)
+ {
+ gUnknown_3005E94[sQuestLogIdx].unk_4 = gUnknown_203B01A;
+ gUnknown_3005E94[sQuestLogIdx].unk_6 = 3;
+ sQuestLogIdx++;
+ gUnknown_203B01A = 0;
+ gUnknown_3005E88 = 4;
+ }
+ break;
+ case 2:
+ if (r1 == 1)
+ gUnknown_3005E88 = 1;
+ else if (r1 == 2)
+ gUnknown_3005E88 = 2;
+ break;
}
}
@@ -1878,64 +1879,64 @@ static void sub_8112940(u8 a0, struct UnkStruct_203AE98 *a1, u16 a2)
switch (a0)
{
- default:
- gUnknown_3005E88 = 0;
- break;
+ default:
+ gUnknown_3005E88 = 0;
+ break;
+ case 1:
+ gUnknown_3005E94 = a1;
+ sNumQuestLogs = a2 / 8;
+ for (i = 0; i < 0x40; i++)
+ {
+ gUnknown_203AF9A[i][0] |= 0xFF;
+ gUnknown_203AF9A[i][1] |= 0xFF;
+ }
+ sQuestLogIdx = 0;
+ gUnknown_203B01C = 0;
+ gUnknown_3005E90 = (struct UnkStruct_3005E90){};
+ gUnknown_203B01A = gUnknown_3005E94[sQuestLogIdx].unk_4;
+ gUnknown_203AF9A[0][0] = gUnknown_3005E94[sQuestLogIdx].unk_3;
+ gUnknown_203AF9A[0][1] = 0xFF;
+ gUnknown_3005E88 = 1;
+ break;
+ case 2:
+ gUnknown_3005E94 = a1;
+ sNumQuestLogs = a2 / 8;
+ for (i = 0; i < sNumQuestLogs; i++)
+ {
+ gUnknown_3005E94[i] = (struct UnkStruct_203AE98){ 0, 0, 0, 0, 0xFFFF, 0xFF };
+ }
+ sQuestLogIdx = 0;
+ gUnknown_203B01A = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_4 = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_6 = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_0 = 0;
+ switch (GetPlayerFacingDirection())
+ {
+ case 0:
case 1:
- gUnknown_3005E94 = a1;
- sNumQuestLogs = a2 / 8;
- for (i = 0; i < 0x40; i++)
- {
- gUnknown_203AF9A[i][0] |= 0xFF;
- gUnknown_203AF9A[i][1] |= 0xFF;
- }
- sQuestLogIdx = 0;
- gUnknown_203B01C = 0;
- gUnknown_3005E90 = (struct UnkStruct_3005E90){};
- gUnknown_203B01A = gUnknown_3005E94[sQuestLogIdx].unk_4;
- gUnknown_203AF9A[0][0] = gUnknown_3005E94[sQuestLogIdx].unk_3;
- gUnknown_203AF9A[0][1] = 0xFF;
- gUnknown_3005E88 = 1;
+ gUnknown_3005E94[sQuestLogIdx].unk_3 = 0;
+ break;
+ case 4:
+ gUnknown_3005E94[sQuestLogIdx].unk_3 = 3;
break;
case 2:
- gUnknown_3005E94 = a1;
- sNumQuestLogs = a2 / 8;
- for (i = 0; i < sNumQuestLogs; i++)
- {
- gUnknown_3005E94[i] = (struct UnkStruct_203AE98){ 0, 0, 0, 0, 0xFFFF, 0xFF };
- }
- sQuestLogIdx = 0;
- gUnknown_203B01A = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_4 = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_6 = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_0 = 0;
- switch (GetPlayerFacingDirection())
- {
- case 0:
- case 1:
- gUnknown_3005E94[sQuestLogIdx].unk_3 = 0;
- break;
- case 4:
- gUnknown_3005E94[sQuestLogIdx].unk_3 = 3;
- break;
- case 2:
- gUnknown_3005E94[sQuestLogIdx].unk_3 = 1;
- break;
- case 3:
- gUnknown_3005E94[sQuestLogIdx].unk_3 = 2;
- break;
- }
- gUnknown_203B01C = 0;
- sQuestLogIdx++;
- gUnknown_3005E94[sQuestLogIdx].unk_4 = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_6 = 2;
- gUnknown_3005E94[sQuestLogIdx].unk_0 = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_1 = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_2 = 0;
- gUnknown_3005E94[sQuestLogIdx].unk_3 = 0;
- sQuestLogIdx++;
- gUnknown_3005E88 = 2;
+ gUnknown_3005E94[sQuestLogIdx].unk_3 = 1;
+ break;
+ case 3:
+ gUnknown_3005E94[sQuestLogIdx].unk_3 = 2;
break;
+ }
+ gUnknown_203B01C = 0;
+ sQuestLogIdx++;
+ gUnknown_3005E94[sQuestLogIdx].unk_4 = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_6 = 2;
+ gUnknown_3005E94[sQuestLogIdx].unk_0 = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_1 = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_2 = 0;
+ gUnknown_3005E94[sQuestLogIdx].unk_3 = 0;
+ sQuestLogIdx++;
+ gUnknown_3005E88 = 2;
+ break;
}
}
@@ -1944,67 +1945,67 @@ void sub_8112B3C(void)
{
switch (gUnknown_3005E88)
{
- case 0:
- break;
- case 1:
- if (sub_8112CEC())
+ case 0:
+ break;
+ case 1:
+ if (sub_8112CEC())
+ {
+ if (gUnknown_203B01A != 0)
+ gUnknown_203B01A--;
+ else
{
- if (gUnknown_203B01A != 0)
- gUnknown_203B01A--;
- else
+ while (1)
{
- while (1)
+ switch (gUnknown_3005E94[sQuestLogIdx].unk_6)
{
- switch (gUnknown_3005E94[sQuestLogIdx].unk_6)
- {
- case 0:
- gUnknown_203AF9A[gUnknown_3005E94[sQuestLogIdx].unk_0][0] = gUnknown_3005E94[sQuestLogIdx].unk_3;
- break;
- case 1:
- gUnknown_203AF9A[gUnknown_3005E94[sQuestLogIdx].unk_0][1] = gUnknown_3005E94[sQuestLogIdx].unk_3;
- break;
- case 2:
- *(u32 *)&gUnknown_3005E90 = ((gUnknown_3005E94[sQuestLogIdx].unk_3 << 24) | (gUnknown_3005E94[sQuestLogIdx].unk_2 << 16) | (gUnknown_3005E94[sQuestLogIdx].unk_1 << 8) | (gUnknown_3005E94[sQuestLogIdx].unk_0 << 0));
- break;
- case 3:
- gUnknown_3005E88 = 3;
- break;
- case 0xFE:
- break;
- case 0xFF:
- gUnknown_3005E88 = 0;
- break;
- }
- if (gUnknown_3005E88 == 0)
- break;
- if (++sQuestLogIdx >= sNumQuestLogs)
- {
- gUnknown_3005E88 = 0;
- break;
- }
- gUnknown_203B01A = gUnknown_3005E94[sQuestLogIdx].unk_4;
- if (gUnknown_3005E88 == 3)
- break;
- if (gUnknown_203B01A == 0)
- continue;
- if (gUnknown_203B01A == 0xFFFF)
- break;
- }
+ case 0:
+ gUnknown_203AF9A[gUnknown_3005E94[sQuestLogIdx].unk_0][0] = gUnknown_3005E94[sQuestLogIdx].unk_3;
+ break;
+ case 1:
+ gUnknown_203AF9A[gUnknown_3005E94[sQuestLogIdx].unk_0][1] = gUnknown_3005E94[sQuestLogIdx].unk_3;
+ break;
+ case 2:
+ *(u32 *)&gUnknown_3005E90 = ((gUnknown_3005E94[sQuestLogIdx].unk_3 << 24) | (gUnknown_3005E94[sQuestLogIdx].unk_2 << 16) | (gUnknown_3005E94[sQuestLogIdx].unk_1 << 8) | (gUnknown_3005E94[sQuestLogIdx].unk_0 << 0));
+ break;
+ case 3:
+ gUnknown_3005E88 = 3;
+ break;
+ case 0xFE:
+ break;
+ case 0xFF:
+ gUnknown_3005E88 = 0;
+ break;
+ }
+ if (gUnknown_3005E88 == 0)
+ break;
+ if (++sQuestLogIdx >= sNumQuestLogs)
+ {
+ gUnknown_3005E88 = 0;
+ break;
+ }
+ gUnknown_203B01A = gUnknown_3005E94[sQuestLogIdx].unk_4;
+ if (gUnknown_3005E88 == 3)
+ break;
+ if (gUnknown_203B01A == 0)
+ continue;
+ if (gUnknown_203B01A == 0xFFFF)
+ break;
}
}
- else if (sQuestLogIdx >= sNumQuestLogs)
- gUnknown_3005E88 = 0;
- break;
- case 2:
- if (ScriptContext2_IsEnabled() != 1)
- gUnknown_203B01A++;
- if (sQuestLogIdx >= sNumQuestLogs)
- gUnknown_3005E88 = 0;
- break;
- case 3:
- break;
- case 4:
- break;
+ }
+ else if (sQuestLogIdx >= sNumQuestLogs)
+ gUnknown_3005E88 = 0;
+ break;
+ case 2:
+ if (ScriptContext2_IsEnabled() != 1)
+ gUnknown_203B01A++;
+ if (sQuestLogIdx >= sNumQuestLogs)
+ gUnknown_3005E88 = 0;
+ break;
+ case 3:
+ break;
+ case 4:
+ break;
}
}
#else
@@ -2203,15 +2204,15 @@ u8 sub_8112CAC(void)
{
switch (gUnknown_3005E88)
{
- case 0:
- default:
- return 0;
- case 1:
- case 3:
- return 1;
- case 2:
- case 4:
- return 2;
+ case 0:
+ default:
+ return 0;
+ case 1:
+ case 3:
+ return 1;
+ case 2:
+ case 4:
+ return 2;
}
}
@@ -2669,27 +2670,27 @@ void BufferStreakTrainerText(void)
switch (gSpecialVar_0x8004)
{
- case 0:
- r2 = 0;
- r3 = 0;
- break;
- case 1:
- case 2:
- case 3:
- case 7:
- break;
- case 4:
- r2 = 1;
- r3 = 0;
- break;
- case 5:
- r2 = 0;
- r3 = 1;
- break;
- case 6:
- r2 = 2;
- r3 = 1;
- break;
+ case 0:
+ r2 = 0;
+ r3 = 0;
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 7:
+ break;
+ case 4:
+ r2 = 1;
+ r3 = 0;
+ break;
+ case 5:
+ r2 = 0;
+ r3 = 1;
+ break;
+ case 6:
+ r2 = 2;
+ r3 = 1;
+ break;
}
sub_8113414(&gSaveBlock2Ptr->linkBattleRecords, r3, r2);
}
@@ -2702,18 +2703,18 @@ static void sub_8113414(struct LinkBattleRecords * a0, u8 a1, u8 a2)
{
switch (a2)
{
- case 0:
- StringCopy(gStringVar1, gSaveBlock1Ptr->rivalName);
- break;
- case 1:
- StringCopy(gStringVar1, gUnknown_84178D0); // LT. SURGE
- break;
- case 2:
- StringCopy(gStringVar1, gUnknown_84178DA); // KOGA
- break;
- default:
- StringCopy(gStringVar1, gSaveBlock1Ptr->rivalName);
- break;
+ case 0:
+ StringCopy(gStringVar1, gSaveBlock1Ptr->rivalName);
+ break;
+ case 1:
+ StringCopy(gStringVar1, gUnknown_84178D0); // LT. SURGE
+ break;
+ case 2:
+ StringCopy(gStringVar1, gUnknown_84178DA); // KOGA
+ break;
+ default:
+ StringCopy(gStringVar1, gSaveBlock1Ptr->rivalName);
+ break;
}
}
else
@@ -3313,7 +3314,7 @@ static const u16 *(*const sQuestLogScriptParsingCBs[])(const u16 *) = {
sub_8115800
};
-static const u8 gUnknown_8456AA0[] = {
+static const u8 sQuestLogEventCmdSizes[] = {
0x08,
0x08,
0x08,
@@ -3359,16 +3360,16 @@ static const u8 gUnknown_8456AA0[] = {
0x06
};
-static u16 *sub_8113A78(u16 *a0, u16 **a1)
+static u16 *QuestLog_SkipCommand(u16 *curPtr, u16 **prevPtr_p)
{
- u16 r2 = a0[0] & 0xfff;
- u16 r4 = a0[0] >> 12;
- if (r2 == 33)
- r4 = 0;
- if (r2 < 3 || r2 > 42)
+ u16 idx = curPtr[0] & 0xfff;
+ u16 cnt = curPtr[0] >> 12;
+ if (idx == 33)
+ cnt = 0;
+ if (idx < 3 || idx > 42)
return NULL;
- *a1 = a0;
- return gUnknown_8456AA0[r2] + (gUnknown_8456AA0[r2] - 4) * r4 + (void *)a0;
+ *prevPtr_p = curPtr;
+ return sQuestLogEventCmdSizes[idx] + (sQuestLogEventCmdSizes[idx] - 4) * cnt + (void *)curPtr;
}
static void sub_8113ABC(u16 *a0)
@@ -3484,7 +3485,7 @@ static void sub_8113BD8(void)
static u16 *sub_8113BF4(u16 *a0)
{
- if (!sub_8110988(a0, gUnknown_8456AA0[39]))
+ if (!sub_8110988(a0, sQuestLogEventCmdSizes[39]))
return NULL;
a0[0] = 39;
return a0 + 1;
@@ -3492,7 +3493,7 @@ static u16 *sub_8113BF4(u16 *a0)
static u16 *sub_8113C20(u16 *a0, struct UnkStruct_203AE98 * a1)
{
- if (!sub_8110988(a0, gUnknown_8456AA0[39]))
+ if (!sub_8110988(a0, sQuestLogEventCmdSizes[39]))
return NULL;
a1->unk_6 = 0xFF;
a1->unk_4 = 0;
@@ -3505,7 +3506,7 @@ static u16 *sub_8113C20(u16 *a0, struct UnkStruct_203AE98 * a1)
static u16 *sub_8113C5C(u16 *a0, u16 a1)
{
- if (!sub_8110988(a0, gUnknown_8456AA0[41]))
+ if (!sub_8110988(a0, sQuestLogEventCmdSizes[41]))
return NULL;
a0[0] = 41;
a0[1] = a1;
@@ -3514,7 +3515,7 @@ static u16 *sub_8113C5C(u16 *a0, u16 a1)
static u16 *sub_8113C8C(u16 *a0, struct UnkStruct_203AE98 * a1)
{
- if (!sub_8110988(a0, gUnknown_8456AA0[41]))
+ if (!sub_8110988(a0, sQuestLogEventCmdSizes[41]))
return NULL;
a1->unk_6 = 0xFE;
a1->unk_4 = a0[1];
@@ -3529,7 +3530,7 @@ static u16 *sub_8113CC8(u16 *a0, struct UnkStruct_203AE98 * a1)
{
u8 *r6 = (u8 *)a0 + 4;
- if (!sub_8110988(a0, gUnknown_8456AA0[0]))
+ if (!sub_8110988(a0, sQuestLogEventCmdSizes[0]))
return NULL;
a0[0] = 0;
a0[1] = a1->unk_4;
@@ -3544,7 +3545,7 @@ static u16 *sub_8113D08(u16 *a0, struct UnkStruct_203AE98 * a1)
{
u8 *r6 = (u8 *)a0 + 4;
- if (!sub_8110988(a0, gUnknown_8456AA0[0]))
+ if (!sub_8110988(a0, sQuestLogEventCmdSizes[0]))
return NULL;
a1->unk_6 = 2;
a1->unk_4 = a0[1];
@@ -3560,7 +3561,7 @@ static u16 *sub_8113D48(u16 *a0, struct UnkStruct_203AE98 * a1)
u16 *r4 = a0;
u8 *r6 = (u8 *)a0 + 4;
- if (!sub_8110988(r4, gUnknown_8456AA0[2]))
+ if (!sub_8110988(r4, sQuestLogEventCmdSizes[2]))
return NULL;
if (a1->unk_6 == 0)
r4[0] = 2;
@@ -3579,7 +3580,7 @@ static u16 *sub_8113D94(u16 *a0, struct UnkStruct_203AE98 * a1)
u16 *r5 = a0;
u8 *r6 = (u8 *)a0 + 4;
- if (!sub_8110988(r5, gUnknown_8456AA0[2]))
+ if (!sub_8110988(r5, sQuestLogEventCmdSizes[2]))
return NULL;
if (r5[0] == 2)
a1->unk_6 = 0;
@@ -3601,9 +3602,9 @@ u16 *sub_8113DE0(u16 a0, u16 *a1)
u8 r1;
if (gUnknown_203B044.unk_1 == 0)
- r6 = gUnknown_8456AA0[a0];
+ r6 = sQuestLogEventCmdSizes[a0];
else
- r6 = gUnknown_8456AA0[a0] - 4;
+ r6 = sQuestLogEventCmdSizes[a0] - 4;
if (!sub_8110944(a1, r6))
return NULL;
@@ -3635,13 +3636,10 @@ u16 *sub_8113DE0(u16 a0, u16 *a1)
static const u16 *sub_8113E88(u16 a0, const u16 *a1)
{
- a1 = (const void *)a1 + (gUnknown_203B044.unk_2 * (gUnknown_8456AA0[a0] - 4) + 4);
+ a1 = (const void *)a1 + (gUnknown_203B044.unk_2 * (sQuestLogEventCmdSizes[a0] - 4) + 4);
return a1;
}
-// TODO: delete this declaration once data_83FECCC.s is decompiled
-extern const u8 gText_EggNickname[];
-
void QuestLog_AutoGetSpeciesName(u16 a0, u8 *a1, u8 a2)
{
if (a1 != NULL)
@@ -3703,48 +3701,48 @@ static const u16 *sub_8113FBC(const u16 *a0)
switch (ItemId_GetPocket(r5[0]))
{
- case POCKET_ITEMS:
- case POCKET_POKE_BALLS:
- case POCKET_BERRY_POUCH:
- StringCopy(gStringVar1, ItemId_GetName(r5[0]));
- if (r5[0] == ITEM_ESCAPE_ROPE)
- {
- sub_80C4DF8(gStringVar2, r5[2]);
- StringExpandPlaceholders(gStringVar4, gUnknown_841AFA6);
- }
- else if (r5[1] != 0xFFFF)
- {
- QuestLog_AutoGetSpeciesName(r5[1], gStringVar2, 0);
- StringExpandPlaceholders(gStringVar4, gUnknown_841A1E7);
- }
+ case POCKET_ITEMS:
+ case POCKET_POKE_BALLS:
+ case POCKET_BERRY_POUCH:
+ StringCopy(gStringVar1, ItemId_GetName(r5[0]));
+ if (r5[0] == ITEM_ESCAPE_ROPE)
+ {
+ sub_80C4DF8(gStringVar2, r5[2]);
+ StringExpandPlaceholders(gStringVar4, gUnknown_841AFA6);
+ }
+ else if (r5[1] != 0xFFFF)
+ {
+ QuestLog_AutoGetSpeciesName(r5[1], gStringVar2, 0);
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A1E7);
+ }
+ else
+ {
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A210);
+ }
+ break;
+ case POCKET_KEY_ITEMS:
+ StringCopy(gStringVar1, ItemId_GetName(r5[0]));
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A220);
+ break;
+ case POCKET_TM_CASE:
+ QuestLog_AutoGetSpeciesName(r5[1], gStringVar1, 0);
+ StringCopy(gStringVar2, gMoveNames[ItemIdToBattleMoveId(r5[0])]);
+ if (r5[2] != 0xFFFF)
+ {
+ StringCopy(gStringVar3, gMoveNames[r5[2]]);
+ if (r5[0] > ITEM_TM50)
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A965);
else
- {
- StringExpandPlaceholders(gStringVar4, gUnknown_841A210);
- }
- break;
- case POCKET_KEY_ITEMS:
- StringCopy(gStringVar1, ItemId_GetName(r5[0]));
- StringExpandPlaceholders(gStringVar4, gUnknown_841A220);
- break;
- case POCKET_TM_CASE:
- QuestLog_AutoGetSpeciesName(r5[1], gStringVar1, 0);
- StringCopy(gStringVar2, gMoveNames[ItemIdToBattleMoveId(r5[0])]);
- if (r5[2] != 0xFFFF)
- {
- StringCopy(gStringVar3, gMoveNames[r5[2]]);
- if (r5[0] > ITEM_TM50)
- StringExpandPlaceholders(gStringVar4, gUnknown_841A965);
- else
- StringExpandPlaceholders(gStringVar4, gUnknown_841A277);
- }
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A277);
+ }
+ else
+ {
+ if (r5[0] > ITEM_TM50)
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A938);
else
- {
- if (r5[0] > ITEM_TM50)
- StringExpandPlaceholders(gStringVar4, gUnknown_841A938);
- else
- StringExpandPlaceholders(gStringVar4, gUnknown_841A255);
- }
- break;
+ StringExpandPlaceholders(gStringVar4, gUnknown_841A255);
+ }
+ break;
}
return r5 + 3;
}
@@ -3873,7 +3871,7 @@ static u16 *sub_81143F0(u16 *a0, const u16 *a1)
if (gUnknown_203B044.unk_0 == 11 && gUnknown_203B044.unk_1 != 0)
return r4;
- if (!sub_8110944(a0, gUnknown_8456AA0[11]))
+ if (!sub_8110944(a0, sQuestLogEventCmdSizes[11]))
return NULL;
r4[0] = 11;
@@ -4371,7 +4369,7 @@ static u16 *sub_8114DE8(u16 *a0, const u16 *a1)
{
u16 *r4 = a0;
u8 *r5 = (u8 *)a0 + 8;
- if (!sub_8110944(r4, gUnknown_8456AA0[31]))
+ if (!sub_8110944(r4, sQuestLogEventCmdSizes[31]))
return NULL;
if (r5[0] == 0 && r5[1] == 0)
{
@@ -4393,7 +4391,7 @@ static u16 *sub_8114DE8(u16 *a0, const u16 *a1)
static const u16 *sub_8114E68(const u16 *a0)
{
const u8 *r6;
- if (!sub_8110944(a0, gUnknown_8456AA0[31]))
+ if (!sub_8110944(a0, sQuestLogEventCmdSizes[31]))
return NULL;
r6 = (const u8 *)a0 + 8;
@@ -4442,11 +4440,11 @@ static bool8 sub_8114FBC(u16 a0)
{
switch (a0)
{
- case 0x96:
- case 0x8F ... 0x92:
- case 0xF9 ... 0xFA:
- case 0x19A:
- return TRUE;
+ case 0x96:
+ case 0x8F ... 0x92:
+ case 0xF9 ... 0xFA:
+ case 0x19A:
+ return TRUE;
}
return FALSE;
}
@@ -4473,7 +4471,7 @@ static const u16 *sub_811500C(const u16 *a0)
static u16 *sub_8115078(u16 *a0, const u16 *a1)
{
- if (!sub_8110944(a0, gUnknown_8456AA0[33]))
+ if (!sub_8110944(a0, sQuestLogEventCmdSizes[33]))
return NULL;
a0[0] = 0x2021;
a0[1] = sQuestLogIdx;
@@ -4487,7 +4485,7 @@ static u16 *sub_8115078(u16 *a0, const u16 *a1)
static const u16 *sub_81150CC(const u16 *a0)
{
const u8 *r5;
- if (!sub_8110944(a0, gUnknown_8456AA0[33]))
+ if (!sub_8110944(a0, sQuestLogEventCmdSizes[33]))
return NULL;
r5 = (const u8 *)a0 + 8;
@@ -4495,22 +4493,22 @@ static const u16 *sub_81150CC(const u16 *a0)
switch (gUnknown_203B044.unk_2)
{
- case 0:
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock2Ptr->playerName);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gSaveBlock1Ptr->rivalName);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_841A2E1);
- break;
- case 1:
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock1Ptr->rivalName);
- QuestLog_AutoGetSpeciesName(a0[2], NULL, 1);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gSaveBlock2Ptr->playerName);
- QuestLog_AutoGetSpeciesName(a0[3], NULL, 3);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_841A312);
- break;
- case 2:
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_8456AD8[r5[0]]);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_841A349);
- break;
+ case 0:
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock2Ptr->playerName);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gSaveBlock1Ptr->rivalName);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_841A2E1);
+ break;
+ case 1:
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock1Ptr->rivalName);
+ QuestLog_AutoGetSpeciesName(a0[2], NULL, 1);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gSaveBlock2Ptr->playerName);
+ QuestLog_AutoGetSpeciesName(a0[3], NULL, 3);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_841A312);
+ break;
+ case 2:
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_8456AD8[r5[0]]);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_841A349);
+ break;
}
return (const u16 *)(r5 + 2);
}
diff --git a/src/scrcmd.c b/src/scrcmd.c
index b59f97420..9675a132e 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -50,15 +50,15 @@ extern const u8 *const gStdScriptsEnd[];
static bool8 sub_806B93C(struct ScriptContext * ctx);
static u8 sub_806B96C(struct ScriptContext * ctx);
-EWRAM_DATA ptrdiff_t gVScriptOffset = 0;
-EWRAM_DATA u8 gUnknown_20370AC = 0;
-EWRAM_DATA u16 sPauseCounter = 0;
-EWRAM_DATA u16 sMovingNpcId = 0;
-EWRAM_DATA u16 sMovingNpcMapBank = 0;
-EWRAM_DATA u16 sMovingNpcMapId = 0;
-EWRAM_DATA u16 sFieldEffectScriptId = 0;
+static EWRAM_DATA ptrdiff_t gVScriptOffset = 0;
+static EWRAM_DATA u8 gUnknown_20370AC = 0;
+static EWRAM_DATA u16 sPauseCounter = 0;
+static EWRAM_DATA u16 sMovingNpcId = 0;
+static EWRAM_DATA u16 sMovingNpcMapBank = 0;
+static EWRAM_DATA u16 sMovingNpcMapId = 0;
+static EWRAM_DATA u16 sFieldEffectScriptId = 0;
-IWRAM_DATA struct ScriptContext * gUnknown_3005070;
+struct ScriptContext * gUnknown_3005070;
extern u8 gSelectedEventObject;
@@ -1835,7 +1835,7 @@ bool8 ScrCmd_showmoneybox(struct ScriptContext *ctx)
u8 y = ScriptReadByte(ctx);
u8 ignore = ScriptReadByte(ctx);
- if (!ignore && sub_81119D4(sub_809D6D4) != TRUE)
+ if (!ignore && QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
DrawMoneyBox(GetMoney(&gSaveBlock1Ptr->money), x, y);
return FALSE;
}
@@ -1865,7 +1865,7 @@ bool8 ScrCmd_showcoinsbox(struct ScriptContext *ctx)
u8 x = ScriptReadByte(ctx);
u8 y = ScriptReadByte(ctx);
- if (sub_81119D4(sub_809D6D4) != TRUE)
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
ShowCoinsWindow(GetCoins(), x, y);
return FALSE;
}
diff --git a/src/script_menu.c b/src/script_menu.c
new file mode 100644
index 000000000..b3826322b
--- /dev/null
+++ b/src/script_menu.c
@@ -0,0 +1,1293 @@
+#include "global.h"
+#include "palette.h"
+#include "text.h"
+#include "menu.h"
+#include "task.h"
+#include "sound.h"
+#include "script_menu.h"
+#include "quest_log.h"
+#include "window.h"
+#include "new_menu_helpers.h"
+#include "event_data.h"
+#include "script.h"
+#include "strings.h"
+#include "string_util.h"
+#include "field_effect.h"
+#include "event_scripts.h"
+#include "constants/songs.h"
+#include "constants/species.h"
+#include "constants/seagallop.h"
+#include "constants/menu.h"
+
+struct MultichoiceListStruct
+{
+ const struct MenuAction * list;
+ u8 count;
+};
+
+static EWRAM_DATA u8 sDelay = 0;
+
+static void DrawVerticalMultichoiceMenu(u8 left, u8 top, u8 mcId, u8 ignoreBpress, u8 initPos);
+static u8 GetMCWindowHeight(u8 count);
+static void CreateMCMenuInputHandlerTask(u8 ignoreBpress, u8 count, u8 windowId, u8 mcId);
+static void Task_MultichoiceMenu_HandleInput(u8 taskId);
+static void MultiChoicePrintHelpDescription(u8 mcId);
+static void Task_YesNoMenu_HandleInput(u8 taskId);
+static void Hask_MultichoiceGridMenu_HandleInput(u8 taskId);
+static void CreatePCMenuWindow(void);
+static bool8 PicboxWait(void);
+static void DestroyScriptMenuWindow(u8 windowId);
+static u8 CreateWindowFromRect(u8 left, u8 top, u8 width, u8 height);
+
+
+static const struct MenuAction sScriptMultiChoiceMenu_YesNo[] = {
+ { gText_Yes },
+ { gText_No }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TrainerCardIconTint[] = {
+ { gText_Normal },
+ { gText_Black },
+ { gText_Pink },
+ { gText_Sepia }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_HOF_Quit[] = {
+ { gText_HallOfFame },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Eggs_Quit[] = {
+ { gText_Eggs },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Victories_Quit[] = {
+ { gText_Victories },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_HOF_Eggs_Quit[] = {
+ { gText_HallOfFame },
+ { gText_Eggs },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_HOF_Victories_Quit[] = {
+ { gText_HallOfFame },
+ { gText_Victories },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Eggs_Victories_Quit[] = {
+ { gText_Eggs },
+ { gText_Victories },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_HOF_Eggs_Victories_Quit[] = {
+ { gText_HallOfFame },
+ { gText_Eggs },
+ { gText_Victories },
+ { gText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TrainerSchoolWhiteboard[] = {
+ { gText_Slp },
+ { gText_Psn },
+ { gText_Par },
+ { gText_Brn },
+ { gText_Frz },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_YesNoInfo[] = {
+ { gText_Yes },
+ { gText_No },
+ { gText_Info }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SingleDoubleMultiInfoExit[] = {
+ { gText_SingleBattle },
+ { gText_DoubleBattle },
+ { gText_MultiBattle },
+ { gText_Info },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_YesNoInfo2[] = {
+ { gText_Yes },
+ { gText_No },
+ { gText_Info }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ChallengeInfoExit[] = {
+ { gText_MakeAChallenge },
+ { gText_Info_2 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_RooftopB1F[] = {
+ { gText_Rooftop },
+ { gText_B1F },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Helix[] = {
+ { gText_HelixFossil },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Dome[] = {
+ { gText_DomeFossil },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Amber[] = {
+ { gText_OldAmber },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_HelixAmber[] = {
+ { gText_HelixFossil },
+ { gText_OldAmber },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_DomeAmber[] = {
+ { gText_DomeFossil },
+ { gText_OldAmber },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_CeladonVendingMachine[] = {
+ { gText_FreshWater_200 },
+ { gText_SodaPop_300 },
+ { gText_Lemonade_350 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_GameCornerTMPrizes[] = {
+ { gText_Tm13_4000Coins },
+ { gText_Tm23_3500Coins },
+ { gText_Tm24_4000Coins },
+ { gText_Tm30_4500Coins },
+ { gText_Tm35_4000Coins },
+ { gText_NoThanks_2 }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_GameCornerBattleItemPrizes[] = {
+ { gText_SmokeBall_800Coins },
+ { gText_MiracleSeed_1000Coins },
+ { gText_Charcoal_1000Coins },
+ { gText_MysticWater_1000Coins },
+ { gText_YellowFlute_1600Coins },
+ { gText_NoThanks_2 }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_GameCornerCoinPurchaseCounter[] = {
+ { gText_50Coins_1000 },
+ { gText_500Coins_10000 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Excellent_NotSoBad[] = {
+ { gText_Excellent },
+ { gText_NotSoBad }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_RightLeft[] = {
+ { gText_Right },
+ { gText_Left }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_DeptStoreElevator[] = {
+ { gText_5F_2 },
+ { gText_4F_2 },
+ { gText_3F_2 },
+ { gText_2F_2 },
+ { gText_1F_2 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlFreshWater[] = {
+ { gText_FreshWater },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlSodaPop[] = {
+ { gText_SodaPop },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlFreshWaterSodaPop[] = {
+ { gText_FreshWater },
+ { gText_SodaPop },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlLemonade[] = {
+ { gText_Lemonade },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlFreshWaterLemonade[] = {
+ { gText_FreshWater },
+ { gText_Lemonade },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlSodaPopLemonade[] = {
+ { gText_SodaPop },
+ { gText_Lemonade },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_ThirstyGirlFreshWaterSodaPopLemonade[] = {
+ { gText_FreshWater },
+ { gText_SodaPop },
+ { gText_Lemonade },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_0[] = {
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_1[] = {
+ { gText_RedShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_2[] = {
+ { gText_YellowShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_3[] = {
+ { gText_RedShard },
+ { gText_YellowShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_4[] = {
+ { gText_BlueShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_5[] = {
+ { gText_RedShard },
+ { gText_BlueShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_6[] = {
+ { gText_YellowShard },
+ { gText_BlueShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Unref_Shards_7[] = {
+ { gText_RedShard },
+ { gText_YellowShard },
+ { gText_BlueShard },
+ { gText_GreenShard },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Eeveelutions[] = {
+ { gText_Eevee },
+ { gText_Flareon },
+ { gText_Jolteon },
+ { gText_Vaporeon },
+ { gText_QuitLooking }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_BikeShop[] = {
+ { gText_Bicycle_1000000 },
+ { gText_NoThanks }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_GameCornerPokemonPrizes[] = {
+ { gText_Abra_180Coins },
+ { gText_Clefairy_500Coins },
+ { gText_Dratini_2800Coins },
+ { gText_Scyther_5500Coins },
+ { gText_Porygon_9999Coins },
+ { gText_NoThanks_2 }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TradeCenter_Colosseum[] = {
+ { gText_TradeCenter },
+ { gText_Colosseum },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Link_Wireless[] = {
+ { gText_GameLinkCable },
+ { gText_Wireless },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_RocketHideoutElevator[] = {
+ { gText_B1F },
+ { gText_B2F },
+ { gText_B4F },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_LinkedDirectUnion[] = {
+ { gText_LinkedGamePlay },
+ { gText_DirectCorner },
+ { gText_UnionRoom },
+ { gOtherText_Quit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Island23[] = {
+ { gText_TwoIsland },
+ { gText_ThreeIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Island13[] = {
+ { gText_OneIsland },
+ { gText_ThreeIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Island12[] = {
+ { gText_OneIsland },
+ { gText_TwoIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TradeColosseumCrush[] = {
+ { gText_TradeCenter },
+ { gText_Colosseum_2 },
+ { gText_BerryCrush },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_48[] = {
+ { gText_Dummy_8417E66 },
+ { gText_Dummy_8417E67 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TradeColosseum_2[] = {
+ { gText_TradeCenter },
+ { gText_Colosseum_2 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_PokejumpDodrio[] = {
+ { gText_PokemonJump },
+ { gText_DodrioBerryPicking },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Mushrooms[] = {
+ { gText_2Tinymushrooms },
+ { gText_1BigMushroom }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TradeColosseumBlankCrush[] = {
+ { gText_TradeCenter },
+ { gText_Colosseum_2 },
+ { gText_Dummy_8417E71 },
+ { gText_BerryCrush },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TradeColosseumBlank[] = {
+ { gText_TradeCenter },
+ { gText_Colosseum_2 },
+ { gText_Dummy_8417E71 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeviiNavel[] = {
+ { gText_SeviiIslands },
+ { gText_NavelRock },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeviiBirth[] = {
+ { gText_SeviiIslands },
+ { gText_BirthIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeviiNavelBirth[] = {
+ { gText_SeviiIslands },
+ { gText_NavelRock },
+ { gText_BirthIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Seagallop123[] = {
+ { gText_OneIsland },
+ { gText_TwoIsland },
+ { gText_ThreeIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeagallopV23[] = {
+ { gText_Vermilion },
+ { gText_TwoIsland },
+ { gText_ThreeIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeagallopV13[] = {
+ { gText_Vermilion },
+ { gText_OneIsland },
+ { gText_ThreeIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeagallopV12[] = {
+ { gText_Vermilion },
+ { gText_OneIsland },
+ { gText_TwoIsland },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_SeagallopVermilion[] = {
+ { gText_Vermilion },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_62[] = {
+ { gText_Dummy_8417F68 },
+ { gText_Dummy_8417F67 },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_JoinOrLead[] = {
+ { gText_JoinGroup },
+ { gText_BecomeLeader },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_TrainerTowerMode[] = {
+ { gOtherText_Single },
+ { gOtherText_Double },
+ { gOtherText_Knockout },
+ { gOtherText_Mixed },
+ { gOtherText_Exit }
+};
+
+static const struct MenuAction sScriptMultiChoiceMenu_Exit[] = {
+ { gOtherText_Exit }
+};
+
+const struct MultichoiceListStruct gScriptMultiChoiceMenus[] = {
+ { sScriptMultiChoiceMenu_YesNo, NELEMS(sScriptMultiChoiceMenu_YesNo) },
+ { sScriptMultiChoiceMenu_Eeveelutions, NELEMS(sScriptMultiChoiceMenu_Eeveelutions) },
+ { sScriptMultiChoiceMenu_TrainerCardIconTint, NELEMS(sScriptMultiChoiceMenu_TrainerCardIconTint) },
+ { sScriptMultiChoiceMenu_HOF_Quit, NELEMS(sScriptMultiChoiceMenu_HOF_Quit) },
+ { sScriptMultiChoiceMenu_Eggs_Quit, NELEMS(sScriptMultiChoiceMenu_Eggs_Quit) },
+ { sScriptMultiChoiceMenu_Victories_Quit, NELEMS(sScriptMultiChoiceMenu_Victories_Quit) },
+ { sScriptMultiChoiceMenu_HOF_Eggs_Quit, NELEMS(sScriptMultiChoiceMenu_HOF_Eggs_Quit) },
+ { sScriptMultiChoiceMenu_HOF_Victories_Quit, NELEMS(sScriptMultiChoiceMenu_HOF_Victories_Quit) },
+ { sScriptMultiChoiceMenu_Eggs_Victories_Quit, NELEMS(sScriptMultiChoiceMenu_Eggs_Victories_Quit) },
+ { sScriptMultiChoiceMenu_HOF_Eggs_Victories_Quit, NELEMS(sScriptMultiChoiceMenu_HOF_Eggs_Victories_Quit) },
+ { sScriptMultiChoiceMenu_Exit, NELEMS(sScriptMultiChoiceMenu_Exit) },
+ { sScriptMultiChoiceMenu_Exit, NELEMS(sScriptMultiChoiceMenu_Exit) },
+ { sScriptMultiChoiceMenu_Exit, NELEMS(sScriptMultiChoiceMenu_Exit) },
+ { sScriptMultiChoiceMenu_BikeShop, NELEMS(sScriptMultiChoiceMenu_BikeShop) },
+ { sScriptMultiChoiceMenu_GameCornerPokemonPrizes, NELEMS(sScriptMultiChoiceMenu_GameCornerPokemonPrizes) },
+ { sScriptMultiChoiceMenu_TrainerSchoolWhiteboard, NELEMS(sScriptMultiChoiceMenu_TrainerSchoolWhiteboard) },
+ { sScriptMultiChoiceMenu_YesNoInfo, NELEMS(sScriptMultiChoiceMenu_YesNoInfo) },
+ { sScriptMultiChoiceMenu_SingleDoubleMultiInfoExit, NELEMS(sScriptMultiChoiceMenu_SingleDoubleMultiInfoExit) },
+ { sScriptMultiChoiceMenu_YesNoInfo2, NELEMS(sScriptMultiChoiceMenu_YesNoInfo2) },
+ { sScriptMultiChoiceMenu_ChallengeInfoExit, NELEMS(sScriptMultiChoiceMenu_ChallengeInfoExit) },
+ { sScriptMultiChoiceMenu_RooftopB1F, NELEMS(sScriptMultiChoiceMenu_RooftopB1F) },
+ { sScriptMultiChoiceMenu_Helix, NELEMS(sScriptMultiChoiceMenu_Helix) },
+ { sScriptMultiChoiceMenu_Dome, NELEMS(sScriptMultiChoiceMenu_Dome) },
+ { sScriptMultiChoiceMenu_Amber, NELEMS(sScriptMultiChoiceMenu_Amber) },
+ { sScriptMultiChoiceMenu_HelixAmber, NELEMS(sScriptMultiChoiceMenu_HelixAmber) },
+ { sScriptMultiChoiceMenu_DomeAmber, NELEMS(sScriptMultiChoiceMenu_DomeAmber) },
+ { sScriptMultiChoiceMenu_CeladonVendingMachine, NELEMS(sScriptMultiChoiceMenu_CeladonVendingMachine) },
+ { sScriptMultiChoiceMenu_GameCornerCoinPurchaseCounter, NELEMS(sScriptMultiChoiceMenu_GameCornerCoinPurchaseCounter) },
+ { sScriptMultiChoiceMenu_Excellent_NotSoBad, NELEMS(sScriptMultiChoiceMenu_Excellent_NotSoBad) },
+ { sScriptMultiChoiceMenu_RightLeft, NELEMS(sScriptMultiChoiceMenu_RightLeft) },
+ { sScriptMultiChoiceMenu_GameCornerTMPrizes, NELEMS(sScriptMultiChoiceMenu_GameCornerTMPrizes) },
+ { sScriptMultiChoiceMenu_DeptStoreElevator, NELEMS(sScriptMultiChoiceMenu_DeptStoreElevator) },
+ { sScriptMultiChoiceMenu_ThirstyGirlFreshWater, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlFreshWater) },
+ { sScriptMultiChoiceMenu_ThirstyGirlSodaPop, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlSodaPop) },
+ { sScriptMultiChoiceMenu_ThirstyGirlFreshWaterSodaPop, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlFreshWaterSodaPop) },
+ { sScriptMultiChoiceMenu_ThirstyGirlLemonade, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlLemonade) },
+ { sScriptMultiChoiceMenu_ThirstyGirlFreshWaterLemonade, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlFreshWaterLemonade) },
+ { sScriptMultiChoiceMenu_ThirstyGirlSodaPopLemonade, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlSodaPopLemonade) },
+ { sScriptMultiChoiceMenu_ThirstyGirlFreshWaterSodaPopLemonade, NELEMS(sScriptMultiChoiceMenu_ThirstyGirlFreshWaterSodaPopLemonade) },
+ { sScriptMultiChoiceMenu_TradeCenter_Colosseum, NELEMS(sScriptMultiChoiceMenu_TradeCenter_Colosseum) },
+ { sScriptMultiChoiceMenu_Link_Wireless, NELEMS(sScriptMultiChoiceMenu_Link_Wireless) },
+ { sScriptMultiChoiceMenu_GameCornerBattleItemPrizes, NELEMS(sScriptMultiChoiceMenu_GameCornerBattleItemPrizes) },
+ { sScriptMultiChoiceMenu_RocketHideoutElevator, NELEMS(sScriptMultiChoiceMenu_RocketHideoutElevator) },
+ { sScriptMultiChoiceMenu_LinkedDirectUnion, NELEMS(sScriptMultiChoiceMenu_LinkedDirectUnion) },
+ { sScriptMultiChoiceMenu_Island23, NELEMS(sScriptMultiChoiceMenu_Island23) },
+ { sScriptMultiChoiceMenu_Island13, NELEMS(sScriptMultiChoiceMenu_Island13) },
+ { sScriptMultiChoiceMenu_Island12, NELEMS(sScriptMultiChoiceMenu_Island12) },
+ { sScriptMultiChoiceMenu_TradeColosseumCrush, NELEMS(sScriptMultiChoiceMenu_TradeColosseumCrush) },
+ { sScriptMultiChoiceMenu_48, NELEMS(sScriptMultiChoiceMenu_48) },
+ { sScriptMultiChoiceMenu_PokejumpDodrio, NELEMS(sScriptMultiChoiceMenu_PokejumpDodrio) },
+ { sScriptMultiChoiceMenu_TradeColosseum_2, NELEMS(sScriptMultiChoiceMenu_TradeColosseum_2) },
+ { sScriptMultiChoiceMenu_Mushrooms, NELEMS(sScriptMultiChoiceMenu_Mushrooms) },
+ { sScriptMultiChoiceMenu_TradeColosseumBlankCrush, NELEMS(sScriptMultiChoiceMenu_TradeColosseumBlankCrush) },
+ { sScriptMultiChoiceMenu_TradeColosseumBlank, NELEMS(sScriptMultiChoiceMenu_TradeColosseumBlank) },
+ { sScriptMultiChoiceMenu_SeviiNavel, NELEMS(sScriptMultiChoiceMenu_SeviiNavel) },
+ { sScriptMultiChoiceMenu_SeviiBirth, NELEMS(sScriptMultiChoiceMenu_SeviiBirth) },
+ { sScriptMultiChoiceMenu_SeviiNavelBirth, NELEMS(sScriptMultiChoiceMenu_SeviiNavelBirth) },
+ { sScriptMultiChoiceMenu_Seagallop123, NELEMS(sScriptMultiChoiceMenu_Seagallop123) },
+ { sScriptMultiChoiceMenu_SeagallopV23, NELEMS(sScriptMultiChoiceMenu_SeagallopV23) },
+ { sScriptMultiChoiceMenu_SeagallopV13, NELEMS(sScriptMultiChoiceMenu_SeagallopV13) },
+ { sScriptMultiChoiceMenu_SeagallopV12, NELEMS(sScriptMultiChoiceMenu_SeagallopV12) },
+ { sScriptMultiChoiceMenu_SeagallopVermilion, NELEMS(sScriptMultiChoiceMenu_SeagallopVermilion) },
+ { sScriptMultiChoiceMenu_62, NELEMS(sScriptMultiChoiceMenu_62) },
+ { sScriptMultiChoiceMenu_JoinOrLead, NELEMS(sScriptMultiChoiceMenu_JoinOrLead) },
+ { sScriptMultiChoiceMenu_TrainerTowerMode, NELEMS(sScriptMultiChoiceMenu_TrainerTowerMode) }
+};
+
+const u8 *const gStdStringPtrs[] = {
+ gText_Cool,
+ gText_Beauty,
+ gText_Cute,
+ gText_Smart,
+ gText_Tough,
+ gText_Cool_2,
+ gText_Beauty_2,
+ gText_Cute_2,
+ gText_Smart_2,
+ gText_Tough_2,
+ gText_Items,
+ gText_KeyItems,
+ gText_PokeBalls,
+ gText_TmsgUnknown_8417B2CHms,
+ gText_Berries,
+ gText_Boulderbadge,
+ gText_Cascadebadge,
+ gText_Thunderbadge,
+ gText_Rainbowbadge,
+ gText_Soulbadge,
+ gText_Marshbadge,
+ gText_Volcanobadge,
+ gText_Earthbadge,
+ gText_Coins_2,
+ gText_ItemsPocket,
+ gText_KeyItemsPocket,
+ gText_PokeBallsPocket,
+ gText_TmCase,
+ gText_BerryPouch_2
+};
+
+static const u8 *const sDescriptionPtrs_CableClub_TradeBattleCancel[] = {
+ Text_1BC388,
+ Text_1BC3C7,
+ Text_1BCB42
+};
+
+static const u8 *const sDescriptionPtrs_WirelessCenter_TradeBattleCrushCancel[] = {
+ Text_1BCA95,
+ Text_1BCACB,
+ Text_1BCAF2,
+ Text_1BCB42
+};
+
+static const u8 *const sDescriptionPtrs_WirelessCenter_TradeBattleCancel[] = {
+ Text_1BCA95,
+ Text_1BCACB,
+ Text_1BCB42
+};
+
+static const union AnimCmd sMuseumFossilAnim0[] = {
+ ANIMCMD_FRAME(0, 10),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sMuseumFossilAnimCmdTable[] = {
+ sMuseumFossilAnim0
+};
+
+static const struct OamData sMuseumFossilOamData = {
+ .shape = SPRITE_SHAPE(64x64),
+ .size = SPRITE_SIZE(64x64)
+};
+
+static const struct SpriteTemplate sMuseumFossilSprTemplate = {
+ .tileTag = 7000,
+ .paletteTag = 0xFFFF,
+ .oam = &sMuseumFossilOamData,
+ .anims = sMuseumFossilAnimCmdTable,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const u16 sMuseumAerodactylSprTiles[] = INCBIN_U16("data/script_menu/aerodactyl_fossil.4bpp");
+static const u16 sMuseumAerodactylSprPalette[] = INCBIN_U16("data/script_menu/aerodactyl_fossil.gbapal");
+static const u16 sMuseumKabutopsSprTiles[] = INCBIN_U16("data/script_menu/kabutops_fossil.4bpp");
+static const u16 sMuseumKabutopsSprPalette[] = INCBIN_U16("data/script_menu/kabutops_fossil.gbapal");
+
+static const struct SpriteSheet sMuseumKabutopsSprSheets[] = {
+ {sMuseumKabutopsSprTiles, 0x800, 7000},
+ {}
+};
+
+static const struct SpriteSheet sMuseumAerodactylSprSheets[] = {
+ {sMuseumAerodactylSprTiles, 0x800, 7000},
+ {}
+};
+
+
+static const u8 *const sSeagallopDestStrings[] = {
+ gText_Vermilion,
+ gText_OneIsland,
+ gText_TwoIsland,
+ gText_ThreeIsland,
+ gText_FourIsland,
+ gText_FiveIsland,
+ gText_SixIsland,
+ gText_SevenIsland
+};
+
+static u16 GetStringTilesWide(const u8 *str)
+{
+ return (GetStringWidth(1, str, 0) + 7) / 8;
+}
+
+static u8 GetMenuWidthFromList(const struct MenuAction * items, u8 count)
+{
+ u16 i;
+ u8 width = GetStringTilesWide(items[0].text);
+ u8 tmp;
+
+ for (i = 1; i < count; i++)
+ {
+ tmp = GetStringTilesWide(items[i].text);
+ if (width < tmp)
+ width = tmp;
+ }
+ return width;
+}
+
+bool8 ScriptMenu_Multichoice(u8 left, u8 top, u8 mcId, u8 ignoreBpress)
+{
+ if (FuncIsActiveTask(Task_MultichoiceMenu_HandleInput) == TRUE)
+ return FALSE;
+ gSpecialVar_Result = SCR_MENU_UNSET;
+ DrawVerticalMultichoiceMenu(left, top, mcId, ignoreBpress, 0);
+ return TRUE;
+}
+
+bool8 ScriptMenu_MultichoiceWithDefault(u8 left, u8 top, u8 mcId, u8 ignoreBpress, u8 cursorPos)
+{
+ if (FuncIsActiveTask(Task_MultichoiceMenu_HandleInput) == TRUE)
+ return FALSE;
+ gSpecialVar_Result = SCR_MENU_UNSET;
+ DrawVerticalMultichoiceMenu(left, top, mcId, ignoreBpress, cursorPos);
+ return TRUE;
+}
+
+static void DrawVerticalMultichoiceMenu(u8 left, u8 top, u8 mcId, u8 ignoreBpress, u8 initPos)
+{
+ s32 i;
+ s32 strWidth;
+ s32 tmp;
+ u8 width;
+ u8 height;
+ u8 count;
+ u8 windowId;
+ const struct MenuAction * list;
+
+ if ((ignoreBpress & 2) || QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
+ {
+ ignoreBpress &= 1;
+ count = gScriptMultiChoiceMenus[mcId].count;
+ list = gScriptMultiChoiceMenus[mcId].list;
+ strWidth = 0;
+ for (i = 0; i < count; i++)
+ {
+ tmp = GetStringWidth(2, list[i].text, 0);
+ if (tmp > strWidth)
+ strWidth = tmp;
+ }
+ width = (strWidth + 9) / 8 + 1;
+ if (left + width > 28)
+ left = 28 - width;
+ height = GetMCWindowHeight(count);
+ windowId = CreateWindowFromRect(left, top, width, height);
+ SetStdWindowBorderStyle(windowId, FALSE);
+ if (mcId == 30 || mcId == 13 || mcId == 41)
+ MultichoiceList_PrintItems(windowId, 2, 8, 2, 14, count, list, 0, 2);
+ else
+ MultichoiceList_PrintItems(windowId, 2, 8, 2, 14, count, list, 0, 2);
+ Menu_InitCursor(windowId, 2, 0, 2, 14, count, initPos);
+ CreateMCMenuInputHandlerTask(ignoreBpress, count, windowId, mcId);
+ ScheduleBgCopyTilemapToVram(0);
+ }
+}
+
+static u8 GetMCWindowHeight(u8 count)
+{
+ switch (count)
+ {
+ case 0:
+ return 1;
+ case 1:
+ return 2;
+ case 2:
+ return 4;
+ case 3:
+ return 6;
+ case 4:
+ return 7;
+ case 5:
+ return 9;
+ case 6:
+ return 11;
+ case 7:
+ return 13;
+ case 8:
+ return 14;
+ default:
+ return 1;
+ }
+}
+
+static void CreateMCMenuInputHandlerTask(u8 ignoreBpress, u8 count, u8 windowId, u8 mcId)
+{
+ u8 taskId;
+ if (mcId == 39 || mcId == 47 || mcId == 50)
+ sDelay = 12;
+ else
+ sDelay = 0;
+ taskId = CreateTask(Task_MultichoiceMenu_HandleInput, 80);
+ gTasks[taskId].data[4] = ignoreBpress;
+ if (count > 3)
+ gTasks[taskId].data[5] = TRUE;
+ else
+ gTasks[taskId].data[5] = FALSE;
+ gTasks[taskId].data[6] = windowId;
+ gTasks[taskId].data[7] = mcId;
+ MultiChoicePrintHelpDescription(mcId);
+}
+
+static void Task_MultichoiceMenu_HandleInput(u8 taskId)
+{
+ s16 *data = gTasks[taskId].data;
+ s8 input;
+ if (!gPaletteFade.active)
+ {
+ if (sDelay != 0)
+ sDelay--;
+ else
+ {
+ if (data[5] == FALSE)
+ input = Menu_ProcessInputNoWrapAround();
+ else
+ input = Menu_ProcessInput();
+ if (JOY_NEW(DPAD_UP | DPAD_DOWN))
+ MultiChoicePrintHelpDescription(data[7]);
+ switch (input)
+ {
+ case -2:
+ return;
+ case -1:
+ if (data[4])
+ return;
+ PlaySE(SE_SELECT);
+ gSpecialVar_Result = SCR_MENU_CANCEL;
+ break;
+ default:
+ gSpecialVar_Result = input;
+ break;
+ }
+ DestroyScriptMenuWindow(data[6]);
+ DestroyTask(taskId);
+ EnableBothScriptContexts();
+ }
+ }
+}
+
+static void MultiChoicePrintHelpDescription(u8 mcId)
+{
+ switch (mcId)
+ {
+ case 39:
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
+ AddTextPrinterParameterized2(0, 2, sDescriptionPtrs_CableClub_TradeBattleCancel[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
+ break;
+ case 47:
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
+ AddTextPrinterParameterized2(0, 2, sDescriptionPtrs_WirelessCenter_TradeBattleCrushCancel[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
+ break;
+ case 50:
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
+ AddTextPrinterParameterized2(0, 2, sDescriptionPtrs_WirelessCenter_TradeBattleCancel[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
+ break;
+ }
+}
+
+bool8 ScriptMenu_YesNo(u8 unused, u8 stuff)
+{
+ if (FuncIsActiveTask(Task_YesNoMenu_HandleInput) == TRUE)
+ return FALSE;
+ gSpecialVar_Result = SCR_MENU_UNSET;
+ if (!QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites))
+ {
+ DisplayYesNoMenuDefaultYes();
+ CreateTask(Task_YesNoMenu_HandleInput, 80);
+ }
+ return TRUE;
+}
+
+bool8 sub_809CE38(void)
+{
+ if (gSpecialVar_Result == SCR_MENU_UNSET)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+static void Task_YesNoMenu_HandleInput(u8 taskId)
+{
+ s8 input;
+ if (gTasks[taskId].data[2] < 5)
+ {
+ gTasks[taskId].data[2]++;
+ }
+ else
+ {
+ input = Menu_ProcessInputNoWrapClearOnChoose();
+ switch (input)
+ {
+ case -2:
+ return;
+ case -1:
+ case 1:
+ PlaySE(SE_SELECT);
+ gSpecialVar_Result = FALSE;
+ break;
+ case 0:
+ gSpecialVar_Result = TRUE;
+ break;
+ }
+ DestroyTask(taskId);
+ EnableBothScriptContexts();
+ }
+}
+
+bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 a4, u8 columnCount)
+{
+ const struct MenuAction * list;
+ u8 count;
+ u8 width;
+ u8 rowCount;
+ u8 taskId;
+ if (FuncIsActiveTask(Hask_MultichoiceGridMenu_HandleInput) == TRUE)
+ return FALSE;
+ gSpecialVar_Result = SCR_MENU_UNSET;
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
+ {
+ list = gScriptMultiChoiceMenus[multichoiceId].list;
+ count = gScriptMultiChoiceMenus[multichoiceId].count;
+ width = GetMenuWidthFromList(list, count) + 1;
+ rowCount = count / columnCount;
+ taskId = CreateTask(Hask_MultichoiceGridMenu_HandleInput, 80);
+ gTasks[taskId].data[4] = a4;
+ gTasks[taskId].data[6] = CreateWindowFromRect(left, top, width * columnCount, rowCount * 2);
+ SetStdWindowBorderStyle(gTasks[taskId].data[6], FALSE);
+ MultichoiceGrid_PrintItems(gTasks[taskId].data[6], 1, width * 8, 16, columnCount, rowCount, list);
+ MultichoiceGrid_InitCursor(gTasks[taskId].data[6], 1, 0, 1, width * 8, columnCount, rowCount, 0);
+ ScheduleBgCopyTilemapToVram(0);
+ }
+ return TRUE;
+}
+
+static void Hask_MultichoiceGridMenu_HandleInput(u8 taskId)
+{
+ s16 *data = gTasks[taskId].data;
+ s8 input = Menu_ProcessInputGridLayout();
+ switch (input)
+ {
+ case -2:
+ return;
+ case -1:
+ if (data[4])
+ return;
+ PlaySE(SE_SELECT);
+ gSpecialVar_Result = SCR_MENU_CANCEL;
+ break;
+ default:
+ gSpecialVar_Result = input;
+ break;
+ }
+ DestroyScriptMenuWindow(data[6]);
+ DestroyTask(taskId);
+ EnableBothScriptContexts();
+}
+
+bool8 ScrSpecial_CreatePCMenu(void)
+{
+ if (FuncIsActiveTask(Task_MultichoiceMenu_HandleInput) == TRUE)
+ return FALSE;
+ gSpecialVar_Result = SCR_MENU_UNSET;
+ CreatePCMenuWindow();
+ return TRUE;
+}
+
+static void CreatePCMenuWindow(void)
+{
+ u8 cursorWidth = GetMenuCursorDimensionByFont(2, 0);
+ u8 height = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT);
+ u8 windowWidth;
+ u8 nitems;
+ u8 windowId;
+ switch (GetStringTilesWide(gText_SPc))
+ {
+ default:
+ if (FlagGet(FLAG_SYS_POKEDEX_GET))
+ windowWidth = 14;
+ else
+ windowWidth = 13;
+ break;
+ case 9:
+ case 10:
+ windowWidth = 14;
+ break;
+ }
+ if (FlagGet(FLAG_SYS_GAME_CLEAR))
+ {
+ nitems = 5;
+ windowId = CreateWindowFromRect(0, 0, windowWidth, 10);
+ SetStdWindowBorderStyle(windowId, FALSE);
+ AddTextPrinterParameterized(windowId, 2, gText_ProfOakSPc, cursorWidth, 34, 0xFF, NULL);
+ AddTextPrinterParameterized(windowId, 2, gText_HallOfFame_2, cursorWidth, 50, 0xFF, NULL);
+ AddTextPrinterParameterized(windowId, 2, gText_LogOff, cursorWidth, 66, 0xFF, NULL);
+ }
+ else
+ {
+ if (FlagGet(FLAG_SYS_POKEDEX_GET))
+ nitems = 4;
+ else
+ nitems = 3;
+ windowId = CreateWindowFromRect(0, 0, windowWidth, nitems * 2);
+ SetStdWindowBorderStyle(windowId, FALSE);
+ if (FlagGet(FLAG_SYS_POKEDEX_GET))
+ AddTextPrinterParameterized(windowId, 2, gText_ProfOakSPc, cursorWidth, 34, 0xFF, NULL);
+ AddTextPrinterParameterized(windowId, 2, gText_LogOff, cursorWidth, 2 + 16 * (nitems - 1), 0xFF, NULL);
+ }
+ if (FlagGet(FLAG_SYS_NOT_SOMEONES_PC))
+ AddTextPrinterParameterized(windowId, 2, gText_BillSPc, cursorWidth, 2 , 0xFF, NULL);
+ else
+ AddTextPrinterParameterized(windowId, 2, gText_SomeoneSPc, cursorWidth, 2 , 0xFF, NULL);
+ StringExpandPlaceholders(gStringVar4, gText_SPc);
+ Menu_PrintFormatIntlPlayerName(windowId, gStringVar4, cursorWidth, 18);
+ Menu_InitCursor(windowId, 2, 0, 2, 16, nitems, 0);
+ CreateMCMenuInputHandlerTask(FALSE, nitems, windowId, 0xFF);
+ ScheduleBgCopyTilemapToVram(0);
+}
+
+void ScriptMenu_DisplayPCStartupPrompt(void)
+{
+ sub_80F7768(0, TRUE);
+ AddTextPrinterParameterized2(0, 2, gUnknown_81A508A, 0, NULL, 2, 1, 3);
+}
+
+static void Task_ScriptShowMonPic(u8 taskId)
+{
+ struct Task * task = &gTasks[taskId];
+ switch (task->data[0])
+ {
+ case 0:
+ task->data[0]++;
+ break;
+ case 1:
+ break;
+ case 2:
+ sub_8083A5C(&gSprites[task->data[2]], task->data[2]);
+ task->data[0]++;
+ break;
+ case 3:
+ DestroyScriptMenuWindow(task->data[5]);
+ DestroyTask(taskId);
+ break;
+ }
+}
+
+bool8 ScriptMenu_ShowPokemonPic(u16 species, u8 x, u8 y)
+{
+ u8 spriteId;
+ u8 taskId;
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) == TRUE)
+ return TRUE;
+ if (FindTaskIdByFunc(Task_ScriptShowMonPic) != 0xFF)
+ return FALSE;
+ spriteId = sub_8083970(species, 8 * x + 40, 8 * y + 40, FALSE);
+ taskId = CreateTask(Task_ScriptShowMonPic, 80);
+ gTasks[taskId].data[5] = CreateWindowFromRect(x, y, 8, 8);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[1] = species;
+ gTasks[taskId].data[2] = spriteId;
+ gSprites[spriteId].callback = SpriteCallbackDummy;
+ gSprites[spriteId].oam.priority = 0;
+ SetStdWindowBorderStyle(gTasks[taskId].data[5], TRUE);
+ ScheduleBgCopyTilemapToVram(0);
+ return TRUE;
+}
+
+bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void)
+{
+ u8 taskId = FindTaskIdByFunc(Task_ScriptShowMonPic);
+ if (taskId == 0xFF)
+ return NULL;
+ gTasks[taskId].data[0]++;
+ return PicboxWait;
+}
+
+static bool8 PicboxWait(void)
+{
+ if (FindTaskIdByFunc(Task_ScriptShowMonPic) == 0xFF)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+void sub_809D424(void)
+{
+ u8 taskId = FindTaskIdByFunc(Task_ScriptShowMonPic);
+ struct Task * task;
+ if (taskId != 0xFF)
+ {
+ task = &gTasks[taskId];
+ switch (task->data[0])
+ {
+ case 0:
+ case 1:
+ case 2:
+ sub_8083A5C(&gSprites[task->data[2]], task->data[2]);
+ DestroyScriptMenuWindow(task->data[5]);
+ DestroyTask(taskId);
+ break;
+ case 3:
+ DestroyScriptMenuWindow(task->data[5]);
+ DestroyTask(taskId);
+ break;
+ }
+ }
+}
+
+void Task_WaitMuseumFossilPic(u8 taskId)
+{
+ struct Task * task = &gTasks[taskId];
+ switch (task->data[0])
+ {
+ case 0:
+ task->data[0]++;
+ break;
+ case 1:
+ break;
+ case 2:
+ DestroySprite(&gSprites[task->data[2]]);
+ FreeSpriteTilesByTag(7000);
+ task->data[0]++;
+ break;
+ case 3:
+ DestroyScriptMenuWindow(task->data[5]);
+ DestroyTask(taskId);
+ break;
+ }
+}
+
+bool8 Special_OpenMuseumFossilPic(void)
+{
+ u8 spriteId;
+ u8 taskId;
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) == TRUE)
+ return TRUE;
+ if (FindTaskIdByFunc(Task_WaitMuseumFossilPic) != 0xFF)
+ return FALSE;
+ if (gSpecialVar_0x8004 == SPECIES_KABUTOPS)
+ {
+ LoadSpriteSheets(sMuseumKabutopsSprSheets);
+ LoadPalette(sMuseumKabutopsSprPalette, 0x1D0, 0x20);
+ }
+ else if (gSpecialVar_0x8004 == SPECIES_AERODACTYL)
+ {
+ LoadSpriteSheets(sMuseumAerodactylSprSheets);
+ LoadPalette(sMuseumAerodactylSprPalette, 0x1D0, 0x20);
+ }
+ else
+ {
+ return FALSE;
+ }
+ spriteId = CreateSprite(&sMuseumFossilSprTemplate, gSpecialVar_0x8005 * 8 + 40, gSpecialVar_0x8006 * 8 + 40, 0);
+ gSprites[spriteId].oam.paletteNum = 13;
+ taskId = CreateTask(Task_WaitMuseumFossilPic, 80);
+ gTasks[taskId].data[5] = CreateWindowFromRect(gSpecialVar_0x8005, gSpecialVar_0x8006, 8, 8);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[2] = spriteId;
+ SetStdWindowBorderStyle(gTasks[taskId].data[5], TRUE);
+ ScheduleBgCopyTilemapToVram(0);
+ return TRUE;
+}
+
+bool8 Special_CloseMuseumFossilPic(void)
+{
+ u8 taskId = FindTaskIdByFunc(Task_WaitMuseumFossilPic);
+ if (taskId == 0xFF)
+ return FALSE;
+ gTasks[taskId].data[0]++;
+ return TRUE;
+}
+
+static u8 CreateWindowFromRect(u8 left, u8 top, u8 width, u8 height)
+{
+ struct WindowTemplate template = SetWindowTemplateFields(0, left + 1, top + 1, width, height, 15, 0x038);
+ u8 windowId = AddWindow(&template);
+ PutWindowTilemap(windowId);
+ return windowId;
+}
+
+static void DestroyScriptMenuWindow(u8 windowId)
+{
+ ClearWindowTilemap(windowId);
+ ClearStdWindowAndFrameToTransparent(windowId, TRUE);
+ RemoveWindow(windowId);
+}
+
+void QLPlaybackCB_DestroyScriptMenuMonPicSprites(void)
+{
+ u8 taskId;
+ s16 *data;
+ ScriptContext1_SetupScript(EventScript_1A7AE0);
+ taskId = FindTaskIdByFunc(Task_ScriptShowMonPic);
+ if (taskId != 0xFF)
+ {
+ data = gTasks[taskId].data;
+ if (data[0] < 2)
+ sub_8083A5C(&gSprites[data[2]], data[2]);
+ }
+ taskId = FindTaskIdByFunc(Task_WaitMuseumFossilPic);
+ if (taskId != 0xFF)
+ {
+ data = gTasks[taskId].data;
+ if (data[0] < 2)
+ {
+ DestroySprite(&gSprites[data[2]]);
+ FreeSpriteTilesByTag(7000);
+ }
+ }
+}
+
+void Special_DrawSeagallopDestinationMenu(void)
+{
+ // 8004 = Starting location
+ // 8005 = Page (0: Verm, One, Two, Three, Four, Other, Exit; 1: Four, Five, Six, Seven, Other, Exit)
+ u8 r4;
+ u8 top;
+ u8 nitems;
+ u8 cursorWidth;
+ u8 fontHeight;
+ u8 windowId;
+ u8 i;
+ gSpecialVar_Result = SCR_MENU_UNSET;
+ if (QuestLog_SchedulePlaybackCB(QLPlaybackCB_DestroyScriptMenuMonPicSprites) != TRUE)
+ {
+ if (gSpecialVar_0x8005 == 1)
+ {
+ if (gSpecialVar_0x8004 < SEAGALLOP_FIVE_ISLAND)
+ r4 = SEAGALLOP_FIVE_ISLAND;
+ else
+ r4 = SEAGALLOP_FOUR_ISLAND;
+ nitems = 5;
+ top = 2;
+ }
+ else
+ {
+ r4 = SEAGALLOP_VERMILION_CITY;
+ nitems = 6;
+ top = 0;
+ }
+ cursorWidth = GetMenuCursorDimensionByFont(2, 0);
+ fontHeight = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT);
+ windowId = CreateWindowFromRect(17, top, 11, nitems * 2);
+ SetStdWindowBorderStyle(windowId, FALSE);
+ for (i = 0; i < nitems - 2; i++)
+ {
+ if (r4 != gSpecialVar_0x8004)
+ AddTextPrinterParameterized(windowId, 2, sSeagallopDestStrings[r4], cursorWidth, i * 16 + 2, 0xFF, NULL);
+ else
+ i--;
+ r4++;
+ if (r4 == SEAGALLOP_CINNABAR_ISLAND)
+ r4 = SEAGALLOP_VERMILION_CITY;
+ }
+ AddTextPrinterParameterized(windowId, 2, gText_Other, cursorWidth, i * 16 + 2, 0xFF, NULL);
+ i++;
+ AddTextPrinterParameterized(windowId, 2, gOtherText_Exit, cursorWidth, i * 16 + 2, 0xFF, NULL);
+ Menu_InitCursor(windowId, 2, 0, 2, 16, nitems, 0);
+ CreateMCMenuInputHandlerTask(FALSE, nitems, windowId, 0xFF);
+ ScheduleBgCopyTilemapToVram(0);
+ }
+}
+
+u16 Special_GetSelectedSeagallopDestination(void)
+{
+ // 8004 = Starting location
+ // 8005 = Page (0: Verm, One, Two, Three, Four, Other, Exit; 1: Four, Five, Six, Seven, Other, Exit)
+ if (gSpecialVar_Result == SCR_MENU_CANCEL)
+ return SCR_MENU_CANCEL;
+ if (gSpecialVar_0x8005 == 1)
+ {
+ if (gSpecialVar_Result == 3)
+ {
+ return SEAGALLOP_MORE;
+ }
+ else if (gSpecialVar_Result == 4)
+ {
+ return SCR_MENU_CANCEL;
+ }
+ else if (gSpecialVar_Result == 0)
+ {
+ if (gSpecialVar_0x8004 > SEAGALLOP_FOUR_ISLAND)
+ return SEAGALLOP_FOUR_ISLAND;
+ else
+ return SEAGALLOP_FIVE_ISLAND;
+ }
+ else if (gSpecialVar_Result == 1)
+ {
+ if (gSpecialVar_0x8004 > SEAGALLOP_FIVE_ISLAND)
+ return SEAGALLOP_FIVE_ISLAND;
+ else
+ return SEAGALLOP_SIX_ISLAND;
+ }
+ else if (gSpecialVar_Result == 2)
+ {
+ if (gSpecialVar_0x8004 > SEAGALLOP_SIX_ISLAND)
+ return SEAGALLOP_SIX_ISLAND;
+ else
+ return SEAGALLOP_SEVEN_ISLAND;
+ }
+ }
+ else
+ {
+ if (gSpecialVar_Result == 4)
+ return SEAGALLOP_MORE;
+ else if (gSpecialVar_Result == 5)
+ return SCR_MENU_CANCEL;
+ else if (gSpecialVar_Result >= gSpecialVar_0x8004)
+ return gSpecialVar_Result + 1;
+ else
+ return gSpecialVar_Result;
+ }
+ return SEAGALLOP_VERMILION_CITY;
+}
diff --git a/src/seagallop.c b/src/seagallop.c
index 006a356e4..cf07f9880 100644
--- a/src/seagallop.c
+++ b/src/seagallop.c
@@ -25,13 +25,13 @@
static EWRAM_DATA void * sBg3TilemapBuffer = NULL;
-static void CB2_SetUpSeaGallopScene(void);
+static void CB2_SetUpSeagallopScene(void);
static void VBlankCB_SeaGallop(void);
static void MainCB2_SeaGallop(void);
-static void Task_SeaGallop_0(u8 taskId);
-static void Task_SeaGallop_1(u8 taskId);
-static void Task_SeaGallop_2(u8 taskId);
-static void Task_SeaGallop_3(void);
+static void Task_Seagallop_0(u8 taskId);
+static void Task_Seagallop_1(u8 taskId);
+static void Task_Seagallop_2(u8 taskId);
+static void Task_Seagallop_3(void);
static void ResetGPU(void);
static void ResetAllAssets(void);
static void SetDispcnt(void);
@@ -64,7 +64,7 @@ static const struct BgTemplate sBGTemplates[] = {
}
};
-static const s8 sSeaGallopSpawnTable[][4] = {
+static const s8 sSeag[][4] = {
// Map X Y
[SEAGALLOP_VERMILION_CITY] = {MAP(VERMILION_CITY), 0x17, 0x20},
[SEAGALLOP_ONE_ISLAND] = {MAP(ONE_ISLAND_HARBOR), 0x08, 0x05},
@@ -176,14 +176,14 @@ static const struct SpriteTemplate sWakeSpriteTemplate = {
SpriteCB_Wake
};
-void ScrSpecial_SeaGallopFerry(void)
+void ScrSpecial_SeagallopFerry(void)
{
SetVBlankCallback(NULL);
HelpSystem_Disable();
- SetMainCallback2(CB2_SetUpSeaGallopScene);
+ SetMainCallback2(CB2_SetUpSeagallopScene);
}
-static void CB2_SetUpSeaGallopScene(void)
+static void CB2_SetUpSeagallopScene(void)
{
void ** ptr;
switch (gMain.state)
@@ -248,7 +248,7 @@ static void CB2_SetUpSeaGallopScene(void)
SetGpuReg(REG_OFFSET_WINOUT, 0x00);
SetGpuReg(REG_OFFSET_WIN0H, 0x00F0);
SetGpuReg(REG_OFFSET_WIN0V, 0x1888);
- CreateTask(Task_SeaGallop_0, 8);
+ CreateTask(Task_Seagallop_0, 8);
SetMainCallback2(MainCB2_SeaGallop);
gMain.state = 0;
break;
@@ -270,9 +270,9 @@ static void MainCB2_SeaGallop(void)
UpdatePaletteFade();
}
-static void Task_SeaGallop_0(u8 taskId)
+static void Task_Seagallop_0(u8 taskId)
{
- gTasks[taskId].func = Task_SeaGallop_1;
+ gTasks[taskId].func = Task_Seagallop_1;
}
static void ScrollBG(void)
@@ -287,7 +287,7 @@ static void ScrollBG(void)
}
}
-static void Task_SeaGallop_1(u8 taskId)
+static void Task_Seagallop_1(u8 taskId)
{
struct Task * task = &gTasks[taskId];
@@ -296,29 +296,29 @@ static void Task_SeaGallop_1(u8 taskId)
{
Overworld_FadeOutMapMusic();
sub_807DC18();
- task->func = Task_SeaGallop_2;
+ task->func = Task_Seagallop_2;
}
}
-static void Task_SeaGallop_2(u8 taskId)
+static void Task_Seagallop_2(u8 taskId)
{
ScrollBG();
if (sub_8055FC4() && !gPaletteFade.active)
{
- Task_SeaGallop_3();
+ Task_Seagallop_3();
HelpSystem_Enable();
DestroyTask(taskId);
}
}
-static void Task_SeaGallop_3(void)
+static void Task_Seagallop_3(void)
{
const s8 * warpInfo;
- if (gSpecialVar_0x8006 >= NELEMS(sSeaGallopSpawnTable))
+ if (gSpecialVar_0x8006 >= NELEMS(sSeag))
gSpecialVar_0x8006 = 0;
- warpInfo = sSeaGallopSpawnTable[gSpecialVar_0x8006];
+ warpInfo = sSeag[gSpecialVar_0x8006];
SetWarpDestination(warpInfo[0], warpInfo[1], -1, warpInfo[2], warpInfo[3]);
PlayRainStoppingSoundEffect();
PlaySE(SE_KAIDAN);