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

◆ Step_PaintBrush()

static void Terraria.GameContent.SmartCursorHelper.Step_PaintBrush ( SmartCursorUsageInfo providedInfo,
ref int focusedX,
ref int focusedY )
inlinestaticprivate

Definition at line 700 of file SmartCursorHelper.cs.

701 {
702 if ((providedInfo.item.type != 1071 && providedInfo.item.type != 1543) || (providedInfo.paintLookup == 0 && providedInfo.paintCoatingLookup == 0) || focusedX != -1 || focusedY != -1)
703 {
704 return;
705 }
706 _targets.Clear();
707 int paintLookup = providedInfo.paintLookup;
708 int paintCoatingLookup = providedInfo.paintCoatingLookup;
709 if (paintLookup != 0 || paintCoatingLookup != 0)
710 {
711 for (int i = providedInfo.reachableStartX; i <= providedInfo.reachableEndX; i++)
712 {
713 for (int j = providedInfo.reachableStartY; j <= providedInfo.reachableEndY; j++)
714 {
715 Tile tile = Main.tile[i, j];
716 if (tile.active() && (false | (paintLookup != 0 && tile.color() != paintLookup) | (paintCoatingLookup == 1 && !tile.fullbrightBlock()) | (paintCoatingLookup == 2 && !tile.invisibleBlock())))
717 {
718 _targets.Add(new Tuple<int, int>(i, j));
719 }
720 }
721 }
722 }
723 if (_targets.Count > 0)
724 {
725 float num = -1f;
727 for (int k = 0; k < _targets.Count; k++)
728 {
729 float num2 = Vector2.Distance(new Vector2(_targets[k].Item1, _targets[k].Item2) * 16f + Vector2.One * 8f, providedInfo.mouse);
730 if (num == -1f || num2 < num)
731 {
732 num = num2;
733 tuple = _targets[k];
734 }
735 }
736 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, providedInfo.reachableStartX, providedInfo.reachableStartY, providedInfo.reachableEndX, providedInfo.reachableEndY))
737 {
738 focusedX = tuple.Item1;
739 focusedY = tuple.Item2;
740 }
741 }
742 _targets.Clear();
743 }
static List< Tuple< int, int > > _targets
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Terraria.GameContent.SmartCursorHelper._targets, Terraria.Tile.active(), Terraria.Tile.color(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Tile.fullbrightBlock(), Terraria.Collision.InTileBounds(), Terraria.Tile.invisibleBlock(), and Terraria.Main.tile.

Referenced by Terraria.GameContent.SmartCursorHelper.SmartCursorLookup().