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

◆ GetCommonTreeFoliageData()

static bool Terraria.WorldGen.GetCommonTreeFoliageData ( int i,
int j,
int xoffset,
ref int treeFrame,
ref int treeStyle,
out int floorY,
out int topTextureFrameWidth,
out int topTextureFrameHeight )
inlinestatic

Definition at line 53552 of file WorldGen.cs.

53553 {
53554 _ = Main.tile[i, j];
53555 int num = i + xoffset;
53558 floorY = j;
53559 int num2 = 0;
53560 for (int k = 0; k < 100; k++)
53561 {
53562 floorY = j + k;
53563 Tile tile = Main.tile[num, floorY];
53564 if (tile == null)
53565 {
53566 return false;
53567 }
53568 switch (tile.type)
53569 {
53570 case 2:
53571 case 477:
53572 {
53573 int num4 = 0;
53574 num4 = ((num <= Main.treeX[0]) ? TreeTops.GetTreeStyle(0) : ((num <= Main.treeX[1]) ? TreeTops.GetTreeStyle(1) : ((num > Main.treeX[2]) ? TreeTops.GetTreeStyle(3) : TreeTops.GetTreeStyle(2))));
53575 switch (num4)
53576 {
53577 case 0:
53578 treeStyle = 0;
53579 break;
53580 case 5:
53581 treeStyle = 10;
53582 break;
53583 default:
53584 treeStyle = 5 + num4;
53585 break;
53586 }
53587 return true;
53588 }
53589 case 23:
53590 case 661:
53591 treeStyle = 1;
53592 return true;
53593 case 70:
53594 treeStyle = 14;
53595 return true;
53596 case 199:
53597 case 662:
53598 treeStyle = 5;
53599 return true;
53600 case 60:
53603 treeStyle = 2;
53604 num2 = TreeTops.GetTreeStyle(5);
53605 if (num2 == 1)
53606 {
53607 treeStyle = 11;
53609 }
53610 if ((double)floorY > Main.worldSurface)
53611 {
53612 treeStyle = 13;
53614 }
53615 return true;
53616 case 147:
53617 treeStyle = 4;
53618 num2 = TreeTops.GetTreeStyle(6);
53619 if (num2 == 0)
53620 {
53621 treeStyle = 12;
53622 if (i % 10 == 0)
53623 {
53624 treeStyle = 18;
53625 }
53626 }
53627 if (num2 == 2 || num2 == 3 || num2 == 32 || num2 == 4 || num2 == 42 || num2 == 5 || num2 == 7)
53628 {
53629 if (num2 % 2 == 0)
53630 {
53631 if (i < Main.maxTilesX / 2)
53632 {
53633 treeStyle = 16;
53634 }
53635 else
53636 {
53637 treeStyle = 17;
53638 }
53639 }
53640 else if (i > Main.maxTilesX / 2)
53641 {
53642 treeStyle = 16;
53643 }
53644 else
53645 {
53646 treeStyle = 17;
53647 }
53648 }
53649 return true;
53650 case 109:
53651 case 492:
53652 {
53654 int num3 = (treeStyle = GetHollowTreeFoliageStyle());
53655 if (num3 == 19)
53656 {
53658 }
53659 if (num3 == 20)
53660 {
53661 treeStyle = 20;
53662 if (i % 6 == 1)
53663 {
53664 treeFrame += 3;
53665 }
53666 else if (i % 6 == 2)
53667 {
53668 treeFrame += 6;
53669 }
53670 else if (i % 6 == 3)
53671 {
53672 treeFrame += 9;
53673 }
53674 else if (i % 6 == 4)
53675 {
53676 treeFrame += 12;
53677 }
53678 else if (i % 6 == 5)
53679 {
53680 treeFrame += 15;
53681 }
53682 }
53683 else if (i % 3 == 1)
53684 {
53685 treeFrame += 3;
53686 }
53687 else if (i % 3 == 2)
53688 {
53689 treeFrame += 6;
53690 }
53691 return true;
53692 }
53693 }
53694 }
53695 return false;
53696 }
static TreeTopsInfo TreeTops
Definition WorldGen.cs:1178
static int GetHollowTreeFoliageStyle()

References Terraria.Main.maxTilesX, Terraria.Main.tile, Terraria.Main.treeX, Terraria.Tile.type, and Terraria.Main.worldSurface.

Referenced by Terraria.GameContent.Drawing.TileDrawing.DrawTrees(), and Terraria.GameContent.Drawing.TileDrawing.MakeExtraPreparations().