aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle
diff options
context:
space:
mode:
authorvulcandth <vulcandth@gmail.com>2022-03-26 21:05:06 -0500
committerGitHub <noreply@github.com>2022-03-26 22:05:06 -0400
commitfbaa5c9d4b48c000a52860a8392fc423c4e312f9 (patch)
tree80c5d8b0458ab6a2c2f1995ed0addd1f6cb5570f /engine/battle
parentRefactor pkmncompress.c to use common.h (diff)
downloadpokeyellow-fbaa5c9d4b48c000a52860a8392fc423c4e312f9.tar.gz
pokeyellow-fbaa5c9d4b48c000a52860a8392fc423c4e312f9.tar.xz
pokeyellow-fbaa5c9d4b48c000a52860a8392fc423c4e312f9.zip
Build the Virtual Console patch with `make yellow_vc` (#80)
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/animations.asm21
-rw-r--r--engine/battle/core.asm23
2 files changed, 44 insertions, 0 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index edffadb6..a46f11df 100644
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -203,7 +203,9 @@ PlayAnimation:
ld h, [hl]
ld l, a
.animationLoop
+ vc_hook FPA_005_End
ld a, [hli]
+ vc_hook FPA_001_End
cp -1
jr z, .AnimationOver
cp FIRST_SE_ID ; is this subanimation or a special effect?
@@ -277,12 +279,17 @@ PlayAnimation:
call LoadSubanimation
call PlaySubanimation
pop af
+ vc_hook FPA_007_End
ldh [rOBP0], a
+ vc_hook FPA_011_End
call UpdateGBCPal_OBP0
.nextAnimationCommand
+ vc_hook FPA_002_End
pop hl
+ vc_hook FPA_003_End
jr .animationLoop
.AnimationOver
+ vc_hook FPA_004_End
ret
LoadSubanimation:
@@ -294,18 +301,26 @@ LoadSubanimation:
ld e, a
ld a, [hl]
ld d, a ; de = address of subanimation
+ vc_hook FPA_005_Begin
ld a, [de]
+ vc_hook FPA_003_Begin
ld b, a
+ vc_hook FPA_002_Begin
and %00011111
+ vc_hook FPA_001_Begin
ld [wSubAnimCounter], a ; number of frame blocks
+ vc_hook FPA_004_Begin
ld a, b
+ vc_hook FPA_007_Begin
and %11100000
cp SUBANIMTYPE_ENEMY << 5
+ vc_hook FPA_009_Begin
jr nz, .isNotType5
.isType5
call GetSubanimationTransform2
jr .saveTransformation
.isNotType5
+ vc_hook FPA_010_Begin
call GetSubanimationTransform1
.saveTransformation
; place the upper 3 bits of a into bits 0-2 of a before storing
@@ -336,6 +351,7 @@ LoadSubanimation:
; sets the transform to SUBANIMTYPE_NORMAL if it's the player's turn
; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1:
+ vc_hook FPA_011_Begin
ld b, a
ldh a, [hWhoseTurn]
and a
@@ -428,10 +444,12 @@ MoveAnimation:
ld c, 30
call DelayFrames
.next4
+ vc_hook FPA_009_End
call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage)
.animationFinished
call WaitForSoundToFinish
xor a
+ vc_hook FPA_008_End
ld [wSubAnimSubEntryAddr], a
ld [wUnusedD09B], a
ld [wSubAnimTransform], a
@@ -469,6 +487,7 @@ ShareMoveAnimations:
PlayApplyingAttackAnimation:
; Generic animation that shows after the move's individual animation
; Different animation depending on whether the move has an additional effect and on whose turn it is
+ vc_hook FPA_010_End
ld a, [wAnimationType]
and a
ret z
@@ -558,8 +577,10 @@ SetAnimationPalette:
ld b, $f0
.next
ld a, b
+ vc_hook FPA_006_Begin
ldh [rOBP0], a
ld a, $6c
+ vc_hook FPA_008_Begin
ldh [rOBP1], a
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index fa1a8d56..e8624289 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -3192,6 +3192,7 @@ LinkBattleExchangeData:
ld a, b
.doExchange
ld [wSerialExchangeNybbleSendData], a
+ vc_hook send_byt2
callfar PrintWaitingText
.syncLoop1
call Serial_ExchangeNybble
@@ -3199,18 +3200,33 @@ LinkBattleExchangeData:
ld a, [wSerialExchangeNybbleReceiveData]
inc a
jr z, .syncLoop1
+ vc_hook send_byt2_ret
+ vc_patch FIGHT
+IF DEF(_YELLOW_VC)
+ ld b, 26
+ELSE
ld b, 10
+ENDC
+ vc_patch_end
.syncLoop2
call DelayFrame
call Serial_ExchangeNybble
dec b
jr nz, .syncLoop2
+ vc_hook send_dummy
+ vc_patch FIGHT2
+IF DEF(_YELLOW_VC)
+ ld b, 26
+ELSE
ld b, 10
+ENDC
+ vc_patch_end
.syncLoop3
call DelayFrame
call Serial_SendZeroByte
dec b
jr nz, .syncLoop3
+ vc_hook send_dummy_end
ret
ExecutePlayerMove:
@@ -6844,7 +6860,14 @@ BattleRandom:
ld a, [hl]
pop bc
pop hl
+ vc_hook fight_ret_c
+ vc_patch fight_ret
+IF DEF(_YELLOW_VC)
+ ret
+ELSE
ret c
+ENDC
+ vc_patch_end
; if we picked the last seed, we need to recalculate the nine seeds
push hl