junglejourney

changeset 180:30d7ba9d8236

Destroy all enemies and unplot the player when leaving a level.
author David Boddie <david@boddie.org.uk>
date Sun Sep 25 01:56:10 2011 +0200
parents 6e9a9d9afc04
children b3bbcce99ca1
files loader.oph mapcode.oph
diffstat 2 files changed, 37 insertions(+), 18 deletions(-) [+]
line diff
     1.1 --- a/loader.oph	Sat Sep 24 20:55:10 2011 +0200
     1.2 +++ b/loader.oph	Sun Sep 25 01:56:10 2011 +0200
     1.3 @@ -99,8 +99,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 $d1, $1f, 0, 0
     1.8 -               .byte $d1, $3d, 0, 0
     1.9 +               .byte $3d, $20, 0, 0
    1.10 +               .byte $3d, $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	Sat Sep 24 20:55:10 2011 +0200
     2.2 +++ b/mapcode.oph	Sun Sep 25 01:56:10 2011 +0200
     2.3 @@ -2177,8 +2177,13 @@
     2.4  
     2.5      try_to_exit_level_exit:
     2.6      sta $5780
     2.7 -    sec                         ; indicate that the player is leaving the room
     2.8 -    rts
     2.9 +
    2.10 +    lda #$80
    2.11 +    sta $74
    2.12 +    lda #$52
    2.13 +    sta $75
    2.14 +    jsr unplot_character    ; remove the player sprite
    2.15 +    jmp destroy_enemies     ; optimise away the rts
    2.16  
    2.17  check_fire_key:
    2.18  
    2.19 @@ -3920,16 +3925,25 @@
    2.20      sta $5281
    2.21  
    2.22      jsr plot_character
    2.23 +    jmp destroy_enemies ; optimise away the rts
    2.24 +
    2.25 +    reduce_strength_exit:
    2.26 +    clc
    2.27 +    rts
    2.28 +
    2.29 +destroy_enemies:
    2.30  
    2.31      lda #$8c
    2.32      sta $74
    2.33 -
    2.34 -    reduce_strength_destroy_enemies_loop:
    2.35 +    lda #$52
    2.36 +    sta $75
    2.37 +
    2.38 +    destroy_enemies_loop:
    2.39  
    2.40          ldy #0
    2.41          lda ($74),y
    2.42          cmp #8
    2.43 -        bmi reduce_strength_not_enemy
    2.44 +        bmi destroy_enemies_not_enemy
    2.45  
    2.46          jsr unplot_character
    2.47  
    2.48 @@ -3942,11 +3956,11 @@
    2.49          sta ($74),y
    2.50  
    2.51          jsr plot_character
    2.52 -        jmp reduce_strength_not_emerging_enemy
    2.53 -
    2.54 -        reduce_strength_not_enemy:
    2.55 +        jmp destroy_enemies_not_emerging_enemy
    2.56 +
    2.57 +        destroy_enemies_not_enemy:
    2.58          cmp #3
    2.59 -        bne reduce_strength_not_emerging_enemy
    2.60 +        bne destroy_enemies_not_emerging_enemy
    2.61  
    2.62          jsr unplot_character
    2.63  
    2.64 @@ -3957,15 +3971,14 @@
    2.65  
    2.66          jsr plot_character
    2.67  
    2.68 -        reduce_strength_not_emerging_enemy:
    2.69 +        destroy_enemies_not_emerging_enemy:
    2.70          clc
    2.71          lda $74
    2.72          adc #6
    2.73          sta $74
    2.74          cmp #$a4
    2.75 -        bmi reduce_strength_destroy_enemies_loop
    2.76 -
    2.77 -    reduce_strength_exit:
    2.78 +        bmi destroy_enemies_loop
    2.79 +
    2.80      clc
    2.81      rts
    2.82  
    2.83 @@ -5545,8 +5558,8 @@
    2.84                      jsr move_characters
    2.85                      jsr move_projectile
    2.86  
    2.87 -                    lda $5780   ; is player out of strength?
    2.88 -                    and #$40
    2.89 +                    lda $5780   ; is player out of strength ($40), leaving the
    2.90 +                    and #$c2    ; level (0x80) or completing the game (0x02)?
    2.91                      beq room_loop_player_move
    2.92                      clc
    2.93  
    2.94 @@ -5556,7 +5569,7 @@
    2.95  
    2.96                      room_loop_delay_next:
    2.97  
    2.98 -                    lda $5281           ; leave the loop when the player
    2.99 +                    lda $5281           ; leave the loop when the player demise
   2.100                      cmp #11             ; animation has finished
   2.101                      beq room_loop_after_player_move
   2.102                      clc
   2.103 @@ -5565,6 +5578,12 @@
   2.104                      and #7
   2.105                      bne room_loop_after_player_move
   2.106  
   2.107 +                    lda $5780   ; skip the animation if leaving the level or
   2.108 +                    and #$82    ; completing the game
   2.109 +                    bne room_loop_after_player_move
   2.110 +
   2.111 +                    ; Show the demise animation when appropriate.
   2.112 +
   2.113                      lda #$80
   2.114                      sta $74
   2.115                      lda #$52