start workin on evo scene

This commit is contained in:
DizzyEggg 2017-10-27 18:52:21 +02:00
parent f4e134569f
commit e8903fb4dd
13 changed files with 351 additions and 616 deletions

View File

@ -1415,7 +1415,7 @@ _080F64F2:
adds r0, r6, 0
adds r1, r5, 0
adds r2, r4, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
adds r0, r6, 0

View File

@ -5,579 +5,13 @@
.text
thumb_func_start sub_813D9B0
sub_813D9B0: @ 813D9B0
push {lr}
bl UpdatePaletteFade
bl RunTasks
pop {r0}
bx r0
thumb_func_end sub_813D9B0
thumb_func_start sub_813D9C0
sub_813D9C0: @ 813D9C0
push {r4-r7,lr}
sub sp, 0x4
lsls r0, 24
lsrs r2, r0, 24
movs r7, 0
ldr r1, =gTasks
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r6, r0, r1
movs r1, 0x8
ldrsh r0, [r6, r1]
cmp r0, 0
beq _0813D9E8
cmp r0, 0x1
beq _0813DA00
b _0813DA30
.pool
_0813D9E8:
movs r0, 0x1
negs r0, r0
str r7, [sp]
movs r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
ldrh r0, [r6, 0x8]
adds r0, 0x1
strh r0, [r6, 0x8]
b _0813DA30
_0813DA00:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0813DA30
movs r0, 0x1C
ldrsh r1, [r6, r0]
movs r0, 0x64
muls r1, r0
ldr r0, =gPlayerParty
adds r7, r1, r0
ldrh r4, [r6, 0xC]
ldrb r5, [r6, 0xE]
ldrb r6, [r6, 0x1C]
adds r0, r2, 0
bl DestroyTask
adds r0, r7, 0
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl EvolutionScene
_0813DA30:
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_813D9C0
thumb_func_start BeginEvolutionScene
BeginEvolutionScene: @ 813DA40
push {r4-r6,lr}
adds r4, r1, 0
adds r5, r2, 0
adds r6, r3, 0
lsls r4, 16
lsrs r4, 16
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
ldr r0, =sub_813D9C0
movs r1, 0
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 r0, [r1, 0x8]
strh r4, [r1, 0xC]
strh r5, [r1, 0xE]
strh r6, [r1, 0x1C]
ldr r0, =sub_813D9B0
bl SetMainCallback2
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end BeginEvolutionScene
thumb_func_start EvolutionScene
EvolutionScene: @ 813DA8C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x24
adds r4, r0, 0
mov r10, r1
mov r0, r10
lsls r0, 16
lsrs r0, 16
mov r10, r0
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0x18]
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0x1C]
movs r0, 0
bl SetHBlankCallback
movs r0, 0
bl SetVBlankCallback
movs r1, 0
str r1, [sp, 0x14]
add r0, sp, 0x14
movs r1, 0xC0
lsls r1, 19
ldr r2, =0x05006000
bl CpuSet
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
bl ResetPaletteFade
ldr r0, =gBattle_BG0_X
movs r2, 0
strh r2, [r0]
ldr r0, =gBattle_BG0_Y
strh r2, [r0]
ldr r0, =gBattle_BG1_X
strh r2, [r0]
ldr r0, =gBattle_BG1_Y
strh r2, [r0]
ldr r0, =gBattle_BG2_X
strh r2, [r0]
ldr r0, =gBattle_BG2_Y
strh r2, [r0]
ldr r1, =gBattle_BG3_X
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
strh r0, [r1]
ldr r0, =gBattle_BG3_Y
movs r1, 0
strh r1, [r0]
ldr r1, =gBattleTerrain
movs r0, 0x9
strb r0, [r1]
bl sub_80356D0
bl LoadBattleTextboxAndBackground
bl ResetSpriteData
bl remove_some_task
bl ResetTasks
bl FreeAllSpritePalettes
ldr r0, =gReservedSpritePaletteCount
movs r2, 0x4
strb r2, [r0]
movs r0, 0x64
bl AllocZeroed
ldr r1, =gUnknown_0203AB80
str r0, [r1]
bl AllocateMonSpritesGfx
adds r0, r4, 0
movs r1, 0x2
mov r2, sp
bl GetMonData
ldr r0, =gStringVar1
mov r1, sp
bl StringCopy10
ldr r0, =gStringVar2
movs r1, 0xB
mov r2, r10
muls r2, r1
adds r1, r2, 0
ldr r2, =gSpeciesNames
adds r1, r2
bl StringCopy
adds r0, r4, 0
movs r1, 0xB
bl GetMonData
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
adds r0, r4, 0
movs r1, 0x1
bl GetMonData
str r0, [sp, 0x20]
adds r0, r4, 0
movs r1, 0
bl GetMonData
mov r9, r0
lsls r0, r5, 3
ldr r1, =gMonFrontPicTable
adds r0, r1
ldr r2, =gMonSpritesGfxPtr
ldr r1, [r2]
ldr r1, [r1, 0x8]
adds r2, r5, 0
bl DecompressPicFromTable_2
adds r0, r5, 0
ldr r1, [sp, 0x20]
mov r2, r9
bl sub_806E7CC
ldr r0, [r0]
movs r1, 0x88
lsls r1, 1
movs r2, 0x20
bl LoadCompressedPalette
adds r0, r5, 0
movs r1, 0x1
bl sub_806A068
ldr r0, =gUnknown_0202499C
mov r8, r0
ldr r1, =gDummySpriteAffineAnimTable
str r1, [r0, 0x10]
movs r1, 0x78
movs r2, 0x40
movs r3, 0x1E
bl CreateSprite
ldr r1, =gUnknown_0203AB80
ldr r2, [r1]
lsls r1, r0, 24
lsrs r3, r1, 24
strb r0, [r2]
ldr r7, =gSprites
lsls r1, r3, 4
adds r1, r3
lsls r1, 2
adds r6, r7, 0
adds r6, 0x1C
adds r0, r1, r6
ldr r2, =SpriteCallbackDummy_2
str r2, [r0]
adds r1, r7
ldrb r2, [r1, 0x5]
movs r4, 0xF
adds r0, r4, 0
ands r0, r2
movs r2, 0x10
orrs r0, r2
strb r0, [r1, 0x5]
adds r1, 0x3E
ldrb r0, [r1]
movs r2, 0x4
orrs r0, r2
strb r0, [r1]
mov r1, r10
lsls r0, r1, 3
ldr r2, =gMonFrontPicTable
adds r0, r2
ldr r2, =gMonSpritesGfxPtr
ldr r1, [r2]
ldr r1, [r1, 0x10]
mov r2, r10
bl DecompressPicFromTable_2
mov r0, r10
ldr r1, [sp, 0x20]
mov r2, r9
bl sub_806E7CC
ldr r0, [r0]
movs r1, 0x90
lsls r1, 1
movs r2, 0x20
bl LoadCompressedPalette
mov r0, r10
movs r1, 0x3
bl sub_806A068
ldr r0, =gDummySpriteAffineAnimTable
mov r1, r8
str r0, [r1, 0x10]
mov r0, r8
movs r1, 0x78
movs r2, 0x40
movs r3, 0x1E
bl CreateSprite
ldr r1, =gUnknown_0203AB80
ldr r2, [r1]
lsls r1, r0, 24
lsrs r3, r1, 24
strb r0, [r2, 0x1]
lsls r1, r3, 4
adds r1, r3
lsls r1, 2
adds r6, r1, r6
ldr r2, =SpriteCallbackDummy_2
str r2, [r6]
adds r1, r7
ldrb r0, [r1, 0x5]
ands r4, r0
movs r0, 0x20
orrs r4, r0
strb r4, [r1, 0x5]
adds r1, 0x3E
ldrb r0, [r1]
movs r2, 0x4
orrs r0, r2
strb r0, [r1]
bl LoadEvoSparkleSpriteAndPal
ldr r0, =evovle_mon_maybe
movs r1, 0
bl CreateTask
ldr r1, =gUnknown_0203AB80
ldr r2, [r1]
lsls r1, r0, 24
lsrs r3, r1, 24
strb r0, [r2, 0x2]
ldr r1, =gTasks
lsls r0, r3, 2
adds r0, r3
lsls r0, 3
adds r0, r1
movs r2, 0
strh r2, [r0, 0x8]
strh r5, [r0, 0xA]
mov r1, r10
strh r1, [r0, 0xC]
mov r2, sp
ldrh r2, [r2, 0x18]
strh r2, [r0, 0xE]
movs r1, 0x1
strh r1, [r0, 0x10]
movs r1, 0
strh r1, [r0, 0x1A]
mov r2, sp
ldrh r2, [r2, 0x1C]
strh r2, [r0, 0x1C]
ldr r1, =gUnknown_0203AB80
ldr r0, [r1]
ldr r1, =gPlttBufferUnfaded + 0x40
adds r0, 0x4
movs r2, 0x60
bl memcpy
movs r1, 0xFA
lsls r1, 5
movs r0, 0
bl SetGpuReg
ldr r0, =nullsub_83
bl SetHBlankCallback
ldr r0, =sub_813FCDC
bl SetVBlankCallback
bl m4aMPlayAllStop
ldr r0, =sub_813E3A4
bl SetMainCallback2
add sp, 0x24
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end EvolutionScene
thumb_func_start sub_813DD7C
sub_813DD7C: @ 813DD7C
push {r4-r6,lr}
mov r6, r9
mov r5, r8
push {r5,r6}
sub sp, 0x8
ldr r2, =gTasks
ldr r0, =gUnknown_0203AB80
mov r8, r0
ldr r0, [r0]
ldrb r1, [r0, 0x2]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x1C
ldrsh r2, [r0, r1]
movs r1, 0x64
adds r4, r2, 0
muls r4, r1
ldr r1, =gPlayerParty
adds r4, r1
ldrh r5, [r0, 0xC]
adds r0, r4, 0
movs r1, 0x1
bl GetMonData
mov r9, r0
adds r0, r4, 0
movs r1, 0
bl GetMonData
adds r6, r0, 0
movs r0, 0
bl SetHBlankCallback
movs r0, 0
bl SetVBlankCallback
movs r4, 0
str r4, [sp, 0x4]
movs r1, 0xC0
lsls r1, 19
ldr r2, =0x05006000
add r0, sp, 0x4
bl CpuSet
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
bl ResetPaletteFade
ldr r0, =gBattle_BG0_X
strh r4, [r0]
ldr r0, =gBattle_BG0_Y
strh r4, [r0]
ldr r0, =gBattle_BG1_X
strh r4, [r0]
ldr r0, =gBattle_BG1_Y
strh r4, [r0]
ldr r0, =gBattle_BG2_X
strh r4, [r0]
ldr r0, =gBattle_BG2_Y
strh r4, [r0]
ldr r1, =gBattle_BG3_X
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
strh r0, [r1]
ldr r0, =gBattle_BG3_Y
strh r4, [r0]
ldr r1, =gBattleTerrain
movs r0, 0x9
strb r0, [r1]
bl sub_80356D0
bl LoadBattleTextboxAndBackground
bl ResetSpriteData
bl FreeAllSpritePalettes
ldr r1, =gReservedSpritePaletteCount
movs r0, 0x4
strb r0, [r1]
lsls r0, r5, 3
ldr r1, =gMonFrontPicTable
adds r0, r1
ldr r1, =gMonSpritesGfxPtr
ldr r1, [r1]
ldr r1, [r1, 0x10]
adds r2, r5, 0
bl DecompressPicFromTable_2
adds r0, r5, 0
mov r1, r9
adds r2, r6, 0
bl sub_806E7CC
ldr r0, [r0]
movs r1, 0x90
lsls r1, 1
movs r2, 0x20
bl LoadCompressedPalette
adds r0, r5, 0
movs r1, 0x3
bl sub_806A068
ldr r0, =gUnknown_0202499C
ldr r1, =gDummySpriteAffineAnimTable
str r1, [r0, 0x10]
movs r1, 0x78
movs r2, 0x40
movs r3, 0x1E
bl CreateSprite
mov r2, r8
ldr r1, [r2]
lsls r2, r0, 24
lsrs r2, 24
strb r0, [r1, 0x1]
ldr r3, =gSprites
lsls r1, r2, 4
adds r1, r2
lsls r1, 2
adds r0, r3, 0
adds r0, 0x1C
adds r0, r1, r0
ldr r2, =SpriteCallbackDummy_2
str r2, [r0]
adds r1, r3
ldrb r2, [r1, 0x5]
movs r0, 0xF
ands r0, r2
movs r2, 0x20
orrs r0, r2
strb r0, [r1, 0x5]
movs r1, 0xFA
lsls r1, 5
movs r0, 0
bl SetGpuReg
ldr r0, =nullsub_83
bl SetHBlankCallback
ldr r0, =sub_813FCDC
bl SetVBlankCallback
ldr r0, =sub_813E3A4
bl SetMainCallback2
movs r0, 0x1
negs r0, r0
str r4, [sp]
movs r1, 0
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
movs r0, 0
bl ShowBg
movs r0, 0x1
bl ShowBg
movs r0, 0x2
bl ShowBg
movs r0, 0x3
bl ShowBg
add sp, 0x8
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_813DD7C
thumb_func_start sub_813DF70
sub_813DF70: @ 813DF70
push {r4-r6,lr}
sub sp, 0xC
ldr r2, =gTasks
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r1, [r0, 0x2]
lsls r0, r1, 2
@ -653,7 +87,7 @@ _0813DFE0:
.pool
_0813E050:
bl ResetPaletteFade
ldr r0, =nullsub_83
ldr r0, =EvoDummyFunc
bl SetHBlankCallback
ldr r0, =sub_813FD64
bl SetVBlankCallback
@ -705,7 +139,7 @@ _0813E0A8:
adds r0, r6, 0
adds r1, r5, 0
adds r2, r4, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
ldr r0, [r0]
movs r1, 0x90
lsls r1, 1
@ -724,7 +158,7 @@ _0813E0F0:
movs r2, 0x40
movs r3, 0x1E
bl CreateSprite
ldr r1, =gUnknown_0203AB80
ldr r1, =gEvoStructPtr
ldr r1, [r1]
lsls r2, r0, 24
lsrs r2, 24
@ -856,7 +290,7 @@ sub_813E1D4: @ 813E1D4
movs r1, 0x1
bl GetMonData
mov r10, r0
ldr r1, =gUnknown_0203AB80
ldr r1, =gEvoStructPtr
mov r9, r1
movs r0, 0x64
bl AllocZeroed
@ -875,7 +309,7 @@ sub_813E1D4: @ 813E1D4
adds r0, r5, 0
mov r1, r10
adds r2, r7, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
ldr r0, [r0]
movs r1, 0x90
lsls r1, 1
@ -980,8 +414,8 @@ sub_813E1D4: @ 813E1D4
.pool
thumb_func_end sub_813E1D4
thumb_func_start sub_813E3A4
sub_813E3A4: @ 813E3A4
thumb_func_start CB2_EvolutionSceneUpdate
CB2_EvolutionSceneUpdate: @ 813E3A4
push {lr}
bl AnimateSprites
bl BuildOamBuffer
@ -990,7 +424,7 @@ sub_813E3A4: @ 813E3A4
bl RunTasks
pop {r0}
bx r0
thumb_func_end sub_813E3A4
thumb_func_end CB2_EvolutionSceneUpdate
thumb_func_start sub_813E3C0
sub_813E3C0: @ 813E3C0
@ -1183,8 +617,8 @@ _0813E546:
.pool
thumb_func_end evovle_mon_internal_maybe
thumb_func_start evovle_mon_maybe
evovle_mon_maybe: @ 813E570
thumb_func_start Task_EvolutionScene
Task_EvolutionScene: @ 813E570
push {r4-r7,lr}
mov r7, r9
mov r6, r8
@ -1292,7 +726,7 @@ _0813E670:
movs r3, 0
bl BeginNormalPaletteFade
ldr r2, =gSprites
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r1, [r0]
lsls r0, r1, 4
@ -1354,7 +788,7 @@ _0813E714:
beq _0813E724
bl _0813F1A4
_0813E724:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0]
ldr r1, =gTasks
@ -1365,7 +799,7 @@ _0813E724:
b _0813EB90
.pool
_0813E740:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0]
bl sub_8140208
@ -1450,7 +884,7 @@ _0813E7FE:
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1, 0x3]
@ -1470,7 +904,7 @@ _0813E828:
beq _0813E83E
bl _0813F1A4
_0813E83E:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r1, [r0]
ldrb r0, [r1]
ldrb r1, [r1, 0x1]
@ -1483,7 +917,7 @@ _0813E83E:
b _0813EC52
.pool
_0813E860:
ldr r2, =gUnknown_0203AB80
ldr r2, =gEvoStructPtr
ldr r1, [r2]
ldrb r0, [r1, 0x3]
subs r0, 0x1
@ -1574,7 +1008,7 @@ _0813E918:
_0813E926:
bl m4aMPlayAllStop
ldr r0, =gPlttBufferUnfaded + 0x40
ldr r1, =gUnknown_0203AB80
ldr r1, =gEvoStructPtr
ldr r1, [r1]
adds r1, 0x4
movs r2, 0x60
@ -1603,7 +1037,7 @@ _0813E964:
beq _0813E974
bl _0813F1A4
_0813E974:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0, 0x1]
mov r1, r8
@ -1776,7 +1210,7 @@ _0813EB06:
adds r0, r7, 0
bl DestroyTask
bl FreeMonSpritesGfx
ldr r4, =gUnknown_0203AB80
ldr r4, =gEvoStructPtr
ldr r0, [r4]
bl Free
str r6, [r4]
@ -1821,7 +1255,7 @@ _0813EB74:
beq _0813EB82
b _0813F1A4
_0813EB82:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0]
mov r3, r8
@ -1839,7 +1273,7 @@ _0813EB96:
b _0813F1A4
.pool
_0813EBA8:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0]
bl sub_8140208
@ -2236,7 +1670,7 @@ _0813EF3E:
subs r2, 0x1
lsls r2, 24
lsrs r2, 24
ldr r3, =sub_813DD7C
ldr r3, =CB2_EvolutionSceneLoadGraphics
ldr r4, =gMoveToLearn
ldrh r4, [r4]
str r4, [sp]
@ -2256,7 +1690,7 @@ _0813EF88:
b _0813F1A4
_0813EF96:
ldr r1, [r6, 0x4]
ldr r0, =sub_813E3A4
ldr r0, =CB2_EvolutionSceneUpdate
cmp r1, r0
beq _0813EFA0
b _0813F1A4
@ -2472,7 +1906,7 @@ _0813F1A4:
pop {r0}
bx r0
.pool
thumb_func_end evovle_mon_maybe
thumb_func_end Task_EvolutionScene
thumb_func_start sub_813F1B8
sub_813F1B8: @ 813F1B8
@ -2619,7 +2053,7 @@ _0813F324:
movs r0, 0x1
bl sub_8140000
ldr r2, =gSprites
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r1, [r0]
lsls r0, r1, 4
@ -2666,7 +2100,7 @@ _0813F396:
ldrh r1, [r0, 0x8]
adds r1, 0x1
strh r1, [r0, 0x8]
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1, 0x3]
@ -2686,7 +2120,7 @@ _0813F3C0:
beq _0813F3D6
bl _0813FCC4
_0813F3D6:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r1, [r0]
ldrb r0, [r1]
ldrb r1, [r1, 0x1]
@ -2695,7 +2129,7 @@ _0813F3D6:
b _0813F6AC
.pool
_0813F3F0:
ldr r2, =gUnknown_0203AB80
ldr r2, =gEvoStructPtr
ldr r1, [r2]
ldrb r0, [r1, 0x3]
subs r0, 0x1
@ -2779,7 +2213,7 @@ _0813F4A6:
ldr r0, =gUnknown_0203AB84
ldr r0, [r0]
bl Free
ldr r5, =gUnknown_0203AB80
ldr r5, =gEvoStructPtr
ldr r0, [r5]
ldrb r0, [r0, 0x1]
ldr r1, =gTasks
@ -2935,7 +2369,7 @@ _0813F624:
_0813F634:
adds r0, r7, 0
bl DestroyTask
ldr r4, =gUnknown_0203AB80
ldr r4, =gEvoStructPtr
ldr r0, [r4]
bl Free
str r5, [r4]
@ -2964,7 +2398,7 @@ _0813F668:
_0813F67C:
bl m4aMPlayAllStop
ldr r2, =gSprites
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r1, [r0]
lsls r0, r1, 4
@ -3004,7 +2438,7 @@ _0813F6D0:
beq _0813F6DE
b _0813FCC4
_0813F6DE:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0]
lsls r4, r7, 2
@ -3020,7 +2454,7 @@ _0813F6F2:
b _0813FCC4
.pool
_0813F704:
ldr r0, =gUnknown_0203AB80
ldr r0, =gEvoStructPtr
ldr r0, [r0]
ldrb r0, [r0]
bl sub_8140208
@ -3622,13 +3056,13 @@ _0813FCC4:
.pool
thumb_func_end sub_813F1B8
thumb_func_start nullsub_83
nullsub_83: @ 813FCD8
thumb_func_start EvoDummyFunc
EvoDummyFunc: @ 813FCD8
bx lr
thumb_func_end nullsub_83
thumb_func_end EvoDummyFunc
thumb_func_start sub_813FCDC
sub_813FCDC: @ 813FCDC
thumb_func_start VBlankCB_EvolutionScene
VBlankCB_EvolutionScene: @ 813FCDC
push {lr}
ldr r0, =gBattle_BG0_X
ldrh r1, [r0]
@ -3669,7 +3103,7 @@ sub_813FCDC: @ 813FCDC
pop {r0}
bx r0
.pool
thumb_func_end sub_813FCDC
thumb_func_end VBlankCB_EvolutionScene
thumb_func_start sub_813FD64
sub_813FD64: @ 813FD64

View File

@ -694,7 +694,7 @@ sub_80B5FE8: @ 80B5FE8
lsls r5, 16
lsrs r5, 16
adds r0, r6, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
mov r8, r0
lsls r4, 16
asrs r4, 16

View File

@ -348,7 +348,7 @@ _08179E84:
adds r1, r0, 0
adds r0, r5, 0
adds r2, r4, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
ldrh r0, [r4, 0x4]

View File

@ -1087,7 +1087,7 @@ _081C4750:
ldrh r0, [r5, 0x2]
ldr r1, [r5, 0x48]
ldr r2, [r5, 0xC]
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
ldrh r0, [r4, 0x4]

View File

@ -732,7 +732,7 @@ _080F8DD8:
adds r0, r6, 0
mov r1, r8
adds r2, r5, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
adds r0, r6, 0

View File

@ -229,6 +229,7 @@
#define BATTLE_TERRAIN_ROCK 6
#define BATTLE_TERRAIN_CAVE 7
#define BATTLE_TERRAIN_INSIDE 8
#define BATTLE_TERRAIN_PLAIN 9
// array entries for battle communication
#define MULTIUSE_STATE 0x0

View File

@ -620,7 +620,7 @@ void SetWildMonHeldItem(void);
u16 GetMonEVCount(struct Pokemon *);
const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon);
const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality);
const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality);
bool32 IsHMMove2(u16 move);
bool8 IsPokeSpriteNotFlipped(u16 species);
bool8 IsMonShiny(struct Pokemon *mon);

View File

@ -180,6 +180,7 @@ SECTIONS {
asm/rom6.o(.text);
asm/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);
src/evolution_scene.o(.text);
asm/evolution_scene.o(.text);
asm/roulette.o(.text);
asm/pokedex_cry_screen.o(.text);

View File

@ -124,7 +124,7 @@ static void sub_818D0C4(u16 species, u32 otId, u32 personality, u8 paletteSlot,
else
{
gUnknown_0203CCEC.paletteTag = paletteTag;
LoadCompressedObjectPalette(sub_806E7CC(species, otId, personality));
LoadCompressedObjectPalette(GetMonSpritePalStructFromOtIdPersonality(species, otId, personality));
}
}
else

299
src/evolution_scene.c Normal file
View File

@ -0,0 +1,299 @@
#include "global.h"
#include "evolution_scene.h"
#include "evolution_graphics.h"
#include "sprite.h"
#include "malloc.h"
#include "task.h"
#include "palette.h"
#include "main.h"
#include "text.h"
#include "text_window.h"
#include "pokemon.h"
#include "string_util.h"
#include "battle.h"
#include "unknown_task.h"
#include "decompress.h"
#include "m4a.h"
#include "menu.h"
#include "pokedex.h"
#include "species.h"
#include "sound.h"
#include "songs.h"
#include "overworld.h"
#include "battle_message.h"
#include "gpu_regs.h"
#include "bg.h"
struct EvoInfo
{
u8 preEvoSpriteID;
u8 postEvoSpriteID;
u8 evoTaskID;
u16 savedPalette[48];
};
extern struct EvoInfo *gEvoStructPtr;
extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y;
extern u16 gBattle_BG1_X;
extern u16 gBattle_BG1_Y;
extern u16 gBattle_BG2_X;
extern u16 gBattle_BG2_Y;
extern u16 gBattle_BG3_X;
extern u16 gBattle_BG3_Y;
extern u16 gBattle_WIN0H;
extern u16 gBattle_WIN0V;
extern u16 gBattle_WIN1H;
extern u16 gBattle_WIN1V;
extern u8 gBattleTerrain;
extern struct SpriteTemplate gUnknown_0202499C;
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern void SpriteCallbackDummy_2(struct Sprite *sprite);
extern void sub_80356D0(void);
extern void sub_806A068(u16, u8);
// this file's functions
void Task_EvolutionScene(u8 taskID);
void Task_TradeEvolutionScene(u8 taskID);
void CB2_EvolutionSceneUpdate(void);
void CB2_TradeEvolutionSceneUpdate(void);
void EvoDummyFunc(void);
void EvoDummyFunc2(void);
void VBlankCB_EvolutionScene(void);
void VBlankCB_TradeEvolutionScene(void);
void sub_81150D8(void);
void CB2_BeginEvolutionScene(void)
{
UpdatePaletteFade();
RunTasks();
}
#define tState data[0]
#define tPreEvoSpecies data[1]
#define tPostEvoSpecies data[2]
#define tCanStop data[3]
#define tBits data[3]
#define tLearnsFirstMove data[4]
#define tLearnMoveState data[6]
#define tData7 data[7]
#define tData8 data[8]
#define tEvoWasStopped data[9]
#define tPartyID data[10]
#define TASK_BIT_CAN_STOP 0x1
#define TASK_BIT_LEARN_MOVE 0x80
void Task_BeginEvolutionScene(u8 taskID)
{
struct Pokemon* mon = NULL;
switch (gTasks[taskID].tState)
{
case 0:
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gTasks[taskID].tState++;
break;
case 1:
if (!gPaletteFade.active)
{
u16 speciesToEvolve;
bool8 canStopEvo;
u8 partyID;
mon = &gPlayerParty[gTasks[taskID].tPartyID];
speciesToEvolve = gTasks[taskID].tPostEvoSpecies;
canStopEvo = gTasks[taskID].tCanStop;
partyID = gTasks[taskID].tPartyID;
DestroyTask(taskID);
EvolutionScene(mon, speciesToEvolve, canStopEvo, partyID);
}
break;
}
}
void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID)
{
u8 taskID = CreateTask(Task_BeginEvolutionScene, 0);
gTasks[taskID].tState = 0;
gTasks[taskID].tPostEvoSpecies = speciesToEvolve;
gTasks[taskID].tCanStop = canStopEvo;
gTasks[taskID].tPartyID = partyID;
SetMainCallback2(CB2_BeginEvolutionScene);
}
void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID)
{
u8 name[20];
u16 currSpecies;
u32 TiD, PiD;
const struct CompressedSpritePalette* pokePal;
u8 ID;
SetHBlankCallback(NULL);
SetVBlankCallback(NULL);
CpuFill32(0, (void*)(VRAM), VRAM_SIZE);
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);
ResetPaletteFade();
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
gBattle_BG2_X = 0;
gBattle_BG2_Y = 0;
gBattle_BG3_X = 256;
gBattle_BG3_Y = 0;
gBattleTerrain = BATTLE_TERRAIN_PLAIN;
sub_80356D0();
LoadBattleTextboxAndBackground();
ResetSpriteData();
remove_some_task();
ResetTasks();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 4;
gEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo));
AllocateMonSpritesGfx();
GetMonData(mon, MON_DATA_NICKNAME, name);
StringCopy10(gStringVar1, name);
StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]);
// preEvo sprite
currSpecies = GetMonData(mon, MON_DATA_SPECIES);
TiD = GetMonData(mon, MON_DATA_OT_ID);
PiD = GetMonData(mon, MON_DATA_PERSONALITY);
DecompressPicFromTable_2(&gMonFrontPicTable[currSpecies],
gMonSpritesGfxPtr->sprites[1],
currSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, TiD, PiD);
LoadCompressedPalette(pokePal->data, 0x110, 0x20);
sub_806A068(currSpecies, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
gEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 1;
gSprites[ID].invisible = 1;
// postEvo sprite
DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve],
gMonSpritesGfxPtr->sprites[3],
speciesToEvolve);
pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, TiD, PiD);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(speciesToEvolve, 3);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
gSprites[ID].invisible = 1;
LoadEvoSparkleSpriteAndPal();
gEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0);
gTasks[ID].tState = 0;
gTasks[ID].tPreEvoSpecies = currSpecies;
gTasks[ID].tPostEvoSpecies = speciesToEvolve;
gTasks[ID].tCanStop = canStopEvo;
gTasks[ID].tLearnsFirstMove = TRUE;
gTasks[ID].tEvoWasStopped = FALSE;
gTasks[ID].tPartyID = partyID;
memcpy(&gEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP);
SetHBlankCallback(EvoDummyFunc);
SetVBlankCallback(VBlankCB_EvolutionScene);
m4aMPlayAllStop();
SetMainCallback2(CB2_EvolutionSceneUpdate);
}
void CB2_EvolutionSceneLoadGraphics(void)
{
u8 ID;
const struct CompressedSpritePalette* pokePal;
u16 postEvoSpecies;
u32 TiD, PiD;
struct Pokemon* Mon = &gPlayerParty[gTasks[gEvoStructPtr->evoTaskID].tPartyID];
postEvoSpecies = gTasks[gEvoStructPtr->evoTaskID].tPostEvoSpecies;
TiD = GetMonData(Mon, MON_DATA_OT_ID);
PiD = GetMonData(Mon, MON_DATA_PERSONALITY);
SetHBlankCallback(NULL);
SetVBlankCallback(NULL);
CpuFill32(0, (void*)(VRAM), VRAM_SIZE);
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);
ResetPaletteFade();
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
gBattle_BG2_X = 0;
gBattle_BG2_Y = 0;
gBattle_BG3_X = 256;
gBattle_BG3_Y = 0;
gBattleTerrain = BATTLE_TERRAIN_PLAIN;
sub_80356D0();
LoadBattleTextboxAndBackground();
ResetSpriteData();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 4;
DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies],
gMonSpritesGfxPtr->sprites[3],
postEvoSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, TiD, PiD);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(postEvoSpecies, 3);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP);
SetHBlankCallback(EvoDummyFunc);
SetVBlankCallback(VBlankCB_EvolutionScene);
SetMainCallback2(CB2_EvolutionSceneUpdate);
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
ShowBg(0);
ShowBg(1);
ShowBg(2);
ShowBg(3);
}

View File

@ -1267,10 +1267,10 @@ const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon)
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
return sub_806E7CC(species, otId, personality);
return GetMonSpritePalStructFromOtIdPersonality(species, otId, personality);
}
const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality)
const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality)
{
u32 shinyValue;

View File

@ -1280,7 +1280,7 @@ gUnknown_0203AB78: @ 203AB78
gUnknown_0203AB7C: @ 203AB7C
.space 0x4
gUnknown_0203AB80: @ 203AB80
gEvoStructPtr: @ 203AB80
.space 0x4
gUnknown_0203AB84: @ 203AB84