From f5be0f933e5debf150fdb4369c0e573117b96b7d Mon Sep 17 00:00:00 2001 From: chordtoll Date: Sun, 13 Oct 2024 23:47:31 -0700 Subject: [PATCH] Decompile dg_object functions --- ...9_022E1A40.inc => overlay_29_022E1AAC.inc} | 15 ++++--- ...ay_29_022E1A40.s => overlay_29_022E1AAC.s} | 42 +------------------ include/dg_object.h | 3 ++ main.lsf | 2 +- src/dg_object.c | 24 +++++++++++ 5 files changed, 36 insertions(+), 50 deletions(-) rename asm/include/{overlay_29_022E1A40.inc => overlay_29_022E1AAC.inc} (98%) rename asm/{overlay_29_022E1A40.s => overlay_29_022E1AAC.s} (97%) diff --git a/asm/include/overlay_29_022E1A40.inc b/asm/include/overlay_29_022E1AAC.inc similarity index 98% rename from asm/include/overlay_29_022E1A40.inc rename to asm/include/overlay_29_022E1AAC.inc index 1d7d3d1f..fdb5119f 100644 --- a/asm/include/overlay_29_022E1A40.inc +++ b/asm/include/overlay_29_022E1AAC.inc @@ -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 @@ -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 @@ -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 diff --git a/asm/overlay_29_022E1A40.s b/asm/overlay_29_022E1AAC.s similarity index 97% rename from asm/overlay_29_022E1A40.s rename to asm/overlay_29_022E1AAC.s index caf4100a..db2765a0 100644 --- a/asm/overlay_29_022E1A40.s +++ b/asm/overlay_29_022E1AAC.s @@ -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} diff --git a/include/dg_object.h b/include/dg_object.h index c9bee943..cf59b0ef 100644 --- a/include/dg_object.h +++ b/include/dg_object.h @@ -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 ov29_022E1A84(struct entity *entity, u32 x, u32 y); +void ov29_022E1A84(struct entity *entity, u32 x, u32 y); #endif //PMDSKY_OVERLAY_29_022E1A1C_H diff --git a/main.lsf b/main.lsf index 992556e0..6030d5c0 100644 --- a/main.lsf +++ b/main.lsf @@ -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 diff --git a/src/dg_object.c b/src/dg_object.c index b3cf702d..06f7951c 100644 --- a/src/dg_object.c +++ b/src/dg_object.c @@ -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 ov29_022E1A84(struct entity *entity, u32 x, u32 y) +{ + entity->pixel_pos.x = x; + entity->pixel_pos.y = y; +} + +void ov29_022E1A84(struct entity *entity, u32 x, u32 y) +{ + entity->pixel_pos.x += x; + entity->pixel_pos.y += y; +}