Through mevent_save_game

This commit is contained in:
PikalaxALT 2019-03-31 12:27:36 -04:00 committed by huderlem
parent f88f815cff
commit 813de11154
4 changed files with 120 additions and 201 deletions

View File

@ -5,199 +5,6 @@
.text
thumb_func_start sub_8018DAC
sub_8018DAC: @ 8018DAC
push {r4,r5,lr}
adds r5, r0, 0
ldrb r0, [r5]
cmp r0, 0
beq _08018DBC
cmp r0, 0x1
beq _08018DE4
b _08018E00
_08018DBC:
cmp r1, 0
bne _08018DD4
bl sav1_get_mevent_buffer_1
adds r4, r0, 0
bl sav1_get_mevent_buffer_2
adds r1, r0, 0
adds r0, r4, 0
bl sub_801BAAC
b _08018DDC
_08018DD4:
bl sub_801B00C
bl sub_801C6C8
_08018DDC:
ldrb r0, [r5]
adds r0, 0x1
strb r0, [r5]
b _08018E00
_08018DE4:
cmp r1, 0
bne _08018DF2
bl sub_801BB74
_08018DEC:
cmp r0, 0
bne _08018DF8
b _08018E00
_08018DF2:
bl sub_801C758
b _08018DEC
_08018DF8:
movs r0, 0
strb r0, [r5]
movs r0, 0x1
b _08018E02
_08018E00:
movs r0, 0
_08018E02:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8018DAC
thumb_func_start sub_8018E08
sub_8018E08: @ 8018E08
push {lr}
cmp r0, 0
bne _08018E14
bl sub_801B1E8
b _08018E18
_08018E14:
bl sub_801B06C
_08018E18:
movs r0, 0x1
pop {r1}
bx r1
thumb_func_end sub_8018E08
thumb_func_start sub_8018E20
sub_8018E20: @ 8018E20
push {lr}
cmp r0, 0
bne _08018E36
adds r0, r1, 0
bl sub_801BDA4
cmp r0, 0
beq _08018E40
bl sub_801BB48
b _08018E48
_08018E36:
adds r0, r1, 0
bl sub_801CA50
cmp r0, 0
bne _08018E44
_08018E40:
movs r0, 0
b _08018E4A
_08018E44:
bl sub_801C72C
_08018E48:
movs r0, 0x1
_08018E4A:
pop {r1}
bx r1
thumb_func_end sub_8018E20
thumb_func_start sub_8018E50
sub_8018E50: @ 8018E50
push {lr}
cmp r2, 0
beq _08018E60
ldr r3, =gText_OkayToDiscardNews
b _08018E62
.pool
_08018E60:
ldr r3, =gText_IfThrowAwayCardEventWontHappen
_08018E62:
movs r2, 0x1
bl sub_8018B08
lsls r0, 24
asrs r0, 24
pop {r1}
bx r1
.pool
thumb_func_end sub_8018E50
thumb_func_start mevent_message_was_thrown_away
mevent_message_was_thrown_away: @ 8018E74
push {lr}
cmp r1, 0
beq _08018E84
ldr r1, =gText_WonderNewsThrownAway
b _08018E86
.pool
_08018E84:
ldr r1, =gText_WonderCardThrownAway
_08018E86:
bl mevent_0814257C
pop {r1}
bx r1
.pool
thumb_func_end mevent_message_was_thrown_away
thumb_func_start mevent_save_game
mevent_save_game: @ 8018E94
push {r4,lr}
adds r4, r0, 0
ldrb r0, [r4]
cmp r0, 0x4
bhi _08018F04
lsls r0, 2
ldr r1, =_08018EAC
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08018EAC:
.4byte _08018EC0
.4byte _08018ECC
.4byte _08018ED4
.4byte _08018EE0
.4byte _08018EF8
_08018EC0:
ldr r0, =gText_DataWillBeSaved
bl sub_8018884
b _08018EEC
.pool
_08018ECC:
movs r0, 0
bl TrySavingData
b _08018EEC
_08018ED4:
ldr r0, =gText_SaveCompletedPressA
bl sub_8018884
b _08018EEC
.pool
_08018EE0:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x3
ands r0, r1
cmp r0, 0
beq _08018F04
_08018EEC:
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
b _08018F04
.pool
_08018EF8:
movs r0, 0
strb r0, [r4]
bl sub_80188DC
movs r0, 0x1
b _08018F06
_08018F04:
movs r0, 0
_08018F06:
pop {r4}
pop {r1}
bx r1
thumb_func_end mevent_save_game
thumb_func_start mevent_message
mevent_message: @ 8018F0C
push {r4-r6,lr}

View File

@ -5,5 +5,9 @@ bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_S
bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0);
s32 sub_801BB74(void);
s32 sub_801C758(void);
s32 sub_801BDA4(bool32 flag);
void sub_801BB48(void);
s32 sub_801CA50(bool32 flag);
void sub_801C72C(void);
#endif //GUARD_MEVENT_801BAAC_H

View File

@ -2628,5 +2628,11 @@ extern const u8 gText_ReadNewsThatArrived[];
extern const u8 gText_ReturnToTitle[];
extern const u8 gText_WhatToDoWithCards[];
extern const u8 gText_WhatToDoWithNews[];
extern const u8 gText_IfThrowAwayCardEventWontHappen[];
extern const u8 gText_OkayToDiscardNews[];
extern const u8 gText_WonderNewsThrownAway[];
extern const u8 gText_WonderCardThrownAway[];
extern const u8 gText_DataWillBeSaved[];
extern const u8 gText_SaveCompletedPressA[];
#endif // GUARD_STRINGS_H

View File

@ -23,6 +23,7 @@
#include "string_util.h"
#include "mevent.h"
#include "mevent_801BAAC.h"
#include "save.h"
void bgid_upload_textbox_1(u8 bgId);
void task_add_00_mystery_gift(void);
@ -781,8 +782,10 @@ s32 sub_8018D98(bool32 a0)
}
}
/*bool32 sub_8018DAC(u8 * state, bool32 arg1)
bool32 sub_8018DAC(u8 * state, bool32 arg1)
{
s32 v0;
switch (*state)
{
case 0:
@ -795,24 +798,123 @@ s32 sub_8018D98(bool32 a0)
sub_801C6C8(sub_801B00C());
}
(*state)++;
break;
case 1:
if (arg1 == 0)
{
if (sub_801BB74() == 0)
v0 = sub_801BB74();
check:
if (v0 != 0)
{
break;
goto done;
}
break;
}
else
{
if (sub_801C758() == 0)
{
break;
}
v0 = sub_801C758();
goto check;
}
done:
*state = 0;
return TRUE;
}
return FALSE;
}*/
}
bool32 sub_8018E08(bool32 arg0)
{
if (arg0 == 0)
{
sub_801B1E8();
}
else
{
sub_801B06C();
}
return TRUE;
}
bool32 sub_8018E20(bool32 arg0, bool32 arg1)
{
if (arg0 == 0)
{
if (sub_801BDA4(arg1) != 0)
{
sub_801BB48();
return TRUE;
}
else
{
return FALSE;
}
}
else
{
if (sub_801CA50(arg1) != 0)
{
sub_801C72C();
return TRUE;
}
else
{
return FALSE;
}
}
}
s8 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2)
{
if (r2 == 0)
{
return sub_8018B08(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen);
}
else
{
return sub_8018B08(textState, windowId, TRUE, gText_OkayToDiscardNews);
}
}
bool32 mevent_message_was_thrown_away(u8 * textState, bool32 r1)
{
if (r1 == 0)
{
return mevent_0814257C(textState, gText_WonderCardThrownAway);
}
else
{
return mevent_0814257C(textState, gText_WonderNewsThrownAway);
}
}
bool32 mevent_save_game(u8 * state)
{
switch (*state)
{
case 0:
sub_8018884(gText_DataWillBeSaved);
(*state)++;
break;
case 1:
TrySavingData(0);
(*state)++;
break;
case 2:
sub_8018884(gText_SaveCompletedPressA);
(*state)++;
break;
case 3:
if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
{
(*state)++;
}
break;
case 4:
*state = 0;
sub_80188DC();
return TRUE;
}
return FALSE;
}