mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
sub_8091F94
This commit is contained in:
parent
ee3dc1edda
commit
66fbc9753f
@ -5,132 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8091F94
|
||||
sub_8091F94: @ 8091F94
|
||||
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 r5, r2, 24
|
||||
adds r6, r5, 0
|
||||
bl FieldObjectIsFarawayIslandMew
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08091FFC
|
||||
bl sub_81D427C
|
||||
adds r5, r0, 0
|
||||
cmp r5, 0
|
||||
bne _08092012
|
||||
adds r5, r6, 0
|
||||
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, r5, 0
|
||||
bl state_to_direction
|
||||
adds r5, r0, 0
|
||||
mov r3, sp
|
||||
adds r3, 0x2
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
mov r2, sp
|
||||
bl FieldObjectMoveDestCoords
|
||||
adds r0, r5, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
b _08092084
|
||||
.pool
|
||||
_08091FFC:
|
||||
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, r5, 0
|
||||
bl state_to_direction
|
||||
adds r5, r0, 0
|
||||
_08092012:
|
||||
mov r6, sp
|
||||
adds r6, 0x2
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
mov r2, sp
|
||||
adds r3, r6, 0
|
||||
bl FieldObjectMoveDestCoords
|
||||
adds r0, r5, 0
|
||||
bl GetGoSpeed0AnimId
|
||||
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, [r6, r0]
|
||||
adds r0, r4, 0
|
||||
adds r3, r5, 0
|
||||
bl npc_block_way
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08092070
|
||||
mov r1, r8
|
||||
cmp r1, 0
|
||||
beq _08092084
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
movs r2, 0
|
||||
ldrsh r1, [r6, r2]
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl _call_via_r8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08092084
|
||||
_08092070:
|
||||
adds r0, r5, 0
|
||||
bl GetFaceDirectionAnimId
|
||||
adds r2, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
bl FieldObjectSetRegularAnim
|
||||
_08092084:
|
||||
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_8091F94
|
||||
|
||||
thumb_func_start sub_80920A4
|
||||
sub_80920A4: @ 80920A4
|
||||
push {r4-r7,lr}
|
||||
|
@ -33,7 +33,7 @@ extern const u8 gUnknown_0850D898[4];
|
||||
extern const u8 gUnknown_0850D8AC[5];
|
||||
extern const u8 gUnknown_0850D8C4[5];
|
||||
extern const u8 gUnknown_0850D8E8[4];
|
||||
extern bool8 (*const gUnknown_0850DA64[])(struct MapObject *, struct Sprite *, u8, u8);
|
||||
extern bool8 (*const gUnknown_0850DA64[])(struct MapObject *, struct Sprite *, u8, bool8(u8));
|
||||
|
||||
|
||||
extern const u8 gUnknown_0850DBA0[5];
|
||||
|
@ -64,6 +64,7 @@ void sub_808F254(u8, u8, u8);
|
||||
void FieldObjectStep(struct MapObject *, struct Sprite *, bool8(struct MapObject *, struct Sprite *));
|
||||
u8 GetOppositeDirection(u8);
|
||||
u8 GetStepInPlaceDelay16AnimId(u8);
|
||||
u8 npc_block_way(struct MapObject *, s16, s16, u32);
|
||||
|
||||
// Exported data declarations
|
||||
|
||||
|
15
include/fieldmap.h
Normal file
15
include/fieldmap.h
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by scott on 9/16/2017.
|
||||
//
|
||||
|
||||
#ifndef POKEEMERALD_FIELDMAP_H
|
||||
#define POKEEMERALD_FIELDMAP_H
|
||||
|
||||
// Exported type declarations
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
u8 MapGridGetMetatileBehaviorAt(s16, s16);
|
||||
|
||||
#endif //POKEEMERALD_FIELDMAP_H
|
@ -26,5 +26,6 @@ extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
|
||||
|
||||
void strange_npc_table_clear(void);
|
||||
const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8);
|
||||
void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *);
|
||||
|
||||
#endif //POKEEMERALD_ROM4_H
|
||||
|
@ -6,5 +6,7 @@
|
||||
#define POKEEMERALD_ROM_81BE66C_H
|
||||
|
||||
bool32 InTrainerHill(void);
|
||||
bool8 FieldObjectIsFarawayIslandMew(struct MapObject *);
|
||||
u32 sub_81D427C(void);
|
||||
|
||||
#endif //POKEEMERALD_ROM_81BE66C_H
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "berry.h"
|
||||
#include "palette.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "fieldmap.h"
|
||||
#include "event_data.h"
|
||||
#include "rom_818CFC8.h"
|
||||
#include "rom_81BE66C.h"
|
||||
@ -95,12 +96,12 @@ static bool8 FieldObjectDoesZCoordMatch(struct MapObject *, u8);
|
||||
void npc_reset(struct MapObject *, struct Sprite *);
|
||||
void FieldObjectSetRegularAnim(struct MapObject *, struct Sprite *, u8);
|
||||
u8 GetFaceDirectionAnimId(u32);
|
||||
u8 GetGoSpeed0AnimId(u32);
|
||||
bool8 FieldObjectExecRegularAnim(struct MapObject *, struct Sprite *);
|
||||
void SetFieldObjectStepTimer(struct Sprite *, s16);
|
||||
bool8 RunFieldObjectStepTimer(struct Sprite *);
|
||||
bool8 npc_block_way__next_tile(struct MapObject *, u8);
|
||||
u8 GetGoSpeed0AnimId(u8);
|
||||
u32 state_to_direction(u8, u8, u8);
|
||||
u32 state_to_direction(u8, u8, u32);
|
||||
void DoGroundEffects_OnSpawn(struct MapObject *, struct Sprite *);
|
||||
void sub_80964E8(struct MapObject *, struct Sprite *);
|
||||
bool8 FieldObjectIsSpecialAnimActive(struct MapObject *);
|
||||
@ -3176,7 +3177,7 @@ bool8 sub_8091EC0(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return gUnknown_0850DA64[player_get_x22()](mapObject, sprite, player_get_direction_upper_nybble(), 0);
|
||||
return gUnknown_0850DA64[player_get_x22()](mapObject, sprite, player_get_direction_upper_nybble(), NULL);
|
||||
}
|
||||
|
||||
bool8 sub_8091F20(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
@ -3189,12 +3190,12 @@ bool8 sub_8091F20(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8091F48(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, u8 a3)
|
||||
bool8 sub_8091F48(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8091F4C(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, u8 a3)
|
||||
bool8 sub_8091F4C(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, playerDirection)));
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
@ -3202,6 +3203,42 @@ bool8 sub_8091F4C(struct MapObject *mapObject, struct Sprite *sprite, u8 playerD
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_8091F94(struct MapObject *mapObject, struct Sprite *sprite, u8 playerDirection, bool8 tileCB(u8))
|
||||
{
|
||||
u32 direction;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
direction = playerDirection;
|
||||
if (FieldObjectIsFarawayIslandMew(mapObject))
|
||||
{
|
||||
direction = sub_81D427C();
|
||||
if (direction == 0)
|
||||
{
|
||||
direction = playerDirection;
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(direction));
|
||||
mapObject->mapobj_bit_1 = TRUE;
|
||||
sprite->data1 = 2;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = state_to_direction(gUnknown_085055CD[mapObject->animPattern], mapObject->mapobj_unk_21, direction);
|
||||
}
|
||||
FieldObjectMoveDestCoords(mapObject, direction, &x, &y);
|
||||
FieldObjectSetRegularAnim(mapObject, sprite, GetGoSpeed0AnimId(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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user