24 protected ref set<UndergroundTrigger>
m_InsideTriggers =
new set<UndergroundTrigger>();
41 m_NVRequester = PPERequester_CameraNV.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV));
48 g_Game.GetWorld().SetExplicitVolumeFactor_EnvSounds2D(1, 0.5);
49 g_Game.GetWeather().SuppressLightningSimulation(
false);
50 g_Game.GetWorld().SetUserLightingLerp(0);
60 m_Requester = PPERUndergroundAcco.Cast(PPERequesterBank.GetRequester( PPERequesterBank.REQ_UNDERGROUND));
98 float closestDist =
float.MAX;
112 switch (crumb.ExternalValueController.Type)
117 if (!ctrl || (ctrl && ctrl.SelectionName ==
""))
124 float animPhase = building.GetAnimationPhase(ctrl.SelectionName);
133 if (crumbRadius != -1)
134 maxRadiusAllowed = crumbRadius;
135 if (dist > maxRadiusAllowed)
136 excludeMask = (excludeMask | (1 << indx));
140 MiscGameplayFunctions.GetHeadBonePos(
m_Player, rayStart);
141 vector rayEnd = crumb.GetPosition();
148 excludeMask = (excludeMask | (1 << indx));
152 distances.Insert(dist);
154 #ifdef DIAG_DEVELOPER
160 float baseDst = distances[0];
163 foreach (
float dst:distances)
167 float dstInv = (baseDst / dst) * baseDst;
169 distancesInverted.Insert(dstInv);
174 foreach (
int i,
float dstInvert:distancesInverted)
176 if ((1 << i) & excludeMask)
179 float ratio = dstInvert / sum;
185 #ifdef DIAG_DEVELOPER
188 float intensity = (1-ratio) * 255;
203 JsonUndergroundAreaBreadcrumb startPoint = points[0];
204 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
210 float accoMin = endPoint.EyeAccommodation;
211 JsonUndergroundAreaBreadcrumb closestPoint;
212 JsonUndergroundAreaBreadcrumb secondaryPoint;
213 float distanceToClosest;
214 float distanceToSecondary;
215 float distanceBetweenPoints;
217 foreach (JsonUndergroundAreaBreadcrumb point : points)
220 if (!closestPoint || dist < distanceToClosest)
224 secondaryPoint = closestPoint;
225 distanceToSecondary = distanceToClosest;
227 closestPoint = point;
228 distanceToClosest = dist;
230 else if (!secondaryPoint || dist < secondaryPoint)
232 secondaryPoint = point;
233 distanceToSecondary = dist;
236 #ifdef DIAG_DEVELOPER
242 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
244 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
246 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
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)
256 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
258 secondaryPoint = nexPoint;
261 acco = closestPoint.EyeAccommodation;
268 distanceToSecondary =
vector.
DistanceSq(playerPos, secondaryPoint.GetPosition());
270 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary);
271 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
273 if (points.Find(closestPoint) > points.Find(secondaryPoint))
297 #ifdef DIAG_DEVELOPER
301 MiscGameplayFunctions.GetHeadBonePos(
m_Player, headPosition);
303 if (acco != accoMin && acco != accoMax)
308 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
319 if(reachedTarget && !
m_Player.m_UndergroundPresence)
338 g_Game.GetWorld().SetUserLightingLerp(0);
369 #ifdef DIAG_DEVELOPER
380 #ifdef DIAG_DEVELOPER
393 float undergrounNVExposureCoef =
m_EyeAcco;
396 undergrounNVExposureCoef = 1.0;
431 EUndergroundTriggerType bestType = EUndergroundTriggerType.UNDEFINED;
433 UndergroundTrigger bestTrigger;
439 if (t.m_Type > bestType)
451 if (bestTrigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
456 if (bestTrigger.m_InterpolationSpeed != -1 && bestTrigger.m_InterpolationSpeed != 0)
471 if (trigger.m_Type == EUndergroundTriggerType.OUTER)
473 else if (trigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
475 else if (trigger.m_Type == EUndergroundTriggerType.INNER)
479 if (newPresence != oldPresence)
482 m_Player.SetUnderground(newPresence);
490 light.SetVisibleDuringDaylight(enable);
559 g_Game.GetWeather().SuppressLightningSimulation(
true);
575 g_Game.GetWeather().SuppressLightningSimulation(
false);
583 g_Game.GetWorld().SetUserLightingLerp(0);
589 #ifdef DIAG_DEVELOPER
590 protected void DisplayDebugInfo(
float acco,
float lighting)
594 DbgUI.Begin(
String(
"Underground Areas"), 20, 20);
void BreadcrumbDoorStateController(TStringArray params)
bool CalculateEyeAcco(float timeSlice)
void UndergroundHandlerClient(PlayerBase player)
ref AnimationTimer m_AnimTimerLightBlend
const float DEFAULT_INTERPOLATION_SPEED
const float DISTANCE_CUTOFF
void OnTriggerLeave(UndergroundTrigger trigger)
string m_AmbientController
UndergroundTrigger m_TransitionalTrigger
PPERUndergroundAcco m_Requester
void UpdateNVGRequester(float value)
const float ACCO_MODIFIER
void CalculateEyeAccoTarget()
ref set< UndergroundTrigger > m_InsideTriggers
enum EUndergroundPresence LIGHT_BLEND_SPEED_IN
PPERUndergroundAcco GetRequester()
EffectSound m_AmbientSound
void CalculateLinePointFade()
void OnTriggerInsiderUpdate()
UndergroundTrigger m_BestTrigger
void CalculateBreadCrumbs()
void ProcessLighting(float timeSlice)
void EnableLights(bool enable)
float m_LightingLerpTarget
const float LIGHT_BLEND_SPEED_OUT
void ~UndergroundHandlerClient()
void OnUndergroundPresenceUpdate(EUndergroundPresence newPresence, EUndergroundPresence oldPresence)
PPERequester_CameraNV m_NVRequester
float m_AccoInterpolationSpeed
void OnTriggerEnter(UndergroundTrigger trigger)
void ProcessEyeAcco(float timeSlice)
const string UNDERGROUND_LIGHTING
void SetUndergroundPresence(UndergroundTrigger trigger)
AnimationTimer class. This timer is for animating float value. usage:
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
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)
static float EaseInQuint(float t)
static float EaseInOutQuint(float t)
static float EaseOutCubic(float t)
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Wrapper class for managing sound through SEffectManager.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto native float Distance(vector v1, vector v2)
Returns the 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'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput=true)
Returns given value remaped from input range into output range.
static proto float AbsFloat(float f)
Returns absolute value.
@ NONE
body is not in simulation, nor in collision world
SetSoundControllerOverride(string controllerName, float value, SoundControllerAction action)
int ARGB(int a, int r, int g, int b)