diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 7aa32c862..25ec2cc28 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,39 +5,6 @@ .text - thumb_func_start npc_obj_ministep_stop_on_arrival -@ bool8 npc_obj_ministep_stop_on_arrival(struct npc_state *fieldObject, struct obj *object) -npc_obj_ministep_stop_on_arrival: @ 8093AB8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r0, r5, 0 - bl obj_npc_ministep - lsls r0, 24 - cmp r0, 0 - bne _08093ACE - movs r0, 0 - b _08093AEA -_08093ACE: - adds r0, r4, 0 - bl npc_coords_shift_still - ldrb r0, [r4] - movs r1, 0x8 - orrs r0, r1 - strb r0, [r4] - adds r2, r5, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x1 -_08093AEA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end npc_obj_ministep_stop_on_arrival - thumb_func_start sub_8093AF0 @ void sub_8093AF0(struct npc_state *fieldObject, struct obj *object, u8 direction) sub_8093AF0: @ 8093AF0 diff --git a/include/field_ground_effect.h b/include/field_ground_effect.h index b7242ee7c..63b67ceaf 100644 --- a/include/field_ground_effect.h +++ b/include/field_ground_effect.h @@ -14,5 +14,9 @@ void SetObjectSubpriorityByZCoord(u8, struct Sprite *, u8); void InitObjectPriorityByZCoord(struct Sprite *, u8); bool8 IsZCoordMismatchAt(u8, s16, s16); bool8 AreZCoordsCompatible(u8, u8); +void FieldObjectUpdateSubpriority(struct MapObject *, struct Sprite *); +void DoGroundEffects_OnSpawn(struct MapObject *, struct Sprite *); +void DoGroundEffects_OnBeginStep(struct MapObject *, struct Sprite *); +void DoGroundEffects_OnFinishStep(struct MapObject *, struct Sprite *); #endif //GUARD_FIELD_GROUND_EFFECT_H diff --git a/include/field_map_obj.h b/include/field_map_obj.h index 23749c91a..40cc64054 100755 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -39,6 +39,7 @@ void sub_8092FF0(s16, s16, s16 *, s16 *); u8 FieldObjectDirectionToImageAnimId(u8); void sub_80930E0(s16 *, s16 *, s16, s16); void FieldObjectClearAnim(struct MapObject *); +void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *); void SpawnFieldObjectsInView(s16, s16); u8 sprite_new(u8, u8, s16, s16, u8, u8); u8 AddPseudoFieldObject(u16, void (*)(struct Sprite *), s16, s16, u8); @@ -69,6 +70,7 @@ u8 GetStepInPlaceDelay16AnimId(u32); u8 GetStepInPlaceDelay32AnimId(u32); u8 npc_block_way(struct MapObject *, s16, s16, u32); void MoveCoords(u8, s16 *, s16 *); +bool8 FieldObjectIsSpecialAnimActive(struct MapObject *); // Exported data declarations diff --git a/include/map_obj_8097404.h b/include/map_obj_8097404.h index afa7a3bae..e5e6fba70 100644 --- a/include/map_obj_8097404.h +++ b/include/map_obj_8097404.h @@ -15,5 +15,6 @@ void sub_8097AC8(struct Sprite *); void npc_sync_anim_pause_bits(struct MapObject *); void oamt_npc_ministep_reset(struct Sprite *, u8, u8); u8 sub_8097F78(struct MapObject *); +bool8 obj_npc_ministep(struct Sprite *sprite); #endif //GUARD_MAP_OBJ_8097404_H diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 5e32d7330..cd840ba70 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -112,21 +112,14 @@ bool8 FieldObjectExecRegularAnim(struct MapObject *, struct Sprite *); void SetFieldObjectStepTimer(struct Sprite *, s16); bool8 RunFieldObjectStepTimer(struct Sprite *); bool8 npc_block_way__next_tile(struct MapObject *, u8); -u32 state_to_direction(u8, u32, u32); -void DoGroundEffects_OnSpawn(struct MapObject *, struct Sprite *); -void sub_80964E8(struct MapObject *, struct Sprite *); -bool8 FieldObjectIsSpecialAnimActive(struct MapObject *); -void FieldObjectExecSpecialAnim(struct MapObject *, struct Sprite *); -void DoGroundEffects_OnBeginStep(struct MapObject *, struct Sprite *); -void DoGroundEffects_OnFinishStep(struct MapObject *, struct Sprite *); -void npc_obj_transfer_image_anim_pause_flag(struct MapObject *, struct Sprite *); -void FieldObjectUpdateSubpriority(struct MapObject *, struct Sprite *); +static u32 state_to_direction(u8, u32, u32); +/*static*/ void sub_80964E8(struct MapObject *, struct Sprite *); +static void FieldObjectExecSpecialAnim(struct MapObject *, struct Sprite *); +/*static*/ void npc_obj_transfer_image_anim_pause_flag(struct MapObject *, struct Sprite *); -bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *fieldObject, s16 x, s16 y); -bool8 IsMetatileDirectionallyImpassable(struct MapObject *, s16, s16, u8); -bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *, s16, s16); -void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *); -void FieldObjectClearAnim(struct MapObject *); +static bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *, s16, s16); +static bool8 IsMetatileDirectionallyImpassable(struct MapObject *, s16, s16, u8); +static bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *, s16, s16); // ROM data @@ -3708,7 +3701,7 @@ u8 sub_8092C8C(struct MapObject *mapObject, s16 x, s16 y, u8 direction) return retval; } -bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, s16 y) +static bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, s16 y) { s16 left; s16 right; @@ -3736,7 +3729,7 @@ bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, return FALSE; } -bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 y, u8 direction) +static bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 y, u8 direction) { if (gUnknown_0850DB5C[direction - 1](mapObject->mapobj_unk_1E) || gUnknown_0850DB6C[direction - 1](MapGridGetMetatileBehaviorAt(x, y))) { @@ -3745,7 +3738,7 @@ bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 return FALSE; } -bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *mapObject, s16 x, s16 y) +static bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *mapObject, s16 x, s16 y) { u8 i; struct MapObject *curObject; @@ -4074,12 +4067,12 @@ u8 GetOppositeDirection(u8 direction) return directions[direction - 1]; } -u32 zffu_offset_calc(u8 a0, u8 a1) +static u32 zffu_offset_calc(u8 a0, u8 a1) { return gUnknown_0850DC2F[a0 - 1][a1 - 1]; } -u32 state_to_direction(u8 a0, u32 a1, u32 a2) +static u32 state_to_direction(u8 a0, u32 a1, u32 a2) { u32 zffuOffset; u8 a1_2; @@ -4095,7 +4088,7 @@ u32 state_to_direction(u8 a0, u32 a1, u32 a2) return gUnknown_0850DC3F[a0 - 1][zffuOffset - 1]; } -void FieldObjectExecSpecialAnim(struct MapObject *mapObject, struct Sprite *sprite) +static void FieldObjectExecSpecialAnim(struct MapObject *mapObject, struct Sprite *sprite) { if (gUnknown_0850DC50[mapObject->mapobj_unk_1C][sprite->data2](mapObject, sprite)) { @@ -4189,3 +4182,15 @@ void do_run_anim(struct MapObject *mapObject, struct Sprite *sprite, u8 directio npc_apply_direction(mapObject, sprite, direction, 1); npc_apply_anim_looping(mapObject, sprite, get_run_image_anim_num(mapObject->mapobj_unk_18)); } + +bool8 npc_obj_ministep_stop_on_arrival(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (obj_npc_ministep(sprite)) + { + npc_coords_shift_still(mapObject); + mapObject->mapobj_bit_3 = TRUE; + sprite->animPaused = TRUE; + return TRUE; + } + return FALSE; +}