проверка на попадание "осколком" по объекту
| 169 | }; |
| 170 | //проверка на попадание "осколком" по объекту |
| 171 | ICF 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 | |
| 206 | float CExplosive::ExplosionEffect(collide::rq_results& storage, CExplosive* exp_obj, CPhysicsShellHolder* blasted_obj, const Fvector& expl_centre, const float expl_radius) |
| 207 | { |