summaryrefslogtreecommitdiff
path: root/src/engine/menus/medal.asm
blob: 57803e375cba7508bde2fe418e617d4020d990c6 (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
ShowMedalReceivedScreen:
	sub $8
	ld c, a
	ld [wWhichMedal], a
	ld a, [wd291]
	push af
	push bc
	call PauseSong
	ld a, MUSIC_STOP
	call PlaySong
	farcall SetMainSGBBorder
	call DisableLCD
	call InitMenuScreen
	ld a, -6
	ld [wMedalScreenYOffset], a
	call LoadCollectedMedalTilemaps
	pop bc
	ld a, c
	add a
	ld c, a
	ld b, $0
	ld hl, MasterMedalNames
	add hl, bc
	ld a, [hli]
	ld [wTxRam2], a
	ld a, [hl]
	ld [wTxRam2 + 1], a
	call FlashWhiteScreen
	ld a, MUSIC_MEDAL
	call PlaySong
	ld a, $ff
	ld [wMedalDisplayTimer], a
.flash_loop
	call DoFrameIfLCDEnabled
	ld a, [wMedalDisplayTimer]
	inc a
	ld [wMedalDisplayTimer], a
	and $f
	jr nz, .flash_loop
	call FlashReceivedMedal
	ld a, [wMedalDisplayTimer]
	cp $e0
	jr nz, .flash_loop
	ldtx hl, WonTheMedalText
	call PrintScrollableText_NoTextBoxLabel
	call WaitForSongToFinish
	call ResumeSong
	pop af
	ld [wd291], a
	ret

MasterMedalNames:
	tx GrassClubMapNameText
	tx ScienceClubMapNameText
	tx FireClubMapNameText
	tx WaterClubMapNameText
	tx LightningClubMapNameText
	tx PsychicClubMapNameText
	tx RockClubMapNameText
	tx FightingClubMapNameText