mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
RandomlyLookSouthOrEast
This commit is contained in:
parent
b269048369
commit
f6840ba7e7
@ -5,174 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookSouthOrEast
|
||||
FieldObjectCB_RandomlyLookSouthOrEast: @ 8090690
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
movs r0, 0x2E
|
||||
ldrsh r2, [r1, r0]
|
||||
lsls r0, r2, 3
|
||||
adds r0, r2
|
||||
lsls r0, 2
|
||||
ldr r2, =gMapObjects
|
||||
adds r0, r2
|
||||
ldr r2, =sub_80906B4
|
||||
bl FieldObjectStep
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end FieldObjectCB_RandomlyLookSouthOrEast
|
||||
|
||||
thumb_func_start sub_80906B4
|
||||
sub_80906B4: @ 80906B4
|
||||
push {r4,lr}
|
||||
ldr r3, =gUnknown_0850D824
|
||||
movs r4, 0x30
|
||||
ldrsh r2, [r1, r4]
|
||||
lsls r2, 2
|
||||
adds r2, r3
|
||||
ldr r2, [r2]
|
||||
bl _call_via_r2
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_80906B4
|
||||
|
||||
thumb_func_start sub_80906D4
|
||||
sub_80906D4: @ 80906D4
|
||||
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_80906D4
|
||||
|
||||
thumb_func_start sub_80906E8
|
||||
sub_80906E8: @ 80906E8
|
||||
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_80906E8
|
||||
|
||||
thumb_func_start sub_8090714
|
||||
sub_8090714: @ 8090714
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r7, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809074A
|
||||
ldr r4, =gUnknown_0850D6EC
|
||||
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 SetFieldObjectStepTimer
|
||||
ldrb r1, [r6]
|
||||
movs r0, 0x3
|
||||
negs r0, r0
|
||||
ands r0, r1
|
||||
strb r0, [r6]
|
||||
strh r5, [r7, 0x30]
|
||||
_0809074A:
|
||||
movs r0, 0
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8090714
|
||||
|
||||
thumb_func_start sub_8090758
|
||||
sub_8090758: @ 8090758
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
adds r0, r5, 0
|
||||
bl RunFieldObjectStepTimer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08090776
|
||||
adds r0, r4, 0
|
||||
bl FieldObjectIsTrainerAndCloseToPlayer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809077E
|
||||
_08090776:
|
||||
movs r0, 0x4
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
b _08090780
|
||||
_0809077E:
|
||||
movs r0, 0
|
||||
_08090780:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8090758
|
||||
|
||||
thumb_func_start sub_8090788
|
||||
sub_8090788: @ 8090788
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldr r1, =gUnknown_0850D838
|
||||
mov r0, sp
|
||||
movs r2, 0x2
|
||||
bl memcpy
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x6
|
||||
bl GetRunningPastFacingDirection
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0
|
||||
bne _080907B8
|
||||
bl Random
|
||||
movs r1, 0x1
|
||||
ands r1, r0
|
||||
mov r2, sp
|
||||
adds r0, r2, r1
|
||||
ldrb r1, [r0]
|
||||
_080907B8:
|
||||
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_8090788
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookNorthOrSouthOrWest
|
||||
FieldObjectCB_RandomlyLookNorthOrSouthOrWest: @ 80907D0
|
||||
push {lr}
|
||||
|
@ -25,5 +25,6 @@ extern const u8 gUnknown_0850D790[2]; // {DIR_WEST, DIR_EAST}
|
||||
extern const u8 gUnknown_0850D7F0[2]; // {DIR_NORTH, DIR_WEST}
|
||||
extern const u8 gUnknown_0850D808[2]; // {DIR_NORTH, DIR_EAST}
|
||||
extern const u8 gUnknown_0850D820[2]; // {DIR_SOUTH, DIR_WEST}
|
||||
extern const u8 gUnknown_0850D838[2]; // {DIR_SOUTH, DIR_EAST}
|
||||
|
||||
#endif //POKEEMERALD_DATA3_H
|
||||
|
@ -2645,3 +2645,56 @@ bool8 sub_8090648 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
field_object_step(RandomlyLookSouthOrEast, gUnknown_0850D824)
|
||||
|
||||
bool8 sub_80906D4 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
npc_reset(mapObject, sprite);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_80906E8 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8090714 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (FieldObjectExecRegularAnim(mapObject, sprite))
|
||||
{
|
||||
SetFieldObjectStepTimer(sprite, gUnknown_0850D6EC[Random() & 0x03]);
|
||||
mapObject->mapobj_bit_1 = FALSE;
|
||||
sprite->data1 = 3;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8090758 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (RunFieldObjectStepTimer(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
|
||||
{
|
||||
sprite->data1 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8090788 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u8 directions[2];
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D838, sizeof gUnknown_0850D838);
|
||||
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_SOUTH_EAST);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
}
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user