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

Function SpawnWraithTails

TombEngine/Objects/TR4/Entity/Wraith.cpp:40–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39
40 static void SpawnWraithTails(const ItemInfo& item)
41 {
42 constexpr auto OFFSET = Vector3(0.0f, -10.0f, -50.0f);
43 constexpr auto COLOR_END = Color(0.0f, 0.0f, 0.0f, 0.0f);
44 constexpr auto WIDTH = 8.0f;
45 constexpr auto LIFE_MAX = 0.5f;
46 constexpr auto VEL = 4.0f;
47 constexpr auto EXP_RATE = 1.0f;
48
49 enum class TailTag
50 {
51 First,
52 Second,
53 Third
54 };
55
56 auto colorStart = Vector4::Zero;
57 switch (item.ObjectNumber)
58 {
59 default:
60 case ID_WRAITH1:
61 colorStart = Vector4(1.0f, 0.6f, 0.0f, 1.0f);
62 break;
63
64 case ID_WRAITH2:
65 colorStart = Vector4(0.0f, 0.5f, 1.0f, 1.0f);
66 break;
67
68 case ID_WRAITH3:
69 colorStart = Vector4(1.0f);
70 break;
71 }
72
73 auto posBase = item.Pose.Position.ToVector3();
74 auto rotMatrix = item.Pose.Orientation.ToRotationMatrix();
75 auto pos = posBase + Vector3::Transform(OFFSET, rotMatrix);
76
77 auto dir0 = Geometry::RotatePoint(posBase, EulerAngles(ANGLE(50.0f), 0, 0));
78 auto dir1 = Geometry::RotatePoint(posBase, EulerAngles(ANGLE(-50.0f), 0, 0));
79 auto dir2 = Geometry::RotatePoint(posBase, EulerAngles(0, ANGLE(50.0f), 0));
80
81 short orient2D = item.Pose.Orientation.z;
82
83 // Spawn first tail.
84 StreamerEffect.Spawn(
85 item.Index, (int)TailTag::First,
86 pos, dir0, orient2D, colorStart, COLOR_END,
87 WIDTH, LIFE_MAX, VEL, EXP_RATE, 0,
88 StreamerFeatherMode::Center, BlendMode::Additive);
89
90 // Spawn second tail.
91 StreamerEffect.Spawn(
92 item.Index, (int)TailTag::Second,
93 pos, dir1, orient2D, colorStart, COLOR_END,
94 WIDTH, LIFE_MAX, VEL, EXP_RATE, 0,
95 StreamerFeatherMode::Center, BlendMode::Additive);
96
97 // Spawn third tail.

Callers 1

WraithControlFunction · 0.85

Calls 8

RotatePointFunction · 0.85
ANGLEFunction · 0.85
SpawnMethod · 0.80
Vector3Function · 0.50
Vector4Function · 0.50
EulerAnglesClass · 0.50
ToVector3Method · 0.45
ToRotationMatrixMethod · 0.45

Tested by

no test coverage detected