sub_80E9744

This commit is contained in:
PikalaxALT 2017-10-25 08:34:41 -04:00
parent 835a04ada8
commit b4f9acd039
3 changed files with 56 additions and 118 deletions

View File

@ -5,124 +5,6 @@
.text
thumb_func_start sub_80E9680
sub_80E9680: @ 80E9680
push {lr}
bl sub_80E8B58
bl sub_80E8B6C
ldr r0, =gScriptResult
ldrh r0, [r0]
cmp r0, 0x1
beq _080E969C
movs r0, 0x1
b _080E969E
.pool
_080E969C:
movs r0, 0
_080E969E:
pop {r1}
bx r1
thumb_func_end sub_80E9680
thumb_func_start sub_80E96A4
sub_80E96A4: @ 80E96A4
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r4, r0, r1
movs r1, 0x8
ldrsh r0, [r4, r1]
cmp r0, 0x1
beq _080E96DC
cmp r0, 0x1
bgt _080E96CC
cmp r0, 0
beq _080E96D2
b _080E9714
.pool
_080E96CC:
cmp r0, 0x2
beq _080E96F4
b _080E9714
_080E96D2:
bl ScriptContext2_Enable
movs r0, 0x1
strh r0, [r4, 0x8]
b _080E9714
_080E96DC:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _080E9714
movs r0, 0x2
strh r0, [r4, 0x8]
b _080E9714
.pool
_080E96F4:
movs r0, 0x7E
bl copy_saved_warp2_bank_and_enter_x_to_warp1
bl warp_in
ldr r0, =gFieldCallback
ldr r1, =mapldr_default
str r1, [r0]
ldr r0, =c2_load_new_map
bl SetMainCallback2
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080E9714:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E96A4
thumb_func_start sub_80E9728
sub_80E9728: @ 80E9728
push {lr}
ldr r0, =sub_80E96A4
movs r1, 0
bl CreateTask
movs r0, 0x1
movs r1, 0
bl fade_screen
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9728
thumb_func_start sub_80E9744
sub_80E9744: @ 80E9744
push {lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x00001a9c
adds r0, r1
ldr r1, =sCurSecretBaseId
ldrb r0, [r0]
ldrb r1, [r1]
cmp r0, r1
beq _080E9770
ldr r1, =gScriptResult
movs r0, 0x1
b _080E9774
.pool
_080E9770:
ldr r1, =gScriptResult
movs r0, 0
_080E9774:
strh r0, [r1]
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9744
thumb_func_start sub_80E9780
sub_80E9780: @ 80E9780
push {r4-r6,lr}

View File

@ -62,5 +62,7 @@ void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
void warp_in(void);
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpNum);
void c2_load_new_map(void);
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused);
void mapldr_default(void);
#endif //GUARD_ROM4_H

View File

@ -516,3 +516,57 @@ void sub_80E9668(struct Coords16 *coords, struct MapEvents *events)
sub_80E8B6C();
ScriptContext1_SetupScript(gUnknown_08275BB7);
}
bool8 sub_80E9680(void)
{
sub_80E8B58();
sub_80E8B6C();
if (gScriptResult == TRUE)
{
return FALSE;
}
return TRUE;
}
void sub_80E96A4(u8 taskId)
{
switch (gTasks[taskId].data[0])
{
case 0:
ScriptContext2_Enable();
gTasks[taskId].data[0] = 1;
break;
case 1:
if (!gPaletteFade.active)
{
gTasks[taskId].data[0] = 2;
}
break;
case 2:
copy_saved_warp2_bank_and_enter_x_to_warp1(0x7e);
warp_in();
gFieldCallback = mapldr_default;
SetMainCallback2(c2_load_new_map);
ScriptContext2_Disable();
DestroyTask(taskId);
break;
}
}
void sub_80E9728(void)
{
CreateTask(sub_80E96A4, 0);
fade_screen(1, 0);
}
void sub_80E9744(void)
{
if (gSaveBlock1Ptr->secretBases[0].secretBaseId != sCurSecretBaseId)
{
gScriptResult = TRUE;
}
else
{
gScriptResult = FALSE;
}
}