Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/movie/credits.asm
2046 views
1
HallOfFamePC:
2
farcall AnimateHallOfFame
3
call ClearScreen
4
ld c, 100
5
call DelayFrames
6
call DisableLCD
7
ld hl, vFont
8
ld bc, ($80 tiles) / 2
9
call ShiftFontColorIndex
10
ld hl, vChars2 tile $60
11
ld bc, ($20 tiles) / 2
12
call ShiftFontColorIndex
13
ld hl, vChars2 tile $7e
14
ld bc, TILE_SIZE
15
ld a, $ff ; solid black
16
call FillMemory
17
hlcoord 0, 0
18
call FillFourRowsWithBlack
19
hlcoord 0, 14
20
call FillFourRowsWithBlack
21
ld a, %11000000
22
ldh [rBGP], a
23
call EnableLCD
24
ld a, SFX_STOP_ALL_MUSIC
25
call PlaySoundWaitForCurrent
26
ld c, BANK(Music_Credits)
27
ld a, MUSIC_CREDITS
28
call PlayMusic
29
ld c, 128
30
call DelayFrames
31
xor a
32
ld [wUnusedCreditsByte], a ; not read
33
ld [wNumCreditsMonsDisplayed], a
34
jp Credits
35
36
FadeInCredits:
37
ld hl, HoFGBPalettes
38
ld b, 4
39
.loop
40
ld a, [hli]
41
ldh [rBGP], a
42
ld c, 5
43
call DelayFrames
44
dec b
45
jr nz, .loop
46
ret
47
48
DisplayCreditsMon:
49
xor a
50
ldh [hAutoBGTransferEnabled], a
51
call SaveScreenTilesToBuffer1
52
call FillMiddleOfScreenWithWhite
53
54
; display the next monster from CreditsMons
55
ld hl, wNumCreditsMonsDisplayed
56
ld c, [hl] ; how many monsters have we displayed so far?
57
inc [hl]
58
ld b, 0
59
ld hl, CreditsMons
60
add hl, bc ; go that far in the list of monsters and get the next one
61
ld a, [hl]
62
ld [wCurPartySpecies], a
63
ld [wCurSpecies], a
64
hlcoord 8, 6
65
call GetMonHeader
66
call LoadFrontSpriteByMonIndex
67
ld hl, vBGMap0 + $c
68
call CreditsCopyTileMapToVRAM
69
xor a
70
ldh [hAutoBGTransferEnabled], a
71
call LoadScreenTilesFromBuffer1
72
ld hl, vBGMap0
73
call CreditsCopyTileMapToVRAM
74
ld a, $A7
75
ldh [rWX], a
76
ld hl, vBGMap1
77
call CreditsCopyTileMapToVRAM
78
call FillMiddleOfScreenWithWhite
79
ld a, %11111100 ; make the mon a black silhouette
80
ldh [rBGP], a
81
82
; scroll the mon left by one tile 7 times
83
ld bc, 7
84
.scrollLoop1
85
call ScrollCreditsMonLeft
86
dec c
87
jr nz, .scrollLoop1
88
89
; scroll the mon left by one tile 20 times
90
; This time, we have to move the window left too in order to hide the text that
91
; is wrapping around to the right side of the screen.
92
ld c, 20
93
.scrollLoop2
94
call ScrollCreditsMonLeft
95
ldh a, [rWX]
96
sub 8
97
ldh [rWX], a
98
dec c
99
jr nz, .scrollLoop2
100
101
xor a
102
ldh [hWY], a
103
ld a, %11000000
104
ldh [rBGP], a
105
ret
106
107
INCLUDE "data/credits/credits_mons.asm"
108
109
ScrollCreditsMonLeft:
110
ld h, b
111
ld l, $20
112
call ScrollCreditsMonLeft_SetSCX
113
ld h, $0
114
ld l, $70
115
call ScrollCreditsMonLeft_SetSCX
116
ld a, b
117
add $8
118
ld b, a
119
ret
120
121
ScrollCreditsMonLeft_SetSCX:
122
ldh a, [rLY]
123
cp l
124
jr nz, ScrollCreditsMonLeft_SetSCX
125
ld a, h
126
ldh [rSCX], a
127
.loop
128
ldh a, [rLY]
129
cp h
130
jr z, .loop
131
ret
132
133
HoFGBPalettes:
134
dc 3, 0, 0, 0
135
dc 3, 1, 0, 0
136
dc 3, 2, 0, 0
137
dc 3, 3, 0, 0
138
139
CreditsCopyTileMapToVRAM:
140
ld a, l
141
ldh [hAutoBGTransferDest], a
142
ld a, h
143
ldh [hAutoBGTransferDest + 1], a
144
ld a, 1
145
ldh [hAutoBGTransferEnabled], a
146
jp Delay3
147
148
ShiftFontColorIndex:
149
; Zero every second byte at hl, writing a total of bc bytes.
150
; When used on VRAM font characters that contain only black and white shades,
151
; it shifts the color index: black -> light gray, allowing palette-controlled
152
; text fade-in during the Credits roll, while the black bars remain solid.
153
ld [hl], 0
154
inc hl
155
inc hl
156
dec bc
157
ld a, b
158
or c
159
jr nz, ShiftFontColorIndex
160
ret
161
162
FillFourRowsWithBlack:
163
ld bc, SCREEN_WIDTH * 4
164
ld a, $7e
165
jp FillMemory
166
167
FillMiddleOfScreenWithWhite:
168
hlcoord 0, 4
169
ld bc, SCREEN_WIDTH * 10
170
ld a, ' '
171
jp FillMemory
172
173
Credits:
174
ld de, CreditsOrder
175
push de
176
.nextCreditsScreen
177
pop de
178
hlcoord 9, 6
179
push hl
180
call FillMiddleOfScreenWithWhite
181
pop hl
182
.nextCreditsCommand
183
ld a, [de]
184
inc de
185
push de
186
cp CRED_TEXT_FADE_MON
187
jr z, .fadeInTextAndShowMon
188
cp CRED_TEXT_MON
189
jr z, .showTextAndShowMon
190
cp CRED_TEXT_FADE
191
jr z, .fadeInText
192
cp CRED_TEXT
193
jr z, .showText
194
cp CRED_COPYRIGHT
195
jr z, .showCopyrightText
196
cp CRED_THE_END
197
jr z, .showTheEnd
198
push hl
199
push hl
200
ld hl, CreditsTextPointers
201
add a
202
ld c, a
203
ld b, 0
204
add hl, bc
205
ld e, [hl]
206
inc hl
207
ld d, [hl]
208
ld a, [de]
209
inc de
210
ld c, a
211
ld b, -1
212
pop hl
213
add hl, bc
214
call PlaceString
215
pop hl
216
ld bc, SCREEN_WIDTH * 2
217
add hl, bc
218
pop de
219
jr .nextCreditsCommand
220
.fadeInTextAndShowMon
221
call FadeInCredits
222
ld c, 90
223
jr .next1
224
.showTextAndShowMon
225
ld c, 110
226
.next1
227
call DelayFrames
228
call DisplayCreditsMon
229
jr .nextCreditsScreen
230
.fadeInText
231
call FadeInCredits
232
ld c, 120
233
jr .next2
234
.showText
235
ld c, 140
236
.next2
237
call DelayFrames
238
jr .nextCreditsScreen
239
.showCopyrightText
240
push de
241
farcall LoadCopyrightTiles
242
pop de
243
pop de
244
jr .nextCreditsCommand
245
.showTheEnd
246
ld c, 16
247
call DelayFrames
248
call FillMiddleOfScreenWithWhite
249
pop de
250
ld de, TheEndGfx
251
ld hl, vChars2 tile $60
252
lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / TILE_SIZE
253
call CopyVideoData
254
hlcoord 4, 8
255
ld de, TheEndTextString
256
call PlaceString
257
hlcoord 4, 9
258
inc de
259
call PlaceString
260
jp FadeInCredits
261
262
TheEndTextString:
263
; "T H E E N D"
264
db $60," ",$62," ",$64," ",$64," ",$66," ",$68,"@"
265
db $61," ",$63," ",$65," ",$65," ",$67," ",$69,"@"
266
267
INCLUDE "data/credits/credits_order.asm"
268
269
INCLUDE "data/credits/credits_text.asm"
270
271
TheEndGfx:
272
INCBIN "gfx/credits/the_end.2bpp"
273
TheEndGfxEnd:
274
275