Пример #1
0
        /// <summary>
        /// Make a new point (only if it is not already there)
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        private void makePoint(int X, int Y)
        {
            SFX.YATT.Tools.Vector <float> coor = findAreaCoor(X, Y, areaViewer.Area);

            if (coor != null)
            {
                Pair <double, double> p = new Pair <double, double>(coor[0], coor[1]);
                Point id = new Point((int)Math.Floor(coor[0]), (int)Math.Floor(coor[1]));
                if (!pointsAlready.ContainsKey(id))
                {
                    pointsAlready[id] = "1";

                    // Get the current area
                    NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer   = getAreaViewer();
                    NWN2Toolset.NWN2ToolsetMainForm       mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
                    NWN2GameArea area = viewer.Area;

                    // Make waypoint
                    NWN2Toolset.NWN2.Data.Instances.NWN2WaypointInstance wayPoint = new NWN2Toolset.NWN2.Data.Instances.NWN2WaypointInstance();
                    wayPoint.Tag      = WAYPOINT_TAG;
                    wayPoint.Position = new Vector3(coor[0], coor[1], coor[2]);
                    area.AddInstance(wayPoint);

                    debugOut("Point: " + p + " added");
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Paint a line given the 2 points
        /// </summary>
        /// <param name="points"></param>
        private void makeLine(LinkedList <Pair <double, double> > points)
        {
            NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer   = getAreaViewer();
            NWN2Toolset.NWN2ToolsetMainForm       mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
            NWN2GameArea area = viewer.Area;

            TRN trn = new SFX.YATT.DAL.TRN(new System.IO.BinaryReader(area.TerrainResource.GetStream(false)), area.Name);

            Pair <Pair <double, double>, Pair <double, double> > resultPair = findUpperAndLower(points);

            Pair <double, double> upper = resultPair.X;
            Pair <double, double> lower = resultPair.Y;

            trn = ApplyLine(area, trn, upper, lower);

            System.IO.Stream       stream = area.TerrainResource.GetStream(true);
            System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream);

            trn.Save(writer);
            stream.Flush();
            stream.Close();
            areaViewer.SaveContents(true, OEIShared.UI.OEIMessageBoxResult.OK);
            mainForm.WaitForPanelsToSave();

            mainForm.CloseViewer(areaViewer, true);
        }
Пример #3
0
        private void paintTriangles(LinkedList <Triangle> triangles)
        {
            NWN2Toolset.NWN2.Views.NWN2AreaViewer viewer = getAreaViewer();
            if (viewer != null)
            {
                NWN2Toolset.NWN2ToolsetMainForm mainForm = NWN2Toolset.NWN2ToolsetMainForm.App;
                NWN2GameArea area = viewer.Area;
                TRN          trn  = new SFX.YATT.DAL.TRN(new System.IO.BinaryReader(area.TerrainResource.GetStream(false)), area.Name);

                // The random object we are going to use for all the instances
                Random ran = new Random();

                area.Demand();
                area.RefreshTerrainResource();

                System.IO.Stream       stream = area.TerrainResource.GetStream(true);
                System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream);

                foreach (Triangle triangle in triangles)
                {
                    trn = ApplyTriangle(area, trn, triangle, triangle.getUpper(), triangle.getLower(), ran);
                }

                trn.Save(writer);
                stream.Flush();
                stream.Close();

                viewer.SaveContents(true, OEIShared.UI.OEIMessageBoxResult.OK);

                mainForm.WaitForPanelsToSave();
                mainForm.CloseViewer(viewer, true);
            }
        }
Пример #4
0
        private NWN2AreaViewer getAreaViewer()
        {
            if (toolset == null)
            {
                toolset = NWN2Toolset.NWN2ToolsetMainForm.App;
            }

            if (module == null)
            {
                module = toolset.Module;
            }

            return((NWN2Toolset.NWN2.Views.NWN2AreaViewer)toolset.GetActiveViewer());
        }
Пример #5
0
        private NWN2AreaViewer getAreaViewer()
        {
            if (toolset == null)
                toolset = NWN2Toolset.NWN2ToolsetMainForm.App;

            if (module == null)
                module = toolset.Module;

            return (NWN2Toolset.NWN2.Views.NWN2AreaViewer)toolset.GetActiveViewer();
        }