mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
RandomlyLookNorthOrSouth
This commit is contained in:
parent
9f6a4be9f0
commit
7440bba1b1
@ -5,174 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookNorthOrSouth
|
||||
FieldObjectCB_RandomlyLookNorthOrSouth: @ 8090050
|
||||
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_RandomlyLookNorthOrSouth
|
||||
bl FieldObjectStep
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end FieldObjectCB_RandomlyLookNorthOrSouth
|
||||
|
||||
thumb_func_start FieldObjectCB2_RandomlyLookNorthOrSouth
|
||||
FieldObjectCB2_RandomlyLookNorthOrSouth: @ 8090074
|
||||
push {r4,lr}
|
||||
ldr r3, =gUnknown_0850D7B4
|
||||
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_RandomlyLookNorthOrSouth
|
||||
|
||||
thumb_func_start sub_8090094
|
||||
sub_8090094: @ 8090094
|
||||
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_8090094
|
||||
|
||||
thumb_func_start sub_80900A8
|
||||
sub_80900A8: @ 80900A8
|
||||
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_80900A8
|
||||
|
||||
thumb_func_start sub_80900D4
|
||||
sub_80900D4: @ 80900D4
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r7, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809010A
|
||||
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]
|
||||
_0809010A:
|
||||
movs r0, 0
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_80900D4
|
||||
|
||||
thumb_func_start sub_8090118
|
||||
sub_8090118: @ 8090118
|
||||
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 _08090136
|
||||
adds r0, r4, 0
|
||||
bl FieldObjectIsTrainerAndCloseToPlayer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809013E
|
||||
_08090136:
|
||||
movs r0, 0x4
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
b _08090140
|
||||
_0809013E:
|
||||
movs r0, 0
|
||||
_08090140:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8090118
|
||||
|
||||
thumb_func_start sub_8090148
|
||||
sub_8090148: @ 8090148
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldr r1, =gUnknown_0850D770
|
||||
mov r0, sp
|
||||
movs r2, 0x2
|
||||
bl memcpy
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl GetRunningPastFacingDirection
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0
|
||||
bne _08090178
|
||||
bl Random
|
||||
movs r1, 0x1
|
||||
ands r1, r0
|
||||
mov r2, sp
|
||||
adds r0, r2, r1
|
||||
ldrb r1, [r0]
|
||||
_08090178:
|
||||
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_8090148
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookEastOrWest
|
||||
FieldObjectCB_RandomlyLookEastOrWest: @ 8090190
|
||||
push {lr}
|
||||
|
@ -2380,3 +2380,56 @@ bool8 sub_8090004 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
field_object_step(RandomlyLookNorthOrSouth, gUnknown_0850D7B4)
|
||||
|
||||
bool8 sub_8090094 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
npc_reset(mapObject, sprite);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_80900A8 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_80900D4 (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_8090118 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (RunFieldObjectStepTimer(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
|
||||
{
|
||||
sprite->data1 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8090148 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u8 directions[2];
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D770, sizeof gUnknown_0850D770);
|
||||
direction = GetRunningPastFacingDirection(mapObject, 1);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
}
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user