MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / DynamicObjectHit

Method DynamicObjectHit

ogsr_engine/xrGame/Level_bullet_manager_firetrace.cpp:274–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272
273static bool g_clear = false;
274void CBulletManager::DynamicObjectHit(CBulletManager::_event& E)
275{
276 //только для динамических объектов
277 VERIFY(E.R.O);
278 if (g_clear)
279 E.Repeated = false;
280 E.Repeated = false;
281 bool NeedShootmark =
282 (E.bullet.hit_type == ALife::eHitTypeFireWound || E.bullet.hit_type == ALife::eHitTypeWound || E.bullet.hit_type == ALife::eHitTypeWound_2); // true;//!E.Repeated;
283
284 if (smart_cast<CActor*>(E.R.O))
285 {
286 /*game_PlayerState* ps = Game().GetPlayerByGameID(E.R.O->ID());
287 if (ps && ps->testFlag(GAME_PLAYER_FLAG_INVINCIBLE))
288 {
289 NeedShootmark = false;
290 };*/
291 }
292 else if (CBaseMonster* monster = smart_cast<CBaseMonster*>(E.R.O))
293 {
294 NeedShootmark = (NeedShootmark && monster->need_shotmark());
295 }
296
297 //визуальное обозначение попадание на объекте
298 // Fvector hit_normal;
299 FireShotmark(&E.bullet, E.bullet.dir, E.point, E.R, E.tgt_material, E.normal, NeedShootmark);
300
301 Fvector original_dir = E.bullet.dir;
302 float power, impulse;
303 std::pair<float, float> hit_result = E.result; // ObjectHit(&E.bullet, E.end_point, E.R, E.tgt_material, hit_normal);
304 power = hit_result.first;
305 impulse = hit_result.second;
306
307 // object-space
308 //вычислить координаты попадания
309 Fvector p_in_object_space, position_in_bone_space;
310 Fmatrix m_inv;
311 m_inv.invert(E.R.O->XFORM());
312 m_inv.transform_tiny(p_in_object_space, E.point);
313
314 // bone-space
315 IKinematics* V = smart_cast<IKinematics*>(E.R.O->Visual());
316
317 if (V)
318 {
319 VERIFY3(V->LL_GetBoneVisible(u16(E.R.element)), *E.R.O->cNameVisual(), V->LL_BoneName(u16(E.R.element)));
320 Fmatrix& m_bone = (V->LL_GetBoneInstance(u16(E.R.element))).mTransform;
321 Fmatrix m_inv_bone;
322 m_inv_bone.invert(m_bone);
323 m_inv_bone.transform_tiny(position_in_bone_space, p_in_object_space);
324 }
325 else
326 {
327 position_in_bone_space.set(p_in_object_space);
328 }
329
330 //отправить хит пораженному объекту
331 if (E.bullet.flags.allow_sendhit && !E.Repeated)

Callers

nothing calls this directly

Calls 10

transform_tinyMethod · 0.80
VisualMethod · 0.80
LL_GetBoneVisibleMethod · 0.80
LL_BoneNameMethod · 0.80
GenHeaderMethod · 0.80
Write_PacketMethod · 0.80
SHitClass · 0.70
need_shotmarkMethod · 0.45
invertMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected