Пример #1
0
 public XYInt GetPosNum(sPosNum posNum)
 {
     if (alignment)
     {
         return(posNum.Alignment);
     }
     return(posNum.Normal);
 }
Пример #2
0
 public XYInt GetPosNum(sPosNum PosNum)
 {
     if (_Alignment)
     {
         return(PosNum.Alignment);
     }
     else
     {
         return(PosNum.Normal);
     }
 }
Пример #3
0
 public void PerformActionMapTiles(clsAction tool, sPosNum centre)
 {
     PerformAction(tool, centre, new XYInt(tool.Map.Terrain.TileSize.X - 1, tool.Map.Terrain.TileSize.Y - 1));
 }
Пример #4
0
 public void PerformActionMapVertices(clsAction tool, sPosNum centre)
 {
     PerformAction(tool, centre, tool.Map.Terrain.TileSize);
 }
Пример #5
0
 public void PerformActionMapSectors(clsAction Tool, sPosNum Centre)
 {
     PerformAction(Tool, Centre, new XYInt(Tool.Map.SectorCount.X - 1, Tool.Map.SectorCount.Y - 1));
 }
Пример #6
0
        private void PerformAction(clsAction action, sPosNum posNum, XYInt lastValidNum)
        {
            var y = 0;

            if (action.Map == null)
            {
                Debugger.Break();
                return;
            }

            var centre = GetPosNum(posNum);

            action.Effect = 1.0D;
            for (y = MathUtil.ClampInt(Tiles.YMin + centre.Y, 0, lastValidNum.Y) - centre.Y;
                 y <= MathUtil.ClampInt(Tiles.YMax + centre.Y, 0, lastValidNum.Y) - centre.Y;
                 y++)
            {
                action.PosNum.Y = centre.Y + y;
                var xNum = y - Tiles.YMin;
                var x    = 0;
                for (x = MathUtil.ClampInt(Tiles.XMin[xNum] + centre.X, 0, lastValidNum.X) - centre.X;
                     x <= MathUtil.ClampInt(Convert.ToInt32(Tiles.XMax[xNum] + centre.X), 0, lastValidNum.X) - centre.X;
                     x++)
                {
                    action.PosNum.X = centre.X + x;
                    if (action.UseEffect)
                    {
                        if (Tiles.ResultRadius > 0.0D)
                        {
                            switch (shape)
                            {
                            case ShapeType.Circle:
                                if (alignment)
                                {
                                    action.Effect =
                                        Convert.ToDouble(1.0D -
                                                         (new XYDouble(action.PosNum.X, action.PosNum.Y) -
                                                          new XYDouble(centre.X - 0.5D, centre.Y - 0.5D)).GetMagnitude() /
                                                         (Tiles.ResultRadius + 0.5D));
                                }
                                else
                                {
                                    action.Effect = Convert.ToDouble(1.0D - (centre - action.PosNum).ToDoubles().GetMagnitude() / (Tiles.ResultRadius + 0.5D));
                                }
                                break;

                            case ShapeType.Square:
                                if (alignment)
                                {
                                    action.Effect = 1.0D -
                                                    Math.Max(Math.Abs(action.PosNum.X - (centre.X - 0.5D)), Math.Abs(action.PosNum.Y - (centre.Y - 0.5D))) /
                                                    (Tiles.ResultRadius + 0.5D);
                                }
                                else
                                {
                                    action.Effect = 1.0D -
                                                    Math.Max(Math.Abs(action.PosNum.X - centre.X), Math.Abs(action.PosNum.Y - centre.Y)) /
                                                    (Tiles.ResultRadius + 0.5D);
                                }
                                break;
                            }
                        }
                    }
                    action.ActionPerform();
                }
            }
        }
Пример #7
0
 public void PerformActionMapTiles(clsAction Tool, sPosNum Centre)
 {
     PerformAction(Tool, Centre, new XYInt(Tool.Map.Terrain.TileSize.X - 1, Tool.Map.Terrain.TileSize.Y - 1));
 }
Пример #8
0
 public void PerformActionMapVertices(clsAction Tool, sPosNum Centre)
 {
     PerformAction(Tool, Centre, Tool.Map.Terrain.TileSize);
 }
Пример #9
0
 private void PerformAction(clsMap.clsAction Action, sPosNum PosNum, modMath.sXY_int LastValidNum)
 {
     if (Action.Map == null)
     {
         Debugger.Break();
     }
     else
     {
         modMath.sXY_int posNum = this.GetPosNum(PosNum);
         Action.Effect = 1.0;
         int introduced11 = modMath.Clamp_int(this.Tiles.YMin + posNum.Y, 0, LastValidNum.Y);
         int introduced12 = modMath.Clamp_int(this.Tiles.YMax + posNum.Y, 0, LastValidNum.Y);
         int num4 = introduced12 - posNum.Y;
         for (int i = introduced11 - posNum.Y; i <= num4; i++)
         {
             Action.PosNum.Y = posNum.Y + i;
             int index = i - this.Tiles.YMin;
             int introduced13 = modMath.Clamp_int(this.Tiles.XMin[index] + posNum.X, 0, LastValidNum.X);
             int introduced14 = modMath.Clamp_int(this.Tiles.XMax[index] + posNum.X, 0, LastValidNum.X);
             int num5 = introduced14 - posNum.X;
             for (int j = introduced13 - posNum.X; j <= num5; j++)
             {
                 modMath.sXY_int _int2;
                 Action.PosNum.X = posNum.X + j;
                 if (Action.UseEffect && (this.Tiles.ResultRadius > 0.0))
                 {
                     switch (this._Shape)
                     {
                         case enumShape.Circle:
                         {
                             if (!this._Alignment)
                             {
                                 goto Label_01DD;
                             }
                             Position.XY_dbl _dbl = new Position.XY_dbl((double) Action.PosNum.X, (double) Action.PosNum.Y);
                             Position.XY_dbl _dbl2 = new Position.XY_dbl(posNum.X - 0.5, posNum.Y - 0.5);
                             Position.XY_dbl _dbl3 = _dbl - _dbl2;
                             Action.Effect = 1.0 - (_dbl3.GetMagnitude() / (this.Tiles.ResultRadius + 0.5));
                             break;
                         }
                         case enumShape.Square:
                         {
                             if (!this._Alignment)
                             {
                                 goto Label_02A3;
                             }
                             double introduced15 = Math.Abs((double) (Action.PosNum.X - (posNum.X - 0.5)));
                             Action.Effect = 1.0 - (Math.Max(introduced15, Math.Abs((double) (Action.PosNum.Y - (posNum.Y - 0.5)))) / (this.Tiles.ResultRadius + 0.5));
                             break;
                         }
                     }
                 }
                 goto Label_02FF;
             Label_01DD:
                 _int2 = posNum - Action.PosNum;
                 Action.Effect = 1.0 - (_int2.ToDoubles().GetMagnitude() / (this.Tiles.ResultRadius + 0.5));
                 goto Label_02FF;
             Label_02A3:
                 int introduced16 = Math.Abs((int) (Action.PosNum.X - posNum.X));
                 Action.Effect = 1.0 - (((double) Math.Max(introduced16, Math.Abs((int) (Action.PosNum.Y - posNum.Y)))) / (this.Tiles.ResultRadius + 0.5));
             Label_02FF:
                 Action.ActionPerform();
             }
         }
     }
 }
Пример #10
0
 public void PerformActionMapSectors(clsMap.clsAction Tool, sPosNum Centre)
 {
     modMath.sXY_int lastValidNum = new modMath.sXY_int(Tool.Map.SectorCount.X - 1, Tool.Map.SectorCount.Y - 1);
     this.PerformAction(Tool, Centre, lastValidNum);
 }
Пример #11
0
 public void PerformActionMapVertices(clsAction Tool, sPosNum Centre)
 {
     PerformAction(Tool, Centre, Tool.Map.Terrain.TileSize);
 }
Пример #12
0
        private void PerformAction(clsAction Action, sPosNum PosNum, XYInt LastValidNum)
        {
            int XNum = 0;
            int X = 0;
            int Y = 0;
            XYInt Centre = new XYInt(0, 0);

            if ( Action.Map == null )
            {
                Debugger.Break();
                return;
            }

            Centre = GetPosNum(PosNum);

            Action.Effect = 1.0D;
            for ( Y = MathUtil.Clamp_int(Tiles.YMin + Centre.Y, 0, LastValidNum.Y) - Centre.Y;
                Y <= MathUtil.Clamp_int(Tiles.YMax + Centre.Y, 0, LastValidNum.Y) - Centre.Y;
                Y++ )
            {
                Action.PosNum.Y = Centre.Y + Y;
                XNum = Y - Tiles.YMin;
                for ( X = MathUtil.Clamp_int(Tiles.XMin[XNum] + Centre.X, 0, LastValidNum.X) - Centre.X;
                    X <= MathUtil.Clamp_int(Convert.ToInt32(Tiles.XMax[XNum] + Centre.X), 0, LastValidNum.X) - Centre.X;
                    X++ )
                {
                    Action.PosNum.X = Centre.X + X;
                    if ( Action.UseEffect )
                    {
                        if ( Tiles.ResultRadius > 0.0D )
                        {
                            switch ( _Shape )
                            {
                                case enumShape.Circle:
                                    if ( _Alignment )
                                    {
                                        Action.Effect =
                                            Convert.ToDouble(1.0D -
                                                                    (new XYDouble(Action.PosNum.X, Action.PosNum.Y) -
                                                                     new XYDouble(Centre.X - 0.5D, Centre.Y - 0.5D)).GetMagnitude() /
                                                                    (Tiles.ResultRadius + 0.5D));
                                    }
                                    else
                                    {
                                        Action.Effect = Convert.ToDouble(1.0D - (Centre - Action.PosNum).ToDoubles().GetMagnitude() / (Tiles.ResultRadius + 0.5D));
                                    }
                                    break;
                                case enumShape.Square:
                                    if ( _Alignment )
                                    {
                                        Action.Effect = 1.0D -
                                                        Math.Max(Math.Abs(Action.PosNum.X - (Centre.X - 0.5D)), Math.Abs(Action.PosNum.Y - (Centre.Y - 0.5D))) /
                                                        (Tiles.ResultRadius + 0.5D);
                                    }
                                    else
                                    {
                                        Action.Effect = 1.0D -
                                                        Math.Max(Math.Abs(Action.PosNum.X - Centre.X), Math.Abs(Action.PosNum.Y - Centre.Y)) /
                                                        (Tiles.ResultRadius + 0.5D);
                                    }
                                    break;
                            }
                        }
                    }
                    Action.ActionPerform();
                }
            }
        }
Пример #13
0
 public void PerformActionMapTiles(clsAction Tool, sPosNum Centre)
 {
     PerformAction(Tool, Centre, new XYInt(Tool.Map.Terrain.TileSize.X - 1, Tool.Map.Terrain.TileSize.Y - 1));
 }
Пример #14
0
 public void PerformActionMapSectors(clsAction Tool, sPosNum Centre)
 {
     PerformAction(Tool, Centre, new XYInt(Tool.Map.SectorCount.X - 1, Tool.Map.SectorCount.Y - 1));
 }
Пример #15
0
 public XYInt GetPosNum(sPosNum PosNum)
 {
     if ( _Alignment )
     {
         return PosNum.Alignment;
     }
     else
     {
         return PosNum.Normal;
     }
 }
Пример #16
0
 public void PerformActionMapSectors(clsAction tool, sPosNum centre)
 {
     PerformAction(tool, centre, new XYInt(tool.Map.SectorCount.X - 1, tool.Map.SectorCount.Y - 1));
 }
Пример #17
0
        private void PerformAction(clsAction Action, sPosNum PosNum, XYInt LastValidNum)
        {
            int   XNum   = 0;
            int   X      = 0;
            int   Y      = 0;
            XYInt Centre = new XYInt(0, 0);

            if (Action.Map == null)
            {
                Debugger.Break();
                return;
            }

            Centre = GetPosNum(PosNum);

            Action.Effect = 1.0D;
            for (Y = MathUtil.Clamp_int(Tiles.YMin + Centre.Y, 0, LastValidNum.Y) - Centre.Y;
                 Y <= MathUtil.Clamp_int(Tiles.YMax + Centre.Y, 0, LastValidNum.Y) - Centre.Y;
                 Y++)
            {
                Action.PosNum.Y = Centre.Y + Y;
                XNum            = Y - Tiles.YMin;
                for (X = MathUtil.Clamp_int(Tiles.XMin[XNum] + Centre.X, 0, LastValidNum.X) - Centre.X;
                     X <= MathUtil.Clamp_int(Convert.ToInt32(Tiles.XMax[XNum] + Centre.X), 0, LastValidNum.X) - Centre.X;
                     X++)
                {
                    Action.PosNum.X = Centre.X + X;
                    if (Action.UseEffect)
                    {
                        if (Tiles.ResultRadius > 0.0D)
                        {
                            switch (_Shape)
                            {
                            case enumShape.Circle:
                                if (_Alignment)
                                {
                                    Action.Effect =
                                        Convert.ToDouble(1.0D -
                                                         (new XYDouble(Action.PosNum.X, Action.PosNum.Y) -
                                                          new XYDouble(Centre.X - 0.5D, Centre.Y - 0.5D)).GetMagnitude() /
                                                         (Tiles.ResultRadius + 0.5D));
                                }
                                else
                                {
                                    Action.Effect = Convert.ToDouble(1.0D - (Centre - Action.PosNum).ToDoubles().GetMagnitude() / (Tiles.ResultRadius + 0.5D));
                                }
                                break;

                            case enumShape.Square:
                                if (_Alignment)
                                {
                                    Action.Effect = 1.0D -
                                                    Math.Max(Math.Abs(Action.PosNum.X - (Centre.X - 0.5D)), Math.Abs(Action.PosNum.Y - (Centre.Y - 0.5D))) /
                                                    (Tiles.ResultRadius + 0.5D);
                                }
                                else
                                {
                                    Action.Effect = 1.0D -
                                                    Math.Max(Math.Abs(Action.PosNum.X - Centre.X), Math.Abs(Action.PosNum.Y - Centre.Y)) /
                                                    (Tiles.ResultRadius + 0.5D);
                                }
                                break;
                            }
                        }
                    }
                    Action.ActionPerform();
                }
            }
        }
Пример #18
0
 public void PerformActionMapTiles(clsMap.clsAction Tool, sPosNum Centre)
 {
     modMath.sXY_int lastValidNum = new modMath.sXY_int(Tool.Map.Terrain.TileSize.X - 1, Tool.Map.Terrain.TileSize.Y - 1);
     this.PerformAction(Tool, Centre, lastValidNum);
 }
Пример #19
0
 public modMath.sXY_int GetPosNum(sPosNum PosNum)
 {
     if (this._Alignment)
     {
         return PosNum.Alignment;
     }
     return PosNum.Normal;
 }