Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/movie/intro.asm
1271 views
1
const_def -1
2
const MOVE_NIDORINO_RIGHT
3
const MOVE_GENGAR_RIGHT
4
const MOVE_GENGAR_LEFT
5
6
DEF ANIMATION_END EQU 80
7
8
PlayIntro:
9
xor a
10
ldh [hJoyHeld], a
11
inc a
12
ldh [hAutoBGTransferEnabled], a
13
call PlayShootingStar
14
call PlayIntroScene
15
call GBFadeOutToWhite
16
xor a
17
ldh [hSCX], a
18
ldh [hAutoBGTransferEnabled], a
19
call ClearSprites
20
call DelayFrame
21
ret
22
23
PlayIntroScene:
24
ld b, SET_PAL_NIDORINO_INTRO
25
call RunPaletteCommand
26
ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
27
ldh [rBGP], a
28
ldh [rOBP0], a
29
ldh [rOBP1], a
30
xor a
31
ldh [hSCX], a
32
ld b, TILEMAP_GENGAR_INTRO_1
33
call IntroCopyTiles
34
ld a, 0
35
ld [wBaseCoordX], a
36
ld a, 80
37
ld [wBaseCoordY], a
38
lb bc, 6, 6
39
call InitIntroNidorinoOAM
40
lb de, 80 / 2, MOVE_NIDORINO_RIGHT
41
call IntroMoveMon
42
ret c
43
44
; hip
45
ld a, SFX_INTRO_HIP
46
call PlaySound
47
xor a
48
ld [wIntroNidorinoBaseTile], a
49
ld de, IntroNidorinoAnimation1
50
call AnimateIntroNidorino
51
; hop
52
ld a, SFX_INTRO_HOP
53
call PlaySound
54
ld de, IntroNidorinoAnimation2
55
call AnimateIntroNidorino
56
ld c, 10
57
call CheckForUserInterruption
58
ret c
59
60
; hip
61
ld a, SFX_INTRO_HIP
62
call PlaySound
63
ld de, IntroNidorinoAnimation1
64
call AnimateIntroNidorino
65
; hop
66
ld a, SFX_INTRO_HOP
67
call PlaySound
68
ld de, IntroNidorinoAnimation2
69
call AnimateIntroNidorino
70
ld c, 30
71
call CheckForUserInterruption
72
ret c
73
74
; raise
75
ld b, TILEMAP_GENGAR_INTRO_2
76
call IntroCopyTiles
77
ld a, SFX_INTRO_RAISE
78
call PlaySound
79
lb de, 8 / 2, MOVE_GENGAR_LEFT
80
call IntroMoveMon
81
ld c, 30
82
call CheckForUserInterruption
83
ret c
84
85
; slash
86
ld b, TILEMAP_GENGAR_INTRO_3
87
call IntroCopyTiles
88
ld a, SFX_INTRO_CRASH
89
call PlaySound
90
lb de, 16 / 2, MOVE_GENGAR_RIGHT
91
call IntroMoveMon
92
; hip
93
ld a, SFX_INTRO_HIP
94
call PlaySound
95
ld a, (FightIntroFrontMon2 - FightIntroFrontMon) / TILE_SIZE
96
ld [wIntroNidorinoBaseTile], a
97
ld de, IntroNidorinoAnimation3
98
call AnimateIntroNidorino
99
ld c, 30
100
call CheckForUserInterruption
101
ret c
102
103
lb de, 8 / 2, MOVE_GENGAR_LEFT
104
call IntroMoveMon
105
ld b, TILEMAP_GENGAR_INTRO_1
106
call IntroCopyTiles
107
ld c, 60
108
call CheckForUserInterruption
109
ret c
110
111
; hip
112
ld a, SFX_INTRO_HIP
113
call PlaySound
114
xor a
115
ld [wIntroNidorinoBaseTile], a
116
ld de, IntroNidorinoAnimation4
117
call AnimateIntroNidorino
118
; hop
119
ld a, SFX_INTRO_HOP
120
call PlaySound
121
ld de, IntroNidorinoAnimation5
122
call AnimateIntroNidorino
123
ld c, 20
124
call CheckForUserInterruption
125
ret c
126
127
ld a, (FightIntroFrontMon2 - FightIntroFrontMon) / TILE_SIZE
128
ld [wIntroNidorinoBaseTile], a
129
ld de, IntroNidorinoAnimation6
130
call AnimateIntroNidorino
131
ld c, 30
132
call CheckForUserInterruption
133
ret c
134
135
; lunge
136
ld a, SFX_INTRO_LUNGE
137
call PlaySound
138
ld a, (FightIntroFrontMon3 - FightIntroFrontMon) / TILE_SIZE
139
ld [wIntroNidorinoBaseTile], a
140
ld de, IntroNidorinoAnimation7
141
jp AnimateIntroNidorino
142
143
AnimateIntroNidorino:
144
ld a, [de]
145
cp ANIMATION_END
146
ret z
147
ld [wBaseCoordY], a
148
inc de
149
ld a, [de]
150
ld [wBaseCoordX], a
151
push de
152
ld c, 6 * 6
153
call UpdateIntroNidorinoOAM
154
ld c, 5
155
call DelayFrames
156
pop de
157
inc de
158
jr AnimateIntroNidorino
159
160
UpdateIntroNidorinoOAM:
161
ld hl, wShadowOAM
162
ld a, [wIntroNidorinoBaseTile]
163
ld d, a
164
.loop
165
ld a, [wBaseCoordY]
166
add [hl]
167
ld [hli], a ; Y
168
ld a, [wBaseCoordX]
169
add [hl]
170
ld [hli], a ; X
171
ld a, d
172
ld [hli], a ; tile
173
inc hl
174
inc d
175
dec c
176
jr nz, .loop
177
ret
178
179
InitIntroNidorinoOAM:
180
ld hl, wShadowOAM
181
ld d, 0
182
.loop
183
push bc
184
ld a, [wBaseCoordY]
185
ld e, a
186
.innerLoop
187
ld a, e
188
add 8
189
ld e, a
190
ld [hli], a ; Y
191
ld a, [wBaseCoordX]
192
ld [hli], a ; X
193
ld a, d
194
ld [hli], a ; tile
195
ld a, OAM_PRIO
196
ld [hli], a ; attributes
197
inc d
198
dec c
199
jr nz, .innerLoop
200
ld a, [wBaseCoordX]
201
add 8
202
ld [wBaseCoordX], a
203
pop bc
204
dec b
205
jr nz, .loop
206
ret
207
208
IntroClearScreen:
209
ld hl, vBGMap1
210
ld bc, TILEMAP_WIDTH * SCREEN_HEIGHT
211
jr IntroClearCommon
212
213
IntroClearMiddleOfScreen:
214
; clear the area of the tile map between the black bars on the top and bottom
215
hlcoord 0, 4
216
ld bc, SCREEN_WIDTH * 10
217
218
IntroClearCommon:
219
ld [hl], 0
220
inc hl
221
dec bc
222
ld a, b
223
or c
224
jr nz, IntroClearCommon
225
ret
226
227
IntroPlaceBlackTiles:
228
ld a, 1
229
.loop
230
ld [hli], a
231
dec c
232
jr nz, .loop
233
ret
234
235
IntroMoveMon:
236
; d = number of times to move the mon (2 pixels each time)
237
ld a, e
238
cp MOVE_NIDORINO_RIGHT
239
jr z, .moveNidorinoRight
240
cp MOVE_GENGAR_LEFT
241
jr z, .moveGengarLeft
242
; move Gengar right
243
ldh a, [hSCX]
244
dec a
245
dec a
246
jr .next
247
.moveNidorinoRight
248
push de
249
ld a, 2
250
ld [wBaseCoordX], a
251
xor a
252
ld [wBaseCoordY], a
253
ld c, 6 * 6
254
call UpdateIntroNidorinoOAM
255
pop de
256
.moveGengarLeft
257
ldh a, [hSCX]
258
inc a
259
inc a
260
.next
261
ldh [hSCX], a
262
push de
263
ld c, 2
264
call CheckForUserInterruption
265
pop de
266
ret c
267
dec d
268
jr nz, IntroMoveMon
269
ret
270
271
IntroCopyTiles:
272
hlcoord 13, 7
273
274
CopyTileIDsFromList_ZeroBaseTileID:
275
ld c, 0
276
predef_jump CopyTileIDsFromList
277
278
PlayIntroMoveSound: ; unreferenced
279
predef GetIntroMoveSound
280
ld a, b
281
jp PlaySound
282
283
LoadIntroGraphics:
284
ld hl, FightIntroBackMon
285
ld de, vChars2
286
ld bc, FightIntroBackMonEnd - FightIntroBackMon
287
ld a, BANK(FightIntroBackMon)
288
call FarCopyData2
289
ld hl, GameFreakIntro
290
ld de, vChars2 + (FightIntroBackMonEnd - FightIntroBackMon)
291
ld bc, GameFreakIntroEnd - GameFreakIntro
292
ld a, BANK(GameFreakIntro)
293
call FarCopyData2
294
ld hl, GameFreakIntro
295
ld de, vChars1
296
ld bc, GameFreakIntroEnd - GameFreakIntro
297
ld a, BANK(GameFreakIntro)
298
call FarCopyData2
299
ld hl, FightIntroFrontMon
300
ld de, vChars0
301
ld bc, FightIntroFrontMonEnd - FightIntroFrontMon
302
ld a, BANK(FightIntroFrontMon)
303
jp FarCopyData2
304
305
PlayShootingStar:
306
ld b, SET_PAL_GAME_FREAK_INTRO
307
call RunPaletteCommand
308
farcall LoadCopyrightAndTextBoxTiles
309
ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
310
ldh [rBGP], a
311
ld c, 180
312
call DelayFrames
313
call ClearScreen
314
call DisableLCD
315
xor a
316
ld [wCurOpponent], a
317
call IntroDrawBlackBars
318
call LoadIntroGraphics
319
call EnableLCD
320
ld hl, rLCDC
321
res B_LCDC_WINDOW, [hl]
322
set B_LCDC_BG_MAP, [hl]
323
ld c, 64
324
call DelayFrames
325
farcall AnimateShootingStar
326
push af
327
; A `call LoadPresentsGraphic` here was removed in localization
328
pop af
329
jr c, .next ; skip the delay if the user interrupted the animation
330
ld c, 40
331
call DelayFrames
332
.next
333
ld a, BANK(Music_IntroBattle)
334
ld [wAudioROMBank], a
335
ld [wAudioSavedROMBank], a
336
ld a, MUSIC_INTRO_BATTLE
337
ld [wNewSoundID], a
338
call PlaySound
339
call IntroClearMiddleOfScreen
340
call ClearSprites
341
jp Delay3
342
343
IntroDrawBlackBars:
344
; clear the screen and draw black bars on the top and bottom
345
call IntroClearScreen
346
hlcoord 0, 0
347
ld c, SCREEN_WIDTH * 4
348
call IntroPlaceBlackTiles
349
hlcoord 0, 14
350
ld c, SCREEN_WIDTH * 4
351
call IntroPlaceBlackTiles
352
ld hl, vBGMap1
353
ld c, TILEMAP_WIDTH * 4
354
call IntroPlaceBlackTiles
355
hlbgcoord 0, 14, vBGMap1
356
ld c, TILEMAP_WIDTH * 4
357
jp IntroPlaceBlackTiles
358
359
LoadPresentsGraphic: ; unreferenced
360
; This routine loaded the "PRESENTS" text graphic (tiles
361
; $67, $68, $69, $6A, $6B, and $6C from gamefreak_presents.2bpp)
362
; at coordinates (11, 7) in the Japanese versions.
363
; It was dummied out in the English localization.
364
ret
365
366
IntroNidorinoAnimation0:
367
db 0, 0
368
db ANIMATION_END
369
370
IntroNidorinoAnimation1:
371
; This is a sequence of pixel movements for part of the Nidorino animation. This
372
; list describes how Nidorino should hop.
373
; First byte is y movement, second byte is x movement
374
db 0, 0
375
db -2, 2
376
db -1, 2
377
db 1, 2
378
db 2, 2
379
db ANIMATION_END
380
381
IntroNidorinoAnimation2:
382
; This is a sequence of pixel movements for part of the Nidorino animation.
383
; First byte is y movement, second byte is x movement
384
db 0, 0
385
db -2, -2
386
db -1, -2
387
db 1, -2
388
db 2, -2
389
db ANIMATION_END
390
391
IntroNidorinoAnimation3:
392
; This is a sequence of pixel movements for part of the Nidorino animation.
393
; First byte is y movement, second byte is x movement
394
db 0, 0
395
db -12, 6
396
db -8, 6
397
db 8, 6
398
db 12, 6
399
db ANIMATION_END
400
401
IntroNidorinoAnimation4:
402
; This is a sequence of pixel movements for part of the Nidorino animation.
403
; First byte is y movement, second byte is x movement
404
db 0, 0
405
db -8, -4
406
db -4, -4
407
db 4, -4
408
db 8, -4
409
db ANIMATION_END
410
411
IntroNidorinoAnimation5:
412
; This is a sequence of pixel movements for part of the Nidorino animation.
413
; First byte is y movement, second byte is x movement
414
db 0, 0
415
db -8, 4
416
db -4, 4
417
db 4, 4
418
db 8, 4
419
db ANIMATION_END
420
421
IntroNidorinoAnimation6:
422
; This is a sequence of pixel movements for part of the Nidorino animation.
423
; First byte is y movement, second byte is x movement
424
db 0, 0
425
db 2, 0
426
db 2, 0
427
db 0, 0
428
db ANIMATION_END
429
430
IntroNidorinoAnimation7:
431
; This is a sequence of pixel movements for part of the Nidorino animation.
432
; First byte is y movement, second byte is x movement
433
db -8, -16
434
db -7, -14
435
db -6, -12
436
db -4, -10
437
db ANIMATION_END
438
439
GameFreakIntro:
440
INCBIN "gfx/splash/gamefreak_presents.2bpp"
441
INCBIN "gfx/splash/gamefreak_logo.2bpp"
442
ds 16, $00 ; blank tile
443
GameFreakIntroEnd:
444
445
FightIntroBackMon:
446
INCBIN "gfx/intro/gengar.2bpp"
447
ds 16, $00 ; blank tile
448
FightIntroBackMonEnd:
449
450
IF DEF(_RED)
451
FightIntroFrontMon:
452
INCBIN "gfx/intro/red_nidorino_1.2bpp"
453
FightIntroFrontMon2:
454
INCBIN "gfx/intro/red_nidorino_2.2bpp"
455
FightIntroFrontMon3:
456
INCBIN "gfx/intro/red_nidorino_3.2bpp"
457
ENDC
458
459
IF DEF(_BLUE)
460
FightIntroFrontMon:
461
INCBIN "gfx/intro/blue_jigglypuff_1.2bpp"
462
FightIntroFrontMon2:
463
INCBIN "gfx/intro/blue_jigglypuff_2.2bpp"
464
FightIntroFrontMon3:
465
INCBIN "gfx/intro/blue_jigglypuff_3.2bpp"
466
ENDC
467
468
FightIntroFrontMonEnd:
469
470
ds 16, $00 ; blank tile
471
472