mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 17:34:20 +01:00
RandomlyLookNorthOrEast
This commit is contained in:
parent
0571056955
commit
8c6367f997
@ -5,174 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookNorthOrEast
|
||||
FieldObjectCB_RandomlyLookNorthOrEast: @ 8090410
|
||||
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_8090434
|
||||
bl FieldObjectStep
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end FieldObjectCB_RandomlyLookNorthOrEast
|
||||
|
||||
thumb_func_start sub_8090434
|
||||
sub_8090434: @ 8090434
|
||||
push {r4,lr}
|
||||
ldr r3, =gUnknown_0850D7F4
|
||||
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_8090434
|
||||
|
||||
thumb_func_start sub_8090454
|
||||
sub_8090454: @ 8090454
|
||||
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_8090454
|
||||
|
||||
thumb_func_start sub_8090468
|
||||
sub_8090468: @ 8090468
|
||||
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_8090468
|
||||
|
||||
thumb_func_start sub_8090494
|
||||
sub_8090494: @ 8090494
|
||||
push {r4-r7,lr}
|
||||
adds r6, r0, 0
|
||||
adds r7, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080904CA
|
||||
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]
|
||||
_080904CA:
|
||||
movs r0, 0
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8090494
|
||||
|
||||
thumb_func_start sub_80904D8
|
||||
sub_80904D8: @ 80904D8
|
||||
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 _080904F6
|
||||
adds r0, r4, 0
|
||||
bl FieldObjectIsTrainerAndCloseToPlayer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080904FE
|
||||
_080904F6:
|
||||
movs r0, 0x4
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
b _08090500
|
||||
_080904FE:
|
||||
movs r0, 0
|
||||
_08090500:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80904D8
|
||||
|
||||
thumb_func_start sub_8090508
|
||||
sub_8090508: @ 8090508
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldr r1, =gUnknown_0850D808
|
||||
mov r0, sp
|
||||
movs r2, 0x2
|
||||
bl memcpy
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x4
|
||||
bl GetRunningPastFacingDirection
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0
|
||||
bne _08090538
|
||||
bl Random
|
||||
movs r1, 0x1
|
||||
ands r1, r0
|
||||
mov r2, sp
|
||||
adds r0, r2, r1
|
||||
ldrb r1, [r0]
|
||||
_08090538:
|
||||
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_8090508
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyLookSouthOrWest
|
||||
FieldObjectCB_RandomlyLookSouthOrWest: @ 8090550
|
||||
push {lr}
|
||||
|
@ -23,5 +23,6 @@ extern const u8 gUnknown_0850D710[4]; // {DIR_SOUTH, DIR_NORTH, DIR_WEST, DIR_EA
|
||||
extern const u8 gUnknown_0850D770[2]; // {DIR_SOUTH, DIR_NORTH}
|
||||
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}
|
||||
|
||||
#endif //POKEEMERALD_DATA3_H
|
||||
|
@ -6,6 +6,20 @@
|
||||
|
||||
// Exported struct declarations
|
||||
|
||||
enum SpinnerRunnerFollowPatterns {
|
||||
RUNFOLLOW_ANY,
|
||||
RUNFOLLOW_NORTH_SOUTH,
|
||||
RUNFOLLOW_EAST_WEST,
|
||||
RUNFOLLOW_NORTH_WEST,
|
||||
RUNFOLLOW_NORTH_EAST,
|
||||
RUNFOLLOW_SOUTH_WEST,
|
||||
RUNFOLLOW_SOUTH_EAST,
|
||||
RUNFOLLOW_NORTH_SOUTH_WEST,
|
||||
RUNFOLLOW_NORTH_SOUTH_EAST,
|
||||
RUNFOLLOW_NORTH_EAST_WEST,
|
||||
RUNFOLLOW_SOUTH_EAST_WEST
|
||||
};
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
|
@ -2096,7 +2096,7 @@ bool8 sub_808FA3C(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D710, sizeof directions);
|
||||
direction = GetRunningPastFacingDirection(mapObject, 0);
|
||||
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_ANY);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x03];
|
||||
@ -2424,7 +2424,7 @@ bool8 sub_8090148 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D770, sizeof gUnknown_0850D770);
|
||||
direction = GetRunningPastFacingDirection(mapObject, 1);
|
||||
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_NORTH_SOUTH);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
@ -2477,7 +2477,7 @@ bool8 sub_8090288 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D790, sizeof gUnknown_0850D790);
|
||||
direction = GetRunningPastFacingDirection(mapObject, 2);
|
||||
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_EAST_WEST);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
@ -2530,7 +2530,60 @@ bool8 sub_80903C8 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D7F0, sizeof gUnknown_0850D7F0);
|
||||
direction = GetRunningPastFacingDirection(mapObject, 3);
|
||||
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_NORTH_WEST);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
}
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
field_object_step(RandomlyLookNorthOrEast, gUnknown_0850D7F4)
|
||||
|
||||
bool8 sub_8090454 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
npc_reset(mapObject, sprite);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8090468 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8090494 (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_80904D8 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (RunFieldObjectStepTimer(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
|
||||
{
|
||||
sprite->data1 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8090508 (struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u8 directions[2];
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D808, sizeof gUnknown_0850D808);
|
||||
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_NORTH_EAST);
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = directions[Random() & 0x01];
|
||||
|
Loading…
x
Reference in New Issue
Block a user