From cd958b1e4376058db61607e1cff4427d8a0175b8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 17 Sep 2017 10:07:43 -0400 Subject: [PATCH] special_anim_with_timer --- asm/field_map_obj.s | 118 -------------------------------------------- src/field_map_obj.c | 29 +++++++++++ 2 files changed, 29 insertions(+), 118 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index e9a96a6e0..9a27d4c06 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,124 +5,6 @@ .text - thumb_func_start sub_8094390 -sub_8094390: @ 8094390 - movs r2, 0x1 - strh r2, [r0, 0x32] - strh r1, [r0, 0x34] - bx lr - thumb_func_end sub_8094390 - - thumb_func_start sub_8094398 -sub_8094398: @ 8094398 - push {lr} - ldrh r0, [r1, 0x34] - subs r0, 0x1 - strh r0, [r1, 0x34] - lsls r0, 16 - cmp r0, 0 - beq _080943AA - movs r0, 0 - b _080943B0 -_080943AA: - movs r0, 0x2 - strh r0, [r1, 0x32] - movs r0, 0x1 -_080943B0: - pop {r1} - bx r1 - thumb_func_end sub_8094398 - - thumb_func_start sub_80943B4 -sub_80943B4: @ 80943B4 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8094390 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8094398 - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80943B4 - - thumb_func_start sub_80943D4 -sub_80943D4: @ 80943D4 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x2 - bl sub_8094390 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8094398 - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80943D4 - - thumb_func_start sub_80943F4 -sub_80943F4: @ 80943F4 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x4 - bl sub_8094390 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8094398 - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80943F4 - - thumb_func_start sub_8094414 -sub_8094414: @ 8094414 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x8 - bl sub_8094390 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8094398 - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8094414 - - thumb_func_start sub_8094434 -sub_8094434: @ 8094434 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0x10 - bl sub_8094390 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8094398 - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8094434 - thumb_func_start sub_8094454 sub_8094454: @ 8094454 push {r4,r5,lr} diff --git a/src/field_map_obj.c b/src/field_map_obj.c index dcf439b9b..9fedc7f0b 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -4381,3 +4381,32 @@ maybe_shadow_1_macro(sub_8094230, maybe_shadow_1, sub_80941B0, 1, 2, 0) maybe_shadow_1_macro(sub_8094288, maybe_shadow_1, sub_80941B0, 2, 2, 0) maybe_shadow_1_macro(sub_80942E0, maybe_shadow_1, sub_80941B0, 3, 2, 0) maybe_shadow_1_macro(sub_8094338, maybe_shadow_1, sub_80941B0, 4, 2, 0) + +void sub_8094390(struct Sprite *sprite, u16 duration) +{ + sprite->data2 = 1; + sprite->data3 = duration; +} + +bool8 sub_8094398(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (-- sprite->data3 == 0) + { + sprite->data2 = 2; + return TRUE; + } + return FALSE; +} + +#define special_anim_with_timer(name, duration)\ +bool8 name(struct MapObject *mapObject, struct Sprite *sprite)\ +{\ + sub_8094390(sprite, duration);\ + return sub_8094398(mapObject, sprite);\ +} + +special_anim_with_timer(sub_80943B4, 1) +special_anim_with_timer(sub_80943D4, 2) +special_anim_with_timer(sub_80943F4, 4) +special_anim_with_timer(sub_8094414, 8) +special_anim_with_timer(sub_8094434, 16)