Пример #1
0
        void InitGameHole(TGAME_MODE gameMode, GAME_TYPE gameType, bool IsRepeted = false, byte Map = 0)
        {
            byte WP;
            byte WD;
            byte P;
            int  x;

            int[] H;
            int[] M;

            if (Map == 0x7F)
            {
                Map = (byte)GetMap();
            }

            if (gameType == GAME_TYPE.HOLE_REPEAT && IsRepeted)
            {
                for (x = 0; x <= 17; x++)
                {
                    WP = (byte)rnd.Next(0, 8);
                    WD = (byte)rnd.Next(255);
                    P  = (byte)rnd.Next(1, 3);

                    this[x].Hole          = (byte)(x + 1);
                    this[x].Weather       = (byte)rnd.Next(0, 3);
                    this[x].WindPower     = WP;
                    this[x].WindDirection = WD;
                    this[x].Map           = Map;
                    this[x].Pos           = P;
                }
                // leave
                return;
            }
            switch (gameMode)
            {
            case TGAME_MODE.GAME_MODE_FRONT:
                for (x = 0; x <= 17; x++)
                {
                    this[x].Hole          = (byte)(x + 1);
                    this[x].Weather       = (byte)rnd.Next(0, 3);
                    this[x].WindPower     = (byte)rnd.Next(0, 8);
                    this[x].WindDirection = (byte)rnd.Next(255);
                    this[x].Map           = Map;
                    this[x].Pos           = (byte)rnd.Next(1, 3);
                }
                break;

            case TGAME_MODE.GAME_MODE_BACK:
                for (x = 0; x <= 17; x++)
                {
                    this[x].Hole          = (byte)(18 - x);
                    this[x].Weather       = (byte)rnd.Next(0, 3);
                    this[x].WindPower     = (byte)rnd.Next(0, 8);
                    this[x].WindDirection = (byte)rnd.Next(255);
                    this[x].Pos           = (byte)rnd.Next(1, 3);
                }
                break;

            case TGAME_MODE.GAME_MODE_SHUFFLE:
            case TGAME_MODE.GAME_MODE_RANDOM:
                H = RandomHole();
                for (x = 0; x <= 17; x++)
                {
                    this[x].Hole          = (byte)H[x];
                    this[x].Weather       = (byte)rnd.Next(0, 3);
                    this[x].WindPower     = (byte)rnd.Next(0, 8);
                    this[x].WindDirection = (byte)rnd.Next(255);
                    this[x].Map           = Map;
                    this[x].Pos           = (byte)rnd.Next(1, 3);
                }
                break;

            case TGAME_MODE.GAME_MODE_SSC:
                H = RandomHole();
                M = RandomMap();
                for (x = 0; x <= 17; x++)
                {
                    this[x].Hole          = (byte)H[x];
                    this[x].Weather       = (byte)rnd.Next(0, 3);
                    this[x].WindPower     = (byte)rnd.Next(0, 8);
                    this[x].WindDirection = (byte)rnd.Next(255);
                    this[x].Map           = (byte)M[x];
                    this[x].Pos           = (byte)rnd.Next(1, 3);
                }
                this.Last().Hole = (byte)(rnd.Next(0, 2) + 1);
                this.Last().Map  = 0x11;
                break;

            default:
                for (x = 0; x <= 17; x++)
                {
                    this[x].Hole          = (byte)(x + 1);
                    this[x].Weather       = (byte)rnd.Next(0, 3);
                    this[x].WindPower     = (byte)rnd.Next(0, 8);
                    this[x].WindDirection = (byte)rnd.Next(255);
                    this[x].Map           = Map;
                    this[x].Pos           = (byte)rnd.Next(1, 3);
                }
                break;
            }
        }
Пример #2
0
 public void Init(TGAME_MODE Mode, GAME_TYPE Type, bool Repeted, byte Map, byte holeCount)
 {
     m_holeCount = holeCount;
     InitGameHole(Mode, Type, Repeted, Map);
 }