Skip to content

Commit

Permalink
Merge pull request #74 from chordtoll/dgo
Browse files Browse the repository at this point in the history
Decompile dg_object functions
  • Loading branch information
AnonymousRandomPerson authored Oct 15, 2024
2 parents 3aca307 + f4784e8 commit 394d16f
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 80 deletions.
2 changes: 1 addition & 1 deletion asm/include/overlay_29_022DC2B8.inc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
.public ov29_022E15C8
.public ov29_022E1604
.public ov29_022E1640
.public ov29_022E1A84
.public SetEntityPixelPosXY
.public ov29_022E2B68
.public ov29_022E2DFC
.public ov29_022E34B0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#pragma once
.public _020A1AE8
.public abs
.public CanSeeInvisibleMonsters
.public DrawMinimapTile
.public DUNGEON_PTR
.public DrawMinimapTile
.public DungeonGetSpriteIndex
.public EntityIsValid__022E1A1C
.public EntityIsValid__022E32E8
Expand All @@ -19,6 +17,12 @@
.public IsPositionActuallyInSight
.public IsPositionInSight
.public ItemIsActive__022E330C
.public SECONDARY_TERRAIN_TYPES
.public StringFromId
.public TeamMemberHasEnabledIqSkill
.public UpdateMinimap
.public UpdateTrapsVisibility
.public abs
.public ov29_022DE954
.public ov29_022DE9F8
.public ov29_022DEA10
Expand All @@ -39,11 +43,6 @@
.public ov29_0237C754
.public ov29_0237C79C
.public ov29_0237C84C
.public SECONDARY_TERRAIN_TYPES
.public strcpy
.public StringFromId
.public sub_02009194
.public sub_020091B0
.public TeamMemberHasEnabledIqSkill
.public UpdateMinimap
.public UpdateTrapsVisibility
2 changes: 1 addition & 1 deletion asm/include/overlay_29_023047DC.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
.public GetTileAtEntity
.public IsFloorOver
.public IsWaterTileset
.public ov29_022E1A90
.public IncrementEntityPixelPosXY
.public ov29_022E8104
.public ov29_022EA370
.public ov29_022EF9BC
Expand Down
4 changes: 2 additions & 2 deletions asm/include/overlay_29_0231F594.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
.public LogMessageByIdWithPopupCheckUser
.public MemAlloc
.public MemFree
.public ov29_022E1A84
.public ov29_022E1A90
.public SetEntityPixelPosXY
.public IncrementEntityPixelPosXY
.public ov29_022E56A0
.public ov29_022F62CC
.public ov29_02304B64
Expand Down
2 changes: 1 addition & 1 deletion asm/include/overlay_29_0231FC20.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.public LogMessageByIdWithPopupCheckUserTarget
.public MoveMonsterToPos
.public ov10_022C4570
.public ov29_022E1A90
.public IncrementEntityPixelPosXY
.public ov29_022E56A0
.public ov29_022F9C74
.public ov29_022FFB90
Expand Down
2 changes: 1 addition & 1 deletion asm/include/overlay_29_023201A0.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.public LogMessageByIdWithPopupCheckUser
.public LogMessageByIdWithPopupCheckUserTarget
.public MoveMonsterToPos
.public ov29_022E1A90
.public IncrementEntityPixelPosXY
.public ov29_022E5560
.public ov29_022E55F0
.public ov29_022E56A0
Expand Down
4 changes: 2 additions & 2 deletions asm/include/overlay_29_0232A3FC.inc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
.public ov10_022C5DE0
.public ov10_022C6321
.public ov10_022C6322
.public ov29_022E1A84
.public ov29_022E1A90
.public SetEntityPixelPosXY
.public IncrementEntityPixelPosXY
.public ov29_022E2CA0
.public ov29_022ED868
.public ov29_022F8FF8
Expand Down
4 changes: 2 additions & 2 deletions asm/include/overlay_29_023456BC.inc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
.public ov10_022C48EC
.public ov10_022C4CD8
.public ov29_022E09E8
.public ov29_022E1A84
.public ov29_022E1A90
.public SetEntityPixelPosXY
.public IncrementEntityPixelPosXY
.public ov29_022E563C
.public ov29_022E9488
.public ov29_022EACBC
Expand Down
2 changes: 1 addition & 1 deletion asm/include/overlay_29_02347BC8.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.public ov29_022E0DE4
.public ov29_022E0DFC
.public ov29_022E0E44
.public ov29_022E1A84
.public SetEntityPixelPosXY
.public ov29_022E2CA0
.public ov29_022E9488
.public ov29_022FB9BC
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_29_022DC2B8.s
Original file line number Diff line number Diff line change
Expand Up @@ -4164,7 +4164,7 @@ _022DF9B0:
add r0, sp, #0x18
mov r1, r1, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r3, #0
mov r0, r4
add r1, sp, #0x18
Expand Down
42 changes: 1 addition & 41 deletions asm/overlay_29_022E1A40.s → asm/overlay_29_022E1AAC.s
Original file line number Diff line number Diff line change
@@ -1,48 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022E1A40.inc"
.include "overlay_29_022E1AAC.inc"

.text

arm_func_start UpdateEntityPixelPos
UpdateEntityPixelPos: ; 0x022E1A40
cmp r1, #0
ldrne r2, [r1]
strne r2, [r0, #0xc]
ldrne r1, [r1, #4]
bne _022E1A7C
ldrsh r2, [r0, #4]
mov r1, #0x18
smulbb r2, r2, r1
add r2, r2, #0xc
mov r2, r2, lsl #8
str r2, [r0, #0xc]
ldrsh r2, [r0, #6]
smulbb r1, r2, r1
add r1, r1, #0x10
mov r1, r1, lsl #8
_022E1A7C:
str r1, [r0, #0x10]
bx lr
arm_func_end UpdateEntityPixelPos

arm_func_start ov29_022E1A84
ov29_022E1A84: ; 0x022E1A84
str r1, [r0, #0xc]
str r2, [r0, #0x10]
bx lr
arm_func_end ov29_022E1A84

arm_func_start ov29_022E1A90
ov29_022E1A90: ; 0x022E1A90
ldr r3, [r0, #0xc]
add r1, r3, r1
str r1, [r0, #0xc]
ldr r1, [r0, #0x10]
add r1, r1, r2
str r1, [r0, #0x10]
bx lr
arm_func_end ov29_022E1A90

arm_func_start ov29_022E1AAC
ov29_022E1AAC: ; 0x022E1AAC
stmdb sp!, {r3, r4, r5, lr}
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_29_023047DC.s
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ _023051C4:
mov r0, r7
ldr r1, [r8, #0x10]
ldr r2, [r8, #0x14]
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
ldrb r0, [sb, #7]
cmp r0, #0
beq _02305258
Expand Down
4 changes: 2 additions & 2 deletions asm/overlay_29_0231F594.s
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ _0231F7A0:
add r2, r2, #4
mov r1, r1, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r1, #0
strh r1, [r5, #0x26]
mov r1, #1
Expand Down Expand Up @@ -405,7 +405,7 @@ _0231FA9C:
ldr r1, [r2, #0x2f4]
ldr r2, [r2, #0x2f8]
str r0, [sp, #4]
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
mov r0, r8
bl sub_020018D0
mov r1, #0xc
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_29_0231FC20.s
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ _0231FF84:
ldr r1, [sp, #0x18]
ldr r2, [sp, #0x1c]
mov r0, sb
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
mov r0, sb
bl ShouldDisplayEntityWrapper
cmp r0, #0
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_29_023201A0.s
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ _023202C4:
mov r0, sl
mov r1, r6
mov r2, r7
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
mov r0, sl
bl ShouldDisplayEntityWrapper
cmp r0, #0
Expand Down
6 changes: 3 additions & 3 deletions asm/overlay_29_0232A3FC.s
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ ov29_0232A834: ; 0x0232A834
add r3, r3, #4
mov r1, r3, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r0, #0
add r1, sp, #8
mov r2, r0
Expand Down Expand Up @@ -528,7 +528,7 @@ _0232AA28:
mov r0, sb
mov r1, r5
mov r2, r4
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
mov r0, fp
bl AdvanceFrame
add r6, r6, #1
Expand Down Expand Up @@ -627,7 +627,7 @@ _0232ABA0:
mov r0, sb
mov r1, r5
mov r2, r6
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
mov r0, r4
bl AdvanceFrame
add r7, r7, #1
Expand Down
16 changes: 8 additions & 8 deletions asm/overlay_29_023456BC.s
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ SpawnDroppedItemWrapper: ; 0x02345A3C
add r3, r3, #4
mov r1, r3, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r0, #0
strh r0, [sp, #0x2e]
str r0, [sp]
Expand Down Expand Up @@ -595,7 +595,7 @@ _02345E90:
mov r1, r7
mov r2, r8
str r5, [sl, #0x1c]
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r6, #0
_02345EE0:
sub r5, r5, #0x800
Expand All @@ -614,7 +614,7 @@ _02345EE0:
mov r0, sl
mov r1, r7
mov r2, r8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r2, #0
str r2, [sl, #0x1c]
mov r0, sl
Expand Down Expand Up @@ -1057,7 +1057,7 @@ _023464C4:
add r2, r2, #4
mov r1, r1, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r0, #0
strh r0, [r6, #0x26]
mov r0, r8, lsl #2
Expand Down Expand Up @@ -1156,7 +1156,7 @@ _0234665C:
ldr r1, [r1, r8, lsl #3]
ldr r2, [r2, #4]
str r0, [sp, #0xc]
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
mov r0, fp
bl sub_020018D0
mov r1, #0xc
Expand Down Expand Up @@ -2368,7 +2368,7 @@ _023474CC:
mov r0, sl
mov r1, r8
mov r2, sb
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r5, #0
str r5, [sl, #0x1c]
cmp r4, #0
Expand Down Expand Up @@ -2439,7 +2439,7 @@ ov29_02347518: ; 0x02347518
add r1, r3, #4
mov r1, r1, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
#ifdef JAPAN
mov r0, #0
#else
Expand Down Expand Up @@ -2623,7 +2623,7 @@ _02347750:
#else
mov r2, fp
#endif
bl ov29_022E1A90
bl IncrementEntityPixelPosXY
bl IsWaterTileset
cmp r0, #0
ldr r0, [r4, #0xd8]
Expand Down
4 changes: 2 additions & 2 deletions asm/overlay_29_02347BC8.s
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ov29_02347BC8: ; 0x02347BC8
add r3, r3, #4
mov r1, r3, lsl #8
mov r2, r2, lsl #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
mov r0, r5
str r0, [sp, #0x2c]
strh r0, [r4, #0xf2]
Expand Down Expand Up @@ -137,7 +137,7 @@ _02347D84:
add r8, r8, r0
add r0, r4, #0xcc
mov fp, r6, asr #8
bl ov29_022E1A84
bl SetEntityPixelPosXY
bl IsWaterTileset
cmp r0, #0
ldr r1, [sp, #0x34]
Expand Down
3 changes: 3 additions & 0 deletions include/dg_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
// entity: entity pointer
// return: bool
u8 EntityIsValid__022E1A1C(struct entity *entity);
void UpdateEntityPixelPos(struct entity *entity, struct pixel_position *pixel_pos);
void SetEntityPixelPosXY(struct entity *entity, u32 x, u32 y);
void IncrementEntityPixelPosXY(struct entity *entity, u32 x, u32 y);

#endif //PMDSKY_OVERLAY_29_022E1A1C_H
2 changes: 1 addition & 1 deletion main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Overlay OVY_29
Object src/dg.o
Object asm/overlay_29_022E0378.o
Object src/dg_object.o
Object asm/overlay_29_022E1A40.o
Object asm/overlay_29_022E1AAC.o
Object src/dg_camera.o
Object asm/overlay_29_022E330C.o
Object src/dg_effect.o
Expand Down
24 changes: 24 additions & 0 deletions src/dg_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,27 @@ u8 EntityIsValid__022E1A1C(struct entity *entity)
}
return entity->type != ENTITY_NOTHING;
}

void UpdateEntityPixelPos(struct entity *entity, struct pixel_position *pixel_pos)
{
if (pixel_pos != 0) {
entity->pixel_pos.x = pixel_pos->x;
entity->pixel_pos.y = pixel_pos->y;
}
else {
entity->pixel_pos.x = ((((entity->pos.x)*0x18)+0x0c)<<8);
entity->pixel_pos.y = ((((entity->pos.y)*0x18)+0x10)<<8);
}
}

void SetEntityPixelPosXY(struct entity *entity, u32 x, u32 y)
{
entity->pixel_pos.x = x;
entity->pixel_pos.y = y;
}

void IncrementEntityPixelPosXY(struct entity *entity, u32 x, u32 y)
{
entity->pixel_pos.x += x;
entity->pixel_pos.y += y;
}

0 comments on commit 394d16f

Please sign in to comment.