2018-01-09 05:36:15 +00:00
|
|
|
INCLUDE "constants.asm"
|
2014-02-06 00:07:24 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
|
2017-12-15 22:22:52 +00:00
|
|
|
SECTION "Credits", ROMX
|
2013-02-26 05:51:05 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits::
|
2015-12-15 01:06:41 +00:00
|
|
|
bit 6, b ; Hall Of Fame
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, $0
|
2015-12-15 01:06:41 +00:00
|
|
|
jr z, .okay
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, $40
|
2015-12-15 01:06:41 +00:00
|
|
|
.okay
|
2015-10-24 23:49:19 +00:00
|
|
|
ld [wJumptableIndex], a
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-11-24 09:26:10 +00:00
|
|
|
push af
|
2018-01-30 19:05:25 +00:00
|
|
|
ld a, BANK(wGBCPalettes)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBGPalettes
|
2020-02-13 17:30:13 +00:00
|
|
|
call ClearTilemap
|
2013-11-24 09:26:10 +00:00
|
|
|
call ClearSprites
|
|
|
|
|
2018-08-26 17:08:01 +00:00
|
|
|
ld hl, wCreditsBlankFrame2bpp
|
|
|
|
ld c, (wCreditsBlankFrame2bppEnd - wCreditsBlankFrame2bpp) / 2
|
2018-08-26 17:23:40 +00:00
|
|
|
ld de, `22222222 ; eight pixels, each color #2 (dark)
|
|
|
|
|
|
|
|
; Fill wCreditsBlankFrame2bpp with 4x4=16 tiles, all solid dark color
|
|
|
|
; (the same color used for the four border frame mons' backgrounds)
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.load_loop
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .load_loop
|
2013-11-24 09:26:10 +00:00
|
|
|
|
|
|
|
ld de, CreditsBorderGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2 tile $20
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(CreditsBorderGFX), 9
|
2013-11-24 09:26:10 +00:00
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
ld de, CopyrightGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2 tile $60
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(CopyrightGFX), 29
|
2013-11-24 09:26:10 +00:00
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
ld de, TheEndGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2 tile $40
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(TheEndGFX), 16
|
2013-11-24 09:26:10 +00:00
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
ld a, $ff
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsBorderFrame], a
|
2013-11-24 09:26:10 +00:00
|
|
|
xor a
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsBorderMon], a
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
call Credits_LoadBorderGFX
|
2013-11-24 09:26:10 +00:00
|
|
|
ld e, l
|
|
|
|
ld d, h
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2
|
2015-12-15 01:06:41 +00:00
|
|
|
lb bc, BANK(CreditsMonsGFX), 16
|
2013-11-24 09:26:10 +00:00
|
|
|
call Request2bpp
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
call ConstructCreditsTilemap
|
2013-11-24 09:26:10 +00:00
|
|
|
xor a
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsLYOverride], a
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wLYOverrides
|
2013-11-24 09:26:10 +00:00
|
|
|
ld bc, $100
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
|
2018-08-25 18:34:25 +00:00
|
|
|
ld a, LOW(rSCX)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hLCDCPointer], a
|
2013-11-24 09:26:10 +00:00
|
|
|
|
|
|
|
call GetCreditsPalette
|
2015-09-09 23:27:07 +00:00
|
|
|
call SetPalettes
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hVBlank]
|
2013-11-24 09:26:10 +00:00
|
|
|
push af
|
|
|
|
ld a, $5
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hVBlank], a
|
2020-06-17 21:03:38 +00:00
|
|
|
ld a, TRUE
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hInMenu], a
|
2013-11-24 09:26:10 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCreditsPos], a
|
2020-04-17 14:52:59 +00:00
|
|
|
ld [wCreditsPos + 1], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCreditsTimer], a
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.execution_loop
|
|
|
|
call Credits_HandleBButton
|
|
|
|
call Credits_HandleAButton
|
|
|
|
jr nz, .exit_credits
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
call Credits_Jumptable
|
2013-11-24 09:26:10 +00:00
|
|
|
call DelayFrame
|
2015-12-15 01:06:41 +00:00
|
|
|
jr .execution_loop
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.exit_credits
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBGPalettes
|
2013-11-24 09:26:10 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hLCDCPointer], a
|
|
|
|
ldh [hBGMapAddress], a
|
2013-11-24 09:26:10 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hVBlank], a
|
2013-11-24 09:26:10 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-11-24 09:26:10 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_HandleAButton:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hJoypadDown]
|
2015-12-15 01:06:41 +00:00
|
|
|
and A_BUTTON
|
2013-11-24 09:26:10 +00:00
|
|
|
ret z
|
2015-10-24 23:49:19 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2013-11-24 09:26:10 +00:00
|
|
|
bit 7, a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_HandleBButton:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hJoypadDown]
|
2015-12-15 01:06:41 +00:00
|
|
|
and B_BUTTON
|
2013-11-24 09:26:10 +00:00
|
|
|
ret z
|
2015-10-24 23:49:19 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2013-11-24 09:26:10 +00:00
|
|
|
bit 6, a
|
|
|
|
ret z
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wCreditsPos
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, [hli]
|
|
|
|
cp $d
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nc, .okay
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
ret z
|
2015-12-15 01:06:41 +00:00
|
|
|
.okay
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wCreditsTimer
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_Jumptable:
|
2015-10-24 23:49:19 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2013-11-24 09:26:10 +00:00
|
|
|
and $f
|
|
|
|
ld e, a
|
2015-01-02 04:59:08 +00:00
|
|
|
ld d, 0
|
2015-12-15 01:06:41 +00:00
|
|
|
ld hl, .Jumptable
|
2013-11-24 09:26:10 +00:00
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-17 23:14:55 +00:00
|
|
|
jp hl
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw ParseCredits
|
|
|
|
dw Credits_Next
|
|
|
|
dw Credits_Next
|
|
|
|
dw Credits_PrepBGMapUpdate
|
|
|
|
dw Credits_UpdateGFXRequestPath
|
|
|
|
dw Credits_RequestGFX
|
|
|
|
dw Credits_LYOverride
|
|
|
|
dw Credits_Next
|
|
|
|
dw Credits_Next
|
|
|
|
dw Credits_Next
|
|
|
|
dw Credits_UpdateGFXRequestPath
|
|
|
|
dw Credits_RequestGFX
|
|
|
|
dw Credits_LoopBack
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_Next:
|
2015-10-24 23:49:19 +00:00
|
|
|
ld hl, wJumptableIndex
|
2013-11-24 09:26:10 +00:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_LoopBack:
|
2015-10-24 23:49:19 +00:00
|
|
|
ld hl, wJumptableIndex
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and $f0
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_PrepBGMapUpdate:
|
2013-11-24 09:26:10 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-15 01:06:41 +00:00
|
|
|
jp Credits_Next
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_UpdateGFXRequestPath:
|
2015-12-15 01:06:41 +00:00
|
|
|
call Credits_LoadBorderGFX
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, l
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wRequested2bppSource], a
|
2013-11-24 09:26:10 +00:00
|
|
|
ld a, h
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wRequested2bppSource + 1], a
|
2017-12-28 12:32:33 +00:00
|
|
|
ld a, LOW(vTiles2)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wRequested2bppDest], a
|
2017-12-28 12:32:33 +00:00
|
|
|
ld a, HIGH(vTiles2)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wRequested2bppDest + 1], a
|
2015-12-15 01:06:41 +00:00
|
|
|
jr Credits_RequestGFX
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_RequestGFX:
|
2013-11-24 09:26:10 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2020-06-17 21:03:38 +00:00
|
|
|
ld a, 8
|
2020-10-26 19:45:57 +00:00
|
|
|
ld [wRequested2bppSize], a
|
2015-12-15 01:06:41 +00:00
|
|
|
jp Credits_Next
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_LYOverride:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rLY]
|
2013-11-24 09:26:10 +00:00
|
|
|
cp $30
|
2015-12-15 01:06:41 +00:00
|
|
|
jr c, Credits_LYOverride
|
|
|
|
ld a, [wCreditsLYOverride]
|
2013-11-24 09:26:10 +00:00
|
|
|
dec a
|
2016-05-04 15:46:23 +00:00
|
|
|
dec a
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsLYOverride], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wLYOverrides + $1f
|
2015-12-15 01:06:41 +00:00
|
|
|
call .Fill
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wLYOverrides + $87
|
2015-12-15 01:06:41 +00:00
|
|
|
call .Fill
|
|
|
|
jp Credits_Next
|
2013-11-24 09:26:10 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Fill:
|
2013-11-24 09:26:10 +00:00
|
|
|
ld c, $8
|
2015-12-15 01:06:41 +00:00
|
|
|
.loop
|
2013-11-24 09:26:10 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .loop
|
2013-11-24 09:26:10 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ParseCredits:
|
2015-10-24 23:49:19 +00:00
|
|
|
ld hl, wJumptableIndex
|
2013-02-26 05:51:05 +00:00
|
|
|
bit 7, [hl]
|
|
|
|
jp nz, .done
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; Wait until the timer has run out to parse the next command.
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wCreditsTimer
|
2013-02-26 05:51:05 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .parse
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; One tick has passed.
|
|
|
|
dec [hl]
|
|
|
|
jp .done
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.parse
|
|
|
|
; First, let's clear the current text display,
|
|
|
|
; starting from line 5.
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2013-02-26 05:51:05 +00:00
|
|
|
hlcoord 0, 5
|
2020-05-26 01:05:52 +00:00
|
|
|
ld bc, SCREEN_WIDTH * 12
|
2013-02-26 05:51:05 +00:00
|
|
|
ld a, " "
|
|
|
|
call ByteFill
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; Then read the script.
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.loop
|
|
|
|
call .get
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; Commands:
|
2013-11-28 05:55:32 +00:00
|
|
|
cp CREDITS_END
|
2013-02-26 05:51:05 +00:00
|
|
|
jp z, .end
|
|
|
|
cp CREDITS_WAIT
|
|
|
|
jr z, .wait
|
|
|
|
cp CREDITS_SCENE
|
|
|
|
jr z, .scene
|
|
|
|
cp CREDITS_CLEAR
|
|
|
|
jr z, .clear
|
|
|
|
cp CREDITS_MUSIC
|
|
|
|
jr z, .music
|
|
|
|
cp CREDITS_WAIT2
|
|
|
|
jr z, .wait2
|
|
|
|
cp CREDITS_THEEND
|
|
|
|
jr z, .theend
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; If it's not a command, it's a string identifier.
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
push af
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2020-06-16 18:11:49 +00:00
|
|
|
ld hl, CreditsStringsPointers
|
2013-02-26 05:51:05 +00:00
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2013-02-26 05:51:05 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop af
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; Strings spanning multiple lines have special cases.
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
cp COPYRIGHT
|
|
|
|
jr z, .copyright
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
cp STAFF
|
|
|
|
jr c, .staff
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
; The rest start from line 6.
|
|
|
|
|
|
|
|
hlcoord 0, 6
|
|
|
|
jr .print
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.copyright
|
|
|
|
hlcoord 2, 6
|
|
|
|
jr .print
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.staff
|
|
|
|
hlcoord 0, 6
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.print
|
|
|
|
; Print strings spaced every two lines.
|
|
|
|
call .get
|
2020-05-26 01:05:52 +00:00
|
|
|
ld bc, SCREEN_WIDTH * 2
|
2013-02-26 05:51:05 +00:00
|
|
|
call AddNTimes
|
|
|
|
call PlaceString
|
|
|
|
jr .loop
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.theend
|
|
|
|
; Display "The End" graphic.
|
2015-12-15 01:06:41 +00:00
|
|
|
call Credits_TheEnd
|
2013-02-26 05:51:05 +00:00
|
|
|
jr .loop
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.scene
|
|
|
|
; Update the scene number and corresponding palette.
|
|
|
|
call .get
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsBorderMon], a ; scene
|
2013-02-26 05:51:05 +00:00
|
|
|
xor a
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsBorderFrame], a ; frame
|
2013-02-26 05:51:05 +00:00
|
|
|
call GetCreditsPalette
|
2015-09-09 23:27:07 +00:00
|
|
|
call SetPalettes ; update hw pal registers
|
2013-02-26 05:51:05 +00:00
|
|
|
jr .loop
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.clear
|
|
|
|
; Clear the banner.
|
|
|
|
ld a, $ff
|
2015-12-15 01:06:41 +00:00
|
|
|
ld [wCreditsBorderFrame], a ; frame
|
2013-02-26 05:51:05 +00:00
|
|
|
jr .loop
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.music
|
|
|
|
; Play the credits music.
|
|
|
|
ld de, MUSIC_CREDITS
|
|
|
|
push de
|
|
|
|
ld de, MUSIC_NONE
|
2013-10-08 17:21:15 +00:00
|
|
|
call PlayMusic
|
2013-02-26 05:51:05 +00:00
|
|
|
call DelayFrame
|
|
|
|
pop de
|
2013-10-08 17:21:15 +00:00
|
|
|
call PlayMusic
|
2013-02-26 05:51:05 +00:00
|
|
|
jp .loop
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.wait2
|
|
|
|
; Wait for some amount of ticks.
|
|
|
|
call .get
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCreditsTimer], a
|
2013-02-26 05:51:05 +00:00
|
|
|
jr .done
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.wait
|
|
|
|
; Wait for some amount of ticks, and do something else.
|
|
|
|
call .get
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCreditsTimer], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapThird], a
|
2013-02-26 05:51:05 +00:00
|
|
|
ld a, 1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.done
|
2015-12-15 01:06:41 +00:00
|
|
|
jp Credits_Next
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
.end
|
|
|
|
; Stop execution.
|
2015-10-24 23:49:19 +00:00
|
|
|
ld hl, wJumptableIndex
|
2013-02-26 05:51:05 +00:00
|
|
|
set 7, [hl]
|
2015-12-15 01:06:41 +00:00
|
|
|
ld a, 32
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFade], a
|
2017-12-25 18:40:10 +00:00
|
|
|
ld a, LOW(MUSIC_POST_CREDITS)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFadeID], a
|
2017-12-25 18:40:10 +00:00
|
|
|
ld a, HIGH(MUSIC_POST_CREDITS)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFadeID + 1], a
|
2013-02-26 05:51:05 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.get
|
2018-01-23 22:39:09 +00:00
|
|
|
; Get byte wCreditsPos from CreditsScript
|
2013-02-26 05:51:05 +00:00
|
|
|
push hl
|
|
|
|
push de
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCreditsPos]
|
2013-02-26 05:51:05 +00:00
|
|
|
ld e, a
|
2018-07-29 05:40:23 +00:00
|
|
|
ld a, [wCreditsPos + 1]
|
2013-02-26 05:51:05 +00:00
|
|
|
ld d, a
|
|
|
|
ld hl, CreditsScript
|
|
|
|
add hl, de
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
inc de
|
|
|
|
ld a, e
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCreditsPos], a
|
2013-02-26 05:51:05 +00:00
|
|
|
ld a, d
|
2018-07-29 05:40:23 +00:00
|
|
|
ld [wCreditsPos + 1], a
|
2013-02-26 05:51:05 +00:00
|
|
|
ld a, [hl]
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ConstructCreditsTilemap:
|
2013-10-02 04:53:35 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $c
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapAddress], a
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $28
|
2015-07-22 19:57:02 +00:00
|
|
|
hlcoord 0, 0
|
2015-12-15 01:06:41 +00:00
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
2013-10-02 04:53:35 +00:00
|
|
|
call ByteFill
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $7f
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 0, 4
|
2015-12-15 01:06:41 +00:00
|
|
|
ld bc, (SCREEN_HEIGHT - 4) * SCREEN_WIDTH
|
2013-10-02 04:53:35 +00:00
|
|
|
call ByteFill
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 0, 4
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $24
|
2015-12-15 01:06:41 +00:00
|
|
|
call DrawCreditsBorder
|
|
|
|
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 0, 17
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $20
|
2015-12-15 01:06:41 +00:00
|
|
|
call DrawCreditsBorder
|
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-15 01:06:41 +00:00
|
|
|
ld bc, 4 * SCREEN_WIDTH
|
2013-10-02 04:53:35 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 4, wAttrmap
|
2015-12-15 01:06:41 +00:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $1
|
|
|
|
call ByteFill
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 5, wAttrmap
|
2015-12-15 01:06:41 +00:00
|
|
|
ld bc, 12 * SCREEN_WIDTH
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $2
|
|
|
|
call ByteFill
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 17, wAttrmap
|
2015-12-15 01:06:41 +00:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-10-02 04:53:35 +00:00
|
|
|
ld a, $1
|
|
|
|
call ByteFill
|
2015-12-15 01:06:41 +00:00
|
|
|
|
2015-12-11 21:59:40 +00:00
|
|
|
call WaitBGMap2
|
2013-10-02 04:53:35 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
|
|
|
ldh [hBGMapAddress], a
|
2015-07-22 19:57:02 +00:00
|
|
|
hlcoord 0, 0
|
2015-12-15 01:06:41 +00:00
|
|
|
call .InitTopPortion
|
2015-12-11 21:59:40 +00:00
|
|
|
call WaitBGMap2
|
2013-10-02 04:53:35 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitTopPortion:
|
2015-12-15 01:06:41 +00:00
|
|
|
ld b, 5
|
|
|
|
.outer_loop
|
2013-10-02 04:53:35 +00:00
|
|
|
push hl
|
2015-12-15 01:06:41 +00:00
|
|
|
ld de, SCREEN_WIDTH - 3
|
|
|
|
ld c, 4
|
2013-10-02 04:53:35 +00:00
|
|
|
xor a
|
2015-12-15 01:06:41 +00:00
|
|
|
.inner_loop
|
|
|
|
rept 3
|
2013-10-02 04:53:35 +00:00
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2015-12-15 01:06:41 +00:00
|
|
|
endr
|
2013-10-02 04:53:35 +00:00
|
|
|
ld [hl], a
|
|
|
|
inc a
|
|
|
|
add hl, de
|
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .inner_loop
|
2013-10-02 04:53:35 +00:00
|
|
|
pop hl
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 4
|
2013-10-02 04:53:35 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-10-02 04:53:35 +00:00
|
|
|
dec b
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .outer_loop
|
2013-10-02 04:53:35 +00:00
|
|
|
ret
|
2013-02-26 05:51:05 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DrawCreditsBorder:
|
2015-12-15 01:06:41 +00:00
|
|
|
ld c, SCREEN_WIDTH / 4
|
|
|
|
.loop
|
2013-10-02 04:53:35 +00:00
|
|
|
push af
|
2015-12-15 01:06:41 +00:00
|
|
|
rept 3
|
2013-10-02 04:53:35 +00:00
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2015-12-15 01:06:41 +00:00
|
|
|
endr
|
2013-10-02 04:53:35 +00:00
|
|
|
ld [hli], a
|
|
|
|
pop af
|
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .loop
|
2013-10-02 04:53:35 +00:00
|
|
|
ret
|
2013-02-26 05:51:05 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetCreditsPalette:
|
2013-02-26 05:51:05 +00:00
|
|
|
call .GetPalAddress
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
push hl
|
|
|
|
ld a, 0
|
|
|
|
call .UpdatePals
|
|
|
|
pop hl
|
|
|
|
ret
|
2016-04-10 18:42:14 +00:00
|
|
|
|
|
|
|
.GetPalAddress:
|
2013-02-26 05:51:05 +00:00
|
|
|
; Each set of palette data is 24 bytes long.
|
2015-12-15 01:06:41 +00:00
|
|
|
ld a, [wCreditsBorderMon] ; scene
|
2018-01-11 17:00:01 +00:00
|
|
|
and %11
|
2013-02-26 05:51:05 +00:00
|
|
|
add a
|
|
|
|
add a ; * 8
|
|
|
|
add a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2013-11-24 09:09:17 +00:00
|
|
|
ld hl, CreditsPalettes
|
2013-02-26 05:51:05 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de ; * 3
|
|
|
|
add hl, de
|
|
|
|
ret
|
2016-04-10 18:42:14 +00:00
|
|
|
|
|
|
|
.UpdatePals:
|
2013-02-26 05:51:05 +00:00
|
|
|
; Update the first three colors in both palette buffers.
|
|
|
|
push af
|
|
|
|
push hl
|
2018-01-01 14:08:21 +00:00
|
|
|
add LOW(wBGPals1)
|
2013-02-26 05:51:05 +00:00
|
|
|
ld e, a
|
|
|
|
ld a, 0
|
2018-01-01 14:08:21 +00:00
|
|
|
adc HIGH(wBGPals1)
|
2013-02-26 05:51:05 +00:00
|
|
|
ld d, a
|
|
|
|
ld bc, 24
|
|
|
|
call CopyBytes
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-26 05:51:05 +00:00
|
|
|
pop hl
|
|
|
|
pop af
|
2018-01-01 14:08:21 +00:00
|
|
|
add LOW(wBGPals2)
|
2013-02-26 05:51:05 +00:00
|
|
|
ld e, a
|
|
|
|
ld a, 0
|
2018-01-01 14:08:21 +00:00
|
|
|
adc HIGH(wBGPals2)
|
2013-02-26 05:51:05 +00:00
|
|
|
ld d, a
|
|
|
|
ld bc, 24
|
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2013-11-24 09:09:17 +00:00
|
|
|
CreditsPalettes:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/credits/credits.pal"
|
2013-02-26 05:51:05 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_LoadBorderGFX:
|
2015-12-15 01:06:41 +00:00
|
|
|
ld hl, wCreditsBorderFrame
|
2013-10-01 21:23:21 +00:00
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
2015-12-15 01:06:41 +00:00
|
|
|
jr z, .init
|
2013-11-24 09:09:17 +00:00
|
|
|
|
2018-01-11 17:00:01 +00:00
|
|
|
and %11
|
2013-10-01 21:23:21 +00:00
|
|
|
ld e, a
|
|
|
|
inc a
|
2018-01-11 17:00:01 +00:00
|
|
|
and %11
|
2013-10-01 21:23:21 +00:00
|
|
|
ld [hl], a
|
2015-12-15 01:06:41 +00:00
|
|
|
ld a, [wCreditsBorderMon]
|
2018-01-11 17:00:01 +00:00
|
|
|
and %11
|
2013-10-01 21:23:21 +00:00
|
|
|
add a
|
2016-05-04 15:46:23 +00:00
|
|
|
add a
|
2013-10-01 21:23:21 +00:00
|
|
|
add e
|
|
|
|
add a
|
|
|
|
ld e, a
|
2013-11-24 09:09:17 +00:00
|
|
|
ld d, 0
|
2015-12-15 01:06:41 +00:00
|
|
|
ld hl, .Frames
|
2013-10-01 21:23:21 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ret
|
2013-11-24 09:09:17 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.init
|
2018-08-26 17:08:01 +00:00
|
|
|
ld hl, wCreditsBlankFrame2bpp
|
2013-10-01 21:23:21 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Frames:
|
2013-11-24 09:09:17 +00:00
|
|
|
dw CreditsPichuGFX
|
2015-12-15 01:06:41 +00:00
|
|
|
dw CreditsPichuGFX + 16 tiles
|
|
|
|
dw CreditsPichuGFX + 32 tiles
|
|
|
|
dw CreditsPichuGFX + 48 tiles
|
2020-06-17 21:03:38 +00:00
|
|
|
|
2013-11-24 09:09:17 +00:00
|
|
|
dw CreditsSmoochumGFX
|
2015-12-15 01:06:41 +00:00
|
|
|
dw CreditsSmoochumGFX + 16 tiles
|
|
|
|
dw CreditsSmoochumGFX + 32 tiles
|
|
|
|
dw CreditsSmoochumGFX + 48 tiles
|
2020-06-17 21:03:38 +00:00
|
|
|
|
2013-11-24 09:09:17 +00:00
|
|
|
dw CreditsDittoGFX
|
2015-12-15 01:06:41 +00:00
|
|
|
dw CreditsDittoGFX + 16 tiles
|
|
|
|
dw CreditsDittoGFX + 32 tiles
|
|
|
|
dw CreditsDittoGFX + 48 tiles
|
2020-06-17 21:03:38 +00:00
|
|
|
|
2013-11-24 09:09:17 +00:00
|
|
|
dw CreditsIgglybuffGFX
|
2015-12-15 01:06:41 +00:00
|
|
|
dw CreditsIgglybuffGFX + 16 tiles
|
|
|
|
dw CreditsIgglybuffGFX + 32 tiles
|
|
|
|
dw CreditsIgglybuffGFX + 48 tiles
|
2013-10-01 21:23:21 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Credits_TheEnd:
|
2013-10-01 21:23:21 +00:00
|
|
|
ld a, $40
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 6, 9
|
2015-12-15 01:06:41 +00:00
|
|
|
call .Load
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 6, 10
|
2018-06-24 14:09:41 +00:00
|
|
|
.Load:
|
2015-12-15 01:06:41 +00:00
|
|
|
ld c, 8
|
|
|
|
.loop
|
2013-10-01 21:23:21 +00:00
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .loop
|
2013-10-01 21:23:21 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-27 01:02:00 +00:00
|
|
|
CreditsBorderGFX: INCBIN "gfx/credits/border.2bpp"
|
|
|
|
|
2018-06-13 03:29:15 +00:00
|
|
|
CreditsMonsGFX: ; used only for BANK(CreditsMonsGFX)
|
2017-12-27 01:02:00 +00:00
|
|
|
CreditsPichuGFX: INCBIN "gfx/credits/pichu.2bpp"
|
|
|
|
CreditsSmoochumGFX: INCBIN "gfx/credits/smoochum.2bpp"
|
|
|
|
CreditsDittoGFX: INCBIN "gfx/credits/ditto.2bpp"
|
|
|
|
CreditsIgglybuffGFX: INCBIN "gfx/credits/igglybuff.2bpp"
|
|
|
|
|
2017-12-15 22:22:52 +00:00
|
|
|
INCLUDE "data/credits_script.asm"
|
|
|
|
INCLUDE "data/credits_strings.asm"
|