Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/movie/credits.asm
1271 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 ZeroMemory
10
ld hl, vChars2 tile $60
11
ld bc, ($20 tiles) / 2
12
call ZeroMemory
13
ld hl, vChars2 tile $7e
14
ld bc, 1 tiles
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
FadeInCreditsText:
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
ZeroMemory:
149
; zero bc bytes at hl
150
ld [hl], 0
151
inc hl
152
inc hl
153
dec bc
154
ld a, b
155
or c
156
jr nz, ZeroMemory
157
ret
158
159
FillFourRowsWithBlack:
160
ld bc, SCREEN_WIDTH * 4
161
ld a, $7e
162
jp FillMemory
163
164
FillMiddleOfScreenWithWhite:
165
hlcoord 0, 4
166
ld bc, SCREEN_WIDTH * 10
167
ld a, " "
168
jp FillMemory
169
170
Credits:
171
ld de, CreditsOrder
172
push de
173
.nextCreditsScreen
174
pop de
175
hlcoord 9, 6
176
push hl
177
call FillMiddleOfScreenWithWhite
178
pop hl
179
.nextCreditsCommand
180
ld a, [de]
181
inc de
182
push de
183
cp CRED_TEXT_FADE_MON
184
jr z, .fadeInTextAndShowMon
185
cp CRED_TEXT_MON
186
jr z, .showTextAndShowMon
187
cp CRED_TEXT_FADE
188
jr z, .fadeInText
189
cp CRED_TEXT
190
jr z, .showText
191
cp CRED_COPYRIGHT
192
jr z, .showCopyrightText
193
cp CRED_THE_END
194
jr z, .showTheEnd
195
push hl
196
push hl
197
ld hl, CreditsTextPointers
198
add a
199
ld c, a
200
ld b, 0
201
add hl, bc
202
ld e, [hl]
203
inc hl
204
ld d, [hl]
205
ld a, [de]
206
inc de
207
ld c, a
208
ld b, -1
209
pop hl
210
add hl, bc
211
call PlaceString
212
pop hl
213
ld bc, SCREEN_WIDTH * 2
214
add hl, bc
215
pop de
216
jr .nextCreditsCommand
217
.fadeInTextAndShowMon
218
call FadeInCreditsText
219
ld c, 90
220
jr .next1
221
.showTextAndShowMon
222
ld c, 110
223
.next1
224
call DelayFrames
225
call DisplayCreditsMon
226
jr .nextCreditsScreen
227
.fadeInText
228
call FadeInCreditsText
229
ld c, 120
230
jr .next2
231
.showText
232
ld c, 140
233
.next2
234
call DelayFrames
235
jr .nextCreditsScreen
236
.showCopyrightText
237
push de
238
farcall LoadCopyrightTiles
239
pop de
240
pop de
241
jr .nextCreditsCommand
242
.showTheEnd
243
ld c, 16
244
call DelayFrames
245
call FillMiddleOfScreenWithWhite
246
pop de
247
ld de, TheEndGfx
248
ld hl, vChars2 tile $60
249
lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10
250
call CopyVideoData
251
hlcoord 4, 8
252
ld de, TheEndTextString
253
call PlaceString
254
hlcoord 4, 9
255
inc de
256
call PlaceString
257
jp FadeInCreditsText
258
259
TheEndTextString:
260
; "T H E E N D"
261
db $60," ",$62," ",$64," ",$64," ",$66," ",$68,"@"
262
db $61," ",$63," ",$65," ",$65," ",$67," ",$69,"@"
263
264
INCLUDE "data/credits/credits_order.asm"
265
266
INCLUDE "data/credits/credits_text.asm"
267
268
TheEndGfx:
269
INCBIN "gfx/credits/the_end.2bpp"
270
TheEndGfxEnd:
271
272