mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Start battle factory
This commit is contained in:
parent
4418189d4c
commit
10eb952db5
@ -5,736 +5,9 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_819A44C
|
||||
sub_819A44C: @ 819A44C
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
ldrb r4, [r5, 0x5]
|
||||
lsrs r4, 4
|
||||
movs r0, 0x65
|
||||
bl IndexOfSpritePaletteTag
|
||||
lsls r0, 24
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
lsrs r0, 24
|
||||
cmp r4, r0
|
||||
bne _0819A4BA
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x3F
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0819A4B0
|
||||
ldrh r1, [r5, 0x2E]
|
||||
movs r2, 0x2E
|
||||
ldrsh r0, [r5, r2]
|
||||
cmp r0, 0
|
||||
beq _0819A484
|
||||
subs r0, r1, 0x1
|
||||
strh r0, [r5, 0x2E]
|
||||
b _0819A4C2
|
||||
_0819A484:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0x5
|
||||
bl __umodsi3
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
bne _0819A4A6
|
||||
adds r0, r5, 0
|
||||
movs r1, 0
|
||||
bl StartSpriteAnim
|
||||
movs r0, 0x20
|
||||
strh r0, [r5, 0x2E]
|
||||
b _0819A4C2
|
||||
_0819A4A6:
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1
|
||||
bl StartSpriteAnim
|
||||
b _0819A4C2
|
||||
_0819A4B0:
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1
|
||||
bl StartSpriteAnimIfDifferent
|
||||
b _0819A4C2
|
||||
_0819A4BA:
|
||||
adds r0, r5, 0
|
||||
movs r1, 0
|
||||
bl StartSpriteAnimIfDifferent
|
||||
_0819A4C2:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_819A44C
|
||||
|
||||
thumb_func_start sub_819A4C8
|
||||
sub_819A4C8: @ 819A4C8
|
||||
push {lr}
|
||||
bl AnimateSprites
|
||||
bl BuildOamBuffer
|
||||
bl RunTextPrinters
|
||||
bl UpdatePaletteFade
|
||||
bl RunTasks
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_819A4C8
|
||||
|
||||
|
||||
thumb_func_start sub_819A4E4
|
||||
sub_819A4E4: @ 819A4E4
|
||||
push {lr}
|
||||
bl LoadOam
|
||||
bl ProcessSpriteCopyRequests
|
||||
bl TransferPlttBuffer
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_819A4E4
|
||||
|
||||
thumb_func_start sub_819A4F8
|
||||
sub_819A4F8: @ 819A4F8
|
||||
push {lr}
|
||||
ldr r0, =gUnknown_0300127C
|
||||
movs r1, 0
|
||||
str r1, [r0]
|
||||
ldr r0, =sub_819A514
|
||||
bl SetMainCallback2
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_819A4F8
|
||||
|
||||
thumb_func_start sub_819A514
|
||||
sub_819A514: @ 819A514
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0xC
|
||||
ldr r0, =gMain
|
||||
movs r1, 0x87
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0xA
|
||||
bls _0819A528
|
||||
b _0819A98E
|
||||
_0819A528:
|
||||
lsls r0, 2
|
||||
ldr r1, =_0819A53C
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_0819A53C:
|
||||
.4byte _0819A568
|
||||
.4byte _0819A5C0
|
||||
.4byte _0819A69C
|
||||
.4byte _0819A77C
|
||||
.4byte _0819A7CC
|
||||
.4byte _0819A868
|
||||
.4byte _0819A8A4
|
||||
.4byte _0819A8AC
|
||||
.4byte _0819A8C4
|
||||
.4byte _0819A8DC
|
||||
.4byte _0819A8FC
|
||||
_0819A568:
|
||||
ldr r4, =gUnknown_0203CE3C
|
||||
ldr r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0819A578
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r4]
|
||||
_0819A578:
|
||||
movs r0, 0
|
||||
bl SetHBlankCallback
|
||||
movs r0, 0
|
||||
bl SetVBlankCallback
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x8]
|
||||
movs r1, 0xC0
|
||||
lsls r1, 19
|
||||
ldr r2, =0x05006000
|
||||
add r0, sp, 0x8
|
||||
bl CpuSet
|
||||
movs r0, 0
|
||||
bl ResetBgsAndClearDma3BusyFlags
|
||||
ldr r1, =gUnknown_08610428
|
||||
movs r0, 0
|
||||
movs r2, 0x3
|
||||
bl InitBgsFromTemplates
|
||||
ldr r0, =gUnknown_08610434
|
||||
bl InitWindows
|
||||
bl DeactivateAllTextPrinters
|
||||
b _0819A8E6
|
||||
.pool
|
||||
_0819A5C0:
|
||||
ldr r5, =gUnknown_0203CE2C
|
||||
movs r4, 0x88
|
||||
lsls r4, 3
|
||||
adds r0, r4, 0
|
||||
bl Alloc
|
||||
str r0, [r5]
|
||||
ldr r5, =gUnknown_0203CE30
|
||||
adds r0, r4, 0
|
||||
bl AllocZeroed
|
||||
str r0, [r5]
|
||||
ldr r5, =gUnknown_0203CE34
|
||||
movs r4, 0x80
|
||||
lsls r4, 4
|
||||
adds r0, r4, 0
|
||||
bl Alloc
|
||||
str r0, [r5]
|
||||
ldr r5, =gUnknown_0203CE38
|
||||
adds r0, r4, 0
|
||||
bl AllocZeroed
|
||||
str r0, [r5]
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgX
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgY
|
||||
movs r0, 0x1
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgX
|
||||
movs r0, 0x1
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgY
|
||||
movs r0, 0x3
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgX
|
||||
movs r0, 0x3
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ChangeBgY
|
||||
movs r0, 0x50
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x52
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x54
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x4C
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x40
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x44
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x42
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x46
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x48
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
movs r0, 0x4A
|
||||
movs r1, 0
|
||||
bl SetGpuReg
|
||||
ldr r1, =gMain
|
||||
movs r3, 0x87
|
||||
lsls r3, 3
|
||||
adds r1, r3
|
||||
b _0819A8EE
|
||||
.pool
|
||||
_0819A69C:
|
||||
bl ResetPaletteFade
|
||||
bl ResetSpriteData
|
||||
bl ResetTasks
|
||||
bl FreeAllSpritePalettes
|
||||
ldr r0, =gFrontierFactorySelectMenu_Gfx
|
||||
ldr r5, =gUnknown_0203CE2C
|
||||
ldr r1, [r5]
|
||||
movs r2, 0x88
|
||||
lsls r2, 2
|
||||
bl CpuSet
|
||||
ldr r0, =gUnknown_0861033C
|
||||
ldr r4, =gUnknown_0203CE30
|
||||
ldr r1, [r4]
|
||||
movs r2, 0x30
|
||||
bl CpuSet
|
||||
ldr r1, [r5]
|
||||
movs r2, 0x88
|
||||
lsls r2, 3
|
||||
movs r0, 0x1
|
||||
movs r3, 0
|
||||
bl LoadBgTiles
|
||||
ldr r1, [r4]
|
||||
movs r0, 0x3
|
||||
movs r2, 0x60
|
||||
movs r3, 0
|
||||
bl LoadBgTiles
|
||||
ldr r0, =gFrontierFactorySelectMenu_Tilemap
|
||||
ldr r4, =gUnknown_0203CE34
|
||||
ldr r1, [r4]
|
||||
movs r2, 0x80
|
||||
lsls r2, 3
|
||||
bl CpuSet
|
||||
ldr r1, [r4]
|
||||
movs r2, 0x80
|
||||
lsls r2, 4
|
||||
movs r0, 0x1
|
||||
movs r3, 0
|
||||
bl LoadBgTilemap
|
||||
ldr r0, =gFrontierFactorySelectMenu_Pal
|
||||
movs r1, 0
|
||||
movs r2, 0x40
|
||||
bl LoadPalette
|
||||
ldr r4, =gUnknown_0861046C
|
||||
adds r0, r4, 0
|
||||
movs r1, 0xF0
|
||||
movs r2, 0x8
|
||||
bl LoadPalette
|
||||
adds r0, r4, 0
|
||||
movs r1, 0xE0
|
||||
movs r2, 0xA
|
||||
bl LoadPalette
|
||||
ldr r0, =gUnknown_0300127C
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0x1
|
||||
bne _0819A738
|
||||
ldr r0, =gPlttBufferUnfaded
|
||||
movs r2, 0xA9
|
||||
lsls r2, 2
|
||||
adds r1, r2
|
||||
ldrh r1, [r1]
|
||||
movs r3, 0xE4
|
||||
lsls r3, 1
|
||||
adds r0, r3
|
||||
strh r1, [r0]
|
||||
_0819A738:
|
||||
ldr r0, =gUnknown_0861039C
|
||||
movs r1, 0x20
|
||||
movs r2, 0x4
|
||||
bl LoadPalette
|
||||
ldr r1, =gMain
|
||||
movs r0, 0x87
|
||||
lsls r0, 3
|
||||
adds r1, r0
|
||||
b _0819A8EE
|
||||
.pool
|
||||
_0819A77C:
|
||||
ldr r0, =gUnknown_0203CE38
|
||||
ldr r1, [r0]
|
||||
movs r0, 0x3
|
||||
bl SetBgTilemapBuffer
|
||||
ldr r5, =gUnknown_0861023C
|
||||
movs r4, 0x8
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
movs r0, 0x3
|
||||
adds r1, r5, 0
|
||||
movs r2, 0xB
|
||||
movs r3, 0x4
|
||||
bl CopyToBgTilemapBufferRect
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
movs r0, 0x3
|
||||
adds r1, r5, 0
|
||||
movs r2, 0x2
|
||||
movs r3, 0x4
|
||||
bl CopyToBgTilemapBufferRect
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
movs r0, 0x3
|
||||
adds r1, r5, 0
|
||||
movs r2, 0x14
|
||||
movs r3, 0x4
|
||||
bl CopyToBgTilemapBufferRect
|
||||
movs r0, 0x3
|
||||
bl CopyBgTilemapBufferToVram
|
||||
b _0819A8E6
|
||||
.pool
|
||||
_0819A7CC:
|
||||
ldr r0, =gUnknown_086103F4
|
||||
bl LoadSpritePalettes
|
||||
ldr r0, =gUnknown_086103BC
|
||||
bl LoadSpriteSheets
|
||||
ldr r0, =gUnknown_086103E4
|
||||
bl LoadCompressedObjectPic
|
||||
movs r0, 0
|
||||
bl ShowBg
|
||||
movs r0, 0x1
|
||||
bl ShowBg
|
||||
ldr r0, =sub_819A4E4
|
||||
bl SetVBlankCallback
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
movs r1, 0
|
||||
str r1, [sp]
|
||||
movs r2, 0x10
|
||||
movs r3, 0
|
||||
bl BeginNormalPaletteFade
|
||||
movs r1, 0x9A
|
||||
lsls r1, 5
|
||||
movs r0, 0
|
||||
bl SetGpuReg
|
||||
ldr r0, =gUnknown_0300127C
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x6]
|
||||
cmp r0, 0x1
|
||||
bne _0819A854
|
||||
movs r0, 0x58
|
||||
movs r1, 0x98
|
||||
movs r2, 0x20
|
||||
movs r3, 0x60
|
||||
bl sub_819C5D0
|
||||
movs r0, 0x3
|
||||
bl ShowBg
|
||||
ldr r1, =0x00001248
|
||||
movs r0, 0x50
|
||||
bl SetGpuReg
|
||||
ldr r1, =0x0000040b
|
||||
movs r0, 0x52
|
||||
bl SetGpuReg
|
||||
b _0819A85A
|
||||
.pool
|
||||
_0819A854:
|
||||
movs r0, 0x3
|
||||
bl HideBg
|
||||
_0819A85A:
|
||||
ldr r1, =gMain
|
||||
movs r3, 0x87
|
||||
lsls r3, 3
|
||||
adds r1, r3
|
||||
b _0819A8EE
|
||||
.pool
|
||||
_0819A868:
|
||||
ldr r4, =gUnknown_0300127C
|
||||
ldr r1, [r4]
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0x1
|
||||
bne _0819A878
|
||||
ldr r0, =gUnknown_0203CF20
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1, 0x3]
|
||||
_0819A878:
|
||||
bl sub_819A9AC
|
||||
bl sub_819AA18
|
||||
ldr r0, [r4]
|
||||
ldrb r0, [r0, 0x6]
|
||||
cmp r0, 0x1
|
||||
bne _0819A88C
|
||||
bl sub_819BE34
|
||||
_0819A88C:
|
||||
ldr r1, =gMain
|
||||
movs r0, 0x87
|
||||
lsls r0, 3
|
||||
adds r1, r0
|
||||
b _0819A8EE
|
||||
.pool
|
||||
_0819A8A4:
|
||||
bl sub_819BA64
|
||||
movs r0, 0x2
|
||||
b _0819A8E2
|
||||
_0819A8AC:
|
||||
bl sub_819BCF8
|
||||
movs r0, 0x5
|
||||
bl PutWindowTilemap
|
||||
ldr r1, =gMain
|
||||
movs r3, 0x87
|
||||
lsls r3, 3
|
||||
adds r1, r3
|
||||
b _0819A8EE
|
||||
.pool
|
||||
_0819A8C4:
|
||||
bl sub_819B9E8
|
||||
movs r0, 0x1
|
||||
bl PutWindowTilemap
|
||||
ldr r1, =gMain
|
||||
movs r0, 0x87
|
||||
lsls r0, 3
|
||||
adds r1, r0
|
||||
b _0819A8EE
|
||||
.pool
|
||||
_0819A8DC:
|
||||
bl sub_819B9B4
|
||||
movs r0, 0
|
||||
_0819A8E2:
|
||||
bl PutWindowTilemap
|
||||
_0819A8E6:
|
||||
ldr r1, =gMain
|
||||
movs r2, 0x87
|
||||
lsls r2, 3
|
||||
adds r1, r2
|
||||
_0819A8EE:
|
||||
ldrb r0, [r1]
|
||||
adds r0, 0x1
|
||||
strb r0, [r1]
|
||||
b _0819A98E
|
||||
.pool
|
||||
_0819A8FC:
|
||||
ldr r0, =sub_819C69C
|
||||
movs r1, 0
|
||||
bl CreateTask
|
||||
ldr r2, =gUnknown_0300127C
|
||||
ldr r1, [r2]
|
||||
ldr r3, =0x000002a1
|
||||
adds r1, r3
|
||||
strb r0, [r1]
|
||||
ldr r3, [r2]
|
||||
ldrb r5, [r3, 0x6]
|
||||
cmp r5, 0
|
||||
bne _0819A954
|
||||
ldr r4, =gTasks
|
||||
ldr r1, =0x000002a1
|
||||
adds r0, r3, r1
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 2
|
||||
adds r0, r1
|
||||
lsls r0, 3
|
||||
adds r0, r4
|
||||
strh r5, [r0, 0x8]
|
||||
ldr r0, =sub_819B378
|
||||
movs r1, 0
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
lsls r0, r1, 2
|
||||
adds r0, r1
|
||||
lsls r0, 3
|
||||
adds r0, r4
|
||||
strh r5, [r0, 0x8]
|
||||
b _0819A988
|
||||
.pool
|
||||
_0819A954:
|
||||
ldr r4, =gTasks
|
||||
ldr r2, =0x000002a1
|
||||
adds r0, r3, r2
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 2
|
||||
adds r0, r1
|
||||
lsls r0, 3
|
||||
adds r0, r4
|
||||
movs r2, 0
|
||||
movs r1, 0x1
|
||||
strh r1, [r0, 0x8]
|
||||
ldr r1, =0x000002a2
|
||||
adds r0, r3, r1
|
||||
strb r2, [r0]
|
||||
ldr r0, =sub_819B124
|
||||
movs r1, 0
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
lsls r0, r1, 2
|
||||
adds r0, r1
|
||||
lsls r0, 3
|
||||
adds r0, r4
|
||||
movs r1, 0xD
|
||||
strh r1, [r0, 0x8]
|
||||
_0819A988:
|
||||
ldr r0, =sub_819A4C8
|
||||
bl SetMainCallback2
|
||||
_0819A98E:
|
||||
add sp, 0xC
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_819A514
|
||||
|
||||
thumb_func_start sub_819A9AC
|
||||
sub_819A9AC: @ 819A9AC
|
||||
push {r4,r5,lr}
|
||||
ldr r5, =gUnknown_0300127C
|
||||
ldr r4, [r5]
|
||||
cmp r4, 0
|
||||
bne _0819AA12
|
||||
movs r0, 0xAB
|
||||
lsls r0, 2
|
||||
bl AllocZeroed
|
||||
str r0, [r5]
|
||||
strb r4, [r0, 0x3]
|
||||
ldr r1, [r5]
|
||||
movs r0, 0x1
|
||||
strb r0, [r1, 0x5]
|
||||
ldr r0, [r5]
|
||||
strb r4, [r0, 0x6]
|
||||
movs r2, 0
|
||||
movs r4, 0x6C
|
||||
movs r3, 0
|
||||
_0819A9D2:
|
||||
ldr r0, [r5]
|
||||
adds r1, r2, 0
|
||||
muls r1, r4
|
||||
adds r0, r1
|
||||
strb r3, [r0, 0x10]
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, 0x5
|
||||
bls _0819A9D2
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00000ca9
|
||||
adds r0, r1
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x3
|
||||
ands r0, r1
|
||||
cmp r0, 0x2
|
||||
beq _0819AA0C
|
||||
movs r0, 0
|
||||
bl sub_819B484
|
||||
b _0819AA12
|
||||
.pool
|
||||
_0819AA0C:
|
||||
movs r0, 0
|
||||
bl sub_819B63C
|
||||
_0819AA12:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_819A9AC
|
||||
|
||||
thumb_func_start sub_819AA18
|
||||
sub_819AA18: @ 819AA18
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
movs r4, 0
|
||||
mov r8, r4
|
||||
ldr r7, =gSprites
|
||||
_0819AA24:
|
||||
lsls r1, r4, 3
|
||||
adds r1, r4
|
||||
lsls r1, 2
|
||||
subs r1, r4
|
||||
adds r1, 0x20
|
||||
lsls r1, 16
|
||||
asrs r1, 16
|
||||
ldr r0, =gUnknown_086105D8
|
||||
movs r2, 0x40
|
||||
movs r3, 0x1
|
||||
bl CreateSprite
|
||||
ldr r6, =gUnknown_0300127C
|
||||
ldr r2, [r6]
|
||||
movs r5, 0x6C
|
||||
adds r1, r4, 0
|
||||
muls r1, r5
|
||||
adds r2, r1
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r2, 0xE]
|
||||
ldrh r1, [r2, 0xE]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r7
|
||||
mov r1, r8
|
||||
strh r1, [r0, 0x2E]
|
||||
adds r0, r4, 0
|
||||
bl sub_819ADAC
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, 0x5
|
||||
bls _0819AA24
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x3]
|
||||
ldr r4, =gSprites
|
||||
muls r1, r5
|
||||
adds r0, r1
|
||||
ldrh r0, [r0, 0xE]
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
adds r1, r4
|
||||
ldr r0, =gUnknown_086105F0
|
||||
movs r2, 0x20
|
||||
ldrsh r1, [r1, r2]
|
||||
movs r2, 0x58
|
||||
movs r3, 0
|
||||
bl CreateSprite
|
||||
ldr r1, [r6]
|
||||
movs r5, 0
|
||||
strb r0, [r1, 0x4]
|
||||
ldr r0, =gUnknown_08610608
|
||||
movs r1, 0xB0
|
||||
movs r2, 0x70
|
||||
movs r3, 0
|
||||
bl CreateSprite
|
||||
ldr r1, [r6]
|
||||
strb r0, [r1, 0x1]
|
||||
ldr r0, =gUnknown_08610620
|
||||
movs r1, 0xB0
|
||||
movs r2, 0x90
|
||||
movs r3, 0
|
||||
bl CreateSprite
|
||||
ldr r1, [r6]
|
||||
strb r0, [r1, 0x2]
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x1]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
adds r0, 0x3E
|
||||
ldrb r1, [r0]
|
||||
movs r2, 0x4
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x2]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
adds r0, 0x3E
|
||||
ldrb r1, [r0]
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x1]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
adds r0, 0x28
|
||||
strb r5, [r0]
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x1]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
adds r0, 0x29
|
||||
strb r5, [r0]
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x2]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
adds r0, 0x28
|
||||
strb r5, [r0]
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0, 0x2]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
adds r0, 0x29
|
||||
strb r5, [r0]
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_819AA18
|
||||
|
||||
thumb_func_start sub_819AB40
|
||||
sub_819AB40: @ 819AB40
|
||||
@ -1059,8 +332,8 @@ _0819AD9C:
|
||||
.pool
|
||||
thumb_func_end sub_819ACE0
|
||||
|
||||
thumb_func_start sub_819ADAC
|
||||
sub_819ADAC: @ 819ADAC
|
||||
thumb_func_start SetBallSpritePaletteNum
|
||||
SetBallSpritePaletteNum: @ 819ADAC
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
@ -1102,7 +375,7 @@ _0819ADCE:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_819ADAC
|
||||
thumb_func_end SetBallSpritePaletteNum
|
||||
|
||||
thumb_func_start sub_819AE08
|
||||
sub_819AE08: @ 819AE08
|
||||
|
@ -13,6 +13,7 @@
|
||||
// Battle Frontier lvl modes.
|
||||
#define FRONTIER_LVL_50 0
|
||||
#define FRONTIER_LVL_OPEN 1
|
||||
#define FRONTIER_LVL_TENT 2
|
||||
|
||||
// Battle Frontier battle modes.
|
||||
#define FRONTIER_MODE_SINGLES 0
|
||||
|
337
src/battle_frontier_2.c
Normal file
337
src/battle_frontier_2.c
Normal file
@ -0,0 +1,337 @@
|
||||
#include "global.h"
|
||||
#include "sprite.h"
|
||||
#include "event_data.h"
|
||||
#include "overworld.h"
|
||||
#include "random.h"
|
||||
#include "battle_tower.h"
|
||||
#include "text.h"
|
||||
#include "palette.h"
|
||||
#include "task.h"
|
||||
#include "main.h"
|
||||
#include "malloc.h"
|
||||
#include "bg.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "window.h"
|
||||
#include "decompress.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
|
||||
#define SELECTABLE_MONS_COUNT 6
|
||||
#define TAG_PAL_BALL_GREY 0x64
|
||||
#define TAG_PAL_BALL_SELECTED 0x65
|
||||
|
||||
struct FactorySelecteableMon
|
||||
{
|
||||
u16 unk0;
|
||||
u16 spriteId;
|
||||
bool8 selected;
|
||||
u8 filler6[0x6A - 6];
|
||||
u8 unk6A;
|
||||
};
|
||||
|
||||
struct UnkStructTempName
|
||||
{
|
||||
u8 menuCursorPos;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 cursorPos;
|
||||
u8 unk4;
|
||||
u8 unk5;
|
||||
bool8 fromSummaryScreen;
|
||||
u8 unk7;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
struct FactorySelecteableMon mons[SELECTABLE_MONS_COUNT];
|
||||
u8 filler294[0x2a1 - 0x294];
|
||||
u8 unk2A1;
|
||||
u8 unk2A2;
|
||||
u8 unk2A3;
|
||||
u16 unk2A4;
|
||||
u16 unk2A6;
|
||||
u16 unk2A8;
|
||||
u16 unk2AA;
|
||||
};
|
||||
|
||||
extern struct UnkStructTempName *gUnknown_0300127C;
|
||||
extern u8 *gUnknown_0203CE2C;
|
||||
extern u8 *gUnknown_0203CE30;
|
||||
extern u8 *gUnknown_0203CE34;
|
||||
extern u8 *gUnknown_0203CE38;
|
||||
extern struct Pokemon *gUnknown_0203CE3C;
|
||||
extern u8 gUnknown_0203CF20;
|
||||
|
||||
// This file's functions.
|
||||
void sub_819A514(void);
|
||||
void sub_819C5D0(u16 mWin0H, u16 nWin0H, u16 mWin0V, u16 nWin0V);
|
||||
void sub_819A9AC(void);
|
||||
void sub_819AA18(void);
|
||||
void sub_819BE34(void);
|
||||
void sub_819BA64(void);
|
||||
void sub_819BCF8(void);
|
||||
void sub_819B9E8(void);
|
||||
void sub_819B9B4(void);
|
||||
void sub_819C69C(u8 taskId);
|
||||
void sub_819B378(u8 taskId);
|
||||
void sub_819B124(u8 taskId);
|
||||
void sub_819B484(u8 arg0);
|
||||
void sub_819B63C(u8 arg0);
|
||||
void SetBallSpritePaletteNum(u8 id);
|
||||
|
||||
// Const rom data.
|
||||
extern const struct BgTemplate gUnknown_08610428[3];
|
||||
extern const struct WindowTemplate gUnknown_08610434[];
|
||||
extern const u8 gUnknown_0861033C[];
|
||||
extern const u8 gUnknown_0861023C[];
|
||||
extern const u16 gUnknown_0861046C[];
|
||||
extern const u16 gUnknown_0861039C[];
|
||||
extern const struct SpritePalette gUnknown_086103F4[];
|
||||
extern const struct SpriteSheet gUnknown_086103BC[];
|
||||
extern const struct CompressedSpriteSheet gUnknown_086103E4[];
|
||||
extern const struct SpriteTemplate gUnknown_086105D8;
|
||||
|
||||
// gfx
|
||||
extern const u8 gFrontierFactorySelectMenu_Gfx[];
|
||||
extern const u8 gFrontierFactorySelectMenu_Tilemap[];
|
||||
extern const u16 gFrontierFactorySelectMenu_Pal[];
|
||||
|
||||
// code
|
||||
void sub_819A44C(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->oam.paletteNum == IndexOfSpritePaletteTag(TAG_PAL_BALL_SELECTED))
|
||||
{
|
||||
if (sprite->animEnded)
|
||||
{
|
||||
if (sprite->data[0] != 0)
|
||||
{
|
||||
sprite->data[0]--;
|
||||
}
|
||||
else if (Random() % 5 == 0)
|
||||
{
|
||||
StartSpriteAnim(sprite, 0);
|
||||
sprite->data[0] = 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSpriteAnim(sprite, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSpriteAnimIfDifferent(sprite, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSpriteAnimIfDifferent(sprite, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_819A4C8(void)
|
||||
{
|
||||
AnimateSprites();
|
||||
BuildOamBuffer();
|
||||
RunTextPrinters();
|
||||
UpdatePaletteFade();
|
||||
RunTasks();
|
||||
}
|
||||
|
||||
void sub_819A4E4(void)
|
||||
{
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
TransferPlttBuffer();
|
||||
}
|
||||
|
||||
void sub_819A4F8(void)
|
||||
{
|
||||
gUnknown_0300127C = NULL;
|
||||
SetMainCallback2(sub_819A514);
|
||||
}
|
||||
|
||||
void sub_819A514(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
switch (gMain.state)
|
||||
{
|
||||
case 0:
|
||||
if (gUnknown_0203CE3C != NULL)
|
||||
FREE_AND_SET_NULL(gUnknown_0203CE3C);
|
||||
SetHBlankCallback(NULL);
|
||||
SetVBlankCallback(NULL);
|
||||
CpuFill32(0, (void *)VRAM, VRAM_SIZE);
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, gUnknown_08610428, ARRAY_COUNT(gUnknown_08610428));
|
||||
InitWindows(gUnknown_08610434);
|
||||
DeactivateAllTextPrinters();
|
||||
gMain.state++;
|
||||
break;
|
||||
case 1:
|
||||
gUnknown_0203CE2C = Alloc(0x440);
|
||||
gUnknown_0203CE30 = AllocZeroed(0x440);
|
||||
gUnknown_0203CE34 = Alloc(0x800);
|
||||
gUnknown_0203CE38 = AllocZeroed(0x800);
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
ChangeBgX(1, 0, 0);
|
||||
ChangeBgY(1, 0, 0);
|
||||
ChangeBgX(3, 0, 0);
|
||||
ChangeBgY(3, 0, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||
SetGpuReg(REG_OFFSET_MOSAIC, 0);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, 0);
|
||||
SetGpuReg(REG_OFFSET_WIN0V, 0);
|
||||
SetGpuReg(REG_OFFSET_WIN1H, 0);
|
||||
SetGpuReg(REG_OFFSET_WIN1V, 0);
|
||||
SetGpuReg(REG_OFFSET_WININ, 0);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, 0);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 2:
|
||||
ResetPaletteFade();
|
||||
ResetSpriteData();
|
||||
ResetTasks();
|
||||
FreeAllSpritePalettes();
|
||||
CpuCopy16(gFrontierFactorySelectMenu_Gfx, gUnknown_0203CE2C, 0x440);
|
||||
CpuCopy16(gUnknown_0861033C, gUnknown_0203CE30, 0x60);
|
||||
LoadBgTiles(1, gUnknown_0203CE2C, 0x440, 0);
|
||||
LoadBgTiles(3, gUnknown_0203CE30, 0x60, 0);
|
||||
CpuCopy16(gFrontierFactorySelectMenu_Tilemap, gUnknown_0203CE34, 0x800);
|
||||
LoadBgTilemap(1, gUnknown_0203CE34, 0x800, 0);
|
||||
LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 0x40);
|
||||
LoadPalette(gUnknown_0861046C, 0xF0, 8);
|
||||
LoadPalette(gUnknown_0861046C, 0xE0, 10);
|
||||
if (gUnknown_0300127C->fromSummaryScreen == TRUE)
|
||||
gPlttBufferUnfaded[228] = gUnknown_0300127C->unk2A4;
|
||||
LoadPalette(gUnknown_0861039C, 0x20, 4);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 3:
|
||||
SetBgTilemapBuffer(3, gUnknown_0203CE38);
|
||||
CopyToBgTilemapBufferRect(3, gUnknown_0861023C, 11, 4, 8, 8);
|
||||
CopyToBgTilemapBufferRect(3, gUnknown_0861023C, 2, 4, 8, 8);
|
||||
CopyToBgTilemapBufferRect(3, gUnknown_0861023C, 20, 4, 8, 8);
|
||||
CopyBgTilemapBufferToVram(3);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 4:
|
||||
LoadSpritePalettes(gUnknown_086103F4);
|
||||
LoadSpriteSheets(gUnknown_086103BC);
|
||||
LoadCompressedObjectPic(gUnknown_086103E4);
|
||||
ShowBg(0);
|
||||
ShowBg(1);
|
||||
SetVBlankCallback(sub_819A4E4);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP);
|
||||
if (gUnknown_0300127C->fromSummaryScreen == TRUE)
|
||||
{
|
||||
sub_819C5D0(88, 152, 32, 96);
|
||||
ShowBg(3);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_OBJ);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
HideBg(3);
|
||||
}
|
||||
gMain.state++;
|
||||
break;
|
||||
case 5:
|
||||
if (gUnknown_0300127C->fromSummaryScreen == TRUE)
|
||||
gUnknown_0300127C->cursorPos = gUnknown_0203CF20;
|
||||
sub_819A9AC();
|
||||
sub_819AA18();
|
||||
if (gUnknown_0300127C->fromSummaryScreen == TRUE)
|
||||
sub_819BE34();
|
||||
gMain.state++;
|
||||
break;
|
||||
case 6:
|
||||
sub_819BA64();
|
||||
PutWindowTilemap(2);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 7:
|
||||
sub_819BCF8();
|
||||
PutWindowTilemap(5);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 8:
|
||||
sub_819B9E8();
|
||||
PutWindowTilemap(1);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 9:
|
||||
sub_819B9B4();
|
||||
PutWindowTilemap(0);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 10:
|
||||
gUnknown_0300127C->unk2A1 = CreateTask(sub_819C69C, 0);
|
||||
if (!gUnknown_0300127C->fromSummaryScreen)
|
||||
{
|
||||
gTasks[gUnknown_0300127C->unk2A1].data[0] = 0;
|
||||
taskId = CreateTask(sub_819B378, 0);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[gUnknown_0300127C->unk2A1].data[0] = 1;
|
||||
gUnknown_0300127C->unk2A2 = 0;
|
||||
taskId = CreateTask(sub_819B124, 0);
|
||||
gTasks[taskId].data[0] = 13;
|
||||
}
|
||||
SetMainCallback2(sub_819A4C8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_819A9AC(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (gUnknown_0300127C != NULL)
|
||||
return;
|
||||
|
||||
gUnknown_0300127C = AllocZeroed(sizeof(*gUnknown_0300127C));
|
||||
gUnknown_0300127C->cursorPos = 0;
|
||||
gUnknown_0300127C->unk5 = 1;
|
||||
gUnknown_0300127C->fromSummaryScreen = FALSE;
|
||||
for (i = 0; i < SELECTABLE_MONS_COUNT; i++)
|
||||
gUnknown_0300127C->mons[i].selected = FALSE;
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_TENT)
|
||||
sub_819B484(0);
|
||||
else
|
||||
sub_819B63C(0);
|
||||
}
|
||||
|
||||
extern const struct SpriteTemplate gUnknown_086105F0;
|
||||
extern const struct SpriteTemplate gUnknown_08610608;
|
||||
extern const struct SpriteTemplate gUnknown_08610620;
|
||||
|
||||
void sub_819AA18(void)
|
||||
{
|
||||
u8 i, cursorPos;
|
||||
s16 x;
|
||||
|
||||
for (i = 0; i < SELECTABLE_MONS_COUNT; i++)
|
||||
{
|
||||
gUnknown_0300127C->mons[i].spriteId = CreateSprite(&gUnknown_086105D8, (35 * i) + 32, 64, 1);
|
||||
gSprites[gUnknown_0300127C->mons[i].spriteId].data[0] = 0;
|
||||
SetBallSpritePaletteNum(i);
|
||||
}
|
||||
cursorPos = gUnknown_0300127C->cursorPos;
|
||||
x = gSprites[gUnknown_0300127C->mons[cursorPos].spriteId].pos1.x;
|
||||
gUnknown_0300127C->unk4 = CreateSprite(&gUnknown_086105F0, x, 88, 0);
|
||||
gUnknown_0300127C->unk1 = CreateSprite(&gUnknown_08610608, 176, 112, 0);
|
||||
gUnknown_0300127C->unk2 = CreateSprite(&gUnknown_08610620, 176, 144, 0);
|
||||
|
||||
gSprites[gUnknown_0300127C->unk1].invisible = 1;
|
||||
gSprites[gUnknown_0300127C->unk2].invisible = 1;
|
||||
|
||||
gSprites[gUnknown_0300127C->unk1].centerToCornerVecX = 0;
|
||||
gSprites[gUnknown_0300127C->unk1].centerToCornerVecY = 0;
|
||||
gSprites[gUnknown_0300127C->unk2].centerToCornerVecX = 0;
|
||||
gSprites[gUnknown_0300127C->unk2].centerToCornerVecY = 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user