Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; by pigdevil2010
- ; memory address corresponds to Patch 4.7.1
- ; TPPRedTransitionTiles is http://i.imgur.com/RdK7Xvb.png
- BattleTransition_TPPRed: ; b69c7 (2d:69c7)
- ; duration may not be accurate because of some
- ; long-running codes like random tiles generation
- ; prepare for animation #1
- ; duration - 7 frames (0.12 seconds)
- ld hl, vChars2 + $500 ; $9500 | tile number $50
- ld de, TPPRedTransitionTiles ; $607d
- ld bc, (BANK(TPPRedTransitionTiles) << 8) + $08 ; $2d08 | bank $2d, 8 tiles long
- call CopyVideoDataDouble ; $1899
- xor a
- ld [H_AUTOBGTRANSFERDEST], a ; $ffbc
- ld [hSCX], a ; $ffae
- ld [hSCY], a ; $ffaf
- ld a, vBGMap0 / $100 ; $98
- ld [H_AUTOBGTRANSFERDEST + 1], a ; $ffbd
- ld a, 1 ; enable automatic background transfer
- ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
- call Delay3 ; $3e0a | copy current tiles to the BGMap0 too
- ld a, $90 ; get rid of a window, it will be used for black scrolling
- ld [hWY], a ; $ffb0
- ld a, vBGMap1 / $100 ; $9c
- ld [H_AUTOBGTRANSFERDEST + 1], a ; $ffbd
- ; fill BGMap1 with black tiles
- ld hl, wTileMap ; $c3a0
- ld bc, 20 * 18
- ld a, $57 ; black tile
- call FillMemory ; $377b
- call Delay3 ; $3e0a | wait for transfer to complete
- ; animation #1 - black wipe from bottom
- ; duration - 48 frames (0.8 seconds)
- ld b, $90
- .anim1loop
- call DelayFrame ; $20cb
- ld a, b
- ld [hWY], a ; $ffb0
- sub 3
- ld b, a
- jr nc, .anim1loop
- xor a
- ld [hWY], a ; $ffb0
- call DelayFrame ; $20cb
- ; prepare for animation #2
- ; duration - 6 frames (0.1 seconds)
- ld a, vBGMap0 / $100 ; $98
- ld [H_AUTOBGTRANSFERDEST + 1], a ; $ffbd
- call GenRandomCommandTiles ; $6a57
- call Delay3 ; $3e0a | wait for transfer to complete
- ; since wTileMap is only 18 rows long, we need to do this
- ; because the BG map is 32 rows long
- ld a, (vBGMap0 + $1c0) / $100 ; $99
- ld [H_AUTOBGTRANSFERDEST + 1], a ; $ffbd
- ld a, (vBGMap0 + $1c0) % $100 ; $c0
- ld [H_AUTOBGTRANSFERDEST], a ; $ffbc
- call GenRandomCommandTiles ; $6a57
- call Delay3 ; $3e0a wait for transfer to complete
- xor a
- ld [H_AUTOBGTRANSFERENABLED], a ; $ffba | no more transfers needed now
- ; animation #2 - revealing the command chaos
- ; duration - 144 frames (2.4 seconds)
- ld bc, 0 ; b = hWY, c = frame count
- ld de, $1 ; d = hSCY, e = rate
- .anim2loop
- call DelayFrameWithCommandChaos ; $6a77
- ld a, b
- ld [hWY], a ; $ffb0
- inc b
- ld a, b
- cp $90
- jr nz, .anim2loop
- ld [hWY], a ; $ffb0
- ; animation #3 - increasing the command chaos speed
- ; duration - 288 frames (4.8 seconds)
- ld c, 0 ; reset the counter
- .anim3loop
- call DelayFrameWithCommandChaos ; $6a77
- ld a, c
- and $1f ; increase every 32 frames
- jr nz, .anim3loop
- inc e
- ld a, e
- cp 10 ; do this until the rate is 9
- jr nz, .anim3loop
- ; restore the original transfer destination
- ld a, vBGMap1 / $100 ; $9c
- ld [H_AUTOBGTRANSFERDEST + 1], a ; $ffbd
- xor a
- ld [H_AUTOBGTRANSFERDEST], a ; $ffbc
- jp GBFadeOutToWhite ; $20f4
- GenRandomCommandTiles: ; b6a57 (2d:6a57)
- ; used for TPP Red battle transition
- ld hl, wTileMap ; c3a0
- ld d, 20 * 18 / 2
- .loop
- ; quick dsum random
- ld a, [rDIV] ; $ff04
- ld b, a
- ld a, [hRandomAdd] ; $ffd3
- adc b
- ld [hRandomAdd], a ; $ffd3
- ld b, a
- ld a, b
- and $7 ; 8 tiles
- add $50 ; tile number $50 - $57
- ld [hli], a
- ld a, b
- swap a
- and $7
- add $50
- ld [hli], a
- dec d
- jr nz, .loop
- ret
- DelayFrameWithCommandChaos: ; b6a77 (2d:6a77)
- ; used for TPP Red battle transition
- inc c
- ld a, d
- add e
- ld [hSCY], a ; $ffaf
- ld d, a
- jp DelayFrame ; $20cb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement