From fb5c19a33bf314f4976ae56ce13f4dc9d9ed0fe0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:36:48 -0400 Subject: [PATCH] through mevent_message --- asm/mystery_gift.s | 138 --------------------------------------------- include/strings.h | 16 ++++++ src/mystery_gift.c | 70 +++++++++++++++++++++++ 3 files changed, 86 insertions(+), 138 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index f4a999bc1..ab25f5dbf 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,144 +5,6 @@ .text - thumb_func_start mevent_message -mevent_message: @ 8018F0C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r2, 0 - str r2, [r4] - cmp r3, 0xE - bls _08018F22 - b _08019034 -_08018F22: - lsls r0, r3, 2 - ldr r1, =_08018F30 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018F30: - .4byte _08018F6C - .4byte _08018F78 - .4byte _08018F84 - .4byte _08018F9C - .4byte _08018FB4 - .4byte _08018FC0 - .4byte _08018FCC - .4byte _08018FD8 - .4byte _08018FE4 - .4byte _08018FF0 - .4byte _08018FFC - .4byte _08019014 - .4byte _08019020 - .4byte _0801902C - .4byte _08019030 -_08018F6C: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NothingSentOver - b _08019034 - .pool -_08018F78: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_RecordUploadedViaWireless - b _08019034 - .pool -_08018F84: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderCardReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderCardReceived - b _08019034 - .pool -_08018F9C: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderNewsReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderNewsReceived - b _08019034 - .pool -_08018FB4: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewStampReceived - b _08019034 - .pool -_08018FC0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadCard - b _08019034 - .pool -_08018FCC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadStamp - b _08019034 - .pool -_08018FD8: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadNews - b _08019034 - .pool -_08018FE4: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NoMoreRoomForStamps - b _08019034 - .pool -_08018FF0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationCanceled - b _08019034 - .pool -_08018FFC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CantAcceptNewsFromTrainer - cmp r6, 0 - bne _08019034 - ldr r2, =gText_CantAcceptCardFromTrainer - b _08019034 - .pool -_08019014: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationError - b _08019034 - .pool -_08019020: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewTrainerReceived - b _08019034 - .pool -_0801902C: - movs r0, 0x1 - b _08019032 -_08019030: - movs r0, 0 -_08019032: - str r0, [r4] -_08019034: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_message - thumb_func_start mevent_08142CE8 mevent_08142CE8: @ 801903C push {r4-r6,lr} diff --git a/include/strings.h b/include/strings.h index 36c4e36d9..4a07d4efb 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2634,5 +2634,21 @@ extern const u8 gText_WonderNewsThrownAway[]; extern const u8 gText_WonderCardThrownAway[]; extern const u8 gText_DataWillBeSaved[]; extern const u8 gText_SaveCompletedPressA[]; +extern const u8 gText_NothingSentOver[]; +extern const u8 gText_RecordUploadedViaWireless[]; +extern const u8 gText_WonderCardReceivedFrom[]; +extern const u8 gText_WonderCardReceived[]; +extern const u8 gText_WonderNewsReceivedFrom[]; +extern const u8 gText_WonderNewsReceived[]; +extern const u8 gText_NewStampReceived[]; +extern const u8 gText_AlreadyHadCard[]; +extern const u8 gText_AlreadyHadStamp[]; +extern const u8 gText_AlreadyHadNews[]; +extern const u8 gText_NoMoreRoomForStamps[]; +extern const u8 gText_CommunicationCanceled[]; +extern const u8 gText_CantAcceptNewsFromTrainer[]; +extern const u8 gText_CantAcceptCardFromTrainer[]; +extern const u8 gText_CommunicationError[]; +extern const u8 gText_NewTrainerReceived[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 206a9e50b..c8a507355 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -918,3 +918,73 @@ bool32 mevent_save_game(u8 * state) return FALSE; } + +const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) +{ + const u8 * msg = NULL; + *a0 = 0; + + switch (a3) + { + case 0: + *a0 = 0; + msg = gText_NothingSentOver; + break; + case 1: + *a0 = 0; + msg = gText_RecordUploadedViaWireless; + break; + case 2: + *a0 = 1; + msg = a2 == 0 ? gText_WonderCardReceived : gText_WonderCardReceivedFrom; + break; + case 3: + *a0 = 1; + msg = a2 == 0 ? gText_WonderNewsReceived : gText_WonderNewsReceivedFrom; + break; + case 4: + *a0 = 1; + msg = gText_NewStampReceived; + break; + case 5: + *a0 = 0; + msg = gText_AlreadyHadCard; + break; + case 6: + *a0 = 0; + msg = gText_AlreadyHadStamp; + break; + case 7: + *a0 = 0; + msg = gText_AlreadyHadNews; + break; + case 8: + *a0 = 0; + msg = gText_NoMoreRoomForStamps; + break; + case 9: + *a0 = 0; + msg = gText_CommunicationCanceled; + break; + case 10: + *a0 = 0; + msg = a1 == 0 ? gText_CantAcceptCardFromTrainer : gText_CantAcceptNewsFromTrainer; + break; + case 11: + *a0 = 0; + msg = gText_CommunicationError; + break; + case 12: + *a0 = 1; + msg = gText_NewTrainerReceived; + break; + case 13: + *a0 = 1; + break; + case 14: + *a0 = 0; + break; + } + + return msg; +}