This commit is contained in:
scnorton 2017-09-15 16:34:03 -04:00
parent 2e1ecdb877
commit 1c6177f678
3 changed files with 92 additions and 279 deletions

View File

@ -5,285 +5,6 @@
.text
thumb_func_start FieldObjectCB_LookAroundCounterclockwise
FieldObjectCB_LookAroundCounterclockwise: @ 8090CD0
push {lr}
adds r1, r0, 0
movs r0, 0x2E
ldrsh r2, [r1, r0]
lsls r0, r2, 3
adds r0, r2
lsls r0, 2
ldr r2, =gMapObjects
adds r0, r2
ldr r2, =sub_8090CF4
bl FieldObjectStep
pop {r0}
bx r0
.pool
thumb_func_end FieldObjectCB_LookAroundCounterclockwise
thumb_func_start sub_8090CF4
sub_8090CF4: @ 8090CF4
push {r4,lr}
ldr r3, =gUnknown_0850D89C
movs r4, 0x30
ldrsh r2, [r1, r4]
lsls r2, 2
adds r2, r3
ldr r2, [r2]
bl _call_via_r2
lsls r0, 24
lsrs r0, 24
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_8090CF4
thumb_func_start sub_8090D14
sub_8090D14: @ 8090D14
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
bl npc_reset
ldrb r0, [r4, 0x18]
lsls r0, 28
lsrs r0, 28
bl GetFaceDirectionAnimId
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
adds r0, r4, 0
adds r1, r5, 0
bl FieldObjectSetRegularAnim
movs r0, 0x1
strh r0, [r5, 0x30]
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8090D14
thumb_func_start sub_8090D40
sub_8090D40: @ 8090D40
push {r4,lr}
adds r4, r1, 0
bl FieldObjectExecRegularAnim
lsls r0, 24
cmp r0, 0
beq _08090D5A
adds r0, r4, 0
movs r1, 0x30
bl SetFieldObjectStepTimer
movs r0, 0x2
strh r0, [r4, 0x30]
_08090D5A:
movs r0, 0
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8090D40
thumb_func_start sub_8090D64
sub_8090D64: @ 8090D64
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
adds r0, r5, 0
bl RunFieldObjectStepTimer
lsls r0, 24
cmp r0, 0
bne _08090D82
adds r0, r4, 0
bl FieldObjectIsTrainerAndCloseToPlayer
lsls r0, 24
cmp r0, 0
beq _08090D86
_08090D82:
movs r0, 0x3
strh r0, [r5, 0x30]
_08090D86:
movs r0, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8090D64
thumb_func_start sub_8090D90
@ bool8 sub_8090D90(struct npc_state *fieldObject, struct obj *object)
sub_8090D90: @ 8090D90
push {r4,r5,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
ldr r1, =gUnknown_0850D8AC
mov r0, sp
movs r2, 0x5
bl memcpy
adds r0, r4, 0
movs r1, 0
bl GetRunningPastFacingDirection
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
bne _08090DBC
ldrb r0, [r4, 0x18]
lsls r0, 28
lsrs r0, 28
add r0, sp
ldrb r1, [r0]
_08090DBC:
adds r0, r4, 0
bl FieldObjectSetDirection
movs r0, 0
strh r0, [r5, 0x30]
movs r0, 0x1
add sp, 0x8
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_8090D90
thumb_func_start FieldObjectCB_LookAroundClockwise
FieldObjectCB_LookAroundClockwise: @ 8090DD4
push {lr}
adds r1, r0, 0
movs r0, 0x2E
ldrsh r2, [r1, r0]
lsls r0, r2, 3
adds r0, r2
lsls r0, 2
ldr r2, =gMapObjects
adds r0, r2
ldr r2, =sub_8090DF8
bl FieldObjectStep
pop {r0}
bx r0
.pool
thumb_func_end FieldObjectCB_LookAroundClockwise
thumb_func_start sub_8090DF8
sub_8090DF8: @ 8090DF8
push {r4,lr}
ldr r3, =gUnknown_0850D8B4
movs r4, 0x30
ldrsh r2, [r1, r4]
lsls r2, 2
adds r2, r3
ldr r2, [r2]
bl _call_via_r2
lsls r0, 24
lsrs r0, 24
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_8090DF8
thumb_func_start sub_8090E18
sub_8090E18: @ 8090E18
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
bl npc_reset
ldrb r0, [r4, 0x18]
lsls r0, 28
lsrs r0, 28
bl GetFaceDirectionAnimId
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
adds r0, r4, 0
adds r1, r5, 0
bl FieldObjectSetRegularAnim
movs r0, 0x1
strh r0, [r5, 0x30]
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8090E18
thumb_func_start sub_8090E44
sub_8090E44: @ 8090E44
push {r4,lr}
adds r4, r1, 0
bl FieldObjectExecRegularAnim
lsls r0, 24
cmp r0, 0
beq _08090E5E
adds r0, r4, 0
movs r1, 0x30
bl SetFieldObjectStepTimer
movs r0, 0x2
strh r0, [r4, 0x30]
_08090E5E:
movs r0, 0
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8090E44
thumb_func_start sub_8090E68
sub_8090E68: @ 8090E68
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
adds r0, r5, 0
bl RunFieldObjectStepTimer
lsls r0, 24
cmp r0, 0
bne _08090E86
adds r0, r4, 0
bl FieldObjectIsTrainerAndCloseToPlayer
lsls r0, 24
cmp r0, 0
beq _08090E8A
_08090E86:
movs r0, 0x3
strh r0, [r5, 0x30]
_08090E8A:
movs r0, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8090E68
thumb_func_start sub_8090E94
sub_8090E94: @ 8090E94
push {r4,r5,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
ldr r1, =gUnknown_0850D8C4
mov r0, sp
movs r2, 0x5
bl memcpy
adds r0, r4, 0
movs r1, 0
bl GetRunningPastFacingDirection
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
bne _08090EC0
ldrb r0, [r4, 0x18]
lsls r0, 28
lsrs r0, 28
add r0, sp
ldrb r1, [r0]
_08090EC0:
adds r0, r4, 0
bl FieldObjectSetDirection
movs r0, 0
strh r0, [r5, 0x30]
movs r0, 0x1
add sp, 0x8
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_8090E94
thumb_func_start FieldObjectCB_AlternatelyGoInOppositeDirections
FieldObjectCB_AlternatelyGoInOppositeDirections: @ 8090ED8
push {lr}

View File

@ -30,5 +30,7 @@ extern const u8 gUnknown_0850D850[4];
extern const u8 gUnknown_0850D868[4];
extern const u8 gUnknown_0850D880[4];
extern const u8 gUnknown_0850D898[4];
extern const u8 gUnknown_0850D8AC[5];
extern const u8 gUnknown_0850D8C4[5];
#endif //POKEEMERALD_DATA3_H

View File

@ -2910,3 +2910,93 @@ bool8 sub_8090C88 (struct MapObject *mapObject, struct Sprite *sprite)
sprite->data1 = 1;
return TRUE;
}
field_object_step(LookAroundCounterclockwise, gUnknown_0850D89C)
bool8 sub_8090D14 (struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
sprite->data1 = 1;
return TRUE;
}
bool8 sub_8090D40 (struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
SetFieldObjectStepTimer(sprite, 48);
sprite->data1 = 2;
}
return FALSE;
}
bool8 sub_8090D64 (struct MapObject *mapObject, struct Sprite *sprite)
{
if (RunFieldObjectStepTimer(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
{
sprite->data1 = 3;
}
return FALSE;
}
bool8 sub_8090D90 (struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[5];
u8 direction;
memcpy(directions, gUnknown_0850D8AC, sizeof gUnknown_0850D8AC);
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_ANY);
if (direction == 0)
{
direction = directions[mapObject->mapobj_unk_18];
}
FieldObjectSetDirection(mapObject, direction);
sprite->data1 = 0;
return TRUE;
}
field_object_step(LookAroundClockwise, gUnknown_0850D8B4)
bool8 sub_8090E18 (struct MapObject *mapObject, struct Sprite *sprite)
{
npc_reset(mapObject, sprite);
FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18));
sprite->data1 = 1;
return TRUE;
}
bool8 sub_8090E44 (struct MapObject *mapObject, struct Sprite *sprite)
{
if (FieldObjectExecRegularAnim(mapObject, sprite))
{
SetFieldObjectStepTimer(sprite, 48);
sprite->data1 = 2;
}
return FALSE;
}
bool8 sub_8090E68 (struct MapObject *mapObject, struct Sprite *sprite)
{
if (RunFieldObjectStepTimer(sprite) || FieldObjectIsTrainerAndCloseToPlayer(mapObject))
{
sprite->data1 = 3;
}
return FALSE;
}
bool8 sub_8090E94 (struct MapObject *mapObject, struct Sprite *sprite)
{
u8 directions[5];
u8 direction;
memcpy(directions, gUnknown_0850D8C4, sizeof gUnknown_0850D8C4);
direction = GetRunningPastFacingDirection(mapObject, RUNFOLLOW_ANY);
if (direction == 0)
{
direction = directions[mapObject->mapobj_unk_18];
}
FieldObjectSetDirection(mapObject, direction);
sprite->data1 = 0;
return TRUE;
}