| 126 | } |
| 127 | |
| 128 | void CCustomDetectorSHOC::UpdateCL() |
| 129 | { |
| 130 | inherited::UpdateCL(); |
| 131 | |
| 132 | if (!IsWorking()) |
| 133 | return; |
| 134 | |
| 135 | if (!H_Parent()) |
| 136 | return; |
| 137 | |
| 138 | if (!m_pCurrentActor) |
| 139 | return; |
| 140 | |
| 141 | ZONE_INFO_MAP_IT it; |
| 142 | for (it = m_ZoneInfoMap.begin(); m_ZoneInfoMap.end() != it; ++it) |
| 143 | { |
| 144 | CCustomZone* pZone = it->first; |
| 145 | ZONE_INFO_SHOC& zone_info = it->second; |
| 146 | |
| 147 | //такой тип зон не обнаруживается |
| 148 | if (m_ZoneTypeMap.find(pZone->CLS_ID) == m_ZoneTypeMap.end() || !pZone->VisibleByDetector()) |
| 149 | continue; |
| 150 | |
| 151 | ZONE_TYPE_SHOC& zone_type = m_ZoneTypeMap[pZone->CLS_ID]; |
| 152 | |
| 153 | if (xr_strlen(zone_type.zone_map_location)) |
| 154 | { |
| 155 | if (pZone->IsEnabled()) |
| 156 | { |
| 157 | if (!Level().MapManager().HasMapLocation(*zone_type.zone_map_location, pZone->ID())) |
| 158 | Level().MapManager().AddMapLocation(*zone_type.zone_map_location, pZone->ID()); |
| 159 | } |
| 160 | else |
| 161 | { |
| 162 | if (Level().MapManager().HasMapLocation(*zone_type.zone_map_location, pZone->ID())) |
| 163 | Level().MapManager().RemoveMapLocation(*zone_type.zone_map_location, pZone->ID()); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | if (!pZone->IsEnabled()) |
| 168 | continue; |
| 169 | |
| 170 | CSpaceRestrictor* pSR = smart_cast<CSpaceRestrictor*>(pZone); |
| 171 | float dist_to_zone = pSR->distance_to(H_Parent()->Position()); // H_Parent()->Position().distance_to(pZone->Position()) - 0.8f*pZone->Radius(); |
| 172 | if (dist_to_zone > zone_type.m_fRadius) |
| 173 | continue; |
| 174 | |
| 175 | if (dist_to_zone < 0) |
| 176 | dist_to_zone = 0; |
| 177 | |
| 178 | float fRelPow = 1.f - dist_to_zone / zone_type.m_fRadius; |
| 179 | clamp(fRelPow, 0.f, 1.f); |
| 180 | |
| 181 | //определить текущую частоту срабатывания сигнала |
| 182 | zone_info.cur_freq = zone_type.min_freq + (zone_type.max_freq - zone_type.min_freq) * fRelPow * fRelPow * fRelPow * fRelPow; |
| 183 | |
| 184 | float current_snd_time = 1000.f * 1.f / zone_info.cur_freq; |
| 185 |
nothing calls this directly
no test coverage detected