junglejourney
changeset 113:f4cdc821c831
Experimented with a high score entry screen, but memory is almost
full, so we shall try something else.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Sun Sep 04 23:28:21 2011 +0200 |
| parents | 174f536c9512 |
| children | 81dd2318a0a4 |
| files | TODO.txt build.py loader.oph mapcode.oph |
| diffstat | 4 files changed, 277 insertions(+), 40 deletions(-) [+] |
line diff
1.1 --- a/TODO.txt Sun Sep 04 19:06:28 2011 +0200 1.2 +++ b/TODO.txt Sun Sep 04 23:28:21 2011 +0200 1.3 @@ -1,7 +1,7 @@ 1.4 To Do 1.5 1.6 -Check and fix object generation. 1.7 Implement high score input. 1.8 +Convert all emerging enemies to explosions at game over time. 1.9 Improve the fire, explosion and player sprites. 1.10 Add sounds. 1.11 Nice to have: make projectiles start next to the player, not on top of him.
2.1 --- a/build.py Sun Sep 04 19:06:28 2011 +0200 2.2 +++ b/build.py Sun Sep 04 23:28:21 2011 +0200 2.3 @@ -104,8 +104,9 @@ 2.4 # 2.5 # 4*2*0x30 + 4*0x30 + 4*2*0x10 + 5*4*2*0x40 + 4*0x40 + 4*0x40 + 4*0x40 + 5*0x40 + 2*0x60 + 2*0x60 + 0x3400 2.6 # 2.7 - # 5080 high scores 2.8 + # 5080 high scores (8 * 12 = 0xe0) 2.9 # n 3 bytes score + 9 bytes ASCII 2.10 + # 2.11 # 5100 objects/treasure table (121 entries) 2.12 # n type 2.13 #
3.1 --- a/loader.oph Sun Sep 04 19:06:28 2011 +0200 3.2 +++ b/loader.oph Sun Sep 04 23:28:21 2011 +0200 3.3 @@ -94,8 +94,8 @@ 3.4 code_block: .byte <code_file_name, >code_file_name 3.5 .byte $00, $1f, 0, 0 3.6 .byte $00, $1f, 0, 0 3.7 - .byte $dd, $1c, 0, 0 3.8 - .byte $dd, $3b, 0, 0 3.9 + .byte $fe, $1d, 0, 0 3.10 + .byte $fe, $3c, 0, 0 3.11 3.12 init_load_window_vdu_bytes: .byte 28,0,29,19,24 3.13
4.1 --- a/mapcode.oph Sun Sep 04 19:06:28 2011 +0200 4.2 +++ b/mapcode.oph Sun Sep 04 23:28:21 2011 +0200 4.3 @@ -69,7 +69,7 @@ 4.4 4.5 ; Room filling routines, writing to 0x579c to 0x57ff. 4.6 4.7 -draw_top_line: 4.8 +draw_top_line: ; $76=tile number for exit/wall 4.9 ldx #9 4.10 lda #2 4.11 4.12 @@ -87,7 +87,7 @@ 4.13 clc 4.14 rts 4.15 4.16 -draw_left_line: 4.17 +draw_left_line: ; $77=tile number for exit/wall 4.18 ldx #90 4.19 draw_left_line_loop0: 4.20 lda #2 4.21 @@ -110,7 +110,7 @@ 4.22 clc 4.23 rts 4.24 4.25 -draw_bottom_line: 4.26 +draw_bottom_line: ; $76=tile number for exit/wall 4.27 ldx #9 4.28 lda #2 4.29 draw_bottom_line_loop0: 4.30 @@ -127,7 +127,7 @@ 4.31 clc 4.32 rts 4.33 4.34 -draw_right_line: 4.35 +draw_right_line: ; $77=tile number for exit/wall 4.36 ldx #99 4.37 draw_right_line_loop0: 4.38 lda #2 4.39 @@ -150,6 +150,17 @@ 4.40 clc 4.41 rts 4.42 4.43 +make_empty_room: 4.44 + 4.45 + ldx #99 4.46 + make_empty_room_loop: 4.47 + lda #0 4.48 + sta $579c,x 4.49 + dex 4.50 + bpl make_empty_room_loop 4.51 + 4.52 + rts 4.53 + 4.54 make_room: ; $78,$79=i,j 4.55 4.56 ; Fills the room array at 579c with values. 4.57 @@ -162,12 +173,7 @@ 4.58 4.59 ; Fill the room with empty space. 4.60 4.61 - ldx #100 4.62 - make_empty_room_loop: 4.63 - lda #0 4.64 - sta $579c,x 4.65 - dex 4.66 - bpl make_empty_room_loop 4.67 + jsr make_empty_room 4.68 4.69 ; Determine if there is a top exit. 4.70 4.71 @@ -812,6 +818,10 @@ 4.72 jmp row_loop 4.73 4.74 end_rows: 4.75 + rts 4.76 + 4.77 +set_room_palette: ; $78=i; $79=j 4.78 + 4.79 lda #1 4.80 sta $70 4.81 lda $78 4.82 @@ -4467,7 +4477,7 @@ 4.83 lda #19 4.84 jmp $fff4 ; optimise away the rts 4.85 4.86 -game_over_vdu_bytes: .byte 31,4,14, 17,2, "The journey", 31,6,15, "is over" 4.87 +game_over_vdu_bytes: .byte 31,4,15, 17,2, "The journey", 31,7,16, "is over" 4.88 4.89 show_game_over: 4.90 4.91 @@ -4495,13 +4505,8 @@ 4.92 show_end_of_level_screen: 4.93 4.94 ; Draw a decorative room. 4.95 - ldx #99 4.96 - end_of_level_clear_room_loop: 4.97 - 4.98 - lda #0 4.99 - sta $579c,x 4.100 - dex 4.101 - bpl end_of_level_clear_room_loop 4.102 + 4.103 + jsr make_empty_room 4.104 4.105 ldx #5 4.106 end_of_level_h_walls_loop: 4.107 @@ -4525,6 +4530,7 @@ 4.108 bpl end_of_level_v_walls_loop 4.109 4.110 jsr plot_room_tiles 4.111 + jsr set_standard_palette 4.112 4.113 ldx #0 4.114 end_of_level_text_loop1: 4.115 @@ -4562,19 +4568,7 @@ 4.116 bne end_of_level_room_count_loop 4.117 4.118 ; Position the player so that we can perform an animation. 4.119 - jsr reset_player_position 4.120 - jsr remove_characters 4.121 - 4.122 - jsr reset_unplot_buffer 4.123 - jsr reset_plot_buffer 4.124 - 4.125 - lda #$00 ; plot the player 4.126 - sta $74 4.127 - lda #$3d 4.128 - sta $75 4.129 - jsr plot_character 4.130 - 4.131 - jsr plot_buffer 4.132 + jsr position_player_set_up_plotting 4.133 4.134 lda $8d 4.135 sta $70 4.136 @@ -4725,11 +4719,28 @@ 4.137 clc 4.138 rts 4.139 4.140 +position_player_set_up_plotting: 4.141 + 4.142 + jsr reset_player_position 4.143 + jsr remove_characters 4.144 + 4.145 + jsr reset_unplot_buffer 4.146 + jsr reset_plot_buffer 4.147 + 4.148 + lda #$00 ; plot the player 4.149 + sta $74 4.150 + lda #$3d 4.151 + sta $75 4.152 + jsr plot_character 4.153 + 4.154 + jsr plot_buffer 4.155 + rts 4.156 + 4.157 complete_game_vdu_bytes1: .byte 12 4.158 complete_game_vdu_bytes2: .byte 17,3, 31,2,20, "Congratulations!" 4.159 complete_game_vdu_bytes3: .byte 17,2, 31,1,22, "Now journey onward" 4.160 complete_game_vdu_bytes4: .byte 17,2, 31,1,24, "to a new adventure" 4.161 -complete_game_vdu_bytes5: .byte 17,1, 31,4,27, "Press SPACE", 31,7,28, "to exit" 4.162 +complete_game_vdu_bytes5: .byte 17,1, 31,4,27, "Press SPACE" 4.163 4.164 show_complete_game: 4.165 4.166 @@ -4762,7 +4773,7 @@ 4.167 lda complete_game_vdu_bytes5,x 4.168 jsr $ffee 4.169 inx 4.170 - cpx #26 4.171 + cpx #16 4.172 bne show_complete_game_message_loop 4.173 4.174 show_complete_game_no_message: 4.175 @@ -4775,6 +4786,228 @@ 4.176 4.177 check_high_scores: 4.178 4.179 + ; Start at the bottom of the table, moving scores down as necessary, and 4.180 + ; write in the current score at the appropriate place. 4.181 + 4.182 + lda #$f6 ; current score 4.183 + sta $70 4.184 + lda #$3d 4.185 + sta $71 4.186 + 4.187 + lda #$80 4.188 + sta $72 4.189 + lda #$50 4.190 + sta $73 4.191 + 4.192 + check_high_scores_loop: 4.193 + 4.194 + ldy #2 4.195 + check_high_scores_digits_loop: 4.196 + 4.197 + lda ($72),y 4.198 + cmp ($70),y ; existing score less than current score? 4.199 + bmi check_high_scores_move_down 4.200 + beq check_high_scores_digits_next ; keep checking digits if equal 4.201 + jmp check_high_scores_next 4.202 + 4.203 + check_high_scores_digits_next: 4.204 + dey 4.205 + bpl check_high_scores_digits_loop 4.206 + 4.207 + check_high_scores_next: 4.208 + clc 4.209 + lda $72 4.210 + adc #12 4.211 + sta $72 4.212 + cmp #$e0 4.213 + bne check_high_scores_loop 4.214 + 4.215 + ; The player's score didn't make it into the high score table. 4.216 + rts 4.217 + 4.218 +check_high_scores_move_down: ; $70,$71=pointer to current score 4.219 + ; $72,$73=pointer to old score 4.220 + 4.221 + ; The current score exceeded the existing entry. Make a note of the 4.222 + ; position in the high score table, insert the player's score, and take 4.223 + ; the old score 4.224 + 4.225 + lda $72 ; Record the position in the high score table of the 4.226 + sta $8d ; player's score. 4.227 + lda $73 4.228 + sta $8e 4.229 + 4.230 + lda #$e0 4.231 + sta $74 4.232 + lda #$50 4.233 + sta $75 4.234 + 4.235 + ldy #0 4.236 + insert_blank_player_name_loop: 4.237 + 4.238 + cpy #3 4.239 + bpl insert_blank_player_name_score_only 4.240 + 4.241 + lda ($70),y 4.242 + jmp insert_blank_player_name_store 4.243 + 4.244 + insert_blank_player_name_score_only: 4.245 + lda #32 4.246 + 4.247 + insert_blank_player_name_store: 4.248 + sta ($74),y 4.249 + iny 4.250 + cpy #12 4.251 + bne insert_blank_player_name_loop 4.252 + 4.253 + check_high_scores_move_down_loop: 4.254 + 4.255 + ldy #0 4.256 + check_high_scores_copy_score_and_name: 4.257 + 4.258 + lda ($72),y ; swap the current score with the score in the table 4.259 + tax 4.260 + lda ($74),y 4.261 + sta ($72),y 4.262 + txa 4.263 + sta ($74),y 4.264 + iny 4.265 + cpy #12 4.266 + bne check_high_scores_copy_score_and_name 4.267 + 4.268 + clc 4.269 + lda $72 4.270 + adc #12 4.271 + sta $72 4.272 + cmp #$e0 4.273 + bne check_high_scores_move_down_loop 4.274 + 4.275 + ; Draw a decorative room. 4.276 + 4.277 + jsr set_hidden_palette 4.278 + 4.279 + jsr make_empty_room 4.280 + 4.281 + lda #3 4.282 + sta $76 4.283 + sta $77 4.284 + jsr draw_top_line 4.285 + jsr draw_bottom_line 4.286 + jsr draw_left_line 4.287 + 4.288 + lda #0 4.289 + sta $77 4.290 + jsr draw_right_line 4.291 + 4.292 + jsr plot_room_tiles 4.293 + 4.294 + ; Add text characters to the room. 4.295 + 4.296 + lda #5 4.297 + jsr $ffee 4.298 + 4.299 + lda #160 ; x (low) 4.300 + sta $70 4.301 + lda #0 ; x (high) 4.302 + sta $71 4.303 + 4.304 + lda #$40 ; y (low) 4.305 + sta $72 4.306 + lda #$03 ; y (high) 4.307 + sta $73 4.308 + 4.309 + lda #65 4.310 + sta $74 4.311 + 4.312 + plot_text_characters_loop: 4.313 + 4.314 + lda #25 4.315 + jsr $ffee 4.316 + lda #4 4.317 + jsr $ffee 4.318 + 4.319 + ldx #0 4.320 + move_xy_loop: 4.321 + 4.322 + lda $70,x 4.323 + jsr $ffee 4.324 + inx 4.325 + cpx #5 4.326 + bne move_xy_loop 4.327 + 4.328 + cmp #90 4.329 + bpl plot_text_characters_endloop 4.330 + 4.331 + inc $74 4.332 + 4.333 + lda $70 4.334 + adc #128 4.335 + sta $70 4.336 + lda $71 4.337 + adc #0 4.338 + sta $71 4.339 + clc 4.340 + 4.341 + cmp #$04 4.342 + bne plot_text_characters_loop 4.343 + lda $70 4.344 + cmp #$20 4.345 + bne plot_text_characters_loop 4.346 + 4.347 + lda #160 4.348 + sta $70 4.349 + lda #0 4.350 + sta $71 4.351 + 4.352 + lda $72 4.353 + sec 4.354 + sbc #192 4.355 + sta $72 4.356 + lda $73 4.357 + sbc #0 4.358 + sta $73 4.359 + clc 4.360 + 4.361 + jmp plot_text_characters_loop 4.362 + 4.363 + plot_text_characters_endloop: 4.364 + clc 4.365 + 4.366 + ; Put the player in the centre of the room. 4.367 + jsr position_player_set_up_plotting 4.368 + 4.369 + lda #0 ; reset motion counter 4.370 + sta $3dfe 4.371 + 4.372 + lda #0 ; not on a character 4.373 + sta $3dfd 4.374 + 4.375 + lda #0 ; reset the level number so that the correct tiles are used 4.376 + sta $3dfa 4.377 + 4.378 + jsr set_standard_palette 4.379 + 4.380 + high_score_entry_loop: 4.381 + 4.382 + jsr reset_unplot_buffer 4.383 + jsr reset_plot_buffer 4.384 + 4.385 + jsr move_player 4.386 + bcs high_score_entry_after_loop ; check if the player leaves the room 4.387 + 4.388 + lda #19 4.389 + jsr $fff4 4.390 + jsr plot_buffer 4.391 + 4.392 + jmp high_score_entry_loop 4.393 + 4.394 + high_score_entry_after_loop: 4.395 + clc 4.396 + 4.397 + lda #12 4.398 + jsr $ffee 4.399 + jsr set_hidden_palette 4.400 + 4.401 rts 4.402 4.403 status_vdu_bytes: .byte 31,2,0, 17,3, "Score", 31,11,0, 17,2, "Strength", 17,1 4.404 @@ -4793,7 +5026,9 @@ 4.405 ; Set the score. 4.406 lda #0 4.407 sta $3df6 4.408 + lda #$02 4.409 sta $3df7 4.410 + lda #0 4.411 sta $3df8 4.412 4.413 ; Blank the screen now because it will be blanked before the room is shown 4.414 @@ -4801,7 +5036,7 @@ 4.415 jsr blank_screen 4.416 4.417 ; Set the player's strength. 4.418 - lda #64 4.419 + lda #4 4.420 sta $70 4.421 jsr add_strength 4.422 4.423 @@ -4967,6 +5202,7 @@ 4.424 lda $3df3 ; current room (x) 4.425 sta $79 4.426 jsr plot_room 4.427 + jsr set_room_palette 4.428 jsr add_treasure 4.429 4.430 lda #$00 ; plot the player 4.431 @@ -4977,10 +5213,10 @@ 4.432 4.433 jsr plot_buffer 4.434 4.435 - lda #0 ; reset projectile counter 4.436 + lda #0 ; reset projectile counter 4.437 sta $3dfd 4.438 4.439 - lda #0 ; reset motion counter 4.440 + lda #0 ; reset motion counter 4.441 sta $3dfe 4.442 4.443 lda #63 ; reset generation counter
