DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Backlit.c
См. документацию.
1
2// Purpose of this file is to encapsulate Backlit Effects
3// Basic implementatoin is for Razer Chroma devices, but API is made to remain universal for future purposes
4//
5// for specific method - watch UAInputAPI/ UAInput class
6//
7//
8
9
10//-----------------------------------------------------------------------------
12const int EUABLAYER_ALL = 0; // all layers
13const int EUABLAYER_HINTKEY = 1; // showing hints
14const int EUABLAYER_VISKEY = 2; // visualisation
15const int EUABLAYER_3 = 3; //
16const int EUABLAYER_CAR = 4; //
17const int EUABLAYER_HUMAN = 5; //
18const int EUABLAYER_6 = 6; //
19const int EUABLAYER_CUSTOM = 7; // custom
20const int EUABLAYER_LOADING = 8; // keys during loading sequence
21const int EUABLAYER_MENU = 9; // keys during menu
22
23
24//-----------------------------------------------------------------------------
26const int EUABACKLIT_NONE = 0; // turn off
27const int EUABACKLIT_ON = 1; // permanent ilumination
28const int EUABACKLIT_2 = 2;
29const int EUABACKLIT_3 = 3;
30const int EUABACKLIT_FADEOUT_SLOW = 4; // slow fadeout
31const int EUABACKLIT_FADEOUT_FAST = 5; // fast fadeout
32const int EUABACKLIT_FADEIN_SLOW = 6; // slow in -> then stay on
33const int EUABACKLIT_FADEIN_FAST = 7; // fast in -> then stay on
34
35
36// note: there should be states like:
37//
38//
39// LOADING/ MAIN MENU/ CONNECTING/ KEYBINDING/ OPTIONS - continuous
40// CHARACTER/ CAR/ "HELI"/ SPECTATOR/ INFECTED - continuous BASE
41// SWIMMING/ CRAWLING/ SPRINTING/ FIGHTING/ FLARE/ FLASHLIGHT - continuous CHARACTER
42//
43// DoorOpen/ HitTaken/ CarCrashed/ etc. - event based
44//
45
46
47const int EUAB_OFF = 0; // all off
48
49// logos :: anims
50const int EUAB_LOGO_DAYZ = 10;
51const int EUAB_LOGO_CONNECTING = 11;
52
53// menus :: anims
54const int EUAB_MENU_BROWSER = 20;
55const int EUAB_MENU_MAIN = 21;
56const int EUAB_MENU_KEYBINDING = 22;
57const int EUAB_MENU_OPTIONS = 23;
58
59// car :: basic background colour + overlay + transition anims
60const int EUAB_CAR_OFF = 100; // sitting in car with engine off
61const int EUAB_CAR_ON_NOLIGHTS = 101; // driving w/o lights (day)
62const int EUAB_CAR_ON_LIGHTS = 102; // driving with headlights (night)
63const int EUAB_CAR_STARTING = 103; // short starting animation
64const int EUAB_CAR_ENTER = 104; // entering car
65const int EUAB_CAR_LEAVE = 105; // leaving car
66const int EUAB_CAR_CRASH = 106; // crashed
67
68// character :: basic background colour + overlay + transition anims
69const int EUAB_PLR_WALK = 200;
70const int EUAB_PLR_RUN = 201;
71const int EUAB_PLR_SPRINT = 202;
72const int EUAB_PLR_SWIM = 203;
73const int EUAB_PLR_HITBY = 204;
74const int EUAB_PLR_CONSUME = 205;
75const int EUAB_PLR_CRAFTING = 206;
76const int EUAB_PLR_EMOTE = 207; // playing emote
77const int EUAB_PLR_UNCONSCIOUS = 208;
78const int EUAB_PLR_DEAD = 209;
79
80// modes :: these are set of background colours
81const int EUAB_MODE_NIGHT = 300;
82const int EUAB_MODE_MORNING_BAD = 301;
83const int EUAB_MODE_MORNING_GOOD = 302;
84const int EUAB_MODE_DAY_FOGGY = 303;
85const int EUAB_MODE_DAY_OVERCAST = 304;
86const int EUAB_MODE_DAY_NICE = 305;
87const int EUAB_MODE_EVENING_BAD = 306;
88const int EUAB_MODE_EVENING_GOOD = 307;
89
90const int EUAB_MODE_FLASHLIGHT = 320;
91const int EUAB_MODE_CHEMLIGHT = 321;
92
93
94// overlay types
95const int EUAB_OVERLAY_NONE = 400; // no overlay
96const int EUAB_OVERLAY_CONTROLS = 401; // highlighted controls
97const int EUAB_OVERLAY_STATUS = 402; // numpad + mouse used for health/ blood level visualisation
98const int EUAB_OVERLAY_VON = 403; // VON status
99
100
101//-----------------------------------------------------------------------------
103
105{
106// private void ~Backlit(); // raist todo: turn lights off there?
107
109
110 void OnInit( DayZGame game )
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 }
119
120 // start infinite loading animation
122 {
123 if( !m_BacklitActive )
124 return; // always return when backlit not present!
125
126 // lighten up your desktop
131 GetUApi().Backlit_Animation("Loading/",2,0xffc8c8c8,0xff080808);
133 }
134
135 // ...
137 {
138 if( !m_BacklitActive )
139 return; // always return when backlit not present!
140
141 // lighten up your desktop
143 GetUApi().Backlit_Animation("MainMenu/",2,0xffff0000,0xff080000);
145 }
146
147 // ...
149 {
150 if( !m_BacklitActive )
151 return; // always return when backlit not present!
152
154 GetUApi().Backlit_Background(0,0xff220000,0xff222222);
155 }
156
157 // ...
159 {
160 if( !m_BacklitActive )
161 return; // always return when backlit not present!
162
164 GetUApi().Backlit_Background(0,0xff211202,0xff110800);
165 }
166
167 // ...
169 {
170 if( !m_BacklitActive )
171 return; // always return when backlit not present!
172
173 // force update player
174 if( GetGame().GetMission().GetHud() )
175 {
177 GetUApi().Backlit_Background(0,0xff220000,0xff222222);
178
179 UpdatePlayer(true);
180 }
181 }
182
183 // ...
185 {
186 if( !m_BacklitActive )
187 return; // always return when backlit not present!
188
189 // reset queue
191 // play hit animation
192 GetUApi().Backlit_Animation("Water/",0,0xff00ffff,0xffffffff);
193 }
194
195 // ...
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 }
209
210 // clear tutorial/ hint keys
212 {
213 if( !m_BacklitActive )
214 return; // always return when backlit not present!
215
216 // remove previous backlit
218 }
219
220 // highlight tutorial/ hint keys
221 void HintShow( UAInput action )
222 {
223 if( !m_BacklitActive )
224 return; // always return when backlit not present!
225
226 action.Backlit_Override(EUABLAYER_HINTKEY,0xffafafff);
227 }
228
229 // clear keybinding keys
231 {
232 if( !m_BacklitActive )
233 return; // always return when backlit not present!
234
236 }
237
238 // clear keybinding keys
239 void KeybindingShow( int keyHash )
240 {
241 if( !m_BacklitActive )
242 return; // always return when backlit not present!
243
245 }
246
247
248 void VisualiseHealth( int iLevel )
249 {
250 UAInputAPI ua_api = GetUApi();
251
252 int aColor = 0xff1fff1f;
253 int dColor = 0xff001f00;
254
255 if( iLevel > 0 )
257 else
258 ua_api.Backlit_KeyByName("kF1",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
259 if( iLevel > 1 )
261 else
262 ua_api.Backlit_KeyByName("kF2",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
263 if( iLevel> 2 )
265 else
266 ua_api.Backlit_KeyByName("kF3",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
267 if( iLevel > 3 )
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 }
285
286 void VisualiseBlood( int iLevel )
287 {
288 UAInputAPI ua_api = GetUApi();
289
290 int aColor = 0xffff1f1f;
291 int dColor = 0xff1f0000;
292
293 if( iLevel > 0 )
295 else
296 ua_api.Backlit_KeyByName("kF5",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
297 if( iLevel > 1 )
299 else
300 ua_api.Backlit_KeyByName("kF6",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
301 if( iLevel > 2 )
303 else
304 ua_api.Backlit_KeyByName("kF7",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
305 if( iLevel > 3 )
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 }
323
326
327 int m_HealthNew = 0;
328 int m_BloodNew = 0;
329
330 void SetHealth( float fHealth ) // range 0 .. 100
331 {
332 float health = fHealth * 0.01; // div 100
333 m_HealthNew = health*4; // 4 stages
334 }
335
336 void SetBlood( float fBlood ) // range 0 .. 5000
337 {
338 float blood = fBlood * 0.0002; // div 5000
339 m_BloodNew = blood*4; // 4 stages
340 }
341
342 void UpdatePlayer( bool bForce )
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
360
361 // set keys to layer CUSTOM
366
369
372
373 // health
375 // blood
377
378 // animation
379 GetUApi().Backlit_Background(0,0xff220000,0xff222222);
380
381 // save level
384 }
385
386
388 bool m_CELBefore = false;
389
390 void RefreshVehicleLayout( int iGear, bool bCEL )
391 {
392 if( !m_BacklitActive )
393 return; // always return when backlit not present!
394
395 UAInputAPI ua_api = GetUApi();
396
397 if( m_GearBefore != iGear )
398 {
399 m_GearBefore = iGear;
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 {
443 m_CELBefore = bCEL;
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 }
452
453};
454
455
456
const int EUAB_PLR_DEAD
Определения Backlit.c:78
const int EUABLAYER_CUSTOM
Определения Backlit.c:19
const int EUABACKLIT_NONE
Input backlit type.
Определения Backlit.c:26
const int EUABLAYER_6
Определения Backlit.c:18
const int EUABACKLIT_3
Определения Backlit.c:29
const int EUAB_MODE_DAY_OVERCAST
Определения Backlit.c:85
const int EUAB_MENU_BROWSER
Определения Backlit.c:54
const int EUAB_PLR_HITBY
Определения Backlit.c:73
const int EUAB_MODE_DAY_NICE
Определения Backlit.c:86
const int EUABLAYER_HUMAN
Определения Backlit.c:17
const int EUABLAYER_VISKEY
Определения Backlit.c:14
const int EUAB_PLR_CONSUME
Определения Backlit.c:74
const int EUAB_MODE_EVENING_GOOD
Определения Backlit.c:88
const int EUAB_PLR_SPRINT
Определения Backlit.c:71
const int EUAB_OVERLAY_STATUS
Определения Backlit.c:97
const int EUAB_CAR_OFF
Определения Backlit.c:60
const int EUABLAYER_CAR
Определения Backlit.c:16
const int EUAB_MODE_NIGHT
Определения Backlit.c:81
const int EUAB_CAR_ON_LIGHTS
Определения Backlit.c:62
const int EUABACKLIT_FADEOUT_SLOW
Определения Backlit.c:30
const int EUAB_CAR_CRASH
Определения Backlit.c:66
const int EUAB_OFF
Определения Backlit.c:47
const int EUAB_MODE_CHEMLIGHT
Определения Backlit.c:91
const int EUAB_OVERLAY_CONTROLS
Определения Backlit.c:96
const int EUAB_PLR_UNCONSCIOUS
Определения Backlit.c:77
const int EUABACKLIT_FADEOUT_FAST
Определения Backlit.c:31
const int EUABLAYER_MENU
Определения Backlit.c:21
const int EUABLAYER_LOADING
Определения Backlit.c:20
const int EUAB_MODE_FLASHLIGHT
Определения Backlit.c:90
const int EUAB_PLR_RUN
Определения Backlit.c:70
const int EUAB_MENU_KEYBINDING
Определения Backlit.c:56
const int EUAB_PLR_EMOTE
Определения Backlit.c:76
const int EUAB_MODE_MORNING_GOOD
Определения Backlit.c:83
const int EUAB_MODE_DAY_FOGGY
Определения Backlit.c:84
const int EUAB_PLR_CRAFTING
Определения Backlit.c:75
const int EUAB_PLR_WALK
Определения Backlit.c:69
const int EUAB_CAR_ENTER
Определения Backlit.c:64
const int EUAB_CAR_ON_NOLIGHTS
Определения Backlit.c:61
const int EUAB_MENU_MAIN
Определения Backlit.c:55
const int EUABACKLIT_FADEIN_SLOW
Определения Backlit.c:32
const int EUABACKLIT_ON
Определения Backlit.c:27
const int EUAB_LOGO_DAYZ
Определения Backlit.c:50
const int EUABLAYER_ALL
Input layer type.
Определения Backlit.c:12
const int EUABLAYER_3
Определения Backlit.c:15
const int EUAB_CAR_LEAVE
Определения Backlit.c:65
const int EUAB_MENU_OPTIONS
Определения Backlit.c:57
const int EUAB_MODE_EVENING_BAD
Определения Backlit.c:87
const int EUAB_MODE_MORNING_BAD
Определения Backlit.c:82
const int EUABACKLIT_2
Определения Backlit.c:28
const int EUAB_OVERLAY_VON
Определения Backlit.c:98
const int EUABACKLIT_FADEIN_FAST
Определения Backlit.c:33
const int EUAB_PLR_SWIM
Определения Backlit.c:72
const int EUAB_LOGO_CONNECTING
Определения Backlit.c:51
const int EUABLAYER_HINTKEY
Определения Backlit.c:13
const int EUAB_OVERLAY_NONE
Определения Backlit.c:95
const int EUAB_CAR_STARTING
Определения Backlit.c:63
proto native UAInputAPI GetUApi()
void SetBlood(float fBlood)
Определения Backlit.c:336
void KeybindingShow(int keyHash)
Определения Backlit.c:239
void OnSwimmingStart()
Определения Backlit.c:184
void KeybindingClear()
Определения Backlit.c:230
void UpdatePlayer(bool bForce)
Определения Backlit.c:342
void OnEnterCar()
Определения Backlit.c:158
int m_HealthBefore
Определения Backlit.c:324
void MainMenu_OnHide()
Определения Backlit.c:148
void OnSwimmingStop()
Определения Backlit.c:196
void OnInit(DayZGame game)
Определения Backlit.c:110
void LoadingAnim()
Определения Backlit.c:121
void HintShow(UAInput action)
Определения Backlit.c:221
void OnLeaveCar()
Определения Backlit.c:168
void VisualiseBlood(int iLevel)
Определения Backlit.c:286
bool m_BacklitActive
Определения Backlit.c:108
int m_HealthNew
Определения Backlit.c:327
void MainMenu_OnShow()
Определения Backlit.c:136
void SetHealth(float fHealth)
Определения Backlit.c:330
int m_BloodBefore
Определения Backlit.c:325
bool m_CELBefore
Определения Backlit.c:388
void VisualiseHealth(int iLevel)
Определения Backlit.c:248
void RefreshVehicleLayout(int iGear, bool bCEL)
Определения Backlit.c:390
int m_BloodNew
Определения Backlit.c:328
void HintClear()
Определения Backlit.c:211
int m_GearBefore
Определения Backlit.c:387
Backlit effect class.
Определения Backlit.c:105
proto native void Backlit_Override(int eType, int iColor)
proto native void Backlit_Animation(string strName, float fLifeTime, int iColor1, int iColor2)
proto native void Backlit_Remove(int eLayer)
proto native void Backlit_EmptyQueue()
proto native void Backlit_Background(int eType, int iColor1, int iColor2)
proto native void Backlit_ForceUpdate()
proto native void Backlit_KeyByHash(int uHash, int eLayer, int eType, int iColor)
proto native void Backlit_KeyByName(string strName, int eLayer, int eType, int iColor)
Определения UAInput.c:166
Определения UAInput.c:24
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.