shithub: pokered

Download patch

ref: e6185ac358b2e548536485781d6ec584c0b7742d
parent: c73b5d73f477da2c0a916e683562e0941c5ff1eb
author: xCrystal <rgr.crystal@gmail.com>
date: Tue Mar 31 17:09:43 EDT 2015

Label some attack animation functions

--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -446,7 +446,7 @@
 	ret
 
 Func_78dbd: ; 78dbd (1e:4dbd)
-	ld a,[wcc5b]
+	ld a,[wAnimationType]
 	and a
 	ret z
 	dec a
@@ -469,12 +469,12 @@
 	dw Func_78dfe
 
 Func_78ddb: ; 78ddb (1e:4ddb)
-	call Func_79e6a
+	call PlayApplyingAttackSound
 	ld b, $8
 	jp Func_79209
 
 Func_78de3: ; 78de3 (1e:4de3)
-	call Func_79e6a
+	call PlayApplyingAttackSound
 	ld b, $8
 	jp Func_79210
 
@@ -483,11 +483,11 @@
 	jr Func_78e01
 
 Func_78df0: ; 78df0 (1e:4df0)
-	call Func_79e6a
+	call PlayApplyingAttackSound
 	jp AnimationBlinkEnemyMon
 
 Func_78df6: ; 78df6 (1e:4df6)
-	call Func_79e6a
+	call PlayApplyingAttackSound
 	ld b, $2
 	jp Func_79210
 
@@ -2929,7 +2929,9 @@
 	ld [W_ANIMATIONID],a
 	jp PlayAnimation
 
-Func_79e6a: ; 79e6a (1e:5e6a)
+PlayApplyingAttackSound: ; 79e6a (1e:5e6a)
+; play a different sound depending if move is not very effective, neutral, or super-effective
+; don't play any sound at all if move is ineffective
 	call WaitForSoundToFinish
 	ld a, [wDamageMultipliers]
 	and $7f
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -582,7 +582,7 @@
 .poisoned
 	call PrintText
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a,BURN_PSN_ANIM
 	call PlayMoveAnimation   ; play burn/poison animation
 	pop hl
@@ -603,7 +603,7 @@
 	xor $1
 	ld [H_WHOSETURN], a
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a,ABSORB
 	call PlayMoveAnimation ; play leech seed animation (from opposing mon)
 	pop af
@@ -3219,7 +3219,7 @@
 	ld b,BANK(Func_79747)
 	call nz,Bankswitch
 	pop af
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld a,[W_PLAYERMOVENUM]
 	call PlayMoveAnimation
 	call HandleExplodingAnimation
@@ -3241,7 +3241,7 @@
 	jr MirrorMoveCheck
 .playAnim
 	xor a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld a,STATUS_AFFECTED_ANIM
 	call PlayMoveAnimation
 MirrorMoveCheck
@@ -3386,7 +3386,7 @@
 	jr z,.WakeUp ; if the number of turns hit 0, wake up
 ; fast asleep
 	xor a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld a,SLP_ANIM - 1
 	call PlayMoveAnimation
 	ld hl,FastAsleepText
@@ -3470,7 +3470,7 @@
 	ld hl,IsConfusedText
 	call PrintText
 	xor a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld a,CONF_ANIM - 1
 	call PlayMoveAnimation
 	call BattleRandom
@@ -3519,7 +3519,7 @@
 
 .FlyOrChargeEffect
 	xor a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld a,STATUS_AFFECTED_ANIM
 	call PlayMoveAnimation
 .NotFlyOrChargeEffect
@@ -3751,7 +3751,7 @@
 	pop af
 	ld [hl], a
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	inc a
 	ld [H_WHOSETURN], a
 	call PlayMoveAnimation
@@ -5198,7 +5198,7 @@
 ; function that picks a random move for metronome
 MetronomePickMove: ; 3e348 (f:6348)
 	xor a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld a,METRONOME
 	call PlayMoveAnimation ; play Metronome's animation
 ; values for player turn
@@ -5754,7 +5754,7 @@
 	ld b, BANK(Func_79747)
 	call nz, Bankswitch
 	pop af
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a, [W_ENEMYMOVENUM]
 	call PlayMoveAnimation
 	call HandleExplodingAnimation
@@ -5778,7 +5778,7 @@
 	jr asm_3e7ef
 .asm_3e7e6
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a,STATUS_AFFECTED_ANIM
 	call PlayMoveAnimation
 asm_3e7ef: ; 3e7ef (f:67ef)
@@ -5870,7 +5870,7 @@
 	ld hl, FastAsleepText
 	call PrintText
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a,SLP_ANIM
 	call PlayMoveAnimation
 	jr .next1
@@ -5946,7 +5946,7 @@
 	ld hl, IsConfusedText
 	call PrintText
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a,CONF_ANIM
 	call PlayMoveAnimation
 	call BattleRandom
@@ -5989,7 +5989,7 @@
 	pop af
 	ld [hl], a
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld [H_WHOSETURN], a
 	ld a, POUND
 	call PlayMoveAnimation
@@ -6030,7 +6030,7 @@
 	jr .notFlyOrChargeEffect
 .flyOrChargeEffect
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a, STATUS_AFFECTED_ANIM
 	call PlayMoveAnimation
 .notFlyOrChargeEffect
@@ -6803,7 +6803,7 @@
 	and a
 	ret nz
 	ld a, 5
-	ld [wcc5b], a
+	ld [wAnimationType], a
 
 PlayMoveAnimation: ; 3ef07 (f:6f07)
 	ld [W_ANIMATIONID],a
@@ -7239,7 +7239,7 @@
 	and $7
 	jr z, .setSleepCounter
 	ld [de], a
-	call Func_3fb89
+	call StoreCurrentMoveAnimationIDAndType
 	ld hl, FellAsleepText
 	jp PrintText
 .didntAffect
@@ -7325,10 +7325,10 @@
 	cp POISON_EFFECT
 	jr z, .asm_3f2cd
 	ld a, b
-	call Func_3fb96
+	call StoreAnimationIDAndType
 	jp PrintText
 .asm_3f2cd
-	call Func_3fb89
+	call StoreCurrentMoveAnimationIDAndType
 	jp PrintText
 .noEffect
 	ld a, [de]
@@ -7373,7 +7373,7 @@
 
 FreezeBurnParalyzeEffect: ; 3f30c (f:730c)
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
 	ret nz ; return if they have a substitute, can't effect them
 	ld a, [H_WHOSETURN]
@@ -7854,7 +7854,7 @@
 	ld a, [de]
 	cp $44
 	jr nc, .ApplyBadgeBoostsAndStatusPenalties
-	call Func_3fb89
+	call StoreCurrentMoveAnimationIDAndType
 .ApplyBadgeBoostsAndStatusPenalties
 	ld a, [H_WHOSETURN]
 	and a
@@ -7977,7 +7977,7 @@
 	ld [bc], a ; set Bide counter to 2 or 3 at random
 	ld a, [H_WHOSETURN]
 	add XSTATITEM_ANIM
-	jp Func_3fb96
+	jp StoreAnimationIDAndType
 
 ThrashPetalDanceEffect: ; 3f717 (f:7717)
 	ld hl, W_PLAYERBATTSTATUS1
@@ -7996,7 +7996,7 @@
 	ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
 	ld a, [H_WHOSETURN]
 	add ANIM_B0
-	jp Func_3fb96
+	jp StoreAnimationIDAndType
 
 SwitchAndTeleportEffect: ; 3f739 (f:7739)
 	ld a, [H_WHOSETURN]
@@ -8030,7 +8030,7 @@
 .asm_3f76e
 	call ReadPlayerMonCurHPAndStatus
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	inc a
 	ld [wEscapedFromBattle], a
 	ld a, [W_PLAYERMOVENUM]
@@ -8072,7 +8072,7 @@
 .asm_3f7c1
 	call ReadPlayerMonCurHPAndStatus
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	inc a
 	ld [wEscapedFromBattle], a
 	ld a, [W_ENEMYMOVENUM]
@@ -8213,7 +8213,7 @@
 	ld b, ANIM_C0
 .notDigOrFly
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a, b
 	call PlayBattleAnimation
 	ld a, [de]
@@ -8345,7 +8345,7 @@
 	ld [bc], a ; confusion status will last 2-5 turns
 	pop af
 	cp CONFUSION_SIDE_EFFECT
-	call nz, Func_3fb89
+	call nz, StoreCurrentMoveAnimationIDAndType
 	ld hl, BecameConfusedText
 	jp PrintText
 
@@ -8550,7 +8550,7 @@
 	swap c
 	add c
 	ld [de], a
-	call Func_3fb89
+	call StoreCurrentMoveAnimationIDAndType
 	ld hl, wccee
 	ld a, [H_WHOSETURN]
 	and a
@@ -8658,7 +8658,8 @@
 	pop hl
 	ret
 
-Func_3fb89: ; 3fb89 (f:7b89)
+StoreCurrentMoveAnimationIDAndType: ; 3fb89 (f:7b89)
+; animation at MOVENUM will be played unless MOVENUM is 0
 	ld a, [H_WHOSETURN]
 	and a
 	ld a, [W_PLAYERMOVENUM]
@@ -8668,20 +8669,20 @@
 	and a
 	ret z
 
-Func_3fb96: ; 3fb96 (f:7b96)
+StoreAnimationIDAndType: ; 3fb96 (f:7b96)
 	ld [W_ANIMATIONID], a
 	ld a, [H_WHOSETURN]
 	and a
 	ld a, $6
-	jr z, .asm_3fba2
+	jr z, .storeAnimationType
 	ld a, $3
-.asm_3fba2
-	ld [wcc5b], a
-	jp Func_3fbbc
+.storeAnimationType
+	ld [wAnimationType], a
+	jp PlayBattleAnimationGotID
 
 PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8)
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	ld a, [H_WHOSETURN]
 	and a
 	ld a, [W_PLAYERMOVENUM]
@@ -8694,7 +8695,7 @@
 PlayBattleAnimation: ; 3fbb9 (f:7bb9)
 	ld [W_ANIMATIONID], a
 
-Func_3fbbc: ; 3fbbc (f:7bbc)
+PlayBattleAnimationGotID: ; 3fbbc (f:7bbc)
 	push hl
 	push de
 	push bc
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -320,7 +320,7 @@
 	ld [W_ANIMATIONID],a
 	xor a
 	ld [$fff3],a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld [wDamageMultipliers],a
 	ld a,[wWhichPokemon]
 	push af
--- a/wram.asm
+++ b/wram.asm
@@ -352,6 +352,9 @@
 
 wHallOfFame:: ; cc5b
 wBoostExpByExpAll:: ; cc5b
+wAnimationType:: ; cc5b
+; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
+
 wcc5b:: ds 1
 wcc5c:: ds 1
 wcc5d:: ds 1