diff options
author | Thomas Winwood <twwinwood@gmail.com> | 2018-06-18 09:45:40 +0100 |
---|---|---|
committer | Thomas Winwood <twwinwood@gmail.com> | 2018-06-18 09:45:40 +0100 |
commit | a08baefa117414a69afa7dcff41c740c1ae59715 (patch) | |
tree | ca317b724961bab62fc84c16a11652fe47669817 | |
parent | 67c8820a607da664acb4d1513f2fa6db8941548c (diff) |
Decompile sub_80DDD78
-rw-r--r-- | asm/ghost.s | 63 | ||||
-rw-r--r-- | src/ghost.c | 20 |
2 files changed, 20 insertions, 63 deletions
diff --git a/asm/ghost.s b/asm/ghost.s index 3aa77a273..2e1b27cd4 100644 --- a/asm/ghost.s +++ b/asm/ghost.s @@ -7,69 +7,6 @@ @ ghost - thumb_func_start sub_80DDD78 -sub_80DDD78: @ 80DDD78 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - subs r0, 0x41 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x82 - bhi _080DDDAC - ldrb r0, [r4, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r0 - movs r0, 0x8 - b _080DDDB6 -_080DDDAC: - ldrb r0, [r4, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r0 - movs r0, 0x4 -_080DDDB6: - orrs r1, r0 - strb r1, [r4, 0x5] - ldrh r0, [r4, 0x2E] - adds r0, 0x13 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x32] - adds r0, 0x50 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3D - bne _080DDDE8 - adds r0, r4, 0 - bl DestroyAnimSprite -_080DDDE8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DDD78 - thumb_func_start sub_80DDDF0 sub_80DDDF0: @ 80DDDF0 push {r4,r5,lr} diff --git a/src/ghost.c b/src/ghost.c index c14a60fdf..a78ac7de3 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -1,4 +1,5 @@ #include "global.h" +#include "battle_anim.h" #include "rom_8077ABC.h" #include "sound.h" #include "trig.h" @@ -115,4 +116,23 @@ void sub_80DDD58(struct Sprite *sprite) sub_8078764(sprite, 1); sprite->callback = sub_80DDD78; sub_80DDD78(sprite); +} + +void sub_80DDD78(struct Sprite *sprite) { + u16 temp1; + sprite->pos2.x = Sin(sprite->data[0], 32); + sprite->pos2.y = Cos(sprite->data[0], 8); + temp1 = sprite->data[0] - 65; + if (temp1 <= 130) { + sprite->oam.priority = 2; + } else { + sprite->oam.priority = 1; + } + sprite->data[0] = (sprite->data[0] + 0x13) & 0xFF; + sprite->data[2] += 80; + sprite->pos2.y += sprite->data[2] >> 8; + sprite->data[7] += 1; + if (sprite->data[7] == 0x3D) { + DestroyAnimSprite(sprite); + } }
\ No newline at end of file |