Exemplo n.º 1
0
        // draw
        public void RenderStarport()
        {
            if (starportMesh == null)
            {
                starportMesh = new MeshObject("\\starport.x");
            }

            if (OuterSpace.theWindowMgr.FindWindow("   ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CStarportWindow",
                                                       75, 0, 175, OuterSpace.ClientArea.Height, Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow("   "));
                    wndStarport = (CStarportWindow)(OuterSpace.theWindowMgr.GetWindow(OuterSpace.theWindowMgr.FindWindow("   ")));
                }
            }

            Mesh            moMesh       = starportMesh.GetMesh();
            List <Material> materialList = new List <Material>();
            List <Texture>  textureList  = new List <Texture>();

            HandleMouseInput();

            OuterSpace.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0F, 0);

            OuterSpace.d3d_scene.SetupLights();

            OuterSpace.thisPlanet.drawplanet();

            // render starport
            Direct3D.Cull oldCull = OuterSpace.device.RenderState.CullMode;

            OuterSpace.device.RenderState.CullMode = Cull.CounterClockwise;

            fYAngle += 0.001F;

            OuterSpace.d3d_scene.transformWorld(Matrix.Zero, Matrix.RotationY(fYAngle), Matrix.Zero,
                                                Matrix.Zero, Matrix.Translation(0.3F, 0.0F, -77.5F));

            OuterSpace.d3d_scene.transformView_Projection(new Vector3(0.0F, 0.1F, -80.0F), new Vector3(0.0F, 0.0F, 0.0F),
                                                          new Vector3(0.0F, 1.0F, 0.0F), Convert.ToSingle(Math.PI / 4), Convert.ToSingle(OuterSpace.ClientArea.Width / OuterSpace.ClientArea.Height),
                                                          0.01F, 1000.0F);

            OuterSpace.d3d_scene.transform_Pipeline();

            starportMesh.Drawmesh();

            OuterSpace.device.RenderState.CullMode = oldCull;

            OuterSpace.device.RenderState.Ambient = Color.FromArgb(255, 65, 65, 65);

            OuterSpace.textfont.DrawText(5, 5, Color.Blue, statustext);
        }
Exemplo n.º 2
0
        // Constructor for planetside random mineral gerneation.
        public mineral(int seed, string lithosphere, int density)
        {
            Random rnd = new Random(seed);

            string[] compounds = {"Aluminium", "Antimony", "Chromium", "Cobalt", "Carbon", "Mercury", "Gold",
             "Silver", "Hydrocarbons", "Iron", "Copper", "Lead", "Magnesium", "Manganese", "Molybdenum", "Nickel",
             "Platinum", "Uranium", "Promethium", "Silicon", "Tin", "Titanium", "Tungsten", "Zinc", "Sodium",
             "Francium", "Helium 3", "Deuterium", "Calcium", "Bismuth", "Boron", "Sulfer", "Unknown"}; // 33

            // First mineral
            Single rnd_mineral;

            if (density == 0)  //lithosphere = 70 Then If the planet has no lithosphere then generate random minerals in trace amounts.
            {
                type = compounds[Convert.ToInt32(rnd.Next(32))];
                Volume = (Byte)0.05;
                return;
            }

            rnd_mineral = rnd.Next(seed);

            // 40% chance it's item #1 from the lithosphere.
            if (rnd_mineral < 0.41)
            {
                type = compounds[Convert.ToInt32(lithosphere.Substring(0, 2))];
                // A remaining 30% chance it's item #2
            }
            else if (rnd_mineral < 0.71)
            {
                //    lithosphere = lithosphere - (lithosphere Mod 100)
                //    lithosphere = lithosphere \ 100
                type = compounds[Convert.ToInt32(lithosphere.Substring(3, 2))];
                //    'A last 10% chance it's item #3
            }
            else if (rnd_mineral < 0.91)
            {
                //    lithosphere = lithosphere - (lithosphere Mod 100)
                //    lithosphere = lithosphere \ 100
                type = compounds[Convert.ToInt32(lithosphere.Substring(6, 2))];
            }
            else
            {
                //    'Otherwise, we'll pick a random mineral.
                type = compounds[Convert.ToInt32(rnd.Next(32))];
            }

            Volume = (Byte)Convert.ToInt32(rnd.Next(99)); // Our max is 9.9 meters^3, just like starflight.
            mineralmesh = new MeshObject("\\" + type + ".X");
        }
Exemplo n.º 3
0
        public mineral(int seed, string lithosphere, int density) // Constructor for planetside random mineral gerneation.
        {
            Random rnd = new Random(seed);

            string[] compounds = { "Aluminium", "Antimony",     "Chromium",   "Cobalt",  "Carbon",  "Mercury",   "Gold",
                                   "Silver",    "Hydrocarbons", "Iron",       "Copper",  "Lead",    "Magnesium", "Manganese","Molybdenum","Nickel",
                                   "Platinum",  "Uranium",      "Promethium", "Silicon", "Tin",     "Titanium",  "Tungsten", "Zinc",  "Sodium",
                                   "Francium",  "Helium 3",     "Deuterium",  "Calcium", "Bismuth", "Boron",     "Sulfer",   "Unknown" }; // 33

            // First mineral
            Single rnd_mineral;

            if (density == 0)  //lithosphere = 70 Then If the planet has no lithosphere then generate random minerals in trace amounts.
            {
                type   = compounds[Convert.ToInt32(rnd.Next(32))];
                Volume = (Byte)0.05;
                return;
            }

            rnd_mineral = rnd.Next(seed);

            // 40% chance it's item #1 from the lithosphere.
            if (rnd_mineral < 0.41)
            {
                type = compounds[Convert.ToInt32(lithosphere.Substring(0, 2))];
                // A remaining 30% chance it's item #2
            }
            else if (rnd_mineral < 0.71)
            {
                //    lithosphere = lithosphere - (lithosphere Mod 100)
                //    lithosphere = lithosphere \ 100
                type = compounds[Convert.ToInt32(lithosphere.Substring(3, 2))];
                //    'A last 10% chance it's item #3
            }
            else if (rnd_mineral < 0.91)
            {
                //    lithosphere = lithosphere - (lithosphere Mod 100)
                //    lithosphere = lithosphere \ 100
                type = compounds[Convert.ToInt32(lithosphere.Substring(6, 2))];
            }
            else
            {
                //    'Otherwise, we'll pick a random mineral.
                type = compounds[Convert.ToInt32(rnd.Next(32))];
            }

            Volume      = (Byte)Convert.ToInt32(rnd.Next(99)); // Our max is 9.9 meters^3, just like starflight.
            mineralmesh = new MeshObject("\\" + type + ".X");
        }
Exemplo n.º 4
0
        public void Start()
        {
            if (RotatingPlanetMesh == null)
            {
                RotatingPlanetMesh = new MeshObject("title_planet.x");
                bgSprite           = new SpriteClass("title_bg.jpg", 1024, 768);
                fgSprite           = new SpriteClass("title_fg.bmp", 1024, 256);
            }

            if (OuterSpace.theWindowMgr.FindWindow(" ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CTitleWindow", options.GetScreenWidth() - 200, 0, 150, options.GetScreenHeight(), Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow(" "));
                }
            }

            bStarted = true;
        }
Exemplo n.º 5
0
 // *** Initialize Game Meshes ***
 private void InitMeshes()
 {
     // This needs to be more robust and not tied to the main class.
     // We are going to have to create and load a
     // a bunch of mesh objects for life forms ships etc..
     lifemesh = new MeshObject("distrib-grass-like.X");
     tvMesh = new MeshObject("TV.X");
     mineralMesh = new MeshObject("Sphere.X");
     shipMesh = new MeshObject("SpaceShip.X");
 }
Exemplo n.º 6
0
        public void Start()
        {
            if (RotatingPlanetMesh == null)
            {
                RotatingPlanetMesh = new MeshObject("title_planet.x");
                bgSprite = new SpriteClass("title_bg.jpg", 1024, 768);
                fgSprite = new SpriteClass("title_fg.bmp", 1024, 256);
            }

            if (OuterSpace.theWindowMgr.FindWindow(" ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CTitleWindow", options.GetScreenWidth() - 200, 0, 150, options.GetScreenHeight(), Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow(" "));
                }
            }

            bStarted = true;
        }
Exemplo n.º 7
0
        // draw
        public void RenderStarport()
        {
            if (starportMesh == null)
            {
                starportMesh = new MeshObject("\\starport.x");
            }

            if (OuterSpace.theWindowMgr.FindWindow("   ") == -1)
            {
                if (OuterSpace.theWindowMgr.LoadWindow("CStarportWindow",
                    75, 0, 175, OuterSpace.ClientArea.Height, Color.FromArgb(255, 255, 255, 255)) == true)
                {
                    OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow("   "));
                    wndStarport = (CStarportWindow)(OuterSpace.theWindowMgr.GetWindow(OuterSpace.theWindowMgr.FindWindow("   ")));
                }
            }

            Mesh moMesh = starportMesh.GetMesh();
            List<Material> materialList = new List<Material>();
            List<Texture> textureList = new List<Texture>();

            HandleMouseInput();

            OuterSpace.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0F, 0);

            OuterSpace.d3d_scene.SetupLights();

            OuterSpace.thisPlanet.drawplanet();

            // render starport
            Direct3D.Cull oldCull = OuterSpace.device.RenderState.CullMode;

            OuterSpace.device.RenderState.CullMode = Cull.CounterClockwise;

            fYAngle += 0.001F;

            OuterSpace.d3d_scene.transformWorld(Matrix.Zero, Matrix.RotationY(fYAngle), Matrix.Zero,
                Matrix.Zero, Matrix.Translation(0.3F, 0.0F, -77.5F));

            OuterSpace.d3d_scene.transformView_Projection(new Vector3(0.0F, 0.1F, -80.0F), new Vector3(0.0F, 0.0F, 0.0F),
                new Vector3(0.0F, 1.0F, 0.0F), Convert.ToSingle(Math.PI / 4), Convert.ToSingle(OuterSpace.ClientArea.Width / OuterSpace.ClientArea.Height),
                0.01F, 1000.0F);

            OuterSpace.d3d_scene.transform_Pipeline();

            starportMesh.Drawmesh();

            OuterSpace.device.RenderState.CullMode = oldCull;

            OuterSpace.device.RenderState.Ambient = Color.FromArgb(255, 65, 65, 65);

            OuterSpace.textfont.DrawText(5, 5, Color.Blue, statustext);
        }