Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_DesaturationEffect.c
Go to the documentation of this file.
1
class
SCR_DesaturationEffect
:
SCR_BaseScreenEffect
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
21
protected
ChimeraCharacter
m_pCharacterEntity
;
22
protected
SCR_CharacterBloodHitZone
m_BloodHZ
;
23
protected
SCR_CharacterDamageManagerComponent
m_DamageManager
;
24
protected
bool
m_bLocalPlayerOutsideCharacter
;
25
26
//------------------------------------------------------------------------------------------------
27
override
void
DisplayStartDraw
(
IEntity
owner)
28
{
29
m_pCharacterEntity
=
ChimeraCharacter
.Cast(owner);
30
}
31
32
//------------------------------------------------------------------------------------------------
33
override
void
SettingsChanged
()
34
{
35
if
(!
m_pCharacterEntity
)
36
return
;
37
38
m_pCharacterEntity
.GetWorld().SetCameraPostProcessEffect(
m_pCharacterEntity
.GetWorld().GetCurrentCameraId(), COLORS_PP_PRIORITY,
PostProcessEffectType
.Colors,
DESATURATION_EMAT
);
39
}
40
41
//------------------------------------------------------------------------------------------------
42
override
void
DisplayControlledEntityChanged
(
IEntity
from,
IEntity
to)
43
{
44
ClearEffects
();
45
46
m_pCharacterEntity
=
ChimeraCharacter
.Cast(to);
47
if
(!
m_pCharacterEntity
)
48
return
;
49
50
m_DamageManager
=
SCR_CharacterDamageManagerComponent
.Cast(
m_pCharacterEntity
.GetDamageManager());
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
{
75
AddDesaturationEffect
();
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
};
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
Math
Definition
Math.c:13
SCR_BaseScreenEffect
Definition
SCR_BaseScreenEffect.c:2
SCR_CharacterBloodHitZone
Blood - does not receive damage directly, only via scripted events.
Definition
SCR_CharacterHitZone.c:430
SCR_CharacterDamageManagerComponent
Definition
SCR_CharacterDamageManagerComponent.c:19
SCR_DesaturationEffect
Definition
SCR_DesaturationEffect.c:2
SCR_DesaturationEffect::DisplayOnResumed
override void DisplayOnResumed()
Definition
SCR_DesaturationEffect.c:67
SCR_DesaturationEffect::m_DamageManager
SCR_CharacterDamageManagerComponent m_DamageManager
Definition
SCR_DesaturationEffect.c:23
SCR_DesaturationEffect::m_bLocalPlayerOutsideCharacter
bool m_bLocalPlayerOutsideCharacter
Definition
SCR_DesaturationEffect.c:24
SCR_DesaturationEffect::m_fDesaturationStart
float m_fDesaturationStart
Definition
SCR_DesaturationEffect.c:12
SCR_DesaturationEffect::DisplayStartDraw
override void DisplayStartDraw(IEntity owner)
Definition
SCR_DesaturationEffect.c:27
SCR_DesaturationEffect::SettingsChanged
override void SettingsChanged()
Definition
SCR_DesaturationEffect.c:33
SCR_DesaturationEffect::m_BloodHZ
SCR_CharacterBloodHitZone m_BloodHZ
Definition
SCR_DesaturationEffect.c:22
SCR_DesaturationEffect::m_fDesaturationEnd
float m_fDesaturationEnd
Definition
SCR_DesaturationEffect.c:15
SCR_DesaturationEffect::ClearEffects
override void ClearEffects()
Definition
SCR_DesaturationEffect.c:91
SCR_DesaturationEffect::UpdateEffect
override void UpdateEffect(float timeSlice)
Definition
SCR_DesaturationEffect.c:73
SCR_DesaturationEffect::m_pCharacterEntity
ChimeraCharacter m_pCharacterEntity
Definition
SCR_DesaturationEffect.c:21
SCR_DesaturationEffect::DisplayOnSuspended
override void DisplayOnSuspended()
Definition
SCR_DesaturationEffect.c:61
SCR_DesaturationEffect::DisplayControlledEntityChanged
override void DisplayControlledEntityChanged(IEntity from, IEntity to)
Definition
SCR_DesaturationEffect.c:42
SCR_DesaturationEffect::AddDesaturationEffect
void AddDesaturationEffect()
Definition
SCR_DesaturationEffect.c:79
SCR_DesaturationEffect::DESATURATION_EMAT
const string DESATURATION_EMAT
Definition
SCR_DesaturationEffect.c:9
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
PostProcessEffectType
PostProcessEffectType
Definition
EnWorld.c:20
scripts
Game
UI
ScreenEffects
SCR_DesaturationEffect.c
Generated by
1.17.0