예제 #1
0
        public void drawplanet()
        {
            int    iceCapRange;
            int    displaceMag;
            float  planetScalar;
            int    roughness;
            string txrMap = "";

            if (renderPolyPlanet == false)
            {
                OuterSpace.msgbox.pushmsgs("Orbit Established");
                OuterSpace.msgbox.pushmsgs("+/- to zoom in and out");
                // OuterSpace.msgbox.pushmsgs("Use arrow keys to fly around,")
                //  Set our random seed based on each planets unique coordinates..
                iceCapRange  = 100;
                displaceMag  = 12;
                planetScalar = 1;
                roughness    = 2;

                switch (PClass)
                {
                case "V":
                    txrMap = "txrMoltenPlanet.bmp";
                    break;

                case "I":
                    txrMap = "txrInfernoPlanet.bmp";
                    break;

                case "P":
                    txrMap = "txrPoisonPlanet.bmp";
                    break;

                case "T":
                    txrMap = "txrEarthPlanet.bmp";
                    break;

                case "R":
                    txrMap = "txrRadiatedPlanet.bmp";
                    break;

                case "X":
                    txrMap = "txrExoticPlanet.bmp";
                    break;

                case "J":
                    planetScalar = 0.7F;
                    txrMap       = "txrGasPlanet.bmp";
                    break;

                case "B":
                    txrMap = "txrBarrenPlanet.bmp";
                    break;

                case "F":
                    planetScalar = 1.3F;
                    txrMap       = "txrIcePlanet.bmp";
                    break;
                }

                planetpoly = new FractalPlanet(iceCapRange, displaceMag, planetScalar, roughness,
                                               Convert.ToSingle(uSeed), txrMap);
            }

            renderPolyPlanet = true;

            planetpoly.RenderPlanet();

            if (OuterSpace.theGameState.IsGameInState(OuterSpace.GameStates.Landing))
            {
                if (OuterSpace.mnu.userchoice == 49)
                {
                    OuterSpace.theGameState.RemoveState(OuterSpace.GameStates.Landing);
                    OuterSpace.theGameState.RemoveState(OuterSpace.GameStates.Landed);
                    renderPolyPlanet           = false;
                    OuterSpace.TV.X            = 0;
                    OuterSpace.TV.Y            = 0;
                    OuterSpace.TV.lastCenter.X = 0;
                    OuterSpace.TV.lastCenter.Y = 0;
                    planetpoly.disposevertexbuffer();
                    OuterSpace.mnu.userchoice = -1;
                    OuterSpace.mnu.items[49]  = "Land";
                }
            }

            if (OuterSpace.theGameState.IsGameInState(OuterSpace.GameStates.Landed))
            {
                if (OuterSpace.mnu.userchoice == 50)
                {
                    //  Move the terrian vehicle if the user picks disembark.
                    OuterSpace.mnu.showmenu = false;
                    OuterSpace.TV.letsMove();
                    OuterSpace.textfont.DrawText(20, 150, Color.White, Convert.ToString(OuterSpace.TV.X));
                    OuterSpace.textfont.DrawText(20, 172, Color.White, Convert.ToString(OuterSpace.TV.Y));
                    OuterSpace.textfont.DrawText(20, 194, Color.White, ("Theta: " + Convert.ToString(OuterSpace.TV.theta)));
                    // Believe it or not kids, the below is one function call!
                    OuterSpace.textfont.DrawText(
                        20,
                        216,
                        Color.White,
                        ("Elevation: " +
                         OuterSpace.thisPlanet.planetpoly.startSphere.getElevationofspot(
                             int.Parse(((int)(OuterSpace.TV.X + (OuterSpace.thisPlanet.PlanetMaps.BigMapX / 2))).ToString()),
                             int.Parse(((int)(OuterSpace.TV.Y + (OuterSpace.thisPlanet.PlanetMaps.BigMapY / 2))).ToString())
                             ).ToString()
                        )
                        );
                }

                if ((OuterSpace.mnu.userchoice == 49))
                {
                    OuterSpace.theGameState.RemoveState(OuterSpace.GameStates.Landing);
                    OuterSpace.theGameState.RemoveState(OuterSpace.GameStates.Landed);
                    renderPolyPlanet = false;
                    planetpoly.disposevertexbuffer();
                    OuterSpace.mnu.userchoice = -1;
                    OuterSpace.mnu.items[49]  = "Land";
                }
            }
        }