Beispiel #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));
        }
Beispiel #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]);
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #5
0
 public CellStruct Position2DOnScreen(CellStruct XY)
 {
     XY.X -= ScreenBounds.Left;
     XY.Y -= ScreenBounds.Top;
     return XY;
 }
Beispiel #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);
        }
Beispiel #7
0
 public static CoordStruct From3DCellsTo3DLeptons(CellStruct XY)
 {
     return new CoordStruct((XY.X << 8) + 128, (XY.Y << 8) + 128, 0);
 }
Beispiel #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);
        }
Beispiel #9
0
 public static CellStruct From3DCellsTo2DCells(CellStruct XY)
 {
     var pl = From3DCellsTo2DLeptons(XY);
     return new CellStruct(pl.X / 256, pl.Y / 256);
 }
Beispiel #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];
 }
Beispiel #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;
        }
Beispiel #12
0
 public CellStruct Position2DOnScreen(CellStruct XY)
 {
     XY.X -= ScreenBounds.Left;
     XY.Y -= ScreenBounds.Top;
     return(XY);
 }
Beispiel #13
0
        public static CellStruct From3DCellsTo2DCells(CellStruct XY)
        {
            var pl = From3DCellsTo2DLeptons(XY);

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