/// <summary>
        /// Draws a specific level's data to a bitmap.
        /// </summary>
        /// <param name="bitmap">The Bitmap object to draw the level data onto.</param>
        /// <param name="levelIndex">The index of the level to draw.</param>
        /// <param name="displayItemsFlag">Flag that specifics which objects to draw on top of the level data.</param>
        public void DrawLevelData(ref Bitmap bitmap, int levelIndex, LevelDisplayFlag displayItemsFlag)
        {
            for (int i = 0; i <= 12; i++)
            {
                for (int x = 0; x <= 12; x++)
                {
                    _Tiles.DrawBitmap(ref bitmap, new Rectangle(CurrentLevel.GetLevelData(i, x) * 16, 0, 16, 16),
                        new Rectangle(x * 16, i * 16, 16, 16));
                }
            }

            // load in the bitmaps that represent the objects.
            LoadAssets();

            // Declare the graphics object that will be used to draw images onto the source bitmap.
            Graphics g = Graphics.FromImage(bitmap);

            // If the user has chosen to render the enemy start positions, loop through
            // each one, and display them.
            if ((displayItemsFlag & LevelDisplayFlag.ViewEnemy) == LevelDisplayFlag.ViewEnemy)
            {
                for (int i = 0; i < CurrentLevel.StartingPositions.Count; i++)
                {
                    if (CurrentLevel.StartingPositions[i].Type == BattleCityStartingPositionType.Enemy)
                    {
                        g.DrawImage(_EnemyBMP, new Point(CurrentLevel.StartingPositions[i].X * 16, CurrentLevel.StartingPositions[i].Y * 16));
                    }
                }
            }

            // If the user has chosen to render the player start positions, loop through
            // each player, and display them.
            if ((displayItemsFlag & LevelDisplayFlag.ViewPlayer) == LevelDisplayFlag.ViewPlayer)
            {
                for (int i = 0; i < CurrentLevel.StartingPositions.Count; i++)
                {
                    if (CurrentLevel.StartingPositions[i].Type == BattleCityStartingPositionType.PlayerOne)
                    {
                        g.DrawImage(_PlayerOneBMP, new Point(CurrentLevel.StartingPositions[i].X * 16, CurrentLevel.StartingPositions[i].Y * 16));
                    }
                    else if (CurrentLevel.StartingPositions[i].Type == BattleCityStartingPositionType.PlayerTwo)
                    {
                        g.DrawImage(_PlayerTwoBMP, new Point(CurrentLevel.StartingPositions[i].X * 16, CurrentLevel.StartingPositions[i].Y * 16));
                    }
                }
            }

            // If the user has decided to display the level flag, call the DrawNormalFlag function.
            if ( ((displayItemsFlag & LevelDisplayFlag.ViewNormalFlag) == LevelDisplayFlag.ViewNormalFlag)
                || ((displayItemsFlag & LevelDisplayFlag.ViewFortifiedFlag) == LevelDisplayFlag.ViewFortifiedFlag))
            {
                DrawFlag(ref bitmap, displayItemsFlag);
            }
        }
 /// <summary>
 /// Draws the current level's data to a bitmap.
 /// </summary>
 /// <param name="bitmap">The Bitmap object to draw the level to.</param>
 /// <param name="displayItemsFlag">Flag that specifics which objects to draw on top of the level data.</param>
 public void DrawLevelData(ref Bitmap bitmap, LevelDisplayFlag displayItemsFlag)
 {
     DrawLevelData(ref bitmap, _CurrentLevel, displayItemsFlag);
 }
        /// <summary>
        /// Draws the flag to a bitmap, at position 80x176.
        /// </summary>
        /// <param name="bitmap">The Bitmap object to draw the flag object to.</param>
        /// <param name="flag"></param>
        public void DrawFlag(ref Bitmap bitmap, LevelDisplayFlag flag)
        {
            NESRender pat = new NESRender(48, 32);
            int InitialX = 80;
            int InitialY = 176;

            byte PaletteIndex;

            // If the function is drawing the fortified flag, a different
            // palette index is needed.
            if ((flag & LevelDisplayFlag.ViewFortifiedFlag) == LevelDisplayFlag.ViewFortifiedFlag)
                PaletteIndex = 3;
            else
                PaletteIndex =0;

            for (byte i = 0; i < 4; i++)
            {
                for (byte x = 0; x < 6; x++)
                {
                    fixed (byte* pPal = &Palette[PaletteIndex, 0])
                    {
                        byte FlagData;
                        // If the flag we are drawing is the fortified flag, retrieve the TSA for it
                        if ((flag & LevelDisplayFlag.ViewFortifiedFlag) == LevelDisplayFlag.ViewFortifiedFlag)
                            FlagData = GetFortifiedFlagTSAData(i, x);
                        else
                            FlagData = GetFlagTSAData(i, x);

                        fixed (byte* pPat = &_PatternTable[BGPATTERNTABLE + (FlagData * 0x10)])
                        {
                            pat.DrawTile((x * 8), (i * 8), pPat, pPal);
                        }
                    }
                }
            }

            // Render the flags data to the main level bitmap at 80 x 176
            pat.DrawBitmap(ref bitmap, new Rectangle(0, 0, pat.Width, pat.Height),
                new Rectangle(InitialX, InitialY, pat.Width, pat.Height));
        }