home *** CD-ROM | disk | FTP | other *** search
/ Apollo 18: The Moon Missions / 990125_1647.ISO / Docking / DOCKING2.FRM < prev    next >
Text File  |  1997-05-16  |  101KB  |  3,071 lines

  1. VERSION 4.00
  2. Begin VB.Form docking 
  3.    AutoRedraw      =   -1  'True
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Docking with the Lunar Module"
  6.    ClientHeight    =   7140
  7.    ClientLeft      =   1785
  8.    ClientTop       =   1575
  9.    ClientWidth     =   9600
  10.    Height          =   7545
  11.    Left            =   1725
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    Picture         =   "DOCKING2.frx":0000
  16.    ScaleHeight     =   7140
  17.    ScaleWidth      =   9600
  18.    Top             =   1230
  19.    Visible         =   0   'False
  20.    Width           =   9720
  21.    Begin VB.Timer Timer3 
  22.       Interval        =   50
  23.       Left            =   150
  24.       Top             =   6300
  25.    End
  26.    Begin VB.VScrollBar VScroll1 
  27.       Height          =   870
  28.       LargeChange     =   10
  29.       Left            =   6975
  30.       Max             =   100
  31.       TabIndex        =   31
  32.       Top             =   6195
  33.       Width           =   270
  34.    End
  35.    Begin VB.TextBox Text6 
  36.       Appearance      =   0  'Flat
  37.       BackColor       =   &H00000000&
  38.       ForeColor       =   &H0000FF00&
  39.       Height          =   300
  40.       Left            =   5910
  41.       TabIndex        =   27
  42.       Text            =   "Text6"
  43.       Top             =   1080
  44.       Visible         =   0   'False
  45.       Width           =   1815
  46.    End
  47.    Begin VB.TextBox Text5 
  48.       Appearance      =   0  'Flat
  49.       BackColor       =   &H00000000&
  50.       ForeColor       =   &H0000FF00&
  51.       Height          =   300
  52.       Left            =   5835
  53.       TabIndex        =   26
  54.       Text            =   "Text5"
  55.       Top             =   735
  56.       Visible         =   0   'False
  57.       Width           =   1980
  58.    End
  59.    Begin VB.TextBox Text4 
  60.       BackColor       =   &H00000000&
  61.       BorderStyle     =   0  'None
  62.       ForeColor       =   &H0000FF00&
  63.       Height          =   315
  64.       Left            =   3270
  65.       TabIndex        =   25
  66.       Text            =   "Text4"
  67.       Top             =   1125
  68.       Visible         =   0   'False
  69.       Width           =   1965
  70.    End
  71.    Begin VB.TextBox Text3 
  72.       Appearance      =   0  'Flat
  73.       BackColor       =   &H00000000&
  74.       BorderStyle     =   0  'None
  75.       ForeColor       =   &H0000FF00&
  76.       Height          =   315
  77.       Left            =   3270
  78.       TabIndex        =   24
  79.       Text            =   "Text3"
  80.       Top             =   750
  81.       Visible         =   0   'False
  82.       Width           =   2220
  83.    End
  84.    Begin VB.TextBox Text2 
  85.       Appearance      =   0  'Flat
  86.       BackColor       =   &H00000000&
  87.       ForeColor       =   &H0000FF00&
  88.       Height          =   300
  89.       Left            =   1065
  90.       TabIndex        =   23
  91.       Text            =   "Text2"
  92.       Top             =   1110
  93.       Visible         =   0   'False
  94.       Width           =   2010
  95.    End
  96.    Begin VB.TextBox Text1 
  97.       Appearance      =   0  'Flat
  98.       BackColor       =   &H00000000&
  99.       ForeColor       =   &H0000FF00&
  100.       Height          =   300
  101.       Left            =   1080
  102.       TabIndex        =   22
  103.       Text            =   "Text1"
  104.       Top             =   690
  105.       Visible         =   0   'False
  106.       Width           =   2070
  107.    End
  108.    Begin VB.Timer Timer2 
  109.       Enabled         =   0   'False
  110.       Interval        =   1000
  111.       Left            =   2835
  112.       Top             =   7770
  113.    End
  114.    Begin VB.CommandButton Command2 
  115.       BackColor       =   &H00C0C0C0&
  116.       Caption         =   "REV"
  117.       Height          =   375
  118.       Index           =   1
  119.       Left            =   5295
  120.       TabIndex        =   21
  121.       Top             =   6555
  122.       Visible         =   0   'False
  123.       Width           =   615
  124.    End
  125.    Begin VB.CommandButton Command2 
  126.       Caption         =   "FWD"
  127.       Height          =   375
  128.       Index           =   0
  129.       Left            =   4110
  130.       TabIndex        =   20
  131.       Top             =   6555
  132.       Visible         =   0   'False
  133.       Width           =   615
  134.    End
  135.    Begin VB.CommandButton starlock 
  136.       Caption         =   "LOCK"
  137.       Height          =   585
  138.       Left            =   8880
  139.       TabIndex        =   19
  140.       Top             =   6345
  141.       Visible         =   0   'False
  142.       Width           =   600
  143.    End
  144.    Begin VB.CommandButton Command1 
  145.       Caption         =   "Command1"
  146.       Height          =   495
  147.       Left            =   9690
  148.       TabIndex        =   18
  149.       Top             =   6690
  150.       Width           =   1215
  151.    End
  152.    Begin VB.PictureBox PicSave 
  153.       Appearance      =   0  'Flat
  154.       AutoRedraw      =   -1  'True
  155.       AutoSize        =   -1  'True
  156.       BackColor       =   &H80000005&
  157.       BorderStyle     =   0  'None
  158.       ForeColor       =   &H80000008&
  159.       Height          =   1440
  160.       Left            =   8550
  161.       ScaleHeight     =   96
  162.       ScaleMode       =   3  'Pixel
  163.       ScaleWidth      =   117
  164.       TabIndex        =   16
  165.       Top             =   7305
  166.       Width           =   1755
  167.    End
  168.    Begin VB.PictureBox PicWork 
  169.       Appearance      =   0  'Flat
  170.       AutoRedraw      =   -1  'True
  171.       AutoSize        =   -1  'True
  172.       BackColor       =   &H80000005&
  173.       BorderStyle     =   0  'None
  174.       ForeColor       =   &H80000008&
  175.       Height          =   1440
  176.       Left            =   6705
  177.       ScaleHeight     =   96
  178.       ScaleMode       =   3  'Pixel
  179.       ScaleWidth      =   117
  180.       TabIndex        =   15
  181.       Top             =   7335
  182.       Width           =   1755
  183.    End
  184.    Begin VB.PictureBox PicMask 
  185.       Appearance      =   0  'Flat
  186.       AutoRedraw      =   -1  'True
  187.       AutoSize        =   -1  'True
  188.       BackColor       =   &H80000005&
  189.       BorderStyle     =   0  'None
  190.       ForeColor       =   &H80000008&
  191.       Height          =   1440
  192.       Left            =   5085
  193.       Picture         =   "DOCKING2.frx":4B444
  194.       ScaleHeight     =   96
  195.       ScaleMode       =   3  'Pixel
  196.       ScaleWidth      =   100
  197.       TabIndex        =   14
  198.       Top             =   7350
  199.       Width           =   1500
  200.    End
  201.    Begin VB.PictureBox PicImage 
  202.       Appearance      =   0  'Flat
  203.       AutoRedraw      =   -1  'True
  204.       AutoSize        =   -1  'True
  205.       BackColor       =   &H80000005&
  206.       BorderStyle     =   0  'None
  207.       ForeColor       =   &H80000008&
  208.       Height          =   1410
  209.       Left            =   3420
  210.       Picture         =   "DOCKING2.frx":4DE08
  211.       ScaleHeight     =   94
  212.       ScaleMode       =   3  'Pixel
  213.       ScaleWidth      =   99
  214.       TabIndex        =   13
  215.       Top             =   7365
  216.       Width           =   1485
  217.    End
  218.    Begin VB.PictureBox auxcon 
  219.       AutoRedraw      =   -1  'True
  220.       AutoSize        =   -1  'True
  221.       BorderStyle     =   0  'None
  222.       Height          =   1425
  223.       Index           =   5
  224.       Left            =   10110
  225.       Picture         =   "DOCKING2.frx":50704
  226.       ScaleHeight     =   95
  227.       ScaleMode       =   3  'Pixel
  228.       ScaleWidth      =   117
  229.       TabIndex        =   9
  230.       Top             =   2385
  231.       Width           =   1755
  232.    End
  233.    Begin VB.PictureBox auxcon 
  234.       AutoRedraw      =   -1  'True
  235.       AutoSize        =   -1  'True
  236.       BorderStyle     =   0  'None
  237.       Height          =   1425
  238.       Index           =   4
  239.       Left            =   10290
  240.       Picture         =   "DOCKING2.frx":537D0
  241.       ScaleHeight     =   95
  242.       ScaleMode       =   3  'Pixel
  243.       ScaleWidth      =   117
  244.       TabIndex        =   8
  245.       Top             =   1635
  246.       Width           =   1755
  247.    End
  248.    Begin VB.PictureBox auxcon 
  249.       AutoRedraw      =   -1  'True
  250.       AutoSize        =   -1  'True
  251.       BorderStyle     =   0  'None
  252.       Height          =   1425
  253.       Index           =   3
  254.       Left            =   10335
  255.       Picture         =   "DOCKING2.frx":5689C
  256.       ScaleHeight     =   95
  257.       ScaleMode       =   3  'Pixel
  258.       ScaleWidth      =   117
  259.       TabIndex        =   7
  260.       Top             =   1215
  261.       Width           =   1755
  262.    End
  263.    Begin VB.PictureBox auxcon 
  264.       AutoRedraw      =   -1  'True
  265.       AutoSize        =   -1  'True
  266.       BorderStyle     =   0  'None
  267.       Height          =   1425
  268.       Index           =   2
  269.       Left            =   9825
  270.       Picture         =   "DOCKING2.frx":59968
  271.       ScaleHeight     =   95
  272.       ScaleMode       =   3  'Pixel
  273.       ScaleWidth      =   117
  274.       TabIndex        =   6
  275.       Top             =   555
  276.       Width           =   1755
  277.    End
  278.    Begin VB.PictureBox auxcon 
  279.       AutoRedraw      =   -1  'True
  280.       AutoSize        =   -1  'True
  281.       BorderStyle     =   0  'None
  282.       Height          =   1425
  283.       Index           =   1
  284.       Left            =   9975
  285.       Picture         =   "DOCKING2.frx":5CA34
  286.       ScaleHeight     =   95
  287.       ScaleMode       =   3  'Pixel
  288.       ScaleWidth      =   117
  289.       TabIndex        =   5
  290.       Top             =   135
  291.       Width           =   1755
  292.    End
  293.    Begin VB.PictureBox picWorkBG 
  294.       Appearance      =   0  'Flat
  295.       AutoRedraw      =   -1  'True
  296.       AutoSize        =   -1  'True
  297.       BackColor       =   &H00400000&
  298.       ForeColor       =   &H80000008&
  299.       Height          =   4860
  300.       Left            =   4860
  301.       ScaleHeight     =   322
  302.       ScaleMode       =   3  'Pixel
  303.       ScaleWidth      =   635
  304.       TabIndex        =   4
  305.       Top             =   7305
  306.       Width           =   9555
  307.    End
  308.    Begin VB.PictureBox picBGoriginal 
  309.       Appearance      =   0  'Flat
  310.       AutoRedraw      =   -1  'True
  311.       AutoSize        =   -1  'True
  312.       BackColor       =   &H80000005&
  313.       ForeColor       =   &H80000008&
  314.       Height          =   9030
  315.       Left            =   -9360
  316.       Picture         =   "DOCKING2.frx":5FB00
  317.       ScaleHeight     =   600
  318.       ScaleMode       =   3  'Pixel
  319.       ScaleWidth      =   800
  320.       TabIndex        =   1
  321.       Top             =   7350
  322.       Width           =   12030
  323.    End
  324.    Begin VB.PictureBox picPitMask 
  325.       Appearance      =   0  'Flat
  326.       AutoRedraw      =   -1  'True
  327.       AutoSize        =   -1  'True
  328.       BackColor       =   &H80000005&
  329.       BorderStyle     =   0  'None
  330.       ForeColor       =   &H80000008&
  331.       Height          =   5205
  332.       Left            =   9780
  333.       Picture         =   "DOCKING2.frx":D5244
  334.       ScaleHeight     =   347
  335.       ScaleMode       =   3  'Pixel
  336.       ScaleWidth      =   640
  337.       TabIndex        =   3
  338.       Top             =   4020
  339.       Width           =   9600
  340.    End
  341.    Begin VB.PictureBox picPitSprite 
  342.       Appearance      =   0  'Flat
  343.       AutoRedraw      =   -1  'True
  344.       AutoSize        =   -1  'True
  345.       BackColor       =   &H80000005&
  346.       BorderStyle     =   0  'None
  347.       ForeColor       =   &H80000008&
  348.       Height          =   5205
  349.       Left            =   10005
  350.       Picture         =   "DOCKING2.frx":10BA08
  351.       ScaleHeight     =   347
  352.       ScaleMode       =   3  'Pixel
  353.       ScaleWidth      =   640
  354.       TabIndex        =   2
  355.       Top             =   510
  356.       Width           =   9600
  357.    End
  358.    Begin VB.Timer Timer1 
  359.       Enabled         =   0   'False
  360.       Interval        =   55
  361.       Left            =   9960
  362.       Top             =   5865
  363.    End
  364.    Begin VB.PictureBox Picture4 
  365.       AutoRedraw      =   -1  'True
  366.       AutoSize        =   -1  'True
  367.       BorderStyle     =   0  'None
  368.       Height          =   7200
  369.       Left            =   0
  370.       Picture         =   "DOCKING2.frx":1421CC
  371.       ScaleHeight     =   480
  372.       ScaleMode       =   3  'Pixel
  373.       ScaleWidth      =   640
  374.       TabIndex        =   0
  375.       Top             =   -15
  376.       Width           =   9600
  377.       Begin VB.PictureBox auxcon 
  378.          AutoRedraw      =   -1  'True
  379.          AutoSize        =   -1  'True
  380.          BorderStyle     =   0  'None
  381.          Height          =   1425
  382.          Index           =   0
  383.          Left            =   4110
  384.          Picture         =   "DOCKING2.frx":18D610
  385.          ScaleHeight     =   95
  386.          ScaleMode       =   3  'Pixel
  387.          ScaleWidth      =   117
  388.          TabIndex        =   10
  389.          Top             =   5520
  390.          Width           =   1755
  391.          Begin VB.Image auxjoy 
  392.             Height          =   300
  393.             Index           =   0
  394.             Left            =   720
  395.             Top             =   225
  396.             Width           =   300
  397.          End
  398.          Begin VB.Image auxjoy 
  399.             Height          =   300
  400.             Index           =   1
  401.             Left            =   1035
  402.             Top             =   555
  403.             Width           =   300
  404.          End
  405.          Begin VB.Image auxjoy 
  406.             Height          =   300
  407.             Index           =   2
  408.             Left            =   720
  409.             Top             =   870
  410.             Width           =   300
  411.          End
  412.          Begin VB.Image auxjoy 
  413.             Height          =   300
  414.             Index           =   3
  415.             Left            =   390
  416.             Top             =   555
  417.             Width           =   300
  418.          End
  419.       End
  420.       Begin VB.PictureBox picBackground 
  421.          Appearance      =   0  'Flat
  422.          BackColor       =   &H00000000&
  423.          BorderStyle     =   0  'None
  424.          DragIcon        =   "DOCKING2.frx":1906DC
  425.          ForeColor       =   &H80000008&
  426.          Height          =   5190
  427.          Left            =   0
  428.          Picture         =   "DOCKING2.frx":1909E6
  429.          ScaleHeight     =   346
  430.          ScaleMode       =   3  'Pixel
  431.          ScaleWidth      =   640
  432.          TabIndex        =   17
  433.          Top             =   150
  434.          Width           =   9600
  435.          Begin VB.TextBox splattextbox 
  436.             Alignment       =   2  'Center
  437.             BackColor       =   &H00000000&
  438.             ForeColor       =   &H000000FF&
  439.             Height          =   300
  440.             Left            =   1830
  441.             TabIndex        =   30
  442.             Top             =   165
  443.             Visible         =   0   'False
  444.             Width           =   6000
  445.          End
  446.          Begin VB.Label labeltime 
  447.             Alignment       =   2  'Center
  448.             BackStyle       =   0  'Transparent
  449.             Caption         =   "labeltime"
  450.             ForeColor       =   &H000000FF&
  451.             Height          =   285
  452.             Left            =   7710
  453.             TabIndex        =   29
  454.             Top             =   600
  455.             Visible         =   0   'False
  456.             Width           =   870
  457.          End
  458.       End
  459.       Begin VB.Image dockThrust 
  460.          Height          =   330
  461.          Index           =   2
  462.          Left            =   7515
  463.          Picture         =   "DOCKING2.frx":1C71AA
  464.          Top             =   6540
  465.          Width           =   195
  466.       End
  467.       Begin VB.Image dockThrust 
  468.          Height          =   330
  469.          Index           =   1
  470.          Left            =   7710
  471.          Picture         =   "DOCKING2.frx":1C774E
  472.          Top             =   6540
  473.          Width           =   195
  474.       End
  475.       Begin VB.Image dockThrust 
  476.          Height          =   330
  477.          Index           =   0
  478.          Left            =   7965
  479.          Picture         =   "DOCKING2.frx":1C7CF2
  480.          Top             =   6540
  481.          Width           =   195
  482.       End
  483.       Begin VB.Label Label1 
  484.          Caption         =   "Label1"
  485.          Height          =   465
  486.          Left            =   2925
  487.          TabIndex        =   28
  488.          Top             =   675
  489.          Width           =   4215
  490.       End
  491.       Begin VB.Image Image1 
  492.          Height          =   585
  493.          Index           =   2
  494.          Left            =   8175
  495.          Picture         =   "DOCKING2.frx":1C8296
  496.          Top             =   5535
  497.          Visible         =   0   'False
  498.          Width           =   870
  499.       End
  500.       Begin VB.Image Image1 
  501.          Height          =   570
  502.          Index           =   1
  503.          Left            =   7305
  504.          Picture         =   "DOCKING2.frx":1C8C72
  505.          Top             =   5535
  506.          Visible         =   0   'False
  507.          Width           =   870
  508.       End
  509.       Begin VB.Image Image1 
  510.          Height          =   585
  511.          Index           =   0
  512.          Left            =   6435
  513.          Picture         =   "DOCKING2.frx":1C9616
  514.          Top             =   5550
  515.          Visible         =   0   'False
  516.          Width           =   870
  517.       End
  518.       Begin VB.Label distance 
  519.          AutoSize        =   -1  'True
  520.          BackStyle       =   0  'Transparent
  521.          Caption         =   "1000"
  522.          BeginProperty Font 
  523.             name            =   "MS Sans Serif"
  524.             charset         =   1
  525.             weight          =   400
  526.             size            =   13.5
  527.             underline       =   0   'False
  528.             italic          =   0   'False
  529.             strikethrough   =   0   'False
  530.          EndProperty
  531.          ForeColor       =   &H0000FF00&
  532.          Height          =   360
  533.          Left            =   1140
  534.          TabIndex        =   12
  535.          Top             =   6435
  536.          Width           =   600
  537.       End
  538.       Begin VB.Label closerate 
  539.          AutoSize        =   -1  'True
  540.          BackStyle       =   0  'Transparent
  541.          Caption         =   "1000"
  542.          BeginProperty Font 
  543.             name            =   "MS Sans Serif"
  544.             charset         =   1
  545.             weight          =   400
  546.             size            =   13.5
  547.             underline       =   0   'False
  548.             italic          =   0   'False
  549.             strikethrough   =   0   'False
  550.          EndProperty
  551.          ForeColor       =   &H0000FF00&
  552.          Height          =   360
  553.          Left            =   1140
  554.          TabIndex        =   11
  555.          Top             =   5790
  556.          Width           =   600
  557.       End
  558.    End
  559. End
  560. Attribute VB_Name = "docking"
  561. Attribute VB_Creatable = False
  562. Attribute VB_Exposed = False
  563.  
  564. Option Explicit
  565. Dim WaitingToLeave As Boolean
  566. Dim IAMTurnedAround As Boolean
  567. Dim Backward As Integer
  568.  
  569. ' Constant for joystick
  570. Dim JoyInfo As tJoyInfo
  571. Dim RangeWidth As Integer
  572. Dim RangeHeight As Integer
  573. Dim ScrollSpeed As Integer     ' The ship's current turning speed
  574. Rem
  575. Dim topj, leftj, rightj, bottomj, centx, centy, leftX, rightX, topY, bottomY As Long
  576.  
  577. ' Constants for mouse action.
  578. Const NO_BUTTON = 0
  579. Const LBUTTON = 1
  580. Const RBUTTON = 2
  581.  
  582. ' Constants for WaveMix channels
  583.  
  584. Const BACKGROUND = 0
  585. Const MISSION_CONTROL = 1
  586. Const BUTTONS = 2
  587. Const EFFECTS = 3
  588. Const WARNINGS = 4
  589. Const MCSECOND = 5
  590.  
  591. Const Gravity = 13 'lunar gravity
  592.  
  593. Const LUPE = 1
  594. Const NO_LUPE = 0
  595.  
  596. Const MOONHEIGHT = 1200
  597. ' Boolean that indicates if mouse button has been pressed down.
  598. Dim MouseButtonDown As Integer
  599.  
  600.  
  601. '-----------------------------------------------------
  602. ' BITDEMO1.FRM
  603. ' This program demonstrates some of the methods used
  604. ' to display bitmaps and sprites.
  605. '-----------------------------------------------------
  606.  
  607. ' The number of pixels to offset the sprite
  608. ' each time it is moved.
  609. Const INCREMENT = 1
  610.  
  611. ' Constants for Raster Operations used by BitBlt function.
  612. Const SRCAND = &H8800C6      ' dest = source AND dest
  613. Const SRCCOPY = &HCC0020     ' dest = source
  614. Const SRCPAINT = &HEE0086    ' dest = source OR dest
  615.  
  616. 'Dim Ship(1 To 4) As tShip
  617.  
  618. ' The x and y coordinates for the Sprite
  619. Dim SpriteX As Integer
  620. Dim SpriteY As Integer
  621.  
  622. ' The x and y coordinates for the upper left corner
  623. ' of the large bitmap (picBMP).
  624. Dim BackgroundX As Integer
  625. Dim BackgroundY As Integer
  626.  
  627. ' The width and height of the work area bitmap (picWork).
  628. Dim WorkWidth As Integer
  629. Dim WorkHeight As Integer
  630.  
  631. Dim ldist As Integer
  632. Dim zcomponent As Integer
  633. Dim S4B(51) As String
  634. Dim s4bmask(51) As String
  635. Dim csmDock(51) As String
  636. Dim csmMask(51) As String
  637.  
  638. Dim DistDrop As Integer
  639. Dim DropTime As Integer
  640. Dim LmAlt As Integer
  641. Dim dirtLevel As Integer
  642. Dim OlddirtLevel As Integer
  643. Dim AltiMeter As Integer
  644. Dim AltiMeterReading As Integer
  645. Dim FwdVel As Single
  646. Dim LatVel As Single
  647. Dim FwdDist As Single
  648. Dim LatDist As Single
  649. Dim Direction As String
  650. Dim PorSta As String
  651. Dim ForRev As String
  652.  
  653. Rem --- disScreen declarations ---
  654. Dim Box(4, 2) As Integer
  655. Dim poly_clip_min_x, poly_clip_min_y, poly_clip_max_x, poly_clip_max_y As Integer
  656. Dim X1, Y1, X2, Y2 As Integer
  657. Dim ClipReturn, WithClip As Boolean
  658.  
  659. Rem --- landstuff declarations
  660. Const GREEN = 2
  661. Const LTGREEN = 10
  662. Const LTRED = 12
  663. Const BLACK = 0
  664. '/*****************************************************************************/
  665. Dim Biggy(300, 400) As Integer 'array to hold altitudes
  666. Dim TargetBiggy(300, 400) As Boolean 'array to hold position of target
  667. 'Dim NextBiggy(300, 400) As Integer 'array to hold 2nd set of altitudes for hyperclose landing
  668. 'Dim NextTargetBiggy(300, 400) As Boolean 'array to hold position of X and C3PO
  669. 'Dim GenBiggy(300, 400) As Integer 'array to hold altitudes for general landing other than land site
  670. Dim Display(32, 32) As Integer 'array hold alts for movement
  671. Dim TargetDisplay(32, 32) As Boolean 'array holds target position for movement
  672. Dim Cdisplay(32, 32) As Integer ' array to hold old values for ClearScreen
  673. Dim BluedLine(32) As Integer 'which lines are created
  674. Dim CollisionFlag As Integer 'special cases, mtn, crater, life, death, etc.
  675.  
  676. 'Dim NewMap As Integer '0 is original, 1 is Landing site, 2 is general landing map
  677.  
  678. Dim Doublein, DoubleStart, DoubleFlag As Integer
  679.  
  680. 'Scaling Constants
  681. Const XSCALE = 17
  682. Const YSCALE = 3
  683. Const SPACING = 8
  684.  
  685. Dim starty, startx As Integer 'begining position on any map for starting
  686. Dim OldStarty, OldStartx As Integer
  687. Dim xoffset, yoffset As Integer
  688. Dim GraphOffset As Integer
  689. Dim Mag As Single 'Multiplication factor
  690. Dim biggytemp As Integer 'map array
  691. Dim hShift, vShift As Integer 'amounts to move position of radar
  692.  
  693. Dim pubXpos As Integer
  694. Dim pubYpos As Integer
  695.  
  696. Dim diedFlag As Boolean
  697. Sub JoyControl(Index As Integer)
  698.   Dim x As Integer
  699.  
  700.   auxjoy(0).Visible = False
  701.   auxjoy(1).Visible = False
  702.   auxjoy(2).Visible = False
  703.   auxjoy(3).Visible = False
  704.   
  705.  Select Case Index
  706.    Case Is = 0
  707.      'Ydock = Ydock - 1
  708.      auxcon(0).Picture = auxcon(1).Picture
  709.    Case Is = 1
  710.      'Xdock = Xdock + 1
  711.      auxcon(0).Picture = auxcon(2).Picture
  712.    Case Is = 2
  713.      'Ydock = Ydock + 1
  714.      auxcon(0).Picture = auxcon(3).Picture
  715.    Case Is = 3
  716.      'Xdock = Xdock - 1
  717.      auxcon(0).Picture = auxcon(4).Picture
  718.  End Select
  719.  
  720.  'x = frmtime.playsound("rcstrst.wav", 3, 0)
  721. End Sub
  722.  
  723.  
  724.  
  725.  
  726.  
  727. Sub auxjoy_Click(Index As Integer)
  728. Dim x As Integer
  729. Dim currpath As String
  730. currpath = CDdrive + "\docking\csm4\"
  731.  
  732.   auxjoy(0).Visible = False
  733.   auxjoy(1).Visible = False
  734.   auxjoy(2).Visible = False
  735.   auxjoy(3).Visible = False
  736.   
  737.  Select Case Index
  738.    Case Is = 0
  739.      Ydock = Ydock - 1
  740.      auxcon(0).Picture = auxcon(1).Picture
  741.      RCSBurstCount = RCSBurstCount + 1
  742.    Case Is = 1
  743.      Xdock = Xdock + 1
  744.      auxcon(0).Picture = auxcon(2).Picture
  745.      LatVel = 33 * Xdock
  746.      RCSBurstCount = RCSBurstCount + 1
  747.    Case Is = 2
  748.      Ydock = Ydock + 1
  749.      auxcon(0).Picture = auxcon(3).Picture
  750.      RCSBurstCount = RCSBurstCount + 1
  751.    Case Is = 3
  752.      Xdock = Xdock - 1
  753.      auxcon(0).Picture = auxcon(4).Picture
  754.      LatVel = 33 * Xdock
  755.      RCSBurstCount = RCSBurstCount + 1
  756. End Select
  757.   If MissionState = 6 And (Index = 0 Or Index = 2) Then
  758.     x = frmTime.playSound(CDdrive + "\sfx\updwnrcs.wav", EFFECTS, NO_LUPE)
  759.   Else
  760.     x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  761.   End If
  762. End Sub
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774. Sub Command2_Click(Index As Integer)
  775.   Dim x As Integer
  776.   Dim currpath As String
  777.   
  778.   currpath = CDdrive + "\docking\csm4\"
  779.   
  780.   Select Case Index
  781.     Case Is = 0
  782.       If MissionState = 6 Then
  783.         Zdock = Zdock - 1
  784.         FwdVel = -Zdock * 33
  785.       Else
  786.         Zdock = Zdock - 1
  787.       End If
  788.     Case Is = 1
  789.       If MissionState = 6 Then
  790.         Zdock = Zdock + 1
  791.         FwdVel = -Zdock * 33
  792.       Else
  793.         Zdock = Zdock + 1
  794.       End If
  795.   End Select
  796.   If MissionState = 6 Then
  797.     x = frmTime.playSound(CDdrive + "\sfx\updwnrcs.wav", EFFECTS, NO_LUPE)
  798.   Else
  799.     x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  800.   End If
  801. End Sub
  802.  
  803. Sub Form_Load()
  804. Dim x As Integer
  805. Dim rc As Long
  806. Randomize
  807.  
  808. StopEverything = False
  809.  
  810. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  811. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  812. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  813. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  814. Timer1.Enabled = False
  815. Timer2.Enabled = False
  816. Timer3.Enabled = False
  817. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  818. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  819. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  820. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  821. Rem --- set the pallette pref
  822. picBGOriginal.ZOrder 0
  823. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  824. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  825. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  826. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  827. picBackground.Visible = False
  828. picBackground.Picture = picPitSprite.Picture
  829. MouseButtonDown = NO_BUTTON
  830. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  831. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  832. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  833. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  834. Image1(0).Visible = True
  835. Image1(1).Visible = True
  836. Image1(2).Visible = True
  837. Command2(0).Visible = True
  838. Command2(1).Visible = True
  839. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  840. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  841. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  842. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  843. If StarCrossed Then ' star finder
  844.   Xdock = 0
  845.   Ydock = 0
  846.   LookedForStars = True
  847.   VScroll1.Visible = False
  848.   picBGOriginal = LoadPicture(CDdrive + "\panels\starfind\strfld4.bmp")
  849.   Timer3.Enabled = True
  850.   picBackground.Picture = LoadPicture(CDdrive + "\panels\starfind\strfndw.bmp")
  851.   picPitSprite.Picture = LoadPicture(CDdrive + "\panels\starfind\strfndw.bmp")
  852.   picPitMask.Picture = LoadPicture(CDdrive + "\panels\starfind\strfndm.bmp")
  853.   starlock.Visible = False
  854.   distance.Visible = False
  855.   closerate.Visible = False
  856.   docking.dockThrust(0).Visible = False
  857.   docking.dockThrust(1).Visible = False
  858.   docking.dockThrust(2).Visible = False
  859.   firstXpos = -(Int(Rnd * 500) + 1)
  860.   firstYpos = -(Int(Rnd * 400) + 1)
  861. ElseIf MissionState = 2 Then ' earth orbit
  862.   VScroll1.Visible = False
  863.   starlock.Visible = False
  864.   Xdock = 0
  865.   Ydock = 0
  866.   Zdock = 0
  867.   ldist = 120
  868.   picBGOriginal = LoadPicture(CDdrive + "\docking\csm4\strfld2.bmp")
  869.   S4B(1) = CDdrive + "\docking\s4b\s4b1.bmp"
  870.   S4B(2) = CDdrive + "\docking\s4b\s4b2.bmp"
  871.   S4B(3) = CDdrive + "\docking\s4b\s4b3.bmp"
  872.   S4B(4) = CDdrive + "\docking\s4b\s4b4.bmp"
  873.   S4B(5) = CDdrive + "\docking\s4b\s4b5.bmp"
  874.   S4B(6) = CDdrive + "\docking\s4b\s4b6.bmp"
  875.   S4B(7) = CDdrive + "\docking\s4b\s4b7.bmp"
  876.   S4B(8) = CDdrive + "\docking\s4b\s4b8.bmp"
  877.   S4B(9) = CDdrive + "\docking\s4b\s4b9.bmp"
  878.   S4B(10) = CDdrive + "\docking\s4b\s4b10.bmp"
  879.   S4B(11) = CDdrive + "\docking\s4b\s4b11.bmp"
  880.   S4B(12) = CDdrive + "\docking\s4b\s4b12.bmp"
  881.   S4B(13) = CDdrive + "\docking\s4b\s4b13.bmp"
  882.   S4B(14) = CDdrive + "\docking\s4b\s4b14.bmp"
  883.   S4B(15) = CDdrive + "\docking\s4b\s4b15.bmp"
  884.   S4B(16) = CDdrive + "\docking\s4b\s4b16.bmp"
  885.   S4B(17) = CDdrive + "\docking\s4b\s4b17.bmp"
  886.   S4B(18) = CDdrive + "\docking\s4b\s4b18.bmp"
  887.   s4bmask(1) = CDdrive + "\docking\mask\s4b1m.bmp"
  888.   s4bmask(2) = CDdrive + "\docking\mask\s4b2m.bmp"
  889.   s4bmask(3) = CDdrive + "\docking\mask\s4b3m.bmp"
  890.   s4bmask(4) = CDdrive + "\docking\mask\s4b4m.bmp"
  891.   s4bmask(5) = CDdrive + "\docking\mask\s4b5m.bmp"
  892.   s4bmask(6) = CDdrive + "\docking\mask\s4b6m.bmp"
  893.   s4bmask(7) = CDdrive + "\docking\mask\s4b7m.bmp"
  894.   s4bmask(8) = CDdrive + "\docking\mask\s4b8m.bmp"
  895.   s4bmask(9) = CDdrive + "\docking\mask\s4b9m.bmp"
  896.   s4bmask(10) = CDdrive + "\docking\mask\s4b10m.bmp"
  897.   s4bmask(11) = CDdrive + "\docking\mask\s4b11m.bmp"
  898.   s4bmask(12) = CDdrive + "\docking\mask\s4b12m.bmp"
  899.   s4bmask(13) = CDdrive + "\docking\mask\s4b13m.bmp"
  900.   s4bmask(14) = CDdrive + "\docking\mask\s4b14m.bmp"
  901.   s4bmask(15) = CDdrive + "\docking\mask\s4b15m.bmp"
  902.   s4bmask(16) = CDdrive + "\docking\mask\s4b16m.bmp"
  903.   s4bmask(17) = CDdrive + "\docking\mask\s4b17m.bmp"
  904.   s4bmask(18) = CDdrive + "\docking\mask\s4b18m.bmp"
  905.   Timer1.Enabled = True
  906.   text1.Visible = False
  907.   Text2.Visible = False
  908.   Text3.Visible = False
  909.   Text4.Visible = False
  910.   Text5.Visible = False
  911.   Text6.Visible = False
  912.   labeltime.Visible = False
  913.   SplatTextBox.Visible = False
  914.   distance.Visible = True
  915.   closerate.Visible = True
  916.   docking.dockThrust(0).Visible = False
  917.   docking.dockThrust(1).Visible = False
  918.   docking.dockThrust(2).Visible = False
  919. ElseIf MissionState = 6 Then 'Landing
  920.   lmEng = True
  921.   VScroll1.Visible = True
  922.   starlock.Visible = False
  923.   Xdock = 0
  924.   Ydock = 0
  925.   Zdock = 0
  926.   picBackground.Picture = LoadPicture(CDdrive + "\landsite\lmScren.bmp")
  927.   picPitSprite.Picture = LoadPicture(CDdrive + "\landsite\lmScren.bmp")
  928.   picPitMask.Picture = LoadPicture(CDdrive + "\landsite\lmScrmsk.bmp")
  929.   picImage = LoadPicture(CDdrive + "\landsite\croshair.bmp")
  930.   picPitMask = LoadPicture(CDdrive + "\landsite\croshair.bmp")
  931.   FwdVel = -200
  932.   LmAlt = 1200 '1200
  933.   VScroll1.Value = 50
  934.   xoffset = 133  '  110 - target
  935.   yoffset = 93  '   75 - target
  936.   startx = Int(Rnd * 100) + 50 '50
  937.   starty = Int(Rnd * 100) + 225 '300
  938.   GraphOffset = 0
  939.   hShift = 47 'amount to shift radar
  940.   vShift = 60 'amount to shift radar
  941.   WithClip = True
  942.   Mag = 1
  943.   text1.Visible = True
  944.   Text2.Visible = True
  945.   Text3.Visible = True
  946.   Text4.Visible = True
  947.   Text5.Visible = True
  948.   Text6.Visible = True
  949.   labeltime.Visible = True
  950.   SplatTextBox.Visible = True
  951.   'limits of box
  952.   poly_clip_min_x = 50
  953.   poly_clip_min_y = 80
  954.   poly_clip_max_x = 575
  955.   poly_clip_max_y = 320
  956.   Box(0, 0) = poly_clip_min_x 'top left X
  957.   Box(0, 1) = poly_clip_min_y 'top left Y
  958.   Box(1, 0) = poly_clip_max_x 'top right X
  959.   Box(1, 1) = poly_clip_min_y 'top right Y
  960.   Box(2, 0) = poly_clip_max_x 'bottom right X
  961.   Box(2, 1) = poly_clip_max_y 'bottom right Y
  962.   Box(3, 0) = poly_clip_min_x 'bottom left X
  963.   Box(3, 1) = poly_clip_max_y 'bottom left Y
  964.   loadYvals
  965.   Timer2.Enabled = True
  966.   DockedWithCSM = True
  967.   LmAlt = 1200
  968.   Xdock = 0
  969.   Ydock = 0
  970.   Zdock = -6
  971.   FwdVel = -Zdock * 33
  972.   distance.Visible = True
  973.   closerate.Visible = True
  974.   docking.dockThrust(0).Picture = frmTime.imgdnum(0).Picture
  975.   docking.dockThrust(1).Picture = frmTime.imgdnum(5).Picture
  976.   docking.dockThrust(2).Picture = frmTime.imgdnum(0).Picture
  977.   docking.dockThrust(0).Visible = True
  978.   docking.dockThrust(1).Visible = True
  979.   docking.dockThrust(2).Visible = True
  980. ElseIf MissionState = 8 Then ' moon orbit
  981.   VScroll1.Visible = False
  982.   starlock.Visible = False
  983.   Xdock = 0
  984.   Ydock = 0
  985.   Zdock = 0
  986.   ldist = 120
  987.   picBGOriginal = LoadPicture(CDdrive + "\docking\csm4\strfld3.bmp")
  988.   csmDock(1) = CDdrive + "\docking\CSM\csm1.bmp"
  989.   csmDock(2) = CDdrive + "\docking\CSM\csm2.bmp"
  990.   csmDock(3) = CDdrive + "\docking\CSM\csm3.bmp"
  991.   csmDock(4) = CDdrive + "\docking\CSM\csm4.bmp"
  992.   csmDock(5) = CDdrive + "\docking\CSM\csm5.bmp"
  993.   csmDock(6) = CDdrive + "\docking\CSM\csm6.bmp"
  994.   csmDock(7) = CDdrive + "\docking\CSM\csm7.bmp"
  995.   csmDock(8) = CDdrive + "\docking\CSM\csm8.bmp"
  996.   csmDock(9) = CDdrive + "\docking\CSM\csm9.bmp"
  997.   csmDock(10) = CDdrive + "\docking\CSM\csm10.bmp"
  998.   csmDock(11) = CDdrive + "\docking\CSM\csm11.bmp"
  999.   csmDock(12) = CDdrive + "\docking\CSM\csm12.bmp"
  1000.   csmDock(13) = CDdrive + "\docking\CSM\csm13.bmp"
  1001.   csmDock(14) = CDdrive + "\docking\CSM\csm14.bmp"
  1002.   csmDock(15) = CDdrive + "\docking\CSM\csm15.bmp"
  1003.   csmDock(16) = CDdrive + "\docking\CSM\csm16.bmp"
  1004.   csmDock(17) = CDdrive + "\docking\CSM\csm17.bmp"
  1005.   csmDock(18) = CDdrive + "\docking\CSM\csm18.bmp"
  1006.   csmMask(1) = CDdrive + "\docking\cMask\cMask1.bmp"
  1007.   csmMask(2) = CDdrive + "\docking\cMask\cMask2.bmp"
  1008.   csmMask(3) = CDdrive + "\docking\cMask\cMask3.bmp"
  1009.   csmMask(4) = CDdrive + "\docking\cMask\cMask4.bmp"
  1010.   csmMask(5) = CDdrive + "\docking\cMask\cMask5.bmp"
  1011.   csmMask(6) = CDdrive + "\docking\cMask\cMask6.bmp"
  1012.   csmMask(7) = CDdrive + "\docking\cMask\cMask7.bmp"
  1013.   csmMask(8) = CDdrive + "\docking\cMask\cMask8.bmp"
  1014.   csmMask(9) = CDdrive + "\docking\cMask\cMask9.bmp"
  1015.   csmMask(10) = CDdrive + "\docking\cMask\cMask10.bmp"
  1016.   csmMask(11) = CDdrive + "\docking\cMask\cMask11.bmp"
  1017.   csmMask(12) = CDdrive + "\docking\cMask\cMask12.bmp"
  1018.   csmMask(13) = CDdrive + "\docking\cMask\cMask13.bmp"
  1019.   csmMask(14) = CDdrive + "\docking\cMask\cMask14.bmp"
  1020.   csmMask(15) = CDdrive + "\docking\cMask\cMask15.bmp"
  1021.   csmMask(16) = CDdrive + "\docking\cMask\cMask16.bmp"
  1022.   csmMask(17) = CDdrive + "\docking\cMask\cMask17.bmp"
  1023.   csmMask(18) = CDdrive + "\docking\cMask\cMask18.bmp"
  1024.   Timer1.Enabled = True
  1025.   text1.Visible = False
  1026.   Text2.Visible = False
  1027.   Text3.Visible = False
  1028.   Text4.Visible = False
  1029.   Text5.Visible = False
  1030.   Text6.Visible = False
  1031.   labeltime.Visible = False
  1032.   SplatTextBox.Visible = False
  1033.   distance.Visible = True
  1034.   closerate.Visible = True
  1035.   docking.dockThrust(0).Visible = False
  1036.   docking.dockThrust(1).Visible = False
  1037.   docking.dockThrust(2).Visible = False
  1038. End If
  1039. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1040. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1041. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1042. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1043. Rem *** check to see if joystick will be used ***
  1044. If joystick = 1 Then
  1045.   'Calibrate.Visible = True
  1046.   '/* temp vals for joyst */
  1047.   rightX = 40000
  1048.   leftX = 6200
  1049.   topY = 14250
  1050.   bottomY = 45251
  1051.   rc = BitBlt(picBackground.hDC, SpriteX, SpriteY, picSave.ScaleWidth, picSave.ScaleHeight, picSave.hDC, 0, 0, SRCCOPY)
  1052.   'StartGame
  1053. Else
  1054.   rc = BitBlt(picBackground.hDC, SpriteX, SpriteY, picSave.ScaleWidth, picSave.ScaleHeight, picSave.hDC, 0, 0, SRCCOPY)
  1055.   'StartGame
  1056. End If
  1057. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1058. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1059. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1060. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1061. 'tdigs(0) = 0
  1062. 'tdigs(1) = 5
  1063. 'tdigs(2) = 0
  1064.  
  1065. picBackground.Visible = True
  1066. ScrollSpeed = 5
  1067.  
  1068.  
  1069. frmTime.Center Me
  1070. Me.Visible = True
  1071. Me.Show
  1072. frmTime.TopperOn 5 'docking to fore
  1073.  
  1074. StopEverything = False
  1075.  
  1076. If MissionState = 6 Then disScreen
  1077.  
  1078. End Sub
  1079. Sub Form_Unload(Cancel As Integer)
  1080.  ' WAVMIX_Close
  1081.  'goGame = 0
  1082. If Not CompUnload Then Cancel = 1
  1083.   StarCrossed = False
  1084. End Sub
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090. Sub Image1_Click(Index As Integer)
  1091.   Dim x As Integer
  1092.   
  1093.   
  1094.   Select Case Index
  1095.     Case Is = 0 'Csm1
  1096.       If goodDock = True Or FoundStars = True Then
  1097.         TranzFlag = True
  1098.         Male = 3 'coming from docking
  1099.         StopEverything = True
  1100.         If MissionState = 8 Or MissionState = 7 Then
  1101.           Female = 2 'going to LM
  1102.         Else
  1103.           Female = 1 'going to CSM
  1104.         End If
  1105.       End If
  1106.     Case Is = 1 'Dock Lock
  1107.       If MissionState = 2 Or MissionState = 8 Then
  1108.         goodDock = True
  1109.       End If
  1110.     Case Is = 2 'Star Finder
  1111.       If (pubXpos >= 500 And pubXpos <= 533) Then
  1112.         If (pubYpos >= 456 And pubYpos <= 486) Then
  1113.           YourLost = False
  1114.           x = frmTime.playSound(CDdrive + "\sfx\119sfx81.wav", EFFECTS, NO_LUPE)
  1115.           x = frmTime.playSound(CDdrive + "\warnings\starlock.wav", WARNINGS, NO_LUPE)
  1116.           FoundStars = True
  1117.         End If
  1118.       ElseIf (pubXpos >= -295 And pubXpos <= -267) Then
  1119.         If (pubYpos >= 456 And pubYpos <= 486) Then
  1120.           YourLost = False
  1121.           x = frmTime.playSound(CDdrive + "\sfx\119sfx81.wav", EFFECTS, NO_LUPE)
  1122.           x = frmTime.playSound(CDdrive + "\warnings\starlock.wav", WARNINGS, NO_LUPE)
  1123.           FoundStars = True
  1124.         End If
  1125.       End If
  1126.   End Select
  1127.  
  1128. If FoundStars Then
  1129.   FoundStars = False
  1130.   StarCrossed = False
  1131.   WaitingToLeave = True
  1132. End If
  1133.  
  1134. End Sub
  1135.  
  1136.  
  1137.  
  1138. Sub starlock_KeyPress(KeyAscii As Integer)
  1139.   Dim LSx1, LSx2, LSy1, LSy2 As Integer
  1140.   Dim rc As Long
  1141.   Dim row, col, linekount As Integer
  1142.   Dim lineColor As Integer
  1143.   
  1144.   lineColor = 2
  1145.   'clearscreen
  1146.   
  1147.     
  1148. If Chr(KeyAscii) = "q" Or Chr(KeyAscii) = "Q" Then
  1149.   starty = starty - 5
  1150. End If
  1151. If Chr(KeyAscii) = "a" Or Chr(KeyAscii) = "A" Then
  1152.   starty = starty + 5
  1153. End If
  1154. If Chr(KeyAscii) = "z" Or Chr(KeyAscii) = "Z" Then
  1155.   startx = startx - 5
  1156. End If
  1157. If Chr(KeyAscii) = "x" Or Chr(KeyAscii) = "X" Then
  1158.   startx = startx + 5
  1159. End If
  1160.   
  1161. If Chr(KeyAscii) = "1" Then
  1162.   LmAlt = 25
  1163. End If
  1164. If Chr(KeyAscii) = "2" Then
  1165.   LmAlt = 75
  1166. End If
  1167. If Chr(KeyAscii) = "3" Then
  1168.   LmAlt = 125
  1169. End If
  1170. If Chr(KeyAscii) = "4" Then
  1171.   LmAlt = 175
  1172. End If
  1173.  
  1174.  Label1.Caption = Str(LmAlt)
  1175.   
  1176.   For row = 0 To 31  'start and end line in array
  1177.     linekount = row * SPACING
  1178.     For col = 0 To 30 '
  1179.       LSx1 = col * XSCALE
  1180.       LSy1 = (-Display(col, row) * YSCALE) + (linekount * 5)
  1181.       
  1182.       LSx2 = (col + 1) * XSCALE
  1183.       LSy2 = (-Display(col + 1, row) * YSCALE) + (linekount * 5)
  1184.       
  1185.       If row = 24 And col = 15 Then
  1186.         picWork.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(14)
  1187.       Else
  1188.         picWork.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(lineColor)
  1189.       End If
  1190.     Next
  1191.   Next
  1192. End Sub
  1193.  
  1194.  
  1195. Sub Timer1_Timer()
  1196.   Static Xpos, Ypos As Integer
  1197.   Static passed_s4b, reorient As Integer
  1198.   Static tempd As Integer
  1199.   Static turnAroundx As Boolean
  1200.   Static turnAroundy As Boolean
  1201.   
  1202.   Dim rc As Long
  1203.   'Dim xtoken, ytoken As Integer
  1204.   'Joystick docking etc.
  1205.   Static xComponent As Integer
  1206.   Static yComponent As Integer
  1207.   Static zcomponent As Integer
  1208.   Rem joyst
  1209.   Dim x As Integer
  1210.   'Dim i As Integer
  1211.   Dim WhereAmI, whereisX, whereisY, wheretoken As Integer
  1212.   'lblZ = ldist
  1213.   Dim currpath As String
  1214.   Static NotFirstTime As Boolean
  1215.   
  1216.   If RCSBurstCount >= 150 Then Check_For_Crash 999, 999
  1217.   
  1218.   If NotFirstTime = False Then 'Need to turn around to dock
  1219.     IAMTurnedAround = True
  1220.     '''''''''''''''''''
  1221.     '''''''''''''''''''
  1222.     '''''''''''''''''''
  1223.     Xpos = 499
  1224.     Ypos = 50
  1225.     '''''''''''''''''''
  1226.     '''''''''''''''''''
  1227.     '''''''''''''''''''
  1228.     Xdock = 2
  1229.     Ydock = 1
  1230. '    ldist = -200
  1231.  '   xpos = xpos + 400
  1232.     NotFirstTime = True
  1233.   End If
  1234.   
  1235.   If IAMTurnedAround Then
  1236.     Backward = 0
  1237.   Else
  1238.     Backward = 0
  1239.   End If
  1240.   
  1241.   Me.Caption = "(24 < " & Xpos & " < 48   ,   -47 < " & Ypos & " < -89)"
  1242.   
  1243.   BackGroundSound = 4
  1244.   
  1245.   currpath = CDdrive + "\docking\csm4\"
  1246.  
  1247. ' Command3.Caption = xpos
  1248. 'Command4.Caption = ypos
  1249.     'closerate.Caption = ypos 'turnAroundx
  1250.     closerate.Caption = Zdock
  1251.     distance.Caption = ldist
  1252.     
  1253.     UpdateBackground
  1254.     
  1255.     
  1256. '-----------------------------------------------------
  1257. ' Move the background horizontally under scroller
  1258. ' control.
  1259. '-----------------------------------------------------
  1260.     If ldist <= 0 Then
  1261.       passed_s4b = 1
  1262.       Zdock = -Zdock
  1263.       reorient = 1
  1264.       distance.Caption = "missed"
  1265.     End If
  1266.     
  1267.     If passed_s4b = 1 Then
  1268.       If Xpos > 500 Or Xpos < -300 Then
  1269.         turnAroundx = True
  1270.       End If
  1271.       If Ypos > 200 And Ypos < 320 Then
  1272.         turnAroundy = True
  1273.       End If
  1274.       If turnAroundx Or turnAroundy Then
  1275.         passed_s4b = 0
  1276.         'Zdock = -Zdock
  1277.         reorient = 0
  1278.         turnAroundx = False
  1279.         turnAroundy = False
  1280.       End If
  1281.     End If
  1282.     'calculate distance from s4sb
  1283.     'If passed_s4b = 1 Then
  1284.       Rem hide s4b
  1285.     'End If
  1286.     
  1287.     ldist = ldist + Zdock
  1288.  
  1289.     If ldist <= 140 And ldist > 131 Then tempd = 18
  1290.     If ldist <= 130 And ldist > 121 Then tempd = 17
  1291.     If ldist <= 120 And ldist > 111 Then tempd = 16
  1292.     If ldist <= 110 And ldist > 101 Then tempd = 15
  1293.     If ldist <= 100 And ldist > 91 Then tempd = 14
  1294.     If ldist <= 90 And ldist > 81 Then tempd = 13
  1295.     If ldist <= 80 And ldist > 71 Then tempd = 12
  1296.     If ldist <= 70 And ldist > 61 Then tempd = 11
  1297.     If ldist <= 60 And ldist > 51 Then tempd = 10
  1298.     If ldist <= 50 And ldist > 41 Then tempd = 9
  1299.     If ldist <= 40 And ldist > 31 Then tempd = 8
  1300.    ' If ldist <= 30 And ldist > 21 Then tempd = 7
  1301.    ' If ldist <= 20 And ldist > 10 Then tempd = 6
  1302.     
  1303.  
  1304.    If ldist <= 1 And ldist >= -1 Then
  1305.      'xtoken = xpos
  1306.      'ytoken = ypos
  1307.      Check_For_Crash Xpos, Ypos
  1308.      Exit Sub
  1309.    End If
  1310.    
  1311.    If tempd > 5 And tempd < 19 Then
  1312.      If MissionState = 2 Then
  1313.        picImage = LoadPicture(S4B(tempd))
  1314.        picMask = LoadPicture(s4bmask(tempd))
  1315.      Else
  1316.        picImage = LoadPicture(csmDock(tempd))
  1317.        picMask = LoadPicture(csmMask(tempd))
  1318.      End If
  1319.    End If
  1320.      
  1321. Rem ********************************************************************************
  1322.     Xpos = Xpos - Xdock
  1323.     
  1324.     Ypos = Ypos - Ydock
  1325.     
  1326.     Rem --- if x is off left side ---
  1327.     If Xpos < -picPitSprite.ScaleWidth + picImage.ScaleWidth Then
  1328.       Xpos = 800 - picPitSprite.ScaleWidth + picImage.ScaleWidth
  1329.     Else 'if off right side
  1330.         If Xpos > 800 - picImage.ScaleWidth Then Xpos = 0 - picImage.ScaleWidth
  1331.     End If
  1332.    
  1333.     Rem --- if y is off top side ---
  1334.     If Ypos < -picImage.ScaleHeight Then
  1335.       Ypos = 600 - picImage.ScaleHeight
  1336.     Else 'if off bottom
  1337.       If Ypos > 600 - picImage.ScaleHeight Then Ypos = 0 - picImage.ScaleHeight
  1338.     End If
  1339.    
  1340.     ' Copy a section of the large bitmap into the work area.
  1341.   rc = BitBlt(picWorkBG.hDC, 0, 0, WorkWidth, WorkHeight, picBGOriginal.hDC, 0, 0, SRCCOPY)
  1342.     
  1343.     
  1344.     ' Copy the sprite work area onto the background.
  1345.     'rc = BitBlt(picBackground.hDC, 0, 0, WorkWidth, WorkHeight, picWork.hDC, 0, 0, SRCCOPY)
  1346.  rc = BitBlt(picWorkBG.hDC, 0, 0, WorkWidth, WorkHeight, picWork.hDC, 0, 0, SRCCOPY)
  1347.     
  1348.  If passed_s4b <> 1 Then
  1349.   Rem hide s4b if passed_s4b
  1350.   
  1351.     ' Draw the sprite mask bitmap into the work area.
  1352.  rc = BitBlt(picWorkBG.hDC, Xpos + 80, Ypos + 80, picMask.ScaleWidth, picMask.ScaleHeight, picMask.hDC, 0, 0, SRCAND)
  1353.     'draw sprite into the work area
  1354.  rc = BitBlt(picWorkBG.hDC, Xpos + 80, Ypos + 80, picImage.ScaleWidth, picImage.ScaleHeight, picImage.hDC, 0, 0, SRCPAINT)
  1355.     
  1356. End If 'passed_s4b
  1357.  
  1358.       
  1359.     ' Draw the cockpit mask into the work area.
  1360.  rc = BitBlt(picWorkBG.hDC, 0, 0, picPitMask.Width, picPitMask.Height, picPitMask.hDC, 0, 0, SRCAND)
  1361.     'draw cockpit
  1362.  rc = BitBlt(picWorkBG.hDC, 0, 0, picPitMask.Width, picPitMask.Height, picPitSprite.hDC, 0, 0, SRCPAINT)
  1363.  
  1364.  
  1365.  
  1366.     'FlickerlessSpriteMove
  1367.     ' Draw the whole thing back onto the screen.
  1368.     rc = BitBlt(picBackground.hDC, 0, 0, picBackground.Width, picBackground.Height, picWorkBG.hDC, 0, 0, SRCCOPY)
  1369.     
  1370.  
  1371.   auxjoy(0).Visible = True
  1372.   auxjoy(1).Visible = True
  1373.   auxjoy(2).Visible = True
  1374.   auxjoy(3).Visible = True
  1375.   auxcon(0).Picture = auxcon(5).Picture
  1376.  Rem
  1377.  Rem
  1378.  Rem Joystick
  1379.   
  1380.   rc = GetJoyStickPos(JOYSTICK1, JoyInfo)
  1381.   If rc = 0 Then
  1382.     'imgJoyCursor.Left = RangeWidth * ((JoyInfo.X - JoyCaps.Xmin) / (JoyCaps.Xmax - JoyCaps.Xmin))
  1383.     'imgJoyCursor.Top = RangeHeight * ((JoyInfo.Y - JoyCaps.Ymin) / (JoyCaps.Ymax - JoyCaps.Ymin))
  1384.     
  1385. '-----------------------------------------------------
  1386. ' Move the background horizontally under scroller
  1387. ' control.
  1388. '-----------------------------------------------------
  1389.   'BackgroundX = HScroll1
  1390.   'BackgroundX = HScroll1
  1391.  ' rc = BitBlt(picBackground.hDC, 0, 0, picBackground.ScaleWidth, picBackground.ScaleHeight, landsite.hDC, BackgroundX + xComponent, BackgroundY, SRCCOPY)
  1392.     
  1393.     'calculate distance from s4sb
  1394.     ldist = ldist + zcomponent
  1395.       
  1396.   End If
  1397.   
  1398.   Rem --- check for left or right
  1399.   whereisX = 0
  1400.   
  1401.   If JoyInfo.x < leftX Then
  1402.     whereisX = -1
  1403.   Else
  1404.     If JoyInfo.x > rightX Then
  1405.       whereisX = 1
  1406.     End If
  1407.   End If
  1408.   
  1409.   Rem --- check for up or down
  1410.   whereisY = 0
  1411.   
  1412.   If JoyInfo.y < topY Then
  1413.     whereisY = -1
  1414.   Else
  1415.     If JoyInfo.y > bottomY Then
  1416.       whereisY = 1
  1417.     End If
  1418.   End If
  1419.   
  1420.   wheretoken = whereisX + whereisY
  1421.   WhereAmI = 4
  1422.   
  1423.   If wheretoken = 1 Then
  1424.     If whereisX = 1 Then
  1425.       WhereAmI = 1
  1426.     Else
  1427.       WhereAmI = 2
  1428.     End If
  1429.   End If
  1430.   
  1431.   If wheretoken = -1 Then
  1432.     If whereisY = -1 Then
  1433.       WhereAmI = 0
  1434.     Else
  1435.       WhereAmI = 3
  1436.     End If
  1437.   End If
  1438.     
  1439.   Command1.Caption = WhereAmI
  1440.   
  1441.   
  1442.   If WhereAmI <> 4 Then
  1443.     Call JoyControl((WhereAmI))
  1444.   End If
  1445.   
  1446.   If JoyInfo.ButtonDown(1) And WhereAmI = 1 Then
  1447.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  1448.       Xdock = Xdock + 1
  1449.       'xComponent = xComponent + 1
  1450.        Call JoyControl(1)
  1451.   End If
  1452.   
  1453.   If JoyInfo.ButtonDown(1) And WhereAmI = 3 Then
  1454.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  1455.       Xdock = Xdock - 1
  1456.       'xComponent = xComponent - 1
  1457.      Call JoyControl(3)
  1458.   End If
  1459.   
  1460.   If JoyInfo.ButtonDown(1) And WhereAmI = 2 Then
  1461.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  1462.       Ydock = Ydock + 1
  1463.       'yComponent = yComponent + 1
  1464.       Call JoyControl(2)
  1465.   End If
  1466.   
  1467.   If JoyInfo.ButtonDown(1) And WhereAmI = 0 Then
  1468.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  1469.       Ydock = Ydock - 1
  1470.       'yComponent = yComponent - 1
  1471.        Call JoyControl(0)
  1472.   End If
  1473.   
  1474.   If JoyInfo.ButtonDown(2) And WhereAmI = 2 Then
  1475.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  1476.       Zdock = Zdock + 1
  1477.     
  1478.   End If
  1479.   
  1480.   If JoyInfo.ButtonDown(2) And WhereAmI = 0 Then
  1481.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  1482.       Zdock = Zdock - 1
  1483.   End If
  1484.   Rem
  1485.   Rem
  1486.   Rem end joystick
  1487. End Sub
  1488.  
  1489.  
  1490.  
  1491.  
  1492. Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1493. '----------------------------------------------------------
  1494. ' Set the module-level MouseButtonDown variable, so that
  1495. ' the Mouse Control timer knows a button was pushed.
  1496. '----------------------------------------------------------
  1497.  
  1498.     MouseButtonDown = Button
  1499. End Sub
  1500.  
  1501. Sub Pause(Seconds As Single)
  1502. '------------------------------------------------------------
  1503. ' Delay for a specified number of seconds.
  1504. '------------------------------------------------------------
  1505. Dim Start As Single
  1506.  
  1507.     Start = Timer
  1508.     Do While (Timer - Start) < Seconds
  1509.         DoEvents
  1510.     Loop
  1511. End Sub
  1512.  
  1513. Sub StartGame()
  1514. '------------------------------------------------------------
  1515. ' Initialize everything and start the game.
  1516. '------------------------------------------------------------
  1517. Dim rc As Integer
  1518. Dim i As Integer
  1519. Static NotFirstTime As Integer
  1520.     Dim x As Integer
  1521.     
  1522.     picBackground.Visible = True
  1523.     ScrollSpeed = 5
  1524.     
  1525.     If MissionState = 6 Then 'Landing
  1526.       
  1527.       lmEng = True
  1528.       Timer1.Enabled = False
  1529.       startx = 50 'initialize x value
  1530.       starty = 300 'initialize line
  1531. '      disScreen 'display starting position
  1532.       Timer2.Enabled = True
  1533.       text1.Visible = True
  1534.       Text2.Visible = True
  1535.       picImage = LoadPicture(CDdrive + "\landsite\croshair.bmp")
  1536.       picPitMask = LoadPicture(CDdrive + "\landsite\croshair.bmp")
  1537.       LmAlt = 1200
  1538.       Xdock = 0
  1539.       Ydock = 0
  1540.       Zdock = -6
  1541.       FwdVel = -Zdock * 33
  1542.     ElseIf Not StarCrossed Then
  1543.       Timer2.Enabled = False
  1544.       Timer1.Enabled = True
  1545.       text1.Visible = False
  1546.       Text2.Visible = False
  1547.     End If
  1548. End Sub
  1549.  
  1550.  
  1551. Sub UpdateBackground()
  1552. '------------------------------------------------------------
  1553. ' The first step in building a new view is to copy the
  1554. ' next section of the original background onto the working
  1555. ' background picture box.
  1556. '------------------------------------------------------------
  1557. 'Static LastXdir As Integer
  1558. 'Static LastYdir As Integer
  1559.  
  1560.  
  1561.    '     BGMove picWorkBG, picBGOriginal, LastXdir * 2, LastYdir * 2
  1562.    
  1563.    BGMove picWorkBG, picBGOriginal, Xdock, Ydock
  1564.    
  1565.    ' End If
  1566.  
  1567. End Sub
  1568.  
  1569.  
  1570. Sub FlickerlessSpriteMove()
  1571. '-----------------------------------------------------
  1572. ' Moving a sprite without flicker requires the use
  1573. ' of an off-screen work area into which we copy a
  1574. ' section of the background and sprite.
  1575. '-----------------------------------------------------
  1576. Dim rc As Integer
  1577.     WorkWidth = 2090
  1578.     WorkHeight = 2020
  1579.     BackgroundX = SpriteX
  1580.     BackgroundY = SpriteY
  1581.     ' Calculate the next position for the sprite, and any
  1582.     ' necessary direction changes.
  1583.     GetNextPos picImage.ScaleWidth, picImage.ScaleHeight
  1584.     
  1585.     ' Copy a section of the large bitmap into the work area.
  1586.    'rc = BitBlt(picWork.hDC, 0, 0, WorkWidth, WorkHeight, picBGOriginal.hDC, (BackgroundX + SpriteX) - INCREMENT, (BackgroundY + SpriteY) - INCREMENT, SRCCOPY)
  1587.    'rc = BitBlt(picWork.hDC, 0, 0, WorkWidth, WorkHeight, picBackground.hDC, (SpriteX), (SpriteY), SRCCOPY)
  1588.     rc = BitBlt(picWork.hDC, 0, 0, WorkWidth, WorkHeight, picBGOriginal.hDC, (SpriteX), (SpriteY), SRCCOPY)
  1589.     
  1590.     ' Draw the mask and sprite bitmaps into the work area.
  1591.     rc = BitBlt(picWork.hDC, INCREMENT, INCREMENT, picMask.ScaleWidth, picMask.ScaleHeight, picMask.hDC, 0, 0, SRCAND)
  1592.     rc = BitBlt(picWork.hDC, INCREMENT, INCREMENT, picImage.ScaleWidth, picImage.ScaleHeight, picImage.hDC, 0, 0, SRCPAINT)
  1593.     'rc = BitBlt(picWork.hDC, 0, 0, picmask.ScaleWidth, picmask.ScaleHeight, picmask.hDC, 0, 0, SRCAND)
  1594.     'rc = BitBlt(picWork.hDC, 0, 0, picImage.ScaleWidth, picImage.ScaleHeight, picImage.hDC, 0, 0, SRCPAINT)
  1595.     
  1596.     ' Copy the work area onto the background.
  1597.   ' rc = BitBlt(picBackground.hDC, SpriteX - INCREMENT, SpriteY - INCREMENT, WorkWidth, WorkHeight, picWork.hDC, 0, 0, SRCCOPY)
  1598.    ' rc = BitBlt(picBackground.hDC, 10, 10, WorkWidth, WorkHeight, picWork.hDC, 0, 0, SRCCOPY)
  1599.     rc = BitBlt(picBackground.hDC, 0, 0, WorkWidth, WorkHeight, picWork.hDC, 0, 0, SRCCOPY)
  1600.     
  1601.     DoEvents
  1602. End Sub
  1603.  
  1604. Sub GetNextPos(ByVal AWidth As Integer, ByVal AHeight As Integer)
  1605.   '-----------------------------------------------------
  1606.   ' Calculate the next position for the sprite, and
  1607.   ' make any necessary direction changes.
  1608.   '-----------------------------------------------------
  1609.   
  1610.     
  1611.   Xdir = Xdock
  1612.   Ydir = Ydock
  1613.      
  1614.     ' Calculate the new position for the sprite.
  1615.     SpriteX = SpriteX + (Xdir)
  1616.     SpriteY = SpriteY + (Ydir)
  1617.  
  1618. End Sub
  1619.  
  1620.  
  1621.  
  1622. Public Sub Check_For_Crash(xtoken, ytoken)
  1623.   Dim lmx As Boolean 'lm
  1624.   Dim Tx As Boolean 'target
  1625.   Dim lmy As Boolean 'lm
  1626.   Dim Ty As Boolean 'target
  1627.   Dim csmx As Boolean 'Csm
  1628.   Dim csmy As Boolean 'Csm
  1629.   Dim z As Integer
  1630.   Dim WentToForm As Boolean
  1631.    
  1632.   If xtoken = 999 And ytoken = 999 Then GoTo CFCENDING
  1633.   
  1634.   BackGroundSound = 999
  1635.   
  1636.   If MissionState = 2 Then 'docking with LM from CSM
  1637.     If xtoken <= 235 + Backward And xtoken >= -35 + Backward Then lmx = True
  1638.     If xtoken <= 89 + Backward And xtoken >= 62 + Backward Then Tx = True
  1639.     If ytoken <= 90 And ytoken >= -160 Then lmy = True
  1640.     If ytoken <= 52 And ytoken >= 26 Then Ty = True
  1641.     If Zdock <= 0 And Zdock > -3 Then z = 0
  1642.     If Zdock > 0 Then z = -1
  1643.     If Zdock <= -3 Then z = 1
  1644.   ElseIf MissionState >= 7 Then 'docking with CSM from LM
  1645.     If xtoken <= 183 + Backward And xtoken >= -84 + Backward Then csmx = True
  1646.     If xtoken <= 48 + Backward And xtoken >= 24 + Backward Then Tx = True
  1647.     If ytoken <= 49 And ytoken >= -226 Then csmy = True
  1648.     If ytoken <= -47 And ytoken >= -89 Then Ty = True
  1649.     If Zdock <= 0 And Zdock > -3 Then z = 0
  1650.     If Zdock > 0 Then z = -1
  1651.     If Zdock <= -3 Then z = 1
  1652.   Else
  1653.     Exit Sub
  1654.   End If
  1655.   
  1656.   If (lmx And lmy) Or (csmx And csmy) Then
  1657.     If z = 0 Then 'not too fast
  1658.        frmTime.masterTimer.Enabled = False
  1659.        Timer1.Enabled = False
  1660.        docking.Hide
  1661.        If MissionState = 2 Then
  1662.          Dock2LM.Show
  1663.          WentToForm = True
  1664.        ElseIf MissionState >= 7 Then
  1665.          Dock2CSM.Show
  1666.          WentToForm = True
  1667.        End If
  1668.             
  1669.       'If Tx And Ty Then
  1670.         'docked
  1671.       '  distance.Caption = "docked"
  1672.       '  Timer1.Enabled = False
  1673.       '  Zdock = 0
  1674.       '  If MissionState = 8 Then
  1675.       '    MissionState = 9
  1676.       '  Else
  1677.           'what are you doing here then...
  1678.       '  End If
  1679.       '  frmTime.PlayAVI "success\shot32.avi", 3
  1680.       '  youaredead = False
  1681.       '  goodDock = True
  1682.       'Else
  1683.         'missed target - bounced off
  1684.       '  distance.Caption = "bounced"
  1685.       '  Xdock = -Xdock
  1686.       '  Ydock = -Ydock
  1687.       '  Zdock = -Zdock
  1688.         
  1689.       '  Exit Sub
  1690.       'End If
  1691.     ElseIf z = -1 Then 'reverse
  1692.       'nothing
  1693.     Else 'z = 1 too fast
  1694.       If (lmx And lmy) Then
  1695.         frmTime.PlayAVI "death\shot33.avi", 3
  1696.         distance.Caption = "crashed"
  1697.         Timer1.Enabled = False
  1698.         Zdock = 0
  1699.         YouAreDead = True
  1700.       Else
  1701.         distance.Caption = "missed"
  1702.         IAMTurnedAround = Not IAMTurnedAround
  1703.         Exit Sub
  1704.       End If
  1705.     End If
  1706.   Else
  1707.     distance.Caption = "missed"
  1708.     IAMTurnedAround = Not IAMTurnedAround
  1709.     Exit Sub
  1710.   End If
  1711.  
  1712. CFCENDING:
  1713.  
  1714. If WentToForm Then
  1715.   If MissionState = 2 Then
  1716.     CompUnload = True
  1717.     Unload Dock2LM
  1718.     CompUnload = False
  1719.   ElseIf MissionState >= 7 Then
  1720.     CompUnload = True
  1721.     Unload Dock2CSM
  1722.     CompUnload = False
  1723.   End If
  1724. End If
  1725.  
  1726. frmTime.masterTimer.Enabled = True
  1727. Me.Visible = False
  1728.  
  1729. If MissionState >= 2 And MissionState <= 6 Then
  1730.   If Not YouAreDead Then
  1731.     fivek = 5
  1732.     Met = 615
  1733.     StopEverything = True
  1734.     OkToDock = False
  1735.     Exit Sub
  1736.   Else
  1737.     fivek = 5
  1738.     Met = 565
  1739.     StopEverything = True
  1740.     OkToDock = False
  1741.   End If
  1742. ElseIf MissionState >= 7 And MissionState <= 9 Then
  1743.   If Not YouAreDead Then
  1744.     fivek = 5
  1745.     Met = 2185 ''''
  1746.     StopEverything = True
  1747.     OkToDock = False
  1748.   Else
  1749.     fivek = 5
  1750.     Met = 2175 ''''
  1751.     StopEverything = True
  1752.     OkToDock = False
  1753.   End If
  1754. End If
  1755.  
  1756. Me.Visible = False
  1757.  
  1758. End Sub
  1759.  
  1760. Public Sub loadYvals()
  1761.   Dim iAutoNumber As Integer
  1762.   Dim row, col As Integer
  1763.   Dim TheNameOfTheFile As String
  1764.   ' ***
  1765.   ' *** OPEN DATA FILE AND FILL ARRAY WITH VALUES
  1766.   ' ***
  1767.   
  1768.     
  1769.   'main matrix load and setup
  1770.   iAutoNumber = FreeFile
  1771.   Open (CDdrive + "\landsite\terrain.dat") For Input As iAutoNumber
  1772.   For row = 0 To 399
  1773.     For col = 0 To 299
  1774.       Input #iAutoNumber, Biggy(col, row)  'read 1 number
  1775.       TargetBiggy(col, row) = False
  1776.     Next 'col
  1777.   Next 'row
  1778.   Close iAutoNumber
  1779.   TargetBiggy(133, 93) = True
  1780.   
  1781. '  Open (CDdrive + "\landsite\target.dat") For Input As iAutoNumber
  1782. '  For row = 0 To 399
  1783. '    For col = 0 To 299
  1784. '      Input #iAutoNumber, NextBiggy(col, row)  'read 1 number
  1785. '      NextTargetBiggy(col, row) = False
  1786. '    Next col
  1787. '  Next row
  1788. '  Close iAutoNumber
  1789. '
  1790. '  'secondary matrix load and setup
  1791. '  Select Case Int(Rnd * 3) + 1
  1792. '    Case Is = 1
  1793. '      TheNameOfTheFile = CDdrive + "\landsite\rndgrnd1.dat"
  1794. '    Case Is = 2
  1795. '      TheNameOfTheFile = CDdrive + "\landsite\rndgrnd2.dat"
  1796. '    Case Is = 3
  1797. '      TheNameOfTheFile = CDdrive + "\landsite\rndgrnd3.dat"
  1798. '  End Select
  1799. '
  1800. '  Open TheNameOfTheFile For Input As iAutoNumber
  1801. '  For row = 0 To 399
  1802. '    For col = 0 To 299
  1803. '      Input #iAutoNumber, GenBiggy(col, row)  'read 1 number
  1804. '    Next col
  1805. '  Next row
  1806. '  Close iAutoNumber
  1807. End Sub
  1808.  
  1809. Sub Timer2_Timer()
  1810.   Static Xpos, Ypos As Integer
  1811.   Static passed_s4b, reorient As Integer
  1812.   Static tempd As Integer
  1813.   Dim rc As Long
  1814.   Dim xtoken, ytoken As Integer
  1815.   'Joystick docking etc.
  1816.   Static xComponent As Integer
  1817.   Static yComponent As Integer
  1818.   Static zcomponent As Integer
  1819.   Rem joyst
  1820.   Dim x As Integer
  1821.   'Dim i As Integer
  1822.   'lblZ = ldist
  1823.   Dim currpath As String
  1824.   Dim TrueDist As Single
  1825.   Dim TrueVel As Single
  1826.   Dim ClosRate As Double
  1827.   Dim RobsAlt As Single
  1828.   Dim RobsDistDrop As Single
  1829.   Static Duration As Integer
  1830.   Dim contThrustEffect As Single
  1831.   Dim contThrustResult As Integer
  1832.   Static WasHolding As Boolean
  1833.     
  1834.   'If RCSBurstCount >= 150 Then collision 0
  1835.  
  1836.   'Zdock = FwdVel / 28
  1837.   'clearScreen
  1838.  starty = starty + Zdock
  1839.  startx = startx + Xdock
  1840.   
  1841. 'update distances
  1842. FwdDist = 33 * (starty + DoubleStart + (24 / Mag))
  1843. LatDist = 33 * (startx + DoubleStart + (16 / Mag))
  1844.  
  1845. TrueDist = Sqr((LmAlt) ^ 2 + (FwdDist) ^ 2 + (LatDist) ^ 2)
  1846. If TrueDist <> 0 Then
  1847.   RobsAlt = LmAlt ' counteract overflow problem
  1848.   RobsDistDrop = DistDrop ' counteract overflow problem
  1849.   ClosRate = ((LatDist * LatVel) + (FwdDist * FwdVel) + (RobsAlt * RobsDistDrop)) / TrueDist
  1850. Else
  1851.   ClosRate = 0
  1852. End If
  1853.  
  1854. Rem ******* DISPLAYS **********
  1855. text1.Text = "True Alt = " + Str(AltiMeterReading)
  1856. Text2.Text = "Your X " + Str(startx + 16) '"fuel"
  1857. Text3.Text = Direction
  1858. Text4.Text = "Your Y " + Str(starty + 16) '"RCS"
  1859. Text5.Text = "Fwd Vel = " + Str(FwdVel)
  1860. Text6.Text = "Lat Vel = " + Str(LatVel)
  1861.  
  1862. distance.Caption = Str(Int(TrueDist))
  1863. closerate.Caption = Str(Int(ClosRate))
  1864.  
  1865. labeltime.Caption = Duration
  1866.  
  1867. 'If Duration = 20000 Then
  1868. '   labeltime.Caption = "too bad!!"
  1869. 'Else
  1870.    Duration = Duration + 1 ' your 40 of life!!!
  1871. 'End If
  1872.  
  1873. landstuff
  1874. If StopEverything Then
  1875.   Timer2.Enabled = False
  1876.   Exit Sub
  1877. End If
  1878.  
  1879. If diedFlag = True Then Exit Sub 'bail
  1880.  
  1881. disScreen
  1882. If StopEverything Then
  1883.   Timer2.Enabled = False
  1884.   Exit Sub
  1885. End If
  1886.      
  1887. auxjoy(0).Visible = True
  1888. auxjoy(1).Visible = True
  1889. auxjoy(2).Visible = True
  1890. auxjoy(3).Visible = True
  1891. auxcon(0).Picture = auxcon(5).Picture
  1892.     
  1893. 'contThrustEffect = -(2 * contThrust / 100) * GRAVITY + GRAVITY
  1894. contThrustEffect = (2 * contThrust / 100) * Gravity + Gravity
  1895. DropTime = DropTime + Ydock * 2.75
  1896. DistDrop = -Int(((contThrustEffect) * DropTime) + Ydock * 2.75 * 3)
  1897.   
  1898. Ydock = 0
  1899.   
  1900. LmAlt = LmAlt + DistDrop
  1901.   
  1902. If contThrust <= 45 Then
  1903.   If DropTime < 0 Then DropTime = 0
  1904.   DropTime = DropTime + 1
  1905. ElseIf contThrust > 45 And contThrust < 55 Then
  1906.   DropTime = 0
  1907. Else
  1908.   If DropTime > 0 Then DropTime = 0
  1909.   DropTime = DropTime - 1
  1910. End If
  1911.  
  1912.  
  1913.  
  1914. End Sub
  1915.  
  1916.  
  1917.  
  1918. Public Sub LeadLine(curline As Integer)
  1919.   Dim col As Integer
  1920.   Dim LSx1, LSx2, LSy1, LSy2 As Integer
  1921.   Dim linekount As Integer
  1922.   
  1923.   linekount = curline * SPACING
  1924.   
  1925.   For col = 0 To 30 '
  1926.     'newvalues for new lines
  1927.     LSx1 = col * XSCALE + hShift
  1928.     LSy1 = (-Display(col, curline) * YSCALE) + (linekount) + GraphOffset + vShift
  1929.       
  1930.     LSx2 = (col + 1) * XSCALE + hShift
  1931.     LSy2 = (-Display(col + 1, curline) * YSCALE) + (linekount) + GraphOffset + vShift
  1932.     
  1933.     If WithClip = True Then
  1934.       ClipLine LSx1, LSy1, LSx2, LSy2 'newline with clip
  1935.       If StopEverything Then Exit Sub
  1936.       If ClipReturn = True Then
  1937.         picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(10)
  1938.       End If
  1939.          
  1940.     Else 'no cliping
  1941.       picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(10)
  1942.     End If
  1943.   Next 'col
  1944.   DoEvents
  1945.  
  1946. End Sub
  1947.  
  1948. Public Sub disScreen()
  1949.   Dim LSx1 As Integer, LSx2 As Integer, LSy1 As Integer, LSy2 As Integer
  1950.   Dim rc As Long
  1951.   Dim row As Integer, col As Integer, linekount, blinekount, tempkount As Integer
  1952.   Dim dirtLevel As Integer
  1953.   Dim x As Long
  1954.   Static HoldOffset As Integer
  1955.   Dim target As Boolean
  1956.   Dim Q As Integer
  1957.   
  1958.   'DrawBox 'displays limits of clipping
  1959.   
  1960.   Select Case Doublein ' offsetting the screen values
  1961.      Case Is = 1
  1962.         GraphOffset = Mag * SPACING
  1963.      Case Is = 2
  1964.         GraphOffset = Mag * SPACING ^ 1.5
  1965.      Case Is = 4
  1966.         GraphOffset = Mag * SPACING ^ 1.75
  1967.      Case Is = 8
  1968.         GraphOffset = Mag * SPACING ^ 1.85
  1969.      Case Is = 16
  1970.         GraphOffset = Mag * SPACING ^ 2
  1971.   End Select
  1972.   
  1973.   ' *** DISPLAY CONTENTS OF ARRAY
  1974.   ' *** ON SCREEN
  1975.   ' ***
  1976.   For row = 0 To 8  'start and end line in array
  1977.     blinekount = row * SPACING
  1978.     
  1979.     For col = 0 To 30 '
  1980.       X1 = col * XSCALE + hShift
  1981.       Y1 = (-Cdisplay(col, row) * YSCALE) + (blinekount) + HoldOffset + vShift
  1982.       X2 = (col + 1) * XSCALE + hShift
  1983.       Y2 = (-Cdisplay(col + 1, row) * YSCALE) + (blinekount) + HoldOffset + vShift
  1984.       If WithClip Then
  1985.         ClipLine X1, Y1, X2, Y2
  1986.         If ClipReturn Then
  1987.           picBackground.Line (X1, Y1)-(X2, Y2), QBColor(0)
  1988.         End If
  1989.       Else
  1990.         picBackground.Line (X1, Y1)-(X2, Y2), QBColor(0)
  1991.       End If
  1992.       Cdisplay(col, row) = Display(col, row) 'load current value into backup array
  1993.     Next
  1994.     Cdisplay(col, row) = Display(31, row)
  1995.     joyPolling 'here is a joystick call
  1996.   Next
  1997.  
  1998.   tempkount = blinekount
  1999.   
  2000.   For row = 0 To 31  'start and end line in array
  2001.   
  2002.     linekount = row * SPACING
  2003.     blinekount = linekount + tempkount + SPACING
  2004.     
  2005.     For col = 0 To 30 '
  2006.       If row <= 22 Then
  2007.         X1 = col * XSCALE + hShift
  2008.         Y1 = (-Cdisplay(col, row + 9) * YSCALE) + (blinekount) + HoldOffset + vShift
  2009.         X2 = (col + 1) * XSCALE + hShift
  2010.         Y2 = (-Cdisplay(col + 1, row + 9) * YSCALE) + (blinekount) + HoldOffset + vShift
  2011.       End If
  2012.       'If row <= 22 Then
  2013.       '  Cdisplay(col, row + 9) = Display(col, row + 9)
  2014.       'End If
  2015.       'newvalues for new lines
  2016.       LSx1 = col * XSCALE + hShift
  2017.       LSy1 = (-Display(col, row) * YSCALE) + (linekount) + GraphOffset + vShift
  2018.       LSx2 = (col + 1) * XSCALE + hShift
  2019.       LSy2 = (-Display(col + 1, row) * YSCALE) + (linekount) + GraphOffset + vShift
  2020.       
  2021.       If WithClip Then 'Clipped
  2022.       
  2023.         If row <= 22 Then
  2024.           ClipLine X1, Y1, X2, Y2 'blankline
  2025.           If StopEverything Then Exit Sub
  2026.           If ClipReturn = True Then
  2027.             picBackground.Line (X1, Y1)-(X2, Y2), QBColor(0)
  2028.           End If
  2029.         End If
  2030.         
  2031.         ClipLine LSx1, LSy1, LSx2, LSy2 'green line
  2032.         If StopEverything Then Exit Sub
  2033.         If ClipReturn Then 'draw if clipped properly
  2034.           picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(BluedLine(row))
  2035.           
  2036.           If TargetDisplay(col, row) Then
  2037.              target = True
  2038.           End If
  2039.           
  2040.           If target Then 'the target
  2041.             picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(12)
  2042.           End If
  2043.           
  2044.         End If 'if Clipreturn
  2045.         
  2046.       Else 'not clipped
  2047.         If row <= 22 Then
  2048.           picBackground.Line (X1, Y1)-(X2, Y2), QBColor(0) 'unclipped blankline
  2049.         End If
  2050.           picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(BluedLine(row)) 'unclipped green
  2051.           
  2052.           If TargetDisplay(col, row) = True Then
  2053.              target = True
  2054.           End If
  2055.           
  2056.           If target Then 'the target
  2057.             picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(12)
  2058.             'x = ellipse(picBackGround.hDC, LSx1, LSy1, LSx2 + 10, LSy2 + 10)
  2059.           End If
  2060.       End If
  2061.       target = False
  2062.       
  2063.       If row = 24 And col = 16 Then '>XZX< check for collision >XZX<
  2064.         picBackground.Line (LSx1, LSy1)-(LSx2, LSy2), QBColor(14)
  2065.       End If
  2066.       
  2067.       If row <= 22 Then 'copy ys over to Cdisplay
  2068.         Cdisplay(col, row + 9) = Display(col, row + 9)
  2069.       End If
  2070.       
  2071.     Next 'col
  2072.     Cdisplay(col, row) = Display(31, row)
  2073.        
  2074.     If row <= 22 Then 'Copy last Y position
  2075.         Cdisplay(col + 1, row + 9) = Display(col + 1, row + 9) 'load current value into backup array
  2076.     End If
  2077.     
  2078.     If row <= 30 Then 'draw leadline
  2079.       LeadLine row + 1
  2080.       If StopEverything Then Exit Sub
  2081.     End If
  2082.     joyPolling
  2083.     If StopEverything Then Exit Sub
  2084.   Next 'row
  2085. 'yoffset = yoffset - 1
  2086.  
  2087. HoldOffset = GraphOffset
  2088.  
  2089. For Q = 0 To 3
  2090.   auxjoy(Q).Enabled = True
  2091.   Command2(Int(Q / 2)).Enabled = True
  2092. Next Q
  2093. x = frmTime.playSound(CDdrive + "\sfx\55sfx27.wav", EFFECTS, NO_LUPE)
  2094.  
  2095. End Sub
  2096.  
  2097. Public Sub ClipLine(X1, Y1, X2, Y2)
  2098.   'int Clip_Line(int *x1,int *y1,int *x2, int *y2)
  2099.   ' //////////////////////////////////////////////////////////////////////////////
  2100.   '// this function clips the sent line using the globally defined clipping
  2101.   '// region
  2102.  
  2103.   Dim point_1, point_2 As Integer   '// tracks if each end point is visible or invisible
  2104.  
  2105.   Dim clip_always    '// used for clipping override
  2106.  
  2107.   Dim xi, yi As Integer '// point of intersection
  2108.  
  2109.   '// which edges are the endpoints beyond
  2110.   Dim right_edge, left_edge, top_edge, bottom_edge As Integer
  2111.  
  2112.   Dim success As Integer      '// was there a successfull clipping
  2113.  
  2114.   Dim Dx, dY As Single        '// used to holds slope deltas
  2115.  
  2116. ' //////////////////////////////////////////////////////////////////////////////
  2117.   point_1 = 0
  2118.   point_2 = 0
  2119.   clip_always = 0
  2120.   right_edge = 0 '// which edges are the endpoints beyond
  2121.   left_edge = 0
  2122.   top_edge = 0
  2123.   bottom_edge = 0
  2124.   success = 0
  2125.   
  2126. '// SECTION 1 //////////////////////////////////////////////////////////////////
  2127. '// test if line is completely visible
  2128.  
  2129. If ((X1 >= poly_clip_min_x) And (X1 <= poly_clip_max_x) And (Y1 >= poly_clip_min_y) And (Y1 <= poly_clip_max_y)) Then point_1 = 1
  2130.  
  2131. If ((X2 >= poly_clip_min_x) And (X2 <= poly_clip_max_x) And (Y2 >= poly_clip_min_y) And (Y2 <= poly_clip_max_y)) Then point_2 = 1
  2132.  
  2133. '// SECTION 2 /////////////////////////////////////////////////////////////////
  2134. '// test endpoints
  2135. 'both endpoints are good
  2136. If (point_1 = 1 And point_2 = 1) Then
  2137.   ClipReturn = True 'return(success);
  2138.   Exit Sub 'then return(1)
  2139. End If
  2140.  
  2141. '// SECTION 3 /////////////////////////////////////////////////////////////////
  2142. '// test if line is completely invisible
  2143.   'entire line is outside box
  2144.   If (point_1 = 0 And point_2 = 0) Then
  2145.     '// must test to see if each endpoint is on the same side of one of
  2146.     '// the bounding planes created by each clipping region boundary
  2147.       If (((X1 < poly_clip_min_x) And (X2 < poly_clip_min_x)) Or ((X1 > poly_clip_max_x) And (X2 > poly_clip_max_x)) Or ((Y1 < poly_clip_min_y) And (Y2 < poly_clip_min_y)) Or ((Y1 > poly_clip_max_y) And (Y2 > poly_clip_max_y))) Then
  2148.         ClipReturn = False
  2149.         Exit Sub 'return(0); no need to draw line
  2150.       End If 'invisible
  2151.     '// if we got here we have the special case where the line cuts into and
  2152.     '// out of the clipping region
  2153.     clip_always = 1
  2154.   End If 'test for invisibly
  2155.  
  2156. '// SECTION 4 /////////////////////////////////////////////////////////////////
  2157. '// take care of case where either endpoint is in clipping region
  2158.  
  2159.   'If ((point_1 = 1) Or (point_2 = 1) Or (point_1 = 0 And point_2 = 0)) Then
  2160.   'left endpoint or both endpoints lie outside of box
  2161.   If ((point_1 = 1) Or (point_1 = 0 And point_2 = 0)) Then
  2162.     '/ compute deltas
  2163.     Dx = X2 - X1
  2164.     dY = Y2 - Y1
  2165.     '// compute what boundary line need to be clipped against
  2166.     If (X2 > poly_clip_max_x) Then 'right edge
  2167.       right_edge = 1 '// flag right edge
  2168.       '// compute intersection with right edge
  2169.       If (Dx <> 0) Then
  2170.         yi = Int(0.5 + (dY / Dx) * (poly_clip_max_x - X1) + Y1)
  2171.       Else
  2172.         yi = -1  '// invalidate intersection
  2173.       End If
  2174.      'End If 'to right
  2175.      
  2176.     ElseIf (X2 < poly_clip_min_x) Then 'left edge
  2177.       left_edge = 1  '/ flag left edge
  2178.       '// compute intersection with left edge
  2179.       If (Dx <> 0) Then
  2180.         yi = Int(0.5 + (dY / Dx) * (poly_clip_min_x - X1) + Y1)
  2181.       Else
  2182.         yi = -1 '// invalidate intersection
  2183.       End If
  2184.     'End If 'to left
  2185.  
  2186.      '// horizontal intersections
  2187.  
  2188.      ElseIf (Y2 > poly_clip_max_y) Then 'bottom edge
  2189.        bottom_edge = 1 '// flag bottom edge
  2190.        '// compute intersection with right edge
  2191.        If (dY <> 0) Then
  2192.          xi = Int(0.5 + (Dx / dY) * (poly_clip_max_y - Y1) + X1)
  2193.        Else
  2194.          xi = -1  '// invalidate inntersection
  2195.        End If
  2196.     ' End If 'bottom
  2197.        
  2198.      ElseIf (Y2 < poly_clip_min_y) Then 'top edge
  2199.        top_edge = 1 '// flag top edge
  2200.        '// compute intersection with top edge
  2201.        If (dY <> 0) Then
  2202.          xi = Int(0.5 + (Dx / dY) * (poly_clip_min_y - Y1) + X1)
  2203.        Else
  2204.          xi = -1  '// invalidate inntersection
  2205.        End If
  2206.      End If 'top
  2207. '// SECTION 5 /////////////////////////////////////////////////////////////////
  2208. '   // now we know where the line passed thru
  2209. '   // compute which edge is the proper intersection
  2210.     If (right_edge = 1 And (yi >= poly_clip_min_y And yi <= poly_clip_max_y)) Then
  2211.         X2 = poly_clip_max_x
  2212.         Y2 = yi
  2213.         success = 1
  2214.     'End If 'intersected right edge
  2215.     ElseIf (left_edge = 1 And (yi >= poly_clip_min_y And yi <= poly_clip_max_y)) Then
  2216.        X2 = poly_clip_min_x
  2217.        Y2 = yi
  2218.        success = 1
  2219.     End If 'intersected left edge
  2220.  
  2221.    If (bottom_edge = 1 And (xi >= poly_clip_min_x And xi <= poly_clip_max_x)) Then
  2222.      X2 = xi
  2223.      Y2 = poly_clip_max_y
  2224.      success = 1
  2225.    'End If 'intersected bottom edge
  2226.    
  2227.    ElseIf (top_edge = 1 And (xi >= poly_clip_min_x And xi <= poly_clip_max_x)) Then
  2228.       X2 = xi
  2229.       Y2 = poly_clip_min_y
  2230.       success = 1
  2231.    End If 'intersected top edge
  2232.  
  2233.  End If 'point_1 is visible
  2234.  
  2235. '// SECTION 6 /////////////////////////////////////////////////////////////////
  2236. '// reset edge flags
  2237.  right_edge = 0
  2238.  left_edge = 0
  2239.  top_edge = 0
  2240.  bottom_edge = 0
  2241.  
  2242. '// test second endpoint
  2243. If ((point_2 = 1) Or (point_1 = 0 And point_2 = 0)) Then
  2244.   '   // compute deltas
  2245.   Dx = X1 - X2
  2246.   dY = Y1 - Y2
  2247.   '  // compute what boundary line need to be clipped against
  2248.   If (X1 > poly_clip_max_x) Then
  2249.     right_edge = 1 '// flag right edge
  2250.     '// compute intersection with right edge
  2251.     If (Dx <> 0) Then
  2252.       yi = Int(0.5 + (dY / Dx) * (poly_clip_max_x - X2) + Y2)
  2253.     Else
  2254.       yi = -1  '// invalidate inntersection
  2255.     End If '// to right
  2256.   ElseIf (X1 < poly_clip_min_x) Then
  2257.     left_edge = 1 '// flag left edge @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2258.     '// compute intersection with left edge
  2259.     If (Dx <> 0) Then
  2260.       yi = Int(0.5 + (dY / Dx) * (poly_clip_min_x - X2) + Y2)
  2261.     Else
  2262.       yi = -1  '// invalidate intersection
  2263.     End If 'to left
  2264.   '// horizontal intersections
  2265.  
  2266.   ElseIf (Y1 > poly_clip_max_y) Then
  2267.     '// flag bottom edge
  2268.     bottom_edge = 1
  2269.     '// compute intersection with right edge
  2270.     If (dY <> 0) Then
  2271.       xi = Int(0.5 + (Dx / dY) * (poly_clip_max_y - Y2) + X2)
  2272.     Else
  2273.       xi = -1  '// invalidate inntersection
  2274.     End If 'bottom
  2275.   ElseIf (Y1 < poly_clip_min_y) Then
  2276.     '// flag top edge
  2277.     top_edge = 1
  2278.     '// compute intersection with top edge
  2279.     If (dY <> 0) Then
  2280.       xi = Int(0.5 + (Dx / dY) * (poly_clip_min_y - Y2) + X2)
  2281.     Else
  2282.       xi = -1   '// invalidate inntersection
  2283.     End If 'top
  2284.   End If
  2285.     '// now we know where the line passed thru
  2286.     '// compute which edge is the proper intersection
  2287.     If (right_edge = 1 And (yi >= poly_clip_min_y And yi <= poly_clip_max_y)) Then
  2288.       X1 = poly_clip_max_x
  2289.       Y1 = yi
  2290.       success = 1
  2291.     End If 'intersected right edge
  2292.     If (left_edge = 1 And (yi >= poly_clip_min_y And yi <= poly_clip_max_y)) Then
  2293.     X1 = poly_clip_min_x
  2294.     Y1 = yi
  2295.     success = 1
  2296.     End If 'intersected left edge
  2297.  
  2298.     If (bottom_edge = 1 And (xi >= poly_clip_min_x And xi <= poly_clip_max_x)) Then
  2299.       X1 = xi
  2300.       Y1 = poly_clip_max_y
  2301.       success = 1
  2302.     End If 'intersected bottom edge
  2303.   
  2304.    If (top_edge = 1 And (xi >= poly_clip_min_x And xi <= poly_clip_max_x)) Then
  2305.      X1 = xi
  2306.      Y1 = poly_clip_min_y
  2307.      success = 1
  2308.    End If 'intersected top edge
  2309.  End If 'point_2 is visible
  2310.  
  2311. '// SECTION 7 /////////////////////////////////////////////////////////////////
  2312. If success = 1 Then
  2313.   ClipReturn = True 'return(success);
  2314. Else
  2315.   ClipReturn = False
  2316. End If
  2317. ' // end Clip_Line
  2318. End Sub
  2319.  
  2320. Public Sub landstuff()
  2321.  Dim biggyx, biggyy As Integer
  2322.  Dim x As Integer
  2323.  Dim y As Integer
  2324.  Dim Temporary(32, 32) As Single
  2325.  Dim TempTarget(32, 32) As Boolean
  2326.  Dim Q As Integer
  2327.  Static GotoLanding As Boolean
  2328.  
  2329. '""""""""""""""""determine display matrix step and offset"""""""""""""""""""
  2330. If LmAlt >= 1000 Then 'you are ok mag factor 0
  2331.   DoubleFlag = 0
  2332.   Doublein = 1
  2333.   DoubleStart = 0
  2334.   Mag = 1
  2335. ElseIf LmAlt >= 750 Then 'you are ok mag factor 1
  2336.   DoubleFlag = 1
  2337.   Doublein = 2
  2338.   DoubleStart = 8
  2339.   Mag = 2
  2340. ElseIf LmAlt >= 500 Then 'you are ok mag factor 2
  2341.   DoubleFlag = 3
  2342.   Doublein = 4
  2343.   DoubleStart = 12
  2344.   Mag = 4
  2345. ElseIf LmAlt >= 400 Then
  2346.   DoubleFlag = 3
  2347.   Doublein = 4
  2348.   DoubleStart = 12
  2349.   Mag = 4
  2350.   GotoLanding = True
  2351. ElseIf LmAlt < 400 Then
  2352.   DoubleFlag = 3
  2353.   Doublein = 4
  2354.   DoubleStart = 12
  2355.   Mag = 4
  2356.   GotoLanding = True
  2357. 'ElseIf LmAlt < 400 Then 'you are ok mag factor 3
  2358. '  GotoLanding = True
  2359. '  DoubleFlag = 3
  2360. '  Doublein = 4
  2361. '  DoubleStart = 12
  2362. '  Mag = 4
  2363. End If
  2364.  
  2365. blueLine DoubleFlag
  2366.  
  2367. '"""""""""""""""""""""""""""""""""""""""y maginification"""""""""""""""""""""""""""""""""""
  2368. biggyy = DoubleStart + starty - 1
  2369. For y = starty To starty + 31 Step Doublein 'these indices are stepped depending on mag factor
  2370.   biggyy = biggyy + 1
  2371.   biggyx = DoubleStart + startx - 1
  2372.   For x = startx To startx + 31
  2373.     biggyx = biggyx + 1
  2374.     Select Case DoubleFlag
  2375.       Case Is = 0
  2376.         Temporary(x - startx, y - starty) = (1 + Biggy(biggyx, biggyy)) * Mag
  2377.         
  2378.         TempTarget(x - startx, y - starty) = TargetBiggy(biggyx, biggyy)
  2379.       Case Is = 1
  2380.         Temporary(x - startx, y - starty) = (2 + Biggy(biggyx, biggyy)) * Mag
  2381.         Temporary(x - startx, y - starty + 1) = (2 + 0.5 * Biggy(biggyx, biggyy) + 0.5 * Biggy(biggyx, biggyy + 1)) * Mag
  2382.         
  2383.         TempTarget(x - startx, y - starty) = TargetBiggy(biggyx, biggyy)
  2384.         TempTarget(x - startx, y - starty + 1) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2385.       Case Is = 3
  2386.         Temporary(x - startx, y - starty) = (4 + Biggy(biggyx, biggyy)) * Mag
  2387.         Temporary(x - startx, y - starty + 1) = (4 + 0.75 * Biggy(biggyx, biggyy) + 0.25 * Biggy(biggyx, biggyy + 1)) * Mag
  2388.         Temporary(x - startx, y - starty + 2) = (4 + 0.5 * Biggy(biggyx, biggyy) + 0.5 * Biggy(biggyx, biggyy + 1)) * Mag
  2389.         Temporary(x - startx, y - starty + 3) = (4 + 0.25 * Biggy(biggyx, biggyy) + 0.75 * Biggy(biggyx, biggyy + 1)) * Mag
  2390.         
  2391.         TempTarget(x - startx, y - starty) = TargetBiggy(biggyx, biggyy)
  2392.         TempTarget(x - startx, y - starty + 1) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2393.         TempTarget(x - startx, y - starty + 2) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2394.         TempTarget(x - startx, y - starty + 3) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2395.       Case Is = 7
  2396.         Temporary(x - startx, y - starty) = (8 + Biggy(biggyx, biggyy)) * Mag
  2397.         Temporary(x - startx, y - starty + 1) = (8 + 0.875 * Biggy(biggyx, biggyy) + 0.125 * Biggy(biggyx, biggyy + 1)) * Mag
  2398.         Temporary(x - startx, y - starty + 2) = (8 + 0.75 * Biggy(biggyx, biggyy) + 0.25 * Biggy(biggyx, biggyy + 1)) * Mag
  2399.         Temporary(x - startx, y - starty + 3) = (8 + 0.625 * Biggy(biggyx, biggyy) + 0.375 * Biggy(biggyx, biggyy + 1)) * Mag
  2400.         Temporary(x - startx, y - starty + 4) = (8 + 0.5 * Biggy(biggyx, biggyy) + 0.5 * Biggy(biggyx, biggyy + 1)) * Mag
  2401.         Temporary(x - startx, y - starty + 5) = (8 + 0.375 * Biggy(biggyx, biggyy) + 0.625 * Biggy(biggyx, biggyy + 1)) * Mag
  2402.         Temporary(x - startx, y - starty + 6) = (8 + 0.25 * Biggy(biggyx, biggyy) + 0.75 * Biggy(biggyx, biggyy + 1)) * Mag
  2403.         Temporary(x - startx, y - starty + 7) = (8 + 0.125 * Biggy(biggyx, biggyy) + 0.875 * Biggy(biggyx, biggyy + 1)) * Mag
  2404.       
  2405.         TempTarget(x - startx, y - starty) = TargetBiggy(biggyx, biggyy)
  2406.         TempTarget(x - startx, y - starty + 1) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2407.         TempTarget(x - startx, y - starty + 2) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2408.         TempTarget(x - startx, y - starty + 3) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2409.         TempTarget(x - startx, y - starty + 4) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2410.         TempTarget(x - startx, y - starty + 5) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2411.         TempTarget(x - startx, y - starty + 6) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2412.         TempTarget(x - startx, y - starty + 7) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2413.       Case Is = 15
  2414.         Temporary(x - startx, y - starty) = (16 + Biggy(biggyx, biggyy)) * Mag
  2415.         Temporary(x - startx, y - starty + 1) = (16 + 0.9375 * Biggy(biggyx, biggyy) + 0.0625 * Biggy(biggyx, biggyy + 1)) * Mag
  2416.         Temporary(x - startx, y - starty + 2) = (16 + 0.875 * Biggy(biggyx, biggyy) + 0.125 * Biggy(biggyx, biggyy + 1)) * Mag
  2417.         Temporary(x - startx, y - starty + 3) = (16 + 0.8125 * Biggy(biggyx, biggyy) + 0.1875 * Biggy(biggyx, biggyy + 1)) * Mag
  2418.         Temporary(x - startx, y - starty + 4) = (16 + 0.75 * Biggy(biggyx, biggyy) + 0.25 * Biggy(biggyx, biggyy + 1)) * Mag
  2419.         Temporary(x - startx, y - starty + 5) = (16 + 0.6875 * Biggy(biggyx, biggyy) + 0.3125 * Biggy(biggyx, biggyy + 1)) * Mag
  2420.         Temporary(x - startx, y - starty + 6) = (16 + 0.625 * Biggy(biggyx, biggyy) + 0.375 * Biggy(biggyx, biggyy + 1)) * Mag
  2421.         Temporary(x - startx, y - starty + 7) = (16 + 0.5625 * Biggy(biggyx, biggyy) + 0.4375 * Biggy(biggyx, biggyy + 1)) * Mag
  2422.         Temporary(x - startx, y - starty + 8) = (16 + 0.5 * Biggy(biggyx, biggyy) + 0.5 * Biggy(biggyx, biggyy + 1)) * Mag
  2423.         Temporary(x - startx, y - starty + 9) = (16 + 0.4375 * Biggy(biggyx, biggyy) + 0.5625 * Biggy(biggyx, biggyy + 1)) * Mag
  2424.         Temporary(x - startx, y - starty + 10) = (16 + 0.375 * Biggy(biggyx, biggyy) + 0.625 * Biggy(biggyx, biggyy + 1)) * Mag
  2425.         Temporary(x - startx, y - starty + 11) = (16 + 0.3125 * Biggy(biggyx, biggyy) + 0.6875 * Biggy(biggyx, biggyy + 1)) * Mag
  2426.         Temporary(x - startx, y - starty + 12) = (16 + 0.25 * Biggy(biggyx, biggyy) + 0.75 * Biggy(biggyx, biggyy + 1)) * Mag
  2427.         Temporary(x - startx, y - starty + 13) = (16 + 0.1875 * Biggy(biggyx, biggyy) + 0.8125 * Biggy(biggyx, biggyy + 1)) * Mag
  2428.         Temporary(x - startx, y - starty + 14) = (16 + 0.125 * Biggy(biggyx, biggyy) + 0.875 * Biggy(biggyx, biggyy + 1)) * Mag
  2429.         Temporary(x - startx, y - starty + 15) = (16 + 0.0625 * Biggy(biggyx, biggyy) + 0.9375 * Biggy(biggyx, biggyy + 1)) * Mag
  2430.       
  2431.         TempTarget(x - startx, y - starty) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2432.         TempTarget(x - startx, y - starty + 1) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2433.         TempTarget(x - startx, y - starty + 2) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2434.         TempTarget(x - startx, y - starty + 3) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2435.         TempTarget(x - startx, y - starty + 4) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2436.         TempTarget(x - startx, y - starty + 5) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2437.         TempTarget(x - startx, y - starty + 6) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2438.         TempTarget(x - startx, y - starty + 7) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2439.         TempTarget(x - startx, y - starty + 8) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2440.         TempTarget(x - startx, y - starty + 9) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2441.         TempTarget(x - startx, y - starty + 10) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2442.         TempTarget(x - startx, y - starty + 11) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2443.         TempTarget(x - startx, y - starty + 12) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2444.         TempTarget(x - startx, y - starty + 13) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2445.         TempTarget(x - startx, y - starty + 14) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2446.         TempTarget(x - startx, y - starty + 15) = TargetBiggy(biggyx, biggyy) Or TargetBiggy(biggyx, biggyy + 1)
  2447.     End Select
  2448.   Next x
  2449. Next y
  2450.  
  2451. '""""""""""""""""""""""""""""""""""""x magnification"""""""""""""""""""""""""""""""""""""
  2452. biggyx = -1
  2453. For x = 0 To 31 Step Doublein 'these indices are stepped depending on mag factor
  2454.   biggyx = biggyx + 1
  2455.   biggyy = -1
  2456.   For y = 0 To 31
  2457.   biggyy = biggyy + 1
  2458.     Select Case DoubleFlag
  2459.       Case Is = 0
  2460.         Display(x, y) = 1 + Temporary(biggyx, biggyy)
  2461.       
  2462.         TargetDisplay(x, y) = TempTarget(biggyx, biggyy)
  2463.       Case Is = 1
  2464.         Display(x, y) = 2 + Temporary(biggyx, biggyy)
  2465.         Display(x + 1, y) = (2 + 0.5 * Temporary(biggyx, biggyy) + 0.5 * Temporary(biggyx + 1, biggyy))
  2466.       
  2467.         TargetDisplay(x, y) = TempTarget(biggyx, biggyy)
  2468.         TargetDisplay(x + 1, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2469.       Case Is = 3
  2470.         Display(x, y) = 4 + Temporary(biggyx, biggyy)
  2471.         Display(x + 1, y) = (4 + 0.75 * Temporary(biggyx, biggyy) + 0.25 * Temporary(biggyx + 1, biggyy))
  2472.         Display(x + 2, y) = (4 + 0.5 * Temporary(biggyx, biggyy) + 0.5 * Temporary(biggyx + 1, biggyy))
  2473.         Display(x + 3, y) = (4 + 0.25 * Temporary(biggyx, biggyy) + 0.75 * Temporary(biggyx + 1, biggyy))
  2474.       
  2475.         TargetDisplay(x, y) = TempTarget(biggyx, biggyy)
  2476.         TargetDisplay(x + 1, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2477.         TargetDisplay(x + 2, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2478.         TargetDisplay(x + 3, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2479.       Case Is = 7
  2480.         Display(x, y) = 8 + Temporary(biggyx, biggyy)
  2481.         Display(x + 1, y) = (8 + 0.875 * Temporary(biggyx, biggyy) + 0.125 * Temporary(biggyx + 1, biggyy))
  2482.         Display(x + 2, y) = (8 + 0.75 * Temporary(biggyx, biggyy) + 0.25 * Temporary(biggyx + 1, biggyy))
  2483.         Display(x + 3, y) = (8 + 0.625 * Temporary(biggyx, biggyy) + 0.375 * Temporary(biggyx + 1, biggyy))
  2484.         Display(x + 4, y) = (8 + 0.5 * Temporary(biggyx, biggyy) + 0.5 * Temporary(biggyx + 1, biggyy))
  2485.         Display(x + 5, y) = (8 + 0.375 * Temporary(biggyx, biggyy) + 0.625 * Temporary(biggyx + 1, biggyy))
  2486.         Display(x + 6, y) = (8 + 0.25 * Temporary(biggyx, biggyy) + 0.75 * Temporary(biggyx + 1, biggyy))
  2487.         Display(x + 7, y) = (8 + 0.125 * Temporary(biggyx, biggyy) + 0.875 * Temporary(biggyx + 1, biggyy))
  2488.       
  2489.         TargetDisplay(x, y) = TempTarget(biggyx, biggyy)
  2490.         TargetDisplay(x + 1, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2491.         TargetDisplay(x + 2, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2492.         TargetDisplay(x + 3, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2493.         TargetDisplay(x + 4, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2494.         TargetDisplay(x + 5, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2495.         TargetDisplay(x + 6, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2496.         TargetDisplay(x + 7, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2497.       Case Is = 15
  2498.         Display(x, y) = 16 + Temporary(biggyx, biggyy)
  2499.         Display(x + 1, y) = (16 + 0.9375 * Temporary(biggyx, biggyy) + 0.0625 * Temporary(biggyx + 1, biggyy))
  2500.         Display(x + 2, y) = (16 + 0.875 * Temporary(biggyx, biggyy) + 0.125 * Temporary(biggyx + 1, biggyy))
  2501.         Display(x + 3, y) = (16 + 0.8125 * Temporary(biggyx, biggyy) + 0.1875 * Temporary(biggyx + 1, biggyy))
  2502.         Display(x + 4, y) = (16 + 0.75 * Temporary(biggyx, biggyy) + 0.25 * Temporary(biggyx + 1, biggyy))
  2503.         Display(x + 5, y) = (16 + 0.6875 * Temporary(biggyx, biggyy) + 0.3125 * Temporary(biggyx + 1, biggyy))
  2504.         Display(x + 6, y) = (16 + 0.625 * Temporary(biggyx, biggyy) + 0.375 * Temporary(biggyx + 1, biggyy))
  2505.         Display(x + 7, y) = (16 + 0.5625 * Temporary(biggyx, biggyy) + 0.4375 * Temporary(biggyx + 1, biggyy))
  2506.         Display(x + 8, y) = (16 + 0.5 * Temporary(biggyx, biggyy) + 0.5 * Temporary(biggyx + 1, biggyy))
  2507.         Display(x + 9, y) = (16 + 0.4375 * Temporary(biggyx, biggyy) + 0.5625 * Temporary(biggyx + 1, biggyy))
  2508.         Display(x + 10, y) = (16 + 0.375 * Temporary(biggyx, biggyy) + 0.625 * Temporary(biggyx + 1, biggyy))
  2509.         Display(x + 11, y) = (16 + 0.3125 * Temporary(biggyx, biggyy) + 0.6875 * Temporary(biggyx + 1, biggyy))
  2510.         Display(x + 12, y) = (16 + 0.25 * Temporary(biggyx, biggyy) + 0.75 * Temporary(biggyx + 1, biggyy))
  2511.         Display(x + 13, y) = (16 + 0.1875 * Temporary(biggyx, biggyy) + 0.8125 * Temporary(biggyx + 1, biggyy))
  2512.         Display(x + 14, y) = (16 + 0.125 * Temporary(biggyx, biggyy) + 0.875 * Temporary(biggyx + 1, biggyy))
  2513.         Display(x + 15, y) = (16 + 0.0625 * Temporary(biggyx, biggyy) + 0.9375 * Temporary(biggyx + 1, biggyy))
  2514.       
  2515.         TargetDisplay(x, y) = TempTarget(biggyx, biggyy)
  2516.         TargetDisplay(x + 1, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2517.         TargetDisplay(x + 2, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2518.         TargetDisplay(x + 3, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2519.         TargetDisplay(x + 4, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2520.         TargetDisplay(x + 5, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2521.         TargetDisplay(x + 6, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2522.         TargetDisplay(x + 7, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2523.         TargetDisplay(x + 8, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2524.         TargetDisplay(x + 9, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2525.         TargetDisplay(x + 10, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2526.         TargetDisplay(x + 11, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2527.         TargetDisplay(x + 12, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2528.         TargetDisplay(x + 13, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2529.         TargetDisplay(x + 14, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2530.         TargetDisplay(x + 15, y) = TempTarget(biggyx + 1, biggyy) Or TargetBiggy(biggyx, biggyy)
  2531.     End Select
  2532.   Next y
  2533. Next x
  2534.  
  2535. dirtLevel = ((Display(16, 24) / Mag) * 15.6)
  2536. AltiMeter = LmAlt - dirtLevel
  2537. AltiMeterReading = AltiMeter
  2538.  
  2539. FwdDist = 33 * (starty + DoubleStart + (24 / Mag))
  2540. LatDist = 33 * (startx + DoubleStart + (16 / Mag))
  2541. joyPolling ' this is a joystick call
  2542. If StopEverything Then Exit Sub
  2543. If (LatDist / 33) < 133 Then
  2544.   PorSta = "Starboard"
  2545. ElseIf (LatDist / 33) = 133 Then
  2546.   PorSta = ""
  2547. Else
  2548.   PorSta = "Port"
  2549. End If
  2550.    
  2551. If (FwdDist / 33) < 93 Then
  2552.   ForRev = "Rev"
  2553. ElseIf (FwdDist / 33) = 93 Then
  2554.   ForRev = ""
  2555. Else
  2556.   ForRev = "Fwd"
  2557. End If
  2558. Direction = ForRev + " " + PorSta
  2559.  
  2560. If startx >= 268 Or startx <= 32 Then 'outtabounds
  2561.   collision 0 ' 0 - out of bounds
  2562.   If StopEverything Then Exit Sub
  2563. End If
  2564. If starty >= 368 Or starty <= 32 Then
  2565.   collision 0
  2566.   If StopEverything Then Exit Sub
  2567. End If
  2568.   
  2569.   If GotoLanding Then
  2570.     Ydock = 0
  2571.     For x = 15 To 17
  2572.       For y = 23 To 25
  2573.         If TargetDisplay(x, y) Then
  2574.           PaintLandingSite = True
  2575.         End If
  2576.       Next y
  2577.     Next x
  2578.     For Q = 0 To 3
  2579.       auxjoy(Q).Enabled = False
  2580.       Command2(Int(Q / 2)).Enabled = False
  2581.     Next Q
  2582.     docking.Timer2.Enabled = False
  2583.     frmTime.masterTimer.Enabled = False
  2584.     Me.Hide
  2585.     StopEverything = True
  2586.     GotoApland = True
  2587.     If GotoApland = True Then
  2588.       Apland.Show
  2589.       If YouAreDead Then
  2590.         docking.collision 0
  2591.       Else
  2592.         If BullsEye Then
  2593.           docking.collision 4
  2594.         ElseIf PaintLandingSite Then
  2595.           docking.collision 5
  2596.         Else
  2597.           docking.collision 3
  2598.         End If
  2599.       End If
  2600.     End If
  2601.   End If
  2602.  
  2603. End Sub
  2604.  
  2605.  
  2606.  
  2607.  
  2608. Public Sub DrawBox()
  2609.   
  2610.   picBackground.Line (Box(0, 0), Box(0, 1))-(Box(1, 0), Box(1, 1)), QBColor(15)
  2611.  
  2612.   picBackground.Line -(Box(2, 0), Box(2, 1)), QBColor(15)
  2613.   picBackground.Line -(Box(3, 0), Box(3, 1)), QBColor(15)
  2614.   picBackground.Line -(Box(0, 0), Box(0, 1)), QBColor(15)
  2615. End Sub
  2616.  
  2617. Public Sub collision(Result As Integer)
  2618. Dim SplatText As String
  2619.  
  2620. diedFlag = True
  2621.  
  2622. Select Case Result
  2623.   Case Is = 0 ' abort?    <---------------------------------------------rick setup abort
  2624.     CompUnload = True
  2625.     Unload Apland
  2626.     CompUnload = False
  2627.     frmTime.masterTimer.Enabled = True
  2628.   Case Is = 1 ' general crash scene 1
  2629.     If LmAlt <= 6 * 15.6 Then
  2630.        frmTime.PlayAVI "death\shot21.avi", 3
  2631.        SplatText = "goin' too flippin' fast in a crater"
  2632.     Else 'LmAlt >= 8 * 15.6 Then
  2633.        frmTime.PlayAVI "death\shot22.avi", 3
  2634.        SplatText = "goin' too darn fast near a mountain"
  2635.     End If
  2636.   Case Is = 2
  2637.        frmTime.PlayAVI "death\shot20.avi", 3
  2638.   Case Is = 3
  2639.     'oh damn, I can't reach it mvi
  2640.     frmTime.masterTimer.Enabled = True
  2641.     CompUnload = True
  2642.     Unload Apland
  2643.     CompUnload = False
  2644.     SplatText = "so close you can smell it.  Too bad you cant take it."
  2645.     OnTheMoon = True
  2646.     CanReachIt = False
  2647.     diedFlag = False
  2648.     frmTime.masterTimer.Enabled = True
  2649.     CompUnload = True
  2650.     Unload Apland
  2651.     CompUnload = False
  2652.   Case Is = 4
  2653.     'happy happy joy joy mvi
  2654.     frmTime.PlayAVI "success\shot19a.avi", 3
  2655.     frmTime.PlayAVI "success\shot19c.avi", 3
  2656.     OnTheMoon = True
  2657.     CanReachIt = True
  2658.     SplatText = "hory cow, you did it!"
  2659.     diedFlag = False
  2660.     MissionState = 7
  2661.     frmTime.masterTimer.Enabled = True
  2662.     CompUnload = True
  2663.     Unload Apland
  2664.     CompUnload = False
  2665.   Case Is = 5
  2666.     'your a loser, you couldn't even get close to the target mvi
  2667.     SplatText = "you suck. try asteroids."
  2668.     OnTheMoon = True
  2669.     CanReachIt = False
  2670.     diedFlag = False
  2671.     frmTime.masterTimer.Enabled = True
  2672.     CompUnload = True
  2673.     Unload Apland
  2674.     CompUnload = False
  2675. End Select
  2676. SplatTextBox.Text = SplatText
  2677. text1.Text = "True Alt = 0"
  2678. Text2.Text = "Your X " + Str(startx + 16) '"fuel"
  2679. Text3.Text = " "
  2680. Text4.Text = "Your Y " + Str(starty + 16) '"RCS"
  2681. Text5.Text = "Fwd Vel = 0"
  2682. Text6.Text = "Lat Vel = 0"
  2683. distance.Caption = "0"
  2684. closerate.Caption = "0"
  2685.  
  2686. DoCurve = False
  2687. Me.Visible = False
  2688. MissionState = 7
  2689.  
  2690. If Not diedFlag Then
  2691.   Met = 1670
  2692.   fivek = 5
  2693.   StopEverything = True
  2694.   OkToLand = False
  2695. Else
  2696.   diedFlag = False
  2697.   StopEverything = True
  2698.   Met = 1660
  2699.   fivek = 5
  2700.   OkToLand = False
  2701. End If
  2702.  
  2703. End Sub
  2704.  
  2705. Public Sub blueLine(whatLine As Integer)
  2706.   Dim k, j As Integer
  2707.  
  2708.   For k = 0 To 31 'initialize bluedline to green
  2709.     BluedLine(k) = 2
  2710.   Next k
  2711.   
  2712.   Select Case whatLine
  2713.     Case Is = 1 'Alt 599
  2714.       For k = 1 To 31 Step 2
  2715.         BluedLine(k) = 8 '1 fake line
  2716.       Next k
  2717.     Case Is = 3 'alt 449
  2718.       For k = 1 To 31 Step 4
  2719.         For j = 0 To 2 ' three fake lines
  2720.           BluedLine(k + j) = 8
  2721.         Next j
  2722.       Next k
  2723.     Case Is = 7 'alt 199
  2724.       For k = 1 To 31 Step 8
  2725.         For j = 0 To 6 'seven fake lines
  2726.           BluedLine(k + j) = 8
  2727.         Next j
  2728.       Next k
  2729.     Case Is = 15
  2730.       For k = 1 To 31 Step 16
  2731.         For j = 0 To 14 'fifteen fake lines
  2732.           BluedLine(k + j) = 8
  2733.         Next j
  2734.       Next k
  2735.     Case Is = 999
  2736.   End Select
  2737.   BluedLine(24) = 10
  2738.   'Label1.Caption = "x = " + Str(startx + 24)
  2739.   'Label2.Caption = "y = " + Str(starty + 25)
  2740. End Sub
  2741.  
  2742. Public Sub joyPolling()
  2743.   Dim WhereAmI, whereisX, whereisY, wheretoken As Integer
  2744.   Dim rc As Long
  2745.   Dim x As Integer
  2746.   Rem Joystick
  2747.   
  2748.   rc = GetJoyStickPos(JOYSTICK1, JoyInfo)
  2749.   DoEvents
  2750.       
  2751.   Rem --- check for left or right
  2752.   whereisX = 0
  2753.   
  2754.   If JoyInfo.x < leftX Then
  2755.     whereisX = -1
  2756.   Else
  2757.     If JoyInfo.x > rightX Then
  2758.       whereisX = 1
  2759.     End If
  2760.   End If
  2761.   
  2762.   Rem --- check for up or down
  2763.   whereisY = 0
  2764.   
  2765.   If JoyInfo.y < topY Then
  2766.     whereisY = -1
  2767.   ElseIf JoyInfo.y > bottomY Then
  2768.       whereisY = 1
  2769.   End If
  2770.   
  2771.   wheretoken = whereisX + whereisY
  2772.   WhereAmI = 4
  2773.  
  2774.   If wheretoken = 1 And whereisX = 1 Then
  2775.     WhereAmI = 1
  2776.   ElseIf wheretoken = 1 And whereisX <> 1 Then
  2777.     WhereAmI = 2
  2778.   End If
  2779.   
  2780.   If wheretoken = -1 And whereisY = -1 Then
  2781.     WhereAmI = 0
  2782.   ElseIf wheretoken = -1 And whereisY <> -1 Then
  2783.     WhereAmI = 3
  2784.   End If
  2785.   
  2786.   Command1.Caption = WhereAmI
  2787.   
  2788.   
  2789.   If WhereAmI <> 4 Then
  2790.     Call JoyControl((WhereAmI))
  2791.   End If
  2792.   
  2793.   If JoyInfo.ButtonDown(1) Then
  2794.     Select Case WhereAmI
  2795.       Case Is = 0
  2796.         x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  2797.         Ydock = Ydock - 1
  2798.         Call JoyControl(0)
  2799.       Case Is = 1
  2800.         x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  2801.         Xdock = Xdock + 1
  2802.         LatVel = Xdock * 33
  2803.          Call JoyControl(1)
  2804.       Case Is = 2
  2805.         x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  2806.         Ydock = Ydock + 1
  2807.         Call JoyControl(2)
  2808.       Case Is = 3
  2809.         x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  2810.         Xdock = Xdock - 1
  2811.         LatVel = Xdock * 33
  2812.         Call JoyControl(3)
  2813.     End Select
  2814.   End If
  2815.   
  2816.   If JoyInfo.ButtonDown(2) Then
  2817.     Select Case WhereAmI
  2818.       Case Is = 0
  2819.         x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  2820.         Zdock = Zdock - 1
  2821.         FwdVel = -Zdock * 33
  2822.       Case Is = 2
  2823.         x = frmTime.playSound(CDdrive + "\sfx\rcstrst.wav", EFFECTS, NO_LUPE)
  2824.         Zdock = Zdock + 1
  2825.         FwdVel = -Zdock * 33
  2826.       End Select
  2827.   End If
  2828.   
  2829.   Rem
  2830.   Rem
  2831.   Rem end joystick
  2832. End Sub
  2833.  
  2834.  
  2835. Sub Timer3_Timer()
  2836.   Static Xpos As Integer
  2837.   Static Ypos As Integer
  2838.   Dim rc As Long
  2839.   Static Scountz As Integer
  2840.   Static Secondz As Integer
  2841.   Static WaitCountz As Integer
  2842.   Static NotFirstTime2 As Boolean
  2843.   Static NotFirstTime1 As Boolean
  2844.   Static xComponent As Integer
  2845.   Static yComponent As Integer
  2846.   
  2847.   
  2848.   
  2849.   Dim x As Integer
  2850.   'Dim i As Integer
  2851.   Dim WhereAmI, whereisX, whereisY, wheretoken As Integer
  2852.   'lblZ = ldist
  2853.   Dim currpath As String
  2854.   
  2855.   If Not NotFirstTime2 Then
  2856.     If Not NotFirstTime1 Then
  2857.       StarSeconds = Int(StarSeconds / 2)
  2858.       Xdock = firstXpos
  2859.       Ydock = firstYpos
  2860.       NotFirstTime1 = True
  2861.       Xpos = 0
  2862.       Ypos = 0
  2863.       BG_NewX = 0
  2864.       BG_NewY = 0
  2865.     Else
  2866.       Xdock = 0
  2867.       Ydock = 0
  2868.       NotFirstTime2 = True
  2869.     End If
  2870.   End If
  2871.   
  2872.   If Not WaitingToLeave Then
  2873.     Scountz = Scountz + 1
  2874.     If Scountz >= 20 Then
  2875.       Scountz = 0
  2876.       Secondz = Secondz + 1
  2877.       If Secondz >= StarSeconds Then
  2878.         StarCrossed = False
  2879.         goGame = 0
  2880.         Reason = 26
  2881.         YouAreDead = True
  2882.         Timer3.Enabled = False
  2883.         docking.Visible = False
  2884.         Exit Sub
  2885.       End If
  2886.     End If
  2887.   Else
  2888.     WaitCountz = WaitCountz + 1
  2889.     If WaitCountz >= 100 Then
  2890.       DoEvents
  2891.       StarCrossed = False
  2892.       Scountz = 0
  2893.       Secondz = 0
  2894.       WaitCountz = 0
  2895.       WaitingToLeave = False
  2896.       NotFirstTime1 = False
  2897.       NotFirstTime2 = False
  2898.       Male = 3
  2899.       Female = 1
  2900.       frmTime.Transfer
  2901.     End If
  2902.     Exit Sub
  2903.   End If
  2904.     
  2905.   currpath = CDdrive + "\docking\csm4\"
  2906.  
  2907.     closerate.Visible = True
  2908.     distance.Visible = True
  2909.     closerate.Caption = pubXpos
  2910.     distance.Caption = pubYpos
  2911.     Secondz = 0
  2912.     'closerate.Caption = " N/A"
  2913.     'distance.Caption = "N/A"
  2914.     
  2915. '-----------------------------------------------------
  2916. ' Move the background horizontally under scroller
  2917. ' control.
  2918. '-----------------------------------------------------
  2919.    
  2920. Rem ********************************************************************************
  2921.     Xpos = Xpos - Xdock
  2922.     
  2923.     Ypos = Ypos - Ydock
  2924.     
  2925.     UpdateBackground
  2926.     
  2927.     Rem --- if x is off left side ---
  2928.     If Xpos < -picPitSprite.ScaleWidth + picImage.ScaleWidth Then
  2929.       Xpos = 800 - picPitSprite.ScaleWidth + picImage.ScaleWidth
  2930.     Else 'if off right side
  2931.         If Xpos > 800 - picImage.ScaleWidth Then Xpos = 0 - picImage.ScaleWidth
  2932.     End If
  2933.    
  2934.     Rem --- if y is off top side ---
  2935.     If Ypos < -picImage.ScaleHeight Then
  2936.       Ypos = 600 - picImage.ScaleHeight
  2937.     Else 'if off bottom
  2938.       If Ypos > 600 - picImage.ScaleHeight Then Ypos = 0 - picImage.ScaleHeight
  2939.     End If
  2940.    
  2941.     ' Copy a section of the large bitmap into the work area.
  2942.   rc = BitBlt(picWorkBG.hDC, 0, 0, WorkWidth, WorkHeight, picBGOriginal.hDC, 0, 0, SRCCOPY)
  2943.         
  2944.       
  2945.  rc = BitBlt(picWorkBG.hDC, 0, 0, picPitMask.Width, picPitMask.Height, picPitMask.hDC, 0, 0, SRCAND)
  2946.     'draw cockpit
  2947.  rc = BitBlt(picWorkBG.hDC, 0, 0, picPitMask.Width, picPitMask.Height, picPitSprite.hDC, 0, 0, SRCPAINT)
  2948.  
  2949.     ' Draw the whole thing back onto the screen.
  2950.   rc = BitBlt(picBackground.hDC, 0, 0, picBackground.Width, picBackground.Height, picWorkBG.hDC, 0, 0, SRCCOPY)
  2951.   
  2952.   auxjoy(0).Visible = True
  2953.   auxjoy(1).Visible = True
  2954.   auxjoy(2).Visible = True
  2955.   auxjoy(3).Visible = True
  2956.   auxcon(0).Picture = auxcon(5).Picture
  2957.  Rem
  2958.  Rem
  2959.  Rem Joystick
  2960.   
  2961.   rc = GetJoyStickPos(JOYSTICK1, JoyInfo)
  2962.  
  2963.   
  2964.   Rem --- check for left or right
  2965.   whereisX = 0
  2966.   
  2967.   If JoyInfo.x < leftX Then
  2968.     whereisX = -1
  2969.   Else
  2970.     If JoyInfo.x > rightX Then
  2971.       whereisX = 1
  2972.     End If
  2973.   End If
  2974.   
  2975.   Rem --- check for up or down
  2976.   whereisY = 0
  2977.   
  2978.   If JoyInfo.y < topY Then
  2979.     whereisY = -1
  2980.   Else
  2981.     If JoyInfo.y > bottomY Then
  2982.       whereisY = 1
  2983.     End If
  2984.   End If
  2985.   
  2986.   wheretoken = whereisX + whereisY
  2987.   WhereAmI = 4
  2988.   
  2989.   If wheretoken = 1 Then
  2990.     If whereisX = 1 Then
  2991.       WhereAmI = 1
  2992.     Else
  2993.       WhereAmI = 2
  2994.     End If
  2995.   End If
  2996.   
  2997.   If wheretoken = -1 Then
  2998.     If whereisY = -1 Then
  2999.       WhereAmI = 0
  3000.     Else
  3001.       WhereAmI = 3
  3002.     End If
  3003.   End If
  3004.     
  3005.   Command1.Caption = WhereAmI
  3006.   
  3007.   If WhereAmI <> 4 Then
  3008.     Call JoyControl((WhereAmI))
  3009.   End If
  3010.   
  3011.   If JoyInfo.ButtonDown(1) And WhereAmI = 1 Then
  3012.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  3013.       Xdock = Xdock + 1
  3014.       'xComponent = xComponent + 1
  3015.        Call JoyControl(1)
  3016.   End If
  3017.   
  3018.   If JoyInfo.ButtonDown(1) And WhereAmI = 3 Then
  3019.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  3020.       Xdock = Xdock - 1
  3021.       'xComponent = xComponent - 1
  3022.      Call JoyControl(3)
  3023.   End If
  3024.   
  3025.   If JoyInfo.ButtonDown(1) And WhereAmI = 2 Then
  3026.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  3027.       Ydock = Ydock + 1
  3028.       'yComponent = yComponent + 1
  3029.       Call JoyControl(2)
  3030.   End If
  3031.   
  3032.   If JoyInfo.ButtonDown(1) And WhereAmI = 0 Then
  3033.       x = frmTime.playSound(CDdrive + "rcstrst.wav", EFFECTS, NO_LUPE)
  3034.       Ydock = Ydock - 1
  3035.       'yComponent = yComponent - 1
  3036.        Call JoyControl(0)
  3037.   End If
  3038.   pubXpos = Xpos
  3039.   pubYpos = Ypos
  3040.  
  3041. End Sub
  3042.  
  3043. Sub VScroll1_Change()
  3044.   Dim temp As Integer
  3045.   Dim tdigs(3) As Integer
  3046.   
  3047.   contThrust = VScroll1 'vscroll1 is the value of the slider
  3048.   
  3049.   
  3050.   temp = contThrust
  3051.   
  3052.   tdigs(0) = contThrust Mod 10
  3053.   temp = temp - tdigs(0)
  3054.   
  3055.   tdigs(1) = temp / 10
  3056.   
  3057.   If tdigs(1) >= 10 Then
  3058.     tdigs(1) = tdigs(1) - 10
  3059.     tdigs(2) = 1
  3060.   Else
  3061.     tdigs(2) = 0
  3062.   End If
  3063.   
  3064.   docking.dockThrust(0).Picture = frmTime.imgdnum(tdigs(0)).Picture
  3065.   docking.dockThrust(1).Picture = frmTime.imgdnum(tdigs(1)).Picture
  3066.   docking.dockThrust(2).Picture = frmTime.imgdnum(tdigs(2)).Picture
  3067.   
  3068. End Sub
  3069.  
  3070.  
  3071.