From ac6bcecdf51531d24143a2afab51572379a0eb24 Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Wed, 20 May 2020 21:00:21 -0700 Subject: [PATCH] Fix mystery gift fakematchings --- src/mystery_gift.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 9da5f060a..06427d2dd 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -1135,9 +1135,9 @@ void task_add_00_mystery_gift(void) void task00_mystery_gift(u8 taskId) { - struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; - u32 sp0; - const u8 * r1; + struct MysteryGiftTaskData *data = (void *)gTasks[taskId].data; + u32 sp0, flag; + const u8 *r1; switch (data->state) { @@ -1233,12 +1233,10 @@ void task00_mystery_gift(u8 taskId) } break; case 5: - { - register u8 eos asm("r1"); - gStringVar1[0] = (eos = EOS); - gStringVar2[0] = eos; - gStringVar3[0] = eos; - } + *gStringVar1 = EOS; + *gStringVar2 = EOS; + *gStringVar3 = EOS; + switch (data->IsCardOrNews) { case 0: @@ -1306,7 +1304,8 @@ void task00_mystery_gift(u8 taskId) } break; 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: mevent_client_set_param(0); @@ -1333,7 +1332,8 @@ void task00_mystery_gift(u8 taskId) } break; 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: if (CheckReceivedGiftFromWonderCard() == TRUE) @@ -1360,7 +1360,8 @@ void task00_mystery_gift(u8 taskId) } break; 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: mevent_client_set_param(0); @@ -1397,8 +1398,6 @@ void task00_mystery_gift(u8 taskId) } break; case 15: - { - register bool32 flag asm("r1"); r1 = mevent_message(&sp0, data->IsCardOrNews, data->source, data->prevPromptWindowId); if (r1 == NULL) { @@ -1425,7 +1424,7 @@ void task00_mystery_gift(u8 taskId) GenerateRandomNews(2); } } - if (sp0 == 0) + if (!sp0) { data->state = 0; PrintMysteryGiftOrEReaderTopMenu(0, 0); @@ -1436,7 +1435,6 @@ void task00_mystery_gift(u8 taskId) } } break; - } case 16: if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_CommunicationError)) { @@ -1624,12 +1622,10 @@ void task00_mystery_gift(u8 taskId) } break; case 31: - { - register u8 eos asm("r1"); - gStringVar1[0] = (eos = EOS); - gStringVar2[0] = eos; - gStringVar3[0] = eos; - } + *gStringVar1 = EOS; + *gStringVar2 = EOS; + *gStringVar3 = EOS; + if (data->IsCardOrNews == 0) { AddTextPrinterToWindow1(gText_SendingWonderCard);