junglejourney

changeset 164:e0bda78f458f

Fixed a feature that allowed enemies to "hide" in tiles containing treasure, preventing them from being destroyed by the mace. Now, all treasure items apart from keys can be destroyed, and the mace cannot pass through keys.
author David Boddie <david@boddie.org.uk>
date Sun Sep 18 17:00:06 2011 +0200
parents a5121cf016ad
children b8837b3d2e11
files TODO.txt mapcode.oph
diffstat 2 files changed, 33 insertions(+), 12 deletions(-) [+]
line diff
     1.1 --- a/TODO.txt	Sun Sep 18 02:23:15 2011 +0200
     1.2 +++ b/TODO.txt	Sun Sep 18 17:00:06 2011 +0200
     1.3 @@ -1,6 +1,5 @@
     1.4  To Do
     1.5  
     1.6 -Fix end animation.
     1.7  Add last two enemy sprite sets.
     1.8  Nice to have: analogue joystick support.
     1.9  Nice to have: make one of the enemies have different movement.
     2.1 --- a/mapcode.oph	Sun Sep 18 02:23:15 2011 +0200
     2.2 +++ b/mapcode.oph	Sun Sep 18 17:00:06 2011 +0200
     2.3 @@ -3405,8 +3405,24 @@
     2.4      adc #2
     2.5      sta $70
     2.6      jsr add_score
     2.7 -
     2.8 -    ; Unplot the enemy and replace it with an explosion.
     2.9 +    jmp move_projectile_create_explosion
    2.10 +
    2.11 +    move_projectile_no_enemy_collision:
    2.12 +
    2.13 +    cmp #4          ; items can be destroyed as well
    2.14 +    bne move_projectile_no_item_collision
    2.15 +
    2.16 +    ldy #1          ; but not keys
    2.17 +    lda ($74),y
    2.18 +    cmp #4          ; even the mace is stopped by a key
    2.19 +    beq move_projectile_remove_projectile
    2.20 +    clc
    2.21 +
    2.22 +    jsr remove_room_item
    2.23 +
    2.24 +    move_projectile_create_explosion:
    2.25 +
    2.26 +    ; Unplot the item/enemy and replace it with an explosion.
    2.27  
    2.28      jsr unplot_character
    2.29  
    2.30 @@ -3424,7 +3440,7 @@
    2.31      ldx #0
    2.32      jsr play_sound
    2.33  
    2.34 -    move_projectile_no_enemy_collision:
    2.35 +    move_projectile_no_item_collision:
    2.36  
    2.37      lda $5287       ; type 2 projectiles pass through everything
    2.38      and #$06
    2.39 @@ -3458,7 +3474,7 @@
    2.40  
    2.41      move_projectile_remove_projectile:
    2.42  
    2.43 -    lda #0                      ; remove the projectile from the character list
    2.44 +    lda #0              ; remove the projectile from the character list
    2.45      sta $5286
    2.46  
    2.47      move_projectile_exit:
    2.48 @@ -3562,12 +3578,7 @@
    2.49      jsr unplot_character
    2.50  
    2.51      ; Remove it from the item table.
    2.52 -    ldx $5782
    2.53 -    lda eleven_times_table,x
    2.54 -    adc $5783
    2.55 -    tax
    2.56 -    lda #$80    ; store a value with the top bit set instead of zero because we
    2.57 -    sta $5200,x ; have visited this room if we can collect the object within it
    2.58 +    jsr remove_room_item
    2.59  
    2.60      lda #0      ; remove the item from the character list
    2.61      ldy #0
    2.62 @@ -3663,6 +3674,17 @@
    2.63      clc
    2.64      rts
    2.65  
    2.66 +remove_room_item:
    2.67 +
    2.68 +    ldx $5782                       ; current room row number
    2.69 +    lda eleven_times_table,x
    2.70 +    adc $5783                       ; current room column number
    2.71 +    tax
    2.72 +    lda #$80    ; store a value with the top bit set instead of zero because we
    2.73 +    sta $5200,x ; have visited this room if we can collect the object within it
    2.74 +    clc
    2.75 +    rts
    2.76 +
    2.77  item_scores:     .byte $1,$4,$9,$16, $50,$20,$5,$10,$40
    2.78  score_vdu_bytes: .byte 1,1,31   ; reversed
    2.79  score_digits:    .byte "0123456789"
    2.80 @@ -3990,7 +4012,7 @@
    2.81      lda projectile_collision_mask_right,x
    2.82      sta $89
    2.83  
    2.84 -    jmp collide ; optimise away the rts
    2.85 +    ; Run on into the next routine.
    2.86  
    2.87  collide:
    2.88