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

Function FlameEmitter3Control

TombEngine/Objects/Effects/flame_emitters.cpp:455–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453 }
454
455 void FlameEmitter3Control(short itemNumber)
456 {
457 auto* item = &g_Level.Items[itemNumber];
458
459 if (TriggerActive(item))
460 {
461 if (item->TriggerFlags)
462 {
463 SoundEffect(SFX_TR4_ELECTRIC_ARCING_LOOP, &item->Pose);
464
465 byte g = (GetRandomControl() & 0x3F) + 192;
466 byte b = (GetRandomControl() & 0x3F) + 192;
467
468 auto origin = item->Pose.Position.ToVector3();
469 auto target = Vector3::Zero;
470
471 if (!(GlobalCounter & 3))
472 {
473 if (item->TriggerFlags == 2 || item->TriggerFlags == 4)
474 {
475 target.x = item->Pose.Position.x + 2048 * phd_sin(item->Pose.Orientation.y + ANGLE(180.0f));
476 target.y = item->Pose.Position.y;
477 target.z = item->Pose.Position.z + 2048 * phd_cos(item->Pose.Orientation.y + ANGLE(180.0f));
478
479 if (GetRandomControl() & 3)
480 SpawnElectricity(origin, target, (GetRandomControl() & 0x1F) + 64, 0, g, b, 24, 0, 32, 3);
481 else
482 SpawnElectricity(origin, target, (GetRandomControl() & 0x1F) + 96, 0, g, b, 32, (int)ElectricityFlags::Spline, 32, 3);
483 }
484 }
485
486 if (item->TriggerFlags >= 3 && !(GlobalCounter & 1))
487 {
488 short targetItemNumber = item->ItemFlags[((GlobalCounter >> 2) & 1) + 2];
489 auto* targetItem = &g_Level.Items[targetItemNumber];
490
491 target = GetJointPosition(targetItem, 0, Vector3i(0, -64, 20)).ToVector3();
492
493 if (!(GlobalCounter & 3))
494 {
495 if (GetRandomControl() & 3)
496 SpawnElectricity(origin, target, (GetRandomControl() & 0x1F) + 64, 0, g, b, 24, 0, 32, 5);
497 else
498 SpawnElectricity(origin, target, (GetRandomControl() & 0x1F) + 96, 0, g, b, 32, (int)ElectricityFlags::Spline, 32, 5);
499 }
500
501 if (item->TriggerFlags != 3 || targetItem->TriggerFlags)
502 SpawnElectricityGlow(target, 64, 0, g, b);
503 }
504
505 if ((GlobalCounter & 3) == 2)
506 {
507 origin = item->Pose.Position.ToVector3();
508 target = Vector3(
509 (GetRandomControl() & 0x1FF) + origin.x - 256,
510 (GetRandomControl() & 0x1FF) + origin.y - 256,
511 (GetRandomControl() & 0x1FF) + origin.z - 256);
512

Callers

nothing calls this directly

Calls 15

TriggerActiveFunction · 0.85
SoundEffectFunction · 0.85
GetRandomControlFunction · 0.85
phd_sinFunction · 0.85
ANGLEFunction · 0.85
phd_cosFunction · 0.85
SpawnElectricityFunction · 0.85
GetJointPositionFunction · 0.85
SpawnElectricityGlowFunction · 0.85
TriggerFireFlameFunction · 0.85
SpawnDynamicLightFunction · 0.85
ItemNearLaraFunction · 0.85

Tested by

no test coverage detected