Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DesaturationEffect.c
Go to the documentation of this file.
2{
3 // PP constants
4 // Variables connected to a material, need to be static
5 static const int COLORS_PP_PRIORITY = 5;
6
7 //Saturation
8 private static float s_fSaturation = 1;
9 protected const string DESATURATION_EMAT = "{7C202A913EB8B1A9}UI/Materials/ScreenEffects_ColorPP.emat";
10
11 [Attribute( defvalue: "0.5", uiwidget: UIWidgets.EditBox)]
12 protected float m_fDesaturationStart;
13
14 [Attribute( defvalue: "0.333", uiwidget: UIWidgets.EditBox)]
15 protected float m_fDesaturationEnd;
16
17 // Enabling/Disabling of PP fx
18 private static bool s_bEnableSaturation;
19
20 // Character
25
26 //------------------------------------------------------------------------------------------------
27 override void DisplayStartDraw(IEntity owner)
28 {
30 }
31
32 //------------------------------------------------------------------------------------------------
33 override void SettingsChanged()
34 {
36 return;
37
38 m_pCharacterEntity.GetWorld().SetCameraPostProcessEffect(m_pCharacterEntity.GetWorld().GetCurrentCameraId(), COLORS_PP_PRIORITY, PostProcessEffectType.Colors, DESATURATION_EMAT);
39 }
40
41 //------------------------------------------------------------------------------------------------
43 {
45
48 return;
49
51 if (!m_DamageManager)
52 return;
53
54 // define hitzones for later getting
55 m_BloodHZ = m_DamageManager.GetBloodHitZone();
56
57 m_pCharacterEntity.GetWorld().SetCameraPostProcessEffect(m_pCharacterEntity.GetWorld().GetCurrentCameraId(), COLORS_PP_PRIORITY, PostProcessEffectType.Colors, DESATURATION_EMAT);
58 }
59
60 //------------------------------------------------------------------------------------------------
61 protected override void DisplayOnSuspended()
62 {
63 s_bEnableSaturation = false;
64 }
65
66 //------------------------------------------------------------------------------------------------
67 protected override void DisplayOnResumed()
68 {
69 s_bEnableSaturation = true;
70 }
71
72 //------------------------------------------------------------------------------------------------
73 protected override void UpdateEffect(float timeSlice)
74 {
76 }
77
78 //------------------------------------------------------------------------------------------------
79 protected void AddDesaturationEffect()
80 {
81 if (!m_BloodHZ)
82 return;
83
84 float bloodLevel = Math.InverseLerp(m_fDesaturationEnd, m_fDesaturationStart, m_BloodHZ.GetHealthScaled());
85
86 s_fSaturation = Math.Clamp(bloodLevel, 0, 1);
87 s_bEnableSaturation = s_fSaturation < 1;
88 }
89
90 //------------------------------------------------------------------------------------------------
91 protected override void ClearEffects()
92 {
93 s_fSaturation = 1;
94 }
95};
Definition Math.c:13
Blood - does not receive damage directly, only via scripted events.
SCR_CharacterDamageManagerComponent m_DamageManager
override void DisplayStartDraw(IEntity owner)
SCR_CharacterBloodHitZone m_BloodHZ
override void UpdateEffect(float timeSlice)
ChimeraCharacter m_pCharacterEntity
override void DisplayControlledEntityChanged(IEntity from, IEntity to)
SCR_FieldOfViewSettings Attribute
PostProcessEffectType
Definition EnWorld.c:20