Exemple #1
0
 public clsViewInfo(clsMap Map, ctrlMapView MapView)
 {
     this.Map = Map;
     this.MapView = MapView;
     this.ViewPos = new modMath.sXYZ_int(0, 0xc00, 0);
     this.FOV_Multiplier_Set(modSettings.Settings.FOVDefault);
     this.ViewAngleSetToDefault();
     modMath.sXY_int horizontal = new modMath.sXY_int((int) Math.Round((double) (((double) (Map.Terrain.TileSize.X * 0x80)) / 2.0)), (int) Math.Round((double) (((double) (Map.Terrain.TileSize.Y * 0x80)) / 2.0)));
     this.LookAtPos(horizontal);
 }
Exemple #2
0
 public void TimedActions(double Zoom, double Move, double Pan, double Roll, double OrbitRate)
 {
     Angles.AnglePY epy;
     modMath.sXYZ_int _int;
     Position.XYZ_dbl _dbl2;
     double scale = Pan * this.FieldOfViewY;
     Matrix3DMath.Matrix3D matrix = new Matrix3DMath.Matrix3D();
     Matrix3DMath.Matrix3D resultMatrix = new Matrix3DMath.Matrix3D();
     Move *= (this.FOVMultiplier * (this.MapView.GLSize.X + this.MapView.GLSize.Y)) * Math.Max((double) Math.Abs(this.ViewPos.Y), 512.0);
     if (modControls.KeyboardProfile.Active(modControls.Control_View_Zoom_In))
     {
         this.FOV_Scale_2E_Change(-Zoom);
     }
     if (modControls.KeyboardProfile.Active(modControls.Control_View_Zoom_Out))
     {
         this.FOV_Scale_2E_Change(Zoom);
     }
     if (modProgram.ViewMoveType == modProgram.enumView_Move_Type.Free)
     {
         Position.XYZ_dbl _dbl;
         _int.X = 0;
         _int.Y = 0;
         _int.Z = 0;
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Forward))
         {
             Matrix3DMath.VectorForwardsRotationByMatrix(this.ViewAngleMatrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Backward))
         {
             Matrix3DMath.VectorBackwardsRotationByMatrix(this.ViewAngleMatrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Left))
         {
             Matrix3DMath.VectorLeftRotationByMatrix(this.ViewAngleMatrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Right))
         {
             Matrix3DMath.VectorRightRotationByMatrix(this.ViewAngleMatrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Up))
         {
             Matrix3DMath.VectorUpRotationByMatrix(this.ViewAngleMatrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Down))
         {
             Matrix3DMath.VectorDownRotationByMatrix(this.ViewAngleMatrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         _dbl.X = 0.0;
         _dbl.Y = 0.0;
         _dbl.Z = 0.0;
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Left))
         {
             Matrix3DMath.VectorForwardsRotationByMatrix(this.ViewAngleMatrix, Roll, ref _dbl2);
             _dbl += _dbl2;
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Right))
         {
             Matrix3DMath.VectorBackwardsRotationByMatrix(this.ViewAngleMatrix, Roll, ref _dbl2);
             _dbl += _dbl2;
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Backward))
         {
             Matrix3DMath.VectorLeftRotationByMatrix(this.ViewAngleMatrix, scale, ref _dbl2);
             _dbl += _dbl2;
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Forward))
         {
             Matrix3DMath.VectorRightRotationByMatrix(this.ViewAngleMatrix, scale, ref _dbl2);
             _dbl += _dbl2;
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Roll_Left))
         {
             Matrix3DMath.VectorDownRotationByMatrix(this.ViewAngleMatrix, scale, ref _dbl2);
             _dbl += _dbl2;
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Roll_Right))
         {
             Matrix3DMath.VectorUpRotationByMatrix(this.ViewAngleMatrix, scale, ref _dbl2);
             _dbl += _dbl2;
         }
         if (((_int.X != 0.0) | (_int.Y != 0.0)) | (_int.Z != 0.0))
         {
             this.ViewPosChange(_int);
         }
         if ((!(_dbl.X == 0.0) | !(_dbl.Y == 0.0)) | !(_dbl.Z == 0.0))
         {
             Matrix3DMath.VectorToPY(_dbl, ref epy);
             Matrix3DMath.MatrixSetToPY(matrix, epy);
             Matrix3DMath.MatrixRotationAroundAxis(this.ViewAngleMatrix, matrix, _dbl.GetMagnitude(), resultMatrix);
             this.ViewAngleSet_Rotate(resultMatrix);
         }
     }
     else if (modProgram.ViewMoveType == modProgram.enumView_Move_Type.RTS)
     {
         _int = new modMath.sXYZ_int();
         Matrix3DMath.MatrixToPY(this.ViewAngleMatrix, ref epy);
         Matrix3DMath.MatrixSetToYAngle(matrix, epy.Yaw);
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Forward))
         {
             Matrix3DMath.VectorForwardsRotationByMatrix(matrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Backward))
         {
             Matrix3DMath.VectorBackwardsRotationByMatrix(matrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Left))
         {
             Matrix3DMath.VectorLeftRotationByMatrix(matrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Right))
         {
             Matrix3DMath.VectorRightRotationByMatrix(matrix, Move, ref _dbl2);
             _int.Add_dbl(_dbl2);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Up))
         {
             _int.Y += (int) Math.Round(Move);
         }
         if (modControls.KeyboardProfile.Active(modControls.Control_View_Move_Down))
         {
             _int.Y -= (int) Math.Round(Move);
         }
         bool flag = false;
         if (modProgram.RTSOrbit)
         {
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Forward))
             {
                 epy.Pitch = modMath.Clamp_dbl(epy.Pitch + OrbitRate, -1.5702509114036483, 1.5702509114036483);
                 flag = true;
             }
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Backward))
             {
                 epy.Pitch = modMath.Clamp_dbl(epy.Pitch - OrbitRate, -1.5702509114036483, 1.5702509114036483);
                 flag = true;
             }
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Left))
             {
                 epy.Yaw = modMath.AngleClamp(epy.Yaw + OrbitRate);
                 flag = true;
             }
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Right))
             {
                 epy.Yaw = modMath.AngleClamp(epy.Yaw - OrbitRate);
                 flag = true;
             }
         }
         else
         {
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Forward))
             {
                 epy.Pitch = modMath.Clamp_dbl(epy.Pitch - OrbitRate, -1.5702509114036483, 1.5702509114036483);
                 flag = true;
             }
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Backward))
             {
                 epy.Pitch = modMath.Clamp_dbl(epy.Pitch + OrbitRate, -1.5702509114036483, 1.5702509114036483);
                 flag = true;
             }
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Left))
             {
                 epy.Yaw = modMath.AngleClamp(epy.Yaw - OrbitRate);
                 flag = true;
             }
             if (modControls.KeyboardProfile.Active(modControls.Control_View_Right))
             {
                 epy.Yaw = modMath.AngleClamp(epy.Yaw + OrbitRate);
                 flag = true;
             }
         }
         if (((_int.X != 0.0) | (_int.Y != 0.0)) | (_int.Z != 0.0))
         {
             this.ViewPosChange(_int);
         }
         if (flag)
         {
             Matrix3DMath.MatrixSetToPY(matrix, epy);
             this.ViewAngleSet_Rotate(matrix);
         }
     }
 }
Exemple #3
0
 public void ViewPosSet(modMath.sXYZ_int NewViewPos)
 {
     this.ViewPos = NewViewPos;
     this.ViewPosClamp();
     this.MapView.DrawViewLater();
 }
Exemple #4
0
 public sXYZ_int(int X, int Y, int Z)
 {
     this = new modMath.sXYZ_int();
     this.X = X;
     this.Y = Y;
     this.Z = Z;
 }