unref_sub_808D77C

This commit is contained in:
scnorton 2017-09-06 16:14:55 -04:00
parent 9498dfa71c
commit 6448563ede
29 changed files with 202 additions and 224 deletions

View File

@ -678,7 +678,7 @@ _080B0C16:
lsls r0, 24
cmp r0, 0
bne _080B0D18
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
subs r0, 0x1
cmp r0, 0x8
@ -830,7 +830,7 @@ _080B0D54:
lsls r0, 24
cmp r0, 0
bne _080B0D7C
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x4
beq _080B0D78

View File

@ -1775,7 +1775,7 @@ sub_8119EF0: @ 8119EF0
lsls r0, 24
cmp r0, 0
bne _08119F08
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x8
bne _08119F10
@ -2173,7 +2173,7 @@ IsRunningDisallowed: @ 811A1DC
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x1A]
movs r0, 0x4
ands r0, r1

View File

@ -2472,7 +2472,7 @@ sub_8127E18: @ 8127E18
push {r5-r7}
sub sp, 0x4
movs r6, 0
ldr r7, =gUnknown_02037318
ldr r7, =gMapHeader
ldr r0, =gSpecialVar_0x8005
mov r8, r0
ldr r1, =gSpecialVar_0x8006
@ -2500,7 +2500,7 @@ _08127E34:
ldrh r0, [r0, 0x14]
cmp r0, r5
beq _08127E82
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0, 0x4]
ldrb r6, [r3]
adds r4, r5, 0
@ -3938,7 +3938,7 @@ _08128A64:
ldrh r1, [r0, 0x22]
adds r1, 0x2
strh r1, [r0, 0x22]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
cmp r0, 0x56
bne _08128A84
@ -4282,7 +4282,7 @@ _08128D48:
movs r0, 0x2
ldrsh r1, [r2, r0]
subs r1, 0x7
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x4]
cmp r1, r0
@ -4316,7 +4316,7 @@ _08128D82:
ldrsh r0, [r2, r4]
adds r1, r0
subs r1, 0x8
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0]
cmp r1, r0
@ -5559,7 +5559,7 @@ _08129744:
ldrb r0, [r4]
bl sub_81296EC
movs r1, 0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
ldrb r2, [r0]
cmp r1, r2
@ -5591,7 +5591,7 @@ _08129796:
sub_81297AC: @ 81297AC
push {r4-r6,lr}
movs r2, 0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
ldrb r1, [r0]
cmp r2, r1
@ -5684,7 +5684,7 @@ _08129846:
_0812985E:
adds r0, r4, 0x7
add r0, r8
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldr r3, [r1]
ldr r1, [sp]
subs r2, r1, r6
@ -5817,7 +5817,7 @@ _08129968:
adds r0, r5, 0
adds r1, r4, 0
bl DisplayItemMessageOnField
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
cmp r0, 0x56
bne _08129994

View File

@ -135,7 +135,7 @@ DrawWholeMapView: @ 8089C34
ldrsh r0, [r1, r2]
movs r2, 0x2
ldrsh r1, [r1, r2]
ldr r2, =gUnknown_02037318
ldr r2, =gMapHeader
ldr r2, [r2]
bl DrawWholeMapViewInternal
ldr r1, =gUnknown_03000E20
@ -225,7 +225,7 @@ RedrawMapSlicesForCameraUpdate: @ 8089CE4
adds r5, r0, 0
adds r6, r1, 0
adds r7, r2, 0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r4, [r0]
cmp r6, 0
ble _08089CFC
@ -476,7 +476,7 @@ CurrentMapDrawMetatileAt: @ 8089EA0
adds r1, r0, 0
cmp r1, 0
blt _08089ECC
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
lsls r1, 16
lsrs r1, 16

View File

@ -704,7 +704,7 @@ TryGetInvisibleMapObjectScript: @ 809C458
push {r4,r5,lr}
lsls r2, 24
lsrs r5, r2, 24
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrh r1, [r0]
subs r1, 0x7
lsls r1, 16
@ -1194,7 +1194,7 @@ sub_809C89C: @ 809C89C
lsls r0, 24
cmp r0, 0
beq _0809C8D4
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x5
bne _0809C8D4
@ -1264,7 +1264,7 @@ _0809C930:
thumb_func_start mapheader_trigger_activate_at__run_now
mapheader_trigger_activate_at__run_now: @ 809C938
push {r4,lr}
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrh r1, [r0]
subs r1, 0x7
lsls r1, 16
@ -1545,7 +1545,7 @@ overworld_poison_timer_set: @ 809CB80
thumb_func_start overworld_poison_step
overworld_poison_step: @ 809CB94
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x9
beq _0809CBD4
@ -1639,7 +1639,7 @@ mapheader_run_first_tag2_script_list_match_conditionally: @ 809CC38
lsrs r4, 16
lsls r5, 24
lsrs r5, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
mov r8, r0
adds r1, r7, 0
bl map_warp_check_packed
@ -1683,7 +1683,7 @@ sub_809CC9C: @ 809CC9C
adds r6, r0, 0
lsls r1, 16
lsrs r5, r1, 16
ldr r7, =gUnknown_02037318
ldr r7, =gMapHeader
adds r0, r7, 0
adds r1, r6, 0
bl map_warp_check_packed
@ -1958,7 +1958,7 @@ sub_809CEB0: @ 809CEB0
adds r4, r0, 0
cmp r4, 0
bne _0809CEE8
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
ldr r5, [r0, 0x8]
b _0809CF0E
@ -1976,7 +1976,7 @@ _0809CEF0:
adds r5, r0, 0
b _0809CF0E
_0809CF00:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
lsls r2, r4, 24
asrs r1, r2, 21
@ -2053,7 +2053,7 @@ map_warp_consider_2_to_inside: @ 809CF78
lsrs r0, 24
cmp r0, 0x1
bne _0809CFB0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r1, [r0, 0x4]
adds r0, r5, 0
bl sub_80E9668
@ -2067,7 +2067,7 @@ _0809CFB0:
lsrs r0, 24
cmp r0, 0x1
bne _0809CFFC
ldr r6, =gUnknown_02037318
ldr r6, =gMapHeader
adds r0, r6, 0
adds r1, r5, 0
bl map_warp_check_packed
@ -2243,7 +2243,7 @@ _0809D0E4:
thumb_func_start sub_809D0F4
sub_809D0F4: @ 809D0F4
push {r4,lr}
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrh r1, [r0]
subs r1, 0x7
lsls r1, 16
@ -2316,7 +2316,7 @@ dive_warp: @ 809D16C
adds r4, r0, 0
lsls r1, 16
lsrs r5, r1, 16
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x5
bne _0809D1A4
@ -2389,7 +2389,7 @@ sub_809D1E8: @ 809D1E8
bl MapGridGetMetatileBehaviorAt
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x5
bne _0809D244
@ -2491,7 +2491,7 @@ sub_809D2BC: @ 809D2BC
movs r2, 0x2
ldrsh r1, [r4, r2]
bl MapGridGetMetatileBehaviorAt
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
adds r0, r4, 0
mov r1, sp
bl map_warp_check_packed

View File

@ -5,84 +5,6 @@
.text
thumb_func_start sub_808D77C
sub_808D77C: @ 808D77C
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r0, 24
mov r8, r0
ldr r4, =gUnknown_02037318
ldr r0, [r4, 0x4]
cmp r0, 0
beq _0808D7FE
bl InBattlePyramid
lsls r0, 24
cmp r0, 0
beq _0808D7A8
bl sub_81AAA40
lsls r0, 24
lsrs r6, r0, 24
b _0808D7CA
.pool
_0808D7A8:
bl InTrainerHill
cmp r0, 0
beq _0808D7C6
movs r6, 0x2
b _0808D7CA
_0808D7B4:
ldr r0, [r7]
ldrb r1, [r0, 0x5]
ldrb r2, [r0, 0x4]
adds r0, r4, 0
bl InitFieldObjectStateFromTemplate
lsls r0, 24
lsrs r0, 24
b _0808D800
_0808D7C6:
ldr r0, [r4, 0x4]
ldrb r6, [r0]
_0808D7CA:
movs r5, 0
cmp r5, r6
bcs _0808D7FE
ldr r7, =gSaveBlock1Ptr
_0808D7D2:
lsls r0, r5, 1
adds r0, r5
lsls r0, 3
movs r1, 0xC7
lsls r1, 4
adds r0, r1
ldr r1, [r7]
adds r4, r1, r0
ldrb r0, [r4]
cmp r0, r8
bne _0808D7F4
ldrh r0, [r4, 0x14]
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _0808D7B4
_0808D7F4:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, r6
bcc _0808D7D2
_0808D7FE:
movs r0, 0x10
_0808D800:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_808D77C
thumb_func_start GetAvailableFieldObjectSlot
@ bool8 GetAvailableFieldObjectSlot(u16 localId, u8 mapId, u8 mapGroupId, u8 *fieldObjectId)
GetAvailableFieldObjectSlot: @ 808D810
@ -1066,7 +988,7 @@ SpawnFieldObjectsInView: @ 808DF80
lsls r1, 16
lsrs r1, 16
str r1, [sp, 0x8]
ldr r5, =gUnknown_02037318
ldr r5, =gMapHeader
ldr r0, [r5, 0x4]
cmp r0, 0
beq _0808E078
@ -3478,7 +3400,7 @@ GetFieldObjectTemplateByLocalIdAndMap: @ 808F128
movs r0, 0xC7
lsls r0, 4
adds r1, r0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
b _0808F16C
.pool

View File

@ -1201,7 +1201,7 @@ sub_809E1C8: @ 809E1C8
mov r7, r9
mov r6, r8
push {r6,r7}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r1, [r0]
mov r9, r1

View File

@ -19,7 +19,7 @@ mapconnection_get_mapheader: @ 8087D44
thumb_func_start not_trainer_hill_battle_pyramid
not_trainer_hill_battle_pyramid: @ 8087D54
push {r4,lr}
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
adds r0, r4, 0
bl mapheader_copy_mapdata_with_padding
ldr r0, [r4, 0x4]
@ -34,7 +34,7 @@ not_trainer_hill_battle_pyramid: @ 8087D54
thumb_func_start sub_8087D74
sub_8087D74: @ 8087D74
push {r4,lr}
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
adds r0, r4, 0
bl mapheader_copy_mapdata_with_padding
movs r0, 0
@ -554,7 +554,7 @@ MapGridGetZCoordAt: @ 8088144
b _08088196
.pool
_08088174:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0]
adds r1, r2, 0x1
movs r2, 0x1
@ -613,7 +613,7 @@ MapGridIsImpassableAt: @ 80881B0
b _08088202
.pool
_080881E0:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0]
adds r1, r2, 0x1
movs r2, 0x1
@ -675,7 +675,7 @@ MapGridGetMetatileIdAt: @ 8088224
b _08088278
.pool
_08088254:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0]
adds r1, r5, 0x1
movs r2, 0x1
@ -702,7 +702,7 @@ _08088278:
b _080882B0
.pool
_0808828C:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0]
adds r1, r5, 0x1
movs r2, 0x1
@ -839,7 +839,7 @@ GetBehaviorByMetatileId: @ 8088370
ldr r0, =0x000001ff
cmp r2, r0
bhi _08088394
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x10]
ldr r1, [r0, 0x10]
@ -854,7 +854,7 @@ _08088394:
b _080883B6
.pool
_080883A4:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x14]
ldr r1, [r0, 0x10]
@ -1029,7 +1029,7 @@ _080884EC:
mov r9, r1
cmp r6, r0
bne _08088508
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x4]
subs r0, 0x1
@ -1104,7 +1104,7 @@ _08088574:
asrs r1, r2, 16
bl sub_80D423C
_08088584:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x4]
subs r0, 0x1
@ -1282,7 +1282,7 @@ GetMapBorderIdAt: @ 808869C
b _08088700
.pool
_080886D8:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0]
adds r1, r4, 0x1
movs r2, 0x1
@ -1607,7 +1607,7 @@ sub_8088950: @ 8088950
mov r8, r2
lsls r0, 24
lsrs r6, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0xC]
ldr r7, [r0]
ldr r4, [r0, 0x4]
@ -1664,7 +1664,7 @@ sub_80889A8: @ 80889A8
blt _08088A00
cmp r4, 0x2
bgt _080889E0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r1, [r0]
ldr r0, [r2]
@ -1676,7 +1676,7 @@ sub_80889A8: @ 80889A8
_080889E0:
cmp r6, 0x4
bgt _08088A00
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r1, [r0, 0x4]
ldr r0, [r2]
@ -1792,7 +1792,7 @@ sub_8088A8C: @ 8088A8C
mov r8, r0
lsls r1, 16
lsrs r1, 16
ldr r2, =gUnknown_02037318
ldr r2, =gMapHeader
ldr r0, [r2, 0xC]
cmp r0, 0
bne _08088AB4

View File

@ -468,7 +468,7 @@ _080F9F54:
sub_80F9F5C: @ 80F9F5C
push {lr}
ldr r0, =gUnknown_0203AB40
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldr r1, [r1, 0x4]
bl sub_80E9608
bl sub_80E8B6C

View File

@ -8,7 +8,7 @@
thumb_func_start SetUpFieldMove_Teleport
SetUpFieldMove_Teleport: @ 817C8BC
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
bl is_light_level_1_2_3_or_6
lsls r0, 24

View File

@ -553,7 +553,7 @@ ItemUseOnFieldCB_Itemfinder: @ 80FD4B8
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
adds r1, r4, 0
bl ItemfinderCheckForHiddenItems
@ -906,7 +906,7 @@ _080FD76C:
subs r0, r5, r0
lsls r0, 16
lsrs r1, r0, 16
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x4]
b _080FD79E
@ -918,7 +918,7 @@ _080FD784:
adds r0, r5
b _080FD798
_080FD78E:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0]
adds r0, 0x7
@ -964,7 +964,7 @@ sub_80FD7C8: @ 80FD7C8
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r1, [r0]
ldr r0, [r1]
adds r0, 0x7
@ -2288,7 +2288,7 @@ re_escape_rope: @ 80FE2D8
thumb_func_start sub_80FE314
sub_80FE314: @ 80FE314
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x1A]
movs r0, 0x2
ands r0, r1

View File

@ -5733,7 +5733,7 @@ _0806EA7C:
mov r8, r2
movs r7, 0x50
_0806EAC6:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xD2
lsls r0, 1

View File

@ -1571,7 +1571,7 @@ _08123904:
_08123928:
ldr r4, =gUnknown_0203A144
ldr r0, [r4]
ldr r3, =gUnknown_02037318
ldr r3, =gMapHeader
ldrb r1, [r3, 0x14]
movs r2, 0
strh r1, [r0]
@ -1599,7 +1599,7 @@ _08123956:
b _08123ABE
.pool
_0812396C:
ldr r2, =gUnknown_02037318
ldr r2, =gMapHeader
ldrb r1, [r2, 0x1A]
movs r0, 0x2
ands r0, r1
@ -1685,7 +1685,7 @@ _081239E4:
_08123A28:
ldr r4, =gUnknown_0203A144
ldr r0, [r4]
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r1, [r1, 0x14]
strh r1, [r0]
cmp r1, 0x57
@ -2811,7 +2811,7 @@ sub_8124288: @ 8124288
str r0, [sp, 0x10]
ldr r0, =SpriteCallbackDummy
str r0, [sp, 0x14]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
bl sub_8124668
cmp r0, 0

View File

@ -278,7 +278,7 @@ CopyFieldObjectTemplatesToSav1: @ 8084894
ldr r2, =0x05000180
mov r0, sp
bl CpuSet
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r2, [r0, 0x4]
ldr r0, [r2, 0x4]
ldr r1, [r5]
@ -302,7 +302,7 @@ CopyFieldObjectTemplatesToSav1: @ 8084894
@ void CopyFieldObjectTemplateCoordsToSav1()
CopyFieldObjectTemplateCoordsToSav1: @ 80848E0
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r1, [r0, 0x4]
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
@ -393,7 +393,7 @@ _08084978:
mapdata_load_assets_to_gpu_and_full_redraw: @ 8084980
push {r4,lr}
bl move_tilemap_camera_to_upper_left_corner
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldr r0, [r4]
bl copy_map_tileset1_tileset2_to_vram
ldr r0, [r4]
@ -571,7 +571,7 @@ warp1_get_mapheader: @ 8084AA8
set_current_map_header_from_sav1_save_old_name: @ 8084ACC
push {r4-r6,lr}
ldr r1, =gUnknown_020322FC
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrb r0, [r4, 0x14]
strh r0, [r1]
ldr r5, =gSaveBlock1Ptr
@ -607,7 +607,7 @@ set_current_map_header_from_sav1_save_old_name: @ 8084ACC
thumb_func_start set_current_map_header_from_sav1
set_current_map_header_from_sav1: @ 8084B1C
push {r4,r5,lr}
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
movs r0, 0x4
@ -646,7 +646,7 @@ update_camera_pos_from_warpid: @ 8084B5C
adds r4, r0, 0
cmp r1, 0
blt _08084B94
ldr r3, =gUnknown_02037318
ldr r3, =gMapHeader
ldr r0, [r3, 0x4]
ldrb r5, [r0, 0x1]
cmp r1, r5
@ -680,7 +680,7 @@ _08084B94:
b _08084BCC
_08084BB0:
ldr r3, [r4]
ldr r2, =gUnknown_02037318
ldr r2, =gMapHeader
ldr r0, [r2]
ldr r0, [r0]
lsrs r1, r0, 31
@ -1232,7 +1232,7 @@ sub_8084FC0: @ 8084FC0
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0xC]
ldr r3, [r0]
ldr r1, [r0, 0x4]
@ -1366,7 +1366,7 @@ mliX_load_map: @ 8085098
str r3, [sp]
adds r2, r3, 0
bl warp1_set
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrb r0, [r4, 0x14]
cmp r0, 0x3A
beq _080850C8
@ -1407,7 +1407,7 @@ _08085116:
bl sub_80AEE20
bl wild_encounter_reset_coro_args
bl mapheader_run_script_with_tag_x5
ldr r2, =gUnknown_02037318
ldr r2, =gMapHeader
ldrb r0, [r2, 0x14]
cmp r0, 0x3A
bne _0808514C
@ -1436,7 +1436,7 @@ mli0_load_map: @ 8085160
ands r0, r1
cmp r0, 0
bne _080851A2
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x00000169
cmp r1, r0
@ -1453,7 +1453,7 @@ _08085190:
_0808519E:
bl CopyFieldObjectTemplatesToSav1
_080851A2:
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrb r0, [r4, 0x17]
bl is_light_level_1_2_3_5_or_6
lsls r0, 24
@ -1802,7 +1802,7 @@ cur_mapdata_block_role_at_screen_center_acc_to_sav1: @ 8085450
thumb_func_start sav1_map_is_biking_allowed
sav1_map_is_biking_allowed: @ 8085474
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x1A]
movs r0, 0x1
ands r0, r1
@ -1821,7 +1821,7 @@ _0808548E:
thumb_func_start update_sav1_flash_used_on_map
update_sav1_flash_used_on_map: @ 8085494
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x15]
cmp r1, 0
bne _080854B0
@ -1897,7 +1897,7 @@ sub_8085524: @ 8085524
ldr r1, [r1]
strh r0, [r1, 0x32]
bl get_mapdata_header
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
str r0, [r1]
pop {r0}
bx r0
@ -3471,7 +3471,7 @@ sub_80861E8: @ 80861E8
thumb_func_start sub_8086204
sub_8086204: @ 8086204
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x1A]
movs r0, 0xF8
ands r0, r1
@ -3507,7 +3507,7 @@ _0808624A:
bl GetCurrentTrainerHillMapId
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x00000169
cmp r1, r0
@ -3528,7 +3528,7 @@ _0808628A:
bl sub_809757C
bl sub_809E7B0
bl sub_8084788
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x00000169
cmp r1, r0
@ -3739,13 +3739,13 @@ _08086492:
bl move_tilemap_camera_to_upper_left_corner
b _08086506
_08086498:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl copy_map_tileset1_to_vram
b _08086506
.pool
_080864A8:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl copy_map_tileset2_to_vram
b _08086506
@ -3756,7 +3756,7 @@ _080864B8:
lsrs r0, 24
cmp r0, 0x1
beq _08086512
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl apply_map_tileset1_tileset2_palette
b _08086506
@ -3858,13 +3858,13 @@ _080865A6:
bl move_tilemap_camera_to_upper_left_corner
b _08086622
_080865AC:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl copy_map_tileset1_to_vram
b _08086622
.pool
_080865BC:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl copy_map_tileset2_to_vram
b _08086622
@ -3875,7 +3875,7 @@ _080865CC:
lsrs r0, 24
cmp r0, 0x1
beq _0808662E
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl apply_map_tileset1_tileset2_palette
b _08086622
@ -3887,7 +3887,7 @@ _080865EE:
bl cur_mapheader_run_tileset_funcs_after_some_cpuset
b _08086622
_080865F4:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x1A]
movs r0, 0xF8
ands r0, r1
@ -4027,13 +4027,13 @@ _0808671E:
bl move_tilemap_camera_to_upper_left_corner
b _08086792
_08086724:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl copy_map_tileset1_to_vram
b _08086792
.pool
_08086734:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl copy_map_tileset2_to_vram
b _08086792
@ -4044,7 +4044,7 @@ _08086744:
lsrs r0, 24
cmp r0, 0x1
beq _080867A8
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
bl apply_map_tileset1_tileset2_palette
b _08086792

View File

@ -88,7 +88,7 @@ task08_080C9820: @ 813549C
cmp r0, 0
beq _0813551E
_081354D2:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x5
bne _08135504
@ -3346,7 +3346,7 @@ sub_81370FC: @ 81370FC
b _08137152
.pool
_08137134:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x15]
cmp r0, 0x1
bne _08137170
@ -5213,7 +5213,7 @@ is_tile_that_overrides_player_control: @ 81380D8
lsls r0, 24
cmp r0, 0
beq _0813810A
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x1
blt _0813810A
@ -5250,7 +5250,7 @@ sub_8138120: @ 8138120
lsls r0, 24
cmp r0, 0
beq _08138152
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x1
blt _08138152
@ -5287,7 +5287,7 @@ sub_8138168: @ 8138168
lsls r0, 24
cmp r0, 0
beq _0813819A
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x1
blt _0813819A
@ -5324,7 +5324,7 @@ sub_81381B0: @ 81381B0
lsls r0, 24
cmp r0, 0
beq _081381E2
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x1
blt _081381E2
@ -5361,7 +5361,7 @@ sub_81381F8: @ 81381F8
lsls r0, 24
cmp r0, 0
beq _0813822A
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x1
blt _0813822A

View File

@ -26359,7 +26359,7 @@ ShowMapNamePopUpWindow: @ 80D49B0
lsls r0, 24
cmp r0, 0
beq _080D4A08
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xBD
lsls r0, 1
@ -26391,7 +26391,7 @@ _080D49F2:
_080D4A08:
mov r4, sp
adds r4, 0xF
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
adds r0, r4, 0
movs r2, 0
@ -26610,7 +26610,7 @@ LoadMapNamePopUpWindowBg: @ 80D4BE0
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
cmp r1, 0x57
bls _080D4C0A
@ -26647,7 +26647,7 @@ _080D4C0A:
bl CallWindowFunction
adds r0, r5, 0
bl PutWindowTilemap
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x16]
cmp r0, 0xE
bne _080D4C6C

View File

@ -16833,7 +16833,7 @@ _08195ED2:
thumb_func_start sub_8195ED8
sub_8195ED8: @ 8195ED8
push {r4,lr}
ldr r4, =gUnknown_02037318
ldr r4, =gMapHeader
ldrb r0, [r4, 0x17]
bl is_light_level_1_2_3_or_6
lsls r0, 24
@ -16857,7 +16857,7 @@ sub_8195ED8: @ 8195ED8
cmp r0, 0
beq _08195F30
_08195F0E:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
cmp r0, 0x38
bne _08195F38
@ -16932,7 +16932,7 @@ sub_8195F68: @ 8195F68
bl sub_8196844
adds r4, r0, 0
bl sub_819672C
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
lsls r0, 16
lsrs r0, 16
ldrb r1, [r1, 0x14]
@ -17938,7 +17938,7 @@ sub_81967AC: @ 81967AC
beq _081967EC
adds r0, r5, 0
bl sub_819672C
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
lsls r0, 16
lsrs r0, 16
ldrb r1, [r1, 0x14]
@ -25773,7 +25773,7 @@ _0819A3D6:
b _0819A43C
.pool
_0819A404:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
adds r0, r5, 0
bl sub_81245DC
@ -49364,7 +49364,7 @@ _081A6BEE:
sub_81A6BF4: @ 81A6BF4
push {lr}
movs r2, 0
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldr r3, =0xfffffea5
adds r0, r3, 0
ldrh r1, [r1, 0x12]
@ -51948,7 +51948,7 @@ sub_81A8090: @ 81A8090
InBattlePike: @ 81A80A8
push {lr}
movs r2, 0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r3, =0xfffffea1
adds r0, r1, r3
@ -55513,7 +55513,7 @@ sub_81A9E28: @ 81A9E28
thumb_func_start InBattlePyramid
InBattlePyramid: @ 81A9E40
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x00000169
cmp r1, r0
@ -55539,7 +55539,7 @@ _081A9E66:
sub_81A9E6C: @ 81A9E6C
push {lr}
movs r2, 0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x00000169
cmp r1, r0
@ -77653,7 +77653,7 @@ _081B5880:
thumb_func_start sub_81B5884
sub_81B5884: @ 81B5884
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
bl is_light_level_1_2_3_or_6
lsls r0, 24
@ -85842,7 +85842,7 @@ sub_81B9E88: @ 81B9E88
sub_81B9E94: @ 81B9E94
push {lr}
movs r2, 0
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r0, [r1, 0x14]
cmp r0, 0x8
bne _081B9EB2

View File

@ -21069,7 +21069,7 @@ sub_81C98D4: @ 81C98D4
_081C98D8:
adds r0, r4, 0
bl sub_81CB0C8
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
lsls r0, 24
lsrs r0, 24
ldrb r1, [r1, 0x14]
@ -23981,7 +23981,7 @@ sub_81CAF78: @ 81CAF78
adds r4, r0, 0
movs r0, 0
strb r0, [r6]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
bl is_light_level_1_2_3_or_6
lsls r0, 24
@ -24309,7 +24309,7 @@ sub_81CB1D0: @ 81CB1D0
bne _081CB218
adds r0, r1, 0
bl sub_81CAEA4
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
lsls r0, 16
lsrs r0, 16
ldrb r1, [r1, 0x14]
@ -24330,7 +24330,7 @@ _081CB218:
bne _081CB258
adds r0, r1, 0
bl sub_81CAEA4
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
lsls r0, 16
lsrs r0, 16
ldrb r1, [r1, 0x14]
@ -26717,7 +26717,7 @@ _081CC4F0:
b _081CC51A
.pool
_081CC4F8:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
bl sub_8124668
str r0, [r4, 0xC]
@ -44923,7 +44923,7 @@ _081D54EE:
thumb_func_start sub_81D5520
sub_81D5520: @ 81D5520
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x12]
adds r0, 0x61
lsls r0, 24
@ -45134,7 +45134,7 @@ sub_81D56B0: @ 81D56B0
ldr r0, =0x00000eec
bl AllocZeroed
str r0, [r4]
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r1, [r1, 0x12]
adds r1, 0x61
strb r1, [r0]
@ -46192,7 +46192,7 @@ _081D5FE6:
lsls r0, 24
lsrs r0, 24
mov r9, r0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r2, [r0, 0xC]
ldr r1, =gUnknown_03005DC0
@ -46261,7 +46261,7 @@ _081D605E:
thumb_func_start InTrainerHill
InTrainerHill: @ 81D6074
push {lr}
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldr r2, =0xfffffe61
adds r0, r2, 0
ldrh r1, [r1, 0x12]
@ -46283,7 +46283,7 @@ _081D608C:
@ u8 GetCurrentTrainerHillMapId()
GetCurrentTrainerHillMapId: @ 81D609C
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r2, [r0, 0x12]
ldr r0, =0x0000019f
cmp r2, r0
@ -46335,7 +46335,7 @@ _081D60F8:
thumb_func_start sub_81D6100
sub_81D6100: @ 81D6100
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x000001a3
movs r2, 0
@ -46369,7 +46369,7 @@ sub_81D6134: @ 81D6134
lsrs r0, 24
cmp r0, 0x1
bne _081D614C
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0, 0x4]
ldr r0, [r0, 0x8]
adds r0, 0x8

View File

@ -442,7 +442,7 @@ mapheader_get_tagged_pointer: @ 8098F88
push {lr}
lsls r0, 24
lsrs r1, r0, 24
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r2, [r0, 0x8]
cmp r2, 0
beq _08098F9C

View File

@ -251,7 +251,7 @@ sub_80E8CB0: @ 80E8CB0
lsls r2, 16
lsrs r2, 16
mov r10, r2
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
mov r8, r0
movs r0, 0
@ -502,7 +502,7 @@ _080E8E32:
movs r1, 0x2
strb r1, [r0]
ldr r0, =0x00004026
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r1, [r1, 0x14]
bl VarSet
pop {r3}
@ -727,7 +727,7 @@ sub_80E9068: @ 80E9068
thumb_func_start sub_80E909C
sub_80E909C: @ 80E909C
push {lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x9
bne _080E90C0
@ -1104,7 +1104,7 @@ _080E93BE:
b _080E9554
_080E93D4:
movs r5, 0
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r3, [r0, 0x4]
ldrb r4, [r3]
mov r9, r0
@ -1294,7 +1294,7 @@ _080E9562:
sub_80E9578: @ 80E9578
push {r4-r6,lr}
movs r5, 0
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldr r0, [r1, 0x4]
ldrb r0, [r0]
cmp r5, r0
@ -1936,7 +1936,7 @@ sub_80E9AC0: @ 80E9AC0
thumb_func_start sub_80E9AD0
sub_80E9AD0: @ 80E9AD0
push {r4-r7,lr}
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r4, [r0, 0x4]
movs r6, 0
b _080E9B62

View File

@ -1293,7 +1293,7 @@ BuyMenuDrawMapBg: @ 80E0584
mov r5, r8
push {r5-r7}
sub sp, 0x4
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
mov r9, r0
mov r4, sp

View File

@ -182,7 +182,7 @@ cur_mapheader_run_tileset1_func: @ 80A0AA8
ldr r1, =gUnknown_03000F40
movs r0, 0
str r0, [r1]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x10]
cmp r0, 0
@ -208,7 +208,7 @@ cur_mapheader_run_tileset2_func: @ 80A0AE4
ldr r1, =gUnknown_03000F44
movs r0, 0
str r0, [r1]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldr r0, [r0]
ldr r0, [r0, 0x14]
cmp r0, 0

View File

@ -742,7 +742,7 @@ GabbyAndTyAfterInterview: @ 80EC448
orrs r0, r2
strb r0, [r1]
ldr r0, [r5]
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r1, [r1, 0x14]
ldr r2, =0x00002bac
adds r0, r2
@ -1221,7 +1221,7 @@ _080EC8CA:
strh r0, [r4, 0x4]
ldrh r0, [r1, 0x6]
strh r0, [r4, 0x8]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
strb r0, [r4, 0xA]
pop {r4}
@ -1309,7 +1309,7 @@ _080EC940:
mov r1, r8
ldrb r0, [r1]
strb r0, [r4, 0x11]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
strb r0, [r4, 0x12]
adds r0, r4, 0
@ -2311,7 +2311,7 @@ SaveRecordedItemPurchasesForTVShow: @ 80ED238
movs r0, 0x16
strb r0, [r5]
strb r4, [r5, 0x1]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
strb r0, [r5, 0x12]
movs r4, 0
@ -3333,7 +3333,7 @@ _080EDBCC:
bl sub_80C0844
_080EDBD2:
strh r0, [r4, 0x2]
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r0, [r1, 0x14]
strb r0, [r4, 0x7]
ldrh r0, [r1, 0x12]
@ -3491,7 +3491,7 @@ sub_80EDCE8: @ 80EDCE8
ldr r0, =gSpecialVar_0x8005
ldrh r0, [r0]
strh r0, [r4, 0x2]
ldr r1, =gUnknown_02037318
ldr r1, =gMapHeader
ldrb r0, [r1, 0x14]
strb r0, [r4, 0x4]
ldrh r0, [r1, 0x12]
@ -4049,7 +4049,7 @@ _080EE1B6:
strb r1, [r4, 0x1]
movs r5, 0
ldr r6, =gUnknown_03005D10
ldr r3, =gUnknown_02037318
ldr r3, =gMapHeader
ldr r7, =gSaveBlock2Ptr
adds r2, r6, 0
adds r2, 0x36

View File

@ -7544,7 +7544,7 @@ sub_80AEDBC: @ 80AEDBC
ldr r0, [r4]
adds r0, 0x2E
ldrb r5, [r0]
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrb r0, [r0, 0x16]
bl sub_80AEEE8
ldr r1, [r4]

View File

@ -46,7 +46,7 @@ sub_80B48C4: @ 80B48C4
ldrh r5, [r2]
cmp r5, r9
bhi _080B496E
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
mov r10, r0
_080B4906:
movs r4, 0
@ -956,7 +956,7 @@ _080B4FBA:
cmp r0, 0
beq _080B5000
_080B4FE0:
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xB3
lsls r0, 1
@ -1191,7 +1191,7 @@ _080B519A:
lsrs r0, 24
cmp r0, 0x1
bne _080B51E8
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
ldr r0, =0x00000169
cmp r1, r0
@ -1319,7 +1319,7 @@ _080B52A6:
ldr r0, =0x0000ffff
cmp r5, r0
bne _080B539C
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xB3
lsls r0, 1
@ -1658,7 +1658,7 @@ sub_80B5578: @ 80B5578
ldr r0, =0x0000ffff
cmp r4, r0
bne _080B562C
ldr r0, =gUnknown_02037318
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xB3
lsls r0, 1

11
include/rom_818CFC8.h Normal file
View File

@ -0,0 +1,11 @@
//
// Created by Scott Norton on 9/6/17.
//
#ifndef POKEEMERALD_ROM_818CFC8_H
#define POKEEMERALD_ROM_818CFC8_H
bool8 InBattlePyramid(void);
u8 sub_81AAA40(void);
#endif //POKEEMERALD_ROM_818CFC8_H

10
include/rom_81BE66C.h Normal file
View File

@ -0,0 +1,10 @@
//
// Created by Scott Norton on 9/6/17.
//
#ifndef POKEEMERALD_ROM_81BE66C_H
#define POKEEMERALD_ROM_81BE66C_H
bool32 InTrainerHill(void);
#endif //POKEEMERALD_ROM_81BE66C_H

View File

@ -4,6 +4,9 @@
#include "sprite.h"
#include "rom4.h"
#include "field_player_avatar.h"
#include "event_data.h"
#include "rom_818CFC8.h"
#include "rom_81BE66C.h"
#include "field_map_obj.h"
// Static struct declarations
@ -352,3 +355,35 @@ __attribute__((naked)) u8 InitFieldObjectStateFromTemplate(struct MapObjectTempl
".pool");
}
#endif
u8 unref_sub_808D77C(u8 localId)
{
u8 i;
u8 nObjects;
struct MapObjectTemplate *template;
if (gMapHeader.events != NULL)
{
if (InBattlePyramid())
{
nObjects = sub_81AAA40();
}
else if (InTrainerHill())
{
nObjects = 2;
}
else
{
nObjects = gMapHeader.events->mapObjectCount;
}
for (i = 0; i < nObjects; i ++)
{
template = &gSaveBlock1Ptr->mapObjectTemplates[i];
if (template->localId == localId && !FlagGet(template->flagId))
{
return InitFieldObjectStateFromTemplate(template, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
}
}
}
return ARRAY_COUNT(gMapObjects);
}

View File

@ -746,7 +746,7 @@ gUnknown_02032308: @ 2032308
gUnknown_02032318: @ 2032318
.space 0x5000
gUnknown_02037318: @ 2037318
gMapHeader: @ 2037318
.space 0x1C
gUnknown_02037334: @ 2037334