| 1514 | } |
| 1515 | |
| 1516 | void TriggerFireFlame(int x, int y, int z, FlameType type, const Vector3& color1, const Vector3& color2) |
| 1517 | { |
| 1518 | int dx = LaraItem->Pose.Position.x - x; |
| 1519 | int dz = LaraItem->Pose.Position.z - z; |
| 1520 | |
| 1521 | if (abs(dx) > BLOCK(16) || abs(dz) > BLOCK(16)) |
| 1522 | return; |
| 1523 | |
| 1524 | auto* spark = GetFreeParticle(); |
| 1525 | |
| 1526 | spark->on = true; |
| 1527 | |
| 1528 | if (color1 == Vector3::Zero || color2 == Vector3::Zero) |
| 1529 | { |
| 1530 | // Legacy default colours, for compatibility with TR4-TR5 objects. |
| 1531 | |
| 1532 | switch (type) |
| 1533 | { |
| 1534 | case FlameType::SmallFast: |
| 1535 | spark->sR = 48; |
| 1536 | spark->sG = 48; |
| 1537 | spark->sB = (GetRandomControl() & 0x1F) + 128; |
| 1538 | spark->dR = 32; |
| 1539 | spark->dG = (GetRandomControl() & 0x3F) - 64; |
| 1540 | spark->dB = (GetRandomControl() & 0x3F) + 64; |
| 1541 | break; |
| 1542 | |
| 1543 | case FlameType::Small: |
| 1544 | spark->sR = spark->sG = (GetRandomControl() & 0x1F) + 48; |
| 1545 | spark->sB = (GetRandomControl() & 0x3F) - 64; |
| 1546 | break; |
| 1547 | |
| 1548 | default: |
| 1549 | spark->sR = 255; |
| 1550 | spark->sB = 48; |
| 1551 | spark->sG = (GetRandomControl() & 0x1F) + 48; |
| 1552 | break; |
| 1553 | } |
| 1554 | |
| 1555 | if (type != FlameType::SmallFast) |
| 1556 | { |
| 1557 | spark->dR = (GetRandomControl() & 0x3F) - 64; |
| 1558 | spark->dG = (GetRandomControl() & 0x3F) + -128; |
| 1559 | spark->dB = 32; |
| 1560 | } |
| 1561 | } |
| 1562 | else |
| 1563 | { |
| 1564 | auto [colorS, colorD] = GenerateColorShift(color1, color2); |
| 1565 | |
| 1566 | spark->sR = colorS[0]; |
| 1567 | spark->sG = colorS[1]; |
| 1568 | spark->sB = colorS[2]; |
| 1569 | |
| 1570 | spark->dR = colorD[0]; |
| 1571 | spark->dG = colorD[1]; |
| 1572 | spark->dB = colorD[2]; |
| 1573 | } |
no test coverage detected