24 protected ref set<UndergroundTrigger>
m_InsideTriggers =
new set<UndergroundTrigger>();
40 m_NVRequester = PPERequester_CameraNV.Cast(PPERequesterBank.GetRequester( PPERequesterBank.REQ_CAMERANV));
59 m_Requester = PPERUndergroundAcco.Cast(PPERequesterBank.GetRequester( PPERequesterBank.REQ_UNDERGROUND));
99 float closestDist =
float.MAX;
113 if (crumbRadius != -1)
114 maxRadiusAllowed = crumbRadius;
115 if (dist > maxRadiusAllowed)
116 excludeMask = (excludeMask | (1 << indx));
119 int idx =
m_Player.GetBoneIndexByName(
"Head");
121 vector rayEnd = crumb.GetPosition();
128 excludeMask = (excludeMask | (1 << indx));
132 distances.Insert(dist);
134 #ifdef DIAG_DEVELOPER
140 float baseDst = distances[0];
143 foreach (
float dst:distances)
147 float dstInv = (baseDst / dst) * baseDst;
149 distancesInverted.Insert(dstInv);
154 foreach (
int i,
float dstInvert:distancesInverted)
156 if ((1 << i) & excludeMask)
159 float ratio = dstInvert / sum;
165 #ifdef DIAG_DEVELOPER
168 float intensity = (1-ratio) * 255;
183 JsonUndergroundAreaBreadcrumb startPoint = points[0];
184 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
190 float accoMin = endPoint.EyeAccommodation;
191 JsonUndergroundAreaBreadcrumb closestPoint;
192 JsonUndergroundAreaBreadcrumb secondaryPoint;
193 float distanceToClosest;
194 float distanceToSecondary;
195 float distanceBetweenPoints;
197 foreach (JsonUndergroundAreaBreadcrumb point : points)
200 if (!closestPoint || dist < distanceToClosest)
204 secondaryPoint = closestPoint;
205 distanceToSecondary = distanceToClosest;
207 closestPoint = point;
208 distanceToClosest = dist;
210 else if (!secondaryPoint || dist < secondaryPoint)
212 secondaryPoint = point;
213 distanceToSecondary = dist;
216 #ifdef DIAG_DEVELOPER
222 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
224 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
226 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
230 if (closestPoint == endPoint)
231 secondaryPoint = points[points.Count() - 2];
232 else if (closestPoint == startPoint)
233 secondaryPoint = points[1];
234 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
236 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
238 secondaryPoint = nexPoint;
241 acco = closestPoint.EyeAccommodation;
248 distanceToSecondary =
vector.
DistanceSq(playerPos, secondaryPoint.GetPosition());
250 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary);
251 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
253 if (points.Find(closestPoint) > points.Find(secondaryPoint))
277 #ifdef DIAG_DEVELOPER
281 if (acco != accoMin && acco != accoMax)
286 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
297 if(reachedTarget && !
m_Player.m_UndergroundPresence)
342 #ifdef DIAG_DEVELOPER
353 #ifdef DIAG_DEVELOPER
366 float undergrounNVExposureCoef =
m_EyeAcco;
369 undergrounNVExposureCoef = 1.0;
404 EUndergroundTriggerType bestType = EUndergroundTriggerType.UNDEFINED;
406 UndergroundTrigger bestTrigger;
412 if (t.m_Type > bestType)
422 if (bestTrigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
427 if (bestTrigger.m_InterpolationSpeed != -1 && bestTrigger.m_InterpolationSpeed != 0)
442 if (trigger.m_Type == EUndergroundTriggerType.OUTER)
446 else if (trigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
450 else if (trigger.m_Type == EUndergroundTriggerType.INNER)
456 if (newPresence != oldPresence)
459 m_Player.SetUnderground(newPresence);
469 light.SetVisibleDuringDaylight(enable);
557 #ifdef DIAG_DEVELOPER
558 protected void DisplayDebugInfo(
float acco,
float lighting)
562 DbgUI.Begin(
String(
"Underground Areas"), 20, 20);
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()
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:
proto native World GetWorld()
proto native Weather GetWeather()
Returns weather controller object.
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 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.
proto native void SuppressLightningSimulation(bool state)
enables/disables thunderbolt simulation on client (together with sounds)
proto native void SetExplicitVolumeFactor_EnvSounds2D(float factor, float fadeTime)
proto native void LoadUserLightingCfg(string path, string name)
proto native void SetUserLightingLerp(float val)
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.
proto native CGame GetGame()
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 AbsFloat(float f)
Returns absolute value.
SetSoundControllerOverride(string controllerName, float value, SoundControllerAction action)
class JsonUndergroundAreaTriggerData GetPosition
int ARGB(int a, int r, int g, int b)