Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
pperhmpghosts.c
Go to the documentation of this file.
1class PPERequester_HMPGhosts extends PPERequester_GameplayBase
2{
3 protected bool m_PulseActive;
4 protected float m_PulseProgress;
5
6 protected ref array<float> m_ChannelWeights = { 0, 0, 0, 0 };
7 protected ref array<float> m_ColorMod = { 1, 1, 1, 1 };
8
9 protected bool m_Stopping;
10 protected bool m_StopNext;
11 protected float m_FadeOutTimeTarget;
12 protected float m_FadingTimeElapsed;
13 protected float m_FadingProgress;
14 protected float m_ElapsedTime;
15
16 override protected void OnStart(Param par = null)
17 {
18 super.OnStart(par);
19
20 m_Stopping = false;
21 m_StopNext = false;
22 m_ElapsedTime = 0.0;
24 m_FadingProgress = 0.0;
25
26 //following changes only performed once, on start
27 //noise
28 float nScaleX = 0.05; //inverse scaling!
29 float nScaleY = 0.05; //inverse scaling!
30 //ghosts
31 float gOffsetX = 30;
32 float gOffsetY = 13;
33 float gScaleX = 1; //inverse scaling!
34 float gScaleY = 1; //inverse scaling!
35 //color modulation
36 m_ColorMod[0] = 0.8;
37 m_ColorMod[1] = 0.8;
38 m_ColorMod[2] = 0.8;
39 m_ColorMod[3] = 0.85;
40
48 }
49
50 override protected void OnUpdate(float delta)
51 {
52 if (m_StopNext)
53 {
54 if (m_IsRunning)
55 Stop();
56 return;
57 }
58
59 if (m_IsRunning)
60 ProcessSimulation(delta);
61
62 super.OnUpdate(delta);
63
64 if (m_IsRunning)
66 }
67
68 protected void ProcessSimulation(float delta)
69 {
70 if (m_Stopping)
71 ProcessFading(delta);
72
73 if (m_PulseActive)
74 {
75 //channel weights
76 float time = m_ElapsedTime * 0.65;
77 SampleChannels(time);
78 ReSampleChannels(time);
79
80 //noise
81 float nOffsetX = (Math.Sin( time * 0.29 ) * 0.5 + 0.5) * 0.3;
82 float nOffsetY = (Math.Cos( time * 0.17 ) * 0.5 + 0.5) * 0.3;
83
84 //channel remapping
85 float animLo = (Math.Sin( time ) * 0.5 + 0.5) * 1;
86 float animHi = (Math.Sin( time ) * 0.5 + 0.5) * 1;
87 float rmpLoAll = Math.Lerp(0.1,0.3,animLo);
88 float rmpHiAll = Math.Lerp(0.9,1.2,animHi);
89
95
97 }
98
99 m_ElapsedTime += delta;
100 }
101
102 protected void SampleChannels(float time)
103 {
104 float offset;
105 // luckily 4 channels * 90 fit into 360 nicely, so no need to distribute weights other way
106 for (int i = 0; i < 4; ++i)
107 {
108 offset = i * Math.PI_HALF;
109 m_ChannelWeights[i] = Math.Sin( time + offset );
110 }
111 }
112
113 protected void ReSampleChannels(float time)
114 {
115 float rampingCoef = 1.1;
116 float w = Math.Clamp((Math.Sin(m_PulseProgress * Math.PI) * rampingCoef),0,1);
117 w = Math.Lerp(0,w,1 - m_FadingProgress);
118
119 for (int i = 0; i < 4; ++i)
121 }
122
123 protected void ProcessFading(float delta)
124 {
125 m_FadingTimeElapsed += delta;
127
129 }
130
131 void SetPulseProgress(float progress) //0..1
132 {
133 m_PulseActive = true;
134 m_PulseProgress = progress;
135 }
136
137 void FadeOutEffect(float targetTime)
138 {
139 m_Stopping = true;
140 m_FadeOutTimeTarget = targetTime;
142 }
143}
Definition enmath.c:7
Ghost - PostProcessEffectType.Ghost.
Definition ppeghost.c:3
static const int L_6_HMP
Definition ppeghost.c:25
static const int PARAM_GHOST_OFFSET_X
Definition ppeghost.c:13
static const int L_7_HMP
Definition ppeghost.c:26
static const int L_8_HMP
Definition ppeghost.c:27
static const int L_9_HMP
Definition ppeghost.c:28
static const int PARAM_NOISE_OFFSET_X
Definition ppeghost.c:6
static const int PARAM_NOISE_OFFSET_Y
Definition ppeghost.c:7
static const int PARAM_GHOST_SCALE_Y
Definition ppeghost.c:16
static const int PARAM_NOISE_SCALE_Y
Definition ppeghost.c:9
static const int PARAM_NOISE_SCALE_X
Definition ppeghost.c:8
static const int L_3_HMP
Definition ppeghost.c:22
static const int L_4_HMP
Definition ppeghost.c:23
static const int L_1_HMP
RGB = per channel multiplication A = overall color curve (0=linear,1=exponential).
Definition ppeghost.c:20
static const int L_5_HMP
Definition ppeghost.c:24
static const int PARAM_GHOST_OFFSET_Y
Definition ppeghost.c:14
static const int PARAM_GHOST_COLOR_MOD
Definition ppeghost.c:17
static const int PARAM_NOISE_REMAP_LO
Definition ppeghost.c:10
static const int PARAM_NOISE_CHANNEL_WEIGHT
Definition ppeghost.c:5
static const int L_2_HMP
Definition ppeghost.c:21
static const int PARAM_GHOST_SCALE_X
Definition ppeghost.c:15
static const int PARAM_NOISE_REMAP_HI
Definition ppeghost.c:11
base, not to be used directly, would lead to layering collisions!
void OnStart(Param par=null)
void ProcessFading(float delta)
ref array< float > m_ColorMod
void SetPulseProgress(float progress)
void OnUpdate(float delta)
void ReSampleChannels(float time)
ref array< float > m_ChannelWeights
void ProcessSimulation(float delta)
void SampleChannels(float time)
void FadeOutEffect(float targetTime)
Base Param Class with no parameters.
Definition param.c:12
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
PostProcessEffectType
Post-process effect type.
Definition enworld.c:72
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float PI_HALF
Definition enmath.c:14
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 const float PI
Definition enmath.c:12
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Sin(float angle)
Returns sinus of angle in radians.
void Stop()
Stops all elements this effect consists of.
Definition effect.c:183
PPOperators
PP operators, specify operation between subsequent layers.
bool m_IsRunning
void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
void SetRequesterUpdating(bool state)
Has to be set for the requester to be handled.
void SetTargetValueColor(int mat_id, int param_idx, array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)