06-20-2005, 02:02 AM
Code:
SUB mapLoad (file$)
'Read MapW, MapH
'REDIM Map(1 to MapW, 1 to MapH)
'REDIM MapOverlay(1 to MapW, 1 to MapH)
vid.xMin = 0
vid.yMin = 0
for r = 1 to MapH
for c = 1 to MapW
' Read Map(r, c)
next
next
end sub
1st off, i duno if you can read data from a sub. so if not youre dimming arrays "FROM 1 TO 0" could be ugly. =P
Code:
SUB mapDraw ()
' r1 = INT(vid.yMin / TileH) + 1
' r2 = y1 + (vid.yRes / tileH)
' c1 = INT(vid.xMin / TileW) + 1
' c2 = x1 + (vid.xRes / TileW)
'x = (c1 - 1) * TileW - vid.xMin
'y = (r1 - 1) * TileH - vid.yMin
for r = r1 to r2
for c = c1 to c2
' bmpGetTile (TerrainBitmap(), 1, 1, TerrainTile(), 32, 32)
' PUT (x,y), TerrainTile(0)
x = x + 32
next
y = y + 32
next
end sub
i did a little debugging and found somehing interesting. the first line of mapdraw becomes this
r1 = Int(0 / 32) + 1
that crashes on compilation, however
r1 = Int(0 / 32)' + 1
does not... :o :o :o :o
its frustrating. i Highly recommend posting the entire code. its like maybe 2 pages worth, some people have posted over 1k lines. i would but i dunno if i should without your permission