summaryrefslogtreecommitdiff
path: root/engine/gfx/pic_animation.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/gfx/pic_animation.asm')
-rw-r--r--engine/gfx/pic_animation.asm196
1 files changed, 67 insertions, 129 deletions
diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm
index 54999a6bb..843e5cba4 100644
--- a/engine/gfx/pic_animation.asm
+++ b/engine/gfx/pic_animation.asm
@@ -1,6 +1,6 @@
; Pic animation arrangement.
-Unused_AnimateMon_Slow_Normal: ; d0000
+Unused_AnimateMon_Slow_Normal:
hlcoord 12, 0
ld a, [wBattleMode]
cp WILD_BATTLE
@@ -15,42 +15,36 @@ Unused_AnimateMon_Slow_Normal: ; d0000
ld d, $0
call AnimateFrontpic
ret
-; d001a
-AnimateMon_Menu: ; d001a
+AnimateMon_Menu:
ld e, ANIM_MON_MENU
ld d, $0
call AnimateFrontpic
ret
-; d0022
-AnimateMon_Trade: ; d0022
+AnimateMon_Trade:
ld e, ANIM_MON_TRADE
ld d, $0
call AnimateFrontpic
ret
-; d002a
-AnimateMon_Evolve: ; d002a
+AnimateMon_Evolve:
ld e, ANIM_MON_EVOLVE
ld d, $0
call AnimateFrontpic
ret
-; d0032
-AnimateMon_Hatch: ; d0032
+AnimateMon_Hatch:
ld e, ANIM_MON_HATCH
ld d, $0
call AnimateFrontpic
ret
-; d003a
-AnimateMon_Unused: ; d003a
+AnimateMon_Unused:
ld e, ANIM_MON_UNUSED
ld d, $0
call AnimateFrontpic
ret
-; d0042
pokeanim: MACRO
rept _NARG
@@ -64,7 +58,7 @@ endr
db (PokeAnim_Finish_ - PokeAnim_SetupCommands) / 2
ENDM
-PokeAnims: ; d0042
+PokeAnims:
dw .Slow
dw .Normal
dw .Menu
@@ -85,8 +79,7 @@ PokeAnims: ; d0042
.Egg1: pokeanim Setup, Play
.Egg2: pokeanim Idle, Play
-
-AnimateFrontpic: ; d008e
+AnimateFrontpic:
call AnimateMon_CheckIfPokemon
ret c
call LoadMonAnimation
@@ -97,9 +90,8 @@ AnimateFrontpic: ; d008e
pop af
jr nc, .loop
ret
-; d00a3
-LoadMonAnimation: ; d00a3
+LoadMonAnimation:
push hl
ld c, e
ld b, 0
@@ -112,9 +104,8 @@ LoadMonAnimation: ; d00a3
pop hl
call PokeAnim_InitPicAttributes
ret
-; d00b4
-SetUpPokeAnim: ; d00b4
+SetUpPokeAnim:
ld a, [rSVBK]
push af
ld a, BANK(wPokeAnimSceneIndex)
@@ -139,9 +130,8 @@ SetUpPokeAnim: ; d00b4
ret z
scf
ret
-; d00da
-PokeAnim_SetupCommands: ; d00da
+PokeAnim_SetupCommands:
setup_command: MACRO
\1_: dw \1
ENDM
@@ -157,16 +147,15 @@ ENDM
setup_command PokeAnim_Cry
setup_command PokeAnim_CryNoWait
setup_command PokeAnim_StereoCry
-; d00f2
-PokeAnim_SetWait: ; d00f2
+PokeAnim_SetWait:
ld a, 18
ld [wPokeAnimWaitCounter], a
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
-PokeAnim_Wait: ; d00fe
+PokeAnim_Wait:
ld hl, wPokeAnimWaitCounter
dec [hl]
ret nz
@@ -174,9 +163,8 @@ PokeAnim_Wait: ; d00fe
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d010b
-PokeAnim_Setup: ; d010b
+PokeAnim_Setup:
ld c, FALSE
ld b, 0
call PokeAnim_InitAnim
@@ -185,9 +173,8 @@ PokeAnim_Setup: ; d010b
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d011d
-PokeAnim_Setup2: ; d011d
+PokeAnim_Setup2:
ld c, FALSE
ld b, 4
call PokeAnim_InitAnim
@@ -196,9 +183,8 @@ PokeAnim_Setup2: ; d011d
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d012f
-PokeAnim_Idle: ; d012f
+PokeAnim_Idle:
ld c, TRUE
ld b, 0
call PokeAnim_InitAnim
@@ -207,9 +193,8 @@ PokeAnim_Idle: ; d012f
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d0141
-PokeAnim_Play: ; d0141
+PokeAnim_Play:
call PokeAnim_DoAnimScript
ld a, [wPokeAnimJumptableIndex]
bit 7, a
@@ -219,9 +204,8 @@ PokeAnim_Play: ; d0141
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d0155
-PokeAnim_Play2: ; d0155
+PokeAnim_Play2:
call PokeAnim_DoAnimScript
ld a, [wPokeAnimJumptableIndex]
bit 7, a
@@ -230,42 +214,37 @@ PokeAnim_Play2: ; d0155
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d0166
-PokeAnim_BasePic: ; d0166
+PokeAnim_BasePic:
call PokeAnim_DeinitFrames
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d0171
-PokeAnim_Finish: ; d0171
+PokeAnim_Finish:
call PokeAnim_DeinitFrames
ld hl, wPokeAnimSceneIndex
set 7, [hl]
ret
-; d017a
-PokeAnim_Cry: ; d017a
+PokeAnim_Cry:
ld a, [wPokeAnimSpecies]
call _PlayMonCry
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d0188
-PokeAnim_CryNoWait: ; d0188
+PokeAnim_CryNoWait:
ld a, [wPokeAnimSpecies]
call PlayMonCry2
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d0196
-PokeAnim_StereoCry: ; d0196
+PokeAnim_StereoCry:
ld a, $f
ld [wCryTracks], a
ld a, [wPokeAnimSpecies]
@@ -274,9 +253,8 @@ PokeAnim_StereoCry: ; d0196
inc a
ld [wPokeAnimSceneIndex], a
ret
-; d01a9
-PokeAnim_DeinitFrames: ; d01a9
+PokeAnim_DeinitFrames:
ld a, [rSVBK]
push af
ld a, BANK(wPokeAnimCoord)
@@ -288,9 +266,8 @@ PokeAnim_DeinitFrames: ; d01a9
pop af
ld [rSVBK], a
ret
-; d01c6
-AnimateMon_CheckIfPokemon: ; d01c6
+AnimateMon_CheckIfPokemon:
ld a, [wCurPartySpecies]
cp EGG
jr z, .fail
@@ -302,9 +279,8 @@ AnimateMon_CheckIfPokemon: ; d01c6
.fail
scf
ret
-; d01d6
-PokeAnim_InitPicAttributes: ; d01d6
+PokeAnim_InitPicAttributes:
ld a, [rSVBK]
push af
ld a, BANK(wPokeAnimSceneIndex)
@@ -355,9 +331,8 @@ PokeAnim_InitPicAttributes: ; d01d6
pop af
ld [rSVBK], a
ret
-; d0228
-PokeAnim_InitAnim: ; d0228
+PokeAnim_InitAnim:
ld a, [rSVBK]
push af
ld a, BANK(wPokeAnimIdleFlag)
@@ -378,9 +353,8 @@ PokeAnim_InitAnim: ; d0228
pop af
ld [rSVBK], a
ret
-; d0250
-PokeAnim_DoAnimScript: ; d0250
+PokeAnim_DoAnimScript:
xor a
ld [hBGMapMode], a
.loop
@@ -389,43 +363,39 @@ PokeAnim_DoAnimScript: ; d0250
ld hl, .Jumptable
rst JumpTable
ret
-; d025d
-.Jumptable: ; d025d
+.Jumptable:
dw .RunAnim
dw .WaitAnim
-; d0261
-.RunAnim: ; d0261
+.RunAnim:
call PokeAnim_GetPointer
ld a, [wPokeAnimCommand]
- cp -1
+ cp endanim_command
jr z, PokeAnim_End
- cp -2
+ cp setrepeat_command
jr z, .SetRepeat
- cp -3
+ cp dorepeat_command
jr z, .DoRepeat
call PokeAnim_GetFrame
ld a, [wPokeAnimParameter]
call PokeAnim_GetDuration
ld [wPokeAnimWaitCounter], a
call PokeAnim_StartWaitAnim
-.WaitAnim: ; d0282
+.WaitAnim:
ld a, [wPokeAnimWaitCounter]
dec a
ld [wPokeAnimWaitCounter], a
ret nz
call PokeAnim_StopWaitAnim
ret
-; d028e
-.SetRepeat: ; d028e
+.SetRepeat:
ld a, [wPokeAnimParameter]
ld [wPokeAnimRepeatTimer], a
jr .loop
-; d0296
-.DoRepeat: ; d0296
+.DoRepeat:
ld a, [wPokeAnimRepeatTimer]
and a
ret z
@@ -435,15 +405,13 @@ PokeAnim_DoAnimScript: ; d0250
ld a, [wPokeAnimParameter]
ld [wPokeAnimFrame], a
jr .loop
-; d02a8
-PokeAnim_End: ; d02a8
+PokeAnim_End:
ld hl, wPokeAnimJumptableIndex
set 7, [hl]
ret
-; d02ae
-PokeAnim_GetDuration: ; d02ae
+PokeAnim_GetDuration:
; a * (1 + [wPokeAnimSpeed] / 16)
ld c, a
ld b, $0
@@ -460,9 +428,8 @@ PokeAnim_GetDuration: ; d02ae
or h
add c
ret
-; d02c8
-PokeAnim_GetFrame: ; d02c8
+PokeAnim_GetFrame:
call PokeAnim_PlaceGraphic
ld a, [wPokeAnimCommand]
and a
@@ -473,35 +440,30 @@ PokeAnim_GetFrame: ; d02c8
pop hl
call PokeAnim_ConvertAndApplyBitmask
ret
-; d02dc
-PokeAnim_StartWaitAnim: ; d02dc
+PokeAnim_StartWaitAnim:
ld a, [wPokeAnimJumptableIndex]
inc a
ld [wPokeAnimJumptableIndex], a
ret
-; d02e4
-PokeAnim_StopWaitAnim: ; d02e4
+PokeAnim_StopWaitAnim:
ld a, [wPokeAnimJumptableIndex]
dec a
ld [wPokeAnimJumptableIndex], a
ret
-; d02ec
-PokeAnim_IsUnown: ; d02ec
+PokeAnim_IsUnown:
ld a, [wPokeAnimSpecies]
cp UNOWN
ret
-; d02f2
-PokeAnim_IsEgg: ; d02f2
+PokeAnim_IsEgg:
ld a, [wPokeAnimSpecies]
cp EGG
ret
-; d02f8
-PokeAnim_GetPointer: ; d02f8
+PokeAnim_GetPointer:
push hl
ld a, [wPokeAnimFrame]
ld e, a
@@ -522,9 +484,8 @@ PokeAnim_GetPointer: ; d02f8
inc [hl]
pop hl
ret
-; d031b
-PokeAnim_GetBitmaskIndex: ; d031b
+PokeAnim_GetBitmaskIndex:
ld a, [wPokeAnimCommand]
dec a
ld c, a
@@ -542,9 +503,8 @@ PokeAnim_GetBitmaskIndex: ; d031b
ld [wPokeAnimCurBitmask], a
inc hl
ret
-; d033b
-PokeAnim_CopyBitmaskToBuffer: ; d033b
+PokeAnim_CopyBitmaskToBuffer:
call .GetSize
push bc
ld hl, wPokeAnimBitmaskAddr
@@ -558,9 +518,8 @@ PokeAnim_CopyBitmaskToBuffer: ; d033b
ld a, [wPokeAnimBitmaskBank]
call FarCopyBytes
ret
-; d0356
-.GetSize: ; d0356
+.GetSize:
push hl
ld a, [wPokeAnimFrontpicHeight]
sub 5 ; to get a number 0, 1, or 2
@@ -572,7 +531,6 @@ PokeAnim_CopyBitmaskToBuffer: ; d033b
ld b, 0
pop hl
ret
-; d0368
.Sizes: db 4, 5, 7
@@ -588,7 +546,7 @@ y = y + 7
endr
ENDM
-PokeAnim_ConvertAndApplyBitmask: ; d036b
+PokeAnim_ConvertAndApplyBitmask:
xor a
ld [wPokeAnimBitmaskCurBit], a
ld [wPokeAnimBitmaskCurRow], a
@@ -614,9 +572,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
pop hl
jr nc, .loop
ret
-; d0392
-.IsCurBitSet: ; d0392
+.IsCurBitSet:
; which byte
ld a, [wPokeAnimBitmaskCurBit]
and $f8
@@ -652,9 +609,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
ld hl, wPokeAnimBitmaskCurBit
inc [hl]
ret
-; d03bd
-.ApplyFrame: ; d03bd
+.ApplyFrame:
push af
call .GetCoord
pop af
@@ -665,9 +621,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
pop hl
ld [hl], a
ret
-; d03cd
-.GetCoord: ; d03cd
+.GetCoord:
call .GetStartCoord
ld a, [wPokeAnimBitmaskCurRow]
ld bc, SCREEN_WIDTH
@@ -693,12 +648,11 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
.skip2
ret
-; d03f4
; unused
db 6, 5, 4
-.GetTilemap: ; d03f7
+.GetTilemap:
push af
ld a, [wPokeAnimFrontpicHeight]
cp 5
@@ -745,7 +699,6 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
.add_13
add 13
ret
-; d042f
._5by5:
poke_anim_box 5
@@ -764,8 +717,7 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
; db 36, 37, 38, 39, 40, 41
; db 43, 44, 45, 46, 47, 48
-
-.GetStartCoord: ; d046c
+.GetStartCoord:
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -793,9 +745,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
.add_bc
add hl, bc
ret
-; d0499
-.NextBit: ; d0499
+.NextBit:
ld a, [wPokeAnimBitmaskCurRow]
inc a
ld [wPokeAnimBitmaskCurRow], a
@@ -818,9 +769,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b
.no_carry
xor a
ret
-; d04bd
-PokeAnim_PlaceGraphic: ; d04bd
+PokeAnim_PlaceGraphic:
call .ClearBox
ld a, [wBoxAlignment]
and a
@@ -860,9 +810,8 @@ PokeAnim_PlaceGraphic: ; d04bd
dec c
jr nz, .loop
ret
-; d04f6
-.ClearBox: ; d04f6
+.ClearBox:
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -871,9 +820,8 @@ PokeAnim_PlaceGraphic: ; d04bd
ld c, 7
call ClearBox
ret
-; d0504
-PokeAnim_SetVBank1: ; d0504
+PokeAnim_SetVBank1:
ld a, [rSVBK]
push af
ld a, BANK(wPokeAnimCoord)
@@ -885,9 +833,8 @@ PokeAnim_SetVBank1: ; d0504
pop af
ld [rSVBK], a
ret
-; d051b
-.SetFlag: ; d051b
+.SetFlag:
call PokeAnim_GetAttrMapCoord
ld b, 7
ld c, 7
@@ -908,9 +855,8 @@ PokeAnim_SetVBank1: ; d0504
dec b
jr nz, .row
ret
-; d0536
-PokeAnim_SetVBank0: ; d0536
+PokeAnim_SetVBank0:
call PokeAnim_GetAttrMapCoord
ld b, 7
ld c, 7
@@ -931,9 +877,8 @@ PokeAnim_SetVBank0: ; d0536
dec b
jr nz, .row
ret
-; d0551
-PokeAnim_GetAttrMapCoord: ; d0551
+PokeAnim_GetAttrMapCoord:
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -941,9 +886,8 @@ PokeAnim_GetAttrMapCoord: ; d0551
ld de, wAttrMap - wTileMap
add hl, de
ret
-; d055c
-GetMonAnimPointer: ; d055c
+GetMonAnimPointer:
call PokeAnim_IsEgg
jr z, .egg
@@ -996,9 +940,8 @@ GetMonAnimPointer: ; d055c
ld a, h
ld [wPokeAnimPointerAddr + 1], a
ret
-; d05b4
-PokeAnim_GetFrontpicDims: ; d05b4
+PokeAnim_GetFrontpicDims:
ld a, [rSVBK]
push af
ld a, BANK(wCurPartySpecies)
@@ -1012,9 +955,8 @@ PokeAnim_GetFrontpicDims: ; d05b4
pop af
ld [rSVBK], a
ret
-; d05ce
-GetMonFramesPointer: ; d05ce
+GetMonFramesPointer:
call PokeAnim_IsEgg
jr z, .egg
@@ -1058,9 +1000,8 @@ GetMonFramesPointer: ; d05ce
ld a, h
ld [wPokeAnimFramesAddr + 1], a
ret
-; d061b
-GetMonBitmaskPointer: ; d061b
+GetMonBitmaskPointer:
call PokeAnim_IsEgg
jr z, .egg
@@ -1097,9 +1038,8 @@ GetMonBitmaskPointer: ; d061b
ld a, h
ld [wPokeAnimBitmaskAddr + 1], a
ret
-; d065c
-PokeAnim_GetSpeciesOrUnown: ; d065c
+PokeAnim_GetSpeciesOrUnown:
call PokeAnim_IsUnown
jr z, .unown
ld a, [wPokeAnimSpecies]
@@ -1108,13 +1048,12 @@ PokeAnim_GetSpeciesOrUnown: ; d065c
.unown
ld a, [wPokeAnimUnownLetter]
ret
-; d0669
-Unused_HOF_AnimateAlignedFrontpic: ; d0669
+Unused_HOF_AnimateAlignedFrontpic:
ld a, $1
ld [wBoxAlignment], a
-HOF_AnimateFrontpic: ; d066e
+HOF_AnimateFrontpic:
call AnimateMon_CheckIfPokemon
jr c, .fail
ld h, d
@@ -1138,4 +1077,3 @@ HOF_AnimateFrontpic: ; d066e
inc a
ld [wCurPartySpecies], a
ret
-; d0695