Skip to content

Commit 1e7c310

Browse files
committed
more ground object decomp
1 parent b89c8e2 commit 1e7c310

File tree

2 files changed

+43
-63
lines changed

2 files changed

+43
-63
lines changed

asm/ground_object.s

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,6 @@
55

66
.text
77

8-
thumb_func_start CallbackObjectGetPosHeightAndUnk
9-
CallbackObjectGetPosHeightAndUnk:
10-
push {r4,lr}
11-
adds r3, r0, 0
12-
movs r4, 0x9A
13-
lsls r4, 1
14-
adds r0, r3, r4
15-
ldr r0, [r0]
16-
str r0, [r1]
17-
movs r1, 0x9C
18-
lsls r1, 1
19-
adds r0, r3, r1
20-
ldr r0, [r0]
21-
str r0, [r2]
22-
pop {r4}
23-
pop {r0}
24-
bx r0
25-
thumb_func_end CallbackObjectGetPosHeightAndUnk
26-
27-
thumb_func_start CallbackObjectSetPosHeight
28-
CallbackObjectSetPosHeight:
29-
movs r2, 0x9A
30-
lsls r2, 1
31-
adds r0, r2
32-
str r1, [r0]
33-
bx lr
34-
thumb_func_end CallbackObjectSetPosHeight
35-
36-
thumb_func_start CallbackObjectGetDirection
37-
CallbackObjectGetDirection:
38-
movs r2, 0x90
39-
lsls r2, 1
40-
adds r0, r2
41-
ldrb r0, [r0]
42-
strb r0, [r1]
43-
bx lr
44-
thumb_func_end CallbackObjectGetDirection
45-
46-
thumb_func_start CallbackObjectSetDirection
47-
CallbackObjectSetDirection:
48-
push {lr}
49-
adds r2, r0, 0
50-
lsls r1, 24
51-
asrs r1, 24
52-
movs r0, 0x1
53-
negs r0, r0
54-
cmp r1, r0
55-
beq _080AC934
56-
movs r3, 0x90
57-
lsls r3, 1
58-
adds r0, r2, r3
59-
strb r1, [r0]
60-
_080AC934:
61-
pop {r0}
62-
bx r0
63-
thumb_func_end CallbackObjectSetDirection
64-
658
thumb_func_start CallbackObjectSetEventIndex
669
CallbackObjectSetEventIndex:
6710
push {r4,r5,lr}

src/ground_object.c

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ static void CallbackObjectSetHitboxPos(void *objectPtr_, PixelPos *posOrNull);
6666
static void CallbackObjectSetPositionBounds(void *objectPtr_, PixelPos *from, PixelPos *to);
6767
static void CallbackObjectGetHitboxCenter(void *objectPtr_, PixelPos *out);
6868
static s32 CallbackObjectMoveReal(void *objectPtr_, PixelPos *pos);
69-
extern void CallbackObjectGetPosHeightAndUnk(void *objectPtr_, u32 *height, u32 *unk);
70-
extern void CallbackObjectSetPosHeight(void *objectPtr_, u32 height);
71-
extern void CallbackObjectGetDirection(void *objectPtr_, s8 *dir);
72-
extern void CallbackObjectSetDirection(void *objectPtr_, s32 dir_);
69+
static void CallbackObjectGetPosHeightAndUnk(void *objectPtr_, u32 *height, u32 *unk);
70+
static void CallbackObjectSetPosHeight(void *objectPtr_, u32 height);
71+
static void CallbackObjectGetDirection(void *objectPtr_, s8 *dir);
72+
static void CallbackObjectSetDirection(void *objectPtr_, s32 dir_);
7373
extern void CallbackObjectSetEventIndex(void *objectPtr_, u16 a1);
7474
extern void CallbackObjectSetUnk_80AC998(void *objectPtr_, s32 a1_, s32 a2);
7575
extern bool8 CallbackObjectSpriteRelatedCheck_80AC9B8(void *objectPtr_);
@@ -170,8 +170,9 @@ static const struct ScriptCommand gUnknown_8118350[] = {
170170
JUMP_LABEL(0),
171171
};
172172

173-
const u8 gUnknown_81183A0[] = {
174-
0xFF, 0xFF, 0x0, 0x8, 0x1, 0x8, 0x0, 0x10, 0x1, 0x10, 0x2, 0x10, 0x3, 0x10, 0x0, 0x8, 0x1, 0x8, 0x2, 0x8, 0x3, 0x8, 0x4, 0x8, 0x5, 0x8, 0x6, 0x8, 0x7, 0x8, 0x8, 0x8, 0x9, 0x8, 0xA, 0x8, 0xB, 0x8, 0xC, 0x8, 0xD, 0x8, 0xE, 0x8, 0xF, 0x8, 0x0, 0x0};
173+
const s16 gUnknown_81183A0[24] = {
174+
0xFFFF, 0x800, 0x801, 0x1000, 0x1001, 0x1002, 0x1003, 0x800, 0x801, 0x802, 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80A, 0x80B, 0x80C, 0x80D, 0x80E, 0x80F, 0x0
175+
};
175176

176177
void AllocGroundObjects(void)
177178
{
@@ -910,3 +911,39 @@ static s32 CallbackObjectMoveReal(void *objectPtr_, PixelPos *pos)
910911
struct GroundObject *objectPtr = objectPtr_;
911912
return TryMoveObjectRelative_80AC6AC(objectPtr, pos);
912913
}
914+
915+
static void CallbackObjectGetPosHeightAndUnk(void *livesPtr_, u32 *height, u32 *unk)
916+
{
917+
struct GroundObject *livesPtr = livesPtr_;
918+
919+
*height = livesPtr->unk134.x;
920+
*unk = livesPtr->unk134.y;
921+
}
922+
923+
static void CallbackObjectSetPosHeight(void *livesPtr_, u32 height)
924+
{
925+
struct GroundObject *livesPtr = livesPtr_;
926+
927+
livesPtr->unk134.x = height;
928+
}
929+
930+
static void CallbackObjectGetDirection(void *livesPtr_, s8 *direction)
931+
{
932+
struct GroundObject *livesPtr = livesPtr_;
933+
934+
*direction = livesPtr->unk120;
935+
}
936+
937+
static void CallbackObjectSetDirection(void *livesPtr_, s32 direction)
938+
{
939+
struct GroundObject *livesPtr = livesPtr_;
940+
s32 dir = (s8) direction;
941+
942+
if (dir != -1) {
943+
livesPtr->unk120 = dir;
944+
}
945+
}
946+
947+
948+
949+

0 commit comments

Comments
 (0)