junglejourney
changeset 116:101d8474c62d
Redesigned the high score entry routine to be easier to implement.
Refactored all the places where the screen is cleared into a single
cls routine that they can all call, saving more space.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Mon Sep 05 23:08:49 2011 +0200 |
| parents | 2f8c43559970 |
| children | 86033c6faa01 |
| files | mapcode.oph |
| diffstat | 1 files changed, 46 insertions(+), 63 deletions(-) [+] |
line diff
1.1 --- a/mapcode.oph Mon Sep 05 22:42:28 2011 +0200 1.2 +++ b/mapcode.oph Mon Sep 05 23:08:49 2011 +0200 1.3 @@ -4216,8 +4216,7 @@ 1.4 ; Move the completed screen down in memory, decoding it. 1.5 jsr move_completed_screen_down 1.6 1.7 - lda #12 ; clear the text window 1.8 - jsr $ffee 1.9 + jsr cls ; clear the text window 1.10 1.11 lda #26 ; unset the text window 1.12 jsr $ffee 1.13 @@ -4437,7 +4436,7 @@ 1.14 lda #19 1.15 jmp $fff4 ; optimise away the rts 1.16 1.17 -game_over_vdu_bytes: .byte 31,4,15, 17,2, "The journey", 31,7,17, "is over" 1.18 +game_over_vdu_bytes: .byte 31,4,15, 17,2, "The journey", 31,9,17, "is over" 1.19 1.20 show_game_over: 1.21 1.22 @@ -4875,51 +4874,41 @@ 1.23 lda #65 1.24 sta $72 1.25 1.26 - ldx #5 1.27 - ldy #0 1.28 + ldx #3 1.29 plot_text_characters_loop: 1.30 1.31 - cpy #14 1.32 - beq skip_space 1.33 - cpy #15 1.34 - beq skip_space 1.35 - 1.36 jsr print_xy 1.37 + 1.38 + lda $70 1.39 + adc #4 1.40 + sta $70 1.41 + 1.42 + dex 1.43 + bpl plot_text_characters_next 1.44 + 1.45 + lda #3 1.46 + sta $70 1.47 + lda $71 1.48 + adc #3 1.49 + sta $71 1.50 + 1.51 + ldx #3 1.52 + 1.53 + plot_text_characters_next: 1.54 + 1.55 inc $72 1.56 - 1.57 - skip_space: 1.58 - clc 1.59 - 1.60 - plot_text_characters_next1: 1.61 - lda $71 1.62 - adc #4 1.63 - sta $71 1.64 - 1.65 - dex 1.66 - bpl plot_text_characters_next2 1.67 - 1.68 - lda #6 1.69 - sta $71 1.70 - lda $70 1.71 - adc #3 1.72 - sta $70 1.73 - 1.74 - ldx #5 1.75 - 1.76 - plot_text_characters_next2: 1.77 - 1.78 - iny 1.79 lda $72 1.80 cmp #91 1.81 bne plot_text_characters_loop 1.82 1.83 + lda #11 1.84 + sta $70 1.85 lda #95 ; _ representing a space 1.86 sta $72 1.87 jsr print_xy 1.88 1.89 - lda $71 1.90 - adc #4 1.91 - sta $71 1.92 + lda #15 1.93 + sta $70 1.94 lda #60 ; < representing delete 1.95 sta $72 1.96 jsr print_xy 1.97 @@ -4949,30 +4938,22 @@ 1.98 jsr move_player 1.99 bcs high_score_entry_after_loop ; check if the player leaves the room 1.100 1.101 + lda $3303 ; dy 1.102 + cmp #0 1.103 + bne high_score_entry_not_aligned 1.104 + 1.105 lda $3302 ; y 1.106 - asl 1.107 - and #7 1.108 - cmp $3303 ; dy 1.109 + cmp #8 1.110 + bpl high_score_entry_not_aligned 1.111 + 1.112 + adc $3304 ; x 1.113 + and #1 1.114 + beq high_score_entry_not_aligned 1.115 + 1.116 + lda $3305 ; dx 1.117 + cmp #2 1.118 bne high_score_entry_not_aligned 1.119 1.120 - lda $3305 ; dx 1.121 - tax 1.122 - and #1 1.123 - bne high_score_entry_not_aligned 1.124 - txa 1.125 - adc $3304 ; x 1.126 - 1.127 - cmp #3 1.128 - beq high_score_entry_aligned 1.129 - cmp #6 1.130 - beq high_score_entry_aligned 1.131 - cmp #9 1.132 - bne high_score_entry_not_aligned 1.133 - 1.134 - high_score_entry_aligned: 1.135 - 1.136 - 1.137 - 1.138 ; The player is aligned with a letter. 1.139 1.140 high_score_entry_not_aligned: 1.141 @@ -4985,10 +4966,14 @@ 1.142 high_score_entry_after_loop: 1.143 clc 1.144 1.145 + jsr cls 1.146 + jsr set_hidden_palette 1.147 + 1.148 + rts 1.149 + 1.150 +cls: 1.151 lda #12 1.152 jsr $ffee 1.153 - jsr set_hidden_palette 1.154 - 1.155 rts 1.156 1.157 print_xy: 1.158 @@ -5009,8 +4994,7 @@ 1.159 start_new_game: 1.160 1.161 ; Clear the screen. 1.162 - lda #12 1.163 - jsr $ffee 1.164 + jsr cls 1.165 1.166 ; Set the level. 1.167 lda #0 1.168 @@ -5318,8 +5302,7 @@ 1.169 jmp main_loop_play_again 1.170 1.171 main_loop_play_again: 1.172 - lda #12 1.173 - jsr $ffee 1.174 + jsr cls 1.175 1.176 ; Check the score against the high scores. 1.177 jsr check_high_scores
