through sub_80E909C

This commit is contained in:
PikalaxALT 2017-10-24 21:27:46 -04:00
parent 6558af388b
commit 0b0926f127
4 changed files with 50 additions and 110 deletions

View File

@ -5,116 +5,6 @@
.text
thumb_func_start sub_80E8FD0
sub_80E8FD0: @ 80E8FD0
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r2, r0, r1
movs r1, 0x8
ldrsh r0, [r2, r1]
cmp r0, 0
beq _080E8FF4
cmp r0, 0x1
beq _080E900C
b _080E904A
.pool
_080E8FF4:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _080E904A
movs r0, 0x1
strh r0, [r2, 0x8]
b _080E904A
.pool
_080E900C:
ldr r0, =0x00004054
bl VarGet
lsls r0, 16
lsrs r0, 16
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
lsls r1, r0, 2
adds r1, r0
lsls r1, 5
adds r2, r1
ldr r0, =0x00001aac
adds r2, r0
ldrb r0, [r2]
cmp r0, 0xFE
bhi _080E9030
adds r0, 0x1
strb r0, [r2]
_080E9030:
bl sub_80E8F9C
bl warp_in
ldr r0, =gFieldCallback
ldr r1, =sub_80AF168
str r1, [r0]
ldr r0, =c2_load_new_map
bl SetMainCallback2
adds r0, r4, 0
bl DestroyTask
_080E904A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E8FD0
thumb_func_start sub_80E9068
sub_80E9068: @ 80E9068
push {lr}
ldr r0, =sub_80E8FD0
movs r1, 0
bl CreateTask
movs r0, 0x1
movs r1, 0
bl fade_screen
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
movs r1, 0x4
ldrsb r1, [r0, r1]
movs r2, 0x5
ldrsb r2, [r0, r2]
movs r3, 0x1
negs r3, r3
movs r0, 0
bl saved_warp2_set
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9068
thumb_func_start sub_80E909C
sub_80E909C: @ 80E909C
push {lr}
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x9
bne _080E90C0
ldr r0, =0x00004097
bl VarGet
lsls r0, 16
cmp r0, 0
bne _080E90C0
movs r0, 0
b _080E90C2
.pool
_080E90C0:
movs r0, 0x1
_080E90C2:
pop {r1}
bx r1
thumb_func_end sub_80E909C
thumb_func_start sub_80E90C8
sub_80E90C8: @ 80E90C8
push {r4,lr}

View File

@ -8,5 +8,6 @@
// Exported ROM declarations
void pal_fill_black(void);
bool8 sub_80ABDFC(void);
void sub_80AF168(void);
#endif //GUARD_FIELD_SCREEN_H

View File

@ -32,6 +32,7 @@ void Overworld_SetMapObjTemplateMovementType(u8, u8);
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void saved_warp2_set(int unused, s8 mapGroup, s8 mapNum, s8 warpId);
void saved_warp2_set_2(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void Overworld_SetHealLocationWarp(u8);
void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
@ -60,5 +61,6 @@ bool32 sub_8087598(void);
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);
#endif //GUARD_ROM4_H

View File

@ -1,6 +1,8 @@
// Includes
#include "global.h"
#include "task.h"
#include "palette.h"
#include "list_menu.h"
#include "map_constants.h"
#include "decoration.h"
@ -9,6 +11,8 @@
#include "fieldmap.h"
#include "field_camera.h"
#include "field_player_avatar.h"
#include "field_screen.h"
#include "field_weather.h"
#include "text.h"
#include "string_util.h"
#include "event_data.h"
@ -256,3 +260,46 @@ void sub_80E8F9C(void)
idx = sCurSecretBaseId / 10 * 4;
warp1_set_2(MAP_GROUP_SECRET_BASE_RED_CAVE1, gUnknown_0858CFE8[idx], gUnknown_0858CFE8[idx + 1]);
}
void sub_80E8FD0(u8 taskId)
{
u16 sbrId;
switch (gTasks[taskId].data[0])
{
case 0:
if (!gPaletteFade.active)
{
gTasks[taskId].data[0] = 1;
}
break;
case 1:
sbrId = VarGet(VAR_0x4054);
if (gSaveBlock1Ptr->secretBases[sbrId].sbr_field_10 < 255)
{
gSaveBlock1Ptr->secretBases[sbrId].sbr_field_10 ++;
}
sub_80E8F9C();
warp_in();
gFieldCallback = sub_80AF168;
SetMainCallback2(c2_load_new_map);
DestroyTask(taskId);
break;
}
}
void sub_80E9068(void)
{
CreateTask(sub_80E8FD0, 0);
fade_screen(1, 0);
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
}
bool8 sub_80E909C(void)
{
if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_0x4097) == 0)
{
return FALSE;
}
return TRUE;
}