Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
ppercameranv.c
Go to the documentation of this file.
1 class PPERequester_CameraNV extends PPERequester_GameplayBase
2 {
3  static const int NV_NO_BATTERY= 0; //darkness
4  static const int NV_DEFAULT_OPTICS = 1;
5  static const int NV_DEFAULT_GLASSES = 2;
6  static const int NV_PUMPKIN = 3;
7  static const int NV_TRANSITIVE = 4; //resets EV during camera transitions
8  static const int NV_DAYTIME_OPTICS = 5;
9 
10  protected int m_CurrentMode;
11  protected float m_UGExposureCoef = 1.0;
12 
13  protected void SetNVMode(int mode)
14  {
15  SetTargetValueFloat(PPEExceptions.EYEACCOM,PPEEyeAccomodationNative.PARAM_INTENSITY,false,1.0,PPEEyeAccomodationNative.L_0_NVG_GENERIC,PPOperators.SET);
16 
17  switch (mode)
18  {
19  case NV_NO_BATTERY: //battery off
20  SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{0.0,0.0,0.0,0.0},PPEGlow.L_23_NVG,PPOperators.MULTIPLICATIVE);
24  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_LIGHT_MULT,false,1.0,PPELightIntensityParamsNative.L_0_NVG,PPOperators.HIGHEST);
25  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_NOISE_MULT,false,0.0,PPELightIntensityParamsNative.L_1_NVG,PPOperators.HIGHEST);
26  break;
27 
28  case NV_DEFAULT_OPTICS: //NV optic on
29  SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{0.0,1.0,0.0,0.0},PPEGlow.L_23_NVG,PPOperators.MULTIPLICATIVE);
30  SetTargetValueFloat(PPEExceptions.EXPOSURE,PPEExposureNative.PARAM_INTENSITY,false,7.0 * m_UGExposureCoef,PPEExposureNative.L_0_NVG_OPTIC,PPOperators.ADD);
31  SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_SHARPNESS,false,9.0,PPEFilmGrain.L_1_NVG,PPOperators.SET);
32  SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_GRAINSIZE,false,1.0,PPEFilmGrain.L_2_NVG,PPOperators.SET);
33  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_LIGHT_MULT,false,3.0,PPELightIntensityParamsNative.L_0_NVG,PPOperators.HIGHEST);
34  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_NOISE_MULT,false,2.0,PPELightIntensityParamsNative.L_1_NVG,PPOperators.HIGHEST);
35  break;
36 
37  case NV_DAYTIME_OPTICS: //NV optic in daytime mode
38  SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{0.0,1.0,0.0,0.0},PPEGlow.L_23_NVG,PPOperators.MULTIPLICATIVE);
39  SetTargetValueFloat(PPEExceptions.EXPOSURE,PPEExposureNative.PARAM_INTENSITY,false,2.0 * m_UGExposureCoef,PPEExposureNative.L_0_NVG_OPTIC,PPOperators.ADD);
40  SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_SHARPNESS,false,9.0,PPEFilmGrain.L_1_NVG,PPOperators.SET);
41  SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_GRAINSIZE,false,1.0,PPEFilmGrain.L_2_NVG,PPOperators.SET);
42  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_LIGHT_MULT,false,3.0,PPELightIntensityParamsNative.L_0_NVG,PPOperators.HIGHEST);
43  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_NOISE_MULT,false,1.0,PPELightIntensityParamsNative.L_1_NVG,PPOperators.HIGHEST);
44  break;
45 
46  case NV_DEFAULT_GLASSES: //goggles on
47  SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{0.0,1.0,0.0,0.0},PPEGlow.L_23_NVG,PPOperators.MULTIPLICATIVE);
48  SetTargetValueFloat(PPEExceptions.EXPOSURE,PPEExposureNative.PARAM_INTENSITY,false,7.0 * m_UGExposureCoef,PPEExposureNative.L_0_NVG_GOGGLES,PPOperators.ADD);
49  SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_SHARPNESS,false,10.0,PPEFilmGrain.L_1_NVG,PPOperators.SET);
50  SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_GRAINSIZE,false,1.0,PPEFilmGrain.L_2_NVG,PPOperators.SET);
51  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_LIGHT_MULT,false,2.0,PPELightIntensityParamsNative.L_0_NVG,PPOperators.HIGHEST);
52  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_NOISE_MULT,false,1.0,PPELightIntensityParamsNative.L_1_NVG,PPOperators.HIGHEST);
53  break;
54 
55  case NV_PUMPKIN: //pumpkin-o-vision
56  SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{1.0,0.2,0.0,0.0},PPEGlow.L_23_NVG,PPOperators.MULTIPLICATIVE);
57  SetTargetValueFloat(PPEExceptions.EXPOSURE,PPEExposureNative.PARAM_INTENSITY,false,5.5 * m_UGExposureCoef,PPEExposureNative.L_0_NVG_GOGGLES,PPOperators.ADD);
60  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_LIGHT_MULT,false,1.0,PPELightIntensityParamsNative.L_0_NVG,PPOperators.HIGHEST);
61  SetTargetValueFloat(PPEExceptions.NVLIGHTPARAMS,PPELightIntensityParamsNative.PARAM_NOISE_MULT,false,0.0,PPELightIntensityParamsNative.L_1_NVG,PPOperators.HIGHEST);
62  break;
63 
64  case NV_TRANSITIVE: //camera transition
65  //SetTargetValueFloat(PPEExceptions.EXPOSURE,PPEExposureNative.PARAM_INTENSITY,false,0,PPEExposureNative.L_0_NVG_OFF,PPOperators.SET);
67  break;
68  }
69 
70  m_CurrentMode = mode;
71  }
72 
73  override protected void OnStart(Param par = null)
74  {
75  super.OnStart();
76 
77  SetNVMode(Param1<int>.Cast(par).param1);
78  }
79 
80  //other values reset automatically on stop
81  override protected void OnStop(Param par = null)
82  {
83  super.OnStop(par);
84  }
85 
86  void SetUndergroundExposureCoef(float coef)
87  {
88  m_UGExposureCoef = coef;
89 
90  if (m_IsRunning)
91  SetNVMode(m_CurrentMode); //TODO: improve (oof...)
92  }
93 }
PostProcessEffectType
PostProcessEffectType
Post-process effect type.
Definition: enworld.c:71
PPEExposureNative
EV postprocess, does not directly use materials.
Definition: ppeexposurenative.c:5
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
SetTargetValueColor
protected void SetTargetValueColor(int mat_id, int param_idx, ref array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
Definition: pperequestplatformsbase.c:195
OnStop
protected void OnStop(Param par=null)
automatically resets all material parameters of this requester to defaults
Definition: pperequestplatformsbase.c:358
SetTargetValueFloatDefault
protected void SetTargetValueFloatDefault(int mat_id, int param_idx)
Definition: pperequestplatformsbase.c:176
PPELightIntensityParamsNative
g_Game.NightVissionLightParams, does not directly use materials. Controls light multiplication and fi...
Definition: ppelightintensityparamsnative.c:5
PPEGlow
Glow - PostProcessEffectType.Glow.
Definition: ppeglow.c:7
PPERequester_GameplayBase
base, not to be used directly, would lead to layering collisions!
Definition: pperbloodloss.c:1
m_CurrentMode
int m_CurrentMode
Definition: plugindayzplayerdebug.c:384
SetTargetValueFloat
protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
Definition: pperequestplatformsbase.c:153
PPEExceptions
PPEExceptions
Definition: ppeconstants.c:41
NV_PUMPKIN
@ NV_PUMPKIN
Definition: dayzplayercamera_base.c:61
m_IsRunning
protected bool m_IsRunning
Definition: pperequestplatformsbase.c:2
PPEFilmGrain
FilmGrain - PostProcessEffectType.FilmGrain.
Definition: ppefilmgrain.c:6
PPEEyeAccomodationNative
Eye Accomodation postprocess, does not directly use materials.
Definition: ppeeyeaccomodationnative.c:5
PPOperators
PPOperators
PP operators, specify operation between subsequent layers.
Definition: ppeconstants.c:51
OnStart
enum EAchievementError OnStart
Definition: pperglasses.c:2