summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Winwood <twwinwood@gmail.com>2018-06-20 11:45:16 +0100
committerThomas Winwood <twwinwood@gmail.com>2018-06-20 11:45:16 +0100
commitef31712404dc6336569b273e01f44d0ebdd31860 (patch)
treec99ec2e8dccd11c73424fa8a27a018c1c33c2191
parent41a5fc73fd85701aa761b22f7068e590d926bea0 (diff)
Decompile sub_80DDED0
-rw-r--r--asm/ghost.s58
-rw-r--r--src/ghost.c18
2 files changed, 18 insertions, 58 deletions
diff --git a/asm/ghost.s b/asm/ghost.s
index ce914c248..66d0effef 100644
--- a/asm/ghost.s
+++ b/asm/ghost.s
@@ -7,64 +7,6 @@
@ ghost
- thumb_func_start sub_80DDED0
-sub_80DDED0: @ 80DDED0
- push {r4-r6,lr}
- lsls r0, 24
- lsrs r0, 24
- adds r5, r0, 0
- ldr r1, _080DDEF4 @ =gTasks
- lsls r0, r5, 2
- adds r0, r5
- lsls r0, 3
- adds r4, r0, r1
- ldrh r1, [r4, 0xA]
- movs r2, 0xA
- ldrsh r0, [r4, r2]
- cmp r0, 0
- ble _080DDEF8
- subs r0, r1, 0x1
- strh r0, [r4, 0xA]
- b _080DDF36
- .align 2, 0
-_080DDEF4: .4byte gTasks
-_080DDEF8:
- movs r0, 0
- bl GetAnimBattlerSpriteId
- lsls r0, 24
- lsrs r1, r0, 24
- ldrh r0, [r4, 0x8]
- adds r0, 0x8
- movs r6, 0
- strh r0, [r4, 0x8]
- lsls r0, 16
- asrs r0, 16
- cmp r0, 0xFF
- bgt _080DDF22
- movs r0, 0x8
- ldrsh r2, [r4, r0]
- adds r0, r1, 0
- adds r1, r2, 0
- movs r3, 0
- bl obj_id_set_rotscale
- b _080DDF36
-_080DDF22:
- adds r0, r1, 0
- bl sub_8078F40
- adds r0, r5, 0
- bl DestroyAnimVisualTask
- ldr r0, _080DDF3C @ =REG_BLDCNT
- strh r6, [r0]
- adds r0, 0x2
- strh r6, [r0]
-_080DDF36:
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_080DDF3C: .4byte REG_BLDCNT
- thumb_func_end sub_80DDED0
-
thumb_func_start sub_80DDF40
sub_80DDF40: @ 80DDF40
push {r4-r6,lr}
diff --git a/src/ghost.c b/src/ghost.c
index e77f26fb1..092677523 100644
--- a/src/ghost.c
+++ b/src/ghost.c
@@ -165,4 +165,22 @@ void sub_80DDE7C(u8 taskId) {
return;
gTasks[taskId].func = &sub_80DDED0;
}
+}
+
+void sub_80DDED0(u8 taskId) {
+ u8 r1;
+ if (gTasks[taskId].data[1] > 0) {
+ gTasks[taskId].data[1] -= 1;
+ return;
+ }
+ r1 = GetAnimBattlerSpriteId(0);
+ gTasks[taskId].data[0] += 8;
+ if (gTasks[taskId].data[0] <= 0xFF) {
+ obj_id_set_rotscale(r1, gTasks[taskId].data[0], gTasks[taskId].data[0], 0);
+ return;
+ }
+ sub_8078F40(r1);
+ DestroyAnimVisualTask(taskId);
+ REG_BLDCNT = 0;
+ REG_BLDALPHA = 0;
} \ No newline at end of file