Skip to content

Commit

Permalink
Merge pull request #552 from red031000/master
Browse files Browse the repository at this point in the history
a little map_object decomp
  • Loading branch information
red031000 authored Sep 30, 2024
2 parents 9a81717 + 046e4e0 commit bcc5bdf
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 193 deletions.
176 changes: 9 additions & 167 deletions arm9/asm/map_object_s.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,168 +3,10 @@

.extern UNK_020F6364
.extern sub_02057EE0
.extern sub_02057F18
.extern sub_0205815C
.extern sub_0205818C

.text

thumb_func_start sub_020581B4
sub_020581B4: ; 0x020581B4
push {r4, lr}
add r4, r0, #0x0
bl MapObject_GetManager
bl sub_020587E0
cmp r0, #0x0
beq _020581F6
add r0, r4, #0x0
bl sub_0205818C
add r0, r4, #0x0
mov r1, #0x0
bl sub_02058544
add r0, r4, #0x0
mov r1, #0x0
bl ov05_021F2E0C
add r0, r4, #0x0
bl MapObject_CheckFlag14
cmp r0, #0x0
bne _020581F6
add r0, r4, #0x0
bl sub_02057F18
add r0, r4, #0x0
bl sub_0205868C
add r0, r4, #0x0
bl sub_02058878
_020581F6:
pop {r4, pc}

thumb_func_start MapObject_ScriptIdIsFFFF
MapObject_ScriptIdIsFFFF: ; 0x020581F8
push {r3, lr}
bl MapObject_GetScript
lsl r0, r0, #0x10
lsr r1, r0, #0x10
ldr r0, _02058210 ; =0x0000FFFF
cmp r1, r0
bne _0205820C
mov r0, #0x1
pop {r3, pc}
_0205820C:
mov r0, #0x0
pop {r3, pc}
.balign 4
_02058210: .word 0x0000FFFF

thumb_func_start sub_02058214
sub_02058214: ; 0x02058214
push {r4-r6, lr}
add r5, r0, #0x0
add r4, r1, #0x0
add r6, r2, #0x0
bl MapObject_CheckFlag25
cmp r0, #0x1
beq _02058228
bl GF_AssertFail
_02058228:
add r0, r5, #0x0
mov r1, #0x0
bl MapObject_SetFlag25
add r0, r5, #0x0
add r1, r6, #0x0
bl sub_0205844C
add r0, r4, #0x0
bl ObjectEvent_GetScript
add r1, r0, #0x0
add r0, r5, #0x0
bl MapObject_SetScript
add r0, r4, #0x0
bl ObjectEvent_GetFlagID
add r1, r0, #0x0
add r0, r5, #0x0
bl MapObject_SetFlagID
pop {r4-r6, pc}
.balign 4

thumb_func_start sub_02058258
sub_02058258: ; 0x02058258
push {r4-r6, lr}
add r6, r2, #0x0
add r5, r0, #0x0
add r0, r6, #0x0
add r4, r1, #0x0
bl ObjectEvent_ScriptIDIsUnset
cmp r0, #0x1
beq _0205826E
bl GF_AssertFail
_0205826E:
add r0, r5, #0x0
mov r1, #0x1
bl MapObject_SetFlag25
add r0, r6, #0x0
bl ObjectEvent_GetScript
add r1, r0, #0x0
add r0, r5, #0x0
bl MapObject_SetScript
add r0, r6, #0x0
bl ObjectEvent_GetFlagID_AssertScriptIDIsUnset
add r1, r0, #0x0
add r0, r5, #0x0
bl MapObject_SetFlagID
add r0, r5, #0x0
add r1, r4, #0x0
bl sub_0205844C
pop {r4-r6, pc}

thumb_func_start sub_0205829C
sub_0205829C: ; 0x0205829C
push {r4, lr}
add r4, r1, #0x0
bl sub_02058744
add r0, r0, r4
pop {r4, pc}

thumb_func_start sub_020582A8
sub_020582A8: ; 0x020582A8
push {r4-r6, lr}
add r6, r1, #0x0
mov r1, #0x1
add r5, r0, #0x0
add r4, r2, #0x0
bl MapObject_TestFlagsBits
cmp r0, #0x0
bne _020582BE
mov r0, #0x0
pop {r4-r6, pc}
_020582BE:
add r0, r5, #0x0
bl MapObject_GetID
cmp r6, r0
beq _020582CC
mov r0, #0x0
pop {r4-r6, pc}
_020582CC:
add r0, r5, #0x0
bl sub_02058450
cmp r4, r0
beq _020582F2
add r0, r5, #0x0
bl MapObject_CheckFlag25
cmp r0, #0x0
bne _020582E4
mov r0, #0x0
pop {r4-r6, pc}
_020582E4:
add r0, r5, #0x0
bl sub_02058750
cmp r4, r0
beq _020582F2
mov r0, #0x0
pop {r4-r6, pc}
_020582F2:
mov r0, #0x1
pop {r4-r6, pc}
.balign 4

thumb_func_start sub_020582F8
sub_020582F8: ; 0x020582F8
push {r3-r7, lr}
Expand Down Expand Up @@ -503,13 +345,13 @@ MapObject_GetFlagID: ; 0x02058490
ldr r0, [r0, #0x1c]
bx lr

thumb_func_start MapObject_SetScript
MapObject_SetScript: ; 0x02058494
thumb_func_start MapObject_SetScriptID
MapObject_SetScriptID: ; 0x02058494
str r1, [r0, #0x20]
bx lr

thumb_func_start MapObject_GetScript
MapObject_GetScript: ; 0x02058498
thumb_func_start MapObject_GetScriptID
MapObject_GetScriptID: ; 0x02058498
ldr r0, [r0, #0x20]
bx lr

Expand Down Expand Up @@ -1200,8 +1042,8 @@ sub_0205886C: ; 0x0205886C
nop
_02058874: .word MapObject_ClearFlagsBits

thumb_func_start sub_02058878
sub_02058878: ; 0x02058878
thumb_func_start MapObject_SetFlag14
MapObject_SetFlag14: ; 0x02058878
ldr r3, _02058880 ; =MapObject_SetFlagsBits
mov r1, #0x1
lsl r1, r1, #0xe
Expand Down Expand Up @@ -1865,8 +1707,8 @@ ObjectEvent_SetScript: ; 0x02058C20
strh r1, [r0, #0xa]
bx lr

thumb_func_start ObjectEvent_GetScript
ObjectEvent_GetScript: ; 0x02058C24
thumb_func_start ObjectEvent_GetScriptID
ObjectEvent_GetScriptID: ; 0x02058C24
ldrh r0, [r0, #0xa]
bx lr

Expand Down Expand Up @@ -2016,7 +1858,7 @@ _02058CD4:
thumb_func_start ObjectEvent_ScriptIDIsUnset
ObjectEvent_ScriptIDIsUnset: ; 0x02058CE0
push {r3, lr}
bl ObjectEvent_GetScript
bl ObjectEvent_GetScriptID
lsl r0, r0, #0x10
lsr r1, r0, #0x10
ldr r0, _02058CF8 ; =0x0000FFFF
Expand Down
2 changes: 1 addition & 1 deletion arm9/asm/unk_02055068.s
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ _02055228:
bl MapObject_SetFlagID
add r0, r5, #0x0
mov r1, #0x0
bl MapObject_SetScript
bl MapObject_SetScriptID
mov r1, #0x0
add r0, r5, #0x0
add r2, r1, #0x0
Expand Down
4 changes: 2 additions & 2 deletions arm9/asm/unk_0205C598.s
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ sub_0205C73C: ; 0x0205C73C
str r2, [r5, #0x0]
str r3, [r5, #0x4]
add r0, r4, #0x0
bl MapObject_GetScript
bl MapObject_GetScriptID
str r0, [r5, #0x8]
lsl r0, r0, #0x10
lsr r0, r0, #0x10
Expand Down Expand Up @@ -573,7 +573,7 @@ _0205C9D0:
thumb_func_start sub_0205C9D8
sub_0205C9D8: ; 0x0205C9D8
push {r3, lr}
bl MapObject_GetScript
bl MapObject_GetScriptID
lsl r0, r0, #0x10
lsr r0, r0, #0x10
bl sub_020395F4
Expand Down
4 changes: 2 additions & 2 deletions arm9/global.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4031,8 +4031,8 @@
.extern MapObject_SetType
.extern MapObject_GetType
.extern MapObject_SetFlagID
.extern MapObject_SetScript
.extern MapObject_GetScript
.extern MapObject_SetScriptID
.extern MapObject_GetScriptID
.extern MapObject_GetInitialFacingDirection
.extern MapObject_SetFacingDirectionDirect
.extern sub_020584AC
Expand Down
10 changes: 5 additions & 5 deletions arm9/overlays/05/asm/ov05_021D80E8.s
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ _021D8486:
beq _021D84A8
ldr r5, [sp, #4]
add r0, r5, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
add r1, r0, #0
lsl r1, r1, #0x10
add r0, r4, #0
Expand Down Expand Up @@ -599,7 +599,7 @@ ov05_021D859C: ; 0x021D859C
bne _021D85C4
ldr r4, [sp]
add r0, r4, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
add r1, r0, #0
lsl r1, r1, #0x10
add r0, r5, #0
Expand Down Expand Up @@ -747,7 +747,7 @@ _021D86AE:
_021D86E4:
ldr r4, [sp]
add r0, r4, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
add r1, r0, #0
lsl r1, r1, #0x10
add r0, r5, #0
Expand Down Expand Up @@ -852,7 +852,7 @@ _021D87B6:
bl sub_02031C10
ldr r4, [sp]
add r0, r4, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
add r1, r0, #0
lsl r1, r1, #0x10
add r0, r5, #0
Expand Down Expand Up @@ -939,7 +939,7 @@ _021D886E:
beq _021D8890
ldr r5, [sp]
add r0, r5, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
add r1, r0, #0
lsl r1, r1, #0x10
add r0, r4, #0
Expand Down
6 changes: 3 additions & 3 deletions arm9/overlays/05/asm/ov05_021E1374.s
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ _021E1844: .word ov05_021F6910
thumb_func_start ov05_021E1848
ov05_021E1848: ; 0x021E1848
push {r3, lr}
bl MapObject_GetScript
bl MapObject_GetScriptID
lsl r0, r0, #0x10
lsr r0, r0, #0x10
bl sub_020395F4
Expand Down Expand Up @@ -909,7 +909,7 @@ ov05_021E1A30: ; 0x021E1A30
bl sub_02034B64
add r7, r0, #0
add r0, r4, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
lsl r0, r0, #0x10
lsr r0, r0, #0x10
str r0, [sp, #0xc]
Expand Down Expand Up @@ -961,7 +961,7 @@ _021E1A98: ; jump table
.short _021E1AAA - _021E1A98 - 2 ; case 8
_021E1AAA:
add r0, r5, #0
bl MapObject_GetScript
bl MapObject_GetScriptID
add r6, r0, #0
lsl r0, r6, #0x10
lsr r0, r0, #0x10
Expand Down
Loading

0 comments on commit bcc5bdf

Please sign in to comment.