CheckForCollisionBetweenFieldObjects
This commit is contained in:
parent
c982993860
commit
951acc8c31
3 changed files with 23 additions and 68 deletions
|
@ -5,74 +5,6 @@
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
thumb_func_start CheckForCollisionBetweenFieldObjects
|
|
||||||
@ bool8 CheckForCollisionBetweenFieldObjects(struct npc_state *fieldObject, u16 x, u16 y)
|
|
||||||
CheckForCollisionBetweenFieldObjects: @ 8092E20
|
|
||||||
push {r4-r7,lr}
|
|
||||||
adds r6, r0, 0
|
|
||||||
lsls r1, 16
|
|
||||||
lsrs r7, r1, 16
|
|
||||||
movs r4, 0
|
|
||||||
lsls r2, 16
|
|
||||||
asrs r5, r2, 16
|
|
||||||
_08092E2E:
|
|
||||||
lsls r0, r4, 3
|
|
||||||
adds r0, r4
|
|
||||||
lsls r0, 2
|
|
||||||
ldr r1, =gMapObjects
|
|
||||||
adds r2, r0, r1
|
|
||||||
ldrb r0, [r2]
|
|
||||||
lsls r0, 31
|
|
||||||
cmp r0, 0
|
|
||||||
beq _08092E88
|
|
||||||
cmp r2, r6
|
|
||||||
beq _08092E88
|
|
||||||
movs r0, 0x10
|
|
||||||
ldrsh r1, [r2, r0]
|
|
||||||
lsls r0, r7, 16
|
|
||||||
asrs r3, r0, 16
|
|
||||||
cmp r1, r3
|
|
||||||
bne _08092E58
|
|
||||||
movs r1, 0x12
|
|
||||||
ldrsh r0, [r2, r1]
|
|
||||||
cmp r0, r5
|
|
||||||
beq _08092E68
|
|
||||||
_08092E58:
|
|
||||||
movs r1, 0x14
|
|
||||||
ldrsh r0, [r2, r1]
|
|
||||||
cmp r0, r3
|
|
||||||
bne _08092E88
|
|
||||||
movs r1, 0x16
|
|
||||||
ldrsh r0, [r2, r1]
|
|
||||||
cmp r0, r5
|
|
||||||
bne _08092E88
|
|
||||||
_08092E68:
|
|
||||||
ldrb r0, [r6, 0xB]
|
|
||||||
lsls r0, 28
|
|
||||||
lsrs r0, 28
|
|
||||||
ldrb r1, [r2, 0xB]
|
|
||||||
lsls r1, 28
|
|
||||||
lsrs r1, 28
|
|
||||||
bl AreZCoordsCompatible
|
|
||||||
lsls r0, 24
|
|
||||||
cmp r0, 0
|
|
||||||
beq _08092E88
|
|
||||||
movs r0, 0x1
|
|
||||||
b _08092E94
|
|
||||||
.pool
|
|
||||||
_08092E88:
|
|
||||||
adds r0, r4, 0x1
|
|
||||||
lsls r0, 24
|
|
||||||
lsrs r4, r0, 24
|
|
||||||
cmp r4, 0xF
|
|
||||||
bls _08092E2E
|
|
||||||
movs r0, 0
|
|
||||||
_08092E94:
|
|
||||||
pop {r4-r7}
|
|
||||||
pop {r1}
|
|
||||||
bx r1
|
|
||||||
thumb_func_end CheckForCollisionBetweenFieldObjects
|
|
||||||
|
|
||||||
thumb_func_start sub_8092E9C
|
thumb_func_start sub_8092E9C
|
||||||
sub_8092E9C: @ 8092E9C
|
sub_8092E9C: @ 8092E9C
|
||||||
push {lr}
|
push {lr}
|
||||||
|
|
|
@ -13,5 +13,6 @@
|
||||||
void SetObjectSubpriorityByZCoord(u8, struct Sprite *, u8);
|
void SetObjectSubpriorityByZCoord(u8, struct Sprite *, u8);
|
||||||
void InitObjectPriorityByZCoord(struct Sprite *, u8);
|
void InitObjectPriorityByZCoord(struct Sprite *, u8);
|
||||||
bool8 IsZCoordMismatchAt(u8, s16, s16);
|
bool8 IsZCoordMismatchAt(u8, s16, s16);
|
||||||
|
bool8 AreZCoordsCompatible(u8, u8);
|
||||||
|
|
||||||
#endif //GUARD_FIELD_GROUND_EFFECT_H
|
#endif //GUARD_FIELD_GROUND_EFFECT_H
|
||||||
|
|
|
@ -3741,6 +3741,28 @@ bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *mapObject, s16 x, s16 y)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
struct MapObject *curObject;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_FIELD_OBJECTS; i ++)
|
||||||
|
{
|
||||||
|
curObject = &gMapObjects[i];
|
||||||
|
if (curObject->active && curObject != mapObject)
|
||||||
|
{
|
||||||
|
if ((curObject->coords2.x == x && curObject->coords2.y == y) || (curObject->coords3.x == x && curObject->coords3.y == y))
|
||||||
|
{
|
||||||
|
if (AreZCoordsCompatible(mapObject->mapobj_unk_0B_0, curObject->mapobj_unk_0B_0))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
asm(".section .text.get_face_direction_anim_id");
|
asm(".section .text.get_face_direction_anim_id");
|
||||||
|
|
||||||
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
|
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
|
||||||
|
|
Loading…
Reference in a new issue