home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: DFÜ und Kommunikation / SOS-DFUE.ISO / programm / best_66 / topdrw10 / manythng.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-02-18  |  81.9 KB  |  2,525 lines

  1. VERSION 2.00
  2. Begin Form ManyThings 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   0  'None
  5.    ClientHeight    =   4605
  6.    ClientLeft      =   900
  7.    ClientTop       =   1605
  8.    ClientWidth     =   5805
  9.    ControlBox      =   0   'False
  10.    Height          =   5010
  11.    Icon            =   MANYTHNG.FRX:0000
  12.    Left            =   840
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   307
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   387
  17.    Top             =   1260
  18.    Width           =   5925
  19.    Begin Timer Tick 
  20.       Enabled         =   0   'False
  21.       Interval        =   50
  22.       Left            =   10
  23.       Top             =   10
  24.    End
  25. ' BackGround -- this form expands to fill the whole
  26. '   screen and is used as the back drop for all the
  27. '   drawing
  28. Option Explicit
  29. ' variables declared here
  30. Dim MouseX, MouseY ' Last position of the mouse moves
  31. Dim LastX As Integer, LastY As Integer
  32. Dim conv2x As Single, conv2y As Single
  33. Dim LastTime As Long
  34. Dim CurrentTime As Long
  35. Dim LinkTime As Long
  36. Dim PlotType As Integer
  37. Dim PlotInit As Integer
  38. Dim PlotEnd As Integer
  39. Dim RepeatIndex As Integer
  40. Dim Pointer As Integer
  41. Dim Mirror As Integer
  42. Dim RunMode As Integer
  43. Dim x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer
  44. Dim vx1 As Single, vy1 As Single, vx2 As Single, vy2 As Single
  45. Dim ax1 As Single, ax2 As Single, ay1 As Single, ay2 As Single
  46. Dim l As Long
  47. Dim m As Long
  48. Dim MaxSpeedX As Integer, MaxSpeedY As Integer
  49. Dim TimeInterval As Long
  50. Dim MaxTime As Long
  51. Dim Repeats As Integer
  52. Dim i As Integer
  53. Dim BoxHeight As Integer, Boxwidth As Integer
  54. Dim DC As Integer
  55. Dim Pattern As Long, Locked As Integer
  56. Dim Direction As Integer
  57. Dim Number As Integer
  58. Dim PicWidth As Integer, PicHeight As Integer
  59. Dim PlotPriority As Integer
  60. Dim Priority As Single
  61. Dim TotalPriority As Single
  62. Dim PriorityBreakPoints() As Single
  63. Const MinColor = 20000
  64. 'Allocate Memory
  65. Dim x1a() As Integer
  66. Dim x2a() As Integer
  67. Dim y1a() As Integer
  68. Dim y2a() As Integer
  69. Dim x1da() As Integer
  70. Dim x2da() As Integer
  71. Dim y1da() As Integer
  72. Dim y2da() As Integer
  73. Dim x1sa() As Single
  74. Dim x2sa() As Single
  75. Dim y1sa() As Single
  76. Dim y2sa() As Single
  77. Dim vx1sa() As Single
  78. Dim vx2sa() As Single
  79. Dim vy1sa() As Single
  80. Dim vy2sa() As Single
  81. Dim ax1sa() As Single
  82. Dim ax2sa() As Single
  83. Dim ay1sa() As Single
  84. Dim ay2sa() As Single
  85. Dim Colors() As Long
  86. Dim DataPts() As Integer
  87. 'for filled polygons
  88. Dim Points() As POINTAPI
  89. Dim MaxPlotType As Integer
  90. Function CheckIfValidMode (SaverMode As Integer) As Integer
  91.   'when in low memory mode the saver only runs the modules
  92.   'that draw on the screen, not those that manipulate
  93.   'bitmaps
  94.   If LowMemoryFlag = 0 Then 'if not low memory mode then done
  95.     CheckIfValidMode = 1
  96.   Else
  97.     If SaverMode <> 0 Then
  98.       NextSelection
  99.       CheckIfValidMode = 0
  100.       LogFile ("Saver not valid in low memory: " + Str$(PlotType))
  101.     Else
  102.       CheckIfValidMode = 1
  103.     End If
  104.   End If
  105. End Function
  106. Sub Circles ()
  107.   ' have a single elipse trace across the
  108.   ' screen with multiple previous copies following
  109.   ' it
  110.   Dim i As Integer, j As Integer, k As Integer, n As Integer
  111.   Dim il As Long, jl As Long, kl As Long
  112.   Dim xRadius As Integer, yRadius As Integer
  113.   Dim HighMirror As Integer
  114.   ' if first time then initialize
  115.   If PlotInit = False Then
  116.     'see if we need to reset changes made from previous init
  117.     If PlotEnd = False Then
  118.       'see if we just want the priority for this saver
  119.       If PlotPriority = True Then
  120.     '1 is normal priority, adjust up to show more often, or down ...
  121.     Priority = 1#
  122.     Exit Sub
  123.       End If
  124.     'check if runing low memory mode
  125.     If CheckIfValidMode(0) = 0 Then
  126.       Exit Sub
  127.     End If
  128.     PlotInit = True
  129.     Cls
  130.     ForeColor = QBColor(15)
  131.     'Set array size and clear the elements
  132.     ReDim x1a(MaxLines) As Integer
  133.     ReDim x2a(MaxLines) As Integer
  134.     ReDim y1a(MaxLines) As Integer
  135.     ReDim y2a(MaxLines) As Integer
  136.     Pointer = 1     ' start with array element 1
  137.     ' set index to count number of times to repeat color
  138.     '   to past maxvalue so that it will be recalculated
  139.     RepeatIndex = MaxLines + 1
  140.     'determine initial position of line
  141.     x1 = Rnd * ScaleWidth
  142.     x2 = Rnd * ScaleWidth
  143.     y1 = Rnd * ScaleHeight
  144.     y2 = Rnd * ScaleHeight
  145.     'set initial velocity
  146.     vx1 = 0
  147.     vx2 = 0
  148.     vy1 = 0
  149.     vy2 = 0
  150.     'set initial acceleration
  151.     ax1 = 0
  152.     ax2 = 0
  153.     ay1 = 0
  154.     ay2 = 0
  155.     'find background color
  156.     m = QBColor(0)
  157.     'Calculate velocity limits
  158.     MaxSpeedX = ScaleWidth * 15! / 800
  159.     MaxSpeedY = ScaleWidth * 15! / 600
  160.     'select mirroring method
  161.     HighMirror = 5
  162.     Mirror = Rnd * HighMirror + 1: If Mirror > HighMirror Then Mirror = 1
  163.   Else 'reset changes done by previous init
  164.     'zero array sizes
  165.     ReDim x1a(0) As Integer
  166.     ReDim x2a(0) As Integer
  167.     ReDim y1a(0) As Integer
  168.     ReDim y2a(0) As Integer
  169.   End If
  170.   Else  ' put run code here
  171.     Tick.Enabled = False' disable timer until circles completed
  172.     ' check if time to get a new color
  173.     If RepeatIndex > RepeatCount Then
  174.     ' use rgb function
  175.       il = Rnd * 255: If il > 255 Then il = 255
  176.       jl = Rnd * 255: If jl > 255 Then jl = 255
  177.       kl = Rnd * 255: If kl > 255 Then kl = 255
  178.     Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  179.     l = RGB(il, jl, kl)
  180.     RepeatIndex = 1
  181.     Else
  182.     RepeatIndex = RepeatIndex + 1
  183.     End If
  184.     'Delete original circle
  185.     xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  186.     yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  187.     If xRadius <> 0 Then
  188.         Circle ((x1a(Pointer) + x2a(Pointer)) / 2, (y1a(Pointer) + y2a(Pointer)) / 2), xRadius, m, , , yRadius / xRadius
  189.     End If
  190.     DoEvents
  191.     Select Case Mirror
  192.     Case 1: 'mirror on x and y axis
  193.         
  194.         'Delete original circle mirrored on Y axis
  195.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  196.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  197.         If xRadius <> 0 Then
  198.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (y1a(Pointer) + y2a(Pointer)) / 2), xRadius, m, , , yRadius / xRadius
  199.         End If
  200.         DoEvents
  201.         'Delete original circle mirrored on X axis
  202.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  203.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  204.         If xRadius <> 0 Then
  205.         Circle ((x1a(Pointer) + x2a(Pointer)) / 2, (ScaleHeight - y1a(Pointer) + ScaleHeight - y2a(Pointer)) / 2), xRadius, m, , , yRadius / xRadius
  206.         End If
  207.         DoEvents
  208.         'Delete original circle mirrored on origin
  209.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  210.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  211.         If xRadius <> 0 Then
  212.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (ScaleHeight - y1a(Pointer) + ScaleHeight - y2a(Pointer)) / 2), xRadius, m, , , yRadius / xRadius
  213.         End If
  214.         DoEvents
  215.     Case 2: 'mirror on Y axis
  216.         
  217.         'Delete original circle mirrored on Y axis
  218.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  219.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  220.         If xRadius <> 0 Then
  221.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (y1a(Pointer) + y2a(Pointer)) / 2), xRadius, m, , , yRadius / xRadius
  222.         End If
  223.         DoEvents
  224.     Case 3: 'mirror around center point
  225.         'Delete original circle mirrored on origin
  226.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  227.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  228.         If xRadius <> 0 Then
  229.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (ScaleHeight - y1a(Pointer) + ScaleHeight - y2a(Pointer)) / 2), xRadius, m, , , yRadius / xRadius
  230.         End If
  231.         DoEvents
  232.     Case Else: ' otherwise ignore (i.e. no mirror)
  233.     End Select
  234.     'Save New Circle
  235.     x1a(Pointer) = x1
  236.     x2a(Pointer) = x2
  237.     y1a(Pointer) = y1
  238.     y2a(Pointer) = y2
  239.     Select Case Mirror
  240.     Case 1: 'mirror on x and y axis
  241.         
  242.         'Delete original circle mirrored on Y axis
  243.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  244.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  245.         If xRadius <> 0 Then
  246.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (y1a(Pointer) + y2a(Pointer)) / 2), xRadius, l, , , yRadius / xRadius
  247.         End If
  248.         DoEvents
  249.         'Delete original circle mirrored on X axis
  250.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  251.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  252.         If xRadius <> 0 Then
  253.         Circle ((x1a(Pointer) + x2a(Pointer)) / 2, (ScaleHeight - y1a(Pointer) + ScaleHeight - y2a(Pointer)) / 2), xRadius, l, , , yRadius / xRadius
  254.         End If
  255.         DoEvents
  256.         'Delete original circle mirrored on origin
  257.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  258.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  259.         If xRadius <> 0 Then
  260.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (ScaleHeight - y1a(Pointer) + ScaleHeight - y2a(Pointer)) / 2), xRadius, l, , , yRadius / xRadius
  261.         End If
  262.     Case 2: 'mirror on Y axis
  263.         
  264.         'Delete original circle mirrored on y axis
  265.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  266.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  267.         If xRadius <> 0 Then
  268.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (y1a(Pointer) + y2a(Pointer)) / 2), xRadius, l, , , yRadius / xRadius
  269.         End If
  270.     Case 3: 'mirror around center point
  271.         'Delete original circle mirrored on origin
  272.         xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  273.         yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  274.         If xRadius <> 0 Then
  275.         Circle ((ScaleWidth - x1a(Pointer) + ScaleWidth - x2a(Pointer)) / 2, (ScaleHeight - y1a(Pointer) + ScaleHeight - y2a(Pointer)) / 2), xRadius, l, , , yRadius / xRadius
  276.         End If
  277.     Case Else: ' otherwise ignore (i.e. no mirror)
  278.     End Select
  279.     DoEvents
  280.     Tick.Enabled = True' re-enable timer
  281.     'Draw new Circle
  282.     xRadius = Abs(x1a(Pointer) - x2a(Pointer)) / 2
  283.     yRadius = Abs(y1a(Pointer) - y2a(Pointer)) / 2
  284.     If xRadius <> 0 Then
  285.         Circle ((x1a(Pointer) + x2a(Pointer)) / 2, (y1a(Pointer) + y2a(Pointer)) / 2), xRadius, l, , , yRadius / xRadius
  286.     End If
  287.     'Move pointer to next item
  288.     Pointer = Pointer + 1
  289.     If Pointer > MaxLines Then
  290.         Pointer = 1
  291.     End If
  292.     'determine new acceleration
  293.     ax1 = Rnd - .5
  294.     ax2 = Rnd - .5
  295.     ay1 = Rnd - .5
  296.     ay2 = Rnd - .5
  297.     'calculate new position
  298.     x1 = x1 + vx1
  299.     x2 = x2 + vx2
  300.     y1 = y1 + vy1
  301.     y2 = y2 + vy2
  302.     'calculate new velocity
  303.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  304.     vx2 = (vx2 + ax2): If Abs(vx2) > MaxSpeedX Then vx2 = 0: ax2 = 0
  305.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  306.     vy2 = (vy2 + ay2): If Abs(vy2) > MaxSpeedY Then vy2 = 0: ay2 = 0
  307.     'check if off screen
  308.     If (x1 > ScaleWidth) Then
  309.         'change direction
  310.         vx1 = -Abs(vx1)
  311.     ElseIf (x1 < 0) Then
  312.         'change direction
  313.         vx1 = Abs(vx1)
  314.     End If
  315.     If (y1 > ScaleHeight) Then
  316.         'change direction
  317.         vy1 = -Abs(vy1)
  318.     ElseIf (y1 < 0) Then
  319.         'change direction
  320.         vy1 = Abs(vy1)
  321.     End If
  322.     If (x2 > ScaleWidth) Then
  323.         'change direction
  324.         vx2 = -Abs(vx2)
  325.     ElseIf (x2 < 0) Then
  326.         'change direction
  327.         vx2 = Abs(vx2)
  328.     End If
  329.     If (y2 > ScaleHeight) Then
  330.         'change direction
  331.         vy2 = -Abs(vy2)
  332.     ElseIf (y2 < 0) Then
  333.         'change direction
  334.         vy2 = Abs(vy2)
  335.     End If
  336.   End If
  337. End Sub
  338. Sub Dribble ()
  339.   'dribbling paint on screen
  340.   Dim i As Integer, j As Integer, k As Integer
  341.   Static MaxHole As Integer
  342.   ' if first time then initialize
  343.   If PlotInit = False Then
  344.     'see if we need to reset changes made from previous init
  345.     If PlotEnd = False Then
  346.       'see if we just want the priority for this saver
  347.       If PlotPriority = True Then
  348.     '1 is normal priority, adjust up to show more often, or down ...
  349.     Priority = 1#
  350.     Exit Sub
  351.       End If
  352.     'check if runing low memory mode
  353.     If CheckIfValidMode(1) = 0 Then
  354.       Exit Sub
  355.     End If
  356.     ' start with original screen
  357.     Picture = Original.Image
  358.     PlotInit = True
  359.     'determine initial position of shot
  360.     x1 = Rnd * ScaleWidth
  361.     y1 = Rnd * ScaleHeight
  362.     'Calculate velocity limits
  363.     MaxSpeedX = ScaleWidth * 20! / 800
  364.     MaxSpeedY = ScaleWidth * 20! / 600
  365.     ' zero initial velocity
  366.     vx1 = 0: vy1 = 0
  367.     'set maximum size of holes
  368.     MaxHole = 4
  369.     ForeColor = RGB(0, 0, 0)' use black box
  370.     FillColor = RGB(0, 0, 0) 'set black fill
  371.     FillStyle = 0 'solid fill
  372.     RunMode = Int(Rnd * 2#)'choose black or color
  373.     'Debug.Print RunMode
  374.     If RunMode > 0 Then ' if random color then use larger spots
  375.     MaxHole = 8
  376.     i = Rnd * 255: If i > 255 Then i = 255
  377.     j = Rnd * 255: If j > 255 Then j = 255
  378.     k = Rnd * 255: If k > 255 Then k = 255
  379.     ForeColor = GetNearestColor(hDC, RGB(i, j, k))
  380.     FillColor = ForeColor
  381.     End If
  382.   Else 'reset changes done by previous init
  383.     Picture = LoadPicture() ' clear screen
  384.     FillStyle = 1 'transparent fill
  385.   End If
  386.   Else  ' put run code here
  387.     If RunMode > 0 Then ' see if need to change to random color
  388.         If Rnd < .05 Then
  389.         i = Rnd * 255: If i > 255 Then i = 255
  390.         j = Rnd * 255: If j > 255 Then j = 255
  391.         k = Rnd * 255: If k > 255 Then k = 255
  392.         ForeColor = GetNearestColor(hDC, RGB(i, j, k))
  393.         FillColor = ForeColor
  394.         End If
  395.     End If
  396.     ' put random hole here
  397.     Circle (x1 + Rnd * 20, y1 + Rnd * 20), MaxHole * Rnd + 2, , , , 1
  398.     'determine new acceleration
  399.     ax1 = 2 * Rnd - 1
  400.     ay1 = 2 * Rnd - 1
  401.         
  402.     'calculate new position
  403.     x1 = x1 + vx1
  404.     y1 = y1 + vy1
  405.         
  406.     'calculate new velocity
  407.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = -vx1 * .9: vy1 = -vy1 * .9: ax1 = 0
  408.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vx1 = -vx1 * .9: vy1 = -vy1 * .9: ay1 = 0
  409.         
  410.     'check if off screen
  411.     If (x1 > ScaleWidth) Then
  412.         'change direction
  413.         vx1 = -Abs(vx1)
  414.     ElseIf (x1 < 0) Then
  415.         'change direction
  416.         vx1 = Abs(vx1)
  417.     End If
  418.     If (y1 > ScaleHeight) Then
  419.         'change direction
  420.         vy1 = -Abs(vy1)
  421.     ElseIf (y1 < 0) Then
  422.         'change direction
  423.         vy1 = Abs(vy1)
  424.     End If
  425.   End If
  426. End Sub
  427. Sub Drop ()
  428.   ' bitblt's with various patterns, dragging them
  429.   ' across the screen randomly
  430.   Dim j As Integer
  431.   Static OldY As Integer
  432.   ' if first time then initialize
  433.   If PlotInit = False Then
  434.     'see if we need to reset changes made from previous init
  435.     If PlotEnd = False Then
  436.       'see if we just want the priority for this saver
  437.       If PlotPriority = True Then
  438.     '1 is normal priority, adjust up to show more often, or down ...
  439.     Priority = 1#
  440.     Exit Sub
  441.       End If
  442.     'check if runing low memory mode
  443.     If CheckIfValidMode(1) = 0 Then
  444.       Exit Sub
  445.     End If
  446.     'store whether column has dropped
  447.     ReDim x1a(ScaleWidth)
  448.     ' start with original screen
  449.     Picture = Original.Image
  450.     PlotInit = True
  451.     'flag that no column has been chosen
  452.     x1 = -1
  453.     'Calculate velocity limits
  454.     MaxSpeedY = ScaleWidth * 10! / 600
  455.     MaxSpeedX = ScaleWidth * 10! / 800
  456.     ' zero initial velocity
  457.     vy1 = 0
  458.     'width of column to drop
  459.     Boxwidth = 10 + Rnd * 100
  460.     i = Int(Rnd * 2#)'if i=0 then do jagged drop
  461.     x2 = 0 'used for width change
  462.   Else 'reset changes done by previous init
  463.     'store whether column has dropped
  464.     ReDim x1a(0)
  465.     Picture = LoadPicture() ' clear screen
  466.   End If
  467. Else  ' put run code here
  468.     If x1 < 0 Then 'see if found valid column
  469.     x1 = Rnd * ScaleWidth / Boxwidth 'choose a column
  470.     If x1a(x1) = 0 Then 'check if not yet dropped
  471.     y1 = 0 'start position
  472.     x1a(x1) = 1 'flag that column has already been used
  473.     x2 = 0: vx2 = 0: OldY = 0' initialize variables
  474.     Else
  475.     x1 = -1 'flag that no column chosen
  476.     End If
  477.     Else 'if column already found, then drop it
  478.     If i = 0 Then 'check if jagged drop
  479.     'make sure effective width does not get too small
  480.     If x2 >= Boxwidth - 5 Then
  481.     x2 = Boxwidth - 5
  482.     vx2 = -vx2 'reverse direction
  483.     End If
  484.     j = x2 / 2 'get half of change
  485.     'shift column
  486.     DC = Original.hDC
  487.     BitBlt hDC, x1 * Boxwidth + j, y1, Boxwidth - x2, ScaleHeight - y1, DC, x1 * Boxwidth + j, 0, &HCC0020'source copy
  488.     'blank top of column
  489.     BitBlt hDC, x1 * Boxwidth + j, OldY, Boxwidth - x2, y1 - OldY + 1, DC, x1 * Boxwidth + j, 0, &H42'blackout
  490.     Else ' not jagged drop
  491.     'shift column
  492.     DC = Original.hDC
  493.     BitBlt hDC, x1 * Boxwidth, y1, Boxwidth, ScaleHeight - y1, DC, x1 * Boxwidth, 0, &HCC0020  'source copy
  494.     'blank top of column
  495.     BitBlt hDC, x1 * Boxwidth, OldY, Boxwidth, y1 - OldY + 1, DC, x1 * Boxwidth, 0, &H42'blackout
  496.     End If
  497.     'save current position
  498.     OldY = y1
  499.     'check if off screen
  500.     If (y1 > ScaleHeight) Then
  501.     x1 = -1 'flag done
  502.     vy1 = 0'zero velocity again
  503.     End If
  504.     'determine new acceleration
  505.     ay1 = Rnd * .25
  506.     ax2 = Rnd * .25 - .125
  507.     'calculate new positions
  508.     y1 = y1 + vy1
  509.     x2 = x2 + vx2
  510.     'calculate new velocity
  511.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = vy1 / 2: ay1 = 0
  512.     vx2 = (vx2 + ax2): If Abs(vx2) > MaxSpeedX Then vx2 = vx2 / 2: ax2 = 0
  513.     End If
  514.   End If
  515. End Sub
  516. Sub FilledCircles ()
  517.   ' have a single filled elipse trace across the screen
  518.   Dim i As Integer, j As Integer, k As Integer, n As Integer
  519.   Dim xRadius As Integer, yRadius As Integer
  520.   ' if first time then initialize
  521.   If PlotInit = False Then
  522.     'see if we need to reset changes made from previous init
  523.     If PlotEnd = False Then
  524.       'see if we just want the priority for this saver
  525.       If PlotPriority = True Then
  526.     '1 is normal priority, adjust up to show more often, or down ...
  527.     Priority = 1#
  528.     Exit Sub
  529.       End If
  530.     'check if runing low memory mode
  531.     If CheckIfValidMode(0) = 0 Then
  532.       Exit Sub
  533.     End If
  534.     PlotInit = True
  535.     Cls
  536.     ForeColor = QBColor(15)
  537.     FillColor = ForeColor
  538.     BackColor = QBColor(0)
  539.     FillStyle = 0' use solid fill
  540.     ' set index to count number of times to repeat color
  541.     '   to past maxvalue so that it will be recalculated
  542.     RepeatIndex = MaxLines + 1
  543.     'determine initial position of line
  544.     x1 = Rnd * ScaleWidth
  545.     x2 = Rnd * ScaleWidth
  546.     y1 = Rnd * ScaleHeight
  547.     y2 = Rnd * ScaleHeight
  548.     'set initial velocity
  549.     vx1 = 0
  550.     vx2 = 0
  551.     vy1 = 0
  552.     vy2 = 0
  553.     'set initial acceleration
  554.     ax1 = 0
  555.     ax2 = 0
  556.     ay1 = 0
  557.     ay2 = 0
  558.     'find background color
  559.     'Calculate velocity limits
  560.     MaxSpeedX = ScaleWidth * 15! / 800
  561.     MaxSpeedY = ScaleWidth * 15! / 600
  562.   Else 'reset changes done by previous init
  563.     FillStyle = 1 'transparent fill
  564.   End If
  565.   Else  ' put run code here
  566.     ' check if time to get a new color
  567.     If RepeatIndex > RepeatCount Then
  568.     ' get random fore ground color
  569.     i = Rnd * 255: If i > 255 Then i = 255
  570.     j = Rnd * 255: If j > 255 Then j = 255
  571.     k = Rnd * 255: If k > 255 Then k = 255
  572.     ForeColor = RGB(i, j, k)
  573.     ' get random fill color
  574.     i = Rnd * 255: If i > 255 Then i = 255
  575.     j = Rnd * 255: If j > 255 Then j = 255
  576.     k = Rnd * 255: If k > 255 Then k = 255
  577.     FillColor = GetNearestColor(hDC, RGB(i, j, k))
  578.     RepeatIndex = 1
  579.     Else
  580.     RepeatIndex = RepeatIndex + 1
  581.     End If
  582.     'Draw new Circle
  583.     xRadius = Abs(x1 - x2) / 2
  584.     yRadius = Abs(y1 - y2) / 2
  585.     If xRadius <> 0 Then
  586.         Circle ((x1 + x2) / 2, (y1 + y2) / 2), xRadius, , , , yRadius / xRadius
  587.     End If
  588.     'Move pointer to next item
  589.     Pointer = Pointer + 1
  590.     If Pointer > MaxLines Then
  591.         Pointer = 1
  592.     End If
  593.     'determine new acceleration
  594.     ax1 = Rnd - .5
  595.     ax2 = Rnd - .5
  596.     ay1 = Rnd - .5
  597.     ay2 = Rnd - .5
  598.     'calculate new position
  599.     x1 = x1 + vx1
  600.     x2 = x2 + vx2
  601.     y1 = y1 + vy1
  602.     y2 = y2 + vy2
  603.     'calculate new velocity
  604.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  605.     vx2 = (vx2 + ax2): If Abs(vx2) > MaxSpeedX Then vx2 = 0: ax2 = 0
  606.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  607.     vy2 = (vy2 + ay2): If Abs(vy2) > MaxSpeedY Then vy2 = 0: ay2 = 0
  608.     'check if off screen
  609.     If (x1 > ScaleWidth) Then
  610.         'change direction
  611.         vx1 = -Abs(vx1)
  612.     ElseIf (x1 < 0) Then
  613.         'change direction
  614.         vx1 = Abs(vx1)
  615.     End If
  616.     If (y1 > ScaleHeight) Then
  617.         'change direction
  618.         vy1 = -Abs(vy1)
  619.     ElseIf (y1 < 0) Then
  620.         'change direction
  621.         vy1 = Abs(vy1)
  622.     End If
  623.     If (x2 > ScaleWidth) Then
  624.         'change direction
  625.         vx2 = -Abs(vx2)
  626.     ElseIf (x2 < 0) Then
  627.         'change direction
  628.         vx2 = Abs(vx2)
  629.     End If
  630.     If (y2 > ScaleHeight) Then
  631.         'change direction
  632.         vy2 = -Abs(vy2)
  633.     ElseIf (y2 < 0) Then
  634.         'change direction
  635.         vy2 = Abs(vy2)
  636.     End If
  637.   End If
  638. End Sub
  639. Sub FilledPolygons ()
  640.   ' draw a randomly moving polygon on the screen
  641.   ' slightly offset from previous polygon
  642.   Dim i As Integer, j As Integer, k As Integer, ii As Integer, n As Integer
  643.   Static Sets As Integer
  644.   ' if first time then initialize
  645.   If PlotInit = False Then
  646.     'see if we need to reset changes made from previous init
  647.     If PlotEnd = False Then
  648.       'see if we just want the priority for this saver
  649.       If PlotPriority = True Then
  650.     '1 is normal priority, adjust up to show more often, or down ...
  651.     Priority = 1#
  652.     Exit Sub
  653.       End If
  654.     'check if runing low memory mode
  655.     If CheckIfValidMode(0) = 0 Then
  656.       Exit Sub
  657.     End If
  658.     PlotInit = True
  659.     ForeColor = RGB(255, 255, 255)
  660.     BackColor = RGB(0, 0, 0)
  661.     FillStyle = 0' use solid fill
  662.     DrawWidth = 1' use narrow line
  663.     j = SetPolyFillMode(hDC, 2)' use winding fill mode
  664.     Cls
  665.     'set number of corners between 3 and 5
  666.     Sets = Rnd * 4 + 3
  667.     'Set array size and clear the elements
  668.     ReDim Points(Sets) As POINTAPI
  669.     ReDim vx1sa(Sets) As Single
  670.     ReDim vy1sa(Sets) As Single
  671.     ReDim ax1sa(Sets) As Single
  672.     ReDim ay1sa(Sets) As Single
  673.     'counter for changing colors, set to overflow
  674.     RepeatIndex = RepeatCount + 1
  675.     For j = 1 To Sets
  676.     'determine initial position of line
  677.     Points(j).x = Rnd * ScaleWidth
  678.     Points(j).y = Rnd * ScaleHeight
  679.     Next j
  680.     'Calculate velocity limits
  681.     MaxSpeedX = ScaleWidth * 15! / 800
  682.     MaxSpeedY = ScaleWidth * 15! / 600
  683.   Else 'reset changes done by previous init
  684.     ReDim Points(0) As POINTAPI
  685.     ReDim vx1sa(0) As Single
  686.     ReDim vy1sa(0) As Single
  687.     ReDim ax1sa(0) As Single
  688.     ReDim ay1sa(0) As Single
  689.     FillStyle = 1 'transparent fill
  690.     j = SetPolyFillMode(hDC, 1)' reset to alternate fill mode
  691.   End If
  692.   Else  ' put run code here
  693.     ' check if time to get a new color
  694.     If RepeatIndex > RepeatCount Then
  695.     'set fill color
  696.     i = Rnd * 255: If i > 255 Then i = 255
  697.     j = Rnd * 255: If j > 255 Then j = 255
  698.     k = Rnd * 255: If k > 255 Then k = 255
  699.     FillColor = GetNearestColor(hDC, RGB(i, j, k))
  700.     'set foreground color
  701.     i = Rnd * 255: If i > 255 Then i = 255
  702.     j = Rnd * 255: If j > 255 Then j = 255
  703.     k = Rnd * 255: If k > 255 Then k = 255
  704.     ForeColor = RGB(i, j, k)
  705.     RepeatIndex = 1
  706.     Else
  707.     RepeatIndex = RepeatIndex + 1
  708.     End If
  709.     'Draw polygon
  710.     j = Polygon(hDC, Points(0), Sets)
  711.     For j = 1 To Sets
  712.         'determine new acceleration
  713.         ax1sa(j) = Rnd - .5
  714.         ay1sa(j) = Rnd - .5
  715.         
  716.         'calculate new position
  717.         Points(j).x = Points(j).x + vx1sa(j)
  718.         Points(j).y = Points(j).y + vy1sa(j)
  719.         'calculate new velocity
  720.         vx1sa(j) = (vx1sa(j) + ax1sa(j)): If Abs(vx1sa(j)) > MaxSpeedX Then vx1sa(j) = 0: ax1sa(j) = 0
  721.         vy1sa(j) = (vy1sa(j) + ay1sa(j)): If Abs(vy1sa(j)) > MaxSpeedY Then vy1sa(j) = 0: ay1sa(j) = 0
  722.         'check if off screen
  723.         If (Points(j).x > ScaleWidth) Then
  724.         'change direction
  725.         vx1sa(j) = -Abs(vx1sa(j))
  726.         ElseIf (Points(j).x < 0) Then
  727.         'change direction
  728.         vx1sa(j) = Abs(vx1sa(j))
  729.         End If
  730.         If (Points(j).y > ScaleHeight) Then
  731.         'change direction
  732.         vy1sa(j) = -Abs(vy1sa(j))
  733.         ElseIf (Points(j).y < 0) Then
  734.         'change direction
  735.         vy1sa(j) = Abs(vy1sa(j))
  736.         End If
  737.     Next j
  738.     End If
  739. End Sub
  740. Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
  741.     LogFile ("KeyPress, Terminating")
  742.     EndScrnsave                 ' End screen blanking
  743. End Sub
  744. Sub Form_Load ()
  745.     ' stretch to full screen
  746.     Move 0, 0, Screen.Width, Screen.Height
  747.     'set system modal
  748.     If TestMode = 0 Then
  749.       i = SetSysModalWindow(hWND)
  750.     End If
  751.     'make mouse invisible
  752.     If TestMode = 0 Then
  753.       HideMouse
  754.     End If
  755.     'tell windows to disable screen savers
  756.     i = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, False, 0, 0)
  757.     DrawWidth = 1
  758.     Randomize
  759.     ' Initialize variables now
  760.     MaxPlotType = 18
  761.     ReadPriorities ' call each Plot type to get its priority
  762.     'set plot type
  763.     If StartSaver = 0 Then
  764.       PlotType = MaxPlotType * Rnd
  765.     Else
  766.       PlotType = StartSaver
  767.     End If
  768.     If PlotType > MaxPlotType Then PlotType = 1
  769.     LogFile ("First Saver is " + Str$(PlotType))
  770.     PlotPriority = False
  771.     PlotInit = False
  772.     PlotEnd = False
  773.     TimeInterval = 0
  774.     MaxTime = MaxChangeMinutes * 60 + Timer ' calculate time in seconds
  775.     'set tick rate
  776.     Tick.Interval = 50
  777.     Repeats = 1 ' number of drawings to make before returning
  778.     Tick.Enabled = True
  779. End Sub
  780. Sub Form_MouseMove (Button As Integer, Shift As Integer, x As Single, y As Single)
  781.     If IsEmpty(MouseX) Or IsEmpty(MouseY) Then
  782.     MouseX = x
  783.     MouseY = y
  784.     LogFile ("First Mouse Movement (" + Str$(x) + "," + Str$(y) + ")")
  785.     End If
  786.     '
  787.     ' Only unblank the screen if the mouse moves quickly
  788.     ' enough (more than 2 pixels at one time.
  789.     '
  790.     If Abs(MouseX - x) > 2 Or Abs(MouseY - y) > 2 Then
  791.        LogFile ("Mouse Movement (" + Str$(x) + "," + Str$(y) + "), Terminating")
  792.        LogFile ("Old Pos (" + Str$(MouseX) + "," + Str$(MouseY) + "), Terminating")
  793.        EndScrnsave             ' End screen blanking
  794.     End If
  795.     LogFile ("Mouse Movement (" + Str$(x) + "," + Str$(y) + "), Continuing")
  796.     MouseX = x                   ' Remember last position
  797.     MouseY = y
  798. End Sub
  799. Sub Form_Paint ()
  800.     ' stretch to full screen
  801.     Move 0, 0, Screen.Width, Screen.Height
  802. End Sub
  803. Function GetSize (FileName$) As Integer
  804.     Dim InLine$
  805.     Dim Loaded As Integer
  806.     Open FileName$ For Binary As #1
  807.     '*****************************************************
  808.     'read header
  809.     InLine$ = Input$(26, 1)
  810.     If Asc(Mid$(InLine$, 1, 1)) <> &H42 Then GoTo errorexit
  811.     If Asc(Mid$(InLine$, 2, 1)) <> &H4D Then GoTo errorexit
  812.     PicWidth = Asc(Mid$(InLine$, 19, 1)) + Asc(Mid$(InLine$, 20, 1)) * 256
  813.     PicHeight = Asc(Mid$(InLine$, 23, 1)) + Asc(Mid$(InLine$, 24, 1)) * 256
  814.     'Debug.Print SWidth, SHeight
  815.     Close #1
  816.     Loaded = 1 'flag good read
  817.     GoTo regexit
  818. errorexit: Loaded = 0
  819. regexit: ' no error exit
  820.     GetSize = Loaded'return read state
  821. End Function
  822. Sub Kalied ()
  823.   ' have a line and its mirror images trace across the
  824.   ' screen with multiple previous copies following
  825.   ' it
  826.   Dim i As Integer, j As Integer, k As Integer, n As Integer
  827.   Dim il As Long, jl As Long, kl As Long
  828.   Dim xRadius As Integer, yRadius As Integer
  829.   Dim HighMirror As Integer
  830.   Dim xx1 As Integer, yy1 As Integer, xx2 As Integer, yy2 As Integer
  831.   Dim xm1 As Integer, ym1 As Integer, xm2 As Integer, ym2 As Integer
  832.   ' if first time then initialize
  833.   If PlotInit = False Then
  834.     'see if we need to reset changes made from previous init
  835.     If PlotEnd = False Then
  836.       'see if we just want the priority for this saver
  837.       If PlotPriority = True Then
  838.     '1 is normal priority, adjust up to show more often, or down ...
  839.     Priority = 1#
  840.     Exit Sub
  841.       End If
  842.     'check if runing low memory mode
  843.     If CheckIfValidMode(0) = 0 Then
  844.       Exit Sub
  845.     End If
  846.     PlotInit = True
  847.     Cls
  848.     ForeColor = QBColor(15)
  849.     'select mirroring method
  850.     HighMirror = 4
  851.     Mirror = Rnd * HighMirror + 1: If Mirror > HighMirror Then Mirror = 1
  852.     'Set array size and clear the elements
  853.     ReDim x1a(MaxLines) As Integer
  854.     ReDim x2a(MaxLines) As Integer
  855.     ReDim y1a(MaxLines) As Integer
  856.     ReDim y2a(MaxLines) As Integer
  857.     Pointer = 1     ' start with array element 1
  858.     ' set index to count number of times to repeat color
  859.     '   to past maxvalue so that it will be recalculated
  860.     RepeatIndex = MaxLines + 1
  861.     'determine initial position of line
  862.     x1 = Rnd * ScaleWidth
  863.     x2 = Rnd * ScaleWidth
  864.     y1 = Rnd * ScaleHeight
  865.     y2 = Rnd * ScaleHeight
  866.     'set initial velocity
  867.     vx1 = 0
  868.     vx2 = 0
  869.     vy1 = 0
  870.     vy2 = 0
  871.     'set initial acceleration
  872.     ax1 = 0
  873.     ax2 = 0
  874.     ay1 = 0
  875.     ay2 = 0
  876.     'find background color
  877.     m = QBColor(0)
  878.     'Calculate velocity limits
  879.     MaxSpeedX = ScaleWidth * 15! / 800
  880.     MaxSpeedY = ScaleWidth * 15! / 600
  881.     'get conversion factors
  882.     conv2x = 1# * ScaleWidth / ScaleHeight
  883.     conv2y = 1# / conv2x
  884.     'set tick rate
  885.     Tick.Interval = 50
  886.   Else 'reset changes done by previous init
  887.     'reset tick rate
  888.     Tick.Interval = 50
  889.     'zero array sizes
  890.     ReDim x1a(0) As Integer
  891.     ReDim x2a(0) As Integer
  892.     ReDim y1a(0) As Integer
  893.     ReDim y2a(0) As Integer
  894.   End If
  895.   Else  ' put run code here
  896.     ' check if time to get a new color
  897.     If RepeatIndex > RepeatCount Then
  898.     ' use rgb function
  899.       il = Rnd * 255: If il > 255 Then il = 255
  900.       jl = Rnd * 255: If jl > 255 Then jl = 255
  901.       kl = Rnd * 255: If kl > 255 Then kl = 255
  902.     Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  903.     l = RGB(il, jl, kl)
  904.     RepeatIndex = 1
  905.     Else
  906.     RepeatIndex = RepeatIndex + 1
  907.     End If
  908.     'Delete original Lines
  909.     xx1 = x1a(Pointer): yy1 = y1a(Pointer)
  910.     xx2 = x2a(Pointer): yy2 = y2a(Pointer)
  911.     Select Case Mirror
  912.     Case 1: 'mirror on x and y axis
  913.         Line (xx1, yy1)-(xx2, yy2), m
  914.         Line (ScaleWidth - xx1, yy1)-(ScaleWidth - xx2, yy2), m
  915.         Line (xx1, ScaleHeight - yy1)-(xx2, ScaleHeight - yy2), m
  916.         Line (ScaleWidth - xx1, ScaleHeight - yy1)-(ScaleWidth - xx2, ScaleHeight - yy2), m
  917.     Case 2: 'mirror on Y axis
  918.         Line (xx1, yy1)-(xx2, yy2), m
  919.         Line (ScaleWidth - xx1, yy1)-(ScaleWidth - xx2, yy2), m
  920.     Case 3: 'mirror around center point
  921.         Line (xx1, yy1)-(xx2, yy2), m
  922.         Line (ScaleWidth - xx1, ScaleHeight - yy1)-(ScaleWidth - xx2, ScaleHeight - yy2), m
  923.     Case 4: 'mirror on x and y axis and diagonally
  924.         Line (xx1, yy1)-(xx2, yy2), m
  925.         Line (ScaleWidth - xx1, yy1)-(ScaleWidth - xx2, yy2), m
  926.         Line (xx1, ScaleHeight - yy1)-(xx2, ScaleHeight - yy2), m
  927.         Line (ScaleWidth - xx1, ScaleHeight - yy1)-(ScaleWidth - xx2, ScaleHeight - yy2), m
  928.         'mirror diagonally
  929.         xm1 = yy1 * conv2x
  930.         ym1 = xx1 * conv2y
  931.         xm2 = yy2 * conv2x
  932.         ym2 = xx2 * conv2y
  933.         Line (xm1, ym1)-(xm2, ym2), m
  934.         Line (ScaleWidth - xm1, ym1)-(ScaleWidth - xm2, ym2), m
  935.         Line (xm1, ScaleHeight - ym1)-(xm2, ScaleHeight - ym2), m
  936.         Line (ScaleWidth - xm1, ScaleHeight - ym1)-(ScaleWidth - xm2, ScaleHeight - ym2), m
  937.     Case Else: Mirror = 1' if invalid value set, then change
  938.     End Select
  939.     'Save New Lines
  940.     x1a(Pointer) = x1
  941.     x2a(Pointer) = x2
  942.     y1a(Pointer) = y1
  943.     y2a(Pointer) = y2
  944.     'Draw New Lines
  945.     Select Case Mirror
  946.     Case 1: 'mirror on x and y axis
  947.         Line (x1, y1)-(x2, y2), l
  948.         Line (ScaleWidth - x1, y1)-(ScaleWidth - x2, y2), l
  949.         Line (x1, ScaleHeight - y1)-(x2, ScaleHeight - y2), l
  950.         Line (ScaleWidth - x1, ScaleHeight - y1)-(ScaleWidth - x2, ScaleHeight - y2), l
  951.     Case 2: 'mirror on Y axis
  952.         Line (x1, y1)-(x2, y2), l
  953.         Line (ScaleWidth - x1, y1)-(ScaleWidth - x2, y2), l
  954.     Case 3: 'mirror around center point
  955.         Line (x1, y1)-(x2, y2), l
  956.         Line (ScaleWidth - x1, ScaleHeight - y1)-(ScaleWidth - x2, ScaleHeight - y2), l
  957.     Case 4: 'mirror on x and y axis and diagonally
  958.         Line (x1, y1)-(x2, y2), l
  959.         Line (ScaleWidth - x1, y1)-(ScaleWidth - x2, y2), l
  960.         Line (x1, ScaleHeight - y1)-(x2, ScaleHeight - y2), l
  961.         Line (ScaleWidth - x1, ScaleHeight - y1)-(ScaleWidth - x2, ScaleHeight - y2), l
  962.         'mirror diagonally
  963.         xm1 = y1 * conv2x
  964.         ym1 = x1 * conv2y
  965.         xm2 = y2 * conv2x
  966.         ym2 = x2 * conv2y
  967.         Line (xm1, ym1)-(xm2, ym2), l
  968.         Line (ScaleWidth - xm1, ym1)-(ScaleWidth - xm2, ym2), l
  969.         Line (xm1, ScaleHeight - ym1)-(xm2, ScaleHeight - ym2), l
  970.         Line (ScaleWidth - xm1, ScaleHeight - ym1)-(ScaleWidth - xm2, ScaleHeight - ym2), l
  971.     Case Else: Mirror = 1' if invalid value set, then change
  972.     End Select
  973.     'Move pointer to next item
  974.     Pointer = Pointer + 1
  975.     If Pointer > MaxLines Then
  976.         Pointer = 1
  977.     End If
  978.     'determine new acceleration
  979.     ax1 = Rnd - .5
  980.     ax2 = Rnd - .5
  981.     ay1 = Rnd - .5
  982.     ay2 = Rnd - .5
  983.     'calculate new position
  984.     x1 = x1 + vx1
  985.     x2 = x2 + vx2
  986.     y1 = y1 + vy1
  987.     y2 = y2 + vy2
  988.     'calculate new velocity
  989.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  990.     vx2 = (vx2 + ax2): If Abs(vx2) > MaxSpeedX Then vx2 = 0: ax2 = 0
  991.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  992.     vy2 = (vy2 + ay2): If Abs(vy2) > MaxSpeedY Then vy2 = 0: ay2 = 0
  993.     'check if off screen
  994.     If (x1 > ScaleWidth) Then
  995.         'change direction
  996.         vx1 = -Abs(vx1)
  997.     ElseIf (x1 < 0) Then
  998.         'change direction
  999.         vx1 = Abs(vx1)
  1000.     End If
  1001.     If (y1 > ScaleHeight) Then
  1002.         'change direction
  1003.         vy1 = -Abs(vy1)
  1004.     ElseIf (y1 < 0) Then
  1005.         'change direction
  1006.         vy1 = Abs(vy1)
  1007.     End If
  1008.     If (x2 > ScaleWidth) Then
  1009.         'change direction
  1010.         vx2 = -Abs(vx2)
  1011.     ElseIf (x2 < 0) Then
  1012.         'change direction
  1013.         vx2 = Abs(vx2)
  1014.     End If
  1015.     If (y2 > ScaleHeight) Then
  1016.         'change direction
  1017.         vy2 = -Abs(vy2)
  1018.     ElseIf (y2 < 0) Then
  1019.         'change direction
  1020.         vy2 = Abs(vy2)
  1021.     End If
  1022.     End If
  1023. End Sub
  1024. Sub Kalied2 ()
  1025.   ' have a line and its mirror images trace across the
  1026.   ' screen with all the previous copies left on the screen
  1027.   ' until the maximum is reached and the screen cleared
  1028.   Dim i As Integer, j As Integer, k As Integer, n As Integer
  1029.   Dim il As Long, jl As Long, kl As Long
  1030.   Dim xRadius As Integer, yRadius As Integer
  1031.   Dim HighMirror As Integer
  1032.   Dim xm1 As Integer, ym1 As Integer, xm2 As Integer, ym2 As Integer
  1033.   ' if first time then initialize
  1034.   If PlotInit = False Then
  1035.     'see if we need to reset changes made from previous init
  1036.     If PlotEnd = True Then
  1037.       Exit Sub
  1038.     End If
  1039.       'see if we just want the priority for this saver
  1040.       If PlotPriority = True Then
  1041.     '1 is normal priority, adjust up to show more often, or down ...
  1042.     Priority = 1#
  1043.     Exit Sub
  1044.       End If
  1045.     'check if runing low memory mode
  1046.     If CheckIfValidMode(0) = 0 Then
  1047.       Exit Sub
  1048.     End If
  1049.     PlotInit = True
  1050.     Cls
  1051.     ForeColor = QBColor(15)
  1052.     'select mirroring method
  1053.     HighMirror = 4
  1054.     Mirror = Rnd * HighMirror + 1: If Mirror > HighMirror Then Mirror = 1
  1055.     Pointer = 1     ' set lines on screen to one
  1056.     ' set index to count number of times to repeat color
  1057.     '   to past maxvalue so that it will be recalculated
  1058.     RepeatIndex = MaxLines + 1
  1059.     'determine initial position of line
  1060.     x1 = Rnd * ScaleWidth
  1061.     x2 = Rnd * ScaleWidth
  1062.     y1 = Rnd * ScaleHeight
  1063.     y2 = Rnd * ScaleHeight
  1064.     'set initial velocity
  1065.     vx1 = 0
  1066.     vx2 = 0
  1067.     vy1 = 0
  1068.     vy2 = 0
  1069.     'set initial acceleration
  1070.     ax1 = 0
  1071.     ax2 = 0
  1072.     ay1 = 0
  1073.     ay2 = 0
  1074.     'find background color
  1075.     m = QBColor(0)
  1076.     'Calculate velocity limits
  1077.     MaxSpeedX = ScaleWidth * 15! / 800
  1078.     MaxSpeedY = ScaleWidth * 15! / 600
  1079.     'get conversion factors
  1080.     conv2x = 1# * ScaleWidth / ScaleHeight
  1081.     conv2y = 1# / conv2x
  1082.   Else  ' put run code here
  1083.     ' check if time to get a new color
  1084.     If RepeatIndex > RepeatCount Then
  1085.     ' use rgb function
  1086.       il = Rnd * 255: If il > 255 Then il = 255
  1087.       jl = Rnd * 255: If jl > 255 Then jl = 255
  1088.       kl = Rnd * 255: If kl > 255 Then kl = 255
  1089.     Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  1090.     l = RGB(il, jl, kl)
  1091.     RepeatIndex = 1
  1092.     Else
  1093.     RepeatIndex = RepeatIndex + 1
  1094.     End If
  1095.     'Draw New Lines
  1096.     Select Case Mirror
  1097.     Case 1: 'mirror on x and y axis
  1098.         Line (x1, y1)-(x2, y2), l
  1099.         Line (ScaleWidth - x1, y1)-(ScaleWidth - x2, y2), l
  1100.         Line (x1, ScaleHeight - y1)-(x2, ScaleHeight - y2), l
  1101.         Line (ScaleWidth - x1, ScaleHeight - y1)-(ScaleWidth - x2, ScaleHeight - y2), l
  1102.     Case 2: 'mirror on Y axis
  1103.         Line (x1, y1)-(x2, y2), l
  1104.         Line (ScaleWidth - x1, y1)-(ScaleWidth - x2, y2), l
  1105.     Case 3: 'mirror around center point
  1106.         Line (x1, y1)-(x2, y2), l
  1107.         Line (ScaleWidth - x1, ScaleHeight - y1)-(ScaleWidth - x2, ScaleHeight - y2), l
  1108.     Case 4: 'mirror on x and y axis and diagonally
  1109.         Line (x1, y1)-(x2, y2), l
  1110.         Line (ScaleWidth - x1, y1)-(ScaleWidth - x2, y2), l
  1111.         Line (x1, ScaleHeight - y1)-(x2, ScaleHeight - y2), l
  1112.         Line (ScaleWidth - x1, ScaleHeight - y1)-(ScaleWidth - x2, ScaleHeight - y2), l
  1113.         'mirror diagonally
  1114.         xm1 = y1 * conv2x
  1115.         ym1 = x1 * conv2y
  1116.         xm2 = y2 * conv2x
  1117.         ym2 = x2 * conv2y
  1118.         Line (xm1, ym1)-(xm2, ym2), l
  1119.         Line (ScaleWidth - xm1, ym1)-(ScaleWidth - xm2, ym2), l
  1120.         Line (xm1, ScaleHeight - ym1)-(xm2, ScaleHeight - ym2), l
  1121.         Line (ScaleWidth - xm1, ScaleHeight - ym1)-(ScaleWidth - xm2, ScaleHeight - ym2), l
  1122.     Case Else: Mirror = 1' if invalid value set, then change
  1123.     End Select
  1124.     ' count total lines on screen
  1125.     Pointer = Pointer + 1
  1126.     If Pointer > MaxCums Then
  1127.         'when maximum reached then clear
  1128.         Cls
  1129.         Pointer = 1
  1130.     End If
  1131.     'determine new acceleration
  1132.     ax1 = Rnd - .5
  1133.     ax2 = Rnd - .5
  1134.     ay1 = Rnd - .5
  1135.     ay2 = Rnd - .5
  1136.     'calculate new position
  1137.     x1 = x1 + vx1
  1138.     x2 = x2 + vx2
  1139.     y1 = y1 + vy1
  1140.     y2 = y2 + vy2
  1141.     'calculate new velocity
  1142.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  1143.     vx2 = (vx2 + ax2): If Abs(vx2) > MaxSpeedX Then vx2 = 0: ax2 = 0
  1144.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  1145.     vy2 = (vy2 + ay2): If Abs(vy2) > MaxSpeedY Then vy2 = 0: ay2 = 0
  1146.     'check if off screen
  1147.     If (x1 > ScaleWidth) Then
  1148.         'change direction
  1149.         vx1 = -Abs(vx1)
  1150.     ElseIf (x1 < 0) Then
  1151.         'change direction
  1152.         vx1 = Abs(vx1)
  1153.     End If
  1154.     If (y1 > ScaleHeight) Then
  1155.         'change direction
  1156.         vy1 = -Abs(vy1)
  1157.     ElseIf (y1 < 0) Then
  1158.         'change direction
  1159.         vy1 = Abs(vy1)
  1160.     End If
  1161.     If (x2 > ScaleWidth) Then
  1162.         'change direction
  1163.         vx2 = -Abs(vx2)
  1164.     ElseIf (x2 < 0) Then
  1165.         'change direction
  1166.         vx2 = Abs(vx2)
  1167.     End If
  1168.     If (y2 > ScaleHeight) Then
  1169.         'change direction
  1170.         vy2 = -Abs(vy2)
  1171.     ElseIf (y2 < 0) Then
  1172.         'change direction
  1173.         vy2 = Abs(vy2)
  1174.     End If
  1175.     End If
  1176. End Sub
  1177. Sub Lines ()
  1178.   ' have a random number of lines trace across the
  1179.   ' screen with multiple previous copies following
  1180.   ' them
  1181.   Dim i As Integer, j As Integer, k As Integer, ii As Integer, n As Integer
  1182.   Dim il As Long, jl As Long, kl As Long
  1183.   Static Sets As Integer
  1184.   ' if first time then initialize
  1185.   If PlotInit = False Then
  1186.     'see if we need to reset changes made from previous init
  1187.     If PlotEnd = False Then
  1188.       'see if we just want the priority for this saver
  1189.       If PlotPriority = True Then
  1190.     '1 is normal priority, adjust up to show more often, or down ...
  1191.     Priority = 1#
  1192.     Exit Sub
  1193.       End If
  1194.     'check if runing low memory mode
  1195.     If CheckIfValidMode(0) = 0 Then
  1196.       Exit Sub
  1197.     End If
  1198.     PlotInit = True
  1199.     Cls
  1200.     ForeColor = QBColor(15)
  1201.     'set number of sets between 1 and 4
  1202.     Sets = Rnd * 3 + 1
  1203.     'Set array size and clear the elements
  1204.     ReDim x1da(MaxLines, Sets) As Integer
  1205.     ReDim x2da(MaxLines, Sets) As Integer
  1206.     ReDim y1da(MaxLines, Sets) As Integer
  1207.     ReDim y2da(MaxLines, Sets) As Integer
  1208.     ReDim x1sa(Sets) As Single
  1209.     ReDim x2sa(Sets) As Single
  1210.     ReDim y1sa(Sets) As Single
  1211.     ReDim y2sa(Sets) As Single
  1212.     ReDim vx1sa(Sets) As Single
  1213.     ReDim vx2sa(Sets) As Single
  1214.     ReDim vy1sa(Sets) As Single
  1215.     ReDim vy2sa(Sets) As Single
  1216.     ReDim ax1sa(Sets) As Single
  1217.     ReDim ax2sa(Sets) As Single
  1218.     ReDim ay1sa(Sets) As Single
  1219.     ReDim ay2sa(Sets) As Single
  1220.     ReDim Colors(Sets) As Long
  1221.     Pointer = 1     ' start with array element 1
  1222.     ' set index to count number of times to repeat color
  1223.     '   to past maxvalue so that it will be recalculated
  1224.     RepeatIndex = MaxLines + 1
  1225.     For j = 1 To Sets
  1226.     'determine initial position of line
  1227.     x1sa(j) = Rnd * ScaleWidth
  1228.     x2sa(j) = Rnd * ScaleWidth
  1229.     y1sa(j) = Rnd * ScaleHeight
  1230.     y2sa(j) = Rnd * ScaleHeight
  1231.     Next j
  1232.     'find background color
  1233.     m = QBColor(0)
  1234.     'Calculate velocity limits
  1235.     MaxSpeedX = ScaleWidth * 15! / 800
  1236.     MaxSpeedY = ScaleWidth * 15! / 600
  1237.   Else 'reset changes done by previous init
  1238.     'Set array size and clear the elements
  1239.     ReDim x1da(0, 0) As Integer
  1240.     ReDim x2da(0, 0) As Integer
  1241.     ReDim y1da(0, 0) As Integer
  1242.     ReDim y2da(0, 0) As Integer
  1243.     ReDim x1sa(0) As Single
  1244.     ReDim x2sa(0) As Single
  1245.     ReDim y1sa(0) As Single
  1246.     ReDim y2sa(0) As Single
  1247.     ReDim vx1sa(0) As Single
  1248.     ReDim vx2sa(0) As Single
  1249.     ReDim vy1sa(0) As Single
  1250.     ReDim vy2sa(0) As Single
  1251.     ReDim ax1sa(0) As Single
  1252.     ReDim ax2sa(0) As Single
  1253.     ReDim ay1sa(0) As Single
  1254.     ReDim ay2sa(0) As Single
  1255.     ReDim Colors(0) As Long
  1256.   End If
  1257.   Else  ' put run code here
  1258.     ' check if time to get a new color
  1259.     If RepeatIndex > RepeatCount Then
  1260.     ' use rgb function
  1261.     For ii = 1 To Sets
  1262.       Do
  1263.         il = Rnd * 255: If il > 255 Then il = 255
  1264.         jl = Rnd * 255: If jl > 255 Then jl = 255
  1265.         kl = Rnd * 255: If kl > 255 Then kl = 255
  1266.       Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  1267.       Colors(ii) = RGB(il, jl, kl)
  1268.     Next ii
  1269.     RepeatIndex = 1
  1270.     Else
  1271.     RepeatIndex = RepeatIndex + 1
  1272.     End If
  1273.     'Delete original Lines
  1274.     For j = 1 To Sets
  1275.         Line (x1da(Pointer, j), y1da(Pointer, j))-(x2da(Pointer, j), y2da(Pointer, j)), m
  1276.     Next j
  1277.     For j = 1 To Sets
  1278.         'Save New Lines
  1279.         x1da(Pointer, j) = x1sa(j)
  1280.         x2da(Pointer, j) = x2sa(j)
  1281.         y1da(Pointer, j) = y1sa(j)
  1282.         y2da(Pointer, j) = y2sa(j)
  1283.         'Draw new Line
  1284.         Line (x1da(Pointer, j), y1da(Pointer, j))-(x2da(Pointer, j), y2da(Pointer, j)), Colors(j)
  1285.     Next j
  1286.     'Move pointer to next item
  1287.     Pointer = Pointer + 1
  1288.     If Pointer > MaxLines Then
  1289.         Pointer = 1
  1290.     End If
  1291.     For j = 1 To Sets
  1292.         'determine new acceleration
  1293.         ax1sa(j) = Rnd - .5
  1294.         ax2sa(j) = Rnd - .5
  1295.         ay1sa(j) = Rnd - .5
  1296.         ay2sa(j) = Rnd - .5
  1297.         'calculate new position
  1298.         x1sa(j) = x1sa(j) + vx1sa(j)
  1299.         x2sa(j) = x2sa(j) + vx2sa(j)
  1300.         y1sa(j) = y1sa(j) + vy1sa(j)
  1301.         y2sa(j) = y2sa(j) + vy2sa(j)
  1302.         'calculate new velocity
  1303.         vx1sa(j) = (vx1sa(j) + ax1sa(j)): If Abs(vx1sa(j)) > MaxSpeedX Then vx1sa(j) = 0: ax1sa(j) = 0
  1304.         vx2sa(j) = (vx2sa(j) + ax2sa(j)): If Abs(vx2sa(j)) > MaxSpeedX Then vx2sa(j) = 0: ax2sa(j) = 0
  1305.         vy1sa(j) = (vy1sa(j) + ay1sa(j)): If Abs(vy1sa(j)) > MaxSpeedY Then vy1sa(j) = 0: ay1sa(j) = 0
  1306.         vy2sa(j) = (vy2sa(j) + ay2sa(j)): If Abs(vy2sa(j)) > MaxSpeedY Then vy2sa(j) = 0: ay2sa(j) = 0
  1307.         'check if off screen
  1308.         If (x1sa(j) > ScaleWidth) Then
  1309.         'change direction
  1310.         vx1sa(j) = -Abs(vx1sa(j))
  1311.         ElseIf (x1sa(j) < 0) Then
  1312.         'change direction
  1313.         vx1sa(j) = Abs(vx1sa(j))
  1314.         End If
  1315.         If (y1sa(j) > ScaleHeight) Then
  1316.         'change direction
  1317.         vy1sa(j) = -Abs(vy1sa(j))
  1318.         ElseIf (y1sa(j) < 0) Then
  1319.         'change direction
  1320.         vy1sa(j) = Abs(vy1sa(j))
  1321.         End If
  1322.         If (x2sa(j) > ScaleWidth) Then
  1323.         'change direction
  1324.         vx2sa(j) = -Abs(vx2sa(j))
  1325.         ElseIf (x2sa(j) < 0) Then
  1326.         'change direction
  1327.         vx2sa(j) = Abs(vx2sa(j))
  1328.         End If
  1329.         If (y2sa(j) > ScaleHeight) Then
  1330.         'change direction
  1331.         vy2sa(j) = -Abs(vy2sa(j))
  1332.         ElseIf (y2sa(j) < 0) Then
  1333.         'change direction
  1334.         vy2sa(j) = Abs(vy2sa(j))
  1335.         End If
  1336.     Next j
  1337.   End If
  1338. End Sub
  1339. Sub MultiSpiros ()
  1340.   'Do spirograph like figures
  1341.   'reserve memory
  1342.   Const Deg2Pi = PI / 180
  1343.   Static MaxRad As Integer'maximum radius for circles
  1344.   Const MaxNodes = 35'maximum number of nodes on spiro
  1345.   Dim Nodes As Integer
  1346.   Const MaxRpts = 7'max times to go around circle
  1347.   Dim Rpts As Integer
  1348.   Const PlotPoints = 4'number of points to plot each time
  1349.   Const ClearCount = 3'number on screen before clearing
  1350.   Static PlotAngleIncr As Single
  1351.   Static PlotEndAngle As Single
  1352.   Static PlotAngle As Single
  1353.   Static SinIncr As Single
  1354.   Static SinAngle As Single
  1355.   Static Xcenter As Integer
  1356.   Static Ycenter As Integer
  1357.   Static Xincr As Integer
  1358.   Static Yincr As Integer
  1359.   Const MaxSpiro = 8' maximum number of simultaneous spiros
  1360.   Static SpiroCnt As Integer
  1361.   Static Rad1 As Integer
  1362.   Static Rad2 As Integer
  1363.   Dim R As Single
  1364.   Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, n As Integer
  1365.   Dim il As Long, jl As Long, kl As Long
  1366.   ' if first time then initialize
  1367.   If PlotInit = False Then
  1368.     'see if we need to reset changes made from previous init
  1369.     If PlotEnd = False Then
  1370.       'see if we just want the priority for this saver
  1371.       If PlotPriority = True Then
  1372.     '1 is normal priority, adjust up to show more often, or down ...
  1373.     Priority = 1#
  1374.     Exit Sub
  1375.       End If
  1376.     'check if runing low memory mode
  1377.     If CheckIfValidMode(0) = 0 Then
  1378.       Exit Sub
  1379.     End If
  1380.       PlotInit = True
  1381.       ForeColor = RGB(255, 255, 255)
  1382.       BackColor = RGB(0, 0, 0)
  1383.       Cls
  1384.      'initialize variables used
  1385.      PlotEndAngle = 0
  1386.      PlotAngle = 10
  1387.      MaxRad = ScaleHeight / 3'maximum radius for circles
  1388.      Pointer = 0
  1389.     Else 'reset changes done by previous init
  1390.       DrawWidth = 1' use narrow line
  1391.     End If
  1392.   Else  ' put run code here
  1393.     ' check if time to do new spiro
  1394.     If PlotAngle > PlotEndAngle Then
  1395.     'set foreground color
  1396.       il = Rnd * 255: If il > 255 Then il = 255
  1397.       jl = Rnd * 255: If jl > 255 Then jl = 255
  1398.       kl = Rnd * 255: If kl > 255 Then kl = 255
  1399.     Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  1400.     ForeColor = RGB(il, jl, kl)
  1401.     PlotAngle = Rnd * 180 * Deg2Pi'initial offset
  1402.     Rpts = Rnd * MaxRpts + .5
  1403.     PlotAngleIncr = .125 * Rpts * Deg2Pi
  1404.     PlotEndAngle = 360 * Rpts * Deg2Pi + PlotAngle + PlotAngleIncr
  1405.     Nodes = Rnd * MaxNodes + .5
  1406.     SinIncr = PlotAngleIncr * Nodes / Rpts
  1407.     SinAngle = 0
  1408.     Rad1 = MaxRad * Rnd
  1409.     Rad2 = MaxRad * Rnd
  1410.     'get location of first
  1411.     Xcenter = Rnd * ScaleWidth * 3 / 4 + ScaleWidth / 8
  1412.     Ycenter = Rnd * ScaleHeight * 3 / 4 + ScaleHeight / 8
  1413.     'get location of last
  1414.     i = Rnd * ScaleWidth * 3 / 4 + ScaleWidth / 8
  1415.     j = Rnd * ScaleHeight * 3 / 4 + ScaleHeight / 8
  1416.     'get number
  1417.     SpiroCnt = (MaxSpiro - 2) * Rnd + 2' maximum number of simultaneous spiros
  1418.     'calculate increment
  1419.     Xincr = (i - Xcenter) / (SpiroCnt - 1)
  1420.     Yincr = (j - Ycenter) / (SpiroCnt - 1)
  1421.     DrawWidth = 1 + 2 * Rnd ' set line width
  1422.     GoSub 3000 'calculate x1 and y1
  1423.     End If
  1424.     For i = 1 To PlotPoints
  1425.       GoSub 3000 'calculate x1 and y1
  1426.       k = x1: l = y1: m = LastX: n = LastY
  1427.       'plot each spiro
  1428.       For j = 1 To SpiroCnt
  1429.     'draw line
  1430.     Line (m, n)-(k, l)
  1431.     'get location for next
  1432.     k = k + Xincr: l = l + Yincr
  1433.     m = m + Xincr: n = n + Yincr
  1434.       Next j
  1435.     Next i
  1436.   End If
  1437.   Exit Sub
  1438. 3000 'calculate new point on screen
  1439.   LastX = x1: LastY = y1
  1440.   R = Rad1 + Rad2 * Sin(SinAngle)
  1441.   x1 = R * Cos(PlotAngle) + Xcenter
  1442.   y1 = R * Sin(PlotAngle) + Ycenter
  1443.   SinAngle = SinAngle + SinIncr
  1444.   PlotAngle = PlotAngle + PlotAngleIncr
  1445.   Return
  1446. End Sub
  1447. Sub NextSelection ()
  1448. Dim i As Integer
  1449. Dim Level As Single
  1450. If RandomFlag <> 0 Then
  1451.   ' pick a new selection but not the same as the last
  1452.     'i = Int(Rnd * MaxPlotType) + 1'choose next one at random
  1453.     Level = Rnd * TotalPriority' get random proportion of TP
  1454.     'now search array to see which saver this prop. falls into
  1455.     i = 1
  1456.     While (PriorityBreakPoints(i) <= Level)
  1457.       i = i + 1
  1458.     Wend
  1459.     'Debug.Print i, Level, TotalPriority
  1460.     If (i > MaxPlotType) Or (i < 1) Then i = PlotType'flag to try again
  1461.   Loop While (i = PlotType)
  1462.   PlotType = i
  1463.   PlotType = PlotType + 1
  1464. End If
  1465. LogFile ("Next Saver is " + Str$(PlotType))
  1466. End Sub
  1467. Function NumberOfColors () As Single
  1468.   Dim i As Integer, j As Integer, k As Integer
  1469.   ' get bits per pixel per plane
  1470.   i = GetDeviceCaps(hDC, BITSPIXEL)
  1471.   ' get number of planes
  1472.   j = GetDeviceCaps(hDC, PLANES)
  1473.   ' get total bits per pixel
  1474.   k = i * j
  1475.   NumberOfColors = 2# ^ k
  1476. End Function
  1477. Sub Patch ()
  1478.   ' copy blocks of original screen to random spots
  1479.   ' if first time then initialize
  1480.   If PlotInit = False Then
  1481.     'see if we need to reset changes made from previous init
  1482.     If PlotEnd = False Then
  1483.       'see if we just want the priority for this saver
  1484.       If PlotPriority = True Then
  1485.     '1 is normal priority, adjust up to show more often, or down ...
  1486.     Priority = 1#
  1487.     Exit Sub
  1488.       End If
  1489.     'check if runing low memory mode
  1490.     If CheckIfValidMode(1) = 0 Then
  1491.       Exit Sub
  1492.     End If
  1493.     ' set tick rate down
  1494.     Tick.Interval = 250
  1495.     ' start with original screen
  1496.     Picture = Original.Image
  1497.     PlotInit = True
  1498.     i = Int(Rnd * 2#) 'if i=0 then alternate reverse copy
  1499.   Else 'reset changes done by previous init
  1500.     Picture = LoadPicture() ' clear screen
  1501.     'reset tick rate
  1502.     Tick.Interval = 50
  1503.   End If
  1504.   Else  ' put run code here
  1505.     BoxHeight = Rnd * ScaleHeight / 2.5
  1506.     Boxwidth = Rnd * ScaleWidth / 2.5 * (8# / 6#)
  1507.     ' get random locations
  1508.     x1 = Rnd * ScaleWidth
  1509.     y1 = Rnd * ScaleHeight
  1510.     x2 = Rnd * ScaleWidth
  1511.     y2 = Rnd * ScaleHeight
  1512.     'make sure room in destination and source blocks
  1513.     If x1 + Boxwidth > ScaleWidth Then Boxwidth = ScaleWidth - x1
  1514.     If x2 + Boxwidth > ScaleWidth Then Boxwidth = ScaleWidth - x2
  1515.     If y1 + BoxHeight > ScaleHeight Then BoxHeight = ScaleHeight - y1
  1516.     If y2 + BoxHeight > ScaleHeight Then BoxHeight = ScaleHeight - y2
  1517.     'BitBlt Box from x2,y2 to x1,y1
  1518.     DC = Original.hDC
  1519.     If i = 0 And Rnd < .5 Then
  1520.     BitBlt hDC, x1, y1, Boxwidth, BoxHeight, DC, x2, y2, &H330008 'not source copy
  1521.     Else
  1522.     BitBlt hDC, x1, y1, Boxwidth, BoxHeight, DC, x2, y2, &HCC0020 'source copy
  1523.     End If
  1524.   End If
  1525. End Sub
  1526. Sub Polygons ()
  1527.   ' draw a randomly moving polygon on the screen
  1528.   ' with multiple previous copies following it
  1529.   Dim i As Integer, j As Integer, k As Integer, ii As Integer, n As Integer
  1530.   Dim il As Long, jl As Long, kl As Long
  1531.   Static Sets As Integer
  1532.   ' if first time then initialize
  1533.   If PlotInit = False Then
  1534.     'see if we need to reset changes made from previous init
  1535.     If PlotEnd = False Then
  1536.       'see if we just want the priority for this saver
  1537.       If PlotPriority = True Then
  1538.     '1 is normal priority, adjust up to show more often, or down ...
  1539.     Priority = 1#
  1540.     Exit Sub
  1541.       End If
  1542.     'check if runing low memory mode
  1543.     If CheckIfValidMode(0) = 0 Then
  1544.       Exit Sub
  1545.     End If
  1546.     PlotInit = True
  1547.     Cls
  1548.     ForeColor = QBColor(15)
  1549.     'set number of sets between 3 and 5
  1550.     Sets = Rnd * 2 + 3
  1551.     'Set array size and clear the elements
  1552.     ReDim x1da(MaxLines, Sets) As Integer
  1553.     ReDim y1da(MaxLines, Sets) As Integer
  1554.     ReDim x1sa(Sets) As Single
  1555.     ReDim y1sa(Sets) As Single
  1556.     ReDim vx1sa(Sets) As Single
  1557.     ReDim vy1sa(Sets) As Single
  1558.     ReDim ax1sa(Sets) As Single
  1559.     ReDim ay1sa(Sets) As Single
  1560.     Pointer = 1     ' start with array element 1
  1561.     ' set index to count number of times to repeat color
  1562.     '   to past maxvalue so that it will be recalculated
  1563.     RepeatIndex = MaxLines + 1
  1564.     For j = 1 To Sets
  1565.     'determine initial position of line
  1566.     x1sa(j) = Rnd * ScaleWidth
  1567.     y1sa(j) = Rnd * ScaleHeight
  1568.     Next j
  1569.     'find background color
  1570.     m = QBColor(0)
  1571.     'Calculate velocity limits
  1572.     MaxSpeedX = ScaleWidth * 15! / 800
  1573.     MaxSpeedY = ScaleWidth * 15! / 600
  1574.   Else 'reset changes done by previous init
  1575.     'Set array size and clear the elements
  1576.     ReDim x1da(0, 0) As Integer
  1577.     ReDim y1da(0, 0) As Integer
  1578.     ReDim x1sa(0) As Single
  1579.     ReDim y1sa(0) As Single
  1580.     ReDim vx1sa(0) As Single
  1581.     ReDim vy1sa(0) As Single
  1582.     ReDim ax1sa(0) As Single
  1583.     ReDim ay1sa(0) As Single
  1584.   End If
  1585.   Else  ' put run code here
  1586.     ' check if time to get a new color
  1587.     If RepeatIndex > RepeatCount Then
  1588.       il = Rnd * 255: If il > 255 Then il = 255
  1589.       jl = Rnd * 255: If jl > 255 Then jl = 255
  1590.       kl = Rnd * 255: If kl > 255 Then kl = 255
  1591.     Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  1592.     l = RGB(il, jl, kl)
  1593.     RepeatIndex = 1
  1594.     Else
  1595.     RepeatIndex = RepeatIndex + 1
  1596.     End If
  1597.     'Delete original Lines
  1598.     Line (x1da(Pointer, 1), y1da(Pointer, 1))-(x1da(Pointer, 2), y1da(Pointer, 2)), m
  1599.     For j = 3 To Sets
  1600.         Line -(x1da(Pointer, j), y1da(Pointer, j)), m
  1601.     Next j
  1602.     Line -(x1da(Pointer, 1), y1da(Pointer, 1)), m
  1603.     For j = 1 To Sets
  1604.         'Save New Lines
  1605.         x1da(Pointer, j) = x1sa(j)
  1606.         y1da(Pointer, j) = y1sa(j)
  1607.     Next j
  1608.     'Draw New Lines
  1609.     Line (x1da(Pointer, 1), y1da(Pointer, 1))-(x1da(Pointer, 2), y1da(Pointer, 2)), l
  1610.     For j = 3 To Sets
  1611.         Line -(x1da(Pointer, j), y1da(Pointer, j)), l
  1612.     Next j
  1613.     Line -(x1da(Pointer, 1), y1da(Pointer, 1)), l
  1614.     'Move pointer to next item
  1615.     Pointer = Pointer + 1
  1616.     If Pointer > MaxLines Then
  1617.         Pointer = 1
  1618.     End If
  1619.     For j = 1 To Sets
  1620.         'determine new acceleration
  1621.         ax1sa(j) = Rnd - .5
  1622.         ay1sa(j) = Rnd - .5
  1623.         
  1624.         'calculate new position
  1625.         x1sa(j) = x1sa(j) + vx1sa(j)
  1626.         y1sa(j) = y1sa(j) + vy1sa(j)
  1627.         'calculate new velocity
  1628.         vx1sa(j) = (vx1sa(j) + ax1sa(j)): If Abs(vx1sa(j)) > MaxSpeedX Then vx1sa(j) = 0: ax1sa(j) = 0
  1629.         vy1sa(j) = (vy1sa(j) + ay1sa(j)): If Abs(vy1sa(j)) > MaxSpeedY Then vy1sa(j) = 0: ay1sa(j) = 0
  1630.         'check if off screen
  1631.         If (x1sa(j) > ScaleWidth) Then
  1632.         'change direction
  1633.         vx1sa(j) = -Abs(vx1sa(j))
  1634.         ElseIf (x1sa(j) < 0) Then
  1635.         'change direction
  1636.         vx1sa(j) = Abs(vx1sa(j))
  1637.         End If
  1638.         If (y1sa(j) > ScaleHeight) Then
  1639.         'change direction
  1640.         vy1sa(j) = -Abs(vy1sa(j))
  1641.         ElseIf (y1sa(j) < 0) Then
  1642.         'change direction
  1643.         vy1sa(j) = Abs(vy1sa(j))
  1644.         End If
  1645.     Next j
  1646.     End If
  1647. End Sub
  1648. Sub Puzzle ()
  1649.   'scramble screen by shifting one column or row at a time
  1650.   Dim tempx As Integer, tempy As Integer
  1651.   Dim x As Integer, y As Integer
  1652.   ' if first time then initialize
  1653.   If PlotInit = False Then
  1654.     'see if we need to reset changes made from previous init
  1655.     If PlotEnd = False Then
  1656.       'see if we just want the priority for this saver
  1657.       If PlotPriority = True Then
  1658.     '1 is normal priority, adjust up to show more often, or down ...
  1659.     Priority = 1#
  1660.     Exit Sub
  1661.       End If
  1662.     'check if runing low memory mode
  1663.     If CheckIfValidMode(1) = 0 Then
  1664.       Exit Sub
  1665.     End If
  1666.     ' set tick rate down
  1667.     Tick.Interval = 1000
  1668.     ' start with original screen
  1669.     Picture = Original.Image
  1670.     'find background color
  1671.     m = QBColor(0)
  1672.     PlotInit = True
  1673.     Number = Rnd * 16 + 4
  1674.     'Number = 20
  1675.     BoxHeight = ScaleHeight / Number
  1676.     Boxwidth = ScaleWidth / Number
  1677.     'initialize blocks
  1678.     ReDim x1da(Number, Number) As Integer
  1679.     ReDim y1da(Number, Number) As Integer
  1680.     For x1 = 1 To Number
  1681.     For y1 = 1 To Number
  1682.         x1da(x1, y1) = (x1 - 1) * Boxwidth
  1683.         y1da(x1, y1) = (y1 - 1) * BoxHeight
  1684.     Next y1
  1685.     Next x1
  1686.   Else 'reset changes done by previous init
  1687.     ReDim x1da(0, 0) As Integer
  1688.     ReDim y1da(0, 0) As Integer
  1689.     'reset tick rate
  1690.     Tick.Interval = 50
  1691.     Picture = LoadPicture() ' clear screen
  1692.   End If
  1693.   Else  ' put run code here
  1694.     If Int(Rnd * 2) = 1 Then 'shift column
  1695.     x1 = Rnd * Number + 1: If x1 > Number Then x1 = 1
  1696.     If Int(Rnd * 2) = 1 Then 'shift down
  1697.         tempx = x1da(x1, Number)
  1698.         tempy = y1da(x1, Number)
  1699.         For y1 = Number To 2 Step -1
  1700.         x1da(x1, y1) = x1da(x1, y1 - 1)
  1701.         y1da(x1, y1) = y1da(x1, y1 - 1)
  1702.         'BitBlt Box to x1,y1
  1703.         DC = Original.hDC
  1704.         x = (x1 - 1) * Boxwidth
  1705.         y = (y1 - 1) * BoxHeight
  1706.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1707.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1708.         Next y1
  1709.         y1 = 1
  1710.         x1da(x1, y1) = tempx
  1711.         y1da(x1, y1) = tempy
  1712.         'BitBlt Box to x1,y1
  1713.         DC = Original.hDC
  1714.         x = (x1 - 1) * Boxwidth
  1715.         y = (y1 - 1) * BoxHeight
  1716.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1717.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1718.     Else ' shift up
  1719.         tempx = x1da(x1, 1)
  1720.         tempy = y1da(x1, 1)
  1721.         For y1 = 1 To (Number - 1)
  1722.         x1da(x1, y1) = x1da(x1, y1 + 1)
  1723.         y1da(x1, y1) = y1da(x1, y1 + 1)
  1724.         'BitBlt Box to x1,y1
  1725.         DC = Original.hDC
  1726.         x = (x1 - 1) * Boxwidth
  1727.         y = (y1 - 1) * BoxHeight
  1728.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1729.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1730.         
  1731.         Next y1
  1732.         y1 = Number
  1733.         x1da(x1, y1) = tempx
  1734.         y1da(x1, y1) = tempy
  1735.         'BitBlt Box to x1,y1
  1736.         DC = Original.hDC
  1737.         x = (x1 - 1) * Boxwidth
  1738.         y = (y1 - 1) * BoxHeight
  1739.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1740.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1741.     End If
  1742.     Else ' shift row
  1743.     y1 = Rnd * Number + 1: If y1 > Number Then y1 = 1
  1744.     If Int(Rnd * 2) = 1 Then 'shift right
  1745.         tempx = x1da(Number, y1)
  1746.         tempy = y1da(Number, y1)
  1747.         For x1 = Number To 2 Step -1
  1748.         x1da(x1, y1) = x1da(x1 - 1, y1)
  1749.         y1da(x1, y1) = y1da(x1 - 1, y1)
  1750.         'BitBlt Box to x1,y1
  1751.         DC = Original.hDC
  1752.         x = (x1 - 1) * Boxwidth
  1753.         y = (y1 - 1) * BoxHeight
  1754.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1755.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1756.         Next x1
  1757.         x1 = 1
  1758.         x1da(x1, y1) = tempx
  1759.         y1da(x1, y1) = tempy
  1760.         'BitBlt Box to x1,y1
  1761.         DC = Original.hDC
  1762.         x = (x1 - 1) * Boxwidth
  1763.         y = (y1 - 1) * BoxHeight
  1764.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1765.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1766.     Else 'shift left
  1767.         tempx = x1da(1, y1)
  1768.         tempy = y1da(1, y1)
  1769.         For x1 = 1 To (Number - 1)
  1770.         x1da(x1, y1) = x1da(x1 + 1, y1)
  1771.         y1da(x1, y1) = y1da(x1 + 1, y1)
  1772.         'BitBlt Box to x1,y1
  1773.         DC = Original.hDC
  1774.         x = (x1 - 1) * Boxwidth
  1775.         y = (y1 - 1) * BoxHeight
  1776.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1777.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1778.         Next x1
  1779.         x1 = Number
  1780.         x1da(x1, y1) = tempx
  1781.         y1da(x1, y1) = tempy
  1782.         'BitBlt Box to x1,y1
  1783.         DC = Original.hDC
  1784.         x = (x1 - 1) * Boxwidth
  1785.         y = (y1 - 1) * BoxHeight
  1786.         BitBlt hDC, x, y, Boxwidth, BoxHeight, DC, x1da(x1, y1), y1da(x1, y1), &HCC0020
  1787.         Line (x, y)-Step(Boxwidth, BoxHeight), m, B
  1788.     End If
  1789.     End If
  1790.   End If
  1791. End Sub
  1792. Sub ReadPriorities ()
  1793.     Dim i As Integer
  1794.     ReDim PriorityBreakPoints(MaxPlotType + 1) As Single
  1795.     TotalPriority = 0
  1796.     'flad that we want to read priorities
  1797.     PlotPriority = True: PlotInit = False: PlotEnd = False
  1798.     For i = 1 To MaxPlotType
  1799.       Priority = 1#'default priority level
  1800.       PlotType = i: RunSelection' get priority for saver
  1801.       If Priority < 0# Then Priority = 0#
  1802.       TotalPriority = TotalPriority + Priority
  1803.       PriorityBreakPoints(i) = TotalPriority
  1804.     Next
  1805.     PriorityBreakPoints(MaxPlotType + 1) = TotalPriority + 3.402E+38
  1806. End Sub
  1807. Sub Replicate (FileName$)
  1808.   Dim x As Integer, y As Integer, x1 As Integer, y1 As Integer
  1809.   DoEvents
  1810.   DoEvents
  1811.   If GetSize(FileName$) = 0 Then Exit Sub
  1812.   DC = CreateDC("DISPLAY", 0&, 0&, 0&)
  1813.   'limit sizes
  1814.   If PicWidth > ScrnWidth Then PicWidth = ScrnWidth
  1815.   If PicHeight > ScrnHeight Then PicHeight = ScrnHeight
  1816.   If (PicWidth < ScrnWidth) Or (PicHeight < ScrnHeight) Then
  1817.     'need to center picture
  1818.     'first backup picture
  1819.     BitBlt Original.hDC, 0, 0, PicWidth, PicHeight, DC, 0, 0, &HCC0020
  1820.     'clear original
  1821.     Picture = LoadPicture()
  1822.     ' now copy back centered
  1823.     x = ScrnWidth / 2 - PicWidth / 2
  1824.     y = ScrnHeight / 2 - PicHeight / 2
  1825.     BitBlt DC, x, y, PicWidth, PicHeight, Original.hDC, 0, 0, &HCC0020
  1826.   End If
  1827.   If (PicWidth < ScrnWidth) Then 'fill row
  1828.     '1st copy left
  1829.     x1 = x
  1830.     While x1 > 0
  1831.       BitBlt DC, x1 - PicWidth, 0, PicWidth, ScrnHeight, DC, x, 0, &HCC0020
  1832.       x1 = x1 - PicWidth
  1833.     Wend
  1834.     'next copy right
  1835.     x1 = x
  1836.     While x1 < ScrnWidth
  1837.       BitBlt DC, x1 + PicWidth, 0, PicWidth, ScrnHeight, DC, x, 0, &HCC0020
  1838.       x1 = x1 + PicWidth
  1839.     Wend
  1840.   End If
  1841.   If (PicHeight < ScrnHeight) Then
  1842.     '1st copy up
  1843.     y1 = y
  1844.     While y1 > 0
  1845.       BitBlt DC, 0, y1 - PicHeight, ScrnWidth, PicHeight, DC, 0, y, &HCC0020
  1846.       y1 = y1 - PicHeight
  1847.     Wend
  1848.     'next copy down
  1849.     y1 = y
  1850.     While y1 < ScrnHeight
  1851.       BitBlt DC, 0, y1 + PicHeight, ScrnWidth, PicHeight, DC, 0, y, &HCC0020
  1852.       y1 = y1 + PicHeight
  1853.     Wend
  1854.   End If
  1855.   DeleteDC DC
  1856. End Sub
  1857. Sub Roll ()
  1858.   ' the display rolls both horizontally and vertically
  1859.   Dim v As Integer
  1860.   ' if first time then initialize
  1861.   If PlotInit = False Then
  1862.     'see if we need to reset changes made from previous init
  1863.     If PlotEnd = False Then
  1864.       'see if we just want the priority for this saver
  1865.       If PlotPriority = True Then
  1866.     '1 is normal priority, adjust up to show more often, or down ...
  1867.     Priority = 1#
  1868.     Exit Sub
  1869.       End If
  1870.     'check if runing low memory mode
  1871.     If CheckIfValidMode(1) = 0 Then
  1872.       Exit Sub
  1873.     End If
  1874.     ' start with original screen
  1875.     Picture = Original.Image
  1876.     PlotInit = True
  1877.     'Calculate velocity limits
  1878.     MaxSpeedX = ScaleWidth * 15! / 800
  1879.     MaxSpeedY = ScaleWidth * 15! / 600
  1880.     ' initial velocities
  1881.     vy1 = 0: vx1 = 0
  1882.     ' initial offset
  1883.     x1 = 0: y1 = 0
  1884.     Direction = Rnd * 2: If Direction > 1 Then Direction = 0
  1885.   Else 'reset changes done by previous init
  1886.     Picture = LoadPicture() ' clear screen
  1887.   End If
  1888.   Else  ' put run code here
  1889.     DC = Original.hDC
  1890.     If Direction Then
  1891.     ' do vertical scroll
  1892.     BitBlt hDC, 0, y1, ScaleWidth, ScaleHeight - y1, DC, 0, 0, &HCC0020
  1893.     BitBlt hDC, 0, 0, ScaleWidth, y1, DC, 0, ScaleHeight - y1, &HCC0020
  1894.     Else
  1895.     ' do horizontal scroll
  1896.     BitBlt hDC, x1, 0, ScaleWidth - x1, ScaleHeight, DC, 0, 0, &HCC0020
  1897.     BitBlt hDC, 0, 0, x1, ScaleHeight, DC, ScaleWidth - x1, 0, &HCC0020
  1898.     End If
  1899.     'determine new acceleration
  1900.     ax1 = Rnd - .5
  1901.     ay1 = Rnd - .5
  1902.         
  1903.     'calculate new velocity
  1904.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  1905.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  1906.     'find new roll amount
  1907.     x1 = x1 + vx1
  1908.     If x1 > ScaleWidth Then
  1909.     x1 = x1 - ScaleWidth
  1910.     Else
  1911.     If x1 < 0 Then
  1912.         x1 = x1 + ScaleWidth
  1913.     End If
  1914.     End If
  1915.         
  1916.     y1 = y1 + vy1
  1917.     If y1 > ScaleHeight Then
  1918.     y1 = y1 - ScaleHeight
  1919.     Else
  1920.     If y1 < 0 Then
  1921.         y1 = y1 + ScaleHeight
  1922.     End If
  1923.     End If
  1924.         
  1925.   End If
  1926. End Sub
  1927. Sub RunSelection ()
  1928.     ' execute the appropriate selection
  1929.     Select Case PlotType
  1930.     Case 1: Squiggles
  1931.     Case 2: Kalied2
  1932.     Case 3: Polygons
  1933.     Case 4: Circles
  1934.     Case 5: Kalied
  1935.     Case 6: Lines
  1936.     Case 7: Roll
  1937.     Case 8: FilledCircles
  1938.     Case 9: Patch
  1939.     Case 10: Spiro
  1940.     Case 11: Scrape
  1941.     Case 12: Stretch
  1942.     Case 13: Dribble
  1943.     Case 14: Drop
  1944.     Case 15: Slides
  1945.     Case 16: FilledPolygons
  1946.     Case 17: MultiSpiros
  1947.     Case 18: Puzzle
  1948.     Case Else: PlotType = 1
  1949.            RunSelection ' try again
  1950.     End Select
  1951. End Sub
  1952. Sub Scrape ()
  1953.   ' bitblt's with various patterns, dragging them
  1954.   ' across the screen randomly
  1955.   ' if first time then initialize
  1956.   If PlotInit = False Then
  1957.     'see if we need to reset changes made from previous init
  1958.     If PlotEnd = False Then
  1959.       'see if we just want the priority for this saver
  1960.       If PlotPriority = True Then
  1961.     '1 is normal priority, adjust up to show more often, or down ...
  1962.     Priority = 1#
  1963.     Exit Sub
  1964.       End If
  1965.     'check if runing low memory mode
  1966.     If CheckIfValidMode(1) = 0 Then
  1967.       Exit Sub
  1968.     End If
  1969.     ' start with original screen
  1970.     Picture = Original.Image
  1971.     PlotInit = True
  1972.     'determine initial position of line
  1973.     x1 = Rnd * ScaleWidth
  1974.     y1 = Rnd * ScaleHeight
  1975.     'Calculate velocity limits
  1976.     MaxSpeedX = ScaleWidth * 15! / 800
  1977.     MaxSpeedY = ScaleWidth * 15! / 600
  1978.     BoxHeight = 400 * Rnd ^ 3 + 20
  1979.     Boxwidth = (400 * Rnd ^ 3 + 20) * (8# / 6#)
  1980.     ' zero initial velocity
  1981.     vx1 = 0: vy1 = 0
  1982.     ' choose scrape type at random
  1983.     i = Rnd * 11
  1984.     Select Case i
  1985.     Case 0: Pattern = &H42 'Black Out
  1986.         Locked = True
  1987.     Case 1: Pattern = &HFF0062 'White Out
  1988.         Locked = True
  1989.     Case 2: Pattern = &HBB0226 'MergePaint
  1990.         Locked = False
  1991.     Case 3: Pattern = &H330008 'Not source copy
  1992.         Locked = True
  1993.     Case 4: Pattern = &H330008 'Not source copy
  1994.         Locked = False
  1995.     Case 5: Pattern = &H660046 'source invert
  1996.         Locked = True
  1997.     Case 6: Pattern = &H8800C6 'source and
  1998.         Locked = False
  1999.     Case 7: Pattern = &HEE0086 'source paint (or)
  2000.         Locked = False
  2001.     Case 8: Pattern = &H550009 'Invert Destination
  2002.         Locked = True
  2003.     Case 9: Pattern = &HCC0020 'Source Copy
  2004.         Locked = False
  2005.     Case Else: Pattern = &HCC0020 'Source Copy
  2006.         Locked = True
  2007.         Picture = LoadPicture() ' start with blank screen
  2008.     End Select
  2009.   Else 'reset changes done by previous init
  2010.     Picture = LoadPicture() ' start with blank screen
  2011.   End If
  2012.   Else  ' put run code here
  2013.     ' do locking if necessary
  2014.     If Locked Then
  2015.         x2 = x1: y2 = y1
  2016.     Else 'do offset
  2017.         x2 = x1 + Boxwidth: If x2 + Boxwidth > ScaleWidth Then x2 = 0
  2018.         y2 = y1 + BoxHeight: If y2 + BoxHeight > ScaleHeight Then y2 = 0
  2019.     End If
  2020.     'BitBlt Box at x1,y1
  2021.     DC = Original.hDC
  2022.     BitBlt hDC, x1, y1, Boxwidth, BoxHeight, DC, x2, y2, Pattern
  2023.     'determine new acceleration
  2024.     ax1 = Rnd - .5
  2025.     ay1 = Rnd - .5
  2026.         
  2027.     'calculate new position
  2028.     x1 = x1 + vx1
  2029.     y1 = y1 + vy1
  2030.         
  2031.     'calculate new velocity
  2032.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  2033.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  2034.         
  2035.     'check if off screen
  2036.     If (x1 > ScaleWidth - Boxwidth) Then
  2037.         'change direction
  2038.         vx1 = -Abs(vx1)
  2039.     ElseIf (x1 < 0) Then
  2040.         'change direction
  2041.         vx1 = Abs(vx1)
  2042.     End If
  2043.     If (y1 > ScaleHeight - BoxHeight) Then
  2044.         'change direction
  2045.         vy1 = -Abs(vy1)
  2046.     ElseIf (y1 < 0) Then
  2047.         'change direction
  2048.         vy1 = Abs(vy1)
  2049.     End If
  2050.   End If
  2051. End Sub
  2052. Sub Slides ()
  2053.   'cycle between different bitmaps
  2054.   Dim j As Integer
  2055.   Static file As String
  2056.   Static OldTime As Long
  2057.   Static running As Integer
  2058.   Dim CurTime As Long
  2059.   Dim FileName As String
  2060.   ' if first time then initialize
  2061.   If PlotInit = False Then
  2062.     'see if we need to reset changes made from previous init
  2063.     If PlotEnd = False Then
  2064.       'see if we just want the priority for this saver
  2065.       If PlotPriority = True Then
  2066.     '1 is normal priority, adjust up to show more often, or down ...
  2067.     Priority = 1#
  2068.     Exit Sub
  2069.       End If
  2070.     'check if runing low memory mode
  2071.     If CheckIfValidMode(1) = 0 Then
  2072.       Exit Sub
  2073.     End If
  2074.     j = Rnd * 50
  2075.     FileName = BitmapsDir
  2076.     FileName = RTrim$(FileName)
  2077.     FileName = FileName + "\*.bmp"
  2078.     On Error GoTo 115
  2079.     file = Dir$(FileName)' get first file in directory
  2080.     On Error GoTo 0
  2081.     If file = "" Then
  2082.       NextSelection 'jump to next since there are no bitmap files in directory
  2083.       Exit Sub
  2084.     End If
  2085.     For i = 1 To j
  2086.       file = Dir$ ' get next file
  2087.       If file = "" Then
  2088.     FileName = BitmapsDir + "\*.bmp"
  2089.     file = Dir$(FileName)' get first file in directory
  2090.       End If
  2091.     Next i
  2092.     OldTime = Timer
  2093.     running = False
  2094.     On Error GoTo 116
  2095.     Picture = LoadPicture(BitmapsDir + "\" + file)
  2096.     On Error GoTo 0
  2097.     Replicate (BitmapsDir + "\" + file)
  2098.     PlotInit = True
  2099.   Else 'reset changes done by previous init
  2100.       ' save screen in place of original for latter use
  2101.       ' we do this because on palette based systems
  2102.       ' the slide procedure messes up the color
  2103.       ' palette and the Clipboard.setData 9 and
  2104.       ' Clipboard.GetData(9) sequence does not restore
  2105.       ' it, so we just use the new picture with the
  2106.       ' new palette from now on
  2107.       DC = CreateDC("DISPLAY", 0&, 0&, 0&)
  2108.       BitBlt Original.hDC, 0, 0, ScrnWidth, ScrnHeight, DC, 0, 0, &HCC0020
  2109.       DeleteDC DC
  2110.     Picture = LoadPicture() ' clear screen
  2111.   End If
  2112. Else  ' put run code here
  2113.     If running Then Exit Sub ' no recursive calls
  2114.     If file = "" Then Exit Sub
  2115.     CurTime = Timer
  2116.     If (CurTime >= OldTime) And ((OldTime + BmpSeconds) > CurTime) Then Exit Sub
  2117.     OldTime = Timer
  2118.     running = True
  2119.     j = Rnd * 20
  2120.     For i = 1 To j
  2121.       file = Dir$ ' get next file
  2122.       If file = "" Then
  2123.     FileName = BitmapsDir + "\*.bmp"
  2124.     file = Dir$(FileName)' get first file in directory
  2125.       End If
  2126.     Next i
  2127.     Picture = LoadPicture(BitmapsDir + "\" + file)
  2128.     Replicate (BitmapsDir + "\" + file)
  2129.   End If
  2130.   running = False
  2131.   Exit Sub
  2132. 115 'directory path does not exist
  2133.   On Error GoTo 0
  2134.   LogFile ("Could not find file " + FileName)
  2135.   Resume 117
  2136. 116 'directory path does not exist
  2137.   On Error GoTo 0
  2138.   LogFile ("Out of Memory.  Could not load file " + BitmapsDir + "\" + file)
  2139.   Resume 117
  2140. 117 NextSelection 'jump to next since there are no bitmap files in directory
  2141.   Exit Sub
  2142. End Sub
  2143. Sub Spiro ()
  2144.   'Do spirograph like figures
  2145.   'reserve memory
  2146.   Const Deg2Pi = PI / 180
  2147.   Static MaxRad As Integer'maximum radius for circles
  2148.   Const MaxNodes = 35'maximum number of nodes on spiro
  2149.   Dim Nodes As Integer
  2150.   Const MaxRpts = 7'max times to go around circle
  2151.   Dim Rpts As Integer
  2152.   Const PlotPoints = 4'number of points to plot each time
  2153.   Const ClearCount = 3'number on screen before clearing
  2154.   Static PlotAngleIncr As Single
  2155.   Static PlotEndAngle As Single
  2156.   Static PlotAngle As Single
  2157.   Static SinIncr As Single
  2158.   Static SinAngle As Single
  2159.   Static Xcenter As Integer
  2160.   Static Ycenter As Integer
  2161.   Static Rad1 As Integer
  2162.   Static Rad2 As Integer
  2163.   Dim R As Single
  2164.   Dim i As Long, j As Long, k As Long, l As Integer
  2165.   ' if first time then initialize
  2166.   If PlotInit = False Then
  2167.     'see if we need to reset changes made from previous init
  2168.     If PlotEnd = False Then
  2169.       'see if we just want the priority for this saver
  2170.       If PlotPriority = True Then
  2171.     '1 is normal priority, adjust up to show more often, or down ...
  2172.     Priority = 1#
  2173.     Exit Sub
  2174.       End If
  2175.     'check if runing low memory mode
  2176.     If CheckIfValidMode(0) = 0 Then
  2177.       Exit Sub
  2178.     End If
  2179.       PlotInit = True
  2180.       ForeColor = RGB(255, 255, 255)
  2181.       BackColor = RGB(0, 0, 0)
  2182.       Cls
  2183.      'initialize variables used
  2184.      PlotEndAngle = 0
  2185.      PlotAngle = 10
  2186.      MaxRad = ScaleHeight / 3'maximum radius for circles
  2187.      Pointer = 0
  2188.     Else 'reset changes done by previous init
  2189.       DrawWidth = 1' use narrow line
  2190.     End If
  2191.   Else  ' put run code here
  2192.     ' check if time to do new spiro
  2193.     If PlotAngle > PlotEndAngle Then
  2194.     'set foreground color
  2195.       i = Rnd * 255: If i > 255 Then i = 255
  2196.       j = Rnd * 255: If j > 255 Then j = 255
  2197.       k = Rnd * 255: If k > 255 Then k = 255
  2198.     Loop Until (i * i + j * j + k * k) > MinColor'make sure color if sufficiently bright
  2199.     ForeColor = RGB(i, j, k)
  2200.     PlotAngle = Rnd * 180 * Deg2Pi'initial offset
  2201.     Rpts = Rnd * MaxRpts + .5
  2202.     PlotAngleIncr = .125 * Rpts * Deg2Pi
  2203.     PlotEndAngle = 360 * Rpts * Deg2Pi + PlotAngle + PlotAngleIncr
  2204.     Nodes = Rnd * MaxNodes + .5
  2205.     SinIncr = PlotAngleIncr * Nodes / Rpts
  2206.     SinAngle = 0
  2207.     Rad1 = MaxRad * Rnd
  2208.     Rad2 = MaxRad * Rnd
  2209.     Xcenter = Rnd * ScaleWidth * 3 / 4 + ScaleWidth / 8
  2210.     Ycenter = Rnd * ScaleHeight * 3 / 4 + ScaleHeight / 8
  2211.     DrawWidth = 1 + 2 * Rnd' use narrow line
  2212.     GoSub 2000 'calculate x1 and y1
  2213.     Pointer = Pointer + 1
  2214.     If Pointer >= ClearCount Then
  2215.       Cls
  2216.       Pointer = 0
  2217.     End If
  2218.     End If
  2219.     For l = 1 To PlotPoints
  2220.       GoSub 2000 'calculate x1 and y1
  2221.       'draw line
  2222.       Line (LastX, LastY)-(x1, y1)
  2223.     Next l
  2224.   End If
  2225.   Exit Sub
  2226. 2000 'calculate new point on screen
  2227.   LastX = x1: LastY = y1
  2228.   R = Rad1 + Rad2 * Sin(SinAngle)
  2229.   x1 = R * Cos(PlotAngle) + Xcenter
  2230.   y1 = R * Sin(PlotAngle) + Ycenter
  2231.   SinAngle = SinAngle + SinIncr
  2232.   PlotAngle = PlotAngle + PlotAngleIncr
  2233.   Return
  2234. End Sub
  2235. Sub Squiggles ()
  2236.   ' draw multiple squiggles on the screen.
  2237.   ' each squiggle is assign a random color at the
  2238.   ' start, then the head travels randomly and the
  2239.   ' tail is erased
  2240.   Dim i As Integer, j As Integer, k As Integer, ii As Integer, n As Integer
  2241.   Dim il As Long, jl As Long, kl As Long
  2242.   Static SquigNumb As Integer
  2243.   Static SquigLen As Integer
  2244.   Static EndPointer As Integer, StartPointer As Integer
  2245.   ' if first time then initialize
  2246.   If PlotInit = False Then
  2247.     'see if we need to reset changes made from previous init
  2248.     If PlotEnd = False Then
  2249.       'see if we just want the priority for this saver
  2250.       If PlotPriority = True Then
  2251.     '1 is normal priority, adjust up to show more often, or down ...
  2252.     Priority = 1#
  2253.     Exit Sub
  2254.       End If
  2255.     'check if runing low memory mode
  2256.     If CheckIfValidMode(0) = 0 Then
  2257.       Exit Sub
  2258.     End If
  2259.     PlotInit = True
  2260.     Cls
  2261.     ForeColor = QBColor(15)
  2262.     SquigNumb = Rnd * 10 + 10
  2263.     SquigLen = Rnd * 100 + 50
  2264.     'Allocate Memory
  2265.     ReDim x1da(SquigLen, SquigNumb)  As Integer
  2266.     ReDim y1da(SquigLen, SquigNumb)  As Integer
  2267.     ReDim x1sa(SquigNumb) As Single
  2268.     ReDim y1sa(SquigNumb) As Single
  2269.     ReDim vx1sa(SquigNumb) As Single
  2270.     ReDim vy1sa(SquigNumb) As Single
  2271.     ReDim ax1sa(SquigNumb) As Single
  2272.     ReDim ay1sa(SquigNumb) As Single
  2273.     ReDim Colors(SquigNumb) As Long
  2274.     Pointer = 1
  2275.     'Print "Clearing Array"
  2276.     For j = 1 To SquigNumb
  2277.     'determine initial position of line
  2278.     x1sa(j) = Rnd * ScaleWidth
  2279.     y1sa(j) = Rnd * ScaleHeight
  2280.     For i = 1 To SquigLen
  2281.         x1da(i, j) = x1sa(j)
  2282.         y1da(i, j) = y1sa(j)
  2283.     Next i
  2284.     Next j
  2285.     'find background color
  2286.     m = QBColor(0)
  2287.     ' use rgb function to get colors
  2288.     For ii = 1 To SquigNumb
  2289.       il = Rnd * 255: If il > 255 Then il = 255
  2290.       jl = Rnd * 255: If jl > 255 Then jl = 255
  2291.       kl = Rnd * 255: If kl > 255 Then kl = 255
  2292.     Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  2293.     Colors(ii) = RGB(il, jl, kl)
  2294.     Next ii
  2295.     'Calculate velocity limits
  2296.     MaxSpeedX = ScaleWidth * 15! / 800
  2297.     MaxSpeedY = ScaleWidth * 15! / 600
  2298.   Else 'reset changes done by previous init
  2299.     ReDim x1da(0, 0)  As Integer
  2300.     ReDim y1da(0, 0)  As Integer
  2301.     ReDim x1sa(0) As Single
  2302.     ReDim y1sa(0) As Single
  2303.     ReDim vx1sa(0) As Single
  2304.     ReDim vy1sa(0) As Single
  2305.     ReDim ax1sa(0) As Single
  2306.     ReDim ay1sa(0) As Single
  2307.     ReDim Colors(0) As Long
  2308.   End If
  2309.   Else  ' put run code here
  2310.     'find where tail line went to
  2311.     If Pointer < SquigLen Then
  2312.         EndPointer = Pointer + 1
  2313.     Else
  2314.         EndPointer = 1
  2315.     End If
  2316.     'find where new line goes
  2317.     If Pointer > 1 Then
  2318.         StartPointer = Pointer - 1
  2319.     Else
  2320.         StartPointer = SquigLen
  2321.     End If
  2322.     If Rnd < .1 Then 'change a color 10% of the time
  2323.       ii = Int(Rnd * SquigNumb + 1)' get random squiggle to change
  2324.       If ii > SquigNumb Then ii = 1
  2325.       Do
  2326.         il = Rnd * 255: If il > 255 Then il = 255
  2327.         jl = Rnd * 255: If jl > 255 Then jl = 255
  2328.         kl = Rnd * 255: If kl > 255 Then kl = 255
  2329.       Loop Until (il * il + jl * jl + kl * kl) > MinColor'make sure color if sufficiently bright
  2330.       Colors(ii) = RGB(il, jl, kl)
  2331.     End If
  2332.     For j = 1 To SquigNumb
  2333.         'Erase tails of squigles
  2334.         Line (x1da(Pointer, j), y1da(Pointer, j))-(x1da(EndPointer, j), y1da(EndPointer, j)), m
  2335.         'Save new points
  2336.         x1da(Pointer, j) = x1sa(j)
  2337.         y1da(Pointer, j) = y1sa(j)
  2338.         'Draw front of Squigles
  2339.         Line (x1da(StartPointer, j), y1da(StartPointer, j))-(x1da(Pointer, j), y1da(Pointer, j)), Colors(j)
  2340.     Next j
  2341.     'Move pointer to next item
  2342.     Pointer = Pointer + 1
  2343.     If Pointer > SquigLen Then
  2344.         Pointer = 1
  2345.     End If
  2346.     For j = 1 To SquigNumb
  2347.         'determine new acceleration
  2348.         ax1sa(j) = Rnd * 4 - 2
  2349.         ay1sa(j) = Rnd * 4 - 2
  2350.         'calculate new position
  2351.         x1sa(j) = x1sa(j) + vx1sa(j)
  2352.         y1sa(j) = y1sa(j) + vy1sa(j)
  2353.         'calculate new velocity
  2354.         vx1sa(j) = (vx1sa(j) + ax1sa(j)): If Abs(vx1sa(j)) > 20 Then vx1sa(j) = 0: ax1sa(j) = 0
  2355.         vy1sa(j) = (vy1sa(j) + ay1sa(j)): If Abs(vy1sa(j)) > 20 Then vy1sa(j) = 0: ay1sa(j) = 0
  2356.         'check if off screen
  2357.         If (x1sa(j) > ScaleWidth) Then
  2358.         x1sa(j) = ScaleWidth
  2359.         'change direction
  2360.         vx1sa(j) = -Abs(vx1sa(j))
  2361.         ElseIf (x1sa(j) < 0) Then
  2362.         x1sa(j) = 0
  2363.         'change direction
  2364.         vx1sa(j) = Abs(vx1sa(j))
  2365.         End If
  2366.         If (y1sa(j) > ScaleHeight) Then
  2367.         y1sa(j) = ScaleHeight
  2368.         'change direction
  2369.         vy1sa(j) = -Abs(vy1sa(j))
  2370.         ElseIf (y1sa(j) < 0) Then
  2371.         y1sa(j) = 0
  2372.         'change direction
  2373.         vy1sa(j) = Abs(vy1sa(j))
  2374.         End If
  2375.     Next j
  2376.   End If
  2377. End Sub
  2378. Sub Stretch ()
  2379.     Dim x As Integer, y As Integer
  2380.     Dim NumColors As Single
  2381.   ' does a StretchBlt from a random box within the Original
  2382.   ' image and then displays it on the screen
  2383.   ' if first time then initialize
  2384.   If PlotInit = False Then
  2385.     'see if we need to reset changes made from previous init
  2386.     If PlotEnd = False Then
  2387.       'see if we just want the priority for this saver
  2388.       If PlotPriority = True Then
  2389.     '1 is normal priority, adjust up to show more often, or down ...
  2390.     Priority = 1#
  2391.     Exit Sub
  2392.       End If
  2393.     'check if runing low memory mode
  2394.     If CheckIfValidMode(2) = 0 Then
  2395.       Exit Sub
  2396.     End If
  2397.     'see how many colors display can handle
  2398.     NumColors = NumberOfColors()
  2399.     If NumColors <= 256 Then 'see if palette based
  2400.       LogFile ("Saver does not work in palette display mode: " + Str$(PlotType))
  2401.       NextSelection 'jump to next since this does not work
  2402.             'well with palettes
  2403.       Exit Sub
  2404.     End If
  2405.     ' set tick rate down
  2406.     Tick.Interval = 300
  2407.     ' start with original screen
  2408.     Picture = Original.Image
  2409.     ' start temp form same as original
  2410.     DC = Original.hDC
  2411.     BitBlt hDC, 0, 0, ScaleWidth, ScaleHeight, DC, 0, 0, &HCC0020
  2412.     BitBlt Temp.hDC, 0, 0, ScaleWidth, ScaleHeight, hDC, 0, 0, &HCC0020
  2413.     PlotInit = True
  2414.     'initial position is 1:1 copy
  2415.     x1 = 0
  2416.     y1 = 0
  2417.     x2 = ScaleWidth
  2418.     y2 = ScaleHeight
  2419.     'Calculate velocity limits
  2420.     MaxSpeedX = ScaleWidth * 15! / 800
  2421.     MaxSpeedY = ScaleWidth * 15! / 600
  2422.     ' zero initial velocity
  2423.     vx1 = MaxSpeedX * Rnd
  2424.     vy1 = MaxSpeedY * Rnd
  2425.     vx2 = -MaxSpeedX * Rnd
  2426.     vy2 = -MaxSpeedY * Rnd
  2427.     Pattern = &HCC0020 'Source Copy
  2428.   Else 'reset changes done by previous init
  2429.     Picture = LoadPicture() ' clear screen
  2430.     'reset tick rate
  2431.     Tick.Interval = 50
  2432.   End If
  2433.   Else  ' put run code here
  2434.     'make sure x1,y1 less than x2,y2 or swap
  2435.     If x1 > x2 Then x = x1: x1 = x2: x2 = x
  2436.     If y1 > y2 Then y = y1: y1 = y2: y2 = y
  2437.     'make sure that source box size does not
  2438.     'go below a minimum
  2439.     If x2 - x1 < 40 Then x2 = x1 + 40
  2440.     If y2 - y1 < 40 Then y2 = y1 + 40
  2441.     'Stretch Box from x1,y1 to x2,y2 onto display
  2442.     DC = Original.hDC
  2443.     x = x2 - x1: y = y2 - y1
  2444.     i = StretchBlt(Temp.hDC, ByVal 0, ByVal 0, ScaleWidth, ScaleHeight, DC, x1, y1, x, y, &HCC0020)
  2445.     'i = StretchBlt(hDC, ByVal 0, ByVal 0, ScaleWidth, ScaleHeight, DC, x1, y1, x, y, &HCC0020)
  2446.     ' now that it has been stretched, write to display
  2447.     DC = Temp.hDC
  2448.     BitBlt hDC, 0, 0, ScaleWidth, ScaleHeight, DC, 0, 0, &HCC0020
  2449.     'determine new acceleration
  2450.     ax1 = Rnd - .5
  2451.     ay1 = Rnd - .5
  2452.     ax2 = Rnd - .5
  2453.     ay2 = Rnd - .5
  2454.         
  2455.     'calculate new position
  2456.     x1 = x1 + vx1
  2457.     y1 = y1 + vy1
  2458.     x2 = x2 + vx2
  2459.     y2 = y2 + vy2
  2460.     'calculate new velocity
  2461.     vx1 = (vx1 + ax1): If Abs(vx1) > MaxSpeedX Then vx1 = 0: ax1 = 0
  2462.     vy1 = (vy1 + ay1): If Abs(vy1) > MaxSpeedY Then vy1 = 0: ay1 = 0
  2463.     vx2 = (vx2 + ax2): If Abs(vx2) > MaxSpeedX Then vx2 = 0: ax2 = 0
  2464.     vy2 = (vy2 + ay2): If Abs(vy2) > MaxSpeedY Then vy2 = 0: ay2 = 0
  2465.     'check if off screen
  2466.     If (x1 >= ScaleWidth) Then
  2467.         'change direction
  2468.         vx1 = -Abs(vx1)
  2469.         x1 = ScaleWidth - 1
  2470.     ElseIf (x1 < 0) Then
  2471.         'change direction
  2472.         vx1 = Abs(vx1)
  2473.         x1 = 0
  2474.     End If
  2475.     If (y1 >= ScaleHeight) Then
  2476.         'change direction
  2477.         vy1 = -Abs(vy1)
  2478.         y1 = ScaleHeight - 1
  2479.     ElseIf (y1 < 0) Then
  2480.         'change direction
  2481.         vy1 = Abs(vy1)
  2482.         y1 = 0
  2483.     End If
  2484.     'check if off screen
  2485.     If (x2 >= ScaleWidth) Then
  2486.         'change direction
  2487.         vx2 = -Abs(vx2)
  2488.         x2 = ScaleWidth - 1
  2489.     ElseIf (x2 < 0) Then
  2490.         'change direction
  2491.         vx2 = Abs(vx2)
  2492.         x2 = 0
  2493.     End If
  2494.     If (y2 >= ScaleHeight) Then
  2495.         'change direction
  2496.         vy2 = -Abs(vy2)
  2497.         y2 = ScaleHeight - 1
  2498.     ElseIf (y2 < 0) Then
  2499.         'change direction
  2500.         vy2 = Abs(vy2)
  2501.         y2 = 0
  2502.     End If
  2503.   End If
  2504. End Sub
  2505. Sub Tick_Timer ()
  2506.     ' check elapsed time to see if need to change type of plot
  2507.     ' also check if past midnight
  2508.     CurrentTime = Timer
  2509.     If (CurrentTime > MaxTime) Or (LastTime > CurrentTime) Then
  2510.     MaxTime = MaxChangeMinutes * 60 + CurrentTime ' calculate time in seconds
  2511.     ' make sure form is still on top
  2512.     ZOrder 0
  2513.     'clear old saver
  2514.     PlotInit = False: PlotEnd = True
  2515.     PlotPriority = False
  2516.     LogFile ("Cleanup after " + Str$(PlotType))
  2517.     RunSelection 'just clean up after running
  2518.     'see if we want random selection
  2519.     NextSelection 'get new PlotType
  2520.     PlotInit = False: PlotEnd = False
  2521.     End If
  2522.     LastTime = CurrentTime
  2523.     RunSelection
  2524. End Sub
  2525.