hay all.
In my program im trying to construct a map into a memblock.
Its for a mini map, so i can update changes to it in real time without it slowing down like the drawing commands do.
anyway i can get the map to load and draw it fine(slow way),but when
i try and do it within a memblock, it gets all squewiff.
Heres the code to load it both ways.
`**********************************************************
` load in a map file
`**********************************************************
open to read 1,"land.hmp"
read long 1,xsize
read long 1,ysize
for waste=1 to 98 : read long 1,wasted : next waste : ` needed for the program i use for heightmaps
dim hight(xsize,ysize)
dim color(xsize,ysize)
for z=1 to ysize
for x=1 to xsize
read byte 1,num
if num<30 then hight(x,z)=0 : color(x,z)=rgb(0,0,200) : `water
if num>41 and num<80 then hight(x,z)=30 : color(x,z)=rgb(182,171,95) : ` sand
if num>79 and num<100 then hight(x,z)=60 : color(x,z)=rgb(0,55,28) : ` grass
if num>99 and num<120 then hight(x,z)=120 : color(x,z)=rgb(0,75,48) : ` grass
if num>119 and num<140 then hight(x,z)=160 : color(x,z)=rgb(0,95,68) : ` grass
if num>139 and num<160 then hight(x,z)=220 : color(x,z)=rgb(0,135,108) : ` grass
if num>159 and num<200 then hight(x,z)=240 : color(x,z)=rgb(162,162,162)
if num>199 and num<230 then hight(x,z)=300 : color(x,z)=rgb(180,180,180)
if num>229 and num<250 then hight(x,z)=390 : color(x,z)=rgb(210,210,210)
if num>249 then hight(x,z)=450 : color(x,z)=rgb(255,255,255)
next x
next y
close file 1
`*****************************************************************************************
` create a memblock from a bitmap the size of the map+1
` then make the map and make the image again to resize
`*****************************************************************************************
create bitmap 100,xsize+1,ysize+1
make memblock from bitmap 100,100
set current bitmap 100
for x=1 to xsize
for z=1 to ysize
pos=(x+(z*ysize))*4
write memblock dword 100,12+(pos),color(x,z)
next z
next x
make image from memblock 100,100
`get image 100,0,0,xsize,ysize
sprite 100,0,0,100
size sprite 100,150,150
paste sprite 100,0,0
get image 100,0,0,150,150
delete sprite 100
delete bitmap 100
delete memblock 100
set current bitmap 0
paste image 100,800,0
text 0,0,"fps= "+str$(screen fps())
text 0,10,"Now press a key to see how it sposed to look"
sync
wait key
for x=1 to xsize
for z=1 to xsize
ink color(x,z),0
dot 100+x,100+z
next z
next x
sync
wait key
Also need attached map file to use.
Again, anyhelp would be majorly appreciated.
cheers
crighton
aye!