예제 #1
0
        void ClearCenterOfMap(TerrainMap map)
        {
            int o = map.Cellwidth() >> 4;
            int p = (map.Cellwidth() - o) >> 1;
            int q = (map.Cellwidth() + o) >> 1;

            for (int i = p; i <= q; i++)
            {
                for (int j = p; j <= q; j++)
                {
                    map.SetMapBit(i, j, false);
                }
            }
        }
예제 #2
0
        void DrawBoundaryFencesOnMap(TerrainMap map)
        {
            // QQQ it would make more sense to do this with a "draw line
            // QQQ on map" primitive, may need that for other things too

            int cw = map.Cellwidth();
            int ch = map.Cellheight();

            int r = cw - 1;
            int a = cw >> 3;
            int b = cw - a;
            int o = cw >> 4;
            int p = (cw - o) >> 1;
            int q = (cw + o) >> 1;

            for (int i = 0; i < cw; i++)
            {
                for (int j = 0; j < ch; j++)
                {
                    bool c = i > a && i < b && (i <p || i> q);
                    if (i == 0 || j == 0 || i == r || j == r || (c && (i == j || i + j == r)))
                    {
                        map.SetMapBit(i, j, true);
                    }
                }
            }
        }
예제 #3
0
        void DrawRandomClumpsOfRocksOnMap(TerrainMap map)
        {
            if (useRandomRocks)
            {
                int spread = 4;
                int r      = map.Cellwidth();
                int k      = Random2(50, 150);

                for (int p = 0; p < k; p++)
                {
                    int i = Random2(0, r - spread);
                    int j = Random2(0, r - spread);
                    int c = Random2(0, 10);

                    for (int q = 0; q < c; q++)
                    {
                        int m = Random2(0, spread);
                        int n = Random2(0, spread);
                        map.SetMapBit(i + m, j + n, true);
                    }
                }
            }
        }
예제 #4
0
        void DrawRandomClumpsOfRocksOnMap(TerrainMap map)
        {
            if (useRandomRocks)
            {
                int spread = 4;
                int r = map.Cellwidth();
                int k = Random2(50, 150);

                for (int p = 0; p < k; p++)
                {
                    int i = Random2(0, r - spread);
                    int j = Random2(0, r - spread);
                    int c = Random2(0, 10);

                    for (int q = 0; q < c; q++)
                    {
                        int m = Random2(0, spread);
                        int n = Random2(0, spread);
                        map.SetMapBit(i + m, j + n, true);
                    }
                }
            }
        }
예제 #5
0
        void DrawBoundaryFencesOnMap(TerrainMap map)
        {
            // QQQ it would make more sense to do this with a "draw line
            // QQQ on map" primitive, may need that for other things too

            int cw = map.Cellwidth();
            int ch = map.Cellheight();

            int r = cw - 1;
            int a = cw >> 3;
            int b = cw - a;
            int o = cw >> 4;
            int p = (cw - o) >> 1;
            int q = (cw + o) >> 1;

            for (int i = 0; i < cw; i++)
            {
                for (int j = 0; j < ch; j++)
                {
                    bool c = i > a && i < b && (i < p || i > q);
                    if (i == 0 || j == 0 || i == r || j == r || (c && (i == j || i + j == r)))
                        map.SetMapBit(i, j, true);
                }
            }
        }
예제 #6
0
 void ClearCenterOfMap(TerrainMap map)
 {
     int o = map.Cellwidth() >> 4;
     int p = (map.Cellwidth() - o) >> 1;
     int q = (map.Cellwidth() + o) >> 1;
     for (int i = p; i <= q; i++)
         for (int j = p; j <= q; j++)
             map.SetMapBit(i, j, false);
 }