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

Function TriggerChaffSmoke

TombEngine/Game/effects/chaffFX.cpp:104–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void TriggerChaffSmoke(const Vector3i& pos, const Vector3i& vel, int speed, bool isMoving, bool wind)
105{
106 SMOKE_SPARKS* smoke;
107
108 int rnd = 0;
109 BYTE trans, size;
110
111 smoke = &SmokeSparks[GetFreeSmokeSpark()];
112
113 smoke->on = true;
114
115 smoke->sShade = 0;
116 if (isMoving)
117 {
118 trans = (speed << 7) >> 5;
119 smoke->dShade = trans;
120 }
121 else
122 smoke->dShade = 64 + (GetRandomDraw() & 7);
123
124 smoke->colFadeSpeed = 4 + (GetRandomDraw() & 3);
125 smoke->fadeToBlack = 4;
126
127 rnd = (GetRandomControl() & 3) - (speed >> 12) + 20;
128 if (rnd < 9)
129 {
130 smoke->life = 9;
131 smoke->sLife = 9;
132 }
133 else
134 {
135 smoke->life = rnd;
136 smoke->sLife = rnd;
137 }
138
139 smoke->blendMode = BlendMode::Additive;
140
141 smoke->position.x = pos.x + (GetRandomControl() & 7) - 3;
142 smoke->position.y = pos.y + (GetRandomControl() & 7) - 3;
143 smoke->position.z = pos.z + (GetRandomControl() & 7) - 3;
144 smoke->velocity.x = vel.x + ((GetRandomDraw() & 63) - 32);
145 smoke->velocity.y = vel.y;
146 smoke->velocity.z = vel.z + ((GetRandomDraw() & 63) - 32);
147 smoke->friction = 4;
148
149 if (GetRandomControl() & 1)
150 {
151 smoke->flags = SP_EXPDEF | SP_ROTATE | SP_DEF | SP_SCALE;
152 smoke->rotAng = (GetRandomControl() & 0xFFF);
153 if (GetRandomControl() & 1)
154 smoke->rotAdd = (GetRandomControl() & 7) - 24;
155 else
156 smoke->rotAdd = (GetRandomControl() & 7) + 24;
157 }
158 else
159 smoke->flags = SP_EXPDEF | SP_DEF | SP_SCALE;
160
161 if (wind)

Callers

nothing calls this directly

Calls 3

GetFreeSmokeSparkFunction · 0.85
GetRandomDrawFunction · 0.85
GetRandomControlFunction · 0.85

Tested by

no test coverage detected