junglejourney

changeset 88:24652251c79e

Show an open exit when the player has a key. Simplified the tile plotting routine, taking care to clear the carry flag before calling the blank tile plotting routine. Removed the check for the key when the player tries to exit the level because this now only occurs if the player encounters an open exit.
author David Boddie <david@boddie.org.uk>
date Wed Aug 31 01:52:31 2011 +0200
parents f45f5ce4ccb3
children b35f8f1fdd1b
files mapcode.oph
diffstat 1 files changed, 39 insertions(+), 53 deletions(-) [+]
line diff
     1.1 --- a/mapcode.oph	Wed Aug 31 01:12:15 2011 +0200
     1.2 +++ b/mapcode.oph	Wed Aug 31 01:52:31 2011 +0200
     1.3 @@ -344,9 +344,18 @@
     1.4      tax
     1.5      lda exit_room_offsets,x
     1.6      tax
     1.7 +    lda $33f0
     1.8 +    and #1
     1.9 +    beq exit_not_open
    1.10 +
    1.11 +    lda #5
    1.12 +    sta $579c,x
    1.13 +    rts
    1.14 +
    1.15 +    exit_not_open:
    1.16 +    clc
    1.17      lda #4
    1.18      sta $579c,x
    1.19 -
    1.20      rts
    1.21  
    1.22      make_room_not_exit_room:
    1.23 @@ -632,54 +641,38 @@
    1.24      
    1.25      rts
    1.26  
    1.27 +tile_addresses_low:  .byte $00, $60, $c0, $00, $60, $c0, $20
    1.28 +tile_addresses_high: .byte $53, $53, $53, $45, $45, $45, $46
    1.29 +
    1.30  plot_tile:          ; $7b=tile number
    1.31                      ;   1 = flowers/decoration
    1.32                      ;   2 = trees/wall
    1.33                      ;   3 = trees
    1.34                      ;   4 = exit
    1.35 +                    ;   5 = open exit
    1.36 +                    ;   6 = final exit (left)
    1.37 +                    ;   7 = final exit (right)
    1.38                      ; $72,$73=screen position 
    1.39  
    1.40      lda $7b
    1.41 -    cmp #1
    1.42 -    bne plot_tile_not_flowers
    1.43 -    lda #$00
    1.44 -    sta $70
    1.45 -    lda #$53
    1.46 -    sta $71
    1.47 -    jmp plot_not_blank
    1.48 -
    1.49 -    plot_tile_not_flowers:
    1.50 -    cmp #2
    1.51 -    bne plot_tile_not_tree1
    1.52 -    lda #$60
    1.53 -    sta $70
    1.54 -    lda #$53
    1.55 -    sta $71
    1.56 -    jmp plot_not_blank
    1.57 -
    1.58 -    plot_tile_not_tree1:
    1.59 -    cmp #3
    1.60 -    bne plot_tile_not_tree2
    1.61 -    lda #$c0
    1.62 -    sta $70
    1.63 -    lda #$53
    1.64 -    sta $71
    1.65 -    jmp plot_not_blank
    1.66 -
    1.67 -    plot_tile_not_tree2:
    1.68 -    cmp #4
    1.69 -    bne plot_tile_not_exit
    1.70 -    lda #$00
    1.71 -    sta $70
    1.72 -    lda #$45
    1.73 -    sta $71
    1.74 -    jmp plot_not_blank_after_add_loop   ; don't adjust the tile for later levels
    1.75 -
    1.76 -    plot_tile_not_exit:
    1.77 +    cmp #0
    1.78 +    bne plot_tile_sprite
    1.79      clc
    1.80      jmp plot_blank      ; optimise away the rts
    1.81  
    1.82 -    plot_not_blank:
    1.83 +    plot_tile_sprite:
    1.84 +    clc
    1.85 +    tax
    1.86 +    dex
    1.87 +    lda tile_addresses_low,x
    1.88 +    sta $70
    1.89 +    lda tile_addresses_high,x
    1.90 +    sta $71
    1.91 +
    1.92 +    lda $7b
    1.93 +    cmp #4
    1.94 +    bpl plot_not_blank_after_add_loop   ; don't adjust the tile for later levels
    1.95 +    
    1.96      clc
    1.97      lda $33fa
    1.98      and #3              ; change the tile set for later levels
    1.99 @@ -1681,8 +1674,8 @@
   1.100      sta $71
   1.101      lda ($70),y                 ; load the tile to the left
   1.102  
   1.103 -    cmp #4                      ; check for the exit
   1.104 -    bne move_player_not_left_exit
   1.105 +    cmp #5                      ; check for the open exit or final exit
   1.106 +    bmi move_player_not_left_exit
   1.107      jmp try_to_exit_level       ; optimise away the rts
   1.108  
   1.109      move_player_not_left_exit:
   1.110 @@ -1770,8 +1763,8 @@
   1.111      sta $71
   1.112      lda ($70),y                 ; load the tile to the right
   1.113  
   1.114 -    cmp #4                      ; check for the exit
   1.115 -    bne move_player_not_right_exit
   1.116 +    cmp #5                      ; check for the open exit or final exit
   1.117 +    bmi move_player_not_right_exit
   1.118      jmp try_to_exit_level       ; optimise away the rts
   1.119  
   1.120      move_player_not_right_exit:
   1.121 @@ -1861,8 +1854,8 @@
   1.122      sta $71
   1.123      lda ($70),y                 ; load the tile above
   1.124  
   1.125 -    cmp #4                      ; check for the exit
   1.126 -    bne move_player_not_up_exit
   1.127 +    cmp #5                      ; check for the open exit or final exit
   1.128 +    bmi move_player_not_up_exit
   1.129      jmp try_to_exit_level       ; optimise away the rts
   1.130  
   1.131      move_player_not_up_exit:
   1.132 @@ -1948,8 +1941,8 @@
   1.133      sta $71
   1.134      lda ($70),y                 ; load the tile below
   1.135  
   1.136 -    cmp #4                      ; check for the exit
   1.137 -    bne move_player_not_down_exit
   1.138 +    cmp #5                      ; check for the open exit or final exit
   1.139 +    bmi move_player_not_down_exit
   1.140      jmp try_to_exit_level       ; optimise away the rts
   1.141  
   1.142      move_player_not_down_exit:
   1.143 @@ -2008,9 +2001,6 @@
   1.144      rts
   1.145  
   1.146  try_to_exit_level:
   1.147 -    lda $33f0
   1.148 -    and #$01
   1.149 -    beq try_to_exit_level_exit
   1.150  
   1.151      lda $33f0                   ; set the exit flag
   1.152      ora #$80
   1.153 @@ -2018,10 +2008,6 @@
   1.154      sec                         ; indicate that the player is leaving the room
   1.155      rts
   1.156  
   1.157 -    try_to_exit_level_exit:
   1.158 -    clc
   1.159 -    rts
   1.160 -
   1.161  check_fire_key:
   1.162  
   1.163      lda $33fd