shake screen functions

This commit is contained in:
YamaArashi 2015-07-12 16:24:03 -07:00
parent a957bb1540
commit 849b53623b
6 changed files with 39 additions and 33 deletions

View file

@ -835,9 +835,9 @@ DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9)
; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically ; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically
.shakeScreen .shakeScreen
ld b,1 ld b,1
predef Func_48125 ; shake horizontally predef PredefShakeScreenHorizontally ; shake horizontally
ld b,1 ld b,1
predef_jump Func_480ff ; shake vertically predef_jump PredefShakeScreenVertically ; shake vertically
FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7) FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7)
ld a,[W_SUBANIMCOUNTER] ld a,[W_SUBANIMCOUNTER]
@ -1225,14 +1225,14 @@ SetAnimationBGPalette: ; 791fc (1e:51fc)
ld b, $5 ld b, $5
AnimationShakeScreenVertically: ; 79209 (1e:5209) AnimationShakeScreenVertically: ; 79209 (1e:5209)
predef_jump Func_480ff predef_jump PredefShakeScreenVertically
AnimationShakeScreen: ; 7920e (1e:520e) AnimationShakeScreen: ; 7920e (1e:520e)
; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations. ; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations.
ld b, $8 ld b, $8
AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210) AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210)
predef_jump Func_48125 predef_jump PredefShakeScreenHorizontally
AnimationWaterDropletsEverywhere: ; 79215 (1e:5215) AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
; Draws water droplets all over the screen and makes them ; Draws water droplets all over the screen and makes them

View file

@ -3958,7 +3958,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
ld hl, KeptGoingAndCrashedText ld hl, KeptGoingAndCrashedText
call PrintText call PrintText
ld b, $4 ld b, $4
predef Func_48125 predef PredefShakeScreenHorizontally
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr nz, .enemyTurn jr nz, .enemyTurn

View file

@ -85,10 +85,10 @@ PredefPointers:: ; 4fe79 (13:7e79)
dbw $03,GiveItem dbw $03,GiveItem
add_predef ChangeBGPalColor0_4Frames add_predef ChangeBGPalColor0_4Frames
add_predef FindPathToPlayer add_predef FindPathToPlayer
add_predef Func_480ff add_predef PredefShakeScreenVertically
add_predef CalcPositionOfPlayerRelativeToNPC add_predef CalcPositionOfPlayerRelativeToNPC
add_predef ConvertNPCMovementDirectionsToJoypadMasks add_predef ConvertNPCMovementDirectionsToJoypadMasks
add_predef Func_48125 add_predef PredefShakeScreenHorizontally
add_predef UpdateHPBar add_predef UpdateHPBar
add_predef HPBarLength add_predef HPBarLength
add_predef Diploma_TextBoxBorder add_predef Diploma_TextBoxBorder

View file

@ -4,62 +4,68 @@ ChangeBGPalColor0_4Frames: ; 480eb (12:40eb)
ld a, [rBGP] ld a, [rBGP]
or b or b
ld [rBGP], a ld [rBGP], a
ld c, 4 ld c, $4
call DelayFrames call DelayFrames
ld a, [rBGP] ld a, [rBGP]
and %11111100 and %11111100
ld [rBGP], a ld [rBGP], a
ret ret
Func_480ff: ; 480ff (12:40ff) PredefShakeScreenVertically: ; 480ff (12:40ff)
; Moves the window down and then back in a sequence of progressively smaller
; numbers of pixels, starting at b.
call GetPredefRegisters call GetPredefRegisters
ld a, $1 ld a, 1
ld [wd0a0], a ld [wDisableVBlankWYUpdate], a
xor a xor a
.asm_48108 .loop
ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld [$ff96], a
call Func_48119 call .MutateWY
call Func_48119 call .MutateWY
dec b dec b
ld a, b ld a, b
jr nz, .asm_48108 jr nz, .loop
xor a xor a
ld [wd0a0], a ld [wDisableVBlankWYUpdate], a
ret ret
Func_48119: ; 48119 (12:4119) .MutateWY ; 48119 (12:4119)
ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) ld a, [$ff96]
xor b xor b
ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld [$ff96], a
ld [rWY], a ld [rWY], a
ld c, 3 ld c, 3
jp DelayFrames jp DelayFrames
Func_48125: ; 48125 (12:4125) PredefShakeScreenHorizontally: ; 48125 (12:4125)
; Moves the window right and then back in a sequence of progressively smaller
; numbers of pixels, starting at b.
call GetPredefRegisters call GetPredefRegisters
xor a xor a
.asm_48129 .loop
ld [$ff97], a ld [$ff97], a
call Func_4813f call .MutateWX
ld c, 1 ld c, 1
call DelayFrames call DelayFrames
call Func_4813f call .MutateWX
dec b dec b
ld a, b ld a, b
jr nz, .asm_48129 jr nz, .loop
ld a, $7
; restore normal WX
ld a, 7
ld [rWX], a ld [rWX], a
ret ret
Func_4813f: ; 4813f (12:413f) .MutateWX ; 4813f (12:413f)
ld a, [$ff97] ld a, [$ff97]
xor b xor b
ld [$ff97], a ld [$ff97], a
bit 7, a bit 7, a
jr z, .asm_48149 jr z, .skipZeroing
xor a xor a ; zero a if it's negative
.asm_48149 .skipZeroing
add $7 add 7
ld [rWX], a ld [rWX], a
ld c, 4 ld c, 4
jp DelayFrames jp DelayFrames

View file

@ -13,7 +13,7 @@ VBlank::
ld a, [hSCY] ld a, [hSCY]
ld [rSCY], a ld [rSCY], a
ld a, [wd0a0] ld a, [wDisableVBlankWYUpdate]
and a and a
jr nz, .ok jr nz, .ok
ld a, [hWY] ld a, [hWY]

View file

@ -1223,7 +1223,7 @@ W_FBMODE:: ; d09e
wNewTileBlockID:: ; d09f wNewTileBlockID:: ; d09f
wd09f:: ds 1 ; used with predef ReplaceTileBlock wd09f:: ds 1 ; used with predef ReplaceTileBlock
wd0a0:: ds 1 ; used in VBlank and ChangeBGPalColor0_4Frames wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank
W_SPRITECURPOSX:: ; d0a1 W_SPRITECURPOSX:: ; d0a1
ds 1 ds 1