mirror of https://github.com/pret/pokeemerald.git
npc_apply_direction
This commit is contained in:
parent
8e03a0199c
commit
432924e56d
|
@ -5,84 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start npc_apply_direction
|
||||
@ void npc_apply_direction(struct npc_state *fieldObject, struct obj *object, u8 direction, u8 speed)
|
||||
npc_apply_direction: @ 8093990
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
adds r4, r2, 0
|
||||
adds r6, r3, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
lsls r6, 24
|
||||
lsrs r6, 24
|
||||
ldrh r1, [r7, 0x10]
|
||||
mov r0, sp
|
||||
strh r1, [r0]
|
||||
ldrh r0, [r7, 0x12]
|
||||
mov r5, sp
|
||||
adds r5, 0x2
|
||||
strh r0, [r5]
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl FieldObjectSetDirection
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
adds r2, r5, 0
|
||||
bl MoveCoords
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, 0
|
||||
ldrsh r2, [r5, r0]
|
||||
adds r0, r7, 0
|
||||
bl npc_coords_shift
|
||||
mov r0, r8
|
||||
adds r1, r4, 0
|
||||
adds r2, r6, 0
|
||||
bl oamt_npc_ministep_reset
|
||||
mov r4, r8
|
||||
adds r4, 0x2C
|
||||
ldrb r1, [r4]
|
||||
movs r0, 0x41
|
||||
negs r0, r0
|
||||
ands r0, r1
|
||||
strb r0, [r4]
|
||||
ldr r0, =gUnknown_020375B8
|
||||
ldr r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08093A0E
|
||||
adds r0, r7, 0
|
||||
bl sub_8097F78
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x10
|
||||
beq _08093A0E
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x40
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
_08093A0E:
|
||||
ldrb r0, [r7]
|
||||
movs r1, 0x4
|
||||
orrs r0, r1
|
||||
strb r0, [r7]
|
||||
movs r0, 0x1
|
||||
mov r1, r8
|
||||
strh r0, [r1, 0x32]
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end npc_apply_direction
|
||||
|
||||
thumb_func_start do_go_anim
|
||||
@ void do_go_anim(struct npc_state *fieldObject, struct obj *object, u8 direction, u8 speed)
|
||||
do_go_anim: @ 8093A2C
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
// Exported type declarations
|
||||
|
||||
// Exported RAM declarations
|
||||
extern void *gUnknown_020375B8;
|
||||
|
||||
// Exported ROM declarations
|
||||
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 *);
|
||||
|
||||
#endif //GUARD_MAP_OBJ_8097404_H
|
||||
|
|
|
@ -4154,3 +4154,23 @@ bool8 sub_8093980(struct MapObject *mapObject, struct Sprite *sprite)
|
|||
an_look_any(mapObject, sprite, DIR_EAST);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void npc_apply_direction(struct MapObject *mapObject, struct Sprite *sprite, u8 direction, u8 speed)
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
x = mapObject->coords2.x;
|
||||
y = mapObject->coords2.y;
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
MoveCoords(direction, &x, &y);
|
||||
npc_coords_shift(mapObject, x, y);
|
||||
oamt_npc_ministep_reset(sprite, direction, speed);
|
||||
sprite->animPaused = FALSE;
|
||||
if (gUnknown_020375B8 != NULL && sub_8097F78(mapObject) != 0x10)
|
||||
{
|
||||
sprite->animPaused = TRUE;
|
||||
}
|
||||
mapObject->mapobj_bit_2 = TRUE;
|
||||
sprite->data2 = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue