Merge pull request #216 from KDSKardabox/master

Decompile Ground Shake, Fossil Special & Flash
This commit is contained in:
Diegoisawesome 2018-02-28 22:46:11 -06:00 committed by GitHub
commit 0a9f0d80f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1487 additions and 2396 deletions

View File

@ -1,709 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start SetUpFieldMove_Flash
SetUpFieldMove_Flash: @ 81370FC
push {r4,lr}
bl ShouldDoBrailleFlyEffect
lsls r0, 24
cmp r0, 0
beq _08137134
ldr r4, =gSpecialVar_Result
bl GetCursorSelectionMonId
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =sub_8179918
b _08137152
.pool
_08137134:
ldr r0, =gMapHeader
ldrb r0, [r0, 0x15]
cmp r0, 0x1
bne _08137170
ldr r0, =0x00000888
bl FlagGet
lsls r0, 24
cmp r0, 0
bne _08137170
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =hm2_flash
_08137152:
str r0, [r1]
movs r0, 0x1
b _08137172
.pool
_08137170:
movs r0, 0
_08137172:
pop {r4}
pop {r1}
bx r1
thumb_func_end SetUpFieldMove_Flash
thumb_func_start hm2_flash
hm2_flash: @ 8137178
push {r4,lr}
bl oei_task_add
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl GetCursorSelectionMonId
ldr r1, =gFieldEffectArguments
lsls r0, 24
lsrs r0, 24
str r0, [r1]
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r2, =sub_81371B4
lsrs r1, r2, 16
strh r1, [r0, 0x18]
strh r2, [r0, 0x1A]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end hm2_flash
thumb_func_start sub_81371B4
sub_81371B4: @ 81371B4
push {lr}
movs r0, 0xCF
bl PlaySE
ldr r0, =0x00000888
bl FlagSet
ldr r0, =EventScript_2926F8
bl ScriptContext1_SetupScript
pop {r0}
bx r0
.pool
thumb_func_end sub_81371B4
thumb_func_start sub_81371D4
sub_81371D4: @ 81371D4
push {lr}
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
pop {r0}
bx r0
thumb_func_end sub_81371D4
thumb_func_start sub_81371EC
sub_81371EC: @ 81371EC
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
pop {r0}
bx r0
thumb_func_end sub_81371EC
thumb_func_start c2_change_map
c2_change_map: @ 8137200
push {r4,lr}
sub sp, 0x8
movs r0, 0
bl SetVBlankCallback
movs r0, 0
movs r1, 0
bl SetGpuReg
movs r0, 0xC
movs r1, 0
bl SetGpuReg
movs r0, 0xA
movs r1, 0
bl SetGpuReg
movs r0, 0x8
movs r1, 0
bl SetGpuReg
movs r0, 0x18
movs r1, 0
bl SetGpuReg
movs r0, 0x1A
movs r1, 0
bl SetGpuReg
movs r0, 0x14
movs r1, 0
bl SetGpuReg
movs r0, 0x16
movs r1, 0
bl SetGpuReg
movs r0, 0x10
movs r1, 0
bl SetGpuReg
movs r0, 0x12
movs r1, 0
bl SetGpuReg
mov r1, sp
movs r0, 0
strh r0, [r1]
ldr r1, =0x040000d4
mov r0, sp
str r0, [r1]
movs r0, 0xC0
lsls r0, 19
str r0, [r1, 0x4]
ldr r0, =0x8100c000
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
movs r4, 0
str r4, [sp, 0x4]
add r0, sp, 0x4
str r0, [r1]
movs r0, 0xE0
lsls r0, 19
str r0, [r1, 0x4]
ldr r0, =0x85000100
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
mov r0, sp
strh r4, [r0]
str r0, [r1]
ldr r0, =0x05000002
str r0, [r1, 0x4]
ldr r0, =0x810001ff
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
bl ResetPaletteFade
bl ResetTasks
bl ResetSpriteData
ldr r3, =0x04000208
ldrh r2, [r3]
strh r4, [r3]
ldr r4, =0x04000200
ldrh r0, [r4]
movs r1, 0x1
orrs r0, r1
strh r0, [r4]
strh r2, [r3]
ldr r0, =sub_81371EC
bl SetVBlankCallback
ldr r0, =sub_81371D4
bl SetMainCallback2
bl sub_8137304
lsls r0, 24
cmp r0, 0
bne _081372D2
ldr r0, =gMain
ldr r0, [r0, 0x8]
bl SetMainCallback2
_081372D2:
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end c2_change_map
thumb_func_start sub_8137304
sub_8137304: @ 8137304
push {r4-r7,lr}
bl get_map_light_from_warp0
lsls r0, 24
lsrs r6, r0, 24
bl Overworld_GetMapTypeOfSaveblockLocation
lsls r0, 24
lsrs r5, r0, 24
movs r3, 0
ldr r4, =gUnknown_085B27C8
ldrb r0, [r4]
cmp r0, 0
beq _08137358
adds r7, r4, 0
adds r0, r4, 0x4
mov r12, r0
_08137326:
lsls r2, r3, 3
adds r1, r2, r7
ldrb r0, [r1]
cmp r0, r6
bne _08137348
ldrb r0, [r1, 0x1]
cmp r0, r5
bne _08137348
mov r1, r12
adds r0, r2, r1
ldr r0, [r0]
bl _call_via_r0
movs r0, 0x1
b _0813735A
.pool
_08137348:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r4
ldrb r0, [r0]
cmp r0, 0
bne _08137326
_08137358:
movs r0, 0
_0813735A:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8137304
thumb_func_start sub_8137360
sub_8137360: @ 8137360
push {r4-r6,lr}
lsls r0, 24
lsls r1, 24
lsrs r5, r0, 24
lsrs r4, r1, 24
movs r3, 0
ldr r1, =gUnknown_085B27C8
ldrb r0, [r1]
cmp r0, 0
beq _081373A0
adds r6, r1, 0
_08137376:
lsls r0, r3, 3
adds r2, r0, r6
ldrb r0, [r2]
cmp r0, r5
bne _08137390
ldrb r0, [r2, 0x1]
cmp r0, r4
bne _08137390
ldrb r0, [r2, 0x2]
b _081373A2
.pool
_08137390:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _08137376
_081373A0:
movs r0, 0
_081373A2:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8137360
thumb_func_start fade_type_for_given_maplight_pair
fade_type_for_given_maplight_pair: @ 81373A8
push {r4-r6,lr}
lsls r0, 24
lsls r1, 24
lsrs r5, r0, 24
lsrs r4, r1, 24
movs r3, 0
ldr r1, =gUnknown_085B27C8
ldrb r0, [r1]
cmp r0, 0
beq _081373E8
adds r6, r1, 0
_081373BE:
lsls r0, r3, 3
adds r2, r0, r6
ldrb r0, [r2]
cmp r0, r5
bne _081373D8
ldrb r0, [r2, 0x1]
cmp r0, r4
bne _081373D8
ldrb r0, [r2, 0x3]
b _081373EA
.pool
_081373D8:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _081373BE
_081373E8:
movs r0, 0
_081373EA:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end fade_type_for_given_maplight_pair
thumb_func_start sub_81373F0
sub_81373F0: @ 81373F0
push {lr}
ldr r0, =sub_8137404
movs r1, 0
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81373F0
thumb_func_start sub_8137404
sub_8137404: @ 8137404
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r0, =sub_8137420
str r0, [r1]
bx lr
.pool
thumb_func_end sub_8137404
thumb_func_start sub_8137420
sub_8137420: @ 8137420
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0
movs r1, 0
bl SetGpuReg
ldr r0, =gCaveTransitionTiles
ldr r1, =0x0600c000
bl LZ77UnCompVram
ldr r0, =gCaveTransitionTilemap
ldr r1, =0x0600f800
bl LZ77UnCompVram
ldr r0, =gCaveTransitionPalette_White
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_085B28A0
movs r1, 0xE0
movs r2, 0x10
bl LoadPalette
ldr r1, =0x00003e41
movs r0, 0x50
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
movs r0, 0x54
movs r1, 0
bl SetGpuReg
ldr r1, =0x00001f0c
movs r0, 0x8
bl SetGpuReg
movs r1, 0x8A
lsls r1, 5
movs r0, 0
bl SetGpuReg
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_81374C4
str r1, [r0]
movs r2, 0
movs r1, 0x10
strh r1, [r0, 0x8]
strh r2, [r0, 0xA]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8137420
thumb_func_start sub_81374C4
sub_81374C4: @ 81374C4
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r5, r1, r2
ldrh r4, [r5, 0xA]
movs r0, 0x80
lsls r0, 5
adds r1, r4, r0
lsls r1, 16
lsrs r1, 16
movs r0, 0x52
bl SetGpuReg
cmp r4, 0x10
bhi _081374F8
ldrh r0, [r5, 0xA]
adds r0, 0x1
strh r0, [r5, 0xA]
b _08137500
.pool
_081374F8:
movs r0, 0
strh r0, [r5, 0xC]
ldr r0, =sub_813750C
str r0, [r5]
_08137500:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81374C4
thumb_func_start sub_813750C
sub_813750C: @ 813750C
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r1, =0x00001010
movs r0, 0x52
bl SetGpuReg
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r4, r0, r1
ldrh r1, [r4, 0xC]
cmp r1, 0x7
bhi _08137554
adds r0, r1, 0x1
strh r0, [r4, 0xC]
lsls r1, 1
ldr r0, =gUnknown_085B28A0
adds r0, r1, r0
movs r2, 0x10
subs r2, r1
lsls r2, 16
lsrs r2, 16
movs r1, 0xE0
bl LoadPalette
b _08137566
.pool
_08137554:
ldr r0, =gCaveTransitionPalette_White
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r0, =sub_8137574
str r0, [r4]
movs r0, 0x8
strh r0, [r4, 0xC]
_08137566:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813750C
thumb_func_start sub_8137574
sub_8137574: @ 8137574
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldrh r2, [r1, 0xC]
movs r3, 0xC
ldrsh r0, [r1, r3]
cmp r0, 0
beq _08137598
subs r0, r2, 0x1
strh r0, [r1, 0xC]
b _081375A0
.pool
_08137598:
ldr r0, =gMain
ldr r0, [r0, 0x8]
bl SetMainCallback2
_081375A0:
pop {r0}
bx r0
.pool
thumb_func_end sub_8137574
thumb_func_start sub_81375A8
sub_81375A8: @ 81375A8
push {lr}
ldr r0, =sub_81375BC
movs r1, 0
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81375A8
thumb_func_start sub_81375BC
sub_81375BC: @ 81375BC
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r0, =sub_81375D8
str r0, [r1]
bx lr
.pool
thumb_func_end sub_81375BC
thumb_func_start sub_81375D8
sub_81375D8: @ 81375D8
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0
movs r1, 0
bl SetGpuReg
ldr r0, =gCaveTransitionTiles
ldr r1, =0x0600c000
bl LZ77UnCompVram
ldr r0, =gCaveTransitionTilemap
ldr r1, =0x0600f800
bl LZ77UnCompVram
movs r0, 0x50
movs r1, 0
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
movs r0, 0x54
movs r1, 0
bl SetGpuReg
ldr r1, =0x00001f0c
movs r0, 0x8
bl SetGpuReg
movs r1, 0x8A
lsls r1, 5
movs r0, 0
bl SetGpuReg
ldr r0, =gCaveTransitionPalette_White
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
ldr r0, =gCaveTransitionPalette_Black
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_8137678
str r1, [r0]
movs r2, 0
movs r1, 0x10
strh r1, [r0, 0x8]
strh r2, [r0, 0xA]
strh r2, [r0, 0xC]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81375D8
thumb_func_start sub_8137678
sub_8137678: @ 8137678
push {r4,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
ldrh r1, [r4, 0xC]
cmp r1, 0xF
bhi _081376B4
adds r2, r1, 0x1
adds r0, r2, 0x1
strh r0, [r4, 0xC]
movs r0, 0xF
subs r0, r1
lsls r0, 1
ldr r1, =gUnknown_085B2890
adds r0, r1
lsls r2, 17
lsrs r2, 16
movs r1, 0xE0
bl LoadPalette
b _081376C8
.pool
_081376B4:
ldr r1, =0x00001010
movs r0, 0x52
bl SetGpuReg
ldr r1, =0x00003e41
movs r0, 0x50
bl SetGpuReg
ldr r0, =sub_81376DC
str r0, [r4]
_081376C8:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8137678
thumb_func_start sub_81376DC
sub_81376DC: @ 81376DC
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r5, r1, r2
ldrh r0, [r5, 0xA]
movs r1, 0x10
subs r1, r0
lsls r1, 16
lsrs r4, r1, 16
movs r0, 0x80
lsls r0, 21
adds r1, r0
lsrs r1, 16
movs r0, 0x52
bl SetGpuReg
cmp r4, 0
beq _08137714
ldrh r0, [r5, 0xA]
adds r0, 0x1
strh r0, [r5, 0xA]
b _08137726
.pool
_08137714:
ldr r0, =gCaveTransitionPalette_Black
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r0, =gMain
ldr r0, [r0, 0x8]
bl SetMainCallback2
_08137726:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81376DC

View File

@ -1,596 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81BE66C
sub_81BE66C: @ 81BE66C
push {lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
movs r0, 0xD0
lsls r0, 5
cmp r1, r0
bne _081BE690
movs r0, 0xA7
lsls r0, 1
bl FlagGet
lsls r0, 24
lsrs r0, 24
b _081BE692
.pool
_081BE690:
movs r0, 0
_081BE692:
pop {r1}
bx r1
thumb_func_end sub_81BE66C
thumb_func_start sub_81BE698
sub_81BE698: @ 81BE698
push {lr}
ldr r0, =gUnknown_0203CF18
ldr r0, [r0]
adds r0, 0x4
bl sub_8151E50
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE698
thumb_func_start sub_81BE6AC
sub_81BE6AC: @ 81BE6AC
ldr r1, =gUnknown_0203CF18
movs r0, 0
str r0, [r1]
bx lr
.pool
thumb_func_end sub_81BE6AC
thumb_func_start sub_81BE6B8
sub_81BE6B8: @ 81BE6B8
push {r4,lr}
ldr r4, =gUnknown_0203CF18
ldr r0, [r4]
cmp r0, 0
beq _081BE6CC
movs r0, 0
str r0, [r4]
b _081BE718
.pool
_081BE6CC:
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
movs r0, 0xD0
lsls r0, 5
cmp r1, r0
bne _081BE718
movs r0, 0xA7
lsls r0, 1
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081BE718
movs r0, 0xC8
bl AllocZeroed
str r0, [r4]
adds r0, 0x4
bl sub_8151B3C
ldr r0, [r4]
adds r0, 0x4
ldr r1, =gUnknown_08617E18
bl sub_8151B68
ldr r0, [r4]
adds r0, 0x4
movs r1, 0x1
movs r2, 0x1
bl sub_8151CA8
ldr r0, =sub_81BE698
movs r1, 0xFF
bl CreateTask
ldr r1, [r4]
strb r0, [r1]
_081BE718:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE6B8
thumb_func_start sub_81BE72C
sub_81BE72C: @ 81BE72C
push {r4,lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
movs r0, 0xD0
lsls r0, 5
cmp r1, r0
bne _081BE788
movs r0, 0xA7
lsls r0, 1
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081BE788
ldr r4, =gUnknown_0203CF18
ldr r0, [r4]
cmp r0, 0
beq _081BE788
ldr r0, =sub_81BE698
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
beq _081BE766
ldr r0, [r4]
ldrb r0, [r0]
bl DestroyTask
_081BE766:
ldr r0, [r4]
adds r0, 0x4
movs r1, 0x1
movs r2, 0x1
bl sub_8151D28
ldr r0, [r4]
adds r0, 0x4
movs r1, 0x1
movs r2, 0x1
bl sub_8151C50
ldr r0, [r4]
bl Free
movs r0, 0
str r0, [r4]
_081BE788:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE72C
thumb_func_start sub_81BE79C
sub_81BE79C: @ 81BE79C
push {r4,lr}
ldr r0, =0x000040cb
bl VarGet
lsls r0, 16
cmp r0, 0
beq _081BE7B8
movs r0, 0xA7
lsls r0, 1
bl FlagClear
b _081BE7EE
.pool
_081BE7B8:
bl Random
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x1
ands r4, r0
movs r0, 0x9D
bl FlagGet
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _081BE7D4
movs r4, 0x1
_081BE7D4:
cmp r4, 0
beq _081BE7E6
movs r0, 0xA7
lsls r0, 1
bl FlagSet
bl sub_81BE6B8
b _081BE7EE
_081BE7E6:
movs r0, 0xA7
lsls r0, 1
bl FlagClear
_081BE7EE:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81BE79C
thumb_func_start sub_81BE7F4
sub_81BE7F4: @ 81BE7F4
push {lr}
ldr r0, =sub_81BE808
movs r1, 0x8
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE7F4
thumb_func_start sub_81BE808
sub_81BE808: @ 81BE808
push {r4,r5,lr}
sub sp, 0x4
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrb r1, [r0, 0x5]
ldrb r2, [r0, 0x4]
movs r0, 0x2D
mov r3, sp
bl TryGetFieldObjectIdByLocalIdAndMap
mov r0, sp
ldrb r0, [r0]
lsls r2, r0, 3
adds r2, r0
lsls r2, 2
ldr r4, =gMapObjects
adds r2, r4
ldr r3, =gSprites
ldrb r1, [r2, 0x4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r3
ldrh r1, [r0, 0x26]
adds r1, 0x4
strh r1, [r0, 0x26]
ldr r0, =gPlayerAvatar
ldrb r0, [r0, 0x5]
lsls r1, r0, 3
adds r1, r0
lsls r1, 2
adds r1, r4
ldrb r2, [r2, 0x4]
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
adds r0, r3
movs r4, 0x22
ldrsh r2, [r0, r4]
movs r4, 0x26
ldrsh r0, [r0, r4]
adds r2, r0
ldrb r1, [r1, 0x4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r3
movs r3, 0x22
ldrsh r1, [r0, r3]
movs r4, 0x26
ldrsh r0, [r0, r4]
adds r1, r0
cmp r2, r1
blt _081BE882
adds r0, r5, 0
bl DestroyTask
bl EnableBothScriptContexts
_081BE882:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE808
thumb_func_start sp136_strengh_sound
sp136_strengh_sound: @ 81BE89C
push {r4-r6,lr}
mov r6, r8
push {r6}
mov r8, r0
adds r4, r1, 0
adds r5, r2, 0
adds r6, r3, 0
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r4, 24
lsrs r4, 24
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
ldr r0, =sub_81BE900
movs r1, 0x9
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
movs r0, 0
strh r4, [r1, 0x8]
strh r0, [r1, 0xA]
strh r5, [r1, 0xC]
strh r6, [r1, 0xE]
mov r0, r8
strh r0, [r1, 0x10]
movs r0, 0
bl SetCameraPanningCallback
movs r0, 0xD6
bl PlaySE
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sp136_strengh_sound
thumb_func_start sub_81BE900
sub_81BE900: @ 81BE900
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r4, r0, r1
ldrh r0, [r4, 0x2]
adds r0, 0x1
strh r0, [r4, 0x2]
movs r1, 0x2
ldrsh r0, [r4, r1]
movs r2, 0x6
ldrsh r1, [r4, r2]
bl __modsi3
cmp r0, 0
bne _081BE95C
strh r0, [r4, 0x2]
ldrh r0, [r4, 0x4]
subs r0, 0x1
strh r0, [r4, 0x4]
ldrh r0, [r4]
negs r0, r0
strh r0, [r4]
ldrh r0, [r4, 0x8]
negs r0, r0
strh r0, [r4, 0x8]
movs r1, 0
ldrsh r0, [r4, r1]
movs r2, 0x8
ldrsh r1, [r4, r2]
bl SetCameraPanning
movs r1, 0x4
ldrsh r0, [r4, r1]
cmp r0, 0
bne _081BE95C
bl sub_81BE968
adds r0, r5, 0
bl DestroyTask
bl InstallCameraPanAheadCallback
_081BE95C:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE900
thumb_func_start sub_81BE968
sub_81BE968: @ 81BE968
push {lr}
ldr r0, =sub_81BE9C0
bl FindTaskIdByFunc
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0xFF
beq _081BE988
ldr r0, =gTasks
lsls r1, r2, 2
adds r1, r2
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_081BE988:
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE968
thumb_func_start sub_81BE994
sub_81BE994: @ 81BE994
push {lr}
ldr r0, =gUnknown_08617D94
bl LoadSpriteSheets
bl sub_81BEA20
ldr r0, =sub_81BE9C0
movs r1, 0x8
bl CreateTask
movs r0, 0x2
movs r1, 0x1
movs r2, 0x10
movs r3, 0x3
bl sp136_strengh_sound
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE994
thumb_func_start sub_81BE9C0
sub_81BE9C0: @ 81BE9C0
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r3, r1, 3
ldr r4, =gTasks + 0x8
adds r2, r3, r4
ldrh r0, [r2, 0x2]
adds r0, 0x1
strh r0, [r2, 0x2]
lsls r0, 16
movs r1, 0xFA
lsls r1, 18
cmp r0, r1
beq _081BE9E6
ldrh r0, [r2]
cmp r0, 0x11
bne _081BE9F0
_081BE9E6:
adds r0, r4, 0
subs r0, 0x8
adds r0, r3, r0
ldr r1, =sub_81BEA00
str r1, [r0]
_081BE9F0:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE9C0
thumb_func_start sub_81BEA00
sub_81BEA00: @ 81BEA00
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0xFA
lsls r0, 4
bl FreeSpriteTilesByTag
adds r0, r4, 0
bl DestroyTask
bl EnableBothScriptContexts
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81BEA00
thumb_func_start sub_81BEA20
sub_81BEA20: @ 81BEA20
push {r4-r7,lr}
movs r4, 0
ldr r5, =gUnknown_08617D64
adds r7, r5, 0x2
ldr r6, =gSprites
_081BEA2A:
lsls r0, r4, 1
adds r0, r4
lsls r0, 1
adds r1, r0, r5
ldrh r1, [r1]
adds r1, 0x78
lsls r1, 16
asrs r1, 16
adds r0, r7
movs r3, 0
ldrsh r2, [r0, r3]
ldr r0, =gUnknown_08617E60
movs r3, 0x8
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrb r2, [r0, 0x5]
movs r3, 0xD
negs r3, r3
adds r1, r3, 0
ands r2, r1
movs r1, 0xF
ands r2, r1
strb r2, [r0, 0x5]
strh r4, [r0, 0x2E]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081BEA2A
movs r4, 0
ldr r5, =gUnknown_08617D64
adds r7, r5, 0x2
ldr r6, =gSprites
_081BEA78:
lsls r0, r4, 1
adds r0, r4
lsls r0, 1
adds r1, r0, r5
ldrh r1, [r1]
adds r1, 0x73
lsls r1, 16
asrs r1, 16
adds r0, r7
ldrh r2, [r0]
subs r2, 0x3
lsls r2, 16
asrs r2, 16
ldr r0, =gUnknown_08617E34
movs r3, 0x8
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrb r2, [r0, 0x5]
movs r3, 0xD
negs r3, r3
adds r1, r3, 0
ands r2, r1
movs r1, 0xF
ands r2, r1
strb r2, [r0, 0x5]
strh r4, [r0, 0x2E]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081BEA78
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEA20
thumb_func_start sub_81BEAD8
sub_81BEAD8: @ 81BEAD8
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x30]
adds r0, 0x2
strh r0, [r4, 0x30]
movs r1, 0x30
ldrsh r0, [r4, r1]
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
strh r0, [r4, 0x26]
movs r0, 0x22
ldrsh r3, [r4, r0]
movs r1, 0x26
ldrsh r0, [r4, r1]
adds r3, r0
ldr r2, =gUnknown_08617D64
movs r0, 0x2E
ldrsh r1, [r4, r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 1
adds r2, 0x4
adds r0, r2
movs r1, 0
ldrsh r0, [r0, r1]
cmp r3, r0
ble _081BEB1A
adds r0, r4, 0
bl DestroySprite
bl sub_81BE968
_081BEB1A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEAD8
.align 2, 0 @ Don't pad with nop.

View File

@ -5,893 +5,6 @@
.text
thumb_func_start sub_81BEB24
sub_81BEB24: @ 81BEB24
push {r4,r5,lr}
movs r4, 0
ldr r5, =gUnknown_08617DA4
_081BEB2A:
lsls r2, r4, 2
adds r2, r5
ldrb r0, [r2]
adds r0, 0x7
ldrb r1, [r2, 0x1]
adds r1, 0x7
ldrh r2, [r2, 0x2]
bl MapGridSetMetatileIdAt
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x11
bls _081BEB2A
bl DrawWholeMapView
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB24
thumb_func_start sub_81BEB54
sub_81BEB54: @ 81BEB54
push {lr}
ldr r0, =sub_81BED50
movs r1, 0x9
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB54
thumb_func_start sub_81BEB68
sub_81BEB68: @ 81BEB68
push {lr}
ldr r0, =sub_81BEBF4
movs r1, 0x9
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB68
thumb_func_start sub_81BEB7C
sub_81BEB7C: @ 81BEB7C
push {lr}
ldr r0, =sub_81BF028
movs r1, 0x9
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB7C
thumb_func_start sub_81BEB90
sub_81BEB90: @ 81BEB90
push {r4,lr}
ldr r4, =gUnknown_0203CF14
ldr r0, [r4]
ldrh r1, [r0]
movs r0, 0x10
bl SetGpuReg
ldr r0, [r4]
ldrh r1, [r0, 0x2]
movs r0, 0x12
bl SetGpuReg
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB90
thumb_func_start sub_81BEBB4
sub_81BEBB4: @ 81BEBB4
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r2, r1, r2
ldrh r1, [r2, 0x8]
movs r3, 0x8
ldrsh r0, [r2, r3]
cmp r0, 0
bne _081BEBEC
ldr r0, =gUnknown_0203CF14
ldr r1, [r0]
ldrh r0, [r1]
negs r0, r0
strh r0, [r1]
movs r0, 0x2
strh r0, [r2, 0x8]
bl sub_81BEB90
b _081BEBF0
.pool
_081BEBEC:
subs r0, r1, 0x1
strh r0, [r2, 0x8]
_081BEBF0:
pop {r0}
bx r0
thumb_func_end sub_81BEBB4
thumb_func_start sub_81BEBF4
sub_81BEBF4: @ 81BEBF4
push {r4,r5,lr}
sub sp, 0xC
lsls r0, 24
lsrs r5, r0, 24
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
movs r1, 0x8
ldrsh r0, [r0, r1]
cmp r0, 0x6
bls _081BEC10
b _081BED40
_081BEC10:
lsls r0, 2
ldr r1, =_081BEC24
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081BEC24:
.4byte _081BEC40
.4byte _081BEC50
.4byte _081BEC88
.4byte _081BECB0
.4byte _081BECF8
.4byte _081BED00
.4byte _081BED1C
_081BEC40:
bl FreeAllWindowBuffers
movs r0, 0
movs r1, 0x7
movs r2, 0x2
bl SetBgAttribute
b _081BED04
_081BEC50:
ldr r4, =gUnknown_0203CF04
movs r0, 0x92
lsls r0, 4
bl AllocZeroed
str r0, [r4]
ldr r4, =gUnknown_0203CF08
movs r0, 0x80
lsls r0, 4
bl AllocZeroed
str r0, [r4]
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
b _081BECD8
.pool
_081BEC88:
ldr r0, =gUnknown_08617274
ldr r4, =gUnknown_0203CF04
ldr r1, [r4]
movs r2, 0x92
lsls r2, 3
bl CpuSet
ldr r1, [r4]
movs r2, 0x92
lsls r2, 4
movs r0, 0
movs r3, 0
bl LoadBgTiles
b _081BECD8
.pool
_081BECB0:
ldr r0, =gUnknown_0203CF08
ldr r1, [r0]
movs r0, 0
bl SetBgTilemapBuffer
ldr r1, =gUnknown_08617B94
movs r0, 0x6
str r0, [sp]
movs r0, 0xC
str r0, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
movs r2, 0xC
movs r3, 0x1D
bl CopyToBgTilemapBufferRect_ChangePalette
movs r0, 0
bl CopyBgTilemapBufferToVram
_081BECD8:
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
ldrh r1, [r0, 0x8]
adds r1, 0x1
strh r1, [r0, 0x8]
b _081BED40
.pool
_081BECF8:
movs r0, 0
bl ShowBg
b _081BED04
_081BED00:
bl sub_81BEB24
_081BED04:
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
b _081BED40
.pool
_081BED1C:
ldr r4, =gUnknown_0203CF14
movs r0, 0x4
bl Alloc
str r0, [r4]
movs r2, 0
movs r1, 0x2
strh r1, [r0]
strh r2, [r0, 0x2]
ldr r0, =sub_81BEBB4
movs r1, 0xA
bl CreateTask
adds r0, r5, 0
bl DestroyTask
bl EnableBothScriptContexts
_081BED40:
add sp, 0xC
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEBF4
thumb_func_start sub_81BED50
sub_81BED50: @ 81BED50
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
lsls r0, 24
lsrs r0, 24
mov r10, r0
ldr r1, =gTasks
lsls r0, 2
add r0, r10
lsls r0, 3
adds r0, r1
ldrh r0, [r0, 0x8]
subs r0, 0x1
lsls r0, 16
asrs r0, 16
adds r6, r1, 0
cmp r0, 0x7
bls _081BED7C
b _081BF002
_081BED7C:
lsls r0, 2
ldr r1, =_081BED90
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081BED90:
.4byte _081BEDB0
.4byte _081BF002
.4byte _081BEDC4
.4byte _081BEF64
.4byte _081BEF94
.4byte _081BEFD0
.4byte _081BEFF0
.4byte _081BEFF8
_081BEDB0:
ldr r4, =gUnknown_0203CF10
movs r0, 0xC0
lsls r0, 2
bl AllocZeroed
str r0, [r4]
b _081BF002
.pool
_081BEDC4:
mov r1, r10
lsls r0, r1, 2
adds r1, r0, r1
lsls r1, 3
adds r2, r1, r6
ldrh r3, [r2, 0xE]
movs r4, 0xE
ldrsh r1, [r2, r4]
str r0, [sp, 0x8]
cmp r1, 0x5F
bgt _081BEE8A
movs r1, 0xA
ldrsh r0, [r2, r1]
cmp r0, 0x1
ble _081BEE7C
lsls r0, r3, 24
lsrs r4, r0, 24
movs r0, 0x30
bl Alloc
ldr r3, =gUnknown_0203CF10
ldr r1, [r3]
lsls r2, r4, 3
adds r1, r2, r1
str r0, [r1]
movs r5, 0
adds r4, r2, 0
_081BEDFA:
ldr r0, [r3]
adds r0, r4, r0
ldr r0, [r0]
adds r0, r5
strb r5, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x2F
bls _081BEDFA
movs r5, 0
ldr r7, =gUnknown_0203CF10
adds r6, r2, 0
_081BEE14:
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x30
bl __umodsi3
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x30
bl __umodsi3
lsls r0, 16
lsrs r0, 16
ldr r1, [r7]
adds r1, r6, r1
ldr r1, [r1]
adds r0, r1, r0
ldrb r2, [r0]
adds r1, r4
ldrb r1, [r1]
strb r1, [r0]
ldr r0, [r7]
adds r0, r6, r0
ldr r0, [r0]
adds r0, r4
strb r2, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x2F
bls _081BEE14
ldr r0, =gTasks
ldr r1, [sp, 0x8]
add r1, r10
lsls r1, 3
adds r2, r1, r0
ldrh r3, [r2, 0xE]
movs r4, 0xE
ldrsh r1, [r2, r4]
adds r6, r0, 0
cmp r1, 0x5F
bgt _081BEE78
adds r0, r3, 0x1
strh r0, [r2, 0xE]
_081BEE78:
movs r0, 0
strh r0, [r2, 0xA]
_081BEE7C:
ldr r1, [sp, 0x8]
add r1, r10
lsls r1, 3
adds r1, r6
ldrh r0, [r1, 0xA]
adds r0, 0x1
strh r0, [r1, 0xA]
_081BEE8A:
ldr r0, [sp, 0x8]
add r0, r10
lsls r0, 3
adds r0, r6
ldrb r4, [r0, 0xE]
ldrb r5, [r0, 0xC]
lsls r0, r4, 16
cmp r5, r4
bcs _081BEF32
str r0, [sp, 0xC]
_081BEE9E:
movs r6, 0
adds r0, r5, 0x1
str r0, [sp, 0x4]
lsls r4, r5, 3
movs r2, 0x5F
subs r1, r2, r5
lsls r0, r1, 1
adds r0, r1
lsls r0, 4
mov r9, r0
_081BEEB2:
ldr r0, =gUnknown_0203CF04
ldr r0, [r0]
ldr r7, =gUnknown_0203CF10
ldr r3, [r7]
adds r3, r4, r3
ldrb r2, [r3, 0x4]
adds r1, r2, 0x1
strb r1, [r3, 0x4]
lsls r2, 24
lsrs r2, 24
ldr r1, [r3]
adds r1, r2
ldrb r1, [r1]
add r1, r9
lsls r1, 16
lsrs r1, 16
movs r2, 0x1
mov r8, r2
str r2, [sp]
movs r2, 0
movs r3, 0x30
bl sub_81BF2B8
adds r0, r6, 0x1
lsls r0, 24
lsrs r6, r0, 24
cmp r6, 0
beq _081BEEB2
ldr r0, [r7]
adds r1, r4, r0
ldrb r0, [r1, 0x4]
cmp r0, 0x2F
bls _081BEF24
ldr r0, [r1]
bl Free
ldr r0, [r7]
adds r0, r4, r0
movs r1, 0
str r1, [r0]
ldr r1, [sp, 0x8]
add r1, r10
lsls r1, 3
ldr r4, =gTasks
adds r1, r4
ldrh r0, [r1, 0xC]
adds r0, 0x1
strh r0, [r1, 0xC]
mov r0, r8
ands r5, r0
cmp r5, 0x1
bne _081BEF24
ldr r0, =gUnknown_0203CF14
ldr r1, [r0]
ldrh r0, [r1, 0x2]
subs r0, 0x1
strh r0, [r1, 0x2]
_081BEF24:
ldr r1, [sp, 0x4]
lsls r0, r1, 16
lsrs r5, r0, 16
ldr r2, [sp, 0xC]
lsrs r0, r2, 16
cmp r5, r0
bcc _081BEE9E
_081BEF32:
ldr r0, =gUnknown_0203CF04
ldr r1, [r0]
movs r2, 0x92
lsls r2, 4
movs r0, 0
movs r3, 0
bl LoadBgTiles
ldr r0, =gUnknown_0203CF10
ldr r0, [r0]
movs r4, 0xBE
lsls r4, 2
adds r0, r4
ldrb r0, [r0, 0x4]
cmp r0, 0x2F
bhi _081BF002
b _081BF014
.pool
_081BEF64:
movs r0, 0
bl UnsetBgTilemapBuffer
ldr r0, =sub_81BEBB4
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
cmp r0, 0xFF
beq _081BEF7C
bl DestroyTask
_081BEF7C:
ldr r0, =gUnknown_0203CF14
ldr r1, [r0]
movs r0, 0
strh r0, [r1]
strh r0, [r1, 0x2]
bl sub_81BEB90
b _081BF002
.pool
_081BEF94:
ldr r4, =gUnknown_0203CF14
ldr r0, [r4]
bl Free
movs r5, 0
str r5, [r4]
ldr r4, =gUnknown_0203CF10
ldr r0, [r4]
bl Free
str r5, [r4]
ldr r4, =gUnknown_0203CF04
ldr r0, [r4]
bl Free
str r5, [r4]
ldr r4, =gUnknown_0203CF08
ldr r0, [r4]
bl Free
str r5, [r4]
b _081BF002
.pool
_081BEFD0:
movs r0, 0xC
movs r1, 0x2
bl SetGpuRegBits
movs r0, 0x8
movs r1, 0
bl SetGpuRegBits
movs r0, 0
movs r1, 0x7
movs r2, 0
bl SetBgAttribute
bl sub_81971D0
b _081BF002
_081BEFF0:
movs r0, 0
bl ShowBg
b _081BF002
_081BEFF8:
mov r0, r10
bl DestroyTask
bl EnableBothScriptContexts
_081BF002:
ldr r0, =gTasks
mov r2, r10
lsls r1, r2, 2
add r1, r10
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_081BF014:
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BED50
thumb_func_start sub_81BF028
sub_81BF028: @ 81BF028
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x18
lsls r0, 24
lsrs r7, r0, 24
ldr r1, =gTasks
lsls r0, r7, 2
adds r0, r7
lsls r0, 3
adds r0, r1
ldrh r0, [r0, 0x8]
subs r0, 0x1
lsls r0, 16
asrs r0, 16
cmp r0, 0x7
bls _081BF04C
b _081BF228
_081BF04C:
lsls r0, 2
ldr r1, =_081BF060
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081BF060:
.4byte _081BF080
.4byte _081BF0B4
.4byte _081BF0DC
.4byte _081BF0F0
.4byte _081BF148
.4byte _081BF170
.4byte _081BF1CC
.4byte _081BF224
_081BF080:
ldr r4, =gUnknown_0203CF0C
movs r0, 0x14
bl AllocZeroed
str r0, [r4]
movs r0, 0x80
bl AllocZeroed
ldr r1, [r4]
str r0, [r1]
movs r0, 0x8
bl AllocZeroed
ldr r1, [r4]
str r0, [r1, 0x4]
movs r0, 0x80
lsls r0, 2
bl AllocZeroed
ldr r1, [r4]
str r0, [r1, 0xC]
movs r0, 0
strh r0, [r1, 0x10]
b _081BF228
.pool
_081BF0B4:
ldr r0, =gUnknown_0203CF0C
ldr r0, [r0]
ldr r1, [r0]
movs r5, 0
ldr r2, =gRootFossil_Gfx
_081BF0BE:
adds r0, r5, r2
ldrb r0, [r0]
strb r0, [r1]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
adds r1, 0x1
cmp r5, 0x7F
bls _081BF0BE
b _081BF228
.pool
_081BF0DC:
ldr r0, =gUnknown_0203CF0C
ldr r0, [r0]
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [r1]
movs r0, 0x80
strh r0, [r1, 0x4]
b _081BF228
.pool
_081BF0F0:
mov r1, sp
ldr r0, =gUnknown_08617E00
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldr r4, =gUnknown_0203CF0C
ldr r0, [r4]
ldr r0, [r0, 0x4]
str r0, [sp, 0xC]
movs r2, 0x10
negs r2, r2
mov r0, sp
movs r1, 0x80
movs r3, 0x1
bl CreateSprite
ldr r1, [r4]
movs r3, 0
strb r0, [r1, 0x8]
ldr r2, =gSprites
ldr r0, [r4]
ldrb r1, [r0, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
adds r0, 0x28
strb r3, [r0]
ldr r3, [r4]
ldrb r1, [r3, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldrh r1, [r0, 0x20]
strh r1, [r0, 0x2E]
ldrb r1, [r3, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
movs r1, 0x1
strh r1, [r0, 0x30]
_081BF148:
movs r5, 0
ldr r2, =gUnknown_0203CF0C
_081BF14C:
ldr r0, [r2]
ldr r1, [r0, 0xC]
lsls r0, r5, 1
adds r0, r1
strh r5, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0xFF
bls _081BF14C
b _081BF228
.pool
_081BF170:
movs r5, 0
movs r6, 0xFF
ldr r0, =0x000001ff
mov r8, r0
_081BF178:
bl Random
adds r4, r6, 0
ands r4, r0
bl Random
adds r1, r6, 0
ands r1, r0
ldr r0, =gUnknown_0203CF0C
ldr r3, [r0]
ldr r0, [r3, 0xC]
lsls r1, 1
adds r1, r0
ldrh r2, [r1]
lsls r4, 1
adds r4, r0
ldrh r0, [r4]
strh r0, [r1]
strh r2, [r4]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, r8
bls _081BF178
ldr r2, =gSprites
ldrb r1, [r3, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r2, 0x1C
adds r0, r2
ldr r1, =sub_81BF248
str r1, [r0]
b _081BF228
.pool
_081BF1CC:
ldr r3, =gSprites
ldr r5, =gUnknown_0203CF0C
ldr r0, [r5]
ldrb r1, [r0, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r2, r0, 2
adds r0, r3, 0
adds r0, 0x1C
adds r0, r2, r0
ldr r1, [r0]
ldr r0, =SpriteCallbackDummy
cmp r1, r0
bne _081BF238
adds r0, r2, r3
bl DestroySprite
ldr r0, [r5]
ldr r0, [r0, 0xC]
bl Free
ldr r0, [r5]
movs r4, 0
str r4, [r0, 0xC]
ldr r0, [r0, 0x4]
bl Free
ldr r0, [r5]
str r4, [r0, 0x4]
ldr r0, [r0]
bl Free
ldr r0, [r5]
str r4, [r0]
bl Free
str r4, [r5]
b _081BF228
.pool
_081BF224:
bl EnableBothScriptContexts
_081BF228:
ldr r0, =gTasks
lsls r1, r7, 2
adds r1, r7
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_081BF238:
add sp, 0x18
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BF028
thumb_func_start sub_81BF248
sub_81BF248: @ 81BF248
push {r4,r5,lr}
sub sp, 0x4
adds r5, r0, 0
ldr r0, =gUnknown_0203CF0C
ldr r0, [r0]
ldrh r0, [r0, 0x10]
cmp r0, 0xFF
bls _081BF268
ldr r0, =SpriteCallbackDummy
str r0, [r5, 0x1C]
b _081BF2B0
.pool
_081BF268:
ldrh r1, [r5, 0x22]
movs r2, 0x22
ldrsh r0, [r5, r2]
cmp r0, 0x5F
ble _081BF2AC
movs r4, 0
_081BF274:
ldr r0, =gUnknown_0203CF0C
ldr r3, [r0]
ldr r0, [r3]
ldrh r1, [r3, 0x10]
adds r2, r1, 0x1
strh r2, [r3, 0x10]
lsls r1, 16
ldr r2, [r3, 0xC]
lsrs r1, 15
adds r1, r2
ldrh r1, [r1]
movs r2, 0
str r2, [sp]
movs r3, 0x10
bl sub_81BF2B8
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x1
bls _081BF274
adds r0, r5, 0
movs r1, 0
bl StartSpriteAnim
b _081BF2B0
.pool
_081BF2AC:
adds r0, r1, 0x1
strh r0, [r5, 0x22]
_081BF2B0:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81BF248
thumb_func_start sub_81BF2B8
sub_81BF2B8: @ 81BF2B8
push {r4-r7,lr}

View File

@ -1,81 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_085B27C8:: @ 85B27C8
.byte 0x01, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x02, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x03, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x05, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x06, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x07, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x08, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x09, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x04, 0x01, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x02, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x03, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x05, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x06, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x07, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x08, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x09, 0x00, 0x01
.4byte sub_81373F0
.byte 0x00, 0x00, 0x00, 0x00
.4byte NULL
.align 2
gCaveTransitionPalette_White:: @ 85B2850
.incbin "graphics/misc/cave_transition_white.gbapal"
.align 2
gCaveTransitionPalette_Black:: @ 85B2870
.incbin "graphics/misc/cave_transition_black.gbapal"
.align 2
gUnknown_085B2890:: @ 85B2890
.incbin "graphics/misc/85B2890.gbapal"
.align 2
gUnknown_085B28A0:: @ 85B28A0
.incbin "graphics/misc/85B28A0.gbapal"
.align 2
gCaveTransitionTilemap:: @ 85B28B0
.incbin "graphics/misc/cave_transition_map.bin.lz"
.align 2
gCaveTransitionTiles:: @ 85B2A90
.incbin "graphics/misc/cave_transition.4bpp.lz"

View File

@ -1,98 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_08617274:: @ 8617274
.space 0x20
.incbin "graphics/misc/mirage_tower.4bpp"
.align 2
gUnknown_08617B94:: @ 8617B94
.incbin "graphics/misc/mirage_tower.bin"
.align 2
gRootFossil_Pal:: @ 8617C24
.incbin "graphics/misc/fossil.gbapal"
.align 2
gRootFossil_Gfx:: @ 8617C44
.incbin "graphics/misc/fossil.4bpp"
.align 2
gMirageTowerCrumbles_Gfx:: @ 8617CC4
.incbin "graphics/misc/mirage_tower_crumbles.4bpp"
.align 2
gMirageTowerCrumbles_Palette:: @ 8617D44
.incbin "graphics/misc/mirage_tower_crumbles.gbapal"
.align 1
gUnknown_08617D64:: @ 8617D64
.2byte 0x0000, 0x000a, 0x0041, 0x0011, 0x0003, 0x0032, 0xfff4, 0x0000, 0x004b, 0x000a, 0x000f, 0x005a, 0x0007, 0x0008, 0x0041, 0xffee
.2byte 0x0005, 0x004b, 0x0016, 0xfff6, 0x0037, 0xffe8, 0xfffc, 0x0041
.align 2
gUnknown_08617D94:: @ 8617D94
obj_tiles gMirageTowerCrumbles_Gfx, 0x0080, 0x0fa0
null_obj_tiles
.align 2
gUnknown_08617DA4:: @ 8617DA4
.byte 0x12, 0x35, 0x51, 0x02, 0x13, 0x35, 0x51, 0x02, 0x14, 0x35, 0x51, 0x02, 0x12, 0x36, 0x51, 0x02, 0x13, 0x36, 0x51, 0x02, 0x14, 0x36, 0x51, 0x02, 0x12, 0x37, 0x51, 0x02, 0x13, 0x37, 0x51, 0x02
.byte 0x14, 0x37, 0x51, 0x02, 0x12, 0x38, 0x51, 0x02, 0x13, 0x38, 0x51, 0x02, 0x14, 0x38, 0x51, 0x02, 0x12, 0x39, 0x59, 0x02, 0x13, 0x39, 0x59, 0x02, 0x14, 0x39, 0x59, 0x02, 0x12, 0x3a, 0x21, 0x01
.byte 0x13, 0x3a, 0x21, 0x01, 0x14, 0x3a, 0x21, 0x01
.align 2
gSpriteAnim_8617DEC:: @ 8617DEC
.2byte 0x0000, 0x0001, 0xffff, 0x0000
.align 2
gOamData_8617DF4:: @ 8617DF4
.2byte 0x0000, 0x4000, 0x3000, 0x0000
.align 2
gSpriteAnimTable_8617DFC:: @ 8617DFC
.4byte gSpriteAnim_8617DEC
.align 2
gUnknown_08617E00:: @ 8617E00
spr_template 0xffff, 0xffff, gOamData_8617DF4, gSpriteAnimTable_8617DFC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_08617E18:: @ 8617E18
.byte 0x3b, 0x43, 0x61, 0x00, 0x0f, 0x05, 0xff, 0x9b
.align 2
gSpriteAnim_8617E20:: @ 8617E20
.2byte 0x0000, 0x000c, 0xfffe, 0x0000
.align 2
gSpriteAnimTable_8617E28:: @ 8617E28
.4byte gSpriteAnim_8617E20
.align 2
gUnknown_08617E2C:: @ 8617E2C
.2byte 0x0000, 0x0000, 0x0000, 0x0000
.align 2
gUnknown_08617E34:: @ 8617E34
spr_template 0x0fa0, 0xffff, gUnknown_08617E2C, gSpriteAnimTable_8617E28, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
.align 2
gSpriteAnim_8617E4C:: @ 8617E4C
.2byte 0x0000, 0x000c, 0xfffe, 0x0000
.align 2
gSpriteAnim_8617E54:: @ 8617E54
.4byte gSpriteAnim_8617E4C
.align 2
gOamData_8617E58:: @ 8617E58
.2byte 0x0000, 0x4000, 0x0000, 0x0000
.align 2
gUnknown_08617E60:: @ 8617E60
spr_template 0x0fa0, 0xffff, gOamData_8617E58, gSpriteAnim_8617E54, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8

View File

@ -0,0 +1,7 @@
#ifndef GUARD_BRAILLE_PUZZLES_H
#define GUARD_BRAILLE_PUZZLES_H
bool8 ShouldDoBrailleFlyEffect(void);
void sub_8179918(void);
#endif // GUARD_BRAILLE_PUZZLES_H

View File

@ -22,6 +22,7 @@ extern const u8 EventScript_2713D1[];
extern const u8 EventScript_2766A2[];
extern const u8 EventScript_2766A6[];
extern const u8 gTVBravoTrainerText00[];
extern const u8 gTVBravoTrainerText01[];
extern const u8 gTVBravoTrainerText02[];
@ -381,6 +382,9 @@ extern const u8 SecretBase_RedCave1_Text_2751E1[];
extern const u8 SecretBase_RedCave1_Text_2754F6[];
extern const u8 SecretBase_RedCave1_Text_2758CC[];
//field effects
extern const u8 FieryPath_EventScript_2908FD[];
extern const u8 EventScript_290CAE[];
extern const u8 EventScript_2926F8[];
#endif //GUARD_EVENT_SCRIPTS_H

View File

@ -1,7 +0,0 @@
#ifndef GUARD_FLDEFF_GROUNDSHAKE_H
#define GUARD_FLDEFF_GROUNDSHAKE_H
void sub_81BE6B8(void);
void sub_81BE72C(void);
#endif // GUARD_FLDEFF_GROUNDSHAKE_H

17
include/roulette_util.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef GUARD_ROULETTE_UTIL_H
#define GUARD_ROULETTE_UTIL_H
// structures
struct InnerStruct203CF18
{
u8 filler[0xC4];
};
void sub_8151B68(struct InnerStruct203CF18 *, const u8*);
void sub_8151B3C(struct InnerStruct203CF18 *);
void sub_8151CA8(struct InnerStruct203CF18 *, u8, u8);
void sub_8151C50(struct InnerStruct203CF18 *, u8, u8);
void sub_8151D28(struct InnerStruct203CF18 *, u8, u8);
void sub_8151E50(struct InnerStruct203CF18 *);
#endif // GUARD_ROULETTE_UTIL_H

View File

@ -180,7 +180,7 @@ SECTIONS {
src/wallclock.o(.text);
asm/rom6.o(.text);
src/pokeblock.o(.text);
asm/fldeff_flash.o(.text);
src/fldeff_flash.o(.text);
asm/post_battle_event_funcs.o(.text);
src/time_events.o(.text);
src/birch_pc.o(.text);
@ -258,7 +258,8 @@ SECTIONS {
src/multiboot.o(.text);
src/unk_81BAD84.o(.text);
src/battle_controller_player_partner.o(.text);
asm/fldeff_groundshake.o(.text);
src/fldeff_groundshake.o(.text);
src/fossil_specials.o(.text);
asm/fossil_specials.o(.text);
src/berry_fix_program.o(.text);
src/pokemon_summary_screen.o(.text);
@ -468,7 +469,7 @@ SECTIONS {
data/starter_choose.o(.rodata);
src/wallclock.o(.rodata);
src/pokeblock.o(.rodata);
data/fldeff_flash.o(.rodata);
src/fldeff_flash.o(.rodata);
src/time_events.o(.rodata);
data/field_specials.o(.rodata);
data/battle_records.o(.rodata);
@ -529,7 +530,8 @@ SECTIONS {
src/unk_text_util_2.o(.rodata);
src/unk_81BAD84.o(.rodata);
src/battle_controller_player_partner.o(.rodata);
data/fossil_special_fldeff_groundshake.o(.rodata);
src/fossil_specials.o(.rodata);
src/fldeff_groundshake.o(.rodata);
src/berry_fix_program.o(.rodata);
data/pokemon_summary_screen.o(.rodata);
data/pokenav.o(.rodata);

367
src/fldeff_flash.c Normal file
View File

@ -0,0 +1,367 @@
#include "global.h"
#include "constants/songs.h"
#include "braille_puzzles.h"
#include "event_data.h"
#include "event_scripts.h"
#include "field_effect.h"
#include "gpu_regs.h"
#include "gba/io_reg.h"
#include "main.h"
#include "palette.h"
#include "party_menu.h"
#include "overworld.h"
#include "rom6.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
// structures
struct FlashStruct
{
u8 unk0;
u8 unk1;
bool8 unk2;
bool8 unk3;
void (*func)(void);
};
// static functions
static void hm2_flash(void);
static void sub_81371B4(void);
static bool8 sub_8137304(void);
static void sub_81373F0(void);
static void sub_8137404(u8 taskId);
static void sub_8137420(u8 taskId);
static void sub_81374C4(u8 taskId);
static void sub_813750C(u8 taskId);
static void sub_8137574(u8 taskId);
static void sub_81375A8(void);
static void sub_81375BC(u8 taskId);
static void sub_81375D8(u8 taskId);
static void sub_8137678(u8 taskId);
static void sub_81376DC(u8 taskId);
// rodata
static const struct FlashStruct gUnknown_085B27C8[] =
{
{1, 4, 1, 0, sub_81375A8},
{2, 4, 1, 0, sub_81375A8},
{3, 4, 1, 0, sub_81375A8},
{5, 4, 1, 0, sub_81375A8},
{6, 4, 1, 0, sub_81375A8},
{7, 4, 1, 0, sub_81375A8},
{8, 4, 1, 0, sub_81375A8},
{9, 4, 1, 0, sub_81375A8},
{4, 1, 0, 1, sub_81373F0},
{4, 2, 0, 1, sub_81373F0},
{4, 3, 0, 1, sub_81373F0},
{4, 5, 0, 1, sub_81373F0},
{4, 6, 0, 1, sub_81373F0},
{4, 7, 0, 1, sub_81373F0},
{4, 8, 0, 1, sub_81373F0},
{4, 9, 0, 1, sub_81373F0},
{0, 0, 0, 0, NULL},
};
static const u16 gCaveTransitionPalette_White[] = INCBIN_U16("graphics/misc/cave_transition_white.gbapal");
static const u16 gCaveTransitionPalette_Black[] = INCBIN_U16("graphics/misc/cave_transition_black.gbapal");
static const u16 gUnknown_085B2890[] = INCBIN_U16("graphics/misc/85B2890.gbapal");
static const u16 gUnknown_085B28A0[] = INCBIN_U16("graphics/misc/85B28A0.gbapal");
static const u16 gCaveTransitionTilemap[] = INCBIN_U16("graphics/misc/cave_transition_map.bin.lz");
static const u8 gCaveTransitionTiles[] = INCBIN_U8("graphics/misc/cave_transition.4bpp.lz");
// text
bool8 SetUpFieldMove_Flash(void)
{
if (ShouldDoBrailleFlyEffect())
{
gSpecialVar_Result = GetCursorSelectionMonId();
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = sub_8179918;
return TRUE;
}
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))
{
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = hm2_flash;
return TRUE;
}
return FALSE;
}
static void hm2_flash(void)
{
u8 taskId = oei_task_add();
gFieldEffectArguments[0] = GetCursorSelectionMonId();
gTasks[taskId].data[8] = (uintptr_t)sub_81371B4 >> 16;
gTasks[taskId].data[9] = (uintptr_t)sub_81371B4;
}
static void sub_81371B4(void)
{
PlaySE(SE_W115);
FlagSet(FLAG_SYS_USE_FLASH);
ScriptContext1_SetupScript(EventScript_2926F8);
}
static void sub_81371D4(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
static void sub_81371EC(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
void c2_change_map(void)
{
u16 ime;
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
ResetPaletteFade();
ResetTasks();
ResetSpriteData();
ime = REG_IME;
REG_IME = 0;
REG_IE |= INTR_FLAG_VBLANK;
REG_IME = ime;
SetVBlankCallback(sub_81371EC);
SetMainCallback2(sub_81371D4);
if (!sub_8137304())
SetMainCallback2(gMain.savedCallback);
}
static bool8 sub_8137304(void)
{
u8 i;
u8 v0 = get_map_light_from_warp0();
u8 v1 = Overworld_GetMapTypeOfSaveblockLocation();
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
{
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
{
gUnknown_085B27C8[i].func();
return TRUE;
}
}
return FALSE;
}
bool8 sub_8137360(u8 a1, u8 a2)
{
u8 i;
u8 v0 = a1;
u8 v1 = a2;
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
{
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
{
return gUnknown_085B27C8[i].unk2;
}
}
return FALSE;
}
bool8 fade_type_for_given_maplight_pair(u8 a1, u8 a2)
{
u8 i;
u8 v0 = a1;
u8 v1 = a2;
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
{
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
{
return gUnknown_085B27C8[i].unk3;
}
}
return FALSE;
}
static void sub_81373F0(void)
{
CreateTask(sub_8137404, 0);
}
static void sub_8137404(u8 taskId)
{
gTasks[taskId].func = sub_8137420;
}
static void sub_8137420(u8 taskId)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000);
LZ77UnCompVram(gCaveTransitionTilemap, (void *)0x600F800);
LoadPalette(gCaveTransitionPalette_White, 0xE0, 0x20);
LoadPalette(gUnknown_085B28A0, 0xE0, 0x10);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
| BLDCNT_EFFECT_BLEND
| BLDCNT_TGT2_BG1
| BLDCNT_TGT2_BG2
| BLDCNT_TGT2_BG3
| BLDCNT_TGT2_OBJ
| BLDCNT_TGT2_BD);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0)
| BGCNT_CHARBASE(3)
| BGCNT_SCREENBASE(31)
| BGCNT_16COLOR
| BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_OBJ_ON);
gTasks[taskId].func = sub_81374C4;
gTasks[taskId].data[0] = 16;
gTasks[taskId].data[1] = 0;
}
static void sub_81374C4(u8 taskId)
{
u16 count = gTasks[taskId].data[1];
u16 blend = count + 0x1000;
SetGpuReg(REG_OFFSET_BLDALPHA, blend);
if (count <= 0x10)
{
gTasks[taskId].data[1]++;
}
else
{
gTasks[taskId].data[2] = 0;
gTasks[taskId].func = sub_813750C;
}
}
static void sub_813750C(u8 taskId)
{
u16 count;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16));
count = gTasks[taskId].data[2];
if (count < 8)
{
gTasks[taskId].data[2]++;
LoadPalette(&gUnknown_085B28A0[count], 0xE0, 16 - 2 * count);
}
else
{
LoadPalette(gCaveTransitionPalette_White, 0, 0x20);
gTasks[taskId].func = sub_8137574;
gTasks[taskId].data[2] = 8;
}
}
static void sub_8137574(u8 taskId)
{
if (gTasks[taskId].data[2])
gTasks[taskId].data[2]--;
else
SetMainCallback2(gMain.savedCallback);
}
static void sub_81375A8(void)
{
CreateTask(sub_81375BC, 0);
}
static void sub_81375BC(u8 taskId)
{
gTasks[taskId].func = sub_81375D8;
}
static void sub_81375D8(u8 taskId)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000);
LZ77UnCompVram(gCaveTransitionTilemap, (void *)0x600F800);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0)
| BGCNT_CHARBASE(3)
| BGCNT_SCREENBASE(31)
| BGCNT_16COLOR
| BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_OBJ_ON);
LoadPalette(gCaveTransitionPalette_White, 0xE0, 0x20);
LoadPalette(gCaveTransitionPalette_Black, 0, 0x20);
gTasks[taskId].func = sub_8137678;
gTasks[taskId].data[0] = 16;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 0;
}
static void sub_8137678(u8 taskId)
{
u16 count = gTasks[taskId].data[2];
if (count < 16)
{
gTasks[taskId].data[2]++;
gTasks[taskId].data[2]++;
LoadPalette(&gUnknown_085B2890[15 - count], 0xE0, 2 * (count + 1));
}
else
{
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16));
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
| BLDCNT_EFFECT_BLEND
| BLDCNT_TGT2_BG1
| BLDCNT_TGT2_BG2
| BLDCNT_TGT2_BG3
| BLDCNT_TGT2_OBJ
| BLDCNT_TGT2_BD);
gTasks[taskId].func = sub_81376DC;
}
}
static void sub_81376DC(u8 taskId)
{
u16 count = 16 - gTasks[taskId].data[1];
u16 blend = count + 0x1000;
SetGpuReg(REG_OFFSET_BLDALPHA, blend);
if (count)
{
gTasks[taskId].data[1]++;
}
else
{
LoadPalette(gCaveTransitionPalette_Black, 0, 0x20);
SetMainCallback2(gMain.savedCallback);
}
}

299
src/fldeff_groundshake.c Normal file
View File

@ -0,0 +1,299 @@
#include "global.h"
#include "global.fieldmap.h"
#include "constants/flags.h"
#include "constants/songs.h"
#include "event_data.h"
#include "field_camera.h"
#include "field_map_obj.h"
#include "malloc.h"
#include "random.h"
#include "roulette_util.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
// structures
struct Struct203CF18 {
u8 taskId;
struct InnerStruct203CF18 unk4;
}; //size = 0xC8
// extern data
extern const struct SpriteSheet gUnknown_08617D94[];
extern const s16 gUnknown_08617D64[][3];
// static functions
static void sub_81BE808(u8 taskId);
static void sub_81BE900(u8 taskId);
static void sub_81BE968(void);
static void sub_81BE9C0(u8 taskId);
static void sub_81BEA00(u8 taskId);
static void sub_81BEA20(void);
static void sub_81BEAD8(struct Sprite* sprite);
// rodata
static const u8 gUnknown_08617E18[] = {0x3b, 0x43, 0x61, 0x00, 0x0f, 0x05, 0xff, 0x9b};
static const union AnimCmd gSpriteAnim_8617E20[] =
{
ANIMCMD_FRAME(0, 12),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const gSpriteAnimTable_8617E28[] =
{
gSpriteAnim_8617E20,
};
static const struct OamData gUnknown_08617E2C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 0,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct SpriteTemplate gUnknown_08617E34 = {
0x0FA0, 0xFFFF, &gUnknown_08617E2C, gSpriteAnimTable_8617E28, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
};
static const union AnimCmd gSpriteAnim_8617E4C[] =
{
ANIMCMD_FRAME(0, 12),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const gSpriteAnim_8617E54[] =
{
gSpriteAnim_8617E4C,
};
static const struct OamData gSpriteAnim_8617E58 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct SpriteTemplate gUnknown_08617E60 = {
0x0FA0, 0xFFFF, &gSpriteAnim_8617E58, gSpriteAnim_8617E54, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
};
// ewram
EWRAM_DATA struct Struct203CF18 *gUnknown_0203CF18 = NULL;
// text
bool8 sub_81BE66C(void)
{
if (!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A))
return 0;
return FlagGet(FLAG_0x14E);
}
void sub_81BE698(u8 taskId)
{
sub_8151E50(&(gUnknown_0203CF18->unk4));
}
void sub_81BE6AC(void)
{
gUnknown_0203CF18 = NULL;
}
void sub_81BE6B8(void)
{
if(gUnknown_0203CF18 != NULL)
{
gUnknown_0203CF18 = NULL;
return;
}
if(!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A) || !FlagGet(FLAG_0x14E))
return;
gUnknown_0203CF18 = (struct Struct203CF18 *)AllocZeroed(sizeof(struct Struct203CF18));
sub_8151B3C(&(gUnknown_0203CF18->unk4));
sub_8151B68(&(gUnknown_0203CF18->unk4), gUnknown_08617E18);
sub_8151CA8(&(gUnknown_0203CF18->unk4), 1, 1);
gUnknown_0203CF18->taskId = CreateTask(sub_81BE698, 0xFF);
}
void sub_81BE72C(void)
{
if(!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A) || !FlagGet(FLAG_0x14E) || gUnknown_0203CF18 == NULL)
return;
if(FuncIsActiveTask(sub_81BE698))
DestroyTask(gUnknown_0203CF18->taskId);
sub_8151D28(&(gUnknown_0203CF18->unk4), 1, 1);
sub_8151C50(&(gUnknown_0203CF18->unk4), 1, 1);
Free(gUnknown_0203CF18);
gUnknown_0203CF18 = NULL;
}
void sub_81BE79C(void)
{
u16 rand;
bool8 chance;
if(VarGet(VAR_0x40CB) != 0)
{
FlagClear(FLAG_0x14E);
return;
}
rand = Random();
chance = rand & 1;
if(FlagGet(FLAG_0x09D) == TRUE)
chance = TRUE;
if(chance)
{
FlagSet(FLAG_0x14E);
sub_81BE6B8();
return;
}
FlagClear(FLAG_0x14E);
}
void sub_81BE7F4(void)
{
CreateTask(sub_81BE808, 0x8);
}
static void sub_81BE808(u8 taskId)
{
u8 mapObjectIdBuffer;
struct MapObject *fieldMapObject;
struct MapObject *playerAvatarMapObject;
TryGetFieldObjectIdByLocalIdAndMap(0x2D, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &mapObjectIdBuffer);
fieldMapObject = &(gMapObjects[mapObjectIdBuffer]);
gSprites[fieldMapObject->spriteId].pos2.y += 4;
playerAvatarMapObject = &(gMapObjects[gPlayerAvatar.mapObjectId]);
if((gSprites[fieldMapObject->spriteId].pos1.y + gSprites[fieldMapObject->spriteId].pos2.y) >=
(gSprites[playerAvatarMapObject->spriteId].pos1.y + gSprites[playerAvatarMapObject->spriteId].pos2.y))
{
DestroyTask(taskId);
EnableBothScriptContexts();
}
}
static void sp136_strengh_sound(u8 a, u8 b, u8 c, u8 d)
{
u8 taskId;
taskId = CreateTask(sub_81BE900, 0x9);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = c;
gTasks[taskId].data[3] = d;
gTasks[taskId].data[4] = a;
SetCameraPanningCallback(NULL);
PlaySE(SE_W070);
}
static void sub_81BE900(u8 taskId)
{
s16 *data;
data = gTasks[taskId].data;
data[1]++;
if((data[1] % data[3]) == 0)
{
data[1] = 0;
data[2]--;
data[0] = -data[0];
data[4] = -data[4];
SetCameraPanning(data[0], data[4]);
if(!data[2])
{
sub_81BE968();
DestroyTask(taskId);
InstallCameraPanAheadCallback();
}
}
}
static void sub_81BE968(void)
{
u8 taskId;
taskId = FindTaskIdByFunc(sub_81BE9C0);
if(taskId != 0xFF)
gTasks[taskId].data[0]++;
}
void sub_81BE994(void)
{
LoadSpriteSheets(gUnknown_08617D94);
sub_81BEA20();
CreateTask(sub_81BE9C0, 0x8);
sp136_strengh_sound(2, 1, 16, 3);
}
static void sub_81BE9C0(u8 taskId)
{
u16 *data;
data = gTasks[taskId].data;
data[1]++;
if(data[1] == 1000 || data[0] == 17)
gTasks[taskId].func = sub_81BEA00;
}
static void sub_81BEA00(u8 taskId)
{
FreeSpriteTilesByTag(4000);
DestroyTask(taskId);
EnableBothScriptContexts();
}
static void sub_81BEA20(void)
{
u8 i;
u8 spriteId;
for(i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_08617E60, gUnknown_08617D64[i][0] + 120, gUnknown_08617D64[i][1], 8);
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].oam.paletteNum = 0;
gSprites[spriteId].data[0] = i;
}
for(i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_08617E34, gUnknown_08617D64[i][0] + 115, gUnknown_08617D64[i][1] - 3, 8);
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].oam.paletteNum = 0;
gSprites[spriteId].data[0] = i;
}
}
static void sub_81BEAD8(struct Sprite* sprite)
{
sprite->data[1] += 2;
sprite->pos2.y = (sprite->data[1] / 2);
if(((sprite->pos1.y) + (sprite->pos2.y)) > gUnknown_08617D64[sprite->data[0]][2])
{
DestroySprite(sprite);
sub_81BE968();
}
}

View File

@ -9,10 +9,10 @@
#include "strings.h"
#include "task.h"
void sub_816166C(u8 taskId);
void sub_81617B8(u8 taskId);
void sub_81616C0(u8 taskId);
void sub_8161724(u8 taskId);
static void sub_816166C(u8 taskId);
static void sub_81616C0(u8 taskId);
static void sub_8161724(u8 taskId);
static void sub_81617B8(u8 taskId);
bool8 SetUpFieldMove_SoftBoiled(void)
{
@ -63,13 +63,13 @@ void sub_81615A8(u8 taskId)
sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C);
}
void sub_816166C(u8 taskId)
static void sub_816166C(u8 taskId)
{
PlaySE(SE_KAIFUKU);
sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAX_HP)/5, sub_81616C0);
}
void sub_81616C0(u8 taskId)
static void sub_81616C0(u8 taskId)
{
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
@ -78,7 +78,7 @@ void sub_81616C0(u8 taskId)
gTasks[taskId].func = sub_8161724;
}
void sub_8161724(u8 taskId)
static void sub_8161724(u8 taskId)
{
if(sub_81B1BD4() == 1)
return;
@ -92,7 +92,7 @@ void sub_8161724(u8 taskId)
gTasks[taskId].func = sub_81B1370;
}
void sub_8161784(u8 taskId)
static void sub_8161784(u8 taskId)
{
if(sub_81B1BD4() == 1)
return;
@ -100,7 +100,7 @@ void sub_8161784(u8 taskId)
gTasks[taskId].func = sub_81B1370;
}
void sub_81617B8(u8 taskId)
static void sub_81617B8(u8 taskId)
{
PlaySE(SE_SELECT);
sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0);

View File

@ -7,9 +7,11 @@
#include "script.h"
#include "task.h"
void FldEff_UseStrength(void);
void sub_8145E74(void);
// static functions
static void FldEff_UseStrength(void);
static void sub_8145E74(void);
// text
bool8 SetUpFieldMove_Strength(void)
{
if (npc_before_player_of_type(87) == TRUE)
@ -22,7 +24,7 @@ bool8 SetUpFieldMove_Strength(void)
return FALSE;
}
void FldEff_UseStrength(void)
static void FldEff_UseStrength(void)
{
gFieldEffectArguments[0] = GetCursorSelectionMonId();
ScriptContext1_SetupScript(FieryPath_EventScript_2908FD);
@ -37,7 +39,7 @@ bool8 sub_8145E2C(void)
return FALSE;
}
void sub_8145E74(void)
static void sub_8145E74(void)
{
FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH);
EnableBothScriptContexts();

View File

@ -6,7 +6,6 @@
#include "field_effect.h"
#include "field_player_avatar.h"
#include "field_screen.h"
#include "fldeff_groundshake.h"
#include "palette.h"
#include "party_menu.h"
#include "rom6.h"
@ -20,6 +19,8 @@ void hm2_sweet_scent(void);
void sub_8159F5C(void);
void sub_8159FEC(u8 taskId);
void sub_815A090(u8 taskId);
void sub_81BE6B8(void);
void sub_81BE72C(void);
bool8 SetUpFieldMove_SweetScent(void)
{

770
src/fossil_specials.c Normal file
View File

@ -0,0 +1,770 @@
#include "global.h"
#include "constants/flags.h"
#include "constants/songs.h"
#include "bg.h"
#include "event_data.h"
#include "field_camera.h"
#include "field_map_obj.h"
#include "fieldmap.h"
#include "global.fieldmap.h"
#include "gpu_regs.h"
#include "malloc.h"
#include "menu.h"
#include "random.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
#include "window.h"
#define MIRAGE_TOWER_GFX_LENGTH (sizeof(gUnknown_08617274) + sizeof(gMirageTower_Gfx))
#define MIRAGE_TOWER_PALETTE_LENGTH 0x800
#define ROOT_FOSSIL_GFX_LENGTH sizeof(gRootFossil_Gfx)
#define ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH 0x100
//struct
struct Struct8617DA4 {
u8 x;
u8 y;
u16 tileId;
};
struct Struct203CF10 {
u8 *buffer;
u8 curr_buffer_index;
};
struct DynamicSpriteFrameImage{
u8 *data;
u16 size;
};
struct Struct203CF0C {
u8 *frameImageTiles;
struct DynamicSpriteFrameImage *frameImage;
u8 spriteId;
u16 *unkC;
u16 unk10;
};
// static functions
static void sub_81BED50(u8 taskId);
static void sub_81BEBF4(u8 taskId);
static void sub_81BF028(u8 taskId);
static void sub_81BF248(struct Sprite *);
/*static*/ void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e);
// .rodata
static const u8 gUnknown_08617274[] = {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00};
static const u8 gMirageTower_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower.4bpp");
static const u16 gUnknown_08617B94[] = INCBIN_U16("graphics/misc/mirage_tower.bin");
static const u16 gRootFossil_Pal[] = INCBIN_U16("graphics/misc/fossil.gbapal");
static const u8 gRootFossil_Gfx[] = INCBIN_U8("graphics/misc/fossil.4bpp");
static const u8 gMirageTowerCrumbles_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower_crumbles.4bpp");
static const u16 gMirageTowerCrumbles_Palette[] = INCBIN_U16("graphics/misc/mirage_tower_crumbles.gbapal");
const s16 gUnknown_08617D64[][3] =
{
{ 0, 10, 65},
{ 17, 3, 50},
{-12, 0, 75},
{ 10, 15, 90},
{ 7, 8, 65},
{-18, 5, 75},
{ 22, -10, 55},
{-24, -4, 65},
};
const struct SpriteSheet gUnknown_08617D94[] =
{
{gMirageTowerCrumbles_Gfx, 0x0080, 0x0fa0},
{NULL}
};
static const struct Struct8617DA4 gUnknown_08617DA4[] =
{
{0x12, 0x35, 0x251},
{0x13, 0x35, 0x251},
{0x14, 0x35, 0x251},
{0x12, 0x36, 0x251},
{0x13, 0x36, 0x251},
{0x14, 0x36, 0x251},
{0x12, 0x37, 0x251},
{0x13, 0x37, 0x251},
{0x14, 0x37, 0x251},
{0x12, 0x38, 0x251},
{0x13, 0x38, 0x251},
{0x14, 0x38, 0x251},
{0x12, 0x39, 0x259},
{0x13, 0x39, 0x259},
{0x14, 0x39, 0x259},
{0x12, 0x3A, 0x121},
{0x13, 0x3A, 0x121},
{0x14, 0x3A, 0x121},
};
static const union AnimCmd gSpriteAnim_8617DEC[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
static const struct OamData gOamData_8617DF4 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 3,
.affineParam = 0,
};
static const union AnimCmd *const gSpriteAnimTable_8617DFC[] =
{
gSpriteAnim_8617DEC,
};
static const struct SpriteTemplate gUnknown_08617E00 = {
0xFFFF, 0xFFFF, &gOamData_8617DF4, gSpriteAnimTable_8617DFC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
};
// ewram
EWRAM_DATA u8* gUnknown_0203CF04 = NULL;
EWRAM_DATA u8* gUnknown_0203CF08 = NULL;
EWRAM_DATA struct Struct203CF0C *gUnknown_0203CF0C = NULL;
EWRAM_DATA struct Struct203CF10 *gUnknown_0203CF10 = NULL;
EWRAM_DATA u16 *gUnknown_0203CF14 = NULL;
// iwram
IWRAM_DATA u16 gUnknown_030012A8[8] = {0, 0, 0, 0, 0, 0, 0, 0};
// text
void sub_81BEB24(void)
{
u8 i;
for(i = 0; i < (sizeof(gUnknown_08617DA4)/sizeof(gUnknown_08617DA4[0])); i++)
MapGridSetMetatileIdAt(gUnknown_08617DA4[i].x + 7, gUnknown_08617DA4[i].y + 7, gUnknown_08617DA4[i].tileId);
DrawWholeMapView();
}
void sub_81BEB54(void)
{
CreateTask(sub_81BED50, 0x9);
}
void sub_81BEB68(void)
{
CreateTask(sub_81BEBF4, 0x9);
}
void sub_81BEB7C(void)
{
CreateTask(sub_81BF028, 0x9);
}
void sub_81BEB90(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, gUnknown_0203CF14[0]);
SetGpuReg(REG_OFFSET_BG0VOFS, gUnknown_0203CF14[1]);
}
void sub_81BEBB4(u8 taskId)
{
if(!(gTasks[taskId].data[0]))
{
gUnknown_0203CF14[0] = -gUnknown_0203CF14[0];
gTasks[taskId].data[0] = 2;
sub_81BEB90();
}
else
gTasks[taskId].data[0]--;
}
static void sub_81BEBF4(u8 taskId)
{
u8 zero;
switch(gTasks[taskId].data[0])
{
case 0:
FreeAllWindowBuffers();
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 2);
gTasks[taskId].data[0]++;
break;
case 1:
gUnknown_0203CF04 = (u8 *)AllocZeroed(MIRAGE_TOWER_GFX_LENGTH);
gUnknown_0203CF08 = (u8 *)AllocZeroed(MIRAGE_TOWER_PALETTE_LENGTH);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
gTasks[taskId].data[0]++;
break;
case 2:
CpuSet(gUnknown_08617274, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH / 2);
LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
gTasks[taskId].data[0]++;
break;
case 3:
SetBgTilemapBuffer(0, gUnknown_0203CF08);
CopyToBgTilemapBufferRect_ChangePalette(0, &gUnknown_08617B94, 12, 29, 6, 12, 17);
CopyBgTilemapBufferToVram(0);
gTasks[taskId].data[0]++;
break;
case 4:
ShowBg(0);
gTasks[taskId].data[0]++;
break;
case 5:
sub_81BEB24();
gTasks[taskId].data[0]++;
break;
case 6:
gUnknown_0203CF14 = (u16 *)Alloc(4);
zero = 0;
gUnknown_0203CF14[0] = 2;
gUnknown_0203CF14[1] = zero;
CreateTask(sub_81BEBB4, 0xA);
DestroyTask(taskId);
EnableBothScriptContexts();
break;
}
}
#ifdef NONMATCHING
#define OUTER_BUFFER_LENGTH 0x60
#define INNER_BUFFER_LENGTH 0x30
static void sub_81BED50(u8 taskId)
{
u8 anotherTaskId, j;
switch(gTasks[taskId].data[0])
{
case 1:
gUnknown_0203CF10 = (struct Struct203CF10 *)AllocZeroed(OUTER_BUFFER_LENGTH * sizeof(struct Struct203CF10));
break;
case 3:
{
u16 i;
u16 left;
u32 index, next;
index = (u16)gTasks[taskId].data[3];
if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
{
if(gTasks[taskId].data[1] > 1)
{
index = (u8)index;
gUnknown_0203CF10[index].buffer = (u8 *)Alloc(INNER_BUFFER_LENGTH);
for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
gUnknown_0203CF10[index].buffer[i] = i;
for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
{
u16 rand1, rand2, temp;
rand1 = Random() % 0x30;
rand2 = Random() % 0x30;
temp = gUnknown_0203CF10[index].buffer[rand2];
gUnknown_0203CF10[index].buffer[rand2] = gUnknown_0203CF10[index].buffer[rand1];
gUnknown_0203CF10[index].buffer[rand1] = temp;
}
if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
gTasks[taskId].data[3]++;
gTasks[taskId].data[1] = 0;
}
gTasks[taskId].data[1]++;
}
index = (u8)gTasks[taskId].data[3];
for(left = (u8)gTasks[taskId].data[2]; left < (u16)index; left = next)
{
j = 0;
next = left + 1;
while(!j)
{
sub_81BF2B8(gUnknown_0203CF04, ((((OUTER_BUFFER_LENGTH - 1) - left) * INNER_BUFFER_LENGTH) + gUnknown_0203CF10[left].buffer[(gUnknown_0203CF10[left].curr_buffer_index)++]), 0, INNER_BUFFER_LENGTH, 1);
j++;
}
if(gUnknown_0203CF10[left].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
{
FREE_AND_SET_NULL(gUnknown_0203CF10[left].buffer);
gTasks[taskId].data[2]++;
if((left % 2) == 1)
gUnknown_0203CF14[1]--;
}
}
LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
if(gUnknown_0203CF10[OUTER_BUFFER_LENGTH - 1].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
break;
return;
}
case 4:
UnsetBgTilemapBuffer(0);
anotherTaskId = FindTaskIdByFunc(sub_81BEBB4);
if(anotherTaskId != 0xFF)
DestroyTask(anotherTaskId);
gUnknown_0203CF14[1] = gUnknown_0203CF14[0] = 0;
sub_81BEB90();
break;
case 5:
FREE_AND_SET_NULL(gUnknown_0203CF14);
FREE_AND_SET_NULL(gUnknown_0203CF10);
FREE_AND_SET_NULL(gUnknown_0203CF04);
FREE_AND_SET_NULL(gUnknown_0203CF08);
break;
case 6:
SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2);
SetGpuRegBits(REG_OFFSET_BG0CNT, 0x0);
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 0);
sub_81971D0();
break;
case 7:
ShowBg(0);
break;
case 8:
DestroyTask(taskId);
EnableBothScriptContexts();
break;
}
gTasks[taskId].data[0]++;
}
#else
ASM_DIRECT
static void sub_81BED50(u8 taskId)
{
asm("\n\
.syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x10\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r10, r0\n\
ldr r1, =gTasks\n\
lsls r0, 2\n\
add r0, r10\n\
lsls r0, 3\n\
adds r0, r1\n\
ldrh r0, [r0, 0x8]\n\
subs r0, 0x1\n\
lsls r0, 16\n\
asrs r0, 16\n\
adds r6, r1, 0\n\
cmp r0, 0x7\n\
bls _081BED7C\n\
b _081BF002\n\
_081BED7C:\n\
lsls r0, 2\n\
ldr r1, =_081BED90\n\
adds r0, r1\n\
ldr r0, [r0]\n\
mov pc, r0\n\
.pool\n\
.align 2, 0\n\
_081BED90:\n\
.4byte _081BEDB0\n\
.4byte _081BF002\n\
.4byte _081BEDC4\n\
.4byte _081BEF64\n\
.4byte _081BEF94\n\
.4byte _081BEFD0\n\
.4byte _081BEFF0\n\
.4byte _081BEFF8\n\
_081BEDB0:\n\
ldr r4, =gUnknown_0203CF10\n\
movs r0, 0xC0\n\
lsls r0, 2\n\
bl AllocZeroed\n\
str r0, [r4]\n\
b _081BF002\n\
.pool\n\
_081BEDC4:\n\
mov r1, r10\n\
lsls r0, r1, 2\n\
adds r1, r0, r1\n\
lsls r1, 3\n\
adds r2, r1, r6\n\
ldrh r3, [r2, 0xE]\n\
movs r4, 0xE\n\
ldrsh r1, [r2, r4]\n\
str r0, [sp, 0x8]\n\
cmp r1, 0x5F\n\
bgt _081BEE8A\n\
movs r1, 0xA\n\
ldrsh r0, [r2, r1]\n\
cmp r0, 0x1\n\
ble _081BEE7C\n\
lsls r0, r3, 24\n\
lsrs r4, r0, 24\n\
movs r0, 0x30\n\
bl Alloc\n\
ldr r3, =gUnknown_0203CF10\n\
ldr r1, [r3]\n\
lsls r2, r4, 3\n\
adds r1, r2, r1\n\
str r0, [r1]\n\
movs r5, 0\n\
adds r4, r2, 0\n\
_081BEDFA:\n\
ldr r0, [r3]\n\
adds r0, r4, r0\n\
ldr r0, [r0]\n\
adds r0, r5\n\
strb r5, [r0]\n\
adds r0, r5, 0x1\n\
lsls r0, 16\n\
lsrs r5, r0, 16\n\
cmp r5, 0x2F\n\
bls _081BEDFA\n\
movs r5, 0\n\
ldr r7, =gUnknown_0203CF10\n\
adds r6, r2, 0\n\
_081BEE14:\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
movs r1, 0x30\n\
bl __umodsi3\n\
adds r4, r0, 0\n\
lsls r4, 16\n\
lsrs r4, 16\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
movs r1, 0x30\n\
bl __umodsi3\n\
lsls r0, 16\n\
lsrs r0, 16\n\
ldr r1, [r7]\n\
adds r1, r6, r1\n\
ldr r1, [r1]\n\
adds r0, r1, r0\n\
ldrb r2, [r0]\n\
adds r1, r4 \n\
ldrb r1, [r1]\n\
strb r1, [r0]\n\
ldr r0, [r7]\n\
adds r0, r6, r0\n\
ldr r0, [r0]\n\
adds r0, r4\n\
strb r2, [r0]\n\
adds r0, r5, 0x1\n\
lsls r0, 16\n\
lsrs r5, r0, 16\n\
cmp r5, 0x2F\n\
bls _081BEE14\n\
ldr r0, =gTasks\n\
ldr r1, [sp, 0x8]\n\
add r1, r10\n\
lsls r1, 3\n\
adds r2, r1, r0\n\
ldrh r3, [r2, 0xE]\n\
movs r4, 0xE\n\
ldrsh r1, [r2, r4]\n\
adds r6, r0, 0\n\
cmp r1, 0x5F\n\
bgt _081BEE78\n\
adds r0, r3, 0x1\n\
strh r0, [r2, 0xE]\n\
_081BEE78:\n\
movs r0, 0\n\
strh r0, [r2, 0xA]\n\
_081BEE7C:\n\
ldr r1, [sp, 0x8]\n\
add r1, r10\n\
lsls r1, 3\n\
adds r1, r6\n\
ldrh r0, [r1, 0xA]\n\
adds r0, 0x1\n\
strh r0, [r1, 0xA]\n\
_081BEE8A:\n\
ldr r0, [sp, 0x8]\n\
add r0, r10\n\
lsls r0, 3\n\
adds r0, r6\n\
ldrb r4, [r0, 0xE]\n\
ldrb r5, [r0, 0xC]\n\
lsls r0, r4, 16\n\
cmp r5, r4\n\
bcs _081BEF32\n\
str r0, [sp, 0xC]\n\
_081BEE9E:\n\
movs r6, 0\n\
adds r0, r5, 0x1\n\
str r0, [sp, 0x4]\n\
lsls r4, r5, 3\n\
movs r2, 0x5F\n\
subs r1, r2, r5\n\
lsls r0, r1, 1\n\
adds r0, r1\n\
lsls r0, 4\n\
mov r9, r0\n\
_081BEEB2:\n\
ldr r0, =gUnknown_0203CF04\n\
ldr r0, [r0]\n\
ldr r7, =gUnknown_0203CF10\n\
ldr r3, [r7]\n\
adds r3, r4, r3\n\
ldrb r2, [r3, 0x4]\n\
adds r1, r2, 0x1\n\
strb r1, [r3, 0x4]\n\
lsls r2, 24\n\
lsrs r2, 24\n\
ldr r1, [r3]\n\
adds r1, r2\n\
ldrb r1, [r1]\n\
add r1, r9\n\
lsls r1, 16\n\
lsrs r1, 16\n\
movs r2, 0x1\n\
mov r8, r2\n\
str r2, [sp]\n\
movs r2, 0\n\
movs r3, 0x30\n\
bl sub_81BF2B8\n\
adds r0, r6, 0x1\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
cmp r6, 0\n\
beq _081BEEB2\n\
ldr r0, [r7]\n\
adds r1, r4, r0\n\
ldrb r0, [r1, 0x4]\n\
cmp r0, 0x2F\n\
bls _081BEF24\n\
ldr r0, [r1]\n\
bl Free\n\
ldr r0, [r7]\n\
adds r0, r4, r0\n\
movs r1, 0\n\
str r1, [r0]\n\
ldr r1, [sp, 0x8]\n\
add r1, r10\n\
lsls r1, 3\n\
ldr r4, =gTasks\n\
adds r1, r4\n\
ldrh r0, [r1, 0xC]\n\
adds r0, 0x1\n\
strh r0, [r1, 0xC]\n\
mov r0, r8\n\
ands r5, r0\n\
cmp r5, 0x1\n\
bne _081BEF24\n\
ldr r0, =gUnknown_0203CF14\n\
ldr r1, [r0]\n\
ldrh r0, [r1, 0x2]\n\
subs r0, 0x1\n\
strh r0, [r1, 0x2]\n\
_081BEF24:\n\
ldr r1, [sp, 0x4]\n\
lsls r0, r1, 16\n\
lsrs r5, r0, 16\n\
ldr r2, [sp, 0xC]\n\
lsrs r0, r2, 16\n\
cmp r5, r0\n\
bcc _081BEE9E\n\
_081BEF32:\n\
ldr r0, =gUnknown_0203CF04\n\
ldr r1, [r0]\n\
movs r2, 0x92\n\
lsls r2, 4\n\
movs r0, 0\n\
movs r3, 0\n\
bl LoadBgTiles\n\
ldr r0, =gUnknown_0203CF10\n\
ldr r0, [r0]\n\
movs r4, 0xBE\n\
lsls r4, 2\n\
adds r0, r4\n\
ldrb r0, [r0, 0x4]\n\
cmp r0, 0x2F\n\
bhi _081BF002\n\
b _081BF014\n\
.pool\n\
_081BEF64:\n\
movs r0, 0\n\
bl UnsetBgTilemapBuffer\n\
ldr r0, =sub_81BEBB4\n\
bl FindTaskIdByFunc\n\
lsls r0, 24\n\
lsrs r0, 24\n\
cmp r0, 0xFF\n\
beq _081BEF7C\n\
bl DestroyTask\n\
_081BEF7C:\n\
ldr r0, =gUnknown_0203CF14\n\
ldr r1, [r0]\n\
movs r0, 0\n\
strh r0, [r1]\n\
strh r0, [r1, 0x2]\n\
bl sub_81BEB90\n\
b _081BF002\n\
.pool\n\
_081BEF94:\n\
ldr r4, =gUnknown_0203CF14\n\
ldr r0, [r4]\n\
bl Free\n\
movs r5, 0\n\
str r5, [r4]\n\
ldr r4, =gUnknown_0203CF10\n\
ldr r0, [r4]\n\
bl Free\n\
str r5, [r4]\n\
ldr r4, =gUnknown_0203CF04\n\
ldr r0, [r4]\n\
bl Free\n\
str r5, [r4]\n\
ldr r4, =gUnknown_0203CF08\n\
ldr r0, [r4]\n\
bl Free\n\
str r5, [r4]\n\
b _081BF002\n\
.pool\n\
_081BEFD0:\n\
movs r0, 0xC\n\
movs r1, 0x2\n\
bl SetGpuRegBits\n\
movs r0, 0x8\n\
movs r1, 0\n\
bl SetGpuRegBits\n\
movs r0, 0\n\
movs r1, 0x7\n\
movs r2, 0\n\
bl SetBgAttribute\n\
bl sub_81971D0\n\
b _081BF002\n\
_081BEFF0:\n\
movs r0, 0\n\
bl ShowBg\n\
b _081BF002\n\
_081BEFF8:\n\
mov r0, r10\n\
bl DestroyTask\n\
bl EnableBothScriptContexts\n\
_081BF002:\n\
ldr r0, =gTasks\n\
mov r2, r10\n\
lsls r1, r2, 2\n\
add r1, r10\n\
lsls r1, 3\n\
adds r1, r0\n\
ldrh r0, [r1, 0x8]\n\
adds r0, 0x1\n\
strh r0, [r1, 0x8]\n\
_081BF014:\n\
add sp, 0x10\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
}
#endif // NONMATCHING
static void sub_81BF028(u8 taskId)
{
u16 i;
switch(gTasks[taskId].data[0])
{
case 1:
gUnknown_0203CF0C = (struct Struct203CF0C *)AllocZeroed(sizeof(struct Struct203CF0C));
gUnknown_0203CF0C->frameImageTiles = (u8 *)AllocZeroed(ROOT_FOSSIL_GFX_LENGTH);
gUnknown_0203CF0C->frameImage = (struct DynamicSpriteFrameImage *) AllocZeroed(sizeof(struct DynamicSpriteFrameImage));
gUnknown_0203CF0C->unkC = (u16 *)AllocZeroed(ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16));
gUnknown_0203CF0C->unk10 = 0;
break;
case 2:
{
u8 *buffer;
buffer = gUnknown_0203CF0C->frameImageTiles;
for(i = 0; i < ROOT_FOSSIL_GFX_LENGTH; i++, buffer++)
*buffer = gRootFossil_Gfx[i];
}
break;
case 3:
gUnknown_0203CF0C->frameImage->data = gUnknown_0203CF0C->frameImageTiles;
gUnknown_0203CF0C->frameImage->size = ROOT_FOSSIL_GFX_LENGTH;
break;
case 4:
{
u8 spriteId, zero;
struct SpriteTemplate fossilTemplate;
fossilTemplate = gUnknown_08617E00;
fossilTemplate.images = (struct SpriteFrameImage *)(gUnknown_0203CF0C->frameImage);
spriteId = CreateSprite(&fossilTemplate, 128, -16, 1);
gUnknown_0203CF0C->spriteId = spriteId;
zero = 0;
gSprites[gUnknown_0203CF0C->spriteId].centerToCornerVecX = zero;
gSprites[gUnknown_0203CF0C->spriteId].data[0] = gSprites[gUnknown_0203CF0C->spriteId].pos1.x;
gSprites[gUnknown_0203CF0C->spriteId].data[1] = 1;
}
case 5:
for(i = 0; i < ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH; i++)
gUnknown_0203CF0C->unkC[i] = i;
break;
case 6:
{
u16 rand1, rand2, temp, j;
j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
for(i = 0; i <= j; i++)
{
rand1 = Random() % 0x100;
rand2 = Random() % 0x100;
j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
temp = gUnknown_0203CF0C->unkC[rand2];
gUnknown_0203CF0C->unkC[rand2] = gUnknown_0203CF0C->unkC[rand1];
gUnknown_0203CF0C->unkC[rand1] = temp;
}
gSprites[gUnknown_0203CF0C->spriteId].callback = sub_81BF248;
break;
}
case 7:
if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
return;
DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]);
FREE_AND_SET_NULL(gUnknown_0203CF0C->unkC);;
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImage);
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImageTiles);
FREE_AND_SET_NULL(gUnknown_0203CF0C);
break;
case 8:
EnableBothScriptContexts();
}
++gTasks[taskId].data[0];
}
static void sub_81BF248(struct Sprite *sprite)
{
if (gUnknown_0203CF0C->unk10 >= (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH))
{
sprite->callback = SpriteCallbackDummy;
}
else if (sprite->pos1.y >= 0x60)
{
u8 i;
for (i = 0; i < 2; i++)
{
sub_81BF2B8(gUnknown_0203CF0C->frameImageTiles, gUnknown_0203CF0C->unkC[gUnknown_0203CF0C->unk10++], 0, 16, 0);
}
StartSpriteAnim(sprite, 0);
}
else
{
sprite->pos1.y++;
}
}