24 protected ref set<UndergroundTrigger>
m_InsideTriggers =
new set<UndergroundTrigger>();
41 m_NVRequester = PPERequester_CameraNV.Cast(PPERequesterBank.GetRequester( PPERequesterBank.REQ_CAMERANV));
60 m_Requester = PPERUndergroundAcco.Cast(PPERequesterBank.GetRequester( PPERequesterBank.REQ_UNDERGROUND));
100 float closestDist =
float.MAX;
114 if (crumbRadius != -1)
115 maxRadiusAllowed = crumbRadius;
116 if (dist > maxRadiusAllowed)
117 excludeMask = (excludeMask | (1 << indx));
120 int idx =
m_Player.GetBoneIndexByName(
"Head");
122 vector rayEnd = crumb.GetPosition();
129 excludeMask = (excludeMask | (1 << indx));
133 distances.Insert(dist);
135 #ifdef DIAG_DEVELOPER
141 float baseDst = distances[0];
144 foreach (
float dst:distances)
148 float dstInv = (baseDst / dst) * baseDst;
150 distancesInverted.Insert(dstInv);
155 foreach (
int i,
float dstInvert:distancesInverted)
157 if ((1 << i) & excludeMask)
160 float ratio = dstInvert / sum;
166 #ifdef DIAG_DEVELOPER
169 float intensity = (1-ratio) * 255;
184 JsonUndergroundAreaBreadcrumb startPoint = points[0];
185 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
191 float accoMin = endPoint.EyeAccommodation;
192 JsonUndergroundAreaBreadcrumb closestPoint;
193 JsonUndergroundAreaBreadcrumb secondaryPoint;
194 float distanceToClosest;
195 float distanceToSecondary;
196 float distanceBetweenPoints;
198 foreach (JsonUndergroundAreaBreadcrumb point : points)
201 if (!closestPoint || dist < distanceToClosest)
205 secondaryPoint = closestPoint;
206 distanceToSecondary = distanceToClosest;
208 closestPoint = point;
209 distanceToClosest = dist;
211 else if (!secondaryPoint || dist < secondaryPoint)
213 secondaryPoint = point;
214 distanceToSecondary = dist;
217 #ifdef DIAG_DEVELOPER
223 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
225 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
227 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
231 if (closestPoint == endPoint)
232 secondaryPoint = points[points.Count() - 2];
233 else if (closestPoint == startPoint)
234 secondaryPoint = points[1];
235 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
237 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
239 secondaryPoint = nexPoint;
242 acco = closestPoint.EyeAccommodation;
249 distanceToSecondary =
vector.
DistanceSq(playerPos, secondaryPoint.GetPosition());
251 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary);
252 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
254 if (points.Find(closestPoint) > points.Find(secondaryPoint))
278 #ifdef DIAG_DEVELOPER
282 if (acco != accoMin && acco != accoMax)
287 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
298 if(reachedTarget && !
m_Player.m_UndergroundPresence)
348 #ifdef DIAG_DEVELOPER
359 #ifdef DIAG_DEVELOPER
372 float undergrounNVExposureCoef =
m_EyeAcco;
375 undergrounNVExposureCoef = 1.0;
410 EUndergroundTriggerType bestType = EUndergroundTriggerType.UNDEFINED;
412 UndergroundTrigger bestTrigger;
418 if (t.m_Type > bestType)
430 if (bestTrigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
435 if (bestTrigger.m_InterpolationSpeed != -1 && bestTrigger.m_InterpolationSpeed != 0)
450 if (trigger.m_Type == EUndergroundTriggerType.OUTER)
454 else if (trigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
458 else if (trigger.m_Type == EUndergroundTriggerType.INNER)
464 if (newPresence != oldPresence)
467 m_Player.SetUnderground(newPresence);
477 light.SetVisibleDuringDaylight(enable);
567 #ifdef DIAG_DEVELOPER
568 protected void DisplayDebugInfo(
float acco,
float lighting)
572 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()
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:
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)