2018-04-05 08:44:02 -07:00
|
|
|
; BattleTransitionJumptable.Jumptable indexes
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF BATTLETRANSITION_CAVE EQU $01
|
|
|
|
DEF BATTLETRANSITION_CAVE_STRONGER EQU $09
|
|
|
|
DEF BATTLETRANSITION_NO_CAVE EQU $10
|
|
|
|
DEF BATTLETRANSITION_NO_CAVE_STRONGER EQU $18
|
|
|
|
DEF BATTLETRANSITION_FINISH EQU $20
|
|
|
|
DEF BATTLETRANSITION_END EQU $80
|
2018-04-05 08:44:02 -07:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF BATTLETRANSITION_SQUARE EQU "8" ; $fe
|
|
|
|
DEF BATTLETRANSITION_BLACK EQU "9" ; $ff
|
2018-06-25 20:14:52 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DoBattleTransition:
|
2016-03-01 19:31:21 -08:00
|
|
|
call .InitGFX
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rBGP]
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rOBP0]
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wOBP0], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rOBP1]
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wOBP1], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
ld hl, hVBlank
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
2022-06-06 14:22:48 -07:00
|
|
|
vc_hook Reduce_battle_transition_flashing
|
2015-10-19 07:23:58 -07:00
|
|
|
ld [hl], $1
|
|
|
|
|
|
|
|
.loop
|
2015-10-24 16:49:19 -07:00
|
|
|
ld a, [wJumptableIndex]
|
2018-04-05 08:44:02 -07:00
|
|
|
bit 7, a ; BATTLETRANSITION_END?
|
2015-10-19 07:23:58 -07:00
|
|
|
jr nz, .done
|
2018-01-02 06:05:14 -08:00
|
|
|
call BattleTransitionJumptable
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2015-10-19 07:23:58 -07:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-01-01 06:08:21 -08:00
|
|
|
ld hl, wBGPals1
|
2015-11-16 08:53:26 -08:00
|
|
|
ld bc, 8 palettes
|
2015-10-19 07:23:58 -07:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
ld a, %11111111
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DmgToCgbBGPals
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hLCDCPointer], a
|
|
|
|
ldh [hLYOverrideStart], a
|
|
|
|
ldh [hLYOverrideEnd], a
|
|
|
|
ldh [hSCY], a
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, $1 ; unnecessary bankswitch?
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
pop af
|
2022-06-06 14:22:48 -07:00
|
|
|
vc_hook Stop_reducing_battle_transition_flashing
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hVBlank], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.InitGFX:
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_MOBILE
|
|
|
|
jr z, .mobile
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ReanchorBGMap_NoOAMUpdate
|
2015-10-19 07:23:58 -07:00
|
|
|
call UpdateSprites
|
|
|
|
call DelayFrame
|
2016-03-01 19:31:21 -08:00
|
|
|
call .NonMobile_LoadPokeballTiles
|
2017-12-24 15:11:17 -08:00
|
|
|
call BattleStart_CopyTilemapAtOnce
|
2015-10-19 07:23:58 -07:00
|
|
|
jr .resume
|
|
|
|
|
|
|
|
.mobile
|
|
|
|
call LoadTrainerBattlePokeballTiles
|
|
|
|
|
|
|
|
.resume
|
|
|
|
ld a, SCREEN_HEIGHT_PX
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hWY], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-24 16:49:19 -07:00
|
|
|
ld hl, wJumptableIndex
|
2015-10-19 07:23:58 -07:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
2015-12-26 18:59:03 -08:00
|
|
|
ld [hli], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ld [hl], a
|
|
|
|
call WipeLYOverrides
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.NonMobile_LoadPokeballTiles:
|
2015-10-19 07:23:58 -07:00
|
|
|
call LoadTrainerBattlePokeballTiles
|
2015-11-20 08:47:52 -08:00
|
|
|
hlbgcoord 0, 0
|
2016-05-11 06:49:03 -07:00
|
|
|
call ConvertTrainerBattlePokeballTilesTo2bpp
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
LoadTrainerBattlePokeballTiles:
|
|
|
|
; Load the tiles used in the Pokeball Graphic that fills the screen
|
|
|
|
; at the start of every Trainer battle.
|
|
|
|
ld de, TrainerBattlePokeballTiles
|
2018-06-25 20:14:52 -07:00
|
|
|
ld hl, vTiles0 tile BATTLETRANSITION_SQUARE
|
2015-10-19 07:23:58 -07:00
|
|
|
ld b, BANK(TrainerBattlePokeballTiles)
|
|
|
|
ld c, 2
|
|
|
|
call Request2bpp
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rVBK]
|
2015-10-19 07:23:58 -07:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
ld de, TrainerBattlePokeballTiles
|
2018-06-25 20:14:52 -07:00
|
|
|
ld hl, vTiles3 tile BATTLETRANSITION_SQUARE
|
2015-10-19 07:23:58 -07:00
|
|
|
ld b, BANK(TrainerBattlePokeballTiles)
|
|
|
|
ld c, 2
|
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ConvertTrainerBattlePokeballTilesTo2bpp:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2015-10-19 07:23:58 -07:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wDecompressScratch)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
push hl
|
2015-12-19 11:48:30 -08:00
|
|
|
ld hl, wDecompressScratch
|
2016-01-27 09:25:12 -08:00
|
|
|
ld bc, $28 tiles
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
.loop
|
|
|
|
ld [hl], -1
|
|
|
|
inc hl
|
|
|
|
dec bc
|
|
|
|
ld a, c
|
|
|
|
or b
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
pop hl
|
2015-12-19 11:48:30 -08:00
|
|
|
ld de, wDecompressScratch
|
2019-01-12 12:17:20 -08:00
|
|
|
ld b, BANK(@)
|
2015-10-19 07:23:58 -07:00
|
|
|
ld c, $28
|
|
|
|
call Request2bpp
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerBattlePokeballTiles:
|
2017-12-10 21:17:39 -08:00
|
|
|
INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp"
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleTransitionJumptable:
|
2018-04-05 08:44:02 -07:00
|
|
|
jumptable .Jumptable, wJumptableIndex
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.Jumptable:
|
2015-10-19 07:23:58 -07:00
|
|
|
dw StartTrainerBattle_DetermineWhichAnimation ; 00
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; BATTLETRANSITION_CAVE
|
2015-10-19 07:23:58 -07:00
|
|
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 01
|
|
|
|
dw StartTrainerBattle_SetUpBGMap ; 02
|
|
|
|
dw StartTrainerBattle_Flash ; 03
|
|
|
|
dw StartTrainerBattle_Flash ; 04
|
|
|
|
dw StartTrainerBattle_Flash ; 05
|
|
|
|
dw StartTrainerBattle_NextScene ; 06
|
|
|
|
dw StartTrainerBattle_SetUpForWavyOutro ; 07
|
|
|
|
dw StartTrainerBattle_SineWave ; 08
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; BATTLETRANSITION_CAVE_STRONGER
|
2015-10-19 07:23:58 -07:00
|
|
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 09
|
|
|
|
dw StartTrainerBattle_SetUpBGMap ; 0a
|
|
|
|
dw StartTrainerBattle_Flash ; 0b
|
|
|
|
dw StartTrainerBattle_Flash ; 0c
|
|
|
|
dw StartTrainerBattle_Flash ; 0d
|
|
|
|
dw StartTrainerBattle_NextScene ; 0e
|
|
|
|
; There is no setup for this one
|
|
|
|
dw StartTrainerBattle_ZoomToBlack ; 0f
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; BATTLETRANSITION_NO_CAVE
|
2015-10-19 07:23:58 -07:00
|
|
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 10
|
|
|
|
dw StartTrainerBattle_SetUpBGMap ; 11
|
|
|
|
dw StartTrainerBattle_Flash ; 12
|
|
|
|
dw StartTrainerBattle_Flash ; 13
|
|
|
|
dw StartTrainerBattle_Flash ; 14
|
|
|
|
dw StartTrainerBattle_NextScene ; 15
|
|
|
|
dw StartTrainerBattle_SetUpForSpinOutro ; 16
|
|
|
|
dw StartTrainerBattle_SpinToBlack ; 17
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; BATTLETRANSITION_NO_CAVE_STRONGER
|
2015-10-19 07:23:58 -07:00
|
|
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 18
|
|
|
|
dw StartTrainerBattle_SetUpBGMap ; 19
|
|
|
|
dw StartTrainerBattle_Flash ; 1a
|
|
|
|
dw StartTrainerBattle_Flash ; 1b
|
|
|
|
dw StartTrainerBattle_Flash ; 1c
|
|
|
|
dw StartTrainerBattle_NextScene ; 1d
|
|
|
|
dw StartTrainerBattle_SetUpForRandomScatterOutro ; 1e
|
|
|
|
dw StartTrainerBattle_SpeckleToBlack ; 1f
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; BATTLETRANSITION_FINISH
|
2015-10-19 07:23:58 -07:00
|
|
|
dw StartTrainerBattle_Finish ; 20
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; transition animations
|
|
|
|
const_def
|
|
|
|
const TRANS_CAVE
|
|
|
|
const TRANS_CAVE_STRONGER
|
|
|
|
const TRANS_NO_CAVE
|
|
|
|
const TRANS_NO_CAVE_STRONGER
|
|
|
|
|
|
|
|
; transition animation bits
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF TRANS_STRONGER_F EQU 0 ; bit set in TRANS_CAVE_STRONGER and TRANS_NO_CAVE_STRONGER
|
|
|
|
DEF TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_DetermineWhichAnimation:
|
2017-12-12 19:58:20 -08:00
|
|
|
; The screen flashes a different number of times depending on the level of
|
|
|
|
; your lead Pokemon relative to the opponent's.
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Battle transitions fail to account for enemy's level (see docs/bugs_and_glitches.md)
|
2015-10-19 07:23:58 -07:00
|
|
|
ld de, 0
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleMonLevel]
|
2015-10-19 07:23:58 -07:00
|
|
|
add 3
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemyMonLevel
|
2015-10-19 07:23:58 -07:00
|
|
|
cp [hl]
|
2018-04-05 08:44:02 -07:00
|
|
|
jr nc, .not_stronger
|
|
|
|
set TRANS_STRONGER_F, e
|
|
|
|
.not_stronger
|
2017-12-24 10:08:38 -08:00
|
|
|
ld a, [wEnvironment]
|
2015-10-19 07:23:58 -07:00
|
|
|
cp CAVE
|
2018-04-05 08:44:02 -07:00
|
|
|
jr z, .cave
|
2017-12-24 10:08:38 -08:00
|
|
|
cp ENVIRONMENT_5
|
2018-04-05 08:44:02 -07:00
|
|
|
jr z, .cave
|
2015-10-19 07:23:58 -07:00
|
|
|
cp DUNGEON
|
2018-04-05 08:44:02 -07:00
|
|
|
jr z, .cave
|
|
|
|
set TRANS_NO_CAVE_F, e
|
|
|
|
.cave
|
2015-10-19 07:23:58 -07:00
|
|
|
ld hl, .StartingPoints
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2015-10-24 16:49:19 -07:00
|
|
|
ld [wJumptableIndex], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StartingPoints:
|
2018-04-05 08:44:02 -07:00
|
|
|
; entries correspond to TRANS_* constants
|
|
|
|
db BATTLETRANSITION_CAVE
|
|
|
|
db BATTLETRANSITION_CAVE_STRONGER
|
|
|
|
db BATTLETRANSITION_NO_CAVE
|
|
|
|
db BATTLETRANSITION_NO_CAVE_STRONGER
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_Finish:
|
2015-10-19 07:23:58 -07:00
|
|
|
call ClearSprites
|
2018-04-05 08:44:02 -07:00
|
|
|
ld a, BATTLETRANSITION_END
|
2015-10-24 16:49:19 -07:00
|
|
|
ld [wJumptableIndex], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_NextScene:
|
2015-10-24 16:49:19 -07:00
|
|
|
ld hl, wJumptableIndex
|
2015-10-19 07:23:58 -07:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SetUpBGMap:
|
2015-10-19 07:23:58 -07:00
|
|
|
call StartTrainerBattle_NextScene
|
|
|
|
xor a
|
2020-10-28 10:35:39 -07:00
|
|
|
ld [wBattleTransitionCounter], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_Flash:
|
2015-10-19 07:23:58 -07:00
|
|
|
call .DoFlashAnimation
|
|
|
|
ret nc
|
|
|
|
call StartTrainerBattle_NextScene
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DoFlashAnimation:
|
2015-12-14 08:12:18 -08:00
|
|
|
ld a, [wTimeOfDayPalset]
|
2020-08-11 11:12:59 -07:00
|
|
|
cp DARKNESS_PALSET
|
2015-10-19 07:23:58 -07:00
|
|
|
jr z, .done
|
2020-10-28 10:35:39 -07:00
|
|
|
ld hl, wBattleTransitionCounter
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
|
|
|
srl a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .pals
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
cp %00000001
|
|
|
|
jr z, .done
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DmgToCgbBGPals
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.done
|
|
|
|
xor a
|
2020-10-28 10:35:39 -07:00
|
|
|
ld [wBattleTransitionCounter], a
|
2015-10-19 07:23:58 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.pals:
|
2018-09-09 15:15:54 -07:00
|
|
|
dc 3, 3, 2, 1
|
|
|
|
dc 3, 3, 3, 2
|
|
|
|
dc 3, 3, 3, 3
|
|
|
|
dc 3, 3, 3, 2
|
|
|
|
dc 3, 3, 2, 1
|
|
|
|
dc 3, 2, 1, 0
|
|
|
|
dc 2, 1, 0, 0
|
|
|
|
dc 1, 0, 0, 0
|
|
|
|
dc 0, 0, 0, 0
|
|
|
|
dc 1, 0, 0, 0
|
|
|
|
dc 2, 1, 0, 0
|
|
|
|
dc 3, 2, 1, 0
|
|
|
|
dc 0, 0, 0, 1
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SetUpForWavyOutro:
|
2022-06-06 14:22:48 -07:00
|
|
|
vc_hook Stop_reducing_battle_transition_flashing_WavyOutro
|
2020-10-22 18:25:40 -07:00
|
|
|
farcall RespawnPlayerAndOpponent
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wLYOverrides)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call StartTrainerBattle_NextScene
|
2015-11-16 08:53:26 -08:00
|
|
|
|
2018-08-25 11:34:25 -07:00
|
|
|
ld a, LOW(rSCX)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hLCDCPointer], a
|
2015-10-19 07:23:58 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hLYOverrideStart], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, $90
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hLYOverrideEnd], a
|
2015-10-19 07:23:58 -07:00
|
|
|
xor a
|
2020-10-28 10:35:39 -07:00
|
|
|
ld [wBattleTransitionCounter], a
|
|
|
|
ld [wBattleTransitionSineWaveOffset], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SineWave:
|
2020-10-28 10:35:39 -07:00
|
|
|
ld a, [wBattleTransitionCounter]
|
2015-10-19 07:23:58 -07:00
|
|
|
cp $60
|
|
|
|
jr nc, .end
|
|
|
|
call .DoSineWave
|
|
|
|
ret
|
|
|
|
|
|
|
|
.end
|
2018-04-05 08:44:02 -07:00
|
|
|
ld a, BATTLETRANSITION_FINISH
|
2015-10-24 16:49:19 -07:00
|
|
|
ld [wJumptableIndex], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DoSineWave:
|
2020-10-28 10:35:39 -07:00
|
|
|
ld hl, wBattleTransitionSineWaveOffset
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
2020-10-28 10:35:39 -07:00
|
|
|
ld hl, wBattleTransitionCounter
|
2015-10-19 07:23:58 -07:00
|
|
|
ld d, [hl]
|
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, wLYOverridesEnd - wLYOverrides
|
|
|
|
ld bc, wLYOverrides
|
2020-06-16 16:32:36 -07:00
|
|
|
ld e, 0
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
.loop
|
|
|
|
push af
|
|
|
|
push de
|
|
|
|
ld a, e
|
|
|
|
call StartTrainerBattle_DrawSineWave
|
|
|
|
ld [bc], a
|
|
|
|
inc bc
|
|
|
|
pop de
|
|
|
|
ld a, e
|
2020-06-16 16:32:36 -07:00
|
|
|
add 2
|
2015-10-19 07:23:58 -07:00
|
|
|
ld e, a
|
|
|
|
pop af
|
|
|
|
dec a
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SetUpForSpinOutro:
|
2022-06-06 14:22:48 -07:00
|
|
|
vc_hook Stop_reducing_battle_transition_flashing_SpinOutro
|
2020-10-22 18:25:40 -07:00
|
|
|
farcall RespawnPlayerAndOpponent
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wLYOverrides)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call StartTrainerBattle_NextScene
|
|
|
|
xor a
|
2020-10-28 10:35:39 -07:00
|
|
|
ld [wBattleTransitionCounter], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SpinToBlack:
|
2015-10-19 07:23:58 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2020-10-28 10:35:39 -07:00
|
|
|
ld a, [wBattleTransitionCounter]
|
2015-10-19 07:23:58 -07:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2020-10-19 17:27:19 -07:00
|
|
|
ld hl, .spin_quadrants
|
2015-10-19 07:23:58 -07:00
|
|
|
rept 5
|
|
|
|
add hl, de
|
|
|
|
endr
|
|
|
|
ld a, [hli]
|
|
|
|
cp -1
|
|
|
|
jr z, .end
|
2020-10-28 10:35:39 -07:00
|
|
|
ld [wBattleTransitionSineWaveOffset], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call .load
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
2020-10-28 10:35:39 -07:00
|
|
|
ld hl, wBattleTransitionCounter
|
2015-10-19 07:23:58 -07:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.end
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2018-04-05 08:44:02 -07:00
|
|
|
ld a, BATTLETRANSITION_FINISH
|
2015-10-24 16:49:19 -07:00
|
|
|
ld [wJumptableIndex], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2017-12-13 21:36:24 -08:00
|
|
|
; quadrants
|
|
|
|
const_def
|
|
|
|
const UPPER_LEFT
|
|
|
|
const UPPER_RIGHT
|
|
|
|
const LOWER_LEFT
|
|
|
|
const LOWER_RIGHT
|
|
|
|
|
2018-04-05 08:44:02 -07:00
|
|
|
; quadrant bits
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF RIGHT_QUADRANT_F EQU 0 ; bit set in UPPER_RIGHT and LOWER_RIGHT
|
|
|
|
DEF LOWER_QUADRANT_F EQU 1 ; bit set in LOWER_LEFT and LOWER_RIGHT
|
2018-04-05 08:44:02 -07:00
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.spin_quadrants:
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO spin_quadrant
|
2017-12-13 21:36:24 -08:00
|
|
|
db \1
|
2020-10-19 17:27:19 -07:00
|
|
|
dw \2
|
2017-12-13 21:36:24 -08:00
|
|
|
dwcoord \3, \4
|
|
|
|
ENDM
|
2020-10-19 17:27:19 -07:00
|
|
|
spin_quadrant UPPER_LEFT, .wedge1, 1, 6
|
|
|
|
spin_quadrant UPPER_LEFT, .wedge2, 0, 3
|
|
|
|
spin_quadrant UPPER_LEFT, .wedge3, 1, 0
|
|
|
|
spin_quadrant UPPER_LEFT, .wedge4, 5, 0
|
|
|
|
spin_quadrant UPPER_LEFT, .wedge5, 9, 0
|
|
|
|
spin_quadrant UPPER_RIGHT, .wedge5, 10, 0
|
|
|
|
spin_quadrant UPPER_RIGHT, .wedge4, 14, 0
|
|
|
|
spin_quadrant UPPER_RIGHT, .wedge3, 18, 0
|
|
|
|
spin_quadrant UPPER_RIGHT, .wedge2, 19, 3
|
|
|
|
spin_quadrant UPPER_RIGHT, .wedge1, 18, 6
|
|
|
|
spin_quadrant LOWER_RIGHT, .wedge1, 18, 11
|
|
|
|
spin_quadrant LOWER_RIGHT, .wedge2, 19, 14
|
|
|
|
spin_quadrant LOWER_RIGHT, .wedge3, 18, 17
|
|
|
|
spin_quadrant LOWER_RIGHT, .wedge4, 14, 17
|
|
|
|
spin_quadrant LOWER_RIGHT, .wedge5, 10, 17
|
|
|
|
spin_quadrant LOWER_LEFT, .wedge5, 9, 17
|
|
|
|
spin_quadrant LOWER_LEFT, .wedge4, 5, 17
|
|
|
|
spin_quadrant LOWER_LEFT, .wedge3, 1, 17
|
|
|
|
spin_quadrant LOWER_LEFT, .wedge2, 0, 14
|
|
|
|
spin_quadrant LOWER_LEFT, .wedge1, 1, 11
|
2015-10-19 07:23:58 -07:00
|
|
|
db -1
|
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
.load:
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
.loop
|
|
|
|
push hl
|
|
|
|
ld a, [de]
|
|
|
|
ld c, a
|
|
|
|
inc de
|
|
|
|
.loop1
|
2019-06-30 11:20:25 -07:00
|
|
|
ld [hl], BATTLETRANSITION_BLACK
|
2020-10-28 10:35:39 -07:00
|
|
|
ld a, [wBattleTransitionSineWaveOffset]
|
2018-04-05 08:44:02 -07:00
|
|
|
bit RIGHT_QUADRANT_F, a
|
2015-10-19 07:23:58 -07:00
|
|
|
jr z, .leftside
|
|
|
|
inc hl
|
|
|
|
jr .okay1
|
|
|
|
.leftside
|
|
|
|
dec hl
|
|
|
|
.okay1
|
|
|
|
dec c
|
|
|
|
jr nz, .loop1
|
|
|
|
pop hl
|
2020-10-28 10:35:39 -07:00
|
|
|
ld a, [wBattleTransitionSineWaveOffset]
|
2018-04-05 08:44:02 -07:00
|
|
|
bit LOWER_QUADRANT_F, a
|
2015-10-19 07:23:58 -07:00
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
jr z, .upper
|
|
|
|
ld bc, -SCREEN_WIDTH
|
|
|
|
.upper
|
|
|
|
add hl, bc
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp -1
|
|
|
|
ret z
|
|
|
|
and a
|
|
|
|
jr z, .loop
|
|
|
|
ld c, a
|
|
|
|
.loop2
|
2020-10-28 10:35:39 -07:00
|
|
|
ld a, [wBattleTransitionSineWaveOffset]
|
2018-04-05 08:44:02 -07:00
|
|
|
bit RIGHT_QUADRANT_F, a
|
2015-10-19 07:23:58 -07:00
|
|
|
jr z, .leftside2
|
|
|
|
dec hl
|
|
|
|
jr .okay2
|
|
|
|
.leftside2
|
|
|
|
inc hl
|
|
|
|
.okay2
|
|
|
|
dec c
|
|
|
|
jr nz, .loop2
|
|
|
|
jr .loop
|
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.wedge1: db 2, 3, 5, 4, 9, -1
|
|
|
|
.wedge2: db 1, 1, 2, 2, 4, 2, 4, 2, 3, -1
|
|
|
|
.wedge3: db 2, 1, 3, 1, 4, 1, 4, 1, 4, 1, 3, 1, 2, 1, 1, 1, 1, -1
|
|
|
|
.wedge4: db 4, 1, 4, 0, 3, 1, 3, 0, 2, 1, 2, 0, 1, -1
|
|
|
|
.wedge5: db 4, 0, 3, 0, 3, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, -1
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SetUpForRandomScatterOutro:
|
2022-06-06 14:22:48 -07:00
|
|
|
vc_hook Stop_reducing_battle_transition_flashing_ScatterOutro
|
2020-10-22 18:25:40 -07:00
|
|
|
farcall RespawnPlayerAndOpponent
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wLYOverrides)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call StartTrainerBattle_NextScene
|
|
|
|
ld a, $10
|
2020-10-28 10:35:39 -07:00
|
|
|
ld [wBattleTransitionCounter], a
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_SpeckleToBlack:
|
2020-10-28 10:35:39 -07:00
|
|
|
ld hl, wBattleTransitionCounter
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
dec [hl]
|
|
|
|
ld c, $c
|
|
|
|
.loop
|
|
|
|
push bc
|
|
|
|
call .BlackOutRandomTile
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
|
|
|
.done
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2018-04-05 08:44:02 -07:00
|
|
|
ld a, BATTLETRANSITION_FINISH
|
2015-10-24 16:49:19 -07:00
|
|
|
ld [wJumptableIndex], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.BlackOutRandomTile:
|
2015-10-19 07:23:58 -07:00
|
|
|
.y_loop
|
|
|
|
call Random
|
|
|
|
cp SCREEN_HEIGHT
|
|
|
|
jr nc, .y_loop
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
.x_loop
|
|
|
|
call Random
|
|
|
|
cp SCREEN_WIDTH
|
|
|
|
jr nc, .x_loop
|
|
|
|
ld c, a
|
|
|
|
|
|
|
|
hlcoord 0, -1
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
inc b
|
|
|
|
|
|
|
|
.row_loop
|
|
|
|
add hl, de
|
|
|
|
dec b
|
|
|
|
jr nz, .row_loop
|
|
|
|
add hl, bc
|
|
|
|
|
|
|
|
; If the tile has already been blacked out,
|
|
|
|
; sample a new tile
|
|
|
|
ld a, [hl]
|
2019-06-30 11:20:25 -07:00
|
|
|
cp BATTLETRANSITION_BLACK
|
2015-10-19 07:23:58 -07:00
|
|
|
jr z, .y_loop
|
2019-06-30 11:20:25 -07:00
|
|
|
ld [hl], BATTLETRANSITION_BLACK
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_LoadPokeBallGraphics:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wOtherTrainerClass]
|
2015-10-19 07:23:58 -07:00
|
|
|
and a
|
2016-01-27 09:25:12 -08:00
|
|
|
jp z, .nextscene ; don't need to be here if wild
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2020-06-16 16:32:36 -07:00
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-10-19 07:23:58 -07:00
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
inc b
|
|
|
|
inc c
|
|
|
|
jr .enter_loop_midway
|
|
|
|
|
2020-06-16 16:32:36 -07:00
|
|
|
.pal_loop
|
2016-01-27 09:25:12 -08:00
|
|
|
; set all pals to 7
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [hl]
|
2020-06-16 16:32:36 -07:00
|
|
|
or PAL_BG_TEXT
|
2015-10-19 07:23:58 -07:00
|
|
|
ld [hli], a
|
|
|
|
.enter_loop_midway
|
|
|
|
dec c
|
2020-06-16 16:32:36 -07:00
|
|
|
jr nz, .pal_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
dec b
|
2020-06-16 16:32:36 -07:00
|
|
|
jr nz, .pal_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-01-09 23:30:17 -08:00
|
|
|
call .loadpokeballgfx
|
2015-10-19 07:23:58 -07:00
|
|
|
hlcoord 2, 1
|
|
|
|
|
|
|
|
ld b, SCREEN_WIDTH - 4
|
2020-06-16 16:32:36 -07:00
|
|
|
.tile_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
push hl
|
|
|
|
ld c, 2
|
2020-06-16 16:32:36 -07:00
|
|
|
.row_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
push hl
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2020-06-16 16:32:36 -07:00
|
|
|
.col_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
; Loading is done bit by bit
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
sla a
|
|
|
|
jr nc, .no_load
|
2018-06-25 20:14:52 -07:00
|
|
|
ld [hl], BATTLETRANSITION_SQUARE
|
2015-10-19 07:23:58 -07:00
|
|
|
.no_load
|
|
|
|
inc hl
|
2020-06-16 16:32:36 -07:00
|
|
|
jr .col_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop hl
|
|
|
|
push bc
|
|
|
|
ld bc, (SCREEN_WIDTH - 4) / 2
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec c
|
2020-06-16 16:32:36 -07:00
|
|
|
jr nz, .row_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
|
|
|
|
pop hl
|
|
|
|
push bc
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2020-06-16 16:32:36 -07:00
|
|
|
jr nz, .tile_loop
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hCGB]
|
2015-10-19 07:23:58 -07:00
|
|
|
and a
|
|
|
|
jr nz, .cgb
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
jr .nextscene
|
|
|
|
|
|
|
|
.cgb
|
2020-08-11 11:12:59 -07:00
|
|
|
ld hl, .pals
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTimeOfDayPal]
|
2018-01-16 14:27:50 -08:00
|
|
|
maskbits NUM_DAYTIMES
|
2018-01-11 09:00:01 -08:00
|
|
|
cp DARKNESS_F
|
2020-08-11 11:12:59 -07:00
|
|
|
jr nz, .not_dark
|
|
|
|
ld hl, .darkpals
|
|
|
|
.not_dark
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2015-10-19 07:23:58 -07:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call .copypals
|
|
|
|
push hl
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wBGPals1 palette PAL_BG_TEXT
|
2016-01-27 09:25:12 -08:00
|
|
|
ld bc, 1 palettes
|
2015-10-19 07:23:58 -07:00
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wBGPals2 palette PAL_BG_TEXT
|
2016-01-27 09:25:12 -08:00
|
|
|
ld bc, 1 palettes
|
2015-10-19 07:23:58 -07:00
|
|
|
call CopyBytes
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2020-08-03 14:41:01 -07:00
|
|
|
ld a, TRUE
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hCGBPalUpdate], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call DelayFrame
|
2017-12-24 15:11:17 -08:00
|
|
|
call BattleStart_CopyTilemapAtOnce
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.nextscene
|
2015-10-19 07:23:58 -07:00
|
|
|
call StartTrainerBattle_NextScene
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.copypals
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wBGPals1 palette PAL_BG_TEXT
|
2015-10-19 07:23:58 -07:00
|
|
|
call .copy
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wBGPals2 palette PAL_BG_TEXT
|
2015-10-19 07:23:58 -07:00
|
|
|
call .copy
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wOBPals1 palette PAL_OW_TREE
|
2015-10-19 07:23:58 -07:00
|
|
|
call .copy
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wOBPals2 palette PAL_OW_TREE
|
2015-10-19 07:23:58 -07:00
|
|
|
call .copy
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wOBPals1 palette PAL_OW_ROCK
|
2015-10-19 07:23:58 -07:00
|
|
|
call .copy
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wOBPals2 palette PAL_OW_ROCK
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.copy
|
2015-10-19 07:23:58 -07:00
|
|
|
push hl
|
2016-01-27 09:25:12 -08:00
|
|
|
ld bc, 1 palettes
|
2015-10-19 07:23:58 -07:00
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.pals:
|
2020-08-11 11:12:59 -07:00
|
|
|
INCLUDE "gfx/overworld/trainer_battle.pal"
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.darkpals:
|
2020-08-11 11:12:59 -07:00
|
|
|
INCLUDE "gfx/overworld/trainer_battle_dark.pal"
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2020-10-19 17:27:19 -07:00
|
|
|
.loadpokeballgfx:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wOtherTrainerClass]
|
2015-10-19 07:23:58 -07:00
|
|
|
ld de, PokeBallTransition
|
|
|
|
ret
|
|
|
|
|
|
|
|
PokeBallTransition:
|
2018-09-09 15:25:43 -07:00
|
|
|
; 16x16 overlay of a Poke Ball
|
2018-09-09 15:15:54 -07:00
|
|
|
pusho
|
|
|
|
opt b.X ; . = 0, X = 1
|
2018-09-09 15:25:43 -07:00
|
|
|
bigdw %......XXXX......
|
|
|
|
bigdw %....XXXXXXXX....
|
|
|
|
bigdw %..XXXX....XXXX..
|
|
|
|
bigdw %..XX........XX..
|
|
|
|
bigdw %.XX..........XX.
|
|
|
|
bigdw %.XX...XXXX...XX.
|
|
|
|
bigdw %XX...XX..XX...XX
|
|
|
|
bigdw %XXXXXX....XXXXXX
|
|
|
|
bigdw %XXXXXX....XXXXXX
|
|
|
|
bigdw %XX...XX..XX...XX
|
|
|
|
bigdw %.XX...XXXX...XX.
|
|
|
|
bigdw %.XX..........XX.
|
|
|
|
bigdw %..XX........XX..
|
|
|
|
bigdw %..XXXX....XXXX..
|
|
|
|
bigdw %....XXXXXXXX....
|
|
|
|
bigdw %......XXXX......
|
2018-09-09 15:15:54 -07:00
|
|
|
popo
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
WipeLYOverrides:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2015-10-19 07:23:58 -07:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wLYOverrides)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-11-16 08:53:26 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wLYOverrides
|
2015-10-19 07:23:58 -07:00
|
|
|
call .wipe
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wLYOverridesBackup
|
2015-10-19 07:23:58 -07:00
|
|
|
call .wipe
|
2015-11-16 08:53:26 -08:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.wipe
|
2015-10-19 07:23:58 -07:00
|
|
|
xor a
|
|
|
|
ld c, SCREEN_HEIGHT_PX
|
|
|
|
.loop
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_DrawSineWave:
|
2018-02-03 18:11:55 -08:00
|
|
|
calc_sine_wave
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StartTrainerBattle_ZoomToBlack:
|
2022-08-06 21:38:08 -07:00
|
|
|
vc_hook Stop_reducing_battle_transition_flashing_ZoomToBlack
|
2020-10-22 18:25:40 -07:00
|
|
|
farcall RespawnPlayerAndOpponent
|
2015-10-19 07:23:58 -07:00
|
|
|
ld de, .boxes
|
|
|
|
|
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
inc de
|
|
|
|
ld c, a
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld l, a
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld h, a
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-19 07:23:58 -07:00
|
|
|
call .Copy
|
|
|
|
call WaitBGMap
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
2018-04-05 08:44:02 -07:00
|
|
|
ld a, BATTLETRANSITION_FINISH
|
2015-10-24 16:49:19 -07:00
|
|
|
ld [wJumptableIndex], a
|
2015-10-19 07:23:58 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.boxes
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO zoombox
|
2017-12-13 21:36:24 -08:00
|
|
|
; width, height, start y, start x
|
|
|
|
db \1, \2
|
|
|
|
dwcoord \3, \4
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2015-10-19 07:23:58 -07:00
|
|
|
zoombox 4, 2, 8, 8
|
|
|
|
zoombox 6, 4, 7, 7
|
|
|
|
zoombox 8, 6, 6, 6
|
|
|
|
zoombox 10, 8, 5, 5
|
|
|
|
zoombox 12, 10, 4, 4
|
|
|
|
zoombox 14, 12, 3, 3
|
|
|
|
zoombox 16, 14, 2, 2
|
|
|
|
zoombox 18, 16, 1, 1
|
|
|
|
zoombox 20, 18, 0, 0
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Copy:
|
2019-06-30 11:20:25 -07:00
|
|
|
ld a, BATTLETRANSITION_BLACK
|
2015-10-19 07:23:58 -07:00
|
|
|
.row
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
.col
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .col
|
|
|
|
pop hl
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .row
|
|
|
|
ret
|
2017-12-15 17:10:54 -08:00
|
|
|
|
2020-10-05 13:15:57 -07:00
|
|
|
UnusedWaitBGMapOnce: ; unreferenced
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, 1
|
2020-10-05 13:15:57 -07:00
|
|
|
ldh [hBGMapMode], a ; redundant
|
2017-12-15 17:10:54 -08:00
|
|
|
call WaitBGMap
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2017-12-15 17:10:54 -08:00
|
|
|
ret
|