mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
RandomlyGoEastOrWest
This commit is contained in:
parent
4a1383d77b
commit
68c62595f5
@ -5,216 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldObjectCB_RandomlyGoEastOrWest
|
||||
FieldObjectCB_RandomlyGoEastOrWest: @ 808FC08
|
||||
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_RandomlyGoEastOrWest
|
||||
bl FieldObjectStep
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end FieldObjectCB_RandomlyGoEastOrWest
|
||||
|
||||
thumb_func_start FieldObjectCB2_RandomlyGoEastOrWest
|
||||
FieldObjectCB2_RandomlyGoEastOrWest: @ 808FC2C
|
||||
push {r4,lr}
|
||||
ldr r3, =gUnknown_0850D774
|
||||
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_RandomlyGoEastOrWest
|
||||
|
||||
thumb_func_start sub_808FC4C
|
||||
sub_808FC4C: @ 808FC4C
|
||||
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_808FC4C
|
||||
|
||||
thumb_func_start sub_808FC60
|
||||
sub_808FC60: @ 808FC60
|
||||
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_808FC60
|
||||
|
||||
thumb_func_start sub_808FC8C
|
||||
sub_808FC8C: @ 808FC8C
|
||||
push {r4-r6,lr}
|
||||
adds r6, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0808FCC0
|
||||
ldr r5, =gUnknown_0850D6DC
|
||||
bl Random
|
||||
movs r4, 0x3
|
||||
adds r1, r4, 0
|
||||
ands r1, r0
|
||||
lsls r1, 1
|
||||
adds r1, r5
|
||||
movs r0, 0
|
||||
ldrsh r1, [r1, r0]
|
||||
adds r0, r6, 0
|
||||
bl SetFieldObjectStepTimer
|
||||
strh r4, [r6, 0x30]
|
||||
movs r0, 0x1
|
||||
b _0808FCC2
|
||||
.pool
|
||||
_0808FCC0:
|
||||
movs r0, 0
|
||||
_0808FCC2:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808FC8C
|
||||
|
||||
thumb_func_start sub_808FCC8
|
||||
sub_808FCC8: @ 808FCC8
|
||||
push {r4,lr}
|
||||
adds r4, r1, 0
|
||||
adds r0, r4, 0
|
||||
bl RunFieldObjectStepTimer
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0808FCDC
|
||||
movs r0, 0
|
||||
b _0808FCE2
|
||||
_0808FCDC:
|
||||
movs r0, 0x4
|
||||
strh r0, [r4, 0x30]
|
||||
movs r0, 0x1
|
||||
_0808FCE2:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808FCC8
|
||||
|
||||
thumb_func_start sub_808FCE8
|
||||
sub_808FCE8: @ 808FCE8
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x4
|
||||
adds r5, r0, 0
|
||||
adds r6, r1, 0
|
||||
ldr r1, =gUnknown_0850D790
|
||||
mov r0, sp
|
||||
movs r2, 0x2
|
||||
bl memcpy
|
||||
bl Random
|
||||
movs r7, 0x1
|
||||
adds r1, r7, 0
|
||||
ands r1, r0
|
||||
mov r2, sp
|
||||
adds r0, r2, r1
|
||||
ldrb r4, [r0]
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl FieldObjectSetDirection
|
||||
movs r0, 0x5
|
||||
strh r0, [r6, 0x30]
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl npc_block_way__next_tile
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0808FD26
|
||||
strh r7, [r6, 0x30]
|
||||
_0808FD26:
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_808FCE8
|
||||
|
||||
thumb_func_start sub_808FD34
|
||||
sub_808FD34: @ 808FD34
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldrb r0, [r4, 0x18]
|
||||
lsrs r0, 4
|
||||
bl GetGoSpeed0AnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x6
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808FD34
|
||||
|
||||
thumb_func_start sub_808FD64
|
||||
sub_808FD64: @ 808FD64
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
bl FieldObjectExecRegularAnim
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0808FD82
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x3
|
||||
negs r1, r1
|
||||
ands r1, r0
|
||||
strb r1, [r4]
|
||||
movs r0, 0x1
|
||||
strh r0, [r5, 0x30]
|
||||
_0808FD82:
|
||||
movs r0, 0
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808FD64
|
||||
|
||||
thumb_func_start FieldObjectCB_FaceFixedDirection
|
||||
FieldObjectCB_FaceFixedDirection: @ 808FD8C
|
||||
push {lr}
|
||||
|
@ -20,5 +20,6 @@ extern const u16 *const gUnknown_0850BE38[2];
|
||||
extern const s16 gUnknown_0850D6DC[4]; // {0x20, 0x40, 0x60, 0x80}
|
||||
extern const u8 gUnknown_0850D710[4]; // {DIR_SOUTH, DIR_NORTH, DIR_WEST, DIR_EAST}
|
||||
extern const u8 gUnknown_0850D770[2]; // {DIR_SOUTH, DIR_NORTH}
|
||||
extern const u8 gUnknown_0850D790[2]; // {DIR_WEST, DIR_EAST}
|
||||
|
||||
#endif //POKEEMERALD_DATA3_H
|
||||
|
@ -2175,3 +2175,74 @@ bool8 sub_808FBE0(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
field_object_step(RandomlyGoEastOrWest, gUnknown_0850D774)
|
||||
|
||||
bool8 sub_808FC4C(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
npc_reset(mapObject, sprite);
|
||||
sprite->data1 = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808FC60(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808FC8C(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (!FieldObjectExecRegularAnim(mapObject, sprite))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
SetFieldObjectStepTimer(sprite, gUnknown_0850D6DC[Random() & 0x03]);
|
||||
sprite->data1 = 3;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808FCC8(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (RunFieldObjectStepTimer(sprite))
|
||||
{
|
||||
sprite->data1 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_808FCE8(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u8 directions[2];
|
||||
u8 direction;
|
||||
|
||||
memcpy(directions, gUnknown_0850D790, sizeof directions);
|
||||
direction = directions[Random() & 0x01];
|
||||
FieldObjectSetDirection(mapObject, direction);
|
||||
sprite->data1 = 5;
|
||||
if (npc_block_way__next_tile(mapObject, direction))
|
||||
{
|
||||
sprite->data1 = 1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808FD34(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(mapObject->placeholder18));
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 6;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_808FD64(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
if (FieldObjectExecRegularAnim(mapObject, sprite))
|
||||
{
|
||||
mapObject->mapobj_bit_1 = FALSE;
|
||||
sprite->data1 = 1;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user