decompile unk transition

This commit is contained in:
DizzyEggg 2018-01-16 23:57:26 +01:00
parent 309640a28c
commit 295aa96a05
6 changed files with 643 additions and 1689 deletions

View File

@ -1,607 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81DA700
sub_81DA700: @ 81DA700
push {lr}
sub sp, 0x8
add r1, sp, 0x4
mov r0, sp
bl sub_8149F58
ldr r0, =gUnknown_0862AD54
ldr r1, [sp, 0x4]
bl LZ77UnCompVram
ldr r0, =gUnknown_0862AF30
ldr r1, [sp]
bl LZ77UnCompVram
ldr r0, =gUnknown_0862B53C
movs r1, 0xF0
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_0862B724
bl LoadCompressedObjectPic
ldr r0, =gUnknown_0862B72C
bl LoadSpritePalette
add sp, 0x8
pop {r0}
bx r0
.pool
thumb_func_end sub_81DA700
thumb_func_start sub_81DA74C
sub_81DA74C: @ 81DA74C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
adds r5, r0, 0
adds r6, r1, 0
ldr r0, [sp, 0x24]
ldr r1, [sp, 0x28]
ldr r4, [sp, 0x2C]
lsls r2, 24
lsrs r2, 24
str r2, [sp]
lsls r3, 24
lsrs r3, 24
mov r10, r3
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r1, 24
lsrs r1, 24
mov r9, r1
lsls r4, 24
lsrs r7, r4, 24
ldr r0, =gUnknown_0862B758
lsls r5, 16
asrs r5, 16
lsls r6, 16
asrs r6, 16
adds r1, r5, 0
adds r2, r6, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r5, r0, 24
cmp r7, 0x1
beq _081DA7D0
cmp r7, 0x1
bgt _081DA7A8
cmp r7, 0
beq _081DA7B8
b _081DA7AC
.pool
_081DA7A8:
cmp r7, 0x2
beq _081DA7E4
_081DA7AC:
ldr r6, =gSprites
lsls r3, r5, 4
b _081DA7F8
.pool
_081DA7B8:
ldr r2, =gSprites
lsls r3, r5, 4
adds r0, r3, r5
lsls r0, 2
adds r0, r2
movs r1, 0x78
strh r1, [r0, 0x2E]
movs r1, 0x2D
b _081DA7F4
.pool
_081DA7D0:
ldr r2, =gSprites
lsls r3, r5, 4
adds r0, r3, r5
lsls r0, 2
adds r0, r2
movs r1, 0x59
b _081DA7F0
.pool
_081DA7E4:
ldr r2, =gSprites
lsls r3, r5, 4
adds r0, r3, r5
lsls r0, 2
adds r0, r2
movs r1, 0x97
_081DA7F0:
strh r1, [r0, 0x2E]
movs r1, 0x61
_081DA7F4:
strh r1, [r0, 0x30]
adds r6, r2, 0
_081DA7F8:
adds r4, r3, r5
lsls r4, 2
adds r0, r4, r6
mov r2, r8
lsls r1, r2, 24
asrs r1, 24
movs r2, 0
strh r1, [r0, 0x32]
mov r3, r9
lsls r1, r3, 24
asrs r1, 24
strh r1, [r0, 0x34]
mov r1, sp
ldrh r1, [r1]
strh r1, [r0, 0x3A]
mov r3, r10
strh r3, [r0, 0x3C]
strh r2, [r0, 0x36]
strh r2, [r0, 0x38]
adds r1, r7, 0
bl StartSpriteAnim
adds r0, r6, 0
adds r0, 0x1C
adds r4, r0
ldr r0, =sub_81DA848
str r0, [r4]
adds r0, r5, 0
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_81DA74C
thumb_func_start sub_81DA848
sub_81DA848: @ 81DA848
push {r4,r5,lr}
adds r3, r0, 0
adds r2, r3, 0
adds r2, 0x2E
movs r0, 0x20
ldrsh r1, [r3, r0]
movs r4, 0x2E
ldrsh r0, [r3, r4]
cmp r1, r0
bne _081DA874
movs r5, 0x22
ldrsh r1, [r3, r5]
movs r4, 0x2
ldrsh r0, [r2, r4]
cmp r1, r0
bne _081DA874
ldr r0, =SpriteCallbackDummy
str r0, [r3, 0x1C]
b _081DA8B4
.pool
_081DA874:
ldrh r4, [r2, 0x8]
movs r5, 0x8
ldrsh r1, [r2, r5]
movs r5, 0xC
ldrsh r0, [r2, r5]
cmp r1, r0
bne _081DA890
ldrh r0, [r2, 0x4]
ldrh r1, [r3, 0x20]
adds r0, r1
movs r1, 0
strh r0, [r3, 0x20]
strh r1, [r2, 0x8]
b _081DA894
_081DA890:
adds r0, r4, 0x1
strh r0, [r2, 0x8]
_081DA894:
ldrh r4, [r2, 0xA]
movs r5, 0xA
ldrsh r1, [r2, r5]
movs r5, 0xE
ldrsh r0, [r2, r5]
cmp r1, r0
bne _081DA8B0
ldrh r0, [r2, 0x6]
ldrh r1, [r3, 0x22]
adds r0, r1
movs r1, 0
strh r0, [r3, 0x22]
strh r1, [r2, 0xA]
b _081DA8B4
_081DA8B0:
adds r0, r4, 0x1
strh r0, [r2, 0xA]
_081DA8B4:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81DA848
thumb_func_start sub_81DA8BC
sub_81DA8BC: @ 81DA8BC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xC
adds r6, r0, 0
mov r8, r1
ldr r0, [sp, 0x2C]
ldr r1, [sp, 0x30]
ldr r4, [sp, 0x34]
ldr r5, [sp, 0x38]
lsls r2, 16
lsrs r2, 16
str r2, [sp]
lsls r3, 16
lsrs r3, 16
str r3, [sp, 0x4]
lsls r0, 16
lsrs r0, 16
mov r10, r0
lsls r1, 16
lsrs r1, 16
mov r9, r1
lsls r4, 16
lsrs r7, r4, 16
lsls r5, 24
lsrs r5, 24
ldr r0, =gUnknown_0862B758
lsls r6, 16
asrs r6, 16
mov r1, r8
lsls r1, 16
asrs r1, 16
mov r8, r1
adds r1, r6, 0
mov r2, r8
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r6, r0, 24
cmp r5, 0x1
beq _081DA94C
cmp r5, 0x1
bgt _081DA924
cmp r5, 0
beq _081DA934
b _081DA928
.pool
_081DA924:
cmp r5, 0x2
beq _081DA960
_081DA928:
ldr r2, =gSprites
lsls r3, r6, 4
b _081DA972
.pool
_081DA934:
ldr r2, =gSprites
lsls r3, r6, 4
adds r0, r3, r6
lsls r0, 2
adds r0, r2
movs r1, 0x78
strh r1, [r0, 0x2E]
movs r1, 0x2D
b _081DA970
.pool
_081DA94C:
ldr r2, =gSprites
lsls r3, r6, 4
adds r0, r3, r6
lsls r0, 2
adds r0, r2
movs r1, 0x59
b _081DA96C
.pool
_081DA960:
ldr r2, =gSprites
lsls r3, r6, 4
adds r0, r3, r6
lsls r0, 2
adds r0, r2
movs r1, 0x97
_081DA96C:
strh r1, [r0, 0x2E]
movs r1, 0x61
_081DA970:
strh r1, [r0, 0x30]
_081DA972:
adds r4, r3, r6
lsls r4, 2
adds r0, r4, r2
mov r3, sp
ldrh r3, [r3]
strh r3, [r0, 0x32]
mov r1, sp
ldrh r1, [r1, 0x4]
strh r1, [r0, 0x34]
mov r3, r10
strh r3, [r0, 0x36]
mov r1, r9
strh r1, [r0, 0x38]
strh r7, [r0, 0x3A]
adds r1, r5, 0
str r2, [sp, 0x8]
bl StartSpriteAnim
ldr r2, [sp, 0x8]
adds r0, r2, 0
adds r0, 0x1C
adds r4, r0
ldr r0, =sub_81DA9BC
str r0, [r4]
adds r0, r6, 0
add sp, 0xC
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_81DA8BC
thumb_func_start sub_81DA9BC
sub_81DA9BC: @ 81DA9BC
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x32]
bl Sin2
lsls r0, 16
asrs r0, 16
movs r2, 0x36
ldrsh r1, [r4, r2]
muls r0, r1
asrs r0, 12
strh r0, [r4, 0x24]
ldrh r0, [r4, 0x32]
bl Cos2
lsls r0, 16
asrs r0, 16
movs r3, 0x36
ldrsh r1, [r4, r3]
muls r0, r1
asrs r0, 12
strh r0, [r4, 0x26]
movs r1, 0x32
ldrsh r0, [r4, r1]
movs r2, 0x34
ldrsh r1, [r4, r2]
adds r0, r1
movs r1, 0xB4
lsls r1, 1
bl __modsi3
strh r0, [r4, 0x32]
ldrh r2, [r4, 0x36]
movs r3, 0x36
ldrsh r1, [r4, r3]
movs r3, 0x38
ldrsh r0, [r4, r3]
cmp r1, r0
beq _081DAA12
ldrh r0, [r4, 0x3A]
adds r0, r2, r0
strh r0, [r4, 0x36]
b _081DAA16
_081DAA12:
ldr r0, =SpriteCallbackDummy
str r0, [r4, 0x1C]
_081DAA16:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81DA9BC
thumb_func_start sub_81DAA20
sub_81DAA20: @ 81DAA20
push {r4,r5,lr}
adds r5, r0, 0
ldr r4, =0x00002e90
adds r0, r4, 0
bl FreeSpriteTilesByTag
adds r0, r4, 0
bl FreeSpritePaletteByTag
movs r0, 0x10
ldrsh r1, [r5, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r4, =gSprites
adds r0, r4
bl DestroySprite
movs r0, 0x12
ldrsh r1, [r5, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r4
bl DestroySprite
movs r0, 0x14
ldrsh r1, [r5, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r4
bl DestroySprite
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81DAA20
thumb_func_start sub_81DAA74
sub_81DAA74: @ 81DAA74
push {r4,r5,lr}
adds r3, r0, 0
ldr r2, =gSprites
movs r0, 0x10
ldrsh r1, [r3, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r5, r2, 0
adds r5, 0x1C
adds r0, r5
ldr r4, [r0]
ldr r0, =SpriteCallbackDummy
cmp r4, r0
bne _081DAAC4
movs r0, 0x12
ldrsh r1, [r3, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r5
ldr r2, [r0]
cmp r2, r4
bne _081DAAC4
movs r1, 0x14
ldrsh r0, [r3, r1]
lsls r1, r0, 4
adds r1, r0
lsls r1, 2
adds r1, r5
ldr r0, [r1]
cmp r0, r2
bne _081DAAC4
movs r0, 0x1
b _081DAAC6
.pool
_081DAAC4:
movs r0, 0
_081DAAC6:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81DAA74
thumb_func_start sub_81DAACC
sub_81DAACC: @ 81DAACC
push {r4,lr}
adds r4, r0, 0
movs r1, 0xA
ldrsh r0, [r4, r1]
cmp r0, 0
beq _081DAB20
bl sub_81DA700
ldr r1, =0x00003f41
movs r0, 0x50
bl SetGpuReg
movs r1, 0x80
lsls r1, 5
movs r0, 0x52
bl SetGpuReg
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r1, 0xA0
lsls r1, 3
movs r0, 0
movs r2, 0x2
bl ChangeBgY
movs r0, 0
strh r0, [r4, 0xA]
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
movs r0, 0x1
b _081DAB46
.pool
_081DAB20:
movs r1, 0x80
lsls r1, 6
movs r0, 0
bl ClearGpuRegBits
movs r1, 0x80
lsls r1, 7
movs r0, 0
bl ClearGpuRegBits
movs r1, 0x80
lsls r1, 1
movs r0, 0
bl ClearGpuRegBits
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
movs r0, 0
_081DAB46:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DAACC
thumb_func_start sub_81DAB4C
sub_81DAB4C: @ 81DAB4C
push {r4,lr}
sub sp, 0x4
adds r4, r0, 0
movs r1, 0xC
ldrsh r0, [r4, r1]
cmp r0, 0
bne _081DAB64
movs r1, 0x80
lsls r1, 1
movs r0, 0
bl SetGpuRegBits
_081DAB64:
ldrh r1, [r4, 0xC]
movs r2, 0xC
ldrsh r0, [r4, r2]
cmp r0, 0x10
bne _081DAB98
ldrh r1, [r4, 0xE]
movs r2, 0xE
ldrsh r0, [r4, r2]
cmp r0, 0x1F
bne _081DAB92
movs r1, 0x1
negs r1, r1
movs r0, 0
str r0, [sp]
adds r0, r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _081DABB0
_081DAB92:
adds r0, r1, 0x1
strh r0, [r4, 0xE]
b _081DABB0
_081DAB98:
adds r0, r1, 0x1
strh r0, [r4, 0xC]
ldrh r1, [r4, 0xC]
movs r0, 0x10
subs r0, r1
lsls r0, 8
orrs r1, r0
lsls r1, 16
lsrs r1, 16
movs r0, 0x52
bl SetGpuReg
_081DABB0:
movs r0, 0
add sp, 0x4
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DAB4C
.align 2, 0 @ Don't pad with nop.

View File

@ -1,985 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81DABBC
sub_81DABBC: @ 81DABBC
push {r4,lr}
adds r4, r0, 0
bl sub_81DAA74
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _081DABD2
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081DABD2:
movs r0, 0
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DABBC
thumb_func_start Phase2Task_34
Phase2Task_34: @ 81DABDC
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B770
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DABEE:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DABEE
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_34
thumb_func_start sub_81DAC14
sub_81DAC14: @ 81DAC14
push {r4-r6,lr}
sub sp, 0xC
adds r6, r0, 0
movs r1, 0x33
negs r1, r1
movs r0, 0
str r0, [sp]
movs r5, 0x2
str r5, [sp, 0x4]
str r0, [sp, 0x8]
movs r0, 0x78
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x10]
movs r0, 0x7
negs r0, r0
str r5, [sp]
movs r4, 0x2
negs r4, r4
str r4, [sp, 0x4]
movs r1, 0x1
str r1, [sp, 0x8]
movs r1, 0xC1
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x12]
str r4, [sp]
str r4, [sp, 0x4]
str r5, [sp, 0x8]
movs r0, 0xF7
movs r1, 0xC1
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x14]
ldrh r0, [r6, 0x8]
adds r0, 0x1
strh r0, [r6, 0x8]
movs r0, 0
add sp, 0xC
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_81DAC14
thumb_func_start sub_81DAC80
sub_81DAC80: @ 81DAC80
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DACA4
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_34
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DACA4:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DAC80
thumb_func_start Phase2Task_35
Phase2Task_35: @ 81DACB4
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B784
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DACC6:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DACC6
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_35
thumb_func_start sub_81DACEC
sub_81DACEC: @ 81DACEC
push {r4,r5,lr}
sub sp, 0xC
adds r5, r0, 0
movs r0, 0
str r0, [sp]
movs r4, 0x4
negs r4, r4
str r4, [sp, 0x4]
str r0, [sp, 0x8]
movs r0, 0x78
movs r1, 0xC5
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x10]
str r4, [sp]
movs r4, 0x2
str r4, [sp, 0x4]
movs r0, 0x1
str r0, [sp, 0x8]
movs r0, 0xF1
movs r1, 0x3B
movs r2, 0
movs r3, 0x1
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x12]
movs r0, 0x1
negs r0, r0
movs r1, 0x4
str r1, [sp]
str r4, [sp, 0x4]
str r4, [sp, 0x8]
movs r1, 0x3B
movs r2, 0
movs r3, 0x1
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x14]
ldrh r0, [r5, 0x8]
adds r0, 0x1
strh r0, [r5, 0x8]
movs r0, 0
add sp, 0xC
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81DACEC
thumb_func_start sub_81DAD58
sub_81DAD58: @ 81DAD58
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DAD7C
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_35
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DAD7C:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DAD58
thumb_func_start Phase2Task_36
Phase2Task_36: @ 81DAD8C
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B798
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DAD9E:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DAD9E
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_36
thumb_func_start sub_81DADC4
sub_81DADC4: @ 81DADC4
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0x10
mov r8, r0
movs r6, 0x80
str r6, [sp]
movs r4, 0
str r4, [sp, 0x4]
movs r5, 0x4
negs r5, r5
str r5, [sp, 0x8]
str r4, [sp, 0xC]
movs r0, 0x78
movs r1, 0x2D
movs r2, 0xC
movs r3, 0x4
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
mov r1, r8
strh r0, [r1, 0x10]
str r6, [sp]
str r4, [sp, 0x4]
str r5, [sp, 0x8]
movs r0, 0x1
str r0, [sp, 0xC]
movs r0, 0x59
movs r1, 0x61
movs r2, 0xFC
movs r3, 0x4
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
mov r1, r8
strh r0, [r1, 0x12]
str r6, [sp]
str r4, [sp, 0x4]
str r5, [sp, 0x8]
movs r0, 0x2
str r0, [sp, 0xC]
movs r0, 0x97
movs r1, 0x61
movs r2, 0x84
movs r3, 0x4
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
mov r1, r8
strh r0, [r1, 0x14]
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
movs r0, 0
add sp, 0x10
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_81DADC4
thumb_func_start sub_81DAE44
sub_81DAE44: @ 81DAE44
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DAE68
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_36
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DAE68:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DAE44
thumb_func_start Phase2Task_37
Phase2Task_37: @ 81DAE78
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B7AC
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DAE8A:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DAE8A
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_37
thumb_func_start sub_81DAEB0
sub_81DAEB0: @ 81DAEB0
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0x10
mov r8, r0
movs r2, 0x8E
lsls r2, 1
movs r6, 0x83
str r6, [sp]
movs r5, 0x23
str r5, [sp, 0x4]
movs r4, 0x3
negs r4, r4
str r4, [sp, 0x8]
movs r0, 0
str r0, [sp, 0xC]
movs r0, 0x78
movs r1, 0x50
movs r3, 0x8
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
mov r1, r8
strh r0, [r1, 0x10]
str r6, [sp]
str r5, [sp, 0x4]
str r4, [sp, 0x8]
movs r0, 0x1
str r0, [sp, 0xC]
movs r0, 0x78
movs r1, 0x50
movs r2, 0x2C
movs r3, 0x8
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
mov r1, r8
strh r0, [r1, 0x12]
str r6, [sp]
str r5, [sp, 0x4]
str r4, [sp, 0x8]
movs r0, 0x2
str r0, [sp, 0xC]
movs r0, 0x79
movs r1, 0x50
movs r2, 0xA4
movs r3, 0x8
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
mov r1, r8
strh r0, [r1, 0x14]
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
movs r0, 0
add sp, 0x10
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_81DAEB0
thumb_func_start sub_81DAF34
sub_81DAF34: @ 81DAF34
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DAF58
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_37
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DAF58:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DAF34
thumb_func_start Phase2Task_38
Phase2Task_38: @ 81DAF68
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B7C0
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DAF7A:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DAF7A
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_38
thumb_func_start sub_81DAFA0
sub_81DAFA0: @ 81DAFA0
push {r4,lr}
sub sp, 0xC
adds r4, r0, 0
movs r0, 0xA
ldrsh r2, [r4, r0]
cmp r2, 0
bne _081DAFCC
movs r1, 0x33
negs r1, r1
str r2, [sp]
movs r0, 0x4
str r0, [sp, 0x4]
str r2, [sp, 0x8]
movs r0, 0x78
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x10]
b _081DB01A
_081DAFCC:
cmp r2, 0x10
bne _081DAFF2
movs r0, 0x7
negs r0, r0
movs r1, 0x4
str r1, [sp]
subs r1, 0x8
str r1, [sp, 0x4]
movs r1, 0x1
str r1, [sp, 0x8]
movs r1, 0xC1
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x12]
b _081DB01A
_081DAFF2:
cmp r2, 0x20
bne _081DB01A
movs r0, 0x4
negs r0, r0
str r0, [sp]
str r0, [sp, 0x4]
movs r0, 0x2
str r0, [sp, 0x8]
movs r0, 0xF7
movs r1, 0xC1
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x14]
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081DB01A:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
movs r0, 0
add sp, 0xC
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DAFA0
thumb_func_start sub_81DB02C
sub_81DB02C: @ 81DB02C
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DB050
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_38
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DB050:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DB02C
thumb_func_start Phase2Task_39
Phase2Task_39: @ 81DB060
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B7D4
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DB072:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DB072
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_39
thumb_func_start sub_81DB098
sub_81DB098: @ 81DB098
push {r4,lr}
sub sp, 0xC
adds r4, r0, 0
movs r0, 0xA
ldrsh r1, [r4, r0]
cmp r1, 0
bne _081DB0C4
str r1, [sp]
movs r0, 0x8
negs r0, r0
str r0, [sp, 0x4]
str r1, [sp, 0x8]
movs r0, 0x78
movs r1, 0xC5
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x10]
b _081DB112
_081DB0C4:
cmp r1, 0x10
bne _081DB0E8
movs r0, 0x8
negs r0, r0
str r0, [sp]
movs r0, 0x1
str r0, [sp, 0x4]
str r0, [sp, 0x8]
movs r0, 0xF1
movs r1, 0x4E
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x12]
b _081DB112
_081DB0E8:
cmp r1, 0x20
bne _081DB112
movs r0, 0x1
negs r0, r0
movs r1, 0x8
str r1, [sp]
movs r1, 0x1
str r1, [sp, 0x4]
movs r1, 0x2
str r1, [sp, 0x8]
movs r1, 0x4E
movs r2, 0
movs r3, 0
bl sub_81DA74C
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x14]
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081DB112:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
movs r0, 0
add sp, 0xC
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DB098
thumb_func_start sub_81DB124
sub_81DB124: @ 81DB124
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DB148
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_39
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DB148:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DB124
thumb_func_start Phase2Task_40
Phase2Task_40: @ 81DB158
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B7E8
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DB16A:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DB16A
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_40
thumb_func_start sub_81DB190
sub_81DB190: @ 81DB190
push {r4,lr}
sub sp, 0x10
adds r4, r0, 0
movs r0, 0xA
ldrsh r1, [r4, r0]
cmp r1, 0
bne _081DB1BE
movs r0, 0x80
str r0, [sp]
str r1, [sp, 0x4]
subs r0, 0x84
str r0, [sp, 0x8]
str r1, [sp, 0xC]
movs r0, 0x78
movs r1, 0x2D
movs r2, 0xC
movs r3, 0x4
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x10]
b _081DB212
_081DB1BE:
cmp r1, 0x10
bne _081DB1E6
movs r0, 0x80
str r0, [sp]
movs r0, 0
str r0, [sp, 0x4]
subs r0, 0x4
str r0, [sp, 0x8]
movs r0, 0x1
str r0, [sp, 0xC]
movs r0, 0x59
movs r1, 0x61
movs r2, 0xFC
movs r3, 0x4
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x12]
b _081DB212
_081DB1E6:
cmp r1, 0x20
bne _081DB212
movs r0, 0x80
str r0, [sp]
movs r0, 0
str r0, [sp, 0x4]
subs r0, 0x4
str r0, [sp, 0x8]
movs r0, 0x2
str r0, [sp, 0xC]
movs r0, 0x97
movs r1, 0x61
movs r2, 0x84
movs r3, 0x4
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x14]
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081DB212:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
movs r0, 0
add sp, 0x10
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DB190
thumb_func_start sub_81DB224
sub_81DB224: @ 81DB224
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DB248
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_40
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DB248:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DB224
thumb_func_start Phase2Task_41
Phase2Task_41: @ 81DB258
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r5, =gUnknown_0862B7FC
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
_081DB26A:
movs r1, 0x8
ldrsh r0, [r4, r1]
lsls r0, 2
adds r0, r5
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
cmp r0, 0
bne _081DB26A
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Phase2Task_41
thumb_func_start sub_81DB290
sub_81DB290: @ 81DB290
push {r4,lr}
sub sp, 0x10
adds r4, r0, 0
movs r0, 0xA
ldrsh r1, [r4, r0]
cmp r1, 0
bne _081DB2C2
movs r2, 0x8E
lsls r2, 1
movs r0, 0x83
str r0, [sp]
movs r0, 0x23
str r0, [sp, 0x4]
subs r0, 0x26
str r0, [sp, 0x8]
str r1, [sp, 0xC]
movs r0, 0x78
movs r1, 0x50
movs r3, 0x8
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x10]
b _081DB316
_081DB2C2:
cmp r1, 0x10
bne _081DB2EA
movs r0, 0x83
str r0, [sp]
movs r0, 0x23
str r0, [sp, 0x4]
subs r0, 0x26
str r0, [sp, 0x8]
movs r0, 0x1
str r0, [sp, 0xC]
movs r0, 0x78
movs r1, 0x50
movs r2, 0x2C
movs r3, 0x8
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x12]
b _081DB316
_081DB2EA:
cmp r1, 0x20
bne _081DB316
movs r0, 0x83
str r0, [sp]
movs r0, 0x23
str r0, [sp, 0x4]
subs r0, 0x26
str r0, [sp, 0x8]
movs r0, 0x2
str r0, [sp, 0xC]
movs r0, 0x79
movs r1, 0x50
movs r2, 0xA4
movs r3, 0x8
bl sub_81DA8BC
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x14]
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081DB316:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
movs r0, 0
add sp, 0x10
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81DB290
thumb_func_start sub_81DB328
sub_81DB328: @ 81DB328
push {lr}
adds r2, r0, 0
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _081DB34C
adds r0, r2, 0
bl sub_81DAA20
ldr r0, =Phase2Task_41
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
bl DestroyTask
_081DB34C:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_81DB328
.align 2, 0 @ Don't pad with nop.

View File

@ -1,42 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_0862AD54:: @ 862AD54
.incbin "baserom.gba", 0x62ad54, 0x1dc
gUnknown_0862AF30:: @ 862AF30
.incbin "baserom.gba", 0x62af30, 0x1AC
gUnknown_0862B0DC:: @ 862B0DC
.incbin "baserom.gba", 0x62b0dc, 0x460
gUnknown_0862B53C:: @ 862B53C
.incbin "baserom.gba", 0x62b53c, 0x1E0
gUnknown_0862B71C:: @ 862B71C
.incbin "baserom.gba", 0x62b71c, 0x8
gUnknown_0862B724:: @ 862B724
obj_tiles gUnknown_0862B0DC, 0x1800, 11920
gUnknown_0862B72C:: @ 862B72C
obj_pal gUnknown_0862B53C, 11920
gUnknown_0862B734:: @ 862B734
.incbin "baserom.gba", 0x62b734, 0x8
gUnknown_0862B73C:: @ 862B73C
.incbin "baserom.gba", 0x62b73c, 0x8
gUnknown_0862B744:: @ 862B744
.incbin "baserom.gba", 0x62b744, 0x8
gUnknown_0862B74C:: @ 862B74C
.4byte gUnknown_0862B734
.4byte gUnknown_0862B73C
.4byte gUnknown_0862B744
gUnknown_0862B758:: @ 862B758
spr_template 11920, 11920, gUnknown_0862B71C, gUnknown_0862B74C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy

View File

@ -3,58 +3,14 @@
.section .rodata
gUnknown_0862B770:: @ 862B770
.4byte sub_81DAACC
.4byte sub_81DAC14
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DAC80
gUnknown_0862AD54:: @ 862AD54
.incbin "baserom.gba", 0x62ad54, 0x1dc
gUnknown_0862B784:: @ 862B784
.4byte sub_81DAACC
.4byte sub_81DACEC
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DAD58
gUnknown_0862AF30:: @ 862AF30
.incbin "baserom.gba", 0x62af30, 0x1AC
gUnknown_0862B798:: @ 862B798
.4byte sub_81DAACC
.4byte sub_81DADC4
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DAE44
gUnknown_0862B0DC:: @ 862B0DC
.incbin "baserom.gba", 0x62b0dc, 0x460
gUnknown_0862B7AC:: @ 862B7AC
.4byte sub_81DAACC
.4byte sub_81DAEB0
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DAF34
gUnknown_0862B7C0:: @ 862B7C0
.4byte sub_81DAACC
.4byte sub_81DAFA0
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DB02C
gUnknown_0862B7D4:: @ 862B7D4
.4byte sub_81DAACC
.4byte sub_81DB098
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DB124
gUnknown_0862B7E8:: @ 862B7E8
.4byte sub_81DAACC
.4byte sub_81DB190
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DB224
gUnknown_0862B7FC:: @ 862B7FC
.4byte sub_81DAACC
.4byte sub_81DB290
.4byte sub_81DABBC
.4byte sub_81DAB4C
.4byte sub_81DB328
gUnknown_0862B53C:: @ 862B53C
.incbin "baserom.gba", 0x62b53c, 0x1E0

View File

@ -273,8 +273,7 @@ SECTIONS {
src/walda_phrase.o(.text);
asm/contest_link_81D9DE4.o(.text);
asm/trainer_rematch.o(.text);
asm/unk_sprite_file.o(.text);
asm/unk_transition.o(.text);
src/unk_transition.o(.text);
src/international_string_util.o(.text);
asm/international_string_util.o(.text);
} =0
@ -539,8 +538,8 @@ SECTIONS {
src/rayquaza_scene.o(.rodata);
src/walda_phrase.o(.rodata);
data/trainer_rematch.o(.rodata);
data/unk_sprite_file.o(.rodata);
data/unk_transition.o(.rodata);
src/unk_transition.o(.rodata);
data/link_strings.o(.rodata);
data/fonts.o(.rodata);
data/mystery_event_msg.o(.rodata);

633
src/unk_transition.c Normal file
View File

@ -0,0 +1,633 @@
#include "global.h"
#include "sprite.h"
#include "decompress.h"
#include "unk_transition.h"
#include "battle_transition.h"
#include "task.h"
#include "palette.h"
#include "trig.h"
#include "bg.h"
#include "gpu_regs.h"
typedef bool8 (*TransitionStateFunc)(struct Task *task);
// this file's functions
static void sub_81DA848(struct Sprite *sprite);
static void sub_81DA9BC(struct Sprite *sprite);
static bool8 sub_81DAACC(struct Task *task);
static bool8 sub_81DAC14(struct Task *task);
static bool8 sub_81DABBC(struct Task *task);
static bool8 sub_81DAB4C(struct Task *task);
static bool8 sub_81DAC80(struct Task *task);
static bool8 sub_81DACEC(struct Task *task);
static bool8 sub_81DAD58(struct Task *task);
static bool8 sub_81DADC4(struct Task *task);
static bool8 sub_81DAE44(struct Task *task);
static bool8 sub_81DAEB0(struct Task *task);
static bool8 sub_81DAF34(struct Task *task);
static bool8 sub_81DAFA0(struct Task *task);
static bool8 sub_81DB02C(struct Task *task);
static bool8 sub_81DB098(struct Task *task);
static bool8 sub_81DB124(struct Task *task);
static bool8 sub_81DB190(struct Task *task);
static bool8 sub_81DB224(struct Task *task);
static bool8 sub_81DB290(struct Task *task);
static bool8 sub_81DB328(struct Task *task);
// const rom data
// TODO: move those from .s file to .c
extern const u8 gUnknown_0862AD54[];
extern const u8 gUnknown_0862AF30[];
extern const u8 gUnknown_0862B0DC[];
extern const u16 gUnknown_0862B53C[];
static const struct OamData sOamData_862B71C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const struct CompressedSpriteSheet sUnknown_0862B724 =
{
gUnknown_0862B0DC, 0x1800, 11920
};
static const struct SpritePalette sUnknown_0862B72C =
{
gUnknown_0862B53C, 11920
};
static const union AnimCmd sSpriteAnim_862B734[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_862B73C[] =
{
ANIMCMD_FRAME(64, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_862B744[] =
{
ANIMCMD_FRAME(128, 1),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_862B74C[] =
{
sSpriteAnim_862B734,
sSpriteAnim_862B73C,
sSpriteAnim_862B744
};
static const struct SpriteTemplate sUnknown_0862B758 =
{
.tileTag = 11920,
.paletteTag = 11920,
.oam = &sOamData_862B71C,
.anims = sSpriteAnimTable_862B74C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const TransitionStateFunc sPhase2_34_Funcs[] =
{
sub_81DAACC,
sub_81DAC14,
sub_81DABBC,
sub_81DAB4C,
sub_81DAC80
};
static const TransitionStateFunc sPhase2_35_Funcs[] =
{
sub_81DAACC,
sub_81DACEC,
sub_81DABBC,
sub_81DAB4C,
sub_81DAD58
};
static const TransitionStateFunc sPhase2_36_Funcs[] =
{
sub_81DAACC,
sub_81DADC4,
sub_81DABBC,
sub_81DAB4C,
sub_81DAE44
};
static const TransitionStateFunc sPhase2_37_Funcs[] =
{
sub_81DAACC,
sub_81DAEB0,
sub_81DABBC,
sub_81DAB4C,
sub_81DAF34
};
static const TransitionStateFunc sPhase2_38_Funcs[] =
{
sub_81DAACC,
sub_81DAFA0,
sub_81DABBC,
sub_81DAB4C,
sub_81DB02C
};
static const TransitionStateFunc sPhase2_39_Funcs[] =
{
sub_81DAACC,
sub_81DB098,
sub_81DABBC,
sub_81DAB4C,
sub_81DB124
};
static const TransitionStateFunc sPhase2_40_Funcs[] =
{
sub_81DAACC,
sub_81DB190,
sub_81DABBC,
sub_81DAB4C,
sub_81DB224
};
static const TransitionStateFunc sPhase2_41_Funcs[] =
{
sub_81DAACC,
sub_81DB290,
sub_81DABBC,
sub_81DAB4C,
sub_81DB328
};
// code
static void sub_81DA700(void)
{
u16 *dst1, *dst2;
sub_8149F58(&dst1, &dst2);
LZ77UnCompVram(gUnknown_0862AD54, dst2);
LZ77UnCompVram(gUnknown_0862AF30, dst1);
LoadPalette(gUnknown_0862B53C, 0xF0, 0x20);
LoadCompressedObjectPic(&sUnknown_0862B724);
LoadSpritePalette(&sUnknown_0862B72C);
}
static u8 sub_81DA74C(s16 x, s16 y, u8 arg2, u8 arg3, s8 arg4, s8 arg5, u8 spriteAnimNum)
{
u8 spriteId = CreateSprite(&sUnknown_0862B758, x, y, 0);
switch (spriteAnimNum)
{
case 0:
gSprites[spriteId].data[0] = 120;
gSprites[spriteId].data[1] = 45;
break;
case 1:
gSprites[spriteId].data[0] = 89;
gSprites[spriteId].data[1] = 97;
break;
case 2:
gSprites[spriteId].data[0] = 151;
gSprites[spriteId].data[1] = 97;
break;
}
gSprites[spriteId].data[2] = arg4;
gSprites[spriteId].data[3] = arg5;
gSprites[spriteId].data[6] = arg2;
gSprites[spriteId].data[7] = arg3;
gSprites[spriteId].data[4] = 0;
gSprites[spriteId].data[5] = 0;
StartSpriteAnim(&gSprites[spriteId], spriteAnimNum);
gSprites[spriteId].callback = sub_81DA848;
return spriteId;
}
static void sub_81DA848(struct Sprite *sprite)
{
s16 *data = sprite->data;
if (sprite->pos1.x == data[0] && sprite->pos1.y == data[1])
{
sprite->callback = SpriteCallbackDummy;
}
else
{
if (data[4] == data[6])
{
sprite->pos1.x += data[2];
data[4] = 0;
}
else
{
data[4]++;
}
if (data[5] == data[7])
{
sprite->pos1.y += data[3];
data[5] = 0;
}
else
{
data[5]++;
}
}
}
static u8 sub_81DA8BC(s16 x, s16 y, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, u8 spriteAnimNum)
{
u8 spriteId = CreateSprite(&sUnknown_0862B758, x, y, 0);
switch (spriteAnimNum)
{
case 0:
gSprites[spriteId].data[0] = 120;
gSprites[spriteId].data[1] = 45;
break;
case 1:
gSprites[spriteId].data[0] = 89;
gSprites[spriteId].data[1] = 97;
break;
case 2:
gSprites[spriteId].data[0] = 151;
gSprites[spriteId].data[1] = 97;
break;
}
gSprites[spriteId].data[2] = arg2;
gSprites[spriteId].data[3] = arg3;
gSprites[spriteId].data[4] = arg4;
gSprites[spriteId].data[5] = arg5;
gSprites[spriteId].data[6] = arg6;
StartSpriteAnim(&gSprites[spriteId], spriteAnimNum);
gSprites[spriteId].callback = sub_81DA9BC;
return spriteId;
}
static void sub_81DA9BC(struct Sprite *sprite)
{
sprite->pos2.x = (Sin2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096
sprite->pos2.y = (Cos2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096
sprite->data[2] = (sprite->data[2] + sprite->data[3]) % 360;
if (sprite->data[4] != sprite->data[5])
sprite->data[4] += sprite->data[6];
else
sprite->callback = SpriteCallbackDummy;
}
#define tState data[0]
static void sub_81DAA20(struct Task *task)
{
FreeSpriteTilesByTag(11920);
FreeSpritePaletteByTag(11920);
DestroySprite(&gSprites[task->data[4]]);
DestroySprite(&gSprites[task->data[5]]);
DestroySprite(&gSprites[task->data[6]]);
}
static bool8 sub_81DAA74(struct Task *task)
{
if (gSprites[task->data[4]].callback == SpriteCallbackDummy
&& gSprites[task->data[5]].callback == SpriteCallbackDummy
&& gSprites[task->data[6]].callback == SpriteCallbackDummy)
return TRUE;
else
return FALSE;
}
static bool8 sub_81DAACC(struct Task *task)
{
if (task->data[1] == 0)
{
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
task->data[1]++;
return FALSE;
}
else
{
sub_81DA700();
SetGpuReg(REG_OFFSET_BLDCNT, 0x3F41);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x1000);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0x500, 2);
task->data[1] = 0;
task->tState++;
return TRUE;
}
}
static bool8 sub_81DAB4C(struct Task *task)
{
if (task->data[2] == 0)
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON);
if (task->data[2] == 16)
{
if (task->data[3] == 31)
{
BeginNormalPaletteFade(-1, -1, 0, 0x10, 0);
task->tState++;
}
else
{
task->data[3]++;
}
}
else
{
u16 var;
task->data[2]++;
var = task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, (var) | ((16 - var) << 8));
}
return FALSE;
}
static bool8 sub_81DABBC(struct Task *task)
{
if (sub_81DAA74(task) == TRUE)
task->tState++;
return FALSE;
}
void Phase2Task_34(u8 taskId)
{
while (sPhase2_34_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DAC14(struct Task *task)
{
task->data[4] = sub_81DA74C(120, -51, 0, 0, 0, 2, 0);
task->data[5] = sub_81DA74C(-7, 193, 0, 0, 2, -2, 1);
task->data[6] = sub_81DA74C(247, 193, 0, 0, -2, -2, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAC80(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_34));
}
return FALSE;
}
void Phase2Task_35(u8 taskId)
{
while (sPhase2_35_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DACEC(struct Task *task)
{
task->data[4] = sub_81DA74C(120, 197, 0, 0, 0, -4, 0);
task->data[5] = sub_81DA74C(241, 59, 0, 1, -4, 2, 1);
task->data[6] = sub_81DA74C(-1, 59, 0, 1, 4, 2, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAD58(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_35));
}
return FALSE;
}
void Phase2Task_36(u8 taskId)
{
while (sPhase2_36_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DADC4(struct Task *task)
{
task->data[4] = sub_81DA8BC(120, 45, 12, 4, 128, 0, -4, 0);
task->data[5] = sub_81DA8BC(89, 97, 252, 4, 128, 0, -4, 1);
task->data[6] = sub_81DA8BC(151, 97, 132, 4, 128, 0, -4, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAE44(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_36));
}
return FALSE;
}
void Phase2Task_37(u8 taskId)
{
while (sPhase2_37_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DAEB0(struct Task *task)
{
task->data[4] = sub_81DA8BC(120, 80, 284, 8, 131, 35, -3, 0);
task->data[5] = sub_81DA8BC(120, 80, 44, 8, 131, 35, -3, 1);
task->data[6] = sub_81DA8BC(121, 80, 164, 8, 131, 35, -3, 2);
task->tState++;
return FALSE;
}
static bool8 sub_81DAF34(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_37));
}
return FALSE;
}
void Phase2Task_38(u8 taskId)
{
while (sPhase2_38_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DAFA0(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA74C(120, -51, 0, 0, 0, 4, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA74C(-7, 193, 0, 0, 4, -4, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA74C(247, 193, 0, 0, -4, -4, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB02C(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_38));
}
return FALSE;
}
void Phase2Task_39(u8 taskId)
{
while (sPhase2_39_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DB098(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA74C(120, 197, 0, 0, 0, -8, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA74C(241, 78, 0, 0, -8, 1, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA74C(-1, 78, 0, 0, 8, 1, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB124(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_39));
}
return FALSE;
}
void Phase2Task_40(u8 taskId)
{
while (sPhase2_40_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DB190(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA8BC(120, 45, 12, 4, 128, 0, -4, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA8BC(89, 97, 252, 4, 128, 0, -4, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA8BC(151, 97, 132, 4, 128, 0, -4, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB224(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_40));
}
return FALSE;
}
void Phase2Task_41(u8 taskId)
{
while (sPhase2_41_Funcs[gTasks[taskId].tState](&gTasks[taskId]));
}
static bool8 sub_81DB290(struct Task *task)
{
if (task->data[1] == 0)
{
task->data[4] = sub_81DA8BC(120, 80, 284, 8, 131, 35, -3, 0);
}
else if (task->data[1] == 16)
{
task->data[5] = sub_81DA8BC(120, 80, 44, 8, 131, 35, -3, 1);
}
else if (task->data[1] == 32)
{
task->data[6] = sub_81DA8BC(121, 80, 164, 8, 131, 35, -3, 2);
task->tState++;
}
task->data[1]++;
return FALSE;
}
static bool8 sub_81DB328(struct Task *task)
{
if (!gPaletteFade.active)
{
sub_81DAA20(task);
DestroyTask(FindTaskIdByFunc(Phase2Task_41));
}
return FALSE;
}