Ejemplo n.º 1
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem addMoreTrisItem = new ToolStripMenuItem("Add More Tris");
                addMoreTrisItem.Click += (sender, e) =>
                {
                    string      text           = DialogUtilities.GetStringFromDialog(labelText: "Enter triangle addresses as hex uints.");
                    List <uint> triAddressList = MapUtilities.ParseCustomTris(text, TriangleClassification.Wall);
                    if (triAddressList == null)
                    {
                        return;
                    }
                    _triList.AddRange(triAddressList.ConvertAll(address => TriangleDataModel.CreateLazy(address)));
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(addMoreTrisItem);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetWallToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetTriangleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Ejemplo n.º 2
0
        private static TriangleDataModel FindCeilingFromList(short shortX, short shortY, short shortZ, int cellX, int cellZ, bool isStaticParition)
        {
            uint partitionAddress = isStaticParition ? TriangleConfig.StaticTrianglePartitionAddress : TriangleConfig.DynamicTrianglePartitionAddress;
            int  type             = 1; // ceiling

            int  typeSize = 2 * 4;
            int  xSize    = 3 * typeSize;
            int  zSize    = 16 * xSize;
            uint address  = (uint)(partitionAddress + cellZ * zSize + cellX * xSize + type * typeSize);

            address = Config.Stream.GetUInt(address);

            while (address != 0)
            {
                uint triAddress           = Config.Stream.GetUInt(address + 4);
                TriangleDataModel tri     = TriangleDataModel.CreateLazy(triAddress);
                bool isLegitimateTriangle = tri.NormX != 0 || tri.NormY != 0 || tri.NormZ != 0;
                if (isLegitimateTriangle && tri.IsPointInsideAndBelowTriangle(shortX, shortY, shortZ))
                {
                    return(tri);
                }
                address = Config.Stream.GetUInt(address);
            }

            return(null);
        }
Ejemplo n.º 3
0
 private void UpdateBasedOnCoordinates()
 {
     foreach (uint triangleAddress in TriangleAddresses)
     {
         TriangleDataModel tri = TriangleDataModel.CreateLazy(triangleAddress);
         UpdateBasedOnCoordinates(triangleAddress, tri.X1, tri.Y1, tri.Z1, tri.X2, tri.Y2, tri.Z2, tri.X3, tri.Y3, tri.Z3);
     }
 }
Ejemplo n.º 4
0
        public static MapObjectLevelWall Create(string text)
        {
            List <uint> triAddressList = MapUtilities.ParseCustomTris(text, null);

            if (triAddressList == null)
            {
                return(null);
            }
            List <TriangleDataModel> triList = triAddressList.ConvertAll(address => TriangleDataModel.CreateLazy(address));

            return(new MapObjectLevelWall(triList));
        }
Ejemplo n.º 5
0
 public MapObjectCustomWall(List <uint> triAddressList)
     : base()
 {
     _triList = triAddressList.ConvertAll(address => TriangleDataModel.CreateLazy(address));
 }
Ejemplo n.º 6
0
 public static List <TriangleDataModel> GetTrianglesInRange(uint startAddress, int numTriangles)
 {
     return(GetTriangleAddressesInRange(startAddress, numTriangles)
            .ConvertAll(triAddress => TriangleDataModel.CreateLazy(triAddress)));
 }
Ejemplo n.º 7
0
 public static List <TriangleDataModel> GetTriangles(List <uint> triAddresses)
 {
     return(triAddresses.FindAll(triAddress => triAddress != 0)
            .ConvertAll(triAddress => TriangleDataModel.CreateLazy(triAddress)));
 }