56 {
57 int num = configuration.Get<int>("FlatBeachPadding");
58 progress.Message = Lang.gen[0].Value;
60 int num2 = 0;
61 double num3 = (double)Main.maxTilesY * 0.3;
63 double num4 = num3 + (double)Main.maxTilesY * 0.2;
66 {
67 num4 = (double)Main.maxTilesY * 0.5;
68 if (Main.maxTilesX > 2500)
69 {
70 num4 = (double)Main.maxTilesY * 0.6;
71 }
73 }
74 double num5 = num3;
75 double num6 = num3;
76 double num7 = num4;
77 double num8 = num4;
78 double num9 = (double)Main.maxTilesY * 0.23;
79 SurfaceHistory surfaceHistory = new SurfaceHistory(500);
80 num2 = GenVars.leftBeachEnd + num;
81 for (
int i = 0;
i < Main.maxTilesX;
i++)
82 {
83 progress.
Set((
double)i / (
double)Main.maxTilesX);
88 if (num2 <= 0)
89 {
93 {
95 }
96 }
97 num2--;
98 if ((
double)
i > (double)Main.maxTilesX * 0.45 && (
double)
i < (double)Main.maxTilesX * 0.55 && (terrainFeatureType ==
TerrainFeatureType.Mountain || terrainFeatureType ==
TerrainFeatureType.Valley))
99 {
101 }
102 if ((
double)
i > (double)Main.maxTilesX * 0.48 && (
double)
i < (double)Main.maxTilesX * 0.52)
103 {
105 }
107 double num10 = 0.17;
108 double num11 = 0.26;
110 {
111 num10 = 0.15;
112 num11 = 0.28;
113 }
115 {
116 num3 = Utils.Clamp(num3, (double)Main.maxTilesY * 0.17, num9);
117 }
118 else if (num3 < (double)Main.maxTilesY * num10)
119 {
120 num3 = (double)Main.maxTilesY * num10;
121 num2 = 0;
122 }
123 else if (num3 > (double)Main.maxTilesY * num11)
124 {
125 num3 = (double)Main.maxTilesY * num11;
126 num2 = 0;
127 }
129 {
131 }
133 {
134 if (Main.maxTilesX > 2500)
135 {
136 if (num4 > (double)Main.maxTilesY * 0.7)
137 {
138 num4 -= 1.0;
139 }
140 }
141 else if (num4 > (double)Main.maxTilesY * 0.6)
142 {
143 num4 -= 1.0;
144 }
145 }
146 else
147 {
148 if (num4 < num3 + (double)Main.maxTilesY * 0.06)
149 {
150 num4 += 1.0;
151 }
152 if (num4 > num3 + (double)Main.maxTilesY * 0.35)
153 {
154 num4 -= 1.0;
155 }
156 }
157 surfaceHistory.Record(num3);
160 {
161 if (num3 > num9)
162 {
164 }
166 num2 = Main.maxTilesX -
i;
167 }
168 }
169 Main.worldSurface = (int)(num6 + 25.0);
170 Main.rockLayer = num8;
171 double num12 = (int)((Main.rockLayer - Main.worldSurface) / 6.0) * 6;
172 Main.rockLayer = (int)(Main.worldSurface + num12);
173 int num13 = (int)(Main.rockLayer + (
double)Main.maxTilesY) / 2 +
GenBase.
_random.Next(-100, 20);
176 {
177 lavaLine = (int)(Main.worldSurface * 4.0 + num4) / 5;
178 }
179 int num14 = 20;
180 if (num7 < num6 + (double)num14)
181 {
182 double num15 = (num7 + num6) / 2.0;
183 double num16 =
Math.
Abs(num7 - num6);
184 if (num16 < (double)num14)
185 {
186 num16 = num14;
187 }
188 num7 = num15 + num16 / 2.0;
189 num6 = num15 - num16 / 2.0;
190 }
191 GenVars.rockLayer = num4;
192 GenVars.rockLayerHigh = num8;
193 GenVars.rockLayerLow = num7;
194 GenVars.worldSurface = num3;
195 GenVars.worldSurfaceHigh = num6;
196 GenVars.worldSurfaceLow = num5;
197 GenVars.waterLine = num13;
198 GenVars.lavaLine = lavaLine;
199 }
static byte Min(byte val1, byte val2)
static double Abs(double value)
static byte Max(byte val1, byte val2)
static double GenerateWorldSurfaceOffset(TerrainFeatureType featureType)
static void RetargetSurfaceHistory(SurfaceHistory history, int targetX, double targetHeight)
static void FillColumn(int x, double worldSurface, double rockLayer)
static UnifiedRandom _random
static int rightBeachStart