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

View file

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

View file

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

View file

@ -4,62 +4,68 @@ ChangeBGPalColor0_4Frames: ; 480eb (12:40eb)
ld a, [rBGP]
or b
ld [rBGP], a
ld c, 4
ld c, $4
call DelayFrames
ld a, [rBGP]
and %11111100
ld [rBGP], a
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
ld a, $1
ld [wd0a0], a
ld a, 1
ld [wDisableVBlankWYUpdate], a
xor a
.asm_48108
ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND)
call Func_48119
call Func_48119
.loop
ld [$ff96], a
call .MutateWY
call .MutateWY
dec b
ld a, b
jr nz, .asm_48108
jr nz, .loop
xor a
ld [wd0a0], a
ld [wDisableVBlankWYUpdate], a
ret
Func_48119: ; 48119 (12:4119)
ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND)
.MutateWY ; 48119 (12:4119)
ld a, [$ff96]
xor b
ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND)
ld [$ff96], a
ld [rWY], a
ld c, 3
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
xor a
.asm_48129
.loop
ld [$ff97], a
call Func_4813f
call .MutateWX
ld c, 1
call DelayFrames
call Func_4813f
call .MutateWX
dec b
ld a, b
jr nz, .asm_48129
ld a, $7
jr nz, .loop
; restore normal WX
ld a, 7
ld [rWX], a
ret
Func_4813f: ; 4813f (12:413f)
.MutateWX ; 4813f (12:413f)
ld a, [$ff97]
xor b
ld [$ff97], a
bit 7, a
jr z, .asm_48149
xor a
.asm_48149
add $7
jr z, .skipZeroing
xor a ; zero a if it's negative
.skipZeroing
add 7
ld [rWX], a
ld c, 4
jp DelayFrames

View file

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

View file

@ -1223,7 +1223,7 @@ W_FBMODE:: ; d09e
wNewTileBlockID:: ; d09f
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
ds 1