DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CalculateLinePointFade()

void CalculateLinePointFade ( )
protected

См. определение в файле UndergroundHandlerClient.c строка 200

201 {
203 JsonUndergroundAreaBreadcrumb startPoint = points[0];
204 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
205 vector playerPos = m_Player.GetPosition();
206
207 bool forceAcco;
208 float acco;
209 float accoMax = m_TransitionalTrigger.m_Data.Breadcrumbs[0].EyeAccommodation;
210 float accoMin = endPoint.EyeAccommodation;
211 JsonUndergroundAreaBreadcrumb closestPoint;
212 JsonUndergroundAreaBreadcrumb secondaryPoint;
213 float distanceToClosest;
214 float distanceToSecondary;
215 float distanceBetweenPoints;
216
217 foreach (JsonUndergroundAreaBreadcrumb point : points) //identify closest segment
218 {
219 float dist = vector.DistanceSq(playerPos, point.GetPosition());
220 if (!closestPoint || dist < distanceToClosest)
221 {
222 if (closestPoint)
223 {
224 secondaryPoint = closestPoint;
225 distanceToSecondary = distanceToClosest;
226 }
227 closestPoint = point;
228 distanceToClosest = dist;
229 }
230 else if (!secondaryPoint || dist < secondaryPoint)
231 {
232 secondaryPoint = point;
233 distanceToSecondary = dist;
234 }
235
236 #ifdef DIAG_DEVELOPER
237 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
238 Debug.DrawSphere(point.GetPosition(),0.1, COLOR_RED, ShapeFlags.ONCE);
239 #endif
240 }
241
242 distanceBetweenPoints = vector.DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
243
244 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints) // before first point, do nothing
245 acco = accoMax;
246 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints) // past second point, do nothing
247 acco = accoMin;
248 else // between the two points, lerp
249 {
250 if (closestPoint == endPoint)
251 secondaryPoint = points[points.Count() - 2];
252 else if (closestPoint == startPoint)
253 secondaryPoint = points[1];
254 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
255 {
256 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
257 if (vector.DistanceSq(playerPos, nexPoint.GetPosition()) < vector.DistanceSq(closestPoint.GetPosition(), nexPoint.GetPosition()))
258 secondaryPoint = nexPoint;
259 else
260 {
261 acco = closestPoint.EyeAccommodation;
262 forceAcco = true;
263 }
264 }
265
266 if (!forceAcco)
267 {
268 distanceToSecondary = vector.DistanceSq(playerPos, secondaryPoint.GetPosition());
269
270 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary); // progress
271 acco = Math.Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
272
273 if (points.Find(closestPoint) > points.Find(secondaryPoint))
274 m_LightingLerpTarget = closestPoint.LightLerp;
275 else
276 m_LightingLerpTarget = secondaryPoint.LightLerp;
277
278 }
279 }
280
282
284 {
285 if (m_LightingLerpTarget == 1)
286 {
288 m_AnimTimerLightBlend.Run(1, this, "OnUpdateTimerIn", "OnUpdateTimerEnd",0, false, LIGHT_BLEND_SPEED_IN);
289 }
290 else
291 {
293 m_AnimTimerLightBlend.Run(0, this, "OnUpdateTimerOut", "OnUpdateTimerEnd",m_LightingLerp, false, LIGHT_BLEND_SPEED_OUT);
294 }
295 }
296
297 #ifdef DIAG_DEVELOPER
298 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
299 {
300 vector headPosition;
301 MiscGameplayFunctions.GetHeadBonePos(m_Player, headPosition);
302 Debug.DrawLine(headPosition, closestPoint.GetPosition(), COLOR_YELLOW, ShapeFlags.ONCE);
303 if (acco != accoMin && acco != accoMax)
304 Debug.DrawLine(closestPoint.GetPosition(), secondaryPoint.GetPosition(), COLOR_RED, ShapeFlags.ONCE);
305
306 DbgUI.Begin(String("Underground Areas"), 20, 20);
307 DbgUI.Text(String("Closest point id: " + points.Find(closestPoint)));
308 DbgUI.Text(String("Second closest id: " + points.Find(secondaryPoint)));
309 DbgUI.End();
310 }
311 #endif
312 }
map m_Player
DiagMenuIDs
Определения EDiagMenuIDs.c:2
ref AnimationTimer m_AnimTimerLightBlend
Определения UndergroundHandlerClient.c:19
UndergroundTrigger m_TransitionalTrigger
Определения UndergroundHandlerClient.c:35
const float ACCO_MODIFIER
Определения UndergroundHandlerClient.c:16
enum EUndergroundPresence LIGHT_BLEND_SPEED_IN
float m_LightingLerpTarget
Определения UndergroundHandlerClient.c:29
const float LIGHT_BLEND_SPEED_OUT
Определения UndergroundHandlerClient.c:12
float m_EyeAccoTarget
Определения UndergroundHandlerClient.c:26
float m_LightingLerp
Определения UndergroundHandlerClient.c:30
AnimationTimer class. This timer is for animating float value. usage:
Определения 3_Game/DayZ/tools/tools.c:651
Определения DbgUI.c:60
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения 3_Game/DayZ/tools/Debug.c:382
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Определения 3_Game/DayZ/tools/Debug.c:461
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EnDebug.c:241
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:119
const int COLOR_RED
Определения 1_Core/DayZ/constants.c:64
const int COLOR_YELLOW
Определения 1_Core/DayZ/constants.c:67
ShapeFlags
Определения EnDebug.c:126
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Определения EnScript.c:339
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Перекрестные ссылки ACCO_MODIFIER, DbgUI::Begin(), COLOR_RED, COLOR_YELLOW, vector::DistanceSq(), Debug::DrawLine(), Debug::DrawSphere(), DbgUI::End(), DiagMenu::GetBool(), Math::Lerp(), LIGHT_BLEND_SPEED_IN, LIGHT_BLEND_SPEED_OUT, m_AnimTimerLightBlend, m_EyeAccoTarget, m_LightingLerp, m_LightingLerpTarget, m_TransitionalTrigger, String() и DbgUI::Text().

Используется в CalculateEyeAccoTarget().