a block of direction-based anim num fns

This commit is contained in:
PikalaxALT 2017-09-16 17:41:46 -04:00
parent 34950dbd13
commit fa436fca4d
2 changed files with 34 additions and 188 deletions

View File

@ -5,192 +5,6 @@
.text
thumb_func_start npc_reset
@ void npc_reset(struct npc_state *fieldObject, struct obj *object)
npc_reset: @ 809293C
ldrb r3, [r0]
movs r2, 0x3
negs r2, r2
ands r2, r3
movs r3, 0x41
negs r3, r3
ands r2, r3
movs r3, 0x7F
ands r2, r3
strb r2, [r0]
movs r2, 0xFF
strb r2, [r0, 0x1C]
movs r0, 0
strh r0, [r1, 0x30]
bx lr
thumb_func_end npc_reset
thumb_func_start FieldObjectDirectionToImageAnimId
@ u8 FieldObjectDirectionToImageAnimId(u8 direction)
FieldObjectDirectionToImageAnimId: @ 809295C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DACC
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end FieldObjectDirectionToImageAnimId
thumb_func_start get_go_image_anim_num
get_go_image_anim_num: @ 809296C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DAD5
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end get_go_image_anim_num
thumb_func_start get_go_fast_image_anim_num
get_go_fast_image_anim_num: @ 809297C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DADE
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end get_go_fast_image_anim_num
thumb_func_start get_go_faster_image_anim_num
get_go_faster_image_anim_num: @ 809298C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DAE7
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end get_go_faster_image_anim_num
thumb_func_start get_go_fastest_image_anim_num
get_go_fastest_image_anim_num: @ 809299C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DAF0
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end get_go_fastest_image_anim_num
thumb_func_start sub_80929AC
sub_80929AC: @ 80929AC
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DAF9
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80929AC
thumb_func_start sub_80929BC
sub_80929BC: @ 80929BC
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB02
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80929BC
thumb_func_start sub_80929CC
sub_80929CC: @ 80929CC
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB0B
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80929CC
thumb_func_start sub_80929DC
sub_80929DC: @ 80929DC
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB14
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80929DC
thumb_func_start sub_80929EC
sub_80929EC: @ 80929EC
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB1D
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80929EC
thumb_func_start sub_80929FC
sub_80929FC: @ 80929FC
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB26
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80929FC
thumb_func_start sub_8092A0C
sub_8092A0C: @ 8092A0C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB2F
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_8092A0C
thumb_func_start sub_8092A1C
sub_8092A1C: @ 8092A1C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB38
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_8092A1C
thumb_func_start sub_8092A2C
sub_8092A2C: @ 8092A2C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB41
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_8092A2C
thumb_func_start get_run_image_anim_num
get_run_image_anim_num: @ 8092A3C
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_0850DB4A
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end get_run_image_anim_num
thumb_func_start sub_8092A4C
sub_8092A4C: @ 8092A4C
push {lr}

View File

@ -3507,6 +3507,38 @@ bool8 sub_809292C(struct MapObject *mapObject, struct Sprite *sprite)
return FALSE;
}
void npc_reset(struct MapObject *mapObject, struct Sprite *sprite)
{
mapObject->mapobj_bit_1 = FALSE;
mapObject->mapobj_bit_6 = FALSE;
mapObject->mapobj_bit_7 = FALSE;
mapObject->mapobj_unk_1C = 0xFF;
sprite->data1 = 0;
}
#define dirn2anim(name, table)\
extern const u8 table[4];\
u8 name(u8 direction)\
{\
return table[direction];\
}
dirn2anim(FieldObjectDirectionToImageAnimId, gUnknown_0850DACC)
dirn2anim(get_go_image_anim_num, gUnknown_0850DAD5)
dirn2anim(get_go_fast_image_anim_num, gUnknown_0850DADE)
dirn2anim(get_go_faster_image_anim_num, gUnknown_0850DAE7)
dirn2anim(get_go_fastest_image_anim_num, gUnknown_0850DAF0)
dirn2anim(sub_80929AC, gUnknown_0850DAF9)
dirn2anim(sub_80929BC, gUnknown_0850DB02)
dirn2anim(sub_80929CC, gUnknown_0850DB0B)
dirn2anim(sub_80929DC, gUnknown_0850DB14)
dirn2anim(sub_80929EC, gUnknown_0850DB1D)
dirn2anim(sub_80929FC, gUnknown_0850DB26)
dirn2anim(sub_8092A0C, gUnknown_0850DB2F)
dirn2anim(sub_8092A1C, gUnknown_0850DB38)
dirn2anim(sub_8092A2C, gUnknown_0850DB41)
dirn2anim(get_run_image_anim_num, gUnknown_0850DB4A)
asm(".section .text.get_face_direction_anim_id");
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
@ -3560,7 +3592,7 @@ void FieldObjectStep(struct MapObject *mapObject, struct Sprite *sprite, bool8 (
FieldObjectUpdateSubpriority(mapObject, sprite);
}
#define dirn2anim(name, table) \
#define dirn2anim_2(name, table) \
extern const u8 table[5]; \
u8 name(u32 direction) \
{ \
@ -3575,4 +3607,4 @@ u8 name(u32 direction) \
return animIds[dirn2]; \
}
dirn2anim(GetFaceDirectionAnimId, gUnknown_0850DBA0);
dirn2anim_2(GetFaceDirectionAnimId, gUnknown_0850DBA0);