Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
shockhitreaction.c
Go to the documentation of this file.
2{
3 const float INTENSITY_COEF_OVERALL = 0.8; //intensity percentage multiplier
4 const float INTENSITY_COEF_BLUR = 1;
5 const float INTENSITY_COEF_COLOR = 0.2;
6 const float INTENSITY_COEF_VIGNETTE = 0.7;
7 const float DURATION_MIN = 0.6;
8
10
15
16 void ShockDealtEffect(float intensity_max)
17 {
18 float duration_coef = Math.Clamp(intensity_max,DURATION_MIN,1);
19 m_HitDuration = 1 * duration_coef;
20 m_BreakPoint = 0.2 * duration_coef;
21 m_ShockIntensityMax = Math.Clamp(intensity_max,0,1);
22
24 //Print(intensity_max);
25 //Print("HitSyncDebug | ShockDealtEffect: " + g_Game.GetPlayer().GetSimulationTimeStamp());
26 }
27
29 {
30 if (g_Game)
31 PPERequesterBank.GetRequester(PPERequester_ShockHitReaction).Stop();
32 }
33
34 void Update(float deltatime)
35 {
36 float value;
37
39 {
41 }
42 else
43 {
45 value = 1 - tmp_value;
46 }
47
48 m_TimeActive += deltatime;
49 value = Math.Clamp(value,0,1);
50
51 //value calculations
53 float val_color = Math.Clamp(val * INTENSITY_COEF_COLOR,0,m_ShockIntensityMax);
54
55 //Postprocess application
57 float factor = val_color * INTENSITY_COEF_OVERALL;
58 float vignette = val * INTENSITY_COEF_OVERALL * INTENSITY_COEF_VIGNETTE;
59
60 m_EffectParam.param1 = blur;
61 m_EffectParam.param2 = vignette;
62 m_EffectParam.param3 = factor;
63 PPERequesterBank.GetRequester(PPERequester_ShockHitReaction).Start(m_EffectParam);
64
66 {
67 delete this;
68 }
69 }
70}
Definition enmath.c:7
ref Param3< float, float, float > m_EffectParam
const float INTENSITY_COEF_VIGNETTE
const float INTENSITY_COEF_BLUR
void Update(float deltatime)
const float INTENSITY_COEF_COLOR
const float INTENSITY_COEF_OVERALL
const float DURATION_MIN
void ShockDealtEffect(float intensity_max)
DayZGame g_Game
Definition dayzgame.c:3942
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 proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.