pokered/engine/battle/battle_transitions.asm

822 lines
15 KiB
NASM
Raw Normal View History

2014-05-29 18:21:41 +00:00
BattleTransition: ; 7096d (1c:496d)
2015-07-23 13:07:12 +00:00
ld a, 1
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
call Delay3
xor a
2014-09-23 22:02:03 +00:00
ld [hWY], a
2014-05-22 22:13:20 +00:00
dec a
2014-09-13 07:50:56 +00:00
ld [wUpdateSpritesEnabled], a
2014-05-22 22:13:20 +00:00
call DelayFrame
2015-07-23 13:07:12 +00:00
; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one).
ld hl, wSpriteStateData1 + 2
2015-07-23 13:07:12 +00:00
ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
2014-05-22 22:13:20 +00:00
ld c, a
2015-07-23 13:07:12 +00:00
ld b, 0
2014-05-22 22:13:20 +00:00
ld de, $10
2014-05-29 18:21:41 +00:00
.loop1
2014-05-22 22:13:20 +00:00
ld a, [hl]
cp $ff
2014-05-29 18:21:41 +00:00
jr z, .skip1
2014-05-22 22:13:20 +00:00
inc b
2014-05-29 18:21:41 +00:00
.skip1
2014-05-22 22:13:20 +00:00
add hl, de
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop1
2015-07-23 13:07:12 +00:00
; Clear OAM except for the blocks used by the player and enemy trainer sprites.
ld hl, wOAMBuffer + $10
2015-07-23 13:07:12 +00:00
ld c, 9
2014-05-29 18:21:41 +00:00
.loop2
2014-05-22 22:13:20 +00:00
ld a, b
swap a
cp l
2015-07-23 13:07:12 +00:00
jr z, .skip2 ; skip clearing the block if the enemy trainer is using it
2014-05-22 22:13:20 +00:00
push hl
push bc
ld bc, $10
xor a
call FillMemory
pop bc
pop hl
2014-05-29 18:21:41 +00:00
.skip2
2014-05-22 22:13:20 +00:00
ld de, $10
add hl, de
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop2
2015-07-23 13:07:12 +00:00
2014-05-22 22:13:20 +00:00
call Delay3
call LoadBattleTransitionTile
2015-07-23 13:07:12 +00:00
ld bc, 0
2015-02-07 10:43:08 +00:00
ld a, [wLinkState]
cp LINK_STATE_BATTLING
2014-05-29 18:21:41 +00:00
jr z, .linkBattle
call GetBattleTransitionID_WildOrTrainer
call GetBattleTransitionID_CompareLevels
call GetBattleTransitionID_IsDungeonMap
.linkBattle
ld hl, BattleTransitions
2014-05-22 22:13:20 +00:00
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
2014-05-29 18:21:41 +00:00
; the three GetBattleTransitionID functions set the first
; three bits of c, which determines what transition animation
; to play at the beginning of a battle
; bit 0: set if trainer battle
; bit 1: set if enemy is at least 3 levels higher than player
; bit 2: set if dungeon map
BattleTransitions: ; 709d2 (1c:49d2)
dw BattleTransition_DoubleCircle ; %000
dw BattleTransition_Spiral ; %001
dw BattleTransition_Circle ; %010
dw BattleTransition_Spiral ; %011
dw BattleTransition_HorizontalStripes ; %100
dw BattleTransition_Shrink ; %101
dw BattleTransition_VerticalStripes ; %110
dw BattleTransition_Split ; %111
GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2)
ld a, [W_CUROPPONENT]
2014-05-22 22:13:20 +00:00
cp $c8
2014-05-29 18:21:41 +00:00
jr nc, .trainer
2014-05-22 22:13:20 +00:00
res 0, c
ret
2014-05-29 18:21:41 +00:00
.trainer
2014-05-22 22:13:20 +00:00
set 0, c
ret
2014-05-29 18:21:41 +00:00
GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef)
ld hl, wPartyMon1HP
2014-05-29 18:21:41 +00:00
.faintedLoop
2014-05-22 22:13:20 +00:00
ld a, [hli]
or [hl]
2014-05-29 18:21:41 +00:00
jr nz, .notFainted
ld de, wPartyMon2 - (wPartyMon1 + 1)
2014-05-22 22:13:20 +00:00
add hl, de
2014-05-29 18:21:41 +00:00
jr .faintedLoop
.notFainted
ld de, wPartyMon1Level - (wPartyMon1HP + 1)
2014-05-22 22:13:20 +00:00
add hl, de
ld a, [hl]
add $3
ld e, a
2014-05-29 18:21:41 +00:00
ld a, [W_CURENEMYLVL]
2014-05-22 22:13:20 +00:00
sub e
2014-05-29 18:21:41 +00:00
jr nc, .highLevelEnemy
2014-05-22 22:13:20 +00:00
res 1, c
2015-07-23 13:07:12 +00:00
ld a, 1
ld [wBattleTransitionSpiralDirection], a
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
.highLevelEnemy
2014-05-22 22:13:20 +00:00
set 1, c
xor a
ld [wBattleTransitionSpiralDirection], a
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
; fails to recognize VICTORY_ROAD_2, VICTORY_ROAD_3, all ROCKET_HIDEOUT maps,
2014-05-30 10:11:18 +00:00
; MANSION_1, SEAFOAM_ISLANDS_[2-5], POWER_PLANT, DIGLETTS_CAVE
; and SILPH_CO_[9-11]F as dungeon maps
2014-05-29 18:21:41 +00:00
GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19)
ld a, [W_CURMAP]
2014-05-22 22:13:20 +00:00
ld e, a
2014-05-29 18:21:41 +00:00
ld hl, DungeonMaps1
.loop1
2014-05-22 22:13:20 +00:00
ld a, [hli]
cp $ff
2014-05-29 18:21:41 +00:00
jr z, .noMatch1
2014-05-22 22:13:20 +00:00
cp e
2014-05-29 18:21:41 +00:00
jr nz, .loop1
.match
2014-05-22 22:13:20 +00:00
set 2, c
ret
2014-05-29 18:21:41 +00:00
.noMatch1
ld hl, DungeonMaps2
.loop2
2014-05-22 22:13:20 +00:00
ld a, [hli]
cp $ff
2014-05-29 18:21:41 +00:00
jr z, .noMatch2
2014-05-22 22:13:20 +00:00
ld d, a
ld a, [hli]
cp e
2014-05-29 18:21:41 +00:00
jr c, .loop2
2014-05-22 22:13:20 +00:00
ld a, e
cp d
2014-05-29 18:21:41 +00:00
jr nc, .match
.noMatch2
2014-05-22 22:13:20 +00:00
res 2, c
ret
2014-05-29 18:21:41 +00:00
; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP
; is equal to one of these maps
DungeonMaps1: ; 70a3f (1c:4a3f)
2014-05-22 22:13:20 +00:00
db VIRIDIAN_FOREST
db ROCK_TUNNEL_1
db SEAFOAM_ISLANDS_1
db ROCK_TUNNEL_2
db $FF
2014-05-29 18:21:41 +00:00
; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP
; is in between or equal to each pair of maps
DungeonMaps2: ; 70a44 (1c:4a44)
2014-05-22 22:13:20 +00:00
; all MT_MOON maps
db MT_MOON_1
db MT_MOON_3
; all SS_ANNE maps, VICTORY_ROAD_1, LANCES_ROOM, and HALL_OF_FAME
db SS_ANNE_1
db HALL_OF_FAME
; all POKEMONTOWER maps and Lavender Town buildings
db LAVENDER_POKECENTER
db LAVENDER_HOUSE_2
2014-05-30 10:11:18 +00:00
; SILPH_CO_[2-8]F, MANSION[2-4], SAFARI_ZONE, and UNKNOWN_DUNGEON maps,
2014-05-22 22:13:20 +00:00
; except for SILPH_CO_1F
db SILPH_CO_2F
db UNKNOWN_DUNGEON_1
db $FF
LoadBattleTransitionTile: ; 70a4d (1c:4a4d)
2014-05-29 08:31:46 +00:00
ld hl, vChars1 + $7f0
2014-05-29 18:21:41 +00:00
ld de, BattleTransitionTile
2014-05-22 22:13:20 +00:00
ld bc, (BANK(BattleTransitionTile) << 8) + $01
jp CopyVideoData
BattleTransitionTile: ; 70a59 (1c:4a59)
INCBIN "gfx/battle_transition.2bpp"
2014-05-29 18:21:41 +00:00
BattleTransition_BlackScreen: ; 70a69 (1c:4a69)
2014-05-22 22:13:20 +00:00
ld a, $ff
2015-02-08 00:24:16 +00:00
ld [rBGP], a
ld [rOBP0], a
ld [rOBP1], a
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
; for non-dungeon trainer battles
; called regardless of mon levels, but does an
; outward spiral if enemy is at least 3 levels
; higher than player and does an inward spiral otherwise
BattleTransition_Spiral: ; 70a72 (1c:4a72)
ld a, [wBattleTransitionSpiralDirection]
2014-05-22 22:13:20 +00:00
and a
2014-05-29 18:21:41 +00:00
jr z, .outwardSpiral
call BattleTransition_InwardSpiral
jr .done
.outwardSpiral
2015-07-18 20:52:03 +00:00
coord hl, 10, 10
2014-05-22 22:13:20 +00:00
ld a, $3
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralCurrentDirection], a
2014-05-22 22:13:20 +00:00
ld a, l
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralTileMapPointer + 1], a
2014-05-22 22:13:20 +00:00
ld a, h
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralTileMapPointer], a
ld b, 120
.loop
ld c, 3
.innerLoop
2014-05-22 22:13:20 +00:00
push bc
2014-05-29 18:21:41 +00:00
call BattleTransition_OutwardSpiral_
2014-05-22 22:13:20 +00:00
pop bc
dec c
2015-07-24 21:39:45 +00:00
jr nz, .innerLoop
2014-05-22 22:13:20 +00:00
call DelayFrame
dec b
2015-07-24 21:39:45 +00:00
jr nz, .loop
2014-05-29 18:21:41 +00:00
.done
call BattleTransition_BlackScreen
2014-05-22 22:13:20 +00:00
xor a
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralTileMapPointer + 1], a
ld [wOutwardSpiralTileMapPointer], a
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa)
2015-07-23 13:07:12 +00:00
ld a, 7
ld [wInwardSpiralUpdateScreenCounter], a
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-23 13:07:12 +00:00
ld c, SCREEN_HEIGHT - 1
2015-07-14 07:16:19 +00:00
ld de, SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
call BattleTransition_InwardSpiral_
2014-05-22 22:13:20 +00:00
inc c
2014-05-29 18:21:41 +00:00
jr .skip
.loop
2015-07-14 07:16:19 +00:00
ld de, SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
call BattleTransition_InwardSpiral_
.skip
2014-05-22 22:13:20 +00:00
inc c
2015-07-23 13:07:12 +00:00
ld de, 1
2014-05-29 18:21:41 +00:00
call BattleTransition_InwardSpiral_
2014-05-22 22:13:20 +00:00
dec c
dec c
2015-07-14 07:16:19 +00:00
ld de, -SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
call BattleTransition_InwardSpiral_
2014-05-22 22:13:20 +00:00
inc c
2015-07-14 07:16:19 +00:00
ld de, -1
2014-05-29 18:21:41 +00:00
call BattleTransition_InwardSpiral_
2014-05-22 22:13:20 +00:00
dec c
dec c
ld a, c
and a
2014-05-29 18:21:41 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0)
2014-05-22 22:13:20 +00:00
push bc
2014-05-29 18:21:41 +00:00
.loop
2014-05-22 22:13:20 +00:00
ld [hl], $ff
add hl, de
push bc
2015-07-23 13:07:12 +00:00
ld a, [wInwardSpiralUpdateScreenCounter]
2014-05-22 22:13:20 +00:00
dec a
2014-05-29 18:21:41 +00:00
jr nz, .skip
call BattleTransition_TransferDelay3
2015-07-23 13:07:12 +00:00
ld a, 7
2014-05-29 18:21:41 +00:00
.skip
2015-07-23 13:07:12 +00:00
ld [wInwardSpiralUpdateScreenCounter], a
2014-05-22 22:13:20 +00:00
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
pop bc
ret
2014-05-29 18:21:41 +00:00
BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9)
2015-07-14 07:16:19 +00:00
ld bc, -SCREEN_WIDTH
ld de, SCREEN_WIDTH
2015-07-24 21:39:45 +00:00
ld a, [wOutwardSpiralTileMapPointer + 1]
2014-05-22 22:13:20 +00:00
ld l, a
2015-07-24 21:39:45 +00:00
ld a, [wOutwardSpiralTileMapPointer]
2014-05-22 22:13:20 +00:00
ld h, a
2015-07-24 21:39:45 +00:00
ld a, [wOutwardSpiralCurrentDirection]
2014-05-22 22:13:20 +00:00
cp $0
2015-07-24 21:39:45 +00:00
jr z, .up
2014-05-22 22:13:20 +00:00
cp $1
2015-07-24 21:39:45 +00:00
jr z, .left
2014-05-22 22:13:20 +00:00
cp $2
2015-07-24 21:39:45 +00:00
jr z, .down
2014-05-22 22:13:20 +00:00
cp $3
2015-07-24 21:39:45 +00:00
jr z, .right
.keepSameDirection
2014-05-22 22:13:20 +00:00
ld [hl], $ff
2015-07-24 21:39:45 +00:00
.done
2014-05-22 22:13:20 +00:00
ld a, l
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralTileMapPointer + 1], a
2014-05-22 22:13:20 +00:00
ld a, h
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralTileMapPointer], a
2014-05-22 22:13:20 +00:00
ret
2015-07-24 21:39:45 +00:00
.up
2014-05-22 22:13:20 +00:00
dec hl
ld a, [hl]
cp $ff
2015-07-24 21:39:45 +00:00
jr nz, .changeDirection
2014-05-22 22:13:20 +00:00
inc hl
add hl, bc
2015-07-24 21:39:45 +00:00
jr .keepSameDirection
.left
2014-05-22 22:13:20 +00:00
add hl, de
ld a, [hl]
cp $ff
2015-07-24 21:39:45 +00:00
jr nz, .changeDirection
2014-05-22 22:13:20 +00:00
add hl, bc
dec hl
2015-07-24 21:39:45 +00:00
jr .keepSameDirection
.down
2014-05-22 22:13:20 +00:00
inc hl
ld a, [hl]
cp $ff
2015-07-24 21:39:45 +00:00
jr nz, .changeDirection
2014-05-22 22:13:20 +00:00
dec hl
add hl, de
2015-07-24 21:39:45 +00:00
jr .keepSameDirection
.right
2014-05-22 22:13:20 +00:00
add hl, bc
ld a, [hl]
cp $ff
2015-07-24 21:39:45 +00:00
jr nz, .changeDirection
2014-05-22 22:13:20 +00:00
add hl, de
inc hl
2015-07-24 21:39:45 +00:00
jr .keepSameDirection
.changeDirection
2014-05-22 22:13:20 +00:00
ld [hl], $ff
2015-07-24 21:39:45 +00:00
ld a, [wOutwardSpiralCurrentDirection]
2014-05-22 22:13:20 +00:00
inc a
cp $4
2014-05-29 18:21:41 +00:00
jr nz, .skip
2014-05-22 22:13:20 +00:00
xor a
2014-05-29 18:21:41 +00:00
.skip
2015-07-24 21:39:45 +00:00
ld [wOutwardSpiralCurrentDirection], a
jr .done
2014-05-22 22:13:20 +00:00
FlashScreen:
2014-05-29 18:21:41 +00:00
BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d)
ld hl, BattleTransition_FlashScreenPalettes
.loop
2014-05-22 22:13:20 +00:00
ld a, [hli]
cp $1
2014-05-29 18:21:41 +00:00
jr z, .done
ld [rBGP], a
ld c, 2
2014-05-22 22:13:20 +00:00
call DelayFrames
2014-05-29 18:21:41 +00:00
jr .loop
.done
2014-05-22 22:13:20 +00:00
dec b
2014-05-29 18:21:41 +00:00
jr nz, BattleTransition_FlashScreen_
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
BattleTransition_FlashScreenPalettes: ; 70b72 (1c:4b72)
2014-05-22 22:13:20 +00:00
db $F9,$FE,$FF,$FE,$F9,$E4,$90,$40,$00,$40,$90,$E4
db $01 ; terminator
2014-05-29 18:21:41 +00:00
; used for low level trainer dungeon battles
BattleTransition_Shrink: ; 70b7f (1c:4b7f)
2015-07-14 07:16:19 +00:00
ld c, SCREEN_HEIGHT / 2
2014-05-29 18:21:41 +00:00
.loop
2014-05-22 22:13:20 +00:00
push bc
xor a
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
2015-07-18 20:52:03 +00:00
coord hl, 0, 7
coord de, 0, 8
2015-07-14 07:16:19 +00:00
ld bc, -SCREEN_WIDTH * 2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles1
2015-07-18 20:52:03 +00:00
coord hl, 0, 10
coord de, 0, 9
2015-07-14 07:16:19 +00:00
ld bc, SCREEN_WIDTH * 2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles1
2015-07-18 20:52:03 +00:00
coord hl, 8, 0
coord de, 9, 0
2015-07-14 07:16:19 +00:00
ld bc, -2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles2
2015-07-18 20:52:03 +00:00
coord hl, 11, 0
coord de, 10, 0
2015-07-23 13:07:12 +00:00
ld bc, 2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles2
2014-05-22 22:13:20 +00:00
ld a, $1
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
ld c, 6
2014-05-22 22:13:20 +00:00
call DelayFrames
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
call BattleTransition_BlackScreen
ld c, 10
2014-05-22 22:13:20 +00:00
jp DelayFrames
2014-05-29 18:21:41 +00:00
; used for high level trainer dungeon battles
BattleTransition_Split: ; 70bca (1c:4bca)
2015-07-14 07:16:19 +00:00
ld c, SCREEN_HEIGHT / 2
2014-05-22 22:13:20 +00:00
xor a
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
.loop
2014-05-22 22:13:20 +00:00
push bc
2015-07-18 20:52:03 +00:00
coord hl, 0, 16
coord de, 0, 17
2015-07-14 07:16:19 +00:00
ld bc, -SCREEN_WIDTH * 2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles1
2015-07-18 20:52:03 +00:00
coord hl, 0, 1
coord de, 0, 0
2015-07-14 07:16:19 +00:00
ld bc, SCREEN_WIDTH * 2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles1
2015-07-18 20:52:03 +00:00
coord hl, 18, 0
coord de, 19, 0
2015-07-14 07:16:19 +00:00
ld bc, -2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles2
2015-07-18 20:52:03 +00:00
coord hl, 1, 0
coord de, 0, 0
2015-07-23 13:07:12 +00:00
ld bc, 2
2014-05-29 18:21:41 +00:00
call BattleTransition_CopyTiles2
call BattleTransition_TransferDelay3
2014-05-22 22:13:20 +00:00
call Delay3
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
call BattleTransition_BlackScreen
ld c, 10
2014-05-22 22:13:20 +00:00
jp DelayFrames
2014-05-29 18:21:41 +00:00
BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)
2014-05-22 22:13:20 +00:00
ld a, c
2015-07-23 13:07:12 +00:00
ld [wBattleTransitionCopyTilesOffset], a
2014-05-22 22:13:20 +00:00
ld a, b
2015-07-23 13:07:12 +00:00
ld [wBattleTransitionCopyTilesOffset + 1], a
ld c, 8
2014-05-29 18:21:41 +00:00
.loop1
2014-05-22 22:13:20 +00:00
push bc
push hl
push de
2015-07-14 07:16:19 +00:00
ld bc, SCREEN_WIDTH
2014-05-22 22:13:20 +00:00
call CopyData
pop hl
pop de
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCopyTilesOffset]
2014-05-22 22:13:20 +00:00
ld c, a
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCopyTilesOffset + 1]
2014-05-22 22:13:20 +00:00
ld b, a
add hl, bc
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop1
2014-05-22 22:13:20 +00:00
ld l, e
ld h, d
ld a, $ff
2015-07-14 07:16:19 +00:00
ld c, SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
.loop2
2014-05-22 22:13:20 +00:00
ld [hli], a
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop2
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f)
2014-05-22 22:13:20 +00:00
ld a, c
2015-07-23 13:07:12 +00:00
ld [wBattleTransitionCopyTilesOffset], a
2014-05-22 22:13:20 +00:00
ld a, b
2015-07-23 13:07:12 +00:00
ld [wBattleTransitionCopyTilesOffset + 1], a
2015-07-14 07:16:19 +00:00
ld c, SCREEN_HEIGHT / 2
2014-05-29 18:21:41 +00:00
.loop1
2014-05-22 22:13:20 +00:00
push bc
push hl
push de
2015-07-14 07:16:19 +00:00
ld c, SCREEN_HEIGHT
2014-05-29 18:21:41 +00:00
.loop2
2014-05-22 22:13:20 +00:00
ld a, [hl]
ld [de], a
ld a, e
2015-07-14 07:16:19 +00:00
add SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
jr nc, .noCarry1
2014-05-22 22:13:20 +00:00
inc d
2014-05-29 18:21:41 +00:00
.noCarry1
2014-05-22 22:13:20 +00:00
ld e, a
ld a, l
2015-07-14 07:16:19 +00:00
add SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
jr nc, .noCarry2
2014-05-22 22:13:20 +00:00
inc h
2014-05-29 18:21:41 +00:00
.noCarry2
2014-05-22 22:13:20 +00:00
ld l, a
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop2
2014-05-22 22:13:20 +00:00
pop hl
pop de
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCopyTilesOffset]
2014-05-22 22:13:20 +00:00
ld c, a
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCopyTilesOffset + 1]
2014-05-22 22:13:20 +00:00
ld b, a
add hl, bc
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop1
2014-05-22 22:13:20 +00:00
ld l, e
ld h, d
2015-07-14 07:16:19 +00:00
ld de, SCREEN_WIDTH
ld c, SCREEN_HEIGHT
2014-05-29 18:21:41 +00:00
.loop3
2014-05-22 22:13:20 +00:00
ld [hl], $ff
add hl, de
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop3
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
; used for high level wild dungeon battles
BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e)
2015-07-14 07:16:19 +00:00
ld c, SCREEN_HEIGHT
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
coord de, 1, 17
2014-05-22 22:13:20 +00:00
xor a
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
.loop
2014-05-22 22:13:20 +00:00
push bc
push hl
push de
push de
2014-05-29 18:21:41 +00:00
call BattleTransition_VerticalStripes_
2014-05-22 22:13:20 +00:00
pop hl
2014-05-29 18:21:41 +00:00
call BattleTransition_VerticalStripes_
call BattleTransition_TransferDelay3
2014-05-22 22:13:20 +00:00
pop hl
2015-07-14 07:16:19 +00:00
ld bc, -SCREEN_WIDTH
2014-05-22 22:13:20 +00:00
add hl, bc
ld e, l
ld d, h
pop hl
2015-07-14 07:16:19 +00:00
ld bc, SCREEN_WIDTH
2014-05-22 22:13:20 +00:00
add hl, bc
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
jp BattleTransition_BlackScreen
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_VerticalStripes_: ; 70caa (1c:4caa)
2015-07-14 07:16:19 +00:00
ld c, SCREEN_WIDTH / 2
2014-05-29 18:21:41 +00:00
.loop
2014-05-22 22:13:20 +00:00
ld [hl], $ff
inc hl
inc hl
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
; used for low level wild dungeon battles
BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4)
2015-07-14 07:16:19 +00:00
ld c, SCREEN_WIDTH
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
coord de, 19, 1
2014-05-22 22:13:20 +00:00
xor a
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
.loop
2014-05-22 22:13:20 +00:00
push bc
push hl
push de
push de
2014-05-29 18:21:41 +00:00
call BattleTransition_HorizontalStripes_
2014-05-22 22:13:20 +00:00
pop hl
2014-05-29 18:21:41 +00:00
call BattleTransition_HorizontalStripes_
call BattleTransition_TransferDelay3
2014-05-22 22:13:20 +00:00
pop de
pop hl
pop bc
inc hl
dec de
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
jp BattleTransition_BlackScreen
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8)
2015-07-14 07:16:19 +00:00
ld c, SCREEN_HEIGHT / 2
ld de, SCREEN_WIDTH * 2
2014-05-29 18:21:41 +00:00
.loop
2014-05-22 22:13:20 +00:00
ld [hl], $ff
add hl, de
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
; used for high level wild non-dungeon battles
; makes one full circle around the screen
; by animating each half circle one at a time
BattleTransition_Circle: ; 70ce4 (1c:4ce4)
call BattleTransition_FlashScreen
2015-07-23 13:07:12 +00:00
lb bc, 0, SCREEN_WIDTH / 2
2014-05-29 18:21:41 +00:00
ld hl, BattleTransition_HalfCircle1
call BattleTransition_Circle_Sub1
2015-07-14 07:16:19 +00:00
ld c, SCREEN_WIDTH / 2
2015-07-23 13:07:12 +00:00
ld b, 1
2014-05-29 18:21:41 +00:00
ld hl, BattleTransition_HalfCircle2
call BattleTransition_Circle_Sub1
jp BattleTransition_BlackScreen
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_FlashScreen: ; 70cfd (1c:4cfd)
2014-05-22 22:13:20 +00:00
ld b, $3
2014-05-29 18:21:41 +00:00
call BattleTransition_FlashScreen_
2014-05-22 22:13:20 +00:00
xor a
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06)
2014-05-22 22:13:20 +00:00
push bc
push hl
ld a, b
2014-05-29 18:21:41 +00:00
call BattleTransition_Circle_Sub2
2014-05-22 22:13:20 +00:00
pop hl
2015-07-23 13:07:12 +00:00
ld bc, 5
2014-05-22 22:13:20 +00:00
add hl, bc
2014-05-29 18:21:41 +00:00
call BattleTransition_TransferDelay3
2014-05-22 22:13:20 +00:00
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, BattleTransition_Circle_Sub1
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
BattleTransition_TransferDelay3: ; 70d19 (1c:4d19)
2015-07-23 13:07:12 +00:00
ld a, 1
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
call Delay3
xor a
2014-05-29 18:21:41 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
ret
2014-05-29 18:21:41 +00:00
; used for low level wild non-dungeon battles
; makes two half circles around the screen
; by animating both half circles at the same time
BattleTransition_DoubleCircle: ; 70d24 (1c:4d24)
call BattleTransition_FlashScreen
2015-07-14 07:16:19 +00:00
ld c, SCREEN_WIDTH / 2
2014-05-29 18:21:41 +00:00
ld hl, BattleTransition_HalfCircle1
ld de, BattleTransition_HalfCircle2
.loop
2014-05-22 22:13:20 +00:00
push bc
push hl
push de
push de
xor a
2014-05-29 18:21:41 +00:00
call BattleTransition_Circle_Sub2
2014-05-22 22:13:20 +00:00
pop hl
ld a, $1
2014-05-29 18:21:41 +00:00
call BattleTransition_Circle_Sub2
2014-05-22 22:13:20 +00:00
pop hl
2015-07-23 13:07:12 +00:00
ld bc, 5
2014-05-22 22:13:20 +00:00
add hl, bc
ld e, l
ld d, h
pop hl
add hl, bc
2014-05-29 18:21:41 +00:00
call BattleTransition_TransferDelay3
2014-05-22 22:13:20 +00:00
pop bc
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop
jp BattleTransition_BlackScreen
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50)
2015-07-23 13:07:12 +00:00
ld [wBattleTransitionCircleScreenQuadrantY], a
2014-05-22 22:13:20 +00:00
ld a, [hli]
2015-07-23 13:07:12 +00:00
ld [wBattleTransitionCircleScreenQuadrantX], a
2014-05-22 22:13:20 +00:00
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
2014-05-29 18:21:41 +00:00
jp BattleTransition_Circle_Sub3
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_HalfCircle1: ; 70d61 (1c:4d61)
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData1
dwCoord 18, 6
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData2
dwCoord 19, 3
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData3
dwCoord 18, 0
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData4
dwCoord 14, 0
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData5
dwCoord 10, 0
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData5
dwCoord 9, 0
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData4
dwCoord 5, 0
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData3
dwCoord 1, 0
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData2
dwCoord 0, 3
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData1
dwCoord 1, 6
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_HalfCircle2: ; 70d93 (1c:4d93)
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData1
dwCoord 1, 11
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData2
dwCoord 0, 14
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData3
dwCoord 1, 17
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData4
dwCoord 5, 17
2014-05-22 22:13:20 +00:00
db $00
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData5
dwCoord 9, 17
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData5
dwCoord 10, 17
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData4
dwCoord 14, 17
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData3
dwCoord 18, 17
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData2
dwCoord 19, 14
2014-05-22 22:13:20 +00:00
db $01
2014-05-29 18:21:41 +00:00
dw BattleTransition_CircleData1
dwCoord 18, 11
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)
2014-05-22 22:13:20 +00:00
push hl
ld a, [de]
ld c, a
inc de
2014-05-29 18:21:41 +00:00
.loop1
2014-05-22 22:13:20 +00:00
ld [hl], $ff
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCircleScreenQuadrantX]
2014-05-22 22:13:20 +00:00
and a
2014-05-29 18:21:41 +00:00
jr z, .skip1
2014-05-22 22:13:20 +00:00
inc hl
2014-05-29 18:21:41 +00:00
jr .skip2
.skip1
2014-05-22 22:13:20 +00:00
dec hl
2014-05-29 18:21:41 +00:00
.skip2
2014-05-22 22:13:20 +00:00
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop1
2014-05-22 22:13:20 +00:00
pop hl
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCircleScreenQuadrantY]
2014-05-22 22:13:20 +00:00
and a
2015-07-14 07:16:19 +00:00
ld bc, SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
jr z, .skip3
2015-07-14 07:16:19 +00:00
ld bc, -SCREEN_WIDTH
2014-05-29 18:21:41 +00:00
.skip3
2014-05-22 22:13:20 +00:00
add hl, bc
ld a, [de]
inc de
cp $ff
ret z
and a
2014-05-29 18:21:41 +00:00
jr z, BattleTransition_Circle_Sub3
2014-05-22 22:13:20 +00:00
ld c, a
2014-05-29 18:21:41 +00:00
.loop2
2015-07-23 13:07:12 +00:00
ld a, [wBattleTransitionCircleScreenQuadrantX]
2014-05-22 22:13:20 +00:00
and a
2014-05-29 18:21:41 +00:00
jr z, .skip4
2014-05-22 22:13:20 +00:00
dec hl
2014-05-29 18:21:41 +00:00
jr .skip5
.skip4
2014-05-22 22:13:20 +00:00
inc hl
2014-05-29 18:21:41 +00:00
.skip5
2014-05-22 22:13:20 +00:00
dec c
2014-05-29 18:21:41 +00:00
jr nz, .loop2
jr BattleTransition_Circle_Sub3
2014-05-22 22:13:20 +00:00
2014-05-29 18:21:41 +00:00
BattleTransition_CircleData1: ; 70dfe (1c:4dfe)
2014-05-22 22:13:20 +00:00
db $02,$03,$05,$04,$09,$FF
2014-05-29 18:21:41 +00:00
BattleTransition_CircleData2: ; 70e04 (1c:4e04)
2014-05-22 22:13:20 +00:00
db $01,$01,$02,$02,$04,$02,$04,$02,$03,$FF
2014-05-29 18:21:41 +00:00
BattleTransition_CircleData3: ; 70e0e (1c:4e0e)
2014-05-22 22:13:20 +00:00
db $02,$01,$03,$01,$04,$01,$04,$01,$04,$01,$03,$01,$02,$01,$01,$01,$01,$FF
2014-05-29 18:21:41 +00:00
BattleTransition_CircleData4: ; 70e20 (1c:4e20)
2014-05-22 22:13:20 +00:00
db $04,$01,$04,$00,$03,$01,$03,$00,$02,$01,$02,$00,$01,$FF
2014-05-29 18:21:41 +00:00
BattleTransition_CircleData5: ; 70e2e (1c:4e2e)
2014-05-22 22:13:20 +00:00
db $04,$00,$03,$00,$03,$00,$02,$00,$02,$00,$01,$00,$01,$00,$01,$FF