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

Function SethAttack

TombEngine/Objects/TR4/Entity/tr4_setha.cpp:493–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491 }
492
493 void SethAttack(int itemNumber)
494 {
495 auto* item = &g_Level.Items[itemNumber];
496
497 item->ItemFlags[0]++;
498
499 auto pos1 = GetJointPosition(item, SethAttack1);
500 auto pos2 = GetJointPosition(item, SethAttack2);
501
502 int sparkR = 64;
503 int sparkG = Random::GenerateInt(64, 192);
504 int sparkB = sparkG;
505 auto sparkColor = Vector3(sparkR, sparkG, sparkB);
506
507 int flameR = 0;
508 int flameG = Random::GenerateInt(64, 192);
509 int flameB = flameG - 32;
510 auto flameColor = Vector3(flameR, flameG, flameB);
511
512 int scale = 0;
513
514 switch (item->Animation.ActiveState)
515 {
516 case SETH_STATE_DUAL_PROJECTILE_ATTACK:
517 case SETH_STATE_HOVER_PROJECTILE_ATTACK:
518 if (item->ItemFlags[0] < 78 && Random::GenerateInt(0, 32) < item->ItemFlags[0])
519 {
520 // Spawn spark particles.
521 for (int i = 0; i < 2; i++)
522 {
523 TriggerAttackSpark(pos1.ToVector3(), sparkColor);
524 TriggerAttackSpark(pos2.ToVector3(), sparkColor);
525 }
526 }
527
528 scale = item->ItemFlags[0] * 2;
529 if (scale > 128)
530 scale = 128;
531
532 if ((Wibble & 0xF) == 8)
533 {
534 if (item->ItemFlags[0] < 127)
535 {
536 TriggerAttackFlame(pos1, flameColor, scale);
537 TriggerAttackFlame(pos2, flameColor, scale);
538 }
539 }
540 else if (!(Wibble & 0xF) && item->ItemFlags[0] < 103)
541 {
542 TriggerAttackFlame(pos1, flameColor, scale);
543 TriggerAttackFlame(pos2, flameColor, scale);
544 }
545
546 if (item->ItemFlags[0] >= 96 && item->ItemFlags[0] <= 99)
547 {
548 auto pos = GetJointPosition(item, SethAttack1.BoneID, Vector3i(SethAttack1.Position.x, SethAttack1.Position.y * 2, SethAttack1.Position.z));
549 auto orient = Geometry::GetOrientToPoint(pos1.ToVector3(), pos.ToVector3());
550 SethProjectileAttack(Pose(pos1, orient), item->RoomNumber, 0);

Callers 1

SethControlFunction · 0.85

Calls 10

GetJointPositionFunction · 0.85
GenerateIntFunction · 0.85
TriggerAttackSparkFunction · 0.85
TriggerAttackFlameFunction · 0.85
GetOrientToPointFunction · 0.85
SethProjectileAttackFunction · 0.85
Vector3iClass · 0.70
PoseClass · 0.70
Vector3Function · 0.50
ToVector3Method · 0.45

Tested by

no test coverage detected