void CShootingObject::RenderLight() { if ( light_render && light_time>0 ) { Light_Render(get_CurrentFirePoint()); } }
void CHelicopter::MGunFireStart() { if(!m_use_mgun_on_attack) return; if(FALSE==IsWorking() && m_enemy.bUseFireTrail){ //start calc fire trail m_enemy.fStartFireTime = Device.fTimeGlobal; Fvector fp = get_CurrentFirePoint(); Fvector ep = m_enemy.destEnemyPos; //calc min firetrail length float h = fp.y-ep.y; if(h>0.0f){ float dl =h*tan(m_lim_x_rot.y); float ds = fp.distance_to_xz(ep); if(ds>dl){ float half_trail = ds-dl; m_enemy.fire_trail_length_curr = half_trail*2.0f; clamp(m_enemy.fire_trail_length_curr,0.0f,m_enemy.fire_trail_length_des); // Msg("Start fire. Desired length=%f, cur_length=%f",m_enemy.fire_trail_length_des,m_enemy.fire_trail_length_curr); }else m_enemy.fire_trail_length_curr = m_enemy.fire_trail_length_des; }else m_enemy.fire_trail_length_curr = m_enemy.fire_trail_length_des; } CShootingObject::FireStart (); }
void CHelicopter::OnShot () { Fvector fire_pos,fire_dir; fire_pos = get_CurrentFirePoint(); fire_dir = m_fire_dir; float fire_trail_speed = 15.0f; clamp (fire_trail_speed,GetCurrVelocity(),300.0f); if(m_enemy.bUseFireTrail){ Fvector enemy_pos = m_enemy.destEnemyPos; float dt = Device.fTimeGlobal - m_enemy.fStartFireTime; VERIFY(dt>=0); float dist = m_enemy.fire_trail_length_curr - dt*fire_trail_speed; if(dist<0) { MGunFireEnd (); return ; } Fvector fp = fire_pos; fp.y = enemy_pos.y; Fvector fd; fd.sub(enemy_pos,fp).normalize_safe(); if(dist > (m_enemy.fire_trail_length_curr/2.0f) ){ fd.mul(-1.0f); dist = dist - (m_enemy.fire_trail_length_curr/2.0f); }else{ dist = (m_enemy.fire_trail_length_curr/2.0f) - dist; } static float fire_trace_width = pSettings->r_float(*cNameSect(),"fire_trace_width"); enemy_pos.mad(fd,dist); Fvector disp_dir; disp_dir.random_point(fire_trace_width); enemy_pos.add(disp_dir); fire_dir.sub(enemy_pos,fire_pos).normalize_safe(); }; FireBullet(fire_pos, fire_dir, fireDispersionBase, m_CurrentAmmo, ID(), ID(), OnServer()); StartShotParticles (); if(m_bLightShotEnabled) Light_Start (); StartFlameParticles (); StartSmokeParticles (fire_pos, zero_vel); OnShellDrop (fire_pos, zero_vel); HUD_SOUND_ITEM::PlaySound (m_sndShot, fire_pos, this, false); }
void CShootingObject::UpdateFlameParticles () { if(0==m_sFlameParticlesCurrent.size()) return; if(!m_pFlameParticles) return; Fmatrix pos; pos.set (get_ParticlesXFORM() ); pos.c.set (get_CurrentFirePoint() ); m_pFlameParticles->SetXFORM (pos); if(!m_pFlameParticles->IsLooped() && !m_pFlameParticles->IsPlaying() && !m_pFlameParticles->PSI_alive()) { m_pFlameParticles->Stop(); CParticlesObject::Destroy(m_pFlameParticles); } }