mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
state_to_direction memes
This commit is contained in:
parent
559833ccf6
commit
c6bb13939e
@ -5,488 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80920A4
|
||||
sub_80920A4: @ 80920A4
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r7, r1, 0
|
||||
mov r8, r3
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
ldr r1, =gUnknown_085055CD
|
||||
ldrb r0, [r4, 0x6]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x21
|
||||
ldrb r1, [r1]
|
||||
adds r2, r6, 0
|
||||
bl state_to_direction
|
||||
adds r6, r0, 0
|
||||
mov r5, sp
|
||||
adds r5, 0x2
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, sp
|
||||
adds r3, r5, 0
|
||||
bl FieldObjectMoveDestCoords
|
||||
adds r0, r6, 0
|
||||
bl GetGoSpeed1AnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, 0
|
||||
ldrsh r2, [r5, r0]
|
||||
adds r0, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl npc_block_way
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0809212A
|
||||
mov r1, r8
|
||||
cmp r1, 0
|
||||
beq _0809213E
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
movs r2, 0
|
||||
ldrsh r1, [r5, r2]
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl _call_via_r8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0809213E
|
||||
_0809212A:
|
||||
adds r0, r6, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
_0809213E:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x2
|
||||
strh r0, [r7, 0x30]
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_80920A4
|
||||
|
||||
thumb_func_start sub_809215C
|
||||
sub_809215C: @ 809215C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r7, r1, 0
|
||||
mov r8, r3
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
ldr r1, =gUnknown_085055CD
|
||||
ldrb r0, [r4, 0x6]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x21
|
||||
ldrb r1, [r1]
|
||||
adds r2, r6, 0
|
||||
bl state_to_direction
|
||||
adds r6, r0, 0
|
||||
mov r5, sp
|
||||
adds r5, 0x2
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, sp
|
||||
adds r3, r5, 0
|
||||
bl FieldObjectMoveDestCoords
|
||||
adds r0, r6, 0
|
||||
bl GetGoSpeed3AnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, 0
|
||||
ldrsh r2, [r5, r0]
|
||||
adds r0, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl npc_block_way
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080921E2
|
||||
mov r1, r8
|
||||
cmp r1, 0
|
||||
beq _080921F6
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
movs r2, 0
|
||||
ldrsh r1, [r5, r2]
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl _call_via_r8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080921F6
|
||||
_080921E2:
|
||||
adds r0, r6, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
_080921F6:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x2
|
||||
strh r0, [r7, 0x30]
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_809215C
|
||||
|
||||
thumb_func_start sub_8092214
|
||||
sub_8092214: @ 8092214
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r7, r1, 0
|
||||
mov r8, r3
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
ldr r1, =gUnknown_085055CD
|
||||
ldrb r0, [r4, 0x6]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x21
|
||||
ldrb r1, [r1]
|
||||
adds r2, r6, 0
|
||||
bl state_to_direction
|
||||
adds r6, r0, 0
|
||||
mov r5, sp
|
||||
adds r5, 0x2
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, sp
|
||||
adds r3, r5, 0
|
||||
bl FieldObjectMoveDestCoords
|
||||
adds r0, r6, 0
|
||||
bl sub_8093438
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, 0
|
||||
ldrsh r2, [r5, r0]
|
||||
adds r0, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl npc_block_way
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0809229A
|
||||
mov r1, r8
|
||||
cmp r1, 0
|
||||
beq _080922AE
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
movs r2, 0
|
||||
ldrsh r1, [r5, r2]
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl _call_via_r8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080922AE
|
||||
_0809229A:
|
||||
adds r0, r6, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
_080922AE:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x2
|
||||
strh r0, [r7, 0x30]
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8092214
|
||||
|
||||
thumb_func_start cph_IM_DIFFERENT
|
||||
cph_IM_DIFFERENT: @ 80922CC
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
ldr r1, =gUnknown_085055CD
|
||||
ldrb r0, [r4, 0x6]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x21
|
||||
ldrb r1, [r1]
|
||||
bl state_to_direction
|
||||
bl sub_80934BC
|
||||
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, 0x2
|
||||
strh r0, [r5, 0x30]
|
||||
movs r0, 0x1
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end cph_IM_DIFFERENT
|
||||
|
||||
thumb_func_start sub_8092314
|
||||
sub_8092314: @ 8092314
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r7, r1, 0
|
||||
mov r8, r3
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
ldr r1, =gUnknown_085055CD
|
||||
ldrb r0, [r4, 0x6]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x21
|
||||
ldrb r1, [r1]
|
||||
adds r2, r6, 0
|
||||
bl state_to_direction
|
||||
adds r6, r0, 0
|
||||
mov r5, sp
|
||||
adds r5, 0x2
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, sp
|
||||
adds r3, r5, 0
|
||||
bl FieldObjectMoveDestCoords
|
||||
adds r0, r6, 0
|
||||
bl sub_8093514
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, 0
|
||||
ldrsh r2, [r5, r0]
|
||||
adds r0, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl npc_block_way
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0809239A
|
||||
mov r1, r8
|
||||
cmp r1, 0
|
||||
beq _080923AE
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
movs r2, 0
|
||||
ldrsh r1, [r5, r2]
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl _call_via_r8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080923AE
|
||||
_0809239A:
|
||||
adds r0, r6, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
_080923AE:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x2
|
||||
strh r0, [r7, 0x30]
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8092314
|
||||
|
||||
thumb_func_start oac_hopping
|
||||
oac_hopping: @ 80923CC
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x8
|
||||
adds r4, r0, 0
|
||||
adds r7, r1, 0
|
||||
mov r8, r3
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
ldr r1, =gUnknown_085055CD
|
||||
ldrb r0, [r4, 0x6]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x21
|
||||
ldrb r1, [r1]
|
||||
adds r2, r6, 0
|
||||
bl state_to_direction
|
||||
adds r6, r0, 0
|
||||
ldrh r1, [r4, 0x10]
|
||||
add r0, sp, 0x4
|
||||
strh r1, [r0]
|
||||
ldrh r0, [r4, 0x12]
|
||||
mov r5, sp
|
||||
adds r5, 0x6
|
||||
strh r0, [r5]
|
||||
movs r0, 0x2
|
||||
str r0, [sp]
|
||||
adds r0, r6, 0
|
||||
add r1, sp, 0x4
|
||||
adds r2, r5, 0
|
||||
movs r3, 0x2
|
||||
bl sub_8092F88
|
||||
adds r0, r6, 0
|
||||
bl GetJumpLedgeAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
add r0, sp, 0x4
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r0, 0
|
||||
ldrsh r2, [r5, r0]
|
||||
adds r0, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl npc_block_way
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08092460
|
||||
mov r1, r8
|
||||
cmp r1, 0
|
||||
beq _08092474
|
||||
add r0, sp, 0x4
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
movs r2, 0
|
||||
ldrsh r1, [r5, r2]
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl _call_via_r8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08092474
|
||||
_08092460:
|
||||
adds r0, r6, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
_08092474:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x2
|
||||
strh r0, [r7, 0x30]
|
||||
movs r0, 0x1
|
||||
add sp, 0x8
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end oac_hopping
|
||||
|
||||
thumb_func_start FieldObjectCB_CopyPlayer2
|
||||
FieldObjectCB_CopyPlayer2: @ 8092494
|
||||
push {lr}
|
||||
|
@ -95,8 +95,17 @@ static bool8 FieldObjectDoesZCoordMatch(struct MapObject *, u8);
|
||||
/*static*/ struct MapObjectTemplate *FindFieldObjectTemplateInArrayByLocalId(u8 localId, struct MapObjectTemplate *templates, u8 count);
|
||||
void npc_reset(struct MapObject *, struct Sprite *);
|
||||
void FieldObjectSetRegularAnim(struct MapObject *, struct Sprite *, u8);
|
||||
|
||||
u8 GetFaceDirectionAnimId(u32);
|
||||
u8 GetGoSpeed0AnimId(u32);
|
||||
u8 GetGoSpeed1AnimId(u32);
|
||||
u8 GetGoSpeed3AnimId(u32);
|
||||
u8 sub_8093438(u32);
|
||||
u8 sub_80934BC(u32);
|
||||
u8 sub_8093514(u32);
|
||||
u8 GetJumpLedgeAnimId(u32);
|
||||
void sub_8092F88(u32, s16 *, s16 *, s16, s16);
|
||||
|
||||
bool8 FieldObjectExecRegularAnim(struct MapObject *, struct Sprite *);
|
||||
void SetFieldObjectStepTimer(struct Sprite *, s16);
|
||||
bool8 RunFieldObjectStepTimer(struct Sprite *);
|
||||
@ -3239,6 +3248,115 @@ bool8 sub_8091F94(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_80920A4(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed1AnimId(direction));
|
||||
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
|
||||
}
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_809215C(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed3AnimId(direction));
|
||||
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
|
||||
}
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8092214(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, sub_8093438(direction));
|
||||
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
|
||||
}
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 cph_IM_DIFFERENT(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, sub_80934BC(direction));
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8092314(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, sub_8093514(direction));
|
||||
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
|
||||
}
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 oac_hopping(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
x = mapObject->coords2.x;
|
||||
y = mapObject->coords2.y;
|
||||
sub_8092F88(direction, &x, &y, 2, 2);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetJumpLedgeAnimId(direction));
|
||||
if (npc_block_way(mapObject, x, y, direction) || (tileCB != NULL && !tileCB(MapGridGetMetatileBehaviorAt(x, y))))
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
|
||||
}
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
asm(".section .text.get_face_direction_anim_id");
|
||||
|
||||
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
|
||||
@ -3292,16 +3410,19 @@ void FieldObjectStep(struct MapObject *mapObject, struct Sprite *sprite, bool8 (
|
||||
FieldObjectUpdateSubpriority(mapObject, sprite);
|
||||
}
|
||||
|
||||
u8 GetFaceDirectionAnimId(u32 direction)
|
||||
{
|
||||
u8 dirn2;
|
||||
u8 animIds[sizeof gUnknown_0850DBA0];
|
||||
|
||||
dirn2 = direction;
|
||||
memcpy(animIds, gUnknown_0850DBA0, sizeof gUnknown_0850DBA0);
|
||||
if (dirn2 > DIR_EAST)
|
||||
{
|
||||
dirn2 = 0;
|
||||
}
|
||||
return animIds[dirn2];
|
||||
#define dirn2anim(name, table) \
|
||||
extern const u8 table[5]; \
|
||||
u8 name(u32 direction) \
|
||||
{ \
|
||||
u8 dirn2; \
|
||||
u8 animIds[5]; \
|
||||
dirn2 = direction; \
|
||||
memcpy(animIds, table, 5); \
|
||||
if (dirn2 > DIR_EAST) \
|
||||
{ \
|
||||
dirn2 = 0; \
|
||||
} \
|
||||
return animIds[dirn2]; \
|
||||
}
|
||||
|
||||
dirn2anim(GetFaceDirectionAnimId, gUnknown_0850DBA0);
|
||||
|
Loading…
Reference in New Issue
Block a user