junglejourney

changeset 87:f45f5ce4ccb3

Changed the seed values for two levels. Updated the item generation algorithm to try and reduce the number of weapons created, and to vary the position of items in rooms.
author David Boddie <david@boddie.org.uk>
date Wed Aug 31 01:12:15 2011 +0200
parents b8c0aa3a50a0
children 24652251c79e
files TODO.txt build.py mapcode.oph
diffstat 3 files changed, 59 insertions(+), 54 deletions(-) [+]
line diff
     1.1 --- a/TODO.txt	Wed Aug 31 01:11:33 2011 +0200
     1.2 +++ b/TODO.txt	Wed Aug 31 01:12:15 2011 +0200
     1.3 @@ -1,10 +1,7 @@
     1.4  To Do
     1.5  
     1.6 -Add support for score.
     1.7  Ensure that the tile sets for each level look good and that the exit sprites
     1.8  used are always the same.
     1.9 -Add more treasure and weapon sprites.
    1.10 -Adjust the distribution of items to make weapons less common.
    1.11  Add decoration to start, key and exit rooms.
    1.12  Show an open exit if the player has a key.
    1.13  Add a screen to show between levels.
     2.1 --- a/build.py	Wed Aug 31 01:11:33 2011 +0200
     2.2 +++ b/build.py	Wed Aug 31 01:12:15 2011 +0200
     2.3 @@ -102,8 +102,6 @@
     2.4      # 4680 space
     2.5      # 5100 objects/treasure table (121 entries)
     2.6      #   n   type
     2.7 -    #   n+1 i map offset
     2.8 -    #   n+2 j map offset
     2.9      #
    2.10      # 51F2 space
    2.11      # 5200 plot buffer (alternate unplot/plot entries terminating in 255)
     3.1 --- a/mapcode.oph	Wed Aug 31 01:11:33 2011 +0200
     3.2 +++ b/mapcode.oph	Wed Aug 31 01:12:15 2011 +0200
     3.3 @@ -16,17 +16,20 @@
     3.4  .org $1900
     3.5  jmp main
     3.6  
     3.7 -seeds:         .byte 100, 26, 33
     3.8 -start_rooms_x: .byte 5,   0,  10
     3.9 -start_rooms_y: .byte 5,   9,  0
    3.10 -exit_rooms_x:  .byte 7,   10, 2
    3.11 -exit_rooms_y:  .byte 0,   4,  10
    3.12 +seeds:         .byte 100, 239, 33   ; $ef, $b7, $90, $d6, $89
    3.13 +start_rooms_x: .byte 5,   3,  10
    3.14 +start_rooms_y: .byte 5,   8,  0
    3.15 +exit_rooms_x:  .byte 7,   9,  2
    3.16 +exit_rooms_y:  .byte 0,   0,  10
    3.17  
    3.18  ; These values need to be kept in sync - the room numbers must match their
    3.19  ; positions in the room array.
    3.20 -key_rooms_x:   .byte 1,   9,  10
    3.21 -key_rooms_y:   .byte 0,   0,  6
    3.22 -key_rooms:     .byte 1, 9, 76
    3.23 +key_rooms_x:   .byte 1,   5,  10
    3.24 +key_rooms_y:   .byte 0,   2,   6
    3.25 +key_rooms:     .byte 1,  27,  76    ; ky*11 + kx
    3.26 +
    3.27 +treasure_table:  .byte 6, 5, 7, 1, 1, 5, 2, 7, 6, 2, 1, 7, 1, 7, 8, 7
    3.28 +treasure_table_: .byte 0, 7, 6, 7, 7, 7, 5, 0, 6, 3, 7, 7, 5, 7, 5, 0
    3.29  
    3.30  unlimited_values:   ; $7c,$7d=first,second
    3.31                      ; Add $7c and $7d, store the result in $7d and the original
    3.32 @@ -425,6 +428,9 @@
    3.33      tax
    3.34  
    3.35      lda $5100,x
    3.36 +    ora #$80
    3.37 +    sta $5100,x         ; set the top bit (room visited)
    3.38 +    and #$7f            ; mask off the top bit to obtain the item number + 1
    3.39      cmp #0
    3.40      beq add_treasure_exit
    3.41  
    3.42 @@ -435,6 +441,7 @@
    3.43  
    3.44      lda $78
    3.45      eor $79
    3.46 +    adc $330d
    3.47      and #15
    3.48      sta $70
    3.49  
    3.50 @@ -4114,23 +4121,32 @@
    3.51      lda key_rooms,x
    3.52      sta $80
    3.53      
    3.54 -    lda $33fa   ; level
    3.55 -    adc #11
    3.56 +    ldx $33fa   ; level
    3.57 +    lda seeds,x
    3.58 +    adc #1
    3.59      and #31
    3.60      sta $7c
    3.61      clc
    3.62 -    lda #10
    3.63 +    lda seeds,x
    3.64 +    adc #2
    3.65 +    and #31
    3.66      sta $7d
    3.67 +    clc
    3.68  
    3.69      lda $33fa   ; create an upper limit on the weapon type found in this level
    3.70      adc #2
    3.71      sta $8d
    3.72      clc
    3.73  
    3.74 -    ldx #121
    3.75 +    lda #$00
    3.76 +    sta $8e
    3.77 +    lda #$51
    3.78 +    sta $8f
    3.79 +
    3.80 +    ldy #0
    3.81      start_level_add_treasure_loop:
    3.82  
    3.83 -        cpx $80                         ; check for the key room
    3.84 +        cpy $80                         ; check for the key room
    3.85          bne start_level_add_treasure_item
    3.86  
    3.87          lda #5                          ; the value to store is type + 1
    3.88 @@ -4140,41 +4156,34 @@
    3.89          clc
    3.90          jsr unlimited_values
    3.91          and #$0f
    3.92 -        cmp #15
    3.93 +        cmp #0
    3.94 +        beq start_level_add_treasure_none
    3.95 +
    3.96 +        clc
    3.97 +        sta $8c
    3.98 +        tya
    3.99 +        adc $8c
   3.100 +        and #31
   3.101 +        clc
   3.102 +        tax
   3.103 +        lda treasure_table,x
   3.104 +
   3.105 +        cmp #4
   3.106 +        bmi start_level_add_treasure_weapon
   3.107 +
   3.108 +        clc
   3.109 +        adc #1
   3.110 +        jmp start_level_add_treasure_store
   3.111 +
   3.112 +        start_level_add_treasure_weapon:
   3.113 +
   3.114 +        ; Only add weapons with types that equal the level number or exceed it
   3.115 +        ; by one.
   3.116 +        cmp $8d                     
   3.117          bcs start_level_add_treasure_none
   3.118  
   3.119 -        cmp #9                          ; only allow values 0-8
   3.120 -        bcc start_level_add_treasure_ok
   3.121 -
   3.122 -        sec
   3.123 -        sbc #4
   3.124          clc
   3.125 -
   3.126 -        cmp #9
   3.127 -        bcc start_level_add_treasure_ok
   3.128 -
   3.129 -        sec
   3.130 -        sbc #4
   3.131 -        clc
   3.132 -
   3.133 -        start_level_add_treasure_ok:
   3.134 -        cmp #5                          ; check for values 5-8
   3.135 -        bcs start_level_add_treasure
   3.136 -
   3.137 -        cmp #4                  ; do not allow keys to be added as normal items
   3.138 -        beq start_level_add_treasure_none
   3.139 -
   3.140 -        cmp $8d                     ; only add weapons with types that equal the
   3.141 -        bcs start_level_add_treasure_none ; level number or exceed it by one
   3.142 -
   3.143 -        clc
   3.144 -        adc #1                  ; store values 0-8 as values 1-9
   3.145 -        jmp start_level_add_treasure_store
   3.146 -
   3.147 -        start_level_add_treasure:
   3.148 -        clc
   3.149 -
   3.150 -        adc #1                  ; store values 0-8 as values 1-9
   3.151 +        adc #1                              ; store values 0-8 as values 1-9
   3.152          jmp start_level_add_treasure_store
   3.153  
   3.154          start_level_add_treasure_none:
   3.155 @@ -4183,10 +4192,11 @@
   3.156  
   3.157          start_level_add_treasure_store:
   3.158          clc
   3.159 -        sta $5100,x             ; add the item to the table
   3.160 -
   3.161 -        dex
   3.162 -        bpl start_level_add_treasure_loop
   3.163 +        sta ($8e),y             ; add the item to the table
   3.164 +
   3.165 +        iny
   3.166 +        cpy #121
   3.167 +        bmi start_level_add_treasure_loop
   3.168  
   3.169      clc
   3.170      rts