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

◆ GetAlpha()

Color Terraria.Gore.GetAlpha ( Color newColor)
inline

Definition at line 1465 of file Gore.cs.

1466 {
1467 float num = (float)(255 - alpha) / 255f;
1468 int r;
1469 int g;
1470 int b;
1471 if (type == 16 || type == 17)
1472 {
1473 r = newColor.R;
1474 g = newColor.G;
1475 b = newColor.B;
1476 }
1477 else
1478 {
1479 if (type == 716)
1480 {
1481 return new Color(255, 255, 255, 200);
1482 }
1483 if (type >= 570 && type <= 572)
1484 {
1485 byte b2 = (byte)(255 - alpha);
1486 return new Color(b2, b2, b2, b2 / 2);
1487 }
1488 if (type == 331)
1489 {
1490 return new Color(255, 255, 255, 50);
1491 }
1492 if (type == 1225)
1493 {
1494 return new Color(num, num, num, num);
1495 }
1496 r = (int)((float)(int)newColor.R * num);
1497 g = (int)((float)(int)newColor.G * num);
1498 b = (int)((float)(int)newColor.B * num);
1499 }
1500 int num2 = newColor.A - alpha;
1501 if (num2 < 0)
1502 {
1503 num2 = 0;
1504 }
1505 if (num2 > 255)
1506 {
1507 num2 = 255;
1508 }
1509 if (type >= 1202 && type <= 1204)
1510 {
1511 return new Color(r, g, b, (num2 < 20) ? num2 : 20);
1512 }
1513 return new Color(r, g, b, num2);
1514 }
int type
Definition Gore.cs:27
int alpha
Definition Gore.cs:25

References Terraria.Gore.alpha, Microsoft.Xna.Framework.Color.B, Microsoft.Xna.Framework.Color.G, Microsoft.Xna.Framework.Color.R, and Terraria.Gore.type.