; --------------------------------------------------------
; Tile Studio Definition file for use with Blitz Basic
; (http://www.blitzbasic.com/)
;
; Because Blitz Basic has no import/include statement, the
; output must be pasted into the source file manually.
;
; Version 1.0 - September 25, 2000
; Mike Wiering (mike.wiering@cs.kun.nl)
; --------------------------------------------------------

; --- bitmap file ----------------------------------------

#tileset
#tilebitmap graphics\\<TileSetIdentifier>.bmp 320
#end tilebitmap
#end tileset

; --------------------------------------------------------

#file <ProjectName>_include.bb
#; ---------- Generated by Tile Studio ----------

#tileset
#map
Const LAYER_<TileSetIdentifier>_<MapIdentifier> = (<TileSetNumber> Shl 8) + <MapNumber>
#end map
#end tileset

#; get map width (tiles)
Function MapWidth (map)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      Return <MapWidth>
#end map
#end tileset
  End Select
End Function

#; get map height (tiles)
Function MapHeight (map)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      Return <MapHeight>
#end map
#end tileset
  End Select
End Function

#; get tile width (pixels)
Function TileWidth (map)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      Return <TileWidth>
#end map
#end tileset
  End Select
End Function

#; get tile height (pixels)
Function TileHeight (map)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      Return <TileHeight>
#end map
#end tileset
  End Select
End Function


#tileset
Global <TileSetIdentifier>Bitmap = LoadAnimImage ("graphics\\<TileSetIdentifier>.bmp", <TileWidth>, <TileHeight>, 0, <TileCount>)
MaskImage <TileSetIdentifier>Bitmap, <TransparentColorR>, <TransparentColorG>, <TransparentColorB>

#map
Dim <TileSetIdentifier><MapIdentifier>Map (<MapHeight>, <MapWidth>)
Restore <TileSetIdentifier><MapIdentifier>MapData
For y = 0 To <MapHeight> - 1
  For x = 0 To <MapWidth> - 1
    Read <TileSetIdentifier><MapIdentifier>Map (y, x)
  Next
Next

.<TileSetIdentifier><MapIdentifier>MapData
#mapdata  "\nData "  ","  "\nData "  "\nData "  ""
<TileNumber:"%3d">
#end mapdata

Dim <TileSetIdentifier><MapIdentifier>BoundMap (<MapHeight>, <MapWidth>)
Restore <TileSetIdentifier><MapIdentifier>BoundMapData
For y = 0 To <MapHeight> - 1
  For x = 0 To <MapWidth> - 1
    Read <TileSetIdentifier><MapIdentifier>BoundMap (y, x)
  Next
Next

#; tile size: w = <TileWidth>, h = <TileHeight>
.<TileSetIdentifier><MapIdentifier>BoundMapData
#mapdata  "\nData "  ","  "\nData "  "\nData "  ""
 <BoundMapValue>
#end mapdata

#end map


#sequence
<TileSetIdentifier>Seq<SequenceNumber>$ = Chr$(<SequenceNumber>) + 
#sequencedata  ""   " + "  ""
Chr$(<TileNumber>)+Chr$(<FrameCount>)
#end sequencedata
#end sequence

Dim <TileSetIdentifier>Sequences$ (<SequenceCount> + 1)
#sequence "\n"
<TileSetIdentifier>Sequences$ (<SequenceNumber>) = <TileSetIdentifier>Seq<SequenceNumber>$
#end sequence

#map
#; <TileSetIdentifier><MapIdentifier>Layer
#; movement (x, y) = (x = <ScrollX>, y = <ScrollY>) 
#end map

#end tileset


#; get tile number at position (x,y)
Function GetTile (map, x, y)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      Return <TileSetIdentifier><MapIdentifier>Map (y, x) - 1
#end map
#end tileset
  End Select
End Function

#; get bounds/map code at position (x,y)
Function GetBounds (map, x, y)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      Return <TileSetIdentifier><MapIdentifier>BoundMap (y, x)
#end map
#end tileset
  End Select
End Function

Function DrawTile (map, x, y, tile)
  Select map
#tileset
#map
    Case LAYER_<TileSetIdentifier>_<MapIdentifier>
      DrawImage <TileSetIdentifier>Bitmap, x, y, tile
#end map
#end tileset
  End Select
End Function

#; ---------- end of generated file ----------
#end file

; --------------------------------------------------------
