Document some mystery gift

This commit is contained in:
GriffinR 2021-10-14 14:10:42 -04:00
parent 95406384f4
commit 37e52c4f34
8 changed files with 351 additions and 324 deletions

View File

@ -1,6 +1,6 @@
#ifndef GUARD_EREADER_SCREEN_H #ifndef GUARD_EREADER_SCREEN_H
#define GUARD_EREADER_SCREEN_H #define GUARD_EREADER_SCREEN_H
void task_add_00_ereader(void); void CreateEReaderTask(void);
#endif // GUARD_EREADER_SCREEN_H #endif // GUARD_EREADER_SCREEN_H

View File

@ -4,15 +4,15 @@
extern bool8 gGiftIsFromEReader; extern bool8 gGiftIsFromEReader;
u16 GetMysteryGiftBaseBlock(void); u16 GetMysteryGiftBaseBlock(void);
void c2_mystery_gift_e_reader_run(void); void CB2_MysteryGiftEReader(void);
void PrintMysteryGiftOrEReaderTopMenu(bool8 isJapanese, bool32 usePickOkCancel); void PrintMysteryGiftOrEReaderTopMenu(bool8 isJapanese, bool32 usePickOkCancel);
void MG_DrawCheckerboardPattern(u32 bg); void MG_DrawCheckerboardPattern(u32 bg);
void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void); void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void);
bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str); bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str);
void AddTextPrinterToWindow1(const u8 *src); void AddTextPrinterToWindow1(const u8 *src);
void c2_ereader(void); void CB2_InitEReader(void);
void c2_mystery_gift(void); void CB2_InitMysteryGift(void);
void MG_DrawTextBorder(u8 windowId); void MG_DrawTextBorder(u8 windowId);
s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u16 *windowId, bool8 yesNoBoxPlacement, const u8 *str); s8 DoMysteryGiftYesNo(u8 *textState, u16 *windowId, bool8 yesNoBoxPlacement, const u8 *str);
#endif //GUARD_MYSTERY_GIFT_H #endif //GUARD_MYSTERY_GIFT_H

View File

@ -153,9 +153,9 @@ extern u8 gUnionRoomRequestedMonType;
u8 CreateTask_CreateTradeMenu(void); u8 CreateTask_CreateTradeMenu(void);
void SetUsingUnionRoomStartMenu(void); void SetUsingUnionRoomStartMenu(void);
void MEvent_CreateTask_CardOrNewsWithFriend(u32 activity); void CreateTask_LinkMysteryGiftWithFriend(u32 activity);
void MEvent_CreateTask_CardOrNewsOverWireless(u32 activity); void CreateTask_LinkMysteryGiftOverWireless(u32 activity);
void MEvent_CreateTask_Leader(u32 activity); void CreateTask_SendMysteryGift(u32 activity);
u8 CreateTask_ListenToWireless(void); u8 CreateTask_ListenToWireless(void);
void StartUnionRoomBattle(u16 battleFlags); void StartUnionRoomBattle(u16 battleFlags);

View File

@ -13,7 +13,7 @@
#include "util.h" #include "util.h"
#include "constants/songs.h" #include "constants/songs.h"
struct Unk81D5014 struct EReaderTaskData
{ {
u16 unk0; u16 unk0;
u16 unk2; u16 unk2;
@ -36,7 +36,7 @@ struct Unk03006370
u32 *unk8; u32 *unk8;
}; };
static void sub_81D5084(u8); static void Task_EReader(u8);
struct Unk03006370 gUnknown_03006370; struct Unk03006370 gUnknown_03006370;
@ -209,11 +209,11 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1)
return 0; return 0;
} }
void task_add_00_ereader(void) void CreateEReaderTask(void)
{ {
struct Unk81D5014 *data; struct EReaderTaskData *data;
u8 taskId = CreateTask(sub_81D5084, 0); u8 taskId = CreateTask(Task_EReader, 0);
data = (struct Unk81D5014 *)gTasks[taskId].data; data = (struct EReaderTaskData *)gTasks[taskId].data;
data->unk8 = 0; data->unk8 = 0;
data->unk9 = 0; data->unk9 = 0;
data->unkA = 0; data->unkA = 0;
@ -244,9 +244,9 @@ static bool32 sub_81D5064(u16 *arg0, u16 arg1)
return FALSE; return FALSE;
} }
static void sub_81D5084(u8 taskId) static void Task_EReader(u8 taskId)
{ {
struct Unk81D5014 *data = (struct Unk81D5014 *)gTasks[taskId].data; struct EReaderTaskData *data = (struct EReaderTaskData *)gTasks[taskId].data;
switch (data->unk8) switch (data->unk8)
{ {
case 0: case 0:

View File

@ -1981,7 +1981,7 @@ static void RfuCheckErrorStatus(void)
{ {
if (gRfu.errorState == RFU_ERROR_STATE_OCCURRED && lman.childClockSlave_flag == 0) if (gRfu.errorState == RFU_ERROR_STATE_OCCURRED && lman.childClockSlave_flag == 0)
{ {
if (gMain.callback2 == c2_mystery_gift_e_reader_run || lman.init_param->mboot_flag) if (gMain.callback2 == CB2_MysteryGiftEReader || lman.init_param->mboot_flag)
gWirelessCommType = 2; gWirelessCommType = 2;
SetMainCallback2(CB2_LinkError); SetMainCallback2(CB2_LinkError);
gMain.savedCallback = CB2_LinkError; gMain.savedCallback = CB2_LinkError;

View File

@ -90,7 +90,7 @@
* - If the user selected New Game, advance to Task_NewGameBirchSpeech_Init. * - If the user selected New Game, advance to Task_NewGameBirchSpeech_Init.
* - If the user selected Continue, advance to CB2_ContinueSavedGame. * - If the user selected Continue, advance to CB2_ContinueSavedGame.
* - If the user selected the Options menu, advance to CB2_InitOptionMenu. * - If the user selected the Options menu, advance to CB2_InitOptionMenu.
* - If the user selected Mystery Gift, advance to CB2_MysteryGift. However, * - If the user selected Mystery Gift, advance to CB2_InitMysteryGift. However,
* if the wireless adapter was removed, instead advance to * if the wireless adapter was removed, instead advance to
* Task_DisplayMainMenuInvalidActionError. * Task_DisplayMainMenuInvalidActionError.
* - Code to start a Mystery Event is present here, but is unreachable in this * - Code to start a Mystery Event is present here, but is unreachable in this
@ -1073,7 +1073,7 @@ static void Task_HandleMainMenuAPressed(u8 taskId)
DestroyTask(taskId); DestroyTask(taskId);
break; break;
case ACTION_MYSTERY_GIFT: case ACTION_MYSTERY_GIFT:
SetMainCallback2(c2_mystery_gift); SetMainCallback2(CB2_InitMysteryGift);
DestroyTask(taskId); DestroyTask(taskId);
break; break;
case ACTION_MYSTERY_EVENTS: case ACTION_MYSTERY_EVENTS:
@ -1081,7 +1081,7 @@ static void Task_HandleMainMenuAPressed(u8 taskId)
DestroyTask(taskId); DestroyTask(taskId);
break; break;
case ACTION_EREADER: case ACTION_EREADER:
SetMainCallback2(c2_ereader); SetMainCallback2(CB2_InitEReader);
DestroyTask(taskId); DestroyTask(taskId);
break; break;
case ACTION_INVALID: case ACTION_INVALID:

File diff suppressed because it is too large Load Diff

View File

@ -218,7 +218,7 @@ static u16 ReadAsU16(const u8 *);
static void Task_TryBecomeLinkLeader(u8); static void Task_TryBecomeLinkLeader(u8);
static void Task_TryJoinLinkGroup(u8); static void Task_TryJoinLinkGroup(u8);
static void Task_ListenToWireless(u8); static void Task_ListenToWireless(u8);
static void Task_MEvent_Leader(u8); static void Task_SendMysteryGift(u8);
static void Task_CardOrNewsWithFriend(u8); static void Task_CardOrNewsWithFriend(u8);
static void Task_CardOrNewsOverWireless(u8); static void Task_CardOrNewsOverWireless(u8);
static void Task_RunUnionRoom(u8); static void Task_RunUnionRoom(u8);
@ -1857,12 +1857,13 @@ static void CreateTask_StartActivity(void)
gTasks[taskId].data[0] = 0; gTasks[taskId].data[0] = 0;
} }
void MEvent_CreateTask_Leader(u32 activity) // Sending Wonder Card/News
void CreateTask_SendMysteryGift(u32 activity)
{ {
u8 taskId; u8 taskId;
struct WirelessLink_Leader *data; struct WirelessLink_Leader *data;
taskId = CreateTask(Task_MEvent_Leader, 0); taskId = CreateTask(Task_SendMysteryGift, 0);
sWirelessLinkMain.leader = data = (void*)(gTasks[taskId].data); sWirelessLinkMain.leader = data = (void*)(gTasks[taskId].data);
data->state = 0; data->state = 0;
@ -1871,7 +1872,7 @@ void MEvent_CreateTask_Leader(u32 activity)
gSpecialVar_Result = LINKUP_ONGOING; gSpecialVar_Result = LINKUP_ONGOING;
} }
static void Task_MEvent_Leader(u8 taskId) static void Task_SendMysteryGift(u8 taskId)
{ {
struct WirelessLink_Leader *data = sWirelessLinkMain.leader; struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
struct WindowTemplate winTemplate; struct WindowTemplate winTemplate;
@ -1944,7 +1945,7 @@ static void Task_MEvent_Leader(u8 taskId)
data->state = 7; data->state = 7;
break; break;
case 7: case 7:
switch (mevent_message_print_and_prompt_yes_no(&data->textState, &data->yesNoWindowId, 0, gStringVar4)) switch (DoMysteryGiftYesNo(&data->textState, &data->yesNoWindowId, 0, gStringVar4))
{ {
case 0: case 0:
LoadWirelessStatusIndicatorSpriteGfx(); LoadWirelessStatusIndicatorSpriteGfx();
@ -2065,7 +2066,7 @@ static void Task_MEvent_Leader(u8 taskId)
} }
} }
void MEvent_CreateTask_CardOrNewsWithFriend(u32 activity) void CreateTask_LinkMysteryGiftWithFriend(u32 activity)
{ {
u8 taskId; u8 taskId;
struct WirelessLink_Group *data; struct WirelessLink_Group *data;
@ -2234,7 +2235,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
} }
} }
void MEvent_CreateTask_CardOrNewsOverWireless(u32 activity) void CreateTask_LinkMysteryGiftOverWireless(u32 activity)
{ {
u8 taskId; u8 taskId;
struct WirelessLink_Group *data; struct WirelessLink_Group *data;