SetPlayerAvatarFieldObjectIdAndObjectId

This commit is contained in:
PikalaxALT 2017-09-07 20:04:59 -04:00
parent 11786cc325
commit f8e8adf82e
3 changed files with 13 additions and 27 deletions

View File

@ -5,32 +5,6 @@
.text
thumb_func_start SetPlayerAvatarFieldObjectIdAndObjectId
@ void SetPlayerAvatarFieldObjectIdAndObjectId(u8 fieldObjectId, u8 objectId)
SetPlayerAvatarFieldObjectIdAndObjectId: @ 808E3C4
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gPlayerAvatar
strb r0, [r5, 0x5]
strb r1, [r5, 0x4]
ldr r1, =gMapObjects
lsls r4, r0, 3
adds r4, r0
lsls r4, 2
adds r4, r1
ldrb r0, [r4, 0x5]
bl GetPlayerAvatarGenderByGraphicsId
strb r0, [r5, 0x7]
ldrb r0, [r4, 0x5]
movs r1, 0x20
bl SetPlayerAvatarExtraStateTransition
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end SetPlayerAvatarFieldObjectIdAndObjectId
thumb_func_start FieldObjectSetGraphicsId
@ void FieldObjectSetGraphicsId(npc_state *npcState, u8 graphicsId)
FieldObjectSetGraphicsId: @ 808E3F8

View File

@ -6,5 +6,7 @@
#define POKEEMERALD_FIELD_PLAYER_AVATAR_H
void ClearPlayerAvatarInfo(void);
void SetPlayerAvatarExtraStateTransition(u8, u8);
u8 GetPlayerAvatarGenderByGraphicsId(u8);
#endif //POKEEMERALD_FIELD_PLAYER_AVATAR_H

View File

@ -36,7 +36,7 @@ static void MakeObjectTemplateFromFieldObjectTemplate(struct MapObjectTemplate *
/*static*/ void sub_808E894(u16);
static void RemoveFieldObjectIfOutsideView(struct MapObject *);
static void sub_808E1B8(u8, s16, s16);
/*static*/ void SetPlayerAvatarFieldObjectIdAndObjectId(u8, u8);
static void SetPlayerAvatarFieldObjectIdAndObjectId(u8, u8);
/*static*/ void sub_808E38C(struct MapObject *);
// ROM data
@ -205,6 +205,8 @@ static u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u
mapObject->mapobj_unk_20 = gUnknown_085055CD[template->movementType];
FieldObjectSetDirection(mapObject, mapObject->mapobj_unk_20);
FieldObjectHandleDynamicGraphicsId(mapObject);
// This block is the culprit
if (gUnknown_0850557C[mapObject->animPattern])
{
if (mapObject->mapobj_unk_19 == 0)
@ -892,3 +894,11 @@ static void sub_808E1B8(u8 mapObjectId, s16 x, s16 y)
mapObject->mapobj_bit_21 = FALSE;
FieldObjectClearAnim(mapObject);
}
static void SetPlayerAvatarFieldObjectIdAndObjectId(u8 mapObjectId, u8 spriteId)
{
gPlayerAvatar.mapObjectId = mapObjectId;
gPlayerAvatar.spriteId = spriteId;
gPlayerAvatar.gender = GetPlayerAvatarGenderByGraphicsId(gMapObjects[mapObjectId].graphicsId);
SetPlayerAvatarExtraStateTransition(gMapObjects[mapObjectId].graphicsId, 0x20);
}