sub_808EB08

This commit is contained in:
PikalaxALT 2017-09-08 21:35:46 -04:00
parent 019935fb73
commit ba6987b733
3 changed files with 21 additions and 79 deletions

View File

@ -5,85 +5,6 @@
.text
thumb_func_start sub_808EB08
sub_808EB08: @ 808EB08
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r6, r0, 0
adds r4, r1, 0
adds r5, r2, 0
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
ldrb r1, [r6, 0x4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r7, r0, r1
ldrb r0, [r6, 0x5]
bl GetFieldObjectGraphicsInfo
mov r8, r0
lsls r4, 16
asrs r4, 16
lsls r5, 16
asrs r5, 16
adds r0, r6, 0
adds r1, r4, 0
adds r2, r5, 0
bl npc_coords_set
movs r1, 0x10
ldrsh r0, [r6, r1]
movs r2, 0x12
ldrsh r1, [r6, r2]
adds r2, r7, 0
adds r2, 0x20
adds r3, r7, 0
adds r3, 0x22
bl sub_8093038
mov r1, r8
ldrh r0, [r1, 0x8]
lsls r0, 16
asrs r0, 17
negs r0, r0
adds r1, r7, 0
adds r1, 0x28
strb r0, [r1]
mov r2, r8
ldrh r0, [r2, 0xA]
lsls r0, 16
asrs r0, 17
negs r0, r0
adds r2, r7, 0
adds r2, 0x29
strb r0, [r2]
ldrh r0, [r7, 0x20]
adds r0, 0x8
strh r0, [r7, 0x20]
ldrh r1, [r7, 0x22]
adds r1, 0x10
movs r0, 0
ldrsb r0, [r2, r0]
adds r0, r1
strh r0, [r7, 0x22]
adds r0, r6, 0
bl sub_808E38C
ldrb r0, [r6, 0x1]
lsrs r0, 7
cmp r0, 0
beq _0808EB9A
bl CameraObjectReset1
_0808EB9A:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_808EB08
thumb_func_start sub_808EBA8
sub_808EBA8: @ 808EBA8
push {r4,r5,lr}

View File

@ -45,6 +45,7 @@ void sub_808E78C(u8, u8, u8, u8);
void sub_808E75C(s16, s16);
void FieldObjectGetLocalIdAndMap(struct MapObject *, u8 *, u8 *, u8 *);
void npc_coords_shift(struct MapObject *, s16, s16);
void sub_808EB08(struct MapObject *, s16, s16);
// Exported data declarations

View File

@ -1242,3 +1242,23 @@ void npc_coords_shift(struct MapObject *mapObject, s16 x, s16 y)
mapObject->coords2.y = y;
}
void sub_808EB08(struct MapObject *mapObject, s16 x, s16 y)
{
struct Sprite *sprite;
const struct MapObjectGraphicsInfo *graphicsInfo;
sprite = &gSprites[mapObject->spriteId];
graphicsInfo = GetFieldObjectGraphicsInfo(mapObject->graphicsId);
npc_coords_set(mapObject, x, y);
sub_8093038(mapObject->coords2.x, mapObject->coords2.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
sprite->pos1.x += 8;
sprite->pos1.y += 16 + sprite->centerToCornerVecY;
sub_808E38C(mapObject);
if (mapObject->mapobj_bit_15)
{
CameraObjectReset1();
}
}