junglejourney
changeset 6:b2a919e2d664
Changed the algorithm used to determine which rooms have exits.
Updated the images to use flowers instead of water.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Sun Aug 07 19:27:01 2011 +0200 |
| parents | cbca25501227 |
| children | c6c8b87ee2fe |
| files | LOADER build.py makesprites.py mapcode.oph |
| diffstat | 4 files changed, 150 insertions(+), 195 deletions(-) [+] |
line diff
1.1 --- a/LOADER Sun Jul 24 02:04:15 2011 +0200 1.2 +++ b/LOADER Sun Aug 07 19:27:01 2011 +0200 1.3 @@ -6,18 +6,18 @@ 1.4 MODE 5 1.5 VDU 23,1,0;0;0;0; 1.6 VDU 19,2,2,0,0,0 1.7 -VDU 19,3,4,0,0,0 1.8 +VDU 19,3,3,0,0,0 1.9 1.10 -?&78=0 1.11 -?&79=0 1.12 +?&78=5 1.13 +?&79=5 1.14 1.15 REPEAT 1.16 -CALL &1B0D 1.17 +CALL &1B1F 1.18 1.19 A% = GET 1.20 -IF A%=90 ?&79=?&79-1 1.21 -IF A%=88 ?&79=?&79+1 1.22 -IF A%=58 ?&78=?&78-1 1.23 -IF A%=47 ?&78=?&78+1 1.24 +IF A%=90 AND ?&79>0 THEN ?&79=?&79-1 1.25 +IF A%=88 AND ?&79<10 THEN ?&79=?&79+1 1.26 +IF A%=58 AND ?&78>0 THEN ?&78=?&78-1 1.27 +IF A%=47 AND ?&78<10 THEN ?&78=?&78+1 1.28 1.29 UNTIL FALSE
2.1 --- a/build.py Sun Jul 24 02:04:15 2011 +0200 2.2 +++ b/build.py Sun Aug 07 19:27:01 2011 +0200 2.3 @@ -65,7 +65,7 @@ 2.4 t = read_basic("LOADER") 2.5 files.append(("LOADER", 0xffff0e00, 0xffff802b, t)) 2.6 2.7 - t = read_basic("TESTVALUES") 2.8 + t = read_basic("TESTEXITS") 2.9 files.append(("TEST", 0xffff0e00, 0xffff802b, t)) 2.10 2.11 u = UEFfile.UEFfile(creator = 'build.py '+version)
3.1 --- a/makesprites.py Sun Jul 24 02:04:15 2011 +0200 3.2 +++ b/makesprites.py Sun Aug 07 19:27:01 2011 +0200 3.3 @@ -19,6 +19,30 @@ 3.4 3.5 sprites = [ 3.6 ("0000000000000000",)*24, 3.7 + ("0000000000000000", 3.8 + "0202000200020020", 3.9 + "0000020000212000", 3.10 + "0020200010201020", 3.11 + "0020000020020020", 3.12 + "0000020122200000", 3.13 + "0200020020200200", 3.14 + "0202000000202200", 3.15 + "0200200200222000", 3.16 + "0000202000200000", 3.17 + "0200002020200200", 3.18 + "0001000020000200", 3.19 + "0011010000002000", 3.20 + "0001100020002020", 3.21 + "0010220222000020", 3.22 + "0000222220202020", 3.23 + "0200022022002000", 3.24 + "0200022000002020", 3.25 + "0002022200000000", 3.26 + "0022202200200200", 3.27 + "0020202202220020", 3.28 + "0002002222220200", 3.29 + "0200000220200020", 3.30 + "0000000220000000"), 3.31 ("0022200000000000", 3.32 "0222220000222200", 3.33 "2222220002222220", 3.34 @@ -43,50 +67,26 @@ 3.35 "2002000222020000", 3.36 "0002000222020000", 3.37 "0002200222200000"), 3.38 - ("0333000003330000", 3.39 - "3000300330003000", 3.40 - "0000033300000333", 3.41 - "0000000000000000", 3.42 - "0033300000333000", 3.43 - "0300330003000300", 3.44 - "3000003330000033", 3.45 - "0000000000000000", 3.46 - "0333000003330000", 3.47 - "3000300030003300", 3.48 - "0000033300000333", 3.49 - "0000000000000000", 3.50 - "3330000033300000", 3.51 - "0003003300030003", 3.52 - "0000333000003330", 3.53 - "0000000000000000", 3.54 - "0333000003330000", 3.55 - "3300300030003000", 3.56 - "0000033300000333", 3.57 - "0000000000000000", 3.58 - "0033300000333000", 3.59 - "0300030003300300", 3.60 - "3000003330000033", 3.61 - "0000000000000000"), 3.62 ("0022000200000000", 3.63 "0002202220002000", 3.64 "0002222200020000", 3.65 "0000220000220000", 3.66 "0000220000022000", 3.67 "0020222000002000", 3.68 - "0222022002002200", 3.69 - "2222022022200202", 3.70 - "0020022222220220", 3.71 + "0232022002002200", 3.72 + "2323022023200202", 3.73 + "0020022232320220", 3.74 "0000002202000200", 3.75 "0000002200002200", 3.76 "0002002200000220", 3.77 - "0022222202002200", 3.78 - "0222022022002000", 3.79 - "0000022002202200", 3.80 + "0023222202002200", 3.81 + "0232022023002000", 3.82 + "0000022002302200", 3.83 "0200022000022000", 3.84 - "2220022000220000", 3.85 - "0222222020022200", 3.86 - "0020222222202020", 3.87 - "0000220022020000", 3.88 + "2320022000220000", 3.89 + "0232222020022200", 3.90 + "0020222223202020", 3.91 + "0000220032020000", 3.92 "0000220000022000", 3.93 "0000220000202000", 3.94 "0000220000002000",
4.1 --- a/mapcode.oph Sun Jul 24 02:04:15 2011 +0200 4.2 +++ b/mapcode.oph Sun Aug 07 19:27:01 2011 +0200 4.3 @@ -27,13 +27,15 @@ 4.4 jsr unlimited_values 4.5 lda $7d 4.6 jsr div9 4.7 - and #3 4.8 + and #7 4.9 sta $7b 4.10 rts ; $7b = (next value % 9) & 3 4.11 4.12 +; Room filling routines, writing to 0x579c to 0x57ff. 4.13 + 4.14 draw_top_line: 4.15 ldx #9 4.16 - lda #1 4.17 + lda #6 4.18 draw_top_line_loop0: 4.19 sta $57f6,x 4.20 dex 4.21 @@ -51,7 +53,7 @@ 4.22 draw_left_line: 4.23 ldx #99 4.24 draw_left_line_loop0: 4.25 - lda #1 4.26 + lda #6 4.27 sta $579c,x 4.28 txa 4.29 sec 4.30 @@ -73,7 +75,7 @@ 4.31 4.32 draw_bottom_line: 4.33 ldx #9 4.34 - lda #1 4.35 + lda #6 4.36 draw_bottom_line_loop0: 4.37 sta $579c,x 4.38 dex 4.39 @@ -91,7 +93,7 @@ 4.40 draw_right_line: 4.41 ldx #90 4.42 draw_right_line_loop0: 4.43 - lda #1 4.44 + lda #6 4.45 sta $579c,x 4.46 txa 4.47 sec 4.48 @@ -111,156 +113,148 @@ 4.49 clc 4.50 rts 4.51 4.52 -top_left_exits: ; $70=test number 4.53 - lda $78 4.54 - adc $7f ; i + second 4.55 - sta $7c 4.56 - clc 4.57 - lda $79 4.58 - adc $7e 4.59 - sta $7d ; j + first 4.60 - clc 4.61 +make_room: ; $78,$79=i,j 4.62 4.63 - lda $70 4.64 - adc #4 ; 4 + test number 4.65 - clc 4.66 - tax 4.67 -top_left_loop: 4.68 - jsr unlimited_values 4.69 - dex 4.70 - bne top_left_loop 4.71 - 4.72 - rts 4.73 - 4.74 -make_room: ; $78,$79=i,j 4.75 - ; $7e,$7f=first,second 4.76 - 4.77 - ; Determine if there is a top exit. 4.78 +; Determine if there is a top exit. 4.79 lda #0 4.80 sta $76 4.81 4.82 - lda $78 4.83 + lda $78 ; i == 0 4.84 cmp #0 4.85 bne not_top_screen 4.86 - lda #1 4.87 + lda #6 4.88 sta $76 4.89 jmp do_top_exit 4.90 not_top_screen: 4.91 clc 4.92 4.93 - lda $7e 4.94 - sta $70 4.95 - jsr top_left_exits 4.96 + lda $78 4.97 + and #7 ; i & 7 4.98 + sta $70 ; temporary result 4.99 + lda $79 4.100 + and #7 ; j & 7 4.101 + cmp $70 4.102 + beq do_top_exit 4.103 + clc 4.104 4.105 - jsr div9 4.106 - sta $70 ; store the result temporarily 4.107 - 4.108 - lda $7e 4.109 - jsr div9 ; second % 9 4.110 - cmp $70 4.111 + lda $78 4.112 + eor $79 ; i ^ j 4.113 + adc $78 ; + i 4.114 + clc 4.115 + cmp $79 ; (i ^ j) + i == j 4.116 bne do_top_exit 4.117 - lda #1 4.118 + lda #6 4.119 sta $76 ; top exit 4.120 4.121 do_top_exit: 4.122 - clc 4.123 jsr draw_top_line 4.124 4.125 - ; Determine if there is a left exit. 4.126 +; Determine if there is a left exit. 4.127 lda #0 4.128 sta $77 4.129 4.130 lda $79 4.131 cmp #0 4.132 bne not_left_screen 4.133 - lda #1 4.134 + lda #6 4.135 sta $77 4.136 jmp do_left_exit 4.137 not_left_screen: 4.138 clc 4.139 4.140 - lda $7f 4.141 - sta $70 4.142 - jsr top_left_exits 4.143 + lda $78 4.144 + and #3 ; i & 3 4.145 + sta $70 ; temporary result 4.146 + lda $79 4.147 + and #3 ; j & 3 4.148 + cmp $70 4.149 + beq do_left_exit 4.150 + clc 4.151 4.152 - jsr div9 4.153 - sta $70 ; store the result temporarily 4.154 - 4.155 - lda $7f 4.156 - jsr div9 ; second % 9 4.157 - cmp $70 4.158 + lda $78 4.159 + ora $79 ; i | j 4.160 + eor $79 ; ^ j 4.161 + cmp $78 ; (i | j) ^ j == i 4.162 bne do_left_exit 4.163 - lda #1 4.164 + lda #6 4.165 sta $77 ; left exit 4.166 4.167 do_left_exit: 4.168 - clc 4.169 jsr draw_left_line 4.170 4.171 - ; Determine if there is a right exit. 4.172 +; Determine if there is a right exit. 4.173 lda #0 4.174 sta $77 4.175 4.176 lda $79 4.177 cmp #10 4.178 bne not_right_screen 4.179 - lda #1 4.180 + lda #6 4.181 sta $77 4.182 jmp do_right_exit 4.183 not_right_screen: 4.184 clc 4.185 4.186 - inc $79 4.187 - lda $7f 4.188 + lda $78 4.189 + and #3 ; i & 3 4.190 + sta $70 ; temporary result 4.191 + lda $79 4.192 + adc #1 4.193 + and #3 ; j & 3 4.194 + cmp $70 4.195 + beq do_right_exit 4.196 + clc 4.197 + 4.198 + lda $79 4.199 + adc #1 4.200 sta $70 4.201 - jsr top_left_exits 4.202 - dec $79 4.203 4.204 - jsr div9 4.205 - sta $70 ; store the result temporarily 4.206 - 4.207 - lda $7f 4.208 - jsr div9 ; second % 9 4.209 - cmp $70 4.210 + lda $78 4.211 + ora $70 ; i | j 4.212 + eor $70 ; ^ j 4.213 + cmp $78 ; (i | j) ^ j == i 4.214 bne do_right_exit 4.215 - lda #1 4.216 + lda #6 4.217 sta $77 ; right exit 4.218 4.219 do_right_exit: 4.220 - clc 4.221 jsr draw_right_line 4.222 4.223 - ; Determine if there is a bottom exit. 4.224 +; Determine if there is a bottom exit. 4.225 lda #0 4.226 sta $76 4.227 4.228 lda $78 4.229 cmp #10 4.230 bne not_bottom_screen 4.231 - lda #1 4.232 + lda #6 4.233 sta $76 4.234 jmp do_bottom_exit 4.235 not_bottom_screen: 4.236 clc 4.237 4.238 - inc $78 4.239 - lda $7e 4.240 + lda $78 4.241 + adc #1 4.242 + and #7 ; i & 7 4.243 + sta $70 ; temporary result 4.244 + lda $79 4.245 + and #7 ; j & 7 4.246 + cmp $70 4.247 + beq do_bottom_exit 4.248 + clc 4.249 + 4.250 + lda $78 4.251 + adc #1 4.252 sta $70 4.253 - jsr top_left_exits 4.254 - dec $78 4.255 4.256 - jsr div9 4.257 - sta $70 ; store the result temporarily 4.258 - 4.259 - lda $7e 4.260 - jsr div9 ; second % 9 4.261 - cmp $70 4.262 + eor $79 ; i ^ j 4.263 + adc $70 ; + i 4.264 + cmp $79 ; (i ^ j) + i == j 4.265 bne do_bottom_exit 4.266 - lda #1 4.267 + lda #6 4.268 sta $76 ; bottom exit 4.269 4.270 do_bottom_exit: 4.271 - clc 4.272 jsr draw_bottom_line 4.273 4.274 ; Fill in the room details. 4.275 @@ -357,35 +351,41 @@ 4.276 rts 4.277 4.278 4.279 -plot_tile: ; $74,$75=sprite area address 4.280 - ; $7b=tile number 4.281 +plot_tile: ; $7b=tile number 4.282 ; $72,$73=screen position 4.283 4.284 - ; Calculate the sprite address ($74,$75 + $7b*0x60). 4.285 - lda $74 4.286 + lda $7b 4.287 + cmp #1 4.288 + bne not_flowers 4.289 + lda #$60 4.290 sta $70 4.291 - lda $75 4.292 - sta $71 4.293 - lda $7b 4.294 - tax 4.295 - 4.296 - cpx #0 4.297 - beq after_multiply_loop 4.298 - 4.299 -multiply_loop: 4.300 - 4.301 - clc 4.302 - lda $70 4.303 - adc #$60 4.304 - sta $70 4.305 - lda $71 4.306 - adc #0 4.307 + lda #$56 4.308 sta $71 4.309 clc 4.310 - dex 4.311 - bne multiply_loop 4.312 - 4.313 -after_multiply_loop: 4.314 + jmp plot ; optimise away the rts 4.315 +not_flowers: 4.316 + cmp #6 4.317 + bne not_tree1 4.318 + lda #$c0 4.319 + sta $70 4.320 + lda #$56 4.321 + sta $71 4.322 + clc 4.323 + jmp plot ; optimise away the rts 4.324 +not_tree1: 4.325 + cmp #7 4.326 + bne not_tree2 4.327 + lda #$20 4.328 + sta $70 4.329 + lda #$57 4.330 + sta $71 4.331 + clc 4.332 + jmp plot ; optimise away the rts 4.333 +not_tree2: 4.334 + lda #$00 4.335 + sta $70 4.336 + lda #$56 4.337 + sta $71 4.338 clc 4.339 jsr plot 4.340 rts 4.341 @@ -396,15 +396,6 @@ 4.342 lda #$58 4.343 sta $73 ; $72,$73 = screen position 4.344 4.345 - lda #$00 4.346 - sta $74 4.347 - lda #$56 4.348 - sta $75 ; $74,$75 = sprite area address 4.349 - 4.350 - lda #0 4.351 - sta $7e ; first 4.352 - sta $7f ; second 4.353 - 4.354 jsr make_room 4.355 4.356 lda #99 4.357 @@ -448,39 +439,3 @@ 4.358 4.359 end_rows: 4.360 rts 4.361 - 4.362 - 4.363 -test_plot: 4.364 - lda #$60 4.365 - sta $70 4.366 - lda #$56 4.367 - sta $71 4.368 - lda #0 4.369 - sta $72 4.370 - lda #$58 4.371 - sta $73 4.372 - jsr plot 4.373 - rts 4.374 - 4.375 -test_plot_tile: 4.376 - lda #$00 4.377 - sta $74 4.378 - lda #$56 4.379 - sta $75 4.380 - lda #1 4.381 - sta $7d 4.382 - lda #0 4.383 - sta $72 4.384 - lda #$58 4.385 - sta $73 4.386 -test_plot_tile_loop: 4.387 - lda $7d 4.388 - sta $7b 4.389 - jsr plot_tile 4.390 - clc 4.391 - lda $7d 4.392 - adc #1 4.393 - sta $7d 4.394 - cmp #4 4.395 - bne test_plot_tile_loop 4.396 - rts
