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

Function TriggerExplosionSparks

TombEngine/Game/effects/effects.cpp:679–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679void TriggerExplosionSparks(int x, int y, int z, int extraTrig, int dynamic, int uw, int roomNumber, const Vector3& mainColor, const Vector3& secondColor)
680{
681 constexpr auto LIFE_MAX = 44.0f;
682 constexpr auto ROTATION_MAX = ANGLE(0.15f);
683
684 static const auto EXTRAS_TABLE = std::array<unsigned char, 4>{ 0, 4, 7, 10 };
685
686 int scalar = 1;
687
688 if (roomNumber < 0)
689 {
690 roomNumber = -roomNumber;
691 scalar = 1;
692 }
693
694 auto& spark = *GetFreeParticle();
695 spark.on = true;
696 spark.sR = 255;
697
698 if (uw == 1)
699 {
700 spark.colFadeSpeed = 7;
701 spark.fadeToBlack = 8;
702 spark.life = (GetRandomControl() & 7) + 16;
703 spark.sLife = spark.life;
704 spark.roomNumber = roomNumber;
705
706 if (mainColor == Vector3::Zero)
707 {
708 spark.sG = (GetRandomControl() & 0x3F) + 128;
709 spark.sB = 32;
710 spark.dR = 192;
711 spark.dG = (GetRandomControl() & 0x1F) + 64;
712 spark.dB = 0;
713 }
714 else
715 {
716 auto [colorS, colorD] = GenerateColorShift(mainColor, secondColor);
717
718 spark.sR = colorS[0];
719 spark.sG = colorS[1];
720 spark.sB = colorS[2];
721 spark.dR = colorD[0];
722 spark.dG = colorD[1];
723 spark.dB = colorD[2];
724 }
725 }
726 else
727 {
728 if (mainColor == Vector3::Zero)
729 {
730 spark.sG = (GetRandomControl() & 0xF) + 32;
731 spark.sB = 0;
732 spark.dR = (GetRandomControl() & 0x3F) + 192;
733 spark.dG = (GetRandomControl() & 0x3F) + 128;
734 spark.dB = 32;
735 spark.colFadeSpeed = 8;
736 spark.fadeToBlack = 16;

Callers 15

ControlTwinAutoGunFunction · 0.85
TriggerKnockbackFunction · 0.85
ControlTonyFireBallFunction · 0.85
ControlWingedMutantFunction · 0.85
ControlExplosionFunction · 0.85
DoGuardianDeathFunction · 0.85
MissileControlFunction · 0.85
BodyPartExplodeFunction · 0.85
ControlEnemyMissileFunction · 0.85
ExplodeBossFunction · 0.85
ControlMineFunction · 0.85
CollideMineFunction · 0.85

Calls 6

ANGLEFunction · 0.85
GetFreeParticleFunction · 0.85
GetRandomControlFunction · 0.85
GenerateColorShiftFunction · 0.85
TriggerExplosionSmokeEndFunction · 0.85
TriggerExplosionSmokeFunction · 0.85

Tested by

no test coverage detected