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

◆ DrawToMap()

void Terraria.Main.DrawToMap ( )
inlineprotected

Definition at line 70294 of file Main.cs.

70295 {
70296 //IL_007e: Unknown result type (might be due to invalid IL or missing references)
70297 //IL_04a0: Unknown result type (might be due to invalid IL or missing references)
70298 //IL_04a5: Unknown result type (might be due to invalid IL or missing references)
70299 //IL_04bc: Unknown result type (might be due to invalid IL or missing references)
70300 //IL_04c5: Unknown result type (might be due to invalid IL or missing references)
70301 //IL_04cf: Unknown result type (might be due to invalid IL or missing references)
70302 //IL_04d8: Unknown result type (might be due to invalid IL or missing references)
70303 //IL_04de: Unknown result type (might be due to invalid IL or missing references)
70304 //IL_0287: Unknown result type (might be due to invalid IL or missing references)
70305 //IL_028c: Unknown result type (might be due to invalid IL or missing references)
70306 //IL_0370: Unknown result type (might be due to invalid IL or missing references)
70307 //IL_037b: Unknown result type (might be due to invalid IL or missing references)
70308 //IL_0385: Unknown result type (might be due to invalid IL or missing references)
70309 //IL_038e: Unknown result type (might be due to invalid IL or missing references)
70310 //IL_0394: Unknown result type (might be due to invalid IL or missing references)
70311 if (!mapEnabled)
70312 {
70313 return;
70314 }
70317 for (int i = 0; i <= num; i++)
70318 {
70319 for (int j = 0; j <= num12; j++)
70320 {
70321 if (!checkMap(i, j))
70322 {
70323 return;
70324 }
70325 }
70326 }
70327 if (clearMap)
70328 {
70329 for (int k = 0; k <= num; k++)
70330 {
70331 for (int l = 0; l <= num12; l++)
70332 {
70333 ((Game)this).GraphicsDevice.SetRenderTarget(mapTarget[k, l]);
70334 ((Game)this).GraphicsDevice.Clear(Color.Transparent);
70335 ((Game)this).GraphicsDevice.SetRenderTarget((RenderTarget2D)null);
70336 }
70337 }
70338 clearMap = false;
70339 }
70340 int num19 = -1;
70341 int num20 = -1;
70342 bool flag = false;
70343 int num21 = 0;
70344 int num22 = mapMinY;
70345 int num23 = mapMinY;
70346 int num24 = mapMaxY;
70347 int num25 = mapMaxY;
70348 int num2 = 1;
70350 {
70353 num2 = 2;
70354 }
70355 for (int m = 0; m < num2; m++)
70356 {
70357 switch (m)
70358 {
70359 case 0:
70360 mapMinY = num22;
70361 mapMaxY = num24;
70362 break;
70363 case 1:
70364 mapMinY = num23;
70365 mapMaxY = num25;
70366 break;
70367 }
70368 if (mapMinX < 0)
70369 {
70370 mapMinX = 0;
70371 }
70372 if (mapMinX >= maxTilesX)
70373 {
70374 mapMinX = maxTilesX - 1;
70375 }
70376 if (mapMinY < 0)
70377 {
70378 mapMinY = 0;
70379 }
70380 if (mapMinY >= maxTilesY)
70381 {
70382 mapMinY = maxTilesY - 1;
70383 }
70384 for (int n = mapMinX; n < mapMaxX; n++)
70385 {
70386 for (int num3 = mapMinY; num3 < mapMaxY; num3++)
70387 {
70388 MapTile mapTile = Map[n, num3];
70389 if (!mapTile.IsChanged || mapTarget[n / textureMaxWidth, num3 / textureMaxHeight].IsContentLost)
70390 {
70391 continue;
70392 }
70393 num21++;
70394 if (num21 >= maxMapUpdates)
70395 {
70396 continue;
70397 }
70398 if (loadMap)
70399 {
70400 loadMapLastX = n;
70401 }
70402 Map.ConsumeUpdate(n, num3);
70403 int num4 = n / textureMaxWidth;
70404 int num5 = num3 / textureMaxHeight;
70405 if (num4 != num19 || num5 != num20)
70406 {
70407 num19 = num4;
70408 num20 = num5;
70409 if (flag)
70410 {
70411 spriteBatch.End();
70412 ((Game)this).GraphicsDevice.SetRenderTarget((RenderTarget2D)null);
70413 }
70414 flag = true;
70415 ((Game)this).GraphicsDevice.SetRenderTarget(mapTarget[num4, num5]);
70416 spriteBatch.Begin();
70417 }
70418 int num6 = n - num4 * textureMaxWidth;
70419 int num7 = num3 - num5 * textureMaxHeight;
70421 int num8 = 1;
70422 int num9 = 1;
70423 int num10 = num3 + 1;
70424 while (num10 < mapMaxY)
70425 {
70427 MapTile mapTile3 = (other2 = Map[n, num10]);
70428 if (!mapTile3.IsChanged || !mapTile.Equals(ref other2) || num10 / textureMaxHeight != num5)
70429 {
70430 break;
70431 }
70432 Map.ConsumeUpdate(n, num10);
70433 num8++;
70434 num10++;
70435 num3++;
70436 }
70437 if (num8 == 1)
70438 {
70439 for (num10 = n + 1; num10 < mapMaxX; num10++)
70440 {
70441 MapTile other;
70442 MapTile mapTile2 = (other = Map[num10, num3]);
70443 if (!mapTile2.IsChanged || !mapTile.Equals(ref other) || num10 / textureMaxWidth != num4)
70444 {
70445 break;
70446 }
70447 Map.ConsumeUpdate(num10, num3);
70448 num9++;
70449 }
70450 }
70451 spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2((float)num6, (float)num7), (Rectangle?)new Rectangle(0, 0, num9, num8), mapTileXnaColor, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f);
70452 }
70453 }
70454 }
70455 for (int num11 = 0; num11 < MapHelper.numUpdateTile; num11++)
70456 {
70459 MapTile mapTile4 = Map[num13, num14];
70460 if (!mapTile4.IsChanged)
70461 {
70462 continue;
70463 }
70464 Map.ConsumeUpdate(num13, num14);
70465 int num15 = num13 / textureMaxWidth;
70467 if (num15 != num19 || num16 != num20)
70468 {
70469 num19 = num15;
70470 num20 = num16;
70471 if (flag)
70472 {
70473 spriteBatch.End();
70474 ((Game)this).GraphicsDevice.SetRenderTarget((RenderTarget2D)null);
70475 }
70476 flag = true;
70477 ((Game)this).GraphicsDevice.SetRenderTarget(mapTarget[num15, num16]);
70478 spriteBatch.Begin();
70479 }
70480 int num17 = num13 - num15 * textureMaxWidth;
70483 spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2((float)num17, (float)num18), (Rectangle?)new Rectangle(0, 0, 1, 1), mapTileXnaColor2, 0f, default(Vector2), 1f, (SpriteEffects)0, 0f);
70484 }
70485 MapHelper.numUpdateTile = 0;
70486 if (flag)
70487 {
70488 spriteBatch.End();
70489 ((Game)this).GraphicsDevice.SetRenderTarget((RenderTarget2D)null);
70490 }
70491 mapReady = true;
70492 loadMapLastX = 0;
70493 loadMap = false;
70494 loadMapLock = false;
70495 }
static Asset< Texture2D > MagicPixel
static bool clearMap
Definition Main.cs:955
static int maxTilesY
The height of the currently-loaded world in tiles.
Definition Main.cs:1191
bool checkMap(int i, int j)
Definition Main.cs:74133
static int maxMapUpdates
Definition Main.cs:925
static int loadMapLastX
Definition Main.cs:929
RenderTarget2D[,] mapTarget
Definition Main.cs:961
static SpriteBatch spriteBatch
Definition Main.cs:1043
static bool loadMapLock
Definition Main.cs:931
static int maxTilesX
The width of the currently-loaded world in tiles.
Definition Main.cs:1186
static int mapMinY
Definition Main.cs:947
static int mapMaxX
Definition Main.cs:945
static int mapMinX
Definition Main.cs:943
static int textureMaxHeight
Definition Main.cs:939
static int textureMaxWidth
Definition Main.cs:937
static bool mapEnabled
Definition Main.cs:975
static int mapMaxY
Definition Main.cs:949
static bool loadMap
Definition Main.cs:933
static bool mapReady
Definition Main.cs:935
static short[] updateTileY
Definition MapHelper.cs:174
static Color GetMapTileXnaColor(ref MapTile tile)
static int numUpdateTile
Definition MapHelper.cs:170
static short[] updateTileX
Definition MapHelper.cs:172

References Terraria.Main.checkMap(), Terraria.Main.clearMap, Terraria.UI.Game, Terraria.Map.MapHelper.GetMapTileXnaColor(), Terraria.Main.loadMap, Terraria.Main.loadMapLastX, Terraria.Main.loadMapLock, Terraria.GameContent.TextureAssets.MagicPixel, Terraria.Main.mapEnabled, Terraria.Main.mapMaxX, Terraria.Main.mapMaxY, Terraria.Main.mapMinX, Terraria.Main.mapMinY, Terraria.Main.mapReady, Terraria.Main.mapTarget, Terraria.Main.maxMapUpdates, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Map.MapHelper.numUpdateTile, Terraria.Main.spriteBatch, Terraria.Main.textureMaxHeight, Terraria.Main.textureMaxWidth, Terraria.Map.MapHelper.updateTileX, and Terraria.Map.MapHelper.updateTileY.

Referenced by Terraria.Main.DoDraw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: