mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
LookRandomDirections helpers
This commit is contained in:
parent
2895765964
commit
c1c12981fe
@ -5,143 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_808F988
|
||||
@ bool8 sub_808F988(struct npc_state *fieldObject, struct obj *object)
|
||||
sub_808F988: @ 808F988
|
||||
push {r4,lr}
|
||||
adds r4, r1, 0
|
||||
bl npc_reset
|
||||
movs r0, 0x1
|
||||
strh r0, [r4, 0x30]
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808F988
|
||||
|
||||
thumb_func_start sub_808F99C
|
||||
@ bool8 sub_808F99C(struct npc_state *fieldObject, struct obj *object)
|
||||
sub_808F99C: @ 808F99C
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldrb r0, [r4, 0x18]
|
||||
lsls r0, 28
|
||||
lsrs r0, 28
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
movs r0, 0x2
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808F99C
|
||||
|
||||
thumb_func_start sub_808F9C8
|
||||
@ bool8 sub_808F9C8(struct npc_state *fieldObject, struct obj *object)
|
||||
sub_808F9C8: @ 808F9C8
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r7, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0808F9FE
|
||||
ldr r4, =gUnknown_0850D6DC
|
||||
bl Random
|
||||
movs r5, 0x3
|
||||
adds r1, r5, 0
|
||||
ands r1, r0
|
||||
lsls r1, 1
|
||||
adds r1, r4
|
||||
movs r0, 0
|
||||
ldrsh r1, [r1, r0]
|
||||
adds r0, r7, 0
|
||||
bl sub_8097978
|
||||
ldrb r1, [r6]
|
||||
movs r0, 0x3
|
||||
negs r0, r0
|
||||
ands r0, r1
|
||||
strb r0, [r6]
|
||||
strh r5, [r7, 0x30]
|
||||
_0808F9FE:
|
||||
movs r0, 0
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_808F9C8
|
||||
|
||||
thumb_func_start sub_808FA0C
|
||||
@ bool8 sub_808FA0C(struct npc_state *fieldObject, struct obj *object)
|
||||
sub_808FA0C: @ 808FA0C
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
adds r0, r5, 0
|
||||
bl sub_809797C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0808FA2A
|
||||
adds r0, r4, 0
|
||||
bl FieldObjectIsTrainerAndCloseToPlayer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0808FA32
|
||||
_0808FA2A:
|
||||
movs r0, 0x4
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
b _0808FA34
|
||||
_0808FA32:
|
||||
movs r0, 0
|
||||
_0808FA34:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808FA0C
|
||||
|
||||
thumb_func_start sub_808FA3C
|
||||
@ bool8 sub_808FA3C(struct npc_state *fieldObject, struct obj *object)
|
||||
sub_808FA3C: @ 808FA3C
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldr r1, =gUnknown_0850D710
|
||||
mov r0, sp
|
||||
movs r2, 0x4
|
||||
bl memcpy
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
bl sub_808F8BC
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0
|
||||
bne _0808FA6C
|
||||
bl Random
|
||||
movs r1, 0x3
|
||||
ands r1, r0
|
||||
mov r2, sp
|
||||
adds r0, r2, r1
|
||||
ldrb r1, [r0]
|
||||
_0808FA6C:
|
||||
adds r0, r4, 0
|
||||
bl FieldObjectSetDirection
|
||||
movs r0, 0x1
|
||||
strh r0, [r5, 0x30]
|
||||
add sp, 0x4
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_808FA3C
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyGoNorthOrSouth
|
||||
FieldObjectCB_RandomlyGoNorthOrSouth: @ 808FA84
|
||||
push {lr}
|
||||
|
@ -2053,3 +2053,54 @@ u8 sub_808F8BC(struct MapObject *mapObject, u8 movementType)
|
||||
}
|
||||
|
||||
field_object_step(LookRandomDirections, gUnknown_0850D740)
|
||||
|
||||
bool8 sub_808F988(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
npc_reset(mapObject, sprite);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808F99C(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808F9C8(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (FieldObjectExecRegularAnim(mapObject, sprite))
|
||||
{
|
||||
sub_8097978(sprite, gUnknown_0850D6DC[Random() & 0x03]);
|
||||
mapObject->mapobj_bit_1 = FALSE;
|
||||
sprite->data1 = 3;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_808FA0C(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (sub_809797C(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
|
||||
{
|
||||
sprite->data1 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_808FA3C(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u8 directions[4];
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D710, sizeof directions);
|
||||
direction = sub_808F8BC(mapObject, 0);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x03];
|
||||
}
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user