summaryrefslogtreecommitdiff
path: root/engine/pinball_game/draw_sprites/draw_gengar_bonus_sprites.asm
blob: 212279dbbd0a939171e40469e593cb2f8fb37143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
DrawSpritesGengarBonus: ; 0x18faf
	ld bc, $7f00
	callba DrawTimer
	call Func_19020
	call Func_190b9
	call Func_19185
	callba DrawFlippers
	callba DrawPinball
	ret

Func_18fda:
; unused
	ld a, [hNewlyPressedButtons]
	bit 6, a
	ret z
	ld a, [wd659]
	and a
	jr z, .asm_18ff8
	ld a, $1
	ld [wd67e], a
	ld [wd687], a
	xor a
	ld [wd659], a
	ld [wd662], a
	ld [wd66b], a
	ret

.asm_18ff8
	ld a, [wd67e]
	and a
	jr z, .asm_1900b
	ld a, $1
	ld [wd698], a
	xor a
	ld [wd67e], a
	ld [wd687], a
	ret

.asm_1900b
	ld a, [wd698]
	and a
	ret z
	ld a, $1
	ld [wd659], a
	ld [wd662], a
	ld [wd66b], a
	xor a
	ld [wd698], a
	ret

Func_19020: ; 0x19020
	ld de, wd659
	call Func_19033
	ld de, wd662
	call Func_19033
	ld de, wd66b
	call Func_19033
	ret

Func_19033: ; 0x19033
	ld a, [de]
	and a
	ret z
.asm_19036
	call Func_19070
	jr nc, .asm_19042
	ld a, [rLCDC]
	bit 7, a
	jr z, .asm_19036
	ret

.asm_19042
	inc de
	inc de
	inc de
	inc de
	inc de
	inc de
	ld a, [de]
	ld hl, hSCX
	sub [hl]
	ld b, a
	inc de
	inc de
	ld a, [de]
	ld hl, hSCY
	sub [hl]
	ld c, a
	dec de
	dec de
	dec de
	dec de
	dec de
	dec de
	ld a, [de]
	ld e, a
	ld d, $0
	ld hl, OAMIds_1906b
	add hl, de
	ld a, [hl]
	cp $ff
	call nz, LoadOAMData2
	ret

OAMIds_1906b:
	db $00, $01, $02, $03
	db $FF

Func_19070: ; 0x19070
	ld a, [wd674]
	and a
	ret z
	push de
	dec a
	ld [wd674], a
	sla a
	sla a
	ld c, a
	ld b, $0
	ld hl, GastlyVideoData_190a9
	add hl, bc
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, Bank(GengarBonusGastlyGfx)
	ld bc, $0060
	call LoadOrCopyVRAMData
	ld a, $8
	ld [wd690], a
	ld [wd6a1], a
	xor a
	ld [wd67e], a
	ld [wd687], a
	ld [wd698], a
	pop de
	scf
	ret

GastlyVideoData_190a9:
	dw vTilesSH tile $10, GengarBonusGastlyGfx
	dw vTilesSH tile $16, GengarBonusGastlyGfx + $60
	dw vTilesSH tile $1c, GengarBonusGastlyGfx + $c0
	dw vTilesSH tile $22, GengarBonusGastlyGfx + $120

Func_190b9: ; 0x190b9
	ld de, wd67e
	call Func_190c6
	ld de, wd687
	call Func_190c6
	ret

Func_190c6: ; 0x190c6
	ld a, [de]
	and a
	ret z
.asm_190c9
	call Func_19104
	jr nc, .asm_190d5
	ld a, [rLCDC]
	bit 7, a
	jr z, .asm_190c9
	ret

.asm_190d5
	inc de
	inc de
	inc de
	inc de
	inc de
	inc de
	ld a, [de]
	ld hl, hSCX
	sub [hl]
	ld b, a
	inc de
	inc de
	ld a, [de]
	ld hl, hSCY
	sub [hl]
	ld c, a
	dec de
	dec de
	dec de
	dec de
	dec de
	dec de
	ld a, [de]
	ld e, a
	ld d, $0
	ld hl, OAMIds_190fe
	add hl, de
	ld a, [hl]
	cp $ff
	call nz, LoadOAMData2
	ret

OAMIds_190fe:
	db $04, $05, $06, $07, $08
	db $FF

Func_19104: ; 0x19104
	ld a, [wd690]
	and a
	ret z
	push de
	dec a
	ld [wd690], a
	sla a
	sla a
	sla a
	ld c, a
	ld b, $0
	ld hl, GengarBonusStageHaunterGfxTable
	add hl, bc
	ld a, [hli]
	ld c, a
	ld a, [hli]
	ld b, a
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, Bank(GengarBonusHaunterGfx)
	call LoadOrCopyVRAMData
	ld a, $4
	ld [wd674], a
	ld a, $8
	ld [wd6a1], a
	xor a
	ld [wd659], a
	ld [wd662], a
	ld [wd66b], a
	ld [wd698], a
	pop de
	scf
	ret

GengarBonusStageHaunterGfxTable: ; 0x19145
; Graphics data for Haunter.
; First word:  length in bytes
; Second word: destination VRAM address
; Third word:  graphics data
; Fourth word: unused
	dw $60, vTilesSH tile $10, GengarBonusHaunterGfx,        $0000
	dw $60, vTilesSH tile $16, GengarBonusHaunterGfx + $60,  $0000
	dw $60, vTilesSH tile $1c, GengarBonusHaunterGfx + $c0,  $0000
	dw $60, vTilesSH tile $22, GengarBonusHaunterGfx + $120, $0000
	dw $20, vTilesSH tile $28, GengarBonusHaunterGfx + $180, $0000
	dw $40, vTilesOB tile $1a, GengarBonusHaunterGfx + $1a0, $0000
	dw $60, vTilesOB tile $1e, GengarBonusHaunterGfx + $1e0, $0000
	dw $60, vTilesOB tile $24, GengarBonusHaunterGfx + $240, $0000

Func_19185: ; 0x19185
	ld de, wd698
	call Func_1918c
	ret

Func_1918c: ; 0x1918c
	ld a, [de]
	and a
	ret z
.asm_1918f
	call Func_191cb
	jr nc, .asm_1919b
	ld a, [rLCDC]
	bit 7, a
	jr z, .asm_1918f
	ret

.asm_1919b
	inc de
	inc de
	inc de
	inc de
	inc de
	inc de
	ld a, [de]
	ld hl, hSCX
	sub [hl]
	ld b, a
	inc de
	inc de
	ld a, [de]
	ld hl, hSCY
	sub [hl]
	ld c, a
	dec de
	dec de
	dec de
	dec de
	dec de
	dec de
	ld a, [de]
	ld e, a
	ld d, $0
	ld hl, OAMIds_191c4
	add hl, de
	ld a, [hl]
	cp $ff
	call nz, LoadOAMData2
	ret

OAMIds_191c4:
	db $09, $0A, $0B, $0C, $0D, $0E
	db $FF

Func_191cb: ; 0x191cb
	ld a, [wd6a1]
	and a
	ret z
	push de
	dec a
	ld [wd6a1], a
	sla a
	sla a
	sla a
	ld c, a
	ld b, $0
	ld hl, GengarBonusStageGengarGfxTable
	add hl, bc
	ld a, [hli]
	ld c, a
	ld a, [hli]
	ld b, a
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, $26
	call LoadOrCopyVRAMData
	ld a, $4
	ld [wd674], a
	ld a, $8
	ld [wd690], a
	xor a
	ld [wd659], a
	ld [wd662], a
	ld [wd66b], a
	ld [wd67e], a
	ld [wd687], a
	pop de
	scf
	ret

GengarBonusStageGengarGfxTable:
	dw $60, vTilesSH tile $10, GengarBonusGengarGfx,        $0000
	dw $60, vTilesSH tile $16, GengarBonusGengarGfx + $60,  $0000
	dw $60, vTilesSH tile $1c, GengarBonusGengarGfx + $c0,  $0000
	dw $60, vTilesSH tile $22, GengarBonusGengarGfx + $120, $0000
	dw $20, vTilesSH tile $28, GengarBonusGengarGfx + $180, $0000
	dw $40, vTilesOB tile $1a, GengarBonusGengarGfx + $1a0, $0000
	dw $60, vTilesOB tile $1e, GengarBonusGengarGfx + $1e0, $0000
	dw $60, vTilesOB tile $24, GengarBonusGengarGfx + $240, $0000