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

Function grenade_hit_callback

ogsr_engine/xrGame/Explosive.cpp:171–204  ·  view source on GitHub ↗

проверка на попадание "осколком" по объекту

Source from the content-addressed store, hash-verified

169};
170//проверка на попадание "осколком" по объекту
171ICF static BOOL grenade_hit_callback(collide::rq_result& result, LPVOID params)
172{
173 SExpQParams& ep = *(SExpQParams*)params;
174 u16 mtl_idx = GAMEMTL_NONE_IDX;
175 if (result.O)
176 {
177 IKinematics* V = 0;
178 if (0 != (V = smart_cast<IKinematics*>(result.O->Visual())))
179 {
180 CBoneData& B = V->LL_GetData((u16)result.element);
181 mtl_idx = B.game_mtl_idx;
182 }
183 }
184 else
185 {
186 //получить треугольник и узнать его материал
187 CDB::TRI* T = Level().ObjectSpace.GetStaticTris() + result.element;
188 mtl_idx = T->material;
189 }
190 SGameMtl* mtl = GMLib.GetMaterialByIdx(mtl_idx);
191 ep.shoot_factor *= mtl->fShootFactor;
192#ifdef DEBUG
193 if (ph_dbg_draw_mask.test(phDbgDrawExplosions))
194 {
195 Fvector p;
196 p.set(ep.l_dir);
197 p.mul(result.range);
198 p.add(ep.source_p);
199 u8 c = u8(mtl->fShootFactor * 255.f);
200 DBG_DrawPoint(p, 0.1f, D3DCOLOR_XRGB(255 - c, 0, c));
201 }
202#endif
203 return (ep.shoot_factor > 0.01f);
204}
205
206float CExplosive::ExplosionEffect(collide::rq_results& storage, CExplosive* exp_obj, CPhysicsShellHolder* blasted_obj, const Fvector& expl_centre, const float expl_radius)
207{

Callers

nothing calls this directly

Calls 6

DBG_DrawPointFunction · 0.85
VisualMethod · 0.80
testMethod · 0.45
setMethod · 0.45
mulMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected