Example #1
0
        /* Constructors for the OuterSpace Form. */
        public OuterSpace()
        {
            InitializeComponent();

            // Initialize game managers
            theRaceMgr = new RaceMgr();
            theWindowMgr = new WindowMgr();
            // The crew manager is initialized AFTER the race manager since crews require races
            theCrewMgr = new CrewMgr();
            theGameState = new CGameState();

            // Initialize the title screen and game options
            MainTitle = new CTitleScreen();

            // Get the screen resolution to use
            clientArea.Width = MainTitle.options.GetScreenWidth();
            clientArea.Height = MainTitle.options.GetScreenHeight();

            // Make the title screen draw first
            if (theGameState.IsGameInState(GameStates.MainTitle))
                MainTitle.SetState(0);

            // Set the window size or screen resolution
            this.ClientSize = new Size(clientArea.Width, clientArea.Height);

            // Window or Full Screen mode?
            if (OuterSpace.IsWindowMode == true)
                this.FormBorderStyle = FormBorderStyle.FixedToolWindow;

            starport = new CStarPort();

            // load the galaxy file the user selects.
            theVerse = new Universe();

            // *** THE FOLLOWING IS COMMENTED OUT BUT SHOULD REMAIN FOR FUTURE REFERENCE UNTIL DEAMED UNECESSARY ***
            //
            //Dim aRace As Race = theRaceMgr.GetRace("Vulcan")
            //Dim crew(4) As CrewMember
            //crew(0) = New CrewMember(theCrewMgr.GetNextKey(), 1, "John Smith", 50, 50, 50, 50, 50, 0)
            //theCrewMgr.HireCrewMember(crew(0))
            //crew(1) = New CrewMember(theCrewMgr.GetNextKey(), 2, "Pon Far", 50, 50, 50, 50, 50, 0)
            //theCrewMgr.HireCrewMember(crew(1))
            //crew(2) = New CrewMember(theCrewMgr.GetNextKey(), 3, "Rommy", 50, 50, 50, 50, 50, 0)
            //theCrewMgr.HireCrewMember(crew(2))
            //crew(3) = New CrewMember(theCrewMgr.GetNextKey(), 4, "Worf", 50, 50, 50, 50, 50, 0)
            //theCrewMgr.HireCrewMember(crew(3))

            //theCrewMgr.Train(1, 4, 3)
            //theCrewMgr.Train(1, 3, 10)
            //theCrewMgr.Train(2, 0, 3)
            //theCrewMgr.Train(3, 2, 3)
            //theCrewMgr.Train(4, 1, 3)

            msgbox = new Messages();
            playership = new vehicleStats();
            TV = new vehicleStats();
            debugfile = new DebugOutput(debugdir + "Debug-Out.txt");

            // Set the parameters of the Terrian Vehicle.
            TV.stellerSpeed = 0.03f;
            TV.systemSpeed = 0.03f;
            TV.combatSpeed = 0.03f;
            TV.thetadif = 1;
            TV.yawdif = 1;

            // Setup other ships
            for (int i = 0; i < MAXOTHERSHIPS; i++)
            {
                otherships[i] = new vehicleStats();
                otherships[i].shipName = null;
            }

            // Set up a refrence table for costly trigometric function caclulations.
            for (int i = 0; i < 360; i++)
            {
                TanRef[i] = (float)Math.Tan(i * (Math.PI / 180));
                moveX[i] = (float)Math.Cos(i * (Math.PI / 180));
                moveY[i] = (float)Math.Sin(i * (Math.PI / 180));
            }

            TanRef[0] = 0.0f;
            moveX[0] = 1.0f;
            moveY[0] = 0.0f;
            TanRef[180] = 0.0f;
            moveX[180] = -1.0f;
            moveY[180] = 0.0f;
            TanRef[90] = (float)Math.Tan(90.1 * (Math.PI / 180));
            moveX[90] = 0.0f;
            moveY[90] = 1.0f;
            TanRef[270] = (float)Math.Tan(270.1 * (Math.PI / 180));
            moveX[270] = 0.0f;
            moveY[270] = -1.0f;
            moveX[360] = 1.0f;
            moveY[360] = 0.0f;

            // Set up initial game clock
            theGameClock = new CGameClock(2317, 3, 2, 0);

            // Windows.Forms.Cursor.Hide()
            this.Cursor.Dispose();

            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
        }
Example #2
0
        private void drawEncounter(vehicleStats[] ships)
        {
            int i = 0;
            userinput.MouseXY(12, 12);

            //Draw the players ship
            smallship.Draw((int)XCor, (int)(ClientArea.Height - YCor), smallship.sourceFrame[0], playership.theta, Color.White);

            //Draw any other ships.
            while (ships[i].shipName != null)
            {
                smallship.Draw((int)ships[i].X, (int)(ClientArea.Height - ships[i].Y), smallship.sourceFrame[0], 0, Color.White);
                i++;
            }
        }