Deswiss the cheese
This commit is contained in:
parent
64d3a67b0c
commit
eb7e52d2a8
4 changed files with 58 additions and 146 deletions
|
@ -5,148 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive
|
||||
@ bool8 FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(struct npc_state *fieldObject)
|
||||
FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive: @ 809318C
|
||||
push {lr}
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x42
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0809319C
|
||||
movs r0, 0
|
||||
b _0809319E
|
||||
_0809319C:
|
||||
movs r0, 0x1
|
||||
_0809319E:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive
|
||||
|
||||
thumb_func_start FieldObjectIsSpecialAnimActive
|
||||
@ bool8 FieldObjectIsSpecialAnimActive(struct npc_state *fieldObject)
|
||||
FieldObjectIsSpecialAnimActive: @ 80931A4
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 25
|
||||
cmp r0, 0
|
||||
bge _080931BA
|
||||
ldrb r0, [r1, 0x1C]
|
||||
cmp r0, 0xFF
|
||||
beq _080931BA
|
||||
movs r0, 0x1
|
||||
b _080931BC
|
||||
_080931BA:
|
||||
movs r0, 0
|
||||
_080931BC:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end FieldObjectIsSpecialAnimActive
|
||||
|
||||
thumb_func_start FieldObjectSetSpecialAnim
|
||||
@ bool8 FieldObjectSetSpecialAnim(struct npc_state *fieldObject, u8 animId)
|
||||
FieldObjectSetSpecialAnim: @ 80931C0
|
||||
push {r4-r6,lr}
|
||||
adds r4, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r5, r1, 24
|
||||
bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
cmp r6, 0
|
||||
bne _08093200
|
||||
adds r0, r4, 0
|
||||
bl npc_sync_anim_pause_bits
|
||||
strb r5, [r4, 0x1C]
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x40
|
||||
orrs r0, r1
|
||||
movs r1, 0x7F
|
||||
ands r0, r1
|
||||
strb r0, [r4]
|
||||
ldr r2, =gSprites
|
||||
ldrb r1, [r4, 0x4]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
strh r6, [r0, 0x32]
|
||||
movs r0, 0
|
||||
b _08093202
|
||||
.pool
|
||||
_08093200:
|
||||
movs r0, 0x1
|
||||
_08093202:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end FieldObjectSetSpecialAnim
|
||||
|
||||
thumb_func_start FieldObjectForceSetSpecialAnim
|
||||
@ void FieldObjectForceSetSpecialAnim(struct npc_state *fieldObject, u8 animId)
|
||||
FieldObjectForceSetSpecialAnim: @ 8093208
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
lsls r4, r1, 24
|
||||
lsrs r4, 24
|
||||
bl FieldObjectClearAnimIfSpecialAnimActive
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl FieldObjectSetSpecialAnim
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end FieldObjectForceSetSpecialAnim
|
||||
|
||||
thumb_func_start FieldObjectClearAnimIfSpecialAnimActive
|
||||
@ void FieldObjectClearAnimIfSpecialAnimActive(struct npc_state *fieldObject)
|
||||
FieldObjectClearAnimIfSpecialAnimActive: @ 8093224
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 25
|
||||
cmp r0, 0
|
||||
bge _08093236
|
||||
adds r0, r1, 0
|
||||
bl FieldObjectClearAnim
|
||||
_08093236:
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end FieldObjectClearAnimIfSpecialAnimActive
|
||||
|
||||
thumb_func_start FieldObjectClearAnim
|
||||
@ void FieldObjectClearAnim(struct npc_state *fieldObject)
|
||||
FieldObjectClearAnim: @ 809323C
|
||||
movs r1, 0xFF
|
||||
strb r1, [r0, 0x1C]
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x41
|
||||
negs r1, r1
|
||||
ands r1, r2
|
||||
movs r2, 0x7F
|
||||
ands r1, r2
|
||||
strb r1, [r0]
|
||||
ldr r3, =gSprites
|
||||
ldrb r2, [r0, 0x4]
|
||||
lsls r1, r2, 4
|
||||
adds r1, r2
|
||||
lsls r1, 2
|
||||
adds r1, r3
|
||||
movs r2, 0
|
||||
strh r2, [r1, 0x30]
|
||||
ldrb r1, [r0, 0x4]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r3
|
||||
strh r2, [r0, 0x32]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end FieldObjectClearAnim
|
||||
|
||||
.section .text.get_simple_go_anim_id
|
||||
|
||||
thumb_func_start GetSimpleGoAnimId
|
||||
@ u8 GetSimpleGoAnimId(u8 direction)
|
||||
GetSimpleGoAnimId: @ 809335C
|
||||
|
|
|
@ -11,5 +11,6 @@
|
|||
|
||||
// Exported ROM declarations
|
||||
void sub_8097AC8(struct Sprite *);
|
||||
void npc_sync_anim_pause_bits(struct MapObject *);
|
||||
|
||||
#endif //GUARD_MAP_OBJ_8097404_H
|
||||
|
|
|
@ -96,8 +96,6 @@ SECTIONS {
|
|||
asm/field_player_avatar.o(.text);
|
||||
src/field_map_obj.o(.text);
|
||||
asm/field_map_obj.o(.text);
|
||||
src/field_map_obj.o(.text.get_face_direction_anim_id);
|
||||
asm/field_map_obj.o(.text.get_simple_go_anim_id);
|
||||
asm/field_ground_effect.o(.text);
|
||||
asm/map_obj_8097404.o(.text);
|
||||
asm/field_message_box.o(.text);
|
||||
|
|
|
@ -125,6 +125,8 @@ void FieldObjectUpdateSubpriority(struct MapObject *, struct Sprite *);
|
|||
bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *fieldObject, s16 x, s16 y);
|
||||
bool8 IsMetatileDirectionallyImpassable(struct MapObject *, s16, s16, u8);
|
||||
bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *, s16, s16);
|
||||
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
|
||||
void FieldObjectClearAnim(struct MapObject *);
|
||||
|
||||
// ROM data
|
||||
|
||||
|
@ -3902,9 +3904,62 @@ void FieldObjectMoveDestCoords(struct MapObject *mapObject, u32 dirn, s16 *x, s1
|
|||
MoveCoords(direction, x, y);
|
||||
}
|
||||
|
||||
asm(".section .text.get_face_direction_anim_id");
|
||||
// file boundary?
|
||||
|
||||
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
|
||||
bool8 FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(struct MapObject *mapObject)
|
||||
{
|
||||
if (mapObject->mapobj_bit_1 || mapObject->mapobj_bit_6)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 FieldObjectIsSpecialAnimActive(struct MapObject *mapObject)
|
||||
{
|
||||
if (mapObject->mapobj_bit_6 && mapObject->mapobj_unk_1C != 0xFF)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 FieldObjectSetSpecialAnim(struct MapObject *mapObject, u8 specialAnimId)
|
||||
{
|
||||
if (FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(mapObject))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
npc_sync_anim_pause_bits(mapObject);
|
||||
mapObject->mapobj_unk_1C = specialAnimId;
|
||||
mapObject->mapobj_bit_6 = TRUE;
|
||||
mapObject->mapobj_bit_7 = FALSE;
|
||||
gSprites[mapObject->spriteId].data2 = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void FieldObjectForceSetSpecialAnim(struct MapObject *mapObject, u8 specialAnimId)
|
||||
{
|
||||
FieldObjectClearAnimIfSpecialAnimActive(mapObject);
|
||||
FieldObjectSetSpecialAnim(mapObject, specialAnimId);
|
||||
}
|
||||
|
||||
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *mapObject)
|
||||
{
|
||||
if (mapObject->mapobj_bit_6)
|
||||
{
|
||||
FieldObjectClearAnim(mapObject);
|
||||
}
|
||||
}
|
||||
|
||||
void FieldObjectClearAnim(struct MapObject *mapObject)
|
||||
{
|
||||
mapObject->mapobj_unk_1C = 0xFF;
|
||||
mapObject->mapobj_bit_6 = FALSE;
|
||||
mapObject->mapobj_bit_7 = FALSE;
|
||||
gSprites[mapObject->spriteId].data1 = 0;
|
||||
gSprites[mapObject->spriteId].data2 = 0;
|
||||
}
|
||||
|
||||
u8 FieldObjectCheckIfSpecialAnimFinishedOrInactive(struct MapObject *mapObject)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue