MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / TriggerExplosionBubble

Function TriggerExplosionBubble

TombEngine/Game/effects/tomb4fx.cpp:1472–1528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1470}
1471
1472void TriggerExplosionBubble(int x, int y, int z, short roomNumber, const Vector3& mainColor, const Vector3& secondColor)
1473{
1474 constexpr auto BUBBLE_COUNT = 24;
1475 auto* spark = GetFreeParticle();
1476
1477 if (mainColor == Vector3::Zero)
1478 {
1479 spark->sR = 128;
1480 spark->sG = 64;
1481 spark->sB = 0;
1482 spark->dR = 128;
1483 spark->dG = 128;
1484 spark->dB = 128;
1485 }
1486 else
1487 {
1488 auto [colorS, colorD] = GenerateColorShift(mainColor, secondColor);
1489
1490 spark->sR = colorS[0];
1491 spark->sG = colorS[1];
1492 spark->sB = colorS[2];
1493 spark->dR = colorD[0];
1494 spark->dG = colorD[1];
1495 spark->dB = colorD[2];
1496 }
1497
1498 spark->on = 1;
1499 spark->life = 24;
1500 spark->sLife = 24;
1501 spark->colFadeSpeed = 8;
1502 spark->fadeToBlack = 12;
1503 spark->blendMode = BlendMode::Additive;
1504 spark->x = x;
1505 spark->y = y;
1506 spark->z = z;
1507 spark->xVel = 0;
1508 spark->yVel = 0;
1509 spark->zVel = 0;
1510 spark->friction = 0;
1511 spark->flags = 2058;
1512 spark->scalar = 3;
1513 spark->gravity = 0;
1514 spark->SpriteSeqID = ID_DEFAULT_SPRITES;
1515 spark->SpriteID = SPR_BUBBLES;
1516 spark->maxYvel = 0;
1517 int size = (GetRandomControl() & 7) + 63;
1518 spark->sSize = size >> 1;
1519 spark->size = size >> 1;
1520 spark->dSize = 2 * size;
1521
1522 auto sphere = BoundingSphere(Vector3(x, y, z), BLOCK(0.25f));
1523 for (int i = 0; i < BUBBLE_COUNT; i++)
1524 {
1525 auto pos = Random::GeneratePointInSphere(sphere);
1526 SpawnBubble(pos, roomNumber, (int)BubbleFlags::LargeScale | (int)BubbleFlags::HighAmplitude);
1527 }
1528}
1529

Callers 3

UpdateSparksFunction · 0.85
TriggerFlashSmokeFunction · 0.85

Calls 6

GetFreeParticleFunction · 0.85
GenerateColorShiftFunction · 0.85
GetRandomControlFunction · 0.85
GeneratePointInSphereFunction · 0.85
SpawnBubbleFunction · 0.85
Vector3Function · 0.50

Tested by

no test coverage detected