shithub: pokecrystal

Download patch

ref: 2cbb1acc6e3bc5fe30d1be8f665d2252703518ac
parent: e0445806694a80a98e4d803478a2675ec8803ba6
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sat Nov 7 04:48:32 EST 2015

Pokemon animations

--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -576,7 +576,7 @@
 
 ; Unless this is the enemy's last Pokemon...
 	push hl
-	callba CountEnemyAliveMons
+	callba CheckEnemyHasMonToSwitchTo
 	pop hl
 	jr nc, .asm_388b7
 
@@ -2028,7 +2028,7 @@
 	jp nz, AIDiscourageMove
 
 	push hl
-	callba CountEnemyAliveMons
+	callba CheckEnemyHasMonToSwitchTo
 	pop hl
 	jr nc, .asm_38eb0
 
@@ -2160,7 +2160,7 @@
 
 AI_Smart_PerishSong: ; 38f4a
 	push hl
-	callab CountEnemyAliveMons
+	callab CheckEnemyHasMonToSwitchTo
 	pop hl
 	jr c, .no
 
--- a/battle/ai/switch.asm
+++ b/battle/ai/switch.asm
@@ -184,7 +184,7 @@
 CheckAbleToSwitch: ; 34941
 	xor a
 	ld [wc717], a
-	call CountEnemyAliveMons
+	call CheckEnemyHasMonToSwitchTo
 	ret c
 
 	ld a, [EnemySubStatus1]
@@ -197,7 +197,7 @@
 
 	; Perish count is 1
 
-	call CountEnemyAliveMons
+	call CheckEnemyHasMonToSwitchTo
 	call Function34b77
 	call Function34b20
 	call Function34a85
@@ -212,7 +212,7 @@
 	ret
 
 .not_2
-	call CountEnemyAliveMons
+	call CheckEnemyHasMonToSwitchTo
 	sla c
 	sla c
 	ld b, $ff
@@ -284,7 +284,7 @@
 	cp 10
 	ret nc
 
-	call CountEnemyAliveMons
+	call CheckEnemyHasMonToSwitchTo
 	call Function34b77
 	call Function34b20
 	call Function34a85
@@ -300,7 +300,7 @@
 ; 349f4
 
 
-CountEnemyAliveMons: ; 349f4
+CheckEnemyHasMonToSwitchTo: ; 349f4
 	ld a, [OTPartyCount]
 	cp 2
 	jr c, .only_one
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -92,7 +92,7 @@
 	call SendOutPkmnText
 	call NewBattleMonStatus
 	call BreakAttraction
-	call Function3db5f
+	call SendOutPlayerMon
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	call SetPlayerTurn
@@ -2928,7 +2928,7 @@
 	call SendOutPkmnText
 	call NewBattleMonStatus
 	call BreakAttraction
-	call Function3db5f
+	call SendOutPlayerMon
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	call SetPlayerTurn
@@ -2950,7 +2950,7 @@
 	call SendOutPkmnText
 	call NewBattleMonStatus
 	call BreakAttraction
-	call Function3db5f
+	call SendOutPlayerMon
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	call SetPlayerTurn
@@ -3755,31 +3755,31 @@
 	call Call_PlayBattleAnim
 
 	call BattleCheckEnemyShininess
-	jr nc, .asm_3d800
+	jr nc, .not_shiny
 	ld a, 1 ; shiny anim
 	ld [wKickCounter], a
 	ld de, ANIM_SEND_OUT_MON
 	call Call_PlayBattleAnim
-.asm_3d800
+.not_shiny
 
 	ld bc, TempMonSpecies
-	callba Function4e53f
-	jr c, .asm_3d82c
+	callba CheckFaintedFrzSlp
+	jr c, .skip_cry
 	callba CheckBattleScene
-	jr c, .asm_3d821
+	jr c, .cry_no_anim
 	hlcoord 12, 0
 	ld d, $0
-	ld e, $0
-	predef Functiond008e
-	jr .asm_3d82c
+	ld e, ANIM_MON_SLOW
+	predef AnimateFrontpic
+	jr .skip_cry
 
-.asm_3d821
+.cry_no_anim
 	ld a, $f
 	ld [CryTracks], a
 	ld a, [TempEnemyMonSpecies]
 	call PlayStereoCry
 
-.asm_3d82c
+.skip_cry
 	call UpdateEnemyHUD
 	ld a, $1
 	ld [hBGMapMode], a
@@ -4207,7 +4207,7 @@
 ; 3db32
 
 
-Function3db32: ; 3db32
+SwitchPlayerMon: ; 3db32
 	call ClearSprites
 	ld a, [CurBattleMon]
 	ld [LastPlayerMon], a
@@ -4218,7 +4218,7 @@
 	call ResetPlayerStatLevels
 	call NewBattleMonStatus
 	call BreakAttraction
-	call Function3db5f
+	call SendOutPlayerMon
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	ld hl, EnemyMonHP
@@ -4228,7 +4228,7 @@
 ; 3db5f
 
 
-Function3db5f: ; 3db5f
+SendOutPlayerMon: ; 3db5f
 	ld hl, BattleMonDVs
 	predef GetUnownLetter
 	hlcoord 1, 5
@@ -4259,25 +4259,25 @@
 	ld de, ANIM_SEND_OUT_MON
 	call Call_PlayBattleAnim
 	call BattleCheckPlayerShininess
-	jr nc, .asm_3dbbc
+	jr nc, .not_shiny
 	ld a, $1
 	ld [wKickCounter], a
 	ld de, ANIM_SEND_OUT_MON
 	call Call_PlayBattleAnim
 
-.asm_3dbbc
+.not_shiny
 	ld a, MON_SPECIES
 	call GetPartyParamLocation
 	ld b, h
 	ld c, l
-	callba Function4e53f
-	jr c, .asm_3dbd6
+	callba CheckFaintedFrzSlp
+	jr c, .statused
 	ld a, $f0
 	ld [CryTracks], a
 	ld a, [CurPartySpecies]
 	call PlayStereoCry
 
-.asm_3dbd6
+.statused
 	call UpdatePlayerHUD
 	ld a, $1
 	ld [hBGMapMode], a
@@ -5528,7 +5528,7 @@
 	call SendOutPkmnText
 	call NewBattleMonStatus
 	call BreakAttraction
-	call Function3db5f
+	call SendOutPlayerMon
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	call SetPlayerTurn
@@ -5553,7 +5553,7 @@
 	xor a
 	ld [wd265], a
 	call ApplyStatLevelMultiplierOnAllStats
-	call Function3db5f
+	call SendOutPlayerMon
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	call SetPlayerTurn
@@ -9556,15 +9556,15 @@
 	jr c, .skip_cry
 
 	callba CheckBattleScene
-	jr c, .do_cry
+	jr c, .cry_no_anim
 
 	hlcoord 12, 0
 	ld d, $0
-	ld e, $1
-	predef Functiond008e
+	ld e, ANIM_MON_NORMAL
+	predef AnimateFrontpic
 	jr .skip_cry
 
-.do_cry
+.cry_no_anim
 	ld a, $0f
 	ld [CryTracks], a
 	ld a, [TempEnemyMonSpecies]
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -6555,41 +6555,42 @@
 
 	ld a, [BattleType]
 	cp BATTLETYPE_SHINY
-	jp z, .asm_36969
+	jp z, .fail
 	cp BATTLETYPE_TRAP
-	jp z, .asm_36969
+	jp z, .fail
 	cp BATTLETYPE_CELEBI
-	jp z, .asm_36969
+	jp z, .fail
 	cp BATTLETYPE_SUICUNE
-	jp z, .asm_36969
+	jp z, .fail
 	ld a, [hBattleTurn]
 	and a
-	jp nz, .asm_368cd
+	jp nz, .force_player_switch
 	ld a, [AttackMissed]
 	and a
-	jr nz, .asm_36852 ; 36830 $20
+	jr nz, .missed ; 36830 $20
 	ld a, [wBattleMode]
 	dec a
-	jr nz, .asm_36869 ; 36836 $31
+	jr nz, .trainer ; 36836 $31
 	ld a, [CurPartyLevel]
 	ld b, a
 	ld a, [BattleMonLevel]
 	cp b
-	jr nc, .asm_36855 ; 36840 $13
+	jr nc, .wild_force_flee ; 36840 $13
 	add b
 	ld c, a
 	inc c
-.asm_36845
+.random_loop_wild
 	call BattleRandom
 	cp c
-	jr nc, .asm_36845 ; 36849 $fa
+	jr nc, .random_loop_wild ; 36849 $fa
 	srl b
 	srl b
 	cp b
-	jr nc, .asm_36855 ; 36850 $3
-.asm_36852
-	jp .asm_36969
-.asm_36855
+	jr nc, .wild_force_flee ; 36850 $3
+.missed
+	jp .fail
+
+.wild_force_flee
 	call UpdateBattleMonInParty
 	xor a
 	ld [wcfca], a
@@ -6597,13 +6598,14 @@
 	ld [wd232], a
 	call SetBattleDraw
 	ld a, [wPlayerMoveStruct + MOVE_ANIM]
-	jp .asm_36975
-.asm_36869
-	call CountEnemyAliveMons
-	jr c, .asm_368ca ; 3686c $5c
+	jp .succeed
+
+.trainer
+	call CheckEnemyHasMonToSwitchTo
+	jr c, .switch_fail ; 3686c $5c
 	ld a, [wc70f]
 	and a
-	jr z, .asm_368ca ; 36872 $56
+	jr z, .switch_fail ; 36872 $56
 	call UpdateEnemyMonInParty
 	ld a, $1
 	ld [wKickCounter], a
@@ -6613,19 +6615,20 @@
 	hlcoord 1, 0
 	lb bc, 4, 10
 	call ClearBox
-	ld c, $14
+	ld c, 20
 	call DelayFrames
 	ld a, [OTPartyCount]
 	ld b, a
 	ld a, [CurOTMon]
 	ld c, a
-.asm_3689a
+; select a random enemy mon to switch to
+.random_loop_trainer
 	call BattleRandom
 	and $7
 	cp b
-	jr nc, .asm_3689a ; 368a0 $f8
+	jr nc, .random_loop_trainer ; 368a0 $f8
 	cp c
-	jr z, .asm_3689a ; 368a3 $f5
+	jr z, .random_loop_trainer ; 368a3 $f5
 	push af
 	push bc
 	ld hl, OTPartyMon1HP
@@ -6634,7 +6637,7 @@
 	or [hl]
 	pop bc
 	pop de
-	jr z, .asm_3689a ; 368b1 $e7
+	jr z, .random_loop_trainer ; 368b1 $e7
 	ld a, d
 	inc a
 	ld [wc718], a
@@ -6646,41 +6649,41 @@
 	ld hl, SpikesDamage
 	jp CallBattleCore
 
-.asm_368ca
-	jp .asm_36969
+.switch_fail
+	jp .fail
 
-.asm_368cd
+.force_player_switch
 	ld a, [AttackMissed]
 	and a
-	jr nz, .asm_368f3
+	jr nz, .player_miss
 
 	ld a, [wBattleMode]
 	dec a
-	jr nz, .asm_36908
+	jr nz, .vs_trainer
 
 	ld a, [BattleMonLevel]
 	ld b, a
 	ld a, [CurPartyLevel]
 	cp b
-	jr nc, .asm_368f5
+	jr nc, .wild_succeed_playeristarget
 
 	add b
 	ld c, a
 	inc c
-.asm_368e6
+.wild_random_loop_playeristarget
 	call BattleRandom
 	cp c
-	jr nc, .asm_368e6
+	jr nc, .wild_random_loop_playeristarget
 
 	srl b
 	srl b
 	cp b
-	jr nc, .asm_368f5
+	jr nc, .wild_succeed_playeristarget
 
-.asm_368f3
-	jr .asm_36969
+.player_miss
+	jr .fail
 
-.asm_368f5
+.wild_succeed_playeristarget
 	call UpdateBattleMonInParty
 	xor a
 	ld [wcfca], a
@@ -6688,39 +6691,39 @@
 	ld [wd232], a
 	call SetBattleDraw
 	ld a, [wEnemyMoveStruct + MOVE_ANIM]
-	jr .asm_36975
+	jr .succeed
 
-.asm_36908
-	call Function36994
-	jr c, .asm_36969
+.vs_trainer
+	call CheckPlayerHasMonToSwitchTo
+	jr c, .fail
 
 	ld a, [wc70f]
 	cp $1
-	jr z, .asm_368ca
+	jr z, .switch_fail
 
 	call UpdateBattleMonInParty
 	ld a, $1
 	ld [wKickCounter], a
 	call AnimateCurrentMove
-	ld c, $14
+	ld c, 20
 	call DelayFrames
 	hlcoord 9, 7
 	lb bc, 5, 11
 	call ClearBox
-	ld c, $14
+	ld c, 20
 	call DelayFrames
 	ld a, [PartyCount]
 	ld b, a
 	ld a, [CurBattleMon]
 	ld c, a
-.asm_3693a
+.random_loop_trainer_playeristarget
 	call BattleRandom
 	and $7
 	cp b
-	jr nc, .asm_3693a
+	jr nc, .random_loop_trainer_playeristarget
 
 	cp c
-	jr z, .asm_3693a
+	jr z, .random_loop_trainer_playeristarget
 
 	push af
 	push bc
@@ -6730,11 +6733,11 @@
 	or [hl]
 	pop bc
 	pop de
-	jr z, .asm_3693a
+	jr z, .random_loop_trainer_playeristarget
 
 	ld a, d
 	ld [CurPartyMon], a
-	ld hl, Function3db32
+	ld hl, SwitchPlayerMon
 	call CallBattleCore
 
 	ld hl, DraggedOutText
@@ -6743,40 +6746,40 @@
 	ld hl, SpikesDamage
 	jp CallBattleCore
 
-.asm_36969
+.fail
 	call BattleCommand_LowerSub
 	call BattleCommand_MoveDelay
 	call BattleCommand_RaiseSub
 	jp PrintButItFailed
 
-.asm_36975
+.succeed
 	push af
 	call SetBattleDraw
 	ld a, $1
 	ld [wKickCounter], a
 	call AnimateCurrentMove
-	ld c, $14
+	ld c, 20
 	call DelayFrames
 	pop af
 
 	ld hl, FledInFearText
-	cp $2e
-	jr z, .asm_36991
+	cp ROAR
+	jr z, .do_text
 	ld hl, BlownAwayText
-.asm_36991
+.do_text
 	jp StdBattleTextBox
 ; 36994
 
 
-Function36994: ; 36994
+CheckPlayerHasMonToSwitchTo: ; 36994
 	ld a, [PartyCount]
 	ld d, a
 	ld e, 0
 	ld bc, PARTYMON_STRUCT_LENGTH
-.asm_3699d
+.loop
 	ld a, [CurBattleMon]
 	cp e
-	jr z, .asm_369ae
+	jr z, .next
 
 	ld a, e
 	ld hl, PartyMon1HP
@@ -6783,17 +6786,17 @@
 	call AddNTimes
 	ld a, [hli]
 	or [hl]
-	jr nz, .asm_369b4
+	jr nz, .not_fainted
 
-.asm_369ae
+.next
 	inc e
 	dec d
-	jr nz, .asm_3699d
+	jr nz, .loop
 
 	scf
 	ret
 
-.asm_369b4
+.not_fainted
 	and a
 	ret
 ; 369b6
--- a/constants/animation_constants.asm
+++ b/constants/animation_constants.asm
@@ -60,3 +60,14 @@
 
 ANIM_BG_VIBRATE_MON EQU $33
 ANIM_BG_WOBBLE_MON EQU $34
+
+	const_def
+	const ANIM_MON_SLOW    ; 0
+	const ANIM_MON_NORMAL  ; 1
+	const ANIM_MON_MENU    ; 2
+	const ANIM_MON_TRADE   ; 3
+	const ANIM_MON_EVOLVE  ; 4
+	const ANIM_MON_HATCH   ; 5
+	const ANIM_MON_UNUSED  ; 6
+	const ANIM_MON_EGG1    ; 7
+	const ANIM_MON_EGG2    ; 8
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -98,10 +98,10 @@
 	add_predef CheckTypeMatchup
 	add_predef ConvertMon_1to2
 	add_predef Functionfb877
-	add_predef Functiond0000
+	add_predef AnimateMon_Slow_Normal
 	add_predef PlaceStatusString
-	add_predef Functiond00a3
-	add_predef Functiond008e
+	add_predef LoadMonAnimation
+	add_predef AnimateFrontpic
 	add_predef Functiond0669 ; $48
 	add_predef Functiond066e
 	dbw $ff, Function2d43 ; ????
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -1,55 +1,55 @@
 ; Pic animation arrangement.
 
 
-Functiond0000: ; d0000
+AnimateMon_Slow_Normal: ; d0000
 	hlcoord 12, 0
 	ld a, [wBattleMode]
-	cp $1
-	jr z, .asm_d0012
-	ld e, $0
+	cp WILD_BATTLE
+	jr z, .wild
+	ld e, ANIM_MON_SLOW
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 
-.asm_d0012
-	ld e, $1
+.wild
+	ld e, ANIM_MON_NORMAL
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 ; d001a
 
-Functiond001a: ; d001a
-	ld e, $2
+AnimateMon_Menu: ; d001a
+	ld e, ANIM_MON_MENU
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 ; d0022
 
-Functiond0022: ; d0022
-	ld e, $3
+AnimateMon_Trade: ; d0022
+	ld e, ANIM_MON_TRADE
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 ; d002a
 
-Functiond002a: ; d002a
-	ld e, $4
+AnimateMon_Evolve: ; d002a
+	ld e, ANIM_MON_EVOLVE
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 ; d0032
 
-Functiond0032: ; d0032
-	ld e, $5
+AnimateMon_Hatch: ; d0032
+	ld e, ANIM_MON_HATCH
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 ; d003a
 
-Functiond003a: ; d003a
-	ld e, $6
+AnimateMon_Unused: ; d003a
+	ld e, ANIM_MON_UNUSED
 	ld d, $0
-	call Functiond008e
+	call AnimateFrontpic
 	ret
 ; d0042
 
@@ -81,31 +81,31 @@
 	dw .Egg1
 	dw .Egg2
 
-.Slow:   POKEANIM Cry3, Setup2, Play
-.Normal: POKEANIM Cry3, Setup, Play
-.Menu:   POKEANIM Cry2, Setup, Play, SetWait, Wait, Extra, Play
+.Slow:   POKEANIM StereoCry, Setup2, Play
+.Normal: POKEANIM StereoCry, Setup, Play
+.Menu:   POKEANIM CryNoWait, Setup, Play, SetWait, Wait, Extra, Play
 .Trade:  POKEANIM Extra, Play2, Extra, Play, SetWait, Wait, Cry, Setup, Play
-.Evolve: POKEANIM Extra, Play, SetWait, Wait, Cry2, Setup, Play
-.Hatch:  POKEANIM Extra, Play, Cry2, Setup, Play, SetWait, Wait, Extra, Play
-.Unused: POKEANIM Cry2, Setup, Play, SetWait, Wait, Extra, Play
+.Evolve: POKEANIM Extra, Play, SetWait, Wait, CryNoWait, Setup, Play
+.Hatch:  POKEANIM Extra, Play, CryNoWait, Setup, Play, SetWait, Wait, Extra, Play
+.Unused: POKEANIM CryNoWait, Setup, Play, SetWait, Wait, Extra, Play
 .Egg1:   POKEANIM Setup, Play
 .Egg2:   POKEANIM Extra, Play
 
 
-Functiond008e: ; d008e
-	call Functiond01c6
+AnimateFrontpic: ; d008e
+	call AnimateMon_CheckIfPokemon
 	ret c
-	call Functiond00a3
-.asm_d0095
+	call LoadMonAnimation
+.loop
 	call Functiond00b4
 	push af
 	callba Function10402d
 	pop af
-	jr nc, .asm_d0095
+	jr nc, .loop
 	ret
 ; d00a3
 
-Functiond00a3: ; d00a3
+LoadMonAnimation: ; d00a3
 	push hl
 	ld c, e
 	ld b, 0
@@ -126,10 +126,10 @@
 	push af
 	ld a, $2
 	ld [rSVBK], a
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	ld c, a
 	ld b, 0
-	ld hl, w2_d169
+	ld hl, wPokeAnimPointer
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
@@ -137,7 +137,7 @@
 	ld a, [hl]
 	ld hl, PokeAnim_SetupCommands
 	rst JumpTable
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	ld c, a
 	pop af
 	ld [rSVBK], a
@@ -162,24 +162,24 @@
 	setup_command PokeAnim_Play
 	setup_command PokeAnim_Play2
 	setup_command PokeAnim_Cry
-	setup_command PokeAnim_Cry2
-	setup_command PokeAnim_Cry3
+	setup_command PokeAnim_CryNoWait
+	setup_command PokeAnim_StereoCry
 ; d00f2
 
 PokeAnim_SetWait: ; d00f2
-	ld a, $12
-	ld [w2_d181], a
-	ld a, [w2_d168]
+	ld a, 18
+	ld [wPokeAnimWaitCounter], a
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 
 PokeAnim_Wait: ; d00fe
-	ld hl, w2_d181
+	ld hl, wPokeAnimWaitCounter
 	dec [hl]
 	ret nz
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d010b
 
@@ -188,9 +188,9 @@
 	ld b, $0
 	call Functiond0228
 	call Functiond0504
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d011d
 
@@ -199,9 +199,9 @@
 	ld b, $4
 	call Functiond0228
 	call Functiond0504
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d012f
 
@@ -210,9 +210,9 @@
 	ld b, $0
 	call Functiond0228
 	call Functiond0504
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d0141
 
@@ -222,9 +222,9 @@
 	bit 7, a
 	ret z
 	call Functiond04bd
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d0155
 
@@ -233,53 +233,53 @@
 	ld a, [w2_d17e]
 	bit 7, a
 	ret z
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d0166
 
 PokeAnim_Nop: ; d0166
 	call Functiond01a9
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d0171
 
 PokeAnim_Finish: ; d0171
 	call Functiond01a9
-	ld hl, w2_d168
+	ld hl, wPokeAnimSceneIndex
 	set 7, [hl]
 	ret
 ; d017a
 
 PokeAnim_Cry: ; d017a
-	ld a, [w2_d16b]
+	ld a, [wPokeAnimSpecies]
 	call _PlayCry
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d0188
 
-PokeAnim_Cry2: ; d0188
-	ld a, [w2_d16b]
+PokeAnim_CryNoWait: ; d0188
+	ld a, [wPokeAnimSpecies]
 	call PlayCry2
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d0196
 
-PokeAnim_Cry3: ; d0196
+PokeAnim_StereoCry: ; d0196
 	ld a, $f
 	ld [CryTracks], a
-	ld a, [w2_d16b]
+	ld a, [wPokeAnimSpecies]
 	call PlayStereoCry2
-	ld a, [w2_d168]
+	ld a, [wPokeAnimSceneIndex]
 	inc a
-	ld [w2_d168], a
+	ld [wPokeAnimSceneIndex], a
 	ret
 ; d01a9
 
@@ -297,16 +297,16 @@
 	ret
 ; d01c6
 
-Functiond01c6: ; d01c6
+AnimateMon_CheckIfPokemon: ; d01c6
 	ld a, [CurPartySpecies]
 	cp EGG
-	jr z, .asm_d01d4
+	jr z, .fail
 	call IsAPokemon
-	jr c, .asm_d01d4
+	jr c, .fail
 	and a
 	ret
 
-.asm_d01d4
+.fail
 	scf
 	ret
 ; d01d6
@@ -316,39 +316,44 @@
 	push af
 	ld a, $2
 	ld [rSVBK], a
+
 	push bc
 	push de
 	push hl
-	ld hl, w2_d168
-	ld bc, $0029
+	ld hl, wPokeAnimSceneIndex
+	ld bc, wPokeAnimStructEnd - wPokeAnimSceneIndex
 	xor a
 	call ByteFill
 	pop hl
 	pop de
 	pop bc
+
+; bc contains anim pointer
 	ld a, c
-	ld [w2_d169], a
+	ld [wPokeAnimPointer], a
 	ld a, b
-	ld [w2_d16a], a
+	ld [wPokeAnimPointer + 1], a
+; hl contains TileMap coords
 	ld a, l
-	ld [w2_d16f], a
+	ld [wPokeAnimCoord], a
 	ld a, h
-	ld [w2_d170], a
+	ld [wPokeAnimCoord + 1], a
+; d = ?????
 	ld a, d
 	ld [w2_d16e], a
 	ld a, $1
 	ld hl, CurPartySpecies
 	call GetFarWRAMByte
-	ld [w2_d16b], a
+	ld [wPokeAnimSpecies], a
 	ld a, $1
 	ld hl, UnownLetter
 	call GetFarWRAMByte
-	ld [w2_d16c], a
-	call Functiond065c
-	ld [w2_d16d], a
-	call Functiond05b4
+	ld [wPokeAnimUnownLetter], a
+	call PokeAnim_GetSpeciesOrUnown
+	ld [wPokeAnimSpeciesOrUnown], a
+	call PokeAnim_GetFrontpicDims
 	ld a, c
-	ld [w2_d171], a
+	ld [wPokeAnimFrontpicHeight], a
 	pop af
 	ld [rSVBK], a
 	ret
@@ -361,7 +366,7 @@
 	ld [rSVBK], a
 	push bc
 	ld hl, w2_d172
-	ld bc, $001f
+	ld bc, wPokeAnimStructEnd - w2_d172
 	xor a
 	call ByteFill
 	pop bc
@@ -406,13 +411,13 @@
 	call Functiond02c8
 	ld a, [w2_d183]
 	call Functiond02ae
-	ld [w2_d181], a
+	ld [wPokeAnimWaitCounter], a
 	call Functiond02dc
 
 Functiond0282: ; d0282
-	ld a, [w2_d181]
+	ld a, [wPokeAnimWaitCounter]
 	dec a
-	ld [w2_d181], a
+	ld [wPokeAnimWaitCounter], a
 	ret nz
 	call Functiond02e4
 	ret
@@ -487,14 +492,14 @@
 	ret
 ; d02ec
 
-Functiond02ec: ; d02ec
-	ld a, [w2_d16b]
+PokeAnim_IsUnown: ; d02ec
+	ld a, [wPokeAnimSpecies]
 	cp UNOWN
 	ret
 ; d02f2
 
-Functiond02f2: ; d02f2
-	ld a, [w2_d16b]
+PokeAnim_IsEgg: ; d02f2
+	ld a, [wPokeAnimSpecies]
 	cp EGG
 	ret
 ; d02f8
@@ -562,7 +567,7 @@
 
 Functiond0356: ; d0356
 	push hl
-	ld a, [w2_d171]
+	ld a, [wPokeAnimFrontpicHeight]
 	sub 5
 	ld c, a
 	ld b, 0
@@ -581,13 +586,13 @@
 	ld [w2_d187], a
 	ld [w2_d186], a
 	ld [w2_d185], a
-.asm_d0375
+.loop
 	push hl
 	call Functiond0392
 	pop hl
 	ld a, b
 	and a
-	jr z, .asm_d038a
+	jr z, .next
 
 	ld a, [w2_d177]
 	call GetFarByte
@@ -596,11 +601,11 @@
 	call Functiond03bd
 	pop hl
 
-.asm_d038a
+.next
 	push hl
 	call Functiond0499
 	pop hl
-	jr nc, .asm_d0375
+	jr nc, .loop
 	ret
 ; d0392
 
@@ -617,23 +622,23 @@
 	ld b, [hl]
 	ld a, [w2_d187]
 	and 7
-	jr z, .asm_d03b0
+	jr z, .skip
 
 	ld c, a
 	ld a, b
-.asm_d03ab
+.loop
 	rrca
 	dec c
-	jr nz, .asm_d03ab
+	jr nz, .loop
 	ld b, a
 
-.asm_d03b0
+.skip
 	xor a
 	bit 0, b
-	jr z, .asm_d03b7
+	jr z, .finish
 	ld a, 1
 
-.asm_d03b7
+.finish
 	ld b, a
 	ld hl, w2_d187
 	inc [hl]
@@ -656,18 +661,18 @@
 Functiond03cd: ; d03cd
 	call Functiond046c
 	ld a, [w2_d186]
-	ld bc, $0014
+	ld bc, SCREEN_WIDTH
 	call AddNTimes
 	ld a, [wc2c6]
 	and a
-	jr nz, .asm_d03e8
+	jr nz, .go
 	ld a, [w2_d185]
 	ld e, a
 	ld d, 0
 	add hl, de
-	jr .asm_d03f3
+	jr .skip
 
-.asm_d03e8
+.go
 	ld a, [w2_d185]
 	ld e, a
 	ld a, l
@@ -677,7 +682,7 @@
 	sbc 0
 	ld h, a
 
-.asm_d03f3
+.skip
 	ret
 ; d03f4
 
@@ -685,18 +690,18 @@
 
 Functiond03f7: ; d03f7
 	push af
-	ld a, [w2_d171]
+	ld a, [wPokeAnimFrontpicHeight]
 	cp 5
-	jr z, .asm_d0405
+	jr z, .check_add_24
 	cp 6
-	jr z, .asm_d041a
+	jr z, .check_add_13
 	pop af
 	ret
 
-.asm_d0405
+.check_add_24
 	pop af
 	cp 5 * 5
-	jr nc, .asm_d0417
+	jr nc, .add_24
 	push hl
 	push de
 	ld hl, Unknown_d042f
@@ -708,14 +713,14 @@
 	pop hl
 	ret
 
-.asm_d0417
+.add_24
 	add 24
 	ret
 
-.asm_d041a
+.check_add_13
 	pop af
 	cp 6 * 6
-	jr nc, .asm_d042c
+	jr nc, .add_13
 	push hl
 	push de
 	ld hl, Unknown_d0448
@@ -727,7 +732,7 @@
 	pop hl
 	ret
 
-.asm_d042c
+.add_13
 	add 13
 	ret
 ; d042f
@@ -749,31 +754,31 @@
 
 
 Functiond046c: ; d046c
-	ld hl, w2_d16f
+	ld hl, wPokeAnimCoord
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
 
-	ld a, [w2_d171]
+	ld a, [wPokeAnimFrontpicHeight]
 	ld de, 0
 	ld bc, 6
 	cp 7
-	jr z, .asm_d048f
+	jr z, .okay
 	ld de, 21
 	ld bc, 25
 	cp 6
-	jr z, .asm_d048f
+	jr z, .okay
 	ld de, 41
 	ld bc, 45
-.asm_d048f
+.okay
 
 	ld a, [wc2c6]
 	and a
-	jr nz, .asm_d0497
+	jr nz, .add_bc
 	add hl, de
 	ret
 
-.asm_d0497
+.add_bc
 	add hl, bc
 	ret
 ; d0499
@@ -783,9 +788,9 @@
 	inc a
 	ld [w2_d186], a
 	ld c, a
-	ld a, [w2_d171]
+	ld a, [wPokeAnimFrontpicHeight]
 	cp c
-	jr nz, .asm_d04bb
+	jr nz, .no_carry
 	xor a
 	ld [w2_d186], a
 	ld a, [w2_d185]
@@ -792,13 +797,13 @@
 	inc a
 	ld [w2_d185], a
 	ld c, a
-	ld a, [w2_d171]
+	ld a, [wPokeAnimFrontpicHeight]
 	cp c
-	jr nz, .asm_d04bb
+	jr nz, .no_carry
 	scf
 	ret
 
-.asm_d04bb
+.no_carry
 	xor a
 	ret
 ; d04bd
@@ -807,17 +812,17 @@
 	call Functiond04f6
 	ld a, [wc2c6]
 	and a
-	jr nz, .asm_d04ce
+	jr nz, .minus_one_and_six
 	ld de, 1
 	ld bc, 0
-	jr .asm_d04d4
+	jr .okay
 
-.asm_d04ce
+.minus_one_and_six
 	ld de, -1
 	ld bc, 6
 
-.asm_d04d4
-	ld hl, w2_d16f
+.okay
+	ld hl, wPokeAnimCoord
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
@@ -825,28 +830,28 @@
 	ld c, 7
 	ld b, 7
 	ld a, [w2_d16e]
-.asm_d04e2
+.loop
 	push bc
 	push hl
 	push de
-	ld de, $0014
-.asm_d04e8
+	ld de, SCREEN_WIDTH
+.loop2
 	ld [hl], a
 	inc a
 	add hl, de
 	dec b
-	jr nz, .asm_d04e8
+	jr nz, .loop2
 	pop de
 	pop hl
 	add hl, de
 	pop bc
 	dec c
-	jr nz, .asm_d04e2
+	jr nz, .loop
 	ret
 ; d04f6
 
 Functiond04f6: ; d04f6
-	ld hl, w2_d16f
+	ld hl, wPokeAnimCoord
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
@@ -917,7 +922,7 @@
 ; d0551
 
 Functiond0551: ; d0551
-	ld hl, w2_d16f
+	ld hl, wPokeAnimCoord
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
@@ -927,18 +932,18 @@
 ; d055c
 
 Functiond055c: ; d055c
-	call Functiond02f2
+	call PokeAnim_IsEgg
 	jr z, .egg
 
 	ld c, BANK(UnownAnimations)
 	ld hl, UnownAnimationPointers
 	ld de, UnownAnimationExtraPointers
-	call Functiond02ec
-	jr z, .asm_d0576
+	call PokeAnim_IsUnown
+	jr z, .unown
 	ld c, BANK(PicAnimations)
 	ld hl, AnimationPointers
 	ld de, AnimationExtraPointers
-.asm_d0576
+.unown
 
 	ld a, [w2_d172]
 	and a
@@ -947,7 +952,7 @@
 	ld l, e
 .asm_d057e
 
-	ld a, [w2_d16d]
+	ld a, [wPokeAnimSpeciesOrUnown]
 	dec a
 	ld e, a
 	ld d, 0
@@ -982,7 +987,7 @@
 	ret
 ; d05b4
 
-Functiond05b4: ; d05b4
+PokeAnim_GetFrontpicDims: ; d05b4
 	ld a, [rSVBK]
 	push af
 	ld a, $1
@@ -999,26 +1004,26 @@
 ; d05ce
 
 Functiond05ce: ; d05ce
-	call Functiond02f2
+	call PokeAnim_IsEgg
 	jr z, .egg
 
-	call Functiond02ec
+	call PokeAnim_IsUnown
 	ld b, BANK(UnownFramesPointers)
 	ld c, BANK(UnownsFrames)
 	ld hl, UnownFramesPointers
-	jr z, .asm_d05ef
-	ld a, [w2_d16b]
+	jr z, .got_frames
+	ld a, [wPokeAnimSpecies]
 	cp 151 + 1
 	ld b, BANK(FramesPointers)
 	ld c, BANK(KantoFrames)
 	ld hl, FramesPointers
-	jr c, .asm_d05ef
+	jr c, .got_frames
 	ld c, BANK(JohtoFrames)
-.asm_d05ef
+.got_frames
 	ld a, c
 	ld [w2_d177], a
 
-	ld a, [w2_d16d]
+	ld a, [wPokeAnimSpeciesOrUnown]
 	dec a
 	ld e, a
 	ld d, 0
@@ -1046,19 +1051,19 @@
 ; d061b
 
 Functiond061b: ; d061b
-	call Functiond02f2
+	call PokeAnim_IsEgg
 	jr z, .egg
 
-	call Functiond02ec
+	call PokeAnim_IsUnown
 	ld a, BANK(UnownBitmasksPointers)
 	ld hl, UnownBitmasksPointers
-	jr z, .asm_d062f
+	jr z, .unown
 	ld a, BANK(BitmasksPointers)
 	ld hl, BitmasksPointers
-.asm_d062f
+.unown
 	ld [w2_d17a], a
 
-	ld a, [w2_d16d]
+	ld a, [wPokeAnimSpeciesOrUnown]
 	dec a
 	ld e, a
 	ld d, 0
@@ -1085,14 +1090,14 @@
 	ret
 ; d065c
 
-Functiond065c: ; d065c
-	call Functiond02ec
-	jr z, .asm_d0665
-	ld a, [w2_d16b]
+PokeAnim_GetSpeciesOrUnown: ; d065c
+	call PokeAnim_IsUnown
+	jr z, .unown
+	ld a, [wPokeAnimSpecies]
 	ret
 
-.asm_d0665
-	ld a, [w2_d16c]
+.unown
+	ld a, [wPokeAnimUnownLetter]
 	ret
 ; d0669
 
@@ -1101,7 +1106,7 @@
 	ld [wc2c6], a
 
 Functiond066e: ; d066e
-	call Functiond01c6
+	call AnimateMon_CheckIfPokemon
 	jr c, .asm_d068c
 	ld h, d
 	ld l, e
@@ -1113,7 +1118,7 @@
 	pop bc
 	ld d, 0
 	ld e, c
-	call Functiond008e
+	call AnimateFrontpic
 	xor a
 	ld [wc2c6], a
 	ret
--- a/home.asm
+++ b/home.asm
@@ -217,10 +217,10 @@
 ; Load TileMap into TempTileMap
 	ld a, [rSVBK]
 	push af
-	ld a, BANK(w2_d000)
+	ld a, BANK(TempTileMap)
 	ld [rSVBK], a
 	hlcoord 0, 0
-	ld de, w2_d000
+	decoord 0, 0, TempTileMap
 	ld bc, TileMapEnd - TileMap
 	call CopyBytes
 	pop af
@@ -241,9 +241,9 @@
 ; Load TempTileMap into TileMap
 	ld a, [rSVBK]
 	push af
-	ld a, BANK(w2_d000)
+	ld a, BANK(TempTileMap)
 	ld [rSVBK], a
-	ld hl, w2_d000
+	hlcoord 0, 0, TempTileMap
 	decoord 0, 0
 	ld bc, TileMapEnd - TileMap
 	call CopyBytes
--- a/main.asm
+++ b/main.asm
@@ -20039,8 +20039,8 @@
 	ld [CurPartySpecies], a
 	hlcoord 6, 3
 	ld d, $0
-	ld e, $5
-	predef Functiond008e
+	ld e, ANIM_MON_HATCH
+	predef AnimateFrontpic
 	pop af
 	ld [CurSpecies], a
 	ret
@@ -41215,8 +41215,8 @@
 	ld [CurPartySpecies], a
 	hlcoord 7, 2
 	ld d, $0
-	ld e, $3
-	predef Functiond008e
+	ld e, ANIM_MON_TRADE
+	predef AnimateFrontpic
 	ret
 ; 4d860
 
@@ -42738,7 +42738,7 @@
 	hlcoord 0, 0
 	ld d, $0
 	ld e, $2
-	predef Functiond00a3
+	predef LoadMonAnimation
 	ld hl, wcf64
 	set 6, [hl]
 	ret
@@ -42793,7 +42793,7 @@
 	ld a, [CurPartySpecies]
 	cp EGG
 	jr z, .asm_4e2fe
-	call Function4e53f
+	call CheckFaintedFrzSlp
 	jr c, Function4e305
 .asm_4e2fe
 	xor a
@@ -42941,7 +42941,7 @@
 	pop de
 	hlcoord 0, 0
 	ld d, $0
-	predef Functiond00a3
+	predef LoadMonAnimation
 	ld hl, wcf64
 	set 6, [hl]
 	ret
@@ -43016,21 +43016,21 @@
 	jp SkipNames
 
 
-Function4e53f: ; 4e53f
+CheckFaintedFrzSlp: ; 4e53f
 	ld hl, MON_HP
 	add hl, bc
 	ld a, [hli]
 	or [hl]
-	jr z, .asm_4e552
+	jr z, .fainted_frz_slp
 	ld hl, MON_STATUS
 	add hl, bc
 	ld a, [hl]
 	and (1 << FRZ) | SLP
-	jr nz, .asm_4e552
+	jr nz, .fainted_frz_slp
 	and a
 	ret
 
-.asm_4e552
+.fainted_frz_slp
 	scf
 	ret
 ; 4e554
@@ -43248,8 +43248,8 @@
 	ld [CurPartySpecies], a
 	hlcoord 7, 2
 	ld d, $0
-	ld e, $4
-	predef Functiond008e
+	ld e, ANIM_MON_EVOLVE
+	predef AnimateFrontpic
 
 	pop af
 	ld [CurPartySpecies], a
@@ -43393,7 +43393,7 @@
 	call GetPartyLocation
 	ld b, h
 	ld c, l
-	callba Function4e53f
+	callba CheckFaintedFrzSlp
 	ret
 ; 4e7a6
 
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -284,8 +284,8 @@
 	ld [CurPartySpecies], a
 	hlcoord 7, 2
 	ld d, $0
-	ld e, $3
-	predef Functiond008e
+	ld e, ANIM_MON_TRADE
+	predef AnimateFrontpic
 	ret
 ; 108229
 
@@ -293,8 +293,8 @@
 	ld [CurPartySpecies], a
 	hlcoord 7, 2
 	ld d, $0
-	ld e, $3
-	predef Functiond00a3
+	ld e, ANIM_MON_TRADE
+	predef LoadMonAnimation
 	ret
 ; 108239
 
@@ -304,7 +304,7 @@
 	call GetPokemonName
 	ld hl, StringBuffer1
 	pop de
-	ld bc, $000b
+	ld bc, PKMN_NAME_LENGTH
 	call CopyBytes
 	ret
 ; 10824b
--- a/wram.asm
+++ b/wram.asm
@@ -2648,20 +2648,19 @@
 
 SECTION "Pic Animations", WRAMX, BANK [2]
 
-w2_d000::
+TempTileMap::
 ; 20x18 grid of 8x8 tiles
 	ds SCREEN_WIDTH * SCREEN_HEIGHT ; $168 = 360
-
-w2_d168:: ds 1
-w2_d169:: ds 1
-w2_d16a:: ds 1
-w2_d16b:: ds 1
-w2_d16c:: ds 1
-w2_d16d:: ds 1
+; PokeAnim Header
+wPokeAnimSceneIndex:: ds 1
+wPokeAnimPointer:: ds 2
+wPokeAnimSpecies:: ds 1
+wPokeAnimUnownLetter:: ds 1
+wPokeAnimSpeciesOrUnown:: ds 1
 w2_d16e:: ds 1
-w2_d16f:: ds 1
-w2_d170:: ds 1
-w2_d171:: ds 1
+wPokeAnimCoord:: ds 2
+wPokeAnimFrontpicHeight:: ds 1
+; PokeAnim Data
 w2_d172:: ds 1
 w2_d173:: ds 1
 w2_d174:: ds 1
@@ -2677,7 +2676,7 @@
 w2_d17e:: ds 1
 w2_d17f:: ds 1
 w2_d180:: ds 1
-w2_d181:: ds 1
+wPokeAnimWaitCounter:: ds 1
 w2_d182:: ds 1
 w2_d183:: ds 1
 w2_d184:: ds 1
@@ -2685,6 +2684,8 @@
 w2_d186:: ds 1
 w2_d187:: ds 1
 w2_d188:: ds 1
+	ds 8
+wPokeAnimStructEnd::
 
 
 SECTION "WRAM 3", WRAMX, BANK [3]