home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / geodem / csc5.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  44.3 KB  |  1,362 lines

  1. VERSION 2.00
  2. Begin Form XView 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "CyberSpace Cruiser"
  6.    ClientHeight    =   7005
  7.    ClientLeft      =   1050
  8.    ClientTop       =   1770
  9.    ClientWidth     =   8670
  10.    Height          =   7695
  11.    Icon            =   CSC5.FRX:0000
  12.    Left            =   990
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   7005
  17.    ScaleMode       =   0  'User
  18.    ScaleTop        =   500
  19.    ScaleWidth      =   8670
  20.    Top             =   1140
  21.    Width           =   8790
  22.    Begin CommandButton MinusButton 
  23.       Caption         =   "-1"
  24.       Height          =   255
  25.       Left            =   5880
  26.       TabIndex        =   20
  27.       Top             =   6600
  28.       Visible         =   0   'False
  29.       Width           =   495
  30.    End
  31.    Begin CommandButton PlusButton 
  32.       Caption         =   "+1"
  33.       Height          =   255
  34.       Left            =   5880
  35.       TabIndex        =   19
  36.       Top             =   6360
  37.       Visible         =   0   'False
  38.       Width           =   495
  39.    End
  40.    Begin PictureBox Picture3 
  41.       BackColor       =   &H00C0C0C0&
  42.       BorderStyle     =   0  'None
  43.       Height          =   495
  44.       Left            =   720
  45.       ScaleHeight     =   495
  46.       ScaleWidth      =   5055
  47.       TabIndex        =   6
  48.       Top             =   6360
  49.       Width           =   5055
  50.       Begin HScrollBar PanLRScroll 
  51.          Height          =   255
  52.          LargeChange     =   10
  53.          Left            =   120
  54.          Max             =   181
  55.          Min             =   -181
  56.          TabIndex        =   9
  57.          Top             =   120
  58.          Width           =   4815
  59.       End
  60.    End
  61.    Begin CommandButton AFButton 
  62.       Caption         =   "AF"
  63.       Height          =   495
  64.       Left            =   120
  65.       TabIndex        =   21
  66.       Top             =   6360
  67.       Visible         =   0   'False
  68.       Width           =   495
  69.    End
  70.    Begin CheckBox SCCheck 
  71.       BackColor       =   &H00C0C0C0&
  72.       Caption         =   "Spin the cube"
  73.       ForeColor       =   &H00808080&
  74.       Height          =   255
  75.       Left            =   6600
  76.       TabIndex        =   22
  77.       Top             =   3960
  78.       Width           =   1815
  79.    End
  80.    Begin PictureBox Picture5 
  81.       BackColor       =   &H00C0C0C0&
  82.       BorderStyle     =   0  'None
  83.       Height          =   1935
  84.       Left            =   6480
  85.       ScaleHeight     =   1935
  86.       ScaleWidth      =   2055
  87.       TabIndex        =   11
  88.       Top             =   1800
  89.       Width           =   2055
  90.       Begin Label Label5 
  91.          BackColor       =   &H00C0C0C0&
  92.          Caption         =   "Label5"
  93.          ForeColor       =   &H00808080&
  94.          Height          =   255
  95.          Left            =   120
  96.          TabIndex        =   16
  97.          Top             =   1560
  98.          Width           =   1815
  99.       End
  100.       Begin Label Label4 
  101.          BackColor       =   &H00C0C0C0&
  102.          Caption         =   "Label4"
  103.          ForeColor       =   &H00808080&
  104.          Height          =   255
  105.          Left            =   120
  106.          TabIndex        =   15
  107.          Top             =   1200
  108.          Width           =   1815
  109.       End
  110.       Begin Label Label3 
  111.          BackColor       =   &H00C0C0C0&
  112.          Caption         =   "Label3"
  113.          ForeColor       =   &H00808080&
  114.          Height          =   255
  115.          Left            =   120
  116.          TabIndex        =   14
  117.          Top             =   840
  118.          Width           =   1815
  119.       End
  120.       Begin Label Label2 
  121.          BackColor       =   &H00C0C0C0&
  122.          Caption         =   "Label2"
  123.          ForeColor       =   &H00808080&
  124.          Height          =   255
  125.          Left            =   120
  126.          TabIndex        =   13
  127.          Top             =   480
  128.          Width           =   1815
  129.       End
  130.       Begin Label Label1 
  131.          BackColor       =   &H00C0C0C0&
  132.          Caption         =   "Label1"
  133.          ForeColor       =   &H00808080&
  134.          Height          =   255
  135.          Left            =   120
  136.          TabIndex        =   12
  137.          Top             =   120
  138.          Width           =   1815
  139.       End
  140.    End
  141.    Begin PictureBox Picture4 
  142.       BackColor       =   &H00C0C0C0&
  143.       BorderStyle     =   0  'None
  144.       Height          =   5055
  145.       Left            =   5880
  146.       ScaleHeight     =   5055
  147.       ScaleWidth      =   495
  148.       TabIndex        =   7
  149.       Top             =   1200
  150.       Width           =   495
  151.       Begin VScrollBar BackForScroll 
  152.          Height          =   4815
  153.          LargeChange     =   100
  154.          Left            =   120
  155.          Max             =   5000
  156.          Min             =   -5000
  157.          SmallChange     =   10
  158.          TabIndex        =   8
  159.          Top             =   120
  160.          Width           =   255
  161.       End
  162.    End
  163.    Begin PictureBox ViewPic 
  164.       AutoRedraw      =   -1  'True
  165.       BackColor       =   &H00C0C0C0&
  166.       BorderStyle     =   0  'None
  167.       Height          =   5055
  168.       Left            =   720
  169.       ScaleHeight     =   337
  170.       ScaleMode       =   3  'Pixel
  171.       ScaleWidth      =   337
  172.       TabIndex        =   0
  173.       Top             =   1200
  174.       Width           =   5055
  175.    End
  176.    Begin PictureBox Picture1 
  177.       BackColor       =   &H00C0C0C0&
  178.       BorderStyle     =   0  'None
  179.       Height          =   5055
  180.       Left            =   120
  181.       ScaleHeight     =   5055
  182.       ScaleWidth      =   495
  183.       TabIndex        =   5
  184.       Top             =   1200
  185.       Width           =   495
  186.       Begin VScrollBar PanUDScroll 
  187.          Height          =   4815
  188.          LargeChange     =   10
  189.          Left            =   120
  190.          Max             =   90
  191.          Min             =   -90
  192.          TabIndex        =   10
  193.          Top             =   120
  194.          Width           =   255
  195.       End
  196.    End
  197.    Begin PictureBox Picture2 
  198.       BackColor       =   &H00C0C0C0&
  199.       BorderStyle     =   0  'None
  200.       Height          =   1575
  201.       Left            =   6480
  202.       ScaleHeight     =   1575
  203.       ScaleWidth      =   2055
  204.       TabIndex        =   1
  205.       Top             =   120
  206.       Width           =   2055
  207.       Begin CommandButton ExitButton 
  208.          Caption         =   "Exit"
  209.          Height          =   375
  210.          Left            =   120
  211.          TabIndex        =   2
  212.          Top             =   1080
  213.          Width           =   1815
  214.       End
  215.       Begin CommandButton StopButton 
  216.          Caption         =   "Spare"
  217.          Enabled         =   0   'False
  218.          Height          =   375
  219.          Left            =   120
  220.          TabIndex        =   3
  221.          Top             =   600
  222.          Width           =   1815
  223.       End
  224.       Begin CommandButton RunButton 
  225.          Caption         =   "Spare"
  226.          Enabled         =   0   'False
  227.          Height          =   375
  228.          Left            =   120
  229.          TabIndex        =   4
  230.          Top             =   120
  231.          Width           =   1815
  232.       End
  233.    End
  234.    Begin PictureBox Picture7 
  235.       BackColor       =   &H00C0C0C0&
  236.       BorderStyle     =   0  'None
  237.       Height          =   975
  238.       Left            =   120
  239.       ScaleHeight     =   975
  240.       ScaleWidth      =   6255
  241.       TabIndex        =   17
  242.       Top             =   120
  243.       Width           =   6255
  244.       Begin TextBox CommText 
  245.          BackColor       =   &H00808080&
  246.          BorderStyle     =   0  'None
  247.          ForeColor       =   &H00FFFF00&
  248.          Height          =   735
  249.          Left            =   120
  250.          MultiLine       =   -1  'True
  251.          TabIndex        =   18
  252.          Top             =   120
  253.          Width           =   6015
  254.       End
  255.    End
  256.    Begin Menu MenuFile 
  257.       Caption         =   "&File"
  258.       Begin Menu FileExit 
  259.          Caption         =   "E&xit"
  260.       End
  261.    End
  262.    Begin Menu MenuAction 
  263.       Caption         =   "&Action"
  264.       Begin Menu ActionJump 
  265.          Caption         =   "&Jump to Coordinate"
  266.          Begin Menu JumpAbsolute 
  267.             Caption         =   "&Absolute"
  268.             Begin Menu AbsoluteX 
  269.                Caption         =   "&X"
  270.             End
  271.             Begin Menu AbsoluteY 
  272.                Caption         =   "&Y"
  273.             End
  274.             Begin Menu AbsoluteZ 
  275.                Caption         =   "&Z"
  276.             End
  277.          End
  278.          Begin Menu JumpRelative 
  279.             Caption         =   "&Relative"
  280.             Begin Menu RelativeX 
  281.                Caption         =   "&X"
  282.             End
  283.             Begin Menu RelativeY 
  284.                Caption         =   "&Y"
  285.             End
  286.             Begin Menu RelativeZ 
  287.                Caption         =   "&Z"
  288.             End
  289.          End
  290.       End
  291.    End
  292.    Begin Menu MenuView 
  293.       Caption         =   "&View"
  294.       Begin Menu ViewFine 
  295.          Caption         =   "&Fine Position Controls"
  296.       End
  297.       Begin Menu ViewAboutFace 
  298.          Caption         =   "&About Face Button"
  299.       End
  300.    End
  301.    Begin Menu MenuHelp 
  302.       Caption         =   "&Help"
  303.       Begin Menu HelpUsing 
  304.          Caption         =   "&Using CyberSpace Cruiser"
  305.       End
  306.       Begin Menu HelpViewport 
  307.          Caption         =   "The &Viewport"
  308.       End
  309.       Begin Menu HelpHyphen1 
  310.          Caption         =   "-"
  311.       End
  312.       Begin Menu HelpAbout 
  313.          Caption         =   "&About CyberSpace Cruiser"
  314.       End
  315.    End
  316. '3D CyberSpace viewer from...
  317. 'Ivory Tower Software
  318. 'Richard Wagner
  319. 'CIS 76427,2611
  320. 'Copyright 1992, all rights reserved.
  321. 'You may use this VB source code in your programs if you include attribution in your
  322. 'startup and "about" screens in the form: "Portions of this program copyright by
  323. 'Ivory Tower Software, used with permission," or a similar phrase.
  324. 'If you do use this source code in your application, please let us know. We would like to
  325. 'take a look at it. Your comments and suggestions for improving this software are
  326. 'welcome.
  327. Dim crlf As String                      'Carriage return linefeed combination
  328. Dim sfAzimuth As Single                 'View direction, vertical axis, single floating point
  329. Dim sfElevation As Single               'View direction, horizontal axis
  330. Dim iOldLRAngle As Integer              'Previous LR angle in degrees, integer
  331. Dim iOldUDAngle As Integer              'Previous UD angle in degrees
  332. Dim sfMDownX  As Single                 'Mouse down X for PicView double click event
  333. Dim sfMDownY  As Single                 'Mouse down Y for PicView double click event
  334. Sub AbsoluteX_Click ()
  335.   LocOK% = -1
  336.   msg$ = "What is the X coordinate to jump to:"
  337.   Result$ = InputBox$(msg$, "Absolute X Coordinate", Str$(sfViewPointX))
  338.   If Result$ = "" Then Exit Sub
  339.   Delta! = Val(Result$) - sfViewPointX
  340.   sfViewPointX = Val(Result$)
  341.   sfWinPointX = sfWinPointX + Delta!
  342.   sfRPointX = sfRPointX + Delta!
  343.   sfSPointX = sfSPointX + Delta!
  344.   LocationModes 0, LocOK%
  345.   If LocOK% = 86 Then           'Trying to jump to a forbidden zone
  346.     sfViewPointX = sfViewPointX - Delta!
  347.     sfWinPointX = sfWinPointX - Delta!
  348.     sfRPointX = sfRPointX - Delta!
  349.     sfSPointX = sfSPointX - Delta!
  350.     Exit Sub
  351.   End If
  352.   Label1.caption = " X = " + Format$(sfViewPointX, "####0")
  353.   PlaceAllObjects
  354. End Sub
  355. Sub AbsoluteY_Click ()
  356.   LocOK% = -1
  357.   msg$ = "What is the Y coordinate to jump to:"
  358.   Result$ = InputBox$(msg$, "Absolute Y Coordinate", Str$(sfViewPointY))
  359.   If Result$ = "" Then Exit Sub
  360.   Delta! = Val(Result$) - sfViewPointY
  361.   sfViewPointY = Val(Result$)
  362.   sfWinPointY = sfWinPointY + Delta!
  363.   sfRPointY = sfRPointY + Delta!
  364.   sfSPointY = sfSPointY + Delta!
  365.   LocationModes 0, LocOK%
  366.   If LocOK% = 86 Then           'Trying to jump to a forbidden zone
  367.     sfViewPointY = sfViewPointY - Delta!
  368.     sfWinPointY = sfWinPointY - Delta!
  369.     sfRPointY = sfRPointY - Delta!
  370.     sfSPointY = sfSPointY - Delta!
  371.     Exit Sub
  372.   End If
  373.   Label1.caption = " Y = " + Format$(sfViewPointY, "####0")
  374.   PlaceAllObjects
  375. End Sub
  376. Sub AbsoluteZ_Click ()
  377.   LocOK% = -1
  378.   msg$ = "What is the Z coordinate to jump to:"
  379.   Result$ = InputBox$(msg$, "Absolute Z Coordinate", Str$(sfViewPointZ))
  380.   If Result$ = "" Then Exit Sub
  381.   Delta! = Val(Result$) - sfViewPointZ
  382.   sfViewPointZ = Val(Result$)
  383.   sfWinPointZ = sfWinPointZ + Delta!
  384.   sfRPointZ = sfRPointZ + Delta!
  385.   sfSPointZ = sfSPointZ + Delta!
  386.   LocationModes 0, LocOK%
  387.   If LocOK% = 86 Then           'Trying to jump to a forbidden zone
  388.     sfViewPointZ = sfViewPointZ - Delta!
  389.     sfWinPointZ = sfWinPointZ - Delta!
  390.     sfRPointZ = sfRPointZ - Delta!
  391.     sfSPointZ = sfSPointZ - Delta!
  392.     Exit Sub
  393.   End If
  394.   Label1.caption = " Z = " + Format$(sfViewPointZ, "####0")
  395.   PlaceAllObjects
  396. End Sub
  397. Sub AFButton_Click ()
  398.   TempVert% = -PanUDScroll.value
  399.   PanUDScroll.value = TempVert%
  400.   TempHort% = PanLRScroll.value
  401.   TempHort% = TempHort% + 180
  402.   If TempHort% > 180 Then TempHort% = TempHort% - 360
  403.   PanLRScroll.value = TempHort%
  404. End Sub
  405. Sub BackForScroll_Change ()
  406.   'On Error GoTo BFScrollHandler
  407.   Static iOldScroll As Integer
  408.   Static iReWind As Integer
  409.   If iReWind Then
  410.     iReWind = 0
  411.     Exit Sub
  412.   End If
  413.   If iFlatLined Then Exit Sub
  414.   DeltaLine% = iOldScroll - BackForScroll.value
  415.   DeltaX! = Sin(sfAzimuth) * Cos(sfElevation) * DeltaLine%
  416.   DeltaY! = Sin(sfElevation) * DeltaLine%
  417.   DeltaZ! = Cos(sfAzimuth) * Cos(sfElevation) * DeltaLine%
  418.   sfViewPointX = sfViewPointX + DeltaX!
  419.   sfViewPointY = sfViewPointY + DeltaY!
  420.   sfViewPointZ = sfViewPointZ - DeltaZ!
  421.   sfWinPointX = sfWinPointX + DeltaX!
  422.   sfWinPointY = sfWinPointY + DeltaY!
  423.   sfWinPointZ = sfWinPointZ - DeltaZ!
  424.   sfRPointX = sfRPointX + DeltaX!
  425.   sfRPointY = sfRPointY + DeltaY!
  426.   sfRPointZ = sfRPointZ - DeltaZ!
  427.   sfSPointX = sfSPointX + DeltaX!
  428.   sfSPointY = sfSPointY + DeltaY!
  429.   sfSPointZ = sfSPointZ - DeltaZ!
  430.   Label1.caption = " X = " + Format$(sfViewPointX, "####0")
  431.   Label2.caption = " Y = " + Format$(sfViewPointY, "####0")
  432.   Label3.caption = " Z = " + Format$(sfViewPointZ, "####0")
  433.   If BackForScroll.value = 5000 Or BackForScroll.value = -5000 Then
  434.     iReWind = -1
  435.     BackForScroll.value = 0
  436.   End If
  437.   iOldScroll = BackForScroll.value
  438.   LocationModes DeltaLine%, 0
  439.   PlaceAllObjects
  440.   ViewPic.SetFocus
  441. BFScrollResume:
  442.   Exit Sub
  443. BFScrollHandler:
  444.   MsgBox "Error in BackForScroll: " + Error$
  445.   Resume BFScrollResume
  446. End Sub
  447. Sub BigRedCube ()
  448.     'This sub defines the object-primitives for the Big Red Cube in cyberspace.
  449.     'Each object is defined in its own object-space centered on 0, 0, 0.
  450.     'A nominal object in has a size of 100 cyberspace linear units (CLUs).
  451.     'The cube is an assemblage of filled squares, each 10 times bigger than nominal.
  452.     i% = iNumObjects
  453.     i% = i% + 1
  454.     iObjectType(i%) = 13                'Filled Square XY
  455.     iLocationX(i%) = -4000
  456.     iLocationY(i%) = -1000
  457.     iLocationZ(i%) = 12000 + 500
  458.     iColor(i%) = 4                      'Fill color, edges will be black
  459.     sfSize(i%) = 10                     '10 times nominal
  460.     i% = i% + 1
  461.     iObjectType(i%) = 13
  462.     iLocationX(i%) = -4000
  463.     iLocationY(i%) = -1000
  464.     iLocationZ(i%) = 12000 - 500
  465.     iColor(i%) = 4
  466.     sfSize(i%) = 10
  467.     i% = i% + 1
  468.     iObjectType(i%) = 14
  469.     iLocationX(i%) = -4000 + 500
  470.     iLocationY(i%) = -1000
  471.     iLocationZ(i%) = 12000
  472.     iColor(i%) = 4
  473.     sfSize(i%) = 10
  474.     i% = i% + 1
  475.     iObjectType(i%) = 14
  476.     iLocationX(i%) = -4000 - 500
  477.     iLocationY(i%) = -1000
  478.     iLocationZ(i%) = 12000
  479.     iColor(i%) = 4
  480.     sfSize(i%) = 10
  481.     i% = i% + 1
  482.     iObjectType(i%) = 15
  483.     iLocationX(i%) = -4000
  484.     iLocationY(i%) = -1000 + 500
  485.     iLocationZ(i%) = 12000
  486.     iColor(i%) = 4
  487.     sfSize(i%) = 10
  488.     i% = i% + 1
  489.     iObjectType(i%) = 15
  490.     iLocationX(i%) = -4000
  491.     iLocationY(i%) = -1000 - 500
  492.     iLocationZ(i%) = 12000
  493.     iColor(i%) = 4
  494.     sfSize(i%) = 10
  495.     iNumObjects = i%
  496. End Sub
  497. Sub DefineAllObjects ()
  498.   'Each object in cyberspace is defined by:
  499.   'Object Number
  500.   'Object Type
  501.   'Center X
  502.   'Center Y
  503.   'Center Z
  504.   'qbcolor
  505.   'sfSize Factor
  506.   'iNumObjects = total number of objects in cyberspace
  507.   iNumObjects = 0
  508.     BigRedCube                  'The big red cube
  509.     YellowCluster               'A cluster of 100 random points
  510.     IvoryTower                  'A tall white structure
  511.     Pyramids                    'Mysterious solids in cyberspace
  512.     SpinningCube                'An animated wireframe object
  513. End Sub
  514. Sub ExitButton_Click ()
  515.   End
  516. End Sub
  517. Sub FileExit_Click ()
  518.   End
  519. End Sub
  520. Sub Form_Load ()
  521.   'left = 0
  522.   left = (Screen.width - width) / 2
  523.   top = (Screen.height - height) / 2
  524.   crlf = Chr$(13) + Chr$(10)
  525.   ViewPic.AutoRedraw = -1
  526.   ViewPic.fillstyle = 0
  527.   ViewPic.ScaleWidth = 1000
  528.   ViewPic.ScaleHeight = -1000
  529.   ViewPic.ScaleTop = 500
  530.   ViewPic.scaleleft = -500
  531.   sfViewPointX = 0
  532.   sfViewPointY = 0
  533.   sfViewPointZ = 5000
  534.   sfWinPointX = 0
  535.   sfWinPointY = 0
  536.   sfWinPointZ = sfViewPointZ - 1000
  537.   sfRPointX = 500
  538.   sfRPointY = 0
  539.   sfRPointZ = sfViewPointZ - 1000
  540.   sfSPointX = 0
  541.   sfSPointY = 500
  542.   sfSPointZ = sfViewPointZ - 1000
  543.   sfAzimuth = 0
  544.   sfElevation = 0
  545.   lOldLinPos = 5000
  546.   lNewLinPos = 5000
  547.   Label1.caption = " X =" + Str$(sfViewPointX)
  548.   Label2.caption = " Y =" + Str$(sfViewPointY)
  549.   Label3.caption = " Z =" + Str$(sfViewPointZ)
  550.   Label4.caption = " Azimuth = 0"
  551.   Label5.caption = " Inclination = 0"
  552.   MakeObjects
  553.   DefineAllObjects
  554.   PlaceAllObjects
  555.   msg$ = "Welcome to cyberspace. Some pyramids are straight ahead."
  556.   msg$ = msg$ + " Use the vertical scroll bar to the right of the viewport"
  557.   msg$ = msg$ + " to move forward."
  558.   CommText.text = msg$
  559. End Sub
  560. Sub Form_Paint ()
  561.   BorderBoxRaised ViewPic, XView
  562.   BorderBoxRaised Picture1, XView
  563.   BorderBoxRaised Picture2, XView
  564.   BorderBoxRaised Picture3, XView
  565.   BorderBoxRaised Picture4, XView
  566.   BorderBoxRaised Picture5, XView
  567.   BorderBoxRaised Picture7, XView
  568.   PicBorderBoxRecessed CommText, Picture7
  569. End Sub
  570. Sub Form_Unload (Cancel As Integer)
  571.   'This is necessary in this program: applications with multiple forms need to
  572.   'have "end" in the Unload procedure of their main forms. This gets around a VB
  573.   'bug which can either leave orphan hidden forms in memory, or crash Windows
  574.   'if you try to exit windows and unload forms from the main form on Windows close.
  575.   End
  576. End Sub
  577. Sub HelpAbout_Click ()
  578.   msg$ = "CyberSpace Cruiser demo version 1.09, July 17, 1992" + crlf + crlf
  579.   msg$ = msg$ + "Copyright 1992 by Ivory Tower Software, all rights reserved." + crlf + crlf
  580.   msg$ = msg$ + "Cyberspace is a real cartesian space of infinite extent, and"
  581.   msg$ = msg$ + " was first described in the novels of William Gibson."
  582.   msg$ = msg$ + " Now Ivory Tower's CyberSpace Cruiser lets any Microsoft Windows computer"
  583.   msg$ = msg$ + " user 'jack in' to cyberspace. A fast machine is highly recommended." + crlf + crlf
  584.   msg$ = msg$ + "This program is freeware. You may copy it freely and anyone may run it at"
  585.   msg$ = msg$ + " no cost on any machine."
  586.   msg$ = msg$ + crlf + crlf
  587.   msg$ = msg$ + "Your comments and suggestions are welcome. Contact Ivory Tower Software"
  588.   msg$ = msg$ + " via CompuServe mail 76427,2611."
  589.   MsgBox msg$, 0, "About CyberSpace Cruiser"
  590. End Sub
  591. Sub HelpUsing_Click ()
  592.   msg$ = "CyberSpace Cruiser allows a human being to view and maneuver through cyberspace."
  593.   msg$ = msg$ + " The viewport gives a 51 degree view angle forward. The scrollbar"
  594.   msg$ = msg$ + " to the right of the viewport moves the user's view point forward and"
  595.   msg$ = msg$ + " backward through cyberspace. Move the thumb button up to go forward."
  596.   msg$ = msg$ + " Each click on the scroll arrow moves the view point 10 cyberspace linear"
  597.   msg$ = msg$ + " units (CLUs). Each click in the scrollbar itself moves the view point 100"
  598.   msg$ = msg$ + " CLUs. The user's position in cyberspace is displayed at all times just"
  599.   msg$ = msg$ + " below the 'Exit' button." + crlf + crlf
  600.   msg$ = msg$ + " The scrollbar at the botton of the viewport controls the user's"
  601.   msg$ = msg$ + " view azimuth (pans left and right) and the scrollbar to the left of the"
  602.   msg$ = msg$ + " viewport controls the user's view inclination (pans up and down). The"
  603.   msg$ = msg$ + " view angles move in one and ten degree increments." + crlf + crlf
  604.   msg$ = msg$ + " To travel in cyberspace, adjust the view direction until the destination"
  605.   msg$ = msg$ + " point is near the center of the viewport. Then move forward until the"
  606.   msg$ = msg$ + " point is reached." + crlf + crlf
  607.   msg$ = msg$ + " 'CyberSpace Cruiser' is a trademark of Ivory Tower Software."
  608.   MsgBox msg$, 0, "Using CyberSpace Cruiser"
  609. End Sub
  610. Sub HelpViewport_Click ()
  611.   msg$ = "The viewport is the large square region of the CyberSpace Cruiser window"
  612.   msg$ = msg$ + " and provides your view into cyberspace. The viewport gives a viewing"
  613.   msg$ = msg$ + " angle of 51 degrees both horizontally and vertically. The viewing"
  614.   msg$ = msg$ + " direction is controlled with the horizontal scroll bar below"
  615.   msg$ = msg$ + " the viewport and with the vertical scroll bar to the left of the"
  616.   msg$ = msg$ + " viewport." + crlf + crlf
  617.   msg$ = msg$ + "If you double click on any point on the viewport, your"
  618.   msg$ = msg$ + " view direction will automatically be adjusted to bring that point"
  619.   msg$ = msg$ + " into the center of the viewport."
  620.   MsgBox msg$, 0, "The Viewport"
  621. End Sub
  622. Sub IvoryTower ()
  623.   'This sub creates the white tower object-set:
  624.   i% = iNumObjects
  625.   'Base Cube:
  626.   i% = i% + 1
  627.   iObjectType(i%) = 13      'Filled Square XY
  628.   iLocationX(i%) = 9000
  629.   iLocationY(i%) = -1000
  630.   iLocationZ(i%) = 9000 + 500
  631.   iColor(i%) = 15
  632.   sfSize(i%) = 10
  633.   i% = i% + 1
  634.   iObjectType(i%) = 13      'Filled Square XY
  635.   iLocationX(i%) = 9000
  636.   iLocationY(i%) = -1000
  637.   iLocationZ(i%) = 9000 - 500
  638.   iColor(i%) = 15
  639.   sfSize(i%) = 10
  640.   i% = i% + 1
  641.   iObjectType(i%) = 14      'Filled Square YZ
  642.   iLocationX(i%) = 9000 + 500
  643.   iLocationY(i%) = -1000
  644.   iLocationZ(i%) = 9000
  645.   iColor(i%) = 15
  646.   sfSize(i%) = 10
  647.   i% = i% + 1
  648.   iObjectType(i%) = 14      'Filled Square YZ
  649.   iLocationX(i%) = 9000 - 500
  650.   iLocationY(i%) = -1000
  651.   iLocationZ(i%) = 9000
  652.   iColor(i%) = 15
  653.   sfSize(i%) = 10
  654.   i% = i% + 1
  655.   iObjectType(i%) = 15      'Filled Square XZ
  656.   iLocationX(i%) = 9000
  657.   iLocationY(i%) = -1000 + 500
  658.   iLocationZ(i%) = 9000
  659.   iColor(i%) = 15
  660.   sfSize(i%) = 10
  661.   i% = i% + 1
  662.   iObjectType(i%) = 15      'Filled Square XZ
  663.   iLocationX(i%) = 9000
  664.   iLocationY(i%) = -1000 - 500
  665.   iLocationZ(i%) = 9000
  666.   iColor(i%) = 15
  667.   sfSize(i%) = 10
  668.   'Second story:
  669.   i% = i% + 1
  670.   iObjectType(i%) = 16      'Tall Rectangle XY
  671.   iLocationX(i%) = 9000
  672.   iLocationY(i%) = 0
  673.   iLocationZ(i%) = 9000 + 400
  674.   iColor(i%) = 15
  675.   sfSize(i%) = 10
  676.   iNumObjects = i%
  677.   i% = i% + 1
  678.   iObjectType(i%) = 16      'Tall Rectangle XY
  679.   iLocationX(i%) = 9000
  680.   iLocationY(i%) = 0
  681.   iLocationZ(i%) = 9000 - 400
  682.   iColor(i%) = 15
  683.   sfSize(i%) = 10
  684.   i% = i% + 1
  685.   iObjectType(i%) = 17      'Tall Rectangle YZ
  686.   iLocationX(i%) = 9000 + 400
  687.   iLocationY(i%) = 0
  688.   iLocationZ(i%) = 9000
  689.   iColor(i%) = 15
  690.   sfSize(i%) = 10
  691.   i% = i% + 1
  692.   iObjectType(i%) = 17      'Tall Rectangle YZ
  693.   iLocationX(i%) = 9000 - 400
  694.   iLocationY(i%) = 0
  695.   iLocationZ(i%) = 9000
  696.   iColor(i%) = 15
  697.   sfSize(i%) = 10
  698.   i% = i% + 1
  699.   iObjectType(i%) = 15      'Filled Square XZ
  700.   iLocationX(i%) = 9000
  701.   iLocationY(i%) = 500
  702.   iLocationZ(i%) = 9000
  703.   iColor(i%) = 15
  704.   sfSize(i%) = 8
  705.   'Third story:
  706.   i% = i% + 1
  707.   iObjectType(i%) = 18      'Tall Rectangle XY
  708.   iLocationX(i%) = 9000
  709.   iLocationY(i%) = 1000
  710.   iLocationZ(i%) = 9000 + 300
  711.   iColor(i%) = 15
  712.   sfSize(i%) = 10
  713.   iNumObjects = i%
  714.   i% = i% + 1
  715.   iObjectType(i%) = 18      'Tall Rectangle XY
  716.   iLocationX(i%) = 9000
  717.   iLocationY(i%) = 1000
  718.   iLocationZ(i%) = 9000 - 300
  719.   iColor(i%) = 15
  720.   sfSize(i%) = 10
  721.   i% = i% + 1
  722.   iObjectType(i%) = 19      'Tall Rectangle YZ
  723.   iLocationX(i%) = 9000 + 300
  724.   iLocationY(i%) = 1000
  725.   iLocationZ(i%) = 9000
  726.   iColor(i%) = 15
  727.   sfSize(i%) = 10
  728.   i% = i% + 1
  729.   iObjectType(i%) = 19      'Tall Rectangle YZ
  730.   iLocationX(i%) = 9000 - 300
  731.   iLocationY(i%) = 1000
  732.   iLocationZ(i%) = 9000
  733.   iColor(i%) = 15
  734.   sfSize(i%) = 10
  735.   i% = i% + 1
  736.   iObjectType(i%) = 15      'Filled Square XZ
  737.   iLocationX(i%) = 9000
  738.   iLocationY(i%) = 1500
  739.   iLocationZ(i%) = 9000
  740.   iColor(i%) = 15
  741.   sfSize(i%) = 6
  742.   iNumObjects = i%
  743. End Sub
  744. Sub LocationModes (ByVal iJump As Integer, iLocOK As Integer)
  745.   'Depending on where you are in cyberspace, different events can occur...
  746.   CommText.text = ""
  747.   'Big Red Cube:
  748.   If sfViewPointZ > 11000 - 2000 And sfViewPointZ < 13000 + 2000 Then
  749.     If sfViewPointX < -3000 + 2000 And sfViewPointX > -5000 - 2000 Then
  750.       If sfViewPointY < 2000 And sfViewPointY > -2000 - 2000 Then
  751.         msg$ = "The big red cube is rumored to contain a fabulous wealth"
  752.         msg$ = msg$ + " of software and data."
  753.         CommText.text = msg$
  754.         If sfViewPointZ > 11000 - 500 And sfViewPointZ < 13000 + 500 Then
  755.           If sfViewPointX < -3000 + 500 And sfViewPointX > -5000 - 500 Then
  756.             If sfViewPointY < 500 And sfViewPointY > -2000 - 500 Then
  757.               MsgBox "Entry to this space is prohibited."
  758.               If Not iLocOK Then
  759.                 XView.BackForScroll.value = XView.BackForScroll.value + iJump
  760.               Else
  761.                 iLocOK = 86
  762.               End If
  763.             End If
  764.           End If
  765.         End If
  766.       End If
  767.     End If
  768.   End If
  769.   'Ivory Tower:
  770.   If sfViewPointZ > 8000 - 2000 And sfViewPointZ < 10000 + 2000 Then
  771.     If sfViewPointX > 8000 - 2000 And sfViewPointX < 10000 + 2000 Then
  772.       If sfViewPointY < 2000 + 2000 And sfViewPointY > -2000 - 2000 Then
  773.         msg$ = "The tall white structure is one of the largest objects"
  774.         msg$ = msg$ + " in cyberspace, measuring 3000 CLUs high."
  775.         CommText.text = msg$
  776.         If sfViewPointZ > 8000 - 500 And sfViewPointZ < 10000 + 500 Then
  777.           If sfViewPointX > 8000 - 500 And sfViewPointX < 10000 + 500 Then
  778.             If sfViewPointY < 2000 + 500 And sfViewPointY > -2000 - 500 Then
  779.               MsgBox "Entry to this space is prohibited."
  780.               If Not iLocOK Then
  781.                 XView.BackForScroll.value = XView.BackForScroll.value + iJump
  782.               Else
  783.                 iLocOK = 86
  784.               End If
  785.             End If
  786.           End If
  787.         End If
  788.       End If
  789.     End If
  790.   End If
  791.   'Pyramids:
  792.   If sfViewPointZ < 200 - 500 + 500 And sfViewPointZ > -400 - 500 - 500 Then
  793.     If sfViewPointX > -300 - 500 And sfViewPointX < 200 + 500 Then
  794.       If sfViewPointY < 200 + 500 And sfViewPointY > -200 - 500 Then
  795.         msg$ = "The two pyramids are rather small structures in cyberspace,"
  796.         msg$ = msg$ + " the taller one being only 50 CLUs high."
  797.         msg$ = msg$ + " No one has ever been able to enter them, so no one knows what's"
  798.         msg$ = msg$ + " inside them, or who they belong to."
  799.         CommText.text = msg$
  800.         If sfViewPointZ < 200 - 500 And sfViewPointZ > -400 - 500 Then
  801.           If sfViewPointX > -300 And sfViewPointX < 200 Then
  802.             If sfViewPointY < 200 And sfViewPointY > -200 Then
  803.               MsgBox "Entry to this space is prohibited."
  804.               If Not iLocOK Then
  805.                 XView.BackForScroll.value = XView.BackForScroll.value + iJump
  806.               Else
  807.                 iLocOK = 86
  808.               End If
  809.             End If
  810.           End If
  811.         End If
  812.       End If
  813.     End If
  814.   End If
  815. End Sub
  816. Sub MakeObjects ()
  817.   'Make prototype objects.
  818.   'Coordinates are in object space. Center objects about 0,0,0 in object space.
  819.   'Object sfSizes, locations and iColors are assigned in DefineAllObjects.
  820.   'The nominal size of an object is 100 CLUs in its major dimension.
  821.   'These object-primitives are defined about 0, 0, 0  in their own object-spaces.
  822.   'They are later translated to cyberspace as needed, each being called by its
  823.   'object type:
  824.   'Object type 0, Point:
  825.   iNumPoints(0) = 1
  826.   iObjectX(0, 1) = 0
  827.   iObjectY(0, 1) = 0
  828.   iObjectZ(0, 1) = 0
  829.   'Object type 1, Wireframe Cube:
  830.   iNumPoints(1) = 8
  831.   'Vertex 1:
  832.   iObjectX(1, 1) = 50
  833.   iObjectY(1, 1) = 50
  834.   iObjectZ(1, 1) = -50
  835.   'Vertex 2:
  836.   iObjectX(1, 2) = -50
  837.   iObjectY(1, 2) = 50
  838.   iObjectZ(1, 2) = -50
  839.   'Vertex 3:
  840.   iObjectX(1, 3) = -50
  841.   iObjectY(1, 3) = -50
  842.   iObjectZ(1, 3) = -50
  843.   'Vertex 4:
  844.   iObjectX(1, 4) = 50
  845.   iObjectY(1, 4) = -50
  846.   iObjectZ(1, 4) = -50
  847.   'Vertex 5:
  848.   iObjectX(1, 5) = 50
  849.   iObjectY(1, 5) = 50
  850.   iObjectZ(1, 5) = 50
  851.   'Vertex 6:
  852.   iObjectX(1, 6) = -50
  853.   iObjectY(1, 6) = 50
  854.   iObjectZ(1, 6) = 50
  855.   'Vertex 7:
  856.   iObjectX(1, 7) = -50
  857.   iObjectY(1, 7) = -50
  858.   iObjectZ(1, 7) = 50
  859.   'Vertex 8:
  860.   iObjectX(1, 8) = 50
  861.   iObjectY(1, 8) = -50
  862.   iObjectZ(1, 8) = 50
  863.   'Object type 13, Filled Square in XY plane
  864.   iNumPoints(13) = 4
  865.   iObjectX(13, 1) = 50
  866.   iObjectY(13, 1) = 50
  867.   iObjectZ(13, 1) = 0
  868.   iObjectX(13, 2) = -50
  869.   iObjectY(13, 2) = 50
  870.   iObjectZ(13, 2) = 0
  871.   iObjectX(13, 3) = -50
  872.   iObjectY(13, 3) = -50
  873.   iObjectZ(13, 3) = 0
  874.   iObjectX(13, 4) = 50
  875.   iObjectY(13, 4) = -50
  876.   iObjectZ(13, 4) = 0
  877.   'Object type 14, Filled Square YZ
  878.   iNumPoints(14) = 4
  879.   iObjectX(14, 1) = 0
  880.   iObjectY(14, 1) = 50
  881.   iObjectZ(14, 1) = 50
  882.   iObjectX(14, 2) = 0
  883.   iObjectY(14, 2) = 50
  884.   iObjectZ(14, 2) = -50
  885.   iObjectX(14, 3) = 0
  886.   iObjectY(14, 3) = -50
  887.   iObjectZ(14, 3) = -50
  888.   iObjectX(14, 4) = 0
  889.   iObjectY(14, 4) = -50
  890.   iObjectZ(14, 4) = 50
  891.   'Object type 15, Filled Square XZ
  892.   iNumPoints(15) = 4
  893.   iObjectX(15, 1) = 50
  894.   iObjectY(15, 1) = 0
  895.   iObjectZ(15, 1) = 50
  896.   iObjectX(15, 2) = 50
  897.   iObjectY(15, 2) = 0
  898.   iObjectZ(15, 2) = -50
  899.   iObjectX(15, 3) = -50
  900.   iObjectY(15, 3) = 0
  901.   iObjectZ(15, 3) = -50
  902.   iObjectX(15, 4) = -50
  903.   iObjectY(15, 4) = 0
  904.   iObjectZ(15, 4) = 50
  905.   'Object type 16, Filled Tall Rectangle (80 x 100) in XY plane
  906.   iNumPoints(16) = 4
  907.   iObjectX(16, 1) = 40
  908.   iObjectY(16, 1) = 50
  909.   iObjectZ(16, 1) = 0
  910.   iObjectX(16, 2) = -40
  911.   iObjectY(16, 2) = 50
  912.   iObjectZ(16, 2) = 0
  913.   iObjectX(16, 3) = -40
  914.   iObjectY(16, 3) = -50
  915.   iObjectZ(16, 3) = 0
  916.   iObjectX(16, 4) = 40
  917.   iObjectY(16, 4) = -50
  918.   iObjectZ(16, 4) = 0
  919.   'Object type 17, Filled Tall Rectangle (80 x 100) in  YZ
  920.   iNumPoints(17) = 4
  921.   iObjectX(17, 1) = 0
  922.   iObjectY(17, 1) = 50
  923.   iObjectZ(17, 1) = 40
  924.   iObjectX(17, 2) = 0
  925.   iObjectY(17, 2) = 50
  926.   iObjectZ(17, 2) = -40
  927.   iObjectX(17, 3) = 0
  928.   iObjectY(17, 3) = -50
  929.   iObjectZ(17, 3) = -40
  930.   iObjectX(17, 4) = 0
  931.   iObjectY(17, 4) = -50
  932.   iObjectZ(17, 4) = 40
  933.   'Object type 18, Filled Tall Rectangle (60 x 100) in XY plane
  934.   iNumPoints(18) = 4
  935.   iObjectX(18, 1) = 30
  936.   iObjectY(18, 1) = 50
  937.   iObjectZ(18, 1) = 0
  938.   iObjectX(18, 2) = -30
  939.   iObjectY(18, 2) = 50
  940.   iObjectZ(18, 2) = 0
  941.   iObjectX(18, 3) = -30
  942.   iObjectY(18, 3) = -50
  943.   iObjectZ(18, 3) = 0
  944.   iObjectX(18, 4) = 30
  945.   iObjectY(18, 4) = -50
  946.   iObjectZ(18, 4) = 0
  947.   'Object type 19, Filled Tall Rectangle (60 x 100) in  YZ
  948.   iNumPoints(19) = 4
  949.   iObjectX(19, 1) = 0
  950.   iObjectY(19, 1) = 50
  951.   iObjectZ(19, 1) = 30
  952.   iObjectX(19, 2) = 0
  953.   iObjectY(19, 2) = 50
  954.   iObjectZ(19, 2) = -30
  955.   iObjectX(19, 3) = 0
  956.   iObjectY(19, 3) = -50
  957.   iObjectZ(19, 3) = -30
  958.   iObjectX(19, 4) = 0
  959.   iObjectY(19, 4) = -50
  960.   iObjectZ(19, 4) = 30
  961. 'Object type 22, Filled Pyramid Facet +X, +Z (shift center -x, -z)
  962.   iNumPoints(22) = 3
  963.   iObjectX(22, 1) = 50 - 10
  964.   iObjectY(22, 1) = -50
  965.   iObjectZ(22, 1) = 0 - 10
  966.   iObjectX(22, 2) = 0 - 10
  967.   iObjectY(22, 2) = 0
  968.   iObjectZ(22, 2) = 0 - 10
  969.   iObjectX(22, 3) = 0 - 10
  970.   iObjectY(22, 3) = -50
  971.   iObjectZ(22, 3) = 50 - 10
  972.   'Object type 23, Filled Pyramid Facet -X, +Z (shift center +x, -z
  973.   iNumPoints(23) = 3
  974.   iObjectX(23, 1) = -50 + 10
  975.   iObjectY(23, 1) = -50
  976.   iObjectZ(23, 1) = 0 - 10
  977.   iObjectX(23, 2) = 0 + 10
  978.   iObjectY(23, 2) = 0
  979.   iObjectZ(23, 2) = 0 - 10
  980.   iObjectX(23, 3) = 0 + 10
  981.   iObjectY(23, 3) = -50
  982.   iObjectZ(23, 3) = 50 - 10
  983.   'Object type 24, Filled Pyramid Facet -X, -Z
  984.   iNumPoints(24) = 3
  985.   iObjectX(24, 1) = -50 + 10
  986.   iObjectY(24, 1) = -50
  987.   iObjectZ(24, 1) = 0 + 10
  988.   iObjectX(24, 2) = 0 + 10
  989.   iObjectY(24, 2) = 0
  990.   iObjectZ(24, 2) = 0 + 10
  991.   iObjectX(24, 3) = 0 + 10
  992.   iObjectY(24, 3) = -50
  993.   iObjectZ(24, 3) = -50 + 10
  994.   'Object type 25, Filled Pyramid Facet +X, -Z
  995.   iNumPoints(25) = 3
  996.   iObjectX(25, 1) = 50 - 10
  997.   iObjectY(25, 1) = -50
  998.   iObjectZ(25, 1) = 0 + 10
  999.   iObjectX(25, 2) = 0 - 10
  1000.   iObjectY(25, 2) = 0
  1001.   iObjectZ(25, 2) = 0 + 10
  1002.   iObjectX(25, 3) = 0 - 10
  1003.   iObjectY(25, 3) = -50
  1004.   iObjectZ(25, 3) = -50 + 10
  1005.   'Object type 26, Filled Diamond XZ (pyramid base)
  1006.   iNumPoints(26) = 4
  1007.   iObjectX(26, 1) = 0
  1008.   iObjectY(26, 1) = 0
  1009.   iObjectZ(26, 1) = 50
  1010.   iObjectX(26, 2) = 50
  1011.   iObjectY(26, 2) = 0
  1012.   iObjectZ(26, 2) = 0
  1013.   iObjectX(26, 3) = 0
  1014.   iObjectY(26, 3) = 0
  1015.   iObjectZ(26, 3) = -50
  1016.   iObjectX(26, 4) = -50
  1017.   iObjectY(26, 4) = 0
  1018.   iObjectZ(26, 4) = 0
  1019.   'Object type 43, Globular Cluster:
  1020.   Randomize
  1021.   iNumPoints(43) = 100
  1022.   For i% = 1 To 100
  1023.     Alpha! = (Rnd * 2 - 1) * sfPi
  1024.     Beta! = Rnd * sfPi
  1025.     Radius! = Rnd * 50
  1026.     iObjectX(43, i%) = CInt(Radius! * Cos(Alpha!) * Sin(Beta!))
  1027.     iObjectY(43, i%) = CInt(Radius! * Cos(Beta!))
  1028.     iObjectZ(43, i%) = CInt(Radius! * Sin(Alpha!) * Sin(Beta!))
  1029.   Next i%
  1030.   'Object type 44, Spinning Wireframe Cube:
  1031.   iNumPoints(44) = 8
  1032.   'Vertex 1:
  1033.   iObjectX(44, 1) = 50
  1034.   iObjectY(44, 1) = 50
  1035.   iObjectZ(44, 1) = -50
  1036.   'Vertex 2:
  1037.   iObjectX(44, 2) = -50
  1038.   iObjectY(44, 2) = 50
  1039.   iObjectZ(44, 2) = -50
  1040.   'Vertex 3:
  1041.   iObjectX(44, 3) = -50
  1042.   iObjectY(44, 3) = -50
  1043.   iObjectZ(44, 3) = -50
  1044.   'Vertex 4:
  1045.   iObjectX(44, 4) = 50
  1046.   iObjectY(44, 4) = -50
  1047.   iObjectZ(44, 4) = -50
  1048.   'Vertex 5:
  1049.   iObjectX(44, 5) = 50
  1050.   iObjectY(44, 5) = 50
  1051.   iObjectZ(44, 5) = 50
  1052.   'Vertex 6:
  1053.   iObjectX(44, 6) = -50
  1054.   iObjectY(44, 6) = 50
  1055.   iObjectZ(44, 6) = 50
  1056.   'Vertex 7:
  1057.   iObjectX(44, 7) = -50
  1058.   iObjectY(44, 7) = -50
  1059.   iObjectZ(44, 7) = 50
  1060.   'Vertex 8:
  1061.   iObjectX(44, 8) = 50
  1062.   iObjectY(44, 8) = -50
  1063.   iObjectZ(44, 8) = 50
  1064. End Sub
  1065. Sub MinusButton_Click ()
  1066.   BackForScroll.value = BackForScroll.value + 1
  1067. End Sub
  1068. Sub PanLRScroll_Change ()
  1069.   If iFlatLined Then Exit Sub
  1070.   If PanLRScroll.value = 181 Then PanLRScroll.value = -180
  1071.   If PanLRScroll.value = -181 Then PanLRScroll.value = 180
  1072.   sfAzimuth = PanLRScroll.value * sfPi / 180
  1073.   Label4.caption = " Azimuth = " + Str$(PanLRScroll.value)
  1074.   DeltaLR% = iOldLRAngle - PanLRScroll.value
  1075.   DeltaAzimuth# = DeltaLR% * sfPi / 180
  1076.   Tx# = sfViewPointX
  1077.   Ty# = sfViewPointY + 100
  1078.   Tz# = sfViewPointZ
  1079.   'Convert single-precision parameters to double precision for call to DLL:
  1080.   a# = sfViewPointX
  1081.   b# = sfViewPointY
  1082.   c# = sfViewPointZ
  1083.   d# = sfWinPointX
  1084.   e# = sfWinPointY
  1085.   f# = sfWinPointZ
  1086.   g# = sfRPointX
  1087.   h# = sfRPointY
  1088.   i# = sfRPointZ
  1089.   j# = sfSPointX
  1090.   k# = sfSPointY
  1091.   l# = sfSPointZ
  1092.   SolidRotate a#, b#, c#, Tx#, Ty#, Tz#, d#, e#, f#, DeltaAzimuth#
  1093.   SolidRotate a#, b#, c#, Tx#, Ty#, Tz#, g#, h#, i#, DeltaAzimuth#
  1094.   SolidRotate a#, b#, c#, Tx#, Ty#, Tz#, j#, k#, l#, DeltaAzimuth#
  1095.   'Convert back to single precision:
  1096.   sfWinPointX = d#
  1097.   sfWinPointY = e#
  1098.   sfWinPointZ = f#
  1099.   sfRPointX = g#
  1100.   sfRPointY = h#
  1101.   sfRPointZ = i#
  1102.   sfSPointX = j#
  1103.   sfSPointY = k#
  1104.   sfSPointZ = l#
  1105.   iOldLRAngle = PanLRScroll.value
  1106.   PlaceAllObjects
  1107.   If Abs(sfViewPointX) < 1000 And Abs(sfViewPointY) < 1000 And Abs(sfViewPointZ) < 1000 And StopButton.enabled = 0 Then
  1108.     RunButton.enabled = -1
  1109.   End If
  1110.   ViewPic.SetFocus
  1111. End Sub
  1112. Sub PanUDScroll_Change ()
  1113.   If iFlatLined Then Exit Sub
  1114.   DeltaUD% = iOldUDAngle - PanUDScroll.value
  1115.   DeltaElevation# = DeltaUD% * sfPi / 180
  1116.   sfElevation = -PanUDScroll.value * sfPi / 180
  1117.   Label5.caption = " Inclination = " + Str$(-PanUDScroll.value)
  1118.   Ux# = sfViewPointX + sfRPointX - sfWinPointX
  1119.   Uy# = sfViewPointY + sfRPointY - sfWinPointY
  1120.   Uz# = sfViewPointZ + sfRPointZ - sfWinPointZ
  1121.   'Convert single-precision parameters to double precision for call to DLL:
  1122.   a# = sfViewPointX
  1123.   b# = sfViewPointY
  1124.   c# = sfViewPointZ
  1125.   d# = sfWinPointX
  1126.   e# = sfWinPointY
  1127.   f# = sfWinPointZ
  1128.   g# = sfRPointX
  1129.   h# = sfRPointY
  1130.   i# = sfRPointZ
  1131.   j# = sfSPointX
  1132.   k# = sfSPointY
  1133.   l# = sfSPointZ
  1134.   SolidRotate a#, b#, c#, Ux#, Uy#, Uz#, d#, e#, f#, -DeltaElevation#
  1135.   SolidRotate a#, b#, c#, Ux#, Uy#, Uz#, g#, h#, i#, -DeltaElevation#
  1136.   SolidRotate a#, b#, c#, Ux#, Uy#, Uz#, j#, k#, l#, -DeltaElevation#
  1137.   'Convert back to single precision:
  1138.   sfWinPointX = d#
  1139.   sfWinPointY = e#
  1140.   sfWinPointZ = f#
  1141.   sfRPointX = g#
  1142.   sfRPointY = h#
  1143.   sfRPointZ = i#
  1144.   sfSPointX = j#
  1145.   sfSPointY = k#
  1146.   sfSPointZ = l#
  1147.   iOldUDAngle = PanUDScroll.value
  1148.   PlaceAllObjects
  1149.   If Abs(sfViewPointX) < 1000 And Abs(sfViewPointY) < 1000 And Abs(sfViewPointZ) < 1000 And StopButton.enabled = 0 Then
  1150.     RunButton.enabled = -1
  1151.   End If
  1152.   ViewPic.SetFocus
  1153. End Sub
  1154. Sub PlusButton_Click ()
  1155.   BackForScroll.value = BackForScroll.value - 1
  1156. End Sub
  1157. Sub Pyramids ()
  1158.     'This sub defines the pyramids as aggregates of filled triangles and squares:
  1159.     i% = iNumObjects
  1160.     'First Pyramid:
  1161.     i% = i% + 1
  1162.     iObjectType(i%) = 22             'Triangle +X, +Z
  1163.     iLocationX(i%) = 10
  1164.     iLocationY(i%) = 0
  1165.     iLocationZ(i%) = -500 + 10
  1166.     iColor(i%) = 6                  'Fill color, edges will be black
  1167.     sfSize(i%) = 1
  1168.     i% = i% + 1
  1169.     iObjectType(i%) = 23             'Triangle -X, +Z
  1170.     iLocationX(i%) = -10
  1171.     iLocationY(i%) = 0
  1172.     iLocationZ(i%) = -500 + 10
  1173.     iColor(i%) = 6                  'Fill color, edges will be black
  1174.     sfSize(i%) = 1
  1175.     i% = i% + 1
  1176.     iObjectType(i%) = 24             'Triangle -X, -Z
  1177.     iLocationX(i%) = -10
  1178.     iLocationY(i%) = 0
  1179.     iLocationZ(i%) = -500 - 10
  1180.     iColor(i%) = 6                  'Fill color, edges will be black
  1181.     sfSize(i%) = 1
  1182.     i% = i% + 1
  1183.     iObjectType(i%) = 25             'Triangle +X, -Z
  1184.     iLocationX(i%) = 10
  1185.     iLocationY(i%) = 0
  1186.     iLocationZ(i%) = -500 - 10
  1187.     iColor(i%) = 6                  'Fill color, edges will be black
  1188.     sfSize(i%) = 1
  1189.     i% = i% + 1
  1190.     iObjectType(i%) = 26            'Pyramid base
  1191.     iLocationX(i%) = 0
  1192.     iLocationY(i%) = -50            'set below the apex
  1193.     iLocationZ(i%) = -500
  1194.     iColor(i%) = 6                  'Fill color, edges will be black
  1195.     sfSize(i%) = 1
  1196.     'Second Pyramid:
  1197.     i% = i% + 1
  1198.     iObjectType(i%) = 22             'Triangle +X, +Z
  1199.     iLocationX(i%) = 7 - 100
  1200.     iLocationY(i%) = 0
  1201.     iLocationZ(i%) = -500 + 7 - 200
  1202.     iColor(i%) = 6                  'Fill color, edges will be black
  1203.     sfSize(i%) = .7
  1204.     i% = i% + 1
  1205.     iObjectType(i%) = 23             'Triangle -X, +Z
  1206.     iLocationX(i%) = -7 - 100
  1207.     iLocationY(i%) = 0
  1208.     iLocationZ(i%) = -500 + 7 - 200
  1209.     iColor(i%) = 6                  'Fill color, edges will be black
  1210.     sfSize(i%) = .7
  1211.     i% = i% + 1
  1212.     iObjectType(i%) = 24             'Triangle -X, -Z
  1213.     iLocationX(i%) = -7 - 100
  1214.     iLocationY(i%) = 0
  1215.     iLocationZ(i%) = -500 - 7 - 200
  1216.     iColor(i%) = 6                  'Fill color, edges will be black
  1217.     sfSize(i%) = .7
  1218.     i% = i% + 1
  1219.     iObjectType(i%) = 25             'Triangle +X, -Z
  1220.     iLocationX(i%) = 7 - 100
  1221.     iLocationY(i%) = 0
  1222.     iLocationZ(i%) = -500 - 7 - 200
  1223.     iColor(i%) = 6                  'Fill color, edges will be black
  1224.     sfSize(i%) = .7
  1225.     i% = i% + 1
  1226.     iObjectType(i%) = 26            'Pyramid base
  1227.     iLocationX(i%) = -100
  1228.     iLocationY(i%) = -35            'set below the apex
  1229.     iLocationZ(i%) = -500 - 200
  1230.     iColor(i%) = 6                  'Fill color, edges will be black
  1231.     sfSize(i%) = .7
  1232.     iNumObjects = i%
  1233. End Sub
  1234. Sub RelativeX_Click ()
  1235.   LocOK% = -1
  1236.   msg$ = "What is the X distance to jump:"
  1237.   Result$ = InputBox$(msg$, "Relative X Coordinate", "0")
  1238.   If Result$ = "" Then Exit Sub
  1239.   Delta! = Val(Result$)
  1240.   sfViewPointX = sfViewPointX + Delta!
  1241.   sfWinPointX = sfWinPointX + Delta!
  1242.   sfRPointX = sfRPointX + Delta!
  1243.   sfSPointX = sfSPointX + Delta!
  1244.   LocationModes 0, LocOK%
  1245.   If LocOK% = 86 Then           'Trying to jump to a forbidden zone
  1246.     sfViewPointX = sfViewPointX - Delta!
  1247.     sfWinPointX = sfWinPointX - Delta!
  1248.     sfRPointX = sfRPointX - Delta!
  1249.     sfSPointX = sfSPointX - Delta!
  1250.     Exit Sub
  1251.   End If
  1252.   Label1.caption = " X = " + Format$(sfViewPointX, "####0")
  1253.   PlaceAllObjects
  1254. End Sub
  1255. Sub RelativeY_Click ()
  1256.   LocOK% = -1
  1257.   msg$ = "What is the Y distance to jump:"
  1258.   Result$ = InputBox$(msg$, "Relative Y Coordinate", "0")
  1259.   If Result$ = "" Then Exit Sub
  1260.   Delta! = Val(Result$)
  1261.   sfViewPointY = sfViewPointY + Delta!
  1262.   sfWinPointY = sfWinPointY + Delta!
  1263.   sfRPointY = sfRPointY + Delta!
  1264.   sfSPointY = sfSPointY + Delta!
  1265.   LocationModes 0, LocOK%
  1266.   If LocOK% = 86 Then           'Trying to jump to a forbidden zone
  1267.     sfViewPointY = sfViewPointY - Delta!
  1268.     sfWinPointY = sfWinPointY - Delta!
  1269.     sfRPointY = sfRPointY - Delta!
  1270.     sfSPointY = sfSPointY - Delta!
  1271.     Exit Sub
  1272.   End If
  1273.   Label2.caption = " Y = " + Format$(sfViewPointY, "####0")
  1274.   PlaceAllObjects
  1275. End Sub
  1276. Sub RelativeZ_Click ()
  1277.   LocOK% = -1
  1278.   msg$ = "What is the Z distance to jump:"
  1279.   Result$ = InputBox$(msg$, "Relative Z Coordinate", "0")
  1280.   If Result$ = "" Then Exit Sub
  1281.   Delta! = Val(Result$)
  1282.   sfViewPointZ = sfViewPointZ + Delta!
  1283.   sfWinPointZ = sfWinPointZ + Delta!
  1284.   sfRPointZ = sfRPointZ + Delta!
  1285.   sfSPointZ = sfSPointZ + Delta!
  1286.   LocationModes 0, LocOK%
  1287.   If LocOK% = 86 Then           'Trying to jump to a forbidden zone
  1288.     sfViewPointZ = sfViewPointZ - Delta!
  1289.     sfWinPointZ = sfWinPointZ - Delta!
  1290.     sfRPointZ = sfRPointZ - Delta!
  1291.     sfSPointZ = sfSPointZ - Delta!
  1292.     Exit Sub
  1293.   End If
  1294.   Label2.caption = " Z = " + Format$(sfViewPointZ, "####0")
  1295.   PlaceAllObjects
  1296. End Sub
  1297. Sub SCCheck_Click ()
  1298.   If SCCheck.value = 1 Then SpinCube
  1299. End Sub
  1300. Sub SpinningCube ()
  1301.     i% = iNumObjects
  1302.     i% = i% + 1
  1303.     iObjectType(i%) = 44             'WireFrame Cube
  1304.     iLocationX(i%) = -3000
  1305.     iLocationY(i%) = 1000
  1306.     iLocationZ(i%) = 0
  1307.     iColor(i%) = 1
  1308.     sfSize(i%) = 2
  1309.     'Spinning Cube object number for location change in Timer event:
  1310.     iSCNum = i%
  1311.     iNumObjects = i%
  1312. End Sub
  1313. Sub ViewAboutFace_Click ()
  1314.   If ViewABoutFace.checked = 0 Then
  1315.     AFButton.Visible = -1
  1316.     ViewABoutFace.checked = -1
  1317.     msg$ = "Use the 'About Face' button to rotate to look behind you."
  1318.     CommText.text = msg$
  1319.   Else
  1320.     AFButton.Visible = 0
  1321.     ViewABoutFace.checked = 0
  1322.   End If
  1323. End Sub
  1324. Sub ViewFine_Click ()
  1325.   If ViewFine.checked = 0 Then
  1326.     PlusButton.Visible = -1
  1327.     MinusButton.Visible = -1
  1328.     ViewFine.checked = -1
  1329.     msg$ = "Use the fine position controls to move to an exact point in cyberspace."
  1330.     msg$ = msg$ + " The '+1' button will move you forward one Cyberspace Linear"
  1331.     msg$ = msg$ + " Unit (CLU). The '-1' button will move you backward one CLU."
  1332.     CommText.text = msg$
  1333.   Else
  1334.     PlusButton.Visible = 0
  1335.     MinusButton.Visible = 0
  1336.     ViewFine.checked = 0
  1337.   End If
  1338. End Sub
  1339. Sub ViewPic_DblClick ()
  1340.   DeltaVert% = CInt(sfMDownY * 25 / 500)
  1341.   PanUDScroll.value = PanUDScroll.value - DeltaVert%
  1342.   DeltaHort% = CInt(sfMDownX * 25 / 500)
  1343.   NewHort% = PanLRScroll.value + DeltaHort%
  1344.   If NewHort% > 180 Then NewHort% = NewHort% - 360
  1345.   If NewHort% < -180 Then NewHort% = NewHort% + 360
  1346.   PanLRScroll.value = NewHort%
  1347. End Sub
  1348. Sub ViewPic_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  1349.   sfMDownX = X
  1350.   sfMDownY = Y
  1351. End Sub
  1352. Sub YellowCluster ()
  1353.     i% = iNumObjects + 1
  1354.     iObjectType(i%) = 43             'Globular cluster
  1355.     iLocationX(i%) = 0
  1356.     iLocationY(i%) = 5000
  1357.     iLocationZ(i%) = 0
  1358.     iColor(i%) = 14                  'QBcolor
  1359.     sfSize(i%) = 2
  1360.     iNumObjects = i%
  1361. End Sub
  1362.