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

◆ CalculateLinePointFade()

void CalculateLinePointFade ( )
protected

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

202 {
204 JsonUndergroundAreaBreadcrumb startPoint = points[0];
205 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
206 vector playerPos = m_Player.GetPosition();
207
208 bool forceAcco;
209 float acco;
210 float accoMax = m_TransitionalTrigger.m_Data.Breadcrumbs[0].EyeAccommodation;
211 float accoMin = endPoint.EyeAccommodation;
212 JsonUndergroundAreaBreadcrumb closestPoint;
213 JsonUndergroundAreaBreadcrumb secondaryPoint;
214 float distanceToClosest;
215 float distanceToSecondary;
216 float distanceBetweenPoints;
217
218 foreach (JsonUndergroundAreaBreadcrumb point : points) //identify closest segment
219 {
220 float dist = vector.DistanceSq(playerPos, point.GetPosition());
221 if (!closestPoint || dist < distanceToClosest)
222 {
223 if (closestPoint)
224 {
225 secondaryPoint = closestPoint;
226 distanceToSecondary = distanceToClosest;
227 }
228 closestPoint = point;
229 distanceToClosest = dist;
230 }
231 else if (!secondaryPoint || dist < secondaryPoint)
232 {
233 secondaryPoint = point;
234 distanceToSecondary = dist;
235 }
236
237 #ifdef DIAG_DEVELOPER
238 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
239 Debug.DrawSphere(point.GetPosition(),0.1, COLOR_RED, ShapeFlags.ONCE);
240 #endif
241 }
242
243 distanceBetweenPoints = vector.DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
244
245 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints) // before first point, do nothing
246 acco = accoMax;
247 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints) // past second point, do nothing
248 acco = accoMin;
249 else // between the two points, lerp
250 {
251 if (closestPoint == endPoint)
252 secondaryPoint = points[points.Count() - 2];
253 else if (closestPoint == startPoint)
254 secondaryPoint = points[1];
255 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
256 {
257 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
258 if (vector.DistanceSq(playerPos, nexPoint.GetPosition()) < vector.DistanceSq(closestPoint.GetPosition(), nexPoint.GetPosition()))
259 secondaryPoint = nexPoint;
260 else
261 {
262 acco = closestPoint.EyeAccommodation;
263 forceAcco = true;
264 }
265 }
266
267 if (!forceAcco)
268 {
269 distanceToSecondary = vector.DistanceSq(playerPos, secondaryPoint.GetPosition());
270
271 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary); // progress
272 acco = Math.Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
273
274 if (points.Find(closestPoint) > points.Find(secondaryPoint))
275 m_LightingLerpTarget = closestPoint.LightLerp;
276 else
277 m_LightingLerpTarget = secondaryPoint.LightLerp;
278
279 }
280 }
281
283
285 {
286 if (m_LightingLerpTarget == 1)
287 {
289 m_AnimTimerLightBlend.Run(1, this, "OnUpdateTimerIn", "OnUpdateTimerEnd",0, false, LIGHT_BLEND_SPEED_IN);
290 }
291 else
292 {
294 m_AnimTimerLightBlend.Run(0, this, "OnUpdateTimerOut", "OnUpdateTimerEnd",m_LightingLerp, false, LIGHT_BLEND_SPEED_OUT);
295 }
296 }
297
298 #ifdef DIAG_DEVELOPER
299 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
300 {
301 vector headPosition = MiscGameplayFunctions.GetPlayerHeadPosition(m_Player);
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 }
DiagMenuIDs
Определения EDiagMenuIDs.c:2
DayZPlayer m_Player
Определения Hand_Events.c:42
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:395
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Определения 3_Game/DayZ/tools/Debug.c:474
Определения 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_Player, m_TransitionalTrigger, String() и DbgUI::Text().

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