mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-29 14:53:55 +01:00
RandomlyLookEastOrWest
This commit is contained in:
parent
7440bba1b1
commit
bf101743c2
@ -5,174 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookEastOrWest
|
||||
FieldObjectCB_RandomlyLookEastOrWest: @ 8090190
|
||||
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, =FieldObjectCB2_RandomlyLookEastOrWest
|
||||
bl FieldObjectStep
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end FieldObjectCB_RandomlyLookEastOrWest
|
||||
|
||||
thumb_func_start FieldObjectCB2_RandomlyLookEastOrWest
|
||||
FieldObjectCB2_RandomlyLookEastOrWest: @ 80901B4
|
||||
push {r4,lr}
|
||||
ldr r3, =gUnknown_0850D7C8
|
||||
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 FieldObjectCB2_RandomlyLookEastOrWest
|
||||
|
||||
thumb_func_start sub_80901D4
|
||||
sub_80901D4: @ 80901D4
|
||||
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_80901D4
|
||||
|
||||
thumb_func_start sub_80901E8
|
||||
sub_80901E8: @ 80901E8
|
||||
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_80901E8
|
||||
|
||||
thumb_func_start sub_8090214
|
||||
sub_8090214: @ 8090214
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r7, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809024A
|
||||
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 SetFieldObjectStepTimer
|
||||
ldrb r1, [r6]
|
||||
movs r0, 0x3
|
||||
negs r0, r0
|
||||
ands r0, r1
|
||||
strb r0, [r6]
|
||||
strh r5, [r7, 0x30]
|
||||
_0809024A:
|
||||
movs r0, 0
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8090214
|
||||
|
||||
thumb_func_start sub_8090258
|
||||
sub_8090258: @ 8090258
|
||||
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 _08090276
|
||||
adds r0, r4, 0
|
||||
bl FieldObjectIsTrainerAndCloseToPlayer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809027E
|
||||
_08090276:
|
||||
movs r0, 0x4
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
b _08090280
|
||||
_0809027E:
|
||||
movs r0, 0
|
||||
_08090280:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8090258
|
||||
|
||||
thumb_func_start sub_8090288
|
||||
sub_8090288: @ 8090288
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldr r1, =gUnknown_0850D790
|
||||
mov r0, sp
|
||||
movs r2, 0x2
|
||||
bl memcpy
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x2
|
||||
bl GetRunningPastFacingDirection
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0
|
||||
bne _080902B8
|
||||
bl Random
|
||||
movs r1, 0x1
|
||||
ands r1, r0
|
||||
mov r2, sp
|
||||
adds r0, r2, r1
|
||||
ldrb r1, [r0]
|
||||
_080902B8:
|
||||
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_8090288
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookNorthOrWest
|
||||
FieldObjectCB_RandomlyLookNorthOrWest: @ 80902D0
|
||||
push {lr}
|
||||
|
@ -2433,3 +2433,56 @@ bool8 sub_8090148 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
field_object_step(RandomlyLookEastOrWest, gUnknown_0850D7C8)
|
||||
|
||||
bool8 sub_80901D4 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
npc_reset(mapObject, sprite);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_80901E8 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8090214 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (FieldObjectExecRegularAnim(mapObject, sprite))
|
||||
{
|
||||
SetFieldObjectStepTimer(sprite, gUnknown_0850D6DC[Random() & 0x03]);
|
||||
mapObject->mapobj_bit_1 = FALSE;
|
||||
sprite->data1 = 3;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8090258 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (RunFieldObjectStepTimer(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
|
||||
{
|
||||
sprite->data1 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8090288 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u8 directions[2];
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D790, sizeof gUnknown_0850D790);
|
||||
direction = GetRunningPastFacingDirection(mapObject, 2);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
}
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user