aboutsummaryrefslogtreecommitdiffstats
path: root/engine/overworld/dust_smoke.asm
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-03 09:38:52 -0400
committerGitHub <noreply@github.com>2020-07-03 09:38:52 -0400
commitc85050497c1bd062e9cd40bf5b32fa3beca366cc (patch)
tree9593ddd3ab820223ab580d5fc0ae133b485b8315 /engine/overworld/dust_smoke.asm
parentActually run .travis/webhook.sh (diff)
parentAdd engine/movie/oak_speech/ subdirectory (diff)
downloadpokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.gz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.xz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.zip
Merge pull request #256 from Rangi42/master
Add subdirectories to engine/ similar to pokecrystal
Diffstat (limited to 'engine/overworld/dust_smoke.asm')
-rwxr-xr-xengine/overworld/dust_smoke.asm93
1 files changed, 93 insertions, 0 deletions
diff --git a/engine/overworld/dust_smoke.asm b/engine/overworld/dust_smoke.asm
new file mode 100755
index 00000000..6c26b712
--- /dev/null
+++ b/engine/overworld/dust_smoke.asm
@@ -0,0 +1,93 @@
+AnimateBoulderDust:
+ ld a, $1
+ ld [wWhichAnimationOffsets], a ; select the boulder dust offsets
+ ld a, [wUpdateSpritesEnabled]
+ push af
+ ld a, $ff
+ ld [wUpdateSpritesEnabled], a
+ ld a, %11100100
+ ld [rOBP1], a
+ call LoadSmokeTileFourTimes
+ callba WriteCutOrBoulderDustAnimationOAMBlock
+ ld c, 8 ; number of steps in animation
+.loop
+ push bc
+ call GetMoveBoulderDustFunctionPointer
+ ld bc, .returnAddress
+ push bc
+ ld c, 4
+ jp hl
+.returnAddress
+ ld a, [rOBP1]
+ xor %01100100
+ ld [rOBP1], a
+ call Delay3
+ pop bc
+ dec c
+ jr nz, .loop
+ pop af
+ ld [wUpdateSpritesEnabled], a
+ jp LoadPlayerSpriteGraphics
+
+GetMoveBoulderDustFunctionPointer:
+ ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
+ ld hl, MoveBoulderDustFunctionPointerTable
+ ld c, a
+ ld b, $0
+ add hl, bc
+ ld a, [hli]
+ ld [wCoordAdjustmentAmount], a
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ push hl
+ ld hl, wOAMBuffer + $90
+ ld d, $0
+ add hl, de
+ ld e, l
+ ld d, h
+ pop hl
+ ret
+
+MoveBoulderDustFunctionPointerTable:
+; facing down
+ db $FF,$00
+ dw AdjustOAMBlockYPos
+
+; facing up
+ db $01,$00
+ dw AdjustOAMBlockYPos
+
+; facing left
+ db $01,$01
+ dw AdjustOAMBlockXPos
+
+; facing right
+ db $FF,$01
+ dw AdjustOAMBlockXPos
+
+LoadSmokeTileFourTimes::
+ ld hl, vChars1 + $7c0
+ ld c, $4
+.loop
+ push bc
+ push hl
+ call LoadSmokeTile
+ pop hl
+ ld bc, $10
+ add hl, bc
+ pop bc
+ dec c
+ jr nz, .loop
+ ret
+
+LoadSmokeTile:
+ ld de, SSAnneSmokePuffTile
+ lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / $10
+ jp CopyVideoData
+
+SSAnneSmokePuffTile:
+ INCBIN "gfx/overworld/smoke.2bpp"
+SSAnneSmokePuffTileEnd: