through task_add_00_mystery_gift

This commit is contained in:
PikalaxALT 2019-03-31 12:55:27 -04:00
parent 8799a1c791
commit 5b361db6b3
3 changed files with 153 additions and 217 deletions

View File

@ -5,223 +5,6 @@
.text .text
thumb_func_start mevent_08142CE8
mevent_08142CE8: @ 801903C
push {r4-r6,lr}
adds r6, r0, 0
adds r0, r1, 0
adds r5, r2, 0
ldrb r4, [r6]
cmp r4, 0x1
beq _0801906E
cmp r4, 0x1
bgt _08019054
cmp r4, 0
beq _0801905A
b _0801909A
_08019054:
cmp r4, 0x2
beq _08019084
b _0801909A
_0801905A:
cmp r0, 0
beq _08019062
bl sub_8018884
_08019062:
movs r0, 0xB9
lsls r0, 1
bl PlayFanfare
strh r4, [r5]
b _0801907C
_0801906E:
ldrh r0, [r5]
adds r0, 0x1
strh r0, [r5]
lsls r0, 16
lsrs r0, 16
cmp r0, 0xF0
bls _0801909A
_0801907C:
ldrb r0, [r6]
adds r0, 0x1
strb r0, [r6]
b _0801909A
_08019084:
bl IsFanfareTaskInactive
lsls r0, 24
cmp r0, 0
beq _0801909A
movs r0, 0
strb r0, [r6]
bl sub_80188DC
movs r0, 0x1
b _0801909C
_0801909A:
movs r0, 0
_0801909C:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end mevent_08142CE8
thumb_func_start mevent_message_stamp_card_etc_send_status
mevent_message_stamp_card_etc_send_status: @ 80190A4
push {r4,lr}
adds r3, r0, 0
ldr r1, =gText_CommunicationError
movs r0, 0
str r0, [r3]
adds r4, r1, 0
cmp r2, 0xE
bhi _08019166
lsls r0, r2, 2
ldr r1, =_080190C8
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080190C8:
.4byte _08019104
.4byte _0801910C
.4byte _08019114
.4byte _0801911C
.4byte _08019128
.4byte _08019130
.4byte _08019138
.4byte _08019140
.4byte _08019148
.4byte _08019150
.4byte _08019164
.4byte _08019158
.4byte _0801915C
.4byte _0801915C
.4byte _08019164
_08019104:
ldr r1, =gText_NothingSentOver
b _08019166
.pool
_0801910C:
ldr r1, =gText_RecordUploadedViaWireless
b _08019166
.pool
_08019114:
ldr r1, =gText_WonderCardSentTo
b _0801911E
.pool
_0801911C:
ldr r1, =gText_WonderNewsSentTo
_0801911E:
movs r0, 0x1
str r0, [r3]
b _08019166
.pool
_08019128:
ldr r1, =gText_StampSentTo
b _08019166
.pool
_08019130:
ldr r1, =gText_OtherTrainerHasCard
b _08019166
.pool
_08019138:
ldr r1, =gText_OtherTrainerHasStamp
b _08019166
.pool
_08019140:
ldr r1, =gText_OtherTrainerHasNews
b _08019166
.pool
_08019148:
ldr r1, =gText_NoMoreRoomForStamps
b _08019166
.pool
_08019150:
ldr r1, =gText_OtherTrainerCanceled
b _08019166
.pool
_08019158:
adds r1, r4, 0
b _08019166
_0801915C:
ldr r1, =gText_GiftSentTo
b _08019166
.pool
_08019164:
ldr r1, =gText_CantSendGiftToTrainer
_08019166:
adds r0, r1, 0
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end mevent_message_stamp_card_etc_send_status
thumb_func_start sub_8019174
sub_8019174: @ 8019174
push {r4,r5,lr}
sub sp, 0x4
adds r4, r0, 0
adds r5, r1, 0
adds r1, r2, 0
adds r2, r3, 0
lsls r1, 24
lsrs r1, 24
mov r0, sp
bl mevent_message_stamp_card_etc_send_status
adds r1, r0, 0
ldr r0, [sp]
cmp r0, 0
bne _0801919A
adds r0, r4, 0
bl mevent_0814257C
b _080191A2
_0801919A:
adds r0, r4, 0
adds r2, r5, 0
bl mevent_08142CE8
_080191A2:
add sp, 0x4
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8019174
thumb_func_start task_add_00_mystery_gift
task_add_00_mystery_gift: @ 80191AC
push {r4,lr}
ldr r0, =task00_mystery_gift
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
lsls r4, r0, 2
adds r4, r0
lsls r4, 3
ldr r0, =gTasks + 0x8
adds r4, r0
movs r0, 0
strb r0, [r4, 0x8]
strb r0, [r4, 0x9]
strb r0, [r4, 0xA]
strb r0, [r4, 0xB]
strb r0, [r4, 0xC]
strb r0, [r4, 0xD]
movs r1, 0
strh r0, [r4]
strh r0, [r4, 0x2]
strh r0, [r4, 0x4]
strh r0, [r4, 0x6]
strb r1, [r4, 0xE]
movs r0, 0x40
bl AllocZeroed
str r0, [r4, 0x10]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end task_add_00_mystery_gift
thumb_func_start task00_mystery_gift thumb_func_start task00_mystery_gift
task00_mystery_gift: @ 80191F4 task00_mystery_gift: @ 80191F4
push {r4,r5,lr} push {r4,r5,lr}

View File

@ -2650,5 +2650,16 @@ extern const u8 gText_CantAcceptNewsFromTrainer[];
extern const u8 gText_CantAcceptCardFromTrainer[]; extern const u8 gText_CantAcceptCardFromTrainer[];
extern const u8 gText_CommunicationError[]; extern const u8 gText_CommunicationError[];
extern const u8 gText_NewTrainerReceived[]; extern const u8 gText_NewTrainerReceived[];
extern const u8 gText_RecordUploadedViaWireless[];
extern const u8 gText_WonderCardSentTo[];
extern const u8 gText_WonderNewsSentTo[];
extern const u8 gText_StampSentTo[];
extern const u8 gText_OtherTrainerHasCard[];
extern const u8 gText_OtherTrainerHasStamp[];
extern const u8 gText_OtherTrainerHasNews[];
extern const u8 gText_NoMoreRoomForStamps[];
extern const u8 gText_OtherTrainerCanceled[];
extern const u8 gText_GiftSentTo[];
extern const u8 gText_CantSendGiftToTrainer[];
#endif // GUARD_STRINGS_H #endif // GUARD_STRINGS_H

View File

@ -27,12 +27,34 @@
void bgid_upload_textbox_1(u8 bgId); void bgid_upload_textbox_1(u8 bgId);
void task_add_00_mystery_gift(void); void task_add_00_mystery_gift(void);
void task00_mystery_gift(u8 taskId);
EWRAM_DATA u8 gUnknown_02022C58[2] = {}; EWRAM_DATA u8 gUnknown_02022C58[2] = {};
const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal");
const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz");
struct MysteryGiftExtraData
{
u8 filler_00[0x40];
};
struct MysteryGiftTaskData
{
u16 unk0;
u16 unk2;
u16 unk4;
u16 unk6;
u8 unk8;
u8 unk9;
u8 unkA;
u8 unkB;
u8 unkC;
u8 unkD;
u8 unkE;
struct MysteryGiftExtraData * unk10;
};
const struct BgTemplate gUnknown_082F0598[] = { const struct BgTemplate gUnknown_082F0598[] = {
{ {
.bg = 0, .bg = 0,
@ -988,3 +1010,123 @@ const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3)
return msg; return msg;
} }
bool32 mevent_08142CE8(u8 * state, const u8 * arg1, u16 * arg2)
{
switch (*state)
{
case 0:
if (arg1 != NULL)
{
sub_8018884(arg1);
}
PlayFanfare(MUS_FANFA4);
*arg2 = 0;
(*state)++;
break;
case 1:
if (++(*arg2) > 0xF0)
{
(*state)++;
}
break;
case 2:
if (IsFanfareTaskInactive())
{
*state = 0;
sub_80188DC();
return TRUE;
}
break;
}
return FALSE;
}
const u8 * mevent_message_stamp_card_etc_send_status(u32 * a0, u8 unused, u32 state)
{
const u8 * result = gText_CommunicationError;
*a0 = 0;
switch (state)
{
case 0:
result = gText_NothingSentOver;
break;
case 1:
result = gText_RecordUploadedViaWireless;
break;
case 2:
result = gText_WonderCardSentTo;
*a0 = 1;
break;
case 3:
result = gText_WonderNewsSentTo;
*a0 = 1;
break;
case 4:
result = gText_StampSentTo;
break;
case 5:
result = gText_OtherTrainerHasCard;
break;
case 6:
result = gText_OtherTrainerHasStamp;
break;
case 7:
result = gText_OtherTrainerHasNews;
break;
case 8:
result = gText_NoMoreRoomForStamps;
break;
case 9:
result = gText_OtherTrainerCanceled;
break;
case 10:
result = gText_CantSendGiftToTrainer;
break;
case 11:
result = gText_CommunicationError;
break;
case 12:
result = gText_GiftSentTo;
break;
case 13:
result = gText_GiftSentTo;
break;
case 14:
result = gText_CantSendGiftToTrainer;
break;
}
return result;
}
bool32 sub_8019174(u8 * state_p, u16 * arg1, u8 arg2, u32 state)
{
u32 flag;
const u8 * str = mevent_message_stamp_card_etc_send_status(&flag, arg2, state);
if (flag)
{
return mevent_08142CE8(state_p, str, arg1);
}
else
{
return mevent_0814257C(state_p, str);
}
}
void task_add_00_mystery_gift(void)
{
u8 taskId = CreateTask(task00_mystery_gift, 0);
struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data;
data->unk8 = 0;
data->unk9 = 0;
data->unkA = 0;
data->unkB = 0;
data->unkC = 0;
data->unkD = 0;
data->unk0 = 0;
data->unk2 = 0;
data->unk4 = 0;
data->unk6 = 0;
data->unkE = 0;
data->unk10 = AllocZeroed(sizeof(*data->unk10));
}