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

◆ MapColor()

static void Terraria.Map.MapHelper.MapColor ( ushort type,
ref Color oldColor,
byte colorType )
inlinestaticprivate

Definition at line 1708 of file MapHelper.cs.

1709 {
1710 Color color = WorldGen.paintColor(colorType);
1711 float num = (float)(int)oldColor.R / 255f;
1712 float num2 = (float)(int)oldColor.G / 255f;
1713 float num3 = (float)(int)oldColor.B / 255f;
1714 if (num2 > num)
1715 {
1716 float num4 = num;
1717 num = num2;
1718 num2 = num4;
1719 }
1720 if (num3 > num)
1721 {
1722 float num5 = num;
1723 num = num3;
1724 num3 = num5;
1725 }
1726 switch (colorType)
1727 {
1728 case 29:
1729 {
1730 float num7 = num3 * 0.3f;
1731 oldColor.R = (byte)((float)(int)color.R * num7);
1732 oldColor.G = (byte)((float)(int)color.G * num7);
1733 oldColor.B = (byte)((float)(int)color.B * num7);
1734 break;
1735 }
1736 case 30:
1737 if (type >= wallRangeStart && type <= wallRangeEnd)
1738 {
1739 oldColor.R = (byte)((float)(255 - oldColor.R) * 0.5f);
1740 oldColor.G = (byte)((float)(255 - oldColor.G) * 0.5f);
1741 oldColor.B = (byte)((float)(255 - oldColor.B) * 0.5f);
1742 }
1743 else
1744 {
1745 oldColor.R = (byte)(255 - oldColor.R);
1746 oldColor.G = (byte)(255 - oldColor.G);
1747 oldColor.B = (byte)(255 - oldColor.B);
1748 }
1749 break;
1750 default:
1751 {
1752 float num6 = num;
1753 oldColor.R = (byte)((float)(int)color.R * num6);
1754 oldColor.G = (byte)((float)(int)color.G * num6);
1755 oldColor.B = (byte)((float)(int)color.B * num6);
1756 break;
1757 }
1758 }
1759 }
static ushort wallRangeEnd
Definition MapHelper.cs:204
static ushort wallRangeStart
Definition MapHelper.cs:202

References Microsoft.Xna.Framework.Color.B, Microsoft.Xna.Framework.Color.G, Terraria.WorldGen.paintColor(), Microsoft.Xna.Framework.Color.R, System.type, Terraria.Map.MapHelper.wallRangeEnd, and Terraria.Map.MapHelper.wallRangeStart.

Referenced by Terraria.Map.MapHelper.GetMapTileXnaColor().