DayZ 1.24
Loading...
Searching...
No Matches
Backlit Class Reference

Backlit effect class. More...

Collaboration diagram for Backlit:
[legend]

Private Member Functions

void OnInit (DayZGame game)
 
void LoadingAnim ()
 
void MainMenu_OnShow ()
 
void MainMenu_OnHide ()
 
void OnEnterCar ()
 
void OnLeaveCar ()
 
void OnSwimmingStart ()
 
void OnSwimmingStop ()
 
void HintClear ()
 
void HintShow (UAInput action)
 
void KeybindingClear ()
 
void KeybindingShow (int keyHash)
 
void VisualiseHealth (int iLevel)
 
void VisualiseBlood (int iLevel)
 
void SetHealth (float fHealth)
 
void SetBlood (float fBlood)
 
void UpdatePlayer (bool bForce)
 
void RefreshVehicleLayout (int iGear, bool bCEL)
 

Private Attributes

bool m_BacklitActive
 
int m_HealthBefore = -1
 
int m_BloodBefore = -1
 
int m_HealthNew = 0
 
int m_BloodNew = 0
 
int m_GearBefore = 0
 
bool m_CELBefore = false
 

Detailed Description

Backlit effect class.

Definition at line 104 of file Backlit.c.

Member Function Documentation

◆ HintClear()

void Backlit::HintClear ( )
inlineprivate

Definition at line 211 of file Backlit.c.

212 {
213 if (!m_BacklitActive)
214 return; // always return when backlit not present!
215
216 // remove previous backlit
217 GetUApi().Backlit_Remove(EUABLAYER_HINTKEY);
218 }
const int EUABLAYER_HINTKEY
Definition Backlit.c:13
proto native UAInputAPI GetUApi()
bool m_BacklitActive
Definition Backlit.c:108

References EUABLAYER_HINTKEY, GetUApi(), and m_BacklitActive.

◆ HintShow()

void Backlit::HintShow ( UAInput action)
inlineprivate

Definition at line 221 of file Backlit.c.

222 {
223 if (!m_BacklitActive)
224 return; // always return when backlit not present!
225
226 action.Backlit_Override(EUABLAYER_HINTKEY, 0xffafafff);
227 }

References EUABLAYER_HINTKEY, and m_BacklitActive.

◆ KeybindingClear()

void Backlit::KeybindingClear ( )
inlineprivate

Definition at line 230 of file Backlit.c.

231 {
232 if (!m_BacklitActive)
233 return; // always return when backlit not present!
234
235 GetUApi().Backlit_Remove(EUABLAYER_ALL);
236 }
const int EUABLAYER_ALL
Input layer type.
Definition Backlit.c:12

References EUABLAYER_ALL, GetUApi(), and m_BacklitActive.

◆ KeybindingShow()

void Backlit::KeybindingShow ( int keyHash)
inlineprivate

Definition at line 239 of file Backlit.c.

240 {
241 if (!m_BacklitActive)
242 return; // always return when backlit not present!
243
244 GetUApi().Backlit_KeyByHash(keyHash, EUABLAYER_VISKEY, EUABACKLIT_FADEOUT_SLOW, 0xff0000ff);
245 }
const int EUABLAYER_VISKEY
Definition Backlit.c:14
const int EUABACKLIT_FADEOUT_SLOW
Definition Backlit.c:30

References EUABACKLIT_FADEOUT_SLOW, EUABLAYER_VISKEY, GetUApi(), and m_BacklitActive.

◆ LoadingAnim()

void Backlit::LoadingAnim ( )
inlineprivate

Definition at line 121 of file Backlit.c.

122 {
123 if (!m_BacklitActive)
124 return; // always return when backlit not present!
125
126 // lighten up your desktop
127 GetUApi().Backlit_KeyByName("kD", EUABLAYER_LOADING, EUABACKLIT_ON, 0xffff0000);
128 GetUApi().Backlit_KeyByName("kA", EUABLAYER_LOADING, EUABACKLIT_ON, 0xffcf0000);
129 GetUApi().Backlit_KeyByName("kY", EUABLAYER_LOADING, EUABACKLIT_ON, 0xffaf0000);
130 GetUApi().Backlit_KeyByName("kZ", EUABLAYER_LOADING, EUABACKLIT_ON, 0xff8f0000);
131 GetUApi().Backlit_Animation("Loading/", 2, 0xffc8c8c8, 0xff080808);
132 GetUApi().Backlit_ForceUpdate();
133 }
const int EUABLAYER_LOADING
Definition Backlit.c:20
const int EUABACKLIT_ON
Definition Backlit.c:27

References EUABACKLIT_ON, EUABLAYER_LOADING, GetUApi(), and m_BacklitActive.

◆ MainMenu_OnHide()

void Backlit::MainMenu_OnHide ( )
inlineprivate

Definition at line 148 of file Backlit.c.

149 {
150 if (!m_BacklitActive)
151 return; // always return when backlit not present!
152
153 GetUApi().Backlit_Remove(EUABLAYER_ALL);
154 GetUApi().Backlit_Background(0, 0xff220000, 0xff222222);
155 }

References EUABLAYER_ALL, GetUApi(), and m_BacklitActive.

◆ MainMenu_OnShow()

void Backlit::MainMenu_OnShow ( )
inlineprivate

Definition at line 136 of file Backlit.c.

137 {
138 if (!m_BacklitActive)
139 return; // always return when backlit not present!
140
141 // lighten up your desktop
142 GetUApi().Backlit_Remove(EUABLAYER_ALL);
143 GetUApi().Backlit_Animation("MainMenu/", 2, 0xffff0000, 0xff080000);
144 GetUApi().Backlit_ForceUpdate();
145 }

References EUABLAYER_ALL, GetUApi(), and m_BacklitActive.

◆ OnEnterCar()

void Backlit::OnEnterCar ( )
inlineprivate

Definition at line 158 of file Backlit.c.

159 {
160 if (!m_BacklitActive)
161 return; // always return when backlit not present!
162
163 GetUApi().Backlit_Remove(EUABLAYER_ALL);
164 GetUApi().Backlit_Background(0, 0xff211202, 0xff110800);
165 }

References EUABLAYER_ALL, GetUApi(), and m_BacklitActive.

◆ OnInit()

void Backlit::OnInit ( DayZGame game)
inlineprivate

Definition at line 110 of file Backlit.c.

111 {
112 // enable only on client/ standalone!
113 if (game.IsClient() || !game.IsMultiplayer())
114 m_BacklitActive = true;
115
116 if (m_BacklitActive)
117 Print("... Backlit Effects Enabled");
118 }
proto void Print(void var)
Prints content of variable to console/log.

References m_BacklitActive, and Print().

◆ OnLeaveCar()

void Backlit::OnLeaveCar ( )
inlineprivate

Definition at line 168 of file Backlit.c.

169 {
170 if (!m_BacklitActive)
171 return; // always return when backlit not present!
172
173 // force update player
174 if (GetGame().GetMission().GetHud())
175 {
176 GetUApi().Backlit_Remove(EUABLAYER_ALL);
177 GetUApi().Backlit_Background(0, 0xff220000, 0xff222222);
178
179 UpdatePlayer(true);
180 }
181 }
void UpdatePlayer(bool bForce)
Definition Backlit.c:342
proto native CGame GetGame()

References EUABLAYER_ALL, GetGame(), GetUApi(), m_BacklitActive, and UpdatePlayer().

◆ OnSwimmingStart()

void Backlit::OnSwimmingStart ( )
inlineprivate

Definition at line 184 of file Backlit.c.

185 {
186 if (!m_BacklitActive)
187 return; // always return when backlit not present!
188
189 // reset queue
190 GetUApi().Backlit_EmptyQueue();
191 // play hit animation
192 GetUApi().Backlit_Animation("Water/", 0, 0xff00ffff, 0xffffffff);
193 }

References GetUApi(), and m_BacklitActive.

◆ OnSwimmingStop()

void Backlit::OnSwimmingStop ( )
inlineprivate

Definition at line 196 of file Backlit.c.

197 {
198 if (!m_BacklitActive)
199 return; // always return when backlit not present!
200
201 if (GetGame().GetMission().GetHud())
202 {
203 // enqueue background
204 GetUApi().Backlit_Background(0, 0xff220000, 0xff222222);
205 // force update player
206 UpdatePlayer(true);
207 }
208 }

References GetGame(), GetUApi(), m_BacklitActive, and UpdatePlayer().

◆ RefreshVehicleLayout()

void Backlit::RefreshVehicleLayout ( int iGear,
bool bCEL )
inlineprivate

Definition at line 390 of file Backlit.c.

391 {
392 if (!m_BacklitActive)
393 return; // always return when backlit not present!
394
396
397 if (m_GearBefore != iGear)
398 {
400
401 int activeColor = 0xff3fff3f;
402 int dimmColor = 0xff0f3f0f;
403
404 if (iGear == CarGear.REVERSE)
405 ua_api.Backlit_KeyByName("kR", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
406 else
407 ua_api.Backlit_KeyByName("kR", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
408
409 if (iGear == CarGear.NEUTRAL)
410 ua_api.Backlit_KeyByName("kN", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
411 else
412 ua_api.Backlit_KeyByName("kN", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
413
414 if (iGear == CarGear.FIRST)
415 ua_api.Backlit_KeyByName("k1", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
416 else
417 ua_api.Backlit_KeyByName("k1", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
418
419 if (iGear == CarGear.SECOND)
420 ua_api.Backlit_KeyByName("k2", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
421 else
422 ua_api.Backlit_KeyByName("k2", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
423
424 if (iGear == CarGear.THIRD)
425 ua_api.Backlit_KeyByName("k3", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
426 else
427 ua_api.Backlit_KeyByName("k3", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
428
429 if (iGear == CarGear.FOURTH)
430 ua_api.Backlit_KeyByName("k4", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
431 else
432 ua_api.Backlit_KeyByName("k4", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
433
434 if (iGear == CarGear.FIFTH)
435 ua_api.Backlit_KeyByName("k5", EUABLAYER_CAR, EUABACKLIT_ON, activeColor);
436 else
437 ua_api.Backlit_KeyByName("k5", EUABLAYER_CAR, EUABACKLIT_ON, dimmColor);
438
439 }
440
441 if (bCEL != m_CELBefore)
442 {
444
445 if (bCEL)
446 ua_api.Backlit_KeyByName("kC", EUABLAYER_CAR, EUABACKLIT_ON, 0xffff0f0f);
447 else
448 ua_api.Backlit_KeyByName("kC", EUABLAYER_CAR, EUABACKLIT_NONE, 0xff000000);
449 }
450
451 }
const int EUABACKLIT_NONE
Input backlit type.
Definition Backlit.c:26
const int EUABLAYER_CAR
Definition Backlit.c:16
bool m_CELBefore
Definition Backlit.c:388
int m_GearBefore
Definition Backlit.c:387

References EUABACKLIT_NONE, EUABACKLIT_ON, EUABLAYER_CAR, GetUApi(), m_BacklitActive, m_CELBefore, and m_GearBefore.

◆ SetBlood()

void Backlit::SetBlood ( float fBlood)
inlineprivate

Definition at line 336 of file Backlit.c.

337 {
338 float blood = fBlood * 0.0002; // div 5000
339 m_BloodNew = blood * 4; // 4 stages
340 }
int m_BloodNew
Definition Backlit.c:328

References m_BloodNew.

◆ SetHealth()

void Backlit::SetHealth ( float fHealth)
inlineprivate

Definition at line 330 of file Backlit.c.

331 {
332 float health = fHealth * 0.01; // div 100
333 m_HealthNew = health * 4; // 4 stages
334 }
int m_HealthNew
Definition Backlit.c:327

References m_HealthNew.

◆ UpdatePlayer()

void Backlit::UpdatePlayer ( bool bForce)
inlineprivate

Definition at line 342 of file Backlit.c.

343 {
344 if (!m_BacklitActive)
345 return; // always return when backlit not present!
346
347 // force update
348 if (bForce)
349 {
350 m_HealthBefore = -1;
351 m_BloodBefore = -1;
352 }
353
354 // do not update
356 return;
357
358 // remove previous layers
359 GetUApi().Backlit_Remove(EUABLAYER_ALL);
360
361 // set keys to layer CUSTOM
362 GetUApi().Backlit_KeyByName("kW", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff0000ff);
363 GetUApi().Backlit_KeyByName("kA", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff0000cf);
364 GetUApi().Backlit_KeyByName("kS", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff0000af);
365 GetUApi().Backlit_KeyByName("kD", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff00008f);
366
367 GetUApi().Backlit_KeyByName("kX", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff3f3f3f);
368 GetUApi().Backlit_KeyByName("kC", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff3f3f3f);
369
370 GetUApi().Backlit_KeyByName("kQ", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff7f7f0f);
371 GetUApi().Backlit_KeyByName("kE", EUABLAYER_CUSTOM, EUABACKLIT_ON, 0xff7f7f0f);
372
373 // health
375 // blood
377
378 // animation
379 GetUApi().Backlit_Background(0, 0xff220000, 0xff222222);
380
381 // save level
384 }
const int EUABLAYER_CUSTOM
Definition Backlit.c:19
int m_HealthBefore
Definition Backlit.c:324
void VisualiseBlood(int iLevel)
Definition Backlit.c:286
int m_BloodBefore
Definition Backlit.c:325
void VisualiseHealth(int iLevel)
Definition Backlit.c:248

References EUABACKLIT_ON, EUABLAYER_ALL, EUABLAYER_CUSTOM, GetUApi(), m_BacklitActive, m_BloodBefore, m_BloodNew, m_HealthBefore, m_HealthNew, VisualiseBlood(), and VisualiseHealth().

Referenced by OnLeaveCar(), and OnSwimmingStop().

◆ VisualiseBlood()

void Backlit::VisualiseBlood ( int iLevel)
inlineprivate

Definition at line 286 of file Backlit.c.

287 {
289
290 int aColor = 0xffff1f1f;
291 int dColor = 0xff1f0000;
292
293 if (iLevel > 0)
294 ua_api.Backlit_KeyByName("kF5", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
295 else
296 ua_api.Backlit_KeyByName("kF5", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
297 if (iLevel > 1)
298 ua_api.Backlit_KeyByName("kF6", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
299 else
300 ua_api.Backlit_KeyByName("kF6", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
301 if (iLevel > 2)
302 ua_api.Backlit_KeyByName("kF7", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
303 else
304 ua_api.Backlit_KeyByName("kF7", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
305 if (iLevel > 3)
306 ua_api.Backlit_KeyByName("kF8", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
307 else
308 ua_api.Backlit_KeyByName("kF8", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
309
310 /* int lc = 0xff1f0000;
311 if( iLevel > 0 )
312 lc = 0xff3f0000;
313 else if( iLevel > 1 )
314 lc = 0xff7f0000;
315 else if( iLevel > 2 )
316 lc = 0xffaf0000;
317 else if( iLevel > 3 )
318 lc = iLevel;
319
320 ua_api.Backlit_KeyByName("mBRight",EUABLAYER_HUMAN,EUABACKLIT_ON,lc);*/
321
322 }
const int EUABLAYER_HUMAN
Definition Backlit.c:17

References EUABACKLIT_ON, EUABLAYER_HUMAN, and GetUApi().

Referenced by UpdatePlayer().

◆ VisualiseHealth()

void Backlit::VisualiseHealth ( int iLevel)
inlineprivate

Definition at line 248 of file Backlit.c.

249 {
251
252 int aColor = 0xff1fff1f;
253 int dColor = 0xff001f00;
254
255 if (iLevel > 0)
256 ua_api.Backlit_KeyByName("kF1", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
257 else
258 ua_api.Backlit_KeyByName("kF1", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
259 if (iLevel > 1)
260 ua_api.Backlit_KeyByName("kF2", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
261 else
262 ua_api.Backlit_KeyByName("kF2", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
263 if (iLevel > 2)
264 ua_api.Backlit_KeyByName("kF3", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
265 else
266 ua_api.Backlit_KeyByName("kF3", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
267 if (iLevel > 3)
268 ua_api.Backlit_KeyByName("kF4", EUABLAYER_HUMAN, EUABACKLIT_ON, aColor);
269 else
270 ua_api.Backlit_KeyByName("kF4", EUABLAYER_HUMAN, EUABACKLIT_ON, dColor);
271
272 /* int lc = 0xff001f00;
273 if( iLevel > 0 )
274 lc = 0xff003f00;
275 else if( iLevel > 1 )
276 lc = 0xff007f00;
277 else if( iLevel > 2 )
278 lc = 0xff00af00;
279 else if( iLevel > 3 )
280 lc = 0xff00ff00;
281
282 ua_api.Backlit_KeyByName("mBMiddle",EUABLAYER_HUMAN,EUABACKLIT_ON,lc);*/
283
284 }

References EUABACKLIT_ON, EUABLAYER_HUMAN, and GetUApi().

Referenced by UpdatePlayer().

Member Data Documentation

◆ m_BacklitActive

◆ m_BloodBefore

int Backlit::m_BloodBefore = -1
private

Definition at line 325 of file Backlit.c.

Referenced by UpdatePlayer().

◆ m_BloodNew

int Backlit::m_BloodNew = 0
private

Definition at line 328 of file Backlit.c.

Referenced by SetBlood(), and UpdatePlayer().

◆ m_CELBefore

bool Backlit::m_CELBefore = false
private

Definition at line 388 of file Backlit.c.

Referenced by RefreshVehicleLayout().

◆ m_GearBefore

int Backlit::m_GearBefore = 0
private

Definition at line 387 of file Backlit.c.

Referenced by RefreshVehicleLayout().

◆ m_HealthBefore

int Backlit::m_HealthBefore = -1
private

Definition at line 324 of file Backlit.c.

Referenced by UpdatePlayer().

◆ m_HealthNew

int Backlit::m_HealthNew = 0
private

Definition at line 327 of file Backlit.c.

Referenced by SetHealth(), and UpdatePlayer().


The documentation for this class was generated from the following file: