junglejourney

changeset 45:2cf14232ef0f

Made the fire key independent from the other keys. Applied the update counter to limit the rate of fire.
author David Boddie <david@boddie.org.uk>
date Sun Aug 21 21:46:42 2011 +0200
parents 5a120c2b6e89
children 94c31bab0877
files mapcode.oph
diffstat 1 files changed, 38 insertions(+), 12 deletions(-) [+]
line diff
     1.1 --- a/mapcode.oph	Sun Aug 21 21:30:56 2011 +0200
     1.2 +++ b/mapcode.oph	Sun Aug 21 21:46:42 2011 +0200
     1.3 @@ -1772,21 +1772,27 @@
     1.4      rts                         ; player has left the room
     1.5  
     1.6      move_player_not_down_key:
     1.7 -
     1.8 -    ; Handle the fire key.
     1.9 +    clc
    1.10 +    rts
    1.11 +
    1.12 +check_fire_key:
    1.13 +
    1.14 +    lda $33fe
    1.15 +    and #15
    1.16 +    bne check_fire_key_exit
    1.17  
    1.18      ldx #182            ; (Return)
    1.19      jsr check_key
    1.20      cpy #255
    1.21 -    bne move_player_not_fire_key
    1.22 +    bne check_fire_key_exit
    1.23  
    1.24      lda $3306
    1.25      cmp #0
    1.26 -    bne move_player_not_fire_key
    1.27 +    bne check_fire_key_exit
    1.28  
    1.29      jmp create_projectile   ; optimise away the rts
    1.30  
    1.31 -    move_player_not_fire_key:
    1.32 +    check_fire_key_exit:
    1.33      clc
    1.34      rts
    1.35  
    1.36 @@ -2465,8 +2471,11 @@
    1.37      lda #3
    1.38      sta $330b       ; dx = 3
    1.39  
    1.40 +    clc
    1.41 +    rts
    1.42 +
    1.43      move_projectile_left_exit:
    1.44 -    clc
    1.45 +    sec
    1.46      rts
    1.47  
    1.48  move_projectile_right:
    1.49 @@ -2526,9 +2535,11 @@
    1.50      inc $330a       ; x
    1.51      lda #0
    1.52      sta $330b       ; dx
    1.53 +    clc
    1.54 +    rts
    1.55  
    1.56      move_projectile_right_exit:
    1.57 -    clc
    1.58 +    sec
    1.59      rts
    1.60  
    1.61  move_projectile_up:
    1.62 @@ -2577,8 +2588,11 @@
    1.63      lda #5
    1.64      sta $3309               ; dy = 5
    1.65  
    1.66 +    clc
    1.67 +    rts
    1.68 +
    1.69      move_projectile_up_exit:
    1.70 -    clc
    1.71 +    sec
    1.72      rts
    1.73  
    1.74  move_projectile_down:
    1.75 @@ -2635,9 +2649,11 @@
    1.76      inc $3308                   ; store the new room y offset
    1.77      lda #0
    1.78      sta $3309                   ; dy = 0
    1.79 +    clc
    1.80 +    rts
    1.81  
    1.82      move_projectile_down_exit:
    1.83 -    clc
    1.84 +    sec
    1.85      rts
    1.86  
    1.87  move_projectile_animate:
    1.88 @@ -2666,32 +2682,41 @@
    1.89      bne move_projectile_not_left
    1.90  
    1.91      jsr move_projectile_left
    1.92 -    jmp move_projectile_toggle
    1.93 +    bcc move_projectile_toggle
    1.94 +    bcs move_projectile_destroy
    1.95  
    1.96      move_projectile_not_left:
    1.97      cmp #$08
    1.98      bne move_projectile_not_right
    1.99  
   1.100      jsr move_projectile_right
   1.101 -    jmp move_projectile_toggle
   1.102 +    bcc move_projectile_toggle
   1.103 +    bcs move_projectile_destroy
   1.104  
   1.105      move_projectile_not_right:
   1.106      cmp #$10
   1.107      bne move_projectile_not_up
   1.108  
   1.109      jsr move_projectile_up
   1.110 -    jmp move_projectile_toggle
   1.111 +    bcc move_projectile_toggle
   1.112 +    bcs move_projectile_destroy
   1.113  
   1.114      move_projectile_not_up:
   1.115      cmp #$18
   1.116      bne move_projectile_toggle
   1.117  
   1.118      jsr move_projectile_down
   1.119 +    bcs move_projectile_destroy
   1.120  
   1.121      move_projectile_toggle:
   1.122      jsr move_projectile_animate
   1.123      jmp plot_character          ; optimise away the rts
   1.124  
   1.125 +    move_projectile_destroy:
   1.126 +    clc
   1.127 +    lda #0
   1.128 +    sta $3306
   1.129 +
   1.130      move_projectile_exit:
   1.131      clc
   1.132      rts
   1.133 @@ -2949,6 +2974,7 @@
   1.134                  jsr move_characters
   1.135                  jsr move_projectile
   1.136  
   1.137 +                jsr check_fire_key
   1.138                  jsr move_player
   1.139                  bcs after_room_loop
   1.140