Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseManualCameraComponent.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6 {
7  [Attribute("1")]
8  private bool m_bEnabled;
9 
10  [Attribute("", UIWidgets.Flags, enums: ParamEnumArray.FromEnum(EManualCameraFlag))]
11  private EManualCameraFlag m_FlagsWhitelist;
12 
13  [Attribute("", UIWidgets.Flags, enums: ParamEnumArray.FromEnum(EManualCameraFlag))]
14  private EManualCameraFlag m_FlagsBlacklist;
15 
16  [Attribute("", UIWidgets.Auto, "Component processing priority. Higher value = higher priority")]
17  protected int m_iPriority;
18 
19  protected SCR_ManualCamera m_Camera;
20  protected InputManager m_InputManager;
21 
25  //------------------------------------------------------------------------------------------------
28  void EOnCameraFrame(SCR_ManualCameraParam param);
29 
30  //------------------------------------------------------------------------------------------------
33  bool EOnCameraInit();
34 
35  //------------------------------------------------------------------------------------------------
37  void EOnCameraExit();
38 
39  //------------------------------------------------------------------------------------------------
41  void EOnCameraReset();
42 
43  //------------------------------------------------------------------------------------------------
47  void EOnCameraParentChange(bool attached, IEntity parent);
48 
49  //------------------------------------------------------------------------------------------------
52  void EOnCameraSave(SCR_ManualCameraComponentSave data);
53 
54  //------------------------------------------------------------------------------------------------
57  void EOnCameraLoad(SCR_ManualCameraComponentSave data);
59 
61  //--- Custom functions
62 
63  //------------------------------------------------------------------------------------------------
64  protected SCR_ManualCamera GetCameraEntity()
65  {
66  return m_Camera;
67  }
68 
69  //------------------------------------------------------------------------------------------------
70  protected InputManager GetInputManager()
71  {
72  return m_InputManager;
73  }
74 
75  //------------------------------------------------------------------------------------------------
76  protected vector CoordToCamera(vector pos)
77  {
78  if (!m_Camera.GetParent())
79  return pos;
80 
81  return m_Camera.GetParent().CoordToLocal(pos);
82  }
83 
84  //------------------------------------------------------------------------------------------------
85  protected vector CoordFromCamera(vector pos)
86  {
87  if (!m_Camera.GetParent())
88  return pos;
89 
90  return m_Camera.GetParent().CoordToParent(pos);
91  }
92 
93  //------------------------------------------------------------------------------------------------
96  void SetEnabled(bool enabled)
97  {
98  m_bEnabled = enabled;
99  }
100 
101  //------------------------------------------------------------------------------------------------
104  int IsEnabled()
105  {
106  return m_bEnabled;
107  }
108 
109  //------------------------------------------------------------------------------------------------
112  int GetPriority()
113  {
114  return m_iPriority;
115  }
116 
117  //------------------------------------------------------------------------------------------------
121  bool HasFlag(EManualCameraFlag flag)
122  {
123  return m_bEnabled && (flag & m_FlagsWhitelist) == m_FlagsWhitelist && (flag & m_FlagsBlacklist) == 0;
124  }
125 
126  //------------------------------------------------------------------------------------------------
130  bool InitBase(SCR_ManualCamera camera)
131  {
132  m_Camera = camera;
133  m_InputManager = GetGame().GetInputManager();
134  return EOnCameraInit();
135  }
136 }
137 
138 class SCR_BaseManualCameraComponentTitle : BaseContainerCustomTitle
139 {
140  //------------------------------------------------------------------------------------------------
141  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
142  {
143  title = source.GetClassName();
144  title.Replace("SCR_", "");
145  title.Replace("ManualCameraComponent", "");
146 
147  EManualCameraFlag flagsWhitelist = 0;
148  source.Get("m_FlagsWhitelist", flagsWhitelist);
149  string textWhitelist;
150  if (flagsWhitelist != 0)
151  {
152  array<int> bitValues = {};
153  SCR_Enum.BitToIntArray(flagsWhitelist, bitValues);
154  foreach (int i, int value: bitValues)
155  {
156  if (i != 0)
157  textWhitelist += " && ";
158 
159  textWhitelist += typename.EnumToString(EManualCameraFlag, value);
160  }
161  }
162 
163  EManualCameraFlag flagsBlacklist = 0;
164  source.Get("m_FlagsBlacklist", flagsBlacklist);
165  string textBlacklist;
166  if (flagsBlacklist != 0)
167  {
168  if (flagsWhitelist != 0)
169  textBlacklist += " && ";
170 
171  array<int> bitValues = {};
172  SCR_Enum.BitToIntArray(flagsBlacklist, bitValues);
173  foreach (int i, int value: bitValues)
174  {
175  if (i != 0)
176  textBlacklist += " && ";
177 
178  textBlacklist += "!" + typename.EnumToString(EManualCameraFlag, value);
179  }
180  }
181 
182  if (flagsWhitelist != 0 || flagsBlacklist != 0)
183  title = string.Format("[%1] %2", textWhitelist + textBlacklist, title);
184 
185  int priority = 0;
186  if (source.Get("m_iPriority", priority))
187  title = string.Format("%1: %2", priority.ToString(2), title);
188 
189  bool enabled = true;
190  if (source.Get("m_bEnabled", enabled) && !enabled)
191  title = string.Format("// %1", title);
192 
193  return true;
194  }
195 }
SCR_ManualCamera
Definition: SCR_ManualCamera.c:16
SCR_Enum
Definition: SCR_Enum.c:1
m_InputManager
protected InputManager m_InputManager
Definition: SCR_BaseManualCameraComponent.c:15
SCR_BaseManualCameraComponent
Parent class from which all SCR_ManualCamera components inherit.
Definition: SCR_BaseManualCameraComponent.c:5
m_FlagsWhitelist
private EManualCameraFlag m_FlagsWhitelist
Definition: SCR_BaseManualCameraComponent.c:6
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_Camera
protected SCR_ManualCamera m_Camera
Definition: SCR_BaseManualCameraComponent.c:14
EManualCameraFlag
EManualCameraFlag
Definition: EManualCameraFlag.c:7
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ManualCameraComponentSave
Definition: SCR_ManualCameraSave.c:15
SCR_ManualCameraParam
Parameter for carrying information between individual camera components.
Definition: SCR_ManualCameraParam.c:5
m_bEnabled
private bool m_bEnabled
Definition: SCR_BaseManualCameraComponent.c:3
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
m_FlagsBlacklist
private EManualCameraFlag m_FlagsBlacklist
Definition: SCR_BaseManualCameraComponent.c:9
m_iPriority
int m_iPriority
Definition: SCR_AITalkRequest.c:28
_WB_GetCustomTitle
class SCR_BaseManualCameraComponent _WB_GetCustomTitle(BaseContainer source, out string title)
Definition: SCR_BaseManualCameraComponent.c:141
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468