summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/animations.asm21
-rw-r--r--engine/battle/core.asm23
-rw-r--r--engine/gfx/palettes.asm1
-rw-r--r--engine/link/cable_club.asm3
-rw-r--r--engine/link/cable_club_npc.asm4
-rw-r--r--engine/menus/link_menu.asm2
-rw-r--r--engine/menus/pokedex.asm6
-rw-r--r--engine/menus/save.asm43
-rw-r--r--engine/movie/intro_yellow.asm5
-rw-r--r--engine/pikachu/pikachu_pcm.asm7
10 files changed, 95 insertions, 20 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
diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm
index fa7bb7c5..4d4e6d02 100644
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -657,6 +657,7 @@ CheckSGB:
SendMltReq1Packet:
ld hl, MltReq1Packet
call SendSGBPacket
+ vc_hook Network_RESET
jp Wait7000
CopyGfxToSuperNintendoVRAM:
diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm
index 0c653cc8..aa2ff15a 100644
--- a/engine/link/cable_club.asm
+++ b/engine/link/cable_club.asm
@@ -130,12 +130,14 @@ CableClub_DoBattleOrTradeAgain:
ld hl, wSerialPlayerDataBlock
ld de, wSerialEnemyDataBlock
ld bc, $1a8
+ vc_hook Network424
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
ld hl, wSerialPartyMonsPatchList
ld de, wSerialEnemyMonsPatchList
ld bc, $c8
+ vc_hook Network200
call Serial_ExchangeBytes
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a
@@ -866,6 +868,7 @@ TradeCenter_Trade:
ld de, TradeCompleted
call PlaceString
predef SaveSAVtoSRAM2
+ vc_hook save_game_end
ld c, 50
call DelayFrames
xor a
diff --git a/engine/link/cable_club_npc.asm b/engine/link/cable_club_npc.asm
index 4d0a0a8a..b65acfdc 100644
--- a/engine/link/cable_club_npc.asm
+++ b/engine/link/cable_club_npc.asm
@@ -30,6 +30,7 @@ CableClubNPC::
xor a
ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
+ vc_hook linkCable_fake_begin
ldh [rSC], a
ld a, [wLinkTimeoutCounter]
dec a
@@ -57,6 +58,7 @@ CableClubNPC::
ld a, [wCurrentMenuItem]
and a
jr nz, .choseNo
+ vc_hook linkCable_block_input
callfar SaveSAVtoSRAM
call WaitForSoundToFinish
ld a, SFX_SAVE
@@ -70,7 +72,9 @@ CableClubNPC::
ld [hl], a
ldh [hSerialReceivedNewData], a
ld [wSerialExchangeNybbleSendData], a
+ vc_hook linkCable_fake_end
call Serial_SyncAndExchangeNybble
+ vc_hook Network_RECHECK
ld hl, wUnknownSerialCounter
ld a, [hli]
inc a
diff --git a/engine/menus/link_menu.asm b/engine/menus/link_menu.asm
index 2f2db573..6d9021e4 100644
--- a/engine/menus/link_menu.asm
+++ b/engine/menus/link_menu.asm
@@ -794,9 +794,11 @@ LinkMenu:
call Delay3
callfar CloseLinkConnection
ld hl, ColosseumCanceledText
+ vc_hook Network_STOP
call PrintText
ld hl, wd72e
res 6, [hl]
+ vc_hook Network_END
ret
.asm_f5963
diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm
index 7b1a204a..d0e8cf2b 100644
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -111,7 +111,13 @@ HandlePokedexSideMenu:
dec a
jr z, .choseArea
dec a
+ vc_patch disable_print
+IF DEF (_YELLOW_VC)
+ jr z, .handleMenuInput
+ELSE
jr z, .chosePrint
+ENDC
+ vc_patch_end
.choseQuit
ld b, 1
.exitSideMenu
diff --git a/engine/menus/save.asm b/engine/menus/save.asm
index 55ae9e47..a623ee1a 100644
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -35,20 +35,23 @@ LoadSAV0:
call EnableSRAMAndLatchClockData
ld a, $1
ld [MBC1SRamBank], a
- ld hl, sPlayerName ; hero name located in SRAM
- ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
+; This vc_hook does not have to be in any particular location.
+; It is defined here because it refers to the same labels as the two lines below.
+ vc_hook SaveLimit
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
- ld a, [sMainDataCheckSum] ; SAV's checksum
+ ld a, [sMainDataCheckSum]
cp c
jp z, .checkSumsMatched
; If the computed checksum didn't match the saved on, try again.
- ld hl, sPlayerName
- ld bc, sMainDataCheckSum - sPlayerName
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
- ld a, [sMainDataCheckSum] ; SAV's checksum
+ ld a, [sMainDataCheckSum]
cp c
jp nz, SAVBadCheckSum
@@ -80,11 +83,11 @@ LoadSAV1:
call EnableSRAMAndLatchClockData
ld a, $1
ld [MBC1SRamBank], a
- ld hl, sPlayerName ; hero name located in SRAM
- ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
- ld a, [sMainDataCheckSum] ; SAV's checksum
+ ld a, [sMainDataCheckSum]
cp c
jr nz, SAVBadCheckSum
ld hl, sCurBoxData
@@ -98,11 +101,11 @@ LoadSAV2:
call EnableSRAMAndLatchClockData
ld a, $1
ld [MBC1SRamBank], a
- ld hl, sPlayerName ; hero name located in SRAM
- ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
- ld a, [sMainDataCheckSum] ; SAV's checksum
+ ld a, [sMainDataCheckSum]
cp c
jp nz, SAVBadCheckSum
ld hl, sPartyData
@@ -213,8 +216,8 @@ SaveSAVtoSRAM0:
call CopyData
ldh a, [hTileAnimations]
ld [sTileAnimations], a
- ld hl, sPlayerName
- ld bc, sMainDataCheckSum - sPlayerName
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
call DisableSRAMAndPrepareClockData
@@ -229,8 +232,8 @@ SaveSAVtoSRAM1:
ld de, sCurBoxData
ld bc, wBoxDataEnd - wBoxDataStart
call CopyData
- ld hl, sPlayerName
- ld bc, sMainDataCheckSum - sPlayerName
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
call DisableSRAMAndPrepareClockData
@@ -255,8 +258,8 @@ SaveSAVtoSRAM2:
inc de
ld a, [hl]
ld [de], a
- ld hl, sPlayerName
- ld bc, sMainDataCheckSum - sPlayerName
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
call DisableSRAMAndPrepareClockData
@@ -584,8 +587,8 @@ SAVCheckRandomID:
ld a, [sPlayerName]
and a
jr z, .next
- ld hl, sPlayerName
- ld bc, sMainDataCheckSum - sPlayerName
+ ld hl, sGameData
+ ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum]
diff --git a/engine/movie/intro_yellow.asm b/engine/movie/intro_yellow.asm
index 8a2e6f4c..f054f576 100644
--- a/engine/movie/intro_yellow.asm
+++ b/engine/movie/intro_yellow.asm
@@ -30,6 +30,7 @@ PlayIntroScene:
jr .loop
.go_to_title_screen
+ vc_hook FPA_031801_End3
call YellowIntro_BlankPalettes
xor a
ldh [hLCDCPointer], a
@@ -123,6 +124,7 @@ Jumptable_f9906:
YellowIntro_NextScene:
ld hl, wYellowIntroCurrentScene
inc [hl]
+ vc_hook FPA_031801_Begin1
ret
YellowIntroScene0:
@@ -601,6 +603,7 @@ YellowIntroScene14:
call YellowIntro_SpawnAnimatedObjectAndSavePointer
call YellowIntro_NextScene
ld a, $28
+ vc_hook FPA_031801_Begin2
ld [wYellowIntroSceneTimer], a
ret
@@ -705,12 +708,14 @@ YellowIntro_CheckFrameTimerDecrement:
ret
.asm_f9e4b
+ vc_hook FPA_031801_End2
scf
ret
YellowIntro_LoadDMGPalAndIncrementCounter:
ld hl, wYellowIntroSceneTimer
ld a, [hl]
+ vc_hook FPA_031801_End1
inc [hl]
ld l, a
ld h, $0
diff --git a/engine/pikachu/pikachu_pcm.asm b/engine/pikachu/pikachu_pcm.asm
index 5ef6fbc3..d971ea85 100644
--- a/engine/pikachu/pikachu_pcm.asm
+++ b/engine/pikachu/pikachu_pcm.asm
@@ -1,4 +1,5 @@
PlayPikachuSoundClip::
+ vc_hook PLAY_NEW
ld a, e
ld e, a
ld d, $0
@@ -39,7 +40,13 @@ PlayPikachuSoundClip::
ld a, l
cp $40 ; end of wave data
jr nz, .saveWaveDataLoop
+ vc_patch PLAY_MUTE
+IF DEF(_YELLOW_VC)
+ ld a, 0
+ELSE
ld a, $80
+ENDC
+ vc_patch_end
ldh [rNR30], a
ldh a, [rNR51]
or $44