Author Topic: fastest way to draw a 2-color 8x8 tile (with variable colors)?  (Read 10671 times)

0 Members and 1 Guest are viewing this topic.

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #15 on: February 23, 2022, 11:11:06 pm »
...
The main change with my code and yours, is that I removed the software rendering completely when I was running the hardware images.
...

The one problem I'm trying to solve, is how to get the color swap version (Sub DrawColorTileHW, Sub DoColorSwapHW) working with hardware images. With that, only one tileset would need to be defined, for any number of foreground/background color combinations. Is that possible, or are we limited by the number of hardware images we can work with at one time?

Code: QB64: [Select]
  1. ' BOOLEAN VALUES
  2. Const FALSE = 0
  3. Const TRUE = Not FALSE
  4.  
  5. ' START THE MAIN ROUTINE
  6. DrawingSpeedTest4
  7. 'HardwareImageDemo2
  8.  
  9. ' FINISH
  10. System ' return control to the operating system
  11.  
  12. ' ################################################################################################################################################################
  13. ' BEGIN DRAWING SPEED TEST
  14. ' ################################################################################################################################################################
  15.  
  16. ' /////////////////////////////////////////////////////////////////////////////
  17.  
  18. Sub DrawingSpeedTest4
  19.     Dim sError As String: sError = ""
  20.     Dim imgScreen As Long ' the main display
  21.     Dim imgHardwareScreen As Long ' copy of the software screen, transformed into a hardware image
  22.     Dim imgTiles As Long ' original tileset, black on transparent
  23.     Dim imgHardwareTiles As Long ' copy of the tileset, tranformed into a hardware image
  24.     Dim imgTilesRed As Long ' colored tileset copy
  25.     Dim imgTilesGreen As Long ' colored tileset copy
  26.     Dim imgTilesBlue As Long ' colored tileset copy
  27.     Dim imgTilesYellow As Long ' colored tileset copy
  28.     Dim imgColorTiles As Long ' holds 4 copies of tileset in different colors (red, green, blue, yellow)
  29.     Dim iTileNum As Integer
  30.     Dim iColorIndex As Integer: iColorIndex = 0
  31.     Dim iFirstColor As Integer: iFirstColor = 0
  32.     Dim iLastColor As Integer: iLastColor = 3
  33.     Dim iCols As Integer
  34.     Dim iRows As Integer
  35.     Dim iY As Integer
  36.     Dim iX As Integer
  37.     Dim fgColor As _Unsigned Long
  38.     Dim bgColor As _Unsigned Long
  39.     Dim iMinY As Integer
  40.     Dim iMaxY As Integer
  41.     Dim iMinX As Integer
  42.     Dim iMaxX As Integer
  43.     Dim iCount1 As Long
  44.     Dim iCount2 As Long
  45.     Dim iCount3 As Long
  46.     Dim iCount4 As Long
  47.     Dim t# ' for timer
  48.  
  49.     ' ================================================================================================================================================================
  50.     ' INIT SCREEN
  51.     ' ================================================================================================================================================================
  52.     imgScreen = _NewImage(1024, 768, 32)
  53.     _ScreenMove 0, 0
  54.     Screen imgScreen
  55.     Cls , cGray
  56.     Color cWhite, cBlack: Locate 1, 1: Print "Press 1 to test DrawTile8 rooutine using 4 tilesets (1 per color) and regular _putimage using using SOFTWARE images...": Do: Loop Until InKey$ = "1"
  57.  
  58.     ' ================================================================================================================================================================
  59.     ' INITIALIZE NEUTRAL COLOR GRAPHICS TILES (BLACK ON TRANSPARENT)
  60.     ' ================================================================================================================================================================
  61.     If Len(sError) = 0 Then
  62.         '' LOAD TILES (16 cols x 16 rows of 8x8 tiles) FROM FILE
  63.         'sFile$ = Left$(Command$(0), _InStrRev(Command$(0), "\")) + "Font_8x8_128x128_v3.png" ' 128x128 pixels, 16 rows x 16 columns of 8x8 tiles
  64.         'imgTiles = _LoadImage(sFile$, 32)
  65.  
  66.         ' LOAD TILES FROM TEXT DEFINITIONS IN Sub GetTileText
  67.         sError = GetTiles$(imgTiles, cBlack, cEmpty)
  68.     End If
  69.  
  70.     ' ================================================================================================================================================================
  71.     ' CREATE COLORED TILESET COPIES
  72.     ' ================================================================================================================================================================
  73.     If Len(sError) = 0 Then
  74.         MakeColoredTileset imgTiles, imgTilesRed, cRed, cBlack
  75.         MakeColoredTileset imgTiles, imgTilesGreen, cLime, cBlack
  76.         MakeColoredTileset imgTiles, imgTilesBlue, cBlue, cBlack
  77.         MakeColoredTileset imgTiles, imgTilesYellow, cYellow, cBlack
  78.  
  79.         ' Make one big tileset with all colors
  80.         imgColorTiles = _NewImage(512, 128, 32)
  81.         _PutImage (0, 0), imgTilesRed, imgColorTiles, (0, 0)-(128, 128)
  82.         _PutImage (128, 0), imgTilesGreen, imgColorTiles, (0, 0)-(128, 128)
  83.         _PutImage (256, 0), imgTilesBlue, imgColorTiles, (0, 0)-(128, 128)
  84.         _PutImage (384, 0), imgTilesYellow, imgColorTiles, (0, 0)-(128, 128)
  85.     End If
  86.  
  87.     ' ================================================================================================================================================================
  88.     ' METHOD #1
  89.     ' _PUTIMAGE with SOFTWARE IMAGES
  90.     ' ================================================================================================================================================================
  91.     If Len(sError) = 0 Then
  92.         iCols = _Width(imgScreen) \ 8
  93.         iRows = _Height(imgScreen) \ 8
  94.         iMinX = 1: iMaxX = 16
  95.         iMinY = 3: iMaxY = 18
  96.         iCount1 = 0
  97.         t# = ExtendedTimer + 3
  98.         Do
  99.             iCount1 = iCount1 + 1
  100.             iFirstColor = iFirstColor Xor 1
  101.             iColorIndex = iFirstColor
  102.             iY = iMinY
  103.             iX = iMinX
  104.             For iTileNum = 0 To 255
  105.                 Select Case iColorIndex
  106.                     Case 0:
  107.                         DrawTile8 imgTilesRed, iTileNum, imgScreen, iX, iY
  108.                     Case 1:
  109.                         DrawTile8 imgTilesGreen, iTileNum, imgScreen, iX, iY
  110.                     Case 2:
  111.                         DrawTile8 imgTilesBlue, iTileNum, imgScreen, iX, iY
  112.                     Case Else:
  113.                         DrawTile8 imgTilesYellow, iTileNum, imgScreen, iX, iY
  114.                 End Select
  115.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  116.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  117.             Next iTileNum
  118.             _Display
  119.         Loop Until Timer > t#
  120.     End If
  121.     Color cWhite, cBlack: Locate 11, 1: Print "Press 2 to test DrawColorTile routine using 1 tileset with DoColorSwap using SOFTWARE images...";: Do: Loop Until InKey$ = "2"
  122.  
  123.     ' ================================================================================================================================================================
  124.     ' METHOD #2
  125.     ' COLOR SWAP with SOFTWARE IMAGES
  126.     ' ================================================================================================================================================================
  127.     If Len(sError) = 0 Then
  128.         iMinX = 1: iMaxX = 16
  129.         iMinY = 23: iMaxY = 38
  130.         iCount2 = 0
  131.         t# = ExtendedTimer + 3
  132.         Do
  133.             iCount2 = iCount2 + 1
  134.             iFirstColor = iFirstColor Xor 1
  135.             iColorIndex = iFirstColor
  136.             iY = iMinY
  137.             iX = iMinX
  138.             For iTileNum = 0 To 255
  139.                 Select Case iColorIndex
  140.                     Case 0:
  141.                         fgColor = cRed: bgColor = cBlack
  142.                     Case 1:
  143.                         fgColor = cLime: bgColor = cBlack
  144.                     Case 2:
  145.                         fgColor = cBlue: bgColor = cBlack
  146.                     Case Else:
  147.                         fgColor = cYellow: bgColor = cBlack
  148.                 End Select
  149.                 DrawColorTile imgScreen, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  150.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  151.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  152.             Next iTileNum
  153.             _Display
  154.         Loop Until Timer > t#
  155.     End If
  156.     Color cWhite, cBlack: Locate 21, 1: Print "Press 3 to test DrawTileHw8 rooutine using 1 big multi-tileset and HARDWARE images...";: Do: Loop Until InKey$ = "3"
  157.  
  158.     ' ================================================================================================================================================================
  159.     ' METHOD #3
  160.     ' _PUTIMAGE with HARDWARE IMAGES
  161.     ' ================================================================================================================================================================
  162.     If Len(sError) = 0 Then
  163.         imgHardwareTiles = _CopyImage(imgColorTiles, 33) ' Copy tilesheet for hardware image
  164.         iMinX = 1: iMaxX = 16
  165.         iMinY = 43: iMaxY = 58
  166.         iCount3 = 0
  167.         t# = ExtendedTimer + 3
  168.         imgHardwareScreen = _CopyImage(0, 33)
  169.         Do
  170.             iCount3 = iCount3 + 1
  171.             iFirstColor = iFirstColor Xor 1
  172.             iColorIndex = iFirstColor
  173.             iY = iMinY
  174.             iX = iMinX
  175.             _PutImage , imgHardwareScreen
  176.             For iTileNum = 0 To 255
  177.                 DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iX, iY, iColorIndex
  178.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  179.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  180.             Next iTileNum
  181.             _Display
  182.         Loop Until Timer > t#
  183.         _AutoDisplay
  184.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  185.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  186.         Color cWhite, cBlack: Locate 31, 1: Print "Press 4 to test DrawColorTileHW rooutine using 1 tileset with DoColorSwapHW using HARDWARE images...";: Do: Loop Until InKey$ = "3"
  187.     End If
  188.  
  189.     ' ================================================================================================================================================================
  190.     ' METHOD #4
  191.     ' COLOR SWAP with HARDWARE IMAGES
  192.     ' ================================================================================================================================================================
  193.     If Len(sError) = 0 Then
  194.         imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  195.         iMinX = 1: iMaxX = 16
  196.         iMinY = 63: iMaxY = 78
  197.         iCount4 = 0
  198.         t# = ExtendedTimer + 3
  199.         imgHardwareScreen = _CopyImage(0, 33)
  200.         Do
  201.             iCount4 = iCount4 + 1
  202.             iFirstColor = iFirstColor Xor 1
  203.             iColorIndex = iFirstColor
  204.             iY = iMinY
  205.             iX = iMinX
  206.             _PutImage , imgHardwareScreen
  207.             For iTileNum = 0 To 255
  208.                 Select Case iColorIndex
  209.                     Case 0:
  210.                         fgColor = cRed: bgColor = cBlack
  211.                     Case 1:
  212.                         fgColor = cLime: bgColor = cBlack
  213.                     Case 2:
  214.                         fgColor = cBlue: bgColor = cBlack
  215.                     Case Else:
  216.                         fgColor = cYellow: bgColor = cBlack
  217.                 End Select
  218.                 DrawColorTileHW imgHardwareScreen, imgHardwareTiles, iTileNum, fgColor, bgColor, iX, iY
  219.  
  220.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  221.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  222.             Next iTileNum
  223.             _Display
  224.         Loop Until Timer > t#
  225.         _AutoDisplay
  226.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  227.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  228.         Color cWhite, cBlack: Locate 41, 1: Print "PRESS 5 TO SEE RESULTS...";: Do: Loop Until InKey$ = "5"
  229.     End If
  230.  
  231.     ' ================================================================================================================================================================
  232.     ' SHOW RESULTS
  233.     ' ================================================================================================================================================================
  234.     Color cWhite, cBlack: Locate 33, 1
  235.     Print ""
  236.     Print "RESULTS:"
  237.     Print Using "DrawTile8       ###,###,###,###,###,### refreshes in 3 seconds."; iCount1
  238.     Print Using "DrawColorTile   ###,###,###,###,###,### refreshes in 3 seconds."; iCount2
  239.     Print Using "DrawTileHw8     ###,###,###,###,###,### refreshes in 3 seconds."; iCount3
  240.     Print Using "DrawColorTileHW ###,###,###,###,###,### refreshes in 3 seconds."; iCount4
  241.     Print "PRESS ANY KEY TO CONTINUE"
  242.     Sleep
  243.  
  244.     ' ================================================================================================================================================================
  245.     ' CLEANUP AND EXIT
  246.     ' ================================================================================================================================================================
  247.     Screen 0 ' RETURN TO TEXT SCREEN
  248.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  249.     If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  250.     If imgTiles < -1 Or imgTiles > 0 Then _FreeImage imgTiles ' FREE MEMORY
  251.     If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  252.     If imgTilesRed < -1 Or imgTilesRed > 0 Then _FreeImage imgTilesRed ' FREE MEMORY
  253.     If imgTilesGreen < -1 Or imgTilesGreen > 0 Then _FreeImage imgTilesGreen ' FREE MEMORY
  254.     If imgTilesBlue < -1 Or imgTilesBlue > 0 Then _FreeImage imgTilesBlue ' FREE MEMORY
  255.     If imgTilesYellow < -1 Or imgTilesYellow > 0 Then _FreeImage imgTilesYellow ' FREE MEMORY
  256.     If imgColorTiles < -1 Or imgColorTiles > 0 Then _FreeImage imgColorTiles ' FREE MEMORY
  257. End Sub ' DrawingSpeedTest4
  258.  
  259. ' ################################################################################################################################################################
  260. ' END DRAWING SPEED TEST
  261. ' ################################################################################################################################################################
  262.  
  263. ' ################################################################################################################################################################
  264. ' BEGIN DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  265. ' ################################################################################################################################################################
  266.  
  267. ' /////////////////////////////////////////////////////////////////////////////
  268. ' Same as DrawColorTile but using hardware images.
  269.  
  270. ' Receives:
  271. ' imgTiles& = handle to 16x16 tile sheet of 16x16 pixel tiles colored black (256 tiles)
  272. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  273. ' TileColor~& = color to use for tile
  274. ' imgScreen& = handle to screen to draw tile on
  275. ' dx% = column # to draw tile at (where each column is 16 pixels wide)
  276. ' dy% = row # to draw tile at (where each row is 16 pixels high)
  277. ' xOffset% = offset tile this many columns over
  278. ' yOffset% = offset tile this many rows down
  279.  
  280. Sub DrawColorTileHW (imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%)
  281.     Dim cols%
  282.     Dim rows%
  283.     Dim sc%
  284.     Dim sr%
  285.     Dim sx1%
  286.     Dim sy1%
  287.     Dim sx2%
  288.     Dim sy2%
  289.     Dim xDest%
  290.     Dim yDest%
  291.     Dim ColorSprite&
  292.     Dim UniversalSprite&
  293.  
  294.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  295.     cols% = 16
  296.     rows% = 16
  297.  
  298.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  299.     sc% = TileNum% Mod rows%
  300.     sr% = TileNum% \ rows%
  301.  
  302.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  303.     sx1% = sc% * 8
  304.  
  305.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  306.     sy1% = sr% * 8
  307.  
  308.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  309.     sx2% = sx1% + 7
  310.  
  311.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  312.     sy2% = sy1% + 7
  313.  
  314.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  315.     xDest% = dx% * 8
  316.  
  317.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  318.     yDest% = dy% * 8
  319.  
  320.     ' IS THERE A BACKGROUND COLOR?
  321.     If BackColor~& <> cEmpty Then
  322.         ColorSprite& = _NewImage(8, 8, 32)
  323.         _Dest ColorSprite&
  324.         Cls , BackColor~&
  325.  
  326.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  327.         _Source ColorSprite&
  328.         _Dest imgScreen&
  329.         _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  330.     End If
  331.  
  332.     ' CREATE A TEMPORARY TILE TO COLOR
  333.     UniversalSprite& = _NewImage(8, 8, 32)
  334.  
  335.     ' COPY THE TILE TO THE TEMPORARY ONE
  336.     _Source imgTiles&
  337.     _Dest UniversalSprite&
  338.     _PutImage (0, 0), imgTiles&, UniversalSprite&, (sx1%, sy1%)-(sx2%, sy2%)
  339.  
  340.     ' COLOR IN THE TEMPORARY TILE
  341.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  342.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  343.     DoColorSwap UniversalSprite&, cBlack, TileColor~&, ColorSprite&
  344.  
  345.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  346.     _Source ColorSprite&
  347.     _Dest imgScreen&
  348.     _PutImage (xDest%, yDest%), ColorSprite&, , (0, 0)-(7, 7)
  349.  
  350.     ' ADDED PER FellipeHeitor
  351.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  352.     If UniversalSprite& < -1 Or UniversalSprite& > 0 Then _FreeImage UniversalSprite&
  353.  
  354. End Sub ' DrawColorTileHW
  355.  
  356. ' /////////////////////////////////////////////////////////////////////////////
  357. ' Same as DoColorSwap but using hardware images.
  358.  
  359. ' Latest version with NOVARSEG's changes.
  360. ' Based on code from:
  361. ' Image color swap?
  362. ' https://www.qb64.org/forum/index.php?topic=2312.0
  363.  
  364. ' Like Function swapcolor& except returns new image in a parameter
  365. ' in case being a function causes a memory leak?
  366.  
  367. Sub DoColorSwapHW (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  368.     Dim m As _MEM
  369.     Dim a As _Offset
  370.     a = 0
  371.     imgNew& = _CopyImage(imgOriginal&, 32)
  372.     m = _MemImage(imgNew&)
  373.     Do Until a = m.SIZE - 4
  374.         a = a + 4
  375.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  376.         If c = oldcolor~& Then
  377.             _MemPut m, m.OFFSET + a, newcolor~&
  378.         End If
  379.     Loop
  380.     _MemFree m
  381. End Sub ' DoColorSwapHW
  382.  
  383. ' ################################################################################################################################################################
  384. ' END DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  385. ' ################################################################################################################################################################
  386.  
  387. ' ################################################################################################################################################################
  388. ' BEGIN DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  389. ' ################################################################################################################################################################
  390.  
  391. ' /////////////////////////////////////////////////////////////////////////////
  392. ' Simple version which calculates coordinates on tile sheet and destination
  393. ' screen every time. For a faster version uses precalculated coordinates,
  394. ' see DrawColorTileFast. This version does not support offsetX, offsetY.
  395.  
  396. ' Receives:
  397. ' imgScreen& = handle to screen to draw tile on
  398. ' imgTiles& = handle to 16x16 tile sheet of 8x8 pixel tiles colored black (256 tiles)
  399. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  400. ' TileColor~& = foreground color to use for tile
  401. ' BackColor~& = background color to use for tile
  402. ' dx% = column # to draw tile at (where each column is 8 pixels wide)
  403. ' dy% = row # to draw tile at (where each row is 8 pixels high)
  404.  
  405. ' Usage:
  406. ' DrawColorTile imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%
  407.  
  408. Sub DrawColorTile (imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%)
  409.     Dim cols%
  410.     Dim rows%
  411.     Dim sc%
  412.     Dim sr%
  413.     Dim sx1%
  414.     Dim sy1%
  415.     Dim sx2%
  416.     Dim sy2%
  417.     Dim xDest%
  418.     Dim yDest%
  419.     Dim ColorSprite&
  420.     Dim UniversalSprite&
  421.  
  422.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  423.     cols% = 16
  424.     rows% = 16
  425.  
  426.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  427.     sc% = TileNum% Mod rows%
  428.     sr% = TileNum% \ rows%
  429.  
  430.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  431.     sx1% = sc% * 8
  432.  
  433.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  434.     sy1% = sr% * 8
  435.  
  436.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  437.     sx2% = sx1% + 7
  438.  
  439.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  440.     sy2% = sy1% + 7
  441.  
  442.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  443.     xDest% = dx% * 8
  444.  
  445.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  446.     yDest% = dy% * 8
  447.  
  448.     ' IS THERE A BACKGROUND COLOR?
  449.     If BackColor~& <> cEmpty Then
  450.         ColorSprite& = _NewImage(8, 8, 32)
  451.         _Dest ColorSprite&
  452.         Cls , BackColor~&
  453.  
  454.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  455.         _Source ColorSprite&
  456.         _Dest imgScreen&
  457.         _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  458.     End If
  459.  
  460.     ' CREATE A TEMPORARY TILE TO COLOR
  461.     UniversalSprite& = _NewImage(8, 8, 32)
  462.  
  463.     ' COPY THE TILE TO THE TEMPORARY ONE
  464.     _Source imgTiles&
  465.     _Dest UniversalSprite&
  466.     _PutImage (0, 0), imgTiles&, UniversalSprite&, (sx1%, sy1%)-(sx2%, sy2%)
  467.  
  468.     ' COLOR IN THE TEMPORARY TILE
  469.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  470.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  471.     DoColorSwap UniversalSprite&, cBlack, TileColor~&, ColorSprite&
  472.  
  473.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  474.     _Source ColorSprite&
  475.     _Dest imgScreen&
  476.     _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  477.  
  478.     ' ADDED PER FellipeHeitor
  479.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  480.     If UniversalSprite& < -1 Or UniversalSprite& > 0 Then _FreeImage UniversalSprite&
  481. End Sub ' DrawColorTile
  482.  
  483. ' /////////////////////////////////////////////////////////////////////////////
  484. ' Latest version with NOVARSEG's changes.
  485.  
  486. ' Based on code from:
  487.  
  488. ' Image color swap?
  489. ' https://www.qb64.org/forum/index.php?topic=2312.0
  490.  
  491. ' Like Function swapcolor& except returns new image in a parameter
  492. ' in case being a function causes a memory leak?
  493.  
  494. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  495.     Dim m As _MEM
  496.     Dim a As _Offset
  497.     a = 0
  498.     imgNew& = _CopyImage(imgOriginal&, 32)
  499.     m = _MemImage(imgNew&)
  500.     Do Until a = m.SIZE - 4
  501.         a = a + 4
  502.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  503.         If c = oldcolor~& Then
  504.             _MemPut m, m.OFFSET + a, newcolor~&
  505.         End If
  506.     Loop
  507.     _MemFree m
  508. End Sub ' DoColorSwap&
  509.  
  510. ' ################################################################################################################################################################
  511. ' END DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  512. ' ################################################################################################################################################################
  513.  
  514. ' ################################################################################################################################################################
  515. ' BEGIN DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  516. ' ################################################################################################################################################################
  517.  
  518. ' /////////////////////////////////////////////////////////////////////////////
  519. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  520.  
  521. ' Original version which calculates coordinates on tile sheet and destination
  522. ' screen every time. For a faster version uses precalculated coordinates,
  523. ' see DrawTileFast.
  524.  
  525. ' tw% = tile width/height (in pixels)
  526.  
  527. ' DIV and MOD:
  528. ' c% = a% \ b% ' DIV (INTEGER DIVISION)
  529. ' d% = a% MOD b% ' MODULO (DIVISION REMAINDER)
  530.  
  531. '_PUTIMAGE (0, 0), i ' places image at upper left corner of window w/o stretching it
  532. '_PUTIMAGE (dx1, dy1), sourceHandle&, destHandle&, (sx1, sy1)-(sx2, sy2) ' portion of source to the top-left corner of the destination page
  533. '_PUTIMAGE (64,  128), imgTiles&,      imgScreen&,   (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  534. '_PutImage (64, 128), imgTiles&, imgScreen&, (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  535.  
  536. Sub DrawTile8 (imgTiles&, TileNum%, imgScreen&, dx%, dy%)
  537.     Dim tw% ' width/height of tile
  538.     Dim tw_minus1% ' width/height of tile -1
  539.     Dim cols% ' # tiles across on tile sheet
  540.     Dim rows% ' # tile rows on tile sheet
  541.     Dim sc% ' source column on tile sheet
  542.     Dim sr% ' source row on tile sheet
  543.     Dim sx1% ' source start x
  544.     Dim sx2% ' source end x
  545.     Dim sy1% ' source start y
  546.     Dim sy2% ' source end y
  547.     Dim xDest% ' destination x
  548.     Dim yDest% ' destination y
  549.  
  550.     ' SIZE OF TILE
  551.     tw% = 8
  552.     tw_minus1% = 7
  553.  
  554.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  555.     cols% = 16
  556.     rows% = 16
  557.  
  558.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  559.     sc% = TileNum% Mod rows%
  560.     sr% = TileNum% \ rows%
  561.  
  562.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  563.  
  564.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  565.     sx1% = sc% * tw%
  566.  
  567.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  568.     sy1% = sr% * tw%
  569.  
  570.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  571.     sx2% = sx1% + tw_minus1%
  572.  
  573.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  574.     sy2% = sy1% + tw_minus1%
  575.  
  576.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  577.     xDest% = dx% * tw%
  578.  
  579.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  580.     yDest% = (dy% * tw%) '+ yOffset%
  581.  
  582.     'Print "Tile#" + cstr$(TileNum%) + _
  583.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  584.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  585.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  586.  
  587.     _Dest imgScreen&
  588.  
  589.     ' portion of source to the top-left corner of the destination page
  590.     _PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  591.  
  592. End Sub ' DrawTile8
  593.  
  594. ' ################################################################################################################################################################
  595. ' END DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  596. ' ################################################################################################################################################################
  597.  
  598. ' ################################################################################################################################################################
  599. ' BEGIN DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  600. ' ################################################################################################################################################################
  601.  
  602. ' /////////////////////////////////////////////////////////////////////////////
  603. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  604. ' using hardware images
  605.  
  606. ' Usage:
  607. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  608. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  609. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  610.  
  611. Sub DrawTileHw8 (imgTiles&, TileNum%, imgScreen&, dx%, dy%, iSubTileset%)
  612.     Dim tw% ' width/height of tile
  613.     Dim tw_minus1% ' width/height of tile -1
  614.     Dim cols% ' # tiles across on tile sheet
  615.     Dim rows% ' # tile rows on tile sheet
  616.     Dim sc% ' source column on tile sheet
  617.     Dim sr% ' source row on tile sheet
  618.     Dim sx1% ' source start x
  619.     Dim sx2% ' source end x
  620.     Dim sy1% ' source start y
  621.     Dim sy2% ' source end y
  622.     Dim xDest% ' destination x
  623.     Dim yDest% ' destination y
  624.     Dim xOffset%
  625.  
  626.     ' CALCULATE OFFSET
  627.     xOffset% = 128 * iSubTileset%
  628.  
  629.     ' SIZE OF TILE
  630.     tw% = 8
  631.     tw_minus1% = 7
  632.  
  633.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  634.     cols% = 16
  635.     rows% = 16
  636.  
  637.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  638.     sc% = TileNum% Mod rows%
  639.     sr% = TileNum% \ rows%
  640.  
  641.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  642.  
  643.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  644.     sx1% = (sc% * tw%) + xOffset%
  645.  
  646.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  647.     sy1% = sr% * tw%
  648.  
  649.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  650.     sx2% = sx1% + tw_minus1%
  651.  
  652.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  653.     sy2% = sy1% + tw_minus1%
  654.  
  655.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  656.     xDest% = dx% * tw%
  657.  
  658.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  659.     yDest% = (dy% * tw%) '+ yOffset%
  660.  
  661.     'Print "Tile#" + cstr$(TileNum%) + _
  662.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  663.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  664.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  665.  
  666.     _Dest imgScreen&
  667.  
  668.     ' portion of source to the top-left corner of the destination page
  669.     '_PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  670.     '_PutImage (200, 100)-Step(100, 100), imgHardware&, , (0, 0)-(40, 40)
  671.     _PutImage (xDest%, yDest%), imgTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  672.  
  673. End Sub ' DrawTileHw8
  674.  
  675. ' /////////////////////////////////////////////////////////////////////////////
  676. ' Receives an image imgTiles of 8x8 tiles
  677. ' colored black on transparent background
  678. ' and returns a new image imgNew
  679. ' copied from the tiles in imgTiles,
  680. ' except colored to foreground color fgColor,
  681. ' and background color bgColor
  682.  
  683. ' Usage:
  684. ' MakeColoredTileset imgTiles, imgNew, fgColor, bgColor
  685.  
  686. Sub MakeColoredTileset (imgTiles As Long, imgNew As Long, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  687.     Dim iTileNum As Integer
  688.     Dim iY As Integer
  689.     Dim iX As Integer
  690.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  691.     imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  692.     iTileNum = 0
  693.     For iY = 0 To (_Height(imgTiles) \ 8) - 1
  694.         For iX = 0 To (_Width(imgTiles) \ 8) - 1
  695.             DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  696.             iTileNum = iTileNum + 1
  697.             If iTileNum > 255 Then Exit For
  698.         Next iX
  699.         If iTileNum > 255 Then Exit For
  700.     Next iY
  701. End Sub ' MakeColoredTileset
  702.  
  703. ' ################################################################################################################################################################
  704. ' END DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  705. ' ################################################################################################################################################################
  706.  
  707. ' ################################################################################################################################################################
  708. ' BEGIN TILE DEFINITIONS
  709. ' ################################################################################################################################################################
  710.  
  711. ' /////////////////////////////////////////////////////////////////////////////
  712. ' Loads tileset of 256 8x8 tiles into a 128x128 image (16 columns x 16 rows)
  713. ' where tiles are a single color.
  714.  
  715. ' Parameters:
  716. ' imgTiles& = contains the resulting tileset image
  717. ' fgColor = tile color
  718. ' bgColor = tile background color
  719.  
  720. Function GetTiles$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  721.     Dim RoutineName As String: RoutineName = "GetTiles$"
  722.     Dim sResult As String: sResult = ""
  723.     ReDim arrTileText(0 To 255) As String
  724.  
  725.     Dim iTileNum As Integer
  726.  
  727.     ReDim arrLines(-1) As String
  728.     Dim iFromX As Integer
  729.     Dim iFromY As Integer
  730.     Dim sLine As String
  731.     Dim sChar As String
  732.  
  733.     Dim iTileX As Integer
  734.     Dim iTileY As Integer
  735.     Dim iToX As Integer
  736.     Dim iToY As Integer
  737.     Dim pixelColor As _Unsigned Long
  738.     Dim bFinished As Integer
  739.  
  740.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  741.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  742.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  743.     imgTiles& = _NewImage(128, 128, 32)
  744.     '    Cls , cEmpty ' set the background color as transparent
  745.  
  746.     'Screen imgTiles&
  747.     'Cls , bgColor ' set the background color as transparent
  748.     _Dest imgTiles&
  749.     'DrawRect 0, 0, 128, 128, cEmpty
  750.     'DrawBox 0, 0, 128, cWhite
  751.     Cls , cEmpty ' set the background color as transparent
  752.  
  753.     GetTileText arrTileText()
  754.     iTileX = 0
  755.     iTileY = 0
  756.     bFinished = FALSE
  757.     For iTileNum = 0 To 255
  758.         split arrTileText(iTileNum), Chr$(13), arrLines()
  759.         iToY = iTileY * 8
  760.         If (iToY > _Height(imgTiles&)) Then
  761.             sResult = "iToY value " + cstr$(iToY) + " " + _
  762.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  763.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  764.             bFinished = TRUE
  765.             Exit For
  766.         End If
  767.  
  768.         For iFromY = LBound(arrLines) To UBound(arrLines)
  769.             sLine = arrLines(iFromY)
  770.             If Len(sLine) > 0 Then
  771.                 iToX = iTileX * 8
  772.                 For iFromX = 1 To Len(sLine)
  773.                     sChar = Mid$(sLine, iFromX, 1)
  774.                     If sChar = "." Then
  775.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  776.                     Else
  777.                         pixelColor = fgColor ' cBlack
  778.                     End If
  779.                     PSet (iToX, iToY), pixelColor
  780.                     iToX = iToX + 1
  781.                     If (iToX > _Width(imgTiles&)) Then
  782.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  783.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  784.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  785.                         bFinished = TRUE
  786.                         Exit For
  787.                     End If
  788.                 Next iFromX
  789.                 iToY = iToY + 1
  790.                 If bFinished = TRUE Then Exit For
  791.             End If
  792.         Next iFromY
  793.         If bFinished = TRUE Then Exit For
  794.  
  795.         iTileX = iTileX + 1
  796.         If iTileX > 15 Then
  797.             iTileX = 0
  798.             iTileY = iTileY + 1
  799.             'if iTileY > 15 then
  800.             '    sResult = "Exceeded max 16 rows of tiles." + _
  801.             '        "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  802.             '    bFinished = TRUE
  803.             '    exit for
  804.             'end if
  805.         End If
  806.     Next iTileNum
  807.  
  808.     GetTiles$ = sResult
  809. End Function ' GetTiles$
  810.  
  811. ' /////////////////////////////////////////////////////////////////////////////
  812. ' Returns an array of 256 8x8 tiles defined in text
  813. ' where each tile is defined by "." as blank and anything else is a pixel
  814. ' and each row is delimited by chr$(13)
  815.  
  816. Sub GetTileText (arrTileText() As String)
  817.     ReDim arrTileText(0 To 255) As String
  818.  
  819.     m$ = ""
  820.     m$ = m$ + "22....22" + Chr$(13)
  821.     m$ = m$ + "2..22..2" + Chr$(13)
  822.     m$ = m$ + "2..2...2" + Chr$(13)
  823.     m$ = m$ + "2...2..2" + Chr$(13)
  824.     m$ = m$ + "2..22..2" + Chr$(13)
  825.     m$ = m$ + "2..22..2" + Chr$(13)
  826.     m$ = m$ + "22....22" + Chr$(13)
  827.     m$ = m$ + "22222222" + Chr$(13)
  828.     arrTileText(0) = m$
  829.  
  830.     m$ = ""
  831.     m$ = m$ + "........" + Chr$(13)
  832.     m$ = m$ + "........" + Chr$(13)
  833.     m$ = m$ + "........" + Chr$(13)
  834.     m$ = m$ + "........" + Chr$(13)
  835.     m$ = m$ + "........" + Chr$(13)
  836.     m$ = m$ + "........" + Chr$(13)
  837.     m$ = m$ + "........" + Chr$(13)
  838.     m$ = m$ + "........" + Chr$(13)
  839.     arrTileText(1) = m$
  840.  
  841.     m$ = ""
  842.     m$ = m$ + "........" + Chr$(13)
  843.     m$ = m$ + "........" + Chr$(13)
  844.     m$ = m$ + "........" + Chr$(13)
  845.     m$ = m$ + "........" + Chr$(13)
  846.     m$ = m$ + "........" + Chr$(13)
  847.     m$ = m$ + "........" + Chr$(13)
  848.     m$ = m$ + "........" + Chr$(13)
  849.     m$ = m$ + "........" + Chr$(13)
  850.     arrTileText(2) = m$
  851.  
  852.     m$ = ""
  853.     m$ = m$ + "........" + Chr$(13)
  854.     m$ = m$ + "........" + Chr$(13)
  855.     m$ = m$ + "........" + Chr$(13)
  856.     m$ = m$ + "........" + Chr$(13)
  857.     m$ = m$ + "........" + Chr$(13)
  858.     m$ = m$ + "........" + Chr$(13)
  859.     m$ = m$ + "........" + Chr$(13)
  860.     m$ = m$ + "........" + Chr$(13)
  861.     arrTileText(3) = m$
  862.  
  863.     m$ = ""
  864.     m$ = m$ + "........" + Chr$(13)
  865.     m$ = m$ + "........" + Chr$(13)
  866.     m$ = m$ + "........" + Chr$(13)
  867.     m$ = m$ + "........" + Chr$(13)
  868.     m$ = m$ + "........" + Chr$(13)
  869.     m$ = m$ + "........" + Chr$(13)
  870.     m$ = m$ + "........" + Chr$(13)
  871.     m$ = m$ + "........" + Chr$(13)
  872.     arrTileText(4) = m$
  873.  
  874.     m$ = ""
  875.     m$ = m$ + "........" + Chr$(13)
  876.     m$ = m$ + "........" + Chr$(13)
  877.     m$ = m$ + "........" + Chr$(13)
  878.     m$ = m$ + "........" + Chr$(13)
  879.     m$ = m$ + "........" + Chr$(13)
  880.     m$ = m$ + "........" + Chr$(13)
  881.     m$ = m$ + "........" + Chr$(13)
  882.     m$ = m$ + "........" + Chr$(13)
  883.     arrTileText(5) = m$
  884.  
  885.     m$ = ""
  886.     m$ = m$ + "........" + Chr$(13)
  887.     m$ = m$ + "........" + Chr$(13)
  888.     m$ = m$ + "........" + Chr$(13)
  889.     m$ = m$ + "........" + Chr$(13)
  890.     m$ = m$ + "........" + Chr$(13)
  891.     m$ = m$ + "........" + Chr$(13)
  892.     m$ = m$ + "........" + Chr$(13)
  893.     m$ = m$ + "........" + Chr$(13)
  894.     arrTileText(6) = m$
  895.  
  896.     m$ = ""
  897.     m$ = m$ + "........" + Chr$(13)
  898.     m$ = m$ + "........" + Chr$(13)
  899.     m$ = m$ + "........" + Chr$(13)
  900.     m$ = m$ + "........" + Chr$(13)
  901.     m$ = m$ + "........" + Chr$(13)
  902.     m$ = m$ + "........" + Chr$(13)
  903.     m$ = m$ + "........" + Chr$(13)
  904.     m$ = m$ + "........" + Chr$(13)
  905.     arrTileText(7) = m$
  906.  
  907.     m$ = ""
  908.     m$ = m$ + "........" + Chr$(13)
  909.     m$ = m$ + "........" + Chr$(13)
  910.     m$ = m$ + "........" + Chr$(13)
  911.     m$ = m$ + "........" + Chr$(13)
  912.     m$ = m$ + "........" + Chr$(13)
  913.     m$ = m$ + "........" + Chr$(13)
  914.     m$ = m$ + "........" + Chr$(13)
  915.     m$ = m$ + "........" + Chr$(13)
  916.     arrTileText(8) = m$
  917.  
  918.     m$ = ""
  919.     m$ = m$ + "........" + Chr$(13)
  920.     m$ = m$ + "........" + Chr$(13)
  921.     m$ = m$ + "........" + Chr$(13)
  922.     m$ = m$ + "........" + Chr$(13)
  923.     m$ = m$ + "........" + Chr$(13)
  924.     m$ = m$ + "........" + Chr$(13)
  925.     m$ = m$ + "........" + Chr$(13)
  926.     m$ = m$ + "........" + Chr$(13)
  927.     arrTileText(9) = m$
  928.  
  929.     m$ = ""
  930.     m$ = m$ + "........" + Chr$(13)
  931.     m$ = m$ + "........" + Chr$(13)
  932.     m$ = m$ + "........" + Chr$(13)
  933.     m$ = m$ + "........" + Chr$(13)
  934.     m$ = m$ + "........" + Chr$(13)
  935.     m$ = m$ + "........" + Chr$(13)
  936.     m$ = m$ + "........" + Chr$(13)
  937.     m$ = m$ + "........" + Chr$(13)
  938.     arrTileText(10) = m$
  939.  
  940.     m$ = ""
  941.     m$ = m$ + "........" + Chr$(13)
  942.     m$ = m$ + "........" + Chr$(13)
  943.     m$ = m$ + "........" + Chr$(13)
  944.     m$ = m$ + "........" + Chr$(13)
  945.     m$ = m$ + "........" + Chr$(13)
  946.     m$ = m$ + "........" + Chr$(13)
  947.     m$ = m$ + "........" + Chr$(13)
  948.     m$ = m$ + "........" + Chr$(13)
  949.     arrTileText(11) = m$
  950.  
  951.     m$ = ""
  952.     m$ = m$ + "........" + Chr$(13)
  953.     m$ = m$ + "........" + Chr$(13)
  954.     m$ = m$ + "........" + Chr$(13)
  955.     m$ = m$ + "........" + Chr$(13)
  956.     m$ = m$ + "........" + Chr$(13)
  957.     m$ = m$ + "........" + Chr$(13)
  958.     m$ = m$ + "........" + Chr$(13)
  959.     m$ = m$ + "........" + Chr$(13)
  960.     arrTileText(12) = m$
  961.  
  962.     m$ = ""
  963.     m$ = m$ + "........" + Chr$(13)
  964.     m$ = m$ + "........" + Chr$(13)
  965.     m$ = m$ + "........" + Chr$(13)
  966.     m$ = m$ + "........" + Chr$(13)
  967.     m$ = m$ + "........" + Chr$(13)
  968.     m$ = m$ + "........" + Chr$(13)
  969.     m$ = m$ + "........" + Chr$(13)
  970.     m$ = m$ + "........" + Chr$(13)
  971.     arrTileText(13) = m$
  972.  
  973.     m$ = ""
  974.     m$ = m$ + "........" + Chr$(13)
  975.     m$ = m$ + "........" + Chr$(13)
  976.     m$ = m$ + "........" + Chr$(13)
  977.     m$ = m$ + "........" + Chr$(13)
  978.     m$ = m$ + "........" + Chr$(13)
  979.     m$ = m$ + "........" + Chr$(13)
  980.     m$ = m$ + "........" + Chr$(13)
  981.     m$ = m$ + "........" + Chr$(13)
  982.     arrTileText(14) = m$
  983.  
  984.     m$ = ""
  985.     m$ = m$ + "........" + Chr$(13)
  986.     m$ = m$ + "........" + Chr$(13)
  987.     m$ = m$ + "........" + Chr$(13)
  988.     m$ = m$ + "........" + Chr$(13)
  989.     m$ = m$ + "........" + Chr$(13)
  990.     m$ = m$ + "........" + Chr$(13)
  991.     m$ = m$ + "........" + Chr$(13)
  992.     m$ = m$ + "........" + Chr$(13)
  993.     arrTileText(15) = m$
  994.  
  995.     m$ = ""
  996.     m$ = m$ + "........" + Chr$(13)
  997.     m$ = m$ + "........" + Chr$(13)
  998.     m$ = m$ + "........" + Chr$(13)
  999.     m$ = m$ + "........" + Chr$(13)
  1000.     m$ = m$ + "........" + Chr$(13)
  1001.     m$ = m$ + "........" + Chr$(13)
  1002.     m$ = m$ + "........" + Chr$(13)
  1003.     m$ = m$ + "........" + Chr$(13)
  1004.     arrTileText(16) = m$
  1005.  
  1006.     m$ = ""
  1007.     m$ = m$ + "........" + Chr$(13)
  1008.     m$ = m$ + "........" + Chr$(13)
  1009.     m$ = m$ + "........" + Chr$(13)
  1010.     m$ = m$ + "........" + Chr$(13)
  1011.     m$ = m$ + "........" + Chr$(13)
  1012.     m$ = m$ + "........" + Chr$(13)
  1013.     m$ = m$ + "........" + Chr$(13)
  1014.     m$ = m$ + "........" + Chr$(13)
  1015.     arrTileText(17) = m$
  1016.  
  1017.     m$ = ""
  1018.     m$ = m$ + "........" + Chr$(13)
  1019.     m$ = m$ + "........" + Chr$(13)
  1020.     m$ = m$ + "........" + Chr$(13)
  1021.     m$ = m$ + "........" + Chr$(13)
  1022.     m$ = m$ + "........" + Chr$(13)
  1023.     m$ = m$ + "........" + Chr$(13)
  1024.     m$ = m$ + "........" + Chr$(13)
  1025.     m$ = m$ + "........" + Chr$(13)
  1026.     arrTileText(18) = m$
  1027.  
  1028.     m$ = ""
  1029.     m$ = m$ + "........" + Chr$(13)
  1030.     m$ = m$ + "........" + Chr$(13)
  1031.     m$ = m$ + "........" + Chr$(13)
  1032.     m$ = m$ + "........" + Chr$(13)
  1033.     m$ = m$ + "........" + Chr$(13)
  1034.     m$ = m$ + "........" + Chr$(13)
  1035.     m$ = m$ + "........" + Chr$(13)
  1036.     m$ = m$ + "........" + Chr$(13)
  1037.     arrTileText(19) = m$
  1038.  
  1039.     m$ = ""
  1040.     m$ = m$ + "........" + Chr$(13)
  1041.     m$ = m$ + "........" + Chr$(13)
  1042.     m$ = m$ + "........" + Chr$(13)
  1043.     m$ = m$ + "........" + Chr$(13)
  1044.     m$ = m$ + "........" + Chr$(13)
  1045.     m$ = m$ + "........" + Chr$(13)
  1046.     m$ = m$ + "........" + Chr$(13)
  1047.     m$ = m$ + "........" + Chr$(13)
  1048.     arrTileText(20) = m$
  1049.  
  1050.     m$ = ""
  1051.     m$ = m$ + "........" + Chr$(13)
  1052.     m$ = m$ + "........" + Chr$(13)
  1053.     m$ = m$ + "........" + Chr$(13)
  1054.     m$ = m$ + "........" + Chr$(13)
  1055.     m$ = m$ + "........" + Chr$(13)
  1056.     m$ = m$ + "........" + Chr$(13)
  1057.     m$ = m$ + "........" + Chr$(13)
  1058.     m$ = m$ + "........" + Chr$(13)
  1059.     arrTileText(21) = m$
  1060.  
  1061.     m$ = ""
  1062.     m$ = m$ + "........" + Chr$(13)
  1063.     m$ = m$ + "........" + Chr$(13)
  1064.     m$ = m$ + "........" + Chr$(13)
  1065.     m$ = m$ + "........" + Chr$(13)
  1066.     m$ = m$ + "........" + Chr$(13)
  1067.     m$ = m$ + "........" + Chr$(13)
  1068.     m$ = m$ + "........" + Chr$(13)
  1069.     m$ = m$ + "........" + Chr$(13)
  1070.     arrTileText(22) = m$
  1071.  
  1072.     m$ = ""
  1073.     m$ = m$ + "........" + Chr$(13)
  1074.     m$ = m$ + "........" + Chr$(13)
  1075.     m$ = m$ + "........" + Chr$(13)
  1076.     m$ = m$ + "........" + Chr$(13)
  1077.     m$ = m$ + "........" + Chr$(13)
  1078.     m$ = m$ + "........" + Chr$(13)
  1079.     m$ = m$ + "........" + Chr$(13)
  1080.     m$ = m$ + "........" + Chr$(13)
  1081.     arrTileText(23) = m$
  1082.  
  1083.     m$ = ""
  1084.     m$ = m$ + "........" + Chr$(13)
  1085.     m$ = m$ + "........" + Chr$(13)
  1086.     m$ = m$ + "........" + Chr$(13)
  1087.     m$ = m$ + "........" + Chr$(13)
  1088.     m$ = m$ + "........" + Chr$(13)
  1089.     m$ = m$ + "........" + Chr$(13)
  1090.     m$ = m$ + "........" + Chr$(13)
  1091.     m$ = m$ + "........" + Chr$(13)
  1092.     arrTileText(24) = m$
  1093.  
  1094.     m$ = ""
  1095.     m$ = m$ + "........" + Chr$(13)
  1096.     m$ = m$ + "........" + Chr$(13)
  1097.     m$ = m$ + "........" + Chr$(13)
  1098.     m$ = m$ + "........" + Chr$(13)
  1099.     m$ = m$ + "........" + Chr$(13)
  1100.     m$ = m$ + "........" + Chr$(13)
  1101.     m$ = m$ + "........" + Chr$(13)
  1102.     m$ = m$ + "........" + Chr$(13)
  1103.     arrTileText(25) = m$
  1104.  
  1105.     m$ = ""
  1106.     m$ = m$ + "........" + Chr$(13)
  1107.     m$ = m$ + "........" + Chr$(13)
  1108.     m$ = m$ + "........" + Chr$(13)
  1109.     m$ = m$ + "........" + Chr$(13)
  1110.     m$ = m$ + "........" + Chr$(13)
  1111.     m$ = m$ + "........" + Chr$(13)
  1112.     m$ = m$ + "........" + Chr$(13)
  1113.     m$ = m$ + "........" + Chr$(13)
  1114.     arrTileText(26) = m$
  1115.  
  1116.     m$ = ""
  1117.     m$ = m$ + "........" + Chr$(13)
  1118.     m$ = m$ + "........" + Chr$(13)
  1119.     m$ = m$ + "........" + Chr$(13)
  1120.     m$ = m$ + "........" + Chr$(13)
  1121.     m$ = m$ + "........" + Chr$(13)
  1122.     m$ = m$ + "........" + Chr$(13)
  1123.     m$ = m$ + "........" + Chr$(13)
  1124.     m$ = m$ + "........" + Chr$(13)
  1125.     arrTileText(27) = m$
  1126.  
  1127.     m$ = ""
  1128.     m$ = m$ + "........" + Chr$(13)
  1129.     m$ = m$ + "........" + Chr$(13)
  1130.     m$ = m$ + "........" + Chr$(13)
  1131.     m$ = m$ + "........" + Chr$(13)
  1132.     m$ = m$ + "........" + Chr$(13)
  1133.     m$ = m$ + "........" + Chr$(13)
  1134.     m$ = m$ + "........" + Chr$(13)
  1135.     m$ = m$ + "........" + Chr$(13)
  1136.     arrTileText(28) = m$
  1137.  
  1138.     m$ = ""
  1139.     m$ = m$ + "........" + Chr$(13)
  1140.     m$ = m$ + "........" + Chr$(13)
  1141.     m$ = m$ + "........" + Chr$(13)
  1142.     m$ = m$ + "........" + Chr$(13)
  1143.     m$ = m$ + "........" + Chr$(13)
  1144.     m$ = m$ + "........" + Chr$(13)
  1145.     m$ = m$ + "........" + Chr$(13)
  1146.     m$ = m$ + "........" + Chr$(13)
  1147.     arrTileText(29) = m$
  1148.  
  1149.     m$ = ""
  1150.     m$ = m$ + "........" + Chr$(13)
  1151.     m$ = m$ + "........" + Chr$(13)
  1152.     m$ = m$ + "........" + Chr$(13)
  1153.     m$ = m$ + "........" + Chr$(13)
  1154.     m$ = m$ + "........" + Chr$(13)
  1155.     m$ = m$ + "........" + Chr$(13)
  1156.     m$ = m$ + "........" + Chr$(13)
  1157.     m$ = m$ + "........" + Chr$(13)
  1158.     arrTileText(30) = m$
  1159.  
  1160.     m$ = ""
  1161.     m$ = m$ + "........" + Chr$(13)
  1162.     m$ = m$ + "........" + Chr$(13)
  1163.     m$ = m$ + "........" + Chr$(13)
  1164.     m$ = m$ + "........" + Chr$(13)
  1165.     m$ = m$ + "........" + Chr$(13)
  1166.     m$ = m$ + "........" + Chr$(13)
  1167.     m$ = m$ + "........" + Chr$(13)
  1168.     m$ = m$ + "........" + Chr$(13)
  1169.     arrTileText(31) = m$
  1170.  
  1171.     m$ = ""
  1172.     m$ = m$ + "........" + Chr$(13)
  1173.     m$ = m$ + "........" + Chr$(13)
  1174.     m$ = m$ + "........" + Chr$(13)
  1175.     m$ = m$ + "........" + Chr$(13)
  1176.     m$ = m$ + "........" + Chr$(13)
  1177.     m$ = m$ + "........" + Chr$(13)
  1178.     m$ = m$ + "........" + Chr$(13)
  1179.     m$ = m$ + "........" + Chr$(13)
  1180.     arrTileText(32) = m$
  1181.  
  1182.     m$ = ""
  1183.     m$ = m$ + "...22..." + Chr$(13)
  1184.     m$ = m$ + "...22..." + Chr$(13)
  1185.     m$ = m$ + "...22..." + Chr$(13)
  1186.     m$ = m$ + "...22..." + Chr$(13)
  1187.     m$ = m$ + "........" + Chr$(13)
  1188.     m$ = m$ + "........" + Chr$(13)
  1189.     m$ = m$ + "...22..." + Chr$(13)
  1190.     m$ = m$ + "........" + Chr$(13)
  1191.     arrTileText(33) = m$
  1192.  
  1193.     m$ = ""
  1194.     m$ = m$ + ".22..22." + Chr$(13)
  1195.     m$ = m$ + ".22..22." + Chr$(13)
  1196.     m$ = m$ + ".22..22." + Chr$(13)
  1197.     m$ = m$ + "........" + Chr$(13)
  1198.     m$ = m$ + "........" + Chr$(13)
  1199.     m$ = m$ + "........" + Chr$(13)
  1200.     m$ = m$ + "........" + Chr$(13)
  1201.     m$ = m$ + "........" + Chr$(13)
  1202.     arrTileText(34) = m$
  1203.  
  1204.     m$ = ""
  1205.     m$ = m$ + ".22..22." + Chr$(13)
  1206.     m$ = m$ + ".22..22." + Chr$(13)
  1207.     m$ = m$ + "22222222" + Chr$(13)
  1208.     m$ = m$ + ".22..22." + Chr$(13)
  1209.     m$ = m$ + "22222222" + Chr$(13)
  1210.     m$ = m$ + ".22..22." + Chr$(13)
  1211.     m$ = m$ + ".22..22." + Chr$(13)
  1212.     m$ = m$ + "........" + Chr$(13)
  1213.     arrTileText(35) = m$
  1214.  
  1215.     m$ = ""
  1216.     m$ = m$ + "...22..." + Chr$(13)
  1217.     m$ = m$ + "..22222." + Chr$(13)
  1218.     m$ = m$ + ".22....." + Chr$(13)
  1219.     m$ = m$ + "..2222.." + Chr$(13)
  1220.     m$ = m$ + ".....22." + Chr$(13)
  1221.     m$ = m$ + ".22222.." + Chr$(13)
  1222.     m$ = m$ + "...22..." + Chr$(13)
  1223.     m$ = m$ + "........" + Chr$(13)
  1224.     arrTileText(36) = m$
  1225.  
  1226.     m$ = ""
  1227.     m$ = m$ + ".22...2." + Chr$(13)
  1228.     m$ = m$ + ".22..22." + Chr$(13)
  1229.     m$ = m$ + "....22.." + Chr$(13)
  1230.     m$ = m$ + "...22..." + Chr$(13)
  1231.     m$ = m$ + "..22...." + Chr$(13)
  1232.     m$ = m$ + ".22..22." + Chr$(13)
  1233.     m$ = m$ + ".2...22." + Chr$(13)
  1234.     m$ = m$ + "........" + Chr$(13)
  1235.     arrTileText(37) = m$
  1236.  
  1237.     m$ = ""
  1238.     m$ = m$ + "..2222.." + Chr$(13)
  1239.     m$ = m$ + ".22..22." + Chr$(13)
  1240.     m$ = m$ + "..2222.." + Chr$(13)
  1241.     m$ = m$ + "..222..." + Chr$(13)
  1242.     m$ = m$ + ".22..222" + Chr$(13)
  1243.     m$ = m$ + ".22..22." + Chr$(13)
  1244.     m$ = m$ + "..222222" + Chr$(13)
  1245.     m$ = m$ + "........" + Chr$(13)
  1246.     arrTileText(38) = m$
  1247.  
  1248.     m$ = ""
  1249.     m$ = m$ + ".....22." + Chr$(13)
  1250.     m$ = m$ + "....22.." + Chr$(13)
  1251.     m$ = m$ + "...22..." + Chr$(13)
  1252.     m$ = m$ + "........" + Chr$(13)
  1253.     m$ = m$ + "........" + Chr$(13)
  1254.     m$ = m$ + "........" + Chr$(13)
  1255.     m$ = m$ + "........" + Chr$(13)
  1256.     m$ = m$ + "........" + Chr$(13)
  1257.     arrTileText(39) = m$
  1258.  
  1259.     m$ = ""
  1260.     m$ = m$ + "....22.." + Chr$(13)
  1261.     m$ = m$ + "...22..." + Chr$(13)
  1262.     m$ = m$ + "..22...." + Chr$(13)
  1263.     m$ = m$ + "..22...." + Chr$(13)
  1264.     m$ = m$ + "..22...." + Chr$(13)
  1265.     m$ = m$ + "...22..." + Chr$(13)
  1266.     m$ = m$ + "....22.." + Chr$(13)
  1267.     m$ = m$ + "........" + Chr$(13)
  1268.     arrTileText(40) = m$
  1269.  
  1270.     m$ = ""
  1271.     m$ = m$ + "..22...." + Chr$(13)
  1272.     m$ = m$ + "...22..." + Chr$(13)
  1273.     m$ = m$ + "....22.." + Chr$(13)
  1274.     m$ = m$ + "....22.." + Chr$(13)
  1275.     m$ = m$ + "....22.." + Chr$(13)
  1276.     m$ = m$ + "...22..." + Chr$(13)
  1277.     m$ = m$ + "..22...." + Chr$(13)
  1278.     m$ = m$ + "........" + Chr$(13)
  1279.     arrTileText(41) = m$
  1280.  
  1281.     m$ = ""
  1282.     m$ = m$ + "........" + Chr$(13)
  1283.     m$ = m$ + ".22..22." + Chr$(13)
  1284.     m$ = m$ + "..2222.." + Chr$(13)
  1285.     m$ = m$ + "22222222" + Chr$(13)
  1286.     m$ = m$ + "..2222.." + Chr$(13)
  1287.     m$ = m$ + ".22..22." + Chr$(13)
  1288.     m$ = m$ + "........" + Chr$(13)
  1289.     m$ = m$ + "........" + Chr$(13)
  1290.     arrTileText(42) = m$
  1291.  
  1292.     m$ = ""
  1293.     m$ = m$ + "........" + Chr$(13)
  1294.     m$ = m$ + "...22..." + Chr$(13)
  1295.     m$ = m$ + "...22..." + Chr$(13)
  1296.     m$ = m$ + ".222222." + Chr$(13)
  1297.     m$ = m$ + "...22..." + Chr$(13)
  1298.     m$ = m$ + "...22..." + Chr$(13)
  1299.     m$ = m$ + "........" + Chr$(13)
  1300.     m$ = m$ + "........" + Chr$(13)
  1301.     arrTileText(43) = m$
  1302.  
  1303.     m$ = ""
  1304.     m$ = m$ + "........" + Chr$(13)
  1305.     m$ = m$ + "........" + Chr$(13)
  1306.     m$ = m$ + "........" + Chr$(13)
  1307.     m$ = m$ + "........" + Chr$(13)
  1308.     m$ = m$ + "........" + Chr$(13)
  1309.     m$ = m$ + "...22..." + Chr$(13)
  1310.     m$ = m$ + "...22..." + Chr$(13)
  1311.     m$ = m$ + "..22...." + Chr$(13)
  1312.     arrTileText(44) = m$
  1313.  
  1314.     m$ = ""
  1315.     m$ = m$ + "........" + Chr$(13)
  1316.     m$ = m$ + "........" + Chr$(13)
  1317.     m$ = m$ + "........" + Chr$(13)
  1318.     m$ = m$ + ".222222." + Chr$(13)
  1319.     m$ = m$ + "........" + Chr$(13)
  1320.     m$ = m$ + "........" + Chr$(13)
  1321.     m$ = m$ + "........" + Chr$(13)
  1322.     m$ = m$ + "........" + Chr$(13)
  1323.     arrTileText(45) = m$
  1324.  
  1325.     m$ = ""
  1326.     m$ = m$ + "........" + Chr$(13)
  1327.     m$ = m$ + "........" + Chr$(13)
  1328.     m$ = m$ + "........" + Chr$(13)
  1329.     m$ = m$ + "........" + Chr$(13)
  1330.     m$ = m$ + "........" + Chr$(13)
  1331.     m$ = m$ + "...22..." + Chr$(13)
  1332.     m$ = m$ + "...22..." + Chr$(13)
  1333.     m$ = m$ + "........" + Chr$(13)
  1334.     arrTileText(46) = m$
  1335.  
  1336.     m$ = ""
  1337.     m$ = m$ + "........" + Chr$(13)
  1338.     m$ = m$ + "......22" + Chr$(13)
  1339.     m$ = m$ + ".....22." + Chr$(13)
  1340.     m$ = m$ + "....22.." + Chr$(13)
  1341.     m$ = m$ + "...22..." + Chr$(13)
  1342.     m$ = m$ + "..22...." + Chr$(13)
  1343.     m$ = m$ + ".22....." + Chr$(13)
  1344.     m$ = m$ + "........" + Chr$(13)
  1345.     arrTileText(47) = m$
  1346.  
  1347.     m$ = ""
  1348.     m$ = m$ + "..2222.." + Chr$(13)
  1349.     m$ = m$ + ".22..22." + Chr$(13)
  1350.     m$ = m$ + ".22.222." + Chr$(13)
  1351.     m$ = m$ + ".222.22." + Chr$(13)
  1352.     m$ = m$ + ".22..22." + Chr$(13)
  1353.     m$ = m$ + ".22..22." + Chr$(13)
  1354.     m$ = m$ + "..2222.." + Chr$(13)
  1355.     m$ = m$ + "........" + Chr$(13)
  1356.     arrTileText(48) = m$
  1357.  
  1358.     m$ = ""
  1359.     m$ = m$ + "...22..." + Chr$(13)
  1360.     m$ = m$ + "...22..." + Chr$(13)
  1361.     m$ = m$ + "..222..." + Chr$(13)
  1362.     m$ = m$ + "...22..." + Chr$(13)
  1363.     m$ = m$ + "...22..." + Chr$(13)
  1364.     m$ = m$ + "...22..." + Chr$(13)
  1365.     m$ = m$ + ".222222." + Chr$(13)
  1366.     m$ = m$ + "........" + Chr$(13)
  1367.     arrTileText(49) = m$
  1368.  
  1369.     m$ = ""
  1370.     m$ = m$ + "..2222.." + Chr$(13)
  1371.     m$ = m$ + ".22..22." + Chr$(13)
  1372.     m$ = m$ + ".....22." + Chr$(13)
  1373.     m$ = m$ + "....22.." + Chr$(13)
  1374.     m$ = m$ + "..22...." + Chr$(13)
  1375.     m$ = m$ + ".22....." + Chr$(13)
  1376.     m$ = m$ + ".222222." + Chr$(13)
  1377.     m$ = m$ + "........" + Chr$(13)
  1378.     arrTileText(50) = m$
  1379.  
  1380.     m$ = ""
  1381.     m$ = m$ + "..2222.." + Chr$(13)
  1382.     m$ = m$ + ".22..22." + Chr$(13)
  1383.     m$ = m$ + ".....22." + Chr$(13)
  1384.     m$ = m$ + "...222.." + Chr$(13)
  1385.     m$ = m$ + ".....22." + Chr$(13)
  1386.     m$ = m$ + ".22..22." + Chr$(13)
  1387.     m$ = m$ + "..2222.." + Chr$(13)
  1388.     m$ = m$ + "........" + Chr$(13)
  1389.     arrTileText(51) = m$
  1390.  
  1391.     m$ = ""
  1392.     m$ = m$ + ".....22." + Chr$(13)
  1393.     m$ = m$ + "....222." + Chr$(13)
  1394.     m$ = m$ + "...2222." + Chr$(13)
  1395.     m$ = m$ + ".22..22." + Chr$(13)
  1396.     m$ = m$ + ".2222222" + Chr$(13)
  1397.     m$ = m$ + ".....22." + Chr$(13)
  1398.     m$ = m$ + ".....22." + Chr$(13)
  1399.     m$ = m$ + "........" + Chr$(13)
  1400.     arrTileText(52) = m$
  1401.  
  1402.     m$ = ""
  1403.     m$ = m$ + ".222222." + Chr$(13)
  1404.     m$ = m$ + ".22....." + Chr$(13)
  1405.     m$ = m$ + ".22222.." + Chr$(13)
  1406.     m$ = m$ + ".....22." + Chr$(13)
  1407.     m$ = m$ + ".....22." + Chr$(13)
  1408.     m$ = m$ + ".22..22." + Chr$(13)
  1409.     m$ = m$ + "..2222.." + Chr$(13)
  1410.     m$ = m$ + "........" + Chr$(13)
  1411.     arrTileText(53) = m$
  1412.  
  1413.     m$ = ""
  1414.     m$ = m$ + "..2222.." + Chr$(13)
  1415.     m$ = m$ + ".22..22." + Chr$(13)
  1416.     m$ = m$ + ".22....." + Chr$(13)
  1417.     m$ = m$ + ".22222.." + Chr$(13)
  1418.     m$ = m$ + ".22..22." + Chr$(13)
  1419.     m$ = m$ + ".22..22." + Chr$(13)
  1420.     m$ = m$ + "..2222.." + Chr$(13)
  1421.     m$ = m$ + "........" + Chr$(13)
  1422.     arrTileText(54) = m$
  1423.  
  1424.     m$ = ""
  1425.     m$ = m$ + ".222222." + Chr$(13)
  1426.     m$ = m$ + ".22..22." + Chr$(13)
  1427.     m$ = m$ + "....22.." + Chr$(13)
  1428.     m$ = m$ + "...22..." + Chr$(13)
  1429.     m$ = m$ + "...22..." + Chr$(13)
  1430.     m$ = m$ + "...22..." + Chr$(13)
  1431.     m$ = m$ + "...22..." + Chr$(13)
  1432.     m$ = m$ + "........" + Chr$(13)
  1433.     arrTileText(55) = m$
  1434.  
  1435.     m$ = ""
  1436.     m$ = m$ + "..2222.." + Chr$(13)
  1437.     m$ = m$ + ".22..22." + Chr$(13)
  1438.     m$ = m$ + ".22..22." + Chr$(13)
  1439.     m$ = m$ + "..2222.." + Chr$(13)
  1440.     m$ = m$ + ".22..22." + Chr$(13)
  1441.     m$ = m$ + ".22..22." + Chr$(13)
  1442.     m$ = m$ + "..2222.." + Chr$(13)
  1443.     m$ = m$ + "........" + Chr$(13)
  1444.     arrTileText(56) = m$
  1445.  
  1446.     m$ = ""
  1447.     m$ = m$ + "..2222.." + Chr$(13)
  1448.     m$ = m$ + ".22..22." + Chr$(13)
  1449.     m$ = m$ + ".22..22." + Chr$(13)
  1450.     m$ = m$ + "..22222." + Chr$(13)
  1451.     m$ = m$ + ".....22." + Chr$(13)
  1452.     m$ = m$ + ".22..22." + Chr$(13)
  1453.     m$ = m$ + "..2222.." + Chr$(13)
  1454.     m$ = m$ + "........" + Chr$(13)
  1455.     arrTileText(57) = m$
  1456.  
  1457.     m$ = ""
  1458.     m$ = m$ + "........" + Chr$(13)
  1459.     m$ = m$ + "........" + Chr$(13)
  1460.     m$ = m$ + "...22..." + Chr$(13)
  1461.     m$ = m$ + "........" + Chr$(13)
  1462.     m$ = m$ + "........" + Chr$(13)
  1463.     m$ = m$ + "...22..." + Chr$(13)
  1464.     m$ = m$ + "........" + Chr$(13)
  1465.     m$ = m$ + "........" + Chr$(13)
  1466.     arrTileText(58) = m$
  1467.  
  1468.     m$ = ""
  1469.     m$ = m$ + "........" + Chr$(13)
  1470.     m$ = m$ + "........" + Chr$(13)
  1471.     m$ = m$ + "...22..." + Chr$(13)
  1472.     m$ = m$ + "........" + Chr$(13)
  1473.     m$ = m$ + "........" + Chr$(13)
  1474.     m$ = m$ + "...22..." + Chr$(13)
  1475.     m$ = m$ + "...22..." + Chr$(13)
  1476.     m$ = m$ + "..22...." + Chr$(13)
  1477.     arrTileText(59) = m$
  1478.  
  1479.     m$ = ""
  1480.     m$ = m$ + "....222." + Chr$(13)
  1481.     m$ = m$ + "...22..." + Chr$(13)
  1482.     m$ = m$ + "..22...." + Chr$(13)
  1483.     m$ = m$ + ".22....." + Chr$(13)
  1484.     m$ = m$ + "..22...." + Chr$(13)
  1485.     m$ = m$ + "...22..." + Chr$(13)
  1486.     m$ = m$ + "....222." + Chr$(13)
  1487.     m$ = m$ + "........" + Chr$(13)
  1488.     arrTileText(60) = m$
  1489.  
  1490.     m$ = ""
  1491.     m$ = m$ + "........" + Chr$(13)
  1492.     m$ = m$ + "........" + Chr$(13)
  1493.     m$ = m$ + ".222222." + Chr$(13)
  1494.     m$ = m$ + "........" + Chr$(13)
  1495.     m$ = m$ + ".222222." + Chr$(13)
  1496.     m$ = m$ + "........" + Chr$(13)
  1497.     m$ = m$ + "........" + Chr$(13)
  1498.     m$ = m$ + "........" + Chr$(13)
  1499.     arrTileText(61) = m$
  1500.  
  1501.     m$ = ""
  1502.     m$ = m$ + ".222...." + Chr$(13)
  1503.     m$ = m$ + "...22..." + Chr$(13)
  1504.     m$ = m$ + "....22.." + Chr$(13)
  1505.     m$ = m$ + ".....22." + Chr$(13)
  1506.     m$ = m$ + "....22.." + Chr$(13)
  1507.     m$ = m$ + "...22..." + Chr$(13)
  1508.     m$ = m$ + ".222...." + Chr$(13)
  1509.     m$ = m$ + "........" + Chr$(13)
  1510.     arrTileText(62) = m$
  1511.  
  1512.     m$ = ""
  1513.     m$ = m$ + "..2222.." + Chr$(13)
  1514.     m$ = m$ + ".22..22." + Chr$(13)
  1515.     m$ = m$ + ".....22." + Chr$(13)
  1516.     m$ = m$ + "....22.." + Chr$(13)
  1517.     m$ = m$ + "...22..." + Chr$(13)
  1518.     m$ = m$ + "........" + Chr$(13)
  1519.     m$ = m$ + "...22..." + Chr$(13)
  1520.     m$ = m$ + "........" + Chr$(13)
  1521.     arrTileText(63) = m$
  1522.  
  1523.     m$ = ""
  1524.     m$ = m$ + "..2222.." + Chr$(13)
  1525.     m$ = m$ + ".22..22." + Chr$(13)
  1526.     m$ = m$ + ".22.222." + Chr$(13)
  1527.     m$ = m$ + ".22.222." + Chr$(13)
  1528.     m$ = m$ + ".22....." + Chr$(13)
  1529.     m$ = m$ + ".22...2." + Chr$(13)
  1530.     m$ = m$ + "..2222.." + Chr$(13)
  1531.     m$ = m$ + "........" + Chr$(13)
  1532.     arrTileText(64) = m$
  1533.  
  1534.     m$ = ""
  1535.     m$ = m$ + "...22..." + Chr$(13)
  1536.     m$ = m$ + "..2222.." + Chr$(13)
  1537.     m$ = m$ + ".22..22." + Chr$(13)
  1538.     m$ = m$ + ".222222." + Chr$(13)
  1539.     m$ = m$ + ".22..22." + Chr$(13)
  1540.     m$ = m$ + ".22..22." + Chr$(13)
  1541.     m$ = m$ + ".22..22." + Chr$(13)
  1542.     m$ = m$ + "........" + Chr$(13)
  1543.     arrTileText(65) = m$
  1544.  
  1545.     m$ = ""
  1546.     m$ = m$ + ".22222.." + Chr$(13)
  1547.     m$ = m$ + ".22..22." + Chr$(13)
  1548.     m$ = m$ + ".22..22." + Chr$(13)
  1549.     m$ = m$ + ".22222.." + Chr$(13)
  1550.     m$ = m$ + ".22..22." + Chr$(13)
  1551.     m$ = m$ + ".22..22." + Chr$(13)
  1552.     m$ = m$ + ".22222.." + Chr$(13)
  1553.     m$ = m$ + "........" + Chr$(13)
  1554.     arrTileText(66) = m$
  1555.  
  1556.     m$ = ""
  1557.     m$ = m$ + "..2222.." + Chr$(13)
  1558.     m$ = m$ + ".22..22." + Chr$(13)
  1559.     m$ = m$ + ".22....." + Chr$(13)
  1560.     m$ = m$ + ".22....." + Chr$(13)
  1561.     m$ = m$ + ".22....." + Chr$(13)
  1562.     m$ = m$ + ".22..22." + Chr$(13)
  1563.     m$ = m$ + "..2222.." + Chr$(13)
  1564.     m$ = m$ + "........" + Chr$(13)
  1565.     arrTileText(67) = m$
  1566.  
  1567.     m$ = ""
  1568.     m$ = m$ + ".2222..." + Chr$(13)
  1569.     m$ = m$ + ".22.22.." + Chr$(13)
  1570.     m$ = m$ + ".22..22." + Chr$(13)
  1571.     m$ = m$ + ".22..22." + Chr$(13)
  1572.     m$ = m$ + ".22..22." + Chr$(13)
  1573.     m$ = m$ + ".22.22.." + Chr$(13)
  1574.     m$ = m$ + ".2222..." + Chr$(13)
  1575.     m$ = m$ + "........" + Chr$(13)
  1576.     arrTileText(68) = m$
  1577.  
  1578.     m$ = ""
  1579.     m$ = m$ + ".222222." + Chr$(13)
  1580.     m$ = m$ + ".22....." + Chr$(13)
  1581.     m$ = m$ + ".22....." + Chr$(13)
  1582.     m$ = m$ + ".2222..." + Chr$(13)
  1583.     m$ = m$ + ".22....." + Chr$(13)
  1584.     m$ = m$ + ".22....." + Chr$(13)
  1585.     m$ = m$ + ".222222." + Chr$(13)
  1586.     m$ = m$ + "........" + Chr$(13)
  1587.     arrTileText(69) = m$
  1588.  
  1589.     m$ = ""
  1590.     m$ = m$ + ".222222." + Chr$(13)
  1591.     m$ = m$ + ".22....." + Chr$(13)
  1592.     m$ = m$ + ".22....." + Chr$(13)
  1593.     m$ = m$ + ".2222..." + Chr$(13)
  1594.     m$ = m$ + ".22....." + Chr$(13)
  1595.     m$ = m$ + ".22....." + Chr$(13)
  1596.     m$ = m$ + ".22....." + Chr$(13)
  1597.     m$ = m$ + "........" + Chr$(13)
  1598.     arrTileText(70) = m$
  1599.  
  1600.     m$ = ""
  1601.     m$ = m$ + "..2222.." + Chr$(13)
  1602.     m$ = m$ + ".22..22." + Chr$(13)
  1603.     m$ = m$ + ".22....." + Chr$(13)
  1604.     m$ = m$ + ".22.222." + Chr$(13)
  1605.     m$ = m$ + ".22..22." + Chr$(13)
  1606.     m$ = m$ + ".22..22." + Chr$(13)
  1607.     m$ = m$ + "..2222.." + Chr$(13)
  1608.     m$ = m$ + "........" + Chr$(13)
  1609.     arrTileText(71) = m$
  1610.  
  1611.     m$ = ""
  1612.     m$ = m$ + ".22..22." + Chr$(13)
  1613.     m$ = m$ + ".22..22." + Chr$(13)
  1614.     m$ = m$ + ".22..22." + Chr$(13)
  1615.     m$ = m$ + ".222222." + Chr$(13)
  1616.     m$ = m$ + ".22..22." + Chr$(13)
  1617.     m$ = m$ + ".22..22." + Chr$(13)
  1618.     m$ = m$ + ".22..22." + Chr$(13)
  1619.     m$ = m$ + "........" + Chr$(13)
  1620.     arrTileText(72) = m$
  1621.  
  1622.     m$ = ""
  1623.     m$ = m$ + "..2222.." + Chr$(13)
  1624.     m$ = m$ + "...22..." + Chr$(13)
  1625.     m$ = m$ + "...22..." + Chr$(13)
  1626.     m$ = m$ + "...22..." + Chr$(13)
  1627.     m$ = m$ + "...22..." + Chr$(13)
  1628.     m$ = m$ + "...22..." + Chr$(13)
  1629.     m$ = m$ + "..2222.." + Chr$(13)
  1630.     m$ = m$ + "........" + Chr$(13)
  1631.     arrTileText(73) = m$
  1632.  
  1633.     m$ = ""
  1634.     m$ = m$ + "...2222." + Chr$(13)
  1635.     m$ = m$ + "....22.." + Chr$(13)
  1636.     m$ = m$ + "....22.." + Chr$(13)
  1637.     m$ = m$ + "....22.." + Chr$(13)
  1638.     m$ = m$ + "....22.." + Chr$(13)
  1639.     m$ = m$ + ".22.22.." + Chr$(13)
  1640.     m$ = m$ + "..222..." + Chr$(13)
  1641.     m$ = m$ + "........" + Chr$(13)
  1642.     arrTileText(74) = m$
  1643.  
  1644.     m$ = ""
  1645.     m$ = m$ + ".22..22." + Chr$(13)
  1646.     m$ = m$ + ".22.22.." + Chr$(13)
  1647.     m$ = m$ + ".2222..." + Chr$(13)
  1648.     m$ = m$ + ".222...." + Chr$(13)
  1649.     m$ = m$ + ".2222..." + Chr$(13)
  1650.     m$ = m$ + ".22.22.." + Chr$(13)
  1651.     m$ = m$ + ".22..22." + Chr$(13)
  1652.     m$ = m$ + "........" + Chr$(13)
  1653.     arrTileText(75) = m$
  1654.  
  1655.     m$ = ""
  1656.     m$ = m$ + ".22....." + Chr$(13)
  1657.     m$ = m$ + ".22....." + Chr$(13)
  1658.     m$ = m$ + ".22....." + Chr$(13)
  1659.     m$ = m$ + ".22....." + Chr$(13)
  1660.     m$ = m$ + ".22....." + Chr$(13)
  1661.     m$ = m$ + ".22....." + Chr$(13)
  1662.     m$ = m$ + ".222222." + Chr$(13)
  1663.     m$ = m$ + "........" + Chr$(13)
  1664.     arrTileText(76) = m$
  1665.  
  1666.     m$ = ""
  1667.     m$ = m$ + ".22...22" + Chr$(13)
  1668.     m$ = m$ + ".222.222" + Chr$(13)
  1669.     m$ = m$ + ".2222222" + Chr$(13)
  1670.     m$ = m$ + ".22.2.22" + Chr$(13)
  1671.     m$ = m$ + ".22...22" + Chr$(13)
  1672.     m$ = m$ + ".22...22" + Chr$(13)
  1673.     m$ = m$ + ".22...22" + Chr$(13)
  1674.     m$ = m$ + "........" + Chr$(13)
  1675.     arrTileText(77) = m$
  1676.  
  1677.     m$ = ""
  1678.     m$ = m$ + ".22..22." + Chr$(13)
  1679.     m$ = m$ + ".222.22." + Chr$(13)
  1680.     m$ = m$ + ".222222." + Chr$(13)
  1681.     m$ = m$ + ".222222." + Chr$(13)
  1682.     m$ = m$ + ".22.222." + Chr$(13)
  1683.     m$ = m$ + ".22..22." + Chr$(13)
  1684.     m$ = m$ + ".22..22." + Chr$(13)
  1685.     m$ = m$ + "........" + Chr$(13)
  1686.     arrTileText(78) = m$
  1687.  
  1688.     m$ = ""
  1689.     m$ = m$ + "..2222.." + Chr$(13)
  1690.     m$ = m$ + ".22..22." + Chr$(13)
  1691.     m$ = m$ + ".22..22." + Chr$(13)
  1692.     m$ = m$ + ".22..22." + Chr$(13)
  1693.     m$ = m$ + ".22..22." + Chr$(13)
  1694.     m$ = m$ + ".22..22." + Chr$(13)
  1695.     m$ = m$ + "..2222.." + Chr$(13)
  1696.     m$ = m$ + "........" + Chr$(13)
  1697.     arrTileText(79) = m$
  1698.  
  1699.     m$ = ""
  1700.     m$ = m$ + ".22222.." + Chr$(13)
  1701.     m$ = m$ + ".22..22." + Chr$(13)
  1702.     m$ = m$ + ".22..22." + Chr$(13)
  1703.     m$ = m$ + ".22222.." + Chr$(13)
  1704.     m$ = m$ + ".22....." + Chr$(13)
  1705.     m$ = m$ + ".22....." + Chr$(13)
  1706.     m$ = m$ + ".22....." + Chr$(13)
  1707.     m$ = m$ + "........" + Chr$(13)
  1708.     arrTileText(80) = m$
  1709.  
  1710.     m$ = ""
  1711.     m$ = m$ + "..2222.." + Chr$(13)
  1712.     m$ = m$ + ".22..22." + Chr$(13)
  1713.     m$ = m$ + ".22..22." + Chr$(13)
  1714.     m$ = m$ + ".22..22." + Chr$(13)
  1715.     m$ = m$ + ".22..22." + Chr$(13)
  1716.     m$ = m$ + "..2222.." + Chr$(13)
  1717.     m$ = m$ + "....222." + Chr$(13)
  1718.     m$ = m$ + "........" + Chr$(13)
  1719.     arrTileText(81) = m$
  1720.  
  1721.     m$ = ""
  1722.     m$ = m$ + ".22222.." + Chr$(13)
  1723.     m$ = m$ + ".22..22." + Chr$(13)
  1724.     m$ = m$ + ".22..22." + Chr$(13)
  1725.     m$ = m$ + ".22222.." + Chr$(13)
  1726.     m$ = m$ + ".2222..." + Chr$(13)
  1727.     m$ = m$ + ".22.22.." + Chr$(13)
  1728.     m$ = m$ + ".22..22." + Chr$(13)
  1729.     m$ = m$ + "........" + Chr$(13)
  1730.     arrTileText(82) = m$
  1731.  
  1732.     m$ = ""
  1733.     m$ = m$ + "..2222.." + Chr$(13)
  1734.     m$ = m$ + ".22..22." + Chr$(13)
  1735.     m$ = m$ + ".22....." + Chr$(13)
  1736.     m$ = m$ + "..2222.." + Chr$(13)
  1737.     m$ = m$ + ".....22." + Chr$(13)
  1738.     m$ = m$ + ".22..22." + Chr$(13)
  1739.     m$ = m$ + "..2222.." + Chr$(13)
  1740.     m$ = m$ + "........" + Chr$(13)
  1741.     arrTileText(83) = m$
  1742.  
  1743.     m$ = ""
  1744.     m$ = m$ + ".222222." + Chr$(13)
  1745.     m$ = m$ + "...22..." + Chr$(13)
  1746.     m$ = m$ + "...22..." + Chr$(13)
  1747.     m$ = m$ + "...22..." + Chr$(13)
  1748.     m$ = m$ + "...22..." + Chr$(13)
  1749.     m$ = m$ + "...22..." + Chr$(13)
  1750.     m$ = m$ + "...22..." + Chr$(13)
  1751.     m$ = m$ + "........" + Chr$(13)
  1752.     arrTileText(84) = m$
  1753.  
  1754.     m$ = ""
  1755.     m$ = m$ + ".22..22." + Chr$(13)
  1756.     m$ = m$ + ".22..22." + Chr$(13)
  1757.     m$ = m$ + ".22..22." + Chr$(13)
  1758.     m$ = m$ + ".22..22." + Chr$(13)
  1759.     m$ = m$ + ".22..22." + Chr$(13)
  1760.     m$ = m$ + ".22..22." + Chr$(13)
  1761.     m$ = m$ + "..2222.." + Chr$(13)
  1762.     m$ = m$ + "........" + Chr$(13)
  1763.     arrTileText(85) = m$
  1764.  
  1765.     m$ = ""
  1766.     m$ = m$ + ".22..22." + Chr$(13)
  1767.     m$ = m$ + ".22..22." + Chr$(13)
  1768.     m$ = m$ + ".22..22." + Chr$(13)
  1769.     m$ = m$ + ".22..22." + Chr$(13)
  1770.     m$ = m$ + ".22..22." + Chr$(13)
  1771.     m$ = m$ + "..2222.." + Chr$(13)
  1772.     m$ = m$ + "...22..." + Chr$(13)
  1773.     m$ = m$ + "........" + Chr$(13)
  1774.     arrTileText(86) = m$
  1775.  
  1776.     m$ = ""
  1777.     m$ = m$ + ".22...22" + Chr$(13)
  1778.     m$ = m$ + ".22...22" + Chr$(13)
  1779.     m$ = m$ + ".22...22" + Chr$(13)
  1780.     m$ = m$ + ".22.2.22" + Chr$(13)
  1781.     m$ = m$ + ".2222222" + Chr$(13)
  1782.     m$ = m$ + ".222.222" + Chr$(13)
  1783.     m$ = m$ + ".22...22" + Chr$(13)
  1784.     m$ = m$ + "........" + Chr$(13)
  1785.     arrTileText(87) = m$
  1786.  
  1787.     m$ = ""
  1788.     m$ = m$ + ".22..22." + Chr$(13)
  1789.     m$ = m$ + ".22..22." + Chr$(13)
  1790.     m$ = m$ + "..2222.." + Chr$(13)
  1791.     m$ = m$ + "...22..." + Chr$(13)
  1792.     m$ = m$ + "..2222.." + Chr$(13)
  1793.     m$ = m$ + ".22..22." + Chr$(13)
  1794.     m$ = m$ + ".22..22." + Chr$(13)
  1795.     m$ = m$ + "........" + Chr$(13)
  1796.     arrTileText(88) = m$
  1797.  
  1798.     m$ = ""
  1799.     m$ = m$ + ".22..22." + Chr$(13)
  1800.     m$ = m$ + ".22..22." + Chr$(13)
  1801.     m$ = m$ + ".22..22." + Chr$(13)
  1802.     m$ = m$ + "..2222.." + Chr$(13)
  1803.     m$ = m$ + "...22..." + Chr$(13)
  1804.     m$ = m$ + "...22..." + Chr$(13)
  1805.     m$ = m$ + "...22..." + Chr$(13)
  1806.     m$ = m$ + "........" + Chr$(13)
  1807.     arrTileText(89) = m$
  1808.  
  1809.     m$ = ""
  1810.     m$ = m$ + ".222222." + Chr$(13)
  1811.     m$ = m$ + ".....22." + Chr$(13)
  1812.     m$ = m$ + "....22.." + Chr$(13)
  1813.     m$ = m$ + "...22..." + Chr$(13)
  1814.     m$ = m$ + "..22...." + Chr$(13)
  1815.     m$ = m$ + ".22....." + Chr$(13)
  1816.     m$ = m$ + ".222222." + Chr$(13)
  1817.     m$ = m$ + "........" + Chr$(13)
  1818.     arrTileText(90) = m$
  1819.  
  1820.     m$ = ""
  1821.     m$ = m$ + "..2222.." + Chr$(13)
  1822.     m$ = m$ + "..22...." + Chr$(13)
  1823.     m$ = m$ + "..22...." + Chr$(13)
  1824.     m$ = m$ + "..22...." + Chr$(13)
  1825.     m$ = m$ + "..22...." + Chr$(13)
  1826.     m$ = m$ + "..22...." + Chr$(13)
  1827.     m$ = m$ + "..2222.." + Chr$(13)
  1828.     m$ = m$ + "........" + Chr$(13)
  1829.     arrTileText(91) = m$
  1830.  
  1831.     m$ = ""
  1832.     m$ = m$ + "........" + Chr$(13)
  1833.     m$ = m$ + ".22....." + Chr$(13)
  1834.     m$ = m$ + "..22...." + Chr$(13)
  1835.     m$ = m$ + "...22..." + Chr$(13)
  1836.     m$ = m$ + "....22.." + Chr$(13)
  1837.     m$ = m$ + ".....22." + Chr$(13)
  1838.     m$ = m$ + "......22" + Chr$(13)
  1839.     m$ = m$ + "........" + Chr$(13)
  1840.     arrTileText(92) = m$
  1841.  
  1842.     m$ = ""
  1843.     m$ = m$ + "..2222.." + Chr$(13)
  1844.     m$ = m$ + "....22.." + Chr$(13)
  1845.     m$ = m$ + "....22.." + Chr$(13)
  1846.     m$ = m$ + "....22.." + Chr$(13)
  1847.     m$ = m$ + "....22.." + Chr$(13)
  1848.     m$ = m$ + "....22.." + Chr$(13)
  1849.     m$ = m$ + "..2222.." + Chr$(13)
  1850.     m$ = m$ + "........" + Chr$(13)
  1851.     arrTileText(93) = m$
  1852.  
  1853.     m$ = ""
  1854.     m$ = m$ + "...22..." + Chr$(13)
  1855.     m$ = m$ + "..2222.." + Chr$(13)
  1856.     m$ = m$ + ".22..22." + Chr$(13)
  1857.     m$ = m$ + "........" + Chr$(13)
  1858.     m$ = m$ + "........" + Chr$(13)
  1859.     m$ = m$ + "........" + Chr$(13)
  1860.     m$ = m$ + "........" + Chr$(13)
  1861.     m$ = m$ + "........" + Chr$(13)
  1862.     arrTileText(94) = m$
  1863.  
  1864.     m$ = ""
  1865.     m$ = m$ + "........" + Chr$(13)
  1866.     m$ = m$ + "........" + Chr$(13)
  1867.     m$ = m$ + "........" + Chr$(13)
  1868.     m$ = m$ + "........" + Chr$(13)
  1869.     m$ = m$ + "........" + Chr$(13)
  1870.     m$ = m$ + ".222222." + Chr$(13)
  1871.     m$ = m$ + "........" + Chr$(13)
  1872.     m$ = m$ + "........" + Chr$(13)
  1873.     arrTileText(95) = m$
  1874.  
  1875.     m$ = ""
  1876.     m$ = m$ + "........" + Chr$(13)
  1877.     m$ = m$ + "........" + Chr$(13)
  1878.     m$ = m$ + "........" + Chr$(13)
  1879.     m$ = m$ + "........" + Chr$(13)
  1880.     m$ = m$ + "........" + Chr$(13)
  1881.     m$ = m$ + "........" + Chr$(13)
  1882.     m$ = m$ + "........" + Chr$(13)
  1883.     m$ = m$ + "........" + Chr$(13)
  1884.     arrTileText(96) = m$
  1885.  
  1886.     m$ = ""
  1887.     m$ = m$ + "........" + Chr$(13)
  1888.     m$ = m$ + "..2222.." + Chr$(13)
  1889.     m$ = m$ + ".....22." + Chr$(13)
  1890.     m$ = m$ + "..22222." + Chr$(13)
  1891.     m$ = m$ + ".22..22." + Chr$(13)
  1892.     m$ = m$ + "..22222." + Chr$(13)
  1893.     m$ = m$ + "........" + Chr$(13)
  1894.     m$ = m$ + "........" + Chr$(13)
  1895.     arrTileText(97) = m$
  1896.  
  1897.     m$ = ""
  1898.     m$ = m$ + ".22....." + Chr$(13)
  1899.     m$ = m$ + ".22....." + Chr$(13)
  1900.     m$ = m$ + ".22222.." + Chr$(13)
  1901.     m$ = m$ + ".22..22." + Chr$(13)
  1902.     m$ = m$ + ".22..22." + Chr$(13)
  1903.     m$ = m$ + ".22222.." + Chr$(13)
  1904.     m$ = m$ + "........" + Chr$(13)
  1905.     m$ = m$ + "........" + Chr$(13)
  1906.     arrTileText(98) = m$
  1907.  
  1908.     m$ = ""
  1909.     m$ = m$ + "........" + Chr$(13)
  1910.     m$ = m$ + "..2222.." + Chr$(13)
  1911.     m$ = m$ + ".22....." + Chr$(13)
  1912.     m$ = m$ + ".22....." + Chr$(13)
  1913.     m$ = m$ + ".22....." + Chr$(13)
  1914.     m$ = m$ + "..2222.." + Chr$(13)
  1915.     m$ = m$ + "........" + Chr$(13)
  1916.     m$ = m$ + "........" + Chr$(13)
  1917.     arrTileText(99) = m$
  1918.  
  1919.     m$ = ""
  1920.     m$ = m$ + ".....22." + Chr$(13)
  1921.     m$ = m$ + ".....22." + Chr$(13)
  1922.     m$ = m$ + "..22222." + Chr$(13)
  1923.     m$ = m$ + ".22..22." + Chr$(13)
  1924.     m$ = m$ + ".22..22." + Chr$(13)
  1925.     m$ = m$ + "..22222." + Chr$(13)
  1926.     m$ = m$ + "........" + Chr$(13)
  1927.     m$ = m$ + "........" + Chr$(13)
  1928.     arrTileText(100) = m$
  1929.  
  1930.     m$ = ""
  1931.     m$ = m$ + "........" + Chr$(13)
  1932.     m$ = m$ + "..2222.." + Chr$(13)
  1933.     m$ = m$ + ".22..22." + Chr$(13)
  1934.     m$ = m$ + ".222222." + Chr$(13)
  1935.     m$ = m$ + ".22....." + Chr$(13)
  1936.     m$ = m$ + "..2222.." + Chr$(13)
  1937.     m$ = m$ + "........" + Chr$(13)
  1938.     m$ = m$ + "........" + Chr$(13)
  1939.     arrTileText(101) = m$
  1940.  
  1941.     m$ = ""
  1942.     m$ = m$ + "....222." + Chr$(13)
  1943.     m$ = m$ + "...22..." + Chr$(13)
  1944.     m$ = m$ + "..22222." + Chr$(13)
  1945.     m$ = m$ + "...22..." + Chr$(13)
  1946.     m$ = m$ + "...22..." + Chr$(13)
  1947.     m$ = m$ + "...22..." + Chr$(13)
  1948.     m$ = m$ + "........" + Chr$(13)
  1949.     m$ = m$ + "........" + Chr$(13)
  1950.     arrTileText(102) = m$
  1951.  
  1952.     m$ = ""
  1953.     m$ = m$ + "........" + Chr$(13)
  1954.     m$ = m$ + "..22222." + Chr$(13)
  1955.     m$ = m$ + ".22..22." + Chr$(13)
  1956.     m$ = m$ + ".22..22." + Chr$(13)
  1957.     m$ = m$ + "..22222." + Chr$(13)
  1958.     m$ = m$ + ".....22." + Chr$(13)
  1959.     m$ = m$ + ".22222.." + Chr$(13)
  1960.     m$ = m$ + "........" + Chr$(13)
  1961.     arrTileText(103) = m$
  1962.  
  1963.     m$ = ""
  1964.     m$ = m$ + ".22....." + Chr$(13)
  1965.     m$ = m$ + ".22....." + Chr$(13)
  1966.     m$ = m$ + ".22222.." + Chr$(13)
  1967.     m$ = m$ + ".22..22." + Chr$(13)
  1968.     m$ = m$ + ".22..22." + Chr$(13)
  1969.     m$ = m$ + ".22..22." + Chr$(13)
  1970.     m$ = m$ + "........" + Chr$(13)
  1971.     m$ = m$ + "........" + Chr$(13)
  1972.     arrTileText(104) = m$
  1973.  
  1974.     m$ = ""
  1975.     m$ = m$ + "...22..." + Chr$(13)
  1976.     m$ = m$ + "........" + Chr$(13)
  1977.     m$ = m$ + "..222..." + Chr$(13)
  1978.     m$ = m$ + "...22..." + Chr$(13)
  1979.     m$ = m$ + "...22..." + Chr$(13)
  1980.     m$ = m$ + "..2222.." + Chr$(13)
  1981.     m$ = m$ + "........" + Chr$(13)
  1982.     m$ = m$ + "........" + Chr$(13)
  1983.     arrTileText(105) = m$
  1984.  
  1985.     m$ = ""
  1986.     m$ = m$ + ".....22." + Chr$(13)
  1987.     m$ = m$ + "........" + Chr$(13)
  1988.     m$ = m$ + ".....22." + Chr$(13)
  1989.     m$ = m$ + ".....22." + Chr$(13)
  1990.     m$ = m$ + ".....22." + Chr$(13)
  1991.     m$ = m$ + ".....22." + Chr$(13)
  1992.     m$ = m$ + "..2222.." + Chr$(13)
  1993.     m$ = m$ + "........" + Chr$(13)
  1994.     arrTileText(106) = m$
  1995.  
  1996.     m$ = ""
  1997.     m$ = m$ + ".22....." + Chr$(13)
  1998.     m$ = m$ + ".22....." + Chr$(13)
  1999.     m$ = m$ + ".22.22.." + Chr$(13)
  2000.     m$ = m$ + ".2222..." + Chr$(13)
  2001.     m$ = m$ + ".22.22.." + Chr$(13)
  2002.     m$ = m$ + ".22..22." + Chr$(13)
  2003.     m$ = m$ + "........" + Chr$(13)
  2004.     m$ = m$ + "........" + Chr$(13)
  2005.     arrTileText(107) = m$
  2006.  
  2007.     m$ = ""
  2008.     m$ = m$ + "..222..." + Chr$(13)
  2009.     m$ = m$ + "...22..." + Chr$(13)
  2010.     m$ = m$ + "...22..." + Chr$(13)
  2011.     m$ = m$ + "...22..." + Chr$(13)
  2012.     m$ = m$ + "...22..." + Chr$(13)
  2013.     m$ = m$ + "..2222.." + Chr$(13)
  2014.     m$ = m$ + "........" + Chr$(13)
  2015.     m$ = m$ + "........" + Chr$(13)
  2016.     arrTileText(108) = m$
  2017.  
  2018.     m$ = ""
  2019.     m$ = m$ + "........" + Chr$(13)
  2020.     m$ = m$ + ".22..22." + Chr$(13)
  2021.     m$ = m$ + ".2222222" + Chr$(13)
  2022.     m$ = m$ + ".2222222" + Chr$(13)
  2023.     m$ = m$ + ".22.2.22" + Chr$(13)
  2024.     m$ = m$ + ".22...22" + Chr$(13)
  2025.     m$ = m$ + "........" + Chr$(13)
  2026.     m$ = m$ + "........" + Chr$(13)
  2027.     arrTileText(109) = m$
  2028.  
  2029.     m$ = ""
  2030.     m$ = m$ + "........" + Chr$(13)
  2031.     m$ = m$ + ".22222.." + Chr$(13)
  2032.     m$ = m$ + ".22..22." + Chr$(13)
  2033.     m$ = m$ + ".22..22." + Chr$(13)
  2034.     m$ = m$ + ".22..22." + Chr$(13)
  2035.     m$ = m$ + ".22..22." + Chr$(13)
  2036.     m$ = m$ + "........" + Chr$(13)
  2037.     m$ = m$ + "........" + Chr$(13)
  2038.     arrTileText(110) = m$
  2039.  
  2040.     m$ = ""
  2041.     m$ = m$ + "........" + Chr$(13)
  2042.     m$ = m$ + "..2222.." + Chr$(13)
  2043.     m$ = m$ + ".22..22." + Chr$(13)
  2044.     m$ = m$ + ".22..22." + Chr$(13)
  2045.     m$ = m$ + ".22..22." + Chr$(13)
  2046.     m$ = m$ + "..2222.." + Chr$(13)
  2047.     m$ = m$ + "........" + Chr$(13)
  2048.     m$ = m$ + "........" + Chr$(13)
  2049.     arrTileText(111) = m$
  2050.  
  2051.     m$ = ""
  2052.     m$ = m$ + "........" + Chr$(13)
  2053.     m$ = m$ + ".22222.." + Chr$(13)
  2054.     m$ = m$ + ".22..22." + Chr$(13)
  2055.     m$ = m$ + ".22..22." + Chr$(13)
  2056.     m$ = m$ + ".22222.." + Chr$(13)
  2057.     m$ = m$ + ".22....." + Chr$(13)
  2058.     m$ = m$ + ".22....." + Chr$(13)
  2059.     m$ = m$ + "........" + Chr$(13)
  2060.     arrTileText(112) = m$
  2061.  
  2062.     m$ = ""
  2063.     m$ = m$ + "........" + Chr$(13)
  2064.     m$ = m$ + "..22222." + Chr$(13)
  2065.     m$ = m$ + ".22..22." + Chr$(13)
  2066.     m$ = m$ + ".22..22." + Chr$(13)
  2067.     m$ = m$ + "..22222." + Chr$(13)
  2068.     m$ = m$ + ".....22." + Chr$(13)
  2069.     m$ = m$ + ".....22." + Chr$(13)
  2070.     m$ = m$ + "........" + Chr$(13)
  2071.     arrTileText(113) = m$
  2072.  
  2073.     m$ = ""
  2074.     m$ = m$ + "........" + Chr$(13)
  2075.     m$ = m$ + ".22222.." + Chr$(13)
  2076.     m$ = m$ + ".22..22." + Chr$(13)
  2077.     m$ = m$ + ".22....." + Chr$(13)
  2078.     m$ = m$ + ".22....." + Chr$(13)
  2079.     m$ = m$ + ".22....." + Chr$(13)
  2080.     m$ = m$ + "........" + Chr$(13)
  2081.     m$ = m$ + "........" + Chr$(13)
  2082.     arrTileText(114) = m$
  2083.  
  2084.     m$ = ""
  2085.     m$ = m$ + "........" + Chr$(13)
  2086.     m$ = m$ + "..22222." + Chr$(13)
  2087.     m$ = m$ + ".22....." + Chr$(13)
  2088.     m$ = m$ + "..2222.." + Chr$(13)
  2089.     m$ = m$ + ".....22." + Chr$(13)
  2090.     m$ = m$ + ".22222.." + Chr$(13)
  2091.     m$ = m$ + "........" + Chr$(13)
  2092.     m$ = m$ + "........" + Chr$(13)
  2093.     arrTileText(115) = m$
  2094.  
  2095.     m$ = ""
  2096.     m$ = m$ + "...22..." + Chr$(13)
  2097.     m$ = m$ + ".222222." + Chr$(13)
  2098.     m$ = m$ + "...22..." + Chr$(13)
  2099.     m$ = m$ + "...22..." + Chr$(13)
  2100.     m$ = m$ + "...22..." + Chr$(13)
  2101.     m$ = m$ + "....222." + Chr$(13)
  2102.     m$ = m$ + "........" + Chr$(13)
  2103.     m$ = m$ + "........" + Chr$(13)
  2104.     arrTileText(116) = m$
  2105.  
  2106.     m$ = ""
  2107.     m$ = m$ + "........" + Chr$(13)
  2108.     m$ = m$ + ".22..22." + Chr$(13)
  2109.     m$ = m$ + ".22..22." + Chr$(13)
  2110.     m$ = m$ + ".22..22." + Chr$(13)
  2111.     m$ = m$ + ".22..22." + Chr$(13)
  2112.     m$ = m$ + "..22222." + Chr$(13)
  2113.     m$ = m$ + "........" + Chr$(13)
  2114.     m$ = m$ + "........" + Chr$(13)
  2115.     arrTileText(117) = m$
  2116.  
  2117.     m$ = ""
  2118.     m$ = m$ + "........" + Chr$(13)
  2119.     m$ = m$ + ".22..22." + Chr$(13)
  2120.     m$ = m$ + ".22..22." + Chr$(13)
  2121.     m$ = m$ + ".22..22." + Chr$(13)
  2122.     m$ = m$ + "..2222.." + Chr$(13)
  2123.     m$ = m$ + "...22..." + Chr$(13)
  2124.     m$ = m$ + "........" + Chr$(13)
  2125.     m$ = m$ + "........" + Chr$(13)
  2126.     arrTileText(118) = m$
  2127.  
  2128.     m$ = ""
  2129.     m$ = m$ + "........" + Chr$(13)
  2130.     m$ = m$ + ".22...22" + Chr$(13)
  2131.     m$ = m$ + ".22.2.22" + Chr$(13)
  2132.     m$ = m$ + ".2222222" + Chr$(13)
  2133.     m$ = m$ + "..22222." + Chr$(13)
  2134.     m$ = m$ + "..22.22." + Chr$(13)
  2135.     m$ = m$ + "........" + Chr$(13)
  2136.     m$ = m$ + "........" + Chr$(13)
  2137.     arrTileText(119) = m$
  2138.  
  2139.     m$ = ""
  2140.     m$ = m$ + "........" + Chr$(13)
  2141.     m$ = m$ + ".22..22." + Chr$(13)
  2142.     m$ = m$ + "..2222.." + Chr$(13)
  2143.     m$ = m$ + "...22..." + Chr$(13)
  2144.     m$ = m$ + "..2222.." + Chr$(13)
  2145.     m$ = m$ + ".22..22." + Chr$(13)
  2146.     m$ = m$ + "........" + Chr$(13)
  2147.     m$ = m$ + "........" + Chr$(13)
  2148.     arrTileText(120) = m$
  2149.  
  2150.     m$ = ""
  2151.     m$ = m$ + "........" + Chr$(13)
  2152.     m$ = m$ + ".22..22." + Chr$(13)
  2153.     m$ = m$ + ".22..22." + Chr$(13)
  2154.     m$ = m$ + ".22..22." + Chr$(13)
  2155.     m$ = m$ + "..22222." + Chr$(13)
  2156.     m$ = m$ + "....22.." + Chr$(13)
  2157.     m$ = m$ + ".2222..." + Chr$(13)
  2158.     m$ = m$ + "........" + Chr$(13)
  2159.     arrTileText(121) = m$
  2160.  
  2161.     m$ = ""
  2162.     m$ = m$ + "........" + Chr$(13)
  2163.     m$ = m$ + ".222222." + Chr$(13)
  2164.     m$ = m$ + "....22.." + Chr$(13)
  2165.     m$ = m$ + "...22..." + Chr$(13)
  2166.     m$ = m$ + "..22...." + Chr$(13)
  2167.     m$ = m$ + ".222222." + Chr$(13)
  2168.     m$ = m$ + "........" + Chr$(13)
  2169.     m$ = m$ + "........" + Chr$(13)
  2170.     arrTileText(122) = m$
  2171.  
  2172.     m$ = ""
  2173.     m$ = m$ + "...222.." + Chr$(13)
  2174.     m$ = m$ + "..22...." + Chr$(13)
  2175.     m$ = m$ + "..2....." + Chr$(13)
  2176.     m$ = m$ + ".22....." + Chr$(13)
  2177.     m$ = m$ + "..2....." + Chr$(13)
  2178.     m$ = m$ + "..22...." + Chr$(13)
  2179.     m$ = m$ + "...222.." + Chr$(13)
  2180.     m$ = m$ + "........" + Chr$(13)
  2181.     arrTileText(123) = m$
  2182.  
  2183.     m$ = ""
  2184.     m$ = m$ + "....2..." + Chr$(13)
  2185.     m$ = m$ + "....2..." + Chr$(13)
  2186.     m$ = m$ + "....2..." + Chr$(13)
  2187.     m$ = m$ + "....2..." + Chr$(13)
  2188.     m$ = m$ + "....2..." + Chr$(13)
  2189.     m$ = m$ + "....2..." + Chr$(13)
  2190.     m$ = m$ + "....2..." + Chr$(13)
  2191.     m$ = m$ + "........" + Chr$(13)
  2192.     arrTileText(124) = m$
  2193.  
  2194.     m$ = ""
  2195.     m$ = m$ + "..222..." + Chr$(13)
  2196.     m$ = m$ + "....22.." + Chr$(13)
  2197.     m$ = m$ + ".....2.." + Chr$(13)
  2198.     m$ = m$ + ".....22." + Chr$(13)
  2199.     m$ = m$ + ".....2.." + Chr$(13)
  2200.     m$ = m$ + "....22.." + Chr$(13)
  2201.     m$ = m$ + "..222..." + Chr$(13)
  2202.     m$ = m$ + "........" + Chr$(13)
  2203.     arrTileText(125) = m$
  2204.  
  2205.     m$ = ""
  2206.     m$ = m$ + "........" + Chr$(13)
  2207.     m$ = m$ + ".22....2" + Chr$(13)
  2208.     m$ = m$ + "2..2..2." + Chr$(13)
  2209.     m$ = m$ + "....22.." + Chr$(13)
  2210.     m$ = m$ + "........" + Chr$(13)
  2211.     m$ = m$ + "........" + Chr$(13)
  2212.     m$ = m$ + "........" + Chr$(13)
  2213.     m$ = m$ + "........" + Chr$(13)
  2214.     arrTileText(126) = m$
  2215.  
  2216.     m$ = ""
  2217.     m$ = m$ + "........" + Chr$(13)
  2218.     m$ = m$ + "........" + Chr$(13)
  2219.     m$ = m$ + "........" + Chr$(13)
  2220.     m$ = m$ + "........" + Chr$(13)
  2221.     m$ = m$ + "........" + Chr$(13)
  2222.     m$ = m$ + "........" + Chr$(13)
  2223.     m$ = m$ + "........" + Chr$(13)
  2224.     m$ = m$ + "........" + Chr$(13)
  2225.     arrTileText(127) = m$
  2226.  
  2227.     m$ = ""
  2228.     m$ = m$ + "........" + Chr$(13)
  2229.     m$ = m$ + "........" + Chr$(13)
  2230.     m$ = m$ + "........" + Chr$(13)
  2231.     m$ = m$ + "22222222" + Chr$(13)
  2232.     m$ = m$ + "22222222" + Chr$(13)
  2233.     m$ = m$ + "........" + Chr$(13)
  2234.     m$ = m$ + "........" + Chr$(13)
  2235.     m$ = m$ + "........" + Chr$(13)
  2236.     arrTileText(128) = m$
  2237.  
  2238.     m$ = ""
  2239.     m$ = m$ + "....2..." + Chr$(13)
  2240.     m$ = m$ + "...222.." + Chr$(13)
  2241.     m$ = m$ + "..22222." + Chr$(13)
  2242.     m$ = m$ + ".2222222" + Chr$(13)
  2243.     m$ = m$ + ".2222222" + Chr$(13)
  2244.     m$ = m$ + "...222.." + Chr$(13)
  2245.     m$ = m$ + "..22222." + Chr$(13)
  2246.     m$ = m$ + "........" + Chr$(13)
  2247.     arrTileText(129) = m$
  2248.  
  2249.     m$ = ""
  2250.     m$ = m$ + "...22..." + Chr$(13)
  2251.     m$ = m$ + "...22..." + Chr$(13)
  2252.     m$ = m$ + "...22..." + Chr$(13)
  2253.     m$ = m$ + "...22..." + Chr$(13)
  2254.     m$ = m$ + "...22..." + Chr$(13)
  2255.     m$ = m$ + "...22..." + Chr$(13)
  2256.     m$ = m$ + "...22..." + Chr$(13)
  2257.     m$ = m$ + "...22..." + Chr$(13)
  2258.     arrTileText(130) = m$
  2259.  
  2260.     m$ = ""
  2261.     m$ = m$ + "........" + Chr$(13)
  2262.     m$ = m$ + "........" + Chr$(13)
  2263.     m$ = m$ + "........" + Chr$(13)
  2264.     m$ = m$ + "22222222" + Chr$(13)
  2265.     m$ = m$ + "22222222" + Chr$(13)
  2266.     m$ = m$ + "........" + Chr$(13)
  2267.     m$ = m$ + "........" + Chr$(13)
  2268.     m$ = m$ + "........" + Chr$(13)
  2269.     arrTileText(131) = m$
  2270.  
  2271.     m$ = ""
  2272.     m$ = m$ + "........" + Chr$(13)
  2273.     m$ = m$ + "........" + Chr$(13)
  2274.     m$ = m$ + "22222222" + Chr$(13)
  2275.     m$ = m$ + "22222222" + Chr$(13)
  2276.     m$ = m$ + "........" + Chr$(13)
  2277.     m$ = m$ + "........" + Chr$(13)
  2278.     m$ = m$ + "........" + Chr$(13)
  2279.     m$ = m$ + "........" + Chr$(13)
  2280.     arrTileText(132) = m$
  2281.  
  2282.     m$ = ""
  2283.     m$ = m$ + "........" + Chr$(13)
  2284.     m$ = m$ + "22222222" + Chr$(13)
  2285.     m$ = m$ + "22222222" + Chr$(13)
  2286.     m$ = m$ + "........" + Chr$(13)
  2287.     m$ = m$ + "........" + Chr$(13)
  2288.     m$ = m$ + "........" + Chr$(13)
  2289.     m$ = m$ + "........" + Chr$(13)
  2290.     m$ = m$ + "........" + Chr$(13)
  2291.     arrTileText(133) = m$
  2292.  
  2293.     m$ = ""
  2294.     m$ = m$ + "........" + Chr$(13)
  2295.     m$ = m$ + "........" + Chr$(13)
  2296.     m$ = m$ + "........" + Chr$(13)
  2297.     m$ = m$ + "........" + Chr$(13)
  2298.     m$ = m$ + "22222222" + Chr$(13)
  2299.     m$ = m$ + "22222222" + Chr$(13)
  2300.     m$ = m$ + "........" + Chr$(13)
  2301.     m$ = m$ + "........" + Chr$(13)
  2302.     arrTileText(134) = m$
  2303.  
  2304.     m$ = ""
  2305.     m$ = m$ + "..22...." + Chr$(13)
  2306.     m$ = m$ + "..22...." + Chr$(13)
  2307.     m$ = m$ + "..22...." + Chr$(13)
  2308.     m$ = m$ + "..22...." + Chr$(13)
  2309.     m$ = m$ + "..22...." + Chr$(13)
  2310.     m$ = m$ + "..22...." + Chr$(13)
  2311.     m$ = m$ + "..22...." + Chr$(13)
  2312.     m$ = m$ + "..22...." + Chr$(13)
  2313.     arrTileText(135) = m$
  2314.  
  2315.     m$ = ""
  2316.     m$ = m$ + "....22.." + Chr$(13)
  2317.     m$ = m$ + "....22.." + Chr$(13)
  2318.     m$ = m$ + "....22.." + Chr$(13)
  2319.     m$ = m$ + "....22.." + Chr$(13)
  2320.     m$ = m$ + "....22.." + Chr$(13)
  2321.     m$ = m$ + "....22.." + Chr$(13)
  2322.     m$ = m$ + "....22.." + Chr$(13)
  2323.     m$ = m$ + "....22.." + Chr$(13)
  2324.     arrTileText(136) = m$
  2325.  
  2326.     m$ = ""
  2327.     m$ = m$ + "........" + Chr$(13)
  2328.     m$ = m$ + "........" + Chr$(13)
  2329.     m$ = m$ + "........" + Chr$(13)
  2330.     m$ = m$ + "222....." + Chr$(13)
  2331.     m$ = m$ + "2222...." + Chr$(13)
  2332.     m$ = m$ + "..222..." + Chr$(13)
  2333.     m$ = m$ + "...22..." + Chr$(13)
  2334.     m$ = m$ + "...22..." + Chr$(13)
  2335.     arrTileText(137) = m$
  2336.  
  2337.     m$ = ""
  2338.     m$ = m$ + "...22..." + Chr$(13)
  2339.     m$ = m$ + "...22..." + Chr$(13)
  2340.     m$ = m$ + "...222.." + Chr$(13)
  2341.     m$ = m$ + "....2222" + Chr$(13)
  2342.     m$ = m$ + ".....222" + Chr$(13)
  2343.     m$ = m$ + "........" + Chr$(13)
  2344.     m$ = m$ + "........" + Chr$(13)
  2345.     m$ = m$ + "........" + Chr$(13)
  2346.     arrTileText(138) = m$
  2347.  
  2348.     m$ = ""
  2349.     m$ = m$ + "...22..." + Chr$(13)
  2350.     m$ = m$ + "...22..." + Chr$(13)
  2351.     m$ = m$ + "..222..." + Chr$(13)
  2352.     m$ = m$ + "2222...." + Chr$(13)
  2353.     m$ = m$ + "222....." + Chr$(13)
  2354.     m$ = m$ + "........" + Chr$(13)
  2355.     m$ = m$ + "........" + Chr$(13)
  2356.     m$ = m$ + "........" + Chr$(13)
  2357.     arrTileText(139) = m$
  2358.  
  2359.     m$ = ""
  2360.     m$ = m$ + "22......" + Chr$(13)
  2361.     m$ = m$ + "22......" + Chr$(13)
  2362.     m$ = m$ + "22......" + Chr$(13)
  2363.     m$ = m$ + "22......" + Chr$(13)
  2364.     m$ = m$ + "22......" + Chr$(13)
  2365.     m$ = m$ + "22......" + Chr$(13)
  2366.     m$ = m$ + "22222222" + Chr$(13)
  2367.     m$ = m$ + "22222222" + Chr$(13)
  2368.     arrTileText(140) = m$
  2369.  
  2370.     m$ = ""
  2371.     m$ = m$ + "22......" + Chr$(13)
  2372.     m$ = m$ + "222....." + Chr$(13)
  2373.     m$ = m$ + ".222...." + Chr$(13)
  2374.     m$ = m$ + "..222..." + Chr$(13)
  2375.     m$ = m$ + "...222.." + Chr$(13)
  2376.     m$ = m$ + "....222." + Chr$(13)
  2377.     m$ = m$ + ".....222" + Chr$(13)
  2378.     m$ = m$ + "......22" + Chr$(13)
  2379.     arrTileText(141) = m$
  2380.  
  2381.     m$ = ""
  2382.     m$ = m$ + "......22" + Chr$(13)
  2383.     m$ = m$ + ".....222" + Chr$(13)
  2384.     m$ = m$ + "....222." + Chr$(13)
  2385.     m$ = m$ + "...222.." + Chr$(13)
  2386.     m$ = m$ + "..222..." + Chr$(13)
  2387.     m$ = m$ + ".222...." + Chr$(13)
  2388.     m$ = m$ + "222....." + Chr$(13)
  2389.     m$ = m$ + "22......" + Chr$(13)
  2390.     arrTileText(142) = m$
  2391.  
  2392.     m$ = ""
  2393.     m$ = m$ + "22222222" + Chr$(13)
  2394.     m$ = m$ + "22222222" + Chr$(13)
  2395.     m$ = m$ + "22......" + Chr$(13)
  2396.     m$ = m$ + "22......" + Chr$(13)
  2397.     m$ = m$ + "22......" + Chr$(13)
  2398.     m$ = m$ + "22......" + Chr$(13)
  2399.     m$ = m$ + "22......" + Chr$(13)
  2400.     m$ = m$ + "22......" + Chr$(13)
  2401.     arrTileText(143) = m$
  2402.  
  2403.     m$ = ""
  2404.     m$ = m$ + "22222222" + Chr$(13)
  2405.     m$ = m$ + "22222222" + Chr$(13)
  2406.     m$ = m$ + "......22" + Chr$(13)
  2407.     m$ = m$ + "......22" + Chr$(13)
  2408.     m$ = m$ + "......22" + Chr$(13)
  2409.     m$ = m$ + "......22" + Chr$(13)
  2410.     m$ = m$ + "......22" + Chr$(13)
  2411.     m$ = m$ + "......22" + Chr$(13)
  2412.     arrTileText(144) = m$
  2413.  
  2414.     m$ = ""
  2415.     m$ = m$ + "........" + Chr$(13)
  2416.     m$ = m$ + "..2222.." + Chr$(13)
  2417.     m$ = m$ + ".222222." + Chr$(13)
  2418.     m$ = m$ + ".222222." + Chr$(13)
  2419.     m$ = m$ + ".222222." + Chr$(13)
  2420.     m$ = m$ + ".222222." + Chr$(13)
  2421.     m$ = m$ + "..2222.." + Chr$(13)
  2422.     m$ = m$ + "........" + Chr$(13)
  2423.     arrTileText(145) = m$
  2424.  
  2425.     m$ = ""
  2426.     m$ = m$ + "........" + Chr$(13)
  2427.     m$ = m$ + "........" + Chr$(13)
  2428.     m$ = m$ + "........" + Chr$(13)
  2429.     m$ = m$ + "........" + Chr$(13)
  2430.     m$ = m$ + "........" + Chr$(13)
  2431.     m$ = m$ + "22222222" + Chr$(13)
  2432.     m$ = m$ + "22222222" + Chr$(13)
  2433.     m$ = m$ + "........" + Chr$(13)
  2434.     arrTileText(146) = m$
  2435.  
  2436.     m$ = ""
  2437.     m$ = m$ + "..22.22." + Chr$(13)
  2438.     m$ = m$ + ".2222222" + Chr$(13)
  2439.     m$ = m$ + ".2222222" + Chr$(13)
  2440.     m$ = m$ + ".2222222" + Chr$(13)
  2441.     m$ = m$ + "..22222." + Chr$(13)
  2442.     m$ = m$ + "...222.." + Chr$(13)
  2443.     m$ = m$ + "....2..." + Chr$(13)
  2444.     m$ = m$ + "........" + Chr$(13)
  2445.     arrTileText(147) = m$
  2446.  
  2447.     m$ = ""
  2448.     m$ = m$ + ".22....." + Chr$(13)
  2449.     m$ = m$ + ".22....." + Chr$(13)
  2450.     m$ = m$ + ".22....." + Chr$(13)
  2451.     m$ = m$ + ".22....." + Chr$(13)
  2452.     m$ = m$ + ".22....." + Chr$(13)
  2453.     m$ = m$ + ".22....." + Chr$(13)
  2454.     m$ = m$ + ".22....." + Chr$(13)
  2455.     m$ = m$ + ".22....." + Chr$(13)
  2456.     arrTileText(148) = m$
  2457.  
  2458.     m$ = ""
  2459.     m$ = m$ + "........" + Chr$(13)
  2460.     m$ = m$ + "........" + Chr$(13)
  2461.     m$ = m$ + "........" + Chr$(13)
  2462.     m$ = m$ + ".....222" + Chr$(13)
  2463.     m$ = m$ + "....2222" + Chr$(13)
  2464.     m$ = m$ + "...222.." + Chr$(13)
  2465.     m$ = m$ + "...22..." + Chr$(13)
  2466.     m$ = m$ + "...22..." + Chr$(13)
  2467.     arrTileText(149) = m$
  2468.  
  2469.     m$ = ""
  2470.     m$ = m$ + "22....22" + Chr$(13)
  2471.     m$ = m$ + "222..222" + Chr$(13)
  2472.     m$ = m$ + ".222222." + Chr$(13)
  2473.     m$ = m$ + "..2222.." + Chr$(13)
  2474.     m$ = m$ + "..2222.." + Chr$(13)
  2475.     m$ = m$ + ".222222." + Chr$(13)
  2476.     m$ = m$ + "222..222" + Chr$(13)
  2477.     m$ = m$ + "22....22" + Chr$(13)
  2478.     arrTileText(150) = m$
  2479.  
  2480.     m$ = ""
  2481.     m$ = m$ + "........" + Chr$(13)
  2482.     m$ = m$ + "..2222.." + Chr$(13)
  2483.     m$ = m$ + ".222222." + Chr$(13)
  2484.     m$ = m$ + ".22..22." + Chr$(13)
  2485.     m$ = m$ + ".22..22." + Chr$(13)
  2486.     m$ = m$ + ".222222." + Chr$(13)
  2487.     m$ = m$ + "..2222.." + Chr$(13)
  2488.     m$ = m$ + "........" + Chr$(13)
  2489.     arrTileText(151) = m$
  2490.  
  2491.     m$ = ""
  2492.     m$ = m$ + "...22..." + Chr$(13)
  2493.     m$ = m$ + "...22..." + Chr$(13)
  2494.     m$ = m$ + ".22..22." + Chr$(13)
  2495.     m$ = m$ + ".22..22." + Chr$(13)
  2496.     m$ = m$ + "...22..." + Chr$(13)
  2497.     m$ = m$ + "...22..." + Chr$(13)
  2498.     m$ = m$ + "..2222.." + Chr$(13)
  2499.     m$ = m$ + "........" + Chr$(13)
  2500.     arrTileText(152) = m$
  2501.  
  2502.     m$ = ""
  2503.     m$ = m$ + ".....22." + Chr$(13)
  2504.     m$ = m$ + ".....22." + Chr$(13)
  2505.     m$ = m$ + ".....22." + Chr$(13)
  2506.     m$ = m$ + ".....22." + Chr$(13)
  2507.     m$ = m$ + ".....22." + Chr$(13)
  2508.     m$ = m$ + ".....22." + Chr$(13)
  2509.     m$ = m$ + ".....22." + Chr$(13)
  2510.     m$ = m$ + ".....22." + Chr$(13)
  2511.     arrTileText(153) = m$
  2512.  
  2513.     m$ = ""
  2514.     m$ = m$ + "....2..." + Chr$(13)
  2515.     m$ = m$ + "...222.." + Chr$(13)
  2516.     m$ = m$ + "..22222." + Chr$(13)
  2517.     m$ = m$ + ".2222222" + Chr$(13)
  2518.     m$ = m$ + "..22222." + Chr$(13)
  2519.     m$ = m$ + "...222.." + Chr$(13)
  2520.     m$ = m$ + "....2..." + Chr$(13)
  2521.     m$ = m$ + "........" + Chr$(13)
  2522.     arrTileText(154) = m$
  2523.  
  2524.     m$ = ""
  2525.     m$ = m$ + "...22..." + Chr$(13)
  2526.     m$ = m$ + "...22..." + Chr$(13)
  2527.     m$ = m$ + "...22..." + Chr$(13)
  2528.     m$ = m$ + "22222222" + Chr$(13)
  2529.     m$ = m$ + "22222222" + Chr$(13)
  2530.     m$ = m$ + "...22..." + Chr$(13)
  2531.     m$ = m$ + "...22..." + Chr$(13)
  2532.     m$ = m$ + "...22..." + Chr$(13)
  2533.     arrTileText(155) = m$
  2534.  
  2535.     m$ = ""
  2536.     m$ = m$ + "22......" + Chr$(13)
  2537.     m$ = m$ + "22......" + Chr$(13)
  2538.     m$ = m$ + "..22...." + Chr$(13)
  2539.     m$ = m$ + "..22...." + Chr$(13)
  2540.     m$ = m$ + "22......" + Chr$(13)
  2541.     m$ = m$ + "22......" + Chr$(13)
  2542.     m$ = m$ + "..22...." + Chr$(13)
  2543.     m$ = m$ + "..22...." + Chr$(13)
  2544.     arrTileText(156) = m$
  2545.  
  2546.     m$ = ""
  2547.     m$ = m$ + "...22..." + Chr$(13)
  2548.     m$ = m$ + "...22..." + Chr$(13)
  2549.     m$ = m$ + "...22..." + Chr$(13)
  2550.     m$ = m$ + "...22..." + Chr$(13)
  2551.     m$ = m$ + "...22..." + Chr$(13)
  2552.     m$ = m$ + "...22..." + Chr$(13)
  2553.     m$ = m$ + "...22..." + Chr$(13)
  2554.     m$ = m$ + "...22..." + Chr$(13)
  2555.     arrTileText(157) = m$
  2556.  
  2557.     m$ = ""
  2558.     m$ = m$ + "........" + Chr$(13)
  2559.     m$ = m$ + "........" + Chr$(13)
  2560.     m$ = m$ + "......22" + Chr$(13)
  2561.     m$ = m$ + "..22222." + Chr$(13)
  2562.     m$ = m$ + ".222.22." + Chr$(13)
  2563.     m$ = m$ + "..22.22." + Chr$(13)
  2564.     m$ = m$ + "..22.22." + Chr$(13)
  2565.     m$ = m$ + "........" + Chr$(13)
  2566.     arrTileText(158) = m$
  2567.  
  2568.     m$ = ""
  2569.     m$ = m$ + "22222222" + Chr$(13)
  2570.     m$ = m$ + ".2222222" + Chr$(13)
  2571.     m$ = m$ + "..222222" + Chr$(13)
  2572.     m$ = m$ + "...22222" + Chr$(13)
  2573.     m$ = m$ + "....2222" + Chr$(13)
  2574.     m$ = m$ + ".....222" + Chr$(13)
  2575.     m$ = m$ + "......22" + Chr$(13)
  2576.     m$ = m$ + ".......2" + Chr$(13)
  2577.     arrTileText(159) = m$
  2578.  
  2579.     m$ = ""
  2580.     m$ = m$ + "........" + Chr$(13)
  2581.     m$ = m$ + "........" + Chr$(13)
  2582.     m$ = m$ + "........" + Chr$(13)
  2583.     m$ = m$ + "........" + Chr$(13)
  2584.     m$ = m$ + "........" + Chr$(13)
  2585.     m$ = m$ + "........" + Chr$(13)
  2586.     m$ = m$ + "........" + Chr$(13)
  2587.     m$ = m$ + "........" + Chr$(13)
  2588.     arrTileText(160) = m$
  2589.  
  2590.     m$ = ""
  2591.     m$ = m$ + "2222...." + Chr$(13)
  2592.     m$ = m$ + "2222...." + Chr$(13)
  2593.     m$ = m$ + "2222...." + Chr$(13)
  2594.     m$ = m$ + "2222...." + Chr$(13)
  2595.     m$ = m$ + "2222...." + Chr$(13)
  2596.     m$ = m$ + "2222...." + Chr$(13)
  2597.     m$ = m$ + "2222...." + Chr$(13)
  2598.     m$ = m$ + "2222...." + Chr$(13)
  2599.     arrTileText(161) = m$
  2600.  
  2601.     m$ = ""
  2602.     m$ = m$ + "........" + Chr$(13)
  2603.     m$ = m$ + "........" + Chr$(13)
  2604.     m$ = m$ + "........" + Chr$(13)
  2605.     m$ = m$ + "........" + Chr$(13)
  2606.     m$ = m$ + "22222222" + Chr$(13)
  2607.     m$ = m$ + "22222222" + Chr$(13)
  2608.     m$ = m$ + "22222222" + Chr$(13)
  2609.     m$ = m$ + "22222222" + Chr$(13)
  2610.     arrTileText(162) = m$
  2611.  
  2612.     m$ = ""
  2613.     m$ = m$ + "22222222" + Chr$(13)
  2614.     m$ = m$ + "........" + Chr$(13)
  2615.     m$ = m$ + "........" + Chr$(13)
  2616.     m$ = m$ + "........" + Chr$(13)
  2617.     m$ = m$ + "........" + Chr$(13)
  2618.     m$ = m$ + "........" + Chr$(13)
  2619.     m$ = m$ + "........" + Chr$(13)
  2620.     m$ = m$ + "........" + Chr$(13)
  2621.     arrTileText(163) = m$
  2622.  
  2623.     m$ = ""
  2624.     m$ = m$ + "........" + Chr$(13)
  2625.     m$ = m$ + "........" + Chr$(13)
  2626.     m$ = m$ + "........" + Chr$(13)
  2627.     m$ = m$ + "........" + Chr$(13)
  2628.     m$ = m$ + "........" + Chr$(13)
  2629.     m$ = m$ + "........" + Chr$(13)
  2630.     m$ = m$ + "........" + Chr$(13)
  2631.     m$ = m$ + "22222222" + Chr$(13)
  2632.     arrTileText(164) = m$
  2633.  
  2634.     m$ = ""
  2635.     m$ = m$ + "22......" + Chr$(13)
  2636.     m$ = m$ + "22......" + Chr$(13)
  2637.     m$ = m$ + "22......" + Chr$(13)
  2638.     m$ = m$ + "22......" + Chr$(13)
  2639.     m$ = m$ + "22......" + Chr$(13)
  2640.     m$ = m$ + "22......" + Chr$(13)
  2641.     m$ = m$ + "22......" + Chr$(13)
  2642.     m$ = m$ + "22......" + Chr$(13)
  2643.     arrTileText(165) = m$
  2644.  
  2645.     m$ = ""
  2646.     m$ = m$ + "22..22.." + Chr$(13)
  2647.     m$ = m$ + "22..22.." + Chr$(13)
  2648.     m$ = m$ + "..22..22" + Chr$(13)
  2649.     m$ = m$ + "..22..22" + Chr$(13)
  2650.     m$ = m$ + "22..22.." + Chr$(13)
  2651.     m$ = m$ + "22..22.." + Chr$(13)
  2652.     m$ = m$ + "..22..22" + Chr$(13)
  2653.     m$ = m$ + "..22..22" + Chr$(13)
  2654.     arrTileText(166) = m$
  2655.  
  2656.     m$ = ""
  2657.     m$ = m$ + "......22" + Chr$(13)
  2658.     m$ = m$ + "......22" + Chr$(13)
  2659.     m$ = m$ + "......22" + Chr$(13)
  2660.     m$ = m$ + "......22" + Chr$(13)
  2661.     m$ = m$ + "......22" + Chr$(13)
  2662.     m$ = m$ + "......22" + Chr$(13)
  2663.     m$ = m$ + "......22" + Chr$(13)
  2664.     m$ = m$ + "......22" + Chr$(13)
  2665.     arrTileText(167) = m$
  2666.  
  2667.     m$ = ""
  2668.     m$ = m$ + "........" + Chr$(13)
  2669.     m$ = m$ + "........" + Chr$(13)
  2670.     m$ = m$ + "........" + Chr$(13)
  2671.     m$ = m$ + "........" + Chr$(13)
  2672.     m$ = m$ + "22..22.." + Chr$(13)
  2673.     m$ = m$ + "22..22.." + Chr$(13)
  2674.     m$ = m$ + "..22..22" + Chr$(13)
  2675.     m$ = m$ + "..22..22" + Chr$(13)
  2676.     arrTileText(168) = m$
  2677.  
  2678.     m$ = ""
  2679.     m$ = m$ + "22222222" + Chr$(13)
  2680.     m$ = m$ + "2222222." + Chr$(13)
  2681.     m$ = m$ + "222222.." + Chr$(13)
  2682.     m$ = m$ + "22222..." + Chr$(13)
  2683.     m$ = m$ + "2222...." + Chr$(13)
  2684.     m$ = m$ + "222....." + Chr$(13)
  2685.     m$ = m$ + "22......" + Chr$(13)
  2686.     m$ = m$ + "2......." + Chr$(13)
  2687.     arrTileText(169) = m$
  2688.  
  2689.     m$ = ""
  2690.     m$ = m$ + "......22" + Chr$(13)
  2691.     m$ = m$ + "......22" + Chr$(13)
  2692.     m$ = m$ + "......22" + Chr$(13)
  2693.     m$ = m$ + "......22" + Chr$(13)
  2694.     m$ = m$ + "......22" + Chr$(13)
  2695.     m$ = m$ + "......22" + Chr$(13)
  2696.     m$ = m$ + "......22" + Chr$(13)
  2697.     m$ = m$ + "......22" + Chr$(13)
  2698.     arrTileText(170) = m$
  2699.  
  2700.     m$ = ""
  2701.     m$ = m$ + "...22..." + Chr$(13)
  2702.     m$ = m$ + "...22..." + Chr$(13)
  2703.     m$ = m$ + "...22..." + Chr$(13)
  2704.     m$ = m$ + "...22222" + Chr$(13)
  2705.     m$ = m$ + "...22222" + Chr$(13)
  2706.     m$ = m$ + "...22..." + Chr$(13)
  2707.     m$ = m$ + "...22..." + Chr$(13)
  2708.     m$ = m$ + "...22..." + Chr$(13)
  2709.     arrTileText(171) = m$
  2710.  
  2711.     m$ = ""
  2712.     m$ = m$ + "........" + Chr$(13)
  2713.     m$ = m$ + "........" + Chr$(13)
  2714.     m$ = m$ + "........" + Chr$(13)
  2715.     m$ = m$ + "........" + Chr$(13)
  2716.     m$ = m$ + "....2222" + Chr$(13)
  2717.     m$ = m$ + "....2222" + Chr$(13)
  2718.     m$ = m$ + "....2222" + Chr$(13)
  2719.     m$ = m$ + "....2222" + Chr$(13)
  2720.     arrTileText(172) = m$
  2721.  
  2722.     m$ = ""
  2723.     m$ = m$ + "...22..." + Chr$(13)
  2724.     m$ = m$ + "...22..." + Chr$(13)
  2725.     m$ = m$ + "...22..." + Chr$(13)
  2726.     m$ = m$ + "...22222" + Chr$(13)
  2727.     m$ = m$ + "...22222" + Chr$(13)
  2728.     m$ = m$ + "........" + Chr$(13)
  2729.     m$ = m$ + "........" + Chr$(13)
  2730.     m$ = m$ + "........" + Chr$(13)
  2731.     arrTileText(173) = m$
  2732.  
  2733.     m$ = ""
  2734.     m$ = m$ + "........" + Chr$(13)
  2735.     m$ = m$ + "........" + Chr$(13)
  2736.     m$ = m$ + "........" + Chr$(13)
  2737.     m$ = m$ + "22222..." + Chr$(13)
  2738.     m$ = m$ + "22222..." + Chr$(13)
  2739.     m$ = m$ + "...22..." + Chr$(13)
  2740.     m$ = m$ + "...22..." + Chr$(13)
  2741.     m$ = m$ + "...22..." + Chr$(13)
  2742.     arrTileText(174) = m$
  2743.  
  2744.     m$ = ""
  2745.     m$ = m$ + "........" + Chr$(13)
  2746.     m$ = m$ + "........" + Chr$(13)
  2747.     m$ = m$ + "........" + Chr$(13)
  2748.     m$ = m$ + "........" + Chr$(13)
  2749.     m$ = m$ + "........" + Chr$(13)
  2750.     m$ = m$ + "........" + Chr$(13)
  2751.     m$ = m$ + "22222222" + Chr$(13)
  2752.     m$ = m$ + "22222222" + Chr$(13)
  2753.     arrTileText(175) = m$
  2754.  
  2755.     m$ = ""
  2756.     m$ = m$ + "........" + Chr$(13)
  2757.     m$ = m$ + "........" + Chr$(13)
  2758.     m$ = m$ + "........" + Chr$(13)
  2759.     m$ = m$ + "...22222" + Chr$(13)
  2760.     m$ = m$ + "...22222" + Chr$(13)
  2761.     m$ = m$ + "...22..." + Chr$(13)
  2762.     m$ = m$ + "...22..." + Chr$(13)
  2763.     m$ = m$ + "...22..." + Chr$(13)
  2764.     arrTileText(176) = m$
  2765.  
  2766.     m$ = ""
  2767.     m$ = m$ + "...22..." + Chr$(13)
  2768.     m$ = m$ + "...22..." + Chr$(13)
  2769.     m$ = m$ + "...22..." + Chr$(13)
  2770.     m$ = m$ + "22222222" + Chr$(13)
  2771.     m$ = m$ + "22222222" + Chr$(13)
  2772.     m$ = m$ + "........" + Chr$(13)
  2773.     m$ = m$ + "........" + Chr$(13)
  2774.     m$ = m$ + "........" + Chr$(13)
  2775.     arrTileText(177) = m$
  2776.  
  2777.     m$ = ""
  2778.     m$ = m$ + "........" + Chr$(13)
  2779.     m$ = m$ + "........" + Chr$(13)
  2780.     m$ = m$ + "........" + Chr$(13)
  2781.     m$ = m$ + "22222222" + Chr$(13)
  2782.     m$ = m$ + "22222222" + Chr$(13)
  2783.     m$ = m$ + "...22..." + Chr$(13)
  2784.     m$ = m$ + "...22..." + Chr$(13)
  2785.     m$ = m$ + "...22..." + Chr$(13)
  2786.     arrTileText(178) = m$
  2787.  
  2788.     m$ = ""
  2789.     m$ = m$ + "...22..." + Chr$(13)
  2790.     m$ = m$ + "...22..." + Chr$(13)
  2791.     m$ = m$ + "...22..." + Chr$(13)
  2792.     m$ = m$ + "22222..." + Chr$(13)
  2793.     m$ = m$ + "22222..." + Chr$(13)
  2794.     m$ = m$ + "...22..." + Chr$(13)
  2795.     m$ = m$ + "...22..." + Chr$(13)
  2796.     m$ = m$ + "...22..." + Chr$(13)
  2797.     arrTileText(179) = m$
  2798.  
  2799.     m$ = ""
  2800.     m$ = m$ + "22......" + Chr$(13)
  2801.     m$ = m$ + "22......" + Chr$(13)
  2802.     m$ = m$ + "22......" + Chr$(13)
  2803.     m$ = m$ + "22......" + Chr$(13)
  2804.     m$ = m$ + "22......" + Chr$(13)
  2805.     m$ = m$ + "22......" + Chr$(13)
  2806.     m$ = m$ + "22......" + Chr$(13)
  2807.     m$ = m$ + "22......" + Chr$(13)
  2808.     arrTileText(180) = m$
  2809.  
  2810.     m$ = ""
  2811.     m$ = m$ + "222....." + Chr$(13)
  2812.     m$ = m$ + "222....." + Chr$(13)
  2813.     m$ = m$ + "222....." + Chr$(13)
  2814.     m$ = m$ + "222....." + Chr$(13)
  2815.     m$ = m$ + "222....." + Chr$(13)
  2816.     m$ = m$ + "222....." + Chr$(13)
  2817.     m$ = m$ + "222....." + Chr$(13)
  2818.     m$ = m$ + "222....." + Chr$(13)
  2819.     arrTileText(181) = m$
  2820.  
  2821.     m$ = ""
  2822.     m$ = m$ + ".....222" + Chr$(13)
  2823.     m$ = m$ + ".....222" + Chr$(13)
  2824.     m$ = m$ + ".....222" + Chr$(13)
  2825.     m$ = m$ + ".....222" + Chr$(13)
  2826.     m$ = m$ + ".....222" + Chr$(13)
  2827.     m$ = m$ + ".....222" + Chr$(13)
  2828.     m$ = m$ + ".....222" + Chr$(13)
  2829.     m$ = m$ + ".....222" + Chr$(13)
  2830.     arrTileText(182) = m$
  2831.  
  2832.     m$ = ""
  2833.     m$ = m$ + "22222222" + Chr$(13)
  2834.     m$ = m$ + "22222222" + Chr$(13)
  2835.     m$ = m$ + "........" + Chr$(13)
  2836.     m$ = m$ + "........" + Chr$(13)
  2837.     m$ = m$ + "........" + Chr$(13)
  2838.     m$ = m$ + "........" + Chr$(13)
  2839.     m$ = m$ + "........" + Chr$(13)
  2840.     m$ = m$ + "........" + Chr$(13)
  2841.     arrTileText(183) = m$
  2842.  
  2843.     m$ = ""
  2844.     m$ = m$ + "22222222" + Chr$(13)
  2845.     m$ = m$ + "22222222" + Chr$(13)
  2846.     m$ = m$ + "22222222" + Chr$(13)
  2847.     m$ = m$ + "........" + Chr$(13)
  2848.     m$ = m$ + "........" + Chr$(13)
  2849.     m$ = m$ + "........" + Chr$(13)
  2850.     m$ = m$ + "........" + Chr$(13)
  2851.     m$ = m$ + "........" + Chr$(13)
  2852.     arrTileText(184) = m$
  2853.  
  2854.     m$ = ""
  2855.     m$ = m$ + "........" + Chr$(13)
  2856.     m$ = m$ + "........" + Chr$(13)
  2857.     m$ = m$ + "........" + Chr$(13)
  2858.     m$ = m$ + "........" + Chr$(13)
  2859.     m$ = m$ + "........" + Chr$(13)
  2860.     m$ = m$ + "22222222" + Chr$(13)
  2861.     m$ = m$ + "22222222" + Chr$(13)
  2862.     m$ = m$ + "22222222" + Chr$(13)
  2863.     arrTileText(185) = m$
  2864.  
  2865.     m$ = ""
  2866.     m$ = m$ + "......22" + Chr$(13)
  2867.     m$ = m$ + "......22" + Chr$(13)
  2868.     m$ = m$ + "......22" + Chr$(13)
  2869.     m$ = m$ + "......22" + Chr$(13)
  2870.     m$ = m$ + "......22" + Chr$(13)
  2871.     m$ = m$ + "......22" + Chr$(13)
  2872.     m$ = m$ + "22222222" + Chr$(13)
  2873.     m$ = m$ + "22222222" + Chr$(13)
  2874.     arrTileText(186) = m$
  2875.  
  2876.     m$ = ""
  2877.     m$ = m$ + "........" + Chr$(13)
  2878.     m$ = m$ + "........" + Chr$(13)
  2879.     m$ = m$ + "........" + Chr$(13)
  2880.     m$ = m$ + "........" + Chr$(13)
  2881.     m$ = m$ + "2222...." + Chr$(13)
  2882.     m$ = m$ + "2222...." + Chr$(13)
  2883.     m$ = m$ + "2222...." + Chr$(13)
  2884.     m$ = m$ + "2222...." + Chr$(13)
  2885.     arrTileText(187) = m$
  2886.  
  2887.     m$ = ""
  2888.     m$ = m$ + "....2222" + Chr$(13)
  2889.     m$ = m$ + "....2222" + Chr$(13)
  2890.     m$ = m$ + "....2222" + Chr$(13)
  2891.     m$ = m$ + "....2222" + Chr$(13)
  2892.     m$ = m$ + "........" + Chr$(13)
  2893.     m$ = m$ + "........" + Chr$(13)
  2894.     m$ = m$ + "........" + Chr$(13)
  2895.     m$ = m$ + "........" + Chr$(13)
  2896.     arrTileText(188) = m$
  2897.  
  2898.     m$ = ""
  2899.     m$ = m$ + "...22..." + Chr$(13)
  2900.     m$ = m$ + "...22..." + Chr$(13)
  2901.     m$ = m$ + "...22..." + Chr$(13)
  2902.     m$ = m$ + "22222..." + Chr$(13)
  2903.     m$ = m$ + "22222..." + Chr$(13)
  2904.     m$ = m$ + "........" + Chr$(13)
  2905.     m$ = m$ + "........" + Chr$(13)
  2906.     m$ = m$ + "........" + Chr$(13)
  2907.     arrTileText(189) = m$
  2908.  
  2909.     m$ = ""
  2910.     m$ = m$ + "2222...." + Chr$(13)
  2911.     m$ = m$ + "2222...." + Chr$(13)
  2912.     m$ = m$ + "2222...." + Chr$(13)
  2913.     m$ = m$ + "2222...." + Chr$(13)
  2914.     m$ = m$ + "........" + Chr$(13)
  2915.     m$ = m$ + "........" + Chr$(13)
  2916.     m$ = m$ + "........" + Chr$(13)
  2917.     m$ = m$ + "........" + Chr$(13)
  2918.     arrTileText(190) = m$
  2919.  
  2920.     m$ = ""
  2921.     m$ = m$ + "2222...." + Chr$(13)
  2922.     m$ = m$ + "2222...." + Chr$(13)
  2923.     m$ = m$ + "2222...." + Chr$(13)
  2924.     m$ = m$ + "2222...." + Chr$(13)
  2925.     m$ = m$ + "....2222" + Chr$(13)
  2926.     m$ = m$ + "....2222" + Chr$(13)
  2927.     m$ = m$ + "....2222" + Chr$(13)
  2928.     m$ = m$ + "....2222" + Chr$(13)
  2929.     arrTileText(191) = m$
  2930.  
  2931.     m$ = ""
  2932.     m$ = m$ + "........" + Chr$(13)
  2933.     m$ = m$ + ".2222222" + Chr$(13)
  2934.     m$ = m$ + ".2.....2" + Chr$(13)
  2935.     m$ = m$ + ".2.....2" + Chr$(13)
  2936.     m$ = m$ + ".2.....2" + Chr$(13)
  2937.     m$ = m$ + ".2.....2" + Chr$(13)
  2938.     m$ = m$ + ".2.....2" + Chr$(13)
  2939.     m$ = m$ + ".2222222" + Chr$(13)
  2940.     arrTileText(192) = m$
  2941.  
  2942.     m$ = ""
  2943.     m$ = m$ + "........" + Chr$(13)
  2944.     m$ = m$ + ".2222222" + Chr$(13)
  2945.     m$ = m$ + ".2222222" + Chr$(13)
  2946.     m$ = m$ + ".2222222" + Chr$(13)
  2947.     m$ = m$ + ".2222222" + Chr$(13)
  2948.     m$ = m$ + ".2222222" + Chr$(13)
  2949.     m$ = m$ + ".2222222" + Chr$(13)
  2950.     m$ = m$ + ".2222222" + Chr$(13)
  2951.     arrTileText(193) = m$
  2952.  
  2953.     m$ = ""
  2954.     m$ = m$ + "........" + Chr$(13)
  2955.     m$ = m$ + "...22..." + Chr$(13)
  2956.     m$ = m$ + "..2222.." + Chr$(13)
  2957.     m$ = m$ + ".222222." + Chr$(13)
  2958.     m$ = m$ + "...22..." + Chr$(13)
  2959.     m$ = m$ + "...22..." + Chr$(13)
  2960.     m$ = m$ + "...22..." + Chr$(13)
  2961.     m$ = m$ + "...22..." + Chr$(13)
  2962.     arrTileText(194) = m$
  2963.  
  2964.     m$ = ""
  2965.     m$ = m$ + "........" + Chr$(13)
  2966.     m$ = m$ + "...22..." + Chr$(13)
  2967.     m$ = m$ + "...22..." + Chr$(13)
  2968.     m$ = m$ + "...22..." + Chr$(13)
  2969.     m$ = m$ + "...22..." + Chr$(13)
  2970.     m$ = m$ + ".222222." + Chr$(13)
  2971.     m$ = m$ + "..2222.." + Chr$(13)
  2972.     m$ = m$ + "...22..." + Chr$(13)
  2973.     arrTileText(195) = m$
  2974.  
  2975.     m$ = ""
  2976.     m$ = m$ + "........" + Chr$(13)
  2977.     m$ = m$ + "...2...." + Chr$(13)
  2978.     m$ = m$ + "..22...." + Chr$(13)
  2979.     m$ = m$ + ".2222222" + Chr$(13)
  2980.     m$ = m$ + ".2222222" + Chr$(13)
  2981.     m$ = m$ + "..22...." + Chr$(13)
  2982.     m$ = m$ + "...2...." + Chr$(13)
  2983.     m$ = m$ + "........" + Chr$(13)
  2984.     arrTileText(196) = m$
  2985.  
  2986.     m$ = ""
  2987.     m$ = m$ + "........" + Chr$(13)
  2988.     m$ = m$ + ".....2.." + Chr$(13)
  2989.     m$ = m$ + ".....22." + Chr$(13)
  2990.     m$ = m$ + ".2222222" + Chr$(13)
  2991.     m$ = m$ + ".2222222" + Chr$(13)
  2992.     m$ = m$ + ".....22." + Chr$(13)
  2993.     m$ = m$ + ".....2.." + Chr$(13)
  2994.     m$ = m$ + "........" + Chr$(13)
  2995.     arrTileText(197) = m$
  2996.  
  2997.     m$ = ""
  2998.     m$ = m$ + "........" + Chr$(13)
  2999.     m$ = m$ + "........" + Chr$(13)
  3000.     m$ = m$ + "........" + Chr$(13)
  3001.     m$ = m$ + "........" + Chr$(13)
  3002.     m$ = m$ + "........" + Chr$(13)
  3003.     m$ = m$ + "........" + Chr$(13)
  3004.     m$ = m$ + "........" + Chr$(13)
  3005.     m$ = m$ + "........" + Chr$(13)
  3006.     arrTileText(198) = m$
  3007.  
  3008.     m$ = ""
  3009.     m$ = m$ + ".222222." + Chr$(13)
  3010.     m$ = m$ + "2......2" + Chr$(13)
  3011.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3012.     m$ = m$ + "2......2" + Chr$(13)
  3013.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3014.     m$ = m$ + "2.2222.2" + Chr$(13)
  3015.     m$ = m$ + "2......2" + Chr$(13)
  3016.     m$ = m$ + ".222222." + Chr$(13)
  3017.     arrTileText(199) = m$
  3018.  
  3019.     m$ = ""
  3020.     m$ = m$ + ".222222." + Chr$(13)
  3021.     m$ = m$ + "2......2" + Chr$(13)
  3022.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3023.     m$ = m$ + "2......2" + Chr$(13)
  3024.     m$ = m$ + "2.2222.2" + Chr$(13)
  3025.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3026.     m$ = m$ + "2......2" + Chr$(13)
  3027.     m$ = m$ + ".222222." + Chr$(13)
  3028.     arrTileText(200) = m$
  3029.  
  3030.     m$ = ""
  3031.     m$ = m$ + "........" + Chr$(13)
  3032.     m$ = m$ + "........" + Chr$(13)
  3033.     m$ = m$ + "........" + Chr$(13)
  3034.     m$ = m$ + "........" + Chr$(13)
  3035.     m$ = m$ + "........" + Chr$(13)
  3036.     m$ = m$ + "........" + Chr$(13)
  3037.     m$ = m$ + "........" + Chr$(13)
  3038.     m$ = m$ + "........" + Chr$(13)
  3039.     arrTileText(201) = m$
  3040.  
  3041.     m$ = ""
  3042.     m$ = m$ + ".222222." + Chr$(13)
  3043.     m$ = m$ + ".....22." + Chr$(13)
  3044.     m$ = m$ + "....22.." + Chr$(13)
  3045.     m$ = m$ + "...22..." + Chr$(13)
  3046.     m$ = m$ + "..22...." + Chr$(13)
  3047.     m$ = m$ + ".22....." + Chr$(13)
  3048.     m$ = m$ + ".222222." + Chr$(13)
  3049.     m$ = m$ + "........" + Chr$(13)
  3050.     arrTileText(202) = m$
  3051.  
  3052.     m$ = ""
  3053.     m$ = m$ + "...22..." + Chr$(13)
  3054.     m$ = m$ + "...22..." + Chr$(13)
  3055.     m$ = m$ + "...22..." + Chr$(13)
  3056.     m$ = m$ + "22222222" + Chr$(13)
  3057.     m$ = m$ + "22222222" + Chr$(13)
  3058.     m$ = m$ + "...22..." + Chr$(13)
  3059.     m$ = m$ + "...22..." + Chr$(13)
  3060.     m$ = m$ + "...22..." + Chr$(13)
  3061.     arrTileText(203) = m$
  3062.  
  3063.     m$ = ""
  3064.     m$ = m$ + "22......" + Chr$(13)
  3065.     m$ = m$ + "22......" + Chr$(13)
  3066.     m$ = m$ + "..22...." + Chr$(13)
  3067.     m$ = m$ + "..22...." + Chr$(13)
  3068.     m$ = m$ + "22......" + Chr$(13)
  3069.     m$ = m$ + "22......" + Chr$(13)
  3070.     m$ = m$ + "..22...." + Chr$(13)
  3071.     m$ = m$ + "..22...." + Chr$(13)
  3072.     arrTileText(204) = m$
  3073.  
  3074.     m$ = ""
  3075.     m$ = m$ + "...22..." + Chr$(13)
  3076.     m$ = m$ + "...22..." + Chr$(13)
  3077.     m$ = m$ + "...22..." + Chr$(13)
  3078.     m$ = m$ + "...22..." + Chr$(13)
  3079.     m$ = m$ + "...22..." + Chr$(13)
  3080.     m$ = m$ + "...22..." + Chr$(13)
  3081.     m$ = m$ + "...22..." + Chr$(13)
  3082.     m$ = m$ + "...22..." + Chr$(13)
  3083.     arrTileText(205) = m$
  3084.  
  3085.     m$ = ""
  3086.     m$ = m$ + "..22..22" + Chr$(13)
  3087.     m$ = m$ + "..22..22" + Chr$(13)
  3088.     m$ = m$ + "22..22.." + Chr$(13)
  3089.     m$ = m$ + "22..22.." + Chr$(13)
  3090.     m$ = m$ + "..22..22" + Chr$(13)
  3091.     m$ = m$ + "..22..22" + Chr$(13)
  3092.     m$ = m$ + "22..22.." + Chr$(13)
  3093.     m$ = m$ + "22..22.." + Chr$(13)
  3094.     arrTileText(206) = m$
  3095.  
  3096.     m$ = ""
  3097.     m$ = m$ + "..22..22" + Chr$(13)
  3098.     m$ = m$ + "2..22..2" + Chr$(13)
  3099.     m$ = m$ + "22..22.." + Chr$(13)
  3100.     m$ = m$ + ".22..22." + Chr$(13)
  3101.     m$ = m$ + "..22..22" + Chr$(13)
  3102.     m$ = m$ + "2..22..2" + Chr$(13)
  3103.     m$ = m$ + "22..22.." + Chr$(13)
  3104.     m$ = m$ + ".22..22." + Chr$(13)
  3105.     arrTileText(207) = m$
  3106.  
  3107.     m$ = ""
  3108.     m$ = m$ + "........" + Chr$(13)
  3109.     m$ = m$ + "........" + Chr$(13)
  3110.     m$ = m$ + "........" + Chr$(13)
  3111.     m$ = m$ + "........" + Chr$(13)
  3112.     m$ = m$ + "........" + Chr$(13)
  3113.     m$ = m$ + "........" + Chr$(13)
  3114.     m$ = m$ + "........" + Chr$(13)
  3115.     m$ = m$ + "........" + Chr$(13)
  3116.     arrTileText(208) = m$
  3117.  
  3118.     m$ = ""
  3119.     m$ = m$ + "2222...." + Chr$(13)
  3120.     m$ = m$ + "2222...." + Chr$(13)
  3121.     m$ = m$ + "2222...." + Chr$(13)
  3122.     m$ = m$ + "2222...." + Chr$(13)
  3123.     m$ = m$ + "2222...." + Chr$(13)
  3124.     m$ = m$ + "2222...." + Chr$(13)
  3125.     m$ = m$ + "2222...." + Chr$(13)
  3126.     m$ = m$ + "2222...." + Chr$(13)
  3127.     arrTileText(209) = m$
  3128.  
  3129.     m$ = ""
  3130.     m$ = m$ + "........" + Chr$(13)
  3131.     m$ = m$ + "........" + Chr$(13)
  3132.     m$ = m$ + "........" + Chr$(13)
  3133.     m$ = m$ + "........" + Chr$(13)
  3134.     m$ = m$ + "22222222" + Chr$(13)
  3135.     m$ = m$ + "22222222" + Chr$(13)
  3136.     m$ = m$ + "22222222" + Chr$(13)
  3137.     m$ = m$ + "22222222" + Chr$(13)
  3138.     arrTileText(210) = m$
  3139.  
  3140.     m$ = ""
  3141.     m$ = m$ + "22222222" + Chr$(13)
  3142.     m$ = m$ + "........" + Chr$(13)
  3143.     m$ = m$ + "........" + Chr$(13)
  3144.     m$ = m$ + "........" + Chr$(13)
  3145.     m$ = m$ + "........" + Chr$(13)
  3146.     m$ = m$ + "........" + Chr$(13)
  3147.     m$ = m$ + "........" + Chr$(13)
  3148.     m$ = m$ + "........" + Chr$(13)
  3149.     arrTileText(211) = m$
  3150.  
  3151.     m$ = ""
  3152.     m$ = m$ + "........" + Chr$(13)
  3153.     m$ = m$ + "........" + Chr$(13)
  3154.     m$ = m$ + "........" + Chr$(13)
  3155.     m$ = m$ + "........" + Chr$(13)
  3156.     m$ = m$ + "........" + Chr$(13)
  3157.     m$ = m$ + "........" + Chr$(13)
  3158.     m$ = m$ + "........" + Chr$(13)
  3159.     m$ = m$ + "22222222" + Chr$(13)
  3160.     arrTileText(212) = m$
  3161.  
  3162.     m$ = ""
  3163.     m$ = m$ + "22......" + Chr$(13)
  3164.     m$ = m$ + "22......" + Chr$(13)
  3165.     m$ = m$ + "22......" + Chr$(13)
  3166.     m$ = m$ + "22......" + Chr$(13)
  3167.     m$ = m$ + "22......" + Chr$(13)
  3168.     m$ = m$ + "22......" + Chr$(13)
  3169.     m$ = m$ + "22......" + Chr$(13)
  3170.     m$ = m$ + "22......" + Chr$(13)
  3171.     arrTileText(213) = m$
  3172.  
  3173.     m$ = ""
  3174.     m$ = m$ + "22..22.." + Chr$(13)
  3175.     m$ = m$ + "22..22.." + Chr$(13)
  3176.     m$ = m$ + "..22..22" + Chr$(13)
  3177.     m$ = m$ + "..22..22" + Chr$(13)
  3178.     m$ = m$ + "22..22.." + Chr$(13)
  3179.     m$ = m$ + "22..22.." + Chr$(13)
  3180.     m$ = m$ + "..22..22" + Chr$(13)
  3181.     m$ = m$ + "..22..22" + Chr$(13)
  3182.     arrTileText(214) = m$
  3183.  
  3184.     m$ = ""
  3185.     m$ = m$ + "......22" + Chr$(13)
  3186.     m$ = m$ + "......22" + Chr$(13)
  3187.     m$ = m$ + "......22" + Chr$(13)
  3188.     m$ = m$ + "......22" + Chr$(13)
  3189.     m$ = m$ + "......22" + Chr$(13)
  3190.     m$ = m$ + "......22" + Chr$(13)
  3191.     m$ = m$ + "......22" + Chr$(13)
  3192.     m$ = m$ + "......22" + Chr$(13)
  3193.     arrTileText(215) = m$
  3194.  
  3195.     m$ = ""
  3196.     m$ = m$ + "........" + Chr$(13)
  3197.     m$ = m$ + "........" + Chr$(13)
  3198.     m$ = m$ + "........" + Chr$(13)
  3199.     m$ = m$ + "........" + Chr$(13)
  3200.     m$ = m$ + "22..22.." + Chr$(13)
  3201.     m$ = m$ + "22..22.." + Chr$(13)
  3202.     m$ = m$ + "..22..22" + Chr$(13)
  3203.     m$ = m$ + "..22..22" + Chr$(13)
  3204.     arrTileText(216) = m$
  3205.  
  3206.     m$ = ""
  3207.     m$ = m$ + "22..22.." + Chr$(13)
  3208.     m$ = m$ + "2..22..2" + Chr$(13)
  3209.     m$ = m$ + "..22..22" + Chr$(13)
  3210.     m$ = m$ + ".22..22." + Chr$(13)
  3211.     m$ = m$ + "22..22.." + Chr$(13)
  3212.     m$ = m$ + "2..22..2" + Chr$(13)
  3213.     m$ = m$ + "..22..22" + Chr$(13)
  3214.     m$ = m$ + ".22..22." + Chr$(13)
  3215.     arrTileText(217) = m$
  3216.  
  3217.     m$ = ""
  3218.     m$ = m$ + "......22" + Chr$(13)
  3219.     m$ = m$ + "......22" + Chr$(13)
  3220.     m$ = m$ + "......22" + Chr$(13)
  3221.     m$ = m$ + "......22" + Chr$(13)
  3222.     m$ = m$ + "......22" + Chr$(13)
  3223.     m$ = m$ + "......22" + Chr$(13)
  3224.     m$ = m$ + "......22" + Chr$(13)
  3225.     m$ = m$ + "......22" + Chr$(13)
  3226.     arrTileText(218) = m$
  3227.  
  3228.     m$ = ""
  3229.     m$ = m$ + "...22..." + Chr$(13)
  3230.     m$ = m$ + "...22..." + Chr$(13)
  3231.     m$ = m$ + "...22..." + Chr$(13)
  3232.     m$ = m$ + "...22222" + Chr$(13)
  3233.     m$ = m$ + "...22222" + Chr$(13)
  3234.     m$ = m$ + "...22..." + Chr$(13)
  3235.     m$ = m$ + "...22..." + Chr$(13)
  3236.     m$ = m$ + "...22..." + Chr$(13)
  3237.     arrTileText(219) = m$
  3238.  
  3239.     m$ = ""
  3240.     m$ = m$ + "........" + Chr$(13)
  3241.     m$ = m$ + "........" + Chr$(13)
  3242.     m$ = m$ + "........" + Chr$(13)
  3243.     m$ = m$ + "........" + Chr$(13)
  3244.     m$ = m$ + "....2222" + Chr$(13)
  3245.     m$ = m$ + "....2222" + Chr$(13)
  3246.     m$ = m$ + "....2222" + Chr$(13)
  3247.     m$ = m$ + "....2222" + Chr$(13)
  3248.     arrTileText(220) = m$
  3249.  
  3250.     m$ = ""
  3251.     m$ = m$ + "...22..." + Chr$(13)
  3252.     m$ = m$ + "...22..." + Chr$(13)
  3253.     m$ = m$ + "...22..." + Chr$(13)
  3254.     m$ = m$ + "...22222" + Chr$(13)
  3255.     m$ = m$ + "...22222" + Chr$(13)
  3256.     m$ = m$ + "........" + Chr$(13)
  3257.     m$ = m$ + "........" + Chr$(13)
  3258.     m$ = m$ + "........" + Chr$(13)
  3259.     arrTileText(221) = m$
  3260.  
  3261.     m$ = ""
  3262.     m$ = m$ + "........" + Chr$(13)
  3263.     m$ = m$ + "........" + Chr$(13)
  3264.     m$ = m$ + "........" + Chr$(13)
  3265.     m$ = m$ + "22222..." + Chr$(13)
  3266.     m$ = m$ + "22222..." + Chr$(13)
  3267.     m$ = m$ + "...22..." + Chr$(13)
  3268.     m$ = m$ + "...22..." + Chr$(13)
  3269.     m$ = m$ + "...22..." + Chr$(13)
  3270.     arrTileText(222) = m$
  3271.  
  3272.     m$ = ""
  3273.     m$ = m$ + "........" + Chr$(13)
  3274.     m$ = m$ + "........" + Chr$(13)
  3275.     m$ = m$ + "........" + Chr$(13)
  3276.     m$ = m$ + "........" + Chr$(13)
  3277.     m$ = m$ + "........" + Chr$(13)
  3278.     m$ = m$ + "........" + Chr$(13)
  3279.     m$ = m$ + "22222222" + Chr$(13)
  3280.     m$ = m$ + "22222222" + Chr$(13)
  3281.     arrTileText(223) = m$
  3282.  
  3283.     m$ = ""
  3284.     m$ = m$ + "........" + Chr$(13)
  3285.     m$ = m$ + "........" + Chr$(13)
  3286.     m$ = m$ + "........" + Chr$(13)
  3287.     m$ = m$ + "...22222" + Chr$(13)
  3288.     m$ = m$ + "...22222" + Chr$(13)
  3289.     m$ = m$ + "...22..." + Chr$(13)
  3290.     m$ = m$ + "...22..." + Chr$(13)
  3291.     m$ = m$ + "...22..." + Chr$(13)
  3292.     arrTileText(224) = m$
  3293.  
  3294.     m$ = ""
  3295.     m$ = m$ + "...22..." + Chr$(13)
  3296.     m$ = m$ + "...22..." + Chr$(13)
  3297.     m$ = m$ + "...22..." + Chr$(13)
  3298.     m$ = m$ + "22222222" + Chr$(13)
  3299.     m$ = m$ + "22222222" + Chr$(13)
  3300.     m$ = m$ + "........" + Chr$(13)
  3301.     m$ = m$ + "........" + Chr$(13)
  3302.     m$ = m$ + "........" + Chr$(13)
  3303.     arrTileText(225) = m$
  3304.  
  3305.     m$ = ""
  3306.     m$ = m$ + "........" + Chr$(13)
  3307.     m$ = m$ + "........" + Chr$(13)
  3308.     m$ = m$ + "........" + Chr$(13)
  3309.     m$ = m$ + "22222222" + Chr$(13)
  3310.     m$ = m$ + "22222222" + Chr$(13)
  3311.     m$ = m$ + "...22..." + Chr$(13)
  3312.     m$ = m$ + "...22..." + Chr$(13)
  3313.     m$ = m$ + "...22..." + Chr$(13)
  3314.     arrTileText(226) = m$
  3315.  
  3316.     m$ = ""
  3317.     m$ = m$ + "...22..." + Chr$(13)
  3318.     m$ = m$ + "...22..." + Chr$(13)
  3319.     m$ = m$ + "...22..." + Chr$(13)
  3320.     m$ = m$ + "22222..." + Chr$(13)
  3321.     m$ = m$ + "22222..." + Chr$(13)
  3322.     m$ = m$ + "...22..." + Chr$(13)
  3323.     m$ = m$ + "...22..." + Chr$(13)
  3324.     m$ = m$ + "...22..." + Chr$(13)
  3325.     arrTileText(227) = m$
  3326.  
  3327.     m$ = ""
  3328.     m$ = m$ + "22......" + Chr$(13)
  3329.     m$ = m$ + "22......" + Chr$(13)
  3330.     m$ = m$ + "22......" + Chr$(13)
  3331.     m$ = m$ + "22......" + Chr$(13)
  3332.     m$ = m$ + "22......" + Chr$(13)
  3333.     m$ = m$ + "22......" + Chr$(13)
  3334.     m$ = m$ + "22......" + Chr$(13)
  3335.     m$ = m$ + "22......" + Chr$(13)
  3336.     arrTileText(228) = m$
  3337.  
  3338.     m$ = ""
  3339.     m$ = m$ + "222....." + Chr$(13)
  3340.     m$ = m$ + "222....." + Chr$(13)
  3341.     m$ = m$ + "222....." + Chr$(13)
  3342.     m$ = m$ + "222....." + Chr$(13)
  3343.     m$ = m$ + "222....." + Chr$(13)
  3344.     m$ = m$ + "222....." + Chr$(13)
  3345.     m$ = m$ + "222....." + Chr$(13)
  3346.     m$ = m$ + "222....." + Chr$(13)
  3347.     arrTileText(229) = m$
  3348.  
  3349.     m$ = ""
  3350.     m$ = m$ + ".....222" + Chr$(13)
  3351.     m$ = m$ + ".....222" + Chr$(13)
  3352.     m$ = m$ + ".....222" + Chr$(13)
  3353.     m$ = m$ + ".....222" + Chr$(13)
  3354.     m$ = m$ + ".....222" + Chr$(13)
  3355.     m$ = m$ + ".....222" + Chr$(13)
  3356.     m$ = m$ + ".....222" + Chr$(13)
  3357.     m$ = m$ + ".....222" + Chr$(13)
  3358.     arrTileText(230) = m$
  3359.  
  3360.     m$ = ""
  3361.     m$ = m$ + "22222222" + Chr$(13)
  3362.     m$ = m$ + "22222222" + Chr$(13)
  3363.     m$ = m$ + "........" + Chr$(13)
  3364.     m$ = m$ + "........" + Chr$(13)
  3365.     m$ = m$ + "........" + Chr$(13)
  3366.     m$ = m$ + "........" + Chr$(13)
  3367.     m$ = m$ + "........" + Chr$(13)
  3368.     m$ = m$ + "........" + Chr$(13)
  3369.     arrTileText(231) = m$
  3370.  
  3371.     m$ = ""
  3372.     m$ = m$ + "22222222" + Chr$(13)
  3373.     m$ = m$ + "22222222" + Chr$(13)
  3374.     m$ = m$ + "22222222" + Chr$(13)
  3375.     m$ = m$ + "........" + Chr$(13)
  3376.     m$ = m$ + "........" + Chr$(13)
  3377.     m$ = m$ + "........" + Chr$(13)
  3378.     m$ = m$ + "........" + Chr$(13)
  3379.     m$ = m$ + "........" + Chr$(13)
  3380.     arrTileText(232) = m$
  3381.  
  3382.     m$ = ""
  3383.     m$ = m$ + "........" + Chr$(13)
  3384.     m$ = m$ + "........" + Chr$(13)
  3385.     m$ = m$ + "........" + Chr$(13)
  3386.     m$ = m$ + "........" + Chr$(13)
  3387.     m$ = m$ + "........" + Chr$(13)
  3388.     m$ = m$ + "22222222" + Chr$(13)
  3389.     m$ = m$ + "22222222" + Chr$(13)
  3390.     m$ = m$ + "22222222" + Chr$(13)
  3391.     arrTileText(233) = m$
  3392.  
  3393.     m$ = ""
  3394.     m$ = m$ + ".......2" + Chr$(13)
  3395.     m$ = m$ + "......22" + Chr$(13)
  3396.     m$ = m$ + ".....22." + Chr$(13)
  3397.     m$ = m$ + ".22.22.." + Chr$(13)
  3398.     m$ = m$ + ".2222..." + Chr$(13)
  3399.     m$ = m$ + ".222...." + Chr$(13)
  3400.     m$ = m$ + ".22....." + Chr$(13)
  3401.     m$ = m$ + "........" + Chr$(13)
  3402.     arrTileText(234) = m$
  3403.  
  3404.     m$ = ""
  3405.     m$ = m$ + "........" + Chr$(13)
  3406.     m$ = m$ + "........" + Chr$(13)
  3407.     m$ = m$ + "........" + Chr$(13)
  3408.     m$ = m$ + "........" + Chr$(13)
  3409.     m$ = m$ + "2222...." + Chr$(13)
  3410.     m$ = m$ + "2222...." + Chr$(13)
  3411.     m$ = m$ + "2222...." + Chr$(13)
  3412.     m$ = m$ + "2222...." + Chr$(13)
  3413.     arrTileText(235) = m$
  3414.  
  3415.     m$ = ""
  3416.     m$ = m$ + "....2222" + Chr$(13)
  3417.     m$ = m$ + "....2222" + Chr$(13)
  3418.     m$ = m$ + "....2222" + Chr$(13)
  3419.     m$ = m$ + "....2222" + Chr$(13)
  3420.     m$ = m$ + "........" + Chr$(13)
  3421.     m$ = m$ + "........" + Chr$(13)
  3422.     m$ = m$ + "........" + Chr$(13)
  3423.     m$ = m$ + "........" + Chr$(13)
  3424.     arrTileText(236) = m$
  3425.  
  3426.     m$ = ""
  3427.     m$ = m$ + "...22..." + Chr$(13)
  3428.     m$ = m$ + "...22..." + Chr$(13)
  3429.     m$ = m$ + "...22..." + Chr$(13)
  3430.     m$ = m$ + "22222..." + Chr$(13)
  3431.     m$ = m$ + "22222..." + Chr$(13)
  3432.     m$ = m$ + "........" + Chr$(13)
  3433.     m$ = m$ + "........" + Chr$(13)
  3434.     m$ = m$ + "........" + Chr$(13)
  3435.     arrTileText(237) = m$
  3436.  
  3437.     m$ = ""
  3438.     m$ = m$ + "2222...." + Chr$(13)
  3439.     m$ = m$ + "2222...." + Chr$(13)
  3440.     m$ = m$ + "2222...." + Chr$(13)
  3441.     m$ = m$ + "2222...." + Chr$(13)
  3442.     m$ = m$ + "........" + Chr$(13)
  3443.     m$ = m$ + "........" + Chr$(13)
  3444.     m$ = m$ + "........" + Chr$(13)
  3445.     m$ = m$ + "........" + Chr$(13)
  3446.     arrTileText(238) = m$
  3447.  
  3448.     m$ = ""
  3449.     m$ = m$ + "2222...." + Chr$(13)
  3450.     m$ = m$ + "2222...." + Chr$(13)
  3451.     m$ = m$ + "2222...." + Chr$(13)
  3452.     m$ = m$ + "2222...." + Chr$(13)
  3453.     m$ = m$ + "....2222" + Chr$(13)
  3454.     m$ = m$ + "....2222" + Chr$(13)
  3455.     m$ = m$ + "....2222" + Chr$(13)
  3456.     m$ = m$ + "....2222" + Chr$(13)
  3457.     arrTileText(239) = m$
  3458.  
  3459.     m$ = ""
  3460.     m$ = m$ + "........" + Chr$(13)
  3461.     m$ = m$ + "........" + Chr$(13)
  3462.     m$ = m$ + "........" + Chr$(13)
  3463.     m$ = m$ + "........" + Chr$(13)
  3464.     m$ = m$ + "........" + Chr$(13)
  3465.     m$ = m$ + "........" + Chr$(13)
  3466.     m$ = m$ + "........" + Chr$(13)
  3467.     m$ = m$ + "........" + Chr$(13)
  3468.     arrTileText(240) = m$
  3469.  
  3470.     m$ = ""
  3471.     m$ = m$ + "22222.22" + Chr$(13)
  3472.     m$ = m$ + "22222.22" + Chr$(13)
  3473.     m$ = m$ + "22222.22" + Chr$(13)
  3474.     m$ = m$ + "........" + Chr$(13)
  3475.     m$ = m$ + "22.22222" + Chr$(13)
  3476.     m$ = m$ + "22.22222" + Chr$(13)
  3477.     m$ = m$ + "22.22222" + Chr$(13)
  3478.     m$ = m$ + "........" + Chr$(13)
  3479.     arrTileText(241) = m$
  3480.  
  3481.     m$ = ""
  3482.     m$ = m$ + "........" + Chr$(13)
  3483.     m$ = m$ + "........" + Chr$(13)
  3484.     m$ = m$ + "........" + Chr$(13)
  3485.     m$ = m$ + ".222222." + Chr$(13)
  3486.     m$ = m$ + "........" + Chr$(13)
  3487.     m$ = m$ + "........" + Chr$(13)
  3488.     m$ = m$ + "........" + Chr$(13)
  3489.     m$ = m$ + "........" + Chr$(13)
  3490.     arrTileText(242) = m$
  3491.  
  3492.     m$ = ""
  3493.     m$ = m$ + "........" + Chr$(13)
  3494.     m$ = m$ + "...2...." + Chr$(13)
  3495.     m$ = m$ + "...2...." + Chr$(13)
  3496.     m$ = m$ + "...2...." + Chr$(13)
  3497.     m$ = m$ + "...2...." + Chr$(13)
  3498.     m$ = m$ + "...2...." + Chr$(13)
  3499.     m$ = m$ + "...2...." + Chr$(13)
  3500.     m$ = m$ + "........" + Chr$(13)
  3501.     arrTileText(243) = m$
  3502.  
  3503.     m$ = ""
  3504.     m$ = m$ + "........" + Chr$(13)
  3505.     m$ = m$ + "........" + Chr$(13)
  3506.     m$ = m$ + "........" + Chr$(13)
  3507.     m$ = m$ + "...2222." + Chr$(13)
  3508.     m$ = m$ + "...2...." + Chr$(13)
  3509.     m$ = m$ + "...2...." + Chr$(13)
  3510.     m$ = m$ + "...2...." + Chr$(13)
  3511.     m$ = m$ + "........" + Chr$(13)
  3512.     arrTileText(244) = m$
  3513.  
  3514.     m$ = ""
  3515.     m$ = m$ + "........" + Chr$(13)
  3516.     m$ = m$ + "........" + Chr$(13)
  3517.     m$ = m$ + "........" + Chr$(13)
  3518.     m$ = m$ + ".222...." + Chr$(13)
  3519.     m$ = m$ + "...2...." + Chr$(13)
  3520.     m$ = m$ + "...2...." + Chr$(13)
  3521.     m$ = m$ + "...2...." + Chr$(13)
  3522.     m$ = m$ + "........" + Chr$(13)
  3523.     arrTileText(245) = m$
  3524.  
  3525.     m$ = ""
  3526.     m$ = m$ + "........" + Chr$(13)
  3527.     m$ = m$ + "...2...." + Chr$(13)
  3528.     m$ = m$ + "...2...." + Chr$(13)
  3529.     m$ = m$ + "...2222." + Chr$(13)
  3530.     m$ = m$ + "........" + Chr$(13)
  3531.     m$ = m$ + "........" + Chr$(13)
  3532.     m$ = m$ + "........" + Chr$(13)
  3533.     m$ = m$ + "........" + Chr$(13)
  3534.     arrTileText(246) = m$
  3535.  
  3536.     m$ = ""
  3537.     m$ = m$ + "........" + Chr$(13)
  3538.     m$ = m$ + "...2...." + Chr$(13)
  3539.     m$ = m$ + "...2...." + Chr$(13)
  3540.     m$ = m$ + ".222...." + Chr$(13)
  3541.     m$ = m$ + "........" + Chr$(13)
  3542.     m$ = m$ + "........" + Chr$(13)
  3543.     m$ = m$ + "........" + Chr$(13)
  3544.     m$ = m$ + "........" + Chr$(13)
  3545.     arrTileText(247) = m$
  3546.  
  3547.     m$ = ""
  3548.     m$ = m$ + "........" + Chr$(13)
  3549.     m$ = m$ + "........" + Chr$(13)
  3550.     m$ = m$ + "........" + Chr$(13)
  3551.     m$ = m$ + "........" + Chr$(13)
  3552.     m$ = m$ + "........" + Chr$(13)
  3553.     m$ = m$ + "........" + Chr$(13)
  3554.     m$ = m$ + "........" + Chr$(13)
  3555.     m$ = m$ + "........" + Chr$(13)
  3556.     arrTileText(248) = m$
  3557.  
  3558.     m$ = ""
  3559.     m$ = m$ + "........" + Chr$(13)
  3560.     m$ = m$ + "........" + Chr$(13)
  3561.     m$ = m$ + "........" + Chr$(13)
  3562.     m$ = m$ + "........" + Chr$(13)
  3563.     m$ = m$ + "........" + Chr$(13)
  3564.     m$ = m$ + "........" + Chr$(13)
  3565.     m$ = m$ + "........" + Chr$(13)
  3566.     m$ = m$ + "........" + Chr$(13)
  3567.     arrTileText(249) = m$
  3568.  
  3569.     m$ = ""
  3570.     m$ = m$ + "........" + Chr$(13)
  3571.     m$ = m$ + "........" + Chr$(13)
  3572.     m$ = m$ + "........" + Chr$(13)
  3573.     m$ = m$ + "........" + Chr$(13)
  3574.     m$ = m$ + "........" + Chr$(13)
  3575.     m$ = m$ + "........" + Chr$(13)
  3576.     m$ = m$ + "........" + Chr$(13)
  3577.     m$ = m$ + "........" + Chr$(13)
  3578.     arrTileText(250) = m$
  3579.  
  3580.     m$ = ""
  3581.     m$ = m$ + "........" + Chr$(13)
  3582.     m$ = m$ + "........" + Chr$(13)
  3583.     m$ = m$ + "........" + Chr$(13)
  3584.     m$ = m$ + "........" + Chr$(13)
  3585.     m$ = m$ + "........" + Chr$(13)
  3586.     m$ = m$ + "........" + Chr$(13)
  3587.     m$ = m$ + "........" + Chr$(13)
  3588.     m$ = m$ + "........" + Chr$(13)
  3589.     arrTileText(251) = m$
  3590.  
  3591.     m$ = ""
  3592.     m$ = m$ + "........" + Chr$(13)
  3593.     m$ = m$ + "........" + Chr$(13)
  3594.     m$ = m$ + "........" + Chr$(13)
  3595.     m$ = m$ + "........" + Chr$(13)
  3596.     m$ = m$ + "........" + Chr$(13)
  3597.     m$ = m$ + "........" + Chr$(13)
  3598.     m$ = m$ + "........" + Chr$(13)
  3599.     m$ = m$ + "........" + Chr$(13)
  3600.     arrTileText(252) = m$
  3601.  
  3602.     m$ = ""
  3603.     m$ = m$ + "22222222" + Chr$(13)
  3604.     m$ = m$ + "2......2" + Chr$(13)
  3605.     m$ = m$ + "2......2" + Chr$(13)
  3606.     m$ = m$ + "2......2" + Chr$(13)
  3607.     m$ = m$ + "2......2" + Chr$(13)
  3608.     m$ = m$ + "2......2" + Chr$(13)
  3609.     m$ = m$ + "2......2" + Chr$(13)
  3610.     m$ = m$ + "22222222" + Chr$(13)
  3611.     arrTileText(253) = m$
  3612.  
  3613.     m$ = ""
  3614.     m$ = m$ + "22222222" + Chr$(13)
  3615.     m$ = m$ + "22222222" + Chr$(13)
  3616.     m$ = m$ + "22222222" + Chr$(13)
  3617.     m$ = m$ + "22222222" + Chr$(13)
  3618.     m$ = m$ + "22222222" + Chr$(13)
  3619.     m$ = m$ + "22222222" + Chr$(13)
  3620.     m$ = m$ + "22222222" + Chr$(13)
  3621.     m$ = m$ + "22222222" + Chr$(13)
  3622.     arrTileText(254) = m$
  3623.  
  3624.     m$ = ""
  3625.     m$ = ""
  3626.     m$ = m$ + "22....22" + Chr$(13)
  3627.     m$ = m$ + "2..22..2" + Chr$(13)
  3628.     m$ = m$ + "2..22..2" + Chr$(13)
  3629.     m$ = m$ + "22.....2" + Chr$(13)
  3630.     m$ = m$ + "22222..2" + Chr$(13)
  3631.     m$ = m$ + "2..22..2" + Chr$(13)
  3632.     m$ = m$ + "22....22" + Chr$(13)
  3633.     m$ = m$ + "22222222" + Chr$(13)
  3634.     arrTileText(255) = m$
  3635.  
  3636. End Sub ' GetTileText
  3637.  
  3638. ' ################################################################################################################################################################
  3639. ' END TILE DEFINITIONS
  3640. ' ################################################################################################################################################################
  3641.  
  3642. ' ################################################################################################################################################################
  3643. ' BEGIN COLOR FUNCTIONS
  3644. ' ################################################################################################################################################################
  3645. Function cWhite~& ()
  3646.     cWhite = _RGB32(255, 255, 255)
  3647. End Function ' cWhite~&
  3648.  
  3649. Function cEmpty~& ()
  3650.     cEmpty = _RGB32(0, 0, 0, 0)
  3651. End Function ' cEmpty~&
  3652.  
  3653. Function cBlack~& ()
  3654.     cBlack = _RGB32(0, 0, 0)
  3655. End Function ' cBlack~&
  3656.  
  3657. Function cRed~& ()
  3658.     cRed = _RGB32(255, 0, 0)
  3659.  
  3660. Function cYellow~& ()
  3661.     cYellow = _RGB32(255, 255, 0)
  3662. End Function ' cYellow~&
  3663.  
  3664. Function cLime~& ()
  3665.     cLime = _RGB32(0, 255, 0)
  3666. End Function ' cLime~&
  3667.  
  3668. Function cCyan~& ()
  3669.     cCyan = _RGB32(0, 255, 255)
  3670. End Function ' cCyan~&
  3671.  
  3672. Function cBlue~& ()
  3673.     cBlue = _RGB32(0, 0, 255)
  3674. End Function ' cBlue~&
  3675.  
  3676. Function cMagenta~& ()
  3677.     cMagenta = _RGB32(255, 0, 255)
  3678. End Function ' cMagenta~&
  3679.  
  3680. Function cOrange~& ()
  3681.     cOrange = _RGB32(255, 165, 0)
  3682. End Function ' cOrange~&
  3683.  
  3684. Function cGray~& ()
  3685.     cGray = _RGB32(128, 128, 128)
  3686. End Function ' cGray~&
  3687. ' ################################################################################################################################################################
  3688. ' END COLOR FUNCTIONS
  3689. ' ################################################################################################################################################################
  3690.  
  3691. ' ################################################################################################################################################################
  3692. ' BEGIN GENERAL PURPOSE ROUTINES #GEN
  3693. ' ################################################################################################################################################################
  3694. ' /////////////////////////////////////////////////////////////////////////////
  3695.  
  3696. Function cstr$ (myValue)
  3697.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  3698.     cstr$ = _Trim$(Str$(myValue))
  3699. End Function ' cstr$
  3700.  
  3701. ' /////////////////////////////////////////////////////////////////////////////
  3702. ' Use with timer functions to avoid "after midnight" bug.
  3703.  
  3704. ' Re: how to time something (ie do loop for n seconds)
  3705. ' https://qb64forum.alephc.xyz/index.php?topic=4682.0
  3706.  
  3707. ' SMcNeill, QB64 Developer
  3708. ' « Reply #1 on: Today at 11:26:52 am »
  3709. '
  3710. ' One caveat here:  You *can* experience bugs with this after midnight.
  3711. '
  3712. ' Program starts at 23:59:59.
  3713. ' Add three seconds -- 24:00:02...  (In seconds, and not hours and minutes like this, though hours and minutes are easier to visualize.)
  3714. ' Clock hits midnight:  0:00:00
  3715. '
  3716. ' At no point will you ever have TIMER become greater than t#.
  3717. '
  3718. ' If you're going to have a program which might run into this issue,
  3719. ' I'd suggest just plugging in my ExtendedTimer and use it instead:
  3720. '
  3721. ' Most of us write time code to test little snippets for which method might
  3722. ' be faster for us while we're coding.  The clock resetting on us isn't
  3723. ' normally such a big deal.  When it is, however, all you have to do is
  3724. ' swap to the ExtendedTimer function [below]
  3725. '
  3726. ' Returns a value for you based off DAY + TIME, rather than just time alone!
  3727. ' No midnight clock issues with something like that in our programs.  ;)
  3728.  
  3729. ' Usage:
  3730. '     ' DO SOMETHING FOR 3 SECONDS
  3731. '     t# = ExtendedTimer + 3
  3732. '     Do
  3733. '         '(SOMETHING)
  3734. '     Loop Until Timer > t#
  3735.  
  3736. Function ExtendedTimer##
  3737.     d$ = Date$
  3738.     l = InStr(d$, "-")
  3739.     l1 = InStr(l + 1, d$, "-")
  3740.     m = Val(Left$(d$, l))
  3741.     d = Val(Mid$(d$, l + 1))
  3742.     y = Val(Mid$(d$, l1 + 1)) - 1970
  3743.     For i = 1 To m
  3744.         Select Case i 'Add the number of days for each previous month passed
  3745.             Case 1: d = d 'January doestn't have any carry over days.
  3746.             Case 2, 4, 6, 8, 9, 11: d = d + 31
  3747.             Case 3: d = d + 28
  3748.             Case 5, 7, 10, 12: d = d + 30
  3749.         End Select
  3750.     Next
  3751.     For i = 1 To y
  3752.         d = d + 365
  3753.     Next
  3754.     For i = 2 To y Step 4
  3755.         If m > 2 Then d = d + 1 'add an extra day for leap year every 4 years, starting in 1970
  3756.     Next
  3757.     d = d - 1 'for year 2000
  3758.     s~&& = d * 24 * 60 * 60 'Seconds are days * 24 hours * 60 minutes * 60 seconds
  3759.     ExtendedTimer## = (s~&& + Timer)
  3760. End Function ' ExtendedTimer##
  3761.  
  3762. ' /////////////////////////////////////////////////////////////////////////////
  3763. ' FROM: String Manipulation
  3764. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  3765. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  3766. '
  3767. 'SUMMARY:
  3768. '   Purpose:  A library of custom functions that transform strings.
  3769. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  3770. '   Platform: QB64 (www.qb64.org)
  3771. '   Revision: 1.6
  3772. '   Updated:  5/28/2012
  3773.  
  3774. 'SUMMARY:
  3775. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  3776. 'INPUT:
  3777. 'Text: The input string; the text that's being manipulated.
  3778. 'Find: The specified sub-string; the string sought within the [Text] string.
  3779. 'Add: The sub-string that's being added to the [Text] string.
  3780.  
  3781. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  3782.     ' VARIABLES:
  3783.     Dim Text2 As String
  3784.     Dim Find2 As String
  3785.     Dim Add2 As String
  3786.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  3787.     Dim strBefore As String ' The characters before the string to be replaced.
  3788.     Dim strAfter As String ' The characters after the string to be replaced.
  3789.  
  3790.     ' INITIALIZE:
  3791.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  3792.     Text2 = Text1
  3793.     Find2 = Find1
  3794.     Add2 = Add1
  3795.  
  3796.     lngLocation = InStr(1, Text2, Find2)
  3797.  
  3798.     ' PROCESSING:
  3799.     ' While [Find2] appears in [Text2]...
  3800.     While lngLocation
  3801.         ' Extract all Text2 before the [Find2] substring:
  3802.         strBefore = Left$(Text2, lngLocation - 1)
  3803.  
  3804.         ' Extract all text after the [Find2] substring:
  3805.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  3806.  
  3807.         ' Return the substring:
  3808.         Text2 = strBefore + Add2 + strAfter
  3809.  
  3810.         ' Locate the next instance of [Find2]:
  3811.         lngLocation = InStr(1, Text2, Find2)
  3812.  
  3813.         ' Next instance of [Find2]...
  3814.     Wend
  3815.  
  3816.     ' OUTPUT:
  3817.     Replace$ = Text2
  3818. End Function ' Replace$
  3819.  
  3820. ' /////////////////////////////////////////////////////////////////////////////
  3821. ' Split and join strings
  3822. ' https://www.qb64.org/forum/index.php?topic=1073.0
  3823. '
  3824. ' FROM luke, QB64 Developer
  3825. ' Date: February 15, 2019, 04:11:07 AM »
  3826. '
  3827. ' Given a string of words separated by spaces (or any other character),
  3828. ' splits it into an array of the words. I've no doubt many people have
  3829. ' written a version of this over the years and no doubt there's a million
  3830. ' ways to do it, but I thought I'd put mine here so we have at least one
  3831. ' version. There's also a join function that does the opposite
  3832. ' array -> single string.
  3833. '
  3834. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  3835. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  3836.  
  3837. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  3838. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  3839. '
  3840. 'delimiter$ must be one character long.
  3841. 'result$() must have been REDIMmed previously.
  3842.  
  3843. ' Modified to handle multi-character delimiters
  3844.  
  3845. Sub split (in$, delimiter$, result$())
  3846.     Dim start As Integer
  3847.     Dim finish As Integer
  3848.     Dim iDelimLen As Integer
  3849.     ReDim result$(-1)
  3850.  
  3851.     iDelimLen = Len(delimiter$)
  3852.  
  3853.     start = 1
  3854.     Do
  3855.         'While Mid$(in$, start, 1) = delimiter$
  3856.         While Mid$(in$, start, iDelimLen) = delimiter$
  3857.             'start = start + 1
  3858.             start = start + iDelimLen
  3859.             If start > Len(in$) Then
  3860.                 Exit Sub
  3861.             End If
  3862.         Wend
  3863.         finish = InStr(start, in$, delimiter$)
  3864.         If finish = 0 Then
  3865.             finish = Len(in$) + 1
  3866.         End If
  3867.  
  3868.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  3869.  
  3870.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  3871.         start = finish + 1
  3872.     Loop While start <= Len(in$)
  3873. End Sub ' split
  3874. ' ################################################################################################################################################################
  3875. ' END GENERAL PURPOSE ROUTINES #GEN
  3876. ' ################################################################################################################################################################
  3877.  
  3878. ' ################################################################################################################################################################
  3879. ' BEGIN HARDWARE IMAGES DEMO #2 (WORKS)
  3880. ' ################################################################################################################################################################
  3881.  
  3882. ' /////////////////////////////////////////////////////////////////////////////
  3883. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  3884. ' https://qb64forum.alephc.xyz/index.php?topic=4674.0
  3885.  
  3886. ' madscijr
  3887. ' « Reply #5 on: Yesterday at 09:46:53 pm »
  3888.  
  3889. ' Quote from: SMcNeill on Yesterday at 07:56:57 pm:
  3890. ' Hardware images basically get their speed by being a sort of "Write Only"
  3891. ' method for images. You can make them, you can put them on the screen,
  3892. ' but you can't edit them or read information back from them.
  3893. ' ...
  3894. ' 2) You don't have to specify where they show up as a destination with putimage.
  3895. ' ...
  3896. ' If you have any specific questions, feel free to ask them and I'll do my
  3897. ' best to answer for you, if I can.  ;)
  3898. '
  3899. ' Thanks for taking the time to explain all that. When I'm back at the PC,
  3900. ' I'll try out your example.
  3901. '
  3902. ' For now, just one question: if you can't read information from them or even
  3903. ' specify where on the destination they go, how are they even useful?
  3904. ' Maybe it will click when I run your example or read up on it, but I just
  3905. ' don't see what the use of an image would be if you can't control where on
  3906. ' the screen it is drawn? Or how it would help speed up drawing a map of
  3907. ' colored tiles to the screen.
  3908. '
  3909. ' Thanks again...
  3910.  
  3911. ' SMcNeill, QB64 Developer
  3912. ' « Reply #6 on: Today at 01:14:28 am »
  3913. '
  3914. ' Try this out and see if it doesn't help answer your questions:
  3915.  
  3916. Sub HardwareImageDemo2
  3917.     $Color:32
  3918.     Display = _NewImage(1024, 720, 32)
  3919.     Software = _NewImage(1024, 720, 32)
  3920.  
  3921.     Screen Display
  3922.     Print "First, let's create a normal sortware screen and fill it with 40x40 tiles of random colors."
  3923.     Print "Press <ANY KEY> to view this screen."
  3924.     Sleep
  3925.  
  3926.     _Dest Software
  3927.     For y = 0 To 720 Step 40
  3928.         For x = 0 To 1024 Step 40
  3929.             Line (x, y)-Step(40, 40), &HFF000000 + Rnd * &HFFFFFF, BF
  3930.         Next
  3931.     Next
  3932.  
  3933.     _Dest Display
  3934.     _PutImage , Software
  3935.     Print
  3936.     Print "As you can see, this is a simple software screen."
  3937.     Print "Now, I'm going to copy that software screen and make it a hardware screen."
  3938.     Print "Press <ANY KEY> for me to do so!"
  3939.     Sleep
  3940.  
  3941.     Hardware = _CopyImage(Software, 33)
  3942.     Cls
  3943.     Print "Now, I'm back to my blank screen, but I now have a hardware screen to work with."
  3944.     Print
  3945.     Print "To keep things simple, let's showcase the differences between using _putimage with a software screen, and then with the hardware screen."
  3946.     Print
  3947.     Print "First, the software screen!  Press <ANY KEY> to continue."
  3948.     Sleep
  3949.  
  3950.     _PutImage (0, 100)-Step(100, 100), Software, Display, (0, 0)-(40, 40)
  3951.     Print "As you can see, all I did here was copy a single tile from the software screen and then scale it to fit upon the current screen."
  3952.     Print
  3953.     Print "Press <ANY KEY> to continue, as I'll now do the same with a hardware image."
  3954.  
  3955.     _PutImage (200, 100)-Step(100, 100), Hardware, , (0, 0)-(40, 40)
  3956.     Print
  3957.     Print "As you can see from the above, we have the same tile copied and scaled onto the screen, just to the right of the software image."
  3958.     Print
  3959.     Print "Doesn't really seem to be very different at all, now does it?"
  3960.     Print
  3961.     Print "Press <ANY KEY> to continue."
  3962.     _Display
  3963.     Sleep
  3964.  
  3965.     Print
  3966.     Color Red
  3967.     Print "BUT WAIT A MOMENT!!  What the heck happened to our hardware tile??!!??"
  3968.     Color White
  3969.     Print
  3970.     Print "It's no longer on the screen, as it was previously.  Why??"
  3971.     Print
  3972.     Print "Because it was never on the software screen at all, but was instead on it's own hardware layer ABOVE the software screen."
  3973.     Print
  3974.     Print "Hardware images only display ONCE, once _DISPLAY is called, and then they flush from the graphics buffer."
  3975.     Print "Draw.  Display.  Flush.  <-- that's the basic process of how a hardware image works."
  3976.     Print
  3977.     Print "If we want one to remain on the screen, we have to do it either by:"
  3978.     Print "1) Not updating the screen after we draw and display the image, as I did above with the tile I displayed."
  3979.     Print "2) Refresh displaying the image in our main loop (which is what we do even with software images for most games and such)."
  3980.     Print
  3981.     Print "Press <ANY KEY> to continue."
  3982.     Sleep
  3983.  
  3984.     Cls
  3985.     Print
  3986.     Print "So, as you can see, hardware images have a few drawbacks to them, with the most obvious being they only display once,"
  3987.     Print "then flush from memory.  If you want persistant hardware images, they're best used in a loop."
  3988.     Print
  3989.     Print "But, if they've got drawbacks, then one has to ask, 'What's the advantages to using them?'"
  3990.     Print "Press <ANY KEY> to find out!"
  3991.     Sleep
  3992.  
  3993.     t# = ExtendedTimer + 3
  3994.     Do
  3995.         count = count + 1
  3996.         _PutImage (0, 100)-Step(100, 100), Software, Display, (x, y)-Step(40, 40)
  3997.         x = x + 40
  3998.         If x > 1024 Then x = 0: y = y + 40
  3999.         If y > 720 Then x = 0: y = 0
  4000.         _Display
  4001.     Loop Until Timer > t#
  4002.  
  4003.     Print "See lots of flashing tiles on the screen for the last three seconds?"
  4004.     Print "That was us using _PUTIMAGE with the software screen, and we put"; count; "tiles on the screen in those 3 seconds."
  4005.     Print
  4006.     Print "Now press <ANY KEY> and we'll do the exact same thing with hardware images."
  4007.     Sleep
  4008.  
  4009.     count = 0: x = 0: y = 0
  4010.     t# = ExtendedTimer + 3
  4011.     tempScreen = _CopyImage(Display, 33)
  4012.     Do
  4013.         count = count + 1
  4014.         _PutImage , tempScreen
  4015.         _PutImage (300, 100)-Step(100, 100), Hardware, , (x, y)-Step(40, 40)
  4016.         x = x + 40
  4017.         If x > 1024 Then x = 0: y = y + 40
  4018.         If y > 720 Then x = 0: y = 0
  4019.         _Display
  4020.     Loop Until Timer > t#
  4021.  
  4022.     _FreeImage tempScreen
  4023.     Print
  4024.     Print "Didn't seem very different at the rate of which we were running things, now did it?"
  4025.     Print "Would you be surprised to find out that we put"; count * 2; "hardware images on the screen in those same 3 seconds?"
  4026.     Print
  4027.     Print "And if you look close, I counted each loop twice, as we didn't just put the hardware image to the screen, but also a"
  4028.     Print "complete copy of the original software screen as well!"
  4029.     Print
  4030.     Print "The reason why I did this?"
  4031.     Print
  4032.     Print "So I could completely elimimate all software iamges and JUST work with the much faster hardware layer!"
  4033.     Print
  4034.     Print "Press <ANY KEY> to continue"
  4035.     Sleep
  4036.  
  4037.     Cls
  4038.     Print "So, as you can see, hardware images are multiple times faster to display and render than software images."
  4039.     Print
  4040.     Print "But here's something else for you to notice -- I'm going to update the screen with constant, limitless tile refeshes."
  4041.     Print "To start with, I'm going to do this in a LOOP with the software images."
  4042.     Print "CTRL-TAB out of this demo program, open your task manager, and see how much memory and CPU processing power the program uses."
  4043.     Print "Then TAB back to this program and hit <ESC> to do the same with the hardware images."
  4044.  
  4045.     Do
  4046.         _PutImage (0, 100)-(1024, 720), Software, Display, (x, y)-Step(40, 40)
  4047.         x = x + 40
  4048.         If x > 1024 Then x = 0: y = y + 40
  4049.         If y > 720 Then x = 0: y = 0
  4050.         _Limit 60
  4051.         _Display
  4052.     Loop Until _KeyDown(27)
  4053.  
  4054.     Cls , 0
  4055.     Print "PRESS <SPACE BAR> to stop the hardware iamges!!"
  4056.     tempImage = _CopyImage(Display, 33)
  4057.     x = 0: y = 0
  4058.     Do
  4059.         _PutImage , tempImage
  4060.         _PutImage (0, 100)-(1023, 719), Hardware, , (x, y)-Step(40, 40)
  4061.         x = x + 40
  4062.         If x > 1024 Then x = 0: y = y + 40
  4063.         If y > 720 Then x = 0: y = 0
  4064.         _Limit 60
  4065.         _Display
  4066.     Loop Until _KeyDown(32)
  4067.  
  4068.     Cls
  4069.     Print "On my laptop, these two methods use the following amounts of CPU power:"
  4070.     Print "Software, 60 FPS -- 3% CPU"
  4071.     Print "Hardware, 60 FPS -- 0.1% CPU"
  4072.     Print
  4073.     Print "If I go in and change the limits to something much higher, these are the results (test them for yourselves, please):"
  4074.     Print "Software, 600 FPS -- 10.3% CPU"
  4075.     Print "Hardware, 600 FPS -- 0.1% CPU"
  4076.     Print
  4077.     Print
  4078.     Print "So, as you can see, the disadvantage to hardware images are they display once, then flush from memory."
  4079.     Print
  4080.     Print "While the advantages to their usage is MUCH faster processing times, and an immense reduction on CPU usage.  (The GPU picks up the work for us!)"
  4081.     Print
  4082.     Print
  4083.     Print "You basically use them just like you would any other normal image, though you have to keep in mind that they render"
  4084.     Print "to their own hardware layer, which you can specify to go on below or above your software screen."
  4085.     Print
  4086.     Print "(Or, you can _DISPLAYORDER _HARDWARE and *only* display the hardware layer, removing software rendering completely!)"
  4087.     Print
  4088.     Print "And THAT, my friends, is basically the lowdown on hardware vs software images.  ;)"
  4089.     Print
  4090.     Print
  4091.     Print "And this was another Steve(tm) Tutorial!  Enjoy!!"
  4092. End Sub ' HardwareImageDemo2
  4093.  
  4094. ' ################################################################################################################################################################
  4095. ' END HARDWARE IMAGES DEMO #2 (WORKS)
  4096. ' ################################################################################################################################################################
  4097.  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #16 on: February 24, 2022, 01:25:42 am »
Now it's my turn to be noobish.  ;D

What exactly are you wanting to do here?  I thought the goal was just to layer some tiles under some text.  Wasn't we doing that?

What's the color swap supposed to do?  Do we leave the text above the tiles and just swap the colors beneath them, or what's the end goal here?  I don't think I fully understand what you're trying to accomplish.

Is there a max number of colors that you're using in the tiles?  Or are they any possible shade of RGB?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #17 on: February 24, 2022, 08:21:37 am »
Now it's my turn to be noobish.  ;D

Noob away, my man! LoL

What exactly are you wanting to do here?  I thought the goal was just to layer some tiles under some text.  Wasn't we doing that?

Sort of, my end goal is to not use text at all but just that tileset, which you may have noticed is an ASCII bitmap font (modified PETSCII to be exact, I grew up with a C64 back in the day). So the entire display would just be tiles from that tileset, including any text.

What's the color swap supposed to do?  Do we leave the text above the tiles and just swap the colors beneath them, or what's the end goal here?  I don't think I fully understand what you're trying to accomplish.

Is there a max number of colors that you're using in the tiles?  Or are they any possible shade of RGB?

Basically the entire screen would just be composed of these 2-color tiles (each with its own foreground/background color) in various color combinations. The current game I'm working on uses 40 different colors, but that could change. So it would just be easiest to be able to use the one tileset (colored black on white or black on transparent) and specify an RGB foreground and background color as we draw each tile (which is where the swap color comes in, replacing the tile's black with foreColor and the white/transparent with backColor). Make sense?

So with that in mind, I'm trying to convert the color tile / color swap routines to use hardware images (originals=DrawColorTile, DoColorSwap, converted=DrawColorTileHW, DoColorSwapHW) but I am just so damn confused. Is it even possible to draw the tile using hardware images specifying the tile's foreground/background color "on the fly"?

The DoColorSwap routine, which I didn't write and don't purport to fully understand (it just works so I use it!), uses _MemImage/_MemGet/_MemPut to assign colors, and I'm not even sure if that's the right approach for this. I assume those won't work with a hardware image, so the tile passed in needs to be a sofware image? At what point does it become a hardware image? Will there be a bottleneck at some point from manipulating the software images? Etc. Etc.

The bottom line is it has to replace the original tile's black pixels with whatever color., and the rest with the background color.

Anyway I appreciate your taking the time to explain hardware images and hearing out this whole use case. In the very least I could just generate a giant hardware image containing multiple copies of the tileset in all 40 colors, but that seems like such a kludge, and I'd much prefer the routine to hardware draw the tile with the specified fore/back colors on the fly if possible.

Code: QB64: [Select]
  1. ' BOOLEAN VALUES
  2. Const FALSE = 0
  3. Const TRUE = Not FALSE
  4.  
  5. ' START THE MAIN ROUTINE
  6. DrawingSpeedTest4
  7. 'HardwareImageDemo2
  8.  
  9. ' FINISH
  10. System ' return control to the operating system
  11.  
  12. ' ################################################################################################################################################################
  13. ' BEGIN DRAWING SPEED TEST
  14. ' ################################################################################################################################################################
  15.  
  16. ' /////////////////////////////////////////////////////////////////////////////
  17.  
  18. Sub DrawingSpeedTest4
  19.     Dim sError As String: sError = ""
  20.     Dim imgScreen As Long ' the main display
  21.     Dim imgHardwareScreen As Long ' copy of the software screen, transformed into a hardware image
  22.     Dim imgTiles As Long ' original tileset, black on transparent
  23.     Dim imgHardwareTiles As Long ' copy of the tileset, tranformed into a hardware image
  24.     Dim imgTilesRed As Long ' colored tileset copy
  25.     Dim imgTilesGreen As Long ' colored tileset copy
  26.     Dim imgTilesBlue As Long ' colored tileset copy
  27.     Dim imgTilesYellow As Long ' colored tileset copy
  28.     Dim imgColorTiles As Long ' holds 4 copies of tileset in different colors (red, green, blue, yellow)
  29.     Dim iTileNum As Integer
  30.     Dim iColorIndex As Integer: iColorIndex = 0
  31.     Dim iFirstColor As Integer: iFirstColor = 0
  32.     Dim iLastColor As Integer: iLastColor = 3
  33.     Dim iCols As Integer
  34.     Dim iRows As Integer
  35.     Dim iY As Integer
  36.     Dim iX As Integer
  37.     Dim fgColor As _Unsigned Long
  38.     Dim bgColor As _Unsigned Long
  39.     Dim iMinY As Integer
  40.     Dim iMaxY As Integer
  41.     Dim iMinX As Integer
  42.     Dim iMaxX As Integer
  43.     Dim iCount1 As Long
  44.     Dim iCount2 As Long
  45.     Dim iCount3 As Long
  46.     Dim iCount4 As Long
  47.     Dim t# ' for timer
  48.    
  49.     ' ================================================================================================================================================================
  50.     ' INIT SCREEN
  51.     ' ================================================================================================================================================================
  52.     imgScreen = _NewImage(1024, 768, 32)
  53.     _ScreenMove 0, 0
  54.     Screen imgScreen
  55.     Cls , cGray
  56.     Color cWhite, cBlack: Locate 1, 1: Print "Press 1 to test DrawTile8 rooutine using 4 tilesets (1 per color) and regular _putimage using using SOFTWARE images...": Do: Loop Until InKey$ = "1"
  57.    
  58.     ' ================================================================================================================================================================
  59.     ' INITIALIZE NEUTRAL COLOR GRAPHICS TILES (BLACK ON TRANSPARENT)
  60.     ' ================================================================================================================================================================
  61.     If Len(sError) = 0 Then
  62.         '' LOAD TILES (16 cols x 16 rows of 8x8 tiles) FROM FILE
  63.         'sFile$ = Left$(Command$(0), _InStrRev(Command$(0), "\")) + "Font_8x8_128x128_v3.png" ' 128x128 pixels, 16 rows x 16 columns of 8x8 tiles
  64.         'imgTiles = _LoadImage(sFile$, 32)
  65.        
  66.         ' LOAD TILES FROM TEXT DEFINITIONS IN Sub GetTileText
  67.         sError = GetTiles$(imgTiles, cBlack, cEmpty)
  68.     End If
  69.    
  70.     ' ================================================================================================================================================================
  71.     ' CREATE COLORED TILESET COPIES
  72.     ' ================================================================================================================================================================
  73.     If Len(sError) = 0 Then
  74.         MakeColoredTileset imgTiles, imgTilesRed, cRed, cBlack
  75.         MakeColoredTileset imgTiles, imgTilesGreen, cLime, cBlack
  76.         MakeColoredTileset imgTiles, imgTilesBlue, cBlue, cBlack
  77.         MakeColoredTileset imgTiles, imgTilesYellow, cYellow, cBlack
  78.  
  79.         ' Make one big tileset with all colors
  80.         imgColorTiles = _NewImage(512, 128, 32)
  81.         _PutImage (0, 0), imgTilesRed, imgColorTiles, (0, 0)-(128, 128)
  82.         _PutImage (128, 0), imgTilesGreen, imgColorTiles, (0, 0)-(128, 128)
  83.         _PutImage (256, 0), imgTilesBlue, imgColorTiles, (0, 0)-(128, 128)
  84.         _PutImage (384, 0), imgTilesYellow, imgColorTiles, (0, 0)-(128, 128)
  85.     End If
  86.    
  87.     ' ================================================================================================================================================================
  88.     ' METHOD #1
  89.     ' _PUTIMAGE with SOFTWARE IMAGES
  90.     ' ================================================================================================================================================================
  91.     If Len(sError) = 0 Then
  92.         iCols = _Width(imgScreen) \ 8
  93.         iRows = _Height(imgScreen) \ 8
  94.         iMinX = 1: iMaxX = 16
  95.         iMinY = 3: iMaxY = 18
  96.         iCount1 = 0
  97.         t# = ExtendedTimer + 3
  98.         Do
  99.             iCount1 = iCount1 + 1
  100.             iFirstColor = iFirstColor Xor 1
  101.             iColorIndex = iFirstColor
  102.             iY = iMinY
  103.             iX = iMinX
  104.             For iTileNum = 0 To 255
  105.                 Select Case iColorIndex
  106.                     Case 0:
  107.                         DrawTile8 imgTilesRed, iTileNum, imgScreen, iX, iY
  108.                     Case 1:
  109.                         DrawTile8 imgTilesGreen, iTileNum, imgScreen, iX, iY
  110.                     Case 2:
  111.                         DrawTile8 imgTilesBlue, iTileNum, imgScreen, iX, iY
  112.                     Case Else:
  113.                         DrawTile8 imgTilesYellow, iTileNum, imgScreen, iX, iY
  114.                 End Select
  115.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  116.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  117.             Next iTileNum
  118.             _Display
  119.         Loop Until Timer > t#
  120.     End If
  121.     Color cWhite, cBlack: Locate 11, 1: Print "Press 2 to test DrawColorTile routine using 1 tileset with DoColorSwap using SOFTWARE images...";: Do: Loop Until InKey$ = "2"
  122.    
  123.     ' ================================================================================================================================================================
  124.     ' METHOD #2
  125.     ' COLOR SWAP with SOFTWARE IMAGES
  126.     ' ================================================================================================================================================================
  127.     If Len(sError) = 0 Then
  128.         iMinX = 1: iMaxX = 16
  129.         iMinY = 23: iMaxY = 38
  130.         iCount2 = 0
  131.         t# = ExtendedTimer + 3
  132.         Do
  133.             iCount2 = iCount2 + 1
  134.             iFirstColor = iFirstColor Xor 1
  135.             iColorIndex = iFirstColor
  136.             iY = iMinY
  137.             iX = iMinX
  138.             For iTileNum = 0 To 255
  139.                 Select Case iColorIndex
  140.                     Case 0:
  141.                         fgColor = cRed: bgColor = cBlack
  142.                     Case 1:
  143.                         fgColor = cLime: bgColor = cBlack
  144.                     Case 2:
  145.                         fgColor = cBlue: bgColor = cBlack
  146.                     Case Else:
  147.                         fgColor = cYellow: bgColor = cBlack
  148.                 End Select
  149.                 DrawColorTile imgScreen, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  150.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  151.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  152.             Next iTileNum
  153.             _Display
  154.         Loop Until Timer > t#
  155.     End If
  156.     Color cWhite, cBlack: Locate 21, 1: Print "Press 3 to test DrawTileHw8 rooutine using 1 big multi-tileset and HARDWARE images...";: Do: Loop Until InKey$ = "3"
  157.    
  158.     ' ================================================================================================================================================================
  159.     ' METHOD #3
  160.     ' _PUTIMAGE with HARDWARE IMAGES
  161.     ' ================================================================================================================================================================
  162.     If Len(sError) = 0 Then
  163.         imgHardwareTiles = _CopyImage(imgColorTiles, 33) ' Copy tilesheet for hardware image
  164.         iMinX = 1: iMaxX = 16
  165.         iMinY = 43: iMaxY = 58
  166.         iCount3 = 0
  167.         t# = ExtendedTimer + 3
  168.         imgHardwareScreen = _CopyImage(0, 33)
  169.         Do
  170.             iCount3 = iCount3 + 1
  171.             iFirstColor = iFirstColor Xor 1
  172.             iColorIndex = iFirstColor
  173.             iY = iMinY
  174.             iX = iMinX
  175.             _PutImage , imgHardwareScreen
  176.             For iTileNum = 0 To 255
  177.                 DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iX, iY, iColorIndex
  178.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  179.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  180.             Next iTileNum
  181.             _Display
  182.         Loop Until Timer > t#
  183.         _AutoDisplay
  184.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  185.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  186.         Color cWhite, cBlack: Locate 31, 1: Print "Press 4 to test DrawColorTileHW rooutine using 1 tileset with DoColorSwapHW using HARDWARE images...";: Do: Loop Until InKey$ = "3"
  187.     End If
  188.    
  189.     ' ================================================================================================================================================================
  190.     ' METHOD #4
  191.     ' COLOR SWAP with HARDWARE IMAGES
  192.     ' ================================================================================================================================================================
  193.     If Len(sError) = 0 Then
  194.         'DO THIS INSIDE DrawColorTileHw ROUTINE INSTEAD: imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  195.         iMinX = 1: iMaxX = 16
  196.         iMinY = 63: iMaxY = 78
  197.         iCount4 = 0
  198.         t# = ExtendedTimer + 3
  199.         imgHardwareScreen = _CopyImage(0, 33)
  200.         Do
  201.             iCount4 = iCount4 + 1
  202.             iFirstColor = iFirstColor Xor 1
  203.             iColorIndex = iFirstColor
  204.             iY = iMinY
  205.             iX = iMinX
  206.             _PutImage , imgHardwareScreen
  207.             For iTileNum = 0 To 255
  208.                 Select Case iColorIndex
  209.                     Case 0:
  210.                         fgColor = cRed: bgColor = cBlack
  211.                     Case 1:
  212.                         fgColor = cLime: bgColor = cBlack
  213.                     Case 2:
  214.                         fgColor = cBlue: bgColor = cBlack
  215.                     Case Else:
  216.                         fgColor = cYellow: bgColor = cBlack
  217.                 End Select
  218.                 DrawColorTileHw imgHardwareScreen, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  219.                
  220.                 iColorIndex = iColorIndex + 1: If iColorIndex > iLastColor Then iColorIndex = iFirstColor
  221.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  222.             Next iTileNum
  223.             _Display
  224.         Loop Until Timer > t#
  225.         _AutoDisplay
  226.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  227.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  228.         COLOR cWhite, cBlack: LOCATE 41,1 : PRINT "PRESS 5 TO SEE RESULTS..."; : Do : Loop Until InKey$="5"
  229.     End If
  230.    
  231.     ' ================================================================================================================================================================
  232.     ' SHOW RESULTS
  233.     ' ================================================================================================================================================================
  234.     Color cWhite, cBlack: Locate 33, 1
  235.     Print ""
  236.     Print "RESULTS:"
  237.     Print Using "DrawTile8       ###,###,###,###,###,### refreshes in 3 seconds."; iCount1
  238.     Print Using "DrawColorTile   ###,###,###,###,###,### refreshes in 3 seconds."; iCount2
  239.     Print Using "DrawTileHw8     ###,###,###,###,###,### refreshes in 3 seconds."; iCount3
  240.     Print Using "DrawColorTileHW ###,###,###,###,###,### refreshes in 3 seconds."; iCount4
  241.     Print "PRESS ANY KEY TO CONTINUE"
  242.     Sleep
  243.    
  244.     ' ================================================================================================================================================================
  245.     ' CLEANUP AND EXIT
  246.     ' ================================================================================================================================================================
  247.     Screen 0 ' RETURN TO TEXT SCREEN
  248.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  249.     If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  250.     If imgTiles < -1 Or imgTiles > 0 Then _FreeImage imgTiles ' FREE MEMORY
  251.     If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  252.     If imgTilesRed < -1 Or imgTilesRed > 0 Then _FreeImage imgTilesRed ' FREE MEMORY
  253.     If imgTilesGreen < -1 Or imgTilesGreen > 0 Then _FreeImage imgTilesGreen ' FREE MEMORY
  254.     If imgTilesBlue < -1 Or imgTilesBlue > 0 Then _FreeImage imgTilesBlue ' FREE MEMORY
  255.     If imgTilesYellow < -1 Or imgTilesYellow > 0 Then _FreeImage imgTilesYellow ' FREE MEMORY
  256.     If imgColorTiles < -1 Or imgColorTiles > 0 Then _FreeImage imgColorTiles ' FREE MEMORY
  257. End Sub ' DrawingSpeedTest4
  258.  
  259. ' ################################################################################################################################################################
  260. ' END DRAWING SPEED TEST
  261. ' ################################################################################################################################################################
  262.  
  263. ' ################################################################################################################################################################
  264. ' BEGIN DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  265. ' ################################################################################################################################################################
  266.  
  267. ' /////////////////////////////////////////////////////////////////////////////
  268. ' Same as DrawColorTile but using hardware images.
  269.  
  270. ' Receives:
  271. ' imgTiles& = handle to 16x16 tile sheet of 16x16 pixel tiles colored black (256 tiles)
  272. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  273. ' TileColor~& = color to use for tile
  274. ' imgScreen& = handle to screen to draw tile on
  275. ' dx% = column # to draw tile at (where each column is 16 pixels wide)
  276. ' dy% = row # to draw tile at (where each row is 16 pixels high)
  277. ' xOffset% = offset tile this many columns over
  278. ' yOffset% = offset tile this many rows down
  279.  
  280. Sub DrawColorTileHW ( _
  281.         imgHardwareScreen As Long, _
  282.         imgTiles As Long, _
  283.         iTileNum As Integer, _
  284.         fgColor As _UNSIGNED Long, _
  285.         bgColor As _UNSIGNED Long, _
  286.         dx As Integer, _
  287.         dy As Integer)
  288.        
  289.     Dim cols%
  290.     Dim rows%
  291.     Dim sc%
  292.     Dim sr%
  293.     Dim sx1%
  294.     Dim sy1%
  295.     Dim sx2%
  296.     Dim sy2%
  297.     Dim xDest%
  298.     Dim yDest%
  299.     Dim imgColorSprite As Long
  300.     Dim imgUniversalSprite As Long
  301.     Dim imgColorSpriteHW As Long
  302.         Dim imgUniversalSpriteHW As Long
  303.        
  304.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  305.     cols% = 16
  306.     rows% = 16
  307.    
  308.     ' GET THE COLUMN/ROW OF TILE # iTileNum ON THE SOURCE TILE SHEET
  309.     sc% = iTileNum Mod rows%
  310.     sr% = iTileNum \ rows%
  311.    
  312.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  313.     sx1% = sc% * 8
  314.    
  315.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  316.     sy1% = sr% * 8
  317.    
  318.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  319.     sx2% = sx1% + 7
  320.    
  321.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  322.     sy2% = sy1% + 7
  323.    
  324.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  325.     xDest% = dx * 8
  326.    
  327.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  328.     yDest% = dy * 8
  329.    
  330.     ' IS THERE A BACKGROUND COLOR?
  331.     If bgColor <> cEmpty Then
  332.         imgColorSprite = _NewImage(8, 8, 32)
  333.                 imgColorSpriteHW = _CopyImage(imgColorSprite, 33) ' Copy for hardware image
  334.         '_Dest imgColorSprite
  335.                 _Dest imgColorSpriteHW
  336.         Cls , bgColor
  337.        
  338.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  339.         '_Source imgColorSprite
  340.                 _Source imgColorSpriteHW
  341.         _Dest imgHardwareScreen
  342.        
  343.                 'SOFTWARE IMAGE:
  344.                 '_PutImage (xDest%, yDest%), imgColorSprite, imgHardwareScreen, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  345.                
  346.                 'HARDWARE IMAGE:
  347.                 _PutImage (xDest%, yDest%), imgColorSpriteHW, , (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  348.     End If
  349.    
  350.     ' CREATE A TEMPORARY TILE TO COLOR
  351.     imgUniversalSprite = _NewImage(8, 8, 32)
  352.        
  353.     ' COPY THE TILE TO THE TEMPORARY ONE
  354.     _Source imgHardwareTiles
  355.     _Dest imgUniversalSprite
  356.     'SOFTWARE IMAGE:
  357.         '_PutImage (0, 0), imgTiles, imgUniversalSprite, (sx1%, sy1%)-(sx2%, sy2%)
  358.        
  359.         'HARDWARE IMAGE:
  360.         _PutImage (0, 0), imgHardwareTiles, , (sx1%, sy1%)-(sx2%, sy2%)
  361.    
  362.     ' COLOR IN THE TEMPORARY TILE
  363.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  364.    
  365.         'SOFTWARE IMAGE:
  366.     'IF imgColorSprite < -1 OR imgColorSprite > 0 THEN _FreeImage imgColorSprite
  367.         'DoColorSwap imgUniversalSprite, cBlack, fgColor, imgColorSprite
  368.        
  369.         'HARDWARE IMAGE:
  370.         DoColorSwapHW imgUniversalSpriteHW, cBlack, fgColor, imgColorSpriteHW
  371.        
  372.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  373.     _Source imgColorSpriteHW
  374.     _Dest imgHardwareScreen
  375.        
  376.         'SOFTWARE IMAGE:
  377.     '_PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  378.    
  379.         'HARDWARE IMAGE:
  380.         _PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  381.        
  382.     ' ADDED PER FellipeHeitor
  383.         IF imgHardwareTiles < -1 OR imgHardwareTiles > 0 THEN _FreeImage imgHardwareTiles
  384.     IF imgColorSprite < -1 OR imgColorSprite > 0 THEN _FreeImage imgColorSprite
  385.     IF imgColorSpriteHW < -1 OR imgColorSpriteHW > 0 THEN _FreeImage imgColorSpriteHW
  386.     IF imgUniversalSprite < -1 OR imgUniversalSprite > 0 THEN _FreeImage imgUniversalSprite
  387.     IF imgUniversalSpriteHW < -1 OR imgUniversalSpriteHW > 0 THEN _FreeImage imgUniversalSpriteHW
  388.    
  389. End Sub ' DrawColorTileHW
  390.  
  391. ' /////////////////////////////////////////////////////////////////////////////
  392. ' Same as DoColorSwap but using hardware images.
  393.  
  394. ' Latest version with NOVARSEG's changes.
  395. ' Based on code from:
  396. ' Image color swap?
  397. ' https://www.qb64.org/forum/index.php?topic=2312.0
  398.  
  399. ' Like Function swapcolor& except returns new image in a parameter
  400. ' in case being a function causes a memory leak?
  401.  
  402. Sub DoColorSwapHW ( _
  403.         imgOriginalHW As Long, _
  404.         oldColor As _UNSIGNED Long, _
  405.         newColor As _UNSIGNED Long, _
  406.         imgNewHW As Long)
  407.        
  408.     Dim m As _MEM
  409.     Dim a As _Offset
  410.         Dim imgNew As Long
  411.        
  412.     a = 0
  413.     imgNew = _CopyImage(imgOriginalHW, 32)
  414.     m = _MemImage(imgNewHW)
  415.     Do Until a = m.SIZE - 4
  416.         a = a + 4
  417.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  418.         If c = oldColor Then
  419.             _MemPut m, m.OFFSET + a, newColor
  420.         End If
  421.     Loop
  422.     _MemFree m
  423. End Sub ' DoColorSwapHW
  424.  
  425. ' ################################################################################################################################################################
  426. ' END DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  427. ' ################################################################################################################################################################
  428.  
  429. ' ################################################################################################################################################################
  430. ' BEGIN DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  431. ' ################################################################################################################################################################
  432.  
  433. ' /////////////////////////////////////////////////////////////////////////////
  434. ' Simple version which calculates coordinates on tile sheet and destination
  435. ' screen every time. For a faster version uses precalculated coordinates,
  436. ' see DrawColorTileFast. This version does not support offsetX, offsetY.
  437.  
  438. ' Receives:
  439. ' imgScreen& = handle to screen to draw tile on
  440. ' imgTiles& = handle to 16x16 tile sheet of 8x8 pixel tiles colored black (256 tiles)
  441. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  442. ' TileColor~& = foreground color to use for tile
  443. ' BackColor~& = background color to use for tile
  444. ' dx% = column # to draw tile at (where each column is 8 pixels wide)
  445. ' dy% = row # to draw tile at (where each row is 8 pixels high)
  446.  
  447. ' Usage:
  448. ' DrawColorTile imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%
  449.  
  450. Sub DrawColorTile (imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%)
  451.     Dim cols%
  452.     Dim rows%
  453.     Dim sc%
  454.     Dim sr%
  455.     Dim sx1%
  456.     Dim sy1%
  457.     Dim sx2%
  458.     Dim sy2%
  459.     Dim xDest%
  460.     Dim yDest%
  461.     Dim ColorSprite&
  462.     Dim UniversalSprite&
  463.  
  464.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  465.     cols% = 16
  466.     rows% = 16
  467.  
  468.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  469.     sc% = TileNum% Mod rows%
  470.     sr% = TileNum% \ rows%
  471.  
  472.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  473.     sx1% = sc% * 8
  474.  
  475.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  476.     sy1% = sr% * 8
  477.  
  478.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  479.     sx2% = sx1% + 7
  480.  
  481.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  482.     sy2% = sy1% + 7
  483.  
  484.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  485.     xDest% = dx% * 8
  486.  
  487.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  488.     yDest% = dy% * 8
  489.  
  490.     ' IS THERE A BACKGROUND COLOR?
  491.     If BackColor~& <> cEmpty Then
  492.         ColorSprite& = _NewImage(8, 8, 32)
  493.         _Dest ColorSprite&
  494.         Cls , BackColor~&
  495.  
  496.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  497.         _Source ColorSprite&
  498.         _Dest imgScreen&
  499.         _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  500.     End If
  501.  
  502.     ' CREATE A TEMPORARY TILE TO COLOR
  503.     UniversalSprite& = _NewImage(8, 8, 32)
  504.  
  505.     ' COPY THE TILE TO THE TEMPORARY ONE
  506.     _Source imgTiles&
  507.     _Dest UniversalSprite&
  508.     _PutImage (0, 0), imgTiles&, UniversalSprite&, (sx1%, sy1%)-(sx2%, sy2%)
  509.  
  510.     ' COLOR IN THE TEMPORARY TILE
  511.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  512.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  513.     DoColorSwap UniversalSprite&, cBlack, TileColor~&, ColorSprite&
  514.  
  515.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  516.     _Source ColorSprite&
  517.     _Dest imgScreen&
  518.     _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  519.  
  520.     ' ADDED PER FellipeHeitor
  521.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  522.     If UniversalSprite& < -1 Or UniversalSprite& > 0 Then _FreeImage UniversalSprite&
  523. End Sub ' DrawColorTile
  524.  
  525. ' /////////////////////////////////////////////////////////////////////////////
  526. ' Latest version with NOVARSEG's changes.
  527.  
  528. ' Based on code from:
  529.  
  530. ' Image color swap?
  531. ' https://www.qb64.org/forum/index.php?topic=2312.0
  532.  
  533. ' Like Function swapcolor& except returns new image in a parameter
  534. ' in case being a function causes a memory leak?
  535.  
  536. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  537.     Dim m As _MEM
  538.     Dim a As _Offset
  539.     a = 0
  540.     imgNew& = _CopyImage(imgOriginal&, 32)
  541.     m = _MemImage(imgNew&)
  542.     Do Until a = m.SIZE - 4
  543.         a = a + 4
  544.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  545.         If c = oldcolor~& Then
  546.             _MemPut m, m.OFFSET + a, newcolor~&
  547.         End If
  548.     Loop
  549.     _MemFree m
  550. End Sub ' DoColorSwap&
  551.  
  552. ' ################################################################################################################################################################
  553. ' END DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  554. ' ################################################################################################################################################################
  555.  
  556. ' ################################################################################################################################################################
  557. ' BEGIN DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  558. ' ################################################################################################################################################################
  559.  
  560. ' /////////////////////////////////////////////////////////////////////////////
  561. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  562.  
  563. ' Original version which calculates coordinates on tile sheet and destination
  564. ' screen every time. For a faster version uses precalculated coordinates,
  565. ' see DrawTileFast.
  566.  
  567. ' tw% = tile width/height (in pixels)
  568.  
  569. ' DIV and MOD:
  570. ' c% = a% \ b% ' DIV (INTEGER DIVISION)
  571. ' d% = a% MOD b% ' MODULO (DIVISION REMAINDER)
  572.  
  573. '_PUTIMAGE (0, 0), i ' places image at upper left corner of window w/o stretching it
  574. '_PUTIMAGE (dx1, dy1), sourceHandle&, destHandle&, (sx1, sy1)-(sx2, sy2) ' portion of source to the top-left corner of the destination page
  575. '_PUTIMAGE (64,  128), imgTiles&,      imgScreen&,   (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  576. '_PutImage (64, 128), imgTiles&, imgScreen&, (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  577.  
  578. Sub DrawTile8 (imgTiles&, TileNum%, imgScreen&, dx%, dy%)
  579.     Dim tw% ' width/height of tile
  580.     Dim tw_minus1% ' width/height of tile -1
  581.     Dim cols% ' # tiles across on tile sheet
  582.     Dim rows% ' # tile rows on tile sheet
  583.     Dim sc% ' source column on tile sheet
  584.     Dim sr% ' source row on tile sheet
  585.     Dim sx1% ' source start x
  586.     Dim sx2% ' source end x
  587.     Dim sy1% ' source start y
  588.     Dim sy2% ' source end y
  589.     Dim xDest% ' destination x
  590.     Dim yDest% ' destination y
  591.  
  592.     ' SIZE OF TILE
  593.     tw% = 8
  594.     tw_minus1% = 7
  595.  
  596.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  597.     cols% = 16
  598.     rows% = 16
  599.  
  600.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  601.     sc% = TileNum% Mod rows%
  602.     sr% = TileNum% \ rows%
  603.  
  604.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  605.  
  606.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  607.     sx1% = sc% * tw%
  608.  
  609.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  610.     sy1% = sr% * tw%
  611.  
  612.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  613.     sx2% = sx1% + tw_minus1%
  614.  
  615.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  616.     sy2% = sy1% + tw_minus1%
  617.  
  618.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  619.     xDest% = dx% * tw%
  620.  
  621.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  622.     yDest% = (dy% * tw%) '+ yOffset%
  623.  
  624.     'Print "Tile#" + cstr$(TileNum%) + _
  625.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  626.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  627.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  628.  
  629.     _Dest imgScreen&
  630.  
  631.     ' portion of source to the top-left corner of the destination page
  632.     _PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  633.  
  634. End Sub ' DrawTile8
  635.  
  636. ' ################################################################################################################################################################
  637. ' END DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  638. ' ################################################################################################################################################################
  639.  
  640. ' ################################################################################################################################################################
  641. ' BEGIN DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  642. ' ################################################################################################################################################################
  643.  
  644. ' /////////////////////////////////////////////////////////////////////////////
  645. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  646. ' using hardware images
  647.  
  648. ' Usage:
  649. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  650. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  651. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  652.  
  653. Sub DrawTileHw8 (imgHardwareTiles&, TileNum%, imgScreen&, dx%, dy%, iSubTileset%)
  654.     Dim tw% ' width/height of tile
  655.     Dim tw_minus1% ' width/height of tile -1
  656.     Dim cols% ' # tiles across on tile sheet
  657.     Dim rows% ' # tile rows on tile sheet
  658.     Dim sc% ' source column on tile sheet
  659.     Dim sr% ' source row on tile sheet
  660.     Dim sx1% ' source start x
  661.     Dim sx2% ' source end x
  662.     Dim sy1% ' source start y
  663.     Dim sy2% ' source end y
  664.     Dim xDest% ' destination x
  665.     Dim yDest% ' destination y
  666.     Dim xOffset%
  667.  
  668.     ' CALCULATE OFFSET
  669.     xOffset% = 128 * iSubTileset%
  670.  
  671.     ' SIZE OF TILE
  672.     tw% = 8
  673.     tw_minus1% = 7
  674.  
  675.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  676.     cols% = 16
  677.     rows% = 16
  678.  
  679.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  680.     sc% = TileNum% Mod rows%
  681.     sr% = TileNum% \ rows%
  682.  
  683.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  684.  
  685.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  686.     sx1% = (sc% * tw%) + xOffset%
  687.  
  688.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  689.     sy1% = sr% * tw%
  690.  
  691.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  692.     sx2% = sx1% + tw_minus1%
  693.  
  694.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  695.     sy2% = sy1% + tw_minus1%
  696.  
  697.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  698.     xDest% = dx% * tw%
  699.  
  700.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  701.     yDest% = (dy% * tw%) '+ yOffset%
  702.  
  703.     'Print "Tile#" + cstr$(TileNum%) + _
  704.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  705.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  706.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  707.  
  708.     _Dest imgScreen&
  709.  
  710.     ' portion of source to the top-left corner of the destination page
  711.     '_PutImage (xDest%, yDest%), imgHardwareTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  712.     '_PutImage (200, 100)-Step(100, 100), imgHardwareTiles&, , (0, 0)-(40, 40)
  713.     _PutImage (xDest%, yDest%), imgHardwareTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  714.  
  715. End Sub ' DrawTileHw8
  716.  
  717. ' /////////////////////////////////////////////////////////////////////////////
  718. ' Receives an image imgTiles of 8x8 tiles
  719. ' colored black on transparent background
  720. ' and returns a new image imgNew
  721. ' copied from the tiles in imgTiles,
  722. ' except colored to foreground color fgColor,
  723. ' and background color bgColor
  724.  
  725. ' Usage:
  726. ' MakeColoredTileset imgTiles, imgNew, fgColor, bgColor
  727.  
  728. Sub MakeColoredTileset (imgTiles As Long, imgNew As Long, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  729.     Dim iTileNum As Integer
  730.     Dim iY As Integer
  731.     Dim iX As Integer
  732.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  733.     imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  734.     iTileNum = 0
  735.     For iY = 0 To (_Height(imgTiles) \ 8) - 1
  736.         For iX = 0 To (_Width(imgTiles) \ 8) - 1
  737.             DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  738.             iTileNum = iTileNum + 1
  739.             If iTileNum > 255 Then Exit For
  740.         Next iX
  741.         If iTileNum > 255 Then Exit For
  742.     Next iY
  743. End Sub ' MakeColoredTileset
  744.  
  745. ' ################################################################################################################################################################
  746. ' END DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  747. ' ################################################################################################################################################################
  748.  
  749. ' ################################################################################################################################################################
  750. ' BEGIN TILE DEFINITIONS
  751. ' ################################################################################################################################################################
  752.  
  753. ' /////////////////////////////////////////////////////////////////////////////
  754. ' Loads tileset of 256 8x8 tiles into a 128x128 image (16 columns x 16 rows)
  755. ' where tiles are a single color.
  756.  
  757. ' Parameters:
  758. ' imgTiles& = contains the resulting tileset image
  759. ' fgColor = tile color
  760. ' bgColor = tile background color
  761.  
  762. Function GetTiles$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  763.     Dim RoutineName As String: RoutineName = "GetTiles$"
  764.     Dim sResult As String: sResult = ""
  765.     ReDim arrTileText(0 To 255) As String
  766.  
  767.     Dim iTileNum As Integer
  768.  
  769.     ReDim arrLines(-1) As String
  770.     Dim iFromX As Integer
  771.     Dim iFromY As Integer
  772.     Dim sLine As String
  773.     Dim sChar As String
  774.  
  775.     Dim iTileX As Integer
  776.     Dim iTileY As Integer
  777.     Dim iToX As Integer
  778.     Dim iToY As Integer
  779.     Dim pixelColor As _Unsigned Long
  780.     Dim bFinished As Integer
  781.  
  782.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  783.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  784.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  785.     imgTiles& = _NewImage(128, 128, 32)
  786.     '    Cls , cEmpty ' set the background color as transparent
  787.  
  788.     'Screen imgTiles&
  789.     'Cls , bgColor ' set the background color as transparent
  790.     _Dest imgTiles&
  791.     'DrawRect 0, 0, 128, 128, cEmpty
  792.     'DrawBox 0, 0, 128, cWhite
  793.     Cls , cEmpty ' set the background color as transparent
  794.  
  795.     GetTileText arrTileText()
  796.     iTileX = 0
  797.     iTileY = 0
  798.     bFinished = FALSE
  799.     For iTileNum = 0 To 255
  800.         split arrTileText(iTileNum), Chr$(13), arrLines()
  801.         iToY = iTileY * 8
  802.         If (iToY > _Height(imgTiles&)) Then
  803.             sResult = "iToY value " + cstr$(iToY) + " " + _
  804.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  805.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  806.             bFinished = TRUE
  807.             Exit For
  808.         End If
  809.  
  810.         For iFromY = LBound(arrLines) To UBound(arrLines)
  811.             sLine = arrLines(iFromY)
  812.             If Len(sLine) > 0 Then
  813.                 iToX = iTileX * 8
  814.                 For iFromX = 1 To Len(sLine)
  815.                     sChar = Mid$(sLine, iFromX, 1)
  816.                     If sChar = "." Then
  817.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  818.                     Else
  819.                         pixelColor = fgColor ' cBlack
  820.                     End If
  821.                     PSet (iToX, iToY), pixelColor
  822.                     iToX = iToX + 1
  823.                     If (iToX > _Width(imgTiles&)) Then
  824.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  825.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  826.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  827.                         bFinished = TRUE
  828.                         Exit For
  829.                     End If
  830.                 Next iFromX
  831.                 iToY = iToY + 1
  832.                 If bFinished = TRUE Then Exit For
  833.             End If
  834.         Next iFromY
  835.         If bFinished = TRUE Then Exit For
  836.  
  837.         iTileX = iTileX + 1
  838.         If iTileX > 15 Then
  839.             iTileX = 0
  840.             iTileY = iTileY + 1
  841.             'if iTileY > 15 then
  842.             '    sResult = "Exceeded max 16 rows of tiles." + _
  843.             '        "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  844.             '    bFinished = TRUE
  845.             '    exit for
  846.             'end if
  847.         End If
  848.     Next iTileNum
  849.  
  850.     GetTiles$ = sResult
  851. End Function ' GetTiles$
  852.  
  853. ' /////////////////////////////////////////////////////////////////////////////
  854. ' Returns an array of 256 8x8 tiles defined in text
  855. ' where each tile is defined by "." as blank and anything else is a pixel
  856. ' and each row is delimited by chr$(13)
  857.  
  858. Sub GetTileText (arrTileText() As String)
  859.     ReDim arrTileText(0 To 255) As String
  860.  
  861.     m$ = ""
  862.     m$ = m$ + "22....22" + Chr$(13)
  863.     m$ = m$ + "2..22..2" + Chr$(13)
  864.     m$ = m$ + "2..2...2" + Chr$(13)
  865.     m$ = m$ + "2...2..2" + Chr$(13)
  866.     m$ = m$ + "2..22..2" + Chr$(13)
  867.     m$ = m$ + "2..22..2" + Chr$(13)
  868.     m$ = m$ + "22....22" + Chr$(13)
  869.     m$ = m$ + "22222222" + Chr$(13)
  870.     arrTileText(0) = m$
  871.  
  872.     m$ = ""
  873.     m$ = m$ + "........" + Chr$(13)
  874.     m$ = m$ + "........" + Chr$(13)
  875.     m$ = m$ + "........" + Chr$(13)
  876.     m$ = m$ + "........" + Chr$(13)
  877.     m$ = m$ + "........" + Chr$(13)
  878.     m$ = m$ + "........" + Chr$(13)
  879.     m$ = m$ + "........" + Chr$(13)
  880.     m$ = m$ + "........" + Chr$(13)
  881.     arrTileText(1) = m$
  882.  
  883.     m$ = ""
  884.     m$ = m$ + "........" + Chr$(13)
  885.     m$ = m$ + "........" + Chr$(13)
  886.     m$ = m$ + "........" + Chr$(13)
  887.     m$ = m$ + "........" + Chr$(13)
  888.     m$ = m$ + "........" + Chr$(13)
  889.     m$ = m$ + "........" + Chr$(13)
  890.     m$ = m$ + "........" + Chr$(13)
  891.     m$ = m$ + "........" + Chr$(13)
  892.     arrTileText(2) = m$
  893.  
  894.     m$ = ""
  895.     m$ = m$ + "........" + Chr$(13)
  896.     m$ = m$ + "........" + Chr$(13)
  897.     m$ = m$ + "........" + Chr$(13)
  898.     m$ = m$ + "........" + Chr$(13)
  899.     m$ = m$ + "........" + Chr$(13)
  900.     m$ = m$ + "........" + Chr$(13)
  901.     m$ = m$ + "........" + Chr$(13)
  902.     m$ = m$ + "........" + Chr$(13)
  903.     arrTileText(3) = m$
  904.  
  905.     m$ = ""
  906.     m$ = m$ + "........" + Chr$(13)
  907.     m$ = m$ + "........" + Chr$(13)
  908.     m$ = m$ + "........" + Chr$(13)
  909.     m$ = m$ + "........" + Chr$(13)
  910.     m$ = m$ + "........" + Chr$(13)
  911.     m$ = m$ + "........" + Chr$(13)
  912.     m$ = m$ + "........" + Chr$(13)
  913.     m$ = m$ + "........" + Chr$(13)
  914.     arrTileText(4) = m$
  915.  
  916.     m$ = ""
  917.     m$ = m$ + "........" + Chr$(13)
  918.     m$ = m$ + "........" + Chr$(13)
  919.     m$ = m$ + "........" + Chr$(13)
  920.     m$ = m$ + "........" + Chr$(13)
  921.     m$ = m$ + "........" + Chr$(13)
  922.     m$ = m$ + "........" + Chr$(13)
  923.     m$ = m$ + "........" + Chr$(13)
  924.     m$ = m$ + "........" + Chr$(13)
  925.     arrTileText(5) = m$
  926.  
  927.     m$ = ""
  928.     m$ = m$ + "........" + Chr$(13)
  929.     m$ = m$ + "........" + Chr$(13)
  930.     m$ = m$ + "........" + Chr$(13)
  931.     m$ = m$ + "........" + Chr$(13)
  932.     m$ = m$ + "........" + Chr$(13)
  933.     m$ = m$ + "........" + Chr$(13)
  934.     m$ = m$ + "........" + Chr$(13)
  935.     m$ = m$ + "........" + Chr$(13)
  936.     arrTileText(6) = m$
  937.  
  938.     m$ = ""
  939.     m$ = m$ + "........" + Chr$(13)
  940.     m$ = m$ + "........" + Chr$(13)
  941.     m$ = m$ + "........" + Chr$(13)
  942.     m$ = m$ + "........" + Chr$(13)
  943.     m$ = m$ + "........" + Chr$(13)
  944.     m$ = m$ + "........" + Chr$(13)
  945.     m$ = m$ + "........" + Chr$(13)
  946.     m$ = m$ + "........" + Chr$(13)
  947.     arrTileText(7) = m$
  948.  
  949.     m$ = ""
  950.     m$ = m$ + "........" + Chr$(13)
  951.     m$ = m$ + "........" + Chr$(13)
  952.     m$ = m$ + "........" + Chr$(13)
  953.     m$ = m$ + "........" + Chr$(13)
  954.     m$ = m$ + "........" + Chr$(13)
  955.     m$ = m$ + "........" + Chr$(13)
  956.     m$ = m$ + "........" + Chr$(13)
  957.     m$ = m$ + "........" + Chr$(13)
  958.     arrTileText(8) = m$
  959.  
  960.     m$ = ""
  961.     m$ = m$ + "........" + Chr$(13)
  962.     m$ = m$ + "........" + Chr$(13)
  963.     m$ = m$ + "........" + Chr$(13)
  964.     m$ = m$ + "........" + Chr$(13)
  965.     m$ = m$ + "........" + Chr$(13)
  966.     m$ = m$ + "........" + Chr$(13)
  967.     m$ = m$ + "........" + Chr$(13)
  968.     m$ = m$ + "........" + Chr$(13)
  969.     arrTileText(9) = m$
  970.  
  971.     m$ = ""
  972.     m$ = m$ + "........" + Chr$(13)
  973.     m$ = m$ + "........" + Chr$(13)
  974.     m$ = m$ + "........" + Chr$(13)
  975.     m$ = m$ + "........" + Chr$(13)
  976.     m$ = m$ + "........" + Chr$(13)
  977.     m$ = m$ + "........" + Chr$(13)
  978.     m$ = m$ + "........" + Chr$(13)
  979.     m$ = m$ + "........" + Chr$(13)
  980.     arrTileText(10) = m$
  981.  
  982.     m$ = ""
  983.     m$ = m$ + "........" + Chr$(13)
  984.     m$ = m$ + "........" + Chr$(13)
  985.     m$ = m$ + "........" + Chr$(13)
  986.     m$ = m$ + "........" + Chr$(13)
  987.     m$ = m$ + "........" + Chr$(13)
  988.     m$ = m$ + "........" + Chr$(13)
  989.     m$ = m$ + "........" + Chr$(13)
  990.     m$ = m$ + "........" + Chr$(13)
  991.     arrTileText(11) = m$
  992.  
  993.     m$ = ""
  994.     m$ = m$ + "........" + Chr$(13)
  995.     m$ = m$ + "........" + Chr$(13)
  996.     m$ = m$ + "........" + Chr$(13)
  997.     m$ = m$ + "........" + Chr$(13)
  998.     m$ = m$ + "........" + Chr$(13)
  999.     m$ = m$ + "........" + Chr$(13)
  1000.     m$ = m$ + "........" + Chr$(13)
  1001.     m$ = m$ + "........" + Chr$(13)
  1002.     arrTileText(12) = m$
  1003.  
  1004.     m$ = ""
  1005.     m$ = m$ + "........" + Chr$(13)
  1006.     m$ = m$ + "........" + Chr$(13)
  1007.     m$ = m$ + "........" + Chr$(13)
  1008.     m$ = m$ + "........" + Chr$(13)
  1009.     m$ = m$ + "........" + Chr$(13)
  1010.     m$ = m$ + "........" + Chr$(13)
  1011.     m$ = m$ + "........" + Chr$(13)
  1012.     m$ = m$ + "........" + Chr$(13)
  1013.     arrTileText(13) = m$
  1014.  
  1015.     m$ = ""
  1016.     m$ = m$ + "........" + Chr$(13)
  1017.     m$ = m$ + "........" + Chr$(13)
  1018.     m$ = m$ + "........" + Chr$(13)
  1019.     m$ = m$ + "........" + Chr$(13)
  1020.     m$ = m$ + "........" + Chr$(13)
  1021.     m$ = m$ + "........" + Chr$(13)
  1022.     m$ = m$ + "........" + Chr$(13)
  1023.     m$ = m$ + "........" + Chr$(13)
  1024.     arrTileText(14) = m$
  1025.  
  1026.     m$ = ""
  1027.     m$ = m$ + "........" + Chr$(13)
  1028.     m$ = m$ + "........" + Chr$(13)
  1029.     m$ = m$ + "........" + Chr$(13)
  1030.     m$ = m$ + "........" + Chr$(13)
  1031.     m$ = m$ + "........" + Chr$(13)
  1032.     m$ = m$ + "........" + Chr$(13)
  1033.     m$ = m$ + "........" + Chr$(13)
  1034.     m$ = m$ + "........" + Chr$(13)
  1035.     arrTileText(15) = m$
  1036.  
  1037.     m$ = ""
  1038.     m$ = m$ + "........" + Chr$(13)
  1039.     m$ = m$ + "........" + Chr$(13)
  1040.     m$ = m$ + "........" + Chr$(13)
  1041.     m$ = m$ + "........" + Chr$(13)
  1042.     m$ = m$ + "........" + Chr$(13)
  1043.     m$ = m$ + "........" + Chr$(13)
  1044.     m$ = m$ + "........" + Chr$(13)
  1045.     m$ = m$ + "........" + Chr$(13)
  1046.     arrTileText(16) = m$
  1047.  
  1048.     m$ = ""
  1049.     m$ = m$ + "........" + Chr$(13)
  1050.     m$ = m$ + "........" + Chr$(13)
  1051.     m$ = m$ + "........" + Chr$(13)
  1052.     m$ = m$ + "........" + Chr$(13)
  1053.     m$ = m$ + "........" + Chr$(13)
  1054.     m$ = m$ + "........" + Chr$(13)
  1055.     m$ = m$ + "........" + Chr$(13)
  1056.     m$ = m$ + "........" + Chr$(13)
  1057.     arrTileText(17) = m$
  1058.  
  1059.     m$ = ""
  1060.     m$ = m$ + "........" + Chr$(13)
  1061.     m$ = m$ + "........" + Chr$(13)
  1062.     m$ = m$ + "........" + Chr$(13)
  1063.     m$ = m$ + "........" + Chr$(13)
  1064.     m$ = m$ + "........" + Chr$(13)
  1065.     m$ = m$ + "........" + Chr$(13)
  1066.     m$ = m$ + "........" + Chr$(13)
  1067.     m$ = m$ + "........" + Chr$(13)
  1068.     arrTileText(18) = m$
  1069.  
  1070.     m$ = ""
  1071.     m$ = m$ + "........" + Chr$(13)
  1072.     m$ = m$ + "........" + Chr$(13)
  1073.     m$ = m$ + "........" + Chr$(13)
  1074.     m$ = m$ + "........" + Chr$(13)
  1075.     m$ = m$ + "........" + Chr$(13)
  1076.     m$ = m$ + "........" + Chr$(13)
  1077.     m$ = m$ + "........" + Chr$(13)
  1078.     m$ = m$ + "........" + Chr$(13)
  1079.     arrTileText(19) = m$
  1080.  
  1081.     m$ = ""
  1082.     m$ = m$ + "........" + Chr$(13)
  1083.     m$ = m$ + "........" + Chr$(13)
  1084.     m$ = m$ + "........" + Chr$(13)
  1085.     m$ = m$ + "........" + Chr$(13)
  1086.     m$ = m$ + "........" + Chr$(13)
  1087.     m$ = m$ + "........" + Chr$(13)
  1088.     m$ = m$ + "........" + Chr$(13)
  1089.     m$ = m$ + "........" + Chr$(13)
  1090.     arrTileText(20) = m$
  1091.  
  1092.     m$ = ""
  1093.     m$ = m$ + "........" + Chr$(13)
  1094.     m$ = m$ + "........" + Chr$(13)
  1095.     m$ = m$ + "........" + Chr$(13)
  1096.     m$ = m$ + "........" + Chr$(13)
  1097.     m$ = m$ + "........" + Chr$(13)
  1098.     m$ = m$ + "........" + Chr$(13)
  1099.     m$ = m$ + "........" + Chr$(13)
  1100.     m$ = m$ + "........" + Chr$(13)
  1101.     arrTileText(21) = m$
  1102.  
  1103.     m$ = ""
  1104.     m$ = m$ + "........" + Chr$(13)
  1105.     m$ = m$ + "........" + Chr$(13)
  1106.     m$ = m$ + "........" + Chr$(13)
  1107.     m$ = m$ + "........" + Chr$(13)
  1108.     m$ = m$ + "........" + Chr$(13)
  1109.     m$ = m$ + "........" + Chr$(13)
  1110.     m$ = m$ + "........" + Chr$(13)
  1111.     m$ = m$ + "........" + Chr$(13)
  1112.     arrTileText(22) = m$
  1113.  
  1114.     m$ = ""
  1115.     m$ = m$ + "........" + Chr$(13)
  1116.     m$ = m$ + "........" + Chr$(13)
  1117.     m$ = m$ + "........" + Chr$(13)
  1118.     m$ = m$ + "........" + Chr$(13)
  1119.     m$ = m$ + "........" + Chr$(13)
  1120.     m$ = m$ + "........" + Chr$(13)
  1121.     m$ = m$ + "........" + Chr$(13)
  1122.     m$ = m$ + "........" + Chr$(13)
  1123.     arrTileText(23) = m$
  1124.  
  1125.     m$ = ""
  1126.     m$ = m$ + "........" + Chr$(13)
  1127.     m$ = m$ + "........" + Chr$(13)
  1128.     m$ = m$ + "........" + Chr$(13)
  1129.     m$ = m$ + "........" + Chr$(13)
  1130.     m$ = m$ + "........" + Chr$(13)
  1131.     m$ = m$ + "........" + Chr$(13)
  1132.     m$ = m$ + "........" + Chr$(13)
  1133.     m$ = m$ + "........" + Chr$(13)
  1134.     arrTileText(24) = m$
  1135.  
  1136.     m$ = ""
  1137.     m$ = m$ + "........" + Chr$(13)
  1138.     m$ = m$ + "........" + Chr$(13)
  1139.     m$ = m$ + "........" + Chr$(13)
  1140.     m$ = m$ + "........" + Chr$(13)
  1141.     m$ = m$ + "........" + Chr$(13)
  1142.     m$ = m$ + "........" + Chr$(13)
  1143.     m$ = m$ + "........" + Chr$(13)
  1144.     m$ = m$ + "........" + Chr$(13)
  1145.     arrTileText(25) = m$
  1146.  
  1147.     m$ = ""
  1148.     m$ = m$ + "........" + Chr$(13)
  1149.     m$ = m$ + "........" + Chr$(13)
  1150.     m$ = m$ + "........" + Chr$(13)
  1151.     m$ = m$ + "........" + Chr$(13)
  1152.     m$ = m$ + "........" + Chr$(13)
  1153.     m$ = m$ + "........" + Chr$(13)
  1154.     m$ = m$ + "........" + Chr$(13)
  1155.     m$ = m$ + "........" + Chr$(13)
  1156.     arrTileText(26) = m$
  1157.  
  1158.     m$ = ""
  1159.     m$ = m$ + "........" + Chr$(13)
  1160.     m$ = m$ + "........" + Chr$(13)
  1161.     m$ = m$ + "........" + Chr$(13)
  1162.     m$ = m$ + "........" + Chr$(13)
  1163.     m$ = m$ + "........" + Chr$(13)
  1164.     m$ = m$ + "........" + Chr$(13)
  1165.     m$ = m$ + "........" + Chr$(13)
  1166.     m$ = m$ + "........" + Chr$(13)
  1167.     arrTileText(27) = m$
  1168.  
  1169.     m$ = ""
  1170.     m$ = m$ + "........" + Chr$(13)
  1171.     m$ = m$ + "........" + Chr$(13)
  1172.     m$ = m$ + "........" + Chr$(13)
  1173.     m$ = m$ + "........" + Chr$(13)
  1174.     m$ = m$ + "........" + Chr$(13)
  1175.     m$ = m$ + "........" + Chr$(13)
  1176.     m$ = m$ + "........" + Chr$(13)
  1177.     m$ = m$ + "........" + Chr$(13)
  1178.     arrTileText(28) = m$
  1179.  
  1180.     m$ = ""
  1181.     m$ = m$ + "........" + Chr$(13)
  1182.     m$ = m$ + "........" + Chr$(13)
  1183.     m$ = m$ + "........" + Chr$(13)
  1184.     m$ = m$ + "........" + Chr$(13)
  1185.     m$ = m$ + "........" + Chr$(13)
  1186.     m$ = m$ + "........" + Chr$(13)
  1187.     m$ = m$ + "........" + Chr$(13)
  1188.     m$ = m$ + "........" + Chr$(13)
  1189.     arrTileText(29) = m$
  1190.  
  1191.     m$ = ""
  1192.     m$ = m$ + "........" + Chr$(13)
  1193.     m$ = m$ + "........" + Chr$(13)
  1194.     m$ = m$ + "........" + Chr$(13)
  1195.     m$ = m$ + "........" + Chr$(13)
  1196.     m$ = m$ + "........" + Chr$(13)
  1197.     m$ = m$ + "........" + Chr$(13)
  1198.     m$ = m$ + "........" + Chr$(13)
  1199.     m$ = m$ + "........" + Chr$(13)
  1200.     arrTileText(30) = m$
  1201.  
  1202.     m$ = ""
  1203.     m$ = m$ + "........" + Chr$(13)
  1204.     m$ = m$ + "........" + Chr$(13)
  1205.     m$ = m$ + "........" + Chr$(13)
  1206.     m$ = m$ + "........" + Chr$(13)
  1207.     m$ = m$ + "........" + Chr$(13)
  1208.     m$ = m$ + "........" + Chr$(13)
  1209.     m$ = m$ + "........" + Chr$(13)
  1210.     m$ = m$ + "........" + Chr$(13)
  1211.     arrTileText(31) = m$
  1212.  
  1213.     m$ = ""
  1214.     m$ = m$ + "........" + Chr$(13)
  1215.     m$ = m$ + "........" + Chr$(13)
  1216.     m$ = m$ + "........" + Chr$(13)
  1217.     m$ = m$ + "........" + Chr$(13)
  1218.     m$ = m$ + "........" + Chr$(13)
  1219.     m$ = m$ + "........" + Chr$(13)
  1220.     m$ = m$ + "........" + Chr$(13)
  1221.     m$ = m$ + "........" + Chr$(13)
  1222.     arrTileText(32) = m$
  1223.  
  1224.     m$ = ""
  1225.     m$ = m$ + "...22..." + Chr$(13)
  1226.     m$ = m$ + "...22..." + Chr$(13)
  1227.     m$ = m$ + "...22..." + Chr$(13)
  1228.     m$ = m$ + "...22..." + Chr$(13)
  1229.     m$ = m$ + "........" + Chr$(13)
  1230.     m$ = m$ + "........" + Chr$(13)
  1231.     m$ = m$ + "...22..." + Chr$(13)
  1232.     m$ = m$ + "........" + Chr$(13)
  1233.     arrTileText(33) = m$
  1234.  
  1235.     m$ = ""
  1236.     m$ = m$ + ".22..22." + Chr$(13)
  1237.     m$ = m$ + ".22..22." + Chr$(13)
  1238.     m$ = m$ + ".22..22." + Chr$(13)
  1239.     m$ = m$ + "........" + Chr$(13)
  1240.     m$ = m$ + "........" + Chr$(13)
  1241.     m$ = m$ + "........" + Chr$(13)
  1242.     m$ = m$ + "........" + Chr$(13)
  1243.     m$ = m$ + "........" + Chr$(13)
  1244.     arrTileText(34) = m$
  1245.  
  1246.     m$ = ""
  1247.     m$ = m$ + ".22..22." + Chr$(13)
  1248.     m$ = m$ + ".22..22." + Chr$(13)
  1249.     m$ = m$ + "22222222" + Chr$(13)
  1250.     m$ = m$ + ".22..22." + Chr$(13)
  1251.     m$ = m$ + "22222222" + Chr$(13)
  1252.     m$ = m$ + ".22..22." + Chr$(13)
  1253.     m$ = m$ + ".22..22." + Chr$(13)
  1254.     m$ = m$ + "........" + Chr$(13)
  1255.     arrTileText(35) = m$
  1256.  
  1257.     m$ = ""
  1258.     m$ = m$ + "...22..." + Chr$(13)
  1259.     m$ = m$ + "..22222." + Chr$(13)
  1260.     m$ = m$ + ".22....." + Chr$(13)
  1261.     m$ = m$ + "..2222.." + Chr$(13)
  1262.     m$ = m$ + ".....22." + Chr$(13)
  1263.     m$ = m$ + ".22222.." + Chr$(13)
  1264.     m$ = m$ + "...22..." + Chr$(13)
  1265.     m$ = m$ + "........" + Chr$(13)
  1266.     arrTileText(36) = m$
  1267.  
  1268.     m$ = ""
  1269.     m$ = m$ + ".22...2." + Chr$(13)
  1270.     m$ = m$ + ".22..22." + Chr$(13)
  1271.     m$ = m$ + "....22.." + Chr$(13)
  1272.     m$ = m$ + "...22..." + Chr$(13)
  1273.     m$ = m$ + "..22...." + Chr$(13)
  1274.     m$ = m$ + ".22..22." + Chr$(13)
  1275.     m$ = m$ + ".2...22." + Chr$(13)
  1276.     m$ = m$ + "........" + Chr$(13)
  1277.     arrTileText(37) = m$
  1278.  
  1279.     m$ = ""
  1280.     m$ = m$ + "..2222.." + Chr$(13)
  1281.     m$ = m$ + ".22..22." + Chr$(13)
  1282.     m$ = m$ + "..2222.." + Chr$(13)
  1283.     m$ = m$ + "..222..." + Chr$(13)
  1284.     m$ = m$ + ".22..222" + Chr$(13)
  1285.     m$ = m$ + ".22..22." + Chr$(13)
  1286.     m$ = m$ + "..222222" + Chr$(13)
  1287.     m$ = m$ + "........" + Chr$(13)
  1288.     arrTileText(38) = m$
  1289.  
  1290.     m$ = ""
  1291.     m$ = m$ + ".....22." + Chr$(13)
  1292.     m$ = m$ + "....22.." + Chr$(13)
  1293.     m$ = m$ + "...22..." + Chr$(13)
  1294.     m$ = m$ + "........" + Chr$(13)
  1295.     m$ = m$ + "........" + Chr$(13)
  1296.     m$ = m$ + "........" + Chr$(13)
  1297.     m$ = m$ + "........" + Chr$(13)
  1298.     m$ = m$ + "........" + Chr$(13)
  1299.     arrTileText(39) = m$
  1300.  
  1301.     m$ = ""
  1302.     m$ = m$ + "....22.." + Chr$(13)
  1303.     m$ = m$ + "...22..." + Chr$(13)
  1304.     m$ = m$ + "..22...." + Chr$(13)
  1305.     m$ = m$ + "..22...." + Chr$(13)
  1306.     m$ = m$ + "..22...." + Chr$(13)
  1307.     m$ = m$ + "...22..." + Chr$(13)
  1308.     m$ = m$ + "....22.." + Chr$(13)
  1309.     m$ = m$ + "........" + Chr$(13)
  1310.     arrTileText(40) = m$
  1311.  
  1312.     m$ = ""
  1313.     m$ = m$ + "..22...." + Chr$(13)
  1314.     m$ = m$ + "...22..." + Chr$(13)
  1315.     m$ = m$ + "....22.." + Chr$(13)
  1316.     m$ = m$ + "....22.." + Chr$(13)
  1317.     m$ = m$ + "....22.." + Chr$(13)
  1318.     m$ = m$ + "...22..." + Chr$(13)
  1319.     m$ = m$ + "..22...." + Chr$(13)
  1320.     m$ = m$ + "........" + Chr$(13)
  1321.     arrTileText(41) = m$
  1322.  
  1323.     m$ = ""
  1324.     m$ = m$ + "........" + Chr$(13)
  1325.     m$ = m$ + ".22..22." + Chr$(13)
  1326.     m$ = m$ + "..2222.." + Chr$(13)
  1327.     m$ = m$ + "22222222" + Chr$(13)
  1328.     m$ = m$ + "..2222.." + Chr$(13)
  1329.     m$ = m$ + ".22..22." + Chr$(13)
  1330.     m$ = m$ + "........" + Chr$(13)
  1331.     m$ = m$ + "........" + Chr$(13)
  1332.     arrTileText(42) = m$
  1333.  
  1334.     m$ = ""
  1335.     m$ = m$ + "........" + Chr$(13)
  1336.     m$ = m$ + "...22..." + Chr$(13)
  1337.     m$ = m$ + "...22..." + Chr$(13)
  1338.     m$ = m$ + ".222222." + Chr$(13)
  1339.     m$ = m$ + "...22..." + Chr$(13)
  1340.     m$ = m$ + "...22..." + Chr$(13)
  1341.     m$ = m$ + "........" + Chr$(13)
  1342.     m$ = m$ + "........" + Chr$(13)
  1343.     arrTileText(43) = m$
  1344.  
  1345.     m$ = ""
  1346.     m$ = m$ + "........" + Chr$(13)
  1347.     m$ = m$ + "........" + Chr$(13)
  1348.     m$ = m$ + "........" + Chr$(13)
  1349.     m$ = m$ + "........" + Chr$(13)
  1350.     m$ = m$ + "........" + Chr$(13)
  1351.     m$ = m$ + "...22..." + Chr$(13)
  1352.     m$ = m$ + "...22..." + Chr$(13)
  1353.     m$ = m$ + "..22...." + Chr$(13)
  1354.     arrTileText(44) = m$
  1355.  
  1356.     m$ = ""
  1357.     m$ = m$ + "........" + Chr$(13)
  1358.     m$ = m$ + "........" + Chr$(13)
  1359.     m$ = m$ + "........" + Chr$(13)
  1360.     m$ = m$ + ".222222." + Chr$(13)
  1361.     m$ = m$ + "........" + Chr$(13)
  1362.     m$ = m$ + "........" + Chr$(13)
  1363.     m$ = m$ + "........" + Chr$(13)
  1364.     m$ = m$ + "........" + Chr$(13)
  1365.     arrTileText(45) = m$
  1366.  
  1367.     m$ = ""
  1368.     m$ = m$ + "........" + Chr$(13)
  1369.     m$ = m$ + "........" + Chr$(13)
  1370.     m$ = m$ + "........" + Chr$(13)
  1371.     m$ = m$ + "........" + Chr$(13)
  1372.     m$ = m$ + "........" + Chr$(13)
  1373.     m$ = m$ + "...22..." + Chr$(13)
  1374.     m$ = m$ + "...22..." + Chr$(13)
  1375.     m$ = m$ + "........" + Chr$(13)
  1376.     arrTileText(46) = m$
  1377.  
  1378.     m$ = ""
  1379.     m$ = m$ + "........" + Chr$(13)
  1380.     m$ = m$ + "......22" + Chr$(13)
  1381.     m$ = m$ + ".....22." + Chr$(13)
  1382.     m$ = m$ + "....22.." + Chr$(13)
  1383.     m$ = m$ + "...22..." + Chr$(13)
  1384.     m$ = m$ + "..22...." + Chr$(13)
  1385.     m$ = m$ + ".22....." + Chr$(13)
  1386.     m$ = m$ + "........" + Chr$(13)
  1387.     arrTileText(47) = m$
  1388.  
  1389.     m$ = ""
  1390.     m$ = m$ + "..2222.." + Chr$(13)
  1391.     m$ = m$ + ".22..22." + Chr$(13)
  1392.     m$ = m$ + ".22.222." + Chr$(13)
  1393.     m$ = m$ + ".222.22." + Chr$(13)
  1394.     m$ = m$ + ".22..22." + Chr$(13)
  1395.     m$ = m$ + ".22..22." + Chr$(13)
  1396.     m$ = m$ + "..2222.." + Chr$(13)
  1397.     m$ = m$ + "........" + Chr$(13)
  1398.     arrTileText(48) = m$
  1399.  
  1400.     m$ = ""
  1401.     m$ = m$ + "...22..." + Chr$(13)
  1402.     m$ = m$ + "...22..." + Chr$(13)
  1403.     m$ = m$ + "..222..." + Chr$(13)
  1404.     m$ = m$ + "...22..." + Chr$(13)
  1405.     m$ = m$ + "...22..." + Chr$(13)
  1406.     m$ = m$ + "...22..." + Chr$(13)
  1407.     m$ = m$ + ".222222." + Chr$(13)
  1408.     m$ = m$ + "........" + Chr$(13)
  1409.     arrTileText(49) = m$
  1410.  
  1411.     m$ = ""
  1412.     m$ = m$ + "..2222.." + Chr$(13)
  1413.     m$ = m$ + ".22..22." + Chr$(13)
  1414.     m$ = m$ + ".....22." + Chr$(13)
  1415.     m$ = m$ + "....22.." + Chr$(13)
  1416.     m$ = m$ + "..22...." + Chr$(13)
  1417.     m$ = m$ + ".22....." + Chr$(13)
  1418.     m$ = m$ + ".222222." + Chr$(13)
  1419.     m$ = m$ + "........" + Chr$(13)
  1420.     arrTileText(50) = m$
  1421.  
  1422.     m$ = ""
  1423.     m$ = m$ + "..2222.." + Chr$(13)
  1424.     m$ = m$ + ".22..22." + Chr$(13)
  1425.     m$ = m$ + ".....22." + Chr$(13)
  1426.     m$ = m$ + "...222.." + Chr$(13)
  1427.     m$ = m$ + ".....22." + Chr$(13)
  1428.     m$ = m$ + ".22..22." + Chr$(13)
  1429.     m$ = m$ + "..2222.." + Chr$(13)
  1430.     m$ = m$ + "........" + Chr$(13)
  1431.     arrTileText(51) = m$
  1432.  
  1433.     m$ = ""
  1434.     m$ = m$ + ".....22." + Chr$(13)
  1435.     m$ = m$ + "....222." + Chr$(13)
  1436.     m$ = m$ + "...2222." + Chr$(13)
  1437.     m$ = m$ + ".22..22." + Chr$(13)
  1438.     m$ = m$ + ".2222222" + Chr$(13)
  1439.     m$ = m$ + ".....22." + Chr$(13)
  1440.     m$ = m$ + ".....22." + Chr$(13)
  1441.     m$ = m$ + "........" + Chr$(13)
  1442.     arrTileText(52) = m$
  1443.  
  1444.     m$ = ""
  1445.     m$ = m$ + ".222222." + Chr$(13)
  1446.     m$ = m$ + ".22....." + Chr$(13)
  1447.     m$ = m$ + ".22222.." + Chr$(13)
  1448.     m$ = m$ + ".....22." + Chr$(13)
  1449.     m$ = m$ + ".....22." + Chr$(13)
  1450.     m$ = m$ + ".22..22." + Chr$(13)
  1451.     m$ = m$ + "..2222.." + Chr$(13)
  1452.     m$ = m$ + "........" + Chr$(13)
  1453.     arrTileText(53) = m$
  1454.  
  1455.     m$ = ""
  1456.     m$ = m$ + "..2222.." + Chr$(13)
  1457.     m$ = m$ + ".22..22." + Chr$(13)
  1458.     m$ = m$ + ".22....." + Chr$(13)
  1459.     m$ = m$ + ".22222.." + Chr$(13)
  1460.     m$ = m$ + ".22..22." + Chr$(13)
  1461.     m$ = m$ + ".22..22." + Chr$(13)
  1462.     m$ = m$ + "..2222.." + Chr$(13)
  1463.     m$ = m$ + "........" + Chr$(13)
  1464.     arrTileText(54) = m$
  1465.  
  1466.     m$ = ""
  1467.     m$ = m$ + ".222222." + Chr$(13)
  1468.     m$ = m$ + ".22..22." + Chr$(13)
  1469.     m$ = m$ + "....22.." + Chr$(13)
  1470.     m$ = m$ + "...22..." + Chr$(13)
  1471.     m$ = m$ + "...22..." + Chr$(13)
  1472.     m$ = m$ + "...22..." + Chr$(13)
  1473.     m$ = m$ + "...22..." + Chr$(13)
  1474.     m$ = m$ + "........" + Chr$(13)
  1475.     arrTileText(55) = m$
  1476.  
  1477.     m$ = ""
  1478.     m$ = m$ + "..2222.." + Chr$(13)
  1479.     m$ = m$ + ".22..22." + Chr$(13)
  1480.     m$ = m$ + ".22..22." + Chr$(13)
  1481.     m$ = m$ + "..2222.." + Chr$(13)
  1482.     m$ = m$ + ".22..22." + Chr$(13)
  1483.     m$ = m$ + ".22..22." + Chr$(13)
  1484.     m$ = m$ + "..2222.." + Chr$(13)
  1485.     m$ = m$ + "........" + Chr$(13)
  1486.     arrTileText(56) = m$
  1487.  
  1488.     m$ = ""
  1489.     m$ = m$ + "..2222.." + Chr$(13)
  1490.     m$ = m$ + ".22..22." + Chr$(13)
  1491.     m$ = m$ + ".22..22." + Chr$(13)
  1492.     m$ = m$ + "..22222." + Chr$(13)
  1493.     m$ = m$ + ".....22." + Chr$(13)
  1494.     m$ = m$ + ".22..22." + Chr$(13)
  1495.     m$ = m$ + "..2222.." + Chr$(13)
  1496.     m$ = m$ + "........" + Chr$(13)
  1497.     arrTileText(57) = m$
  1498.  
  1499.     m$ = ""
  1500.     m$ = m$ + "........" + Chr$(13)
  1501.     m$ = m$ + "........" + Chr$(13)
  1502.     m$ = m$ + "...22..." + Chr$(13)
  1503.     m$ = m$ + "........" + Chr$(13)
  1504.     m$ = m$ + "........" + Chr$(13)
  1505.     m$ = m$ + "...22..." + Chr$(13)
  1506.     m$ = m$ + "........" + Chr$(13)
  1507.     m$ = m$ + "........" + Chr$(13)
  1508.     arrTileText(58) = m$
  1509.  
  1510.     m$ = ""
  1511.     m$ = m$ + "........" + Chr$(13)
  1512.     m$ = m$ + "........" + Chr$(13)
  1513.     m$ = m$ + "...22..." + Chr$(13)
  1514.     m$ = m$ + "........" + Chr$(13)
  1515.     m$ = m$ + "........" + Chr$(13)
  1516.     m$ = m$ + "...22..." + Chr$(13)
  1517.     m$ = m$ + "...22..." + Chr$(13)
  1518.     m$ = m$ + "..22...." + Chr$(13)
  1519.     arrTileText(59) = m$
  1520.  
  1521.     m$ = ""
  1522.     m$ = m$ + "....222." + Chr$(13)
  1523.     m$ = m$ + "...22..." + Chr$(13)
  1524.     m$ = m$ + "..22...." + Chr$(13)
  1525.     m$ = m$ + ".22....." + Chr$(13)
  1526.     m$ = m$ + "..22...." + Chr$(13)
  1527.     m$ = m$ + "...22..." + Chr$(13)
  1528.     m$ = m$ + "....222." + Chr$(13)
  1529.     m$ = m$ + "........" + Chr$(13)
  1530.     arrTileText(60) = m$
  1531.  
  1532.     m$ = ""
  1533.     m$ = m$ + "........" + Chr$(13)
  1534.     m$ = m$ + "........" + Chr$(13)
  1535.     m$ = m$ + ".222222." + Chr$(13)
  1536.     m$ = m$ + "........" + Chr$(13)
  1537.     m$ = m$ + ".222222." + Chr$(13)
  1538.     m$ = m$ + "........" + Chr$(13)
  1539.     m$ = m$ + "........" + Chr$(13)
  1540.     m$ = m$ + "........" + Chr$(13)
  1541.     arrTileText(61) = m$
  1542.  
  1543.     m$ = ""
  1544.     m$ = m$ + ".222...." + Chr$(13)
  1545.     m$ = m$ + "...22..." + Chr$(13)
  1546.     m$ = m$ + "....22.." + Chr$(13)
  1547.     m$ = m$ + ".....22." + Chr$(13)
  1548.     m$ = m$ + "....22.." + Chr$(13)
  1549.     m$ = m$ + "...22..." + Chr$(13)
  1550.     m$ = m$ + ".222...." + Chr$(13)
  1551.     m$ = m$ + "........" + Chr$(13)
  1552.     arrTileText(62) = m$
  1553.  
  1554.     m$ = ""
  1555.     m$ = m$ + "..2222.." + Chr$(13)
  1556.     m$ = m$ + ".22..22." + Chr$(13)
  1557.     m$ = m$ + ".....22." + Chr$(13)
  1558.     m$ = m$ + "....22.." + Chr$(13)
  1559.     m$ = m$ + "...22..." + Chr$(13)
  1560.     m$ = m$ + "........" + Chr$(13)
  1561.     m$ = m$ + "...22..." + Chr$(13)
  1562.     m$ = m$ + "........" + Chr$(13)
  1563.     arrTileText(63) = m$
  1564.  
  1565.     m$ = ""
  1566.     m$ = m$ + "..2222.." + Chr$(13)
  1567.     m$ = m$ + ".22..22." + Chr$(13)
  1568.     m$ = m$ + ".22.222." + Chr$(13)
  1569.     m$ = m$ + ".22.222." + Chr$(13)
  1570.     m$ = m$ + ".22....." + Chr$(13)
  1571.     m$ = m$ + ".22...2." + Chr$(13)
  1572.     m$ = m$ + "..2222.." + Chr$(13)
  1573.     m$ = m$ + "........" + Chr$(13)
  1574.     arrTileText(64) = m$
  1575.  
  1576.     m$ = ""
  1577.     m$ = m$ + "...22..." + Chr$(13)
  1578.     m$ = m$ + "..2222.." + Chr$(13)
  1579.     m$ = m$ + ".22..22." + Chr$(13)
  1580.     m$ = m$ + ".222222." + Chr$(13)
  1581.     m$ = m$ + ".22..22." + Chr$(13)
  1582.     m$ = m$ + ".22..22." + Chr$(13)
  1583.     m$ = m$ + ".22..22." + Chr$(13)
  1584.     m$ = m$ + "........" + Chr$(13)
  1585.     arrTileText(65) = m$
  1586.  
  1587.     m$ = ""
  1588.     m$ = m$ + ".22222.." + Chr$(13)
  1589.     m$ = m$ + ".22..22." + Chr$(13)
  1590.     m$ = m$ + ".22..22." + Chr$(13)
  1591.     m$ = m$ + ".22222.." + Chr$(13)
  1592.     m$ = m$ + ".22..22." + Chr$(13)
  1593.     m$ = m$ + ".22..22." + Chr$(13)
  1594.     m$ = m$ + ".22222.." + Chr$(13)
  1595.     m$ = m$ + "........" + Chr$(13)
  1596.     arrTileText(66) = m$
  1597.  
  1598.     m$ = ""
  1599.     m$ = m$ + "..2222.." + Chr$(13)
  1600.     m$ = m$ + ".22..22." + Chr$(13)
  1601.     m$ = m$ + ".22....." + Chr$(13)
  1602.     m$ = m$ + ".22....." + Chr$(13)
  1603.     m$ = m$ + ".22....." + Chr$(13)
  1604.     m$ = m$ + ".22..22." + Chr$(13)
  1605.     m$ = m$ + "..2222.." + Chr$(13)
  1606.     m$ = m$ + "........" + Chr$(13)
  1607.     arrTileText(67) = m$
  1608.  
  1609.     m$ = ""
  1610.     m$ = m$ + ".2222..." + Chr$(13)
  1611.     m$ = m$ + ".22.22.." + Chr$(13)
  1612.     m$ = m$ + ".22..22." + Chr$(13)
  1613.     m$ = m$ + ".22..22." + Chr$(13)
  1614.     m$ = m$ + ".22..22." + Chr$(13)
  1615.     m$ = m$ + ".22.22.." + Chr$(13)
  1616.     m$ = m$ + ".2222..." + Chr$(13)
  1617.     m$ = m$ + "........" + Chr$(13)
  1618.     arrTileText(68) = m$
  1619.  
  1620.     m$ = ""
  1621.     m$ = m$ + ".222222." + Chr$(13)
  1622.     m$ = m$ + ".22....." + Chr$(13)
  1623.     m$ = m$ + ".22....." + Chr$(13)
  1624.     m$ = m$ + ".2222..." + Chr$(13)
  1625.     m$ = m$ + ".22....." + Chr$(13)
  1626.     m$ = m$ + ".22....." + Chr$(13)
  1627.     m$ = m$ + ".222222." + Chr$(13)
  1628.     m$ = m$ + "........" + Chr$(13)
  1629.     arrTileText(69) = m$
  1630.  
  1631.     m$ = ""
  1632.     m$ = m$ + ".222222." + Chr$(13)
  1633.     m$ = m$ + ".22....." + Chr$(13)
  1634.     m$ = m$ + ".22....." + Chr$(13)
  1635.     m$ = m$ + ".2222..." + Chr$(13)
  1636.     m$ = m$ + ".22....." + Chr$(13)
  1637.     m$ = m$ + ".22....." + Chr$(13)
  1638.     m$ = m$ + ".22....." + Chr$(13)
  1639.     m$ = m$ + "........" + Chr$(13)
  1640.     arrTileText(70) = m$
  1641.  
  1642.     m$ = ""
  1643.     m$ = m$ + "..2222.." + Chr$(13)
  1644.     m$ = m$ + ".22..22." + Chr$(13)
  1645.     m$ = m$ + ".22....." + Chr$(13)
  1646.     m$ = m$ + ".22.222." + Chr$(13)
  1647.     m$ = m$ + ".22..22." + Chr$(13)
  1648.     m$ = m$ + ".22..22." + Chr$(13)
  1649.     m$ = m$ + "..2222.." + Chr$(13)
  1650.     m$ = m$ + "........" + Chr$(13)
  1651.     arrTileText(71) = m$
  1652.  
  1653.     m$ = ""
  1654.     m$ = m$ + ".22..22." + Chr$(13)
  1655.     m$ = m$ + ".22..22." + Chr$(13)
  1656.     m$ = m$ + ".22..22." + Chr$(13)
  1657.     m$ = m$ + ".222222." + Chr$(13)
  1658.     m$ = m$ + ".22..22." + Chr$(13)
  1659.     m$ = m$ + ".22..22." + Chr$(13)
  1660.     m$ = m$ + ".22..22." + Chr$(13)
  1661.     m$ = m$ + "........" + Chr$(13)
  1662.     arrTileText(72) = m$
  1663.  
  1664.     m$ = ""
  1665.     m$ = m$ + "..2222.." + Chr$(13)
  1666.     m$ = m$ + "...22..." + Chr$(13)
  1667.     m$ = m$ + "...22..." + Chr$(13)
  1668.     m$ = m$ + "...22..." + Chr$(13)
  1669.     m$ = m$ + "...22..." + Chr$(13)
  1670.     m$ = m$ + "...22..." + Chr$(13)
  1671.     m$ = m$ + "..2222.." + Chr$(13)
  1672.     m$ = m$ + "........" + Chr$(13)
  1673.     arrTileText(73) = m$
  1674.  
  1675.     m$ = ""
  1676.     m$ = m$ + "...2222." + Chr$(13)
  1677.     m$ = m$ + "....22.." + Chr$(13)
  1678.     m$ = m$ + "....22.." + Chr$(13)
  1679.     m$ = m$ + "....22.." + Chr$(13)
  1680.     m$ = m$ + "....22.." + Chr$(13)
  1681.     m$ = m$ + ".22.22.." + Chr$(13)
  1682.     m$ = m$ + "..222..." + Chr$(13)
  1683.     m$ = m$ + "........" + Chr$(13)
  1684.     arrTileText(74) = m$
  1685.  
  1686.     m$ = ""
  1687.     m$ = m$ + ".22..22." + Chr$(13)
  1688.     m$ = m$ + ".22.22.." + Chr$(13)
  1689.     m$ = m$ + ".2222..." + Chr$(13)
  1690.     m$ = m$ + ".222...." + Chr$(13)
  1691.     m$ = m$ + ".2222..." + Chr$(13)
  1692.     m$ = m$ + ".22.22.." + Chr$(13)
  1693.     m$ = m$ + ".22..22." + Chr$(13)
  1694.     m$ = m$ + "........" + Chr$(13)
  1695.     arrTileText(75) = m$
  1696.  
  1697.     m$ = ""
  1698.     m$ = m$ + ".22....." + Chr$(13)
  1699.     m$ = m$ + ".22....." + Chr$(13)
  1700.     m$ = m$ + ".22....." + Chr$(13)
  1701.     m$ = m$ + ".22....." + Chr$(13)
  1702.     m$ = m$ + ".22....." + Chr$(13)
  1703.     m$ = m$ + ".22....." + Chr$(13)
  1704.     m$ = m$ + ".222222." + Chr$(13)
  1705.     m$ = m$ + "........" + Chr$(13)
  1706.     arrTileText(76) = m$
  1707.  
  1708.     m$ = ""
  1709.     m$ = m$ + ".22...22" + Chr$(13)
  1710.     m$ = m$ + ".222.222" + Chr$(13)
  1711.     m$ = m$ + ".2222222" + Chr$(13)
  1712.     m$ = m$ + ".22.2.22" + Chr$(13)
  1713.     m$ = m$ + ".22...22" + Chr$(13)
  1714.     m$ = m$ + ".22...22" + Chr$(13)
  1715.     m$ = m$ + ".22...22" + Chr$(13)
  1716.     m$ = m$ + "........" + Chr$(13)
  1717.     arrTileText(77) = m$
  1718.  
  1719.     m$ = ""
  1720.     m$ = m$ + ".22..22." + Chr$(13)
  1721.     m$ = m$ + ".222.22." + Chr$(13)
  1722.     m$ = m$ + ".222222." + Chr$(13)
  1723.     m$ = m$ + ".222222." + Chr$(13)
  1724.     m$ = m$ + ".22.222." + Chr$(13)
  1725.     m$ = m$ + ".22..22." + Chr$(13)
  1726.     m$ = m$ + ".22..22." + Chr$(13)
  1727.     m$ = m$ + "........" + Chr$(13)
  1728.     arrTileText(78) = m$
  1729.  
  1730.     m$ = ""
  1731.     m$ = m$ + "..2222.." + Chr$(13)
  1732.     m$ = m$ + ".22..22." + Chr$(13)
  1733.     m$ = m$ + ".22..22." + Chr$(13)
  1734.     m$ = m$ + ".22..22." + Chr$(13)
  1735.     m$ = m$ + ".22..22." + Chr$(13)
  1736.     m$ = m$ + ".22..22." + Chr$(13)
  1737.     m$ = m$ + "..2222.." + Chr$(13)
  1738.     m$ = m$ + "........" + Chr$(13)
  1739.     arrTileText(79) = m$
  1740.  
  1741.     m$ = ""
  1742.     m$ = m$ + ".22222.." + Chr$(13)
  1743.     m$ = m$ + ".22..22." + Chr$(13)
  1744.     m$ = m$ + ".22..22." + Chr$(13)
  1745.     m$ = m$ + ".22222.." + Chr$(13)
  1746.     m$ = m$ + ".22....." + Chr$(13)
  1747.     m$ = m$ + ".22....." + Chr$(13)
  1748.     m$ = m$ + ".22....." + Chr$(13)
  1749.     m$ = m$ + "........" + Chr$(13)
  1750.     arrTileText(80) = m$
  1751.  
  1752.     m$ = ""
  1753.     m$ = m$ + "..2222.." + Chr$(13)
  1754.     m$ = m$ + ".22..22." + Chr$(13)
  1755.     m$ = m$ + ".22..22." + Chr$(13)
  1756.     m$ = m$ + ".22..22." + Chr$(13)
  1757.     m$ = m$ + ".22..22." + Chr$(13)
  1758.     m$ = m$ + "..2222.." + Chr$(13)
  1759.     m$ = m$ + "....222." + Chr$(13)
  1760.     m$ = m$ + "........" + Chr$(13)
  1761.     arrTileText(81) = m$
  1762.  
  1763.     m$ = ""
  1764.     m$ = m$ + ".22222.." + Chr$(13)
  1765.     m$ = m$ + ".22..22." + Chr$(13)
  1766.     m$ = m$ + ".22..22." + Chr$(13)
  1767.     m$ = m$ + ".22222.." + Chr$(13)
  1768.     m$ = m$ + ".2222..." + Chr$(13)
  1769.     m$ = m$ + ".22.22.." + Chr$(13)
  1770.     m$ = m$ + ".22..22." + Chr$(13)
  1771.     m$ = m$ + "........" + Chr$(13)
  1772.     arrTileText(82) = m$
  1773.  
  1774.     m$ = ""
  1775.     m$ = m$ + "..2222.." + Chr$(13)
  1776.     m$ = m$ + ".22..22." + Chr$(13)
  1777.     m$ = m$ + ".22....." + Chr$(13)
  1778.     m$ = m$ + "..2222.." + Chr$(13)
  1779.     m$ = m$ + ".....22." + Chr$(13)
  1780.     m$ = m$ + ".22..22." + Chr$(13)
  1781.     m$ = m$ + "..2222.." + Chr$(13)
  1782.     m$ = m$ + "........" + Chr$(13)
  1783.     arrTileText(83) = m$
  1784.  
  1785.     m$ = ""
  1786.     m$ = m$ + ".222222." + Chr$(13)
  1787.     m$ = m$ + "...22..." + Chr$(13)
  1788.     m$ = m$ + "...22..." + Chr$(13)
  1789.     m$ = m$ + "...22..." + Chr$(13)
  1790.     m$ = m$ + "...22..." + Chr$(13)
  1791.     m$ = m$ + "...22..." + Chr$(13)
  1792.     m$ = m$ + "...22..." + Chr$(13)
  1793.     m$ = m$ + "........" + Chr$(13)
  1794.     arrTileText(84) = m$
  1795.  
  1796.     m$ = ""
  1797.     m$ = m$ + ".22..22." + Chr$(13)
  1798.     m$ = m$ + ".22..22." + Chr$(13)
  1799.     m$ = m$ + ".22..22." + Chr$(13)
  1800.     m$ = m$ + ".22..22." + Chr$(13)
  1801.     m$ = m$ + ".22..22." + Chr$(13)
  1802.     m$ = m$ + ".22..22." + Chr$(13)
  1803.     m$ = m$ + "..2222.." + Chr$(13)
  1804.     m$ = m$ + "........" + Chr$(13)
  1805.     arrTileText(85) = m$
  1806.  
  1807.     m$ = ""
  1808.     m$ = m$ + ".22..22." + Chr$(13)
  1809.     m$ = m$ + ".22..22." + Chr$(13)
  1810.     m$ = m$ + ".22..22." + Chr$(13)
  1811.     m$ = m$ + ".22..22." + Chr$(13)
  1812.     m$ = m$ + ".22..22." + Chr$(13)
  1813.     m$ = m$ + "..2222.." + Chr$(13)
  1814.     m$ = m$ + "...22..." + Chr$(13)
  1815.     m$ = m$ + "........" + Chr$(13)
  1816.     arrTileText(86) = m$
  1817.  
  1818.     m$ = ""
  1819.     m$ = m$ + ".22...22" + Chr$(13)
  1820.     m$ = m$ + ".22...22" + Chr$(13)
  1821.     m$ = m$ + ".22...22" + Chr$(13)
  1822.     m$ = m$ + ".22.2.22" + Chr$(13)
  1823.     m$ = m$ + ".2222222" + Chr$(13)
  1824.     m$ = m$ + ".222.222" + Chr$(13)
  1825.     m$ = m$ + ".22...22" + Chr$(13)
  1826.     m$ = m$ + "........" + Chr$(13)
  1827.     arrTileText(87) = m$
  1828.  
  1829.     m$ = ""
  1830.     m$ = m$ + ".22..22." + Chr$(13)
  1831.     m$ = m$ + ".22..22." + Chr$(13)
  1832.     m$ = m$ + "..2222.." + Chr$(13)
  1833.     m$ = m$ + "...22..." + Chr$(13)
  1834.     m$ = m$ + "..2222.." + Chr$(13)
  1835.     m$ = m$ + ".22..22." + Chr$(13)
  1836.     m$ = m$ + ".22..22." + Chr$(13)
  1837.     m$ = m$ + "........" + Chr$(13)
  1838.     arrTileText(88) = m$
  1839.  
  1840.     m$ = ""
  1841.     m$ = m$ + ".22..22." + Chr$(13)
  1842.     m$ = m$ + ".22..22." + Chr$(13)
  1843.     m$ = m$ + ".22..22." + Chr$(13)
  1844.     m$ = m$ + "..2222.." + Chr$(13)
  1845.     m$ = m$ + "...22..." + Chr$(13)
  1846.     m$ = m$ + "...22..." + Chr$(13)
  1847.     m$ = m$ + "...22..." + Chr$(13)
  1848.     m$ = m$ + "........" + Chr$(13)
  1849.     arrTileText(89) = m$
  1850.  
  1851.     m$ = ""
  1852.     m$ = m$ + ".222222." + Chr$(13)
  1853.     m$ = m$ + ".....22." + Chr$(13)
  1854.     m$ = m$ + "....22.." + Chr$(13)
  1855.     m$ = m$ + "...22..." + Chr$(13)
  1856.     m$ = m$ + "..22...." + Chr$(13)
  1857.     m$ = m$ + ".22....." + Chr$(13)
  1858.     m$ = m$ + ".222222." + Chr$(13)
  1859.     m$ = m$ + "........" + Chr$(13)
  1860.     arrTileText(90) = m$
  1861.  
  1862.     m$ = ""
  1863.     m$ = m$ + "..2222.." + Chr$(13)
  1864.     m$ = m$ + "..22...." + Chr$(13)
  1865.     m$ = m$ + "..22...." + Chr$(13)
  1866.     m$ = m$ + "..22...." + Chr$(13)
  1867.     m$ = m$ + "..22...." + Chr$(13)
  1868.     m$ = m$ + "..22...." + Chr$(13)
  1869.     m$ = m$ + "..2222.." + Chr$(13)
  1870.     m$ = m$ + "........" + Chr$(13)
  1871.     arrTileText(91) = m$
  1872.  
  1873.     m$ = ""
  1874.     m$ = m$ + "........" + Chr$(13)
  1875.     m$ = m$ + ".22....." + Chr$(13)
  1876.     m$ = m$ + "..22...." + Chr$(13)
  1877.     m$ = m$ + "...22..." + Chr$(13)
  1878.     m$ = m$ + "....22.." + Chr$(13)
  1879.     m$ = m$ + ".....22." + Chr$(13)
  1880.     m$ = m$ + "......22" + Chr$(13)
  1881.     m$ = m$ + "........" + Chr$(13)
  1882.     arrTileText(92) = m$
  1883.  
  1884.     m$ = ""
  1885.     m$ = m$ + "..2222.." + Chr$(13)
  1886.     m$ = m$ + "....22.." + Chr$(13)
  1887.     m$ = m$ + "....22.." + Chr$(13)
  1888.     m$ = m$ + "....22.." + Chr$(13)
  1889.     m$ = m$ + "....22.." + Chr$(13)
  1890.     m$ = m$ + "....22.." + Chr$(13)
  1891.     m$ = m$ + "..2222.." + Chr$(13)
  1892.     m$ = m$ + "........" + Chr$(13)
  1893.     arrTileText(93) = m$
  1894.  
  1895.     m$ = ""
  1896.     m$ = m$ + "...22..." + Chr$(13)
  1897.     m$ = m$ + "..2222.." + Chr$(13)
  1898.     m$ = m$ + ".22..22." + Chr$(13)
  1899.     m$ = m$ + "........" + Chr$(13)
  1900.     m$ = m$ + "........" + Chr$(13)
  1901.     m$ = m$ + "........" + Chr$(13)
  1902.     m$ = m$ + "........" + Chr$(13)
  1903.     m$ = m$ + "........" + Chr$(13)
  1904.     arrTileText(94) = m$
  1905.  
  1906.     m$ = ""
  1907.     m$ = m$ + "........" + Chr$(13)
  1908.     m$ = m$ + "........" + Chr$(13)
  1909.     m$ = m$ + "........" + Chr$(13)
  1910.     m$ = m$ + "........" + Chr$(13)
  1911.     m$ = m$ + "........" + Chr$(13)
  1912.     m$ = m$ + ".222222." + Chr$(13)
  1913.     m$ = m$ + "........" + Chr$(13)
  1914.     m$ = m$ + "........" + Chr$(13)
  1915.     arrTileText(95) = m$
  1916.  
  1917.     m$ = ""
  1918.     m$ = m$ + "........" + Chr$(13)
  1919.     m$ = m$ + "........" + Chr$(13)
  1920.     m$ = m$ + "........" + Chr$(13)
  1921.     m$ = m$ + "........" + Chr$(13)
  1922.     m$ = m$ + "........" + Chr$(13)
  1923.     m$ = m$ + "........" + Chr$(13)
  1924.     m$ = m$ + "........" + Chr$(13)
  1925.     m$ = m$ + "........" + Chr$(13)
  1926.     arrTileText(96) = m$
  1927.  
  1928.     m$ = ""
  1929.     m$ = m$ + "........" + Chr$(13)
  1930.     m$ = m$ + "..2222.." + Chr$(13)
  1931.     m$ = m$ + ".....22." + Chr$(13)
  1932.     m$ = m$ + "..22222." + Chr$(13)
  1933.     m$ = m$ + ".22..22." + Chr$(13)
  1934.     m$ = m$ + "..22222." + Chr$(13)
  1935.     m$ = m$ + "........" + Chr$(13)
  1936.     m$ = m$ + "........" + Chr$(13)
  1937.     arrTileText(97) = m$
  1938.  
  1939.     m$ = ""
  1940.     m$ = m$ + ".22....." + Chr$(13)
  1941.     m$ = m$ + ".22....." + Chr$(13)
  1942.     m$ = m$ + ".22222.." + Chr$(13)
  1943.     m$ = m$ + ".22..22." + Chr$(13)
  1944.     m$ = m$ + ".22..22." + Chr$(13)
  1945.     m$ = m$ + ".22222.." + Chr$(13)
  1946.     m$ = m$ + "........" + Chr$(13)
  1947.     m$ = m$ + "........" + Chr$(13)
  1948.     arrTileText(98) = m$
  1949.  
  1950.     m$ = ""
  1951.     m$ = m$ + "........" + Chr$(13)
  1952.     m$ = m$ + "..2222.." + Chr$(13)
  1953.     m$ = m$ + ".22....." + Chr$(13)
  1954.     m$ = m$ + ".22....." + Chr$(13)
  1955.     m$ = m$ + ".22....." + Chr$(13)
  1956.     m$ = m$ + "..2222.." + Chr$(13)
  1957.     m$ = m$ + "........" + Chr$(13)
  1958.     m$ = m$ + "........" + Chr$(13)
  1959.     arrTileText(99) = m$
  1960.  
  1961.     m$ = ""
  1962.     m$ = m$ + ".....22." + Chr$(13)
  1963.     m$ = m$ + ".....22." + Chr$(13)
  1964.     m$ = m$ + "..22222." + Chr$(13)
  1965.     m$ = m$ + ".22..22." + Chr$(13)
  1966.     m$ = m$ + ".22..22." + Chr$(13)
  1967.     m$ = m$ + "..22222." + Chr$(13)
  1968.     m$ = m$ + "........" + Chr$(13)
  1969.     m$ = m$ + "........" + Chr$(13)
  1970.     arrTileText(100) = m$
  1971.  
  1972.     m$ = ""
  1973.     m$ = m$ + "........" + Chr$(13)
  1974.     m$ = m$ + "..2222.." + Chr$(13)
  1975.     m$ = m$ + ".22..22." + Chr$(13)
  1976.     m$ = m$ + ".222222." + Chr$(13)
  1977.     m$ = m$ + ".22....." + Chr$(13)
  1978.     m$ = m$ + "..2222.." + Chr$(13)
  1979.     m$ = m$ + "........" + Chr$(13)
  1980.     m$ = m$ + "........" + Chr$(13)
  1981.     arrTileText(101) = m$
  1982.  
  1983.     m$ = ""
  1984.     m$ = m$ + "....222." + Chr$(13)
  1985.     m$ = m$ + "...22..." + Chr$(13)
  1986.     m$ = m$ + "..22222." + Chr$(13)
  1987.     m$ = m$ + "...22..." + Chr$(13)
  1988.     m$ = m$ + "...22..." + Chr$(13)
  1989.     m$ = m$ + "...22..." + Chr$(13)
  1990.     m$ = m$ + "........" + Chr$(13)
  1991.     m$ = m$ + "........" + Chr$(13)
  1992.     arrTileText(102) = m$
  1993.  
  1994.     m$ = ""
  1995.     m$ = m$ + "........" + Chr$(13)
  1996.     m$ = m$ + "..22222." + Chr$(13)
  1997.     m$ = m$ + ".22..22." + Chr$(13)
  1998.     m$ = m$ + ".22..22." + Chr$(13)
  1999.     m$ = m$ + "..22222." + Chr$(13)
  2000.     m$ = m$ + ".....22." + Chr$(13)
  2001.     m$ = m$ + ".22222.." + Chr$(13)
  2002.     m$ = m$ + "........" + Chr$(13)
  2003.     arrTileText(103) = m$
  2004.  
  2005.     m$ = ""
  2006.     m$ = m$ + ".22....." + Chr$(13)
  2007.     m$ = m$ + ".22....." + Chr$(13)
  2008.     m$ = m$ + ".22222.." + Chr$(13)
  2009.     m$ = m$ + ".22..22." + Chr$(13)
  2010.     m$ = m$ + ".22..22." + Chr$(13)
  2011.     m$ = m$ + ".22..22." + Chr$(13)
  2012.     m$ = m$ + "........" + Chr$(13)
  2013.     m$ = m$ + "........" + Chr$(13)
  2014.     arrTileText(104) = m$
  2015.  
  2016.     m$ = ""
  2017.     m$ = m$ + "...22..." + Chr$(13)
  2018.     m$ = m$ + "........" + Chr$(13)
  2019.     m$ = m$ + "..222..." + Chr$(13)
  2020.     m$ = m$ + "...22..." + Chr$(13)
  2021.     m$ = m$ + "...22..." + Chr$(13)
  2022.     m$ = m$ + "..2222.." + Chr$(13)
  2023.     m$ = m$ + "........" + Chr$(13)
  2024.     m$ = m$ + "........" + Chr$(13)
  2025.     arrTileText(105) = m$
  2026.  
  2027.     m$ = ""
  2028.     m$ = m$ + ".....22." + Chr$(13)
  2029.     m$ = m$ + "........" + Chr$(13)
  2030.     m$ = m$ + ".....22." + Chr$(13)
  2031.     m$ = m$ + ".....22." + Chr$(13)
  2032.     m$ = m$ + ".....22." + Chr$(13)
  2033.     m$ = m$ + ".....22." + Chr$(13)
  2034.     m$ = m$ + "..2222.." + Chr$(13)
  2035.     m$ = m$ + "........" + Chr$(13)
  2036.     arrTileText(106) = m$
  2037.  
  2038.     m$ = ""
  2039.     m$ = m$ + ".22....." + Chr$(13)
  2040.     m$ = m$ + ".22....." + Chr$(13)
  2041.     m$ = m$ + ".22.22.." + Chr$(13)
  2042.     m$ = m$ + ".2222..." + Chr$(13)
  2043.     m$ = m$ + ".22.22.." + Chr$(13)
  2044.     m$ = m$ + ".22..22." + Chr$(13)
  2045.     m$ = m$ + "........" + Chr$(13)
  2046.     m$ = m$ + "........" + Chr$(13)
  2047.     arrTileText(107) = m$
  2048.  
  2049.     m$ = ""
  2050.     m$ = m$ + "..222..." + Chr$(13)
  2051.     m$ = m$ + "...22..." + Chr$(13)
  2052.     m$ = m$ + "...22..." + Chr$(13)
  2053.     m$ = m$ + "...22..." + Chr$(13)
  2054.     m$ = m$ + "...22..." + Chr$(13)
  2055.     m$ = m$ + "..2222.." + Chr$(13)
  2056.     m$ = m$ + "........" + Chr$(13)
  2057.     m$ = m$ + "........" + Chr$(13)
  2058.     arrTileText(108) = m$
  2059.  
  2060.     m$ = ""
  2061.     m$ = m$ + "........" + Chr$(13)
  2062.     m$ = m$ + ".22..22." + Chr$(13)
  2063.     m$ = m$ + ".2222222" + Chr$(13)
  2064.     m$ = m$ + ".2222222" + Chr$(13)
  2065.     m$ = m$ + ".22.2.22" + Chr$(13)
  2066.     m$ = m$ + ".22...22" + Chr$(13)
  2067.     m$ = m$ + "........" + Chr$(13)
  2068.     m$ = m$ + "........" + Chr$(13)
  2069.     arrTileText(109) = m$
  2070.  
  2071.     m$ = ""
  2072.     m$ = m$ + "........" + Chr$(13)
  2073.     m$ = m$ + ".22222.." + Chr$(13)
  2074.     m$ = m$ + ".22..22." + Chr$(13)
  2075.     m$ = m$ + ".22..22." + Chr$(13)
  2076.     m$ = m$ + ".22..22." + Chr$(13)
  2077.     m$ = m$ + ".22..22." + Chr$(13)
  2078.     m$ = m$ + "........" + Chr$(13)
  2079.     m$ = m$ + "........" + Chr$(13)
  2080.     arrTileText(110) = m$
  2081.  
  2082.     m$ = ""
  2083.     m$ = m$ + "........" + Chr$(13)
  2084.     m$ = m$ + "..2222.." + Chr$(13)
  2085.     m$ = m$ + ".22..22." + Chr$(13)
  2086.     m$ = m$ + ".22..22." + Chr$(13)
  2087.     m$ = m$ + ".22..22." + Chr$(13)
  2088.     m$ = m$ + "..2222.." + Chr$(13)
  2089.     m$ = m$ + "........" + Chr$(13)
  2090.     m$ = m$ + "........" + Chr$(13)
  2091.     arrTileText(111) = m$
  2092.  
  2093.     m$ = ""
  2094.     m$ = m$ + "........" + Chr$(13)
  2095.     m$ = m$ + ".22222.." + Chr$(13)
  2096.     m$ = m$ + ".22..22." + Chr$(13)
  2097.     m$ = m$ + ".22..22." + Chr$(13)
  2098.     m$ = m$ + ".22222.." + Chr$(13)
  2099.     m$ = m$ + ".22....." + Chr$(13)
  2100.     m$ = m$ + ".22....." + Chr$(13)
  2101.     m$ = m$ + "........" + Chr$(13)
  2102.     arrTileText(112) = m$
  2103.  
  2104.     m$ = ""
  2105.     m$ = m$ + "........" + Chr$(13)
  2106.     m$ = m$ + "..22222." + Chr$(13)
  2107.     m$ = m$ + ".22..22." + Chr$(13)
  2108.     m$ = m$ + ".22..22." + Chr$(13)
  2109.     m$ = m$ + "..22222." + Chr$(13)
  2110.     m$ = m$ + ".....22." + Chr$(13)
  2111.     m$ = m$ + ".....22." + Chr$(13)
  2112.     m$ = m$ + "........" + Chr$(13)
  2113.     arrTileText(113) = m$
  2114.  
  2115.     m$ = ""
  2116.     m$ = m$ + "........" + Chr$(13)
  2117.     m$ = m$ + ".22222.." + Chr$(13)
  2118.     m$ = m$ + ".22..22." + Chr$(13)
  2119.     m$ = m$ + ".22....." + Chr$(13)
  2120.     m$ = m$ + ".22....." + Chr$(13)
  2121.     m$ = m$ + ".22....." + Chr$(13)
  2122.     m$ = m$ + "........" + Chr$(13)
  2123.     m$ = m$ + "........" + Chr$(13)
  2124.     arrTileText(114) = m$
  2125.  
  2126.     m$ = ""
  2127.     m$ = m$ + "........" + Chr$(13)
  2128.     m$ = m$ + "..22222." + Chr$(13)
  2129.     m$ = m$ + ".22....." + Chr$(13)
  2130.     m$ = m$ + "..2222.." + Chr$(13)
  2131.     m$ = m$ + ".....22." + Chr$(13)
  2132.     m$ = m$ + ".22222.." + Chr$(13)
  2133.     m$ = m$ + "........" + Chr$(13)
  2134.     m$ = m$ + "........" + Chr$(13)
  2135.     arrTileText(115) = m$
  2136.  
  2137.     m$ = ""
  2138.     m$ = m$ + "...22..." + Chr$(13)
  2139.     m$ = m$ + ".222222." + Chr$(13)
  2140.     m$ = m$ + "...22..." + Chr$(13)
  2141.     m$ = m$ + "...22..." + Chr$(13)
  2142.     m$ = m$ + "...22..." + Chr$(13)
  2143.     m$ = m$ + "....222." + Chr$(13)
  2144.     m$ = m$ + "........" + Chr$(13)
  2145.     m$ = m$ + "........" + Chr$(13)
  2146.     arrTileText(116) = m$
  2147.  
  2148.     m$ = ""
  2149.     m$ = m$ + "........" + Chr$(13)
  2150.     m$ = m$ + ".22..22." + Chr$(13)
  2151.     m$ = m$ + ".22..22." + Chr$(13)
  2152.     m$ = m$ + ".22..22." + Chr$(13)
  2153.     m$ = m$ + ".22..22." + Chr$(13)
  2154.     m$ = m$ + "..22222." + Chr$(13)
  2155.     m$ = m$ + "........" + Chr$(13)
  2156.     m$ = m$ + "........" + Chr$(13)
  2157.     arrTileText(117) = m$
  2158.  
  2159.     m$ = ""
  2160.     m$ = m$ + "........" + Chr$(13)
  2161.     m$ = m$ + ".22..22." + Chr$(13)
  2162.     m$ = m$ + ".22..22." + Chr$(13)
  2163.     m$ = m$ + ".22..22." + Chr$(13)
  2164.     m$ = m$ + "..2222.." + Chr$(13)
  2165.     m$ = m$ + "...22..." + Chr$(13)
  2166.     m$ = m$ + "........" + Chr$(13)
  2167.     m$ = m$ + "........" + Chr$(13)
  2168.     arrTileText(118) = m$
  2169.  
  2170.     m$ = ""
  2171.     m$ = m$ + "........" + Chr$(13)
  2172.     m$ = m$ + ".22...22" + Chr$(13)
  2173.     m$ = m$ + ".22.2.22" + Chr$(13)
  2174.     m$ = m$ + ".2222222" + Chr$(13)
  2175.     m$ = m$ + "..22222." + Chr$(13)
  2176.     m$ = m$ + "..22.22." + Chr$(13)
  2177.     m$ = m$ + "........" + Chr$(13)
  2178.     m$ = m$ + "........" + Chr$(13)
  2179.     arrTileText(119) = m$
  2180.  
  2181.     m$ = ""
  2182.     m$ = m$ + "........" + Chr$(13)
  2183.     m$ = m$ + ".22..22." + Chr$(13)
  2184.     m$ = m$ + "..2222.." + Chr$(13)
  2185.     m$ = m$ + "...22..." + Chr$(13)
  2186.     m$ = m$ + "..2222.." + Chr$(13)
  2187.     m$ = m$ + ".22..22." + Chr$(13)
  2188.     m$ = m$ + "........" + Chr$(13)
  2189.     m$ = m$ + "........" + Chr$(13)
  2190.     arrTileText(120) = m$
  2191.  
  2192.     m$ = ""
  2193.     m$ = m$ + "........" + Chr$(13)
  2194.     m$ = m$ + ".22..22." + Chr$(13)
  2195.     m$ = m$ + ".22..22." + Chr$(13)
  2196.     m$ = m$ + ".22..22." + Chr$(13)
  2197.     m$ = m$ + "..22222." + Chr$(13)
  2198.     m$ = m$ + "....22.." + Chr$(13)
  2199.     m$ = m$ + ".2222..." + Chr$(13)
  2200.     m$ = m$ + "........" + Chr$(13)
  2201.     arrTileText(121) = m$
  2202.  
  2203.     m$ = ""
  2204.     m$ = m$ + "........" + Chr$(13)
  2205.     m$ = m$ + ".222222." + Chr$(13)
  2206.     m$ = m$ + "....22.." + Chr$(13)
  2207.     m$ = m$ + "...22..." + Chr$(13)
  2208.     m$ = m$ + "..22...." + Chr$(13)
  2209.     m$ = m$ + ".222222." + Chr$(13)
  2210.     m$ = m$ + "........" + Chr$(13)
  2211.     m$ = m$ + "........" + Chr$(13)
  2212.     arrTileText(122) = m$
  2213.  
  2214.     m$ = ""
  2215.     m$ = m$ + "...222.." + Chr$(13)
  2216.     m$ = m$ + "..22...." + Chr$(13)
  2217.     m$ = m$ + "..2....." + Chr$(13)
  2218.     m$ = m$ + ".22....." + Chr$(13)
  2219.     m$ = m$ + "..2....." + Chr$(13)
  2220.     m$ = m$ + "..22...." + Chr$(13)
  2221.     m$ = m$ + "...222.." + Chr$(13)
  2222.     m$ = m$ + "........" + Chr$(13)
  2223.     arrTileText(123) = m$
  2224.  
  2225.     m$ = ""
  2226.     m$ = m$ + "....2..." + Chr$(13)
  2227.     m$ = m$ + "....2..." + Chr$(13)
  2228.     m$ = m$ + "....2..." + Chr$(13)
  2229.     m$ = m$ + "....2..." + Chr$(13)
  2230.     m$ = m$ + "....2..." + Chr$(13)
  2231.     m$ = m$ + "....2..." + Chr$(13)
  2232.     m$ = m$ + "....2..." + Chr$(13)
  2233.     m$ = m$ + "........" + Chr$(13)
  2234.     arrTileText(124) = m$
  2235.  
  2236.     m$ = ""
  2237.     m$ = m$ + "..222..." + Chr$(13)
  2238.     m$ = m$ + "....22.." + Chr$(13)
  2239.     m$ = m$ + ".....2.." + Chr$(13)
  2240.     m$ = m$ + ".....22." + Chr$(13)
  2241.     m$ = m$ + ".....2.." + Chr$(13)
  2242.     m$ = m$ + "....22.." + Chr$(13)
  2243.     m$ = m$ + "..222..." + Chr$(13)
  2244.     m$ = m$ + "........" + Chr$(13)
  2245.     arrTileText(125) = m$
  2246.  
  2247.     m$ = ""
  2248.     m$ = m$ + "........" + Chr$(13)
  2249.     m$ = m$ + ".22....2" + Chr$(13)
  2250.     m$ = m$ + "2..2..2." + Chr$(13)
  2251.     m$ = m$ + "....22.." + Chr$(13)
  2252.     m$ = m$ + "........" + Chr$(13)
  2253.     m$ = m$ + "........" + Chr$(13)
  2254.     m$ = m$ + "........" + Chr$(13)
  2255.     m$ = m$ + "........" + Chr$(13)
  2256.     arrTileText(126) = m$
  2257.  
  2258.     m$ = ""
  2259.     m$ = m$ + "........" + Chr$(13)
  2260.     m$ = m$ + "........" + Chr$(13)
  2261.     m$ = m$ + "........" + Chr$(13)
  2262.     m$ = m$ + "........" + Chr$(13)
  2263.     m$ = m$ + "........" + Chr$(13)
  2264.     m$ = m$ + "........" + Chr$(13)
  2265.     m$ = m$ + "........" + Chr$(13)
  2266.     m$ = m$ + "........" + Chr$(13)
  2267.     arrTileText(127) = m$
  2268.  
  2269.     m$ = ""
  2270.     m$ = m$ + "........" + Chr$(13)
  2271.     m$ = m$ + "........" + Chr$(13)
  2272.     m$ = m$ + "........" + Chr$(13)
  2273.     m$ = m$ + "22222222" + Chr$(13)
  2274.     m$ = m$ + "22222222" + Chr$(13)
  2275.     m$ = m$ + "........" + Chr$(13)
  2276.     m$ = m$ + "........" + Chr$(13)
  2277.     m$ = m$ + "........" + Chr$(13)
  2278.     arrTileText(128) = m$
  2279.  
  2280.     m$ = ""
  2281.     m$ = m$ + "....2..." + Chr$(13)
  2282.     m$ = m$ + "...222.." + Chr$(13)
  2283.     m$ = m$ + "..22222." + Chr$(13)
  2284.     m$ = m$ + ".2222222" + Chr$(13)
  2285.     m$ = m$ + ".2222222" + Chr$(13)
  2286.     m$ = m$ + "...222.." + Chr$(13)
  2287.     m$ = m$ + "..22222." + Chr$(13)
  2288.     m$ = m$ + "........" + Chr$(13)
  2289.     arrTileText(129) = m$
  2290.  
  2291.     m$ = ""
  2292.     m$ = m$ + "...22..." + Chr$(13)
  2293.     m$ = m$ + "...22..." + Chr$(13)
  2294.     m$ = m$ + "...22..." + Chr$(13)
  2295.     m$ = m$ + "...22..." + Chr$(13)
  2296.     m$ = m$ + "...22..." + Chr$(13)
  2297.     m$ = m$ + "...22..." + Chr$(13)
  2298.     m$ = m$ + "...22..." + Chr$(13)
  2299.     m$ = m$ + "...22..." + Chr$(13)
  2300.     arrTileText(130) = m$
  2301.  
  2302.     m$ = ""
  2303.     m$ = m$ + "........" + Chr$(13)
  2304.     m$ = m$ + "........" + Chr$(13)
  2305.     m$ = m$ + "........" + Chr$(13)
  2306.     m$ = m$ + "22222222" + Chr$(13)
  2307.     m$ = m$ + "22222222" + Chr$(13)
  2308.     m$ = m$ + "........" + Chr$(13)
  2309.     m$ = m$ + "........" + Chr$(13)
  2310.     m$ = m$ + "........" + Chr$(13)
  2311.     arrTileText(131) = m$
  2312.  
  2313.     m$ = ""
  2314.     m$ = m$ + "........" + Chr$(13)
  2315.     m$ = m$ + "........" + Chr$(13)
  2316.     m$ = m$ + "22222222" + Chr$(13)
  2317.     m$ = m$ + "22222222" + Chr$(13)
  2318.     m$ = m$ + "........" + Chr$(13)
  2319.     m$ = m$ + "........" + Chr$(13)
  2320.     m$ = m$ + "........" + Chr$(13)
  2321.     m$ = m$ + "........" + Chr$(13)
  2322.     arrTileText(132) = m$
  2323.  
  2324.     m$ = ""
  2325.     m$ = m$ + "........" + Chr$(13)
  2326.     m$ = m$ + "22222222" + Chr$(13)
  2327.     m$ = m$ + "22222222" + Chr$(13)
  2328.     m$ = m$ + "........" + Chr$(13)
  2329.     m$ = m$ + "........" + Chr$(13)
  2330.     m$ = m$ + "........" + Chr$(13)
  2331.     m$ = m$ + "........" + Chr$(13)
  2332.     m$ = m$ + "........" + Chr$(13)
  2333.     arrTileText(133) = m$
  2334.  
  2335.     m$ = ""
  2336.     m$ = m$ + "........" + Chr$(13)
  2337.     m$ = m$ + "........" + Chr$(13)
  2338.     m$ = m$ + "........" + Chr$(13)
  2339.     m$ = m$ + "........" + Chr$(13)
  2340.     m$ = m$ + "22222222" + Chr$(13)
  2341.     m$ = m$ + "22222222" + Chr$(13)
  2342.     m$ = m$ + "........" + Chr$(13)
  2343.     m$ = m$ + "........" + Chr$(13)
  2344.     arrTileText(134) = m$
  2345.  
  2346.     m$ = ""
  2347.     m$ = m$ + "..22...." + Chr$(13)
  2348.     m$ = m$ + "..22...." + Chr$(13)
  2349.     m$ = m$ + "..22...." + Chr$(13)
  2350.     m$ = m$ + "..22...." + Chr$(13)
  2351.     m$ = m$ + "..22...." + Chr$(13)
  2352.     m$ = m$ + "..22...." + Chr$(13)
  2353.     m$ = m$ + "..22...." + Chr$(13)
  2354.     m$ = m$ + "..22...." + Chr$(13)
  2355.     arrTileText(135) = m$
  2356.  
  2357.     m$ = ""
  2358.     m$ = m$ + "....22.." + Chr$(13)
  2359.     m$ = m$ + "....22.." + Chr$(13)
  2360.     m$ = m$ + "....22.." + Chr$(13)
  2361.     m$ = m$ + "....22.." + Chr$(13)
  2362.     m$ = m$ + "....22.." + Chr$(13)
  2363.     m$ = m$ + "....22.." + Chr$(13)
  2364.     m$ = m$ + "....22.." + Chr$(13)
  2365.     m$ = m$ + "....22.." + Chr$(13)
  2366.     arrTileText(136) = m$
  2367.  
  2368.     m$ = ""
  2369.     m$ = m$ + "........" + Chr$(13)
  2370.     m$ = m$ + "........" + Chr$(13)
  2371.     m$ = m$ + "........" + Chr$(13)
  2372.     m$ = m$ + "222....." + Chr$(13)
  2373.     m$ = m$ + "2222...." + Chr$(13)
  2374.     m$ = m$ + "..222..." + Chr$(13)
  2375.     m$ = m$ + "...22..." + Chr$(13)
  2376.     m$ = m$ + "...22..." + Chr$(13)
  2377.     arrTileText(137) = m$
  2378.  
  2379.     m$ = ""
  2380.     m$ = m$ + "...22..." + Chr$(13)
  2381.     m$ = m$ + "...22..." + Chr$(13)
  2382.     m$ = m$ + "...222.." + Chr$(13)
  2383.     m$ = m$ + "....2222" + Chr$(13)
  2384.     m$ = m$ + ".....222" + Chr$(13)
  2385.     m$ = m$ + "........" + Chr$(13)
  2386.     m$ = m$ + "........" + Chr$(13)
  2387.     m$ = m$ + "........" + Chr$(13)
  2388.     arrTileText(138) = m$
  2389.  
  2390.     m$ = ""
  2391.     m$ = m$ + "...22..." + Chr$(13)
  2392.     m$ = m$ + "...22..." + Chr$(13)
  2393.     m$ = m$ + "..222..." + Chr$(13)
  2394.     m$ = m$ + "2222...." + Chr$(13)
  2395.     m$ = m$ + "222....." + Chr$(13)
  2396.     m$ = m$ + "........" + Chr$(13)
  2397.     m$ = m$ + "........" + Chr$(13)
  2398.     m$ = m$ + "........" + Chr$(13)
  2399.     arrTileText(139) = m$
  2400.  
  2401.     m$ = ""
  2402.     m$ = m$ + "22......" + Chr$(13)
  2403.     m$ = m$ + "22......" + Chr$(13)
  2404.     m$ = m$ + "22......" + Chr$(13)
  2405.     m$ = m$ + "22......" + Chr$(13)
  2406.     m$ = m$ + "22......" + Chr$(13)
  2407.     m$ = m$ + "22......" + Chr$(13)
  2408.     m$ = m$ + "22222222" + Chr$(13)
  2409.     m$ = m$ + "22222222" + Chr$(13)
  2410.     arrTileText(140) = m$
  2411.  
  2412.     m$ = ""
  2413.     m$ = m$ + "22......" + Chr$(13)
  2414.     m$ = m$ + "222....." + Chr$(13)
  2415.     m$ = m$ + ".222...." + Chr$(13)
  2416.     m$ = m$ + "..222..." + Chr$(13)
  2417.     m$ = m$ + "...222.." + Chr$(13)
  2418.     m$ = m$ + "....222." + Chr$(13)
  2419.     m$ = m$ + ".....222" + Chr$(13)
  2420.     m$ = m$ + "......22" + Chr$(13)
  2421.     arrTileText(141) = m$
  2422.  
  2423.     m$ = ""
  2424.     m$ = m$ + "......22" + Chr$(13)
  2425.     m$ = m$ + ".....222" + Chr$(13)
  2426.     m$ = m$ + "....222." + Chr$(13)
  2427.     m$ = m$ + "...222.." + Chr$(13)
  2428.     m$ = m$ + "..222..." + Chr$(13)
  2429.     m$ = m$ + ".222...." + Chr$(13)
  2430.     m$ = m$ + "222....." + Chr$(13)
  2431.     m$ = m$ + "22......" + Chr$(13)
  2432.     arrTileText(142) = m$
  2433.  
  2434.     m$ = ""
  2435.     m$ = m$ + "22222222" + Chr$(13)
  2436.     m$ = m$ + "22222222" + Chr$(13)
  2437.     m$ = m$ + "22......" + Chr$(13)
  2438.     m$ = m$ + "22......" + Chr$(13)
  2439.     m$ = m$ + "22......" + Chr$(13)
  2440.     m$ = m$ + "22......" + Chr$(13)
  2441.     m$ = m$ + "22......" + Chr$(13)
  2442.     m$ = m$ + "22......" + Chr$(13)
  2443.     arrTileText(143) = m$
  2444.  
  2445.     m$ = ""
  2446.     m$ = m$ + "22222222" + Chr$(13)
  2447.     m$ = m$ + "22222222" + Chr$(13)
  2448.     m$ = m$ + "......22" + Chr$(13)
  2449.     m$ = m$ + "......22" + Chr$(13)
  2450.     m$ = m$ + "......22" + Chr$(13)
  2451.     m$ = m$ + "......22" + Chr$(13)
  2452.     m$ = m$ + "......22" + Chr$(13)
  2453.     m$ = m$ + "......22" + Chr$(13)
  2454.     arrTileText(144) = m$
  2455.  
  2456.     m$ = ""
  2457.     m$ = m$ + "........" + Chr$(13)
  2458.     m$ = m$ + "..2222.." + Chr$(13)
  2459.     m$ = m$ + ".222222." + Chr$(13)
  2460.     m$ = m$ + ".222222." + Chr$(13)
  2461.     m$ = m$ + ".222222." + Chr$(13)
  2462.     m$ = m$ + ".222222." + Chr$(13)
  2463.     m$ = m$ + "..2222.." + Chr$(13)
  2464.     m$ = m$ + "........" + Chr$(13)
  2465.     arrTileText(145) = m$
  2466.  
  2467.     m$ = ""
  2468.     m$ = m$ + "........" + Chr$(13)
  2469.     m$ = m$ + "........" + Chr$(13)
  2470.     m$ = m$ + "........" + Chr$(13)
  2471.     m$ = m$ + "........" + Chr$(13)
  2472.     m$ = m$ + "........" + Chr$(13)
  2473.     m$ = m$ + "22222222" + Chr$(13)
  2474.     m$ = m$ + "22222222" + Chr$(13)
  2475.     m$ = m$ + "........" + Chr$(13)
  2476.     arrTileText(146) = m$
  2477.  
  2478.     m$ = ""
  2479.     m$ = m$ + "..22.22." + Chr$(13)
  2480.     m$ = m$ + ".2222222" + Chr$(13)
  2481.     m$ = m$ + ".2222222" + Chr$(13)
  2482.     m$ = m$ + ".2222222" + Chr$(13)
  2483.     m$ = m$ + "..22222." + Chr$(13)
  2484.     m$ = m$ + "...222.." + Chr$(13)
  2485.     m$ = m$ + "....2..." + Chr$(13)
  2486.     m$ = m$ + "........" + Chr$(13)
  2487.     arrTileText(147) = m$
  2488.  
  2489.     m$ = ""
  2490.     m$ = m$ + ".22....." + Chr$(13)
  2491.     m$ = m$ + ".22....." + Chr$(13)
  2492.     m$ = m$ + ".22....." + Chr$(13)
  2493.     m$ = m$ + ".22....." + Chr$(13)
  2494.     m$ = m$ + ".22....." + Chr$(13)
  2495.     m$ = m$ + ".22....." + Chr$(13)
  2496.     m$ = m$ + ".22....." + Chr$(13)
  2497.     m$ = m$ + ".22....." + Chr$(13)
  2498.     arrTileText(148) = m$
  2499.  
  2500.     m$ = ""
  2501.     m$ = m$ + "........" + Chr$(13)
  2502.     m$ = m$ + "........" + Chr$(13)
  2503.     m$ = m$ + "........" + Chr$(13)
  2504.     m$ = m$ + ".....222" + Chr$(13)
  2505.     m$ = m$ + "....2222" + Chr$(13)
  2506.     m$ = m$ + "...222.." + Chr$(13)
  2507.     m$ = m$ + "...22..." + Chr$(13)
  2508.     m$ = m$ + "...22..." + Chr$(13)
  2509.     arrTileText(149) = m$
  2510.  
  2511.     m$ = ""
  2512.     m$ = m$ + "22....22" + Chr$(13)
  2513.     m$ = m$ + "222..222" + Chr$(13)
  2514.     m$ = m$ + ".222222." + Chr$(13)
  2515.     m$ = m$ + "..2222.." + Chr$(13)
  2516.     m$ = m$ + "..2222.." + Chr$(13)
  2517.     m$ = m$ + ".222222." + Chr$(13)
  2518.     m$ = m$ + "222..222" + Chr$(13)
  2519.     m$ = m$ + "22....22" + Chr$(13)
  2520.     arrTileText(150) = m$
  2521.  
  2522.     m$ = ""
  2523.     m$ = m$ + "........" + Chr$(13)
  2524.     m$ = m$ + "..2222.." + Chr$(13)
  2525.     m$ = m$ + ".222222." + Chr$(13)
  2526.     m$ = m$ + ".22..22." + Chr$(13)
  2527.     m$ = m$ + ".22..22." + Chr$(13)
  2528.     m$ = m$ + ".222222." + Chr$(13)
  2529.     m$ = m$ + "..2222.." + Chr$(13)
  2530.     m$ = m$ + "........" + Chr$(13)
  2531.     arrTileText(151) = m$
  2532.  
  2533.     m$ = ""
  2534.     m$ = m$ + "...22..." + Chr$(13)
  2535.     m$ = m$ + "...22..." + Chr$(13)
  2536.     m$ = m$ + ".22..22." + Chr$(13)
  2537.     m$ = m$ + ".22..22." + Chr$(13)
  2538.     m$ = m$ + "...22..." + Chr$(13)
  2539.     m$ = m$ + "...22..." + Chr$(13)
  2540.     m$ = m$ + "..2222.." + Chr$(13)
  2541.     m$ = m$ + "........" + Chr$(13)
  2542.     arrTileText(152) = m$
  2543.  
  2544.     m$ = ""
  2545.     m$ = m$ + ".....22." + Chr$(13)
  2546.     m$ = m$ + ".....22." + Chr$(13)
  2547.     m$ = m$ + ".....22." + Chr$(13)
  2548.     m$ = m$ + ".....22." + Chr$(13)
  2549.     m$ = m$ + ".....22." + Chr$(13)
  2550.     m$ = m$ + ".....22." + Chr$(13)
  2551.     m$ = m$ + ".....22." + Chr$(13)
  2552.     m$ = m$ + ".....22." + Chr$(13)
  2553.     arrTileText(153) = m$
  2554.  
  2555.     m$ = ""
  2556.     m$ = m$ + "....2..." + Chr$(13)
  2557.     m$ = m$ + "...222.." + Chr$(13)
  2558.     m$ = m$ + "..22222." + Chr$(13)
  2559.     m$ = m$ + ".2222222" + Chr$(13)
  2560.     m$ = m$ + "..22222." + Chr$(13)
  2561.     m$ = m$ + "...222.." + Chr$(13)
  2562.     m$ = m$ + "....2..." + Chr$(13)
  2563.     m$ = m$ + "........" + Chr$(13)
  2564.     arrTileText(154) = m$
  2565.  
  2566.     m$ = ""
  2567.     m$ = m$ + "...22..." + Chr$(13)
  2568.     m$ = m$ + "...22..." + Chr$(13)
  2569.     m$ = m$ + "...22..." + Chr$(13)
  2570.     m$ = m$ + "22222222" + Chr$(13)
  2571.     m$ = m$ + "22222222" + Chr$(13)
  2572.     m$ = m$ + "...22..." + Chr$(13)
  2573.     m$ = m$ + "...22..." + Chr$(13)
  2574.     m$ = m$ + "...22..." + Chr$(13)
  2575.     arrTileText(155) = m$
  2576.  
  2577.     m$ = ""
  2578.     m$ = m$ + "22......" + Chr$(13)
  2579.     m$ = m$ + "22......" + Chr$(13)
  2580.     m$ = m$ + "..22...." + Chr$(13)
  2581.     m$ = m$ + "..22...." + Chr$(13)
  2582.     m$ = m$ + "22......" + Chr$(13)
  2583.     m$ = m$ + "22......" + Chr$(13)
  2584.     m$ = m$ + "..22...." + Chr$(13)
  2585.     m$ = m$ + "..22...." + Chr$(13)
  2586.     arrTileText(156) = m$
  2587.  
  2588.     m$ = ""
  2589.     m$ = m$ + "...22..." + Chr$(13)
  2590.     m$ = m$ + "...22..." + Chr$(13)
  2591.     m$ = m$ + "...22..." + Chr$(13)
  2592.     m$ = m$ + "...22..." + Chr$(13)
  2593.     m$ = m$ + "...22..." + Chr$(13)
  2594.     m$ = m$ + "...22..." + Chr$(13)
  2595.     m$ = m$ + "...22..." + Chr$(13)
  2596.     m$ = m$ + "...22..." + Chr$(13)
  2597.     arrTileText(157) = m$
  2598.  
  2599.     m$ = ""
  2600.     m$ = m$ + "........" + Chr$(13)
  2601.     m$ = m$ + "........" + Chr$(13)
  2602.     m$ = m$ + "......22" + Chr$(13)
  2603.     m$ = m$ + "..22222." + Chr$(13)
  2604.     m$ = m$ + ".222.22." + Chr$(13)
  2605.     m$ = m$ + "..22.22." + Chr$(13)
  2606.     m$ = m$ + "..22.22." + Chr$(13)
  2607.     m$ = m$ + "........" + Chr$(13)
  2608.     arrTileText(158) = m$
  2609.  
  2610.     m$ = ""
  2611.     m$ = m$ + "22222222" + Chr$(13)
  2612.     m$ = m$ + ".2222222" + Chr$(13)
  2613.     m$ = m$ + "..222222" + Chr$(13)
  2614.     m$ = m$ + "...22222" + Chr$(13)
  2615.     m$ = m$ + "....2222" + Chr$(13)
  2616.     m$ = m$ + ".....222" + Chr$(13)
  2617.     m$ = m$ + "......22" + Chr$(13)
  2618.     m$ = m$ + ".......2" + Chr$(13)
  2619.     arrTileText(159) = m$
  2620.  
  2621.     m$ = ""
  2622.     m$ = m$ + "........" + Chr$(13)
  2623.     m$ = m$ + "........" + Chr$(13)
  2624.     m$ = m$ + "........" + Chr$(13)
  2625.     m$ = m$ + "........" + Chr$(13)
  2626.     m$ = m$ + "........" + Chr$(13)
  2627.     m$ = m$ + "........" + Chr$(13)
  2628.     m$ = m$ + "........" + Chr$(13)
  2629.     m$ = m$ + "........" + Chr$(13)
  2630.     arrTileText(160) = m$
  2631.  
  2632.     m$ = ""
  2633.     m$ = m$ + "2222...." + Chr$(13)
  2634.     m$ = m$ + "2222...." + Chr$(13)
  2635.     m$ = m$ + "2222...." + Chr$(13)
  2636.     m$ = m$ + "2222...." + Chr$(13)
  2637.     m$ = m$ + "2222...." + Chr$(13)
  2638.     m$ = m$ + "2222...." + Chr$(13)
  2639.     m$ = m$ + "2222...." + Chr$(13)
  2640.     m$ = m$ + "2222...." + Chr$(13)
  2641.     arrTileText(161) = m$
  2642.  
  2643.     m$ = ""
  2644.     m$ = m$ + "........" + Chr$(13)
  2645.     m$ = m$ + "........" + Chr$(13)
  2646.     m$ = m$ + "........" + Chr$(13)
  2647.     m$ = m$ + "........" + Chr$(13)
  2648.     m$ = m$ + "22222222" + Chr$(13)
  2649.     m$ = m$ + "22222222" + Chr$(13)
  2650.     m$ = m$ + "22222222" + Chr$(13)
  2651.     m$ = m$ + "22222222" + Chr$(13)
  2652.     arrTileText(162) = m$
  2653.  
  2654.     m$ = ""
  2655.     m$ = m$ + "22222222" + Chr$(13)
  2656.     m$ = m$ + "........" + Chr$(13)
  2657.     m$ = m$ + "........" + Chr$(13)
  2658.     m$ = m$ + "........" + Chr$(13)
  2659.     m$ = m$ + "........" + Chr$(13)
  2660.     m$ = m$ + "........" + Chr$(13)
  2661.     m$ = m$ + "........" + Chr$(13)
  2662.     m$ = m$ + "........" + Chr$(13)
  2663.     arrTileText(163) = m$
  2664.  
  2665.     m$ = ""
  2666.     m$ = m$ + "........" + Chr$(13)
  2667.     m$ = m$ + "........" + Chr$(13)
  2668.     m$ = m$ + "........" + Chr$(13)
  2669.     m$ = m$ + "........" + Chr$(13)
  2670.     m$ = m$ + "........" + Chr$(13)
  2671.     m$ = m$ + "........" + Chr$(13)
  2672.     m$ = m$ + "........" + Chr$(13)
  2673.     m$ = m$ + "22222222" + Chr$(13)
  2674.     arrTileText(164) = m$
  2675.  
  2676.     m$ = ""
  2677.     m$ = m$ + "22......" + Chr$(13)
  2678.     m$ = m$ + "22......" + Chr$(13)
  2679.     m$ = m$ + "22......" + Chr$(13)
  2680.     m$ = m$ + "22......" + Chr$(13)
  2681.     m$ = m$ + "22......" + Chr$(13)
  2682.     m$ = m$ + "22......" + Chr$(13)
  2683.     m$ = m$ + "22......" + Chr$(13)
  2684.     m$ = m$ + "22......" + Chr$(13)
  2685.     arrTileText(165) = m$
  2686.  
  2687.     m$ = ""
  2688.     m$ = m$ + "22..22.." + Chr$(13)
  2689.     m$ = m$ + "22..22.." + Chr$(13)
  2690.     m$ = m$ + "..22..22" + Chr$(13)
  2691.     m$ = m$ + "..22..22" + Chr$(13)
  2692.     m$ = m$ + "22..22.." + Chr$(13)
  2693.     m$ = m$ + "22..22.." + Chr$(13)
  2694.     m$ = m$ + "..22..22" + Chr$(13)
  2695.     m$ = m$ + "..22..22" + Chr$(13)
  2696.     arrTileText(166) = m$
  2697.  
  2698.     m$ = ""
  2699.     m$ = m$ + "......22" + Chr$(13)
  2700.     m$ = m$ + "......22" + Chr$(13)
  2701.     m$ = m$ + "......22" + Chr$(13)
  2702.     m$ = m$ + "......22" + Chr$(13)
  2703.     m$ = m$ + "......22" + Chr$(13)
  2704.     m$ = m$ + "......22" + Chr$(13)
  2705.     m$ = m$ + "......22" + Chr$(13)
  2706.     m$ = m$ + "......22" + Chr$(13)
  2707.     arrTileText(167) = m$
  2708.  
  2709.     m$ = ""
  2710.     m$ = m$ + "........" + Chr$(13)
  2711.     m$ = m$ + "........" + Chr$(13)
  2712.     m$ = m$ + "........" + Chr$(13)
  2713.     m$ = m$ + "........" + Chr$(13)
  2714.     m$ = m$ + "22..22.." + Chr$(13)
  2715.     m$ = m$ + "22..22.." + Chr$(13)
  2716.     m$ = m$ + "..22..22" + Chr$(13)
  2717.     m$ = m$ + "..22..22" + Chr$(13)
  2718.     arrTileText(168) = m$
  2719.  
  2720.     m$ = ""
  2721.     m$ = m$ + "22222222" + Chr$(13)
  2722.     m$ = m$ + "2222222." + Chr$(13)
  2723.     m$ = m$ + "222222.." + Chr$(13)
  2724.     m$ = m$ + "22222..." + Chr$(13)
  2725.     m$ = m$ + "2222...." + Chr$(13)
  2726.     m$ = m$ + "222....." + Chr$(13)
  2727.     m$ = m$ + "22......" + Chr$(13)
  2728.     m$ = m$ + "2......." + Chr$(13)
  2729.     arrTileText(169) = m$
  2730.  
  2731.     m$ = ""
  2732.     m$ = m$ + "......22" + Chr$(13)
  2733.     m$ = m$ + "......22" + Chr$(13)
  2734.     m$ = m$ + "......22" + Chr$(13)
  2735.     m$ = m$ + "......22" + Chr$(13)
  2736.     m$ = m$ + "......22" + Chr$(13)
  2737.     m$ = m$ + "......22" + Chr$(13)
  2738.     m$ = m$ + "......22" + Chr$(13)
  2739.     m$ = m$ + "......22" + Chr$(13)
  2740.     arrTileText(170) = m$
  2741.  
  2742.     m$ = ""
  2743.     m$ = m$ + "...22..." + Chr$(13)
  2744.     m$ = m$ + "...22..." + Chr$(13)
  2745.     m$ = m$ + "...22..." + Chr$(13)
  2746.     m$ = m$ + "...22222" + Chr$(13)
  2747.     m$ = m$ + "...22222" + Chr$(13)
  2748.     m$ = m$ + "...22..." + Chr$(13)
  2749.     m$ = m$ + "...22..." + Chr$(13)
  2750.     m$ = m$ + "...22..." + Chr$(13)
  2751.     arrTileText(171) = m$
  2752.  
  2753.     m$ = ""
  2754.     m$ = m$ + "........" + Chr$(13)
  2755.     m$ = m$ + "........" + Chr$(13)
  2756.     m$ = m$ + "........" + Chr$(13)
  2757.     m$ = m$ + "........" + Chr$(13)
  2758.     m$ = m$ + "....2222" + Chr$(13)
  2759.     m$ = m$ + "....2222" + Chr$(13)
  2760.     m$ = m$ + "....2222" + Chr$(13)
  2761.     m$ = m$ + "....2222" + Chr$(13)
  2762.     arrTileText(172) = m$
  2763.  
  2764.     m$ = ""
  2765.     m$ = m$ + "...22..." + Chr$(13)
  2766.     m$ = m$ + "...22..." + Chr$(13)
  2767.     m$ = m$ + "...22..." + Chr$(13)
  2768.     m$ = m$ + "...22222" + Chr$(13)
  2769.     m$ = m$ + "...22222" + Chr$(13)
  2770.     m$ = m$ + "........" + Chr$(13)
  2771.     m$ = m$ + "........" + Chr$(13)
  2772.     m$ = m$ + "........" + Chr$(13)
  2773.     arrTileText(173) = m$
  2774.  
  2775.     m$ = ""
  2776.     m$ = m$ + "........" + Chr$(13)
  2777.     m$ = m$ + "........" + Chr$(13)
  2778.     m$ = m$ + "........" + Chr$(13)
  2779.     m$ = m$ + "22222..." + Chr$(13)
  2780.     m$ = m$ + "22222..." + Chr$(13)
  2781.     m$ = m$ + "...22..." + Chr$(13)
  2782.     m$ = m$ + "...22..." + Chr$(13)
  2783.     m$ = m$ + "...22..." + Chr$(13)
  2784.     arrTileText(174) = m$
  2785.  
  2786.     m$ = ""
  2787.     m$ = m$ + "........" + Chr$(13)
  2788.     m$ = m$ + "........" + Chr$(13)
  2789.     m$ = m$ + "........" + Chr$(13)
  2790.     m$ = m$ + "........" + Chr$(13)
  2791.     m$ = m$ + "........" + Chr$(13)
  2792.     m$ = m$ + "........" + Chr$(13)
  2793.     m$ = m$ + "22222222" + Chr$(13)
  2794.     m$ = m$ + "22222222" + Chr$(13)
  2795.     arrTileText(175) = m$
  2796.  
  2797.     m$ = ""
  2798.     m$ = m$ + "........" + Chr$(13)
  2799.     m$ = m$ + "........" + Chr$(13)
  2800.     m$ = m$ + "........" + Chr$(13)
  2801.     m$ = m$ + "...22222" + Chr$(13)
  2802.     m$ = m$ + "...22222" + Chr$(13)
  2803.     m$ = m$ + "...22..." + Chr$(13)
  2804.     m$ = m$ + "...22..." + Chr$(13)
  2805.     m$ = m$ + "...22..." + Chr$(13)
  2806.     arrTileText(176) = m$
  2807.  
  2808.     m$ = ""
  2809.     m$ = m$ + "...22..." + Chr$(13)
  2810.     m$ = m$ + "...22..." + Chr$(13)
  2811.     m$ = m$ + "...22..." + Chr$(13)
  2812.     m$ = m$ + "22222222" + Chr$(13)
  2813.     m$ = m$ + "22222222" + Chr$(13)
  2814.     m$ = m$ + "........" + Chr$(13)
  2815.     m$ = m$ + "........" + Chr$(13)
  2816.     m$ = m$ + "........" + Chr$(13)
  2817.     arrTileText(177) = m$
  2818.  
  2819.     m$ = ""
  2820.     m$ = m$ + "........" + Chr$(13)
  2821.     m$ = m$ + "........" + Chr$(13)
  2822.     m$ = m$ + "........" + Chr$(13)
  2823.     m$ = m$ + "22222222" + Chr$(13)
  2824.     m$ = m$ + "22222222" + Chr$(13)
  2825.     m$ = m$ + "...22..." + Chr$(13)
  2826.     m$ = m$ + "...22..." + Chr$(13)
  2827.     m$ = m$ + "...22..." + Chr$(13)
  2828.     arrTileText(178) = m$
  2829.  
  2830.     m$ = ""
  2831.     m$ = m$ + "...22..." + Chr$(13)
  2832.     m$ = m$ + "...22..." + Chr$(13)
  2833.     m$ = m$ + "...22..." + Chr$(13)
  2834.     m$ = m$ + "22222..." + Chr$(13)
  2835.     m$ = m$ + "22222..." + Chr$(13)
  2836.     m$ = m$ + "...22..." + Chr$(13)
  2837.     m$ = m$ + "...22..." + Chr$(13)
  2838.     m$ = m$ + "...22..." + Chr$(13)
  2839.     arrTileText(179) = m$
  2840.  
  2841.     m$ = ""
  2842.     m$ = m$ + "22......" + Chr$(13)
  2843.     m$ = m$ + "22......" + Chr$(13)
  2844.     m$ = m$ + "22......" + Chr$(13)
  2845.     m$ = m$ + "22......" + Chr$(13)
  2846.     m$ = m$ + "22......" + Chr$(13)
  2847.     m$ = m$ + "22......" + Chr$(13)
  2848.     m$ = m$ + "22......" + Chr$(13)
  2849.     m$ = m$ + "22......" + Chr$(13)
  2850.     arrTileText(180) = m$
  2851.  
  2852.     m$ = ""
  2853.     m$ = m$ + "222....." + Chr$(13)
  2854.     m$ = m$ + "222....." + Chr$(13)
  2855.     m$ = m$ + "222....." + Chr$(13)
  2856.     m$ = m$ + "222....." + Chr$(13)
  2857.     m$ = m$ + "222....." + Chr$(13)
  2858.     m$ = m$ + "222....." + Chr$(13)
  2859.     m$ = m$ + "222....." + Chr$(13)
  2860.     m$ = m$ + "222....." + Chr$(13)
  2861.     arrTileText(181) = m$
  2862.  
  2863.     m$ = ""
  2864.     m$ = m$ + ".....222" + Chr$(13)
  2865.     m$ = m$ + ".....222" + Chr$(13)
  2866.     m$ = m$ + ".....222" + Chr$(13)
  2867.     m$ = m$ + ".....222" + Chr$(13)
  2868.     m$ = m$ + ".....222" + Chr$(13)
  2869.     m$ = m$ + ".....222" + Chr$(13)
  2870.     m$ = m$ + ".....222" + Chr$(13)
  2871.     m$ = m$ + ".....222" + Chr$(13)
  2872.     arrTileText(182) = m$
  2873.  
  2874.     m$ = ""
  2875.     m$ = m$ + "22222222" + Chr$(13)
  2876.     m$ = m$ + "22222222" + Chr$(13)
  2877.     m$ = m$ + "........" + Chr$(13)
  2878.     m$ = m$ + "........" + Chr$(13)
  2879.     m$ = m$ + "........" + Chr$(13)
  2880.     m$ = m$ + "........" + Chr$(13)
  2881.     m$ = m$ + "........" + Chr$(13)
  2882.     m$ = m$ + "........" + Chr$(13)
  2883.     arrTileText(183) = m$
  2884.  
  2885.     m$ = ""
  2886.     m$ = m$ + "22222222" + Chr$(13)
  2887.     m$ = m$ + "22222222" + Chr$(13)
  2888.     m$ = m$ + "22222222" + Chr$(13)
  2889.     m$ = m$ + "........" + Chr$(13)
  2890.     m$ = m$ + "........" + Chr$(13)
  2891.     m$ = m$ + "........" + Chr$(13)
  2892.     m$ = m$ + "........" + Chr$(13)
  2893.     m$ = m$ + "........" + Chr$(13)
  2894.     arrTileText(184) = m$
  2895.  
  2896.     m$ = ""
  2897.     m$ = m$ + "........" + Chr$(13)
  2898.     m$ = m$ + "........" + Chr$(13)
  2899.     m$ = m$ + "........" + Chr$(13)
  2900.     m$ = m$ + "........" + Chr$(13)
  2901.     m$ = m$ + "........" + Chr$(13)
  2902.     m$ = m$ + "22222222" + Chr$(13)
  2903.     m$ = m$ + "22222222" + Chr$(13)
  2904.     m$ = m$ + "22222222" + Chr$(13)
  2905.     arrTileText(185) = m$
  2906.  
  2907.     m$ = ""
  2908.     m$ = m$ + "......22" + Chr$(13)
  2909.     m$ = m$ + "......22" + Chr$(13)
  2910.     m$ = m$ + "......22" + Chr$(13)
  2911.     m$ = m$ + "......22" + Chr$(13)
  2912.     m$ = m$ + "......22" + Chr$(13)
  2913.     m$ = m$ + "......22" + Chr$(13)
  2914.     m$ = m$ + "22222222" + Chr$(13)
  2915.     m$ = m$ + "22222222" + Chr$(13)
  2916.     arrTileText(186) = m$
  2917.  
  2918.     m$ = ""
  2919.     m$ = m$ + "........" + Chr$(13)
  2920.     m$ = m$ + "........" + Chr$(13)
  2921.     m$ = m$ + "........" + Chr$(13)
  2922.     m$ = m$ + "........" + Chr$(13)
  2923.     m$ = m$ + "2222...." + Chr$(13)
  2924.     m$ = m$ + "2222...." + Chr$(13)
  2925.     m$ = m$ + "2222...." + Chr$(13)
  2926.     m$ = m$ + "2222...." + Chr$(13)
  2927.     arrTileText(187) = m$
  2928.  
  2929.     m$ = ""
  2930.     m$ = m$ + "....2222" + Chr$(13)
  2931.     m$ = m$ + "....2222" + Chr$(13)
  2932.     m$ = m$ + "....2222" + Chr$(13)
  2933.     m$ = m$ + "....2222" + Chr$(13)
  2934.     m$ = m$ + "........" + Chr$(13)
  2935.     m$ = m$ + "........" + Chr$(13)
  2936.     m$ = m$ + "........" + Chr$(13)
  2937.     m$ = m$ + "........" + Chr$(13)
  2938.     arrTileText(188) = m$
  2939.  
  2940.     m$ = ""
  2941.     m$ = m$ + "...22..." + Chr$(13)
  2942.     m$ = m$ + "...22..." + Chr$(13)
  2943.     m$ = m$ + "...22..." + Chr$(13)
  2944.     m$ = m$ + "22222..." + Chr$(13)
  2945.     m$ = m$ + "22222..." + Chr$(13)
  2946.     m$ = m$ + "........" + Chr$(13)
  2947.     m$ = m$ + "........" + Chr$(13)
  2948.     m$ = m$ + "........" + Chr$(13)
  2949.     arrTileText(189) = m$
  2950.  
  2951.     m$ = ""
  2952.     m$ = m$ + "2222...." + Chr$(13)
  2953.     m$ = m$ + "2222...." + Chr$(13)
  2954.     m$ = m$ + "2222...." + Chr$(13)
  2955.     m$ = m$ + "2222...." + Chr$(13)
  2956.     m$ = m$ + "........" + Chr$(13)
  2957.     m$ = m$ + "........" + Chr$(13)
  2958.     m$ = m$ + "........" + Chr$(13)
  2959.     m$ = m$ + "........" + Chr$(13)
  2960.     arrTileText(190) = m$
  2961.  
  2962.     m$ = ""
  2963.     m$ = m$ + "2222...." + Chr$(13)
  2964.     m$ = m$ + "2222...." + Chr$(13)
  2965.     m$ = m$ + "2222...." + Chr$(13)
  2966.     m$ = m$ + "2222...." + Chr$(13)
  2967.     m$ = m$ + "....2222" + Chr$(13)
  2968.     m$ = m$ + "....2222" + Chr$(13)
  2969.     m$ = m$ + "....2222" + Chr$(13)
  2970.     m$ = m$ + "....2222" + Chr$(13)
  2971.     arrTileText(191) = m$
  2972.  
  2973.     m$ = ""
  2974.     m$ = m$ + "........" + Chr$(13)
  2975.     m$ = m$ + ".2222222" + Chr$(13)
  2976.     m$ = m$ + ".2.....2" + Chr$(13)
  2977.     m$ = m$ + ".2.....2" + Chr$(13)
  2978.     m$ = m$ + ".2.....2" + Chr$(13)
  2979.     m$ = m$ + ".2.....2" + Chr$(13)
  2980.     m$ = m$ + ".2.....2" + Chr$(13)
  2981.     m$ = m$ + ".2222222" + Chr$(13)
  2982.     arrTileText(192) = m$
  2983.  
  2984.     m$ = ""
  2985.     m$ = m$ + "........" + Chr$(13)
  2986.     m$ = m$ + ".2222222" + Chr$(13)
  2987.     m$ = m$ + ".2222222" + Chr$(13)
  2988.     m$ = m$ + ".2222222" + Chr$(13)
  2989.     m$ = m$ + ".2222222" + Chr$(13)
  2990.     m$ = m$ + ".2222222" + Chr$(13)
  2991.     m$ = m$ + ".2222222" + Chr$(13)
  2992.     m$ = m$ + ".2222222" + Chr$(13)
  2993.     arrTileText(193) = m$
  2994.  
  2995.     m$ = ""
  2996.     m$ = m$ + "........" + Chr$(13)
  2997.     m$ = m$ + "...22..." + Chr$(13)
  2998.     m$ = m$ + "..2222.." + Chr$(13)
  2999.     m$ = m$ + ".222222." + Chr$(13)
  3000.     m$ = m$ + "...22..." + Chr$(13)
  3001.     m$ = m$ + "...22..." + Chr$(13)
  3002.     m$ = m$ + "...22..." + Chr$(13)
  3003.     m$ = m$ + "...22..." + Chr$(13)
  3004.     arrTileText(194) = m$
  3005.  
  3006.     m$ = ""
  3007.     m$ = m$ + "........" + Chr$(13)
  3008.     m$ = m$ + "...22..." + Chr$(13)
  3009.     m$ = m$ + "...22..." + Chr$(13)
  3010.     m$ = m$ + "...22..." + Chr$(13)
  3011.     m$ = m$ + "...22..." + Chr$(13)
  3012.     m$ = m$ + ".222222." + Chr$(13)
  3013.     m$ = m$ + "..2222.." + Chr$(13)
  3014.     m$ = m$ + "...22..." + Chr$(13)
  3015.     arrTileText(195) = m$
  3016.  
  3017.     m$ = ""
  3018.     m$ = m$ + "........" + Chr$(13)
  3019.     m$ = m$ + "...2...." + Chr$(13)
  3020.     m$ = m$ + "..22...." + Chr$(13)
  3021.     m$ = m$ + ".2222222" + Chr$(13)
  3022.     m$ = m$ + ".2222222" + Chr$(13)
  3023.     m$ = m$ + "..22...." + Chr$(13)
  3024.     m$ = m$ + "...2...." + Chr$(13)
  3025.     m$ = m$ + "........" + Chr$(13)
  3026.     arrTileText(196) = m$
  3027.  
  3028.     m$ = ""
  3029.     m$ = m$ + "........" + Chr$(13)
  3030.     m$ = m$ + ".....2.." + Chr$(13)
  3031.     m$ = m$ + ".....22." + Chr$(13)
  3032.     m$ = m$ + ".2222222" + Chr$(13)
  3033.     m$ = m$ + ".2222222" + Chr$(13)
  3034.     m$ = m$ + ".....22." + Chr$(13)
  3035.     m$ = m$ + ".....2.." + Chr$(13)
  3036.     m$ = m$ + "........" + Chr$(13)
  3037.     arrTileText(197) = m$
  3038.  
  3039.     m$ = ""
  3040.     m$ = m$ + "........" + Chr$(13)
  3041.     m$ = m$ + "........" + Chr$(13)
  3042.     m$ = m$ + "........" + Chr$(13)
  3043.     m$ = m$ + "........" + Chr$(13)
  3044.     m$ = m$ + "........" + Chr$(13)
  3045.     m$ = m$ + "........" + Chr$(13)
  3046.     m$ = m$ + "........" + Chr$(13)
  3047.     m$ = m$ + "........" + Chr$(13)
  3048.     arrTileText(198) = m$
  3049.  
  3050.     m$ = ""
  3051.     m$ = m$ + ".222222." + Chr$(13)
  3052.     m$ = m$ + "2......2" + Chr$(13)
  3053.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3054.     m$ = m$ + "2......2" + Chr$(13)
  3055.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3056.     m$ = m$ + "2.2222.2" + Chr$(13)
  3057.     m$ = m$ + "2......2" + Chr$(13)
  3058.     m$ = m$ + ".222222." + Chr$(13)
  3059.     arrTileText(199) = m$
  3060.  
  3061.     m$ = ""
  3062.     m$ = m$ + ".222222." + Chr$(13)
  3063.     m$ = m$ + "2......2" + Chr$(13)
  3064.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3065.     m$ = m$ + "2......2" + Chr$(13)
  3066.     m$ = m$ + "2.2222.2" + Chr$(13)
  3067.     m$ = m$ + "2.2..2.2" + Chr$(13)
  3068.     m$ = m$ + "2......2" + Chr$(13)
  3069.     m$ = m$ + ".222222." + Chr$(13)
  3070.     arrTileText(200) = m$
  3071.  
  3072.     m$ = ""
  3073.     m$ = m$ + "........" + Chr$(13)
  3074.     m$ = m$ + "........" + Chr$(13)
  3075.     m$ = m$ + "........" + Chr$(13)
  3076.     m$ = m$ + "........" + Chr$(13)
  3077.     m$ = m$ + "........" + Chr$(13)
  3078.     m$ = m$ + "........" + Chr$(13)
  3079.     m$ = m$ + "........" + Chr$(13)
  3080.     m$ = m$ + "........" + Chr$(13)
  3081.     arrTileText(201) = m$
  3082.  
  3083.     m$ = ""
  3084.     m$ = m$ + ".222222." + Chr$(13)
  3085.     m$ = m$ + ".....22." + Chr$(13)
  3086.     m$ = m$ + "....22.." + Chr$(13)
  3087.     m$ = m$ + "...22..." + Chr$(13)
  3088.     m$ = m$ + "..22...." + Chr$(13)
  3089.     m$ = m$ + ".22....." + Chr$(13)
  3090.     m$ = m$ + ".222222." + Chr$(13)
  3091.     m$ = m$ + "........" + Chr$(13)
  3092.     arrTileText(202) = m$
  3093.  
  3094.     m$ = ""
  3095.     m$ = m$ + "...22..." + Chr$(13)
  3096.     m$ = m$ + "...22..." + Chr$(13)
  3097.     m$ = m$ + "...22..." + Chr$(13)
  3098.     m$ = m$ + "22222222" + Chr$(13)
  3099.     m$ = m$ + "22222222" + Chr$(13)
  3100.     m$ = m$ + "...22..." + Chr$(13)
  3101.     m$ = m$ + "...22..." + Chr$(13)
  3102.     m$ = m$ + "...22..." + Chr$(13)
  3103.     arrTileText(203) = m$
  3104.  
  3105.     m$ = ""
  3106.     m$ = m$ + "22......" + Chr$(13)
  3107.     m$ = m$ + "22......" + Chr$(13)
  3108.     m$ = m$ + "..22...." + Chr$(13)
  3109.     m$ = m$ + "..22...." + Chr$(13)
  3110.     m$ = m$ + "22......" + Chr$(13)
  3111.     m$ = m$ + "22......" + Chr$(13)
  3112.     m$ = m$ + "..22...." + Chr$(13)
  3113.     m$ = m$ + "..22...." + Chr$(13)
  3114.     arrTileText(204) = m$
  3115.  
  3116.     m$ = ""
  3117.     m$ = m$ + "...22..." + Chr$(13)
  3118.     m$ = m$ + "...22..." + Chr$(13)
  3119.     m$ = m$ + "...22..." + Chr$(13)
  3120.     m$ = m$ + "...22..." + Chr$(13)
  3121.     m$ = m$ + "...22..." + Chr$(13)
  3122.     m$ = m$ + "...22..." + Chr$(13)
  3123.     m$ = m$ + "...22..." + Chr$(13)
  3124.     m$ = m$ + "...22..." + Chr$(13)
  3125.     arrTileText(205) = m$
  3126.  
  3127.     m$ = ""
  3128.     m$ = m$ + "..22..22" + Chr$(13)
  3129.     m$ = m$ + "..22..22" + Chr$(13)
  3130.     m$ = m$ + "22..22.." + Chr$(13)
  3131.     m$ = m$ + "22..22.." + Chr$(13)
  3132.     m$ = m$ + "..22..22" + Chr$(13)
  3133.     m$ = m$ + "..22..22" + Chr$(13)
  3134.     m$ = m$ + "22..22.." + Chr$(13)
  3135.     m$ = m$ + "22..22.." + Chr$(13)
  3136.     arrTileText(206) = m$
  3137.  
  3138.     m$ = ""
  3139.     m$ = m$ + "..22..22" + Chr$(13)
  3140.     m$ = m$ + "2..22..2" + Chr$(13)
  3141.     m$ = m$ + "22..22.." + Chr$(13)
  3142.     m$ = m$ + ".22..22." + Chr$(13)
  3143.     m$ = m$ + "..22..22" + Chr$(13)
  3144.     m$ = m$ + "2..22..2" + Chr$(13)
  3145.     m$ = m$ + "22..22.." + Chr$(13)
  3146.     m$ = m$ + ".22..22." + Chr$(13)
  3147.     arrTileText(207) = m$
  3148.  
  3149.     m$ = ""
  3150.     m$ = m$ + "........" + Chr$(13)
  3151.     m$ = m$ + "........" + Chr$(13)
  3152.     m$ = m$ + "........" + Chr$(13)
  3153.     m$ = m$ + "........" + Chr$(13)
  3154.     m$ = m$ + "........" + Chr$(13)
  3155.     m$ = m$ + "........" + Chr$(13)
  3156.     m$ = m$ + "........" + Chr$(13)
  3157.     m$ = m$ + "........" + Chr$(13)
  3158.     arrTileText(208) = m$
  3159.  
  3160.     m$ = ""
  3161.     m$ = m$ + "2222...." + Chr$(13)
  3162.     m$ = m$ + "2222...." + Chr$(13)
  3163.     m$ = m$ + "2222...." + Chr$(13)
  3164.     m$ = m$ + "2222...." + Chr$(13)
  3165.     m$ = m$ + "2222...." + Chr$(13)
  3166.     m$ = m$ + "2222...." + Chr$(13)
  3167.     m$ = m$ + "2222...." + Chr$(13)
  3168.     m$ = m$ + "2222...." + Chr$(13)
  3169.     arrTileText(209) = m$
  3170.  
  3171.     m$ = ""
  3172.     m$ = m$ + "........" + Chr$(13)
  3173.     m$ = m$ + "........" + Chr$(13)
  3174.     m$ = m$ + "........" + Chr$(13)
  3175.     m$ = m$ + "........" + Chr$(13)
  3176.     m$ = m$ + "22222222" + Chr$(13)
  3177.     m$ = m$ + "22222222" + Chr$(13)
  3178.     m$ = m$ + "22222222" + Chr$(13)
  3179.     m$ = m$ + "22222222" + Chr$(13)
  3180.     arrTileText(210) = m$
  3181.  
  3182.     m$ = ""
  3183.     m$ = m$ + "22222222" + Chr$(13)
  3184.     m$ = m$ + "........" + Chr$(13)
  3185.     m$ = m$ + "........" + Chr$(13)
  3186.     m$ = m$ + "........" + Chr$(13)
  3187.     m$ = m$ + "........" + Chr$(13)
  3188.     m$ = m$ + "........" + Chr$(13)
  3189.     m$ = m$ + "........" + Chr$(13)
  3190.     m$ = m$ + "........" + Chr$(13)
  3191.     arrTileText(211) = m$
  3192.  
  3193.     m$ = ""
  3194.     m$ = m$ + "........" + Chr$(13)
  3195.     m$ = m$ + "........" + Chr$(13)
  3196.     m$ = m$ + "........" + Chr$(13)
  3197.     m$ = m$ + "........" + Chr$(13)
  3198.     m$ = m$ + "........" + Chr$(13)
  3199.     m$ = m$ + "........" + Chr$(13)
  3200.     m$ = m$ + "........" + Chr$(13)
  3201.     m$ = m$ + "22222222" + Chr$(13)
  3202.     arrTileText(212) = m$
  3203.  
  3204.     m$ = ""
  3205.     m$ = m$ + "22......" + Chr$(13)
  3206.     m$ = m$ + "22......" + Chr$(13)
  3207.     m$ = m$ + "22......" + Chr$(13)
  3208.     m$ = m$ + "22......" + Chr$(13)
  3209.     m$ = m$ + "22......" + Chr$(13)
  3210.     m$ = m$ + "22......" + Chr$(13)
  3211.     m$ = m$ + "22......" + Chr$(13)
  3212.     m$ = m$ + "22......" + Chr$(13)
  3213.     arrTileText(213) = m$
  3214.  
  3215.     m$ = ""
  3216.     m$ = m$ + "22..22.." + Chr$(13)
  3217.     m$ = m$ + "22..22.." + Chr$(13)
  3218.     m$ = m$ + "..22..22" + Chr$(13)
  3219.     m$ = m$ + "..22..22" + Chr$(13)
  3220.     m$ = m$ + "22..22.." + Chr$(13)
  3221.     m$ = m$ + "22..22.." + Chr$(13)
  3222.     m$ = m$ + "..22..22" + Chr$(13)
  3223.     m$ = m$ + "..22..22" + Chr$(13)
  3224.     arrTileText(214) = m$
  3225.  
  3226.     m$ = ""
  3227.     m$ = m$ + "......22" + Chr$(13)
  3228.     m$ = m$ + "......22" + Chr$(13)
  3229.     m$ = m$ + "......22" + Chr$(13)
  3230.     m$ = m$ + "......22" + Chr$(13)
  3231.     m$ = m$ + "......22" + Chr$(13)
  3232.     m$ = m$ + "......22" + Chr$(13)
  3233.     m$ = m$ + "......22" + Chr$(13)
  3234.     m$ = m$ + "......22" + Chr$(13)
  3235.     arrTileText(215) = m$
  3236.  
  3237.     m$ = ""
  3238.     m$ = m$ + "........" + Chr$(13)
  3239.     m$ = m$ + "........" + Chr$(13)
  3240.     m$ = m$ + "........" + Chr$(13)
  3241.     m$ = m$ + "........" + Chr$(13)
  3242.     m$ = m$ + "22..22.." + Chr$(13)
  3243.     m$ = m$ + "22..22.." + Chr$(13)
  3244.     m$ = m$ + "..22..22" + Chr$(13)
  3245.     m$ = m$ + "..22..22" + Chr$(13)
  3246.     arrTileText(216) = m$
  3247.  
  3248.     m$ = ""
  3249.     m$ = m$ + "22..22.." + Chr$(13)
  3250.     m$ = m$ + "2..22..2" + Chr$(13)
  3251.     m$ = m$ + "..22..22" + Chr$(13)
  3252.     m$ = m$ + ".22..22." + Chr$(13)
  3253.     m$ = m$ + "22..22.." + Chr$(13)
  3254.     m$ = m$ + "2..22..2" + Chr$(13)
  3255.     m$ = m$ + "..22..22" + Chr$(13)
  3256.     m$ = m$ + ".22..22." + Chr$(13)
  3257.     arrTileText(217) = m$
  3258.  
  3259.     m$ = ""
  3260.     m$ = m$ + "......22" + Chr$(13)
  3261.     m$ = m$ + "......22" + Chr$(13)
  3262.     m$ = m$ + "......22" + Chr$(13)
  3263.     m$ = m$ + "......22" + Chr$(13)
  3264.     m$ = m$ + "......22" + Chr$(13)
  3265.     m$ = m$ + "......22" + Chr$(13)
  3266.     m$ = m$ + "......22" + Chr$(13)
  3267.     m$ = m$ + "......22" + Chr$(13)
  3268.     arrTileText(218) = m$
  3269.  
  3270.     m$ = ""
  3271.     m$ = m$ + "...22..." + Chr$(13)
  3272.     m$ = m$ + "...22..." + Chr$(13)
  3273.     m$ = m$ + "...22..." + Chr$(13)
  3274.     m$ = m$ + "...22222" + Chr$(13)
  3275.     m$ = m$ + "...22222" + Chr$(13)
  3276.     m$ = m$ + "...22..." + Chr$(13)
  3277.     m$ = m$ + "...22..." + Chr$(13)
  3278.     m$ = m$ + "...22..." + Chr$(13)
  3279.     arrTileText(219) = m$
  3280.  
  3281.     m$ = ""
  3282.     m$ = m$ + "........" + Chr$(13)
  3283.     m$ = m$ + "........" + Chr$(13)
  3284.     m$ = m$ + "........" + Chr$(13)
  3285.     m$ = m$ + "........" + Chr$(13)
  3286.     m$ = m$ + "....2222" + Chr$(13)
  3287.     m$ = m$ + "....2222" + Chr$(13)
  3288.     m$ = m$ + "....2222" + Chr$(13)
  3289.     m$ = m$ + "....2222" + Chr$(13)
  3290.     arrTileText(220) = m$
  3291.  
  3292.     m$ = ""
  3293.     m$ = m$ + "...22..." + Chr$(13)
  3294.     m$ = m$ + "...22..." + Chr$(13)
  3295.     m$ = m$ + "...22..." + Chr$(13)
  3296.     m$ = m$ + "...22222" + Chr$(13)
  3297.     m$ = m$ + "...22222" + Chr$(13)
  3298.     m$ = m$ + "........" + Chr$(13)
  3299.     m$ = m$ + "........" + Chr$(13)
  3300.     m$ = m$ + "........" + Chr$(13)
  3301.     arrTileText(221) = m$
  3302.  
  3303.     m$ = ""
  3304.     m$ = m$ + "........" + Chr$(13)
  3305.     m$ = m$ + "........" + Chr$(13)
  3306.     m$ = m$ + "........" + Chr$(13)
  3307.     m$ = m$ + "22222..." + Chr$(13)
  3308.     m$ = m$ + "22222..." + Chr$(13)
  3309.     m$ = m$ + "...22..." + Chr$(13)
  3310.     m$ = m$ + "...22..." + Chr$(13)
  3311.     m$ = m$ + "...22..." + Chr$(13)
  3312.     arrTileText(222) = m$
  3313.  
  3314.     m$ = ""
  3315.     m$ = m$ + "........" + Chr$(13)
  3316.     m$ = m$ + "........" + Chr$(13)
  3317.     m$ = m$ + "........" + Chr$(13)
  3318.     m$ = m$ + "........" + Chr$(13)
  3319.     m$ = m$ + "........" + Chr$(13)
  3320.     m$ = m$ + "........" + Chr$(13)
  3321.     m$ = m$ + "22222222" + Chr$(13)
  3322.     m$ = m$ + "22222222" + Chr$(13)
  3323.     arrTileText(223) = m$
  3324.  
  3325.     m$ = ""
  3326.     m$ = m$ + "........" + Chr$(13)
  3327.     m$ = m$ + "........" + Chr$(13)
  3328.     m$ = m$ + "........" + Chr$(13)
  3329.     m$ = m$ + "...22222" + Chr$(13)
  3330.     m$ = m$ + "...22222" + Chr$(13)
  3331.     m$ = m$ + "...22..." + Chr$(13)
  3332.     m$ = m$ + "...22..." + Chr$(13)
  3333.     m$ = m$ + "...22..." + Chr$(13)
  3334.     arrTileText(224) = m$
  3335.  
  3336.     m$ = ""
  3337.     m$ = m$ + "...22..." + Chr$(13)
  3338.     m$ = m$ + "...22..." + Chr$(13)
  3339.     m$ = m$ + "...22..." + Chr$(13)
  3340.     m$ = m$ + "22222222" + Chr$(13)
  3341.     m$ = m$ + "22222222" + Chr$(13)
  3342.     m$ = m$ + "........" + Chr$(13)
  3343.     m$ = m$ + "........" + Chr$(13)
  3344.     m$ = m$ + "........" + Chr$(13)
  3345.     arrTileText(225) = m$
  3346.  
  3347.     m$ = ""
  3348.     m$ = m$ + "........" + Chr$(13)
  3349.     m$ = m$ + "........" + Chr$(13)
  3350.     m$ = m$ + "........" + Chr$(13)
  3351.     m$ = m$ + "22222222" + Chr$(13)
  3352.     m$ = m$ + "22222222" + Chr$(13)
  3353.     m$ = m$ + "...22..." + Chr$(13)
  3354.     m$ = m$ + "...22..." + Chr$(13)
  3355.     m$ = m$ + "...22..." + Chr$(13)
  3356.     arrTileText(226) = m$
  3357.  
  3358.     m$ = ""
  3359.     m$ = m$ + "...22..." + Chr$(13)
  3360.     m$ = m$ + "...22..." + Chr$(13)
  3361.     m$ = m$ + "...22..." + Chr$(13)
  3362.     m$ = m$ + "22222..." + Chr$(13)
  3363.     m$ = m$ + "22222..." + Chr$(13)
  3364.     m$ = m$ + "...22..." + Chr$(13)
  3365.     m$ = m$ + "...22..." + Chr$(13)
  3366.     m$ = m$ + "...22..." + Chr$(13)
  3367.     arrTileText(227) = m$
  3368.  
  3369.     m$ = ""
  3370.     m$ = m$ + "22......" + Chr$(13)
  3371.     m$ = m$ + "22......" + Chr$(13)
  3372.     m$ = m$ + "22......" + Chr$(13)
  3373.     m$ = m$ + "22......" + Chr$(13)
  3374.     m$ = m$ + "22......" + Chr$(13)
  3375.     m$ = m$ + "22......" + Chr$(13)
  3376.     m$ = m$ + "22......" + Chr$(13)
  3377.     m$ = m$ + "22......" + Chr$(13)
  3378.     arrTileText(228) = m$
  3379.  
  3380.     m$ = ""
  3381.     m$ = m$ + "222....." + Chr$(13)
  3382.     m$ = m$ + "222....." + Chr$(13)
  3383.     m$ = m$ + "222....." + Chr$(13)
  3384.     m$ = m$ + "222....." + Chr$(13)
  3385.     m$ = m$ + "222....." + Chr$(13)
  3386.     m$ = m$ + "222....." + Chr$(13)
  3387.     m$ = m$ + "222....." + Chr$(13)
  3388.     m$ = m$ + "222....." + Chr$(13)
  3389.     arrTileText(229) = m$
  3390.  
  3391.     m$ = ""
  3392.     m$ = m$ + ".....222" + Chr$(13)
  3393.     m$ = m$ + ".....222" + Chr$(13)
  3394.     m$ = m$ + ".....222" + Chr$(13)
  3395.     m$ = m$ + ".....222" + Chr$(13)
  3396.     m$ = m$ + ".....222" + Chr$(13)
  3397.     m$ = m$ + ".....222" + Chr$(13)
  3398.     m$ = m$ + ".....222" + Chr$(13)
  3399.     m$ = m$ + ".....222" + Chr$(13)
  3400.     arrTileText(230) = m$
  3401.  
  3402.     m$ = ""
  3403.     m$ = m$ + "22222222" + Chr$(13)
  3404.     m$ = m$ + "22222222" + Chr$(13)
  3405.     m$ = m$ + "........" + Chr$(13)
  3406.     m$ = m$ + "........" + Chr$(13)
  3407.     m$ = m$ + "........" + Chr$(13)
  3408.     m$ = m$ + "........" + Chr$(13)
  3409.     m$ = m$ + "........" + Chr$(13)
  3410.     m$ = m$ + "........" + Chr$(13)
  3411.     arrTileText(231) = m$
  3412.  
  3413.     m$ = ""
  3414.     m$ = m$ + "22222222" + Chr$(13)
  3415.     m$ = m$ + "22222222" + Chr$(13)
  3416.     m$ = m$ + "22222222" + Chr$(13)
  3417.     m$ = m$ + "........" + Chr$(13)
  3418.     m$ = m$ + "........" + Chr$(13)
  3419.     m$ = m$ + "........" + Chr$(13)
  3420.     m$ = m$ + "........" + Chr$(13)
  3421.     m$ = m$ + "........" + Chr$(13)
  3422.     arrTileText(232) = m$
  3423.  
  3424.     m$ = ""
  3425.     m$ = m$ + "........" + Chr$(13)
  3426.     m$ = m$ + "........" + Chr$(13)
  3427.     m$ = m$ + "........" + Chr$(13)
  3428.     m$ = m$ + "........" + Chr$(13)
  3429.     m$ = m$ + "........" + Chr$(13)
  3430.     m$ = m$ + "22222222" + Chr$(13)
  3431.     m$ = m$ + "22222222" + Chr$(13)
  3432.     m$ = m$ + "22222222" + Chr$(13)
  3433.     arrTileText(233) = m$
  3434.  
  3435.     m$ = ""
  3436.     m$ = m$ + ".......2" + Chr$(13)
  3437.     m$ = m$ + "......22" + Chr$(13)
  3438.     m$ = m$ + ".....22." + Chr$(13)
  3439.     m$ = m$ + ".22.22.." + Chr$(13)
  3440.     m$ = m$ + ".2222..." + Chr$(13)
  3441.     m$ = m$ + ".222...." + Chr$(13)
  3442.     m$ = m$ + ".22....." + Chr$(13)
  3443.     m$ = m$ + "........" + Chr$(13)
  3444.     arrTileText(234) = m$
  3445.  
  3446.     m$ = ""
  3447.     m$ = m$ + "........" + Chr$(13)
  3448.     m$ = m$ + "........" + Chr$(13)
  3449.     m$ = m$ + "........" + Chr$(13)
  3450.     m$ = m$ + "........" + Chr$(13)
  3451.     m$ = m$ + "2222...." + Chr$(13)
  3452.     m$ = m$ + "2222...." + Chr$(13)
  3453.     m$ = m$ + "2222...." + Chr$(13)
  3454.     m$ = m$ + "2222...." + Chr$(13)
  3455.     arrTileText(235) = m$
  3456.  
  3457.     m$ = ""
  3458.     m$ = m$ + "....2222" + Chr$(13)
  3459.     m$ = m$ + "....2222" + Chr$(13)
  3460.     m$ = m$ + "....2222" + Chr$(13)
  3461.     m$ = m$ + "....2222" + Chr$(13)
  3462.     m$ = m$ + "........" + Chr$(13)
  3463.     m$ = m$ + "........" + Chr$(13)
  3464.     m$ = m$ + "........" + Chr$(13)
  3465.     m$ = m$ + "........" + Chr$(13)
  3466.     arrTileText(236) = m$
  3467.  
  3468.     m$ = ""
  3469.     m$ = m$ + "...22..." + Chr$(13)
  3470.     m$ = m$ + "...22..." + Chr$(13)
  3471.     m$ = m$ + "...22..." + Chr$(13)
  3472.     m$ = m$ + "22222..." + Chr$(13)
  3473.     m$ = m$ + "22222..." + Chr$(13)
  3474.     m$ = m$ + "........" + Chr$(13)
  3475.     m$ = m$ + "........" + Chr$(13)
  3476.     m$ = m$ + "........" + Chr$(13)
  3477.     arrTileText(237) = m$
  3478.  
  3479.     m$ = ""
  3480.     m$ = m$ + "2222...." + Chr$(13)
  3481.     m$ = m$ + "2222...." + Chr$(13)
  3482.     m$ = m$ + "2222...." + Chr$(13)
  3483.     m$ = m$ + "2222...." + Chr$(13)
  3484.     m$ = m$ + "........" + Chr$(13)
  3485.     m$ = m$ + "........" + Chr$(13)
  3486.     m$ = m$ + "........" + Chr$(13)
  3487.     m$ = m$ + "........" + Chr$(13)
  3488.     arrTileText(238) = m$
  3489.  
  3490.     m$ = ""
  3491.     m$ = m$ + "2222...." + Chr$(13)
  3492.     m$ = m$ + "2222...." + Chr$(13)
  3493.     m$ = m$ + "2222...." + Chr$(13)
  3494.     m$ = m$ + "2222...." + Chr$(13)
  3495.     m$ = m$ + "....2222" + Chr$(13)
  3496.     m$ = m$ + "....2222" + Chr$(13)
  3497.     m$ = m$ + "....2222" + Chr$(13)
  3498.     m$ = m$ + "....2222" + Chr$(13)
  3499.     arrTileText(239) = m$
  3500.  
  3501.     m$ = ""
  3502.     m$ = m$ + "........" + Chr$(13)
  3503.     m$ = m$ + "........" + Chr$(13)
  3504.     m$ = m$ + "........" + Chr$(13)
  3505.     m$ = m$ + "........" + Chr$(13)
  3506.     m$ = m$ + "........" + Chr$(13)
  3507.     m$ = m$ + "........" + Chr$(13)
  3508.     m$ = m$ + "........" + Chr$(13)
  3509.     m$ = m$ + "........" + Chr$(13)
  3510.     arrTileText(240) = m$
  3511.  
  3512.     m$ = ""
  3513.     m$ = m$ + "22222.22" + Chr$(13)
  3514.     m$ = m$ + "22222.22" + Chr$(13)
  3515.     m$ = m$ + "22222.22" + Chr$(13)
  3516.     m$ = m$ + "........" + Chr$(13)
  3517.     m$ = m$ + "22.22222" + Chr$(13)
  3518.     m$ = m$ + "22.22222" + Chr$(13)
  3519.     m$ = m$ + "22.22222" + Chr$(13)
  3520.     m$ = m$ + "........" + Chr$(13)
  3521.     arrTileText(241) = m$
  3522.  
  3523.     m$ = ""
  3524.     m$ = m$ + "........" + Chr$(13)
  3525.     m$ = m$ + "........" + Chr$(13)
  3526.     m$ = m$ + "........" + Chr$(13)
  3527.     m$ = m$ + ".222222." + Chr$(13)
  3528.     m$ = m$ + "........" + Chr$(13)
  3529.     m$ = m$ + "........" + Chr$(13)
  3530.     m$ = m$ + "........" + Chr$(13)
  3531.     m$ = m$ + "........" + Chr$(13)
  3532.     arrTileText(242) = m$
  3533.  
  3534.     m$ = ""
  3535.     m$ = m$ + "........" + Chr$(13)
  3536.     m$ = m$ + "...2...." + Chr$(13)
  3537.     m$ = m$ + "...2...." + Chr$(13)
  3538.     m$ = m$ + "...2...." + Chr$(13)
  3539.     m$ = m$ + "...2...." + Chr$(13)
  3540.     m$ = m$ + "...2...." + Chr$(13)
  3541.     m$ = m$ + "...2...." + Chr$(13)
  3542.     m$ = m$ + "........" + Chr$(13)
  3543.     arrTileText(243) = m$
  3544.  
  3545.     m$ = ""
  3546.     m$ = m$ + "........" + Chr$(13)
  3547.     m$ = m$ + "........" + Chr$(13)
  3548.     m$ = m$ + "........" + Chr$(13)
  3549.     m$ = m$ + "...2222." + Chr$(13)
  3550.     m$ = m$ + "...2...." + Chr$(13)
  3551.     m$ = m$ + "...2...." + Chr$(13)
  3552.     m$ = m$ + "...2...." + Chr$(13)
  3553.     m$ = m$ + "........" + Chr$(13)
  3554.     arrTileText(244) = m$
  3555.  
  3556.     m$ = ""
  3557.     m$ = m$ + "........" + Chr$(13)
  3558.     m$ = m$ + "........" + Chr$(13)
  3559.     m$ = m$ + "........" + Chr$(13)
  3560.     m$ = m$ + ".222...." + Chr$(13)
  3561.     m$ = m$ + "...2...." + Chr$(13)
  3562.     m$ = m$ + "...2...." + Chr$(13)
  3563.     m$ = m$ + "...2...." + Chr$(13)
  3564.     m$ = m$ + "........" + Chr$(13)
  3565.     arrTileText(245) = m$
  3566.  
  3567.     m$ = ""
  3568.     m$ = m$ + "........" + Chr$(13)
  3569.     m$ = m$ + "...2...." + Chr$(13)
  3570.     m$ = m$ + "...2...." + Chr$(13)
  3571.     m$ = m$ + "...2222." + Chr$(13)
  3572.     m$ = m$ + "........" + Chr$(13)
  3573.     m$ = m$ + "........" + Chr$(13)
  3574.     m$ = m$ + "........" + Chr$(13)
  3575.     m$ = m$ + "........" + Chr$(13)
  3576.     arrTileText(246) = m$
  3577.  
  3578.     m$ = ""
  3579.     m$ = m$ + "........" + Chr$(13)
  3580.     m$ = m$ + "...2...." + Chr$(13)
  3581.     m$ = m$ + "...2...." + Chr$(13)
  3582.     m$ = m$ + ".222...." + Chr$(13)
  3583.     m$ = m$ + "........" + Chr$(13)
  3584.     m$ = m$ + "........" + Chr$(13)
  3585.     m$ = m$ + "........" + Chr$(13)
  3586.     m$ = m$ + "........" + Chr$(13)
  3587.     arrTileText(247) = m$
  3588.  
  3589.     m$ = ""
  3590.     m$ = m$ + "........" + Chr$(13)
  3591.     m$ = m$ + "........" + Chr$(13)
  3592.     m$ = m$ + "........" + Chr$(13)
  3593.     m$ = m$ + "........" + Chr$(13)
  3594.     m$ = m$ + "........" + Chr$(13)
  3595.     m$ = m$ + "........" + Chr$(13)
  3596.     m$ = m$ + "........" + Chr$(13)
  3597.     m$ = m$ + "........" + Chr$(13)
  3598.     arrTileText(248) = m$
  3599.  
  3600.     m$ = ""
  3601.     m$ = m$ + "........" + Chr$(13)
  3602.     m$ = m$ + "........" + Chr$(13)
  3603.     m$ = m$ + "........" + Chr$(13)
  3604.     m$ = m$ + "........" + Chr$(13)
  3605.     m$ = m$ + "........" + Chr$(13)
  3606.     m$ = m$ + "........" + Chr$(13)
  3607.     m$ = m$ + "........" + Chr$(13)
  3608.     m$ = m$ + "........" + Chr$(13)
  3609.     arrTileText(249) = m$
  3610.  
  3611.     m$ = ""
  3612.     m$ = m$ + "........" + Chr$(13)
  3613.     m$ = m$ + "........" + Chr$(13)
  3614.     m$ = m$ + "........" + Chr$(13)
  3615.     m$ = m$ + "........" + Chr$(13)
  3616.     m$ = m$ + "........" + Chr$(13)
  3617.     m$ = m$ + "........" + Chr$(13)
  3618.     m$ = m$ + "........" + Chr$(13)
  3619.     m$ = m$ + "........" + Chr$(13)
  3620.     arrTileText(250) = m$
  3621.  
  3622.     m$ = ""
  3623.     m$ = m$ + "........" + Chr$(13)
  3624.     m$ = m$ + "........" + Chr$(13)
  3625.     m$ = m$ + "........" + Chr$(13)
  3626.     m$ = m$ + "........" + Chr$(13)
  3627.     m$ = m$ + "........" + Chr$(13)
  3628.     m$ = m$ + "........" + Chr$(13)
  3629.     m$ = m$ + "........" + Chr$(13)
  3630.     m$ = m$ + "........" + Chr$(13)
  3631.     arrTileText(251) = m$
  3632.  
  3633.     m$ = ""
  3634.     m$ = m$ + "........" + Chr$(13)
  3635.     m$ = m$ + "........" + Chr$(13)
  3636.     m$ = m$ + "........" + Chr$(13)
  3637.     m$ = m$ + "........" + Chr$(13)
  3638.     m$ = m$ + "........" + Chr$(13)
  3639.     m$ = m$ + "........" + Chr$(13)
  3640.     m$ = m$ + "........" + Chr$(13)
  3641.     m$ = m$ + "........" + Chr$(13)
  3642.     arrTileText(252) = m$
  3643.  
  3644.     m$ = ""
  3645.     m$ = m$ + "22222222" + Chr$(13)
  3646.     m$ = m$ + "2......2" + Chr$(13)
  3647.     m$ = m$ + "2......2" + Chr$(13)
  3648.     m$ = m$ + "2......2" + Chr$(13)
  3649.     m$ = m$ + "2......2" + Chr$(13)
  3650.     m$ = m$ + "2......2" + Chr$(13)
  3651.     m$ = m$ + "2......2" + Chr$(13)
  3652.     m$ = m$ + "22222222" + Chr$(13)
  3653.     arrTileText(253) = m$
  3654.  
  3655.     m$ = ""
  3656.     m$ = m$ + "22222222" + Chr$(13)
  3657.     m$ = m$ + "22222222" + Chr$(13)
  3658.     m$ = m$ + "22222222" + Chr$(13)
  3659.     m$ = m$ + "22222222" + Chr$(13)
  3660.     m$ = m$ + "22222222" + Chr$(13)
  3661.     m$ = m$ + "22222222" + Chr$(13)
  3662.     m$ = m$ + "22222222" + Chr$(13)
  3663.     m$ = m$ + "22222222" + Chr$(13)
  3664.     arrTileText(254) = m$
  3665.  
  3666.     m$ = ""
  3667.     m$ = ""
  3668.     m$ = m$ + "22....22" + Chr$(13)
  3669.     m$ = m$ + "2..22..2" + Chr$(13)
  3670.     m$ = m$ + "2..22..2" + Chr$(13)
  3671.     m$ = m$ + "22.....2" + Chr$(13)
  3672.     m$ = m$ + "22222..2" + Chr$(13)
  3673.     m$ = m$ + "2..22..2" + Chr$(13)
  3674.     m$ = m$ + "22....22" + Chr$(13)
  3675.     m$ = m$ + "22222222" + Chr$(13)
  3676.     arrTileText(255) = m$
  3677.  
  3678. End Sub ' GetTileText
  3679.  
  3680. ' ################################################################################################################################################################
  3681. ' END TILE DEFINITIONS
  3682. ' ################################################################################################################################################################
  3683.  
  3684. ' ################################################################################################################################################################
  3685. ' BEGIN COLOR FUNCTIONS
  3686. ' ################################################################################################################################################################
  3687. Function cWhite~& ()
  3688.     cWhite = _RGB32(255, 255, 255)
  3689. End Function ' cWhite~&
  3690.  
  3691. Function cEmpty~& ()
  3692.     cEmpty = _RGB32(0, 0, 0, 0)
  3693. End Function ' cEmpty~&
  3694.  
  3695. Function cBlack~& ()
  3696.     cBlack = _RGB32(0, 0, 0)
  3697. End Function ' cBlack~&
  3698.  
  3699. Function cRed~& ()
  3700.     cRed = _RGB32(255, 0, 0)
  3701.  
  3702. Function cYellow~& ()
  3703.     cYellow = _RGB32(255, 255, 0)
  3704. End Function ' cYellow~&
  3705.  
  3706. Function cLime~& ()
  3707.     cLime = _RGB32(0, 255, 0)
  3708. End Function ' cLime~&
  3709.  
  3710. Function cCyan~& ()
  3711.     cCyan = _RGB32(0, 255, 255)
  3712. End Function ' cCyan~&
  3713.  
  3714. Function cBlue~& ()
  3715.     cBlue = _RGB32(0, 0, 255)
  3716. End Function ' cBlue~&
  3717.  
  3718. Function cMagenta~& ()
  3719.     cMagenta = _RGB32(255, 0, 255)
  3720. End Function ' cMagenta~&
  3721.  
  3722. Function cOrange~& ()
  3723.     cOrange = _RGB32(255, 165, 0)
  3724. End Function ' cOrange~&
  3725.  
  3726. Function cGray~& ()
  3727.     cGray = _RGB32(128, 128, 128)
  3728. End Function ' cGray~&
  3729. ' ################################################################################################################################################################
  3730. ' END COLOR FUNCTIONS
  3731. ' ################################################################################################################################################################
  3732.  
  3733. ' ################################################################################################################################################################
  3734. ' BEGIN GENERAL PURPOSE ROUTINES #GEN
  3735. ' ################################################################################################################################################################
  3736. ' /////////////////////////////////////////////////////////////////////////////
  3737.  
  3738. Function cstr$ (myValue)
  3739.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  3740.     cstr$ = _Trim$(Str$(myValue))
  3741. End Function ' cstr$
  3742.  
  3743. ' /////////////////////////////////////////////////////////////////////////////
  3744. ' Use with timer functions to avoid "after midnight" bug.
  3745.  
  3746. ' Re: how to time something (ie do loop for n seconds)
  3747. ' https://qb64forum.alephc.xyz/index.php?topic=4682.0
  3748.  
  3749. ' SMcNeill, QB64 Developer
  3750. ' « Reply #1 on: Today at 11:26:52 am »
  3751. '
  3752. ' One caveat here:  You *can* experience bugs with this after midnight.
  3753. '
  3754. ' Program starts at 23:59:59.
  3755. ' Add three seconds -- 24:00:02...  (In seconds, and not hours and minutes like this, though hours and minutes are easier to visualize.)
  3756. ' Clock hits midnight:  0:00:00
  3757. '
  3758. ' At no point will you ever have TIMER become greater than t#.
  3759. '
  3760. ' If you're going to have a program which might run into this issue,
  3761. ' I'd suggest just plugging in my ExtendedTimer and use it instead:
  3762. '
  3763. ' Most of us write time code to test little snippets for which method might
  3764. ' be faster for us while we're coding.  The clock resetting on us isn't
  3765. ' normally such a big deal.  When it is, however, all you have to do is
  3766. ' swap to the ExtendedTimer function [below]
  3767. '
  3768. ' Returns a value for you based off DAY + TIME, rather than just time alone!
  3769. ' No midnight clock issues with something like that in our programs.  ;)
  3770.  
  3771. ' Usage:
  3772. '     ' DO SOMETHING FOR 3 SECONDS
  3773. '     t# = ExtendedTimer + 3
  3774. '     Do
  3775. '         '(SOMETHING)
  3776. '     Loop Until Timer > t#
  3777.  
  3778. FUNCTION ExtendedTimer##
  3779.     d$ = DATE$
  3780.     l = INSTR(d$, "-")
  3781.     l1 = INSTR(l + 1, d$, "-")
  3782.     m = VAL(LEFT$(d$, l))
  3783.     d = VAL(MID$(d$, l + 1))
  3784.     y = VAL(MID$(d$, l1 + 1)) - 1970
  3785.     FOR i = 1 TO m
  3786.         SELECT CASE i 'Add the number of days for each previous month passed
  3787.             CASE 1: d = d 'January doestn't have any carry over days.
  3788.             CASE 2, 4, 6, 8, 9, 11: d = d + 31
  3789.             CASE 3: d = d + 28
  3790.             CASE 5, 7, 10, 12: d = d + 30
  3791.         END SELECT
  3792.     NEXT
  3793.     FOR i = 1 TO y
  3794.         d = d + 365
  3795.     NEXT
  3796.     FOR i = 2 TO y STEP 4
  3797.         IF m > 2 THEN d = d + 1 'add an extra day for leap year every 4 years, starting in 1970
  3798.     NEXT
  3799.     d = d - 1 'for year 2000
  3800.     s~&& = d * 24 * 60 * 60 'Seconds are days * 24 hours * 60 minutes * 60 seconds
  3801.     ExtendedTimer## = (s~&& + TIMER)
  3802. END FUNCTION ' ExtendedTimer##
  3803.  
  3804. ' /////////////////////////////////////////////////////////////////////////////
  3805. ' FROM: String Manipulation
  3806. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  3807. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  3808. '
  3809. 'SUMMARY:
  3810. '   Purpose:  A library of custom functions that transform strings.
  3811. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  3812. '   Platform: QB64 (www.qb64.org)
  3813. '   Revision: 1.6
  3814. '   Updated:  5/28/2012
  3815.  
  3816. 'SUMMARY:
  3817. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  3818. 'INPUT:
  3819. 'Text: The input string; the text that's being manipulated.
  3820. 'Find: The specified sub-string; the string sought within the [Text] string.
  3821. 'Add: The sub-string that's being added to the [Text] string.
  3822.  
  3823. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  3824.     ' VARIABLES:
  3825.     Dim Text2 As String
  3826.     Dim Find2 As String
  3827.     Dim Add2 As String
  3828.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  3829.     Dim strBefore As String ' The characters before the string to be replaced.
  3830.     Dim strAfter As String ' The characters after the string to be replaced.
  3831.  
  3832.     ' INITIALIZE:
  3833.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  3834.     Text2 = Text1
  3835.     Find2 = Find1
  3836.     Add2 = Add1
  3837.  
  3838.     lngLocation = InStr(1, Text2, Find2)
  3839.  
  3840.     ' PROCESSING:
  3841.     ' While [Find2] appears in [Text2]...
  3842.     While lngLocation
  3843.         ' Extract all Text2 before the [Find2] substring:
  3844.         strBefore = Left$(Text2, lngLocation - 1)
  3845.  
  3846.         ' Extract all text after the [Find2] substring:
  3847.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  3848.  
  3849.         ' Return the substring:
  3850.         Text2 = strBefore + Add2 + strAfter
  3851.  
  3852.         ' Locate the next instance of [Find2]:
  3853.         lngLocation = InStr(1, Text2, Find2)
  3854.  
  3855.         ' Next instance of [Find2]...
  3856.     Wend
  3857.  
  3858.     ' OUTPUT:
  3859.     Replace$ = Text2
  3860. End Function ' Replace$
  3861.  
  3862. ' /////////////////////////////////////////////////////////////////////////////
  3863. ' Split and join strings
  3864. ' https://www.qb64.org/forum/index.php?topic=1073.0
  3865. '
  3866. ' FROM luke, QB64 Developer
  3867. ' Date: February 15, 2019, 04:11:07 AM »
  3868. '
  3869. ' Given a string of words separated by spaces (or any other character),
  3870. ' splits it into an array of the words. I've no doubt many people have
  3871. ' written a version of this over the years and no doubt there's a million
  3872. ' ways to do it, but I thought I'd put mine here so we have at least one
  3873. ' version. There's also a join function that does the opposite
  3874. ' array -> single string.
  3875. '
  3876. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  3877. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  3878.  
  3879. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  3880. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  3881. '
  3882. 'delimiter$ must be one character long.
  3883. 'result$() must have been REDIMmed previously.
  3884.  
  3885. ' Modified to handle multi-character delimiters
  3886.  
  3887. Sub split (in$, delimiter$, result$())
  3888.     Dim start As Integer
  3889.     Dim finish As Integer
  3890.     Dim iDelimLen As Integer
  3891.     ReDim result$(-1)
  3892.  
  3893.     iDelimLen = Len(delimiter$)
  3894.  
  3895.     start = 1
  3896.     Do
  3897.         'While Mid$(in$, start, 1) = delimiter$
  3898.         While Mid$(in$, start, iDelimLen) = delimiter$
  3899.             'start = start + 1
  3900.             start = start + iDelimLen
  3901.             If start > Len(in$) Then
  3902.                 Exit Sub
  3903.             End If
  3904.         Wend
  3905.         finish = InStr(start, in$, delimiter$)
  3906.         If finish = 0 Then
  3907.             finish = Len(in$) + 1
  3908.         End If
  3909.  
  3910.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  3911.  
  3912.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  3913.         start = finish + 1
  3914.     Loop While start <= Len(in$)
  3915. End Sub ' split
  3916. ' ################################################################################################################################################################
  3917. ' END GENERAL PURPOSE ROUTINES #GEN
  3918. ' ################################################################################################################################################################
  3919.  
  3920. ' ################################################################################################################################################################
  3921. ' BEGIN HARDWARE IMAGES DEMO #2 (WORKS)
  3922. ' ################################################################################################################################################################
  3923.  
  3924. ' /////////////////////////////////////////////////////////////////////////////
  3925. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  3926. ' https://qb64forum.alephc.xyz/index.php?topic=4674.0
  3927.  
  3928. ' madscijr
  3929. ' « Reply #5 on: Yesterday at 09:46:53 pm »
  3930.  
  3931. ' Quote from: SMcNeill on Yesterday at 07:56:57 pm:
  3932. ' Hardware images basically get their speed by being a sort of "Write Only"
  3933. ' method for images. You can make them, you can put them on the screen,
  3934. ' but you can't edit them or read information back from them.
  3935. ' ...
  3936. ' 2) You don't have to specify where they show up as a destination with putimage.
  3937. ' ...
  3938. ' If you have any specific questions, feel free to ask them and I'll do my
  3939. ' best to answer for you, if I can.  ;)
  3940. '
  3941. ' Thanks for taking the time to explain all that. When I'm back at the PC,
  3942. ' I'll try out your example.
  3943. '
  3944. ' For now, just one question: if you can't read information from them or even
  3945. ' specify where on the destination they go, how are they even useful?
  3946. ' Maybe it will click when I run your example or read up on it, but I just
  3947. ' don't see what the use of an image would be if you can't control where on
  3948. ' the screen it is drawn? Or how it would help speed up drawing a map of
  3949. ' colored tiles to the screen.
  3950. '
  3951. ' Thanks again...
  3952.  
  3953. ' SMcNeill, QB64 Developer
  3954. ' « Reply #6 on: Today at 01:14:28 am »
  3955. '
  3956. ' Try this out and see if it doesn't help answer your questions:
  3957.  
  3958. Sub HardwareImageDemo2
  3959.     $Color:32
  3960.     Display = _NewImage(1024, 720, 32)
  3961.     Software = _NewImage(1024, 720, 32)
  3962.  
  3963.     Screen Display
  3964.     Print "First, let's create a normal sortware screen and fill it with 40x40 tiles of random colors."
  3965.     Print "Press <ANY KEY> to view this screen."
  3966.     Sleep
  3967.  
  3968.     _Dest Software
  3969.     For y = 0 To 720 Step 40
  3970.         For x = 0 To 1024 Step 40
  3971.             Line (x, y)-Step(40, 40), &HFF000000 + Rnd * &HFFFFFF, BF
  3972.         Next
  3973.     Next
  3974.  
  3975.     _Dest Display
  3976.     _PutImage , Software
  3977.     Print
  3978.     Print "As you can see, this is a simple software screen."
  3979.     Print "Now, I'm going to copy that software screen and make it a hardware screen."
  3980.     Print "Press <ANY KEY> for me to do so!"
  3981.     Sleep
  3982.  
  3983.     Hardware = _CopyImage(Software, 33)
  3984.     Cls
  3985.     Print "Now, I'm back to my blank screen, but I now have a hardware screen to work with."
  3986.     Print
  3987.     Print "To keep things simple, let's showcase the differences between using _putimage with a software screen, and then with the hardware screen."
  3988.     Print
  3989.     Print "First, the software screen!  Press <ANY KEY> to continue."
  3990.     Sleep
  3991.  
  3992.     _PutImage (0, 100)-Step(100, 100), Software, Display, (0, 0)-(40, 40)
  3993.     Print "As you can see, all I did here was copy a single tile from the software screen and then scale it to fit upon the current screen."
  3994.     Print
  3995.     Print "Press <ANY KEY> to continue, as I'll now do the same with a hardware image."
  3996.  
  3997.     _PutImage (200, 100)-Step(100, 100), Hardware, , (0, 0)-(40, 40)
  3998.     Print
  3999.     Print "As you can see from the above, we have the same tile copied and scaled onto the screen, just to the right of the software image."
  4000.     Print
  4001.     Print "Doesn't really seem to be very different at all, now does it?"
  4002.     Print
  4003.     Print "Press <ANY KEY> to continue."
  4004.     _Display
  4005.     Sleep
  4006.  
  4007.     Print
  4008.     Color Red
  4009.     Print "BUT WAIT A MOMENT!!  What the heck happened to our hardware tile??!!??"
  4010.     Color White
  4011.     Print
  4012.     Print "It's no longer on the screen, as it was previously.  Why??"
  4013.     Print
  4014.     Print "Because it was never on the software screen at all, but was instead on it's own hardware layer ABOVE the software screen."
  4015.     Print
  4016.     Print "Hardware images only display ONCE, once _DISPLAY is called, and then they flush from the graphics buffer."
  4017.     Print "Draw.  Display.  Flush.  <-- that's the basic process of how a hardware image works."
  4018.     Print
  4019.     Print "If we want one to remain on the screen, we have to do it either by:"
  4020.     Print "1) Not updating the screen after we draw and display the image, as I did above with the tile I displayed."
  4021.     Print "2) Refresh displaying the image in our main loop (which is what we do even with software images for most games and such)."
  4022.     Print
  4023.     Print "Press <ANY KEY> to continue."
  4024.     Sleep
  4025.  
  4026.     Cls
  4027.     Print
  4028.     Print "So, as you can see, hardware images have a few drawbacks to them, with the most obvious being they only display once,"
  4029.     Print "then flush from memory.  If you want persistant hardware images, they're best used in a loop."
  4030.     Print
  4031.     Print "But, if they've got drawbacks, then one has to ask, 'What's the advantages to using them?'"
  4032.     Print "Press <ANY KEY> to find out!"
  4033.     Sleep
  4034.  
  4035.     t# = ExtendedTimer + 3
  4036.     Do
  4037.         count = count + 1
  4038.         _PutImage (0, 100)-Step(100, 100), Software, Display, (x, y)-Step(40, 40)
  4039.         x = x + 40
  4040.         If x > 1024 Then x = 0: y = y + 40
  4041.         If y > 720 Then x = 0: y = 0
  4042.         _Display
  4043.     Loop Until Timer > t#
  4044.  
  4045.     Print "See lots of flashing tiles on the screen for the last three seconds?"
  4046.     Print "That was us using _PUTIMAGE with the software screen, and we put"; count; "tiles on the screen in those 3 seconds."
  4047.     Print
  4048.     Print "Now press <ANY KEY> and we'll do the exact same thing with hardware images."
  4049.     Sleep
  4050.  
  4051.     count = 0: x = 0: y = 0
  4052.     t# = ExtendedTimer + 3
  4053.     tempScreen = _CopyImage(Display, 33)
  4054.     Do
  4055.         count = count + 1
  4056.         _PutImage , tempScreen
  4057.         _PutImage (300, 100)-Step(100, 100), Hardware, , (x, y)-Step(40, 40)
  4058.         x = x + 40
  4059.         If x > 1024 Then x = 0: y = y + 40
  4060.         If y > 720 Then x = 0: y = 0
  4061.         _Display
  4062.     Loop Until Timer > t#
  4063.  
  4064.     _FreeImage tempScreen
  4065.     Print
  4066.     Print "Didn't seem very different at the rate of which we were running things, now did it?"
  4067.     Print "Would you be surprised to find out that we put"; count * 2; "hardware images on the screen in those same 3 seconds?"
  4068.     Print
  4069.     Print "And if you look close, I counted each loop twice, as we didn't just put the hardware image to the screen, but also a"
  4070.     Print "complete copy of the original software screen as well!"
  4071.     Print
  4072.     Print "The reason why I did this?"
  4073.     Print
  4074.     Print "So I could completely elimimate all software iamges and JUST work with the much faster hardware layer!"
  4075.     Print
  4076.     Print "Press <ANY KEY> to continue"
  4077.     Sleep
  4078.  
  4079.     Cls
  4080.     Print "So, as you can see, hardware images are multiple times faster to display and render than software images."
  4081.     Print
  4082.     Print "But here's something else for you to notice -- I'm going to update the screen with constant, limitless tile refeshes."
  4083.     Print "To start with, I'm going to do this in a LOOP with the software images."
  4084.     Print "CTRL-TAB out of this demo program, open your task manager, and see how much memory and CPU processing power the program uses."
  4085.     Print "Then TAB back to this program and hit <ESC> to do the same with the hardware images."
  4086.  
  4087.     Do
  4088.         _PutImage (0, 100)-(1024, 720), Software, Display, (x, y)-Step(40, 40)
  4089.         x = x + 40
  4090.         If x > 1024 Then x = 0: y = y + 40
  4091.         If y > 720 Then x = 0: y = 0
  4092.         _Limit 60
  4093.         _Display
  4094.     Loop Until _KeyDown(27)
  4095.  
  4096.     Cls , 0
  4097.     Print "PRESS <SPACE BAR> to stop the hardware iamges!!"
  4098.     tempImage = _CopyImage(Display, 33)
  4099.     x = 0: y = 0
  4100.     Do
  4101.         _PutImage , tempImage
  4102.         _PutImage (0, 100)-(1023, 719), Hardware, , (x, y)-Step(40, 40)
  4103.         x = x + 40
  4104.         If x > 1024 Then x = 0: y = y + 40
  4105.         If y > 720 Then x = 0: y = 0
  4106.         _Limit 60
  4107.         _Display
  4108.     Loop Until _KeyDown(32)
  4109.  
  4110.     Cls
  4111.     Print "On my laptop, these two methods use the following amounts of CPU power:"
  4112.     Print "Software, 60 FPS -- 3% CPU"
  4113.     Print "Hardware, 60 FPS -- 0.1% CPU"
  4114.     Print
  4115.     Print "If I go in and change the limits to something much higher, these are the results (test them for yourselves, please):"
  4116.     Print "Software, 600 FPS -- 10.3% CPU"
  4117.     Print "Hardware, 600 FPS -- 0.1% CPU"
  4118.     Print
  4119.     Print
  4120.     Print "So, as you can see, the disadvantage to hardware images are they display once, then flush from memory."
  4121.     Print
  4122.     Print "While the advantages to their usage is MUCH faster processing times, and an immense reduction on CPU usage.  (The GPU picks up the work for us!)"
  4123.     Print
  4124.     Print
  4125.     Print "You basically use them just like you would any other normal image, though you have to keep in mind that they render"
  4126.     Print "to their own hardware layer, which you can specify to go on below or above your software screen."
  4127.     Print
  4128.     Print "(Or, you can _DISPLAYORDER _HARDWARE and *only* display the hardware layer, removing software rendering completely!)"
  4129.     Print
  4130.     Print "And THAT, my friends, is basically the lowdown on hardware vs software images.  ;)"
  4131.     Print
  4132.     Print
  4133.     Print "And this was another Steve(tm) Tutorial!  Enjoy!!"
  4134. End Sub ' HardwareImageDemo2
  4135.  
  4136. ' ################################################################################################################################################################
  4137. ' END HARDWARE IMAGES DEMO #2 (WORKS)
  4138. ' ################################################################################################################################################################
  4139.  
« Last Edit: February 24, 2022, 10:06:27 am by madscijr »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #18 on: February 24, 2022, 05:08:58 pm »
One thing that would be *very* different with all hardware images vs what you're doing currently, is the fact that you have to remember:  Hardware images display once and then flush themselves from the GPU buffer. 

You can't just print to a tile, and then read the information for the color of that tile, and instantly turn that color into another one.  You have write access to hardware images, but not read access -- and the images aren't persistent like the software images are.

For something like this to work for a whole screen in hardware image mode, you'd have to sort out some sort of way to store your screen's info and then constantly redraw everything over and over again to keep it refreshed on the display.

The way I'd  go about doing something like this would be to make myself a custom SCREEN 0-style memory array.  Screen 0 stores all our information for each character in 2 bytes -- one for color, one for character.  I'd basically do the same, but with 3 bytes -- one for tile color, one for font color, one for character.

Let me toss a simple demo of this line of thinking for you:
Code: QB64: [Select]
  1.  
  2. Display = _NewImage(800, 600, 32) 'my main screenwich is 100 by 75 characters with 8x8 font.
  3. Tile = _NewImage(8 * 256, 8, 32) '8x8 tiles in 256 colors
  4. Font = _NewImage(8 * 256, 8 * 256, 32) '256 characters of an 8x8 font, in all 256 possible colors.
  5.  
  6. Screen Display 'Set the main screen for starters so it'll go ahead and create itself properly while I'm working on making my tiles and fonts
  7.  
  8.  
  9.  
  10. Dim As _Unsigned Long Kolors(255) 'an array to hold all my color values
  11. tempScreen256 = _NewImage(10, 10, 256) 'very tiny 256 color screen, just to borrow the palette from
  12. For i = 0 To 255 '40 colors
  13.     Kolors(i) = _RGB32(_Red(i, tempScreen256), _Green(i, tempScreen256), _Blue(i, tempScreen256)) 'since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  14. _FreeImage tempScreen256 'free up all images once done with them
  15.  
  16. _Dest Tile 'Create my software tiles of 256 colors
  17. For i = 0 To 255 '256 tiles, one for each color
  18.     Line (i * 8, 0)-Step(8, 8), Kolors(i), BF 'all drawn sequentially onto a sprite sheet
  19.  
  20. _Dest Font
  21. _Font 8 'I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  22. For k = 0 To 255 '256 colors
  23.     Color Kolors(k), 0 'make our font the proper color
  24.     For c = 0 To 255 '256 characters
  25.         _PrintString (c * 8, k * 8), Chr$(c) 'print the characters row by row to the screen
  26.     Next
  27. _Dest Display
  28.  
  29. Sleep 'View the blank screen  until a key is hit
  30. Screen Tile 'View the tiles
  31. Sleep 'until a key is hit
  32. Screen Font 'view the fonts
  33. Sleep 'until a key is hit
  34. Screen Display 'and back to the normal blank screen
  35. _Delay .2 'time to remove finger from key
  36. Dim Shared As Long TileHw, FontHw
  37.  
  38. TileHw = _CopyImage(Tile, 33) 'hardware copy of the tile image
  39. FontHw = _CopyImage(Font, 33) 'hardware copy of the font image
  40.  
  41. _FreeImage Tile 'free unused images when done with them
  42. _FreeImage Font 'free unused images when done with them
  43.  
  44. _DisplayOrder _Hardware 'From this point onwards, I'm *ONLY* going to use my hardware layer
  45.  
  46. Dim Shared ScreenArray(99, 74) As _Unsigned Long 'Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  47.  
  48. 'To start with, let's put all 256 chracters on the screen, on a color 40 tile (red), in a color 3 font (cyan)
  49. For i = 0 To 255
  50.     x = x + 1: If x > 99 Then x = 0: y = y + 1
  51.     ScreenArray(x, y) = SetAll(40, 3, i) '40 tile color, 3 font color, i is the character
  52.  
  53. Do 'And then let's show these results on the screen.  Take a moment to open task manager and see how little resources we're using here.
  54.     ScreenRender 'Draw a whole screen full of these tiles + characters
  55.     _Limit 30
  56. Loop Until _KeyDown(13) 'until we hit ENTER
  57.  
  58. _Delay .2 'time to lift up the key so we don't instantly blow past the next loop
  59.  
  60. x = 0: y = 0
  61. For i = 0 To 255 'and here I'm going to set all these tiles to have incremental background tile colors
  62.     x = x + 1: If x > 99 Then x = 0: y = y + 1 'from left to right, top to bottom
  63.     SetArrayTile x, y, i 'set each tile to become an ever increasing color value
  64.  
  65. Do 'And then let's show these results on the screen.
  66.     ScreenRender 'Draw a whole screen full of these tiles + characters
  67.     _Limit 30
  68. Loop Until _KeyDown(13) 'until we hit ENTER
  69.  
  70. 'And to finish up, let's do a quick count of how many loops per second we *could* process, with the whole screen being redrawn over and over like this
  71. t## = Timer + 3
  72.     count& = count& + 1
  73.     ScreenRender
  74.  
  75. Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  76.  
  77.  
  78. Sub ScreenRender
  79.     Dim As _Unsigned Long tileColor, fontColor, character
  80.     For x = 0 To 99
  81.         For y = 0 To 74
  82.             tileColor = ScreenArray(x, y) \ (256 * 256)
  83.             fontColor = (ScreenArray(x, y) - tileColor * 256 * 256) \ 256
  84.             character = ScreenArray(x, y) Mod 256
  85.             _PutImage (x * 8, y * 8)-Step(7, 7), TileHw, , (tileColor * 8, 0)-Step(7, 7)
  86.             _PutImage (x * 8, y * 8)-Step(7, 7), FontHw, , (character * 8, fontColor * 8)-Step(7, 7)
  87.         Next
  88.     Next
  89.     _Display
  90.  
  91. Function SetAll&& (tile, fontcolor, character)
  92.     SetAll&& = tile * 256 * 256 + fontcolor * 256 + character
  93.  
  94. Sub SetArrayTile (x, y, newTileColor)
  95.     temp&& = ScreenArray(x, y)
  96.     oldTile&& = temp&& \ (256 * 256)
  97.     ScreenArray(x, y) = temp&& - oldTile&& + newTileColor * 256 * 256
  98.  
  99. Sub SetArrayFontColor (x, y, newFontColor)
  100.     temp&& = ScreenArray(x, y)
  101.     oldTile&& = temp&& \ (256 * 256)
  102.     oldFont&& = (temp&& - oldTile&&) \ 256
  103.     ScreenArray(x, y) = temp&& - oldFont&& + newFontColor * 256
  104.  
  105. Sub SetArrayCharacter (x, y, newCharacter)
  106.     temp&& = ScreenArray(x, y)
  107.     oldCharacter&& = temp&& Mod 256
  108.     ScreenArray(x, y) = temp&& - oldCharacter&& + newCharacter
  109.  

I tried to comment the heck out of the code to help explain what it's doing from line to line, so I hope this isn't too hard to sort out and understand.

The beginning is nothing more than initializing things and making 2 different sprite sheets that I'll make use of later -- one for the tiles and one for the characters.

Then there's the mid section where you can SLEEP step through and view the various resource sheets.

Then an example of all the characters in a cyan font, resting atop a red tile.  (You have to hit ENTER to move on from this screen.)

Then an example of all those tiles that go under the characters being replaced with sequential colored tiles.  (A lot of these tiles are simply BLACK, but that's the nature of the 256 color palette as those multiple blacks are there to be replaced with custom color values instead.)

Once more, you'll have to hit ENTER to continue.

And then I do a quick time loop to count how many times we can redraw the whole screen of tiles + characters in 3 seconds.



For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of about 1800 refreshes in that time.  That's around 600 FPS, which would be more than enough for any sort of game display or use that I think I could come up with, and that's without me trying to optimize math or any such things to reduce calculations and speed the process up any more.  (Keep in mind, this is 1800 full pages of a 800x600 screen -- if your screen has a lower overall resolution, then you'd draw more loops with less to process, but a higher resolution screen would draw fewer loops with more to process.)

No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page of tiles and colored characters.  (And, YES, it is a whole page being rendered repeatedly -- even if I didn't bother to fill in the vast majority of that page with anything more than black tiles, black fonts, and chr$(0) blank spaces...)

It's a completely different approach to displaying stuff than what you've been doing, but it seems as if what you've been doing isn't working as it must be running too slow for you.  You wouldn't be able to use the normal PRINT statements to display to the faux screen memory array I've created; you'd have to write your own.




For a quick speed comparison, here's the same type process ran using PRINT and a software screen of the same size:
Code: QB64: [Select]
  1. Screen _NewImage(800, 600, 32)
  2.  
  3. t## = Timer + 3
  4.     count = count + 1
  5.     For x = 1 To 100
  6.         For y = 1 To 75
  7.             c = (c + 1) Mod 256
  8.             Color _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
  9.             Locate y, x: Print Chr$(c);
  10.         Next
  11.     Next
  12. Print count; "total screen replacements in 3 seconds."
  13.  

About 600 times in 3 seconds, for a total of 200 FPS on my machine.

The faux hardware screen array is ~ 3 times faster than this, without us trying to do anything to optimize performance any more than just sticking to the very basics.  ;)

More is required to work with it, but it does run faster once all is said and done, if that's the primary concern that your program is facing -- display speeds from character rendering.  :)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #19 on: February 24, 2022, 05:38:37 pm »
...
The way I'd go about doing something like this would be to make myself a custom SCREEN 0-style memory array. 
...
Let me toss a simple demo of this line of thinking for you:
...
More is required to work with it, but it does run faster once all is said and done, if that's the primary concern that your program is facing -- display speeds from character rendering.  :)

I'll have to give this a look when at the PC. I appreciate all the work put into this and hope this can benefit you and others, not just me! Hopefully the end result can be a reusable pattern or set of functions for other applications. Thanks yet again for your time and the thought that has gone into this.

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #20 on: February 25, 2022, 11:39:33 am »
About 600 times in 3 seconds, for a total of 200 FPS on my machine.
The faux hardware screen array is ~ 3 times faster than this, without us trying to do anything to optimize performance any more than just sticking to the very basics.  ;)
More is required to work with it, but it does run faster once all is said and done, if that's the primary concern that your program is facing -- display speeds from character rendering.  :)

I ran it and see the difference in speed.
No time now to get into it in detail, but at the end of the hardware image sample, it seems to lock up.
(See my version below.)
Any idea why? I do a keyclear and return to screen 0 but the program just becomes nonresponsive after that.
Thanks again.

Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2.  
  3. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  4. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  5.  
  6. ' SMcNeill, QB64 Developer
  7. ' Reply #18 on: Yesterday at 05:08:58 pm
  8. '
  9. ' One thing that would be *very* different with all hardware images vs what
  10. ' you're doing currently, is the fact that you have to remember:  
  11. ' Hardware images display once and then flush themselves from the GPU buffer.
  12. '
  13. ' You can't just print to a tile, and then read the information for the color of
  14. ' that tile, and instantly turn that color into another one.  You have write
  15. ' access to hardware images, but not read access -- and the images aren't
  16. ' persistent like the software images are.
  17. '
  18. ' For something like this to work for a whole screen in hardware image mode,
  19. ' you'd have to sort out some sort of way to store your screen's info and then
  20. ' constantly redraw everything over and over again to keep it refreshed on the
  21. ' display.
  22. '
  23. ' The way I'd go about doing something like this would be to make myself a
  24. ' custom SCREEN 0-style memory array.  Screen 0 stores all our information for
  25. ' each character in 2 bytes -- one for color, one for character.  I'd basically
  26. ' do the same, but with 3 bytes -- one for tile color, one for font color, one
  27. ' for character.
  28. '
  29. ' Let me toss a simple demo of this line of thinking for you:
  30. ' (TestCustomHardwareScreen1)
  31. '
  32. ' I tried to comment the heck out of the code to help explain what it's doing
  33. ' from line to line, so I hope this isn't too hard to sort out and understand.
  34. '
  35. ' The beginning is nothing more than initializing things and making 2 different
  36. ' sprite sheets that I'll make use of later -- one for the tiles and one for the
  37. ' characters.
  38. '
  39. ' Then there's the mid section where you can SLEEP step through and view the
  40. ' various resource sheets.
  41. '
  42. ' Then an example of all the characters in a cyan font, resting atop a red tile.  
  43. ' (You have to hit ENTER to move on from this screen.)
  44. '
  45. ' Then an example of all those tiles that go under the characters being replaced
  46. ' with sequential colored tiles.  (A lot of these tiles are simply BLACK, but
  47. ' that's the nature of the 256 color palette as those multiple blacks are there
  48. ' to be replaced with custom color values instead.)
  49. '
  50. ' Once more, you'll have to hit ENTER to continue.
  51. '
  52. ' And then I do a quick time loop to count how many times we can redraw the whole
  53. ' screen of tiles + characters in 3 seconds.
  54. '
  55. ' For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of
  56. ' about 1800 refreshes in that time.  That's around 600 FPS, which would be more
  57. ' than enough for any sort of game display or use that I think I could come up
  58. ' with, and that's without me trying to optimize math or any such things to
  59. ' reduce calculations and speed the process up any more.  (Keep in mind, this is
  60. ' 1800 full pages of a 800x600 screen -- if your screen has a lower overall
  61. ' resolution, then you'd draw more loops with less to process, but a higher
  62. ' resolution screen would draw fewer loops with more to process.)
  63. '
  64. ' No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page
  65. ' of tiles and colored characters.  (And, YES, it is a whole page being rendered
  66. ' repeatedly -- even if I didn't bother to fill in the vast majority of that page
  67. ' with anything more than black tiles, black fonts, and chr$(0) blank spaces...)
  68. '
  69. ' It's a completely different approach to displaying stuff than what you've been
  70. ' doing, but it seems as if what you've been doing isn't working as it must be
  71. ' running too slow for you.  You wouldn't be able to use the normal PRINT
  72. ' statements to display to the faux screen memory array I've created; you'd have
  73. ' to write your own.
  74. '
  75. ' For a quick speed comparison, here's the same type process ran using PRINT
  76. ' and a software screen of the same size:
  77. ' (TestSoftwareScreen1)
  78.  
  79. ' ################################################################################################################################################################
  80.  
  81. ' BOOLEAN VALUES
  82. Const FALSE = 0
  83. Const TRUE = Not FALSE
  84.  
  85. ' GLOBAL VARIABLES
  86. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  87. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  88. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES DEBUG CONSOLE
  89. Dim Shared As Long TileHw, FontHw
  90. Dim Shared ScreenArray(99, 74) As _Unsigned Long 'Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  91.  
  92. ' LOCAL VARIABLES
  93. Dim in$
  94.  
  95. ' ****************************************************************************************************************************************************************
  96. ' ACTIVATE DEBUGGING WINDOW
  97. If m_bDebug = TRUE Then
  98.     $Console
  99.     _Delay 4
  100.     _Console On
  101.     _Echo "Started " + m_ProgramName$
  102.     _Echo "Debugging on..."
  103. ' ****************************************************************************************************************************************************************
  104.  
  105. ' START THE MAIN ROUTINE
  106. main
  107.  
  108. ' FINISH
  109. Print m_ProgramName$ + " finished."
  110. Input "Press <ENTER> to continue", in$
  111.  
  112. ' ****************************************************************************************************************************************************************
  113. ' DEACTIVATE DEBUGGING WINDOW
  114. If m_bDebug = TRUE Then
  115. ' ****************************************************************************************************************************************************************
  116.  
  117. System ' return control to the operating system
  118.  
  119. ' ################################################################################################################################################################
  120.  
  121. ' /////////////////////////////////////////////////////////////////////////////
  122.  
  123. Sub main
  124.     Dim RoutineName As String: RoutineName = "main"
  125.     Dim in$
  126.     Dim bFinished As Integer : bFinished = FALSE
  127.     Dim result$: result$ = ""
  128.     Do
  129.                 Screen 0
  130.         Cls
  131.         Print m_ProgramName$
  132.         Print
  133.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  134.         Print
  135.         Print "1) TestCustomHardwareScreen1"
  136.                 Print "2) ^ instructions"
  137.                 Print
  138.         Print "3) TestSoftwareScreen1"
  139.         Print "4) ^ instructions"
  140.         Print
  141.         Print "Q) Exit program"
  142.         Do
  143.             in$ = InKey$
  144.             If ucase$(in$) = "Q" Then
  145.                 bFinished = TRUE : Exit Do
  146.             ElseIf ucase$(in$) = "1" Then
  147.                 TestCustomHardwareScreen1 : Exit Do
  148.             ElseIf ucase$(in$) = "2" Then
  149.                 ShowInstructions(GetInstructions1$) : Exit Do
  150.             ElseIf ucase$(in$) = "3" Then
  151.                 TestSoftwareScreen1 : Exit Do
  152.             ElseIf ucase$(in$) = "4" Then
  153.                 ShowInstructions(GetInstructions2$) : Exit Do
  154.             End If
  155.         Loop
  156.     Loop Until bFinished = TRUE
  157. End Sub ' main
  158.  
  159. ' /////////////////////////////////////////////////////////////////////////////
  160.  
  161. Sub ShowInstructions(in$)
  162.     Dim iLoop As Integer
  163.     Dim iCount As Integer : iCount = 0
  164.     Dim iRows As Integer : iRows = _Height(0) '\ _FontHeight ' GET # OF AVAILABLE TEXT ROWS
  165.     ReDim arrLines(-1) As String
  166.     Cls
  167.     split in$, CHR$(13), arrLines() ' SPLIT OUTPUT INTO LINES
  168.     for iLoop = lbound(arrLines) to ubound(arrLines)
  169.         print arrLines(iLoop)
  170.         iCount = iCount + 1
  171.         if iCount > (iRows - 5) then
  172.             'INPUT "PRESS <ENTER> TO CONTINUE"; in$
  173.                         Sleep
  174.             iCount = 0
  175.         end if
  176.     next iLoop
  177.         print
  178.     input "PRESS <ENTER> TO CONTINUE";in$
  179. End Sub ' ShowInstructions
  180.  
  181. ' /////////////////////////////////////////////////////////////////////////////
  182. ' Split and join strings
  183. ' https://www.qb64.org/forum/index.php?topic=1073.0
  184. '
  185. ' FROM luke, QB64 Developer
  186. ' Date: February 15, 2019, 04:11:07 AM »
  187. '
  188. ' Given a string of words separated by spaces (or any other character),
  189. ' splits it into an array of the words. I've no doubt many people have
  190. ' written a version of this over the years and no doubt there's a million
  191. ' ways to do it, but I thought I'd put mine here so we have at least one
  192. ' version. There's also a join function that does the opposite
  193. ' array -> single string.
  194. '
  195. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  196. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  197.  
  198. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  199. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  200. '
  201. 'delimiter$ must be one character long.
  202. 'result$() must have been REDIMmed previously.
  203.  
  204. ' Modified to handle multi-character delimiters
  205.  
  206. Sub split (in$, delimiter$, result$())
  207.     Dim start As Integer
  208.     Dim finish As Integer
  209.     Dim iDelimLen As Integer
  210.     ReDim result$(-1)
  211.  
  212.     iDelimLen = Len(delimiter$)
  213.  
  214.     start = 1
  215.     Do
  216.         'While Mid$(in$, start, 1) = delimiter$
  217.         While Mid$(in$, start, iDelimLen) = delimiter$
  218.             'start = start + 1
  219.             start = start + iDelimLen
  220.             If start > Len(in$) Then
  221.                 Exit Sub
  222.             End If
  223.         Wend
  224.         finish = InStr(start, in$, delimiter$)
  225.         If finish = 0 Then
  226.             finish = Len(in$) + 1
  227.         End If
  228.  
  229.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  230.  
  231.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  232.         start = finish + 1
  233.     Loop While start <= Len(in$)
  234. End Sub ' split
  235.  
  236. ' ################################################################################################################################################################
  237.  
  238. ' /////////////////////////////////////////////////////////////////////////////
  239.  
  240. Function GetInstructions1$
  241.     Dim in$
  242.         in$ = ""
  243.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + chr$(13)
  244.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + chr$(13)
  245.     in$ = in$ + " " + chr$(13)
  246.         in$ = in$ + "SMcNeill, QB64 Developer" + chr$(13)
  247.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + chr$(13)
  248.     in$ = in$ + " " + chr$(13)
  249.     in$ = in$ + "One thing that would be *very* different with all hardware images vs what " + chr$(13)
  250.     in$ = in$ + "you're doing currently, is the fact that you have to remember:  " + chr$(13)
  251.     in$ = in$ + "Hardware images display once and then flush themselves from the GPU buffer. " + chr$(13)
  252.     in$ = in$ + " " + chr$(13)
  253.     in$ = in$ + "You can't just print to a tile, and then read the information for the color of " + chr$(13)
  254.     in$ = in$ + "that tile, and instantly turn that color into another one.  You have write " + chr$(13)
  255.     in$ = in$ + "access to hardware images, but not read access -- and the images aren't " + chr$(13)
  256.     in$ = in$ + "persistent like the software images are." + chr$(13)
  257.     in$ = in$ + " " + chr$(13)
  258.     in$ = in$ + "For something like this to work for a whole screen in hardware image mode, " + chr$(13)
  259.     in$ = in$ + "you'd have to sort out some sort of way to store your screen's info and then " + chr$(13)
  260.     in$ = in$ + "constantly redraw everything over and over again to keep it refreshed on the " + chr$(13)
  261.     in$ = in$ + "display." + chr$(13)
  262.     in$ = in$ + " " + chr$(13)
  263.     in$ = in$ + "The way I'd go about doing something like this would be to make myself a " + chr$(13)
  264.     in$ = in$ + "custom SCREEN 0-style memory array.  Screen 0 stores all our information for " + chr$(13)
  265.     in$ = in$ + "each character in 2 bytes -- one for color, one for character.  I'd basically " + chr$(13)
  266.     in$ = in$ + "do the same, but with 3 bytes -- one for tile color, one for font color, one " + chr$(13)
  267.     in$ = in$ + "for character." + chr$(13)
  268.     in$ = in$ + " " + chr$(13)
  269.     in$ = in$ + "Let me toss a simple demo of this line of thinking for you:" + chr$(13)
  270.     in$ = in$ + " " + chr$(13)
  271.     in$ = in$ + "I tried to comment the heck out of the code to help explain what it's doing " + chr$(13)
  272.     in$ = in$ + "from line to line, so I hope this isn't too hard to sort out and understand." + chr$(13)
  273.     in$ = in$ + " " + chr$(13)
  274.     in$ = in$ + "The beginning is nothing more than initializing things and making 2 different " + chr$(13)
  275.     in$ = in$ + "sprite sheets that I'll make use of later -- one for the tiles and one for the " + chr$(13)
  276.     in$ = in$ + "characters." + chr$(13)
  277.     in$ = in$ + " " + chr$(13)
  278.     in$ = in$ + "Then there's the mid section where you can SLEEP step through and view the " + chr$(13)
  279.     in$ = in$ + "various resource sheets." + chr$(13)
  280.     in$ = in$ + " " + chr$(13)
  281.     in$ = in$ + "Then an example of all the characters in a cyan font, resting atop a red tile.  " + chr$(13)
  282.     in$ = in$ + "(You have to hit ENTER to move on from this screen.)" + chr$(13)
  283.     in$ = in$ + " " + chr$(13)
  284.     in$ = in$ + "Then an example of all those tiles that go under the characters being replaced " + chr$(13)
  285.     in$ = in$ + "with sequential colored tiles.  (A lot of these tiles are simply BLACK, but " + chr$(13)
  286.     in$ = in$ + "that's the nature of the 256 color palette as those multiple blacks are there " + chr$(13)
  287.     in$ = in$ + "to be replaced with custom color values instead.)" + chr$(13)
  288.     in$ = in$ + " " + chr$(13)
  289.     in$ = in$ + "Once more, you'll have to hit ENTER to continue." + chr$(13)
  290.     in$ = in$ + " " + chr$(13)
  291.     in$ = in$ + "And then I do a quick time loop to count how many times we can redraw the whole " + chr$(13)
  292.     in$ = in$ + "screen of tiles + characters in 3 seconds." + chr$(13)
  293.     in$ = in$ + " " + chr$(13)
  294.     in$ = in$ + "For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of " + chr$(13)
  295.     in$ = in$ + "about 1800 refreshes in that time.  That's around 600 FPS, which would be more " + chr$(13)
  296.     in$ = in$ + "than enough for any sort of game display or use that I think I could come up " + chr$(13)
  297.     in$ = in$ + "with, and that's without me trying to optimize math or any such things to " + chr$(13)
  298.     in$ = in$ + "reduce calculations and speed the process up any more.  (Keep in mind, this is " + chr$(13)
  299.     in$ = in$ + "1800 full pages of a 800x600 screen -- if your screen has a lower overall " + chr$(13)
  300.     in$ = in$ + "resolution, then you'd draw more loops with less to process, but a higher " + chr$(13)
  301.     in$ = in$ + "resolution screen would draw fewer loops with more to process.)" + chr$(13)
  302.     in$ = in$ + " " + chr$(13)
  303.     in$ = in$ + "No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page " + chr$(13)
  304.     in$ = in$ + "of tiles and colored characters.  (And, YES, it is a whole page being rendered " + chr$(13)
  305.     in$ = in$ + "repeatedly -- even if I didn't bother to fill in the vast majority of that page " + chr$(13)
  306.     in$ = in$ + "with anything more than black tiles, black fonts, and chr$(0) blank spaces...)" + chr$(13)
  307.     in$ = in$ + " " + chr$(13)
  308.     in$ = in$ + "It's a completely different approach to displaying stuff than what you've been " + chr$(13)
  309.     in$ = in$ + "doing, but it seems as if what you've been doing isn't working as it must be " + chr$(13)
  310.     in$ = in$ + "running too slow for you.  You wouldn't be able to use the normal PRINT " + chr$(13)
  311.     in$ = in$ + "statements to display to the faux screen memory array I've created; you'd have " + chr$(13)
  312.     in$ = in$ + "to write your own." + chr$(13)
  313.     GetInstructions1$ = in$
  314. End Function ' GetInstructions1$
  315.  
  316. ' /////////////////////////////////////////////////////////////////////////////
  317.  
  318. Function GetInstructions2$
  319.     Dim in$
  320.         in$ = ""
  321.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + chr$(13)
  322.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + chr$(13)
  323.     in$ = in$ + " " + chr$(13)
  324.         in$ = in$ + "SMcNeill, QB64 Developer" + chr$(13)
  325.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + chr$(13)
  326.     in$ = in$ + " " + chr$(13)
  327.     in$ = in$ + "For a quick speed comparison, here's the same type process ran using PRINT " + chr$(13)
  328.     in$ = in$ + "and a software screen of the same size:" + chr$(13)
  329.     GetInstructions2$ = in$
  330. End Function ' GetInstructions2$
  331.  
  332. ' ################################################################################################################################################################
  333.  
  334. ' /////////////////////////////////////////////////////////////////////////////
  335.  
  336. Sub TestCustomHardwareScreen1
  337.     Dim in$
  338.     Cls
  339.         Print "Custom hardware screen test. Press <ENTER> to proceed through each step."
  340.         Input "PRESS <ENTER> TO START";in$
  341.        
  342.         Randomize Timer
  343.    
  344.     Display = _NewImage(800, 600, 32) 'my main screenwich is 100 by 75 characters with 8x8 font.
  345.     Tile = _NewImage(8 * 256, 8, 32) '8x8 tiles in 256 colors
  346.     Font = _NewImage(8 * 256, 8 * 256, 32) '256 characters of an 8x8 font, in all 256 possible colors.
  347.    
  348.     Screen Display 'Set the main screen for starters so it'll go ahead and create itself properly while I'm working on making my tiles and fonts
  349.    
  350.     Dim As _Unsigned Long Kolors(255) 'an array to hold all my color values
  351.     tempScreen256 = _NewImage(10, 10, 256) 'very tiny 256 color screen, just to borrow the palette from
  352.     For i = 0 To 255 '40 colors
  353.         Kolors(i) = _RGB32(_Red(i, tempScreen256), _Green(i, tempScreen256), _Blue(i, tempScreen256)) 'since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  354.     Next
  355.     _FreeImage tempScreen256 'free up all images once done with them
  356.    
  357.     _Dest Tile 'Create my software tiles of 256 colors
  358.     For i = 0 To 255 '256 tiles, one for each color
  359.         Line (i * 8, 0)-Step(8, 8), Kolors(i), BF 'all drawn sequentially onto a sprite sheet
  360.     Next
  361.    
  362.     _Dest Font
  363.     _Font 8 'I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  364.     For k = 0 To 255 '256 colors
  365.         Color Kolors(k), 0 'make our font the proper color
  366.         For c = 0 To 255 '256 characters
  367.             _PrintString (c * 8, k * 8), Chr$(c) 'print the characters row by row to the screen
  368.         Next
  369.     Next
  370.     _Dest Display
  371.    
  372.     Sleep 'View the blank screen  until a key is hit
  373.     Screen Tile 'View the tiles
  374.     Sleep 'until a key is hit
  375.     Screen Font 'view the fonts
  376.     Sleep 'until a key is hit
  377.     Screen Display 'and back to the normal blank screen
  378.     _Delay .2 'time to remove finger from key
  379.     'Dim Shared As Long TileHw, FontHw
  380.        
  381.     TileHw = _CopyImage(Tile, 33) 'hardware copy of the tile image
  382.     FontHw = _CopyImage(Font, 33) 'hardware copy of the font image
  383.    
  384.     _FreeImage Tile 'free unused images when done with them
  385.     _FreeImage Font 'free unused images when done with them
  386.    
  387.     _DisplayOrder _Hardware 'From this point onwards, I'm *ONLY* going to use my hardware layer
  388.    
  389.     'Dim Shared ScreenArray(99, 74) As _Unsigned Long 'Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  390.    
  391.     'To start with, let's put all 256 chracters on the screen, on a color 40 tile (red), in a color 3 font (cyan)
  392.     For i = 0 To 255
  393.         x = x + 1: If x > 99 Then x = 0: y = y + 1
  394.         ScreenArray(x, y) = SetAll(40, 3, i) '40 tile color, 3 font color, i is the character
  395.     Next
  396.    
  397.     Do 'And then let's show these results on the screen.  Take a moment to open task manager and see how little resources we're using here.
  398.         ScreenRender 'Draw a whole screen full of these tiles + characters
  399.         _Limit 30
  400.     Loop Until _KeyDown(13) 'until we hit ENTER
  401.    
  402.     _Delay .2 'time to lift up the key so we don't instantly blow past the next loop
  403.    
  404.     x = 0: y = 0
  405.     For i = 0 To 255 'and here I'm going to set all these tiles to have incremental background tile colors
  406.         x = x + 1: If x > 99 Then x = 0: y = y + 1 'from left to right, top to bottom
  407.         SetArrayTile x, y, i 'set each tile to become an ever increasing color value
  408.     Next
  409.    
  410.     Do 'And then let's show these results on the screen.
  411.         ScreenRender 'Draw a whole screen full of these tiles + characters
  412.         _Limit 30
  413.     Loop Until _KeyDown(13) 'until we hit ENTER
  414.    
  415.     'And to finish up, let's do a quick count of how many loops per second we *could* process, with the whole screen being redrawn over and over like this
  416.     t## = Timer + 3
  417.     Do
  418.         count& = count& + 1
  419.         ScreenRender
  420.     Loop Until Timer > t##
  421.    
  422.        
  423.         _KEYCLEAR: _DELAY 1
  424.         Screen 0 : Cls
  425.     Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  426.        
  427.         Print
  428.         Input "PRESS <ENTER> TO CONTINUE";in$
  429.        
  430. End Sub ' TestCustomHardwareScreen1
  431.  
  432. ' /////////////////////////////////////////////////////////////////////////////
  433.  
  434. Sub ScreenRender
  435.     Dim As _Unsigned Long tileColor, fontColor, character
  436.     For x = 0 To 99
  437.         For y = 0 To 74
  438.             tileColor = ScreenArray(x, y) \ (256 * 256)
  439.             fontColor = (ScreenArray(x, y) - tileColor * 256 * 256) \ 256
  440.             character = ScreenArray(x, y) Mod 256
  441.             _PutImage (x * 8, y * 8)-Step(7, 7), TileHw, , (tileColor * 8, 0)-Step(7, 7)
  442.             _PutImage (x * 8, y * 8)-Step(7, 7), FontHw, , (character * 8, fontColor * 8)-Step(7, 7)
  443.         Next
  444.     Next
  445.     _Display
  446. End Sub ' ScreenRender
  447.  
  448. ' /////////////////////////////////////////////////////////////////////////////
  449.  
  450. Function SetAll&& (tile, fontcolor, character)
  451.     SetAll&& = tile * 256 * 256 + fontcolor * 256 + character
  452. End Function ' SetAll&&
  453.  
  454. ' /////////////////////////////////////////////////////////////////////////////
  455.  
  456. Sub SetArrayTile (x, y, newTileColor)
  457.     temp&& = ScreenArray(x, y)
  458.     oldTile&& = temp&& \ (256 * 256)
  459.     ScreenArray(x, y) = temp&& - oldTile&& + newTileColor * 256 * 256
  460. End Sub ' SetArrayTile
  461.  
  462. ' /////////////////////////////////////////////////////////////////////////////
  463.  
  464. Sub SetArrayFontColor (x, y, newFontColor)
  465.     temp&& = ScreenArray(x, y)
  466.     oldTile&& = temp&& \ (256 * 256)
  467.     oldFont&& = (temp&& - oldTile&&) \ 256
  468.     ScreenArray(x, y) = temp&& - oldFont&& + newFontColor * 256
  469. End Sub ' SetArrayFontColor
  470.  
  471. ' /////////////////////////////////////////////////////////////////////////////
  472.  
  473. Sub SetArrayCharacter (x, y, newCharacter)
  474.     temp&& = ScreenArray(x, y)
  475.     oldCharacter&& = temp&& Mod 256
  476.     ScreenArray(x, y) = temp&& - oldCharacter&& + newCharacter
  477. End Sub ' SetArrayCharacter
  478.  
  479. ' /////////////////////////////////////////////////////////////////////////////
  480.  
  481. Sub TestSoftwareScreen1
  482.     Dim in$
  483.        
  484.         Screen _NewImage(800, 600, 32)
  485.    
  486.     t## = Timer + 3
  487.     _Font 8
  488.     Do
  489.         count = count + 1
  490.         For x = 1 To 100
  491.             For y = 1 To 75
  492.                 c = (c + 1) Mod 256
  493.                 Color _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
  494.                 Locate y, x: Print Chr$(c);
  495.             Next
  496.         Next
  497.     Loop Until Timer > t##
  498.    
  499.         _KEYCLEAR: _DELAY 1
  500.         Screen 0 : Cls
  501.     Print count; "total screen replacements in 3 seconds."
  502.         Print
  503.         Input "PRESS <ENTER> TO CONTINUE";in$
  504. End Sub ' TestSoftwareScreen1
  505.  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #21 on: February 25, 2022, 04:41:35 pm »
Quote
No time now to get into it in detail, but at the end of the hardware image sample, it seems to lock up.
(See my version below.)
Any idea why? I do a keyclear and return to screen 0 but the program just becomes nonresponsive after that.

I haven't had a chance to test the code, but glancing over it, it appears that you're missing a call to _AutoDisplay.  In the Sub ScreenRender, we have a call to _Display which sets the program to only update the screen when we manually tell it to.  Without an _AutoDisplay, the PRINT and INPUT statements won't display to the screen unless you add another _DISPLAY in there for them.

Try to place an _AutoDisplay after the _DisplayOrder statement.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #22 on: February 26, 2022, 12:07:38 pm »
I haven't had a chance to test the code, but glancing over it, it appears that you're missing a call to _AutoDisplay.  In the Sub ScreenRender, we have a call to _Display which sets the program to only update the screen when we manually tell it to.  Without an _AutoDisplay, the PRINT and INPUT statements won't display to the screen unless you add another _DISPLAY in there for them.
Try to place an _AutoDisplay after the _DisplayOrder statement.  ;)

I will, thanks.

Meanwhile, I started thinking along a different track for approaching the problem.

In speed tests, I noticed the Line statement was many times faster drawing rectangles, and also simple shapes using multiple rectangles, than _putimage with software images.

How about this approach? It may be even faster with hardware images if you can use Line with those, but even without, I expect some speed...

Later I'll add this to the previous program that compares speeds and adjust it so we're comparing apples to apples, and see.

I think the worst case would be a tile that has a checkerboard pattern where the maximim # of rectangles would be 32, but a lot of shapes just need 2-4 rectangles (+1 if there is a background color).

Anyway here is a proof of concept v1:

Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2. ' VECTOR TILE DRAWING EXPERIMENT
  3.  
  4. ' GENERATES SEMI-OPTIMIZED VECTOR DRAWING ROUTINES USING Line COMMANDS
  5. ' FOR ONE OR MORE 8X8 RASTER TILES.
  6.  
  7. ' Eventually we would store a list of line coordinates for each tile
  8. ' in a 2D array or similar data structure, with just one general-
  9. ' purpose drawing routine that receives a list of (x1,y1,x2,y2)
  10. ' and a color and draws the shape with Line. The background would
  11. ' be transparent but if we want a background color can be specified
  12. ' and simply draw an 8x8 background color rectangle first and then
  13. ' draw the shape on top of that.
  14.  
  15. ' TODO: Optimize for each shape by determining how to draw it with the
  16. '       minimum number of line commands.
  17. '
  18. '       For example this:
  19. '           ' DRAW WITH HORIZONTAL LINES
  20. '           Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  21. '           Line (iX + 6, iY + 4)-(iX + 6, iY + 4), fgColor
  22. '       could be replaced with:
  23. '           ' DRAW WITH VERTICAL LINES
  24. '           Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  25. '
  26. '       Google "rectangular decomposition of binary images" and similar
  27. '       to find a better algorithm.
  28. '
  29. '       Brute force method would be to draw every size rectangle from 1x1
  30. '       up to 8x8 (which can themselves be precalculated) in every available
  31. '       location in the 8x8 grid (where no part of any rectangle falls off
  32. '       the grid), then try every combination of those rectangles to find
  33. '       combination where the the minimum number of rectangles cover all
  34. '       points.
  35. '
  36. '       Rather than compute this on the fly, we could precompute it and
  37. '       for each given tile, store the list of those rectangle coordinates
  38. '       (x1,y1,x2,y2) for drawing it indexed by the tile's definiton in
  39. '       hexidecimal where 16-bits (0-F) defines the bit pattern for each
  40. '       row in the tile, therefore a tile's definition can be stored by
  41. '       8 characters (or less if we use base 64). Perhaps build a utility
  42. '       that will compute the optimal drawing pattern for every possible
  43. '       combination of an 8x8 grid, and index them all by the tile's 8-byte
  44. '       hexidecimal definition. It might take a while to run, but once it
  45. '       does, we will have a database of every possible tile's optimized
  46. '       drawing instructions that can be quickly looked up.
  47. '       Then we only pull out those definitions for the tiles that our
  48. '       given program uses, so the data would be relatively small
  49. '       (even smaller if we encode it with base-64).
  50.  
  51. ' ################################################################################################################################################################
  52.  
  53. ' ===============================================================================
  54. ' GLOBAL CONSTANTS
  55. ' ===============================================================================
  56. ' BOOLEAN VALUES
  57. Const FALSE = 0
  58. Const TRUE = Not FALSE
  59.  
  60. ' ===============================================================================
  61. ' USER DEFINED TYPES
  62. ' ===============================================================================
  63. ' UDT TO HOLD COORDINATES FOR DRAWING A RECTANGLE
  64. Type CoordinateType
  65.     x1 As Integer ' start x
  66.     x2 As Integer ' end x
  67.     y1 As Integer ' start y
  68.     y2 As Integer ' end y
  69. End Type ' CoordinateType
  70.  
  71. ' UDT TO HOLD COLOR CODE INFO
  72. Type ColorType
  73.     name As String
  74.     value As _Unsigned Long
  75. End Type ' ColorType
  76.  
  77. ' UDT FOR PRECALCULATED TILESHEET
  78. Type TileSheetMapType
  79.     xStart As Integer
  80.     xEnd As Integer
  81.     yStart As Integer
  82.     yEnd As Integer
  83.  
  84. ' UDT FOR PRECALCULATED TILE MAP
  85. Type TileMapType
  86.     xPos As Integer
  87.     yPos As Integer
  88.  
  89. ' ===============================================================================
  90. ' GLOBAL VARIABLES
  91. ' ===============================================================================
  92. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES CONSOLE WINDOW AND DebugPrint
  93. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  94. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  95.  
  96. ' ===============================================================================
  97. ' LOCAL VARIABLES
  98. ' ===============================================================================
  99. Dim in$
  100.  
  101. ' ****************************************************************************************************************************************************************
  102. ' ACTIVATE DEBUGGING WINDOW
  103. If m_bDebug = TRUE Then
  104.     $Console
  105.     _Delay 4
  106.     _Console On
  107.     _Echo "Started " + m_ProgramName$
  108.     _Echo "Debugging on..."
  109. ' ****************************************************************************************************************************************************************
  110.  
  111. ' ===============================================================================
  112. ' START THE MAIN ROUTINE
  113. ' ===============================================================================
  114. main
  115.  
  116. ' ===============================================================================
  117. ' FINISH
  118. ' ===============================================================================
  119. Print m_ProgramName$ + " finished."
  120. Input "Press <ENTER> to continue", in$
  121. ' ****************************************************************************************************************************************************************
  122. ' DEACTIVATE DEBUGGING WINDOW
  123. If m_bDebug = TRUE Then
  124. ' ****************************************************************************************************************************************************************
  125. System ' return control to the operating system
  126.  
  127. ' ################################################################################################################################################################
  128. ' BEGIN MAIN MENU
  129. ' ################################################################################################################################################################
  130.  
  131. ' /////////////////////////////////////////////////////////////////////////////
  132.  
  133. Sub main
  134.     Dim RoutineName As String: RoutineName = "main"
  135.     Dim in$
  136.     Dim bFinished As Integer: bFinished = FALSE
  137.     Dim result$: result$ = ""
  138.     Do
  139.         Screen 0
  140.         Cls
  141.         Print m_ProgramName$
  142.         Print
  143.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  144.         Print "How about using the Line statement and draw tiles as vector imagess?"
  145.         Print
  146.         Print "1) GenerateVectorTileCode"
  147.         Print "2) DrawVectorTilesTest1"
  148.         Print
  149.         Print "Q) Exit program"
  150.         Do
  151.             in$ = InKey$
  152.             If UCase$(in$) = "Q" Then
  153.                 bFinished = TRUE: Exit Do
  154.             ElseIf UCase$(in$) = "1" Then
  155.                 GenerateVectorTileCode: Exit Do
  156.             ElseIf UCase$(in$) = "2" Then
  157.                 DrawVectorTilesTest1: Exit Do
  158.             End If
  159.         Loop
  160.     Loop Until bFinished = TRUE
  161. End Sub ' main
  162.  
  163. ' ################################################################################################################################################################
  164. ' END MAIN MENU
  165. ' ################################################################################################################################################################
  166.  
  167. ' ################################################################################################################################################################
  168. ' BEGIN VECTOR TILE DRAWING TEST ROUTINES
  169. ' ################################################################################################################################################################
  170.  
  171. ' /////////////////////////////////////////////////////////////////////////////
  172.  
  173. Sub DrawVectorTilesTest1
  174.     Dim iX As Integer
  175.     Dim iY As Integer
  176.     Dim iMaxX As Integer
  177.     Dim iMaxY As Integer
  178.     Dim iShape As Integer
  179.     Dim iMaxShape As Integer
  180.     Dim fgColor As _Unsigned Long
  181.     Dim arrColor(0 To 7) As _Unsigned Long
  182.     Dim iColorIndex As Integer
  183.     Dim in$
  184.  
  185.     arrColor(0) = cBlack
  186.     arrColor(1) = cRed
  187.     arrColor(2) = cYellow
  188.     arrColor(3) = cLime
  189.     arrColor(4) = cCyan
  190.     arrColor(5) = cBlue
  191.     arrColor(6) = cPurple
  192.     arrColor(7) = cMagenta
  193.  
  194.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  195.     Cls , cBlack
  196.  
  197.     iMaxX = ((_Width(0) - 16) \ 8)
  198.     iMaxY = (_Height(0) - 16)
  199.     iMaxShape = 24
  200.     iShape = 0:: iColorIndex = 1
  201.  
  202.     For iY = (8 * 10) To iMaxY Step 8
  203.         For iX = 0 To iMaxX Step 8
  204.             DrawShape iShape, iX, iY, arrColor(iColorIndex)
  205.             iShape = iShape + 1: If iShape > iMaxShape Then iShape = 0
  206.             iColorIndex = iColorIndex + 1: If iColorIndex > 7 Then iColorIndex = 1
  207.         Next iX
  208.     Next iY
  209.  
  210.     Locate 1, 1
  211.     Input "PRESS <ENTER> TO CONTINUE"; in$
  212. End Sub ' DrawVectorTilesTest1
  213.  
  214. ' /////////////////////////////////////////////////////////////////////////////
  215.  
  216. Sub DrawShape (iShape As Integer, iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  217.     Select Case iShape
  218.         Case 0:
  219.             DrawHomeLine8x8_VT_1 iX, iY, fgColor
  220.         Case 1:
  221.             DrawHomeLine8x8_HZ_1 iX, iY, fgColor
  222.         Case 2:
  223.             DrawHomeLine8x8_NW_1 iX, iY, fgColor
  224.         Case 3:
  225.             DrawHomeLine8x8_NE_1 iX, iY, fgColor
  226.         Case 4:
  227.             DrawHomeLine8x8_SW_1 iX, iY, fgColor
  228.         Case 5:
  229.             DrawHomeLine8x8_SE_1 iX, iY, fgColor
  230.         Case 6:
  231.             DrawHomeLine8x8_VT_2 iX, iY, fgColor
  232.         Case 7:
  233.             DrawHomeLine8x8_HZ_2 iX, iY, fgColor
  234.         Case 8:
  235.             DrawHomeLine8x8_NW_2 iX, iY, fgColor
  236.         Case 9:
  237.             DrawHomeLine8x8_NE_2 iX, iY, fgColor
  238.         Case 10:
  239.             DrawHomeLine8x8_SW_2 iX, iY, fgColor
  240.         Case 11:
  241.             DrawHomeLine8x8_SE_2 iX, iY, fgColor
  242.         Case 12:
  243.             DrawHomeLine8x8_VT_3 iX, iY, fgColor
  244.         Case 13:
  245.             DrawHomeLine8x8_HZ_3 iX, iY, fgColor
  246.         Case 14:
  247.             DrawHomeLine8x8_NW_3 iX, iY, fgColor
  248.         Case 15:
  249.             DrawHomeLine8x8_NE_3 iX, iY, fgColor
  250.         Case 16:
  251.             DrawHomeLine8x8_SW_3 iX, iY, fgColor
  252.         Case 17:
  253.             DrawHomeLine8x8_SE_3 iX, iY, fgColor
  254.         Case 18:
  255.             DrawJailLine8x8_VT_2 iX, iY, fgColor
  256.         Case 19:
  257.             DrawJailLine8x8_VT_1 iX, iY, fgColor
  258.         Case 20:
  259.             DrawJailLine8x8_HZ_2 iX, iY, fgColor
  260.         Case 21:
  261.             DrawJailLine8x8_HZ_1 iX, iY, fgColor
  262.         Case 22:
  263.             DrawJailLine8x8_Grid_1 iX, iY, fgColor
  264.         Case 23:
  265.             DrawJailLine8x8_Grid_2 iX, iY, fgColor
  266.         Case 24:
  267.             DrawJailLine8x8_Grid_3 iX, iY, fgColor
  268.         Case Else:
  269.             '(IGNORE)
  270.     End Select
  271. End Sub ' DrawShape
  272.  
  273. ' ################################################################################################################################################################
  274. ' END VECTOR TILE DRAWING TEST ROUTINES
  275. ' ################################################################################################################################################################
  276.  
  277. ' ################################################################################################################################################################
  278. ' BEGIN BOX DRAWING ROUTINES
  279. ' ################################################################################################################################################################
  280.  
  281. ' /////////////////////////////////////////////////////////////////////////////
  282. ' DRAW A 2-D BOX (OUTLINE)
  283. ' https://www.qb64.org/wiki/LINE
  284.  
  285. Sub DrawBoxOutline (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  286.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, B ' Draw box outline
  287. End Sub ' DrawBoxOutline
  288.  
  289. ' /////////////////////////////////////////////////////////////////////////////
  290. ' DRAW A 2-D BOX (SOLID)
  291. ' https://www.qb64.org/wiki/LINE
  292.  
  293. ' Renamed DrawBox/DrawBoxLine to DrawSolidBox
  294.  
  295. Sub DrawBoxSolid (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  296.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, BF ' Draw a solid box
  297. End Sub ' DrawBoxSolid
  298.  
  299. ' /////////////////////////////////////////////////////////////////////////////
  300. ' DRAW A 2-D RECTANGLE (OUTLINE)
  301.  
  302. Sub DrawRectOutline (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  303.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, B ' Draw rectangle outline
  304. End Sub ' DrawRectOutline
  305.  
  306. ' /////////////////////////////////////////////////////////////////////////////
  307. ' DRAW A 2-D RECTANGLE (SOLID)
  308.  
  309. Sub DrawRectSolid (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  310.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, BF ' Draw a solid rectangle
  311. End Sub ' DrawRectSolid
  312.  
  313. ' /////////////////////////////////////////////////////////////////////////////
  314. ' DRAW A 2-D BOX (OUTLINE)
  315. ' https://www.qb64.org/wiki/LINE
  316.  
  317. ' The style parameter 0-255 doesn't seem to have a solid line?
  318. ' For that, use DrawOutlineBox.
  319.  
  320. ' LINE [STEP] [(column1, row1)]-[STEP] (column2, row2), color[, [{B|BF}], style%]
  321. ' B creates a box outline with each side parallel to the program screen sides. BF creates a filled box.
  322. ' The style% signed INTEGER value sets a dotted pattern to draw the line or rectangle outline.
  323.  
  324. Sub DrawStyledOutlineBox (iX%, iY%, iSize%, iColor~&, iStyle%)
  325.     Line (iX%, iY%)-(iX% + (iSize% - 1), iY% + (iSize% - 1)), iColor~&, B , iStyle%
  326. End Sub ' DrawStyledOutlineBox
  327.  
  328. ' /////////////////////////////////////////////////////////////////////////////
  329. ' DRAW A 2-D BOX (OUTLINE) WITH A SOLID LINE
  330.  
  331. Sub DrawOutlineBox (iX%, iY%, iSize2%, iColor~&, iWeight2%)
  332.     Dim iFromX%
  333.     Dim iFromY%
  334.     Dim iToX%
  335.     Dim iToY%
  336.     iSize% = iSize2% - 1
  337.     iWeight% = iWeight2% - 1
  338.     If iWeight% = 0 Then
  339.         ' TOP LINE
  340.         iFromX% = iX%
  341.         iFromY% = iY%
  342.         iToX% = iX% + iSize%
  343.         iToY% = iY%
  344.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  345.  
  346.         ' BOTTOM LINE
  347.         iFromX% = iX%
  348.         iFromY% = iY% + iSize%
  349.         iToX% = iX% + iSize%
  350.         iToY% = iY% + iSize%
  351.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  352.  
  353.         ' LEFT LINE
  354.         iFromX% = iX%
  355.         iFromY% = iY%
  356.         iToX% = iX%
  357.         iToY% = iY% + iSize%
  358.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  359.  
  360.         ' RIGHT LINE
  361.         iFromX% = iX% + iSize%
  362.         iFromY% = iY%
  363.         iToX% = iX% + iSize%
  364.         iToY% = iY% + iSize%
  365.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  366.     ElseIf iWeight% > 0 Then
  367.         ' TOP LINE
  368.         For iFromY% = iY% To (iY% + iWeight%)
  369.             iFromX% = iX%
  370.             'iFromY% = iY%
  371.             iToX% = iX% + iSize%
  372.             iToY% = iFromY%
  373.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  374.         Next iFromY%
  375.  
  376.         ' BOTTOM LINE
  377.         For iFromY% = ((iY% + iSize%) - iWeight%) To (iY% + iSize%)
  378.             iFromX% = iX%
  379.             'iFromY% = iY% + iSize%
  380.             iToX% = iX% + iSize%
  381.             iToY% = iFromY%
  382.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  383.         Next iFromY%
  384.  
  385.         ' LEFT LINE
  386.         For iFromX% = iX% To (iX% + iWeight%)
  387.             'iFromX% = iX%
  388.             iFromY% = iY%
  389.             iToX% = iFromX%
  390.             iToY% = iY% + iSize%
  391.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  392.         Next iFromX%
  393.  
  394.         ' RIGHT LINE
  395.         For iFromX% = ((iX% + iSize%) - iWeight%) To (iX% + iSize%)
  396.             'iFromX% = iX% + iSize%
  397.             iFromY% = iY%
  398.             iToX% = iFromX%
  399.             iToY% = iY% + iSize%
  400.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  401.         Next iFromX%
  402.     End If
  403. End Sub ' DrawOutlineBox
  404.  
  405. ' ################################################################################################################################################################
  406. ' END BOX DRAWING ROUTINES
  407. ' ################################################################################################################################################################
  408.  
  409. ' ################################################################################################################################################################
  410. ' BEGIN GENERATE LINE DRAWING SHAPE ROUTINES
  411. ' ################################################################################################################################################################
  412.  
  413. ' /////////////////////////////////////////////////////////////////////////////
  414. ' GENERATES SEMI-OPTIMIZED VECTOR DRAWING ROUTINES USING Line COMMANDS
  415. ' FOR ONE OR MORE 8X8 TILES.
  416.  
  417. ' TODO: Optimize for each shape by determining how to draw it with the
  418. '       minimum number of line commands.
  419.  
  420. Sub GenerateNextVectorTileCode (MyString As String, sNameList As String)
  421.     Dim RoutineName As String: RoutineName = "GenerateNextVectorTileCode"
  422.     Dim sError As String: sError = ""
  423.     ReDim arrShapes(-1) As String
  424.     ReDim arrLines(-1) As String
  425.     ReDim arrCols(-1) As String
  426.     ReDim arrCount(-1) As String
  427.     ReDim arrLenCountHZ(-1) As Integer
  428.     ReDim arrLenCountVT(-1) As Integer
  429.     ReDim arrNextShape(-1, -1) As String
  430.     ReDim arrNames(-1) As String
  431.     Dim sLine As String
  432.     Dim iLen As Integer
  433.     Dim iCount As Integer
  434.     Dim in$
  435.     Dim iLoopRows As Integer
  436.     Dim iLoopCols As Integer
  437.     Dim iShapeCount As Integer
  438.     Dim iLoopShape As Integer
  439.     ReDim arrColSize As Integer
  440.     ReDim arrRowSize As Integer
  441.     Dim iCountHZ As Integer
  442.     Dim iCountVT As Integer
  443.     Dim iLoopCount As Integer
  444.     Dim sTransposed As String
  445.     Dim iColumnCount As Integer
  446.     Dim iRowCount As Integer
  447.     Dim iScoreHZ As Integer
  448.     Dim iScoreVT As Integer
  449.     Dim iRow As Integer
  450.     Dim iX1 As Integer
  451.     Dim iX2 As Integer
  452.     Dim iY1 As Integer
  453.     Dim iY2 As Integer
  454.     Dim iLast As Integer
  455.     Dim sTemplate1 As String
  456.     Dim sTemplate2 As String
  457.     Dim sShapeCode As String
  458.     Dim sLineCommands As String
  459.     Dim iTotalCount As Integer: iTotalCount = 0
  460.     Dim sNextShapeComment As String
  461.  
  462.     ' Initialize screen
  463.     If Len(sError) = 0 Then
  464.         Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  465.     End If
  466.  
  467.     ' Initialize template
  468.     If Len(sError) = 0 Then
  469.         ' Template for code for a shape routine:
  470.         sTemplate1 = "" + _
  471.             "' /////////////////////////////////////////////////////////////////////////////" + chr$(13) + _
  472.             "' Draw this shape with Line commands:" + chr$(13) + _
  473.             "{shape comments}" + _
  474.             "Sub {name}(iX As Integer, iY As Integer, fgColor As _UNSIGNED Long)" + chr$(13) + _
  475.             "    ' {comment}" + chr$(13) + _
  476.             "{line commands}" + _
  477.             "End Sub ' {name}" + chr$(13) + _
  478.             chr$(13) + ""
  479.  
  480.         ' Template for what replaces "{line commands}":
  481.         sTemplate2 = "    Line ({x1}, {y1})-({x2}, {y2}), fgColor" + Chr$(13)
  482.     End If
  483.  
  484.     ' Break multiple up into shapes
  485.     If Len(sError) = 0 Then
  486.         split MyString, Chr$(13), arrLines()
  487.         sLine = arrLines(LBound(arrLines))
  488.         iLen = Len(sLine)
  489.         sLine = Replace$(sLine, " ", "")
  490.         iCount = (iLen - Len(sLine)) + 1
  491.         For iLoopRows = LBound(arrLines) To UBound(arrLines)
  492.             If Len(arrLines(iLoopRows)) > 0 Then
  493.                 split arrLines(iLoopRows), " ", arrCols()
  494.                 iShapeCount = 0
  495.  
  496.                 For iLoopCols = LBound(arrCols) To UBound(arrCols)
  497.                     If Len(arrCols(iLoopCols)) > 0 Then
  498.                         iShapeCount = iShapeCount + 1
  499.  
  500.                         If UBound(arrShapes) < iShapeCount Then
  501.                             ReDim _Preserve arrShapes(0 To iShapeCount)
  502.                         End If
  503.  
  504.                         arrShapes(iShapeCount) = arrShapes(iShapeCount) + arrCols(iLoopCols) + Chr$(13)
  505.                     End If
  506.                 Next iLoopCols
  507.             End If
  508.         Next iLoopRows
  509.     End If
  510.  
  511.     ' Get names
  512.     If Len(sError) = 0 Then
  513.         split sNameList, ",", arrNames()
  514.         If (UBound(arrNames) + 1 < iShapeCount) Then
  515.             sError = "Not enough names in sNameList." + chr$(13) + _
  516.                 "Detected " + cstr$( ubound(arrNames)+1 ) + "names in " + chr$(13) + _
  517.                 "sNameList " + chr$(34) + sNameList + chr$(34) + chr$(13) + _
  518.                 "and " + cstr$(iShapeCount) + " shapes."
  519.         End If
  520.     End If
  521.  
  522.     ' Process shapes and generate line drawing routines
  523.     If Len(sError) = 0 Then
  524.         For iLoopShape = 1 To iShapeCount
  525.             Cls
  526.             Print "Shape #" + cstr$(iLoopShape)
  527.             Print arrShapes(iLoopShape)
  528.  
  529.             ' Count rows/columns and create comment showing the shape
  530.             iRowCount = 0
  531.             iColumnCount = 0
  532.             sNextShapeComment = ""
  533.             split arrShapes(iLoopShape), Chr$(13), arrLines()
  534.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  535.                 If Len(arrLines(iLoopRows)) > 0 Then
  536.                     sNextShapeComment = sNextShapeComment + "' " + _Trim$(arrLines(iLoopRows)) + Chr$(13)
  537.                     iRowCount = iRowCount + 1
  538.                     iLen = Len(_Trim$(arrLines(iLoopRows)))
  539.                     If iLen > iColumnCount Then
  540.                         iColumnCount = iLen
  541.                     End If
  542.                 End If
  543.             Next iLoopRows
  544.             ReDim arrLenCountHZ(1 To iColumnCount) As Integer
  545.             ReDim arrLenCountVT(1 To iRowCount) As Integer
  546.             Print "iRowCount   =" + cstr$(iRowCount)
  547.             Print "iColumnCount=" + cstr$(iColumnCount)
  548.             ReDim arrNextShape(iRowCount, iColumnCount) As String
  549.  
  550.             ' Count consecutive horizontal
  551.             iCountHZ = 0
  552.             Print "lbound(arrLines)=" + cstr$(LBound(arrLines))
  553.             Print "ubound(arrLines)=" + cstr$(UBound(arrLines))
  554.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  555.                 If Len(arrLines(iLoopRows)) > 0 Then
  556.                     split arrLines(iLoopRows), ".", arrCount()
  557.                     For iLoopCount = LBound(arrCount) To UBound(arrCount)
  558.                         iLen = Len(_Trim$(arrCount(iLoopCount)))
  559.                         arrLenCountHZ(iLen) = arrLenCountHZ(iLen) + 1
  560.                         If iLen > 0 Then
  561.                             iCountHZ = iCountHZ + 1
  562.                         End If
  563.                     Next iLoopCount
  564.                 End If
  565.             Next iLoopRows
  566.             Print "iCountHZ = " + cstr$(iCountHZ)
  567.  
  568.             ' Transpose to count vertical and create 2D array
  569.             sTransposed = ""
  570.             iCount = 0
  571.             ReDim arrCols(iColumnCount) As String
  572.             iRow = 0
  573.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  574.                 If Len(arrLines(iLoopRows)) > 0 Then
  575.                     iRow = iRow + 1
  576.                     For iLoopCols = 1 To Len(arrLines(iLoopRows))
  577.                         arrCols(iLoopCols) = arrCols(iLoopCols) + Mid$(arrLines(iLoopRows), iLoopCols, 1)
  578.                         arrNextShape(iRow, iLoopCols) = Mid$(arrLines(iLoopRows), iLoopCols, 1)
  579.                     Next iLoopCols
  580.                 End If
  581.             Next iLoopRows
  582.             For iLoopCols = LBound(arrCols) To UBound(arrCols)
  583.                 sTransposed = sTransposed + arrCols(iLoopCols) + Chr$(13)
  584.             Next iLoopCols
  585.             'print "Transposed:"
  586.             'print sTransposed
  587.  
  588.             ' Count consecutive vertical
  589.             iCountVT = 0
  590.             For iLoopRows = LBound(arrCols) To UBound(arrCols)
  591.                 If Len(arrCols(iLoopRows)) > 0 Then
  592.                     split arrCols(iLoopRows), ".", arrCount()
  593.                     For iLoopCount = LBound(arrCount) To UBound(arrCount)
  594.                         iLen = Len(_Trim$(arrCount(iLoopCount)))
  595.                         arrLenCountVT(iLen) = arrLenCountVT(iLen) + 1
  596.                         If iLen > 0 Then
  597.                             iCountVT = iCountVT + 1
  598.                         End If
  599.                     Next iLoopCount
  600.                 End If
  601.             Next iLoopRows
  602.  
  603.             ' Weigh horizontal vs vertical
  604.             iScoreHZ = 0
  605.             sLine = ""
  606.             For iCount = 1 To iColumnCount
  607.                 If iCount > 1 Then sLine = sLine + ", "
  608.                 sLine = sLine + cstr$(iCount) + "=" + cstr$(arrLenCountHZ(iCount))
  609.                 iScoreHZ = iScoreHZ + (iCount * arrLenCountHZ(iCount))
  610.             Next iCount
  611.             Print "Horizontal count: " + sLine
  612.             Print "Horizontal total: " + cstr$(iCountHZ)
  613.             Print "Horizontal miles: " + cstr$(iScoreHZ)
  614.  
  615.             iScoreVT = 0
  616.             sLine = ""
  617.             For iCount = 1 To iRowCount
  618.                 If iCount > 1 Then sLine = sLine + ", "
  619.                 sLine = sLine + cstr$(iCount) + "=" + cstr$(arrLenCountVT(iCount))
  620.                 iScoreVT = iScoreVT + (iCount * arrLenCountVT(iCount))
  621.             Next iCount
  622.             Print "Vertical   count: " + sLine
  623.             Print "Vertical   total: " + cstr$(iCountVT)
  624.             Print "Vertical   miles: " + cstr$(iScoreVT)
  625.  
  626.             '' Verify break up into array
  627.             'print "REGURGITATED 2D:"
  628.             'for iLoopRows = lbound(arrNextShape, 1) to ubound(arrNextShape, 1)
  629.             '    sLine = ""
  630.             '    for iLoopCols = lbound(arrNextShape, 2) to ubound(arrNextShape, 2)
  631.             '        sLine = sLine + arrNextShape(iLoopRows, iLoopCols)
  632.             '    next iLoopCols
  633.             '    print sLine
  634.             'next iLoopRows
  635.  
  636.             ' DID WE FIND ANYTHING TO DRAW?
  637.             If iCountVT > 0 And iCountHZ > 0 Then
  638.  
  639.                 ' INTIALIZE TEMPLATE FOR NEXT SHAPE
  640.                 'sTemplate1: {name} {comment} {line commands}
  641.                 sShapeCode = sTemplate1
  642.                 sShapeCode = Replace$(sShapeCode, "{name}", arrNames(iLoopShape - 1))
  643.                 sShapeCode = Replace$(sShapeCode, "{shape comments}", sNextShapeComment)
  644.                 sLineCommands = ""
  645.  
  646.                 ' More consecutive horizontal or vertical?
  647.                 If iCountVT < iCountHZ Then
  648.  
  649.                     ' ADD A COMMENT THAT THIS ROUTINE USES VERTICAL LINES
  650.                     'sTemplate1: {name} {comment} {line commands}
  651.                     sShapeCode = Replace$(sShapeCode, "{comment}", "DRAW WITH VERTICAL LINES")
  652.  
  653.                     ' LOOK AT SHAPE COLUMN BY COLUMN
  654.                     For iLoopCols = LBound(arrNextShape, 2) To UBound(arrNextShape, 2)
  655.                         iX1 = iLoopCols
  656.                         iX2 = iLoopCols
  657.                         iY1 = -1
  658.                         iY2 = -1
  659.  
  660.                         ' LOOK AT SHAPE ROW BY ROW
  661.                         For iLoopRows = LBound(arrNextShape, 1) To UBound(arrNextShape, 1)
  662.  
  663.                             ' PIXEL HERE...
  664.                             If arrNextShape(iLoopRows, iLoopCols) = "#" Then
  665.                                 ' ARE WE CURRENTLY IN A LINE?
  666.                                 If iY1 = -1 Then
  667.                                     ' NO, START A NEW LINE
  668.                                     ' Remember this as the starting point
  669.                                     iY1 = iLoopRows
  670.                                 End If
  671.  
  672.                                 ' Remember the most recent point
  673.                                 iLast = iLoopRows
  674.  
  675.                                 ' NO PIXEL HERE...
  676.                             Else
  677.                                 ' ARE WE CURRENTLY IN A LINE?
  678.                                 If iY1 <> -1 Then
  679.                                     ' Use the most recent point as the end point
  680.                                     iY2 = iLast
  681.  
  682.                                     ' GENERATE THE NEXT LINE COMMAND
  683.                                     'sTemplate1: {name} {comment} {line commands}
  684.                                     'sTemplate2: {x1} {y1} {x2} {y2}
  685.                                     'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  686.                                     sLine = sTemplate2
  687.  
  688.                                     If iX1 = 1 Then
  689.                                         sLine = Replace$(sLine, "{x1}", "iX")
  690.                                     Else
  691.                                         sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  692.                                     End If
  693.  
  694.                                     If iY1 = 1 Then
  695.                                         sLine = Replace$(sLine, "{y1}", "iY")
  696.                                     Else
  697.                                         sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  698.                                     End If
  699.  
  700.                                     If iX2 = 1 Then
  701.                                         sLine = Replace$(sLine, "{x2}", "iX")
  702.                                     Else
  703.                                         sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  704.                                     End If
  705.  
  706.                                     If iY2 = 1 Then
  707.                                         sLine = Replace$(sLine, "{y2}", "iY")
  708.                                     Else
  709.                                         sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  710.                                     End If
  711.  
  712.                                     ' SAVE THE COMMAND TO BE ADDED
  713.                                     sLineCommands = sLineCommands + sLine
  714.  
  715.                                     ' RESET (NO LONGER IN A LINE)
  716.                                     iY1 = -1
  717.                                 End If
  718.                             End If
  719.                         Next iLoopRows
  720.  
  721.                         ' AND CHECK AGAIN AT THE END
  722.                         ' ARE WE CURRENTLY IN A LINE?
  723.                         If iY1 <> -1 Then
  724.                             ' Use the most recent point as the end point
  725.                             iY2 = iLast
  726.  
  727.                             ' GENERATE THE NEXT LINE COMMAND
  728.                             'sTemplate1: {name} {comment} {line commands}
  729.                             'sTemplate2: {x1} {y1} {x2} {y2}
  730.                             'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  731.                             sLine = sTemplate2
  732.  
  733.                             If iX1 = 1 Then
  734.                                 sLine = Replace$(sLine, "{x1}", "iX")
  735.                             Else
  736.                                 sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  737.                             End If
  738.  
  739.                             If iY1 = 1 Then
  740.                                 sLine = Replace$(sLine, "{y1}", "iY")
  741.                             Else
  742.                                 sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  743.                             End If
  744.  
  745.                             If iX2 = 1 Then
  746.                                 sLine = Replace$(sLine, "{x2}", "iX")
  747.                             Else
  748.                                 sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  749.                             End If
  750.  
  751.                             If iY2 = 1 Then
  752.                                 sLine = Replace$(sLine, "{y2}", "iY")
  753.                             Else
  754.                                 sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  755.                             End If
  756.  
  757.                             ' SAVE THE COMMAND TO BE ADDED
  758.                             sLineCommands = sLineCommands + sLine
  759.  
  760.                             ' RESET (NO LONGER IN A LINE)
  761.                             iY1 = -1
  762.                         End If
  763.                     Next iLoopCols
  764.  
  765.                     ' ADD THE LINE COMMANDS TO THE CURRENT SHAPE'S DRAW ROUTINE
  766.                     sShapeCode = Replace$(sShapeCode, "{line commands}", sLineCommands)
  767.  
  768.                     ' OUTPUT IT
  769.                     iTotalCount = iTotalCount + 1
  770.                     DebugPrint sShapeCode
  771.  
  772.                 Else
  773.                     ' ADD A COMMENT THAT THIS ROUTINE USES HORIZONTAL LINES
  774.                     'sTemplate1: {name} {comment} {line commands}
  775.                     sShapeCode = Replace$(sShapeCode, "{comment}", "DRAW WITH HORIZONTAL LINES")
  776.  
  777.                     ' LOOK AT SHAPE ROW BY ROW
  778.                     For iLoopRows = LBound(arrNextShape, 1) To UBound(arrNextShape, 1)
  779.                         iX1 = -1
  780.                         iX2 = -1
  781.                         iY1 = iLoopRows
  782.                         iY2 = iLoopRows
  783.  
  784.                         ' LOOK AT SHAPE COLUMN BY COLUMN
  785.                         For iLoopCols = LBound(arrNextShape, 2) To UBound(arrNextShape, 2)
  786.  
  787.                             ' PIXEL HERE...
  788.                             If arrNextShape(iLoopRows, iLoopCols) = "#" Then
  789.                                 ' ARE WE CURRENTLY IN A LINE?
  790.                                 If iX1 = -1 Then
  791.                                     ' NO, START A NEW LINE
  792.                                     ' Remember this as the starting point
  793.                                     iX1 = iLoopCols
  794.                                 End If
  795.  
  796.                                 ' Remember the most recent point
  797.                                 iLast = iLoopCols
  798.  
  799.                                 ' NO PIXEL HERE...
  800.                             Else
  801.                                 ' ARE WE CURRENTLY IN A LINE?
  802.                                 If iX1 <> -1 Then
  803.                                     ' Use the most recent point as the end point
  804.                                     iX2 = iLast
  805.  
  806.                                     ' GENERATE THE NEXT LINE COMMAND
  807.                                     'sTemplate1: {name} {comment} {line commands}
  808.                                     'sTemplate2: {x1} {y1} {x2} {y2}
  809.                                     'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  810.                                     sLine = sTemplate2
  811.  
  812.                                     If iX1 = 1 Then
  813.                                         sLine = Replace$(sLine, "{x1}", "iX")
  814.                                     Else
  815.                                         sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  816.                                     End If
  817.  
  818.                                     If iY1 = 1 Then
  819.                                         sLine = Replace$(sLine, "{y1}", "iY")
  820.                                     Else
  821.                                         sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  822.                                     End If
  823.  
  824.                                     If iX2 = 1 Then
  825.                                         sLine = Replace$(sLine, "{x2}", "iX")
  826.                                     Else
  827.                                         sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  828.                                     End If
  829.  
  830.                                     If iY2 = 1 Then
  831.                                         sLine = Replace$(sLine, "{y2}", "iY")
  832.                                     Else
  833.                                         sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  834.                                     End If
  835.  
  836.                                     ' SAVE THE COMMAND TO BE ADDED
  837.                                     sLineCommands = sLineCommands + sLine
  838.  
  839.                                     ' RESET (NO LONGER IN A LINE)
  840.                                     iX1 = -1
  841.                                 End If
  842.                             End If
  843.                         Next iLoopCols
  844.  
  845.                         ' AND CHECK AGAIN AT THE END
  846.                         ' ARE WE CURRENTLY IN A LINE?
  847.                         If iX1 <> -1 Then
  848.                             ' Use the most recent point as the end point
  849.                             iX2 = iLast
  850.  
  851.                             ' GENERATE THE NEXT LINE COMMAND
  852.                             'sTemplate1: {name} {comment} {line commands}
  853.                             'sTemplate2: {x1} {y1} {x2} {y2}
  854.                             'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  855.                             sLine = sTemplate2
  856.  
  857.                             If iX1 = 1 Then
  858.                                 sLine = Replace$(sLine, "{x1}", "iX")
  859.                             Else
  860.                                 sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  861.                             End If
  862.  
  863.                             If iY1 = 1 Then
  864.                                 sLine = Replace$(sLine, "{y1}", "iY")
  865.                             Else
  866.                                 sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  867.                             End If
  868.  
  869.                             If iX2 = 1 Then
  870.                                 sLine = Replace$(sLine, "{x2}", "iX")
  871.                             Else
  872.                                 sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  873.                             End If
  874.  
  875.                             If iY2 = 1 Then
  876.                                 sLine = Replace$(sLine, "{y2}", "iY")
  877.                             Else
  878.                                 sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  879.                             End If
  880.  
  881.                             ' SAVE THE COMMAND TO BE ADDED
  882.                             sLineCommands = sLineCommands + sLine
  883.  
  884.                             ' RESET (NO LONGER IN A LINE)
  885.                             iX1 = -1
  886.                         End If
  887.                     Next iLoopRows
  888.  
  889.                     ' ADD THE LINE COMMANDS TO THE CURRENT SHAPE'S DRAW ROUTINE
  890.                     sShapeCode = Replace$(sShapeCode, "{line commands}", sLineCommands)
  891.  
  892.                     ' OUTPUT IT
  893.                     iTotalCount = iTotalCount + 1
  894.                     DebugPrint sShapeCode
  895.                 End If
  896.             End If
  897.  
  898.             ' DONE
  899.             Print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  900.             Print sShapeCode
  901.             Print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  902.             'Input "PRESS <ENTER> TO CONTINUE";in$
  903.         Next iLoopShape
  904.     End If
  905.  
  906.     ' SHOW RESULTS
  907.     If Len(sError) = 0 Then
  908.         Print "Generated " + cstr$(iTotalCount) + " shape routines."
  909.     Else
  910.         Print RoutineName + " failed:"
  911.         Print sError
  912.     End If
  913.     'Input "PRESS <ENTER> TO CONTINUE";in$
  914.  
  915.     Screen 0
  916. End Sub ' GenerateNextVectorTileCode
  917.  
  918. ' /////////////////////////////////////////////////////////////////////////////
  919. ' Defines various 8x8 tiles and calls GenerateNextVectorTileCode to generate vector
  920. ' Line routines to draw each one.
  921.  
  922. Sub GenerateVectorTileCode ()
  923.     Dim MyString As String
  924.     Dim sNameList As String
  925.     Dim in$
  926.  
  927.     MyString = ""
  928.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  929.     MyString = MyString + "...#.... ........ ........ ........ ...#.... ...#...." + Chr$(13)
  930.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  931.     MyString = MyString + "...#.... #.#.#.#. ...##.#. #.##.... ...##.#. #.##...." + Chr$(13)
  932.     MyString = MyString + "........ ........ ...#.... ...#.... ........ ........" + Chr$(13)
  933.     MyString = MyString + "...#.... ........ ........ ........ ........ ........" + Chr$(13)
  934.     MyString = MyString + "........ ........ ...#.... ...#.... ........ ........" + Chr$(13)
  935.     MyString = MyString + "...#.... ........ ........ ........ ........ ........"
  936.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  937.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  938.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  939.     sNameList = Replace$(sNameList, "{n}", "1")
  940.     GenerateNextVectorTileCode MyString, sNameList
  941.  
  942.     MyString = ""
  943.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  944.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  945.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  946.     MyString = MyString + "...##... #.#.#.#. ...##.#. #.#.#... ...##.#. #.#.#..." + Chr$(13)
  947.     MyString = MyString + "........ #.#.#.#. ...##.#. #.#.#... ...##.#. #.#.#..." + Chr$(13)
  948.     MyString = MyString + "...##... ........ ........ ........ ........ ........" + Chr$(13)
  949.     MyString = MyString + "........ ........ ...##... ...##... ........ ........" + Chr$(13)
  950.     MyString = MyString + "...##... ........ ........ ........ ........ ........"
  951.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  952.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  953.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  954.     sNameList = Replace$(sNameList, "{n}", "2")
  955.     GenerateNextVectorTileCode MyString, sNameList
  956.  
  957.     MyString = ""
  958.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  959.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  960.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  961.     MyString = MyString + "........ .##..##. .....##. .##..... .....##. .##....." + Chr$(13)
  962.     MyString = MyString + "........ .##..##. .....##. .##..... .....##. .##....." + Chr$(13)
  963.     MyString = MyString + "...##... ........ ...##... ...##... ........ ........" + Chr$(13)
  964.     MyString = MyString + "...##... ........ ...##... ...##... ........ ........" + Chr$(13)
  965.     MyString = MyString + "........ ........ ........ ........ ........ ........"
  966.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  967.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  968.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  969.     sNameList = Replace$(sNameList, "{n}", "3")
  970.     GenerateNextVectorTileCode MyString, sNameList
  971.  
  972.     MyString = ""
  973.     MyString = MyString + "##..##.. #.#.#.#. ######## ######## #######. ...##... ...#...#" + Chr$(13)
  974.     MyString = MyString + "##..##.. #.#.#.#. ######## ........ #.#.#.#. ...##... ...#...#" + Chr$(13)
  975.     MyString = MyString + "##..##.. #.#.#.#. ........ ######## #######. ...##... ...#...#" + Chr$(13)
  976.     MyString = MyString + "##..##.. #.#.#.#. ........ ........ #.#.#.#. ######## ########" + Chr$(13)
  977.     MyString = MyString + "##..##.. #.#.#.#. ######## ######## #######. ######## ...#...#" + Chr$(13)
  978.     MyString = MyString + "##..##.. #.#.#.#. ######## ........ #.#.#.#. ...##... ...#...#" + Chr$(13)
  979.     MyString = MyString + "##..##.. #.#.#.#. ........ ######## #######. ...##... ...#...#" + Chr$(13)
  980.     MyString = MyString + "##..##.. #.#.#.#. ........ ........ #.#.#.#. ...##... ########"
  981.     sNameList = "DrawJailLine8x8_VT_2,DrawJailLine8x8_VT_1," + _
  982.         "DrawJailLine8x8_HZ_2,DrawJailLine8x8_HZ_1," + _
  983.         "DrawJailLine8x8_Grid_1,DrawJailLine8x8_Grid_3," + _
  984.         "DrawJailLine8x8_Grid_2"
  985.     GenerateNextVectorTileCode MyString, sNameList
  986.     Print
  987.     Print "See console window for generated code."
  988.     Input "PRESS <ENTER> TO CONTINUE"; in$
  989. End Sub ' GenerateVectorTileCode
  990.  
  991. ' ################################################################################################################################################################
  992. ' END GENERATE LINE DRAWING SHAPE ROUTINES
  993. ' ################################################################################################################################################################
  994.  
  995. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  996. ' BEGIN GENERATED VECTOR TILE ROUTINES
  997. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  998.  
  999. ' /////////////////////////////////////////////////////////////////////////////
  1000. ' Draw this shape with Line commands:
  1001. ' ........
  1002. ' ...#....
  1003. ' ........
  1004. ' ...#....
  1005. ' ........
  1006. ' ...#....
  1007. ' ........
  1008. ' ...#....
  1009. Sub DrawHomeLine8x8_VT_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1010.     ' DRAW WITH HORIZONTAL LINES
  1011.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  1012.     Line (iX + 3, iY + 3)-(iX + 3, iY + 3), fgColor
  1013.     Line (iX + 3, iY + 5)-(iX + 3, iY + 5), fgColor
  1014.     Line (iX + 3, iY + 7)-(iX + 3, iY + 7), fgColor
  1015. End Sub ' DrawHomeLine8x8_VT_1
  1016.  
  1017. ' /////////////////////////////////////////////////////////////////////////////
  1018. ' Draw this shape with Line commands:
  1019. ' ........
  1020. ' ........
  1021. ' ........
  1022. ' #.#.#.#.
  1023. ' ........
  1024. ' ........
  1025. ' ........
  1026. ' ........
  1027. Sub DrawHomeLine8x8_HZ_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1028.     ' DRAW WITH HORIZONTAL LINES
  1029.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  1030.     Line (iX + 2, iY + 3)-(iX + 2, iY + 3), fgColor
  1031.     Line (iX + 4, iY + 3)-(iX + 4, iY + 3), fgColor
  1032.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  1033. End Sub ' DrawHomeLine8x8_HZ_1
  1034.  
  1035. ' /////////////////////////////////////////////////////////////////////////////
  1036. ' Draw this shape with Line commands:
  1037. ' ........
  1038. ' ........
  1039. ' ........
  1040. ' ...##.#.
  1041. ' ...#....
  1042. ' ........
  1043. ' ...#....
  1044. ' ........
  1045. Sub DrawHomeLine8x8_NW_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1046.     ' DRAW WITH HORIZONTAL LINES
  1047.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  1048.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  1049.     Line (iX + 3, iY + 4)-(iX + 3, iY + 4), fgColor
  1050.     Line (iX + 3, iY + 6)-(iX + 3, iY + 6), fgColor
  1051. End Sub ' DrawHomeLine8x8_NW_1
  1052.  
  1053. ' /////////////////////////////////////////////////////////////////////////////
  1054. ' Draw this shape with Line commands:
  1055. ' ........
  1056. ' ........
  1057. ' ........
  1058. ' #.##....
  1059. ' ...#....
  1060. ' ........
  1061. ' ...#....
  1062. ' ........
  1063. Sub DrawHomeLine8x8_NE_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1064.     ' DRAW WITH HORIZONTAL LINES
  1065.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  1066.     Line (iX + 2, iY + 3)-(iX + 3, iY + 3), fgColor
  1067.     Line (iX + 3, iY + 4)-(iX + 3, iY + 4), fgColor
  1068.     Line (iX + 3, iY + 6)-(iX + 3, iY + 6), fgColor
  1069. End Sub ' DrawHomeLine8x8_NE_1
  1070.  
  1071. ' /////////////////////////////////////////////////////////////////////////////
  1072. ' Draw this shape with Line commands:
  1073. ' ........
  1074. ' ...#....
  1075. ' ........
  1076. ' ...##.#.
  1077. ' ........
  1078. ' ........
  1079. ' ........
  1080. ' ........
  1081. Sub DrawHomeLine8x8_SW_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1082.     ' DRAW WITH HORIZONTAL LINES
  1083.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  1084.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  1085.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  1086. End Sub ' DrawHomeLine8x8_SW_1
  1087.  
  1088. ' /////////////////////////////////////////////////////////////////////////////
  1089. ' Draw this shape with Line commands:
  1090. ' ........
  1091. ' ...#....
  1092. ' ........
  1093. ' #.##....
  1094. ' ........
  1095. ' ........
  1096. ' ........
  1097. ' ........
  1098. Sub DrawHomeLine8x8_SE_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1099.     ' DRAW WITH HORIZONTAL LINES
  1100.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  1101.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  1102.     Line (iX + 2, iY + 3)-(iX + 3, iY + 3), fgColor
  1103. End Sub ' DrawHomeLine8x8_SE_1
  1104.  
  1105. ' /////////////////////////////////////////////////////////////////////////////
  1106. ' Draw this shape with Line commands:
  1107. ' ........
  1108. ' ...##...
  1109. ' ........
  1110. ' ...##...
  1111. ' ........
  1112. ' ...##...
  1113. ' ........
  1114. ' ...##...
  1115. Sub DrawHomeLine8x8_VT_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1116.     ' DRAW WITH HORIZONTAL LINES
  1117.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  1118.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  1119.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  1120.     Line (iX + 3, iY + 7)-(iX + 4, iY + 7), fgColor
  1121. End Sub ' DrawHomeLine8x8_VT_2
  1122.  
  1123. ' /////////////////////////////////////////////////////////////////////////////
  1124. ' Draw this shape with Line commands:
  1125. ' ........
  1126. ' ........
  1127. ' ........
  1128. ' #.#.#.#.
  1129. ' #.#.#.#.
  1130. ' ........
  1131. ' ........
  1132. ' ........
  1133. Sub DrawHomeLine8x8_HZ_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1134.     ' DRAW WITH VERTICAL LINES
  1135.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  1136.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  1137.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  1138.     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  1139. End Sub ' DrawHomeLine8x8_HZ_2
  1140.  
  1141. ' /////////////////////////////////////////////////////////////////////////////
  1142. ' Draw this shape with Line commands:
  1143. ' ........
  1144. ' ........
  1145. ' ........
  1146. ' ...##.#.
  1147. ' ...##.#.
  1148. ' ........
  1149. ' ...##...
  1150. ' ........
  1151. Sub DrawHomeLine8x8_NW_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1152.     ' DRAW WITH HORIZONTAL LINES
  1153.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  1154.     Line (iX + 3, iY + 4)-(iX + 4, iY + 4), fgColor
  1155.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  1156.  
  1157.     ' DRAW WITH VERTICAL LINES
  1158.     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  1159. End Sub ' DrawHomeLine8x8_NW_2
  1160.  
  1161. ' /////////////////////////////////////////////////////////////////////////////
  1162. ' Draw this shape with Line commands:
  1163. ' ........
  1164. ' ........
  1165. ' ........
  1166. ' #.#.#...
  1167. ' #.#.#...
  1168. ' ........
  1169. ' ...##...
  1170. ' ........
  1171. Sub DrawHomeLine8x8_NE_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1172.     ' DRAW WITH VERTICAL LINES
  1173.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  1174.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  1175.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  1176.  
  1177.     ' DRAW WITH HORIZONTAL LINES
  1178.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  1179. End Sub ' DrawHomeLine8x8_NE_2
  1180.  
  1181. ' /////////////////////////////////////////////////////////////////////////////
  1182. ' Draw this shape with Line commands:
  1183. ' ........
  1184. ' ...##...
  1185. ' ........
  1186. ' ...##.#.
  1187. ' ...##.#.
  1188. ' ........
  1189. ' ........
  1190. ' ........
  1191. Sub DrawHomeLine8x8_SW_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1192.     ' DRAW WITH HORIZONTAL LINES
  1193.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  1194.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  1195.     Line (iX + 3, iY + 4)-(iX + 4, iY + 4), fgColor
  1196.  
  1197.     ' DRAW WITH VERTICAL LINES
  1198.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  1199. End Sub ' DrawHomeLine8x8_SW_2
  1200.  
  1201. ' /////////////////////////////////////////////////////////////////////////////
  1202. ' Draw this shape with Line commands:
  1203. ' ........
  1204. ' ...##...
  1205. ' ........
  1206. ' #.#.#...
  1207. ' #.#.#...
  1208. ' ........
  1209. ' ........
  1210. ' ........
  1211. Sub DrawHomeLine8x8_SE_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1212.     ' DRAW WITH HORIZONTAL LINES
  1213.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  1214.  
  1215.     ' DRAW WITH VERTICAL LINES
  1216.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  1217.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  1218.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  1219.  
  1220. End Sub ' DrawHomeLine8x8_SE_2
  1221.  
  1222. ' /////////////////////////////////////////////////////////////////////////////
  1223. ' Draw this shape with Line commands:
  1224. ' ........
  1225. ' ...##...
  1226. ' ...##...
  1227. ' ........
  1228. ' ........
  1229. ' ...##...
  1230. ' ...##...
  1231. ' ........
  1232. Sub DrawHomeLine8x8_VT_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1233.     ' DRAW WITH HORIZONTAL LINES
  1234.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  1235.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  1236.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  1237.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  1238. End Sub ' DrawHomeLine8x8_VT_3
  1239.  
  1240. ' /////////////////////////////////////////////////////////////////////////////
  1241. ' Draw this shape with Line commands:
  1242. ' ........
  1243. ' ........
  1244. ' ........
  1245. ' .##..##.
  1246. ' .##..##.
  1247. ' ........
  1248. ' ........
  1249. ' ........
  1250. Sub DrawHomeLine8x8_HZ_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1251.     ' DRAW WITH HORIZONTAL LINES
  1252.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  1253.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  1254.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  1255.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  1256. End Sub ' DrawHomeLine8x8_HZ_3
  1257.  
  1258. ' /////////////////////////////////////////////////////////////////////////////
  1259. ' Draw this shape with Line commands:
  1260. ' ........
  1261. ' ........
  1262. ' ........
  1263. ' .....##.
  1264. ' .....##.
  1265. ' ...##...
  1266. ' ...##...
  1267. ' ........
  1268. Sub DrawHomeLine8x8_NW_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1269.     ' DRAW WITH HORIZONTAL LINES
  1270.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  1271.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  1272.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  1273.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  1274. End Sub ' DrawHomeLine8x8_NW_3
  1275.  
  1276. ' /////////////////////////////////////////////////////////////////////////////
  1277. ' Draw this shape with Line commands:
  1278. ' ........
  1279. ' ........
  1280. ' ........
  1281. ' .##.....
  1282. ' .##.....
  1283. ' ...##...
  1284. ' ...##...
  1285. ' ........
  1286. Sub DrawHomeLine8x8_NE_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1287.     ' DRAW WITH HORIZONTAL LINES
  1288.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  1289.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  1290.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  1291.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  1292. End Sub ' DrawHomeLine8x8_NE_3
  1293.  
  1294. ' /////////////////////////////////////////////////////////////////////////////
  1295. ' Draw this shape with Line commands:
  1296. ' ........
  1297. ' ...##...
  1298. ' ...##...
  1299. ' .....##.
  1300. ' .....##.
  1301. ' ........
  1302. ' ........
  1303. ' ........
  1304. Sub DrawHomeLine8x8_SW_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1305.     ' DRAW WITH HORIZONTAL LINES
  1306.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  1307.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  1308.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  1309.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  1310. End Sub ' DrawHomeLine8x8_SW_3
  1311.  
  1312. ' /////////////////////////////////////////////////////////////////////////////
  1313. ' Draw this shape with Line commands:
  1314. ' ........
  1315. ' ...##...
  1316. ' ...##...
  1317. ' .##.....
  1318. ' .##.....
  1319. ' ........
  1320. ' ........
  1321. ' ........
  1322. Sub DrawHomeLine8x8_SE_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1323.     ' DRAW WITH HORIZONTAL LINES
  1324.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  1325.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  1326.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  1327.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  1328. End Sub ' DrawHomeLine8x8_SE_3
  1329.  
  1330. ' /////////////////////////////////////////////////////////////////////////////
  1331. ' Draw this shape with Line commands:
  1332. ' ##..##..
  1333. ' ##..##..
  1334. ' ##..##..
  1335. ' ##..##..
  1336. ' ##..##..
  1337. ' ##..##..
  1338. ' ##..##..
  1339. ' ##..##..
  1340. Sub DrawJailLine8x8_VT_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1341.     ' DRAW WITH VERTICAL LINES
  1342.     Line (iX, iY)-(iX, iY + 7), fgColor
  1343.     Line (iX + 1, iY)-(iX + 1, iY + 7), fgColor
  1344.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  1345.     Line (iX + 5, iY)-(iX + 5, iY + 7), fgColor
  1346. End Sub ' DrawJailLine8x8_VT_2
  1347.  
  1348. ' /////////////////////////////////////////////////////////////////////////////
  1349. ' Draw this shape with Line commands:
  1350. ' #.#.#.#.
  1351. ' #.#.#.#.
  1352. ' #.#.#.#.
  1353. ' #.#.#.#.
  1354. ' #.#.#.#.
  1355. ' #.#.#.#.
  1356. ' #.#.#.#.
  1357. ' #.#.#.#.
  1358. Sub DrawJailLine8x8_VT_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1359.     ' DRAW WITH VERTICAL LINES
  1360.     Line (iX, iY)-(iX, iY + 7), fgColor
  1361.     Line (iX + 2, iY)-(iX + 2, iY + 7), fgColor
  1362.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  1363.     Line (iX + 6, iY)-(iX + 6, iY + 7), fgColor
  1364. End Sub ' DrawJailLine8x8_VT_1
  1365.  
  1366. ' /////////////////////////////////////////////////////////////////////////////
  1367. ' Draw this shape with Line commands:
  1368. ' ########
  1369. ' ########
  1370. ' ........
  1371. ' ........
  1372. ' ########
  1373. ' ########
  1374. ' ........
  1375. ' ........
  1376. Sub DrawJailLine8x8_HZ_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1377.     ' DRAW WITH HORIZONTAL LINES
  1378.     Line (iX, iY)-(iX + 7, iY), fgColor
  1379.     Line (iX, iY + 1)-(iX + 7, iY + 1), fgColor
  1380.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  1381.     Line (iX, iY + 5)-(iX + 7, iY + 5), fgColor
  1382. End Sub ' DrawJailLine8x8_HZ_2
  1383.  
  1384. ' /////////////////////////////////////////////////////////////////////////////
  1385. ' Draw this shape with Line commands:
  1386. ' ########
  1387. ' ........
  1388. ' ########
  1389. ' ........
  1390. ' ########
  1391. ' ........
  1392. ' ########
  1393. ' ........
  1394. Sub DrawJailLine8x8_HZ_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1395.     ' DRAW WITH HORIZONTAL LINES
  1396.     Line (iX, iY)-(iX + 7, iY), fgColor
  1397.     Line (iX, iY + 2)-(iX + 7, iY + 2), fgColor
  1398.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  1399.     Line (iX, iY + 6)-(iX + 7, iY + 6), fgColor
  1400. End Sub ' DrawJailLine8x8_HZ_1
  1401.  
  1402. ' /////////////////////////////////////////////////////////////////////////////
  1403. ' Draw this shape with Line commands:
  1404. ' #######.
  1405. ' #.#.#.#.
  1406. ' #######.
  1407. ' #.#.#.#.
  1408. ' #######.
  1409. ' #.#.#.#.
  1410. ' #######.
  1411. ' #.#.#.#.
  1412. Sub DrawJailLine8x8_Grid_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1413.     ' DRAW WITH VERTICAL LINES
  1414.     Line (iX, iY)-(iX, iY + 7), fgColor
  1415.     Line (iX + 2, iY)-(iX + 2, iY + 7), fgColor
  1416.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  1417.     Line (iX + 6, iY)-(iX + 6, iY + 7), fgColor
  1418.  
  1419.     ' DRAW WITH HORIZONTAL LINES
  1420.     Line (iX, iY)-(iX + 7, iY), fgColor
  1421.     Line (iX, iY + 2)-(iX + 7, iY + 2), fgColor
  1422.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  1423.     Line (iX, iY + 6)-(iX + 7, iY + 6), fgColor
  1424. End Sub ' DrawJailLine8x8_Grid_1
  1425.  
  1426. ' /////////////////////////////////////////////////////////////////////////////
  1427. ' Draw this shape with Line commands:
  1428. ' ...#...#
  1429. ' ...#...#
  1430. ' ...#...#
  1431. ' ########
  1432. ' ...#...#
  1433. ' ...#...#
  1434. ' ...#...#
  1435. ' ########
  1436. Sub DrawJailLine8x8_Grid_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1437.     ' DRAW WITH VERTICAL LINES
  1438.     Line (iX + 3, iY)-(iX + 3, iY + 7), fgColor
  1439.     Line (iX + 7, iY)-(iX + 7, iY + 7), fgColor
  1440.     ' DRAW WITH HORIZONTAL LINES
  1441.     Line (iX, iY + 3)-(iX + 7, iY + 3), fgColor
  1442.     Line (iX, iY + 7)-(iX + 7, iY + 7), fgColor
  1443. End Sub ' DrawJailLine8x8_Grid_2
  1444.  
  1445. ' /////////////////////////////////////////////////////////////////////////////
  1446. ' Draw this shape with Line commands:
  1447. ' ...##...
  1448. ' ...##...
  1449. ' ...##...
  1450. ' ########
  1451. ' ########
  1452. ' ...##...
  1453. ' ...##...
  1454. ' ...##...
  1455. Sub DrawJailLine8x8_Grid_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1456.     ' DRAW WITH VERTICAL LINES
  1457.     Line (iX + 3, iY)-(iX + 3, iY + 7), fgColor
  1458.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  1459.     ' DRAW WITH HORIZONTAL LINES
  1460.     Line (iX, iY + 3)-(iX + 7, iY + 3), fgColor
  1461.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  1462. End Sub ' DrawJailLine8x8_Grid_3
  1463.  
  1464. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1465. ' END GENERATED VECTOR TILE ROUTINES
  1466. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1467.  
  1468. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1469. ' BEGIN MANUALLY CREATED VECTOR TILE ROUTINES
  1470. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1471.  
  1472. ' /////////////////////////////////////////////////////////////////////////////
  1473. ' Fastest!
  1474.  
  1475. Sub DrawUpArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1476.     Dim iStartX As Integer: iStartX = iX + 3
  1477.     Line (iStartX, iY)-(iStartX, iY + 7), fgColor
  1478.     Line (iStartX, iY)-(iX, iY + 3), fgColor
  1479.     Line (iStartX, iY)-(iStartX + 3, iY + 3), fgColor
  1480. End Sub ' DrawUpArrowLine_8x8
  1481.  
  1482. ' /////////////////////////////////////////////////////////////////////////////
  1483. ' Fastest!
  1484.  
  1485. Sub DrawDownArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1486.     Dim iStartX As Integer: iStartX = iX + 3
  1487.     Line (iStartX, iY)-(iStartX, iY + 7), fgColor
  1488.     Line (iStartX, iY + 7)-(iX, iY + 4), fgColor
  1489.     Line (iStartX, iY + 7)-(iStartX + 3, iY + 4), fgColor
  1490. End Sub ' DrawDownArrowLine_8x8
  1491.  
  1492. ' /////////////////////////////////////////////////////////////////////////////
  1493. ' Fastest!
  1494.  
  1495. Sub DrawLeftArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1496.     Dim iStartY As Integer: iStartY = iY + 3
  1497.     Line (iX, iStartY)-(iX + 7, iStartY), fgColor
  1498.     Line (iX, iStartY)-(iX + 3, iY), fgColor
  1499.     Line (iX, iStartY)-(iX + 3, iStartY + 3), fgColor
  1500. End Sub ' DrawLeftArrowLine_8x8
  1501.  
  1502. ' /////////////////////////////////////////////////////////////////////////////
  1503. ' Fastest!
  1504.  
  1505. Sub DrawRightArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1506.     Dim iStartY As Integer: iStartY = iY + 3
  1507.     Line (iX, iStartY)-(iX + 7, iStartY), fgColor
  1508.     Line (iX + 7, iStartY)-(iX + 4, iY), fgColor
  1509.     Line (iX + 7, iStartY)-(iX + 4, iStartY + 3), fgColor
  1510. End Sub ' DrawRightArrowLine_8x8
  1511.  
  1512. ' /////////////////////////////////////////////////////////////////////////////
  1513. ' This uses PSET to draw the arrow pixel-by-pixel
  1514. ' PSET = second fastest method after Line.
  1515.  
  1516. ' PSET (X, Y), Color
  1517. ' draw will start where pset leaves off
  1518.  
  1519. Sub DrawLeftArrowPset_8x8 (iX As Long, iY As Long, fgColor As _Unsigned Long)
  1520.     Dim iLoopX As Integer
  1521.     Dim iLoopY As Integer
  1522.     For iLoopX = iX To iX + 7: PSet (iLoopX, iY), fgColor: Next iLoopX
  1523.     PSet (iX + 1, iY - 1), fgColor
  1524.     PSet (iX + 2, iY - 2), fgColor
  1525.     PSet (iX + 3, iY - 3), fgColor
  1526.     PSet (iX + 1, iY + 1), fgColor
  1527.     PSet (iX + 2, iY + 2), fgColor
  1528.     PSet (iX + 3, iY + 3), fgColor
  1529. End Sub ' DrawLeftArrowPset_8x8
  1530.  
  1531. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1532. ' END MANUALLY CREATED VECTOR TILE ROUTINES
  1533. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1534.  
  1535. ' ################################################################################################################################################################
  1536. ' END MISC GRAPHICS ROUTINES
  1537. ' ################################################################################################################################################################
  1538.  
  1539. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1540. ' BEGIN STRING TO ARRAY FUNCTIONS
  1541. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1542.  
  1543. ' /////////////////////////////////////////////////////////////////////////////
  1544.  
  1545. ' Usage:
  1546. ' Dim StringArray(1 To 48, 1 To 128) As String
  1547. ' StringToArray StringArray(), GetMap$
  1548.  
  1549. ' version 2 with indexed array(row, columm)
  1550.  
  1551. Sub StringToArray (MyArray() As String, MyString As String)
  1552.     Dim sDelim As String
  1553.     ReDim arrLines(0) As String
  1554.     Dim iRow As Integer
  1555.     Dim iCol As Integer
  1556.     Dim sChar As String
  1557.     Dim iDim1 As Integer
  1558.     Dim iDim2 As Integer
  1559.     Dim iIndex1 As Integer
  1560.     Dim iIndex2 As Integer
  1561.  
  1562.     iDim1 = LBound(MyArray, 1)
  1563.     iDim2 = LBound(MyArray, 2)
  1564.     sDelim = Chr$(13)
  1565.     split MyString, sDelim, arrLines()
  1566.     For iRow = LBound(arrLines) To UBound(arrLines)
  1567.         If iRow <= UBound(MyArray, 1) Then
  1568.             For iCol = 1 To Len(arrLines(iRow))
  1569.                 If iCol <= UBound(MyArray, 2) Then
  1570.                     sChar = Mid$(arrLines(iRow), iCol, 1)
  1571.  
  1572.                     If Len(sChar) > 1 Then
  1573.                         sChar = Left$(sChar, 1)
  1574.                     Else
  1575.                         If Len(sChar) = 0 Then
  1576.                             sChar = "."
  1577.                         End If
  1578.                     End If
  1579.  
  1580.                     iIndex1 = iRow + iDim1
  1581.                     iIndex2 = (iCol - 1) + iDim2
  1582.                     MyArray(iIndex1, iIndex2) = sChar
  1583.                     'DebugPrint "MyArray(" + cstr$(iIndex1) + ", " + cstr$(iIndex2) + " = " + chr$(34) + sChar + chr$(34)
  1584.                 Else
  1585.                     ' Exit if out of bounds
  1586.                     Exit For
  1587.                 End If
  1588.             Next iCol
  1589.         Else
  1590.             ' Exit if out of bounds
  1591.             Exit For
  1592.         End If
  1593.     Next iRow
  1594. End Sub ' StringToArray
  1595.  
  1596. ' /////////////////////////////////////////////////////////////////////////////
  1597.  
  1598. Function ArrayToString$ (MyArray( 1 To 32 , 1 To 32) As String)
  1599.     Dim MyString As String
  1600.     Dim iY As Integer
  1601.     Dim iX As Integer
  1602.     Dim sLine As String
  1603.     MyString = ""
  1604.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  1605.         sLine = ""
  1606.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  1607.             sLine = sLine + MyArray(iY, iX)
  1608.         Next iX
  1609.         MyString = MyString + sLine + Chr$(13)
  1610.     Next iY
  1611.     ArrayToString$ = MyString
  1612. End Function ' ArrayToString$
  1613.  
  1614. ' /////////////////////////////////////////////////////////////////////////////
  1615.  
  1616. Function ArrayToStringTest$ (MyArray() As String)
  1617.     Dim MyString As String
  1618.     Dim iY As Integer
  1619.     Dim iX As Integer
  1620.     Dim sLine As String
  1621.     MyString = ""
  1622.  
  1623.     MyString = MyString + "           11111111112222222222333" + Chr$(13)
  1624.     MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  1625.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  1626.         sLine = ""
  1627.         sLine = sLine + Right$("  " + cstr$(iY), 2)
  1628.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  1629.             sLine = sLine + MyArray(iY, iX)
  1630.         Next iX
  1631.         sLine = sLine + Right$("  " + cstr$(iY), 2)
  1632.         MyString = MyString + sLine + Chr$(13)
  1633.     Next iY
  1634.     MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  1635.     MyString = MyString + "           11111111112222222222333" + Chr$(13)
  1636.     ArrayToStringTest$ = MyString
  1637. End Function ' ArrayToStringTest$
  1638.  
  1639. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1640. ' END STRING TO ARRAY FUNCTIONS
  1641. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1642.  
  1643. ' ################################################################################################################################################################
  1644. ' BEGIN TILE UTILITIES
  1645. ' ################################################################################################################################################################
  1646.  
  1647. ' /////////////////////////////////////////////////////////////////////////////
  1648. ' Precalculates the tile locations ahead of time to save time copying them
  1649. ' to the screen.
  1650.  
  1651. ' Requires the following types be declared:
  1652. '
  1653. '     Type TileSheetMapType ' UDT FOR PRECALCULATED TILESHEET
  1654. '         xStart As Integer
  1655. '         xEnd As Integer
  1656. '         yStart As Integer
  1657. '         yEnd As Integer
  1658. '     End Type
  1659. '     Type TileMapType ' UDT FOR PRECALCULATED TILE MAP
  1660. '         xPos As Integer
  1661. '         yPos As Integer
  1662. '     End Type
  1663. '
  1664. ' EXAMPLE USAGE:
  1665. '
  1666. '     Dim TileCount%
  1667. '     Dim TilesheetCols%
  1668. '     Dim TilesheetRows%
  1669. '     Dim tileHeightPx%
  1670. '     Dim tileWidthPx%
  1671. '     Dim xOffset%
  1672. '     Dim yOffset%
  1673. '     Dim numTilesX%
  1674. '     Dim numTilesY%
  1675. '     REDIM arrTileSheetMap(255) AS TileSheetMapType
  1676. '     REDIM arrTileMap(20, 20) AS TileMapType
  1677. '     TileCount% = 256 ' TOTAL # OF TILES
  1678. '     TilesheetCols% = 16 ' # OF COLUMNS ON SOURCE TILE SHEET
  1679. '     TilesheetRows% = 16 ' # OF ROWS    ON SOURCE TILE SHEET
  1680. '     tileHeightPx% = 32 ' TILE HEIGHT
  1681. '     tileWidthPx% = 32 ' TILE WIDTH
  1682. '     xOffset% = 0 ' SCREEN OFFSET X
  1683. '     yOffset% = 64 ' SCREEN OFFSET Y
  1684. '     numTilesX% = 20 ' HOW MANY TILES ACROSS (ON DESTINATION)
  1685. '     numTilesY% = 20 ' HOW MANY TILES UP/DOWN (ON DESTINATION)
  1686. '     ComputeTileLocations arrTileSheetMap(), arrTileMap(), TileCount%, _
  1687. '         TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, _
  1688. '         xOffset%, yOffset%, numTilesX%, numTilesY%
  1689.  
  1690. ' TODO: this can be simplified & optimized:
  1691. '       - we don't need x/y offsets
  1692. '       - tile height/width can be hardcoded
  1693. '       - etc.
  1694.  
  1695. Sub ComputeTileLocations (arrTileSheetMap() As TileSheetMapType, arrTileMap() As TileMapType, TileCount%, TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, xOffset%, yOffset%, numTilesX%, numTilesY%)
  1696.     Dim TileNum%
  1697.     Dim sc%
  1698.     Dim sr%
  1699.     Dim sx1%
  1700.     Dim sx2%
  1701.     Dim sy1%
  1702.     Dim sy2%
  1703.  
  1704.     Dim dx%
  1705.     Dim dy%
  1706.     Dim xDest%
  1707.     Dim yDest%
  1708.  
  1709.     ' -----------------------------------------------------------------------------
  1710.     ' CALCULATE TILE SHEET COORDINATES FOR TILES 0-255
  1711.  
  1712.     For TileNum% = 0 To (TileCount% - 1)
  1713.  
  1714.         ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1715.         sc% = TileNum% Mod TilesheetCols%
  1716.         sr% = TileNum% \ TilesheetRows%
  1717.  
  1718.         'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  1719.  
  1720.         ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1721.         'sx1% = sc% * tw%
  1722.         sx1% = sc% * tileWidthPx%
  1723.  
  1724.         ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  1725.         'sy1% = sr% * tw%
  1726.         sy1% = sr% * tileHeightPx%
  1727.  
  1728.         ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1729.         'sx2% = sx1% + (tw% - 1)
  1730.         sx2% = sx1% + (tileWidthPx% - 1)
  1731.  
  1732.         ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1733.         'sy2% = sy1% + (tw% - 1)
  1734.         sy2% = sy1% + (tileHeightPx% - 1)
  1735.  
  1736.         ' SAVE THE COORDINATES FOR TileNum% IN THE ARRAY
  1737.         arrTileSheetMap(TileNum%).xStart = sx1%
  1738.         arrTileSheetMap(TileNum%).xEnd = sx2%
  1739.         arrTileSheetMap(TileNum%).yStart = sy1%
  1740.         arrTileSheetMap(TileNum%).yEnd = sy2%
  1741.  
  1742.     Next TileNum%
  1743.  
  1744.     ' -----------------------------------------------------------------------------
  1745.     ' CALCULATE SCREEN COORDINATES FOR TILES
  1746.  
  1747.     For dx% = 0 To (numTilesX% - 1)
  1748.         For dy% = 0 To (numTilesY% - 1)
  1749.  
  1750.             ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1751.             'xDest% = dx% * tw%
  1752.             xDest% = (dx% * tileWidthPx%) + xOffset%
  1753.  
  1754.             ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1755.             'yDest% = (dy% * tw%) + 64
  1756.             yDest% = (dy% * tileHeightPx%) + yOffset%
  1757.  
  1758.             'Print "Tile#" + cstr$(TileNum%) + " at r" + cstr$(sr%) + "c" + cstr$(sc%) + " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  1759.  
  1760.             ' SAVE THE SCREEN PIXEL COORDINATES FOR dx%, dy% IN THE ARRAY
  1761.             ' WHERE dx% and dy% ARE 1-BASED
  1762.             arrTileMap(dx% + 1, dy% + 1).xPos = xDest%
  1763.             arrTileMap(dx% + 1, dy% + 1).yPos = yDest%
  1764.  
  1765.         Next dy%
  1766.     Next dx%
  1767.  
  1768. End Sub ' ComputeTileLocations
  1769.  
  1770. ' /////////////////////////////////////////////////////////////////////////////
  1771. ' Latest version with NOVARSEG's changes.
  1772.  
  1773. ' Based on code from:
  1774.  
  1775. ' Image color swap?
  1776. ' https://www.qb64.org/forum/index.php?topic=2312.0
  1777.  
  1778. ' Like Function swapcolor& except returns new image in a parameter
  1779. ' in case being a function causes a memory leak?
  1780.  
  1781. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  1782.     Dim m As _MEM
  1783.     Dim a As _Offset
  1784.     a = 0
  1785.     imgNew& = _CopyImage(imgOriginal&, 32)
  1786.     m = _MemImage(imgNew&)
  1787.     Do Until a = m.SIZE - 4
  1788.         a = a + 4
  1789.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  1790.         If c = oldcolor~& Then
  1791.             _MemPut m, m.OFFSET + a, newcolor~&
  1792.         End If
  1793.     Loop
  1794.     _MemFree m
  1795. End Sub ' DoColorSwap&
  1796.  
  1797. ' ################################################################################################################################################################
  1798. ' END TILE UTILITIES
  1799. ' ################################################################################################################################################################
  1800.  
  1801. ' ################################################################################################################################################################
  1802. ' BEGIN HELPER ROUTINES
  1803. ' ################################################################################################################################################################
  1804.  
  1805. ' /////////////////////////////////////////////////////////////////////////////
  1806. ' div: int1% = num1% \ den1%
  1807. ' mod: rem1% = num1% MOD den1%
  1808.  
  1809. Function NextColorIndex% (iX As Integer, iY As Integer)
  1810.     Dim iIndex As Integer
  1811.     Dim iAdd As Integer
  1812.     iOut = (iX Mod 4)
  1813.     iAdd = (iY Mod 4)
  1814.     NextColorIndex% = iOut + iAdd + 1
  1815. End Function ' NextColorIndex%
  1816.  
  1817. ' /////////////////////////////////////////////////////////////////////////////
  1818. ' Pauses for iDS deciseconds (iDS * 100 ms)
  1819.  
  1820. Sub PauseDecisecond (iDS As Integer)
  1821.     Dim iCount As Integer
  1822.     iCount = 0
  1823.     Do
  1824.         iCount = iCount + 1
  1825.         _Limit 10 ' run 10x every second
  1826.     Loop Until iCount = iDS
  1827. End Sub ' PauseDecisecond
  1828.  
  1829. ' /////////////////////////////////////////////////////////////////////////////
  1830. ' Returns TRUE if point (x1%, y1%) is adjacent to point (x2%, y2%)
  1831.  
  1832. Function PointsAreAdjacent% (x1%, y1%, x2%, y2%)
  1833.     Dim bResult%: bResult% = FALSE
  1834.  
  1835.     ' x or y can be the same, but not both
  1836.     If (x1% <> x2%) Or (y1% <> y2%) Then
  1837.         If (x1% = x2%) Or ((x1% = (x2% + 1)) Or (x2% = (x1% + 1))) Then
  1838.             If (y1% = y2%) Or ((y1% = (y2% + 1)) Or (y2% = (y1% + 1))) Then
  1839.                 bResult% = TRUE
  1840.             End If
  1841.         End If
  1842.     End If
  1843.     PointsAreAdjacent% = bResult%
  1844. End Function ' PointsAreAdjacent%
  1845.  
  1846. ' ################################################################################################################################################################
  1847. ' END HELPER ROUTINES
  1848. ' ################################################################################################################################################################
  1849.  
  1850. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1851. ' BEGIN COLOR ARRAY FUNCTIONS
  1852. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1853.  
  1854. ' /////////////////////////////////////////////////////////////////////////////
  1855.  
  1856. Sub AddColor (ColorValue As _Unsigned Long, ColorName As String, arrColor() As ColorType)
  1857.     ReDim _Preserve arrColor(0 To UBound(arrColor) + 1) As ColorType
  1858.     arrColor(UBound(arrColor)).name = ColorName
  1859.     arrColor(UBound(arrColor)).value = ColorValue
  1860. End Sub ' AddColor
  1861.  
  1862. ' /////////////////////////////////////////////////////////////////////////////
  1863.  
  1864. Sub AddColors (arrColor() As ColorType)
  1865.     AddColor cBlack, "cBlack", arrColor()
  1866.     AddColor cGray, "cGray", arrColor()
  1867.     AddColor cSilver, "cSilver", arrColor()
  1868.     AddColor cWhite, "cWhite", arrColor()
  1869.     AddColor cRed, "cRed", arrColor()
  1870.     AddColor cOrangeRed, "cOrangeRed", arrColor()
  1871.     AddColor cYellow, "cYellow", arrColor()
  1872.     AddColor cLime, "cLime", arrColor()
  1873.     AddColor cCyan, "cCyan", arrColor()
  1874.     AddColor cDodgerBlue, "cDodgerBlue", arrColor()
  1875.     AddColor cBlue, "cBlue", arrColor()
  1876.     AddColor cDeepPurple, "cDeepPurple", arrColor()
  1877.     AddColor cDarkGreen, "cDarkGreen", arrColor()
  1878.     AddColor cMagenta, "cMagenta", arrColor()
  1879.     AddColor cHotPink, "cHotPink", arrColor()
  1880.     AddColor cDarkBrown, "cDarkBrown", arrColor()
  1881.     AddColor cEmpty, "cEmpty", arrColor()
  1882. End Sub ' AddColors
  1883.  
  1884. ' /////////////////////////////////////////////////////////////////////////////
  1885.  
  1886. Sub AddGrayscaleColors (arrColor() As ColorType)
  1887.     'AddColor cBlack, "cBlack", arrColor()
  1888.     AddColor cDimGray, "cDimGray", arrColor()
  1889.     AddColor cGray, "cGray", arrColor()
  1890.     AddColor cDarkGray, "cDarkGray", arrColor()
  1891.     AddColor cSilver, "cSilver", arrColor()
  1892.     AddColor cLightGray, "cLightGray", arrColor()
  1893.     AddColor cWhite, "cGainsboro", arrColor()
  1894.     AddColor cWhite, "cWhiteSmoke", arrColor()
  1895.     AddColor cWhite, "cWhite", arrColor()
  1896. End Sub ' AddGrayscaleColors
  1897.  
  1898. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1899. ' END COLOR ARRAY FUNCTIONS
  1900. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1901.  
  1902. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1903. ' BEGIN COLOR FUNCTIONS
  1904. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1905.  
  1906. Function cRed~& ()
  1907.     cRed = _RGB32(255, 0, 0)
  1908.  
  1909. Function cOrangeRed~& ()
  1910.     cOrangeRed = _RGB32(255, 69, 0)
  1911. End Function ' cOrangeRed~&
  1912.  
  1913. Function cDarkOrange~& ()
  1914.     cDarkOrange = _RGB32(255, 140, 0)
  1915. End Function ' cDarkOrange~&
  1916.  
  1917. Function cOrange~& ()
  1918.     cOrange = _RGB32(255, 165, 0)
  1919. End Function ' cOrange~&
  1920.  
  1921. Function cGold~& ()
  1922.     cGold = _RGB32(255, 215, 0)
  1923. End Function ' cGold~&
  1924.  
  1925. Function cYellow~& ()
  1926.     cYellow = _RGB32(255, 255, 0)
  1927. End Function ' cYellow~&
  1928.  
  1929. 'Function cChartreuse~& ()
  1930. '    cChartreuse = _RGB32(127, 255, 0)
  1931. 'End Function ' cChartreuse~&
  1932.  
  1933. ' WE USE THIS CSS3 COLOR FOR INBETWEEN LIME AND YELLOW
  1934. ' INSTEAD OF Chartreuse WHICH IS NOT YELLOW ENOUGH
  1935. Function cOliveDrab1~& ()
  1936.     cOliveDrab1 = _RGB32(192, 255, 62)
  1937. End Function ' cOliveDrab1~&
  1938.  
  1939. Function cLime~& ()
  1940.     cLime = _RGB32(0, 255, 0)
  1941. End Function ' cLime~&
  1942.  
  1943. Function cMediumSpringGreen~& ()
  1944.     cMediumSpringGreen = _RGB32(0, 250, 154)
  1945. End Function ' cMediumSpringGreen~&
  1946.  
  1947. Function cCyan~& ()
  1948.     cCyan = _RGB32(0, 255, 255)
  1949. End Function ' cCyan~&
  1950.  
  1951. Function cDeepSkyBlue~& ()
  1952.     cDeepSkyBlue = _RGB32(0, 191, 255)
  1953. End Function ' cDeepSkyBlue~&
  1954.  
  1955. Function cDodgerBlue~& ()
  1956.     cDodgerBlue = _RGB32(30, 144, 255)
  1957. End Function ' cDodgerBlue~&
  1958.  
  1959. Function cSeaBlue~& ()
  1960.     cSeaBlue = _RGB32(0, 64, 255)
  1961. End Function ' cSeaBlue~&
  1962.  
  1963. Function cBlue~& ()
  1964.     cBlue = _RGB32(0, 0, 255)
  1965. End Function ' cBlue~&
  1966.  
  1967. Function cBluePurple~& ()
  1968.     cBluePurple = _RGB32(64, 0, 255)
  1969. End Function ' cBluePurple~&
  1970.  
  1971. Function cDeepPurple~& ()
  1972.     cDeepPurple = _RGB32(96, 0, 255)
  1973. End Function ' cDeepPurple~&
  1974.  
  1975. Function cPurple~& ()
  1976.     cPurple = _RGB32(128, 0, 255)
  1977. End Function ' cPurple~&
  1978.  
  1979. Function cPurpleRed~& ()
  1980.     cPurpleRed = _RGB32(128, 0, 192)
  1981. End Function ' cPurpleRed~&
  1982.  
  1983. Function cDarkRed~& ()
  1984.     cDarkRed = _RGB32(160, 0, 64)
  1985. End Function ' cDarkRed~&
  1986.  
  1987. Function cBrickRed~& ()
  1988.     cBrickRed = _RGB32(192, 0, 32)
  1989. End Function ' cBrickRed~&
  1990.  
  1991. Function cDarkGreen~& ()
  1992.     cDarkGreen = _RGB32(0, 100, 0)
  1993. End Function ' cDarkGreen~&
  1994.  
  1995. Function cGreen~& ()
  1996.     cGreen = _RGB32(0, 128, 0)
  1997. End Function ' cGreen~&
  1998.  
  1999. Function cOliveDrab~& ()
  2000.     cOliveDrab = _RGB32(107, 142, 35)
  2001. End Function ' cOliveDrab~&
  2002.  
  2003. Function cLightPink~& ()
  2004.     cLightPink = _RGB32(255, 182, 193)
  2005. End Function ' cLightPink~&
  2006.  
  2007. Function cHotPink~& ()
  2008.     cHotPink = _RGB32(255, 105, 180)
  2009. End Function ' cHotPink~&
  2010.  
  2011. Function cDeepPink~& ()
  2012.     cDeepPink = _RGB32(255, 20, 147)
  2013. End Function ' cDeepPink~&
  2014.  
  2015. Function cMagenta~& ()
  2016.     cMagenta = _RGB32(255, 0, 255)
  2017. End Function ' cMagenta~&
  2018.  
  2019. Function cBlack~& ()
  2020.     cBlack = _RGB32(0, 0, 0)
  2021. End Function ' cBlack~&
  2022.  
  2023. Function cDimGray~& ()
  2024.     cDimGray = _RGB32(105, 105, 105)
  2025. End Function ' cDimGray~&
  2026.  
  2027. Function cGray~& ()
  2028.     cGray = _RGB32(128, 128, 128)
  2029. End Function ' cGray~&
  2030.  
  2031. Function cDarkGray~& ()
  2032.     cDarkGray = _RGB32(169, 169, 169)
  2033. End Function ' cDarkGray~&
  2034.  
  2035. Function cSilver~& ()
  2036.     cSilver = _RGB32(192, 192, 192)
  2037. End Function ' cSilver~&
  2038.  
  2039. Function cLightGray~& ()
  2040.     cLightGray = _RGB32(211, 211, 211)
  2041. End Function ' cLightGray~&
  2042.  
  2043. Function cGainsboro~& ()
  2044.     cGainsboro = _RGB32(220, 220, 220)
  2045. End Function ' cGainsboro~&
  2046.  
  2047. Function cWhiteSmoke~& ()
  2048.     cWhiteSmoke = _RGB32(245, 245, 245)
  2049. End Function ' cWhiteSmoke~&
  2050.  
  2051. Function cWhite~& ()
  2052.     cWhite = _RGB32(255, 255, 255)
  2053.     'cWhite = _RGB32(254, 254, 254)
  2054. End Function ' cWhite~&
  2055.  
  2056. Function cDarkBrown~& ()
  2057.     cDarkBrown = _RGB32(128, 64, 0)
  2058. End Function ' cDarkBrown~&
  2059.  
  2060. Function cLightBrown~& ()
  2061.     cLightBrown = _RGB32(196, 96, 0)
  2062. End Function ' cLightBrown~&
  2063.  
  2064. Function cKhaki~& ()
  2065.     cKhaki = _RGB32(240, 230, 140)
  2066. End Function ' cKhaki~&
  2067.  
  2068. Function cEmpty~& ()
  2069.     'cEmpty~& = -1
  2070.     cEmpty = _RGB32(0, 0, 0, 0)
  2071. End Function ' cEmpty~&
  2072.  
  2073. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2074. ' END COLOR FUNCTIONS
  2075. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2076.  
  2077. ' ################################################################################################################################################################
  2078. ' BEGIN GENERAL PURPOSE ROUTINES
  2079. ' ################################################################################################################################################################
  2080.  
  2081. ' /////////////////////////////////////////////////////////////////////////////
  2082. ' Convert a value to string and trim it (because normal Str$ adds spaces)
  2083.  
  2084. Function cstr$ (myValue)
  2085.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  2086.     cstr$ = _Trim$(Str$(myValue))
  2087. End Function ' cstr$
  2088.  
  2089. ' /////////////////////////////////////////////////////////////////////////////
  2090. ' FROM: String Manipulation
  2091. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  2092. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  2093. '
  2094. 'SUMMARY:
  2095. '   Purpose:  A library of custom functions that transform strings.
  2096. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  2097. '   Platform: QB64 (www.qb64.org)
  2098. '   Revision: 1.6
  2099. '   Updated:  5/28/2012
  2100.  
  2101. 'SUMMARY:
  2102. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  2103. 'INPUT:
  2104. 'Text: The input string; the text that's being manipulated.
  2105. 'Find: The specified sub-string; the string sought within the [Text] string.
  2106. 'Add: The sub-string that's being added to the [Text] string.
  2107.  
  2108. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  2109.     ' VARIABLES:
  2110.     Dim Text2 As String
  2111.     Dim Find2 As String
  2112.     Dim Add2 As String
  2113.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  2114.     Dim strBefore As String ' The characters before the string to be replaced.
  2115.     Dim strAfter As String ' The characters after the string to be replaced.
  2116.  
  2117.     ' INITIALIZE:
  2118.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  2119.     Text2 = Text1
  2120.     Find2 = Find1
  2121.     Add2 = Add1
  2122.  
  2123.     lngLocation = InStr(1, Text2, Find2)
  2124.  
  2125.     ' PROCESSING:
  2126.     ' While [Find2] appears in [Text2]...
  2127.     While lngLocation
  2128.         ' Extract all Text2 before the [Find2] substring:
  2129.         strBefore = Left$(Text2, lngLocation - 1)
  2130.  
  2131.         ' Extract all text after the [Find2] substring:
  2132.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  2133.  
  2134.         ' Return the substring:
  2135.         Text2 = strBefore + Add2 + strAfter
  2136.  
  2137.         ' Locate the next instance of [Find2]:
  2138.         lngLocation = InStr(1, Text2, Find2)
  2139.  
  2140.         ' Next instance of [Find2]...
  2141.     Wend
  2142.  
  2143.     ' OUTPUT:
  2144.     Replace$ = Text2
  2145. End Function ' Replace$
  2146.  
  2147. ' /////////////////////////////////////////////////////////////////////////////
  2148. ' Split and join strings
  2149. ' https://www.qb64.org/forum/index.php?topic=1073.0
  2150. '
  2151. ' FROM luke, QB64 Developer
  2152. ' Date: February 15, 2019, 04:11:07 AM
  2153. '
  2154. ' Given a string of words separated by spaces (or any other character),
  2155. ' splits it into an array of the words. I've no doubt many people have
  2156. ' written a version of this over the years and no doubt there's a million
  2157. ' ways to do it, but I thought I'd put mine here so we have at least one
  2158. ' version. There's also a join function that does the opposite
  2159. ' array -> single string.
  2160. '
  2161. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  2162. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  2163.  
  2164. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  2165. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  2166. '
  2167. 'delimiter$ must be one character long.
  2168. 'result$() must have been REDIMmed previously.
  2169.  
  2170. ' Modified to handle multi-character delimiters
  2171.  
  2172. Sub split (in$, delimiter$, result$())
  2173.     Dim start As Integer
  2174.     Dim finish As Integer
  2175.     Dim iDelimLen As Integer
  2176.     ReDim result$(-1)
  2177.  
  2178.     iDelimLen = Len(delimiter$)
  2179.  
  2180.     start = 1
  2181.     Do
  2182.         'While Mid$(in$, start, 1) = delimiter$
  2183.         While Mid$(in$, start, iDelimLen) = delimiter$
  2184.             'start = start + 1
  2185.             start = start + iDelimLen
  2186.             If start > Len(in$) Then
  2187.                 Exit Sub
  2188.             End If
  2189.         Wend
  2190.         finish = InStr(start, in$, delimiter$)
  2191.         If finish = 0 Then
  2192.             finish = Len(in$) + 1
  2193.         End If
  2194.  
  2195.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  2196.  
  2197.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  2198.         start = finish + 1
  2199.     Loop While start <= Len(in$)
  2200. End Sub ' split
  2201.  
  2202. ' ################################################################################################################################################################
  2203. ' END GENERAL PURPOSE ROUTINES
  2204. ' ################################################################################################################################################################
  2205.  
  2206. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2207. ' BEGIN DEBUGGING ROUTINES #DEBUGGING
  2208. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2209.  
  2210. Sub DebugPrint (MyString As String)
  2211.     If m_bDebug = TRUE Then
  2212.         '_Echo MyString
  2213.  
  2214.         ReDim arrLines(-1) As String
  2215.         Dim iLoop As Integer
  2216.         split MyString, Chr$(13), arrLines()
  2217.         For iLoop = LBound(arrLines) To UBound(arrLines)
  2218.             _Echo arrLines(iLoop)
  2219.         Next iLoop
  2220.     End If
  2221. End Sub ' DebugPrint
  2222.  
  2223. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2224. ' END DEBUGGING ROUTINES @DEBUGGING
  2225. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2226.  
  2227.  
« Last Edit: February 26, 2022, 05:50:48 pm by madscijr »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #23 on: February 26, 2022, 02:08:07 pm »
Like Steve mentioned, it's just missing _AUTODISPALY.

    INPUT "PRESS <ENTER> TO CONTINUE"; in$
    _AUTODISPLAY
END SUB   

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #24 on: February 26, 2022, 06:29:54 pm »
Like Steve mentioned, it's just missing _AUTODISPALY.

    INPUT "PRESS <ENTER> TO CONTINUE"; in$
    _AUTODISPLAY
END SUB   

Pete

Yes that's right. Thanks.

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #25 on: March 01, 2022, 01:46:35 am »
One thing that would be *very* different with all hardware images vs what you're doing currently, is the fact that you have to remember:  Hardware images display once and then flush themselves from the GPU buffer. 
...
About 600 times in 3 seconds, for a total of 200 FPS on my machine.

The faux hardware screen array is ~ 3 times faster than this, without us trying to do anything to optimize performance any more than just sticking to the very basics.  ;)

More is required to work with it, but it does run faster once all is said and done, if that's the primary concern that your program is facing -- display speeds from character rendering.  :)

If only for my own intellectual curiosity, I was bitten by the desire to figure out some way to compute the minimum set of rectangles to draw with Line, that would yield a given 8x8 raster tile, and I think it's working.
I'm sure there are better ways to do it, but without all the output statements (DebugPrint which explain what's going on) it runs decently fast. Once the shapes for the tiles are calculated, you can use that to generate the routine to draw the tile, and it doesn't have to change unless the tileset changes.

Anyway, when i get more time I will try to do some apples to apples speed tests with this method versus the hardware screen method. Even if this way doesn't turn out to be the solution, it was still interesting & fun figuring out how to optimize drawing a tile with a minimum # of rectangles...

Here is the version without extra debugging out, it just analyzes some tiles and writes the minimum rectangles to draw each in the Console window:
Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2. ' VECTOR TILE DRAWING EXPERIMENT
  3.  
  4. ' GENERATES SEMI-OPTIMIZED VECTOR DRAWING ROUTINES USING Line COMMANDS
  5. ' FOR ONE OR MORE 8X8 RASTER TILES.
  6.  
  7. ' Eventually we would store a list of line coordinates for each tile
  8. ' in a 2D array or similar data structure, with just one general-
  9. ' purpose drawing routine that receives a list of (x1,y1,x2,y2)
  10. ' and a color and draws the shape with Line. The background would
  11. ' be transparent but if we want a background color can be specified
  12. ' and simply draw an 8x8 background color rectangle first and then
  13. ' draw the shape on top of that.
  14.  
  15. ' TODO: Optimize for each shape by determining how to draw it with the
  16. '       minimum number of line commands.
  17. '
  18. '       For example this:
  19. '           ' DRAW WITH HORIZONTAL LINES
  20. '           Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  21. '           Line (iX + 6, iY + 4)-(iX + 6, iY + 4), fgColor
  22. '       could be replaced with:
  23. '           ' DRAW WITH VERTICAL LINES
  24. '           Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  25. '
  26. '       Google "rectangular decomposition of binary images" and similar
  27. '       to find a better algorithm.
  28. '
  29. '       Brute force method would be to draw every size rectangle from 1x1
  30. '       up to 8x8 (which can themselves be precalculated) in every available
  31. '       location in the 8x8 grid (where no part of any rectangle falls off
  32. '       the grid), then try every combination of those rectangles to find
  33. '       combination where the the minimum number of rectangles cover all
  34. '       points.
  35. '
  36. '       Rather than compute this on the fly, we could precompute it and
  37. '       for each given tile, store the list of those rectangle coordinates
  38. '       (x1,y1,x2,y2) for drawing it indexed by the tile's definition in
  39. '       hexidecimal where 16-bits (0-F) defines the bit pattern for each
  40. '       row in the tile, therefore a tile's definition can be stored by
  41. '       8 characters (or less if we use base 64). Perhaps build a utility
  42. '       that will compute the optimal drawing pattern for every possible
  43. '       combination of an 8x8 grid, and index them all by the tile's 8-byte
  44. '       hexidecimal definition. It might take a while to run, but once it
  45. '       does, we will have a database of every possible tile's optimized
  46. '       drawing instructions that can be quickly looked up.
  47. '       Then we only pull out those definitions for the tiles that our
  48. '       given program uses, so the data would be relatively small
  49. '       (even smaller if we encode it with base-64).
  50.  
  51. ' ################################################################################################################################################################
  52.  
  53. ' ===============================================================================
  54. ' GLOBAL CONSTANTS
  55. ' ===============================================================================
  56. ' BOOLEAN VALUES
  57. Const FALSE = 0
  58. Const TRUE = Not FALSE
  59.  
  60. ' ===============================================================================
  61. ' USER DEFINED TYPES
  62. ' ===============================================================================
  63. ' UDT TO HOLD COORDINATES FOR DRAWING A RECTANGLE
  64. Type RectangleType
  65.     x1 As Integer ' start x
  66.     x2 As Integer ' end x
  67.     y1 As Integer ' start y
  68.     y2 As Integer ' end y
  69.     PixelCount As Integer
  70.     IsActive As Integer
  71. End Type ' RectangleType
  72.  
  73. Type DrawCompareType
  74.     IndexList As String
  75.     ShapeCount As Integer
  76.     PixelCount As Integer
  77.     IsActive As Integer
  78. End Type ' DrawCompareType
  79.  
  80. Type CoordinateType
  81.     x1 As Integer ' start x
  82.     x2 As Integer ' end x
  83.     y1 As Integer ' start y
  84.     y2 As Integer ' end y
  85. End Type ' CoordinateType
  86.  
  87. ' UDT TO HOLD COLOR CODE INFO
  88. Type ColorType
  89.     name As String
  90.     value As _Unsigned Long
  91. End Type ' ColorType
  92.  
  93. ' UDT FOR PRECALCULATED TILESHEET
  94. Type TileSheetMapType
  95.     xStart As Integer
  96.     xEnd As Integer
  97.     yStart As Integer
  98.     yEnd As Integer
  99.  
  100. ' UDT FOR PRECALCULATED TILE MAP
  101. Type TileMapType
  102.     xPos As Integer
  103.     yPos As Integer
  104.  
  105. ' ===============================================================================
  106. ' GLOBAL VARIABLES
  107. ' ===============================================================================
  108. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES CONSOLE WINDOW AND DebugPrint
  109. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  110. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  111. Dim Shared m_iCount As Long: m_iCount = 0
  112.  
  113. ' ===============================================================================
  114. ' LOCAL VARIABLES
  115. ' ===============================================================================
  116. Dim in$
  117.  
  118. ' ****************************************************************************************************************************************************************
  119. ' ACTIVATE DEBUGGING WINDOW
  120. If m_bDebug = TRUE Then
  121.     $Console
  122.     _Delay 4
  123.     _Console On
  124.     _Echo "Started " + m_ProgramName$
  125.     _Echo "Debugging on..."
  126. ' ****************************************************************************************************************************************************************
  127.  
  128. ' ===============================================================================
  129. ' START THE MAIN ROUTINE
  130. ' ===============================================================================
  131. main
  132.  
  133. ' ===============================================================================
  134. ' FINISH
  135. ' ===============================================================================
  136. Print m_ProgramName$ + " finished."
  137. Input "Press <ENTER> to continue", in$
  138. ' ****************************************************************************************************************************************************************
  139. ' DEACTIVATE DEBUGGING WINDOW
  140. If m_bDebug = TRUE Then
  141. ' ****************************************************************************************************************************************************************
  142. System ' return control to the operating system
  143.  
  144. ' ################################################################################################################################################################
  145. ' BEGIN MAIN MENU
  146. ' ################################################################################################################################################################
  147.  
  148. ' /////////////////////////////////////////////////////////////////////////////
  149.  
  150. Sub main
  151.     Dim RoutineName As String: RoutineName = "main"
  152.     Dim in$
  153.     Dim bFinished As Integer: bFinished = FALSE
  154.     Dim result$: result$ = ""
  155.     Do
  156.         Screen 0
  157.         Cls
  158.         Print m_ProgramName$
  159.         Print
  160.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  161.         Print "How about using the Line statement and draw tiles as vector images?"
  162.         Print
  163.         Print "This code finds the optimized minimum rectangles to draw a given"
  164.         Print "8x8 raster tile, for using Line."
  165.         Print "Press 6 to try it. Results appear in the Console window."
  166.         Print
  167.        
  168.         'I GUESS I BROKE OPTIONS 1,3,4,5 WHEN DISABLING DebugPrint, WHOOPS!
  169.         'Print "1) GenerateVectorTileCode"
  170.         'Print "2) DrawVectorTilesTest1"
  171.         'Print "3) GetAllPossibleShapesTest"
  172.         'Print "4) FindAllCombinationsTest1 - find all combinations of n numbers"
  173.         'Print "5) FindAllCombinationsTest2 - find all combinations of n numbers"
  174.         Print "6) FindOptimizedVectorTest - find minimum shapes to draw a tile"
  175.         Print
  176.         Print "Q) Exit program"
  177.         Do
  178.             in$ = InKey$
  179.             If UCase$(in$) = "Q" Then
  180.                 bFinished = TRUE: Exit Do
  181.                 'ElseIf UCase$(in$) = "1" Then
  182.                 '    GenerateVectorTileCode: Exit Do
  183.                 'ElseIf UCase$(in$) = "2" Then
  184.                 '    DrawVectorTilesTest1: Exit Do
  185.                 'ElseIf UCase$(in$) = "3" Then
  186.                 '    GetAllPossibleShapesTest: Exit Do
  187.                 'ElseIf UCase$(in$) = "4" Then
  188.                 '    FindAllCombinationsTest1: Exit Do
  189.                 'ElseIf UCase$(in$) = "5" Then
  190.                 '    FindAllCombinationsTest2: Exit Do
  191.             ElseIf UCase$(in$) = "6" Then
  192.                 FindOptimizedVectorTest: Exit Do
  193.             End If
  194.         Loop
  195.     Loop Until bFinished = TRUE
  196. End Sub ' main
  197.  
  198. ' ################################################################################################################################################################
  199. ' END MAIN MENU
  200. ' ################################################################################################################################################################
  201.  
  202. ' ################################################################################################################################################################
  203. ' BEGIN VECTOR TILE DRAWING TEST ROUTINES
  204. ' ################################################################################################################################################################
  205.  
  206. ' /////////////////////////////////////////////////////////////////////////////
  207.  
  208. Sub DrawVectorTilesTest1
  209.     Dim iX As Integer
  210.     Dim iY As Integer
  211.     Dim iMaxX As Integer
  212.     Dim iMaxY As Integer
  213.     Dim iShape As Integer
  214.     Dim iMaxShape As Integer
  215.     Dim fgColor As _Unsigned Long
  216.     Dim arrColor(0 To 7) As _Unsigned Long
  217.     Dim iColorIndex As Integer
  218.     Dim in$
  219.  
  220.     arrColor(0) = cBlack
  221.     arrColor(1) = cRed
  222.     arrColor(2) = cYellow
  223.     arrColor(3) = cLime
  224.     arrColor(4) = cCyan
  225.     arrColor(5) = cBlue
  226.     arrColor(6) = cPurple
  227.     arrColor(7) = cMagenta
  228.  
  229.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  230.     Cls , cBlack
  231.  
  232.     iMaxX = ((_Width(0) - 16) \ 8)
  233.     iMaxY = (_Height(0) - 16)
  234.     iMaxShape = 24
  235.     iShape = 0:: iColorIndex = 1
  236.  
  237.     For iY = (8 * 10) To iMaxY Step 8
  238.         For iX = 0 To iMaxX Step 8
  239.             DrawShape iShape, iX, iY, arrColor(iColorIndex)
  240.             iShape = iShape + 1: If iShape > iMaxShape Then iShape = 0
  241.             iColorIndex = iColorIndex + 1: If iColorIndex > 7 Then iColorIndex = 1
  242.         Next iX
  243.     Next iY
  244.  
  245.     Locate 1, 1
  246.     Input "PRESS <ENTER> TO CONTINUE"; in$
  247.     Screen 0
  248. End Sub ' DrawVectorTilesTest1
  249.  
  250. ' /////////////////////////////////////////////////////////////////////////////
  251.  
  252. Sub DrawShape (iShape As Integer, iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  253.     Select Case iShape
  254.         Case 0:
  255.             DrawHomeLine8x8_VT_1 iX, iY, fgColor
  256.         Case 1:
  257.             DrawHomeLine8x8_HZ_1 iX, iY, fgColor
  258.         Case 2:
  259.             DrawHomeLine8x8_NW_1 iX, iY, fgColor
  260.         Case 3:
  261.             DrawHomeLine8x8_NE_1 iX, iY, fgColor
  262.         Case 4:
  263.             DrawHomeLine8x8_SW_1 iX, iY, fgColor
  264.         Case 5:
  265.             DrawHomeLine8x8_SE_1 iX, iY, fgColor
  266.         Case 6:
  267.             DrawHomeLine8x8_VT_2 iX, iY, fgColor
  268.         Case 7:
  269.             DrawHomeLine8x8_HZ_2 iX, iY, fgColor
  270.         Case 8:
  271.             DrawHomeLine8x8_NW_2 iX, iY, fgColor
  272.         Case 9:
  273.             DrawHomeLine8x8_NE_2 iX, iY, fgColor
  274.         Case 10:
  275.             DrawHomeLine8x8_SW_2 iX, iY, fgColor
  276.         Case 11:
  277.             DrawHomeLine8x8_SE_2 iX, iY, fgColor
  278.         Case 12:
  279.             DrawHomeLine8x8_VT_3 iX, iY, fgColor
  280.         Case 13:
  281.             DrawHomeLine8x8_HZ_3 iX, iY, fgColor
  282.         Case 14:
  283.             DrawHomeLine8x8_NW_3 iX, iY, fgColor
  284.         Case 15:
  285.             DrawHomeLine8x8_NE_3 iX, iY, fgColor
  286.         Case 16:
  287.             DrawHomeLine8x8_SW_3 iX, iY, fgColor
  288.         Case 17:
  289.             DrawHomeLine8x8_SE_3 iX, iY, fgColor
  290.         Case 18:
  291.             DrawJailLine8x8_VT_2 iX, iY, fgColor
  292.         Case 19:
  293.             DrawJailLine8x8_VT_1 iX, iY, fgColor
  294.         Case 20:
  295.             DrawJailLine8x8_HZ_2 iX, iY, fgColor
  296.         Case 21:
  297.             DrawJailLine8x8_HZ_1 iX, iY, fgColor
  298.         Case 22:
  299.             DrawJailLine8x8_Grid_1 iX, iY, fgColor
  300.         Case 23:
  301.             DrawJailLine8x8_Grid_2 iX, iY, fgColor
  302.         Case 24:
  303.             DrawJailLine8x8_Grid_3 iX, iY, fgColor
  304.         Case Else:
  305.             '(IGNORE)
  306.     End Select
  307. End Sub ' DrawShape
  308.  
  309. ' ################################################################################################################################################################
  310. ' END VECTOR TILE DRAWING TEST ROUTINES
  311. ' ################################################################################################################################################################
  312.  
  313. ' ################################################################################################################################################################
  314. ' BEGIN BOX DRAWING ROUTINES
  315. ' ################################################################################################################################################################
  316.  
  317. ' /////////////////////////////////////////////////////////////////////////////
  318. ' DRAW A 2-D BOX (OUTLINE)
  319. ' https://www.qb64.org/wiki/LINE
  320.  
  321. Sub DrawBoxOutline (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  322.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, B ' Draw box outline
  323. End Sub ' DrawBoxOutline
  324.  
  325. ' /////////////////////////////////////////////////////////////////////////////
  326. ' DRAW A 2-D BOX (SOLID)
  327. ' https://www.qb64.org/wiki/LINE
  328.  
  329. ' Renamed DrawBox/DrawBoxLine to DrawSolidBox
  330.  
  331. Sub DrawBoxSolid (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  332.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, BF ' Draw a solid box
  333. End Sub ' DrawBoxSolid
  334.  
  335. ' /////////////////////////////////////////////////////////////////////////////
  336. ' DRAW A 2-D RECTANGLE (OUTLINE)
  337.  
  338. Sub DrawRectOutline (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  339.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, B ' Draw rectangle outline
  340. End Sub ' DrawRectOutline
  341.  
  342. ' /////////////////////////////////////////////////////////////////////////////
  343. ' DRAW A 2-D RECTANGLE (SOLID)
  344.  
  345. Sub DrawRectSolid (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  346.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, BF ' Draw a solid rectangle
  347. End Sub ' DrawRectSolid
  348.  
  349. ' /////////////////////////////////////////////////////////////////////////////
  350. ' DRAW A 2-D BOX (OUTLINE)
  351. ' https://www.qb64.org/wiki/LINE
  352.  
  353. ' The style parameter 0-255 doesn't seem to have a solid line?
  354. ' For that, use DrawOutlineBox.
  355.  
  356. ' LINE [STEP] [(column1, row1)]-[STEP] (column2, row2), color[, [{B|BF}], style%]
  357. ' B creates a box outline with each side parallel to the program screen sides. BF creates a filled box.
  358. ' The style% signed INTEGER value sets a dotted pattern to draw the line or rectangle outline.
  359.  
  360. Sub DrawStyledOutlineBox (iX%, iY%, iSize%, iColor~&, iStyle%)
  361.     Line (iX%, iY%)-(iX% + (iSize% - 1), iY% + (iSize% - 1)), iColor~&, B , iStyle%
  362. End Sub ' DrawStyledOutlineBox
  363.  
  364. ' /////////////////////////////////////////////////////////////////////////////
  365. ' DRAW A 2-D BOX (OUTLINE) WITH A SOLID LINE
  366.  
  367. Sub DrawOutlineBox (iX%, iY%, iSize2%, iColor~&, iWeight2%)
  368.     Dim iFromX%
  369.     Dim iFromY%
  370.     Dim iToX%
  371.     Dim iToY%
  372.     iSize% = iSize2% - 1
  373.     iWeight% = iWeight2% - 1
  374.     If iWeight% = 0 Then
  375.         ' TOP LINE
  376.         iFromX% = iX%
  377.         iFromY% = iY%
  378.         iToX% = iX% + iSize%
  379.         iToY% = iY%
  380.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  381.  
  382.         ' BOTTOM LINE
  383.         iFromX% = iX%
  384.         iFromY% = iY% + iSize%
  385.         iToX% = iX% + iSize%
  386.         iToY% = iY% + iSize%
  387.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  388.  
  389.         ' LEFT LINE
  390.         iFromX% = iX%
  391.         iFromY% = iY%
  392.         iToX% = iX%
  393.         iToY% = iY% + iSize%
  394.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  395.  
  396.         ' RIGHT LINE
  397.         iFromX% = iX% + iSize%
  398.         iFromY% = iY%
  399.         iToX% = iX% + iSize%
  400.         iToY% = iY% + iSize%
  401.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  402.     ElseIf iWeight% > 0 Then
  403.         ' TOP LINE
  404.         For iFromY% = iY% To (iY% + iWeight%)
  405.             iFromX% = iX%
  406.             'iFromY% = iY%
  407.             iToX% = iX% + iSize%
  408.             iToY% = iFromY%
  409.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  410.         Next iFromY%
  411.  
  412.         ' BOTTOM LINE
  413.         For iFromY% = ((iY% + iSize%) - iWeight%) To (iY% + iSize%)
  414.             iFromX% = iX%
  415.             'iFromY% = iY% + iSize%
  416.             iToX% = iX% + iSize%
  417.             iToY% = iFromY%
  418.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  419.         Next iFromY%
  420.  
  421.         ' LEFT LINE
  422.         For iFromX% = iX% To (iX% + iWeight%)
  423.             'iFromX% = iX%
  424.             iFromY% = iY%
  425.             iToX% = iFromX%
  426.             iToY% = iY% + iSize%
  427.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  428.         Next iFromX%
  429.  
  430.         ' RIGHT LINE
  431.         For iFromX% = ((iX% + iSize%) - iWeight%) To (iX% + iSize%)
  432.             'iFromX% = iX% + iSize%
  433.             iFromY% = iY%
  434.             iToX% = iFromX%
  435.             iToY% = iY% + iSize%
  436.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  437.         Next iFromX%
  438.     End If
  439. End Sub ' DrawOutlineBox
  440.  
  441. ' ################################################################################################################################################################
  442. ' END BOX DRAWING ROUTINES
  443. ' ################################################################################################################################################################
  444.  
  445. ' ################################################################################################################################################################
  446. ' BEGIN GENERATE LINE DRAWING SHAPE ROUTINES
  447. ' ################################################################################################################################################################
  448.  
  449. ' /////////////////////////////////////////////////////////////////////////////
  450.  
  451. Sub GetAllPossibleShapes (arrShapes1() As RectangleType)
  452.     ReDim arrShapes1(-1) As RectangleType
  453.     Dim iLoopRows As Integer
  454.     Dim iLoopCols As Integer
  455.     Dim iIndex As Integer
  456.     Dim iLoopY As Integer
  457.     Dim iLoopX As Integer
  458.  
  459.     For iLoopRows = 1 To 8
  460.         For iLoopCols = 1 To 8
  461.             ' Add next shape to array
  462.             iIndex = UBound(arrShapes1) + 1
  463.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  464.  
  465.             ' Save coordinates
  466.             arrShapes1(iIndex).x1 = 1
  467.             arrShapes1(iIndex).y1 = 1
  468.             arrShapes1(iIndex).x2 = iLoopCols
  469.             arrShapes1(iIndex).y2 = iLoopRows
  470.             arrShapes1(UBound(arrShapes1)).PixelCount = 0
  471.  
  472.             ' Count Pixels
  473.             For iLoopY = 1 To 8
  474.                 For iLoopX = 1 To 8
  475.                     if _
  476.                         iLoopY >= arrShapes1(iIndex).y1 _
  477.                         and _
  478.                         iLoopY <= arrShapes1(iIndex).y2 _
  479.                         and _
  480.                         iLoopX >= arrShapes1(iIndex).x1 _
  481.                         and _
  482.                         iLoopX <= arrShapes1(iIndex).x2 _
  483.                         then
  484.  
  485.                         'sLine = sLine + "#"
  486.                         arrShapes1(UBound(arrShapes1)).PixelCount = arrShapes1(UBound(arrShapes1)).PixelCount + 1
  487.                     Else
  488.                         'sLine = sLine + "."
  489.                     End If
  490.                 Next iLoopX
  491.                 ''DebugPrint sLine
  492.             Next iLoopY
  493.  
  494.         Next iLoopCols
  495.     Next iLoopRows
  496. End Sub ' GetAllPossibleShapes
  497.  
  498. ' /////////////////////////////////////////////////////////////////////////////
  499.  
  500. Sub GetAllPossibleShapesTest
  501.     ReDim arrShapes1(-1) As RectangleType
  502.     Dim arrColor(0 To 7) As _Unsigned Long
  503.     Dim iLoopShape As Integer
  504.     Dim iOffsetY As Integer
  505.     Dim iOffsetX As Integer
  506.     Dim iColorIndex As Integer
  507.     Dim iMinColorIndex As Integer: iMinColorIndex = 1
  508.     Dim iMaxColorIndex As Integer: iMaxColorIndex = 7
  509.     Dim in$
  510.     Dim iX As Integer
  511.     Dim iY As Integer
  512.     Dim iSizeW As Integer
  513.     Dim iSizeH As Integer
  514.     Dim fgColor As _Unsigned Long
  515.     Dim iMinX As Integer
  516.     Dim iMinY As Integer
  517.     Dim iMaxX As Integer
  518.     Dim iMaxY As Integer
  519.  
  520.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  521.     iMinX = 0
  522.     iMinY = 17
  523.     iMaxX = (_Width(0) / 8) ' iMaxX = _Width(0) - 16
  524.     iMaxY = _Height(0) - 16
  525.     iOffsetY = iMinY
  526.     iOffsetX = iMinX
  527.  
  528.     arrColor(0) = cBlack
  529.     arrColor(1) = cRed
  530.     arrColor(2) = cYellow
  531.     arrColor(3) = cLime
  532.     arrColor(4) = cCyan
  533.     arrColor(5) = cBlue
  534.     arrColor(6) = cPurple
  535.     arrColor(7) = cMagenta
  536.  
  537.     GetAllPossibleShapes arrShapes1()
  538.  
  539.     iColorIndex = iMinColorIndex
  540.     For iLoopShape = 0 To UBound(arrShapes1)
  541.         'DebugPrint _
  542.         '    "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  543.         '    "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  544.         '    cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  545.  
  546.         iX = arrShapes1(iLoopShape).x1 + iOffsetX
  547.         iY = arrShapes1(iLoopShape).y1 + iOffsetY
  548.         iSizeW = (arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1) + 1
  549.         iSizeH = (arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1) + 1
  550.         fgColor = arrColor(iColorIndex)
  551.         DrawRectSolid iX, iY, iSizeW, iSizeH, fgColor
  552.  
  553.         iOffsetX = iOffsetX + 16: If iOffsetX > iMaxX Then iOffsetX = iMinX: iOffsetY = iOffsetY + 16: If iOffsetY > iMaxY Then iOffsetY = iMinY
  554.         iColorIndex = iColorIndex + 1: If iColorIndex > iMaxColorIndex Then iColorIndex = iMinColorIndex
  555.     Next iLoopShape
  556.  
  557.     Locate 1, 1
  558.     Color cWhite, cBlack
  559.     Input "PRESS <ENTER> TO CONTINUE"; in$
  560.     Screen 0
  561. End Sub ' GetAllPossibleShapes
  562.  
  563.  
  564. Function DedupeDelimList$ (sInput As String, sDelim As String)
  565.     ReDim arrLines(-1) As String
  566.     Dim sOutput As String
  567.     Dim iLoop As Integer
  568.  
  569.     split sInput, sDelim, arrLines()
  570.     sOutput = sDelim
  571.     For iLoop = LBound(arrLines) To UBound(arrLines)
  572.         If InStr(1, sOutput, sDelim + arrLines(iLoop) + sDelim) = 0 Then
  573.             sOutput = sOutput + arrLines(iLoop) + sDelim
  574.         End If
  575.     Next iLoop
  576.  
  577.     DedupeDelimList$ = sOutput
  578. End Function ' DedupeDelimList$
  579.  
  580. ' /////////////////////////////////////////////////////////////////////////////
  581.  
  582. Function FindAllCombinationsNext$ (arrGroup() As Integer)
  583.     Dim sResult As String: sResult = ""
  584.     ReDim arrSubGroup(0 To UBound(arrGroup) - 1) As Integer
  585.     Dim iOmit As Integer
  586.     Dim iKeep As Integer
  587.     Dim iIndex As Integer
  588.  
  589.     'dim sLine as string : sLine = "Received: "
  590.     '    ''DebugPrint "FindAllCombinationsNext$ called, level " + cstr$(iLevel)
  591.     '    m_iCount = m_iCount + 1
  592.     '    'DebugPrint CurrentDateTime$ + " FindAllCombinationsNext$ called, m_iCount=" + cstr$(m_iCount)
  593.     'For iKeep = 0 To UBound(arrGroup)
  594.     'sLine = sLine + cstr$(arrGroup(iKeep)) + " "
  595.     'Next iKeep
  596.     ''DebugPrint "    " + sLine
  597.  
  598.     ' Recursively try omitting each one
  599.     If UBound(arrGroup) > 0 Then
  600.         For iOmit = 0 To UBound(arrGroup)
  601.             ReDim arrSubGroup(0 To UBound(arrGroup) - 1) As Integer
  602.             iIndex = -1
  603.             For iKeep = 0 To UBound(arrGroup)
  604.                 If arrGroup(iKeep) <> arrGroup(iOmit) Then
  605.                     iIndex = iIndex + 1
  606.                     arrSubGroup(iIndex) = arrGroup(iKeep)
  607.                     'sResult = sResult + IIFSTR$(len(sResult)=0, "", ",") + cstr$(arrGroup(iKeep))
  608.                     sResult = sResult + cstr$(arrGroup(iKeep)) + ","
  609.                 End If
  610.             Next iKeep
  611.             'sResult = sResult + IIFSTR$(len(sResult)=0, "", ";") + FindAllCombinationsTestNext$(arrSubGroup())
  612.             sResult = sResult + ";" + FindAllCombinationsNext$(arrSubGroup())
  613.             sResult = DedupeDelimList$(sResult, ";")
  614.         Next iOmit
  615.     Else
  616.         sResult = cstr$(arrGroup(0)) + ";"
  617.     End If
  618.  
  619.     sResult = DedupeDelimList$(sResult, ";")
  620.     'm_iCount = m_iCount - 1
  621.     ''DebugPrint "    Returning: " + chr$(34) + sResult + chr$(34)
  622.     FindAllCombinationsNext$ = sResult
  623. End Function ' FindAllCombinationsNext$
  624.  
  625. ' /////////////////////////////////////////////////////////////////////////////
  626. ' Get all combinations of the items in the list
  627.  
  628. Sub FindAllCombinations (sItemList As String)
  629.     ReDim arrGroup(-1) As Integer
  630.     Dim iLoop As Integer
  631.     Dim sResult As String: sResult = ""
  632.     ReDim arrLines(-1) As String
  633.     Dim sFinal As String: sFinal = ""
  634.  
  635.     ' Start with all
  636.     GetIntegerArrayFromDelimList sItemList, ",", 0, arrGroup()
  637.     For iLoop = LBound(arrGroup) To UBound(arrGroup)
  638.         sResult = sResult + IIFSTR$(Len(sResult) = 0, "", ",") + cstr$(iLoop)
  639.     Next iLoop
  640.  
  641.     ' Find all other combinations (including without)
  642.     sResult = sResult + ";" + FindAllCombinationsNext$(arrGroup())
  643.     sResult = Replace$(sResult, ",;", ";")
  644.  
  645.     ' Dedupe results
  646.     split sResult, ";", arrLines()
  647.     sFinal = ";"
  648.     For iLoop = LBound(arrLines) To UBound(arrLines)
  649.         If InStr(1, sFinal, ";" + arrLines(iLoop) + ";") = 0 Then
  650.             sFinal = sFinal + arrLines(iLoop) + ";"
  651.             'DebugPrint arrLines(iLoop)
  652.         End If
  653.     Next iLoop
  654. End Sub ' FindAllCombinations
  655.  
  656. ' /////////////////////////////////////////////////////////////////////////////
  657.  
  658. Sub FindAllCombinationsTest2
  659.     Dim sItemList As String
  660.     ReDim arrGroup(-1) As Integer
  661.     Dim iLoop As Integer
  662.     Dim sResult As String: sResult = ""
  663.     ReDim arrLines(-1) As String
  664.     Dim sFinal As String: sFinal = ""
  665.  
  666.     ' Use non-contiguous test data
  667.     'sItemList = "1,2,3,4"
  668.     'sItemList = "1,2,4,8,16,32,64,128"
  669.     Input "Enter a space-separated list of numbers"; sItemList
  670.     sItemList = Replace$(sItemList, " ", ",")
  671.     GetIntegerArrayFromDelimList sItemList, ",", 0, arrGroup()
  672.  
  673.     ' Start with all
  674.     For iLoop = LBound(arrGroup) To UBound(arrGroup)
  675.         sResult = sResult + IIFSTR$(Len(sResult) = 0, "", ",") + cstr$(arrGroup(iLoop))
  676.     Next iLoop
  677.  
  678.     ' Find all other combinations (including without)
  679.     sResult = sResult + ";" + FindAllCombinationsNext$(arrGroup())
  680.     sResult = Replace$(sResult, ",;", ";")
  681.  
  682.     ' Dedupe results
  683.     split sResult, ";", arrLines()
  684.     sFinal = ";"
  685.     For iLoop = LBound(arrLines) To UBound(arrLines)
  686.         If InStr(1, sFinal, ";" + arrLines(iLoop) + ";") = 0 Then
  687.             sFinal = sFinal + arrLines(iLoop) + ";"
  688.             'DebugPrint arrLines(iLoop)
  689.         End If
  690.     Next iLoop
  691. End Sub ' FindAllCombinationsTest2
  692.  
  693. ' /////////////////////////////////////////////////////////////////////////////
  694.  
  695. Sub FindAllCombinationsTest1
  696.     Dim iFrom As Integer: iFrom = 1
  697.     Dim iTo As Integer: iTo = 4
  698.     ReDim arrGroup(-1) As Integer
  699.     Dim iLoop As Integer
  700.     Dim sResult As String: sResult = ""
  701.     ReDim arrLines(-1) As String
  702.     Dim sFinal As String: sFinal = ""
  703.  
  704.     ' Generate some simple test data
  705.     For iLoop = iFrom To iTo
  706.         ReDim _Preserve arrGroup(0 To UBound(arrGroup) + 1) As Integer
  707.         arrGroup(UBound(arrGroup)) = iLoop
  708.     Next iLoop
  709.  
  710.     ' Start with all
  711.     For iLoop = LBound(arrGroup) To UBound(arrGroup)
  712.         sResult = sResult + IIFSTR$(Len(sResult) = 0, "", ",") + cstr$(arrGroup(iLoop))
  713.     Next iLoop
  714.  
  715.     ' Find all other combinations (including without)
  716.     sResult = sResult + ";" + FindAllCombinationsNext$(arrGroup())
  717.     sResult = Replace$(sResult, ",;", ";")
  718.  
  719.     ' Dedupe results
  720.     split sResult, ";", arrLines()
  721.     sFinal = ";"
  722.     For iLoop = LBound(arrLines) To UBound(arrLines)
  723.         If InStr(1, sFinal, ";" + arrLines(iLoop) + ";") = 0 Then
  724.             sFinal = sFinal + arrLines(iLoop) + ";"
  725.             'DebugPrint arrLines(iLoop)
  726.         End If
  727.     Next iLoop
  728. End Sub ' FindAllCombinationsTest1
  729.  
  730. ' /////////////////////////////////////////////////////////////////////////////
  731.  
  732. Sub FindOptimizedVector (TileString As String)
  733.     ReDim arrTile1(1 To 8, 1 To 8) As String
  734.     ReDim arrTile2(1 To 8, 1 To 8) As String
  735.     ReDim arrShapes1(-1) As RectangleType
  736.     ReDim arrShapes2(-1) As RectangleType
  737.     ReDim arrShapes3(-1) As RectangleType
  738.  
  739.     Dim iLoopShape As Integer
  740.     Dim iLoopY As Integer
  741.     Dim iLoopX As Integer
  742.     Dim iDestY As Integer
  743.     Dim iDestX As Integer
  744.     Dim iSizeY As Integer
  745.     Dim iSizeX As Integer
  746.     Dim iEndY As Integer
  747.     Dim iEndX As Integer
  748.     Dim iTestY As Integer
  749.     Dim iTestX As Integer
  750.     Dim bShapeFits As Integer
  751.     Dim sLine As String
  752.     Dim sNextPixel As String
  753.     Dim iShape1 As Integer
  754.     Dim iShape2 As Integer
  755.     Dim iIndex As Integer
  756.  
  757.     Dim sItemList As String
  758.     ReDim arrNumGroup(-1) As Integer
  759.     ReDim arrListGroup(-1) As String
  760.     ReDim arrShapeList(-1) As String
  761.     Dim iLoop1 As Integer
  762.     Dim iLoop2 As Integer
  763.     Dim sGroupList1 As String
  764.     Dim sGroupList2 As String
  765.     ReDim arrLines(-1) As String
  766.  
  767.     Dim iPixelCount As Integer
  768.     Dim iShapeCount As Integer
  769.     ReDim arrCompare(-1) As DrawCompareType
  770.     Dim iMatchCount As Integer
  771.  
  772.     ' Turn tile into 2D array
  773.     StringToArray arrTile1(), TileString
  774.  
  775.     ' Get all shapes to try
  776.     GetAllPossibleShapes arrShapes1()
  777.  
  778.     ' Try all shapes
  779.     For iLoopShape = 0 To UBound(arrShapes1)
  780.         ' Try next shape
  781.  
  782.         ' BEGIN DEBUG SHOW NEXT SHAPE
  783.         If TRUE = FALSE Then
  784.             'DebugPrint "arrShapes1(" + cstr$(iLoopShape) + "):"
  785.             'DebugPrint _
  786.             '    "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  787.             '    "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  788.             '    cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  789.             For iLoopY = 1 To 8
  790.                 sLine = ""
  791.                 For iLoopX = 1 To 8
  792.                 if _
  793.                     iLoopY >= arrShapes1(iLoopShape).y1 _
  794.                     and _
  795.                     iLoopY <= arrShapes1(iLoopShape).y2 _
  796.                     and _
  797.                     iLoopX >= arrShapes1(iLoopShape).x1 _
  798.                     and _
  799.                     iLoopX <= arrShapes1(iLoopShape).x2 _
  800.                     then
  801.  
  802.                         sLine = sLine + "#"
  803.                     Else
  804.                         sLine = sLine + "."
  805.                     End If
  806.                 Next iLoopX
  807.                 'DebugPrint sLine
  808.             Next iLoopY
  809.             'DebugPrint ""
  810.         End If
  811.         ' END DEBUG SHOW NEXT SHAPE
  812.  
  813.         ' Try test tile in every position (that it fits)
  814.         For iDestY = 1 To 8
  815.             For iDestX = 1 To 8
  816.                 bShapeFits = FALSE
  817.  
  818.                 ' Does shape fit at this Y position?
  819.                 iSizeY = arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1
  820.                 iEndY = iDestY + iSizeY
  821.                 If iEndY < 9 Then
  822.                     ' Does shape fit at this X position?
  823.                     iSizeX = arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1
  824.                     iEndX = iDestX + iSizeX
  825.                     If iEndX < 9 Then
  826.                         ' Do any of shape's pixels fall outside of tile's pixels?
  827.                         bShapeFits = TRUE
  828.                         For iTestY = iDestY To iEndY
  829.                             For iTestX = iDestX To iEndX
  830.                                 If arrTile1(iTestY, iTestX) = "." Then
  831.                                     ' No pixel here, shape fails
  832.                                     bShapeFits = FALSE
  833.                                     Exit For
  834.                                 End If
  835.                             Next iTestX
  836.                             If bShapeFits = FALSE Then Exit For
  837.                         Next iTestY
  838.                     End If
  839.                 End If
  840.  
  841.                 ' If shape fits, add it to the list
  842.                 If bShapeFits = TRUE Then
  843.                     iIndex = UBound(arrShapes2) + 1
  844.                     ReDim _Preserve arrShapes2(0 To iIndex) As RectangleType
  845.                     arrShapes2(iIndex).y1 = iDestY
  846.                     arrShapes2(iIndex).x1 = iDestX
  847.                     arrShapes2(iIndex).y2 = iEndY
  848.                     arrShapes2(iIndex).x2 = iEndX
  849.                     arrShapes2(iIndex).PixelCount = arrShapes1(iLoopShape).PixelCount
  850.                     arrShapes2(iIndex).IsActive = TRUE
  851.                 End If
  852.             Next iDestX
  853.         Next iDestY
  854.     Next iLoopShape
  855.  
  856.     '' Show tile
  857.     ''DebugPrint "TILE TO CHECK:"
  858.     'for iLoopY = lbound(arrTile1, 1) to ubound(arrTile1, 1)
  859.     '    sLine = ""
  860.     '    for iLoopX = lbound(arrTile1, 2) to ubound(arrTile1, 2)
  861.     '        sLine=sLine + arrTile1(iLoopY, iLoopX)
  862.     '    next iLoopX
  863.     '    'DebugPrint sLine
  864.     'next iLoopY
  865.  
  866.     '' Show all contender shapes
  867.     ''DebugPrint "SHAPES THAT MATCHED + FIT:"
  868.     'for iLoopShape = 0 to ubound(arrShapes2)
  869.     '    if arrShapes2(iLoopShape).IsActive = TRUE then
  870.     '        'DebugPrint _
  871.     '            "(" + cstr$(arrShapes2(iLoopShape).x1) + ", " + cstr$(arrShapes2(iLoopShape).y1) + ")-" + _
  872.     '            "(" + cstr$(arrShapes2(iLoopShape).x2) + ", " + cstr$(arrShapes2(iLoopShape).y2) + ") " + _
  873.     '            cstr$(arrShapes2(iLoopShape).PixelCount) + " pixels"
  874.     '        for iDestY = 1 To 8
  875.     '            sLine = ""
  876.     '            for iDestX = 1 To 8
  877.     '                sNextPixel = "."
  878.     '                if iDestY >= arrShapes2(iLoopShape).y1 then
  879.     '                    if iDestY <= arrShapes2(iLoopShape).y2 then
  880.     '                        if iDestX >= arrShapes2(iLoopShape).x1 then
  881.     '                            if iDestX <= arrShapes2(iLoopShape).x2 then
  882.     '                                sNextPixel = "#"
  883.     '                            end if
  884.     '                        end if
  885.     '                    end if
  886.     '                end if
  887.     '                sLine = sLine + sNextPixel
  888.     '            next iDestX
  889.     '            'DebugPrint sLine
  890.     '        next iDestY
  891.     '    end if
  892.     'next iLoopShape
  893.  
  894.     ' Remove redundant shapes (any where another shape covers more points)
  895.     For iShape1 = 0 To UBound(arrShapes2)
  896.  
  897.         ' make sure shape #1 was not eliminated
  898.         If arrShapes2(iShape1).IsActive = TRUE Then
  899.  
  900.             ' compare shape #1 against all other shapes
  901.             For iShape2 = 0 To UBound(arrShapes2)
  902.  
  903.                 ' don't compare against itself
  904.                 If iShape2 <> iShape1 Then
  905.  
  906.                     ' make sure shape #2 was not eliminated
  907.                     If arrShapes2(iShape2).IsActive = TRUE Then
  908.  
  909.                         ' can shape #2 do what shape #1 can do? (covers all points shape #1 does)
  910.                         if _
  911.                             arrShapes2(iShape1).y1 >= arrShapes2(iShape2).y1 _
  912.                             and _
  913.                             arrShapes2(iShape1).y2 <= arrShapes2(iShape2).y2 _
  914.                             and _
  915.                             arrShapes2(iShape1).x1 >= arrShapes2(iShape2).x1 _
  916.                             and _
  917.                             arrShapes2(iShape1).x2 <= arrShapes2(iShape2).x2 _
  918.                             then
  919.  
  920.                             ' does shape #2 do it better? (cover more points than shape #1)
  921.                             If arrShapes2(iShape2).PixelCount >= arrShapes2(iShape1).PixelCount Then
  922.                                 ' Remove shape #1
  923.                                 arrShapes2(iShape1).IsActive = FALSE
  924.                             End If
  925.  
  926.                         End If
  927.  
  928.                     End If
  929.  
  930.                 End If
  931.  
  932.             Next iShape2
  933.  
  934.         End If
  935.  
  936.     Next iShape1
  937.  
  938.     ' Add level 1 non-redundant shapes to the next list
  939.     For iLoopShape = 0 To UBound(arrShapes2)
  940.         If arrShapes2(iLoopShape).IsActive = TRUE Then
  941.             iIndex = UBound(arrShapes3) + 1
  942.             ReDim _Preserve arrShapes3(0 To iIndex) As RectangleType
  943.             arrShapes3(iIndex).y1 = arrShapes2(iLoopShape).y1
  944.             arrShapes3(iIndex).x1 = arrShapes2(iLoopShape).x1
  945.             arrShapes3(iIndex).y2 = arrShapes2(iLoopShape).y2
  946.             arrShapes3(iIndex).x2 = arrShapes2(iLoopShape).x2
  947.             arrShapes3(iIndex).PixelCount = arrShapes2(iLoopShape).PixelCount
  948.             arrShapes3(iIndex).IsActive = arrShapes2(iLoopShape).IsActive
  949.         End If
  950.     Next iLoopShape
  951.  
  952.     ' Show all non-redundant shapes
  953.     'DebugPrint "SHAPES THAT MATCHED + FIT, NON-REDUNDANT LEVEL 1:"
  954.     For iLoopShape = 0 To UBound(arrShapes3)
  955.         'DebugPrint _
  956.         '    "(" + cstr$(arrShapes3(iLoopShape).x1) + ", " + cstr$(arrShapes3(iLoopShape).y1) + ")-" + _
  957.         '    "(" + cstr$(arrShapes3(iLoopShape).x2) + ", " + cstr$(arrShapes3(iLoopShape).y2) + ") " + _
  958.         '    cstr$(arrShapes3(iLoopShape).PixelCount) + " pixels"
  959.         For iDestY = 1 To 8
  960.             sLine = ""
  961.             For iDestX = 1 To 8
  962.                 sNextPixel = "."
  963.                 If iDestY >= arrShapes3(iLoopShape).y1 Then
  964.                     If iDestY <= arrShapes3(iLoopShape).y2 Then
  965.                         If iDestX >= arrShapes3(iLoopShape).x1 Then
  966.                             If iDestX <= arrShapes3(iLoopShape).x2 Then
  967.                                 sNextPixel = "#"
  968.                             End If
  969.                         End If
  970.                     End If
  971.                 End If
  972.                 sLine = sLine + sNextPixel
  973.             Next iDestX
  974.             'DebugPrint sLine
  975.         Next iDestY
  976.     Next iLoopShape
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.     ' Can we do without any?
  984.  
  985.     ' Try all combinations
  986.  
  987.     ' Items to combine
  988.     sItemList = ""
  989.     For iShape1 = 0 To UBound(arrShapes3)
  990.         sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iShape1)
  991.     Next iShape1
  992.     GetIntegerArrayFromDelimList sItemList, ",", 0, arrNumGroup()
  993.  
  994.     ' Start with all
  995.     sGroupList1 = ""
  996.     For iLoop1 = LBound(arrNumGroup) To UBound(arrNumGroup)
  997.         sGroupList1 = sGroupList1 + IIFSTR$(Len(sGroupList1) = 0, "", ",") + cstr$(arrNumGroup(iLoop1))
  998.     Next iLoop1
  999.  
  1000.     ' Find all other combinations (including without)
  1001.     sGroupList1 = sGroupList1 + ";" + FindAllCombinationsNext$(arrNumGroup())
  1002.     sGroupList1 = Replace$(sGroupList1, ",;", ";")
  1003.  
  1004.     ' Dedupe results
  1005.     split sGroupList1, ";", arrListGroup()
  1006.     sGroupList2 = ";"
  1007.     For iLoop1 = LBound(arrListGroup) To UBound(arrListGroup)
  1008.         If InStr(1, sGroupList2, ";" + arrListGroup(iLoop1) + ";") = 0 Then
  1009.             sGroupList2 = sGroupList2 + arrListGroup(iLoop1) + ";"
  1010.             ''DebugPrint arrListGroup(iLoop1)
  1011.         End If
  1012.     Next iLoop1
  1013.  
  1014.     ' Now see which combinations can draw the tile
  1015.     'DebugPrint "==============================================================================="
  1016.     'DebugPrint "Now see which combinations can draw the tile..."
  1017.     iMatchCount = 0
  1018.     split sGroupList2, ";", arrListGroup()
  1019.     For iLoop1 = LBound(arrListGroup) To UBound(arrListGroup)
  1020.         'DebugPrint "arrListGroup(" + cstr$(iLoop1) + ") = " + chr$(34) + arrListGroup(iLoop1) + chr$(34)
  1021.  
  1022.         ' Clear test tile
  1023.         ReDim arrTile2(1 To 8, 1 To 8) As String
  1024.         For iDestY = 1 To 8
  1025.             For iDestX = 1 To 8
  1026.                 arrTile2(iDestY, iDestX) = "."
  1027.             Next iDestX
  1028.         Next iDestY
  1029.  
  1030.         ' Get list of indexes that make up the next combination of shape
  1031.         split arrListGroup(iLoop1), ",", arrShapeList()
  1032.  
  1033.         ' Try drawing next combination of shapes in the test tile
  1034.         iShapeCount = 0
  1035.         iPixelCount = 0
  1036.         For iLoop2 = LBound(arrShapeList) To UBound(arrShapeList)
  1037.             If IsNum%(arrShapeList(iLoop2)) = TRUE Then
  1038.                 iIndex = Val(arrShapeList(iLoop2))
  1039.                 iShapeCount = iShapeCount + 1
  1040.                 iPixelCount = iPixelCount + arrShapes3(iIndex).PixelCount
  1041.  
  1042.                 For iDestY = 1 To 8
  1043.                     For iDestX = 1 To 8
  1044.                         'arrTile2(iDestY, iDestX) = "."
  1045.                         If iDestY >= arrShapes3(iIndex).y1 Then
  1046.                             If iDestY <= arrShapes3(iIndex).y2 Then
  1047.                                 If iDestX >= arrShapes3(iIndex).x1 Then
  1048.                                     If iDestX <= arrShapes3(iIndex).x2 Then
  1049.                                         arrTile2(iDestY, iDestX) = "#"
  1050.                                     End If
  1051.                                 End If
  1052.                             End If
  1053.                         End If
  1054.                     Next iDestX
  1055.                 Next iDestY
  1056.             Else
  1057.                 'DebugPrint "ERROR NON-NUMERIC AT arrShapeList(" + cstr$(iLoop2) + ") = " + chr$(34) + arrShapeList(iLoop2) + chr$(34)
  1058.                 'exit for
  1059.             End If
  1060.         Next iLoop2
  1061.  
  1062.         ' Does the test tile match the real tile?
  1063.         If TilesAreEqual%(arrTile1(), arrTile2()) = TRUE Then
  1064.             'DebugPrint "Found matching tile at iLoop1=" + cstr$(iLoop1)
  1065.             iMatchCount = iMatchCount + 1
  1066.  
  1067.             iIndex = UBound(arrCompare) + 1
  1068.             'DebugPrint "Appending to arrCompare at position " + cstr$(iIndex)
  1069.             'DebugPrint "    after:"
  1070.             'DebugPrint "        lbound(arrCompare)=" + cstr$(lbound(arrCompare))
  1071.             'DebugPrint "        ubound(arrCompare)=" + cstr$(ubound(arrCompare))
  1072.             ReDim _Preserve arrCompare(0 To iIndex) As DrawCompareType
  1073.             'DebugPrint "    after:"
  1074.             'DebugPrint "        lbound(arrCompare)=" + cstr$(lbound(arrCompare))
  1075.             'DebugPrint "        ubound(arrCompare)=" + cstr$(ubound(arrCompare))
  1076.             arrCompare(iIndex).IndexList = arrListGroup(iLoop1)
  1077.             arrCompare(iIndex).ShapeCount = iShapeCount
  1078.             arrCompare(iIndex).PixelCount = iPixelCount
  1079.             arrCompare(iIndex).IsActive = TRUE
  1080.         Else
  1081.             'DebugPrint "Tiles didn't match"
  1082.         End If
  1083.  
  1084.     Next iLoop1
  1085.  
  1086.     ' Identify the best combination that uses the least # of shapes + pixels
  1087.     If UBound(arrCompare) > LBound(arrCompare) Then
  1088.         For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  1089.             For iLoop2 = LBound(arrCompare) To UBound(arrCompare)
  1090.                 If iLoop1 <> iLoop2 Then
  1091.                     If arrCompare(iLoop1).IsActive = TRUE Then
  1092.                         If arrCompare(iLoop2).IsActive = TRUE Then
  1093.                             'DebugPrint "Comparing   ShapeCount   PixelCount   IndexList"
  1094.  
  1095.                             'DebugPrint left$(cstr$(iLoop1) + String$(9, " "), 9) + _
  1096.                             '    "   " + _
  1097.                             '    left$(cstr$(arrCompare(iLoop1).ShapeCount) + String$(10, " "), 10) + _
  1098.                             '    "   " + _
  1099.                             '    left$(cstr$(arrCompare(iLoop1).PixelCount) + String$(10, " "), 10) + _
  1100.                             '    "   " + _
  1101.                             '    arrCompare(iLoop1).IndexList
  1102.                             'DebugPrint left$(cstr$(iLoop2) + String$(9, " "), 9) + _
  1103.                             '    "   " + _
  1104.                             '    left$(cstr$(arrCompare(iLoop2).ShapeCount) + String$(10, " "), 10) + _
  1105.                             '    "   " + _
  1106.                             '    left$(cstr$(arrCompare(iLoop2).PixelCount) + String$(10, " "), 10) + _
  1107.                             '    "   " + _
  1108.                             '    arrCompare(iLoop2).IndexList
  1109.  
  1110.                             If arrCompare(iLoop2).ShapeCount < arrCompare(iLoop1).ShapeCount Then
  1111.                                 'DebugPrint "#" + cstr$(iLoop1) + " uses more shapes, marking inactive"
  1112.                                 arrCompare(iLoop1).IsActive = FALSE
  1113.                             ElseIf arrCompare(iLoop2).ShapeCount > arrCompare(iLoop1).ShapeCount Then
  1114.                                 'DebugPrint "#" + cstr$(iLoop2) + " uses more shapes, marking inactive"
  1115.                                 arrCompare(iLoop2).IsActive = FALSE
  1116.                             Else
  1117.                                 If arrCompare(iLoop2).PixelCount < arrCompare(iLoop1).PixelCount Then
  1118.                                     'DebugPrint "#" + cstr$(iLoop1) + " uses more pixels, marking inactive"
  1119.                                     arrCompare(iLoop1).IsActive = FALSE
  1120.                                 ElseIf arrCompare(iLoop2).PixelCount > arrCompare(iLoop1).PixelCount Then
  1121.                                     'DebugPrint "#" + cstr$(iLoop2) + " uses more pixels, marking inactive"
  1122.                                     arrCompare(iLoop2).IsActive = FALSE
  1123.                                 Else
  1124.                                     'DebugPrint "Same # of shapes and pixels, marking #" + cstr$(iLoop2) + " inactive"
  1125.                                     arrCompare(iLoop2).IsActive = FALSE
  1126.                                 End If
  1127.                             End If
  1128.                         End If
  1129.                     End If
  1130.                 End If
  1131.             Next iLoop2
  1132.         Next iLoop1
  1133.     End If
  1134.  
  1135.     ' The winner!
  1136.     ' Get list of indexes that make up the winning shape combination
  1137.     'DebugPrint "Looking for the winner"
  1138.     'DebugPrint "lbound(arrCompare)=" + cstr$(lbound(arrCompare))
  1139.     'DebugPrint "ubound(arrCompare)=" + cstr$(ubound(arrCompare))
  1140.     'DebugPrint "arrCompare  ShapeCount   PixelCount   IsActive   IndexList"
  1141.  
  1142.     iIndex = -1
  1143.     For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  1144.         'DebugPrint "iLoop1=" + cstr$(iLoop1)
  1145.  
  1146.         'sLine = ""
  1147.         'sLine = sLine + left$(cstr$(iLoop1) + String$(9, " "), 9)
  1148.         'sLine = sLine + "   "
  1149.         'sLine = sLine + left$(cstr$(arrCompare(iLoop1).ShapeCount) + String$(10, " "), 10)
  1150.         'sLine = sLine + "   "
  1151.         'sLine = sLine + left$(cstr$(arrCompare(iLoop1).PixelCount) + String$(10, " "), 10)
  1152.         'sLine = sLine + "   "
  1153.         'sLine = sLine + left$(TrueFalse$(arrCompare(iLoop1).IsActive) + String$(8, " "), 8)
  1154.         'sLine = sLine + "   "
  1155.         'sLine = sLine + arrCompare(iLoop1).IndexList
  1156.         'DebugPrint sLine
  1157.  
  1158.         If arrCompare(iLoop1).IsActive = TRUE Then
  1159.             iIndex = iLoop1: Exit For
  1160.         End If
  1161.     Next iLoop1
  1162.     If iIndex > -1 Then
  1163.         'DebugPrint "-------------------------------------------------------------------------------"
  1164.         'DebugPrint "The winning shape combination:"
  1165.         split arrCompare(iIndex).IndexList, ",", arrShapeList()
  1166.         For iLoop2 = LBound(arrShapeList) To UBound(arrShapeList)
  1167.             DebugPrint "-------------------------------------------------------------------------------"
  1168.             'DebugPrint "Shape #" + arrShapeList(iLoop2)
  1169.             If IsNum%(arrShapeList(iLoop2)) = TRUE Then
  1170.                 iIndex = Val(arrShapeList(iLoop2))
  1171.                 For iDestY = 1 To 8
  1172.                     sLine = ""
  1173.                     For iDestX = 1 To 8
  1174.                         sNextPixel = "."
  1175.                         If iDestY >= arrShapes3(iIndex).y1 Then
  1176.                             If iDestY <= arrShapes3(iIndex).y2 Then
  1177.                                 If iDestX >= arrShapes3(iIndex).x1 Then
  1178.                                     If iDestX <= arrShapes3(iIndex).x2 Then
  1179.                                         sNextPixel = "#"
  1180.                                     End If
  1181.                                 End If
  1182.                             End If
  1183.                         End If
  1184.                         sLine = sLine + sNextPixel
  1185.                     Next iDestX
  1186.                     DebugPrint sLine
  1187.                 Next iDestY
  1188.             Else
  1189.                 'DebugPrint "ERROR NON-NUMERIC AT arrShapeList(" + cstr$(iLoop2) + ") = " + chr$(34) + arrShapeList(iLoop2) + chr$(34)
  1190.                 'exit for
  1191.             End If
  1192.         Next iLoop2
  1193.         DebugPrint "-------------------------------------------------------------------------------"
  1194.     Else
  1195.         'DebugPrint "ERROR: NO WORKING SHAPE COMBINATIONS FOUND"
  1196.     End If
  1197.  
  1198. End Sub ' FindOptimizedVector
  1199.  
  1200. Function TilesAreEqual% (arrTile1() As String, arrTile2() As String)
  1201.     Dim bResult As Integer: bResult = FALSE
  1202.     Dim iLoopY As Integer
  1203.     Dim iLoopX As Integer
  1204.     Dim sLine As String
  1205.     If LBound(arrTile1, 1) = LBound(arrTile2, 1) Then
  1206.         If UBound(arrTile1, 1) = UBound(arrTile2, 1) Then
  1207.             If LBound(arrTile1, 2) = LBound(arrTile2, 2) Then
  1208.                 If UBound(arrTile1, 2) = UBound(arrTile2, 2) Then
  1209.  
  1210.                     If TRUE = FALSE Then
  1211.                         'DebugPrint "???????????????????????????????????????????????????????????????????????????????"
  1212.                         'DebugPrint "Comparing arrTile1:"
  1213.                         For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  1214.                             sLine = ""
  1215.                             For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  1216.                                 sLine = sLine + arrTile1(iLoopY, iLoopX)
  1217.                             Next iLoopX
  1218.                             'DebugPrint sLine
  1219.                         Next iLoopY
  1220.                         'DebugPrint "???????????????????????????????????????????????????????????????????????????????"
  1221.                         'DebugPrint "With arrTile2:"
  1222.                         For iLoopY = LBound(arrTile2, 1) To UBound(arrTile2, 1)
  1223.                             sLine = ""
  1224.                             For iLoopX = LBound(arrTile2, 2) To UBound(arrTile2, 2)
  1225.                                 sLine = sLine + arrTile2(iLoopY, iLoopX)
  1226.                             Next iLoopX
  1227.                             'DebugPrint sLine
  1228.                         Next iLoopY
  1229.                         'DebugPrint "???????????????????????????????????????????????????????????????????????????????"
  1230.                     End If
  1231.  
  1232.  
  1233.  
  1234.  
  1235.                     bResult = TRUE
  1236.                     For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  1237.                         For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  1238.                             If arrTile1(iLoopY, iLoopX) = "." And arrTile2(iLoopY, iLoopX) <> "." Then
  1239.                                 bResult = FALSE: Exit For
  1240.                             ElseIf arrTile1(iLoopY, iLoopX) <> "." And arrTile2(iLoopY, iLoopX) = "." Then
  1241.                                 bResult = FALSE: Exit For
  1242.                             End If
  1243.                         Next iLoopX
  1244.                         If bResult = FALSE Then Exit For
  1245.                     Next iLoopY
  1246.                 Else
  1247.                     'DebugPrint "ubound(tile,2) didn't match"
  1248.                 End If
  1249.             Else
  1250.                 'DebugPrint "lbound(tile,2) didn't match"
  1251.             End If
  1252.         Else
  1253.             'DebugPrint "ubound(tile,1) didn't match"
  1254.         End If
  1255.     Else
  1256.         'DebugPrint "lbound(tile,1) didn't match"
  1257.     End If
  1258.     TilesAreEqual% = bResult
  1259. End Function ' TilesAreEqual%
  1260.  
  1261. ' /////////////////////////////////////////////////////////////////////////////
  1262.  
  1263. Sub FindOptimizedVectorTest
  1264.     Dim RoutineName As String: RoutineName = "FindOptimizedVectorTest"
  1265.     Dim sError As String: sError = ""
  1266.     Dim in$
  1267.     ReDim arrTileText(0 To 255) As String
  1268.     Dim sTestList As String
  1269.     ReDim arrTestIndex(-1) As Integer
  1270.     Dim iLoop As Integer
  1271.     Dim iIndex As Integer
  1272.  
  1273.     ' Start output
  1274.     'DebugPrint "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  1275.     'DebugPrint "Testing tiles: " + sTestList
  1276.     'DebugPrint ""
  1277.  
  1278.     ' Get raster tiles as a string array
  1279.     GetTileText arrTileText()
  1280.  
  1281.     ' List of tiles to test
  1282.     'sTestList = "254,253,247,32,238,241,225,233,213,214,212,203,194,193,192,169,154,151,145,147,129,115,114,84,65,46,44,35,252"
  1283.     'sTestList = "46,35"
  1284.     sTestList = "84,253,192,151,147,114,65"
  1285.     GetIntegerArrayFromDelimList sTestList, ",", 0, arrTestIndex()
  1286.  
  1287.     ' Test tiles
  1288.     For iLoop = LBound(arrTestIndex) To UBound(arrTestIndex)
  1289.         iIndex = arrTestIndex(iLoop)
  1290.         DebugPrint "----------------------------------------------------------------------------------------------------------------------------------------------------------------"
  1291.         DebugPrint "Tile #" + cstr$(iIndex) + ":"
  1292.         DebugPrint arrTileText(iIndex)
  1293.         DebugPrint ""
  1294.  
  1295.         ' Process next tile and generate line drawing routines
  1296.         FindOptimizedVector arrTileText(iIndex)
  1297.  
  1298.         DebugPrint ""
  1299.     Next iLoop
  1300.  
  1301.     ' DONE
  1302.     DebugPrint RoutineName + " finished."
  1303.     'Input "PRESS <ENTER> TO CONTINUE";in$
  1304. End Sub ' FindOptimizedVectorTest
  1305.  
  1306. ' /////////////////////////////////////////////////////////////////////////////
  1307.  
  1308. Sub GetIntegerArrayFromDelimList (MyString As String, sDelimiter As String, iMinIndex As Integer, arrInteger() As Integer)
  1309.     ReDim arrString(-1) As String
  1310.     Dim CleanString As String
  1311.     Dim iLoop As Integer
  1312.     Dim iCount As Integer: iCount = iMinIndex - 1
  1313.  
  1314.     ReDim arrInteger(-1) As Integer
  1315.  
  1316.     If Len(sDelimiter) > 0 Then
  1317.         CleanString = MyString
  1318.         If sDelimiter <> " " Then
  1319.             CleanString = Replace$(CleanString, " ", "")
  1320.         End If
  1321.  
  1322.         split CleanString, sDelimiter, arrString()
  1323.         iCount = iMinIndex - 1
  1324.         For iLoop = LBound(arrString) To UBound(arrString)
  1325.             If IsNum%(arrString(iLoop)) = TRUE Then
  1326.                 iCount = iCount + 1
  1327.                 ReDim _Preserve arrInteger(iMinIndex To iCount) As Integer
  1328.                 arrInteger(iCount) = Val(arrString(iLoop))
  1329.             End If
  1330.         Next iLoop
  1331.     Else
  1332.         If IsNum%(MyString) = TRUE Then
  1333.             ReDim _Preserve arrInteger(iMinIndex To iMinIndex) As Integer
  1334.             arrInteger(iMinIndex) = Val(MyString)
  1335.         End If
  1336.     End If
  1337. End Sub ' GetIntegerArrayFromDelimList
  1338.  
  1339. ' /////////////////////////////////////////////////////////////////////////////
  1340.  
  1341. Sub BreakMultipleIntoShapes (MyString As String, arrShapes1() As String)
  1342.     ReDim arrLines(-1) As String
  1343.     ReDim arrCols(-1) As String
  1344.     Dim sLine As String
  1345.     Dim iLen As Integer
  1346.     Dim iCount As Integer
  1347.     Dim iLoopRows As Integer
  1348.     Dim iLoopCols As Integer
  1349.     Dim iShapeCount As Integer
  1350.  
  1351.     ' Break multiple up into shapes
  1352.     split MyString, Chr$(13), arrLines()
  1353.     sLine = arrLines(LBound(arrLines))
  1354.     iLen = Len(sLine)
  1355.     sLine = Replace$(sLine, " ", "")
  1356.     iCount = (iLen - Len(sLine)) + 1
  1357.     For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1358.         If Len(arrLines(iLoopRows)) > 0 Then
  1359.             split arrLines(iLoopRows), " ", arrCols()
  1360.             iShapeCount = 0
  1361.             For iLoopCols = LBound(arrCols) To UBound(arrCols)
  1362.                 If Len(arrCols(iLoopCols)) > 0 Then
  1363.                     iShapeCount = iShapeCount + 1
  1364.                     If UBound(arrShapes1) < iShapeCount Then
  1365.                         ReDim _Preserve arrShapes1(0 To iShapeCount)
  1366.                     End If
  1367.                     arrShapes1(iShapeCount) = arrShapes1(iShapeCount) + arrCols(iLoopCols) + Chr$(13)
  1368.                 End If
  1369.             Next iLoopCols
  1370.         End If
  1371.     Next iLoopRows
  1372. End Sub ' BreakMultipleIntoShapes
  1373.  
  1374. ' /////////////////////////////////////////////////////////////////////////////
  1375.  
  1376. Sub BreakMultipleIntoShapesTest
  1377.     Dim in$
  1378.     Dim MyString As String
  1379.     ReDim arrShapes1(-1) As String
  1380.     Dim iLoop As Integer
  1381.  
  1382.     ' Test data
  1383.     MyString = ""
  1384.     MyString = MyString + "######## #.#.#.#. ####.... ...##... ######## ........ ........ 2222.... 22..22.. ...22..." + Chr$(13)
  1385.     MyString = MyString + "######## .#.#.#.# ####.... ...##... #......# .2222222 ........ 2222.... 22..22.. ...22..." + Chr$(13)
  1386.     MyString = MyString + "######## #.#.#.#. ####.... ...##... #......# .2222222 ........ 2222.... ..22..22 ...22..." + Chr$(13)
  1387.     MyString = MyString + "######## .#.#.#.#.####.... ######## #......# .2222222 ........ 2222.... ..22..22 ...22222" + Chr$(13)
  1388.     MyString = MyString + "######## #.#.#.#. ....#### ######## #......# .2222222 ........ 2222.... 22..22.. ...22222" + Chr$(13)
  1389.     MyString = MyString + "######## .#.#.#.# ....#### ...##... #......# .2222222 ........ 2222.... 22..22.. ........" + Chr$(13)
  1390.     MyString = MyString + "######## #.#.#.#. ....#### ...##... #......# .2222222 ........ 2222.... ..22..22 ........" + Chr$(13)
  1391.     MyString = MyString + "######## .#.#.#.# ....#### ...##... ######## .2222222 ........ 2222.... ..22..22 ........"
  1392.  
  1393.     ' Break up
  1394.     BreakMultipleIntoShapes MyString, arrShapes1()
  1395.  
  1396.     ' Show Results
  1397.     For iLoop = LBound(arrShapes1) To UBound(arrShapes1)
  1398.         Print "arrShapes1(" + cstr$(iLoop) + "):"
  1399.         Print arrShapes1(iLoop)
  1400.         Print
  1401.         Input "PRESS <ENTER> TO CONTINUE"; in$
  1402.     Next iLoop
  1403.  
  1404. End Sub ' BreakMultipleIntoShapesTest
  1405.  
  1406. ' /////////////////////////////////////////////////////////////////////////////
  1407. ' GENERATES SEMI-OPTIMIZED VECTOR DRAWING ROUTINES USING Line COMMANDS
  1408. ' FOR ONE OR MORE 8X8 TILES.
  1409.  
  1410. ' TODO: Optimize for each shape by determining how to draw it with the
  1411. '       minimum number of line commands.
  1412.  
  1413. Sub GenerateNextVectorTileCode (MyString As String, sNameList As String)
  1414.     Dim RoutineName As String: RoutineName = "GenerateNextVectorTileCode"
  1415.     Dim sError As String: sError = ""
  1416.     ReDim arrShapes1(-1) As String
  1417.     ReDim arrLines(-1) As String
  1418.     ReDim arrCols(-1) As String
  1419.     ReDim arrCount(-1) As String
  1420.     ReDim arrLenCountHZ(-1) As Integer
  1421.     ReDim arrLenCountVT(-1) As Integer
  1422.     ReDim arrNextShape(-1, -1) As String
  1423.     ReDim arrNames(-1) As String
  1424.     Dim sLine As String
  1425.     Dim iLen As Integer
  1426.     Dim iCount As Integer
  1427.     Dim in$
  1428.     Dim iLoopRows As Integer
  1429.     Dim iLoopCols As Integer
  1430.     Dim iShapeCount As Integer
  1431.     Dim iLoopShape As Integer
  1432.     ReDim arrColSize As Integer
  1433.     ReDim arrRowSize As Integer
  1434.     Dim iCountHZ As Integer
  1435.     Dim iCountVT As Integer
  1436.     Dim iLoopCount As Integer
  1437.     Dim sTransposed As String
  1438.     Dim iColumnCount As Integer
  1439.     Dim iRowCount As Integer
  1440.     Dim iScoreHZ As Integer
  1441.     Dim iScoreVT As Integer
  1442.     Dim iRow As Integer
  1443.     Dim iX1 As Integer
  1444.     Dim iX2 As Integer
  1445.     Dim iY1 As Integer
  1446.     Dim iY2 As Integer
  1447.     Dim iLast As Integer
  1448.     Dim sTemplate1 As String
  1449.     Dim sTemplate2 As String
  1450.     Dim sShapeCode As String
  1451.     Dim sLineCommands As String
  1452.     Dim iTotalCount As Integer: iTotalCount = 0
  1453.     Dim sNextShapeComment As String
  1454.  
  1455.     ' Initialize screen
  1456.     If Len(sError) = 0 Then
  1457.         Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  1458.     End If
  1459.  
  1460.     ' Initialize template
  1461.     If Len(sError) = 0 Then
  1462.         ' Template for code for a shape routine:
  1463.         sTemplate1 = "" + _
  1464.             "' /////////////////////////////////////////////////////////////////////////////" + chr$(13) + _
  1465.             "' Draw this shape with Line commands:" + chr$(13) + _
  1466.             "{shape comments}" + _
  1467.             "Sub {name}(iX As Integer, iY As Integer, fgColor As _UNSIGNED Long)" + chr$(13) + _
  1468.             "    ' {comment}" + chr$(13) + _
  1469.             "{line commands}" + _
  1470.             "End Sub ' {name}" + chr$(13) + _
  1471.             chr$(13) + ""
  1472.  
  1473.         ' Template for what replaces "{line commands}":
  1474.         sTemplate2 = "    Line ({x1}, {y1})-({x2}, {y2}), fgColor" + Chr$(13)
  1475.     End If
  1476.  
  1477.     ' Break multiple up into shapes
  1478.     If Len(sError) = 0 Then
  1479.         split MyString, Chr$(13), arrLines()
  1480.         sLine = arrLines(LBound(arrLines))
  1481.         iLen = Len(sLine)
  1482.         sLine = Replace$(sLine, " ", "")
  1483.         iCount = (iLen - Len(sLine)) + 1
  1484.         For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1485.             If Len(arrLines(iLoopRows)) > 0 Then
  1486.                 split arrLines(iLoopRows), " ", arrCols()
  1487.                 iShapeCount = 0
  1488.  
  1489.                 For iLoopCols = LBound(arrCols) To UBound(arrCols)
  1490.                     If Len(arrCols(iLoopCols)) > 0 Then
  1491.                         iShapeCount = iShapeCount + 1
  1492.  
  1493.                         If UBound(arrShapes1) < iShapeCount Then
  1494.                             ReDim _Preserve arrShapes1(0 To iShapeCount)
  1495.                         End If
  1496.  
  1497.                         arrShapes1(iShapeCount) = arrShapes1(iShapeCount) + arrCols(iLoopCols) + Chr$(13)
  1498.                     End If
  1499.                 Next iLoopCols
  1500.             End If
  1501.         Next iLoopRows
  1502.     End If
  1503.  
  1504.     ' Get names
  1505.     If Len(sError) = 0 Then
  1506.         split sNameList, ",", arrNames()
  1507.         If (UBound(arrNames) + 1 < iShapeCount) Then
  1508.             sError = "Not enough names in sNameList." + chr$(13) + _
  1509.                 "Detected " + cstr$( ubound(arrNames)+1 ) + "names in " + chr$(13) + _
  1510.                 "sNameList " + chr$(34) + sNameList + chr$(34) + chr$(13) + _
  1511.                 "and " + cstr$(iShapeCount) + " shapes."
  1512.         End If
  1513.     End If
  1514.  
  1515.     ' Process shapes and generate line drawing routines
  1516.     If Len(sError) = 0 Then
  1517.         For iLoopShape = 1 To iShapeCount
  1518.             Cls
  1519.             Print "Shape #" + cstr$(iLoopShape)
  1520.             Print arrShapes1(iLoopShape)
  1521.  
  1522.             ' Count rows/columns and create comment showing the shape
  1523.             iRowCount = 0
  1524.             iColumnCount = 0
  1525.             sNextShapeComment = ""
  1526.             split arrShapes1(iLoopShape), Chr$(13), arrLines()
  1527.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1528.                 If Len(arrLines(iLoopRows)) > 0 Then
  1529.                     sNextShapeComment = sNextShapeComment + "' " + _Trim$(arrLines(iLoopRows)) + Chr$(13)
  1530.                     iRowCount = iRowCount + 1
  1531.                     iLen = Len(_Trim$(arrLines(iLoopRows)))
  1532.                     If iLen > iColumnCount Then
  1533.                         iColumnCount = iLen
  1534.                     End If
  1535.                 End If
  1536.             Next iLoopRows
  1537.             ReDim arrLenCountHZ(1 To iColumnCount) As Integer
  1538.             ReDim arrLenCountVT(1 To iRowCount) As Integer
  1539.             Print "iRowCount   =" + cstr$(iRowCount)
  1540.             Print "iColumnCount=" + cstr$(iColumnCount)
  1541.             ReDim arrNextShape(iRowCount, iColumnCount) As String
  1542.  
  1543.             ' Count consecutive horizontal
  1544.             iCountHZ = 0
  1545.             Print "lbound(arrLines)=" + cstr$(LBound(arrLines))
  1546.             Print "ubound(arrLines)=" + cstr$(UBound(arrLines))
  1547.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1548.                 If Len(arrLines(iLoopRows)) > 0 Then
  1549.                     split arrLines(iLoopRows), ".", arrCount()
  1550.                     For iLoopCount = LBound(arrCount) To UBound(arrCount)
  1551.                         iLen = Len(_Trim$(arrCount(iLoopCount)))
  1552.                         arrLenCountHZ(iLen) = arrLenCountHZ(iLen) + 1
  1553.                         If iLen > 0 Then
  1554.                             iCountHZ = iCountHZ + 1
  1555.                         End If
  1556.                     Next iLoopCount
  1557.                 End If
  1558.             Next iLoopRows
  1559.             Print "iCountHZ = " + cstr$(iCountHZ)
  1560.  
  1561.             ' Transpose to count vertical and create 2D array
  1562.             sTransposed = ""
  1563.             iCount = 0
  1564.             ReDim arrCols(iColumnCount) As String
  1565.             iRow = 0
  1566.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1567.                 If Len(arrLines(iLoopRows)) > 0 Then
  1568.                     iRow = iRow + 1
  1569.                     For iLoopCols = 1 To Len(arrLines(iLoopRows))
  1570.                         arrCols(iLoopCols) = arrCols(iLoopCols) + Mid$(arrLines(iLoopRows), iLoopCols, 1)
  1571.                         arrNextShape(iRow, iLoopCols) = Mid$(arrLines(iLoopRows), iLoopCols, 1)
  1572.                     Next iLoopCols
  1573.                 End If
  1574.             Next iLoopRows
  1575.             For iLoopCols = LBound(arrCols) To UBound(arrCols)
  1576.                 sTransposed = sTransposed + arrCols(iLoopCols) + Chr$(13)
  1577.             Next iLoopCols
  1578.             'print "Transposed:"
  1579.             'print sTransposed
  1580.  
  1581.             ' Count consecutive vertical
  1582.             iCountVT = 0
  1583.             For iLoopRows = LBound(arrCols) To UBound(arrCols)
  1584.                 If Len(arrCols(iLoopRows)) > 0 Then
  1585.                     split arrCols(iLoopRows), ".", arrCount()
  1586.                     For iLoopCount = LBound(arrCount) To UBound(arrCount)
  1587.                         iLen = Len(_Trim$(arrCount(iLoopCount)))
  1588.                         arrLenCountVT(iLen) = arrLenCountVT(iLen) + 1
  1589.                         If iLen > 0 Then
  1590.                             iCountVT = iCountVT + 1
  1591.                         End If
  1592.                     Next iLoopCount
  1593.                 End If
  1594.             Next iLoopRows
  1595.  
  1596.             ' Weigh horizontal vs vertical
  1597.             iScoreHZ = 0
  1598.             sLine = ""
  1599.             For iCount = 1 To iColumnCount
  1600.                 If iCount > 1 Then sLine = sLine + ", "
  1601.                 sLine = sLine + cstr$(iCount) + "=" + cstr$(arrLenCountHZ(iCount))
  1602.                 iScoreHZ = iScoreHZ + (iCount * arrLenCountHZ(iCount))
  1603.             Next iCount
  1604.             Print "Horizontal count: " + sLine
  1605.             Print "Horizontal total: " + cstr$(iCountHZ)
  1606.             Print "Horizontal miles: " + cstr$(iScoreHZ)
  1607.  
  1608.             iScoreVT = 0
  1609.             sLine = ""
  1610.             For iCount = 1 To iRowCount
  1611.                 If iCount > 1 Then sLine = sLine + ", "
  1612.                 sLine = sLine + cstr$(iCount) + "=" + cstr$(arrLenCountVT(iCount))
  1613.                 iScoreVT = iScoreVT + (iCount * arrLenCountVT(iCount))
  1614.             Next iCount
  1615.             Print "Vertical   count: " + sLine
  1616.             Print "Vertical   total: " + cstr$(iCountVT)
  1617.             Print "Vertical   miles: " + cstr$(iScoreVT)
  1618.  
  1619.             '' Verify break up into array
  1620.             'print "REGURGITATED 2D:"
  1621.             'for iLoopRows = lbound(arrNextShape, 1) to ubound(arrNextShape, 1)
  1622.             '    sLine = ""
  1623.             '    for iLoopCols = lbound(arrNextShape, 2) to ubound(arrNextShape, 2)
  1624.             '        sLine = sLine + arrNextShape(iLoopRows, iLoopCols)
  1625.             '    next iLoopCols
  1626.             '    print sLine
  1627.             'next iLoopRows
  1628.  
  1629.             ' DID WE FIND ANYTHING TO DRAW?
  1630.             If iCountVT > 0 And iCountHZ > 0 Then
  1631.  
  1632.                 ' INTIALIZE TEMPLATE FOR NEXT SHAPE
  1633.                 'sTemplate1: {name} {comment} {line commands}
  1634.                 sShapeCode = sTemplate1
  1635.                 sShapeCode = Replace$(sShapeCode, "{name}", arrNames(iLoopShape - 1))
  1636.                 sShapeCode = Replace$(sShapeCode, "{shape comments}", sNextShapeComment)
  1637.                 sLineCommands = ""
  1638.  
  1639.                 ' More consecutive horizontal or vertical?
  1640.                 If iCountVT < iCountHZ Then
  1641.  
  1642.                     ' ADD A COMMENT THAT THIS ROUTINE USES VERTICAL LINES
  1643.                     'sTemplate1: {name} {comment} {line commands}
  1644.                     sShapeCode = Replace$(sShapeCode, "{comment}", "DRAW WITH VERTICAL LINES")
  1645.  
  1646.                     ' LOOK AT SHAPE COLUMN BY COLUMN
  1647.                     For iLoopCols = LBound(arrNextShape, 2) To UBound(arrNextShape, 2)
  1648.                         iX1 = iLoopCols
  1649.                         iX2 = iLoopCols
  1650.                         iY1 = -1
  1651.                         iY2 = -1
  1652.  
  1653.                         ' LOOK AT SHAPE ROW BY ROW
  1654.                         For iLoopRows = LBound(arrNextShape, 1) To UBound(arrNextShape, 1)
  1655.  
  1656.                             ' PIXEL HERE...
  1657.                             If arrNextShape(iLoopRows, iLoopCols) = "#" Then
  1658.                                 ' ARE WE CURRENTLY IN A LINE?
  1659.                                 If iY1 = -1 Then
  1660.                                     ' NO, START A NEW LINE
  1661.                                     ' Remember this as the starting point
  1662.                                     iY1 = iLoopRows
  1663.                                 End If
  1664.  
  1665.                                 ' Remember the most recent point
  1666.                                 iLast = iLoopRows
  1667.  
  1668.                                 ' NO PIXEL HERE...
  1669.                             Else
  1670.                                 ' ARE WE CURRENTLY IN A LINE?
  1671.                                 If iY1 <> -1 Then
  1672.                                     ' Use the most recent point as the end point
  1673.                                     iY2 = iLast
  1674.  
  1675.                                     ' GENERATE THE NEXT LINE COMMAND
  1676.                                     'sTemplate1: {name} {comment} {line commands}
  1677.                                     'sTemplate2: {x1} {y1} {x2} {y2}
  1678.                                     'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1679.                                     sLine = sTemplate2
  1680.  
  1681.                                     If iX1 = 1 Then
  1682.                                         sLine = Replace$(sLine, "{x1}", "iX")
  1683.                                     Else
  1684.                                         sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1685.                                     End If
  1686.  
  1687.                                     If iY1 = 1 Then
  1688.                                         sLine = Replace$(sLine, "{y1}", "iY")
  1689.                                     Else
  1690.                                         sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1691.                                     End If
  1692.  
  1693.                                     If iX2 = 1 Then
  1694.                                         sLine = Replace$(sLine, "{x2}", "iX")
  1695.                                     Else
  1696.                                         sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1697.                                     End If
  1698.  
  1699.                                     If iY2 = 1 Then
  1700.                                         sLine = Replace$(sLine, "{y2}", "iY")
  1701.                                     Else
  1702.                                         sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1703.                                     End If
  1704.  
  1705.                                     ' SAVE THE COMMAND TO BE ADDED
  1706.                                     sLineCommands = sLineCommands + sLine
  1707.  
  1708.                                     ' RESET (NO LONGER IN A LINE)
  1709.                                     iY1 = -1
  1710.                                 End If
  1711.                             End If
  1712.                         Next iLoopRows
  1713.  
  1714.                         ' AND CHECK AGAIN AT THE END
  1715.                         ' ARE WE CURRENTLY IN A LINE?
  1716.                         If iY1 <> -1 Then
  1717.                             ' Use the most recent point as the end point
  1718.                             iY2 = iLast
  1719.  
  1720.                             ' GENERATE THE NEXT LINE COMMAND
  1721.                             'sTemplate1: {name} {comment} {line commands}
  1722.                             'sTemplate2: {x1} {y1} {x2} {y2}
  1723.                             'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1724.                             sLine = sTemplate2
  1725.  
  1726.                             If iX1 = 1 Then
  1727.                                 sLine = Replace$(sLine, "{x1}", "iX")
  1728.                             Else
  1729.                                 sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1730.                             End If
  1731.  
  1732.                             If iY1 = 1 Then
  1733.                                 sLine = Replace$(sLine, "{y1}", "iY")
  1734.                             Else
  1735.                                 sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1736.                             End If
  1737.  
  1738.                             If iX2 = 1 Then
  1739.                                 sLine = Replace$(sLine, "{x2}", "iX")
  1740.                             Else
  1741.                                 sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1742.                             End If
  1743.  
  1744.                             If iY2 = 1 Then
  1745.                                 sLine = Replace$(sLine, "{y2}", "iY")
  1746.                             Else
  1747.                                 sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1748.                             End If
  1749.  
  1750.                             ' SAVE THE COMMAND TO BE ADDED
  1751.                             sLineCommands = sLineCommands + sLine
  1752.  
  1753.                             ' RESET (NO LONGER IN A LINE)
  1754.                             iY1 = -1
  1755.                         End If
  1756.                     Next iLoopCols
  1757.  
  1758.                     ' ADD THE LINE COMMANDS TO THE CURRENT SHAPE'S DRAW ROUTINE
  1759.                     sShapeCode = Replace$(sShapeCode, "{line commands}", sLineCommands)
  1760.  
  1761.                     ' OUTPUT IT
  1762.                     iTotalCount = iTotalCount + 1
  1763.                     'DebugPrint sShapeCode
  1764.  
  1765.                 Else
  1766.                     ' ADD A COMMENT THAT THIS ROUTINE USES HORIZONTAL LINES
  1767.                     'sTemplate1: {name} {comment} {line commands}
  1768.                     sShapeCode = Replace$(sShapeCode, "{comment}", "DRAW WITH HORIZONTAL LINES")
  1769.  
  1770.                     ' LOOK AT SHAPE ROW BY ROW
  1771.                     For iLoopRows = LBound(arrNextShape, 1) To UBound(arrNextShape, 1)
  1772.                         iX1 = -1
  1773.                         iX2 = -1
  1774.                         iY1 = iLoopRows
  1775.                         iY2 = iLoopRows
  1776.  
  1777.                         ' LOOK AT SHAPE COLUMN BY COLUMN
  1778.                         For iLoopCols = LBound(arrNextShape, 2) To UBound(arrNextShape, 2)
  1779.  
  1780.                             ' PIXEL HERE...
  1781.                             If arrNextShape(iLoopRows, iLoopCols) = "#" Then
  1782.                                 ' ARE WE CURRENTLY IN A LINE?
  1783.                                 If iX1 = -1 Then
  1784.                                     ' NO, START A NEW LINE
  1785.                                     ' Remember this as the starting point
  1786.                                     iX1 = iLoopCols
  1787.                                 End If
  1788.  
  1789.                                 ' Remember the most recent point
  1790.                                 iLast = iLoopCols
  1791.  
  1792.                                 ' NO PIXEL HERE...
  1793.                             Else
  1794.                                 ' ARE WE CURRENTLY IN A LINE?
  1795.                                 If iX1 <> -1 Then
  1796.                                     ' Use the most recent point as the end point
  1797.                                     iX2 = iLast
  1798.  
  1799.                                     ' GENERATE THE NEXT LINE COMMAND
  1800.                                     'sTemplate1: {name} {comment} {line commands}
  1801.                                     'sTemplate2: {x1} {y1} {x2} {y2}
  1802.                                     'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1803.                                     sLine = sTemplate2
  1804.  
  1805.                                     If iX1 = 1 Then
  1806.                                         sLine = Replace$(sLine, "{x1}", "iX")
  1807.                                     Else
  1808.                                         sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1809.                                     End If
  1810.  
  1811.                                     If iY1 = 1 Then
  1812.                                         sLine = Replace$(sLine, "{y1}", "iY")
  1813.                                     Else
  1814.                                         sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1815.                                     End If
  1816.  
  1817.                                     If iX2 = 1 Then
  1818.                                         sLine = Replace$(sLine, "{x2}", "iX")
  1819.                                     Else
  1820.                                         sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1821.                                     End If
  1822.  
  1823.                                     If iY2 = 1 Then
  1824.                                         sLine = Replace$(sLine, "{y2}", "iY")
  1825.                                     Else
  1826.                                         sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1827.                                     End If
  1828.  
  1829.                                     ' SAVE THE COMMAND TO BE ADDED
  1830.                                     sLineCommands = sLineCommands + sLine
  1831.  
  1832.                                     ' RESET (NO LONGER IN A LINE)
  1833.                                     iX1 = -1
  1834.                                 End If
  1835.                             End If
  1836.                         Next iLoopCols
  1837.  
  1838.                         ' AND CHECK AGAIN AT THE END
  1839.                         ' ARE WE CURRENTLY IN A LINE?
  1840.                         If iX1 <> -1 Then
  1841.                             ' Use the most recent point as the end point
  1842.                             iX2 = iLast
  1843.  
  1844.                             ' GENERATE THE NEXT LINE COMMAND
  1845.                             'sTemplate1: {name} {comment} {line commands}
  1846.                             'sTemplate2: {x1} {y1} {x2} {y2}
  1847.                             'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1848.                             sLine = sTemplate2
  1849.  
  1850.                             If iX1 = 1 Then
  1851.                                 sLine = Replace$(sLine, "{x1}", "iX")
  1852.                             Else
  1853.                                 sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1854.                             End If
  1855.  
  1856.                             If iY1 = 1 Then
  1857.                                 sLine = Replace$(sLine, "{y1}", "iY")
  1858.                             Else
  1859.                                 sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1860.                             End If
  1861.  
  1862.                             If iX2 = 1 Then
  1863.                                 sLine = Replace$(sLine, "{x2}", "iX")
  1864.                             Else
  1865.                                 sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1866.                             End If
  1867.  
  1868.                             If iY2 = 1 Then
  1869.                                 sLine = Replace$(sLine, "{y2}", "iY")
  1870.                             Else
  1871.                                 sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1872.                             End If
  1873.  
  1874.                             ' SAVE THE COMMAND TO BE ADDED
  1875.                             sLineCommands = sLineCommands + sLine
  1876.  
  1877.                             ' RESET (NO LONGER IN A LINE)
  1878.                             iX1 = -1
  1879.                         End If
  1880.                     Next iLoopRows
  1881.  
  1882.                     ' ADD THE LINE COMMANDS TO THE CURRENT SHAPE'S DRAW ROUTINE
  1883.                     sShapeCode = Replace$(sShapeCode, "{line commands}", sLineCommands)
  1884.  
  1885.                     ' OUTPUT IT
  1886.                     iTotalCount = iTotalCount + 1
  1887.                     'DebugPrint sShapeCode
  1888.                 End If
  1889.             End If
  1890.  
  1891.             ' DONE
  1892.             Print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  1893.             Print sShapeCode
  1894.             Print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  1895.             'Input "PRESS <ENTER> TO CONTINUE";in$
  1896.         Next iLoopShape
  1897.     End If
  1898.  
  1899.     ' SHOW RESULTS
  1900.     If Len(sError) = 0 Then
  1901.         Print "Generated " + cstr$(iTotalCount) + " shape routines."
  1902.     Else
  1903.         Print RoutineName + " failed:"
  1904.         Print sError
  1905.     End If
  1906.     'Input "PRESS <ENTER> TO CONTINUE";in$
  1907.  
  1908.     Screen 0
  1909. End Sub ' GenerateNextVectorTileCode
  1910.  
  1911. ' /////////////////////////////////////////////////////////////////////////////
  1912. ' Defines various 8x8 tiles and calls GenerateNextVectorTileCode to generate vector
  1913. ' Line routines to draw each one.
  1914.  
  1915. Sub GenerateVectorTileCode ()
  1916.     Dim MyString As String
  1917.     Dim sNameList As String
  1918.     Dim in$
  1919.  
  1920.     MyString = ""
  1921.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1922.     MyString = MyString + "...#.... ........ ........ ........ ...#.... ...#...." + Chr$(13)
  1923.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1924.     MyString = MyString + "...#.... #.#.#.#. ...##.#. #.##.... ...##.#. #.##...." + Chr$(13)
  1925.     MyString = MyString + "........ ........ ...#.... ...#.... ........ ........" + Chr$(13)
  1926.     MyString = MyString + "...#.... ........ ........ ........ ........ ........" + Chr$(13)
  1927.     MyString = MyString + "........ ........ ...#.... ...#.... ........ ........" + Chr$(13)
  1928.     MyString = MyString + "...#.... ........ ........ ........ ........ ........"
  1929.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  1930.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  1931.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  1932.     sNameList = Replace$(sNameList, "{n}", "1")
  1933.     GenerateNextVectorTileCode MyString, sNameList
  1934.  
  1935.     MyString = ""
  1936.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1937.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  1938.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1939.     MyString = MyString + "...##... #.#.#.#. ...##.#. #.#.#... ...##.#. #.#.#..." + Chr$(13)
  1940.     MyString = MyString + "........ #.#.#.#. ...##.#. #.#.#... ...##.#. #.#.#..." + Chr$(13)
  1941.     MyString = MyString + "...##... ........ ........ ........ ........ ........" + Chr$(13)
  1942.     MyString = MyString + "........ ........ ...##... ...##... ........ ........" + Chr$(13)
  1943.     MyString = MyString + "...##... ........ ........ ........ ........ ........"
  1944.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  1945.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  1946.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  1947.     sNameList = Replace$(sNameList, "{n}", "2")
  1948.     GenerateNextVectorTileCode MyString, sNameList
  1949.  
  1950.     MyString = ""
  1951.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1952.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  1953.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  1954.     MyString = MyString + "........ .##..##. .....##. .##..... .....##. .##....." + Chr$(13)
  1955.     MyString = MyString + "........ .##..##. .....##. .##..... .....##. .##....." + Chr$(13)
  1956.     MyString = MyString + "...##... ........ ...##... ...##... ........ ........" + Chr$(13)
  1957.     MyString = MyString + "...##... ........ ...##... ...##... ........ ........" + Chr$(13)
  1958.     MyString = MyString + "........ ........ ........ ........ ........ ........"
  1959.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  1960.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  1961.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  1962.     sNameList = Replace$(sNameList, "{n}", "3")
  1963.     GenerateNextVectorTileCode MyString, sNameList
  1964.  
  1965.     MyString = ""
  1966.     MyString = MyString + "##..##.. #.#.#.#. ######## ######## #######. ...##... ...#...#" + Chr$(13)
  1967.     MyString = MyString + "##..##.. #.#.#.#. ######## ........ #.#.#.#. ...##... ...#...#" + Chr$(13)
  1968.     MyString = MyString + "##..##.. #.#.#.#. ........ ######## #######. ...##... ...#...#" + Chr$(13)
  1969.     MyString = MyString + "##..##.. #.#.#.#. ........ ........ #.#.#.#. ######## ########" + Chr$(13)
  1970.     MyString = MyString + "##..##.. #.#.#.#. ######## ######## #######. ######## ...#...#" + Chr$(13)
  1971.     MyString = MyString + "##..##.. #.#.#.#. ######## ........ #.#.#.#. ...##... ...#...#" + Chr$(13)
  1972.     MyString = MyString + "##..##.. #.#.#.#. ........ ######## #######. ...##... ...#...#" + Chr$(13)
  1973.     MyString = MyString + "##..##.. #.#.#.#. ........ ........ #.#.#.#. ...##... ########"
  1974.     sNameList = "DrawJailLine8x8_VT_2,DrawJailLine8x8_VT_1," + _
  1975.         "DrawJailLine8x8_HZ_2,DrawJailLine8x8_HZ_1," + _
  1976.         "DrawJailLine8x8_Grid_1,DrawJailLine8x8_Grid_3," + _
  1977.         "DrawJailLine8x8_Grid_2"
  1978.     GenerateNextVectorTileCode MyString, sNameList
  1979.     Print
  1980.     Print "See console window for generated code."
  1981.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1982. End Sub ' GenerateVectorTileCode
  1983.  
  1984. ' ################################################################################################################################################################
  1985. ' END GENERATE LINE DRAWING SHAPE ROUTINES
  1986. ' ################################################################################################################################################################
  1987.  
  1988. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1989. ' BEGIN GENERATED VECTOR TILE ROUTINES
  1990. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1991.  
  1992. ' /////////////////////////////////////////////////////////////////////////////
  1993. ' Draw this shape with Line commands:
  1994. ' ........
  1995. ' ...#....
  1996. ' ........
  1997. ' ...#....
  1998. ' ........
  1999. ' ...#....
  2000. ' ........
  2001. ' ...#....
  2002. Sub DrawHomeLine8x8_VT_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2003.     ' DRAW WITH HORIZONTAL LINES
  2004.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  2005.     Line (iX + 3, iY + 3)-(iX + 3, iY + 3), fgColor
  2006.     Line (iX + 3, iY + 5)-(iX + 3, iY + 5), fgColor
  2007.     Line (iX + 3, iY + 7)-(iX + 3, iY + 7), fgColor
  2008. End Sub ' DrawHomeLine8x8_VT_1
  2009.  
  2010. ' /////////////////////////////////////////////////////////////////////////////
  2011. ' Draw this shape with Line commands:
  2012. ' ........
  2013. ' ........
  2014. ' ........
  2015. ' #.#.#.#.
  2016. ' ........
  2017. ' ........
  2018. ' ........
  2019. ' ........
  2020. Sub DrawHomeLine8x8_HZ_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2021.     ' DRAW WITH HORIZONTAL LINES
  2022.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  2023.     Line (iX + 2, iY + 3)-(iX + 2, iY + 3), fgColor
  2024.     Line (iX + 4, iY + 3)-(iX + 4, iY + 3), fgColor
  2025.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  2026. End Sub ' DrawHomeLine8x8_HZ_1
  2027.  
  2028. ' /////////////////////////////////////////////////////////////////////////////
  2029. ' Draw this shape with Line commands:
  2030. ' ........
  2031. ' ........
  2032. ' ........
  2033. ' ...##.#.
  2034. ' ...#....
  2035. ' ........
  2036. ' ...#....
  2037. ' ........
  2038. Sub DrawHomeLine8x8_NW_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2039.     ' DRAW WITH HORIZONTAL LINES
  2040.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2041.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  2042.     Line (iX + 3, iY + 4)-(iX + 3, iY + 4), fgColor
  2043.     Line (iX + 3, iY + 6)-(iX + 3, iY + 6), fgColor
  2044. End Sub ' DrawHomeLine8x8_NW_1
  2045.  
  2046. ' /////////////////////////////////////////////////////////////////////////////
  2047. ' Draw this shape with Line commands:
  2048. ' ........
  2049. ' ........
  2050. ' ........
  2051. ' #.##....
  2052. ' ...#....
  2053. ' ........
  2054. ' ...#....
  2055. ' ........
  2056. Sub DrawHomeLine8x8_NE_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2057.     ' DRAW WITH HORIZONTAL LINES
  2058.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  2059.     Line (iX + 2, iY + 3)-(iX + 3, iY + 3), fgColor
  2060.     Line (iX + 3, iY + 4)-(iX + 3, iY + 4), fgColor
  2061.     Line (iX + 3, iY + 6)-(iX + 3, iY + 6), fgColor
  2062. End Sub ' DrawHomeLine8x8_NE_1
  2063.  
  2064. ' /////////////////////////////////////////////////////////////////////////////
  2065. ' Draw this shape with Line commands:
  2066. ' ........
  2067. ' ...#....
  2068. ' ........
  2069. ' ...##.#.
  2070. ' ........
  2071. ' ........
  2072. ' ........
  2073. ' ........
  2074. Sub DrawHomeLine8x8_SW_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2075.     ' DRAW WITH HORIZONTAL LINES
  2076.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  2077.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2078.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  2079. End Sub ' DrawHomeLine8x8_SW_1
  2080.  
  2081. ' /////////////////////////////////////////////////////////////////////////////
  2082. ' Draw this shape with Line commands:
  2083. ' ........
  2084. ' ...#....
  2085. ' ........
  2086. ' #.##....
  2087. ' ........
  2088. ' ........
  2089. ' ........
  2090. ' ........
  2091. Sub DrawHomeLine8x8_SE_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2092.     ' DRAW WITH HORIZONTAL LINES
  2093.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  2094.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  2095.     Line (iX + 2, iY + 3)-(iX + 3, iY + 3), fgColor
  2096. End Sub ' DrawHomeLine8x8_SE_1
  2097.  
  2098. ' /////////////////////////////////////////////////////////////////////////////
  2099. ' Draw this shape with Line commands:
  2100. ' ........
  2101. ' ...##...
  2102. ' ........
  2103. ' ...##...
  2104. ' ........
  2105. ' ...##...
  2106. ' ........
  2107. ' ...##...
  2108. Sub DrawHomeLine8x8_VT_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2109.     ' DRAW WITH HORIZONTAL LINES
  2110.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2111.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2112.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2113.     Line (iX + 3, iY + 7)-(iX + 4, iY + 7), fgColor
  2114. End Sub ' DrawHomeLine8x8_VT_2
  2115.  
  2116. ' /////////////////////////////////////////////////////////////////////////////
  2117. ' Draw this shape with Line commands:
  2118. ' ........
  2119. ' ........
  2120. ' ........
  2121. ' #.#.#.#.
  2122. ' #.#.#.#.
  2123. ' ........
  2124. ' ........
  2125. ' ........
  2126. Sub DrawHomeLine8x8_HZ_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2127.     ' DRAW WITH VERTICAL LINES
  2128.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  2129.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  2130.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2131.     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  2132. End Sub ' DrawHomeLine8x8_HZ_2
  2133.  
  2134. ' /////////////////////////////////////////////////////////////////////////////
  2135. ' Draw this shape with Line commands:
  2136. ' ........
  2137. ' ........
  2138. ' ........
  2139. ' ...##.#.
  2140. ' ...##.#.
  2141. ' ........
  2142. ' ...##...
  2143. ' ........
  2144. Sub DrawHomeLine8x8_NW_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2145.     ' DRAW WITH HORIZONTAL LINES
  2146.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2147.     Line (iX + 3, iY + 4)-(iX + 4, iY + 4), fgColor
  2148.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2149.  
  2150.     ' DRAW WITH VERTICAL LINES
  2151.     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  2152. End Sub ' DrawHomeLine8x8_NW_2
  2153.  
  2154. ' /////////////////////////////////////////////////////////////////////////////
  2155. ' Draw this shape with Line commands:
  2156. ' ........
  2157. ' ........
  2158. ' ........
  2159. ' #.#.#...
  2160. ' #.#.#...
  2161. ' ........
  2162. ' ...##...
  2163. ' ........
  2164. Sub DrawHomeLine8x8_NE_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2165.     ' DRAW WITH VERTICAL LINES
  2166.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  2167.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  2168.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2169.  
  2170.     ' DRAW WITH HORIZONTAL LINES
  2171.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2172. End Sub ' DrawHomeLine8x8_NE_2
  2173.  
  2174. ' /////////////////////////////////////////////////////////////////////////////
  2175. ' Draw this shape with Line commands:
  2176. ' ........
  2177. ' ...##...
  2178. ' ........
  2179. ' ...##.#.
  2180. ' ...##.#.
  2181. ' ........
  2182. ' ........
  2183. ' ........
  2184. Sub DrawHomeLine8x8_SW_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2185.     ' DRAW WITH HORIZONTAL LINES
  2186.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2187.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2188.     Line (iX + 3, iY + 4)-(iX + 4, iY + 4), fgColor
  2189.  
  2190.     ' DRAW WITH VERTICAL LINES
  2191.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2192. End Sub ' DrawHomeLine8x8_SW_2
  2193.  
  2194. ' /////////////////////////////////////////////////////////////////////////////
  2195. ' Draw this shape with Line commands:
  2196. ' ........
  2197. ' ...##...
  2198. ' ........
  2199. ' #.#.#...
  2200. ' #.#.#...
  2201. ' ........
  2202. ' ........
  2203. ' ........
  2204. Sub DrawHomeLine8x8_SE_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2205.     ' DRAW WITH HORIZONTAL LINES
  2206.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2207.  
  2208.     ' DRAW WITH VERTICAL LINES
  2209.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  2210.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  2211.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2212.  
  2213. End Sub ' DrawHomeLine8x8_SE_2
  2214.  
  2215. ' /////////////////////////////////////////////////////////////////////////////
  2216. ' Draw this shape with Line commands:
  2217. ' ........
  2218. ' ...##...
  2219. ' ...##...
  2220. ' ........
  2221. ' ........
  2222. ' ...##...
  2223. ' ...##...
  2224. ' ........
  2225. Sub DrawHomeLine8x8_VT_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2226.     ' DRAW WITH HORIZONTAL LINES
  2227.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2228.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  2229.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2230.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2231. End Sub ' DrawHomeLine8x8_VT_3
  2232.  
  2233. ' /////////////////////////////////////////////////////////////////////////////
  2234. ' Draw this shape with Line commands:
  2235. ' ........
  2236. ' ........
  2237. ' ........
  2238. ' .##..##.
  2239. ' .##..##.
  2240. ' ........
  2241. ' ........
  2242. ' ........
  2243. Sub DrawHomeLine8x8_HZ_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2244.     ' DRAW WITH HORIZONTAL LINES
  2245.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  2246.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  2247.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  2248.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  2249. End Sub ' DrawHomeLine8x8_HZ_3
  2250.  
  2251. ' /////////////////////////////////////////////////////////////////////////////
  2252. ' Draw this shape with Line commands:
  2253. ' ........
  2254. ' ........
  2255. ' ........
  2256. ' .....##.
  2257. ' .....##.
  2258. ' ...##...
  2259. ' ...##...
  2260. ' ........
  2261. Sub DrawHomeLine8x8_NW_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2262.     ' DRAW WITH HORIZONTAL LINES
  2263.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  2264.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  2265.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2266.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2267. End Sub ' DrawHomeLine8x8_NW_3
  2268.  
  2269. ' /////////////////////////////////////////////////////////////////////////////
  2270. ' Draw this shape with Line commands:
  2271. ' ........
  2272. ' ........
  2273. ' ........
  2274. ' .##.....
  2275. ' .##.....
  2276. ' ...##...
  2277. ' ...##...
  2278. ' ........
  2279. Sub DrawHomeLine8x8_NE_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2280.     ' DRAW WITH HORIZONTAL LINES
  2281.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  2282.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  2283.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2284.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2285. End Sub ' DrawHomeLine8x8_NE_3
  2286.  
  2287. ' /////////////////////////////////////////////////////////////////////////////
  2288. ' Draw this shape with Line commands:
  2289. ' ........
  2290. ' ...##...
  2291. ' ...##...
  2292. ' .....##.
  2293. ' .....##.
  2294. ' ........
  2295. ' ........
  2296. ' ........
  2297. Sub DrawHomeLine8x8_SW_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2298.     ' DRAW WITH HORIZONTAL LINES
  2299.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2300.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  2301.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  2302.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  2303. End Sub ' DrawHomeLine8x8_SW_3
  2304.  
  2305. ' /////////////////////////////////////////////////////////////////////////////
  2306. ' Draw this shape with Line commands:
  2307. ' ........
  2308. ' ...##...
  2309. ' ...##...
  2310. ' .##.....
  2311. ' .##.....
  2312. ' ........
  2313. ' ........
  2314. ' ........
  2315. Sub DrawHomeLine8x8_SE_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2316.     ' DRAW WITH HORIZONTAL LINES
  2317.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2318.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  2319.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  2320.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  2321. End Sub ' DrawHomeLine8x8_SE_3
  2322.  
  2323. ' /////////////////////////////////////////////////////////////////////////////
  2324. ' Draw this shape with Line commands:
  2325. ' ##..##..
  2326. ' ##..##..
  2327. ' ##..##..
  2328. ' ##..##..
  2329. ' ##..##..
  2330. ' ##..##..
  2331. ' ##..##..
  2332. ' ##..##..
  2333. Sub DrawJailLine8x8_VT_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2334.     ' DRAW WITH VERTICAL LINES
  2335.     Line (iX, iY)-(iX, iY + 7), fgColor
  2336.     Line (iX + 1, iY)-(iX + 1, iY + 7), fgColor
  2337.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2338.     Line (iX + 5, iY)-(iX + 5, iY + 7), fgColor
  2339. End Sub ' DrawJailLine8x8_VT_2
  2340.  
  2341. ' /////////////////////////////////////////////////////////////////////////////
  2342. ' Draw this shape with Line commands:
  2343. ' #.#.#.#.
  2344. ' #.#.#.#.
  2345. ' #.#.#.#.
  2346. ' #.#.#.#.
  2347. ' #.#.#.#.
  2348. ' #.#.#.#.
  2349. ' #.#.#.#.
  2350. ' #.#.#.#.
  2351. Sub DrawJailLine8x8_VT_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2352.     ' DRAW WITH VERTICAL LINES
  2353.     Line (iX, iY)-(iX, iY + 7), fgColor
  2354.     Line (iX + 2, iY)-(iX + 2, iY + 7), fgColor
  2355.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2356.     Line (iX + 6, iY)-(iX + 6, iY + 7), fgColor
  2357. End Sub ' DrawJailLine8x8_VT_1
  2358.  
  2359. ' /////////////////////////////////////////////////////////////////////////////
  2360. ' Draw this shape with Line commands:
  2361. ' ########
  2362. ' ########
  2363. ' ........
  2364. ' ........
  2365. ' ########
  2366. ' ########
  2367. ' ........
  2368. ' ........
  2369. Sub DrawJailLine8x8_HZ_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2370.     ' DRAW WITH HORIZONTAL LINES
  2371.     Line (iX, iY)-(iX + 7, iY), fgColor
  2372.     Line (iX, iY + 1)-(iX + 7, iY + 1), fgColor
  2373.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2374.     Line (iX, iY + 5)-(iX + 7, iY + 5), fgColor
  2375. End Sub ' DrawJailLine8x8_HZ_2
  2376.  
  2377. ' /////////////////////////////////////////////////////////////////////////////
  2378. ' Draw this shape with Line commands:
  2379. ' ########
  2380. ' ........
  2381. ' ########
  2382. ' ........
  2383. ' ########
  2384. ' ........
  2385. ' ########
  2386. ' ........
  2387. Sub DrawJailLine8x8_HZ_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2388.     ' DRAW WITH HORIZONTAL LINES
  2389.     Line (iX, iY)-(iX + 7, iY), fgColor
  2390.     Line (iX, iY + 2)-(iX + 7, iY + 2), fgColor
  2391.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2392.     Line (iX, iY + 6)-(iX + 7, iY + 6), fgColor
  2393. End Sub ' DrawJailLine8x8_HZ_1
  2394.  
  2395. ' /////////////////////////////////////////////////////////////////////////////
  2396. ' Draw this shape with Line commands:
  2397. ' #######.
  2398. ' #.#.#.#.
  2399. ' #######.
  2400. ' #.#.#.#.
  2401. ' #######.
  2402. ' #.#.#.#.
  2403. ' #######.
  2404. ' #.#.#.#.
  2405. Sub DrawJailLine8x8_Grid_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2406.     ' DRAW WITH VERTICAL LINES
  2407.     Line (iX, iY)-(iX, iY + 7), fgColor
  2408.     Line (iX + 2, iY)-(iX + 2, iY + 7), fgColor
  2409.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2410.     Line (iX + 6, iY)-(iX + 6, iY + 7), fgColor
  2411.  
  2412.     ' DRAW WITH HORIZONTAL LINES
  2413.     Line (iX, iY)-(iX + 7, iY), fgColor
  2414.     Line (iX, iY + 2)-(iX + 7, iY + 2), fgColor
  2415.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2416.     Line (iX, iY + 6)-(iX + 7, iY + 6), fgColor
  2417. End Sub ' DrawJailLine8x8_Grid_1
  2418.  
  2419. ' /////////////////////////////////////////////////////////////////////////////
  2420. ' Draw this shape with Line commands:
  2421. ' ...#...#
  2422. ' ...#...#
  2423. ' ...#...#
  2424. ' ########
  2425. ' ...#...#
  2426. ' ...#...#
  2427. ' ...#...#
  2428. ' ########
  2429. Sub DrawJailLine8x8_Grid_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2430.     ' DRAW WITH VERTICAL LINES
  2431.     Line (iX + 3, iY)-(iX + 3, iY + 7), fgColor
  2432.     Line (iX + 7, iY)-(iX + 7, iY + 7), fgColor
  2433.     ' DRAW WITH HORIZONTAL LINES
  2434.     Line (iX, iY + 3)-(iX + 7, iY + 3), fgColor
  2435.     Line (iX, iY + 7)-(iX + 7, iY + 7), fgColor
  2436. End Sub ' DrawJailLine8x8_Grid_2
  2437.  
  2438. ' /////////////////////////////////////////////////////////////////////////////
  2439. ' Draw this shape with Line commands:
  2440. ' ...##...
  2441. ' ...##...
  2442. ' ...##...
  2443. ' ########
  2444. ' ########
  2445. ' ...##...
  2446. ' ...##...
  2447. ' ...##...
  2448. Sub DrawJailLine8x8_Grid_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2449.     ' DRAW WITH VERTICAL LINES
  2450.     Line (iX + 3, iY)-(iX + 3, iY + 7), fgColor
  2451.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2452.     ' DRAW WITH HORIZONTAL LINES
  2453.     Line (iX, iY + 3)-(iX + 7, iY + 3), fgColor
  2454.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2455. End Sub ' DrawJailLine8x8_Grid_3
  2456.  
  2457. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2458. ' END GENERATED VECTOR TILE ROUTINES
  2459. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2460.  
  2461. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2462. ' BEGIN MANUALLY CREATED VECTOR TILE ROUTINES
  2463. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2464.  
  2465. ' /////////////////////////////////////////////////////////////////////////////
  2466. ' Fastest!
  2467.  
  2468. Sub DrawUpArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2469.     Dim iStartX As Integer: iStartX = iX + 3
  2470.     Line (iStartX, iY)-(iStartX, iY + 7), fgColor
  2471.     Line (iStartX, iY)-(iX, iY + 3), fgColor
  2472.     Line (iStartX, iY)-(iStartX + 3, iY + 3), fgColor
  2473. End Sub ' DrawUpArrowLine_8x8
  2474.  
  2475. ' /////////////////////////////////////////////////////////////////////////////
  2476. ' Fastest!
  2477.  
  2478. Sub DrawDownArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2479.     Dim iStartX As Integer: iStartX = iX + 3
  2480.     Line (iStartX, iY)-(iStartX, iY + 7), fgColor
  2481.     Line (iStartX, iY + 7)-(iX, iY + 4), fgColor
  2482.     Line (iStartX, iY + 7)-(iStartX + 3, iY + 4), fgColor
  2483. End Sub ' DrawDownArrowLine_8x8
  2484.  
  2485. ' /////////////////////////////////////////////////////////////////////////////
  2486. ' Fastest!
  2487.  
  2488. Sub DrawLeftArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2489.     Dim iStartY As Integer: iStartY = iY + 3
  2490.     Line (iX, iStartY)-(iX + 7, iStartY), fgColor
  2491.     Line (iX, iStartY)-(iX + 3, iY), fgColor
  2492.     Line (iX, iStartY)-(iX + 3, iStartY + 3), fgColor
  2493. End Sub ' DrawLeftArrowLine_8x8
  2494.  
  2495. ' /////////////////////////////////////////////////////////////////////////////
  2496. ' Fastest!
  2497.  
  2498. Sub DrawRightArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2499.     Dim iStartY As Integer: iStartY = iY + 3
  2500.     Line (iX, iStartY)-(iX + 7, iStartY), fgColor
  2501.     Line (iX + 7, iStartY)-(iX + 4, iY), fgColor
  2502.     Line (iX + 7, iStartY)-(iX + 4, iStartY + 3), fgColor
  2503. End Sub ' DrawRightArrowLine_8x8
  2504.  
  2505. ' /////////////////////////////////////////////////////////////////////////////
  2506. ' This uses PSET to draw the arrow pixel-by-pixel
  2507. ' PSET = second fastest method after Line.
  2508.  
  2509. ' PSET (X, Y), Color
  2510. ' draw will start where pset leaves off
  2511.  
  2512. Sub DrawLeftArrowPset_8x8 (iX As Long, iY As Long, fgColor As _Unsigned Long)
  2513.     Dim iLoopX As Integer
  2514.     Dim iLoopY As Integer
  2515.     For iLoopX = iX To iX + 7: PSet (iLoopX, iY), fgColor: Next iLoopX
  2516.     PSet (iX + 1, iY - 1), fgColor
  2517.     PSet (iX + 2, iY - 2), fgColor
  2518.     PSet (iX + 3, iY - 3), fgColor
  2519.     PSet (iX + 1, iY + 1), fgColor
  2520.     PSet (iX + 2, iY + 2), fgColor
  2521.     PSet (iX + 3, iY + 3), fgColor
  2522. End Sub ' DrawLeftArrowPset_8x8
  2523.  
  2524. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2525. ' END MANUALLY CREATED VECTOR TILE ROUTINES
  2526. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2527.  
  2528. ' ################################################################################################################################################################
  2529. ' END MISC GRAPHICS ROUTINES
  2530. ' ################################################################################################################################################################
  2531.  
  2532. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2533. ' BEGIN STRING TO ARRAY FUNCTIONS
  2534. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2535.  
  2536. ' /////////////////////////////////////////////////////////////////////////////
  2537.  
  2538. ' Usage:
  2539. ' Dim StringArray(1 To 48, 1 To 128) As String
  2540. ' StringToArray StringArray(), GetMap$
  2541.  
  2542. ' version 2 with indexed array(row, columm)
  2543.  
  2544. Sub StringToArray (MyArray() As String, MyString As String)
  2545.     Dim sDelim As String
  2546.     ReDim arrLines(0) As String
  2547.     Dim iRow As Integer
  2548.     Dim iCol As Integer
  2549.     Dim sChar As String
  2550.     Dim iDim1 As Integer
  2551.     Dim iDim2 As Integer
  2552.     Dim iIndex1 As Integer
  2553.     Dim iIndex2 As Integer
  2554.  
  2555.     iDim1 = LBound(MyArray, 1)
  2556.     iDim2 = LBound(MyArray, 2)
  2557.     sDelim = Chr$(13)
  2558.     split MyString, sDelim, arrLines()
  2559.     For iRow = LBound(arrLines) To UBound(arrLines)
  2560.         If iRow <= UBound(MyArray, 1) Then
  2561.             For iCol = 1 To Len(arrLines(iRow))
  2562.                 If iCol <= UBound(MyArray, 2) Then
  2563.                     sChar = Mid$(arrLines(iRow), iCol, 1)
  2564.  
  2565.                     If Len(sChar) > 1 Then
  2566.                         sChar = Left$(sChar, 1)
  2567.                     Else
  2568.                         If Len(sChar) = 0 Then
  2569.                             sChar = "."
  2570.                         End If
  2571.                     End If
  2572.  
  2573.                     iIndex1 = iRow + iDim1
  2574.                     iIndex2 = (iCol - 1) + iDim2
  2575.                     MyArray(iIndex1, iIndex2) = sChar
  2576.                     ''DebugPrint "MyArray(" + cstr$(iIndex1) + ", " + cstr$(iIndex2) + " = " + chr$(34) + sChar + chr$(34)
  2577.                 Else
  2578.                     ' Exit if out of bounds
  2579.                     Exit For
  2580.                 End If
  2581.             Next iCol
  2582.         Else
  2583.             ' Exit if out of bounds
  2584.             Exit For
  2585.         End If
  2586.     Next iRow
  2587. End Sub ' StringToArray
  2588.  
  2589. ' /////////////////////////////////////////////////////////////////////////////
  2590.  
  2591. Function Array2dToString$ (MyArray() As String)
  2592.     Dim MyString As String
  2593.     Dim iY As Integer
  2594.     Dim iX As Integer
  2595.     Dim sLine As String
  2596.     MyString = ""
  2597.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  2598.         sLine = ""
  2599.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  2600.             sLine = sLine + MyArray(iY, iX)
  2601.         Next iX
  2602.         MyString = MyString + sLine + Chr$(13)
  2603.     Next iY
  2604.     Array2dToString$ = MyString
  2605. End Function ' Array2dToString$
  2606.  
  2607. ' /////////////////////////////////////////////////////////////////////////////
  2608.  
  2609. Function ArrayToString$ (MyArray( 1 To 32 , 1 To 32) As String)
  2610.     Dim MyString As String
  2611.     Dim iY As Integer
  2612.     Dim iX As Integer
  2613.     Dim sLine As String
  2614.     MyString = ""
  2615.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  2616.         sLine = ""
  2617.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  2618.             sLine = sLine + MyArray(iY, iX)
  2619.         Next iX
  2620.         MyString = MyString + sLine + Chr$(13)
  2621.     Next iY
  2622.     ArrayToString$ = MyString
  2623. End Function ' ArrayToString$
  2624.  
  2625. ' /////////////////////////////////////////////////////////////////////////////
  2626.  
  2627. Function ArrayToStringTest$ (MyArray() As String)
  2628.     Dim MyString As String
  2629.     Dim iY As Integer
  2630.     Dim iX As Integer
  2631.     Dim sLine As String
  2632.     MyString = ""
  2633.  
  2634.     MyString = MyString + "           11111111112222222222333" + Chr$(13)
  2635.     MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  2636.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  2637.         sLine = ""
  2638.         sLine = sLine + Right$("  " + cstr$(iY), 2)
  2639.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  2640.             sLine = sLine + MyArray(iY, iX)
  2641.         Next iX
  2642.         sLine = sLine + Right$("  " + cstr$(iY), 2)
  2643.         MyString = MyString + sLine + Chr$(13)
  2644.     Next iY
  2645.     MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  2646.     MyString = MyString + "           11111111112222222222333" + Chr$(13)
  2647.     ArrayToStringTest$ = MyString
  2648. End Function ' ArrayToStringTest$
  2649.  
  2650. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2651. ' END STRING TO ARRAY FUNCTIONS
  2652. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2653.  
  2654. ' ################################################################################################################################################################
  2655. ' BEGIN TILE UTILITIES
  2656. ' ################################################################################################################################################################
  2657.  
  2658. ' /////////////////////////////////////////////////////////////////////////////
  2659. ' Precalculates the tile locations ahead of time to save time copying them
  2660. ' to the screen.
  2661.  
  2662. ' Requires the following types be declared:
  2663. '
  2664. '     Type TileSheetMapType ' UDT FOR PRECALCULATED TILESHEET
  2665. '         xStart As Integer
  2666. '         xEnd As Integer
  2667. '         yStart As Integer
  2668. '         yEnd As Integer
  2669. '     End Type
  2670. '     Type TileMapType ' UDT FOR PRECALCULATED TILE MAP
  2671. '         xPos As Integer
  2672. '         yPos As Integer
  2673. '     End Type
  2674. '
  2675. ' EXAMPLE USAGE:
  2676. '
  2677. '     Dim TileCount%
  2678. '     Dim TilesheetCols%
  2679. '     Dim TilesheetRows%
  2680. '     Dim tileHeightPx%
  2681. '     Dim tileWidthPx%
  2682. '     Dim xOffset%
  2683. '     Dim yOffset%
  2684. '     Dim numTilesX%
  2685. '     Dim numTilesY%
  2686. '     REDIM arrTileSheetMap(255) AS TileSheetMapType
  2687. '     REDIM arrTileMap(20, 20) AS TileMapType
  2688. '     TileCount% = 256 ' TOTAL # OF TILES
  2689. '     TilesheetCols% = 16 ' # OF COLUMNS ON SOURCE TILE SHEET
  2690. '     TilesheetRows% = 16 ' # OF ROWS    ON SOURCE TILE SHEET
  2691. '     tileHeightPx% = 32 ' TILE HEIGHT
  2692. '     tileWidthPx% = 32 ' TILE WIDTH
  2693. '     xOffset% = 0 ' SCREEN OFFSET X
  2694. '     yOffset% = 64 ' SCREEN OFFSET Y
  2695. '     numTilesX% = 20 ' HOW MANY TILES ACROSS (ON DESTINATION)
  2696. '     numTilesY% = 20 ' HOW MANY TILES UP/DOWN (ON DESTINATION)
  2697. '     ComputeTileLocations arrTileSheetMap(), arrTileMap(), TileCount%, _
  2698. '         TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, _
  2699. '         xOffset%, yOffset%, numTilesX%, numTilesY%
  2700.  
  2701. ' TODO: this can be simplified & optimized:
  2702. '       - we don't need x/y offsets
  2703. '       - tile height/width can be hardcoded
  2704. '       - etc.
  2705.  
  2706. Sub ComputeTileLocations (arrTileSheetMap() As TileSheetMapType, arrTileMap() As TileMapType, TileCount%, TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, xOffset%, yOffset%, numTilesX%, numTilesY%)
  2707.     Dim TileNum%
  2708.     Dim sc%
  2709.     Dim sr%
  2710.     Dim sx1%
  2711.     Dim sx2%
  2712.     Dim sy1%
  2713.     Dim sy2%
  2714.  
  2715.     Dim dx%
  2716.     Dim dy%
  2717.     Dim xDest%
  2718.     Dim yDest%
  2719.  
  2720.     ' -----------------------------------------------------------------------------
  2721.     ' CALCULATE TILE SHEET COORDINATES FOR TILES 0-255
  2722.  
  2723.     For TileNum% = 0 To (TileCount% - 1)
  2724.  
  2725.         ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  2726.         sc% = TileNum% Mod TilesheetCols%
  2727.         sr% = TileNum% \ TilesheetRows%
  2728.  
  2729.         'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  2730.  
  2731.         ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2732.         'sx1% = sc% * tw%
  2733.         sx1% = sc% * tileWidthPx%
  2734.  
  2735.         ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2736.         'sy1% = sr% * tw%
  2737.         sy1% = sr% * tileHeightPx%
  2738.  
  2739.         ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2740.         'sx2% = sx1% + (tw% - 1)
  2741.         sx2% = sx1% + (tileWidthPx% - 1)
  2742.  
  2743.         ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2744.         'sy2% = sy1% + (tw% - 1)
  2745.         sy2% = sy1% + (tileHeightPx% - 1)
  2746.  
  2747.         ' SAVE THE COORDINATES FOR TileNum% IN THE ARRAY
  2748.         arrTileSheetMap(TileNum%).xStart = sx1%
  2749.         arrTileSheetMap(TileNum%).xEnd = sx2%
  2750.         arrTileSheetMap(TileNum%).yStart = sy1%
  2751.         arrTileSheetMap(TileNum%).yEnd = sy2%
  2752.  
  2753.     Next TileNum%
  2754.  
  2755.     ' -----------------------------------------------------------------------------
  2756.     ' CALCULATE SCREEN COORDINATES FOR TILES
  2757.  
  2758.     For dx% = 0 To (numTilesX% - 1)
  2759.         For dy% = 0 To (numTilesY% - 1)
  2760.  
  2761.             ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2762.             'xDest% = dx% * tw%
  2763.             xDest% = (dx% * tileWidthPx%) + xOffset%
  2764.  
  2765.             ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2766.             'yDest% = (dy% * tw%) + 64
  2767.             yDest% = (dy% * tileHeightPx%) + yOffset%
  2768.  
  2769.             'Print "Tile#" + cstr$(TileNum%) + " at r" + cstr$(sr%) + "c" + cstr$(sc%) + " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  2770.  
  2771.             ' SAVE THE SCREEN PIXEL COORDINATES FOR dx%, dy% IN THE ARRAY
  2772.             ' WHERE dx% and dy% ARE 1-BASED
  2773.             arrTileMap(dx% + 1, dy% + 1).xPos = xDest%
  2774.             arrTileMap(dx% + 1, dy% + 1).yPos = yDest%
  2775.  
  2776.         Next dy%
  2777.     Next dx%
  2778.  
  2779. End Sub ' ComputeTileLocations
  2780.  
  2781. ' /////////////////////////////////////////////////////////////////////////////
  2782. ' Latest version with NOVARSEG's changes.
  2783.  
  2784. ' Based on code from:
  2785.  
  2786. ' Image color swap?
  2787. ' https://www.qb64.org/forum/index.php?topic=2312.0
  2788.  
  2789. ' Like Function swapcolor& except returns new image in a parameter
  2790. ' in case being a function causes a memory leak?
  2791.  
  2792. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  2793.     Dim m As _MEM
  2794.     Dim a As _Offset
  2795.     a = 0
  2796.     imgNew& = _CopyImage(imgOriginal&, 32)
  2797.     m = _MemImage(imgNew&)
  2798.     Do Until a = m.SIZE - 4
  2799.         a = a + 4
  2800.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  2801.         If c = oldcolor~& Then
  2802.             _MemPut m, m.OFFSET + a, newcolor~&
  2803.         End If
  2804.     Loop
  2805.     _MemFree m
  2806. End Sub ' DoColorSwap&
  2807.  
  2808. ' ################################################################################################################################################################
  2809. ' END TILE UTILITIES
  2810. ' ################################################################################################################################################################
  2811.  
  2812. ' ################################################################################################################################################################
  2813. ' BEGIN HELPER ROUTINES
  2814. ' ################################################################################################################################################################
  2815.  
  2816. ' /////////////////////////////////////////////////////////////////////////////
  2817. ' div: int1% = num1% \ den1%
  2818. ' mod: rem1% = num1% MOD den1%
  2819.  
  2820. Function NextColorIndex% (iX As Integer, iY As Integer)
  2821.     Dim iIndex As Integer
  2822.     Dim iAdd As Integer
  2823.     iOut = (iX Mod 4)
  2824.     iAdd = (iY Mod 4)
  2825.     NextColorIndex% = iOut + iAdd + 1
  2826. End Function ' NextColorIndex%
  2827.  
  2828. ' /////////////////////////////////////////////////////////////////////////////
  2829. ' Pauses for iDS deciseconds (iDS * 100 ms)
  2830.  
  2831. Sub PauseDecisecond (iDS As Integer)
  2832.     Dim iCount As Integer
  2833.     iCount = 0
  2834.     Do
  2835.         iCount = iCount + 1
  2836.         _Limit 10 ' run 10x every second
  2837.     Loop Until iCount = iDS
  2838. End Sub ' PauseDecisecond
  2839.  
  2840. ' /////////////////////////////////////////////////////////////////////////////
  2841. ' Returns TRUE if point (x1%, y1%) is adjacent to point (x2%, y2%)
  2842.  
  2843. Function PointsAreAdjacent% (x1%, y1%, x2%, y2%)
  2844.     Dim bResult%: bResult% = FALSE
  2845.  
  2846.     ' x or y can be the same, but not both
  2847.     If (x1% <> x2%) Or (y1% <> y2%) Then
  2848.         If (x1% = x2%) Or ((x1% = (x2% + 1)) Or (x2% = (x1% + 1))) Then
  2849.             If (y1% = y2%) Or ((y1% = (y2% + 1)) Or (y2% = (y1% + 1))) Then
  2850.                 bResult% = TRUE
  2851.             End If
  2852.         End If
  2853.     End If
  2854.     PointsAreAdjacent% = bResult%
  2855. End Function ' PointsAreAdjacent%
  2856.  
  2857. ' ################################################################################################################################################################
  2858. ' END HELPER ROUTINES
  2859. ' ################################################################################################################################################################
  2860.  
  2861. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2862. ' BEGIN COLOR ARRAY FUNCTIONS
  2863. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2864.  
  2865. ' /////////////////////////////////////////////////////////////////////////////
  2866.  
  2867. Sub AddColor (ColorValue As _Unsigned Long, ColorName As String, arrColor() As ColorType)
  2868.     ReDim _Preserve arrColor(0 To UBound(arrColor) + 1) As ColorType
  2869.     arrColor(UBound(arrColor)).name = ColorName
  2870.     arrColor(UBound(arrColor)).value = ColorValue
  2871. End Sub ' AddColor
  2872.  
  2873. ' /////////////////////////////////////////////////////////////////////////////
  2874.  
  2875. Sub AddColors (arrColor() As ColorType)
  2876.     AddColor cBlack, "cBlack", arrColor()
  2877.     AddColor cGray, "cGray", arrColor()
  2878.     AddColor cSilver, "cSilver", arrColor()
  2879.     AddColor cWhite, "cWhite", arrColor()
  2880.     AddColor cRed, "cRed", arrColor()
  2881.     AddColor cOrangeRed, "cOrangeRed", arrColor()
  2882.     AddColor cYellow, "cYellow", arrColor()
  2883.     AddColor cLime, "cLime", arrColor()
  2884.     AddColor cCyan, "cCyan", arrColor()
  2885.     AddColor cDodgerBlue, "cDodgerBlue", arrColor()
  2886.     AddColor cBlue, "cBlue", arrColor()
  2887.     AddColor cDeepPurple, "cDeepPurple", arrColor()
  2888.     AddColor cDarkGreen, "cDarkGreen", arrColor()
  2889.     AddColor cMagenta, "cMagenta", arrColor()
  2890.     AddColor cHotPink, "cHotPink", arrColor()
  2891.     AddColor cDarkBrown, "cDarkBrown", arrColor()
  2892.     AddColor cEmpty, "cEmpty", arrColor()
  2893. End Sub ' AddColors
  2894.  
  2895. ' /////////////////////////////////////////////////////////////////////////////
  2896.  
  2897. Sub AddGrayscaleColors (arrColor() As ColorType)
  2898.     'AddColor cBlack, "cBlack", arrColor()
  2899.     AddColor cDimGray, "cDimGray", arrColor()
  2900.     AddColor cGray, "cGray", arrColor()
  2901.     AddColor cDarkGray, "cDarkGray", arrColor()
  2902.     AddColor cSilver, "cSilver", arrColor()
  2903.     AddColor cLightGray, "cLightGray", arrColor()
  2904.     AddColor cWhite, "cGainsboro", arrColor()
  2905.     AddColor cWhite, "cWhiteSmoke", arrColor()
  2906.     AddColor cWhite, "cWhite", arrColor()
  2907. End Sub ' AddGrayscaleColors
  2908.  
  2909. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2910. ' END COLOR ARRAY FUNCTIONS
  2911. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2912.  
  2913. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2914. ' BEGIN COLOR FUNCTIONS
  2915. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2916.  
  2917. Function cRed~& ()
  2918.     cRed = _RGB32(255, 0, 0)
  2919.  
  2920. Function cOrangeRed~& ()
  2921.     cOrangeRed = _RGB32(255, 69, 0)
  2922. End Function ' cOrangeRed~&
  2923.  
  2924. Function cDarkOrange~& ()
  2925.     cDarkOrange = _RGB32(255, 140, 0)
  2926. End Function ' cDarkOrange~&
  2927.  
  2928. Function cOrange~& ()
  2929.     cOrange = _RGB32(255, 165, 0)
  2930. End Function ' cOrange~&
  2931.  
  2932. Function cGold~& ()
  2933.     cGold = _RGB32(255, 215, 0)
  2934. End Function ' cGold~&
  2935.  
  2936. Function cYellow~& ()
  2937.     cYellow = _RGB32(255, 255, 0)
  2938. End Function ' cYellow~&
  2939.  
  2940. 'Function cChartreuse~& ()
  2941. '    cChartreuse = _RGB32(127, 255, 0)
  2942. 'End Function ' cChartreuse~&
  2943.  
  2944. ' WE USE THIS CSS3 COLOR FOR INBETWEEN LIME AND YELLOW
  2945. ' INSTEAD OF Chartreuse WHICH IS NOT YELLOW ENOUGH
  2946. Function cOliveDrab1~& ()
  2947.     cOliveDrab1 = _RGB32(192, 255, 62)
  2948. End Function ' cOliveDrab1~&
  2949.  
  2950. Function cLime~& ()
  2951.     cLime = _RGB32(0, 255, 0)
  2952. End Function ' cLime~&
  2953.  
  2954. Function cMediumSpringGreen~& ()
  2955.     cMediumSpringGreen = _RGB32(0, 250, 154)
  2956. End Function ' cMediumSpringGreen~&
  2957.  
  2958. Function cCyan~& ()
  2959.     cCyan = _RGB32(0, 255, 255)
  2960. End Function ' cCyan~&
  2961.  
  2962. Function cDeepSkyBlue~& ()
  2963.     cDeepSkyBlue = _RGB32(0, 191, 255)
  2964. End Function ' cDeepSkyBlue~&
  2965.  
  2966. Function cDodgerBlue~& ()
  2967.     cDodgerBlue = _RGB32(30, 144, 255)
  2968. End Function ' cDodgerBlue~&
  2969.  
  2970. Function cSeaBlue~& ()
  2971.     cSeaBlue = _RGB32(0, 64, 255)
  2972. End Function ' cSeaBlue~&
  2973.  
  2974. Function cBlue~& ()
  2975.     cBlue = _RGB32(0, 0, 255)
  2976. End Function ' cBlue~&
  2977.  
  2978. Function cBluePurple~& ()
  2979.     cBluePurple = _RGB32(64, 0, 255)
  2980. End Function ' cBluePurple~&
  2981.  
  2982. Function cDeepPurple~& ()
  2983.     cDeepPurple = _RGB32(96, 0, 255)
  2984. End Function ' cDeepPurple~&
  2985.  
  2986. Function cPurple~& ()
  2987.     cPurple = _RGB32(128, 0, 255)
  2988. End Function ' cPurple~&
  2989.  
  2990. Function cPurpleRed~& ()
  2991.     cPurpleRed = _RGB32(128, 0, 192)
  2992. End Function ' cPurpleRed~&
  2993.  
  2994. Function cDarkRed~& ()
  2995.     cDarkRed = _RGB32(160, 0, 64)
  2996. End Function ' cDarkRed~&
  2997.  
  2998. Function cBrickRed~& ()
  2999.     cBrickRed = _RGB32(192, 0, 32)
  3000. End Function ' cBrickRed~&
  3001.  
  3002. Function cDarkGreen~& ()
  3003.     cDarkGreen = _RGB32(0, 100, 0)
  3004. End Function ' cDarkGreen~&
  3005.  
  3006. Function cGreen~& ()
  3007.     cGreen = _RGB32(0, 128, 0)
  3008. End Function ' cGreen~&
  3009.  
  3010. Function cOliveDrab~& ()
  3011.     cOliveDrab = _RGB32(107, 142, 35)
  3012. End Function ' cOliveDrab~&
  3013.  
  3014. Function cLightPink~& ()
  3015.     cLightPink = _RGB32(255, 182, 193)
  3016. End Function ' cLightPink~&
  3017.  
  3018. Function cHotPink~& ()
  3019.     cHotPink = _RGB32(255, 105, 180)
  3020. End Function ' cHotPink~&
  3021.  
  3022. Function cDeepPink~& ()
  3023.     cDeepPink = _RGB32(255, 20, 147)
  3024. End Function ' cDeepPink~&
  3025.  
  3026. Function cMagenta~& ()
  3027.     cMagenta = _RGB32(255, 0, 255)
  3028. End Function ' cMagenta~&
  3029.  
  3030. Function cBlack~& ()
  3031.     cBlack = _RGB32(0, 0, 0)
  3032. End Function ' cBlack~&
  3033.  
  3034. Function cDimGray~& ()
  3035.     cDimGray = _RGB32(105, 105, 105)
  3036. End Function ' cDimGray~&
  3037.  
  3038. Function cGray~& ()
  3039.     cGray = _RGB32(128, 128, 128)
  3040. End Function ' cGray~&
  3041.  
  3042. Function cDarkGray~& ()
  3043.     cDarkGray = _RGB32(169, 169, 169)
  3044. End Function ' cDarkGray~&
  3045.  
  3046. Function cSilver~& ()
  3047.     cSilver = _RGB32(192, 192, 192)
  3048. End Function ' cSilver~&
  3049.  
  3050. Function cLightGray~& ()
  3051.     cLightGray = _RGB32(211, 211, 211)
  3052. End Function ' cLightGray~&
  3053.  
  3054. Function cGainsboro~& ()
  3055.     cGainsboro = _RGB32(220, 220, 220)
  3056. End Function ' cGainsboro~&
  3057.  
  3058. Function cWhiteSmoke~& ()
  3059.     cWhiteSmoke = _RGB32(245, 245, 245)
  3060. End Function ' cWhiteSmoke~&
  3061.  
  3062. Function cWhite~& ()
  3063.     cWhite = _RGB32(255, 255, 255)
  3064.     'cWhite = _RGB32(254, 254, 254)
  3065. End Function ' cWhite~&
  3066.  
  3067. Function cDarkBrown~& ()
  3068.     cDarkBrown = _RGB32(128, 64, 0)
  3069. End Function ' cDarkBrown~&
  3070.  
  3071. Function cLightBrown~& ()
  3072.     cLightBrown = _RGB32(196, 96, 0)
  3073. End Function ' cLightBrown~&
  3074.  
  3075. Function cKhaki~& ()
  3076.     cKhaki = _RGB32(240, 230, 140)
  3077. End Function ' cKhaki~&
  3078.  
  3079. Function cEmpty~& ()
  3080.     'cEmpty~& = -1
  3081.     cEmpty = _RGB32(0, 0, 0, 0)
  3082. End Function ' cEmpty~&
  3083.  
  3084. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3085. ' END COLOR FUNCTIONS
  3086. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3087.  
  3088. ' ################################################################################################################################################################
  3089. ' BEGIN GENERAL PURPOSE ROUTINES
  3090. ' ################################################################################################################################################################
  3091.  
  3092. ' /////////////////////////////////////////////////////////////////////////////
  3093. ' Convert a value to string and trim it (because normal Str$ adds spaces)
  3094.  
  3095. Function cstr$ (myValue)
  3096.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  3097.     cstr$ = _Trim$(Str$(myValue))
  3098. End Function ' cstr$
  3099.  
  3100. ' /////////////////////////////////////////////////////////////////////////////
  3101.  
  3102. Function CurrentDateTime$
  3103.     CurrentDateTime$ = Mid$(Date$, 7, 4) + "-" + _
  3104.         Mid$(Date$, 1, 5) + " " + _
  3105.         Time$
  3106. End Function ' CurrentDateTime$
  3107.  
  3108. ' /////////////////////////////////////////////////////////////////////////////
  3109.  
  3110. Function IIF (Condition, IfTrue, IfFalse)
  3111.     If Condition Then IIF = IfTrue Else IIF = IfFalse
  3112.  
  3113. ' /////////////////////////////////////////////////////////////////////////////
  3114.  
  3115. Function IIFSTR$ (Condition, IfTrue$, IfFalse$)
  3116.     If Condition Then IIFSTR$ = IfTrue$ Else IIFSTR$ = IfFalse$
  3117.  
  3118. ' /////////////////////////////////////////////////////////////////////////////
  3119. ' By sMcNeill from https://www.qb64.org/forum/index.php?topic=896.0
  3120.  
  3121. Function IsNum% (text$)
  3122.     Dim a$
  3123.     Dim b$
  3124.     a$ = _Trim$(text$)
  3125.     b$ = _Trim$(Str$(Val(text$)))
  3126.     If a$ = b$ Then
  3127.         IsNum% = TRUE
  3128.     Else
  3129.         IsNum% = FALSE
  3130.     End If
  3131. End Function ' IsNum%
  3132.  
  3133. ' /////////////////////////////////////////////////////////////////////////////
  3134. ' FROM: String Manipulation
  3135. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  3136. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  3137. '
  3138. 'SUMMARY:
  3139. '   Purpose:  A library of custom functions that transform strings.
  3140. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  3141. '   Platform: QB64 (www.qb64.org)
  3142. '   Revision: 1.6
  3143. '   Updated:  5/28/2012
  3144.  
  3145. 'SUMMARY:
  3146. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  3147. 'INPUT:
  3148. 'Text: The input string; the text that's being manipulated.
  3149. 'Find: The specified sub-string; the string sought within the [Text] string.
  3150. 'Add: The sub-string that's being added to the [Text] string.
  3151.  
  3152. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  3153.     ' VARIABLES:
  3154.     Dim Text2 As String
  3155.     Dim Find2 As String
  3156.     Dim Add2 As String
  3157.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  3158.     Dim strBefore As String ' The characters before the string to be replaced.
  3159.     Dim strAfter As String ' The characters after the string to be replaced.
  3160.  
  3161.     ' INITIALIZE:
  3162.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  3163.     Text2 = Text1
  3164.     Find2 = Find1
  3165.     Add2 = Add1
  3166.  
  3167.     lngLocation = InStr(1, Text2, Find2)
  3168.  
  3169.     ' PROCESSING:
  3170.     ' While [Find2] appears in [Text2]...
  3171.     While lngLocation
  3172.         ' Extract all Text2 before the [Find2] substring:
  3173.         strBefore = Left$(Text2, lngLocation - 1)
  3174.  
  3175.         ' Extract all text after the [Find2] substring:
  3176.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  3177.  
  3178.         ' Return the substring:
  3179.         Text2 = strBefore + Add2 + strAfter
  3180.  
  3181.         ' Locate the next instance of [Find2]:
  3182.         lngLocation = InStr(1, Text2, Find2)
  3183.  
  3184.         ' Next instance of [Find2]...
  3185.     Wend
  3186.  
  3187.     ' OUTPUT:
  3188.     Replace$ = Text2
  3189. End Function ' Replace$
  3190.  
  3191. ' /////////////////////////////////////////////////////////////////////////////
  3192. ' Split and join strings
  3193. ' https://www.qb64.org/forum/index.php?topic=1073.0
  3194. '
  3195. ' FROM luke, QB64 Developer
  3196. ' Date: February 15, 2019, 04:11:07 AM
  3197. '
  3198. ' Given a string of words separated by spaces (or any other character),
  3199. ' splits it into an array of the words. I've no doubt many people have
  3200. ' written a version of this over the years and no doubt there's a million
  3201. ' ways to do it, but I thought I'd put mine here so we have at least one
  3202. ' version. There's also a join function that does the opposite
  3203. ' array -> single string.
  3204. '
  3205. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  3206. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  3207.  
  3208. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  3209. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  3210. '
  3211. 'delimiter$ must be one character long.
  3212. 'result$() must have been REDIMmed previously.
  3213.  
  3214. ' Modified to handle multi-character delimiters
  3215.  
  3216. Sub split (in$, delimiter$, result$())
  3217.     Dim start As Integer
  3218.     Dim finish As Integer
  3219.     Dim iDelimLen As Integer
  3220.     ReDim result$(-1)
  3221.  
  3222.     iDelimLen = Len(delimiter$)
  3223.  
  3224.     start = 1
  3225.     Do
  3226.         'While Mid$(in$, start, 1) = delimiter$
  3227.         While Mid$(in$, start, iDelimLen) = delimiter$
  3228.             'start = start + 1
  3229.             start = start + iDelimLen
  3230.             If start > Len(in$) Then
  3231.                 Exit Sub
  3232.             End If
  3233.         Wend
  3234.         finish = InStr(start, in$, delimiter$)
  3235.         If finish = 0 Then
  3236.             finish = Len(in$) + 1
  3237.         End If
  3238.  
  3239.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  3240.  
  3241.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  3242.         start = finish + 1
  3243.     Loop While start <= Len(in$)
  3244. End Sub ' split
  3245.  
  3246. ' /////////////////////////////////////////////////////////////////////////////
  3247.  
  3248. Function TrueFalse$ (myValue)
  3249.     If myValue = TRUE Then
  3250.         TrueFalse$ = "TRUE"
  3251.     Else
  3252.         TrueFalse$ = "FALSE"
  3253.     End If
  3254. End Function ' TrueFalse$
  3255.  
  3256. ' ################################################################################################################################################################
  3257. ' END GENERAL PURPOSE ROUTINES
  3258. ' ################################################################################################################################################################
  3259.  
  3260. ' ################################################################################################################################################################
  3261. ' BEGIN TILE DEFINITIONS
  3262. ' ################################################################################################################################################################
  3263.  
  3264. ' /////////////////////////////////////////////////////////////////////////////
  3265. ' Returns an array of 256 8x8 tiles defined in text
  3266. ' where each tile is defined by "." as blank and anything else is a pixel
  3267. ' and each row is delimited by chr$(13)
  3268.  
  3269. Sub GetTileText (arrTileText() As String)
  3270.     ReDim arrTileText(0 To 255) As String
  3271.  
  3272.     m$ = ""
  3273.     m$ = m$ + "22....22" + Chr$(13)
  3274.     m$ = m$ + "2..22..2" + Chr$(13)
  3275.     m$ = m$ + "2..2...2" + Chr$(13)
  3276.     m$ = m$ + "2...2..2" + Chr$(13)
  3277.     m$ = m$ + "2..22..2" + Chr$(13)
  3278.     m$ = m$ + "2..22..2" + Chr$(13)
  3279.     m$ = m$ + "22....22" + Chr$(13)
  3280.     m$ = m$ + "22222222" + Chr$(13)
  3281.     arrTileText(0) = m$
  3282.  
  3283.     m$ = ""
  3284.     m$ = m$ + "........" + Chr$(13)
  3285.     m$ = m$ + "........" + Chr$(13)
  3286.     m$ = m$ + "........" + Chr$(13)
  3287.     m$ = m$ + "........" + Chr$(13)
  3288.     m$ = m$ + "........" + Chr$(13)
  3289.     m$ = m$ + "........" + Chr$(13)
  3290.     m$ = m$ + "........" + Chr$(13)
  3291.     m$ = m$ + "........" + Chr$(13)
  3292.     arrTileText(1) = m$
  3293.  
  3294.     m$ = ""
  3295.     m$ = m$ + "........" + Chr$(13)
  3296.     m$ = m$ + "........" + Chr$(13)
  3297.     m$ = m$ + "........" + Chr$(13)
  3298.     m$ = m$ + "........" + Chr$(13)
  3299.     m$ = m$ + "........" + Chr$(13)
  3300.     m$ = m$ + "........" + Chr$(13)
  3301.     m$ = m$ + "........" + Chr$(13)
  3302.     m$ = m$ + "........" + Chr$(13)
  3303.     arrTileText(2) = m$
  3304.  
  3305.     m$ = ""
  3306.     m$ = m$ + "........" + Chr$(13)
  3307.     m$ = m$ + "........" + Chr$(13)
  3308.     m$ = m$ + "........" + Chr$(13)
  3309.     m$ = m$ + "........" + Chr$(13)
  3310.     m$ = m$ + "........" + Chr$(13)
  3311.     m$ = m$ + "........" + Chr$(13)
  3312.     m$ = m$ + "........" + Chr$(13)
  3313.     m$ = m$ + "........" + Chr$(13)
  3314.     arrTileText(3) = m$
  3315.  
  3316.     m$ = ""
  3317.     m$ = m$ + "........" + Chr$(13)
  3318.     m$ = m$ + "........" + Chr$(13)
  3319.     m$ = m$ + "........" + Chr$(13)
  3320.     m$ = m$ + "........" + Chr$(13)
  3321.     m$ = m$ + "........" + Chr$(13)
  3322.     m$ = m$ + "........" + Chr$(13)
  3323.     m$ = m$ + "........" + Chr$(13)
  3324.     m$ = m$ + "........" + Chr$(13)
  3325.     arrTileText(4) = m$
  3326.  
  3327.     m$ = ""
  3328.     m$ = m$ + "........" + Chr$(13)
  3329.     m$ = m$ + "........" + Chr$(13)
  3330.     m$ = m$ + "........" + Chr$(13)
  3331.     m$ = m$ + "........" + Chr$(13)
  3332.     m$ = m$ + "........" + Chr$(13)
  3333.     m$ = m$ + "........" + Chr$(13)
  3334.     m$ = m$ + "........" + Chr$(13)
  3335.     m$ = m$ + "........" + Chr$(13)
  3336.     arrTileText(5) = m$
  3337.  
  3338.     m$ = ""
  3339.     m$ = m$ + "........" + Chr$(13)
  3340.     m$ = m$ + "........" + Chr$(13)
  3341.     m$ = m$ + "........" + Chr$(13)
  3342.     m$ = m$ + "........" + Chr$(13)
  3343.     m$ = m$ + "........" + Chr$(13)
  3344.     m$ = m$ + "........" + Chr$(13)
  3345.     m$ = m$ + "........" + Chr$(13)
  3346.     m$ = m$ + "........" + Chr$(13)
  3347.     arrTileText(6) = m$
  3348.  
  3349.     m$ = ""
  3350.     m$ = m$ + "........" + Chr$(13)
  3351.     m$ = m$ + "........" + Chr$(13)
  3352.     m$ = m$ + "........" + Chr$(13)
  3353.     m$ = m$ + "........" + Chr$(13)
  3354.     m$ = m$ + "........" + Chr$(13)
  3355.     m$ = m$ + "........" + Chr$(13)
  3356.     m$ = m$ + "........" + Chr$(13)
  3357.     m$ = m$ + "........" + Chr$(13)
  3358.     arrTileText(7) = m$
  3359.  
  3360.     m$ = ""
  3361.     m$ = m$ + "........" + Chr$(13)
  3362.     m$ = m$ + "........" + Chr$(13)
  3363.     m$ = m$ + "........" + Chr$(13)
  3364.     m$ = m$ + "........" + Chr$(13)
  3365.     m$ = m$ + "........" + Chr$(13)
  3366.     m$ = m$ + "........" + Chr$(13)
  3367.     m$ = m$ + "........" + Chr$(13)
  3368.     m$ = m$ + "........" + Chr$(13)
  3369.     arrTileText(8) = m$
  3370.  
  3371.     m$ = ""
  3372.     m$ = m$ + "........" + Chr$(13)
  3373.     m$ = m$ + "........" + Chr$(13)
  3374.     m$ = m$ + "........" + Chr$(13)
  3375.     m$ = m$ + "........" + Chr$(13)
  3376.     m$ = m$ + "........" + Chr$(13)
  3377.     m$ = m$ + "........" + Chr$(13)
  3378.     m$ = m$ + "........" + Chr$(13)
  3379.     m$ = m$ + "........" + Chr$(13)
  3380.     arrTileText(9) = m$
  3381.  
  3382.     m$ = ""
  3383.     m$ = m$ + "........" + Chr$(13)
  3384.     m$ = m$ + "........" + Chr$(13)
  3385.     m$ = m$ + "........" + Chr$(13)
  3386.     m$ = m$ + "........" + Chr$(13)
  3387.     m$ = m$ + "........" + Chr$(13)
  3388.     m$ = m$ + "........" + Chr$(13)
  3389.     m$ = m$ + "........" + Chr$(13)
  3390.     m$ = m$ + "........" + Chr$(13)
  3391.     arrTileText(10) = m$
  3392.  
  3393.     m$ = ""
  3394.     m$ = m$ + "........" + Chr$(13)
  3395.     m$ = m$ + "........" + Chr$(13)
  3396.     m$ = m$ + "........" + Chr$(13)
  3397.     m$ = m$ + "........" + Chr$(13)
  3398.     m$ = m$ + "........" + Chr$(13)
  3399.     m$ = m$ + "........" + Chr$(13)
  3400.     m$ = m$ + "........" + Chr$(13)
  3401.     m$ = m$ + "........" + Chr$(13)
  3402.     arrTileText(11) = m$
  3403.  
  3404.     m$ = ""
  3405.     m$ = m$ + "........" + Chr$(13)
  3406.     m$ = m$ + "........" + Chr$(13)
  3407.     m$ = m$ + "........" + Chr$(13)
  3408.     m$ = m$ + "........" + Chr$(13)
  3409.     m$ = m$ + "........" + Chr$(13)
  3410.     m$ = m$ + "........" + Chr$(13)
  3411.     m$ = m$ + "........" + Chr$(13)
  3412.     m$ = m$ + "........" + Chr$(13)
  3413.     arrTileText(12) = m$
  3414.  
  3415.     m$ = ""
  3416.     m$ = m$ + "........" + Chr$(13)
  3417.     m$ = m$ + "........" + Chr$(13)
  3418.     m$ = m$ + "........" + Chr$(13)
  3419.     m$ = m$ + "........" + Chr$(13)
  3420.     m$ = m$ + "........" + Chr$(13)
  3421.     m$ = m$ + "........" + Chr$(13)
  3422.     m$ = m$ + "........" + Chr$(13)
  3423.     m$ = m$ + "........" + Chr$(13)
  3424.     arrTileText(13) = m$
  3425.  
  3426.     m$ = ""
  3427.     m$ = m$ + "........" + Chr$(13)
  3428.     m$ = m$ + "........" + Chr$(13)
  3429.     m$ = m$ + "........" + Chr$(13)
  3430.     m$ = m$ + "........" + Chr$(13)
  3431.     m$ = m$ + "........" + Chr$(13)
  3432.     m$ = m$ + "........" + Chr$(13)
  3433.     m$ = m$ + "........" + Chr$(13)
  3434.     m$ = m$ + "........" + Chr$(13)
  3435.     arrTileText(14) = m$
  3436.  
  3437.     m$ = ""
  3438.     m$ = m$ + "........" + Chr$(13)
  3439.     m$ = m$ + "........" + Chr$(13)
  3440.     m$ = m$ + "........" + Chr$(13)
  3441.     m$ = m$ + "........" + Chr$(13)
  3442.     m$ = m$ + "........" + Chr$(13)
  3443.     m$ = m$ + "........" + Chr$(13)
  3444.     m$ = m$ + "........" + Chr$(13)
  3445.     m$ = m$ + "........" + Chr$(13)
  3446.     arrTileText(15) = m$
  3447.  
  3448.     m$ = ""
  3449.     m$ = m$ + "........" + Chr$(13)
  3450.     m$ = m$ + "........" + Chr$(13)
  3451.     m$ = m$ + "........" + Chr$(13)
  3452.     m$ = m$ + "........" + Chr$(13)
  3453.     m$ = m$ + "........" + Chr$(13)
  3454.     m$ = m$ + "........" + Chr$(13)
  3455.     m$ = m$ + "........" + Chr$(13)
  3456.     m$ = m$ + "........" + Chr$(13)
  3457.     arrTileText(16) = m$
  3458.  
  3459.     m$ = ""
  3460.     m$ = m$ + "........" + Chr$(13)
  3461.     m$ = m$ + "........" + Chr$(13)
  3462.     m$ = m$ + "........" + Chr$(13)
  3463.     m$ = m$ + "........" + Chr$(13)
  3464.     m$ = m$ + "........" + Chr$(13)
  3465.     m$ = m$ + "........" + Chr$(13)
  3466.     m$ = m$ + "........" + Chr$(13)
  3467.     m$ = m$ + "........" + Chr$(13)
  3468.     arrTileText(17) = m$
  3469.  
  3470.     m$ = ""
  3471.     m$ = m$ + "........" + Chr$(13)
  3472.     m$ = m$ + "........" + Chr$(13)
  3473.     m$ = m$ + "........" + Chr$(13)
  3474.     m$ = m$ + "........" + Chr$(13)
  3475.     m$ = m$ + "........" + Chr$(13)
  3476.     m$ = m$ + "........" + Chr$(13)
  3477.     m$ = m$ + "........" + Chr$(13)
  3478.     m$ = m$ + "........" + Chr$(13)
  3479.     arrTileText(18) = m$
  3480.  
  3481.     m$ = ""
  3482.     m$ = m$ + "........" + Chr$(13)
  3483.     m$ = m$ + "........" + Chr$(13)
  3484.     m$ = m$ + "........" + Chr$(13)
  3485.     m$ = m$ + "........" + Chr$(13)
  3486.     m$ = m$ + "........" + Chr$(13)
  3487.     m$ = m$ + "........" + Chr$(13)
  3488.     m$ = m$ + "........" + Chr$(13)
  3489.     m$ = m$ + "........" + Chr$(13)
  3490.     arrTileText(19) = m$
  3491.  
  3492.     m$ = ""
  3493.     m$ = m$ + "........" + Chr$(13)
  3494.     m$ = m$ + "........" + Chr$(13)
  3495.     m$ = m$ + "........" + Chr$(13)
  3496.     m$ = m$ + "........" + Chr$(13)
  3497.     m$ = m$ + "........" + Chr$(13)
  3498.     m$ = m$ + "........" + Chr$(13)
  3499.     m$ = m$ + "........" + Chr$(13)
  3500.     m$ = m$ + "........" + Chr$(13)
  3501.     arrTileText(20) = m$
  3502.  
  3503.     m$ = ""
  3504.     m$ = m$ + "........" + Chr$(13)
  3505.     m$ = m$ + "........" + Chr$(13)
  3506.     m$ = m$ + "........" + Chr$(13)
  3507.     m$ = m$ + "........" + Chr$(13)
  3508.     m$ = m$ + "........" + Chr$(13)
  3509.     m$ = m$ + "........" + Chr$(13)
  3510.     m$ = m$ + "........" + Chr$(13)
  3511.     m$ = m$ + "........" + Chr$(13)
  3512.     arrTileText(21) = m$
  3513.  
  3514.     m$ = ""
  3515.     m$ = m$ + "........" + Chr$(13)
  3516.     m$ = m$ + "........" + Chr$(13)
  3517.     m$ = m$ + "........" + Chr$(13)
  3518.     m$ = m$ + "........" + Chr$(13)
  3519.     m$ = m$ + "........" + Chr$(13)
  3520.     m$ = m$ + "........" + Chr$(13)
  3521.     m$ = m$ + "........" + Chr$(13)
  3522.     m$ = m$ + "........" + Chr$(13)
  3523.     arrTileText(22) = m$
  3524.  
  3525.     m$ = ""
  3526.     m$ = m$ + "........" + Chr$(13)
  3527.     m$ = m$ + "........" + Chr$(13)
  3528.     m$ = m$ + "........" + Chr$(13)
  3529.     m$ = m$ + "........" + Chr$(13)
  3530.     m$ = m$ + "........" + Chr$(13)
  3531.     m$ = m$ + "........" + Chr$(13)
  3532.     m$ = m$ + "........" + Chr$(13)
  3533.     m$ = m$ + "........" + Chr$(13)
  3534.     arrTileText(23) = m$
  3535.  
  3536.     m$ = ""
  3537.     m$ = m$ + "........" + Chr$(13)
  3538.     m$ = m$ + "........" + Chr$(13)
  3539.     m$ = m$ + "........" + Chr$(13)
  3540.     m$ = m$ + "........" + Chr$(13)
  3541.     m$ = m$ + "........" + Chr$(13)
  3542.     m$ = m$ + "........" + Chr$(13)
  3543.     m$ = m$ + "........" + Chr$(13)
  3544.     m$ = m$ + "........" + Chr$(13)
  3545.     arrTileText(24) = m$
  3546.  
  3547.     m$ = ""
  3548.     m$ = m$ + "........" + Chr$(13)
  3549.     m$ = m$ + "........" + Chr$(13)
  3550.     m$ = m$ + "........" + Chr$(13)
  3551.     m$ = m$ + "........" + Chr$(13)
  3552.     m$ = m$ + "........" + Chr$(13)
  3553.     m$ = m$ + "........" + Chr$(13)
  3554.     m$ = m$ + "........" + Chr$(13)
  3555.     m$ = m$ + "........" + Chr$(13)
  3556.     arrTileText(25) = m$
  3557.  
  3558.     m$ = ""
  3559.     m$ = m$ + "........" + Chr$(13)
  3560.     m$ = m$ + "........" + Chr$(13)
  3561.     m$ = m$ + "........" + Chr$(13)
  3562.     m$ = m$ + "........" + Chr$(13)
  3563.     m$ = m$ + "........" + Chr$(13)
  3564.     m$ = m$ + "........" + Chr$(13)
  3565.     m$ = m$ + "........" + Chr$(13)
  3566.     m$ = m$ + "........" + Chr$(13)
  3567.     arrTileText(26) = m$
  3568.  
  3569.     m$ = ""
  3570.     m$ = m$ + "........" + Chr$(13)
  3571.     m$ = m$ + "........" + Chr$(13)
  3572.     m$ = m$ + "........" + Chr$(13)
  3573.     m$ = m$ + "........" + Chr$(13)
  3574.     m$ = m$ + "........" + Chr$(13)
  3575.     m$ = m$ + "........" + Chr$(13)
  3576.     m$ = m$ + "........" + Chr$(13)
  3577.     m$ = m$ + "........" + Chr$(13)
  3578.     arrTileText(27) = m$
  3579.  
  3580.     m$ = ""
  3581.     m$ = m$ + "........" + Chr$(13)
  3582.     m$ = m$ + "........" + Chr$(13)
  3583.     m$ = m$ + "........" + Chr$(13)
  3584.     m$ = m$ + "........" + Chr$(13)
  3585.     m$ = m$ + "........" + Chr$(13)
  3586.     m$ = m$ + "........" + Chr$(13)
  3587.     m$ = m$ + "........" + Chr$(13)
  3588.     m$ = m$ + "........" + Chr$(13)
  3589.     arrTileText(28) = m$
  3590.  
  3591.     m$ = ""
  3592.     m$ = m$ + "........" + Chr$(13)
  3593.     m$ = m$ + "........" + Chr$(13)
  3594.     m$ = m$ + "........" + Chr$(13)
  3595.     m$ = m$ + "........" + Chr$(13)
  3596.     m$ = m$ + "........" + Chr$(13)
  3597.     m$ = m$ + "........" + Chr$(13)
  3598.     m$ = m$ + "........" + Chr$(13)
  3599.     m$ = m$ + "........" + Chr$(13)
  3600.     arrTileText(29) = m$
  3601.  
  3602.     m$ = ""
  3603.     m$ = m$ + "........" + Chr$(13)
  3604.     m$ = m$ + "........" + Chr$(13)
  3605.     m$ = m$ + "........" + Chr$(13)
  3606.     m$ = m$ + "........" + Chr$(13)
  3607.     m$ = m$ + "........" + Chr$(13)
  3608.     m$ = m$ + "........" + Chr$(13)
  3609.     m$ = m$ + "........" + Chr$(13)
  3610.     m$ = m$ + "........" + Chr$(13)
  3611.     arrTileText(30) = m$
  3612.  
  3613.     m$ = ""
  3614.     m$ = m$ + "........" + Chr$(13)
  3615.     m$ = m$ + "........" + Chr$(13)
  3616.     m$ = m$ + "........" + Chr$(13)
  3617.     m$ = m$ + "........" + Chr$(13)
  3618.     m$ = m$ + "........" + Chr$(13)
  3619.     m$ = m$ + "........" + Chr$(13)
  3620.     m$ = m$ + "........" + Chr$(13)
  3621.     m$ = m$ + "........" + Chr$(13)
  3622.     arrTileText(31) = m$
  3623.  
  3624.     m$ = ""
  3625.     m$ = m$ + "........" + Chr$(13)
  3626.     m$ = m$ + "........" + Chr$(13)
  3627.     m$ = m$ + "........" + Chr$(13)
  3628.     m$ = m$ + "........" + Chr$(13)
  3629.     m$ = m$ + "........" + Chr$(13)
  3630.     m$ = m$ + "........" + Chr$(13)
  3631.     m$ = m$ + "........" + Chr$(13)
  3632.     m$ = m$ + "........" + Chr$(13)
  3633.     arrTileText(32) = m$
  3634.  
  3635.     m$ = ""
  3636.     m$ = m$ + "...22..." + Chr$(13)
  3637.     m$ = m$ + "...22..." + Chr$(13)
  3638.     m$ = m$ + "...22..." + Chr$(13)
  3639.     m$ = m$ + "...22..." + Chr$(13)
  3640.     m$ = m$ + "........" + Chr$(13)
  3641.     m$ = m$ + "........" + Chr$(13)
  3642.     m$ = m$ + "...22..." + Chr$(13)
  3643.     m$ = m$ + "........" + Chr$(13)
  3644.     arrTileText(33) = m$
  3645.  
  3646.     m$ = ""
  3647.     m$ = m$ + ".22..22." + Chr$(13)
  3648.     m$ = m$ + ".22..22." + Chr$(13)
  3649.     m$ = m$ + ".22..22." + Chr$(13)
  3650.     m$ = m$ + "........" + Chr$(13)
  3651.     m$ = m$ + "........" + Chr$(13)
  3652.     m$ = m$ + "........" + Chr$(13)
  3653.     m$ = m$ + "........" + Chr$(13)
  3654.     m$ = m$ + "........" + Chr$(13)
  3655.     arrTileText(34) = m$
  3656.  
  3657.     m$ = ""
  3658.     m$ = m$ + ".22..22." + Chr$(13)
  3659.     m$ = m$ + ".22..22." + Chr$(13)
  3660.     m$ = m$ + "22222222" + Chr$(13)
  3661.     m$ = m$ + ".22..22." + Chr$(13)
  3662.     m$ = m$ + "22222222" + Chr$(13)
  3663.     m$ = m$ + ".22..22." + Chr$(13)
  3664.     m$ = m$ + ".22..22." + Chr$(13)
  3665.     m$ = m$ + "........" + Chr$(13)
  3666.     arrTileText(35) = m$
  3667.  
  3668.     m$ = ""
  3669.     m$ = m$ + "...22..." + Chr$(13)
  3670.     m$ = m$ + "..22222." + Chr$(13)
  3671.     m$ = m$ + ".22....." + Chr$(13)
  3672.     m$ = m$ + "..2222.." + Chr$(13)
  3673.     m$ = m$ + ".....22." + Chr$(13)
  3674.     m$ = m$ + ".22222.." + Chr$(13)
  3675.     m$ = m$ + "...22..." + Chr$(13)
  3676.     m$ = m$ + "........" + Chr$(13)
  3677.     arrTileText(36) = m$
  3678.  
  3679.     m$ = ""
  3680.     m$ = m$ + ".22...2." + Chr$(13)
  3681.     m$ = m$ + ".22..22." + Chr$(13)
  3682.     m$ = m$ + "....22.." + Chr$(13)
  3683.     m$ = m$ + "...22..." + Chr$(13)
  3684.     m$ = m$ + "..22...." + Chr$(13)
  3685.     m$ = m$ + ".22..22." + Chr$(13)
  3686.     m$ = m$ + ".2...22." + Chr$(13)
  3687.     m$ = m$ + "........" + Chr$(13)
  3688.     arrTileText(37) = m$
  3689.  
  3690.     m$ = ""
  3691.     m$ = m$ + "..2222.." + Chr$(13)
  3692.     m$ = m$ + ".22..22." + Chr$(13)
  3693.     m$ = m$ + "..2222.." + Chr$(13)
  3694.     m$ = m$ + "..222..." + Chr$(13)
  3695.     m$ = m$ + ".22..222" + Chr$(13)
  3696.     m$ = m$ + ".22..22." + Chr$(13)
  3697.     m$ = m$ + "..222222" + Chr$(13)
  3698.     m$ = m$ + "........" + Chr$(13)
  3699.     arrTileText(38) = m$
  3700.  
  3701.     m$ = ""
  3702.     m$ = m$ + ".....22." + Chr$(13)
  3703.     m$ = m$ + "....22.." + Chr$(13)
  3704.     m$ = m$ + "...22..." + Chr$(13)
  3705.     m$ = m$ + "........" + Chr$(13)
  3706.     m$ = m$ + "........" + Chr$(13)
  3707.     m$ = m$ + "........" + Chr$(13)
  3708.     m$ = m$ + "........" + Chr$(13)
  3709.     m$ = m$ + "........" + Chr$(13)
  3710.     arrTileText(39) = m$
  3711.  
  3712.     m$ = ""
  3713.     m$ = m$ + "....22.." + Chr$(13)
  3714.     m$ = m$ + "...22..." + Chr$(13)
  3715.     m$ = m$ + "..22...." + Chr$(13)
  3716.     m$ = m$ + "..22...." + Chr$(13)
  3717.     m$ = m$ + "..22...." + Chr$(13)
  3718.     m$ = m$ + "...22..." + Chr$(13)
  3719.     m$ = m$ + "....22.." + Chr$(13)
  3720.     m$ = m$ + "........" + Chr$(13)
  3721.     arrTileText(40) = m$
  3722.  
  3723.     m$ = ""
  3724.     m$ = m$ + "..22...." + Chr$(13)
  3725.     m$ = m$ + "...22..." + Chr$(13)
  3726.     m$ = m$ + "....22.." + Chr$(13)
  3727.     m$ = m$ + "....22.." + Chr$(13)
  3728.     m$ = m$ + "....22.." + Chr$(13)
  3729.     m$ = m$ + "...22..." + Chr$(13)
  3730.     m$ = m$ + "..22...." + Chr$(13)
  3731.     m$ = m$ + "........" + Chr$(13)
  3732.     arrTileText(41) = m$
  3733.  
  3734.     m$ = ""
  3735.     m$ = m$ + "........" + Chr$(13)
  3736.     m$ = m$ + ".22..22." + Chr$(13)
  3737.     m$ = m$ + "..2222.." + Chr$(13)
  3738.     m$ = m$ + "22222222" + Chr$(13)
  3739.     m$ = m$ + "..2222.." + Chr$(13)
  3740.     m$ = m$ + ".22..22." + Chr$(13)
  3741.     m$ = m$ + "........" + Chr$(13)
  3742.     m$ = m$ + "........" + Chr$(13)
  3743.     arrTileText(42) = m$
  3744.  
  3745.     m$ = ""
  3746.     m$ = m$ + "........" + Chr$(13)
  3747.     m$ = m$ + "...22..." + Chr$(13)
  3748.     m$ = m$ + "...22..." + Chr$(13)
  3749.     m$ = m$ + ".222222." + Chr$(13)
  3750.     m$ = m$ + "...22..." + Chr$(13)
  3751.     m$ = m$ + "...22..." + Chr$(13)
  3752.     m$ = m$ + "........" + Chr$(13)
  3753.     m$ = m$ + "........" + Chr$(13)
  3754.     arrTileText(43) = m$
  3755.  
  3756.     m$ = ""
  3757.     m$ = m$ + "........" + Chr$(13)
  3758.     m$ = m$ + "........" + Chr$(13)
  3759.     m$ = m$ + "........" + Chr$(13)
  3760.     m$ = m$ + "........" + Chr$(13)
  3761.     m$ = m$ + "........" + Chr$(13)
  3762.     m$ = m$ + "...22..." + Chr$(13)
  3763.     m$ = m$ + "...22..." + Chr$(13)
  3764.     m$ = m$ + "..22...." + Chr$(13)
  3765.     arrTileText(44) = m$
  3766.  
  3767.     m$ = ""
  3768.     m$ = m$ + "........" + Chr$(13)
  3769.     m$ = m$ + "........" + Chr$(13)
  3770.     m$ = m$ + "........" + Chr$(13)
  3771.     m$ = m$ + ".222222." + Chr$(13)
  3772.     m$ = m$ + "........" + Chr$(13)
  3773.     m$ = m$ + "........" + Chr$(13)
  3774.     m$ = m$ + "........" + Chr$(13)
  3775.     m$ = m$ + "........" + Chr$(13)
  3776.     arrTileText(45) = m$
  3777.  
  3778.     m$ = ""
  3779.     m$ = m$ + "........" + Chr$(13)
  3780.     m$ = m$ + "........" + Chr$(13)
  3781.     m$ = m$ + "........" + Chr$(13)
  3782.     m$ = m$ + "........" + Chr$(13)
  3783.     m$ = m$ + "........" + Chr$(13)
  3784.     m$ = m$ + "...22..." + Chr$(13)
  3785.     m$ = m$ + "...22..." + Chr$(13)
  3786.     m$ = m$ + "........" + Chr$(13)
  3787.     arrTileText(46) = m$
  3788.  
  3789.     m$ = ""
  3790.     m$ = m$ + "........" + Chr$(13)
  3791.     m$ = m$ + "......22" + Chr$(13)
  3792.     m$ = m$ + ".....22." + Chr$(13)
  3793.     m$ = m$ + "....22.." + Chr$(13)
  3794.     m$ = m$ + "...22..." + Chr$(13)
  3795.     m$ = m$ + "..22...." + Chr$(13)
  3796.     m$ = m$ + ".22....." + Chr$(13)
  3797.     m$ = m$ + "........" + Chr$(13)
  3798.     arrTileText(47) = m$
  3799.  
  3800.     m$ = ""
  3801.     m$ = m$ + "..2222.." + Chr$(13)
  3802.     m$ = m$ + ".22..22." + Chr$(13)
  3803.     m$ = m$ + ".22.222." + Chr$(13)
  3804.     m$ = m$ + ".222.22." + Chr$(13)
  3805.     m$ = m$ + ".22..22." + Chr$(13)
  3806.     m$ = m$ + ".22..22." + Chr$(13)
  3807.     m$ = m$ + "..2222.." + Chr$(13)
  3808.     m$ = m$ + "........" + Chr$(13)
  3809.     arrTileText(48) = m$
  3810.  
  3811.     m$ = ""
  3812.     m$ = m$ + "...22..." + Chr$(13)
  3813.     m$ = m$ + "...22..." + Chr$(13)
  3814.     m$ = m$ + "..222..." + Chr$(13)
  3815.     m$ = m$ + "...22..." + Chr$(13)
  3816.     m$ = m$ + "...22..." + Chr$(13)
  3817.     m$ = m$ + "...22..." + Chr$(13)
  3818.     m$ = m$ + ".222222." + Chr$(13)
  3819.     m$ = m$ + "........" + Chr$(13)
  3820.     arrTileText(49) = m$
  3821.  
  3822.     m$ = ""
  3823.     m$ = m$ + "..2222.." + Chr$(13)
  3824.     m$ = m$ + ".22..22." + Chr$(13)
  3825.     m$ = m$ + ".....22." + Chr$(13)
  3826.     m$ = m$ + "....22.." + Chr$(13)
  3827.     m$ = m$ + "..22...." + Chr$(13)
  3828.     m$ = m$ + ".22....." + Chr$(13)
  3829.     m$ = m$ + ".222222." + Chr$(13)
  3830.     m$ = m$ + "........" + Chr$(13)
  3831.     arrTileText(50) = m$
  3832.  
  3833.     m$ = ""
  3834.     m$ = m$ + "..2222.." + Chr$(13)
  3835.     m$ = m$ + ".22..22." + Chr$(13)
  3836.     m$ = m$ + ".....22." + Chr$(13)
  3837.     m$ = m$ + "...222.." + Chr$(13)
  3838.     m$ = m$ + ".....22." + Chr$(13)
  3839.     m$ = m$ + ".22..22." + Chr$(13)
  3840.     m$ = m$ + "..2222.." + Chr$(13)
  3841.     m$ = m$ + "........" + Chr$(13)
  3842.     arrTileText(51) = m$
  3843.  
  3844.     m$ = ""
  3845.     m$ = m$ + ".....22." + Chr$(13)
  3846.     m$ = m$ + "....222." + Chr$(13)
  3847.     m$ = m$ + "...2222." + Chr$(13)
  3848.     m$ = m$ + ".22..22." + Chr$(13)
  3849.     m$ = m$ + ".2222222" + Chr$(13)
  3850.     m$ = m$ + ".....22." + Chr$(13)
  3851.     m$ = m$ + ".....22." + Chr$(13)
  3852.     m$ = m$ + "........" + Chr$(13)
  3853.     arrTileText(52) = m$
  3854.  
  3855.     m$ = ""
  3856.     m$ = m$ + ".222222." + Chr$(13)
  3857.     m$ = m$ + ".22....." + Chr$(13)
  3858.     m$ = m$ + ".22222.." + Chr$(13)
  3859.     m$ = m$ + ".....22." + Chr$(13)
  3860.     m$ = m$ + ".....22." + Chr$(13)
  3861.     m$ = m$ + ".22..22." + Chr$(13)
  3862.     m$ = m$ + "..2222.." + Chr$(13)
  3863.     m$ = m$ + "........" + Chr$(13)
  3864.     arrTileText(53) = m$
  3865.  
  3866.     m$ = ""
  3867.     m$ = m$ + "..2222.." + Chr$(13)
  3868.     m$ = m$ + ".22..22." + Chr$(13)
  3869.     m$ = m$ + ".22....." + Chr$(13)
  3870.     m$ = m$ + ".22222.." + Chr$(13)
  3871.     m$ = m$ + ".22..22." + Chr$(13)
  3872.     m$ = m$ + ".22..22." + Chr$(13)
  3873.     m$ = m$ + "..2222.." + Chr$(13)
  3874.     m$ = m$ + "........" + Chr$(13)
  3875.     arrTileText(54) = m$
  3876.  
  3877.     m$ = ""
  3878.     m$ = m$ + ".222222." + Chr$(13)
  3879.     m$ = m$ + ".22..22." + Chr$(13)
  3880.     m$ = m$ + "....22.." + Chr$(13)
  3881.     m$ = m$ + "...22..." + Chr$(13)
  3882.     m$ = m$ + "...22..." + Chr$(13)
  3883.     m$ = m$ + "...22..." + Chr$(13)
  3884.     m$ = m$ + "...22..." + Chr$(13)
  3885.     m$ = m$ + "........" + Chr$(13)
  3886.     arrTileText(55) = m$
  3887.  
  3888.     m$ = ""
  3889.     m$ = m$ + "..2222.." + Chr$(13)
  3890.     m$ = m$ + ".22..22." + Chr$(13)
  3891.     m$ = m$ + ".22..22." + Chr$(13)
  3892.     m$ = m$ + "..2222.." + Chr$(13)
  3893.     m$ = m$ + ".22..22." + Chr$(13)
  3894.     m$ = m$ + ".22..22." + Chr$(13)
  3895.     m$ = m$ + "..2222.." + Chr$(13)
  3896.     m$ = m$ + "........" + Chr$(13)
  3897.     arrTileText(56) = m$
  3898.  
  3899.     m$ = ""
  3900.     m$ = m$ + "..2222.." + Chr$(13)
  3901.     m$ = m$ + ".22..22." + Chr$(13)
  3902.     m$ = m$ + ".22..22." + Chr$(13)
  3903.     m$ = m$ + "..22222." + Chr$(13)
  3904.     m$ = m$ + ".....22." + Chr$(13)
  3905.     m$ = m$ + ".22..22." + Chr$(13)
  3906.     m$ = m$ + "..2222.." + Chr$(13)
  3907.     m$ = m$ + "........" + Chr$(13)
  3908.     arrTileText(57) = m$
  3909.  
  3910.     m$ = ""
  3911.     m$ = m$ + "........" + Chr$(13)
  3912.     m$ = m$ + "........" + Chr$(13)
  3913.     m$ = m$ + "...22..." + Chr$(13)
  3914.     m$ = m$ + "........" + Chr$(13)
  3915.     m$ = m$ + "........" + Chr$(13)
  3916.     m$ = m$ + "...22..." + Chr$(13)
  3917.     m$ = m$ + "........" + Chr$(13)
  3918.     m$ = m$ + "........" + Chr$(13)
  3919.     arrTileText(58) = m$
  3920.  
  3921.     m$ = ""
  3922.     m$ = m$ + "........" + Chr$(13)
  3923.     m$ = m$ + "........" + Chr$(13)
  3924.     m$ = m$ + "...22..." + Chr$(13)
  3925.     m$ = m$ + "........" + Chr$(13)
  3926.     m$ = m$ + "........" + Chr$(13)
  3927.     m$ = m$ + "...22..." + Chr$(13)
  3928.     m$ = m$ + "...22..." + Chr$(13)
  3929.     m$ = m$ + "..22...." + Chr$(13)
  3930.     arrTileText(59) = m$
  3931.  
  3932.     m$ = ""
  3933.     m$ = m$ + "....222." + Chr$(13)
  3934.     m$ = m$ + "...22..." + Chr$(13)
  3935.     m$ = m$ + "..22...." + Chr$(13)
  3936.     m$ = m$ + ".22....." + Chr$(13)
  3937.     m$ = m$ + "..22...." + Chr$(13)
  3938.     m$ = m$ + "...22..." + Chr$(13)
  3939.     m$ = m$ + "....222." + Chr$(13)
  3940.     m$ = m$ + "........" + Chr$(13)
  3941.     arrTileText(60) = m$
  3942.  
  3943.     m$ = ""
  3944.     m$ = m$ + "........" + Chr$(13)
  3945.     m$ = m$ + "........" + Chr$(13)
  3946.     m$ = m$ + ".222222." + Chr$(13)
  3947.     m$ = m$ + "........" + Chr$(13)
  3948.     m$ = m$ + ".222222." + Chr$(13)
  3949.     m$ = m$ + "........" + Chr$(13)
  3950.     m$ = m$ + "........" + Chr$(13)
  3951.     m$ = m$ + "........" + Chr$(13)
  3952.     arrTileText(61) = m$
  3953.  
  3954.     m$ = ""
  3955.     m$ = m$ + ".222...." + Chr$(13)
  3956.     m$ = m$ + "...22..." + Chr$(13)
  3957.     m$ = m$ + "....22.." + Chr$(13)
  3958.     m$ = m$ + ".....22." + Chr$(13)
  3959.     m$ = m$ + "....22.." + Chr$(13)
  3960.     m$ = m$ + "...22..." + Chr$(13)
  3961.     m$ = m$ + ".222...." + Chr$(13)
  3962.     m$ = m$ + "........" + Chr$(13)
  3963.     arrTileText(62) = m$
  3964.  
  3965.     m$ = ""
  3966.     m$ = m$ + "..2222.." + Chr$(13)
  3967.     m$ = m$ + ".22..22." + Chr$(13)
  3968.     m$ = m$ + ".....22." + Chr$(13)
  3969.     m$ = m$ + "....22.." + Chr$(13)
  3970.     m$ = m$ + "...22..." + Chr$(13)
  3971.     m$ = m$ + "........" + Chr$(13)
  3972.     m$ = m$ + "...22..." + Chr$(13)
  3973.     m$ = m$ + "........" + Chr$(13)
  3974.     arrTileText(63) = m$
  3975.  
  3976.     m$ = ""
  3977.     m$ = m$ + "..2222.." + Chr$(13)
  3978.     m$ = m$ + ".22..22." + Chr$(13)
  3979.     m$ = m$ + ".22.222." + Chr$(13)
  3980.     m$ = m$ + ".22.222." + Chr$(13)
  3981.     m$ = m$ + ".22....." + Chr$(13)
  3982.     m$ = m$ + ".22...2." + Chr$(13)
  3983.     m$ = m$ + "..2222.." + Chr$(13)
  3984.     m$ = m$ + "........" + Chr$(13)
  3985.     arrTileText(64) = m$
  3986.  
  3987.     m$ = ""
  3988.     m$ = m$ + "...22..." + Chr$(13)
  3989.     m$ = m$ + "..2222.." + Chr$(13)
  3990.     m$ = m$ + ".22..22." + Chr$(13)
  3991.     m$ = m$ + ".222222." + Chr$(13)
  3992.     m$ = m$ + ".22..22." + Chr$(13)
  3993.     m$ = m$ + ".22..22." + Chr$(13)
  3994.     m$ = m$ + ".22..22." + Chr$(13)
  3995.     m$ = m$ + "........" + Chr$(13)
  3996.     arrTileText(65) = m$
  3997.  
  3998.     m$ = ""
  3999.     m$ = m$ + ".22222.." + Chr$(13)
  4000.     m$ = m$ + ".22..22." + Chr$(13)
  4001.     m$ = m$ + ".22..22." + Chr$(13)
  4002.     m$ = m$ + ".22222.." + Chr$(13)
  4003.     m$ = m$ + ".22..22." + Chr$(13)
  4004.     m$ = m$ + ".22..22." + Chr$(13)
  4005.     m$ = m$ + ".22222.." + Chr$(13)
  4006.     m$ = m$ + "........" + Chr$(13)
  4007.     arrTileText(66) = m$
  4008.  
  4009.     m$ = ""
  4010.     m$ = m$ + "..2222.." + Chr$(13)
  4011.     m$ = m$ + ".22..22." + Chr$(13)
  4012.     m$ = m$ + ".22....." + Chr$(13)
  4013.     m$ = m$ + ".22....." + Chr$(13)
  4014.     m$ = m$ + ".22....." + Chr$(13)
  4015.     m$ = m$ + ".22..22." + Chr$(13)
  4016.     m$ = m$ + "..2222.." + Chr$(13)
  4017.     m$ = m$ + "........" + Chr$(13)
  4018.     arrTileText(67) = m$
  4019.  
  4020.     m$ = ""
  4021.     m$ = m$ + ".2222..." + Chr$(13)
  4022.     m$ = m$ + ".22.22.." + Chr$(13)
  4023.     m$ = m$ + ".22..22." + Chr$(13)
  4024.     m$ = m$ + ".22..22." + Chr$(13)
  4025.     m$ = m$ + ".22..22." + Chr$(13)
  4026.     m$ = m$ + ".22.22.." + Chr$(13)
  4027.     m$ = m$ + ".2222..." + Chr$(13)
  4028.     m$ = m$ + "........" + Chr$(13)
  4029.     arrTileText(68) = m$
  4030.  
  4031.     m$ = ""
  4032.     m$ = m$ + ".222222." + Chr$(13)
  4033.     m$ = m$ + ".22....." + Chr$(13)
  4034.     m$ = m$ + ".22....." + Chr$(13)
  4035.     m$ = m$ + ".2222..." + Chr$(13)
  4036.     m$ = m$ + ".22....." + Chr$(13)
  4037.     m$ = m$ + ".22....." + Chr$(13)
  4038.     m$ = m$ + ".222222." + Chr$(13)
  4039.     m$ = m$ + "........" + Chr$(13)
  4040.     arrTileText(69) = m$
  4041.  
  4042.     m$ = ""
  4043.     m$ = m$ + ".222222." + Chr$(13)
  4044.     m$ = m$ + ".22....." + Chr$(13)
  4045.     m$ = m$ + ".22....." + Chr$(13)
  4046.     m$ = m$ + ".2222..." + Chr$(13)
  4047.     m$ = m$ + ".22....." + Chr$(13)
  4048.     m$ = m$ + ".22....." + Chr$(13)
  4049.     m$ = m$ + ".22....." + Chr$(13)
  4050.     m$ = m$ + "........" + Chr$(13)
  4051.     arrTileText(70) = m$
  4052.  
  4053.     m$ = ""
  4054.     m$ = m$ + "..2222.." + Chr$(13)
  4055.     m$ = m$ + ".22..22." + Chr$(13)
  4056.     m$ = m$ + ".22....." + Chr$(13)
  4057.     m$ = m$ + ".22.222." + Chr$(13)
  4058.     m$ = m$ + ".22..22." + Chr$(13)
  4059.     m$ = m$ + ".22..22." + Chr$(13)
  4060.     m$ = m$ + "..2222.." + Chr$(13)
  4061.     m$ = m$ + "........" + Chr$(13)
  4062.     arrTileText(71) = m$
  4063.  
  4064.     m$ = ""
  4065.     m$ = m$ + ".22..22." + Chr$(13)
  4066.     m$ = m$ + ".22..22." + Chr$(13)
  4067.     m$ = m$ + ".22..22." + Chr$(13)
  4068.     m$ = m$ + ".222222." + Chr$(13)
  4069.     m$ = m$ + ".22..22." + Chr$(13)
  4070.     m$ = m$ + ".22..22." + Chr$(13)
  4071.     m$ = m$ + ".22..22." + Chr$(13)
  4072.     m$ = m$ + "........" + Chr$(13)
  4073.     arrTileText(72) = m$
  4074.  
  4075.     m$ = ""
  4076.     m$ = m$ + "..2222.." + Chr$(13)
  4077.     m$ = m$ + "...22..." + Chr$(13)
  4078.     m$ = m$ + "...22..." + Chr$(13)
  4079.     m$ = m$ + "...22..." + Chr$(13)
  4080.     m$ = m$ + "...22..." + Chr$(13)
  4081.     m$ = m$ + "...22..." + Chr$(13)
  4082.     m$ = m$ + "..2222.." + Chr$(13)
  4083.     m$ = m$ + "........" + Chr$(13)
  4084.     arrTileText(73) = m$
  4085.  
  4086.     m$ = ""
  4087.     m$ = m$ + "...2222." + Chr$(13)
  4088.     m$ = m$ + "....22.." + Chr$(13)
  4089.     m$ = m$ + "....22.." + Chr$(13)
  4090.     m$ = m$ + "....22.." + Chr$(13)
  4091.     m$ = m$ + "....22.." + Chr$(13)
  4092.     m$ = m$ + ".22.22.." + Chr$(13)
  4093.     m$ = m$ + "..222..." + Chr$(13)
  4094.     m$ = m$ + "........" + Chr$(13)
  4095.     arrTileText(74) = m$
  4096.  
  4097.     m$ = ""
  4098.     m$ = m$ + ".22..22." + Chr$(13)
  4099.     m$ = m$ + ".22.22.." + Chr$(13)
  4100.     m$ = m$ + ".2222..." + Chr$(13)
  4101.     m$ = m$ + ".222...." + Chr$(13)
  4102.     m$ = m$ + ".2222..." + Chr$(13)
  4103.     m$ = m$ + ".22.22.." + Chr$(13)
  4104.     m$ = m$ + ".22..22." + Chr$(13)
  4105.     m$ = m$ + "........" + Chr$(13)
  4106.     arrTileText(75) = m$
  4107.  
  4108.     m$ = ""
  4109.     m$ = m$ + ".22....." + Chr$(13)
  4110.     m$ = m$ + ".22....." + Chr$(13)
  4111.     m$ = m$ + ".22....." + Chr$(13)
  4112.     m$ = m$ + ".22....." + Chr$(13)
  4113.     m$ = m$ + ".22....." + Chr$(13)
  4114.     m$ = m$ + ".22....." + Chr$(13)
  4115.     m$ = m$ + ".222222." + Chr$(13)
  4116.     m$ = m$ + "........" + Chr$(13)
  4117.     arrTileText(76) = m$
  4118.  
  4119.     m$ = ""
  4120.     m$ = m$ + ".22...22" + Chr$(13)
  4121.     m$ = m$ + ".222.222" + Chr$(13)
  4122.     m$ = m$ + ".2222222" + Chr$(13)
  4123.     m$ = m$ + ".22.2.22" + Chr$(13)
  4124.     m$ = m$ + ".22...22" + Chr$(13)
  4125.     m$ = m$ + ".22...22" + Chr$(13)
  4126.     m$ = m$ + ".22...22" + Chr$(13)
  4127.     m$ = m$ + "........" + Chr$(13)
  4128.     arrTileText(77) = m$
  4129.  
  4130.     m$ = ""
  4131.     m$ = m$ + ".22..22." + Chr$(13)
  4132.     m$ = m$ + ".222.22." + Chr$(13)
  4133.     m$ = m$ + ".222222." + Chr$(13)
  4134.     m$ = m$ + ".222222." + Chr$(13)
  4135.     m$ = m$ + ".22.222." + Chr$(13)
  4136.     m$ = m$ + ".22..22." + Chr$(13)
  4137.     m$ = m$ + ".22..22." + Chr$(13)
  4138.     m$ = m$ + "........" + Chr$(13)
  4139.     arrTileText(78) = m$
  4140.  
  4141.     m$ = ""
  4142.     m$ = m$ + "..2222.." + Chr$(13)
  4143.     m$ = m$ + ".22..22." + Chr$(13)
  4144.     m$ = m$ + ".22..22." + Chr$(13)
  4145.     m$ = m$ + ".22..22." + Chr$(13)
  4146.     m$ = m$ + ".22..22." + Chr$(13)
  4147.     m$ = m$ + ".22..22." + Chr$(13)
  4148.     m$ = m$ + "..2222.." + Chr$(13)
  4149.     m$ = m$ + "........" + Chr$(13)
  4150.     arrTileText(79) = m$
  4151.  
  4152.     m$ = ""
  4153.     m$ = m$ + ".22222.." + Chr$(13)
  4154.     m$ = m$ + ".22..22." + Chr$(13)
  4155.     m$ = m$ + ".22..22." + Chr$(13)
  4156.     m$ = m$ + ".22222.." + Chr$(13)
  4157.     m$ = m$ + ".22....." + Chr$(13)
  4158.     m$ = m$ + ".22....." + Chr$(13)
  4159.     m$ = m$ + ".22....." + Chr$(13)
  4160.     m$ = m$ + "........" + Chr$(13)
  4161.     arrTileText(80) = m$
  4162.  
  4163.     m$ = ""
  4164.     m$ = m$ + "..2222.." + Chr$(13)
  4165.     m$ = m$ + ".22..22." + Chr$(13)
  4166.     m$ = m$ + ".22..22." + Chr$(13)
  4167.     m$ = m$ + ".22..22." + Chr$(13)
  4168.     m$ = m$ + ".22..22." + Chr$(13)
  4169.     m$ = m$ + "..2222.." + Chr$(13)
  4170.     m$ = m$ + "....222." + Chr$(13)
  4171.     m$ = m$ + "........" + Chr$(13)
  4172.     arrTileText(81) = m$
  4173.  
  4174.     m$ = ""
  4175.     m$ = m$ + ".22222.." + Chr$(13)
  4176.     m$ = m$ + ".22..22." + Chr$(13)
  4177.     m$ = m$ + ".22..22." + Chr$(13)
  4178.     m$ = m$ + ".22222.." + Chr$(13)
  4179.     m$ = m$ + ".2222..." + Chr$(13)
  4180.     m$ = m$ + ".22.22.." + Chr$(13)
  4181.     m$ = m$ + ".22..22." + Chr$(13)
  4182.     m$ = m$ + "........" + Chr$(13)
  4183.     arrTileText(82) = m$
  4184.  
  4185.     m$ = ""
  4186.     m$ = m$ + "..2222.." + Chr$(13)
  4187.     m$ = m$ + ".22..22." + Chr$(13)
  4188.     m$ = m$ + ".22....." + Chr$(13)
  4189.     m$ = m$ + "..2222.." + Chr$(13)
  4190.     m$ = m$ + ".....22." + Chr$(13)
  4191.     m$ = m$ + ".22..22." + Chr$(13)
  4192.     m$ = m$ + "..2222.." + Chr$(13)
  4193.     m$ = m$ + "........" + Chr$(13)
  4194.     arrTileText(83) = m$
  4195.  
  4196.     m$ = ""
  4197.     m$ = m$ + ".222222." + Chr$(13)
  4198.     m$ = m$ + "...22..." + Chr$(13)
  4199.     m$ = m$ + "...22..." + Chr$(13)
  4200.     m$ = m$ + "...22..." + Chr$(13)
  4201.     m$ = m$ + "...22..." + Chr$(13)
  4202.     m$ = m$ + "...22..." + Chr$(13)
  4203.     m$ = m$ + "...22..." + Chr$(13)
  4204.     m$ = m$ + "........" + Chr$(13)
  4205.     arrTileText(84) = m$
  4206.  
  4207.     m$ = ""
  4208.     m$ = m$ + ".22..22." + Chr$(13)
  4209.     m$ = m$ + ".22..22." + Chr$(13)
  4210.     m$ = m$ + ".22..22." + Chr$(13)
  4211.     m$ = m$ + ".22..22." + Chr$(13)
  4212.     m$ = m$ + ".22..22." + Chr$(13)
  4213.     m$ = m$ + ".22..22." + Chr$(13)
  4214.     m$ = m$ + "..2222.." + Chr$(13)
  4215.     m$ = m$ + "........" + Chr$(13)
  4216.     arrTileText(85) = m$
  4217.  
  4218.     m$ = ""
  4219.     m$ = m$ + ".22..22." + Chr$(13)
  4220.     m$ = m$ + ".22..22." + Chr$(13)
  4221.     m$ = m$ + ".22..22." + Chr$(13)
  4222.     m$ = m$ + ".22..22." + Chr$(13)
  4223.     m$ = m$ + ".22..22." + Chr$(13)
  4224.     m$ = m$ + "..2222.." + Chr$(13)
  4225.     m$ = m$ + "...22..." + Chr$(13)
  4226.     m$ = m$ + "........" + Chr$(13)
  4227.     arrTileText(86) = m$
  4228.  
  4229.     m$ = ""
  4230.     m$ = m$ + ".22...22" + Chr$(13)
  4231.     m$ = m$ + ".22...22" + Chr$(13)
  4232.     m$ = m$ + ".22...22" + Chr$(13)
  4233.     m$ = m$ + ".22.2.22" + Chr$(13)
  4234.     m$ = m$ + ".2222222" + Chr$(13)
  4235.     m$ = m$ + ".222.222" + Chr$(13)
  4236.     m$ = m$ + ".22...22" + Chr$(13)
  4237.     m$ = m$ + "........" + Chr$(13)
  4238.     arrTileText(87) = m$
  4239.  
  4240.     m$ = ""
  4241.     m$ = m$ + ".22..22." + Chr$(13)
  4242.     m$ = m$ + ".22..22." + Chr$(13)
  4243.     m$ = m$ + "..2222.." + Chr$(13)
  4244.     m$ = m$ + "...22..." + Chr$(13)
  4245.     m$ = m$ + "..2222.." + Chr$(13)
  4246.     m$ = m$ + ".22..22." + Chr$(13)
  4247.     m$ = m$ + ".22..22." + Chr$(13)
  4248.     m$ = m$ + "........" + Chr$(13)
  4249.     arrTileText(88) = m$
  4250.  
  4251.     m$ = ""
  4252.     m$ = m$ + ".22..22." + Chr$(13)
  4253.     m$ = m$ + ".22..22." + Chr$(13)
  4254.     m$ = m$ + ".22..22." + Chr$(13)
  4255.     m$ = m$ + "..2222.." + Chr$(13)
  4256.     m$ = m$ + "...22..." + Chr$(13)
  4257.     m$ = m$ + "...22..." + Chr$(13)
  4258.     m$ = m$ + "...22..." + Chr$(13)
  4259.     m$ = m$ + "........" + Chr$(13)
  4260.     arrTileText(89) = m$
  4261.  
  4262.     m$ = ""
  4263.     m$ = m$ + ".222222." + Chr$(13)
  4264.     m$ = m$ + ".....22." + Chr$(13)
  4265.     m$ = m$ + "....22.." + Chr$(13)
  4266.     m$ = m$ + "...22..." + Chr$(13)
  4267.     m$ = m$ + "..22...." + Chr$(13)
  4268.     m$ = m$ + ".22....." + Chr$(13)
  4269.     m$ = m$ + ".222222." + Chr$(13)
  4270.     m$ = m$ + "........" + Chr$(13)
  4271.     arrTileText(90) = m$
  4272.  
  4273.     m$ = ""
  4274.     m$ = m$ + "..2222.." + Chr$(13)
  4275.     m$ = m$ + "..22...." + Chr$(13)
  4276.     m$ = m$ + "..22...." + Chr$(13)
  4277.     m$ = m$ + "..22...." + Chr$(13)
  4278.     m$ = m$ + "..22...." + Chr$(13)
  4279.     m$ = m$ + "..22...." + Chr$(13)
  4280.     m$ = m$ + "..2222.." + Chr$(13)
  4281.     m$ = m$ + "........" + Chr$(13)
  4282.     arrTileText(91) = m$
  4283.  
  4284.     m$ = ""
  4285.     m$ = m$ + "........" + Chr$(13)
  4286.     m$ = m$ + ".22....." + Chr$(13)
  4287.     m$ = m$ + "..22...." + Chr$(13)
  4288.     m$ = m$ + "...22..." + Chr$(13)
  4289.     m$ = m$ + "....22.." + Chr$(13)
  4290.     m$ = m$ + ".....22." + Chr$(13)
  4291.     m$ = m$ + "......22" + Chr$(13)
  4292.     m$ = m$ + "........" + Chr$(13)
  4293.     arrTileText(92) = m$
  4294.  
  4295.     m$ = ""
  4296.     m$ = m$ + "..2222.." + Chr$(13)
  4297.     m$ = m$ + "....22.." + Chr$(13)
  4298.     m$ = m$ + "....22.." + Chr$(13)
  4299.     m$ = m$ + "....22.." + Chr$(13)
  4300.     m$ = m$ + "....22.." + Chr$(13)
  4301.     m$ = m$ + "....22.." + Chr$(13)
  4302.     m$ = m$ + "..2222.." + Chr$(13)
  4303.     m$ = m$ + "........" + Chr$(13)
  4304.     arrTileText(93) = m$
  4305.  
  4306.     m$ = ""
  4307.     m$ = m$ + "...22..." + Chr$(13)
  4308.     m$ = m$ + "..2222.." + Chr$(13)
  4309.     m$ = m$ + ".22..22." + Chr$(13)
  4310.     m$ = m$ + "........" + Chr$(13)
  4311.     m$ = m$ + "........" + Chr$(13)
  4312.     m$ = m$ + "........" + Chr$(13)
  4313.     m$ = m$ + "........" + Chr$(13)
  4314.     m$ = m$ + "........" + Chr$(13)
  4315.     arrTileText(94) = m$
  4316.  
  4317.     m$ = ""
  4318.     m$ = m$ + "........" + Chr$(13)
  4319.     m$ = m$ + "........" + Chr$(13)
  4320.     m$ = m$ + "........" + Chr$(13)
  4321.     m$ = m$ + "........" + Chr$(13)
  4322.     m$ = m$ + "........" + Chr$(13)
  4323.     m$ = m$ + ".222222." + Chr$(13)
  4324.     m$ = m$ + "........" + Chr$(13)
  4325.     m$ = m$ + "........" + Chr$(13)
  4326.     arrTileText(95) = m$
  4327.  
  4328.     m$ = ""
  4329.     m$ = m$ + "........" + Chr$(13)
  4330.     m$ = m$ + "........" + Chr$(13)
  4331.     m$ = m$ + "........" + Chr$(13)
  4332.     m$ = m$ + "........" + Chr$(13)
  4333.     m$ = m$ + "........" + Chr$(13)
  4334.     m$ = m$ + "........" + Chr$(13)
  4335.     m$ = m$ + "........" + Chr$(13)
  4336.     m$ = m$ + "........" + Chr$(13)
  4337.     arrTileText(96) = m$
  4338.  
  4339.     m$ = ""
  4340.     m$ = m$ + "........" + Chr$(13)
  4341.     m$ = m$ + "..2222.." + Chr$(13)
  4342.     m$ = m$ + ".....22." + Chr$(13)
  4343.     m$ = m$ + "..22222." + Chr$(13)
  4344.     m$ = m$ + ".22..22." + Chr$(13)
  4345.     m$ = m$ + "..22222." + Chr$(13)
  4346.     m$ = m$ + "........" + Chr$(13)
  4347.     m$ = m$ + "........" + Chr$(13)
  4348.     arrTileText(97) = m$
  4349.  
  4350.     m$ = ""
  4351.     m$ = m$ + ".22....." + Chr$(13)
  4352.     m$ = m$ + ".22....." + Chr$(13)
  4353.     m$ = m$ + ".22222.." + Chr$(13)
  4354.     m$ = m$ + ".22..22." + Chr$(13)
  4355.     m$ = m$ + ".22..22." + Chr$(13)
  4356.     m$ = m$ + ".22222.." + Chr$(13)
  4357.     m$ = m$ + "........" + Chr$(13)
  4358.     m$ = m$ + "........" + Chr$(13)
  4359.     arrTileText(98) = m$
  4360.  
  4361.     m$ = ""
  4362.     m$ = m$ + "........" + Chr$(13)
  4363.     m$ = m$ + "..2222.." + Chr$(13)
  4364.     m$ = m$ + ".22....." + Chr$(13)
  4365.     m$ = m$ + ".22....." + Chr$(13)
  4366.     m$ = m$ + ".22....." + Chr$(13)
  4367.     m$ = m$ + "..2222.." + Chr$(13)
  4368.     m$ = m$ + "........" + Chr$(13)
  4369.     m$ = m$ + "........" + Chr$(13)
  4370.     arrTileText(99) = m$
  4371.  
  4372.     m$ = ""
  4373.     m$ = m$ + ".....22." + Chr$(13)
  4374.     m$ = m$ + ".....22." + Chr$(13)
  4375.     m$ = m$ + "..22222." + Chr$(13)
  4376.     m$ = m$ + ".22..22." + Chr$(13)
  4377.     m$ = m$ + ".22..22." + Chr$(13)
  4378.     m$ = m$ + "..22222." + Chr$(13)
  4379.     m$ = m$ + "........" + Chr$(13)
  4380.     m$ = m$ + "........" + Chr$(13)
  4381.     arrTileText(100) = m$
  4382.  
  4383.     m$ = ""
  4384.     m$ = m$ + "........" + Chr$(13)
  4385.     m$ = m$ + "..2222.." + Chr$(13)
  4386.     m$ = m$ + ".22..22." + Chr$(13)
  4387.     m$ = m$ + ".222222." + Chr$(13)
  4388.     m$ = m$ + ".22....." + Chr$(13)
  4389.     m$ = m$ + "..2222.." + Chr$(13)
  4390.     m$ = m$ + "........" + Chr$(13)
  4391.     m$ = m$ + "........" + Chr$(13)
  4392.     arrTileText(101) = m$
  4393.  
  4394.     m$ = ""
  4395.     m$ = m$ + "....222." + Chr$(13)
  4396.     m$ = m$ + "...22..." + Chr$(13)
  4397.     m$ = m$ + "..22222." + Chr$(13)
  4398.     m$ = m$ + "...22..." + Chr$(13)
  4399.     m$ = m$ + "...22..." + Chr$(13)
  4400.     m$ = m$ + "...22..." + Chr$(13)
  4401.     m$ = m$ + "........" + Chr$(13)
  4402.     m$ = m$ + "........" + Chr$(13)
  4403.     arrTileText(102) = m$
  4404.  
  4405.     m$ = ""
  4406.     m$ = m$ + "........" + Chr$(13)
  4407.     m$ = m$ + "..22222." + Chr$(13)
  4408.     m$ = m$ + ".22..22." + Chr$(13)
  4409.     m$ = m$ + ".22..22." + Chr$(13)
  4410.     m$ = m$ + "..22222." + Chr$(13)
  4411.     m$ = m$ + ".....22." + Chr$(13)
  4412.     m$ = m$ + ".22222.." + Chr$(13)
  4413.     m$ = m$ + "........" + Chr$(13)
  4414.     arrTileText(103) = m$
  4415.  
  4416.     m$ = ""
  4417.     m$ = m$ + ".22....." + Chr$(13)
  4418.     m$ = m$ + ".22....." + Chr$(13)
  4419.     m$ = m$ + ".22222.." + Chr$(13)
  4420.     m$ = m$ + ".22..22." + Chr$(13)
  4421.     m$ = m$ + ".22..22." + Chr$(13)
  4422.     m$ = m$ + ".22..22." + Chr$(13)
  4423.     m$ = m$ + "........" + Chr$(13)
  4424.     m$ = m$ + "........" + Chr$(13)
  4425.     arrTileText(104) = m$
  4426.  
  4427.     m$ = ""
  4428.     m$ = m$ + "...22..." + Chr$(13)
  4429.     m$ = m$ + "........" + Chr$(13)
  4430.     m$ = m$ + "..222..." + Chr$(13)
  4431.     m$ = m$ + "...22..." + Chr$(13)
  4432.     m$ = m$ + "...22..." + Chr$(13)
  4433.     m$ = m$ + "..2222.." + Chr$(13)
  4434.     m$ = m$ + "........" + Chr$(13)
  4435.     m$ = m$ + "........" + Chr$(13)
  4436.     arrTileText(105) = m$
  4437.  
  4438.     m$ = ""
  4439.     m$ = m$ + ".....22." + Chr$(13)
  4440.     m$ = m$ + "........" + Chr$(13)
  4441.     m$ = m$ + ".....22." + Chr$(13)
  4442.     m$ = m$ + ".....22." + Chr$(13)
  4443.     m$ = m$ + ".....22." + Chr$(13)
  4444.     m$ = m$ + ".....22." + Chr$(13)
  4445.     m$ = m$ + "..2222.." + Chr$(13)
  4446.     m$ = m$ + "........" + Chr$(13)
  4447.     arrTileText(106) = m$
  4448.  
  4449.     m$ = ""
  4450.     m$ = m$ + ".22....." + Chr$(13)
  4451.     m$ = m$ + ".22....." + Chr$(13)
  4452.     m$ = m$ + ".22.22.." + Chr$(13)
  4453.     m$ = m$ + ".2222..." + Chr$(13)
  4454.     m$ = m$ + ".22.22.." + Chr$(13)
  4455.     m$ = m$ + ".22..22." + Chr$(13)
  4456.     m$ = m$ + "........" + Chr$(13)
  4457.     m$ = m$ + "........" + Chr$(13)
  4458.     arrTileText(107) = m$
  4459.  
  4460.     m$ = ""
  4461.     m$ = m$ + "..222..." + Chr$(13)
  4462.     m$ = m$ + "...22..." + Chr$(13)
  4463.     m$ = m$ + "...22..." + Chr$(13)
  4464.     m$ = m$ + "...22..." + Chr$(13)
  4465.     m$ = m$ + "...22..." + Chr$(13)
  4466.     m$ = m$ + "..2222.." + Chr$(13)
  4467.     m$ = m$ + "........" + Chr$(13)
  4468.     m$ = m$ + "........" + Chr$(13)
  4469.     arrTileText(108) = m$
  4470.  
  4471.     m$ = ""
  4472.     m$ = m$ + "........" + Chr$(13)
  4473.     m$ = m$ + ".22..22." + Chr$(13)
  4474.     m$ = m$ + ".2222222" + Chr$(13)
  4475.     m$ = m$ + ".2222222" + Chr$(13)
  4476.     m$ = m$ + ".22.2.22" + Chr$(13)
  4477.     m$ = m$ + ".22...22" + Chr$(13)
  4478.     m$ = m$ + "........" + Chr$(13)
  4479.     m$ = m$ + "........" + Chr$(13)
  4480.     arrTileText(109) = m$
  4481.  
  4482.     m$ = ""
  4483.     m$ = m$ + "........" + Chr$(13)
  4484.     m$ = m$ + ".22222.." + Chr$(13)
  4485.     m$ = m$ + ".22..22." + Chr$(13)
  4486.     m$ = m$ + ".22..22." + Chr$(13)
  4487.     m$ = m$ + ".22..22." + Chr$(13)
  4488.     m$ = m$ + ".22..22." + Chr$(13)
  4489.     m$ = m$ + "........" + Chr$(13)
  4490.     m$ = m$ + "........" + Chr$(13)
  4491.     arrTileText(110) = m$
  4492.  
  4493.     m$ = ""
  4494.     m$ = m$ + "........" + Chr$(13)
  4495.     m$ = m$ + "..2222.." + Chr$(13)
  4496.     m$ = m$ + ".22..22." + Chr$(13)
  4497.     m$ = m$ + ".22..22." + Chr$(13)
  4498.     m$ = m$ + ".22..22." + Chr$(13)
  4499.     m$ = m$ + "..2222.." + Chr$(13)
  4500.     m$ = m$ + "........" + Chr$(13)
  4501.     m$ = m$ + "........" + Chr$(13)
  4502.     arrTileText(111) = m$
  4503.  
  4504.     m$ = ""
  4505.     m$ = m$ + "........" + Chr$(13)
  4506.     m$ = m$ + ".22222.." + Chr$(13)
  4507.     m$ = m$ + ".22..22." + Chr$(13)
  4508.     m$ = m$ + ".22..22." + Chr$(13)
  4509.     m$ = m$ + ".22222.." + Chr$(13)
  4510.     m$ = m$ + ".22....." + Chr$(13)
  4511.     m$ = m$ + ".22....." + Chr$(13)
  4512.     m$ = m$ + "........" + Chr$(13)
  4513.     arrTileText(112) = m$
  4514.  
  4515.     m$ = ""
  4516.     m$ = m$ + "........" + Chr$(13)
  4517.     m$ = m$ + "..22222." + Chr$(13)
  4518.     m$ = m$ + ".22..22." + Chr$(13)
  4519.     m$ = m$ + ".22..22." + Chr$(13)
  4520.     m$ = m$ + "..22222." + Chr$(13)
  4521.     m$ = m$ + ".....22." + Chr$(13)
  4522.     m$ = m$ + ".....22." + Chr$(13)
  4523.     m$ = m$ + "........" + Chr$(13)
  4524.     arrTileText(113) = m$
  4525.  
  4526.     m$ = ""
  4527.     m$ = m$ + "........" + Chr$(13)
  4528.     m$ = m$ + ".22222.." + Chr$(13)
  4529.     m$ = m$ + ".22..22." + Chr$(13)
  4530.     m$ = m$ + ".22....." + Chr$(13)
  4531.     m$ = m$ + ".22....." + Chr$(13)
  4532.     m$ = m$ + ".22....." + Chr$(13)
  4533.     m$ = m$ + "........" + Chr$(13)
  4534.     m$ = m$ + "........" + Chr$(13)
  4535.     arrTileText(114) = m$
  4536.  
  4537.     m$ = ""
  4538.     m$ = m$ + "........" + Chr$(13)
  4539.     m$ = m$ + "..22222." + Chr$(13)
  4540.     m$ = m$ + ".22....." + Chr$(13)
  4541.     m$ = m$ + "..2222.." + Chr$(13)
  4542.     m$ = m$ + ".....22." + Chr$(13)
  4543.     m$ = m$ + ".22222.." + Chr$(13)
  4544.     m$ = m$ + "........" + Chr$(13)
  4545.     m$ = m$ + "........" + Chr$(13)
  4546.     arrTileText(115) = m$
  4547.  
  4548.     m$ = ""
  4549.     m$ = m$ + "...22..." + Chr$(13)
  4550.     m$ = m$ + ".222222." + Chr$(13)
  4551.     m$ = m$ + "...22..." + Chr$(13)
  4552.     m$ = m$ + "...22..." + Chr$(13)
  4553.     m$ = m$ + "...22..." + Chr$(13)
  4554.     m$ = m$ + "....222." + Chr$(13)
  4555.     m$ = m$ + "........" + Chr$(13)
  4556.     m$ = m$ + "........" + Chr$(13)
  4557.     arrTileText(116) = m$
  4558.  
  4559.     m$ = ""
  4560.     m$ = m$ + "........" + Chr$(13)
  4561.     m$ = m$ + ".22..22." + Chr$(13)
  4562.     m$ = m$ + ".22..22." + Chr$(13)
  4563.     m$ = m$ + ".22..22." + Chr$(13)
  4564.     m$ = m$ + ".22..22." + Chr$(13)
  4565.     m$ = m$ + "..22222." + Chr$(13)
  4566.     m$ = m$ + "........" + Chr$(13)
  4567.     m$ = m$ + "........" + Chr$(13)
  4568.     arrTileText(117) = m$
  4569.  
  4570.     m$ = ""
  4571.     m$ = m$ + "........" + Chr$(13)
  4572.     m$ = m$ + ".22..22." + Chr$(13)
  4573.     m$ = m$ + ".22..22." + Chr$(13)
  4574.     m$ = m$ + ".22..22." + Chr$(13)
  4575.     m$ = m$ + "..2222.." + Chr$(13)
  4576.     m$ = m$ + "...22..." + Chr$(13)
  4577.     m$ = m$ + "........" + Chr$(13)
  4578.     m$ = m$ + "........" + Chr$(13)
  4579.     arrTileText(118) = m$
  4580.  
  4581.     m$ = ""
  4582.     m$ = m$ + "........" + Chr$(13)
  4583.     m$ = m$ + ".22...22" + Chr$(13)
  4584.     m$ = m$ + ".22.2.22" + Chr$(13)
  4585.     m$ = m$ + ".2222222" + Chr$(13)
  4586.     m$ = m$ + "..22222." + Chr$(13)
  4587.     m$ = m$ + "..22.22." + Chr$(13)
  4588.     m$ = m$ + "........" + Chr$(13)
  4589.     m$ = m$ + "........" + Chr$(13)
  4590.     arrTileText(119) = m$
  4591.  
  4592.     m$ = ""
  4593.     m$ = m$ + "........" + Chr$(13)
  4594.     m$ = m$ + ".22..22." + Chr$(13)
  4595.     m$ = m$ + "..2222.." + Chr$(13)
  4596.     m$ = m$ + "...22..." + Chr$(13)
  4597.     m$ = m$ + "..2222.." + Chr$(13)
  4598.     m$ = m$ + ".22..22." + Chr$(13)
  4599.     m$ = m$ + "........" + Chr$(13)
  4600.     m$ = m$ + "........" + Chr$(13)
  4601.     arrTileText(120) = m$
  4602.  
  4603.     m$ = ""
  4604.     m$ = m$ + "........" + Chr$(13)
  4605.     m$ = m$ + ".22..22." + Chr$(13)
  4606.     m$ = m$ + ".22..22." + Chr$(13)
  4607.     m$ = m$ + ".22..22." + Chr$(13)
  4608.     m$ = m$ + "..22222." + Chr$(13)
  4609.     m$ = m$ + "....22.." + Chr$(13)
  4610.     m$ = m$ + ".2222..." + Chr$(13)
  4611.     m$ = m$ + "........" + Chr$(13)
  4612.     arrTileText(121) = m$
  4613.  
  4614.     m$ = ""
  4615.     m$ = m$ + "........" + Chr$(13)
  4616.     m$ = m$ + ".222222." + Chr$(13)
  4617.     m$ = m$ + "....22.." + Chr$(13)
  4618.     m$ = m$ + "...22..." + Chr$(13)
  4619.     m$ = m$ + "..22...." + Chr$(13)
  4620.     m$ = m$ + ".222222." + Chr$(13)
  4621.     m$ = m$ + "........" + Chr$(13)
  4622.     m$ = m$ + "........" + Chr$(13)
  4623.     arrTileText(122) = m$
  4624.  
  4625.     m$ = ""
  4626.     m$ = m$ + "...222.." + Chr$(13)
  4627.     m$ = m$ + "..22...." + Chr$(13)
  4628.     m$ = m$ + "..2....." + Chr$(13)
  4629.     m$ = m$ + ".22....." + Chr$(13)
  4630.     m$ = m$ + "..2....." + Chr$(13)
  4631.     m$ = m$ + "..22...." + Chr$(13)
  4632.     m$ = m$ + "...222.." + Chr$(13)
  4633.     m$ = m$ + "........" + Chr$(13)
  4634.     arrTileText(123) = m$
  4635.  
  4636.     m$ = ""
  4637.     m$ = m$ + "....2..." + Chr$(13)
  4638.     m$ = m$ + "....2..." + Chr$(13)
  4639.     m$ = m$ + "....2..." + Chr$(13)
  4640.     m$ = m$ + "....2..." + Chr$(13)
  4641.     m$ = m$ + "....2..." + Chr$(13)
  4642.     m$ = m$ + "....2..." + Chr$(13)
  4643.     m$ = m$ + "....2..." + Chr$(13)
  4644.     m$ = m$ + "........" + Chr$(13)
  4645.     arrTileText(124) = m$
  4646.  
  4647.     m$ = ""
  4648.     m$ = m$ + "..222..." + Chr$(13)
  4649.     m$ = m$ + "....22.." + Chr$(13)
  4650.     m$ = m$ + ".....2.." + Chr$(13)
  4651.     m$ = m$ + ".....22." + Chr$(13)
  4652.     m$ = m$ + ".....2.." + Chr$(13)
  4653.     m$ = m$ + "....22.." + Chr$(13)
  4654.     m$ = m$ + "..222..." + Chr$(13)
  4655.     m$ = m$ + "........" + Chr$(13)
  4656.     arrTileText(125) = m$
  4657.  
  4658.     m$ = ""
  4659.     m$ = m$ + "........" + Chr$(13)
  4660.     m$ = m$ + ".22....2" + Chr$(13)
  4661.     m$ = m$ + "2..2..2." + Chr$(13)
  4662.     m$ = m$ + "....22.." + Chr$(13)
  4663.     m$ = m$ + "........" + Chr$(13)
  4664.     m$ = m$ + "........" + Chr$(13)
  4665.     m$ = m$ + "........" + Chr$(13)
  4666.     m$ = m$ + "........" + Chr$(13)
  4667.     arrTileText(126) = m$
  4668.  
  4669.     m$ = ""
  4670.     m$ = m$ + "........" + Chr$(13)
  4671.     m$ = m$ + "........" + Chr$(13)
  4672.     m$ = m$ + "........" + Chr$(13)
  4673.     m$ = m$ + "........" + Chr$(13)
  4674.     m$ = m$ + "........" + Chr$(13)
  4675.     m$ = m$ + "........" + Chr$(13)
  4676.     m$ = m$ + "........" + Chr$(13)
  4677.     m$ = m$ + "........" + Chr$(13)
  4678.     arrTileText(127) = m$
  4679.  
  4680.     m$ = ""
  4681.     m$ = m$ + "........" + Chr$(13)
  4682.     m$ = m$ + "........" + Chr$(13)
  4683.     m$ = m$ + "........" + Chr$(13)
  4684.     m$ = m$ + "22222222" + Chr$(13)
  4685.     m$ = m$ + "22222222" + Chr$(13)
  4686.     m$ = m$ + "........" + Chr$(13)
  4687.     m$ = m$ + "........" + Chr$(13)
  4688.     m$ = m$ + "........" + Chr$(13)
  4689.     arrTileText(128) = m$
  4690.  
  4691.     m$ = ""
  4692.     m$ = m$ + "....2..." + Chr$(13)
  4693.     m$ = m$ + "...222.." + Chr$(13)
  4694.     m$ = m$ + "..22222." + Chr$(13)
  4695.     m$ = m$ + ".2222222" + Chr$(13)
  4696.     m$ = m$ + ".2222222" + Chr$(13)
  4697.     m$ = m$ + "...222.." + Chr$(13)
  4698.     m$ = m$ + "..22222." + Chr$(13)
  4699.     m$ = m$ + "........" + Chr$(13)
  4700.     arrTileText(129) = m$
  4701.  
  4702.     m$ = ""
  4703.     m$ = m$ + "...22..." + Chr$(13)
  4704.     m$ = m$ + "...22..." + Chr$(13)
  4705.     m$ = m$ + "...22..." + Chr$(13)
  4706.     m$ = m$ + "...22..." + Chr$(13)
  4707.     m$ = m$ + "...22..." + Chr$(13)
  4708.     m$ = m$ + "...22..." + Chr$(13)
  4709.     m$ = m$ + "...22..." + Chr$(13)
  4710.     m$ = m$ + "...22..." + Chr$(13)
  4711.     arrTileText(130) = m$
  4712.  
  4713.     m$ = ""
  4714.     m$ = m$ + "........" + Chr$(13)
  4715.     m$ = m$ + "........" + Chr$(13)
  4716.     m$ = m$ + "........" + Chr$(13)
  4717.     m$ = m$ + "22222222" + Chr$(13)
  4718.     m$ = m$ + "22222222" + Chr$(13)
  4719.     m$ = m$ + "........" + Chr$(13)
  4720.     m$ = m$ + "........" + Chr$(13)
  4721.     m$ = m$ + "........" + Chr$(13)
  4722.     arrTileText(131) = m$
  4723.  
  4724.     m$ = ""
  4725.     m$ = m$ + "........" + Chr$(13)
  4726.     m$ = m$ + "........" + Chr$(13)
  4727.     m$ = m$ + "22222222" + Chr$(13)
  4728.     m$ = m$ + "22222222" + Chr$(13)
  4729.     m$ = m$ + "........" + Chr$(13)
  4730.     m$ = m$ + "........" + Chr$(13)
  4731.     m$ = m$ + "........" + Chr$(13)
  4732.     m$ = m$ + "........" + Chr$(13)
  4733.     arrTileText(132) = m$
  4734.  
  4735.     m$ = ""
  4736.     m$ = m$ + "........" + Chr$(13)
  4737.     m$ = m$ + "22222222" + Chr$(13)
  4738.     m$ = m$ + "22222222" + Chr$(13)
  4739.     m$ = m$ + "........" + Chr$(13)
  4740.     m$ = m$ + "........" + Chr$(13)
  4741.     m$ = m$ + "........" + Chr$(13)
  4742.     m$ = m$ + "........" + Chr$(13)
  4743.     m$ = m$ + "........" + Chr$(13)
  4744.     arrTileText(133) = m$
  4745.  
  4746.     m$ = ""
  4747.     m$ = m$ + "........" + Chr$(13)
  4748.     m$ = m$ + "........" + Chr$(13)
  4749.     m$ = m$ + "........" + Chr$(13)
  4750.     m$ = m$ + "........" + Chr$(13)
  4751.     m$ = m$ + "22222222" + Chr$(13)
  4752.     m$ = m$ + "22222222" + Chr$(13)
  4753.     m$ = m$ + "........" + Chr$(13)
  4754.     m$ = m$ + "........" + Chr$(13)
  4755.     arrTileText(134) = m$
  4756.  
  4757.     m$ = ""
  4758.     m$ = m$ + "..22...." + Chr$(13)
  4759.     m$ = m$ + "..22...." + Chr$(13)
  4760.     m$ = m$ + "..22...." + Chr$(13)
  4761.     m$ = m$ + "..22...." + Chr$(13)
  4762.     m$ = m$ + "..22...." + Chr$(13)
  4763.     m$ = m$ + "..22...." + Chr$(13)
  4764.     m$ = m$ + "..22...." + Chr$(13)
  4765.     m$ = m$ + "..22...." + Chr$(13)
  4766.     arrTileText(135) = m$
  4767.  
  4768.     m$ = ""
  4769.     m$ = m$ + "....22.." + Chr$(13)
  4770.     m$ = m$ + "....22.." + Chr$(13)
  4771.     m$ = m$ + "....22.." + Chr$(13)
  4772.     m$ = m$ + "....22.." + Chr$(13)
  4773.     m$ = m$ + "....22.." + Chr$(13)
  4774.     m$ = m$ + "....22.." + Chr$(13)
  4775.     m$ = m$ + "....22.." + Chr$(13)
  4776.     m$ = m$ + "....22.." + Chr$(13)
  4777.     arrTileText(136) = m$
  4778.  
  4779.     m$ = ""
  4780.     m$ = m$ + "........" + Chr$(13)
  4781.     m$ = m$ + "........" + Chr$(13)
  4782.     m$ = m$ + "........" + Chr$(13)
  4783.     m$ = m$ + "222....." + Chr$(13)
  4784.     m$ = m$ + "2222...." + Chr$(13)
  4785.     m$ = m$ + "..222..." + Chr$(13)
  4786.     m$ = m$ + "...22..." + Chr$(13)
  4787.     m$ = m$ + "...22..." + Chr$(13)
  4788.     arrTileText(137) = m$
  4789.  
  4790.     m$ = ""
  4791.     m$ = m$ + "...22..." + Chr$(13)
  4792.     m$ = m$ + "...22..." + Chr$(13)
  4793.     m$ = m$ + "...222.." + Chr$(13)
  4794.     m$ = m$ + "....2222" + Chr$(13)
  4795.     m$ = m$ + ".....222" + Chr$(13)
  4796.     m$ = m$ + "........" + Chr$(13)
  4797.     m$ = m$ + "........" + Chr$(13)
  4798.     m$ = m$ + "........" + Chr$(13)
  4799.     arrTileText(138) = m$
  4800.  
  4801.     m$ = ""
  4802.     m$ = m$ + "...22..." + Chr$(13)
  4803.     m$ = m$ + "...22..." + Chr$(13)
  4804.     m$ = m$ + "..222..." + Chr$(13)
  4805.     m$ = m$ + "2222...." + Chr$(13)
  4806.     m$ = m$ + "222....." + Chr$(13)
  4807.     m$ = m$ + "........" + Chr$(13)
  4808.     m$ = m$ + "........" + Chr$(13)
  4809.     m$ = m$ + "........" + Chr$(13)
  4810.     arrTileText(139) = m$
  4811.  
  4812.     m$ = ""
  4813.     m$ = m$ + "22......" + Chr$(13)
  4814.     m$ = m$ + "22......" + Chr$(13)
  4815.     m$ = m$ + "22......" + Chr$(13)
  4816.     m$ = m$ + "22......" + Chr$(13)
  4817.     m$ = m$ + "22......" + Chr$(13)
  4818.     m$ = m$ + "22......" + Chr$(13)
  4819.     m$ = m$ + "22222222" + Chr$(13)
  4820.     m$ = m$ + "22222222" + Chr$(13)
  4821.     arrTileText(140) = m$
  4822.  
  4823.     m$ = ""
  4824.     m$ = m$ + "22......" + Chr$(13)
  4825.     m$ = m$ + "222....." + Chr$(13)
  4826.     m$ = m$ + ".222...." + Chr$(13)
  4827.     m$ = m$ + "..222..." + Chr$(13)
  4828.     m$ = m$ + "...222.." + Chr$(13)
  4829.     m$ = m$ + "....222." + Chr$(13)
  4830.     m$ = m$ + ".....222" + Chr$(13)
  4831.     m$ = m$ + "......22" + Chr$(13)
  4832.     arrTileText(141) = m$
  4833.  
  4834.     m$ = ""
  4835.     m$ = m$ + "......22" + Chr$(13)
  4836.     m$ = m$ + ".....222" + Chr$(13)
  4837.     m$ = m$ + "....222." + Chr$(13)
  4838.     m$ = m$ + "...222.." + Chr$(13)
  4839.     m$ = m$ + "..222..." + Chr$(13)
  4840.     m$ = m$ + ".222...." + Chr$(13)
  4841.     m$ = m$ + "222....." + Chr$(13)
  4842.     m$ = m$ + "22......" + Chr$(13)
  4843.     arrTileText(142) = m$
  4844.  
  4845.     m$ = ""
  4846.     m$ = m$ + "22222222" + Chr$(13)
  4847.     m$ = m$ + "22222222" + Chr$(13)
  4848.     m$ = m$ + "22......" + Chr$(13)
  4849.     m$ = m$ + "22......" + Chr$(13)
  4850.     m$ = m$ + "22......" + Chr$(13)
  4851.     m$ = m$ + "22......" + Chr$(13)
  4852.     m$ = m$ + "22......" + Chr$(13)
  4853.     m$ = m$ + "22......" + Chr$(13)
  4854.     arrTileText(143) = m$
  4855.  
  4856.     m$ = ""
  4857.     m$ = m$ + "22222222" + Chr$(13)
  4858.     m$ = m$ + "22222222" + Chr$(13)
  4859.     m$ = m$ + "......22" + Chr$(13)
  4860.     m$ = m$ + "......22" + Chr$(13)
  4861.     m$ = m$ + "......22" + Chr$(13)
  4862.     m$ = m$ + "......22" + Chr$(13)
  4863.     m$ = m$ + "......22" + Chr$(13)
  4864.     m$ = m$ + "......22" + Chr$(13)
  4865.     arrTileText(144) = m$
  4866.  
  4867.     m$ = ""
  4868.     m$ = m$ + "........" + Chr$(13)
  4869.     m$ = m$ + "..2222.." + Chr$(13)
  4870.     m$ = m$ + ".222222." + Chr$(13)
  4871.     m$ = m$ + ".222222." + Chr$(13)
  4872.     m$ = m$ + ".222222." + Chr$(13)
  4873.     m$ = m$ + ".222222." + Chr$(13)
  4874.     m$ = m$ + "..2222.." + Chr$(13)
  4875.     m$ = m$ + "........" + Chr$(13)
  4876.     arrTileText(145) = m$
  4877.  
  4878.     m$ = ""
  4879.     m$ = m$ + "........" + Chr$(13)
  4880.     m$ = m$ + "........" + Chr$(13)
  4881.     m$ = m$ + "........" + Chr$(13)
  4882.     m$ = m$ + "........" + Chr$(13)
  4883.     m$ = m$ + "........" + Chr$(13)
  4884.     m$ = m$ + "22222222" + Chr$(13)
  4885.     m$ = m$ + "22222222" + Chr$(13)
  4886.     m$ = m$ + "........" + Chr$(13)
  4887.     arrTileText(146) = m$
  4888.  
  4889.     m$ = ""
  4890.     m$ = m$ + "..22.22." + Chr$(13)
  4891.     m$ = m$ + ".2222222" + Chr$(13)
  4892.     m$ = m$ + ".2222222" + Chr$(13)
  4893.     m$ = m$ + ".2222222" + Chr$(13)
  4894.     m$ = m$ + "..22222." + Chr$(13)
  4895.     m$ = m$ + "...222.." + Chr$(13)
  4896.     m$ = m$ + "....2..." + Chr$(13)
  4897.     m$ = m$ + "........" + Chr$(13)
  4898.     arrTileText(147) = m$
  4899.  
  4900.     m$ = ""
  4901.     m$ = m$ + ".22....." + Chr$(13)
  4902.     m$ = m$ + ".22....." + Chr$(13)
  4903.     m$ = m$ + ".22....." + Chr$(13)
  4904.     m$ = m$ + ".22....." + Chr$(13)
  4905.     m$ = m$ + ".22....." + Chr$(13)
  4906.     m$ = m$ + ".22....." + Chr$(13)
  4907.     m$ = m$ + ".22....." + Chr$(13)
  4908.     m$ = m$ + ".22....." + Chr$(13)
  4909.     arrTileText(148) = m$
  4910.  
  4911.     m$ = ""
  4912.     m$ = m$ + "........" + Chr$(13)
  4913.     m$ = m$ + "........" + Chr$(13)
  4914.     m$ = m$ + "........" + Chr$(13)
  4915.     m$ = m$ + ".....222" + Chr$(13)
  4916.     m$ = m$ + "....2222" + Chr$(13)
  4917.     m$ = m$ + "...222.." + Chr$(13)
  4918.     m$ = m$ + "...22..." + Chr$(13)
  4919.     m$ = m$ + "...22..." + Chr$(13)
  4920.     arrTileText(149) = m$
  4921.  
  4922.     m$ = ""
  4923.     m$ = m$ + "22....22" + Chr$(13)
  4924.     m$ = m$ + "222..222" + Chr$(13)
  4925.     m$ = m$ + ".222222." + Chr$(13)
  4926.     m$ = m$ + "..2222.." + Chr$(13)
  4927.     m$ = m$ + "..2222.." + Chr$(13)
  4928.     m$ = m$ + ".222222." + Chr$(13)
  4929.     m$ = m$ + "222..222" + Chr$(13)
  4930.     m$ = m$ + "22....22" + Chr$(13)
  4931.     arrTileText(150) = m$
  4932.  
  4933.     m$ = ""
  4934.     m$ = m$ + "........" + Chr$(13)
  4935.     m$ = m$ + "..2222.." + Chr$(13)
  4936.     m$ = m$ + ".222222." + Chr$(13)
  4937.     m$ = m$ + ".22..22." + Chr$(13)
  4938.     m$ = m$ + ".22..22." + Chr$(13)
  4939.     m$ = m$ + ".222222." + Chr$(13)
  4940.     m$ = m$ + "..2222.." + Chr$(13)
  4941.     m$ = m$ + "........" + Chr$(13)
  4942.     arrTileText(151) = m$
  4943.  
  4944.     m$ = ""
  4945.     m$ = m$ + "...22..." + Chr$(13)
  4946.     m$ = m$ + "...22..." + Chr$(13)
  4947.     m$ = m$ + ".22..22." + Chr$(13)
  4948.     m$ = m$ + ".22..22." + Chr$(13)
  4949.     m$ = m$ + "...22..." + Chr$(13)
  4950.     m$ = m$ + "...22..." + Chr$(13)
  4951.     m$ = m$ + "..2222.." + Chr$(13)
  4952.     m$ = m$ + "........" + Chr$(13)
  4953.     arrTileText(152) = m$
  4954.  
  4955.     m$ = ""
  4956.     m$ = m$ + ".....22." + Chr$(13)
  4957.     m$ = m$ + ".....22." + Chr$(13)
  4958.     m$ = m$ + ".....22." + Chr$(13)
  4959.     m$ = m$ + ".....22." + Chr$(13)
  4960.     m$ = m$ + ".....22." + Chr$(13)
  4961.     m$ = m$ + ".....22." + Chr$(13)
  4962.     m$ = m$ + ".....22." + Chr$(13)
  4963.     m$ = m$ + ".....22." + Chr$(13)
  4964.     arrTileText(153) = m$
  4965.  
  4966.     m$ = ""
  4967.     m$ = m$ + "....2..." + Chr$(13)
  4968.     m$ = m$ + "...222.." + Chr$(13)
  4969.     m$ = m$ + "..22222." + Chr$(13)
  4970.     m$ = m$ + ".2222222" + Chr$(13)
  4971.     m$ = m$ + "..22222." + Chr$(13)
  4972.     m$ = m$ + "...222.." + Chr$(13)
  4973.     m$ = m$ + "....2..." + Chr$(13)
  4974.     m$ = m$ + "........" + Chr$(13)
  4975.     arrTileText(154) = m$
  4976.  
  4977.     m$ = ""
  4978.     m$ = m$ + "...22..." + Chr$(13)
  4979.     m$ = m$ + "...22..." + Chr$(13)
  4980.     m$ = m$ + "...22..." + Chr$(13)
  4981.     m$ = m$ + "22222222" + Chr$(13)
  4982.     m$ = m$ + "22222222" + Chr$(13)
  4983.     m$ = m$ + "...22..." + Chr$(13)
  4984.     m$ = m$ + "...22..." + Chr$(13)
  4985.     m$ = m$ + "...22..." + Chr$(13)
  4986.     arrTileText(155) = m$
  4987.  
  4988.     m$ = ""
  4989.     m$ = m$ + "22......" + Chr$(13)
  4990.     m$ = m$ + "22......" + Chr$(13)
  4991.     m$ = m$ + "..22...." + Chr$(13)
  4992.     m$ = m$ + "..22...." + Chr$(13)
  4993.     m$ = m$ + "22......" + Chr$(13)
  4994.     m$ = m$ + "22......" + Chr$(13)
  4995.     m$ = m$ + "..22...." + Chr$(13)
  4996.     m$ = m$ + "..22...." + Chr$(13)
  4997.     arrTileText(156) = m$
  4998.  
  4999.     m$ = ""
  5000.     m$ = m$ + "...22..." + Chr$(13)
  5001.     m$ = m$ + "...22..." + Chr$(13)
  5002.     m$ = m$ + "...22..." + Chr$(13)
  5003.     m$ = m$ + "...22..." + Chr$(13)
  5004.     m$ = m$ + "...22..." + Chr$(13)
  5005.     m$ = m$ + "...22..." + Chr$(13)
  5006.     m$ = m$ + "...22..." + Chr$(13)
  5007.     m$ = m$ + "...22..." + Chr$(13)
  5008.     arrTileText(157) = m$
  5009.  
  5010.     m$ = ""
  5011.     m$ = m$ + "........" + Chr$(13)
  5012.     m$ = m$ + "........" + Chr$(13)
  5013.     m$ = m$ + "......22" + Chr$(13)
  5014.     m$ = m$ + "..22222." + Chr$(13)
  5015.     m$ = m$ + ".222.22." + Chr$(13)
  5016.     m$ = m$ + "..22.22." + Chr$(13)
  5017.     m$ = m$ + "..22.22." + Chr$(13)
  5018.     m$ = m$ + "........" + Chr$(13)
  5019.     arrTileText(158) = m$
  5020.  
  5021.     m$ = ""
  5022.     m$ = m$ + "22222222" + Chr$(13)
  5023.     m$ = m$ + ".2222222" + Chr$(13)
  5024.     m$ = m$ + "..222222" + Chr$(13)
  5025.     m$ = m$ + "...22222" + Chr$(13)
  5026.     m$ = m$ + "....2222" + Chr$(13)
  5027.     m$ = m$ + ".....222" + Chr$(13)
  5028.     m$ = m$ + "......22" + Chr$(13)
  5029.     m$ = m$ + ".......2" + Chr$(13)
  5030.     arrTileText(159) = m$
  5031.  
  5032.     m$ = ""
  5033.     m$ = m$ + "........" + Chr$(13)
  5034.     m$ = m$ + "........" + Chr$(13)
  5035.     m$ = m$ + "........" + Chr$(13)
  5036.     m$ = m$ + "........" + Chr$(13)
  5037.     m$ = m$ + "........" + Chr$(13)
  5038.     m$ = m$ + "........" + Chr$(13)
  5039.     m$ = m$ + "........" + Chr$(13)
  5040.     m$ = m$ + "........" + Chr$(13)
  5041.     arrTileText(160) = m$
  5042.  
  5043.     m$ = ""
  5044.     m$ = m$ + "2222...." + Chr$(13)
  5045.     m$ = m$ + "2222...." + Chr$(13)
  5046.     m$ = m$ + "2222...." + Chr$(13)
  5047.     m$ = m$ + "2222...." + Chr$(13)
  5048.     m$ = m$ + "2222...." + Chr$(13)
  5049.     m$ = m$ + "2222...." + Chr$(13)
  5050.     m$ = m$ + "2222...." + Chr$(13)
  5051.     m$ = m$ + "2222...." + Chr$(13)
  5052.     arrTileText(161) = m$
  5053.  
  5054.     m$ = ""
  5055.     m$ = m$ + "........" + Chr$(13)
  5056.     m$ = m$ + "........" + Chr$(13)
  5057.     m$ = m$ + "........" + Chr$(13)
  5058.     m$ = m$ + "........" + Chr$(13)
  5059.     m$ = m$ + "22222222" + Chr$(13)
  5060.     m$ = m$ + "22222222" + Chr$(13)
  5061.     m$ = m$ + "22222222" + Chr$(13)
  5062.     m$ = m$ + "22222222" + Chr$(13)
  5063.     arrTileText(162) = m$
  5064.  
  5065.     m$ = ""
  5066.     m$ = m$ + "22222222" + Chr$(13)
  5067.     m$ = m$ + "........" + Chr$(13)
  5068.     m$ = m$ + "........" + Chr$(13)
  5069.     m$ = m$ + "........" + Chr$(13)
  5070.     m$ = m$ + "........" + Chr$(13)
  5071.     m$ = m$ + "........" + Chr$(13)
  5072.     m$ = m$ + "........" + Chr$(13)
  5073.     m$ = m$ + "........" + Chr$(13)
  5074.     arrTileText(163) = m$
  5075.  
  5076.     m$ = ""
  5077.     m$ = m$ + "........" + Chr$(13)
  5078.     m$ = m$ + "........" + Chr$(13)
  5079.     m$ = m$ + "........" + Chr$(13)
  5080.     m$ = m$ + "........" + Chr$(13)
  5081.     m$ = m$ + "........" + Chr$(13)
  5082.     m$ = m$ + "........" + Chr$(13)
  5083.     m$ = m$ + "........" + Chr$(13)
  5084.     m$ = m$ + "22222222" + Chr$(13)
  5085.     arrTileText(164) = m$
  5086.  
  5087.     m$ = ""
  5088.     m$ = m$ + "22......" + Chr$(13)
  5089.     m$ = m$ + "22......" + Chr$(13)
  5090.     m$ = m$ + "22......" + Chr$(13)
  5091.     m$ = m$ + "22......" + Chr$(13)
  5092.     m$ = m$ + "22......" + Chr$(13)
  5093.     m$ = m$ + "22......" + Chr$(13)
  5094.     m$ = m$ + "22......" + Chr$(13)
  5095.     m$ = m$ + "22......" + Chr$(13)
  5096.     arrTileText(165) = m$
  5097.  
  5098.     m$ = ""
  5099.     m$ = m$ + "22..22.." + Chr$(13)
  5100.     m$ = m$ + "22..22.." + Chr$(13)
  5101.     m$ = m$ + "..22..22" + Chr$(13)
  5102.     m$ = m$ + "..22..22" + Chr$(13)
  5103.     m$ = m$ + "22..22.." + Chr$(13)
  5104.     m$ = m$ + "22..22.." + Chr$(13)
  5105.     m$ = m$ + "..22..22" + Chr$(13)
  5106.     m$ = m$ + "..22..22" + Chr$(13)
  5107.     arrTileText(166) = m$
  5108.  
  5109.     m$ = ""
  5110.     m$ = m$ + "......22" + Chr$(13)
  5111.     m$ = m$ + "......22" + Chr$(13)
  5112.     m$ = m$ + "......22" + Chr$(13)
  5113.     m$ = m$ + "......22" + Chr$(13)
  5114.     m$ = m$ + "......22" + Chr$(13)
  5115.     m$ = m$ + "......22" + Chr$(13)
  5116.     m$ = m$ + "......22" + Chr$(13)
  5117.     m$ = m$ + "......22" + Chr$(13)
  5118.     arrTileText(167) = m$
  5119.  
  5120.     m$ = ""
  5121.     m$ = m$ + "........" + Chr$(13)
  5122.     m$ = m$ + "........" + Chr$(13)
  5123.     m$ = m$ + "........" + Chr$(13)
  5124.     m$ = m$ + "........" + Chr$(13)
  5125.     m$ = m$ + "22..22.." + Chr$(13)
  5126.     m$ = m$ + "22..22.." + Chr$(13)
  5127.     m$ = m$ + "..22..22" + Chr$(13)
  5128.     m$ = m$ + "..22..22" + Chr$(13)
  5129.     arrTileText(168) = m$
  5130.  
  5131.     m$ = ""
  5132.     m$ = m$ + "22222222" + Chr$(13)
  5133.     m$ = m$ + "2222222." + Chr$(13)
  5134.     m$ = m$ + "222222.." + Chr$(13)
  5135.     m$ = m$ + "22222..." + Chr$(13)
  5136.     m$ = m$ + "2222...." + Chr$(13)
  5137.     m$ = m$ + "222....." + Chr$(13)
  5138.     m$ = m$ + "22......" + Chr$(13)
  5139.     m$ = m$ + "2......." + Chr$(13)
  5140.     arrTileText(169) = m$
  5141.  
  5142.     m$ = ""
  5143.     m$ = m$ + "......22" + Chr$(13)
  5144.     m$ = m$ + "......22" + Chr$(13)
  5145.     m$ = m$ + "......22" + Chr$(13)
  5146.     m$ = m$ + "......22" + Chr$(13)
  5147.     m$ = m$ + "......22" + Chr$(13)
  5148.     m$ = m$ + "......22" + Chr$(13)
  5149.     m$ = m$ + "......22" + Chr$(13)
  5150.     m$ = m$ + "......22" + Chr$(13)
  5151.     arrTileText(170) = m$
  5152.  
  5153.     m$ = ""
  5154.     m$ = m$ + "...22..." + Chr$(13)
  5155.     m$ = m$ + "...22..." + Chr$(13)
  5156.     m$ = m$ + "...22..." + Chr$(13)
  5157.     m$ = m$ + "...22222" + Chr$(13)
  5158.     m$ = m$ + "...22222" + Chr$(13)
  5159.     m$ = m$ + "...22..." + Chr$(13)
  5160.     m$ = m$ + "...22..." + Chr$(13)
  5161.     m$ = m$ + "...22..." + Chr$(13)
  5162.     arrTileText(171) = m$
  5163.  
  5164.     m$ = ""
  5165.     m$ = m$ + "........" + Chr$(13)
  5166.     m$ = m$ + "........" + Chr$(13)
  5167.     m$ = m$ + "........" + Chr$(13)
  5168.     m$ = m$ + "........" + Chr$(13)
  5169.     m$ = m$ + "....2222" + Chr$(13)
  5170.     m$ = m$ + "....2222" + Chr$(13)
  5171.     m$ = m$ + "....2222" + Chr$(13)
  5172.     m$ = m$ + "....2222" + Chr$(13)
  5173.     arrTileText(172) = m$
  5174.  
  5175.     m$ = ""
  5176.     m$ = m$ + "...22..." + Chr$(13)
  5177.     m$ = m$ + "...22..." + Chr$(13)
  5178.     m$ = m$ + "...22..." + Chr$(13)
  5179.     m$ = m$ + "...22222" + Chr$(13)
  5180.     m$ = m$ + "...22222" + Chr$(13)
  5181.     m$ = m$ + "........" + Chr$(13)
  5182.     m$ = m$ + "........" + Chr$(13)
  5183.     m$ = m$ + "........" + Chr$(13)
  5184.     arrTileText(173) = m$
  5185.  
  5186.     m$ = ""
  5187.     m$ = m$ + "........" + Chr$(13)
  5188.     m$ = m$ + "........" + Chr$(13)
  5189.     m$ = m$ + "........" + Chr$(13)
  5190.     m$ = m$ + "22222..." + Chr$(13)
  5191.     m$ = m$ + "22222..." + Chr$(13)
  5192.     m$ = m$ + "...22..." + Chr$(13)
  5193.     m$ = m$ + "...22..." + Chr$(13)
  5194.     m$ = m$ + "...22..." + Chr$(13)
  5195.     arrTileText(174) = m$
  5196.  
  5197.     m$ = ""
  5198.     m$ = m$ + "........" + Chr$(13)
  5199.     m$ = m$ + "........" + Chr$(13)
  5200.     m$ = m$ + "........" + Chr$(13)
  5201.     m$ = m$ + "........" + Chr$(13)
  5202.     m$ = m$ + "........" + Chr$(13)
  5203.     m$ = m$ + "........" + Chr$(13)
  5204.     m$ = m$ + "22222222" + Chr$(13)
  5205.     m$ = m$ + "22222222" + Chr$(13)
  5206.     arrTileText(175) = m$
  5207.  
  5208.     m$ = ""
  5209.     m$ = m$ + "........" + Chr$(13)
  5210.     m$ = m$ + "........" + Chr$(13)
  5211.     m$ = m$ + "........" + Chr$(13)
  5212.     m$ = m$ + "...22222" + Chr$(13)
  5213.     m$ = m$ + "...22222" + Chr$(13)
  5214.     m$ = m$ + "...22..." + Chr$(13)
  5215.     m$ = m$ + "...22..." + Chr$(13)
  5216.     m$ = m$ + "...22..." + Chr$(13)
  5217.     arrTileText(176) = m$
  5218.  
  5219.     m$ = ""
  5220.     m$ = m$ + "...22..." + Chr$(13)
  5221.     m$ = m$ + "...22..." + Chr$(13)
  5222.     m$ = m$ + "...22..." + Chr$(13)
  5223.     m$ = m$ + "22222222" + Chr$(13)
  5224.     m$ = m$ + "22222222" + Chr$(13)
  5225.     m$ = m$ + "........" + Chr$(13)
  5226.     m$ = m$ + "........" + Chr$(13)
  5227.     m$ = m$ + "........" + Chr$(13)
  5228.     arrTileText(177) = m$
  5229.  
  5230.     m$ = ""
  5231.     m$ = m$ + "........" + Chr$(13)
  5232.     m$ = m$ + "........" + Chr$(13)
  5233.     m$ = m$ + "........" + Chr$(13)
  5234.     m$ = m$ + "22222222" + Chr$(13)
  5235.     m$ = m$ + "22222222" + Chr$(13)
  5236.     m$ = m$ + "...22..." + Chr$(13)
  5237.     m$ = m$ + "...22..." + Chr$(13)
  5238.     m$ = m$ + "...22..." + Chr$(13)
  5239.     arrTileText(178) = m$
  5240.  
  5241.     m$ = ""
  5242.     m$ = m$ + "...22..." + Chr$(13)
  5243.     m$ = m$ + "...22..." + Chr$(13)
  5244.     m$ = m$ + "...22..." + Chr$(13)
  5245.     m$ = m$ + "22222..." + Chr$(13)
  5246.     m$ = m$ + "22222..." + Chr$(13)
  5247.     m$ = m$ + "...22..." + Chr$(13)
  5248.     m$ = m$ + "...22..." + Chr$(13)
  5249.     m$ = m$ + "...22..." + Chr$(13)
  5250.     arrTileText(179) = m$
  5251.  
  5252.     m$ = ""
  5253.     m$ = m$ + "22......" + Chr$(13)
  5254.     m$ = m$ + "22......" + Chr$(13)
  5255.     m$ = m$ + "22......" + Chr$(13)
  5256.     m$ = m$ + "22......" + Chr$(13)
  5257.     m$ = m$ + "22......" + Chr$(13)
  5258.     m$ = m$ + "22......" + Chr$(13)
  5259.     m$ = m$ + "22......" + Chr$(13)
  5260.     m$ = m$ + "22......" + Chr$(13)
  5261.     arrTileText(180) = m$
  5262.  
  5263.     m$ = ""
  5264.     m$ = m$ + "222....." + Chr$(13)
  5265.     m$ = m$ + "222....." + Chr$(13)
  5266.     m$ = m$ + "222....." + Chr$(13)
  5267.     m$ = m$ + "222....." + Chr$(13)
  5268.     m$ = m$ + "222....." + Chr$(13)
  5269.     m$ = m$ + "222....." + Chr$(13)
  5270.     m$ = m$ + "222....." + Chr$(13)
  5271.     m$ = m$ + "222....." + Chr$(13)
  5272.     arrTileText(181) = m$
  5273.  
  5274.     m$ = ""
  5275.     m$ = m$ + ".....222" + Chr$(13)
  5276.     m$ = m$ + ".....222" + Chr$(13)
  5277.     m$ = m$ + ".....222" + Chr$(13)
  5278.     m$ = m$ + ".....222" + Chr$(13)
  5279.     m$ = m$ + ".....222" + Chr$(13)
  5280.     m$ = m$ + ".....222" + Chr$(13)
  5281.     m$ = m$ + ".....222" + Chr$(13)
  5282.     m$ = m$ + ".....222" + Chr$(13)
  5283.     arrTileText(182) = m$
  5284.  
  5285.     m$ = ""
  5286.     m$ = m$ + "22222222" + Chr$(13)
  5287.     m$ = m$ + "22222222" + Chr$(13)
  5288.     m$ = m$ + "........" + Chr$(13)
  5289.     m$ = m$ + "........" + Chr$(13)
  5290.     m$ = m$ + "........" + Chr$(13)
  5291.     m$ = m$ + "........" + Chr$(13)
  5292.     m$ = m$ + "........" + Chr$(13)
  5293.     m$ = m$ + "........" + Chr$(13)
  5294.     arrTileText(183) = m$
  5295.  
  5296.     m$ = ""
  5297.     m$ = m$ + "22222222" + Chr$(13)
  5298.     m$ = m$ + "22222222" + Chr$(13)
  5299.     m$ = m$ + "22222222" + Chr$(13)
  5300.     m$ = m$ + "........" + Chr$(13)
  5301.     m$ = m$ + "........" + Chr$(13)
  5302.     m$ = m$ + "........" + Chr$(13)
  5303.     m$ = m$ + "........" + Chr$(13)
  5304.     m$ = m$ + "........" + Chr$(13)
  5305.     arrTileText(184) = m$
  5306.  
  5307.     m$ = ""
  5308.     m$ = m$ + "........" + Chr$(13)
  5309.     m$ = m$ + "........" + Chr$(13)
  5310.     m$ = m$ + "........" + Chr$(13)
  5311.     m$ = m$ + "........" + Chr$(13)
  5312.     m$ = m$ + "........" + Chr$(13)
  5313.     m$ = m$ + "22222222" + Chr$(13)
  5314.     m$ = m$ + "22222222" + Chr$(13)
  5315.     m$ = m$ + "22222222" + Chr$(13)
  5316.     arrTileText(185) = m$
  5317.  
  5318.     m$ = ""
  5319.     m$ = m$ + "......22" + Chr$(13)
  5320.     m$ = m$ + "......22" + Chr$(13)
  5321.     m$ = m$ + "......22" + Chr$(13)
  5322.     m$ = m$ + "......22" + Chr$(13)
  5323.     m$ = m$ + "......22" + Chr$(13)
  5324.     m$ = m$ + "......22" + Chr$(13)
  5325.     m$ = m$ + "22222222" + Chr$(13)
  5326.     m$ = m$ + "22222222" + Chr$(13)
  5327.     arrTileText(186) = m$
  5328.  
  5329.     m$ = ""
  5330.     m$ = m$ + "........" + Chr$(13)
  5331.     m$ = m$ + "........" + Chr$(13)
  5332.     m$ = m$ + "........" + Chr$(13)
  5333.     m$ = m$ + "........" + Chr$(13)
  5334.     m$ = m$ + "2222...." + Chr$(13)
  5335.     m$ = m$ + "2222...." + Chr$(13)
  5336.     m$ = m$ + "2222...." + Chr$(13)
  5337.     m$ = m$ + "2222...." + Chr$(13)
  5338.     arrTileText(187) = m$
  5339.  
  5340.     m$ = ""
  5341.     m$ = m$ + "....2222" + Chr$(13)
  5342.     m$ = m$ + "....2222" + Chr$(13)
  5343.     m$ = m$ + "....2222" + Chr$(13)
  5344.     m$ = m$ + "....2222" + Chr$(13)
  5345.     m$ = m$ + "........" + Chr$(13)
  5346.     m$ = m$ + "........" + Chr$(13)
  5347.     m$ = m$ + "........" + Chr$(13)
  5348.     m$ = m$ + "........" + Chr$(13)
  5349.     arrTileText(188) = m$
  5350.  
  5351.     m$ = ""
  5352.     m$ = m$ + "...22..." + Chr$(13)
  5353.     m$ = m$ + "...22..." + Chr$(13)
  5354.     m$ = m$ + "...22..." + Chr$(13)
  5355.     m$ = m$ + "22222..." + Chr$(13)
  5356.     m$ = m$ + "22222..." + Chr$(13)
  5357.     m$ = m$ + "........" + Chr$(13)
  5358.     m$ = m$ + "........" + Chr$(13)
  5359.     m$ = m$ + "........" + Chr$(13)
  5360.     arrTileText(189) = m$
  5361.  
  5362.     m$ = ""
  5363.     m$ = m$ + "2222...." + Chr$(13)
  5364.     m$ = m$ + "2222...." + Chr$(13)
  5365.     m$ = m$ + "2222...." + Chr$(13)
  5366.     m$ = m$ + "2222...." + Chr$(13)
  5367.     m$ = m$ + "........" + Chr$(13)
  5368.     m$ = m$ + "........" + Chr$(13)
  5369.     m$ = m$ + "........" + Chr$(13)
  5370.     m$ = m$ + "........" + Chr$(13)
  5371.     arrTileText(190) = m$
  5372.  
  5373.     m$ = ""
  5374.     m$ = m$ + "2222...." + Chr$(13)
  5375.     m$ = m$ + "2222...." + Chr$(13)
  5376.     m$ = m$ + "2222...." + Chr$(13)
  5377.     m$ = m$ + "2222...." + Chr$(13)
  5378.     m$ = m$ + "....2222" + Chr$(13)
  5379.     m$ = m$ + "....2222" + Chr$(13)
  5380.     m$ = m$ + "....2222" + Chr$(13)
  5381.     m$ = m$ + "....2222" + Chr$(13)
  5382.     arrTileText(191) = m$
  5383.  
  5384.     m$ = ""
  5385.     m$ = m$ + "........" + Chr$(13)
  5386.     m$ = m$ + ".2222222" + Chr$(13)
  5387.     m$ = m$ + ".2.....2" + Chr$(13)
  5388.     m$ = m$ + ".2.....2" + Chr$(13)
  5389.     m$ = m$ + ".2.....2" + Chr$(13)
  5390.     m$ = m$ + ".2.....2" + Chr$(13)
  5391.     m$ = m$ + ".2.....2" + Chr$(13)
  5392.     m$ = m$ + ".2222222" + Chr$(13)
  5393.     arrTileText(192) = m$
  5394.  
  5395.     m$ = ""
  5396.     m$ = m$ + "........" + Chr$(13)
  5397.     m$ = m$ + ".2222222" + Chr$(13)
  5398.     m$ = m$ + ".2222222" + Chr$(13)
  5399.     m$ = m$ + ".2222222" + Chr$(13)
  5400.     m$ = m$ + ".2222222" + Chr$(13)
  5401.     m$ = m$ + ".2222222" + Chr$(13)
  5402.     m$ = m$ + ".2222222" + Chr$(13)
  5403.     m$ = m$ + ".2222222" + Chr$(13)
  5404.     arrTileText(193) = m$
  5405.  
  5406.     m$ = ""
  5407.     m$ = m$ + "........" + Chr$(13)
  5408.     m$ = m$ + "...22..." + Chr$(13)
  5409.     m$ = m$ + "..2222.." + Chr$(13)
  5410.     m$ = m$ + ".222222." + Chr$(13)
  5411.     m$ = m$ + "...22..." + Chr$(13)
  5412.     m$ = m$ + "...22..." + Chr$(13)
  5413.     m$ = m$ + "...22..." + Chr$(13)
  5414.     m$ = m$ + "...22..." + Chr$(13)
  5415.     arrTileText(194) = m$
  5416.  
  5417.     m$ = ""
  5418.     m$ = m$ + "........" + Chr$(13)
  5419.     m$ = m$ + "...22..." + Chr$(13)
  5420.     m$ = m$ + "...22..." + Chr$(13)
  5421.     m$ = m$ + "...22..." + Chr$(13)
  5422.     m$ = m$ + "...22..." + Chr$(13)
  5423.     m$ = m$ + ".222222." + Chr$(13)
  5424.     m$ = m$ + "..2222.." + Chr$(13)
  5425.     m$ = m$ + "...22..." + Chr$(13)
  5426.     arrTileText(195) = m$
  5427.  
  5428.     m$ = ""
  5429.     m$ = m$ + "........" + Chr$(13)
  5430.     m$ = m$ + "...2...." + Chr$(13)
  5431.     m$ = m$ + "..22...." + Chr$(13)
  5432.     m$ = m$ + ".2222222" + Chr$(13)
  5433.     m$ = m$ + ".2222222" + Chr$(13)
  5434.     m$ = m$ + "..22...." + Chr$(13)
  5435.     m$ = m$ + "...2...." + Chr$(13)
  5436.     m$ = m$ + "........" + Chr$(13)
  5437.     arrTileText(196) = m$
  5438.  
  5439.     m$ = ""
  5440.     m$ = m$ + "........" + Chr$(13)
  5441.     m$ = m$ + ".....2.." + Chr$(13)
  5442.     m$ = m$ + ".....22." + Chr$(13)
  5443.     m$ = m$ + ".2222222" + Chr$(13)
  5444.     m$ = m$ + ".2222222" + Chr$(13)
  5445.     m$ = m$ + ".....22." + Chr$(13)
  5446.     m$ = m$ + ".....2.." + Chr$(13)
  5447.     m$ = m$ + "........" + Chr$(13)
  5448.     arrTileText(197) = m$
  5449.  
  5450.     m$ = ""
  5451.     m$ = m$ + "........" + Chr$(13)
  5452.     m$ = m$ + "........" + Chr$(13)
  5453.     m$ = m$ + "........" + Chr$(13)
  5454.     m$ = m$ + "........" + Chr$(13)
  5455.     m$ = m$ + "........" + Chr$(13)
  5456.     m$ = m$ + "........" + Chr$(13)
  5457.     m$ = m$ + "........" + Chr$(13)
  5458.     m$ = m$ + "........" + Chr$(13)
  5459.     arrTileText(198) = m$
  5460.  
  5461.     m$ = ""
  5462.     m$ = m$ + ".222222." + Chr$(13)
  5463.     m$ = m$ + "2......2" + Chr$(13)
  5464.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5465.     m$ = m$ + "2......2" + Chr$(13)
  5466.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5467.     m$ = m$ + "2.2222.2" + Chr$(13)
  5468.     m$ = m$ + "2......2" + Chr$(13)
  5469.     m$ = m$ + ".222222." + Chr$(13)
  5470.     arrTileText(199) = m$
  5471.  
  5472.     m$ = ""
  5473.     m$ = m$ + ".222222." + Chr$(13)
  5474.     m$ = m$ + "2......2" + Chr$(13)
  5475.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5476.     m$ = m$ + "2......2" + Chr$(13)
  5477.     m$ = m$ + "2.2222.2" + Chr$(13)
  5478.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5479.     m$ = m$ + "2......2" + Chr$(13)
  5480.     m$ = m$ + ".222222." + Chr$(13)
  5481.     arrTileText(200) = m$
  5482.  
  5483.     m$ = ""
  5484.     m$ = m$ + "........" + Chr$(13)
  5485.     m$ = m$ + "........" + Chr$(13)
  5486.     m$ = m$ + "........" + Chr$(13)
  5487.     m$ = m$ + "........" + Chr$(13)
  5488.     m$ = m$ + "........" + Chr$(13)
  5489.     m$ = m$ + "........" + Chr$(13)
  5490.     m$ = m$ + "........" + Chr$(13)
  5491.     m$ = m$ + "........" + Chr$(13)
  5492.     arrTileText(201) = m$
  5493.  
  5494.     m$ = ""
  5495.     m$ = m$ + ".222222." + Chr$(13)
  5496.     m$ = m$ + ".....22." + Chr$(13)
  5497.     m$ = m$ + "....22.." + Chr$(13)
  5498.     m$ = m$ + "...22..." + Chr$(13)
  5499.     m$ = m$ + "..22...." + Chr$(13)
  5500.     m$ = m$ + ".22....." + Chr$(13)
  5501.     m$ = m$ + ".222222." + Chr$(13)
  5502.     m$ = m$ + "........" + Chr$(13)
  5503.     arrTileText(202) = m$
  5504.  
  5505.     m$ = ""
  5506.     m$ = m$ + "...22..." + Chr$(13)
  5507.     m$ = m$ + "...22..." + Chr$(13)
  5508.     m$ = m$ + "...22..." + Chr$(13)
  5509.     m$ = m$ + "22222222" + Chr$(13)
  5510.     m$ = m$ + "22222222" + Chr$(13)
  5511.     m$ = m$ + "...22..." + Chr$(13)
  5512.     m$ = m$ + "...22..." + Chr$(13)
  5513.     m$ = m$ + "...22..." + Chr$(13)
  5514.     arrTileText(203) = m$
  5515.  
  5516.     m$ = ""
  5517.     m$ = m$ + "22......" + Chr$(13)
  5518.     m$ = m$ + "22......" + Chr$(13)
  5519.     m$ = m$ + "..22...." + Chr$(13)
  5520.     m$ = m$ + "..22...." + Chr$(13)
  5521.     m$ = m$ + "22......" + Chr$(13)
  5522.     m$ = m$ + "22......" + Chr$(13)
  5523.     m$ = m$ + "..22...." + Chr$(13)
  5524.     m$ = m$ + "..22...." + Chr$(13)
  5525.     arrTileText(204) = m$
  5526.  
  5527.     m$ = ""
  5528.     m$ = m$ + "...22..." + Chr$(13)
  5529.     m$ = m$ + "...22..." + Chr$(13)
  5530.     m$ = m$ + "...22..." + Chr$(13)
  5531.     m$ = m$ + "...22..." + Chr$(13)
  5532.     m$ = m$ + "...22..." + Chr$(13)
  5533.     m$ = m$ + "...22..." + Chr$(13)
  5534.     m$ = m$ + "...22..." + Chr$(13)
  5535.     m$ = m$ + "...22..." + Chr$(13)
  5536.     arrTileText(205) = m$
  5537.  
  5538.     m$ = ""
  5539.     m$ = m$ + "..22..22" + Chr$(13)
  5540.     m$ = m$ + "..22..22" + Chr$(13)
  5541.     m$ = m$ + "22..22.." + Chr$(13)
  5542.     m$ = m$ + "22..22.." + Chr$(13)
  5543.     m$ = m$ + "..22..22" + Chr$(13)
  5544.     m$ = m$ + "..22..22" + Chr$(13)
  5545.     m$ = m$ + "22..22.." + Chr$(13)
  5546.     m$ = m$ + "22..22.." + Chr$(13)
  5547.     arrTileText(206) = m$
  5548.  
  5549.     m$ = ""
  5550.     m$ = m$ + "..22..22" + Chr$(13)
  5551.     m$ = m$ + "2..22..2" + Chr$(13)
  5552.     m$ = m$ + "22..22.." + Chr$(13)
  5553.     m$ = m$ + ".22..22." + Chr$(13)
  5554.     m$ = m$ + "..22..22" + Chr$(13)
  5555.     m$ = m$ + "2..22..2" + Chr$(13)
  5556.     m$ = m$ + "22..22.." + Chr$(13)
  5557.     m$ = m$ + ".22..22." + Chr$(13)
  5558.     arrTileText(207) = m$
  5559.  
  5560.     m$ = ""
  5561.     m$ = m$ + "........" + Chr$(13)
  5562.     m$ = m$ + "........" + Chr$(13)
  5563.     m$ = m$ + "........" + Chr$(13)
  5564.     m$ = m$ + "........" + Chr$(13)
  5565.     m$ = m$ + "........" + Chr$(13)
  5566.     m$ = m$ + "........" + Chr$(13)
  5567.     m$ = m$ + "........" + Chr$(13)
  5568.     m$ = m$ + "........" + Chr$(13)
  5569.     arrTileText(208) = m$
  5570.  
  5571.     m$ = ""
  5572.     m$ = m$ + "2222...." + Chr$(13)
  5573.     m$ = m$ + "2222...." + Chr$(13)
  5574.     m$ = m$ + "2222...." + Chr$(13)
  5575.     m$ = m$ + "2222...." + Chr$(13)
  5576.     m$ = m$ + "2222...." + Chr$(13)
  5577.     m$ = m$ + "2222...." + Chr$(13)
  5578.     m$ = m$ + "2222...." + Chr$(13)
  5579.     m$ = m$ + "2222...." + Chr$(13)
  5580.     arrTileText(209) = m$
  5581.  
  5582.     m$ = ""
  5583.     m$ = m$ + "........" + Chr$(13)
  5584.     m$ = m$ + "........" + Chr$(13)
  5585.     m$ = m$ + "........" + Chr$(13)
  5586.     m$ = m$ + "........" + Chr$(13)
  5587.     m$ = m$ + "22222222" + Chr$(13)
  5588.     m$ = m$ + "22222222" + Chr$(13)
  5589.     m$ = m$ + "22222222" + Chr$(13)
  5590.     m$ = m$ + "22222222" + Chr$(13)
  5591.     arrTileText(210) = m$
  5592.  
  5593.     m$ = ""
  5594.     m$ = m$ + "22222222" + Chr$(13)
  5595.     m$ = m$ + "........" + Chr$(13)
  5596.     m$ = m$ + "........" + Chr$(13)
  5597.     m$ = m$ + "........" + Chr$(13)
  5598.     m$ = m$ + "........" + Chr$(13)
  5599.     m$ = m$ + "........" + Chr$(13)
  5600.     m$ = m$ + "........" + Chr$(13)
  5601.     m$ = m$ + "........" + Chr$(13)
  5602.     arrTileText(211) = m$
  5603.  
  5604.     m$ = ""
  5605.     m$ = m$ + "........" + Chr$(13)
  5606.     m$ = m$ + "........" + Chr$(13)
  5607.     m$ = m$ + "........" + Chr$(13)
  5608.     m$ = m$ + "........" + Chr$(13)
  5609.     m$ = m$ + "........" + Chr$(13)
  5610.     m$ = m$ + "........" + Chr$(13)
  5611.     m$ = m$ + "........" + Chr$(13)
  5612.     m$ = m$ + "22222222" + Chr$(13)
  5613.     arrTileText(212) = m$
  5614.  
  5615.     m$ = ""
  5616.     m$ = m$ + "22......" + Chr$(13)
  5617.     m$ = m$ + "22......" + Chr$(13)
  5618.     m$ = m$ + "22......" + Chr$(13)
  5619.     m$ = m$ + "22......" + Chr$(13)
  5620.     m$ = m$ + "22......" + Chr$(13)
  5621.     m$ = m$ + "22......" + Chr$(13)
  5622.     m$ = m$ + "22......" + Chr$(13)
  5623.     m$ = m$ + "22......" + Chr$(13)
  5624.     arrTileText(213) = m$
  5625.  
  5626.     m$ = ""
  5627.     m$ = m$ + "22..22.." + Chr$(13)
  5628.     m$ = m$ + "22..22.." + Chr$(13)
  5629.     m$ = m$ + "..22..22" + Chr$(13)
  5630.     m$ = m$ + "..22..22" + Chr$(13)
  5631.     m$ = m$ + "22..22.." + Chr$(13)
  5632.     m$ = m$ + "22..22.." + Chr$(13)
  5633.     m$ = m$ + "..22..22" + Chr$(13)
  5634.     m$ = m$ + "..22..22" + Chr$(13)
  5635.     arrTileText(214) = m$
  5636.  
  5637.     m$ = ""
  5638.     m$ = m$ + "......22" + Chr$(13)
  5639.     m$ = m$ + "......22" + Chr$(13)
  5640.     m$ = m$ + "......22" + Chr$(13)
  5641.     m$ = m$ + "......22" + Chr$(13)
  5642.     m$ = m$ + "......22" + Chr$(13)
  5643.     m$ = m$ + "......22" + Chr$(13)
  5644.     m$ = m$ + "......22" + Chr$(13)
  5645.     m$ = m$ + "......22" + Chr$(13)
  5646.     arrTileText(215) = m$
  5647.  
  5648.     m$ = ""
  5649.     m$ = m$ + "........" + Chr$(13)
  5650.     m$ = m$ + "........" + Chr$(13)
  5651.     m$ = m$ + "........" + Chr$(13)
  5652.     m$ = m$ + "........" + Chr$(13)
  5653.     m$ = m$ + "22..22.." + Chr$(13)
  5654.     m$ = m$ + "22..22.." + Chr$(13)
  5655.     m$ = m$ + "..22..22" + Chr$(13)
  5656.     m$ = m$ + "..22..22" + Chr$(13)
  5657.     arrTileText(216) = m$
  5658.  
  5659.     m$ = ""
  5660.     m$ = m$ + "22..22.." + Chr$(13)
  5661.     m$ = m$ + "2..22..2" + Chr$(13)
  5662.     m$ = m$ + "..22..22" + Chr$(13)
  5663.     m$ = m$ + ".22..22." + Chr$(13)
  5664.     m$ = m$ + "22..22.." + Chr$(13)
  5665.     m$ = m$ + "2..22..2" + Chr$(13)
  5666.     m$ = m$ + "..22..22" + Chr$(13)
  5667.     m$ = m$ + ".22..22." + Chr$(13)
  5668.     arrTileText(217) = m$
  5669.  
  5670.     m$ = ""
  5671.     m$ = m$ + "......22" + Chr$(13)
  5672.     m$ = m$ + "......22" + Chr$(13)
  5673.     m$ = m$ + "......22" + Chr$(13)
  5674.     m$ = m$ + "......22" + Chr$(13)
  5675.     m$ = m$ + "......22" + Chr$(13)
  5676.     m$ = m$ + "......22" + Chr$(13)
  5677.     m$ = m$ + "......22" + Chr$(13)
  5678.     m$ = m$ + "......22" + Chr$(13)
  5679.     arrTileText(218) = m$
  5680.  
  5681.     m$ = ""
  5682.     m$ = m$ + "...22..." + Chr$(13)
  5683.     m$ = m$ + "...22..." + Chr$(13)
  5684.     m$ = m$ + "...22..." + Chr$(13)
  5685.     m$ = m$ + "...22222" + Chr$(13)
  5686.     m$ = m$ + "...22222" + Chr$(13)
  5687.     m$ = m$ + "...22..." + Chr$(13)
  5688.     m$ = m$ + "...22..." + Chr$(13)
  5689.     m$ = m$ + "...22..." + Chr$(13)
  5690.     arrTileText(219) = m$
  5691.  
  5692.     m$ = ""
  5693.     m$ = m$ + "........" + Chr$(13)
  5694.     m$ = m$ + "........" + Chr$(13)
  5695.     m$ = m$ + "........" + Chr$(13)
  5696.     m$ = m$ + "........" + Chr$(13)
  5697.     m$ = m$ + "....2222" + Chr$(13)
  5698.     m$ = m$ + "....2222" + Chr$(13)
  5699.     m$ = m$ + "....2222" + Chr$(13)
  5700.     m$ = m$ + "....2222" + Chr$(13)
  5701.     arrTileText(220) = m$
  5702.  
  5703.     m$ = ""
  5704.     m$ = m$ + "...22..." + Chr$(13)
  5705.     m$ = m$ + "...22..." + Chr$(13)
  5706.     m$ = m$ + "...22..." + Chr$(13)
  5707.     m$ = m$ + "...22222" + Chr$(13)
  5708.     m$ = m$ + "...22222" + Chr$(13)
  5709.     m$ = m$ + "........" + Chr$(13)
  5710.     m$ = m$ + "........" + Chr$(13)
  5711.     m$ = m$ + "........" + Chr$(13)
  5712.     arrTileText(221) = m$
  5713.  
  5714.     m$ = ""
  5715.     m$ = m$ + "........" + Chr$(13)
  5716.     m$ = m$ + "........" + Chr$(13)
  5717.     m$ = m$ + "........" + Chr$(13)
  5718.     m$ = m$ + "22222..." + Chr$(13)
  5719.     m$ = m$ + "22222..." + Chr$(13)
  5720.     m$ = m$ + "...22..." + Chr$(13)
  5721.     m$ = m$ + "...22..." + Chr$(13)
  5722.     m$ = m$ + "...22..." + Chr$(13)
  5723.     arrTileText(222) = m$
  5724.  
  5725.     m$ = ""
  5726.     m$ = m$ + "........" + Chr$(13)
  5727.     m$ = m$ + "........" + Chr$(13)
  5728.     m$ = m$ + "........" + Chr$(13)
  5729.     m$ = m$ + "........" + Chr$(13)
  5730.     m$ = m$ + "........" + Chr$(13)
  5731.     m$ = m$ + "........" + Chr$(13)
  5732.     m$ = m$ + "22222222" + Chr$(13)
  5733.     m$ = m$ + "22222222" + Chr$(13)
  5734.     arrTileText(223) = m$
  5735.  
  5736.     m$ = ""
  5737.     m$ = m$ + "........" + Chr$(13)
  5738.     m$ = m$ + "........" + Chr$(13)
  5739.     m$ = m$ + "........" + Chr$(13)
  5740.     m$ = m$ + "...22222" + Chr$(13)
  5741.     m$ = m$ + "...22222" + Chr$(13)
  5742.     m$ = m$ + "...22..." + Chr$(13)
  5743.     m$ = m$ + "...22..." + Chr$(13)
  5744.     m$ = m$ + "...22..." + Chr$(13)
  5745.     arrTileText(224) = m$
  5746.  
  5747.     m$ = ""
  5748.     m$ = m$ + "...22..." + Chr$(13)
  5749.     m$ = m$ + "...22..." + Chr$(13)
  5750.     m$ = m$ + "...22..." + Chr$(13)
  5751.     m$ = m$ + "22222222" + Chr$(13)
  5752.     m$ = m$ + "22222222" + Chr$(13)
  5753.     m$ = m$ + "........" + Chr$(13)
  5754.     m$ = m$ + "........" + Chr$(13)
  5755.     m$ = m$ + "........" + Chr$(13)
  5756.     arrTileText(225) = m$
  5757.  
  5758.     m$ = ""
  5759.     m$ = m$ + "........" + Chr$(13)
  5760.     m$ = m$ + "........" + Chr$(13)
  5761.     m$ = m$ + "........" + Chr$(13)
  5762.     m$ = m$ + "22222222" + Chr$(13)
  5763.     m$ = m$ + "22222222" + Chr$(13)
  5764.     m$ = m$ + "...22..." + Chr$(13)
  5765.     m$ = m$ + "...22..." + Chr$(13)
  5766.     m$ = m$ + "...22..." + Chr$(13)
  5767.     arrTileText(226) = m$
  5768.  
  5769.     m$ = ""
  5770.     m$ = m$ + "...22..." + Chr$(13)
  5771.     m$ = m$ + "...22..." + Chr$(13)
  5772.     m$ = m$ + "...22..." + Chr$(13)
  5773.     m$ = m$ + "22222..." + Chr$(13)
  5774.     m$ = m$ + "22222..." + Chr$(13)
  5775.     m$ = m$ + "...22..." + Chr$(13)
  5776.     m$ = m$ + "...22..." + Chr$(13)
  5777.     m$ = m$ + "...22..." + Chr$(13)
  5778.     arrTileText(227) = m$
  5779.  
  5780.     m$ = ""
  5781.     m$ = m$ + "22......" + Chr$(13)
  5782.     m$ = m$ + "22......" + Chr$(13)
  5783.     m$ = m$ + "22......" + Chr$(13)
  5784.     m$ = m$ + "22......" + Chr$(13)
  5785.     m$ = m$ + "22......" + Chr$(13)
  5786.     m$ = m$ + "22......" + Chr$(13)
  5787.     m$ = m$ + "22......" + Chr$(13)
  5788.     m$ = m$ + "22......" + Chr$(13)
  5789.     arrTileText(228) = m$
  5790.  
  5791.     m$ = ""
  5792.     m$ = m$ + "222....." + Chr$(13)
  5793.     m$ = m$ + "222....." + Chr$(13)
  5794.     m$ = m$ + "222....." + Chr$(13)
  5795.     m$ = m$ + "222....." + Chr$(13)
  5796.     m$ = m$ + "222....." + Chr$(13)
  5797.     m$ = m$ + "222....." + Chr$(13)
  5798.     m$ = m$ + "222....." + Chr$(13)
  5799.     m$ = m$ + "222....." + Chr$(13)
  5800.     arrTileText(229) = m$
  5801.  
  5802.     m$ = ""
  5803.     m$ = m$ + ".....222" + Chr$(13)
  5804.     m$ = m$ + ".....222" + Chr$(13)
  5805.     m$ = m$ + ".....222" + Chr$(13)
  5806.     m$ = m$ + ".....222" + Chr$(13)
  5807.     m$ = m$ + ".....222" + Chr$(13)
  5808.     m$ = m$ + ".....222" + Chr$(13)
  5809.     m$ = m$ + ".....222" + Chr$(13)
  5810.     m$ = m$ + ".....222" + Chr$(13)
  5811.     arrTileText(230) = m$
  5812.  
  5813.     m$ = ""
  5814.     m$ = m$ + "22222222" + Chr$(13)
  5815.     m$ = m$ + "22222222" + Chr$(13)
  5816.     m$ = m$ + "........" + Chr$(13)
  5817.     m$ = m$ + "........" + Chr$(13)
  5818.     m$ = m$ + "........" + Chr$(13)
  5819.     m$ = m$ + "........" + Chr$(13)
  5820.     m$ = m$ + "........" + Chr$(13)
  5821.     m$ = m$ + "........" + Chr$(13)
  5822.     arrTileText(231) = m$
  5823.  
  5824.     m$ = ""
  5825.     m$ = m$ + "22222222" + Chr$(13)
  5826.     m$ = m$ + "22222222" + Chr$(13)
  5827.     m$ = m$ + "22222222" + Chr$(13)
  5828.     m$ = m$ + "........" + Chr$(13)
  5829.     m$ = m$ + "........" + Chr$(13)
  5830.     m$ = m$ + "........" + Chr$(13)
  5831.     m$ = m$ + "........" + Chr$(13)
  5832.     m$ = m$ + "........" + Chr$(13)
  5833.     arrTileText(232) = m$
  5834.  
  5835.     m$ = ""
  5836.     m$ = m$ + "........" + Chr$(13)
  5837.     m$ = m$ + "........" + Chr$(13)
  5838.     m$ = m$ + "........" + Chr$(13)
  5839.     m$ = m$ + "........" + Chr$(13)
  5840.     m$ = m$ + "........" + Chr$(13)
  5841.     m$ = m$ + "22222222" + Chr$(13)
  5842.     m$ = m$ + "22222222" + Chr$(13)
  5843.     m$ = m$ + "22222222" + Chr$(13)
  5844.     arrTileText(233) = m$
  5845.  
  5846.     m$ = ""
  5847.     m$ = m$ + ".......2" + Chr$(13)
  5848.     m$ = m$ + "......22" + Chr$(13)
  5849.     m$ = m$ + ".....22." + Chr$(13)
  5850.     m$ = m$ + ".22.22.." + Chr$(13)
  5851.     m$ = m$ + ".2222..." + Chr$(13)
  5852.     m$ = m$ + ".222...." + Chr$(13)
  5853.     m$ = m$ + ".22....." + Chr$(13)
  5854.     m$ = m$ + "........" + Chr$(13)
  5855.     arrTileText(234) = m$
  5856.  
  5857.     m$ = ""
  5858.     m$ = m$ + "........" + Chr$(13)
  5859.     m$ = m$ + "........" + Chr$(13)
  5860.     m$ = m$ + "........" + Chr$(13)
  5861.     m$ = m$ + "........" + Chr$(13)
  5862.     m$ = m$ + "2222...." + Chr$(13)
  5863.     m$ = m$ + "2222...." + Chr$(13)
  5864.     m$ = m$ + "2222...." + Chr$(13)
  5865.     m$ = m$ + "2222...." + Chr$(13)
  5866.     arrTileText(235) = m$
  5867.  
  5868.     m$ = ""
  5869.     m$ = m$ + "....2222" + Chr$(13)
  5870.     m$ = m$ + "....2222" + Chr$(13)
  5871.     m$ = m$ + "....2222" + Chr$(13)
  5872.     m$ = m$ + "....2222" + Chr$(13)
  5873.     m$ = m$ + "........" + Chr$(13)
  5874.     m$ = m$ + "........" + Chr$(13)
  5875.     m$ = m$ + "........" + Chr$(13)
  5876.     m$ = m$ + "........" + Chr$(13)
  5877.     arrTileText(236) = m$
  5878.  
  5879.     m$ = ""
  5880.     m$ = m$ + "...22..." + Chr$(13)
  5881.     m$ = m$ + "...22..." + Chr$(13)
  5882.     m$ = m$ + "...22..." + Chr$(13)
  5883.     m$ = m$ + "22222..." + Chr$(13)
  5884.     m$ = m$ + "22222..." + Chr$(13)
  5885.     m$ = m$ + "........" + Chr$(13)
  5886.     m$ = m$ + "........" + Chr$(13)
  5887.     m$ = m$ + "........" + Chr$(13)
  5888.     arrTileText(237) = m$
  5889.  
  5890.     m$ = ""
  5891.     m$ = m$ + "2222...." + Chr$(13)
  5892.     m$ = m$ + "2222...." + Chr$(13)
  5893.     m$ = m$ + "2222...." + Chr$(13)
  5894.     m$ = m$ + "2222...." + Chr$(13)
  5895.     m$ = m$ + "........" + Chr$(13)
  5896.     m$ = m$ + "........" + Chr$(13)
  5897.     m$ = m$ + "........" + Chr$(13)
  5898.     m$ = m$ + "........" + Chr$(13)
  5899.     arrTileText(238) = m$
  5900.  
  5901.     m$ = ""
  5902.     m$ = m$ + "2222...." + Chr$(13)
  5903.     m$ = m$ + "2222...." + Chr$(13)
  5904.     m$ = m$ + "2222...." + Chr$(13)
  5905.     m$ = m$ + "2222...." + Chr$(13)
  5906.     m$ = m$ + "....2222" + Chr$(13)
  5907.     m$ = m$ + "....2222" + Chr$(13)
  5908.     m$ = m$ + "....2222" + Chr$(13)
  5909.     m$ = m$ + "....2222" + Chr$(13)
  5910.     arrTileText(239) = m$
  5911.  
  5912.     m$ = ""
  5913.     m$ = m$ + "........" + Chr$(13)
  5914.     m$ = m$ + "........" + Chr$(13)
  5915.     m$ = m$ + "........" + Chr$(13)
  5916.     m$ = m$ + "........" + Chr$(13)
  5917.     m$ = m$ + "........" + Chr$(13)
  5918.     m$ = m$ + "........" + Chr$(13)
  5919.     m$ = m$ + "........" + Chr$(13)
  5920.     m$ = m$ + "........" + Chr$(13)
  5921.     arrTileText(240) = m$
  5922.  
  5923.     m$ = ""
  5924.     m$ = m$ + "22222.22" + Chr$(13)
  5925.     m$ = m$ + "22222.22" + Chr$(13)
  5926.     m$ = m$ + "22222.22" + Chr$(13)
  5927.     m$ = m$ + "........" + Chr$(13)
  5928.     m$ = m$ + "22.22222" + Chr$(13)
  5929.     m$ = m$ + "22.22222" + Chr$(13)
  5930.     m$ = m$ + "22.22222" + Chr$(13)
  5931.     m$ = m$ + "........" + Chr$(13)
  5932.     arrTileText(241) = m$
  5933.  
  5934.     m$ = ""
  5935.     m$ = m$ + "........" + Chr$(13)
  5936.     m$ = m$ + "........" + Chr$(13)
  5937.     m$ = m$ + "........" + Chr$(13)
  5938.     m$ = m$ + ".222222." + Chr$(13)
  5939.     m$ = m$ + "........" + Chr$(13)
  5940.     m$ = m$ + "........" + Chr$(13)
  5941.     m$ = m$ + "........" + Chr$(13)
  5942.     m$ = m$ + "........" + Chr$(13)
  5943.     arrTileText(242) = m$
  5944.  
  5945.     m$ = ""
  5946.     m$ = m$ + "........" + Chr$(13)
  5947.     m$ = m$ + "...2...." + Chr$(13)
  5948.     m$ = m$ + "...2...." + Chr$(13)
  5949.     m$ = m$ + "...2...." + Chr$(13)
  5950.     m$ = m$ + "...2...." + Chr$(13)
  5951.     m$ = m$ + "...2...." + Chr$(13)
  5952.     m$ = m$ + "...2...." + Chr$(13)
  5953.     m$ = m$ + "........" + Chr$(13)
  5954.     arrTileText(243) = m$
  5955.  
  5956.     m$ = ""
  5957.     m$ = m$ + "........" + Chr$(13)
  5958.     m$ = m$ + "........" + Chr$(13)
  5959.     m$ = m$ + "........" + Chr$(13)
  5960.     m$ = m$ + "...2222." + Chr$(13)
  5961.     m$ = m$ + "...2...." + Chr$(13)
  5962.     m$ = m$ + "...2...." + Chr$(13)
  5963.     m$ = m$ + "...2...." + Chr$(13)
  5964.     m$ = m$ + "........" + Chr$(13)
  5965.     arrTileText(244) = m$
  5966.  
  5967.     m$ = ""
  5968.     m$ = m$ + "........" + Chr$(13)
  5969.     m$ = m$ + "........" + Chr$(13)
  5970.     m$ = m$ + "........" + Chr$(13)
  5971.     m$ = m$ + ".222...." + Chr$(13)
  5972.     m$ = m$ + "...2...." + Chr$(13)
  5973.     m$ = m$ + "...2...." + Chr$(13)
  5974.     m$ = m$ + "...2...." + Chr$(13)
  5975.     m$ = m$ + "........" + Chr$(13)
  5976.     arrTileText(245) = m$
  5977.  
  5978.     m$ = ""
  5979.     m$ = m$ + "........" + Chr$(13)
  5980.     m$ = m$ + "...2...." + Chr$(13)
  5981.     m$ = m$ + "...2...." + Chr$(13)
  5982.     m$ = m$ + "...2222." + Chr$(13)
  5983.     m$ = m$ + "........" + Chr$(13)
  5984.     m$ = m$ + "........" + Chr$(13)
  5985.     m$ = m$ + "........" + Chr$(13)
  5986.     m$ = m$ + "........" + Chr$(13)
  5987.     arrTileText(246) = m$
  5988.  
  5989.     m$ = ""
  5990.     m$ = m$ + "........" + Chr$(13)
  5991.     m$ = m$ + "...2...." + Chr$(13)
  5992.     m$ = m$ + "...2...." + Chr$(13)
  5993.     m$ = m$ + ".222...." + Chr$(13)
  5994.     m$ = m$ + "........" + Chr$(13)
  5995.     m$ = m$ + "........" + Chr$(13)
  5996.     m$ = m$ + "........" + Chr$(13)
  5997.     m$ = m$ + "........" + Chr$(13)
  5998.     arrTileText(247) = m$
  5999.  
  6000.     m$ = ""
  6001.     m$ = m$ + "........" + Chr$(13)
  6002.     m$ = m$ + "........" + Chr$(13)
  6003.     m$ = m$ + "........" + Chr$(13)
  6004.     m$ = m$ + "........" + Chr$(13)
  6005.     m$ = m$ + "........" + Chr$(13)
  6006.     m$ = m$ + "........" + Chr$(13)
  6007.     m$ = m$ + "........" + Chr$(13)
  6008.     m$ = m$ + "........" + Chr$(13)
  6009.     arrTileText(248) = m$
  6010.  
  6011.     m$ = ""
  6012.     m$ = m$ + "........" + Chr$(13)
  6013.     m$ = m$ + "........" + Chr$(13)
  6014.     m$ = m$ + "........" + Chr$(13)
  6015.     m$ = m$ + "........" + Chr$(13)
  6016.     m$ = m$ + "........" + Chr$(13)
  6017.     m$ = m$ + "........" + Chr$(13)
  6018.     m$ = m$ + "........" + Chr$(13)
  6019.     m$ = m$ + "........" + Chr$(13)
  6020.     arrTileText(249) = m$
  6021.  
  6022.     m$ = ""
  6023.     m$ = m$ + "........" + Chr$(13)
  6024.     m$ = m$ + "........" + Chr$(13)
  6025.     m$ = m$ + "........" + Chr$(13)
  6026.     m$ = m$ + "........" + Chr$(13)
  6027.     m$ = m$ + "........" + Chr$(13)
  6028.     m$ = m$ + "........" + Chr$(13)
  6029.     m$ = m$ + "........" + Chr$(13)
  6030.     m$ = m$ + "........" + Chr$(13)
  6031.     arrTileText(250) = m$
  6032.  
  6033.     m$ = ""
  6034.     m$ = m$ + "........" + Chr$(13)
  6035.     m$ = m$ + "........" + Chr$(13)
  6036.     m$ = m$ + "........" + Chr$(13)
  6037.     m$ = m$ + "........" + Chr$(13)
  6038.     m$ = m$ + "........" + Chr$(13)
  6039.     m$ = m$ + "........" + Chr$(13)
  6040.     m$ = m$ + "........" + Chr$(13)
  6041.     m$ = m$ + "........" + Chr$(13)
  6042.     arrTileText(251) = m$
  6043.  
  6044.     m$ = ""
  6045.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6046.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6047.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6048.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6049.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6050.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6051.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6052.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6053.     arrTileText(252) = m$
  6054.  
  6055.     m$ = ""
  6056.     m$ = m$ + "22222222" + Chr$(13)
  6057.     m$ = m$ + "2......2" + Chr$(13)
  6058.     m$ = m$ + "2......2" + Chr$(13)
  6059.     m$ = m$ + "2......2" + Chr$(13)
  6060.     m$ = m$ + "2......2" + Chr$(13)
  6061.     m$ = m$ + "2......2" + Chr$(13)
  6062.     m$ = m$ + "2......2" + Chr$(13)
  6063.     m$ = m$ + "22222222" + Chr$(13)
  6064.     arrTileText(253) = m$
  6065.  
  6066.     m$ = ""
  6067.     m$ = m$ + "22222222" + Chr$(13)
  6068.     m$ = m$ + "22222222" + Chr$(13)
  6069.     m$ = m$ + "22222222" + Chr$(13)
  6070.     m$ = m$ + "22222222" + Chr$(13)
  6071.     m$ = m$ + "22222222" + Chr$(13)
  6072.     m$ = m$ + "22222222" + Chr$(13)
  6073.     m$ = m$ + "22222222" + Chr$(13)
  6074.     m$ = m$ + "22222222" + Chr$(13)
  6075.     arrTileText(254) = m$
  6076.  
  6077.     m$ = ""
  6078.     m$ = ""
  6079.     m$ = m$ + "22....22" + Chr$(13)
  6080.     m$ = m$ + "2..22..2" + Chr$(13)
  6081.     m$ = m$ + "2..22..2" + Chr$(13)
  6082.     m$ = m$ + "22.....2" + Chr$(13)
  6083.     m$ = m$ + "22222..2" + Chr$(13)
  6084.     m$ = m$ + "2..22..2" + Chr$(13)
  6085.     m$ = m$ + "22....22" + Chr$(13)
  6086.     m$ = m$ + "22222222" + Chr$(13)
  6087.     arrTileText(255) = m$
  6088.  
  6089. End Sub ' GetTileText
  6090.  
  6091. ' ################################################################################################################################################################
  6092. ' END TILE DEFINITIONS
  6093. ' ################################################################################################################################################################
  6094.  
  6095. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6096. ' BEGIN DEBUGGING ROUTINES #DEBUGGING
  6097. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6098.  
  6099. Sub DebugPrint (MyString As String)
  6100.     If m_bDebug = TRUE Then
  6101.         '_Echo MyString
  6102.  
  6103.         ReDim arrLines(-1) As String
  6104.         Dim iLoop As Integer
  6105.         split MyString, Chr$(13), arrLines()
  6106.         For iLoop = LBound(arrLines) To UBound(arrLines)
  6107.             _Echo arrLines(iLoop)
  6108.         Next iLoop
  6109.     End If
  6110. End Sub ' DebugPrint
  6111.  
  6112. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6113. ' END DEBUGGING ROUTINES @DEBUGGING
  6114. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6115.  

Here is the version with extra debugging output explaining what it's doing:
Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2. ' VECTOR TILE DRAWING EXPERIMENT
  3.  
  4. ' GENERATES SEMI-OPTIMIZED VECTOR DRAWING ROUTINES USING Line COMMANDS
  5. ' FOR ONE OR MORE 8X8 RASTER TILES.
  6.  
  7. ' Eventually we would store a list of line coordinates for each tile
  8. ' in a 2D array or similar data structure, with just one general-
  9. ' purpose drawing routine that receives a list of (x1,y1,x2,y2)
  10. ' and a color and draws the shape with Line. The background would
  11. ' be transparent but if we want a background color can be specified
  12. ' and simply draw an 8x8 background color rectangle first and then
  13. ' draw the shape on top of that.
  14.  
  15. ' TODO: Optimize for each shape by determining how to draw it with the
  16. '       minimum number of line commands.
  17. '
  18. '       For example this:
  19. '           ' DRAW WITH HORIZONTAL LINES
  20. '           Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  21. '           Line (iX + 6, iY + 4)-(iX + 6, iY + 4), fgColor
  22. '       could be replaced with:
  23. '           ' DRAW WITH VERTICAL LINES
  24. '           Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  25. '
  26. '       Google "rectangular decomposition of binary images" and similar
  27. '       to find a better algorithm.
  28. '
  29. '       Brute force method would be to draw every size rectangle from 1x1
  30. '       up to 8x8 (which can themselves be precalculated) in every available
  31. '       location in the 8x8 grid (where no part of any rectangle falls off
  32. '       the grid), then try every combination of those rectangles to find
  33. '       combination where the the minimum number of rectangles cover all
  34. '       points.
  35. '
  36. '       Rather than compute this on the fly, we could precompute it and
  37. '       for each given tile, store the list of those rectangle coordinates
  38. '       (x1,y1,x2,y2) for drawing it indexed by the tile's definition in
  39. '       hexidecimal where 16-bits (0-F) defines the bit pattern for each
  40. '       row in the tile, therefore a tile's definition can be stored by
  41. '       8 characters (or less if we use base 64). Perhaps build a utility
  42. '       that will compute the optimal drawing pattern for every possible
  43. '       combination of an 8x8 grid, and index them all by the tile's 8-byte
  44. '       hexidecimal definition. It might take a while to run, but once it
  45. '       does, we will have a database of every possible tile's optimized
  46. '       drawing instructions that can be quickly looked up.
  47. '       Then we only pull out those definitions for the tiles that our
  48. '       given program uses, so the data would be relatively small
  49. '       (even smaller if we encode it with base-64).
  50.  
  51. ' ################################################################################################################################################################
  52.  
  53. ' ===============================================================================
  54. ' GLOBAL CONSTANTS
  55. ' ===============================================================================
  56. ' BOOLEAN VALUES
  57. Const FALSE = 0
  58. Const TRUE = Not FALSE
  59.  
  60. ' ===============================================================================
  61. ' USER DEFINED TYPES
  62. ' ===============================================================================
  63. ' UDT TO HOLD COORDINATES FOR DRAWING A RECTANGLE
  64. Type RectangleType
  65.     x1 As Integer ' start x
  66.     x2 As Integer ' end x
  67.     y1 As Integer ' start y
  68.     y2 As Integer ' end y
  69.     PixelCount As Integer
  70.     IsActive As Integer
  71. End Type ' RectangleType
  72.  
  73. Type DrawCompareType
  74.     IndexList As String
  75.     ShapeCount As Integer
  76.     PixelCount As Integer
  77.     IsActive As Integer
  78. End Type ' DrawCompareType
  79.  
  80. Type CoordinateType
  81.     x1 As Integer ' start x
  82.     x2 As Integer ' end x
  83.     y1 As Integer ' start y
  84.     y2 As Integer ' end y
  85. End Type ' CoordinateType
  86.  
  87. ' UDT TO HOLD COLOR CODE INFO
  88. Type ColorType
  89.     name As String
  90.     value As _Unsigned Long
  91. End Type ' ColorType
  92.  
  93. ' UDT FOR PRECALCULATED TILESHEET
  94. Type TileSheetMapType
  95.     xStart As Integer
  96.     xEnd As Integer
  97.     yStart As Integer
  98.     yEnd As Integer
  99.  
  100. ' UDT FOR PRECALCULATED TILE MAP
  101. Type TileMapType
  102.     xPos As Integer
  103.     yPos As Integer
  104.  
  105. ' ===============================================================================
  106. ' GLOBAL VARIABLES
  107. ' ===============================================================================
  108. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES CONSOLE WINDOW AND DebugPrint
  109. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  110. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  111. Dim Shared m_iCount As Long: m_iCount = 0
  112.  
  113. ' ===============================================================================
  114. ' LOCAL VARIABLES
  115. ' ===============================================================================
  116. Dim in$
  117.  
  118. ' ****************************************************************************************************************************************************************
  119. ' ACTIVATE DEBUGGING WINDOW
  120. If m_bDebug = TRUE Then
  121.     $Console
  122.     _Delay 4
  123.     _Console On
  124.     _Echo "Started " + m_ProgramName$
  125.     _Echo "Debugging on..."
  126. ' ****************************************************************************************************************************************************************
  127.  
  128. ' ===============================================================================
  129. ' START THE MAIN ROUTINE
  130. ' ===============================================================================
  131. main
  132.  
  133. ' ===============================================================================
  134. ' FINISH
  135. ' ===============================================================================
  136. Print m_ProgramName$ + " finished."
  137. Input "Press <ENTER> to continue", in$
  138. ' ****************************************************************************************************************************************************************
  139. ' DEACTIVATE DEBUGGING WINDOW
  140. If m_bDebug = TRUE Then
  141. ' ****************************************************************************************************************************************************************
  142. System ' return control to the operating system
  143.  
  144. ' ################################################################################################################################################################
  145. ' BEGIN MAIN MENU
  146. ' ################################################################################################################################################################
  147.  
  148. ' /////////////////////////////////////////////////////////////////////////////
  149.  
  150. Sub main
  151.     Dim RoutineName As String: RoutineName = "main"
  152.     Dim in$
  153.     Dim bFinished As Integer: bFinished = FALSE
  154.     Dim result$: result$ = ""
  155.     Do
  156.         Screen 0
  157.         Cls
  158.         Print m_ProgramName$
  159.         Print
  160.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  161.         Print "How about using the Line statement and draw tiles as vector images?"
  162.         Print
  163.         Print "1) GenerateVectorTileCode"
  164.         Print "2) DrawVectorTilesTest1"
  165.         Print "3) GetAllPossibleShapesTest"
  166.         Print "4) FindAllCombinationsTest1 - find all combinations of n numbers"
  167.         Print "5) FindAllCombinationsTest2 - find all combinations of n numbers"
  168.         Print "6) FindOptimizedVectorTest - find minimum shapes to draw a tile"
  169.         Print
  170.         Print "Q) Exit program"
  171.         Do
  172.             in$ = InKey$
  173.             If UCase$(in$) = "Q" Then
  174.                 bFinished = TRUE: Exit Do
  175.             ElseIf UCase$(in$) = "1" Then
  176.                 GenerateVectorTileCode: Exit Do
  177.             ElseIf UCase$(in$) = "2" Then
  178.                 DrawVectorTilesTest1: Exit Do
  179.             ElseIf UCase$(in$) = "3" Then
  180.                 GetAllPossibleShapesTest: Exit Do
  181.             ElseIf UCase$(in$) = "4" Then
  182.                 FindAllCombinationsTest1: Exit Do
  183.             ElseIf UCase$(in$) = "5" Then
  184.                 FindAllCombinationsTest2: Exit Do
  185.             ElseIf UCase$(in$) = "6" Then
  186.                 FindOptimizedVectorTest: Exit Do
  187.             End If
  188.         Loop
  189.     Loop Until bFinished = TRUE
  190. End Sub ' main
  191.  
  192. ' ################################################################################################################################################################
  193. ' END MAIN MENU
  194. ' ################################################################################################################################################################
  195.  
  196. ' ################################################################################################################################################################
  197. ' BEGIN VECTOR TILE DRAWING TEST ROUTINES
  198. ' ################################################################################################################################################################
  199.  
  200. ' /////////////////////////////////////////////////////////////////////////////
  201.  
  202. Sub DrawVectorTilesTest1
  203.     Dim iX As Integer
  204.     Dim iY As Integer
  205.     Dim iMaxX As Integer
  206.     Dim iMaxY As Integer
  207.     Dim iShape As Integer
  208.     Dim iMaxShape As Integer
  209.     Dim fgColor As _Unsigned Long
  210.     Dim arrColor(0 To 7) As _Unsigned Long
  211.     Dim iColorIndex As Integer
  212.     Dim in$
  213.  
  214.     arrColor(0) = cBlack
  215.     arrColor(1) = cRed
  216.     arrColor(2) = cYellow
  217.     arrColor(3) = cLime
  218.     arrColor(4) = cCyan
  219.     arrColor(5) = cBlue
  220.     arrColor(6) = cPurple
  221.     arrColor(7) = cMagenta
  222.  
  223.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  224.     Cls , cBlack
  225.  
  226.     iMaxX = ((_Width(0) - 16) \ 8)
  227.     iMaxY = (_Height(0) - 16)
  228.     iMaxShape = 24
  229.     iShape = 0:: iColorIndex = 1
  230.  
  231.     For iY = (8 * 10) To iMaxY Step 8
  232.         For iX = 0 To iMaxX Step 8
  233.             DrawShape iShape, iX, iY, arrColor(iColorIndex)
  234.             iShape = iShape + 1: If iShape > iMaxShape Then iShape = 0
  235.             iColorIndex = iColorIndex + 1: If iColorIndex > 7 Then iColorIndex = 1
  236.         Next iX
  237.     Next iY
  238.  
  239.     Locate 1, 1
  240.     Input "PRESS <ENTER> TO CONTINUE"; in$
  241.     Screen 0
  242. End Sub ' DrawVectorTilesTest1
  243.  
  244. ' /////////////////////////////////////////////////////////////////////////////
  245.  
  246. Sub DrawShape (iShape As Integer, iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  247.     Select Case iShape
  248.         Case 0:
  249.             DrawHomeLine8x8_VT_1 iX, iY, fgColor
  250.         Case 1:
  251.             DrawHomeLine8x8_HZ_1 iX, iY, fgColor
  252.         Case 2:
  253.             DrawHomeLine8x8_NW_1 iX, iY, fgColor
  254.         Case 3:
  255.             DrawHomeLine8x8_NE_1 iX, iY, fgColor
  256.         Case 4:
  257.             DrawHomeLine8x8_SW_1 iX, iY, fgColor
  258.         Case 5:
  259.             DrawHomeLine8x8_SE_1 iX, iY, fgColor
  260.         Case 6:
  261.             DrawHomeLine8x8_VT_2 iX, iY, fgColor
  262.         Case 7:
  263.             DrawHomeLine8x8_HZ_2 iX, iY, fgColor
  264.         Case 8:
  265.             DrawHomeLine8x8_NW_2 iX, iY, fgColor
  266.         Case 9:
  267.             DrawHomeLine8x8_NE_2 iX, iY, fgColor
  268.         Case 10:
  269.             DrawHomeLine8x8_SW_2 iX, iY, fgColor
  270.         Case 11:
  271.             DrawHomeLine8x8_SE_2 iX, iY, fgColor
  272.         Case 12:
  273.             DrawHomeLine8x8_VT_3 iX, iY, fgColor
  274.         Case 13:
  275.             DrawHomeLine8x8_HZ_3 iX, iY, fgColor
  276.         Case 14:
  277.             DrawHomeLine8x8_NW_3 iX, iY, fgColor
  278.         Case 15:
  279.             DrawHomeLine8x8_NE_3 iX, iY, fgColor
  280.         Case 16:
  281.             DrawHomeLine8x8_SW_3 iX, iY, fgColor
  282.         Case 17:
  283.             DrawHomeLine8x8_SE_3 iX, iY, fgColor
  284.         Case 18:
  285.             DrawJailLine8x8_VT_2 iX, iY, fgColor
  286.         Case 19:
  287.             DrawJailLine8x8_VT_1 iX, iY, fgColor
  288.         Case 20:
  289.             DrawJailLine8x8_HZ_2 iX, iY, fgColor
  290.         Case 21:
  291.             DrawJailLine8x8_HZ_1 iX, iY, fgColor
  292.         Case 22:
  293.             DrawJailLine8x8_Grid_1 iX, iY, fgColor
  294.         Case 23:
  295.             DrawJailLine8x8_Grid_2 iX, iY, fgColor
  296.         Case 24:
  297.             DrawJailLine8x8_Grid_3 iX, iY, fgColor
  298.         Case Else:
  299.             '(IGNORE)
  300.     End Select
  301. End Sub ' DrawShape
  302.  
  303. ' ################################################################################################################################################################
  304. ' END VECTOR TILE DRAWING TEST ROUTINES
  305. ' ################################################################################################################################################################
  306.  
  307. ' ################################################################################################################################################################
  308. ' BEGIN BOX DRAWING ROUTINES
  309. ' ################################################################################################################################################################
  310.  
  311. ' /////////////////////////////////////////////////////////////////////////////
  312. ' DRAW A 2-D BOX (OUTLINE)
  313. ' https://www.qb64.org/wiki/LINE
  314.  
  315. Sub DrawBoxOutline (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  316.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, B ' Draw box outline
  317. End Sub ' DrawBoxOutline
  318.  
  319. ' /////////////////////////////////////////////////////////////////////////////
  320. ' DRAW A 2-D BOX (SOLID)
  321. ' https://www.qb64.org/wiki/LINE
  322.  
  323. ' Renamed DrawBox/DrawBoxLine to DrawSolidBox
  324.  
  325. Sub DrawBoxSolid (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  326.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, BF ' Draw a solid box
  327. End Sub ' DrawBoxSolid
  328.  
  329. ' /////////////////////////////////////////////////////////////////////////////
  330. ' DRAW A 2-D RECTANGLE (OUTLINE)
  331.  
  332. Sub DrawRectOutline (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  333.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, B ' Draw rectangle outline
  334. End Sub ' DrawRectOutline
  335.  
  336. ' /////////////////////////////////////////////////////////////////////////////
  337. ' DRAW A 2-D RECTANGLE (SOLID)
  338.  
  339. Sub DrawRectSolid (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  340.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, BF ' Draw a solid rectangle
  341. End Sub ' DrawRectSolid
  342.  
  343. ' /////////////////////////////////////////////////////////////////////////////
  344. ' DRAW A 2-D BOX (OUTLINE)
  345. ' https://www.qb64.org/wiki/LINE
  346.  
  347. ' The style parameter 0-255 doesn't seem to have a solid line?
  348. ' For that, use DrawOutlineBox.
  349.  
  350. ' LINE [STEP] [(column1, row1)]-[STEP] (column2, row2), color[, [{B|BF}], style%]
  351. ' B creates a box outline with each side parallel to the program screen sides. BF creates a filled box.
  352. ' The style% signed INTEGER value sets a dotted pattern to draw the line or rectangle outline.
  353.  
  354. Sub DrawStyledOutlineBox (iX%, iY%, iSize%, iColor~&, iStyle%)
  355.     Line (iX%, iY%)-(iX% + (iSize% - 1), iY% + (iSize% - 1)), iColor~&, B , iStyle%
  356. End Sub ' DrawStyledOutlineBox
  357.  
  358. ' /////////////////////////////////////////////////////////////////////////////
  359. ' DRAW A 2-D BOX (OUTLINE) WITH A SOLID LINE
  360.  
  361. Sub DrawOutlineBox (iX%, iY%, iSize2%, iColor~&, iWeight2%)
  362.     Dim iFromX%
  363.     Dim iFromY%
  364.     Dim iToX%
  365.     Dim iToY%
  366.     iSize% = iSize2% - 1
  367.     iWeight% = iWeight2% - 1
  368.     If iWeight% = 0 Then
  369.         ' TOP LINE
  370.         iFromX% = iX%
  371.         iFromY% = iY%
  372.         iToX% = iX% + iSize%
  373.         iToY% = iY%
  374.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  375.  
  376.         ' BOTTOM LINE
  377.         iFromX% = iX%
  378.         iFromY% = iY% + iSize%
  379.         iToX% = iX% + iSize%
  380.         iToY% = iY% + iSize%
  381.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  382.  
  383.         ' LEFT LINE
  384.         iFromX% = iX%
  385.         iFromY% = iY%
  386.         iToX% = iX%
  387.         iToY% = iY% + iSize%
  388.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  389.  
  390.         ' RIGHT LINE
  391.         iFromX% = iX% + iSize%
  392.         iFromY% = iY%
  393.         iToX% = iX% + iSize%
  394.         iToY% = iY% + iSize%
  395.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  396.     ElseIf iWeight% > 0 Then
  397.         ' TOP LINE
  398.         For iFromY% = iY% To (iY% + iWeight%)
  399.             iFromX% = iX%
  400.             'iFromY% = iY%
  401.             iToX% = iX% + iSize%
  402.             iToY% = iFromY%
  403.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  404.         Next iFromY%
  405.  
  406.         ' BOTTOM LINE
  407.         For iFromY% = ((iY% + iSize%) - iWeight%) To (iY% + iSize%)
  408.             iFromX% = iX%
  409.             'iFromY% = iY% + iSize%
  410.             iToX% = iX% + iSize%
  411.             iToY% = iFromY%
  412.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  413.         Next iFromY%
  414.  
  415.         ' LEFT LINE
  416.         For iFromX% = iX% To (iX% + iWeight%)
  417.             'iFromX% = iX%
  418.             iFromY% = iY%
  419.             iToX% = iFromX%
  420.             iToY% = iY% + iSize%
  421.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  422.         Next iFromX%
  423.  
  424.         ' RIGHT LINE
  425.         For iFromX% = ((iX% + iSize%) - iWeight%) To (iX% + iSize%)
  426.             'iFromX% = iX% + iSize%
  427.             iFromY% = iY%
  428.             iToX% = iFromX%
  429.             iToY% = iY% + iSize%
  430.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  431.         Next iFromX%
  432.     End If
  433. End Sub ' DrawOutlineBox
  434.  
  435. ' ################################################################################################################################################################
  436. ' END BOX DRAWING ROUTINES
  437. ' ################################################################################################################################################################
  438.  
  439. ' ################################################################################################################################################################
  440. ' BEGIN GENERATE LINE DRAWING SHAPE ROUTINES
  441. ' ################################################################################################################################################################
  442.  
  443. ' /////////////////////////////////////////////////////////////////////////////
  444.  
  445. Sub GetAllPossibleShapes (arrShapes1() As RectangleType)
  446.     ReDim arrShapes1(-1) As RectangleType
  447.     Dim iLoopRows As Integer
  448.     Dim iLoopCols As Integer
  449.     Dim iIndex As Integer
  450.     Dim iLoopY As Integer
  451.     Dim iLoopX As Integer
  452.  
  453.     For iLoopRows = 1 To 8
  454.         For iLoopCols = 1 To 8
  455.             ' Add next shape to array
  456.             iIndex = UBound(arrShapes1) + 1
  457.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  458.  
  459.             ' Save coordinates
  460.             arrShapes1(iIndex).x1 = 1
  461.             arrShapes1(iIndex).y1 = 1
  462.             arrShapes1(iIndex).x2 = iLoopCols
  463.             arrShapes1(iIndex).y2 = iLoopRows
  464.             arrShapes1(UBound(arrShapes1)).PixelCount = 0
  465.  
  466.             ' Count Pixels
  467.             For iLoopY = 1 To 8
  468.                 For iLoopX = 1 To 8
  469.                     if _
  470.                         iLoopY >= arrShapes1(iIndex).y1 _
  471.                         and _
  472.                         iLoopY <= arrShapes1(iIndex).y2 _
  473.                         and _
  474.                         iLoopX >= arrShapes1(iIndex).x1 _
  475.                         and _
  476.                         iLoopX <= arrShapes1(iIndex).x2 _
  477.                         then
  478.  
  479.                         'sLine = sLine + "#"
  480.                         arrShapes1(UBound(arrShapes1)).PixelCount = arrShapes1(UBound(arrShapes1)).PixelCount + 1
  481.                     Else
  482.                         'sLine = sLine + "."
  483.                     End If
  484.                 Next iLoopX
  485.                 'DebugPrint sLine
  486.             Next iLoopY
  487.  
  488.         Next iLoopCols
  489.     Next iLoopRows
  490. End Sub ' GetAllPossibleShapes
  491.  
  492. ' /////////////////////////////////////////////////////////////////////////////
  493.  
  494. Sub GetAllPossibleShapesTest
  495.     ReDim arrShapes1(-1) As RectangleType
  496.     Dim arrColor(0 To 7) As _Unsigned Long
  497.     Dim iLoopShape As Integer
  498.     Dim iOffsetY As Integer
  499.     Dim iOffsetX As Integer
  500.     Dim iColorIndex As Integer
  501.     Dim iMinColorIndex As Integer: iMinColorIndex = 1
  502.     Dim iMaxColorIndex As Integer: iMaxColorIndex = 7
  503.     Dim in$
  504.     Dim iX As Integer
  505.     Dim iY As Integer
  506.     Dim iSizeW As Integer
  507.     Dim iSizeH As Integer
  508.     Dim fgColor As _Unsigned Long
  509.     Dim iMinX As Integer
  510.     Dim iMinY As Integer
  511.     Dim iMaxX As Integer
  512.     Dim iMaxY As Integer
  513.  
  514.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  515.     iMinX = 0
  516.     iMinY = 17
  517.     iMaxX = (_Width(0) / 8) ' iMaxX = _Width(0) - 16
  518.     iMaxY = _Height(0) - 16
  519.     iOffsetY = iMinY
  520.     iOffsetX = iMinX
  521.  
  522.     arrColor(0) = cBlack
  523.     arrColor(1) = cRed
  524.     arrColor(2) = cYellow
  525.     arrColor(3) = cLime
  526.     arrColor(4) = cCyan
  527.     arrColor(5) = cBlue
  528.     arrColor(6) = cPurple
  529.     arrColor(7) = cMagenta
  530.  
  531.     GetAllPossibleShapes arrShapes1()
  532.  
  533.     iColorIndex = iMinColorIndex
  534.     For iLoopShape = 0 To UBound(arrShapes1)
  535.         DebugPrint _
  536.             "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  537.             "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  538.             cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  539.  
  540.         iX = arrShapes1(iLoopShape).x1 + iOffsetX
  541.         iY = arrShapes1(iLoopShape).y1 + iOffsetY
  542.         iSizeW = (arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1) + 1
  543.         iSizeH = (arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1) + 1
  544.         fgColor = arrColor(iColorIndex)
  545.         DrawRectSolid iX, iY, iSizeW, iSizeH, fgColor
  546.  
  547.         iOffsetX = iOffsetX + 16: If iOffsetX > iMaxX Then iOffsetX = iMinX: iOffsetY = iOffsetY + 16: If iOffsetY > iMaxY Then iOffsetY = iMinY
  548.         iColorIndex = iColorIndex + 1: If iColorIndex > iMaxColorIndex Then iColorIndex = iMinColorIndex
  549.     Next iLoopShape
  550.  
  551.     Locate 1, 1
  552.     Color cWhite, cBlack
  553.     Input "PRESS <ENTER> TO CONTINUE"; in$
  554.     Screen 0
  555. End Sub ' GetAllPossibleShapes
  556.  
  557.  
  558. Function DedupeDelimList$ (sInput As String, sDelim As String)
  559.     ReDim arrLines(-1) As String
  560.     Dim sOutput As String
  561.     Dim iLoop As Integer
  562.  
  563.     split sInput, sDelim, arrLines()
  564.     sOutput = sDelim
  565.     For iLoop = LBound(arrLines) To UBound(arrLines)
  566.         If InStr(1, sOutput, sDelim + arrLines(iLoop) + sDelim) = 0 Then
  567.             sOutput = sOutput + arrLines(iLoop) + sDelim
  568.         End If
  569.     Next iLoop
  570.  
  571.     DedupeDelimList$ = sOutput
  572. End Function ' DedupeDelimList$
  573.  
  574. ' /////////////////////////////////////////////////////////////////////////////
  575.  
  576. Function FindAllCombinationsNext$ (arrGroup() As Integer)
  577.     Dim sResult As String: sResult = ""
  578.     ReDim arrSubGroup(0 To UBound(arrGroup) - 1) As Integer
  579.     Dim iOmit As Integer
  580.     Dim iKeep As Integer
  581.     Dim iIndex As Integer
  582.  
  583.     'dim sLine as string : sLine = "Received: "
  584.     '    'DebugPrint "FindAllCombinationsNext$ called, level " + cstr$(iLevel)
  585.     '    m_iCount = m_iCount + 1
  586.     '    DebugPrint CurrentDateTime$ + " FindAllCombinationsNext$ called, m_iCount=" + cstr$(m_iCount)
  587.     'For iKeep = 0 To UBound(arrGroup)
  588.     'sLine = sLine + cstr$(arrGroup(iKeep)) + " "
  589.     'Next iKeep
  590.     'DebugPrint "    " + sLine
  591.  
  592.     ' Recursively try omitting each one
  593.     If UBound(arrGroup) > 0 Then
  594.         For iOmit = 0 To UBound(arrGroup)
  595.             ReDim arrSubGroup(0 To UBound(arrGroup) - 1) As Integer
  596.             iIndex = -1
  597.             For iKeep = 0 To UBound(arrGroup)
  598.                 If arrGroup(iKeep) <> arrGroup(iOmit) Then
  599.                     iIndex = iIndex + 1
  600.                     arrSubGroup(iIndex) = arrGroup(iKeep)
  601.                     'sResult = sResult + IIFSTR$(len(sResult)=0, "", ",") + cstr$(arrGroup(iKeep))
  602.                     sResult = sResult + cstr$(arrGroup(iKeep)) + ","
  603.                 End If
  604.             Next iKeep
  605.             'sResult = sResult + IIFSTR$(len(sResult)=0, "", ";") + FindAllCombinationsTestNext$(arrSubGroup())
  606.             sResult = sResult + ";" + FindAllCombinationsNext$(arrSubGroup())
  607.             sResult = DedupeDelimList$(sResult, ";")
  608.         Next iOmit
  609.     Else
  610.         sResult = cstr$(arrGroup(0)) + ";"
  611.     End If
  612.  
  613.     sResult = DedupeDelimList$(sResult, ";")
  614.     'm_iCount = m_iCount - 1
  615.     'DebugPrint "    Returning: " + chr$(34) + sResult + chr$(34)
  616.     FindAllCombinationsNext$ = sResult
  617. End Function ' FindAllCombinationsNext$
  618.  
  619. ' /////////////////////////////////////////////////////////////////////////////
  620. ' Get all combinations of the items in the list
  621.  
  622. Sub FindAllCombinations (sItemList As String)
  623.     ReDim arrGroup(-1) As Integer
  624.     Dim iLoop As Integer
  625.     Dim sResult As String: sResult = ""
  626.     ReDim arrLines(-1) As String
  627.     Dim sFinal As String: sFinal = ""
  628.  
  629.     ' Start with all
  630.     GetIntegerArrayFromDelimList sItemList, ",", 0, arrGroup()
  631.     For iLoop = LBound(arrGroup) To UBound(arrGroup)
  632.         sResult = sResult + IIFSTR$(Len(sResult) = 0, "", ",") + cstr$(iLoop)
  633.     Next iLoop
  634.  
  635.     ' Find all other combinations (including without)
  636.     sResult = sResult + ";" + FindAllCombinationsNext$(arrGroup())
  637.     sResult = Replace$(sResult, ",;", ";")
  638.  
  639.     ' Dedupe results
  640.     split sResult, ";", arrLines()
  641.     sFinal = ";"
  642.     For iLoop = LBound(arrLines) To UBound(arrLines)
  643.         If InStr(1, sFinal, ";" + arrLines(iLoop) + ";") = 0 Then
  644.             sFinal = sFinal + arrLines(iLoop) + ";"
  645.             DebugPrint arrLines(iLoop)
  646.         End If
  647.     Next iLoop
  648. End Sub ' FindAllCombinations
  649.  
  650. ' /////////////////////////////////////////////////////////////////////////////
  651.  
  652. Sub FindAllCombinationsTest2
  653.     Dim sItemList As String
  654.     ReDim arrGroup(-1) As Integer
  655.     Dim iLoop As Integer
  656.     Dim sResult As String: sResult = ""
  657.     ReDim arrLines(-1) As String
  658.     Dim sFinal As String: sFinal = ""
  659.  
  660.     ' Use non-contiguous test data
  661.     'sItemList = "1,2,3,4"
  662.     'sItemList = "1,2,4,8,16,32,64,128"
  663.     Input "Enter a space-separated list of numbers"; sItemList
  664.     sItemList = Replace$(sItemList, " ", ",")
  665.     GetIntegerArrayFromDelimList sItemList, ",", 0, arrGroup()
  666.  
  667.     ' Start with all
  668.     For iLoop = LBound(arrGroup) To UBound(arrGroup)
  669.         sResult = sResult + IIFSTR$(Len(sResult) = 0, "", ",") + cstr$(arrGroup(iLoop))
  670.     Next iLoop
  671.  
  672.     ' Find all other combinations (including without)
  673.     sResult = sResult + ";" + FindAllCombinationsNext$(arrGroup())
  674.     sResult = Replace$(sResult, ",;", ";")
  675.  
  676.     ' Dedupe results
  677.     split sResult, ";", arrLines()
  678.     sFinal = ";"
  679.     For iLoop = LBound(arrLines) To UBound(arrLines)
  680.         If InStr(1, sFinal, ";" + arrLines(iLoop) + ";") = 0 Then
  681.             sFinal = sFinal + arrLines(iLoop) + ";"
  682.             DebugPrint arrLines(iLoop)
  683.         End If
  684.     Next iLoop
  685. End Sub ' FindAllCombinationsTest2
  686.  
  687. ' /////////////////////////////////////////////////////////////////////////////
  688.  
  689. Sub FindAllCombinationsTest1
  690.     Dim iFrom As Integer: iFrom = 1
  691.     Dim iTo As Integer: iTo = 4
  692.     ReDim arrGroup(-1) As Integer
  693.     Dim iLoop As Integer
  694.     Dim sResult As String: sResult = ""
  695.     ReDim arrLines(-1) As String
  696.     Dim sFinal As String: sFinal = ""
  697.  
  698.     ' Generate some simple test data
  699.     For iLoop = iFrom To iTo
  700.         ReDim _Preserve arrGroup(0 To UBound(arrGroup) + 1) As Integer
  701.         arrGroup(UBound(arrGroup)) = iLoop
  702.     Next iLoop
  703.  
  704.     ' Start with all
  705.     For iLoop = LBound(arrGroup) To UBound(arrGroup)
  706.         sResult = sResult + IIFSTR$(Len(sResult) = 0, "", ",") + cstr$(arrGroup(iLoop))
  707.     Next iLoop
  708.  
  709.     ' Find all other combinations (including without)
  710.     sResult = sResult + ";" + FindAllCombinationsNext$(arrGroup())
  711.     sResult = Replace$(sResult, ",;", ";")
  712.  
  713.     ' Dedupe results
  714.     split sResult, ";", arrLines()
  715.     sFinal = ";"
  716.     For iLoop = LBound(arrLines) To UBound(arrLines)
  717.         If InStr(1, sFinal, ";" + arrLines(iLoop) + ";") = 0 Then
  718.             sFinal = sFinal + arrLines(iLoop) + ";"
  719.             DebugPrint arrLines(iLoop)
  720.         End If
  721.     Next iLoop
  722. End Sub ' FindAllCombinationsTest1
  723.  
  724. ' /////////////////////////////////////////////////////////////////////////////
  725.  
  726. Sub FindOptimizedVector (TileString As String)
  727.     ReDim arrTile1(1 To 8, 1 To 8) As String
  728.     ReDim arrTile2(1 To 8, 1 To 8) As String
  729.     ReDim arrShapes1(-1) As RectangleType
  730.     ReDim arrShapes2(-1) As RectangleType
  731.     ReDim arrShapes3(-1) As RectangleType
  732.  
  733.     Dim iLoopShape As Integer
  734.     Dim iLoopY As Integer
  735.     Dim iLoopX As Integer
  736.     Dim iDestY As Integer
  737.     Dim iDestX As Integer
  738.     Dim iSizeY As Integer
  739.     Dim iSizeX As Integer
  740.     Dim iEndY As Integer
  741.     Dim iEndX As Integer
  742.     Dim iTestY As Integer
  743.     Dim iTestX As Integer
  744.     Dim bShapeFits As Integer
  745.     Dim sLine As String
  746.     Dim sNextPixel As String
  747.     Dim iShape1 As Integer
  748.     Dim iShape2 As Integer
  749.     Dim iIndex As Integer
  750.  
  751.     Dim sItemList As String
  752.     ReDim arrNumGroup(-1) As Integer
  753.     ReDim arrListGroup(-1) As String
  754.     ReDim arrShapeList(-1) As String
  755.     Dim iLoop1 As Integer
  756.     Dim iLoop2 As Integer
  757.     Dim sGroupList1 As String
  758.     Dim sGroupList2 As String
  759.     ReDim arrLines(-1) As String
  760.  
  761.     Dim iPixelCount As Integer
  762.     Dim iShapeCount As Integer
  763.     ReDim arrCompare(-1) As DrawCompareType
  764.     Dim iMatchCount As Integer
  765.  
  766.     ' Turn tile into 2D array
  767.     StringToArray arrTile1(), TileString
  768.  
  769.     ' Get all shapes to try
  770.     GetAllPossibleShapes arrShapes1()
  771.  
  772.     ' Try all shapes
  773.     For iLoopShape = 0 To UBound(arrShapes1)
  774.         ' Try next shape
  775.  
  776.         ' BEGIN DEBUG SHOW NEXT SHAPE
  777.         If TRUE = FALSE Then
  778.             DebugPrint "arrShapes1(" + cstr$(iLoopShape) + "):"
  779.         DebugPrint _
  780.             "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  781.             "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  782.             cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  783.             For iLoopY = 1 To 8
  784.                 sLine = ""
  785.                 For iLoopX = 1 To 8
  786.                 if _
  787.                     iLoopY >= arrShapes1(iLoopShape).y1 _
  788.                     and _
  789.                     iLoopY <= arrShapes1(iLoopShape).y2 _
  790.                     and _
  791.                     iLoopX >= arrShapes1(iLoopShape).x1 _
  792.                     and _
  793.                     iLoopX <= arrShapes1(iLoopShape).x2 _
  794.                     then
  795.  
  796.                         sLine = sLine + "#"
  797.                     Else
  798.                         sLine = sLine + "."
  799.                     End If
  800.                 Next iLoopX
  801.                 DebugPrint sLine
  802.             Next iLoopY
  803.             DebugPrint ""
  804.         End If
  805.         ' END DEBUG SHOW NEXT SHAPE
  806.  
  807.         ' Try test tile in every position (that it fits)
  808.         For iDestY = 1 To 8
  809.             For iDestX = 1 To 8
  810.                 bShapeFits = FALSE
  811.  
  812.                 ' Does shape fit at this Y position?
  813.                 iSizeY = arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1
  814.                 iEndY = iDestY + iSizeY
  815.                 If iEndY < 9 Then
  816.                     ' Does shape fit at this X position?
  817.                     iSizeX = arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1
  818.                     iEndX = iDestX + iSizeX
  819.                     If iEndX < 9 Then
  820.                         ' Do any of shape's pixels fall outside of tile's pixels?
  821.                         bShapeFits = TRUE
  822.                         For iTestY = iDestY To iEndY
  823.                             For iTestX = iDestX To iEndX
  824.                                 If arrTile1(iTestY, iTestX) = "." Then
  825.                                     ' No pixel here, shape fails
  826.                                     bShapeFits = FALSE
  827.                                     Exit For
  828.                                 End If
  829.                             Next iTestX
  830.                             If bShapeFits = FALSE Then Exit For
  831.                         Next iTestY
  832.                     End If
  833.                 End If
  834.  
  835.                 ' If shape fits, add it to the list
  836.                 If bShapeFits = TRUE Then
  837.                     iIndex = UBound(arrShapes2) + 1
  838.                     ReDim _Preserve arrShapes2(0 To iIndex) As RectangleType
  839.                     arrShapes2(iIndex).y1 = iDestY
  840.                     arrShapes2(iIndex).x1 = iDestX
  841.                     arrShapes2(iIndex).y2 = iEndY
  842.                     arrShapes2(iIndex).x2 = iEndX
  843.                     arrShapes2(iIndex).PixelCount = arrShapes1(iLoopShape).PixelCount
  844.                     arrShapes2(iIndex).IsActive = TRUE
  845.                 End If
  846.             Next iDestX
  847.         Next iDestY
  848.     Next iLoopShape
  849.  
  850.     '' Show tile
  851.     'DebugPrint "TILE TO CHECK:"
  852.     'for iLoopY = lbound(arrTile1, 1) to ubound(arrTile1, 1)
  853.     '    sLine = ""
  854.     '    for iLoopX = lbound(arrTile1, 2) to ubound(arrTile1, 2)
  855.     '        sLine=sLine + arrTile1(iLoopY, iLoopX)
  856.     '    next iLoopX
  857.     '    DebugPrint sLine
  858.     'next iLoopY
  859.  
  860.     '' Show all contender shapes
  861.     'DebugPrint "SHAPES THAT MATCHED + FIT:"
  862.     'for iLoopShape = 0 to ubound(arrShapes2)
  863.     '    if arrShapes2(iLoopShape).IsActive = TRUE then
  864.     '        DebugPrint _
  865.     '            "(" + cstr$(arrShapes2(iLoopShape).x1) + ", " + cstr$(arrShapes2(iLoopShape).y1) + ")-" + _
  866.     '            "(" + cstr$(arrShapes2(iLoopShape).x2) + ", " + cstr$(arrShapes2(iLoopShape).y2) + ") " + _
  867.     '            cstr$(arrShapes2(iLoopShape).PixelCount) + " pixels"
  868.     '        for iDestY = 1 To 8
  869.     '            sLine = ""
  870.     '            for iDestX = 1 To 8
  871.     '                sNextPixel = "."
  872.     '                if iDestY >= arrShapes2(iLoopShape).y1 then
  873.     '                    if iDestY <= arrShapes2(iLoopShape).y2 then
  874.     '                        if iDestX >= arrShapes2(iLoopShape).x1 then
  875.     '                            if iDestX <= arrShapes2(iLoopShape).x2 then
  876.     '                                sNextPixel = "#"
  877.     '                            end if
  878.     '                        end if
  879.     '                    end if
  880.     '                end if
  881.     '                sLine = sLine + sNextPixel
  882.     '            next iDestX
  883.     '            DebugPrint sLine
  884.     '        next iDestY
  885.     '    end if
  886.     'next iLoopShape
  887.  
  888.     ' Remove redundant shapes (any where another shape covers more points)
  889.     For iShape1 = 0 To UBound(arrShapes2)
  890.  
  891.         ' make sure shape #1 was not eliminated
  892.         If arrShapes2(iShape1).IsActive = TRUE Then
  893.  
  894.             ' compare shape #1 against all other shapes
  895.             For iShape2 = 0 To UBound(arrShapes2)
  896.  
  897.                 ' don't compare against itself
  898.                 If iShape2 <> iShape1 Then
  899.  
  900.                     ' make sure shape #2 was not eliminated
  901.                     If arrShapes2(iShape2).IsActive = TRUE Then
  902.  
  903.                         ' can shape #2 do what shape #1 can do? (covers all points shape #1 does)
  904.                         if _
  905.                             arrShapes2(iShape1).y1 >= arrShapes2(iShape2).y1 _
  906.                             and _
  907.                             arrShapes2(iShape1).y2 <= arrShapes2(iShape2).y2 _
  908.                             and _
  909.                             arrShapes2(iShape1).x1 >= arrShapes2(iShape2).x1 _
  910.                             and _
  911.                             arrShapes2(iShape1).x2 <= arrShapes2(iShape2).x2 _
  912.                             then
  913.  
  914.                             ' does shape #2 do it better? (cover more points than shape #1)
  915.                             If arrShapes2(iShape2).PixelCount >= arrShapes2(iShape1).PixelCount Then
  916.                                 ' Remove shape #1
  917.                                 arrShapes2(iShape1).IsActive = FALSE
  918.                             End If
  919.  
  920.                         End If
  921.  
  922.                     End If
  923.  
  924.                 End If
  925.  
  926.             Next iShape2
  927.  
  928.         End If
  929.  
  930.     Next iShape1
  931.  
  932.     ' Add level 1 non-redundant shapes to the next list
  933.     For iLoopShape = 0 To UBound(arrShapes2)
  934.         If arrShapes2(iLoopShape).IsActive = TRUE Then
  935.             iIndex = UBound(arrShapes3) + 1
  936.             ReDim _Preserve arrShapes3(0 To iIndex) As RectangleType
  937.             arrShapes3(iIndex).y1 = arrShapes2(iLoopShape).y1
  938.             arrShapes3(iIndex).x1 = arrShapes2(iLoopShape).x1
  939.             arrShapes3(iIndex).y2 = arrShapes2(iLoopShape).y2
  940.             arrShapes3(iIndex).x2 = arrShapes2(iLoopShape).x2
  941.             arrShapes3(iIndex).PixelCount = arrShapes2(iLoopShape).PixelCount
  942.             arrShapes3(iIndex).IsActive = arrShapes2(iLoopShape).IsActive
  943.         End If
  944.     Next iLoopShape
  945.  
  946.     ' Show all non-redundant shapes
  947.     DebugPrint "SHAPES THAT MATCHED + FIT, NON-REDUNDANT LEVEL 1:"
  948.     For iLoopShape = 0 To UBound(arrShapes3)
  949.         DebugPrint _
  950.             "(" + cstr$(arrShapes3(iLoopShape).x1) + ", " + cstr$(arrShapes3(iLoopShape).y1) + ")-" + _
  951.             "(" + cstr$(arrShapes3(iLoopShape).x2) + ", " + cstr$(arrShapes3(iLoopShape).y2) + ") " + _
  952.             cstr$(arrShapes3(iLoopShape).PixelCount) + " pixels"
  953.         For iDestY = 1 To 8
  954.             sLine = ""
  955.             For iDestX = 1 To 8
  956.                 sNextPixel = "."
  957.                 If iDestY >= arrShapes3(iLoopShape).y1 Then
  958.                     If iDestY <= arrShapes3(iLoopShape).y2 Then
  959.                         If iDestX >= arrShapes3(iLoopShape).x1 Then
  960.                             If iDestX <= arrShapes3(iLoopShape).x2 Then
  961.                                 sNextPixel = "#"
  962.                             End If
  963.                         End If
  964.                     End If
  965.                 End If
  966.                 sLine = sLine + sNextPixel
  967.             Next iDestX
  968.             DebugPrint sLine
  969.         Next iDestY
  970.     Next iLoopShape
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.     ' Can we do without any?
  978.  
  979.     ' Try all combinations
  980.  
  981.     ' Items to combine
  982.     sItemList = ""
  983.     For iShape1 = 0 To UBound(arrShapes3)
  984.         sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iShape1)
  985.     Next iShape1
  986.     GetIntegerArrayFromDelimList sItemList, ",", 0, arrNumGroup()
  987.  
  988.     ' Start with all
  989.     sGroupList1 = ""
  990.     For iLoop1 = LBound(arrNumGroup) To UBound(arrNumGroup)
  991.         sGroupList1 = sGroupList1 + IIFSTR$(Len(sGroupList1) = 0, "", ",") + cstr$(arrNumGroup(iLoop1))
  992.     Next iLoop1
  993.  
  994.     ' Find all other combinations (including without)
  995.     sGroupList1 = sGroupList1 + ";" + FindAllCombinationsNext$(arrNumGroup())
  996.     sGroupList1 = Replace$(sGroupList1, ",;", ";")
  997.  
  998.     ' Dedupe results
  999.     split sGroupList1, ";", arrListGroup()
  1000.     sGroupList2 = ";"
  1001.     For iLoop1 = LBound(arrListGroup) To UBound(arrListGroup)
  1002.         If InStr(1, sGroupList2, ";" + arrListGroup(iLoop1) + ";") = 0 Then
  1003.             sGroupList2 = sGroupList2 + arrListGroup(iLoop1) + ";"
  1004.             'DebugPrint arrListGroup(iLoop1)
  1005.         End If
  1006.     Next iLoop1
  1007.  
  1008.     ' Now see which combinations can draw the tile
  1009.     DebugPrint "==============================================================================="
  1010.     DebugPrint "Now see which combinations can draw the tile..."
  1011.     iMatchCount = 0
  1012.     split sGroupList2, ";", arrListGroup()
  1013.     For iLoop1 = LBound(arrListGroup) To UBound(arrListGroup)
  1014.         DebugPrint "arrListGroup(" + cstr$(iLoop1) + ") = " + Chr$(34) + arrListGroup(iLoop1) + Chr$(34)
  1015.  
  1016.         ' Clear test tile
  1017.         ReDim arrTile2(1 To 8, 1 To 8) As String
  1018.         For iDestY = 1 To 8
  1019.             For iDestX = 1 To 8
  1020.                 arrTile2(iDestY, iDestX) = "."
  1021.             Next iDestX
  1022.         Next iDestY
  1023.  
  1024.         ' Get list of indexes that make up the next combination of shape
  1025.         split arrListGroup(iLoop1), ",", arrShapeList()
  1026.  
  1027.         ' Try drawing next combination of shapes in the test tile
  1028.         iShapeCount = 0
  1029.         iPixelCount = 0
  1030.         For iLoop2 = LBound(arrShapeList) To UBound(arrShapeList)
  1031.             If IsNum%(arrShapeList(iLoop2)) = TRUE Then
  1032.                 iIndex = Val(arrShapeList(iLoop2))
  1033.                 iShapeCount = iShapeCount + 1
  1034.                 iPixelCount = iPixelCount + arrShapes3(iIndex).PixelCount
  1035.  
  1036.                 For iDestY = 1 To 8
  1037.                     For iDestX = 1 To 8
  1038.                         'arrTile2(iDestY, iDestX) = "."
  1039.                         If iDestY >= arrShapes3(iIndex).y1 Then
  1040.                             If iDestY <= arrShapes3(iIndex).y2 Then
  1041.                                 If iDestX >= arrShapes3(iIndex).x1 Then
  1042.                                     If iDestX <= arrShapes3(iIndex).x2 Then
  1043.                                         arrTile2(iDestY, iDestX) = "#"
  1044.                                     End If
  1045.                                 End If
  1046.                             End If
  1047.                         End If
  1048.                     Next iDestX
  1049.                 Next iDestY
  1050.             Else
  1051.                 DebugPrint "ERROR NON-NUMERIC AT arrShapeList(" + cstr$(iLoop2) + ") = " + Chr$(34) + arrShapeList(iLoop2) + Chr$(34)
  1052.                 'exit for
  1053.             End If
  1054.         Next iLoop2
  1055.  
  1056.         ' Does the test tile match the real tile?
  1057.         If TilesAreEqual%(arrTile1(), arrTile2()) = TRUE Then
  1058.             DebugPrint "Found matching tile at iLoop1=" + cstr$(iLoop1)
  1059.             iMatchCount = iMatchCount + 1
  1060.  
  1061.             iIndex = UBound(arrCompare) + 1
  1062.             DebugPrint "Appending to arrCompare at position " + cstr$(iIndex)
  1063.             DebugPrint "    after:"
  1064.             DebugPrint "        lbound(arrCompare)=" + cstr$(LBound(arrCompare))
  1065.             DebugPrint "        ubound(arrCompare)=" + cstr$(UBound(arrCompare))
  1066.             ReDim _Preserve arrCompare(0 To iIndex) As DrawCompareType
  1067.             DebugPrint "    after:"
  1068.             DebugPrint "        lbound(arrCompare)=" + cstr$(LBound(arrCompare))
  1069.             DebugPrint "        ubound(arrCompare)=" + cstr$(UBound(arrCompare))
  1070.             arrCompare(iIndex).IndexList = arrListGroup(iLoop1)
  1071.             arrCompare(iIndex).ShapeCount = iShapeCount
  1072.             arrCompare(iIndex).PixelCount = iPixelCount
  1073.             arrCompare(iIndex).IsActive = TRUE
  1074.         Else
  1075.             DebugPrint "Tiles didn't match"
  1076.         End If
  1077.  
  1078.     Next iLoop1
  1079.  
  1080.     ' Identify the best combination that uses the least # of shapes + pixels
  1081.     If UBound(arrCompare) > LBound(arrCompare) Then
  1082.         For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  1083.             For iLoop2 = LBound(arrCompare) To UBound(arrCompare)
  1084.                 If iLoop1 <> iLoop2 Then
  1085.                     If arrCompare(iLoop1).IsActive = TRUE Then
  1086.                         If arrCompare(iLoop2).IsActive = TRUE Then
  1087.                             DebugPrint "Comparing   ShapeCount   PixelCount   IndexList"
  1088.  
  1089.                             DebugPrint left$(cstr$(iLoop1) + String$(9, " "), 9) + _
  1090.                                 "   " + _
  1091.                                 left$(cstr$(arrCompare(iLoop1).ShapeCount) + String$(10, " "), 10) + _
  1092.                                 "   " + _
  1093.                                 left$(cstr$(arrCompare(iLoop1).PixelCount) + String$(10, " "), 10) + _
  1094.                                 "   " + _
  1095.                                 arrCompare(iLoop1).IndexList
  1096.                             DebugPrint left$(cstr$(iLoop2) + String$(9, " "), 9) + _
  1097.                                 "   " + _
  1098.                                 left$(cstr$(arrCompare(iLoop2).ShapeCount) + String$(10, " "), 10) + _
  1099.                                 "   " + _
  1100.                                 left$(cstr$(arrCompare(iLoop2).PixelCount) + String$(10, " "), 10) + _
  1101.                                 "   " + _
  1102.                                 arrCompare(iLoop2).IndexList
  1103.  
  1104.                             If arrCompare(iLoop2).ShapeCount < arrCompare(iLoop1).ShapeCount Then
  1105.                                 DebugPrint "#" + cstr$(iLoop1) + " uses more shapes, marking inactive"
  1106.                                 arrCompare(iLoop1).IsActive = FALSE
  1107.                             ElseIf arrCompare(iLoop2).ShapeCount > arrCompare(iLoop1).ShapeCount Then
  1108.                                 DebugPrint "#" + cstr$(iLoop2) + " uses more shapes, marking inactive"
  1109.                                 arrCompare(iLoop2).IsActive = FALSE
  1110.                             Else
  1111.                                 If arrCompare(iLoop2).PixelCount < arrCompare(iLoop1).PixelCount Then
  1112.                                     DebugPrint "#" + cstr$(iLoop1) + " uses more pixels, marking inactive"
  1113.                                     arrCompare(iLoop1).IsActive = FALSE
  1114.                                 ElseIf arrCompare(iLoop2).PixelCount > arrCompare(iLoop1).PixelCount Then
  1115.                                     DebugPrint "#" + cstr$(iLoop2) + " uses more pixels, marking inactive"
  1116.                                     arrCompare(iLoop2).IsActive = FALSE
  1117.                                 Else
  1118.                                     DebugPrint "Same # of shapes and pixels, marking #" + cstr$(iLoop2) + " inactive"
  1119.                                     arrCompare(iLoop2).IsActive = FALSE
  1120.                                 End If
  1121.                             End If
  1122.                         End If
  1123.                     End If
  1124.                 End If
  1125.             Next iLoop2
  1126.         Next iLoop1
  1127.     End If
  1128.  
  1129.     ' The winner!
  1130.     ' Get list of indexes that make up the winning shape combination
  1131.     DebugPrint "Looking for the winner"
  1132.     DebugPrint "lbound(arrCompare)=" + cstr$(LBound(arrCompare))
  1133.     DebugPrint "ubound(arrCompare)=" + cstr$(UBound(arrCompare))
  1134.     DebugPrint "arrCompare  ShapeCount   PixelCount   IsActive   IndexList"
  1135.  
  1136.     iIndex = -1
  1137.     For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  1138.         DebugPrint "iLoop1=" + cstr$(iLoop1)
  1139.  
  1140.         sLine = ""
  1141.         sLine = sLine + Left$(cstr$(iLoop1) + String$(9, " "), 9)
  1142.         sLine = sLine + "   "
  1143.         sLine = sLine + Left$(cstr$(arrCompare(iLoop1).ShapeCount) + String$(10, " "), 10)
  1144.         sLine = sLine + "   "
  1145.         sLine = sLine + Left$(cstr$(arrCompare(iLoop1).PixelCount) + String$(10, " "), 10)
  1146.         sLine = sLine + "   "
  1147.         sLine = sLine + Left$(TrueFalse$(arrCompare(iLoop1).IsActive) + String$(8, " "), 8)
  1148.         sLine = sLine + "   "
  1149.         sLine = sLine + arrCompare(iLoop1).IndexList
  1150.         DebugPrint sLine
  1151.  
  1152.         If arrCompare(iLoop1).IsActive = TRUE Then
  1153.             iIndex = iLoop1: Exit For
  1154.         End If
  1155.     Next iLoop1
  1156.     If iIndex > -1 Then
  1157.         DebugPrint "-------------------------------------------------------------------------------"
  1158.         DebugPrint "The winning shape combination:"
  1159.         split arrCompare(iIndex).IndexList, ",", arrShapeList()
  1160.         For iLoop2 = LBound(arrShapeList) To UBound(arrShapeList)
  1161.             DebugPrint "-------------------------------------------------------------------------------"
  1162.             DebugPrint "Shape #" + arrShapeList(iLoop2)
  1163.             If IsNum%(arrShapeList(iLoop2)) = TRUE Then
  1164.                 iIndex = Val(arrShapeList(iLoop2))
  1165.                 For iDestY = 1 To 8
  1166.                     sLine = ""
  1167.                     For iDestX = 1 To 8
  1168.                         sNextPixel = "."
  1169.                         If iDestY >= arrShapes3(iIndex).y1 Then
  1170.                             If iDestY <= arrShapes3(iIndex).y2 Then
  1171.                                 If iDestX >= arrShapes3(iIndex).x1 Then
  1172.                                     If iDestX <= arrShapes3(iIndex).x2 Then
  1173.                                         sNextPixel = "#"
  1174.                                     End If
  1175.                                 End If
  1176.                             End If
  1177.                         End If
  1178.                         sLine = sLine + sNextPixel
  1179.                     Next iDestX
  1180.                     DebugPrint sLine
  1181.                 Next iDestY
  1182.             Else
  1183.                 DebugPrint "ERROR NON-NUMERIC AT arrShapeList(" + cstr$(iLoop2) + ") = " + Chr$(34) + arrShapeList(iLoop2) + Chr$(34)
  1184.                 'exit for
  1185.             End If
  1186.         Next iLoop2
  1187.         DebugPrint "-------------------------------------------------------------------------------"
  1188.     Else
  1189.         DebugPrint "ERROR: NO WORKING SHAPE COMBINATIONS FOUND"
  1190.     End If
  1191.  
  1192. End Sub ' FindOptimizedVector
  1193.  
  1194. Function TilesAreEqual% (arrTile1() As String, arrTile2() As String)
  1195.     Dim bResult As Integer: bResult = FALSE
  1196.     Dim iLoopY As Integer
  1197.     Dim iLoopX As Integer
  1198.     Dim sLine As String
  1199.     If LBound(arrTile1, 1) = LBound(arrTile2, 1) Then
  1200.         If UBound(arrTile1, 1) = UBound(arrTile2, 1) Then
  1201.             If LBound(arrTile1, 2) = LBound(arrTile2, 2) Then
  1202.                 If UBound(arrTile1, 2) = UBound(arrTile2, 2) Then
  1203.  
  1204.                     If TRUE = FALSE Then
  1205.                         DebugPrint "???????????????????????????????????????????????????????????????????????????????"
  1206.                         DebugPrint "Comparing arrTile1:"
  1207.                         For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  1208.                             sLine = ""
  1209.                             For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  1210.                                 sLine = sLine + arrTile1(iLoopY, iLoopX)
  1211.                             Next iLoopX
  1212.                             DebugPrint sLine
  1213.                         Next iLoopY
  1214.                         DebugPrint "???????????????????????????????????????????????????????????????????????????????"
  1215.                         DebugPrint "With arrTile2:"
  1216.                         For iLoopY = LBound(arrTile2, 1) To UBound(arrTile2, 1)
  1217.                             sLine = ""
  1218.                             For iLoopX = LBound(arrTile2, 2) To UBound(arrTile2, 2)
  1219.                                 sLine = sLine + arrTile2(iLoopY, iLoopX)
  1220.                             Next iLoopX
  1221.                             DebugPrint sLine
  1222.                         Next iLoopY
  1223.                         DebugPrint "???????????????????????????????????????????????????????????????????????????????"
  1224.                     End If
  1225.  
  1226.  
  1227.  
  1228.  
  1229.                     bResult = TRUE
  1230.                     For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  1231.                         For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  1232.                             If arrTile1(iLoopY, iLoopX) = "." And arrTile2(iLoopY, iLoopX) <> "." Then
  1233.                                 bResult = FALSE: Exit For
  1234.                             ElseIf arrTile1(iLoopY, iLoopX) <> "." And arrTile2(iLoopY, iLoopX) = "." Then
  1235.                                 bResult = FALSE: Exit For
  1236.                             End If
  1237.                         Next iLoopX
  1238.                         If bResult = FALSE Then Exit For
  1239.                     Next iLoopY
  1240.                 Else
  1241.                     DebugPrint "ubound(tile,2) didn't match"
  1242.                 End If
  1243.             Else
  1244.                 DebugPrint "lbound(tile,2) didn't match"
  1245.             End If
  1246.         Else
  1247.             DebugPrint "ubound(tile,1) didn't match"
  1248.         End If
  1249.     Else
  1250.         DebugPrint "lbound(tile,1) didn't match"
  1251.     End If
  1252.     TilesAreEqual% = bResult
  1253. End Function ' TilesAreEqual%
  1254.  
  1255. ' /////////////////////////////////////////////////////////////////////////////
  1256.  
  1257. Sub FindOptimizedVectorTest
  1258.     Dim RoutineName As String: RoutineName = "FindOptimizedVectorTest"
  1259.     Dim sError As String: sError = ""
  1260.     Dim in$
  1261.     ReDim arrTileText(0 To 255) As String
  1262.     Dim sTestList As String
  1263.     ReDim arrTestIndex(-1) As Integer
  1264.     Dim iLoop As Integer
  1265.     Dim iIndex As Integer
  1266.  
  1267.     ' Start output
  1268.     DebugPrint "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  1269.     DebugPrint "Testing tiles: " + sTestList
  1270.     DebugPrint ""
  1271.  
  1272.     ' Get raster tiles as a string array
  1273.     GetTileText arrTileText()
  1274.  
  1275.     ' List of tiles to test
  1276.     'sTestList = "254,253,247,32,238,241,225,233,213,214,212,203,194,193,192,169,154,151,145,147,129,115,114,84,65,46,44,35,252"
  1277.     'sTestList = "46,35"
  1278.     sTestList = "84,253,192,151,147,114,65"
  1279.     GetIntegerArrayFromDelimList sTestList, ",", 0, arrTestIndex()
  1280.  
  1281.     ' Test tiles
  1282.     For iLoop = LBound(arrTestIndex) To UBound(arrTestIndex)
  1283.         iIndex = arrTestIndex(iLoop)
  1284.         DebugPrint "----------------------------------------------------------------------------------------------------------------------------------------------------------------"
  1285.         DebugPrint "Tile #" + cstr$(iIndex) + ":"
  1286.         DebugPrint arrTileText(iIndex)
  1287.         DebugPrint ""
  1288.  
  1289.         ' Process next tile and generate line drawing routines
  1290.         FindOptimizedVector arrTileText(iIndex)
  1291.  
  1292.         DebugPrint ""
  1293.     Next iLoop
  1294.  
  1295.     ' DONE
  1296.     DebugPrint RoutineName + " finished."
  1297.     'Input "PRESS <ENTER> TO CONTINUE";in$
  1298. End Sub ' FindOptimizedVectorTest
  1299.  
  1300. ' /////////////////////////////////////////////////////////////////////////////
  1301.  
  1302. Sub GetIntegerArrayFromDelimList (MyString As String, sDelimiter As String, iMinIndex As Integer, arrInteger() As Integer)
  1303.     ReDim arrString(-1) As String
  1304.     Dim CleanString As String
  1305.     Dim iLoop As Integer
  1306.     Dim iCount As Integer: iCount = iMinIndex - 1
  1307.  
  1308.     ReDim arrInteger(-1) As Integer
  1309.  
  1310.     If Len(sDelimiter) > 0 Then
  1311.         CleanString = MyString
  1312.         If sDelimiter <> " " Then
  1313.             CleanString = Replace$(CleanString, " ", "")
  1314.         End If
  1315.  
  1316.         split CleanString, sDelimiter, arrString()
  1317.         iCount = iMinIndex - 1
  1318.         For iLoop = LBound(arrString) To UBound(arrString)
  1319.             If IsNum%(arrString(iLoop)) = TRUE Then
  1320.                 iCount = iCount + 1
  1321.                 ReDim _Preserve arrInteger(iMinIndex To iCount) As Integer
  1322.                 arrInteger(iCount) = Val(arrString(iLoop))
  1323.             End If
  1324.         Next iLoop
  1325.     Else
  1326.         If IsNum%(MyString) = TRUE Then
  1327.             ReDim _Preserve arrInteger(iMinIndex To iMinIndex) As Integer
  1328.             arrInteger(iMinIndex) = Val(MyString)
  1329.         End If
  1330.     End If
  1331. End Sub ' GetIntegerArrayFromDelimList
  1332.  
  1333. ' /////////////////////////////////////////////////////////////////////////////
  1334.  
  1335. Sub BreakMultipleIntoShapes (MyString As String, arrShapes1() As String)
  1336.     ReDim arrLines(-1) As String
  1337.     ReDim arrCols(-1) As String
  1338.     Dim sLine As String
  1339.     Dim iLen As Integer
  1340.     Dim iCount As Integer
  1341.     Dim iLoopRows As Integer
  1342.     Dim iLoopCols As Integer
  1343.     Dim iShapeCount As Integer
  1344.  
  1345.     ' Break multiple up into shapes
  1346.     split MyString, Chr$(13), arrLines()
  1347.     sLine = arrLines(LBound(arrLines))
  1348.     iLen = Len(sLine)
  1349.     sLine = Replace$(sLine, " ", "")
  1350.     iCount = (iLen - Len(sLine)) + 1
  1351.     For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1352.         If Len(arrLines(iLoopRows)) > 0 Then
  1353.             split arrLines(iLoopRows), " ", arrCols()
  1354.             iShapeCount = 0
  1355.             For iLoopCols = LBound(arrCols) To UBound(arrCols)
  1356.                 If Len(arrCols(iLoopCols)) > 0 Then
  1357.                     iShapeCount = iShapeCount + 1
  1358.                     If UBound(arrShapes1) < iShapeCount Then
  1359.                         ReDim _Preserve arrShapes1(0 To iShapeCount)
  1360.                     End If
  1361.                     arrShapes1(iShapeCount) = arrShapes1(iShapeCount) + arrCols(iLoopCols) + Chr$(13)
  1362.                 End If
  1363.             Next iLoopCols
  1364.         End If
  1365.     Next iLoopRows
  1366. End Sub ' BreakMultipleIntoShapes
  1367.  
  1368. ' /////////////////////////////////////////////////////////////////////////////
  1369.  
  1370. Sub BreakMultipleIntoShapesTest
  1371.     Dim in$
  1372.     Dim MyString As String
  1373.     ReDim arrShapes1(-1) As String
  1374.     Dim iLoop As Integer
  1375.  
  1376.     ' Test data
  1377.     MyString = ""
  1378.     MyString = MyString + "######## #.#.#.#. ####.... ...##... ######## ........ ........ 2222.... 22..22.. ...22..." + Chr$(13)
  1379.     MyString = MyString + "######## .#.#.#.# ####.... ...##... #......# .2222222 ........ 2222.... 22..22.. ...22..." + Chr$(13)
  1380.     MyString = MyString + "######## #.#.#.#. ####.... ...##... #......# .2222222 ........ 2222.... ..22..22 ...22..." + Chr$(13)
  1381.     MyString = MyString + "######## .#.#.#.#.####.... ######## #......# .2222222 ........ 2222.... ..22..22 ...22222" + Chr$(13)
  1382.     MyString = MyString + "######## #.#.#.#. ....#### ######## #......# .2222222 ........ 2222.... 22..22.. ...22222" + Chr$(13)
  1383.     MyString = MyString + "######## .#.#.#.# ....#### ...##... #......# .2222222 ........ 2222.... 22..22.. ........" + Chr$(13)
  1384.     MyString = MyString + "######## #.#.#.#. ....#### ...##... #......# .2222222 ........ 2222.... ..22..22 ........" + Chr$(13)
  1385.     MyString = MyString + "######## .#.#.#.# ....#### ...##... ######## .2222222 ........ 2222.... ..22..22 ........"
  1386.  
  1387.     ' Break up
  1388.     BreakMultipleIntoShapes MyString, arrShapes1()
  1389.  
  1390.     ' Show Results
  1391.     For iLoop = LBound(arrShapes1) To UBound(arrShapes1)
  1392.         Print "arrShapes1(" + cstr$(iLoop) + "):"
  1393.         Print arrShapes1(iLoop)
  1394.         Print
  1395.         Input "PRESS <ENTER> TO CONTINUE"; in$
  1396.     Next iLoop
  1397.  
  1398. End Sub ' BreakMultipleIntoShapesTest
  1399.  
  1400. ' /////////////////////////////////////////////////////////////////////////////
  1401. ' GENERATES SEMI-OPTIMIZED VECTOR DRAWING ROUTINES USING Line COMMANDS
  1402. ' FOR ONE OR MORE 8X8 TILES.
  1403.  
  1404. ' TODO: Optimize for each shape by determining how to draw it with the
  1405. '       minimum number of line commands.
  1406.  
  1407. Sub GenerateNextVectorTileCode (MyString As String, sNameList As String)
  1408.     Dim RoutineName As String: RoutineName = "GenerateNextVectorTileCode"
  1409.     Dim sError As String: sError = ""
  1410.     ReDim arrShapes1(-1) As String
  1411.     ReDim arrLines(-1) As String
  1412.     ReDim arrCols(-1) As String
  1413.     ReDim arrCount(-1) As String
  1414.     ReDim arrLenCountHZ(-1) As Integer
  1415.     ReDim arrLenCountVT(-1) As Integer
  1416.     ReDim arrNextShape(-1, -1) As String
  1417.     ReDim arrNames(-1) As String
  1418.     Dim sLine As String
  1419.     Dim iLen As Integer
  1420.     Dim iCount As Integer
  1421.     Dim in$
  1422.     Dim iLoopRows As Integer
  1423.     Dim iLoopCols As Integer
  1424.     Dim iShapeCount As Integer
  1425.     Dim iLoopShape As Integer
  1426.     ReDim arrColSize As Integer
  1427.     ReDim arrRowSize As Integer
  1428.     Dim iCountHZ As Integer
  1429.     Dim iCountVT As Integer
  1430.     Dim iLoopCount As Integer
  1431.     Dim sTransposed As String
  1432.     Dim iColumnCount As Integer
  1433.     Dim iRowCount As Integer
  1434.     Dim iScoreHZ As Integer
  1435.     Dim iScoreVT As Integer
  1436.     Dim iRow As Integer
  1437.     Dim iX1 As Integer
  1438.     Dim iX2 As Integer
  1439.     Dim iY1 As Integer
  1440.     Dim iY2 As Integer
  1441.     Dim iLast As Integer
  1442.     Dim sTemplate1 As String
  1443.     Dim sTemplate2 As String
  1444.     Dim sShapeCode As String
  1445.     Dim sLineCommands As String
  1446.     Dim iTotalCount As Integer: iTotalCount = 0
  1447.     Dim sNextShapeComment As String
  1448.  
  1449.     ' Initialize screen
  1450.     If Len(sError) = 0 Then
  1451.         Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  1452.     End If
  1453.  
  1454.     ' Initialize template
  1455.     If Len(sError) = 0 Then
  1456.         ' Template for code for a shape routine:
  1457.         sTemplate1 = "" + _
  1458.             "' /////////////////////////////////////////////////////////////////////////////" + chr$(13) + _
  1459.             "' Draw this shape with Line commands:" + chr$(13) + _
  1460.             "{shape comments}" + _
  1461.             "Sub {name}(iX As Integer, iY As Integer, fgColor As _UNSIGNED Long)" + chr$(13) + _
  1462.             "    ' {comment}" + chr$(13) + _
  1463.             "{line commands}" + _
  1464.             "End Sub ' {name}" + chr$(13) + _
  1465.             chr$(13) + ""
  1466.  
  1467.         ' Template for what replaces "{line commands}":
  1468.         sTemplate2 = "    Line ({x1}, {y1})-({x2}, {y2}), fgColor" + Chr$(13)
  1469.     End If
  1470.  
  1471.     ' Break multiple up into shapes
  1472.     If Len(sError) = 0 Then
  1473.         split MyString, Chr$(13), arrLines()
  1474.         sLine = arrLines(LBound(arrLines))
  1475.         iLen = Len(sLine)
  1476.         sLine = Replace$(sLine, " ", "")
  1477.         iCount = (iLen - Len(sLine)) + 1
  1478.         For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1479.             If Len(arrLines(iLoopRows)) > 0 Then
  1480.                 split arrLines(iLoopRows), " ", arrCols()
  1481.                 iShapeCount = 0
  1482.  
  1483.                 For iLoopCols = LBound(arrCols) To UBound(arrCols)
  1484.                     If Len(arrCols(iLoopCols)) > 0 Then
  1485.                         iShapeCount = iShapeCount + 1
  1486.  
  1487.                         If UBound(arrShapes1) < iShapeCount Then
  1488.                             ReDim _Preserve arrShapes1(0 To iShapeCount)
  1489.                         End If
  1490.  
  1491.                         arrShapes1(iShapeCount) = arrShapes1(iShapeCount) + arrCols(iLoopCols) + Chr$(13)
  1492.                     End If
  1493.                 Next iLoopCols
  1494.             End If
  1495.         Next iLoopRows
  1496.     End If
  1497.  
  1498.     ' Get names
  1499.     If Len(sError) = 0 Then
  1500.         split sNameList, ",", arrNames()
  1501.         If (UBound(arrNames) + 1 < iShapeCount) Then
  1502.             sError = "Not enough names in sNameList." + chr$(13) + _
  1503.                 "Detected " + cstr$( ubound(arrNames)+1 ) + "names in " + chr$(13) + _
  1504.                 "sNameList " + chr$(34) + sNameList + chr$(34) + chr$(13) + _
  1505.                 "and " + cstr$(iShapeCount) + " shapes."
  1506.         End If
  1507.     End If
  1508.  
  1509.     ' Process shapes and generate line drawing routines
  1510.     If Len(sError) = 0 Then
  1511.         For iLoopShape = 1 To iShapeCount
  1512.             Cls
  1513.             Print "Shape #" + cstr$(iLoopShape)
  1514.             Print arrShapes1(iLoopShape)
  1515.  
  1516.             ' Count rows/columns and create comment showing the shape
  1517.             iRowCount = 0
  1518.             iColumnCount = 0
  1519.             sNextShapeComment = ""
  1520.             split arrShapes1(iLoopShape), Chr$(13), arrLines()
  1521.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1522.                 If Len(arrLines(iLoopRows)) > 0 Then
  1523.                     sNextShapeComment = sNextShapeComment + "' " + _Trim$(arrLines(iLoopRows)) + Chr$(13)
  1524.                     iRowCount = iRowCount + 1
  1525.                     iLen = Len(_Trim$(arrLines(iLoopRows)))
  1526.                     If iLen > iColumnCount Then
  1527.                         iColumnCount = iLen
  1528.                     End If
  1529.                 End If
  1530.             Next iLoopRows
  1531.             ReDim arrLenCountHZ(1 To iColumnCount) As Integer
  1532.             ReDim arrLenCountVT(1 To iRowCount) As Integer
  1533.             Print "iRowCount   =" + cstr$(iRowCount)
  1534.             Print "iColumnCount=" + cstr$(iColumnCount)
  1535.             ReDim arrNextShape(iRowCount, iColumnCount) As String
  1536.  
  1537.             ' Count consecutive horizontal
  1538.             iCountHZ = 0
  1539.             Print "lbound(arrLines)=" + cstr$(LBound(arrLines))
  1540.             Print "ubound(arrLines)=" + cstr$(UBound(arrLines))
  1541.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1542.                 If Len(arrLines(iLoopRows)) > 0 Then
  1543.                     split arrLines(iLoopRows), ".", arrCount()
  1544.                     For iLoopCount = LBound(arrCount) To UBound(arrCount)
  1545.                         iLen = Len(_Trim$(arrCount(iLoopCount)))
  1546.                         arrLenCountHZ(iLen) = arrLenCountHZ(iLen) + 1
  1547.                         If iLen > 0 Then
  1548.                             iCountHZ = iCountHZ + 1
  1549.                         End If
  1550.                     Next iLoopCount
  1551.                 End If
  1552.             Next iLoopRows
  1553.             Print "iCountHZ = " + cstr$(iCountHZ)
  1554.  
  1555.             ' Transpose to count vertical and create 2D array
  1556.             sTransposed = ""
  1557.             iCount = 0
  1558.             ReDim arrCols(iColumnCount) As String
  1559.             iRow = 0
  1560.             For iLoopRows = LBound(arrLines) To UBound(arrLines)
  1561.                 If Len(arrLines(iLoopRows)) > 0 Then
  1562.                     iRow = iRow + 1
  1563.                     For iLoopCols = 1 To Len(arrLines(iLoopRows))
  1564.                         arrCols(iLoopCols) = arrCols(iLoopCols) + Mid$(arrLines(iLoopRows), iLoopCols, 1)
  1565.                         arrNextShape(iRow, iLoopCols) = Mid$(arrLines(iLoopRows), iLoopCols, 1)
  1566.                     Next iLoopCols
  1567.                 End If
  1568.             Next iLoopRows
  1569.             For iLoopCols = LBound(arrCols) To UBound(arrCols)
  1570.                 sTransposed = sTransposed + arrCols(iLoopCols) + Chr$(13)
  1571.             Next iLoopCols
  1572.             'print "Transposed:"
  1573.             'print sTransposed
  1574.  
  1575.             ' Count consecutive vertical
  1576.             iCountVT = 0
  1577.             For iLoopRows = LBound(arrCols) To UBound(arrCols)
  1578.                 If Len(arrCols(iLoopRows)) > 0 Then
  1579.                     split arrCols(iLoopRows), ".", arrCount()
  1580.                     For iLoopCount = LBound(arrCount) To UBound(arrCount)
  1581.                         iLen = Len(_Trim$(arrCount(iLoopCount)))
  1582.                         arrLenCountVT(iLen) = arrLenCountVT(iLen) + 1
  1583.                         If iLen > 0 Then
  1584.                             iCountVT = iCountVT + 1
  1585.                         End If
  1586.                     Next iLoopCount
  1587.                 End If
  1588.             Next iLoopRows
  1589.  
  1590.             ' Weigh horizontal vs vertical
  1591.             iScoreHZ = 0
  1592.             sLine = ""
  1593.             For iCount = 1 To iColumnCount
  1594.                 If iCount > 1 Then sLine = sLine + ", "
  1595.                 sLine = sLine + cstr$(iCount) + "=" + cstr$(arrLenCountHZ(iCount))
  1596.                 iScoreHZ = iScoreHZ + (iCount * arrLenCountHZ(iCount))
  1597.             Next iCount
  1598.             Print "Horizontal count: " + sLine
  1599.             Print "Horizontal total: " + cstr$(iCountHZ)
  1600.             Print "Horizontal miles: " + cstr$(iScoreHZ)
  1601.  
  1602.             iScoreVT = 0
  1603.             sLine = ""
  1604.             For iCount = 1 To iRowCount
  1605.                 If iCount > 1 Then sLine = sLine + ", "
  1606.                 sLine = sLine + cstr$(iCount) + "=" + cstr$(arrLenCountVT(iCount))
  1607.                 iScoreVT = iScoreVT + (iCount * arrLenCountVT(iCount))
  1608.             Next iCount
  1609.             Print "Vertical   count: " + sLine
  1610.             Print "Vertical   total: " + cstr$(iCountVT)
  1611.             Print "Vertical   miles: " + cstr$(iScoreVT)
  1612.  
  1613.             '' Verify break up into array
  1614.             'print "REGURGITATED 2D:"
  1615.             'for iLoopRows = lbound(arrNextShape, 1) to ubound(arrNextShape, 1)
  1616.             '    sLine = ""
  1617.             '    for iLoopCols = lbound(arrNextShape, 2) to ubound(arrNextShape, 2)
  1618.             '        sLine = sLine + arrNextShape(iLoopRows, iLoopCols)
  1619.             '    next iLoopCols
  1620.             '    print sLine
  1621.             'next iLoopRows
  1622.  
  1623.             ' DID WE FIND ANYTHING TO DRAW?
  1624.             If iCountVT > 0 And iCountHZ > 0 Then
  1625.  
  1626.                 ' INTIALIZE TEMPLATE FOR NEXT SHAPE
  1627.                 'sTemplate1: {name} {comment} {line commands}
  1628.                 sShapeCode = sTemplate1
  1629.                 sShapeCode = Replace$(sShapeCode, "{name}", arrNames(iLoopShape - 1))
  1630.                 sShapeCode = Replace$(sShapeCode, "{shape comments}", sNextShapeComment)
  1631.                 sLineCommands = ""
  1632.  
  1633.                 ' More consecutive horizontal or vertical?
  1634.                 If iCountVT < iCountHZ Then
  1635.  
  1636.                     ' ADD A COMMENT THAT THIS ROUTINE USES VERTICAL LINES
  1637.                     'sTemplate1: {name} {comment} {line commands}
  1638.                     sShapeCode = Replace$(sShapeCode, "{comment}", "DRAW WITH VERTICAL LINES")
  1639.  
  1640.                     ' LOOK AT SHAPE COLUMN BY COLUMN
  1641.                     For iLoopCols = LBound(arrNextShape, 2) To UBound(arrNextShape, 2)
  1642.                         iX1 = iLoopCols
  1643.                         iX2 = iLoopCols
  1644.                         iY1 = -1
  1645.                         iY2 = -1
  1646.  
  1647.                         ' LOOK AT SHAPE ROW BY ROW
  1648.                         For iLoopRows = LBound(arrNextShape, 1) To UBound(arrNextShape, 1)
  1649.  
  1650.                             ' PIXEL HERE...
  1651.                             If arrNextShape(iLoopRows, iLoopCols) = "#" Then
  1652.                                 ' ARE WE CURRENTLY IN A LINE?
  1653.                                 If iY1 = -1 Then
  1654.                                     ' NO, START A NEW LINE
  1655.                                     ' Remember this as the starting point
  1656.                                     iY1 = iLoopRows
  1657.                                 End If
  1658.  
  1659.                                 ' Remember the most recent point
  1660.                                 iLast = iLoopRows
  1661.  
  1662.                                 ' NO PIXEL HERE...
  1663.                             Else
  1664.                                 ' ARE WE CURRENTLY IN A LINE?
  1665.                                 If iY1 <> -1 Then
  1666.                                     ' Use the most recent point as the end point
  1667.                                     iY2 = iLast
  1668.  
  1669.                                     ' GENERATE THE NEXT LINE COMMAND
  1670.                                     'sTemplate1: {name} {comment} {line commands}
  1671.                                     'sTemplate2: {x1} {y1} {x2} {y2}
  1672.                                     'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1673.                                     sLine = sTemplate2
  1674.  
  1675.                                     If iX1 = 1 Then
  1676.                                         sLine = Replace$(sLine, "{x1}", "iX")
  1677.                                     Else
  1678.                                         sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1679.                                     End If
  1680.  
  1681.                                     If iY1 = 1 Then
  1682.                                         sLine = Replace$(sLine, "{y1}", "iY")
  1683.                                     Else
  1684.                                         sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1685.                                     End If
  1686.  
  1687.                                     If iX2 = 1 Then
  1688.                                         sLine = Replace$(sLine, "{x2}", "iX")
  1689.                                     Else
  1690.                                         sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1691.                                     End If
  1692.  
  1693.                                     If iY2 = 1 Then
  1694.                                         sLine = Replace$(sLine, "{y2}", "iY")
  1695.                                     Else
  1696.                                         sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1697.                                     End If
  1698.  
  1699.                                     ' SAVE THE COMMAND TO BE ADDED
  1700.                                     sLineCommands = sLineCommands + sLine
  1701.  
  1702.                                     ' RESET (NO LONGER IN A LINE)
  1703.                                     iY1 = -1
  1704.                                 End If
  1705.                             End If
  1706.                         Next iLoopRows
  1707.  
  1708.                         ' AND CHECK AGAIN AT THE END
  1709.                         ' ARE WE CURRENTLY IN A LINE?
  1710.                         If iY1 <> -1 Then
  1711.                             ' Use the most recent point as the end point
  1712.                             iY2 = iLast
  1713.  
  1714.                             ' GENERATE THE NEXT LINE COMMAND
  1715.                             'sTemplate1: {name} {comment} {line commands}
  1716.                             'sTemplate2: {x1} {y1} {x2} {y2}
  1717.                             'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1718.                             sLine = sTemplate2
  1719.  
  1720.                             If iX1 = 1 Then
  1721.                                 sLine = Replace$(sLine, "{x1}", "iX")
  1722.                             Else
  1723.                                 sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1724.                             End If
  1725.  
  1726.                             If iY1 = 1 Then
  1727.                                 sLine = Replace$(sLine, "{y1}", "iY")
  1728.                             Else
  1729.                                 sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1730.                             End If
  1731.  
  1732.                             If iX2 = 1 Then
  1733.                                 sLine = Replace$(sLine, "{x2}", "iX")
  1734.                             Else
  1735.                                 sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1736.                             End If
  1737.  
  1738.                             If iY2 = 1 Then
  1739.                                 sLine = Replace$(sLine, "{y2}", "iY")
  1740.                             Else
  1741.                                 sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1742.                             End If
  1743.  
  1744.                             ' SAVE THE COMMAND TO BE ADDED
  1745.                             sLineCommands = sLineCommands + sLine
  1746.  
  1747.                             ' RESET (NO LONGER IN A LINE)
  1748.                             iY1 = -1
  1749.                         End If
  1750.                     Next iLoopCols
  1751.  
  1752.                     ' ADD THE LINE COMMANDS TO THE CURRENT SHAPE'S DRAW ROUTINE
  1753.                     sShapeCode = Replace$(sShapeCode, "{line commands}", sLineCommands)
  1754.  
  1755.                     ' OUTPUT IT
  1756.                     iTotalCount = iTotalCount + 1
  1757.                     DebugPrint sShapeCode
  1758.  
  1759.                 Else
  1760.                     ' ADD A COMMENT THAT THIS ROUTINE USES HORIZONTAL LINES
  1761.                     'sTemplate1: {name} {comment} {line commands}
  1762.                     sShapeCode = Replace$(sShapeCode, "{comment}", "DRAW WITH HORIZONTAL LINES")
  1763.  
  1764.                     ' LOOK AT SHAPE ROW BY ROW
  1765.                     For iLoopRows = LBound(arrNextShape, 1) To UBound(arrNextShape, 1)
  1766.                         iX1 = -1
  1767.                         iX2 = -1
  1768.                         iY1 = iLoopRows
  1769.                         iY2 = iLoopRows
  1770.  
  1771.                         ' LOOK AT SHAPE COLUMN BY COLUMN
  1772.                         For iLoopCols = LBound(arrNextShape, 2) To UBound(arrNextShape, 2)
  1773.  
  1774.                             ' PIXEL HERE...
  1775.                             If arrNextShape(iLoopRows, iLoopCols) = "#" Then
  1776.                                 ' ARE WE CURRENTLY IN A LINE?
  1777.                                 If iX1 = -1 Then
  1778.                                     ' NO, START A NEW LINE
  1779.                                     ' Remember this as the starting point
  1780.                                     iX1 = iLoopCols
  1781.                                 End If
  1782.  
  1783.                                 ' Remember the most recent point
  1784.                                 iLast = iLoopCols
  1785.  
  1786.                                 ' NO PIXEL HERE...
  1787.                             Else
  1788.                                 ' ARE WE CURRENTLY IN A LINE?
  1789.                                 If iX1 <> -1 Then
  1790.                                     ' Use the most recent point as the end point
  1791.                                     iX2 = iLast
  1792.  
  1793.                                     ' GENERATE THE NEXT LINE COMMAND
  1794.                                     'sTemplate1: {name} {comment} {line commands}
  1795.                                     'sTemplate2: {x1} {y1} {x2} {y2}
  1796.                                     'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1797.                                     sLine = sTemplate2
  1798.  
  1799.                                     If iX1 = 1 Then
  1800.                                         sLine = Replace$(sLine, "{x1}", "iX")
  1801.                                     Else
  1802.                                         sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1803.                                     End If
  1804.  
  1805.                                     If iY1 = 1 Then
  1806.                                         sLine = Replace$(sLine, "{y1}", "iY")
  1807.                                     Else
  1808.                                         sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1809.                                     End If
  1810.  
  1811.                                     If iX2 = 1 Then
  1812.                                         sLine = Replace$(sLine, "{x2}", "iX")
  1813.                                     Else
  1814.                                         sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1815.                                     End If
  1816.  
  1817.                                     If iY2 = 1 Then
  1818.                                         sLine = Replace$(sLine, "{y2}", "iY")
  1819.                                     Else
  1820.                                         sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1821.                                     End If
  1822.  
  1823.                                     ' SAVE THE COMMAND TO BE ADDED
  1824.                                     sLineCommands = sLineCommands + sLine
  1825.  
  1826.                                     ' RESET (NO LONGER IN A LINE)
  1827.                                     iX1 = -1
  1828.                                 End If
  1829.                             End If
  1830.                         Next iLoopCols
  1831.  
  1832.                         ' AND CHECK AGAIN AT THE END
  1833.                         ' ARE WE CURRENTLY IN A LINE?
  1834.                         If iX1 <> -1 Then
  1835.                             ' Use the most recent point as the end point
  1836.                             iX2 = iLast
  1837.  
  1838.                             ' GENERATE THE NEXT LINE COMMAND
  1839.                             'sTemplate1: {name} {comment} {line commands}
  1840.                             'sTemplate2: {x1} {y1} {x2} {y2}
  1841.                             'sTemplate2 = sTemplate2 + "    Line (iX+4, iY+1)-(iX+4, iY+2), fgColor" + chr$(13)
  1842.                             sLine = sTemplate2
  1843.  
  1844.                             If iX1 = 1 Then
  1845.                                 sLine = Replace$(sLine, "{x1}", "iX")
  1846.                             Else
  1847.                                 sLine = Replace$(sLine, "{x1}", "iX + " + cstr$(iX1 - 1))
  1848.                             End If
  1849.  
  1850.                             If iY1 = 1 Then
  1851.                                 sLine = Replace$(sLine, "{y1}", "iY")
  1852.                             Else
  1853.                                 sLine = Replace$(sLine, "{y1}", "iY + " + cstr$(iY1 - 1))
  1854.                             End If
  1855.  
  1856.                             If iX2 = 1 Then
  1857.                                 sLine = Replace$(sLine, "{x2}", "iX")
  1858.                             Else
  1859.                                 sLine = Replace$(sLine, "{x2}", "iX + " + cstr$(iX2 - 1))
  1860.                             End If
  1861.  
  1862.                             If iY2 = 1 Then
  1863.                                 sLine = Replace$(sLine, "{y2}", "iY")
  1864.                             Else
  1865.                                 sLine = Replace$(sLine, "{y2}", "iY + " + cstr$(iY2 - 1))
  1866.                             End If
  1867.  
  1868.                             ' SAVE THE COMMAND TO BE ADDED
  1869.                             sLineCommands = sLineCommands + sLine
  1870.  
  1871.                             ' RESET (NO LONGER IN A LINE)
  1872.                             iX1 = -1
  1873.                         End If
  1874.                     Next iLoopRows
  1875.  
  1876.                     ' ADD THE LINE COMMANDS TO THE CURRENT SHAPE'S DRAW ROUTINE
  1877.                     sShapeCode = Replace$(sShapeCode, "{line commands}", sLineCommands)
  1878.  
  1879.                     ' OUTPUT IT
  1880.                     iTotalCount = iTotalCount + 1
  1881.                     DebugPrint sShapeCode
  1882.                 End If
  1883.             End If
  1884.  
  1885.             ' DONE
  1886.             Print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  1887.             Print sShapeCode
  1888.             Print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  1889.             'Input "PRESS <ENTER> TO CONTINUE";in$
  1890.         Next iLoopShape
  1891.     End If
  1892.  
  1893.     ' SHOW RESULTS
  1894.     If Len(sError) = 0 Then
  1895.         Print "Generated " + cstr$(iTotalCount) + " shape routines."
  1896.     Else
  1897.         Print RoutineName + " failed:"
  1898.         Print sError
  1899.     End If
  1900.     'Input "PRESS <ENTER> TO CONTINUE";in$
  1901.  
  1902.     Screen 0
  1903. End Sub ' GenerateNextVectorTileCode
  1904.  
  1905. ' /////////////////////////////////////////////////////////////////////////////
  1906. ' Defines various 8x8 tiles and calls GenerateNextVectorTileCode to generate vector
  1907. ' Line routines to draw each one.
  1908.  
  1909. Sub GenerateVectorTileCode ()
  1910.     Dim MyString As String
  1911.     Dim sNameList As String
  1912.     Dim in$
  1913.  
  1914.     MyString = ""
  1915.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1916.     MyString = MyString + "...#.... ........ ........ ........ ...#.... ...#...." + Chr$(13)
  1917.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1918.     MyString = MyString + "...#.... #.#.#.#. ...##.#. #.##.... ...##.#. #.##...." + Chr$(13)
  1919.     MyString = MyString + "........ ........ ...#.... ...#.... ........ ........" + Chr$(13)
  1920.     MyString = MyString + "...#.... ........ ........ ........ ........ ........" + Chr$(13)
  1921.     MyString = MyString + "........ ........ ...#.... ...#.... ........ ........" + Chr$(13)
  1922.     MyString = MyString + "...#.... ........ ........ ........ ........ ........"
  1923.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  1924.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  1925.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  1926.     sNameList = Replace$(sNameList, "{n}", "1")
  1927.     GenerateNextVectorTileCode MyString, sNameList
  1928.  
  1929.     MyString = ""
  1930.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1931.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  1932.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1933.     MyString = MyString + "...##... #.#.#.#. ...##.#. #.#.#... ...##.#. #.#.#..." + Chr$(13)
  1934.     MyString = MyString + "........ #.#.#.#. ...##.#. #.#.#... ...##.#. #.#.#..." + Chr$(13)
  1935.     MyString = MyString + "...##... ........ ........ ........ ........ ........" + Chr$(13)
  1936.     MyString = MyString + "........ ........ ...##... ...##... ........ ........" + Chr$(13)
  1937.     MyString = MyString + "...##... ........ ........ ........ ........ ........"
  1938.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  1939.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  1940.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  1941.     sNameList = Replace$(sNameList, "{n}", "2")
  1942.     GenerateNextVectorTileCode MyString, sNameList
  1943.  
  1944.     MyString = ""
  1945.     MyString = MyString + "........ ........ ........ ........ ........ ........" + Chr$(13)
  1946.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  1947.     MyString = MyString + "...##... ........ ........ ........ ...##... ...##..." + Chr$(13)
  1948.     MyString = MyString + "........ .##..##. .....##. .##..... .....##. .##....." + Chr$(13)
  1949.     MyString = MyString + "........ .##..##. .....##. .##..... .....##. .##....." + Chr$(13)
  1950.     MyString = MyString + "...##... ........ ...##... ...##... ........ ........" + Chr$(13)
  1951.     MyString = MyString + "...##... ........ ...##... ...##... ........ ........" + Chr$(13)
  1952.     MyString = MyString + "........ ........ ........ ........ ........ ........"
  1953.     sNameList = "DrawHomeLine8x8_VT_{n},DrawHomeLine8x8_HZ_{n}," + _
  1954.         "DrawHomeLine8x8_NW_{n},DrawHomeLine8x8_NE_{n}," + _
  1955.         "DrawHomeLine8x8_SW_{n},DrawHomeLine8x8_SE_{n}"
  1956.     sNameList = Replace$(sNameList, "{n}", "3")
  1957.     GenerateNextVectorTileCode MyString, sNameList
  1958.  
  1959.     MyString = ""
  1960.     MyString = MyString + "##..##.. #.#.#.#. ######## ######## #######. ...##... ...#...#" + Chr$(13)
  1961.     MyString = MyString + "##..##.. #.#.#.#. ######## ........ #.#.#.#. ...##... ...#...#" + Chr$(13)
  1962.     MyString = MyString + "##..##.. #.#.#.#. ........ ######## #######. ...##... ...#...#" + Chr$(13)
  1963.     MyString = MyString + "##..##.. #.#.#.#. ........ ........ #.#.#.#. ######## ########" + Chr$(13)
  1964.     MyString = MyString + "##..##.. #.#.#.#. ######## ######## #######. ######## ...#...#" + Chr$(13)
  1965.     MyString = MyString + "##..##.. #.#.#.#. ######## ........ #.#.#.#. ...##... ...#...#" + Chr$(13)
  1966.     MyString = MyString + "##..##.. #.#.#.#. ........ ######## #######. ...##... ...#...#" + Chr$(13)
  1967.     MyString = MyString + "##..##.. #.#.#.#. ........ ........ #.#.#.#. ...##... ########"
  1968.     sNameList = "DrawJailLine8x8_VT_2,DrawJailLine8x8_VT_1," + _
  1969.         "DrawJailLine8x8_HZ_2,DrawJailLine8x8_HZ_1," + _
  1970.         "DrawJailLine8x8_Grid_1,DrawJailLine8x8_Grid_3," + _
  1971.         "DrawJailLine8x8_Grid_2"
  1972.     GenerateNextVectorTileCode MyString, sNameList
  1973.     Print
  1974.     Print "See console window for generated code."
  1975.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1976. End Sub ' GenerateVectorTileCode
  1977.  
  1978. ' ################################################################################################################################################################
  1979. ' END GENERATE LINE DRAWING SHAPE ROUTINES
  1980. ' ################################################################################################################################################################
  1981.  
  1982. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1983. ' BEGIN GENERATED VECTOR TILE ROUTINES
  1984. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1985.  
  1986. ' /////////////////////////////////////////////////////////////////////////////
  1987. ' Draw this shape with Line commands:
  1988. ' ........
  1989. ' ...#....
  1990. ' ........
  1991. ' ...#....
  1992. ' ........
  1993. ' ...#....
  1994. ' ........
  1995. ' ...#....
  1996. Sub DrawHomeLine8x8_VT_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  1997.     ' DRAW WITH HORIZONTAL LINES
  1998.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  1999.     Line (iX + 3, iY + 3)-(iX + 3, iY + 3), fgColor
  2000.     Line (iX + 3, iY + 5)-(iX + 3, iY + 5), fgColor
  2001.     Line (iX + 3, iY + 7)-(iX + 3, iY + 7), fgColor
  2002. End Sub ' DrawHomeLine8x8_VT_1
  2003.  
  2004. ' /////////////////////////////////////////////////////////////////////////////
  2005. ' Draw this shape with Line commands:
  2006. ' ........
  2007. ' ........
  2008. ' ........
  2009. ' #.#.#.#.
  2010. ' ........
  2011. ' ........
  2012. ' ........
  2013. ' ........
  2014. Sub DrawHomeLine8x8_HZ_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2015.     ' DRAW WITH HORIZONTAL LINES
  2016.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  2017.     Line (iX + 2, iY + 3)-(iX + 2, iY + 3), fgColor
  2018.     Line (iX + 4, iY + 3)-(iX + 4, iY + 3), fgColor
  2019.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  2020. End Sub ' DrawHomeLine8x8_HZ_1
  2021.  
  2022. ' /////////////////////////////////////////////////////////////////////////////
  2023. ' Draw this shape with Line commands:
  2024. ' ........
  2025. ' ........
  2026. ' ........
  2027. ' ...##.#.
  2028. ' ...#....
  2029. ' ........
  2030. ' ...#....
  2031. ' ........
  2032. Sub DrawHomeLine8x8_NW_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2033.     ' DRAW WITH HORIZONTAL LINES
  2034.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2035.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  2036.     Line (iX + 3, iY + 4)-(iX + 3, iY + 4), fgColor
  2037.     Line (iX + 3, iY + 6)-(iX + 3, iY + 6), fgColor
  2038. End Sub ' DrawHomeLine8x8_NW_1
  2039.  
  2040. ' /////////////////////////////////////////////////////////////////////////////
  2041. ' Draw this shape with Line commands:
  2042. ' ........
  2043. ' ........
  2044. ' ........
  2045. ' #.##....
  2046. ' ...#....
  2047. ' ........
  2048. ' ...#....
  2049. ' ........
  2050. Sub DrawHomeLine8x8_NE_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2051.     ' DRAW WITH HORIZONTAL LINES
  2052.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  2053.     Line (iX + 2, iY + 3)-(iX + 3, iY + 3), fgColor
  2054.     Line (iX + 3, iY + 4)-(iX + 3, iY + 4), fgColor
  2055.     Line (iX + 3, iY + 6)-(iX + 3, iY + 6), fgColor
  2056. End Sub ' DrawHomeLine8x8_NE_1
  2057.  
  2058. ' /////////////////////////////////////////////////////////////////////////////
  2059. ' Draw this shape with Line commands:
  2060. ' ........
  2061. ' ...#....
  2062. ' ........
  2063. ' ...##.#.
  2064. ' ........
  2065. ' ........
  2066. ' ........
  2067. ' ........
  2068. Sub DrawHomeLine8x8_SW_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2069.     ' DRAW WITH HORIZONTAL LINES
  2070.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  2071.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2072.     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  2073. End Sub ' DrawHomeLine8x8_SW_1
  2074.  
  2075. ' /////////////////////////////////////////////////////////////////////////////
  2076. ' Draw this shape with Line commands:
  2077. ' ........
  2078. ' ...#....
  2079. ' ........
  2080. ' #.##....
  2081. ' ........
  2082. ' ........
  2083. ' ........
  2084. ' ........
  2085. Sub DrawHomeLine8x8_SE_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2086.     ' DRAW WITH HORIZONTAL LINES
  2087.     Line (iX + 3, iY + 1)-(iX + 3, iY + 1), fgColor
  2088.     Line (iX, iY + 3)-(iX, iY + 3), fgColor
  2089.     Line (iX + 2, iY + 3)-(iX + 3, iY + 3), fgColor
  2090. End Sub ' DrawHomeLine8x8_SE_1
  2091.  
  2092. ' /////////////////////////////////////////////////////////////////////////////
  2093. ' Draw this shape with Line commands:
  2094. ' ........
  2095. ' ...##...
  2096. ' ........
  2097. ' ...##...
  2098. ' ........
  2099. ' ...##...
  2100. ' ........
  2101. ' ...##...
  2102. Sub DrawHomeLine8x8_VT_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2103.     ' DRAW WITH HORIZONTAL LINES
  2104.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2105.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2106.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2107.     Line (iX + 3, iY + 7)-(iX + 4, iY + 7), fgColor
  2108. End Sub ' DrawHomeLine8x8_VT_2
  2109.  
  2110. ' /////////////////////////////////////////////////////////////////////////////
  2111. ' Draw this shape with Line commands:
  2112. ' ........
  2113. ' ........
  2114. ' ........
  2115. ' #.#.#.#.
  2116. ' #.#.#.#.
  2117. ' ........
  2118. ' ........
  2119. ' ........
  2120. Sub DrawHomeLine8x8_HZ_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2121.     ' DRAW WITH VERTICAL LINES
  2122.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  2123.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  2124.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2125.     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  2126. End Sub ' DrawHomeLine8x8_HZ_2
  2127.  
  2128. ' /////////////////////////////////////////////////////////////////////////////
  2129. ' Draw this shape with Line commands:
  2130. ' ........
  2131. ' ........
  2132. ' ........
  2133. ' ...##.#.
  2134. ' ...##.#.
  2135. ' ........
  2136. ' ...##...
  2137. ' ........
  2138. Sub DrawHomeLine8x8_NW_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2139.     ' DRAW WITH HORIZONTAL LINES
  2140.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2141.     Line (iX + 3, iY + 4)-(iX + 4, iY + 4), fgColor
  2142.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2143.  
  2144.     ' DRAW WITH VERTICAL LINES
  2145.     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  2146. End Sub ' DrawHomeLine8x8_NW_2
  2147.  
  2148. ' /////////////////////////////////////////////////////////////////////////////
  2149. ' Draw this shape with Line commands:
  2150. ' ........
  2151. ' ........
  2152. ' ........
  2153. ' #.#.#...
  2154. ' #.#.#...
  2155. ' ........
  2156. ' ...##...
  2157. ' ........
  2158. Sub DrawHomeLine8x8_NE_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2159.     ' DRAW WITH VERTICAL LINES
  2160.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  2161.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  2162.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2163.  
  2164.     ' DRAW WITH HORIZONTAL LINES
  2165.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2166. End Sub ' DrawHomeLine8x8_NE_2
  2167.  
  2168. ' /////////////////////////////////////////////////////////////////////////////
  2169. ' Draw this shape with Line commands:
  2170. ' ........
  2171. ' ...##...
  2172. ' ........
  2173. ' ...##.#.
  2174. ' ...##.#.
  2175. ' ........
  2176. ' ........
  2177. ' ........
  2178. Sub DrawHomeLine8x8_SW_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2179.     ' DRAW WITH HORIZONTAL LINES
  2180.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2181.     Line (iX + 3, iY + 3)-(iX + 4, iY + 3), fgColor
  2182.     Line (iX + 3, iY + 4)-(iX + 4, iY + 4), fgColor
  2183.  
  2184.     ' DRAW WITH VERTICAL LINES
  2185.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2186. End Sub ' DrawHomeLine8x8_SW_2
  2187.  
  2188. ' /////////////////////////////////////////////////////////////////////////////
  2189. ' Draw this shape with Line commands:
  2190. ' ........
  2191. ' ...##...
  2192. ' ........
  2193. ' #.#.#...
  2194. ' #.#.#...
  2195. ' ........
  2196. ' ........
  2197. ' ........
  2198. Sub DrawHomeLine8x8_SE_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2199.     ' DRAW WITH HORIZONTAL LINES
  2200.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2201.  
  2202.     ' DRAW WITH VERTICAL LINES
  2203.     Line (iX, iY + 3)-(iX, iY + 4), fgColor
  2204.     Line (iX + 2, iY + 3)-(iX + 2, iY + 4), fgColor
  2205.     Line (iX + 4, iY + 3)-(iX + 4, iY + 4), fgColor
  2206.  
  2207. End Sub ' DrawHomeLine8x8_SE_2
  2208.  
  2209. ' /////////////////////////////////////////////////////////////////////////////
  2210. ' Draw this shape with Line commands:
  2211. ' ........
  2212. ' ...##...
  2213. ' ...##...
  2214. ' ........
  2215. ' ........
  2216. ' ...##...
  2217. ' ...##...
  2218. ' ........
  2219. Sub DrawHomeLine8x8_VT_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2220.     ' DRAW WITH HORIZONTAL LINES
  2221.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2222.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  2223.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2224.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2225. End Sub ' DrawHomeLine8x8_VT_3
  2226.  
  2227. ' /////////////////////////////////////////////////////////////////////////////
  2228. ' Draw this shape with Line commands:
  2229. ' ........
  2230. ' ........
  2231. ' ........
  2232. ' .##..##.
  2233. ' .##..##.
  2234. ' ........
  2235. ' ........
  2236. ' ........
  2237. Sub DrawHomeLine8x8_HZ_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2238.     ' DRAW WITH HORIZONTAL LINES
  2239.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  2240.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  2241.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  2242.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  2243. End Sub ' DrawHomeLine8x8_HZ_3
  2244.  
  2245. ' /////////////////////////////////////////////////////////////////////////////
  2246. ' Draw this shape with Line commands:
  2247. ' ........
  2248. ' ........
  2249. ' ........
  2250. ' .....##.
  2251. ' .....##.
  2252. ' ...##...
  2253. ' ...##...
  2254. ' ........
  2255. Sub DrawHomeLine8x8_NW_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2256.     ' DRAW WITH HORIZONTAL LINES
  2257.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  2258.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  2259.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2260.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2261. End Sub ' DrawHomeLine8x8_NW_3
  2262.  
  2263. ' /////////////////////////////////////////////////////////////////////////////
  2264. ' Draw this shape with Line commands:
  2265. ' ........
  2266. ' ........
  2267. ' ........
  2268. ' .##.....
  2269. ' .##.....
  2270. ' ...##...
  2271. ' ...##...
  2272. ' ........
  2273. Sub DrawHomeLine8x8_NE_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2274.     ' DRAW WITH HORIZONTAL LINES
  2275.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  2276.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  2277.     Line (iX + 3, iY + 5)-(iX + 4, iY + 5), fgColor
  2278.     Line (iX + 3, iY + 6)-(iX + 4, iY + 6), fgColor
  2279. End Sub ' DrawHomeLine8x8_NE_3
  2280.  
  2281. ' /////////////////////////////////////////////////////////////////////////////
  2282. ' Draw this shape with Line commands:
  2283. ' ........
  2284. ' ...##...
  2285. ' ...##...
  2286. ' .....##.
  2287. ' .....##.
  2288. ' ........
  2289. ' ........
  2290. ' ........
  2291. Sub DrawHomeLine8x8_SW_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2292.     ' DRAW WITH HORIZONTAL LINES
  2293.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2294.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  2295.     Line (iX + 5, iY + 3)-(iX + 6, iY + 3), fgColor
  2296.     Line (iX + 5, iY + 4)-(iX + 6, iY + 4), fgColor
  2297. End Sub ' DrawHomeLine8x8_SW_3
  2298.  
  2299. ' /////////////////////////////////////////////////////////////////////////////
  2300. ' Draw this shape with Line commands:
  2301. ' ........
  2302. ' ...##...
  2303. ' ...##...
  2304. ' .##.....
  2305. ' .##.....
  2306. ' ........
  2307. ' ........
  2308. ' ........
  2309. Sub DrawHomeLine8x8_SE_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2310.     ' DRAW WITH HORIZONTAL LINES
  2311.     Line (iX + 3, iY + 1)-(iX + 4, iY + 1), fgColor
  2312.     Line (iX + 3, iY + 2)-(iX + 4, iY + 2), fgColor
  2313.     Line (iX + 1, iY + 3)-(iX + 2, iY + 3), fgColor
  2314.     Line (iX + 1, iY + 4)-(iX + 2, iY + 4), fgColor
  2315. End Sub ' DrawHomeLine8x8_SE_3
  2316.  
  2317. ' /////////////////////////////////////////////////////////////////////////////
  2318. ' Draw this shape with Line commands:
  2319. ' ##..##..
  2320. ' ##..##..
  2321. ' ##..##..
  2322. ' ##..##..
  2323. ' ##..##..
  2324. ' ##..##..
  2325. ' ##..##..
  2326. ' ##..##..
  2327. Sub DrawJailLine8x8_VT_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2328.     ' DRAW WITH VERTICAL LINES
  2329.     Line (iX, iY)-(iX, iY + 7), fgColor
  2330.     Line (iX + 1, iY)-(iX + 1, iY + 7), fgColor
  2331.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2332.     Line (iX + 5, iY)-(iX + 5, iY + 7), fgColor
  2333. End Sub ' DrawJailLine8x8_VT_2
  2334.  
  2335. ' /////////////////////////////////////////////////////////////////////////////
  2336. ' Draw this shape with Line commands:
  2337. ' #.#.#.#.
  2338. ' #.#.#.#.
  2339. ' #.#.#.#.
  2340. ' #.#.#.#.
  2341. ' #.#.#.#.
  2342. ' #.#.#.#.
  2343. ' #.#.#.#.
  2344. ' #.#.#.#.
  2345. Sub DrawJailLine8x8_VT_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2346.     ' DRAW WITH VERTICAL LINES
  2347.     Line (iX, iY)-(iX, iY + 7), fgColor
  2348.     Line (iX + 2, iY)-(iX + 2, iY + 7), fgColor
  2349.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2350.     Line (iX + 6, iY)-(iX + 6, iY + 7), fgColor
  2351. End Sub ' DrawJailLine8x8_VT_1
  2352.  
  2353. ' /////////////////////////////////////////////////////////////////////////////
  2354. ' Draw this shape with Line commands:
  2355. ' ########
  2356. ' ########
  2357. ' ........
  2358. ' ........
  2359. ' ########
  2360. ' ########
  2361. ' ........
  2362. ' ........
  2363. Sub DrawJailLine8x8_HZ_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2364.     ' DRAW WITH HORIZONTAL LINES
  2365.     Line (iX, iY)-(iX + 7, iY), fgColor
  2366.     Line (iX, iY + 1)-(iX + 7, iY + 1), fgColor
  2367.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2368.     Line (iX, iY + 5)-(iX + 7, iY + 5), fgColor
  2369. End Sub ' DrawJailLine8x8_HZ_2
  2370.  
  2371. ' /////////////////////////////////////////////////////////////////////////////
  2372. ' Draw this shape with Line commands:
  2373. ' ########
  2374. ' ........
  2375. ' ########
  2376. ' ........
  2377. ' ########
  2378. ' ........
  2379. ' ########
  2380. ' ........
  2381. Sub DrawJailLine8x8_HZ_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2382.     ' DRAW WITH HORIZONTAL LINES
  2383.     Line (iX, iY)-(iX + 7, iY), fgColor
  2384.     Line (iX, iY + 2)-(iX + 7, iY + 2), fgColor
  2385.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2386.     Line (iX, iY + 6)-(iX + 7, iY + 6), fgColor
  2387. End Sub ' DrawJailLine8x8_HZ_1
  2388.  
  2389. ' /////////////////////////////////////////////////////////////////////////////
  2390. ' Draw this shape with Line commands:
  2391. ' #######.
  2392. ' #.#.#.#.
  2393. ' #######.
  2394. ' #.#.#.#.
  2395. ' #######.
  2396. ' #.#.#.#.
  2397. ' #######.
  2398. ' #.#.#.#.
  2399. Sub DrawJailLine8x8_Grid_1 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2400.     ' DRAW WITH VERTICAL LINES
  2401.     Line (iX, iY)-(iX, iY + 7), fgColor
  2402.     Line (iX + 2, iY)-(iX + 2, iY + 7), fgColor
  2403.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2404.     Line (iX + 6, iY)-(iX + 6, iY + 7), fgColor
  2405.  
  2406.     ' DRAW WITH HORIZONTAL LINES
  2407.     Line (iX, iY)-(iX + 7, iY), fgColor
  2408.     Line (iX, iY + 2)-(iX + 7, iY + 2), fgColor
  2409.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2410.     Line (iX, iY + 6)-(iX + 7, iY + 6), fgColor
  2411. End Sub ' DrawJailLine8x8_Grid_1
  2412.  
  2413. ' /////////////////////////////////////////////////////////////////////////////
  2414. ' Draw this shape with Line commands:
  2415. ' ...#...#
  2416. ' ...#...#
  2417. ' ...#...#
  2418. ' ########
  2419. ' ...#...#
  2420. ' ...#...#
  2421. ' ...#...#
  2422. ' ########
  2423. Sub DrawJailLine8x8_Grid_2 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2424.     ' DRAW WITH VERTICAL LINES
  2425.     Line (iX + 3, iY)-(iX + 3, iY + 7), fgColor
  2426.     Line (iX + 7, iY)-(iX + 7, iY + 7), fgColor
  2427.     ' DRAW WITH HORIZONTAL LINES
  2428.     Line (iX, iY + 3)-(iX + 7, iY + 3), fgColor
  2429.     Line (iX, iY + 7)-(iX + 7, iY + 7), fgColor
  2430. End Sub ' DrawJailLine8x8_Grid_2
  2431.  
  2432. ' /////////////////////////////////////////////////////////////////////////////
  2433. ' Draw this shape with Line commands:
  2434. ' ...##...
  2435. ' ...##...
  2436. ' ...##...
  2437. ' ########
  2438. ' ########
  2439. ' ...##...
  2440. ' ...##...
  2441. ' ...##...
  2442. Sub DrawJailLine8x8_Grid_3 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2443.     ' DRAW WITH VERTICAL LINES
  2444.     Line (iX + 3, iY)-(iX + 3, iY + 7), fgColor
  2445.     Line (iX + 4, iY)-(iX + 4, iY + 7), fgColor
  2446.     ' DRAW WITH HORIZONTAL LINES
  2447.     Line (iX, iY + 3)-(iX + 7, iY + 3), fgColor
  2448.     Line (iX, iY + 4)-(iX + 7, iY + 4), fgColor
  2449. End Sub ' DrawJailLine8x8_Grid_3
  2450.  
  2451. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2452. ' END GENERATED VECTOR TILE ROUTINES
  2453. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2454.  
  2455. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2456. ' BEGIN MANUALLY CREATED VECTOR TILE ROUTINES
  2457. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2458.  
  2459. ' /////////////////////////////////////////////////////////////////////////////
  2460. ' Fastest!
  2461.  
  2462. Sub DrawUpArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2463.     Dim iStartX As Integer: iStartX = iX + 3
  2464.     Line (iStartX, iY)-(iStartX, iY + 7), fgColor
  2465.     Line (iStartX, iY)-(iX, iY + 3), fgColor
  2466.     Line (iStartX, iY)-(iStartX + 3, iY + 3), fgColor
  2467. End Sub ' DrawUpArrowLine_8x8
  2468.  
  2469. ' /////////////////////////////////////////////////////////////////////////////
  2470. ' Fastest!
  2471.  
  2472. Sub DrawDownArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2473.     Dim iStartX As Integer: iStartX = iX + 3
  2474.     Line (iStartX, iY)-(iStartX, iY + 7), fgColor
  2475.     Line (iStartX, iY + 7)-(iX, iY + 4), fgColor
  2476.     Line (iStartX, iY + 7)-(iStartX + 3, iY + 4), fgColor
  2477. End Sub ' DrawDownArrowLine_8x8
  2478.  
  2479. ' /////////////////////////////////////////////////////////////////////////////
  2480. ' Fastest!
  2481.  
  2482. Sub DrawLeftArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2483.     Dim iStartY As Integer: iStartY = iY + 3
  2484.     Line (iX, iStartY)-(iX + 7, iStartY), fgColor
  2485.     Line (iX, iStartY)-(iX + 3, iY), fgColor
  2486.     Line (iX, iStartY)-(iX + 3, iStartY + 3), fgColor
  2487. End Sub ' DrawLeftArrowLine_8x8
  2488.  
  2489. ' /////////////////////////////////////////////////////////////////////////////
  2490. ' Fastest!
  2491.  
  2492. Sub DrawRightArrowLine_8x8 (iX As Integer, iY As Integer, fgColor As _Unsigned Long)
  2493.     Dim iStartY As Integer: iStartY = iY + 3
  2494.     Line (iX, iStartY)-(iX + 7, iStartY), fgColor
  2495.     Line (iX + 7, iStartY)-(iX + 4, iY), fgColor
  2496.     Line (iX + 7, iStartY)-(iX + 4, iStartY + 3), fgColor
  2497. End Sub ' DrawRightArrowLine_8x8
  2498.  
  2499. ' /////////////////////////////////////////////////////////////////////////////
  2500. ' This uses PSET to draw the arrow pixel-by-pixel
  2501. ' PSET = second fastest method after Line.
  2502.  
  2503. ' PSET (X, Y), Color
  2504. ' draw will start where pset leaves off
  2505.  
  2506. Sub DrawLeftArrowPset_8x8 (iX As Long, iY As Long, fgColor As _Unsigned Long)
  2507.     Dim iLoopX As Integer
  2508.     Dim iLoopY As Integer
  2509.     For iLoopX = iX To iX + 7: PSet (iLoopX, iY), fgColor: Next iLoopX
  2510.     PSet (iX + 1, iY - 1), fgColor
  2511.     PSet (iX + 2, iY - 2), fgColor
  2512.     PSet (iX + 3, iY - 3), fgColor
  2513.     PSet (iX + 1, iY + 1), fgColor
  2514.     PSet (iX + 2, iY + 2), fgColor
  2515.     PSet (iX + 3, iY + 3), fgColor
  2516. End Sub ' DrawLeftArrowPset_8x8
  2517.  
  2518. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2519. ' END MANUALLY CREATED VECTOR TILE ROUTINES
  2520. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2521.  
  2522. ' ################################################################################################################################################################
  2523. ' END MISC GRAPHICS ROUTINES
  2524. ' ################################################################################################################################################################
  2525.  
  2526. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2527. ' BEGIN STRING TO ARRAY FUNCTIONS
  2528. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2529.  
  2530. ' /////////////////////////////////////////////////////////////////////////////
  2531.  
  2532. ' Usage:
  2533. ' Dim StringArray(1 To 48, 1 To 128) As String
  2534. ' StringToArray StringArray(), GetMap$
  2535.  
  2536. ' version 2 with indexed array(row, columm)
  2537.  
  2538. Sub StringToArray (MyArray() As String, MyString As String)
  2539.     Dim sDelim As String
  2540.     ReDim arrLines(0) As String
  2541.     Dim iRow As Integer
  2542.     Dim iCol As Integer
  2543.     Dim sChar As String
  2544.     Dim iDim1 As Integer
  2545.     Dim iDim2 As Integer
  2546.     Dim iIndex1 As Integer
  2547.     Dim iIndex2 As Integer
  2548.  
  2549.     iDim1 = LBound(MyArray, 1)
  2550.     iDim2 = LBound(MyArray, 2)
  2551.     sDelim = Chr$(13)
  2552.     split MyString, sDelim, arrLines()
  2553.     For iRow = LBound(arrLines) To UBound(arrLines)
  2554.         If iRow <= UBound(MyArray, 1) Then
  2555.             For iCol = 1 To Len(arrLines(iRow))
  2556.                 If iCol <= UBound(MyArray, 2) Then
  2557.                     sChar = Mid$(arrLines(iRow), iCol, 1)
  2558.  
  2559.                     If Len(sChar) > 1 Then
  2560.                         sChar = Left$(sChar, 1)
  2561.                     Else
  2562.                         If Len(sChar) = 0 Then
  2563.                             sChar = "."
  2564.                         End If
  2565.                     End If
  2566.  
  2567.                     iIndex1 = iRow + iDim1
  2568.                     iIndex2 = (iCol - 1) + iDim2
  2569.                     MyArray(iIndex1, iIndex2) = sChar
  2570.                     'DebugPrint "MyArray(" + cstr$(iIndex1) + ", " + cstr$(iIndex2) + " = " + chr$(34) + sChar + chr$(34)
  2571.                 Else
  2572.                     ' Exit if out of bounds
  2573.                     Exit For
  2574.                 End If
  2575.             Next iCol
  2576.         Else
  2577.             ' Exit if out of bounds
  2578.             Exit For
  2579.         End If
  2580.     Next iRow
  2581. End Sub ' StringToArray
  2582.  
  2583. ' /////////////////////////////////////////////////////////////////////////////
  2584.  
  2585. Function Array2dToString$ (MyArray() As String)
  2586.     Dim MyString As String
  2587.     Dim iY As Integer
  2588.     Dim iX As Integer
  2589.     Dim sLine As String
  2590.     MyString = ""
  2591.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  2592.         sLine = ""
  2593.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  2594.             sLine = sLine + MyArray(iY, iX)
  2595.         Next iX
  2596.         MyString = MyString + sLine + Chr$(13)
  2597.     Next iY
  2598.     Array2dToString$ = MyString
  2599. End Function ' Array2dToString$
  2600.  
  2601. ' /////////////////////////////////////////////////////////////////////////////
  2602.  
  2603. Function ArrayToString$ (MyArray( 1 To 32 , 1 To 32) As String)
  2604.     Dim MyString As String
  2605.     Dim iY As Integer
  2606.     Dim iX As Integer
  2607.     Dim sLine As String
  2608.     MyString = ""
  2609.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  2610.         sLine = ""
  2611.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  2612.             sLine = sLine + MyArray(iY, iX)
  2613.         Next iX
  2614.         MyString = MyString + sLine + Chr$(13)
  2615.     Next iY
  2616.     ArrayToString$ = MyString
  2617. End Function ' ArrayToString$
  2618.  
  2619. ' /////////////////////////////////////////////////////////////////////////////
  2620.  
  2621. Function ArrayToStringTest$ (MyArray() As String)
  2622.     Dim MyString As String
  2623.     Dim iY As Integer
  2624.     Dim iX As Integer
  2625.     Dim sLine As String
  2626.     MyString = ""
  2627.  
  2628.     MyString = MyString + "           11111111112222222222333" + Chr$(13)
  2629.     MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  2630.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  2631.         sLine = ""
  2632.         sLine = sLine + Right$("  " + cstr$(iY), 2)
  2633.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  2634.             sLine = sLine + MyArray(iY, iX)
  2635.         Next iX
  2636.         sLine = sLine + Right$("  " + cstr$(iY), 2)
  2637.         MyString = MyString + sLine + Chr$(13)
  2638.     Next iY
  2639.     MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  2640.     MyString = MyString + "           11111111112222222222333" + Chr$(13)
  2641.     ArrayToStringTest$ = MyString
  2642. End Function ' ArrayToStringTest$
  2643.  
  2644. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2645. ' END STRING TO ARRAY FUNCTIONS
  2646. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2647.  
  2648. ' ################################################################################################################################################################
  2649. ' BEGIN TILE UTILITIES
  2650. ' ################################################################################################################################################################
  2651.  
  2652. ' /////////////////////////////////////////////////////////////////////////////
  2653. ' Precalculates the tile locations ahead of time to save time copying them
  2654. ' to the screen.
  2655.  
  2656. ' Requires the following types be declared:
  2657. '
  2658. '     Type TileSheetMapType ' UDT FOR PRECALCULATED TILESHEET
  2659. '         xStart As Integer
  2660. '         xEnd As Integer
  2661. '         yStart As Integer
  2662. '         yEnd As Integer
  2663. '     End Type
  2664. '     Type TileMapType ' UDT FOR PRECALCULATED TILE MAP
  2665. '         xPos As Integer
  2666. '         yPos As Integer
  2667. '     End Type
  2668. '
  2669. ' EXAMPLE USAGE:
  2670. '
  2671. '     Dim TileCount%
  2672. '     Dim TilesheetCols%
  2673. '     Dim TilesheetRows%
  2674. '     Dim tileHeightPx%
  2675. '     Dim tileWidthPx%
  2676. '     Dim xOffset%
  2677. '     Dim yOffset%
  2678. '     Dim numTilesX%
  2679. '     Dim numTilesY%
  2680. '     REDIM arrTileSheetMap(255) AS TileSheetMapType
  2681. '     REDIM arrTileMap(20, 20) AS TileMapType
  2682. '     TileCount% = 256 ' TOTAL # OF TILES
  2683. '     TilesheetCols% = 16 ' # OF COLUMNS ON SOURCE TILE SHEET
  2684. '     TilesheetRows% = 16 ' # OF ROWS    ON SOURCE TILE SHEET
  2685. '     tileHeightPx% = 32 ' TILE HEIGHT
  2686. '     tileWidthPx% = 32 ' TILE WIDTH
  2687. '     xOffset% = 0 ' SCREEN OFFSET X
  2688. '     yOffset% = 64 ' SCREEN OFFSET Y
  2689. '     numTilesX% = 20 ' HOW MANY TILES ACROSS (ON DESTINATION)
  2690. '     numTilesY% = 20 ' HOW MANY TILES UP/DOWN (ON DESTINATION)
  2691. '     ComputeTileLocations arrTileSheetMap(), arrTileMap(), TileCount%, _
  2692. '         TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, _
  2693. '         xOffset%, yOffset%, numTilesX%, numTilesY%
  2694.  
  2695. ' TODO: this can be simplified & optimized:
  2696. '       - we don't need x/y offsets
  2697. '       - tile height/width can be hardcoded
  2698. '       - etc.
  2699.  
  2700. Sub ComputeTileLocations (arrTileSheetMap() As TileSheetMapType, arrTileMap() As TileMapType, TileCount%, TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, xOffset%, yOffset%, numTilesX%, numTilesY%)
  2701.     Dim TileNum%
  2702.     Dim sc%
  2703.     Dim sr%
  2704.     Dim sx1%
  2705.     Dim sx2%
  2706.     Dim sy1%
  2707.     Dim sy2%
  2708.  
  2709.     Dim dx%
  2710.     Dim dy%
  2711.     Dim xDest%
  2712.     Dim yDest%
  2713.  
  2714.     ' -----------------------------------------------------------------------------
  2715.     ' CALCULATE TILE SHEET COORDINATES FOR TILES 0-255
  2716.  
  2717.     For TileNum% = 0 To (TileCount% - 1)
  2718.  
  2719.         ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  2720.         sc% = TileNum% Mod TilesheetCols%
  2721.         sr% = TileNum% \ TilesheetRows%
  2722.  
  2723.         'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  2724.  
  2725.         ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2726.         'sx1% = sc% * tw%
  2727.         sx1% = sc% * tileWidthPx%
  2728.  
  2729.         ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2730.         'sy1% = sr% * tw%
  2731.         sy1% = sr% * tileHeightPx%
  2732.  
  2733.         ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2734.         'sx2% = sx1% + (tw% - 1)
  2735.         sx2% = sx1% + (tileWidthPx% - 1)
  2736.  
  2737.         ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2738.         'sy2% = sy1% + (tw% - 1)
  2739.         sy2% = sy1% + (tileHeightPx% - 1)
  2740.  
  2741.         ' SAVE THE COORDINATES FOR TileNum% IN THE ARRAY
  2742.         arrTileSheetMap(TileNum%).xStart = sx1%
  2743.         arrTileSheetMap(TileNum%).xEnd = sx2%
  2744.         arrTileSheetMap(TileNum%).yStart = sy1%
  2745.         arrTileSheetMap(TileNum%).yEnd = sy2%
  2746.  
  2747.     Next TileNum%
  2748.  
  2749.     ' -----------------------------------------------------------------------------
  2750.     ' CALCULATE SCREEN COORDINATES FOR TILES
  2751.  
  2752.     For dx% = 0 To (numTilesX% - 1)
  2753.         For dy% = 0 To (numTilesY% - 1)
  2754.  
  2755.             ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2756.             'xDest% = dx% * tw%
  2757.             xDest% = (dx% * tileWidthPx%) + xOffset%
  2758.  
  2759.             ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2760.             'yDest% = (dy% * tw%) + 64
  2761.             yDest% = (dy% * tileHeightPx%) + yOffset%
  2762.  
  2763.             'Print "Tile#" + cstr$(TileNum%) + " at r" + cstr$(sr%) + "c" + cstr$(sc%) + " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  2764.  
  2765.             ' SAVE THE SCREEN PIXEL COORDINATES FOR dx%, dy% IN THE ARRAY
  2766.             ' WHERE dx% and dy% ARE 1-BASED
  2767.             arrTileMap(dx% + 1, dy% + 1).xPos = xDest%
  2768.             arrTileMap(dx% + 1, dy% + 1).yPos = yDest%
  2769.  
  2770.         Next dy%
  2771.     Next dx%
  2772.  
  2773. End Sub ' ComputeTileLocations
  2774.  
  2775. ' /////////////////////////////////////////////////////////////////////////////
  2776. ' Latest version with NOVARSEG's changes.
  2777.  
  2778. ' Based on code from:
  2779.  
  2780. ' Image color swap?
  2781. ' https://www.qb64.org/forum/index.php?topic=2312.0
  2782.  
  2783. ' Like Function swapcolor& except returns new image in a parameter
  2784. ' in case being a function causes a memory leak?
  2785.  
  2786. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  2787.     Dim m As _MEM
  2788.     Dim a As _Offset
  2789.     a = 0
  2790.     imgNew& = _CopyImage(imgOriginal&, 32)
  2791.     m = _MemImage(imgNew&)
  2792.     Do Until a = m.SIZE - 4
  2793.         a = a + 4
  2794.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  2795.         If c = oldcolor~& Then
  2796.             _MemPut m, m.OFFSET + a, newcolor~&
  2797.         End If
  2798.     Loop
  2799.     _MemFree m
  2800. End Sub ' DoColorSwap&
  2801.  
  2802. ' ################################################################################################################################################################
  2803. ' END TILE UTILITIES
  2804. ' ################################################################################################################################################################
  2805.  
  2806. ' ################################################################################################################################################################
  2807. ' BEGIN HELPER ROUTINES
  2808. ' ################################################################################################################################################################
  2809.  
  2810. ' /////////////////////////////////////////////////////////////////////////////
  2811. ' div: int1% = num1% \ den1%
  2812. ' mod: rem1% = num1% MOD den1%
  2813.  
  2814. Function NextColorIndex% (iX As Integer, iY As Integer)
  2815.     Dim iIndex As Integer
  2816.     Dim iAdd As Integer
  2817.     iOut = (iX Mod 4)
  2818.     iAdd = (iY Mod 4)
  2819.     NextColorIndex% = iOut + iAdd + 1
  2820. End Function ' NextColorIndex%
  2821.  
  2822. ' /////////////////////////////////////////////////////////////////////////////
  2823. ' Pauses for iDS deciseconds (iDS * 100 ms)
  2824.  
  2825. Sub PauseDecisecond (iDS As Integer)
  2826.     Dim iCount As Integer
  2827.     iCount = 0
  2828.     Do
  2829.         iCount = iCount + 1
  2830.         _Limit 10 ' run 10x every second
  2831.     Loop Until iCount = iDS
  2832. End Sub ' PauseDecisecond
  2833.  
  2834. ' /////////////////////////////////////////////////////////////////////////////
  2835. ' Returns TRUE if point (x1%, y1%) is adjacent to point (x2%, y2%)
  2836.  
  2837. Function PointsAreAdjacent% (x1%, y1%, x2%, y2%)
  2838.     Dim bResult%: bResult% = FALSE
  2839.  
  2840.     ' x or y can be the same, but not both
  2841.     If (x1% <> x2%) Or (y1% <> y2%) Then
  2842.         If (x1% = x2%) Or ((x1% = (x2% + 1)) Or (x2% = (x1% + 1))) Then
  2843.             If (y1% = y2%) Or ((y1% = (y2% + 1)) Or (y2% = (y1% + 1))) Then
  2844.                 bResult% = TRUE
  2845.             End If
  2846.         End If
  2847.     End If
  2848.     PointsAreAdjacent% = bResult%
  2849. End Function ' PointsAreAdjacent%
  2850.  
  2851. ' ################################################################################################################################################################
  2852. ' END HELPER ROUTINES
  2853. ' ################################################################################################################################################################
  2854.  
  2855. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2856. ' BEGIN COLOR ARRAY FUNCTIONS
  2857. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2858.  
  2859. ' /////////////////////////////////////////////////////////////////////////////
  2860.  
  2861. Sub AddColor (ColorValue As _Unsigned Long, ColorName As String, arrColor() As ColorType)
  2862.     ReDim _Preserve arrColor(0 To UBound(arrColor) + 1) As ColorType
  2863.     arrColor(UBound(arrColor)).name = ColorName
  2864.     arrColor(UBound(arrColor)).value = ColorValue
  2865. End Sub ' AddColor
  2866.  
  2867. ' /////////////////////////////////////////////////////////////////////////////
  2868.  
  2869. Sub AddColors (arrColor() As ColorType)
  2870.     AddColor cBlack, "cBlack", arrColor()
  2871.     AddColor cGray, "cGray", arrColor()
  2872.     AddColor cSilver, "cSilver", arrColor()
  2873.     AddColor cWhite, "cWhite", arrColor()
  2874.     AddColor cRed, "cRed", arrColor()
  2875.     AddColor cOrangeRed, "cOrangeRed", arrColor()
  2876.     AddColor cYellow, "cYellow", arrColor()
  2877.     AddColor cLime, "cLime", arrColor()
  2878.     AddColor cCyan, "cCyan", arrColor()
  2879.     AddColor cDodgerBlue, "cDodgerBlue", arrColor()
  2880.     AddColor cBlue, "cBlue", arrColor()
  2881.     AddColor cDeepPurple, "cDeepPurple", arrColor()
  2882.     AddColor cDarkGreen, "cDarkGreen", arrColor()
  2883.     AddColor cMagenta, "cMagenta", arrColor()
  2884.     AddColor cHotPink, "cHotPink", arrColor()
  2885.     AddColor cDarkBrown, "cDarkBrown", arrColor()
  2886.     AddColor cEmpty, "cEmpty", arrColor()
  2887. End Sub ' AddColors
  2888.  
  2889. ' /////////////////////////////////////////////////////////////////////////////
  2890.  
  2891. Sub AddGrayscaleColors (arrColor() As ColorType)
  2892.     'AddColor cBlack, "cBlack", arrColor()
  2893.     AddColor cDimGray, "cDimGray", arrColor()
  2894.     AddColor cGray, "cGray", arrColor()
  2895.     AddColor cDarkGray, "cDarkGray", arrColor()
  2896.     AddColor cSilver, "cSilver", arrColor()
  2897.     AddColor cLightGray, "cLightGray", arrColor()
  2898.     AddColor cWhite, "cGainsboro", arrColor()
  2899.     AddColor cWhite, "cWhiteSmoke", arrColor()
  2900.     AddColor cWhite, "cWhite", arrColor()
  2901. End Sub ' AddGrayscaleColors
  2902.  
  2903. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2904. ' END COLOR ARRAY FUNCTIONS
  2905. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2906.  
  2907. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2908. ' BEGIN COLOR FUNCTIONS
  2909. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2910.  
  2911. Function cRed~& ()
  2912.     cRed = _RGB32(255, 0, 0)
  2913.  
  2914. Function cOrangeRed~& ()
  2915.     cOrangeRed = _RGB32(255, 69, 0)
  2916. End Function ' cOrangeRed~&
  2917.  
  2918. Function cDarkOrange~& ()
  2919.     cDarkOrange = _RGB32(255, 140, 0)
  2920. End Function ' cDarkOrange~&
  2921.  
  2922. Function cOrange~& ()
  2923.     cOrange = _RGB32(255, 165, 0)
  2924. End Function ' cOrange~&
  2925.  
  2926. Function cGold~& ()
  2927.     cGold = _RGB32(255, 215, 0)
  2928. End Function ' cGold~&
  2929.  
  2930. Function cYellow~& ()
  2931.     cYellow = _RGB32(255, 255, 0)
  2932. End Function ' cYellow~&
  2933.  
  2934. 'Function cChartreuse~& ()
  2935. '    cChartreuse = _RGB32(127, 255, 0)
  2936. 'End Function ' cChartreuse~&
  2937.  
  2938. ' WE USE THIS CSS3 COLOR FOR INBETWEEN LIME AND YELLOW
  2939. ' INSTEAD OF Chartreuse WHICH IS NOT YELLOW ENOUGH
  2940. Function cOliveDrab1~& ()
  2941.     cOliveDrab1 = _RGB32(192, 255, 62)
  2942. End Function ' cOliveDrab1~&
  2943.  
  2944. Function cLime~& ()
  2945.     cLime = _RGB32(0, 255, 0)
  2946. End Function ' cLime~&
  2947.  
  2948. Function cMediumSpringGreen~& ()
  2949.     cMediumSpringGreen = _RGB32(0, 250, 154)
  2950. End Function ' cMediumSpringGreen~&
  2951.  
  2952. Function cCyan~& ()
  2953.     cCyan = _RGB32(0, 255, 255)
  2954. End Function ' cCyan~&
  2955.  
  2956. Function cDeepSkyBlue~& ()
  2957.     cDeepSkyBlue = _RGB32(0, 191, 255)
  2958. End Function ' cDeepSkyBlue~&
  2959.  
  2960. Function cDodgerBlue~& ()
  2961.     cDodgerBlue = _RGB32(30, 144, 255)
  2962. End Function ' cDodgerBlue~&
  2963.  
  2964. Function cSeaBlue~& ()
  2965.     cSeaBlue = _RGB32(0, 64, 255)
  2966. End Function ' cSeaBlue~&
  2967.  
  2968. Function cBlue~& ()
  2969.     cBlue = _RGB32(0, 0, 255)
  2970. End Function ' cBlue~&
  2971.  
  2972. Function cBluePurple~& ()
  2973.     cBluePurple = _RGB32(64, 0, 255)
  2974. End Function ' cBluePurple~&
  2975.  
  2976. Function cDeepPurple~& ()
  2977.     cDeepPurple = _RGB32(96, 0, 255)
  2978. End Function ' cDeepPurple~&
  2979.  
  2980. Function cPurple~& ()
  2981.     cPurple = _RGB32(128, 0, 255)
  2982. End Function ' cPurple~&
  2983.  
  2984. Function cPurpleRed~& ()
  2985.     cPurpleRed = _RGB32(128, 0, 192)
  2986. End Function ' cPurpleRed~&
  2987.  
  2988. Function cDarkRed~& ()
  2989.     cDarkRed = _RGB32(160, 0, 64)
  2990. End Function ' cDarkRed~&
  2991.  
  2992. Function cBrickRed~& ()
  2993.     cBrickRed = _RGB32(192, 0, 32)
  2994. End Function ' cBrickRed~&
  2995.  
  2996. Function cDarkGreen~& ()
  2997.     cDarkGreen = _RGB32(0, 100, 0)
  2998. End Function ' cDarkGreen~&
  2999.  
  3000. Function cGreen~& ()
  3001.     cGreen = _RGB32(0, 128, 0)
  3002. End Function ' cGreen~&
  3003.  
  3004. Function cOliveDrab~& ()
  3005.     cOliveDrab = _RGB32(107, 142, 35)
  3006. End Function ' cOliveDrab~&
  3007.  
  3008. Function cLightPink~& ()
  3009.     cLightPink = _RGB32(255, 182, 193)
  3010. End Function ' cLightPink~&
  3011.  
  3012. Function cHotPink~& ()
  3013.     cHotPink = _RGB32(255, 105, 180)
  3014. End Function ' cHotPink~&
  3015.  
  3016. Function cDeepPink~& ()
  3017.     cDeepPink = _RGB32(255, 20, 147)
  3018. End Function ' cDeepPink~&
  3019.  
  3020. Function cMagenta~& ()
  3021.     cMagenta = _RGB32(255, 0, 255)
  3022. End Function ' cMagenta~&
  3023.  
  3024. Function cBlack~& ()
  3025.     cBlack = _RGB32(0, 0, 0)
  3026. End Function ' cBlack~&
  3027.  
  3028. Function cDimGray~& ()
  3029.     cDimGray = _RGB32(105, 105, 105)
  3030. End Function ' cDimGray~&
  3031.  
  3032. Function cGray~& ()
  3033.     cGray = _RGB32(128, 128, 128)
  3034. End Function ' cGray~&
  3035.  
  3036. Function cDarkGray~& ()
  3037.     cDarkGray = _RGB32(169, 169, 169)
  3038. End Function ' cDarkGray~&
  3039.  
  3040. Function cSilver~& ()
  3041.     cSilver = _RGB32(192, 192, 192)
  3042. End Function ' cSilver~&
  3043.  
  3044. Function cLightGray~& ()
  3045.     cLightGray = _RGB32(211, 211, 211)
  3046. End Function ' cLightGray~&
  3047.  
  3048. Function cGainsboro~& ()
  3049.     cGainsboro = _RGB32(220, 220, 220)
  3050. End Function ' cGainsboro~&
  3051.  
  3052. Function cWhiteSmoke~& ()
  3053.     cWhiteSmoke = _RGB32(245, 245, 245)
  3054. End Function ' cWhiteSmoke~&
  3055.  
  3056. Function cWhite~& ()
  3057.     cWhite = _RGB32(255, 255, 255)
  3058.     'cWhite = _RGB32(254, 254, 254)
  3059. End Function ' cWhite~&
  3060.  
  3061. Function cDarkBrown~& ()
  3062.     cDarkBrown = _RGB32(128, 64, 0)
  3063. End Function ' cDarkBrown~&
  3064.  
  3065. Function cLightBrown~& ()
  3066.     cLightBrown = _RGB32(196, 96, 0)
  3067. End Function ' cLightBrown~&
  3068.  
  3069. Function cKhaki~& ()
  3070.     cKhaki = _RGB32(240, 230, 140)
  3071. End Function ' cKhaki~&
  3072.  
  3073. Function cEmpty~& ()
  3074.     'cEmpty~& = -1
  3075.     cEmpty = _RGB32(0, 0, 0, 0)
  3076. End Function ' cEmpty~&
  3077.  
  3078. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3079. ' END COLOR FUNCTIONS
  3080. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3081.  
  3082. ' ################################################################################################################################################################
  3083. ' BEGIN GENERAL PURPOSE ROUTINES
  3084. ' ################################################################################################################################################################
  3085.  
  3086. ' /////////////////////////////////////////////////////////////////////////////
  3087. ' Convert a value to string and trim it (because normal Str$ adds spaces)
  3088.  
  3089. Function cstr$ (myValue)
  3090.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  3091.     cstr$ = _Trim$(Str$(myValue))
  3092. End Function ' cstr$
  3093.  
  3094. ' /////////////////////////////////////////////////////////////////////////////
  3095.  
  3096. Function CurrentDateTime$
  3097.     CurrentDateTime$ = Mid$(Date$, 7, 4) + "-" + _
  3098.         Mid$(Date$, 1, 5) + " " + _
  3099.         Time$
  3100. End Function ' CurrentDateTime$
  3101.  
  3102. ' /////////////////////////////////////////////////////////////////////////////
  3103.  
  3104. Function IIF (Condition, IfTrue, IfFalse)
  3105.     If Condition Then IIF = IfTrue Else IIF = IfFalse
  3106.  
  3107. ' /////////////////////////////////////////////////////////////////////////////
  3108.  
  3109. Function IIFSTR$ (Condition, IfTrue$, IfFalse$)
  3110.     If Condition Then IIFSTR$ = IfTrue$ Else IIFSTR$ = IfFalse$
  3111.  
  3112. ' /////////////////////////////////////////////////////////////////////////////
  3113. ' By sMcNeill from https://www.qb64.org/forum/index.php?topic=896.0
  3114.  
  3115. Function IsNum% (text$)
  3116.     Dim a$
  3117.     Dim b$
  3118.     a$ = _Trim$(text$)
  3119.     b$ = _Trim$(Str$(Val(text$)))
  3120.     If a$ = b$ Then
  3121.         IsNum% = TRUE
  3122.     Else
  3123.         IsNum% = FALSE
  3124.     End If
  3125. End Function ' IsNum%
  3126.  
  3127. ' /////////////////////////////////////////////////////////////////////////////
  3128. ' FROM: String Manipulation
  3129. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  3130. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  3131. '
  3132. 'SUMMARY:
  3133. '   Purpose:  A library of custom functions that transform strings.
  3134. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  3135. '   Platform: QB64 (www.qb64.org)
  3136. '   Revision: 1.6
  3137. '   Updated:  5/28/2012
  3138.  
  3139. 'SUMMARY:
  3140. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  3141. 'INPUT:
  3142. 'Text: The input string; the text that's being manipulated.
  3143. 'Find: The specified sub-string; the string sought within the [Text] string.
  3144. 'Add: The sub-string that's being added to the [Text] string.
  3145.  
  3146. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  3147.     ' VARIABLES:
  3148.     Dim Text2 As String
  3149.     Dim Find2 As String
  3150.     Dim Add2 As String
  3151.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  3152.     Dim strBefore As String ' The characters before the string to be replaced.
  3153.     Dim strAfter As String ' The characters after the string to be replaced.
  3154.  
  3155.     ' INITIALIZE:
  3156.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  3157.     Text2 = Text1
  3158.     Find2 = Find1
  3159.     Add2 = Add1
  3160.  
  3161.     lngLocation = InStr(1, Text2, Find2)
  3162.  
  3163.     ' PROCESSING:
  3164.     ' While [Find2] appears in [Text2]...
  3165.     While lngLocation
  3166.         ' Extract all Text2 before the [Find2] substring:
  3167.         strBefore = Left$(Text2, lngLocation - 1)
  3168.  
  3169.         ' Extract all text after the [Find2] substring:
  3170.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  3171.  
  3172.         ' Return the substring:
  3173.         Text2 = strBefore + Add2 + strAfter
  3174.  
  3175.         ' Locate the next instance of [Find2]:
  3176.         lngLocation = InStr(1, Text2, Find2)
  3177.  
  3178.         ' Next instance of [Find2]...
  3179.     Wend
  3180.  
  3181.     ' OUTPUT:
  3182.     Replace$ = Text2
  3183. End Function ' Replace$
  3184.  
  3185. ' /////////////////////////////////////////////////////////////////////////////
  3186. ' Split and join strings
  3187. ' https://www.qb64.org/forum/index.php?topic=1073.0
  3188. '
  3189. ' FROM luke, QB64 Developer
  3190. ' Date: February 15, 2019, 04:11:07 AM
  3191. '
  3192. ' Given a string of words separated by spaces (or any other character),
  3193. ' splits it into an array of the words. I've no doubt many people have
  3194. ' written a version of this over the years and no doubt there's a million
  3195. ' ways to do it, but I thought I'd put mine here so we have at least one
  3196. ' version. There's also a join function that does the opposite
  3197. ' array -> single string.
  3198. '
  3199. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  3200. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  3201.  
  3202. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  3203. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  3204. '
  3205. 'delimiter$ must be one character long.
  3206. 'result$() must have been REDIMmed previously.
  3207.  
  3208. ' Modified to handle multi-character delimiters
  3209.  
  3210. Sub split (in$, delimiter$, result$())
  3211.     Dim start As Integer
  3212.     Dim finish As Integer
  3213.     Dim iDelimLen As Integer
  3214.     ReDim result$(-1)
  3215.  
  3216.     iDelimLen = Len(delimiter$)
  3217.  
  3218.     start = 1
  3219.     Do
  3220.         'While Mid$(in$, start, 1) = delimiter$
  3221.         While Mid$(in$, start, iDelimLen) = delimiter$
  3222.             'start = start + 1
  3223.             start = start + iDelimLen
  3224.             If start > Len(in$) Then
  3225.                 Exit Sub
  3226.             End If
  3227.         Wend
  3228.         finish = InStr(start, in$, delimiter$)
  3229.         If finish = 0 Then
  3230.             finish = Len(in$) + 1
  3231.         End If
  3232.  
  3233.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  3234.  
  3235.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  3236.         start = finish + 1
  3237.     Loop While start <= Len(in$)
  3238. End Sub ' split
  3239.  
  3240. ' /////////////////////////////////////////////////////////////////////////////
  3241.  
  3242. Function TrueFalse$ (myValue)
  3243.     If myValue = TRUE Then
  3244.         TrueFalse$ = "TRUE"
  3245.     Else
  3246.         TrueFalse$ = "FALSE"
  3247.     End If
  3248. End Function ' TrueFalse$
  3249.  
  3250. ' ################################################################################################################################################################
  3251. ' END GENERAL PURPOSE ROUTINES
  3252. ' ################################################################################################################################################################
  3253.  
  3254. ' ################################################################################################################################################################
  3255. ' BEGIN TILE DEFINITIONS
  3256. ' ################################################################################################################################################################
  3257.  
  3258. ' /////////////////////////////////////////////////////////////////////////////
  3259. ' Returns an array of 256 8x8 tiles defined in text
  3260. ' where each tile is defined by "." as blank and anything else is a pixel
  3261. ' and each row is delimited by chr$(13)
  3262.  
  3263. Sub GetTileText (arrTileText() As String)
  3264.     ReDim arrTileText(0 To 255) As String
  3265.  
  3266.     m$ = ""
  3267.     m$ = m$ + "22....22" + Chr$(13)
  3268.     m$ = m$ + "2..22..2" + Chr$(13)
  3269.     m$ = m$ + "2..2...2" + Chr$(13)
  3270.     m$ = m$ + "2...2..2" + Chr$(13)
  3271.     m$ = m$ + "2..22..2" + Chr$(13)
  3272.     m$ = m$ + "2..22..2" + Chr$(13)
  3273.     m$ = m$ + "22....22" + Chr$(13)
  3274.     m$ = m$ + "22222222" + Chr$(13)
  3275.     arrTileText(0) = m$
  3276.  
  3277.     m$ = ""
  3278.     m$ = m$ + "........" + Chr$(13)
  3279.     m$ = m$ + "........" + Chr$(13)
  3280.     m$ = m$ + "........" + Chr$(13)
  3281.     m$ = m$ + "........" + Chr$(13)
  3282.     m$ = m$ + "........" + Chr$(13)
  3283.     m$ = m$ + "........" + Chr$(13)
  3284.     m$ = m$ + "........" + Chr$(13)
  3285.     m$ = m$ + "........" + Chr$(13)
  3286.     arrTileText(1) = m$
  3287.  
  3288.     m$ = ""
  3289.     m$ = m$ + "........" + Chr$(13)
  3290.     m$ = m$ + "........" + Chr$(13)
  3291.     m$ = m$ + "........" + Chr$(13)
  3292.     m$ = m$ + "........" + Chr$(13)
  3293.     m$ = m$ + "........" + Chr$(13)
  3294.     m$ = m$ + "........" + Chr$(13)
  3295.     m$ = m$ + "........" + Chr$(13)
  3296.     m$ = m$ + "........" + Chr$(13)
  3297.     arrTileText(2) = m$
  3298.  
  3299.     m$ = ""
  3300.     m$ = m$ + "........" + Chr$(13)
  3301.     m$ = m$ + "........" + Chr$(13)
  3302.     m$ = m$ + "........" + Chr$(13)
  3303.     m$ = m$ + "........" + Chr$(13)
  3304.     m$ = m$ + "........" + Chr$(13)
  3305.     m$ = m$ + "........" + Chr$(13)
  3306.     m$ = m$ + "........" + Chr$(13)
  3307.     m$ = m$ + "........" + Chr$(13)
  3308.     arrTileText(3) = m$
  3309.  
  3310.     m$ = ""
  3311.     m$ = m$ + "........" + Chr$(13)
  3312.     m$ = m$ + "........" + Chr$(13)
  3313.     m$ = m$ + "........" + Chr$(13)
  3314.     m$ = m$ + "........" + Chr$(13)
  3315.     m$ = m$ + "........" + Chr$(13)
  3316.     m$ = m$ + "........" + Chr$(13)
  3317.     m$ = m$ + "........" + Chr$(13)
  3318.     m$ = m$ + "........" + Chr$(13)
  3319.     arrTileText(4) = m$
  3320.  
  3321.     m$ = ""
  3322.     m$ = m$ + "........" + Chr$(13)
  3323.     m$ = m$ + "........" + Chr$(13)
  3324.     m$ = m$ + "........" + Chr$(13)
  3325.     m$ = m$ + "........" + Chr$(13)
  3326.     m$ = m$ + "........" + Chr$(13)
  3327.     m$ = m$ + "........" + Chr$(13)
  3328.     m$ = m$ + "........" + Chr$(13)
  3329.     m$ = m$ + "........" + Chr$(13)
  3330.     arrTileText(5) = m$
  3331.  
  3332.     m$ = ""
  3333.     m$ = m$ + "........" + Chr$(13)
  3334.     m$ = m$ + "........" + Chr$(13)
  3335.     m$ = m$ + "........" + Chr$(13)
  3336.     m$ = m$ + "........" + Chr$(13)
  3337.     m$ = m$ + "........" + Chr$(13)
  3338.     m$ = m$ + "........" + Chr$(13)
  3339.     m$ = m$ + "........" + Chr$(13)
  3340.     m$ = m$ + "........" + Chr$(13)
  3341.     arrTileText(6) = m$
  3342.  
  3343.     m$ = ""
  3344.     m$ = m$ + "........" + Chr$(13)
  3345.     m$ = m$ + "........" + Chr$(13)
  3346.     m$ = m$ + "........" + Chr$(13)
  3347.     m$ = m$ + "........" + Chr$(13)
  3348.     m$ = m$ + "........" + Chr$(13)
  3349.     m$ = m$ + "........" + Chr$(13)
  3350.     m$ = m$ + "........" + Chr$(13)
  3351.     m$ = m$ + "........" + Chr$(13)
  3352.     arrTileText(7) = m$
  3353.  
  3354.     m$ = ""
  3355.     m$ = m$ + "........" + Chr$(13)
  3356.     m$ = m$ + "........" + Chr$(13)
  3357.     m$ = m$ + "........" + Chr$(13)
  3358.     m$ = m$ + "........" + Chr$(13)
  3359.     m$ = m$ + "........" + Chr$(13)
  3360.     m$ = m$ + "........" + Chr$(13)
  3361.     m$ = m$ + "........" + Chr$(13)
  3362.     m$ = m$ + "........" + Chr$(13)
  3363.     arrTileText(8) = m$
  3364.  
  3365.     m$ = ""
  3366.     m$ = m$ + "........" + Chr$(13)
  3367.     m$ = m$ + "........" + Chr$(13)
  3368.     m$ = m$ + "........" + Chr$(13)
  3369.     m$ = m$ + "........" + Chr$(13)
  3370.     m$ = m$ + "........" + Chr$(13)
  3371.     m$ = m$ + "........" + Chr$(13)
  3372.     m$ = m$ + "........" + Chr$(13)
  3373.     m$ = m$ + "........" + Chr$(13)
  3374.     arrTileText(9) = m$
  3375.  
  3376.     m$ = ""
  3377.     m$ = m$ + "........" + Chr$(13)
  3378.     m$ = m$ + "........" + Chr$(13)
  3379.     m$ = m$ + "........" + Chr$(13)
  3380.     m$ = m$ + "........" + Chr$(13)
  3381.     m$ = m$ + "........" + Chr$(13)
  3382.     m$ = m$ + "........" + Chr$(13)
  3383.     m$ = m$ + "........" + Chr$(13)
  3384.     m$ = m$ + "........" + Chr$(13)
  3385.     arrTileText(10) = m$
  3386.  
  3387.     m$ = ""
  3388.     m$ = m$ + "........" + Chr$(13)
  3389.     m$ = m$ + "........" + Chr$(13)
  3390.     m$ = m$ + "........" + Chr$(13)
  3391.     m$ = m$ + "........" + Chr$(13)
  3392.     m$ = m$ + "........" + Chr$(13)
  3393.     m$ = m$ + "........" + Chr$(13)
  3394.     m$ = m$ + "........" + Chr$(13)
  3395.     m$ = m$ + "........" + Chr$(13)
  3396.     arrTileText(11) = m$
  3397.  
  3398.     m$ = ""
  3399.     m$ = m$ + "........" + Chr$(13)
  3400.     m$ = m$ + "........" + Chr$(13)
  3401.     m$ = m$ + "........" + Chr$(13)
  3402.     m$ = m$ + "........" + Chr$(13)
  3403.     m$ = m$ + "........" + Chr$(13)
  3404.     m$ = m$ + "........" + Chr$(13)
  3405.     m$ = m$ + "........" + Chr$(13)
  3406.     m$ = m$ + "........" + Chr$(13)
  3407.     arrTileText(12) = m$
  3408.  
  3409.     m$ = ""
  3410.     m$ = m$ + "........" + Chr$(13)
  3411.     m$ = m$ + "........" + Chr$(13)
  3412.     m$ = m$ + "........" + Chr$(13)
  3413.     m$ = m$ + "........" + Chr$(13)
  3414.     m$ = m$ + "........" + Chr$(13)
  3415.     m$ = m$ + "........" + Chr$(13)
  3416.     m$ = m$ + "........" + Chr$(13)
  3417.     m$ = m$ + "........" + Chr$(13)
  3418.     arrTileText(13) = m$
  3419.  
  3420.     m$ = ""
  3421.     m$ = m$ + "........" + Chr$(13)
  3422.     m$ = m$ + "........" + Chr$(13)
  3423.     m$ = m$ + "........" + Chr$(13)
  3424.     m$ = m$ + "........" + Chr$(13)
  3425.     m$ = m$ + "........" + Chr$(13)
  3426.     m$ = m$ + "........" + Chr$(13)
  3427.     m$ = m$ + "........" + Chr$(13)
  3428.     m$ = m$ + "........" + Chr$(13)
  3429.     arrTileText(14) = m$
  3430.  
  3431.     m$ = ""
  3432.     m$ = m$ + "........" + Chr$(13)
  3433.     m$ = m$ + "........" + Chr$(13)
  3434.     m$ = m$ + "........" + Chr$(13)
  3435.     m$ = m$ + "........" + Chr$(13)
  3436.     m$ = m$ + "........" + Chr$(13)
  3437.     m$ = m$ + "........" + Chr$(13)
  3438.     m$ = m$ + "........" + Chr$(13)
  3439.     m$ = m$ + "........" + Chr$(13)
  3440.     arrTileText(15) = m$
  3441.  
  3442.     m$ = ""
  3443.     m$ = m$ + "........" + Chr$(13)
  3444.     m$ = m$ + "........" + Chr$(13)
  3445.     m$ = m$ + "........" + Chr$(13)
  3446.     m$ = m$ + "........" + Chr$(13)
  3447.     m$ = m$ + "........" + Chr$(13)
  3448.     m$ = m$ + "........" + Chr$(13)
  3449.     m$ = m$ + "........" + Chr$(13)
  3450.     m$ = m$ + "........" + Chr$(13)
  3451.     arrTileText(16) = m$
  3452.  
  3453.     m$ = ""
  3454.     m$ = m$ + "........" + Chr$(13)
  3455.     m$ = m$ + "........" + Chr$(13)
  3456.     m$ = m$ + "........" + Chr$(13)
  3457.     m$ = m$ + "........" + Chr$(13)
  3458.     m$ = m$ + "........" + Chr$(13)
  3459.     m$ = m$ + "........" + Chr$(13)
  3460.     m$ = m$ + "........" + Chr$(13)
  3461.     m$ = m$ + "........" + Chr$(13)
  3462.     arrTileText(17) = m$
  3463.  
  3464.     m$ = ""
  3465.     m$ = m$ + "........" + Chr$(13)
  3466.     m$ = m$ + "........" + Chr$(13)
  3467.     m$ = m$ + "........" + Chr$(13)
  3468.     m$ = m$ + "........" + Chr$(13)
  3469.     m$ = m$ + "........" + Chr$(13)
  3470.     m$ = m$ + "........" + Chr$(13)
  3471.     m$ = m$ + "........" + Chr$(13)
  3472.     m$ = m$ + "........" + Chr$(13)
  3473.     arrTileText(18) = m$
  3474.  
  3475.     m$ = ""
  3476.     m$ = m$ + "........" + Chr$(13)
  3477.     m$ = m$ + "........" + Chr$(13)
  3478.     m$ = m$ + "........" + Chr$(13)
  3479.     m$ = m$ + "........" + Chr$(13)
  3480.     m$ = m$ + "........" + Chr$(13)
  3481.     m$ = m$ + "........" + Chr$(13)
  3482.     m$ = m$ + "........" + Chr$(13)
  3483.     m$ = m$ + "........" + Chr$(13)
  3484.     arrTileText(19) = m$
  3485.  
  3486.     m$ = ""
  3487.     m$ = m$ + "........" + Chr$(13)
  3488.     m$ = m$ + "........" + Chr$(13)
  3489.     m$ = m$ + "........" + Chr$(13)
  3490.     m$ = m$ + "........" + Chr$(13)
  3491.     m$ = m$ + "........" + Chr$(13)
  3492.     m$ = m$ + "........" + Chr$(13)
  3493.     m$ = m$ + "........" + Chr$(13)
  3494.     m$ = m$ + "........" + Chr$(13)
  3495.     arrTileText(20) = m$
  3496.  
  3497.     m$ = ""
  3498.     m$ = m$ + "........" + Chr$(13)
  3499.     m$ = m$ + "........" + Chr$(13)
  3500.     m$ = m$ + "........" + Chr$(13)
  3501.     m$ = m$ + "........" + Chr$(13)
  3502.     m$ = m$ + "........" + Chr$(13)
  3503.     m$ = m$ + "........" + Chr$(13)
  3504.     m$ = m$ + "........" + Chr$(13)
  3505.     m$ = m$ + "........" + Chr$(13)
  3506.     arrTileText(21) = m$
  3507.  
  3508.     m$ = ""
  3509.     m$ = m$ + "........" + Chr$(13)
  3510.     m$ = m$ + "........" + Chr$(13)
  3511.     m$ = m$ + "........" + Chr$(13)
  3512.     m$ = m$ + "........" + Chr$(13)
  3513.     m$ = m$ + "........" + Chr$(13)
  3514.     m$ = m$ + "........" + Chr$(13)
  3515.     m$ = m$ + "........" + Chr$(13)
  3516.     m$ = m$ + "........" + Chr$(13)
  3517.     arrTileText(22) = m$
  3518.  
  3519.     m$ = ""
  3520.     m$ = m$ + "........" + Chr$(13)
  3521.     m$ = m$ + "........" + Chr$(13)
  3522.     m$ = m$ + "........" + Chr$(13)
  3523.     m$ = m$ + "........" + Chr$(13)
  3524.     m$ = m$ + "........" + Chr$(13)
  3525.     m$ = m$ + "........" + Chr$(13)
  3526.     m$ = m$ + "........" + Chr$(13)
  3527.     m$ = m$ + "........" + Chr$(13)
  3528.     arrTileText(23) = m$
  3529.  
  3530.     m$ = ""
  3531.     m$ = m$ + "........" + Chr$(13)
  3532.     m$ = m$ + "........" + Chr$(13)
  3533.     m$ = m$ + "........" + Chr$(13)
  3534.     m$ = m$ + "........" + Chr$(13)
  3535.     m$ = m$ + "........" + Chr$(13)
  3536.     m$ = m$ + "........" + Chr$(13)
  3537.     m$ = m$ + "........" + Chr$(13)
  3538.     m$ = m$ + "........" + Chr$(13)
  3539.     arrTileText(24) = m$
  3540.  
  3541.     m$ = ""
  3542.     m$ = m$ + "........" + Chr$(13)
  3543.     m$ = m$ + "........" + Chr$(13)
  3544.     m$ = m$ + "........" + Chr$(13)
  3545.     m$ = m$ + "........" + Chr$(13)
  3546.     m$ = m$ + "........" + Chr$(13)
  3547.     m$ = m$ + "........" + Chr$(13)
  3548.     m$ = m$ + "........" + Chr$(13)
  3549.     m$ = m$ + "........" + Chr$(13)
  3550.     arrTileText(25) = m$
  3551.  
  3552.     m$ = ""
  3553.     m$ = m$ + "........" + Chr$(13)
  3554.     m$ = m$ + "........" + Chr$(13)
  3555.     m$ = m$ + "........" + Chr$(13)
  3556.     m$ = m$ + "........" + Chr$(13)
  3557.     m$ = m$ + "........" + Chr$(13)
  3558.     m$ = m$ + "........" + Chr$(13)
  3559.     m$ = m$ + "........" + Chr$(13)
  3560.     m$ = m$ + "........" + Chr$(13)
  3561.     arrTileText(26) = m$
  3562.  
  3563.     m$ = ""
  3564.     m$ = m$ + "........" + Chr$(13)
  3565.     m$ = m$ + "........" + Chr$(13)
  3566.     m$ = m$ + "........" + Chr$(13)
  3567.     m$ = m$ + "........" + Chr$(13)
  3568.     m$ = m$ + "........" + Chr$(13)
  3569.     m$ = m$ + "........" + Chr$(13)
  3570.     m$ = m$ + "........" + Chr$(13)
  3571.     m$ = m$ + "........" + Chr$(13)
  3572.     arrTileText(27) = m$
  3573.  
  3574.     m$ = ""
  3575.     m$ = m$ + "........" + Chr$(13)
  3576.     m$ = m$ + "........" + Chr$(13)
  3577.     m$ = m$ + "........" + Chr$(13)
  3578.     m$ = m$ + "........" + Chr$(13)
  3579.     m$ = m$ + "........" + Chr$(13)
  3580.     m$ = m$ + "........" + Chr$(13)
  3581.     m$ = m$ + "........" + Chr$(13)
  3582.     m$ = m$ + "........" + Chr$(13)
  3583.     arrTileText(28) = m$
  3584.  
  3585.     m$ = ""
  3586.     m$ = m$ + "........" + Chr$(13)
  3587.     m$ = m$ + "........" + Chr$(13)
  3588.     m$ = m$ + "........" + Chr$(13)
  3589.     m$ = m$ + "........" + Chr$(13)
  3590.     m$ = m$ + "........" + Chr$(13)
  3591.     m$ = m$ + "........" + Chr$(13)
  3592.     m$ = m$ + "........" + Chr$(13)
  3593.     m$ = m$ + "........" + Chr$(13)
  3594.     arrTileText(29) = m$
  3595.  
  3596.     m$ = ""
  3597.     m$ = m$ + "........" + Chr$(13)
  3598.     m$ = m$ + "........" + Chr$(13)
  3599.     m$ = m$ + "........" + Chr$(13)
  3600.     m$ = m$ + "........" + Chr$(13)
  3601.     m$ = m$ + "........" + Chr$(13)
  3602.     m$ = m$ + "........" + Chr$(13)
  3603.     m$ = m$ + "........" + Chr$(13)
  3604.     m$ = m$ + "........" + Chr$(13)
  3605.     arrTileText(30) = m$
  3606.  
  3607.     m$ = ""
  3608.     m$ = m$ + "........" + Chr$(13)
  3609.     m$ = m$ + "........" + Chr$(13)
  3610.     m$ = m$ + "........" + Chr$(13)
  3611.     m$ = m$ + "........" + Chr$(13)
  3612.     m$ = m$ + "........" + Chr$(13)
  3613.     m$ = m$ + "........" + Chr$(13)
  3614.     m$ = m$ + "........" + Chr$(13)
  3615.     m$ = m$ + "........" + Chr$(13)
  3616.     arrTileText(31) = m$
  3617.  
  3618.     m$ = ""
  3619.     m$ = m$ + "........" + Chr$(13)
  3620.     m$ = m$ + "........" + Chr$(13)
  3621.     m$ = m$ + "........" + Chr$(13)
  3622.     m$ = m$ + "........" + Chr$(13)
  3623.     m$ = m$ + "........" + Chr$(13)
  3624.     m$ = m$ + "........" + Chr$(13)
  3625.     m$ = m$ + "........" + Chr$(13)
  3626.     m$ = m$ + "........" + Chr$(13)
  3627.     arrTileText(32) = m$
  3628.  
  3629.     m$ = ""
  3630.     m$ = m$ + "...22..." + Chr$(13)
  3631.     m$ = m$ + "...22..." + Chr$(13)
  3632.     m$ = m$ + "...22..." + Chr$(13)
  3633.     m$ = m$ + "...22..." + Chr$(13)
  3634.     m$ = m$ + "........" + Chr$(13)
  3635.     m$ = m$ + "........" + Chr$(13)
  3636.     m$ = m$ + "...22..." + Chr$(13)
  3637.     m$ = m$ + "........" + Chr$(13)
  3638.     arrTileText(33) = m$
  3639.  
  3640.     m$ = ""
  3641.     m$ = m$ + ".22..22." + Chr$(13)
  3642.     m$ = m$ + ".22..22." + Chr$(13)
  3643.     m$ = m$ + ".22..22." + Chr$(13)
  3644.     m$ = m$ + "........" + Chr$(13)
  3645.     m$ = m$ + "........" + Chr$(13)
  3646.     m$ = m$ + "........" + Chr$(13)
  3647.     m$ = m$ + "........" + Chr$(13)
  3648.     m$ = m$ + "........" + Chr$(13)
  3649.     arrTileText(34) = m$
  3650.  
  3651.     m$ = ""
  3652.     m$ = m$ + ".22..22." + Chr$(13)
  3653.     m$ = m$ + ".22..22." + Chr$(13)
  3654.     m$ = m$ + "22222222" + Chr$(13)
  3655.     m$ = m$ + ".22..22." + Chr$(13)
  3656.     m$ = m$ + "22222222" + Chr$(13)
  3657.     m$ = m$ + ".22..22." + Chr$(13)
  3658.     m$ = m$ + ".22..22." + Chr$(13)
  3659.     m$ = m$ + "........" + Chr$(13)
  3660.     arrTileText(35) = m$
  3661.  
  3662.     m$ = ""
  3663.     m$ = m$ + "...22..." + Chr$(13)
  3664.     m$ = m$ + "..22222." + Chr$(13)
  3665.     m$ = m$ + ".22....." + Chr$(13)
  3666.     m$ = m$ + "..2222.." + Chr$(13)
  3667.     m$ = m$ + ".....22." + Chr$(13)
  3668.     m$ = m$ + ".22222.." + Chr$(13)
  3669.     m$ = m$ + "...22..." + Chr$(13)
  3670.     m$ = m$ + "........" + Chr$(13)
  3671.     arrTileText(36) = m$
  3672.  
  3673.     m$ = ""
  3674.     m$ = m$ + ".22...2." + Chr$(13)
  3675.     m$ = m$ + ".22..22." + Chr$(13)
  3676.     m$ = m$ + "....22.." + Chr$(13)
  3677.     m$ = m$ + "...22..." + Chr$(13)
  3678.     m$ = m$ + "..22...." + Chr$(13)
  3679.     m$ = m$ + ".22..22." + Chr$(13)
  3680.     m$ = m$ + ".2...22." + Chr$(13)
  3681.     m$ = m$ + "........" + Chr$(13)
  3682.     arrTileText(37) = m$
  3683.  
  3684.     m$ = ""
  3685.     m$ = m$ + "..2222.." + Chr$(13)
  3686.     m$ = m$ + ".22..22." + Chr$(13)
  3687.     m$ = m$ + "..2222.." + Chr$(13)
  3688.     m$ = m$ + "..222..." + Chr$(13)
  3689.     m$ = m$ + ".22..222" + Chr$(13)
  3690.     m$ = m$ + ".22..22." + Chr$(13)
  3691.     m$ = m$ + "..222222" + Chr$(13)
  3692.     m$ = m$ + "........" + Chr$(13)
  3693.     arrTileText(38) = m$
  3694.  
  3695.     m$ = ""
  3696.     m$ = m$ + ".....22." + Chr$(13)
  3697.     m$ = m$ + "....22.." + Chr$(13)
  3698.     m$ = m$ + "...22..." + Chr$(13)
  3699.     m$ = m$ + "........" + Chr$(13)
  3700.     m$ = m$ + "........" + Chr$(13)
  3701.     m$ = m$ + "........" + Chr$(13)
  3702.     m$ = m$ + "........" + Chr$(13)
  3703.     m$ = m$ + "........" + Chr$(13)
  3704.     arrTileText(39) = m$
  3705.  
  3706.     m$ = ""
  3707.     m$ = m$ + "....22.." + Chr$(13)
  3708.     m$ = m$ + "...22..." + Chr$(13)
  3709.     m$ = m$ + "..22...." + Chr$(13)
  3710.     m$ = m$ + "..22...." + Chr$(13)
  3711.     m$ = m$ + "..22...." + Chr$(13)
  3712.     m$ = m$ + "...22..." + Chr$(13)
  3713.     m$ = m$ + "....22.." + Chr$(13)
  3714.     m$ = m$ + "........" + Chr$(13)
  3715.     arrTileText(40) = m$
  3716.  
  3717.     m$ = ""
  3718.     m$ = m$ + "..22...." + Chr$(13)
  3719.     m$ = m$ + "...22..." + Chr$(13)
  3720.     m$ = m$ + "....22.." + Chr$(13)
  3721.     m$ = m$ + "....22.." + Chr$(13)
  3722.     m$ = m$ + "....22.." + Chr$(13)
  3723.     m$ = m$ + "...22..." + Chr$(13)
  3724.     m$ = m$ + "..22...." + Chr$(13)
  3725.     m$ = m$ + "........" + Chr$(13)
  3726.     arrTileText(41) = m$
  3727.  
  3728.     m$ = ""
  3729.     m$ = m$ + "........" + Chr$(13)
  3730.     m$ = m$ + ".22..22." + Chr$(13)
  3731.     m$ = m$ + "..2222.." + Chr$(13)
  3732.     m$ = m$ + "22222222" + Chr$(13)
  3733.     m$ = m$ + "..2222.." + Chr$(13)
  3734.     m$ = m$ + ".22..22." + Chr$(13)
  3735.     m$ = m$ + "........" + Chr$(13)
  3736.     m$ = m$ + "........" + Chr$(13)
  3737.     arrTileText(42) = m$
  3738.  
  3739.     m$ = ""
  3740.     m$ = m$ + "........" + Chr$(13)
  3741.     m$ = m$ + "...22..." + Chr$(13)
  3742.     m$ = m$ + "...22..." + Chr$(13)
  3743.     m$ = m$ + ".222222." + Chr$(13)
  3744.     m$ = m$ + "...22..." + Chr$(13)
  3745.     m$ = m$ + "...22..." + Chr$(13)
  3746.     m$ = m$ + "........" + Chr$(13)
  3747.     m$ = m$ + "........" + Chr$(13)
  3748.     arrTileText(43) = m$
  3749.  
  3750.     m$ = ""
  3751.     m$ = m$ + "........" + Chr$(13)
  3752.     m$ = m$ + "........" + Chr$(13)
  3753.     m$ = m$ + "........" + Chr$(13)
  3754.     m$ = m$ + "........" + Chr$(13)
  3755.     m$ = m$ + "........" + Chr$(13)
  3756.     m$ = m$ + "...22..." + Chr$(13)
  3757.     m$ = m$ + "...22..." + Chr$(13)
  3758.     m$ = m$ + "..22...." + Chr$(13)
  3759.     arrTileText(44) = m$
  3760.  
  3761.     m$ = ""
  3762.     m$ = m$ + "........" + Chr$(13)
  3763.     m$ = m$ + "........" + Chr$(13)
  3764.     m$ = m$ + "........" + Chr$(13)
  3765.     m$ = m$ + ".222222." + Chr$(13)
  3766.     m$ = m$ + "........" + Chr$(13)
  3767.     m$ = m$ + "........" + Chr$(13)
  3768.     m$ = m$ + "........" + Chr$(13)
  3769.     m$ = m$ + "........" + Chr$(13)
  3770.     arrTileText(45) = m$
  3771.  
  3772.     m$ = ""
  3773.     m$ = m$ + "........" + Chr$(13)
  3774.     m$ = m$ + "........" + Chr$(13)
  3775.     m$ = m$ + "........" + Chr$(13)
  3776.     m$ = m$ + "........" + Chr$(13)
  3777.     m$ = m$ + "........" + Chr$(13)
  3778.     m$ = m$ + "...22..." + Chr$(13)
  3779.     m$ = m$ + "...22..." + Chr$(13)
  3780.     m$ = m$ + "........" + Chr$(13)
  3781.     arrTileText(46) = m$
  3782.  
  3783.     m$ = ""
  3784.     m$ = m$ + "........" + Chr$(13)
  3785.     m$ = m$ + "......22" + Chr$(13)
  3786.     m$ = m$ + ".....22." + Chr$(13)
  3787.     m$ = m$ + "....22.." + Chr$(13)
  3788.     m$ = m$ + "...22..." + Chr$(13)
  3789.     m$ = m$ + "..22...." + Chr$(13)
  3790.     m$ = m$ + ".22....." + Chr$(13)
  3791.     m$ = m$ + "........" + Chr$(13)
  3792.     arrTileText(47) = m$
  3793.  
  3794.     m$ = ""
  3795.     m$ = m$ + "..2222.." + Chr$(13)
  3796.     m$ = m$ + ".22..22." + Chr$(13)
  3797.     m$ = m$ + ".22.222." + Chr$(13)
  3798.     m$ = m$ + ".222.22." + Chr$(13)
  3799.     m$ = m$ + ".22..22." + Chr$(13)
  3800.     m$ = m$ + ".22..22." + Chr$(13)
  3801.     m$ = m$ + "..2222.." + Chr$(13)
  3802.     m$ = m$ + "........" + Chr$(13)
  3803.     arrTileText(48) = m$
  3804.  
  3805.     m$ = ""
  3806.     m$ = m$ + "...22..." + Chr$(13)
  3807.     m$ = m$ + "...22..." + Chr$(13)
  3808.     m$ = m$ + "..222..." + Chr$(13)
  3809.     m$ = m$ + "...22..." + Chr$(13)
  3810.     m$ = m$ + "...22..." + Chr$(13)
  3811.     m$ = m$ + "...22..." + Chr$(13)
  3812.     m$ = m$ + ".222222." + Chr$(13)
  3813.     m$ = m$ + "........" + Chr$(13)
  3814.     arrTileText(49) = m$
  3815.  
  3816.     m$ = ""
  3817.     m$ = m$ + "..2222.." + Chr$(13)
  3818.     m$ = m$ + ".22..22." + Chr$(13)
  3819.     m$ = m$ + ".....22." + Chr$(13)
  3820.     m$ = m$ + "....22.." + Chr$(13)
  3821.     m$ = m$ + "..22...." + Chr$(13)
  3822.     m$ = m$ + ".22....." + Chr$(13)
  3823.     m$ = m$ + ".222222." + Chr$(13)
  3824.     m$ = m$ + "........" + Chr$(13)
  3825.     arrTileText(50) = m$
  3826.  
  3827.     m$ = ""
  3828.     m$ = m$ + "..2222.." + Chr$(13)
  3829.     m$ = m$ + ".22..22." + Chr$(13)
  3830.     m$ = m$ + ".....22." + Chr$(13)
  3831.     m$ = m$ + "...222.." + Chr$(13)
  3832.     m$ = m$ + ".....22." + Chr$(13)
  3833.     m$ = m$ + ".22..22." + Chr$(13)
  3834.     m$ = m$ + "..2222.." + Chr$(13)
  3835.     m$ = m$ + "........" + Chr$(13)
  3836.     arrTileText(51) = m$
  3837.  
  3838.     m$ = ""
  3839.     m$ = m$ + ".....22." + Chr$(13)
  3840.     m$ = m$ + "....222." + Chr$(13)
  3841.     m$ = m$ + "...2222." + Chr$(13)
  3842.     m$ = m$ + ".22..22." + Chr$(13)
  3843.     m$ = m$ + ".2222222" + Chr$(13)
  3844.     m$ = m$ + ".....22." + Chr$(13)
  3845.     m$ = m$ + ".....22." + Chr$(13)
  3846.     m$ = m$ + "........" + Chr$(13)
  3847.     arrTileText(52) = m$
  3848.  
  3849.     m$ = ""
  3850.     m$ = m$ + ".222222." + Chr$(13)
  3851.     m$ = m$ + ".22....." + Chr$(13)
  3852.     m$ = m$ + ".22222.." + Chr$(13)
  3853.     m$ = m$ + ".....22." + Chr$(13)
  3854.     m$ = m$ + ".....22." + Chr$(13)
  3855.     m$ = m$ + ".22..22." + Chr$(13)
  3856.     m$ = m$ + "..2222.." + Chr$(13)
  3857.     m$ = m$ + "........" + Chr$(13)
  3858.     arrTileText(53) = m$
  3859.  
  3860.     m$ = ""
  3861.     m$ = m$ + "..2222.." + Chr$(13)
  3862.     m$ = m$ + ".22..22." + Chr$(13)
  3863.     m$ = m$ + ".22....." + Chr$(13)
  3864.     m$ = m$ + ".22222.." + Chr$(13)
  3865.     m$ = m$ + ".22..22." + Chr$(13)
  3866.     m$ = m$ + ".22..22." + Chr$(13)
  3867.     m$ = m$ + "..2222.." + Chr$(13)
  3868.     m$ = m$ + "........" + Chr$(13)
  3869.     arrTileText(54) = m$
  3870.  
  3871.     m$ = ""
  3872.     m$ = m$ + ".222222." + Chr$(13)
  3873.     m$ = m$ + ".22..22." + Chr$(13)
  3874.     m$ = m$ + "....22.." + Chr$(13)
  3875.     m$ = m$ + "...22..." + Chr$(13)
  3876.     m$ = m$ + "...22..." + Chr$(13)
  3877.     m$ = m$ + "...22..." + Chr$(13)
  3878.     m$ = m$ + "...22..." + Chr$(13)
  3879.     m$ = m$ + "........" + Chr$(13)
  3880.     arrTileText(55) = m$
  3881.  
  3882.     m$ = ""
  3883.     m$ = m$ + "..2222.." + Chr$(13)
  3884.     m$ = m$ + ".22..22." + Chr$(13)
  3885.     m$ = m$ + ".22..22." + Chr$(13)
  3886.     m$ = m$ + "..2222.." + Chr$(13)
  3887.     m$ = m$ + ".22..22." + Chr$(13)
  3888.     m$ = m$ + ".22..22." + Chr$(13)
  3889.     m$ = m$ + "..2222.." + Chr$(13)
  3890.     m$ = m$ + "........" + Chr$(13)
  3891.     arrTileText(56) = m$
  3892.  
  3893.     m$ = ""
  3894.     m$ = m$ + "..2222.." + Chr$(13)
  3895.     m$ = m$ + ".22..22." + Chr$(13)
  3896.     m$ = m$ + ".22..22." + Chr$(13)
  3897.     m$ = m$ + "..22222." + Chr$(13)
  3898.     m$ = m$ + ".....22." + Chr$(13)
  3899.     m$ = m$ + ".22..22." + Chr$(13)
  3900.     m$ = m$ + "..2222.." + Chr$(13)
  3901.     m$ = m$ + "........" + Chr$(13)
  3902.     arrTileText(57) = m$
  3903.  
  3904.     m$ = ""
  3905.     m$ = m$ + "........" + Chr$(13)
  3906.     m$ = m$ + "........" + Chr$(13)
  3907.     m$ = m$ + "...22..." + Chr$(13)
  3908.     m$ = m$ + "........" + Chr$(13)
  3909.     m$ = m$ + "........" + Chr$(13)
  3910.     m$ = m$ + "...22..." + Chr$(13)
  3911.     m$ = m$ + "........" + Chr$(13)
  3912.     m$ = m$ + "........" + Chr$(13)
  3913.     arrTileText(58) = m$
  3914.  
  3915.     m$ = ""
  3916.     m$ = m$ + "........" + Chr$(13)
  3917.     m$ = m$ + "........" + Chr$(13)
  3918.     m$ = m$ + "...22..." + Chr$(13)
  3919.     m$ = m$ + "........" + Chr$(13)
  3920.     m$ = m$ + "........" + Chr$(13)
  3921.     m$ = m$ + "...22..." + Chr$(13)
  3922.     m$ = m$ + "...22..." + Chr$(13)
  3923.     m$ = m$ + "..22...." + Chr$(13)
  3924.     arrTileText(59) = m$
  3925.  
  3926.     m$ = ""
  3927.     m$ = m$ + "....222." + Chr$(13)
  3928.     m$ = m$ + "...22..." + Chr$(13)
  3929.     m$ = m$ + "..22...." + Chr$(13)
  3930.     m$ = m$ + ".22....." + Chr$(13)
  3931.     m$ = m$ + "..22...." + Chr$(13)
  3932.     m$ = m$ + "...22..." + Chr$(13)
  3933.     m$ = m$ + "....222." + Chr$(13)
  3934.     m$ = m$ + "........" + Chr$(13)
  3935.     arrTileText(60) = m$
  3936.  
  3937.     m$ = ""
  3938.     m$ = m$ + "........" + Chr$(13)
  3939.     m$ = m$ + "........" + Chr$(13)
  3940.     m$ = m$ + ".222222." + Chr$(13)
  3941.     m$ = m$ + "........" + Chr$(13)
  3942.     m$ = m$ + ".222222." + Chr$(13)
  3943.     m$ = m$ + "........" + Chr$(13)
  3944.     m$ = m$ + "........" + Chr$(13)
  3945.     m$ = m$ + "........" + Chr$(13)
  3946.     arrTileText(61) = m$
  3947.  
  3948.     m$ = ""
  3949.     m$ = m$ + ".222...." + Chr$(13)
  3950.     m$ = m$ + "...22..." + Chr$(13)
  3951.     m$ = m$ + "....22.." + Chr$(13)
  3952.     m$ = m$ + ".....22." + Chr$(13)
  3953.     m$ = m$ + "....22.." + Chr$(13)
  3954.     m$ = m$ + "...22..." + Chr$(13)
  3955.     m$ = m$ + ".222...." + Chr$(13)
  3956.     m$ = m$ + "........" + Chr$(13)
  3957.     arrTileText(62) = m$
  3958.  
  3959.     m$ = ""
  3960.     m$ = m$ + "..2222.." + Chr$(13)
  3961.     m$ = m$ + ".22..22." + Chr$(13)
  3962.     m$ = m$ + ".....22." + Chr$(13)
  3963.     m$ = m$ + "....22.." + Chr$(13)
  3964.     m$ = m$ + "...22..." + Chr$(13)
  3965.     m$ = m$ + "........" + Chr$(13)
  3966.     m$ = m$ + "...22..." + Chr$(13)
  3967.     m$ = m$ + "........" + Chr$(13)
  3968.     arrTileText(63) = m$
  3969.  
  3970.     m$ = ""
  3971.     m$ = m$ + "..2222.." + Chr$(13)
  3972.     m$ = m$ + ".22..22." + Chr$(13)
  3973.     m$ = m$ + ".22.222." + Chr$(13)
  3974.     m$ = m$ + ".22.222." + Chr$(13)
  3975.     m$ = m$ + ".22....." + Chr$(13)
  3976.     m$ = m$ + ".22...2." + Chr$(13)
  3977.     m$ = m$ + "..2222.." + Chr$(13)
  3978.     m$ = m$ + "........" + Chr$(13)
  3979.     arrTileText(64) = m$
  3980.  
  3981.     m$ = ""
  3982.     m$ = m$ + "...22..." + Chr$(13)
  3983.     m$ = m$ + "..2222.." + Chr$(13)
  3984.     m$ = m$ + ".22..22." + Chr$(13)
  3985.     m$ = m$ + ".222222." + Chr$(13)
  3986.     m$ = m$ + ".22..22." + Chr$(13)
  3987.     m$ = m$ + ".22..22." + Chr$(13)
  3988.     m$ = m$ + ".22..22." + Chr$(13)
  3989.     m$ = m$ + "........" + Chr$(13)
  3990.     arrTileText(65) = m$
  3991.  
  3992.     m$ = ""
  3993.     m$ = m$ + ".22222.." + Chr$(13)
  3994.     m$ = m$ + ".22..22." + Chr$(13)
  3995.     m$ = m$ + ".22..22." + Chr$(13)
  3996.     m$ = m$ + ".22222.." + Chr$(13)
  3997.     m$ = m$ + ".22..22." + Chr$(13)
  3998.     m$ = m$ + ".22..22." + Chr$(13)
  3999.     m$ = m$ + ".22222.." + Chr$(13)
  4000.     m$ = m$ + "........" + Chr$(13)
  4001.     arrTileText(66) = m$
  4002.  
  4003.     m$ = ""
  4004.     m$ = m$ + "..2222.." + Chr$(13)
  4005.     m$ = m$ + ".22..22." + Chr$(13)
  4006.     m$ = m$ + ".22....." + Chr$(13)
  4007.     m$ = m$ + ".22....." + Chr$(13)
  4008.     m$ = m$ + ".22....." + Chr$(13)
  4009.     m$ = m$ + ".22..22." + Chr$(13)
  4010.     m$ = m$ + "..2222.." + Chr$(13)
  4011.     m$ = m$ + "........" + Chr$(13)
  4012.     arrTileText(67) = m$
  4013.  
  4014.     m$ = ""
  4015.     m$ = m$ + ".2222..." + Chr$(13)
  4016.     m$ = m$ + ".22.22.." + Chr$(13)
  4017.     m$ = m$ + ".22..22." + Chr$(13)
  4018.     m$ = m$ + ".22..22." + Chr$(13)
  4019.     m$ = m$ + ".22..22." + Chr$(13)
  4020.     m$ = m$ + ".22.22.." + Chr$(13)
  4021.     m$ = m$ + ".2222..." + Chr$(13)
  4022.     m$ = m$ + "........" + Chr$(13)
  4023.     arrTileText(68) = m$
  4024.  
  4025.     m$ = ""
  4026.     m$ = m$ + ".222222." + Chr$(13)
  4027.     m$ = m$ + ".22....." + Chr$(13)
  4028.     m$ = m$ + ".22....." + Chr$(13)
  4029.     m$ = m$ + ".2222..." + Chr$(13)
  4030.     m$ = m$ + ".22....." + Chr$(13)
  4031.     m$ = m$ + ".22....." + Chr$(13)
  4032.     m$ = m$ + ".222222." + Chr$(13)
  4033.     m$ = m$ + "........" + Chr$(13)
  4034.     arrTileText(69) = m$
  4035.  
  4036.     m$ = ""
  4037.     m$ = m$ + ".222222." + Chr$(13)
  4038.     m$ = m$ + ".22....." + Chr$(13)
  4039.     m$ = m$ + ".22....." + Chr$(13)
  4040.     m$ = m$ + ".2222..." + Chr$(13)
  4041.     m$ = m$ + ".22....." + Chr$(13)
  4042.     m$ = m$ + ".22....." + Chr$(13)
  4043.     m$ = m$ + ".22....." + Chr$(13)
  4044.     m$ = m$ + "........" + Chr$(13)
  4045.     arrTileText(70) = m$
  4046.  
  4047.     m$ = ""
  4048.     m$ = m$ + "..2222.." + Chr$(13)
  4049.     m$ = m$ + ".22..22." + Chr$(13)
  4050.     m$ = m$ + ".22....." + Chr$(13)
  4051.     m$ = m$ + ".22.222." + Chr$(13)
  4052.     m$ = m$ + ".22..22." + Chr$(13)
  4053.     m$ = m$ + ".22..22." + Chr$(13)
  4054.     m$ = m$ + "..2222.." + Chr$(13)
  4055.     m$ = m$ + "........" + Chr$(13)
  4056.     arrTileText(71) = m$
  4057.  
  4058.     m$ = ""
  4059.     m$ = m$ + ".22..22." + Chr$(13)
  4060.     m$ = m$ + ".22..22." + Chr$(13)
  4061.     m$ = m$ + ".22..22." + Chr$(13)
  4062.     m$ = m$ + ".222222." + Chr$(13)
  4063.     m$ = m$ + ".22..22." + Chr$(13)
  4064.     m$ = m$ + ".22..22." + Chr$(13)
  4065.     m$ = m$ + ".22..22." + Chr$(13)
  4066.     m$ = m$ + "........" + Chr$(13)
  4067.     arrTileText(72) = m$
  4068.  
  4069.     m$ = ""
  4070.     m$ = m$ + "..2222.." + Chr$(13)
  4071.     m$ = m$ + "...22..." + Chr$(13)
  4072.     m$ = m$ + "...22..." + Chr$(13)
  4073.     m$ = m$ + "...22..." + Chr$(13)
  4074.     m$ = m$ + "...22..." + Chr$(13)
  4075.     m$ = m$ + "...22..." + Chr$(13)
  4076.     m$ = m$ + "..2222.." + Chr$(13)
  4077.     m$ = m$ + "........" + Chr$(13)
  4078.     arrTileText(73) = m$
  4079.  
  4080.     m$ = ""
  4081.     m$ = m$ + "...2222." + Chr$(13)
  4082.     m$ = m$ + "....22.." + Chr$(13)
  4083.     m$ = m$ + "....22.." + Chr$(13)
  4084.     m$ = m$ + "....22.." + Chr$(13)
  4085.     m$ = m$ + "....22.." + Chr$(13)
  4086.     m$ = m$ + ".22.22.." + Chr$(13)
  4087.     m$ = m$ + "..222..." + Chr$(13)
  4088.     m$ = m$ + "........" + Chr$(13)
  4089.     arrTileText(74) = m$
  4090.  
  4091.     m$ = ""
  4092.     m$ = m$ + ".22..22." + Chr$(13)
  4093.     m$ = m$ + ".22.22.." + Chr$(13)
  4094.     m$ = m$ + ".2222..." + Chr$(13)
  4095.     m$ = m$ + ".222...." + Chr$(13)
  4096.     m$ = m$ + ".2222..." + Chr$(13)
  4097.     m$ = m$ + ".22.22.." + Chr$(13)
  4098.     m$ = m$ + ".22..22." + Chr$(13)
  4099.     m$ = m$ + "........" + Chr$(13)
  4100.     arrTileText(75) = m$
  4101.  
  4102.     m$ = ""
  4103.     m$ = m$ + ".22....." + Chr$(13)
  4104.     m$ = m$ + ".22....." + Chr$(13)
  4105.     m$ = m$ + ".22....." + Chr$(13)
  4106.     m$ = m$ + ".22....." + Chr$(13)
  4107.     m$ = m$ + ".22....." + Chr$(13)
  4108.     m$ = m$ + ".22....." + Chr$(13)
  4109.     m$ = m$ + ".222222." + Chr$(13)
  4110.     m$ = m$ + "........" + Chr$(13)
  4111.     arrTileText(76) = m$
  4112.  
  4113.     m$ = ""
  4114.     m$ = m$ + ".22...22" + Chr$(13)
  4115.     m$ = m$ + ".222.222" + Chr$(13)
  4116.     m$ = m$ + ".2222222" + Chr$(13)
  4117.     m$ = m$ + ".22.2.22" + Chr$(13)
  4118.     m$ = m$ + ".22...22" + Chr$(13)
  4119.     m$ = m$ + ".22...22" + Chr$(13)
  4120.     m$ = m$ + ".22...22" + Chr$(13)
  4121.     m$ = m$ + "........" + Chr$(13)
  4122.     arrTileText(77) = m$
  4123.  
  4124.     m$ = ""
  4125.     m$ = m$ + ".22..22." + Chr$(13)
  4126.     m$ = m$ + ".222.22." + Chr$(13)
  4127.     m$ = m$ + ".222222." + Chr$(13)
  4128.     m$ = m$ + ".222222." + Chr$(13)
  4129.     m$ = m$ + ".22.222." + Chr$(13)
  4130.     m$ = m$ + ".22..22." + Chr$(13)
  4131.     m$ = m$ + ".22..22." + Chr$(13)
  4132.     m$ = m$ + "........" + Chr$(13)
  4133.     arrTileText(78) = m$
  4134.  
  4135.     m$ = ""
  4136.     m$ = m$ + "..2222.." + Chr$(13)
  4137.     m$ = m$ + ".22..22." + Chr$(13)
  4138.     m$ = m$ + ".22..22." + Chr$(13)
  4139.     m$ = m$ + ".22..22." + Chr$(13)
  4140.     m$ = m$ + ".22..22." + Chr$(13)
  4141.     m$ = m$ + ".22..22." + Chr$(13)
  4142.     m$ = m$ + "..2222.." + Chr$(13)
  4143.     m$ = m$ + "........" + Chr$(13)
  4144.     arrTileText(79) = m$
  4145.  
  4146.     m$ = ""
  4147.     m$ = m$ + ".22222.." + Chr$(13)
  4148.     m$ = m$ + ".22..22." + Chr$(13)
  4149.     m$ = m$ + ".22..22." + Chr$(13)
  4150.     m$ = m$ + ".22222.." + Chr$(13)
  4151.     m$ = m$ + ".22....." + Chr$(13)
  4152.     m$ = m$ + ".22....." + Chr$(13)
  4153.     m$ = m$ + ".22....." + Chr$(13)
  4154.     m$ = m$ + "........" + Chr$(13)
  4155.     arrTileText(80) = m$
  4156.  
  4157.     m$ = ""
  4158.     m$ = m$ + "..2222.." + Chr$(13)
  4159.     m$ = m$ + ".22..22." + Chr$(13)
  4160.     m$ = m$ + ".22..22." + Chr$(13)
  4161.     m$ = m$ + ".22..22." + Chr$(13)
  4162.     m$ = m$ + ".22..22." + Chr$(13)
  4163.     m$ = m$ + "..2222.." + Chr$(13)
  4164.     m$ = m$ + "....222." + Chr$(13)
  4165.     m$ = m$ + "........" + Chr$(13)
  4166.     arrTileText(81) = m$
  4167.  
  4168.     m$ = ""
  4169.     m$ = m$ + ".22222.." + Chr$(13)
  4170.     m$ = m$ + ".22..22." + Chr$(13)
  4171.     m$ = m$ + ".22..22." + Chr$(13)
  4172.     m$ = m$ + ".22222.." + Chr$(13)
  4173.     m$ = m$ + ".2222..." + Chr$(13)
  4174.     m$ = m$ + ".22.22.." + Chr$(13)
  4175.     m$ = m$ + ".22..22." + Chr$(13)
  4176.     m$ = m$ + "........" + Chr$(13)
  4177.     arrTileText(82) = m$
  4178.  
  4179.     m$ = ""
  4180.     m$ = m$ + "..2222.." + Chr$(13)
  4181.     m$ = m$ + ".22..22." + Chr$(13)
  4182.     m$ = m$ + ".22....." + Chr$(13)
  4183.     m$ = m$ + "..2222.." + Chr$(13)
  4184.     m$ = m$ + ".....22." + Chr$(13)
  4185.     m$ = m$ + ".22..22." + Chr$(13)
  4186.     m$ = m$ + "..2222.." + Chr$(13)
  4187.     m$ = m$ + "........" + Chr$(13)
  4188.     arrTileText(83) = m$
  4189.  
  4190.     m$ = ""
  4191.     m$ = m$ + ".222222." + Chr$(13)
  4192.     m$ = m$ + "...22..." + Chr$(13)
  4193.     m$ = m$ + "...22..." + Chr$(13)
  4194.     m$ = m$ + "...22..." + Chr$(13)
  4195.     m$ = m$ + "...22..." + Chr$(13)
  4196.     m$ = m$ + "...22..." + Chr$(13)
  4197.     m$ = m$ + "...22..." + Chr$(13)
  4198.     m$ = m$ + "........" + Chr$(13)
  4199.     arrTileText(84) = m$
  4200.  
  4201.     m$ = ""
  4202.     m$ = m$ + ".22..22." + Chr$(13)
  4203.     m$ = m$ + ".22..22." + Chr$(13)
  4204.     m$ = m$ + ".22..22." + Chr$(13)
  4205.     m$ = m$ + ".22..22." + Chr$(13)
  4206.     m$ = m$ + ".22..22." + Chr$(13)
  4207.     m$ = m$ + ".22..22." + Chr$(13)
  4208.     m$ = m$ + "..2222.." + Chr$(13)
  4209.     m$ = m$ + "........" + Chr$(13)
  4210.     arrTileText(85) = m$
  4211.  
  4212.     m$ = ""
  4213.     m$ = m$ + ".22..22." + Chr$(13)
  4214.     m$ = m$ + ".22..22." + Chr$(13)
  4215.     m$ = m$ + ".22..22." + Chr$(13)
  4216.     m$ = m$ + ".22..22." + Chr$(13)
  4217.     m$ = m$ + ".22..22." + Chr$(13)
  4218.     m$ = m$ + "..2222.." + Chr$(13)
  4219.     m$ = m$ + "...22..." + Chr$(13)
  4220.     m$ = m$ + "........" + Chr$(13)
  4221.     arrTileText(86) = m$
  4222.  
  4223.     m$ = ""
  4224.     m$ = m$ + ".22...22" + Chr$(13)
  4225.     m$ = m$ + ".22...22" + Chr$(13)
  4226.     m$ = m$ + ".22...22" + Chr$(13)
  4227.     m$ = m$ + ".22.2.22" + Chr$(13)
  4228.     m$ = m$ + ".2222222" + Chr$(13)
  4229.     m$ = m$ + ".222.222" + Chr$(13)
  4230.     m$ = m$ + ".22...22" + Chr$(13)
  4231.     m$ = m$ + "........" + Chr$(13)
  4232.     arrTileText(87) = m$
  4233.  
  4234.     m$ = ""
  4235.     m$ = m$ + ".22..22." + Chr$(13)
  4236.     m$ = m$ + ".22..22." + Chr$(13)
  4237.     m$ = m$ + "..2222.." + Chr$(13)
  4238.     m$ = m$ + "...22..." + Chr$(13)
  4239.     m$ = m$ + "..2222.." + Chr$(13)
  4240.     m$ = m$ + ".22..22." + Chr$(13)
  4241.     m$ = m$ + ".22..22." + Chr$(13)
  4242.     m$ = m$ + "........" + Chr$(13)
  4243.     arrTileText(88) = m$
  4244.  
  4245.     m$ = ""
  4246.     m$ = m$ + ".22..22." + Chr$(13)
  4247.     m$ = m$ + ".22..22." + Chr$(13)
  4248.     m$ = m$ + ".22..22." + Chr$(13)
  4249.     m$ = m$ + "..2222.." + Chr$(13)
  4250.     m$ = m$ + "...22..." + Chr$(13)
  4251.     m$ = m$ + "...22..." + Chr$(13)
  4252.     m$ = m$ + "...22..." + Chr$(13)
  4253.     m$ = m$ + "........" + Chr$(13)
  4254.     arrTileText(89) = m$
  4255.  
  4256.     m$ = ""
  4257.     m$ = m$ + ".222222." + Chr$(13)
  4258.     m$ = m$ + ".....22." + Chr$(13)
  4259.     m$ = m$ + "....22.." + Chr$(13)
  4260.     m$ = m$ + "...22..." + Chr$(13)
  4261.     m$ = m$ + "..22...." + Chr$(13)
  4262.     m$ = m$ + ".22....." + Chr$(13)
  4263.     m$ = m$ + ".222222." + Chr$(13)
  4264.     m$ = m$ + "........" + Chr$(13)
  4265.     arrTileText(90) = m$
  4266.  
  4267.     m$ = ""
  4268.     m$ = m$ + "..2222.." + Chr$(13)
  4269.     m$ = m$ + "..22...." + Chr$(13)
  4270.     m$ = m$ + "..22...." + Chr$(13)
  4271.     m$ = m$ + "..22...." + Chr$(13)
  4272.     m$ = m$ + "..22...." + Chr$(13)
  4273.     m$ = m$ + "..22...." + Chr$(13)
  4274.     m$ = m$ + "..2222.." + Chr$(13)
  4275.     m$ = m$ + "........" + Chr$(13)
  4276.     arrTileText(91) = m$
  4277.  
  4278.     m$ = ""
  4279.     m$ = m$ + "........" + Chr$(13)
  4280.     m$ = m$ + ".22....." + Chr$(13)
  4281.     m$ = m$ + "..22...." + Chr$(13)
  4282.     m$ = m$ + "...22..." + Chr$(13)
  4283.     m$ = m$ + "....22.." + Chr$(13)
  4284.     m$ = m$ + ".....22." + Chr$(13)
  4285.     m$ = m$ + "......22" + Chr$(13)
  4286.     m$ = m$ + "........" + Chr$(13)
  4287.     arrTileText(92) = m$
  4288.  
  4289.     m$ = ""
  4290.     m$ = m$ + "..2222.." + Chr$(13)
  4291.     m$ = m$ + "....22.." + Chr$(13)
  4292.     m$ = m$ + "....22.." + Chr$(13)
  4293.     m$ = m$ + "....22.." + Chr$(13)
  4294.     m$ = m$ + "....22.." + Chr$(13)
  4295.     m$ = m$ + "....22.." + Chr$(13)
  4296.     m$ = m$ + "..2222.." + Chr$(13)
  4297.     m$ = m$ + "........" + Chr$(13)
  4298.     arrTileText(93) = m$
  4299.  
  4300.     m$ = ""
  4301.     m$ = m$ + "...22..." + Chr$(13)
  4302.     m$ = m$ + "..2222.." + Chr$(13)
  4303.     m$ = m$ + ".22..22." + Chr$(13)
  4304.     m$ = m$ + "........" + Chr$(13)
  4305.     m$ = m$ + "........" + Chr$(13)
  4306.     m$ = m$ + "........" + Chr$(13)
  4307.     m$ = m$ + "........" + Chr$(13)
  4308.     m$ = m$ + "........" + Chr$(13)
  4309.     arrTileText(94) = m$
  4310.  
  4311.     m$ = ""
  4312.     m$ = m$ + "........" + Chr$(13)
  4313.     m$ = m$ + "........" + Chr$(13)
  4314.     m$ = m$ + "........" + Chr$(13)
  4315.     m$ = m$ + "........" + Chr$(13)
  4316.     m$ = m$ + "........" + Chr$(13)
  4317.     m$ = m$ + ".222222." + Chr$(13)
  4318.     m$ = m$ + "........" + Chr$(13)
  4319.     m$ = m$ + "........" + Chr$(13)
  4320.     arrTileText(95) = m$
  4321.  
  4322.     m$ = ""
  4323.     m$ = m$ + "........" + Chr$(13)
  4324.     m$ = m$ + "........" + Chr$(13)
  4325.     m$ = m$ + "........" + Chr$(13)
  4326.     m$ = m$ + "........" + Chr$(13)
  4327.     m$ = m$ + "........" + Chr$(13)
  4328.     m$ = m$ + "........" + Chr$(13)
  4329.     m$ = m$ + "........" + Chr$(13)
  4330.     m$ = m$ + "........" + Chr$(13)
  4331.     arrTileText(96) = m$
  4332.  
  4333.     m$ = ""
  4334.     m$ = m$ + "........" + Chr$(13)
  4335.     m$ = m$ + "..2222.." + Chr$(13)
  4336.     m$ = m$ + ".....22." + Chr$(13)
  4337.     m$ = m$ + "..22222." + Chr$(13)
  4338.     m$ = m$ + ".22..22." + Chr$(13)
  4339.     m$ = m$ + "..22222." + Chr$(13)
  4340.     m$ = m$ + "........" + Chr$(13)
  4341.     m$ = m$ + "........" + Chr$(13)
  4342.     arrTileText(97) = m$
  4343.  
  4344.     m$ = ""
  4345.     m$ = m$ + ".22....." + Chr$(13)
  4346.     m$ = m$ + ".22....." + Chr$(13)
  4347.     m$ = m$ + ".22222.." + Chr$(13)
  4348.     m$ = m$ + ".22..22." + Chr$(13)
  4349.     m$ = m$ + ".22..22." + Chr$(13)
  4350.     m$ = m$ + ".22222.." + Chr$(13)
  4351.     m$ = m$ + "........" + Chr$(13)
  4352.     m$ = m$ + "........" + Chr$(13)
  4353.     arrTileText(98) = m$
  4354.  
  4355.     m$ = ""
  4356.     m$ = m$ + "........" + Chr$(13)
  4357.     m$ = m$ + "..2222.." + Chr$(13)
  4358.     m$ = m$ + ".22....." + Chr$(13)
  4359.     m$ = m$ + ".22....." + Chr$(13)
  4360.     m$ = m$ + ".22....." + Chr$(13)
  4361.     m$ = m$ + "..2222.." + Chr$(13)
  4362.     m$ = m$ + "........" + Chr$(13)
  4363.     m$ = m$ + "........" + Chr$(13)
  4364.     arrTileText(99) = m$
  4365.  
  4366.     m$ = ""
  4367.     m$ = m$ + ".....22." + Chr$(13)
  4368.     m$ = m$ + ".....22." + Chr$(13)
  4369.     m$ = m$ + "..22222." + Chr$(13)
  4370.     m$ = m$ + ".22..22." + Chr$(13)
  4371.     m$ = m$ + ".22..22." + Chr$(13)
  4372.     m$ = m$ + "..22222." + Chr$(13)
  4373.     m$ = m$ + "........" + Chr$(13)
  4374.     m$ = m$ + "........" + Chr$(13)
  4375.     arrTileText(100) = m$
  4376.  
  4377.     m$ = ""
  4378.     m$ = m$ + "........" + Chr$(13)
  4379.     m$ = m$ + "..2222.." + Chr$(13)
  4380.     m$ = m$ + ".22..22." + Chr$(13)
  4381.     m$ = m$ + ".222222." + Chr$(13)
  4382.     m$ = m$ + ".22....." + Chr$(13)
  4383.     m$ = m$ + "..2222.." + Chr$(13)
  4384.     m$ = m$ + "........" + Chr$(13)
  4385.     m$ = m$ + "........" + Chr$(13)
  4386.     arrTileText(101) = m$
  4387.  
  4388.     m$ = ""
  4389.     m$ = m$ + "....222." + Chr$(13)
  4390.     m$ = m$ + "...22..." + Chr$(13)
  4391.     m$ = m$ + "..22222." + Chr$(13)
  4392.     m$ = m$ + "...22..." + Chr$(13)
  4393.     m$ = m$ + "...22..." + Chr$(13)
  4394.     m$ = m$ + "...22..." + Chr$(13)
  4395.     m$ = m$ + "........" + Chr$(13)
  4396.     m$ = m$ + "........" + Chr$(13)
  4397.     arrTileText(102) = m$
  4398.  
  4399.     m$ = ""
  4400.     m$ = m$ + "........" + Chr$(13)
  4401.     m$ = m$ + "..22222." + Chr$(13)
  4402.     m$ = m$ + ".22..22." + Chr$(13)
  4403.     m$ = m$ + ".22..22." + Chr$(13)
  4404.     m$ = m$ + "..22222." + Chr$(13)
  4405.     m$ = m$ + ".....22." + Chr$(13)
  4406.     m$ = m$ + ".22222.." + Chr$(13)
  4407.     m$ = m$ + "........" + Chr$(13)
  4408.     arrTileText(103) = m$
  4409.  
  4410.     m$ = ""
  4411.     m$ = m$ + ".22....." + Chr$(13)
  4412.     m$ = m$ + ".22....." + Chr$(13)
  4413.     m$ = m$ + ".22222.." + Chr$(13)
  4414.     m$ = m$ + ".22..22." + Chr$(13)
  4415.     m$ = m$ + ".22..22." + Chr$(13)
  4416.     m$ = m$ + ".22..22." + Chr$(13)
  4417.     m$ = m$ + "........" + Chr$(13)
  4418.     m$ = m$ + "........" + Chr$(13)
  4419.     arrTileText(104) = m$
  4420.  
  4421.     m$ = ""
  4422.     m$ = m$ + "...22..." + Chr$(13)
  4423.     m$ = m$ + "........" + Chr$(13)
  4424.     m$ = m$ + "..222..." + Chr$(13)
  4425.     m$ = m$ + "...22..." + Chr$(13)
  4426.     m$ = m$ + "...22..." + Chr$(13)
  4427.     m$ = m$ + "..2222.." + Chr$(13)
  4428.     m$ = m$ + "........" + Chr$(13)
  4429.     m$ = m$ + "........" + Chr$(13)
  4430.     arrTileText(105) = m$
  4431.  
  4432.     m$ = ""
  4433.     m$ = m$ + ".....22." + Chr$(13)
  4434.     m$ = m$ + "........" + Chr$(13)
  4435.     m$ = m$ + ".....22." + Chr$(13)
  4436.     m$ = m$ + ".....22." + Chr$(13)
  4437.     m$ = m$ + ".....22." + Chr$(13)
  4438.     m$ = m$ + ".....22." + Chr$(13)
  4439.     m$ = m$ + "..2222.." + Chr$(13)
  4440.     m$ = m$ + "........" + Chr$(13)
  4441.     arrTileText(106) = m$
  4442.  
  4443.     m$ = ""
  4444.     m$ = m$ + ".22....." + Chr$(13)
  4445.     m$ = m$ + ".22....." + Chr$(13)
  4446.     m$ = m$ + ".22.22.." + Chr$(13)
  4447.     m$ = m$ + ".2222..." + Chr$(13)
  4448.     m$ = m$ + ".22.22.." + Chr$(13)
  4449.     m$ = m$ + ".22..22." + Chr$(13)
  4450.     m$ = m$ + "........" + Chr$(13)
  4451.     m$ = m$ + "........" + Chr$(13)
  4452.     arrTileText(107) = m$
  4453.  
  4454.     m$ = ""
  4455.     m$ = m$ + "..222..." + Chr$(13)
  4456.     m$ = m$ + "...22..." + Chr$(13)
  4457.     m$ = m$ + "...22..." + Chr$(13)
  4458.     m$ = m$ + "...22..." + Chr$(13)
  4459.     m$ = m$ + "...22..." + Chr$(13)
  4460.     m$ = m$ + "..2222.." + Chr$(13)
  4461.     m$ = m$ + "........" + Chr$(13)
  4462.     m$ = m$ + "........" + Chr$(13)
  4463.     arrTileText(108) = m$
  4464.  
  4465.     m$ = ""
  4466.     m$ = m$ + "........" + Chr$(13)
  4467.     m$ = m$ + ".22..22." + Chr$(13)
  4468.     m$ = m$ + ".2222222" + Chr$(13)
  4469.     m$ = m$ + ".2222222" + Chr$(13)
  4470.     m$ = m$ + ".22.2.22" + Chr$(13)
  4471.     m$ = m$ + ".22...22" + Chr$(13)
  4472.     m$ = m$ + "........" + Chr$(13)
  4473.     m$ = m$ + "........" + Chr$(13)
  4474.     arrTileText(109) = m$
  4475.  
  4476.     m$ = ""
  4477.     m$ = m$ + "........" + Chr$(13)
  4478.     m$ = m$ + ".22222.." + Chr$(13)
  4479.     m$ = m$ + ".22..22." + Chr$(13)
  4480.     m$ = m$ + ".22..22." + Chr$(13)
  4481.     m$ = m$ + ".22..22." + Chr$(13)
  4482.     m$ = m$ + ".22..22." + Chr$(13)
  4483.     m$ = m$ + "........" + Chr$(13)
  4484.     m$ = m$ + "........" + Chr$(13)
  4485.     arrTileText(110) = m$
  4486.  
  4487.     m$ = ""
  4488.     m$ = m$ + "........" + Chr$(13)
  4489.     m$ = m$ + "..2222.." + Chr$(13)
  4490.     m$ = m$ + ".22..22." + Chr$(13)
  4491.     m$ = m$ + ".22..22." + Chr$(13)
  4492.     m$ = m$ + ".22..22." + Chr$(13)
  4493.     m$ = m$ + "..2222.." + Chr$(13)
  4494.     m$ = m$ + "........" + Chr$(13)
  4495.     m$ = m$ + "........" + Chr$(13)
  4496.     arrTileText(111) = m$
  4497.  
  4498.     m$ = ""
  4499.     m$ = m$ + "........" + Chr$(13)
  4500.     m$ = m$ + ".22222.." + Chr$(13)
  4501.     m$ = m$ + ".22..22." + Chr$(13)
  4502.     m$ = m$ + ".22..22." + Chr$(13)
  4503.     m$ = m$ + ".22222.." + Chr$(13)
  4504.     m$ = m$ + ".22....." + Chr$(13)
  4505.     m$ = m$ + ".22....." + Chr$(13)
  4506.     m$ = m$ + "........" + Chr$(13)
  4507.     arrTileText(112) = m$
  4508.  
  4509.     m$ = ""
  4510.     m$ = m$ + "........" + Chr$(13)
  4511.     m$ = m$ + "..22222." + Chr$(13)
  4512.     m$ = m$ + ".22..22." + Chr$(13)
  4513.     m$ = m$ + ".22..22." + Chr$(13)
  4514.     m$ = m$ + "..22222." + Chr$(13)
  4515.     m$ = m$ + ".....22." + Chr$(13)
  4516.     m$ = m$ + ".....22." + Chr$(13)
  4517.     m$ = m$ + "........" + Chr$(13)
  4518.     arrTileText(113) = m$
  4519.  
  4520.     m$ = ""
  4521.     m$ = m$ + "........" + Chr$(13)
  4522.     m$ = m$ + ".22222.." + Chr$(13)
  4523.     m$ = m$ + ".22..22." + Chr$(13)
  4524.     m$ = m$ + ".22....." + Chr$(13)
  4525.     m$ = m$ + ".22....." + Chr$(13)
  4526.     m$ = m$ + ".22....." + Chr$(13)
  4527.     m$ = m$ + "........" + Chr$(13)
  4528.     m$ = m$ + "........" + Chr$(13)
  4529.     arrTileText(114) = m$
  4530.  
  4531.     m$ = ""
  4532.     m$ = m$ + "........" + Chr$(13)
  4533.     m$ = m$ + "..22222." + Chr$(13)
  4534.     m$ = m$ + ".22....." + Chr$(13)
  4535.     m$ = m$ + "..2222.." + Chr$(13)
  4536.     m$ = m$ + ".....22." + Chr$(13)
  4537.     m$ = m$ + ".22222.." + Chr$(13)
  4538.     m$ = m$ + "........" + Chr$(13)
  4539.     m$ = m$ + "........" + Chr$(13)
  4540.     arrTileText(115) = m$
  4541.  
  4542.     m$ = ""
  4543.     m$ = m$ + "...22..." + Chr$(13)
  4544.     m$ = m$ + ".222222." + Chr$(13)
  4545.     m$ = m$ + "...22..." + Chr$(13)
  4546.     m$ = m$ + "...22..." + Chr$(13)
  4547.     m$ = m$ + "...22..." + Chr$(13)
  4548.     m$ = m$ + "....222." + Chr$(13)
  4549.     m$ = m$ + "........" + Chr$(13)
  4550.     m$ = m$ + "........" + Chr$(13)
  4551.     arrTileText(116) = m$
  4552.  
  4553.     m$ = ""
  4554.     m$ = m$ + "........" + Chr$(13)
  4555.     m$ = m$ + ".22..22." + Chr$(13)
  4556.     m$ = m$ + ".22..22." + Chr$(13)
  4557.     m$ = m$ + ".22..22." + Chr$(13)
  4558.     m$ = m$ + ".22..22." + Chr$(13)
  4559.     m$ = m$ + "..22222." + Chr$(13)
  4560.     m$ = m$ + "........" + Chr$(13)
  4561.     m$ = m$ + "........" + Chr$(13)
  4562.     arrTileText(117) = m$
  4563.  
  4564.     m$ = ""
  4565.     m$ = m$ + "........" + Chr$(13)
  4566.     m$ = m$ + ".22..22." + Chr$(13)
  4567.     m$ = m$ + ".22..22." + Chr$(13)
  4568.     m$ = m$ + ".22..22." + Chr$(13)
  4569.     m$ = m$ + "..2222.." + Chr$(13)
  4570.     m$ = m$ + "...22..." + Chr$(13)
  4571.     m$ = m$ + "........" + Chr$(13)
  4572.     m$ = m$ + "........" + Chr$(13)
  4573.     arrTileText(118) = m$
  4574.  
  4575.     m$ = ""
  4576.     m$ = m$ + "........" + Chr$(13)
  4577.     m$ = m$ + ".22...22" + Chr$(13)
  4578.     m$ = m$ + ".22.2.22" + Chr$(13)
  4579.     m$ = m$ + ".2222222" + Chr$(13)
  4580.     m$ = m$ + "..22222." + Chr$(13)
  4581.     m$ = m$ + "..22.22." + Chr$(13)
  4582.     m$ = m$ + "........" + Chr$(13)
  4583.     m$ = m$ + "........" + Chr$(13)
  4584.     arrTileText(119) = m$
  4585.  
  4586.     m$ = ""
  4587.     m$ = m$ + "........" + Chr$(13)
  4588.     m$ = m$ + ".22..22." + Chr$(13)
  4589.     m$ = m$ + "..2222.." + Chr$(13)
  4590.     m$ = m$ + "...22..." + Chr$(13)
  4591.     m$ = m$ + "..2222.." + Chr$(13)
  4592.     m$ = m$ + ".22..22." + Chr$(13)
  4593.     m$ = m$ + "........" + Chr$(13)
  4594.     m$ = m$ + "........" + Chr$(13)
  4595.     arrTileText(120) = m$
  4596.  
  4597.     m$ = ""
  4598.     m$ = m$ + "........" + Chr$(13)
  4599.     m$ = m$ + ".22..22." + Chr$(13)
  4600.     m$ = m$ + ".22..22." + Chr$(13)
  4601.     m$ = m$ + ".22..22." + Chr$(13)
  4602.     m$ = m$ + "..22222." + Chr$(13)
  4603.     m$ = m$ + "....22.." + Chr$(13)
  4604.     m$ = m$ + ".2222..." + Chr$(13)
  4605.     m$ = m$ + "........" + Chr$(13)
  4606.     arrTileText(121) = m$
  4607.  
  4608.     m$ = ""
  4609.     m$ = m$ + "........" + Chr$(13)
  4610.     m$ = m$ + ".222222." + Chr$(13)
  4611.     m$ = m$ + "....22.." + Chr$(13)
  4612.     m$ = m$ + "...22..." + Chr$(13)
  4613.     m$ = m$ + "..22...." + Chr$(13)
  4614.     m$ = m$ + ".222222." + Chr$(13)
  4615.     m$ = m$ + "........" + Chr$(13)
  4616.     m$ = m$ + "........" + Chr$(13)
  4617.     arrTileText(122) = m$
  4618.  
  4619.     m$ = ""
  4620.     m$ = m$ + "...222.." + Chr$(13)
  4621.     m$ = m$ + "..22...." + Chr$(13)
  4622.     m$ = m$ + "..2....." + Chr$(13)
  4623.     m$ = m$ + ".22....." + Chr$(13)
  4624.     m$ = m$ + "..2....." + Chr$(13)
  4625.     m$ = m$ + "..22...." + Chr$(13)
  4626.     m$ = m$ + "...222.." + Chr$(13)
  4627.     m$ = m$ + "........" + Chr$(13)
  4628.     arrTileText(123) = m$
  4629.  
  4630.     m$ = ""
  4631.     m$ = m$ + "....2..." + Chr$(13)
  4632.     m$ = m$ + "....2..." + Chr$(13)
  4633.     m$ = m$ + "....2..." + Chr$(13)
  4634.     m$ = m$ + "....2..." + Chr$(13)
  4635.     m$ = m$ + "....2..." + Chr$(13)
  4636.     m$ = m$ + "....2..." + Chr$(13)
  4637.     m$ = m$ + "....2..." + Chr$(13)
  4638.     m$ = m$ + "........" + Chr$(13)
  4639.     arrTileText(124) = m$
  4640.  
  4641.     m$ = ""
  4642.     m$ = m$ + "..222..." + Chr$(13)
  4643.     m$ = m$ + "....22.." + Chr$(13)
  4644.     m$ = m$ + ".....2.." + Chr$(13)
  4645.     m$ = m$ + ".....22." + Chr$(13)
  4646.     m$ = m$ + ".....2.." + Chr$(13)
  4647.     m$ = m$ + "....22.." + Chr$(13)
  4648.     m$ = m$ + "..222..." + Chr$(13)
  4649.     m$ = m$ + "........" + Chr$(13)
  4650.     arrTileText(125) = m$
  4651.  
  4652.     m$ = ""
  4653.     m$ = m$ + "........" + Chr$(13)
  4654.     m$ = m$ + ".22....2" + Chr$(13)
  4655.     m$ = m$ + "2..2..2." + Chr$(13)
  4656.     m$ = m$ + "....22.." + Chr$(13)
  4657.     m$ = m$ + "........" + Chr$(13)
  4658.     m$ = m$ + "........" + Chr$(13)
  4659.     m$ = m$ + "........" + Chr$(13)
  4660.     m$ = m$ + "........" + Chr$(13)
  4661.     arrTileText(126) = m$
  4662.  
  4663.     m$ = ""
  4664.     m$ = m$ + "........" + Chr$(13)
  4665.     m$ = m$ + "........" + Chr$(13)
  4666.     m$ = m$ + "........" + Chr$(13)
  4667.     m$ = m$ + "........" + Chr$(13)
  4668.     m$ = m$ + "........" + Chr$(13)
  4669.     m$ = m$ + "........" + Chr$(13)
  4670.     m$ = m$ + "........" + Chr$(13)
  4671.     m$ = m$ + "........" + Chr$(13)
  4672.     arrTileText(127) = m$
  4673.  
  4674.     m$ = ""
  4675.     m$ = m$ + "........" + Chr$(13)
  4676.     m$ = m$ + "........" + Chr$(13)
  4677.     m$ = m$ + "........" + Chr$(13)
  4678.     m$ = m$ + "22222222" + Chr$(13)
  4679.     m$ = m$ + "22222222" + Chr$(13)
  4680.     m$ = m$ + "........" + Chr$(13)
  4681.     m$ = m$ + "........" + Chr$(13)
  4682.     m$ = m$ + "........" + Chr$(13)
  4683.     arrTileText(128) = m$
  4684.  
  4685.     m$ = ""
  4686.     m$ = m$ + "....2..." + Chr$(13)
  4687.     m$ = m$ + "...222.." + Chr$(13)
  4688.     m$ = m$ + "..22222." + Chr$(13)
  4689.     m$ = m$ + ".2222222" + Chr$(13)
  4690.     m$ = m$ + ".2222222" + Chr$(13)
  4691.     m$ = m$ + "...222.." + Chr$(13)
  4692.     m$ = m$ + "..22222." + Chr$(13)
  4693.     m$ = m$ + "........" + Chr$(13)
  4694.     arrTileText(129) = m$
  4695.  
  4696.     m$ = ""
  4697.     m$ = m$ + "...22..." + Chr$(13)
  4698.     m$ = m$ + "...22..." + Chr$(13)
  4699.     m$ = m$ + "...22..." + Chr$(13)
  4700.     m$ = m$ + "...22..." + Chr$(13)
  4701.     m$ = m$ + "...22..." + Chr$(13)
  4702.     m$ = m$ + "...22..." + Chr$(13)
  4703.     m$ = m$ + "...22..." + Chr$(13)
  4704.     m$ = m$ + "...22..." + Chr$(13)
  4705.     arrTileText(130) = m$
  4706.  
  4707.     m$ = ""
  4708.     m$ = m$ + "........" + Chr$(13)
  4709.     m$ = m$ + "........" + Chr$(13)
  4710.     m$ = m$ + "........" + Chr$(13)
  4711.     m$ = m$ + "22222222" + Chr$(13)
  4712.     m$ = m$ + "22222222" + Chr$(13)
  4713.     m$ = m$ + "........" + Chr$(13)
  4714.     m$ = m$ + "........" + Chr$(13)
  4715.     m$ = m$ + "........" + Chr$(13)
  4716.     arrTileText(131) = m$
  4717.  
  4718.     m$ = ""
  4719.     m$ = m$ + "........" + Chr$(13)
  4720.     m$ = m$ + "........" + Chr$(13)
  4721.     m$ = m$ + "22222222" + Chr$(13)
  4722.     m$ = m$ + "22222222" + Chr$(13)
  4723.     m$ = m$ + "........" + Chr$(13)
  4724.     m$ = m$ + "........" + Chr$(13)
  4725.     m$ = m$ + "........" + Chr$(13)
  4726.     m$ = m$ + "........" + Chr$(13)
  4727.     arrTileText(132) = m$
  4728.  
  4729.     m$ = ""
  4730.     m$ = m$ + "........" + Chr$(13)
  4731.     m$ = m$ + "22222222" + Chr$(13)
  4732.     m$ = m$ + "22222222" + Chr$(13)
  4733.     m$ = m$ + "........" + Chr$(13)
  4734.     m$ = m$ + "........" + Chr$(13)
  4735.     m$ = m$ + "........" + Chr$(13)
  4736.     m$ = m$ + "........" + Chr$(13)
  4737.     m$ = m$ + "........" + Chr$(13)
  4738.     arrTileText(133) = m$
  4739.  
  4740.     m$ = ""
  4741.     m$ = m$ + "........" + Chr$(13)
  4742.     m$ = m$ + "........" + Chr$(13)
  4743.     m$ = m$ + "........" + Chr$(13)
  4744.     m$ = m$ + "........" + Chr$(13)
  4745.     m$ = m$ + "22222222" + Chr$(13)
  4746.     m$ = m$ + "22222222" + Chr$(13)
  4747.     m$ = m$ + "........" + Chr$(13)
  4748.     m$ = m$ + "........" + Chr$(13)
  4749.     arrTileText(134) = m$
  4750.  
  4751.     m$ = ""
  4752.     m$ = m$ + "..22...." + Chr$(13)
  4753.     m$ = m$ + "..22...." + Chr$(13)
  4754.     m$ = m$ + "..22...." + Chr$(13)
  4755.     m$ = m$ + "..22...." + Chr$(13)
  4756.     m$ = m$ + "..22...." + Chr$(13)
  4757.     m$ = m$ + "..22...." + Chr$(13)
  4758.     m$ = m$ + "..22...." + Chr$(13)
  4759.     m$ = m$ + "..22...." + Chr$(13)
  4760.     arrTileText(135) = m$
  4761.  
  4762.     m$ = ""
  4763.     m$ = m$ + "....22.." + Chr$(13)
  4764.     m$ = m$ + "....22.." + Chr$(13)
  4765.     m$ = m$ + "....22.." + Chr$(13)
  4766.     m$ = m$ + "....22.." + Chr$(13)
  4767.     m$ = m$ + "....22.." + Chr$(13)
  4768.     m$ = m$ + "....22.." + Chr$(13)
  4769.     m$ = m$ + "....22.." + Chr$(13)
  4770.     m$ = m$ + "....22.." + Chr$(13)
  4771.     arrTileText(136) = m$
  4772.  
  4773.     m$ = ""
  4774.     m$ = m$ + "........" + Chr$(13)
  4775.     m$ = m$ + "........" + Chr$(13)
  4776.     m$ = m$ + "........" + Chr$(13)
  4777.     m$ = m$ + "222....." + Chr$(13)
  4778.     m$ = m$ + "2222...." + Chr$(13)
  4779.     m$ = m$ + "..222..." + Chr$(13)
  4780.     m$ = m$ + "...22..." + Chr$(13)
  4781.     m$ = m$ + "...22..." + Chr$(13)
  4782.     arrTileText(137) = m$
  4783.  
  4784.     m$ = ""
  4785.     m$ = m$ + "...22..." + Chr$(13)
  4786.     m$ = m$ + "...22..." + Chr$(13)
  4787.     m$ = m$ + "...222.." + Chr$(13)
  4788.     m$ = m$ + "....2222" + Chr$(13)
  4789.     m$ = m$ + ".....222" + Chr$(13)
  4790.     m$ = m$ + "........" + Chr$(13)
  4791.     m$ = m$ + "........" + Chr$(13)
  4792.     m$ = m$ + "........" + Chr$(13)
  4793.     arrTileText(138) = m$
  4794.  
  4795.     m$ = ""
  4796.     m$ = m$ + "...22..." + Chr$(13)
  4797.     m$ = m$ + "...22..." + Chr$(13)
  4798.     m$ = m$ + "..222..." + Chr$(13)
  4799.     m$ = m$ + "2222...." + Chr$(13)
  4800.     m$ = m$ + "222....." + Chr$(13)
  4801.     m$ = m$ + "........" + Chr$(13)
  4802.     m$ = m$ + "........" + Chr$(13)
  4803.     m$ = m$ + "........" + Chr$(13)
  4804.     arrTileText(139) = m$
  4805.  
  4806.     m$ = ""
  4807.     m$ = m$ + "22......" + Chr$(13)
  4808.     m$ = m$ + "22......" + Chr$(13)
  4809.     m$ = m$ + "22......" + Chr$(13)
  4810.     m$ = m$ + "22......" + Chr$(13)
  4811.     m$ = m$ + "22......" + Chr$(13)
  4812.     m$ = m$ + "22......" + Chr$(13)
  4813.     m$ = m$ + "22222222" + Chr$(13)
  4814.     m$ = m$ + "22222222" + Chr$(13)
  4815.     arrTileText(140) = m$
  4816.  
  4817.     m$ = ""
  4818.     m$ = m$ + "22......" + Chr$(13)
  4819.     m$ = m$ + "222....." + Chr$(13)
  4820.     m$ = m$ + ".222...." + Chr$(13)
  4821.     m$ = m$ + "..222..." + Chr$(13)
  4822.     m$ = m$ + "...222.." + Chr$(13)
  4823.     m$ = m$ + "....222." + Chr$(13)
  4824.     m$ = m$ + ".....222" + Chr$(13)
  4825.     m$ = m$ + "......22" + Chr$(13)
  4826.     arrTileText(141) = m$
  4827.  
  4828.     m$ = ""
  4829.     m$ = m$ + "......22" + Chr$(13)
  4830.     m$ = m$ + ".....222" + Chr$(13)
  4831.     m$ = m$ + "....222." + Chr$(13)
  4832.     m$ = m$ + "...222.." + Chr$(13)
  4833.     m$ = m$ + "..222..." + Chr$(13)
  4834.     m$ = m$ + ".222...." + Chr$(13)
  4835.     m$ = m$ + "222....." + Chr$(13)
  4836.     m$ = m$ + "22......" + Chr$(13)
  4837.     arrTileText(142) = m$
  4838.  
  4839.     m$ = ""
  4840.     m$ = m$ + "22222222" + Chr$(13)
  4841.     m$ = m$ + "22222222" + Chr$(13)
  4842.     m$ = m$ + "22......" + Chr$(13)
  4843.     m$ = m$ + "22......" + Chr$(13)
  4844.     m$ = m$ + "22......" + Chr$(13)
  4845.     m$ = m$ + "22......" + Chr$(13)
  4846.     m$ = m$ + "22......" + Chr$(13)
  4847.     m$ = m$ + "22......" + Chr$(13)
  4848.     arrTileText(143) = m$
  4849.  
  4850.     m$ = ""
  4851.     m$ = m$ + "22222222" + Chr$(13)
  4852.     m$ = m$ + "22222222" + Chr$(13)
  4853.     m$ = m$ + "......22" + Chr$(13)
  4854.     m$ = m$ + "......22" + Chr$(13)
  4855.     m$ = m$ + "......22" + Chr$(13)
  4856.     m$ = m$ + "......22" + Chr$(13)
  4857.     m$ = m$ + "......22" + Chr$(13)
  4858.     m$ = m$ + "......22" + Chr$(13)
  4859.     arrTileText(144) = m$
  4860.  
  4861.     m$ = ""
  4862.     m$ = m$ + "........" + Chr$(13)
  4863.     m$ = m$ + "..2222.." + Chr$(13)
  4864.     m$ = m$ + ".222222." + Chr$(13)
  4865.     m$ = m$ + ".222222." + Chr$(13)
  4866.     m$ = m$ + ".222222." + Chr$(13)
  4867.     m$ = m$ + ".222222." + Chr$(13)
  4868.     m$ = m$ + "..2222.." + Chr$(13)
  4869.     m$ = m$ + "........" + Chr$(13)
  4870.     arrTileText(145) = m$
  4871.  
  4872.     m$ = ""
  4873.     m$ = m$ + "........" + Chr$(13)
  4874.     m$ = m$ + "........" + Chr$(13)
  4875.     m$ = m$ + "........" + Chr$(13)
  4876.     m$ = m$ + "........" + Chr$(13)
  4877.     m$ = m$ + "........" + Chr$(13)
  4878.     m$ = m$ + "22222222" + Chr$(13)
  4879.     m$ = m$ + "22222222" + Chr$(13)
  4880.     m$ = m$ + "........" + Chr$(13)
  4881.     arrTileText(146) = m$
  4882.  
  4883.     m$ = ""
  4884.     m$ = m$ + "..22.22." + Chr$(13)
  4885.     m$ = m$ + ".2222222" + Chr$(13)
  4886.     m$ = m$ + ".2222222" + Chr$(13)
  4887.     m$ = m$ + ".2222222" + Chr$(13)
  4888.     m$ = m$ + "..22222." + Chr$(13)
  4889.     m$ = m$ + "...222.." + Chr$(13)
  4890.     m$ = m$ + "....2..." + Chr$(13)
  4891.     m$ = m$ + "........" + Chr$(13)
  4892.     arrTileText(147) = m$
  4893.  
  4894.     m$ = ""
  4895.     m$ = m$ + ".22....." + Chr$(13)
  4896.     m$ = m$ + ".22....." + Chr$(13)
  4897.     m$ = m$ + ".22....." + Chr$(13)
  4898.     m$ = m$ + ".22....." + Chr$(13)
  4899.     m$ = m$ + ".22....." + Chr$(13)
  4900.     m$ = m$ + ".22....." + Chr$(13)
  4901.     m$ = m$ + ".22....." + Chr$(13)
  4902.     m$ = m$ + ".22....." + Chr$(13)
  4903.     arrTileText(148) = m$
  4904.  
  4905.     m$ = ""
  4906.     m$ = m$ + "........" + Chr$(13)
  4907.     m$ = m$ + "........" + Chr$(13)
  4908.     m$ = m$ + "........" + Chr$(13)
  4909.     m$ = m$ + ".....222" + Chr$(13)
  4910.     m$ = m$ + "....2222" + Chr$(13)
  4911.     m$ = m$ + "...222.." + Chr$(13)
  4912.     m$ = m$ + "...22..." + Chr$(13)
  4913.     m$ = m$ + "...22..." + Chr$(13)
  4914.     arrTileText(149) = m$
  4915.  
  4916.     m$ = ""
  4917.     m$ = m$ + "22....22" + Chr$(13)
  4918.     m$ = m$ + "222..222" + Chr$(13)
  4919.     m$ = m$ + ".222222." + Chr$(13)
  4920.     m$ = m$ + "..2222.." + Chr$(13)
  4921.     m$ = m$ + "..2222.." + Chr$(13)
  4922.     m$ = m$ + ".222222." + Chr$(13)
  4923.     m$ = m$ + "222..222" + Chr$(13)
  4924.     m$ = m$ + "22....22" + Chr$(13)
  4925.     arrTileText(150) = m$
  4926.  
  4927.     m$ = ""
  4928.     m$ = m$ + "........" + Chr$(13)
  4929.     m$ = m$ + "..2222.." + Chr$(13)
  4930.     m$ = m$ + ".222222." + Chr$(13)
  4931.     m$ = m$ + ".22..22." + Chr$(13)
  4932.     m$ = m$ + ".22..22." + Chr$(13)
  4933.     m$ = m$ + ".222222." + Chr$(13)
  4934.     m$ = m$ + "..2222.." + Chr$(13)
  4935.     m$ = m$ + "........" + Chr$(13)
  4936.     arrTileText(151) = m$
  4937.  
  4938.     m$ = ""
  4939.     m$ = m$ + "...22..." + Chr$(13)
  4940.     m$ = m$ + "...22..." + Chr$(13)
  4941.     m$ = m$ + ".22..22." + Chr$(13)
  4942.     m$ = m$ + ".22..22." + Chr$(13)
  4943.     m$ = m$ + "...22..." + Chr$(13)
  4944.     m$ = m$ + "...22..." + Chr$(13)
  4945.     m$ = m$ + "..2222.." + Chr$(13)
  4946.     m$ = m$ + "........" + Chr$(13)
  4947.     arrTileText(152) = m$
  4948.  
  4949.     m$ = ""
  4950.     m$ = m$ + ".....22." + Chr$(13)
  4951.     m$ = m$ + ".....22." + Chr$(13)
  4952.     m$ = m$ + ".....22." + Chr$(13)
  4953.     m$ = m$ + ".....22." + Chr$(13)
  4954.     m$ = m$ + ".....22." + Chr$(13)
  4955.     m$ = m$ + ".....22." + Chr$(13)
  4956.     m$ = m$ + ".....22." + Chr$(13)
  4957.     m$ = m$ + ".....22." + Chr$(13)
  4958.     arrTileText(153) = m$
  4959.  
  4960.     m$ = ""
  4961.     m$ = m$ + "....2..." + Chr$(13)
  4962.     m$ = m$ + "...222.." + Chr$(13)
  4963.     m$ = m$ + "..22222." + Chr$(13)
  4964.     m$ = m$ + ".2222222" + Chr$(13)
  4965.     m$ = m$ + "..22222." + Chr$(13)
  4966.     m$ = m$ + "...222.." + Chr$(13)
  4967.     m$ = m$ + "....2..." + Chr$(13)
  4968.     m$ = m$ + "........" + Chr$(13)
  4969.     arrTileText(154) = m$
  4970.  
  4971.     m$ = ""
  4972.     m$ = m$ + "...22..." + Chr$(13)
  4973.     m$ = m$ + "...22..." + Chr$(13)
  4974.     m$ = m$ + "...22..." + Chr$(13)
  4975.     m$ = m$ + "22222222" + Chr$(13)
  4976.     m$ = m$ + "22222222" + Chr$(13)
  4977.     m$ = m$ + "...22..." + Chr$(13)
  4978.     m$ = m$ + "...22..." + Chr$(13)
  4979.     m$ = m$ + "...22..." + Chr$(13)
  4980.     arrTileText(155) = m$
  4981.  
  4982.     m$ = ""
  4983.     m$ = m$ + "22......" + Chr$(13)
  4984.     m$ = m$ + "22......" + Chr$(13)
  4985.     m$ = m$ + "..22...." + Chr$(13)
  4986.     m$ = m$ + "..22...." + Chr$(13)
  4987.     m$ = m$ + "22......" + Chr$(13)
  4988.     m$ = m$ + "22......" + Chr$(13)
  4989.     m$ = m$ + "..22...." + Chr$(13)
  4990.     m$ = m$ + "..22...." + Chr$(13)
  4991.     arrTileText(156) = m$
  4992.  
  4993.     m$ = ""
  4994.     m$ = m$ + "...22..." + Chr$(13)
  4995.     m$ = m$ + "...22..." + Chr$(13)
  4996.     m$ = m$ + "...22..." + Chr$(13)
  4997.     m$ = m$ + "...22..." + Chr$(13)
  4998.     m$ = m$ + "...22..." + Chr$(13)
  4999.     m$ = m$ + "...22..." + Chr$(13)
  5000.     m$ = m$ + "...22..." + Chr$(13)
  5001.     m$ = m$ + "...22..." + Chr$(13)
  5002.     arrTileText(157) = m$
  5003.  
  5004.     m$ = ""
  5005.     m$ = m$ + "........" + Chr$(13)
  5006.     m$ = m$ + "........" + Chr$(13)
  5007.     m$ = m$ + "......22" + Chr$(13)
  5008.     m$ = m$ + "..22222." + Chr$(13)
  5009.     m$ = m$ + ".222.22." + Chr$(13)
  5010.     m$ = m$ + "..22.22." + Chr$(13)
  5011.     m$ = m$ + "..22.22." + Chr$(13)
  5012.     m$ = m$ + "........" + Chr$(13)
  5013.     arrTileText(158) = m$
  5014.  
  5015.     m$ = ""
  5016.     m$ = m$ + "22222222" + Chr$(13)
  5017.     m$ = m$ + ".2222222" + Chr$(13)
  5018.     m$ = m$ + "..222222" + Chr$(13)
  5019.     m$ = m$ + "...22222" + Chr$(13)
  5020.     m$ = m$ + "....2222" + Chr$(13)
  5021.     m$ = m$ + ".....222" + Chr$(13)
  5022.     m$ = m$ + "......22" + Chr$(13)
  5023.     m$ = m$ + ".......2" + Chr$(13)
  5024.     arrTileText(159) = m$
  5025.  
  5026.     m$ = ""
  5027.     m$ = m$ + "........" + Chr$(13)
  5028.     m$ = m$ + "........" + Chr$(13)
  5029.     m$ = m$ + "........" + Chr$(13)
  5030.     m$ = m$ + "........" + Chr$(13)
  5031.     m$ = m$ + "........" + Chr$(13)
  5032.     m$ = m$ + "........" + Chr$(13)
  5033.     m$ = m$ + "........" + Chr$(13)
  5034.     m$ = m$ + "........" + Chr$(13)
  5035.     arrTileText(160) = m$
  5036.  
  5037.     m$ = ""
  5038.     m$ = m$ + "2222...." + Chr$(13)
  5039.     m$ = m$ + "2222...." + Chr$(13)
  5040.     m$ = m$ + "2222...." + Chr$(13)
  5041.     m$ = m$ + "2222...." + Chr$(13)
  5042.     m$ = m$ + "2222...." + Chr$(13)
  5043.     m$ = m$ + "2222...." + Chr$(13)
  5044.     m$ = m$ + "2222...." + Chr$(13)
  5045.     m$ = m$ + "2222...." + Chr$(13)
  5046.     arrTileText(161) = m$
  5047.  
  5048.     m$ = ""
  5049.     m$ = m$ + "........" + Chr$(13)
  5050.     m$ = m$ + "........" + Chr$(13)
  5051.     m$ = m$ + "........" + Chr$(13)
  5052.     m$ = m$ + "........" + Chr$(13)
  5053.     m$ = m$ + "22222222" + Chr$(13)
  5054.     m$ = m$ + "22222222" + Chr$(13)
  5055.     m$ = m$ + "22222222" + Chr$(13)
  5056.     m$ = m$ + "22222222" + Chr$(13)
  5057.     arrTileText(162) = m$
  5058.  
  5059.     m$ = ""
  5060.     m$ = m$ + "22222222" + Chr$(13)
  5061.     m$ = m$ + "........" + Chr$(13)
  5062.     m$ = m$ + "........" + Chr$(13)
  5063.     m$ = m$ + "........" + Chr$(13)
  5064.     m$ = m$ + "........" + Chr$(13)
  5065.     m$ = m$ + "........" + Chr$(13)
  5066.     m$ = m$ + "........" + Chr$(13)
  5067.     m$ = m$ + "........" + Chr$(13)
  5068.     arrTileText(163) = m$
  5069.  
  5070.     m$ = ""
  5071.     m$ = m$ + "........" + Chr$(13)
  5072.     m$ = m$ + "........" + Chr$(13)
  5073.     m$ = m$ + "........" + Chr$(13)
  5074.     m$ = m$ + "........" + Chr$(13)
  5075.     m$ = m$ + "........" + Chr$(13)
  5076.     m$ = m$ + "........" + Chr$(13)
  5077.     m$ = m$ + "........" + Chr$(13)
  5078.     m$ = m$ + "22222222" + Chr$(13)
  5079.     arrTileText(164) = m$
  5080.  
  5081.     m$ = ""
  5082.     m$ = m$ + "22......" + Chr$(13)
  5083.     m$ = m$ + "22......" + Chr$(13)
  5084.     m$ = m$ + "22......" + Chr$(13)
  5085.     m$ = m$ + "22......" + Chr$(13)
  5086.     m$ = m$ + "22......" + Chr$(13)
  5087.     m$ = m$ + "22......" + Chr$(13)
  5088.     m$ = m$ + "22......" + Chr$(13)
  5089.     m$ = m$ + "22......" + Chr$(13)
  5090.     arrTileText(165) = m$
  5091.  
  5092.     m$ = ""
  5093.     m$ = m$ + "22..22.." + Chr$(13)
  5094.     m$ = m$ + "22..22.." + Chr$(13)
  5095.     m$ = m$ + "..22..22" + Chr$(13)
  5096.     m$ = m$ + "..22..22" + Chr$(13)
  5097.     m$ = m$ + "22..22.." + Chr$(13)
  5098.     m$ = m$ + "22..22.." + Chr$(13)
  5099.     m$ = m$ + "..22..22" + Chr$(13)
  5100.     m$ = m$ + "..22..22" + Chr$(13)
  5101.     arrTileText(166) = m$
  5102.  
  5103.     m$ = ""
  5104.     m$ = m$ + "......22" + Chr$(13)
  5105.     m$ = m$ + "......22" + Chr$(13)
  5106.     m$ = m$ + "......22" + Chr$(13)
  5107.     m$ = m$ + "......22" + Chr$(13)
  5108.     m$ = m$ + "......22" + Chr$(13)
  5109.     m$ = m$ + "......22" + Chr$(13)
  5110.     m$ = m$ + "......22" + Chr$(13)
  5111.     m$ = m$ + "......22" + Chr$(13)
  5112.     arrTileText(167) = m$
  5113.  
  5114.     m$ = ""
  5115.     m$ = m$ + "........" + Chr$(13)
  5116.     m$ = m$ + "........" + Chr$(13)
  5117.     m$ = m$ + "........" + Chr$(13)
  5118.     m$ = m$ + "........" + Chr$(13)
  5119.     m$ = m$ + "22..22.." + Chr$(13)
  5120.     m$ = m$ + "22..22.." + Chr$(13)
  5121.     m$ = m$ + "..22..22" + Chr$(13)
  5122.     m$ = m$ + "..22..22" + Chr$(13)
  5123.     arrTileText(168) = m$
  5124.  
  5125.     m$ = ""
  5126.     m$ = m$ + "22222222" + Chr$(13)
  5127.     m$ = m$ + "2222222." + Chr$(13)
  5128.     m$ = m$ + "222222.." + Chr$(13)
  5129.     m$ = m$ + "22222..." + Chr$(13)
  5130.     m$ = m$ + "2222...." + Chr$(13)
  5131.     m$ = m$ + "222....." + Chr$(13)
  5132.     m$ = m$ + "22......" + Chr$(13)
  5133.     m$ = m$ + "2......." + Chr$(13)
  5134.     arrTileText(169) = m$
  5135.  
  5136.     m$ = ""
  5137.     m$ = m$ + "......22" + Chr$(13)
  5138.     m$ = m$ + "......22" + Chr$(13)
  5139.     m$ = m$ + "......22" + Chr$(13)
  5140.     m$ = m$ + "......22" + Chr$(13)
  5141.     m$ = m$ + "......22" + Chr$(13)
  5142.     m$ = m$ + "......22" + Chr$(13)
  5143.     m$ = m$ + "......22" + Chr$(13)
  5144.     m$ = m$ + "......22" + Chr$(13)
  5145.     arrTileText(170) = m$
  5146.  
  5147.     m$ = ""
  5148.     m$ = m$ + "...22..." + Chr$(13)
  5149.     m$ = m$ + "...22..." + Chr$(13)
  5150.     m$ = m$ + "...22..." + Chr$(13)
  5151.     m$ = m$ + "...22222" + Chr$(13)
  5152.     m$ = m$ + "...22222" + Chr$(13)
  5153.     m$ = m$ + "...22..." + Chr$(13)
  5154.     m$ = m$ + "...22..." + Chr$(13)
  5155.     m$ = m$ + "...22..." + Chr$(13)
  5156.     arrTileText(171) = m$
  5157.  
  5158.     m$ = ""
  5159.     m$ = m$ + "........" + Chr$(13)
  5160.     m$ = m$ + "........" + Chr$(13)
  5161.     m$ = m$ + "........" + Chr$(13)
  5162.     m$ = m$ + "........" + Chr$(13)
  5163.     m$ = m$ + "....2222" + Chr$(13)
  5164.     m$ = m$ + "....2222" + Chr$(13)
  5165.     m$ = m$ + "....2222" + Chr$(13)
  5166.     m$ = m$ + "....2222" + Chr$(13)
  5167.     arrTileText(172) = m$
  5168.  
  5169.     m$ = ""
  5170.     m$ = m$ + "...22..." + Chr$(13)
  5171.     m$ = m$ + "...22..." + Chr$(13)
  5172.     m$ = m$ + "...22..." + Chr$(13)
  5173.     m$ = m$ + "...22222" + Chr$(13)
  5174.     m$ = m$ + "...22222" + Chr$(13)
  5175.     m$ = m$ + "........" + Chr$(13)
  5176.     m$ = m$ + "........" + Chr$(13)
  5177.     m$ = m$ + "........" + Chr$(13)
  5178.     arrTileText(173) = m$
  5179.  
  5180.     m$ = ""
  5181.     m$ = m$ + "........" + Chr$(13)
  5182.     m$ = m$ + "........" + Chr$(13)
  5183.     m$ = m$ + "........" + Chr$(13)
  5184.     m$ = m$ + "22222..." + Chr$(13)
  5185.     m$ = m$ + "22222..." + Chr$(13)
  5186.     m$ = m$ + "...22..." + Chr$(13)
  5187.     m$ = m$ + "...22..." + Chr$(13)
  5188.     m$ = m$ + "...22..." + Chr$(13)
  5189.     arrTileText(174) = m$
  5190.  
  5191.     m$ = ""
  5192.     m$ = m$ + "........" + Chr$(13)
  5193.     m$ = m$ + "........" + Chr$(13)
  5194.     m$ = m$ + "........" + Chr$(13)
  5195.     m$ = m$ + "........" + Chr$(13)
  5196.     m$ = m$ + "........" + Chr$(13)
  5197.     m$ = m$ + "........" + Chr$(13)
  5198.     m$ = m$ + "22222222" + Chr$(13)
  5199.     m$ = m$ + "22222222" + Chr$(13)
  5200.     arrTileText(175) = m$
  5201.  
  5202.     m$ = ""
  5203.     m$ = m$ + "........" + Chr$(13)
  5204.     m$ = m$ + "........" + Chr$(13)
  5205.     m$ = m$ + "........" + Chr$(13)
  5206.     m$ = m$ + "...22222" + Chr$(13)
  5207.     m$ = m$ + "...22222" + Chr$(13)
  5208.     m$ = m$ + "...22..." + Chr$(13)
  5209.     m$ = m$ + "...22..." + Chr$(13)
  5210.     m$ = m$ + "...22..." + Chr$(13)
  5211.     arrTileText(176) = m$
  5212.  
  5213.     m$ = ""
  5214.     m$ = m$ + "...22..." + Chr$(13)
  5215.     m$ = m$ + "...22..." + Chr$(13)
  5216.     m$ = m$ + "...22..." + Chr$(13)
  5217.     m$ = m$ + "22222222" + Chr$(13)
  5218.     m$ = m$ + "22222222" + Chr$(13)
  5219.     m$ = m$ + "........" + Chr$(13)
  5220.     m$ = m$ + "........" + Chr$(13)
  5221.     m$ = m$ + "........" + Chr$(13)
  5222.     arrTileText(177) = m$
  5223.  
  5224.     m$ = ""
  5225.     m$ = m$ + "........" + Chr$(13)
  5226.     m$ = m$ + "........" + Chr$(13)
  5227.     m$ = m$ + "........" + Chr$(13)
  5228.     m$ = m$ + "22222222" + Chr$(13)
  5229.     m$ = m$ + "22222222" + Chr$(13)
  5230.     m$ = m$ + "...22..." + Chr$(13)
  5231.     m$ = m$ + "...22..." + Chr$(13)
  5232.     m$ = m$ + "...22..." + Chr$(13)
  5233.     arrTileText(178) = m$
  5234.  
  5235.     m$ = ""
  5236.     m$ = m$ + "...22..." + Chr$(13)
  5237.     m$ = m$ + "...22..." + Chr$(13)
  5238.     m$ = m$ + "...22..." + Chr$(13)
  5239.     m$ = m$ + "22222..." + Chr$(13)
  5240.     m$ = m$ + "22222..." + Chr$(13)
  5241.     m$ = m$ + "...22..." + Chr$(13)
  5242.     m$ = m$ + "...22..." + Chr$(13)
  5243.     m$ = m$ + "...22..." + Chr$(13)
  5244.     arrTileText(179) = m$
  5245.  
  5246.     m$ = ""
  5247.     m$ = m$ + "22......" + Chr$(13)
  5248.     m$ = m$ + "22......" + Chr$(13)
  5249.     m$ = m$ + "22......" + Chr$(13)
  5250.     m$ = m$ + "22......" + Chr$(13)
  5251.     m$ = m$ + "22......" + Chr$(13)
  5252.     m$ = m$ + "22......" + Chr$(13)
  5253.     m$ = m$ + "22......" + Chr$(13)
  5254.     m$ = m$ + "22......" + Chr$(13)
  5255.     arrTileText(180) = m$
  5256.  
  5257.     m$ = ""
  5258.     m$ = m$ + "222....." + Chr$(13)
  5259.     m$ = m$ + "222....." + Chr$(13)
  5260.     m$ = m$ + "222....." + Chr$(13)
  5261.     m$ = m$ + "222....." + Chr$(13)
  5262.     m$ = m$ + "222....." + Chr$(13)
  5263.     m$ = m$ + "222....." + Chr$(13)
  5264.     m$ = m$ + "222....." + Chr$(13)
  5265.     m$ = m$ + "222....." + Chr$(13)
  5266.     arrTileText(181) = m$
  5267.  
  5268.     m$ = ""
  5269.     m$ = m$ + ".....222" + Chr$(13)
  5270.     m$ = m$ + ".....222" + Chr$(13)
  5271.     m$ = m$ + ".....222" + Chr$(13)
  5272.     m$ = m$ + ".....222" + Chr$(13)
  5273.     m$ = m$ + ".....222" + Chr$(13)
  5274.     m$ = m$ + ".....222" + Chr$(13)
  5275.     m$ = m$ + ".....222" + Chr$(13)
  5276.     m$ = m$ + ".....222" + Chr$(13)
  5277.     arrTileText(182) = m$
  5278.  
  5279.     m$ = ""
  5280.     m$ = m$ + "22222222" + Chr$(13)
  5281.     m$ = m$ + "22222222" + Chr$(13)
  5282.     m$ = m$ + "........" + Chr$(13)
  5283.     m$ = m$ + "........" + Chr$(13)
  5284.     m$ = m$ + "........" + Chr$(13)
  5285.     m$ = m$ + "........" + Chr$(13)
  5286.     m$ = m$ + "........" + Chr$(13)
  5287.     m$ = m$ + "........" + Chr$(13)
  5288.     arrTileText(183) = m$
  5289.  
  5290.     m$ = ""
  5291.     m$ = m$ + "22222222" + Chr$(13)
  5292.     m$ = m$ + "22222222" + Chr$(13)
  5293.     m$ = m$ + "22222222" + Chr$(13)
  5294.     m$ = m$ + "........" + Chr$(13)
  5295.     m$ = m$ + "........" + Chr$(13)
  5296.     m$ = m$ + "........" + Chr$(13)
  5297.     m$ = m$ + "........" + Chr$(13)
  5298.     m$ = m$ + "........" + Chr$(13)
  5299.     arrTileText(184) = m$
  5300.  
  5301.     m$ = ""
  5302.     m$ = m$ + "........" + Chr$(13)
  5303.     m$ = m$ + "........" + Chr$(13)
  5304.     m$ = m$ + "........" + Chr$(13)
  5305.     m$ = m$ + "........" + Chr$(13)
  5306.     m$ = m$ + "........" + Chr$(13)
  5307.     m$ = m$ + "22222222" + Chr$(13)
  5308.     m$ = m$ + "22222222" + Chr$(13)
  5309.     m$ = m$ + "22222222" + Chr$(13)
  5310.     arrTileText(185) = m$
  5311.  
  5312.     m$ = ""
  5313.     m$ = m$ + "......22" + Chr$(13)
  5314.     m$ = m$ + "......22" + Chr$(13)
  5315.     m$ = m$ + "......22" + Chr$(13)
  5316.     m$ = m$ + "......22" + Chr$(13)
  5317.     m$ = m$ + "......22" + Chr$(13)
  5318.     m$ = m$ + "......22" + Chr$(13)
  5319.     m$ = m$ + "22222222" + Chr$(13)
  5320.     m$ = m$ + "22222222" + Chr$(13)
  5321.     arrTileText(186) = m$
  5322.  
  5323.     m$ = ""
  5324.     m$ = m$ + "........" + Chr$(13)
  5325.     m$ = m$ + "........" + Chr$(13)
  5326.     m$ = m$ + "........" + Chr$(13)
  5327.     m$ = m$ + "........" + Chr$(13)
  5328.     m$ = m$ + "2222...." + Chr$(13)
  5329.     m$ = m$ + "2222...." + Chr$(13)
  5330.     m$ = m$ + "2222...." + Chr$(13)
  5331.     m$ = m$ + "2222...." + Chr$(13)
  5332.     arrTileText(187) = m$
  5333.  
  5334.     m$ = ""
  5335.     m$ = m$ + "....2222" + Chr$(13)
  5336.     m$ = m$ + "....2222" + Chr$(13)
  5337.     m$ = m$ + "....2222" + Chr$(13)
  5338.     m$ = m$ + "....2222" + Chr$(13)
  5339.     m$ = m$ + "........" + Chr$(13)
  5340.     m$ = m$ + "........" + Chr$(13)
  5341.     m$ = m$ + "........" + Chr$(13)
  5342.     m$ = m$ + "........" + Chr$(13)
  5343.     arrTileText(188) = m$
  5344.  
  5345.     m$ = ""
  5346.     m$ = m$ + "...22..." + Chr$(13)
  5347.     m$ = m$ + "...22..." + Chr$(13)
  5348.     m$ = m$ + "...22..." + Chr$(13)
  5349.     m$ = m$ + "22222..." + Chr$(13)
  5350.     m$ = m$ + "22222..." + Chr$(13)
  5351.     m$ = m$ + "........" + Chr$(13)
  5352.     m$ = m$ + "........" + Chr$(13)
  5353.     m$ = m$ + "........" + Chr$(13)
  5354.     arrTileText(189) = m$
  5355.  
  5356.     m$ = ""
  5357.     m$ = m$ + "2222...." + Chr$(13)
  5358.     m$ = m$ + "2222...." + Chr$(13)
  5359.     m$ = m$ + "2222...." + Chr$(13)
  5360.     m$ = m$ + "2222...." + Chr$(13)
  5361.     m$ = m$ + "........" + Chr$(13)
  5362.     m$ = m$ + "........" + Chr$(13)
  5363.     m$ = m$ + "........" + Chr$(13)
  5364.     m$ = m$ + "........" + Chr$(13)
  5365.     arrTileText(190) = m$
  5366.  
  5367.     m$ = ""
  5368.     m$ = m$ + "2222...." + Chr$(13)
  5369.     m$ = m$ + "2222...." + Chr$(13)
  5370.     m$ = m$ + "2222...." + Chr$(13)
  5371.     m$ = m$ + "2222...." + Chr$(13)
  5372.     m$ = m$ + "....2222" + Chr$(13)
  5373.     m$ = m$ + "....2222" + Chr$(13)
  5374.     m$ = m$ + "....2222" + Chr$(13)
  5375.     m$ = m$ + "....2222" + Chr$(13)
  5376.     arrTileText(191) = m$
  5377.  
  5378.     m$ = ""
  5379.     m$ = m$ + "........" + Chr$(13)
  5380.     m$ = m$ + ".2222222" + Chr$(13)
  5381.     m$ = m$ + ".2.....2" + Chr$(13)
  5382.     m$ = m$ + ".2.....2" + Chr$(13)
  5383.     m$ = m$ + ".2.....2" + Chr$(13)
  5384.     m$ = m$ + ".2.....2" + Chr$(13)
  5385.     m$ = m$ + ".2.....2" + Chr$(13)
  5386.     m$ = m$ + ".2222222" + Chr$(13)
  5387.     arrTileText(192) = m$
  5388.  
  5389.     m$ = ""
  5390.     m$ = m$ + "........" + Chr$(13)
  5391.     m$ = m$ + ".2222222" + Chr$(13)
  5392.     m$ = m$ + ".2222222" + Chr$(13)
  5393.     m$ = m$ + ".2222222" + Chr$(13)
  5394.     m$ = m$ + ".2222222" + Chr$(13)
  5395.     m$ = m$ + ".2222222" + Chr$(13)
  5396.     m$ = m$ + ".2222222" + Chr$(13)
  5397.     m$ = m$ + ".2222222" + Chr$(13)
  5398.     arrTileText(193) = m$
  5399.  
  5400.     m$ = ""
  5401.     m$ = m$ + "........" + Chr$(13)
  5402.     m$ = m$ + "...22..." + Chr$(13)
  5403.     m$ = m$ + "..2222.." + Chr$(13)
  5404.     m$ = m$ + ".222222." + Chr$(13)
  5405.     m$ = m$ + "...22..." + Chr$(13)
  5406.     m$ = m$ + "...22..." + Chr$(13)
  5407.     m$ = m$ + "...22..." + Chr$(13)
  5408.     m$ = m$ + "...22..." + Chr$(13)
  5409.     arrTileText(194) = m$
  5410.  
  5411.     m$ = ""
  5412.     m$ = m$ + "........" + Chr$(13)
  5413.     m$ = m$ + "...22..." + Chr$(13)
  5414.     m$ = m$ + "...22..." + Chr$(13)
  5415.     m$ = m$ + "...22..." + Chr$(13)
  5416.     m$ = m$ + "...22..." + Chr$(13)
  5417.     m$ = m$ + ".222222." + Chr$(13)
  5418.     m$ = m$ + "..2222.." + Chr$(13)
  5419.     m$ = m$ + "...22..." + Chr$(13)
  5420.     arrTileText(195) = m$
  5421.  
  5422.     m$ = ""
  5423.     m$ = m$ + "........" + Chr$(13)
  5424.     m$ = m$ + "...2...." + Chr$(13)
  5425.     m$ = m$ + "..22...." + Chr$(13)
  5426.     m$ = m$ + ".2222222" + Chr$(13)
  5427.     m$ = m$ + ".2222222" + Chr$(13)
  5428.     m$ = m$ + "..22...." + Chr$(13)
  5429.     m$ = m$ + "...2...." + Chr$(13)
  5430.     m$ = m$ + "........" + Chr$(13)
  5431.     arrTileText(196) = m$
  5432.  
  5433.     m$ = ""
  5434.     m$ = m$ + "........" + Chr$(13)
  5435.     m$ = m$ + ".....2.." + Chr$(13)
  5436.     m$ = m$ + ".....22." + Chr$(13)
  5437.     m$ = m$ + ".2222222" + Chr$(13)
  5438.     m$ = m$ + ".2222222" + Chr$(13)
  5439.     m$ = m$ + ".....22." + Chr$(13)
  5440.     m$ = m$ + ".....2.." + Chr$(13)
  5441.     m$ = m$ + "........" + Chr$(13)
  5442.     arrTileText(197) = m$
  5443.  
  5444.     m$ = ""
  5445.     m$ = m$ + "........" + Chr$(13)
  5446.     m$ = m$ + "........" + Chr$(13)
  5447.     m$ = m$ + "........" + Chr$(13)
  5448.     m$ = m$ + "........" + Chr$(13)
  5449.     m$ = m$ + "........" + Chr$(13)
  5450.     m$ = m$ + "........" + Chr$(13)
  5451.     m$ = m$ + "........" + Chr$(13)
  5452.     m$ = m$ + "........" + Chr$(13)
  5453.     arrTileText(198) = m$
  5454.  
  5455.     m$ = ""
  5456.     m$ = m$ + ".222222." + Chr$(13)
  5457.     m$ = m$ + "2......2" + Chr$(13)
  5458.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5459.     m$ = m$ + "2......2" + Chr$(13)
  5460.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5461.     m$ = m$ + "2.2222.2" + Chr$(13)
  5462.     m$ = m$ + "2......2" + Chr$(13)
  5463.     m$ = m$ + ".222222." + Chr$(13)
  5464.     arrTileText(199) = m$
  5465.  
  5466.     m$ = ""
  5467.     m$ = m$ + ".222222." + Chr$(13)
  5468.     m$ = m$ + "2......2" + Chr$(13)
  5469.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5470.     m$ = m$ + "2......2" + Chr$(13)
  5471.     m$ = m$ + "2.2222.2" + Chr$(13)
  5472.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5473.     m$ = m$ + "2......2" + Chr$(13)
  5474.     m$ = m$ + ".222222." + Chr$(13)
  5475.     arrTileText(200) = m$
  5476.  
  5477.     m$ = ""
  5478.     m$ = m$ + "........" + Chr$(13)
  5479.     m$ = m$ + "........" + Chr$(13)
  5480.     m$ = m$ + "........" + Chr$(13)
  5481.     m$ = m$ + "........" + Chr$(13)
  5482.     m$ = m$ + "........" + Chr$(13)
  5483.     m$ = m$ + "........" + Chr$(13)
  5484.     m$ = m$ + "........" + Chr$(13)
  5485.     m$ = m$ + "........" + Chr$(13)
  5486.     arrTileText(201) = m$
  5487.  
  5488.     m$ = ""
  5489.     m$ = m$ + ".222222." + Chr$(13)
  5490.     m$ = m$ + ".....22." + Chr$(13)
  5491.     m$ = m$ + "....22.." + Chr$(13)
  5492.     m$ = m$ + "...22..." + Chr$(13)
  5493.     m$ = m$ + "..22...." + Chr$(13)
  5494.     m$ = m$ + ".22....." + Chr$(13)
  5495.     m$ = m$ + ".222222." + Chr$(13)
  5496.     m$ = m$ + "........" + Chr$(13)
  5497.     arrTileText(202) = m$
  5498.  
  5499.     m$ = ""
  5500.     m$ = m$ + "...22..." + Chr$(13)
  5501.     m$ = m$ + "...22..." + Chr$(13)
  5502.     m$ = m$ + "...22..." + Chr$(13)
  5503.     m$ = m$ + "22222222" + Chr$(13)
  5504.     m$ = m$ + "22222222" + Chr$(13)
  5505.     m$ = m$ + "...22..." + Chr$(13)
  5506.     m$ = m$ + "...22..." + Chr$(13)
  5507.     m$ = m$ + "...22..." + Chr$(13)
  5508.     arrTileText(203) = m$
  5509.  
  5510.     m$ = ""
  5511.     m$ = m$ + "22......" + Chr$(13)
  5512.     m$ = m$ + "22......" + Chr$(13)
  5513.     m$ = m$ + "..22...." + Chr$(13)
  5514.     m$ = m$ + "..22...." + Chr$(13)
  5515.     m$ = m$ + "22......" + Chr$(13)
  5516.     m$ = m$ + "22......" + Chr$(13)
  5517.     m$ = m$ + "..22...." + Chr$(13)
  5518.     m$ = m$ + "..22...." + Chr$(13)
  5519.     arrTileText(204) = m$
  5520.  
  5521.     m$ = ""
  5522.     m$ = m$ + "...22..." + Chr$(13)
  5523.     m$ = m$ + "...22..." + Chr$(13)
  5524.     m$ = m$ + "...22..." + Chr$(13)
  5525.     m$ = m$ + "...22..." + Chr$(13)
  5526.     m$ = m$ + "...22..." + Chr$(13)
  5527.     m$ = m$ + "...22..." + Chr$(13)
  5528.     m$ = m$ + "...22..." + Chr$(13)
  5529.     m$ = m$ + "...22..." + Chr$(13)
  5530.     arrTileText(205) = m$
  5531.  
  5532.     m$ = ""
  5533.     m$ = m$ + "..22..22" + Chr$(13)
  5534.     m$ = m$ + "..22..22" + Chr$(13)
  5535.     m$ = m$ + "22..22.." + Chr$(13)
  5536.     m$ = m$ + "22..22.." + Chr$(13)
  5537.     m$ = m$ + "..22..22" + Chr$(13)
  5538.     m$ = m$ + "..22..22" + Chr$(13)
  5539.     m$ = m$ + "22..22.." + Chr$(13)
  5540.     m$ = m$ + "22..22.." + Chr$(13)
  5541.     arrTileText(206) = m$
  5542.  
  5543.     m$ = ""
  5544.     m$ = m$ + "..22..22" + Chr$(13)
  5545.     m$ = m$ + "2..22..2" + Chr$(13)
  5546.     m$ = m$ + "22..22.." + Chr$(13)
  5547.     m$ = m$ + ".22..22." + Chr$(13)
  5548.     m$ = m$ + "..22..22" + Chr$(13)
  5549.     m$ = m$ + "2..22..2" + Chr$(13)
  5550.     m$ = m$ + "22..22.." + Chr$(13)
  5551.     m$ = m$ + ".22..22." + Chr$(13)
  5552.     arrTileText(207) = m$
  5553.  
  5554.     m$ = ""
  5555.     m$ = m$ + "........" + Chr$(13)
  5556.     m$ = m$ + "........" + Chr$(13)
  5557.     m$ = m$ + "........" + Chr$(13)
  5558.     m$ = m$ + "........" + Chr$(13)
  5559.     m$ = m$ + "........" + Chr$(13)
  5560.     m$ = m$ + "........" + Chr$(13)
  5561.     m$ = m$ + "........" + Chr$(13)
  5562.     m$ = m$ + "........" + Chr$(13)
  5563.     arrTileText(208) = m$
  5564.  
  5565.     m$ = ""
  5566.     m$ = m$ + "2222...." + Chr$(13)
  5567.     m$ = m$ + "2222...." + Chr$(13)
  5568.     m$ = m$ + "2222...." + Chr$(13)
  5569.     m$ = m$ + "2222...." + Chr$(13)
  5570.     m$ = m$ + "2222...." + Chr$(13)
  5571.     m$ = m$ + "2222...." + Chr$(13)
  5572.     m$ = m$ + "2222...." + Chr$(13)
  5573.     m$ = m$ + "2222...." + Chr$(13)
  5574.     arrTileText(209) = m$
  5575.  
  5576.     m$ = ""
  5577.     m$ = m$ + "........" + Chr$(13)
  5578.     m$ = m$ + "........" + Chr$(13)
  5579.     m$ = m$ + "........" + Chr$(13)
  5580.     m$ = m$ + "........" + Chr$(13)
  5581.     m$ = m$ + "22222222" + Chr$(13)
  5582.     m$ = m$ + "22222222" + Chr$(13)
  5583.     m$ = m$ + "22222222" + Chr$(13)
  5584.     m$ = m$ + "22222222" + Chr$(13)
  5585.     arrTileText(210) = m$
  5586.  
  5587.     m$ = ""
  5588.     m$ = m$ + "22222222" + Chr$(13)
  5589.     m$ = m$ + "........" + Chr$(13)
  5590.     m$ = m$ + "........" + Chr$(13)
  5591.     m$ = m$ + "........" + Chr$(13)
  5592.     m$ = m$ + "........" + Chr$(13)
  5593.     m$ = m$ + "........" + Chr$(13)
  5594.     m$ = m$ + "........" + Chr$(13)
  5595.     m$ = m$ + "........" + Chr$(13)
  5596.     arrTileText(211) = m$
  5597.  
  5598.     m$ = ""
  5599.     m$ = m$ + "........" + Chr$(13)
  5600.     m$ = m$ + "........" + Chr$(13)
  5601.     m$ = m$ + "........" + Chr$(13)
  5602.     m$ = m$ + "........" + Chr$(13)
  5603.     m$ = m$ + "........" + Chr$(13)
  5604.     m$ = m$ + "........" + Chr$(13)
  5605.     m$ = m$ + "........" + Chr$(13)
  5606.     m$ = m$ + "22222222" + Chr$(13)
  5607.     arrTileText(212) = m$
  5608.  
  5609.     m$ = ""
  5610.     m$ = m$ + "22......" + Chr$(13)
  5611.     m$ = m$ + "22......" + Chr$(13)
  5612.     m$ = m$ + "22......" + Chr$(13)
  5613.     m$ = m$ + "22......" + Chr$(13)
  5614.     m$ = m$ + "22......" + Chr$(13)
  5615.     m$ = m$ + "22......" + Chr$(13)
  5616.     m$ = m$ + "22......" + Chr$(13)
  5617.     m$ = m$ + "22......" + Chr$(13)
  5618.     arrTileText(213) = m$
  5619.  
  5620.     m$ = ""
  5621.     m$ = m$ + "22..22.." + Chr$(13)
  5622.     m$ = m$ + "22..22.." + Chr$(13)
  5623.     m$ = m$ + "..22..22" + Chr$(13)
  5624.     m$ = m$ + "..22..22" + Chr$(13)
  5625.     m$ = m$ + "22..22.." + Chr$(13)
  5626.     m$ = m$ + "22..22.." + Chr$(13)
  5627.     m$ = m$ + "..22..22" + Chr$(13)
  5628.     m$ = m$ + "..22..22" + Chr$(13)
  5629.     arrTileText(214) = m$
  5630.  
  5631.     m$ = ""
  5632.     m$ = m$ + "......22" + Chr$(13)
  5633.     m$ = m$ + "......22" + Chr$(13)
  5634.     m$ = m$ + "......22" + Chr$(13)
  5635.     m$ = m$ + "......22" + Chr$(13)
  5636.     m$ = m$ + "......22" + Chr$(13)
  5637.     m$ = m$ + "......22" + Chr$(13)
  5638.     m$ = m$ + "......22" + Chr$(13)
  5639.     m$ = m$ + "......22" + Chr$(13)
  5640.     arrTileText(215) = m$
  5641.  
  5642.     m$ = ""
  5643.     m$ = m$ + "........" + Chr$(13)
  5644.     m$ = m$ + "........" + Chr$(13)
  5645.     m$ = m$ + "........" + Chr$(13)
  5646.     m$ = m$ + "........" + Chr$(13)
  5647.     m$ = m$ + "22..22.." + Chr$(13)
  5648.     m$ = m$ + "22..22.." + Chr$(13)
  5649.     m$ = m$ + "..22..22" + Chr$(13)
  5650.     m$ = m$ + "..22..22" + Chr$(13)
  5651.     arrTileText(216) = m$
  5652.  
  5653.     m$ = ""
  5654.     m$ = m$ + "22..22.." + Chr$(13)
  5655.     m$ = m$ + "2..22..2" + Chr$(13)
  5656.     m$ = m$ + "..22..22" + Chr$(13)
  5657.     m$ = m$ + ".22..22." + Chr$(13)
  5658.     m$ = m$ + "22..22.." + Chr$(13)
  5659.     m$ = m$ + "2..22..2" + Chr$(13)
  5660.     m$ = m$ + "..22..22" + Chr$(13)
  5661.     m$ = m$ + ".22..22." + Chr$(13)
  5662.     arrTileText(217) = m$
  5663.  
  5664.     m$ = ""
  5665.     m$ = m$ + "......22" + Chr$(13)
  5666.     m$ = m$ + "......22" + Chr$(13)
  5667.     m$ = m$ + "......22" + Chr$(13)
  5668.     m$ = m$ + "......22" + Chr$(13)
  5669.     m$ = m$ + "......22" + Chr$(13)
  5670.     m$ = m$ + "......22" + Chr$(13)
  5671.     m$ = m$ + "......22" + Chr$(13)
  5672.     m$ = m$ + "......22" + Chr$(13)
  5673.     arrTileText(218) = m$
  5674.  
  5675.     m$ = ""
  5676.     m$ = m$ + "...22..." + Chr$(13)
  5677.     m$ = m$ + "...22..." + Chr$(13)
  5678.     m$ = m$ + "...22..." + Chr$(13)
  5679.     m$ = m$ + "...22222" + Chr$(13)
  5680.     m$ = m$ + "...22222" + Chr$(13)
  5681.     m$ = m$ + "...22..." + Chr$(13)
  5682.     m$ = m$ + "...22..." + Chr$(13)
  5683.     m$ = m$ + "...22..." + Chr$(13)
  5684.     arrTileText(219) = m$
  5685.  
  5686.     m$ = ""
  5687.     m$ = m$ + "........" + Chr$(13)
  5688.     m$ = m$ + "........" + Chr$(13)
  5689.     m$ = m$ + "........" + Chr$(13)
  5690.     m$ = m$ + "........" + Chr$(13)
  5691.     m$ = m$ + "....2222" + Chr$(13)
  5692.     m$ = m$ + "....2222" + Chr$(13)
  5693.     m$ = m$ + "....2222" + Chr$(13)
  5694.     m$ = m$ + "....2222" + Chr$(13)
  5695.     arrTileText(220) = m$
  5696.  
  5697.     m$ = ""
  5698.     m$ = m$ + "...22..." + Chr$(13)
  5699.     m$ = m$ + "...22..." + Chr$(13)
  5700.     m$ = m$ + "...22..." + Chr$(13)
  5701.     m$ = m$ + "...22222" + Chr$(13)
  5702.     m$ = m$ + "...22222" + Chr$(13)
  5703.     m$ = m$ + "........" + Chr$(13)
  5704.     m$ = m$ + "........" + Chr$(13)
  5705.     m$ = m$ + "........" + Chr$(13)
  5706.     arrTileText(221) = m$
  5707.  
  5708.     m$ = ""
  5709.     m$ = m$ + "........" + Chr$(13)
  5710.     m$ = m$ + "........" + Chr$(13)
  5711.     m$ = m$ + "........" + Chr$(13)
  5712.     m$ = m$ + "22222..." + Chr$(13)
  5713.     m$ = m$ + "22222..." + Chr$(13)
  5714.     m$ = m$ + "...22..." + Chr$(13)
  5715.     m$ = m$ + "...22..." + Chr$(13)
  5716.     m$ = m$ + "...22..." + Chr$(13)
  5717.     arrTileText(222) = m$
  5718.  
  5719.     m$ = ""
  5720.     m$ = m$ + "........" + Chr$(13)
  5721.     m$ = m$ + "........" + Chr$(13)
  5722.     m$ = m$ + "........" + Chr$(13)
  5723.     m$ = m$ + "........" + Chr$(13)
  5724.     m$ = m$ + "........" + Chr$(13)
  5725.     m$ = m$ + "........" + Chr$(13)
  5726.     m$ = m$ + "22222222" + Chr$(13)
  5727.     m$ = m$ + "22222222" + Chr$(13)
  5728.     arrTileText(223) = m$
  5729.  
  5730.     m$ = ""
  5731.     m$ = m$ + "........" + Chr$(13)
  5732.     m$ = m$ + "........" + Chr$(13)
  5733.     m$ = m$ + "........" + Chr$(13)
  5734.     m$ = m$ + "...22222" + Chr$(13)
  5735.     m$ = m$ + "...22222" + Chr$(13)
  5736.     m$ = m$ + "...22..." + Chr$(13)
  5737.     m$ = m$ + "...22..." + Chr$(13)
  5738.     m$ = m$ + "...22..." + Chr$(13)
  5739.     arrTileText(224) = m$
  5740.  
  5741.     m$ = ""
  5742.     m$ = m$ + "...22..." + Chr$(13)
  5743.     m$ = m$ + "...22..." + Chr$(13)
  5744.     m$ = m$ + "...22..." + Chr$(13)
  5745.     m$ = m$ + "22222222" + Chr$(13)
  5746.     m$ = m$ + "22222222" + Chr$(13)
  5747.     m$ = m$ + "........" + Chr$(13)
  5748.     m$ = m$ + "........" + Chr$(13)
  5749.     m$ = m$ + "........" + Chr$(13)
  5750.     arrTileText(225) = m$
  5751.  
  5752.     m$ = ""
  5753.     m$ = m$ + "........" + Chr$(13)
  5754.     m$ = m$ + "........" + Chr$(13)
  5755.     m$ = m$ + "........" + Chr$(13)
  5756.     m$ = m$ + "22222222" + Chr$(13)
  5757.     m$ = m$ + "22222222" + Chr$(13)
  5758.     m$ = m$ + "...22..." + Chr$(13)
  5759.     m$ = m$ + "...22..." + Chr$(13)
  5760.     m$ = m$ + "...22..." + Chr$(13)
  5761.     arrTileText(226) = m$
  5762.  
  5763.     m$ = ""
  5764.     m$ = m$ + "...22..." + Chr$(13)
  5765.     m$ = m$ + "...22..." + Chr$(13)
  5766.     m$ = m$ + "...22..." + Chr$(13)
  5767.     m$ = m$ + "22222..." + Chr$(13)
  5768.     m$ = m$ + "22222..." + Chr$(13)
  5769.     m$ = m$ + "...22..." + Chr$(13)
  5770.     m$ = m$ + "...22..." + Chr$(13)
  5771.     m$ = m$ + "...22..." + Chr$(13)
  5772.     arrTileText(227) = m$
  5773.  
  5774.     m$ = ""
  5775.     m$ = m$ + "22......" + Chr$(13)
  5776.     m$ = m$ + "22......" + Chr$(13)
  5777.     m$ = m$ + "22......" + Chr$(13)
  5778.     m$ = m$ + "22......" + Chr$(13)
  5779.     m$ = m$ + "22......" + Chr$(13)
  5780.     m$ = m$ + "22......" + Chr$(13)
  5781.     m$ = m$ + "22......" + Chr$(13)
  5782.     m$ = m$ + "22......" + Chr$(13)
  5783.     arrTileText(228) = m$
  5784.  
  5785.     m$ = ""
  5786.     m$ = m$ + "222....." + Chr$(13)
  5787.     m$ = m$ + "222....." + Chr$(13)
  5788.     m$ = m$ + "222....." + Chr$(13)
  5789.     m$ = m$ + "222....." + Chr$(13)
  5790.     m$ = m$ + "222....." + Chr$(13)
  5791.     m$ = m$ + "222....." + Chr$(13)
  5792.     m$ = m$ + "222....." + Chr$(13)
  5793.     m$ = m$ + "222....." + Chr$(13)
  5794.     arrTileText(229) = m$
  5795.  
  5796.     m$ = ""
  5797.     m$ = m$ + ".....222" + Chr$(13)
  5798.     m$ = m$ + ".....222" + Chr$(13)
  5799.     m$ = m$ + ".....222" + Chr$(13)
  5800.     m$ = m$ + ".....222" + Chr$(13)
  5801.     m$ = m$ + ".....222" + Chr$(13)
  5802.     m$ = m$ + ".....222" + Chr$(13)
  5803.     m$ = m$ + ".....222" + Chr$(13)
  5804.     m$ = m$ + ".....222" + Chr$(13)
  5805.     arrTileText(230) = m$
  5806.  
  5807.     m$ = ""
  5808.     m$ = m$ + "22222222" + Chr$(13)
  5809.     m$ = m$ + "22222222" + Chr$(13)
  5810.     m$ = m$ + "........" + Chr$(13)
  5811.     m$ = m$ + "........" + Chr$(13)
  5812.     m$ = m$ + "........" + Chr$(13)
  5813.     m$ = m$ + "........" + Chr$(13)
  5814.     m$ = m$ + "........" + Chr$(13)
  5815.     m$ = m$ + "........" + Chr$(13)
  5816.     arrTileText(231) = m$
  5817.  
  5818.     m$ = ""
  5819.     m$ = m$ + "22222222" + Chr$(13)
  5820.     m$ = m$ + "22222222" + Chr$(13)
  5821.     m$ = m$ + "22222222" + Chr$(13)
  5822.     m$ = m$ + "........" + Chr$(13)
  5823.     m$ = m$ + "........" + Chr$(13)
  5824.     m$ = m$ + "........" + Chr$(13)
  5825.     m$ = m$ + "........" + Chr$(13)
  5826.     m$ = m$ + "........" + Chr$(13)
  5827.     arrTileText(232) = m$
  5828.  
  5829.     m$ = ""
  5830.     m$ = m$ + "........" + Chr$(13)
  5831.     m$ = m$ + "........" + Chr$(13)
  5832.     m$ = m$ + "........" + Chr$(13)
  5833.     m$ = m$ + "........" + Chr$(13)
  5834.     m$ = m$ + "........" + Chr$(13)
  5835.     m$ = m$ + "22222222" + Chr$(13)
  5836.     m$ = m$ + "22222222" + Chr$(13)
  5837.     m$ = m$ + "22222222" + Chr$(13)
  5838.     arrTileText(233) = m$
  5839.  
  5840.     m$ = ""
  5841.     m$ = m$ + ".......2" + Chr$(13)
  5842.     m$ = m$ + "......22" + Chr$(13)
  5843.     m$ = m$ + ".....22." + Chr$(13)
  5844.     m$ = m$ + ".22.22.." + Chr$(13)
  5845.     m$ = m$ + ".2222..." + Chr$(13)
  5846.     m$ = m$ + ".222...." + Chr$(13)
  5847.     m$ = m$ + ".22....." + Chr$(13)
  5848.     m$ = m$ + "........" + Chr$(13)
  5849.     arrTileText(234) = m$
  5850.  
  5851.     m$ = ""
  5852.     m$ = m$ + "........" + Chr$(13)
  5853.     m$ = m$ + "........" + Chr$(13)
  5854.     m$ = m$ + "........" + Chr$(13)
  5855.     m$ = m$ + "........" + Chr$(13)
  5856.     m$ = m$ + "2222...." + Chr$(13)
  5857.     m$ = m$ + "2222...." + Chr$(13)
  5858.     m$ = m$ + "2222...." + Chr$(13)
  5859.     m$ = m$ + "2222...." + Chr$(13)
  5860.     arrTileText(235) = m$
  5861.  
  5862.     m$ = ""
  5863.     m$ = m$ + "....2222" + Chr$(13)
  5864.     m$ = m$ + "....2222" + Chr$(13)
  5865.     m$ = m$ + "....2222" + Chr$(13)
  5866.     m$ = m$ + "....2222" + Chr$(13)
  5867.     m$ = m$ + "........" + Chr$(13)
  5868.     m$ = m$ + "........" + Chr$(13)
  5869.     m$ = m$ + "........" + Chr$(13)
  5870.     m$ = m$ + "........" + Chr$(13)
  5871.     arrTileText(236) = m$
  5872.  
  5873.     m$ = ""
  5874.     m$ = m$ + "...22..." + Chr$(13)
  5875.     m$ = m$ + "...22..." + Chr$(13)
  5876.     m$ = m$ + "...22..." + Chr$(13)
  5877.     m$ = m$ + "22222..." + Chr$(13)
  5878.     m$ = m$ + "22222..." + Chr$(13)
  5879.     m$ = m$ + "........" + Chr$(13)
  5880.     m$ = m$ + "........" + Chr$(13)
  5881.     m$ = m$ + "........" + Chr$(13)
  5882.     arrTileText(237) = m$
  5883.  
  5884.     m$ = ""
  5885.     m$ = m$ + "2222...." + Chr$(13)
  5886.     m$ = m$ + "2222...." + Chr$(13)
  5887.     m$ = m$ + "2222...." + Chr$(13)
  5888.     m$ = m$ + "2222...." + Chr$(13)
  5889.     m$ = m$ + "........" + Chr$(13)
  5890.     m$ = m$ + "........" + Chr$(13)
  5891.     m$ = m$ + "........" + Chr$(13)
  5892.     m$ = m$ + "........" + Chr$(13)
  5893.     arrTileText(238) = m$
  5894.  
  5895.     m$ = ""
  5896.     m$ = m$ + "2222...." + Chr$(13)
  5897.     m$ = m$ + "2222...." + Chr$(13)
  5898.     m$ = m$ + "2222...." + Chr$(13)
  5899.     m$ = m$ + "2222...." + Chr$(13)
  5900.     m$ = m$ + "....2222" + Chr$(13)
  5901.     m$ = m$ + "....2222" + Chr$(13)
  5902.     m$ = m$ + "....2222" + Chr$(13)
  5903.     m$ = m$ + "....2222" + Chr$(13)
  5904.     arrTileText(239) = m$
  5905.  
  5906.     m$ = ""
  5907.     m$ = m$ + "........" + Chr$(13)
  5908.     m$ = m$ + "........" + Chr$(13)
  5909.     m$ = m$ + "........" + Chr$(13)
  5910.     m$ = m$ + "........" + Chr$(13)
  5911.     m$ = m$ + "........" + Chr$(13)
  5912.     m$ = m$ + "........" + Chr$(13)
  5913.     m$ = m$ + "........" + Chr$(13)
  5914.     m$ = m$ + "........" + Chr$(13)
  5915.     arrTileText(240) = m$
  5916.  
  5917.     m$ = ""
  5918.     m$ = m$ + "22222.22" + Chr$(13)
  5919.     m$ = m$ + "22222.22" + Chr$(13)
  5920.     m$ = m$ + "22222.22" + Chr$(13)
  5921.     m$ = m$ + "........" + Chr$(13)
  5922.     m$ = m$ + "22.22222" + Chr$(13)
  5923.     m$ = m$ + "22.22222" + Chr$(13)
  5924.     m$ = m$ + "22.22222" + Chr$(13)
  5925.     m$ = m$ + "........" + Chr$(13)
  5926.     arrTileText(241) = m$
  5927.  
  5928.     m$ = ""
  5929.     m$ = m$ + "........" + Chr$(13)
  5930.     m$ = m$ + "........" + Chr$(13)
  5931.     m$ = m$ + "........" + Chr$(13)
  5932.     m$ = m$ + ".222222." + Chr$(13)
  5933.     m$ = m$ + "........" + Chr$(13)
  5934.     m$ = m$ + "........" + Chr$(13)
  5935.     m$ = m$ + "........" + Chr$(13)
  5936.     m$ = m$ + "........" + Chr$(13)
  5937.     arrTileText(242) = m$
  5938.  
  5939.     m$ = ""
  5940.     m$ = m$ + "........" + Chr$(13)
  5941.     m$ = m$ + "...2...." + Chr$(13)
  5942.     m$ = m$ + "...2...." + Chr$(13)
  5943.     m$ = m$ + "...2...." + Chr$(13)
  5944.     m$ = m$ + "...2...." + Chr$(13)
  5945.     m$ = m$ + "...2...." + Chr$(13)
  5946.     m$ = m$ + "...2...." + Chr$(13)
  5947.     m$ = m$ + "........" + Chr$(13)
  5948.     arrTileText(243) = m$
  5949.  
  5950.     m$ = ""
  5951.     m$ = m$ + "........" + Chr$(13)
  5952.     m$ = m$ + "........" + Chr$(13)
  5953.     m$ = m$ + "........" + Chr$(13)
  5954.     m$ = m$ + "...2222." + Chr$(13)
  5955.     m$ = m$ + "...2...." + Chr$(13)
  5956.     m$ = m$ + "...2...." + Chr$(13)
  5957.     m$ = m$ + "...2...." + Chr$(13)
  5958.     m$ = m$ + "........" + Chr$(13)
  5959.     arrTileText(244) = m$
  5960.  
  5961.     m$ = ""
  5962.     m$ = m$ + "........" + Chr$(13)
  5963.     m$ = m$ + "........" + Chr$(13)
  5964.     m$ = m$ + "........" + Chr$(13)
  5965.     m$ = m$ + ".222...." + Chr$(13)
  5966.     m$ = m$ + "...2...." + Chr$(13)
  5967.     m$ = m$ + "...2...." + Chr$(13)
  5968.     m$ = m$ + "...2...." + Chr$(13)
  5969.     m$ = m$ + "........" + Chr$(13)
  5970.     arrTileText(245) = m$
  5971.  
  5972.     m$ = ""
  5973.     m$ = m$ + "........" + Chr$(13)
  5974.     m$ = m$ + "...2...." + Chr$(13)
  5975.     m$ = m$ + "...2...." + Chr$(13)
  5976.     m$ = m$ + "...2222." + Chr$(13)
  5977.     m$ = m$ + "........" + Chr$(13)
  5978.     m$ = m$ + "........" + Chr$(13)
  5979.     m$ = m$ + "........" + Chr$(13)
  5980.     m$ = m$ + "........" + Chr$(13)
  5981.     arrTileText(246) = m$
  5982.  
  5983.     m$ = ""
  5984.     m$ = m$ + "........" + Chr$(13)
  5985.     m$ = m$ + "...2...." + Chr$(13)
  5986.     m$ = m$ + "...2...." + Chr$(13)
  5987.     m$ = m$ + ".222...." + Chr$(13)
  5988.     m$ = m$ + "........" + Chr$(13)
  5989.     m$ = m$ + "........" + Chr$(13)
  5990.     m$ = m$ + "........" + Chr$(13)
  5991.     m$ = m$ + "........" + Chr$(13)
  5992.     arrTileText(247) = m$
  5993.  
  5994.     m$ = ""
  5995.     m$ = m$ + "........" + Chr$(13)
  5996.     m$ = m$ + "........" + Chr$(13)
  5997.     m$ = m$ + "........" + Chr$(13)
  5998.     m$ = m$ + "........" + Chr$(13)
  5999.     m$ = m$ + "........" + Chr$(13)
  6000.     m$ = m$ + "........" + Chr$(13)
  6001.     m$ = m$ + "........" + Chr$(13)
  6002.     m$ = m$ + "........" + Chr$(13)
  6003.     arrTileText(248) = m$
  6004.  
  6005.     m$ = ""
  6006.     m$ = m$ + "........" + Chr$(13)
  6007.     m$ = m$ + "........" + Chr$(13)
  6008.     m$ = m$ + "........" + Chr$(13)
  6009.     m$ = m$ + "........" + Chr$(13)
  6010.     m$ = m$ + "........" + Chr$(13)
  6011.     m$ = m$ + "........" + Chr$(13)
  6012.     m$ = m$ + "........" + Chr$(13)
  6013.     m$ = m$ + "........" + Chr$(13)
  6014.     arrTileText(249) = m$
  6015.  
  6016.     m$ = ""
  6017.     m$ = m$ + "........" + Chr$(13)
  6018.     m$ = m$ + "........" + Chr$(13)
  6019.     m$ = m$ + "........" + Chr$(13)
  6020.     m$ = m$ + "........" + Chr$(13)
  6021.     m$ = m$ + "........" + Chr$(13)
  6022.     m$ = m$ + "........" + Chr$(13)
  6023.     m$ = m$ + "........" + Chr$(13)
  6024.     m$ = m$ + "........" + Chr$(13)
  6025.     arrTileText(250) = m$
  6026.  
  6027.     m$ = ""
  6028.     m$ = m$ + "........" + Chr$(13)
  6029.     m$ = m$ + "........" + Chr$(13)
  6030.     m$ = m$ + "........" + Chr$(13)
  6031.     m$ = m$ + "........" + Chr$(13)
  6032.     m$ = m$ + "........" + Chr$(13)
  6033.     m$ = m$ + "........" + Chr$(13)
  6034.     m$ = m$ + "........" + Chr$(13)
  6035.     m$ = m$ + "........" + Chr$(13)
  6036.     arrTileText(251) = m$
  6037.  
  6038.     m$ = ""
  6039.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6040.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6041.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6042.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6043.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6044.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6045.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6046.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6047.     arrTileText(252) = m$
  6048.  
  6049.     m$ = ""
  6050.     m$ = m$ + "22222222" + Chr$(13)
  6051.     m$ = m$ + "2......2" + Chr$(13)
  6052.     m$ = m$ + "2......2" + Chr$(13)
  6053.     m$ = m$ + "2......2" + Chr$(13)
  6054.     m$ = m$ + "2......2" + Chr$(13)
  6055.     m$ = m$ + "2......2" + Chr$(13)
  6056.     m$ = m$ + "2......2" + Chr$(13)
  6057.     m$ = m$ + "22222222" + Chr$(13)
  6058.     arrTileText(253) = m$
  6059.  
  6060.     m$ = ""
  6061.     m$ = m$ + "22222222" + Chr$(13)
  6062.     m$ = m$ + "22222222" + Chr$(13)
  6063.     m$ = m$ + "22222222" + Chr$(13)
  6064.     m$ = m$ + "22222222" + Chr$(13)
  6065.     m$ = m$ + "22222222" + Chr$(13)
  6066.     m$ = m$ + "22222222" + Chr$(13)
  6067.     m$ = m$ + "22222222" + Chr$(13)
  6068.     m$ = m$ + "22222222" + Chr$(13)
  6069.     arrTileText(254) = m$
  6070.  
  6071.     m$ = ""
  6072.     m$ = ""
  6073.     m$ = m$ + "22....22" + Chr$(13)
  6074.     m$ = m$ + "2..22..2" + Chr$(13)
  6075.     m$ = m$ + "2..22..2" + Chr$(13)
  6076.     m$ = m$ + "22.....2" + Chr$(13)
  6077.     m$ = m$ + "22222..2" + Chr$(13)
  6078.     m$ = m$ + "2..22..2" + Chr$(13)
  6079.     m$ = m$ + "22....22" + Chr$(13)
  6080.     m$ = m$ + "22222222" + Chr$(13)
  6081.     arrTileText(255) = m$
  6082.  
  6083. End Sub ' GetTileText
  6084.  
  6085. ' ################################################################################################################################################################
  6086. ' END TILE DEFINITIONS
  6087. ' ################################################################################################################################################################
  6088.  
  6089. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6090. ' BEGIN DEBUGGING ROUTINES #DEBUGGING
  6091. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6092.  
  6093. Sub DebugPrint (MyString As String)
  6094.     If m_bDebug = TRUE Then
  6095.         '_Echo MyString
  6096.  
  6097.         ReDim arrLines(-1) As String
  6098.         Dim iLoop As Integer
  6099.         split MyString, Chr$(13), arrLines()
  6100.         For iLoop = LBound(arrLines) To UBound(arrLines)
  6101.             _Echo arrLines(iLoop)
  6102.         Next iLoop
  6103.     End If
  6104. End Sub ' DebugPrint
  6105.  
  6106. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6107. ' END DEBUGGING ROUTINES @DEBUGGING
  6108. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6109.  
« Last Edit: March 01, 2022, 02:03:57 am by madscijr »

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #26 on: March 03, 2022, 11:24:55 pm »
@SMcNeill  @Pete
UPDATE:
Well, I got the tileset to rectangles working, and tried a couple of different ways to render the tiles.

Using Line to draw the rectangles, it is 2x faster than the original color tile drawing routine (_PutImage with ColorSwap). The pure hardware image one is still 10-20 times faster, but you have to pre draw the tileset in different colors (which isn't a deal breaker per se, just a complication).

Then I thought of using hardware _PutImage to render the tiles piece by piece, copying tiny rectangular pieces (1x1 upto 8x8) of a palette screen (which would just contain areas of color). This would combine the speed of hardware images with controlling the colors on the fly. I already have the code that analyzes a raster tileset and decomposes it into a minimum set of component rectangles. So that method works and is 2x faster than using Line, and 3-4x faster than the original _PutImage/ColorSwap. It is still only a fraction as fast as simple copy with hardware images, but it's over 3x faster than just drawing solid boxes with line, which is what my game was using to get more speed.

Next is to integrate Steve's custom screen into the speed tests and see how that does, apples-to-apples.

Results:
Code: [Select]
DrawTile8                  4,202 refreshes in 3 seconds.
DrawColorTile              1,825 refreshes in 3 seconds.
DrawTileHw8               26,108 refreshes in 3 seconds.
DrawVectorTileLine         3,775 refreshes in 3 seconds.
DrawVectorTilePutImage     2,979 refreshes in 3 seconds.
DrawVectorTilePutImageHW   6,440 refreshes in 3 seconds.
Solid boxes with line      1,979 refreshes in 3 seconds.

And the latest code with all the methods/examples/tests:
Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2. ' Speed tests and demos of various methods draw a 2-color 8x8 tile
  3.  
  4. ' From thread:
  5. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  6. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  7. ' ################################################################################################################################################################
  8.  
  9. ' ===============================================================================
  10. ' GLOBAL CONSTANTS
  11. ' ===============================================================================
  12. ' BOOLEAN VALUES
  13. Const FALSE = 0
  14. Const TRUE = Not FALSE
  15.  
  16. ' ===============================================================================
  17. ' USER DEFINED TYPES
  18. ' ===============================================================================
  19. ' UDT TO HOLD COORDINATES FOR DRAWING A RECTANGLE
  20. Type RectangleType
  21.     x1 As Integer ' start x
  22.     y1 As Integer ' start y
  23.     x2 As Integer ' end x
  24.     y2 As Integer ' end y
  25.     PixelCount As Integer
  26.     IsActive As Integer
  27. End Type ' RectangleType
  28.  
  29. Type DrawCompareType
  30.     IndexList As String
  31.     ShapeCount As Integer
  32.     PixelCount As Integer
  33.     IsActive As Integer
  34. End Type ' DrawCompareType
  35.  
  36. ' UDT FOR PRECALCULATED TILESHEET
  37. Type TileSheetMapType
  38.     xStart As Integer
  39.     xEnd As Integer
  40.     yStart As Integer
  41.     yEnd As Integer
  42.  
  43. ' UDT FOR PRECALCULATED TILE MAP
  44. Type TileMapType
  45.     xPos As Integer
  46.     yPos As Integer
  47.  
  48. ' ===============================================================================
  49. ' GLOBAL VARIABLES
  50. ' ===============================================================================
  51. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES CONSOLE WINDOW AND DebugPrint
  52. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  53. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  54. Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  55.  
  56. ' Used for Steve's very different custom screen:
  57. Dim Shared As Long TileHw, FontHw
  58. Dim Shared ScreenArray(99, 74) As _Unsigned Long ' Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  59.  
  60. ' ===============================================================================
  61. ' LOCAL VARIABLES
  62. ' ===============================================================================
  63. Dim in$
  64.  
  65. ' ****************************************************************************************************************************************************************
  66. ' ACTIVATE DEBUGGING WINDOW
  67. If m_bDebug = TRUE Then
  68.     $Console
  69.     _Delay 4
  70.     _Console On
  71.     _Echo "Started " + m_ProgramName$
  72.     _Echo "Debugging on..."
  73. ' ****************************************************************************************************************************************************************
  74.  
  75. ' ===============================================================================
  76. ' START THE MAIN ROUTINE
  77. ' ===============================================================================
  78. main
  79.  
  80. ' ===============================================================================
  81. ' FINISH
  82. ' ===============================================================================
  83. Print m_ProgramName$ + " finished."
  84. Input "Press <ENTER> to continue", in$
  85. ' ****************************************************************************************************************************************************************
  86. ' DEACTIVATE DEBUGGING WINDOW
  87. If m_bDebug = TRUE Then
  88. ' ****************************************************************************************************************************************************************
  89. System ' return control to the operating system
  90.  
  91. ' ################################################################################################################################################################
  92. ' BEGIN MAIN MENU
  93. ' ################################################################################################################################################################
  94.  
  95. ' /////////////////////////////////////////////////////////////////////////////
  96.  
  97. Sub main
  98.     Dim RoutineName As String: RoutineName = "main"
  99.     Dim in$
  100.     Dim bFinished As Integer: bFinished = FALSE
  101.     Dim result$: result$ = ""
  102.     Do
  103.         Screen 0: _ScreenMove 0, 0
  104.         Cls
  105.         Print m_ProgramName$
  106.         Print
  107.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  108.         Print
  109.  
  110.         Print "1) DrawingSpeedTest6"
  111.         Print
  112.         Print "2) HardwareImageDemo2"
  113.         Print
  114.         Print "3) GetAllPossibleShapesTest"
  115.         Print "4) FindOptimizedVectorTest - find minimum shapes to draw a tile"
  116.         Print "5) GetVectorTilesTest"
  117.         Print "6) MakePaletteImageTest"
  118.         Print "7) DrawVectorTilePutImageTest"
  119.         Print
  120.         Print "A) TestCustomHardwareScreen1"
  121.         Print "B) ^ instructions"
  122.         Print
  123.         Print "C) TestSoftwareScreen1"
  124.         Print "D) ^ instructions"
  125.         Print
  126.         Print "Q) Exit program"
  127.         Do
  128.             in$ = InKey$
  129.             If UCase$(in$) = "Q" Then
  130.                 bFinished = TRUE: Exit Do
  131.             ElseIf UCase$(in$) = "1" Then
  132.                 DrawingSpeedTest6: Exit Do
  133.             ElseIf UCase$(in$) = "2" Then
  134.                 HardwareImageDemo2: Exit Do
  135.             ElseIf UCase$(in$) = "3" Then
  136.                 GetAllPossibleShapesTest: Exit Do
  137.             ElseIf UCase$(in$) = "4" Then
  138.                 FindOptimizedVectorTest: Exit Do
  139.             ElseIf UCase$(in$) = "5" Then
  140.                 GetVectorTilesTest: Exit Do
  141.             ElseIf UCase$(in$) = "6" Then
  142.                 MakePaletteImageTest: Exit Do
  143.             ElseIf UCase$(in$) = "7" Then
  144.                 DrawVectorTilePutImageTest: Exit Do
  145.             ElseIf UCase$(in$) = "A" Then
  146.                 TestCustomHardwareScreen1: Exit Do
  147.             ElseIf UCase$(in$) = "B" Then
  148.                 ShowInstructions (GetInstructions1$): Exit Do
  149.             ElseIf UCase$(in$) = "C" Then
  150.                 TestSoftwareScreen1: Exit Do
  151.             ElseIf UCase$(in$) = "D" Then
  152.                 ShowInstructions (GetInstructions2$): Exit Do
  153.             End If
  154.         Loop
  155.     Loop Until bFinished = TRUE
  156. End Sub ' main
  157.  
  158. ' ################################################################################################################################################################
  159. ' END MAIN MENU
  160. ' ################################################################################################################################################################
  161.  
  162. ' ################################################################################################################################################################
  163. ' BEGIN DRAWING SPEED TEST
  164. ' ################################################################################################################################################################
  165.  
  166. ' /////////////////////////////////////////////////////////////////////////////
  167.  
  168. Sub DrawingSpeedTest6
  169.     Dim sError As String: sError = ""
  170.     Dim imgScreen As Long ' the main display
  171.     Dim imgHardwareScreen As Long ' copy of the software screen, transformed into a hardware image
  172.     Dim imgTiles As Long ' original tileset, black on transparent
  173.     Dim imgHardwareTiles As Long ' copy of the tileset, tranformed into a hardware image
  174.     Dim imgTilesRed As Long ' colored tileset copy
  175.     Dim imgTilesGreen As Long ' colored tileset copy
  176.     Dim imgTilesBlue As Long ' colored tileset copy
  177.     Dim imgTilesYellow As Long ' colored tileset copy
  178.     Dim imgColorTiles As Long ' holds 4 copies of tileset in different colors (red, green, blue, yellow)
  179.     Dim imgPalette As Long ' contains palette of colors
  180.     Dim imgPaletteHW As Long ' hardware image of palette of colors
  181.     Dim iTileNum As Integer
  182.     Dim iFgColorIndex As Integer: iFgColorIndex = 0
  183.     Dim iBgColorIndex As Integer: iBgColorIndex = 0
  184.     Dim iFirstColor As Integer: iFirstColor = 0
  185.     Dim iLastColor As Integer: iLastColor = 3
  186.     'Dim iCols As Integer
  187.     'Dim iRows As Integer
  188.     Dim iY As Integer
  189.     Dim iX As Integer
  190.     Dim fgColor As _Unsigned Long
  191.     Dim bgColor As _Unsigned Long
  192.     Dim iMinY As Integer
  193.     Dim iMaxY As Integer
  194.     Dim iMinX As Integer
  195.     Dim iMaxX As Integer
  196.     Dim iCount1 As Long
  197.     Dim iCount2 As Long
  198.     Dim iCount3 As Long
  199.     Dim iCount4 As Long
  200.     Dim iCount5 As Long
  201.     Dim iCount6 As Long
  202.     Dim iCount7 As Long
  203.     Dim t# ' for timer
  204.     Dim arrColor(0 To 5) As _Unsigned Long
  205.  
  206.     ' ================================================================================================================================================================
  207.     ' INIT SCREEN
  208.     ' ================================================================================================================================================================
  209.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  210.     Screen imgScreen
  211.     Cls , cGray
  212.  
  213.     'iCols = _Width(imgScreen) \ 8
  214.     'iRows = _Height(imgScreen) \ 8
  215.  
  216.     iMinX = 1: iMaxX = 16
  217.     iMinY = 3: iMaxY = 18
  218.  
  219.     ' ================================================================================================================================================================
  220.     ' INITIALIZE NEUTRAL COLOR GRAPHICS TILES (BLACK ON TRANSPARENT)
  221.     ' ================================================================================================================================================================
  222.     If Len(sError) = 0 Then
  223.         '' LOAD TILES (16 cols x 16 rows of 8x8 tiles) FROM FILE
  224.         'sFile$ = Left$(Command$(0), _InStrRev(Command$(0), "\")) + "Font_8x8_128x128_v3.png" ' 128x128 pixels, 16 rows x 16 columns of 8x8 tiles
  225.         'imgTiles = _LoadImage(sFile$, 32)
  226.  
  227.         ' LOAD TILES FROM TEXT DEFINITIONS IN Sub GetTileText
  228.         sError = GetTiles$(imgTiles, cBlack, cEmpty)
  229.     End If
  230.  
  231.     ' ================================================================================================================================================================
  232.     ' CREATE COLORED TILESET COPIES
  233.     ' ================================================================================================================================================================
  234.     If Len(sError) = 0 Then
  235.         MakeColoredTileset imgTiles, imgTilesRed, cRed, cBlack
  236.         MakeColoredTileset imgTiles, imgTilesGreen, cLime, cBlack
  237.         MakeColoredTileset imgTiles, imgTilesBlue, cBlue, cBlack
  238.         MakeColoredTileset imgTiles, imgTilesYellow, cYellow, cBlack
  239.  
  240.         ' Make one big tileset with all colors
  241.         imgColorTiles = _NewImage(512, 128, 32)
  242.         _PutImage (0, 0), imgTilesRed, imgColorTiles, (0, 0)-(128, 128)
  243.         _PutImage (128, 0), imgTilesGreen, imgColorTiles, (0, 0)-(128, 128)
  244.         _PutImage (256, 0), imgTilesBlue, imgColorTiles, (0, 0)-(128, 128)
  245.         _PutImage (384, 0), imgTilesYellow, imgColorTiles, (0, 0)-(128, 128)
  246.  
  247.         imgHardwareTiles = _CopyImage(imgColorTiles, 33) ' Copy tilesheet for hardware image
  248.     End If
  249.  
  250.     ' ================================================================================================================================================================
  251.     ' VECTOR TILES SETUP
  252.     ' ================================================================================================================================================================
  253.     If Len(sError) = 0 Then
  254.         ' set up vector tiles
  255.         GetVectorTiles
  256.  
  257.         ' set up colors for vector HW tiles
  258.         arrColor(0) = cRed
  259.         arrColor(1) = cLime
  260.         arrColor(2) = cBlue
  261.         arrColor(3) = cYellow
  262.         arrColor(4) = cBlack
  263.         arrColor(5) = cEmpty
  264.         MakePaletteImage imgPalette, arrColor()
  265.         _Dest imgScreen&
  266.  
  267.         imgPaletteHW = _CopyImage(imgPalette, 33) ' Copy palette for hardware image
  268.     End If
  269.  
  270.     ' ================================================================================================================================================================
  271.     ' METHOD #1
  272.     ' _PUTIMAGE with SOFTWARE IMAGES
  273.     ' ================================================================================================================================================================
  274.     If Len(sError) = 0 Then
  275.         Cls , cGray
  276.         Color cWhite, cBlack: Locate 1, 1: Print "Test #1: DrawTile8 routine using 4 tilesets (1 per color) and regular _putimage using using SOFTWARE images..."
  277.  
  278.         iCount1 = 0
  279.         t# = Timer + 3
  280.         Do
  281.             iCount1 = iCount1 + 1
  282.             iFirstColor = iFirstColor Xor 1
  283.             iFgColorIndex = iFirstColor
  284.             iY = iMinY
  285.             iX = iMinX
  286.             For iTileNum = 0 To 255
  287.                 Select Case iFgColorIndex
  288.                     Case 0:
  289.                         DrawTile8 imgTilesRed, iTileNum, imgScreen, iX, iY
  290.                     Case 1:
  291.                         DrawTile8 imgTilesGreen, iTileNum, imgScreen, iX, iY
  292.                     Case 2:
  293.                         DrawTile8 imgTilesBlue, iTileNum, imgScreen, iX, iY
  294.                     Case Else:
  295.                         DrawTile8 imgTilesYellow, iTileNum, imgScreen, iX, iY
  296.                 End Select
  297.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  298.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  299.             Next iTileNum
  300.             _Display
  301.         Loop Until Timer > t#
  302.         _AutoDisplay
  303.     End If
  304.  
  305.     ' ================================================================================================================================================================
  306.     ' METHOD #2
  307.     ' COLOR SWAP with SOFTWARE IMAGES
  308.     ' ================================================================================================================================================================
  309.     If Len(sError) = 0 Then
  310.         Cls , cGray
  311.         Color cWhite, cBlack: Locate 1, 1: Print "Test #2: DrawColorTile routine using 1 tileset with DoColorSwap using SOFTWARE images...";
  312.  
  313.         iCount2 = 0
  314.         t# = Timer + 3
  315.         Do
  316.             iCount2 = iCount2 + 1
  317.             iFirstColor = iFirstColor Xor 1
  318.             iFgColorIndex = iFirstColor
  319.             iY = iMinY
  320.             iX = iMinX
  321.             For iTileNum = 0 To 255
  322.                 Select Case iFgColorIndex
  323.                     Case 0:
  324.                         fgColor = cRed: bgColor = cBlack
  325.                     Case 1:
  326.                         fgColor = cLime: bgColor = cBlack
  327.                     Case 2:
  328.                         fgColor = cBlue: bgColor = cBlack
  329.                     Case Else:
  330.                         fgColor = cYellow: bgColor = cBlack
  331.                 End Select
  332.                 DrawColorTile imgScreen, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  333.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  334.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  335.             Next iTileNum
  336.             _Display
  337.         Loop Until Timer > t#
  338.         _AutoDisplay
  339.     End If
  340.  
  341.     ' ================================================================================================================================================================
  342.     ' METHOD #3
  343.     ' _PUTIMAGE with HARDWARE IMAGES
  344.     ' ================================================================================================================================================================
  345.     If Len(sError) = 0 Then
  346.         Cls , cGray
  347.         Color cWhite, cBlack: Locate 1, 1: Print "Test #3: DrawTileHw8 routine using 1 big multi-tileset and HARDWARE images...";
  348.  
  349.         imgHardwareScreen = _CopyImage(0, 33)
  350.  
  351.         iCount3 = 0
  352.         t# = Timer + 3
  353.         Do
  354.             iCount3 = iCount3 + 1
  355.             iFirstColor = iFirstColor Xor 1
  356.             iFgColorIndex = iFirstColor
  357.             iY = iMinY
  358.             iX = iMinX
  359.             _PutImage , imgHardwareScreen
  360.             For iTileNum = 0 To 255
  361.                 DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iX, iY, iFgColorIndex
  362.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  363.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  364.             Next iTileNum
  365.             _Display
  366.         Loop Until Timer > t#
  367.         _AutoDisplay
  368.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  369.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  370.     End If
  371.  
  372.     ' ================================================================================================================================================================
  373.     ' METHOD #4
  374.     ' VECTOR-BASED TILES USING LINE
  375.     ' ================================================================================================================================================================
  376.     If Len(sError) = 0 Then
  377.         Cls , cGray
  378.         Color cWhite, cBlack: Locate 1, 1: Print "Test #4: DrawVectorTileLine routine using 1 vector-based tileset drawn with Line shapes...";
  379.  
  380.         iCount4 = 0
  381.         t# = Timer + 3
  382.         Do
  383.             iCount4 = iCount4 + 1
  384.             iFirstColor = iFirstColor Xor 1
  385.             iFgColorIndex = iFirstColor
  386.             iY = iMinY
  387.             iX = iMinX
  388.             For iTileNum = 0 To 255
  389.                 Select Case iFgColorIndex
  390.                     Case 0:
  391.                         fgColor = cRed: bgColor = cBlack
  392.                     Case 1:
  393.                         fgColor = cLime: bgColor = cBlack
  394.                     Case 2:
  395.                         fgColor = cBlue: bgColor = cBlack
  396.                     Case Else:
  397.                         fgColor = cYellow: bgColor = cBlack
  398.                 End Select
  399.                 'DrawShape iTileNum, iX, iY, fgColor, bgColor
  400.                 DrawVectorTileLine iTileNum, iX * 8, iY * 8, fgColor, bgColor
  401.  
  402.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  403.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  404.             Next iTileNum
  405.             _Display
  406.         Loop Until Timer > t#
  407.         _AutoDisplay
  408.     End If
  409.  
  410.     ' ================================================================================================================================================================
  411.     ' METHOD #5
  412.     ' VECTOR-BASED TILES USING _PutImage
  413.     ' ================================================================================================================================================================
  414.     If Len(sError) = 0 Then
  415.         Cls , cGray
  416.         Color cWhite, cBlack: Locate 1, 1: Print "Test #5: DrawVectorTilePutImage routine using 1 vector-based tileset drawn with _PutImage...";
  417.  
  418.         iBgColorIndex = 4
  419.  
  420.         iCount5 = 0
  421.         t# = Timer + 3
  422.         Do
  423.             iCount5 = iCount5 + 1
  424.             iFirstColor = iFirstColor Xor 1
  425.             iFgColorIndex = iFirstColor
  426.             iY = iMinY
  427.             iX = iMinX
  428.             For iTileNum = 0 To 255
  429.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  430.                 DrawVectorTilePutImage _
  431.                     imgScreen, imgPalette, arrColor(), _
  432.                     iTileNum, iX, iY, _
  433.                     iFgColorIndex, iBgColorIndex
  434.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  435.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  436.             Next iTileNum
  437.             _Display
  438.         Loop Until Timer > t#
  439.         _AutoDisplay
  440.     End If
  441.  
  442.     ' ================================================================================================================================================================
  443.     ' METHOD #6
  444.     ' VECTOR-BASED TILES USING _PutImage with HARDWARE IMAGES
  445.     ' ================================================================================================================================================================
  446.     If Len(sError) = 0 Then
  447.         Cls , cGray
  448.         Color cWhite, cBlack: Locate 1, 1: Print "Test #6: DrawVectorTilePutImageHW routine using 1 vector-based tileset drawn with hardware images...";
  449.  
  450.         iBgColorIndex = 4
  451.         imgHardwareScreen = _CopyImage(0, 33)
  452.  
  453.         iCount6 = 0
  454.         t# = Timer + 3
  455.         Do
  456.             iCount6 = iCount6 + 1
  457.             iFirstColor = iFirstColor Xor 1
  458.             iFgColorIndex = iFirstColor
  459.             iY = iMinY
  460.             iX = iMinX
  461.             _PutImage , imgHardwareScreen
  462.             For iTileNum = 0 To 255
  463.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  464.                 DrawVectorTilePutImageHW _
  465.                     imgPaletteHW, arrColor(), _
  466.                     iTileNum, iX, iY, _
  467.                     iFgColorIndex, iBgColorIndex
  468.  
  469.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  470.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  471.             Next iTileNum
  472.             _Display
  473.         Loop Until Timer > t#
  474.         _AutoDisplay
  475.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  476.         If imgPaletteHW < -1 Or imgPaletteHW > 0 Then _FreeImage imgPaletteHW ' FREE MEMORY
  477.     End If
  478.  
  479.     ' ================================================================================================================================================================
  480.     ' METHOD #7
  481.     ' SOLID BOXES WITH LINE
  482.     ' ================================================================================================================================================================
  483.     If Len(sError) = 0 Then
  484.         Cls , cGray
  485.         Color cWhite, cBlack: Locate 1, 1: Print "Test #7: Solid boxes with Line...";
  486.  
  487.         iCount7 = 0
  488.         t# = Timer + 3
  489.         Do
  490.             _Display
  491.             iCount7 = iCount7 + 1
  492.             iFirstColor = iFirstColor Xor 1
  493.             iFgColorIndex = iFirstColor
  494.             iY = iMinY
  495.             iX = iMinX
  496.             For iTileNum = 0 To 255
  497.                 Select Case iFgColorIndex
  498.                     Case 0:
  499.                         fgColor = cRed: bgColor = cBlack
  500.                     Case 1:
  501.                         fgColor = cLime: bgColor = cBlack
  502.                     Case 2:
  503.                         fgColor = cBlue: bgColor = cBlack
  504.                     Case Else:
  505.                         fgColor = cYellow: bgColor = cBlack
  506.                 End Select
  507.  
  508.                 'DrawShape iTileNum, iX, iY, fgColor, bgColor
  509.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  510.                 Line (iX * 8, iY * 8)-((iX * 8) + 7, (iY * 8) + 7), fgColor, BF ' Draw a solid box
  511.  
  512.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  513.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  514.             Next iTileNum
  515.             _Display
  516.         Loop Until Timer > t#
  517.         _AutoDisplay
  518.     End If
  519.  
  520.     ' ================================================================================================================================================================
  521.     ' SHOW RESULTS
  522.     ' ================================================================================================================================================================
  523.     Cls , cGray
  524.     Color cWhite, cBlack: Locate 1, 1
  525.     Print ""
  526.     Print "RESULTS:"
  527.     Print Using "DrawTile8                ###,###,###,###,###,### refreshes in 3 seconds."; iCount1
  528.     Print Using "DrawColorTile            ###,###,###,###,###,### refreshes in 3 seconds."; iCount2
  529.     Print Using "DrawTileHw8              ###,###,###,###,###,### refreshes in 3 seconds."; iCount3
  530.     Print Using "DrawVectorTileLine       ###,###,###,###,###,### refreshes in 3 seconds."; iCount4
  531.     Print Using "DrawVectorTilePutImage   ###,###,###,###,###,### refreshes in 3 seconds."; iCount5
  532.     Print Using "DrawVectorTilePutImageHW ###,###,###,###,###,### refreshes in 3 seconds."; iCount6
  533.     Print Using "Solid boxes with Line    ###,###,###,###,###,### refreshes in 3 seconds."; iCount7
  534.     Print "PRESS ANY KEY TO CONTINUE"
  535.     Sleep
  536.  
  537.     ' ================================================================================================================================================================
  538.     ' CLEANUP AND EXIT
  539.     ' ================================================================================================================================================================
  540.     Screen 0 ' RETURN TO TEXT SCREEN
  541.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  542.     'If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  543.     If imgTiles < -1 Or imgTiles > 0 Then _FreeImage imgTiles ' FREE MEMORY
  544.     'If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  545.     If imgTilesRed < -1 Or imgTilesRed > 0 Then _FreeImage imgTilesRed ' FREE MEMORY
  546.     If imgTilesGreen < -1 Or imgTilesGreen > 0 Then _FreeImage imgTilesGreen ' FREE MEMORY
  547.     If imgTilesBlue < -1 Or imgTilesBlue > 0 Then _FreeImage imgTilesBlue ' FREE MEMORY
  548.     If imgTilesYellow < -1 Or imgTilesYellow > 0 Then _FreeImage imgTilesYellow ' FREE MEMORY
  549.     If imgColorTiles < -1 Or imgColorTiles > 0 Then _FreeImage imgColorTiles ' FREE MEMORY
  550.     If imgPalette < -1 Or imgPalette > 0 Then _FreeImage imgPalette ' FREE MEMORY
  551.     'If imgPaletteHW < -1 Or imgPaletteHW > 0 Then _FreeImage imgPaletteHW ' FREE MEMORY
  552. End Sub ' DrawingSpeedTest6
  553.  
  554. ' ################################################################################################################################################################
  555. ' END DRAWING SPEED TEST
  556. ' ################################################################################################################################################################
  557.  
  558. ' ################################################################################################################################################################
  559. ' BEGIN VECTOR-BASED TILE ROUTINES
  560. ' ################################################################################################################################################################
  561.  
  562. ' /////////////////////////////////////////////////////////////////////////////
  563.  
  564. Sub DrawVectorTilePutImageTest
  565.     Dim imgPalette As Long ' contains palette of colors
  566.     Dim imgScreen As Long ' the main display
  567.     Dim MyString As String
  568.     Dim iLoop As Integer
  569.     Dim iTileNum As Integer
  570.     Dim arrColor(0 To 8) As _Unsigned Long
  571.     Dim arrColorNames(0 To 8) As String
  572.     Dim iMinFgColorIndex As Integer: iMinFgColorIndex = 0
  573.     Dim iMaxFgColorIndex As Integer: iMaxFgColorIndex = 7
  574.     Dim iMinBgColorIndex As Integer: iMinBgColorIndex = 0
  575.     Dim iMaxBgColorIndex As Integer: iMaxBgColorIndex = 8
  576.     Dim iFgColorIndex As Integer: iFgColorIndex = iMinFgColorIndex
  577.     Dim iBgColorIndex As Integer: iBgColorIndex = iMinBgColorIndex
  578.     Dim iX As Integer
  579.     Dim iY As Integer
  580.     Dim iMinX As Integer
  581.     Dim iMaxX As Integer
  582.     Dim iMinY As Integer
  583.     Dim iMaxY As Integer
  584.  
  585.     ' Initialize colors
  586.     arrColor(0) = cBlack
  587.     arrColor(1) = cRed
  588.     arrColor(2) = cYellow
  589.     arrColor(3) = cLime
  590.     arrColor(4) = cCyan
  591.     arrColor(5) = cBlue
  592.     arrColor(6) = cPurple
  593.     arrColor(7) = cMagenta
  594.     arrColor(8) = cEmpty
  595.  
  596.     ' Initialize color names (for test output)
  597.     arrColorNames(0) = "cBlack"
  598.     arrColorNames(1) = "cRed"
  599.     arrColorNames(2) = "cYellow"
  600.     arrColorNames(3) = "cLime"
  601.     arrColorNames(4) = "cCyan"
  602.     arrColorNames(5) = "cBlue"
  603.     arrColorNames(6) = "cPurple"
  604.     arrColorNames(7) = "cMagenta"
  605.     arrColorNames(8) = "cEmpty"
  606.  
  607.     ' Set up screen
  608.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  609.     Screen imgScreen
  610.     Cls , cGray
  611.  
  612.     ' Generate color palette
  613.     MakePaletteImage imgPalette, arrColor()
  614.  
  615.     '' Draw palette on screen:
  616.     ''_PutImage (xDest%, yDest%), imgSource&, imgDest&, (sx1%, sy1%)-(sx2%, sy2%)
  617.     '_PutImage (400, 300), imgPalette, imgScreen, (0,0)-(_WIDTH(imgPalette), _HEIGHT(imgPalette))
  618.  
  619.     ' Set up tiles
  620.     GetVectorTiles
  621.  
  622.     ' Set up screen boundaries, initial colors, etc.
  623.     iMinX = 0: iMaxX = _Width(0) \ 8
  624.     iMinY = 0: iMaxY = _Height(0) \ 8
  625.     DebugPrint "iMaxX = _Width(0) = " + cstr$(iMaxX)
  626.     DebugPrint "iMaxY = _Height(0) = " + cstr$(iMaxY)
  627.  
  628.     iFgColorIndex = iMinFgColorIndex - 1
  629.  
  630.     ' Freeze dislay
  631.     _Display
  632.  
  633.     ' Test text
  634.     'MyString = "#"
  635.     'MyString = "BOO!"
  636.     MyString = "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  637.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  638.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  639.         "THIS IS A TEST!"
  640.  
  641.     iY = 5
  642.     iX = 5
  643.     For iLoop = 1 To Len(MyString)
  644.         iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iMaxFgColorIndex Then iFgColorIndex = iMinFgColorIndex
  645.         iBgColorIndex = iBgColorIndex + 1: If iBgColorIndex > iMaxBgColorIndex Then iBgColorIndex = iMinBgColorIndex
  646.         iTileNum = Asc(Mid$(MyString, iLoop, 1))
  647.         If iTileNum = 13 Then
  648.             ' Linebreak = go to a new line
  649.             iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  650.         Else
  651.             DrawVectorTilePutImage _
  652.                 imgScreen, imgPalette, arrColor(), _
  653.                 iTileNum, iX, iY, _
  654.                 iFgColorIndex, iBgColorIndex
  655.             iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  656.             'iX = iX + 1: iY = iY + 1
  657.             If iX > iMaxX Then iX = iMinX
  658.             If iY > iMaxY Then iY = iMinY
  659.         End If
  660.     Next iLoop
  661.  
  662.     ' Resume display
  663.     _Display
  664.  
  665.     ' Promput user
  666.     Color cWhite, cBlack: Locate 22, 1
  667.     Print "Press any key to continue";
  668.     Sleep
  669.  
  670.     Screen 0 ' RETURN TO TEXT SCREEN
  671.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  672. End Sub ' DrawVectorTilePutImageTest
  673.  
  674. ' /////////////////////////////////////////////////////////////////////////////
  675. ' Draw the shape with _PutImage commands using hardware images:
  676.  
  677. ' Requires that this global shared variable be declared:
  678. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  679. ' containing
  680. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  681. ' where for each tile, dimension 2 index 0:
  682. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  683. ' holds the last used {iShapeNum} index.
  684.  
  685. ' Receives:
  686. ' imgScreen& = image handle of the screen to draw to
  687. ' imgPalette& = image handle of the palette containing 8x8 squares each with the desired color
  688. ' arrColor() = array containing _UNSIGNED Long RGB color values
  689. ' iTileNum% = 0-255, number of the tile in m_arrLineTiles to draw
  690. ' iX, iY = x/y position to draw 8x8 tile to (multiplied by 8 to get screen position)
  691. ' fgColor, bgColor = index for foreground/background color in arrColor (which contains the actual RGB values)
  692.  
  693. Sub DrawVectorTilePutImage( _
  694.     imgScreen&, imgPalette&, arrColor() as _UNSIGNED Long, _
  695.     iTileNum As Integer, iX As Integer, iY As Integer, _
  696.     fgColorIndex As Integer, bgColorIndex As Integer)
  697.  
  698.     Dim iLoop As Integer
  699.  
  700.     Dim sc% ' source column on tile sheet
  701.     Dim sr% ' source row on tile sheet
  702.     Dim sx1% ' source start x
  703.     Dim sx2% ' source end x
  704.     Dim sy1% ' source start y
  705.     Dim sy2% ' source end y
  706.     Dim xDest% ' destination x
  707.     Dim yDest% ' destination y
  708.  
  709.     ' Copy from palette
  710.     _Source imgPalette&
  711.  
  712.     ' Draw to screen
  713.     _Dest imgScreen&
  714.  
  715.     ' GET THE ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  716.     sr% = 0 ' TileNum% \ rows%
  717.  
  718.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  719.     sy1% = sr% * 8
  720.  
  721.     ' draw background if not transparent
  722.     If bgColorIndex >= LBound(arrColor) Then
  723.         If bgColorIndex <= UBound(arrColor) Then
  724.             If arrColor(bgColorIndex) <> cEmpty Then
  725.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  726.                 sc% = bgColorIndex ' TileNum% Mod rows%
  727.  
  728.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  729.                 sx1% = sc% * 8
  730.  
  731.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  732.                 sx2% = sx1% + 7
  733.  
  734.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  735.                 sy2% = sy1% + 7
  736.  
  737.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  738.                 xDest% = iX * 8 ' dx% * 8
  739.  
  740.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  741.                 yDest% = iY * 8 ' (dy% * 8) '+ yOffset%
  742.  
  743.                 ' Copy portion of source to the top-left corner of the destination page
  744.                 _PutImage (xDest%, yDest%), _
  745.                     imgPalette&, imgScreen&, _
  746.                     (sx1%, sy1%)-(sx2%, sy2%)
  747.             End If
  748.         End If
  749.     End If
  750.  
  751.     If fgColorIndex >= LBound(arrColor) Then
  752.         If fgColorIndex <= UBound(arrColor) Then
  753.             For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  754.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  755.                 sc% = fgColorIndex ' TileNum% Mod rows%
  756.  
  757.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  758.                 sx1% = sc% * 8
  759.  
  760.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  761.                 'sx2% = sx1% + 7
  762.                 sx2% = sx1% + (m_arrLineTiles(iTileNum, iLoop).x2 - m_arrLineTiles(iTileNum, iLoop).x1)
  763.  
  764.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  765.                 'sy2% = sy1% + 7
  766.                 sy2% = sy1% + (m_arrLineTiles(iTileNum, iLoop).y2 - m_arrLineTiles(iTileNum, iLoop).y1)
  767.  
  768.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  769.                 xDest% = (iX * 8) + m_arrLineTiles(iTileNum, iLoop).x1 ' dx% * 8
  770.  
  771.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  772.                 yDest% = (iY * 8) + m_arrLineTiles(iTileNum, iLoop).y1 ' (dy% * 8) '+ yOffset%
  773.  
  774.                 ' Copy portion of source to the top-left corner of the destination page
  775.                 _PutImage (xDest%, yDest%), _
  776.                     imgPalette&, imgScreen&, _
  777.                     (sx1%, sy1%)-(sx2%, sy2%)
  778.  
  779.             Next iLoop
  780.         End If
  781.     End If
  782. End Sub ' DrawVectorTilePutImage
  783.  
  784. ' /////////////////////////////////////////////////////////////////////////////
  785. ' (Same as DrawVectorTilePutImage but uses hardware images.)
  786.  
  787. ' Draw the shape with _PutImage commands using hardware images:
  788.  
  789. ' Requires that this global shared variable be declared:
  790. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  791. ' containing
  792. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  793. ' where for each tile, dimension 2 index 0:
  794. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  795. ' holds the last used {iShapeNum} index.
  796.  
  797. ' Receives:
  798. ' imgScreen& = image handle of hardware image for the screen to draw to
  799. ' imgPalette& = image handle of hardware image for palette containing 8x8 squares each with the desired color
  800. ' arrColor() = array containing _UNSIGNED Long RGB color values
  801. ' iTileNum% = 0-255, number of the tile in m_arrLineTiles to draw
  802. ' iX, iY = x/y position to draw 8x8 tile to (multiplied by 8 to get screen position)
  803. ' fgColor, bgColor = index for foreground/background color in arrColor (which contains the actual RGB values)
  804.  
  805. Sub DrawVectorTilePutImageHW( _
  806.     imgPalette&, arrColor() as _UNSIGNED Long, _
  807.     iTileNum As Integer, iX As Integer, iY As Integer, _
  808.     fgColorIndex As Integer, bgColorIndex As Integer)
  809.  
  810.     Dim iLoop As Integer
  811.     Dim sc% ' source column on tile sheet
  812.     Dim sr% ' source row on tile sheet
  813.     Dim sx1% ' source start x
  814.     Dim sx2% ' source end x
  815.     Dim sy1% ' source start y
  816.     Dim sy2% ' source end y
  817.     Dim xDest% ' destination x
  818.     Dim yDest% ' destination y
  819.  
  820.     ' GET THE ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  821.     sr% = 0 ' TileNum% \ rows%
  822.  
  823.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  824.     sy1% = sr% * 8
  825.  
  826.     ' draw background if not transparent
  827.     If bgColorIndex >= LBound(arrColor) Then
  828.         If bgColorIndex <= UBound(arrColor) Then
  829.             If arrColor(bgColorIndex) <> cEmpty Then
  830.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  831.                 sc% = bgColorIndex ' TileNum% Mod rows%
  832.  
  833.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  834.                 sx1% = sc% * 8
  835.  
  836.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  837.                 sx2% = sx1% + 7
  838.  
  839.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  840.                 sy2% = sy1% + 7
  841.  
  842.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  843.                 xDest% = iX * 8
  844.  
  845.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  846.                 yDest% = iY * 8
  847.  
  848.                 ' Copy portion of source to the top-left corner of the destination page
  849.                 _PutImage (xDest%, yDest%), _
  850.                     imgPalette&, , _
  851.                     (sx1%, sy1%)-(sx2%, sy2%)
  852.             End If
  853.         End If
  854.     End If
  855.  
  856.     If fgColorIndex >= LBound(arrColor) Then
  857.         If fgColorIndex <= UBound(arrColor) Then
  858.             For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  859.                 ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  860.                 sc% = fgColorIndex ' TileNum% Mod rows%
  861.  
  862.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  863.                 sx1% = sc% * 8
  864.  
  865.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  866.                 sx2% = sx1% + (m_arrLineTiles(iTileNum, iLoop).x2 - m_arrLineTiles(iTileNum, iLoop).x1)
  867.  
  868.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  869.                 sy2% = sy1% + (m_arrLineTiles(iTileNum, iLoop).y2 - m_arrLineTiles(iTileNum, iLoop).y1)
  870.  
  871.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  872.                 xDest% = (iX * 8) + m_arrLineTiles(iTileNum, iLoop).x1
  873.  
  874.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  875.                 yDest% = (iY * 8) + m_arrLineTiles(iTileNum, iLoop).y1
  876.  
  877.                 ' Copy portion of source to the top-left corner of the destination page
  878.                 _PutImage (xDest%, yDest%), _
  879.                     imgPalette&, , _
  880.                     (sx1%, sy1%)-(sx2%, sy2%)
  881.             Next iLoop
  882.         End If
  883.     End If
  884. End Sub ' DrawVectorTilePutImageHW
  885.  
  886. ' /////////////////////////////////////////////////////////////////////////////
  887. ' Receives an array of _Unsigned Long RGB color values
  888. ' and returns a new image imgNew
  889. ' containing 8x8 squares with each color
  890.  
  891. ' Usage:
  892. ' MakePaletteImage imgNew, arrColorRGB()
  893.  
  894. Sub MakePaletteImage (imgNew As Long, arrColorRGB() As _Unsigned Long)
  895.     Dim tw% ' width/height of tile
  896.     Dim iCount As Integer
  897.     Dim iY As Integer
  898.     Dim iX As Integer
  899.     Dim iLoop1 As Integer
  900.  
  901.     tw% = 8 ' SIZE OF TILE
  902.  
  903.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  904.  
  905.     iY = tw%
  906.     iX = ((UBound(arrColorRGB) - LBound(arrColorRGB)) + 1) * tw%
  907.     If iX > 0 Then
  908.         imgNew = _NewImage(iX, iY, 32)
  909.         _Dest imgNew&
  910.  
  911.         iY = 0
  912.         iCount = -1
  913.         For iLoop1 = LBound(arrColorRGB) To UBound(arrColorRGB)
  914.             iCount = iCount + 1
  915.             iX = iCount * tw%
  916.             Line (iX, iY)-(iX + 7, iY + 7), arrColorRGB(iCount), BF
  917.         Next iLoop1
  918.     End If
  919. End Sub ' MakePaletteImage
  920.  
  921. ' /////////////////////////////////////////////////////////////////////////////
  922.  
  923. Sub MakePaletteImageTest
  924.     Dim arrColor(0 To 7) As _Unsigned Long
  925.     Dim imgPalette As Long ' contains palette of colors
  926.     Dim imgScreen As Long ' the main display
  927.  
  928.     arrColor(0) = cBlack
  929.     arrColor(1) = cRed
  930.     arrColor(2) = cYellow
  931.     arrColor(3) = cLime
  932.     arrColor(4) = cCyan
  933.     arrColor(5) = cBlue
  934.     arrColor(6) = cPurple
  935.     arrColor(7) = cMagenta
  936.     'arrColor(8) = cEmpty
  937.  
  938.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  939.     Screen imgScreen
  940.     Cls , cGray
  941.  
  942.     MakePaletteImage imgPalette, arrColor()
  943.  
  944.     ' Draw palette on screen:
  945.     '_PutImage (xDest%, yDest%), imgSource&, imgDest&, (sx1%, sy1%)-(sx2%, sy2%)
  946.     _PutImage (400, 300), imgPalette, imgScreen, (0, 0)-(_Width(imgPalette), _Height(imgPalette))
  947.  
  948.     ' Promput user
  949.     _Dest imgScreen
  950.     Color cWhite, cBlack
  951.     'PrintString1 15, 1, "Press any key to continue"
  952.     Locate 15, 1: Print "Press any key to continue";
  953.     Sleep
  954.  
  955.     Screen 0 ' RETURN TO TEXT SCREEN
  956.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  957.  
  958. End Sub ' MakePaletteImage
  959.  
  960. ' /////////////////////////////////////////////////////////////////////////////
  961. ' Draw the shape with Line commands:
  962.  
  963. ' Requires that this global shared variable be declared:
  964. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  965. ' containing
  966. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  967. ' where for each tile, dimension 2 index 0:
  968. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  969. ' holds the last used {iShapeNum} index.
  970.  
  971. Sub DrawVectorTileLine (iTileNum As Integer, iX As Integer, iY As Integer, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  972.     If bgColor <> cEmpty Then
  973.         Line (iX, iY)-(iX + 7, iY + 7), bgColor, BF
  974.     End If
  975.     Dim iLoop As Integer
  976.     For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  977.         Line (iX+m_arrLineTiles(iTileNum, iLoop).x1, _
  978.             iY+m_arrLineTiles(iTileNum, iLoop).y1 _
  979.             )-(iX+m_arrLineTiles(iTileNum, iLoop).x2, _
  980.             iY+m_arrLineTiles(iTileNum, iLoop).y2), _
  981.             fgColor, BF
  982.     Next iLoop
  983. End Sub ' DrawVectorTileLine
  984.  
  985. ' /////////////////////////////////////////////////////////////////////////////
  986. ' Get line drawing coordinates for 8x8 tileset.
  987.  
  988. ' Requires that this global shared variable be declared:
  989. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  990. ' containing
  991. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  992. ' where for each tile, dimension 2 index 0:
  993. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  994. ' holds the last used {iShapeNum} index.
  995.  
  996. ' VECTOR TILE DRAWING EXPERIMENT
  997.  
  998. ' Translates an 8x8 raster tileset into a set of (hopefully)
  999. ' optimized rectangle coordinates that can be quickly drawn to
  1000. ' the screen with Line.
  1001.  
  1002. ' GOAL: Optimize for each shape by determining how to draw it with the
  1003. ' minimum number of line commands.
  1004. '
  1005. ' For example this:
  1006. '     ' DRAW WITH HORIZONTAL LINES
  1007. '     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  1008. '     Line (iX + 6, iY + 4)-(iX + 6, iY + 4), fgColor
  1009. ' could be replaced with:
  1010. '     ' DRAW WITH VERTICAL LINES
  1011. '     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  1012.  
  1013. ' For each tile, we store a list of line coordinates (x1,y1,x2,y2)
  1014. ' in a 2D array, and draw using a simple drawing routine that
  1015. ' receives the list of coordinates, fgColor and bgColor,
  1016. ' and draws all shapes (solid rectangles) with Line.
  1017. ' If bgColor is not transparent and if we want a background color
  1018. ' then we first draw an 8x8 bgColor rectangle first and then
  1019. ' draw the shape on top of that.
  1020.  
  1021. ' Rather than compute this on the fly, we could precompute it and
  1022. ' for each given tile, store the list of those rectangle coordinates
  1023. ' (x1,y1,x2,y2) for drawing it indexed by the tile's definition in
  1024. ' hexidecimal where 16-bits (0-F) defines the bit pattern for each
  1025. ' row in the tile, therefore a tile's definition can be stored by
  1026. ' 8 characters (or less if we use base 64). Perhaps build a utility
  1027. ' that will compute the optimal drawing pattern for every possible
  1028. ' combination of an 8x8 grid, and index them all by the tile's 8-byte
  1029. ' hexidecimal definition. It might take a while to run, but once it
  1030. ' does, we will have a database of every possible tile's optimized
  1031. ' drawing instructions that can be quickly looked up.
  1032. ' Then we only pull out those definitions for the tiles that our
  1033. ' given program uses, so the data would be relatively small
  1034. ' (even smaller if we encode it with base-64).
  1035.  
  1036. ' TODO: maybe optimize with linked list?
  1037.  
  1038. Sub GetVectorTiles
  1039.     Dim RoutineName As String: RoutineName = "GetVectorTiles"
  1040.     ReDim arrTileText(0 To 255) As String
  1041.     ReDim arrShapes1(-1) As RectangleType
  1042.     Dim iTileNum As Integer
  1043.     Dim iLoop1 As Integer
  1044.     Dim sLine As String
  1045.     Dim iLen As Integer
  1046.  
  1047.     '' DEBUG
  1048.     'Dim sStartTime As String : sStartTime = "TBD"
  1049.     'Dim sEndTime As String : sEndTime = "TBD"
  1050.     'sStartTime = CurrentDateTime$
  1051.     'DebugPrint CurrentDateTime$ + " started " + RoutineName
  1052.  
  1053.     ' Get raster tiles as a string array
  1054.     GetTileText arrTileText()
  1055.  
  1056.     ' Get minimum set of Line coordinates for each tile
  1057.     For iTileNum = 0 To 255
  1058.         FindOptimizedVector arrTileText(iTileNum), arrShapes1()
  1059.  
  1060.         ' If we have coordinates, add it to the database
  1061.         If UBound(arrShapes1) > -1 Then
  1062.  
  1063.             'DebugPrint "#   x1   y1   x2   y2   Pixels    IsActive"
  1064.             'for iLoop1 = lbound(arrShapes1) to ubound(arrShapes1)
  1065.             '    sLine = ""
  1066.             '    sLine = sLine + left$(cstr$(iLoop1) + String$(4, " "), 4)
  1067.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).x1) + String$(2, " "), 2) + "   "
  1068.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).y1) + String$(2, " "), 2) + "   "
  1069.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).x2) + String$(2, " "), 2) + "   "
  1070.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).y2) + String$(2, " "), 2) + "   "
  1071.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).PixelCount) + String$(7, " "), 7) + "   "
  1072.             '    sLine = sLine + TrueFalse$(arrShapes1(iLoop1).IsActive)
  1073.             '    DebugPrint sLine
  1074.             'next iLoop1
  1075.  
  1076.             ' SAVE SHAPES TO TILE
  1077.             iLen = 0
  1078.             For iLoop1 = LBound(arrShapes1) To UBound(arrShapes1)
  1079.                 If arrShapes1(iLoop1).IsActive = TRUE Then
  1080.                     iLen = iLen + 1
  1081.  
  1082.                     ' NOTE: we do -1 because FindOptimizedVector does it 1-based,
  1083.                     '       don't ask me why, i was confused and don't want to
  1084.                     '       spend time right now to fix it,
  1085.                     '       but it saves math later to do 0-based
  1086.                     m_arrLineTiles(iTileNum, iLen).x1 = arrShapes1(iLoop1).x1 - 1
  1087.                     m_arrLineTiles(iTileNum, iLen).y1 = arrShapes1(iLoop1).y1 - 1
  1088.                     m_arrLineTiles(iTileNum, iLen).x2 = arrShapes1(iLoop1).x2 - 1
  1089.                     m_arrLineTiles(iTileNum, iLen).y2 = arrShapes1(iLoop1).y2 - 1
  1090.  
  1091.                     m_arrLineTiles(iTileNum, iLen).PixelCount = arrShapes1(iLoop1).PixelCount
  1092.                     m_arrLineTiles(iTileNum, iLen).IsActive = arrShapes1(iLoop1).IsActive
  1093.                 End If
  1094.             Next iLoop1
  1095.  
  1096.             ' MARK TILE (ubound 2, index 0) AS HAVING SHAPES + SAVE COUNT
  1097.             m_arrLineTiles(iTileNum, 0).IsActive = TRUE
  1098.             m_arrLineTiles(iTileNum, 0).PixelCount = iLen ' (iTileNum, 0).PixelCount stores the # of shapes
  1099.  
  1100.             ' DISABLE ANY REMAINING ENTRIES
  1101.             For iLoop1 = (iLen + 1) To UBound(m_arrLineTiles, 2)
  1102.                 m_arrLineTiles(iTileNum, iLoop1).IsActive = FALSE
  1103.             Next iLoop1
  1104.  
  1105.         Else
  1106.             ' This tile must have been blank
  1107.             'DebugPrint "*** NO SHAPES TO DRAW THIS TILE ***"
  1108.  
  1109.             ' MARK THIS TILE AS HAVING NO SHAPES
  1110.             m_arrLineTiles(iTileNum, 0).IsActive = FALSE
  1111.             m_arrLineTiles(iTileNum, 0).PixelCount = 0 ' (iTileNum, 0).PixelCount stores the # of shapes
  1112.         End If
  1113.     Next iTileNum
  1114.  
  1115.     '' DEBUG
  1116.     'sEndTime = CurrentDateTime$
  1117.     'DebugPrint RoutineName + " finished:"
  1118.     'DebugPrint "    started  at: " + sStartTime
  1119.     'DebugPrint "    finished at: " + sEndTime
  1120. End Sub ' GetVectorTiles
  1121.  
  1122. ' /////////////////////////////////////////////////////////////////////////////
  1123. ' 254 solid
  1124. ' 253 empty
  1125. ' 252 shaded
  1126. ' 241 bricks
  1127. ' 191 checker
  1128. ' 194 - 197 arrows u/d/l/r
  1129. ' 169 top left corner
  1130. ' 154 diamond
  1131. ' 155 +
  1132. ' 151 empty circle
  1133. ' 145 solid circle
  1134. ' 147 heart
  1135.  
  1136. Sub GetVectorTilesTest
  1137.     Dim imgScreen As Long ' the main display
  1138.     Dim MyString As String
  1139.     Dim iLoop As Integer
  1140.     Dim iTileNum As Integer
  1141.     Dim arrColor(0 To 8) As _Unsigned Long
  1142.     Dim iMinFgColorIndex As Integer: iMinFgColorIndex = 0
  1143.     Dim iMaxFgColorIndex As Integer: iMaxFgColorIndex = 7
  1144.     Dim iMinBgColorIndex As Integer: iMinBgColorIndex = 0
  1145.     Dim iMaxBgColorIndex As Integer: iMaxBgColorIndex = 8
  1146.     Dim iFgColorIndex As Integer: iFgColorIndex = iMinFgColorIndex
  1147.     Dim iBgColorIndex As Integer: iBgColorIndex = iMinBgColorIndex
  1148.     Dim iX As Integer
  1149.     Dim iY As Integer
  1150.     Dim iMinX As Integer
  1151.     Dim iMaxX As Integer
  1152.     Dim iMinY As Integer
  1153.     Dim iMaxY As Integer
  1154.  
  1155.     ' Initialize colors
  1156.     arrColor(0) = cBlack
  1157.     arrColor(1) = cRed
  1158.     arrColor(2) = cYellow
  1159.     arrColor(3) = cLime
  1160.     arrColor(4) = cCyan
  1161.     arrColor(5) = cBlue
  1162.     arrColor(6) = cPurple
  1163.     arrColor(7) = cMagenta
  1164.     arrColor(8) = cEmpty
  1165.  
  1166.     ' Set up screen
  1167.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1168.     Screen imgScreen
  1169.     Cls , cGray
  1170.  
  1171.     ' Set up tiles
  1172.     GetVectorTiles
  1173.  
  1174.     ' Test text
  1175.     MyString = "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1176.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1177.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1178.         "THIS IS A TEST!"
  1179.  
  1180.     ' Set up screen boundaries, initial colors, etc.
  1181.     iMinX = 0: iMaxX = _Width(0) \ 8
  1182.     iMinY = 0: iMaxY = _Height(0) \ 8
  1183.     iFgColorIndex = iMinFgColorIndex - 1
  1184.     iY = 5
  1185.     iX = 5
  1186.     For iLoop = 1 To Len(MyString)
  1187.         iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iMaxFgColorIndex Then iFgColorIndex = iMinFgColorIndex
  1188.         iBgColorIndex = iBgColorIndex + 1: If iBgColorIndex > iMaxBgColorIndex Then iBgColorIndex = iMinBgColorIndex
  1189.  
  1190.         iTileNum = Asc(Mid$(MyString, iLoop, 1))
  1191.         If iTileNum = 13 Then
  1192.             ' Linebreak = go to a new line
  1193.             iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1194.         Else
  1195.             'DrawVectorTileLine iTileNum, iX*8, iY*8, arrColor(iFgColorIndex), cEmpty
  1196.             DrawVectorTileLine iTileNum, iX * 8, iY * 8, arrColor(iFgColorIndex), arrColor(iBgColorIndex)
  1197.             iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1198.         End If
  1199.  
  1200.     Next iLoop
  1201.  
  1202.     ' Promput user
  1203.     Color cWhite, cBlack: Locate 22, 1
  1204.     Print "Press any key to continue";
  1205.     Sleep
  1206.  
  1207.     Screen 0 ' RETURN TO TEXT SCREEN
  1208.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  1209. End Sub ' GetVectorTilesTest
  1210.  
  1211. ' /////////////////////////////////////////////////////////////////////////////
  1212. ' Calculates and returns the coordinates for every possible rectangle shape
  1213. ' from 1-8 pixels high, and 1-8 pixels wide.
  1214.  
  1215. Sub GetAllPossibleShapes (arrShapes1() As RectangleType)
  1216.     ReDim arrShapes1(-1) As RectangleType
  1217.     Dim iLoopRows As Integer
  1218.     Dim iLoopCols As Integer
  1219.     Dim iIndex As Integer
  1220.     Dim iLoopY As Integer
  1221.     Dim iLoopX As Integer
  1222.  
  1223.     For iLoopRows = 1 To 8
  1224.         For iLoopCols = 1 To 8
  1225.             ' Add next shape to array
  1226.             iIndex = UBound(arrShapes1) + 1
  1227.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  1228.  
  1229.             ' Save coordinates
  1230.             arrShapes1(iIndex).x1 = 1
  1231.             arrShapes1(iIndex).y1 = 1
  1232.             arrShapes1(iIndex).x2 = iLoopCols
  1233.             arrShapes1(iIndex).y2 = iLoopRows
  1234.             arrShapes1(UBound(arrShapes1)).PixelCount = 0
  1235.  
  1236.             ' Count Pixels
  1237.             For iLoopY = 1 To 8
  1238.                 For iLoopX = 1 To 8
  1239.                     if _
  1240.                         iLoopY >= arrShapes1(iIndex).y1 _
  1241.                         and _
  1242.                         iLoopY <= arrShapes1(iIndex).y2 _
  1243.                         and _
  1244.                         iLoopX >= arrShapes1(iIndex).x1 _
  1245.                         and _
  1246.                         iLoopX <= arrShapes1(iIndex).x2 _
  1247.                         then
  1248.  
  1249.                         'sLine = sLine + "#"
  1250.                         arrShapes1(UBound(arrShapes1)).PixelCount = arrShapes1(UBound(arrShapes1)).PixelCount + 1
  1251.                     Else
  1252.                         'sLine = sLine + "."
  1253.                     End If
  1254.                 Next iLoopX
  1255.                 'DebugPrint sLine
  1256.             Next iLoopY
  1257.  
  1258.         Next iLoopCols
  1259.     Next iLoopRows
  1260. End Sub ' GetAllPossibleShapes
  1261.  
  1262. ' /////////////////////////////////////////////////////////////////////////////
  1263. ' Tests GetAllPossibleShapes to retrieve the coordinates for every possible
  1264. ' rectangle shape from 1-8 pixels high, and 1-8 pixels wide,
  1265. ' and uses Line to draw them on the screen.
  1266.  
  1267. Sub GetAllPossibleShapesTest
  1268.     ReDim arrShapes1(-1) As RectangleType
  1269.     Dim arrColor(0 To 7) As _Unsigned Long
  1270.     Dim iLoopShape As Integer
  1271.     Dim iOffsetY As Integer
  1272.     Dim iOffsetX As Integer
  1273.     Dim iColorIndex As Integer
  1274.     Dim iMinColorIndex As Integer: iMinColorIndex = 1
  1275.     Dim iMaxColorIndex As Integer: iMaxColorIndex = 7
  1276.     Dim in$
  1277.     Dim iX As Integer
  1278.     Dim iY As Integer
  1279.     Dim iSizeW As Integer
  1280.     Dim iSizeH As Integer
  1281.     Dim fgColor As _Unsigned Long
  1282.     Dim iMinX As Integer
  1283.     Dim iMinY As Integer
  1284.     Dim iMaxX As Integer
  1285.     Dim iMaxY As Integer
  1286.  
  1287.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  1288.     iMinX = 0
  1289.     iMinY = 17
  1290.     iMaxX = (_Width(0) / 8) ' iMaxX = _Width(0) - 16
  1291.     iMaxY = _Height(0) - 16
  1292.     iOffsetY = iMinY
  1293.     iOffsetX = iMinX
  1294.  
  1295.     arrColor(0) = cBlack
  1296.     arrColor(1) = cRed
  1297.     arrColor(2) = cYellow
  1298.     arrColor(3) = cLime
  1299.     arrColor(4) = cCyan
  1300.     arrColor(5) = cBlue
  1301.     arrColor(6) = cPurple
  1302.     arrColor(7) = cMagenta
  1303.  
  1304.     GetAllPossibleShapes arrShapes1()
  1305.  
  1306.     iColorIndex = iMinColorIndex
  1307.     For iLoopShape = 0 To UBound(arrShapes1)
  1308.         DebugPrint _
  1309.             "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  1310.             "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  1311.             cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  1312.  
  1313.         iX = arrShapes1(iLoopShape).x1 + iOffsetX
  1314.         iY = arrShapes1(iLoopShape).y1 + iOffsetY
  1315.         iSizeW = (arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1) + 1
  1316.         iSizeH = (arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1) + 1
  1317.         fgColor = arrColor(iColorIndex)
  1318.         DrawRectSolid iX, iY, iSizeW, iSizeH, fgColor
  1319.  
  1320.         iOffsetX = iOffsetX + 16: If iOffsetX > iMaxX Then iOffsetX = iMinX: iOffsetY = iOffsetY + 16: If iOffsetY > iMaxY Then iOffsetY = iMinY
  1321.         iColorIndex = iColorIndex + 1: If iColorIndex > iMaxColorIndex Then iColorIndex = iMinColorIndex
  1322.     Next iLoopShape
  1323.  
  1324.     Locate 1, 1
  1325.     Color cWhite, cBlack
  1326.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1327.     Screen 0
  1328. End Sub ' GetAllPossibleShapes
  1329.  
  1330. ' /////////////////////////////////////////////////////////////////////////////
  1331.  
  1332. Sub DumpNextShape (oShape As RectangleType, sVarName As String)
  1333.     Dim iLoopY As Integer
  1334.     Dim iLoopX As Integer
  1335.     Dim sLine As String
  1336.  
  1337.     If Len(sVarName) > 0 Then
  1338.         DebugPrint sVarName + ":"
  1339.     Else
  1340.         DebugPrint "RectangleType:"
  1341.     End If
  1342.  
  1343.     DebugPrint _
  1344.         "(" + cstr$(oShape.x1) + ", " + cstr$(oShape.y1) + ")-" + _
  1345.         "(" + cstr$(oShape.x2) + ", " + cstr$(oShape.y2) + ") " + _
  1346.         cstr$(oShape.PixelCount) + " pixels, " + _
  1347.         "IsActive=" + TrueFalse$(oShape.IsActive)
  1348.  
  1349.     For iLoopY = 1 To 8
  1350.         sLine = ""
  1351.         For iLoopX = 1 To 8
  1352.             if _
  1353.                 iLoopY >= oShape.y1 _
  1354.                 and _
  1355.                 iLoopY <= oShape.y2 _
  1356.                 and _
  1357.                 iLoopX >= oShape.x1 _
  1358.                 and _
  1359.                 iLoopX <= oShape.x2 _
  1360.                 then
  1361.  
  1362.                 sLine = sLine + "#"
  1363.             Else
  1364.                 sLine = sLine + "."
  1365.             End If
  1366.         Next iLoopX
  1367.         DebugPrint sLine
  1368.     Next iLoopY
  1369.     DebugPrint ""
  1370. End Sub ' DumpNextShape
  1371.  
  1372. ' /////////////////////////////////////////////////////////////////////////////
  1373. ' Dump all shapes in array.
  1374.  
  1375. ' {i} in sVarName is replaced by array index
  1376.  
  1377. Sub DumpShapeList (arrShapes() As RectangleType, sVarName As String)
  1378.     Dim iLoop1 As Integer
  1379.     Dim sNextVarName As String
  1380.  
  1381.     For iLoop1 = 0 To UBound(arrShapes3)
  1382.         sNextVarName = Replace$(sVarName, "{i}", cstr$(iLoop1))
  1383.         DumpNextShape arrShapes(iLoop1), sVarName
  1384.     Next iLoop1
  1385. End Sub ' DumpShapeList
  1386.  
  1387. ' /////////////////////////////////////////////////////////////////////////////
  1388. ' Receives an array of shapes
  1389. '
  1390. Sub GetActiveShapes (arrShapes2() As RectangleType, arrShapes3() As RectangleType)
  1391.     Dim iLoopShape As Integer
  1392.     Dim iIndex As Integer
  1393.     ReDim arrShapes3(-1) As RectangleType
  1394.     For iLoopShape = 0 To UBound(arrShapes2)
  1395.         If arrShapes2(iLoopShape).IsActive = TRUE Then
  1396.             iIndex = UBound(arrShapes3) + 1
  1397.             ReDim _Preserve arrShapes3(0 To iIndex) As RectangleType
  1398.             arrShapes3(iIndex).y1 = arrShapes2(iLoopShape).y1
  1399.             arrShapes3(iIndex).x1 = arrShapes2(iLoopShape).x1
  1400.             arrShapes3(iIndex).y2 = arrShapes2(iLoopShape).y2
  1401.             arrShapes3(iIndex).x2 = arrShapes2(iLoopShape).x2
  1402.             arrShapes3(iIndex).PixelCount = arrShapes2(iLoopShape).PixelCount
  1403.             arrShapes3(iIndex).IsActive = arrShapes2(iLoopShape).IsActive
  1404.         End If
  1405.     Next iLoopShape
  1406. End Sub ' GetActiveShapes
  1407.  
  1408. ' /////////////////////////////////////////////////////////////////////////////
  1409.  
  1410. Function DelimIntegerListsAreEqual% (sList1 As String, sList2 As String, sDelim As String)
  1411.     Dim bResult As Integer: bResult = FALSE
  1412.     Dim arrList1(-1) As Integer
  1413.     Dim arrList2(-1) As Integer
  1414.     Dim iLoop1 As Integer
  1415.     Dim iLoop2 As Integer
  1416.     Dim bFound As Integer
  1417.  
  1418.     ' Convert delimited lists into integer arrays
  1419.     GetIntegerArrayFromDelimList sList1, sDelim, 0, arrList1()
  1420.     GetIntegerArrayFromDelimList sList2, sDelim, 0, arrList2()
  1421.  
  1422.     ' Are lists same size?
  1423.     If UBound(arrList1) = UBound(arrList2) Then
  1424.         bResult = TRUE
  1425.     End If
  1426.  
  1427.     ' Check list #2 against list #1
  1428.     If bResult = TRUE Then
  1429.         ' Are all items in list #1 in list #2?
  1430.         For iLoop1 = LBound(arrList1) To UBound(arrList1)
  1431.             bFound = FALSE
  1432.             For iLoop2 = LBound(arrList2) To UBound(arrList2)
  1433.                 If arrList2(iLoop2) = arrList1(iLoop1) Then
  1434.                     bFound = TRUE
  1435.                     Exit For
  1436.                 End If
  1437.             Next iLoop2
  1438.             If bFound = FALSE Then
  1439.                 ' not found, lists not equal
  1440.                 bResult = FALSE
  1441.                 Exit For
  1442.             End If
  1443.         Next iLoop1
  1444.     End If
  1445.  
  1446.     ' Check list #1 against list #2
  1447.     If bResult = TRUE Then
  1448.         For iLoop1 = LBound(arrList2) To UBound(arrList2)
  1449.             bFound = FALSE
  1450.             For iLoop2 = LBound(arrList1) To UBound(arrList1)
  1451.                 If arrList1(iLoop2) = arrList2(iLoop1) Then
  1452.                     bFound = TRUE
  1453.                     Exit For
  1454.                 End If
  1455.             Next iLoop2
  1456.             If bFound = FALSE Then
  1457.                 ' not found, lists not equal
  1458.                 bResult = FALSE
  1459.                 Exit For
  1460.             End If
  1461.         Next iLoop1
  1462.     End If
  1463.  
  1464.     ' Return results
  1465.     DelimIntegerListsAreEqual% = bResult
  1466. End Function ' DelimIntegerListsAreEqual%
  1467.  
  1468. ' /////////////////////////////////////////////////////////////////////////////
  1469.  
  1470. ' DumpTileFromShapes arrShapes1(), bIncludeInactive, bShowRowsAndColumns
  1471.  
  1472. Sub DumpTileFromShapes (arrShapes1() As RectangleType, bIncludeInactive As Integer, bShowRowsAndColumns As Integer)
  1473.     ReDim arrTile1(1 To 8, 1 To 8) As String
  1474.     Dim iDestY As Integer
  1475.     Dim iDestX As Integer
  1476.     Dim iLoop1 As Integer
  1477.     Dim sLine As String
  1478.  
  1479.     ' Initialize next tile
  1480.     For iDestY = 1 To 8: For iDestX = 1 To 8: arrTile1(iDestY, iDestX) = ".": Next iDestX: Next iDestY
  1481.  
  1482.     ' Draw all (active) shapes onto tile
  1483.     For iLoop1 = LBound(arrShapes1) To UBound(arrShapes1)
  1484.         If arrShapes1(iLoop1).IsActive = TRUE Or bIncludeInactive = TRUE Then
  1485.             For iDestY = 1 To 8
  1486.                 For iDestX = 1 To 8
  1487.                     If iDestY >= arrShapes1(iLoop1).y1 Then
  1488.                         If iDestY <= arrShapes1(iLoop1).y2 Then
  1489.                             If iDestX >= arrShapes1(iLoop1).x1 Then
  1490.                                 If iDestX <= arrShapes1(iLoop1).x2 Then
  1491.                                     arrTile1(iDestY, iDestX) = "#"
  1492.                                 End If
  1493.                             End If
  1494.                         End If
  1495.                     End If
  1496.                 Next iDestX
  1497.             Next iDestY
  1498.         End If
  1499.     Next iLoop1
  1500.  
  1501.     ' Output the shape
  1502.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  1503.     For iDestY = 1 To 8
  1504.         sLine = ""
  1505.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  1506.         For iDestX = 1 To 8
  1507.             sLine = sLine + arrTile1(iDestY, iDestX)
  1508.         Next iDestX
  1509.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  1510.         DebugPrint sLine
  1511.     Next iDestY
  1512.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  1513.  
  1514. End Sub ' DumpTileFromShapes
  1515.  
  1516. ' /////////////////////////////////////////////////////////////////////////////
  1517.  
  1518. ' DumpTile arrTile1(), bShowRowsAndColumns
  1519.  
  1520. Sub DumpTile (arrTile1( 1 To 8 , 1 To 8) As String, bShowRowsAndColumns As Integer)
  1521.     Dim iDestY As Integer
  1522.     Dim iDestX As Integer
  1523.     Dim sLine As String
  1524.  
  1525.     ' Output the tile
  1526.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  1527.     For iDestY = 1 To 8
  1528.         sLine = ""
  1529.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  1530.         For iDestX = 1 To 8
  1531.             sLine = sLine + arrTile1(iDestY, iDestX)
  1532.         Next iDestX
  1533.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  1534.         DebugPrint sLine
  1535.     Next iDestY
  1536.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  1537. End Sub ' DumpTile
  1538.  
  1539. ' /////////////////////////////////////////////////////////////////////////////
  1540. ' Receives an 8x8 raster tile definition and returns a list of coordinates
  1541. ' for the minimum number of rectangles to draw that tile.
  1542.  
  1543. ' This version uses a brute force method, ie draw every size rectangle
  1544. ' from 1x1 up to 8x8 (which can themselves be precalculated) in every
  1545. ' available location in the 8x8 grid (where no part of any rectangle falls
  1546. ' off the grid), then tries every combination of those rectangles to find
  1547. ' the combination where the the minimum number of rectangles cover all
  1548. ' points (or if 2 combinations have the same # of rectangles, the one that
  1549. ' covers the lesser total points).
  1550.  
  1551. ' (You can try searching for "rectangular decomposition of binary images"
  1552. ' and similar to find a better algorithm.)
  1553.  
  1554. ' Receives:
  1555. ' TileString (String) = contains 8x8 raster tile definition as a string, where
  1556. '                       empty space represended by ".",
  1557. '                       pixel represented by any non-whitespace character,
  1558. '                       each row separated by chr$(13).
  1559. ' Returns (byref):
  1560. ' arrOptimizedShapes (array of RectangleType) = array of rectangle coordinates
  1561. '                       defining the shapes that will draw the tile.
  1562. '
  1563. ' Return value = empty string if successful, error message if not.
  1564.  
  1565. Sub FindOptimizedVector (TileString As String, arrShapes1() As RectangleType)
  1566.     Dim RoutineName As String: RoutineName = "FindOptimizedVector"
  1567.     Dim bContinue As Integer: bContinue = TRUE
  1568.     ReDim arrTile1(1 To 8, 1 To 8) As String
  1569.     ReDim arrTile2(1 To 8, 1 To 8) As String
  1570.     ReDim arrShapes2(-1) As RectangleType
  1571.     ReDim arrCompare(-1) As DrawCompareType
  1572.     Dim oShapeSet As DrawCompareType
  1573.     Dim iLoopY As Integer
  1574.     Dim iLoopX As Integer
  1575.     Dim iDestY As Integer
  1576.     Dim iDestX As Integer
  1577.     Dim iSizeY As Integer
  1578.     Dim iSizeX As Integer
  1579.     Dim iEndY As Integer
  1580.     Dim iEndX As Integer
  1581.     Dim iTestY As Integer
  1582.     Dim iTestX As Integer
  1583.     Dim bShapeFits As Integer
  1584.     Dim iLoop1 As Integer
  1585.     Dim iLoop2 As Integer
  1586.     Dim iIndex As Integer
  1587.     Dim sItemList As String
  1588.     Dim iShapeCount As Integer
  1589.     Dim iPixelCount As Integer
  1590.     Dim bFinished As Integer
  1591.     Dim sCompare As String
  1592.     ReDim arrTestIndex(-1) As Integer
  1593.     Dim iShapeIndex As Integer
  1594.     Dim iRound As Integer
  1595.     Dim sLine As String
  1596.  
  1597.     '' ****************************************************************************************************************************************************************
  1598.     '' DEBUG:
  1599.     'Dim sStartTime As String : sStartTime = CurrentDateTime$
  1600.     'Dim sEndTime As String : sEndTime = ""
  1601.     'DebugPrint sStartTime + " started " + RoutineName
  1602.     '' ****************************************************************************************************************************************************************
  1603.  
  1604.     ' =============================================================================
  1605.     ' INITIALIZE
  1606.     If bContinue = TRUE Then
  1607.         ' -----------------------------------------------------------------------------
  1608.         ' Init results
  1609.         ReDim arrShapes1(-1) As RectangleType
  1610.  
  1611.         ' -----------------------------------------------------------------------------
  1612.         ' Turn tile into 2D array
  1613.         StringTo2dArray arrTile1(), TileString
  1614.  
  1615.         ' -----------------------------------------------------------------------------
  1616.         ' Count pixels
  1617.         iPixelCount = 0
  1618.         For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  1619.             For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  1620.                 If arrTile1(iLoopY, iLoopX) <> "." Then
  1621.                     iPixelCount = iPixelCount + 1
  1622.                 End If
  1623.             Next iLoopX
  1624.         Next iLoopY
  1625.  
  1626.         ' If shape is blank no need to continue looking
  1627.         ' we can just return an empty array
  1628.         If iPixelCount = 0 Then
  1629.             bContinue = FALSE
  1630.         End If
  1631.     End If
  1632.  
  1633.     ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1634.     ' BEGIN LOOK FOR MINIMUM COMBINATION OF SHAPES TO DRAW TILE
  1635.     If bContinue = TRUE Then
  1636.         ' =============================================================================
  1637.         ' Get a set of every size shape (rectangle) from 1x1 up to 8x8
  1638.         GetAllPossibleShapes arrShapes1()
  1639.         'DebugPrint "ALL POSSIBLE SHAPES:"
  1640.         'DumpShapeList arrShapes1(), "arrShapes1{i}"
  1641.  
  1642.         ' =============================================================================
  1643.         ' Try each shape in every location on the tile, to see which fit
  1644.         For iLoop1 = 0 To UBound(arrShapes1)
  1645.             ' Try plotting next shape in every position
  1646.             For iDestY = 1 To 8
  1647.                 For iDestX = 1 To 8
  1648.                     ' Track whether shape is fully on the tile at this position
  1649.                     bShapeFits = FALSE
  1650.  
  1651.                     ' Does shape fit at this Y position?
  1652.                     iSizeY = arrShapes1(iLoop1).y2 - arrShapes1(iLoop1).y1
  1653.                     iEndY = iDestY + iSizeY
  1654.                     If iEndY < 9 Then
  1655.                         ' Does shape fit at this X position?
  1656.                         iSizeX = arrShapes1(iLoop1).x2 - arrShapes1(iLoop1).x1
  1657.                         iEndX = iDestX + iSizeX
  1658.                         If iEndX < 9 Then
  1659.                             ' The shape is fully on the tile here
  1660.                             bShapeFits = TRUE
  1661.  
  1662.                             ' Now see if any of shape's pixels fall outside of tile's pixels?
  1663.                             For iTestY = iDestY To iEndY
  1664.                                 For iTestX = iDestX To iEndX
  1665.                                     If arrTile1(iTestY, iTestX) = "." Then
  1666.                                         ' No pixel here, shape fails
  1667.                                         bShapeFits = FALSE
  1668.                                         Exit For
  1669.                                     End If
  1670.                                 Next iTestX
  1671.                                 If bShapeFits = FALSE Then Exit For
  1672.                             Next iTestY
  1673.                         End If
  1674.                     End If
  1675.  
  1676.                     ' If shape fits, add it to the list of shapes/positions that work for the tile
  1677.                     If bShapeFits = TRUE Then
  1678.                         iIndex = UBound(arrShapes2) + 1
  1679.                         ReDim _Preserve arrShapes2(0 To iIndex) As RectangleType
  1680.                         arrShapes2(iIndex).y1 = iDestY
  1681.                         arrShapes2(iIndex).x1 = iDestX
  1682.                         arrShapes2(iIndex).y2 = iEndY
  1683.                         arrShapes2(iIndex).x2 = iEndX
  1684.                         arrShapes2(iIndex).PixelCount = arrShapes1(iLoop1).PixelCount
  1685.                         arrShapes2(iIndex).IsActive = TRUE
  1686.                     End If
  1687.                 Next iDestX
  1688.             Next iDestY
  1689.         Next iLoop1
  1690.  
  1691.         ' Eliminate non-active shapes
  1692.         GetActiveShapes arrShapes2(), arrShapes1()
  1693.  
  1694.         'DebugPrint "ALL SHAPES/LOCATIONS THAT MATCHED + FIT:"
  1695.         'DumpShapeList arrShapes2(), "arrShapes2{i}"
  1696.  
  1697.         ' =============================================================================
  1698.         ' Remove redundant shapes (any where another shape covers more points)
  1699.  
  1700.         For iLoop1 = 0 To UBound(arrShapes1)
  1701.             ' make sure shape #1 was not eliminated
  1702.             If arrShapes1(iLoop1).IsActive = TRUE Then
  1703.                 ' compare shape #1 against all other shapes
  1704.                 For iLoop2 = 0 To UBound(arrShapes1)
  1705.                     ' don't compare against itself
  1706.                     If iLoop2 <> iLoop1 Then
  1707.                         ' make sure shape #2 was not eliminated
  1708.                         If arrShapes1(iLoop2).IsActive = TRUE Then
  1709.                             ' can shape #2 do what shape #1 can do? (covers all points shape #1 does)
  1710.                             if _
  1711.                                 arrShapes1(iLoop1).y1 >= arrShapes1(iLoop2).y1 _
  1712.                                 and _
  1713.                                 arrShapes1(iLoop1).y2 <= arrShapes1(iLoop2).y2 _
  1714.                                 and _
  1715.                                 arrShapes1(iLoop1).x1 >= arrShapes1(iLoop2).x1 _
  1716.                                 and _
  1717.                                 arrShapes1(iLoop1).x2 <= arrShapes1(iLoop2).x2 _
  1718.                                 then
  1719.  
  1720.                                 ' does shape #2 do it better? (cover more points than shape #1)
  1721.                                 If arrShapes1(iLoop2).PixelCount >= arrShapes1(iLoop1).PixelCount Then
  1722.                                     ' Remove shape #1
  1723.                                     arrShapes1(iLoop1).IsActive = FALSE
  1724.                                 End If
  1725.                             End If
  1726.                         End If
  1727.                     End If
  1728.                 Next iLoop2
  1729.             End If
  1730.         Next iLoop1
  1731.  
  1732.         ' Eliminate non-active shapes
  1733.         GetActiveShapes arrShapes1(), arrShapes2()
  1734.  
  1735.         'DebugPrint "SHAPES THAT MATCHED + FIT, NON-REDUNDANT LEVEL 1:"
  1736.         'DumpShapeList arrShapes2(), "arrShapes2{i}"
  1737.  
  1738.     End If
  1739.  
  1740.     ' =============================================================================
  1741.     ' Can we do without any?
  1742.     ' Compare all combinations subtractively:
  1743.  
  1744.     ' 1. Count enabled shapes + total pixels for full list of shapes "set A".
  1745.     ' 2. Save "set A" to the "contender list",
  1746.     '    with the shape count and total pixel count.
  1747.     ' 3. For each shape "x":
  1748.     '    a) see if full tile can still be drawn without "x"
  1749.     '       (where the set of shapes minus "x" is "set y").
  1750.     '    b) If full tile can be drawn, save "set y" to the "contender list"
  1751.     '       with the shape count and total pixel count.
  1752.     ' 4. When done, identify the winner "set z" that can draw the full tile
  1753.     '    using the minimum shape coverage.
  1754.     '    a) The set with the smallest tile count wins.
  1755.     '    b) In the event of a tie, the set with the least total pixel count wins.
  1756.     '    c) In the event of another tie, just use the first finalist.
  1757.     ' 5. Disable all shapes NOT in the winning "set z".
  1758.     ' 6. Save list of enabled shapes to "last winner".
  1759.     ' 7. Repeat steps 1-5 until, comparing the list of enabled shapes to
  1760.     '    the list "last winner". When the list stops changing (lists are equal),
  1761.     '    we have gone as far as we can go.
  1762.     ' 8. Return shapes in "last winner" as final result.
  1763.  
  1764.     If bContinue = TRUE Then
  1765.  
  1766.         ' -----------------------------------------------------------------------------
  1767.         ' Start with all
  1768.         ' 1. Count enabled shapes + total pixels for full list of shapes "set A".
  1769.         ' 2. Save "set A" to the "contender list",
  1770.         '    with the shape count and total pixel count.
  1771.         sItemList = ""
  1772.         iShapeCount = 0
  1773.         iPixelCount = 0
  1774.         For iLoop1 = LBound(arrShapes2) To UBound(arrShapes2)
  1775.             sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iLoop1)
  1776.             iShapeCount = iShapeCount + 1
  1777.             iPixelCount = iPixelCount + arrShapes2(iLoop1).PixelCount
  1778.         Next iLoop1
  1779.  
  1780.         oShapeSet.IndexList = sItemList
  1781.         oShapeSet.ShapeCount = iShapeCount
  1782.         oShapeSet.PixelCount = iPixelCount
  1783.         oShapeSet.IsActive = TRUE
  1784.  
  1785.         ' -----------------------------------------------------------------------------
  1786.         ' Now see which combinations can draw the tile
  1787.  
  1788.         iRound = 0
  1789.         bFinished = FALSE
  1790.         Do
  1791.             ' At the top of the loop, oShapeSet contains the latest set of shapes
  1792.             iRound = iRound + 1
  1793.  
  1794.             ' Get the list of shapes (indexes pointing to each shape in arrShapes2)
  1795.             ' All this packing and unpacking probably wastes cycles
  1796.             ' It might not be necessary if we had arrays inside of types!
  1797.             GetIntegerArrayFromDelimList oShapeSet.IndexList, ",", 0, arrTestIndex()
  1798.  
  1799.             ' Clear the list of contenders
  1800.             ReDim arrCompare(-1) As DrawCompareType
  1801.  
  1802.             '' ****************************************************************************************************************************************************************
  1803.             'DebugPrint "################################################################################################################################################################"
  1804.             'DebugPrint "Round " + cstr$(iRound) + " shapes to dedupe:"
  1805.             'for iLoop2 = lbound(arrTestIndex) to ubound(arrTestIndex)
  1806.             '    iIndex = arrTestIndex(iLoop2)
  1807.             '    DumpNextShape arrShapes2(iIndex), "Shape " + cstr$(iIndex) + " round " + cstr$(iRound) + ""
  1808.             '    DebugPrint ""
  1809.             'Next iLoop2
  1810.             'DebugPrint "################################################################################################################################################################"
  1811.             '' ****************************************************************************************************************************************************************
  1812.  
  1813.             ' 3. For each shape "x":
  1814.             '    a) see if full tile can still be drawn without "x"
  1815.             '       (where the set of shapes minus "x" is "set y").
  1816.             '    b) If full tile can be drawn, save "set y" to the "contender list"
  1817.             '       with the shape count and total pixel count.
  1818.             For iLoop1 = LBound(arrTestIndex) To UBound(arrTestIndex)
  1819.  
  1820.                 ''DEBUG:
  1821.                 'DebugPrint "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
  1822.                 'DebugPrint "Can we eliminate " + cstr$(iLoop1) ' this shape?"
  1823.                 'DumpNextShape arrShapes2(iLoop1), "arrShapes2(" + cstr$(iLoop1) + ")"
  1824.                 'DebugPrint "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
  1825.                 'DebugPrint ""
  1826.  
  1827.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1828.                 ' Clear test tile
  1829.                 ReDim arrTile2(1 To 8, 1 To 8) As String
  1830.                 For iDestY = 1 To 8
  1831.                     For iDestX = 1 To 8
  1832.                         arrTile2(iDestY, iDestX) = "."
  1833.                     Next iDestX
  1834.                 Next iDestY
  1835.  
  1836.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1837.                 ' Try drawing next combination of shapes in the test tile
  1838.                 sItemList = ""
  1839.                 iShapeCount = 0
  1840.                 iPixelCount = 0
  1841.                 For iLoop2 = LBound(arrTestIndex) To UBound(arrTestIndex)
  1842.  
  1843.                     ' Make sure it's not shape "x"
  1844.                     If iLoop2 <> iLoop1 Then
  1845.                         iIndex = arrTestIndex(iLoop2)
  1846.  
  1847.                         sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iIndex)
  1848.                         iShapeCount = iShapeCount + 1
  1849.                         iPixelCount = iPixelCount + arrShapes2(iIndex).PixelCount
  1850.  
  1851.                         For iDestY = 1 To 8
  1852.                             For iDestX = 1 To 8
  1853.                                 If iDestY >= arrShapes2(iIndex).y1 Then
  1854.                                     If iDestY <= arrShapes2(iIndex).y2 Then
  1855.                                         If iDestX >= arrShapes2(iIndex).x1 Then
  1856.                                             If iDestX <= arrShapes2(iIndex).x2 Then
  1857.                                                 arrTile2(iDestY, iDestX) = "#"
  1858.                                             End If
  1859.                                         End If
  1860.                                     End If
  1861.                                 End If
  1862.                             Next iDestX
  1863.                         Next iDestY
  1864.                     End If
  1865.                 Next iLoop2
  1866.  
  1867.                 ''DebugPrint "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  1868.                 ''DebugPrint "Attempted drawing tile without " + cstr$(iLoop1) ' item #" + cstr$(iLoop1)
  1869.                 ''DumpTile arrTile2(), TRUE
  1870.                 'DebugPrint "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  1871.                 'DebugPrint ""
  1872.                 'DebugPrint "RESULT$:"
  1873.                 iShapeIndex = arrTestIndex(iLoop1)
  1874.  
  1875.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1876.                 ' Does the test tile match the real tile?
  1877.                 sCompare = TilesAreEqual$(arrTile1(), arrTile2())
  1878.                 If Len(sCompare) = 0 Then
  1879.                     ' Add to the list of contenders
  1880.                     iIndex = UBound(arrCompare) + 1
  1881.                     ReDim _Preserve arrCompare(0 To iIndex) As DrawCompareType
  1882.                     arrCompare(iIndex).IndexList = sItemList
  1883.                     arrCompare(iIndex).ShapeCount = iShapeCount
  1884.                     arrCompare(iIndex).PixelCount = iPixelCount
  1885.                     arrCompare(iIndex).IsActive = TRUE
  1886.  
  1887.                     'DebugPrint "*******************************************************************************"
  1888.                     'DebugPrint "YES: Tile can be drawn without shape " + cstr$(iShapeIndex) + " round " + cstr$(iRound)
  1889.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").IndexList  = " + sItemList
  1890.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").ShapeCount = " + cstr$(iShapeCount)
  1891.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").PixelCount = " + cstr$(PixelCount)
  1892.                     'DebugPrint "*******************************************************************************"
  1893.  
  1894.                     'else
  1895.                     'DebugPrint "*******************************************************************************"
  1896.                     'DebugPrint "NOPE: Tile cannot be drawn without shape " + cstr$(iShapeIndex) + " round " + cstr$(iRound)
  1897.                     'DebugPrint sCompare
  1898.                     'DebugPrint "Attempted with:"
  1899.                     'DebugPrint ".IndexList  = " + sItemList
  1900.                     'DebugPrint ".ShapeCount = " + cstr$(iShapeCount)
  1901.                     'DebugPrint ".PixelCount = " + cstr$(PixelCount)
  1902.                     'DebugPrint "*******************************************************************************"
  1903.                 End If
  1904.  
  1905.             Next iLoop1
  1906.  
  1907.             ' =============================================================================
  1908.             ' Identify the best combination that uses the least # of shapes + pixels
  1909.  
  1910.             ' DEDUPE IF THERE ARE >1 GROUPS
  1911.             If UBound(arrCompare) > LBound(arrCompare) Then
  1912.  
  1913.                 '' ****************************************************************************************************************************************************************
  1914.                 ''DEBUG:
  1915.                 'DebugPrint "RESULTS BEFORE DEDUPE:"
  1916.                 'sLine = ","
  1917.                 'for iLoop2 = lbound(arrCompare) to ubound(arrCompare)
  1918.                 '    if arrCompare(iLoop2).IsActive = TRUE then
  1919.                 '        sLine = sLine + cstr$(iLoop2) + ","
  1920.                 '        DebugPrint "-------------------------------------------------------------------------------"
  1921.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IndexList  = " + arrCompare(iLoop2).IndexList
  1922.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").ShapeCount = " + cstr$(arrCompare(iLoop2).ShapeCount)
  1923.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").PixelCount = " + cstr$(arrCompare(iLoop2).PixelCount)
  1924.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IsActive   = " + TrueFalse$(arrCompare(iLoop2).IsActive)
  1925.                 '    end if
  1926.                 'next iLoop2
  1927.                 'DebugPrint ""
  1928.                 '' ****************************************************************************************************************************************************************
  1929.  
  1930.                 For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  1931.                     For iLoop2 = LBound(arrCompare) To UBound(arrCompare)
  1932.                         If iLoop1 <> iLoop2 Then
  1933.                             If arrCompare(iLoop1).IsActive = TRUE Then
  1934.                                 If arrCompare(iLoop2).IsActive = TRUE Then
  1935.                                     If arrCompare(iLoop2).ShapeCount < arrCompare(iLoop1).ShapeCount Then
  1936.                                         arrCompare(iLoop1).IsActive = FALSE
  1937.                                     ElseIf arrCompare(iLoop2).ShapeCount > arrCompare(iLoop1).ShapeCount Then
  1938.                                         arrCompare(iLoop2).IsActive = FALSE
  1939.                                     Else
  1940.                                         If arrCompare(iLoop2).PixelCount < arrCompare(iLoop1).PixelCount Then
  1941.                                             arrCompare(iLoop1).IsActive = FALSE
  1942.                                         ElseIf arrCompare(iLoop2).PixelCount > arrCompare(iLoop1).PixelCount Then
  1943.                                             arrCompare(iLoop2).IsActive = FALSE
  1944.                                         Else
  1945.                                             arrCompare(iLoop2).IsActive = FALSE
  1946.                                         End If
  1947.                                     End If
  1948.                                 End If
  1949.                             End If
  1950.                         End If
  1951.                     Next iLoop2
  1952.                 Next iLoop1
  1953.  
  1954.                 '' ****************************************************************************************************************************************************************
  1955.                 ''DEBUG:
  1956.                 'DebugPrint "RESULTS AFTER DEDUPE:"
  1957.                 'for iLoop2 = lbound(arrCompare) to ubound(arrCompare)
  1958.                 '    if InStr(1, sLine, "," + cstr$(iLoop2) + ",") > 0 then
  1959.                 '        DebugPrint "-------------------------------------------------------------------------------"
  1960.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IndexList  = " + arrCompare(iLoop2).IndexList
  1961.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").ShapeCount = " + cstr$(arrCompare(iLoop2).ShapeCount)
  1962.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").PixelCount = " + cstr$(arrCompare(iLoop2).PixelCount)
  1963.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IsActive   = " + TrueFalse$(arrCompare(iLoop2).IsActive)
  1964.                 '    end if
  1965.                 'next iLoop2
  1966.                 'DebugPrint ""
  1967.                 '' ****************************************************************************************************************************************************************
  1968.  
  1969.             End If
  1970.  
  1971.             ' =============================================================================
  1972.             ' Identify the winner!
  1973.             ' Look at the list of indexes that make up the winning shape combination,
  1974.             ' and pick the first one.
  1975.  
  1976.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  1977.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  1978.             'DebugPrint "LOOK FOR THE WINNER, END ROUND " + cstr$(iRound)
  1979.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  1980.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  1981.             iIndex = -1
  1982.  
  1983.             'DebugPrint "arrCompare(" + cstr$(lbound(arrCompare)) + " To " + cstr$(ubound(arrCompare)) + ")"
  1984.             'DebugPrint ""
  1985.  
  1986.             'DebugPrint "Group   Status"
  1987.             'DebugPrint "-----   ----------"
  1988.             For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  1989.                 If arrCompare(iLoop1).IsActive = TRUE Then
  1990.                     If iIndex = -1 Then
  1991.                         iIndex = iLoop1
  1992.                         Exit For
  1993.                         '            DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "IsActive WINNER"
  1994.                         '        else
  1995.                         '            DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "IsActive"
  1996.                     End If
  1997.                     '    else
  1998.                     '        DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "(disabled)"
  1999.                 End If
  2000.             Next iLoop1
  2001.             'DebugPrint ""
  2002.  
  2003.             ' =============================================================================
  2004.             ' Has it changed from the last round?
  2005.             'DebugPrint "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
  2006.             'DebugPrint "Has it changed from the last round?"
  2007.             'DebugPrint "iIndex=" + cstr$(iIndex)
  2008.             'DebugPrint "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
  2009.             'DebugPrint ""
  2010.  
  2011.             If iIndex > -1 Then
  2012.                 'DebugPrint "Comparing arrCompare(" + cstr$(iIndex) + ").IndexList: " + arrCompare(iIndex).IndexList
  2013.                 'DebugPrint "       to oShapeSet.IndexList: " + oShapeSet.IndexList
  2014.                 'DebugPrint ""
  2015.  
  2016.                 If DelimIntegerListsAreEqual%(arrCompare(iIndex).IndexList, oShapeSet.IndexList, ",") = TRUE Then
  2017.                     'DebugPrint "DelimIntegerListsAreEqual% returns TRUE"
  2018.                     'DebugPrint "FOUND WINNER (Group #" + cstr$(iIndex) + ") exiting..."
  2019.                     ' no change, we have reduced as much as possible, exit
  2020.                     bFinished = TRUE
  2021.                 Else
  2022.                     'DebugPrint "DelimIntegerListsAreEqual% returns FALSE"
  2023.                     'DebugPrint "None yet, try next data"
  2024.                     'DebugPrint "Replacing old best set: "
  2025.                     'DebugPrint "    IndexList=" + oShapeSet.IndexList
  2026.                     'DebugPrint "    ShapeCount=" + cstr$(oShapeSet.ShapeCount)
  2027.                     'DebugPrint "    PixelCount=" + cstr$(oShapeSet.PixelCount)
  2028.                     'DebugPrint "    IsActive  =" + TrueFalse$(oShapeSet.IsActive)
  2029.                     'DebugPrint "with arrCompare(" + cstr$(iIndex) + ")"
  2030.                     'DebugPrint "    IndexList=" + arrCompare(iIndex).IndexList
  2031.                     'DebugPrint "    ShapeCount=" + cstr$(arrCompare(iIndex).ShapeCount)
  2032.                     'DebugPrint "    PixelCount=" + cstr$(arrCompare(iIndex).PixelCount)
  2033.                     'DebugPrint "    IsActive  =" + TrueFalse$(arrCompare(iIndex).IsActive)
  2034.                     'DebugPrint "and continuing to compare..."
  2035.  
  2036.                     ' Continue reducing with the latest set
  2037.                     oShapeSet.IndexList = arrCompare(iIndex).IndexList
  2038.                     oShapeSet.ShapeCount = arrCompare(iIndex).ShapeCount
  2039.                     oShapeSet.PixelCount = arrCompare(iIndex).PixelCount
  2040.                     oShapeSet.IsActive = TRUE
  2041.                 End If
  2042.             Else
  2043.                 'DebugPrint "(NONE FOUND THAT WORKED, USE THE EXISTING oShapeSet)"
  2044.                 'DebugPrint "Replacing old best set: "
  2045.                 'DebugPrint "    oShapeSet.IndexList=" + oShapeSet.IndexList
  2046.                 'DebugPrint "    oShapeSet.ShapeCount=" + cstr$(oShapeSet.ShapeCount)
  2047.                 'DebugPrint "    oShapeSet.PixelCount=" + cstr$(oShapeSet.PixelCount)
  2048.                 'DebugPrint "    oShapeSet.IsActive  =" + TrueFalse$(oShapeSet.IsActive)
  2049.                 ' none found that works, exit
  2050.                 bFinished = TRUE
  2051.             End If
  2052.  
  2053.         Loop Until bFinished = TRUE
  2054.  
  2055.         ' =============================================================================
  2056.         ' Build results
  2057.  
  2058.         ' Get the list of shapes (indexes pointing to each shape in arrShapes1)
  2059.         GetIntegerArrayFromDelimList oShapeSet.IndexList, ",", 0, arrTestIndex()
  2060.  
  2061.         ' Initialize the final output
  2062.         ReDim arrShapes1(-1) As RectangleType
  2063.  
  2064.         ' Add the shapes to the final list
  2065.         For iLoop2 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2066.             iShapeIndex = arrTestIndex(iLoop2)
  2067.  
  2068.             iIndex = UBound(arrShapes1) + 1
  2069.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  2070.  
  2071.             'DebugPrint "Copying arrShapes2(" + cstr$(iShapeIndex) + ") to arrShapes1(" + cstr$(iIndex) + "):"
  2072.  
  2073.             If arrShapes2(iShapeIndex).IsActive = TRUE Then
  2074.                 arrShapes1(iIndex).x1 = arrShapes2(iShapeIndex).x1
  2075.                 arrShapes1(iIndex).y1 = arrShapes2(iShapeIndex).y1
  2076.                 arrShapes1(iIndex).x2 = arrShapes2(iShapeIndex).x2
  2077.                 arrShapes1(iIndex).y2 = arrShapes2(iShapeIndex).y2
  2078.                 arrShapes1(iIndex).PixelCount = arrShapes2(iShapeIndex).PixelCount
  2079.                 arrShapes1(iIndex).IsActive = arrShapes2(iShapeIndex).IsActive
  2080.  
  2081.                 ''DEBUG:
  2082.                 'DumpNextShape arrShapes1(iIndex), "arrShapes1(" + cstr$(iIndex) + ")"
  2083.  
  2084.             End If
  2085.         Next iLoop2
  2086.  
  2087.     End If
  2088.     ' END LOOK FOR MINIMUM COMBINATION OF SHAPES TO DRAW TILE
  2089.     ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2090.  
  2091.     '' ****************************************************************************************************************************************************************
  2092.     '' DEBUG:
  2093.     'DumpTileFromShapes arrShapes1(), FALSE, TRUE
  2094.     '
  2095.     'sEndTime = CurrentDateTime$
  2096.     'DebugPrint RoutineName + " finished:"
  2097.     'DebugPrint "    started  at: " + sStartTime
  2098.     'DebugPrint "    finished at: " + sEndTime
  2099.     '' ****************************************************************************************************************************************************************
  2100.  
  2101. End Sub ' FindOptimizedVector
  2102.  
  2103. ' /////////////////////////////////////////////////////////////////////////////
  2104. ' Test routine for the FindOptimizedVector routine.
  2105.  
  2106. Sub FindOptimizedVectorTest
  2107.     Dim RoutineName As String: RoutineName = "FindOptimizedVectorTest"
  2108.     Dim sError As String: sError = ""
  2109.     Dim in$
  2110.     ReDim arrTileText(0 To 255) As String
  2111.     Dim sTestList As String
  2112.     ReDim arrTestIndex(-1) As Integer
  2113.     Dim iLoop1 As Integer
  2114.     Dim iLoop2 As Integer
  2115.     Dim iIndex As Integer
  2116.     ReDim arrOptimizedShapes(-1) As RectangleType
  2117.     Dim sLine As String
  2118.  
  2119.     ' Start output
  2120.     DebugPrint "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  2121.     DebugPrint "Testing tiles: " + sTestList
  2122.     DebugPrint ""
  2123.  
  2124.     ' Get raster tiles as a string array
  2125.     GetTileText arrTileText()
  2126.  
  2127.     ' List of tiles to test
  2128.     'sTestList = "254,253,247,32,238,241,225,233,213,214,212,203,194,193,192,169,154,151,145,147,129,115,114,84,65,46,44,35,252"
  2129.     'sTestList = "46,35"
  2130.     'sTestList = "84,253,192,151,147,114,65"
  2131.     'sTestList = "43,44,45,46"
  2132.     'sTestList = "60,62" ' 84 + 192 work, the rest don't
  2133.     'sTestList = "254,252"
  2134.     sTestList = "84,60,62,75,141,142,150,207,217,252,192" ' 84 + 192 work, the rest don't
  2135.     'sTestList = "60,62,75,141,142,150,207,217,252" ' 84 + 192 work, the rest don't
  2136.     'sTestList="75"
  2137.     'DebugPrint "GETTING LIST OF TILES..."
  2138.     GetIntegerArrayFromDelimList sTestList, ",", 0, arrTestIndex()
  2139.  
  2140.     ' Test tiles
  2141.     For iIndex = 0 To 255
  2142.         'for iLoop1 = lbound(arrTestIndex) to ubound(arrTestIndex)
  2143.         '    iIndex = arrTestIndex(iLoop1)
  2144.         DebugPrint "----------------------------------------------------------------------------------------------------------------------------------------------------------------"
  2145.         DebugPrint "Tile #" + cstr$(iIndex) + ":"
  2146.         DebugPrint arrTileText(iIndex)
  2147.         DebugPrint ""
  2148.  
  2149.         ' Process next tile and generate line drawing routines
  2150.         FindOptimizedVector arrTileText(iIndex), arrOptimizedShapes()
  2151.  
  2152.         If Len(sError) = 0 Then
  2153.             If UBound(arrOptimizedShapes) > -1 Then
  2154.                 DebugPrint "#   x1   y1   x2   y2   Pixels    IsActive"
  2155.                 For iLoop2 = LBound(arrOptimizedShapes) To UBound(arrOptimizedShapes)
  2156.                     sLine = ""
  2157.                     sLine = sLine + Left$(cstr$(iLoop2) + String$(4, " "), 4)
  2158.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).x1) + String$(2, " "), 2) + "   "
  2159.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).y1) + String$(2, " "), 2) + "   "
  2160.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).x2) + String$(2, " "), 2) + "   "
  2161.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).y2) + String$(2, " "), 2) + "   "
  2162.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).PixelCount) + String$(7, " "), 7) + "   "
  2163.                     sLine = sLine + TrueFalse$(arrOptimizedShapes(iLoop2).IsActive)
  2164.                     DebugPrint sLine
  2165.                 Next iLoop2
  2166.             Else
  2167.                 DebugPrint "*** NO SHAPES TO DRAW THIS TILE ***"
  2168.             End If
  2169.         Else
  2170.             DebugPrint "ERROR FOR TILE #" + cstr$(iIndex) + ": " + sError
  2171.         End If
  2172.         DebugPrint ""
  2173.         'next iLoop1
  2174.     Next iIndex
  2175.  
  2176.     ' DONE
  2177.     DebugPrint RoutineName + " finished."
  2178.     'Input "PRESS <ENTER> TO CONTINUE";in$
  2179. End Sub ' FindOptimizedVectorTest
  2180.  
  2181. ' /////////////////////////////////////////////////////////////////////////////
  2182. ' Receives two 2D string arrays and compares the dimensions
  2183. ' and makes sure that the any blank pixel value "." matches
  2184. ' (any other non-whitespace characters are considered a pixel
  2185. ' as long as they are not "." they are considered a match).
  2186. ' Returns empty string if they match, else returns a difference report.
  2187.  
  2188. Function TilesAreEqual$ (arrTile1() As String, arrTile2() As String)
  2189.     Dim sResult As String: sResult = ""
  2190.     Dim iLoopY As Integer
  2191.     Dim iLoopX As Integer
  2192.     Dim sTemp As String
  2193.     Dim bMatch As Integer
  2194.     Dim iY As Integer
  2195.  
  2196.     If LBound(arrTile1, 1) = LBound(arrTile2, 1) Then
  2197.         If UBound(arrTile1, 1) = UBound(arrTile2, 1) Then
  2198.             If LBound(arrTile1, 2) = LBound(arrTile2, 2) Then
  2199.                 If UBound(arrTile1, 2) = UBound(arrTile2, 2) Then
  2200.                     bMatch = TRUE
  2201.                     sTemp = " 12345678 " + Chr$(13)
  2202.                     iY = 0
  2203.                     For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  2204.                         iY = iY + 1
  2205.                         sTemp = sTemp + cstr$(iY)
  2206.                         For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  2207.                             If arrTile1(iLoopY, iLoopX) = "." And arrTile2(iLoopY, iLoopX) <> "." Then
  2208.                                 bMatch = FALSE
  2209.                                 sTemp = sTemp + "?"
  2210.                             ElseIf arrTile1(iLoopY, iLoopX) <> "." And arrTile2(iLoopY, iLoopX) = "." Then
  2211.                                 bMatch = FALSE
  2212.                                 sTemp = sTemp + "?"
  2213.                             Else
  2214.                                 sTemp = sTemp + arrTile1(iLoopY, iLoopX)
  2215.                             End If
  2216.                         Next iLoopX
  2217.                         sTemp = sTemp + cstr$(iY) + Chr$(13)
  2218.                     Next iLoopY
  2219.                     sTemp = sTemp + " 12345678 " + Chr$(13)
  2220.                     If bMatch = FALSE Then
  2221.                         sResult = sTemp
  2222.                     End If
  2223.                 Else
  2224.                     sResult = "ubound(arrTile1, 2)=" + cstr$(ubound(arrTile1, 2)) + _
  2225.                         " <> " + _
  2226.                         "ubound(arrTile2, 2)=" + cstr$(ubound(arrTile2, 2))
  2227.                 End If
  2228.             Else
  2229.                 sResult = "lbound(arrTile1, 2)=" + cstr$(lbound(arrTile1, 2)) + _
  2230.                     " <> " + _
  2231.                     "lbound(arrTile2, 2)=" + cstr$(lbound(arrTile2, 2))
  2232.  
  2233.             End If
  2234.         Else
  2235.             sResult = "ubound(arrTile1, 1)=" + cstr$(ubound(arrTile1, 1)) + _
  2236.                 " <> " + _
  2237.                 "ubound(arrTile2, 1)=" + cstr$(ubound(arrTile2, 1))
  2238.         End If
  2239.     Else
  2240.         sResult = "lbound(arrTile1, 1)=" + cstr$(lbound(arrTile1, 1)) + _
  2241.             " <> " + _
  2242.             "lbound(arrTile2, 1)=" + cstr$(lbound(arrTile2, 1))
  2243.     End If
  2244.     TilesAreEqual$ = sResult
  2245. End Function ' TilesAreEqual$
  2246.  
  2247. ' ################################################################################################################################################################
  2248. ' END VECTOR-BASED TILE ROUTINES
  2249. ' ################################################################################################################################################################
  2250.  
  2251. ' ################################################################################################################################################################
  2252. ' BEGIN BOX DRAWING ROUTINES
  2253. ' ################################################################################################################################################################
  2254.  
  2255. ' /////////////////////////////////////////////////////////////////////////////
  2256. ' DRAW A 2-D BOX (OUTLINE)
  2257. ' https://www.qb64.org/wiki/LINE
  2258.  
  2259. Sub DrawBoxOutline (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  2260.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, B ' Draw box outline
  2261. End Sub ' DrawBoxOutline
  2262.  
  2263. ' /////////////////////////////////////////////////////////////////////////////
  2264. ' DRAW A 2-D BOX (SOLID)
  2265. ' https://www.qb64.org/wiki/LINE
  2266.  
  2267. ' Renamed DrawBox/DrawBoxLine to DrawSolidBox
  2268.  
  2269. Sub DrawBoxSolid (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  2270.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, BF ' Draw a solid box
  2271. End Sub ' DrawBoxSolid
  2272.  
  2273. ' /////////////////////////////////////////////////////////////////////////////
  2274. ' DRAW A 2-D RECTANGLE (OUTLINE)
  2275.  
  2276. Sub DrawRectOutline (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  2277.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, B ' Draw rectangle outline
  2278. End Sub ' DrawRectOutline
  2279.  
  2280. ' /////////////////////////////////////////////////////////////////////////////
  2281. ' DRAW A 2-D RECTANGLE (SOLID)
  2282.  
  2283. Sub DrawRectSolid (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  2284.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, BF ' Draw a solid rectangle
  2285. End Sub ' DrawRectSolid
  2286.  
  2287. ' /////////////////////////////////////////////////////////////////////////////
  2288. ' DRAW A 2-D BOX (OUTLINE)
  2289. ' https://www.qb64.org/wiki/LINE
  2290.  
  2291. ' The style parameter 0-255 doesn't seem to have a solid line?
  2292. ' For that, use DrawOutlineBox.
  2293.  
  2294. ' LINE [STEP] [(column1, row1)]-[STEP] (column2, row2), color[, [{B|BF}], style%]
  2295. ' B creates a box outline with each side parallel to the program screen sides. BF creates a filled box.
  2296. ' The style% signed INTEGER value sets a dotted pattern to draw the line or rectangle outline.
  2297.  
  2298. Sub DrawStyledOutlineBox (iX%, iY%, iSize%, iColor~&, iStyle%)
  2299.     Line (iX%, iY%)-(iX% + (iSize% - 1), iY% + (iSize% - 1)), iColor~&, B , iStyle%
  2300. End Sub ' DrawStyledOutlineBox
  2301.  
  2302. ' /////////////////////////////////////////////////////////////////////////////
  2303. ' DRAW A 2-D BOX (OUTLINE) WITH A SOLID LINE
  2304.  
  2305. Sub DrawOutlineBox (iX%, iY%, iSize2%, iColor~&, iWeight2%)
  2306.     Dim iFromX%
  2307.     Dim iFromY%
  2308.     Dim iToX%
  2309.     Dim iToY%
  2310.     iSize% = iSize2% - 1
  2311.     iWeight% = iWeight2% - 1
  2312.     If iWeight% = 0 Then
  2313.         ' TOP LINE
  2314.         iFromX% = iX%
  2315.         iFromY% = iY%
  2316.         iToX% = iX% + iSize%
  2317.         iToY% = iY%
  2318.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2319.  
  2320.         ' BOTTOM LINE
  2321.         iFromX% = iX%
  2322.         iFromY% = iY% + iSize%
  2323.         iToX% = iX% + iSize%
  2324.         iToY% = iY% + iSize%
  2325.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2326.  
  2327.         ' LEFT LINE
  2328.         iFromX% = iX%
  2329.         iFromY% = iY%
  2330.         iToX% = iX%
  2331.         iToY% = iY% + iSize%
  2332.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2333.  
  2334.         ' RIGHT LINE
  2335.         iFromX% = iX% + iSize%
  2336.         iFromY% = iY%
  2337.         iToX% = iX% + iSize%
  2338.         iToY% = iY% + iSize%
  2339.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2340.     ElseIf iWeight% > 0 Then
  2341.         ' TOP LINE
  2342.         For iFromY% = iY% To (iY% + iWeight%)
  2343.             iFromX% = iX%
  2344.             'iFromY% = iY%
  2345.             iToX% = iX% + iSize%
  2346.             iToY% = iFromY%
  2347.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2348.         Next iFromY%
  2349.  
  2350.         ' BOTTOM LINE
  2351.         For iFromY% = ((iY% + iSize%) - iWeight%) To (iY% + iSize%)
  2352.             iFromX% = iX%
  2353.             'iFromY% = iY% + iSize%
  2354.             iToX% = iX% + iSize%
  2355.             iToY% = iFromY%
  2356.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2357.         Next iFromY%
  2358.  
  2359.         ' LEFT LINE
  2360.         For iFromX% = iX% To (iX% + iWeight%)
  2361.             'iFromX% = iX%
  2362.             iFromY% = iY%
  2363.             iToX% = iFromX%
  2364.             iToY% = iY% + iSize%
  2365.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2366.         Next iFromX%
  2367.  
  2368.         ' RIGHT LINE
  2369.         For iFromX% = ((iX% + iSize%) - iWeight%) To (iX% + iSize%)
  2370.             'iFromX% = iX% + iSize%
  2371.             iFromY% = iY%
  2372.             iToX% = iFromX%
  2373.             iToY% = iY% + iSize%
  2374.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  2375.         Next iFromX%
  2376.     End If
  2377. End Sub ' DrawOutlineBox
  2378.  
  2379. ' ################################################################################################################################################################
  2380. ' END BOX DRAWING ROUTINES
  2381. ' ################################################################################################################################################################
  2382.  
  2383. ' ################################################################################################################################################################
  2384. ' BEGIN DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  2385. ' ################################################################################################################################################################
  2386.  
  2387. ' /////////////////////////////////////////////////////////////////////////////
  2388. ' Same as DrawColorTile but using hardware images.
  2389.  
  2390. ' Receives:
  2391. ' imgTiles& = handle to 16x16 tile sheet of 16x16 pixel tiles colored black (256 tiles)
  2392. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  2393. ' TileColor~& = color to use for tile
  2394. ' imgScreen& = handle to screen to draw tile on
  2395. ' dx% = column # to draw tile at (where each column is 16 pixels wide)
  2396. ' dy% = row # to draw tile at (where each row is 16 pixels high)
  2397. ' xOffset% = offset tile this many columns over
  2398. ' yOffset% = offset tile this many rows down
  2399.  
  2400. Sub DrawColorTileHW ( _
  2401.     imgHardwareScreen As Long, _
  2402.     imgTiles As Long, _
  2403.     iTileNum As Integer, _
  2404.     fgColor As _UNSIGNED Long, _
  2405.     bgColor As _UNSIGNED Long, _
  2406.     dx As Integer, _
  2407.     dy As Integer)
  2408.  
  2409.     Dim cols%
  2410.     Dim rows%
  2411.     Dim sc%
  2412.     Dim sr%
  2413.     Dim sx1%
  2414.     Dim sy1%
  2415.     Dim sx2%
  2416.     Dim sy2%
  2417.     Dim xDest%
  2418.     Dim yDest%
  2419.     Dim imgColorSprite As Long
  2420.     Dim imgUniversalSprite As Long
  2421.     Dim imgColorSpriteHW As Long
  2422.     Dim imgUniversalSpriteHW As Long
  2423.  
  2424.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  2425.     cols% = 16
  2426.     rows% = 16
  2427.  
  2428.     ' GET THE COLUMN/ROW OF TILE # iTileNum ON THE SOURCE TILE SHEET
  2429.     sc% = iTileNum Mod rows%
  2430.     sr% = iTileNum \ rows%
  2431.  
  2432.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2433.     sx1% = sc% * 8
  2434.  
  2435.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2436.     sy1% = sr% * 8
  2437.  
  2438.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2439.     sx2% = sx1% + 7
  2440.  
  2441.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2442.     sy2% = sy1% + 7
  2443.  
  2444.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2445.     xDest% = dx * 8
  2446.  
  2447.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2448.     yDest% = dy * 8
  2449.  
  2450.     ' IS THERE A BACKGROUND COLOR?
  2451.     If bgColor <> cEmpty Then
  2452.         imgColorSprite = _NewImage(8, 8, 32)
  2453.         imgColorSpriteHW = _CopyImage(imgColorSprite, 33) ' Copy for hardware image
  2454.         '_Dest imgColorSprite
  2455.         _Dest imgColorSpriteHW
  2456.         Cls , bgColor
  2457.  
  2458.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  2459.         '_Source imgColorSprite
  2460.         _Source imgColorSpriteHW
  2461.         _Dest imgHardwareScreen
  2462.  
  2463.         'SOFTWARE IMAGE:
  2464.         '_PutImage (xDest%, yDest%), imgColorSprite, imgHardwareScreen, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  2465.  
  2466.         'HARDWARE IMAGE:
  2467.         _PutImage (xDest%, yDest%), imgColorSpriteHW, , (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  2468.     End If
  2469.  
  2470.     ' CREATE A TEMPORARY TILE TO COLOR
  2471.     imgUniversalSprite = _NewImage(8, 8, 32)
  2472.  
  2473.     ' COPY THE TILE TO THE TEMPORARY ONE
  2474.     _Source imgHardwareTiles
  2475.     _Dest imgUniversalSprite
  2476.     'SOFTWARE IMAGE:
  2477.     '_PutImage (0, 0), imgTiles, imgUniversalSprite, (sx1%, sy1%)-(sx2%, sy2%)
  2478.  
  2479.     'HARDWARE IMAGE:
  2480.     _PutImage (0, 0), imgHardwareTiles, , (sx1%, sy1%)-(sx2%, sy2%)
  2481.  
  2482.     ' COLOR IN THE TEMPORARY TILE
  2483.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  2484.  
  2485.     'SOFTWARE IMAGE:
  2486.     'IF imgColorSprite < -1 OR imgColorSprite > 0 THEN _FreeImage imgColorSprite
  2487.     'DoColorSwap imgUniversalSprite, cBlack, fgColor, imgColorSprite
  2488.  
  2489.     'HARDWARE IMAGE:
  2490.     DoColorSwapHW imgUniversalSpriteHW, cBlack, fgColor, imgColorSpriteHW
  2491.  
  2492.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  2493.     _Source imgColorSpriteHW
  2494.     _Dest imgHardwareScreen
  2495.  
  2496.     'SOFTWARE IMAGE:
  2497.     '_PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  2498.  
  2499.     'HARDWARE IMAGE:
  2500.     _PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  2501.  
  2502.     ' ADDED PER FellipeHeitor
  2503.     If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles
  2504.     If imgColorSprite < -1 Or imgColorSprite > 0 Then _FreeImage imgColorSprite
  2505.     If imgColorSpriteHW < -1 Or imgColorSpriteHW > 0 Then _FreeImage imgColorSpriteHW
  2506.     If imgUniversalSprite < -1 Or imgUniversalSprite > 0 Then _FreeImage imgUniversalSprite
  2507.     If imgUniversalSpriteHW < -1 Or imgUniversalSpriteHW > 0 Then _FreeImage imgUniversalSpriteHW
  2508.  
  2509. End Sub ' DrawColorTileHW
  2510.  
  2511. ' /////////////////////////////////////////////////////////////////////////////
  2512. ' Same as DoColorSwap but using hardware images.
  2513.  
  2514. ' Latest version with NOVARSEG's changes.
  2515. ' Based on code from:
  2516. ' Image color swap?
  2517. ' https://www.qb64.org/forum/index.php?topic=2312.0
  2518.  
  2519. ' Like Function swapcolor& except returns new image in a parameter
  2520. ' in case being a function causes a memory leak?
  2521.  
  2522. Sub DoColorSwapHW ( _
  2523.     imgOriginalHW As Long, _
  2524.     oldColor As _UNSIGNED Long, _
  2525.     newColor As _UNSIGNED Long, _
  2526.     imgNewHW As Long)
  2527.  
  2528.     Dim m As _MEM
  2529.     Dim a As _Offset
  2530.     Dim imgNew As Long
  2531.  
  2532.     a = 0
  2533.     imgNew = _CopyImage(imgOriginalHW, 32)
  2534.     m = _MemImage(imgNewHW)
  2535.     Do Until a = m.SIZE - 4
  2536.         a = a + 4
  2537.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  2538.         If c = oldColor Then
  2539.             _MemPut m, m.OFFSET + a, newColor
  2540.         End If
  2541.     Loop
  2542.     _MemFree m
  2543. End Sub ' DoColorSwapHW
  2544.  
  2545. ' ################################################################################################################################################################
  2546. ' END DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  2547. ' ################################################################################################################################################################
  2548.  
  2549. ' ################################################################################################################################################################
  2550. ' BEGIN DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  2551. ' ################################################################################################################################################################
  2552.  
  2553. ' /////////////////////////////////////////////////////////////////////////////
  2554. ' Simple version which calculates coordinates on tile sheet and destination
  2555. ' screen every time. For a faster version uses precalculated coordinates,
  2556. ' see DrawColorTileFast. This version does not support offsetX, offsetY.
  2557.  
  2558. ' Receives:
  2559. ' imgScreen& = handle to screen to draw tile on
  2560. ' imgTiles& = handle to 16x16 tile sheet of 8x8 pixel tiles colored black (256 tiles)
  2561. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  2562. ' TileColor~& = foreground color to use for tile
  2563. ' BackColor~& = background color to use for tile
  2564. ' dx% = column # to draw tile at (where each column is 8 pixels wide)
  2565. ' dy% = row # to draw tile at (where each row is 8 pixels high)
  2566.  
  2567. ' Usage:
  2568. ' DrawColorTile imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%
  2569.  
  2570. Sub DrawColorTile (imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%)
  2571.     Dim cols%
  2572.     Dim rows%
  2573.     Dim sc%
  2574.     Dim sr%
  2575.     Dim sx1%
  2576.     Dim sy1%
  2577.     Dim sx2%
  2578.     Dim sy2%
  2579.     Dim xDest%
  2580.     Dim yDest%
  2581.     Dim ColorSprite&
  2582.     Dim UniversalSprite&
  2583.  
  2584.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  2585.     cols% = 16
  2586.     rows% = 16
  2587.  
  2588.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  2589.     sc% = TileNum% Mod rows%
  2590.     sr% = TileNum% \ rows%
  2591.  
  2592.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2593.     sx1% = sc% * 8
  2594.  
  2595.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2596.     sy1% = sr% * 8
  2597.  
  2598.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2599.     sx2% = sx1% + 7
  2600.  
  2601.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2602.     sy2% = sy1% + 7
  2603.  
  2604.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2605.     xDest% = dx% * 8
  2606.  
  2607.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2608.     yDest% = dy% * 8
  2609.  
  2610.     ' IS THERE A BACKGROUND COLOR?
  2611.     If BackColor~& <> cEmpty Then
  2612.         ColorSprite& = _NewImage(8, 8, 32)
  2613.         _Dest ColorSprite&
  2614.         Cls , BackColor~&
  2615.  
  2616.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  2617.         _Source ColorSprite&
  2618.         _Dest imgScreen&
  2619.         _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  2620.     End If
  2621.  
  2622.     ' CREATE A TEMPORARY TILE TO COLOR
  2623.     UniversalSprite& = _NewImage(8, 8, 32)
  2624.  
  2625.     ' COPY THE TILE TO THE TEMPORARY ONE
  2626.     _Source imgTiles&
  2627.     _Dest UniversalSprite&
  2628.     _PutImage (0, 0), imgTiles&, UniversalSprite&, (sx1%, sy1%)-(sx2%, sy2%)
  2629.  
  2630.     ' COLOR IN THE TEMPORARY TILE
  2631.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  2632.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  2633.     DoColorSwap UniversalSprite&, cBlack, TileColor~&, ColorSprite&
  2634.  
  2635.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  2636.     _Source ColorSprite&
  2637.     _Dest imgScreen&
  2638.     _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  2639.  
  2640.     ' ADDED PER FellipeHeitor
  2641.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  2642.     If UniversalSprite& < -1 Or UniversalSprite& > 0 Then _FreeImage UniversalSprite&
  2643. End Sub ' DrawColorTile
  2644.  
  2645. ' /////////////////////////////////////////////////////////////////////////////
  2646. ' Latest version with NOVARSEG's changes.
  2647.  
  2648. ' Based on code from:
  2649.  
  2650. ' Image color swap?
  2651. ' https://www.qb64.org/forum/index.php?topic=2312.0
  2652.  
  2653. ' Like Function swapcolor& except returns new image in a parameter
  2654. ' in case being a function causes a memory leak?
  2655.  
  2656. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  2657.     Dim m As _MEM
  2658.     Dim a As _Offset
  2659.     a = 0
  2660.     imgNew& = _CopyImage(imgOriginal&, 32)
  2661.     m = _MemImage(imgNew&)
  2662.     Do Until a = m.SIZE - 4
  2663.         a = a + 4
  2664.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  2665.         If c = oldcolor~& Then
  2666.             _MemPut m, m.OFFSET + a, newcolor~&
  2667.         End If
  2668.     Loop
  2669.     _MemFree m
  2670. End Sub ' DoColorSwap&
  2671.  
  2672. ' ################################################################################################################################################################
  2673. ' END DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  2674. ' ################################################################################################################################################################
  2675.  
  2676. ' ################################################################################################################################################################
  2677. ' BEGIN DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  2678. ' ################################################################################################################################################################
  2679.  
  2680. ' /////////////////////////////////////////////////////////////////////////////
  2681. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  2682.  
  2683. ' Original version which calculates coordinates on tile sheet and destination
  2684. ' screen every time. For a faster version uses precalculated coordinates,
  2685. ' see DrawTileFast.
  2686.  
  2687. ' tw% = tile width/height (in pixels)
  2688.  
  2689. ' DIV and MOD:
  2690. ' c% = a% \ b% ' DIV (INTEGER DIVISION)
  2691. ' d% = a% MOD b% ' MODULO (DIVISION REMAINDER)
  2692.  
  2693. '_PUTIMAGE (0, 0), i ' places image at upper left corner of window w/o stretching it
  2694. '_PUTIMAGE (dx1, dy1), sourceHandle&, destHandle&, (sx1, sy1)-(sx2, sy2) ' portion of source to the top-left corner of the destination page
  2695. '_PUTIMAGE (64,  128), imgTiles&,      imgScreen&,   (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  2696. '_PutImage (64, 128), imgTiles&, imgScreen&, (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  2697.  
  2698. Sub DrawTile8 (imgTiles&, TileNum%, imgScreen&, dx%, dy%)
  2699.     Dim tw% ' width/height of tile
  2700.     Dim tw_minus1% ' width/height of tile -1
  2701.     Dim cols% ' # tiles across on tile sheet
  2702.     Dim rows% ' # tile rows on tile sheet
  2703.     Dim sc% ' source column on tile sheet
  2704.     Dim sr% ' source row on tile sheet
  2705.     Dim sx1% ' source start x
  2706.     Dim sx2% ' source end x
  2707.     Dim sy1% ' source start y
  2708.     Dim sy2% ' source end y
  2709.     Dim xDest% ' destination x
  2710.     Dim yDest% ' destination y
  2711.  
  2712.     ' SIZE OF TILE
  2713.     tw% = 8
  2714.     tw_minus1% = 7
  2715.  
  2716.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  2717.     cols% = 16
  2718.     rows% = 16
  2719.  
  2720.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  2721.     sc% = TileNum% Mod rows%
  2722.     sr% = TileNum% \ rows%
  2723.  
  2724.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  2725.  
  2726.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2727.     sx1% = sc% * tw%
  2728.  
  2729.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2730.     sy1% = sr% * tw%
  2731.  
  2732.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2733.     sx2% = sx1% + tw_minus1%
  2734.  
  2735.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2736.     sy2% = sy1% + tw_minus1%
  2737.  
  2738.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2739.     xDest% = dx% * tw%
  2740.  
  2741.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2742.     yDest% = (dy% * tw%) '+ yOffset%
  2743.  
  2744.     'Print "Tile#" + cstr$(TileNum%) + _
  2745.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  2746.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  2747.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  2748.  
  2749.     _Dest imgScreen&
  2750.  
  2751.     ' portion of source to the top-left corner of the destination page
  2752.     _PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  2753.  
  2754. End Sub ' DrawTile8
  2755.  
  2756. ' ################################################################################################################################################################
  2757. ' END DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  2758. ' ################################################################################################################################################################
  2759.  
  2760. ' ################################################################################################################################################################
  2761. ' BEGIN DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  2762. ' ################################################################################################################################################################
  2763.  
  2764. ' /////////////////////////////////////////////////////////////////////////////
  2765. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  2766. ' using hardware images
  2767.  
  2768. ' Usage:
  2769. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  2770. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  2771. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  2772.  
  2773. Sub DrawTileHw8 (imgHardwareTiles&, TileNum%, imgScreen&, dx%, dy%, iSubTileset%)
  2774.     Dim tw% ' width/height of tile
  2775.     Dim tw_minus1% ' width/height of tile -1
  2776.     Dim cols% ' # tiles across on tile sheet
  2777.     Dim rows% ' # tile rows on tile sheet
  2778.     Dim sc% ' source column on tile sheet
  2779.     Dim sr% ' source row on tile sheet
  2780.     Dim sx1% ' source start x
  2781.     Dim sx2% ' source end x
  2782.     Dim sy1% ' source start y
  2783.     Dim sy2% ' source end y
  2784.     Dim xDest% ' destination x
  2785.     Dim yDest% ' destination y
  2786.     Dim xOffset%
  2787.  
  2788.     ' CALCULATE OFFSET
  2789.     xOffset% = 128 * iSubTileset%
  2790.  
  2791.     ' SIZE OF TILE
  2792.     tw% = 8
  2793.     tw_minus1% = 7
  2794.  
  2795.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  2796.     cols% = 16
  2797.     rows% = 16
  2798.  
  2799.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  2800.     sc% = TileNum% Mod rows%
  2801.     sr% = TileNum% \ rows%
  2802.  
  2803.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  2804.  
  2805.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2806.     sx1% = (sc% * tw%) + xOffset%
  2807.  
  2808.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2809.     sy1% = sr% * tw%
  2810.  
  2811.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2812.     sx2% = sx1% + tw_minus1%
  2813.  
  2814.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2815.     sy2% = sy1% + tw_minus1%
  2816.  
  2817.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2818.     xDest% = dx% * tw%
  2819.  
  2820.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2821.     yDest% = (dy% * tw%) '+ yOffset%
  2822.  
  2823.     'Print "Tile#" + cstr$(TileNum%) + _
  2824.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  2825.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  2826.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  2827.  
  2828.     _Dest imgScreen&
  2829.  
  2830.     ' portion of source to the top-left corner of the destination page
  2831.     '_PutImage (xDest%, yDest%), imgHardwareTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  2832.     '_PutImage (200, 100)-Step(100, 100), imgHardwareTiles&, , (0, 0)-(40, 40)
  2833.     _PutImage (xDest%, yDest%), imgHardwareTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  2834.  
  2835. End Sub ' DrawTileHw8
  2836.  
  2837. ' /////////////////////////////////////////////////////////////////////////////
  2838. ' Receives an image imgTiles of 8x8 tiles
  2839. ' colored black on transparent background
  2840. ' and returns a new image imgNew
  2841. ' copied from the tiles in imgTiles,
  2842. ' except colored to foreground color fgColor,
  2843. ' and background color bgColor
  2844.  
  2845. ' Usage:
  2846. ' MakeColoredTileset imgTiles, imgNew, fgColor, bgColor
  2847.  
  2848. Sub MakeColoredTileset (imgTiles As Long, imgNew As Long, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  2849.     Dim iTileNum As Integer
  2850.     Dim iY As Integer
  2851.     Dim iX As Integer
  2852.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  2853.     imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  2854.     iTileNum = 0
  2855.     For iY = 0 To (_Height(imgTiles) \ 8) - 1
  2856.         For iX = 0 To (_Width(imgTiles) \ 8) - 1
  2857.             DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  2858.             iTileNum = iTileNum + 1
  2859.             If iTileNum > 255 Then Exit For
  2860.         Next iX
  2861.         If iTileNum > 255 Then Exit For
  2862.     Next iY
  2863. End Sub ' MakeColoredTileset
  2864.  
  2865. ' ################################################################################################################################################################
  2866. ' END DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  2867. ' ################################################################################################################################################################
  2868.  
  2869. ' ################################################################################################################################################################
  2870. ' BEGIN TILE PRECALCULATION UTILITIES
  2871. ' ################################################################################################################################################################
  2872.  
  2873. ' /////////////////////////////////////////////////////////////////////////////
  2874. ' Precalculates the tile locations ahead of time to save time copying them
  2875. ' to the screen.
  2876.  
  2877. ' Requires the following types be declared:
  2878. '
  2879. '     Type TileSheetMapType ' UDT FOR PRECALCULATED TILESHEET
  2880. '         xStart As Integer
  2881. '         xEnd As Integer
  2882. '         yStart As Integer
  2883. '         yEnd As Integer
  2884. '     End Type
  2885. '     Type TileMapType ' UDT FOR PRECALCULATED TILE MAP
  2886. '         xPos As Integer
  2887. '         yPos As Integer
  2888. '     End Type
  2889. '
  2890. ' EXAMPLE USAGE:
  2891. '
  2892. '     Dim TileCount%
  2893. '     Dim TilesheetCols%
  2894. '     Dim TilesheetRows%
  2895. '     Dim tileHeightPx%
  2896. '     Dim tileWidthPx%
  2897. '     Dim xOffset%
  2898. '     Dim yOffset%
  2899. '     Dim numTilesX%
  2900. '     Dim numTilesY%
  2901. '     REDIM arrTileSheetMap(255) AS TileSheetMapType
  2902. '     REDIM arrTileMap(20, 20) AS TileMapType
  2903. '     TileCount% = 256 ' TOTAL # OF TILES
  2904. '     TilesheetCols% = 16 ' # OF COLUMNS ON SOURCE TILE SHEET
  2905. '     TilesheetRows% = 16 ' # OF ROWS    ON SOURCE TILE SHEET
  2906. '     tileHeightPx% = 32 ' TILE HEIGHT
  2907. '     tileWidthPx% = 32 ' TILE WIDTH
  2908. '     xOffset% = 0 ' SCREEN OFFSET X
  2909. '     yOffset% = 64 ' SCREEN OFFSET Y
  2910. '     numTilesX% = 20 ' HOW MANY TILES ACROSS (ON DESTINATION)
  2911. '     numTilesY% = 20 ' HOW MANY TILES UP/DOWN (ON DESTINATION)
  2912. '     ComputeTileLocations arrTileSheetMap(), arrTileMap(), TileCount%, _
  2913. '         TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, _
  2914. '         xOffset%, yOffset%, numTilesX%, numTilesY%
  2915.  
  2916. ' TODO: this can be simplified & optimized:
  2917. '       - we don't need x/y offsets
  2918. '       - tile height/width can be hardcoded
  2919. '       - etc.
  2920.  
  2921. Sub ComputeTileLocations (arrTileSheetMap() As TileSheetMapType, arrTileMap() As TileMapType, TileCount%, TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, xOffset%, yOffset%, numTilesX%, numTilesY%)
  2922.     Dim TileNum%
  2923.     Dim sc%
  2924.     Dim sr%
  2925.     Dim sx1%
  2926.     Dim sx2%
  2927.     Dim sy1%
  2928.     Dim sy2%
  2929.  
  2930.     Dim dx%
  2931.     Dim dy%
  2932.     Dim xDest%
  2933.     Dim yDest%
  2934.  
  2935.     ' -----------------------------------------------------------------------------
  2936.     ' CALCULATE TILE SHEET COORDINATES FOR TILES 0-255
  2937.  
  2938.     For TileNum% = 0 To (TileCount% - 1)
  2939.  
  2940.         ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  2941.         sc% = TileNum% Mod TilesheetCols%
  2942.         sr% = TileNum% \ TilesheetRows%
  2943.  
  2944.         'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  2945.  
  2946.         ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  2947.         'sx1% = sc% * tw%
  2948.         sx1% = sc% * tileWidthPx%
  2949.  
  2950.         ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  2951.         'sy1% = sr% * tw%
  2952.         sy1% = sr% * tileHeightPx%
  2953.  
  2954.         ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  2955.         'sx2% = sx1% + (tw% - 1)
  2956.         sx2% = sx1% + (tileWidthPx% - 1)
  2957.  
  2958.         ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  2959.         'sy2% = sy1% + (tw% - 1)
  2960.         sy2% = sy1% + (tileHeightPx% - 1)
  2961.  
  2962.         ' SAVE THE COORDINATES FOR TileNum% IN THE ARRAY
  2963.         arrTileSheetMap(TileNum%).xStart = sx1%
  2964.         arrTileSheetMap(TileNum%).xEnd = sx2%
  2965.         arrTileSheetMap(TileNum%).yStart = sy1%
  2966.         arrTileSheetMap(TileNum%).yEnd = sy2%
  2967.  
  2968.     Next TileNum%
  2969.  
  2970.     ' -----------------------------------------------------------------------------
  2971.     ' CALCULATE SCREEN COORDINATES FOR TILES
  2972.  
  2973.     For dx% = 0 To (numTilesX% - 1)
  2974.         For dy% = 0 To (numTilesY% - 1)
  2975.  
  2976.             ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  2977.             'xDest% = dx% * tw%
  2978.             xDest% = (dx% * tileWidthPx%) + xOffset%
  2979.  
  2980.             ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  2981.             'yDest% = (dy% * tw%) + 64
  2982.             yDest% = (dy% * tileHeightPx%) + yOffset%
  2983.  
  2984.             'Print "Tile#" + cstr$(TileNum%) + " at r" + cstr$(sr%) + "c" + cstr$(sc%) + " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  2985.  
  2986.             ' SAVE THE SCREEN PIXEL COORDINATES FOR dx%, dy% IN THE ARRAY
  2987.             ' WHERE dx% and dy% ARE 1-BASED
  2988.             arrTileMap(dx% + 1, dy% + 1).xPos = xDest%
  2989.             arrTileMap(dx% + 1, dy% + 1).yPos = yDest%
  2990.  
  2991.         Next dy%
  2992.     Next dx%
  2993.  
  2994. End Sub ' ComputeTileLocations
  2995.  
  2996. ' ################################################################################################################################################################
  2997. ' END TILE PRECALCULATION UTILITIES
  2998. ' ################################################################################################################################################################
  2999.  
  3000. ' ################################################################################################################################################################
  3001. ' BEGIN TILE TO IMAGE ROUTINES
  3002. ' ################################################################################################################################################################
  3003.  
  3004. ' /////////////////////////////////////////////////////////////////////////////
  3005. ' Loads tileset of 256 8x8 tiles into a 128x128 image (16 columns x 16 rows)
  3006. ' where tiles are a single color.
  3007.  
  3008. ' Parameters:
  3009. ' imgTiles& = contains the resulting tileset image
  3010. ' fgColor = tile color
  3011. ' bgColor = tile background color
  3012.  
  3013. Function GetTiles$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  3014.     Dim RoutineName As String: RoutineName = "GetTiles$"
  3015.     Dim sResult As String: sResult = ""
  3016.     ReDim arrTileText(0 To 255) As String
  3017.  
  3018.     Dim iTileNum As Integer
  3019.  
  3020.     ReDim arrLines(-1) As String
  3021.     Dim iFromX As Integer
  3022.     Dim iFromY As Integer
  3023.     Dim sLine As String
  3024.     Dim sChar As String
  3025.  
  3026.     Dim iTileX As Integer
  3027.     Dim iTileY As Integer
  3028.     Dim iToX As Integer
  3029.     Dim iToY As Integer
  3030.     Dim pixelColor As _Unsigned Long
  3031.     Dim bFinished As Integer
  3032.  
  3033.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  3034.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  3035.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  3036.     imgTiles& = _NewImage(128, 128, 32)
  3037.     '    Cls , cEmpty ' set the background color as transparent
  3038.  
  3039.     'Screen imgTiles&
  3040.     'Cls , bgColor ' set the background color as transparent
  3041.     _Dest imgTiles&
  3042.     'DrawRect 0, 0, 128, 128, cEmpty
  3043.     'DrawBox 0, 0, 128, cWhite
  3044.     Cls , cEmpty ' set the background color as transparent
  3045.  
  3046.     GetTileText arrTileText()
  3047.     iTileX = 0
  3048.     iTileY = 0
  3049.     bFinished = FALSE
  3050.     For iTileNum = 0 To 255
  3051.         split arrTileText(iTileNum), Chr$(13), arrLines()
  3052.         iToY = iTileY * 8
  3053.         If (iToY > _Height(imgTiles&)) Then
  3054.             sResult = "iToY value " + cstr$(iToY) + " " + _
  3055.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  3056.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  3057.             bFinished = TRUE
  3058.             Exit For
  3059.         End If
  3060.  
  3061.         For iFromY = LBound(arrLines) To UBound(arrLines)
  3062.             sLine = arrLines(iFromY)
  3063.             If Len(sLine) > 0 Then
  3064.                 iToX = iTileX * 8
  3065.                 For iFromX = 1 To Len(sLine)
  3066.                     sChar = Mid$(sLine, iFromX, 1)
  3067.                     If sChar = "." Then
  3068.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  3069.                     Else
  3070.                         pixelColor = fgColor ' cBlack
  3071.                     End If
  3072.                     PSet (iToX, iToY), pixelColor
  3073.                     iToX = iToX + 1
  3074.                     If (iToX > _Width(imgTiles&)) Then
  3075.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  3076.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  3077.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  3078.                         bFinished = TRUE
  3079.                         Exit For
  3080.                     End If
  3081.                 Next iFromX
  3082.                 iToY = iToY + 1
  3083.                 If bFinished = TRUE Then Exit For
  3084.             End If
  3085.         Next iFromY
  3086.         If bFinished = TRUE Then Exit For
  3087.  
  3088.         iTileX = iTileX + 1
  3089.         If iTileX > 15 Then
  3090.             iTileX = 0
  3091.             iTileY = iTileY + 1
  3092.             'if iTileY > 15 then
  3093.             '    sResult = "Exceeded max 16 rows of tiles." + _
  3094.             '        "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  3095.             '    bFinished = TRUE
  3096.             '    exit for
  3097.             'end if
  3098.         End If
  3099.     Next iTileNum
  3100.  
  3101.     GetTiles$ = sResult
  3102. End Function ' GetTiles$
  3103.  
  3104. ' ################################################################################################################################################################
  3105. ' END TILE TO IMAGE ROUTINES
  3106. ' ################################################################################################################################################################
  3107.  
  3108. ' ################################################################################################################################################################
  3109. ' BEGIN TILE DEFINITIONS
  3110. ' ################################################################################################################################################################
  3111.  
  3112. ' /////////////////////////////////////////////////////////////////////////////
  3113. ' Returns an array of 256 8x8 tiles defined in text
  3114. ' where each tile is defined by "." as blank and anything else is a pixel
  3115. ' and each row is delimited by chr$(13)
  3116.  
  3117. Sub GetTileText (arrTileText() As String)
  3118.     ReDim arrTileText(0 To 255) As String
  3119.  
  3120.     m$ = ""
  3121.     m$ = m$ + "22....22" + Chr$(13)
  3122.     m$ = m$ + "2..22..2" + Chr$(13)
  3123.     m$ = m$ + "2..2...2" + Chr$(13)
  3124.     m$ = m$ + "2...2..2" + Chr$(13)
  3125.     m$ = m$ + "2..22..2" + Chr$(13)
  3126.     m$ = m$ + "2..22..2" + Chr$(13)
  3127.     m$ = m$ + "22....22" + Chr$(13)
  3128.     m$ = m$ + "22222222" + Chr$(13)
  3129.     arrTileText(0) = m$
  3130.  
  3131.     m$ = ""
  3132.     m$ = m$ + "........" + Chr$(13)
  3133.     m$ = m$ + "........" + Chr$(13)
  3134.     m$ = m$ + "........" + Chr$(13)
  3135.     m$ = m$ + "........" + Chr$(13)
  3136.     m$ = m$ + "........" + Chr$(13)
  3137.     m$ = m$ + "........" + Chr$(13)
  3138.     m$ = m$ + "........" + Chr$(13)
  3139.     m$ = m$ + "........" + Chr$(13)
  3140.     arrTileText(1) = m$
  3141.  
  3142.     m$ = ""
  3143.     m$ = m$ + "........" + Chr$(13)
  3144.     m$ = m$ + "........" + Chr$(13)
  3145.     m$ = m$ + "........" + Chr$(13)
  3146.     m$ = m$ + "........" + Chr$(13)
  3147.     m$ = m$ + "........" + Chr$(13)
  3148.     m$ = m$ + "........" + Chr$(13)
  3149.     m$ = m$ + "........" + Chr$(13)
  3150.     m$ = m$ + "........" + Chr$(13)
  3151.     arrTileText(2) = m$
  3152.  
  3153.     m$ = ""
  3154.     m$ = m$ + "........" + Chr$(13)
  3155.     m$ = m$ + "........" + Chr$(13)
  3156.     m$ = m$ + "........" + Chr$(13)
  3157.     m$ = m$ + "........" + Chr$(13)
  3158.     m$ = m$ + "........" + Chr$(13)
  3159.     m$ = m$ + "........" + Chr$(13)
  3160.     m$ = m$ + "........" + Chr$(13)
  3161.     m$ = m$ + "........" + Chr$(13)
  3162.     arrTileText(3) = m$
  3163.  
  3164.     m$ = ""
  3165.     m$ = m$ + "........" + Chr$(13)
  3166.     m$ = m$ + "........" + Chr$(13)
  3167.     m$ = m$ + "........" + Chr$(13)
  3168.     m$ = m$ + "........" + Chr$(13)
  3169.     m$ = m$ + "........" + Chr$(13)
  3170.     m$ = m$ + "........" + Chr$(13)
  3171.     m$ = m$ + "........" + Chr$(13)
  3172.     m$ = m$ + "........" + Chr$(13)
  3173.     arrTileText(4) = m$
  3174.  
  3175.     m$ = ""
  3176.     m$ = m$ + "........" + Chr$(13)
  3177.     m$ = m$ + "........" + Chr$(13)
  3178.     m$ = m$ + "........" + Chr$(13)
  3179.     m$ = m$ + "........" + Chr$(13)
  3180.     m$ = m$ + "........" + Chr$(13)
  3181.     m$ = m$ + "........" + Chr$(13)
  3182.     m$ = m$ + "........" + Chr$(13)
  3183.     m$ = m$ + "........" + Chr$(13)
  3184.     arrTileText(5) = m$
  3185.  
  3186.     m$ = ""
  3187.     m$ = m$ + "........" + Chr$(13)
  3188.     m$ = m$ + "........" + Chr$(13)
  3189.     m$ = m$ + "........" + Chr$(13)
  3190.     m$ = m$ + "........" + Chr$(13)
  3191.     m$ = m$ + "........" + Chr$(13)
  3192.     m$ = m$ + "........" + Chr$(13)
  3193.     m$ = m$ + "........" + Chr$(13)
  3194.     m$ = m$ + "........" + Chr$(13)
  3195.     arrTileText(6) = m$
  3196.  
  3197.     m$ = ""
  3198.     m$ = m$ + "........" + Chr$(13)
  3199.     m$ = m$ + "........" + Chr$(13)
  3200.     m$ = m$ + "........" + Chr$(13)
  3201.     m$ = m$ + "........" + Chr$(13)
  3202.     m$ = m$ + "........" + Chr$(13)
  3203.     m$ = m$ + "........" + Chr$(13)
  3204.     m$ = m$ + "........" + Chr$(13)
  3205.     m$ = m$ + "........" + Chr$(13)
  3206.     arrTileText(7) = m$
  3207.  
  3208.     m$ = ""
  3209.     m$ = m$ + "........" + Chr$(13)
  3210.     m$ = m$ + "........" + Chr$(13)
  3211.     m$ = m$ + "........" + Chr$(13)
  3212.     m$ = m$ + "........" + Chr$(13)
  3213.     m$ = m$ + "........" + Chr$(13)
  3214.     m$ = m$ + "........" + Chr$(13)
  3215.     m$ = m$ + "........" + Chr$(13)
  3216.     m$ = m$ + "........" + Chr$(13)
  3217.     arrTileText(8) = m$
  3218.  
  3219.     m$ = ""
  3220.     m$ = m$ + "........" + Chr$(13)
  3221.     m$ = m$ + "........" + Chr$(13)
  3222.     m$ = m$ + "........" + Chr$(13)
  3223.     m$ = m$ + "........" + Chr$(13)
  3224.     m$ = m$ + "........" + Chr$(13)
  3225.     m$ = m$ + "........" + Chr$(13)
  3226.     m$ = m$ + "........" + Chr$(13)
  3227.     m$ = m$ + "........" + Chr$(13)
  3228.     arrTileText(9) = m$
  3229.  
  3230.     m$ = ""
  3231.     m$ = m$ + "........" + Chr$(13)
  3232.     m$ = m$ + "........" + Chr$(13)
  3233.     m$ = m$ + "........" + Chr$(13)
  3234.     m$ = m$ + "........" + Chr$(13)
  3235.     m$ = m$ + "........" + Chr$(13)
  3236.     m$ = m$ + "........" + Chr$(13)
  3237.     m$ = m$ + "........" + Chr$(13)
  3238.     m$ = m$ + "........" + Chr$(13)
  3239.     arrTileText(10) = m$
  3240.  
  3241.     m$ = ""
  3242.     m$ = m$ + "........" + Chr$(13)
  3243.     m$ = m$ + "........" + Chr$(13)
  3244.     m$ = m$ + "........" + Chr$(13)
  3245.     m$ = m$ + "........" + Chr$(13)
  3246.     m$ = m$ + "........" + Chr$(13)
  3247.     m$ = m$ + "........" + Chr$(13)
  3248.     m$ = m$ + "........" + Chr$(13)
  3249.     m$ = m$ + "........" + Chr$(13)
  3250.     arrTileText(11) = m$
  3251.  
  3252.     m$ = ""
  3253.     m$ = m$ + "........" + Chr$(13)
  3254.     m$ = m$ + "........" + Chr$(13)
  3255.     m$ = m$ + "........" + Chr$(13)
  3256.     m$ = m$ + "........" + Chr$(13)
  3257.     m$ = m$ + "........" + Chr$(13)
  3258.     m$ = m$ + "........" + Chr$(13)
  3259.     m$ = m$ + "........" + Chr$(13)
  3260.     m$ = m$ + "........" + Chr$(13)
  3261.     arrTileText(12) = m$
  3262.  
  3263.     m$ = ""
  3264.     m$ = m$ + "........" + Chr$(13)
  3265.     m$ = m$ + "........" + Chr$(13)
  3266.     m$ = m$ + "........" + Chr$(13)
  3267.     m$ = m$ + "........" + Chr$(13)
  3268.     m$ = m$ + "........" + Chr$(13)
  3269.     m$ = m$ + "........" + Chr$(13)
  3270.     m$ = m$ + "........" + Chr$(13)
  3271.     m$ = m$ + "........" + Chr$(13)
  3272.     arrTileText(13) = m$
  3273.  
  3274.     m$ = ""
  3275.     m$ = m$ + "........" + Chr$(13)
  3276.     m$ = m$ + "........" + Chr$(13)
  3277.     m$ = m$ + "........" + Chr$(13)
  3278.     m$ = m$ + "........" + Chr$(13)
  3279.     m$ = m$ + "........" + Chr$(13)
  3280.     m$ = m$ + "........" + Chr$(13)
  3281.     m$ = m$ + "........" + Chr$(13)
  3282.     m$ = m$ + "........" + Chr$(13)
  3283.     arrTileText(14) = m$
  3284.  
  3285.     m$ = ""
  3286.     m$ = m$ + "........" + Chr$(13)
  3287.     m$ = m$ + "........" + Chr$(13)
  3288.     m$ = m$ + "........" + Chr$(13)
  3289.     m$ = m$ + "........" + Chr$(13)
  3290.     m$ = m$ + "........" + Chr$(13)
  3291.     m$ = m$ + "........" + Chr$(13)
  3292.     m$ = m$ + "........" + Chr$(13)
  3293.     m$ = m$ + "........" + Chr$(13)
  3294.     arrTileText(15) = m$
  3295.  
  3296.     m$ = ""
  3297.     m$ = m$ + "........" + Chr$(13)
  3298.     m$ = m$ + "........" + Chr$(13)
  3299.     m$ = m$ + "........" + Chr$(13)
  3300.     m$ = m$ + "........" + Chr$(13)
  3301.     m$ = m$ + "........" + Chr$(13)
  3302.     m$ = m$ + "........" + Chr$(13)
  3303.     m$ = m$ + "........" + Chr$(13)
  3304.     m$ = m$ + "........" + Chr$(13)
  3305.     arrTileText(16) = m$
  3306.  
  3307.     m$ = ""
  3308.     m$ = m$ + "........" + Chr$(13)
  3309.     m$ = m$ + "........" + Chr$(13)
  3310.     m$ = m$ + "........" + Chr$(13)
  3311.     m$ = m$ + "........" + Chr$(13)
  3312.     m$ = m$ + "........" + Chr$(13)
  3313.     m$ = m$ + "........" + Chr$(13)
  3314.     m$ = m$ + "........" + Chr$(13)
  3315.     m$ = m$ + "........" + Chr$(13)
  3316.     arrTileText(17) = m$
  3317.  
  3318.     m$ = ""
  3319.     m$ = m$ + "........" + Chr$(13)
  3320.     m$ = m$ + "........" + Chr$(13)
  3321.     m$ = m$ + "........" + Chr$(13)
  3322.     m$ = m$ + "........" + Chr$(13)
  3323.     m$ = m$ + "........" + Chr$(13)
  3324.     m$ = m$ + "........" + Chr$(13)
  3325.     m$ = m$ + "........" + Chr$(13)
  3326.     m$ = m$ + "........" + Chr$(13)
  3327.     arrTileText(18) = m$
  3328.  
  3329.     m$ = ""
  3330.     m$ = m$ + "........" + Chr$(13)
  3331.     m$ = m$ + "........" + Chr$(13)
  3332.     m$ = m$ + "........" + Chr$(13)
  3333.     m$ = m$ + "........" + Chr$(13)
  3334.     m$ = m$ + "........" + Chr$(13)
  3335.     m$ = m$ + "........" + Chr$(13)
  3336.     m$ = m$ + "........" + Chr$(13)
  3337.     m$ = m$ + "........" + Chr$(13)
  3338.     arrTileText(19) = m$
  3339.  
  3340.     m$ = ""
  3341.     m$ = m$ + "........" + Chr$(13)
  3342.     m$ = m$ + "........" + Chr$(13)
  3343.     m$ = m$ + "........" + Chr$(13)
  3344.     m$ = m$ + "........" + Chr$(13)
  3345.     m$ = m$ + "........" + Chr$(13)
  3346.     m$ = m$ + "........" + Chr$(13)
  3347.     m$ = m$ + "........" + Chr$(13)
  3348.     m$ = m$ + "........" + Chr$(13)
  3349.     arrTileText(20) = m$
  3350.  
  3351.     m$ = ""
  3352.     m$ = m$ + "........" + Chr$(13)
  3353.     m$ = m$ + "........" + Chr$(13)
  3354.     m$ = m$ + "........" + Chr$(13)
  3355.     m$ = m$ + "........" + Chr$(13)
  3356.     m$ = m$ + "........" + Chr$(13)
  3357.     m$ = m$ + "........" + Chr$(13)
  3358.     m$ = m$ + "........" + Chr$(13)
  3359.     m$ = m$ + "........" + Chr$(13)
  3360.     arrTileText(21) = m$
  3361.  
  3362.     m$ = ""
  3363.     m$ = m$ + "........" + Chr$(13)
  3364.     m$ = m$ + "........" + Chr$(13)
  3365.     m$ = m$ + "........" + Chr$(13)
  3366.     m$ = m$ + "........" + Chr$(13)
  3367.     m$ = m$ + "........" + Chr$(13)
  3368.     m$ = m$ + "........" + Chr$(13)
  3369.     m$ = m$ + "........" + Chr$(13)
  3370.     m$ = m$ + "........" + Chr$(13)
  3371.     arrTileText(22) = m$
  3372.  
  3373.     m$ = ""
  3374.     m$ = m$ + "........" + Chr$(13)
  3375.     m$ = m$ + "........" + Chr$(13)
  3376.     m$ = m$ + "........" + Chr$(13)
  3377.     m$ = m$ + "........" + Chr$(13)
  3378.     m$ = m$ + "........" + Chr$(13)
  3379.     m$ = m$ + "........" + Chr$(13)
  3380.     m$ = m$ + "........" + Chr$(13)
  3381.     m$ = m$ + "........" + Chr$(13)
  3382.     arrTileText(23) = m$
  3383.  
  3384.     m$ = ""
  3385.     m$ = m$ + "........" + Chr$(13)
  3386.     m$ = m$ + "........" + Chr$(13)
  3387.     m$ = m$ + "........" + Chr$(13)
  3388.     m$ = m$ + "........" + Chr$(13)
  3389.     m$ = m$ + "........" + Chr$(13)
  3390.     m$ = m$ + "........" + Chr$(13)
  3391.     m$ = m$ + "........" + Chr$(13)
  3392.     m$ = m$ + "........" + Chr$(13)
  3393.     arrTileText(24) = m$
  3394.  
  3395.     m$ = ""
  3396.     m$ = m$ + "........" + Chr$(13)
  3397.     m$ = m$ + "........" + Chr$(13)
  3398.     m$ = m$ + "........" + Chr$(13)
  3399.     m$ = m$ + "........" + Chr$(13)
  3400.     m$ = m$ + "........" + Chr$(13)
  3401.     m$ = m$ + "........" + Chr$(13)
  3402.     m$ = m$ + "........" + Chr$(13)
  3403.     m$ = m$ + "........" + Chr$(13)
  3404.     arrTileText(25) = m$
  3405.  
  3406.     m$ = ""
  3407.     m$ = m$ + "........" + Chr$(13)
  3408.     m$ = m$ + "........" + Chr$(13)
  3409.     m$ = m$ + "........" + Chr$(13)
  3410.     m$ = m$ + "........" + Chr$(13)
  3411.     m$ = m$ + "........" + Chr$(13)
  3412.     m$ = m$ + "........" + Chr$(13)
  3413.     m$ = m$ + "........" + Chr$(13)
  3414.     m$ = m$ + "........" + Chr$(13)
  3415.     arrTileText(26) = m$
  3416.  
  3417.     m$ = ""
  3418.     m$ = m$ + "........" + Chr$(13)
  3419.     m$ = m$ + "........" + Chr$(13)
  3420.     m$ = m$ + "........" + Chr$(13)
  3421.     m$ = m$ + "........" + Chr$(13)
  3422.     m$ = m$ + "........" + Chr$(13)
  3423.     m$ = m$ + "........" + Chr$(13)
  3424.     m$ = m$ + "........" + Chr$(13)
  3425.     m$ = m$ + "........" + Chr$(13)
  3426.     arrTileText(27) = m$
  3427.  
  3428.     m$ = ""
  3429.     m$ = m$ + "........" + Chr$(13)
  3430.     m$ = m$ + "........" + Chr$(13)
  3431.     m$ = m$ + "........" + Chr$(13)
  3432.     m$ = m$ + "........" + Chr$(13)
  3433.     m$ = m$ + "........" + Chr$(13)
  3434.     m$ = m$ + "........" + Chr$(13)
  3435.     m$ = m$ + "........" + Chr$(13)
  3436.     m$ = m$ + "........" + Chr$(13)
  3437.     arrTileText(28) = m$
  3438.  
  3439.     m$ = ""
  3440.     m$ = m$ + "........" + Chr$(13)
  3441.     m$ = m$ + "........" + Chr$(13)
  3442.     m$ = m$ + "........" + Chr$(13)
  3443.     m$ = m$ + "........" + Chr$(13)
  3444.     m$ = m$ + "........" + Chr$(13)
  3445.     m$ = m$ + "........" + Chr$(13)
  3446.     m$ = m$ + "........" + Chr$(13)
  3447.     m$ = m$ + "........" + Chr$(13)
  3448.     arrTileText(29) = m$
  3449.  
  3450.     m$ = ""
  3451.     m$ = m$ + "........" + Chr$(13)
  3452.     m$ = m$ + "........" + Chr$(13)
  3453.     m$ = m$ + "........" + Chr$(13)
  3454.     m$ = m$ + "........" + Chr$(13)
  3455.     m$ = m$ + "........" + Chr$(13)
  3456.     m$ = m$ + "........" + Chr$(13)
  3457.     m$ = m$ + "........" + Chr$(13)
  3458.     m$ = m$ + "........" + Chr$(13)
  3459.     arrTileText(30) = m$
  3460.  
  3461.     m$ = ""
  3462.     m$ = m$ + "........" + Chr$(13)
  3463.     m$ = m$ + "........" + Chr$(13)
  3464.     m$ = m$ + "........" + Chr$(13)
  3465.     m$ = m$ + "........" + Chr$(13)
  3466.     m$ = m$ + "........" + Chr$(13)
  3467.     m$ = m$ + "........" + Chr$(13)
  3468.     m$ = m$ + "........" + Chr$(13)
  3469.     m$ = m$ + "........" + Chr$(13)
  3470.     arrTileText(31) = m$
  3471.  
  3472.     m$ = ""
  3473.     m$ = m$ + "........" + Chr$(13)
  3474.     m$ = m$ + "........" + Chr$(13)
  3475.     m$ = m$ + "........" + Chr$(13)
  3476.     m$ = m$ + "........" + Chr$(13)
  3477.     m$ = m$ + "........" + Chr$(13)
  3478.     m$ = m$ + "........" + Chr$(13)
  3479.     m$ = m$ + "........" + Chr$(13)
  3480.     m$ = m$ + "........" + Chr$(13)
  3481.     arrTileText(32) = m$
  3482.  
  3483.     m$ = ""
  3484.     m$ = m$ + "...22..." + Chr$(13)
  3485.     m$ = m$ + "...22..." + Chr$(13)
  3486.     m$ = m$ + "...22..." + Chr$(13)
  3487.     m$ = m$ + "...22..." + Chr$(13)
  3488.     m$ = m$ + "........" + Chr$(13)
  3489.     m$ = m$ + "........" + Chr$(13)
  3490.     m$ = m$ + "...22..." + Chr$(13)
  3491.     m$ = m$ + "........" + Chr$(13)
  3492.     arrTileText(33) = m$
  3493.  
  3494.     m$ = ""
  3495.     m$ = m$ + ".22..22." + Chr$(13)
  3496.     m$ = m$ + ".22..22." + Chr$(13)
  3497.     m$ = m$ + ".22..22." + Chr$(13)
  3498.     m$ = m$ + "........" + Chr$(13)
  3499.     m$ = m$ + "........" + Chr$(13)
  3500.     m$ = m$ + "........" + Chr$(13)
  3501.     m$ = m$ + "........" + Chr$(13)
  3502.     m$ = m$ + "........" + Chr$(13)
  3503.     arrTileText(34) = m$
  3504.  
  3505.     m$ = ""
  3506.     m$ = m$ + ".22..22." + Chr$(13)
  3507.     m$ = m$ + ".22..22." + Chr$(13)
  3508.     m$ = m$ + "22222222" + Chr$(13)
  3509.     m$ = m$ + ".22..22." + Chr$(13)
  3510.     m$ = m$ + "22222222" + Chr$(13)
  3511.     m$ = m$ + ".22..22." + Chr$(13)
  3512.     m$ = m$ + ".22..22." + Chr$(13)
  3513.     m$ = m$ + "........" + Chr$(13)
  3514.     arrTileText(35) = m$
  3515.  
  3516.     m$ = ""
  3517.     m$ = m$ + "...22..." + Chr$(13)
  3518.     m$ = m$ + "..22222." + Chr$(13)
  3519.     m$ = m$ + ".22....." + Chr$(13)
  3520.     m$ = m$ + "..2222.." + Chr$(13)
  3521.     m$ = m$ + ".....22." + Chr$(13)
  3522.     m$ = m$ + ".22222.." + Chr$(13)
  3523.     m$ = m$ + "...22..." + Chr$(13)
  3524.     m$ = m$ + "........" + Chr$(13)
  3525.     arrTileText(36) = m$
  3526.  
  3527.     m$ = ""
  3528.     m$ = m$ + ".22...2." + Chr$(13)
  3529.     m$ = m$ + ".22..22." + Chr$(13)
  3530.     m$ = m$ + "....22.." + Chr$(13)
  3531.     m$ = m$ + "...22..." + Chr$(13)
  3532.     m$ = m$ + "..22...." + Chr$(13)
  3533.     m$ = m$ + ".22..22." + Chr$(13)
  3534.     m$ = m$ + ".2...22." + Chr$(13)
  3535.     m$ = m$ + "........" + Chr$(13)
  3536.     arrTileText(37) = m$
  3537.  
  3538.     m$ = ""
  3539.     m$ = m$ + "..2222.." + Chr$(13)
  3540.     m$ = m$ + ".22..22." + Chr$(13)
  3541.     m$ = m$ + "..2222.." + Chr$(13)
  3542.     m$ = m$ + "..222..." + Chr$(13)
  3543.     m$ = m$ + ".22..222" + Chr$(13)
  3544.     m$ = m$ + ".22..22." + Chr$(13)
  3545.     m$ = m$ + "..222222" + Chr$(13)
  3546.     m$ = m$ + "........" + Chr$(13)
  3547.     arrTileText(38) = m$
  3548.  
  3549.     m$ = ""
  3550.     m$ = m$ + ".....22." + Chr$(13)
  3551.     m$ = m$ + "....22.." + Chr$(13)
  3552.     m$ = m$ + "...22..." + Chr$(13)
  3553.     m$ = m$ + "........" + Chr$(13)
  3554.     m$ = m$ + "........" + Chr$(13)
  3555.     m$ = m$ + "........" + Chr$(13)
  3556.     m$ = m$ + "........" + Chr$(13)
  3557.     m$ = m$ + "........" + Chr$(13)
  3558.     arrTileText(39) = m$
  3559.  
  3560.     m$ = ""
  3561.     m$ = m$ + "....22.." + Chr$(13)
  3562.     m$ = m$ + "...22..." + Chr$(13)
  3563.     m$ = m$ + "..22...." + Chr$(13)
  3564.     m$ = m$ + "..22...." + Chr$(13)
  3565.     m$ = m$ + "..22...." + Chr$(13)
  3566.     m$ = m$ + "...22..." + Chr$(13)
  3567.     m$ = m$ + "....22.." + Chr$(13)
  3568.     m$ = m$ + "........" + Chr$(13)
  3569.     arrTileText(40) = m$
  3570.  
  3571.     m$ = ""
  3572.     m$ = m$ + "..22...." + Chr$(13)
  3573.     m$ = m$ + "...22..." + Chr$(13)
  3574.     m$ = m$ + "....22.." + Chr$(13)
  3575.     m$ = m$ + "....22.." + Chr$(13)
  3576.     m$ = m$ + "....22.." + Chr$(13)
  3577.     m$ = m$ + "...22..." + Chr$(13)
  3578.     m$ = m$ + "..22...." + Chr$(13)
  3579.     m$ = m$ + "........" + Chr$(13)
  3580.     arrTileText(41) = m$
  3581.  
  3582.     m$ = ""
  3583.     m$ = m$ + "........" + Chr$(13)
  3584.     m$ = m$ + ".22..22." + Chr$(13)
  3585.     m$ = m$ + "..2222.." + Chr$(13)
  3586.     m$ = m$ + "22222222" + Chr$(13)
  3587.     m$ = m$ + "..2222.." + Chr$(13)
  3588.     m$ = m$ + ".22..22." + Chr$(13)
  3589.     m$ = m$ + "........" + Chr$(13)
  3590.     m$ = m$ + "........" + Chr$(13)
  3591.     arrTileText(42) = m$
  3592.  
  3593.     m$ = ""
  3594.     m$ = m$ + "........" + Chr$(13)
  3595.     m$ = m$ + "...22..." + Chr$(13)
  3596.     m$ = m$ + "...22..." + Chr$(13)
  3597.     m$ = m$ + ".222222." + Chr$(13)
  3598.     m$ = m$ + "...22..." + Chr$(13)
  3599.     m$ = m$ + "...22..." + Chr$(13)
  3600.     m$ = m$ + "........" + Chr$(13)
  3601.     m$ = m$ + "........" + Chr$(13)
  3602.     arrTileText(43) = m$
  3603.  
  3604.     m$ = ""
  3605.     m$ = m$ + "........" + Chr$(13)
  3606.     m$ = m$ + "........" + Chr$(13)
  3607.     m$ = m$ + "........" + Chr$(13)
  3608.     m$ = m$ + "........" + Chr$(13)
  3609.     m$ = m$ + "........" + Chr$(13)
  3610.     m$ = m$ + "...22..." + Chr$(13)
  3611.     m$ = m$ + "...22..." + Chr$(13)
  3612.     m$ = m$ + "..22...." + Chr$(13)
  3613.     arrTileText(44) = m$
  3614.  
  3615.     m$ = ""
  3616.     m$ = m$ + "........" + Chr$(13)
  3617.     m$ = m$ + "........" + Chr$(13)
  3618.     m$ = m$ + "........" + Chr$(13)
  3619.     m$ = m$ + ".222222." + Chr$(13)
  3620.     m$ = m$ + "........" + Chr$(13)
  3621.     m$ = m$ + "........" + Chr$(13)
  3622.     m$ = m$ + "........" + Chr$(13)
  3623.     m$ = m$ + "........" + Chr$(13)
  3624.     arrTileText(45) = m$
  3625.  
  3626.     m$ = ""
  3627.     m$ = m$ + "........" + Chr$(13)
  3628.     m$ = m$ + "........" + Chr$(13)
  3629.     m$ = m$ + "........" + Chr$(13)
  3630.     m$ = m$ + "........" + Chr$(13)
  3631.     m$ = m$ + "........" + Chr$(13)
  3632.     m$ = m$ + "...22..." + Chr$(13)
  3633.     m$ = m$ + "...22..." + Chr$(13)
  3634.     m$ = m$ + "........" + Chr$(13)
  3635.     arrTileText(46) = m$
  3636.  
  3637.     m$ = ""
  3638.     m$ = m$ + "........" + Chr$(13)
  3639.     m$ = m$ + "......22" + Chr$(13)
  3640.     m$ = m$ + ".....22." + Chr$(13)
  3641.     m$ = m$ + "....22.." + Chr$(13)
  3642.     m$ = m$ + "...22..." + Chr$(13)
  3643.     m$ = m$ + "..22...." + Chr$(13)
  3644.     m$ = m$ + ".22....." + Chr$(13)
  3645.     m$ = m$ + "........" + Chr$(13)
  3646.     arrTileText(47) = m$
  3647.  
  3648.     m$ = ""
  3649.     m$ = m$ + "..2222.." + Chr$(13)
  3650.     m$ = m$ + ".22..22." + Chr$(13)
  3651.     m$ = m$ + ".22.222." + Chr$(13)
  3652.     m$ = m$ + ".222.22." + Chr$(13)
  3653.     m$ = m$ + ".22..22." + Chr$(13)
  3654.     m$ = m$ + ".22..22." + Chr$(13)
  3655.     m$ = m$ + "..2222.." + Chr$(13)
  3656.     m$ = m$ + "........" + Chr$(13)
  3657.     arrTileText(48) = m$
  3658.  
  3659.     m$ = ""
  3660.     m$ = m$ + "...22..." + Chr$(13)
  3661.     m$ = m$ + "...22..." + Chr$(13)
  3662.     m$ = m$ + "..222..." + Chr$(13)
  3663.     m$ = m$ + "...22..." + Chr$(13)
  3664.     m$ = m$ + "...22..." + Chr$(13)
  3665.     m$ = m$ + "...22..." + Chr$(13)
  3666.     m$ = m$ + ".222222." + Chr$(13)
  3667.     m$ = m$ + "........" + Chr$(13)
  3668.     arrTileText(49) = m$
  3669.  
  3670.     m$ = ""
  3671.     m$ = m$ + "..2222.." + Chr$(13)
  3672.     m$ = m$ + ".22..22." + Chr$(13)
  3673.     m$ = m$ + ".....22." + Chr$(13)
  3674.     m$ = m$ + "....22.." + Chr$(13)
  3675.     m$ = m$ + "..22...." + Chr$(13)
  3676.     m$ = m$ + ".22....." + Chr$(13)
  3677.     m$ = m$ + ".222222." + Chr$(13)
  3678.     m$ = m$ + "........" + Chr$(13)
  3679.     arrTileText(50) = m$
  3680.  
  3681.     m$ = ""
  3682.     m$ = m$ + "..2222.." + Chr$(13)
  3683.     m$ = m$ + ".22..22." + Chr$(13)
  3684.     m$ = m$ + ".....22." + Chr$(13)
  3685.     m$ = m$ + "...222.." + Chr$(13)
  3686.     m$ = m$ + ".....22." + Chr$(13)
  3687.     m$ = m$ + ".22..22." + Chr$(13)
  3688.     m$ = m$ + "..2222.." + Chr$(13)
  3689.     m$ = m$ + "........" + Chr$(13)
  3690.     arrTileText(51) = m$
  3691.  
  3692.     m$ = ""
  3693.     m$ = m$ + ".....22." + Chr$(13)
  3694.     m$ = m$ + "....222." + Chr$(13)
  3695.     m$ = m$ + "...2222." + Chr$(13)
  3696.     m$ = m$ + ".22..22." + Chr$(13)
  3697.     m$ = m$ + ".2222222" + Chr$(13)
  3698.     m$ = m$ + ".....22." + Chr$(13)
  3699.     m$ = m$ + ".....22." + Chr$(13)
  3700.     m$ = m$ + "........" + Chr$(13)
  3701.     arrTileText(52) = m$
  3702.  
  3703.     m$ = ""
  3704.     m$ = m$ + ".222222." + Chr$(13)
  3705.     m$ = m$ + ".22....." + Chr$(13)
  3706.     m$ = m$ + ".22222.." + Chr$(13)
  3707.     m$ = m$ + ".....22." + Chr$(13)
  3708.     m$ = m$ + ".....22." + Chr$(13)
  3709.     m$ = m$ + ".22..22." + Chr$(13)
  3710.     m$ = m$ + "..2222.." + Chr$(13)
  3711.     m$ = m$ + "........" + Chr$(13)
  3712.     arrTileText(53) = m$
  3713.  
  3714.     m$ = ""
  3715.     m$ = m$ + "..2222.." + Chr$(13)
  3716.     m$ = m$ + ".22..22." + Chr$(13)
  3717.     m$ = m$ + ".22....." + Chr$(13)
  3718.     m$ = m$ + ".22222.." + Chr$(13)
  3719.     m$ = m$ + ".22..22." + Chr$(13)
  3720.     m$ = m$ + ".22..22." + Chr$(13)
  3721.     m$ = m$ + "..2222.." + Chr$(13)
  3722.     m$ = m$ + "........" + Chr$(13)
  3723.     arrTileText(54) = m$
  3724.  
  3725.     m$ = ""
  3726.     m$ = m$ + ".222222." + Chr$(13)
  3727.     m$ = m$ + ".22..22." + Chr$(13)
  3728.     m$ = m$ + "....22.." + Chr$(13)
  3729.     m$ = m$ + "...22..." + Chr$(13)
  3730.     m$ = m$ + "...22..." + Chr$(13)
  3731.     m$ = m$ + "...22..." + Chr$(13)
  3732.     m$ = m$ + "...22..." + Chr$(13)
  3733.     m$ = m$ + "........" + Chr$(13)
  3734.     arrTileText(55) = m$
  3735.  
  3736.     m$ = ""
  3737.     m$ = m$ + "..2222.." + Chr$(13)
  3738.     m$ = m$ + ".22..22." + Chr$(13)
  3739.     m$ = m$ + ".22..22." + Chr$(13)
  3740.     m$ = m$ + "..2222.." + Chr$(13)
  3741.     m$ = m$ + ".22..22." + Chr$(13)
  3742.     m$ = m$ + ".22..22." + Chr$(13)
  3743.     m$ = m$ + "..2222.." + Chr$(13)
  3744.     m$ = m$ + "........" + Chr$(13)
  3745.     arrTileText(56) = m$
  3746.  
  3747.     m$ = ""
  3748.     m$ = m$ + "..2222.." + Chr$(13)
  3749.     m$ = m$ + ".22..22." + Chr$(13)
  3750.     m$ = m$ + ".22..22." + Chr$(13)
  3751.     m$ = m$ + "..22222." + Chr$(13)
  3752.     m$ = m$ + ".....22." + Chr$(13)
  3753.     m$ = m$ + ".22..22." + Chr$(13)
  3754.     m$ = m$ + "..2222.." + Chr$(13)
  3755.     m$ = m$ + "........" + Chr$(13)
  3756.     arrTileText(57) = m$
  3757.  
  3758.     m$ = ""
  3759.     m$ = m$ + "........" + Chr$(13)
  3760.     m$ = m$ + "........" + Chr$(13)
  3761.     m$ = m$ + "...22..." + Chr$(13)
  3762.     m$ = m$ + "........" + Chr$(13)
  3763.     m$ = m$ + "........" + Chr$(13)
  3764.     m$ = m$ + "...22..." + Chr$(13)
  3765.     m$ = m$ + "........" + Chr$(13)
  3766.     m$ = m$ + "........" + Chr$(13)
  3767.     arrTileText(58) = m$
  3768.  
  3769.     m$ = ""
  3770.     m$ = m$ + "........" + Chr$(13)
  3771.     m$ = m$ + "........" + Chr$(13)
  3772.     m$ = m$ + "...22..." + Chr$(13)
  3773.     m$ = m$ + "........" + Chr$(13)
  3774.     m$ = m$ + "........" + Chr$(13)
  3775.     m$ = m$ + "...22..." + Chr$(13)
  3776.     m$ = m$ + "...22..." + Chr$(13)
  3777.     m$ = m$ + "..22...." + Chr$(13)
  3778.     arrTileText(59) = m$
  3779.  
  3780.     m$ = ""
  3781.     m$ = m$ + "....222." + Chr$(13)
  3782.     m$ = m$ + "...22..." + Chr$(13)
  3783.     m$ = m$ + "..22...." + Chr$(13)
  3784.     m$ = m$ + ".22....." + Chr$(13)
  3785.     m$ = m$ + "..22...." + Chr$(13)
  3786.     m$ = m$ + "...22..." + Chr$(13)
  3787.     m$ = m$ + "....222." + Chr$(13)
  3788.     m$ = m$ + "........" + Chr$(13)
  3789.     arrTileText(60) = m$
  3790.  
  3791.     m$ = ""
  3792.     m$ = m$ + "........" + Chr$(13)
  3793.     m$ = m$ + "........" + Chr$(13)
  3794.     m$ = m$ + ".222222." + Chr$(13)
  3795.     m$ = m$ + "........" + Chr$(13)
  3796.     m$ = m$ + ".222222." + Chr$(13)
  3797.     m$ = m$ + "........" + Chr$(13)
  3798.     m$ = m$ + "........" + Chr$(13)
  3799.     m$ = m$ + "........" + Chr$(13)
  3800.     arrTileText(61) = m$
  3801.  
  3802.     m$ = ""
  3803.     m$ = m$ + ".222...." + Chr$(13)
  3804.     m$ = m$ + "...22..." + Chr$(13)
  3805.     m$ = m$ + "....22.." + Chr$(13)
  3806.     m$ = m$ + ".....22." + Chr$(13)
  3807.     m$ = m$ + "....22.." + Chr$(13)
  3808.     m$ = m$ + "...22..." + Chr$(13)
  3809.     m$ = m$ + ".222...." + Chr$(13)
  3810.     m$ = m$ + "........" + Chr$(13)
  3811.     arrTileText(62) = m$
  3812.  
  3813.     m$ = ""
  3814.     m$ = m$ + "..2222.." + Chr$(13)
  3815.     m$ = m$ + ".22..22." + Chr$(13)
  3816.     m$ = m$ + ".....22." + Chr$(13)
  3817.     m$ = m$ + "....22.." + Chr$(13)
  3818.     m$ = m$ + "...22..." + Chr$(13)
  3819.     m$ = m$ + "........" + Chr$(13)
  3820.     m$ = m$ + "...22..." + Chr$(13)
  3821.     m$ = m$ + "........" + Chr$(13)
  3822.     arrTileText(63) = m$
  3823.  
  3824.     m$ = ""
  3825.     m$ = m$ + "..2222.." + Chr$(13)
  3826.     m$ = m$ + ".22..22." + Chr$(13)
  3827.     m$ = m$ + ".22.222." + Chr$(13)
  3828.     m$ = m$ + ".22.222." + Chr$(13)
  3829.     m$ = m$ + ".22....." + Chr$(13)
  3830.     m$ = m$ + ".22...2." + Chr$(13)
  3831.     m$ = m$ + "..2222.." + Chr$(13)
  3832.     m$ = m$ + "........" + Chr$(13)
  3833.     arrTileText(64) = m$
  3834.  
  3835.     m$ = ""
  3836.     m$ = m$ + "...22..." + Chr$(13)
  3837.     m$ = m$ + "..2222.." + Chr$(13)
  3838.     m$ = m$ + ".22..22." + Chr$(13)
  3839.     m$ = m$ + ".222222." + Chr$(13)
  3840.     m$ = m$ + ".22..22." + Chr$(13)
  3841.     m$ = m$ + ".22..22." + Chr$(13)
  3842.     m$ = m$ + ".22..22." + Chr$(13)
  3843.     m$ = m$ + "........" + Chr$(13)
  3844.     arrTileText(65) = m$
  3845.  
  3846.     m$ = ""
  3847.     m$ = m$ + ".22222.." + Chr$(13)
  3848.     m$ = m$ + ".22..22." + Chr$(13)
  3849.     m$ = m$ + ".22..22." + Chr$(13)
  3850.     m$ = m$ + ".22222.." + Chr$(13)
  3851.     m$ = m$ + ".22..22." + Chr$(13)
  3852.     m$ = m$ + ".22..22." + Chr$(13)
  3853.     m$ = m$ + ".22222.." + Chr$(13)
  3854.     m$ = m$ + "........" + Chr$(13)
  3855.     arrTileText(66) = m$
  3856.  
  3857.     m$ = ""
  3858.     m$ = m$ + "..2222.." + Chr$(13)
  3859.     m$ = m$ + ".22..22." + Chr$(13)
  3860.     m$ = m$ + ".22....." + Chr$(13)
  3861.     m$ = m$ + ".22....." + Chr$(13)
  3862.     m$ = m$ + ".22....." + Chr$(13)
  3863.     m$ = m$ + ".22..22." + Chr$(13)
  3864.     m$ = m$ + "..2222.." + Chr$(13)
  3865.     m$ = m$ + "........" + Chr$(13)
  3866.     arrTileText(67) = m$
  3867.  
  3868.     m$ = ""
  3869.     m$ = m$ + ".2222..." + Chr$(13)
  3870.     m$ = m$ + ".22.22.." + Chr$(13)
  3871.     m$ = m$ + ".22..22." + Chr$(13)
  3872.     m$ = m$ + ".22..22." + Chr$(13)
  3873.     m$ = m$ + ".22..22." + Chr$(13)
  3874.     m$ = m$ + ".22.22.." + Chr$(13)
  3875.     m$ = m$ + ".2222..." + Chr$(13)
  3876.     m$ = m$ + "........" + Chr$(13)
  3877.     arrTileText(68) = m$
  3878.  
  3879.     m$ = ""
  3880.     m$ = m$ + ".222222." + Chr$(13)
  3881.     m$ = m$ + ".22....." + Chr$(13)
  3882.     m$ = m$ + ".22....." + Chr$(13)
  3883.     m$ = m$ + ".2222..." + Chr$(13)
  3884.     m$ = m$ + ".22....." + Chr$(13)
  3885.     m$ = m$ + ".22....." + Chr$(13)
  3886.     m$ = m$ + ".222222." + Chr$(13)
  3887.     m$ = m$ + "........" + Chr$(13)
  3888.     arrTileText(69) = m$
  3889.  
  3890.     m$ = ""
  3891.     m$ = m$ + ".222222." + Chr$(13)
  3892.     m$ = m$ + ".22....." + Chr$(13)
  3893.     m$ = m$ + ".22....." + Chr$(13)
  3894.     m$ = m$ + ".2222..." + Chr$(13)
  3895.     m$ = m$ + ".22....." + Chr$(13)
  3896.     m$ = m$ + ".22....." + Chr$(13)
  3897.     m$ = m$ + ".22....." + Chr$(13)
  3898.     m$ = m$ + "........" + Chr$(13)
  3899.     arrTileText(70) = m$
  3900.  
  3901.     m$ = ""
  3902.     m$ = m$ + "..2222.." + Chr$(13)
  3903.     m$ = m$ + ".22..22." + Chr$(13)
  3904.     m$ = m$ + ".22....." + Chr$(13)
  3905.     m$ = m$ + ".22.222." + Chr$(13)
  3906.     m$ = m$ + ".22..22." + Chr$(13)
  3907.     m$ = m$ + ".22..22." + Chr$(13)
  3908.     m$ = m$ + "..2222.." + Chr$(13)
  3909.     m$ = m$ + "........" + Chr$(13)
  3910.     arrTileText(71) = m$
  3911.  
  3912.     m$ = ""
  3913.     m$ = m$ + ".22..22." + Chr$(13)
  3914.     m$ = m$ + ".22..22." + Chr$(13)
  3915.     m$ = m$ + ".22..22." + Chr$(13)
  3916.     m$ = m$ + ".222222." + Chr$(13)
  3917.     m$ = m$ + ".22..22." + Chr$(13)
  3918.     m$ = m$ + ".22..22." + Chr$(13)
  3919.     m$ = m$ + ".22..22." + Chr$(13)
  3920.     m$ = m$ + "........" + Chr$(13)
  3921.     arrTileText(72) = m$
  3922.  
  3923.     m$ = ""
  3924.     m$ = m$ + "..2222.." + Chr$(13)
  3925.     m$ = m$ + "...22..." + Chr$(13)
  3926.     m$ = m$ + "...22..." + Chr$(13)
  3927.     m$ = m$ + "...22..." + Chr$(13)
  3928.     m$ = m$ + "...22..." + Chr$(13)
  3929.     m$ = m$ + "...22..." + Chr$(13)
  3930.     m$ = m$ + "..2222.." + Chr$(13)
  3931.     m$ = m$ + "........" + Chr$(13)
  3932.     arrTileText(73) = m$
  3933.  
  3934.     m$ = ""
  3935.     m$ = m$ + "...2222." + Chr$(13)
  3936.     m$ = m$ + "....22.." + Chr$(13)
  3937.     m$ = m$ + "....22.." + Chr$(13)
  3938.     m$ = m$ + "....22.." + Chr$(13)
  3939.     m$ = m$ + "....22.." + Chr$(13)
  3940.     m$ = m$ + ".22.22.." + Chr$(13)
  3941.     m$ = m$ + "..222..." + Chr$(13)
  3942.     m$ = m$ + "........" + Chr$(13)
  3943.     arrTileText(74) = m$
  3944.  
  3945.     m$ = ""
  3946.     m$ = m$ + ".22..22." + Chr$(13)
  3947.     m$ = m$ + ".22.22.." + Chr$(13)
  3948.     m$ = m$ + ".2222..." + Chr$(13)
  3949.     m$ = m$ + ".222...." + Chr$(13)
  3950.     m$ = m$ + ".2222..." + Chr$(13)
  3951.     m$ = m$ + ".22.22.." + Chr$(13)
  3952.     m$ = m$ + ".22..22." + Chr$(13)
  3953.     m$ = m$ + "........" + Chr$(13)
  3954.     arrTileText(75) = m$
  3955.  
  3956.     m$ = ""
  3957.     m$ = m$ + ".22....." + Chr$(13)
  3958.     m$ = m$ + ".22....." + Chr$(13)
  3959.     m$ = m$ + ".22....." + Chr$(13)
  3960.     m$ = m$ + ".22....." + Chr$(13)
  3961.     m$ = m$ + ".22....." + Chr$(13)
  3962.     m$ = m$ + ".22....." + Chr$(13)
  3963.     m$ = m$ + ".222222." + Chr$(13)
  3964.     m$ = m$ + "........" + Chr$(13)
  3965.     arrTileText(76) = m$
  3966.  
  3967.     m$ = ""
  3968.     m$ = m$ + ".22...22" + Chr$(13)
  3969.     m$ = m$ + ".222.222" + Chr$(13)
  3970.     m$ = m$ + ".2222222" + Chr$(13)
  3971.     m$ = m$ + ".22.2.22" + Chr$(13)
  3972.     m$ = m$ + ".22...22" + Chr$(13)
  3973.     m$ = m$ + ".22...22" + Chr$(13)
  3974.     m$ = m$ + ".22...22" + Chr$(13)
  3975.     m$ = m$ + "........" + Chr$(13)
  3976.     arrTileText(77) = m$
  3977.  
  3978.     m$ = ""
  3979.     m$ = m$ + ".22..22." + Chr$(13)
  3980.     m$ = m$ + ".222.22." + Chr$(13)
  3981.     m$ = m$ + ".222222." + Chr$(13)
  3982.     m$ = m$ + ".222222." + Chr$(13)
  3983.     m$ = m$ + ".22.222." + Chr$(13)
  3984.     m$ = m$ + ".22..22." + Chr$(13)
  3985.     m$ = m$ + ".22..22." + Chr$(13)
  3986.     m$ = m$ + "........" + Chr$(13)
  3987.     arrTileText(78) = m$
  3988.  
  3989.     m$ = ""
  3990.     m$ = m$ + "..2222.." + Chr$(13)
  3991.     m$ = m$ + ".22..22." + Chr$(13)
  3992.     m$ = m$ + ".22..22." + Chr$(13)
  3993.     m$ = m$ + ".22..22." + Chr$(13)
  3994.     m$ = m$ + ".22..22." + Chr$(13)
  3995.     m$ = m$ + ".22..22." + Chr$(13)
  3996.     m$ = m$ + "..2222.." + Chr$(13)
  3997.     m$ = m$ + "........" + Chr$(13)
  3998.     arrTileText(79) = m$
  3999.  
  4000.     m$ = ""
  4001.     m$ = m$ + ".22222.." + Chr$(13)
  4002.     m$ = m$ + ".22..22." + Chr$(13)
  4003.     m$ = m$ + ".22..22." + Chr$(13)
  4004.     m$ = m$ + ".22222.." + Chr$(13)
  4005.     m$ = m$ + ".22....." + Chr$(13)
  4006.     m$ = m$ + ".22....." + Chr$(13)
  4007.     m$ = m$ + ".22....." + Chr$(13)
  4008.     m$ = m$ + "........" + Chr$(13)
  4009.     arrTileText(80) = m$
  4010.  
  4011.     m$ = ""
  4012.     m$ = m$ + "..2222.." + Chr$(13)
  4013.     m$ = m$ + ".22..22." + Chr$(13)
  4014.     m$ = m$ + ".22..22." + Chr$(13)
  4015.     m$ = m$ + ".22..22." + Chr$(13)
  4016.     m$ = m$ + ".22..22." + Chr$(13)
  4017.     m$ = m$ + "..2222.." + Chr$(13)
  4018.     m$ = m$ + "....222." + Chr$(13)
  4019.     m$ = m$ + "........" + Chr$(13)
  4020.     arrTileText(81) = m$
  4021.  
  4022.     m$ = ""
  4023.     m$ = m$ + ".22222.." + Chr$(13)
  4024.     m$ = m$ + ".22..22." + Chr$(13)
  4025.     m$ = m$ + ".22..22." + Chr$(13)
  4026.     m$ = m$ + ".22222.." + Chr$(13)
  4027.     m$ = m$ + ".2222..." + Chr$(13)
  4028.     m$ = m$ + ".22.22.." + Chr$(13)
  4029.     m$ = m$ + ".22..22." + Chr$(13)
  4030.     m$ = m$ + "........" + Chr$(13)
  4031.     arrTileText(82) = m$
  4032.  
  4033.     m$ = ""
  4034.     m$ = m$ + "..2222.." + Chr$(13)
  4035.     m$ = m$ + ".22..22." + Chr$(13)
  4036.     m$ = m$ + ".22....." + Chr$(13)
  4037.     m$ = m$ + "..2222.." + Chr$(13)
  4038.     m$ = m$ + ".....22." + Chr$(13)
  4039.     m$ = m$ + ".22..22." + Chr$(13)
  4040.     m$ = m$ + "..2222.." + Chr$(13)
  4041.     m$ = m$ + "........" + Chr$(13)
  4042.     arrTileText(83) = m$
  4043.  
  4044.     m$ = ""
  4045.     m$ = m$ + ".222222." + Chr$(13)
  4046.     m$ = m$ + "...22..." + Chr$(13)
  4047.     m$ = m$ + "...22..." + Chr$(13)
  4048.     m$ = m$ + "...22..." + Chr$(13)
  4049.     m$ = m$ + "...22..." + Chr$(13)
  4050.     m$ = m$ + "...22..." + Chr$(13)
  4051.     m$ = m$ + "...22..." + Chr$(13)
  4052.     m$ = m$ + "........" + Chr$(13)
  4053.     arrTileText(84) = m$
  4054.  
  4055.     m$ = ""
  4056.     m$ = m$ + ".22..22." + Chr$(13)
  4057.     m$ = m$ + ".22..22." + Chr$(13)
  4058.     m$ = m$ + ".22..22." + Chr$(13)
  4059.     m$ = m$ + ".22..22." + Chr$(13)
  4060.     m$ = m$ + ".22..22." + Chr$(13)
  4061.     m$ = m$ + ".22..22." + Chr$(13)
  4062.     m$ = m$ + "..2222.." + Chr$(13)
  4063.     m$ = m$ + "........" + Chr$(13)
  4064.     arrTileText(85) = m$
  4065.  
  4066.     m$ = ""
  4067.     m$ = m$ + ".22..22." + Chr$(13)
  4068.     m$ = m$ + ".22..22." + Chr$(13)
  4069.     m$ = m$ + ".22..22." + Chr$(13)
  4070.     m$ = m$ + ".22..22." + Chr$(13)
  4071.     m$ = m$ + ".22..22." + Chr$(13)
  4072.     m$ = m$ + "..2222.." + Chr$(13)
  4073.     m$ = m$ + "...22..." + Chr$(13)
  4074.     m$ = m$ + "........" + Chr$(13)
  4075.     arrTileText(86) = m$
  4076.  
  4077.     m$ = ""
  4078.     m$ = m$ + ".22...22" + Chr$(13)
  4079.     m$ = m$ + ".22...22" + Chr$(13)
  4080.     m$ = m$ + ".22...22" + Chr$(13)
  4081.     m$ = m$ + ".22.2.22" + Chr$(13)
  4082.     m$ = m$ + ".2222222" + Chr$(13)
  4083.     m$ = m$ + ".222.222" + Chr$(13)
  4084.     m$ = m$ + ".22...22" + Chr$(13)
  4085.     m$ = m$ + "........" + Chr$(13)
  4086.     arrTileText(87) = m$
  4087.  
  4088.     m$ = ""
  4089.     m$ = m$ + ".22..22." + Chr$(13)
  4090.     m$ = m$ + ".22..22." + Chr$(13)
  4091.     m$ = m$ + "..2222.." + Chr$(13)
  4092.     m$ = m$ + "...22..." + Chr$(13)
  4093.     m$ = m$ + "..2222.." + Chr$(13)
  4094.     m$ = m$ + ".22..22." + Chr$(13)
  4095.     m$ = m$ + ".22..22." + Chr$(13)
  4096.     m$ = m$ + "........" + Chr$(13)
  4097.     arrTileText(88) = m$
  4098.  
  4099.     m$ = ""
  4100.     m$ = m$ + ".22..22." + Chr$(13)
  4101.     m$ = m$ + ".22..22." + Chr$(13)
  4102.     m$ = m$ + ".22..22." + Chr$(13)
  4103.     m$ = m$ + "..2222.." + Chr$(13)
  4104.     m$ = m$ + "...22..." + Chr$(13)
  4105.     m$ = m$ + "...22..." + Chr$(13)
  4106.     m$ = m$ + "...22..." + Chr$(13)
  4107.     m$ = m$ + "........" + Chr$(13)
  4108.     arrTileText(89) = m$
  4109.  
  4110.     m$ = ""
  4111.     m$ = m$ + ".222222." + Chr$(13)
  4112.     m$ = m$ + ".....22." + Chr$(13)
  4113.     m$ = m$ + "....22.." + Chr$(13)
  4114.     m$ = m$ + "...22..." + Chr$(13)
  4115.     m$ = m$ + "..22...." + Chr$(13)
  4116.     m$ = m$ + ".22....." + Chr$(13)
  4117.     m$ = m$ + ".222222." + Chr$(13)
  4118.     m$ = m$ + "........" + Chr$(13)
  4119.     arrTileText(90) = m$
  4120.  
  4121.     m$ = ""
  4122.     m$ = m$ + "..2222.." + Chr$(13)
  4123.     m$ = m$ + "..22...." + Chr$(13)
  4124.     m$ = m$ + "..22...." + Chr$(13)
  4125.     m$ = m$ + "..22...." + Chr$(13)
  4126.     m$ = m$ + "..22...." + Chr$(13)
  4127.     m$ = m$ + "..22...." + Chr$(13)
  4128.     m$ = m$ + "..2222.." + Chr$(13)
  4129.     m$ = m$ + "........" + Chr$(13)
  4130.     arrTileText(91) = m$
  4131.  
  4132.     m$ = ""
  4133.     m$ = m$ + "........" + Chr$(13)
  4134.     m$ = m$ + ".22....." + Chr$(13)
  4135.     m$ = m$ + "..22...." + Chr$(13)
  4136.     m$ = m$ + "...22..." + Chr$(13)
  4137.     m$ = m$ + "....22.." + Chr$(13)
  4138.     m$ = m$ + ".....22." + Chr$(13)
  4139.     m$ = m$ + "......22" + Chr$(13)
  4140.     m$ = m$ + "........" + Chr$(13)
  4141.     arrTileText(92) = m$
  4142.  
  4143.     m$ = ""
  4144.     m$ = m$ + "..2222.." + Chr$(13)
  4145.     m$ = m$ + "....22.." + Chr$(13)
  4146.     m$ = m$ + "....22.." + Chr$(13)
  4147.     m$ = m$ + "....22.." + Chr$(13)
  4148.     m$ = m$ + "....22.." + Chr$(13)
  4149.     m$ = m$ + "....22.." + Chr$(13)
  4150.     m$ = m$ + "..2222.." + Chr$(13)
  4151.     m$ = m$ + "........" + Chr$(13)
  4152.     arrTileText(93) = m$
  4153.  
  4154.     m$ = ""
  4155.     m$ = m$ + "...22..." + Chr$(13)
  4156.     m$ = m$ + "..2222.." + Chr$(13)
  4157.     m$ = m$ + ".22..22." + Chr$(13)
  4158.     m$ = m$ + "........" + Chr$(13)
  4159.     m$ = m$ + "........" + Chr$(13)
  4160.     m$ = m$ + "........" + Chr$(13)
  4161.     m$ = m$ + "........" + Chr$(13)
  4162.     m$ = m$ + "........" + Chr$(13)
  4163.     arrTileText(94) = m$
  4164.  
  4165.     m$ = ""
  4166.     m$ = m$ + "........" + Chr$(13)
  4167.     m$ = m$ + "........" + Chr$(13)
  4168.     m$ = m$ + "........" + Chr$(13)
  4169.     m$ = m$ + "........" + Chr$(13)
  4170.     m$ = m$ + "........" + Chr$(13)
  4171.     m$ = m$ + ".222222." + Chr$(13)
  4172.     m$ = m$ + "........" + Chr$(13)
  4173.     m$ = m$ + "........" + Chr$(13)
  4174.     arrTileText(95) = m$
  4175.  
  4176.     m$ = ""
  4177.     m$ = m$ + "........" + Chr$(13)
  4178.     m$ = m$ + "........" + Chr$(13)
  4179.     m$ = m$ + "........" + Chr$(13)
  4180.     m$ = m$ + "........" + Chr$(13)
  4181.     m$ = m$ + "........" + Chr$(13)
  4182.     m$ = m$ + "........" + Chr$(13)
  4183.     m$ = m$ + "........" + Chr$(13)
  4184.     m$ = m$ + "........" + Chr$(13)
  4185.     arrTileText(96) = m$
  4186.  
  4187.     m$ = ""
  4188.     m$ = m$ + "........" + Chr$(13)
  4189.     m$ = m$ + "..2222.." + Chr$(13)
  4190.     m$ = m$ + ".....22." + Chr$(13)
  4191.     m$ = m$ + "..22222." + Chr$(13)
  4192.     m$ = m$ + ".22..22." + Chr$(13)
  4193.     m$ = m$ + "..22222." + Chr$(13)
  4194.     m$ = m$ + "........" + Chr$(13)
  4195.     m$ = m$ + "........" + Chr$(13)
  4196.     arrTileText(97) = m$
  4197.  
  4198.     m$ = ""
  4199.     m$ = m$ + ".22....." + Chr$(13)
  4200.     m$ = m$ + ".22....." + Chr$(13)
  4201.     m$ = m$ + ".22222.." + Chr$(13)
  4202.     m$ = m$ + ".22..22." + Chr$(13)
  4203.     m$ = m$ + ".22..22." + Chr$(13)
  4204.     m$ = m$ + ".22222.." + Chr$(13)
  4205.     m$ = m$ + "........" + Chr$(13)
  4206.     m$ = m$ + "........" + Chr$(13)
  4207.     arrTileText(98) = m$
  4208.  
  4209.     m$ = ""
  4210.     m$ = m$ + "........" + Chr$(13)
  4211.     m$ = m$ + "..2222.." + Chr$(13)
  4212.     m$ = m$ + ".22....." + Chr$(13)
  4213.     m$ = m$ + ".22....." + Chr$(13)
  4214.     m$ = m$ + ".22....." + Chr$(13)
  4215.     m$ = m$ + "..2222.." + Chr$(13)
  4216.     m$ = m$ + "........" + Chr$(13)
  4217.     m$ = m$ + "........" + Chr$(13)
  4218.     arrTileText(99) = m$
  4219.  
  4220.     m$ = ""
  4221.     m$ = m$ + ".....22." + Chr$(13)
  4222.     m$ = m$ + ".....22." + Chr$(13)
  4223.     m$ = m$ + "..22222." + Chr$(13)
  4224.     m$ = m$ + ".22..22." + Chr$(13)
  4225.     m$ = m$ + ".22..22." + Chr$(13)
  4226.     m$ = m$ + "..22222." + Chr$(13)
  4227.     m$ = m$ + "........" + Chr$(13)
  4228.     m$ = m$ + "........" + Chr$(13)
  4229.     arrTileText(100) = m$
  4230.  
  4231.     m$ = ""
  4232.     m$ = m$ + "........" + Chr$(13)
  4233.     m$ = m$ + "..2222.." + Chr$(13)
  4234.     m$ = m$ + ".22..22." + Chr$(13)
  4235.     m$ = m$ + ".222222." + Chr$(13)
  4236.     m$ = m$ + ".22....." + Chr$(13)
  4237.     m$ = m$ + "..2222.." + Chr$(13)
  4238.     m$ = m$ + "........" + Chr$(13)
  4239.     m$ = m$ + "........" + Chr$(13)
  4240.     arrTileText(101) = m$
  4241.  
  4242.     m$ = ""
  4243.     m$ = m$ + "....222." + Chr$(13)
  4244.     m$ = m$ + "...22..." + Chr$(13)
  4245.     m$ = m$ + "..22222." + Chr$(13)
  4246.     m$ = m$ + "...22..." + Chr$(13)
  4247.     m$ = m$ + "...22..." + Chr$(13)
  4248.     m$ = m$ + "...22..." + Chr$(13)
  4249.     m$ = m$ + "........" + Chr$(13)
  4250.     m$ = m$ + "........" + Chr$(13)
  4251.     arrTileText(102) = m$
  4252.  
  4253.     m$ = ""
  4254.     m$ = m$ + "........" + Chr$(13)
  4255.     m$ = m$ + "..22222." + Chr$(13)
  4256.     m$ = m$ + ".22..22." + Chr$(13)
  4257.     m$ = m$ + ".22..22." + Chr$(13)
  4258.     m$ = m$ + "..22222." + Chr$(13)
  4259.     m$ = m$ + ".....22." + Chr$(13)
  4260.     m$ = m$ + ".22222.." + Chr$(13)
  4261.     m$ = m$ + "........" + Chr$(13)
  4262.     arrTileText(103) = m$
  4263.  
  4264.     m$ = ""
  4265.     m$ = m$ + ".22....." + Chr$(13)
  4266.     m$ = m$ + ".22....." + Chr$(13)
  4267.     m$ = m$ + ".22222.." + Chr$(13)
  4268.     m$ = m$ + ".22..22." + Chr$(13)
  4269.     m$ = m$ + ".22..22." + Chr$(13)
  4270.     m$ = m$ + ".22..22." + Chr$(13)
  4271.     m$ = m$ + "........" + Chr$(13)
  4272.     m$ = m$ + "........" + Chr$(13)
  4273.     arrTileText(104) = m$
  4274.  
  4275.     m$ = ""
  4276.     m$ = m$ + "...22..." + Chr$(13)
  4277.     m$ = m$ + "........" + Chr$(13)
  4278.     m$ = m$ + "..222..." + Chr$(13)
  4279.     m$ = m$ + "...22..." + Chr$(13)
  4280.     m$ = m$ + "...22..." + Chr$(13)
  4281.     m$ = m$ + "..2222.." + Chr$(13)
  4282.     m$ = m$ + "........" + Chr$(13)
  4283.     m$ = m$ + "........" + Chr$(13)
  4284.     arrTileText(105) = m$
  4285.  
  4286.     m$ = ""
  4287.     m$ = m$ + ".....22." + Chr$(13)
  4288.     m$ = m$ + "........" + Chr$(13)
  4289.     m$ = m$ + ".....22." + Chr$(13)
  4290.     m$ = m$ + ".....22." + Chr$(13)
  4291.     m$ = m$ + ".....22." + Chr$(13)
  4292.     m$ = m$ + ".....22." + Chr$(13)
  4293.     m$ = m$ + "..2222.." + Chr$(13)
  4294.     m$ = m$ + "........" + Chr$(13)
  4295.     arrTileText(106) = m$
  4296.  
  4297.     m$ = ""
  4298.     m$ = m$ + ".22....." + Chr$(13)
  4299.     m$ = m$ + ".22....." + Chr$(13)
  4300.     m$ = m$ + ".22.22.." + Chr$(13)
  4301.     m$ = m$ + ".2222..." + Chr$(13)
  4302.     m$ = m$ + ".22.22.." + Chr$(13)
  4303.     m$ = m$ + ".22..22." + Chr$(13)
  4304.     m$ = m$ + "........" + Chr$(13)
  4305.     m$ = m$ + "........" + Chr$(13)
  4306.     arrTileText(107) = m$
  4307.  
  4308.     m$ = ""
  4309.     m$ = m$ + "..222..." + Chr$(13)
  4310.     m$ = m$ + "...22..." + Chr$(13)
  4311.     m$ = m$ + "...22..." + Chr$(13)
  4312.     m$ = m$ + "...22..." + Chr$(13)
  4313.     m$ = m$ + "...22..." + Chr$(13)
  4314.     m$ = m$ + "..2222.." + Chr$(13)
  4315.     m$ = m$ + "........" + Chr$(13)
  4316.     m$ = m$ + "........" + Chr$(13)
  4317.     arrTileText(108) = m$
  4318.  
  4319.     m$ = ""
  4320.     m$ = m$ + "........" + Chr$(13)
  4321.     m$ = m$ + ".22..22." + Chr$(13)
  4322.     m$ = m$ + ".2222222" + Chr$(13)
  4323.     m$ = m$ + ".2222222" + Chr$(13)
  4324.     m$ = m$ + ".22.2.22" + Chr$(13)
  4325.     m$ = m$ + ".22...22" + Chr$(13)
  4326.     m$ = m$ + "........" + Chr$(13)
  4327.     m$ = m$ + "........" + Chr$(13)
  4328.     arrTileText(109) = m$
  4329.  
  4330.     m$ = ""
  4331.     m$ = m$ + "........" + Chr$(13)
  4332.     m$ = m$ + ".22222.." + Chr$(13)
  4333.     m$ = m$ + ".22..22." + Chr$(13)
  4334.     m$ = m$ + ".22..22." + Chr$(13)
  4335.     m$ = m$ + ".22..22." + Chr$(13)
  4336.     m$ = m$ + ".22..22." + Chr$(13)
  4337.     m$ = m$ + "........" + Chr$(13)
  4338.     m$ = m$ + "........" + Chr$(13)
  4339.     arrTileText(110) = m$
  4340.  
  4341.     m$ = ""
  4342.     m$ = m$ + "........" + Chr$(13)
  4343.     m$ = m$ + "..2222.." + Chr$(13)
  4344.     m$ = m$ + ".22..22." + Chr$(13)
  4345.     m$ = m$ + ".22..22." + Chr$(13)
  4346.     m$ = m$ + ".22..22." + Chr$(13)
  4347.     m$ = m$ + "..2222.." + Chr$(13)
  4348.     m$ = m$ + "........" + Chr$(13)
  4349.     m$ = m$ + "........" + Chr$(13)
  4350.     arrTileText(111) = m$
  4351.  
  4352.     m$ = ""
  4353.     m$ = m$ + "........" + Chr$(13)
  4354.     m$ = m$ + ".22222.." + Chr$(13)
  4355.     m$ = m$ + ".22..22." + Chr$(13)
  4356.     m$ = m$ + ".22..22." + Chr$(13)
  4357.     m$ = m$ + ".22222.." + Chr$(13)
  4358.     m$ = m$ + ".22....." + Chr$(13)
  4359.     m$ = m$ + ".22....." + Chr$(13)
  4360.     m$ = m$ + "........" + Chr$(13)
  4361.     arrTileText(112) = m$
  4362.  
  4363.     m$ = ""
  4364.     m$ = m$ + "........" + Chr$(13)
  4365.     m$ = m$ + "..22222." + Chr$(13)
  4366.     m$ = m$ + ".22..22." + Chr$(13)
  4367.     m$ = m$ + ".22..22." + Chr$(13)
  4368.     m$ = m$ + "..22222." + Chr$(13)
  4369.     m$ = m$ + ".....22." + Chr$(13)
  4370.     m$ = m$ + ".....22." + Chr$(13)
  4371.     m$ = m$ + "........" + Chr$(13)
  4372.     arrTileText(113) = m$
  4373.  
  4374.     m$ = ""
  4375.     m$ = m$ + "........" + Chr$(13)
  4376.     m$ = m$ + ".22222.." + Chr$(13)
  4377.     m$ = m$ + ".22..22." + Chr$(13)
  4378.     m$ = m$ + ".22....." + Chr$(13)
  4379.     m$ = m$ + ".22....." + Chr$(13)
  4380.     m$ = m$ + ".22....." + Chr$(13)
  4381.     m$ = m$ + "........" + Chr$(13)
  4382.     m$ = m$ + "........" + Chr$(13)
  4383.     arrTileText(114) = m$
  4384.  
  4385.     m$ = ""
  4386.     m$ = m$ + "........" + Chr$(13)
  4387.     m$ = m$ + "..22222." + Chr$(13)
  4388.     m$ = m$ + ".22....." + Chr$(13)
  4389.     m$ = m$ + "..2222.." + Chr$(13)
  4390.     m$ = m$ + ".....22." + Chr$(13)
  4391.     m$ = m$ + ".22222.." + Chr$(13)
  4392.     m$ = m$ + "........" + Chr$(13)
  4393.     m$ = m$ + "........" + Chr$(13)
  4394.     arrTileText(115) = m$
  4395.  
  4396.     m$ = ""
  4397.     m$ = m$ + "...22..." + Chr$(13)
  4398.     m$ = m$ + ".222222." + Chr$(13)
  4399.     m$ = m$ + "...22..." + Chr$(13)
  4400.     m$ = m$ + "...22..." + Chr$(13)
  4401.     m$ = m$ + "...22..." + Chr$(13)
  4402.     m$ = m$ + "....222." + Chr$(13)
  4403.     m$ = m$ + "........" + Chr$(13)
  4404.     m$ = m$ + "........" + Chr$(13)
  4405.     arrTileText(116) = m$
  4406.  
  4407.     m$ = ""
  4408.     m$ = m$ + "........" + Chr$(13)
  4409.     m$ = m$ + ".22..22." + Chr$(13)
  4410.     m$ = m$ + ".22..22." + Chr$(13)
  4411.     m$ = m$ + ".22..22." + Chr$(13)
  4412.     m$ = m$ + ".22..22." + Chr$(13)
  4413.     m$ = m$ + "..22222." + Chr$(13)
  4414.     m$ = m$ + "........" + Chr$(13)
  4415.     m$ = m$ + "........" + Chr$(13)
  4416.     arrTileText(117) = m$
  4417.  
  4418.     m$ = ""
  4419.     m$ = m$ + "........" + Chr$(13)
  4420.     m$ = m$ + ".22..22." + Chr$(13)
  4421.     m$ = m$ + ".22..22." + Chr$(13)
  4422.     m$ = m$ + ".22..22." + Chr$(13)
  4423.     m$ = m$ + "..2222.." + Chr$(13)
  4424.     m$ = m$ + "...22..." + Chr$(13)
  4425.     m$ = m$ + "........" + Chr$(13)
  4426.     m$ = m$ + "........" + Chr$(13)
  4427.     arrTileText(118) = m$
  4428.  
  4429.     m$ = ""
  4430.     m$ = m$ + "........" + Chr$(13)
  4431.     m$ = m$ + ".22...22" + Chr$(13)
  4432.     m$ = m$ + ".22.2.22" + Chr$(13)
  4433.     m$ = m$ + ".2222222" + Chr$(13)
  4434.     m$ = m$ + "..22222." + Chr$(13)
  4435.     m$ = m$ + "..22.22." + Chr$(13)
  4436.     m$ = m$ + "........" + Chr$(13)
  4437.     m$ = m$ + "........" + Chr$(13)
  4438.     arrTileText(119) = m$
  4439.  
  4440.     m$ = ""
  4441.     m$ = m$ + "........" + Chr$(13)
  4442.     m$ = m$ + ".22..22." + Chr$(13)
  4443.     m$ = m$ + "..2222.." + Chr$(13)
  4444.     m$ = m$ + "...22..." + Chr$(13)
  4445.     m$ = m$ + "..2222.." + Chr$(13)
  4446.     m$ = m$ + ".22..22." + Chr$(13)
  4447.     m$ = m$ + "........" + Chr$(13)
  4448.     m$ = m$ + "........" + Chr$(13)
  4449.     arrTileText(120) = m$
  4450.  
  4451.     m$ = ""
  4452.     m$ = m$ + "........" + Chr$(13)
  4453.     m$ = m$ + ".22..22." + Chr$(13)
  4454.     m$ = m$ + ".22..22." + Chr$(13)
  4455.     m$ = m$ + ".22..22." + Chr$(13)
  4456.     m$ = m$ + "..22222." + Chr$(13)
  4457.     m$ = m$ + "....22.." + Chr$(13)
  4458.     m$ = m$ + ".2222..." + Chr$(13)
  4459.     m$ = m$ + "........" + Chr$(13)
  4460.     arrTileText(121) = m$
  4461.  
  4462.     m$ = ""
  4463.     m$ = m$ + "........" + Chr$(13)
  4464.     m$ = m$ + ".222222." + Chr$(13)
  4465.     m$ = m$ + "....22.." + Chr$(13)
  4466.     m$ = m$ + "...22..." + Chr$(13)
  4467.     m$ = m$ + "..22...." + Chr$(13)
  4468.     m$ = m$ + ".222222." + Chr$(13)
  4469.     m$ = m$ + "........" + Chr$(13)
  4470.     m$ = m$ + "........" + Chr$(13)
  4471.     arrTileText(122) = m$
  4472.  
  4473.     m$ = ""
  4474.     m$ = m$ + "...222.." + Chr$(13)
  4475.     m$ = m$ + "..22...." + Chr$(13)
  4476.     m$ = m$ + "..2....." + Chr$(13)
  4477.     m$ = m$ + ".22....." + Chr$(13)
  4478.     m$ = m$ + "..2....." + Chr$(13)
  4479.     m$ = m$ + "..22...." + Chr$(13)
  4480.     m$ = m$ + "...222.." + Chr$(13)
  4481.     m$ = m$ + "........" + Chr$(13)
  4482.     arrTileText(123) = m$
  4483.  
  4484.     m$ = ""
  4485.     m$ = m$ + "....2..." + Chr$(13)
  4486.     m$ = m$ + "....2..." + Chr$(13)
  4487.     m$ = m$ + "....2..." + Chr$(13)
  4488.     m$ = m$ + "....2..." + Chr$(13)
  4489.     m$ = m$ + "....2..." + Chr$(13)
  4490.     m$ = m$ + "....2..." + Chr$(13)
  4491.     m$ = m$ + "....2..." + Chr$(13)
  4492.     m$ = m$ + "........" + Chr$(13)
  4493.     arrTileText(124) = m$
  4494.  
  4495.     m$ = ""
  4496.     m$ = m$ + "..222..." + Chr$(13)
  4497.     m$ = m$ + "....22.." + Chr$(13)
  4498.     m$ = m$ + ".....2.." + Chr$(13)
  4499.     m$ = m$ + ".....22." + Chr$(13)
  4500.     m$ = m$ + ".....2.." + Chr$(13)
  4501.     m$ = m$ + "....22.." + Chr$(13)
  4502.     m$ = m$ + "..222..." + Chr$(13)
  4503.     m$ = m$ + "........" + Chr$(13)
  4504.     arrTileText(125) = m$
  4505.  
  4506.     m$ = ""
  4507.     m$ = m$ + "........" + Chr$(13)
  4508.     m$ = m$ + ".22....2" + Chr$(13)
  4509.     m$ = m$ + "2..2..2." + Chr$(13)
  4510.     m$ = m$ + "....22.." + Chr$(13)
  4511.     m$ = m$ + "........" + Chr$(13)
  4512.     m$ = m$ + "........" + Chr$(13)
  4513.     m$ = m$ + "........" + Chr$(13)
  4514.     m$ = m$ + "........" + Chr$(13)
  4515.     arrTileText(126) = m$
  4516.  
  4517.     m$ = ""
  4518.     m$ = m$ + "........" + Chr$(13)
  4519.     m$ = m$ + "........" + Chr$(13)
  4520.     m$ = m$ + "........" + Chr$(13)
  4521.     m$ = m$ + "........" + Chr$(13)
  4522.     m$ = m$ + "........" + Chr$(13)
  4523.     m$ = m$ + "........" + Chr$(13)
  4524.     m$ = m$ + "........" + Chr$(13)
  4525.     m$ = m$ + "........" + Chr$(13)
  4526.     arrTileText(127) = m$
  4527.  
  4528.     m$ = ""
  4529.     m$ = m$ + "........" + Chr$(13)
  4530.     m$ = m$ + "........" + Chr$(13)
  4531.     m$ = m$ + "........" + Chr$(13)
  4532.     m$ = m$ + "22222222" + Chr$(13)
  4533.     m$ = m$ + "22222222" + Chr$(13)
  4534.     m$ = m$ + "........" + Chr$(13)
  4535.     m$ = m$ + "........" + Chr$(13)
  4536.     m$ = m$ + "........" + Chr$(13)
  4537.     arrTileText(128) = m$
  4538.  
  4539.     m$ = ""
  4540.     m$ = m$ + "....2..." + Chr$(13)
  4541.     m$ = m$ + "...222.." + Chr$(13)
  4542.     m$ = m$ + "..22222." + Chr$(13)
  4543.     m$ = m$ + ".2222222" + Chr$(13)
  4544.     m$ = m$ + ".2222222" + Chr$(13)
  4545.     m$ = m$ + "...222.." + Chr$(13)
  4546.     m$ = m$ + "..22222." + Chr$(13)
  4547.     m$ = m$ + "........" + Chr$(13)
  4548.     arrTileText(129) = m$
  4549.  
  4550.     m$ = ""
  4551.     m$ = m$ + "...22..." + Chr$(13)
  4552.     m$ = m$ + "...22..." + Chr$(13)
  4553.     m$ = m$ + "...22..." + Chr$(13)
  4554.     m$ = m$ + "...22..." + Chr$(13)
  4555.     m$ = m$ + "...22..." + Chr$(13)
  4556.     m$ = m$ + "...22..." + Chr$(13)
  4557.     m$ = m$ + "...22..." + Chr$(13)
  4558.     m$ = m$ + "...22..." + Chr$(13)
  4559.     arrTileText(130) = m$
  4560.  
  4561.     m$ = ""
  4562.     m$ = m$ + "........" + Chr$(13)
  4563.     m$ = m$ + "........" + Chr$(13)
  4564.     m$ = m$ + "........" + Chr$(13)
  4565.     m$ = m$ + "22222222" + Chr$(13)
  4566.     m$ = m$ + "22222222" + Chr$(13)
  4567.     m$ = m$ + "........" + Chr$(13)
  4568.     m$ = m$ + "........" + Chr$(13)
  4569.     m$ = m$ + "........" + Chr$(13)
  4570.     arrTileText(131) = m$
  4571.  
  4572.     m$ = ""
  4573.     m$ = m$ + "........" + Chr$(13)
  4574.     m$ = m$ + "........" + Chr$(13)
  4575.     m$ = m$ + "22222222" + Chr$(13)
  4576.     m$ = m$ + "22222222" + Chr$(13)
  4577.     m$ = m$ + "........" + Chr$(13)
  4578.     m$ = m$ + "........" + Chr$(13)
  4579.     m$ = m$ + "........" + Chr$(13)
  4580.     m$ = m$ + "........" + Chr$(13)
  4581.     arrTileText(132) = m$
  4582.  
  4583.     m$ = ""
  4584.     m$ = m$ + "........" + Chr$(13)
  4585.     m$ = m$ + "22222222" + Chr$(13)
  4586.     m$ = m$ + "22222222" + Chr$(13)
  4587.     m$ = m$ + "........" + Chr$(13)
  4588.     m$ = m$ + "........" + Chr$(13)
  4589.     m$ = m$ + "........" + Chr$(13)
  4590.     m$ = m$ + "........" + Chr$(13)
  4591.     m$ = m$ + "........" + Chr$(13)
  4592.     arrTileText(133) = m$
  4593.  
  4594.     m$ = ""
  4595.     m$ = m$ + "........" + Chr$(13)
  4596.     m$ = m$ + "........" + Chr$(13)
  4597.     m$ = m$ + "........" + Chr$(13)
  4598.     m$ = m$ + "........" + Chr$(13)
  4599.     m$ = m$ + "22222222" + Chr$(13)
  4600.     m$ = m$ + "22222222" + Chr$(13)
  4601.     m$ = m$ + "........" + Chr$(13)
  4602.     m$ = m$ + "........" + Chr$(13)
  4603.     arrTileText(134) = m$
  4604.  
  4605.     m$ = ""
  4606.     m$ = m$ + "..22...." + Chr$(13)
  4607.     m$ = m$ + "..22...." + Chr$(13)
  4608.     m$ = m$ + "..22...." + Chr$(13)
  4609.     m$ = m$ + "..22...." + Chr$(13)
  4610.     m$ = m$ + "..22...." + Chr$(13)
  4611.     m$ = m$ + "..22...." + Chr$(13)
  4612.     m$ = m$ + "..22...." + Chr$(13)
  4613.     m$ = m$ + "..22...." + Chr$(13)
  4614.     arrTileText(135) = m$
  4615.  
  4616.     m$ = ""
  4617.     m$ = m$ + "....22.." + Chr$(13)
  4618.     m$ = m$ + "....22.." + Chr$(13)
  4619.     m$ = m$ + "....22.." + Chr$(13)
  4620.     m$ = m$ + "....22.." + Chr$(13)
  4621.     m$ = m$ + "....22.." + Chr$(13)
  4622.     m$ = m$ + "....22.." + Chr$(13)
  4623.     m$ = m$ + "....22.." + Chr$(13)
  4624.     m$ = m$ + "....22.." + Chr$(13)
  4625.     arrTileText(136) = m$
  4626.  
  4627.     m$ = ""
  4628.     m$ = m$ + "........" + Chr$(13)
  4629.     m$ = m$ + "........" + Chr$(13)
  4630.     m$ = m$ + "........" + Chr$(13)
  4631.     m$ = m$ + "222....." + Chr$(13)
  4632.     m$ = m$ + "2222...." + Chr$(13)
  4633.     m$ = m$ + "..222..." + Chr$(13)
  4634.     m$ = m$ + "...22..." + Chr$(13)
  4635.     m$ = m$ + "...22..." + Chr$(13)
  4636.     arrTileText(137) = m$
  4637.  
  4638.     m$ = ""
  4639.     m$ = m$ + "...22..." + Chr$(13)
  4640.     m$ = m$ + "...22..." + Chr$(13)
  4641.     m$ = m$ + "...222.." + Chr$(13)
  4642.     m$ = m$ + "....2222" + Chr$(13)
  4643.     m$ = m$ + ".....222" + Chr$(13)
  4644.     m$ = m$ + "........" + Chr$(13)
  4645.     m$ = m$ + "........" + Chr$(13)
  4646.     m$ = m$ + "........" + Chr$(13)
  4647.     arrTileText(138) = m$
  4648.  
  4649.     m$ = ""
  4650.     m$ = m$ + "...22..." + Chr$(13)
  4651.     m$ = m$ + "...22..." + Chr$(13)
  4652.     m$ = m$ + "..222..." + Chr$(13)
  4653.     m$ = m$ + "2222...." + Chr$(13)
  4654.     m$ = m$ + "222....." + Chr$(13)
  4655.     m$ = m$ + "........" + Chr$(13)
  4656.     m$ = m$ + "........" + Chr$(13)
  4657.     m$ = m$ + "........" + Chr$(13)
  4658.     arrTileText(139) = m$
  4659.  
  4660.     m$ = ""
  4661.     m$ = m$ + "22......" + Chr$(13)
  4662.     m$ = m$ + "22......" + Chr$(13)
  4663.     m$ = m$ + "22......" + Chr$(13)
  4664.     m$ = m$ + "22......" + Chr$(13)
  4665.     m$ = m$ + "22......" + Chr$(13)
  4666.     m$ = m$ + "22......" + Chr$(13)
  4667.     m$ = m$ + "22222222" + Chr$(13)
  4668.     m$ = m$ + "22222222" + Chr$(13)
  4669.     arrTileText(140) = m$
  4670.  
  4671.     m$ = ""
  4672.     m$ = m$ + "22......" + Chr$(13)
  4673.     m$ = m$ + "222....." + Chr$(13)
  4674.     m$ = m$ + ".222...." + Chr$(13)
  4675.     m$ = m$ + "..222..." + Chr$(13)
  4676.     m$ = m$ + "...222.." + Chr$(13)
  4677.     m$ = m$ + "....222." + Chr$(13)
  4678.     m$ = m$ + ".....222" + Chr$(13)
  4679.     m$ = m$ + "......22" + Chr$(13)
  4680.     arrTileText(141) = m$
  4681.  
  4682.     m$ = ""
  4683.     m$ = m$ + "......22" + Chr$(13)
  4684.     m$ = m$ + ".....222" + Chr$(13)
  4685.     m$ = m$ + "....222." + Chr$(13)
  4686.     m$ = m$ + "...222.." + Chr$(13)
  4687.     m$ = m$ + "..222..." + Chr$(13)
  4688.     m$ = m$ + ".222...." + Chr$(13)
  4689.     m$ = m$ + "222....." + Chr$(13)
  4690.     m$ = m$ + "22......" + Chr$(13)
  4691.     arrTileText(142) = m$
  4692.  
  4693.     m$ = ""
  4694.     m$ = m$ + "22222222" + Chr$(13)
  4695.     m$ = m$ + "22222222" + Chr$(13)
  4696.     m$ = m$ + "22......" + Chr$(13)
  4697.     m$ = m$ + "22......" + Chr$(13)
  4698.     m$ = m$ + "22......" + Chr$(13)
  4699.     m$ = m$ + "22......" + Chr$(13)
  4700.     m$ = m$ + "22......" + Chr$(13)
  4701.     m$ = m$ + "22......" + Chr$(13)
  4702.     arrTileText(143) = m$
  4703.  
  4704.     m$ = ""
  4705.     m$ = m$ + "22222222" + Chr$(13)
  4706.     m$ = m$ + "22222222" + Chr$(13)
  4707.     m$ = m$ + "......22" + Chr$(13)
  4708.     m$ = m$ + "......22" + Chr$(13)
  4709.     m$ = m$ + "......22" + Chr$(13)
  4710.     m$ = m$ + "......22" + Chr$(13)
  4711.     m$ = m$ + "......22" + Chr$(13)
  4712.     m$ = m$ + "......22" + Chr$(13)
  4713.     arrTileText(144) = m$
  4714.  
  4715.     m$ = ""
  4716.     m$ = m$ + "........" + Chr$(13)
  4717.     m$ = m$ + "..2222.." + Chr$(13)
  4718.     m$ = m$ + ".222222." + Chr$(13)
  4719.     m$ = m$ + ".222222." + Chr$(13)
  4720.     m$ = m$ + ".222222." + Chr$(13)
  4721.     m$ = m$ + ".222222." + Chr$(13)
  4722.     m$ = m$ + "..2222.." + Chr$(13)
  4723.     m$ = m$ + "........" + Chr$(13)
  4724.     arrTileText(145) = m$
  4725.  
  4726.     m$ = ""
  4727.     m$ = m$ + "........" + Chr$(13)
  4728.     m$ = m$ + "........" + Chr$(13)
  4729.     m$ = m$ + "........" + Chr$(13)
  4730.     m$ = m$ + "........" + Chr$(13)
  4731.     m$ = m$ + "........" + Chr$(13)
  4732.     m$ = m$ + "22222222" + Chr$(13)
  4733.     m$ = m$ + "22222222" + Chr$(13)
  4734.     m$ = m$ + "........" + Chr$(13)
  4735.     arrTileText(146) = m$
  4736.  
  4737.     m$ = ""
  4738.     m$ = m$ + "..22.22." + Chr$(13)
  4739.     m$ = m$ + ".2222222" + Chr$(13)
  4740.     m$ = m$ + ".2222222" + Chr$(13)
  4741.     m$ = m$ + ".2222222" + Chr$(13)
  4742.     m$ = m$ + "..22222." + Chr$(13)
  4743.     m$ = m$ + "...222.." + Chr$(13)
  4744.     m$ = m$ + "....2..." + Chr$(13)
  4745.     m$ = m$ + "........" + Chr$(13)
  4746.     arrTileText(147) = m$
  4747.  
  4748.     m$ = ""
  4749.     m$ = m$ + ".22....." + Chr$(13)
  4750.     m$ = m$ + ".22....." + Chr$(13)
  4751.     m$ = m$ + ".22....." + Chr$(13)
  4752.     m$ = m$ + ".22....." + Chr$(13)
  4753.     m$ = m$ + ".22....." + Chr$(13)
  4754.     m$ = m$ + ".22....." + Chr$(13)
  4755.     m$ = m$ + ".22....." + Chr$(13)
  4756.     m$ = m$ + ".22....." + Chr$(13)
  4757.     arrTileText(148) = m$
  4758.  
  4759.     m$ = ""
  4760.     m$ = m$ + "........" + Chr$(13)
  4761.     m$ = m$ + "........" + Chr$(13)
  4762.     m$ = m$ + "........" + Chr$(13)
  4763.     m$ = m$ + ".....222" + Chr$(13)
  4764.     m$ = m$ + "....2222" + Chr$(13)
  4765.     m$ = m$ + "...222.." + Chr$(13)
  4766.     m$ = m$ + "...22..." + Chr$(13)
  4767.     m$ = m$ + "...22..." + Chr$(13)
  4768.     arrTileText(149) = m$
  4769.  
  4770.     m$ = ""
  4771.     m$ = m$ + "22....22" + Chr$(13)
  4772.     m$ = m$ + "222..222" + Chr$(13)
  4773.     m$ = m$ + ".222222." + Chr$(13)
  4774.     m$ = m$ + "..2222.." + Chr$(13)
  4775.     m$ = m$ + "..2222.." + Chr$(13)
  4776.     m$ = m$ + ".222222." + Chr$(13)
  4777.     m$ = m$ + "222..222" + Chr$(13)
  4778.     m$ = m$ + "22....22" + Chr$(13)
  4779.     arrTileText(150) = m$
  4780.  
  4781.     m$ = ""
  4782.     m$ = m$ + "........" + Chr$(13)
  4783.     m$ = m$ + "..2222.." + Chr$(13)
  4784.     m$ = m$ + ".222222." + Chr$(13)
  4785.     m$ = m$ + ".22..22." + Chr$(13)
  4786.     m$ = m$ + ".22..22." + Chr$(13)
  4787.     m$ = m$ + ".222222." + Chr$(13)
  4788.     m$ = m$ + "..2222.." + Chr$(13)
  4789.     m$ = m$ + "........" + Chr$(13)
  4790.     arrTileText(151) = m$
  4791.  
  4792.     m$ = ""
  4793.     m$ = m$ + "...22..." + Chr$(13)
  4794.     m$ = m$ + "...22..." + Chr$(13)
  4795.     m$ = m$ + ".22..22." + Chr$(13)
  4796.     m$ = m$ + ".22..22." + Chr$(13)
  4797.     m$ = m$ + "...22..." + Chr$(13)
  4798.     m$ = m$ + "...22..." + Chr$(13)
  4799.     m$ = m$ + "..2222.." + Chr$(13)
  4800.     m$ = m$ + "........" + Chr$(13)
  4801.     arrTileText(152) = m$
  4802.  
  4803.     m$ = ""
  4804.     m$ = m$ + ".....22." + Chr$(13)
  4805.     m$ = m$ + ".....22." + Chr$(13)
  4806.     m$ = m$ + ".....22." + Chr$(13)
  4807.     m$ = m$ + ".....22." + Chr$(13)
  4808.     m$ = m$ + ".....22." + Chr$(13)
  4809.     m$ = m$ + ".....22." + Chr$(13)
  4810.     m$ = m$ + ".....22." + Chr$(13)
  4811.     m$ = m$ + ".....22." + Chr$(13)
  4812.     arrTileText(153) = m$
  4813.  
  4814.     m$ = ""
  4815.     m$ = m$ + "....2..." + Chr$(13)
  4816.     m$ = m$ + "...222.." + Chr$(13)
  4817.     m$ = m$ + "..22222." + Chr$(13)
  4818.     m$ = m$ + ".2222222" + Chr$(13)
  4819.     m$ = m$ + "..22222." + Chr$(13)
  4820.     m$ = m$ + "...222.." + Chr$(13)
  4821.     m$ = m$ + "....2..." + Chr$(13)
  4822.     m$ = m$ + "........" + Chr$(13)
  4823.     arrTileText(154) = m$
  4824.  
  4825.     m$ = ""
  4826.     m$ = m$ + "...22..." + Chr$(13)
  4827.     m$ = m$ + "...22..." + Chr$(13)
  4828.     m$ = m$ + "...22..." + Chr$(13)
  4829.     m$ = m$ + "22222222" + Chr$(13)
  4830.     m$ = m$ + "22222222" + Chr$(13)
  4831.     m$ = m$ + "...22..." + Chr$(13)
  4832.     m$ = m$ + "...22..." + Chr$(13)
  4833.     m$ = m$ + "...22..." + Chr$(13)
  4834.     arrTileText(155) = m$
  4835.  
  4836.     m$ = ""
  4837.     m$ = m$ + "22......" + Chr$(13)
  4838.     m$ = m$ + "22......" + Chr$(13)
  4839.     m$ = m$ + "..22...." + Chr$(13)
  4840.     m$ = m$ + "..22...." + Chr$(13)
  4841.     m$ = m$ + "22......" + Chr$(13)
  4842.     m$ = m$ + "22......" + Chr$(13)
  4843.     m$ = m$ + "..22...." + Chr$(13)
  4844.     m$ = m$ + "..22...." + Chr$(13)
  4845.     arrTileText(156) = m$
  4846.  
  4847.     m$ = ""
  4848.     m$ = m$ + "...22..." + Chr$(13)
  4849.     m$ = m$ + "...22..." + Chr$(13)
  4850.     m$ = m$ + "...22..." + Chr$(13)
  4851.     m$ = m$ + "...22..." + Chr$(13)
  4852.     m$ = m$ + "...22..." + Chr$(13)
  4853.     m$ = m$ + "...22..." + Chr$(13)
  4854.     m$ = m$ + "...22..." + Chr$(13)
  4855.     m$ = m$ + "...22..." + Chr$(13)
  4856.     arrTileText(157) = m$
  4857.  
  4858.     m$ = ""
  4859.     m$ = m$ + "........" + Chr$(13)
  4860.     m$ = m$ + "........" + Chr$(13)
  4861.     m$ = m$ + "......22" + Chr$(13)
  4862.     m$ = m$ + "..22222." + Chr$(13)
  4863.     m$ = m$ + ".222.22." + Chr$(13)
  4864.     m$ = m$ + "..22.22." + Chr$(13)
  4865.     m$ = m$ + "..22.22." + Chr$(13)
  4866.     m$ = m$ + "........" + Chr$(13)
  4867.     arrTileText(158) = m$
  4868.  
  4869.     m$ = ""
  4870.     m$ = m$ + "22222222" + Chr$(13)
  4871.     m$ = m$ + ".2222222" + Chr$(13)
  4872.     m$ = m$ + "..222222" + Chr$(13)
  4873.     m$ = m$ + "...22222" + Chr$(13)
  4874.     m$ = m$ + "....2222" + Chr$(13)
  4875.     m$ = m$ + ".....222" + Chr$(13)
  4876.     m$ = m$ + "......22" + Chr$(13)
  4877.     m$ = m$ + ".......2" + Chr$(13)
  4878.     arrTileText(159) = m$
  4879.  
  4880.     m$ = ""
  4881.     m$ = m$ + "........" + Chr$(13)
  4882.     m$ = m$ + "........" + Chr$(13)
  4883.     m$ = m$ + "........" + Chr$(13)
  4884.     m$ = m$ + "........" + Chr$(13)
  4885.     m$ = m$ + "........" + Chr$(13)
  4886.     m$ = m$ + "........" + Chr$(13)
  4887.     m$ = m$ + "........" + Chr$(13)
  4888.     m$ = m$ + "........" + Chr$(13)
  4889.     arrTileText(160) = m$
  4890.  
  4891.     m$ = ""
  4892.     m$ = m$ + "2222...." + Chr$(13)
  4893.     m$ = m$ + "2222...." + Chr$(13)
  4894.     m$ = m$ + "2222...." + Chr$(13)
  4895.     m$ = m$ + "2222...." + Chr$(13)
  4896.     m$ = m$ + "2222...." + Chr$(13)
  4897.     m$ = m$ + "2222...." + Chr$(13)
  4898.     m$ = m$ + "2222...." + Chr$(13)
  4899.     m$ = m$ + "2222...." + Chr$(13)
  4900.     arrTileText(161) = m$
  4901.  
  4902.     m$ = ""
  4903.     m$ = m$ + "........" + Chr$(13)
  4904.     m$ = m$ + "........" + Chr$(13)
  4905.     m$ = m$ + "........" + Chr$(13)
  4906.     m$ = m$ + "........" + Chr$(13)
  4907.     m$ = m$ + "22222222" + Chr$(13)
  4908.     m$ = m$ + "22222222" + Chr$(13)
  4909.     m$ = m$ + "22222222" + Chr$(13)
  4910.     m$ = m$ + "22222222" + Chr$(13)
  4911.     arrTileText(162) = m$
  4912.  
  4913.     m$ = ""
  4914.     m$ = m$ + "22222222" + Chr$(13)
  4915.     m$ = m$ + "........" + Chr$(13)
  4916.     m$ = m$ + "........" + Chr$(13)
  4917.     m$ = m$ + "........" + Chr$(13)
  4918.     m$ = m$ + "........" + Chr$(13)
  4919.     m$ = m$ + "........" + Chr$(13)
  4920.     m$ = m$ + "........" + Chr$(13)
  4921.     m$ = m$ + "........" + Chr$(13)
  4922.     arrTileText(163) = m$
  4923.  
  4924.     m$ = ""
  4925.     m$ = m$ + "........" + Chr$(13)
  4926.     m$ = m$ + "........" + Chr$(13)
  4927.     m$ = m$ + "........" + Chr$(13)
  4928.     m$ = m$ + "........" + Chr$(13)
  4929.     m$ = m$ + "........" + Chr$(13)
  4930.     m$ = m$ + "........" + Chr$(13)
  4931.     m$ = m$ + "........" + Chr$(13)
  4932.     m$ = m$ + "22222222" + Chr$(13)
  4933.     arrTileText(164) = m$
  4934.  
  4935.     m$ = ""
  4936.     m$ = m$ + "22......" + Chr$(13)
  4937.     m$ = m$ + "22......" + Chr$(13)
  4938.     m$ = m$ + "22......" + Chr$(13)
  4939.     m$ = m$ + "22......" + Chr$(13)
  4940.     m$ = m$ + "22......" + Chr$(13)
  4941.     m$ = m$ + "22......" + Chr$(13)
  4942.     m$ = m$ + "22......" + Chr$(13)
  4943.     m$ = m$ + "22......" + Chr$(13)
  4944.     arrTileText(165) = m$
  4945.  
  4946.     m$ = ""
  4947.     m$ = m$ + "22..22.." + Chr$(13)
  4948.     m$ = m$ + "22..22.." + Chr$(13)
  4949.     m$ = m$ + "..22..22" + Chr$(13)
  4950.     m$ = m$ + "..22..22" + Chr$(13)
  4951.     m$ = m$ + "22..22.." + Chr$(13)
  4952.     m$ = m$ + "22..22.." + Chr$(13)
  4953.     m$ = m$ + "..22..22" + Chr$(13)
  4954.     m$ = m$ + "..22..22" + Chr$(13)
  4955.     arrTileText(166) = m$
  4956.  
  4957.     m$ = ""
  4958.     m$ = m$ + "......22" + Chr$(13)
  4959.     m$ = m$ + "......22" + Chr$(13)
  4960.     m$ = m$ + "......22" + Chr$(13)
  4961.     m$ = m$ + "......22" + Chr$(13)
  4962.     m$ = m$ + "......22" + Chr$(13)
  4963.     m$ = m$ + "......22" + Chr$(13)
  4964.     m$ = m$ + "......22" + Chr$(13)
  4965.     m$ = m$ + "......22" + Chr$(13)
  4966.     arrTileText(167) = m$
  4967.  
  4968.     m$ = ""
  4969.     m$ = m$ + "........" + Chr$(13)
  4970.     m$ = m$ + "........" + Chr$(13)
  4971.     m$ = m$ + "........" + Chr$(13)
  4972.     m$ = m$ + "........" + Chr$(13)
  4973.     m$ = m$ + "22..22.." + Chr$(13)
  4974.     m$ = m$ + "22..22.." + Chr$(13)
  4975.     m$ = m$ + "..22..22" + Chr$(13)
  4976.     m$ = m$ + "..22..22" + Chr$(13)
  4977.     arrTileText(168) = m$
  4978.  
  4979.     m$ = ""
  4980.     m$ = m$ + "22222222" + Chr$(13)
  4981.     m$ = m$ + "2222222." + Chr$(13)
  4982.     m$ = m$ + "222222.." + Chr$(13)
  4983.     m$ = m$ + "22222..." + Chr$(13)
  4984.     m$ = m$ + "2222...." + Chr$(13)
  4985.     m$ = m$ + "222....." + Chr$(13)
  4986.     m$ = m$ + "22......" + Chr$(13)
  4987.     m$ = m$ + "2......." + Chr$(13)
  4988.     arrTileText(169) = m$
  4989.  
  4990.     m$ = ""
  4991.     m$ = m$ + "......22" + Chr$(13)
  4992.     m$ = m$ + "......22" + Chr$(13)
  4993.     m$ = m$ + "......22" + Chr$(13)
  4994.     m$ = m$ + "......22" + Chr$(13)
  4995.     m$ = m$ + "......22" + Chr$(13)
  4996.     m$ = m$ + "......22" + Chr$(13)
  4997.     m$ = m$ + "......22" + Chr$(13)
  4998.     m$ = m$ + "......22" + Chr$(13)
  4999.     arrTileText(170) = m$
  5000.  
  5001.     m$ = ""
  5002.     m$ = m$ + "...22..." + Chr$(13)
  5003.     m$ = m$ + "...22..." + Chr$(13)
  5004.     m$ = m$ + "...22..." + Chr$(13)
  5005.     m$ = m$ + "...22222" + Chr$(13)
  5006.     m$ = m$ + "...22222" + Chr$(13)
  5007.     m$ = m$ + "...22..." + Chr$(13)
  5008.     m$ = m$ + "...22..." + Chr$(13)
  5009.     m$ = m$ + "...22..." + Chr$(13)
  5010.     arrTileText(171) = m$
  5011.  
  5012.     m$ = ""
  5013.     m$ = m$ + "........" + Chr$(13)
  5014.     m$ = m$ + "........" + Chr$(13)
  5015.     m$ = m$ + "........" + Chr$(13)
  5016.     m$ = m$ + "........" + Chr$(13)
  5017.     m$ = m$ + "....2222" + Chr$(13)
  5018.     m$ = m$ + "....2222" + Chr$(13)
  5019.     m$ = m$ + "....2222" + Chr$(13)
  5020.     m$ = m$ + "....2222" + Chr$(13)
  5021.     arrTileText(172) = m$
  5022.  
  5023.     m$ = ""
  5024.     m$ = m$ + "...22..." + Chr$(13)
  5025.     m$ = m$ + "...22..." + Chr$(13)
  5026.     m$ = m$ + "...22..." + Chr$(13)
  5027.     m$ = m$ + "...22222" + Chr$(13)
  5028.     m$ = m$ + "...22222" + Chr$(13)
  5029.     m$ = m$ + "........" + Chr$(13)
  5030.     m$ = m$ + "........" + Chr$(13)
  5031.     m$ = m$ + "........" + Chr$(13)
  5032.     arrTileText(173) = m$
  5033.  
  5034.     m$ = ""
  5035.     m$ = m$ + "........" + Chr$(13)
  5036.     m$ = m$ + "........" + Chr$(13)
  5037.     m$ = m$ + "........" + Chr$(13)
  5038.     m$ = m$ + "22222..." + Chr$(13)
  5039.     m$ = m$ + "22222..." + Chr$(13)
  5040.     m$ = m$ + "...22..." + Chr$(13)
  5041.     m$ = m$ + "...22..." + Chr$(13)
  5042.     m$ = m$ + "...22..." + Chr$(13)
  5043.     arrTileText(174) = m$
  5044.  
  5045.     m$ = ""
  5046.     m$ = m$ + "........" + Chr$(13)
  5047.     m$ = m$ + "........" + Chr$(13)
  5048.     m$ = m$ + "........" + Chr$(13)
  5049.     m$ = m$ + "........" + Chr$(13)
  5050.     m$ = m$ + "........" + Chr$(13)
  5051.     m$ = m$ + "........" + Chr$(13)
  5052.     m$ = m$ + "22222222" + Chr$(13)
  5053.     m$ = m$ + "22222222" + Chr$(13)
  5054.     arrTileText(175) = m$
  5055.  
  5056.     m$ = ""
  5057.     m$ = m$ + "........" + Chr$(13)
  5058.     m$ = m$ + "........" + Chr$(13)
  5059.     m$ = m$ + "........" + Chr$(13)
  5060.     m$ = m$ + "...22222" + Chr$(13)
  5061.     m$ = m$ + "...22222" + Chr$(13)
  5062.     m$ = m$ + "...22..." + Chr$(13)
  5063.     m$ = m$ + "...22..." + Chr$(13)
  5064.     m$ = m$ + "...22..." + Chr$(13)
  5065.     arrTileText(176) = m$
  5066.  
  5067.     m$ = ""
  5068.     m$ = m$ + "...22..." + Chr$(13)
  5069.     m$ = m$ + "...22..." + Chr$(13)
  5070.     m$ = m$ + "...22..." + Chr$(13)
  5071.     m$ = m$ + "22222222" + Chr$(13)
  5072.     m$ = m$ + "22222222" + Chr$(13)
  5073.     m$ = m$ + "........" + Chr$(13)
  5074.     m$ = m$ + "........" + Chr$(13)
  5075.     m$ = m$ + "........" + Chr$(13)
  5076.     arrTileText(177) = m$
  5077.  
  5078.     m$ = ""
  5079.     m$ = m$ + "........" + Chr$(13)
  5080.     m$ = m$ + "........" + Chr$(13)
  5081.     m$ = m$ + "........" + Chr$(13)
  5082.     m$ = m$ + "22222222" + Chr$(13)
  5083.     m$ = m$ + "22222222" + Chr$(13)
  5084.     m$ = m$ + "...22..." + Chr$(13)
  5085.     m$ = m$ + "...22..." + Chr$(13)
  5086.     m$ = m$ + "...22..." + Chr$(13)
  5087.     arrTileText(178) = m$
  5088.  
  5089.     m$ = ""
  5090.     m$ = m$ + "...22..." + Chr$(13)
  5091.     m$ = m$ + "...22..." + Chr$(13)
  5092.     m$ = m$ + "...22..." + Chr$(13)
  5093.     m$ = m$ + "22222..." + Chr$(13)
  5094.     m$ = m$ + "22222..." + Chr$(13)
  5095.     m$ = m$ + "...22..." + Chr$(13)
  5096.     m$ = m$ + "...22..." + Chr$(13)
  5097.     m$ = m$ + "...22..." + Chr$(13)
  5098.     arrTileText(179) = m$
  5099.  
  5100.     m$ = ""
  5101.     m$ = m$ + "22......" + Chr$(13)
  5102.     m$ = m$ + "22......" + Chr$(13)
  5103.     m$ = m$ + "22......" + Chr$(13)
  5104.     m$ = m$ + "22......" + Chr$(13)
  5105.     m$ = m$ + "22......" + Chr$(13)
  5106.     m$ = m$ + "22......" + Chr$(13)
  5107.     m$ = m$ + "22......" + Chr$(13)
  5108.     m$ = m$ + "22......" + Chr$(13)
  5109.     arrTileText(180) = m$
  5110.  
  5111.     m$ = ""
  5112.     m$ = m$ + "222....." + Chr$(13)
  5113.     m$ = m$ + "222....." + Chr$(13)
  5114.     m$ = m$ + "222....." + Chr$(13)
  5115.     m$ = m$ + "222....." + Chr$(13)
  5116.     m$ = m$ + "222....." + Chr$(13)
  5117.     m$ = m$ + "222....." + Chr$(13)
  5118.     m$ = m$ + "222....." + Chr$(13)
  5119.     m$ = m$ + "222....." + Chr$(13)
  5120.     arrTileText(181) = m$
  5121.  
  5122.     m$ = ""
  5123.     m$ = m$ + ".....222" + Chr$(13)
  5124.     m$ = m$ + ".....222" + Chr$(13)
  5125.     m$ = m$ + ".....222" + Chr$(13)
  5126.     m$ = m$ + ".....222" + Chr$(13)
  5127.     m$ = m$ + ".....222" + Chr$(13)
  5128.     m$ = m$ + ".....222" + Chr$(13)
  5129.     m$ = m$ + ".....222" + Chr$(13)
  5130.     m$ = m$ + ".....222" + Chr$(13)
  5131.     arrTileText(182) = m$
  5132.  
  5133.     m$ = ""
  5134.     m$ = m$ + "22222222" + Chr$(13)
  5135.     m$ = m$ + "22222222" + Chr$(13)
  5136.     m$ = m$ + "........" + Chr$(13)
  5137.     m$ = m$ + "........" + Chr$(13)
  5138.     m$ = m$ + "........" + Chr$(13)
  5139.     m$ = m$ + "........" + Chr$(13)
  5140.     m$ = m$ + "........" + Chr$(13)
  5141.     m$ = m$ + "........" + Chr$(13)
  5142.     arrTileText(183) = m$
  5143.  
  5144.     m$ = ""
  5145.     m$ = m$ + "22222222" + Chr$(13)
  5146.     m$ = m$ + "22222222" + Chr$(13)
  5147.     m$ = m$ + "22222222" + Chr$(13)
  5148.     m$ = m$ + "........" + Chr$(13)
  5149.     m$ = m$ + "........" + Chr$(13)
  5150.     m$ = m$ + "........" + Chr$(13)
  5151.     m$ = m$ + "........" + Chr$(13)
  5152.     m$ = m$ + "........" + Chr$(13)
  5153.     arrTileText(184) = m$
  5154.  
  5155.     m$ = ""
  5156.     m$ = m$ + "........" + Chr$(13)
  5157.     m$ = m$ + "........" + Chr$(13)
  5158.     m$ = m$ + "........" + Chr$(13)
  5159.     m$ = m$ + "........" + Chr$(13)
  5160.     m$ = m$ + "........" + Chr$(13)
  5161.     m$ = m$ + "22222222" + Chr$(13)
  5162.     m$ = m$ + "22222222" + Chr$(13)
  5163.     m$ = m$ + "22222222" + Chr$(13)
  5164.     arrTileText(185) = m$
  5165.  
  5166.     m$ = ""
  5167.     m$ = m$ + "......22" + Chr$(13)
  5168.     m$ = m$ + "......22" + Chr$(13)
  5169.     m$ = m$ + "......22" + Chr$(13)
  5170.     m$ = m$ + "......22" + Chr$(13)
  5171.     m$ = m$ + "......22" + Chr$(13)
  5172.     m$ = m$ + "......22" + Chr$(13)
  5173.     m$ = m$ + "22222222" + Chr$(13)
  5174.     m$ = m$ + "22222222" + Chr$(13)
  5175.     arrTileText(186) = m$
  5176.  
  5177.     m$ = ""
  5178.     m$ = m$ + "........" + Chr$(13)
  5179.     m$ = m$ + "........" + Chr$(13)
  5180.     m$ = m$ + "........" + Chr$(13)
  5181.     m$ = m$ + "........" + Chr$(13)
  5182.     m$ = m$ + "2222...." + Chr$(13)
  5183.     m$ = m$ + "2222...." + Chr$(13)
  5184.     m$ = m$ + "2222...." + Chr$(13)
  5185.     m$ = m$ + "2222...." + Chr$(13)
  5186.     arrTileText(187) = m$
  5187.  
  5188.     m$ = ""
  5189.     m$ = m$ + "....2222" + Chr$(13)
  5190.     m$ = m$ + "....2222" + Chr$(13)
  5191.     m$ = m$ + "....2222" + Chr$(13)
  5192.     m$ = m$ + "....2222" + Chr$(13)
  5193.     m$ = m$ + "........" + Chr$(13)
  5194.     m$ = m$ + "........" + Chr$(13)
  5195.     m$ = m$ + "........" + Chr$(13)
  5196.     m$ = m$ + "........" + Chr$(13)
  5197.     arrTileText(188) = m$
  5198.  
  5199.     m$ = ""
  5200.     m$ = m$ + "...22..." + Chr$(13)
  5201.     m$ = m$ + "...22..." + Chr$(13)
  5202.     m$ = m$ + "...22..." + Chr$(13)
  5203.     m$ = m$ + "22222..." + Chr$(13)
  5204.     m$ = m$ + "22222..." + Chr$(13)
  5205.     m$ = m$ + "........" + Chr$(13)
  5206.     m$ = m$ + "........" + Chr$(13)
  5207.     m$ = m$ + "........" + Chr$(13)
  5208.     arrTileText(189) = m$
  5209.  
  5210.     m$ = ""
  5211.     m$ = m$ + "2222...." + Chr$(13)
  5212.     m$ = m$ + "2222...." + Chr$(13)
  5213.     m$ = m$ + "2222...." + Chr$(13)
  5214.     m$ = m$ + "2222...." + Chr$(13)
  5215.     m$ = m$ + "........" + Chr$(13)
  5216.     m$ = m$ + "........" + Chr$(13)
  5217.     m$ = m$ + "........" + Chr$(13)
  5218.     m$ = m$ + "........" + Chr$(13)
  5219.     arrTileText(190) = m$
  5220.  
  5221.     m$ = ""
  5222.     m$ = m$ + "2222...." + Chr$(13)
  5223.     m$ = m$ + "2222...." + Chr$(13)
  5224.     m$ = m$ + "2222...." + Chr$(13)
  5225.     m$ = m$ + "2222...." + Chr$(13)
  5226.     m$ = m$ + "....2222" + Chr$(13)
  5227.     m$ = m$ + "....2222" + Chr$(13)
  5228.     m$ = m$ + "....2222" + Chr$(13)
  5229.     m$ = m$ + "....2222" + Chr$(13)
  5230.     arrTileText(191) = m$
  5231.  
  5232.     m$ = ""
  5233.     m$ = m$ + "........" + Chr$(13)
  5234.     m$ = m$ + ".2222222" + Chr$(13)
  5235.     m$ = m$ + ".2.....2" + Chr$(13)
  5236.     m$ = m$ + ".2.....2" + Chr$(13)
  5237.     m$ = m$ + ".2.....2" + Chr$(13)
  5238.     m$ = m$ + ".2.....2" + Chr$(13)
  5239.     m$ = m$ + ".2.....2" + Chr$(13)
  5240.     m$ = m$ + ".2222222" + Chr$(13)
  5241.     arrTileText(192) = m$
  5242.  
  5243.     m$ = ""
  5244.     m$ = m$ + "........" + Chr$(13)
  5245.     m$ = m$ + ".2222222" + Chr$(13)
  5246.     m$ = m$ + ".2222222" + Chr$(13)
  5247.     m$ = m$ + ".2222222" + Chr$(13)
  5248.     m$ = m$ + ".2222222" + Chr$(13)
  5249.     m$ = m$ + ".2222222" + Chr$(13)
  5250.     m$ = m$ + ".2222222" + Chr$(13)
  5251.     m$ = m$ + ".2222222" + Chr$(13)
  5252.     arrTileText(193) = m$
  5253.  
  5254.     m$ = ""
  5255.     m$ = m$ + "........" + Chr$(13)
  5256.     m$ = m$ + "...22..." + Chr$(13)
  5257.     m$ = m$ + "..2222.." + Chr$(13)
  5258.     m$ = m$ + ".222222." + Chr$(13)
  5259.     m$ = m$ + "...22..." + Chr$(13)
  5260.     m$ = m$ + "...22..." + Chr$(13)
  5261.     m$ = m$ + "...22..." + Chr$(13)
  5262.     m$ = m$ + "...22..." + Chr$(13)
  5263.     arrTileText(194) = m$
  5264.  
  5265.     m$ = ""
  5266.     m$ = m$ + "........" + Chr$(13)
  5267.     m$ = m$ + "...22..." + Chr$(13)
  5268.     m$ = m$ + "...22..." + Chr$(13)
  5269.     m$ = m$ + "...22..." + Chr$(13)
  5270.     m$ = m$ + "...22..." + Chr$(13)
  5271.     m$ = m$ + ".222222." + Chr$(13)
  5272.     m$ = m$ + "..2222.." + Chr$(13)
  5273.     m$ = m$ + "...22..." + Chr$(13)
  5274.     arrTileText(195) = m$
  5275.  
  5276.     m$ = ""
  5277.     m$ = m$ + "........" + Chr$(13)
  5278.     m$ = m$ + "...2...." + Chr$(13)
  5279.     m$ = m$ + "..22...." + Chr$(13)
  5280.     m$ = m$ + ".2222222" + Chr$(13)
  5281.     m$ = m$ + ".2222222" + Chr$(13)
  5282.     m$ = m$ + "..22...." + Chr$(13)
  5283.     m$ = m$ + "...2...." + Chr$(13)
  5284.     m$ = m$ + "........" + Chr$(13)
  5285.     arrTileText(196) = m$
  5286.  
  5287.     m$ = ""
  5288.     m$ = m$ + "........" + Chr$(13)
  5289.     m$ = m$ + ".....2.." + Chr$(13)
  5290.     m$ = m$ + ".....22." + Chr$(13)
  5291.     m$ = m$ + ".2222222" + Chr$(13)
  5292.     m$ = m$ + ".2222222" + Chr$(13)
  5293.     m$ = m$ + ".....22." + Chr$(13)
  5294.     m$ = m$ + ".....2.." + Chr$(13)
  5295.     m$ = m$ + "........" + Chr$(13)
  5296.     arrTileText(197) = m$
  5297.  
  5298.     m$ = ""
  5299.     m$ = m$ + "........" + Chr$(13)
  5300.     m$ = m$ + "........" + Chr$(13)
  5301.     m$ = m$ + "........" + Chr$(13)
  5302.     m$ = m$ + "........" + Chr$(13)
  5303.     m$ = m$ + "........" + Chr$(13)
  5304.     m$ = m$ + "........" + Chr$(13)
  5305.     m$ = m$ + "........" + Chr$(13)
  5306.     m$ = m$ + "........" + Chr$(13)
  5307.     arrTileText(198) = m$
  5308.  
  5309.     m$ = ""
  5310.     m$ = m$ + ".222222." + Chr$(13)
  5311.     m$ = m$ + "2......2" + Chr$(13)
  5312.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5313.     m$ = m$ + "2......2" + Chr$(13)
  5314.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5315.     m$ = m$ + "2.2222.2" + Chr$(13)
  5316.     m$ = m$ + "2......2" + Chr$(13)
  5317.     m$ = m$ + ".222222." + Chr$(13)
  5318.     arrTileText(199) = m$
  5319.  
  5320.     m$ = ""
  5321.     m$ = m$ + ".222222." + Chr$(13)
  5322.     m$ = m$ + "2......2" + Chr$(13)
  5323.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5324.     m$ = m$ + "2......2" + Chr$(13)
  5325.     m$ = m$ + "2.2222.2" + Chr$(13)
  5326.     m$ = m$ + "2.2..2.2" + Chr$(13)
  5327.     m$ = m$ + "2......2" + Chr$(13)
  5328.     m$ = m$ + ".222222." + Chr$(13)
  5329.     arrTileText(200) = m$
  5330.  
  5331.     m$ = ""
  5332.     m$ = m$ + "........" + Chr$(13)
  5333.     m$ = m$ + "........" + Chr$(13)
  5334.     m$ = m$ + "........" + Chr$(13)
  5335.     m$ = m$ + "........" + Chr$(13)
  5336.     m$ = m$ + "........" + Chr$(13)
  5337.     m$ = m$ + "........" + Chr$(13)
  5338.     m$ = m$ + "........" + Chr$(13)
  5339.     m$ = m$ + "........" + Chr$(13)
  5340.     arrTileText(201) = m$
  5341.  
  5342.     m$ = ""
  5343.     m$ = m$ + ".222222." + Chr$(13)
  5344.     m$ = m$ + ".....22." + Chr$(13)
  5345.     m$ = m$ + "....22.." + Chr$(13)
  5346.     m$ = m$ + "...22..." + Chr$(13)
  5347.     m$ = m$ + "..22...." + Chr$(13)
  5348.     m$ = m$ + ".22....." + Chr$(13)
  5349.     m$ = m$ + ".222222." + Chr$(13)
  5350.     m$ = m$ + "........" + Chr$(13)
  5351.     arrTileText(202) = m$
  5352.  
  5353.     m$ = ""
  5354.     m$ = m$ + "...22..." + Chr$(13)
  5355.     m$ = m$ + "...22..." + Chr$(13)
  5356.     m$ = m$ + "...22..." + Chr$(13)
  5357.     m$ = m$ + "22222222" + Chr$(13)
  5358.     m$ = m$ + "22222222" + Chr$(13)
  5359.     m$ = m$ + "...22..." + Chr$(13)
  5360.     m$ = m$ + "...22..." + Chr$(13)
  5361.     m$ = m$ + "...22..." + Chr$(13)
  5362.     arrTileText(203) = m$
  5363.  
  5364.     m$ = ""
  5365.     m$ = m$ + "22......" + Chr$(13)
  5366.     m$ = m$ + "22......" + Chr$(13)
  5367.     m$ = m$ + "..22...." + Chr$(13)
  5368.     m$ = m$ + "..22...." + Chr$(13)
  5369.     m$ = m$ + "22......" + Chr$(13)
  5370.     m$ = m$ + "22......" + Chr$(13)
  5371.     m$ = m$ + "..22...." + Chr$(13)
  5372.     m$ = m$ + "..22...." + Chr$(13)
  5373.     arrTileText(204) = m$
  5374.  
  5375.     m$ = ""
  5376.     m$ = m$ + "...22..." + Chr$(13)
  5377.     m$ = m$ + "...22..." + Chr$(13)
  5378.     m$ = m$ + "...22..." + Chr$(13)
  5379.     m$ = m$ + "...22..." + Chr$(13)
  5380.     m$ = m$ + "...22..." + Chr$(13)
  5381.     m$ = m$ + "...22..." + Chr$(13)
  5382.     m$ = m$ + "...22..." + Chr$(13)
  5383.     m$ = m$ + "...22..." + Chr$(13)
  5384.     arrTileText(205) = m$
  5385.  
  5386.     m$ = ""
  5387.     m$ = m$ + "..22..22" + Chr$(13)
  5388.     m$ = m$ + "..22..22" + Chr$(13)
  5389.     m$ = m$ + "22..22.." + Chr$(13)
  5390.     m$ = m$ + "22..22.." + Chr$(13)
  5391.     m$ = m$ + "..22..22" + Chr$(13)
  5392.     m$ = m$ + "..22..22" + Chr$(13)
  5393.     m$ = m$ + "22..22.." + Chr$(13)
  5394.     m$ = m$ + "22..22.." + Chr$(13)
  5395.     arrTileText(206) = m$
  5396.  
  5397.     m$ = ""
  5398.     m$ = m$ + "..22..22" + Chr$(13)
  5399.     m$ = m$ + "2..22..2" + Chr$(13)
  5400.     m$ = m$ + "22..22.." + Chr$(13)
  5401.     m$ = m$ + ".22..22." + Chr$(13)
  5402.     m$ = m$ + "..22..22" + Chr$(13)
  5403.     m$ = m$ + "2..22..2" + Chr$(13)
  5404.     m$ = m$ + "22..22.." + Chr$(13)
  5405.     m$ = m$ + ".22..22." + Chr$(13)
  5406.     arrTileText(207) = m$
  5407.  
  5408.     m$ = ""
  5409.     m$ = m$ + "........" + Chr$(13)
  5410.     m$ = m$ + "........" + Chr$(13)
  5411.     m$ = m$ + "........" + Chr$(13)
  5412.     m$ = m$ + "........" + Chr$(13)
  5413.     m$ = m$ + "........" + Chr$(13)
  5414.     m$ = m$ + "........" + Chr$(13)
  5415.     m$ = m$ + "........" + Chr$(13)
  5416.     m$ = m$ + "........" + Chr$(13)
  5417.     arrTileText(208) = m$
  5418.  
  5419.     m$ = ""
  5420.     m$ = m$ + "2222...." + Chr$(13)
  5421.     m$ = m$ + "2222...." + Chr$(13)
  5422.     m$ = m$ + "2222...." + Chr$(13)
  5423.     m$ = m$ + "2222...." + Chr$(13)
  5424.     m$ = m$ + "2222...." + Chr$(13)
  5425.     m$ = m$ + "2222...." + Chr$(13)
  5426.     m$ = m$ + "2222...." + Chr$(13)
  5427.     m$ = m$ + "2222...." + Chr$(13)
  5428.     arrTileText(209) = m$
  5429.  
  5430.     m$ = ""
  5431.     m$ = m$ + "........" + Chr$(13)
  5432.     m$ = m$ + "........" + Chr$(13)
  5433.     m$ = m$ + "........" + Chr$(13)
  5434.     m$ = m$ + "........" + Chr$(13)
  5435.     m$ = m$ + "22222222" + Chr$(13)
  5436.     m$ = m$ + "22222222" + Chr$(13)
  5437.     m$ = m$ + "22222222" + Chr$(13)
  5438.     m$ = m$ + "22222222" + Chr$(13)
  5439.     arrTileText(210) = m$
  5440.  
  5441.     m$ = ""
  5442.     m$ = m$ + "22222222" + Chr$(13)
  5443.     m$ = m$ + "........" + Chr$(13)
  5444.     m$ = m$ + "........" + Chr$(13)
  5445.     m$ = m$ + "........" + Chr$(13)
  5446.     m$ = m$ + "........" + Chr$(13)
  5447.     m$ = m$ + "........" + Chr$(13)
  5448.     m$ = m$ + "........" + Chr$(13)
  5449.     m$ = m$ + "........" + Chr$(13)
  5450.     arrTileText(211) = m$
  5451.  
  5452.     m$ = ""
  5453.     m$ = m$ + "........" + Chr$(13)
  5454.     m$ = m$ + "........" + Chr$(13)
  5455.     m$ = m$ + "........" + Chr$(13)
  5456.     m$ = m$ + "........" + Chr$(13)
  5457.     m$ = m$ + "........" + Chr$(13)
  5458.     m$ = m$ + "........" + Chr$(13)
  5459.     m$ = m$ + "........" + Chr$(13)
  5460.     m$ = m$ + "22222222" + Chr$(13)
  5461.     arrTileText(212) = m$
  5462.  
  5463.     m$ = ""
  5464.     m$ = m$ + "22......" + Chr$(13)
  5465.     m$ = m$ + "22......" + Chr$(13)
  5466.     m$ = m$ + "22......" + Chr$(13)
  5467.     m$ = m$ + "22......" + Chr$(13)
  5468.     m$ = m$ + "22......" + Chr$(13)
  5469.     m$ = m$ + "22......" + Chr$(13)
  5470.     m$ = m$ + "22......" + Chr$(13)
  5471.     m$ = m$ + "22......" + Chr$(13)
  5472.     arrTileText(213) = m$
  5473.  
  5474.     m$ = ""
  5475.     m$ = m$ + "22..22.." + Chr$(13)
  5476.     m$ = m$ + "22..22.." + Chr$(13)
  5477.     m$ = m$ + "..22..22" + Chr$(13)
  5478.     m$ = m$ + "..22..22" + Chr$(13)
  5479.     m$ = m$ + "22..22.." + Chr$(13)
  5480.     m$ = m$ + "22..22.." + Chr$(13)
  5481.     m$ = m$ + "..22..22" + Chr$(13)
  5482.     m$ = m$ + "..22..22" + Chr$(13)
  5483.     arrTileText(214) = m$
  5484.  
  5485.     m$ = ""
  5486.     m$ = m$ + "......22" + Chr$(13)
  5487.     m$ = m$ + "......22" + Chr$(13)
  5488.     m$ = m$ + "......22" + Chr$(13)
  5489.     m$ = m$ + "......22" + Chr$(13)
  5490.     m$ = m$ + "......22" + Chr$(13)
  5491.     m$ = m$ + "......22" + Chr$(13)
  5492.     m$ = m$ + "......22" + Chr$(13)
  5493.     m$ = m$ + "......22" + Chr$(13)
  5494.     arrTileText(215) = m$
  5495.  
  5496.     m$ = ""
  5497.     m$ = m$ + "........" + Chr$(13)
  5498.     m$ = m$ + "........" + Chr$(13)
  5499.     m$ = m$ + "........" + Chr$(13)
  5500.     m$ = m$ + "........" + Chr$(13)
  5501.     m$ = m$ + "22..22.." + Chr$(13)
  5502.     m$ = m$ + "22..22.." + Chr$(13)
  5503.     m$ = m$ + "..22..22" + Chr$(13)
  5504.     m$ = m$ + "..22..22" + Chr$(13)
  5505.     arrTileText(216) = m$
  5506.  
  5507.     m$ = ""
  5508.     m$ = m$ + "22..22.." + Chr$(13)
  5509.     m$ = m$ + "2..22..2" + Chr$(13)
  5510.     m$ = m$ + "..22..22" + Chr$(13)
  5511.     m$ = m$ + ".22..22." + Chr$(13)
  5512.     m$ = m$ + "22..22.." + Chr$(13)
  5513.     m$ = m$ + "2..22..2" + Chr$(13)
  5514.     m$ = m$ + "..22..22" + Chr$(13)
  5515.     m$ = m$ + ".22..22." + Chr$(13)
  5516.     arrTileText(217) = m$
  5517.  
  5518.     m$ = ""
  5519.     m$ = m$ + "......22" + Chr$(13)
  5520.     m$ = m$ + "......22" + Chr$(13)
  5521.     m$ = m$ + "......22" + Chr$(13)
  5522.     m$ = m$ + "......22" + Chr$(13)
  5523.     m$ = m$ + "......22" + Chr$(13)
  5524.     m$ = m$ + "......22" + Chr$(13)
  5525.     m$ = m$ + "......22" + Chr$(13)
  5526.     m$ = m$ + "......22" + Chr$(13)
  5527.     arrTileText(218) = m$
  5528.  
  5529.     m$ = ""
  5530.     m$ = m$ + "...22..." + Chr$(13)
  5531.     m$ = m$ + "...22..." + Chr$(13)
  5532.     m$ = m$ + "...22..." + Chr$(13)
  5533.     m$ = m$ + "...22222" + Chr$(13)
  5534.     m$ = m$ + "...22222" + Chr$(13)
  5535.     m$ = m$ + "...22..." + Chr$(13)
  5536.     m$ = m$ + "...22..." + Chr$(13)
  5537.     m$ = m$ + "...22..." + Chr$(13)
  5538.     arrTileText(219) = m$
  5539.  
  5540.     m$ = ""
  5541.     m$ = m$ + "........" + Chr$(13)
  5542.     m$ = m$ + "........" + Chr$(13)
  5543.     m$ = m$ + "........" + Chr$(13)
  5544.     m$ = m$ + "........" + Chr$(13)
  5545.     m$ = m$ + "....2222" + Chr$(13)
  5546.     m$ = m$ + "....2222" + Chr$(13)
  5547.     m$ = m$ + "....2222" + Chr$(13)
  5548.     m$ = m$ + "....2222" + Chr$(13)
  5549.     arrTileText(220) = m$
  5550.  
  5551.     m$ = ""
  5552.     m$ = m$ + "...22..." + Chr$(13)
  5553.     m$ = m$ + "...22..." + Chr$(13)
  5554.     m$ = m$ + "...22..." + Chr$(13)
  5555.     m$ = m$ + "...22222" + Chr$(13)
  5556.     m$ = m$ + "...22222" + Chr$(13)
  5557.     m$ = m$ + "........" + Chr$(13)
  5558.     m$ = m$ + "........" + Chr$(13)
  5559.     m$ = m$ + "........" + Chr$(13)
  5560.     arrTileText(221) = m$
  5561.  
  5562.     m$ = ""
  5563.     m$ = m$ + "........" + Chr$(13)
  5564.     m$ = m$ + "........" + Chr$(13)
  5565.     m$ = m$ + "........" + Chr$(13)
  5566.     m$ = m$ + "22222..." + Chr$(13)
  5567.     m$ = m$ + "22222..." + Chr$(13)
  5568.     m$ = m$ + "...22..." + Chr$(13)
  5569.     m$ = m$ + "...22..." + Chr$(13)
  5570.     m$ = m$ + "...22..." + Chr$(13)
  5571.     arrTileText(222) = m$
  5572.  
  5573.     m$ = ""
  5574.     m$ = m$ + "........" + Chr$(13)
  5575.     m$ = m$ + "........" + Chr$(13)
  5576.     m$ = m$ + "........" + Chr$(13)
  5577.     m$ = m$ + "........" + Chr$(13)
  5578.     m$ = m$ + "........" + Chr$(13)
  5579.     m$ = m$ + "........" + Chr$(13)
  5580.     m$ = m$ + "22222222" + Chr$(13)
  5581.     m$ = m$ + "22222222" + Chr$(13)
  5582.     arrTileText(223) = m$
  5583.  
  5584.     m$ = ""
  5585.     m$ = m$ + "........" + Chr$(13)
  5586.     m$ = m$ + "........" + Chr$(13)
  5587.     m$ = m$ + "........" + Chr$(13)
  5588.     m$ = m$ + "...22222" + Chr$(13)
  5589.     m$ = m$ + "...22222" + Chr$(13)
  5590.     m$ = m$ + "...22..." + Chr$(13)
  5591.     m$ = m$ + "...22..." + Chr$(13)
  5592.     m$ = m$ + "...22..." + Chr$(13)
  5593.     arrTileText(224) = m$
  5594.  
  5595.     m$ = ""
  5596.     m$ = m$ + "...22..." + Chr$(13)
  5597.     m$ = m$ + "...22..." + Chr$(13)
  5598.     m$ = m$ + "...22..." + Chr$(13)
  5599.     m$ = m$ + "22222222" + Chr$(13)
  5600.     m$ = m$ + "22222222" + Chr$(13)
  5601.     m$ = m$ + "........" + Chr$(13)
  5602.     m$ = m$ + "........" + Chr$(13)
  5603.     m$ = m$ + "........" + Chr$(13)
  5604.     arrTileText(225) = m$
  5605.  
  5606.     m$ = ""
  5607.     m$ = m$ + "........" + Chr$(13)
  5608.     m$ = m$ + "........" + Chr$(13)
  5609.     m$ = m$ + "........" + Chr$(13)
  5610.     m$ = m$ + "22222222" + Chr$(13)
  5611.     m$ = m$ + "22222222" + Chr$(13)
  5612.     m$ = m$ + "...22..." + Chr$(13)
  5613.     m$ = m$ + "...22..." + Chr$(13)
  5614.     m$ = m$ + "...22..." + Chr$(13)
  5615.     arrTileText(226) = m$
  5616.  
  5617.     m$ = ""
  5618.     m$ = m$ + "...22..." + Chr$(13)
  5619.     m$ = m$ + "...22..." + Chr$(13)
  5620.     m$ = m$ + "...22..." + Chr$(13)
  5621.     m$ = m$ + "22222..." + Chr$(13)
  5622.     m$ = m$ + "22222..." + Chr$(13)
  5623.     m$ = m$ + "...22..." + Chr$(13)
  5624.     m$ = m$ + "...22..." + Chr$(13)
  5625.     m$ = m$ + "...22..." + Chr$(13)
  5626.     arrTileText(227) = m$
  5627.  
  5628.     m$ = ""
  5629.     m$ = m$ + "22......" + Chr$(13)
  5630.     m$ = m$ + "22......" + Chr$(13)
  5631.     m$ = m$ + "22......" + Chr$(13)
  5632.     m$ = m$ + "22......" + Chr$(13)
  5633.     m$ = m$ + "22......" + Chr$(13)
  5634.     m$ = m$ + "22......" + Chr$(13)
  5635.     m$ = m$ + "22......" + Chr$(13)
  5636.     m$ = m$ + "22......" + Chr$(13)
  5637.     arrTileText(228) = m$
  5638.  
  5639.     m$ = ""
  5640.     m$ = m$ + "222....." + Chr$(13)
  5641.     m$ = m$ + "222....." + Chr$(13)
  5642.     m$ = m$ + "222....." + Chr$(13)
  5643.     m$ = m$ + "222....." + Chr$(13)
  5644.     m$ = m$ + "222....." + Chr$(13)
  5645.     m$ = m$ + "222....." + Chr$(13)
  5646.     m$ = m$ + "222....." + Chr$(13)
  5647.     m$ = m$ + "222....." + Chr$(13)
  5648.     arrTileText(229) = m$
  5649.  
  5650.     m$ = ""
  5651.     m$ = m$ + ".....222" + Chr$(13)
  5652.     m$ = m$ + ".....222" + Chr$(13)
  5653.     m$ = m$ + ".....222" + Chr$(13)
  5654.     m$ = m$ + ".....222" + Chr$(13)
  5655.     m$ = m$ + ".....222" + Chr$(13)
  5656.     m$ = m$ + ".....222" + Chr$(13)
  5657.     m$ = m$ + ".....222" + Chr$(13)
  5658.     m$ = m$ + ".....222" + Chr$(13)
  5659.     arrTileText(230) = m$
  5660.  
  5661.     m$ = ""
  5662.     m$ = m$ + "22222222" + Chr$(13)
  5663.     m$ = m$ + "22222222" + Chr$(13)
  5664.     m$ = m$ + "........" + Chr$(13)
  5665.     m$ = m$ + "........" + Chr$(13)
  5666.     m$ = m$ + "........" + Chr$(13)
  5667.     m$ = m$ + "........" + Chr$(13)
  5668.     m$ = m$ + "........" + Chr$(13)
  5669.     m$ = m$ + "........" + Chr$(13)
  5670.     arrTileText(231) = m$
  5671.  
  5672.     m$ = ""
  5673.     m$ = m$ + "22222222" + Chr$(13)
  5674.     m$ = m$ + "22222222" + Chr$(13)
  5675.     m$ = m$ + "22222222" + Chr$(13)
  5676.     m$ = m$ + "........" + Chr$(13)
  5677.     m$ = m$ + "........" + Chr$(13)
  5678.     m$ = m$ + "........" + Chr$(13)
  5679.     m$ = m$ + "........" + Chr$(13)
  5680.     m$ = m$ + "........" + Chr$(13)
  5681.     arrTileText(232) = m$
  5682.  
  5683.     m$ = ""
  5684.     m$ = m$ + "........" + Chr$(13)
  5685.     m$ = m$ + "........" + Chr$(13)
  5686.     m$ = m$ + "........" + Chr$(13)
  5687.     m$ = m$ + "........" + Chr$(13)
  5688.     m$ = m$ + "........" + Chr$(13)
  5689.     m$ = m$ + "22222222" + Chr$(13)
  5690.     m$ = m$ + "22222222" + Chr$(13)
  5691.     m$ = m$ + "22222222" + Chr$(13)
  5692.     arrTileText(233) = m$
  5693.  
  5694.     m$ = ""
  5695.     m$ = m$ + ".......2" + Chr$(13)
  5696.     m$ = m$ + "......22" + Chr$(13)
  5697.     m$ = m$ + ".....22." + Chr$(13)
  5698.     m$ = m$ + ".22.22.." + Chr$(13)
  5699.     m$ = m$ + ".2222..." + Chr$(13)
  5700.     m$ = m$ + ".222...." + Chr$(13)
  5701.     m$ = m$ + ".22....." + Chr$(13)
  5702.     m$ = m$ + "........" + Chr$(13)
  5703.     arrTileText(234) = m$
  5704.  
  5705.     m$ = ""
  5706.     m$ = m$ + "........" + Chr$(13)
  5707.     m$ = m$ + "........" + Chr$(13)
  5708.     m$ = m$ + "........" + Chr$(13)
  5709.     m$ = m$ + "........" + Chr$(13)
  5710.     m$ = m$ + "2222...." + Chr$(13)
  5711.     m$ = m$ + "2222...." + Chr$(13)
  5712.     m$ = m$ + "2222...." + Chr$(13)
  5713.     m$ = m$ + "2222...." + Chr$(13)
  5714.     arrTileText(235) = m$
  5715.  
  5716.     m$ = ""
  5717.     m$ = m$ + "....2222" + Chr$(13)
  5718.     m$ = m$ + "....2222" + Chr$(13)
  5719.     m$ = m$ + "....2222" + Chr$(13)
  5720.     m$ = m$ + "....2222" + Chr$(13)
  5721.     m$ = m$ + "........" + Chr$(13)
  5722.     m$ = m$ + "........" + Chr$(13)
  5723.     m$ = m$ + "........" + Chr$(13)
  5724.     m$ = m$ + "........" + Chr$(13)
  5725.     arrTileText(236) = m$
  5726.  
  5727.     m$ = ""
  5728.     m$ = m$ + "...22..." + Chr$(13)
  5729.     m$ = m$ + "...22..." + Chr$(13)
  5730.     m$ = m$ + "...22..." + Chr$(13)
  5731.     m$ = m$ + "22222..." + Chr$(13)
  5732.     m$ = m$ + "22222..." + Chr$(13)
  5733.     m$ = m$ + "........" + Chr$(13)
  5734.     m$ = m$ + "........" + Chr$(13)
  5735.     m$ = m$ + "........" + Chr$(13)
  5736.     arrTileText(237) = m$
  5737.  
  5738.     m$ = ""
  5739.     m$ = m$ + "2222...." + Chr$(13)
  5740.     m$ = m$ + "2222...." + Chr$(13)
  5741.     m$ = m$ + "2222...." + Chr$(13)
  5742.     m$ = m$ + "2222...." + Chr$(13)
  5743.     m$ = m$ + "........" + Chr$(13)
  5744.     m$ = m$ + "........" + Chr$(13)
  5745.     m$ = m$ + "........" + Chr$(13)
  5746.     m$ = m$ + "........" + Chr$(13)
  5747.     arrTileText(238) = m$
  5748.  
  5749.     m$ = ""
  5750.     m$ = m$ + "2222...." + Chr$(13)
  5751.     m$ = m$ + "2222...." + Chr$(13)
  5752.     m$ = m$ + "2222...." + Chr$(13)
  5753.     m$ = m$ + "2222...." + Chr$(13)
  5754.     m$ = m$ + "....2222" + Chr$(13)
  5755.     m$ = m$ + "....2222" + Chr$(13)
  5756.     m$ = m$ + "....2222" + Chr$(13)
  5757.     m$ = m$ + "....2222" + Chr$(13)
  5758.     arrTileText(239) = m$
  5759.  
  5760.     m$ = ""
  5761.     m$ = m$ + "........" + Chr$(13)
  5762.     m$ = m$ + "........" + Chr$(13)
  5763.     m$ = m$ + "........" + Chr$(13)
  5764.     m$ = m$ + "........" + Chr$(13)
  5765.     m$ = m$ + "........" + Chr$(13)
  5766.     m$ = m$ + "........" + Chr$(13)
  5767.     m$ = m$ + "........" + Chr$(13)
  5768.     m$ = m$ + "........" + Chr$(13)
  5769.     arrTileText(240) = m$
  5770.  
  5771.     m$ = ""
  5772.     m$ = m$ + "22222.22" + Chr$(13)
  5773.     m$ = m$ + "22222.22" + Chr$(13)
  5774.     m$ = m$ + "22222.22" + Chr$(13)
  5775.     m$ = m$ + "........" + Chr$(13)
  5776.     m$ = m$ + "22.22222" + Chr$(13)
  5777.     m$ = m$ + "22.22222" + Chr$(13)
  5778.     m$ = m$ + "22.22222" + Chr$(13)
  5779.     m$ = m$ + "........" + Chr$(13)
  5780.     arrTileText(241) = m$
  5781.  
  5782.     m$ = ""
  5783.     m$ = m$ + "........" + Chr$(13)
  5784.     m$ = m$ + "........" + Chr$(13)
  5785.     m$ = m$ + "........" + Chr$(13)
  5786.     m$ = m$ + ".222222." + Chr$(13)
  5787.     m$ = m$ + "........" + Chr$(13)
  5788.     m$ = m$ + "........" + Chr$(13)
  5789.     m$ = m$ + "........" + Chr$(13)
  5790.     m$ = m$ + "........" + Chr$(13)
  5791.     arrTileText(242) = m$
  5792.  
  5793.     m$ = ""
  5794.     m$ = m$ + "........" + Chr$(13)
  5795.     m$ = m$ + "...2...." + Chr$(13)
  5796.     m$ = m$ + "...2...." + Chr$(13)
  5797.     m$ = m$ + "...2...." + Chr$(13)
  5798.     m$ = m$ + "...2...." + Chr$(13)
  5799.     m$ = m$ + "...2...." + Chr$(13)
  5800.     m$ = m$ + "...2...." + Chr$(13)
  5801.     m$ = m$ + "........" + Chr$(13)
  5802.     arrTileText(243) = m$
  5803.  
  5804.     m$ = ""
  5805.     m$ = m$ + "........" + Chr$(13)
  5806.     m$ = m$ + "........" + Chr$(13)
  5807.     m$ = m$ + "........" + Chr$(13)
  5808.     m$ = m$ + "...2222." + Chr$(13)
  5809.     m$ = m$ + "...2...." + Chr$(13)
  5810.     m$ = m$ + "...2...." + Chr$(13)
  5811.     m$ = m$ + "...2...." + Chr$(13)
  5812.     m$ = m$ + "........" + Chr$(13)
  5813.     arrTileText(244) = m$
  5814.  
  5815.     m$ = ""
  5816.     m$ = m$ + "........" + Chr$(13)
  5817.     m$ = m$ + "........" + Chr$(13)
  5818.     m$ = m$ + "........" + Chr$(13)
  5819.     m$ = m$ + ".222...." + Chr$(13)
  5820.     m$ = m$ + "...2...." + Chr$(13)
  5821.     m$ = m$ + "...2...." + Chr$(13)
  5822.     m$ = m$ + "...2...." + Chr$(13)
  5823.     m$ = m$ + "........" + Chr$(13)
  5824.     arrTileText(245) = m$
  5825.  
  5826.     m$ = ""
  5827.     m$ = m$ + "........" + Chr$(13)
  5828.     m$ = m$ + "...2...." + Chr$(13)
  5829.     m$ = m$ + "...2...." + Chr$(13)
  5830.     m$ = m$ + "...2222." + Chr$(13)
  5831.     m$ = m$ + "........" + Chr$(13)
  5832.     m$ = m$ + "........" + Chr$(13)
  5833.     m$ = m$ + "........" + Chr$(13)
  5834.     m$ = m$ + "........" + Chr$(13)
  5835.     arrTileText(246) = m$
  5836.  
  5837.     m$ = ""
  5838.     m$ = m$ + "........" + Chr$(13)
  5839.     m$ = m$ + "...2...." + Chr$(13)
  5840.     m$ = m$ + "...2...." + Chr$(13)
  5841.     m$ = m$ + ".222...." + Chr$(13)
  5842.     m$ = m$ + "........" + Chr$(13)
  5843.     m$ = m$ + "........" + Chr$(13)
  5844.     m$ = m$ + "........" + Chr$(13)
  5845.     m$ = m$ + "........" + Chr$(13)
  5846.     arrTileText(247) = m$
  5847.  
  5848.     m$ = ""
  5849.     m$ = m$ + "........" + Chr$(13)
  5850.     m$ = m$ + "........" + Chr$(13)
  5851.     m$ = m$ + "........" + Chr$(13)
  5852.     m$ = m$ + "........" + Chr$(13)
  5853.     m$ = m$ + "........" + Chr$(13)
  5854.     m$ = m$ + "........" + Chr$(13)
  5855.     m$ = m$ + "........" + Chr$(13)
  5856.     m$ = m$ + "........" + Chr$(13)
  5857.     arrTileText(248) = m$
  5858.  
  5859.     m$ = ""
  5860.     m$ = m$ + "........" + Chr$(13)
  5861.     m$ = m$ + "........" + Chr$(13)
  5862.     m$ = m$ + "........" + Chr$(13)
  5863.     m$ = m$ + "........" + Chr$(13)
  5864.     m$ = m$ + "........" + Chr$(13)
  5865.     m$ = m$ + "........" + Chr$(13)
  5866.     m$ = m$ + "........" + Chr$(13)
  5867.     m$ = m$ + "........" + Chr$(13)
  5868.     arrTileText(249) = m$
  5869.  
  5870.     m$ = ""
  5871.     m$ = m$ + "........" + Chr$(13)
  5872.     m$ = m$ + "........" + Chr$(13)
  5873.     m$ = m$ + "........" + Chr$(13)
  5874.     m$ = m$ + "........" + Chr$(13)
  5875.     m$ = m$ + "........" + Chr$(13)
  5876.     m$ = m$ + "........" + Chr$(13)
  5877.     m$ = m$ + "........" + Chr$(13)
  5878.     m$ = m$ + "........" + Chr$(13)
  5879.     arrTileText(250) = m$
  5880.  
  5881.     m$ = ""
  5882.     m$ = m$ + "........" + Chr$(13)
  5883.     m$ = m$ + "........" + Chr$(13)
  5884.     m$ = m$ + "........" + Chr$(13)
  5885.     m$ = m$ + "........" + Chr$(13)
  5886.     m$ = m$ + "........" + Chr$(13)
  5887.     m$ = m$ + "........" + Chr$(13)
  5888.     m$ = m$ + "........" + Chr$(13)
  5889.     m$ = m$ + "........" + Chr$(13)
  5890.     arrTileText(251) = m$
  5891.  
  5892.     m$ = ""
  5893.     m$ = m$ + "2.2.2.2." + Chr$(13)
  5894.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  5895.     m$ = m$ + "2.2.2.2." + Chr$(13)
  5896.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  5897.     m$ = m$ + "2.2.2.2." + Chr$(13)
  5898.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  5899.     m$ = m$ + "2.2.2.2." + Chr$(13)
  5900.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  5901.     arrTileText(252) = m$
  5902.  
  5903.     m$ = ""
  5904.     m$ = m$ + "22222222" + Chr$(13)
  5905.     m$ = m$ + "2......2" + Chr$(13)
  5906.     m$ = m$ + "2......2" + Chr$(13)
  5907.     m$ = m$ + "2......2" + Chr$(13)
  5908.     m$ = m$ + "2......2" + Chr$(13)
  5909.     m$ = m$ + "2......2" + Chr$(13)
  5910.     m$ = m$ + "2......2" + Chr$(13)
  5911.     m$ = m$ + "22222222" + Chr$(13)
  5912.     arrTileText(253) = m$
  5913.  
  5914.     m$ = ""
  5915.     m$ = m$ + "22222222" + Chr$(13)
  5916.     m$ = m$ + "22222222" + Chr$(13)
  5917.     m$ = m$ + "22222222" + Chr$(13)
  5918.     m$ = m$ + "22222222" + Chr$(13)
  5919.     m$ = m$ + "22222222" + Chr$(13)
  5920.     m$ = m$ + "22222222" + Chr$(13)
  5921.     m$ = m$ + "22222222" + Chr$(13)
  5922.     m$ = m$ + "22222222" + Chr$(13)
  5923.     arrTileText(254) = m$
  5924.  
  5925.     m$ = ""
  5926.     m$ = ""
  5927.     m$ = m$ + "22....22" + Chr$(13)
  5928.     m$ = m$ + "2..22..2" + Chr$(13)
  5929.     m$ = m$ + "2..22..2" + Chr$(13)
  5930.     m$ = m$ + "22.....2" + Chr$(13)
  5931.     m$ = m$ + "22222..2" + Chr$(13)
  5932.     m$ = m$ + "2..22..2" + Chr$(13)
  5933.     m$ = m$ + "22....22" + Chr$(13)
  5934.     m$ = m$ + "22222222" + Chr$(13)
  5935.     arrTileText(255) = m$
  5936.  
  5937. End Sub ' GetTileText
  5938.  
  5939. ' ################################################################################################################################################################
  5940. ' END TILE DEFINITIONS
  5941. ' ################################################################################################################################################################
  5942.  
  5943. ' ################################################################################################################################################################
  5944. ' BEGIN COLOR FUNCTIONS
  5945. ' ################################################################################################################################################################
  5946. Function cWhite~& ()
  5947.     cWhite = _RGB32(255, 255, 255)
  5948. End Function ' cWhite~&
  5949.  
  5950. Function cEmpty~& ()
  5951.     cEmpty = _RGB32(0, 0, 0, 0)
  5952. End Function ' cEmpty~&
  5953.  
  5954. Function cBlack~& ()
  5955.     cBlack = _RGB32(0, 0, 0)
  5956. End Function ' cBlack~&
  5957.  
  5958. Function cRed~& ()
  5959.     cRed = _RGB32(255, 0, 0)
  5960.  
  5961. Function cYellow~& ()
  5962.     cYellow = _RGB32(255, 255, 0)
  5963. End Function ' cYellow~&
  5964.  
  5965. Function cLime~& ()
  5966.     cLime = _RGB32(0, 255, 0)
  5967. End Function ' cLime~&
  5968.  
  5969. Function cCyan~& ()
  5970.     cCyan = _RGB32(0, 255, 255)
  5971. End Function ' cCyan~&
  5972.  
  5973. Function cBlue~& ()
  5974.     cBlue = _RGB32(0, 0, 255)
  5975. End Function ' cBlue~&
  5976.  
  5977. Function cPurple~& ()
  5978.     cPurple = _RGB32(128, 0, 255)
  5979. End Function ' cPurple~&
  5980.  
  5981. Function cMagenta~& ()
  5982.     cMagenta = _RGB32(255, 0, 255)
  5983. End Function ' cMagenta~&
  5984.  
  5985. Function cOrange~& ()
  5986.     cOrange = _RGB32(255, 165, 0)
  5987. End Function ' cOrange~&
  5988.  
  5989. Function cGray~& ()
  5990.     cGray = _RGB32(128, 128, 128)
  5991. End Function ' cGray~&
  5992. ' ################################################################################################################################################################
  5993. ' END COLOR FUNCTIONS
  5994. ' ################################################################################################################################################################
  5995.  
  5996. ' ################################################################################################################################################################
  5997. ' BEGIN GENERAL PURPOSE ROUTINES
  5998. ' ################################################################################################################################################################
  5999.  
  6000. ' /////////////////////////////////////////////////////////////////////////////
  6001. ' See also StringTo2dArray
  6002.  
  6003. Function Array2dToString$ (MyArray() As String)
  6004.     Dim MyString As String
  6005.     Dim iY As Integer
  6006.     Dim iX As Integer
  6007.     Dim sLine As String
  6008.     MyString = ""
  6009.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  6010.         sLine = ""
  6011.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  6012.             sLine = sLine + MyArray(iY, iX)
  6013.         Next iX
  6014.         MyString = MyString + sLine + Chr$(13)
  6015.     Next iY
  6016.     Array2dToString$ = MyString
  6017. End Function ' Array2dToString$
  6018.  
  6019. ' /////////////////////////////////////////////////////////////////////////////
  6020.  
  6021. 'Function Array2dToStringTest$ (MyArray() As String)
  6022. '    Dim MyString As String
  6023. '    Dim iY As Integer
  6024. '    Dim iX As Integer
  6025. '    Dim sLine As String
  6026. '    MyString = ""
  6027. '    MyString = MyString + "           11111111112222222222333" + Chr$(13)
  6028. '    MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  6029. '    For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  6030. '        sLine = ""
  6031. '        sLine = sLine + Right$("  " + cstr$(iY), 2)
  6032. '        For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  6033. '            sLine = sLine + MyArray(iY, iX)
  6034. '        Next iX
  6035. '        sLine = sLine + Right$("  " + cstr$(iY), 2)
  6036. '        MyString = MyString + sLine + Chr$(13)
  6037. '    Next iY
  6038. '    MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  6039. '    MyString = MyString + "           11111111112222222222333" + Chr$(13)
  6040. '    Array2dToStringTest$ = MyString
  6041. 'End Function ' Array2dToStringTest$
  6042.  
  6043. ' /////////////////////////////////////////////////////////////////////////////
  6044.  
  6045. Function cstr$ (myValue)
  6046.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  6047.     cstr$ = _Trim$(Str$(myValue))
  6048. End Function ' cstr$
  6049.  
  6050. ' /////////////////////////////////////////////////////////////////////////////
  6051. ' Simple timestamp function
  6052.  
  6053. Function CurrentDateTime$
  6054.     CurrentDateTime$ = Mid$(Date$, 7, 4) + "-" + _
  6055.         Mid$(Date$, 1, 5) + " " + _
  6056.         Time$
  6057. End Function ' CurrentDateTime$
  6058.  
  6059. ' /////////////////////////////////////////////////////////////////////////////
  6060. ' Receives an {sDelim} delimited list {sInput}
  6061. ' returns the list with all duplicate entries removed.
  6062.  
  6063. Function DedupeDelimList$ (sInput As String, sDelim As String)
  6064.     ReDim arrLines(-1) As String
  6065.     Dim sOutput As String
  6066.     Dim iLoop As Integer
  6067.  
  6068.     split sInput, sDelim, arrLines()
  6069.     sOutput = sDelim
  6070.     For iLoop = LBound(arrLines) To UBound(arrLines)
  6071.         If InStr(1, sOutput, sDelim + arrLines(iLoop) + sDelim) = 0 Then
  6072.             sOutput = sOutput + arrLines(iLoop) + sDelim
  6073.         End If
  6074.     Next iLoop
  6075.  
  6076.     DedupeDelimList$ = sOutput
  6077. End Function ' DedupeDelimList$
  6078.  
  6079. ' /////////////////////////////////////////////////////////////////////////////
  6080. ' Use with timer functions to avoid "after midnight" bug.
  6081.  
  6082. ' Re: how to time something (ie do loop for n seconds)
  6083. ' https://qb64forum.alephc.xyz/index.php?topic=4682.0
  6084.  
  6085. ' SMcNeill, QB64 Developer
  6086. ' « Reply #1 on: Today at 11:26:52 am »
  6087. '
  6088. ' One caveat here:  You *can* experience bugs with this after midnight.
  6089. '
  6090. ' Program starts at 23:59:59.
  6091. ' Add three seconds -- 24:00:02...  (In seconds, and not hours and minutes like this, though hours and minutes are easier to visualize.)
  6092. ' Clock hits midnight:  0:00:00
  6093. '
  6094. ' At no point will you ever have TIMER become greater than t#.
  6095. '
  6096. ' If you're going to have a program which might run into this issue,
  6097. ' I'd suggest just plugging in my ExtendedTimer and use it instead:
  6098. '
  6099. ' Most of us write time code to test little snippets for which method might
  6100. ' be faster for us while we're coding.  The clock resetting on us isn't
  6101. ' normally such a big deal.  When it is, however, all you have to do is
  6102. ' swap to the ExtendedTimer function [below]
  6103. '
  6104. ' Returns a value for you based off DAY + TIME, rather than just time alone!
  6105. ' No midnight clock issues with something like that in our programs.  ;)
  6106.  
  6107. ' Usage:
  6108. '     ' DO SOMETHING FOR 3 SECONDS
  6109. '     t# = ExtendedTimer + 3
  6110. '     Do
  6111. '         '(SOMETHING)
  6112. '     Loop Until Timer > t#
  6113.  
  6114. Function ExtendedTimer##
  6115.     d$ = Date$
  6116.     l = InStr(d$, "-")
  6117.     l1 = InStr(l + 1, d$, "-")
  6118.     m = Val(Left$(d$, l))
  6119.     d = Val(Mid$(d$, l + 1))
  6120.     y = Val(Mid$(d$, l1 + 1)) - 1970
  6121.     For i = 1 To m
  6122.         Select Case i 'Add the number of days for each previous month passed
  6123.             Case 1: d = d 'January doestn't have any carry over days.
  6124.             Case 2, 4, 6, 8, 9, 11: d = d + 31
  6125.             Case 3: d = d + 28
  6126.             Case 5, 7, 10, 12: d = d + 30
  6127.         End Select
  6128.     Next
  6129.     For i = 1 To y
  6130.         d = d + 365
  6131.     Next
  6132.     For i = 2 To y Step 4
  6133.         If m > 2 Then d = d + 1 'add an extra day for leap year every 4 years, starting in 1970
  6134.     Next
  6135.     d = d - 1 'for year 2000
  6136.     s~&& = d * 24 * 60 * 60 'Seconds are days * 24 hours * 60 minutes * 60 seconds
  6137.     ExtendedTimer## = (s~&& + Timer)
  6138. End Function ' ExtendedTimer##
  6139.  
  6140. ' /////////////////////////////////////////////////////////////////////////////
  6141. ' Receives a {sDelimeter} delimited list of numbers {MyString}
  6142. ' and splits it up into an integer array arrInteger()
  6143. ' beginning at index {iMinIndex}.
  6144.  
  6145. Sub GetIntegerArrayFromDelimList (MyString As String, sDelimiter As String, iMinIndex As Integer, arrInteger() As Integer)
  6146.     ReDim arrString(-1) As String
  6147.     Dim CleanString As String
  6148.     Dim iLoop As Integer
  6149.     Dim iCount As Integer: iCount = iMinIndex - 1
  6150.  
  6151.     ReDim arrInteger(-1) As Integer
  6152.  
  6153.     'DebugPrint "GetIntegerArrayFromDelimList " + _
  6154.     '    "MyString=" + chr$(34) + MyString + chr$(34) + ", " + _
  6155.     '    "sDelimiter=" + chr$(34) + sDelimiter + chr$(34) + ", " + _
  6156.     '    "iMinIndex=" + cstr$(iMinIndex) + ", " + _
  6157.     '    "arrInteger()"
  6158.  
  6159.  
  6160.     If Len(sDelimiter) > 0 Then
  6161.         CleanString = MyString
  6162.         If sDelimiter <> " " Then
  6163.             CleanString = Replace$(CleanString, " ", "")
  6164.         End If
  6165.  
  6166.         split CleanString, sDelimiter, arrString()
  6167.         iCount = iMinIndex - 1
  6168.         For iLoop = LBound(arrString) To UBound(arrString)
  6169.             If IsNum%(arrString(iLoop)) = TRUE Then
  6170.                 iCount = iCount + 1
  6171.                 ReDim _Preserve arrInteger(iMinIndex To iCount) As Integer
  6172.                 arrInteger(iCount) = Val(arrString(iLoop))
  6173.                 'DebugPrint "5633 arrInteger(" + cstr$(iCount) + ") = VAL(arrString(" + cstr$(iLoop) + ")) = " + cstr$(arrInteger(iCount))
  6174.  
  6175.             End If
  6176.         Next iLoop
  6177.     Else
  6178.         If IsNum%(MyString) = TRUE Then
  6179.             ReDim _Preserve arrInteger(iMinIndex To iMinIndex) As Integer
  6180.             arrInteger(iMinIndex) = Val(MyString)
  6181.         End If
  6182.     End If
  6183.  
  6184.     'CleanString=""
  6185.     'for iLoop=lbound(arrInteger) to ubound(arrInteger)
  6186.     'CleanString = CleanString + iifstr$(iLoop=lbound(arrInteger), "", ",") + cstr$(arrInteger(iLoop))
  6187.     'next iLoop
  6188.     'DebugPrint "arrInteger=(" + CleanString + ")"
  6189.  
  6190. End Sub ' GetIntegerArrayFromDelimList
  6191.  
  6192. ' /////////////////////////////////////////////////////////////////////////////
  6193.  
  6194. Function IIF (Condition, IfTrue, IfFalse)
  6195.     If Condition Then IIF = IfTrue Else IIF = IfFalse
  6196.  
  6197. ' /////////////////////////////////////////////////////////////////////////////
  6198.  
  6199. Function IIFSTR$ (Condition, IfTrue$, IfFalse$)
  6200.     If Condition Then IIFSTR$ = IfTrue$ Else IIFSTR$ = IfFalse$
  6201.  
  6202. ' /////////////////////////////////////////////////////////////////////////////
  6203. ' By sMcNeill from https://www.qb64.org/forum/index.php?topic=896.0
  6204.  
  6205. Function IsNum% (text$)
  6206.     Dim a$
  6207.     Dim b$
  6208.     a$ = _Trim$(text$)
  6209.     b$ = _Trim$(Str$(Val(text$)))
  6210.     If a$ = b$ Then
  6211.         IsNum% = TRUE
  6212.     Else
  6213.         IsNum% = FALSE
  6214.     End If
  6215. End Function ' IsNum%
  6216.  
  6217. ' /////////////////////////////////////////////////////////////////////////////
  6218. ' Does a _PrintString at the specified row+column.
  6219.  
  6220. ' iRow and iCol are 0-based.
  6221.  
  6222. Sub PrintString (iRow As Integer, iCol As Integer, MyString As String)
  6223.     Dim iX As Integer
  6224.     Dim iY As Integer
  6225.     iX = _FontWidth * iCol
  6226.     iY = _FontHeight * iRow ' (iRow + 1)
  6227.     _PrintString (iX, iY), MyString
  6228. End Sub ' PrintString
  6229.  
  6230. ' /////////////////////////////////////////////////////////////////////////////
  6231. ' Does a _PrintString at the specified row+column.
  6232.  
  6233. ' iRow and iCol are 1-based.
  6234.  
  6235. Sub PrintString1 (iRow As Integer, iCol As Integer, MyString As String)
  6236.     Dim iX As Integer
  6237.     Dim iY As Integer
  6238.     iX = _FontWidth * (iCol - 1)
  6239.     iY = _FontHeight * (iRow - 1)
  6240.     _PrintString (iX, iY), MyString
  6241. End Sub ' PrintString1
  6242.  
  6243. ' /////////////////////////////////////////////////////////////////////////////
  6244. ' FROM: String Manipulation
  6245. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  6246. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  6247. '
  6248. 'SUMMARY:
  6249. '   Purpose:  A library of custom functions that transform strings.
  6250. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  6251. '   Platform: QB64 (www.qb64.org)
  6252. '   Revision: 1.6
  6253. '   Updated:  5/28/2012
  6254.  
  6255. 'SUMMARY:
  6256. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  6257. 'INPUT:
  6258. 'Text: The input string; the text that's being manipulated.
  6259. 'Find: The specified sub-string; the string sought within the [Text] string.
  6260. 'Add: The sub-string that's being added to the [Text] string.
  6261.  
  6262. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  6263.     ' VARIABLES:
  6264.     Dim Text2 As String
  6265.     Dim Find2 As String
  6266.     Dim Add2 As String
  6267.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  6268.     Dim strBefore As String ' The characters before the string to be replaced.
  6269.     Dim strAfter As String ' The characters after the string to be replaced.
  6270.  
  6271.     ' INITIALIZE:
  6272.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  6273.     Text2 = Text1
  6274.     Find2 = Find1
  6275.     Add2 = Add1
  6276.  
  6277.     lngLocation = InStr(1, Text2, Find2)
  6278.  
  6279.     ' PROCESSING:
  6280.     ' While [Find2] appears in [Text2]...
  6281.     While lngLocation
  6282.         ' Extract all Text2 before the [Find2] substring:
  6283.         strBefore = Left$(Text2, lngLocation - 1)
  6284.  
  6285.         ' Extract all text after the [Find2] substring:
  6286.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  6287.  
  6288.         ' Return the substring:
  6289.         Text2 = strBefore + Add2 + strAfter
  6290.  
  6291.         ' Locate the next instance of [Find2]:
  6292.         lngLocation = InStr(1, Text2, Find2)
  6293.  
  6294.         ' Next instance of [Find2]...
  6295.     Wend
  6296.  
  6297.     ' OUTPUT:
  6298.     Replace$ = Text2
  6299. End Function ' Replace$
  6300.  
  6301. ' /////////////////////////////////////////////////////////////////////////////
  6302. ' Split and join strings
  6303. ' https://www.qb64.org/forum/index.php?topic=1073.0
  6304. '
  6305. ' FROM luke, QB64 Developer
  6306. ' Date: February 15, 2019, 04:11:07 AM
  6307. '
  6308. ' Given a string of words separated by spaces (or any other character),
  6309. ' splits it into an array of the words. I've no doubt many people have
  6310. ' written a version of this over the years and no doubt there's a million
  6311. ' ways to do it, but I thought I'd put mine here so we have at least one
  6312. ' version. There's also a join function that does the opposite
  6313. ' array -> single string.
  6314. '
  6315. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  6316. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  6317.  
  6318. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  6319. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  6320. '
  6321. 'delimiter$ must be one character long.
  6322. 'result$() must have been REDIMmed previously.
  6323.  
  6324. ' Modified to handle multi-character delimiters
  6325.  
  6326. Sub split (in$, delimiter$, result$())
  6327.     Dim start As Integer
  6328.     Dim finish As Integer
  6329.     Dim iDelimLen As Integer
  6330.     ReDim result$(-1)
  6331.  
  6332.     iDelimLen = Len(delimiter$)
  6333.  
  6334.     start = 1
  6335.     Do
  6336.         'While Mid$(in$, start, 1) = delimiter$
  6337.         While Mid$(in$, start, iDelimLen) = delimiter$
  6338.             'start = start + 1
  6339.             start = start + iDelimLen
  6340.             If start > Len(in$) Then
  6341.                 Exit Sub
  6342.             End If
  6343.         Wend
  6344.         finish = InStr(start, in$, delimiter$)
  6345.         If finish = 0 Then
  6346.             finish = Len(in$) + 1
  6347.         End If
  6348.  
  6349.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  6350.  
  6351.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  6352.         start = finish + 1
  6353.     Loop While start <= Len(in$)
  6354. End Sub ' split
  6355.  
  6356. ' /////////////////////////////////////////////////////////////////////////////
  6357. ' Converts a chr$(13) delimited string
  6358. ' into a 2-dimensional array.
  6359.  
  6360. ' Usage:
  6361. ' Dim StringArray(1 To 48, 1 To 128) As String
  6362. ' StringTo2dArray StringArray(), GetMap$
  6363.  
  6364. ' Version 2 with indexed array(row, columm)
  6365. ' Renamed StringToArray to StringTo2dArray.
  6366.  
  6367. ' See also: Array2dToString$
  6368.  
  6369. Sub StringTo2dArray (MyArray() As String, MyString As String)
  6370.     Dim sDelim As String
  6371.     ReDim arrLines(0) As String
  6372.     Dim iRow As Integer
  6373.     Dim iCol As Integer
  6374.     Dim sChar As String
  6375.     Dim iDim1 As Integer
  6376.     Dim iDim2 As Integer
  6377.     Dim iIndex1 As Integer
  6378.     Dim iIndex2 As Integer
  6379.  
  6380.     iDim1 = LBound(MyArray, 1)
  6381.     iDim2 = LBound(MyArray, 2)
  6382.     sDelim = Chr$(13)
  6383.     split MyString, sDelim, arrLines()
  6384.     For iRow = LBound(arrLines) To UBound(arrLines)
  6385.         If iRow <= UBound(MyArray, 1) Then
  6386.             For iCol = 1 To Len(arrLines(iRow))
  6387.                 If iCol <= UBound(MyArray, 2) Then
  6388.                     sChar = Mid$(arrLines(iRow), iCol, 1)
  6389.  
  6390.                     If Len(sChar) > 1 Then
  6391.                         sChar = Left$(sChar, 1)
  6392.                     Else
  6393.                         If Len(sChar) = 0 Then
  6394.                             sChar = "."
  6395.                         End If
  6396.                     End If
  6397.  
  6398.                     iIndex1 = iRow + iDim1
  6399.                     iIndex2 = (iCol - 1) + iDim2
  6400.                     MyArray(iIndex1, iIndex2) = sChar
  6401.                     'DebugPrint "MyArray(" + cstr$(iIndex1) + ", " + cstr$(iIndex2) + " = " + chr$(34) + sChar + chr$(34)
  6402.                 Else
  6403.                     ' Exit if out of bounds
  6404.                     Exit For
  6405.                 End If
  6406.             Next iCol
  6407.         Else
  6408.             ' Exit if out of bounds
  6409.             Exit For
  6410.         End If
  6411.     Next iRow
  6412. End Sub ' StringTo2dArray
  6413.  
  6414. ' /////////////////////////////////////////////////////////////////////////////
  6415.  
  6416. Function TrueFalse$ (myValue)
  6417.     If myValue = TRUE Then
  6418.         TrueFalse$ = "TRUE"
  6419.     Else
  6420.         TrueFalse$ = "FALSE"
  6421.     End If
  6422. End Function ' TrueFalse$
  6423.  
  6424. ' ################################################################################################################################################################
  6425. ' END GENERAL PURPOSE ROUTINES
  6426. ' ################################################################################################################################################################
  6427.  
  6428. ' ################################################################################################################################################################
  6429. ' BEGIN HARDWARE IMAGES DEMO #2 (WORKS)
  6430. ' ################################################################################################################################################################
  6431.  
  6432. ' /////////////////////////////////////////////////////////////////////////////
  6433. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  6434. ' https://qb64forum.alephc.xyz/index.php?topic=4674.0
  6435.  
  6436. ' madscijr
  6437. ' « Reply #5 on: Yesterday at 09:46:53 pm »
  6438.  
  6439. ' Quote from: SMcNeill on Yesterday at 07:56:57 pm:
  6440. ' Hardware images basically get their speed by being a sort of "Write Only"
  6441. ' method for images. You can make them, you can put them on the screen,
  6442. ' but you can't edit them or read information back from them.
  6443. ' ...
  6444. ' 2) You don't have to specify where they show up as a destination with putimage.
  6445. ' ...
  6446. ' If you have any specific questions, feel free to ask them and I'll do my
  6447. ' best to answer for you, if I can.  ;)
  6448. '
  6449. ' Thanks for taking the time to explain all that. When I'm back at the PC,
  6450. ' I'll try out your example.
  6451. '
  6452. ' For now, just one question: if you can't read information from them or even
  6453. ' specify where on the destination they go, how are they even useful?
  6454. ' Maybe it will click when I run your example or read up on it, but I just
  6455. ' don't see what the use of an image would be if you can't control where on
  6456. ' the screen it is drawn? Or how it would help speed up drawing a map of
  6457. ' colored tiles to the screen.
  6458. '
  6459. ' Thanks again...
  6460.  
  6461. ' SMcNeill, QB64 Developer
  6462. ' « Reply #6 on: Today at 01:14:28 am »
  6463. '
  6464. ' Try this out and see if it doesn't help answer your questions:
  6465.  
  6466. Sub HardwareImageDemo2
  6467.     $Color:32
  6468.     Display = _NewImage(1024, 720, 32)
  6469.     Software = _NewImage(1024, 720, 32)
  6470.  
  6471.     Screen Display
  6472.     Print "First, let's create a normal sortware screen and fill it with 40x40 tiles of random colors."
  6473.     Print "Press <ANY KEY> to view this screen."
  6474.     Sleep
  6475.  
  6476.     _Dest Software
  6477.     For y = 0 To 720 Step 40
  6478.         For x = 0 To 1024 Step 40
  6479.             Line (x, y)-Step(40, 40), &HFF000000 + Rnd * &HFFFFFF, BF
  6480.         Next
  6481.     Next
  6482.  
  6483.     _Dest Display
  6484.     _PutImage , Software
  6485.     Print
  6486.     Print "As you can see, this is a simple software screen."
  6487.     Print "Now, I'm going to copy that software screen and make it a hardware screen."
  6488.     Print "Press <ANY KEY> for me to do so!"
  6489.     Sleep
  6490.  
  6491.     Hardware = _CopyImage(Software, 33)
  6492.     Cls
  6493.     Print "Now, I'm back to my blank screen, but I now have a hardware screen to work with."
  6494.     Print
  6495.     Print "To keep things simple, let's showcase the differences between using _putimage with a software screen, and then with the hardware screen."
  6496.     Print
  6497.     Print "First, the software screen!  Press <ANY KEY> to continue."
  6498.     Sleep
  6499.  
  6500.     _PutImage (0, 100)-Step(100, 100), Software, Display, (0, 0)-(40, 40)
  6501.     Print "As you can see, all I did here was copy a single tile from the software screen and then scale it to fit upon the current screen."
  6502.     Print
  6503.     Print "Press <ANY KEY> to continue, as I'll now do the same with a hardware image."
  6504.  
  6505.     _PutImage (200, 100)-Step(100, 100), Hardware, , (0, 0)-(40, 40)
  6506.     Print
  6507.     Print "As you can see from the above, we have the same tile copied and scaled onto the screen, just to the right of the software image."
  6508.     Print
  6509.     Print "Doesn't really seem to be very different at all, now does it?"
  6510.     Print
  6511.     Print "Press <ANY KEY> to continue."
  6512.     _Display
  6513.     Sleep
  6514.  
  6515.     Print
  6516.     Color Red
  6517.     Print "BUT WAIT A MOMENT!!  What the heck happened to our hardware tile??!!??"
  6518.     Color White
  6519.     Print
  6520.     Print "It's no longer on the screen, as it was previously.  Why??"
  6521.     Print
  6522.     Print "Because it was never on the software screen at all, but was instead on it's own hardware layer ABOVE the software screen."
  6523.     Print
  6524.     Print "Hardware images only display ONCE, once _DISPLAY is called, and then they flush from the graphics buffer."
  6525.     Print "Draw.  Display.  Flush.  <-- that's the basic process of how a hardware image works."
  6526.     Print
  6527.     Print "If we want one to remain on the screen, we have to do it either by:"
  6528.     Print "1) Not updating the screen after we draw and display the image, as I did above with the tile I displayed."
  6529.     Print "2) Refresh displaying the image in our main loop (which is what we do even with software images for most games and such)."
  6530.     Print
  6531.     Print "Press <ANY KEY> to continue."
  6532.     Sleep
  6533.  
  6534.     Cls
  6535.     Print
  6536.     Print "So, as you can see, hardware images have a few drawbacks to them, with the most obvious being they only display once,"
  6537.     Print "then flush from memory.  If you want persistant hardware images, they're best used in a loop."
  6538.     Print
  6539.     Print "But, if they've got drawbacks, then one has to ask, 'What's the advantages to using them?'"
  6540.     Print "Press <ANY KEY> to find out!"
  6541.     Sleep
  6542.  
  6543.     't# = ExtendedTimer + 3
  6544.     t# = Timer + 3
  6545.     Do
  6546.         count = count + 1
  6547.         _PutImage (0, 100)-Step(100, 100), Software, Display, (x, y)-Step(40, 40)
  6548.         x = x + 40
  6549.         If x > 1024 Then x = 0: y = y + 40
  6550.         If y > 720 Then x = 0: y = 0
  6551.         _Display
  6552.     Loop Until Timer > t#
  6553.  
  6554.     Print "See lots of flashing tiles on the screen for the last three seconds?"
  6555.     Print "That was us using _PUTIMAGE with the software screen, and we put"; count; "tiles on the screen in those 3 seconds."
  6556.     Print
  6557.     Print "Now press <ANY KEY> and we'll do the exact same thing with hardware images."
  6558.     Sleep
  6559.  
  6560.     count = 0: x = 0: y = 0
  6561.     t# = Timer + 3
  6562.     tempScreen = _CopyImage(Display, 33)
  6563.     Do
  6564.         count = count + 1
  6565.         _PutImage , tempScreen
  6566.         _PutImage (300, 100)-Step(100, 100), Hardware, , (x, y)-Step(40, 40)
  6567.         x = x + 40
  6568.         If x > 1024 Then x = 0: y = y + 40
  6569.         If y > 720 Then x = 0: y = 0
  6570.         _Display
  6571.     Loop Until Timer > t#
  6572.  
  6573.     _FreeImage tempScreen
  6574.     Print
  6575.     Print "Didn't seem very different at the rate of which we were running things, now did it?"
  6576.     Print "Would you be surprised to find out that we put"; count * 2; "hardware images on the screen in those same 3 seconds?"
  6577.     Print
  6578.     Print "And if you look close, I counted each loop twice, as we didn't just put the hardware image to the screen, but also a"
  6579.     Print "complete copy of the original software screen as well!"
  6580.     Print
  6581.     Print "The reason why I did this?"
  6582.     Print
  6583.     Print "So I could completely elimimate all software iamges and JUST work with the much faster hardware layer!"
  6584.     Print
  6585.     Print "Press <ANY KEY> to continue"
  6586.     Sleep
  6587.  
  6588.     Cls
  6589.     Print "So, as you can see, hardware images are multiple times faster to display and render than software images."
  6590.     Print
  6591.     Print "But here's something else for you to notice -- I'm going to update the screen with constant, limitless tile refeshes."
  6592.     Print "To start with, I'm going to do this in a LOOP with the software images."
  6593.     Print "CTRL-TAB out of this demo program, open your task manager, and see how much memory and CPU processing power the program uses."
  6594.     Print "Then TAB back to this program and hit <ESC> to do the same with the hardware images."
  6595.  
  6596.     Do
  6597.         _PutImage (0, 100)-(1024, 720), Software, Display, (x, y)-Step(40, 40)
  6598.         x = x + 40
  6599.         If x > 1024 Then x = 0: y = y + 40
  6600.         If y > 720 Then x = 0: y = 0
  6601.         _Limit 60
  6602.         _Display
  6603.     Loop Until _KeyDown(27)
  6604.  
  6605.     Cls , 0
  6606.     Print "PRESS <SPACE BAR> to stop the hardware iamges!!"
  6607.     tempImage = _CopyImage(Display, 33)
  6608.     x = 0: y = 0
  6609.     Do
  6610.         _PutImage , tempImage
  6611.         _PutImage (0, 100)-(1023, 719), Hardware, , (x, y)-Step(40, 40)
  6612.         x = x + 40
  6613.         If x > 1024 Then x = 0: y = y + 40
  6614.         If y > 720 Then x = 0: y = 0
  6615.         _Limit 60
  6616.         _Display
  6617.     Loop Until _KeyDown(32)
  6618.  
  6619.     Cls
  6620.     Print "On my laptop, these two methods use the following amounts of CPU power:"
  6621.     Print "Software, 60 FPS -- 3% CPU"
  6622.     Print "Hardware, 60 FPS -- 0.1% CPU"
  6623.     Print
  6624.     Print "If I go in and change the limits to something much higher, these are the results (test them for yourselves, please):"
  6625.     Print "Software, 600 FPS -- 10.3% CPU"
  6626.     Print "Hardware, 600 FPS -- 0.1% CPU"
  6627.     Print
  6628.     Print
  6629.     Print "So, as you can see, the disadvantage to hardware images are they display once, then flush from memory."
  6630.     Print
  6631.     Print "While the advantages to their usage is MUCH faster processing times, and an immense reduction on CPU usage.  (The GPU picks up the work for us!)"
  6632.     Print
  6633.     Print
  6634.     Print "You basically use them just like you would any other normal image, though you have to keep in mind that they render"
  6635.     Print "to their own hardware layer, which you can specify to go on below or above your software screen."
  6636.     Print
  6637.     Print "(Or, you can _DISPLAYORDER _HARDWARE and *only* display the hardware layer, removing software rendering completely!)"
  6638.     Print
  6639.     Print "And THAT, my friends, is basically the lowdown on hardware vs software images.  ;)"
  6640.     Print
  6641.     Print
  6642.     Print "And this was another Steve(tm) Tutorial!  Enjoy!!"
  6643. End Sub ' HardwareImageDemo2
  6644.  
  6645. ' ################################################################################################################################################################
  6646. ' END HARDWARE IMAGES DEMO #2 (WORKS)
  6647. ' ################################################################################################################################################################
  6648.  
  6649. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6650. ' BEGIN DEBUGGING ROUTINES #DEBUGGING
  6651. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6652.  
  6653. Sub DebugPrint (MyString As String)
  6654.     If m_bDebug = TRUE Then
  6655.         '_Echo MyString
  6656.  
  6657.         ReDim arrLines(-1) As String
  6658.         Dim iLoop As Integer
  6659.         split MyString, Chr$(13), arrLines()
  6660.         For iLoop = LBound(arrLines) To UBound(arrLines)
  6661.             _Echo arrLines(iLoop)
  6662.         Next iLoop
  6663.     End If
  6664. End Sub ' DebugPrint
  6665.  
  6666. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6667. ' END DEBUGGING ROUTINES @DEBUGGING
  6668. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6669.  
  6670. ' ################################################################################################################################################################
  6671. ' BEGIN MENU HELPER ROUTINES
  6672. ' ################################################################################################################################################################
  6673.  
  6674. ' /////////////////////////////////////////////////////////////////////////////
  6675.  
  6676. Sub ShowInstructions (in$)
  6677.     Dim iLoop As Integer
  6678.     Dim iCount As Integer: iCount = 0
  6679.     Dim iRows As Integer: iRows = _Height(0) '\ _FontHeight ' GET # OF AVAILABLE TEXT ROWS
  6680.     ReDim arrLines(-1) As String
  6681.     Cls
  6682.     split in$, Chr$(13), arrLines() ' SPLIT OUTPUT INTO LINES
  6683.     For iLoop = LBound(arrLines) To UBound(arrLines)
  6684.         Print arrLines(iLoop)
  6685.         iCount = iCount + 1
  6686.         If iCount > (iRows - 5) Then
  6687.             'INPUT "PRESS <ENTER> TO CONTINUE"; in$
  6688.             Sleep
  6689.             iCount = 0
  6690.         End If
  6691.     Next iLoop
  6692.     Print
  6693.     Input "PRESS <ENTER> TO CONTINUE"; in$
  6694. End Sub ' ShowInstructions
  6695.  
  6696. ' ################################################################################################################################################################
  6697. ' END MENU HELPER ROUTINES
  6698. ' ################################################################################################################################################################
  6699.  
  6700.  
  6701. ' ################################################################################################################################################################
  6702. ' BEGIN Steve's very different custom screen
  6703. ' ################################################################################################################################################################
  6704.  
  6705. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  6706. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  6707.  
  6708. ' SMcNeill, QB64 Developer
  6709. ' Reply #18 on: Yesterday at 05:08:58 pm
  6710. '
  6711. ' One thing that would be *very* different with all hardware images vs what
  6712. ' you're doing currently, is the fact that you have to remember:
  6713. ' Hardware images display once and then flush themselves from the GPU buffer.
  6714. '
  6715. ' You can't just print to a tile, and then read the information for the color of
  6716. ' that tile, and instantly turn that color into another one.  You have write
  6717. ' access to hardware images, but not read access -- and the images aren't
  6718. ' persistent like the software images are.
  6719. '
  6720. ' For something like this to work for a whole screen in hardware image mode,
  6721. ' you'd have to sort out some sort of way to store your screen's info and then
  6722. ' constantly redraw everything over and over again to keep it refreshed on the
  6723. ' display.
  6724. '
  6725. ' The way I'd go about doing something like this would be to make myself a
  6726. ' custom SCREEN 0-style memory array.  Screen 0 stores all our information for
  6727. ' each character in 2 bytes -- one for color, one for character.  I'd basically
  6728. ' do the same, but with 3 bytes -- one for tile color, one for font color, one
  6729. ' for character.
  6730. '
  6731. ' Let me toss a simple demo of this line of thinking for you:
  6732. ' (TestCustomHardwareScreen1)
  6733. '
  6734. ' I tried to comment the heck out of the code to help explain what it's doing
  6735. ' from line to line, so I hope this isn't too hard to sort out and understand.
  6736. '
  6737. ' The beginning is nothing more than initializing things and making 2 different
  6738. ' sprite sheets that I'll make use of later -- one for the tiles and one for the
  6739. ' characters.
  6740. '
  6741. ' Then there's the mid section where you can SLEEP step through and view the
  6742. ' various resource sheets.
  6743. '
  6744. ' Then an example of all the characters in a cyan font, resting atop a red tile.
  6745. ' (You have to hit ENTER to move on from this screen.)
  6746. '
  6747. ' Then an example of all those tiles that go under the characters being replaced
  6748. ' with sequential colored tiles.  (A lot of these tiles are simply BLACK, but
  6749. ' that's the nature of the 256 color palette as those multiple blacks are there
  6750. ' to be replaced with custom color values instead.)
  6751. '
  6752. ' Once more, you'll have to hit ENTER to continue.
  6753. '
  6754. ' And then I do a quick time loop to count how many times we can redraw the whole
  6755. ' screen of tiles + characters in 3 seconds.
  6756. '
  6757. ' For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of
  6758. ' about 1800 refreshes in that time.  That's around 600 FPS, which would be more
  6759. ' than enough for any sort of game display or use that I think I could come up
  6760. ' with, and that's without me trying to optimize math or any such things to
  6761. ' reduce calculations and speed the process up any more.  (Keep in mind, this is
  6762. ' 1800 full pages of a 800x600 screen -- if your screen has a lower overall
  6763. ' resolution, then you'd draw more loops with less to process, but a higher
  6764. ' resolution screen would draw fewer loops with more to process.)
  6765. '
  6766. ' No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page
  6767. ' of tiles and colored characters.  (And, YES, it is a whole page being rendered
  6768. ' repeatedly -- even if I didn't bother to fill in the vast majority of that page
  6769. ' with anything more than black tiles, black fonts, and chr$(0) blank spaces...)
  6770. '
  6771. ' It's a completely different approach to displaying stuff than what you've been
  6772. ' doing, but it seems as if what you've been doing isn't working as it must be
  6773. ' running too slow for you.  You wouldn't be able to use the normal PRINT
  6774. ' statements to display to the faux screen memory array I've created; you'd have
  6775. ' to write your own.
  6776. '
  6777. ' For a quick speed comparison, here's the same type process ran using PRINT
  6778. ' and a software screen of the same size:
  6779. ' (TestSoftwareScreen1)
  6780.  
  6781. ' /////////////////////////////////////////////////////////////////////////////
  6782.  
  6783. Function GetInstructions1$
  6784.     Dim in$
  6785.     in$ = ""
  6786.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + Chr$(13)
  6787.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + Chr$(13)
  6788.     in$ = in$ + " " + Chr$(13)
  6789.     in$ = in$ + "SMcNeill, QB64 Developer" + Chr$(13)
  6790.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + Chr$(13)
  6791.     in$ = in$ + " " + Chr$(13)
  6792.     in$ = in$ + "One thing that would be *very* different with all hardware images vs what " + Chr$(13)
  6793.     in$ = in$ + "you're doing currently, is the fact that you have to remember:  " + Chr$(13)
  6794.     in$ = in$ + "Hardware images display once and then flush themselves from the GPU buffer. " + Chr$(13)
  6795.     in$ = in$ + " " + Chr$(13)
  6796.     in$ = in$ + "You can't just print to a tile, and then read the information for the color of " + Chr$(13)
  6797.     in$ = in$ + "that tile, and instantly turn that color into another one.  You have write " + Chr$(13)
  6798.     in$ = in$ + "access to hardware images, but not read access -- and the images aren't " + Chr$(13)
  6799.     in$ = in$ + "persistent like the software images are." + Chr$(13)
  6800.     in$ = in$ + " " + Chr$(13)
  6801.     in$ = in$ + "For something like this to work for a whole screen in hardware image mode, " + Chr$(13)
  6802.     in$ = in$ + "you'd have to sort out some sort of way to store your screen's info and then " + Chr$(13)
  6803.     in$ = in$ + "constantly redraw everything over and over again to keep it refreshed on the " + Chr$(13)
  6804.     in$ = in$ + "display." + Chr$(13)
  6805.     in$ = in$ + " " + Chr$(13)
  6806.     in$ = in$ + "The way I'd go about doing something like this would be to make myself a " + Chr$(13)
  6807.     in$ = in$ + "custom SCREEN 0-style memory array.  Screen 0 stores all our information for " + Chr$(13)
  6808.     in$ = in$ + "each character in 2 bytes -- one for color, one for character.  I'd basically " + Chr$(13)
  6809.     in$ = in$ + "do the same, but with 3 bytes -- one for tile color, one for font color, one " + Chr$(13)
  6810.     in$ = in$ + "for character." + Chr$(13)
  6811.     in$ = in$ + " " + Chr$(13)
  6812.     in$ = in$ + "Let me toss a simple demo of this line of thinking for you:" + Chr$(13)
  6813.     in$ = in$ + " " + Chr$(13)
  6814.     in$ = in$ + "I tried to comment the heck out of the code to help explain what it's doing " + Chr$(13)
  6815.     in$ = in$ + "from line to line, so I hope this isn't too hard to sort out and understand." + Chr$(13)
  6816.     in$ = in$ + " " + Chr$(13)
  6817.     in$ = in$ + "The beginning is nothing more than initializing things and making 2 different " + Chr$(13)
  6818.     in$ = in$ + "sprite sheets that I'll make use of later -- one for the tiles and one for the " + Chr$(13)
  6819.     in$ = in$ + "characters." + Chr$(13)
  6820.     in$ = in$ + " " + Chr$(13)
  6821.     in$ = in$ + "Then there's the mid section where you can SLEEP step through and view the " + Chr$(13)
  6822.     in$ = in$ + "various resource sheets." + Chr$(13)
  6823.     in$ = in$ + " " + Chr$(13)
  6824.     in$ = in$ + "Then an example of all the characters in a cyan font, resting atop a red tile.  " + Chr$(13)
  6825.     in$ = in$ + "(You have to hit ENTER to move on from this screen.)" + Chr$(13)
  6826.     in$ = in$ + " " + Chr$(13)
  6827.     in$ = in$ + "Then an example of all those tiles that go under the characters being replaced " + Chr$(13)
  6828.     in$ = in$ + "with sequential colored tiles.  (A lot of these tiles are simply BLACK, but " + Chr$(13)
  6829.     in$ = in$ + "that's the nature of the 256 color palette as those multiple blacks are there " + Chr$(13)
  6830.     in$ = in$ + "to be replaced with custom color values instead.)" + Chr$(13)
  6831.     in$ = in$ + " " + Chr$(13)
  6832.     in$ = in$ + "Once more, you'll have to hit ENTER to continue." + Chr$(13)
  6833.     in$ = in$ + " " + Chr$(13)
  6834.     in$ = in$ + "And then I do a quick time loop to count how many times we can redraw the whole " + Chr$(13)
  6835.     in$ = in$ + "screen of tiles + characters in 3 seconds." + Chr$(13)
  6836.     in$ = in$ + " " + Chr$(13)
  6837.     in$ = in$ + "For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of " + Chr$(13)
  6838.     in$ = in$ + "about 1800 refreshes in that time.  That's around 600 FPS, which would be more " + Chr$(13)
  6839.     in$ = in$ + "than enough for any sort of game display or use that I think I could come up " + Chr$(13)
  6840.     in$ = in$ + "with, and that's without me trying to optimize math or any such things to " + Chr$(13)
  6841.     in$ = in$ + "reduce calculations and speed the process up any more.  (Keep in mind, this is " + Chr$(13)
  6842.     in$ = in$ + "1800 full pages of a 800x600 screen -- if your screen has a lower overall " + Chr$(13)
  6843.     in$ = in$ + "resolution, then you'd draw more loops with less to process, but a higher " + Chr$(13)
  6844.     in$ = in$ + "resolution screen would draw fewer loops with more to process.)" + Chr$(13)
  6845.     in$ = in$ + " " + Chr$(13)
  6846.     in$ = in$ + "No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page " + Chr$(13)
  6847.     in$ = in$ + "of tiles and colored characters.  (And, YES, it is a whole page being rendered " + Chr$(13)
  6848.     in$ = in$ + "repeatedly -- even if I didn't bother to fill in the vast majority of that page " + Chr$(13)
  6849.     in$ = in$ + "with anything more than black tiles, black fonts, and chr$(0) blank spaces...)" + Chr$(13)
  6850.     in$ = in$ + " " + Chr$(13)
  6851.     in$ = in$ + "It's a completely different approach to displaying stuff than what you've been " + Chr$(13)
  6852.     in$ = in$ + "doing, but it seems as if what you've been doing isn't working as it must be " + Chr$(13)
  6853.     in$ = in$ + "running too slow for you.  You wouldn't be able to use the normal PRINT " + Chr$(13)
  6854.     in$ = in$ + "statements to display to the faux screen memory array I've created; you'd have " + Chr$(13)
  6855.     in$ = in$ + "to write your own." + Chr$(13)
  6856.     GetInstructions1$ = in$
  6857. End Function ' GetInstructions1$
  6858.  
  6859. ' /////////////////////////////////////////////////////////////////////////////
  6860.  
  6861. Function GetInstructions2$
  6862.     Dim in$
  6863.     in$ = ""
  6864.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + Chr$(13)
  6865.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + Chr$(13)
  6866.     in$ = in$ + " " + Chr$(13)
  6867.     in$ = in$ + "SMcNeill, QB64 Developer" + Chr$(13)
  6868.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + Chr$(13)
  6869.     in$ = in$ + " " + Chr$(13)
  6870.     in$ = in$ + "For a quick speed comparison, here's the same type process ran using PRINT " + Chr$(13)
  6871.     in$ = in$ + "and a software screen of the same size:" + Chr$(13)
  6872.     GetInstructions2$ = in$
  6873. End Function ' GetInstructions2$
  6874.  
  6875. ' ################################################################################################################################################################
  6876.  
  6877. ' /////////////////////////////////////////////////////////////////////////////
  6878.  
  6879. Sub TestCustomHardwareScreen1
  6880.     Dim in$
  6881.     Cls
  6882.     Print "Custom hardware screen test. Press <ENTER> to proceed through each step."
  6883.     Input "PRESS <ENTER> TO START"; in$
  6884.  
  6885.  
  6886.     Display = _NewImage(800, 600, 32) 'my main screenwich is 100 by 75 characters with 8x8 font.
  6887.     Tile = _NewImage(8 * 256, 8, 32) '8x8 tiles in 256 colors
  6888.     Font = _NewImage(8 * 256, 8 * 256, 32) '256 characters of an 8x8 font, in all 256 possible colors.
  6889.  
  6890.     Screen Display 'Set the main screen for starters so it'll go ahead and create itself properly while I'm working on making my tiles and fonts
  6891.  
  6892.     Dim As _Unsigned Long Kolors(255) 'an array to hold all my color values
  6893.     tempScreen256 = _NewImage(10, 10, 256) 'very tiny 256 color screen, just to borrow the palette from
  6894.     For i = 0 To 255 '40 colors
  6895.         Kolors(i) = _RGB32(_Red(i, tempScreen256), _Green(i, tempScreen256), _Blue(i, tempScreen256)) 'since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  6896.     Next
  6897.     _FreeImage tempScreen256 'free up all images once done with them
  6898.  
  6899.     _Dest Tile 'Create my software tiles of 256 colors
  6900.     For i = 0 To 255 '256 tiles, one for each color
  6901.         Line (i * 8, 0)-Step(8, 8), Kolors(i), BF 'all drawn sequentially onto a sprite sheet
  6902.     Next
  6903.  
  6904.     _Dest Font
  6905.     _Font 8 'I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  6906.     For k = 0 To 255 '256 colors
  6907.         Color Kolors(k), 0 'make our font the proper color
  6908.         For c = 0 To 255 '256 characters
  6909.             _PrintString (c * 8, k * 8), Chr$(c) 'print the characters row by row to the screen
  6910.         Next
  6911.     Next
  6912.     _Dest Display
  6913.  
  6914.     Sleep 'View the blank screen  until a key is hit
  6915.     Screen Tile 'View the tiles
  6916.     Sleep 'until a key is hit
  6917.     Screen Font 'view the fonts
  6918.     Sleep 'until a key is hit
  6919.     Screen Display 'and back to the normal blank screen
  6920.     _Delay .2 'time to remove finger from key
  6921.     'Dim Shared As Long TileHw, FontHw
  6922.  
  6923.     TileHw = _CopyImage(Tile, 33) 'hardware copy of the tile image
  6924.     FontHw = _CopyImage(Font, 33) 'hardware copy of the font image
  6925.  
  6926.     _FreeImage Tile 'free unused images when done with them
  6927.     _FreeImage Font 'free unused images when done with them
  6928.  
  6929.     _DisplayOrder _Hardware 'From this point onwards, I'm *ONLY* going to use my hardware layer
  6930.  
  6931.     'Dim Shared ScreenArray(99, 74) As _Unsigned Long 'Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  6932.  
  6933.     'To start with, let's put all 256 chracters on the screen, on a color 40 tile (red), in a color 3 font (cyan)
  6934.     For i = 0 To 255
  6935.         x = x + 1: If x > 99 Then x = 0: y = y + 1
  6936.         ScreenArray(x, y) = SetAll(40, 3, i) '40 tile color, 3 font color, i is the character
  6937.     Next
  6938.  
  6939.     Do 'And then let's show these results on the screen.  Take a moment to open task manager and see how little resources we're using here.
  6940.         ScreenRender 'Draw a whole screen full of these tiles + characters
  6941.         _Limit 30
  6942.     Loop Until _KeyDown(13) 'until we hit ENTER
  6943.  
  6944.     _Delay .2 'time to lift up the key so we don't instantly blow past the next loop
  6945.  
  6946.     x = 0: y = 0
  6947.     For i = 0 To 255 'and here I'm going to set all these tiles to have incremental background tile colors
  6948.         x = x + 1: If x > 99 Then x = 0: y = y + 1 'from left to right, top to bottom
  6949.         SetArrayTile x, y, i 'set each tile to become an ever increasing color value
  6950.     Next
  6951.  
  6952.     Do 'And then let's show these results on the screen.
  6953.         ScreenRender 'Draw a whole screen full of these tiles + characters
  6954.         _Limit 30
  6955.     Loop Until _KeyDown(13) 'until we hit ENTER
  6956.  
  6957.     'And to finish up, let's do a quick count of how many loops per second we *could* process, with the whole screen being redrawn over and over like this
  6958.     t## = Timer + 3
  6959.     Do
  6960.         count& = count& + 1
  6961.         ScreenRender
  6962.     Loop Until Timer > t##
  6963.  
  6964.  
  6965.  
  6966.     _KeyClear: _Delay 1
  6967.     Screen 0: Cls
  6968.     Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  6969.  
  6970.     Print
  6971.     Input "PRESS <ENTER> TO CONTINUE"; in$
  6972.  
  6973. End Sub ' TestCustomHardwareScreen1
  6974.  
  6975. ' /////////////////////////////////////////////////////////////////////////////
  6976.  
  6977. Sub ScreenRender
  6978.     Dim As _Unsigned Long tileColor, fontColor, character
  6979.     For x = 0 To 99
  6980.         For y = 0 To 74
  6981.             tileColor = ScreenArray(x, y) \ (256 * 256)
  6982.             fontColor = (ScreenArray(x, y) - tileColor * 256 * 256) \ 256
  6983.             character = ScreenArray(x, y) Mod 256
  6984.             _PutImage (x * 8, y * 8)-Step(7, 7), TileHw, , (tileColor * 8, 0)-Step(7, 7)
  6985.             _PutImage (x * 8, y * 8)-Step(7, 7), FontHw, , (character * 8, fontColor * 8)-Step(7, 7)
  6986.         Next
  6987.     Next
  6988.     _Display
  6989. End Sub ' ScreenRender
  6990.  
  6991. ' /////////////////////////////////////////////////////////////////////////////
  6992.  
  6993. Function SetAll&& (tile, fontcolor, character)
  6994.     SetAll&& = tile * 256 * 256 + fontcolor * 256 + character
  6995. End Function ' SetAll&&
  6996.  
  6997. ' /////////////////////////////////////////////////////////////////////////////
  6998.  
  6999. Sub SetArrayTile (x, y, newTileColor)
  7000.     temp&& = ScreenArray(x, y)
  7001.     oldTile&& = temp&& \ (256 * 256)
  7002.     ScreenArray(x, y) = temp&& - oldTile&& + newTileColor * 256 * 256
  7003. End Sub ' SetArrayTile
  7004.  
  7005. ' /////////////////////////////////////////////////////////////////////////////
  7006.  
  7007. Sub SetArrayFontColor (x, y, newFontColor)
  7008.     temp&& = ScreenArray(x, y)
  7009.     oldTile&& = temp&& \ (256 * 256)
  7010.     oldFont&& = (temp&& - oldTile&&) \ 256
  7011.     ScreenArray(x, y) = temp&& - oldFont&& + newFontColor * 256
  7012. End Sub ' SetArrayFontColor
  7013.  
  7014. ' /////////////////////////////////////////////////////////////////////////////
  7015.  
  7016. Sub SetArrayCharacter (x, y, newCharacter)
  7017.     temp&& = ScreenArray(x, y)
  7018.     oldCharacter&& = temp&& Mod 256
  7019.     ScreenArray(x, y) = temp&& - oldCharacter&& + newCharacter
  7020. End Sub ' SetArrayCharacter
  7021.  
  7022. ' /////////////////////////////////////////////////////////////////////////////
  7023.  
  7024. Sub TestSoftwareScreen1
  7025.     Dim in$
  7026.  
  7027.     Screen _NewImage(800, 600, 32)
  7028.  
  7029.     t## = Timer + 3
  7030.     _Font 8
  7031.     Do
  7032.         count = count + 1
  7033.         For x = 1 To 100
  7034.             For y = 1 To 75
  7035.                 c = (c + 1) Mod 256
  7036.                 Color _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
  7037.                 Locate y, x: Print Chr$(c);
  7038.             Next
  7039.         Next
  7040.     Loop Until Timer > t##
  7041.  
  7042.     _KeyClear: _Delay 1
  7043.     Screen 0: Cls
  7044.     Print count; "total screen replacements in 3 seconds."
  7045.     Print
  7046.     Input "PRESS <ENTER> TO CONTINUE"; in$
  7047. End Sub ' TestSoftwareScreen1
  7048.  
  7049. ' ################################################################################################################################################################
  7050. ' END Steve's very different custom screen
  7051. ' ################################################################################################################################################################
  7052.  
« Last Edit: March 04, 2022, 10:35:51 pm by madscijr »

Offline Gets

  • Newbie
  • Posts: 28
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #27 on: March 05, 2022, 01:55:44 pm »
Benefits of drawing rectangles should be greater with larger images, especially if they're designed with the format in mind. hardware boxes are also much faster when handling transparencies.

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
« Reply #28 on: March 21, 2022, 01:43:59 pm »
...
The way I'd  go about doing something like this would be to make myself a custom SCREEN 0-style memory array.  Screen 0 stores all our information for each character in 2 bytes -- one for color, one for character.  I'd basically do the same, but with 3 bytes -- one for tile color, one for font color, one for character.

Let me toss a simple demo of this line of thinking for you:
...

OK, I started studying your example (see Sub TestCustomHardwareScreen2 on line 624) and I am a little confused about what exactly is happening.

You use the word "tile" and the word "font", and it seems like a tile is just a square block of color, whereas the font is what I would call the tile.

Is your code just creating a giant image with the tileset drawn in all possible combinations of foreground/background color?

Or is it actually drawing the tiles in hardware and changing the colors on the fly?

If it's the former (create a giant image for all possible color combinations) then I got that working (menu option 1, test #8 in below code) and it's pretty fast (13,433 refreshes).

Code: QB64: [Select]
  1. ' ################################################################################################################################################################
  2. ' Speed tests and demos of various methods draw a 2-color 8x8 tile
  3.  
  4. ' From thread:
  5. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  6. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  7. ' ################################################################################################################################################################
  8.  
  9. ' ===============================================================================
  10. ' GLOBAL CONSTANTS
  11. ' ===============================================================================
  12. ' BOOLEAN VALUES
  13. Const FALSE = 0
  14. Const TRUE = Not FALSE
  15.  
  16. ' ===============================================================================
  17. ' USER DEFINED TYPES
  18. ' ===============================================================================
  19. ' UDT TO HOLD COORDINATES FOR DRAWING A RECTANGLE
  20. Type RectangleType
  21.     x1 As Integer ' start x
  22.     y1 As Integer ' start y
  23.     x2 As Integer ' end x
  24.     y2 As Integer ' end y
  25.     PixelCount As Integer
  26.     IsActive As Integer
  27. End Type ' RectangleType
  28.  
  29. Type DrawCompareType
  30.     IndexList As String
  31.     ShapeCount As Integer
  32.     PixelCount As Integer
  33.     IsActive As Integer
  34. End Type ' DrawCompareType
  35.  
  36. ' UDT FOR PRECALCULATED TILESHEET
  37. Type TileSheetMapType
  38.     xStart As Integer
  39.     xEnd As Integer
  40.     yStart As Integer
  41.     yEnd As Integer
  42.  
  43. ' UDT FOR PRECALCULATED TILE MAP
  44. Type TileMapType
  45.     xPos As Integer
  46.     yPos As Integer
  47.  
  48. ' ===============================================================================
  49. ' GLOBAL VARIABLES
  50. ' ===============================================================================
  51. Dim Shared m_bDebug As Integer: m_bDebug = TRUE ' ENABLES/DISABLES CONSOLE WINDOW AND DebugPrint
  52. Dim Shared m_ProgramPath$: m_ProgramPath$ = Left$(Command$(0), _InStrRev(Command$(0), "\"))
  53. Dim Shared m_ProgramName$: m_ProgramName$ = Mid$(Command$(0), _InStrRev(Command$(0), "\") + 1)
  54. Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  55.  
  56. ' Used for Steve's very different custom screen:
  57. Dim Shared m_TileHw As Long
  58. Dim Shared m_FontHw As Long
  59. Dim Shared m_ScreenArray(99, 74) As _Unsigned Long ' Here, I'm creating a screen array to hold the information of EVERY character I place onto the screen, and its tile
  60.  
  61. ' ===============================================================================
  62. ' LOCAL VARIABLES
  63. ' ===============================================================================
  64. Dim in$
  65.  
  66. ' ****************************************************************************************************************************************************************
  67. ' ACTIVATE DEBUGGING WINDOW
  68. If m_bDebug = TRUE Then
  69.     $Console
  70.     _Delay 4
  71.     _Console On
  72.     _Echo "Started " + m_ProgramName$
  73.     _Echo "Debugging on..."
  74. ' ****************************************************************************************************************************************************************
  75.  
  76. ' ===============================================================================
  77. ' START THE MAIN ROUTINE
  78. ' ===============================================================================
  79. main
  80.  
  81. ' ===============================================================================
  82. ' FINISH
  83. ' ===============================================================================
  84. Print m_ProgramName$ + " finished."
  85. Input "Press <ENTER> to continue", in$
  86. ' ****************************************************************************************************************************************************************
  87. ' DEACTIVATE DEBUGGING WINDOW
  88. If m_bDebug = TRUE Then
  89. ' ****************************************************************************************************************************************************************
  90. System ' return control to the operating system
  91.  
  92. ' ################################################################################################################################################################
  93. ' BEGIN MAIN MENU
  94. ' ################################################################################################################################################################
  95.  
  96. ' /////////////////////////////////////////////////////////////////////////////
  97.  
  98. Sub main
  99.     Dim RoutineName As String: RoutineName = "main"
  100.     Dim in$
  101.     Dim bFinished As Integer: bFinished = FALSE
  102.     Dim result$: result$ = ""
  103.     Do
  104.         Screen 0: _ScreenMove 0, 0
  105.         Cls
  106.         Print m_ProgramName$
  107.         Print
  108.         Print "RE: fastest way to draw a 2-color 8x8 tile (with variable colors)?"
  109.         Print
  110.  
  111.         Print "1) DrawingSpeedTest7"
  112.         Print
  113.         Print "2) HardwareImageDemo2"
  114.         Print
  115.         Print "3) GetAllPossibleShapesTest"
  116.         Print "4) FindOptimizedVectorTest - find minimum shapes to draw a tile"
  117.         Print "5) GetVectorTilesTest"
  118.         Print "6) MakePaletteImageTest"
  119.         Print "7) DrawVectorTilePutImageTest"
  120.         Print
  121.         Print "A) TestCustomHardwareScreen1"
  122.         Print "B) ^ instructions"
  123.         Print
  124.         Print "C) TestSoftwareScreen1"
  125.         Print "D) ^ instructions"
  126.  
  127.         Print "E) TestCustomHardwareScreen2"
  128.  
  129.         Print
  130.         Print "Q) Exit program"
  131.         Do
  132.             in$ = InKey$
  133.             If UCase$(in$) = "Q" Then
  134.                 bFinished = TRUE: Exit Do
  135.             ElseIf UCase$(in$) = "1" Then
  136.                 DrawingSpeedTest7: Exit Do
  137.             ElseIf UCase$(in$) = "2" Then
  138.                 HardwareImageDemo2: Exit Do
  139.             ElseIf UCase$(in$) = "3" Then
  140.                 GetAllPossibleShapesTest: Exit Do
  141.             ElseIf UCase$(in$) = "4" Then
  142.                 FindOptimizedVectorTest: Exit Do
  143.             ElseIf UCase$(in$) = "5" Then
  144.                 GetVectorTilesTest: Exit Do
  145.             ElseIf UCase$(in$) = "6" Then
  146.                 MakePaletteImageTest: Exit Do
  147.             ElseIf UCase$(in$) = "7" Then
  148.                 DrawVectorTilePutImageTest: Exit Do
  149.             ElseIf UCase$(in$) = "A" Then
  150.                 TestCustomHardwareScreen1: Exit Do
  151.             ElseIf UCase$(in$) = "B" Then
  152.                 ShowInstructions (GetInstructions1$): Exit Do
  153.             ElseIf UCase$(in$) = "C" Then
  154.                 TestSoftwareScreen1: Exit Do
  155.             ElseIf UCase$(in$) = "D" Then
  156.                 ShowInstructions (GetInstructions2$): Exit Do
  157.  
  158.             ElseIf UCase$(in$) = "E" Then
  159.                 TestCustomHardwareScreen2: Exit Do
  160.  
  161.             End If
  162.         Loop
  163.     Loop Until bFinished = TRUE
  164. End Sub ' main
  165.  
  166. ' ################################################################################################################################################################
  167. ' END MAIN MENU
  168. ' ################################################################################################################################################################
  169.  
  170. ' ################################################################################################################################################################
  171. ' BEGIN DRAWING SPEED TEST
  172. ' ################################################################################################################################################################
  173.  
  174. ' /////////////////////////////////////////////////////////////////////////////
  175.  
  176. Sub DrawingSpeedTest7
  177.     Dim sError As String: sError = ""
  178.     Dim imgScreen As Long ' the main display
  179.     Dim imgHardwareScreen As Long ' copy of the software screen, transformed into a hardware image
  180.     Dim imgTiles As Long ' original tileset, black on transparent
  181.     Dim imgHardwareTiles As Long ' copy of the tileset, tranformed into a hardware image
  182.     Dim imgTilesRed As Long ' colored tileset copy
  183.     Dim imgTilesGreen As Long ' colored tileset copy
  184.     Dim imgTilesBlue As Long ' colored tileset copy
  185.     Dim imgTilesYellow As Long ' colored tileset copy
  186.     Dim imgColorTiles As Long ' holds 4 copies of tileset in different colors (red, green, blue, yellow)
  187.     Dim imgTilesAllColorsSW As Long ' holds n copies of tileset in all combinations of specified foreground/background colors
  188.     Dim imgTilesAllColorsHW As Long ' copy of the tileset, tranformed into a hardware image
  189.  
  190.     Dim imgPalette As Long ' contains palette of colors
  191.     Dim imgPaletteHW As Long ' hardware image of palette of colors
  192.     Dim iTileNum As Integer
  193.     Dim iFgColorIndex As Integer: iFgColorIndex = 0
  194.     Dim iBgColorIndex As Integer: iBgColorIndex = 0
  195.     Dim iFirstColor As Integer: iFirstColor = 0
  196.     Dim iLastColor As Integer: iLastColor = 3
  197.     'Dim iCols As Integer
  198.     'Dim iRows As Integer
  199.     Dim iY As Integer
  200.     Dim iX As Integer
  201.     Dim fgColor As _Unsigned Long
  202.     Dim bgColor As _Unsigned Long
  203.     Dim iMinY As Integer
  204.     Dim iMaxY As Integer
  205.     Dim iMinX As Integer
  206.     Dim iMaxX As Integer
  207.     Dim iCount1 As Long
  208.     Dim iCount2 As Long
  209.     Dim iCount3 As Long
  210.     Dim iCount4 As Long
  211.     Dim iCount5 As Long
  212.     Dim iCount6 As Long
  213.     Dim iCount7 As Long
  214.     Dim iCount8 As Long
  215.     Dim t# ' for timer
  216.     Dim arrColor(0 To 5) As _Unsigned Long
  217.  
  218.     Dim arrColors(-1) As _Unsigned Long ' supported colors for COLORED TILESET COPIES v2
  219.     ReDim arrTileIndex(-1) As Long ' stores x positions for tiles (0-255) for COLORED TILESET COPIES v2
  220.     ReDim arrColorIndex(-1, -1) As Long ' stores y positions for (fgColorIndex, bgColorIndex) for COLORED TILESET COPIES v2
  221.     Dim iFirstColor2 As Integer
  222.     Dim iLastColor2 As Integer
  223.  
  224.     ' ================================================================================================================================================================
  225.     ' INIT SCREEN
  226.     ' ================================================================================================================================================================
  227.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  228.     Screen imgScreen
  229.     Cls , cGray
  230.  
  231.     'iCols = _Width(imgScreen) \ 8
  232.     'iRows = _Height(imgScreen) \ 8
  233.  
  234.     iMinX = 1: iMaxX = 16
  235.     iMinY = 3: iMaxY = 18
  236.  
  237.     ' ================================================================================================================================================================
  238.     ' INITIALIZE NEUTRAL COLOR GRAPHICS TILES (BLACK ON TRANSPARENT)
  239.     ' ================================================================================================================================================================
  240.     If Len(sError) = 0 Then
  241.         '' LOAD TILES (16 cols x 16 rows of 8x8 tiles) FROM FILE
  242.         'sFile$ = Left$(Command$(0), _InStrRev(Command$(0), "\")) + "Font_8x8_128x128_v3.png" ' 128x128 pixels, 16 rows x 16 columns of 8x8 tiles
  243.         'imgTiles = _LoadImage(sFile$, 32)
  244.  
  245.         ' LOAD TILES FROM TEXT DEFINITIONS IN Sub GetTileText
  246.         sError = GetTiles$(imgTiles, cBlack, cEmpty)
  247.     End If
  248.  
  249.     ' ================================================================================================================================================================
  250.     ' CREATE COLORED TILESET COPIES v1
  251.     ' ================================================================================================================================================================
  252.     If Len(sError) = 0 Then
  253.         MakeColoredTileset imgTiles, imgTilesRed, cRed, cBlack
  254.         MakeColoredTileset imgTiles, imgTilesGreen, cLime, cBlack
  255.         MakeColoredTileset imgTiles, imgTilesBlue, cBlue, cBlack
  256.         MakeColoredTileset imgTiles, imgTilesYellow, cYellow, cBlack
  257.  
  258.         ' Make one big tileset with all colors
  259.         imgColorTiles = _NewImage(512, 128, 32)
  260.         _PutImage (0, 0), imgTilesRed, imgColorTiles, (0, 0)-(128, 128)
  261.         _PutImage (128, 0), imgTilesGreen, imgColorTiles, (0, 0)-(128, 128)
  262.         _PutImage (256, 0), imgTilesBlue, imgColorTiles, (0, 0)-(128, 128)
  263.         _PutImage (384, 0), imgTilesYellow, imgColorTiles, (0, 0)-(128, 128)
  264.  
  265.         imgHardwareTiles = _CopyImage(imgColorTiles, 33) ' Copy tilesheet for hardware image
  266.     End If
  267.  
  268.     ' ================================================================================================================================================================
  269.     ' CREATE COLORED TILESET COPIES v2
  270.     ' ================================================================================================================================================================
  271.     If Len(sError) = 0 Then
  272.         'ReDim arrColors(0 To 4) As _UNSIGNED Long
  273.         'arrColors(0) = cRed
  274.         'arrColors(1) = cLime
  275.         'arrColors(2) = cBlue
  276.         'arrColors(3) = cYellow
  277.         'arrColors(4) = cBlack
  278.  
  279.         ReDim arrColors(0 To 39) As _Unsigned Long
  280.         arrColors(0) = cRed
  281.         arrColors(1) = cOrangeRed
  282.         arrColors(2) = cDarkOrange
  283.         arrColors(3) = cOrange
  284.         arrColors(4) = cGold
  285.         arrColors(5) = cYellow
  286.         arrColors(6) = cChartreuse
  287.         arrColors(7) = cOliveDrab1
  288.         arrColors(8) = cLime
  289.         arrColors(9) = cMediumSpringGreen
  290.         arrColors(10) = cCyan
  291.         arrColors(11) = cDeepSkyBlue
  292.         arrColors(12) = cDodgerBlue
  293.         arrColors(13) = cSeaBlue
  294.         arrColors(14) = cBlue
  295.         arrColors(15) = cBluePurple
  296.         arrColors(16) = cDeepPurple
  297.         arrColors(17) = cPurple
  298.         arrColors(18) = cPurpleRed
  299.         arrColors(19) = cDarkRed
  300.         arrColors(20) = cBrickRed
  301.         arrColors(21) = cDarkGreen
  302.         arrColors(22) = cGreen
  303.         arrColors(23) = cOliveDrab
  304.         arrColors(24) = cLightPink
  305.         arrColors(25) = cHotPink
  306.         arrColors(26) = cDeepPink
  307.         arrColors(27) = cMagenta
  308.         arrColors(28) = cBlack
  309.         arrColors(29) = cDimGray
  310.         arrColors(30) = cGray
  311.         arrColors(31) = cDarkGray
  312.         arrColors(32) = cSilver
  313.         arrColors(33) = cLightGray
  314.         arrColors(34) = cGainsboro
  315.         arrColors(35) = cWhiteSmoke
  316.         arrColors(36) = cWhite
  317.         arrColors(37) = cDarkBrown
  318.         arrColors(38) = cLightBrown
  319.         arrColors(39) = cKhaki
  320.         iFirstColor2 = LBound(arrColors)
  321.         iLastColor2 = UBound(arrColors)
  322.  
  323.         ' Make one big tileset with all possible foreground/background color combinations
  324.         MakeColoredTileset2 imgTiles, imgTilesAllColorsSW, arrColors(), arrTileIndex(), arrColorIndex()
  325.         imgTilesAllColorsHW = _CopyImage(imgTilesAllColorsSW, 33) ' Copy tilesheet for hardware image
  326.     End If
  327.  
  328.     ' ================================================================================================================================================================
  329.     ' VECTOR TILES SETUP
  330.     ' ================================================================================================================================================================
  331.     If Len(sError) = 0 Then
  332.         ' set up vector tiles
  333.         GetVectorTiles
  334.  
  335.         ' set up colors for vector HW tiles
  336.         arrColor(0) = cRed
  337.         arrColor(1) = cLime
  338.         arrColor(2) = cBlue
  339.         arrColor(3) = cYellow
  340.         arrColor(4) = cBlack
  341.         arrColor(5) = cEmpty
  342.         MakePaletteImage imgPalette, arrColor()
  343.         _Dest imgScreen&
  344.  
  345.         imgPaletteHW = _CopyImage(imgPalette, 33) ' Copy palette for hardware image
  346.     End If
  347.  
  348.     ' ================================================================================================================================================================
  349.     ' METHOD #1
  350.     ' _PUTIMAGE with SOFTWARE IMAGES
  351.     ' ================================================================================================================================================================
  352.     If Len(sError) = 0 Then
  353.         Cls , cGray
  354.         Color cWhite, cBlack: Locate 1, 1: Print "Test #1: DrawTile8 routine using 4 tilesets (1 per color) and regular _putimage using using SOFTWARE images..."
  355.  
  356.         iCount1 = 0
  357.         t# = Timer + 3
  358.         Do
  359.             iCount1 = iCount1 + 1
  360.             iFirstColor = iFirstColor Xor 1
  361.             iFgColorIndex = iFirstColor
  362.             iY = iMinY
  363.             iX = iMinX
  364.             For iTileNum = 0 To 255
  365.                 Select Case iFgColorIndex
  366.                     Case 0:
  367.                         DrawTile8 imgTilesRed, iTileNum, imgScreen, iX, iY
  368.                     Case 1:
  369.                         DrawTile8 imgTilesGreen, iTileNum, imgScreen, iX, iY
  370.                     Case 2:
  371.                         DrawTile8 imgTilesBlue, iTileNum, imgScreen, iX, iY
  372.                     Case Else:
  373.                         DrawTile8 imgTilesYellow, iTileNum, imgScreen, iX, iY
  374.                 End Select
  375.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  376.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  377.             Next iTileNum
  378.             _Display
  379.         Loop Until Timer > t#
  380.         _AutoDisplay
  381.     End If
  382.  
  383.     ' ================================================================================================================================================================
  384.     ' METHOD #2
  385.     ' COLOR SWAP with SOFTWARE IMAGES
  386.     ' ================================================================================================================================================================
  387.     If Len(sError) = 0 Then
  388.         Cls , cGray
  389.         Color cWhite, cBlack: Locate 1, 1: Print "Test #2: DrawColorTile routine using 1 tileset with DoColorSwap using SOFTWARE images...";
  390.  
  391.         iCount2 = 0
  392.         t# = Timer + 3
  393.         Do
  394.             iCount2 = iCount2 + 1
  395.             iFirstColor = iFirstColor Xor 1
  396.             iFgColorIndex = iFirstColor
  397.             iY = iMinY
  398.             iX = iMinX
  399.             For iTileNum = 0 To 255
  400.                 Select Case iFgColorIndex
  401.                     Case 0:
  402.                         fgColor = cRed: bgColor = cBlack
  403.                     Case 1:
  404.                         fgColor = cLime: bgColor = cBlack
  405.                     Case 2:
  406.                         fgColor = cBlue: bgColor = cBlack
  407.                     Case Else:
  408.                         fgColor = cYellow: bgColor = cBlack
  409.                 End Select
  410.                 DrawColorTile imgScreen, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  411.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  412.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  413.             Next iTileNum
  414.             _Display
  415.         Loop Until Timer > t#
  416.         _AutoDisplay
  417.     End If
  418.  
  419.     ' ================================================================================================================================================================
  420.     ' METHOD #3
  421.     ' _PUTIMAGE with HARDWARE IMAGES
  422.     ' ================================================================================================================================================================
  423.     If Len(sError) = 0 Then
  424.         Cls , cGray
  425.         Color cWhite, cBlack: Locate 1, 1: Print "Test #3: DrawTileHw8 routine using 1 big multi-tileset and HARDWARE images...";
  426.  
  427.         imgHardwareScreen = _CopyImage(0, 33)
  428.  
  429.         iCount3 = 0
  430.         t# = Timer + 3
  431.         Do
  432.             iCount3 = iCount3 + 1
  433.             iFirstColor = iFirstColor Xor 1
  434.             iFgColorIndex = iFirstColor
  435.             iY = iMinY
  436.             iX = iMinX
  437.             _PutImage , imgHardwareScreen
  438.             For iTileNum = 0 To 255
  439.                 DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iX, iY, iFgColorIndex
  440.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  441.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  442.             Next iTileNum
  443.             _Display
  444.         Loop Until Timer > t#
  445.         _AutoDisplay
  446.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  447.         If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  448.     End If
  449.  
  450.     ' ================================================================================================================================================================
  451.     ' METHOD #4
  452.     ' VECTOR-BASED TILES USING LINE
  453.     ' ================================================================================================================================================================
  454.     If Len(sError) = 0 Then
  455.         Cls , cGray
  456.         Color cWhite, cBlack: Locate 1, 1: Print "Test #4: DrawVectorTileLine routine using 1 vector-based tileset drawn with Line shapes...";
  457.  
  458.         iCount4 = 0
  459.         t# = Timer + 3
  460.         Do
  461.             iCount4 = iCount4 + 1
  462.             iFirstColor = iFirstColor Xor 1
  463.             iFgColorIndex = iFirstColor
  464.             iY = iMinY
  465.             iX = iMinX
  466.             For iTileNum = 0 To 255
  467.                 Select Case iFgColorIndex
  468.                     Case 0:
  469.                         fgColor = cRed: bgColor = cBlack
  470.                     Case 1:
  471.                         fgColor = cLime: bgColor = cBlack
  472.                     Case 2:
  473.                         fgColor = cBlue: bgColor = cBlack
  474.                     Case Else:
  475.                         fgColor = cYellow: bgColor = cBlack
  476.                 End Select
  477.                 'DrawShape iTileNum, iX, iY, fgColor, bgColor
  478.                 DrawVectorTileLine iTileNum, iX * 8, iY * 8, fgColor, bgColor
  479.  
  480.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  481.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  482.             Next iTileNum
  483.             _Display
  484.         Loop Until Timer > t#
  485.         _AutoDisplay
  486.     End If
  487.  
  488.     ' ================================================================================================================================================================
  489.     ' METHOD #5
  490.     ' VECTOR-BASED TILES USING _PutImage
  491.     ' ================================================================================================================================================================
  492.     If Len(sError) = 0 Then
  493.         Cls , cGray
  494.         Color cWhite, cBlack: Locate 1, 1: Print "Test #5: DrawVectorTilePutImage routine using 1 vector-based tileset drawn with _PutImage...";
  495.  
  496.         iBgColorIndex = 4
  497.  
  498.         iCount5 = 0
  499.         t# = Timer + 3
  500.         Do
  501.             iCount5 = iCount5 + 1
  502.             iFirstColor = iFirstColor Xor 1
  503.             iFgColorIndex = iFirstColor
  504.             iY = iMinY
  505.             iX = iMinX
  506.             For iTileNum = 0 To 255
  507.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  508.                 DrawVectorTilePutImage _
  509.                     imgScreen, imgPalette, arrColor(), _
  510.                     iTileNum, iX, iY, _
  511.                     iFgColorIndex, iBgColorIndex
  512.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  513.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  514.             Next iTileNum
  515.             _Display
  516.         Loop Until Timer > t#
  517.         _AutoDisplay
  518.     End If
  519.  
  520.     ' ================================================================================================================================================================
  521.     ' METHOD #6
  522.     ' VECTOR-BASED TILES USING _PutImage with HARDWARE IMAGES
  523.     ' ================================================================================================================================================================
  524.     If Len(sError) = 0 Then
  525.         Cls , cGray
  526.         Color cWhite, cBlack: Locate 1, 1: Print "Test #6: DrawVectorTilePutImageHW routine using 1 vector-based tileset drawn with hardware images...";
  527.  
  528.         iBgColorIndex = 4
  529.         imgHardwareScreen = _CopyImage(0, 33)
  530.  
  531.         iCount6 = 0
  532.         t# = Timer + 3
  533.         Do
  534.             iCount6 = iCount6 + 1
  535.             iFirstColor = iFirstColor Xor 1
  536.             iFgColorIndex = iFirstColor
  537.             iY = iMinY
  538.             iX = iMinX
  539.             _PutImage , imgHardwareScreen
  540.             For iTileNum = 0 To 255
  541.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  542.                 DrawVectorTilePutImageHW _
  543.                     imgPaletteHW, arrColor(), _
  544.                     iTileNum, iX, iY, _
  545.                     iFgColorIndex, iBgColorIndex
  546.  
  547.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  548.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  549.             Next iTileNum
  550.             _Display
  551.         Loop Until Timer > t#
  552.         _AutoDisplay
  553.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  554.         If imgPaletteHW < -1 Or imgPaletteHW > 0 Then _FreeImage imgPaletteHW ' FREE MEMORY
  555.     End If
  556.  
  557.     ' ================================================================================================================================================================
  558.     ' METHOD #7
  559.     ' SOLID BOXES WITH LINE
  560.     ' ================================================================================================================================================================
  561.     If Len(sError) = 0 Then
  562.         Cls , cGray
  563.         Color cWhite, cBlack: Locate 1, 1: Print "Test #7: Solid boxes with Line...";
  564.  
  565.         iCount7 = 0
  566.         t# = Timer + 3
  567.         Do
  568.             _Display
  569.             iCount7 = iCount7 + 1
  570.             iFirstColor = iFirstColor Xor 1
  571.             iFgColorIndex = iFirstColor
  572.             iY = iMinY
  573.             iX = iMinX
  574.             For iTileNum = 0 To 255
  575.                 Select Case iFgColorIndex
  576.                     Case 0:
  577.                         fgColor = cRed: bgColor = cBlack
  578.                     Case 1:
  579.                         fgColor = cLime: bgColor = cBlack
  580.                     Case 2:
  581.                         fgColor = cBlue: bgColor = cBlack
  582.                     Case Else:
  583.                         fgColor = cYellow: bgColor = cBlack
  584.                 End Select
  585.  
  586.                 'DrawShape iTileNum, iX, iY, fgColor, bgColor
  587.                 'DrawVectorTileLine iTileNum, iX*8, iY*8, fgColor, bgColor
  588.                 Line (iX * 8, iY * 8)-((iX * 8) + 7, (iY * 8) + 7), fgColor, BF ' Draw a solid box
  589.  
  590.                 iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iLastColor Then iFgColorIndex = iFirstColor
  591.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  592.             Next iTileNum
  593.             _Display
  594.         Loop Until Timer > t#
  595.         _AutoDisplay
  596.     End If
  597.  
  598.  
  599.     ' ================================================================================================================================================================
  600.     ' METHOD #8
  601.     ' _PUTIMAGE with HARDWARE IMAGES v2 (ALL COLOR COMBINATIONS)
  602.     ' ================================================================================================================================================================
  603.     If Len(sError) = 0 Then
  604.         Cls , cGray
  605.         Color cWhite, cBlack: Locate 1, 1: Print "Test #8: DrawColorTileHw8 routine using 1 big multi-tileset and HARDWARE images...";
  606.  
  607.         ''_PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  608.         '_PutImage (0, 0), imgTilesAllColorsSW, imgScreen
  609.         'sleep
  610.         'IF TRUE=FALSE THEN
  611.         imgHardwareScreen = _CopyImage(0, 33)
  612.  
  613.         iCount8 = 0
  614.         t# = Timer + 3
  615.         Do
  616.             iCount8 = iCount8 + 1
  617.             iFirstColor2 = iFirstColor2 Xor 1
  618.             iFgColorIndex = iFirstColor2
  619.             iBgColorIndex = iFgColorIndex + 1: If iBgColorIndex > iLastColor2 Then iBgColorIndex = iFirstColor2
  620.  
  621.             iY = iMinY
  622.             iX = iMinX
  623.             _PutImage , imgHardwareScreen
  624.             For iTileNum = 0 To 255
  625.                 DrawColorTileHw8 imgTilesAllColorsHW, iTileNum, imgScreen, iX, iY, iFgColorIndex, iBgColorIndex, arrTileIndex(), arrColorIndex()
  626.                 iFgColorIndex = iFgColorIndex + 1
  627.                 If iFgColorIndex > iLastColor2 Then
  628.                     iFgColorIndex = iFirstColor2
  629.                     iBgColorIndex = iBgColorIndex + 1
  630.                     If iBgColorIndex > iLastColor2 Then
  631.                         iBgColorIndex = iFirstColor2
  632.                     End If
  633.                 End If
  634.  
  635.                 iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then Exit For
  636.             Next iTileNum
  637.             _Display
  638.         Loop Until Timer > t#
  639.         _AutoDisplay
  640.         If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  641.         'END IF
  642.         If imgTilesAllColorsHW < -1 Or imgTilesAllColorsHW > 0 Then _FreeImage imgTilesAllColorsHW ' FREE MEMORY
  643.     End If
  644.  
  645.  
  646.  
  647.     ' ================================================================================================================================================================
  648.     ' SHOW RESULTS
  649.     ' ================================================================================================================================================================
  650.     Cls , cGray
  651.     Color cWhite, cBlack: Locate 1, 1
  652.     Print ""
  653.     Print "RESULTS:"
  654.     Print Using "DrawTile8                ###,###,###,###,###,### refreshes in 3 seconds."; iCount1
  655.     Print Using "DrawColorTile            ###,###,###,###,###,### refreshes in 3 seconds."; iCount2
  656.     Print Using "DrawTileHw8              ###,###,###,###,###,### refreshes in 3 seconds."; iCount3
  657.     Print Using "DrawVectorTileLine       ###,###,###,###,###,### refreshes in 3 seconds."; iCount4
  658.     Print Using "DrawVectorTilePutImage   ###,###,###,###,###,### refreshes in 3 seconds."; iCount5
  659.     Print Using "DrawVectorTilePutImageHW ###,###,###,###,###,### refreshes in 3 seconds."; iCount6
  660.     Print Using "Solid boxes with Line    ###,###,###,###,###,### refreshes in 3 seconds."; iCount7
  661.     Print Using "DrawColorTileHw8         ###,###,###,###,###,### refreshes in 3 seconds."; iCount8
  662.     Print "PRESS ANY KEY TO CONTINUE"
  663.     Sleep
  664.  
  665.     ' ================================================================================================================================================================
  666.     ' CLEANUP AND EXIT
  667.     ' ================================================================================================================================================================
  668.     Screen 0 ' RETURN TO TEXT SCREEN
  669.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  670.     'If imgHardwareScreen < -1 Or imgHardwareScreen > 0 Then _FreeImage imgHardwareScreen ' FREE MEMORY
  671.     If imgTiles < -1 Or imgTiles > 0 Then _FreeImage imgTiles ' FREE MEMORY
  672.     'If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles ' FREE MEMORY
  673.     If imgTilesRed < -1 Or imgTilesRed > 0 Then _FreeImage imgTilesRed ' FREE MEMORY
  674.     If imgTilesGreen < -1 Or imgTilesGreen > 0 Then _FreeImage imgTilesGreen ' FREE MEMORY
  675.     If imgTilesBlue < -1 Or imgTilesBlue > 0 Then _FreeImage imgTilesBlue ' FREE MEMORY
  676.     If imgTilesYellow < -1 Or imgTilesYellow > 0 Then _FreeImage imgTilesYellow ' FREE MEMORY
  677.     If imgColorTiles < -1 Or imgColorTiles > 0 Then _FreeImage imgColorTiles ' FREE MEMORY
  678.     If imgTilesAllColorsSW < -1 Or imgTilesAllColorsSW > 0 Then _FreeImage imgTilesAllColorsSW ' FREE MEMORY
  679.     'If imgTilesAllColorsHW < -1 Or imgTilesAllColorsHW > 0 Then _FreeImage imgTilesAllColorsHW ' FREE MEMORY
  680.     If imgPalette < -1 Or imgPalette > 0 Then _FreeImage imgPalette ' FREE MEMORY
  681.     'If imgPaletteHW < -1 Or imgPaletteHW > 0 Then _FreeImage imgPaletteHW ' FREE MEMORY
  682.  
  683. End Sub ' DrawingSpeedTest7
  684.  
  685. ' ################################################################################################################################################################
  686. ' END DRAWING SPEED TEST
  687. ' ################################################################################################################################################################
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729. ' ################################################################################################################################################################
  730. ' BEGIN Steve's very different custom screen
  731. ' ################################################################################################################################################################
  732.  
  733. ' /////////////////////////////////////////////////////////////////////////////
  734.  
  735. Sub TestCustomHardwareScreen2
  736.     Dim sError As String: sError = ""
  737.     Dim in$
  738.     Dim arrColors(255) As _Unsigned Long ' an array to hold all my color values
  739.     Dim imgDisplay As Long
  740.     Dim imgTile As Long
  741.     Dim imgFont As Long
  742.     Dim imgTempScreen256 As Long
  743.     Dim iLoop As Integer
  744.     Dim iColor As Integer
  745.     Dim iTile As Integer
  746.     Dim iX As Integer
  747.     Dim iY As Integer
  748.     Dim count&
  749.     Dim t## ' _FLOAT
  750.  
  751.  
  752.     imgDisplay = _NewImage(800, 600, 32) ' my main screenwich is 100 by 75 characters with 8x8 font.
  753.     imgTile = _NewImage(8 * 256, 8, 32) ' 8x8 tiles in 256 colors
  754.     imgFont = _NewImage(8 * 256, 8 * 256, 32) ' 256 characters of an 8x8 font, in all 256 possible colors.
  755.  
  756.     ' Set the main screen for starters so it'll go ahead
  757.     ' and create itself properly while I'm working on making my tiles and fonts
  758.     Screen imgDisplay
  759.  
  760.     ' very tiny 256 color screen, just to borrow the palette from
  761.     imgTempScreen256 = _NewImage(10, 10, 256)
  762.     ' 40 colors
  763.     For iLoop = 0 To 255
  764.         ' since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  765.         arrColors(iLoop) = _RGB32(_Red(iLoop, imgTempScreen256), _Green(iLoop, imgTempScreen256), _Blue(iLoop, imgTempScreen256))
  766.     Next iLoop
  767.     If imgTempScreen256 < -1 Or imgTempScreen256 > 0 Then _FreeImage imgTempScreen256 ' FREE MEMORY
  768.  
  769.     ' Create my software tiles of 256 colors
  770.     _Dest imgTile
  771.     For iLoop = 0 To 255 ' 256 tiles, one for each color
  772.         ' all drawn sequentially onto a sprite sheet
  773.         Line (iLoop * 8, 0)-Step(8, 8), arrColors(iLoop), BF
  774.     Next iLoop
  775.  
  776.     ' I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  777.     _Dest imgFont
  778.     _Font 8
  779.     For iColor = 0 To 255 ' 256 colors
  780.         Color arrColors(iColor), 0 ' make our font the proper color
  781.         For iTile = 0 To 255 ' 256 characters
  782.             ' print the characters row by row to the screen
  783.             _PrintString (iTile * 8, iColor * 8), Chr$(iTile)
  784.         Next iTile
  785.     Next iColor
  786.     _Dest imgDisplay
  787.  
  788.     'Sleep ' View the blank screen  until a key is hit
  789.  
  790.     Screen imgTile ' View the tiles
  791.     DebugPrint "Viewing the tiles (imgTile) - press any key to continue"
  792.     Sleep ' until a key is hit
  793.  
  794.     Screen imgFont ' view the fonts
  795.     DebugPrint "Viewing the fonts (imgFont) - press any key to continue"
  796.     Sleep ' until a key is hit
  797.  
  798.     Screen imgDisplay ' and back to the normal blank screen
  799.     _Delay .2 ' time to remove finger from key
  800.     'Dim Shared As Long m_TileHw, m_FontHw
  801.  
  802.     m_TileHw = _CopyImage(imgTile, 33) ' hardware copy of the tile image
  803.     m_FontHw = _CopyImage(imgFont, 33) ' hardware copy of the font image
  804.  
  805.     If imgTile < -1 Or imgTile > 0 Then _FreeImage imgTile ' FREE MEMORY 'free unused images when done with them
  806.     If imgFont < -1 Or imgFont > 0 Then _FreeImage imgFont ' FREE MEMORY 'free unused images when done with them
  807.  
  808.     ' From this point onwards, I'm *ONLY* going to use my hardware layer
  809.  
  810.     '' Here, I'm creating a screen array to hold the information
  811.     '' of EVERY character I place onto the screen, and its tile
  812.     'Dim Shared m_ScreenArray(99, 74) As _Unsigned Long
  813.  
  814.     ' To start with, let's put all 256 chracters on the screen,
  815.     ' on a color 40 tile (red), in a color 3 font (cyan)
  816.     iX = 0: iY = 0
  817.     For iLoop = 0 To 255
  818.         ' 40 tile color, 3 font color, iLoop is the character
  819.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  820.         m_ScreenArray(iX, iY) = SetAll(40, 3, iLoop)
  821.     Next iLoop
  822.  
  823.     ' And then let's show these results on the screen.
  824.     ' Take a moment to open task manager and see how little resources we're using here.
  825.     DebugPrint "Viewing the whole screen full of these tiles + characters"
  826.     DebugPrint "press ENTER to continue"
  827.     Do
  828.         ' Draw a whole screen full of these tiles + characters
  829.         ScreenRender
  830.         _Limit 30
  831.     Loop Until _KeyDown(13) ' until we hit ENTER
  832.  
  833.     _Delay .2 ' time to lift up the key so we don't instantly blow past the next loop
  834.  
  835.     iX = 0: iY = 0
  836.     ' and here I'm going to set all these tiles to have incremental background tile colors
  837.     For iLoop = 0 To 255
  838.         ' from left to right, top to bottom
  839.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  840.         SetArrayTile iX, iY, iLoop ' set each tile to become an ever increasing color value
  841.     Next iLoop
  842.  
  843.     ' And then let's show these results on the screen.
  844.     DebugPrint "Viewing the screen with incremental colors"
  845.     DebugPrint "press ENTER to continue"
  846.     Do
  847.         ' Draw a whole screen full of these tiles + characters
  848.         ScreenRender
  849.         _Limit 30
  850.     Loop Until _KeyDown(13) ' until we hit ENTER
  851.  
  852.     ' And to finish up, let's do a quick count of how many loops per second
  853.     ' we *could* process, with the whole screen being redrawn over and over like this
  854.     DebugPrint "Counting how many loops per second for 3 seconds..."
  855.     t## = Timer + 3
  856.     count& = 0
  857.     Do
  858.         count& = count& + 1
  859.         ScreenRender
  860.     Loop Until Timer > t##
  861.  
  862.     ' Return to normal software screen
  863.     DebugPrint "Returning to normal software screen"
  864.  
  865.     _KeyClear: _Delay 1 ' clear keyboard buffer
  866.  
  867.     Screen 0: Cls
  868.     Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  869.     Print
  870.     Input "PRESS <ENTER> TO CONTINUE"; in$
  871.  
  872.     If imgDisplay < -1 Or imgDisplay > 0 Then _FreeImage imgDisplay ' FREE MEMORY
  873.  
  874. End Sub ' TestCustomHardwareScreen2
  875.  
  876. ' /////////////////////////////////////////////////////////////////////////////
  877.  
  878. Sub TestCustomHardwareScreen1
  879.     Dim sError As String: sError = ""
  880.     Dim in$
  881.     Dim arrColors(255) As _Unsigned Long ' an array to hold all my color values
  882.     Dim imgDisplay As Long
  883.     Dim imgTile As Long
  884.     Dim imgFont As Long
  885.     Dim imgTempScreen256 As Long
  886.     Dim iLoop As Integer
  887.     Dim iColor As Integer
  888.     Dim iTile As Integer
  889.     Dim iX As Integer
  890.     Dim iY As Integer
  891.     Dim count&
  892.     Dim t## ' _FLOAT
  893.  
  894.     Cls
  895.     Print "Custom hardware screen test. Press <ENTER> to proceed through each step."
  896.     Input "PRESS <ENTER> TO START"; in$
  897.  
  898.  
  899.     imgDisplay = _NewImage(800, 600, 32) ' my main screenwich is 100 by 75 characters with 8x8 font.
  900.     imgTile = _NewImage(8 * 256, 8, 32) ' 8x8 tiles in 256 colors
  901.     imgFont = _NewImage(8 * 256, 8 * 256, 32) ' 256 characters of an 8x8 font, in all 256 possible colors.
  902.  
  903.     ' Set the main screen for starters so it'll go ahead
  904.     ' and create itself properly while I'm working on making my tiles and fonts
  905.     Screen imgDisplay
  906.  
  907.     ' very tiny 256 color screen, just to borrow the palette from
  908.     imgTempScreen256 = _NewImage(10, 10, 256)
  909.     For iLoop = 0 To 255 ' 40 colors
  910.         ' since I don't know your color palette, I'll just copy the QB64 256 color palette.  ;)
  911.         arrColors(iLoop) = _RGB32(_Red(iLoop, imgTempScreen256), _Green(iLoop, imgTempScreen256), _Blue(iLoop, imgTempScreen256))
  912.     Next iLoop
  913.     If imgTempScreen256 < -1 Or imgTempScreen256 > 0 Then _FreeImage imgTempScreen256 ' FREE MEMORY
  914.  
  915.     ' Create my software tiles of 256 colors
  916.     _Dest imgTile
  917.     For iLoop = 0 To 255 ' 256 tiles, one for each color
  918.         Line (iLoop * 8, 0)-Step(8, 8), arrColors(iLoop), BF ' all drawn sequentially onto a sprite sheet
  919.     Next iLoop
  920.  
  921.     ' I'm just going to use the built in QB64 8x8 font for quick and easy sheet creation.
  922.     _Dest imgFont
  923.     _Font 8
  924.     For iColor = 0 To 255 ' 256 colors
  925.         Color arrColors(iColor), 0 ' make our font the proper color
  926.         For iTile = 0 To 255 ' 256 characters
  927.             _PrintString (iTile * 8, iColor * 8), Chr$(iTile) ' print the characters row by row to the screen
  928.         Next iTile
  929.     Next iColor
  930.     _Dest imgDisplay
  931.  
  932.     Sleep ' View the blank screen  until a key is hit
  933.  
  934.     Screen imgTile ' View the tiles
  935.     Sleep ' until a key is hit
  936.  
  937.     Screen imgFont ' view the fonts
  938.     Sleep ' until a key is hit
  939.  
  940.     Screen imgDisplay ' and back to the normal blank screen
  941.     _Delay .2 ' time to remove finger from key
  942.     'Dim Shared As Long m_TileHw, m_FontHw
  943.  
  944.     m_TileHw = _CopyImage(imgTile, 33) ' hardware copy of the tile image
  945.     m_FontHw = _CopyImage(imgFont, 33) ' hardware copy of the font image
  946.  
  947.     If imgTile < -1 Or imgTile > 0 Then _FreeImage imgTile ' FREE MEMORY 'free unused images when done with them
  948.     If imgFont < -1 Or imgFont > 0 Then _FreeImage imgFont ' FREE MEMORY 'free unused images when done with them
  949.  
  950.     ' From this point onwards, I'm *ONLY* going to use my hardware layer
  951.  
  952.     '' Here, I'm creating a screen array to hold the information
  953.     '' of EVERY character I place onto the screen, and its tile
  954.     'Dim Shared m_ScreenArray(99, 74) As _Unsigned Long
  955.  
  956.     ' To start with, let's put all 256 chracters on the screen,
  957.     ' on a color 40 tile (red), in a color 3 font (cyan)
  958.     iX = 0: iY = 0
  959.     For iLoop = 0 To 255
  960.         ' 40 tile color, 3 font color, iLoop is the character
  961.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  962.         m_ScreenArray(iX, iY) = SetAll(40, 3, iLoop)
  963.     Next iLoop
  964.  
  965.     ' And then let's show these results on the screen.
  966.     ' Take a moment to open task manager and see how little resources we're using here.
  967.     Do
  968.         ' Draw a whole screen full of these tiles + characters
  969.         ScreenRender
  970.         _Limit 30
  971.     Loop Until _KeyDown(13) ' until we hit ENTER
  972.  
  973.     _Delay .2 ' time to lift up the key so we don't instantly blow past the next loop
  974.  
  975.     iX = 0: iY = 0
  976.     ' and here I'm going to set all these tiles to have incremental background tile colors
  977.     For iLoop = 0 To 255
  978.         ' from left to right, top to bottom
  979.         iX = iX + 1: If iX > 99 Then iX = 0: iY = iY + 1
  980.         SetArrayTile iX, iY, iLoop ' set each tile to become an ever increasing color value
  981.     Next iLoop
  982.  
  983.     ' And then let's show these results on the screen.
  984.     Do
  985.         ' Draw a whole screen full of these tiles + characters
  986.         ScreenRender
  987.         _Limit 30
  988.     Loop Until _KeyDown(13) ' until we hit ENTER
  989.  
  990.     ' And to finish up, let's do a quick count of how many loops per second
  991.     ' we *could* process, with the whole screen being redrawn over and over like this
  992.     t## = Timer + 3
  993.     count& = 0
  994.     Do
  995.         count& = count& + 1
  996.         ScreenRender
  997.     Loop Until Timer > t##
  998.  
  999.     ' Return to normal software screen
  1000.  
  1001.     _KeyClear: _Delay 1 ' clear keyboard buffer
  1002.  
  1003.     Screen 0: Cls
  1004.     Print "Whole screen rendering of color tile + color font = "; count&; " times in 3 seconds."
  1005.  
  1006.     Print
  1007.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1008.  
  1009.     If imgDisplay < -1 Or imgDisplay > 0 Then _FreeImage imgDisplay ' FREE MEMORY
  1010.  
  1011. End Sub ' TestCustomHardwareScreen1
  1012.  
  1013. ' /////////////////////////////////////////////////////////////////////////////
  1014.  
  1015. Sub ScreenRender
  1016.     Dim tileColor As _Unsigned Long
  1017.     Dim fontColor As _Unsigned Long
  1018.     Dim character As _Unsigned Long
  1019.     Dim iX As Integer
  1020.     Dim iY As Integer
  1021.  
  1022.     For iX = 0 To 99
  1023.         For iY = 0 To 74
  1024.             tileColor = m_ScreenArray(iX, iY) \ (256 * 256)
  1025.             fontColor = (m_ScreenArray(iX, iY) - tileColor * 256 * 256) \ 256
  1026.             character = m_ScreenArray(iX, iY) Mod 256
  1027.             _PutImage (iX * 8, iY * 8)-Step(7, 7), m_TileHw, , (tileColor * 8, 0)-Step(7, 7)
  1028.             _PutImage (iX * 8, iY * 8)-Step(7, 7), m_FontHw, , (character * 8, fontColor * 8)-Step(7, 7)
  1029.         Next iY
  1030.     Next iX
  1031.     _Display
  1032. End Sub ' ScreenRender
  1033.  
  1034. ' /////////////////////////////////////////////////////////////////////////////
  1035.  
  1036. Function SetAll&& (tile, fontcolor, character)
  1037.     SetAll&& = tile * 256 * 256 + fontcolor * 256 + character
  1038. End Function ' SetAll&&
  1039.  
  1040. ' /////////////////////////////////////////////////////////////////////////////
  1041.  
  1042. Sub SetArrayTile (iX, iY, newTileColor)
  1043.     Dim temp&&
  1044.     Dim oldTile&&
  1045.  
  1046.     temp&& = m_ScreenArray(iX, iY)
  1047.     oldTile&& = temp&& \ (256 * 256)
  1048.     m_ScreenArray(iX, iY) = temp&& - oldTile&& + newTileColor * 256 * 256
  1049. End Sub ' SetArrayTile
  1050.  
  1051. ' /////////////////////////////////////////////////////////////////////////////
  1052.  
  1053. Sub SetArrayFontColor (iX, iY, newFontColor)
  1054.     Dim temp&&
  1055.     Dim oldTile&&
  1056.     Dim oldFont&&
  1057.  
  1058.     temp&& = m_ScreenArray(iX, iY)
  1059.     oldTile&& = temp&& \ (256 * 256)
  1060.     oldFont&& = (temp&& - oldTile&&) \ 256
  1061.     m_ScreenArray(iX, iY) = temp&& - oldFont&& + newFontColor * 256
  1062. End Sub ' SetArrayFontColor
  1063.  
  1064. ' /////////////////////////////////////////////////////////////////////////////
  1065.  
  1066. Sub SetArrayCharacter (iX, iY, newCharacter)
  1067.     Dim temp&&
  1068.     Dim oldCharacter&&
  1069.  
  1070.     temp&& = m_ScreenArray(iX, iY)
  1071.     oldCharacter&& = temp&& Mod 256
  1072.     m_ScreenArray(iX, iY) = temp&& - oldCharacter&& + newCharacter
  1073. End Sub ' SetArrayCharacter
  1074.  
  1075. ' ################################################################################################################################################################
  1076.  
  1077. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  1078. ' https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904
  1079.  
  1080. ' SMcNeill, QB64 Developer
  1081. ' Reply #18 on: Yesterday at 05:08:58 pm
  1082. '
  1083. ' One thing that would be *very* different with all hardware images vs what
  1084. ' you're doing currently, is the fact that you have to remember:
  1085. ' Hardware images display once and then flush themselves from the GPU buffer.
  1086. '
  1087. ' You can't just print to a tile, and then read the information for the color of
  1088. ' that tile, and instantly turn that color into another one.  You have write
  1089. ' access to hardware images, but not read access -- and the images aren't
  1090. ' persistent like the software images are.
  1091. '
  1092. ' For something like this to work for a whole screen in hardware image mode,
  1093. ' you'd have to sort out some sort of way to store your screen's info and then
  1094. ' constantly redraw everything over and over again to keep it refreshed on the
  1095. ' display.
  1096. '
  1097. ' The way I'd go about doing something like this would be to make myself a
  1098. ' custom SCREEN 0-style memory array.  Screen 0 stores all our information for
  1099. ' each character in 2 bytes -- one for color, one for character.  I'd basically
  1100. ' do the same, but with 3 bytes -- one for tile color, one for font color, one
  1101. ' for character.
  1102. '
  1103. ' Let me toss a simple demo of this line of thinking for you:
  1104. ' (TestCustomHardwareScreen1)
  1105. '
  1106. ' I tried to comment the heck out of the code to help explain what it's doing
  1107. ' from line to line, so I hope this isn't too hard to sort out and understand.
  1108. '
  1109. ' The beginning is nothing more than initializing things and making 2 different
  1110. ' sprite sheets that I'll make use of later -- one for the tiles and one for the
  1111. ' characters.
  1112. '
  1113. ' Then there's the mid section where you can SLEEP step through and view the
  1114. ' various resource sheets.
  1115. '
  1116. ' Then an example of all the characters in a cyan font, resting atop a red tile.
  1117. ' (You have to hit ENTER to move on from this screen.)
  1118. '
  1119. ' Then an example of all those tiles that go under the characters being replaced
  1120. ' with sequential colored tiles.  (A lot of these tiles are simply BLACK, but
  1121. ' that's the nature of the 256 color palette as those multiple blacks are there
  1122. ' to be replaced with custom color values instead.)
  1123. '
  1124. ' Once more, you'll have to hit ENTER to continue.
  1125. '
  1126. ' And then I do a quick time loop to count how many times we can redraw the whole
  1127. ' screen of tiles + characters in 3 seconds.
  1128. '
  1129. ' For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of
  1130. ' about 1800 refreshes in that time.  That's around 600 FPS, which would be more
  1131. ' than enough for any sort of game display or use that I think I could come up
  1132. ' with, and that's without me trying to optimize math or any such things to
  1133. ' reduce calculations and speed the process up any more.  (Keep in mind, this is
  1134. ' 1800 full pages of a 800x600 screen -- if your screen has a lower overall
  1135. ' resolution, then you'd draw more loops with less to process, but a higher
  1136. ' resolution screen would draw fewer loops with more to process.)
  1137. '
  1138. ' No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page
  1139. ' of tiles and colored characters.  (And, YES, it is a whole page being rendered
  1140. ' repeatedly -- even if I didn't bother to fill in the vast majority of that page
  1141. ' with anything more than black tiles, black fonts, and chr$(0) blank spaces...)
  1142. '
  1143. ' It's a completely different approach to displaying stuff than what you've been
  1144. ' doing, but it seems as if what you've been doing isn't working as it must be
  1145. ' running too slow for you.  You wouldn't be able to use the normal PRINT
  1146. ' statements to display to the faux screen memory array I've created; you'd have
  1147. ' to write your own.
  1148. '
  1149. ' For a quick speed comparison, here's the same type process ran using PRINT
  1150. ' and a software screen of the same size:
  1151. ' (TestSoftwareScreen1)
  1152.  
  1153. ' ################################################################################################################################################################
  1154.  
  1155. ' /////////////////////////////////////////////////////////////////////////////
  1156.  
  1157. Function GetInstructions1$
  1158.     Dim in$
  1159.     in$ = ""
  1160.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + Chr$(13)
  1161.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + Chr$(13)
  1162.     in$ = in$ + " " + Chr$(13)
  1163.     in$ = in$ + "SMcNeill, QB64 Developer" + Chr$(13)
  1164.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + Chr$(13)
  1165.     in$ = in$ + " " + Chr$(13)
  1166.     in$ = in$ + "One thing that would be *very* different with all hardware images vs what " + Chr$(13)
  1167.     in$ = in$ + "you're doing currently, is the fact that you have to remember:  " + Chr$(13)
  1168.     in$ = in$ + "Hardware images display once and then flush themselves from the GPU buffer. " + Chr$(13)
  1169.     in$ = in$ + " " + Chr$(13)
  1170.     in$ = in$ + "You can't just print to a tile, and then read the information for the color of " + Chr$(13)
  1171.     in$ = in$ + "that tile, and instantly turn that color into another one.  You have write " + Chr$(13)
  1172.     in$ = in$ + "access to hardware images, but not read access -- and the images aren't " + Chr$(13)
  1173.     in$ = in$ + "persistent like the software images are." + Chr$(13)
  1174.     in$ = in$ + " " + Chr$(13)
  1175.     in$ = in$ + "For something like this to work for a whole screen in hardware image mode, " + Chr$(13)
  1176.     in$ = in$ + "you'd have to sort out some sort of way to store your screen's info and then " + Chr$(13)
  1177.     in$ = in$ + "constantly redraw everything over and over again to keep it refreshed on the " + Chr$(13)
  1178.     in$ = in$ + "display." + Chr$(13)
  1179.     in$ = in$ + " " + Chr$(13)
  1180.     in$ = in$ + "The way I'd go about doing something like this would be to make myself a " + Chr$(13)
  1181.     in$ = in$ + "custom SCREEN 0-style memory array.  Screen 0 stores all our information for " + Chr$(13)
  1182.     in$ = in$ + "each character in 2 bytes -- one for color, one for character.  I'd basically " + Chr$(13)
  1183.     in$ = in$ + "do the same, but with 3 bytes -- one for tile color, one for font color, one " + Chr$(13)
  1184.     in$ = in$ + "for character." + Chr$(13)
  1185.     in$ = in$ + " " + Chr$(13)
  1186.     in$ = in$ + "Let me toss a simple demo of this line of thinking for you:" + Chr$(13)
  1187.     in$ = in$ + " " + Chr$(13)
  1188.     in$ = in$ + "I tried to comment the heck out of the code to help explain what it's doing " + Chr$(13)
  1189.     in$ = in$ + "from line to line, so I hope this isn't too hard to sort out and understand." + Chr$(13)
  1190.     in$ = in$ + " " + Chr$(13)
  1191.     in$ = in$ + "The beginning is nothing more than initializing things and making 2 different " + Chr$(13)
  1192.     in$ = in$ + "sprite sheets that I'll make use of later -- one for the tiles and one for the " + Chr$(13)
  1193.     in$ = in$ + "characters." + Chr$(13)
  1194.     in$ = in$ + " " + Chr$(13)
  1195.     in$ = in$ + "Then there's the mid section where you can SLEEP step through and view the " + Chr$(13)
  1196.     in$ = in$ + "various resource sheets." + Chr$(13)
  1197.     in$ = in$ + " " + Chr$(13)
  1198.     in$ = in$ + "Then an example of all the characters in a cyan font, resting atop a red tile.  " + Chr$(13)
  1199.     in$ = in$ + "(You have to hit ENTER to move on from this screen.)" + Chr$(13)
  1200.     in$ = in$ + " " + Chr$(13)
  1201.     in$ = in$ + "Then an example of all those tiles that go under the characters being replaced " + Chr$(13)
  1202.     in$ = in$ + "with sequential colored tiles.  (A lot of these tiles are simply BLACK, but " + Chr$(13)
  1203.     in$ = in$ + "that's the nature of the 256 color palette as those multiple blacks are there " + Chr$(13)
  1204.     in$ = in$ + "to be replaced with custom color values instead.)" + Chr$(13)
  1205.     in$ = in$ + " " + Chr$(13)
  1206.     in$ = in$ + "Once more, you'll have to hit ENTER to continue." + Chr$(13)
  1207.     in$ = in$ + " " + Chr$(13)
  1208.     in$ = in$ + "And then I do a quick time loop to count how many times we can redraw the whole " + Chr$(13)
  1209.     in$ = in$ + "screen of tiles + characters in 3 seconds." + Chr$(13)
  1210.     in$ = in$ + " " + Chr$(13)
  1211.     in$ = in$ + "For an 800x600 screen (100 x 75 characters and tiles), my laptop does a max of " + Chr$(13)
  1212.     in$ = in$ + "about 1800 refreshes in that time.  That's around 600 FPS, which would be more " + Chr$(13)
  1213.     in$ = in$ + "than enough for any sort of game display or use that I think I could come up " + Chr$(13)
  1214.     in$ = in$ + "with, and that's without me trying to optimize math or any such things to " + Chr$(13)
  1215.     in$ = in$ + "reduce calculations and speed the process up any more.  (Keep in mind, this is " + Chr$(13)
  1216.     in$ = in$ + "1800 full pages of a 800x600 screen -- if your screen has a lower overall " + Chr$(13)
  1217.     in$ = in$ + "resolution, then you'd draw more loops with less to process, but a higher " + Chr$(13)
  1218.     in$ = in$ + "resolution screen would draw fewer loops with more to process.)" + Chr$(13)
  1219.     in$ = in$ + " " + Chr$(13)
  1220.     in$ = in$ + "No _MEM access.  No optimization work.  Just 600 FPS rendering of a whole page " + Chr$(13)
  1221.     in$ = in$ + "of tiles and colored characters.  (And, YES, it is a whole page being rendered " + Chr$(13)
  1222.     in$ = in$ + "repeatedly -- even if I didn't bother to fill in the vast majority of that page " + Chr$(13)
  1223.     in$ = in$ + "with anything more than black tiles, black fonts, and chr$(0) blank spaces...)" + Chr$(13)
  1224.     in$ = in$ + " " + Chr$(13)
  1225.     in$ = in$ + "It's a completely different approach to displaying stuff than what you've been " + Chr$(13)
  1226.     in$ = in$ + "doing, but it seems as if what you've been doing isn't working as it must be " + Chr$(13)
  1227.     in$ = in$ + "running too slow for you.  You wouldn't be able to use the normal PRINT " + Chr$(13)
  1228.     in$ = in$ + "statements to display to the faux screen memory array I've created; you'd have " + Chr$(13)
  1229.     in$ = in$ + "to write your own." + Chr$(13)
  1230.     GetInstructions1$ = in$
  1231. End Function ' GetInstructions1$
  1232.  
  1233. ' /////////////////////////////////////////////////////////////////////////////
  1234.  
  1235. Function GetInstructions2$
  1236.     Dim in$
  1237.     in$ = ""
  1238.     in$ = in$ + "Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?" + Chr$(13)
  1239.     in$ = in$ + "https://qb64forum.alephc.xyz/index.php?topic=4674.msg140904#msg140904" + Chr$(13)
  1240.     in$ = in$ + " " + Chr$(13)
  1241.     in$ = in$ + "SMcNeill, QB64 Developer" + Chr$(13)
  1242.     in$ = in$ + "Reply #18 on: Yesterday at 05:08:58 pm" + Chr$(13)
  1243.     in$ = in$ + " " + Chr$(13)
  1244.     in$ = in$ + "For a quick speed comparison, here's the same type process ran using PRINT " + Chr$(13)
  1245.     in$ = in$ + "and a software screen of the same size:" + Chr$(13)
  1246.     GetInstructions2$ = in$
  1247. End Function ' GetInstructions2$
  1248.  
  1249. ' ################################################################################################################################################################
  1250.  
  1251. ' /////////////////////////////////////////////////////////////////////////////
  1252.  
  1253. Sub TestSoftwareScreen1
  1254.     Dim in$
  1255.     Dim t## ' _FLOAT
  1256.     Dim count As Integer
  1257.     Dim iX As Integer
  1258.     Dim iY As Integer
  1259.     Dim iTile As Integer
  1260.  
  1261.     Screen _NewImage(800, 600, 32)
  1262.  
  1263.     _Font 8
  1264.     t## = Timer + 3
  1265.     count = 0
  1266.     Do
  1267.         count = count + 1
  1268.         For iX = 1 To 100
  1269.             For iY = 1 To 75
  1270.                 iTile = (iTile + 1) Mod 256
  1271.                 Color _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
  1272.                 Locate iY, iX: Print Chr$(iTile);
  1273.             Next iY
  1274.         Next iX
  1275.     Loop Until Timer > t##
  1276.  
  1277.     _KeyClear: _Delay 1
  1278.     Screen 0: Cls
  1279.     Print count; "total screen replacements in 3 seconds."
  1280.     Print
  1281.     Input "PRESS <ENTER> TO CONTINUE"; in$
  1282. End Sub ' TestSoftwareScreen1
  1283.  
  1284. ' ################################################################################################################################################################
  1285. ' END Steve's very different custom screen
  1286. ' ################################################################################################################################################################
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356. ' ################################################################################################################################################################
  1357. ' BEGIN VECTOR-BASED TILE ROUTINES
  1358. ' ################################################################################################################################################################
  1359.  
  1360. ' /////////////////////////////////////////////////////////////////////////////
  1361.  
  1362. Sub DrawVectorTilePutImageTest
  1363.     Dim imgPalette As Long ' contains palette of colors
  1364.     Dim imgScreen As Long ' the main display
  1365.     Dim MyString As String
  1366.     Dim iLoop As Integer
  1367.     Dim iTileNum As Integer
  1368.     Dim arrColor(0 To 8) As _Unsigned Long
  1369.     Dim arrColorNames(0 To 8) As String
  1370.     Dim iMinFgColorIndex As Integer: iMinFgColorIndex = 0
  1371.     Dim iMaxFgColorIndex As Integer: iMaxFgColorIndex = 7
  1372.     Dim iMinBgColorIndex As Integer: iMinBgColorIndex = 0
  1373.     Dim iMaxBgColorIndex As Integer: iMaxBgColorIndex = 8
  1374.     Dim iFgColorIndex As Integer: iFgColorIndex = iMinFgColorIndex
  1375.     Dim iBgColorIndex As Integer: iBgColorIndex = iMinBgColorIndex
  1376.     Dim iX As Integer
  1377.     Dim iY As Integer
  1378.     Dim iMinX As Integer
  1379.     Dim iMaxX As Integer
  1380.     Dim iMinY As Integer
  1381.     Dim iMaxY As Integer
  1382.  
  1383.     ' Initialize colors
  1384.     arrColor(0) = cBlack
  1385.     arrColor(1) = cRed
  1386.     arrColor(2) = cYellow
  1387.     arrColor(3) = cLime
  1388.     arrColor(4) = cCyan
  1389.     arrColor(5) = cBlue
  1390.     arrColor(6) = cPurple
  1391.     arrColor(7) = cMagenta
  1392.     arrColor(8) = cEmpty
  1393.  
  1394.     ' Initialize color names (for test output)
  1395.     arrColorNames(0) = "cBlack"
  1396.     arrColorNames(1) = "cRed"
  1397.     arrColorNames(2) = "cYellow"
  1398.     arrColorNames(3) = "cLime"
  1399.     arrColorNames(4) = "cCyan"
  1400.     arrColorNames(5) = "cBlue"
  1401.     arrColorNames(6) = "cPurple"
  1402.     arrColorNames(7) = "cMagenta"
  1403.     arrColorNames(8) = "cEmpty"
  1404.  
  1405.     ' Set up screen
  1406.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1407.     Screen imgScreen
  1408.     Cls , cGray
  1409.  
  1410.     ' Generate color palette
  1411.     MakePaletteImage imgPalette, arrColor()
  1412.  
  1413.     '' Draw palette on screen:
  1414.     ''_PutImage (xDest%, yDest%), imgSource&, imgDest&, (sx1%, sy1%)-(sx2%, sy2%)
  1415.     '_PutImage (400, 300), imgPalette, imgScreen, (0,0)-(_WIDTH(imgPalette), _HEIGHT(imgPalette))
  1416.  
  1417.     ' Set up tiles
  1418.     GetVectorTiles
  1419.  
  1420.     ' Set up screen boundaries, initial colors, etc.
  1421.     iMinX = 0: iMaxX = _Width(0) \ 8
  1422.     iMinY = 0: iMaxY = _Height(0) \ 8
  1423.     DebugPrint "iMaxX = _Width(0) = " + cstr$(iMaxX)
  1424.     DebugPrint "iMaxY = _Height(0) = " + cstr$(iMaxY)
  1425.  
  1426.     iFgColorIndex = iMinFgColorIndex - 1
  1427.  
  1428.     ' Freeze dislay
  1429.     _Display
  1430.  
  1431.     ' Test text
  1432.     'MyString = "#"
  1433.     'MyString = "BOO!"
  1434.     MyString = "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1435.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1436.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1437.         "THIS IS A TEST!"
  1438.  
  1439.     iY = 5
  1440.     iX = 5
  1441.     For iLoop = 1 To Len(MyString)
  1442.         iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iMaxFgColorIndex Then iFgColorIndex = iMinFgColorIndex
  1443.         iBgColorIndex = iBgColorIndex + 1: If iBgColorIndex > iMaxBgColorIndex Then iBgColorIndex = iMinBgColorIndex
  1444.         iTileNum = Asc(Mid$(MyString, iLoop, 1))
  1445.         If iTileNum = 13 Then
  1446.             ' Linebreak = go to a new line
  1447.             iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1448.         Else
  1449.             DrawVectorTilePutImage _
  1450.                 imgScreen, imgPalette, arrColor(), _
  1451.                 iTileNum, iX, iY, _
  1452.                 iFgColorIndex, iBgColorIndex
  1453.             iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1454.             'iX = iX + 1: iY = iY + 1
  1455.             If iX > iMaxX Then iX = iMinX
  1456.             If iY > iMaxY Then iY = iMinY
  1457.         End If
  1458.     Next iLoop
  1459.  
  1460.     ' Resume display
  1461.     _Display
  1462.  
  1463.     ' Promput user
  1464.     Color cWhite, cBlack: Locate 22, 1
  1465.     Print "Press any key to continue";
  1466.     Sleep
  1467.  
  1468.     Screen 0 ' RETURN TO TEXT SCREEN
  1469.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  1470. End Sub ' DrawVectorTilePutImageTest
  1471.  
  1472. ' /////////////////////////////////////////////////////////////////////////////
  1473. ' Draw the shape with _PutImage commands using hardware images:
  1474.  
  1475. ' Requires that this global shared variable be declared:
  1476. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1477. ' containing
  1478. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1479. ' where for each tile, dimension 2 index 0:
  1480. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1481. ' holds the last used {iShapeNum} index.
  1482.  
  1483. ' Receives:
  1484. ' imgScreen& = image handle of the screen to draw to
  1485. ' imgPalette& = image handle of the palette containing 8x8 squares each with the desired color
  1486. ' arrColor() = array containing _UNSIGNED Long RGB color values
  1487. ' iTileNum% = 0-255, number of the tile in m_arrLineTiles to draw
  1488. ' iX, iY = x/y position to draw 8x8 tile to (multiplied by 8 to get screen position)
  1489. ' fgColor, bgColor = index for foreground/background color in arrColor (which contains the actual RGB values)
  1490.  
  1491. Sub DrawVectorTilePutImage( _
  1492.     imgScreen&, imgPalette&, arrColor() as _UNSIGNED Long, _
  1493.     iTileNum As Integer, iX As Integer, iY As Integer, _
  1494.     fgColorIndex As Integer, bgColorIndex As Integer)
  1495.  
  1496.     Dim iLoop As Integer
  1497.  
  1498.     Dim sc% ' source column on tile sheet
  1499.     Dim sr% ' source row on tile sheet
  1500.     Dim sx1% ' source start x
  1501.     Dim sx2% ' source end x
  1502.     Dim sy1% ' source start y
  1503.     Dim sy2% ' source end y
  1504.     Dim xDest% ' destination x
  1505.     Dim yDest% ' destination y
  1506.  
  1507.     ' Copy from palette
  1508.     _Source imgPalette&
  1509.  
  1510.     ' Draw to screen
  1511.     _Dest imgScreen&
  1512.  
  1513.     ' GET THE ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1514.     sr% = 0 ' TileNum% \ rows%
  1515.  
  1516.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  1517.     sy1% = sr% * 8
  1518.  
  1519.     ' draw background if not transparent
  1520.     If bgColorIndex >= LBound(arrColor) Then
  1521.         If bgColorIndex <= UBound(arrColor) Then
  1522.             If arrColor(bgColorIndex) <> cEmpty Then
  1523.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1524.                 sc% = bgColorIndex ' TileNum% Mod rows%
  1525.  
  1526.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1527.                 sx1% = sc% * 8
  1528.  
  1529.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1530.                 sx2% = sx1% + 7
  1531.  
  1532.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1533.                 sy2% = sy1% + 7
  1534.  
  1535.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1536.                 xDest% = iX * 8 ' dx% * 8
  1537.  
  1538.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1539.                 yDest% = iY * 8 ' (dy% * 8) '+ yOffset%
  1540.  
  1541.                 ' Copy portion of source to the top-left corner of the destination page
  1542.                 _PutImage (xDest%, yDest%), _
  1543.                     imgPalette&, imgScreen&, _
  1544.                     (sx1%, sy1%)-(sx2%, sy2%)
  1545.             End If
  1546.         End If
  1547.     End If
  1548.  
  1549.     If fgColorIndex >= LBound(arrColor) Then
  1550.         If fgColorIndex <= UBound(arrColor) Then
  1551.             For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  1552.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1553.                 sc% = fgColorIndex ' TileNum% Mod rows%
  1554.  
  1555.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1556.                 sx1% = sc% * 8
  1557.  
  1558.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1559.                 'sx2% = sx1% + 7
  1560.                 sx2% = sx1% + (m_arrLineTiles(iTileNum, iLoop).x2 - m_arrLineTiles(iTileNum, iLoop).x1)
  1561.  
  1562.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1563.                 'sy2% = sy1% + 7
  1564.                 sy2% = sy1% + (m_arrLineTiles(iTileNum, iLoop).y2 - m_arrLineTiles(iTileNum, iLoop).y1)
  1565.  
  1566.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1567.                 xDest% = (iX * 8) + m_arrLineTiles(iTileNum, iLoop).x1 ' dx% * 8
  1568.  
  1569.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1570.                 yDest% = (iY * 8) + m_arrLineTiles(iTileNum, iLoop).y1 ' (dy% * 8) '+ yOffset%
  1571.  
  1572.                 ' Copy portion of source to the top-left corner of the destination page
  1573.                 _PutImage (xDest%, yDest%), _
  1574.                     imgPalette&, imgScreen&, _
  1575.                     (sx1%, sy1%)-(sx2%, sy2%)
  1576.  
  1577.             Next iLoop
  1578.         End If
  1579.     End If
  1580. End Sub ' DrawVectorTilePutImage
  1581.  
  1582. ' /////////////////////////////////////////////////////////////////////////////
  1583. ' (Same as DrawVectorTilePutImage but uses hardware images.)
  1584.  
  1585. ' Draw the shape with _PutImage commands using hardware images:
  1586.  
  1587. ' Requires that this global shared variable be declared:
  1588. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1589. ' containing
  1590. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1591. ' where for each tile, dimension 2 index 0:
  1592. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1593. ' holds the last used {iShapeNum} index.
  1594.  
  1595. ' Receives:
  1596. ' imgScreen& = image handle of hardware image for the screen to draw to
  1597. ' imgPalette& = image handle of hardware image for palette containing 8x8 squares each with the desired color
  1598. ' arrColor() = array containing _UNSIGNED Long RGB color values
  1599. ' iTileNum% = 0-255, number of the tile in m_arrLineTiles to draw
  1600. ' iX, iY = x/y position to draw 8x8 tile to (multiplied by 8 to get screen position)
  1601. ' fgColor, bgColor = index for foreground/background color in arrColor (which contains the actual RGB values)
  1602.  
  1603. Sub DrawVectorTilePutImageHW( _
  1604.     imgPalette&, arrColor() as _UNSIGNED Long, _
  1605.     iTileNum As Integer, iX As Integer, iY As Integer, _
  1606.     fgColorIndex As Integer, bgColorIndex As Integer)
  1607.  
  1608.     Dim iLoop As Integer
  1609.     Dim sc% ' source column on tile sheet
  1610.     Dim sr% ' source row on tile sheet
  1611.     Dim sx1% ' source start x
  1612.     Dim sx2% ' source end x
  1613.     Dim sy1% ' source start y
  1614.     Dim sy2% ' source end y
  1615.     Dim xDest% ' destination x
  1616.     Dim yDest% ' destination y
  1617.  
  1618.     ' GET THE ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1619.     sr% = 0 ' TileNum% \ rows%
  1620.  
  1621.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  1622.     sy1% = sr% * 8
  1623.  
  1624.     ' draw background if not transparent
  1625.     If bgColorIndex >= LBound(arrColor) Then
  1626.         If bgColorIndex <= UBound(arrColor) Then
  1627.             If arrColor(bgColorIndex) <> cEmpty Then
  1628.                 ' GET THE COLUMN OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1629.                 sc% = bgColorIndex ' TileNum% Mod rows%
  1630.  
  1631.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1632.                 sx1% = sc% * 8
  1633.  
  1634.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1635.                 sx2% = sx1% + 7
  1636.  
  1637.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1638.                 sy2% = sy1% + 7
  1639.  
  1640.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1641.                 xDest% = iX * 8
  1642.  
  1643.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1644.                 yDest% = iY * 8
  1645.  
  1646.                 ' Copy portion of source to the top-left corner of the destination page
  1647.                 _PutImage (xDest%, yDest%), _
  1648.                     imgPalette&, , _
  1649.                     (sx1%, sy1%)-(sx2%, sy2%)
  1650.             End If
  1651.         End If
  1652.     End If
  1653.  
  1654.     If fgColorIndex >= LBound(arrColor) Then
  1655.         If fgColorIndex <= UBound(arrColor) Then
  1656.             For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  1657.                 ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  1658.                 sc% = fgColorIndex ' TileNum% Mod rows%
  1659.  
  1660.                 ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  1661.                 sx1% = sc% * 8
  1662.  
  1663.                 ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  1664.                 sx2% = sx1% + (m_arrLineTiles(iTileNum, iLoop).x2 - m_arrLineTiles(iTileNum, iLoop).x1)
  1665.  
  1666.                 ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  1667.                 sy2% = sy1% + (m_arrLineTiles(iTileNum, iLoop).y2 - m_arrLineTiles(iTileNum, iLoop).y1)
  1668.  
  1669.                 ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  1670.                 xDest% = (iX * 8) + m_arrLineTiles(iTileNum, iLoop).x1
  1671.  
  1672.                 ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  1673.                 yDest% = (iY * 8) + m_arrLineTiles(iTileNum, iLoop).y1
  1674.  
  1675.                 ' Copy portion of source to the top-left corner of the destination page
  1676.                 _PutImage (xDest%, yDest%), _
  1677.                     imgPalette&, , _
  1678.                     (sx1%, sy1%)-(sx2%, sy2%)
  1679.             Next iLoop
  1680.         End If
  1681.     End If
  1682. End Sub ' DrawVectorTilePutImageHW
  1683.  
  1684. ' /////////////////////////////////////////////////////////////////////////////
  1685. ' Receives an array of _Unsigned Long RGB color values
  1686. ' and returns a new image imgNew
  1687. ' containing 8x8 squares with each color
  1688.  
  1689. ' Usage:
  1690. ' MakePaletteImage imgNew, arrColorRGB()
  1691.  
  1692. Sub MakePaletteImage (imgNew As Long, arrColorRGB() As _Unsigned Long)
  1693.     Dim tw% ' width/height of tile
  1694.     Dim iCount As Integer
  1695.     Dim iY As Integer
  1696.     Dim iX As Integer
  1697.     Dim iLoop1 As Integer
  1698.  
  1699.     tw% = 8 ' SIZE OF TILE
  1700.  
  1701.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  1702.  
  1703.     iY = tw%
  1704.     iX = ((UBound(arrColorRGB) - LBound(arrColorRGB)) + 1) * tw%
  1705.     If iX > 0 Then
  1706.         imgNew = _NewImage(iX, iY, 32)
  1707.         _Dest imgNew&
  1708.  
  1709.         iY = 0
  1710.         iCount = -1
  1711.         For iLoop1 = LBound(arrColorRGB) To UBound(arrColorRGB)
  1712.             iCount = iCount + 1
  1713.             iX = iCount * tw%
  1714.             Line (iX, iY)-(iX + 7, iY + 7), arrColorRGB(iCount), BF
  1715.         Next iLoop1
  1716.     End If
  1717. End Sub ' MakePaletteImage
  1718.  
  1719. ' /////////////////////////////////////////////////////////////////////////////
  1720.  
  1721. Sub MakePaletteImageTest
  1722.     Dim arrColor(0 To 7) As _Unsigned Long
  1723.     Dim imgPalette As Long ' contains palette of colors
  1724.     Dim imgScreen As Long ' the main display
  1725.  
  1726.     arrColor(0) = cBlack
  1727.     arrColor(1) = cRed
  1728.     arrColor(2) = cYellow
  1729.     arrColor(3) = cLime
  1730.     arrColor(4) = cCyan
  1731.     arrColor(5) = cBlue
  1732.     arrColor(6) = cPurple
  1733.     arrColor(7) = cMagenta
  1734.     'arrColor(8) = cEmpty
  1735.  
  1736.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1737.     Screen imgScreen
  1738.     Cls , cGray
  1739.  
  1740.     MakePaletteImage imgPalette, arrColor()
  1741.  
  1742.     ' Draw palette on screen:
  1743.     '_PutImage (xDest%, yDest%), imgSource&, imgDest&, (sx1%, sy1%)-(sx2%, sy2%)
  1744.     _PutImage (400, 300), imgPalette, imgScreen, (0, 0)-(_Width(imgPalette), _Height(imgPalette))
  1745.  
  1746.     ' Promput user
  1747.     _Dest imgScreen
  1748.     Color cWhite, cBlack
  1749.     'PrintString1 15, 1, "Press any key to continue"
  1750.     Locate 15, 1: Print "Press any key to continue";
  1751.     Sleep
  1752.  
  1753.     Screen 0 ' RETURN TO TEXT SCREEN
  1754.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  1755.  
  1756. End Sub ' MakePaletteImage
  1757.  
  1758. ' /////////////////////////////////////////////////////////////////////////////
  1759. ' Draw the shape with Line commands:
  1760.  
  1761. ' Requires that this global shared variable be declared:
  1762. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1763. ' containing
  1764. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1765. ' where for each tile, dimension 2 index 0:
  1766. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1767. ' holds the last used {iShapeNum} index.
  1768.  
  1769. Sub DrawVectorTileLine (iTileNum As Integer, iX As Integer, iY As Integer, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  1770.     If bgColor <> cEmpty Then
  1771.         Line (iX, iY)-(iX + 7, iY + 7), bgColor, BF
  1772.     End If
  1773.     Dim iLoop As Integer
  1774.     For iLoop = 1 To m_arrLineTiles(iTileNum, 0).PixelCount
  1775.         Line (iX+m_arrLineTiles(iTileNum, iLoop).x1, _
  1776.             iY+m_arrLineTiles(iTileNum, iLoop).y1 _
  1777.             )-(iX+m_arrLineTiles(iTileNum, iLoop).x2, _
  1778.             iY+m_arrLineTiles(iTileNum, iLoop).y2), _
  1779.             fgColor, BF
  1780.     Next iLoop
  1781. End Sub ' DrawVectorTileLine
  1782.  
  1783. ' /////////////////////////////////////////////////////////////////////////////
  1784. ' Get line drawing coordinates for 8x8 tileset.
  1785.  
  1786. ' Requires that this global shared variable be declared:
  1787. '     Dim Shared m_arrLineTiles(0 To 255, 0 To 32) As RectangleType
  1788. ' containing
  1789. '     m_arrLineTiles({iTileNum}, {iShapeNum})
  1790. ' where for each tile, dimension 2 index 0:
  1791. '     m_arrLineTiles({iTileNum}, 0).PixelCount
  1792. ' holds the last used {iShapeNum} index.
  1793.  
  1794. ' VECTOR TILE DRAWING EXPERIMENT
  1795.  
  1796. ' Translates an 8x8 raster tileset into a set of (hopefully)
  1797. ' optimized rectangle coordinates that can be quickly drawn to
  1798. ' the screen with Line.
  1799.  
  1800. ' GOAL: Optimize for each shape by determining how to draw it with the
  1801. ' minimum number of line commands.
  1802. '
  1803. ' For example this:
  1804. '     ' DRAW WITH HORIZONTAL LINES
  1805. '     Line (iX + 6, iY + 3)-(iX + 6, iY + 3), fgColor
  1806. '     Line (iX + 6, iY + 4)-(iX + 6, iY + 4), fgColor
  1807. ' could be replaced with:
  1808. '     ' DRAW WITH VERTICAL LINES
  1809. '     Line (iX + 6, iY + 3)-(iX + 6, iY + 4), fgColor
  1810.  
  1811. ' For each tile, we store a list of line coordinates (x1,y1,x2,y2)
  1812. ' in a 2D array, and draw using a simple drawing routine that
  1813. ' receives the list of coordinates, fgColor and bgColor,
  1814. ' and draws all shapes (solid rectangles) with Line.
  1815. ' If bgColor is not transparent and if we want a background color
  1816. ' then we first draw an 8x8 bgColor rectangle first and then
  1817. ' draw the shape on top of that.
  1818.  
  1819. ' Rather than compute this on the fly, we could precompute it and
  1820. ' for each given tile, store the list of those rectangle coordinates
  1821. ' (x1,y1,x2,y2) for drawing it indexed by the tile's definition in
  1822. ' hexidecimal where 16-bits (0-F) defines the bit pattern for each
  1823. ' row in the tile, therefore a tile's definition can be stored by
  1824. ' 8 characters (or less if we use base 64). Perhaps build a utility
  1825. ' that will compute the optimal drawing pattern for every possible
  1826. ' combination of an 8x8 grid, and index them all by the tile's 8-byte
  1827. ' hexidecimal definition. It might take a while to run, but once it
  1828. ' does, we will have a database of every possible tile's optimized
  1829. ' drawing instructions that can be quickly looked up.
  1830. ' Then we only pull out those definitions for the tiles that our
  1831. ' given program uses, so the data would be relatively small
  1832. ' (even smaller if we encode it with base-64).
  1833.  
  1834. ' TODO: maybe optimize with linked list?
  1835.  
  1836. Sub GetVectorTiles
  1837.     Dim RoutineName As String: RoutineName = "GetVectorTiles"
  1838.     ReDim arrTileText(0 To 255) As String
  1839.     ReDim arrShapes1(-1) As RectangleType
  1840.     Dim iTileNum As Integer
  1841.     Dim iLoop1 As Integer
  1842.     Dim sLine As String
  1843.     Dim iLen As Integer
  1844.  
  1845.     '' DEBUG
  1846.     'Dim sStartTime As String : sStartTime = "TBD"
  1847.     'Dim sEndTime As String : sEndTime = "TBD"
  1848.     'sStartTime = CurrentDateTime$
  1849.     'DebugPrint CurrentDateTime$ + " started " + RoutineName
  1850.  
  1851.     ' Get raster tiles as a string array
  1852.     GetTileText arrTileText()
  1853.  
  1854.     ' Get minimum set of Line coordinates for each tile
  1855.     For iTileNum = 0 To 255
  1856.         FindOptimizedVector arrTileText(iTileNum), arrShapes1()
  1857.  
  1858.         ' If we have coordinates, add it to the database
  1859.         If UBound(arrShapes1) > -1 Then
  1860.  
  1861.             'DebugPrint "#   x1   y1   x2   y2   Pixels    IsActive"
  1862.             'for iLoop1 = lbound(arrShapes1) to ubound(arrShapes1)
  1863.             '    sLine = ""
  1864.             '    sLine = sLine + left$(cstr$(iLoop1) + String$(4, " "), 4)
  1865.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).x1) + String$(2, " "), 2) + "   "
  1866.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).y1) + String$(2, " "), 2) + "   "
  1867.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).x2) + String$(2, " "), 2) + "   "
  1868.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).y2) + String$(2, " "), 2) + "   "
  1869.             '    sLine = sLine + left$(cstr$(arrShapes1(iLoop1).PixelCount) + String$(7, " "), 7) + "   "
  1870.             '    sLine = sLine + TrueFalse$(arrShapes1(iLoop1).IsActive)
  1871.             '    DebugPrint sLine
  1872.             'next iLoop1
  1873.  
  1874.             ' SAVE SHAPES TO TILE
  1875.             iLen = 0
  1876.             For iLoop1 = LBound(arrShapes1) To UBound(arrShapes1)
  1877.                 If arrShapes1(iLoop1).IsActive = TRUE Then
  1878.                     iLen = iLen + 1
  1879.  
  1880.                     ' NOTE: we do -1 because FindOptimizedVector does it 1-based,
  1881.                     '       don't ask me why, i was confused and don't want to
  1882.                     '       spend time right now to fix it,
  1883.                     '       but it saves math later to do 0-based
  1884.                     m_arrLineTiles(iTileNum, iLen).x1 = arrShapes1(iLoop1).x1 - 1
  1885.                     m_arrLineTiles(iTileNum, iLen).y1 = arrShapes1(iLoop1).y1 - 1
  1886.                     m_arrLineTiles(iTileNum, iLen).x2 = arrShapes1(iLoop1).x2 - 1
  1887.                     m_arrLineTiles(iTileNum, iLen).y2 = arrShapes1(iLoop1).y2 - 1
  1888.  
  1889.                     m_arrLineTiles(iTileNum, iLen).PixelCount = arrShapes1(iLoop1).PixelCount
  1890.                     m_arrLineTiles(iTileNum, iLen).IsActive = arrShapes1(iLoop1).IsActive
  1891.                 End If
  1892.             Next iLoop1
  1893.  
  1894.             ' MARK TILE (ubound 2, index 0) AS HAVING SHAPES + SAVE COUNT
  1895.             m_arrLineTiles(iTileNum, 0).IsActive = TRUE
  1896.             m_arrLineTiles(iTileNum, 0).PixelCount = iLen ' (iTileNum, 0).PixelCount stores the # of shapes
  1897.  
  1898.             ' DISABLE ANY REMAINING ENTRIES
  1899.             For iLoop1 = (iLen + 1) To UBound(m_arrLineTiles, 2)
  1900.                 m_arrLineTiles(iTileNum, iLoop1).IsActive = FALSE
  1901.             Next iLoop1
  1902.  
  1903.         Else
  1904.             ' This tile must have been blank
  1905.             'DebugPrint "*** NO SHAPES TO DRAW THIS TILE ***"
  1906.  
  1907.             ' MARK THIS TILE AS HAVING NO SHAPES
  1908.             m_arrLineTiles(iTileNum, 0).IsActive = FALSE
  1909.             m_arrLineTiles(iTileNum, 0).PixelCount = 0 ' (iTileNum, 0).PixelCount stores the # of shapes
  1910.         End If
  1911.     Next iTileNum
  1912.  
  1913.     '' DEBUG
  1914.     'sEndTime = CurrentDateTime$
  1915.     'DebugPrint RoutineName + " finished:"
  1916.     'DebugPrint "    started  at: " + sStartTime
  1917.     'DebugPrint "    finished at: " + sEndTime
  1918. End Sub ' GetVectorTiles
  1919.  
  1920. ' /////////////////////////////////////////////////////////////////////////////
  1921. ' 254 solid
  1922. ' 253 empty
  1923. ' 252 shaded
  1924. ' 241 bricks
  1925. ' 191 checker
  1926. ' 194 - 197 arrows u/d/l/r
  1927. ' 169 top left corner
  1928. ' 154 diamond
  1929. ' 155 +
  1930. ' 151 empty circle
  1931. ' 145 solid circle
  1932. ' 147 heart
  1933.  
  1934. Sub GetVectorTilesTest
  1935.     Dim imgScreen As Long ' the main display
  1936.     Dim MyString As String
  1937.     Dim iLoop As Integer
  1938.     Dim iTileNum As Integer
  1939.     Dim arrColor(0 To 8) As _Unsigned Long
  1940.     Dim iMinFgColorIndex As Integer: iMinFgColorIndex = 0
  1941.     Dim iMaxFgColorIndex As Integer: iMaxFgColorIndex = 7
  1942.     Dim iMinBgColorIndex As Integer: iMinBgColorIndex = 0
  1943.     Dim iMaxBgColorIndex As Integer: iMaxBgColorIndex = 8
  1944.     Dim iFgColorIndex As Integer: iFgColorIndex = iMinFgColorIndex
  1945.     Dim iBgColorIndex As Integer: iBgColorIndex = iMinBgColorIndex
  1946.     Dim iX As Integer
  1947.     Dim iY As Integer
  1948.     Dim iMinX As Integer
  1949.     Dim iMaxX As Integer
  1950.     Dim iMinY As Integer
  1951.     Dim iMaxY As Integer
  1952.  
  1953.     ' Initialize colors
  1954.     arrColor(0) = cBlack
  1955.     arrColor(1) = cRed
  1956.     arrColor(2) = cYellow
  1957.     arrColor(3) = cLime
  1958.     arrColor(4) = cCyan
  1959.     arrColor(5) = cBlue
  1960.     arrColor(6) = cPurple
  1961.     arrColor(7) = cMagenta
  1962.     arrColor(8) = cEmpty
  1963.  
  1964.     ' Set up screen
  1965.     imgScreen = _NewImage(1024, 768, 32): _ScreenMove 0, 0
  1966.     Screen imgScreen
  1967.     Cls , cGray
  1968.  
  1969.     ' Set up tiles
  1970.     GetVectorTiles
  1971.  
  1972.     ' Test text
  1973.     MyString = "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1974.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1975.         "HELLO WORLD " + chr$(147) + " " + chr$(154) + " " + chr$(191) + chr$(13) + _
  1976.         "THIS IS A TEST!"
  1977.  
  1978.     ' Set up screen boundaries, initial colors, etc.
  1979.     iMinX = 0: iMaxX = _Width(0) \ 8
  1980.     iMinY = 0: iMaxY = _Height(0) \ 8
  1981.     iFgColorIndex = iMinFgColorIndex - 1
  1982.     iY = 5
  1983.     iX = 5
  1984.     For iLoop = 1 To Len(MyString)
  1985.         iFgColorIndex = iFgColorIndex + 1: If iFgColorIndex > iMaxFgColorIndex Then iFgColorIndex = iMinFgColorIndex
  1986.         iBgColorIndex = iBgColorIndex + 1: If iBgColorIndex > iMaxBgColorIndex Then iBgColorIndex = iMinBgColorIndex
  1987.  
  1988.         iTileNum = Asc(Mid$(MyString, iLoop, 1))
  1989.         If iTileNum = 13 Then
  1990.             ' Linebreak = go to a new line
  1991.             iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1992.         Else
  1993.             'DrawVectorTileLine iTileNum, iX*8, iY*8, arrColor(iFgColorIndex), cEmpty
  1994.             DrawVectorTileLine iTileNum, iX * 8, iY * 8, arrColor(iFgColorIndex), arrColor(iBgColorIndex)
  1995.             iX = iX + 1: If iX > iMaxX Then iX = iMinX: iY = iY + 1: If iY > iMaxY Then iY = iMinY
  1996.         End If
  1997.  
  1998.     Next iLoop
  1999.  
  2000.     ' Promput user
  2001.     Color cWhite, cBlack: Locate 22, 1
  2002.     Print "Press any key to continue";
  2003.     Sleep
  2004.  
  2005.     Screen 0 ' RETURN TO TEXT SCREEN
  2006.     If imgScreen < -1 Or imgScreen > 0 Then _FreeImage imgScreen ' FREE MEMORY
  2007. End Sub ' GetVectorTilesTest
  2008.  
  2009. ' /////////////////////////////////////////////////////////////////////////////
  2010. ' Calculates and returns the coordinates for every possible rectangle shape
  2011. ' from 1-8 pixels high, and 1-8 pixels wide.
  2012.  
  2013. Sub GetAllPossibleShapes (arrShapes1() As RectangleType)
  2014.     ReDim arrShapes1(-1) As RectangleType
  2015.     Dim iLoopRows As Integer
  2016.     Dim iLoopCols As Integer
  2017.     Dim iIndex As Integer
  2018.     Dim iLoopY As Integer
  2019.     Dim iLoopX As Integer
  2020.  
  2021.     For iLoopRows = 1 To 8
  2022.         For iLoopCols = 1 To 8
  2023.             ' Add next shape to array
  2024.             iIndex = UBound(arrShapes1) + 1
  2025.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  2026.  
  2027.             ' Save coordinates
  2028.             arrShapes1(iIndex).x1 = 1
  2029.             arrShapes1(iIndex).y1 = 1
  2030.             arrShapes1(iIndex).x2 = iLoopCols
  2031.             arrShapes1(iIndex).y2 = iLoopRows
  2032.             arrShapes1(UBound(arrShapes1)).PixelCount = 0
  2033.  
  2034.             ' Count Pixels
  2035.             For iLoopY = 1 To 8
  2036.                 For iLoopX = 1 To 8
  2037.                     if _
  2038.                         iLoopY >= arrShapes1(iIndex).y1 _
  2039.                         and _
  2040.                         iLoopY <= arrShapes1(iIndex).y2 _
  2041.                         and _
  2042.                         iLoopX >= arrShapes1(iIndex).x1 _
  2043.                         and _
  2044.                         iLoopX <= arrShapes1(iIndex).x2 _
  2045.                         then
  2046.  
  2047.                         'sLine = sLine + "#"
  2048.                         arrShapes1(UBound(arrShapes1)).PixelCount = arrShapes1(UBound(arrShapes1)).PixelCount + 1
  2049.                     Else
  2050.                         'sLine = sLine + "."
  2051.                     End If
  2052.                 Next iLoopX
  2053.                 'DebugPrint sLine
  2054.             Next iLoopY
  2055.  
  2056.         Next iLoopCols
  2057.     Next iLoopRows
  2058. End Sub ' GetAllPossibleShapes
  2059.  
  2060. ' /////////////////////////////////////////////////////////////////////////////
  2061. ' Tests GetAllPossibleShapes to retrieve the coordinates for every possible
  2062. ' rectangle shape from 1-8 pixels high, and 1-8 pixels wide,
  2063. ' and uses Line to draw them on the screen.
  2064.  
  2065. Sub GetAllPossibleShapesTest
  2066.     ReDim arrShapes1(-1) As RectangleType
  2067.     Dim arrColor(0 To 7) As _Unsigned Long
  2068.     Dim iLoopShape As Integer
  2069.     Dim iOffsetY As Integer
  2070.     Dim iOffsetX As Integer
  2071.     Dim iColorIndex As Integer
  2072.     Dim iMinColorIndex As Integer: iMinColorIndex = 1
  2073.     Dim iMaxColorIndex As Integer: iMaxColorIndex = 7
  2074.     Dim in$
  2075.     Dim iX As Integer
  2076.     Dim iY As Integer
  2077.     Dim iSizeW As Integer
  2078.     Dim iSizeH As Integer
  2079.     Dim fgColor As _Unsigned Long
  2080.     Dim iMinX As Integer
  2081.     Dim iMinY As Integer
  2082.     Dim iMaxX As Integer
  2083.     Dim iMaxY As Integer
  2084.  
  2085.     Screen _NewImage(1280, 1024, 32): _ScreenMove 0, 0
  2086.     iMinX = 0
  2087.     iMinY = 17
  2088.     iMaxX = (_Width(0) / 8) ' iMaxX = _Width(0) - 16
  2089.     iMaxY = _Height(0) - 16
  2090.     iOffsetY = iMinY
  2091.     iOffsetX = iMinX
  2092.  
  2093.     arrColor(0) = cBlack
  2094.     arrColor(1) = cRed
  2095.     arrColor(2) = cYellow
  2096.     arrColor(3) = cLime
  2097.     arrColor(4) = cCyan
  2098.     arrColor(5) = cBlue
  2099.     arrColor(6) = cPurple
  2100.     arrColor(7) = cMagenta
  2101.  
  2102.     GetAllPossibleShapes arrShapes1()
  2103.  
  2104.     iColorIndex = iMinColorIndex
  2105.     For iLoopShape = 0 To UBound(arrShapes1)
  2106.         DebugPrint _
  2107.             "(" + cstr$(arrShapes1(iLoopShape).x1) + ", " + cstr$(arrShapes1(iLoopShape).y1) + ")-" + _
  2108.             "(" + cstr$(arrShapes1(iLoopShape).x2) + ", " + cstr$(arrShapes1(iLoopShape).y2) + ") " + _
  2109.             cstr$(arrShapes1(iLoopShape).PixelCount) + " pixels"
  2110.  
  2111.         iX = arrShapes1(iLoopShape).x1 + iOffsetX
  2112.         iY = arrShapes1(iLoopShape).y1 + iOffsetY
  2113.         iSizeW = (arrShapes1(iLoopShape).x2 - arrShapes1(iLoopShape).x1) + 1
  2114.         iSizeH = (arrShapes1(iLoopShape).y2 - arrShapes1(iLoopShape).y1) + 1
  2115.         fgColor = arrColor(iColorIndex)
  2116.         DrawRectSolid iX, iY, iSizeW, iSizeH, fgColor
  2117.  
  2118.         iOffsetX = iOffsetX + 16: If iOffsetX > iMaxX Then iOffsetX = iMinX: iOffsetY = iOffsetY + 16: If iOffsetY > iMaxY Then iOffsetY = iMinY
  2119.         iColorIndex = iColorIndex + 1: If iColorIndex > iMaxColorIndex Then iColorIndex = iMinColorIndex
  2120.     Next iLoopShape
  2121.  
  2122.     Locate 1, 1
  2123.     Color cWhite, cBlack
  2124.     Input "PRESS <ENTER> TO CONTINUE"; in$
  2125.     Screen 0
  2126. End Sub ' GetAllPossibleShapes
  2127.  
  2128. ' /////////////////////////////////////////////////////////////////////////////
  2129.  
  2130. Sub DumpNextShape (oShape As RectangleType, sVarName As String)
  2131.     Dim iLoopY As Integer
  2132.     Dim iLoopX As Integer
  2133.     Dim sLine As String
  2134.  
  2135.     If Len(sVarName) > 0 Then
  2136.         DebugPrint sVarName + ":"
  2137.     Else
  2138.         DebugPrint "RectangleType:"
  2139.     End If
  2140.  
  2141.     DebugPrint _
  2142.         "(" + cstr$(oShape.x1) + ", " + cstr$(oShape.y1) + ")-" + _
  2143.         "(" + cstr$(oShape.x2) + ", " + cstr$(oShape.y2) + ") " + _
  2144.         cstr$(oShape.PixelCount) + " pixels, " + _
  2145.         "IsActive=" + TrueFalse$(oShape.IsActive)
  2146.  
  2147.     For iLoopY = 1 To 8
  2148.         sLine = ""
  2149.         For iLoopX = 1 To 8
  2150.             if _
  2151.                 iLoopY >= oShape.y1 _
  2152.                 and _
  2153.                 iLoopY <= oShape.y2 _
  2154.                 and _
  2155.                 iLoopX >= oShape.x1 _
  2156.                 and _
  2157.                 iLoopX <= oShape.x2 _
  2158.                 then
  2159.  
  2160.                 sLine = sLine + "#"
  2161.             Else
  2162.                 sLine = sLine + "."
  2163.             End If
  2164.         Next iLoopX
  2165.         DebugPrint sLine
  2166.     Next iLoopY
  2167.     DebugPrint ""
  2168. End Sub ' DumpNextShape
  2169.  
  2170. ' /////////////////////////////////////////////////////////////////////////////
  2171. ' Dump all shapes in array.
  2172.  
  2173. ' {i} in sVarName is replaced by array index
  2174.  
  2175. Sub DumpShapeList (arrShapes() As RectangleType, sVarName As String)
  2176.     Dim iLoop1 As Integer
  2177.     Dim sNextVarName As String
  2178.  
  2179.     For iLoop1 = 0 To UBound(arrShapes3)
  2180.         sNextVarName = Replace$(sVarName, "{i}", cstr$(iLoop1))
  2181.         DumpNextShape arrShapes(iLoop1), sVarName
  2182.     Next iLoop1
  2183. End Sub ' DumpShapeList
  2184.  
  2185. ' /////////////////////////////////////////////////////////////////////////////
  2186. ' Receives an array of shapes
  2187. '
  2188. Sub GetActiveShapes (arrShapes2() As RectangleType, arrShapes3() As RectangleType)
  2189.     Dim iLoopShape As Integer
  2190.     Dim iIndex As Integer
  2191.     ReDim arrShapes3(-1) As RectangleType
  2192.     For iLoopShape = 0 To UBound(arrShapes2)
  2193.         If arrShapes2(iLoopShape).IsActive = TRUE Then
  2194.             iIndex = UBound(arrShapes3) + 1
  2195.             ReDim _Preserve arrShapes3(0 To iIndex) As RectangleType
  2196.             arrShapes3(iIndex).y1 = arrShapes2(iLoopShape).y1
  2197.             arrShapes3(iIndex).x1 = arrShapes2(iLoopShape).x1
  2198.             arrShapes3(iIndex).y2 = arrShapes2(iLoopShape).y2
  2199.             arrShapes3(iIndex).x2 = arrShapes2(iLoopShape).x2
  2200.             arrShapes3(iIndex).PixelCount = arrShapes2(iLoopShape).PixelCount
  2201.             arrShapes3(iIndex).IsActive = arrShapes2(iLoopShape).IsActive
  2202.         End If
  2203.     Next iLoopShape
  2204. End Sub ' GetActiveShapes
  2205.  
  2206. ' /////////////////////////////////////////////////////////////////////////////
  2207.  
  2208. Function DelimIntegerListsAreEqual% (sList1 As String, sList2 As String, sDelim As String)
  2209.     Dim bResult As Integer: bResult = FALSE
  2210.     Dim arrList1(-1) As Integer
  2211.     Dim arrList2(-1) As Integer
  2212.     Dim iLoop1 As Integer
  2213.     Dim iLoop2 As Integer
  2214.     Dim bFound As Integer
  2215.  
  2216.     ' Convert delimited lists into integer arrays
  2217.     GetIntegerArrayFromDelimList sList1, sDelim, 0, arrList1()
  2218.     GetIntegerArrayFromDelimList sList2, sDelim, 0, arrList2()
  2219.  
  2220.     ' Are lists same size?
  2221.     If UBound(arrList1) = UBound(arrList2) Then
  2222.         bResult = TRUE
  2223.     End If
  2224.  
  2225.     ' Check list #2 against list #1
  2226.     If bResult = TRUE Then
  2227.         ' Are all items in list #1 in list #2?
  2228.         For iLoop1 = LBound(arrList1) To UBound(arrList1)
  2229.             bFound = FALSE
  2230.             For iLoop2 = LBound(arrList2) To UBound(arrList2)
  2231.                 If arrList2(iLoop2) = arrList1(iLoop1) Then
  2232.                     bFound = TRUE
  2233.                     Exit For
  2234.                 End If
  2235.             Next iLoop2
  2236.             If bFound = FALSE Then
  2237.                 ' not found, lists not equal
  2238.                 bResult = FALSE
  2239.                 Exit For
  2240.             End If
  2241.         Next iLoop1
  2242.     End If
  2243.  
  2244.     ' Check list #1 against list #2
  2245.     If bResult = TRUE Then
  2246.         For iLoop1 = LBound(arrList2) To UBound(arrList2)
  2247.             bFound = FALSE
  2248.             For iLoop2 = LBound(arrList1) To UBound(arrList1)
  2249.                 If arrList1(iLoop2) = arrList2(iLoop1) Then
  2250.                     bFound = TRUE
  2251.                     Exit For
  2252.                 End If
  2253.             Next iLoop2
  2254.             If bFound = FALSE Then
  2255.                 ' not found, lists not equal
  2256.                 bResult = FALSE
  2257.                 Exit For
  2258.             End If
  2259.         Next iLoop1
  2260.     End If
  2261.  
  2262.     ' Return results
  2263.     DelimIntegerListsAreEqual% = bResult
  2264. End Function ' DelimIntegerListsAreEqual%
  2265.  
  2266. ' /////////////////////////////////////////////////////////////////////////////
  2267.  
  2268. ' DumpTileFromShapes arrShapes1(), bIncludeInactive, bShowRowsAndColumns
  2269.  
  2270. Sub DumpTileFromShapes (arrShapes1() As RectangleType, bIncludeInactive As Integer, bShowRowsAndColumns As Integer)
  2271.     ReDim arrTile1(1 To 8, 1 To 8) As String
  2272.     Dim iDestY As Integer
  2273.     Dim iDestX As Integer
  2274.     Dim iLoop1 As Integer
  2275.     Dim sLine As String
  2276.  
  2277.     ' Initialize next tile
  2278.     For iDestY = 1 To 8: For iDestX = 1 To 8: arrTile1(iDestY, iDestX) = ".": Next iDestX: Next iDestY
  2279.  
  2280.     ' Draw all (active) shapes onto tile
  2281.     For iLoop1 = LBound(arrShapes1) To UBound(arrShapes1)
  2282.         If arrShapes1(iLoop1).IsActive = TRUE Or bIncludeInactive = TRUE Then
  2283.             For iDestY = 1 To 8
  2284.                 For iDestX = 1 To 8
  2285.                     If iDestY >= arrShapes1(iLoop1).y1 Then
  2286.                         If iDestY <= arrShapes1(iLoop1).y2 Then
  2287.                             If iDestX >= arrShapes1(iLoop1).x1 Then
  2288.                                 If iDestX <= arrShapes1(iLoop1).x2 Then
  2289.                                     arrTile1(iDestY, iDestX) = "#"
  2290.                                 End If
  2291.                             End If
  2292.                         End If
  2293.                     End If
  2294.                 Next iDestX
  2295.             Next iDestY
  2296.         End If
  2297.     Next iLoop1
  2298.  
  2299.     ' Output the shape
  2300.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2301.     For iDestY = 1 To 8
  2302.         sLine = ""
  2303.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2304.         For iDestX = 1 To 8
  2305.             sLine = sLine + arrTile1(iDestY, iDestX)
  2306.         Next iDestX
  2307.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2308.         DebugPrint sLine
  2309.     Next iDestY
  2310.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2311.  
  2312. End Sub ' DumpTileFromShapes
  2313.  
  2314. ' /////////////////////////////////////////////////////////////////////////////
  2315.  
  2316. ' DumpTile arrTile1(), bShowRowsAndColumns
  2317.  
  2318. Sub DumpTile (arrTile1( 1 To 8 , 1 To 8) As String, bShowRowsAndColumns As Integer)
  2319.     Dim iDestY As Integer
  2320.     Dim iDestX As Integer
  2321.     Dim sLine As String
  2322.  
  2323.     ' Output the tile
  2324.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2325.     For iDestY = 1 To 8
  2326.         sLine = ""
  2327.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2328.         For iDestX = 1 To 8
  2329.             sLine = sLine + arrTile1(iDestY, iDestX)
  2330.         Next iDestX
  2331.         If bShowRowsAndColumns = TRUE Then sLine = sLine + cstr$(iDestY)
  2332.         DebugPrint sLine
  2333.     Next iDestY
  2334.     If bShowRowsAndColumns = TRUE Then DebugPrint " 12345678"
  2335. End Sub ' DumpTile
  2336.  
  2337. ' /////////////////////////////////////////////////////////////////////////////
  2338. ' Receives an 8x8 raster tile definition and returns a list of coordinates
  2339. ' for the minimum number of rectangles to draw that tile.
  2340.  
  2341. ' This version uses a brute force method, ie draw every size rectangle
  2342. ' from 1x1 up to 8x8 (which can themselves be precalculated) in every
  2343. ' available location in the 8x8 grid (where no part of any rectangle falls
  2344. ' off the grid), then tries every combination of those rectangles to find
  2345. ' the combination where the the minimum number of rectangles cover all
  2346. ' points (or if 2 combinations have the same # of rectangles, the one that
  2347. ' covers the lesser total points).
  2348.  
  2349. ' (You can try searching for "rectangular decomposition of binary images"
  2350. ' and similar to find a better algorithm.)
  2351.  
  2352. ' Receives:
  2353. ' TileString (String) = contains 8x8 raster tile definition as a string, where
  2354. '                       empty space represended by ".",
  2355. '                       pixel represented by any non-whitespace character,
  2356. '                       each row separated by chr$(13).
  2357. ' Returns (byref):
  2358. ' arrOptimizedShapes (array of RectangleType) = array of rectangle coordinates
  2359. '                       defining the shapes that will draw the tile.
  2360. '
  2361. ' Return value = empty string if successful, error message if not.
  2362.  
  2363. Sub FindOptimizedVector (TileString As String, arrShapes1() As RectangleType)
  2364.     Dim RoutineName As String: RoutineName = "FindOptimizedVector"
  2365.     Dim bContinue As Integer: bContinue = TRUE
  2366.     ReDim arrTile1(1 To 8, 1 To 8) As String
  2367.     ReDim arrTile2(1 To 8, 1 To 8) As String
  2368.     ReDim arrShapes2(-1) As RectangleType
  2369.     ReDim arrCompare(-1) As DrawCompareType
  2370.     Dim oShapeSet As DrawCompareType
  2371.     Dim iLoopY As Integer
  2372.     Dim iLoopX As Integer
  2373.     Dim iDestY As Integer
  2374.     Dim iDestX As Integer
  2375.     Dim iSizeY As Integer
  2376.     Dim iSizeX As Integer
  2377.     Dim iEndY As Integer
  2378.     Dim iEndX As Integer
  2379.     Dim iTestY As Integer
  2380.     Dim iTestX As Integer
  2381.     Dim bShapeFits As Integer
  2382.     Dim iLoop1 As Integer
  2383.     Dim iLoop2 As Integer
  2384.     Dim iIndex As Integer
  2385.     Dim sItemList As String
  2386.     Dim iShapeCount As Integer
  2387.     Dim iPixelCount As Integer
  2388.     Dim bFinished As Integer
  2389.     Dim sCompare As String
  2390.     ReDim arrTestIndex(-1) As Integer
  2391.     Dim iShapeIndex As Integer
  2392.     Dim iRound As Integer
  2393.     Dim sLine As String
  2394.  
  2395.     '' ****************************************************************************************************************************************************************
  2396.     '' DEBUG:
  2397.     'Dim sStartTime As String : sStartTime = CurrentDateTime$
  2398.     'Dim sEndTime As String : sEndTime = ""
  2399.     'DebugPrint sStartTime + " started " + RoutineName
  2400.     '' ****************************************************************************************************************************************************************
  2401.  
  2402.     ' =============================================================================
  2403.     ' INITIALIZE
  2404.     If bContinue = TRUE Then
  2405.         ' -----------------------------------------------------------------------------
  2406.         ' Init results
  2407.         ReDim arrShapes1(-1) As RectangleType
  2408.  
  2409.         ' -----------------------------------------------------------------------------
  2410.         ' Turn tile into 2D array
  2411.         StringTo2dArray arrTile1(), TileString
  2412.  
  2413.         ' -----------------------------------------------------------------------------
  2414.         ' Count pixels
  2415.         iPixelCount = 0
  2416.         For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  2417.             For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  2418.                 If arrTile1(iLoopY, iLoopX) <> "." Then
  2419.                     iPixelCount = iPixelCount + 1
  2420.                 End If
  2421.             Next iLoopX
  2422.         Next iLoopY
  2423.  
  2424.         ' If shape is blank no need to continue looking
  2425.         ' we can just return an empty array
  2426.         If iPixelCount = 0 Then
  2427.             bContinue = FALSE
  2428.         End If
  2429.     End If
  2430.  
  2431.     ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2432.     ' BEGIN LOOK FOR MINIMUM COMBINATION OF SHAPES TO DRAW TILE
  2433.     If bContinue = TRUE Then
  2434.         ' =============================================================================
  2435.         ' Get a set of every size shape (rectangle) from 1x1 up to 8x8
  2436.         GetAllPossibleShapes arrShapes1()
  2437.         'DebugPrint "ALL POSSIBLE SHAPES:"
  2438.         'DumpShapeList arrShapes1(), "arrShapes1{i}"
  2439.  
  2440.         ' =============================================================================
  2441.         ' Try each shape in every location on the tile, to see which fit
  2442.         For iLoop1 = 0 To UBound(arrShapes1)
  2443.             ' Try plotting next shape in every position
  2444.             For iDestY = 1 To 8
  2445.                 For iDestX = 1 To 8
  2446.                     ' Track whether shape is fully on the tile at this position
  2447.                     bShapeFits = FALSE
  2448.  
  2449.                     ' Does shape fit at this Y position?
  2450.                     iSizeY = arrShapes1(iLoop1).y2 - arrShapes1(iLoop1).y1
  2451.                     iEndY = iDestY + iSizeY
  2452.                     If iEndY < 9 Then
  2453.                         ' Does shape fit at this X position?
  2454.                         iSizeX = arrShapes1(iLoop1).x2 - arrShapes1(iLoop1).x1
  2455.                         iEndX = iDestX + iSizeX
  2456.                         If iEndX < 9 Then
  2457.                             ' The shape is fully on the tile here
  2458.                             bShapeFits = TRUE
  2459.  
  2460.                             ' Now see if any of shape's pixels fall outside of tile's pixels?
  2461.                             For iTestY = iDestY To iEndY
  2462.                                 For iTestX = iDestX To iEndX
  2463.                                     If arrTile1(iTestY, iTestX) = "." Then
  2464.                                         ' No pixel here, shape fails
  2465.                                         bShapeFits = FALSE
  2466.                                         Exit For
  2467.                                     End If
  2468.                                 Next iTestX
  2469.                                 If bShapeFits = FALSE Then Exit For
  2470.                             Next iTestY
  2471.                         End If
  2472.                     End If
  2473.  
  2474.                     ' If shape fits, add it to the list of shapes/positions that work for the tile
  2475.                     If bShapeFits = TRUE Then
  2476.                         iIndex = UBound(arrShapes2) + 1
  2477.                         ReDim _Preserve arrShapes2(0 To iIndex) As RectangleType
  2478.                         arrShapes2(iIndex).y1 = iDestY
  2479.                         arrShapes2(iIndex).x1 = iDestX
  2480.                         arrShapes2(iIndex).y2 = iEndY
  2481.                         arrShapes2(iIndex).x2 = iEndX
  2482.                         arrShapes2(iIndex).PixelCount = arrShapes1(iLoop1).PixelCount
  2483.                         arrShapes2(iIndex).IsActive = TRUE
  2484.                     End If
  2485.                 Next iDestX
  2486.             Next iDestY
  2487.         Next iLoop1
  2488.  
  2489.         ' Eliminate non-active shapes
  2490.         GetActiveShapes arrShapes2(), arrShapes1()
  2491.  
  2492.         'DebugPrint "ALL SHAPES/LOCATIONS THAT MATCHED + FIT:"
  2493.         'DumpShapeList arrShapes2(), "arrShapes2{i}"
  2494.  
  2495.         ' =============================================================================
  2496.         ' Remove redundant shapes (any where another shape covers more points)
  2497.  
  2498.         For iLoop1 = 0 To UBound(arrShapes1)
  2499.             ' make sure shape #1 was not eliminated
  2500.             If arrShapes1(iLoop1).IsActive = TRUE Then
  2501.                 ' compare shape #1 against all other shapes
  2502.                 For iLoop2 = 0 To UBound(arrShapes1)
  2503.                     ' don't compare against itself
  2504.                     If iLoop2 <> iLoop1 Then
  2505.                         ' make sure shape #2 was not eliminated
  2506.                         If arrShapes1(iLoop2).IsActive = TRUE Then
  2507.                             ' can shape #2 do what shape #1 can do? (covers all points shape #1 does)
  2508.                             if _
  2509.                                 arrShapes1(iLoop1).y1 >= arrShapes1(iLoop2).y1 _
  2510.                                 and _
  2511.                                 arrShapes1(iLoop1).y2 <= arrShapes1(iLoop2).y2 _
  2512.                                 and _
  2513.                                 arrShapes1(iLoop1).x1 >= arrShapes1(iLoop2).x1 _
  2514.                                 and _
  2515.                                 arrShapes1(iLoop1).x2 <= arrShapes1(iLoop2).x2 _
  2516.                                 then
  2517.  
  2518.                                 ' does shape #2 do it better? (cover more points than shape #1)
  2519.                                 If arrShapes1(iLoop2).PixelCount >= arrShapes1(iLoop1).PixelCount Then
  2520.                                     ' Remove shape #1
  2521.                                     arrShapes1(iLoop1).IsActive = FALSE
  2522.                                 End If
  2523.                             End If
  2524.                         End If
  2525.                     End If
  2526.                 Next iLoop2
  2527.             End If
  2528.         Next iLoop1
  2529.  
  2530.         ' Eliminate non-active shapes
  2531.         GetActiveShapes arrShapes1(), arrShapes2()
  2532.  
  2533.         'DebugPrint "SHAPES THAT MATCHED + FIT, NON-REDUNDANT LEVEL 1:"
  2534.         'DumpShapeList arrShapes2(), "arrShapes2{i}"
  2535.  
  2536.     End If
  2537.  
  2538.     ' =============================================================================
  2539.     ' Can we do without any?
  2540.     ' Compare all combinations subtractively:
  2541.  
  2542.     ' 1. Count enabled shapes + total pixels for full list of shapes "set A".
  2543.     ' 2. Save "set A" to the "contender list",
  2544.     '    with the shape count and total pixel count.
  2545.     ' 3. For each shape "x":
  2546.     '    a) see if full tile can still be drawn without "x"
  2547.     '       (where the set of shapes minus "x" is "set y").
  2548.     '    b) If full tile can be drawn, save "set y" to the "contender list"
  2549.     '       with the shape count and total pixel count.
  2550.     ' 4. When done, identify the winner "set z" that can draw the full tile
  2551.     '    using the minimum shape coverage.
  2552.     '    a) The set with the smallest tile count wins.
  2553.     '    b) In the event of a tie, the set with the least total pixel count wins.
  2554.     '    c) In the event of another tie, just use the first finalist.
  2555.     ' 5. Disable all shapes NOT in the winning "set z".
  2556.     ' 6. Save list of enabled shapes to "last winner".
  2557.     ' 7. Repeat steps 1-5 until, comparing the list of enabled shapes to
  2558.     '    the list "last winner". When the list stops changing (lists are equal),
  2559.     '    we have gone as far as we can go.
  2560.     ' 8. Return shapes in "last winner" as final result.
  2561.  
  2562.     If bContinue = TRUE Then
  2563.  
  2564.         ' -----------------------------------------------------------------------------
  2565.         ' Start with all
  2566.         ' 1. Count enabled shapes + total pixels for full list of shapes "set A".
  2567.         ' 2. Save "set A" to the "contender list",
  2568.         '    with the shape count and total pixel count.
  2569.         sItemList = ""
  2570.         iShapeCount = 0
  2571.         iPixelCount = 0
  2572.         For iLoop1 = LBound(arrShapes2) To UBound(arrShapes2)
  2573.             sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iLoop1)
  2574.             iShapeCount = iShapeCount + 1
  2575.             iPixelCount = iPixelCount + arrShapes2(iLoop1).PixelCount
  2576.         Next iLoop1
  2577.  
  2578.         oShapeSet.IndexList = sItemList
  2579.         oShapeSet.ShapeCount = iShapeCount
  2580.         oShapeSet.PixelCount = iPixelCount
  2581.         oShapeSet.IsActive = TRUE
  2582.  
  2583.         ' -----------------------------------------------------------------------------
  2584.         ' Now see which combinations can draw the tile
  2585.  
  2586.         iRound = 0
  2587.         bFinished = FALSE
  2588.         Do
  2589.             ' At the top of the loop, oShapeSet contains the latest set of shapes
  2590.             iRound = iRound + 1
  2591.  
  2592.             ' Get the list of shapes (indexes pointing to each shape in arrShapes2)
  2593.             ' All this packing and unpacking probably wastes cycles
  2594.             ' It might not be necessary if we had arrays inside of types!
  2595.             GetIntegerArrayFromDelimList oShapeSet.IndexList, ",", 0, arrTestIndex()
  2596.  
  2597.             ' Clear the list of contenders
  2598.             ReDim arrCompare(-1) As DrawCompareType
  2599.  
  2600.             '' ****************************************************************************************************************************************************************
  2601.             'DebugPrint "################################################################################################################################################################"
  2602.             'DebugPrint "Round " + cstr$(iRound) + " shapes to dedupe:"
  2603.             'for iLoop2 = lbound(arrTestIndex) to ubound(arrTestIndex)
  2604.             '    iIndex = arrTestIndex(iLoop2)
  2605.             '    DumpNextShape arrShapes2(iIndex), "Shape " + cstr$(iIndex) + " round " + cstr$(iRound) + ""
  2606.             '    DebugPrint ""
  2607.             'Next iLoop2
  2608.             'DebugPrint "################################################################################################################################################################"
  2609.             '' ****************************************************************************************************************************************************************
  2610.  
  2611.             ' 3. For each shape "x":
  2612.             '    a) see if full tile can still be drawn without "x"
  2613.             '       (where the set of shapes minus "x" is "set y").
  2614.             '    b) If full tile can be drawn, save "set y" to the "contender list"
  2615.             '       with the shape count and total pixel count.
  2616.             For iLoop1 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2617.  
  2618.                 ''DEBUG:
  2619.                 'DebugPrint "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
  2620.                 'DebugPrint "Can we eliminate " + cstr$(iLoop1) ' this shape?"
  2621.                 'DumpNextShape arrShapes2(iLoop1), "arrShapes2(" + cstr$(iLoop1) + ")"
  2622.                 'DebugPrint "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
  2623.                 'DebugPrint ""
  2624.  
  2625.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2626.                 ' Clear test tile
  2627.                 ReDim arrTile2(1 To 8, 1 To 8) As String
  2628.                 For iDestY = 1 To 8
  2629.                     For iDestX = 1 To 8
  2630.                         arrTile2(iDestY, iDestX) = "."
  2631.                     Next iDestX
  2632.                 Next iDestY
  2633.  
  2634.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2635.                 ' Try drawing next combination of shapes in the test tile
  2636.                 sItemList = ""
  2637.                 iShapeCount = 0
  2638.                 iPixelCount = 0
  2639.                 For iLoop2 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2640.  
  2641.                     ' Make sure it's not shape "x"
  2642.                     If iLoop2 <> iLoop1 Then
  2643.                         iIndex = arrTestIndex(iLoop2)
  2644.  
  2645.                         sItemList = sItemList + IIFSTR$(Len(sItemList) = 0, "", ",") + cstr$(iIndex)
  2646.                         iShapeCount = iShapeCount + 1
  2647.                         iPixelCount = iPixelCount + arrShapes2(iIndex).PixelCount
  2648.  
  2649.                         For iDestY = 1 To 8
  2650.                             For iDestX = 1 To 8
  2651.                                 If iDestY >= arrShapes2(iIndex).y1 Then
  2652.                                     If iDestY <= arrShapes2(iIndex).y2 Then
  2653.                                         If iDestX >= arrShapes2(iIndex).x1 Then
  2654.                                             If iDestX <= arrShapes2(iIndex).x2 Then
  2655.                                                 arrTile2(iDestY, iDestX) = "#"
  2656.                                             End If
  2657.                                         End If
  2658.                                     End If
  2659.                                 End If
  2660.                             Next iDestX
  2661.                         Next iDestY
  2662.                     End If
  2663.                 Next iLoop2
  2664.  
  2665.                 ''DebugPrint "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  2666.                 ''DebugPrint "Attempted drawing tile without " + cstr$(iLoop1) ' item #" + cstr$(iLoop1)
  2667.                 ''DumpTile arrTile2(), TRUE
  2668.                 'DebugPrint "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  2669.                 'DebugPrint ""
  2670.                 'DebugPrint "RESULT$:"
  2671.                 iShapeIndex = arrTestIndex(iLoop1)
  2672.  
  2673.                 ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2674.                 ' Does the test tile match the real tile?
  2675.                 sCompare = TilesAreEqual$(arrTile1(), arrTile2())
  2676.                 If Len(sCompare) = 0 Then
  2677.                     ' Add to the list of contenders
  2678.                     iIndex = UBound(arrCompare) + 1
  2679.                     ReDim _Preserve arrCompare(0 To iIndex) As DrawCompareType
  2680.                     arrCompare(iIndex).IndexList = sItemList
  2681.                     arrCompare(iIndex).ShapeCount = iShapeCount
  2682.                     arrCompare(iIndex).PixelCount = iPixelCount
  2683.                     arrCompare(iIndex).IsActive = TRUE
  2684.  
  2685.                     'DebugPrint "*******************************************************************************"
  2686.                     'DebugPrint "YES: Tile can be drawn without shape " + cstr$(iShapeIndex) + " round " + cstr$(iRound)
  2687.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").IndexList  = " + sItemList
  2688.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").ShapeCount = " + cstr$(iShapeCount)
  2689.                     'DebugPrint "arrCompare(" + cstr$(iIndex) + ").PixelCount = " + cstr$(PixelCount)
  2690.                     'DebugPrint "*******************************************************************************"
  2691.  
  2692.                     'else
  2693.                     'DebugPrint "*******************************************************************************"
  2694.                     'DebugPrint "NOPE: Tile cannot be drawn without shape " + cstr$(iShapeIndex) + " round " + cstr$(iRound)
  2695.                     'DebugPrint sCompare
  2696.                     'DebugPrint "Attempted with:"
  2697.                     'DebugPrint ".IndexList  = " + sItemList
  2698.                     'DebugPrint ".ShapeCount = " + cstr$(iShapeCount)
  2699.                     'DebugPrint ".PixelCount = " + cstr$(PixelCount)
  2700.                     'DebugPrint "*******************************************************************************"
  2701.                 End If
  2702.  
  2703.             Next iLoop1
  2704.  
  2705.             ' =============================================================================
  2706.             ' Identify the best combination that uses the least # of shapes + pixels
  2707.  
  2708.             ' DEDUPE IF THERE ARE >1 GROUPS
  2709.             If UBound(arrCompare) > LBound(arrCompare) Then
  2710.  
  2711.                 '' ****************************************************************************************************************************************************************
  2712.                 ''DEBUG:
  2713.                 'DebugPrint "RESULTS BEFORE DEDUPE:"
  2714.                 'sLine = ","
  2715.                 'for iLoop2 = lbound(arrCompare) to ubound(arrCompare)
  2716.                 '    if arrCompare(iLoop2).IsActive = TRUE then
  2717.                 '        sLine = sLine + cstr$(iLoop2) + ","
  2718.                 '        DebugPrint "-------------------------------------------------------------------------------"
  2719.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IndexList  = " + arrCompare(iLoop2).IndexList
  2720.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").ShapeCount = " + cstr$(arrCompare(iLoop2).ShapeCount)
  2721.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").PixelCount = " + cstr$(arrCompare(iLoop2).PixelCount)
  2722.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IsActive   = " + TrueFalse$(arrCompare(iLoop2).IsActive)
  2723.                 '    end if
  2724.                 'next iLoop2
  2725.                 'DebugPrint ""
  2726.                 '' ****************************************************************************************************************************************************************
  2727.  
  2728.                 For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  2729.                     For iLoop2 = LBound(arrCompare) To UBound(arrCompare)
  2730.                         If iLoop1 <> iLoop2 Then
  2731.                             If arrCompare(iLoop1).IsActive = TRUE Then
  2732.                                 If arrCompare(iLoop2).IsActive = TRUE Then
  2733.                                     If arrCompare(iLoop2).ShapeCount < arrCompare(iLoop1).ShapeCount Then
  2734.                                         arrCompare(iLoop1).IsActive = FALSE
  2735.                                     ElseIf arrCompare(iLoop2).ShapeCount > arrCompare(iLoop1).ShapeCount Then
  2736.                                         arrCompare(iLoop2).IsActive = FALSE
  2737.                                     Else
  2738.                                         If arrCompare(iLoop2).PixelCount < arrCompare(iLoop1).PixelCount Then
  2739.                                             arrCompare(iLoop1).IsActive = FALSE
  2740.                                         ElseIf arrCompare(iLoop2).PixelCount > arrCompare(iLoop1).PixelCount Then
  2741.                                             arrCompare(iLoop2).IsActive = FALSE
  2742.                                         Else
  2743.                                             arrCompare(iLoop2).IsActive = FALSE
  2744.                                         End If
  2745.                                     End If
  2746.                                 End If
  2747.                             End If
  2748.                         End If
  2749.                     Next iLoop2
  2750.                 Next iLoop1
  2751.  
  2752.                 '' ****************************************************************************************************************************************************************
  2753.                 ''DEBUG:
  2754.                 'DebugPrint "RESULTS AFTER DEDUPE:"
  2755.                 'for iLoop2 = lbound(arrCompare) to ubound(arrCompare)
  2756.                 '    if InStr(1, sLine, "," + cstr$(iLoop2) + ",") > 0 then
  2757.                 '        DebugPrint "-------------------------------------------------------------------------------"
  2758.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IndexList  = " + arrCompare(iLoop2).IndexList
  2759.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").ShapeCount = " + cstr$(arrCompare(iLoop2).ShapeCount)
  2760.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").PixelCount = " + cstr$(arrCompare(iLoop2).PixelCount)
  2761.                 '        DebugPrint "arrCompare(" + cstr$(iLoop2) + ").IsActive   = " + TrueFalse$(arrCompare(iLoop2).IsActive)
  2762.                 '    end if
  2763.                 'next iLoop2
  2764.                 'DebugPrint ""
  2765.                 '' ****************************************************************************************************************************************************************
  2766.  
  2767.             End If
  2768.  
  2769.             ' =============================================================================
  2770.             ' Identify the winner!
  2771.             ' Look at the list of indexes that make up the winning shape combination,
  2772.             ' and pick the first one.
  2773.  
  2774.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2775.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2776.             'DebugPrint "LOOK FOR THE WINNER, END ROUND " + cstr$(iRound)
  2777.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2778.             'DebugPrint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
  2779.             iIndex = -1
  2780.  
  2781.             'DebugPrint "arrCompare(" + cstr$(lbound(arrCompare)) + " To " + cstr$(ubound(arrCompare)) + ")"
  2782.             'DebugPrint ""
  2783.  
  2784.             'DebugPrint "Group   Status"
  2785.             'DebugPrint "-----   ----------"
  2786.             For iLoop1 = LBound(arrCompare) To UBound(arrCompare)
  2787.                 If arrCompare(iLoop1).IsActive = TRUE Then
  2788.                     If iIndex = -1 Then
  2789.                         iIndex = iLoop1
  2790.                         Exit For
  2791.                         '            DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "IsActive WINNER"
  2792.                         '        else
  2793.                         '            DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "IsActive"
  2794.                     End If
  2795.                     '    else
  2796.                     '        DebugPrint left$(cstr$(iLoop1) + "     ", 5) + "   " + "(disabled)"
  2797.                 End If
  2798.             Next iLoop1
  2799.             'DebugPrint ""
  2800.  
  2801.             ' =============================================================================
  2802.             ' Has it changed from the last round?
  2803.             'DebugPrint "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
  2804.             'DebugPrint "Has it changed from the last round?"
  2805.             'DebugPrint "iIndex=" + cstr$(iIndex)
  2806.             'DebugPrint "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
  2807.             'DebugPrint ""
  2808.  
  2809.             If iIndex > -1 Then
  2810.                 'DebugPrint "Comparing arrCompare(" + cstr$(iIndex) + ").IndexList: " + arrCompare(iIndex).IndexList
  2811.                 'DebugPrint "       to oShapeSet.IndexList: " + oShapeSet.IndexList
  2812.                 'DebugPrint ""
  2813.  
  2814.                 If DelimIntegerListsAreEqual%(arrCompare(iIndex).IndexList, oShapeSet.IndexList, ",") = TRUE Then
  2815.                     'DebugPrint "DelimIntegerListsAreEqual% returns TRUE"
  2816.                     'DebugPrint "FOUND WINNER (Group #" + cstr$(iIndex) + ") exiting..."
  2817.                     ' no change, we have reduced as much as possible, exit
  2818.                     bFinished = TRUE
  2819.                 Else
  2820.                     'DebugPrint "DelimIntegerListsAreEqual% returns FALSE"
  2821.                     'DebugPrint "None yet, try next data"
  2822.                     'DebugPrint "Replacing old best set: "
  2823.                     'DebugPrint "    IndexList=" + oShapeSet.IndexList
  2824.                     'DebugPrint "    ShapeCount=" + cstr$(oShapeSet.ShapeCount)
  2825.                     'DebugPrint "    PixelCount=" + cstr$(oShapeSet.PixelCount)
  2826.                     'DebugPrint "    IsActive  =" + TrueFalse$(oShapeSet.IsActive)
  2827.                     'DebugPrint "with arrCompare(" + cstr$(iIndex) + ")"
  2828.                     'DebugPrint "    IndexList=" + arrCompare(iIndex).IndexList
  2829.                     'DebugPrint "    ShapeCount=" + cstr$(arrCompare(iIndex).ShapeCount)
  2830.                     'DebugPrint "    PixelCount=" + cstr$(arrCompare(iIndex).PixelCount)
  2831.                     'DebugPrint "    IsActive  =" + TrueFalse$(arrCompare(iIndex).IsActive)
  2832.                     'DebugPrint "and continuing to compare..."
  2833.  
  2834.                     ' Continue reducing with the latest set
  2835.                     oShapeSet.IndexList = arrCompare(iIndex).IndexList
  2836.                     oShapeSet.ShapeCount = arrCompare(iIndex).ShapeCount
  2837.                     oShapeSet.PixelCount = arrCompare(iIndex).PixelCount
  2838.                     oShapeSet.IsActive = TRUE
  2839.                 End If
  2840.             Else
  2841.                 'DebugPrint "(NONE FOUND THAT WORKED, USE THE EXISTING oShapeSet)"
  2842.                 'DebugPrint "Replacing old best set: "
  2843.                 'DebugPrint "    oShapeSet.IndexList=" + oShapeSet.IndexList
  2844.                 'DebugPrint "    oShapeSet.ShapeCount=" + cstr$(oShapeSet.ShapeCount)
  2845.                 'DebugPrint "    oShapeSet.PixelCount=" + cstr$(oShapeSet.PixelCount)
  2846.                 'DebugPrint "    oShapeSet.IsActive  =" + TrueFalse$(oShapeSet.IsActive)
  2847.                 ' none found that works, exit
  2848.                 bFinished = TRUE
  2849.             End If
  2850.  
  2851.         Loop Until bFinished = TRUE
  2852.  
  2853.         ' =============================================================================
  2854.         ' Build results
  2855.  
  2856.         ' Get the list of shapes (indexes pointing to each shape in arrShapes1)
  2857.         GetIntegerArrayFromDelimList oShapeSet.IndexList, ",", 0, arrTestIndex()
  2858.  
  2859.         ' Initialize the final output
  2860.         ReDim arrShapes1(-1) As RectangleType
  2861.  
  2862.         ' Add the shapes to the final list
  2863.         For iLoop2 = LBound(arrTestIndex) To UBound(arrTestIndex)
  2864.             iShapeIndex = arrTestIndex(iLoop2)
  2865.  
  2866.             iIndex = UBound(arrShapes1) + 1
  2867.             ReDim _Preserve arrShapes1(0 To iIndex) As RectangleType
  2868.  
  2869.             'DebugPrint "Copying arrShapes2(" + cstr$(iShapeIndex) + ") to arrShapes1(" + cstr$(iIndex) + "):"
  2870.  
  2871.             If arrShapes2(iShapeIndex).IsActive = TRUE Then
  2872.                 arrShapes1(iIndex).x1 = arrShapes2(iShapeIndex).x1
  2873.                 arrShapes1(iIndex).y1 = arrShapes2(iShapeIndex).y1
  2874.                 arrShapes1(iIndex).x2 = arrShapes2(iShapeIndex).x2
  2875.                 arrShapes1(iIndex).y2 = arrShapes2(iShapeIndex).y2
  2876.                 arrShapes1(iIndex).PixelCount = arrShapes2(iShapeIndex).PixelCount
  2877.                 arrShapes1(iIndex).IsActive = arrShapes2(iShapeIndex).IsActive
  2878.  
  2879.                 ''DEBUG:
  2880.                 'DumpNextShape arrShapes1(iIndex), "arrShapes1(" + cstr$(iIndex) + ")"
  2881.  
  2882.             End If
  2883.         Next iLoop2
  2884.  
  2885.     End If
  2886.     ' END LOOK FOR MINIMUM COMBINATION OF SHAPES TO DRAW TILE
  2887.     ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2888.  
  2889.     '' ****************************************************************************************************************************************************************
  2890.     '' DEBUG:
  2891.     'DumpTileFromShapes arrShapes1(), FALSE, TRUE
  2892.     '
  2893.     'sEndTime = CurrentDateTime$
  2894.     'DebugPrint RoutineName + " finished:"
  2895.     'DebugPrint "    started  at: " + sStartTime
  2896.     'DebugPrint "    finished at: " + sEndTime
  2897.     '' ****************************************************************************************************************************************************************
  2898.  
  2899. End Sub ' FindOptimizedVector
  2900.  
  2901. ' /////////////////////////////////////////////////////////////////////////////
  2902. ' Test routine for the FindOptimizedVector routine.
  2903.  
  2904. Sub FindOptimizedVectorTest
  2905.     Dim RoutineName As String: RoutineName = "FindOptimizedVectorTest"
  2906.     Dim sError As String: sError = ""
  2907.     Dim in$
  2908.     ReDim arrTileText(0 To 255) As String
  2909.     Dim sTestList As String
  2910.     ReDim arrTestIndex(-1) As Integer
  2911.     Dim iLoop1 As Integer
  2912.     Dim iLoop2 As Integer
  2913.     Dim iIndex As Integer
  2914.     ReDim arrOptimizedShapes(-1) As RectangleType
  2915.     Dim sLine As String
  2916.  
  2917.     ' Start output
  2918.     DebugPrint "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  2919.     DebugPrint "Testing tiles: " + sTestList
  2920.     DebugPrint ""
  2921.  
  2922.     ' Get raster tiles as a string array
  2923.     GetTileText arrTileText()
  2924.  
  2925.     ' List of tiles to test
  2926.     'sTestList = "254,253,247,32,238,241,225,233,213,214,212,203,194,193,192,169,154,151,145,147,129,115,114,84,65,46,44,35,252"
  2927.     'sTestList = "46,35"
  2928.     'sTestList = "84,253,192,151,147,114,65"
  2929.     'sTestList = "43,44,45,46"
  2930.     'sTestList = "60,62" ' 84 + 192 work, the rest don't
  2931.     'sTestList = "254,252"
  2932.     sTestList = "84,60,62,75,141,142,150,207,217,252,192" ' 84 + 192 work, the rest don't
  2933.     'sTestList = "60,62,75,141,142,150,207,217,252" ' 84 + 192 work, the rest don't
  2934.     'sTestList="75"
  2935.     'DebugPrint "GETTING LIST OF TILES..."
  2936.     GetIntegerArrayFromDelimList sTestList, ",", 0, arrTestIndex()
  2937.  
  2938.     ' Test tiles
  2939.     For iIndex = 0 To 255
  2940.         'for iLoop1 = lbound(arrTestIndex) to ubound(arrTestIndex)
  2941.         '    iIndex = arrTestIndex(iLoop1)
  2942.         DebugPrint "----------------------------------------------------------------------------------------------------------------------------------------------------------------"
  2943.         DebugPrint "Tile #" + cstr$(iIndex) + ":"
  2944.         DebugPrint arrTileText(iIndex)
  2945.         DebugPrint ""
  2946.  
  2947.         ' Process next tile and generate line drawing routines
  2948.         FindOptimizedVector arrTileText(iIndex), arrOptimizedShapes()
  2949.  
  2950.         If Len(sError) = 0 Then
  2951.             If UBound(arrOptimizedShapes) > -1 Then
  2952.                 DebugPrint "#   x1   y1   x2   y2   Pixels    IsActive"
  2953.                 For iLoop2 = LBound(arrOptimizedShapes) To UBound(arrOptimizedShapes)
  2954.                     sLine = ""
  2955.                     sLine = sLine + Left$(cstr$(iLoop2) + String$(4, " "), 4)
  2956.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).x1) + String$(2, " "), 2) + "   "
  2957.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).y1) + String$(2, " "), 2) + "   "
  2958.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).x2) + String$(2, " "), 2) + "   "
  2959.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).y2) + String$(2, " "), 2) + "   "
  2960.                     sLine = sLine + Left$(cstr$(arrOptimizedShapes(iLoop2).PixelCount) + String$(7, " "), 7) + "   "
  2961.                     sLine = sLine + TrueFalse$(arrOptimizedShapes(iLoop2).IsActive)
  2962.                     DebugPrint sLine
  2963.                 Next iLoop2
  2964.             Else
  2965.                 DebugPrint "*** NO SHAPES TO DRAW THIS TILE ***"
  2966.             End If
  2967.         Else
  2968.             DebugPrint "ERROR FOR TILE #" + cstr$(iIndex) + ": " + sError
  2969.         End If
  2970.         DebugPrint ""
  2971.         'next iLoop1
  2972.     Next iIndex
  2973.  
  2974.     ' DONE
  2975.     DebugPrint RoutineName + " finished."
  2976.     'Input "PRESS <ENTER> TO CONTINUE";in$
  2977. End Sub ' FindOptimizedVectorTest
  2978.  
  2979. ' /////////////////////////////////////////////////////////////////////////////
  2980. ' Receives two 2D string arrays and compares the dimensions
  2981. ' and makes sure that the any blank pixel value "." matches
  2982. ' (any other non-whitespace characters are considered a pixel
  2983. ' as long as they are not "." they are considered a match).
  2984. ' Returns empty string if they match, else returns a difference report.
  2985.  
  2986. Function TilesAreEqual$ (arrTile1() As String, arrTile2() As String)
  2987.     Dim sResult As String: sResult = ""
  2988.     Dim iLoopY As Integer
  2989.     Dim iLoopX As Integer
  2990.     Dim sTemp As String
  2991.     Dim bMatch As Integer
  2992.     Dim iY As Integer
  2993.  
  2994.     If LBound(arrTile1, 1) = LBound(arrTile2, 1) Then
  2995.         If UBound(arrTile1, 1) = UBound(arrTile2, 1) Then
  2996.             If LBound(arrTile1, 2) = LBound(arrTile2, 2) Then
  2997.                 If UBound(arrTile1, 2) = UBound(arrTile2, 2) Then
  2998.                     bMatch = TRUE
  2999.                     sTemp = " 12345678 " + Chr$(13)
  3000.                     iY = 0
  3001.                     For iLoopY = LBound(arrTile1, 1) To UBound(arrTile1, 1)
  3002.                         iY = iY + 1
  3003.                         sTemp = sTemp + cstr$(iY)
  3004.                         For iLoopX = LBound(arrTile1, 2) To UBound(arrTile1, 2)
  3005.                             If arrTile1(iLoopY, iLoopX) = "." And arrTile2(iLoopY, iLoopX) <> "." Then
  3006.                                 bMatch = FALSE
  3007.                                 sTemp = sTemp + "?"
  3008.                             ElseIf arrTile1(iLoopY, iLoopX) <> "." And arrTile2(iLoopY, iLoopX) = "." Then
  3009.                                 bMatch = FALSE
  3010.                                 sTemp = sTemp + "?"
  3011.                             Else
  3012.                                 sTemp = sTemp + arrTile1(iLoopY, iLoopX)
  3013.                             End If
  3014.                         Next iLoopX
  3015.                         sTemp = sTemp + cstr$(iY) + Chr$(13)
  3016.                     Next iLoopY
  3017.                     sTemp = sTemp + " 12345678 " + Chr$(13)
  3018.                     If bMatch = FALSE Then
  3019.                         sResult = sTemp
  3020.                     End If
  3021.                 Else
  3022.                     sResult = "ubound(arrTile1, 2)=" + cstr$(ubound(arrTile1, 2)) + _
  3023.                         " <> " + _
  3024.                         "ubound(arrTile2, 2)=" + cstr$(ubound(arrTile2, 2))
  3025.                 End If
  3026.             Else
  3027.                 sResult = "lbound(arrTile1, 2)=" + cstr$(lbound(arrTile1, 2)) + _
  3028.                     " <> " + _
  3029.                     "lbound(arrTile2, 2)=" + cstr$(lbound(arrTile2, 2))
  3030.  
  3031.             End If
  3032.         Else
  3033.             sResult = "ubound(arrTile1, 1)=" + cstr$(ubound(arrTile1, 1)) + _
  3034.                 " <> " + _
  3035.                 "ubound(arrTile2, 1)=" + cstr$(ubound(arrTile2, 1))
  3036.         End If
  3037.     Else
  3038.         sResult = "lbound(arrTile1, 1)=" + cstr$(lbound(arrTile1, 1)) + _
  3039.             " <> " + _
  3040.             "lbound(arrTile2, 1)=" + cstr$(lbound(arrTile2, 1))
  3041.     End If
  3042.     TilesAreEqual$ = sResult
  3043. End Function ' TilesAreEqual$
  3044.  
  3045. ' ################################################################################################################################################################
  3046. ' END VECTOR-BASED TILE ROUTINES
  3047. ' ################################################################################################################################################################
  3048.  
  3049. ' ################################################################################################################################################################
  3050. ' BEGIN BOX DRAWING ROUTINES
  3051. ' ################################################################################################################################################################
  3052.  
  3053. ' /////////////////////////////////////////////////////////////////////////////
  3054. ' DRAW A 2-D BOX (OUTLINE)
  3055. ' https://www.qb64.org/wiki/LINE
  3056.  
  3057. Sub DrawBoxOutline (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  3058.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, B ' Draw box outline
  3059. End Sub ' DrawBoxOutline
  3060.  
  3061. ' /////////////////////////////////////////////////////////////////////////////
  3062. ' DRAW A 2-D BOX (SOLID)
  3063. ' https://www.qb64.org/wiki/LINE
  3064.  
  3065. ' Renamed DrawBox/DrawBoxLine to DrawSolidBox
  3066.  
  3067. Sub DrawBoxSolid (iX As Integer, iY As Integer, iSize As Integer, fgColor As _Unsigned Long)
  3068.     Line (iX, iY)-(iX + (iSize - 1), iY + (iSize - 1)), fgColor, BF ' Draw a solid box
  3069. End Sub ' DrawBoxSolid
  3070.  
  3071. ' /////////////////////////////////////////////////////////////////////////////
  3072. ' DRAW A 2-D RECTANGLE (OUTLINE)
  3073.  
  3074. Sub DrawRectOutline (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  3075.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, B ' Draw rectangle outline
  3076. End Sub ' DrawRectOutline
  3077.  
  3078. ' /////////////////////////////////////////////////////////////////////////////
  3079. ' DRAW A 2-D RECTANGLE (SOLID)
  3080.  
  3081. Sub DrawRectSolid (iX As Integer, iY As Integer, iSizeW As Integer, iSizeH As Integer, fgColor As _Unsigned Long)
  3082.     Line (iX, iY)-(iX + (iSizeW - 1), iY + (iSizeH - 1)), fgColor, BF ' Draw a solid rectangle
  3083. End Sub ' DrawRectSolid
  3084.  
  3085. ' /////////////////////////////////////////////////////////////////////////////
  3086. ' DRAW A 2-D BOX (OUTLINE)
  3087. ' https://www.qb64.org/wiki/LINE
  3088.  
  3089. ' The style parameter 0-255 doesn't seem to have a solid line?
  3090. ' For that, use DrawOutlineBox.
  3091.  
  3092. ' LINE [STEP] [(column1, row1)]-[STEP] (column2, row2), color[, [{B|BF}], style%]
  3093. ' B creates a box outline with each side parallel to the program screen sides. BF creates a filled box.
  3094. ' The style% signed INTEGER value sets a dotted pattern to draw the line or rectangle outline.
  3095.  
  3096. Sub DrawStyledOutlineBox (iX%, iY%, iSize%, iColor~&, iStyle%)
  3097.     Line (iX%, iY%)-(iX% + (iSize% - 1), iY% + (iSize% - 1)), iColor~&, B , iStyle%
  3098. End Sub ' DrawStyledOutlineBox
  3099.  
  3100. ' /////////////////////////////////////////////////////////////////////////////
  3101. ' DRAW A 2-D BOX (OUTLINE) WITH A SOLID LINE
  3102.  
  3103. Sub DrawOutlineBox (iX%, iY%, iSize2%, iColor~&, iWeight2%)
  3104.     Dim iFromX%
  3105.     Dim iFromY%
  3106.     Dim iToX%
  3107.     Dim iToY%
  3108.     iSize% = iSize2% - 1
  3109.     iWeight% = iWeight2% - 1
  3110.     If iWeight% = 0 Then
  3111.         ' TOP LINE
  3112.         iFromX% = iX%
  3113.         iFromY% = iY%
  3114.         iToX% = iX% + iSize%
  3115.         iToY% = iY%
  3116.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3117.  
  3118.         ' BOTTOM LINE
  3119.         iFromX% = iX%
  3120.         iFromY% = iY% + iSize%
  3121.         iToX% = iX% + iSize%
  3122.         iToY% = iY% + iSize%
  3123.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3124.  
  3125.         ' LEFT LINE
  3126.         iFromX% = iX%
  3127.         iFromY% = iY%
  3128.         iToX% = iX%
  3129.         iToY% = iY% + iSize%
  3130.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3131.  
  3132.         ' RIGHT LINE
  3133.         iFromX% = iX% + iSize%
  3134.         iFromY% = iY%
  3135.         iToX% = iX% + iSize%
  3136.         iToY% = iY% + iSize%
  3137.         Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3138.     ElseIf iWeight% > 0 Then
  3139.         ' TOP LINE
  3140.         For iFromY% = iY% To (iY% + iWeight%)
  3141.             iFromX% = iX%
  3142.             'iFromY% = iY%
  3143.             iToX% = iX% + iSize%
  3144.             iToY% = iFromY%
  3145.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3146.         Next iFromY%
  3147.  
  3148.         ' BOTTOM LINE
  3149.         For iFromY% = ((iY% + iSize%) - iWeight%) To (iY% + iSize%)
  3150.             iFromX% = iX%
  3151.             'iFromY% = iY% + iSize%
  3152.             iToX% = iX% + iSize%
  3153.             iToY% = iFromY%
  3154.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3155.         Next iFromY%
  3156.  
  3157.         ' LEFT LINE
  3158.         For iFromX% = iX% To (iX% + iWeight%)
  3159.             'iFromX% = iX%
  3160.             iFromY% = iY%
  3161.             iToX% = iFromX%
  3162.             iToY% = iY% + iSize%
  3163.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3164.         Next iFromX%
  3165.  
  3166.         ' RIGHT LINE
  3167.         For iFromX% = ((iX% + iSize%) - iWeight%) To (iX% + iSize%)
  3168.             'iFromX% = iX% + iSize%
  3169.             iFromY% = iY%
  3170.             iToX% = iFromX%
  3171.             iToY% = iY% + iSize%
  3172.             Line (iFromX%, iFromY%)-(iToX%, iToY%), iColor~&, BF
  3173.         Next iFromX%
  3174.     End If
  3175. End Sub ' DrawOutlineBox
  3176.  
  3177. ' ################################################################################################################################################################
  3178. ' END BOX DRAWING ROUTINES
  3179. ' ################################################################################################################################################################
  3180.  
  3181. ' ################################################################################################################################################################
  3182. ' BEGIN DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  3183. ' ################################################################################################################################################################
  3184.  
  3185. ' /////////////////////////////////////////////////////////////////////////////
  3186. ' Same as DrawColorTile but using hardware images.
  3187.  
  3188. ' Receives:
  3189. ' imgTiles& = handle to 16x16 tile sheet of 16x16 pixel tiles colored black (256 tiles)
  3190. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  3191. ' TileColor~& = color to use for tile
  3192. ' imgScreen& = handle to screen to draw tile on
  3193. ' dx% = column # to draw tile at (where each column is 16 pixels wide)
  3194. ' dy% = row # to draw tile at (where each row is 16 pixels high)
  3195. ' xOffset% = offset tile this many columns over
  3196. ' yOffset% = offset tile this many rows down
  3197.  
  3198. Sub DrawColorTileHW ( _
  3199.     imgHardwareScreen As Long, _
  3200.     imgTiles As Long, _
  3201.     iTileNum As Integer, _
  3202.     fgColor As _UNSIGNED Long, _
  3203.     bgColor As _UNSIGNED Long, _
  3204.     dx As Integer, _
  3205.     dy As Integer)
  3206.  
  3207.     Dim cols%
  3208.     Dim rows%
  3209.     Dim sc%
  3210.     Dim sr%
  3211.     Dim sx1%
  3212.     Dim sy1%
  3213.     Dim sx2%
  3214.     Dim sy2%
  3215.     Dim xDest%
  3216.     Dim yDest%
  3217.     Dim imgColorSprite As Long
  3218.     Dim imgUniversalSprite As Long
  3219.     Dim imgColorSpriteHW As Long
  3220.     Dim imgUniversalSpriteHW As Long
  3221.  
  3222.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3223.     cols% = 16
  3224.     rows% = 16
  3225.  
  3226.     ' GET THE COLUMN/ROW OF TILE # iTileNum ON THE SOURCE TILE SHEET
  3227.     sc% = iTileNum Mod rows%
  3228.     sr% = iTileNum \ rows%
  3229.  
  3230.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3231.     sx1% = sc% * 8
  3232.  
  3233.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3234.     sy1% = sr% * 8
  3235.  
  3236.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3237.     sx2% = sx1% + 7
  3238.  
  3239.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3240.     sy2% = sy1% + 7
  3241.  
  3242.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3243.     xDest% = dx * 8
  3244.  
  3245.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3246.     yDest% = dy * 8
  3247.  
  3248.     ' IS THERE A BACKGROUND COLOR?
  3249.     If bgColor <> cEmpty Then
  3250.         imgColorSprite = _NewImage(8, 8, 32)
  3251.         imgColorSpriteHW = _CopyImage(imgColorSprite, 33) ' Copy for hardware image
  3252.         '_Dest imgColorSprite
  3253.         _Dest imgColorSpriteHW
  3254.         Cls , bgColor
  3255.  
  3256.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  3257.         '_Source imgColorSprite
  3258.         _Source imgColorSpriteHW
  3259.         _Dest imgHardwareScreen
  3260.  
  3261.         'SOFTWARE IMAGE:
  3262.         '_PutImage (xDest%, yDest%), imgColorSprite, imgHardwareScreen, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3263.  
  3264.         'HARDWARE IMAGE:
  3265.         _PutImage (xDest%, yDest%), imgColorSpriteHW, , (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3266.     End If
  3267.  
  3268.     ' CREATE A TEMPORARY TILE TO COLOR
  3269.     imgUniversalSprite = _NewImage(8, 8, 32)
  3270.  
  3271.     ' COPY THE TILE TO THE TEMPORARY ONE
  3272.     _Source imgHardwareTiles
  3273.     _Dest imgUniversalSprite
  3274.     'SOFTWARE IMAGE:
  3275.     '_PutImage (0, 0), imgTiles, imgUniversalSprite, (sx1%, sy1%)-(sx2%, sy2%)
  3276.  
  3277.     'HARDWARE IMAGE:
  3278.     _PutImage (0, 0), imgHardwareTiles, , (sx1%, sy1%)-(sx2%, sy2%)
  3279.  
  3280.     ' COLOR IN THE TEMPORARY TILE
  3281.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  3282.  
  3283.     'SOFTWARE IMAGE:
  3284.     'IF imgColorSprite < -1 OR imgColorSprite > 0 THEN _FreeImage imgColorSprite
  3285.     'DoColorSwap imgUniversalSprite, cBlack, fgColor, imgColorSprite
  3286.  
  3287.     'HARDWARE IMAGE:
  3288.     DoColorSwapHW imgUniversalSpriteHW, cBlack, fgColor, imgColorSpriteHW
  3289.  
  3290.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgHardwareScreen
  3291.     _Source imgColorSpriteHW
  3292.     _Dest imgHardwareScreen
  3293.  
  3294.     'SOFTWARE IMAGE:
  3295.     '_PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  3296.  
  3297.     'HARDWARE IMAGE:
  3298.     _PutImage (xDest%, yDest%), imgColorSprite, , (0, 0)-(7, 7)
  3299.  
  3300.     ' ADDED PER FellipeHeitor
  3301.     If imgHardwareTiles < -1 Or imgHardwareTiles > 0 Then _FreeImage imgHardwareTiles
  3302.     If imgColorSprite < -1 Or imgColorSprite > 0 Then _FreeImage imgColorSprite
  3303.     If imgColorSpriteHW < -1 Or imgColorSpriteHW > 0 Then _FreeImage imgColorSpriteHW
  3304.     If imgUniversalSprite < -1 Or imgUniversalSprite > 0 Then _FreeImage imgUniversalSprite
  3305.     If imgUniversalSpriteHW < -1 Or imgUniversalSpriteHW > 0 Then _FreeImage imgUniversalSpriteHW
  3306.  
  3307. End Sub ' DrawColorTileHW
  3308.  
  3309. ' /////////////////////////////////////////////////////////////////////////////
  3310. ' Same as DoColorSwap but using hardware images.
  3311.  
  3312. ' Latest version with NOVARSEG's changes.
  3313. ' Based on code from:
  3314. ' Image color swap?
  3315. ' https://www.qb64.org/forum/index.php?topic=2312.0
  3316.  
  3317. ' Like Function swapcolor& except returns new image in a parameter
  3318. ' in case being a function causes a memory leak?
  3319.  
  3320. Sub DoColorSwapHW ( _
  3321.     imgOriginalHW As Long, _
  3322.     oldColor As _UNSIGNED Long, _
  3323.     newColor As _UNSIGNED Long, _
  3324.     imgNewHW As Long)
  3325.  
  3326.     Dim m As _MEM
  3327.     Dim a As _Offset
  3328.     Dim imgNew As Long
  3329.  
  3330.     a = 0
  3331.     imgNew = _CopyImage(imgOriginalHW, 32)
  3332.     m = _MemImage(imgNewHW)
  3333.     Do Until a = m.SIZE - 4
  3334.         a = a + 4
  3335.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  3336.         If c = oldColor Then
  3337.             _MemPut m, m.OFFSET + a, newColor
  3338.         End If
  3339.     Loop
  3340.     _MemFree m
  3341. End Sub ' DoColorSwapHW
  3342.  
  3343. ' ################################################################################################################################################################
  3344. ' END DRAW TILES, COLOR SWAP with HARDWARE IMAGES
  3345. ' ################################################################################################################################################################
  3346.  
  3347. ' ################################################################################################################################################################
  3348. ' BEGIN DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  3349. ' ################################################################################################################################################################
  3350.  
  3351. ' /////////////////////////////////////////////////////////////////////////////
  3352. ' Simple version which calculates coordinates on tile sheet and destination
  3353. ' screen every time. For a faster version uses precalculated coordinates,
  3354. ' see DrawColorTileFast. This version does not support offsetX, offsetY.
  3355.  
  3356. ' Receives:
  3357. ' imgScreen& = handle to screen to draw tile on
  3358. ' imgTiles& = handle to 16x16 tile sheet of 8x8 pixel tiles colored black (256 tiles)
  3359. ' TileNum% = ordinal number of tile on tile sheet to draw (0-255)
  3360. ' TileColor~& = foreground color to use for tile
  3361. ' BackColor~& = background color to use for tile
  3362. ' dx% = column # to draw tile at (where each column is 8 pixels wide)
  3363. ' dy% = row # to draw tile at (where each row is 8 pixels high)
  3364.  
  3365. ' Usage:
  3366. ' DrawColorTile imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%
  3367.  
  3368. Sub DrawColorTile (imgScreen&, imgTiles&, TileNum%, TileColor~&, BackColor~&, dx%, dy%)
  3369.     Dim cols%
  3370.     Dim rows%
  3371.     Dim sc%
  3372.     Dim sr%
  3373.     Dim sx1%
  3374.     Dim sy1%
  3375.     Dim sx2%
  3376.     Dim sy2%
  3377.     Dim xDest%
  3378.     Dim yDest%
  3379.     Dim ColorSprite&
  3380.     Dim UniversalSprite&
  3381.  
  3382.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3383.     cols% = 16
  3384.     rows% = 16
  3385.  
  3386.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3387.     sc% = TileNum% Mod rows%
  3388.     sr% = TileNum% \ rows%
  3389.  
  3390.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3391.     sx1% = sc% * 8
  3392.  
  3393.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3394.     sy1% = sr% * 8
  3395.  
  3396.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3397.     sx2% = sx1% + 7
  3398.  
  3399.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3400.     sy2% = sy1% + 7
  3401.  
  3402.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3403.     xDest% = dx% * 8
  3404.  
  3405.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3406.     yDest% = dy% * 8
  3407.  
  3408.     ' IS THERE A BACKGROUND COLOR?
  3409.     If BackColor~& <> cEmpty Then
  3410.         ColorSprite& = _NewImage(8, 8, 32)
  3411.         _Dest ColorSprite&
  3412.         Cls , BackColor~&
  3413.  
  3414.         ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  3415.         _Source ColorSprite&
  3416.         _Dest imgScreen&
  3417.         _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3418.     End If
  3419.  
  3420.     ' CREATE A TEMPORARY TILE TO COLOR
  3421.     UniversalSprite& = _NewImage(8, 8, 32)
  3422.  
  3423.     ' COPY THE TILE TO THE TEMPORARY ONE
  3424.     _Source imgTiles&
  3425.     _Dest UniversalSprite&
  3426.     _PutImage (0, 0), imgTiles&, UniversalSprite&, (sx1%, sy1%)-(sx2%, sy2%)
  3427.  
  3428.     ' COLOR IN THE TEMPORARY TILE
  3429.     ' REPLACING BLACK (THE SOURCE COLOR) WITH THE TILE COLOR
  3430.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  3431.     DoColorSwap UniversalSprite&, cBlack, TileColor~&, ColorSprite&
  3432.  
  3433.     ' COPY THE TEMPORARY TILE TO THE SCREEN imgScreen&
  3434.     _Source ColorSprite&
  3435.     _Dest imgScreen&
  3436.     _PutImage (xDest%, yDest%), ColorSprite&, imgScreen&, (0, 0)-(7, 7) ' portion of source to the top-left corner of the destination page
  3437.  
  3438.     ' ADDED PER FellipeHeitor
  3439.     If ColorSprite& < -1 Or ColorSprite& > 0 Then _FreeImage ColorSprite&
  3440.     If UniversalSprite& < -1 Or UniversalSprite& > 0 Then _FreeImage UniversalSprite&
  3441. End Sub ' DrawColorTile
  3442.  
  3443. ' /////////////////////////////////////////////////////////////////////////////
  3444. ' Latest version with NOVARSEG's changes.
  3445.  
  3446. ' Based on code from:
  3447.  
  3448. ' Image color swap?
  3449. ' https://www.qb64.org/forum/index.php?topic=2312.0
  3450.  
  3451. ' Like Function swapcolor& except returns new image in a parameter
  3452. ' in case being a function causes a memory leak?
  3453.  
  3454. Sub DoColorSwap (imgOriginal&, oldcolor~&, newcolor~&, imgNew&)
  3455.     Dim m As _MEM
  3456.     Dim a As _Offset
  3457.     a = 0
  3458.     imgNew& = _CopyImage(imgOriginal&, 32)
  3459.     m = _MemImage(imgNew&)
  3460.     Do Until a = m.SIZE - 4
  3461.         a = a + 4
  3462.         c = _MemGet(m, m.OFFSET + a, _Unsigned Long)
  3463.         If c = oldcolor~& Then
  3464.             _MemPut m, m.OFFSET + a, newcolor~&
  3465.         End If
  3466.     Loop
  3467.     _MemFree m
  3468. End Sub ' DoColorSwap&
  3469.  
  3470. ' ################################################################################################################################################################
  3471. ' END DRAW TILES, COLOR SWAP with SOFTWARE IMAGES
  3472. ' ################################################################################################################################################################
  3473.  
  3474. ' ################################################################################################################################################################
  3475. ' BEGIN DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  3476. ' ################################################################################################################################################################
  3477.  
  3478. ' /////////////////////////////////////////////////////////////////////////////
  3479. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  3480.  
  3481. ' Original version which calculates coordinates on tile sheet and destination
  3482. ' screen every time. For a faster version uses precalculated coordinates,
  3483. ' see DrawTileFast.
  3484.  
  3485. ' tw% = tile width/height (in pixels)
  3486.  
  3487. ' DIV and MOD:
  3488. ' c% = a% \ b% ' DIV (INTEGER DIVISION)
  3489. ' d% = a% MOD b% ' MODULO (DIVISION REMAINDER)
  3490.  
  3491. '_PUTIMAGE (0, 0), i ' places image at upper left corner of window w/o stretching it
  3492. '_PUTIMAGE (dx1, dy1), sourceHandle&, destHandle&, (sx1, sy1)-(sx2, sy2) ' portion of source to the top-left corner of the destination page
  3493. '_PUTIMAGE (64,  128), imgTiles&,      imgScreen&,   (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  3494. '_PutImage (64, 128), imgTiles&, imgScreen&, (128, 128)-(164, 164) ' portion of source to the top-left corner of the destination page
  3495.  
  3496. Sub DrawTile8 (imgTiles&, TileNum%, imgScreen&, dx%, dy%)
  3497.     Dim tw% ' width/height of tile
  3498.     Dim tw_minus1% ' width/height of tile -1
  3499.     Dim cols% ' # tiles across on tile sheet
  3500.     Dim rows% ' # tile rows on tile sheet
  3501.     Dim sc% ' source column on tile sheet
  3502.     Dim sr% ' source row on tile sheet
  3503.     Dim sx1% ' source start x
  3504.     Dim sx2% ' source end x
  3505.     Dim sy1% ' source start y
  3506.     Dim sy2% ' source end y
  3507.     Dim xDest% ' destination x
  3508.     Dim yDest% ' destination y
  3509.  
  3510.     ' SIZE OF TILE
  3511.     tw% = 8
  3512.     tw_minus1% = 7
  3513.  
  3514.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3515.     cols% = 16
  3516.     rows% = 16
  3517.  
  3518.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3519.     sc% = TileNum% Mod rows%
  3520.     sr% = TileNum% \ rows%
  3521.  
  3522.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3523.  
  3524.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3525.     sx1% = sc% * tw%
  3526.  
  3527.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3528.     sy1% = sr% * tw%
  3529.  
  3530.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3531.     sx2% = sx1% + tw_minus1%
  3532.  
  3533.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3534.     sy2% = sy1% + tw_minus1%
  3535.  
  3536.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3537.     xDest% = dx% * tw%
  3538.  
  3539.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3540.     yDest% = (dy% * tw%) '+ yOffset%
  3541.  
  3542.     'Print "Tile#" + cstr$(TileNum%) + _
  3543.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  3544.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  3545.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3546.  
  3547.     _Dest imgScreen&
  3548.  
  3549.     ' portion of source to the top-left corner of the destination page
  3550.     _PutImage (xDest%, yDest%), imgTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  3551.  
  3552. End Sub ' DrawTile8
  3553.  
  3554. ' ################################################################################################################################################################
  3555. ' END DRAW TILES, _PUTIMAGE with SOFTWARE IMAGES
  3556. ' ################################################################################################################################################################
  3557.  
  3558. ' ################################################################################################################################################################
  3559. ' BEGIN DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  3560. ' ################################################################################################################################################################
  3561.  
  3562. ' /////////////////////////////////////////////////////////////////////////////
  3563. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  3564. ' using hardware images
  3565.  
  3566. ' Usage:
  3567. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  3568. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  3569. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  3570.  
  3571. ' where iSubTileset% = iFgColorIndex
  3572.  
  3573. Sub DrawTileHw8 (imgHardwareTiles&, TileNum%, imgScreen&, dx%, dy%, iSubTileset%)
  3574.     Dim tw% ' width/height of tile
  3575.     Dim tw_minus1% ' width/height of tile -1
  3576.     Dim cols% ' # tiles across on tile sheet
  3577.     Dim rows% ' # tile rows on tile sheet
  3578.     Dim sc% ' source column on tile sheet
  3579.     Dim sr% ' source row on tile sheet
  3580.     Dim sx1% ' source start x
  3581.     Dim sx2% ' source end x
  3582.     Dim sy1% ' source start y
  3583.     Dim sy2% ' source end y
  3584.     Dim xDest% ' destination x
  3585.     Dim yDest% ' destination y
  3586.     Dim xOffset%
  3587.  
  3588.     ' CALCULATE OFFSET
  3589.     xOffset% = 128 * iSubTileset%
  3590.  
  3591.     ' SIZE OF TILE
  3592.     tw% = 8
  3593.     tw_minus1% = 7
  3594.  
  3595.     ' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3596.     cols% = 16
  3597.     rows% = 16
  3598.  
  3599.     ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3600.     sc% = TileNum% Mod rows%
  3601.     sr% = TileNum% \ rows%
  3602.  
  3603.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3604.  
  3605.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3606.     sx1% = (sc% * tw%) + xOffset%
  3607.  
  3608.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3609.     sy1% = sr% * tw%
  3610.  
  3611.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3612.     sx2% = sx1% + tw_minus1%
  3613.  
  3614.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3615.     sy2% = sy1% + tw_minus1%
  3616.  
  3617.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3618.     xDest% = dx% * tw%
  3619.  
  3620.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3621.     yDest% = (dy% * tw%) '+ yOffset%
  3622.  
  3623.     'Print "Tile#" + cstr$(TileNum%) + _
  3624.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  3625.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  3626.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3627.  
  3628.     _Dest imgScreen&
  3629.  
  3630.     ' portion of source to the top-left corner of the destination page
  3631.     '_PutImage (xDest%, yDest%), imgHardwareTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  3632.     '_PutImage (200, 100)-Step(100, 100), imgHardwareTiles&, , (0, 0)-(40, 40)
  3633.     _PutImage (xDest%, yDest%), imgHardwareTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  3634.  
  3635. End Sub ' DrawTileHw8
  3636.  
  3637. ' /////////////////////////////////////////////////////////////////////////////
  3638. ' Receives an image imgTiles of 8x8 tiles
  3639. ' colored black on transparent background
  3640. ' and returns a new image imgNew
  3641. ' copied from the tiles in imgTiles,
  3642. ' except colored to foreground color fgColor,
  3643. ' and background color bgColor
  3644.  
  3645. ' Usage:
  3646. ' MakeColoredTileset imgTiles, imgNew, fgColor, bgColor
  3647.  
  3648. Sub MakeColoredTileset (imgTiles As Long, imgNew As Long, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  3649.     Dim iTileNum As Integer
  3650.     Dim iY As Integer
  3651.     Dim iX As Integer
  3652.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  3653.     imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  3654.     iTileNum = 0
  3655.     For iY = 0 To (_Height(imgTiles) \ 8) - 1
  3656.         For iX = 0 To (_Width(imgTiles) \ 8) - 1
  3657.             DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX, iY
  3658.             iTileNum = iTileNum + 1
  3659.             If iTileNum > 255 Then Exit For
  3660.         Next iX
  3661.         If iTileNum > 255 Then Exit For
  3662.     Next iY
  3663. End Sub ' MakeColoredTileset
  3664.  
  3665. ' /////////////////////////////////////////////////////////////////////////////
  3666. ' Receives an image imgTiles of 8x8 tiles
  3667. ' colored black on transparent background
  3668. ' and an array of colors,
  3669. ' and returns a new image imgNew
  3670. ' copied from the tiles in imgTiles,
  3671. ' with every combination of the colors in the array
  3672. ' as the foreground/background color.
  3673.  
  3674. ' Usage:
  3675. ' MakeColoredTileset2 imgTiles, imgNew, arrColor(), arrTileIndex(), arrColorIndex()
  3676.  
  3677. ' Input: iTileNum, bgColor, fgColor
  3678. ' X Index: arrTileIndex(iTileNum) = returns x position for iTileNum
  3679. ' Y Index: arrColorIndex(fgColor, bgColor) = returns y position for fgColor, bgColor
  3680.  
  3681. Sub MakeColoredTileset2 ( _
  3682.     imgTiles As Long, _
  3683.     imgNew As Long, _
  3684.     arrColor() As _Unsigned Long, _
  3685.     arrTileIndex() As Long, _
  3686.     arrColorIndex() As Long)
  3687.  
  3688.     Dim iTileNum As Integer
  3689.     Dim iY As Integer
  3690.     Dim iX As Integer
  3691.     Dim iFG As Integer
  3692.     Dim iBG As Integer
  3693.     Dim iWidth As Long
  3694.     Dim iHeight As Long
  3695.     Dim iColorCount As Long
  3696.     Dim iDestX As Long
  3697.     Dim iDestY As Long
  3698.     Dim fgColor As _Unsigned Long
  3699.     Dim bgColor As _Unsigned Long
  3700.  
  3701.     If imgNew < -1 Or imgNew > 0 Then _FreeImage imgNew ' FREE MEMORY
  3702.  
  3703.     ' FIGURE OUT SIZE OF TARGET IMAGE
  3704.     iColorCount = (UBound(arrColor) - LBound(arrColor)) + 1
  3705.     iHeight = (iColorCount * iColorCount) * 8
  3706.     iWidth = 256 * 8
  3707.  
  3708.     ' CREATE TARGET IMAGE
  3709.     'imgNew = _NewImage(_Width(imgTiles), _Height(imgTiles), 32)
  3710.     imgNew = _NewImage(iWidth, iHeight, 32)
  3711.  
  3712.     ' INITIALIZE X POSITION INDEX
  3713.     ReDim arrTileIndex(0 To 255) As Long
  3714.  
  3715.     ' INITIALIZE Y POSITION INDEX
  3716.     ReDim arrColorIndex(LBound(arrColor) To UBound(arrColor), LBound(arrColor) To UBound(arrColor)) As Long
  3717.  
  3718.     ' POPULATE X POSITION INDEX
  3719.     iX = 0
  3720.     For iTileNum = 0 To 255
  3721.         arrTileIndex(iTileNum) = iX
  3722.         iX = iX + 8
  3723.     Next iTileNum
  3724.  
  3725.     ' CREATE TILE MAP FOR ALL COMBINATIONS OF FOREGROUND + BACKGROUND COLORS
  3726.     ' AND POPULATE Y POSITION INDEX
  3727.     iY = 0
  3728.     For iFG = LBound(arrColor) To UBound(arrColor)
  3729.         For iBG = LBound(arrColor) To UBound(arrColor)
  3730.             For iTileNum = 0 To 255
  3731.                 iX = arrTileIndex(iTileNum)
  3732.                 fgColor = arrColor(iFG)
  3733.                 bgColor = arrColor(iBG)
  3734.                 DrawColorTile imgNew, imgTiles, iTileNum, fgColor, bgColor, iX \ 8, iY \ 8
  3735.                 arrColorIndex(iFG, iBG) = iY
  3736.             Next iTileNum
  3737.             iY = iY + 8
  3738.         Next iBG
  3739.     Next iFG
  3740.  
  3741. End Sub ' MakeColoredTileset2
  3742.  
  3743. ' /////////////////////////////////////////////////////////////////////////////
  3744. ' Draws an 8x8 tile at the specified column/row dx%, dy%
  3745. ' in the specified foreground/background color
  3746. ' using hardware images.
  3747.  
  3748. ' Usage:
  3749. ' Dim imgHardwareTiles As Long ' the hardware image copy of the tileset
  3750. ' imgHardwareTiles = _CopyImage(imgTiles, 33) ' Copy tilesheet for hardware image
  3751. ' DrawTileHw8 imgHardwareTiles, iTileNum, imgScreen, iColumn, iRow, iSubTileset
  3752.  
  3753. ' THIS:
  3754. ' DrawColorTileHw8 imgTilesAllColorsHW, iTileNum, imgScreen, iX, iY, iFgColorIndex, iBgColorIndex, arrTileIndex(), arrColorIndex()
  3755.  
  3756. Sub DrawColorTileHw8 (imgHardwareTiles&, TileNum%, imgScreen&, dx%, dy%, _
  3757.     iFgColorIndex As Integer, _
  3758.     iBgColorIndex As Integer, _
  3759.     arrTileIndex() As Long, _
  3760.     arrColorIndex() As Long)
  3761.  
  3762.     Dim tw% ' width/height of tile
  3763.     Dim tw_minus1% ' width/height of tile -1
  3764.     Dim cols% ' # tiles across on tile sheet
  3765.     Dim rows% ' # tile rows on tile sheet
  3766.     Dim sc% ' source column on tile sheet
  3767.     Dim sr% ' source row on tile sheet
  3768.     Dim sx1% ' source start x
  3769.     Dim sx2% ' source end x
  3770.     Dim sy1% ' source start y
  3771.     Dim sy2% ' source end y
  3772.     Dim xDest% ' destination x
  3773.     Dim yDest% ' destination y
  3774.     Dim xOffset%
  3775.  
  3776.     '' CALCULATE OFFSET
  3777.     'xOffset% = 128 * iSubTileset%
  3778.  
  3779.     ' SIZE OF TILE
  3780.     tw% = 8
  3781.     tw_minus1% = 7
  3782.  
  3783.     '' # OF COLUMNS / ROWS ON SOURCE TILE SHEET
  3784.     'cols% = 16
  3785.     'rows% = 16
  3786.  
  3787.     '' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3788.     'sc% = TileNum% Mod rows%
  3789.     'sr% = TileNum% \ rows%
  3790.  
  3791.     'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3792.  
  3793.     ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3794.     'sx1% = (sc% * tw%) + xOffset%
  3795.     sx1% = arrTileIndex(TileNum%)
  3796.  
  3797.     ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3798.     'sy1% = sr% * tw%
  3799.     sy1% = arrColorIndex(iFgColorIndex, iBgColorIndex)
  3800.  
  3801.     ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3802.     sx2% = sx1% + tw_minus1%
  3803.  
  3804.     ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3805.     sy2% = sy1% + tw_minus1%
  3806.  
  3807.     ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3808.     xDest% = dx% * tw%
  3809.  
  3810.     ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3811.     yDest% = (dy% * tw%) '+ yOffset%
  3812.  
  3813.     'Print "Tile#" + cstr$(TileNum%) + _
  3814.     '    " at r" + cstr$(sr%) + "c" + cstr$(sc%) + _
  3815.     '    " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + _
  3816.     '    " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3817.  
  3818.     _Dest imgScreen&
  3819.  
  3820.     ' portion of source to the top-left corner of the destination page
  3821.     '_PutImage (xDest%, yDest%), imgHardwareTiles&, imgScreen&, (sx1%, sy1%)-(sx2%, sy2%)
  3822.     '_PutImage (200, 100)-Step(100, 100), imgHardwareTiles&, , (0, 0)-(40, 40)
  3823.     _PutImage (xDest%, yDest%), imgHardwareTiles&, , (sx1%, sy1%)-(sx2%, sy2%)
  3824.  
  3825. End Sub ' DrawColorTileHw8
  3826.  
  3827. ' ################################################################################################################################################################
  3828. ' END DRAW TILES, _PUTIMAGE with HARDWARE IMAGES
  3829. ' ################################################################################################################################################################
  3830.  
  3831. ' ################################################################################################################################################################
  3832. ' BEGIN TILE PRECALCULATION UTILITIES
  3833. ' ################################################################################################################################################################
  3834.  
  3835. ' /////////////////////////////////////////////////////////////////////////////
  3836. ' Precalculates the tile locations ahead of time to save time copying them
  3837. ' to the screen.
  3838.  
  3839. ' Requires the following types be declared:
  3840. '
  3841. '     Type TileSheetMapType ' UDT FOR PRECALCULATED TILESHEET
  3842. '         xStart As Integer
  3843. '         xEnd As Integer
  3844. '         yStart As Integer
  3845. '         yEnd As Integer
  3846. '     End Type
  3847. '     Type TileMapType ' UDT FOR PRECALCULATED TILE MAP
  3848. '         xPos As Integer
  3849. '         yPos As Integer
  3850. '     End Type
  3851. '
  3852. ' EXAMPLE USAGE:
  3853. '
  3854. '     Dim TileCount%
  3855. '     Dim TilesheetCols%
  3856. '     Dim TilesheetRows%
  3857. '     Dim tileHeightPx%
  3858. '     Dim tileWidthPx%
  3859. '     Dim xOffset%
  3860. '     Dim yOffset%
  3861. '     Dim numTilesX%
  3862. '     Dim numTilesY%
  3863. '     REDIM arrTileSheetMap(255) AS TileSheetMapType
  3864. '     REDIM arrTileMap(20, 20) AS TileMapType
  3865. '     TileCount% = 256 ' TOTAL # OF TILES
  3866. '     TilesheetCols% = 16 ' # OF COLUMNS ON SOURCE TILE SHEET
  3867. '     TilesheetRows% = 16 ' # OF ROWS    ON SOURCE TILE SHEET
  3868. '     tileHeightPx% = 32 ' TILE HEIGHT
  3869. '     tileWidthPx% = 32 ' TILE WIDTH
  3870. '     xOffset% = 0 ' SCREEN OFFSET X
  3871. '     yOffset% = 64 ' SCREEN OFFSET Y
  3872. '     numTilesX% = 20 ' HOW MANY TILES ACROSS (ON DESTINATION)
  3873. '     numTilesY% = 20 ' HOW MANY TILES UP/DOWN (ON DESTINATION)
  3874. '     ComputeTileLocations arrTileSheetMap(), arrTileMap(), TileCount%, _
  3875. '         TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, _
  3876. '         xOffset%, yOffset%, numTilesX%, numTilesY%
  3877.  
  3878. ' TODO: this can be simplified & optimized:
  3879. '       - we don't need x/y offsets
  3880. '       - tile height/width can be hardcoded
  3881. '       - etc.
  3882.  
  3883. Sub ComputeTileLocations (arrTileSheetMap() As TileSheetMapType, arrTileMap() As TileMapType, TileCount%, TilesheetCols%, TilesheetRows%, tileWidthPx%, tileHeightPx%, xOffset%, yOffset%, numTilesX%, numTilesY%)
  3884.     Dim TileNum%
  3885.     Dim sc%
  3886.     Dim sr%
  3887.     Dim sx1%
  3888.     Dim sx2%
  3889.     Dim sy1%
  3890.     Dim sy2%
  3891.  
  3892.     Dim dx%
  3893.     Dim dy%
  3894.     Dim xDest%
  3895.     Dim yDest%
  3896.  
  3897.     ' -----------------------------------------------------------------------------
  3898.     ' CALCULATE TILE SHEET COORDINATES FOR TILES 0-255
  3899.  
  3900.     For TileNum% = 0 To (TileCount% - 1)
  3901.  
  3902.         ' GET THE COLUMN/ROW OF TILE # TileNum% ON THE SOURCE TILE SHEET
  3903.         sc% = TileNum% Mod TilesheetCols%
  3904.         sr% = TileNum% \ TilesheetRows%
  3905.  
  3906.         'Print "Tile#" + cstr$(TileNum%) + " at sc%=" + cstr$(sc%) + ",sr%=" + cstr$(sr%)
  3907.  
  3908.         ' GET THE START X COORDINATE ON THE SOURCE TILE SHEET
  3909.         'sx1% = sc% * tw%
  3910.         sx1% = sc% * tileWidthPx%
  3911.  
  3912.         ' GET THE START Y COORDINATE ON THE SOURCE TILE SHEET
  3913.         'sy1% = sr% * tw%
  3914.         sy1% = sr% * tileHeightPx%
  3915.  
  3916.         ' GET THE END X COORDINATE ON THE SOURCE TILE SHEET
  3917.         'sx2% = sx1% + (tw% - 1)
  3918.         sx2% = sx1% + (tileWidthPx% - 1)
  3919.  
  3920.         ' GET THE END y COORDINATE ON THE SOURCE TILE SHEET
  3921.         'sy2% = sy1% + (tw% - 1)
  3922.         sy2% = sy1% + (tileHeightPx% - 1)
  3923.  
  3924.         ' SAVE THE COORDINATES FOR TileNum% IN THE ARRAY
  3925.         arrTileSheetMap(TileNum%).xStart = sx1%
  3926.         arrTileSheetMap(TileNum%).xEnd = sx2%
  3927.         arrTileSheetMap(TileNum%).yStart = sy1%
  3928.         arrTileSheetMap(TileNum%).yEnd = sy2%
  3929.  
  3930.     Next TileNum%
  3931.  
  3932.     ' -----------------------------------------------------------------------------
  3933.     ' CALCULATE SCREEN COORDINATES FOR TILES
  3934.  
  3935.     For dx% = 0 To (numTilesX% - 1)
  3936.         For dy% = 0 To (numTilesY% - 1)
  3937.  
  3938.             ' GET THE DESTINATION X COORDINATE ON THE SCREEN
  3939.             'xDest% = dx% * tw%
  3940.             xDest% = (dx% * tileWidthPx%) + xOffset%
  3941.  
  3942.             ' GET THE DESTINATION Y COORDINATE ON THE SCREEN
  3943.             'yDest% = (dy% * tw%) + 64
  3944.             yDest% = (dy% * tileHeightPx%) + yOffset%
  3945.  
  3946.             'Print "Tile#" + cstr$(TileNum%) + " at r" + cstr$(sr%) + "c" + cstr$(sc%) + " pixel location r" + cstr$(sy1%) + "c" + cstr$(sx1%) + " through r" + cstr$(sy2%) + "c" + cstr$(sx2%)
  3947.  
  3948.             ' SAVE THE SCREEN PIXEL COORDINATES FOR dx%, dy% IN THE ARRAY
  3949.             ' WHERE dx% and dy% ARE 1-BASED
  3950.             arrTileMap(dx% + 1, dy% + 1).xPos = xDest%
  3951.             arrTileMap(dx% + 1, dy% + 1).yPos = yDest%
  3952.  
  3953.         Next dy%
  3954.     Next dx%
  3955.  
  3956. End Sub ' ComputeTileLocations
  3957.  
  3958. ' ################################################################################################################################################################
  3959. ' END TILE PRECALCULATION UTILITIES
  3960. ' ################################################################################################################################################################
  3961.  
  3962. ' ################################################################################################################################################################
  3963. ' BEGIN TILE TO IMAGE ROUTINES
  3964. ' ################################################################################################################################################################
  3965.  
  3966. ' /////////////////////////////////////////////////////////////////////////////
  3967. ' Loads tileset of 256 8x8 tiles into a 128x128 image (16 columns x 16 rows)
  3968. ' where tiles are a single color.
  3969.  
  3970. ' Parameters:
  3971. ' imgTiles& = contains the resulting tileset image
  3972. ' fgColor = tile color
  3973. ' bgColor = tile background color
  3974.  
  3975. Function GetTiles$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  3976.     Dim RoutineName As String: RoutineName = "GetTiles$"
  3977.     Dim sResult As String: sResult = ""
  3978.     ReDim arrTileText(0 To 255) As String
  3979.  
  3980.     Dim iTileNum As Integer
  3981.  
  3982.     ReDim arrLines(-1) As String
  3983.     Dim iFromX As Integer
  3984.     Dim iFromY As Integer
  3985.     Dim sLine As String
  3986.     Dim sChar As String
  3987.  
  3988.     Dim iTileX As Integer
  3989.     Dim iTileY As Integer
  3990.     Dim iToX As Integer
  3991.     Dim iToY As Integer
  3992.     Dim pixelColor As _Unsigned Long
  3993.     Dim bFinished As Integer
  3994.  
  3995.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  3996.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  3997.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  3998.     imgTiles& = _NewImage(128, 128, 32)
  3999.     '    Cls , cEmpty ' set the background color as transparent
  4000.  
  4001.     'Screen imgTiles&
  4002.     'Cls , bgColor ' set the background color as transparent
  4003.     _Dest imgTiles&
  4004.     'DrawRect 0, 0, 128, 128, cEmpty
  4005.     'DrawBox 0, 0, 128, cWhite
  4006.     Cls , cEmpty ' set the background color as transparent
  4007.  
  4008.     GetTileText arrTileText()
  4009.     iTileX = 0
  4010.     iTileY = 0
  4011.     bFinished = FALSE
  4012.     For iTileNum = 0 To 255
  4013.         split arrTileText(iTileNum), Chr$(13), arrLines()
  4014.         iToY = iTileY * 8
  4015.         If (iToY > _Height(imgTiles&)) Then
  4016.             sResult = "iToY value " + cstr$(iToY) + " " + _
  4017.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  4018.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4019.             bFinished = TRUE
  4020.             Exit For
  4021.         End If
  4022.  
  4023.         For iFromY = LBound(arrLines) To UBound(arrLines)
  4024.             sLine = arrLines(iFromY)
  4025.             If Len(sLine) > 0 Then
  4026.                 iToX = iTileX * 8
  4027.                 For iFromX = 1 To Len(sLine)
  4028.                     sChar = Mid$(sLine, iFromX, 1)
  4029.                     If sChar = "." Then
  4030.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  4031.                     Else
  4032.                         pixelColor = fgColor ' cBlack
  4033.                     End If
  4034.                     PSet (iToX, iToY), pixelColor
  4035.                     iToX = iToX + 1
  4036.                     If (iToX > _Width(imgTiles&)) Then
  4037.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  4038.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  4039.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4040.                         bFinished = TRUE
  4041.                         Exit For
  4042.                     End If
  4043.                 Next iFromX
  4044.                 iToY = iToY + 1
  4045.                 If bFinished = TRUE Then Exit For
  4046.             End If
  4047.         Next iFromY
  4048.         If bFinished = TRUE Then Exit For
  4049.  
  4050.         iTileX = iTileX + 1
  4051.         If iTileX > 15 Then
  4052.             iTileX = 0
  4053.             iTileY = iTileY + 1
  4054.             'if iTileY > 15 then
  4055.             '    sResult = "Exceeded max 16 rows of tiles." + _
  4056.             '        "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4057.             '    bFinished = TRUE
  4058.             '    exit for
  4059.             'end if
  4060.         End If
  4061.     Next iTileNum
  4062.  
  4063.     GetTiles$ = sResult
  4064. End Function ' GetTiles$
  4065.  
  4066. ' /////////////////////////////////////////////////////////////////////////////
  4067. ' Loads tileset of 256 8x8 tiles into a 2048 x 8 image
  4068. ' (256 8x8 pixel tiles organized left to right)
  4069. ' where tiles are a single color.
  4070.  
  4071. ' Parameters:
  4072. ' imgTiles& = contains the resulting tileset image
  4073. ' fgColor = tile color
  4074. ' bgColor = tile background color
  4075.  
  4076. Function GetTiles2$ (imgTiles&, fgColor As _Unsigned Long, bgColor As _Unsigned Long)
  4077.     Dim RoutineName As String: RoutineName = "GetTiles2$"
  4078.     Dim sResult As String: sResult = ""
  4079.     ReDim arrTileText(0 To 255) As String
  4080.  
  4081.     Dim iTileNum As Integer
  4082.  
  4083.     ReDim arrLines(-1) As String
  4084.     Dim iFromX As Integer
  4085.     Dim iFromY As Integer
  4086.     Dim sLine As String
  4087.     Dim sChar As String
  4088.  
  4089.     Dim iTileX As Integer
  4090.     Dim iTileY As Integer
  4091.     Dim iToX As Integer
  4092.     Dim iToY As Integer
  4093.     Dim pixelColor As _Unsigned Long
  4094.     Dim bFinished As Integer
  4095.  
  4096.     ' Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
  4097.     ' _DISPLAY turns off the auto refresh screen default _AUTODISPLAY behavior. Prevents screen flickering.
  4098.     If imgTiles& < -1 Or imgTiles& > 0 Then _FreeImage imgTiles&
  4099.     imgTiles& = _NewImage(2048, 8, 32)
  4100.     '    Cls , cEmpty ' set the background color as transparent
  4101.  
  4102.     'Screen imgTiles&
  4103.     'Cls , bgColor ' set the background color as transparent
  4104.     _Dest imgTiles&
  4105.     'DrawRect 0, 0, 128, 128, cEmpty
  4106.     'DrawBox 0, 0, 128, cWhite
  4107.     Cls , cEmpty ' set the background color as transparent
  4108.  
  4109.     GetTileText arrTileText()
  4110.     iTileX = 0
  4111.     iTileY = 0
  4112.     iToY = 0
  4113.     bFinished = FALSE
  4114.     For iTileNum = 0 To 255
  4115.         split arrTileText(iTileNum), Chr$(13), arrLines()
  4116.         iToY = iTileY * 8
  4117.         If (iToY > _Height(imgTiles&)) Then
  4118.             sResult = "iToY value " + cstr$(iToY) + " " + _
  4119.                 "exceeded image height " + cstr$(_Height(imgTiles&)) + ". " + _
  4120.                 "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4121.             bFinished = TRUE
  4122.             Exit For
  4123.         End If
  4124.  
  4125.         For iFromY = LBound(arrLines) To UBound(arrLines)
  4126.             sLine = arrLines(iFromY)
  4127.             If Len(sLine) > 0 Then
  4128.                 iToX = iTileX * 8
  4129.                 For iFromX = 1 To Len(sLine)
  4130.                     sChar = Mid$(sLine, iFromX, 1)
  4131.                     If sChar = "." Then
  4132.                         pixelColor = bgColor ' cEmpty ' POINT(iFromX, iFromY)
  4133.                     Else
  4134.                         pixelColor = fgColor ' cBlack
  4135.                     End If
  4136.                     PSet (iToX, iToY), pixelColor
  4137.                     iToX = iToX + 1
  4138.                     If (iToX > _Width(imgTiles&)) Then
  4139.                         sResult = "iToX value " + cstr$(iToX) + " " + _
  4140.                             "exceeded image width " + cstr$(_Width(imgTiles&)) + ". " + _
  4141.                             "Exiting " + RoutineName + " at iTileNum=" + cstr$(iTileNum) + "."
  4142.                         bFinished = TRUE
  4143.                         Exit For
  4144.                     End If
  4145.                 Next iFromX
  4146.                 iToY = iToY + 1
  4147.                 If bFinished = TRUE Then Exit For
  4148.             End If
  4149.         Next iFromY
  4150.         If bFinished = TRUE Then Exit For
  4151.  
  4152.         iTileX = iTileX + 1
  4153.         'If iTileX > 15 Then
  4154.         '    iTileX = 0
  4155.         '    iTileY = iTileY + 1
  4156.         'End If
  4157.     Next iTileNum
  4158.  
  4159.     GetTiles2$ = sResult
  4160. End Function ' GetTiles2$
  4161.  
  4162. ' ################################################################################################################################################################
  4163. ' END TILE TO IMAGE ROUTINES
  4164. ' ################################################################################################################################################################
  4165.  
  4166. ' ################################################################################################################################################################
  4167. ' BEGIN TILE DEFINITIONS
  4168. ' ################################################################################################################################################################
  4169.  
  4170. ' /////////////////////////////////////////////////////////////////////////////
  4171. ' Returns an array of 256 8x8 tiles defined in text
  4172. ' where each tile is defined by "." as blank and anything else is a pixel
  4173. ' and each row is delimited by chr$(13)
  4174.  
  4175. Sub GetTileText (arrTileText() As String)
  4176.     ReDim arrTileText(0 To 255) As String
  4177.  
  4178.     m$ = ""
  4179.     m$ = m$ + "22....22" + Chr$(13)
  4180.     m$ = m$ + "2..22..2" + Chr$(13)
  4181.     m$ = m$ + "2..2...2" + Chr$(13)
  4182.     m$ = m$ + "2...2..2" + Chr$(13)
  4183.     m$ = m$ + "2..22..2" + Chr$(13)
  4184.     m$ = m$ + "2..22..2" + Chr$(13)
  4185.     m$ = m$ + "22....22" + Chr$(13)
  4186.     m$ = m$ + "22222222" + Chr$(13)
  4187.     arrTileText(0) = m$
  4188.  
  4189.     m$ = ""
  4190.     m$ = m$ + "........" + Chr$(13)
  4191.     m$ = m$ + "........" + Chr$(13)
  4192.     m$ = m$ + "........" + Chr$(13)
  4193.     m$ = m$ + "........" + Chr$(13)
  4194.     m$ = m$ + "........" + Chr$(13)
  4195.     m$ = m$ + "........" + Chr$(13)
  4196.     m$ = m$ + "........" + Chr$(13)
  4197.     m$ = m$ + "........" + Chr$(13)
  4198.     arrTileText(1) = m$
  4199.  
  4200.     m$ = ""
  4201.     m$ = m$ + "........" + Chr$(13)
  4202.     m$ = m$ + "........" + Chr$(13)
  4203.     m$ = m$ + "........" + Chr$(13)
  4204.     m$ = m$ + "........" + Chr$(13)
  4205.     m$ = m$ + "........" + Chr$(13)
  4206.     m$ = m$ + "........" + Chr$(13)
  4207.     m$ = m$ + "........" + Chr$(13)
  4208.     m$ = m$ + "........" + Chr$(13)
  4209.     arrTileText(2) = m$
  4210.  
  4211.     m$ = ""
  4212.     m$ = m$ + "........" + Chr$(13)
  4213.     m$ = m$ + "........" + Chr$(13)
  4214.     m$ = m$ + "........" + Chr$(13)
  4215.     m$ = m$ + "........" + Chr$(13)
  4216.     m$ = m$ + "........" + Chr$(13)
  4217.     m$ = m$ + "........" + Chr$(13)
  4218.     m$ = m$ + "........" + Chr$(13)
  4219.     m$ = m$ + "........" + Chr$(13)
  4220.     arrTileText(3) = m$
  4221.  
  4222.     m$ = ""
  4223.     m$ = m$ + "........" + Chr$(13)
  4224.     m$ = m$ + "........" + Chr$(13)
  4225.     m$ = m$ + "........" + Chr$(13)
  4226.     m$ = m$ + "........" + Chr$(13)
  4227.     m$ = m$ + "........" + Chr$(13)
  4228.     m$ = m$ + "........" + Chr$(13)
  4229.     m$ = m$ + "........" + Chr$(13)
  4230.     m$ = m$ + "........" + Chr$(13)
  4231.     arrTileText(4) = m$
  4232.  
  4233.     m$ = ""
  4234.     m$ = m$ + "........" + Chr$(13)
  4235.     m$ = m$ + "........" + Chr$(13)
  4236.     m$ = m$ + "........" + Chr$(13)
  4237.     m$ = m$ + "........" + Chr$(13)
  4238.     m$ = m$ + "........" + Chr$(13)
  4239.     m$ = m$ + "........" + Chr$(13)
  4240.     m$ = m$ + "........" + Chr$(13)
  4241.     m$ = m$ + "........" + Chr$(13)
  4242.     arrTileText(5) = m$
  4243.  
  4244.     m$ = ""
  4245.     m$ = m$ + "........" + Chr$(13)
  4246.     m$ = m$ + "........" + Chr$(13)
  4247.     m$ = m$ + "........" + Chr$(13)
  4248.     m$ = m$ + "........" + Chr$(13)
  4249.     m$ = m$ + "........" + Chr$(13)
  4250.     m$ = m$ + "........" + Chr$(13)
  4251.     m$ = m$ + "........" + Chr$(13)
  4252.     m$ = m$ + "........" + Chr$(13)
  4253.     arrTileText(6) = m$
  4254.  
  4255.     m$ = ""
  4256.     m$ = m$ + "........" + Chr$(13)
  4257.     m$ = m$ + "........" + Chr$(13)
  4258.     m$ = m$ + "........" + Chr$(13)
  4259.     m$ = m$ + "........" + Chr$(13)
  4260.     m$ = m$ + "........" + Chr$(13)
  4261.     m$ = m$ + "........" + Chr$(13)
  4262.     m$ = m$ + "........" + Chr$(13)
  4263.     m$ = m$ + "........" + Chr$(13)
  4264.     arrTileText(7) = m$
  4265.  
  4266.     m$ = ""
  4267.     m$ = m$ + "........" + Chr$(13)
  4268.     m$ = m$ + "........" + Chr$(13)
  4269.     m$ = m$ + "........" + Chr$(13)
  4270.     m$ = m$ + "........" + Chr$(13)
  4271.     m$ = m$ + "........" + Chr$(13)
  4272.     m$ = m$ + "........" + Chr$(13)
  4273.     m$ = m$ + "........" + Chr$(13)
  4274.     m$ = m$ + "........" + Chr$(13)
  4275.     arrTileText(8) = m$
  4276.  
  4277.     m$ = ""
  4278.     m$ = m$ + "........" + Chr$(13)
  4279.     m$ = m$ + "........" + Chr$(13)
  4280.     m$ = m$ + "........" + Chr$(13)
  4281.     m$ = m$ + "........" + Chr$(13)
  4282.     m$ = m$ + "........" + Chr$(13)
  4283.     m$ = m$ + "........" + Chr$(13)
  4284.     m$ = m$ + "........" + Chr$(13)
  4285.     m$ = m$ + "........" + Chr$(13)
  4286.     arrTileText(9) = m$
  4287.  
  4288.     m$ = ""
  4289.     m$ = m$ + "........" + Chr$(13)
  4290.     m$ = m$ + "........" + Chr$(13)
  4291.     m$ = m$ + "........" + Chr$(13)
  4292.     m$ = m$ + "........" + Chr$(13)
  4293.     m$ = m$ + "........" + Chr$(13)
  4294.     m$ = m$ + "........" + Chr$(13)
  4295.     m$ = m$ + "........" + Chr$(13)
  4296.     m$ = m$ + "........" + Chr$(13)
  4297.     arrTileText(10) = m$
  4298.  
  4299.     m$ = ""
  4300.     m$ = m$ + "........" + Chr$(13)
  4301.     m$ = m$ + "........" + Chr$(13)
  4302.     m$ = m$ + "........" + Chr$(13)
  4303.     m$ = m$ + "........" + Chr$(13)
  4304.     m$ = m$ + "........" + Chr$(13)
  4305.     m$ = m$ + "........" + Chr$(13)
  4306.     m$ = m$ + "........" + Chr$(13)
  4307.     m$ = m$ + "........" + Chr$(13)
  4308.     arrTileText(11) = m$
  4309.  
  4310.     m$ = ""
  4311.     m$ = m$ + "........" + Chr$(13)
  4312.     m$ = m$ + "........" + Chr$(13)
  4313.     m$ = m$ + "........" + Chr$(13)
  4314.     m$ = m$ + "........" + Chr$(13)
  4315.     m$ = m$ + "........" + Chr$(13)
  4316.     m$ = m$ + "........" + Chr$(13)
  4317.     m$ = m$ + "........" + Chr$(13)
  4318.     m$ = m$ + "........" + Chr$(13)
  4319.     arrTileText(12) = m$
  4320.  
  4321.     m$ = ""
  4322.     m$ = m$ + "........" + Chr$(13)
  4323.     m$ = m$ + "........" + Chr$(13)
  4324.     m$ = m$ + "........" + Chr$(13)
  4325.     m$ = m$ + "........" + Chr$(13)
  4326.     m$ = m$ + "........" + Chr$(13)
  4327.     m$ = m$ + "........" + Chr$(13)
  4328.     m$ = m$ + "........" + Chr$(13)
  4329.     m$ = m$ + "........" + Chr$(13)
  4330.     arrTileText(13) = m$
  4331.  
  4332.     m$ = ""
  4333.     m$ = m$ + "........" + Chr$(13)
  4334.     m$ = m$ + "........" + Chr$(13)
  4335.     m$ = m$ + "........" + Chr$(13)
  4336.     m$ = m$ + "........" + Chr$(13)
  4337.     m$ = m$ + "........" + Chr$(13)
  4338.     m$ = m$ + "........" + Chr$(13)
  4339.     m$ = m$ + "........" + Chr$(13)
  4340.     m$ = m$ + "........" + Chr$(13)
  4341.     arrTileText(14) = m$
  4342.  
  4343.     m$ = ""
  4344.     m$ = m$ + "........" + Chr$(13)
  4345.     m$ = m$ + "........" + Chr$(13)
  4346.     m$ = m$ + "........" + Chr$(13)
  4347.     m$ = m$ + "........" + Chr$(13)
  4348.     m$ = m$ + "........" + Chr$(13)
  4349.     m$ = m$ + "........" + Chr$(13)
  4350.     m$ = m$ + "........" + Chr$(13)
  4351.     m$ = m$ + "........" + Chr$(13)
  4352.     arrTileText(15) = m$
  4353.  
  4354.     m$ = ""
  4355.     m$ = m$ + "........" + Chr$(13)
  4356.     m$ = m$ + "........" + Chr$(13)
  4357.     m$ = m$ + "........" + Chr$(13)
  4358.     m$ = m$ + "........" + Chr$(13)
  4359.     m$ = m$ + "........" + Chr$(13)
  4360.     m$ = m$ + "........" + Chr$(13)
  4361.     m$ = m$ + "........" + Chr$(13)
  4362.     m$ = m$ + "........" + Chr$(13)
  4363.     arrTileText(16) = m$
  4364.  
  4365.     m$ = ""
  4366.     m$ = m$ + "........" + Chr$(13)
  4367.     m$ = m$ + "........" + Chr$(13)
  4368.     m$ = m$ + "........" + Chr$(13)
  4369.     m$ = m$ + "........" + Chr$(13)
  4370.     m$ = m$ + "........" + Chr$(13)
  4371.     m$ = m$ + "........" + Chr$(13)
  4372.     m$ = m$ + "........" + Chr$(13)
  4373.     m$ = m$ + "........" + Chr$(13)
  4374.     arrTileText(17) = m$
  4375.  
  4376.     m$ = ""
  4377.     m$ = m$ + "........" + Chr$(13)
  4378.     m$ = m$ + "........" + Chr$(13)
  4379.     m$ = m$ + "........" + Chr$(13)
  4380.     m$ = m$ + "........" + Chr$(13)
  4381.     m$ = m$ + "........" + Chr$(13)
  4382.     m$ = m$ + "........" + Chr$(13)
  4383.     m$ = m$ + "........" + Chr$(13)
  4384.     m$ = m$ + "........" + Chr$(13)
  4385.     arrTileText(18) = m$
  4386.  
  4387.     m$ = ""
  4388.     m$ = m$ + "........" + Chr$(13)
  4389.     m$ = m$ + "........" + Chr$(13)
  4390.     m$ = m$ + "........" + Chr$(13)
  4391.     m$ = m$ + "........" + Chr$(13)
  4392.     m$ = m$ + "........" + Chr$(13)
  4393.     m$ = m$ + "........" + Chr$(13)
  4394.     m$ = m$ + "........" + Chr$(13)
  4395.     m$ = m$ + "........" + Chr$(13)
  4396.     arrTileText(19) = m$
  4397.  
  4398.     m$ = ""
  4399.     m$ = m$ + "........" + Chr$(13)
  4400.     m$ = m$ + "........" + Chr$(13)
  4401.     m$ = m$ + "........" + Chr$(13)
  4402.     m$ = m$ + "........" + Chr$(13)
  4403.     m$ = m$ + "........" + Chr$(13)
  4404.     m$ = m$ + "........" + Chr$(13)
  4405.     m$ = m$ + "........" + Chr$(13)
  4406.     m$ = m$ + "........" + Chr$(13)
  4407.     arrTileText(20) = m$
  4408.  
  4409.     m$ = ""
  4410.     m$ = m$ + "........" + Chr$(13)
  4411.     m$ = m$ + "........" + Chr$(13)
  4412.     m$ = m$ + "........" + Chr$(13)
  4413.     m$ = m$ + "........" + Chr$(13)
  4414.     m$ = m$ + "........" + Chr$(13)
  4415.     m$ = m$ + "........" + Chr$(13)
  4416.     m$ = m$ + "........" + Chr$(13)
  4417.     m$ = m$ + "........" + Chr$(13)
  4418.     arrTileText(21) = m$
  4419.  
  4420.     m$ = ""
  4421.     m$ = m$ + "........" + Chr$(13)
  4422.     m$ = m$ + "........" + Chr$(13)
  4423.     m$ = m$ + "........" + Chr$(13)
  4424.     m$ = m$ + "........" + Chr$(13)
  4425.     m$ = m$ + "........" + Chr$(13)
  4426.     m$ = m$ + "........" + Chr$(13)
  4427.     m$ = m$ + "........" + Chr$(13)
  4428.     m$ = m$ + "........" + Chr$(13)
  4429.     arrTileText(22) = m$
  4430.  
  4431.     m$ = ""
  4432.     m$ = m$ + "........" + Chr$(13)
  4433.     m$ = m$ + "........" + Chr$(13)
  4434.     m$ = m$ + "........" + Chr$(13)
  4435.     m$ = m$ + "........" + Chr$(13)
  4436.     m$ = m$ + "........" + Chr$(13)
  4437.     m$ = m$ + "........" + Chr$(13)
  4438.     m$ = m$ + "........" + Chr$(13)
  4439.     m$ = m$ + "........" + Chr$(13)
  4440.     arrTileText(23) = m$
  4441.  
  4442.     m$ = ""
  4443.     m$ = m$ + "........" + Chr$(13)
  4444.     m$ = m$ + "........" + Chr$(13)
  4445.     m$ = m$ + "........" + Chr$(13)
  4446.     m$ = m$ + "........" + Chr$(13)
  4447.     m$ = m$ + "........" + Chr$(13)
  4448.     m$ = m$ + "........" + Chr$(13)
  4449.     m$ = m$ + "........" + Chr$(13)
  4450.     m$ = m$ + "........" + Chr$(13)
  4451.     arrTileText(24) = m$
  4452.  
  4453.     m$ = ""
  4454.     m$ = m$ + "........" + Chr$(13)
  4455.     m$ = m$ + "........" + Chr$(13)
  4456.     m$ = m$ + "........" + Chr$(13)
  4457.     m$ = m$ + "........" + Chr$(13)
  4458.     m$ = m$ + "........" + Chr$(13)
  4459.     m$ = m$ + "........" + Chr$(13)
  4460.     m$ = m$ + "........" + Chr$(13)
  4461.     m$ = m$ + "........" + Chr$(13)
  4462.     arrTileText(25) = m$
  4463.  
  4464.     m$ = ""
  4465.     m$ = m$ + "........" + Chr$(13)
  4466.     m$ = m$ + "........" + Chr$(13)
  4467.     m$ = m$ + "........" + Chr$(13)
  4468.     m$ = m$ + "........" + Chr$(13)
  4469.     m$ = m$ + "........" + Chr$(13)
  4470.     m$ = m$ + "........" + Chr$(13)
  4471.     m$ = m$ + "........" + Chr$(13)
  4472.     m$ = m$ + "........" + Chr$(13)
  4473.     arrTileText(26) = m$
  4474.  
  4475.     m$ = ""
  4476.     m$ = m$ + "........" + Chr$(13)
  4477.     m$ = m$ + "........" + Chr$(13)
  4478.     m$ = m$ + "........" + Chr$(13)
  4479.     m$ = m$ + "........" + Chr$(13)
  4480.     m$ = m$ + "........" + Chr$(13)
  4481.     m$ = m$ + "........" + Chr$(13)
  4482.     m$ = m$ + "........" + Chr$(13)
  4483.     m$ = m$ + "........" + Chr$(13)
  4484.     arrTileText(27) = m$
  4485.  
  4486.     m$ = ""
  4487.     m$ = m$ + "........" + Chr$(13)
  4488.     m$ = m$ + "........" + Chr$(13)
  4489.     m$ = m$ + "........" + Chr$(13)
  4490.     m$ = m$ + "........" + Chr$(13)
  4491.     m$ = m$ + "........" + Chr$(13)
  4492.     m$ = m$ + "........" + Chr$(13)
  4493.     m$ = m$ + "........" + Chr$(13)
  4494.     m$ = m$ + "........" + Chr$(13)
  4495.     arrTileText(28) = m$
  4496.  
  4497.     m$ = ""
  4498.     m$ = m$ + "........" + Chr$(13)
  4499.     m$ = m$ + "........" + Chr$(13)
  4500.     m$ = m$ + "........" + Chr$(13)
  4501.     m$ = m$ + "........" + Chr$(13)
  4502.     m$ = m$ + "........" + Chr$(13)
  4503.     m$ = m$ + "........" + Chr$(13)
  4504.     m$ = m$ + "........" + Chr$(13)
  4505.     m$ = m$ + "........" + Chr$(13)
  4506.     arrTileText(29) = m$
  4507.  
  4508.     m$ = ""
  4509.     m$ = m$ + "........" + Chr$(13)
  4510.     m$ = m$ + "........" + Chr$(13)
  4511.     m$ = m$ + "........" + Chr$(13)
  4512.     m$ = m$ + "........" + Chr$(13)
  4513.     m$ = m$ + "........" + Chr$(13)
  4514.     m$ = m$ + "........" + Chr$(13)
  4515.     m$ = m$ + "........" + Chr$(13)
  4516.     m$ = m$ + "........" + Chr$(13)
  4517.     arrTileText(30) = m$
  4518.  
  4519.     m$ = ""
  4520.     m$ = m$ + "........" + Chr$(13)
  4521.     m$ = m$ + "........" + Chr$(13)
  4522.     m$ = m$ + "........" + Chr$(13)
  4523.     m$ = m$ + "........" + Chr$(13)
  4524.     m$ = m$ + "........" + Chr$(13)
  4525.     m$ = m$ + "........" + Chr$(13)
  4526.     m$ = m$ + "........" + Chr$(13)
  4527.     m$ = m$ + "........" + Chr$(13)
  4528.     arrTileText(31) = m$
  4529.  
  4530.     m$ = ""
  4531.     m$ = m$ + "........" + Chr$(13)
  4532.     m$ = m$ + "........" + Chr$(13)
  4533.     m$ = m$ + "........" + Chr$(13)
  4534.     m$ = m$ + "........" + Chr$(13)
  4535.     m$ = m$ + "........" + Chr$(13)
  4536.     m$ = m$ + "........" + Chr$(13)
  4537.     m$ = m$ + "........" + Chr$(13)
  4538.     m$ = m$ + "........" + Chr$(13)
  4539.     arrTileText(32) = m$
  4540.  
  4541.     m$ = ""
  4542.     m$ = m$ + "...22..." + Chr$(13)
  4543.     m$ = m$ + "...22..." + Chr$(13)
  4544.     m$ = m$ + "...22..." + Chr$(13)
  4545.     m$ = m$ + "...22..." + Chr$(13)
  4546.     m$ = m$ + "........" + Chr$(13)
  4547.     m$ = m$ + "........" + Chr$(13)
  4548.     m$ = m$ + "...22..." + Chr$(13)
  4549.     m$ = m$ + "........" + Chr$(13)
  4550.     arrTileText(33) = m$
  4551.  
  4552.     m$ = ""
  4553.     m$ = m$ + ".22..22." + Chr$(13)
  4554.     m$ = m$ + ".22..22." + Chr$(13)
  4555.     m$ = m$ + ".22..22." + Chr$(13)
  4556.     m$ = m$ + "........" + Chr$(13)
  4557.     m$ = m$ + "........" + Chr$(13)
  4558.     m$ = m$ + "........" + Chr$(13)
  4559.     m$ = m$ + "........" + Chr$(13)
  4560.     m$ = m$ + "........" + Chr$(13)
  4561.     arrTileText(34) = m$
  4562.  
  4563.     m$ = ""
  4564.     m$ = m$ + ".22..22." + Chr$(13)
  4565.     m$ = m$ + ".22..22." + Chr$(13)
  4566.     m$ = m$ + "22222222" + Chr$(13)
  4567.     m$ = m$ + ".22..22." + Chr$(13)
  4568.     m$ = m$ + "22222222" + Chr$(13)
  4569.     m$ = m$ + ".22..22." + Chr$(13)
  4570.     m$ = m$ + ".22..22." + Chr$(13)
  4571.     m$ = m$ + "........" + Chr$(13)
  4572.     arrTileText(35) = m$
  4573.  
  4574.     m$ = ""
  4575.     m$ = m$ + "...22..." + Chr$(13)
  4576.     m$ = m$ + "..22222." + Chr$(13)
  4577.     m$ = m$ + ".22....." + Chr$(13)
  4578.     m$ = m$ + "..2222.." + Chr$(13)
  4579.     m$ = m$ + ".....22." + Chr$(13)
  4580.     m$ = m$ + ".22222.." + Chr$(13)
  4581.     m$ = m$ + "...22..." + Chr$(13)
  4582.     m$ = m$ + "........" + Chr$(13)
  4583.     arrTileText(36) = m$
  4584.  
  4585.     m$ = ""
  4586.     m$ = m$ + ".22...2." + Chr$(13)
  4587.     m$ = m$ + ".22..22." + Chr$(13)
  4588.     m$ = m$ + "....22.." + Chr$(13)
  4589.     m$ = m$ + "...22..." + Chr$(13)
  4590.     m$ = m$ + "..22...." + Chr$(13)
  4591.     m$ = m$ + ".22..22." + Chr$(13)
  4592.     m$ = m$ + ".2...22." + Chr$(13)
  4593.     m$ = m$ + "........" + Chr$(13)
  4594.     arrTileText(37) = m$
  4595.  
  4596.     m$ = ""
  4597.     m$ = m$ + "..2222.." + Chr$(13)
  4598.     m$ = m$ + ".22..22." + Chr$(13)
  4599.     m$ = m$ + "..2222.." + Chr$(13)
  4600.     m$ = m$ + "..222..." + Chr$(13)
  4601.     m$ = m$ + ".22..222" + Chr$(13)
  4602.     m$ = m$ + ".22..22." + Chr$(13)
  4603.     m$ = m$ + "..222222" + Chr$(13)
  4604.     m$ = m$ + "........" + Chr$(13)
  4605.     arrTileText(38) = m$
  4606.  
  4607.     m$ = ""
  4608.     m$ = m$ + ".....22." + Chr$(13)
  4609.     m$ = m$ + "....22.." + Chr$(13)
  4610.     m$ = m$ + "...22..." + Chr$(13)
  4611.     m$ = m$ + "........" + Chr$(13)
  4612.     m$ = m$ + "........" + Chr$(13)
  4613.     m$ = m$ + "........" + Chr$(13)
  4614.     m$ = m$ + "........" + Chr$(13)
  4615.     m$ = m$ + "........" + Chr$(13)
  4616.     arrTileText(39) = m$
  4617.  
  4618.     m$ = ""
  4619.     m$ = m$ + "....22.." + Chr$(13)
  4620.     m$ = m$ + "...22..." + Chr$(13)
  4621.     m$ = m$ + "..22...." + Chr$(13)
  4622.     m$ = m$ + "..22...." + Chr$(13)
  4623.     m$ = m$ + "..22...." + Chr$(13)
  4624.     m$ = m$ + "...22..." + Chr$(13)
  4625.     m$ = m$ + "....22.." + Chr$(13)
  4626.     m$ = m$ + "........" + Chr$(13)
  4627.     arrTileText(40) = m$
  4628.  
  4629.     m$ = ""
  4630.     m$ = m$ + "..22...." + Chr$(13)
  4631.     m$ = m$ + "...22..." + Chr$(13)
  4632.     m$ = m$ + "....22.." + Chr$(13)
  4633.     m$ = m$ + "....22.." + Chr$(13)
  4634.     m$ = m$ + "....22.." + Chr$(13)
  4635.     m$ = m$ + "...22..." + Chr$(13)
  4636.     m$ = m$ + "..22...." + Chr$(13)
  4637.     m$ = m$ + "........" + Chr$(13)
  4638.     arrTileText(41) = m$
  4639.  
  4640.     m$ = ""
  4641.     m$ = m$ + "........" + Chr$(13)
  4642.     m$ = m$ + ".22..22." + Chr$(13)
  4643.     m$ = m$ + "..2222.." + Chr$(13)
  4644.     m$ = m$ + "22222222" + Chr$(13)
  4645.     m$ = m$ + "..2222.." + Chr$(13)
  4646.     m$ = m$ + ".22..22." + Chr$(13)
  4647.     m$ = m$ + "........" + Chr$(13)
  4648.     m$ = m$ + "........" + Chr$(13)
  4649.     arrTileText(42) = m$
  4650.  
  4651.     m$ = ""
  4652.     m$ = m$ + "........" + Chr$(13)
  4653.     m$ = m$ + "...22..." + Chr$(13)
  4654.     m$ = m$ + "...22..." + Chr$(13)
  4655.     m$ = m$ + ".222222." + Chr$(13)
  4656.     m$ = m$ + "...22..." + Chr$(13)
  4657.     m$ = m$ + "...22..." + Chr$(13)
  4658.     m$ = m$ + "........" + Chr$(13)
  4659.     m$ = m$ + "........" + Chr$(13)
  4660.     arrTileText(43) = m$
  4661.  
  4662.     m$ = ""
  4663.     m$ = m$ + "........" + Chr$(13)
  4664.     m$ = m$ + "........" + Chr$(13)
  4665.     m$ = m$ + "........" + Chr$(13)
  4666.     m$ = m$ + "........" + Chr$(13)
  4667.     m$ = m$ + "........" + Chr$(13)
  4668.     m$ = m$ + "...22..." + Chr$(13)
  4669.     m$ = m$ + "...22..." + Chr$(13)
  4670.     m$ = m$ + "..22...." + Chr$(13)
  4671.     arrTileText(44) = m$
  4672.  
  4673.     m$ = ""
  4674.     m$ = m$ + "........" + Chr$(13)
  4675.     m$ = m$ + "........" + Chr$(13)
  4676.     m$ = m$ + "........" + Chr$(13)
  4677.     m$ = m$ + ".222222." + Chr$(13)
  4678.     m$ = m$ + "........" + Chr$(13)
  4679.     m$ = m$ + "........" + Chr$(13)
  4680.     m$ = m$ + "........" + Chr$(13)
  4681.     m$ = m$ + "........" + Chr$(13)
  4682.     arrTileText(45) = m$
  4683.  
  4684.     m$ = ""
  4685.     m$ = m$ + "........" + Chr$(13)
  4686.     m$ = m$ + "........" + Chr$(13)
  4687.     m$ = m$ + "........" + Chr$(13)
  4688.     m$ = m$ + "........" + Chr$(13)
  4689.     m$ = m$ + "........" + Chr$(13)
  4690.     m$ = m$ + "...22..." + Chr$(13)
  4691.     m$ = m$ + "...22..." + Chr$(13)
  4692.     m$ = m$ + "........" + Chr$(13)
  4693.     arrTileText(46) = m$
  4694.  
  4695.     m$ = ""
  4696.     m$ = m$ + "........" + Chr$(13)
  4697.     m$ = m$ + "......22" + Chr$(13)
  4698.     m$ = m$ + ".....22." + Chr$(13)
  4699.     m$ = m$ + "....22.." + Chr$(13)
  4700.     m$ = m$ + "...22..." + Chr$(13)
  4701.     m$ = m$ + "..22...." + Chr$(13)
  4702.     m$ = m$ + ".22....." + Chr$(13)
  4703.     m$ = m$ + "........" + Chr$(13)
  4704.     arrTileText(47) = m$
  4705.  
  4706.     m$ = ""
  4707.     m$ = m$ + "..2222.." + Chr$(13)
  4708.     m$ = m$ + ".22..22." + Chr$(13)
  4709.     m$ = m$ + ".22.222." + Chr$(13)
  4710.     m$ = m$ + ".222.22." + Chr$(13)
  4711.     m$ = m$ + ".22..22." + Chr$(13)
  4712.     m$ = m$ + ".22..22." + Chr$(13)
  4713.     m$ = m$ + "..2222.." + Chr$(13)
  4714.     m$ = m$ + "........" + Chr$(13)
  4715.     arrTileText(48) = m$
  4716.  
  4717.     m$ = ""
  4718.     m$ = m$ + "...22..." + Chr$(13)
  4719.     m$ = m$ + "...22..." + Chr$(13)
  4720.     m$ = m$ + "..222..." + Chr$(13)
  4721.     m$ = m$ + "...22..." + Chr$(13)
  4722.     m$ = m$ + "...22..." + Chr$(13)
  4723.     m$ = m$ + "...22..." + Chr$(13)
  4724.     m$ = m$ + ".222222." + Chr$(13)
  4725.     m$ = m$ + "........" + Chr$(13)
  4726.     arrTileText(49) = m$
  4727.  
  4728.     m$ = ""
  4729.     m$ = m$ + "..2222.." + Chr$(13)
  4730.     m$ = m$ + ".22..22." + Chr$(13)
  4731.     m$ = m$ + ".....22." + Chr$(13)
  4732.     m$ = m$ + "....22.." + Chr$(13)
  4733.     m$ = m$ + "..22...." + Chr$(13)
  4734.     m$ = m$ + ".22....." + Chr$(13)
  4735.     m$ = m$ + ".222222." + Chr$(13)
  4736.     m$ = m$ + "........" + Chr$(13)
  4737.     arrTileText(50) = m$
  4738.  
  4739.     m$ = ""
  4740.     m$ = m$ + "..2222.." + Chr$(13)
  4741.     m$ = m$ + ".22..22." + Chr$(13)
  4742.     m$ = m$ + ".....22." + Chr$(13)
  4743.     m$ = m$ + "...222.." + Chr$(13)
  4744.     m$ = m$ + ".....22." + Chr$(13)
  4745.     m$ = m$ + ".22..22." + Chr$(13)
  4746.     m$ = m$ + "..2222.." + Chr$(13)
  4747.     m$ = m$ + "........" + Chr$(13)
  4748.     arrTileText(51) = m$
  4749.  
  4750.     m$ = ""
  4751.     m$ = m$ + ".....22." + Chr$(13)
  4752.     m$ = m$ + "....222." + Chr$(13)
  4753.     m$ = m$ + "...2222." + Chr$(13)
  4754.     m$ = m$ + ".22..22." + Chr$(13)
  4755.     m$ = m$ + ".2222222" + Chr$(13)
  4756.     m$ = m$ + ".....22." + Chr$(13)
  4757.     m$ = m$ + ".....22." + Chr$(13)
  4758.     m$ = m$ + "........" + Chr$(13)
  4759.     arrTileText(52) = m$
  4760.  
  4761.     m$ = ""
  4762.     m$ = m$ + ".222222." + Chr$(13)
  4763.     m$ = m$ + ".22....." + Chr$(13)
  4764.     m$ = m$ + ".22222.." + Chr$(13)
  4765.     m$ = m$ + ".....22." + Chr$(13)
  4766.     m$ = m$ + ".....22." + Chr$(13)
  4767.     m$ = m$ + ".22..22." + Chr$(13)
  4768.     m$ = m$ + "..2222.." + Chr$(13)
  4769.     m$ = m$ + "........" + Chr$(13)
  4770.     arrTileText(53) = m$
  4771.  
  4772.     m$ = ""
  4773.     m$ = m$ + "..2222.." + Chr$(13)
  4774.     m$ = m$ + ".22..22." + Chr$(13)
  4775.     m$ = m$ + ".22....." + Chr$(13)
  4776.     m$ = m$ + ".22222.." + Chr$(13)
  4777.     m$ = m$ + ".22..22." + Chr$(13)
  4778.     m$ = m$ + ".22..22." + Chr$(13)
  4779.     m$ = m$ + "..2222.." + Chr$(13)
  4780.     m$ = m$ + "........" + Chr$(13)
  4781.     arrTileText(54) = m$
  4782.  
  4783.     m$ = ""
  4784.     m$ = m$ + ".222222." + Chr$(13)
  4785.     m$ = m$ + ".22..22." + Chr$(13)
  4786.     m$ = m$ + "....22.." + Chr$(13)
  4787.     m$ = m$ + "...22..." + Chr$(13)
  4788.     m$ = m$ + "...22..." + Chr$(13)
  4789.     m$ = m$ + "...22..." + Chr$(13)
  4790.     m$ = m$ + "...22..." + Chr$(13)
  4791.     m$ = m$ + "........" + Chr$(13)
  4792.     arrTileText(55) = m$
  4793.  
  4794.     m$ = ""
  4795.     m$ = m$ + "..2222.." + Chr$(13)
  4796.     m$ = m$ + ".22..22." + Chr$(13)
  4797.     m$ = m$ + ".22..22." + Chr$(13)
  4798.     m$ = m$ + "..2222.." + Chr$(13)
  4799.     m$ = m$ + ".22..22." + Chr$(13)
  4800.     m$ = m$ + ".22..22." + Chr$(13)
  4801.     m$ = m$ + "..2222.." + Chr$(13)
  4802.     m$ = m$ + "........" + Chr$(13)
  4803.     arrTileText(56) = m$
  4804.  
  4805.     m$ = ""
  4806.     m$ = m$ + "..2222.." + Chr$(13)
  4807.     m$ = m$ + ".22..22." + Chr$(13)
  4808.     m$ = m$ + ".22..22." + Chr$(13)
  4809.     m$ = m$ + "..22222." + Chr$(13)
  4810.     m$ = m$ + ".....22." + Chr$(13)
  4811.     m$ = m$ + ".22..22." + Chr$(13)
  4812.     m$ = m$ + "..2222.." + Chr$(13)
  4813.     m$ = m$ + "........" + Chr$(13)
  4814.     arrTileText(57) = m$
  4815.  
  4816.     m$ = ""
  4817.     m$ = m$ + "........" + Chr$(13)
  4818.     m$ = m$ + "........" + Chr$(13)
  4819.     m$ = m$ + "...22..." + Chr$(13)
  4820.     m$ = m$ + "........" + Chr$(13)
  4821.     m$ = m$ + "........" + Chr$(13)
  4822.     m$ = m$ + "...22..." + Chr$(13)
  4823.     m$ = m$ + "........" + Chr$(13)
  4824.     m$ = m$ + "........" + Chr$(13)
  4825.     arrTileText(58) = m$
  4826.  
  4827.     m$ = ""
  4828.     m$ = m$ + "........" + Chr$(13)
  4829.     m$ = m$ + "........" + Chr$(13)
  4830.     m$ = m$ + "...22..." + Chr$(13)
  4831.     m$ = m$ + "........" + Chr$(13)
  4832.     m$ = m$ + "........" + Chr$(13)
  4833.     m$ = m$ + "...22..." + Chr$(13)
  4834.     m$ = m$ + "...22..." + Chr$(13)
  4835.     m$ = m$ + "..22...." + Chr$(13)
  4836.     arrTileText(59) = m$
  4837.  
  4838.     m$ = ""
  4839.     m$ = m$ + "....222." + Chr$(13)
  4840.     m$ = m$ + "...22..." + Chr$(13)
  4841.     m$ = m$ + "..22...." + Chr$(13)
  4842.     m$ = m$ + ".22....." + Chr$(13)
  4843.     m$ = m$ + "..22...." + Chr$(13)
  4844.     m$ = m$ + "...22..." + Chr$(13)
  4845.     m$ = m$ + "....222." + Chr$(13)
  4846.     m$ = m$ + "........" + Chr$(13)
  4847.     arrTileText(60) = m$
  4848.  
  4849.     m$ = ""
  4850.     m$ = m$ + "........" + Chr$(13)
  4851.     m$ = m$ + "........" + Chr$(13)
  4852.     m$ = m$ + ".222222." + Chr$(13)
  4853.     m$ = m$ + "........" + Chr$(13)
  4854.     m$ = m$ + ".222222." + Chr$(13)
  4855.     m$ = m$ + "........" + Chr$(13)
  4856.     m$ = m$ + "........" + Chr$(13)
  4857.     m$ = m$ + "........" + Chr$(13)
  4858.     arrTileText(61) = m$
  4859.  
  4860.     m$ = ""
  4861.     m$ = m$ + ".222...." + Chr$(13)
  4862.     m$ = m$ + "...22..." + Chr$(13)
  4863.     m$ = m$ + "....22.." + Chr$(13)
  4864.     m$ = m$ + ".....22." + Chr$(13)
  4865.     m$ = m$ + "....22.." + Chr$(13)
  4866.     m$ = m$ + "...22..." + Chr$(13)
  4867.     m$ = m$ + ".222...." + Chr$(13)
  4868.     m$ = m$ + "........" + Chr$(13)
  4869.     arrTileText(62) = m$
  4870.  
  4871.     m$ = ""
  4872.     m$ = m$ + "..2222.." + Chr$(13)
  4873.     m$ = m$ + ".22..22." + Chr$(13)
  4874.     m$ = m$ + ".....22." + Chr$(13)
  4875.     m$ = m$ + "....22.." + Chr$(13)
  4876.     m$ = m$ + "...22..." + Chr$(13)
  4877.     m$ = m$ + "........" + Chr$(13)
  4878.     m$ = m$ + "...22..." + Chr$(13)
  4879.     m$ = m$ + "........" + Chr$(13)
  4880.     arrTileText(63) = m$
  4881.  
  4882.     m$ = ""
  4883.     m$ = m$ + "..2222.." + Chr$(13)
  4884.     m$ = m$ + ".22..22." + Chr$(13)
  4885.     m$ = m$ + ".22.222." + Chr$(13)
  4886.     m$ = m$ + ".22.222." + Chr$(13)
  4887.     m$ = m$ + ".22....." + Chr$(13)
  4888.     m$ = m$ + ".22...2." + Chr$(13)
  4889.     m$ = m$ + "..2222.." + Chr$(13)
  4890.     m$ = m$ + "........" + Chr$(13)
  4891.     arrTileText(64) = m$
  4892.  
  4893.     m$ = ""
  4894.     m$ = m$ + "...22..." + Chr$(13)
  4895.     m$ = m$ + "..2222.." + Chr$(13)
  4896.     m$ = m$ + ".22..22." + Chr$(13)
  4897.     m$ = m$ + ".222222." + Chr$(13)
  4898.     m$ = m$ + ".22..22." + Chr$(13)
  4899.     m$ = m$ + ".22..22." + Chr$(13)
  4900.     m$ = m$ + ".22..22." + Chr$(13)
  4901.     m$ = m$ + "........" + Chr$(13)
  4902.     arrTileText(65) = m$
  4903.  
  4904.     m$ = ""
  4905.     m$ = m$ + ".22222.." + Chr$(13)
  4906.     m$ = m$ + ".22..22." + Chr$(13)
  4907.     m$ = m$ + ".22..22." + Chr$(13)
  4908.     m$ = m$ + ".22222.." + Chr$(13)
  4909.     m$ = m$ + ".22..22." + Chr$(13)
  4910.     m$ = m$ + ".22..22." + Chr$(13)
  4911.     m$ = m$ + ".22222.." + Chr$(13)
  4912.     m$ = m$ + "........" + Chr$(13)
  4913.     arrTileText(66) = m$
  4914.  
  4915.     m$ = ""
  4916.     m$ = m$ + "..2222.." + Chr$(13)
  4917.     m$ = m$ + ".22..22." + Chr$(13)
  4918.     m$ = m$ + ".22....." + Chr$(13)
  4919.     m$ = m$ + ".22....." + Chr$(13)
  4920.     m$ = m$ + ".22....." + Chr$(13)
  4921.     m$ = m$ + ".22..22." + Chr$(13)
  4922.     m$ = m$ + "..2222.." + Chr$(13)
  4923.     m$ = m$ + "........" + Chr$(13)
  4924.     arrTileText(67) = m$
  4925.  
  4926.     m$ = ""
  4927.     m$ = m$ + ".2222..." + Chr$(13)
  4928.     m$ = m$ + ".22.22.." + Chr$(13)
  4929.     m$ = m$ + ".22..22." + Chr$(13)
  4930.     m$ = m$ + ".22..22." + Chr$(13)
  4931.     m$ = m$ + ".22..22." + Chr$(13)
  4932.     m$ = m$ + ".22.22.." + Chr$(13)
  4933.     m$ = m$ + ".2222..." + Chr$(13)
  4934.     m$ = m$ + "........" + Chr$(13)
  4935.     arrTileText(68) = m$
  4936.  
  4937.     m$ = ""
  4938.     m$ = m$ + ".222222." + Chr$(13)
  4939.     m$ = m$ + ".22....." + Chr$(13)
  4940.     m$ = m$ + ".22....." + Chr$(13)
  4941.     m$ = m$ + ".2222..." + Chr$(13)
  4942.     m$ = m$ + ".22....." + Chr$(13)
  4943.     m$ = m$ + ".22....." + Chr$(13)
  4944.     m$ = m$ + ".222222." + Chr$(13)
  4945.     m$ = m$ + "........" + Chr$(13)
  4946.     arrTileText(69) = m$
  4947.  
  4948.     m$ = ""
  4949.     m$ = m$ + ".222222." + Chr$(13)
  4950.     m$ = m$ + ".22....." + Chr$(13)
  4951.     m$ = m$ + ".22....." + Chr$(13)
  4952.     m$ = m$ + ".2222..." + Chr$(13)
  4953.     m$ = m$ + ".22....." + Chr$(13)
  4954.     m$ = m$ + ".22....." + Chr$(13)
  4955.     m$ = m$ + ".22....." + Chr$(13)
  4956.     m$ = m$ + "........" + Chr$(13)
  4957.     arrTileText(70) = m$
  4958.  
  4959.     m$ = ""
  4960.     m$ = m$ + "..2222.." + Chr$(13)
  4961.     m$ = m$ + ".22..22." + Chr$(13)
  4962.     m$ = m$ + ".22....." + Chr$(13)
  4963.     m$ = m$ + ".22.222." + Chr$(13)
  4964.     m$ = m$ + ".22..22." + Chr$(13)
  4965.     m$ = m$ + ".22..22." + Chr$(13)
  4966.     m$ = m$ + "..2222.." + Chr$(13)
  4967.     m$ = m$ + "........" + Chr$(13)
  4968.     arrTileText(71) = m$
  4969.  
  4970.     m$ = ""
  4971.     m$ = m$ + ".22..22." + Chr$(13)
  4972.     m$ = m$ + ".22..22." + Chr$(13)
  4973.     m$ = m$ + ".22..22." + Chr$(13)
  4974.     m$ = m$ + ".222222." + Chr$(13)
  4975.     m$ = m$ + ".22..22." + Chr$(13)
  4976.     m$ = m$ + ".22..22." + Chr$(13)
  4977.     m$ = m$ + ".22..22." + Chr$(13)
  4978.     m$ = m$ + "........" + Chr$(13)
  4979.     arrTileText(72) = m$
  4980.  
  4981.     m$ = ""
  4982.     m$ = m$ + "..2222.." + Chr$(13)
  4983.     m$ = m$ + "...22..." + Chr$(13)
  4984.     m$ = m$ + "...22..." + Chr$(13)
  4985.     m$ = m$ + "...22..." + Chr$(13)
  4986.     m$ = m$ + "...22..." + Chr$(13)
  4987.     m$ = m$ + "...22..." + Chr$(13)
  4988.     m$ = m$ + "..2222.." + Chr$(13)
  4989.     m$ = m$ + "........" + Chr$(13)
  4990.     arrTileText(73) = m$
  4991.  
  4992.     m$ = ""
  4993.     m$ = m$ + "...2222." + Chr$(13)
  4994.     m$ = m$ + "....22.." + Chr$(13)
  4995.     m$ = m$ + "....22.." + Chr$(13)
  4996.     m$ = m$ + "....22.." + Chr$(13)
  4997.     m$ = m$ + "....22.." + Chr$(13)
  4998.     m$ = m$ + ".22.22.." + Chr$(13)
  4999.     m$ = m$ + "..222..." + Chr$(13)
  5000.     m$ = m$ + "........" + Chr$(13)
  5001.     arrTileText(74) = m$
  5002.  
  5003.     m$ = ""
  5004.     m$ = m$ + ".22..22." + Chr$(13)
  5005.     m$ = m$ + ".22.22.." + Chr$(13)
  5006.     m$ = m$ + ".2222..." + Chr$(13)
  5007.     m$ = m$ + ".222...." + Chr$(13)
  5008.     m$ = m$ + ".2222..." + Chr$(13)
  5009.     m$ = m$ + ".22.22.." + Chr$(13)
  5010.     m$ = m$ + ".22..22." + Chr$(13)
  5011.     m$ = m$ + "........" + Chr$(13)
  5012.     arrTileText(75) = m$
  5013.  
  5014.     m$ = ""
  5015.     m$ = m$ + ".22....." + Chr$(13)
  5016.     m$ = m$ + ".22....." + Chr$(13)
  5017.     m$ = m$ + ".22....." + Chr$(13)
  5018.     m$ = m$ + ".22....." + Chr$(13)
  5019.     m$ = m$ + ".22....." + Chr$(13)
  5020.     m$ = m$ + ".22....." + Chr$(13)
  5021.     m$ = m$ + ".222222." + Chr$(13)
  5022.     m$ = m$ + "........" + Chr$(13)
  5023.     arrTileText(76) = m$
  5024.  
  5025.     m$ = ""
  5026.     m$ = m$ + ".22...22" + Chr$(13)
  5027.     m$ = m$ + ".222.222" + Chr$(13)
  5028.     m$ = m$ + ".2222222" + Chr$(13)
  5029.     m$ = m$ + ".22.2.22" + Chr$(13)
  5030.     m$ = m$ + ".22...22" + Chr$(13)
  5031.     m$ = m$ + ".22...22" + Chr$(13)
  5032.     m$ = m$ + ".22...22" + Chr$(13)
  5033.     m$ = m$ + "........" + Chr$(13)
  5034.     arrTileText(77) = m$
  5035.  
  5036.     m$ = ""
  5037.     m$ = m$ + ".22..22." + Chr$(13)
  5038.     m$ = m$ + ".222.22." + Chr$(13)
  5039.     m$ = m$ + ".222222." + Chr$(13)
  5040.     m$ = m$ + ".222222." + Chr$(13)
  5041.     m$ = m$ + ".22.222." + Chr$(13)
  5042.     m$ = m$ + ".22..22." + Chr$(13)
  5043.     m$ = m$ + ".22..22." + Chr$(13)
  5044.     m$ = m$ + "........" + Chr$(13)
  5045.     arrTileText(78) = m$
  5046.  
  5047.     m$ = ""
  5048.     m$ = m$ + "..2222.." + Chr$(13)
  5049.     m$ = m$ + ".22..22." + Chr$(13)
  5050.     m$ = m$ + ".22..22." + Chr$(13)
  5051.     m$ = m$ + ".22..22." + Chr$(13)
  5052.     m$ = m$ + ".22..22." + Chr$(13)
  5053.     m$ = m$ + ".22..22." + Chr$(13)
  5054.     m$ = m$ + "..2222.." + Chr$(13)
  5055.     m$ = m$ + "........" + Chr$(13)
  5056.     arrTileText(79) = m$
  5057.  
  5058.     m$ = ""
  5059.     m$ = m$ + ".22222.." + Chr$(13)
  5060.     m$ = m$ + ".22..22." + Chr$(13)
  5061.     m$ = m$ + ".22..22." + Chr$(13)
  5062.     m$ = m$ + ".22222.." + Chr$(13)
  5063.     m$ = m$ + ".22....." + Chr$(13)
  5064.     m$ = m$ + ".22....." + Chr$(13)
  5065.     m$ = m$ + ".22....." + Chr$(13)
  5066.     m$ = m$ + "........" + Chr$(13)
  5067.     arrTileText(80) = m$
  5068.  
  5069.     m$ = ""
  5070.     m$ = m$ + "..2222.." + Chr$(13)
  5071.     m$ = m$ + ".22..22." + Chr$(13)
  5072.     m$ = m$ + ".22..22." + Chr$(13)
  5073.     m$ = m$ + ".22..22." + Chr$(13)
  5074.     m$ = m$ + ".22..22." + Chr$(13)
  5075.     m$ = m$ + "..2222.." + Chr$(13)
  5076.     m$ = m$ + "....222." + Chr$(13)
  5077.     m$ = m$ + "........" + Chr$(13)
  5078.     arrTileText(81) = m$
  5079.  
  5080.     m$ = ""
  5081.     m$ = m$ + ".22222.." + Chr$(13)
  5082.     m$ = m$ + ".22..22." + Chr$(13)
  5083.     m$ = m$ + ".22..22." + Chr$(13)
  5084.     m$ = m$ + ".22222.." + Chr$(13)
  5085.     m$ = m$ + ".2222..." + Chr$(13)
  5086.     m$ = m$ + ".22.22.." + Chr$(13)
  5087.     m$ = m$ + ".22..22." + Chr$(13)
  5088.     m$ = m$ + "........" + Chr$(13)
  5089.     arrTileText(82) = m$
  5090.  
  5091.     m$ = ""
  5092.     m$ = m$ + "..2222.." + Chr$(13)
  5093.     m$ = m$ + ".22..22." + Chr$(13)
  5094.     m$ = m$ + ".22....." + Chr$(13)
  5095.     m$ = m$ + "..2222.." + Chr$(13)
  5096.     m$ = m$ + ".....22." + Chr$(13)
  5097.     m$ = m$ + ".22..22." + Chr$(13)
  5098.     m$ = m$ + "..2222.." + Chr$(13)
  5099.     m$ = m$ + "........" + Chr$(13)
  5100.     arrTileText(83) = m$
  5101.  
  5102.     m$ = ""
  5103.     m$ = m$ + ".222222." + Chr$(13)
  5104.     m$ = m$ + "...22..." + Chr$(13)
  5105.     m$ = m$ + "...22..." + Chr$(13)
  5106.     m$ = m$ + "...22..." + Chr$(13)
  5107.     m$ = m$ + "...22..." + Chr$(13)
  5108.     m$ = m$ + "...22..." + Chr$(13)
  5109.     m$ = m$ + "...22..." + Chr$(13)
  5110.     m$ = m$ + "........" + Chr$(13)
  5111.     arrTileText(84) = m$
  5112.  
  5113.     m$ = ""
  5114.     m$ = m$ + ".22..22." + Chr$(13)
  5115.     m$ = m$ + ".22..22." + Chr$(13)
  5116.     m$ = m$ + ".22..22." + Chr$(13)
  5117.     m$ = m$ + ".22..22." + Chr$(13)
  5118.     m$ = m$ + ".22..22." + Chr$(13)
  5119.     m$ = m$ + ".22..22." + Chr$(13)
  5120.     m$ = m$ + "..2222.." + Chr$(13)
  5121.     m$ = m$ + "........" + Chr$(13)
  5122.     arrTileText(85) = m$
  5123.  
  5124.     m$ = ""
  5125.     m$ = m$ + ".22..22." + Chr$(13)
  5126.     m$ = m$ + ".22..22." + Chr$(13)
  5127.     m$ = m$ + ".22..22." + Chr$(13)
  5128.     m$ = m$ + ".22..22." + Chr$(13)
  5129.     m$ = m$ + ".22..22." + Chr$(13)
  5130.     m$ = m$ + "..2222.." + Chr$(13)
  5131.     m$ = m$ + "...22..." + Chr$(13)
  5132.     m$ = m$ + "........" + Chr$(13)
  5133.     arrTileText(86) = m$
  5134.  
  5135.     m$ = ""
  5136.     m$ = m$ + ".22...22" + Chr$(13)
  5137.     m$ = m$ + ".22...22" + Chr$(13)
  5138.     m$ = m$ + ".22...22" + Chr$(13)
  5139.     m$ = m$ + ".22.2.22" + Chr$(13)
  5140.     m$ = m$ + ".2222222" + Chr$(13)
  5141.     m$ = m$ + ".222.222" + Chr$(13)
  5142.     m$ = m$ + ".22...22" + Chr$(13)
  5143.     m$ = m$ + "........" + Chr$(13)
  5144.     arrTileText(87) = m$
  5145.  
  5146.     m$ = ""
  5147.     m$ = m$ + ".22..22." + Chr$(13)
  5148.     m$ = m$ + ".22..22." + Chr$(13)
  5149.     m$ = m$ + "..2222.." + Chr$(13)
  5150.     m$ = m$ + "...22..." + Chr$(13)
  5151.     m$ = m$ + "..2222.." + Chr$(13)
  5152.     m$ = m$ + ".22..22." + Chr$(13)
  5153.     m$ = m$ + ".22..22." + Chr$(13)
  5154.     m$ = m$ + "........" + Chr$(13)
  5155.     arrTileText(88) = m$
  5156.  
  5157.     m$ = ""
  5158.     m$ = m$ + ".22..22." + Chr$(13)
  5159.     m$ = m$ + ".22..22." + Chr$(13)
  5160.     m$ = m$ + ".22..22." + Chr$(13)
  5161.     m$ = m$ + "..2222.." + Chr$(13)
  5162.     m$ = m$ + "...22..." + Chr$(13)
  5163.     m$ = m$ + "...22..." + Chr$(13)
  5164.     m$ = m$ + "...22..." + Chr$(13)
  5165.     m$ = m$ + "........" + Chr$(13)
  5166.     arrTileText(89) = m$
  5167.  
  5168.     m$ = ""
  5169.     m$ = m$ + ".222222." + Chr$(13)
  5170.     m$ = m$ + ".....22." + Chr$(13)
  5171.     m$ = m$ + "....22.." + Chr$(13)
  5172.     m$ = m$ + "...22..." + Chr$(13)
  5173.     m$ = m$ + "..22...." + Chr$(13)
  5174.     m$ = m$ + ".22....." + Chr$(13)
  5175.     m$ = m$ + ".222222." + Chr$(13)
  5176.     m$ = m$ + "........" + Chr$(13)
  5177.     arrTileText(90) = m$
  5178.  
  5179.     m$ = ""
  5180.     m$ = m$ + "..2222.." + Chr$(13)
  5181.     m$ = m$ + "..22...." + Chr$(13)
  5182.     m$ = m$ + "..22...." + Chr$(13)
  5183.     m$ = m$ + "..22...." + Chr$(13)
  5184.     m$ = m$ + "..22...." + Chr$(13)
  5185.     m$ = m$ + "..22...." + Chr$(13)
  5186.     m$ = m$ + "..2222.." + Chr$(13)
  5187.     m$ = m$ + "........" + Chr$(13)
  5188.     arrTileText(91) = m$
  5189.  
  5190.     m$ = ""
  5191.     m$ = m$ + "........" + Chr$(13)
  5192.     m$ = m$ + ".22....." + Chr$(13)
  5193.     m$ = m$ + "..22...." + Chr$(13)
  5194.     m$ = m$ + "...22..." + Chr$(13)
  5195.     m$ = m$ + "....22.." + Chr$(13)
  5196.     m$ = m$ + ".....22." + Chr$(13)
  5197.     m$ = m$ + "......22" + Chr$(13)
  5198.     m$ = m$ + "........" + Chr$(13)
  5199.     arrTileText(92) = m$
  5200.  
  5201.     m$ = ""
  5202.     m$ = m$ + "..2222.." + Chr$(13)
  5203.     m$ = m$ + "....22.." + Chr$(13)
  5204.     m$ = m$ + "....22.." + Chr$(13)
  5205.     m$ = m$ + "....22.." + Chr$(13)
  5206.     m$ = m$ + "....22.." + Chr$(13)
  5207.     m$ = m$ + "....22.." + Chr$(13)
  5208.     m$ = m$ + "..2222.." + Chr$(13)
  5209.     m$ = m$ + "........" + Chr$(13)
  5210.     arrTileText(93) = m$
  5211.  
  5212.     m$ = ""
  5213.     m$ = m$ + "...22..." + Chr$(13)
  5214.     m$ = m$ + "..2222.." + Chr$(13)
  5215.     m$ = m$ + ".22..22." + Chr$(13)
  5216.     m$ = m$ + "........" + Chr$(13)
  5217.     m$ = m$ + "........" + Chr$(13)
  5218.     m$ = m$ + "........" + Chr$(13)
  5219.     m$ = m$ + "........" + Chr$(13)
  5220.     m$ = m$ + "........" + Chr$(13)
  5221.     arrTileText(94) = m$
  5222.  
  5223.     m$ = ""
  5224.     m$ = m$ + "........" + Chr$(13)
  5225.     m$ = m$ + "........" + Chr$(13)
  5226.     m$ = m$ + "........" + Chr$(13)
  5227.     m$ = m$ + "........" + Chr$(13)
  5228.     m$ = m$ + "........" + Chr$(13)
  5229.     m$ = m$ + ".222222." + Chr$(13)
  5230.     m$ = m$ + "........" + Chr$(13)
  5231.     m$ = m$ + "........" + Chr$(13)
  5232.     arrTileText(95) = m$
  5233.  
  5234.     m$ = ""
  5235.     m$ = m$ + "........" + Chr$(13)
  5236.     m$ = m$ + "........" + Chr$(13)
  5237.     m$ = m$ + "........" + Chr$(13)
  5238.     m$ = m$ + "........" + Chr$(13)
  5239.     m$ = m$ + "........" + Chr$(13)
  5240.     m$ = m$ + "........" + Chr$(13)
  5241.     m$ = m$ + "........" + Chr$(13)
  5242.     m$ = m$ + "........" + Chr$(13)
  5243.     arrTileText(96) = m$
  5244.  
  5245.     m$ = ""
  5246.     m$ = m$ + "........" + Chr$(13)
  5247.     m$ = m$ + "..2222.." + Chr$(13)
  5248.     m$ = m$ + ".....22." + Chr$(13)
  5249.     m$ = m$ + "..22222." + Chr$(13)
  5250.     m$ = m$ + ".22..22." + Chr$(13)
  5251.     m$ = m$ + "..22222." + Chr$(13)
  5252.     m$ = m$ + "........" + Chr$(13)
  5253.     m$ = m$ + "........" + Chr$(13)
  5254.     arrTileText(97) = m$
  5255.  
  5256.     m$ = ""
  5257.     m$ = m$ + ".22....." + Chr$(13)
  5258.     m$ = m$ + ".22....." + Chr$(13)
  5259.     m$ = m$ + ".22222.." + Chr$(13)
  5260.     m$ = m$ + ".22..22." + Chr$(13)
  5261.     m$ = m$ + ".22..22." + Chr$(13)
  5262.     m$ = m$ + ".22222.." + Chr$(13)
  5263.     m$ = m$ + "........" + Chr$(13)
  5264.     m$ = m$ + "........" + Chr$(13)
  5265.     arrTileText(98) = m$
  5266.  
  5267.     m$ = ""
  5268.     m$ = m$ + "........" + Chr$(13)
  5269.     m$ = m$ + "..2222.." + Chr$(13)
  5270.     m$ = m$ + ".22....." + Chr$(13)
  5271.     m$ = m$ + ".22....." + Chr$(13)
  5272.     m$ = m$ + ".22....." + Chr$(13)
  5273.     m$ = m$ + "..2222.." + Chr$(13)
  5274.     m$ = m$ + "........" + Chr$(13)
  5275.     m$ = m$ + "........" + Chr$(13)
  5276.     arrTileText(99) = m$
  5277.  
  5278.     m$ = ""
  5279.     m$ = m$ + ".....22." + Chr$(13)
  5280.     m$ = m$ + ".....22." + Chr$(13)
  5281.     m$ = m$ + "..22222." + Chr$(13)
  5282.     m$ = m$ + ".22..22." + Chr$(13)
  5283.     m$ = m$ + ".22..22." + Chr$(13)
  5284.     m$ = m$ + "..22222." + Chr$(13)
  5285.     m$ = m$ + "........" + Chr$(13)
  5286.     m$ = m$ + "........" + Chr$(13)
  5287.     arrTileText(100) = m$
  5288.  
  5289.     m$ = ""
  5290.     m$ = m$ + "........" + Chr$(13)
  5291.     m$ = m$ + "..2222.." + Chr$(13)
  5292.     m$ = m$ + ".22..22." + Chr$(13)
  5293.     m$ = m$ + ".222222." + Chr$(13)
  5294.     m$ = m$ + ".22....." + Chr$(13)
  5295.     m$ = m$ + "..2222.." + Chr$(13)
  5296.     m$ = m$ + "........" + Chr$(13)
  5297.     m$ = m$ + "........" + Chr$(13)
  5298.     arrTileText(101) = m$
  5299.  
  5300.     m$ = ""
  5301.     m$ = m$ + "....222." + Chr$(13)
  5302.     m$ = m$ + "...22..." + Chr$(13)
  5303.     m$ = m$ + "..22222." + Chr$(13)
  5304.     m$ = m$ + "...22..." + Chr$(13)
  5305.     m$ = m$ + "...22..." + Chr$(13)
  5306.     m$ = m$ + "...22..." + Chr$(13)
  5307.     m$ = m$ + "........" + Chr$(13)
  5308.     m$ = m$ + "........" + Chr$(13)
  5309.     arrTileText(102) = m$
  5310.  
  5311.     m$ = ""
  5312.     m$ = m$ + "........" + Chr$(13)
  5313.     m$ = m$ + "..22222." + Chr$(13)
  5314.     m$ = m$ + ".22..22." + Chr$(13)
  5315.     m$ = m$ + ".22..22." + Chr$(13)
  5316.     m$ = m$ + "..22222." + Chr$(13)
  5317.     m$ = m$ + ".....22." + Chr$(13)
  5318.     m$ = m$ + ".22222.." + Chr$(13)
  5319.     m$ = m$ + "........" + Chr$(13)
  5320.     arrTileText(103) = m$
  5321.  
  5322.     m$ = ""
  5323.     m$ = m$ + ".22....." + Chr$(13)
  5324.     m$ = m$ + ".22....." + Chr$(13)
  5325.     m$ = m$ + ".22222.." + Chr$(13)
  5326.     m$ = m$ + ".22..22." + Chr$(13)
  5327.     m$ = m$ + ".22..22." + Chr$(13)
  5328.     m$ = m$ + ".22..22." + Chr$(13)
  5329.     m$ = m$ + "........" + Chr$(13)
  5330.     m$ = m$ + "........" + Chr$(13)
  5331.     arrTileText(104) = m$
  5332.  
  5333.     m$ = ""
  5334.     m$ = m$ + "...22..." + Chr$(13)
  5335.     m$ = m$ + "........" + Chr$(13)
  5336.     m$ = m$ + "..222..." + Chr$(13)
  5337.     m$ = m$ + "...22..." + Chr$(13)
  5338.     m$ = m$ + "...22..." + Chr$(13)
  5339.     m$ = m$ + "..2222.." + Chr$(13)
  5340.     m$ = m$ + "........" + Chr$(13)
  5341.     m$ = m$ + "........" + Chr$(13)
  5342.     arrTileText(105) = m$
  5343.  
  5344.     m$ = ""
  5345.     m$ = m$ + ".....22." + Chr$(13)
  5346.     m$ = m$ + "........" + Chr$(13)
  5347.     m$ = m$ + ".....22." + Chr$(13)
  5348.     m$ = m$ + ".....22." + Chr$(13)
  5349.     m$ = m$ + ".....22." + Chr$(13)
  5350.     m$ = m$ + ".....22." + Chr$(13)
  5351.     m$ = m$ + "..2222.." + Chr$(13)
  5352.     m$ = m$ + "........" + Chr$(13)
  5353.     arrTileText(106) = m$
  5354.  
  5355.     m$ = ""
  5356.     m$ = m$ + ".22....." + Chr$(13)
  5357.     m$ = m$ + ".22....." + Chr$(13)
  5358.     m$ = m$ + ".22.22.." + Chr$(13)
  5359.     m$ = m$ + ".2222..." + Chr$(13)
  5360.     m$ = m$ + ".22.22.." + Chr$(13)
  5361.     m$ = m$ + ".22..22." + Chr$(13)
  5362.     m$ = m$ + "........" + Chr$(13)
  5363.     m$ = m$ + "........" + Chr$(13)
  5364.     arrTileText(107) = m$
  5365.  
  5366.     m$ = ""
  5367.     m$ = m$ + "..222..." + Chr$(13)
  5368.     m$ = m$ + "...22..." + Chr$(13)
  5369.     m$ = m$ + "...22..." + Chr$(13)
  5370.     m$ = m$ + "...22..." + Chr$(13)
  5371.     m$ = m$ + "...22..." + Chr$(13)
  5372.     m$ = m$ + "..2222.." + Chr$(13)
  5373.     m$ = m$ + "........" + Chr$(13)
  5374.     m$ = m$ + "........" + Chr$(13)
  5375.     arrTileText(108) = m$
  5376.  
  5377.     m$ = ""
  5378.     m$ = m$ + "........" + Chr$(13)
  5379.     m$ = m$ + ".22..22." + Chr$(13)
  5380.     m$ = m$ + ".2222222" + Chr$(13)
  5381.     m$ = m$ + ".2222222" + Chr$(13)
  5382.     m$ = m$ + ".22.2.22" + Chr$(13)
  5383.     m$ = m$ + ".22...22" + Chr$(13)
  5384.     m$ = m$ + "........" + Chr$(13)
  5385.     m$ = m$ + "........" + Chr$(13)
  5386.     arrTileText(109) = m$
  5387.  
  5388.     m$ = ""
  5389.     m$ = m$ + "........" + Chr$(13)
  5390.     m$ = m$ + ".22222.." + Chr$(13)
  5391.     m$ = m$ + ".22..22." + Chr$(13)
  5392.     m$ = m$ + ".22..22." + Chr$(13)
  5393.     m$ = m$ + ".22..22." + Chr$(13)
  5394.     m$ = m$ + ".22..22." + Chr$(13)
  5395.     m$ = m$ + "........" + Chr$(13)
  5396.     m$ = m$ + "........" + Chr$(13)
  5397.     arrTileText(110) = m$
  5398.  
  5399.     m$ = ""
  5400.     m$ = m$ + "........" + Chr$(13)
  5401.     m$ = m$ + "..2222.." + Chr$(13)
  5402.     m$ = m$ + ".22..22." + Chr$(13)
  5403.     m$ = m$ + ".22..22." + Chr$(13)
  5404.     m$ = m$ + ".22..22." + Chr$(13)
  5405.     m$ = m$ + "..2222.." + Chr$(13)
  5406.     m$ = m$ + "........" + Chr$(13)
  5407.     m$ = m$ + "........" + Chr$(13)
  5408.     arrTileText(111) = m$
  5409.  
  5410.     m$ = ""
  5411.     m$ = m$ + "........" + Chr$(13)
  5412.     m$ = m$ + ".22222.." + Chr$(13)
  5413.     m$ = m$ + ".22..22." + Chr$(13)
  5414.     m$ = m$ + ".22..22." + Chr$(13)
  5415.     m$ = m$ + ".22222.." + Chr$(13)
  5416.     m$ = m$ + ".22....." + Chr$(13)
  5417.     m$ = m$ + ".22....." + Chr$(13)
  5418.     m$ = m$ + "........" + Chr$(13)
  5419.     arrTileText(112) = m$
  5420.  
  5421.     m$ = ""
  5422.     m$ = m$ + "........" + Chr$(13)
  5423.     m$ = m$ + "..22222." + Chr$(13)
  5424.     m$ = m$ + ".22..22." + Chr$(13)
  5425.     m$ = m$ + ".22..22." + Chr$(13)
  5426.     m$ = m$ + "..22222." + Chr$(13)
  5427.     m$ = m$ + ".....22." + Chr$(13)
  5428.     m$ = m$ + ".....22." + Chr$(13)
  5429.     m$ = m$ + "........" + Chr$(13)
  5430.     arrTileText(113) = m$
  5431.  
  5432.     m$ = ""
  5433.     m$ = m$ + "........" + Chr$(13)
  5434.     m$ = m$ + ".22222.." + Chr$(13)
  5435.     m$ = m$ + ".22..22." + Chr$(13)
  5436.     m$ = m$ + ".22....." + Chr$(13)
  5437.     m$ = m$ + ".22....." + Chr$(13)
  5438.     m$ = m$ + ".22....." + Chr$(13)
  5439.     m$ = m$ + "........" + Chr$(13)
  5440.     m$ = m$ + "........" + Chr$(13)
  5441.     arrTileText(114) = m$
  5442.  
  5443.     m$ = ""
  5444.     m$ = m$ + "........" + Chr$(13)
  5445.     m$ = m$ + "..22222." + Chr$(13)
  5446.     m$ = m$ + ".22....." + Chr$(13)
  5447.     m$ = m$ + "..2222.." + Chr$(13)
  5448.     m$ = m$ + ".....22." + Chr$(13)
  5449.     m$ = m$ + ".22222.." + Chr$(13)
  5450.     m$ = m$ + "........" + Chr$(13)
  5451.     m$ = m$ + "........" + Chr$(13)
  5452.     arrTileText(115) = m$
  5453.  
  5454.     m$ = ""
  5455.     m$ = m$ + "...22..." + Chr$(13)
  5456.     m$ = m$ + ".222222." + Chr$(13)
  5457.     m$ = m$ + "...22..." + Chr$(13)
  5458.     m$ = m$ + "...22..." + Chr$(13)
  5459.     m$ = m$ + "...22..." + Chr$(13)
  5460.     m$ = m$ + "....222." + Chr$(13)
  5461.     m$ = m$ + "........" + Chr$(13)
  5462.     m$ = m$ + "........" + Chr$(13)
  5463.     arrTileText(116) = m$
  5464.  
  5465.     m$ = ""
  5466.     m$ = m$ + "........" + Chr$(13)
  5467.     m$ = m$ + ".22..22." + Chr$(13)
  5468.     m$ = m$ + ".22..22." + Chr$(13)
  5469.     m$ = m$ + ".22..22." + Chr$(13)
  5470.     m$ = m$ + ".22..22." + Chr$(13)
  5471.     m$ = m$ + "..22222." + Chr$(13)
  5472.     m$ = m$ + "........" + Chr$(13)
  5473.     m$ = m$ + "........" + Chr$(13)
  5474.     arrTileText(117) = m$
  5475.  
  5476.     m$ = ""
  5477.     m$ = m$ + "........" + Chr$(13)
  5478.     m$ = m$ + ".22..22." + Chr$(13)
  5479.     m$ = m$ + ".22..22." + Chr$(13)
  5480.     m$ = m$ + ".22..22." + Chr$(13)
  5481.     m$ = m$ + "..2222.." + Chr$(13)
  5482.     m$ = m$ + "...22..." + Chr$(13)
  5483.     m$ = m$ + "........" + Chr$(13)
  5484.     m$ = m$ + "........" + Chr$(13)
  5485.     arrTileText(118) = m$
  5486.  
  5487.     m$ = ""
  5488.     m$ = m$ + "........" + Chr$(13)
  5489.     m$ = m$ + ".22...22" + Chr$(13)
  5490.     m$ = m$ + ".22.2.22" + Chr$(13)
  5491.     m$ = m$ + ".2222222" + Chr$(13)
  5492.     m$ = m$ + "..22222." + Chr$(13)
  5493.     m$ = m$ + "..22.22." + Chr$(13)
  5494.     m$ = m$ + "........" + Chr$(13)
  5495.     m$ = m$ + "........" + Chr$(13)
  5496.     arrTileText(119) = m$
  5497.  
  5498.     m$ = ""
  5499.     m$ = m$ + "........" + Chr$(13)
  5500.     m$ = m$ + ".22..22." + Chr$(13)
  5501.     m$ = m$ + "..2222.." + Chr$(13)
  5502.     m$ = m$ + "...22..." + Chr$(13)
  5503.     m$ = m$ + "..2222.." + Chr$(13)
  5504.     m$ = m$ + ".22..22." + Chr$(13)
  5505.     m$ = m$ + "........" + Chr$(13)
  5506.     m$ = m$ + "........" + Chr$(13)
  5507.     arrTileText(120) = m$
  5508.  
  5509.     m$ = ""
  5510.     m$ = m$ + "........" + Chr$(13)
  5511.     m$ = m$ + ".22..22." + Chr$(13)
  5512.     m$ = m$ + ".22..22." + Chr$(13)
  5513.     m$ = m$ + ".22..22." + Chr$(13)
  5514.     m$ = m$ + "..22222." + Chr$(13)
  5515.     m$ = m$ + "....22.." + Chr$(13)
  5516.     m$ = m$ + ".2222..." + Chr$(13)
  5517.     m$ = m$ + "........" + Chr$(13)
  5518.     arrTileText(121) = m$
  5519.  
  5520.     m$ = ""
  5521.     m$ = m$ + "........" + Chr$(13)
  5522.     m$ = m$ + ".222222." + Chr$(13)
  5523.     m$ = m$ + "....22.." + Chr$(13)
  5524.     m$ = m$ + "...22..." + Chr$(13)
  5525.     m$ = m$ + "..22...." + Chr$(13)
  5526.     m$ = m$ + ".222222." + Chr$(13)
  5527.     m$ = m$ + "........" + Chr$(13)
  5528.     m$ = m$ + "........" + Chr$(13)
  5529.     arrTileText(122) = m$
  5530.  
  5531.     m$ = ""
  5532.     m$ = m$ + "...222.." + Chr$(13)
  5533.     m$ = m$ + "..22...." + Chr$(13)
  5534.     m$ = m$ + "..2....." + Chr$(13)
  5535.     m$ = m$ + ".22....." + Chr$(13)
  5536.     m$ = m$ + "..2....." + Chr$(13)
  5537.     m$ = m$ + "..22...." + Chr$(13)
  5538.     m$ = m$ + "...222.." + Chr$(13)
  5539.     m$ = m$ + "........" + Chr$(13)
  5540.     arrTileText(123) = m$
  5541.  
  5542.     m$ = ""
  5543.     m$ = m$ + "....2..." + Chr$(13)
  5544.     m$ = m$ + "....2..." + Chr$(13)
  5545.     m$ = m$ + "....2..." + Chr$(13)
  5546.     m$ = m$ + "....2..." + Chr$(13)
  5547.     m$ = m$ + "....2..." + Chr$(13)
  5548.     m$ = m$ + "....2..." + Chr$(13)
  5549.     m$ = m$ + "....2..." + Chr$(13)
  5550.     m$ = m$ + "........" + Chr$(13)
  5551.     arrTileText(124) = m$
  5552.  
  5553.     m$ = ""
  5554.     m$ = m$ + "..222..." + Chr$(13)
  5555.     m$ = m$ + "....22.." + Chr$(13)
  5556.     m$ = m$ + ".....2.." + Chr$(13)
  5557.     m$ = m$ + ".....22." + Chr$(13)
  5558.     m$ = m$ + ".....2.." + Chr$(13)
  5559.     m$ = m$ + "....22.." + Chr$(13)
  5560.     m$ = m$ + "..222..." + Chr$(13)
  5561.     m$ = m$ + "........" + Chr$(13)
  5562.     arrTileText(125) = m$
  5563.  
  5564.     m$ = ""
  5565.     m$ = m$ + "........" + Chr$(13)
  5566.     m$ = m$ + ".22....2" + Chr$(13)
  5567.     m$ = m$ + "2..2..2." + Chr$(13)
  5568.     m$ = m$ + "....22.." + Chr$(13)
  5569.     m$ = m$ + "........" + Chr$(13)
  5570.     m$ = m$ + "........" + Chr$(13)
  5571.     m$ = m$ + "........" + Chr$(13)
  5572.     m$ = m$ + "........" + Chr$(13)
  5573.     arrTileText(126) = m$
  5574.  
  5575.     m$ = ""
  5576.     m$ = m$ + "........" + Chr$(13)
  5577.     m$ = m$ + "........" + Chr$(13)
  5578.     m$ = m$ + "........" + Chr$(13)
  5579.     m$ = m$ + "........" + Chr$(13)
  5580.     m$ = m$ + "........" + Chr$(13)
  5581.     m$ = m$ + "........" + Chr$(13)
  5582.     m$ = m$ + "........" + Chr$(13)
  5583.     m$ = m$ + "........" + Chr$(13)
  5584.     arrTileText(127) = m$
  5585.  
  5586.     m$ = ""
  5587.     m$ = m$ + "........" + Chr$(13)
  5588.     m$ = m$ + "........" + Chr$(13)
  5589.     m$ = m$ + "........" + Chr$(13)
  5590.     m$ = m$ + "22222222" + Chr$(13)
  5591.     m$ = m$ + "22222222" + Chr$(13)
  5592.     m$ = m$ + "........" + Chr$(13)
  5593.     m$ = m$ + "........" + Chr$(13)
  5594.     m$ = m$ + "........" + Chr$(13)
  5595.     arrTileText(128) = m$
  5596.  
  5597.     m$ = ""
  5598.     m$ = m$ + "....2..." + Chr$(13)
  5599.     m$ = m$ + "...222.." + Chr$(13)
  5600.     m$ = m$ + "..22222." + Chr$(13)
  5601.     m$ = m$ + ".2222222" + Chr$(13)
  5602.     m$ = m$ + ".2222222" + Chr$(13)
  5603.     m$ = m$ + "...222.." + Chr$(13)
  5604.     m$ = m$ + "..22222." + Chr$(13)
  5605.     m$ = m$ + "........" + Chr$(13)
  5606.     arrTileText(129) = m$
  5607.  
  5608.     m$ = ""
  5609.     m$ = m$ + "...22..." + Chr$(13)
  5610.     m$ = m$ + "...22..." + Chr$(13)
  5611.     m$ = m$ + "...22..." + Chr$(13)
  5612.     m$ = m$ + "...22..." + Chr$(13)
  5613.     m$ = m$ + "...22..." + Chr$(13)
  5614.     m$ = m$ + "...22..." + Chr$(13)
  5615.     m$ = m$ + "...22..." + Chr$(13)
  5616.     m$ = m$ + "...22..." + Chr$(13)
  5617.     arrTileText(130) = m$
  5618.  
  5619.     m$ = ""
  5620.     m$ = m$ + "........" + Chr$(13)
  5621.     m$ = m$ + "........" + Chr$(13)
  5622.     m$ = m$ + "........" + Chr$(13)
  5623.     m$ = m$ + "22222222" + Chr$(13)
  5624.     m$ = m$ + "22222222" + Chr$(13)
  5625.     m$ = m$ + "........" + Chr$(13)
  5626.     m$ = m$ + "........" + Chr$(13)
  5627.     m$ = m$ + "........" + Chr$(13)
  5628.     arrTileText(131) = m$
  5629.  
  5630.     m$ = ""
  5631.     m$ = m$ + "........" + Chr$(13)
  5632.     m$ = m$ + "........" + Chr$(13)
  5633.     m$ = m$ + "22222222" + Chr$(13)
  5634.     m$ = m$ + "22222222" + Chr$(13)
  5635.     m$ = m$ + "........" + Chr$(13)
  5636.     m$ = m$ + "........" + Chr$(13)
  5637.     m$ = m$ + "........" + Chr$(13)
  5638.     m$ = m$ + "........" + Chr$(13)
  5639.     arrTileText(132) = m$
  5640.  
  5641.     m$ = ""
  5642.     m$ = m$ + "........" + Chr$(13)
  5643.     m$ = m$ + "22222222" + Chr$(13)
  5644.     m$ = m$ + "22222222" + Chr$(13)
  5645.     m$ = m$ + "........" + Chr$(13)
  5646.     m$ = m$ + "........" + Chr$(13)
  5647.     m$ = m$ + "........" + Chr$(13)
  5648.     m$ = m$ + "........" + Chr$(13)
  5649.     m$ = m$ + "........" + Chr$(13)
  5650.     arrTileText(133) = m$
  5651.  
  5652.     m$ = ""
  5653.     m$ = m$ + "........" + Chr$(13)
  5654.     m$ = m$ + "........" + Chr$(13)
  5655.     m$ = m$ + "........" + Chr$(13)
  5656.     m$ = m$ + "........" + Chr$(13)
  5657.     m$ = m$ + "22222222" + Chr$(13)
  5658.     m$ = m$ + "22222222" + Chr$(13)
  5659.     m$ = m$ + "........" + Chr$(13)
  5660.     m$ = m$ + "........" + Chr$(13)
  5661.     arrTileText(134) = m$
  5662.  
  5663.     m$ = ""
  5664.     m$ = m$ + "..22...." + Chr$(13)
  5665.     m$ = m$ + "..22...." + Chr$(13)
  5666.     m$ = m$ + "..22...." + Chr$(13)
  5667.     m$ = m$ + "..22...." + Chr$(13)
  5668.     m$ = m$ + "..22...." + Chr$(13)
  5669.     m$ = m$ + "..22...." + Chr$(13)
  5670.     m$ = m$ + "..22...." + Chr$(13)
  5671.     m$ = m$ + "..22...." + Chr$(13)
  5672.     arrTileText(135) = m$
  5673.  
  5674.     m$ = ""
  5675.     m$ = m$ + "....22.." + Chr$(13)
  5676.     m$ = m$ + "....22.." + Chr$(13)
  5677.     m$ = m$ + "....22.." + Chr$(13)
  5678.     m$ = m$ + "....22.." + Chr$(13)
  5679.     m$ = m$ + "....22.." + Chr$(13)
  5680.     m$ = m$ + "....22.." + Chr$(13)
  5681.     m$ = m$ + "....22.." + Chr$(13)
  5682.     m$ = m$ + "....22.." + Chr$(13)
  5683.     arrTileText(136) = m$
  5684.  
  5685.     m$ = ""
  5686.     m$ = m$ + "........" + Chr$(13)
  5687.     m$ = m$ + "........" + Chr$(13)
  5688.     m$ = m$ + "........" + Chr$(13)
  5689.     m$ = m$ + "222....." + Chr$(13)
  5690.     m$ = m$ + "2222...." + Chr$(13)
  5691.     m$ = m$ + "..222..." + Chr$(13)
  5692.     m$ = m$ + "...22..." + Chr$(13)
  5693.     m$ = m$ + "...22..." + Chr$(13)
  5694.     arrTileText(137) = m$
  5695.  
  5696.     m$ = ""
  5697.     m$ = m$ + "...22..." + Chr$(13)
  5698.     m$ = m$ + "...22..." + Chr$(13)
  5699.     m$ = m$ + "...222.." + Chr$(13)
  5700.     m$ = m$ + "....2222" + Chr$(13)
  5701.     m$ = m$ + ".....222" + Chr$(13)
  5702.     m$ = m$ + "........" + Chr$(13)
  5703.     m$ = m$ + "........" + Chr$(13)
  5704.     m$ = m$ + "........" + Chr$(13)
  5705.     arrTileText(138) = m$
  5706.  
  5707.     m$ = ""
  5708.     m$ = m$ + "...22..." + Chr$(13)
  5709.     m$ = m$ + "...22..." + Chr$(13)
  5710.     m$ = m$ + "..222..." + Chr$(13)
  5711.     m$ = m$ + "2222...." + Chr$(13)
  5712.     m$ = m$ + "222....." + Chr$(13)
  5713.     m$ = m$ + "........" + Chr$(13)
  5714.     m$ = m$ + "........" + Chr$(13)
  5715.     m$ = m$ + "........" + Chr$(13)
  5716.     arrTileText(139) = m$
  5717.  
  5718.     m$ = ""
  5719.     m$ = m$ + "22......" + Chr$(13)
  5720.     m$ = m$ + "22......" + Chr$(13)
  5721.     m$ = m$ + "22......" + Chr$(13)
  5722.     m$ = m$ + "22......" + Chr$(13)
  5723.     m$ = m$ + "22......" + Chr$(13)
  5724.     m$ = m$ + "22......" + Chr$(13)
  5725.     m$ = m$ + "22222222" + Chr$(13)
  5726.     m$ = m$ + "22222222" + Chr$(13)
  5727.     arrTileText(140) = m$
  5728.  
  5729.     m$ = ""
  5730.     m$ = m$ + "22......" + Chr$(13)
  5731.     m$ = m$ + "222....." + Chr$(13)
  5732.     m$ = m$ + ".222...." + Chr$(13)
  5733.     m$ = m$ + "..222..." + Chr$(13)
  5734.     m$ = m$ + "...222.." + Chr$(13)
  5735.     m$ = m$ + "....222." + Chr$(13)
  5736.     m$ = m$ + ".....222" + Chr$(13)
  5737.     m$ = m$ + "......22" + Chr$(13)
  5738.     arrTileText(141) = m$
  5739.  
  5740.     m$ = ""
  5741.     m$ = m$ + "......22" + Chr$(13)
  5742.     m$ = m$ + ".....222" + Chr$(13)
  5743.     m$ = m$ + "....222." + Chr$(13)
  5744.     m$ = m$ + "...222.." + Chr$(13)
  5745.     m$ = m$ + "..222..." + Chr$(13)
  5746.     m$ = m$ + ".222...." + Chr$(13)
  5747.     m$ = m$ + "222....." + Chr$(13)
  5748.     m$ = m$ + "22......" + Chr$(13)
  5749.     arrTileText(142) = m$
  5750.  
  5751.     m$ = ""
  5752.     m$ = m$ + "22222222" + Chr$(13)
  5753.     m$ = m$ + "22222222" + Chr$(13)
  5754.     m$ = m$ + "22......" + Chr$(13)
  5755.     m$ = m$ + "22......" + Chr$(13)
  5756.     m$ = m$ + "22......" + Chr$(13)
  5757.     m$ = m$ + "22......" + Chr$(13)
  5758.     m$ = m$ + "22......" + Chr$(13)
  5759.     m$ = m$ + "22......" + Chr$(13)
  5760.     arrTileText(143) = m$
  5761.  
  5762.     m$ = ""
  5763.     m$ = m$ + "22222222" + Chr$(13)
  5764.     m$ = m$ + "22222222" + Chr$(13)
  5765.     m$ = m$ + "......22" + Chr$(13)
  5766.     m$ = m$ + "......22" + Chr$(13)
  5767.     m$ = m$ + "......22" + Chr$(13)
  5768.     m$ = m$ + "......22" + Chr$(13)
  5769.     m$ = m$ + "......22" + Chr$(13)
  5770.     m$ = m$ + "......22" + Chr$(13)
  5771.     arrTileText(144) = m$
  5772.  
  5773.     m$ = ""
  5774.     m$ = m$ + "........" + Chr$(13)
  5775.     m$ = m$ + "..2222.." + Chr$(13)
  5776.     m$ = m$ + ".222222." + Chr$(13)
  5777.     m$ = m$ + ".222222." + Chr$(13)
  5778.     m$ = m$ + ".222222." + Chr$(13)
  5779.     m$ = m$ + ".222222." + Chr$(13)
  5780.     m$ = m$ + "..2222.." + Chr$(13)
  5781.     m$ = m$ + "........" + Chr$(13)
  5782.     arrTileText(145) = m$
  5783.  
  5784.     m$ = ""
  5785.     m$ = m$ + "........" + Chr$(13)
  5786.     m$ = m$ + "........" + Chr$(13)
  5787.     m$ = m$ + "........" + Chr$(13)
  5788.     m$ = m$ + "........" + Chr$(13)
  5789.     m$ = m$ + "........" + Chr$(13)
  5790.     m$ = m$ + "22222222" + Chr$(13)
  5791.     m$ = m$ + "22222222" + Chr$(13)
  5792.     m$ = m$ + "........" + Chr$(13)
  5793.     arrTileText(146) = m$
  5794.  
  5795.     m$ = ""
  5796.     m$ = m$ + "..22.22." + Chr$(13)
  5797.     m$ = m$ + ".2222222" + Chr$(13)
  5798.     m$ = m$ + ".2222222" + Chr$(13)
  5799.     m$ = m$ + ".2222222" + Chr$(13)
  5800.     m$ = m$ + "..22222." + Chr$(13)
  5801.     m$ = m$ + "...222.." + Chr$(13)
  5802.     m$ = m$ + "....2..." + Chr$(13)
  5803.     m$ = m$ + "........" + Chr$(13)
  5804.     arrTileText(147) = m$
  5805.  
  5806.     m$ = ""
  5807.     m$ = m$ + ".22....." + Chr$(13)
  5808.     m$ = m$ + ".22....." + Chr$(13)
  5809.     m$ = m$ + ".22....." + Chr$(13)
  5810.     m$ = m$ + ".22....." + Chr$(13)
  5811.     m$ = m$ + ".22....." + Chr$(13)
  5812.     m$ = m$ + ".22....." + Chr$(13)
  5813.     m$ = m$ + ".22....." + Chr$(13)
  5814.     m$ = m$ + ".22....." + Chr$(13)
  5815.     arrTileText(148) = m$
  5816.  
  5817.     m$ = ""
  5818.     m$ = m$ + "........" + Chr$(13)
  5819.     m$ = m$ + "........" + Chr$(13)
  5820.     m$ = m$ + "........" + Chr$(13)
  5821.     m$ = m$ + ".....222" + Chr$(13)
  5822.     m$ = m$ + "....2222" + Chr$(13)
  5823.     m$ = m$ + "...222.." + Chr$(13)
  5824.     m$ = m$ + "...22..." + Chr$(13)
  5825.     m$ = m$ + "...22..." + Chr$(13)
  5826.     arrTileText(149) = m$
  5827.  
  5828.     m$ = ""
  5829.     m$ = m$ + "22....22" + Chr$(13)
  5830.     m$ = m$ + "222..222" + Chr$(13)
  5831.     m$ = m$ + ".222222." + Chr$(13)
  5832.     m$ = m$ + "..2222.." + Chr$(13)
  5833.     m$ = m$ + "..2222.." + Chr$(13)
  5834.     m$ = m$ + ".222222." + Chr$(13)
  5835.     m$ = m$ + "222..222" + Chr$(13)
  5836.     m$ = m$ + "22....22" + Chr$(13)
  5837.     arrTileText(150) = m$
  5838.  
  5839.     m$ = ""
  5840.     m$ = m$ + "........" + Chr$(13)
  5841.     m$ = m$ + "..2222.." + Chr$(13)
  5842.     m$ = m$ + ".222222." + Chr$(13)
  5843.     m$ = m$ + ".22..22." + Chr$(13)
  5844.     m$ = m$ + ".22..22." + Chr$(13)
  5845.     m$ = m$ + ".222222." + Chr$(13)
  5846.     m$ = m$ + "..2222.." + Chr$(13)
  5847.     m$ = m$ + "........" + Chr$(13)
  5848.     arrTileText(151) = m$
  5849.  
  5850.     m$ = ""
  5851.     m$ = m$ + "...22..." + Chr$(13)
  5852.     m$ = m$ + "...22..." + Chr$(13)
  5853.     m$ = m$ + ".22..22." + Chr$(13)
  5854.     m$ = m$ + ".22..22." + Chr$(13)
  5855.     m$ = m$ + "...22..." + Chr$(13)
  5856.     m$ = m$ + "...22..." + Chr$(13)
  5857.     m$ = m$ + "..2222.." + Chr$(13)
  5858.     m$ = m$ + "........" + Chr$(13)
  5859.     arrTileText(152) = m$
  5860.  
  5861.     m$ = ""
  5862.     m$ = m$ + ".....22." + Chr$(13)
  5863.     m$ = m$ + ".....22." + Chr$(13)
  5864.     m$ = m$ + ".....22." + Chr$(13)
  5865.     m$ = m$ + ".....22." + Chr$(13)
  5866.     m$ = m$ + ".....22." + Chr$(13)
  5867.     m$ = m$ + ".....22." + Chr$(13)
  5868.     m$ = m$ + ".....22." + Chr$(13)
  5869.     m$ = m$ + ".....22." + Chr$(13)
  5870.     arrTileText(153) = m$
  5871.  
  5872.     m$ = ""
  5873.     m$ = m$ + "....2..." + Chr$(13)
  5874.     m$ = m$ + "...222.." + Chr$(13)
  5875.     m$ = m$ + "..22222." + Chr$(13)
  5876.     m$ = m$ + ".2222222" + Chr$(13)
  5877.     m$ = m$ + "..22222." + Chr$(13)
  5878.     m$ = m$ + "...222.." + Chr$(13)
  5879.     m$ = m$ + "....2..." + Chr$(13)
  5880.     m$ = m$ + "........" + Chr$(13)
  5881.     arrTileText(154) = m$
  5882.  
  5883.     m$ = ""
  5884.     m$ = m$ + "...22..." + Chr$(13)
  5885.     m$ = m$ + "...22..." + Chr$(13)
  5886.     m$ = m$ + "...22..." + Chr$(13)
  5887.     m$ = m$ + "22222222" + Chr$(13)
  5888.     m$ = m$ + "22222222" + Chr$(13)
  5889.     m$ = m$ + "...22..." + Chr$(13)
  5890.     m$ = m$ + "...22..." + Chr$(13)
  5891.     m$ = m$ + "...22..." + Chr$(13)
  5892.     arrTileText(155) = m$
  5893.  
  5894.     m$ = ""
  5895.     m$ = m$ + "22......" + Chr$(13)
  5896.     m$ = m$ + "22......" + Chr$(13)
  5897.     m$ = m$ + "..22...." + Chr$(13)
  5898.     m$ = m$ + "..22...." + Chr$(13)
  5899.     m$ = m$ + "22......" + Chr$(13)
  5900.     m$ = m$ + "22......" + Chr$(13)
  5901.     m$ = m$ + "..22...." + Chr$(13)
  5902.     m$ = m$ + "..22...." + Chr$(13)
  5903.     arrTileText(156) = m$
  5904.  
  5905.     m$ = ""
  5906.     m$ = m$ + "...22..." + Chr$(13)
  5907.     m$ = m$ + "...22..." + Chr$(13)
  5908.     m$ = m$ + "...22..." + Chr$(13)
  5909.     m$ = m$ + "...22..." + Chr$(13)
  5910.     m$ = m$ + "...22..." + Chr$(13)
  5911.     m$ = m$ + "...22..." + Chr$(13)
  5912.     m$ = m$ + "...22..." + Chr$(13)
  5913.     m$ = m$ + "...22..." + Chr$(13)
  5914.     arrTileText(157) = m$
  5915.  
  5916.     m$ = ""
  5917.     m$ = m$ + "........" + Chr$(13)
  5918.     m$ = m$ + "........" + Chr$(13)
  5919.     m$ = m$ + "......22" + Chr$(13)
  5920.     m$ = m$ + "..22222." + Chr$(13)
  5921.     m$ = m$ + ".222.22." + Chr$(13)
  5922.     m$ = m$ + "..22.22." + Chr$(13)
  5923.     m$ = m$ + "..22.22." + Chr$(13)
  5924.     m$ = m$ + "........" + Chr$(13)
  5925.     arrTileText(158) = m$
  5926.  
  5927.     m$ = ""
  5928.     m$ = m$ + "22222222" + Chr$(13)
  5929.     m$ = m$ + ".2222222" + Chr$(13)
  5930.     m$ = m$ + "..222222" + Chr$(13)
  5931.     m$ = m$ + "...22222" + Chr$(13)
  5932.     m$ = m$ + "....2222" + Chr$(13)
  5933.     m$ = m$ + ".....222" + Chr$(13)
  5934.     m$ = m$ + "......22" + Chr$(13)
  5935.     m$ = m$ + ".......2" + Chr$(13)
  5936.     arrTileText(159) = m$
  5937.  
  5938.     m$ = ""
  5939.     m$ = m$ + "........" + Chr$(13)
  5940.     m$ = m$ + "........" + Chr$(13)
  5941.     m$ = m$ + "........" + Chr$(13)
  5942.     m$ = m$ + "........" + Chr$(13)
  5943.     m$ = m$ + "........" + Chr$(13)
  5944.     m$ = m$ + "........" + Chr$(13)
  5945.     m$ = m$ + "........" + Chr$(13)
  5946.     m$ = m$ + "........" + Chr$(13)
  5947.     arrTileText(160) = m$
  5948.  
  5949.     m$ = ""
  5950.     m$ = m$ + "2222...." + Chr$(13)
  5951.     m$ = m$ + "2222...." + Chr$(13)
  5952.     m$ = m$ + "2222...." + Chr$(13)
  5953.     m$ = m$ + "2222...." + Chr$(13)
  5954.     m$ = m$ + "2222...." + Chr$(13)
  5955.     m$ = m$ + "2222...." + Chr$(13)
  5956.     m$ = m$ + "2222...." + Chr$(13)
  5957.     m$ = m$ + "2222...." + Chr$(13)
  5958.     arrTileText(161) = m$
  5959.  
  5960.     m$ = ""
  5961.     m$ = m$ + "........" + Chr$(13)
  5962.     m$ = m$ + "........" + Chr$(13)
  5963.     m$ = m$ + "........" + Chr$(13)
  5964.     m$ = m$ + "........" + Chr$(13)
  5965.     m$ = m$ + "22222222" + Chr$(13)
  5966.     m$ = m$ + "22222222" + Chr$(13)
  5967.     m$ = m$ + "22222222" + Chr$(13)
  5968.     m$ = m$ + "22222222" + Chr$(13)
  5969.     arrTileText(162) = m$
  5970.  
  5971.     m$ = ""
  5972.     m$ = m$ + "22222222" + Chr$(13)
  5973.     m$ = m$ + "........" + Chr$(13)
  5974.     m$ = m$ + "........" + Chr$(13)
  5975.     m$ = m$ + "........" + Chr$(13)
  5976.     m$ = m$ + "........" + Chr$(13)
  5977.     m$ = m$ + "........" + Chr$(13)
  5978.     m$ = m$ + "........" + Chr$(13)
  5979.     m$ = m$ + "........" + Chr$(13)
  5980.     arrTileText(163) = m$
  5981.  
  5982.     m$ = ""
  5983.     m$ = m$ + "........" + Chr$(13)
  5984.     m$ = m$ + "........" + Chr$(13)
  5985.     m$ = m$ + "........" + Chr$(13)
  5986.     m$ = m$ + "........" + Chr$(13)
  5987.     m$ = m$ + "........" + Chr$(13)
  5988.     m$ = m$ + "........" + Chr$(13)
  5989.     m$ = m$ + "........" + Chr$(13)
  5990.     m$ = m$ + "22222222" + Chr$(13)
  5991.     arrTileText(164) = m$
  5992.  
  5993.     m$ = ""
  5994.     m$ = m$ + "22......" + Chr$(13)
  5995.     m$ = m$ + "22......" + Chr$(13)
  5996.     m$ = m$ + "22......" + Chr$(13)
  5997.     m$ = m$ + "22......" + Chr$(13)
  5998.     m$ = m$ + "22......" + Chr$(13)
  5999.     m$ = m$ + "22......" + Chr$(13)
  6000.     m$ = m$ + "22......" + Chr$(13)
  6001.     m$ = m$ + "22......" + Chr$(13)
  6002.     arrTileText(165) = m$
  6003.  
  6004.     m$ = ""
  6005.     m$ = m$ + "22..22.." + Chr$(13)
  6006.     m$ = m$ + "22..22.." + Chr$(13)
  6007.     m$ = m$ + "..22..22" + Chr$(13)
  6008.     m$ = m$ + "..22..22" + Chr$(13)
  6009.     m$ = m$ + "22..22.." + Chr$(13)
  6010.     m$ = m$ + "22..22.." + Chr$(13)
  6011.     m$ = m$ + "..22..22" + Chr$(13)
  6012.     m$ = m$ + "..22..22" + Chr$(13)
  6013.     arrTileText(166) = m$
  6014.  
  6015.     m$ = ""
  6016.     m$ = m$ + "......22" + Chr$(13)
  6017.     m$ = m$ + "......22" + Chr$(13)
  6018.     m$ = m$ + "......22" + Chr$(13)
  6019.     m$ = m$ + "......22" + Chr$(13)
  6020.     m$ = m$ + "......22" + Chr$(13)
  6021.     m$ = m$ + "......22" + Chr$(13)
  6022.     m$ = m$ + "......22" + Chr$(13)
  6023.     m$ = m$ + "......22" + Chr$(13)
  6024.     arrTileText(167) = m$
  6025.  
  6026.     m$ = ""
  6027.     m$ = m$ + "........" + Chr$(13)
  6028.     m$ = m$ + "........" + Chr$(13)
  6029.     m$ = m$ + "........" + Chr$(13)
  6030.     m$ = m$ + "........" + Chr$(13)
  6031.     m$ = m$ + "22..22.." + Chr$(13)
  6032.     m$ = m$ + "22..22.." + Chr$(13)
  6033.     m$ = m$ + "..22..22" + Chr$(13)
  6034.     m$ = m$ + "..22..22" + Chr$(13)
  6035.     arrTileText(168) = m$
  6036.  
  6037.     m$ = ""
  6038.     m$ = m$ + "22222222" + Chr$(13)
  6039.     m$ = m$ + "2222222." + Chr$(13)
  6040.     m$ = m$ + "222222.." + Chr$(13)
  6041.     m$ = m$ + "22222..." + Chr$(13)
  6042.     m$ = m$ + "2222...." + Chr$(13)
  6043.     m$ = m$ + "222....." + Chr$(13)
  6044.     m$ = m$ + "22......" + Chr$(13)
  6045.     m$ = m$ + "2......." + Chr$(13)
  6046.     arrTileText(169) = m$
  6047.  
  6048.     m$ = ""
  6049.     m$ = m$ + "......22" + Chr$(13)
  6050.     m$ = m$ + "......22" + Chr$(13)
  6051.     m$ = m$ + "......22" + Chr$(13)
  6052.     m$ = m$ + "......22" + Chr$(13)
  6053.     m$ = m$ + "......22" + Chr$(13)
  6054.     m$ = m$ + "......22" + Chr$(13)
  6055.     m$ = m$ + "......22" + Chr$(13)
  6056.     m$ = m$ + "......22" + Chr$(13)
  6057.     arrTileText(170) = m$
  6058.  
  6059.     m$ = ""
  6060.     m$ = m$ + "...22..." + Chr$(13)
  6061.     m$ = m$ + "...22..." + Chr$(13)
  6062.     m$ = m$ + "...22..." + Chr$(13)
  6063.     m$ = m$ + "...22222" + Chr$(13)
  6064.     m$ = m$ + "...22222" + Chr$(13)
  6065.     m$ = m$ + "...22..." + Chr$(13)
  6066.     m$ = m$ + "...22..." + Chr$(13)
  6067.     m$ = m$ + "...22..." + Chr$(13)
  6068.     arrTileText(171) = m$
  6069.  
  6070.     m$ = ""
  6071.     m$ = m$ + "........" + Chr$(13)
  6072.     m$ = m$ + "........" + Chr$(13)
  6073.     m$ = m$ + "........" + Chr$(13)
  6074.     m$ = m$ + "........" + Chr$(13)
  6075.     m$ = m$ + "....2222" + Chr$(13)
  6076.     m$ = m$ + "....2222" + Chr$(13)
  6077.     m$ = m$ + "....2222" + Chr$(13)
  6078.     m$ = m$ + "....2222" + Chr$(13)
  6079.     arrTileText(172) = m$
  6080.  
  6081.     m$ = ""
  6082.     m$ = m$ + "...22..." + Chr$(13)
  6083.     m$ = m$ + "...22..." + Chr$(13)
  6084.     m$ = m$ + "...22..." + Chr$(13)
  6085.     m$ = m$ + "...22222" + Chr$(13)
  6086.     m$ = m$ + "...22222" + Chr$(13)
  6087.     m$ = m$ + "........" + Chr$(13)
  6088.     m$ = m$ + "........" + Chr$(13)
  6089.     m$ = m$ + "........" + Chr$(13)
  6090.     arrTileText(173) = m$
  6091.  
  6092.     m$ = ""
  6093.     m$ = m$ + "........" + Chr$(13)
  6094.     m$ = m$ + "........" + Chr$(13)
  6095.     m$ = m$ + "........" + Chr$(13)
  6096.     m$ = m$ + "22222..." + Chr$(13)
  6097.     m$ = m$ + "22222..." + Chr$(13)
  6098.     m$ = m$ + "...22..." + Chr$(13)
  6099.     m$ = m$ + "...22..." + Chr$(13)
  6100.     m$ = m$ + "...22..." + Chr$(13)
  6101.     arrTileText(174) = m$
  6102.  
  6103.     m$ = ""
  6104.     m$ = m$ + "........" + Chr$(13)
  6105.     m$ = m$ + "........" + Chr$(13)
  6106.     m$ = m$ + "........" + Chr$(13)
  6107.     m$ = m$ + "........" + Chr$(13)
  6108.     m$ = m$ + "........" + Chr$(13)
  6109.     m$ = m$ + "........" + Chr$(13)
  6110.     m$ = m$ + "22222222" + Chr$(13)
  6111.     m$ = m$ + "22222222" + Chr$(13)
  6112.     arrTileText(175) = m$
  6113.  
  6114.     m$ = ""
  6115.     m$ = m$ + "........" + Chr$(13)
  6116.     m$ = m$ + "........" + Chr$(13)
  6117.     m$ = m$ + "........" + Chr$(13)
  6118.     m$ = m$ + "...22222" + Chr$(13)
  6119.     m$ = m$ + "...22222" + Chr$(13)
  6120.     m$ = m$ + "...22..." + Chr$(13)
  6121.     m$ = m$ + "...22..." + Chr$(13)
  6122.     m$ = m$ + "...22..." + Chr$(13)
  6123.     arrTileText(176) = m$
  6124.  
  6125.     m$ = ""
  6126.     m$ = m$ + "...22..." + Chr$(13)
  6127.     m$ = m$ + "...22..." + Chr$(13)
  6128.     m$ = m$ + "...22..." + Chr$(13)
  6129.     m$ = m$ + "22222222" + Chr$(13)
  6130.     m$ = m$ + "22222222" + Chr$(13)
  6131.     m$ = m$ + "........" + Chr$(13)
  6132.     m$ = m$ + "........" + Chr$(13)
  6133.     m$ = m$ + "........" + Chr$(13)
  6134.     arrTileText(177) = m$
  6135.  
  6136.     m$ = ""
  6137.     m$ = m$ + "........" + Chr$(13)
  6138.     m$ = m$ + "........" + Chr$(13)
  6139.     m$ = m$ + "........" + Chr$(13)
  6140.     m$ = m$ + "22222222" + Chr$(13)
  6141.     m$ = m$ + "22222222" + Chr$(13)
  6142.     m$ = m$ + "...22..." + Chr$(13)
  6143.     m$ = m$ + "...22..." + Chr$(13)
  6144.     m$ = m$ + "...22..." + Chr$(13)
  6145.     arrTileText(178) = m$
  6146.  
  6147.     m$ = ""
  6148.     m$ = m$ + "...22..." + Chr$(13)
  6149.     m$ = m$ + "...22..." + Chr$(13)
  6150.     m$ = m$ + "...22..." + Chr$(13)
  6151.     m$ = m$ + "22222..." + Chr$(13)
  6152.     m$ = m$ + "22222..." + Chr$(13)
  6153.     m$ = m$ + "...22..." + Chr$(13)
  6154.     m$ = m$ + "...22..." + Chr$(13)
  6155.     m$ = m$ + "...22..." + Chr$(13)
  6156.     arrTileText(179) = m$
  6157.  
  6158.     m$ = ""
  6159.     m$ = m$ + "22......" + Chr$(13)
  6160.     m$ = m$ + "22......" + Chr$(13)
  6161.     m$ = m$ + "22......" + Chr$(13)
  6162.     m$ = m$ + "22......" + Chr$(13)
  6163.     m$ = m$ + "22......" + Chr$(13)
  6164.     m$ = m$ + "22......" + Chr$(13)
  6165.     m$ = m$ + "22......" + Chr$(13)
  6166.     m$ = m$ + "22......" + Chr$(13)
  6167.     arrTileText(180) = m$
  6168.  
  6169.     m$ = ""
  6170.     m$ = m$ + "222....." + Chr$(13)
  6171.     m$ = m$ + "222....." + Chr$(13)
  6172.     m$ = m$ + "222....." + Chr$(13)
  6173.     m$ = m$ + "222....." + Chr$(13)
  6174.     m$ = m$ + "222....." + Chr$(13)
  6175.     m$ = m$ + "222....." + Chr$(13)
  6176.     m$ = m$ + "222....." + Chr$(13)
  6177.     m$ = m$ + "222....." + Chr$(13)
  6178.     arrTileText(181) = m$
  6179.  
  6180.     m$ = ""
  6181.     m$ = m$ + ".....222" + Chr$(13)
  6182.     m$ = m$ + ".....222" + Chr$(13)
  6183.     m$ = m$ + ".....222" + Chr$(13)
  6184.     m$ = m$ + ".....222" + Chr$(13)
  6185.     m$ = m$ + ".....222" + Chr$(13)
  6186.     m$ = m$ + ".....222" + Chr$(13)
  6187.     m$ = m$ + ".....222" + Chr$(13)
  6188.     m$ = m$ + ".....222" + Chr$(13)
  6189.     arrTileText(182) = m$
  6190.  
  6191.     m$ = ""
  6192.     m$ = m$ + "22222222" + Chr$(13)
  6193.     m$ = m$ + "22222222" + Chr$(13)
  6194.     m$ = m$ + "........" + Chr$(13)
  6195.     m$ = m$ + "........" + Chr$(13)
  6196.     m$ = m$ + "........" + Chr$(13)
  6197.     m$ = m$ + "........" + Chr$(13)
  6198.     m$ = m$ + "........" + Chr$(13)
  6199.     m$ = m$ + "........" + Chr$(13)
  6200.     arrTileText(183) = m$
  6201.  
  6202.     m$ = ""
  6203.     m$ = m$ + "22222222" + Chr$(13)
  6204.     m$ = m$ + "22222222" + Chr$(13)
  6205.     m$ = m$ + "22222222" + Chr$(13)
  6206.     m$ = m$ + "........" + Chr$(13)
  6207.     m$ = m$ + "........" + Chr$(13)
  6208.     m$ = m$ + "........" + Chr$(13)
  6209.     m$ = m$ + "........" + Chr$(13)
  6210.     m$ = m$ + "........" + Chr$(13)
  6211.     arrTileText(184) = m$
  6212.  
  6213.     m$ = ""
  6214.     m$ = m$ + "........" + Chr$(13)
  6215.     m$ = m$ + "........" + Chr$(13)
  6216.     m$ = m$ + "........" + Chr$(13)
  6217.     m$ = m$ + "........" + Chr$(13)
  6218.     m$ = m$ + "........" + Chr$(13)
  6219.     m$ = m$ + "22222222" + Chr$(13)
  6220.     m$ = m$ + "22222222" + Chr$(13)
  6221.     m$ = m$ + "22222222" + Chr$(13)
  6222.     arrTileText(185) = m$
  6223.  
  6224.     m$ = ""
  6225.     m$ = m$ + "......22" + Chr$(13)
  6226.     m$ = m$ + "......22" + Chr$(13)
  6227.     m$ = m$ + "......22" + Chr$(13)
  6228.     m$ = m$ + "......22" + Chr$(13)
  6229.     m$ = m$ + "......22" + Chr$(13)
  6230.     m$ = m$ + "......22" + Chr$(13)
  6231.     m$ = m$ + "22222222" + Chr$(13)
  6232.     m$ = m$ + "22222222" + Chr$(13)
  6233.     arrTileText(186) = m$
  6234.  
  6235.     m$ = ""
  6236.     m$ = m$ + "........" + Chr$(13)
  6237.     m$ = m$ + "........" + Chr$(13)
  6238.     m$ = m$ + "........" + Chr$(13)
  6239.     m$ = m$ + "........" + Chr$(13)
  6240.     m$ = m$ + "2222...." + Chr$(13)
  6241.     m$ = m$ + "2222...." + Chr$(13)
  6242.     m$ = m$ + "2222...." + Chr$(13)
  6243.     m$ = m$ + "2222...." + Chr$(13)
  6244.     arrTileText(187) = m$
  6245.  
  6246.     m$ = ""
  6247.     m$ = m$ + "....2222" + Chr$(13)
  6248.     m$ = m$ + "....2222" + Chr$(13)
  6249.     m$ = m$ + "....2222" + Chr$(13)
  6250.     m$ = m$ + "....2222" + Chr$(13)
  6251.     m$ = m$ + "........" + Chr$(13)
  6252.     m$ = m$ + "........" + Chr$(13)
  6253.     m$ = m$ + "........" + Chr$(13)
  6254.     m$ = m$ + "........" + Chr$(13)
  6255.     arrTileText(188) = m$
  6256.  
  6257.     m$ = ""
  6258.     m$ = m$ + "...22..." + Chr$(13)
  6259.     m$ = m$ + "...22..." + Chr$(13)
  6260.     m$ = m$ + "...22..." + Chr$(13)
  6261.     m$ = m$ + "22222..." + Chr$(13)
  6262.     m$ = m$ + "22222..." + Chr$(13)
  6263.     m$ = m$ + "........" + Chr$(13)
  6264.     m$ = m$ + "........" + Chr$(13)
  6265.     m$ = m$ + "........" + Chr$(13)
  6266.     arrTileText(189) = m$
  6267.  
  6268.     m$ = ""
  6269.     m$ = m$ + "2222...." + Chr$(13)
  6270.     m$ = m$ + "2222...." + Chr$(13)
  6271.     m$ = m$ + "2222...." + Chr$(13)
  6272.     m$ = m$ + "2222...." + Chr$(13)
  6273.     m$ = m$ + "........" + Chr$(13)
  6274.     m$ = m$ + "........" + Chr$(13)
  6275.     m$ = m$ + "........" + Chr$(13)
  6276.     m$ = m$ + "........" + Chr$(13)
  6277.     arrTileText(190) = m$
  6278.  
  6279.     m$ = ""
  6280.     m$ = m$ + "2222...." + Chr$(13)
  6281.     m$ = m$ + "2222...." + Chr$(13)
  6282.     m$ = m$ + "2222...." + Chr$(13)
  6283.     m$ = m$ + "2222...." + Chr$(13)
  6284.     m$ = m$ + "....2222" + Chr$(13)
  6285.     m$ = m$ + "....2222" + Chr$(13)
  6286.     m$ = m$ + "....2222" + Chr$(13)
  6287.     m$ = m$ + "....2222" + Chr$(13)
  6288.     arrTileText(191) = m$
  6289.  
  6290.     m$ = ""
  6291.     m$ = m$ + "........" + Chr$(13)
  6292.     m$ = m$ + ".2222222" + Chr$(13)
  6293.     m$ = m$ + ".2.....2" + Chr$(13)
  6294.     m$ = m$ + ".2.....2" + Chr$(13)
  6295.     m$ = m$ + ".2.....2" + Chr$(13)
  6296.     m$ = m$ + ".2.....2" + Chr$(13)
  6297.     m$ = m$ + ".2.....2" + Chr$(13)
  6298.     m$ = m$ + ".2222222" + Chr$(13)
  6299.     arrTileText(192) = m$
  6300.  
  6301.     m$ = ""
  6302.     m$ = m$ + "........" + Chr$(13)
  6303.     m$ = m$ + ".2222222" + Chr$(13)
  6304.     m$ = m$ + ".2222222" + Chr$(13)
  6305.     m$ = m$ + ".2222222" + Chr$(13)
  6306.     m$ = m$ + ".2222222" + Chr$(13)
  6307.     m$ = m$ + ".2222222" + Chr$(13)
  6308.     m$ = m$ + ".2222222" + Chr$(13)
  6309.     m$ = m$ + ".2222222" + Chr$(13)
  6310.     arrTileText(193) = m$
  6311.  
  6312.     m$ = ""
  6313.     m$ = m$ + "........" + Chr$(13)
  6314.     m$ = m$ + "...22..." + Chr$(13)
  6315.     m$ = m$ + "..2222.." + Chr$(13)
  6316.     m$ = m$ + ".222222." + Chr$(13)
  6317.     m$ = m$ + "...22..." + Chr$(13)
  6318.     m$ = m$ + "...22..." + Chr$(13)
  6319.     m$ = m$ + "...22..." + Chr$(13)
  6320.     m$ = m$ + "...22..." + Chr$(13)
  6321.     arrTileText(194) = m$
  6322.  
  6323.     m$ = ""
  6324.     m$ = m$ + "........" + Chr$(13)
  6325.     m$ = m$ + "...22..." + Chr$(13)
  6326.     m$ = m$ + "...22..." + Chr$(13)
  6327.     m$ = m$ + "...22..." + Chr$(13)
  6328.     m$ = m$ + "...22..." + Chr$(13)
  6329.     m$ = m$ + ".222222." + Chr$(13)
  6330.     m$ = m$ + "..2222.." + Chr$(13)
  6331.     m$ = m$ + "...22..." + Chr$(13)
  6332.     arrTileText(195) = m$
  6333.  
  6334.     m$ = ""
  6335.     m$ = m$ + "........" + Chr$(13)
  6336.     m$ = m$ + "...2...." + Chr$(13)
  6337.     m$ = m$ + "..22...." + Chr$(13)
  6338.     m$ = m$ + ".2222222" + Chr$(13)
  6339.     m$ = m$ + ".2222222" + Chr$(13)
  6340.     m$ = m$ + "..22...." + Chr$(13)
  6341.     m$ = m$ + "...2...." + Chr$(13)
  6342.     m$ = m$ + "........" + Chr$(13)
  6343.     arrTileText(196) = m$
  6344.  
  6345.     m$ = ""
  6346.     m$ = m$ + "........" + Chr$(13)
  6347.     m$ = m$ + ".....2.." + Chr$(13)
  6348.     m$ = m$ + ".....22." + Chr$(13)
  6349.     m$ = m$ + ".2222222" + Chr$(13)
  6350.     m$ = m$ + ".2222222" + Chr$(13)
  6351.     m$ = m$ + ".....22." + Chr$(13)
  6352.     m$ = m$ + ".....2.." + Chr$(13)
  6353.     m$ = m$ + "........" + Chr$(13)
  6354.     arrTileText(197) = m$
  6355.  
  6356.     m$ = ""
  6357.     m$ = m$ + "........" + Chr$(13)
  6358.     m$ = m$ + "........" + Chr$(13)
  6359.     m$ = m$ + "........" + Chr$(13)
  6360.     m$ = m$ + "........" + Chr$(13)
  6361.     m$ = m$ + "........" + Chr$(13)
  6362.     m$ = m$ + "........" + Chr$(13)
  6363.     m$ = m$ + "........" + Chr$(13)
  6364.     m$ = m$ + "........" + Chr$(13)
  6365.     arrTileText(198) = m$
  6366.  
  6367.     m$ = ""
  6368.     m$ = m$ + ".222222." + Chr$(13)
  6369.     m$ = m$ + "2......2" + Chr$(13)
  6370.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6371.     m$ = m$ + "2......2" + Chr$(13)
  6372.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6373.     m$ = m$ + "2.2222.2" + Chr$(13)
  6374.     m$ = m$ + "2......2" + Chr$(13)
  6375.     m$ = m$ + ".222222." + Chr$(13)
  6376.     arrTileText(199) = m$
  6377.  
  6378.     m$ = ""
  6379.     m$ = m$ + ".222222." + Chr$(13)
  6380.     m$ = m$ + "2......2" + Chr$(13)
  6381.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6382.     m$ = m$ + "2......2" + Chr$(13)
  6383.     m$ = m$ + "2.2222.2" + Chr$(13)
  6384.     m$ = m$ + "2.2..2.2" + Chr$(13)
  6385.     m$ = m$ + "2......2" + Chr$(13)
  6386.     m$ = m$ + ".222222." + Chr$(13)
  6387.     arrTileText(200) = m$
  6388.  
  6389.     m$ = ""
  6390.     m$ = m$ + "........" + Chr$(13)
  6391.     m$ = m$ + "........" + Chr$(13)
  6392.     m$ = m$ + "........" + Chr$(13)
  6393.     m$ = m$ + "........" + Chr$(13)
  6394.     m$ = m$ + "........" + Chr$(13)
  6395.     m$ = m$ + "........" + Chr$(13)
  6396.     m$ = m$ + "........" + Chr$(13)
  6397.     m$ = m$ + "........" + Chr$(13)
  6398.     arrTileText(201) = m$
  6399.  
  6400.     m$ = ""
  6401.     m$ = m$ + ".222222." + Chr$(13)
  6402.     m$ = m$ + ".....22." + Chr$(13)
  6403.     m$ = m$ + "....22.." + Chr$(13)
  6404.     m$ = m$ + "...22..." + Chr$(13)
  6405.     m$ = m$ + "..22...." + Chr$(13)
  6406.     m$ = m$ + ".22....." + Chr$(13)
  6407.     m$ = m$ + ".222222." + Chr$(13)
  6408.     m$ = m$ + "........" + Chr$(13)
  6409.     arrTileText(202) = m$
  6410.  
  6411.     m$ = ""
  6412.     m$ = m$ + "...22..." + Chr$(13)
  6413.     m$ = m$ + "...22..." + Chr$(13)
  6414.     m$ = m$ + "...22..." + Chr$(13)
  6415.     m$ = m$ + "22222222" + Chr$(13)
  6416.     m$ = m$ + "22222222" + Chr$(13)
  6417.     m$ = m$ + "...22..." + Chr$(13)
  6418.     m$ = m$ + "...22..." + Chr$(13)
  6419.     m$ = m$ + "...22..." + Chr$(13)
  6420.     arrTileText(203) = m$
  6421.  
  6422.     m$ = ""
  6423.     m$ = m$ + "22......" + Chr$(13)
  6424.     m$ = m$ + "22......" + Chr$(13)
  6425.     m$ = m$ + "..22...." + Chr$(13)
  6426.     m$ = m$ + "..22...." + Chr$(13)
  6427.     m$ = m$ + "22......" + Chr$(13)
  6428.     m$ = m$ + "22......" + Chr$(13)
  6429.     m$ = m$ + "..22...." + Chr$(13)
  6430.     m$ = m$ + "..22...." + Chr$(13)
  6431.     arrTileText(204) = m$
  6432.  
  6433.     m$ = ""
  6434.     m$ = m$ + "...22..." + Chr$(13)
  6435.     m$ = m$ + "...22..." + Chr$(13)
  6436.     m$ = m$ + "...22..." + Chr$(13)
  6437.     m$ = m$ + "...22..." + Chr$(13)
  6438.     m$ = m$ + "...22..." + Chr$(13)
  6439.     m$ = m$ + "...22..." + Chr$(13)
  6440.     m$ = m$ + "...22..." + Chr$(13)
  6441.     m$ = m$ + "...22..." + Chr$(13)
  6442.     arrTileText(205) = m$
  6443.  
  6444.     m$ = ""
  6445.     m$ = m$ + "..22..22" + Chr$(13)
  6446.     m$ = m$ + "..22..22" + Chr$(13)
  6447.     m$ = m$ + "22..22.." + Chr$(13)
  6448.     m$ = m$ + "22..22.." + Chr$(13)
  6449.     m$ = m$ + "..22..22" + Chr$(13)
  6450.     m$ = m$ + "..22..22" + Chr$(13)
  6451.     m$ = m$ + "22..22.." + Chr$(13)
  6452.     m$ = m$ + "22..22.." + Chr$(13)
  6453.     arrTileText(206) = m$
  6454.  
  6455.     m$ = ""
  6456.     m$ = m$ + "..22..22" + Chr$(13)
  6457.     m$ = m$ + "2..22..2" + Chr$(13)
  6458.     m$ = m$ + "22..22.." + Chr$(13)
  6459.     m$ = m$ + ".22..22." + Chr$(13)
  6460.     m$ = m$ + "..22..22" + Chr$(13)
  6461.     m$ = m$ + "2..22..2" + Chr$(13)
  6462.     m$ = m$ + "22..22.." + Chr$(13)
  6463.     m$ = m$ + ".22..22." + Chr$(13)
  6464.     arrTileText(207) = m$
  6465.  
  6466.     m$ = ""
  6467.     m$ = m$ + "........" + Chr$(13)
  6468.     m$ = m$ + "........" + Chr$(13)
  6469.     m$ = m$ + "........" + Chr$(13)
  6470.     m$ = m$ + "........" + Chr$(13)
  6471.     m$ = m$ + "........" + Chr$(13)
  6472.     m$ = m$ + "........" + Chr$(13)
  6473.     m$ = m$ + "........" + Chr$(13)
  6474.     m$ = m$ + "........" + Chr$(13)
  6475.     arrTileText(208) = m$
  6476.  
  6477.     m$ = ""
  6478.     m$ = m$ + "2222...." + Chr$(13)
  6479.     m$ = m$ + "2222...." + Chr$(13)
  6480.     m$ = m$ + "2222...." + Chr$(13)
  6481.     m$ = m$ + "2222...." + Chr$(13)
  6482.     m$ = m$ + "2222...." + Chr$(13)
  6483.     m$ = m$ + "2222...." + Chr$(13)
  6484.     m$ = m$ + "2222...." + Chr$(13)
  6485.     m$ = m$ + "2222...." + Chr$(13)
  6486.     arrTileText(209) = m$
  6487.  
  6488.     m$ = ""
  6489.     m$ = m$ + "........" + Chr$(13)
  6490.     m$ = m$ + "........" + Chr$(13)
  6491.     m$ = m$ + "........" + Chr$(13)
  6492.     m$ = m$ + "........" + Chr$(13)
  6493.     m$ = m$ + "22222222" + Chr$(13)
  6494.     m$ = m$ + "22222222" + Chr$(13)
  6495.     m$ = m$ + "22222222" + Chr$(13)
  6496.     m$ = m$ + "22222222" + Chr$(13)
  6497.     arrTileText(210) = m$
  6498.  
  6499.     m$ = ""
  6500.     m$ = m$ + "22222222" + Chr$(13)
  6501.     m$ = m$ + "........" + Chr$(13)
  6502.     m$ = m$ + "........" + Chr$(13)
  6503.     m$ = m$ + "........" + Chr$(13)
  6504.     m$ = m$ + "........" + Chr$(13)
  6505.     m$ = m$ + "........" + Chr$(13)
  6506.     m$ = m$ + "........" + Chr$(13)
  6507.     m$ = m$ + "........" + Chr$(13)
  6508.     arrTileText(211) = m$
  6509.  
  6510.     m$ = ""
  6511.     m$ = m$ + "........" + Chr$(13)
  6512.     m$ = m$ + "........" + Chr$(13)
  6513.     m$ = m$ + "........" + Chr$(13)
  6514.     m$ = m$ + "........" + Chr$(13)
  6515.     m$ = m$ + "........" + Chr$(13)
  6516.     m$ = m$ + "........" + Chr$(13)
  6517.     m$ = m$ + "........" + Chr$(13)
  6518.     m$ = m$ + "22222222" + Chr$(13)
  6519.     arrTileText(212) = m$
  6520.  
  6521.     m$ = ""
  6522.     m$ = m$ + "22......" + Chr$(13)
  6523.     m$ = m$ + "22......" + Chr$(13)
  6524.     m$ = m$ + "22......" + Chr$(13)
  6525.     m$ = m$ + "22......" + Chr$(13)
  6526.     m$ = m$ + "22......" + Chr$(13)
  6527.     m$ = m$ + "22......" + Chr$(13)
  6528.     m$ = m$ + "22......" + Chr$(13)
  6529.     m$ = m$ + "22......" + Chr$(13)
  6530.     arrTileText(213) = m$
  6531.  
  6532.     m$ = ""
  6533.     m$ = m$ + "22..22.." + Chr$(13)
  6534.     m$ = m$ + "22..22.." + Chr$(13)
  6535.     m$ = m$ + "..22..22" + Chr$(13)
  6536.     m$ = m$ + "..22..22" + Chr$(13)
  6537.     m$ = m$ + "22..22.." + Chr$(13)
  6538.     m$ = m$ + "22..22.." + Chr$(13)
  6539.     m$ = m$ + "..22..22" + Chr$(13)
  6540.     m$ = m$ + "..22..22" + Chr$(13)
  6541.     arrTileText(214) = m$
  6542.  
  6543.     m$ = ""
  6544.     m$ = m$ + "......22" + Chr$(13)
  6545.     m$ = m$ + "......22" + Chr$(13)
  6546.     m$ = m$ + "......22" + Chr$(13)
  6547.     m$ = m$ + "......22" + Chr$(13)
  6548.     m$ = m$ + "......22" + Chr$(13)
  6549.     m$ = m$ + "......22" + Chr$(13)
  6550.     m$ = m$ + "......22" + Chr$(13)
  6551.     m$ = m$ + "......22" + Chr$(13)
  6552.     arrTileText(215) = m$
  6553.  
  6554.     m$ = ""
  6555.     m$ = m$ + "........" + Chr$(13)
  6556.     m$ = m$ + "........" + Chr$(13)
  6557.     m$ = m$ + "........" + Chr$(13)
  6558.     m$ = m$ + "........" + Chr$(13)
  6559.     m$ = m$ + "22..22.." + Chr$(13)
  6560.     m$ = m$ + "22..22.." + Chr$(13)
  6561.     m$ = m$ + "..22..22" + Chr$(13)
  6562.     m$ = m$ + "..22..22" + Chr$(13)
  6563.     arrTileText(216) = m$
  6564.  
  6565.     m$ = ""
  6566.     m$ = m$ + "22..22.." + Chr$(13)
  6567.     m$ = m$ + "2..22..2" + Chr$(13)
  6568.     m$ = m$ + "..22..22" + Chr$(13)
  6569.     m$ = m$ + ".22..22." + Chr$(13)
  6570.     m$ = m$ + "22..22.." + Chr$(13)
  6571.     m$ = m$ + "2..22..2" + Chr$(13)
  6572.     m$ = m$ + "..22..22" + Chr$(13)
  6573.     m$ = m$ + ".22..22." + Chr$(13)
  6574.     arrTileText(217) = m$
  6575.  
  6576.     m$ = ""
  6577.     m$ = m$ + "......22" + Chr$(13)
  6578.     m$ = m$ + "......22" + Chr$(13)
  6579.     m$ = m$ + "......22" + Chr$(13)
  6580.     m$ = m$ + "......22" + Chr$(13)
  6581.     m$ = m$ + "......22" + Chr$(13)
  6582.     m$ = m$ + "......22" + Chr$(13)
  6583.     m$ = m$ + "......22" + Chr$(13)
  6584.     m$ = m$ + "......22" + Chr$(13)
  6585.     arrTileText(218) = m$
  6586.  
  6587.     m$ = ""
  6588.     m$ = m$ + "...22..." + Chr$(13)
  6589.     m$ = m$ + "...22..." + Chr$(13)
  6590.     m$ = m$ + "...22..." + Chr$(13)
  6591.     m$ = m$ + "...22222" + Chr$(13)
  6592.     m$ = m$ + "...22222" + Chr$(13)
  6593.     m$ = m$ + "...22..." + Chr$(13)
  6594.     m$ = m$ + "...22..." + Chr$(13)
  6595.     m$ = m$ + "...22..." + Chr$(13)
  6596.     arrTileText(219) = m$
  6597.  
  6598.     m$ = ""
  6599.     m$ = m$ + "........" + Chr$(13)
  6600.     m$ = m$ + "........" + Chr$(13)
  6601.     m$ = m$ + "........" + Chr$(13)
  6602.     m$ = m$ + "........" + Chr$(13)
  6603.     m$ = m$ + "....2222" + Chr$(13)
  6604.     m$ = m$ + "....2222" + Chr$(13)
  6605.     m$ = m$ + "....2222" + Chr$(13)
  6606.     m$ = m$ + "....2222" + Chr$(13)
  6607.     arrTileText(220) = m$
  6608.  
  6609.     m$ = ""
  6610.     m$ = m$ + "...22..." + Chr$(13)
  6611.     m$ = m$ + "...22..." + Chr$(13)
  6612.     m$ = m$ + "...22..." + Chr$(13)
  6613.     m$ = m$ + "...22222" + Chr$(13)
  6614.     m$ = m$ + "...22222" + Chr$(13)
  6615.     m$ = m$ + "........" + Chr$(13)
  6616.     m$ = m$ + "........" + Chr$(13)
  6617.     m$ = m$ + "........" + Chr$(13)
  6618.     arrTileText(221) = m$
  6619.  
  6620.     m$ = ""
  6621.     m$ = m$ + "........" + Chr$(13)
  6622.     m$ = m$ + "........" + Chr$(13)
  6623.     m$ = m$ + "........" + Chr$(13)
  6624.     m$ = m$ + "22222..." + Chr$(13)
  6625.     m$ = m$ + "22222..." + Chr$(13)
  6626.     m$ = m$ + "...22..." + Chr$(13)
  6627.     m$ = m$ + "...22..." + Chr$(13)
  6628.     m$ = m$ + "...22..." + Chr$(13)
  6629.     arrTileText(222) = m$
  6630.  
  6631.     m$ = ""
  6632.     m$ = m$ + "........" + Chr$(13)
  6633.     m$ = m$ + "........" + Chr$(13)
  6634.     m$ = m$ + "........" + Chr$(13)
  6635.     m$ = m$ + "........" + Chr$(13)
  6636.     m$ = m$ + "........" + Chr$(13)
  6637.     m$ = m$ + "........" + Chr$(13)
  6638.     m$ = m$ + "22222222" + Chr$(13)
  6639.     m$ = m$ + "22222222" + Chr$(13)
  6640.     arrTileText(223) = m$
  6641.  
  6642.     m$ = ""
  6643.     m$ = m$ + "........" + Chr$(13)
  6644.     m$ = m$ + "........" + Chr$(13)
  6645.     m$ = m$ + "........" + Chr$(13)
  6646.     m$ = m$ + "...22222" + Chr$(13)
  6647.     m$ = m$ + "...22222" + Chr$(13)
  6648.     m$ = m$ + "...22..." + Chr$(13)
  6649.     m$ = m$ + "...22..." + Chr$(13)
  6650.     m$ = m$ + "...22..." + Chr$(13)
  6651.     arrTileText(224) = m$
  6652.  
  6653.     m$ = ""
  6654.     m$ = m$ + "...22..." + Chr$(13)
  6655.     m$ = m$ + "...22..." + Chr$(13)
  6656.     m$ = m$ + "...22..." + Chr$(13)
  6657.     m$ = m$ + "22222222" + Chr$(13)
  6658.     m$ = m$ + "22222222" + Chr$(13)
  6659.     m$ = m$ + "........" + Chr$(13)
  6660.     m$ = m$ + "........" + Chr$(13)
  6661.     m$ = m$ + "........" + Chr$(13)
  6662.     arrTileText(225) = m$
  6663.  
  6664.     m$ = ""
  6665.     m$ = m$ + "........" + Chr$(13)
  6666.     m$ = m$ + "........" + Chr$(13)
  6667.     m$ = m$ + "........" + Chr$(13)
  6668.     m$ = m$ + "22222222" + Chr$(13)
  6669.     m$ = m$ + "22222222" + Chr$(13)
  6670.     m$ = m$ + "...22..." + Chr$(13)
  6671.     m$ = m$ + "...22..." + Chr$(13)
  6672.     m$ = m$ + "...22..." + Chr$(13)
  6673.     arrTileText(226) = m$
  6674.  
  6675.     m$ = ""
  6676.     m$ = m$ + "...22..." + Chr$(13)
  6677.     m$ = m$ + "...22..." + Chr$(13)
  6678.     m$ = m$ + "...22..." + Chr$(13)
  6679.     m$ = m$ + "22222..." + Chr$(13)
  6680.     m$ = m$ + "22222..." + Chr$(13)
  6681.     m$ = m$ + "...22..." + Chr$(13)
  6682.     m$ = m$ + "...22..." + Chr$(13)
  6683.     m$ = m$ + "...22..." + Chr$(13)
  6684.     arrTileText(227) = m$
  6685.  
  6686.     m$ = ""
  6687.     m$ = m$ + "22......" + Chr$(13)
  6688.     m$ = m$ + "22......" + Chr$(13)
  6689.     m$ = m$ + "22......" + Chr$(13)
  6690.     m$ = m$ + "22......" + Chr$(13)
  6691.     m$ = m$ + "22......" + Chr$(13)
  6692.     m$ = m$ + "22......" + Chr$(13)
  6693.     m$ = m$ + "22......" + Chr$(13)
  6694.     m$ = m$ + "22......" + Chr$(13)
  6695.     arrTileText(228) = m$
  6696.  
  6697.     m$ = ""
  6698.     m$ = m$ + "222....." + Chr$(13)
  6699.     m$ = m$ + "222....." + Chr$(13)
  6700.     m$ = m$ + "222....." + Chr$(13)
  6701.     m$ = m$ + "222....." + Chr$(13)
  6702.     m$ = m$ + "222....." + Chr$(13)
  6703.     m$ = m$ + "222....." + Chr$(13)
  6704.     m$ = m$ + "222....." + Chr$(13)
  6705.     m$ = m$ + "222....." + Chr$(13)
  6706.     arrTileText(229) = m$
  6707.  
  6708.     m$ = ""
  6709.     m$ = m$ + ".....222" + Chr$(13)
  6710.     m$ = m$ + ".....222" + Chr$(13)
  6711.     m$ = m$ + ".....222" + Chr$(13)
  6712.     m$ = m$ + ".....222" + Chr$(13)
  6713.     m$ = m$ + ".....222" + Chr$(13)
  6714.     m$ = m$ + ".....222" + Chr$(13)
  6715.     m$ = m$ + ".....222" + Chr$(13)
  6716.     m$ = m$ + ".....222" + Chr$(13)
  6717.     arrTileText(230) = m$
  6718.  
  6719.     m$ = ""
  6720.     m$ = m$ + "22222222" + Chr$(13)
  6721.     m$ = m$ + "22222222" + Chr$(13)
  6722.     m$ = m$ + "........" + Chr$(13)
  6723.     m$ = m$ + "........" + Chr$(13)
  6724.     m$ = m$ + "........" + Chr$(13)
  6725.     m$ = m$ + "........" + Chr$(13)
  6726.     m$ = m$ + "........" + Chr$(13)
  6727.     m$ = m$ + "........" + Chr$(13)
  6728.     arrTileText(231) = m$
  6729.  
  6730.     m$ = ""
  6731.     m$ = m$ + "22222222" + Chr$(13)
  6732.     m$ = m$ + "22222222" + Chr$(13)
  6733.     m$ = m$ + "22222222" + Chr$(13)
  6734.     m$ = m$ + "........" + Chr$(13)
  6735.     m$ = m$ + "........" + Chr$(13)
  6736.     m$ = m$ + "........" + Chr$(13)
  6737.     m$ = m$ + "........" + Chr$(13)
  6738.     m$ = m$ + "........" + Chr$(13)
  6739.     arrTileText(232) = m$
  6740.  
  6741.     m$ = ""
  6742.     m$ = m$ + "........" + Chr$(13)
  6743.     m$ = m$ + "........" + Chr$(13)
  6744.     m$ = m$ + "........" + Chr$(13)
  6745.     m$ = m$ + "........" + Chr$(13)
  6746.     m$ = m$ + "........" + Chr$(13)
  6747.     m$ = m$ + "22222222" + Chr$(13)
  6748.     m$ = m$ + "22222222" + Chr$(13)
  6749.     m$ = m$ + "22222222" + Chr$(13)
  6750.     arrTileText(233) = m$
  6751.  
  6752.     m$ = ""
  6753.     m$ = m$ + ".......2" + Chr$(13)
  6754.     m$ = m$ + "......22" + Chr$(13)
  6755.     m$ = m$ + ".....22." + Chr$(13)
  6756.     m$ = m$ + ".22.22.." + Chr$(13)
  6757.     m$ = m$ + ".2222..." + Chr$(13)
  6758.     m$ = m$ + ".222...." + Chr$(13)
  6759.     m$ = m$ + ".22....." + Chr$(13)
  6760.     m$ = m$ + "........" + Chr$(13)
  6761.     arrTileText(234) = m$
  6762.  
  6763.     m$ = ""
  6764.     m$ = m$ + "........" + Chr$(13)
  6765.     m$ = m$ + "........" + Chr$(13)
  6766.     m$ = m$ + "........" + Chr$(13)
  6767.     m$ = m$ + "........" + Chr$(13)
  6768.     m$ = m$ + "2222...." + Chr$(13)
  6769.     m$ = m$ + "2222...." + Chr$(13)
  6770.     m$ = m$ + "2222...." + Chr$(13)
  6771.     m$ = m$ + "2222...." + Chr$(13)
  6772.     arrTileText(235) = m$
  6773.  
  6774.     m$ = ""
  6775.     m$ = m$ + "....2222" + Chr$(13)
  6776.     m$ = m$ + "....2222" + Chr$(13)
  6777.     m$ = m$ + "....2222" + Chr$(13)
  6778.     m$ = m$ + "....2222" + Chr$(13)
  6779.     m$ = m$ + "........" + Chr$(13)
  6780.     m$ = m$ + "........" + Chr$(13)
  6781.     m$ = m$ + "........" + Chr$(13)
  6782.     m$ = m$ + "........" + Chr$(13)
  6783.     arrTileText(236) = m$
  6784.  
  6785.     m$ = ""
  6786.     m$ = m$ + "...22..." + Chr$(13)
  6787.     m$ = m$ + "...22..." + Chr$(13)
  6788.     m$ = m$ + "...22..." + Chr$(13)
  6789.     m$ = m$ + "22222..." + Chr$(13)
  6790.     m$ = m$ + "22222..." + Chr$(13)
  6791.     m$ = m$ + "........" + Chr$(13)
  6792.     m$ = m$ + "........" + Chr$(13)
  6793.     m$ = m$ + "........" + Chr$(13)
  6794.     arrTileText(237) = m$
  6795.  
  6796.     m$ = ""
  6797.     m$ = m$ + "2222...." + Chr$(13)
  6798.     m$ = m$ + "2222...." + Chr$(13)
  6799.     m$ = m$ + "2222...." + Chr$(13)
  6800.     m$ = m$ + "2222...." + Chr$(13)
  6801.     m$ = m$ + "........" + Chr$(13)
  6802.     m$ = m$ + "........" + Chr$(13)
  6803.     m$ = m$ + "........" + Chr$(13)
  6804.     m$ = m$ + "........" + Chr$(13)
  6805.     arrTileText(238) = m$
  6806.  
  6807.     m$ = ""
  6808.     m$ = m$ + "2222...." + Chr$(13)
  6809.     m$ = m$ + "2222...." + Chr$(13)
  6810.     m$ = m$ + "2222...." + Chr$(13)
  6811.     m$ = m$ + "2222...." + Chr$(13)
  6812.     m$ = m$ + "....2222" + Chr$(13)
  6813.     m$ = m$ + "....2222" + Chr$(13)
  6814.     m$ = m$ + "....2222" + Chr$(13)
  6815.     m$ = m$ + "....2222" + Chr$(13)
  6816.     arrTileText(239) = m$
  6817.  
  6818.     m$ = ""
  6819.     m$ = m$ + "........" + Chr$(13)
  6820.     m$ = m$ + "........" + Chr$(13)
  6821.     m$ = m$ + "........" + Chr$(13)
  6822.     m$ = m$ + "........" + Chr$(13)
  6823.     m$ = m$ + "........" + Chr$(13)
  6824.     m$ = m$ + "........" + Chr$(13)
  6825.     m$ = m$ + "........" + Chr$(13)
  6826.     m$ = m$ + "........" + Chr$(13)
  6827.     arrTileText(240) = m$
  6828.  
  6829.     m$ = ""
  6830.     m$ = m$ + "22222.22" + Chr$(13)
  6831.     m$ = m$ + "22222.22" + Chr$(13)
  6832.     m$ = m$ + "22222.22" + Chr$(13)
  6833.     m$ = m$ + "........" + Chr$(13)
  6834.     m$ = m$ + "22.22222" + Chr$(13)
  6835.     m$ = m$ + "22.22222" + Chr$(13)
  6836.     m$ = m$ + "22.22222" + Chr$(13)
  6837.     m$ = m$ + "........" + Chr$(13)
  6838.     arrTileText(241) = m$
  6839.  
  6840.     m$ = ""
  6841.     m$ = m$ + "........" + Chr$(13)
  6842.     m$ = m$ + "........" + Chr$(13)
  6843.     m$ = m$ + "........" + Chr$(13)
  6844.     m$ = m$ + ".222222." + Chr$(13)
  6845.     m$ = m$ + "........" + Chr$(13)
  6846.     m$ = m$ + "........" + Chr$(13)
  6847.     m$ = m$ + "........" + Chr$(13)
  6848.     m$ = m$ + "........" + Chr$(13)
  6849.     arrTileText(242) = m$
  6850.  
  6851.     m$ = ""
  6852.     m$ = m$ + "........" + Chr$(13)
  6853.     m$ = m$ + "...2...." + Chr$(13)
  6854.     m$ = m$ + "...2...." + Chr$(13)
  6855.     m$ = m$ + "...2...." + Chr$(13)
  6856.     m$ = m$ + "...2...." + Chr$(13)
  6857.     m$ = m$ + "...2...." + Chr$(13)
  6858.     m$ = m$ + "...2...." + Chr$(13)
  6859.     m$ = m$ + "........" + Chr$(13)
  6860.     arrTileText(243) = m$
  6861.  
  6862.     m$ = ""
  6863.     m$ = m$ + "........" + Chr$(13)
  6864.     m$ = m$ + "........" + Chr$(13)
  6865.     m$ = m$ + "........" + Chr$(13)
  6866.     m$ = m$ + "...2222." + Chr$(13)
  6867.     m$ = m$ + "...2...." + Chr$(13)
  6868.     m$ = m$ + "...2...." + Chr$(13)
  6869.     m$ = m$ + "...2...." + Chr$(13)
  6870.     m$ = m$ + "........" + Chr$(13)
  6871.     arrTileText(244) = m$
  6872.  
  6873.     m$ = ""
  6874.     m$ = m$ + "........" + Chr$(13)
  6875.     m$ = m$ + "........" + Chr$(13)
  6876.     m$ = m$ + "........" + Chr$(13)
  6877.     m$ = m$ + ".222...." + Chr$(13)
  6878.     m$ = m$ + "...2...." + Chr$(13)
  6879.     m$ = m$ + "...2...." + Chr$(13)
  6880.     m$ = m$ + "...2...." + Chr$(13)
  6881.     m$ = m$ + "........" + Chr$(13)
  6882.     arrTileText(245) = m$
  6883.  
  6884.     m$ = ""
  6885.     m$ = m$ + "........" + Chr$(13)
  6886.     m$ = m$ + "...2...." + Chr$(13)
  6887.     m$ = m$ + "...2...." + Chr$(13)
  6888.     m$ = m$ + "...2222." + Chr$(13)
  6889.     m$ = m$ + "........" + Chr$(13)
  6890.     m$ = m$ + "........" + Chr$(13)
  6891.     m$ = m$ + "........" + Chr$(13)
  6892.     m$ = m$ + "........" + Chr$(13)
  6893.     arrTileText(246) = m$
  6894.  
  6895.     m$ = ""
  6896.     m$ = m$ + "........" + Chr$(13)
  6897.     m$ = m$ + "...2...." + Chr$(13)
  6898.     m$ = m$ + "...2...." + Chr$(13)
  6899.     m$ = m$ + ".222...." + Chr$(13)
  6900.     m$ = m$ + "........" + Chr$(13)
  6901.     m$ = m$ + "........" + Chr$(13)
  6902.     m$ = m$ + "........" + Chr$(13)
  6903.     m$ = m$ + "........" + Chr$(13)
  6904.     arrTileText(247) = m$
  6905.  
  6906.     m$ = ""
  6907.     m$ = m$ + "........" + Chr$(13)
  6908.     m$ = m$ + "........" + Chr$(13)
  6909.     m$ = m$ + "........" + Chr$(13)
  6910.     m$ = m$ + "........" + Chr$(13)
  6911.     m$ = m$ + "........" + Chr$(13)
  6912.     m$ = m$ + "........" + Chr$(13)
  6913.     m$ = m$ + "........" + Chr$(13)
  6914.     m$ = m$ + "........" + Chr$(13)
  6915.     arrTileText(248) = m$
  6916.  
  6917.     m$ = ""
  6918.     m$ = m$ + "........" + Chr$(13)
  6919.     m$ = m$ + "........" + Chr$(13)
  6920.     m$ = m$ + "........" + Chr$(13)
  6921.     m$ = m$ + "........" + Chr$(13)
  6922.     m$ = m$ + "........" + Chr$(13)
  6923.     m$ = m$ + "........" + Chr$(13)
  6924.     m$ = m$ + "........" + Chr$(13)
  6925.     m$ = m$ + "........" + Chr$(13)
  6926.     arrTileText(249) = m$
  6927.  
  6928.     m$ = ""
  6929.     m$ = m$ + "........" + Chr$(13)
  6930.     m$ = m$ + "........" + Chr$(13)
  6931.     m$ = m$ + "........" + Chr$(13)
  6932.     m$ = m$ + "........" + Chr$(13)
  6933.     m$ = m$ + "........" + Chr$(13)
  6934.     m$ = m$ + "........" + Chr$(13)
  6935.     m$ = m$ + "........" + Chr$(13)
  6936.     m$ = m$ + "........" + Chr$(13)
  6937.     arrTileText(250) = m$
  6938.  
  6939.     m$ = ""
  6940.     m$ = m$ + "........" + Chr$(13)
  6941.     m$ = m$ + "........" + Chr$(13)
  6942.     m$ = m$ + "........" + Chr$(13)
  6943.     m$ = m$ + "........" + Chr$(13)
  6944.     m$ = m$ + "........" + Chr$(13)
  6945.     m$ = m$ + "........" + Chr$(13)
  6946.     m$ = m$ + "........" + Chr$(13)
  6947.     m$ = m$ + "........" + Chr$(13)
  6948.     arrTileText(251) = m$
  6949.  
  6950.     m$ = ""
  6951.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6952.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6953.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6954.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6955.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6956.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6957.     m$ = m$ + "2.2.2.2." + Chr$(13)
  6958.     m$ = m$ + ".2.2.2.2" + Chr$(13)
  6959.     arrTileText(252) = m$
  6960.  
  6961.     m$ = ""
  6962.     m$ = m$ + "22222222" + Chr$(13)
  6963.     m$ = m$ + "2......2" + Chr$(13)
  6964.     m$ = m$ + "2......2" + Chr$(13)
  6965.     m$ = m$ + "2......2" + Chr$(13)
  6966.     m$ = m$ + "2......2" + Chr$(13)
  6967.     m$ = m$ + "2......2" + Chr$(13)
  6968.     m$ = m$ + "2......2" + Chr$(13)
  6969.     m$ = m$ + "22222222" + Chr$(13)
  6970.     arrTileText(253) = m$
  6971.  
  6972.     m$ = ""
  6973.     m$ = m$ + "22222222" + Chr$(13)
  6974.     m$ = m$ + "22222222" + Chr$(13)
  6975.     m$ = m$ + "22222222" + Chr$(13)
  6976.     m$ = m$ + "22222222" + Chr$(13)
  6977.     m$ = m$ + "22222222" + Chr$(13)
  6978.     m$ = m$ + "22222222" + Chr$(13)
  6979.     m$ = m$ + "22222222" + Chr$(13)
  6980.     m$ = m$ + "22222222" + Chr$(13)
  6981.     arrTileText(254) = m$
  6982.  
  6983.     m$ = ""
  6984.     m$ = ""
  6985.     m$ = m$ + "22....22" + Chr$(13)
  6986.     m$ = m$ + "2..22..2" + Chr$(13)
  6987.     m$ = m$ + "2..22..2" + Chr$(13)
  6988.     m$ = m$ + "22.....2" + Chr$(13)
  6989.     m$ = m$ + "22222..2" + Chr$(13)
  6990.     m$ = m$ + "2..22..2" + Chr$(13)
  6991.     m$ = m$ + "22....22" + Chr$(13)
  6992.     m$ = m$ + "22222222" + Chr$(13)
  6993.     arrTileText(255) = m$
  6994.  
  6995. End Sub ' GetTileText
  6996.  
  6997. ' ################################################################################################################################################################
  6998. ' END TILE DEFINITIONS
  6999. ' ################################################################################################################################################################
  7000.  
  7001. ' ################################################################################################################################################################
  7002. ' BEGIN COLOR FUNCTIONS
  7003. ' ################################################################################################################################################################
  7004. Function cWhite~& ()
  7005.     cWhite = _RGB32(255, 255, 255)
  7006. End Function ' cWhite~&
  7007.  
  7008. Function cEmpty~& ()
  7009.     cEmpty = _RGB32(0, 0, 0, 0)
  7010. End Function ' cEmpty~&
  7011.  
  7012. Function cBlack~& ()
  7013.     cBlack = _RGB32(0, 0, 0)
  7014. End Function ' cBlack~&
  7015.  
  7016. Function cRed~& ()
  7017.     cRed = _RGB32(255, 0, 0)
  7018.  
  7019. Function cYellow~& ()
  7020.     cYellow = _RGB32(255, 255, 0)
  7021. End Function ' cYellow~&
  7022.  
  7023. Function cLime~& ()
  7024.     cLime = _RGB32(0, 255, 0)
  7025. End Function ' cLime~&
  7026.  
  7027. Function cCyan~& ()
  7028.     cCyan = _RGB32(0, 255, 255)
  7029. End Function ' cCyan~&
  7030.  
  7031. Function cBlue~& ()
  7032.     cBlue = _RGB32(0, 0, 255)
  7033. End Function ' cBlue~&
  7034.  
  7035. Function cPurple~& ()
  7036.     cPurple = _RGB32(128, 0, 255)
  7037. End Function ' cPurple~&
  7038.  
  7039. Function cMagenta~& ()
  7040.     cMagenta = _RGB32(255, 0, 255)
  7041. End Function ' cMagenta~&
  7042.  
  7043. Function cOrange~& ()
  7044.     cOrange = _RGB32(255, 165, 0)
  7045. End Function ' cOrange~&
  7046.  
  7047. Function cGray~& ()
  7048.     cGray = _RGB32(128, 128, 128)
  7049. End Function ' cGray~&
  7050. ' ################################################################################################################################################################
  7051. ' END COLOR FUNCTIONS
  7052. ' ################################################################################################################################################################
  7053.  
  7054. ' ################################################################################################################################################################
  7055. ' BEGIN GENERAL PURPOSE ROUTINES
  7056. ' ################################################################################################################################################################
  7057.  
  7058. ' /////////////////////////////////////////////////////////////////////////////
  7059. ' See also StringTo2dArray
  7060.  
  7061. Function Array2dToString$ (MyArray() As String)
  7062.     Dim MyString As String
  7063.     Dim iY As Integer
  7064.     Dim iX As Integer
  7065.     Dim sLine As String
  7066.     MyString = ""
  7067.     For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  7068.         sLine = ""
  7069.         For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  7070.             sLine = sLine + MyArray(iY, iX)
  7071.         Next iX
  7072.         MyString = MyString + sLine + Chr$(13)
  7073.     Next iY
  7074.     Array2dToString$ = MyString
  7075. End Function ' Array2dToString$
  7076.  
  7077. ' /////////////////////////////////////////////////////////////////////////////
  7078.  
  7079. 'Function Array2dToStringTest$ (MyArray() As String)
  7080. '    Dim MyString As String
  7081. '    Dim iY As Integer
  7082. '    Dim iX As Integer
  7083. '    Dim sLine As String
  7084. '    MyString = ""
  7085. '    MyString = MyString + "           11111111112222222222333" + Chr$(13)
  7086. '    MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  7087. '    For iY = LBound(MyArray, 1) To UBound(MyArray, 1)
  7088. '        sLine = ""
  7089. '        sLine = sLine + Right$("  " + cstr$(iY), 2)
  7090. '        For iX = LBound(MyArray, 2) To UBound(MyArray, 2)
  7091. '            sLine = sLine + MyArray(iY, iX)
  7092. '        Next iX
  7093. '        sLine = sLine + Right$("  " + cstr$(iY), 2)
  7094. '        MyString = MyString + sLine + Chr$(13)
  7095. '    Next iY
  7096. '    MyString = MyString + "  12345678901234567890123456789012" + Chr$(13)
  7097. '    MyString = MyString + "           11111111112222222222333" + Chr$(13)
  7098. '    Array2dToStringTest$ = MyString
  7099. 'End Function ' Array2dToStringTest$
  7100.  
  7101. ' /////////////////////////////////////////////////////////////////////////////
  7102.  
  7103. Function cstr$ (myValue)
  7104.     'cstr$ = LTRIM$(RTRIM$(STR$(myValue)))
  7105.     cstr$ = _Trim$(Str$(myValue))
  7106. End Function ' cstr$
  7107.  
  7108. ' /////////////////////////////////////////////////////////////////////////////
  7109. ' Simple timestamp function
  7110.  
  7111. Function CurrentDateTime$
  7112.     CurrentDateTime$ = Mid$(Date$, 7, 4) + "-" + _
  7113.         Mid$(Date$, 1, 5) + " " + _
  7114.         Time$
  7115. End Function ' CurrentDateTime$
  7116.  
  7117. ' /////////////////////////////////////////////////////////////////////////////
  7118. ' Receives an {sDelim} delimited list {sInput}
  7119. ' returns the list with all duplicate entries removed.
  7120.  
  7121. Function DedupeDelimList$ (sInput As String, sDelim As String)
  7122.     ReDim arrLines(-1) As String
  7123.     Dim sOutput As String
  7124.     Dim iLoop As Integer
  7125.  
  7126.     split sInput, sDelim, arrLines()
  7127.     sOutput = sDelim
  7128.     For iLoop = LBound(arrLines) To UBound(arrLines)
  7129.         If InStr(1, sOutput, sDelim + arrLines(iLoop) + sDelim) = 0 Then
  7130.             sOutput = sOutput + arrLines(iLoop) + sDelim
  7131.         End If
  7132.     Next iLoop
  7133.  
  7134.     DedupeDelimList$ = sOutput
  7135. End Function ' DedupeDelimList$
  7136.  
  7137. ' /////////////////////////////////////////////////////////////////////////////
  7138. ' Use with timer functions to avoid "after midnight" bug.
  7139.  
  7140. ' Re: how to time something (ie do loop for n seconds)
  7141. ' https://qb64forum.alephc.xyz/index.php?topic=4682.0
  7142.  
  7143. ' SMcNeill, QB64 Developer
  7144. ' « Reply #1 on: Today at 11:26:52 am »
  7145. '
  7146. ' One caveat here:  You *can* experience bugs with this after midnight.
  7147. '
  7148. ' Program starts at 23:59:59.
  7149. ' Add three seconds -- 24:00:02...  (In seconds, and not hours and minutes like this, though hours and minutes are easier to visualize.)
  7150. ' Clock hits midnight:  0:00:00
  7151. '
  7152. ' At no point will you ever have TIMER become greater than t#.
  7153. '
  7154. ' If you're going to have a program which might run into this issue,
  7155. ' I'd suggest just plugging in my ExtendedTimer and use it instead:
  7156. '
  7157. ' Most of us write time code to test little snippets for which method might
  7158. ' be faster for us while we're coding.  The clock resetting on us isn't
  7159. ' normally such a big deal.  When it is, however, all you have to do is
  7160. ' swap to the ExtendedTimer function [below]
  7161. '
  7162. ' Returns a value for you based off DAY + TIME, rather than just time alone!
  7163. ' No midnight clock issues with something like that in our programs.  ;)
  7164.  
  7165. ' Usage:
  7166. '     ' DO SOMETHING FOR 3 SECONDS
  7167. '     t# = ExtendedTimer + 3
  7168. '     Do
  7169. '         '(SOMETHING)
  7170. '     Loop Until Timer > t#
  7171.  
  7172. Function ExtendedTimer##
  7173.     d$ = Date$
  7174.     l = InStr(d$, "-")
  7175.     l1 = InStr(l + 1, d$, "-")
  7176.     m = Val(Left$(d$, l))
  7177.     d = Val(Mid$(d$, l + 1))
  7178.     y = Val(Mid$(d$, l1 + 1)) - 1970
  7179.     For i = 1 To m
  7180.         Select Case i 'Add the number of days for each previous month passed
  7181.             Case 1: d = d 'January doestn't have any carry over days.
  7182.             Case 2, 4, 6, 8, 9, 11: d = d + 31
  7183.             Case 3: d = d + 28
  7184.             Case 5, 7, 10, 12: d = d + 30
  7185.         End Select
  7186.     Next
  7187.     For i = 1 To y
  7188.         d = d + 365
  7189.     Next
  7190.     For i = 2 To y Step 4
  7191.         If m > 2 Then d = d + 1 'add an extra day for leap year every 4 years, starting in 1970
  7192.     Next
  7193.     d = d - 1 'for year 2000
  7194.     s~&& = d * 24 * 60 * 60 'Seconds are days * 24 hours * 60 minutes * 60 seconds
  7195.     ExtendedTimer## = (s~&& + Timer)
  7196. End Function ' ExtendedTimer##
  7197.  
  7198. ' /////////////////////////////////////////////////////////////////////////////
  7199. ' Receives a {sDelimeter} delimited list of numbers {MyString}
  7200. ' and splits it up into an integer array arrInteger()
  7201. ' beginning at index {iMinIndex}.
  7202.  
  7203. Sub GetIntegerArrayFromDelimList (MyString As String, sDelimiter As String, iMinIndex As Integer, arrInteger() As Integer)
  7204.     ReDim arrString(-1) As String
  7205.     Dim CleanString As String
  7206.     Dim iLoop As Integer
  7207.     Dim iCount As Integer: iCount = iMinIndex - 1
  7208.  
  7209.     ReDim arrInteger(-1) As Integer
  7210.  
  7211.     'DebugPrint "GetIntegerArrayFromDelimList " + _
  7212.     '    "MyString=" + chr$(34) + MyString + chr$(34) + ", " + _
  7213.     '    "sDelimiter=" + chr$(34) + sDelimiter + chr$(34) + ", " + _
  7214.     '    "iMinIndex=" + cstr$(iMinIndex) + ", " + _
  7215.     '    "arrInteger()"
  7216.  
  7217.  
  7218.     If Len(sDelimiter) > 0 Then
  7219.         CleanString = MyString
  7220.         If sDelimiter <> " " Then
  7221.             CleanString = Replace$(CleanString, " ", "")
  7222.         End If
  7223.  
  7224.         split CleanString, sDelimiter, arrString()
  7225.         iCount = iMinIndex - 1
  7226.         For iLoop = LBound(arrString) To UBound(arrString)
  7227.             If IsNum%(arrString(iLoop)) = TRUE Then
  7228.                 iCount = iCount + 1
  7229.                 ReDim _Preserve arrInteger(iMinIndex To iCount) As Integer
  7230.                 arrInteger(iCount) = Val(arrString(iLoop))
  7231.                 'DebugPrint "5633 arrInteger(" + cstr$(iCount) + ") = VAL(arrString(" + cstr$(iLoop) + ")) = " + cstr$(arrInteger(iCount))
  7232.  
  7233.             End If
  7234.         Next iLoop
  7235.     Else
  7236.         If IsNum%(MyString) = TRUE Then
  7237.             ReDim _Preserve arrInteger(iMinIndex To iMinIndex) As Integer
  7238.             arrInteger(iMinIndex) = Val(MyString)
  7239.         End If
  7240.     End If
  7241.  
  7242.     'CleanString=""
  7243.     'for iLoop=lbound(arrInteger) to ubound(arrInteger)
  7244.     'CleanString = CleanString + iifstr$(iLoop=lbound(arrInteger), "", ",") + cstr$(arrInteger(iLoop))
  7245.     'next iLoop
  7246.     'DebugPrint "arrInteger=(" + CleanString + ")"
  7247.  
  7248. End Sub ' GetIntegerArrayFromDelimList
  7249.  
  7250. ' /////////////////////////////////////////////////////////////////////////////
  7251.  
  7252. Function IIF (Condition, IfTrue, IfFalse)
  7253.     If Condition Then IIF = IfTrue Else IIF = IfFalse
  7254.  
  7255. ' /////////////////////////////////////////////////////////////////////////////
  7256.  
  7257. Function IIFSTR$ (Condition, IfTrue$, IfFalse$)
  7258.     If Condition Then IIFSTR$ = IfTrue$ Else IIFSTR$ = IfFalse$
  7259.  
  7260. ' /////////////////////////////////////////////////////////////////////////////
  7261. ' By sMcNeill from https://www.qb64.org/forum/index.php?topic=896.0
  7262.  
  7263. Function IsNum% (text$)
  7264.     Dim a$
  7265.     Dim b$
  7266.     a$ = _Trim$(text$)
  7267.     b$ = _Trim$(Str$(Val(text$)))
  7268.     If a$ = b$ Then
  7269.         IsNum% = TRUE
  7270.     Else
  7271.         IsNum% = FALSE
  7272.     End If
  7273. End Function ' IsNum%
  7274.  
  7275. ' /////////////////////////////////////////////////////////////////////////////
  7276. ' Does a _PrintString at the specified row+column.
  7277.  
  7278. ' iRow and iCol are 0-based.
  7279.  
  7280. Sub PrintString (iRow As Integer, iCol As Integer, MyString As String)
  7281.     Dim iX As Integer
  7282.     Dim iY As Integer
  7283.     iX = _FontWidth * iCol
  7284.     iY = _FontHeight * iRow ' (iRow + 1)
  7285.     _PrintString (iX, iY), MyString
  7286. End Sub ' PrintString
  7287.  
  7288. ' /////////////////////////////////////////////////////////////////////////////
  7289. ' Does a _PrintString at the specified row+column.
  7290.  
  7291. ' iRow and iCol are 1-based.
  7292.  
  7293. Sub PrintString1 (iRow As Integer, iCol As Integer, MyString As String)
  7294.     Dim iX As Integer
  7295.     Dim iY As Integer
  7296.     iX = _FontWidth * (iCol - 1)
  7297.     iY = _FontHeight * (iRow - 1)
  7298.     _PrintString (iX, iY), MyString
  7299. End Sub ' PrintString1
  7300.  
  7301. ' /////////////////////////////////////////////////////////////////////////////
  7302. ' FROM: String Manipulation
  7303. ' found at abandoned, outdated and now likely malicious qb64 dot net website
  7304. ' http://www.qb64.[net]/forum/index_topic_5964-0/
  7305. '
  7306. 'SUMMARY:
  7307. '   Purpose:  A library of custom functions that transform strings.
  7308. '   Author:   Dustinian Camburides (dustinian@gmail.com)
  7309. '   Platform: QB64 (www.qb64.org)
  7310. '   Revision: 1.6
  7311. '   Updated:  5/28/2012
  7312.  
  7313. 'SUMMARY:
  7314. '[Replace$] replaces all instances of the [Find] sub-string with the [Add] sub-string within the [Text] string.
  7315. 'INPUT:
  7316. 'Text: The input string; the text that's being manipulated.
  7317. 'Find: The specified sub-string; the string sought within the [Text] string.
  7318. 'Add: The sub-string that's being added to the [Text] string.
  7319.  
  7320. Function Replace$ (Text1 As String, Find1 As String, Add1 As String)
  7321.     ' VARIABLES:
  7322.     Dim Text2 As String
  7323.     Dim Find2 As String
  7324.     Dim Add2 As String
  7325.     Dim lngLocation As Long ' The address of the [Find] substring within the [Text] string.
  7326.     Dim strBefore As String ' The characters before the string to be replaced.
  7327.     Dim strAfter As String ' The characters after the string to be replaced.
  7328.  
  7329.     ' INITIALIZE:
  7330.     ' MAKE COPIESSO THE ORIGINAL IS NOT MODIFIED (LIKE ByVal IN VBA)
  7331.     Text2 = Text1
  7332.     Find2 = Find1
  7333.     Add2 = Add1
  7334.  
  7335.     lngLocation = InStr(1, Text2, Find2)
  7336.  
  7337.     ' PROCESSING:
  7338.     ' While [Find2] appears in [Text2]...
  7339.     While lngLocation
  7340.         ' Extract all Text2 before the [Find2] substring:
  7341.         strBefore = Left$(Text2, lngLocation - 1)
  7342.  
  7343.         ' Extract all text after the [Find2] substring:
  7344.         strAfter = Right$(Text2, ((Len(Text2) - (lngLocation + Len(Find2) - 1))))
  7345.  
  7346.         ' Return the substring:
  7347.         Text2 = strBefore + Add2 + strAfter
  7348.  
  7349.         ' Locate the next instance of [Find2]:
  7350.         lngLocation = InStr(1, Text2, Find2)
  7351.  
  7352.         ' Next instance of [Find2]...
  7353.     Wend
  7354.  
  7355.     ' OUTPUT:
  7356.     Replace$ = Text2
  7357. End Function ' Replace$
  7358.  
  7359. ' /////////////////////////////////////////////////////////////////////////////
  7360. ' Split and join strings
  7361. ' https://www.qb64.org/forum/index.php?topic=1073.0
  7362. '
  7363. ' FROM luke, QB64 Developer
  7364. ' Date: February 15, 2019, 04:11:07 AM
  7365. '
  7366. ' Given a string of words separated by spaces (or any other character),
  7367. ' splits it into an array of the words. I've no doubt many people have
  7368. ' written a version of this over the years and no doubt there's a million
  7369. ' ways to do it, but I thought I'd put mine here so we have at least one
  7370. ' version. There's also a join function that does the opposite
  7371. ' array -> single string.
  7372. '
  7373. ' Code is hopefully reasonably self explanatory with comments and a little demo.
  7374. ' Note, this is akin to Python/JavaScript split/join, PHP explode/implode.
  7375.  
  7376. 'Split in$ into pieces, chopping at every occurrence of delimiter$. Multiple consecutive occurrences
  7377. 'of delimiter$ are treated as a single instance. The chopped pieces are stored in result$().
  7378. '
  7379. 'delimiter$ must be one character long.
  7380. 'result$() must have been REDIMmed previously.
  7381.  
  7382. ' Modified to handle multi-character delimiters
  7383.  
  7384. Sub split (in$, delimiter$, result$())
  7385.     Dim start As Integer
  7386.     Dim finish As Integer
  7387.     Dim iDelimLen As Integer
  7388.     ReDim result$(-1)
  7389.  
  7390.     iDelimLen = Len(delimiter$)
  7391.  
  7392.     start = 1
  7393.     Do
  7394.         'While Mid$(in$, start, 1) = delimiter$
  7395.         While Mid$(in$, start, iDelimLen) = delimiter$
  7396.             'start = start + 1
  7397.             start = start + iDelimLen
  7398.             If start > Len(in$) Then
  7399.                 Exit Sub
  7400.             End If
  7401.         Wend
  7402.         finish = InStr(start, in$, delimiter$)
  7403.         If finish = 0 Then
  7404.             finish = Len(in$) + 1
  7405.         End If
  7406.  
  7407.         ReDim _Preserve result$(0 To UBound(result$) + 1)
  7408.  
  7409.         result$(UBound(result$)) = Mid$(in$, start, finish - start)
  7410.         start = finish + 1
  7411.     Loop While start <= Len(in$)
  7412. End Sub ' split
  7413.  
  7414. ' /////////////////////////////////////////////////////////////////////////////
  7415. ' Converts a chr$(13) delimited string
  7416. ' into a 2-dimensional array.
  7417.  
  7418. ' Usage:
  7419. ' Dim StringArray(1 To 48, 1 To 128) As String
  7420. ' StringTo2dArray StringArray(), GetMap$
  7421.  
  7422. ' Version 2 with indexed array(row, columm)
  7423. ' Renamed StringToArray to StringTo2dArray.
  7424.  
  7425. ' See also: Array2dToString$
  7426.  
  7427. Sub StringTo2dArray (MyArray() As String, MyString As String)
  7428.     Dim sDelim As String
  7429.     ReDim arrLines(0) As String
  7430.     Dim iRow As Integer
  7431.     Dim iCol As Integer
  7432.     Dim sChar As String
  7433.     Dim iDim1 As Integer
  7434.     Dim iDim2 As Integer
  7435.     Dim iIndex1 As Integer
  7436.     Dim iIndex2 As Integer
  7437.  
  7438.     iDim1 = LBound(MyArray, 1)
  7439.     iDim2 = LBound(MyArray, 2)
  7440.     sDelim = Chr$(13)
  7441.     split MyString, sDelim, arrLines()
  7442.     For iRow = LBound(arrLines) To UBound(arrLines)
  7443.         If iRow <= UBound(MyArray, 1) Then
  7444.             For iCol = 1 To Len(arrLines(iRow))
  7445.                 If iCol <= UBound(MyArray, 2) Then
  7446.                     sChar = Mid$(arrLines(iRow), iCol, 1)
  7447.  
  7448.                     If Len(sChar) > 1 Then
  7449.                         sChar = Left$(sChar, 1)
  7450.                     Else
  7451.                         If Len(sChar) = 0 Then
  7452.                             sChar = "."
  7453.                         End If
  7454.                     End If
  7455.  
  7456.                     iIndex1 = iRow + iDim1
  7457.                     iIndex2 = (iCol - 1) + iDim2
  7458.                     MyArray(iIndex1, iIndex2) = sChar
  7459.                     'DebugPrint "MyArray(" + cstr$(iIndex1) + ", " + cstr$(iIndex2) + " = " + chr$(34) + sChar + chr$(34)
  7460.                 Else
  7461.                     ' Exit if out of bounds
  7462.                     Exit For
  7463.                 End If
  7464.             Next iCol
  7465.         Else
  7466.             ' Exit if out of bounds
  7467.             Exit For
  7468.         End If
  7469.     Next iRow
  7470. End Sub ' StringTo2dArray
  7471.  
  7472. ' /////////////////////////////////////////////////////////////////////////////
  7473.  
  7474. Function TrueFalse$ (myValue)
  7475.     If myValue = TRUE Then
  7476.         TrueFalse$ = "TRUE"
  7477.     Else
  7478.         TrueFalse$ = "FALSE"
  7479.     End If
  7480. End Function ' TrueFalse$
  7481.  
  7482. ' ################################################################################################################################################################
  7483. ' END GENERAL PURPOSE ROUTINES
  7484. ' ################################################################################################################################################################
  7485.  
  7486. ' ################################################################################################################################################################
  7487. ' BEGIN HARDWARE IMAGES DEMO #2 (WORKS)
  7488. ' ################################################################################################################################################################
  7489.  
  7490. ' /////////////////////////////////////////////////////////////////////////////
  7491. ' Re: fastest way to draw a 2-color 8x8 tile (with variable colors)?
  7492. ' https://qb64forum.alephc.xyz/index.php?topic=4674.0
  7493.  
  7494. ' madscijr
  7495. ' « Reply #5 on: Yesterday at 09:46:53 pm »
  7496.  
  7497. ' Quote from: SMcNeill on Yesterday at 07:56:57 pm:
  7498. ' Hardware images basically get their speed by being a sort of "Write Only"
  7499. ' method for images. You can make them, you can put them on the screen,
  7500. ' but you can't edit them or read information back from them.
  7501. ' ...
  7502. ' 2) You don't have to specify where they show up as a destination with putimage.
  7503. ' ...
  7504. ' If you have any specific questions, feel free to ask them and I'll do my
  7505. ' best to answer for you, if I can.  ;)
  7506. '
  7507. ' Thanks for taking the time to explain all that. When I'm back at the PC,
  7508. ' I'll try out your example.
  7509. '
  7510. ' For now, just one question: if you can't read information from them or even
  7511. ' specify where on the destination they go, how are they even useful?
  7512. ' Maybe it will click when I run your example or read up on it, but I just
  7513. ' don't see what the use of an image would be if you can't control where on
  7514. ' the screen it is drawn? Or how it would help speed up drawing a map of
  7515. ' colored tiles to the screen.
  7516. '
  7517. ' Thanks again...
  7518.  
  7519. ' SMcNeill, QB64 Developer
  7520. ' « Reply #6 on: Today at 01:14:28 am »
  7521. '
  7522. ' Try this out and see if it doesn't help answer your questions:
  7523.  
  7524. Sub HardwareImageDemo2
  7525.     $Color:32
  7526.     Display = _NewImage(1024, 720, 32)
  7527.     Software = _NewImage(1024, 720, 32)
  7528.  
  7529.     Screen Display
  7530.     Print "First, let's create a normal sortware screen and fill it with 40x40 tiles of random colors."
  7531.     Print "Press <ANY KEY> to view this screen."
  7532.     Sleep
  7533.  
  7534.     _Dest Software
  7535.     For y = 0 To 720 Step 40
  7536.         For x = 0 To 1024 Step 40
  7537.             Line (x, y)-Step(40, 40), &HFF000000 + Rnd * &HFFFFFF, BF
  7538.         Next
  7539.     Next
  7540.  
  7541.     _Dest Display
  7542.     _PutImage , Software
  7543.     Print
  7544.     Print "As you can see, this is a simple software screen."
  7545.     Print "Now, I'm going to copy that software screen and make it a hardware screen."
  7546.     Print "Press <ANY KEY> for me to do so!"
  7547.     Sleep
  7548.  
  7549.     Hardware = _CopyImage(Software, 33)
  7550.     Cls
  7551.     Print "Now, I'm back to my blank screen, but I now have a hardware screen to work with."
  7552.     Print
  7553.     Print "To keep things simple, let's showcase the differences between using _putimage with a software screen, and then with the hardware screen."
  7554.     Print
  7555.     Print "First, the software screen!  Press <ANY KEY> to continue."
  7556.     Sleep
  7557.  
  7558.     _PutImage (0, 100)-Step(100, 100), Software, Display, (0, 0)-(40, 40)
  7559.     Print "As you can see, all I did here was copy a single tile from the software screen and then scale it to fit upon the current screen."
  7560.     Print
  7561.     Print "Press <ANY KEY> to continue, as I'll now do the same with a hardware image."
  7562.  
  7563.     _PutImage (200, 100)-Step(100, 100), Hardware, , (0, 0)-(40, 40)
  7564.     Print
  7565.     Print "As you can see from the above, we have the same tile copied and scaled onto the screen, just to the right of the software image."
  7566.     Print
  7567.     Print "Doesn't really seem to be very different at all, now does it?"
  7568.     Print
  7569.     Print "Press <ANY KEY> to continue."
  7570.     _Display
  7571.     Sleep
  7572.  
  7573.     Print
  7574.     Color Red
  7575.     Print "BUT WAIT A MOMENT!!  What the heck happened to our hardware tile??!!??"
  7576.     Color White
  7577.     Print
  7578.     Print "It's no longer on the screen, as it was previously.  Why??"
  7579.     Print
  7580.     Print "Because it was never on the software screen at all, but was instead on it's own hardware layer ABOVE the software screen."
  7581.     Print
  7582.     Print "Hardware images only display ONCE, once _DISPLAY is called, and then they flush from the graphics buffer."
  7583.     Print "Draw.  Display.  Flush.  <-- that's the basic process of how a hardware image works."
  7584.     Print
  7585.     Print "If we want one to remain on the screen, we have to do it either by:"
  7586.     Print "1) Not updating the screen after we draw and display the image, as I did above with the tile I displayed."
  7587.     Print "2) Refresh displaying the image in our main loop (which is what we do even with software images for most games and such)."
  7588.     Print
  7589.     Print "Press <ANY KEY> to continue."
  7590.     Sleep
  7591.  
  7592.     Cls
  7593.     Print
  7594.     Print "So, as you can see, hardware images have a few drawbacks to them, with the most obvious being they only display once,"
  7595.     Print "then flush from memory.  If you want persistant hardware images, they're best used in a loop."
  7596.     Print
  7597.     Print "But, if they've got drawbacks, then one has to ask, 'What's the advantages to using them?'"
  7598.     Print "Press <ANY KEY> to find out!"
  7599.     Sleep
  7600.  
  7601.     't# = ExtendedTimer + 3
  7602.     t# = Timer + 3
  7603.     Do
  7604.         count = count + 1
  7605.         _PutImage (0, 100)-Step(100, 100), Software, Display, (x, y)-Step(40, 40)
  7606.         x = x + 40
  7607.         If x > 1024 Then x = 0: y = y + 40
  7608.         If y > 720 Then x = 0: y = 0
  7609.         _Display
  7610.     Loop Until Timer > t#
  7611.  
  7612.     Print "See lots of flashing tiles on the screen for the last three seconds?"
  7613.     Print "That was us using _PUTIMAGE with the software screen, and we put"; count; "tiles on the screen in those 3 seconds."
  7614.     Print
  7615.     Print "Now press <ANY KEY> and we'll do the exact same thing with hardware images."
  7616.     Sleep
  7617.  
  7618.     count = 0: x = 0: y = 0
  7619.     t# = Timer + 3
  7620.     tempScreen = _CopyImage(Display, 33)
  7621.     Do
  7622.         count = count + 1
  7623.         _PutImage , tempScreen
  7624.         _PutImage (300, 100)-Step(100, 100), Hardware, , (x, y)-Step(40, 40)
  7625.         x = x + 40
  7626.         If x > 1024 Then x = 0: y = y + 40
  7627.         If y > 720 Then x = 0: y = 0
  7628.         _Display
  7629.     Loop Until Timer > t#
  7630.  
  7631.     _FreeImage tempScreen
  7632.     Print
  7633.     Print "Didn't seem very different at the rate of which we were running things, now did it?"
  7634.     Print "Would you be surprised to find out that we put"; count * 2; "hardware images on the screen in those same 3 seconds?"
  7635.     Print
  7636.     Print "And if you look close, I counted each loop twice, as we didn't just put the hardware image to the screen, but also a"
  7637.     Print "complete copy of the original software screen as well!"
  7638.     Print
  7639.     Print "The reason why I did this?"
  7640.     Print
  7641.     Print "So I could completely elimimate all software iamges and JUST work with the much faster hardware layer!"
  7642.     Print
  7643.     Print "Press <ANY KEY> to continue"
  7644.     Sleep
  7645.  
  7646.     Cls
  7647.     Print "So, as you can see, hardware images are multiple times faster to display and render than software images."
  7648.     Print
  7649.     Print "But here's something else for you to notice -- I'm going to update the screen with constant, limitless tile refeshes."
  7650.     Print "To start with, I'm going to do this in a LOOP with the software images."
  7651.     Print "CTRL-TAB out of this demo program, open your task manager, and see how much memory and CPU processing power the program uses."
  7652.     Print "Then TAB back to this program and hit <ESC> to do the same with the hardware images."
  7653.  
  7654.     Do
  7655.         _PutImage (0, 100)-(1024, 720), Software, Display, (x, y)-Step(40, 40)
  7656.         x = x + 40
  7657.         If x > 1024 Then x = 0: y = y + 40
  7658.         If y > 720 Then x = 0: y = 0
  7659.         _Limit 60
  7660.         _Display
  7661.     Loop Until _KeyDown(27)
  7662.  
  7663.     Cls , 0
  7664.     Print "PRESS <SPACE BAR> to stop the hardware iamges!!"
  7665.     tempImage = _CopyImage(Display, 33)
  7666.     x = 0: y = 0
  7667.     Do
  7668.         _PutImage , tempImage
  7669.         _PutImage (0, 100)-(1023, 719), Hardware, , (x, y)-Step(40, 40)
  7670.         x = x + 40
  7671.         If x > 1024 Then x = 0: y = y + 40
  7672.         If y > 720 Then x = 0: y = 0
  7673.         _Limit 60
  7674.         _Display
  7675.     Loop Until _KeyDown(32)
  7676.  
  7677.     Cls
  7678.     Print "On my laptop, these two methods use the following amounts of CPU power:"
  7679.     Print "Software, 60 FPS -- 3% CPU"
  7680.     Print "Hardware, 60 FPS -- 0.1% CPU"
  7681.     Print
  7682.     Print "If I go in and change the limits to something much higher, these are the results (test them for yourselves, please):"
  7683.     Print "Software, 600 FPS -- 10.3% CPU"
  7684.     Print "Hardware, 600 FPS -- 0.1% CPU"
  7685.     Print
  7686.     Print
  7687.     Print "So, as you can see, the disadvantage to hardware images are they display once, then flush from memory."
  7688.     Print
  7689.     Print "While the advantages to their usage is MUCH faster processing times, and an immense reduction on CPU usage.  (The GPU picks up the work for us!)"
  7690.     Print
  7691.     Print
  7692.     Print "You basically use them just like you would any other normal image, though you have to keep in mind that they render"
  7693.     Print "to their own hardware layer, which you can specify to go on below or above your software screen."
  7694.     Print
  7695.     Print "(Or, you can _DISPLAYORDER _HARDWARE and *only* display the hardware layer, removing software rendering completely!)"
  7696.     Print
  7697.     Print "And THAT, my friends, is basically the lowdown on hardware vs software images.  ;)"
  7698.     Print
  7699.     Print
  7700.     Print "And this was another Steve(tm) Tutorial!  Enjoy!!"
  7701. End Sub ' HardwareImageDemo2
  7702.  
  7703. ' ################################################################################################################################################################
  7704. ' END HARDWARE IMAGES DEMO #2 (WORKS)
  7705. ' ################################################################################################################################################################
  7706.  
  7707. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7708. ' BEGIN DEBUGGING ROUTINES #DEBUGGING
  7709. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7710.  
  7711. Sub DebugPrint (MyString As String)
  7712.     If m_bDebug = TRUE Then
  7713.         '_Echo MyString
  7714.  
  7715.         ReDim arrLines(-1) As String
  7716.         Dim iLoop As Integer
  7717.         split MyString, Chr$(13), arrLines()
  7718.         For iLoop = LBound(arrLines) To UBound(arrLines)
  7719.             _Echo arrLines(iLoop)
  7720.         Next iLoop
  7721.     End If
  7722. End Sub ' DebugPrint
  7723.  
  7724. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7725. ' END DEBUGGING ROUTINES @DEBUGGING
  7726. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7727.  
  7728. ' ################################################################################################################################################################
  7729. ' BEGIN MENU HELPER ROUTINES
  7730. ' ################################################################################################################################################################
  7731.  
  7732. ' /////////////////////////////////////////////////////////////////////////////
  7733.  
  7734. Sub ShowInstructions (in$)
  7735.     Dim iLoop As Integer
  7736.     Dim iCount As Integer: iCount = 0
  7737.     Dim iRows As Integer: iRows = _Height(0) '\ _FontHeight ' GET # OF AVAILABLE TEXT ROWS
  7738.     ReDim arrLines(-1) As String
  7739.     Cls
  7740.     split in$, Chr$(13), arrLines() ' SPLIT OUTPUT INTO LINES
  7741.     For iLoop = LBound(arrLines) To UBound(arrLines)
  7742.         Print arrLines(iLoop)
  7743.         iCount = iCount + 1
  7744.         If iCount > (iRows - 5) Then
  7745.             'INPUT "PRESS <ENTER> TO CONTINUE"; in$
  7746.             Sleep
  7747.             iCount = 0
  7748.         End If
  7749.     Next iLoop
  7750.     Print
  7751.     Input "PRESS <ENTER> TO CONTINUE"; in$
  7752. End Sub ' ShowInstructions
  7753.  
  7754. ' ################################################################################################################################################################
  7755. ' END MENU HELPER ROUTINES
  7756. ' ################################################################################################################################################################
  7757.  
  7758.  
  7759. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7760. ' #REFERENCE
  7761.  
  7762. ' =============================================================================
  7763. ' SOME USEFUL STUFF FOR REFERENCE:
  7764.  
  7765. ' Type Name               Type suffix symbol   Minimum value                  Maximum value                Size in Bytes
  7766. ' ---------------------   ------------------   ----------------------------   --------------------------   -------------
  7767. ' _BIT                    `                    -1                             0                            1/8
  7768. ' _BIT * n                `n                   -128                           127                          n/8
  7769. ' _UNSIGNED _BIT          ~`                   0                              1                            1/8
  7770. ' _BYTE                   %%                   -128                           127                          1
  7771. ' _UNSIGNED _BYTE         ~%%                  0                              255                          1
  7772. ' INTEGER                 %                    -32,768                        32,767                       2
  7773. ' _UNSIGNED INTEGER       ~%                   0                              65,535                       2
  7774. ' LONG                    &                    -2,147,483,648                 2,147,483,647                4
  7775. ' _UNSIGNED LONG          ~&                   0                              4,294,967,295                4
  7776. ' _INTEGER64              &&                   -9,223,372,036,854,775,808     9,223,372,036,854,775,807    8
  7777. ' _UNSIGNED _INTEGER64    ~&&                  0                              18,446,744,073,709,551,615   8
  7778. ' SINGLE                  ! or none            -2.802597E-45                  +3.402823E+38                4
  7779. ' DOUBLE                  #                    -4.490656458412465E-324        +1.797693134862310E+308      8
  7780. ' _FLOAT                  ##                   -1.18E-4932                    +1.18E+4932                  32(10 used)
  7781. ' _OFFSET                 %&                   -9,223,372,036,854,775,808     9,223,372,036,854,775,807    Use LEN
  7782. ' _UNSIGNED _OFFSET       ~%&                  0                              18,446,744,073,709,551,615   Use LEN
  7783. ' _MEM                    none                 combined memory variable type  N/A                          Use LEN
  7784.  
  7785. ' div: int1% = num1% \ den1%
  7786. ' mod: rem1% = num1% MOD den1%
  7787.  
  7788. ' @REFERENCE
  7789. ' ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7790.  
« Last Edit: March 21, 2022, 05:29:17 pm by madscijr »