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

Function TriggerFlareSmoke

TombEngine/Game/effects/smoke.cpp:89–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 void TriggerFlareSmoke(const Vector3& pos, const Vector3& direction, int life, int room)
90 {
91 auto& s = GetFreeSmokeParticle();
92 s = {};
93 s.position = pos;
94 s.age = 0;
95 constexpr float d = 0.2f;
96
97 auto randomDir = Vector3(Random::GenerateFloat(-d, d), Random::GenerateFloat(-d, d), Random::GenerateFloat(-d, d));
98 auto direction2 = Vector3::Zero;
99 (direction + randomDir).Normalize(direction2);
100
101 s.velocity = direction2 * Random::GenerateFloat(7, 9);
102 s.gravity = -0.2f;
103 s.friction = Random::GenerateFloat(0.7f, 0.85f);
104 s.sourceColor = g_GameFlow->GetSettings()->Flare.Color * Vector4(0.5f);
105 s.destinationColor = Vector4(1, 1, 1, 0);
106 s.life = Random::GenerateFloat(25, 35);
107 s.angularVelocity = Random::GenerateFloat(-0.3f, 0.3f);
108 s.angularDrag = 0.97f;
109 s.sourceSize = life > 4 ? Random::GenerateFloat(16, 24) : Random::GenerateFloat(100, 128);
110 s.destinationSize = life > 4 ? Random::GenerateFloat(160, 200) : Random::GenerateFloat(256, 300);
111 s.affectedByWind = true;
112 s.active = true;
113 s.room = room;
114 }
115
116 //TODO: add additional "Weapon Special" param or something. Currently initial == 2 means Rocket Launcher backwards smoke.
117 //TODO: Refactor different weapon types out of it

Callers 1

TriggerChaffEffectsFunction · 0.85

Calls 5

GenerateFloatFunction · 0.85
GetSettingsMethod · 0.80
Vector3Function · 0.50
Vector4Function · 0.50
NormalizeMethod · 0.45

Tested by

no test coverage detected