From 4b04e92e8b236d91ea5cc45813f914f10a86b748 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 17 Sep 2017 13:26:17 -0400 Subject: [PATCH] Ten more functions (remaining function count is 99) --- asm/field_map_obj.s | 221 --------------------------------- include/field_effect_helpers.h | 1 + include/trainer_see.h | 7 ++ src/field_map_obj.c | 99 +++++++++++++++ 4 files changed, 107 insertions(+), 221 deletions(-) create mode 100644 include/trainer_see.h diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 526b37db67..18e4298a02 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,227 +5,6 @@ .text - thumb_func_start sub_8095548 -sub_8095548: @ 8095548 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4, 0x6] - cmp r0, 0x3F - bne _0809555E - adds r0, r4, 0 - bl sub_80B4578 - movs r0, 0 - b _08095586 -_0809555E: - subs r0, 0x39 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08095580 - adds r0, r4, 0 - bl sub_8155D78 - movs r0, 0x1 - strh r0, [r5, 0x32] - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_809558C - lsls r0, 24 - lsrs r0, 24 - b _08095586 -_08095580: - movs r0, 0x2 - strh r0, [r5, 0x32] - movs r0, 0x1 -_08095586: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8095548 - - thumb_func_start sub_809558C -sub_809558C: @ 809558C - push {r4,lr} - adds r4, r1, 0 - bl sub_8155DA0 - lsls r0, 24 - cmp r0, 0 - bne _0809559E - movs r0, 0 - b _080955A4 -_0809559E: - movs r0, 0x2 - strh r0, [r4, 0x32] - movs r0, 0x1 -_080955A4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_809558C - - thumb_func_start sub_80955AC -sub_80955AC: @ 80955AC - push {r4,lr} - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0 - bl obj_anim_image_set_and_seek - movs r0, 0x1 - strh r0, [r4, 0x32] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80955AC - - thumb_func_start sub_80955C8 -sub_80955C8: @ 80955C8 - push {r4,lr} - adds r4, r1, 0 - adds r0, r4, 0 - bl sub_80979BC - lsls r0, 24 - cmp r0, 0 - beq _080955E4 - adds r0, r4, 0 - movs r1, 0x20 - bl SetFieldObjectStepTimer - movs r0, 0x2 - strh r0, [r4, 0x32] -_080955E4: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80955C8 - - thumb_func_start sub_80955EC -sub_80955EC: @ 80955EC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r2, [r4, 0x1] - lsls r1, r2, 26 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 5 - subs r0, 0x22 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x1] - adds r0, r5, 0 - bl RunFieldObjectStepTimer - lsls r0, 24 - cmp r0, 0 - beq _0809561E - ldrb r0, [r4, 0x1] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r0, 0x3 - strh r0, [r5, 0x32] -_0809561E: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80955EC - - thumb_func_start sub_8095628 -sub_8095628: @ 8095628 - push {r4,lr} - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0 - bl obj_anim_image_set_and_seek - movs r0, 0x1 - strh r0, [r4, 0x32] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8095628 - - thumb_func_start sub_8095644 -sub_8095644: @ 8095644 - push {r4,lr} - adds r4, r1, 0 - adds r0, r4, 0 - bl sub_80979BC - lsls r0, 24 - cmp r0, 0 - beq _08095660 - adds r0, r4, 0 - movs r1, 0x20 - bl SetFieldObjectStepTimer - movs r0, 0x2 - strh r0, [r4, 0x32] -_08095660: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8095644 - - thumb_func_start sub_8095668 -sub_8095668: @ 8095668 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r2, [r4, 0x1] - lsls r1, r2, 26 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 5 - subs r0, 0x22 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x1] - adds r0, r5, 0 - bl RunFieldObjectStepTimer - lsls r0, 24 - cmp r0, 0 - beq _0809569A - ldrb r0, [r4, 0x1] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r0, 0x3 - strh r0, [r5, 0x32] -_0809569A: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8095668 - - thumb_func_start sub_80956A4 -sub_80956A4: @ 80956A4 - ldrb r2, [r0, 0x3] - movs r3, 0x4 - orrs r2, r3 - strb r2, [r0, 0x3] - movs r0, 0x1 - strh r0, [r1, 0x32] - bx lr - thumb_func_end sub_80956A4 - - thumb_func_start sub_80956B4 -sub_80956B4: @ 80956B4 - ldrb r3, [r0, 0x3] - movs r2, 0x5 - negs r2, r2 - ands r2, r3 - strb r2, [r0, 0x3] - movs r0, 0x1 - strh r0, [r1, 0x32] - bx lr - thumb_func_end sub_80956B4 - thumb_func_start sub_80956C4 sub_80956C4: @ 80956C4 push {r4,lr} diff --git a/include/field_effect_helpers.h b/include/field_effect_helpers.h index 6504a84f1c..e80daf3bd6 100644 --- a/include/field_effect_helpers.h +++ b/include/field_effect_helpers.h @@ -11,5 +11,6 @@ // Exported ROM declarations u8 sub_8154228(void); +bool8 sub_8155DA0(struct MapObject *); #endif //GUARD_FIELD_EFFECT_HELPERS_H diff --git a/include/trainer_see.h b/include/trainer_see.h new file mode 100644 index 0000000000..3f39783b87 --- /dev/null +++ b/include/trainer_see.h @@ -0,0 +1,7 @@ +#ifndef GUARD_TRAINER_SEE_H +#define GUARD_TRAINER_SEE_H + +void sub_80B4578(struct MapObject *); +void sub_8155D78(struct MapObject *); + +#endif //GUARD_TRAINER_SEE_H diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 432eb5b47b..cc645751c0 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -21,6 +21,7 @@ #include "field_effect.h" #include "field_effect_helpers.h" #include "field_camera.h" +#include "trainer_see.h" #include "field_map_obj.h" #define NUM_FIELD_MAP_OBJECT_TEMPLATES 0x51 @@ -120,6 +121,7 @@ static void FieldObjectExecSpecialAnim(struct MapObject *, struct Sprite *); static bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject *, s16, s16); static bool8 IsMetatileDirectionallyImpassable(struct MapObject *, s16, s16, u8); static bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *, s16, s16); +static bool8 sub_809558C(struct MapObject *, struct Sprite *); // ROM data @@ -4670,3 +4672,100 @@ bool8 do_heart_bubble(struct MapObject *mapObject, struct Sprite *sprite) sprite->data2 = 1; return TRUE; } + +bool8 sub_8095548(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (mapObject->animPattern == 0x3F) + { + sub_80B4578(mapObject); + return FALSE; + } + if (mapObject->animPattern != 0x39 && mapObject->animPattern != 0x3A) + { + sprite->data2 = 2; + return TRUE; + } + sub_8155D78(mapObject); + sprite->data2 = 1; + return sub_809558C(mapObject, sprite); +} + +static bool8 sub_809558C(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (sub_8155DA0(mapObject)) + { + sprite->data2 = 2; + return TRUE; + } + return FALSE; +} + +bool8 sub_80955AC(struct MapObject *mapObject, struct Sprite *sprite) +{ + obj_anim_image_set_and_seek(sprite, 1, 0); + sprite->data2 = 1; + return FALSE; +} + +bool8 sub_80955C8(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (sub_80979BC(sprite)) + { + SetFieldObjectStepTimer(sprite, 32); + sprite->data2 = 2; + } + return FALSE; +} + +bool8 sub_80955EC(struct MapObject *mapObject, struct Sprite *sprite) +{ + mapObject->mapobj_bit_13 ^= TRUE; + if (RunFieldObjectStepTimer(sprite)) + { + mapObject->mapobj_bit_13 = TRUE; + sprite->data2 = 3; + } + return FALSE; +} + +bool8 sub_8095628(struct MapObject *mapObject, struct Sprite *sprite) +{ + obj_anim_image_set_and_seek(sprite, 1, 0); + sprite->data2 = 1; + return FALSE; +} + +bool8 sub_8095644(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (sub_80979BC(sprite)) + { + SetFieldObjectStepTimer(sprite, 32); + sprite->data2 = 2; + } + return FALSE; +} + +bool8 sub_8095668(struct MapObject *mapObject, struct Sprite *sprite) +{ + mapObject->mapobj_bit_13 ^= TRUE; + if (RunFieldObjectStepTimer(sprite)) + { + mapObject->mapobj_bit_13 = TRUE; + sprite->data2 = 3; + } + return FALSE; +} + +bool8 sub_80956A4(struct MapObject *mapObject, struct Sprite *sprite) +{ + mapObject->mapobj_bit_26 = TRUE; + sprite->data2 = 1; + return TRUE; +} + +bool8 sub_80956B4(struct MapObject *mapObject, struct Sprite *sprite) +{ + mapObject->mapobj_bit_26 = FALSE; + sprite->data2 = 1; + return TRUE; +}