Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/overworld/dust_smoke.asm
1271 views
1
AnimateBoulderDust:
2
ld a, $1
3
ld [wWhichAnimationOffsets], a ; select the boulder dust offsets
4
ld a, [wUpdateSpritesEnabled]
5
push af
6
ld a, $ff
7
ld [wUpdateSpritesEnabled], a
8
ld a, %11100100
9
ldh [rOBP1], a
10
call LoadSmokeTileFourTimes
11
farcall WriteCutOrBoulderDustAnimationOAMBlock
12
ld c, 8 ; number of steps in animation
13
.loop
14
push bc
15
call GetMoveBoulderDustFunctionPointer
16
ld bc, .returnAddress
17
push bc
18
ld c, 4
19
jp hl
20
.returnAddress
21
ldh a, [rOBP1]
22
xor %01100100
23
ldh [rOBP1], a
24
call Delay3
25
pop bc
26
dec c
27
jr nz, .loop
28
pop af
29
ld [wUpdateSpritesEnabled], a
30
jp LoadPlayerSpriteGraphics
31
32
GetMoveBoulderDustFunctionPointer:
33
ld a, [wSpritePlayerStateData1FacingDirection]
34
ld hl, MoveBoulderDustFunctionPointerTable
35
ld c, a
36
ld b, $0
37
add hl, bc
38
ld a, [hli]
39
ld [wCoordAdjustmentAmount], a
40
ld a, [hli]
41
ld e, a
42
ld a, [hli]
43
ld h, [hl]
44
ld l, a
45
push hl
46
ld hl, wShadowOAMSprite36
47
ld d, $0
48
add hl, de
49
ld e, l
50
ld d, h
51
pop hl
52
ret
53
54
MACRO boulder_dust_adjust
55
db \1, \2 ; coords
56
dw \3 ; function
57
ENDM
58
59
MoveBoulderDustFunctionPointerTable:
60
boulder_dust_adjust -1, 0, AdjustOAMBlockYPos ; down
61
boulder_dust_adjust 1, 0, AdjustOAMBlockYPos ; up
62
boulder_dust_adjust 1, 1, AdjustOAMBlockXPos ; left
63
boulder_dust_adjust -1, 1, AdjustOAMBlockXPos ; right
64
65
LoadSmokeTileFourTimes::
66
ld hl, vChars1 tile $7c
67
ld c, 4
68
.loop
69
push bc
70
push hl
71
call LoadSmokeTile
72
pop hl
73
ld bc, 1 tiles
74
add hl, bc
75
pop bc
76
dec c
77
jr nz, .loop
78
ret
79
80
LoadSmokeTile:
81
ld de, SSAnneSmokePuffTile
82
lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / $10
83
jp CopyVideoData
84
85
SSAnneSmokePuffTile:
86
INCBIN "gfx/overworld/smoke.2bpp"
87
SSAnneSmokePuffTileEnd:
88
89