示例#1
0
        public static CellStruct From3DCellsTo2DLeptons(CellStruct XY)
        {
            var p3 = From3DCellsTo3DLeptons(XY);

            var dx = -60 * p3.Y / 2 + 60 * p3.X / 2;
            var dy = 30 * p3.Y / 2 + 30 * p3.X / 2;

            return(new CellStruct(dx, dy));
        }
示例#2
0
        internal CellClass GetCellAt(CellStruct xy)
        {
            if (xy.X < 0 || xy.X > 511 || xy.Y < 0 || xy.Y > 511)
            {
                throw new IndexOutOfRangeException();
            }
            var idxCell = xy.X + (xy.Y << 9);

            return(Cells[idxCell]);
        }
示例#3
0
        public static CellStruct Position2DCellsTL(CellStruct XY)
        {
            var p2 = From3DCellsTo2DCells(XY);

            var w2 = FileFormats.Binary.TMP.TileWidth / 2;
            var h2 = FileFormats.Binary.TMP.TileHeight / 2;

            var x = p2.X - w2;
            var y = p2.Y - h2;

            return(new CellStruct(x, y));
        }
示例#4
0
        internal bool DrawSubTile(int IsoTileTypeSubIndex, Helpers.ZBufferedTexture tex, CellStruct TopLeft, int CellLevel, bool highlight = false)
        {
            var t = getSubTile(IsoTileTypeSubIndex);

            var clipped = tex.CopyTexture(t.GetTextureStandalone(isoPAL), new CellStruct(TopLeft.X + t.Bounds.X, TopLeft.Y + t.Bounds.Y), CellLevel * 30, false);

            if (highlight)
            {
                t.Highlight(tex, TopLeft);
            }

            return(clipped);
        }
示例#5
0
 public CellStruct Position2DOnScreen(CellStruct XY)
 {
     XY.X -= ScreenBounds.Left;
     XY.Y -= ScreenBounds.Top;
     return XY;
 }
示例#6
0
        public static CellStruct Position2DCellsTL(CellStruct XY)
        {
            var p2 = From3DCellsTo2DCells(XY);

            var w2 = FileFormats.Binary.TMP.TileWidth / 2;
            var h2 = FileFormats.Binary.TMP.TileHeight / 2;

            var x = p2.X - w2;
            var y = p2.Y - h2;

            return new CellStruct(x, y);
        }
示例#7
0
 public static CoordStruct From3DCellsTo3DLeptons(CellStruct XY)
 {
     return new CoordStruct((XY.X << 8) + 128, (XY.Y << 8) + 128, 0);
 }
示例#8
0
        public static CellStruct From3DCellsTo2DLeptons(CellStruct XY)
        {
            var p3 = From3DCellsTo3DLeptons(XY);

            var dx = -60 * p3.Y / 2 + 60 * p3.X / 2;
            var dy = 30 * p3.Y / 2 + 30 * p3.X / 2;

            return new CellStruct(dx, dy);
        }
示例#9
0
 public static CellStruct From3DCellsTo2DCells(CellStruct XY)
 {
     var pl = From3DCellsTo2DLeptons(XY);
     return new CellStruct(pl.X / 256, pl.Y / 256);
 }
示例#10
0
 internal CellClass GetCellAt(CellStruct xy)
 {
     if (xy.X < 0 || xy.X > 511 || xy.Y < 0 || xy.Y > 511) {
         throw new IndexOutOfRangeException();
     }
     var idxCell = xy.X + (xy.Y << 9);
     return Cells[idxCell];
 }
示例#11
0
        internal bool DrawSubTile(int IsoTileTypeSubIndex, Helpers.ZBufferedTexture tex, CellStruct TopLeft, int CellLevel, bool highlight = false)
        {
            var t = getSubTile(IsoTileTypeSubIndex);

            var clipped = tex.CopyTexture(t.GetTextureStandalone(isoPAL), new CellStruct(TopLeft.X + t.Bounds.X, TopLeft.Y + t.Bounds.Y), CellLevel * 30, false);

            if (highlight) {
                t.Highlight(tex, TopLeft);
            }

            return clipped;
        }
示例#12
0
 public CellStruct Position2DOnScreen(CellStruct XY)
 {
     XY.X -= ScreenBounds.Left;
     XY.Y -= ScreenBounds.Top;
     return(XY);
 }
示例#13
0
        public static CellStruct From3DCellsTo2DCells(CellStruct XY)
        {
            var pl = From3DCellsTo2DLeptons(XY);

            return(new CellStruct(pl.X / 256, pl.Y / 256));
        }
示例#14
0
 public static CoordStruct From3DCellsTo3DLeptons(CellStruct XY)
 {
     return(new CoordStruct((XY.X << 8) + 128, (XY.Y << 8) + 128, 0));
 }