summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-07-12 16:24:03 -0700
committerYamaArashi <shadow962@live.com>2015-07-12 16:24:03 -0700
commit849b53623b2ace56ef40b7bbdefe29a86e10162e (patch)
treebb51d26ff10480cdba37a27d38f266eb1c4057c8
parenta957bb154046427966d6e00de526adab13388938 (diff)
shake screen functions
-rwxr-xr-xengine/battle/animations.asm8
-rwxr-xr-xengine/battle/core.asm2
-rwxr-xr-xengine/predefs.asm4
-rwxr-xr-xengine/predefs12.asm54
-rw-r--r--home/vblank.asm2
-rwxr-xr-xwram.asm2
6 files changed, 39 insertions, 33 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 939c8db0..8b3b9147 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -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
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index db1ebd32..364b184b 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -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
diff --git a/engine/predefs.asm b/engine/predefs.asm
index 90065d51..a8aba971 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -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
diff --git a/engine/predefs12.asm b/engine/predefs12.asm
index f318447e..9731134f 100755
--- a/engine/predefs12.asm
+++ b/engine/predefs12.asm
@@ -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
diff --git a/home/vblank.asm b/home/vblank.asm
index d8288187..9adf537c 100644
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -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]
diff --git a/wram.asm b/wram.asm
index 2fbbd7ec..83aa4e60 100755
--- a/wram.asm
+++ b/wram.asm
@@ -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