obj_npc_animation_step, npc_apply_anim_looping
This commit is contained in:
parent
119c0e96b5
commit
589c34e30a
2 changed files with 50 additions and 84 deletions
|
@ -5,85 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start npc_apply_anim_looping
|
||||
@ void npc_apply_anim_looping(struct npc_state *fieldObject, struct obj *object, u8 anim)
|
||||
npc_apply_anim_looping: @ 8092A70
|
||||
push {r4,lr}
|
||||
adds r4, r1, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
ldrb r0, [r0, 0x1]
|
||||
lsls r0, 27
|
||||
cmp r0, 0
|
||||
blt _08092AB2
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x2A
|
||||
strb r2, [r0]
|
||||
ldr r0, [r4, 0x8]
|
||||
bl sub_8092A4C
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x2B
|
||||
cmp r0, 0
|
||||
beq _08092AAA
|
||||
ldrb r2, [r1]
|
||||
ldrb r3, [r0, 0x4]
|
||||
cmp r2, r3
|
||||
bne _08092AA0
|
||||
ldrb r0, [r0, 0x7]
|
||||
b _08092AA8
|
||||
_08092AA0:
|
||||
ldrb r3, [r0, 0x5]
|
||||
cmp r2, r3
|
||||
bne _08092AAA
|
||||
ldrb r0, [r0, 0x6]
|
||||
_08092AA8:
|
||||
strb r0, [r1]
|
||||
_08092AAA:
|
||||
ldrb r1, [r1]
|
||||
adds r0, r4, 0
|
||||
bl SeekSpriteAnim
|
||||
_08092AB2:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end npc_apply_anim_looping
|
||||
|
||||
thumb_func_start obj_npc_animation_step
|
||||
@ void obj_npc_animation_step(struct npc_state *fieldObject, struct obj *object, u8 anim)
|
||||
obj_npc_animation_step: @ 8092AB8
|
||||
push {r4,lr}
|
||||
adds r4, r1, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
ldrb r0, [r0, 0x1]
|
||||
lsls r0, 27
|
||||
cmp r0, 0
|
||||
blt _08092AF0
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x2A
|
||||
strb r2, [r0]
|
||||
ldr r0, [r4, 0x8]
|
||||
bl sub_8092A4C
|
||||
adds r2, r0, 0
|
||||
cmp r2, 0
|
||||
beq _08092AF0
|
||||
ldrb r1, [r2, 0x5]
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x2B
|
||||
ldrb r0, [r0]
|
||||
ldrb r3, [r2, 0x4]
|
||||
cmp r0, r3
|
||||
bhi _08092AEA
|
||||
ldrb r1, [r2, 0x4]
|
||||
_08092AEA:
|
||||
adds r0, r4, 0
|
||||
bl SeekSpriteAnim
|
||||
_08092AF0:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end obj_npc_animation_step
|
||||
|
||||
thumb_func_start sub_8092AF8
|
||||
sub_8092AF8: @ 8092AF8
|
||||
push {lr}
|
||||
|
|
|
@ -3540,19 +3540,19 @@ dirn2anim(sub_8092A2C, gUnknown_0850DB41)
|
|||
dirn2anim(get_run_image_anim_num, gUnknown_0850DB4A)
|
||||
|
||||
struct UnkStruct_085094AC {
|
||||
const union AnimCmd **unk00;
|
||||
u8 unk04[4];
|
||||
const union AnimCmd *const *anims;
|
||||
u8 animPos[4];
|
||||
};
|
||||
|
||||
extern const struct UnkStruct_085094AC gUnknown_085094AC[];
|
||||
|
||||
const struct UnkStruct_085094AC *sub_8092A4C(const union AnimCmd **a0)
|
||||
static const struct UnkStruct_085094AC *sub_8092A4C(const union AnimCmd *const *anims)
|
||||
{
|
||||
const struct UnkStruct_085094AC *retval;
|
||||
|
||||
for (retval = gUnknown_085094AC; retval->unk00 != NULL; retval ++)
|
||||
for (retval = gUnknown_085094AC; retval->anims != NULL; retval ++)
|
||||
{
|
||||
if (retval->unk00 == a0)
|
||||
if (retval->anims == anims)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
@ -3560,6 +3560,51 @@ const struct UnkStruct_085094AC *sub_8092A4C(const union AnimCmd **a0)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void npc_apply_anim_looping(struct MapObject *mapObject, struct Sprite *sprite, u8 animNum)
|
||||
{
|
||||
const struct UnkStruct_085094AC *unk85094AC;
|
||||
|
||||
if (!mapObject->mapobj_bit_12)
|
||||
{
|
||||
sprite->animNum = animNum;
|
||||
unk85094AC = sub_8092A4C(sprite->anims);
|
||||
if (unk85094AC != NULL)
|
||||
{
|
||||
if (sprite->animCmdIndex == unk85094AC->animPos[0])
|
||||
{
|
||||
sprite->animCmdIndex = unk85094AC->animPos[3];
|
||||
}
|
||||
else if (sprite->animCmdIndex == unk85094AC->animPos[1])
|
||||
{
|
||||
sprite->animCmdIndex = unk85094AC->animPos[2];
|
||||
}
|
||||
}
|
||||
SeekSpriteAnim(sprite, sprite->animCmdIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void obj_npc_animation_step(struct MapObject *mapObject, struct Sprite *sprite, u8 animNum)
|
||||
{
|
||||
const struct UnkStruct_085094AC *unk85094AC;
|
||||
|
||||
if (!mapObject->mapobj_bit_12)
|
||||
{
|
||||
u8 animPos;
|
||||
|
||||
sprite->animNum = animNum;
|
||||
unk85094AC = sub_8092A4C(sprite->anims);
|
||||
if (unk85094AC != NULL)
|
||||
{
|
||||
animPos = unk85094AC->animPos[1];
|
||||
if (sprite->animCmdIndex <= unk85094AC->animPos[0])
|
||||
{
|
||||
animPos = unk85094AC->animPos[0];
|
||||
}
|
||||
SeekSpriteAnim(sprite, animPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
asm(".section .text.get_face_direction_anim_id");
|
||||
|
||||
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
|
||||
|
|
Loading…
Reference in a new issue