I found 2 bugs in the rle generation.
First look at this
Code:
;2. egg
.db 272 ;length
.db 17 ;hieght
.db 16 ;width
.db 255 ;escape
.db 255,271,0,4,0 ;rle compressed map
First thing you should notice is that 271. On a DB, brass and tasm will generate errors, Spasm would would and it 255. When you do RLE you have to limit the maximum run to 255(well technically 256). so that shoould actually be 2 runs instead like this:
Code:
.db 255,255,0,255,16,0
The second bug I found in RLE generation was that the maps were 1 byte larger than intended.
The above map is only 272 bytes long, 271 of those are 0 the last should be 4. however there is an extra 0 after the 4, so thats just wasteful.
Last about the issue I was talking about earlier. Lets say i have this map collection:
Code:
;MapCollection - mapcollection
map:
.db 4
;1. map
.db 64
.db 8
.db 8
.db 255,4,3,0,6,255,4,0,1,1,9,255,3,1,10,1
.db 9,9,15,13,13,0,1,3,0,15,15,1,7,1,13,1
.db 1,14,5,5,16,13,0,2,1,255,3,5,255,4,3,1
.db 5,1,5,12,3,18,3,255,3,5,15,12,12,3,3,0
;2. egg
.db 272
.db 17
.db 16
.db 255,255,271,0,4,0
;3. sweet
.db 240
.db 20
.db 12
.db 255,255,3,0,255,5,3,255,7,0,3,255,4,0,3,3
.db 255,5,0,3,255,11,0,3,255,11,0,3,255,11,0,3
.db 255,11,0,3,3,255,11,0,255,5,3,255,11,0,3,255
.db 11,0,3,255,10,0,3,3,255,18,0,5,255,11,0,5
.db 255,11,0,5,255,11,0,5,255,11,0,5,255,11,0,5
.db 5,255,19,0,255,12,5,0
;4. guy
.db 4
.db 2
.db 2
.db 255,0,1,2,3,0
How would I address map 3? The only way I can think of is to fake decompress through all the maps untill I get to the map that I want. But that is extremely impractical.
What I was suggesting was a way to make labels and possibly luts.
Basically an output like this:
Code:
mapcollection:
.db 4
.dw map ;Look up table
.dw egg
.dw sweet
.dw guy
map:
.db 64
.db 8
.db 8
.db 255,4,3,0,6,255,4,0,1,1,9,255,3,1,10,1
.db 9,9,15,13,13,0,1,3,0,15,15,1,7,1,13,1
.db 1,14,5,5,16,13,0,2,1,255,3,5,255,4,3,1
.db 5,1,5,12,3,18,3,255,3,5,15,12,12,3,3,0
egg:
.db 272
.db 17
.db 16
.db 255,255,271,0,4,0
sweet:
.db 240
.db 20
.db 12
.db 255,255,3,0,255,5,3,255,7,0,3,255,4,0,3,3
.db 255,5,0,3,255,11,0,3,255,11,0,3,255,11,0,3
.db 255,11,0,3,3,255,11,0,255,5,3,255,11,0,3,255
.db 11,0,3,255,10,0,3,3,255,18,0,5,255,11,0,5
.db 255,11,0,5,255,11,0,5,255,11,0,5,255,11,0,5
.db 5,255,19,0,255,12,5,0
guy:
.db 4
.db 2
.db 2
.db 255,0,1,2,3,0