I'm trying figuire out something that I just can't seem to wrap my head around. First off, ***** I'm not planning on remaking Ultima 4 ***** but it was a good example of the data I will be working with.
The way the data is set up is that there is a world data file that outlines where all the tiles are in the world and each hex value translates to a tile image. The main world is made up of 65536 tiles (64 sections (8x8) comprised of 1024 tiles (32x32).
World
|00|01|02|03|04|05|06|07|
|08|09|10|11|12|13|14|15|
|16|17|18|19|20|21|22|23|
|24|25|26|27|28|29|30|31|
|32|33|34|35|36|37|38|39|
|40|41|42|43|44|45|46|47|
|48|49|50|51|52|53|54|55|
|56|57|58|59|60|61|62|64|
Sections 00 & 01
|00|01|02|...|31|32|||1024|1025|...
|33|34|...
That would be all fine and good if all the values worked straight across, but within each section it reads 32 across and then drops down to the next line (32 rows, 32 columns, 1024 bytes) then moves up to the top of the next zone.
OK, now that you have the big picture. HOW would you go about making the tiles display as you move in that direction. Just like if you were playing an RPG and were traveling the countryside. Because when you hit those lines where two sections line up your data would be 1024 bytes off. Attached is the code and data files.
I may be making this harder than it should be, but just can't seem to decipher it right now. I thought I was doing pretty good to figuire out how to convert the data over...
Thanks!
Hoose
`Initialize Display
set display mode 800,600,16
hide mouse
`User Input
set cursor 10,550
input "Enter Tile To Display to Screen (0-63) or X to end: ",tile
cls
`Initialize varibles
WorldData=0
CurrentByte= tile * 1024
`Main Program
`for c=1 to 64
screenX=0
screenY=0
for s= 1 to 32
for t= 1 to 32
WorldData=read byte from file("WORLD.MAP",CurrentByte)
load image "image"+str$(WorldData)+".bmp",1
paste image 1,screenX,screenY
screenX=screenX+16
inc CurrentByte,1
next t
screenY=screenY+16
screenX=screenX-512
next s
`next c
get image 2,0,0,512,512
save image "tile"+str$(tile)+".bmp",2
set cursor 10,550
print "Press any key to exit"
wait key
end
[/b][b][/b][b][u][/u]