Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decompile map_object.c #548

Merged
merged 19 commits into from
Jul 22, 2024
Merged
1,953 changes: 977 additions & 976 deletions arm9/arm9.lsf

Large diffs are not rendered by default.

2,319 changes: 2,319 additions & 0 deletions arm9/asm/map_object_s.s

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions arm9/asm/scrcmd_7.s
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ ScrCmd_Unk00F0: ; 0x02041BC4
bl FieldSysGetAttrAddr
add r5, r0, #0x0
ldr r0, [r5, #0x0]
bl MapObject_GetFieldSysPtr
bl MapObject_GetFieldSystem
add r4, r0, #0x0
ldr r0, [r5, #0x0]
bl MapObject_GetID
Expand All @@ -652,15 +652,15 @@ ScrCmd_Unk00F1: ; 0x02041BF0
bl ScriptReadWord
add r4, r0, #0x0
ldr r0, [r5, #0x0]
bl MapObject_GetFieldSysPtr
bl MapObject_GetFieldSystem
add r7, r0, #0x0
ldr r0, [r5, #0x0]
bl MapObject_GetID
add r1, r0, #0x0
lsl r1, r1, #0x10
add r0, r7, #0x0
lsr r1, r1, #0x10
bl TrainerFlagCheck
bl TrainerFieldSystem_FlagCheck
cmp r0, #0x1
bne _02041C34
ldr r1, [r6, #0x8]
Expand Down
2 changes: 1 addition & 1 deletion arm9/asm/unk_02012944.s
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ _02012A4E:
ldr r0, _02012ABC ; =sub_02012BE4
ldr r2, [sp, #0x28]
add r1, r5, #0x0
bl sub_0200CA44
bl SysTask_CreateOnMainQueue
ldr r1, _02012AB0 ; =0x00000604
mov r2, #0x3
str r0, [r5, r1]
Expand Down
2 changes: 1 addition & 1 deletion arm9/asm/unk_02014BF4.s
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ _02014CC2:
ldr r1, [r5, #0x0]
ldr r0, _02014D78 ; =sub_02014DD8
add r1, r1, r4
bl sub_0200CA44
bl SysTask_CreateOnMainQueue
ldr r1, [r5, #0x0]
add r1, r1, r4
str r0, [r1, #0x4]
Expand Down
2 changes: 1 addition & 1 deletion arm9/asm/unk_02034A28.s
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ _02034AD8:
ldr r1, [r1, #0x0]
ldr r3, [r3, #0x14]
add r2, r4, #0x0
bl sub_02057BAC
bl MapObject_CreateFromMultipleObjectEvents
_02034AEC:
pop {r3-r5, pc}
.balign 4
Expand Down
16 changes: 8 additions & 8 deletions arm9/asm/unk_02034D7C.s
Original file line number Diff line number Diff line change
Expand Up @@ -163,36 +163,36 @@ Save_LocalFieldData_Get: ; 0x02034E30
nop
_02034E38: .word SaveArray_Get

thumb_func_start sub_02034E3C
sub_02034E3C: ; 0x02034E3C
thumb_func_start Save_MapObjects_Get
Save_MapObjects_Get: ; 0x02034E3C
ldr r3, _02034E44 ; =SaveArray_Get
mov r1, #0xb
bx r3
nop
_02034E44: .word SaveArray_Get

thumb_func_start sub_02034E48
sub_02034E48: ; 0x02034E48
thumb_func_start FieldSystem_SyncMapObjectsToSave
FieldSystem_SyncMapObjectsToSave: ; 0x02034E48
push {r4, lr}
add r4, r0, #0x0
ldr r0, [r4, #0xc]
bl sub_02034E3C
bl Save_MapObjects_Get
add r2, r0, #0x0
ldr r1, [r4, #0x34]
add r0, r4, #0x0
mov r3, #0x40
bl sub_02057800
bl FieldSystem_SyncMapObjectsToSaveEx
pop {r4, pc}

thumb_func_start sub_02034E60
sub_02034E60: ; 0x02034E60
push {r4, lr}
add r4, r0, #0x0
ldr r0, [r4, #0xc]
bl sub_02034E3C
bl Save_MapObjects_Get
add r1, r0, #0x0
ldr r0, [r4, #0x34]
mov r2, #0x40
bl sub_0205785C
bl MapObjectManager_RestoreFromSave
pop {r4, pc}
.balign 4
4 changes: 2 additions & 2 deletions arm9/asm/unk_02037024.s
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ _0203714A:
bl sub_02039694
add r1, r0, #0x0
add r0, r4, #0x0
bl FlagCheck
bl FieldSystem_FlagCheck
cmp r0, #0x1
beq _02037160
mov r0, #0x1
Expand Down Expand Up @@ -313,7 +313,7 @@ _02037244:
cmp r0, #0x1
bne _02037260
ldr r0, [r4, #0x0]
bl sub_02058458
bl MapObject_GetSpriteID
sub r0, #0x5b
cmp r0, #0x5
bhi _02037260
Expand Down
14 changes: 7 additions & 7 deletions arm9/asm/unk_02038C78.s
Original file line number Diff line number Diff line change
Expand Up @@ -1982,8 +1982,8 @@ _020394FE:
pop {r4, pc}
.balign 4

thumb_func_start sub_02039504
sub_02039504: ; 0x02039504
thumb_func_start FieldSystem_VarGetObjectEventGraphicsId
FieldSystem_VarGetObjectEventGraphicsId: ; 0x02039504
push {r3-r5, lr}
add r4, r1, #0x0
add r5, r0, #0x0
Expand All @@ -2001,8 +2001,8 @@ _02039512:
nop
_02039524: .word 0x00004020

thumb_func_start FlagCheck
FlagCheck: ; 0x02039528
thumb_func_start FieldSystem_FlagCheck
FieldSystem_FlagCheck: ; 0x02039528
push {r4, lr}
ldr r0, [r0, #0xc]
add r4, r1, #0x0
Expand Down Expand Up @@ -2152,8 +2152,8 @@ _0203963C:
mov r0, #0x0
pop {r3, pc}

thumb_func_start TrainerFlagCheck
TrainerFlagCheck: ; 0x02039640
thumb_func_start TrainerFieldSystem_FlagCheck
TrainerFieldSystem_FlagCheck: ; 0x02039640
push {r4, lr}
ldr r0, [r0, #0xc]
add r4, r1, #0x0
Expand Down Expand Up @@ -2385,7 +2385,7 @@ _020397EC:
bl sub_02039694
add r1, r0, #0x0
ldr r0, [sp, #0x0]
bl FlagCheck
bl FieldSystem_FlagCheck
cmp r0, #0x0
bne _0203984C
ldr r1, [r4, #0x4]
Expand Down
8 changes: 4 additions & 4 deletions arm9/asm/unk_02048904.s
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ sub_02048AE4: ; 0x02048AE4
add r5, r0, #0x0
mov r1, #0x40
mov r2, #0x5
bl sub_02057380
bl MapObjectManager_Init
str r0, [r5, #0x34]
ldr r0, [r5, #0xc]
bl Save_PlayerData_GetProfileAddr
Expand Down Expand Up @@ -301,9 +301,9 @@ sub_02048B34: ; 0x02048B34
ldr r0, [r4, #0x38]
bl sub_02055160
ldr r0, [r4, #0x34]
bl sub_0205771C
bl MapObjectManager_RemoveAllActiveObjects
ldr r0, [r4, #0x34]
bl sub_020573AC
bl MapObjectManager_Delete
pop {r4, pc}

thumb_func_start sub_02048B50
Expand All @@ -312,7 +312,7 @@ sub_02048B50: ; 0x02048B50
add r5, r0, #0x0
mov r1, #0x40
mov r2, #0x5
bl sub_02057380
bl MapObjectManager_Init
str r0, [r5, #0x34]
add r0, r5, #0x0
bl sub_02034E60
Expand Down
32 changes: 16 additions & 16 deletions arm9/asm/unk_0204B34C.s
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ sub_0204B490: ; 0x0204B490
add r1, sp, #0x0
add r2, sp, #0x4
mov r3, #0x1
bl sub_020580F4
bl MapObjectManager_GetNextObjectWithFlagFromIndex
cmp r0, #0x1
bne _0204B4F8
mov r6, #0x0
mov r7, #0x1
_0204B4B6:
ldr r0, [sp, #0x0]
bl sub_02058458
bl MapObject_GetSpriteID
bl sub_0205C334
cmp r0, #0x1
bne _0204B4E8
Expand All @@ -230,7 +230,7 @@ _0204B4B6:
beq _0204B4E8
ldr r0, [sp, #0x0]
add r1, r6, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
add r2, r7, #0x0
Expand All @@ -240,7 +240,7 @@ _0204B4E8:
add r1, sp, #0x0
add r2, sp, #0x4
mov r3, #0x1
bl sub_020580F4
bl MapObjectManager_GetNextObjectWithFlagFromIndex
cmp r0, #0x1
beq _0204B4B6
_0204B4F8:
Expand All @@ -258,7 +258,7 @@ sub_0204B4FC: ; 0x0204B4FC
add r4, r0, #0x0
add r0, r7, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
str r0, [sp, #0x0]
ldr r1, [sp, #0x0]
add r0, r4, #0x0
Expand Down Expand Up @@ -312,7 +312,7 @@ sub_0204B57C: ; 0x0204B57C
add r6, r0, #0x0
add r0, r4, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r4, r0, #0x0
add r0, r5, #0x0
bl sub_0204B37C
Expand All @@ -334,7 +334,7 @@ sub_0204B5A8: ; 0x0204B5A8
add r7, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r5, r0, #0x0
add r0, r6, #0x0
bl sub_0204B35C
Expand All @@ -357,7 +357,7 @@ sub_0204B5DC: ; 0x0204B5DC
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_020252AC
Expand All @@ -373,7 +373,7 @@ sub_0204B5FC: ; 0x0204B5FC
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_02025238
Expand All @@ -389,7 +389,7 @@ sub_0204B61C: ; 0x0204B61C
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_02025244
Expand All @@ -405,7 +405,7 @@ sub_0204B63C: ; 0x0204B63C
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_02025244
Expand All @@ -422,7 +422,7 @@ sub_0204B660: ; 0x0204B660
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_020252D0
Expand All @@ -439,7 +439,7 @@ sub_0204B684: ; 0x0204B684
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_0202524C
Expand All @@ -455,7 +455,7 @@ sub_0204B6A4: ; 0x0204B6A4
add r4, r0, #0x0
add r0, r5, #0x0
mov r1, #0x0
bl sub_02058510
bl MapObject_GetParam
add r1, r0, #0x0
add r0, r4, #0x0
bl sub_020252E8
Expand All @@ -470,7 +470,7 @@ sub_0204B6C4: ; 0x0204B6C4
ldr r4, _0204B708 ; =0x00000000
beq _0204B6D8
add r0, r5, #0x0
bl sub_02058458
bl MapObject_GetSpriteID
cmp r0, #0x64
beq _0204B6DC
_0204B6D8:
Expand Down Expand Up @@ -615,7 +615,7 @@ _0204B7CC:
thumb_func_start sub_0204B7D8
sub_0204B7D8: ; 0x0204B7D8
push {r3, lr}
bl sub_02058458
bl MapObject_GetSpriteID
cmp r0, #0x64
bne _0204B7E6
mov r0, #0x1
Expand Down
Loading
Loading