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

Function DoImpStoneAttack

TombEngine/Objects/TR5/Entity/tr5_imp.cpp:100–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 }
99
100 static void DoImpStoneAttack(ItemInfo* item)
101 {
102 auto pos1 = GetJointPosition(item, ImpRightHandBite);
103 auto pos2 = GetJointPosition(LaraItem, LM_HEAD);
104 auto orient = Geometry::GetOrientToPoint(pos1.ToVector3(), pos2.ToVector3());
105
106 int distance = Vector3i::Distance(pos1, pos2);
107 if (distance < 8)
108 distance = 8;
109
110 orient.x += short(GetRandomControl() % (distance / 2) - (distance / 4));
111 orient.y += short(GetRandomControl() % (distance / 4) - (distance / 8));
112
113 int fxNumber = CreateNewEffect(item->RoomNumber);
114 if (fxNumber == NO_VALUE)
115 return;
116
117 auto& fx = EffectList[fxNumber];
118
119 fx.objectNumber = ID_IMP_ROCK;
120 fx.frameNumber = Objects[ID_IMP_ROCK].meshIndex;
121
122 fx.pos.Position = pos1;
123 fx.roomNumber = item->RoomNumber;
124 fx.speed = sqrt(distance) * 4;
125
126 fx.pos.Orientation = EulerAngles(orient.x + (distance / 2), orient.y, 0);
127
128 if (fx.speed < BLOCK(0.25f))
129 fx.speed = BLOCK(0.25f);
130
131 fx.fallspeed = 0;
132 fx.color = Vector4::One;
133 fx.counter = 0;
134 fx.flag1 = 2;
135 fx.flag2 = 0x2000;
136 }
137
138 static bool IsTorchLitNearby(ItemInfo& item)
139 {

Callers 1

ImpControlFunction · 0.85

Calls 6

GetJointPositionFunction · 0.85
GetOrientToPointFunction · 0.85
GetRandomControlFunction · 0.85
CreateNewEffectFunction · 0.85
EulerAnglesClass · 0.70
ToVector3Method · 0.45

Tested by

no test coverage detected