castleraider

changeset 291:789d97ee40d7

Restricted the step sounds to only play when the character drops down. Simplified the step sound. Added pause (P) and unpause (O) checks. Extended the number of envelopes used to support more sound effects.
author David Boddie <david@boddie.org.uk>
date Sun Mar 30 22:41:22 2014 +0200
parents 3d47f40dec57
children 256c97f5d8fe
files code.oph loader.oph plotting.oph sound.oph
diffstat 4 files changed, 45 insertions(+), 29 deletions(-) [+]
line diff
     1.1 --- a/code.oph	Sun Mar 30 19:57:12 2014 +0200
     1.2 +++ b/code.oph	Sun Mar 30 22:41:22 2014 +0200
     1.3 @@ -142,6 +142,13 @@
     1.4          lda player_lost
     1.5          beq main_loop_check_jump
     1.6  
     1.7 +            lda #25                     ; Wait for half a second.
     1.8 +            sta $80
     1.9 +            main_loop_lost_loop:
    1.10 +                jsr vsync
    1.11 +                dec $80
    1.12 +                bpl main_loop_lost_loop
    1.13 +
    1.14              lda player_lives
    1.15              beq main_loop_endloop
    1.16  
    1.17 @@ -194,6 +201,17 @@
    1.18          main_loop_continue:
    1.19          clc
    1.20  
    1.21 +        ldx #200            ; (P)
    1.22 +        jsr check_key
    1.23 +        bne main_loop_check_escape
    1.24 +
    1.25 +        main_loop_pause_loop:
    1.26 +        
    1.27 +            ldx #201        ; (O)
    1.28 +            jsr check_key
    1.29 +            bne main_loop_pause_loop
    1.30 +
    1.31 +        main_loop_check_escape:
    1.32          ldx #143            ; (Escape)
    1.33          jsr check_key
    1.34          bne main_loop
    1.35 @@ -383,8 +401,8 @@
    1.36      lda player_falling          ; If the character is not falling then exit.
    1.37      beq check_beneath_fall_exit
    1.38  
    1.39 -    lda player_y                ; Play the step sound.
    1.40 -    jsr play_step_sound
    1.41 +    ldx #3                      ; Play the step sound.
    1.42 +    jsr play_sound
    1.43  
    1.44      lda #0                      ; Reset the falling flag.
    1.45  
    1.46 @@ -597,6 +615,9 @@
    1.47      lda ($82),y
    1.48      bne check_tile_visible_exit ; if visible (i.e. not collected) then exit
    1.49  
    1.50 +    ldx #4                      ; door sound
    1.51 +    jsr play_sound
    1.52 +
    1.53      ldy $8c                     ; restore the special tile number (00Dtnnnn)
    1.54      jmp make_tile_invisible     ; make all tiles of that type invisible and exit
    1.55  
    1.56 @@ -735,10 +756,8 @@
    1.57  
    1.58      jsr plot_player         ; Move the player up by one tile.
    1.59      dec player_y            ; We should really check to make sure that there
    1.60 -    jsr plot_player         ; is space above the player to do this.
    1.61 -
    1.62 -    lda player_y            ; Play the step sound.
    1.63 -    jmp play_step_sound     ; Branch and return.
    1.64 +    jmp plot_player         ; is space above the player to do this.
    1.65 +                            ; Branch and return.
    1.66  
    1.67      check_move_exit_not_ok:
    1.68      sec
    1.69 @@ -887,6 +906,11 @@
    1.70      jsr change_palette              ; Change the palette using the value stored
    1.71                                      ; in $70.
    1.72  
    1.73 +    ldx #5
    1.74 +    jsr play_sound                  ; Play the portal sound.
    1.75 +
    1.76 +                                    ; Fall through to the following routine.
    1.77 +
    1.78  jump_to_tracking_offset:
    1.79  
    1.80      lda scroll_offset_high
    1.81 @@ -1005,8 +1029,6 @@
    1.82      lda player_lost         ; Don't allow the routine to be entered if it has
    1.83      bne player_demise_exit  ; just been called.
    1.84  
    1.85 -    jsr plot_char       ; Unplot the character.
    1.86 -
    1.87      lda #1
    1.88      sta player_lost
    1.89      tax                 ; X=1
     2.1 --- a/loader.oph	Sun Mar 30 19:57:12 2014 +0200
     2.2 +++ b/loader.oph	Sun Mar 30 22:41:22 2014 +0200
     2.3 @@ -137,7 +137,7 @@
     2.4  
     2.5          inc $70
     2.6          lda $70
     2.7 -        cmp #4
     2.8 +        cmp #5
     2.9          bne define_envelopes_loop
    2.10  
    2.11      ; Configure the interrupt routine.
    2.12 @@ -461,11 +461,15 @@
    2.13  message_text_end:
    2.14  
    2.15  envelopes_low:  .byte <demise_envelope, <item_envelope, <jump_envelope
    2.16 +                .byte <door_envelope, <portal_envelope
    2.17  envelopes_high: .byte >demise_envelope, >item_envelope, >jump_envelope
    2.18 +                .byte >door_envelope, >portal_envelope
    2.19  
    2.20  demise_envelope:    .byte 1,2,252,250,0,15,15,0,126,0,0,130,126,126
    2.21  item_envelope:      .byte 2,2,10,254,2,6,2,2,126,0,0,130,126,126
    2.22  jump_envelope:      .byte 3,1,20,10,5,2,4,4,126,0,0,130,126,126
    2.23 +door_envelope:      .byte 4,1,1,25,1,10,1,9,126,0,0,130,126,126
    2.24 +portal_envelope:    .byte 5,1,4,0,252,1,1,1,126,0,0,130,126,126
    2.25  
    2.26  init_load_window_vdu_bytes: .byte 28,0,30,19,26,12
    2.27  
     3.1 --- a/plotting.oph	Sun Mar 30 19:57:12 2014 +0200
     3.2 +++ b/plotting.oph	Sun Mar 30 22:41:22 2014 +0200
     3.3 @@ -1108,8 +1108,8 @@
     3.4  
     3.5  plot_char_bank:
     3.6  
     3.7 -    lda player_lost
     3.8 -    beq plot_char_bank_plot
     3.9 +    lda player_lost             ; Don't plot the character if the player has
    3.10 +    beq plot_char_bank_plot     ; just lost a life.
    3.11      rts
    3.12  
    3.13      plot_char_bank_plot:
     4.1 --- a/sound.oph	Sun Mar 30 19:57:12 2014 +0200
     4.2 +++ b/sound.oph	Sun Mar 30 22:41:22 2014 +0200
     4.3 @@ -14,26 +14,16 @@
     4.4  ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
     4.5  
     4.6  sounds_low:  .byte <demise_sound, <item_sound, <jump_sound, <step_sound
     4.7 +             .byte <door_sound, <portal_sound
     4.8  sounds_high: .byte >demise_sound, >item_sound, >jump_sound, >step_sound
     4.9 +             .byte >door_sound, >portal_sound
    4.10  
    4.11 -demise_sound:   .byte 1,0, 1,0, 160,0, 6,0
    4.12 -item_sound:     .byte $13,0, 2,0, 160,0, 4,0
    4.13 -jump_sound:     .byte $13,0, 3,0, 50,0, 2,0
    4.14 -step_sound:     .byte $01,0, 241,0
    4.15 -  step_pitch:   .byte               0,0
    4.16 -  step_duration:.byte                   1,0
    4.17 -
    4.18 -play_step_sound:    ; A=row number
    4.19 -
    4.20 -    asl
    4.21 -    sta $80
    4.22 -    lda #40
    4.23 -    sec
    4.24 -    sbc $80
    4.25 -    sta step_pitch
    4.26 -    clc
    4.27 -
    4.28 -    ldx #3          ; Drop through into the next routine.
    4.29 +demise_sound:   .byte 1,0, 1,0, 160,0, 6,0      ; 6 * 50ms
    4.30 +item_sound:     .byte $13,0, 2,0, 160,0, 4,0    ; 4 * 50ms
    4.31 +jump_sound:     .byte $13,0, 3,0, 50,0, 2,0     ; 2 * 50ms
    4.32 +step_sound:     .byte $01,0, 241,0, 0,0, 1,0    ; 50ms
    4.33 +door_sound:     .byte $11,0, 4,0, 0,0, 4,0      ; 200ms
    4.34 +portal_sound:   .byte $11,0, 5,0, 10,0, 2,0     ; 100ms
    4.35  
    4.36  play_sound:     ; X=sound number
    4.37