DayZ 1.24
Loading...
Searching...
No Matches
IngameHud.c
Go to the documentation of this file.
1class IngameHud extends Hud
2{
3 protected const float FADE_IN_TIME = 0.3;
4 protected const float FADE_OUT_TIME = 0.3;
5 protected const float HIDE_MENU_TIME = 5;
6
8 protected ref map<int, ImageWidget> m_StatesWidgets; // [key] ImageWidget
9
10 protected ref map<ImageWidget, int> m_TendencyStatusCritical; //array of icons that are blinking due to critical tendency status
11 protected const float TENDENCY_BLINK_TIME = 0.25;
12 protected float m_BlinkTime;
13
17 protected ref map<int, ImageWidget> m_BadgesWidgets; // [key] ImageWidget
18 protected bool m_AnyBadgeVisible;
19 protected bool m_IsTemperatureVisible;
20 protected float m_TemperatureTimer;
21 protected float m_TemperatureShowTime = 30;
23
24 protected bool m_IsStaminaVisible;
25 protected float m_StaminaTimer;
26 protected float m_StaminaShowTime = 0.15;
27
30
34 protected ref InventoryQuickbar m_Quickbar;
35
37
47
49
53
59
62
63 protected bool m_InVehicleAsDriver;
65
66
73
78 protected Widget m_Badges;
80 protected ref WidgetFadeTimer m_FadeTimerCrosshair;
81 protected ref WidgetFadeTimer m_FadeTimerActionCursor;
82 // protected ref WidgetFadeTimer m_FadeTimerWeaponMode;
83 // protected ref WidgetFadeTimer m_FadeTimerZeroing;
84 protected ref WidgetFadeTimer m_FadeTimerZeroingOld;
85 protected ref WidgetFadeTimer m_FadeTimerMagazineName;
86 protected ref WidgetFadeTimer m_FadeTimerWeaponName;
87 protected ref WidgetFadeTimer m_FadeTimerWeaponStats;
88 protected ref WidgetFadeTimer m_FadeTimerQuickbar;
89 protected ref WidgetFadeTimer m_FadeTimerWalkieTalkie;
90 protected ref WidgetFadeTimer m_FadeTimerWalkieTalkieText;
91
94 protected Widget m_Presence;
106 protected ref Timer myTimer; //TEMP
116
127
130
133
134 // CrossHairs
136
137 protected bool m_HudHideUI;
138 protected bool m_HudHidePlayer;
139 protected bool m_HudInventory;
140 protected bool m_HudState; //options-driven global setting
141 protected bool m_QuickbarHideUI;
142 protected bool m_QuickbarHidePlayer;
143 protected bool m_QuickbarState; //options-driven global setting
144 protected bool m_IsQuickbarVisible;
145 protected bool m_IsHudVisible;
146 protected bool m_Faded;
147 protected bool m_ZeroingKeyPressed;
148
156
158
160 {
161 m_FadeTimerCrosshair = new WidgetFadeTimer;
162 m_FadeTimerActionCursor = new WidgetFadeTimer;
163 m_FadeTimerQuickbar = new WidgetFadeTimer;
164 m_FadeTimerWalkieTalkie = new WidgetFadeTimer;
165 m_FadeTimerWalkieTalkieText = new WidgetFadeTimer;
166
167 m_StatesWidgets = new map<int, ImageWidget>; // [key] widgetName
168 m_StatesWidgetNames = new map<int, string>;
169
170 m_TendencyStatusCritical = new map<ImageWidget, int>;
171
172 m_BadgesWidgets = new map<int, ImageWidget>; // [key] widgetName
173 m_BadgesWidgetNames = new map<int, string>;
174 m_BadgesSupportedLevels = new map<int, int>;
175 m_BadgesWidgetDisplay = new map<int, int>;
176
177 m_VehicleDamageZonesHitTimer = 0;
178
179 m_VehicleGearTable = new map<int, string>;
180 m_VehicleGearTable.Set(-1, "");
181 m_VehicleGearTable.Set(CarGear.REVERSE, "R");
182 m_VehicleGearTable.Set(CarGear.NEUTRAL, "N");
183 m_VehicleGearTable.Set(CarGear.FIRST, "1");
184 m_VehicleGearTable.Set(CarGear.SECOND, "2");
185 m_VehicleGearTable.Set(CarGear.THIRD, "3");
186 m_VehicleGearTable.Set(CarGear.FOURTH, "4");
187 m_VehicleGearTable.Set(CarGear.FIFTH, "5");
188 m_VehicleGearTable.Set(CarGear.SIXTH, "6");
189 m_VehicleGearTable.Set(CarGear.SEVENTH, "7");
190 m_VehicleGearTable.Set(CarGear.EIGTH, "8");
191
192 m_VehicleGearTableAuto = new map<int, string>;
193 m_VehicleGearTableAuto.Set(-1, "");
194 m_VehicleGearTableAuto.Set(CarAutomaticGearboxMode.R, "R");
195 m_VehicleGearTableAuto.Set(CarAutomaticGearboxMode.N, "N");
196 m_VehicleGearTableAuto.Set(CarAutomaticGearboxMode.D, "D");
197
198 }
199
201 {
202 m_HudPanelWidget = hud_panel_widget;
203 m_HudPanelWidget.Show(true);
204
205 //Quickbar
206 m_QuickbarWidget = m_HudPanelWidget.FindAnyWidget("QuickbarGrid");
207 m_QuickbarWidget.Show(false);
208
209 //Left HUD Panel
210 m_LeftHudPanelWidget = m_HudPanelWidget.FindAnyWidget("LeftHUDPanel");
211
212 //TEMPORARY HACK!!! player is not present when Hud is being initialized
213 myTimer = new Timer(CALL_CATEGORY_GAMEPLAY);
214 myTimer.Run(1, this, "InitQuickbar");
215
216 m_CursorWidget = m_HudPanelWidget.FindAnyWidget("CursorIcons");
217 m_CursorWidget.Show(true);
218 Class.CastTo(m_CursorIcon, m_HudPanelWidget.FindAnyWidget("Cursor"));
219
220 //Permanent Crosshair
221 Class.CastTo(m_PermanentCrossHair, m_HudPanelWidget.FindAnyWidget("PermanentCrossHair"));
222
223 m_WalkieTalkie = m_HudPanelWidget.FindAnyWidget("WalkieTalkie");
224
225 //Panels
226 Class.CastTo(m_Stamina, m_HudPanelWidget.FindAnyWidget("StaminaBar"));
227 m_Presence = m_HudPanelWidget.FindAnyWidget("PresencePanel");
228 m_Badges = hud_panel_widget.FindAnyWidget("BadgesPanel");
229 m_Notifiers = m_HudPanelWidget.FindAnyWidget("NotifiersPanel");
230 m_SpecializatonPanel = m_HudPanelWidget.FindAnyWidget("SpecializationPanel");
231 m_SpecializationIcon = m_HudPanelWidget.FindAnyWidget("SpecializationIcon");
232 m_BadgeNotifierDivider = m_HudPanelWidget.FindAnyWidget("BadgeNotifierDivider");
233 m_BloodType = TextWidget.Cast(m_HudPanelWidget.FindAnyWidget("BloodType"));
234 m_BloodPosType = TextWidget.Cast(m_HudPanelWidget.FindAnyWidget("BloodPosType"));
235
236 m_VehiclePanel = m_HudPanelWidget.FindAnyWidget("VehiclePanel");
237 m_VehiclePanel.Show(false);
238
239 m_VehicleRPMPointer = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("RPMPointer"));
240 m_VehicleRPMDial = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("RPMDial"));
241 m_VehicleRPMRedline = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("RPMDialRedline"));
242 m_VehicleSpeedPointer = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("SpeedPointer"));
243 m_VehicleSpeedValue = TextWidget.Cast(m_VehiclePanel.FindAnyWidget("SpeedValue"));
244
245 m_VehicleCurrentGearValue = TextWidget.Cast(m_VehiclePanel.FindAnyWidget("Current"));
246 m_VehicleNextGearValue = TextWidget.Cast(m_VehiclePanel.FindAnyWidget("Next"));
247 m_VehiclePrevGearValue = TextWidget.Cast(m_VehiclePanel.FindAnyWidget("Prev"));
248
249 m_VehicleBatteryLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("BatteryLight"));
250 m_VehicleEngineLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("EngineLight"));
251 m_VehicleOilLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("OilLight"));
252 m_VehicleHandBrakeLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("HandBrakeLight"));
253 m_VehicleWheelLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("WheelLight"));
254
255 m_VehicleTemperatureIndicator = m_VehiclePanel.FindAnyWidget("TemperatureIndicator");
256 m_VehicleTemperaturePointer = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("TemperaturePointer"));
257 m_VehicleTemperatureLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("TemperatureLight"));
258 m_VehicleFuelPointer = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("FuelPointer"));
259 m_VehicleFuelLight = ImageWidget.Cast(m_VehiclePanel.FindAnyWidget("FuelLight"));
260
261 m_StaminaBackground = m_HudPanelWidget.FindAnyWidget("StaminaBackground");
262 m_StaminaBackground.Show(true);
263 m_StanceProne = m_HudPanelWidget.FindAnyWidget("StanceProne");
264 m_StanceCrouch = m_HudPanelWidget.FindAnyWidget("StanceCrouch");
265 m_StanceStand = m_HudPanelWidget.FindAnyWidget("StanceStand");
266 m_StanceStandWalk = m_HudPanelWidget.FindAnyWidget("StanceStandWalk");
267 m_StanceCar = m_HudPanelWidget.FindAnyWidget("StanceCar");
268 m_StancePanel = m_HudPanelWidget.FindAnyWidget("StancePanel");
269
270 m_ActionTarget = m_HudPanelWidget.FindAnyWidget("ActionTargetsCursorWidget");
272 m_ActionTarget.GetScript(m_ActionTargetsCursor);
273
274 // heat buffer plus sign
275 m_HeatBufferPlus = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("HeatBuffer"));
276
277 //Game State Icons
278 m_GameStatusIconsPanel = m_HudPanelWidget.FindAnyWidget("GameStatusIcons");
279 m_HighPingA = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("HighPingA"));
280 m_HighPingB = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("HighPingB"));
281 m_LowServerPerfA = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("LowServerPerfA"));
282 m_LowServerPerfB = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("LowServerPerfB"));
283 m_ConnectionLost = ImageWidget.Cast(m_HudPanelWidget.FindAnyWidget("ConnectionLost"));
284
285 if (m_HeatBufferPlus)
286 m_HeatBufferPlus.Show(false);
287
288#ifndef NO_GUI
290 m_Timer.Run(0.333, this, "RefreshQuickbar", NULL, true);
291#endif
293
294 m_PresenceLevel0 = hud_panel_widget.FindAnyWidget("Presence0");
295 m_PresenceLevel1 = hud_panel_widget.FindAnyWidget("Presence1");
296 m_PresenceLevel2 = hud_panel_widget.FindAnyWidget("Presence2");
297 m_PresenceLevel3 = hud_panel_widget.FindAnyWidget("Presence3");
298 m_PresenceLevel4 = hud_panel_widget.FindAnyWidget("Presence4");
299 m_PresenceLevel0.Show(false);
300 m_PresenceLevel1.Show(false);
301 m_PresenceLevel2.Show(false);
302 m_PresenceLevel3.Show(false);
303 m_PresenceLevel4.Show(false);
304
306 m_HudState = g_Game.GetProfileOption(EDayZProfilesOptions.HUD);
307 MissionGameplay.Cast(GetGame().GetMission()).GetConnectivityInvoker().Insert(OnConnectionIconsSettingsChanged);
308 m_GameStatusIconsPanel.Show(g_Game.GetProfileOption(EDayZProfilesOptions.CONNECTIVITY_INFO));
309 //ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() && g_Game.GetProfileOption(EDayZProfilesOptions.QUICKBAR)); //unreliable
310 }
311
313 {
314 // state notifiers
315 m_StatesWidgetNames.Clear();
316 m_StatesWidgets.Clear();
317 m_StatesWidgetNames.Set(NTFKEY_THIRSTY, "Thirsty");
318 m_StatesWidgetNames.Set(NTFKEY_HUNGRY, "Hungry");
319 m_StatesWidgetNames.Set(NTFKEY_SICK, "Health");
320 m_StatesWidgetNames.Set(NTFKEY_BLEEDISH, "Blood");
321 m_StatesWidgetNames.Set(NTFKEY_FEVERISH, "Temperature");
322
323 m_Notifiers.Show(true);
324 m_Badges.Show(true);
325
326 int i = 0;
327 int key = 0;
328 for (i = 0; i < m_StatesWidgetNames.Count(); i++)
329 {
330 string widget_name = m_StatesWidgetNames.GetElement(i);
331 key = m_StatesWidgetNames.GetKey(i);
333 Class.CastTo(w, m_Notifiers.FindAnyWidget(String("Icon" + widget_name)));
334 m_StatesWidgets.Set(key, w);
335 w.Show(true);
336 for (int y = 0; y < 5; y++)
337 w.LoadImageFile(y, "set:dayz_gui image:icon" + widget_name + y);
338
339 w.SetImage(0);
340 float alpha = w.GetAlpha();
341 w.SetColor(ARGB(alpha * 255, 220, 220, 220)); //white
342 m_TendencyStatusCritical.Remove(w);
343 // clear all arrows
344 for (int x = 1; x < 4; x++)
345 {
346 Class.CastTo(w, m_Notifiers.FindAnyWidget(String(widget_name + "ArrowUp" + x.ToString())));
347 w.Show(false);
348 Class.CastTo(w, m_Notifiers.FindAnyWidget(String(widget_name + "ArrowDown" + x.ToString())));
349 w.Show(false);
350 }
351
352
353 }
354
355 // badges
356 m_BadgesWidgetNames.Clear();
357 m_BadgesWidgets.Clear();
358 m_BadgesWidgetDisplay.Clear();
359 m_BadgesSupportedLevels.Clear();
360
361 m_BadgesWidgetNames.Set(NTFKEY_FRACTURE, "Fracture");
362 m_BadgesWidgetNames.Set(NTFKEY_STUFFED, "Stomach");
363 m_BadgesWidgetNames.Set(NTFKEY_SICK, "Sick");
364 m_BadgesWidgetNames.Set(NTFKEY_WETNESS, "Wetness");
365 m_BadgesWidgetNames.Set(NTFKEY_POISONED, "Poisoned");
366 m_BadgesWidgetNames.Set(NTFKEY_BLEEDISH, "Bleeding");
367 m_BadgesWidgetNames.Set(NTFKEY_LIVES, "Shock");
368 m_BadgesWidgetNames.Set(NTFKEY_PILLS, "Pills");
369 m_BadgesWidgetNames.Set(NTFKEY_LEGS, "InjuredLegs");
370
371 // any badges not included bellow are just ON/OFF
372 m_BadgesSupportedLevels.Insert(NTFKEY_LEGS, 3);
373
374 for (i = 0; i < m_BadgesWidgetNames.Count(); i++)
375 {
376 string badge_name = m_BadgesWidgetNames.GetElement(i);
377 key = m_BadgesWidgetNames.GetKey(i);
379
380
381 Class.CastTo(badge_widget, m_Badges.FindAnyWidget(badge_name));
382
383 if (m_BadgesSupportedLevels.Contains(key))
384 {
385 int badgeCountMax = m_BadgesSupportedLevels.Get(key);
386
387 for (int q = 0; q < badgeCountMax; q++)
388 badge_widget.LoadImageFile(q, "set:dayz_gui image:icon" + badge_name + q);
389 }
390
391 m_BadgesWidgets.Set(key, badge_widget);
392 badge_widget.Show(false);
393 m_BadgesWidgetDisplay.Set(key, false);
394 }
395 m_AnyBadgeVisible = false;
396 m_BadgeNotifierDivider.Show(false);
397
398 }
399
401 {
402 m_GameStatusIconsPanel.Show(enabled);
403 }
404
405 override void OnResizeScreen()
406 {
407 float x, y;
408 m_HudPanelWidget.GetScreenSize(x, y);
409 m_HudPanelWidget.Update();
410 m_Badges.Update();
411 m_Notifiers.SetPos(0, 0);
412 }
413
414 override void Show(bool show)
415 {
416 m_HudPanelWidget.Show(show);
417 }
418
419 override void ShowWalkieTalkie(bool show)
420 {
421 m_FadeTimerWalkieTalkie.Stop();
422 m_FadeTimerWalkieTalkieText.Stop();
423 m_WalkieTalkie.Show(show);
424 }
425
427 {
428 m_WalkieTalkie.Show(true);
429 m_FadeTimerWalkieTalkie.Stop();
430 m_FadeTimerWalkieTalkieText.Stop();
431 m_FadeTimerWalkieTalkie.FadeOut(m_WalkieTalkie.FindAnyWidget("Icon"), fadeOutSeconds);
432 m_FadeTimerWalkieTalkieText.FadeOut(m_WalkieTalkie.FindAnyWidget("Text"), fadeOutSeconds);
433 }
434
435 override void SetWalkieTalkieText(string text)
436 {
438 Class.CastTo(txt, m_WalkieTalkie.FindAnyWidget("Text"));
439 txt.SetText(text);
440 }
441
442 override void SetCursorIcon(string icon)
443 {
444 if (icon.Length() == 0 || icon == CursorIcons.None)
445 m_CursorIcon.Show(false);
446 else
447 {
448 m_CursorIcon.LoadImageFile(0, icon);
449 m_CursorIcon.Show(true);
450 }
451 }
452
453 override void ShowCursor()
454 {
455 m_CursorWidget.Show(true);
456 }
457
458 override void HideCursor()
459 {
460 m_CursorWidget.Show(false);
461 }
462
463 override void SetCursorIconScale(string type, float percentage)
464 {
465 float x, y;
466 m_CursorIcon.FindAnyWidget(type).GetParent().GetSize(x, y);
467 m_CursorIcon.FindAnyWidget(type).GetParent().SetSize(x * percentage, y * percentage);
468 }
469
470 override void SetCursorIconOffset(string type, float x, float y)
471 {
472 m_CursorIcon.FindAnyWidget(type).GetParent().SetPos(x, y);
473 }
474
475 override void SetCursorIconSize(string type, float x, float y)
476 {
477 m_CursorIcon.FindAnyWidget(type).GetParent().SetSize(x, y);
478 }
479
480#ifdef DIAG_DEVELOPER
481 // Debug Crosshair
482 override void SetPermanentCrossHair(bool show)
483 {
484 m_PermanentCrossHair.Show(show);
485 }
486#endif
487
488 override void DisplayNotifier(int key, int tendency, int status)
489 {
491 if (key == NTFKEY_FEVERISH)
493 else
495
496 // tendency arrows
497 string arrow_name = "ArrowUp";
498 if (tendency < 0)
499 arrow_name = "ArrowDown";
501
502 for (int x = 1; x < 4; x++)
503 {
504 Class.CastTo(w, m_Notifiers.FindAnyWidget(String(m_StatesWidgetNames.Get(key) + "ArrowUp" + x.ToString())));
505 if (w)
506 w.Show(false);
507 Class.CastTo(w, m_Notifiers.FindAnyWidget(String(m_StatesWidgetNames.Get(key) + "ArrowDown" + x.ToString())));
508 if (w)
509 w.Show(false);
510 }
511
512 if (tendency > 0)
513 {
514 string widget_name = m_StatesWidgetNames.Get(key) + arrow_name + Math.Clamp(tendency, 1, 3);
515 Class.CastTo(w, m_Notifiers.FindAnyWidget(widget_name));
516 if (w)
517 w.Show(true);
518 }
519 }
520
522 {
524 Class.CastTo(w, m_Notifiers.FindAnyWidget(String("Icon" + m_StatesWidgetNames.Get(key))));
525
526 if (w)
527 {
528 w.SetImage(Math.Clamp(status - 1, 0, 4));
529 float alpha = w.GetAlpha();
530
531 switch (status)
532 {
533 case 3:
534 w.SetColor(ARGB(alpha * 255, 220, 220, 0)); //yellow
535 m_TendencyStatusCritical.Remove(w); //remove from blinking group
536 break;
537 case 4:
538 w.SetColor(ARGB(alpha * 255, 220, 0, 0)); //red
539 m_TendencyStatusCritical.Remove(w); //remove from blinking group
540 break;
541 case 5:
542 if (!m_TendencyStatusCritical.Contains(w))
543 {
544 m_TendencyStatusCritical.Insert(w, ARGB(alpha * 255, 220, 0, 0)); //add to blinking group
545 }
546 break;
547 default:
548 w.SetColor(ARGB(alpha * 255, 220, 220, 220)); //white
549 m_TendencyStatusCritical.Remove(w); //remove from blinking group
550 break;
551 }
552 }
553 }
554
556 {
557 ImageWidget w = ImageWidget.Cast(m_Notifiers.FindAnyWidget(String("Icon" + m_StatesWidgetNames.Get(key))));
558 TextWidget temp_top = TextWidget.Cast(m_Notifiers.FindAnyWidget("TemperatureValueTop"));
559 TextWidget temp_bot = TextWidget.Cast(m_Notifiers.FindAnyWidget("TemperatureValueBottom"));
560 //string temp = player..ToString() + "°C";
561 float alpha = w.GetAlpha();
562
563 if (tendency < 0)
564 {
565 temp_top.Show(true);
566 temp_bot.Show(false);
567 }
568 else
569 {
570 temp_top.Show(false);
571 temp_bot.Show(true);
572 }
573
574 switch (status)
575 {
576 case 2:
577 w.SetColor(ARGB(alpha * 255, 220, 220, 0)); //WARNING_PLUS
578 m_TendencyStatusCritical.Remove(w);
579 w.SetImage(1);
580
581 break;
582 case 3:
583 w.SetColor(ARGB(alpha * 255, 220, 0, 0)); //CRITICAL_PLUS
584 m_TendencyStatusCritical.Remove(w);
585 w.SetImage(0);
586 break;
587 case 4:
588 if (!m_TendencyStatusCritical.Contains(w)) //BLINKING_PLUS
589 m_TendencyStatusCritical.Insert(w, ARGB(alpha * 255, 220, 0, 0));
590 w.SetImage(0);
591 break;
592 case 5:
593 w.SetColor(ARGB(alpha * 255, 0, 206, 209)); //WARNING_MINUS
594 m_TendencyStatusCritical.Remove(w);
595 w.SetImage(3);
596 break;
597 case 6:
598 w.SetColor(ARGB(alpha * 255, 30, 144, 220)); //CRITICAL_MINUS
599 m_TendencyStatusCritical.Remove(w);
600 w.SetImage(4);
601 break;
602 case 7: //BLINKING_MINUS
603 if (!m_TendencyStatusCritical.Contains(w))
604 m_TendencyStatusCritical.Insert(w, ARGB(alpha * 255, 30, 144, 220));
605 w.SetImage(4);
606 break;
607 default:
608 w.SetColor(ARGB(alpha * 255, 220, 220, 220)); //DEFAULT
609 m_TendencyStatusCritical.Remove(w);
610 w.SetImage(2);
611 break;
612 }
613 }
614
615 override void DisplayBadge(int key, int value)
616 {
617 TextWidget bleed_count = TextWidget.Cast(m_Badges.FindAnyWidget("BleedingCount"));
618
619 m_BadgesWidgetDisplay.Set(key, value);
620 m_AnyBadgeVisible = false;
621 for (int i = 0; i < m_BadgesWidgetDisplay.Count(); i++)
622 {
623 int badge_key = m_BadgesWidgetDisplay.GetKey(i);
624 int badge_value = m_BadgesWidgetDisplay.Get(badge_key);
625 string badge_name = m_BadgesWidgetNames.Get(badge_key);
626
628 Class.CastTo(badge_widget, m_Badges.FindAnyWidget(badge_name));
629 if (badge_widget)
630 {
631 if (badge_value > 0)
632 {
633 if (m_BadgesSupportedLevels.Contains(badge_key))
634 {
635 int levelIndex = badge_value - 1;
636 int maxSupportedIndex = m_BadgesSupportedLevels.Get(badge_key) - 1;
638 badge_widget.SetImage(levelIndex);
639 }
640
641 badge_widget.Show(true);
642 m_AnyBadgeVisible = true;
644 {
645 bleed_count.Show(true);
646 bleed_count.SetText(m_BadgesWidgetDisplay.Get(badge_key).ToString());
647 }
648 }
649 else
650 {
652 bleed_count.Show(false);
653 badge_widget.Show(false);
654 }
655 }
656 }
657
659 }
660
661 override void SetTemperature(string temp)
662 {
663 m_IsTemperatureVisible = true;
664 TextWidget temp_top = TextWidget.Cast(m_Notifiers.FindAnyWidget("TemperatureValueTop"));
665 TextWidget temp_bot = TextWidget.Cast(m_Notifiers.FindAnyWidget("TemperatureValueBottom"));
666 temp_top.SetText(temp);
667 temp_bot.SetText(temp);
668 m_TemperatureTimer = 0;
669 }
670
672 {
673 m_IsTemperatureVisible = false;
674 TextWidget temp_top = TextWidget.Cast(m_Notifiers.FindAnyWidget("TemperatureValueTop"));
675 TextWidget temp_bot = TextWidget.Cast(m_Notifiers.FindAnyWidget("TemperatureValueBottom"));
676 temp_top.SetText("");
677 temp_bot.SetText("");
678 m_TemperatureTimer = 0;
679 }
680
681 override void SetStaminaBarVisibility(bool show)
682 {
683 //m_StaminaBackground.Show( show );
684 //m_Stamina.Show( show );
685 if (show)
686 {
687 m_Stamina.SetAlpha(1);
688 //m_Stamina.SetTextColor( ColorManager.COLOR_NORMAL_TEXT );
689 }
690 else
691 {
692 m_Stamina.SetAlpha(0.3);
693 //m_Stamina.SetTextColor( ColorManager.RED_COLOR );
694 }
695
696 m_IsStaminaVisible = show;
697 m_StaminaTimer = 0;
698 }
699
700 // state 0 = empty
701 // state 1 = digesting
702 // state 2 = full
704 {
705 ImageWidget stomach = ImageWidget.Cast(m_Badges.FindAnyWidget("Stomach"));
706 stomach.LoadImageFile(0, "set:dayz_gui image:iconStomach" + state);
707 }
708
709 override void SetStamina(int value, int range)
710 {
711 float sx, sy;
713 float percentage = 1;
714 if (max != 0)
715 percentage = range / max;
716
717 if (range != 0)
718 m_Stamina.SetCurrent((value / range) * 100);
719 else
720 m_Stamina.SetCurrent(0);
721
722 m_Stamina.GetSize(sx, sy);
723 m_Stamina.SetSize(percentage, sy);
724 m_StaminaBackground.SetSize(1 - percentage, sy);
725
726 // set health & blood values
727 if (!GetGame().IsMultiplayer())
728 {
729 if (GetGame().GetPlayer())
730 {
733
734 if (player)
735 {
736 float h1 = player.GetHealth("", "");
737 float b1 = player.GetHealth("", "Blood");
738
739 GetDayZGame().GetBacklit().SetHealth(h1);
740 GetDayZGame().GetBacklit().SetBlood(b1);
741 }
742 }
743 }
744
745 // update backlit
746 GetDayZGame().GetBacklit().UpdatePlayer(false);
747 }
748
749 bool KeyPress(int key)
750 {
751 return false;
752 }
753
755 {
756 m_ZeroingKeyPressed = true;
757 }
758
759 override void DisplayStance(int stance)
760 {
763 Car car;
764 if (!Class.CastTo(car, player.GetDrivingVehicle()))
765 {
766 if (stance == 1)
767 {
768 bool is_walking;
769 m_StanceStand.Show(!is_walking);
770 m_StanceStandWalk.Show(is_walking);
771 m_StanceCrouch.Show(false);
772 m_StanceProne.Show(false);
773 m_StanceCar.Show(false);
774 }
775 if (stance == 2)
776 {
777 m_StanceStand.Show(false);
778 m_StanceStandWalk.Show(false);
779 m_StanceCrouch.Show(true);
780 m_StanceProne.Show(false);
781 m_StanceCar.Show(false);
782 }
783 if (stance == 3)
784 {
785 m_StanceStand.Show(false);
786 m_StanceStandWalk.Show(false);
787 m_StanceCrouch.Show(false);
788 m_StanceProne.Show(true);
789 m_StanceCar.Show(false);
790 }
791 }
792 else
793 {
794 m_StanceStand.Show(false);
795 m_StanceCrouch.Show(false);
796 m_StanceProne.Show(false);
797 m_StanceCar.Show(true);
798 }
799 }
800
801 override void DisplayPresence()
802 {
804
806 {
807 int presence_level = player.GetNoisePresenceInAI();
808 m_PresenceLevel0.Show(false);
809 m_PresenceLevel1.Show(false);
810 m_PresenceLevel2.Show(false);
811 m_PresenceLevel3.Show(false);
812 m_PresenceLevel4.Show(false);
813
814 if (presence_level > 0)
815 m_PresenceLevel0.Show(true);
816 if (presence_level > 1)
817 m_PresenceLevel1.Show(true);
818 if (presence_level > 2)
819 m_PresenceLevel2.Show(true);
820 if (presence_level > 3)
821 m_PresenceLevel3.Show(true);
822 if (presence_level > 4)
823 m_PresenceLevel4.Show(true);
824 }
825 }
826
827 int m_VehicleGearCount = -1;
831
832 override void ShowVehicleInfo()
833 {
835 if (player)
836 {
837 HumanCommandVehicle hcv = player.GetCommand_Vehicle();
838 if (hcv)
839 {
840 m_CurrentVehicle = CarScript.Cast(hcv.GetTransport());
841 if (m_CurrentVehicle)
842 {
843 m_InVehicleAsDriver = true;
844 m_VehicleGearCount = m_CurrentVehicle.GetGearsCount();
845 m_VehicleOilLight.Show(m_VehicleHasOil);
846
847 float rpm_value_red = m_CurrentVehicle.EngineGetRPMRedline() / m_CurrentVehicle.EngineGetRPMMax();
848 m_VehicleRPMDial.SetMaskProgress(rpm_value_red);
849 m_VehicleRPMRedline.SetMaskProgress(1 - rpm_value_red);
850
851 m_HudPanelWidget.FindAnyWidget("PlayerPanel").Show(false);
852 m_Presence.Show(false);
853 m_StancePanel.Show(false);
854
855 m_VehiclePanel.Show(true);
856 }
857 }
858 }
859 }
860
861 override void HideVehicleInfo()
862 {
863 m_HudPanelWidget.FindAnyWidget("PlayerPanel").Show(true);
864 m_Presence.Show(true);
865 m_StancePanel.Show(true);
866 m_VehiclePanel.Show(false);
867
868 m_InVehicleAsDriver = false;
869 m_CurrentVehicle = null;
870 m_VehicleGearCount = -1;
871 }
872
874 {
875 if (m_CurrentVehicle && !GetGame().GetUIManager().GetMenu())
876 {
877 m_VehiclePanel.Show(true);
878 float rpm_value = m_CurrentVehicle.EngineGetRPM() / m_CurrentVehicle.EngineGetRPMMax();
879 float rpm_value_red = m_CurrentVehicle.EngineGetRPMRedline() / m_CurrentVehicle.EngineGetRPMMax();
880 float speed_value = m_CurrentVehicle.GetSpeedometerAbsolute() / 200;
881
882 m_VehicleRPMPointer.SetRotation(0, 0, rpm_value * 270 - 130, true);
883 m_VehicleSpeedPointer.SetRotation(0, 0, speed_value * 260 - 130, true);
884 m_VehicleSpeedValue.SetText(Math.AbsInt(m_CurrentVehicle.GetSpeedometer()).ToString());
885
886 int engineHealthLevel = m_CurrentVehicle.GetHealthLevel("Engine");
887 int fuelTankHealthLevel = m_CurrentVehicle.GetHealthLevel("FuelTank");
888 bool newHealth = false;
889
891 if (m_CurrentVehicle.HasEngineZoneReceivedHit())
892 {
893 if (m_TimeSinceLastEngineLightChange > 0.35)
894 {
895 m_VehicleEngineLight.Show(!m_VehicleEngineLight.IsVisible());
897 m_VehicleEngineLight.SetColor(Colors.WHITE);
898 else
899 m_VehicleEngineLight.SetColor(ItemManager.GetItemHealthColor(engineHealthLevel));
900
901 m_VehicleEngineLight.SetAlpha(1);
902 m_TimeSinceLastEngineLightChange = 0;
903 }
904
905 m_TimeSinceLastEngineLightChange += timeslice;
906 newHealth = true;
907 }
909 {
910 m_VehicleEngineLight.SetColor(ItemManager.GetItemHealthColor(engineHealthLevel));
911 m_VehicleEngineLight.SetAlpha(1);
912 m_VehicleEngineLight.Show(true);
913 }
914 else
915 m_VehicleEngineLight.Show(false);
916
919 {
920 m_VehicleFuelLight.SetColor(Colors.WHITE);
921 m_VehicleFuelLight.SetAlpha(1);
922 m_VehicleFuelLight.Show(true);
923 }
925 {
926 m_VehicleFuelLight.SetColor(ItemManager.GetItemHealthColor(fuelTankHealthLevel));
927 m_VehicleFuelLight.SetAlpha(1);
928 m_VehicleFuelLight.Show(true);
929 }
930
932 if (m_CurrentVehicle.IsVitalRadiator())
933 {
934 m_VehicleTemperatureIndicator.Show(true);
935 if (m_CurrentVehicle.HasRadiator())
936 {
937 int radiatorHealthLevel = m_CurrentVehicle.GetRadiator().GetHealthLevel("");
939 {
940 m_VehicleTemperatureLight.SetColor(Colors.WHITE);
941 m_VehicleTemperatureLight.SetAlpha(1);
942 m_VehicleTemperatureLight.Show(true);
943 }
945 {
946 m_VehicleTemperatureLight.SetColor(ItemManager.GetItemHealthColor(radiatorHealthLevel));
947 m_VehicleTemperatureLight.SetAlpha(1);
948 m_VehicleTemperatureLight.Show(true);
949 }
950 }
951 else
952 {
953 m_VehicleTemperatureLight.SetColor(Colors.COLOR_RUINED);
954 m_VehicleTemperatureLight.SetAlpha(1);
955 m_VehicleTemperatureLight.Show(true);
956 }
957 }
958 else
959 m_VehicleTemperatureIndicator.Show(false);
960
961 m_VehicleHandBrakeLight.Show(m_CurrentVehicle.IsHandbrakeActive());
962 m_VehicleWheelLight.Show(m_CurrentVehicle.WheelIsAnyLocked());
963
964
965 int engagedGear = -1;
966 int prevGear = -1;
967 int nextGear = -1;
968
969 if (m_CurrentVehicle.GearboxGetType() == CarGearboxType.MANUAL)
970 {
971 engagedGear = m_CurrentVehicle.GetGear();
972 prevGear = engagedGear - 1;
973 nextGear = engagedGear + 1;
974
975 if (engagedGear == CarGear.NEUTRAL)
976 prevGear = CarGear.REVERSE;
977 else if (engagedGear == CarGear.REVERSE)
978 {
979 prevGear = -1;
980 nextGear = CarGear.NEUTRAL;
981 }
982
983 m_VehicleCurrentGearValue.SetText(m_VehicleGearTable.Get(engagedGear));
984 m_VehicleNextGearValue.Show(nextGear < m_VehicleGearCount);
985
986 m_VehicleNextGearValue.SetText(m_VehicleGearTable.Get(nextGear));
987 m_VehiclePrevGearValue.SetText(m_VehicleGearTable.Get(prevGear));
988 }
989 else
990 {
991 engagedGear = m_CurrentVehicle.GearboxGetMode();
992 prevGear = engagedGear - 1;
993 nextGear = engagedGear + 1;
994
995 m_VehicleCurrentGearValue.SetText(m_VehicleGearTableAuto.Get(engagedGear));
996 m_VehicleNextGearValue.Show(nextGear < EnumTools.GetEnumSize(CarAutomaticGearboxMode));
997
998 m_VehicleNextGearValue.SetText(m_VehicleGearTableAuto.Get(nextGear));
999 m_VehiclePrevGearValue.SetText(m_VehicleGearTableAuto.Get(prevGear));
1000 }
1001
1002 // refresh backlit
1003 GetDayZGame().GetBacklit().RefreshVehicleLayout(engagedGear, newHealth);
1004
1005 m_VehicleFuelPointer.SetRotation(0, 0, m_CurrentVehicle.GetFluidFraction(CarFluid.FUEL) * 260 - 130, true);
1006 m_VehicleTemperaturePointer.SetRotation(0, 0, -1 * m_CurrentVehicle.GetFluidFraction(CarFluid.COOLANT) * 260 + 130, true);
1007
1009 if (m_VehicleDamageZonesHitTimer > 1)
1010 {
1011 m_VehicleDamageZoneHitEngineState = false;
1012 m_VehicleDamageZonesHitTimer = 0;
1013 }
1014
1015 m_VehicleDamageZonesHitTimer += timeslice;
1016 }
1017 else
1018 m_VehiclePanel.Show(false);
1019 }
1020
1022 {
1023 if (m_Quickbar == NULL)
1024 m_Quickbar = new InventoryQuickbar(m_QuickbarWidget);
1025 }
1026
1027 InventoryQuickbar GetQuickbar()
1028 {
1029 return m_Quickbar;
1030 }
1031
1033 {
1034 return m_IsQuickbarVisible;
1035 }
1036
1038 {
1039 return m_IsHudVisible;
1040 }
1041
1043 {
1044#ifdef PLATFORM_CONSOLE
1045 ShowQuickBar(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
1046#else
1047 ShowQuickBar(g_Game.GetProfileOption(EDayZProfilesOptions.QUICKBAR));
1048#endif
1049 }
1050
1052 {
1053 m_IsQuickbarVisible = !m_QuickbarHideUI && !m_QuickbarHidePlayer && m_QuickbarState;
1054 m_QuickbarWidget.Show(m_IsQuickbarVisible);
1055 }
1056
1058 {
1059 m_IsHudVisible = (!m_HudHidePlayer && !m_HudHideUI && m_HudState) || m_HudInventory;
1060
1061 SetLeftStatsVisibility(m_IsHudVisible);
1062 m_Badges.Show(m_IsHudVisible);
1063 m_Notifiers.Show(m_IsHudVisible);
1064 m_BadgeNotifierDivider.Show(m_IsHudVisible && m_AnyBadgeVisible);
1065#ifdef PLATFORM_CONSOLE
1066 m_SpecializatonPanel.Show(m_HudInventory);
1067#else
1068 m_SpecializatonPanel.Show(false);
1069#endif
1070 }
1071
1072 void UpdateSpecialtyMeter(float x, float y)
1073 {
1074#ifdef PLATFORM_CONSOLE
1075 m_SpecializationIcon.SetPos(x, y, true);
1076#endif
1077 }
1078
1080 {
1081 return m_QuickbarHidePlayer;
1082 }
1083
1085 {
1086 return m_HudHidePlayer;
1087 }
1088
1089 override void ShowQuickbarUI(bool show)
1090 {
1091 m_QuickbarHideUI = !show;
1093 }
1094
1095 override void ShowQuickbarPlayer(bool show)
1096 {
1097 m_QuickbarHidePlayer = !show;
1099 }
1100
1101 override void ShowHudPlayer(bool show)
1102 {
1103 m_HudHidePlayer = !show;
1104 if (m_HudState)
1106 }
1107
1108 override void ShowHudUI(bool show)
1109 {
1110 m_HudHideUI = !show;
1111 if (m_HudState)
1113 }
1114
1115 override void ShowHudInventory(bool show)
1116 {
1117 m_HudInventory = show;
1119 }
1120
1121 override void ToggleHeatBufferPlusSign(bool show)
1122 {
1123 m_HeatBufferPlus.Show(show);
1124 }
1125
1127 override void ShowQuickBar(bool show)
1128 {
1129 m_QuickbarState = show;
1130 //shown by default
1131 m_QuickbarHidePlayer = false;
1133 }
1134
1135 override void ShowHud(bool show)
1136 {
1137 m_HudState = show;
1138 m_HudHidePlayer = false;
1140 }
1141
1143 {
1144 return m_QuickbarState;
1145 }
1146
1148 {
1149 return m_HudState;
1150 }
1151
1152
1154 {
1155 if (type == EConnectivityStatType.PING)
1156 {
1157 switch (level)
1158 {
1159 case EConnectivityStatLevel.OFF:
1160 m_HighPingA.Show(false);
1161 m_HighPingB.Show(false);
1162 break;
1163 case EConnectivityStatLevel.LEVEL1:
1164 m_HighPingA.Show(true);
1165 m_HighPingB.Show(false);
1166 break;
1167 case EConnectivityStatLevel.LEVEL2:
1168 m_HighPingA.Show(false);
1169 m_HighPingB.Show(true);
1170 break;
1171 }
1172 }
1173 else if (type == EConnectivityStatType.SERVER_PERF)
1174 {
1175 switch (level)
1176 {
1177 case EConnectivityStatLevel.OFF:
1178 m_LowServerPerfA.Show(false);
1179 m_LowServerPerfB.Show(false);
1180 break;
1181 case EConnectivityStatLevel.LEVEL1:
1182 m_LowServerPerfA.Show(true);
1183 m_LowServerPerfB.Show(false);
1184 break;
1185 case EConnectivityStatLevel.LEVEL2:
1186 m_LowServerPerfA.Show(false);
1187 m_LowServerPerfB.Show(true);
1188 break;
1189 }
1190 }
1191 else if (type == EConnectivityStatType.CONN_LOST)
1192 {
1193 switch (level)
1194 {
1195 case EConnectivityStatLevel.OFF:
1196 m_ConnectionLost.Show(false);
1197 break;
1198 case EConnectivityStatLevel.LEVEL1:
1199 m_ConnectionLost.Show(true);
1200 break
1201 }
1202 }
1203 }
1204
1207 {
1208 Widget child = m_LeftHudPanelWidget.GetChildren();
1209 while (child)
1210 {
1211 if (child.GetName() == "ChatFrameWidget")
1212 {
1213 child = child.GetSibling();
1214 continue
1215 }
1216
1217 child.Show(visible);
1218 child = child.GetSibling();
1219 }
1220 }
1221
1222 override void RefreshQuickbar(bool itemChanged = false)
1223 {
1224 if ((!m_QuickbarState || m_QuickbarHidePlayer || m_QuickbarHideUI) && !itemChanged) // Don't update when it is hidden or disabled
1225 return;
1226
1227 if (itemChanged)
1228 {
1229 UIManager manager = GetGame().GetUIManager();
1230
1232 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
1233
1234 if (mission)
1235 inventory = mission.GetInventory();
1236
1237 if (inventory)
1238 inventory.RefreshQuickbar();
1239 }
1240
1241 if (m_Quickbar)
1242 m_Quickbar.UpdateItems(m_QuickbarWidget);
1243 }
1244
1246 {
1247 return m_HudPanelWidget;
1248 }
1249
1250 override void UpdateBloodName()
1251 {
1254
1255 if (player)
1256 {
1257 string blood_name;
1258 bool positive;
1260 bool blood_type_visible = player.HasBloodTypeVisible();
1261
1263 {
1264 m_BloodType.SetText(blood_name);
1265 if (positive)
1266 m_BloodPosType.SetText("+");
1267 else
1268 m_BloodPosType.SetText("-");
1269 }
1270 else
1271 {
1272 m_BloodType.SetText("");
1273 m_BloodPosType.SetText("");
1274 }
1275 }
1276 }
1277
1279 {
1280 if (GetGame().GetPlayer())
1281 {
1282 bool found = false;
1283 vector head_pos = GetGame().GetCurrentCameraPosition();
1284 float distance;
1285 foreach (Man player : ClientData.m_PlayerBaseList)
1286 {
1287 vector target_player = player.GetPosition();
1289
1290 target_player[1] = target_player[1] + 1.2;
1291
1292 if (distance <= 15 && player != GetGame().GetPlayer())
1293 {
1294 vector screen_pos = GetGame().GetScreenPosRelative(target_player);
1295 vector end_pos = head_pos + GetGame().GetCurrentCameraDirection() * 25;
1297 params.sorted = true;
1298
1301 if (results.Count() > 0)
1302 {
1303 if (results.Get(0).obj == player)
1304 {
1305 m_CurrentTaggedPlayer = PlayerBase.Cast(player);
1306 found = true;
1307 }
1308 }
1309 }
1310 }
1311 if (!found)
1312 m_CurrentTaggedPlayer = null;
1313 }
1314 }
1315
1320
1322 {
1323 if (m_CurrentTaggedPlayer && m_CurrentTaggedPlayer.GetIdentity())
1324 {
1325 if (!m_PlayerTag)
1326 {
1327 m_PlayerTag = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/hud/hud_player_tag.layout");
1328 m_PlayerTagText = TextWidget.Cast(m_PlayerTag.FindAnyWidget("TagText"));
1329 }
1330 m_PlayerSpineIndex = m_CurrentTaggedPlayer.GetBoneIndex("Spine2");
1331 vector player_pos = m_CurrentTaggedPlayer.GetBonePositionWS(m_PlayerSpineIndex);
1332 vector screen_pos = GetGame().GetScreenPosRelative(player_pos);
1333
1334 if (screen_pos[2] > 0)
1335 {
1336 if (screen_pos[0] > 0 && screen_pos[0] < 1)
1337 {
1338 if (screen_pos[1] > 0 && screen_pos[1] < 1)
1339 {
1340 m_PlayerTagText.SetAlpha(Math.Clamp(m_PlayerTagText.GetAlpha() + timeslice * 10, 0, 1));
1341 m_PlayerTag.SetPos(0.55, 0.55);
1342 m_PlayerTagText.SetText(m_CurrentTaggedPlayer.GetIdentity().GetPlainName());
1343
1344 //m_PlayerTagText.SetSize( 1, 1 - screen_pos[2] / 25 );
1345 return;
1346 }
1347 }
1348 }
1349 }
1350
1351 if (m_PlayerTag)
1352 {
1353 float new_alpha = Math.Clamp(m_PlayerTagText.GetAlpha() - timeslice * 10, 0, 1);
1354 m_PlayerTagText.SetAlpha(Math.Clamp(m_PlayerTagText.GetAlpha() - timeslice * 10, 0, 1));
1355 if (new_alpha == 0)
1356 {
1357 m_PlayerTagText.SetText("");
1358 m_CurrentTaggedPlayer = null;
1359 }
1360 }
1361 }
1362
1363 override void Update(float timeslice)
1364 {
1365 super.Update(timeslice);
1366
1367 m_ActionTargetsCursor.Update();
1369 //
1370 //modifiers - tendency status (critical)
1371 if (m_BlinkTime > TENDENCY_BLINK_TIME)
1372 {
1373 //get color & alpha
1374 if (m_TendencyStatusCritical.Count() > 0)
1375 {
1376 for (int i = 0; i < m_TendencyStatusCritical.Count(); ++i)
1377 {
1378
1379 ImageWidget widget = m_TendencyStatusCritical.GetKey(i);
1380 int alpha = widget.GetAlpha() * 255;
1381 int color;
1382 int colorA = ARGB(alpha, 255, 255, 255);
1383 int colorB = m_TendencyStatusCritical.Get(widget);
1384
1385 //set new color to different color
1386 if (widget.GetColor() == colorA)
1387 color = colorB;
1388 else
1389 color = colorA;
1390
1391 widget.SetColor(color);
1392 }
1393 }
1394
1395 m_BlinkTime = 0; //reset
1396 }
1397 else
1398 m_BlinkTime += timeslice;
1399
1400 if (m_IsTemperatureVisible)
1401 {
1402 m_TemperatureTimer += timeslice;
1403 if (m_TemperatureTimer > m_TemperatureShowTime)
1405 }
1406
1407 if (!m_IsStaminaVisible)
1408 {
1409 m_StaminaTimer += timeslice;
1410 if (m_StaminaTimer > m_StaminaShowTime)
1412
1413 }
1414
1415 if (m_HitDirEffectArray && m_HitDirEffectArray.Count() > 0)
1416 {
1419 }
1420
1422
1423#ifdef PLATFORM_PS4
1426#endif
1427 }
1428
1430 {
1432 return;
1433
1434 if (m_HitDirEffectArray == null)
1435 m_HitDirEffectArray = new array<ref HitDirectionEffectBase>;
1438 m_HitDirEffectArray.Insert(hiteff);
1439 }
1440
1442 {
1443 for (int i = 0; i < m_HitDirEffectArray.Count(); i++)
1444 m_HitDirEffectArray[i].Update(timeslice);
1445 }
1446
1448 {
1449 for (int i = m_HitDirEffectArray.Count() - 1; i > -1; i--)
1450 {
1451 if (m_HitDirEffectArray[i].DurationCheck())
1452 m_HitDirEffectArray.Remove(i);
1453 }
1454 }
1455
1456 void Debug()
1457 {
1458 foreach (int val: m_BadgesWidgetDisplay)
1459 {
1460 int key = m_BadgesWidgetDisplay.GetKeyByValue(val);
1462 Print(val);
1463 Print("---------------------");
1464 }
1465 }
1466
1467 //------------------------------------------
1468 //ye olde unused methods
1469
1470 //DEPRECATED
1472 {
1473 }
1474}
const int NTFKEY_LIVES
Definition _constants.c:44
const int NTFKEY_WETNESS
Definition _constants.c:36
const int NTFKEY_POISONED
Definition _constants.c:46
const int NTFKEY_PILLS
Definition _constants.c:47
const int NTFKEY_SICK
Definition _constants.c:40
enum eBadgeLevel NTFKEY_THIRSTY
const int NTFKEY_HUNGRY
Definition _constants.c:34
const int NTFKEY_FRACTURE
Definition _constants.c:37
const int NTFKEY_BLEEDISH
Definition _constants.c:42
const int NTFKEY_LEGS
Definition _constants.c:49
const int NTFKEY_FEVERISH
Definition _constants.c:39
const int NTFKEY_STUFFED
Definition _constants.c:41
Widget m_QuickbarWidget
Definition Inventory.c:34
ref InventoryQuickbar m_Quickbar
Definition Inventory.c:32
Widget m_SpecializationIcon
Definition Inventory.c:36
ActionInput GetInput()
Definition ActionBase.c:989
CarAutomaticGearboxMode
Enumerated automatic gearbox modes. (native, do not change or extend)
Definition Car.c:65
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Definition Car.c:33
DayZGame g_Game
Definition DayZGame.c:3528
DayZGame GetDayZGame()
Definition DayZGame.c:3530
ref Timer m_Timer
Definition DayZGame.c:675
Mission mission
EDayZProfilesOptions
EConnectivityStatType
Icon x
Icon y
void InventoryMenu()
PlayerBase GetPlayer()
ref array< ref NotifierBase > m_Notifiers
ref map< PlayerBase, int > m_BloodType
class StaminaSoundHandlerBase extends SoundHandlerBase m_Stamina
static string GetBloodTypeName(int bloodtype, out string type, out bool positive)
Definition BloodType.c:82
override bool IsVitalRadiator()
Definition Offroad_02.c:359
static float GetStaminaMax()
Super root of all classes in Enforce script.
Definition EnScript.c:11
static ref array< Man > m_PlayerBaseList
Definition ClientData.c:7
Definition Colors.c:4
const int WHITE
Definition Colors.c:15
const int COLOR_RUINED
Definition Colors.c:20
const string None
Definition gameplay.c:575
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
static int GetEnumSize(typename e)
Return amount of values in enum.
Definition EnConvert.c:620
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
Definition EnConvert.c:598
void RefreshVehicleHud(float timeslice)
Definition IngameHud.c:873
ref WidgetFadeTimer m_FadeTimerWalkieTalkieText
Definition IngameHud.c:90
bool IsHudVisible()
Definition IngameHud.c:1037
Widget m_StaminaBackground
Definition IngameHud.c:93
ref array< ref HitDirectionEffectBase > m_HitDirEffectArray
Definition IngameHud.c:157
TextWidget m_PlayerTagText
Definition IngameHud.c:1319
float m_StaminaTimer
Definition IngameHud.c:25
bool m_HudState
Definition IngameHud.c:140
void ShowPlayerTag(float timeslice)
Definition IngameHud.c:1321
Widget m_PlayerTag
Definition IngameHud.c:1318
TextWidget m_ActionItemDesc
Definition IngameHud.c:119
override void HideVehicleInfo()
Definition IngameHud.c:861
bool m_InVehicleAsDriver
Definition IngameHud.c:63
void SetLeftStatsVisibility(bool visible)
eg. stamina bar...
Definition IngameHud.c:1206
TextWidget m_VehiclePrevGearValue
Definition IngameHud.c:52
ImageWidget m_VehicleTemperatureLight
Definition IngameHud.c:44
TextWidget m_ActionButtonText
Definition IngameHud.c:126
ref map< ImageWidget, int > m_TendencyStatusCritical
Definition IngameHud.c:10
void RefreshHudVisibility()
Definition IngameHud.c:1057
bool m_ZeroingKeyPressed
Definition IngameHud.c:147
override void ShowVehicleInfo()
Definition IngameHud.c:832
override void SetTemperature(string temp)
Definition IngameHud.c:661
override void DisplayNotifier(int key, int tendency, int status)
Definition IngameHud.c:488
override void OnResizeScreen()
Definition IngameHud.c:405
bool m_QuickbarState
Definition IngameHud.c:143
int m_PlayerSpineIndex
Definition IngameHud.c:1316
TextWidget m_ActionDesc
Definition IngameHud.c:118
float m_BlinkTime
Definition IngameHud.c:12
override void DisplayBadge(int key, int value)
Definition IngameHud.c:615
Widget m_WalkieTalkie
Definition IngameHud.c:115
void Debug()
Definition IngameHud.c:1456
Widget m_CursorWidget
Definition IngameHud.c:113
override void ShowHudPlayer(bool show)
Definition IngameHud.c:1101
ref InventoryQuickbar m_Quickbar
Definition IngameHud.c:34
bool m_QuickbarHidePlayer
Definition IngameHud.c:142
bool m_VehicleDamageZoneHitEngineState
Definition IngameHud.c:60
override void ShowHud(bool show)
Definition IngameHud.c:1135
Widget m_ActionTarget
Definition IngameHud.c:131
ref map< int, int > m_BadgesSupportedLevels
Definition IngameHud.c:15
TextWidget m_BloodPosType
Definition IngameHud.c:76
override void ShowHudInventory(bool show)
Definition IngameHud.c:1115
override void ShowWalkieTalkie(int fadeOutSeconds)
Definition IngameHud.c:426
Widget m_PresenceLevel1
Definition IngameHud.c:102
void SetPermanentCrossHair(bool show)
Definition gameplay.c:659
ImageWidget m_LowServerPerfA
Definition IngameHud.c:70
ref WidgetFadeTimer m_FadeTimerActionCursor
Definition IngameHud.c:81
bool m_VehicleHasCoolant
Definition IngameHud.c:830
Widget m_ActionQuantityBox
Definition IngameHud.c:123
float m_VehicleDamageZonesHitTimer
Definition IngameHud.c:61
void DisplayPresence()
Definition gameplay.c:628
override void SetCursorIcon(string icon)
Definition IngameHud.c:442
ref map< int, string > m_VehicleGearTable
Definition IngameHud.c:28
bool m_AnyBadgeVisible
Definition IngameHud.c:18
ref WidgetFadeTimer m_FadeTimerWeaponName
Definition IngameHud.c:86
float m_TimeSinceLastEngineLightChange
Definition IngameHud.c:828
Widget m_SpecializationIcon
Definition IngameHud.c:155
ImageWidget m_PermanentCrossHair
Definition IngameHud.c:135
Widget m_RadialProgressBarCrossHair
Definition IngameHud.c:111
override void UpdateBloodName()
Definition IngameHud.c:1250
ImageWidget m_VehicleRPMDial
Definition IngameHud.c:39
override void ShowWalkieTalkie(bool show)
Definition IngameHud.c:419
Widget m_ActionMultipleItemsFrame
Definition IngameHud.c:129
bool m_VehicleHasOil
Definition IngameHud.c:829
override void Init(Widget hud_panel_widget)
Definition IngameHud.c:200
Widget m_Presence
Definition IngameHud.c:94
override void ShowHudUI(bool show)
Definition IngameHud.c:1108
override void SetConnectivityStatIcon(EConnectivityStatType type, EConnectivityStatLevel level)
Definition IngameHud.c:1153
Widget m_PresenceLevel0
Definition IngameHud.c:101
void RefreshPlayerTags()
Definition IngameHud.c:1278
Widget m_HudPanelWidget
Definition IngameHud.c:31
bool GetHudState()
Definition IngameHud.c:1147
TextWidget m_BloodType
Definition IngameHud.c:75
void UpdateSpecialtyMeter(float x, float y)
Definition IngameHud.c:1072
override void HideCursor()
Definition IngameHud.c:458
ref WidgetFadeTimer m_FadeTimerZeroingOld
Definition IngameHud.c:84
bool IsHideHudPlayer()
Definition IngameHud.c:1084
ImageWidget m_ConnectionLost
Definition IngameHud.c:72
override void DisplayStance(int stance)
Definition IngameHud.c:759
Widget m_StancePanel
Definition IngameHud.c:100
bool m_IsTemperatureVisible
Definition IngameHud.c:19
Widget m_HitIndicatorLeft
Definition IngameHud.c:151
ImageWidget m_HighPingB
Definition IngameHud.c:69
ref map< int, int > m_BadgesWidgetDisplay
Definition IngameHud.c:16
void OnConnectionIconsSettingsChanged(bool enabled)
Definition IngameHud.c:400
Widget m_PresenceLevel3
Definition IngameHud.c:104
Widget m_MouseContinuousAction
Definition IngameHud.c:109
bool m_HudHideUI
Definition IngameHud.c:137
CarScript m_CurrentVehicle
Definition IngameHud.c:64
Widget m_QuickbarWidget
Definition IngameHud.c:33
void ZeroingKeyPress()
Definition IngameHud.c:754
TextWidget m_ActionQuantityBoxText
Definition IngameHud.c:124
ActionTargetsCursor m_ActionTargetsCursor
Definition IngameHud.c:132
Widget m_ActionWidget
Definition IngameHud.c:117
override void SetCursorIconScale(string type, float percentage)
Definition IngameHud.c:463
Widget m_StanceStandWalk
Definition IngameHud.c:97
void HideTemperature()
Definition IngameHud.c:671
ImageWidget m_VehicleHandBrakeLight
Definition IngameHud.c:57
void SetStomachState(int state)
Definition IngameHud.c:703
Widget m_RadialProgressBar
Definition IngameHud.c:112
void HideQuickbarTimer()
Definition IngameHud.c:1471
bool m_QuickbarHideUI
Definition IngameHud.c:141
ref map< int, string > m_StatesWidgetNames
Definition IngameHud.c:7
Widget m_HitIndicatorSingle
Definition IngameHud.c:153
ImageWidget m_VehicleRPMPointer
Definition IngameHud.c:38
Widget m_StanceStand
Definition IngameHud.c:96
Widget m_BadgeNotifierDivider
Definition IngameHud.c:77
void IngameHud()
Definition IngameHud.c:159
override void ShowQuickbarPlayer(bool show)
Definition IngameHud.c:1095
Widget m_StanceCar
Definition IngameHud.c:99
override void DisplayPresence()
Definition IngameHud.c:801
ImageWidget m_VehicleEngineLight
Definition IngameHud.c:55
void DisplayTendencyTemp(int key, int tendency, int status)
Definition IngameHud.c:555
void SetStaminaBarVisibility(bool show)
ImageWidget m_VehicleTemperaturePointer
Definition IngameHud.c:43
ImageWidget m_CursorIcon
Definition IngameHud.c:114
Widget m_VehicleTemperatureIndicator
Definition IngameHud.c:42
ProgressBarWidget m_ActionQuantityBar
Definition IngameHud.c:122
ImageWidget m_LowServerPerfB
Definition IngameHud.c:71
void InitQuickbar()
Definition IngameHud.c:1021
void UpdateHitDirEffects(float timeslice)
Definition IngameHud.c:1441
ref WidgetFadeTimer m_FadeTimerWeaponStats
Definition IngameHud.c:87
Widget m_MouseSingleAction
Definition IngameHud.c:108
ImageWidget m_VehicleRPMRedline
Definition IngameHud.c:40
void ShowQuickBar(bool show)
ImageWidget m_VehicleSpeedPointer
Definition IngameHud.c:41
ref WidgetFadeTimer m_FadeTimerMagazineName
Definition IngameHud.c:85
void DisplayTendencyNormal(int key, int tendency, int status)
Definition IngameHud.c:521
Widget m_SpecializatonPanel
Definition IngameHud.c:154
TextWidget m_VehicleSpeedValue
Definition IngameHud.c:48
override void ShowQuickbarUI(bool show)
Definition IngameHud.c:1089
ref map< int, string > m_VehicleGearTableAuto
Definition IngameHud.c:29
ref map< int, string > m_BadgesWidgetNames
Definition IngameHud.c:14
TextWidget m_VehicleCurrentGearValue
Definition IngameHud.c:50
bool m_HudHidePlayer
Definition IngameHud.c:138
bool m_IsStaminaVisible
Definition IngameHud.c:24
override void SetStamina(int value, int range)
Definition IngameHud.c:709
Widget m_PresenceLevel2
Definition IngameHud.c:103
ImageWidget m_VehicleOilLight
Definition IngameHud.c:56
ref WidgetFadeTimer m_FadeTimerQuickbar
Definition IngameHud.c:88
Widget m_HitIndicatorDown
Definition IngameHud.c:150
Widget m_Badges
Definition IngameHud.c:78
override void SetCursorIconOffset(string type, float x, float y)
Definition IngameHud.c:470
ImageWidget m_VehicleFuelLight
Definition IngameHud.c:46
InventoryQuickbar GetQuickbar()
Definition IngameHud.c:1027
ref WidgetFadeTimer m_FadeTimerCrosshair
Definition IngameHud.c:80
ProgressBarWidget m_Stamina
Definition IngameHud.c:92
ImageWidget m_HeatBufferPlus
Definition IngameHud.c:22
float m_TemperatureTimer
Definition IngameHud.c:20
ImageWidget m_ActionIcon
Definition IngameHud.c:125
bool m_HudInventory
Definition IngameHud.c:139
ImageWidget m_VehicleBatteryLight
Definition IngameHud.c:54
Widget GetHudPanelWidget()
Definition IngameHud.c:1245
bool IsQuickbarVisible()
Definition IngameHud.c:1032
bool m_IsHudVisible
Definition IngameHud.c:145
override void ShowQuickBar(bool show)
global setting; is quickbar visibility allowed?
Definition IngameHud.c:1127
ref map< int, ImageWidget > m_StatesWidgets
Definition IngameHud.c:8
Widget m_PresenceLevel4
Definition IngameHud.c:105
ImageWidget m_VehicleFuelPointer
Definition IngameHud.c:45
override void ToggleHeatBufferPlusSign(bool show)
Definition IngameHud.c:1121
Widget m_RadialProgressBar1
Definition IngameHud.c:110
bool m_Faded
Definition IngameHud.c:146
Widget m_VehiclePanel
Definition IngameHud.c:36
override void ShowCursor()
Definition IngameHud.c:453
override void RefreshQuickbar(bool itemChanged=false)
Definition IngameHud.c:1222
ref Timer myTimer
Definition IngameHud.c:106
ref WidgetFadeTimer m_FadeTimerWalkieTalkie
Definition IngameHud.c:89
Widget m_StanceProne
Definition IngameHud.c:95
Widget m_GameStatusIconsPanel
Definition IngameHud.c:67
override void SetStaminaBarVisibility(bool show)
Definition IngameHud.c:681
Widget m_HitIndicatorRight
Definition IngameHud.c:152
bool m_IsQuickbarVisible
Definition IngameHud.c:144
void InitBadgesAndNotifiers()
Definition IngameHud.c:312
override void Show(bool show)
Definition IngameHud.c:414
override void Update(float timeslice)
Definition IngameHud.c:1363
ref map< int, ImageWidget > m_BadgesWidgets
Definition IngameHud.c:17
Widget m_LeftHudPanelWidget
Definition IngameHud.c:32
TextWidget m_VehicleNextGearValue
Definition IngameHud.c:51
void RefreshQuickbarVisibility()
Definition IngameHud.c:1051
bool IsHideQuickbarPlayer()
Definition IngameHud.c:1079
override void SpawnHitDirEffect(DayZPlayer player, float hit_direction, float intensity_max)
Definition IngameHud.c:1429
PlayerBase m_CurrentTaggedPlayer
Definition IngameHud.c:1317
ImageWidget m_HighPingA
Definition IngameHud.c:68
Widget m_ActionIconFrame
Definition IngameHud.c:128
void CleanupHitDirEffects()
Definition IngameHud.c:1447
Widget m_StanceCrouch
Definition IngameHud.c:98
override void UpdateQuickbarGlobalVisibility()
Definition IngameHud.c:1042
Widget m_HitIndicatorUp
Definition IngameHud.c:149
bool KeyPress(int key)
Definition IngameHud.c:749
override void SetWalkieTalkieText(string text)
Definition IngameHud.c:435
Widget m_Notifiers
Definition IngameHud.c:74
bool GetQuickBarState()
Definition IngameHud.c:1142
ImageWidget m_VehicleWheelLight
Definition IngameHud.c:58
override void SetCursorIconSize(string type, float x, float y)
Definition IngameHud.c:475
ref Timer m_HideTimer
Definition IngameHud.c:79
ImageWidget m_ActionHealthMark
Definition IngameHud.c:121
static int GetItemHealthColor(int pHealthLevel)
Definition EnMath.c:7
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
HitDirectionModes
Definition constants.c:98
proto void Print(void var)
Prints content of variable to console/log.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Definition EnScript.c:338
const int STATE_WORN
Definition constants.c:760
static proto int AbsInt(int i)
Returns absolute value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
const int MENU_INVENTORY
Definition constants.c:170
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
proto native volatile void Update()
int ARGB(int a, int r, int g, int b)
Definition proto.c:322