MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Simulate

Method Simulate

engine/Poseidon/UI/DisplayUIMenus.cpp:237–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235 GetHead()->Deanimate(*GetHeadType(), GetHeadShape(), level, false, M3Identity, false);
236}
237
238void CHead::Simulate()
239{
240 UITime time = Glob.uiTime;
241 const float t0 = 4.0;
242 float oldT = fastFmod(_lastSimulation.toFloat(), t0);
243 float newT = fastFmod(time.toFloat(), t0);
244 float angle = (H_PI * 2.0 / t0) * newT;
245 Matrix3 orient(MRotationY, angle);
246 float scale = Scale();
247 SetOrientation(orient);
248 SetScale(scale);
249
250 const float tChange = 0.5 * t0;
251 if (oldT < tChange && newT >= tChange)
252 {
253 int size = (Pars >> "CfgMimics" >> "States").GetEntryCount();
254 int i = toIntFloor(size * GRandGen.RandomValue());
255 GetHead()->SetMimic((Pars >> "CfgMimics" >> "States").GetEntry(i).GetName());
256 }
257
258 GetHead()->Simulate(*GetHeadType(), time - _lastSimulation, SimulateVisibleNear, false);
259 _lastSimulation = time;
260}
261
262void CHead::SetFace(RString name)

Callers 1

OnSimulateMethod · 0.45

Calls 6

fastFmodFunction · 0.85
toFloatMethod · 0.80
SetMimicMethod · 0.80
GetEntryCountMethod · 0.45
RandomValueMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected