//--------------------------------------------------------------------------
$vehicleReticle[ScoutFlyer, 1, bitmap] = "gui/hud_ret_shrike.png";
$vehicleReticle[ScoutFlyer, 1, frame] = true;
$vehicleReticle[ScoutFlyer, 2, bitmap] = "gui/ret_missile.png";
$vehicleReticle[ScoutFlyer, 2, frame] = true;
$vehicleReticle[ScoutFlyer, 3, bitmap] = "gui/hud_ret_targlaser.png";
$vehicleReticle[ScoutFlyer, 3, frame] = false;

// This large function builds the Vehicle HUDs for each Vehicle.
function clientCmdShowVehicleGauges(%VehicleType, %MountPoint)
{
    dashboardHud.nrgBar = new HudBitmapCtrl(vEnergyFrame) {
      profile = "GuiDashBoxProfile";
      horizSizing = "right";
      vertSizing = "top";
      position = "160 80";
      extent = "118 19";
      minExtent = "8 8";
      visible = "1";
      bitmap = "gui/hud_veh_new_dashpiece_5.png";
      opacity = "0.8";

      new HudEnergy(vEnergyBar) {
         profile = "GuiDefaultProfile";
         horizSizing = "right";
         vertSizing = "top";
         position = "0 0";
         extent = "118 19";
         minExtent = "8 8";
         visible = "1";
         fillColor = "0.353000 0.373000 0.933000 0.800000";
         frameColor = "0.000000 1.000000 0.000000 1.000000";
         autoCenter = "0";
         autoResize = "0";
         displayMounted = true;
         bitmap = "gui/hud_veh_new_dashpiece_5.png";
         verticalFill = false;
         subRegion = "4 5 98 10";
         pulseRate = "500";
         pulseThreshold = "0.3";
         //modColor = "1.000000 0.500000 0.000000 1.000000";
      };
   };
   dashboardHud.add(dashboardHud.nrgBar);

   dashboardHud.dmgBar = new HudBitmapCtrl(vDamageFrame) {
      profile = "GuiDashBoxProfile";
      horizSizing = "right";
      vertSizing = "top";
      position = "361 80";
      extent = "118 19";
      minExtent = "8 8";
      visible = "1";
      bitmap = "gui/hud_veh_new_dashpiece_4.png";
      opacity = "0.8";

      new HudDamage(vDamageBar) {
         profile = "GuiDefaultProfile";
         horizSizing = "right";
         vertSizing = "top";
         position = "0 0";
         extent = "118 19";
         minExtent = "8 8";
         visible = "1";
         fillColor = "0.000000 1.0000 0.000000 0.800000";
         frameColor = "0.000000 1.000000 0.000000 0.000000";
         bitmap = "gui/hud_veh_new_dashpiece_4.png";
         verticalFill = false;
         displayMounted = true;
         opacity = "0.8";
         subRegion = "18 5 97 10";
         pulseRate = "500";
         pulseThreshold = "0.3";
         //modColor = "1.000000 0.500000 0.000000 1.000000";
      };
   };
   dashboardHud.add(dashboardHud.dmgBar);

   // For Pilots only...
   if(%MountPoint == 0)
   {
      // common elements that show up on all vehicle pilot HUDs
      dashboardHud.diagram = new HudBitmapCtrl(vDiagramHud) {
         profile = "GuiDashBoxProfile";
         horizSizing = "right";
         vertSizing = "top";
         position = "200 10";
         extent = "176 108";
         minExtent = "8 8";
         visible = "1";
         bitmap = "gui/hud_veh_new_dash.png";
         opacity = "0.8";
      };
      dashboardHud.add(dashboardHud.diagram);

      dashboardHud.vehDiagram = new HudBitmapCtrl(vOverheadHud) {
         profile = "GuiDashBoxProfile";
         horizSizing = "right";
         vertSizing = "top";
         position = "256 0";
         extent = "128 128";
         minExtent = "8 8";
         visible = "1";
         bitmap = "";
         opacity = "1.0";
      };
      dashboardHud.add(dashboardHud.vehDiagram);

      dashboardHud.speedBox = new GuiControl(vSpeedBox) {
         profile = "GuiDashBoxProfile";
         horizSizing = "right";
         vertSizing = "top";
         position = "210 47";
         extent = "40 40";
         minExtent = "8 8";
         visible = "1";

         new GuiTextCtrl(vSpeedText) {
            profile = "GuiDashTextProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "3 15";
            extent = "18 15";
            minExtent = "8 8";
            visible = "1";
            text = "test";
         };
         new GuiTextCtrl(vSpeedTxtLbl) {
            profile = "GuiDashTextProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "18 15";
            extent = "27 15";
            minExtent = "8 8";
            visible = "1";
            text = "KPH";
         };
      };
      dashboardHud.add(dashboardHud.speedBox);

      dashboardHud.updateSpeed();
   }

   switch$ (%VehicleType) {

      case "Shrike" :
         vOverheadHud.setBitmap("gui/hud_veh_icon_shrike.png");

         // add altitude box for flying vehicles
         dashboardHud.altBox = new HudBitmapCtrl(vAltitudeBox) {
            profile = "GuiDashBoxProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "371 56";
            extent = "68 22";
            minExtent = "8 8";
            bitmap = "gui/hud_veh_new_dashpiece_1.png";
            visible = "1";
            opacity = "0.8";

            new GuiTextCtrl(vAltitudeText) {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "19 5";
               extent = "18 15";
               minExtent = "8 8";
               visible = "1";
               text = "test";
            };
            new GuiTextCtrl(vAltitudeTxtLbl) {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "40 5";
               extent = "12 15";
               minExtent = "8 8";
               visible = "1";
               text = "M";
            };
            new HudBitmapCtrl(vWeap3Hilite) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "bottom";
               position = "99 9";
               extent = "40 44";
               minExtent = "8 8";
               visible = "1";
               bitmap = "gui/hud_veh_new_hilite_middle.png";
               opacity = "0.3";
            };
         };
         dashboardHud.add(dashboardHud.altBox);
         dashboardHud.updateAltitude();

         // add right-hand weapons box and highlight
         dashboardHud.weapon = new GuiControl(vWeapHiliteOne)
         {
            profile = "GuiDefaultProfile";
            horizSizing = "center";
            vertSizing = "top";
            position = "225 70";
            extent = "240 50";
            minExtent = "8 8";
            visible = "1";

            new HudBitmapCtrl(vWeap1Hilite)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "bottom";
               position = "10 11";
               extent = "80 44";
               minExtent = "8 8";
               visible = "1";
               bitmap = "gui/hud_veh_new_hilite_left.png";
               opacity = "0.4";
            };

            new HudBitmapCtrl(vWeap2Hilite)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "bottom";
               position = "103 11";
               extent = "80 44";
               minExtent = "8 8";
               visible = "1";
               bitmap = "gui/hud_veh_new_hilite_right.png";
               opacity = "0.4";
            };

            new HudBitmapCtrl(turreteerFrame)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "center";
               vertSizing = "bottom";
               position = "20 8";
               extent = "152 36";
               minExtent = "8 8";
               visible = "1";
               bitmap = "gui/hud_veh_new_tankgunner_dash.png";
               opacity = "0.8";

               new HudBitmapCtrl(vWeaponOne)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "25 8";
                  extent = "25 25";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_chaingun.png";
               };

               new HudBitmapCtrl(vWeaponTwo) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "62 6";
                  extent = "25 25";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_targetlaser.png";
               };

               new HudBitmapCtrl(vWeaponTwo)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "99 8";
                  extent = "25 25";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_missiles.png";
               };
            };
         };
         dashboardHud.add(dashboardHud.weapon);

         vOverheadHud.passengerHud = new GuiControl(vPassengerHud)
         {
            profile = "GuiDashBoxProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "0 0";
            extent = "127 114";
            minExtent = "8 8";
            visible = "1";

            new GuiBitmapCtrl(vPassenger0Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "59 46";
               extent = "10 10";
               minExtent = "3 3";
               visible = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
            };
         };
         vOverheadHud.add(vOverheadHud.passengerHud);

         $numVWeapons = 3;
         // change to shrike reticle
         reticleHud.setBitmap("gui/hud_ret_shrike.png");
         reticleFrameHud.setVisible(true);

      case "Bomber" :
         if(%MountPoint == 1)
         {
            // bombardier hud
            dashboardHud.bHud = new GuiControl(bombardierHud) {
               profile = "GuiDefaultProfile";
               horizSizing = "center";
               vertSizing = "top";
               position = "200 75";
               extent = "480 50";
               minExtent = "8 8";
               visible = "1";

               new HudBitmapCtrl(vWeap1Hilite) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "18 9";
                  extent = "80 44";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_veh_new_hilite_left.png";
                  opacity = "0.3";
               };
               new HudBitmapCtrl(vWeap2Hilite) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "141 9";
                  extent = "80 44";
                  minExtent = "8 8";
                  visible = "0";
                  bitmap = "gui/hud_veh_new_hilite_right.png";
                  opacity = "0.3";
               };
               new HudBitmapCtrl(vWeap3Hilite) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "99 9";
                  extent = "40 44";
                  minExtent = "8 8";
                  visible = "0";
                  bitmap = "gui/hud_veh_new_hilite_middle.png";
                  opacity = "0.3";
               };

               new HudBitmapCtrl(bombardierFrame) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "center";
                  vertSizing = "bottom";
                  position = "20 8";
                  extent = "200 40";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_veh_new_bombardier_dash.png";
                  opacity = "1.0";

                  new HudBitmapCtrl(vWeaponOne) {
                     profile = "GuiDashBoxProfile";
                     horizSizing = "right";
                     vertSizing = "bottom";
                     position = "28 5";
                     extent = "25 25";
                     minExtent = "8 8";
                     visible = "1";
                     bitmap = "gui/hud_blaster.png";
                  };

                  new HudBitmapCtrl(vWeaponTwo) {
                     profile = "GuiDashBoxProfile";
                     horizSizing = "right";
                     vertSizing = "bottom";
                     position = "87 6";
                     extent = "25 25";
                     minExtent = "8 8";
                     visible = "1";
                     bitmap = "gui/hud_targetlaser.png";
                  };

                  new HudBitmapCtrl(vWeaponThree) {
                     profile = "GuiDashBoxProfile";
                     horizSizing = "right";
                     vertSizing = "bottom";
                     position = "147 6";
                     extent = "25 25";
                     minExtent = "8 8";
                     visible = "1";
                     bitmap = "gui/hud_veh_bomb.png";
                  };
               };

               new GuiTextCtrl(BombTypeLabel)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "20 -30";
                  extent = "450 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "Key:    BombType:";
               };

               new GuiTextCtrl(BombType1)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "20 -18";
                  extent = "450 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "1  -  High Yield";
               };

               new GuiTextCtrl(BombType2)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "20 -6";
                  extent = "450 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "2  -  Cluster Bomb";
               };

               new GuiTextCtrl(BombType3)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "20 6";
                  extent = "450 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "3  -  Incendiary Bomb";
               };

               new GuiTextCtrl(BombType4)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "20 18";
                  extent = "450 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "4  -  EMP Bomb";
               };

               new GuiTextCtrl(BombType5)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "20 30";
                  extent = "450 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "5  -  Depth Charge";
               };
            };
            dashboardHud.add(dashboardHud.bHud);

            $numVWeapons = 3;
            reticleHud.setBitmap("gui/hud_ret_shrike.png");
            reticleFrameHud.setVisible(false);
         }
         else if(%MountPoint == 0)
         {
            // pilot dashboard hud
            vOverheadHud.setBitmap("gui/hud_veh_icon_bomber.png");
            // add altitude box for flying vehicles
            dashboardHud.altBox = new HudBitmapCtrl(vAltitudeBox) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "371 56";
               extent = "68 22";
               minExtent = "8 8";
               bitmap = "gui/hud_veh_new_dashpiece_1.png";
               visible = "1";
               opacity = "0.8";

               new GuiTextCtrl(vAltitudeText) {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "19 5";
                  extent = "18 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "test";
               };
               new GuiTextCtrl(vAltitudeTxtLbl) {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "40 5";
                  extent = "12 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "M";
               };
            };
            dashboardHud.add(dashboardHud.altBox);
            dashboardHud.updateAltitude();
         }
         else
         {
            // tailgunner hud
            dashboardHud.vehDiagram = new HudBitmapCtrl(vOverheadHud) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "256 0";
               extent = "128 128";
               minExtent = "8 8";
               visible = "1";
               bitmap = "gui/hud_veh_icon_bomber.png";
               opacity = "1.0";
            };
            dashboardHud.add(dashboardHud.vehDiagram);
         }
         if(%MountPoint != 1)
         {
            // passenger slot "dots"
            vOverheadHud.passengerHud = new GuiControl(vPassengerHud) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "0 0";
               extent = "127 114";
               minExtent = "8 8";
               visible = "1";

               new GuiBitmapCtrl(vPassenger0Slot)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "59 24";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot2.png";
               };
               new GuiBitmapCtrl(vPassenger0Slote)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "59 24";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot.png";
               };
               new GuiTextCtrl(vPassengerName0Slot)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "6 19";
                  extent = "118 19";
                  minExtent = "8 8";
                  visible = "0";
                  text = "Passenger";
               };
               new GuiBitmapCtrl(vPassenger1Slot)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "59 39";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot2.png";
               };
               new GuiBitmapCtrl(vPassenger1Slote)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "59 39";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot.png";
               };
               new GuiTextCtrl(vPassengerName1Slot)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "6 36";
                  extent = "118 19";
                  minExtent = "8 8";
                  visible = "0";
                  text = "Passenger";
               };
               new GuiBitmapCtrl(vPassenger2Slot)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "59 84";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot2.png";
               };
               new GuiBitmapCtrl(vPassenger2Slote)
               {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "59 84";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot.png";
               };
               new GuiTextCtrl(vPassengerName2Slot)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "6 72";
                  extent = "118 19";
                  minExtent = "8 8";
                  visible = "0";
                  text = "Passenger";
               };
            };
            vOverheadHud.add(vOverheadHud.passengerHud);
         }
      case "HAPC" :
         if(%MountPoint == 0)
         {
            vOverheadHud.setBitmap("gui/hud_veh_icon_hapc.png");
            // add altitude box for flying vehicles
            dashboardHud.altBox = new HudBitmapCtrl(vAltitudeBox) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "371 56";
               extent = "68 22";
               minExtent = "8 8";
               bitmap = "gui/hud_veh_new_dashpiece_1.png";
               visible = "1";
               opacity = "0.8";

               new GuiTextCtrl(vAltitudeText) {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "19 5";
                  extent = "18 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "test";
               };
               new GuiTextCtrl(vAltitudeTxtLbl) {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "40 5";
                  extent = "12 15";
                  minExtent = "8 8";
                  visible = "1";
                  text = "M";
               };
            };
            dashboardHud.add(dashboardHud.altBox);
            updateVehicleAltitude();
            dashboardHud.updateAltitude();

         }
         else
         {
            // passenger hud
            dashboardHud.vehDiagram = new HudBitmapCtrl(vOverheadHud) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "256 0";
               extent = "128 128";
               minExtent = "8 8";
               visible = "1";
               bitmap = "gui/hud_veh_icon_hapc.png";
               opacity = "1.0";
            };
            dashboardHud.add(dashboardHud.vehDiagram);
         }
         // passenger slot "dots"
         vOverheadHud.passengerHud = new GuiControl(vPassengerHud) {
            profile = "GuiDashBoxProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "-19 0";
            extent = "180 101";
            minExtent = "8 8";
            visible = "1";
            setFirstResponder = "0";
            modal = "1";
            helpTag = "0";

            new GuiBitmapCtrl(vPassenger0Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "79 65";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
               wrap = "0";
            };
            new GuiBitmapCtrl(vPassenger0Slote)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "79 65";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot.png";
               wrap = "0";
            };
            new GuiTextCtrl(vPassengerName0Slot)
            {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "29 65";
               extent = "118 19";
               minExtent = "8 8";
               visible = "0";
               text = "Passenger";
            };
            new GuiBitmapCtrl(vPassenger1Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "79 84";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
               wrap = "0";
            };
            new GuiBitmapCtrl(vPassenger1Slote)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "79 84";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot.png";
               wrap = "0";
            };
            new GuiTextCtrl(vPassengerName1Slot)
            {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "29 84";
               extent = "118 19";
               minExtent = "8 8";
               visible = "0";
               text = "Passenger";
            };
            new GuiBitmapCtrl(vPassenger2Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "58 29";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
               wrap = "0";
            };
            new GuiBitmapCtrl(vPassenger2Slote)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "58 29";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot.png";
               wrap = "0";
            };
            new GuiTextCtrl(vPassengerName2Slot)
            {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "14 23";
               extent = "70 19";
               minExtent = "8 8";
               visible = "0";
               text = "Passenger";
            };
            new GuiBitmapCtrl(vPassenger3Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "58 50";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
               wrap = "0";
            };
            new GuiBitmapCtrl(vPassenger3Slote)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "58 50";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot.png";
               wrap = "0";
            };
            new GuiTextCtrl(vPassengerName3Slot)
            {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "14 42";
               extent = "70 19";
               minExtent = "8 8";
               visible = "0";
               text = "Passenger";
            };
            new GuiBitmapCtrl(vPassenger4Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "100 50";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
               wrap = "0";
            };
            new GuiBitmapCtrl(vPassenger4Slote)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "100 50";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot.png";
               wrap = "0";
            };
            new GuiTextCtrl(vPassengerName4Slot)
            {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "85 42";
               extent = "70 19";
               minExtent = "8 8";
               visible = "0";
               text = "Passenger";
            };
            new GuiBitmapCtrl(vPassenger5Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "100 29";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
               wrap = "0";
            };
            new GuiBitmapCtrl(vPassenger5Slote)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "100 29";
               extent = "10 10";
               minExtent = "3 3";
               visible = "0";
               setFirstResponder = "0";
               modal = "1";
               bitmap = "gui/hud_veh_seatdot.png";
               wrap = "0";
            };
            new GuiTextCtrl(vPassengerName5Slot)
            {
               profile = "GuiDashTextProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "85 23";
               extent = "70 19";
               minExtent = "8 8";
               visible = "0";
               text = "Passenger";
            };
         };
         vOverheadHud.add(vOverheadHud.passengerHud);

      case "Assault" :
         if(%MountPoint == 1)
         {
            // turreteer hud
            dashboardHud.tHud = new GuiControl(turreteerHud) {
               profile = "GuiDefaultProfile";
               horizSizing = "center";
               vertSizing = "top";
               position = "225 70";
               extent = "240 50";
               minExtent = "8 8";
               visible = "1";

               new HudBitmapCtrl(vWeap1Hilite) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "10 11";
                  extent = "80 44";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_veh_new_hilite_left.png";
                  opacity = "0.4";
               };
               new HudBitmapCtrl(vWeap2Hilite) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "bottom";
                  position = "103 11";
                  extent = "80 44";
                  minExtent = "8 8";
                  visible = "0";
                  bitmap = "gui/hud_veh_new_hilite_right.png";
                  opacity = "0.4";
               };

               new HudBitmapCtrl(turreteerFrame) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "center";
                  vertSizing = "bottom";
                  position = "20 8";
                  extent = "152 36";
                  minExtent = "8 8";
                  visible = "1";
                  bitmap = "gui/hud_veh_new_tankgunner_dash.png";
                  opacity = "0.8";

                  new HudBitmapCtrl(vWeaponOne) {
                     profile = "GuiDashBoxProfile";
                     horizSizing = "right";
                     vertSizing = "bottom";
                     position = "25 8";
                     extent = "25 25";
                     minExtent = "8 8";
                     visible = "1";
                     bitmap = "gui/hud_chaingun.png";
                  };

                  new HudBitmapCtrl(vWeaponTwo) {
                     profile = "GuiDashBoxProfile";
                     horizSizing = "right";
                     vertSizing = "bottom";
                     position = "99 8";
                     extent = "25 25";
                     minExtent = "8 8";
                     visible = "1";
                     bitmap = "gui/hud_mortor.png";
                  };
               };
            };
            dashboardHud.add(dashboardHud.tHud);

            $numVWeapons = 2;
            // add tank chaingun reticle
            reticleHud.setBitmap("gui/hud_ret_tankchaingun.png");
            reticleFrameHud.setVisible(false);
         }
         else
         {
            // node 0 == driver
            vOverheadHud.setBitmap("gui/hud_veh_icon_assault.png");
            // passenger slot "dots"
            vOverheadHud.passengerHud = new GuiControl(vPassengerHud) {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "0 0";
               extent = "127 114";
               minExtent = "8 8";
               visible = "1";

               new GuiBitmapCtrl(vPassenger0Slot) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "64 30";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot2.png";
               };
               new GuiBitmapCtrl(vPassenger0Slote) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "64 30";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot.png";
               };
               new GuiTextCtrl(vPassengerName0Slot)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "18 25";
                  extent = "107 19";
                  minExtent = "8 8";
                  visible = "0";
                  text = "Passenger";
               };
               new GuiBitmapCtrl(vPassenger1Slot) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "53 53";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot2.png";
               };
               new GuiBitmapCtrl(vPassenger1Slote) {
                  profile = "GuiDashBoxProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "53 53";
                  extent = "10 10";
                  minExtent = "3 3";
                  visible = "0";
                  bitmap = "gui/hud_veh_seatdot.png";
               };
               new GuiTextCtrl(vPassengerName1Slot)
               {
                  profile = "GuiDashTextProfile";
                  horizSizing = "right";
                  vertSizing = "top";
                  position = "6 48";
                  extent = "107 19";
                  minExtent = "8 8";
                  visible = "0";
                  text = "Passenger";
               };
            };
            vOverheadHud.add(vOverheadHud.passengerHud);
         }

      case "Hoverbike" :
         vOverheadHud.setBitmap("gui/hud_veh_icon_hoverbike.png");

         vOverheadHud.passengerHud = new GuiControl(vPassengerHud)
         {
            profile = "GuiDashBoxProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "0 0";
            extent = "127 114";
            minExtent = "8 8";
            visible = "1";

            new GuiBitmapCtrl(vPassenger0Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "59 65";
               extent = "10 10";
               minExtent = "3 3";
               visible = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
            };
         };
         vOverheadHud.add(vOverheadHud.passengerHud);

      case "MPB" :
         vOverheadHud.setBitmap("gui/hud_veh_icon_mpb.png");

         vOverheadHud.passengerHud = new GuiControl(vPassengerHud)
         {
            profile = "GuiDashBoxProfile";
            horizSizing = "right";
            vertSizing = "top";
            position = "0 0";
            extent = "127 114";
            minExtent = "8 8";
            visible = "1";

            new GuiBitmapCtrl(vPassenger0Slot)
            {
               profile = "GuiDashBoxProfile";
               horizSizing = "right";
               vertSizing = "top";
               position = "59 20";
               extent = "10 10";
               minExtent = "3 3";
               visible = "1";
               bitmap = "gui/hud_veh_seatdot2.png";
            };
         };
         vOverheadHud.add(vOverheadHud.passengerHud);

   }
   if(%MountPoint == 0)
      vDiagramHud.setVisible(true);
   else
      if(isObject(vDiagramHud))
         vDiagramHud.setVisible(false);
}

//------------------------------------------------------------------------------
function InventoryScreen::addLine( %this, %tag, %lineNum, %type, %count )
{
   $Hud[%tag].count = %count;

   // Add label:
   %yOffset = ( %lineNum * 26 ) + 28;
   $Hud[%tag].data[%lineNum, 0] = new GuiTextCtrl() 
   {
      profile = "ShellTextRightProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "228 " @ %yOffset;
      extent = "80 22";
      minExtent = "8 8";
      visible = "1";
      setFirstResponder = "0";
      modal = "1";
      helpTag = "0";
      text = "";
   };

   // Add drop menu:
   $Hud[%tag].data[%lineNum, 1] = new ShellPopupMenu(INV_Menu) 
   {
      profile = "ShellPopupProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "305 " @ %yOffset - 9;
      extent = "180 36";
      minExtent = "8 8";
      visible = "1";
      setFirstResponder = "0";
      modal = "1";
      helpTag = "0";
      maxPopupHeight = "200";
      text = "";
      type = %type;
   };

   return 2;
}

// This function writes the name of the player on the HUD for vehicles
function clientCmdCheckPassengers(%PassengerString)
{
   %MountPoints = getWord(%PassengerString, 0) * 2;

   echo(%PassengerString);

   %i = 0;
   while (%i < %MountPoints)
   {
      %Passenger = "vPassenger" @ %i @ "Slot";
      %PassengerName = "vPassengerName" @ %i @ "Slot";
      %EnemyPassenger = "vPassenger" @ %i @ "Slote";

      if (isObject(%Passenger))
      {
         %Word = getWord(%PassengerString, (2 * %i) + 1);
         if (%Word $= "1")
         {
            // If friendly use green box / Black Text
            %Passenger.setVisible(true);
            %PassengerName.setText(getWord(%PassengerString, (2 * %i) + 2));
            %PassengerName.setVisible(true);
            %EnemyPassenger.setVisible(false);

         } else {
            if (%Word $= "2")
            {
               // If enemy use red box / text
               %Passenger.setVisible(false);
               %PassengerName.setText(getWord(%PassengerString, (2 * %i) + 2));
               %PassengerName.setVisible(true);
               %EnemyPassenger.setVisible(true);
            } else {
               // Else write nothing
               %Passenger.setVisible(false);
               %PassengerName.setVisible(false);
               %EnemyPassenger.setVisible(false);
            }
         }
      }

      %i++;
   }
}

// This is used when you are a gunner, if you are a bombadier the bomb type replaces
// weapon # selection
function clientCmdSetWeaponryVehicleKeys(%Bomber)
{
   %bind = moveMap.getBinding( nextWeapon );
   passengerKeys.bind( getField( %bind, 0 ), getField( %bind, 1 ), nextVehicleWeapon );

   %bind = moveMap.getBinding( prevWeapon );
   passengerKeys.bind( getField( %bind, 0 ), getField( %bind, 1 ), prevVehicleWeapon );

   %bind = moveMap.getBinding( cycleWeaponAxis );
   passengerKeys.bind( getField( %bind, 0 ), getField( %bind, 1 ), cycleVehicleWeapon );

   %bind = moveMap.getBinding( cycleNextWeaponOnly );
   passengerKeys.bind( getField( %bind, 0 ), getField( %bind, 1 ), cycleNextVehicleWeaponOnly );

   if (%Bomber == true)
   {
      passengerKeys.bind(keyboard, 1, useBombOne);
      passengerKeys.bind(keyboard, 2, useBombTwo);
      passengerKeys.bind(keyboard, 3, useBombThree);
      passengerKeys.bind(keyboard, 4, useBombFour);
      passengerKeys.bind(keyboard, 5, useBombFive);
      passengerKeys.bind(keyboard, 6, useBombSix);
   } else {
      passengerKeys.bind(keyboard, 1, useWeaponOne);
      passengerKeys.bind(keyboard, 2, useWeaponTwo);
      passengerKeys.bind(keyboard, 3, useWeaponThree);
   }
}

// This is used when you are a pilot, it defines what keys you can use
function clientCmdSetPilotVehicleKeys()
{
   passengerKeys.copyBind( moveMap, toggleFirstPerson );
   passengerKeys.copyBind( moveMap, toggleFreeLook );
   passengerKeys.copyBind( moveMap, mouseJet );

   passengerKeys.bind(keyboard, 2, ejectPassenger2);
   passengerKeys.bind(keyboard, 3, ejectPassenger3);
   passengerKeys.bind(keyboard, 4, ejectPassenger4);
   passengerKeys.bind(keyboard, 5, ejectPassenger5);
   passengerKeys.bind(keyboard, 6, ejectPassenger6);
   passengerKeys.bind(keyboard, 0, ejectPassengerAll);

   // Use the InvertVehicleYAxis pref:
   if ( $pref::Vehicle::InvertYAxis )
   {
      %bind = moveMap.getBinding( pitch );
      %device = getField( %bind, 0 );
      %action = getField( %bind, 1 );
      %flags = moveMap.isInverted( %device, %action ) ? "SD" : "SDI";
      %deadZone = moveMap.getDeadZone( %device, %action );
      %scale = moveMap.getScale( %device, %action );
      passengerKeys.bind( %device, %action, %flags, %deadZone, %scale, pitch );
   }
}

// Ask the switch you to Bomb Type 1
function useBombOne(%val)
{
   if(%val)
      commandToServer('setVehicleBomb', 1);
}

// Ask the switch you to Bomb Type 2
function useBombTwo(%val)
{
   if(%val)
      commandToServer('setVehicleBomb', 2);
}

// Ask the switch you to Bomb Type 3
function useBombThree(%val)
{
   if(%val)
      commandToServer('setVehicleBomb', 3);
}

// Ask the switch you to Bomb Type 4
function useBombFour(%val)
{
   if(%val)
      commandToServer('setVehicleBomb', 4);
}

// Ask the switch you to Bomb Type 5
function useBombFive(%val)
{
   if(%val)
      commandToServer('SetVehicleBomb', 5);
}

// Ask the switch you to Bomb Type 6
function useBombSix(%val)
{
   if(%val)
      commandToServer('setVehicleBomb', 6);
}

// Ask the server to Eject mountpoint 2
function ejectPassenger2(%val)
{
   if(%val)
      commandToServer('EjectPassenger', 2);
}

// Ask the server to Eject mountpoint 3
function ejectPassenger3(%val)
{
   if(%val)
      commandToServer('EjectPassenger', 3);
}

// Ask the server to Eject mountpoint 4
function ejectPassenger4(%val)
{
   if(%val)
      commandToServer('EjectPassenger', 4);
}

// Ask the server to Eject mountpoint 5
function ejectPassenger5(%val)
{
   if(%val)
      commandToServer('EjectPassenger', 5);
}

// Ask the server to Eject mountpoint 6
function ejectPassenger6(%val)
{
   if(%val)
      commandToServer('EjectPassenger', 6);
}

// Ask the server to Eject everyone
function ejectPassengerAll(%val)
{
   if(%val)
   {
      commandToServer('EjectPassenger', 1);
      commandToServer('EjectPassenger', 2);
      commandToServer('EjectPassenger', 3);
      commandToServer('EjectPassenger', 4);
      commandToServer('EjectPassenger', 5);
      commandToServer('EjectPassenger', 6);
   }
}
