DayZ 1.29
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
163 UAInputAPI api = GetUApi();
165 api.Backlit_Background(0,0xff211202,0xff110800);
166 }
167
168 // ...
170 {
171 if( !m_BacklitActive )
172 return; // always return when backlit not present!
173
174 // force update player
175 if( g_Game.GetMission().GetHud() )
176 {
177 UAInputAPI api = GetUApi();
179 api.Backlit_Background(0,0xff220000,0xff222222);
180
181 UpdatePlayer(true);
182 }
183 }
184
185 // ...
187 {
188 if( !m_BacklitActive )
189 return; // always return when backlit not present!
190
191 UAInputAPI api = GetUApi();
192 // reset queue
193 api.Backlit_EmptyQueue();
194 // play hit animation
195 api.Backlit_Animation("Water/",0,0xff00ffff,0xffffffff);
196 }
197
198 // ...
200 {
201 if( !m_BacklitActive )
202 return; // always return when backlit not present!
203
204 if( g_Game.GetMission().GetHud() )
205 {
206 // enqueue background
207 GetUApi().Backlit_Background(0,0xff220000,0xff222222);
208 // force update player
209 UpdatePlayer(true);
210 }
211 }
212
213 // clear tutorial/ hint keys
215 {
216 if( !m_BacklitActive )
217 return; // always return when backlit not present!
218
219 // remove previous backlit
221 }
222
223 // highlight tutorial/ hint keys
224 void HintShow( UAInput action )
225 {
226 if( !m_BacklitActive )
227 return; // always return when backlit not present!
228
229 action.Backlit_Override(EUABLAYER_HINTKEY,0xffafafff);
230 }
231
232 // clear keybinding keys
234 {
235 if( !m_BacklitActive )
236 return; // always return when backlit not present!
237
239 }
240
241 // clear keybinding keys
242 void KeybindingShow( int keyHash )
243 {
244 if( !m_BacklitActive )
245 return; // always return when backlit not present!
246
248 }
249
250
251 void VisualiseHealth( int iLevel )
252 {
253 UAInputAPI ua_api = GetUApi();
254
255 int aColor = 0xff1fff1f;
256 int dColor = 0xff001f00;
257
258 if( iLevel > 0 )
260 else
261 ua_api.Backlit_KeyByName("kF1",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
262 if( iLevel > 1 )
264 else
265 ua_api.Backlit_KeyByName("kF2",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
266 if( iLevel> 2 )
268 else
269 ua_api.Backlit_KeyByName("kF3",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
270 if( iLevel > 3 )
272 else
273 ua_api.Backlit_KeyByName("kF4",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
274
275/* int lc = 0xff001f00;
276 if( iLevel > 0 )
277 lc = 0xff003f00;
278 else if( iLevel > 1 )
279 lc = 0xff007f00;
280 else if( iLevel > 2 )
281 lc = 0xff00af00;
282 else if( iLevel > 3 )
283 lc = 0xff00ff00;
284
285 ua_api.Backlit_KeyByName("mBMiddle",EUABLAYER_HUMAN,EUABACKLIT_ON,lc);*/
286
287 }
288
289 void VisualiseBlood( int iLevel )
290 {
291 UAInputAPI ua_api = GetUApi();
292
293 int aColor = 0xffff1f1f;
294 int dColor = 0xff1f0000;
295
296 if( iLevel > 0 )
298 else
299 ua_api.Backlit_KeyByName("kF5",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
300 if( iLevel > 1 )
302 else
303 ua_api.Backlit_KeyByName("kF6",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
304 if( iLevel > 2 )
306 else
307 ua_api.Backlit_KeyByName("kF7",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
308 if( iLevel > 3 )
310 else
311 ua_api.Backlit_KeyByName("kF8",EUABLAYER_HUMAN,EUABACKLIT_ON,dColor );
312
313/* int lc = 0xff1f0000;
314 if( iLevel > 0 )
315 lc = 0xff3f0000;
316 else if( iLevel > 1 )
317 lc = 0xff7f0000;
318 else if( iLevel > 2 )
319 lc = 0xffaf0000;
320 else if( iLevel > 3 )
321 lc = iLevel;
322
323 ua_api.Backlit_KeyByName("mBRight",EUABLAYER_HUMAN,EUABACKLIT_ON,lc);*/
324
325 }
326
329
330 int m_HealthNew = 0;
331 int m_BloodNew = 0;
332
333 void SetHealth( float fHealth ) // range 0 .. 100
334 {
335 float health = fHealth * 0.01; // div 100
336 m_HealthNew = health*4; // 4 stages
337 }
338
339 void SetBlood( float fBlood ) // range 0 .. 5000
340 {
341 float blood = fBlood * 0.0002; // div 5000
342 m_BloodNew = blood*4; // 4 stages
343 }
344
345 void UpdatePlayer( bool bForce )
346 {
347 if( !m_BacklitActive )
348 return; // always return when backlit not present!
349
350 // force update
351 if( bForce )
352 {
353 m_HealthBefore = -1;
354 m_BloodBefore = -1;
355 }
356
357 // do not update
359 return;
360
361 UAInputAPI api = GetUApi();
362 // remove previous layers
364
365 // set keys to layer CUSTOM
370
373
376
377 // health
379 // blood
381
382 // animation
383 api.Backlit_Background(0,0xff220000,0xff222222);
384
385 // save level
388 }
389
390
392 bool m_CELBefore = false;
393
394 void RefreshVehicleLayout( int iGear, bool bCEL )
395 {
396 if( !m_BacklitActive )
397 return; // always return when backlit not present!
398
399 UAInputAPI ua_api = GetUApi();
400
401 if( m_GearBefore != iGear )
402 {
403 m_GearBefore = iGear;
404
405 int activeColor = 0xff3fff3f;
406 int dimmColor = 0xff0f3f0f;
407
408 if( iGear == CarGear.REVERSE )
409 ua_api.Backlit_KeyByName("kR",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
410 else
411 ua_api.Backlit_KeyByName("kR",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
412
413 if( iGear == CarGear.NEUTRAL )
414 ua_api.Backlit_KeyByName("kN",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
415 else
416 ua_api.Backlit_KeyByName("kN",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
417
418 if( iGear == CarGear.FIRST )
419 ua_api.Backlit_KeyByName("k1",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
420 else
421 ua_api.Backlit_KeyByName("k1",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
422
423 if( iGear == CarGear.SECOND )
424 ua_api.Backlit_KeyByName("k2",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
425 else
426 ua_api.Backlit_KeyByName("k2",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
427
428 if( iGear == CarGear.THIRD )
429 ua_api.Backlit_KeyByName("k3",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
430 else
431 ua_api.Backlit_KeyByName("k3",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
432
433 if( iGear == CarGear.FOURTH )
434 ua_api.Backlit_KeyByName("k4",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
435 else
436 ua_api.Backlit_KeyByName("k4",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
437
438 if( iGear == CarGear.FIFTH )
439 ua_api.Backlit_KeyByName("k5",EUABLAYER_CAR,EUABACKLIT_ON,activeColor);
440 else
441 ua_api.Backlit_KeyByName("k5",EUABLAYER_CAR,EUABACKLIT_ON,dimmColor);
442
443 }
444
445 if( bCEL != m_CELBefore )
446 {
447 m_CELBefore = bCEL;
448
449 if( bCEL )
450 ua_api.Backlit_KeyByName("kC",EUABLAYER_CAR,EUABACKLIT_ON,0xffff0f0f);
451 else
452 ua_api.Backlit_KeyByName("kC",EUABLAYER_CAR,EUABACKLIT_NONE,0xff000000);
453 }
454
455 }
456
457};
458
459
460
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
DayZGame g_Game
Определения DayZGame.c:3942
proto native UAInputAPI GetUApi()
void SetBlood(float fBlood)
Определения Backlit.c:339
void KeybindingShow(int keyHash)
Определения Backlit.c:242
void OnSwimmingStart()
Определения Backlit.c:186
void KeybindingClear()
Определения Backlit.c:233
void UpdatePlayer(bool bForce)
Определения Backlit.c:345
void OnEnterCar()
Определения Backlit.c:158
int m_HealthBefore
Определения Backlit.c:327
void MainMenu_OnHide()
Определения Backlit.c:148
void OnSwimmingStop()
Определения Backlit.c:199
void OnInit(DayZGame game)
Определения Backlit.c:110
void LoadingAnim()
Определения Backlit.c:121
void HintShow(UAInput action)
Определения Backlit.c:224
void OnLeaveCar()
Определения Backlit.c:169
void VisualiseBlood(int iLevel)
Определения Backlit.c:289
bool m_BacklitActive
Определения Backlit.c:108
int m_HealthNew
Определения Backlit.c:330
void MainMenu_OnShow()
Определения Backlit.c:136
void SetHealth(float fHealth)
Определения Backlit.c:333
int m_BloodBefore
Определения Backlit.c:328
bool m_CELBefore
Определения Backlit.c:392
void VisualiseHealth(int iLevel)
Определения Backlit.c:251
void RefreshVehicleLayout(int iGear, bool bCEL)
Определения Backlit.c:394
int m_BloodNew
Определения Backlit.c:331
void HintClear()
Определения Backlit.c:214
int m_GearBefore
Определения Backlit.c:391
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 void Print(void var)
Prints content of variable to console/log.