NoMovement1, GoRandomDirections

This commit is contained in:
scnorton 2017-09-13 09:41:11 -04:00
parent c8696f1552
commit 28b272bf52
3 changed files with 29 additions and 60 deletions

View file

@ -5,66 +5,6 @@
.text
thumb_func_start FieldObjectCB_NoMovement1
FieldObjectCB_NoMovement1: @ 808F3E0
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_NoMovement1
bl FieldObjectStep
pop {r0}
bx r0
.pool
thumb_func_end FieldObjectCB_NoMovement1
thumb_func_start FieldObjectCB2_NoMovement1
FieldObjectCB2_NoMovement1: @ 808F404
movs r0, 0
bx lr
thumb_func_end FieldObjectCB2_NoMovement1
thumb_func_start FieldObjectCB_GoRandomDirections
FieldObjectCB_GoRandomDirections: @ 808F408
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_GoRandomDirections
bl FieldObjectStep
pop {r0}
bx r0
.pool
thumb_func_end FieldObjectCB_GoRandomDirections
thumb_func_start FieldObjectCB2_GoRandomDirections
FieldObjectCB2_GoRandomDirections: @ 808F42C
push {r4,lr}
ldr r3, =gUnknown_0850D6F4
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_GoRandomDirections
thumb_func_start sub_808F44C
sub_808F44C: @ 808F44C
push {r4,lr}

View file

@ -47,6 +47,7 @@ void FieldObjectGetLocalIdAndMap(struct MapObject *, u8 *, u8 *, u8 *);
void npc_coords_shift(struct MapObject *, s16, s16);
void sub_808EB08(struct MapObject *, s16, s16);
void sub_808F254(u8, u8, u8);
void FieldObjectStep(struct MapObject *, struct Sprite *, bool8(struct MapObject *, struct Sprite *));
// Exported data declarations

View file

@ -20,6 +20,29 @@
#define NUM_FIELD_MAP_OBJECT_TEMPLATES 0x51
#define null_object_step(name, retval) \
static bool8 FieldObjectCB2_##name(struct MapObject *, struct Sprite *);\
void FieldObjectCB_##name(struct Sprite *sprite)\
{\
FieldObjectStep(&gMapObjects[sprite->data0], sprite, FieldObjectCB2_##name);\
}\
static bool8 FieldObjectCB2_##name(struct MapObject *mapObject, struct Sprite *sprite)\
{\
return (retval);\
}
#define field_object_step(name, table) \
extern bool8 (*const (table)[])(struct MapObject *, struct Sprite *);\
static bool8 FieldObjectCB2_##name(struct MapObject *, struct Sprite *);\
void FieldObjectCB_##name(struct Sprite *sprite)\
{\
FieldObjectStep(&gMapObjects[sprite->data0], sprite, FieldObjectCB2_##name);\
}\
static bool8 FieldObjectCB2_##name(struct MapObject *mapObject, struct Sprite *sprite)\
{\
return (table)[sprite->data1](mapObject, sprite);\
}
// Static struct declarations
// Static RAM declarations
@ -1692,3 +1715,8 @@ u16 npc_paltag_by_palslot(u8 palSlot)
}
return 0x11ff;
}
null_object_step(NoMovement1, FALSE)
field_object_step(GoRandomDirections, gUnknown_0850D6F4)