TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetNextMapDraw()

bool Terraria.WorldSections.GetNextMapDraw ( Vector2 playerPos,
out int x,
out int y )
inline

Definition at line 224 of file WorldSections.cs.

225 {
226 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
227 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
228 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
229 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
230 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
231 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
232 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
233 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
234 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
235 //IL_007e: Unknown result type (might be due to invalid IL or missing references)
236 //IL_007f: Unknown result type (might be due to invalid IL or missing references)
237 //IL_00d4: Unknown result type (might be due to invalid IL or missing references)
238 //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
239 //IL_0145: Unknown result type (might be due to invalid IL or missing references)
240 //IL_015e: Unknown result type (might be due to invalid IL or missing references)
241 //IL_02d2: Unknown result type (might be due to invalid IL or missing references)
242 //IL_02d3: Unknown result type (might be due to invalid IL or missing references)
243 if (mapSectionsLeft <= 0)
244 {
245 x = -1;
246 y = -1;
247 return false;
248 }
249 Stopwatch stopwatch = new Stopwatch();
250 stopwatch.Start();
251 int num = 0;
252 int num3 = 0;
253 Vector2 vector = prevMap.centerPos;
254 playerPos *= 0.0625f;
255 int sectionX = Netplay.GetSectionX((int)playerPos.X);
256 int sectionY = Netplay.GetSectionY((int)playerPos.Y);
257 int num4 = Netplay.GetSectionX((int)vector.X);
258 int num5 = Netplay.GetSectionY((int)vector.Y);
259 int num6;
260 if (num4 != sectionX || num5 != sectionY)
261 {
263 num4 = sectionX;
264 num5 = sectionY;
265 num6 = 4;
266 x = sectionX;
267 y = sectionY;
268 }
269 else
270 {
271 num6 = prevMap.leg;
272 x = prevMap.X;
273 y = prevMap.Y;
274 num = prevMap.xDir;
275 num3 = prevMap.yDir;
276 }
277 int num7 = (int)(playerPos.X - ((float)num4 + 0.5f) * 200f);
278 int num8 = (int)(playerPos.Y - ((float)num5 + 0.5f) * 150f);
279 if (num == 0)
280 {
281 num = ((num7 <= 0) ? 1 : (-1));
282 num3 = ((num8 <= 0) ? 1 : (-1));
283 }
284 int num9 = 0;
285 bool flag = false;
286 bool flag2 = false;
287 while (true)
288 {
289 if (num9 == 4)
290 {
291 if (flag2)
292 {
293 throw new Exception("Infinite loop in WorldSections.GetNextMapDraw");
294 }
295 flag2 = true;
296 x = num4;
297 y = num5;
298 num7 = (int)(vector.X - ((float)num4 + 0.5f) * 200f);
299 num8 = (int)(vector.Y - ((float)num5 + 0.5f) * 150f);
300 num = ((num7 <= 0) ? 1 : (-1));
301 num3 = ((num8 <= 0) ? 1 : (-1));
302 num6 = 4;
303 num9 = 0;
304 }
305 if (y >= 0 && y < height && x >= 0 && x < width)
306 {
307 flag = false;
308 if (!data[y * width + x][2])
309 {
310 break;
311 }
312 }
313 int num10 = x - num4;
314 int num2 = y - num5;
315 if (num10 == 0 || num2 == 0)
316 {
317 if (num6 == 4)
318 {
319 if (num10 == 0 && num2 == 0)
320 {
321 if (Math.Abs(num7) > Math.Abs(num8))
322 {
323 y -= num3;
324 }
325 else
326 {
327 x -= num;
328 }
329 }
330 else
331 {
332 if (num10 != 0)
333 {
334 x += num10 / Math.Abs(num10);
335 }
336 if (num2 != 0)
337 {
338 y += num2 / Math.Abs(num2);
339 }
340 }
341 num6 = 0;
342 num9 = -2;
343 flag = true;
344 }
345 else
346 {
347 if (num10 != 0)
348 {
349 num = ((num10 <= 0) ? 1 : (-1));
350 }
351 else
352 {
353 num3 = ((num2 <= 0) ? 1 : (-1));
354 }
355 x += num;
356 y += num3;
357 num6++;
358 }
359 if (flag)
360 {
361 num9++;
362 }
363 else
364 {
365 flag = true;
366 }
367 }
368 else
369 {
370 x += num;
371 y += num3;
372 }
373 }
374 data[y * width + x][2] = true;
376 prevMap.centerPos = playerPos;
377 prevMap.X = x;
378 prevMap.Y = y;
379 prevMap.leg = num6;
380 prevMap.xDir = num;
381 prevMap.yDir = num3;
382 stopwatch.Stop();
383 return true;
384 }
IterationState prevMap

References Terraria.WorldSections.IterationState.centerPos, Terraria.WorldSections.data, Terraria.Netplay.GetSectionX(), Terraria.Netplay.GetSectionY(), Terraria.WorldSections.IterationState.leg, Terraria.WorldSections.mapSectionsLeft, Terraria.WorldSections.prevMap, Terraria.WorldSections.width, Terraria.WorldSections.IterationState.X, Terraria.WorldSections.IterationState.xDir, Terraria.WorldSections.IterationState.Y, and Terraria.WorldSections.IterationState.yDir.

+ Here is the call graph for this function: