/// <summary>
        /// Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
        /// amounts, or biomeList[] indices based on the particular GenLayer subclass.
        /// </summary>
        public override int[] GetInts(int par1, int par2, int par3, int par4)
        {
            int i = par1 >> 1;
            int j = par2 >> 1;
            int k = (par3 >> 1) + 3;
            int l = (par4 >> 1) + 3;

            int[] ai  = Parent.GetInts(i, j, k, l);
            int[] ai1 = IntCache.GetIntCache(k * 2 * (l * 2));
            int   i1  = k << 1;

            for (int j1 = 0; j1 < l - 1; j1++)
            {
                int k1 = j1 << 1;
                int i2 = k1 * i1;
                int j2 = ai[0 + (j1 + 0) * k];
                int k2 = ai[0 + (j1 + 1) * k];

                for (int l2 = 0; l2 < k - 1; l2++)
                {
                    InitChunkSeed(l2 + i << 1, j1 + j << 1);
                    int i3 = ai[l2 + 1 + (j1 + 0) * k];
                    int j3 = ai[l2 + 1 + (j1 + 1) * k];
                    ai1[i2]        = j2;
                    ai1[i2++ + i1] = Choose(j2, k2);
                    ai1[i2]        = Choose(j2, i3);
                    ai1[i2++ + i1] = Choose(j2, i3, k2, j3);
                    j2             = i3;
                    k2             = j3;
                }
            }

            int[] ai2 = IntCache.GetIntCache(par3 * par4);

            for (int l1 = 0; l1 < par4; l1++)
            {
                Array.Copy(ai1, (l1 + (par2 & 1)) * (k << 1) + (par1 & 1), ai2, l1 * par3, par3);
            }

            return(ai2);
        }
Beispiel #2
0
        /// <summary>
        /// Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
        /// amounts, or biomeList[] indices based on the particular GenLayer subclass.
        /// </summary>
        public override int[] GetInts(int par1, int par2, int par3, int par4)
        {
            par1 -= 2;
            par2 -= 2;
            sbyte byte0 = 2;
            int   i     = 1 << byte0;
            int   j     = par1 >> byte0;
            int   k     = par2 >> byte0;
            int   l     = (par3 >> byte0) + 3;
            int   i1    = (par4 >> byte0) + 3;

            int[] ai = Parent.GetInts(j, k, l, i1);
            int   j1 = l << byte0;
            int   k1 = i1 << byte0;

            int[] ai1 = IntCache.GetIntCache(j1 * k1);

            for (int l1 = 0; l1 < i1 - 1; l1++)
            {
                int i2 = ai[0 + (l1 + 0) * l];
                int k2 = ai[0 + (l1 + 1) * l];

                for (int l2 = 0; l2 < l - 1; l2++)
                {
                    double d = (double)i * 0.90000000000000002D;
                    InitChunkSeed(l2 + j << byte0, l1 + k << byte0);
                    double d1 = ((double)NextInt(1024) / 1024D - 0.5D) * d;
                    double d2 = ((double)NextInt(1024) / 1024D - 0.5D) * d;
                    InitChunkSeed(l2 + j + 1 << byte0, l1 + k << byte0);
                    double d3 = ((double)NextInt(1024) / 1024D - 0.5D) * d + (double)i;
                    double d4 = ((double)NextInt(1024) / 1024D - 0.5D) * d;
                    InitChunkSeed(l2 + j << byte0, l1 + k + 1 << byte0);
                    double d5 = ((double)NextInt(1024) / 1024D - 0.5D) * d;
                    double d6 = ((double)NextInt(1024) / 1024D - 0.5D) * d + (double)i;
                    InitChunkSeed(l2 + j + 1 << byte0, l1 + k + 1 << byte0);
                    double d7 = ((double)NextInt(1024) / 1024D - 0.5D) * d + (double)i;
                    double d8 = ((double)NextInt(1024) / 1024D - 0.5D) * d + (double)i;
                    int    i3 = ai[l2 + 1 + (l1 + 0) * l];
                    int    j3 = ai[l2 + 1 + (l1 + 1) * l];

                    for (int k3 = 0; k3 < i; k3++)
                    {
                        int l3 = ((l1 << byte0) + k3) * j1 + (l2 << byte0);

                        for (int i4 = 0; i4 < i; i4++)
                        {
                            double d9  = ((double)k3 - d2) * ((double)k3 - d2) + ((double)i4 - d1) * ((double)i4 - d1);
                            double d10 = ((double)k3 - d4) * ((double)k3 - d4) + ((double)i4 - d3) * ((double)i4 - d3);
                            double d11 = ((double)k3 - d6) * ((double)k3 - d6) + ((double)i4 - d5) * ((double)i4 - d5);
                            double d12 = ((double)k3 - d8) * ((double)k3 - d8) + ((double)i4 - d7) * ((double)i4 - d7);

                            if (d9 < d10 && d9 < d11 && d9 < d12)
                            {
                                ai1[l3++] = i2;
                                continue;
                            }

                            if (d10 < d9 && d10 < d11 && d10 < d12)
                            {
                                ai1[l3++] = i3;
                                continue;
                            }

                            if (d11 < d9 && d11 < d10 && d11 < d12)
                            {
                                ai1[l3++] = k2;
                            }
                            else
                            {
                                ai1[l3++] = j3;
                            }
                        }
                    }

                    i2 = i3;
                    k2 = j3;
                }
            }

            int[] ai2 = IntCache.GetIntCache(par3 * par4);

            for (int j2 = 0; j2 < par4; j2++)
            {
                Array.Copy(ai1, (j2 + (par2 & i - 1)) * (l << byte0) + (par1 & i - 1), ai2, j2 * par3, par3);
            }

            return(ai2);
        }