void CBlackGraviArtefact::UpdateCLChild() { VERIFY(!ph_world->Processing()); inherited::UpdateCLChild (); if (getVisible() && m_pPhysicsShell) { if (m_bStrike) { Fvector P; P.set(Position()); feel_touch_update(P,m_fRadius); GraviStrike(); CParticlesObject* pStaticPG; pStaticPG = CParticlesObject::Create(*m_sParticleName,TRUE); Fmatrix pos; pos.set(XFORM()); Fvector vel; //vel.sub(Position(),ps_Element(0).vPosition); //vel.div((Level().timeServer()-ps_Element(0).dwTime)/1000.f); vel.set(0,0,0); pStaticPG->UpdateParent(pos, vel); pStaticPG->Play(); m_bStrike = false; } }else if(H_Parent()) XFORM().set(H_Parent()->XFORM()); }
void CBurer::Hit (SHit* pHDS) { if ( m_shield_active && pHDS->hit_type == ALife::eHitTypeFireWound && Device.dwFrame != last_hit_frame ) { // вычислить позицию и направленность партикла Fmatrix pos; //CParticlesPlayer::MakeXFORM(this,element,Fvector().set(0.f,0.f,1.f),p_in_object_space,pos); CParticlesPlayer::MakeXFORM (this,pHDS->bone(),pHDS->dir,pHDS->p_in_bone_space,pos); // установить particles CParticlesObject* ps = CParticlesObject::Create(particle_fire_shield,TRUE); ps->UpdateParent (pos,Fvector().set(0.f,0.f,0.f)); GamePersistent().ps_needtoplay.push_back (ps); } else if ( !m_shield_active ) { inherited::Hit (pHDS); } last_hit_frame = Device.dwFrame; }
CParticlesObject* CPhantom::PlayParticles(const shared_str& name, BOOL bAutoRemove, const Fmatrix& xform) { CParticlesObject* ps = CParticlesObject::Create(name.c_str(),bAutoRemove); ps->UpdateParent (xform, zero_vel); ps->Play (false); return bAutoRemove?0:ps; }
void CCustomZone::PlayBoltEntranceParticles() { CCF_Shape* Sh = (CCF_Shape*)CFORM(); const Fmatrix& XF = XFORM(); Fmatrix PXF; xr_vector<CCF_Shape::shape_def>& Shapes = Sh->Shapes(); Fvector sP0, sP1, vel; CParticlesObject* pParticles = NULL; xr_vector<CCF_Shape::shape_def>::iterator it = Shapes.begin(); xr_vector<CCF_Shape::shape_def>::iterator it_e = Shapes.end(); for(;it!=it_e;++it) { CCF_Shape::shape_def& s = *it; switch (s.type) { case 0: // sphere { sP0 = s.data.sphere.P; XF.transform_tiny (sP0); float ki = 10.0f * s.data.sphere.R; float c = 2.0f * s.data.sphere.R; float quant_h = (PI_MUL_2/float(ki))*c; float quant_p = (PI_DIV_2/float(ki)); for(float i=0; i<ki; ++i) { vel.setHP ( ::Random.randF(quant_h/2.0f, quant_h)*i, ::Random.randF(quant_p/2.0f, quant_p)*i ); vel.mul (s.data.sphere.R); sP1.add (sP0, vel); PXF.identity (); PXF.k.normalize (vel); Fvector::generate_orthonormal_basis(PXF.k, PXF.j, PXF.i); PXF.c = sP1; pParticles = CParticlesObject::Create(m_sBoltEntranceParticles.c_str(), TRUE); pParticles->UpdateParent(PXF,vel); pParticles->Play (false); } }break; case 1: // box break; } } }
void CCustomZone::PlayBlowoutParticles() { if(!m_sBlowoutParticles) return; CParticlesObject* pParticles; pParticles = CParticlesObject::Create(*m_sBlowoutParticles,TRUE); pParticles->UpdateParent(XFORM(),zero_vel); pParticles->Play(false); }
void CBulletManager::PlayExplodePS (const Fmatrix& xf) { if (!m_ExplodeParticles.empty()){ const shared_str& ps_name = m_ExplodeParticles[Random.randI(0, m_ExplodeParticles.size())]; CParticlesObject* ps = CParticlesObject::Create(*ps_name,TRUE); ps->UpdateParent(xf,zero_vel); GamePersistent().ps_needtoplay.push_back(ps); } }
void CCustomZone::PlayEntranceParticles(CGameObject* pObject) { m_entrance_sound.play_at_pos (0, pObject->Position()); LPCSTR particle_str = NULL; if(pObject->Radius()<SMALL_OBJECT_RADIUS) { if(!m_sEntranceParticlesSmall) return; particle_str = m_sEntranceParticlesSmall.c_str(); } else { if(!m_sEntranceParticlesBig) return; particle_str = m_sEntranceParticlesBig.c_str(); } Fvector vel; CPhysicsShellHolder* shell_holder=smart_cast<CPhysicsShellHolder*>(pObject); if(shell_holder) shell_holder->PHGetLinearVell(vel); else vel.set (0,0,0); //выбрать случайную косточку на объекте CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pObject); if (PP) { u16 play_bone = PP->GetRandomBone(); if (play_bone!=BI_NONE) { CParticlesObject* pParticles = CParticlesObject::Create(particle_str, TRUE); Fmatrix xform; Fvector dir; if(fis_zero (vel.magnitude())) dir.set (0,1,0); else { dir.set (vel); dir.normalize (); } PP->MakeXFORM (pObject,play_bone,dir,Fvector().set(0,0,0),xform); pParticles->UpdateParent(xform, vel); pParticles->Play (false); } } if(m_zone_flags.test(eBoltEntranceParticles) && smart_cast<CBolt*>(pObject)) PlayBoltEntranceParticles(); }
void CCustomZone::PlayAwakingParticles() { if(m_sAwakingParticles.size()) { CParticlesObject* pParticles; pParticles = CParticlesObject::Create(*m_sAwakingParticles,TRUE); pParticles->UpdateParent(XFORM(),zero_vel); pParticles->Play(false); } if(m_awaking_sound._handle()) m_awaking_sound.play_at_pos (0, Position()); }
virtual void run () { CParticlesObject* ps = CParticlesObject::Create(ps_name,TRUE); Fmatrix pos; Fvector zero_vel = {0.f,0.f,0.f}; pos.k.set(*((Fvector*)c.normal)); Fvector::generate_orthonormal_basis(pos.k, pos.j, pos.i); pos.c.set(*((Fvector*)c.pos)); ps->UpdateParent(pos,zero_vel); GamePersistent().ps_needtoplay.push_back(ps); };
void CShootingObject::OnShellDrop (const Fvector& play_pos, const Fvector& parent_vel) { if(!m_sShellParticles) return; if( Device.vCameraPosition.distance_to_sqr(play_pos)>2*2 ) return; CParticlesObject* pShellParticles = CParticlesObject::Create(*m_sShellParticles,TRUE); Fmatrix particles_pos; particles_pos.set (get_ParticlesXFORM()); particles_pos.c.set (play_pos); pShellParticles->UpdateParent (particles_pos, parent_vel); pShellParticles->Play (); }
void CCustomZone::PlayBulletParticles(Fvector& pos) { m_entrance_sound.play_at_pos(0, pos); if(!m_sEntranceParticlesSmall) return; CParticlesObject* pParticles; pParticles = CParticlesObject::Create(*m_sEntranceParticlesSmall,TRUE); Fmatrix M; M = XFORM(); M.c.set(pos); pParticles->UpdateParent(M,zero_vel); pParticles->Play(false); }
CParticlesObject* CBaseMonster::PlayParticles(const shared_str& name, const Fvector &position, const Fvector &dir, BOOL auto_remove, BOOL xformed) { CParticlesObject* ps = CParticlesObject::Create(name.c_str(),auto_remove); // вычислить позицию и направленность партикла Fmatrix matrix; matrix.identity (); matrix.k.set (dir); Fvector::generate_orthonormal_basis_normalized(matrix.k,matrix.j,matrix.i); matrix.translate_over (position); (xformed) ? ps->SetXFORM (matrix) : ps->UpdateParent(matrix,zero_vel); ps->Play (false); return ps; }
void game_cl_Deathmatch::PlayParticleEffect(LPCSTR EffName, Fvector& pos) { if (!EffName) return; // вычислить позицию и направленность партикла Fmatrix M; M.translate(pos); // CParticlesPlayer::MakeXFORM(pObj,0,Fvector().set(0.f,1.f,0.f),Fvector().set(0.f,0.f,0.f),pos); // установить particles CParticlesObject* ps = NULL; ps = CParticlesObject::Create(EffName,TRUE); ps->UpdateParent(M,Fvector().set(0.f,0.f,0.f)); GamePersistent().ps_needtoplay.push_back(ps); }
void CBottleItem::BreakToPieces() { //играем звук sndBreaking.play_at_pos(0, Position(), false); //отыграть партиклы разбивания if(*m_sBreakParticles) { //показываем эффекты CParticlesObject* pStaticPG; pStaticPG = CParticlesObject::Create(*m_sBreakParticles,TRUE); pStaticPG->play_at_pos(Position()); } //ликвидировать сам объект if (Local()) { DestroyObject (); } }
void CShootingObject::OnShellDrop (const Fvector& play_pos, const Fvector& parent_vel) { if(!m_sShellParticles) return; if( Device.vCameraPosition.distance_to_sqr(play_pos)>2*2 ) return; CParticlesObject* pShellParticles = CParticlesObject::Create(*m_sShellParticles,TRUE); Fmatrix particles_pos; particles_pos.set (get_ParticlesXFORM()); particles_pos.c.set (play_pos); pShellParticles->UpdateParent (particles_pos, parent_vel); CSpectator* tmp_spectr = smart_cast<CSpectator*>(Level().CurrentControlEntity()); bool in_hud_mode = IsHudModeNow(); if (in_hud_mode && tmp_spectr && (tmp_spectr->GetActiveCam() != CSpectator::eacFirstEye)) { in_hud_mode = false; } pShellParticles->Play(in_hud_mode); }
BOOL CBlackGraviArtefact::net_Spawn(CSE_Abstract* DC) { if(!inherited::net_Spawn(DC)) return FALSE; CParticlesObject* pStaticPG; pStaticPG = CParticlesObject::Create("anomaly\\galantine",FALSE); Fmatrix pos; //pos.rotateY(1.57); //pos.mulA(pos); pos.scale(0.7f,0.7f,0.7f); pos.translate_over(XFORM().c); Fvector vel; vel.set(0,0,0); pStaticPG->UpdateParent(pos, vel); pStaticPG->Play(); return TRUE; }
void CActor::Hit (SHit* pHDS) { pHDS->aim_bullet = false; SHit HDS = *pHDS; if( HDS.hit_type<ALife::eHitTypeBurn || HDS.hit_type >= ALife::eHitTypeMax ) { string256 err; sprintf (err, "Unknown/unregistered hit type [%d]", HDS.hit_type); R_ASSERT2 (0, err ); } #ifdef DEBUG if(ph_dbg_draw_mask.test(phDbgCharacterControl)) { DBG_OpenCashedDraw(); Fvector to;to.add(Position(),Fvector().mul(HDS.dir,HDS.phys_impulse())); DBG_DrawLine(Position(),to,D3DCOLOR_XRGB(124,124,0)); DBG_ClosedCashedDraw(500); } #endif bool bPlaySound = true; if (!g_Alive()) bPlaySound = false; if (!IsGameTypeSingle() && !g_pGamePersistent->bDedicatedServer) { game_PlayerState* ps = Game().GetPlayerByGameID(ID()); if (ps && ps->testFlag(GAME_PLAYER_FLAG_INVINCIBLE)) { bPlaySound = false; if (Device.dwFrame != last_hit_frame && HDS.bone() != BI_NONE) { // вычислить позицию и направленность партикла Fmatrix pos; CParticlesPlayer::MakeXFORM(this,HDS.bone(),HDS.dir,HDS.p_in_bone_space,pos); // установить particles CParticlesObject* ps = NULL; if (eacFirstEye == cam_active && this == Level().CurrentEntity()) ps = CParticlesObject::Create(invincibility_fire_shield_1st,TRUE); else ps = CParticlesObject::Create(invincibility_fire_shield_3rd,TRUE); ps->UpdateParent(pos,Fvector().set(0.f,0.f,0.f)); GamePersistent().ps_needtoplay.push_back(ps); }; }; last_hit_frame = Device.dwFrame; }; if( !g_pGamePersistent->bDedicatedServer && !sndHit[HDS.hit_type].empty() && (ALife::eHitTypeTelepatic != HDS.hit_type)) { ref_sound& S = sndHit[HDS.hit_type][Random.randI(sndHit[HDS.hit_type].size())]; bool b_snd_hit_playing = sndHit[HDS.hit_type].end() != std::find_if(sndHit[HDS.hit_type].begin(), sndHit[HDS.hit_type].end(), playing_pred()); if(ALife::eHitTypeExplosion == HDS.hit_type) { if (this == Level().CurrentControlEntity()) { S.set_volume(10.0f); if(!m_sndShockEffector){ m_sndShockEffector = xr_new<SndShockEffector>(); m_sndShockEffector->Start(this, float(S._handle()->length_ms()), HDS.damage() ); } } else bPlaySound = false; } if (bPlaySound && !b_snd_hit_playing) { Fvector point = Position(); point.y += CameraHeight(); S.play_at_pos (this, point); }; } //slow actor, only when he gets hit if(HDS.hit_type == ALife::eHitTypeWound || HDS.hit_type == ALife::eHitTypeStrike) { hit_slowmo = HDS.damage(); clamp (hit_slowmo,0.0f,1.f); } else hit_slowmo = 0.f; //--------------------------------------------------------------- if (Level().CurrentViewEntity() == this && !g_pGamePersistent->bDedicatedServer && HDS.hit_type == ALife::eHitTypeFireWound) { CObject* pLastHitter = Level().Objects.net_Find(m_iLastHitterID); CObject* pLastHittingWeapon = Level().Objects.net_Find(m_iLastHittingWeaponID); HitSector(pLastHitter, pLastHittingWeapon); }; if ((mstate_real&mcSprint) && Level().CurrentControlEntity() == this && HDS.hit_type != ALife::eHitTypeTelepatic && HDS.hit_type != ALife::eHitTypeRadiation ) { // mstate_real &=~mcSprint; mstate_wishful &=~mcSprint; }; if(!g_pGamePersistent->bDedicatedServer) { HitMark (HDS.damage(), HDS.dir, HDS.who, HDS.bone(), HDS.p_in_bone_space, HDS.impulse, HDS.hit_type); } switch (GameID()) { case GAME_SINGLE: { float hit_power = HitArtefactsOnBelt(HDS.damage(), HDS.hit_type); if (GodMode())//psActorFlags.test(AF_GODMODE)) { HDS.power = 0.0f; // inherited::Hit(0.f,dir,who,element,position_in_bone_space,impulse, hit_type); inherited::Hit(&HDS); return; } else { //inherited::Hit (hit_power,dir,who,element,position_in_bone_space, impulse, hit_type); HDS.power = hit_power; inherited::Hit(&HDS); }; } break; default: { m_bWasBackStabbed = false; if (HDS.hit_type == ALife::eHitTypeWound_2 && Check_for_BackStab_Bone(HDS.bone())) { // convert impulse into local coordinate system Fmatrix mInvXForm; mInvXForm.invert (XFORM()); Fvector vLocalDir; mInvXForm.transform_dir (vLocalDir,HDS.dir); vLocalDir.invert (); Fvector a = {0,0,1}; float res = a.dotproduct(vLocalDir); if (res < -0.707) { game_PlayerState* ps = Game().GetPlayerByGameID(ID()); if (!ps || !ps->testFlag(GAME_PLAYER_FLAG_INVINCIBLE)) m_bWasBackStabbed = true; } }; float hit_power = 0; if (m_bWasBackStabbed) hit_power = 100000; else hit_power = HitArtefactsOnBelt(HDS.damage(), HDS.hit_type); HDS.power = hit_power; inherited::Hit (&HDS); //inherited::Hit (hit_power,dir,who,element,position_in_bone_space, impulse, hit_type, 0.0f); } break; } }
void CBastArtefact::UpdateCLChild() { //Log ("--- A - CBastArtefact",*cName()); //Log ("--- A - CBastArtefact",renderable.xform); //современем энергия по немногу тоже уменьшается if(m_fEnergy>0) m_fEnergy -= m_fEnergyDecreasePerTime*Device.fTimeDelta; if (getVisible() && m_pPhysicsShell) { if(m_bStrike) { //выбрать жертву, если она еще не выбрана if(!m_AliveList.empty() && m_AttakingEntity == NULL) { CEntityAlive* pEntityToHit = NULL; if(m_AliveList.size()>1) { do { int rnd = ::Random.randI(m_AliveList.size()); pEntityToHit = m_AliveList[rnd]; } while (pEntityToHit == m_pHitedEntity); } else { pEntityToHit = m_AliveList.front(); } m_AttakingEntity = pEntityToHit; } } if(m_AttakingEntity) { if(m_AttakingEntity->g_Alive() && m_fEnergy>m_fStrikeImpulse) { m_fEnergy -= m_fStrikeImpulse; //бросить артефакт на выбранную цель Fvector dir; m_AttakingEntity->Center(dir); dir.sub(this->Position()); dir.y += ::Random.randF(-0.05f, 0.5f); m_pPhysicsShell->applyImpulse(dir, m_fStrikeImpulse * Device.fTimeDelta * m_pPhysicsShell->getMass()); } else { m_AttakingEntity = NULL; m_bStrike = false; } } if(m_fEnergy>0 && ::Random.randF(0.f, 1.0f)<(m_fEnergy/(m_fStrikeImpulse*100.f))) { CParticlesObject* pStaticPG; pStaticPG = CParticlesObject::Create(*m_sParticleName,TRUE); Fmatrix pos; pos.set(XFORM()); Fvector vel; //vel.sub(Position(),ps_Element(0).vPosition); //vel.div((Level().timeServer()-ps_Element(0).dwTime)/1000.f); vel.set(0,0,0); pStaticPG->UpdateParent(pos, vel); pStaticPG->Play(); } } else if(H_Parent()) XFORM().set(H_Parent()->XFORM()); }
void CBurer::UpdateGraviObject() { if ( !m_gravi_object.active ) { return; } if ( !m_gravi_object.enemy || (m_gravi_object.enemy && m_gravi_object.enemy->getDestroy()) ) { m_gravi_object.deactivate(); return; } if ( m_gravi_object.from_pos.distance_to(m_gravi_object.cur_pos) > m_gravi_object.from_pos.distance_to(m_gravi_object.target_pos) ) { m_gravi_object.deactivate(); return; } float dt = float(Device.dwTimeGlobal - m_gravi_object.time_last_update); float dist = dt * float(m_gravi.speed)/1000.f; if (dist < m_gravi.step) return; Fvector new_pos; Fvector dir; dir.sub(m_gravi_object.target_pos,m_gravi_object.cur_pos); dir.normalize(); new_pos.mad(m_gravi_object.cur_pos,dir,dist); // Trace to enemy Fvector enemy_center; m_gravi_object.enemy->Center(enemy_center); dir.sub(enemy_center, new_pos); dir.normalize(); float trace_dist = float(m_gravi.step); collide::rq_result l_rq; if (Level().ObjectSpace.RayPick(new_pos, dir, trace_dist, collide::rqtBoth, l_rq, NULL)) { const CObject *enemy = smart_cast<const CObject *>(m_gravi_object.enemy); if ((l_rq.O == enemy) && (l_rq.range < trace_dist)) { // check for visibility bool b_enemy_visible = false; xr_vector<CObject *> visible_objects; feel_vision_get(visible_objects); // find object for (u32 i = 0; i<visible_objects.size(); i++) { if (visible_objects[i] == enemy) { b_enemy_visible = true; break; } } if (b_enemy_visible) { Fvector impulse_dir; impulse_dir.set(0.0f,0.0f,1.0f); impulse_dir.normalize(); HitEntity(m_gravi_object.enemy, m_gravi.hit_power, m_gravi.impulse_to_enemy, impulse_dir, ALife::eHitTypeStrike, false); m_gravi_object.deactivate(); return; } } } m_gravi_object.cur_pos = new_pos; m_gravi_object.time_last_update = Device.dwTimeGlobal; // --------------------------------------------------------------------- // draw particle CParticlesObject* ps = CParticlesObject::Create(particle_gravi_wave,TRUE); // вычислить позицию и направленность партикла Fmatrix pos; pos.identity(); pos.k.set(dir); Fvector::generate_orthonormal_basis_normalized(pos.k,pos.j,pos.i); // установить позицию pos.translate_over(m_gravi_object.cur_pos); ps->UpdateParent(pos, zero_vel); ps->Play(false); // hit objects m_nearest.clear_not_free (); Level().ObjectSpace.GetNearest (m_nearest,m_gravi_object.cur_pos, m_gravi.radius, NULL); //xr_vector<CObject*> &m_nearest = Level().ObjectSpace.q_nearest; for (u32 i=0;i<m_nearest.size();i++) { CPhysicsShellHolder *obj = smart_cast<CPhysicsShellHolder *>(m_nearest[i]); if (!obj || !obj->m_pPhysicsShell) continue; Fvector dir; dir.sub(obj->Position(), m_gravi_object.cur_pos); dir.normalize(); obj->m_pPhysicsShell->applyImpulse(dir,m_gravi.impulse_to_objects * obj->m_pPhysicsShell->getMass()); } // играть звук Fvector snd_pos = m_gravi_object.cur_pos; snd_pos.y += 0.5f; if (sound_gravi_wave._feedback()) { sound_gravi_wave.set_position (snd_pos); } else ::Sound->play_at_pos (sound_gravi_wave,0,snd_pos); }
void CExplosive::Explode() { VERIFY(0xffff != Initiator()); VERIFY(m_explosion_flags.test(flReadyToExplode));//m_bReadyToExplode VERIFY(!ph_world->Processing()); //m_bExploding = true; m_explosion_flags.set(flExploding,TRUE); cast_game_object()->processing_activate(); Fvector& pos = m_vExplodePos; Fvector& dir = m_vExplodeDir; #ifdef DEBUG if(ph_dbg_draw_mask.test(phDbgDrawExplosions)) { DBG_OpenCashedDraw(); DBG_DrawPoint(pos,0.3f,D3DCOLOR_XRGB(255,0,0)); } #endif // Msg("---------CExplosive Explode [%d] frame[%d]",cast_game_object()->ID(), Device.dwFrame); OnBeforeExplosion(); //играем звук взрыва Sound->play_at_pos(sndExplode, 0, pos, false); //показываем эффекты m_wallmark_manager.PlaceWallmarks (pos); Fvector vel; smart_cast<CPhysicsShellHolder*>(cast_game_object())->PHGetLinearVell(vel); Fmatrix explode_matrix; explode_matrix.identity(); explode_matrix.j.set(dir); Fvector::generate_orthonormal_basis(explode_matrix.j, explode_matrix.i, explode_matrix.k); explode_matrix.c.set(pos); CParticlesObject* pStaticPG; pStaticPG = CParticlesObject::Create(*m_sExplodeParticles,!m_bDynamicParticles); if (m_bDynamicParticles) m_pExpParticle = pStaticPG; pStaticPG->UpdateParent(explode_matrix,vel); pStaticPG->Play(); //включаем подсветку от взрыва StartLight(); //trace frags Fvector frag_dir; ////////////////////////////// //осколки ////////////////////////////// //------------------------------------- bool SendHits = false; if (OnServer()) SendHits = true; else SendHits = false; for(int i = 0; i < m_iFragsNum; ++i){ frag_dir.random_dir (); frag_dir.normalize (); CCartridge cartridge; cartridge.m_kDist = 1.f; cartridge.m_kHit = 1.f; cartridge.m_kImpulse = 1.f; cartridge.m_kPierce = 1.f; cartridge.fWallmarkSize = fWallmarkSize; cartridge.bullet_material_idx = GMLib.GetMaterialIdx(WEAPON_MATERIAL_NAME); cartridge.m_flags.set (CCartridge::cfTracer,FALSE); Level().BulletManager().AddBullet( pos, frag_dir, m_fFragmentSpeed, m_fFragHit, m_fFragHitImpulse, Initiator(), cast_game_object()->ID(), m_eHitTypeFrag, m_fFragsRadius, cartridge, SendHits ); } if (cast_game_object()->Remote()) return; ///////////////////////////////// //взрывная волна //////////////////////////////// //--------------------------------------------------------------------- xr_vector<ISpatial*> ISpatialResult; g_SpatialSpace->q_sphere(ISpatialResult,0,STYPE_COLLIDEABLE,pos,m_fBlastRadius); m_blasted_objects.clear (); for (u32 o_it=0; o_it<ISpatialResult.size(); o_it++) { ISpatial* spatial = ISpatialResult[o_it]; // feel_touch_new(spatial->dcast_CObject()); CPhysicsShellHolder *pGameObject = smart_cast<CPhysicsShellHolder*>(spatial->dcast_CObject()); if(pGameObject && cast_game_object()->ID() != pGameObject->ID()) m_blasted_objects.push_back(pGameObject); } GetExplosionBox(m_vExplodeSize); START_PROFILE("explosive/activate explosion box") ActivateExplosionBox(m_vExplodeSize,m_vExplodePos); STOP_PROFILE //--------------------------------------------------------------------- #ifdef DEBUG if(ph_dbg_draw_mask.test(phDbgDrawExplosions)) { DBG_ClosedCashedDraw(100000); } #endif ////////////////////////////////////////////////////////////////////////// // Explode Effector ////////////// CGameObject* GO = smart_cast<CGameObject*>(Level().CurrentEntity()); CActor* pActor = smart_cast<CActor*>(GO); if(pActor) { float dist_to_actor = pActor->Position().distance_to(pos); float max_dist = EFFECTOR_RADIUS; if (dist_to_actor < max_dist) AddEffector (pActor, effExplodeHit, effector.effect_sect_name, (max_dist - dist_to_actor) / max_dist ); } }
BOOL CLevel::Load_GameSpecific_After() { // loading static particles string_path fn_game; if (FS.exist(fn_game, "$level$", "level.ps_static")) { IReader *F = FS.r_open (fn_game); CParticlesObject* pStaticParticles; u32 chunk = 0; string256 ref_name; Fmatrix transform; Fvector zero_vel={0.f,0.f,0.f}; for (IReader *OBJ = F->open_chunk_iterator(chunk); OBJ; OBJ = F->open_chunk_iterator(chunk,OBJ)) { OBJ->r_stringZ (ref_name,sizeof(ref_name)); OBJ->r (&transform,sizeof(Fmatrix));transform.c.y+=0.01f; pStaticParticles = CParticlesObject::Create(ref_name,FALSE,false); pStaticParticles->UpdateParent (transform,zero_vel); pStaticParticles->Play (); m_StaticParticles.push_back (pStaticParticles); } FS.r_close (F); } if (!g_dedicated_server) { // loading static sounds VERIFY (m_level_sound_manager); m_level_sound_manager->Load (); // loading sound environment if ( FS.exist(fn_game, "$level$", "level.snd_env")) { IReader *F = FS.r_open (fn_game); ::Sound->set_geometry_env(F); FS.r_close (F); } // loading SOM if (FS.exist(fn_game, "$level$", "level.som")) { IReader *F = FS.r_open (fn_game); ::Sound->set_geometry_som(F); FS.r_close (F); } // loading random (around player) sounds if (pSettings->section_exist("sounds_random")){ CInifile::Sect& S = pSettings->r_section("sounds_random"); Sounds_Random.reserve (S.Data.size()); for (CInifile::SectCIt I=S.Data.begin(); S.Data.end()!=I; ++I) { Sounds_Random.push_back (ref_sound()); Sound->create (Sounds_Random.back(),*I->first,st_Effect,sg_SourceType); } Sounds_Random_dwNextTime= Device.TimerAsync () + 50000; Sounds_Random_Enabled = FALSE; } // Сбрасываем состояния дождя при загрузке уровня во избежание пропажи звука. Real Wolf. if (g_pGamePersistent->pEnvironment) { if (auto rain = g_pGamePersistent->pEnvironment->eff_Rain) { rain->InvalidateState(); } } } if (!g_dedicated_server) { // loading scripts ai().script_engine().remove_script_process(ScriptEngine::eScriptProcessorLevel); if (pLevel->section_exist("level_scripts") && pLevel->line_exist("level_scripts","script")) ai().script_engine().add_script_process(ScriptEngine::eScriptProcessorLevel,xr_new<CScriptProcess>("level",pLevel->r_string("level_scripts","script"))); else ai().script_engine().add_script_process(ScriptEngine::eScriptProcessorLevel,xr_new<CScriptProcess>("level","")); } BlockCheatLoad(); return TRUE; }