Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_StaminaBlurEffect.c
Go to the documentation of this file.
2{
3 // PP constants
4 // Play Animation of StaminaEffects()
5 protected const float STAMINAEFFECT_INITIAL_OPACITY_TARGET = 0.75;
6 protected const float STAMINAEFFECT_FADEIN_PROGRESSION_TARGET = 0.35;
8 protected const float STAMINA_CLEAREFFECT_DELAY = 2000;
9 protected const float STAMINA_EFFECT_THRESHOLD = 0.45;
10
11 [Attribute(defvalue: "0.1111", uiwidget: UIWidgets.EditBox, desc: "Blur intensity multiplier")]
12 protected float m_fStaminaBlurMultiplier;
13
14 //Blurriness
15 private static float s_fBlurriness;
16 private static bool s_bEnableRadialBlur;
17 protected const string RADIAL_BLUR_EMAT = "{B011FE0AD21E2447}UI/Materials/ScreenEffects_BlurPP.emat";
18
19 // Widgets
20 private ImageWidget m_wSupression;
21
22 // Variables connected to a material, need to be static
23 static const int RADIAL_BLUR_PRIORITY = 6;
24
25 // Stamina
26 protected int m_iStaminaSignal = -1;
27 protected bool m_bStaminaEffectActive;
28
29 // Owner data
31
32 //------------------------------------------------------------------------------------------------
33 protected override void DisplayStartDraw(IEntity owner)
34 {
35 m_wSupression = ImageWidget.Cast(m_wRoot.FindAnyWidget("SuppressionVignette"));
36 }
37
38 //------------------------------------------------------------------------------------------------
39 protected override void DisplayControlledEntityChanged(IEntity from, IEntity to)
40 {
41 ChimeraCharacter characterEntity = ChimeraCharacter.Cast(to);
42 if (!characterEntity)
43 return;
44
45 // Audio components for damage-related audio effects
46 m_pSignalsManager = SignalsManagerComponent.Cast(characterEntity.FindComponent(SignalsManagerComponent));
48 m_iStaminaSignal = m_pSignalsManager.FindSignal("Exhaustion");
49
50 characterEntity.GetWorld().SetCameraPostProcessEffect(characterEntity.GetWorld().GetCurrentCameraId(), RADIAL_BLUR_PRIORITY, PostProcessEffectType.RadialBlur, RADIAL_BLUR_EMAT);
51 }
52
53 //------------------------------------------------------------------------------------------------
54 protected void FindStaminaValues()
55 {
57 return;
58
59 float stamina = m_pSignalsManager.GetSignalValue(m_iStaminaSignal);
60 s_fBlurriness = m_wSupression.GetMaskProgress() * m_fStaminaBlurMultiplier;
61
63 {
64 s_bEnableRadialBlur = true;
65 StaminaEffects(true);
66 }
68 {
69 s_bEnableRadialBlur = false;
70 GetGame().GetCallqueue().Remove(StaminaEffects);
71 GetGame().GetCallqueue().Remove(ClearStaminaEffect);
72 ClearStaminaEffect(false);
74 }
75 }
76
77 //------------------------------------------------------------------------------------------------
78 protected void StaminaEffects(bool repeat)
79 {
80 if (!m_wSupression)
81 return;
82
84
85 m_wSupression.SetOpacity(STAMINAEFFECT_INITIAL_OPACITY_TARGET);
87
88 UpdateEffectVisibility(m_wSupression);
89
90 GetGame().GetCallqueue().CallLater(ClearStaminaEffect, STAMINA_CLEAREFFECT_DELAY, false, true);
91 }
92
93 //------------------------------------------------------------------------------------------------
94 protected void ClearStaminaEffect(bool repeat)
95 {
96 if (!m_wSupression)
97 return;
98
99 AnimateWidget.AlphaMask(m_wSupression, 0, 1);
100 if (repeat && m_bStaminaEffectActive && m_wSupression && !m_wSupression.GetOpacity() == 0)
101 GetGame().GetCallqueue().CallLater(StaminaEffects, STAMINA_CLEAREFFECT_DELAY, false, repeat);
102 }
103
104 //------------------------------------------------------------------------------------------------
105 protected override void DisplayOnSuspended()
106 {
107 s_bEnableRadialBlur = false;
108 }
109
110 //------------------------------------------------------------------------------------------------
111 protected override void DisplayOnResumed()
112 {
113 s_bEnableRadialBlur = true;
114 }
115
116 //------------------------------------------------------------------------------------------------
117 protected override void UpdateEffect(float timeSlice)
118 {
121 }
122
123 //------------------------------------------------------------------------------------------------
124 protected override void ClearEffects()
125 {
126 if (m_wSupression)
127 HideSingleEffect(m_wSupression);
128 }
129}
ArmaReforgerScripted GetGame()
Definition game.c:1398
Widget m_wRoot
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static WidgetAnimationAlphaMask AlphaMask(Widget widget, float targetValue, float speed)
void HideSingleEffect(notnull ImageWidget effectWidget)
void UpdateEffectVisibility(notnull ImageWidget effectWidget)
The widget will be made visible or hidden based on its opacity.
const float STAMINAEFFECT_INITIAL_OPACITY_TARGET
const float STAMINAEFFECT_FADEIN_PROGRESSION_DURATION
override void DisplayStartDraw(IEntity owner)
override void UpdateEffect(float timeSlice)
SignalsManagerComponent m_pSignalsManager
void ClearStaminaEffect(bool repeat)
void StaminaEffects(bool repeat)
override void DisplayControlledEntityChanged(IEntity from, IEntity to)
const float STAMINAEFFECT_FADEIN_PROGRESSION_TARGET
SCR_FieldOfViewSettings Attribute
PostProcessEffectType
Definition EnWorld.c:20