201 {
203 JsonUndergroundAreaBreadcrumb startPoint = points[0];
204 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
206
207 bool forceAcco;
208 float acco;
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)
218 {
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
239 #endif
240 }
241
242 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
243
244 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
245 acco = accoMax;
246 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
247 acco = accoMin;
248 else
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];
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);
271 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
272
273 if (points.Find(closestPoint) > points.Find(secondaryPoint))
275 else
277
278 }
279 }
280
282
284 {
286 {
289 }
290 else
291 {
294 }
295 }
296
297 #ifdef DIAG_DEVELOPER
299 {
301 MiscGameplayFunctions.GetHeadBonePos(
m_Player, headPosition);
303 if (acco != accoMin && acco != accoMax)
305
308 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
310 }
311 #endif
312 }
ref AnimationTimer m_AnimTimerLightBlend
UndergroundTrigger m_TransitionalTrigger
const float ACCO_MODIFIER
enum EUndergroundPresence LIGHT_BLEND_SPEED_IN
float m_LightingLerpTarget
const float LIGHT_BLEND_SPEED_OUT
AnimationTimer class. This timer is for animating float value. usage:
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
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.
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)
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.