junglejourney

changeset 95:148d87837b0c

Updated the level seeds. Added start, exit and key room decorations. Adjusted enemy emerging behaviour. Modified the title page text slightly.
author David Boddie <david@boddie.org.uk>
date Thu Sep 01 23:09:25 2011 +0200
parents ca3ed4323f00
children d97dc77ff4c2
files mapcode.oph tools/makesprites.py
diffstat 2 files changed, 97 insertions(+), 42 deletions(-) [+]
line diff
     1.1 --- a/mapcode.oph	Thu Sep 01 23:07:26 2011 +0200
     1.2 +++ b/mapcode.oph	Thu Sep 01 23:09:25 2011 +0200
     1.3 @@ -16,11 +16,11 @@
     1.4  .org $1f00
     1.5  jmp main
     1.6  
     1.7 -seeds:         .byte 100, 239, 33   ; $ef, $b7, $90, $d6, $89
     1.8 -start_rooms_x: .byte 5,   3,  10
     1.9 -start_rooms_y: .byte 5,   8,  0
    1.10 -exit_rooms_x:  .byte 7,   9,  2
    1.11 -exit_rooms_y:  .byte 0,   0,  10
    1.12 +seeds:         .byte 100, 239, 183   ; $ef, $b7, $90, $d6, $89
    1.13 +start_rooms_x: .byte 5,   3,   5
    1.14 +start_rooms_y: .byte 5,   8,   1
    1.15 +exit_rooms_x:  .byte 7,   9,   3
    1.16 +exit_rooms_y:  .byte 0,   0,   9
    1.17  
    1.18  ; These values need to be kept in sync - the room numbers must match their
    1.19  ; positions in the room array.
    1.20 @@ -326,7 +326,9 @@
    1.21      cmp $79
    1.22      bne make_room_not_starting_room
    1.23  
    1.24 -    rts
    1.25 +    lda #3
    1.26 +    sta $70
    1.27 +    jmp add_room_decoration ; optimise away the rts
    1.28  
    1.29      make_room_not_starting_room:
    1.30  
    1.31 @@ -350,7 +352,9 @@
    1.32  
    1.33      lda #5
    1.34      sta $579c,x
    1.35 -    rts
    1.36 +    lda #3
    1.37 +    sta $70
    1.38 +    jmp add_room_decoration ; optimise away the rts
    1.39  
    1.40      exit_not_open:
    1.41      clc
    1.42 @@ -367,7 +371,9 @@
    1.43      cmp $79
    1.44      bne make_room_not_key_room
    1.45  
    1.46 -    rts
    1.47 +    lda #1
    1.48 +    sta $70
    1.49 +    jmp add_room_decoration ; optimise away the rts
    1.50  
    1.51      make_room_not_key_room:
    1.52      clc
    1.53 @@ -422,6 +428,28 @@
    1.54      make_room_loop1_exit:
    1.55      rts
    1.56  
    1.57 +decoration_offsets: .byte 11,18,81,88
    1.58 +
    1.59 +add_room_decoration:
    1.60 +
    1.61 +    lda #$9c
    1.62 +    sta $8e
    1.63 +    lda #$57
    1.64 +    sta $8f
    1.65 +    
    1.66 +    ldx #3
    1.67 +    add_room_decoration_loop:
    1.68 +
    1.69 +        lda decoration_offsets,x
    1.70 +        tay
    1.71 +        lda $70
    1.72 +        sta ($8e),y
    1.73 +        dex
    1.74 +        bpl add_room_decoration_loop
    1.75 +    
    1.76 +    clc
    1.77 +    rts
    1.78 +
    1.79  exit_room_offsets:  .byte 35,66,63,56,34,44,64,33,36,55,65,53,45,46,54,43
    1.80  treasure_x:         .byte 3, 2, 4, 8, 2, 5, 4, 1, 3, 8, 6, 5, 7, 1, 7, 6
    1.81  treasure_y:         .byte 1, 3, 7, 7, 2, 3, 6, 1, 4, 6, 8, 5, 5, 4, 8, 2
    1.82 @@ -2084,17 +2112,17 @@
    1.83      jsr unlimited_values
    1.84      lda $7d
    1.85      and #7
    1.86 +    cmp #4
    1.87 +    bmi emerge_type_ok
    1.88 +
    1.89 +    sec
    1.90 +    sbc #4
    1.91 +    clc
    1.92 +
    1.93 +    emerge_type_ok:
    1.94      cmp $3df1               ; only allow the appropriate enemies for this level
    1.95 -    bpl emerge_type_default
    1.96 -
    1.97 -    cmp #4
    1.98      bmi emerge_type_exit
    1.99  
   1.100 -    lda #$40
   1.101 -    clc
   1.102 -    rts
   1.103 -
   1.104 -    emerge_type_default:
   1.105      sec
   1.106      sbc $3df1
   1.107      clc
   1.108 @@ -2126,7 +2154,15 @@
   1.109  
   1.110      lda $7d
   1.111      and #7
   1.112 -    adc #2
   1.113 +    cmp #6
   1.114 +    bpl emerge_position_common_first_area_truncate
   1.115 +
   1.116 +    adc #4
   1.117 +    rts
   1.118 +
   1.119 +    emerge_position_common_first_area_truncate:
   1.120 +    clc
   1.121 +    lda #8
   1.122      rts
   1.123  
   1.124      emerge_position_common_not_first_area:
   1.125 @@ -2134,26 +2170,35 @@
   1.126      bpl emerge_position_common_third_area
   1.127  
   1.128      lda $7d
   1.129 -    and #1
   1.130 -    bne emerge_position_common_lower_second_area
   1.131 -
   1.132 -    lda $7d
   1.133 -    and #3
   1.134 -    rts
   1.135 -
   1.136 -    emerge_position_common_lower_second_area:
   1.137 +    cmp #5
   1.138 +    bmi emerge_position_common_lower_second_area
   1.139 +
   1.140      clc
   1.141 -
   1.142      lda $7d
   1.143      and #3
   1.144      adc #6
   1.145      rts
   1.146  
   1.147 +    emerge_position_common_lower_second_area:
   1.148 +    clc
   1.149 +
   1.150 +    lda $7d
   1.151 +    and #3
   1.152 +    rts
   1.153 +
   1.154      emerge_position_common_third_area:
   1.155      clc
   1.156  
   1.157      lda $7d
   1.158      and #7
   1.159 +    cmp #6
   1.160 +    bpl emerge_position_common_third_area_truncate
   1.161 +
   1.162 +    rts
   1.163 +
   1.164 +    emerge_position_common_third_area_truncate:
   1.165 +    clc
   1.166 +    lda #5
   1.167      rts
   1.168  
   1.169  emerge_character:           ; $74,$75=character address
   1.170 @@ -2161,21 +2206,31 @@
   1.171      lda #63
   1.172      sta $3dff
   1.173  
   1.174 -    jsr emerge_y_position     ; obtain a y position
   1.175 -    tax
   1.176 -    jsr emerge_x_position     ; obtain an x position
   1.177 -    sta $80                 ; temporary
   1.178 -    tay
   1.179 -
   1.180 -    lda room_row_offsets_low,x
   1.181 -    sta $70
   1.182 -    lda #$57
   1.183 -    sta $71
   1.184 -    lda ($70),y             ; load the tile
   1.185 -
   1.186 -    cmp #0
   1.187 +    lda #3      ; try three tiles to find a space
   1.188 +    sta $81
   1.189 +    emerge_character_loop:
   1.190 +
   1.191 +        jsr emerge_y_position     ; obtain a y position
   1.192 +        tax
   1.193 +        jsr emerge_x_position     ; obtain an x position
   1.194 +        sta $80                 ; temporary
   1.195 +        tay
   1.196 +
   1.197 +        lda room_row_offsets_low,x
   1.198 +        sta $70
   1.199 +        lda #$57
   1.200 +        sta $71
   1.201 +        lda ($70),y             ; load the tile
   1.202 +
   1.203 +        cmp #0
   1.204 +        beq emerge_character_space_found
   1.205 +
   1.206 +        dec $81
   1.207 +        bpl emerge_character_loop
   1.208 +
   1.209      bne emerge_character_exit
   1.210  
   1.211 +    emerge_character_space_found:
   1.212      ; There is a space in the room, so add an emerging enemy.
   1.213  
   1.214      ldy #0
   1.215 @@ -3987,7 +4042,7 @@
   1.216  
   1.217      rts
   1.218  
   1.219 -title_vdu_bytes: .byte 12, 31,0,27, 17,2, "Press SPACE to play"
   1.220 +title_vdu_bytes: .byte 12, 17,2, 31,4,27, "Press SPACE", 31,7,28, "to play"
   1.221  
   1.222  show_title:
   1.223  
   1.224 @@ -4008,7 +4063,7 @@
   1.225          lda title_vdu_bytes,x
   1.226          jsr $ffee
   1.227          inx
   1.228 -        cpx #25
   1.229 +        cpx #27
   1.230          bmi write_title_text_loop
   1.231  
   1.232      rts
     2.1 --- a/tools/makesprites.py	Thu Sep 01 23:07:26 2011 +0200
     2.2 +++ b/tools/makesprites.py	Thu Sep 01 23:09:25 2011 +0200
     2.3 @@ -47,7 +47,7 @@
     2.4           read_xpm("images/leaf2.xpm"),
     2.5           read_xpm("images/flowers2.xpm", [(".", "0"), ("#", "1"), ("+", "2"), ("@", "3")]),
     2.6           read_xpm("images/leaf6.xpm", [(".", "0"), ("+", "2")]),
     2.7 -         read_xpm("images/leaf4.xpm", [(".", "0"), ("+", "1"), ("#", "2"), ("@", "3")]),
     2.8 +         read_xpm("images/leaf4.xpm", [(".", "0"), ("#", "1"), ("+", "2"), ("@", "3")]),
     2.9           read_xpm("images/bricks.xpm", [(".", "0"), ("#", "1"), ("+", "2"), ("@", "3")]),
    2.10           read_xpm("images/wall1.xpm"),
    2.11           read_xpm("images/wall2.xpm")]