junglejourney

changeset 220:f25989daa9f9

Adjusted the joystick threshold values. Ensured that only joystick or keyboard checks are performed depending on the mode of input.
author David Boddie <david@boddie.org.uk>
date Sun Nov 06 02:18:39 2011 +0100
parents 02610f059ac0
children 9011c5310b27
files loader.oph mapcode.oph
diffstat 2 files changed, 65 insertions(+), 48 deletions(-) [+]
line diff
     1.1 --- a/loader.oph	Tue Oct 18 00:04:04 2011 +0200
     1.2 +++ b/loader.oph	Sun Nov 06 02:18:39 2011 +0100
     1.3 @@ -117,8 +117,8 @@
     1.4  code_block: .byte <code_file_name, >code_file_name
     1.5                 .byte $00, $1e, 0, 0
     1.6                 .byte $00, $1e, 0, 0
     1.7 -               .byte $40, $20, 0, 0
     1.8 -               .byte $40, $3e, 0, 0
     1.9 +               .byte $54, $20, 0, 0
    1.10 +               .byte $54, $3e, 0, 0
    1.11  
    1.12  init_load_window_vdu_bytes: .byte 28,0,30,19,27
    1.13  
     2.1 --- a/mapcode.oph	Tue Oct 18 00:04:04 2011 +0200
     2.2 +++ b/mapcode.oph	Sun Nov 06 02:18:39 2011 +0100
     2.3 @@ -1740,32 +1740,14 @@
     2.4      lda #128
     2.5      ldx #1
     2.6      jsr $fff4
     2.7 -    cpy #112                ; <= -16
     2.8 +    cpy #96                 ; <= -32
     2.9      bcs move_player_check_joystick_left
    2.10      jmp move_player_right
    2.11  
    2.12      move_player_check_joystick_left:
    2.13 -    cpy #144                ; >= 16
    2.14 -    bcc move_player_handle_joystick_up_down
    2.15 -    jmp move_player_left
    2.16 -
    2.17 -    move_player_handle_joystick_up_down:
    2.18 -
    2.19 -    lda #128
    2.20 -    ldx #2
    2.21 -    jsr $fff4
    2.22 -    cpy #112                ; <= -16
    2.23 -    bcs move_player_check_joystick_up
    2.24 -    jmp move_player_down
    2.25 -
    2.26 -    move_player_check_joystick_up:
    2.27 -    cpy #144
    2.28 -    bcc move_player_no_joystick_input
    2.29 -    jmp move_player_up      ; >= 16
    2.30 -
    2.31 -    move_player_no_joystick_input:
    2.32 -    clc
    2.33 -    rts
    2.34 +    cpy #160                ; >= 32
    2.35 +    bcs move_player_left
    2.36 +    jmp move_player_handle_joystick_up_down
    2.37  
    2.38      move_player_handle_left_key:
    2.39  
    2.40 @@ -1774,7 +1756,8 @@
    2.41      ldx #158            ; (Z)
    2.42      jsr check_key
    2.43      cpy #255
    2.44 -    bne move_player_not_left_key
    2.45 +    beq move_player_left
    2.46 +    jmp move_player_check_right_key
    2.47  
    2.48      move_player_left:
    2.49  
    2.50 @@ -1810,7 +1793,10 @@
    2.51  
    2.52      move_player_not_left_exit1:
    2.53      cmp #0
    2.54 -    bne move_player_not_left_key
    2.55 +    beq move_player_left_check_dy
    2.56 +    jmp move_player_not_horizontal
    2.57 +
    2.58 +    move_player_left_check_dy:
    2.59  
    2.60      lda $5283               ; dy
    2.61      cmp #0
    2.62 @@ -1828,7 +1814,8 @@
    2.63  
    2.64      move_player_not_left_exit2:
    2.65      cmp #0
    2.66 -    bne move_player_not_left_key
    2.67 +    beq move_player_allow_left
    2.68 +    jmp move_player_not_horizontal
    2.69  
    2.70      move_player_allow_left:
    2.71      tya
    2.72 @@ -1861,7 +1848,7 @@
    2.73      sec                     ; indicate to the calling routine that the player
    2.74      rts                     ; has left the room
    2.75  
    2.76 -    move_player_not_left_key:
    2.77 +    move_player_check_right_key:
    2.78  
    2.79      ; Handle the right key.
    2.80  
    2.81 @@ -1869,7 +1856,7 @@
    2.82      jsr check_key
    2.83      cpy #255
    2.84      beq move_player_right
    2.85 -    jmp move_player_not_right_key
    2.86 +    jmp move_player_not_horizontal
    2.87  
    2.88      move_player_right:
    2.89  
    2.90 @@ -1907,7 +1894,7 @@
    2.91  
    2.92      move_player_not_right_exit1:
    2.93      cmp #0
    2.94 -    bne move_player_not_right_key
    2.95 +    bne move_player_not_horizontal
    2.96  
    2.97      lda $5283                   ; dy
    2.98      cmp #0
    2.99 @@ -1925,7 +1912,7 @@
   2.100  
   2.101      move_player_not_right_exit2:
   2.102      cmp #0
   2.103 -    bne move_player_not_right_key
   2.104 +    bne move_player_not_horizontal
   2.105  
   2.106      move_player_allow_right:
   2.107  
   2.108 @@ -1961,14 +1948,48 @@
   2.109      sec                         ; indicate to the calling routine that the
   2.110      rts                         ; player has left the room
   2.111  
   2.112 -    move_player_not_right_key:
   2.113 +    move_player_not_horizontal:
   2.114 +
   2.115 +    ; Handle joystick
   2.116 +
   2.117 +    lda $577e
   2.118 +    cmp #0
   2.119 +    beq move_player_handle_up_key
   2.120 +
   2.121 +    move_player_handle_joystick_up_down:
   2.122 +
   2.123 +    lda #128
   2.124 +    ldx #2
   2.125 +    jsr $fff4
   2.126 +    cpy #96                 ; <= -32
   2.127 +    bcs move_player_check_joystick_up
   2.128 +    jmp move_player_down
   2.129 +
   2.130 +    move_player_check_joystick_up:
   2.131 +    cpy #160
   2.132 +    bcc move_player_no_joystick_input
   2.133 +    jmp move_player_up      ; >= 32
   2.134 +
   2.135 +    move_player_no_joystick_input:
   2.136 +    clc
   2.137 +    rts
   2.138 +
   2.139 +    move_player_handle_up_key:
   2.140  
   2.141      ; Handle the up key.
   2.142  
   2.143      ldx #183            ; (:)
   2.144      jsr check_key
   2.145      cpy #255
   2.146 -    bne move_player_not_up_key
   2.147 +    beq move_player_up
   2.148 +
   2.149 +    ; Handle the down key.
   2.150 +
   2.151 +    ldx #151            ; (/)
   2.152 +    jsr check_key
   2.153 +    cpy #255
   2.154 +    beq move_player_down
   2.155 +    jmp move_player_not_vertical
   2.156  
   2.157      move_player_up:
   2.158  
   2.159 @@ -2002,7 +2023,11 @@
   2.160  
   2.161      move_player_not_up_exit1:
   2.162      cmp #0
   2.163 -    bne move_player_not_up_key
   2.164 +    beq move_player_up_check_dx
   2.165 +    clc
   2.166 +    rts
   2.167 +
   2.168 +    move_player_up_check_dx:
   2.169  
   2.170      lda $5285                   ; dx
   2.171      cmp #3
   2.172 @@ -2018,7 +2043,9 @@
   2.173  
   2.174      move_player_not_up_exit2:
   2.175      cmp #0
   2.176 -    bne move_player_not_up_key
   2.177 +    beq move_player_allow_up
   2.178 +    clc
   2.179 +    rts
   2.180  
   2.181      move_player_allow_up:
   2.182      txa
   2.183 @@ -2051,16 +2078,6 @@
   2.184      sec                     ; indicate to the calling routine that the player
   2.185      rts                     ; has left the room
   2.186  
   2.187 -    move_player_not_up_key:
   2.188 -
   2.189 -    ; Handle the down key.
   2.190 -
   2.191 -    ldx #151            ; (/)
   2.192 -    jsr check_key
   2.193 -    cpy #255
   2.194 -    beq move_player_down
   2.195 -    jmp move_player_not_down_key
   2.196 -
   2.197      move_player_down:
   2.198  
   2.199      lda $5283                   ; read dy
   2.200 @@ -2096,7 +2113,7 @@
   2.201  
   2.202      move_player_not_down_exit1:
   2.203      cmp #0
   2.204 -    bne move_player_not_down_key
   2.205 +    bne move_player_not_vertical
   2.206  
   2.207      lda $5285                   ; dx
   2.208      cmp #3
   2.209 @@ -2112,7 +2129,7 @@
   2.210  
   2.211      move_player_not_down_exit2:
   2.212      cmp #0
   2.213 -    bne move_player_not_down_key
   2.214 +    bne move_player_not_vertical
   2.215  
   2.216      move_player_allow_down:
   2.217  
   2.218 @@ -2147,7 +2164,7 @@
   2.219      sec                         ; indicate to the calling routine that the
   2.220      rts                         ; player has left the room
   2.221  
   2.222 -    move_player_not_down_key:
   2.223 +    move_player_not_vertical:
   2.224      clc
   2.225      rts
   2.226