2 ; Copyright (C) 2010 Kent Hansen.
4 ; This program is free software; you can redistribute it and/or modify
5 ; it under the terms of the GNU General Public License as published by
6 ; the Free Software Foundation; either version 3 of the License, or
7 ; (at your option) any later version.
9 ; This program is distributed in the hope that it will be useful,
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ; GNU General Public License for more details.
14 ; You should have received a copy of the GNU General Public License
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
18 .
include "common/fade.h"
19 .
include "common/joypad.h"
20 .
include "common/ldc.h"
21 .
include "common/palette.h"
22 .
include "common/ppu.h"
23 .
include "common/ppubuffer.h"
24 .
include "common/sprite.h"
25 .
include "common/timer.h"
26 .
include "sound/mixer.h"
27 .
include "sound/sound.h"
28 .
include "sound/sfx.h"
39 .
public difficultyselect_init
40 .
public difficultyselect_main
43 .extrn
main_cycle:byte
44 .extrn
frame_count:byte
46 .
proc difficultyselect_init
51 lda #
24 : sta chr_banks
[0]
52 lda #
26 : sta chr_banks
[1]
53 lda #
0 : sta chr_banks
[2]
54 lda #
0 : sta chr_banks
[3]
55 lda #
0 : sta chr_banks
[4]
56 lda #
0 : sta chr_banks
[5]
72 jsr start_fade_from_black
78 sta player.difficulty
; normal is default
87 .
db $0f,$06,$16,$27,$0f,$27,$00,$20,$0f,$06,$00,$10,$0f,$00,$10,$20
88 .
db $0f,$0C,$00,$20,$0f,$20,$20,$20,$0f,$20,$20,$20,$0f,$20,$20,$20
91 .incbin
"graphics/difficultyselect-bg.dat"
103 .
proc difficultyselect_main
106 lsr
: lsr
: lsr
: lsr
112 ; CF: 0 = normal, 1 = other
114 ; To highlight the selection, we flip the palette of the current row.
115 ; Each row is 6 tiles tall.
118 ldy player.difficulty
119 lda
@@attrib_length,y
121 lda
@@attrib_addr_lo,y
124 ldy player.difficulty
125 lda
@@attrib_data_1st,y
132 jsr put_ppu_string_byte
135 ldy player.difficulty
136 lda
@@attrib_length,y
138 lda
@@attrib_addr_lo,y
143 ldy player.difficulty
144 lda
@@attrib_data_2nd,y
150 jsr put_ppu_string_byte
163 .
proc play_cursor_sfx
171 and #
(JOYPAD_BUTTON_START | JOYPAD_BUTTON_A
)
172 bne
@@select_difficulty
174 and #JOYPAD_BUTTON_UP
177 and #
(JOYPAD_BUTTON_DOWN | JOYPAD_BUTTON_SELECT
)
181 bne
@@next_speed_level
187 inc player.speed_level
188 lda player.speed_level
192 sta player.speed_level
193 + jmp play_cursor_sfx
198 jsr draw_selection
; make sure old selection is disabled
199 dec player.difficulty
202 sta player.difficulty
203 + jmp play_cursor_sfx
207 jsr draw_selection
; make sure old selection is disabled
208 inc player.difficulty
209 lda player.difficulty
213 sta player.difficulty
214 + jmp play_cursor_sfx
218 jsr draw_selection
; make sure it's drawn selected
220 .ifndef NO_TRANSITIONS
225 ; start fading out music
230 @@start_fade_out_music_timer:
234 lda #
<@@fade_out_music
235 ldy #
>@@fade_out_music
236 jmp set_timer_callback
239 jsr mixer_get_master_vol
243 jsr mixer_set_master_vol
244 jmp @@start_fade_out_music_timer
245 + ; done fading out music
247 jsr start_song
; mute
251 lda #
<@@really_select
252 ldy #
>@@really_select
253 jsr set_timer_callback
254 jmp start_fade_to_black