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

Function FlameEmitter2Control

TombEngine/Objects/Effects/flame_emitters.cpp:263–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261 }
262
263 void FlameEmitter2Control(short itemNumber)
264 {
265 auto* item = &g_Level.Items[itemNumber];
266 bool active = (item->TriggerFlags < 0) ? TriggerActive(item) : CalculateActiveState(item);
267
268 if (active)
269 {
270 // If not an emitter for flipmaps
271 if (item->TriggerFlags >= 0)
272 {
273 // If not a moving flame
274 if (item->TriggerFlags != 2)
275 {
276 float size = 1.0f;
277 switch (item->TriggerFlags)
278 {
279 default:
280 case 0:
281 size = 2.0f;
282 break;
283
284 case 1:
285 size = 1.0f;
286 break;
287
288 case 3:
289 size = 0.5f;
290 break;
291
292 case 4:
293 case 123:
294 size = 0.25f;
295 break;
296 }
297
298 AddFire(item->Pose.Position, item->RoomNumber, item->Model.Color, size, item->ItemFlags[3]);
299 }
300
301 if (item->TriggerFlags == 0 || item->TriggerFlags == 2)
302 {
303 float multiplier = (float)(UCHAR_MAX - item->ItemFlags[3]) / float(UCHAR_MAX);
304 auto color = GetFlameColor(item->Model.Color);
305
306 SpawnDynamicLight(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z,
307 10 * multiplier,
308 color.x, color.y, color.z);
309 }
310
311 if (item->TriggerFlags == 2)
312 {
313 item->Pose.Position.x += phd_sin(item->Pose.Orientation.y - ANGLE(180)) * (CLICK(1) / FPS);
314 item->Pose.Position.z += phd_cos(item->Pose.Orientation.y - ANGLE(180)) * (CLICK(1) / FPS);
315
316 auto pointColl = GetPointCollision(*item);
317
318 if (TestEnvironment(ENV_FLAG_WATER, pointColl.GetRoomNumber()) ||
319 pointColl.GetFloorHeight() - item->Pose.Position.y > CLICK(2) ||
320 pointColl.GetFloorHeight() == NO_HEIGHT)

Callers

nothing calls this directly

Calls 15

TriggerActiveFunction · 0.85
CalculateActiveStateFunction · 0.85
AddFireFunction · 0.85
GetFlameColorFunction · 0.85
SpawnDynamicLightFunction · 0.85
phd_sinFunction · 0.85
ANGLEFunction · 0.85
phd_cosFunction · 0.85
GetPointCollisionFunction · 0.85
TestEnvironmentFunction · 0.85
KillItemFunction · 0.85
ItemNewRoomFunction · 0.85

Tested by

no test coverage detected