fakematching task00_mystery_gift

This commit is contained in:
PikalaxALT 2019-03-31 15:50:25 -04:00
parent 5b361db6b3
commit 4f12f0ae28
9 changed files with 607 additions and 875 deletions

View File

@ -5,870 +5,6 @@
.text
thumb_func_start task00_mystery_gift
task00_mystery_gift: @ 80191F4
push {r4,r5,lr}
sub sp, 0x4
lsls r0, 24
lsrs r4, r0, 24
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r5, r0, r1
ldrb r0, [r5, 0x8]
cmp r0, 0x25
bls _0801920E
b _08019922
_0801920E:
lsls r0, 2
ldr r1, =_08019220
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08019220:
.4byte _080192B8
.4byte _080192BE
.4byte _08019300
.4byte _08019338
.4byte _0801935C
.4byte _080193AC
.4byte _0801940C
.4byte _08019444
.4byte _08019454
.4byte _080194CC
.4byte _080194F0
.4byte _08019508
.4byte _08019538
.4byte _08019574
.4byte _0801958C
.4byte _080195BC
.4byte _080198EC
.4byte _0801961A
.4byte _0801962A
.4byte _08019922
.4byte _0801963C
.4byte _08019688
.4byte _080196FE
.4byte _0801972E
.4byte _08019764
.4byte _0801977E
.4byte _08019792
.4byte _0801979E
.4byte _080197B2
.4byte _080197C6
.4byte _080197F8
.4byte _0801982C
.4byte _08019870
.4byte _08019884
.4byte _080198A0
.4byte _080198B8
.4byte _080198EC
.4byte _0801990C
_080192B8:
movs r0, 0x1
strb r0, [r5, 0x8]
b _08019922
_080192BE:
adds r0, r5, 0
adds r0, 0x9
adds r1, r5, 0
movs r2, 0
bl sub_8018A50
adds r1, r0, 0
cmp r1, 0x1
beq _080192E8
cmp r1, 0x1
bcc _080192DE
movs r0, 0x2
negs r0, r0
cmp r1, r0
beq _080192FA
b _08019922
_080192DE:
movs r0, 0
strb r0, [r5, 0xC]
bl sub_801B27C
b _080192EE
_080192E8:
strb r1, [r5, 0xC]
bl sub_801B0CC
_080192EE:
cmp r0, 0x1
bne _080192F4
b _08019820
_080192F4:
movs r0, 0x2
strb r0, [r5, 0x8]
b _08019922
_080192FA:
movs r0, 0x25
strb r0, [r5, 0x8]
b _08019922
_08019300:
ldrb r0, [r5, 0xC]
cmp r0, 0
bne _08019314
adds r0, r5, 0
adds r0, 0x9
ldr r1, =gText_DontHaveCardNewOneInput
b _0801931A
.pool
_08019314:
adds r0, r5, 0
adds r0, 0x9
ldr r1, =gText_DontHaveNewsNewOneInput
_0801931A:
bl mevent_0814257C
cmp r0, 0
bne _08019324
b _08019922
_08019324:
movs r0, 0x3
strb r0, [r5, 0x8]
movs r0, 0
movs r1, 0x1
bl sub_80186EC
b _08019922
.pool
_08019338:
ldrb r0, [r5, 0xC]
cmp r0, 0
bne _0801934C
ldr r0, =gText_WhereShouldCardBeAccessed
bl sub_8018884
b _08019352
.pool
_0801934C:
ldr r0, =gText_WhereShouldNewsBeAccessed
bl sub_8018884
_08019352:
movs r0, 0x4
strb r0, [r5, 0x8]
b _08019922
.pool
_0801935C:
adds r0, r5, 0
adds r0, 0x9
adds r1, r5, 0
movs r2, 0x1
bl sub_8018A50
adds r4, r0, 0
cmp r4, 0x1
beq _0801938A
cmp r4, 0x1
bcc _0801937C
movs r0, 0x2
negs r0, r0
cmp r4, r0
beq _08019396
b _08019922
_0801937C:
bl sub_80188DC
movs r1, 0
movs r0, 0x5
strb r0, [r5, 0x8]
strb r1, [r5, 0xD]
b _08019922
_0801938A:
bl sub_80188DC
movs r0, 0x5
strb r0, [r5, 0x8]
strb r4, [r5, 0xD]
b _08019922
_08019396:
bl sub_80188DC
ldrb r0, [r5, 0xC]
bl sub_8018D98
cmp r0, 0
beq _080193A6
b _08019820
_080193A6:
strb r0, [r5, 0x8]
movs r0, 0
b _080198FE
_080193AC:
ldr r0, =gStringVar1
movs r1, 0xFF
strb r1, [r0]
ldr r0, =gStringVar2
strb r1, [r0]
ldr r0, =gStringVar3
strb r1, [r0]
ldrb r0, [r5, 0xC]
cmp r0, 0
beq _080193D4
cmp r0, 0x1
beq _080193EE
b _08019406
.pool
_080193D4:
ldrb r0, [r5, 0xD]
cmp r0, 0x1
bne _080193E2
movs r0, 0x15
bl sub_8014EFC
b _08019406
_080193E2:
cmp r0, 0
bne _08019406
movs r0, 0x15
bl sub_80152A8
b _08019406
_080193EE:
ldrb r0, [r5, 0xD]
cmp r0, 0x1
bne _080193FC
movs r0, 0x16
bl sub_8014EFC
b _08019406
_080193FC:
cmp r0, 0
bne _08019406
movs r0, 0x16
bl sub_80152A8
_08019406:
movs r0, 0x6
strb r0, [r5, 0x8]
b _08019922
_0801940C:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
beq _0801942C
movs r0, 0x1
bl sub_8018838
movs r0, 0x7
strb r0, [r5, 0x8]
ldrb r0, [r5, 0xC]
bl sub_801D484
b _08019922
.pool
_0801942C:
ldr r0, =gSpecialVar_Result
ldrh r0, [r0]
cmp r0, 0x5
beq _08019436
b _08019922
_08019436:
movs r0, 0x1
bl sub_8018838
b _080197C0
.pool
_08019444:
ldr r0, =gText_Communicating
bl sub_8018884
movs r0, 0x8
strb r0, [r5, 0x8]
b _08019922
.pool
_08019454:
adds r0, r5, 0
bl sub_801D4A8
subs r0, 0x2
cmp r0, 0x4
bls _08019462
b _08019922
_08019462:
lsls r0, 2
ldr r1, =_08019470
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08019470:
.4byte _080194AE
.4byte _080194A8
.4byte _080194B4
.4byte _08019492
.4byte _08019484
_08019484:
bl task_add_05_task_del_08FA224_when_no_RfuFunc
ldrh r0, [r5]
strb r0, [r5, 0xE]
movs r0, 0xD
strb r0, [r5, 0x8]
b _08019922
_08019492:
ldr r4, [r5, 0x10]
bl sub_801D4F4
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0x40
bl memcpy
bl sub_801D4E4
b _08019922
_080194A8:
movs r0, 0xA
strb r0, [r5, 0x8]
b _08019922
_080194AE:
movs r0, 0x9
strb r0, [r5, 0x8]
b _08019922
_080194B4:
movs r0, 0xB
strb r0, [r5, 0x8]
ldr r0, =gStringVar1
ldr r1, =gLinkPlayers + 8
bl StringCopy
b _08019922
.pool
_080194CC:
adds r4, r5, 0
adds r4, 0x9
bl sub_801D4F4
adds r3, r0, 0
adds r0, r4, 0
adds r1, r5, 0
movs r2, 0
bl sub_8018B08
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0x1
beq _08019564
cmp r1, 0x1
bcs _08019552
movs r0, 0
b _08019566
_080194F0:
adds r4, r5, 0
adds r4, 0x9
bl sub_801D4F4
adds r1, r0, 0
adds r0, r4, 0
bl mevent_0814257C
cmp r0, 0
bne _08019506
b _08019922
_08019506:
b _0801956A
_08019508:
adds r0, r5, 0
adds r0, 0x9
ldr r3, =gText_ThrowAwayWonderCard
adds r1, r5, 0
movs r2, 0
bl sub_8018B08
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0x1
beq _08019564
cmp r1, 0x1
bcs _08019552
bl sub_801B3F8
cmp r0, 0x1
bne _08019534
movs r0, 0xC
strb r0, [r5, 0x8]
b _08019922
.pool
_08019534:
movs r0, 0
b _08019566
_08019538:
adds r0, r5, 0
adds r0, 0x9
ldr r3, =gText_HaventReceivedCardsGift
adds r1, r5, 0
movs r2, 0
bl sub_8018B08
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0x1
beq _08019564
cmp r1, 0x1
bcc _08019560
_08019552:
movs r0, 0x1
negs r0, r0
cmp r1, r0
beq _08019564
b _08019922
.pool
_08019560:
movs r0, 0
b _08019566
_08019564:
movs r0, 0x1
_08019566:
bl sub_801D500
_0801956A:
bl sub_801D4E4
movs r0, 0x7
strb r0, [r5, 0x8]
b _08019922
_08019574:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
beq _0801957E
b _08019922
_0801957E:
bl sub_800E084
movs r0, 0xE
strb r0, [r5, 0x8]
b _08019922
.pool
_0801958C:
adds r0, r5, 0
adds r0, 0x9
ldr r1, =gText_CommunicationCompleted
bl sub_8018A1C
cmp r0, 0
bne _0801959C
b _08019922
_0801959C:
ldrb r0, [r5, 0xD]
cmp r0, 0x1
bne _080195AA
ldr r0, =gStringVar1
ldr r1, =gLinkPlayers + 8
bl StringCopy
_080195AA:
movs r0, 0xF
strb r0, [r5, 0x8]
b _08019922
.pool
_080195BC:
ldrb r1, [r5, 0xC]
ldrb r2, [r5, 0xD]
ldrb r3, [r5, 0xE]
mov r0, sp
bl mevent_message
adds r1, r0, 0
cmp r1, 0
bne _080195D0
ldr r1, [r5, 0x10]
_080195D0:
ldr r0, [sp]
cmp r0, 0
beq _080195E2
adds r0, r5, 0
adds r0, 0x9
adds r2, r5, 0
bl mevent_08142CE8
b _080195EA
_080195E2:
adds r0, r5, 0
adds r0, 0x9
bl mevent_0814257C
_080195EA:
adds r1, r0, 0
cmp r1, 0
bne _080195F2
b _08019922
_080195F2:
ldrb r0, [r5, 0xE]
cmp r0, 0x3
bne _0801960C
ldrb r0, [r5, 0xD]
cmp r0, 0x1
bne _08019606
movs r0, 0x1
bl sub_801DB68
b _0801960C
_08019606:
movs r0, 0x2
bl sub_801DB68
_0801960C:
ldr r0, [sp]
cmp r0, 0
beq _08019614
b _080198DC
_08019614:
strb r0, [r5, 0x8]
movs r0, 0
b _080198FE
_0801961A:
adds r0, r5, 0
adds r0, 0x9
bl mevent_save_game
cmp r0, 0
bne _08019628
b _08019922
_08019628:
b _08019820
_0801962A:
adds r0, r5, 0
adds r0, 0x9
ldrb r1, [r5, 0xC]
bl sub_8018DAC
cmp r0, 0
bne _0801963A
b _08019922
_0801963A:
b _080196F8
_0801963C:
ldrb r0, [r5, 0xC]
cmp r0, 0
bne _08019664
ldr r2, =gMain
ldrh r1, [r2, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _08019652
movs r0, 0x15
strb r0, [r5, 0x8]
_08019652:
ldrh r1, [r2, 0x2E]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _0801965E
b _08019922
_0801965E:
b _08019682
.pool
_08019664:
ldr r0, =gMain
ldrh r0, [r0, 0x2E]
bl sub_801CCD0
cmp r0, 0
beq _0801967C
cmp r0, 0x1
beq _08019682
b _08019922
.pool
_0801967C:
bl sub_801CC38
b _0801975E
_08019682:
movs r0, 0x1B
strb r0, [r5, 0x8]
b _08019922
_08019688:
ldrb r0, [r5, 0xC]
cmp r0, 0
bne _080196A2
bl sub_801B308
cmp r0, 0
beq _080196B6
adds r0, r5, 0
adds r0, 0x9
ldrb r2, [r5, 0xC]
adds r1, r5, 0
movs r3, 0
b _080196C0
_080196A2:
bl sub_801B128
cmp r0, 0
beq _080196B6
adds r0, r5, 0
adds r0, 0x9
ldrb r2, [r5, 0xC]
adds r1, r5, 0
movs r3, 0
b _080196C0
_080196B6:
adds r0, r5, 0
adds r0, 0x9
ldrb r2, [r5, 0xC]
adds r1, r5, 0
movs r3, 0x1
_080196C0:
bl sub_8018C4C
adds r1, r0, 0
cmp r1, 0x1
beq _080196E2
cmp r1, 0x1
bcc _080196DC
cmp r1, 0x2
beq _080196E8
movs r0, 0x2
negs r0, r0
cmp r1, r0
beq _080196EE
b _08019922
_080196DC:
movs r0, 0x1C
strb r0, [r5, 0x8]
b _08019922
_080196E2:
movs r0, 0x1D
strb r0, [r5, 0x8]
b _08019922
_080196E8:
movs r0, 0x16
strb r0, [r5, 0x8]
b _08019922
_080196EE:
ldrb r0, [r5, 0xC]
cmp r0, 0x1
bne _080196F8
bl sub_801CC80
_080196F8:
movs r0, 0x14
strb r0, [r5, 0x8]
b _08019922
_080196FE:
adds r0, r5, 0
adds r0, 0x9
ldrb r2, [r5, 0xC]
adds r1, r5, 0
bl sub_8018E50
adds r1, r0, 0
cmp r1, 0
beq _0801971A
cmp r1, 0
ble _08019748
cmp r1, 0x1
beq _0801975E
b _08019922
_0801971A:
ldrb r0, [r5, 0xC]
cmp r0, 0
bne _08019758
bl sub_801B3F8
cmp r0, 0x1
bne _08019758
movs r0, 0x17
strb r0, [r5, 0x8]
b _08019922
_0801972E:
adds r0, r5, 0
adds r0, 0x9
ldr r3, =gText_HaventReceivedGiftOkayToDiscard
adds r1, r5, 0
movs r2, 0x1
bl sub_8018B08
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0x1
beq _0801975E
cmp r1, 0x1
bcc _08019758
_08019748:
movs r0, 0x1
negs r0, r0
cmp r1, r0
beq _0801975E
b _08019922
.pool
_08019758:
movs r0, 0x18
strb r0, [r5, 0x8]
b _08019922
_0801975E:
movs r0, 0x15
strb r0, [r5, 0x8]
b _08019922
_08019764:
ldrb r0, [r5, 0xC]
movs r1, 0x1
bl sub_8018E20
cmp r0, 0
bne _08019772
b _08019922
_08019772:
ldrb r0, [r5, 0xC]
bl sub_8018E08
movs r0, 0x19
strb r0, [r5, 0x8]
b _08019922
_0801977E:
adds r0, r5, 0
adds r0, 0x9
bl mevent_save_game
cmp r0, 0
bne _0801978C
b _08019922
_0801978C:
movs r0, 0x1A
strb r0, [r5, 0x8]
b _08019922
_08019792:
adds r0, r5, 0
adds r0, 0x9
ldrb r1, [r5, 0xC]
bl mevent_message_was_thrown_away
b _080198F6
_0801979E:
ldrb r0, [r5, 0xC]
movs r1, 0
bl sub_8018E20
cmp r0, 0
bne _080197AC
b _08019922
_080197AC:
movs r0, 0
strb r0, [r5, 0x8]
b _08019922
_080197B2:
ldrb r0, [r5, 0xC]
movs r1, 0x1
bl sub_8018E20
cmp r0, 0
bne _080197C0
b _08019922
_080197C0:
movs r0, 0x3
strb r0, [r5, 0x8]
b _08019922
_080197C6:
ldrb r0, [r5, 0xC]
movs r1, 0x1
bl sub_8018E20
cmp r0, 0
bne _080197D4
b _08019922
_080197D4:
ldrb r0, [r5, 0xC]
cmp r0, 0
beq _080197E0
cmp r0, 0x1
beq _080197E8
b _080197EE
_080197E0:
movs r0, 0x15
bl sub_8014A00
b _080197EE
_080197E8:
movs r0, 0x16
bl sub_8014A00
_080197EE:
movs r0, 0x1
strb r0, [r5, 0xD]
movs r0, 0x1E
strb r0, [r5, 0x8]
b _08019922
_080197F8:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
beq _08019810
movs r0, 0x1
bl sub_8018838
movs r0, 0x1F
strb r0, [r5, 0x8]
b _08019922
.pool
_08019810:
ldr r0, =gSpecialVar_Result
ldrh r0, [r0]
cmp r0, 0x5
beq _0801981A
b _08019922
_0801981A:
movs r0, 0x1
bl sub_8018838
_08019820:
movs r0, 0x12
strb r0, [r5, 0x8]
b _08019922
.pool
_0801982C:
ldr r0, =gStringVar1
movs r1, 0xFF
strb r1, [r0]
ldr r0, =gStringVar2
strb r1, [r0]
ldr r0, =gStringVar3
strb r1, [r0]
ldrb r0, [r5, 0xC]
cmp r0, 0
bne _0801985C
ldr r0, =gText_SendingWonderCard
bl sub_8018884
bl mevent_srv_new_wcard
b _08019866
.pool
_0801985C:
ldr r0, =gText_SendingWonderNews
bl sub_8018884
bl mevent_srv_init_wnews
_08019866:
movs r0, 0x20
strb r0, [r5, 0x8]
b _08019922
.pool
_08019870:
adds r0, r5, 0
bl sub_801D0C4
cmp r0, 0x3
bne _08019922
ldrh r0, [r5]
strb r0, [r5, 0xE]
movs r0, 0x21
strb r0, [r5, 0x8]
b _08019922
_08019884:
bl task_add_05_task_del_08FA224_when_no_RfuFunc
ldr r0, =gStringVar1
ldr r1, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name
bl StringCopy
movs r0, 0x22
strb r0, [r5, 0x8]
b _08019922
.pool
_080198A0:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
bne _08019922
bl sub_800E084
movs r0, 0x23
strb r0, [r5, 0x8]
b _08019922
.pool
_080198B8:
adds r0, r5, 0
adds r0, 0x9
ldrb r2, [r5, 0xD]
ldrb r3, [r5, 0xE]
adds r1, r5, 0
bl sub_8019174
cmp r0, 0
beq _08019922
ldr r0, [r5, 0xC]
ldr r1, =0x00ffff00
ands r0, r1
ldr r1, =0x00030100
cmp r0, r1
bne _080198FA
movs r0, 0x3
bl sub_801DB68
_080198DC:
movs r0, 0x11
strb r0, [r5, 0x8]
b _08019922
.pool
_080198EC:
adds r0, r5, 0
adds r0, 0x9
ldr r1, =gText_CommunicationError
bl mevent_0814257C
_080198F6:
cmp r0, 0
beq _08019922
_080198FA:
movs r0, 0
strb r0, [r5, 0x8]
_080198FE:
movs r1, 0
bl sub_80186EC
b _08019922
.pool
_0801990C:
bl CloseLink
ldr r0, [r5, 0x10]
bl Free
adds r0, r4, 0
bl DestroyTask
ldr r0, =sub_80186A4
bl SetMainCallback2
_08019922:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end task00_mystery_gift
thumb_func_start sub_8019930
sub_8019930: @ 8019930
ldr r0, =0x000001a9

View File

@ -9,5 +9,8 @@ s32 sub_801BDA4(bool32 flag);
void sub_801BB48(void);
s32 sub_801CA50(bool32 flag);
void sub_801C72C(void);
u32 sub_801CCD0(u16 input);
void sub_801CC80(void);
void sub_801CC38(void);
#endif //GUARD_MEVENT_801BAAC_H

View File

@ -2,5 +2,6 @@
#define GUARD_MEVENT_NEWS_H
void sub_801DBC0(void);
void sub_801DB68(u32 a0);
#endif //GUARD_MEVENT_NEWS_H

8
include/mevent_server.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef GUARD_MEVENT_SERVER_H
#define GUARD_MEVENT_SERVER_H
void mevent_srv_new_wcard();
void mevent_srv_init_wnews();
u32 sub_801D0C4(u16 * a0);
#endif //GUARD_MEVENT_SERVER_H

View File

@ -0,0 +1,10 @@
#ifndef GUARD_MEVENT_SERVER_ISH_H
#define GUARD_MEVENT_SERVER_ISH_H
void sub_801D484(u32 arg);
u32 sub_801D4A8(u16 * a0);
void sub_801D4E4(void);
void * sub_801D4F4(void);
void sub_801D500(u32 a0);
#endif //GUARD_MEVENT_SERVER_ISH_H

View File

@ -2661,5 +2661,16 @@ extern const u8 gText_NoMoreRoomForStamps[];
extern const u8 gText_OtherTrainerCanceled[];
extern const u8 gText_GiftSentTo[];
extern const u8 gText_CantSendGiftToTrainer[];
extern const u8 gText_DontHaveCardNewOneInput[];
extern const u8 gText_DontHaveNewsNewOneInput[];
extern const u8 gText_WhereShouldCardBeAccessed[];
extern const u8 gText_WhereShouldNewsBeAccessed[];
extern const u8 gText_Communicating[];
extern const u8 gText_ThrowAwayWonderCard[];
extern const u8 gText_HaventReceivedCardsGift[];
extern const u8 gText_CommunicationCompleted[];
extern const u8 gText_HaventReceivedGiftOkayToDiscard[];
extern const u8 gText_SendingWonderCard[];
extern const u8 gText_SendingWonderNews[];
#endif // GUARD_STRINGS_H

View File

@ -169,6 +169,9 @@ void var_800D_set_xB(void);
bool32 mevent_0814257C(u8 *textState, const u8 *str);
void sub_8018884(const u8 *src);
void sub_80186A4(void);
void sub_8014EFC(u32 arg0);
void sub_80152A8(u32 arg0);
void sub_8014A00(u32 arg0);
extern bool8 gUnknown_02022C60;

View File

@ -724,7 +724,7 @@ void sub_801CC80(void)
}
}
u8 sub_801CCD0(u16 input)
u32 sub_801CCD0(u16 input)
{
if (gUnknown_02022C78->unk_01C2_0)
{

View File

@ -24,6 +24,12 @@
#include "mevent.h"
#include "mevent_801BAAC.h"
#include "save.h"
#include "link.h"
#include "mevent_server_ish.h"
#include "event_data.h"
#include "link_rfu.h"
#include "mevent_news.h"
#include "mevent_server.h"
void bgid_upload_textbox_1(u8 bgId);
void task_add_00_mystery_gift(void);
@ -34,11 +40,6 @@ EWRAM_DATA u8 gUnknown_02022C58[2] = {};
const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal");
const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz");
struct MysteryGiftExtraData
{
u8 filler_00[0x40];
};
struct MysteryGiftTaskData
{
u16 unk0;
@ -52,7 +53,7 @@ struct MysteryGiftTaskData
u8 unkC;
u8 unkD;
u8 unkE;
struct MysteryGiftExtraData * unk10;
u8 * unk10;
};
const struct BgTemplate gUnknown_082F0598[] = {
@ -623,7 +624,7 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str)
}
}
s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2)
u32 sub_8018A50(u8 * unused0, u16 * unused1, bool8 r2)
{
struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638;
struct WindowTemplate windowTemplate = gUnknown_082F05E0;
@ -661,7 +662,7 @@ s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2)
return r4;
}
s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str)
s8 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str)
{
struct WindowTemplate windowTemplate;
s8 input;
@ -886,7 +887,7 @@ bool32 sub_8018E20(bool32 arg0, bool32 arg1)
}
}
s8 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2)
s32 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2)
{
if (r2 == 0)
{
@ -1128,5 +1129,564 @@ void task_add_00_mystery_gift(void)
data->unk4 = 0;
data->unk6 = 0;
data->unkE = 0;
data->unk10 = AllocZeroed(sizeof(*data->unk10));
data->unk10 = AllocZeroed(0x40);
}
void task00_mystery_gift(u8 taskId)
{
struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data;
u32 sp0;
const u8 * r1;
switch (data->unk8)
{
case 0:
data->unk8 = 1;
break;
case 1:
switch (sub_8018A50(&data->unk9, &data->unk0, FALSE))
{
case 0:
data->unkC = 0;
if (sub_801B27C() == TRUE)
{
data->unk8 = 18;
}
else
{
data->unk8 = 2;
}
break;
case 1:
data->unkC = 1;
if (sub_801B0CC() == TRUE)
{
data->unk8 = 18;
}
else
{
data->unk8 = 2;
}
break;
case -2u:
data->unk8 = 37;
break;
}
break;
case 2:
{
if (data->unkC == 0)
{
if (mevent_0814257C(&data->unk9, gText_DontHaveCardNewOneInput))
{
data->unk8 = 3;
sub_80186EC(0, 1);
}
}
else
{
if (mevent_0814257C(&data->unk9, gText_DontHaveNewsNewOneInput))
{
data->unk8 = 3;
sub_80186EC(0, 1);
}
}
break;
}
case 3:
if (data->unkC == 0)
{
sub_8018884(gText_WhereShouldCardBeAccessed);
}
else
{
sub_8018884(gText_WhereShouldNewsBeAccessed);
}
data->unk8 = 4;
break;
case 4:
switch (sub_8018A50(&data->unk9, &data->unk0, TRUE))
{
case 0:
sub_80188DC();
data->unk8 = 5;
data->unkD = 0;
break;
case 1:
sub_80188DC();
data->unk8 = 5;
data->unkD = 1;
break;
case -2u:
sub_80188DC();
if (sub_8018D98(data->unkC))
{
data->unk8 = 18;
}
else
{
data->unk8 = 0;
sub_80186EC(0, 0);
}
break;
}
break;
case 5:
{
register u8 eos asm("r1");
gStringVar1[0] = (eos = EOS);
gStringVar2[0] = eos;
gStringVar3[0] = eos;
}
switch (data->unkC)
{
case 0:
if (data->unkD == 1)
{
sub_8014EFC(0x15);
}
else if (data->unkD == 0)
{
sub_80152A8(0x15);
}
break;
case 1:
if (data->unkD == 1)
{
sub_8014EFC(0x16);
}
else if (data->unkD == 0)
{
sub_80152A8(0x16);
}
break;
}
data->unk8 = 6;
break;
case 6:
if (gReceivedRemoteLinkPlayers != 0)
{
sub_8018838(TRUE);
data->unk8 = 7;
sub_801D484(data->unkC);
}
else if (gSpecialVar_Result == 5)
{
sub_8018838(TRUE);
data->unk8 = 3;
}
break;
case 7:
sub_8018884(gText_Communicating);
data->unk8 = 8;
break;
case 8:
switch (sub_801D4A8(&data->unk0))
{
case 6:
task_add_05_task_del_08FA224_when_no_RfuFunc();
data->unkE = data->unk0;
data->unk8 = 13;
break;
case 5:
memcpy(data->unk10, sub_801D4F4(), 0x40);
sub_801D4E4();
break;
case 3:
data->unk8 = 10;
break;
case 2:
data->unk8 = 9;
break;
case 4:
data->unk8 = 11;
StringCopy(gStringVar1, gLinkPlayers[0].name);
break;
}
break;
case 9:
switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, sub_801D4F4()))
{
case 0:
sub_801D500(0);
sub_801D4E4();
data->unk8 = 7;
break;
case 1:
sub_801D500(1);
sub_801D4E4();
data->unk8 = 7;
break;
case -1u:
sub_801D500(1);
sub_801D4E4();
data->unk8 = 7;
break;
}
break;
case 10:
if (mevent_0814257C(&data->unk9, sub_801D4F4()))
{
sub_801D4E4();
data->unk8 = 7;
}
break;
case 11:
switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_ThrowAwayWonderCard))
{
case 0:
if (sub_801B3F8() == TRUE)
{
data->unk8 = 12;
}
else
{
sub_801D500(0);
sub_801D4E4();
data->unk8 = 7;
}
break;
case 1:
sub_801D500(1);
sub_801D4E4();
data->unk8 = 7;
break;
case -1u:
sub_801D500(1);
sub_801D4E4();
data->unk8 = 7;
break;
}
break;
case 12:
switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_HaventReceivedCardsGift))
{
case 0:
sub_801D500(0);
sub_801D4E4();
data->unk8 = 7;
break;
case 1:
sub_801D500(1);
sub_801D4E4();
data->unk8 = 7;
break;
case -1u:
sub_801D500(1);
sub_801D4E4();
data->unk8 = 7;
break;
}
break;
case 13:
if (gReceivedRemoteLinkPlayers == 0)
{
sub_800E084();
data->unk8 = 14;
}
break;
case 14:
if (sub_8018A1C(&data->unk9, gText_CommunicationCompleted))
{
if (data->unkD == 1)
{
StringCopy(gStringVar1, gLinkPlayers[0].name);
}
data->unk8 = 15;
}
break;
case 15:
{
register bool32 flag asm("r1");
r1 = mevent_message(&sp0, data->unkC, data->unkD, data->unkE);
if (r1 == NULL)
{
r1 = data->unk10;
}
if (sp0)
{
flag = mevent_08142CE8(&data->unk9, r1, &data->unk0);
}
else
{
flag = mevent_0814257C(&data->unk9, r1);
}
if (flag)
{
if (data->unkE == 3)
{
if (data->unkD == 1)
{
sub_801DB68(1);
}
else
{
sub_801DB68(2);
}
}
if (sp0 == 0)
{
data->unk8 = 0;
sub_80186EC(0, 0);
}
else
{
data->unk8 = 17;
}
}
break;
}
case 16:
if (mevent_0814257C(&data->unk9, gText_CommunicationError))
{
data->unk8 = 0;
sub_80186EC(0, 0);
}
break;
case 17:
if (mevent_save_game(&data->unk9))
{
data->unk8 = 18;
}
break;
case 18:
if (sub_8018DAC(&data->unk9, data->unkC))
{
data->unk8 = 20;
}
break;
case 20:
if (data->unkC == 0)
{
if (({gMain.newKeys & A_BUTTON;}))
{
data->unk8 = 21;
}
if (({gMain.newKeys & B_BUTTON;}))
{
data->unk8 = 27;
}
}
else
{
switch (sub_801CCD0(gMain.newKeys))
{
case 0:
sub_801CC38();
data->unk8 = 21;
break;
case 1:
data->unk8 = 27;
break;
}
}
break;
case 21:
{
u32 result;
if (data->unkC == 0)
{
if (sub_801B308())
{
result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE);
}
else
{
result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE);
}
}
else
{
if (sub_801B128())
{
result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE);
}
else
{
result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE);
}
}
switch (result)
{
case 0:
data->unk8 = 28;
break;
case 1:
data->unk8 = 29;
break;
case 2:
data->unk8 = 22;
break;
case -2u:
if (data->unkC == 1)
{
sub_801CC80();
}
data->unk8 = 20;
break;
}
break;
}
case 22:
switch (sub_8018E50(&data->unk9, &data->unk0, data->unkC))
{
case 0:
if (data->unkC == 0 && sub_801B3F8() == TRUE)
{
data->unk8 = 23;
}
else
{
data->unk8 = 24;
}
break;
case 1:
data->unk8 = 21;
break;
case -1:
data->unk8 = 21;
break;
}
break;
case 23:
switch ((u32)sub_8018B08(&data->unk9, &data->unk0, TRUE, gText_HaventReceivedGiftOkayToDiscard))
{
case 0:
data->unk8 = 24;
break;
case 1:
data->unk8 = 21;
break;
case -1u:
data->unk8 = 21;
break;
}
break;
case 24:
if (sub_8018E20(data->unkC, 1))
{
sub_8018E08(data->unkC);
data->unk8 = 25;
}
break;
case 25:
if (mevent_save_game(&data->unk9))
{
data->unk8 = 26;
}
break;
case 26:
if (mevent_message_was_thrown_away(&data->unk9, data->unkC))
{
data->unk8 = 0;
sub_80186EC(0, 0);
}
break;
case 27:
if (sub_8018E20(data->unkC, 0))
{
data->unk8 = 0;
}
break;
case 28:
if (sub_8018E20(data->unkC, 1))
{
data->unk8 = 3;
}
break;
case 29:
if (sub_8018E20(data->unkC, 1))
{
switch (data->unkC)
{
case 0:
sub_8014A00(21);
break;
case 1:
sub_8014A00(22);
break;
}
data->unkD = 1;
data->unk8 = 30;
}
break;
case 30:
if (gReceivedRemoteLinkPlayers != 0)
{
sub_8018838(1);
data->unk8 = 31;
}
else if (gSpecialVar_Result == 5)
{
sub_8018838(1);
data->unk8 = 18;
}
break;
case 31:
{
register u8 eos asm("r1");
gStringVar1[0] = (eos = EOS);
gStringVar2[0] = eos;
gStringVar3[0] = eos;
}
if (data->unkC == 0)
{
sub_8018884(gText_SendingWonderCard);
mevent_srv_new_wcard();
}
else
{
sub_8018884(gText_SendingWonderNews);
mevent_srv_init_wnews();
}
data->unk8 = 32;
break;
case 32:
if (sub_801D0C4(&data->unk0) == 3)
{
data->unkE = data->unk0;
data->unk8 = 33;
}
break;
case 33:
task_add_05_task_del_08FA224_when_no_RfuFunc();
StringCopy(gStringVar1, gLinkPlayers[1].name);
data->unk8 = 34;
break;
case 34:
if (gReceivedRemoteLinkPlayers == 0)
{
sub_800E084();
data->unk8 = 35;
}
break;
case 35:
if (sub_8019174(&data->unk9, &data->unk0, data->unkD, data->unkE))
{
if (data->unkD == 1 && data->unkE == 3)
{
sub_801DB68(3);
data->unk8 = 17;
}
else
{
data->unk8 = 0;
sub_80186EC(0, 0);
}
}
break;
case 36:
if (mevent_0814257C(&data->unk9, gText_CommunicationError))
{
data->unk8 = 0;
sub_80186EC(0, 0);
}
break;
case 37:
CloseLink();
Free(data->unk10);
DestroyTask(taskId);
SetMainCallback2(sub_80186A4);
break;
}
}