void CCustomZone::StopObjectIdleParticles(CGameObject* pObject) { if (m_zone_flags.test(eIdleObjectParticlesDontStop) && !pObject->cast_actor()) return; CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pObject); if(!PP) return; OBJECT_INFO_VEC_IT it = std::find(m_ObjectInfoMap.begin(),m_ObjectInfoMap.end(),pObject); if(m_ObjectInfoMap.end() == it) return; shared_str particle_str = NULL; //разные партиклы для объектов разного размера if(pObject->Radius()<SMALL_OBJECT_RADIUS) { if(!m_sIdleObjectParticlesSmall) return; particle_str = m_sIdleObjectParticlesSmall; } else { if(!m_sIdleObjectParticlesBig) return; particle_str = m_sIdleObjectParticlesBig; } PP->StopParticles (particle_str, BI_NONE, true); }
bool CTeleWhirlwindObject::destroy_object (const Fvector dir,float val) { CPHDestroyable* D=object->ph_destroyable(); if(D) { D->PhysicallyRemoveSelf(); D->Destroy(m_telekinesis->OwnerObject()->ID()); //. m_telekinesis->add_impact(dir,val*10.f); xr_vector<shared_str>::iterator i = D->m_destroyed_obj_visual_names.begin(); xr_vector<shared_str>::iterator e = D->m_destroyed_obj_visual_names.end(); if (IsGameTypeSingle()) { for(;e!=i;i++) m_telekinesis->add_impact(dir,val*10.f); }; CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(object); if(PP) { u16 root=(smart_cast<IKinematics*>(object->Visual()))->LL_GetBoneRoot(); PP->StartParticles(m_telekinesis->destroing_particles(),root, Fvector().set(0,1,0),m_telekinesis->OwnerObject()->ID()); } return true; } return false; }
void CCustomZone::PlayObjectIdleParticles(CGameObject* pObject) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pObject); if(!PP) return; shared_str particle_str = NULL; //разные партиклы для объектов разного размера if(pObject->Radius()<SMALL_OBJECT_RADIUS) { if(!m_sIdleObjectParticlesSmall) return; particle_str = m_sIdleObjectParticlesSmall; } else { if(!m_sIdleObjectParticlesBig) return; particle_str = m_sIdleObjectParticlesBig; } //запустить партиклы на объекте //. new PP->StopParticles (particle_str, BI_NONE, true); PP->StartParticles (particle_str, Fvector().set(0,1,0), ID()); if (!IsEnabled()) PP->StopParticles (particle_str, BI_NONE, true); }
void CCustomZone::PlayHitParticles(CGameObject* pObject) { m_hit_sound.play_at_pos(0, pObject->Position()); shared_str particle_str = NULL; if(pObject->Radius()<SMALL_OBJECT_RADIUS) { if(!m_sHitParticlesSmall) return; particle_str = m_sHitParticlesSmall; } else { if(!m_sHitParticlesBig) return; particle_str = m_sHitParticlesBig; } if( particle_str.size() ) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pObject); if (PP){ u16 play_bone = PP->GetRandomBone(); if (play_bone!=BI_NONE) PP->StartParticles (particle_str,play_bone,Fvector().set(0,1,0), ID()); } } }
void CBurer::StartTeleObjectParticle(CGameObject *pO) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pO); if(!PP) return; PP->StartParticles (particle_tele_object, Fvector().set(0.0f, 0.1f, 0.0f), pO->ID()); }
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 CScriptGameObject::start_particles(LPCSTR pname, LPCSTR bone) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(&object()); if (!PP) return; IKinematics* K = smart_cast<IKinematics*>(object().Visual()); R_ASSERT(K); u16 play_bone = K->LL_BoneID(bone); R_ASSERT(play_bone != BI_NONE); if (K->LL_GetBoneVisible(play_bone)) PP->StartParticles(pname, play_bone, Fvector().set(0, 1, 0), 9999); else ai().script_engine().script_log(ScriptStorage::eLuaMessageTypeError, "Cant start particles, bone [%s] is not visible now", bone); }
bool CTeleWhirlwindObject::destroy_object (const Fvector dir,float val) { CPHDestroyable* D=object->ph_destroyable(); if(D) { D->PhysicallyRemoveSelf(); D->Destroy(m_telekinesis->OwnerObject()->ID()); m_telekinesis->add_impact(dir,val*10.f); CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(object); if(PP) { u16 root=(smart_cast<CKinematics*>(object->Visual()))->LL_GetBoneRoot(); PP->StartParticles(m_telekinesis->destroing_particles(),root, Fvector().set(0,1,0),m_telekinesis->OwnerObject()->ID()); } return true; } return false; }
void CBaseGraviZone::StopTeleParticles(CGameObject* pObject) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pObject); if(!PP) return; shared_str particle_str = NULL; //разные партиклы дл¤ объектов разного размера if(pObject->Radius()<SMALL_OBJECT_RADIUS) { if(!m_sTeleParticlesSmall) return; particle_str = m_sTeleParticlesSmall; } else { if(!m_sTeleParticlesBig) return; particle_str = m_sTeleParticlesBig; } //остановить партиклы PP->StopParticles (particle_str, BI_NONE, true); }
void CBaseGraviZone::PlayTeleParticles(CGameObject* pObject) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pObject); if(!PP) return; shared_str particle_str = NULL; //разные партиклы дл¤ объектов разного размера if(pObject->Radius()<SMALL_OBJECT_RADIUS) { if(!m_sTeleParticlesSmall) return; particle_str = m_sTeleParticlesSmall; } else { if(!m_sTeleParticlesBig) return; particle_str = m_sTeleParticlesBig; } PP->StartParticles(particle_str, Fvector().set(0,1,0), ID()); }
void CMincer::NotificateDestroy (CPHDestroyableNotificate *dn) { Fvector dir = {0,0,0}; float impulse = 0; //if(!m_telekinetics.has_impacts()) return; //CObject* obj=Level().Objects.net_Find(id); CPhysicsShellHolder* obj=dn->PPhysicsShellHolder(); m_telekinetics.draw_out_impact(dir,impulse); CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(obj); if(PP && *m_torn_particles) { PP->StartParticles(m_torn_particles,Fvector().set(0,1,0),ID()); } m_tearing_sound.play_at_pos(0,m_telekinetics.Center()); Fvector position_in_bone_space, throw_in_dir; position_in_bone_space.set (0.0f, 0.0f, 0.0f); throw_in_dir.set (1.0f, 0.0f, 1.0f); CreateHit(obj->ID(),ID(),throw_in_dir,0.0f,0,position_in_bone_space,impulse,ALife::eHitTypeExplosion); }
void CBurer::StopTeleObjectParticle(CGameObject *pO) { CParticlesPlayer* PP = smart_cast<CParticlesPlayer*>(pO); if(!PP) return; PP->StopParticles (particle_tele_object, BI_NONE, true); }