Merge pull request #1055 from Sierraffinity/mystery_gift_fakematchfix

Fix mystery gift fakematchings
This commit is contained in:
Sierra A 2020-05-20 21:08:31 -07:00 committed by GitHub
commit 25f0dac1b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1135,9 +1135,9 @@ void task_add_00_mystery_gift(void)
void task00_mystery_gift(u8 taskId) void task00_mystery_gift(u8 taskId)
{ {
struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; struct MysteryGiftTaskData *data = (void *)gTasks[taskId].data;
u32 sp0; u32 sp0, flag;
const u8 * r1; const u8 *r1;
switch (data->state) switch (data->state)
{ {
@ -1233,12 +1233,10 @@ void task00_mystery_gift(u8 taskId)
} }
break; break;
case 5: case 5:
{ *gStringVar1 = EOS;
register u8 eos asm("r1"); *gStringVar2 = EOS;
gStringVar1[0] = (eos = EOS); *gStringVar3 = EOS;
gStringVar2[0] = eos;
gStringVar3[0] = eos;
}
switch (data->IsCardOrNews) switch (data->IsCardOrNews)
{ {
case 0: case 0:
@ -1306,7 +1304,8 @@ void task00_mystery_gift(u8 taskId)
} }
break; break;
case 9: case 9:
switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_client_get_buffer())) flag = mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_client_get_buffer());
switch (flag)
{ {
case 0: case 0:
mevent_client_set_param(0); mevent_client_set_param(0);
@ -1333,7 +1332,8 @@ void task00_mystery_gift(u8 taskId)
} }
break; break;
case 11: case 11:
switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_ThrowAwayWonderCard)) flag = mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_ThrowAwayWonderCard);
switch (flag)
{ {
case 0: case 0:
if (CheckReceivedGiftFromWonderCard() == TRUE) if (CheckReceivedGiftFromWonderCard() == TRUE)
@ -1360,7 +1360,8 @@ void task00_mystery_gift(u8 taskId)
} }
break; break;
case 12: case 12:
switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift)) flag = mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift);
switch (flag)
{ {
case 0: case 0:
mevent_client_set_param(0); mevent_client_set_param(0);
@ -1397,8 +1398,6 @@ void task00_mystery_gift(u8 taskId)
} }
break; break;
case 15: case 15:
{
register bool32 flag asm("r1");
r1 = mevent_message(&sp0, data->IsCardOrNews, data->source, data->prevPromptWindowId); r1 = mevent_message(&sp0, data->IsCardOrNews, data->source, data->prevPromptWindowId);
if (r1 == NULL) if (r1 == NULL)
{ {
@ -1425,7 +1424,7 @@ void task00_mystery_gift(u8 taskId)
GenerateRandomNews(2); GenerateRandomNews(2);
} }
} }
if (sp0 == 0) if (!sp0)
{ {
data->state = 0; data->state = 0;
PrintMysteryGiftOrEReaderTopMenu(0, 0); PrintMysteryGiftOrEReaderTopMenu(0, 0);
@ -1436,7 +1435,6 @@ void task00_mystery_gift(u8 taskId)
} }
} }
break; break;
}
case 16: case 16:
if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_CommunicationError)) if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_CommunicationError))
{ {
@ -1624,12 +1622,10 @@ void task00_mystery_gift(u8 taskId)
} }
break; break;
case 31: case 31:
{ *gStringVar1 = EOS;
register u8 eos asm("r1"); *gStringVar2 = EOS;
gStringVar1[0] = (eos = EOS); *gStringVar3 = EOS;
gStringVar2[0] = eos;
gStringVar3[0] = eos;
}
if (data->IsCardOrNews == 0) if (data->IsCardOrNews == 0)
{ {
AddTextPrinterToWindow1(gText_SendingWonderCard); AddTextPrinterToWindow1(gText_SendingWonderCard);