Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
dayzgame.c
Go to the documentation of this file.
12
13const int DISCONNECT_SESSION_FLAGS_FORCE = int.MAX & ~DisconnectSessionFlags.IGNORE_WHEN_IN_GAME;
14const int DISCONNECT_SESSION_FLAGS_JOIN = int.MAX & ~DisconnectSessionFlags.JOIN_ERROR_CHECK;
15const int DISCONNECT_SESSION_FLAGS_ALL = int.MAX;
16
18{
19 proto native Object GetSource();
20 proto native vector GetPos();
21 proto native vector GetInVelocity();
22 proto native string GetAmmoType();
23 proto native float GetProjectileDamage();
24}
25
26class CollisionInfoBase: ProjectileStoppedInfo
27{
28 proto native vector GetSurfNormal();
29}
30
31class ObjectCollisionInfo: CollisionInfoBase
32{
33 proto native Object GetHitObj();
34 proto native vector GetHitObjPos();
35 proto native vector GetHitObjRot();
36 proto native int GetComponentIndex();
37}
38
39class TerrainCollisionInfo: CollisionInfoBase
40{
41 proto native bool GetIsWater();
42}
43
45{
46 static ref map<int, string> m_Mappings = new map<int, string>;
47
48 static void RegisterSoundSet(string sound_set)
49 {
50 m_Mappings.Set(sound_set.Hash(), sound_set);
51 }
52
53 static string GetSoundSetByHash(int hash)
54 {
55 string sound_set;
56 if (m_Mappings)
57 m_Mappings.Find(hash,sound_set);
58 return sound_set;
59 }
60};
61
62
64{
65 protected ref UiHintPanelLoading m_HintPanel;
66 protected bool m_IsStatic;
67 protected float m_HintTimeAccu;
68
69 override void Update(float timeslice)
70 {
71 if (m_HintPanel)
72 {
73 m_HintTimeAccu += timeslice;
74 if (CanChangeHintPage(m_HintTimeAccu))
75 {
76 m_HintPanel.ShowRandomPage();
77 m_HintTimeAccu = 0;
78 }
79 }
80
81 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
82 {
83 Leave();
84 }
85 }
86
87 protected void Leave()
88 {
89 g_Game.SetGameState(DayZGameState.MAIN_MENU);
90 g_Game.SetLoadState(DayZLoadState.MAIN_MENU_START);
91
92 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().DisconnectSessionForce);
93
94 Close();
95 }
96
97 protected bool CanChangeHintPage(float timeAccu);
98
99 bool IsStatic()
100 {
101 return m_IsStatic;
102 }
103
105 {
106 return false;
107 }
108}
109
111{
112 protected TextWidget m_txtPosition;
113 protected TextWidget m_txtNote;
114 protected ButtonWidget m_btnLeave;
115 protected int m_iPosition = -1;
116
118 {
119 g_Game.SetKeyboardHandle(this);
120 }
121
123 {
124 g_Game.SetKeyboardHandle(NULL);
125 }
126
127 override Widget Init()
128 {
129 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/dialog_queue_position.layout");
130 m_HintPanel = new UiHintPanelLoading(layoutRoot.FindAnyWidget("hint_frame0"));
131 m_txtPosition = TextWidget.Cast(layoutRoot.FindAnyWidget("txtPosition"));
132 m_txtNote = TextWidget.Cast(layoutRoot.FindAnyWidget("txtNote"));
133 m_btnLeave = ButtonWidget.Cast(layoutRoot.FindAnyWidget("btnLeave"));
134 m_txtNote.Show(true);
135 layoutRoot.FindAnyWidget("notification_root").Show(false);
136
137 #ifdef PLATFORM_CONSOLE
138 layoutRoot.FindAnyWidget("toolbar_bg").Show(true);
139 RichTextWidget toolbar_b = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
140 toolbar_b.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
141 #ifdef PLATFORM_XBOX
142 #ifdef BUILD_EXPERIMENTAL
143 layoutRoot.FindAnyWidget("notification_root").Show(true);
144 #endif
145 #endif
146 #endif
147
148 return layoutRoot;
149 }
150
151 override bool OnClick(Widget w, int x, int y, int button)
152 {
153 super.OnClick(w, x, y, button);
154 if (w == m_btnLeave)
155 {
156 Leave();
157 return true;
158 }
159 return false;
160 }
161
162 void Show()
163 {
164 if (layoutRoot)
165 {
166 layoutRoot.Show(true);
167 }
168 }
169
170 void Hide()
171 {
172 if (layoutRoot)
173 layoutRoot.Show(false);
174 m_HintPanel = null;
175 }
176
177 void SetPosition(int position)
178 {
179 if (position != m_iPosition)
180 {
181 m_iPosition = position;
182 m_txtPosition.SetText(position.ToString());
183 }
184 }
185
186 override protected bool CanChangeHintPage(float timeAccu)
187 {
188 return timeAccu >= GameConstants.LOADING_SCREEN_HINT_INTERVAL;
189 }
190};
191
192
194class LoginQueueStatic extends LoginQueueBase
195{
196 void LoginQueueStatic()
197 {
198 Init();
199
200 m_IsStatic = true;
201 }
202};
203
205{
206 protected TextWidget m_txtDescription;
207 protected TextWidget m_txtLabel;
208 protected ButtonWidget m_btnLeave;
209
210 protected bool m_IsRespawn;
211
212 private ref FullTimeData m_FullTime;
213
214 void LoginTimeBase()
215 {
216 g_Game.SetKeyboardHandle(this);
217 m_IsRespawn = false;
218
219 m_FullTime = new FullTimeData();
220 }
221
222 void ~LoginTimeBase()
223 {
224 if (g_Game)
225 g_Game.SetKeyboardHandle(null);
226 m_FullTime = null;
227 }
228
229 override Widget Init()
230 {
231 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/dialog_login_time.layout");
232
233 m_txtDescription = TextWidget.Cast(layoutRoot.FindAnyWidget("txtDescription"));
234 m_txtLabel = TextWidget.Cast(layoutRoot.FindAnyWidget("txtLabel"));
235 m_btnLeave = ButtonWidget.Cast(layoutRoot.FindAnyWidget("btnLeave"));
236 m_txtDescription.Show(true);
237 layoutRoot.FindAnyWidget("notification_root").Show(false);
238
239 #ifdef PLATFORM_CONSOLE
240 layoutRoot.FindAnyWidget("toolbar_bg").Show(true);
241 RichTextWidget toolbar_b = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
242 toolbar_b.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
243 #ifdef PLATFORM_XBOX
244 #ifdef BUILD_EXPERIMENTAL
245 layoutRoot.FindAnyWidget("notification_root").Show(true);
246 #endif
247 #endif
248 #endif
249
250 return layoutRoot;
251 }
252
253 override bool OnClick(Widget w, int x, int y, int button)
254 {
255 super.OnClick(w, x, y, button);
256 if (w == m_btnLeave)
257 {
258 Leave();
259 return true;
260 }
261 return false;
262 }
263
264 void Show()
265 {
266 if (layoutRoot)
267 {
268 layoutRoot.Show(true);
269 m_HintPanel = new UiHintPanelLoading(layoutRoot.FindAnyWidget("hint_frame0"));
270 }
271 }
272
273 void Hide()
274 {
275 if (layoutRoot)
276 layoutRoot.Show(false);
277 m_HintPanel = null;
278 }
279
280 void SetTime(int time)
281 {
282 string text = "";
283 TimeConversions.ConvertSecondsToFullTime(time, m_FullTime);
284 if (!m_IsRespawn)
285 text = "#menu_loading_in_";
286 else
287 text = "#dayz_game_spawning_in_";
288
289 if (m_FullTime.m_Days > 0)
290 text += "dhms";
291 else if (m_FullTime.m_Hours > 0)
292 text += "hms";
293 else if (m_FullTime.m_Minutes > 0)
294 text += "ms";
295 else
296 text += "s";
297
298 text = Widget.TranslateString(text);
299 text = string.Format(text, m_FullTime.m_Seconds, m_FullTime.m_Minutes, m_FullTime.m_Hours, m_FullTime.m_Days);
300 m_txtLabel.SetText(text);
301
302 if (m_IsRespawn && time <= 1)
304 }
305
306 void SetStatus(string status)
307 {
308 m_txtDescription.SetText(status);
309 }
310
311 void SetRespawn(bool value)
312 {
313 m_IsRespawn = value;
314 }
315
316 bool IsRespawn()
317 {
318 return m_IsRespawn;
319 }
320
321 override protected bool CanChangeHintPage(float timeAccu)
322 {
323 return timeAccu >= GameConstants.LOADING_SCREEN_HINT_INTERVAL && m_FullTime.m_Seconds >= GameConstants.LOADING_SCREEN_HINT_INTERVAL_MIN;
324 }
325};
326
328class LoginTimeStatic extends LoginTimeBase
329{
330 void LoginTimeStatic()
331 {
332 Init();
333
334 m_IsStatic = true;
335 }
336
337 void ~LoginTimeStatic()
338 {
339 }
340};
341
342
343
345{
346 private ref Widget m_WidgetRoot;
347 private TextWidget m_TextWidgetTitle;
348 private float m_duration;
349
350 void ConnectionLost(DayZGame game)
351 {
352 m_WidgetRoot = game.GetWorkspace().CreateWidgets("gui/layouts/day_z_connection_lost.layout");
353 m_WidgetRoot.Show(false);
354
355 Class.CastTo(m_TextWidgetTitle, m_WidgetRoot.FindAnyWidget("TextWidget"));
356 m_duration = 0.0;
357 }
358
359 void Show()
360 {
361 if (!m_WidgetRoot.IsVisible())
362 {
363 if (g_Game.GetUIManager().IsDialogVisible())
364 {
365 g_Game.GetUIManager().HideDialog();
366 }
367
368 m_WidgetRoot.Show(true);
369 m_TextWidgetTitle.SetText("");
370 }
371 }
372
373 void Hide()
374 {
375 if (m_WidgetRoot.IsVisible())
376 {
377 m_WidgetRoot.Show(false);
378 }
379 }
380
381 void SetText(string text)
382 {
383 m_TextWidgetTitle.SetText(text);
384 }
385
386 float GetDuration()
387 {
388 return m_duration;
389 }
390
391 void SetDuration(float duration)
392 {
393 m_duration = duration;
394 }
395};
396
401
403{
404 private ref map<EDayZProfilesOptions, ref DayZProfilesOptionBool> m_DayZProfilesOptionsBool;
405 private ref map<EDayZProfilesOptions, ref DayZProfilesOptionInt> m_DayZProfilesOptionsInt;
406 private ref map<EDayZProfilesOptions, ref DayZProfilesOptionFloat> m_DayZProfilesOptionsFloat;
407
408 static ref ScriptInvoker m_OnIntOptionChanged = new ScriptInvoker();
409 static ref ScriptInvoker m_OnBoolOptionChanged = new ScriptInvoker();
410 static ref ScriptInvoker m_OnFloatOptionChanged = new ScriptInvoker();
411
413 {
414 m_DayZProfilesOptionsBool = new map<EDayZProfilesOptions, ref DayZProfilesOptionBool>();
415 m_DayZProfilesOptionsInt = new map<EDayZProfilesOptions, ref DayZProfilesOptionInt>();
416 m_DayZProfilesOptionsFloat = new map<EDayZProfilesOptions, ref DayZProfilesOptionFloat>();
417 }
418
419 void RegisterProfileOption(EDayZProfilesOptions option, string profileOptionName, bool def = true)
420 {
421 if (!m_DayZProfilesOptionsBool.Contains(option))
422 {
424 bool profileVal = GetProfileValueBool(profileOptionName, def);
425
426 m_DayZProfilesOptionsBool.Set(option, new DayZProfilesOptionBool(profileOptionName, profileVal, def));
427 SetProfileOptionBool(option, profileVal);
428 }
429 }
430
431 void RegisterProfileOptionBool(EDayZProfilesOptions option, string profileOptionName, bool defaultValue = true)
432 {
433 RegisterProfileOption(option, profileOptionName, defaultValue);
434 }
435
436 void RegisterProfileOptionInt(EDayZProfilesOptions option, string profileOptionName, int defaultValue = 0)
437 {
438 if (!m_DayZProfilesOptionsInt.Contains(option))
439 {
441 string outValue;
442 GetGame().GetProfileString(profileOptionName, outValue);
443 int value = outValue.ToInt();
444
445 m_DayZProfilesOptionsInt.Set(option, new DayZProfilesOptionInt(profileOptionName, value, defaultValue));
446 SetProfileOptionInt(option, value);
447 }
448 }
449
450 void RegisterProfileOptionFloat(EDayZProfilesOptions option, string profileOptionName, float defaultValue = 0.0)
451 {
452 if (!m_DayZProfilesOptionsFloat.Contains(option))
453 {
455 string outValue;
456 GetGame().GetProfileString(profileOptionName, outValue);
457 float value = outValue.ToFloat();
458
459 m_DayZProfilesOptionsFloat.Set(option, new DayZProfilesOptionFloat(profileOptionName, value, defaultValue));
460 SetProfileOptionFloat(option, value);
461 }
462 }
463
464 void ResetOptionsBool()
465 {
466 if (!m_DayZProfilesOptionsBool)
467 {
468 m_DayZProfilesOptionsBool = new map<EDayZProfilesOptions, ref DayZProfilesOptionBool>();
469 }
470
471 foreach (EDayZProfilesOptions e_opt, DayZProfilesOptionBool r_opt : m_DayZProfilesOptionsBool)
472 {
473 bool profileVal = GetProfileValueBool(r_opt.param1, r_opt.param3);
474 SetProfileOptionBool(e_opt, profileVal);
475 }
476 }
477
478 void ResetOptions()
479 {
480 ResetOptionsBool();
481 }
482
483 void ResetOptionsInt()
484 {
485 if (!m_DayZProfilesOptionsInt)
486 {
487 m_DayZProfilesOptionsInt = new map<EDayZProfilesOptions, ref DayZProfilesOptionInt>();
488 }
489
490 foreach (EDayZProfilesOptions e_opt, DayZProfilesOptionInt r_opt : m_DayZProfilesOptionsInt)
491 {
492 string outValue;
493 GetGame().GetProfileString(r_opt.param1, outValue);
494 int value = outValue.ToInt();
495 SetProfileOptionInt(e_opt, value);
496 }
497 }
498
499 void ResetOptionsFloat()
500 {
501 if (!m_DayZProfilesOptionsFloat)
502 {
503 m_DayZProfilesOptionsFloat = new map<EDayZProfilesOptions, ref DayZProfilesOptionFloat>();
504 }
505
506 foreach (EDayZProfilesOptions e_opt, DayZProfilesOptionFloat r_opt : m_DayZProfilesOptionsFloat)
507 {
508 string outValue;
509 GetGame().GetProfileString(r_opt.param1, outValue);
510 float value = outValue.ToFloat();
511 SetProfileOptionFloat(e_opt, value);
512 }
513 }
514
515 void SetProfileOption(EDayZProfilesOptions option, bool value)
516 {
517 if (m_DayZProfilesOptionsBool && m_DayZProfilesOptionsBool.Contains(option))
518 {
519 DayZProfilesOptionBool po = m_DayZProfilesOptionsBool.Get(option);
520
521 po.param2 = value;
522 GetGame().SetProfileString(po.param1, value.ToString());
523 GetGame().SaveProfile();
524
525 m_OnBoolOptionChanged.Invoke(po.param1, value);
526 }
527 }
528
529 void SetProfileOptionBool(EDayZProfilesOptions option, bool value)
530 {
531 SetProfileOption(option, value);
532 }
533
534 void SetProfileOptionInt(EDayZProfilesOptions option, int value)
535 {
536 if (m_DayZProfilesOptionsInt && m_DayZProfilesOptionsInt.Contains(option))
537 {
538 DayZProfilesOptionInt po = m_DayZProfilesOptionsInt.Get(option);
539
540 po.param2 = value;
541 GetGame().SetProfileString(po.param1, value.ToString());
542 GetGame().SaveProfile();
543
544 m_OnIntOptionChanged.Invoke(option, value);
545 }
546 }
547
548 void SetProfileOptionFloat(EDayZProfilesOptions option, float value)
549 {
550 if (m_DayZProfilesOptionsFloat && m_DayZProfilesOptionsFloat.Contains(option))
551 {
552 DayZProfilesOptionFloat po = m_DayZProfilesOptionsFloat.Get(option);
553
554 po.param2 = value;
555 GetGame().SetProfileString(po.param1, value.ToString());
556 GetGame().SaveProfile();
557
558 m_OnFloatOptionChanged.Invoke(po.param1, value);
559 }
560 }
561
562 bool GetProfileOption(EDayZProfilesOptions option)
563 {
564 if (m_DayZProfilesOptionsBool && m_DayZProfilesOptionsBool.Contains(option))
565 {
566 DayZProfilesOptionBool po = m_DayZProfilesOptionsBool.Get(option);
567 return po.param2;
568 }
569
570 return true;
571 }
572
573 bool GetProfileOptionBool(EDayZProfilesOptions option)
574 {
575 return GetProfileOption(option);
576 }
577
578 int GetProfileOptionInt(EDayZProfilesOptions option)
579 {
580 if (m_DayZProfilesOptionsInt && m_DayZProfilesOptionsInt.Contains(option))
581 {
582 DayZProfilesOptionInt po = m_DayZProfilesOptionsInt.Get(option);
583 return po.param2;
584 }
585
586 return 0;
587 }
588
589 float GetProfileOptionFloat(EDayZProfilesOptions option)
590 {
591 if (m_DayZProfilesOptionsFloat && m_DayZProfilesOptionsFloat.Contains(option))
592 {
593 DayZProfilesOptionFloat po = m_DayZProfilesOptionsFloat.Get(option);
594 return po.param2;
595 }
596
597 return 0.0;
598 }
599
600 bool GetProfileOptionDefault(EDayZProfilesOptions option)
601 {
602 return GetProfileOptionDefaultBool(option);
603 }
604
605 bool GetProfileOptionDefaultBool(EDayZProfilesOptions option)
606 {
607 if (m_DayZProfilesOptionsBool && m_DayZProfilesOptionsBool.Contains(option))
608 {
609 DayZProfilesOptionBool po = m_DayZProfilesOptionsBool.Get(option);
610 return po.param3;
611 }
612
613 ErrorEx("Invalid profile option id! Returning 'true'.", ErrorExSeverity.WARNING);
614 return true;
615 }
616
617 int GetProfileOptionDefaultInt(EDayZProfilesOptions option)
618 {
619 if (m_DayZProfilesOptionsInt && m_DayZProfilesOptionsInt.Contains(option))
620 {
621 DayZProfilesOptionInt po = m_DayZProfilesOptionsInt.Get(option);
622 return po.param3;
623 }
624
625 ErrorEx("Invalid profile option id! Returning '0'.", ErrorExSeverity.WARNING);
626 return 0;
627 }
628
629 float GetProfileOptionDefaultFloat(EDayZProfilesOptions option)
630 {
631 if (m_DayZProfilesOptionsFloat && m_DayZProfilesOptionsFloat.Contains(option))
632 {
633 DayZProfilesOptionFloat po = m_DayZProfilesOptionsFloat.Get(option);
634 return po.param3;
635 }
636
637 ErrorEx("Invalid profile option id! Returning '0.0'.", ErrorExSeverity.WARNING);
638 return 0.0;
639 }
640
642 {
643 if (m_DayZProfilesOptions)
644 return m_DayZProfilesOptions;
645
646 return null;
647 }
648
651 private ref map<EDayZProfilesOptions, ref DayZProfilesOption> m_DayZProfilesOptions;
652 private DayZGame m_Game;
653}
654
655enum DayZGameState
656{
663 IN_GAME
664}
665
666enum DayZLoadState
667{
668 UNDEFINED,
683 MISSION_CONTROLLER_SELECT
684}
685
686class LoadingScreen
687{
688 ref Widget m_WidgetRoot;
691 TextWidget m_ModdedWarning;
693 DayZGame m_DayZGame;
695
696 ImageWidget m_ImageLogoMid;
697 ImageWidget m_ImageLogoCorner;
699 ImageWidget m_ImageBackground;
700 ProgressBarWidget m_ProgressLoading;
702 TextWidget m_ProgressText;
703
706 ref UiHintPanelLoading m_HintPanel;
707 void LoadingScreen(DayZGame game)
708 {
709 m_DayZGame = game;
710
711 m_WidgetRoot = game.GetLoadingWorkspace().CreateWidgets("gui/layouts/loading.layout");
712 Class.CastTo(m_ImageLogoMid, m_WidgetRoot.FindAnyWidget("ImageLogoMid"));
713 Class.CastTo(m_ImageLogoCorner, m_WidgetRoot.FindAnyWidget("ImageLogoCorner"));
714
715 Class.CastTo(m_TextWidgetTitle, m_WidgetRoot.FindAnyWidget("TextWidget"));
716 Class.CastTo(m_TextWidgetStatus, m_WidgetRoot.FindAnyWidget("StatusText"));
717 Class.CastTo(m_ImageWidgetBackground, m_WidgetRoot.FindAnyWidget("ImageBackground"));
718 Class.CastTo(m_ImageLoadingIcon, m_WidgetRoot.FindAnyWidget("ImageLoadingIcon"));
719 Class.CastTo(m_ModdedWarning, m_WidgetRoot.FindAnyWidget("ModdedWarning"));
720
721 m_ImageBackground = ImageWidget.Cast(m_WidgetRoot.FindAnyWidget("ImageBackground"));
722 m_ProgressLoading = ProgressBarWidget.Cast(m_WidgetRoot.FindAnyWidget("LoadingBar"));
723
724 string tmp;
725 m_ProgressText = TextWidget.Cast(m_WidgetRoot.FindAnyWidget("ProgressText"));
726 if (GetGame())
727 {
728 m_ProgressText.Show(GetGame().CommandlineGetParam("loadingTest", tmp));
729 }
730 m_WidgetRoot.FindAnyWidget("notification_root").Show(false);
731
732 #ifdef PLATFORM_CONSOLE
733 #ifdef PLATFORM_XBOX
734 #ifdef BUILD_EXPERIMENTAL
735 Widget expNotification = m_WidgetRoot.FindAnyWidget("notification_root");
736 if (expNotification)
737 {
738 expNotification.Show(true);
739 }
740 #endif
741 #endif
742 #endif
743
744 m_ModdedWarning.Show(g_Game.ReportModded());
745 m_ImageLogoMid.Show(true);
746 m_ImageLogoCorner.Show(false);
747
748 m_ImageWidgetBackground.Show(true);
749 m_Counter = 0;
750
751 // lighten up your desktop
752 game.GetBacklit().LoadingAnim();
753
754 ProgressAsync.SetProgressData(m_ProgressLoading);
755 ProgressAsync.SetUserData(m_ImageBackground);
756 }
757
759 void OnTimer();
760
761 void Inc()
762 {
763 m_LastProgressUpdate = m_DayZGame.GetTickTime();
764 m_Counter++;
765 if (m_Counter == 1)
766 {
767 Show();
768 }
769 }
770
771 void Dec()
772 {
773 m_Counter = m_Counter - 1;
774
775 if (m_Counter <= 0)
776 {
777 m_Counter = 0;
778 EndLoading();
779 m_HintPanel = null;
780 }
781 }
782
784 {
785 ProgressAsync.SetProgressData(null);
786 ProgressAsync.SetUserData(null);
787 m_WidgetRoot.Show(false);
788 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.CheckDialogs);
789 }
790
792 {
793 return m_WidgetRoot.IsVisible();
794 }
795
796 void SetTitle(string title)
797 {
798 m_TextWidgetTitle.SetText(title);
799 }
800
801 void SetStatus(string status)
802 {
803 m_TextWidgetStatus.SetText(status);
804 }
805
806 void SetProgress(float val)
807 {
808 float time_delta = m_DayZGame.GetTickTime() - m_LastProgressUpdate;
809
810 m_LastProgressUpdate = m_DayZGame.GetTickTime();
811 }
812
813 void OnUpdate(float timeslice)
814 {
815
816 }
817
818 void ShowEx(DayZGame game)
819 {
820 if (!m_HintPanel)
821 {
822 m_HintPanel = new UiHintPanelLoading(m_WidgetRoot.FindAnyWidget("hint_frame"));
823 m_HintPanel.Init(game);
824 }
825
826 Show();
827 }
828
829 void Show()
830 {
831 Widget lIcon = m_ImageBackground;
832 Widget pText = m_ProgressLoading;
833 m_ProgressText.SetText("");
834 m_ProgressLoading.SetCurrent(0.0);
835 m_ImageBackground.SetMaskProgress(0.0);
836
837 if (!m_WidgetRoot.IsVisible())
838 {
839 if (m_DayZGame.GetUIManager().IsDialogVisible())
840 {
841 m_DayZGame.GetUIManager().HideDialog();
842 }
843
844 if (m_DayZGame.GetMissionState() == DayZGame.MISSION_STATE_MAINMENU)
845 {
846 m_ImageLogoMid.Show(false);
847 m_ImageLogoCorner.Show(false);
848 m_ImageWidgetBackground.Show(true);
849 m_TextWidgetStatus.Show(true);
850 }
851 else
852 {
853 m_ImageLogoMid.Show(true);
854 m_ImageLogoCorner.Show(false);
855 m_ImageWidgetBackground.Show(true);
856 m_TextWidgetStatus.Show(false);
857 }
858
859 m_WidgetRoot.Show(true);
860 m_TextWidgetTitle.SetText("");
861 m_TextWidgetStatus.SetText("");
862 }
863
864 ProgressAsync.SetProgressData(pText);
865 ProgressAsync.SetUserData(lIcon);
866 }
867
868 void Hide(bool force)
869 {
870 if (force)
871 {
872 while (m_Counter > 0)
873 {
874 Dec();
875 }
876 }
877
878 if (m_Counter <= 0)
879 {
880 m_WidgetRoot.Show(false);
881 ProgressAsync.SetUserData(null);
882 ProgressAsync.SetProgressData(null);
883 m_HintPanel = null;
884 }
885 }
886};
887
888
889class DayZGame extends CGame
890{
892
893 const int MISSION_STATE_MAINMENU = 0;
894 const int MISSION_STATE_GAME = 1;
895 const int MISSION_STATE_FINNISH = 2;
896
898
899 private const int STATS_COUNT = EConnectivityStatType.COUNT;
900 private EConnectivityStatLevel m_ConnectivityStatsStates[STATS_COUNT];
901
902 private int m_MissionState;
903
904 //HK stuff
905 protected DayZGameState m_GameState;
906 protected DayZLoadState m_LoadState;
908 protected bool m_FirstConnect = true;
909 //End HK stuff
910
912 private ref LoginTimeBase m_LoginTimeScreen;
913 private ref LoginQueueBase m_LoginQueue;
914 private int m_LoginTime;
915
916 private ref ConnectionLost m_connectionLost;
917 private ref TimerQueue m_timerQueue[CALL_CATEGORY_COUNT];
918 private ref ScriptCallQueue m_callQueue[CALL_CATEGORY_COUNT];
919 private ref ScriptInvoker m_updateQueue[CALL_CATEGORY_COUNT];
920 private ref ScriptInvoker m_postUpdateQueue[CALL_CATEGORY_COUNT];
921 private ref DragQueue m_dragQueue;
922 private ref ScriptInvoker m_YieldDataInitInvoker;
923 private ref DayZProfilesOptions m_DayZProfileOptions;
924 private bool m_early_access_dialog_accepted;
925 private UIScriptedMenu m_keyboard_handler;
926 private ScriptModule m_mission_module;
927 private string m_MissionPath;
928 private string m_MissionFolderPath;
929 private bool m_IsCtrlHolding;
930 private bool m_IsWinHolding;
931 private bool m_IsLeftAltHolding;
932 private bool m_IsRightAltHolding;
933
934 private bool m_IsWorldWetTempUpdateEnabled = true;
935 private bool m_IsFoodDecayEnabled = true;
936 private float m_FoodDecayModifier;
937
938 static bool m_ReportModded;
939 private bool m_IsStressTest;
940 private bool m_AimLoggingEnabled;
941 int m_OriginalCharactersCount;
942 private string m_PlayerName;
943 private bool m_IsNewCharacter;
944 private bool m_IsConnecting;
945 private bool m_ConnectFromJoin;
946 private bool m_ShouldShowControllerDisconnect;
947 private bool m_CursorDesiredVisibilityScript = true;
948 private int m_PreviousGamepad;
949 private float m_UserFOV;
950
951 private float m_DeltaTime;
952
953 float m_volume_sound;
954 float m_volume_speechEX;
955 float m_volume_music;
956 float m_volume_VOIP;
957 float m_volume_radio;
958
959 float m_PreviousEVValue;
960 float m_EVValue = 0;
961
962 #ifdef DIAG_DEVELOPER
963 private static ref ServerFpsStatsUpdatedEventParams m_ServerFpsStatsParams;
964 #endif
965
966 static ref AmmoCamParams m_AmmoShakeParams = new AmmoCamParams();//TODO: make static, reuse
967
968 static ref ScriptInvoker Event_OnRPC = new ScriptInvoker();
969
970 private ref Backlit m_Backlit;
971
972 private ref array<string> m_CharClassNames = new array<string>();
973 private ref array<int> m_ConnectedInputDeviceList; //has to be owned here, 'Input' is a native class
974
975 //Used for helicrash sound
976 private ref EffectSound m_CrashSound;
977
978 //Used for Artillery sound
979 private ref EffectSound m_ArtySound;
980 private const int MIN_ARTY_SOUND_RANGE = 300; // The distance under which sound is no longer heard
981
982 static ref NoiseParams m_NoiseParams = new NoiseParams();
983 static ref TemperatureAccessManager m_TAManager = new TemperatureAccessManager();
984 #ifdef DEVELOPER
985 static bool m_IsPreviewSpawn;
986 #endif
987 #ifdef DIAG_DEVELOPER
988 ref CameraToolsMenuServer m_CameraToolsMenuServer;
989 #endif
990
991 // CGame override functions
992 void DayZGame()
993 {
994 PPEManagerStatic.CreateManagerStatic();
995
996#ifdef PLATFORM_CONSOLE
997 SetMainMenuWorld("MainMenuSceneXbox");
998#endif
999 m_MissionState = MISSION_STATE_GAME;
1000
1001 m_keyboard_handler = null;
1002
1003 #ifdef DEVELOPER
1004 m_early_access_dialog_accepted = true;
1005 #endif
1006
1007 for (int i = 0; i < CALL_CATEGORY_COUNT; i++)
1008 {
1009 m_callQueue[i] = new ScriptCallQueue();
1010 m_updateQueue[i] = new ScriptInvoker();
1011 m_timerQueue[i] = new TimerQueue();
1012
1013 m_postUpdateQueue[i] = new ScriptInvoker();
1014 }
1015
1016 m_dragQueue = new DragQueue;
1017
1018 m_LoginTime = 0;
1019
1020 string tmp;
1021 if (CommandlineGetParam("stresstest", tmp))
1022 {
1023 m_IsStressTest = true;
1024 }
1025
1026 if (CommandlineGetParam("doAimLogs", tmp))
1027 {
1028 m_AimLoggingEnabled = true;
1029 }
1030
1031 // initialize backlit effects
1032 m_Backlit = new Backlit();
1033 m_Backlit.OnInit(this);
1034
1035 m_ReportModded = GetModToBeReported();
1036
1037 #ifndef NO_GUI
1038 if (m_loading == null)
1039 {
1040 m_loading = new LoadingScreen(this);
1041 }
1042
1043 if (m_loading)
1044 {
1045 m_loading.ShowEx(this);
1046 }
1047
1049 #endif
1050
1051 Debug.Init();
1052 Component.Init();
1053 CachedObjectsParams.Init();
1054 CachedObjectsArrays.Init();
1055 BleedChanceData.InitBleedChanceData();
1056 GetUApi().PresetSelect(GetUApi().PresetCurrent());
1057
1058 m_DayZProfileOptions = new DayZProfilesOptions();
1059
1060 GetCallQueue(CALL_CATEGORY_GUI).Call(DeferredInit);
1061 GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(GlobalsInit);
1062
1063 string path = "cfgVehicles";
1064 string child_name = "";
1065 int count = ConfigGetChildrenCount(path);
1066
1067 for (int p = 0; p < count; ++p)
1068 {
1069 ConfigGetChildName(path, p, child_name);
1070
1071 if (ConfigGetInt(path + " " + child_name + " scope") == 2 && IsKindOf(child_name, "SurvivorBase"))
1072 m_CharClassNames.Insert(child_name);
1073 }
1074
1075 m_IsConnecting = false;
1076 m_ConnectFromJoin = false;
1077 }
1078
1079 // ------------------------------------------------------------
1080 private void ~DayZGame()
1081 {
1082 PPEManagerStatic.DestroyManagerStatic();
1083 BleedChanceData.Cleanup();
1085
1086 g_Game = null;
1087 SetDispatcher(null);
1088 Print("~DayZGame()");
1089 }
1090
1091 // ------------------------------------------------------------
1092 void DeferredInit()
1093 {
1094 GameOptions opt = new GameOptions();
1095 opt.Initialize();
1096
1097 GetInput().UpdateConnectedInputDeviceList();
1098
1099 m_UserFOV = GetUserFOVFromConfig();
1100
1101 m_volume_sound = GetSoundScene().GetSoundVolume();
1102 m_volume_speechEX = GetSoundScene().GetSpeechExVolume();
1103 m_volume_music = GetSoundScene().GetMusicVolume();
1104 m_volume_VOIP = GetSoundScene().GetVOIPVolume();
1105 m_volume_radio = GetSoundScene().GetRadioVolume();
1106
1107 PPEManagerStatic.GetPPEManager().Init();
1109 }
1110
1111 // ------------------------------------------------------------
1112 void GlobalsInit()
1113 {
1114 if (GetCEApi())
1115 {
1116 m_IsWorldWetTempUpdateEnabled = (GetCEApi().GetCEGlobalInt("WorldWetTempUpdate") == 1);
1117
1118 m_FoodDecayModifier = GetCEApi().GetCEGlobalFloat("FoodDecay");
1119
1120 //check for legacy INT format, if value == float.MIN when read as FLOAT, it is of type INT, so we read it as such below
1121 if (m_FoodDecayModifier == float.MIN)
1122 {
1123 m_FoodDecayModifier = GetCEApi().GetCEGlobalInt("FoodDecay");
1124 }
1125 }
1126
1127 //we need to perform the load here as some objects behaving correctly after spawn is dependent on CE being initialized before spawning them
1129 }
1130
1131 // ------------------------------------------------------------
1132 void RegisterProfilesOptions()
1133 {
1134 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.CROSSHAIR, SHOW_CROSSHAIR);
1135 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.HUD, SHOW_HUD);
1136 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.HUD_VEHICLE, SHOW_HUD_VEHICLE);
1137 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.QUICKBAR, SHOW_QUICKBAR);
1138 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.SERVER_MESSAGES, SYSTEM_CHAT_MSG);
1139 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.USERS_CHAT, DIRECT_CHAT_MSG);
1140 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.RADIO_CHAT, RADIO_CHAT_MSG);
1141 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.GAME_MESSAGES, GAME_CHAT_MSG, false);
1142 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.ADMIN_MESSAGES, ADMIN_CHAT_MSG, false);
1143 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.PLAYER_MESSAGES, PLAYER_CHAT_MSG, false);
1144 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.SERVERINFO_DISPLAY, SHOW_SERVERINFO, true);
1145 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.BLEEDINGINDICATION, ENABLE_BLEEDINGINDICATION, true);
1146 m_DayZProfileOptions.RegisterProfileOptionBool(EDayZProfilesOptions.CONNECTIVITY_INFO, SHOW_CONNECTIVITYINFO, true);
1147
1148 m_DayZProfileOptions.RegisterProfileOptionFloat(EDayZProfilesOptions.HUD_BRIGHTNESS, HUD_BRIGHTNESS, 0.0);
1149
1150 m_DayZProfileOptions.RegisterProfileOptionInt(EDayZProfilesOptions.AMBIENT_MUSIC_MODE, OPTIONS_SOUND_AMBIENT_SOUND_MODE, 0);
1151 }
1152
1153 void ResetProfileOptions()
1154 {
1155 m_DayZProfileOptions.ResetOptionsBool();
1156 m_DayZProfileOptions.ResetOptionsInt();
1157 m_DayZProfileOptions.ResetOptionsFloat();
1158 }
1159
1161 void SetMissionPath(string path)
1162 {
1163 m_MissionPath = path;
1164
1165 int pos_end = 0;
1166 int pos_cur = 0;
1167
1168 while (pos_cur != -1)
1169 {
1170 pos_end = pos_cur;
1171 pos_cur = path.IndexOfFrom(pos_cur + 1 , "\\");
1172 }
1173
1174 m_MissionFolderPath = path.Substring(0, pos_end);
1175 }
1176
1177 string GetMissionPath()
1178 {
1179 return m_MissionPath;
1180 }
1181
1182 string GetMissionFolderPath()
1183 {
1184 return m_MissionFolderPath;
1185 }
1186
1187 override ScriptCallQueue GetCallQueue(int call_category)
1188 {
1189 return m_callQueue[call_category];
1190 }
1191
1192 override ScriptInvoker GetUpdateQueue(int call_category)
1193 {
1194 return m_updateQueue[call_category];
1195 }
1196
1197 override ScriptInvoker GetPostUpdateQueue(int call_category)
1198 {
1199 return m_postUpdateQueue[call_category];
1200 }
1201
1202 ScriptInvoker GetYieldDataInitInvoker()
1203 {
1204 if (!m_YieldDataInitInvoker)
1205 m_YieldDataInitInvoker = new ScriptInvoker();
1206
1207 return m_YieldDataInitInvoker;
1208 }
1209
1210 override TimerQueue GetTimerQueue(int call_category)
1211 {
1212 return m_timerQueue[call_category];
1213 }
1214
1215 override DragQueue GetDragQueue()
1216 {
1217 return m_dragQueue;
1218 }
1219
1220 // ------------------------------------------------------------
1221 void OnGameplayDataHandlerLoad()
1222 {
1223
1224 }
1225
1226
1227 // ------------------------------------------------------------
1228 int GetMissionState()
1229 {
1230 return m_MissionState;
1231 }
1232
1233 // ------------------------------------------------------------
1234 void SetMissionState(int state)
1235 {
1236 m_MissionState = state;
1237 }
1238
1239 // ------------------------------------------------------------
1240 bool GetProfileOption(EDayZProfilesOptions option)
1241 {
1242 return m_DayZProfileOptions.GetProfileOption(option);
1243 }
1244
1245 bool GetProfileOptionBool(EDayZProfilesOptions option)
1246 {
1247 return GetProfileOption(option);
1248 }
1249
1250 int GetProfileOptionInt(EDayZProfilesOptions option)
1251 {
1252 return m_DayZProfileOptions.GetProfileOptionInt(option);
1253 }
1254
1255 float GetProfileOptionFloat(EDayZProfilesOptions option)
1256 {
1257 return m_DayZProfileOptions.GetProfileOptionFloat(option);
1258 }
1259
1260 bool GetProfileOptionDefault(EDayZProfilesOptions option)
1261 {
1262 return m_DayZProfileOptions.GetProfileOptionDefaultBool(option);
1263 }
1264
1265 bool GetProfileOptionDefaultBool(EDayZProfilesOptions option)
1266 {
1267 return GetProfileOptionDefault(option);
1268 }
1269
1270 int GetProfileOptionDefaultInt(EDayZProfilesOptions option)
1271 {
1272 return m_DayZProfileOptions.GetProfileOptionDefaultInt(option);
1273 }
1274
1275 float GetProfileOptionDefaultFloat(EDayZProfilesOptions option)
1276 {
1277 return m_DayZProfileOptions.GetProfileOptionDefaultFloat(option);
1278 }
1279
1280 void SetProfileOption(EDayZProfilesOptions option, bool value)
1281 {
1282 m_DayZProfileOptions.SetProfileOptionBool(option, value);
1283 }
1284
1285 void SetProfileOptionBool(EDayZProfilesOptions option, bool value)
1286 {
1287 SetProfileOption(option, value);
1288 }
1289
1290 void SetProfileOptionInt(EDayZProfilesOptions option, int value)
1291 {
1292 m_DayZProfileOptions.SetProfileOptionInt(option, value);
1293 }
1294
1295 void SetProfileOptionFloat(EDayZProfilesOptions option, float value)
1296 {
1297 m_DayZProfileOptions.SetProfileOptionFloat(option, value);
1298 }
1299
1301 {
1302 return m_DayZProfileOptions.GetProfileOptionMap();
1303 }
1304
1305 bool IsStressTest()
1306 {
1307 return m_IsStressTest;
1308 }
1309
1310 bool IsAimLogEnabled()
1311 {
1312 return m_AimLoggingEnabled;
1313 }
1314
1315 void SetGameState(DayZGameState state)
1316 {
1317 m_GameState = state;
1318 }
1319
1320 DayZGameState GetGameState()
1321 {
1322 return m_GameState;
1323 }
1324
1325 void SetLoadState(DayZLoadState state)
1326 {
1327 m_LoadState = state;
1328 }
1329
1330 DayZLoadState GetLoadState()
1331 {
1332 return m_LoadState;
1333 }
1334
1335 static bool ReportModded()
1336 {
1337 return m_ReportModded;
1338 }
1339
1340 Backlit GetBacklit()
1341 {
1342 return m_Backlit;
1343 }
1344
1345 // ------------------------------------------------------------
1346 override bool IsInventoryOpen()
1347 {
1348#ifndef NO_GUI
1349 if (GetUIManager().FindMenu(MENU_INVENTORY) != NULL)
1350 {
1351 return true;
1352 }
1353#endif
1354 return false;
1355 }
1356
1357 // ------------------------------------------------------------
1358 void EarlyAccessDialog(UIScriptedMenu parent)
1359 {
1360 if (!m_early_access_dialog_accepted)
1361 {
1362 g_Game.GetUIManager().EnterScriptedMenu(MENU_EARLYACCESS, parent);
1363 m_early_access_dialog_accepted = true;
1364 }
1365 }
1366
1367 // ------------------------------------------------------------
1369 override UIScriptedMenu CreateScriptedMenu(int id)
1370 {
1371 #ifndef NO_GUI
1372 Mission mission = GetMission();
1373 if (mission)
1374 {
1375 return mission.CreateScriptedMenu(id);
1376 }
1377 #endif
1378 return NULL;
1379 }
1380
1381 // ------------------------------------------------------------
1382 void ReloadMission()
1383 {
1384 #ifdef ENABLE_LOGGING
1385 Print("Reloading mission module!");
1386 CreateMission(m_MissionPath);
1387 #endif
1388 }
1389
1390 // ------------------------------------------------------------
1391 void CancelLoginQueue()
1392 {
1393 if (m_LoginQueue)
1394 {
1395 if (m_LoginQueue.IsStatic())
1396 {
1397 m_LoginQueue.Hide();
1398 delete m_LoginQueue;
1399 }
1400 else
1401 {
1402 m_LoginQueue.Close();
1403 }
1404 }
1405 }
1406 // ------------------------------------------------------------
1407 void CancelLoginTimeCountdown()
1408 {
1409 GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(this.LoginTimeCountdown);
1410
1411 if (m_LoginTimeScreen)
1412 {
1413 if (m_LoginTimeScreen.IsStatic())
1414 {
1415 m_LoginTimeScreen.Hide();
1416 delete m_LoginTimeScreen;
1417 }
1418 else
1419 {
1420 m_LoginTimeScreen.Close();
1421 }
1422 }
1423 }
1424 // ------------------------------------------------------------
1425 private void ClearConnectivityStates()
1426 {
1427 for (int i = 0; i < STATS_COUNT; i++)
1428 m_ConnectivityStatsStates[i] = 0;
1429 }
1430
1431
1432 // ------------------------------------------------------------
1433 override void OnEvent(EventType eventTypeId, Param params)
1434 {
1435 string address;
1436 int port;
1437 int high, low;
1438
1439 switch (eventTypeId)
1440 {
1441 case StartupEventTypeID:
1442 {
1443 #ifndef SERVER
1444 // Just call it, to create the global instance if it doesn't exist yet
1445 ParticleManager.GetInstance();
1446 #endif
1447 break;
1448 }
1450 {
1451 #ifndef SERVER
1452 ClearConnectivityStates();
1453 #endif
1454 m_FirstConnect = true;
1455 ClientData.ResetClientData();
1456 break;
1457 }
1459 {
1460 LoadingHide();
1461 CancelLoginTimeCountdown();
1462 SetConnecting(false);
1463 SetGameState(DayZGameState.MAIN_MENU);
1464 m_FirstConnect = true;
1465 #ifdef PLATFORM_CONSOLE
1466 if (GetUserManager().GetSelectedUser())
1467 {
1470 if (GetGameState() == DayZGameState.IN_GAME)
1471 {
1472 SetLoadState(DayZLoadState.MAIN_MENU_START);
1473 }
1474 }
1475 m_Notifications.ClearVoiceNotifications();
1476 #endif
1477
1478 // analytics - disconnected player
1480 discData.m_CharacterId = g_Game.GetDatabaseID();
1481 discData.m_Reason = "quit";
1482 Analytics.PlayerDisconnected(discData);
1483 break;
1484 }
1486 {
1487 CancelLoginQueue();
1488 LoadingHide(true);
1489 SetConnecting(false);
1490 ProgressAsync.DestroyAllPendingProgresses();
1491
1492 if (GetGameState() == DayZGameState.CONNECTING)
1493 {
1494 SetGameState(DayZGameState.MAIN_MENU);
1495 }
1496
1497 break;
1498 }
1500 {
1501 LoadingHide(true);
1502 ProgressAsync.DestroyAllPendingProgresses();
1503
1504 SetGameState(DayZGameState.IN_GAME);
1505
1506 // analytics - spawned
1508 spawnData.m_CharacterId = g_Game.GetDatabaseID();
1509 spawnData.m_Lifetime = 0;
1510 spawnData.m_Position = vector.Zero;
1511 if (GetPlayer())
1512 {
1513 spawnData.m_Position = GetPlayer().GetPosition();
1514 }
1515 spawnData.m_DaytimeHour = 0;
1516 spawnData.m_Population = 0;
1517 Analytics.PlayerSpawned(spawnData);
1518
1519 #ifdef PLATFORM_CONSOLE
1520 m_Notifications.ClearVoiceNotifications();
1522 #endif
1523 if (m_FirstConnect)
1524 {
1525 m_FirstConnect = false;
1526 if (GetHostAddress(address, port))
1527 {
1528 AddVisitedServer(address, port);
1529 }
1530
1531 #ifdef PLATFORM_CONSOLE
1532 #ifndef PLATFORM_WINDOWS // if app is not on Windows with -XBOX parameter
1533 if (null != GetUserManager().GetSelectedUser())
1534 {
1537 }
1538 #endif
1539 #endif
1540 }
1541
1543
1544 break;
1545 }
1547 {
1548 MPConnectionLostEventParams conLost_params;
1549 if (Class.CastTo(conLost_params, params))
1550 {
1551 int duration = conLost_params.param1;
1552 OnMPConnectionLostEvent(duration);
1553 }
1554 break;
1555 }
1557 {
1558 LoadingShow();
1559 break;
1560 }
1562 {
1563 GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.CheckDialogs);
1564 break;
1565 }
1567 {
1568 ChatMessageEventParams chat_params;
1569 if (Class.CastTo(chat_params, params))
1570 {
1571
1572 }
1573 break;
1574 }
1576 {
1577 ProgressEventParams prog_params;
1578 if (Class.CastTo(prog_params, params))
1579 LoadProgressUpdate(prog_params.param1, prog_params.param2, prog_params.param3);
1580 break;
1581 }
1583 {
1584 LoginTimeEventParams loginTimeParams;
1585 if (Class.CastTo(loginTimeParams, params))
1586 {
1587 OnLoginTimeEvent(loginTimeParams.param1);
1588 }
1589 break;
1590 }
1591 case RespawnEventTypeID:
1592 {
1593 RespawnEventParams respawnParams;
1594 if (Class.CastTo(respawnParams, params))
1595 {
1596 OnRespawnEvent(respawnParams.param1);
1597 }
1598 break;
1599 }
1600 case PreloadEventTypeID:
1601 {
1602 PreloadEventParams preloadParams;
1603 if (Class.CastTo(preloadParams, params))
1604 {
1605 OnPreloadEvent(preloadParams.param1);
1606 }
1607 break;
1608 }
1609 case LogoutEventTypeID:
1610 {
1611 LogoutEventParams logoutParams;
1612 if (Class.CastTo(logoutParams, params))
1613 {
1614 GetCallQueue(CALL_CATEGORY_GUI).Call(GetMission().StartLogoutMenu, logoutParams.param1);
1615 }
1616 break;
1617 }
1619 {
1621 break;
1622 }
1624 {
1625 LoginStatusEventParams loginStatusParams;
1626 Class.CastTo(loginStatusParams, params);
1627
1628 string msg1 = loginStatusParams.param1;
1629 string msg2 = loginStatusParams.param2;
1630 string finalMsg;
1631
1632 // write either to login time screen or loading screen
1633 if (m_LoginTimeScreen)
1634 {
1635 finalMsg = msg1;
1636 // login time screen supports two lines
1637 if (msg2.Length() > 0)
1638 finalMsg += "\n" + msg2;
1639
1640 m_LoginTimeScreen.SetStatus(finalMsg);
1641 }
1642 else if (m_loading)
1643 {
1644 // loading only one line, but it's a long one
1645 finalMsg = msg1 + " " + msg2;
1646 m_loading.SetStatus(finalMsg);
1647 }
1648 break;
1649 }
1651 {
1652 g_Game.SetGameState(DayZGameState.CONNECTING);
1653 SetConnecting(true);
1654 break;
1655 }
1657 {
1658 g_Game.SetGameState(DayZGameState.MAIN_MENU);
1659 SetConnecting(false);
1660 if (m_ConnectFromJoin)
1661 {
1662 m_ConnectFromJoin = false;
1663 AbortMission();
1664 }
1665 break;
1666 }
1668 {
1669 DLCOwnerShipFailedParams dlcParams;
1670 if (Class.CastTo(dlcParams, params))
1671 {
1672 Print("### DLC Ownership failed !!! Map: " + dlcParams.param1);
1673 }
1674 break;
1675 }
1677 {
1678 ConnectivityStatsUpdatedEventParams connectivityStatsParams;
1679 if (Class.CastTo(connectivityStatsParams, params))
1680 {
1681 PlayerIdentity playerIdentity = connectivityStatsParams.param1;
1682
1683 int pingAvg = playerIdentity.GetPingAvg();
1684 if (pingAvg < GetWorld().GetPingWarningThreshold())
1685 {
1686 SetConnectivityStatState(EConnectivityStatType.PING, EConnectivityStatLevel.OFF);
1687 }
1688 else if (pingAvg < GetWorld().GetPingCriticalThreshold())
1689 {
1690 SetConnectivityStatState(EConnectivityStatType.PING, EConnectivityStatLevel.LEVEL1);
1691 }
1692 else
1693 {
1694 SetConnectivityStatState(EConnectivityStatType.PING, EConnectivityStatLevel.LEVEL2);
1695 }
1696 }
1697 break;
1698 }
1700 {
1701 ServerFpsStatsUpdatedEventParams serverFpsStatsParams;
1702 if (Class.CastTo(serverFpsStatsParams, params))
1703 {
1704 #ifdef DIAG_DEVELOPER
1705 m_ServerFpsStatsParams = serverFpsStatsParams;
1706 #endif
1707 float fps = serverFpsStatsParams.param1;
1708 if (fps > GetWorld().GetServerFpsWarningThreshold())
1709 {
1710 SetConnectivityStatState(EConnectivityStatType.SERVER_PERF, EConnectivityStatLevel.OFF);
1711 }
1712 else if (fps > GetWorld().GetServerFpsCriticalThreshold())
1713 {
1714 SetConnectivityStatState(EConnectivityStatType.SERVER_PERF, EConnectivityStatLevel.LEVEL1);
1715 }
1716 else
1717 {
1718 SetConnectivityStatState(EConnectivityStatType.SERVER_PERF, EConnectivityStatLevel.LEVEL2);
1719 }
1720 }
1721 break;
1722 }
1723 }
1724
1725 VONManager.GetInstance().OnEvent(eventTypeId, params);
1726
1727 Mission mission = GetMission();
1728 if (mission)
1729 {
1730 mission.OnEvent(eventTypeId, params);
1731 }
1732
1733 ErrorModuleHandler emh = ErrorModuleHandler.GetInstance();
1734 if (emh)
1735 emh.OnEvent(eventTypeId, params);
1736 }
1737
1738 void SetConnectivityStatState(EConnectivityStatType type, EConnectivityStatLevel level)
1739 {
1740 if (level != m_ConnectivityStatsStates[type])
1741 {
1742 if (OnConnectivityStatChange(type, level, m_ConnectivityStatsStates[type]))//before setting the prev. level to be the current level, we need to make sure we successfully set the icon
1743 {
1744 m_ConnectivityStatsStates[type] = level;
1745 }
1746 }
1747 }
1748
1749 protected bool OnConnectivityStatChange(EConnectivityStatType type, EConnectivityStatLevel newLevel, EConnectivityStatLevel oldLevel)
1750 {
1751 if (!GetGame() || !GetGame().GetMission())
1752 return false;
1753 Hud hud = GetGame().GetMission().GetHud();
1754 if (!hud)
1755 return false;
1756
1757 hud.SetConnectivityStatIcon(type, newLevel);
1758 return true;
1759 }
1760
1761 #ifdef DIAG_DEVELOPER
1762 private void DrawPerformanceStats(float pingAct, float pingAvg, float throttleInput, float throttleOutput)
1763 {
1764 DbgUI.Begin("Performance Stats", 720, 10);
1765 DbgUI.Text("pingAct:" + pingAct );
1766 int color = COLOR_WHITE;
1767 if ( pingAvg >= GetWorld().GetPingCriticalThreshold())
1768 color = COLOR_RED;
1769 else if ( pingAvg >= GetWorld().GetPingWarningThreshold())
1770 color = COLOR_YELLOW;
1771
1772 DbgUI.ColoredText(color, "pingAvg:" + pingAvg);
1773 DbgUI.Text("Ping Warning Threshold:" + GetWorld().GetPingWarningThreshold());
1774 DbgUI.Text("Ping Critical Threshold:" + GetWorld().GetPingCriticalThreshold());
1775 DbgUI.PlotLive("pingAvg history:", 300, 125, pingAvg, 100, 100 );
1776 DbgUI.Text("Server Fps Warning Threshold:" + GetWorld().GetServerFpsWarningThreshold());
1777 DbgUI.Text("Server Fps Critical Threshold:" + GetWorld().GetServerFpsCriticalThreshold());
1778 if (m_ServerFpsStatsParams)// SERVER FPS
1779 {
1780 color = COLOR_WHITE;
1781 if ( m_ServerFpsStatsParams.param1 <= GetWorld().GetServerFpsCriticalThreshold())
1782 color = COLOR_RED;
1783 else if ( m_ServerFpsStatsParams.param1 <= GetWorld().GetServerFpsWarningThreshold())
1784 color = COLOR_YELLOW;
1785
1786 DbgUI.ColoredText(color, "serverFPS:" + m_ServerFpsStatsParams.param1.ToString() );
1787 DbgUI.PlotLive("serverFPS history:", 300, 125, m_ServerFpsStatsParams.param1, 100, 100 );
1788
1789 color = COLOR_WHITE;
1790 DbgUI.ColoredText(COLOR_WHITE, "serverFrameTime:" + m_ServerFpsStatsParams.param2.ToString() );
1791 DbgUI.PlotLive("serverFrameTime history:", 300, 75, m_ServerFpsStatsParams.param2, 100, 100 );
1792
1793 color = COLOR_WHITE;
1794 if (m_ServerFpsStatsParams.param3 > 0)
1795 color = COLOR_RED;
1796
1797 DbgUI.ColoredText(color, "physStepsSkippedServer:" + m_ServerFpsStatsParams.param3.ToString() );
1798 DbgUI.PlotLive("physStepsSkippedServer history:", 300, 75, m_ServerFpsStatsParams.param3, 100, 100 );
1799
1800 color = COLOR_WHITE;
1801 if (m_ServerFpsStatsParams.param4 > 0)
1802 color = COLOR_RED;
1803 DbgUI.ColoredText(color, "physStepsSkippedClient:" + m_ServerFpsStatsParams.param4.ToString() );
1804 DbgUI.PlotLive("physStepsSkippedClient history:", 300, 75, m_ServerFpsStatsParams.param4, 100, 100 );
1805 }
1806
1807 DbgUI.Text("throttleInput:" + throttleInput);
1808 DbgUI.PlotLive("throttleInput history:", 300, 75, throttleInput, 100, 50 );
1809 DbgUI.Text("throttleOutput:" + throttleOutput);
1810 DbgUI.PlotLive("throttleOutput history:", 300, 75, throttleOutput, 100, 50 );
1811 DbgUI.End();
1812 }
1813 #endif
1814
1816 {
1817 m_Notifications.AddVoiceNotification(vonStartParams.param2, vonStartParams.param1);
1818 }
1819
1821 {
1822 m_Notifications.RemoveVoiceNotification(vonStopParams.param2);
1823 }
1824
1825 // ------------------------------------------------------------
1826 void UpdateLoginQueue(float timeslice)
1827 {
1828 int pos = GetUIManager().GetLoginQueuePosition();
1829
1831 if (!m_LoginQueue && pos > 0)
1832 {
1833 GetUIManager().CloseAll();
1834
1835 if (GetMission())
1836 {
1837 UIScriptedMenu parent = GetUIManager().GetMenu();
1838 EnterLoginQueue(parent);
1839 }
1840 else
1841 {
1842 m_LoginQueue = new LoginQueueStatic();
1843 GetUIManager().ShowScriptedMenu(m_LoginQueue, null);
1844 }
1845 }
1846 if (m_LoginQueue)
1847 {
1848 m_LoginQueue.SetPosition(pos);
1849
1851 LoginQueueStatic loginQueue;
1852 if (LoginQueueBase.CastTo(loginQueue, m_LoginQueue))
1853 {
1854 loginQueue.Update(timeslice);
1855 }
1856 }
1857 }
1858
1859 // ------------------------------------------------------------
1860 void OnLoginTimeEvent(int loginTime)
1861 {
1862#ifndef NO_GUI
1863 // remove login queue if exits
1864 CancelLoginQueue();
1865
1866 GetUserManager().GetUserDatabaseIdAsync();
1867
1868 m_LoginTime = loginTime;
1869
1870 // timer for login
1871 if (m_LoginTime > 0)
1872 {
1873 if (!m_LoginTimeScreen)
1874 {
1875 GetUIManager().CloseAll();
1876
1877 if (GetMission())
1878 {
1879 UIScriptedMenu parent = GetUIManager().GetMenu();
1880 EnterLoginTime(parent);
1881 }
1882 else
1883 {
1884 m_LoginTimeScreen = new LoginTimeStatic();
1885 GetUIManager().ShowScriptedMenu(m_LoginTimeScreen, null);
1886 }
1887 }
1888
1889 m_LoginTimeScreen.SetTime(m_LoginTime);
1890 m_LoginTimeScreen.Show();
1891
1892 GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.LoginTimeCountdown, 1000, true);
1893 }
1894#endif
1895 }
1896
1897 // ------------------------------------------------------------
1899 {
1900 if (m_LoginTime > 0)
1901 {
1902 if (m_LoginTimeScreen)
1903 m_LoginTimeScreen.SetTime(m_LoginTime);
1904
1905 m_LoginTime--;
1906 }
1907 else
1908 {
1909 // stop the call loop
1910 CancelLoginTimeCountdown();
1911 }
1912 }
1913
1914 // ------------------------------------------------------------
1915 void OnRespawnEvent(int time)
1916 {
1917 // use login time screen for respawn timer
1918 if (time >= 0)
1919 {
1920 m_LoginTime = time;
1921 if (!m_LoginTimeScreen)
1922 {
1923 GetUIManager().CloseAll();
1924
1925 UIScriptedMenu parent = GetUIManager().GetMenu();
1926 EnterLoginTime(parent);
1927 }
1928
1929 m_LoginTimeScreen.SetRespawn(true);
1930 m_LoginTimeScreen.SetTime(m_LoginTime);
1931 m_LoginTimeScreen.Show();
1932
1933 GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(this.LoginTimeCountdown, 1000, true);
1934 }
1935
1936 if (GetPlayer())
1937 GetPlayer().StopDeathDarkeningEffect();
1938
1939 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Start(new Param1<float>(1.0));
1940 }
1941
1942 // ------------------------------------------------------------
1944 {
1945 // cancel only login time (respawn time is parallel with preload, but login time is not)
1946 if (m_LoginTimeScreen && !m_LoginTimeScreen.IsRespawn())
1947 CancelLoginTimeCountdown();
1948
1949 // tell game to continue
1951 }
1952
1953 // ------------------------------------------------------------
1954 // Serialize and send default character information to server (must be called)
1956 {
1958
1959 //GetMenuData().RequestGetDefaultCharacterData();
1960 GetMenuDefaultCharacterData().SerializeCharacterData(ctx.GetWriteContext());
1961 StoreLoginData(ctx.GetWriteContext());
1962 }
1963
1964 // ------------------------------------------------------------
1966 {
1967 m_LoginQueue = LoginQueueBase.Cast(GetUIManager().EnterScriptedMenu(MENU_LOGIN_QUEUE, parent));
1968 }
1969
1970 // ------------------------------------------------------------
1972 {
1973 m_LoginTimeScreen = LoginTimeBase.Cast(GetUIManager().EnterScriptedMenu(MENU_LOGIN_TIME, parent));
1974 }
1975
1976 // ------------------------------------------------------------
1977 void OnMPConnectionLostEvent(int duration)
1978 {
1979 if (duration >= 0)//(-1 means conn. reestablished)
1980 SetConnectivityStatState(EConnectivityStatType.CONN_LOST, EConnectivityStatLevel.LEVEL1);
1981 else
1982 SetConnectivityStatState(EConnectivityStatType.CONN_LOST, EConnectivityStatLevel.OFF);
1983
1984 #ifdef PLATFORM_PS4
1985 //PSN Set multiplay state
1986 if (duration < 0 && GetGameState() == DayZGameState.IN_GAME)
1987 {
1989 }
1990 else
1991 {
1993 }
1994 #endif
1995 }
1996
1997 // ------------------------------------------------------------
1998 void LoadProgressUpdate(int progressState, float progress, string title)
1999 {
2000 #ifndef NO_GUI
2001 switch (progressState)
2002 {
2003 case PROGRESS_START:
2004 {
2005 #ifndef NO_GUI
2006 // get out of the black screen immediately
2007 GetUIManager().ScreenFadeOut(0);
2008 #endif
2009 m_loading.Inc();
2010 m_loading.SetTitle(title);
2011 if (m_loading.m_HintPanel)
2012 m_loading.m_HintPanel.ShowRandomPage();
2013
2014 }
2015 break;
2016
2017 case PROGRESS_FINISH:
2018 {
2019 m_loading.Dec();
2020 }
2021 break;
2022
2023 case PROGRESS_PROGRESS:
2024 {
2025 m_loading.SetProgress(progress);
2026
2027 }
2028 break;
2029
2030 case PROGRESS_UPDATE:
2031 {
2032 m_loading.SetProgress(0);
2033 }
2034 break;
2035 }
2036 #endif
2037 }
2038
2039 // ------------------------------------------------------------
2040 override void OnAfterCreate()
2041 {
2042 Math.Randomize(-1);
2043 }
2044
2045 // ------------------------------------------------------------
2046 override void OnActivateMessage()
2047 {
2049 }
2050
2051 // ------------------------------------------------------------
2052 override void OnDeactivateMessage()
2053 {
2055 }
2056
2057 // ------------------------------------------------------------
2058 override bool OnInitialize()
2059 {
2060 ParticleList.PreloadParticles();
2061
2062 RegisterProfilesOptions();
2064
2066 m_Visited = new TStringArray;
2067 GetProfileStringList("SB_Visited", m_Visited);
2068
2069 if (GetLoadState() == DayZLoadState.UNDEFINED)
2070 {
2071 string param;
2072
2073 if (GetCLIParam("join", param))
2074 {
2075 JoinLaunch();
2076 #ifndef PLATFORM_PS4
2078 #endif
2079 }
2080 else if (GetCLIParam("connect", param))
2081 {
2082 ConnectLaunch();
2083 }
2084 else if (GetCLIParam("autotest", param))
2085 {
2086 AutoTestLaunch(param);
2087 }
2088 else if (GetCLIParam("mission", param))
2089 {
2090 MissionLaunch();
2091 }
2092 else if (GetCLIParam("party", param))
2093 {
2094 PartyLaunch();
2095 }
2096 else
2097 {
2099 }
2100
2101 return true;
2102 }
2103
2104 return false;
2105 }
2106
2108 {
2110 m_Notifications = new NotificationUI();
2111 }
2112
2113 protected ref Widget m_IntroMenu;
2114 protected ref Widget m_GamepadDisconnectMenu; //DEPRECATED
2115 protected int m_PrevBlur;
2116
2117 protected string m_DatabaseID;
2118
2119 protected string m_ConnectAddress;
2120 protected int m_ConnectPort;
2122 protected string m_ConnectPassword;
2123
2124 protected const int MAX_VISITED = 50;
2126
2128 {
2129 return m_DatabaseID;
2130 }
2131
2132 void SetDatabaseID(string id)
2133 {
2134 m_DatabaseID = id;
2135 if (GetUIManager().GetMenu())
2136 {
2137 GetUIManager().GetMenu().Refresh();
2138 }
2139 }
2140
2142 {
2144 m_IntroMenu = GetWorkspace().CreateWidgets("gui/layouts/xbox/day_z_title_screen.layout");
2145 RichTextWidget text_widget = RichTextWidget.Cast(m_IntroMenu.FindAnyWidget("InputPromptText"));
2146 m_IntroMenu.FindAnyWidget("notification_root").Show(false);
2147 if (text_widget)
2148 {
2149 string text = Widget.TranslateString("#console_start_game");
2150 #ifdef PLATFORM_XBOX
2151 BiosUserManager user_manager = GetGame().GetUserManager();
2152 if (user_manager && user_manager.GetSelectedUser())
2153 text_widget.SetText(string.Format(text, "<image set=\"xbox_buttons\" name=\"A\" />"));
2154 else
2155 text_widget.SetText(string.Format(text, "<image set=\"xbox_buttons\" name=\"A\" />"));
2156 #endif
2157
2158 #ifdef PLATFORM_PS4
2159 string confirm = "cross";
2160 if (GetGame().GetInput().GetEnterButton() == GamepadButton.A)
2161 {
2162 confirm = "cross";
2163 }
2164 else
2165 {
2166 confirm = "circle";
2167 }
2168 text_widget.SetText(string.Format(text, "<image set=\"playstation_buttons\" name=\"" + confirm + "\" />"));
2169 #endif
2170 }
2171
2172 #ifdef PLATFORM_CONSOLE
2173 #ifdef PLATFORM_XBOX
2174 #ifdef BUILD_EXPERIMENTAL
2175 m_IntroMenu.FindAnyWidget("notification_root").Show(true);
2176 #endif
2177 #endif
2178 #endif
2179 }
2180
2182 {
2183 if (m_IntroMenu)
2184 {
2185 delete m_IntroMenu;
2186 }
2187 }
2188
2190 {
2191 return m_ShouldShowControllerDisconnect;
2192 }
2193
2195 {
2196 #ifdef PLATFORM_CONSOLE
2197 if (!GetUIManager().IsMenuOpen(MENU_WARNING_INPUTDEVICE_DISCONNECT))
2198 {
2199 m_ShouldShowControllerDisconnect = !GetInput().AreAllAllowedInputDevicesActive();
2200 if (m_ShouldShowControllerDisconnect)
2201 {
2202 GetCallQueue(CALL_CATEGORY_GUI).Call(GetUIManager().EnterScriptedMenu,MENU_WARNING_INPUTDEVICE_DISCONNECT,GetUIManager().GetMenu());
2203 }
2204 }
2205 #endif
2206 }
2207
2209 {
2210 SetGameState(DayZGameState.JOIN);
2211 SetLoadState(DayZLoadState.JOIN_START);
2212
2213 #ifdef PLATFORM_CONSOLE
2214 string join_param;
2215 if (GetCLIParam("join", join_param))
2216 {
2217 BiosUserManager user_manager = GetUserManager();
2218 user_manager.ParseJoinAsync(join_param);
2219 }
2220 #endif
2221 }
2222
2224 {
2225 BiosUserManager user_manager = GetUserManager();
2226 if (user_manager.GetTitleInitiator())
2227 {
2228 user_manager.SelectUserEx(user_manager.GetTitleInitiator());
2229 }
2230
2231 SetGameState(DayZGameState.CONNECT);
2232 SetLoadState(DayZLoadState.CONNECT_START);
2233
2234 #ifndef PLATFORM_WINDOWS
2235 #ifdef PLATFORM_CONSOLE
2237 GamepadCheck();
2238 #endif
2239 #else
2241 #endif
2242 }
2243
2245 {
2246 SetGameState(DayZGameState.PARTY);
2247 SetLoadState(DayZLoadState.PARTY_START);
2248 BiosUserManager user_manager = GetGame().GetUserManager();
2249
2250 string param;
2251 if (GetCLIParam("party", param))
2252 {
2253 user_manager.ParsePartyAsync(param);
2254 StartRandomCutscene(GetMainMenuWorld());
2255 }
2256 }
2257
2259 {
2260#ifdef PLATFORM_WINDOWS
2261 BiosUserManager user_manager = GetUserManager();
2262 if (user_manager)
2263 {
2264 if (user_manager.GetTitleInitiator())
2265 {
2266 user_manager.SelectUserEx(user_manager.GetTitleInitiator());
2267 }
2268 }
2269#endif
2270
2271 SetGameState(DayZGameState.MAIN_MENU);
2272 SetLoadState(DayZLoadState.MAIN_MENU_START);
2273 StartRandomCutscene(GetMainMenuWorld());
2275 }
2276
2278 {
2279 BiosUserManager user_manager = GetUserManager();
2280 if (user_manager)
2281 {
2282 if (user_manager.GetTitleInitiator())
2283 {
2284 user_manager.SelectUserEx(user_manager.GetTitleInitiator());
2285 }
2286 }
2287
2288 SetGameState(DayZGameState.IN_GAME);
2289 SetLoadState(DayZLoadState.MISSION_START);
2290
2291 #ifndef PLATFORM_WINDOWS
2292 #ifdef PLATFORM_CONSOLE
2293 #ifndef DEVELOPER
2295 GamepadCheck();
2296 return;
2297 #endif
2298 #endif
2299 #endif
2300
2301 string mission;
2302 GetCLIParam("mission", mission);
2303 PlayMission(mission);
2304 }
2305
2306 void AutoTestLaunch(string param)
2307 {
2308 if (!AutotestConfigHandler.LoadData(param))
2309 AutoTestFixture.LogRPT("Failed to load autotest configuration, continue with mission load.");
2310 else
2311 m_AutotestEnabled = true;
2312
2313 string mission;
2314 GetCLIParam("mission", mission);
2315 if (!mission)
2316 {
2317 AutoTestFixture.LogRPT("Parameter 'mission' is not set on CLI.");
2318 RequestExit(IDC_MAIN_QUIT);
2319 }
2320
2321 PlayMission(mission);
2322 }
2323
2324 void SelectUser(int gamepad = -1)
2325 {
2326 BiosUserManager user_manager = GetUserManager();
2327 if (user_manager)
2328 {
2329 BiosUser selected_user;
2330 if (gamepad > -1)
2331 {
2332 GetInput().GetGamepadUser(gamepad, selected_user);
2333 #ifdef PLATFORM_PS4
2334 if (selected_user)
2335 #endif
2336 {
2337 if (user_manager.SelectUserEx(selected_user))
2338 {
2339 GetGame().GetInput().IdentifyGamepad(GamepadButton.BUTTON_NONE);
2340 GetInput().SelectActiveGamepad(gamepad);
2341 }
2342 else
2343 {
2344 selected_user = user_manager.GetSelectedUser();
2345 }
2346
2347 #ifdef PLATFORM_PS4
2348 if (!selected_user.IsOnline())
2349 {
2350 user_manager.LogOnUserAsync(selected_user);
2351 return;
2352 }
2353 #endif
2354 }
2355 #ifdef PLATFORM_PS4
2356 else
2357 {
2358 GetInput().ResetActiveGamepad();
2359 GamepadCheck();
2360 }
2361 #endif
2362 }
2363
2364 if (!selected_user)
2365 selected_user = user_manager.GetSelectedUser();
2366
2367 if (!selected_user)
2368 {
2369 user_manager.PickUserAsync();
2370 return;
2371 }
2372
2373 user_manager.SelectUserEx(selected_user);
2374
2375 switch (GetLoadState())
2376 {
2377 case DayZLoadState.JOIN_START:
2378 {
2379 SetLoadState(DayZLoadState.JOIN_USER_SELECT);
2380 break;
2381 }
2382 case DayZLoadState.PARTY_START:
2383 {
2384 SetLoadState(DayZLoadState.PARTY_USER_SELECT);
2385 break;
2386 }
2387 case DayZLoadState.MAIN_MENU_START:
2388 {
2389 SetLoadState(DayZLoadState.MAIN_MENU_USER_SELECT);
2390 break;
2391 }
2392 case DayZLoadState.CONNECT_START:
2393 {
2394 SetLoadState(DayZLoadState.CONNECT_USER_SELECT);
2395 break;
2396 }
2397 case DayZLoadState.MISSION_START:
2398 {
2399 SetLoadState(DayZLoadState.MISSION_USER_SELECT);
2400 break;
2401 }
2402 default:
2403 break;
2404 }
2405
2406 SelectGamepad();
2407 g_Game.SetHudBrightness(g_Game.GetHUDBrightnessSetting());
2408 }
2409 }
2410
2411 void SetPreviousGamepad(int gamepad)
2412 {
2413 m_PreviousGamepad = gamepad;
2414 }
2415
2417 {
2418 return m_PreviousGamepad;
2419 }
2420
2422 {
2423#ifndef AUTOTEST
2424 if (GetInput().IsActiveGamepadSelected())
2425 {
2426#endif
2428 SelectUser();
2429#ifndef AUTOTEST
2430 }
2431 else
2432 {
2433 #ifdef PLATFORM_CONSOLE
2434 #ifndef PLATFORM_WINDOWS
2435 #ifdef PLATFORM_PS4
2436 if (GetUserManager().GetSelectedUser())
2437 {
2438 int gamepad = GetInput().GetUserGamepad(GetUserManager().GetSelectedUser());
2439 if (gamepad > -1)
2440 {
2441 SelectUser(gamepad);
2442 }
2443 else
2444 {
2445 if (!m_IntroMenu && !(GetGame().GetUIManager().GetMenu() && GetGame().GetUIManager().GetMenu().GetID() == MENU_TITLE_SCREEN))
2447 GetGame().GetInput().IdentifyGamepad(GetGame().GetInput().GetEnterButton());
2448 }
2449 }
2450 else
2451 #endif
2452 {
2453 if (!m_IntroMenu && !(GetUIManager().GetMenu() && GetUIManager().GetMenu().GetID() == MENU_TITLE_SCREEN))
2455 GetInput().IdentifyGamepad(GetInput().GetEnterButton());
2456 }
2457 #endif
2458 #endif
2459 }
2460#endif
2461 }
2462
2464 {
2465 ResetProfileOptions();
2466 BiosUserManager user_manager = GetUserManager();
2467
2468 if (user_manager)
2469 {
2470 BiosUser selected_user = user_manager.GetSelectedUser();
2471 if (selected_user)
2472 {
2473 OnlineServices.SetBiosUser(selected_user);
2474 SetPlayerName(selected_user.GetName());
2476 #ifdef PLATFORM_CONSOLE
2477 SetPlayerGameName(selected_user.GetName());
2478 user_manager.GetUserDatabaseIdAsync();
2479 #endif
2480 }
2481
2482 if (GetUIManager().GetMenu())
2483 {
2484 GetUIManager().GetMenu().Refresh();
2485 }
2486 }
2487
2488 switch (GetLoadState())
2489 {
2490 case DayZLoadState.JOIN_USER_SELECT:
2491 {
2492 SetLoadState(DayZLoadState.JOIN_CONTROLLER_SELECT);
2494 break;
2495 }
2496 case DayZLoadState.PARTY_USER_SELECT:
2497 {
2498 SetLoadState(DayZLoadState.PARTY_CONTROLLER_SELECT);
2500 GetUIManager().EnterScriptedMenu(MENU_SERVER_BROWSER, GetUIManager().GetMenu());
2501 break;
2502 }
2503 case DayZLoadState.CONNECT_USER_SELECT:
2504 {
2505 SetLoadState(DayZLoadState.CONNECT_CONTROLLER_SELECT);
2507 break;
2508 }
2509 case DayZLoadState.MAIN_MENU_USER_SELECT:
2510 {
2511 SetLoadState(DayZLoadState.MAIN_MENU_CONTROLLER_SELECT);
2513 GetUIManager().EnterScriptedMenu(MENU_MAIN, GetUIManager().GetMenu());
2514 break;
2515 }
2516 case DayZLoadState.MISSION_USER_SELECT:
2517 {
2518 SetLoadState(DayZLoadState.MISSION_CONTROLLER_SELECT);
2520 string mission;
2521 GetCLIParam("mission", mission);
2522 PlayMission(mission);
2523 break;
2524 }
2525 }
2526 }
2527
2529 {
2530 if (GetLoadState() == DayZLoadState.JOIN_CONTROLLER_SELECT)
2531 {
2532 SetGameState(DayZGameState.CONNECTING);
2534 }
2535 else
2536 {
2537 if (GetGameState() != DayZGameState.CONNECTING)
2538 {
2539 switch (GetLoadState())
2540 {
2541 case DayZLoadState.CONNECT_CONTROLLER_SELECT:
2542 {
2543 SetGameState(DayZGameState.CONNECTING);
2545 break;
2546 }
2547 case DayZLoadState.PARTY_CONTROLLER_SELECT:
2548 {
2549 SetGameState(DayZGameState.CONNECTING);
2550 Connect();
2551 break;
2552 }
2553 case DayZLoadState.MAIN_MENU_CONTROLLER_SELECT:
2554 {
2555 SetGameState(DayZGameState.CONNECTING);
2556 Connect();
2557 break;
2558 }
2559 }
2560 }
2561 else
2562 {
2563 string address;
2564 int port;
2565 if (GetHostAddress(address, port))
2566 {
2567 if (m_ConnectAddress == address && m_ConnectPort == port)
2568 ErrorModuleHandler.ThrowError(ErrorCategory.ConnectErrorScript, EConnectErrorScript.ALREADY_CONNECTING_THIS);
2569 else
2570 ErrorModuleHandler.ThrowError(ErrorCategory.ConnectErrorScript, EConnectErrorScript.ALREADY_CONNECTING, string.Format("%1:%2", address, port));
2571 }
2572 else
2573 {
2574 DisconnectSessionForce();
2576 TryConnect();
2577 }
2578 }
2579 }
2580 }
2581
2582 bool GetLastVisitedServer(out string ip, out int port)
2583 {
2584 if (m_Visited)
2585 {
2586 if (m_Visited.Count() > 0)
2587 {
2588 string uid = m_Visited.Get(m_Visited.Count() - 1);
2589 TStringArray output = new TStringArray;
2590 uid.Split(":", output);
2591 ip = output[0];
2592 port = output[1].ToInt();
2593 return true;
2594 }
2595 }
2596 return false;
2597 }
2598
2599 void AddVisitedServer(string ip, int port)
2600 {
2601 string uid = ip + ":" + port;
2602 if (m_Visited)
2603 {
2604 int pos = m_Visited.Find(uid);
2605
2606 if (pos < 0)
2607 {
2608 if (m_Visited.Count() == MAX_VISITED)
2609 m_Visited.Remove(0);
2610 m_Visited.Insert(uid);
2611 }
2612 else
2613 {
2614 // if item is not saved as last server, move it
2615 if (pos != (m_Visited.Count() - 1))
2616 {
2617 m_Visited.Remove(pos);
2618 m_Visited.Insert(uid);
2619 }
2620 }
2621 SetProfileStringList("SB_Visited", m_Visited);
2622 SaveProfile();
2623 }
2624 }
2625
2626 bool IsVisited(string ip, int port)
2627 {
2628 string uid = ip + ":" + port;
2629 int index = m_Visited.Find(uid);
2630 return (index >= 0);
2631 }
2632
2634 {
2635 string addr;
2636 int port;
2637 if (GetHostAddress(addr, port))
2638 {
2639 m_ConnectAddress = addr;
2640 m_ConnectPort = port;
2641 }
2642 OnlineServices.GetCurrentServerInfo(m_ConnectAddress, m_ConnectPort);
2643 }
2644
2645 void Connect()
2646 {
2647 SetConnecting(true);
2648
2650 string addr;
2651 int port;
2652 if (GetHostAddress(addr, port))
2653 {
2654 if (m_ConnectAddress == addr && m_ConnectPort == port)
2655 return;
2656 }
2657
2658 string connectAddress = m_ConnectAddress;
2659
2660 if (m_ConnectSteamQueryPort)
2661 connectAddress = string.Format("%1:%2:%3", m_ConnectAddress, m_ConnectPort, m_ConnectSteamQueryPort);
2662
2663 if (Connect(GetUIManager().GetMenu(), connectAddress, m_ConnectPort, m_ConnectPassword) != 0)
2665 }
2666
2667 void DisconnectSessionScript(bool displayJoinError = false)
2668 {
2669 DisconnectSessionFlags flags = DisconnectSessionFlags.SELECT_USER | DisconnectSessionFlags.IGNORE_WHEN_IN_GAME;
2670 if (displayJoinError)
2671 {
2672 flags |= DisconnectSessionFlags.JOIN_ERROR_ENABLED;
2673 flags |= DisconnectSessionFlags.JOIN_ERROR_CHECK;
2674 }
2675
2676 DisconnectSessionEx(flags);
2677 }
2678
2680 {
2681 if (flags & DisconnectSessionFlags.SELECT_USER && OnlineServices.GetBiosUser())
2682 {
2684 }
2685
2686 if (flags & DisconnectSessionFlags.JOIN_ERROR_ENABLED)
2687 {
2688 if (!(flags & DisconnectSessionFlags.JOIN_ERROR_CHECK) || GetGameState() == DayZGameState.JOIN)
2689 {
2690 NotificationSystem.AddNotification(NotificationType.JOIN_FAIL_GET_SESSION, NotificationSystem.DEFAULT_TIME_DISPLAYED);
2691 }
2692 }
2693
2694 if (flags & DisconnectSessionFlags.IGNORE_WHEN_IN_GAME && GetGameState() == DayZGameState.IN_GAME)
2695 {
2696 return;
2697 }
2698
2699 if (flags & DisconnectSessionFlags.CLOSE_MENUS && GetGame().GetUIManager())
2700 {
2701 GetGame().GetUIManager().CloseAllSubmenus();
2702
2703 if ( GetGame().GetUIManager().IsDialogVisible() )
2704 {
2705 GetGame().GetUIManager().CloseDialog();
2706 }
2707 }
2708
2709 if (flags & DisconnectSessionFlags.ALWAYS_FORCE)
2710 {
2711 DisconnectSessionForce();
2712 }
2713
2714 if (GetGame().GetMission())
2715 {
2716 if (g_Game.GetGameState() != DayZGameState.MAIN_MENU)
2717 {
2718 if (flags & DisconnectSessionFlags.DISCONNECT_ERROR_ENABLED)
2719 {
2720 NotificationSystem.AddNotification(NotificationType.DISCONNECTED, NotificationSystem.DEFAULT_TIME_DISPLAYED);
2721 }
2722
2723 GetGame().GetMission().AbortMission();
2724
2725 SetGameState(DayZGameState.MAIN_MENU);
2726 SetLoadState(DayZLoadState.MAIN_MENU_CONTROLLER_SELECT);
2727
2728 GamepadCheck();
2729 }
2730 }
2731
2732 else
2733 {
2735 }
2736 }
2737
2738 void ConnectFromServerBrowser(string ip, int port, string password = "")
2739 {
2740 m_ConnectAddress = ip;
2741 m_ConnectPort = port;
2742 m_ConnectPassword = password;
2743 m_ConnectFromJoin = false;
2745 }
2746
2747 void ConnectFromServerBrowserEx(string ip, int port, int steamQueryPort, string password = "")
2748 {
2749 m_ConnectSteamQueryPort = steamQueryPort;
2750 ConnectFromServerBrowser(ip, port, password);
2751 }
2752
2753 void ConnectFromJoin(string ip, int port)
2754 {
2755 m_ConnectAddress = ip;
2756 m_ConnectPort = port;
2757 m_ConnectFromJoin = true;
2758 Connect();
2759 }
2760
2762 {
2763 string port;
2764 if (GetCLIParam("connect", m_ConnectAddress))
2765 {
2766 GetCLIParam("port", port);
2767 m_ConnectPort = port.ToInt();
2768
2769 GetCLIParam("password", m_ConnectPassword);
2770
2771 m_ConnectFromJoin = false;
2772 Connect();
2773 }
2774 }
2775
2777 {
2778 return m_IsCtrlHolding;
2779 }
2780
2781 // ------------------------------------------------------------
2782 override void OnKeyPress(int key)
2783 {
2784
2785 if (key == KeyCode.KC_LCONTROL)
2786 {
2787 m_IsCtrlHolding = true;
2788 }
2789
2790 if (key == KeyCode.KC_LMENU)
2791 {
2792 m_IsLeftAltHolding = true;
2793 }
2794
2795 if (key == KeyCode.KC_RMENU)
2796 {
2797 m_IsRightAltHolding = true;
2798 }
2799
2800 if (m_keyboard_handler)
2801 {
2802 m_keyboard_handler.OnKeyDown(NULL, 0, 0, key);
2803 }
2804
2805 Mission mission = GetMission();
2806 if (mission)
2807 {
2808 mission.OnKeyPress(key);
2809 }
2810
2811#ifdef DEVELOPER
2812 if ((m_IsLeftAltHolding || m_IsLeftAltHolding) && key == KeyCode.KC_F4)
2813 {
2814 RequestExit(0);
2815 }
2816#endif
2817
2818 }
2819
2820 // ------------------------------------------------------------
2821 override void OnKeyRelease(int key)
2822 {
2823 if (key == KeyCode.KC_LCONTROL)
2824 {
2825 m_IsCtrlHolding = false;
2826 }
2827
2828 if (key == KeyCode.KC_LWIN)
2829 {
2830 m_IsWinHolding = false;
2831 }
2832
2833 if (key == KeyCode.KC_LMENU || key == KeyCode.KC_RMENU)
2834 {
2835 m_IsLeftAltHolding = false;
2836 }
2837
2838 if (key == KeyCode.KC_RMENU)
2839 {
2840 m_IsRightAltHolding = false;
2841 }
2842
2843 if (m_keyboard_handler)
2844 {
2845 m_keyboard_handler.OnKeyUp(NULL, 0, 0, key);
2846 }
2847
2848 Mission mission = GetMission();
2849 if (mission)
2850 {
2851 mission.OnKeyRelease(key);
2852 }
2853 }
2854
2855 // ------------------------------------------------------------
2856 override void OnMouseButtonPress(int button)
2857 {
2858 Mission mission = GetMission();
2859 if (mission)
2860 {
2861 mission.OnMouseButtonPress(button);
2862 }
2863 }
2864
2865 // ------------------------------------------------------------
2866 override void OnMouseButtonRelease(int button)
2867 {
2868 Mission mission = GetMission();
2869 if (mission)
2870 {
2871 mission.OnMouseButtonRelease(button);
2872 }
2873 }
2874
2875 // ------------------------------------------------------------
2876 override void OnDeviceReset()
2877 {
2878 m_IsCtrlHolding = false;
2879 m_IsWinHolding = false;
2880 m_IsLeftAltHolding = false;
2881 m_IsRightAltHolding = false;
2882 }
2883
2884 // ------------------------------------------------------------
2886 {
2887 return m_DeltaTime;
2888 }
2889
2890 // ------------------------------------------------------------
2891 override void OnUpdate(bool doSim, float timeslice)
2892 {
2893 m_DeltaTime = timeslice;
2894
2895 Mission mission = GetMission();
2896 bool gameIsRunning = false;
2897
2898 if (doSim && mission && !mission.IsPaused())
2899 {
2900 gameIsRunning = true;
2901 }
2902
2903 if (doSim && mission)
2904 {
2905 mission.OnUpdate(timeslice);
2906
2907 // update local weather effects
2908 if ( IsClient() || !IsMultiplayer() )
2909 {
2910 WorldData worldData = mission.GetWorldData();
2911 if ( worldData )
2912 worldData.UpdateWeatherEffects( GetWeather(), timeslice );
2913 }
2914 }
2915
2916 SEffectManager.OnUpdate(timeslice);
2917
2918 // queues and timers update
2919 GetCallQueue(CALL_CATEGORY_SYSTEM).Tick(timeslice);
2920 GetUpdateQueue(CALL_CATEGORY_SYSTEM).Invoke(timeslice);
2921 GetTimerQueue(CALL_CATEGORY_SYSTEM).Tick(timeslice);
2922
2923 #ifndef NO_GUI
2924 if (m_IsConnecting)
2925 UpdateLoginQueue(timeslice);
2926
2927 if (m_loading && m_loading.IsLoading())
2928 {
2929 m_loading.OnUpdate(timeslice);
2930 }
2931 else if (m_LoginTimeScreen && m_LoginTimeScreen.IsStatic())
2932 {
2933 m_LoginTimeScreen.Update(timeslice);
2934 }
2935 else
2936 {
2937 GetCallQueue(CALL_CATEGORY_GUI).Tick(timeslice);
2938 GetUpdateQueue(CALL_CATEGORY_GUI).Invoke(timeslice);
2939 GetTimerQueue(CALL_CATEGORY_GUI).Tick(timeslice);
2940 GetDragQueue().Tick();
2941 }
2942
2943 NotificationSystem.Update(timeslice);
2944 if (m_Notifications)
2945 {
2946 m_Notifications.Update(timeslice);
2947 }
2948
2949 #ifndef SERVER
2950 #ifdef DIAG_DEVELOPER
2951 if (GetGame().IsMultiplayer() && GetPlayer() && DiagMenu.GetBool(DiagMenuIDs.MISC_CONNECTION_STATS))
2952 {
2953 PlayerIdentity playerIdentity = GetPlayer().GetIdentity();
2954
2955 if (playerIdentity)
2956 {
2957 int pingAct = playerIdentity.GetPingAct();
2958 int pingAvg = playerIdentity.GetPingAvg();
2959
2960 float throttleInput = playerIdentity.GetInputThrottle();
2961 float throttleOutput = playerIdentity.GetOutputThrottle();
2962
2963 DrawPerformanceStats(pingAct, pingAvg, throttleInput, throttleOutput);
2964 }
2965 }
2966 #endif
2967 #endif
2968
2969 #endif
2970
2971 if (gameIsRunning)
2972 {
2973 GetCallQueue(CALL_CATEGORY_GAMEPLAY).Tick(timeslice);
2974 GetUpdateQueue(CALL_CATEGORY_GAMEPLAY).Invoke(timeslice);
2975 GetTimerQueue(CALL_CATEGORY_GAMEPLAY).Tick(timeslice);
2976 }
2977 }
2978
2979 // ------------------------------------------------------------
2980 override void OnPostUpdate(bool doSim, float timeslice)
2981 {
2982 Mission mission = GetMission();
2983 bool gameIsRunning = false;
2984
2985 if (doSim && mission && !mission.IsPaused())
2986 {
2987 gameIsRunning = true;
2988 }
2989
2990 GetPostUpdateQueue(CALL_CATEGORY_SYSTEM).Invoke(timeslice);
2991
2992 #ifndef NO_GUI
2993 if (m_loading && m_loading.IsLoading())
2994 {
2995 }
2996 else if (m_LoginTimeScreen && m_LoginTimeScreen.IsStatic())
2997 {
2998 }
2999 else
3000 {
3001 GetPostUpdateQueue(CALL_CATEGORY_GUI).Invoke(timeslice);
3002 }
3003 #endif
3004
3005 if (gameIsRunning)
3006 {
3007 GetPostUpdateQueue(CALL_CATEGORY_GAMEPLAY).Invoke(timeslice);
3008 }
3009 }
3010
3011 // ------------------------------------------------------------
3012 override void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
3013 {
3014 super.OnRPC(sender, target, rpc_type, ctx);
3015 Event_OnRPC.Invoke(sender, target, rpc_type, ctx);
3016
3017 //Print("["+ GetGame().GetTime().ToString() +"] => DayZGame::OnRPC = "+ EnumTools.EnumToString(ERPCs,rpc_type));
3018
3019 if (target)
3020 {
3021 // call rpc on target
3022 target.OnRPC(sender, rpc_type, ctx);
3023 }
3024 else
3025 {
3026 switch (rpc_type)
3027 {
3028 #ifndef SERVER
3029 #ifndef NO_GUI
3030 case ERPCs.RPC_CFG_GAMEPLAY_SYNC:
3031 {
3032 CfgGameplayHandler.OnRPC(null, ctx);
3033 break;
3034 }
3035 case ERPCs.RPC_UNDERGROUND_SYNC:
3036 {
3037 UndergroundAreaLoader.OnRPC(ctx);
3038 break;
3039 }
3040 case ERPCs.RPC_PLAYERRESTRICTEDAREAS_SYNC:
3041 {
3043 break;
3044 }
3045 case ERPCs.RPC_SEND_NOTIFICATION:
3046 {
3047 NotificationType type;
3048 float show_time;
3049 string detail_text;
3050
3051 ctx.Read(type);
3052 ctx.Read(show_time);
3053 ctx.Read(detail_text);
3054
3055 NotificationSystem.AddNotification(type, show_time, detail_text);
3056 break;
3057 }
3058 case ERPCs.RPC_SEND_NOTIFICATION_EXTENDED:
3059 {
3060 float show_time_ext;
3061 string title_text_ext;
3062 string detail_text_ext;
3063 string icon_ext;
3064
3065 ctx.Read(show_time_ext);
3066 ctx.Read(title_text_ext);
3067 ctx.Read(detail_text_ext);
3068 ctx.Read(icon_ext);
3069
3070 NotificationSystem.AddNotificationExtended(show_time_ext, title_text_ext, detail_text_ext, icon_ext);
3071 break;
3072 }
3073
3074
3075 case ERPCs.RPC_SOUND_HELICRASH:
3076 {
3077 bool playSound;
3078 vector pos;
3079 string sound_set;
3080
3081 //Helicrash is a world event, we want anyone to be able to hear it
3082 Param3<bool, vector, int> playCrashSound = new Param3<bool, vector, int>(false, "0 0 0",0);
3083 if (ctx.Read(playCrashSound))
3084 {
3085 playSound = playCrashSound.param1;
3086 pos = playCrashSound.param2;
3087 sound_set = CrashSoundSets.GetSoundSetByHash(playCrashSound.param3);
3088 }
3089
3090 if (playSound)
3091 {
3092 m_CrashSound = SEffectManager.PlaySound(sound_set, pos, 0.1, 0.1);
3093 m_CrashSound.SetAutodestroy(true);
3094 }
3095
3096 break;
3097 }
3098 //Random off map artillery barrage
3099 case ERPCs.RPC_SOUND_ARTILLERY:
3100 {
3101 vector position;
3102 Param1<vector> playArtySound = new Param1<vector>(vector.Zero);
3103 if (ctx.Read(playArtySound))
3104 {
3105 position = playArtySound.param1;
3106 if (position == vector.Zero)
3107 break;
3108 }
3109 else
3110 break;
3111
3112 if (!GetGame().GetPlayer())
3113 break;
3114
3115 if (vector.DistanceSq(GetGame().GetPlayer().GetPosition(), position) <= (MIN_ARTY_SOUND_RANGE * MIN_ARTY_SOUND_RANGE))
3116 break;
3117
3118 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_Barrage_SoundSet", position, 0.1, 0.1);
3119 m_ArtySound.SetAutodestroy(true);
3120
3121 break;
3122 }
3123 case ERPCs.RPC_SOUND_CONTAMINATION:
3124 {
3125 vector soundPos;
3126
3127 Param1<vector> playContaminatedSound = new Param1<vector>(vector.Zero);
3128 if (ctx.Read(playContaminatedSound))
3129 {
3130 soundPos = playContaminatedSound.param1;
3131 if (soundPos == vector.Zero)
3132 break;
3133 }
3134 else
3135 break;
3136
3137 if (!GetGame().GetPlayer())
3138 break;
3139
3140 EffectSound closeArtySound = SEffectManager.PlaySound("Artillery_Close_SoundSet", soundPos);
3141 closeArtySound.SetAutodestroy(true);
3142
3143 // We add camera shake upon shell detonation
3144 float distance_to_player = vector.DistanceSq(soundPos, GetGame().GetPlayer().GetPosition());
3145 if (distance_to_player <= GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE2)
3146 {
3147 float strength_factor = Math.InverseLerp(GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE, 0, Math.Sqrt(distance_to_player));
3148 DayZPlayerCamera camera = GetGame().GetPlayer().GetCurrentCamera();
3149 if (camera)
3150 camera.SpawnCameraShake(strength_factor * 4);
3151 }
3152
3153 ParticleManager.GetInstance().PlayInWorld(ParticleList.CONTAMINATED_AREA_GAS_SHELL, soundPos);
3154 break;
3155 }
3156 // Single artillery shot to announce dynamic contaminated area
3157 case ERPCs.RPC_SOUND_ARTILLERY_SINGLE:
3158 {
3159 vector soundPosition;
3160 vector delayedSoundPos;
3161 float soundDelay;
3162
3163 Param3<vector, vector, float> playArtyShotSound = new Param3<vector, vector, float>(vector.Zero, vector.Zero, 0);
3164 if (ctx.Read(playArtyShotSound))
3165 {
3166 soundPosition = playArtyShotSound.param1;
3167 delayedSoundPos = playArtyShotSound.param2;
3168 soundDelay = playArtyShotSound.param3;
3169 if (soundPosition == vector.Zero)
3170 break;
3171 }
3172 else
3173 break;
3174
3175 if (!GetGame().GetPlayer())
3176 break;
3177
3178 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_SoundSet", soundPosition, 0.1, 0.1);
3179 m_ArtySound.SetAutodestroy(true);
3180
3181 // We remove the amount of time the incoming sound lasts
3182 soundDelay -= 5;
3183 // We convert to milliseconds
3184 soundDelay *= 1000;
3185 GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DelayedMidAirDetonation, soundDelay, false, delayedSoundPos[0], delayedSoundPos[1], delayedSoundPos[2]);
3186 break;
3187 }
3188 case ERPCs.RPC_SET_BILLBOARDS:
3189 {
3190 if (!m_BillboardSetHandler)
3191 m_BillboardSetHandler = new BillboardSetHandler();
3192
3193 Param1<int> indexP = new Param1<int>(-1);
3194 if (ctx.Read(indexP))
3195 {
3196 int index = indexP.param1;
3197 m_BillboardSetHandler.OnRPCIndex(index);
3198 }
3199 break;
3200 }
3201 #endif
3202 #endif
3203
3204 case ERPCs.RPC_USER_SYNC_PERMISSIONS:
3205 {
3206 map<string, bool> mute_list;
3207 if (ctx.Read(mute_list))
3208 {
3209 for (int i = 0; i < mute_list.Count(); i++)
3210 {
3211 string uid = mute_list.GetKey(i);
3212 bool mute = mute_list.GetElement(i);
3213 MutePlayer(uid, sender.GetPlainId(), mute);
3214 }
3215 }
3216 break;
3217 }
3218
3219 /*
3220 case ERPCs.RPC_SERVER_RESPAWN_MODE:
3221 {
3222 int mode;
3223 if (ctx.Read(mode) && !IsServer())
3224 {
3225 GetMission().SetRespawnModeClient(mode);
3226 }
3227 }
3228 */
3229
3230 #ifdef DEVELOPER
3231 case ERPCs.DEV_SET_WEATHER:
3232 {
3233 Param1<DebugWeatherRPCData> p1data = new Param1<DebugWeatherRPCData>(null);
3234
3235 if ( ctx.Read(p1data) )
3236 {
3237 DebugWeatherRPCData data = p1data.param1;
3238
3239 if (data.m_FogValue >= 0)
3240 GetGame().GetWeather().GetFog().Set(data.m_FogValue, data.m_FogInterpolation, data.m_FogDuration);
3241
3242 if (data.m_OvercastValue >= 0)
3243 GetGame().GetWeather().GetOvercast().Set(data.m_OvercastValue, data.m_OvercastInterpolation, data.m_OvercastDuration);
3244
3245 if (data.m_RainValue >= 0)
3246 GetGame().GetWeather().GetRain().Set(data.m_RainValue, data.m_RainInterpolation, data.m_RainDuration);
3247
3248 if (data.m_SnowfallValue >= 0)
3249 GetGame().GetWeather().GetSnowfall().Set(data.m_SnowfallValue, data.m_SnowfallInterpolation, data.m_SnowfallDuration);
3250
3251 if (data.m_VolFogDistanceDensity >= 0)
3252 GetGame().GetWeather().SetDynVolFogDistanceDensity(data.m_VolFogDistanceDensity, data.m_VolFogDistanceDensityTime);
3253
3254 if (data.m_VolFogHeightDensity >= 0)
3255 GetGame().GetWeather().SetDynVolFogHeightDensity(data.m_VolFogHeightDensity, data.m_VolFogHeightDensityTime);
3256
3257 if (data.m_VolFogHeightBias >= -500)
3258 GetGame().GetWeather().SetDynVolFogHeightBias(data.m_VolFogHeightBias, data.m_VolFogHeightBiasTime);
3259
3260 if (data.m_WindMagnitudeValue >= 0)
3261 GetGame().GetWeather().GetWindMagnitude().Set(data.m_WindMagnitudeValue, data.m_WindDInterpolation, data.m_WindDDuration);
3262
3263 if (data.m_WindDirectionValue >= -3.14)
3264 GetGame().GetWeather().GetWindDirection().Set(data.m_WindDirectionValue, data.m_WindDInterpolation, data.m_WindDDuration);
3265 }
3266 else
3267 {
3268 ErrorEx("Failed to read weather debug data");
3269 }
3270 break;
3271 }
3272 #endif
3273
3274
3275 #ifdef DIAG_DEVELOPER
3276 #ifdef SERVER
3277 case ERPCs.DIAG_CAMERATOOLS_CAM_DATA:
3278 {
3279 if (!m_CameraToolsMenuServer)
3280 {
3281 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3282 }
3283 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3284 break;
3285 }
3286
3287 case ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE:
3288 {
3289 if (!m_CameraToolsMenuServer)
3290 {
3291 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3292 }
3293 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3294 break;
3295 }
3296
3297 #endif
3298 #endif
3299
3300 }
3301 // global rpc's handling
3302 }
3303 }
3304
3305 void DelayedMidAirDetonation(float x, float y, float z)
3306 {
3307 EffectSound artilleryFallSound = SEffectManager.PlaySound("Artillery_Fall_SoundSet", Vector(x, y, z));
3308 artilleryFallSound.SetAutodestroy(true);
3309 }
3310
3311 // ------------------------------------------------------------
3313 {
3314 #ifndef NO_GUI
3315 Mission mission = GetMission();
3316 if (mission && !m_loading.IsLoading() && GetUIManager().IsDialogQueued())
3317 {
3318 mission.Pause();
3319 GetUIManager().ShowQueuedDialog();
3320 }
3321 #endif
3322 }
3323
3325 void SetConnecting(bool value)
3326 {
3327 m_IsConnecting = value;
3328 }
3329
3331 {
3332 return m_IsConnecting;
3333 }
3334
3335 // ------------------------------------------------------------
3337 {
3338 return m_loading && m_loading.IsLoading();
3339 }
3340
3341 // ------------------------------------------------------------
3343 {
3344 m_keyboard_handler = handler;
3345 }
3346
3347 // ------------------------------------------------------------
3349 {
3350 #ifndef NO_GUI
3351 m_loading.ShowEx(this);
3352 #endif
3353 }
3354
3355 // ------------------------------------------------------------
3356 void LoadingHide(bool force = false)
3357 {
3358 #ifndef NO_GUI
3359 m_loading.Hide(force);
3360 // turn the lights back on
3361 PPEManagerStatic.GetPPEManager().StopAllEffects();
3362 #ifdef PLATFORM_CONSOLE
3363 if (!IsLoading())
3364 {
3365 if (m_LoadState != DayZLoadState.MAIN_MENU_START && m_LoadState != DayZLoadState.MAIN_MENU_USER_SELECT)
3366 {
3368 }
3369 }
3370 #endif
3371 #endif
3372 }
3373
3374 // ------------------------------------------------------------
3375 override string CreateDefaultPlayer()
3376 {
3377 if (m_CharClassNames.Count() > 0)
3378 return m_CharClassNames[0];
3379
3380 return "";
3381 }
3382
3383 // ------------------------------------------------------------
3384 override string CreateRandomPlayer()
3385 {
3386 return m_CharClassNames.GetRandomElement();
3387 }
3388
3389 // ------------------------------------------------------------
3391 {
3392 return m_CharClassNames;
3393 }
3394
3395 // ------------------------------------------------------------
3396 void ExplosionEffectsEx(Object source, Object directHit, int componentIndex, float energyFactor, float explosionFactor, HitInfo hitInfo)
3397 {
3398 vector pos = hitInfo.GetPosition();
3399 string ammoType = hitInfo.GetAmmoType();
3400
3401 // Call legacy method
3402 ExplosionEffects(source, directHit, componentIndex, hitInfo.GetSurface(), pos, hitInfo.GetSurfaceNormal(), energyFactor, explosionFactor, hitInfo.IsWater(), ammoType);
3403
3404 // add explosion noise
3405 if (IsServer())
3406 {
3407 //NoiseParams npar = new NoiseParams();
3408 m_NoiseParams.LoadFromPath(string.Format("cfgAmmo %1 NoiseExplosion", ammoType));
3409
3410 float multiplier = hitInfo.GetSurfaceNoiseMultiplier();
3411 if (multiplier == 0)
3412 multiplier = 1;
3413
3414 GetNoiseSystem().AddNoiseTarget(pos, 21, m_NoiseParams, multiplier * GetGame().GetWeather().GetNoiseReductionByWeather());
3415 }
3416 }
3417
3418 // ------------------------------------------------------------
3419 void ExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal,
3420 float energyFactor, float explosionFactor, bool isWater, string ammoType)
3421 {
3422 #ifndef SERVER
3423 if (source)
3424 {
3425 if (GetGame().GetPlayer() == null)
3426 return;
3427 source.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
3428
3429 if (source.ShootsExplosiveAmmo() )
3430 {
3431 int particleID = AmmoTypesAPI.GetExplosionParticleID(ammoType, surface);
3432 if (particleID > -1)
3433 {
3434 ParticleManager.GetInstance().PlayInWorld(particleID, pos);
3435 }
3436 }
3437
3438
3439 float distance_to_player = vector.Distance(pos, GetGame().GetPlayer().GetPosition());
3440 m_AmmoShakeParams.Load(ammoType);
3441
3442 if (distance_to_player < m_AmmoShakeParams.m_Radius)
3443 {
3444 float dist01 = Math.InverseLerp(0, m_AmmoShakeParams.m_Radius, distance_to_player);
3445 float modifier = Math.Lerp(m_AmmoShakeParams.m_ModifierClose, m_AmmoShakeParams.m_ModifierFar,dist01);
3446
3447 GetGame().GetPlayer().GetCurrentCamera().SpawnCameraShake(modifier * m_AmmoShakeParams.m_Strength);
3448 }
3449 }
3450 #endif
3451 }
3452
3453 // ------------------------------------------------------------
3455 {
3456 string simulation;
3457
3458 GetGame().ConfigGetText("cfgAmmo " + info.GetAmmoType() + " simulation", simulation);
3459
3460 if (simulation == "shotArrow")
3461 {
3462 string pile;
3463
3464 GetGame().ConfigGetText("cfgAmmo " + info.GetAmmoType() + " spawnPileType", pile);
3465
3466 EntityAI arrow = EntityAI.Cast(GetGame().CreateObjectEx(pile, info.GetPos(), ECE_DYNAMIC_PERSISTENCY));
3467 arrow.PlaceOnSurface();
3468 arrow.SetFromProjectile(info);
3469 }
3470 }
3471
3472 const float ARROW_PIERCE_DEPTH = 0.05;
3473
3474 // ------------------------------------------------------------
3475 void OnProjectileStoppedInTerrain(TerrainCollisionInfo info)
3476 {
3477 string simulation;
3478
3479 if (info.GetIsWater())
3480 return;
3481
3482 GetGame().ConfigGetText("cfgAmmo " + info.GetAmmoType() + " simulation", simulation);
3483 if (simulation == "shotArrow")
3484 {
3485 string pile;
3486 GetGame().ConfigGetText("cfgAmmo " + info.GetAmmoType() + " spawnPileType", pile);
3487 vector pos = info.GetPos();
3488 vector dir = -info.GetInVelocity();
3489
3490 dir.Normalize();
3491 pos -= dir * ARROW_PIERCE_DEPTH;
3492
3493 EntityAI arrow = EntityAI.Cast(GetGame().CreateObjectEx(pile, pos, ECE_KEEPHEIGHT|ECE_DYNAMIC_PERSISTENCY));
3494 arrow.SetDirection(dir);
3495 arrow.SetFromProjectile(info);
3496 }
3497 }
3498
3499 // ------------------------------------------------------------
3501 {
3502 string simulation;
3503
3504 GetGame().ConfigGetText("cfgAmmo " + info.GetAmmoType() + " simulation", simulation);
3505 if (simulation == "shotArrow")
3506 {
3507 string pile;
3508 GetGame().ConfigGetText("cfgAmmo " + info.GetAmmoType() + " spawnPileType", pile);
3509
3510 EntityAI arrow = null;
3511 EntityAI ent = EntityAI.Cast(info.GetHitObj());
3512 if (ent)
3513 {
3514 EntityAI parent = ent.GetHierarchyParent();
3515 if (parent && parent.IsPlayer())
3516 {
3517 arrow = EntityAI.Cast(GetGame().CreateObjectEx(pile, parent.GetPosition(), ECE_DYNAMIC_PERSISTENCY));
3518 arrow.PlaceOnSurface();
3519 arrow.SetFromProjectile(info);
3520
3521 return;
3522 }
3523 }
3524
3525 vector pos = info.GetPos();
3526 vector dir = -info.GetInVelocity();
3527
3528 dir.Normalize();
3529 pos -= dir * ARROW_PIERCE_DEPTH;
3530
3531 arrow = EntityAI.Cast(GetGame().CreateObjectEx(pile, pos, ECE_KEEPHEIGHT|ECE_DYNAMIC_PERSISTENCY));
3532 arrow.SetDirection(dir);
3533 arrow.SetFromProjectile(info);
3534
3535 info.GetHitObj().AddArrow(arrow, info.GetComponentIndex(), info.GetHitObjPos(), info.GetHitObjRot());
3536 }
3537 }
3538
3539 // ------------------------------------------------------------
3540 void FirearmEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal,
3541 vector exitPos, vector inSpeed, vector outSpeed, bool isWater, bool deflected, string ammoType)
3542 {
3543 #ifndef SERVER
3544 ImpactEffectsData impactEffectsData = new ImpactEffectsData();
3545 impactEffectsData.m_DirectHit = directHit;
3546 impactEffectsData.m_ComponentIndex = componentIndex;
3547 impactEffectsData.m_Surface = surface;
3548 impactEffectsData.m_Position = pos;
3549 impactEffectsData.m_ImpactType = ImpactTypes.UNKNOWN;
3550 impactEffectsData.m_SurfaceNormal = surfNormal;
3551 impactEffectsData.m_ExitPosition = exitPos;
3552 impactEffectsData.m_InSpeed = inSpeed;
3553 impactEffectsData.m_OutSpeed = outSpeed;
3554 impactEffectsData.m_IsDeflected = deflected;
3555 impactEffectsData.m_AmmoType = ammoType;
3556 impactEffectsData.m_IsWater = isWater;
3557
3558 if (directHit)
3559 {
3560 directHit.OnReceivedHit(impactEffectsData);
3561 }
3562
3563 ImpactMaterials.EvaluateImpactEffectEx(impactEffectsData);
3564 #endif
3565
3566
3567 if (IsServer())
3568 {
3569 if (source && source.ShootsExplosiveAmmo() && !deflected && outSpeed == vector.Zero)
3570 {
3571 if (ammoType == "Bullet_40mm_ChemGas")
3572 {
3573 GetGame().CreateObject("ContaminatedArea_Local", pos);
3574 }
3575 else if (ammoType == "Bullet_40mm_Explosive")
3576 {
3577 DamageSystem.ExplosionDamage(EntityAI.Cast(source), null, "Explosion_40mm_Ammo", pos, DamageType.EXPLOSION);
3578 }
3579 }
3580
3581 // add hit noise
3582 m_NoiseParams.LoadFromPath("cfgAmmo " + ammoType + " NoiseHit");
3583
3584 float surfaceCoef = SurfaceGetNoiseMultiplier(directHit, pos, componentIndex);
3585 float coefAdjusted = surfaceCoef * inSpeed.Length() / ConfigGetFloat("cfgAmmo " + ammoType + " initSpeed");
3586 if (coefAdjusted == 0)
3587 coefAdjusted = 1;
3588
3589 GetNoiseSystem().AddNoiseTarget(pos, 10, m_NoiseParams, coefAdjusted * GetGame().GetWeather().GetNoiseReductionByWeather()); // Leave a ping for 5 seconds
3590 }
3591 }
3592
3593 // ------------------------------------------------------------
3594 void CloseCombatEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal,
3595 bool isWater, string ammoType)
3596 {
3597 #ifndef SERVER
3598 ImpactEffectsData impactEffectsData = new ImpactEffectsData();
3599 impactEffectsData.m_DirectHit = directHit;
3600 impactEffectsData.m_ComponentIndex = componentIndex;
3601 impactEffectsData.m_Surface = surface;
3602 impactEffectsData.m_Position = pos;
3603 impactEffectsData.m_ImpactType = ImpactTypes.MELEE;
3604 impactEffectsData.m_SurfaceNormal = Vector(Math.RandomFloat(-1,1), Math.RandomFloat(-1,1), Math.RandomFloat(-1,1));
3605 impactEffectsData.m_ExitPosition = "0 0 0";
3606 impactEffectsData.m_InSpeed = "0 0 0";
3607 impactEffectsData.m_OutSpeed = "0 0 0";
3608 impactEffectsData.m_IsDeflected = false;
3609 impactEffectsData.m_AmmoType = ammoType;
3610 impactEffectsData.m_IsWater = isWater;
3611
3612 if (directHit)
3613 directHit.OnReceivedHit(impactEffectsData);
3614
3615 ImpactMaterials.EvaluateImpactEffectEx(impactEffectsData);
3616 #endif
3617
3618 // add hit noise
3619 if (IsServer())
3620 {
3621 m_NoiseParams.LoadFromPath("cfgAmmo " + ammoType + " NoiseHit");
3622
3623 float surfaceCoef = SurfaceGetNoiseMultiplier(directHit, pos, componentIndex);
3624 if (surfaceCoef == 0)
3625 surfaceCoef = 1;
3626
3627 GetNoiseSystem().AddNoisePos(EntityAI.Cast(source), pos, m_NoiseParams, surfaceCoef * GetGame().GetWeather().GetNoiseReductionByWeather());
3628 }
3629 }
3630
3631 void UpdateVoiceLevel(int level)
3632 {
3633 GetMission().UpdateVoiceLevelWidgets(level);
3634 }
3635
3636 void InitCharacterMenuDataInfo(int menudata_count)
3637 {
3638 m_OriginalCharactersCount = menudata_count;
3639 }
3640
3642 {
3643 m_PlayerName = name;
3644 }
3645
3647 {
3648 return m_PlayerName;
3649 }
3650
3651 void SetNewCharacter(bool state)
3652 {
3653 m_IsNewCharacter = state;
3654 }
3655
3657 {
3658 return m_IsNewCharacter;
3659 }
3660
3661 void SetUserFOV(float pFov)
3662 {
3663 if (pFov < OPTIONS_FIELD_OF_VIEW_MIN)
3664 pFov = OPTIONS_FIELD_OF_VIEW_MIN;
3665
3666 if (pFov > OPTIONS_FIELD_OF_VIEW_MAX)
3667 pFov = OPTIONS_FIELD_OF_VIEW_MAX;
3668
3669 m_UserFOV = pFov;
3670 }
3671
3673 {
3674 return m_UserFOV;
3675 }
3676
3678 {
3679 GameOptions gameOptions = new GameOptions;
3680 NumericOptionsAccess noa;
3681 if (gameOptions && Class.CastTo(noa,gameOptions.GetOptionByType(OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW)))
3682 {
3683 return noa.ReadValue();
3684 }
3685 return 1.0;
3686 }
3687
3689 {
3690 switch (type)
3691 {
3692 case ECameraZoomType.NONE:
3693 return GetUserFOV();
3694 case ECameraZoomType.NORMAL:
3695 return Math.Min(GetUserFOV(), GameConstants.DZPLAYER_CAMERA_FOV_EYEZOOM);
3696 case ECameraZoomType.SHALLOW:
3697 return Math.Min(GetUserFOV(),GameConstants.DZPLAYER_CAMERA_FOV_EYEZOOM_SHALLOW);
3698 default:
3699 return GetUserFOV();
3700 }
3701 return GetUserFOV();
3702 }
3703
3704 void SetHudBrightness(float value)
3705 {
3706 Widget.SetLV(value);
3707 Widget.SetTextLV(value);
3708 }
3709
3711 {
3712 return g_Game.GetProfileOptionFloat(EDayZProfilesOptions.HUD_BRIGHTNESS);
3713 }
3714
3715 // Check if ammo is compatible with a weapon in hands
3716 static bool CheckAmmoCompability(EntityAI weaponInHand, EntityAI ammo)
3717 {
3718 TStringArray ammo_names = new TStringArray; // Array of ammo types (their name) that can be used with weapon in hand
3719
3720 string cfg_path = "CfgWeapons " + weaponInHand.GetType() + " chamberableFrom"; // Create config path
3721 GetGame().ConfigGetTextArray(cfg_path, ammo_names); // Get ammo types
3722
3723 foreach (string ammo_name : ammo_names) // for every ammo in ammo string compare passed ammo
3724 {
3725 if (ammo.GetType() == ammo_name)
3726 {
3727 return true;
3728 }
3729 }
3730
3731 // if no ammo from the array matches with ammo passed, return false
3732 return false;
3733 }
3734
3735 void SetEVValue(float value)
3736 {
3737 m_PreviousEVValue = m_EVValue;
3738 SetEVUser(value);
3739 m_EVValue = value;
3740 }
3741
3743 {
3744 return m_EVValue;
3745 }
3746
3748 {
3749 return m_PreviousEVValue;
3750 }
3751
3753 {
3754 ListOptionsAccess language_option;
3755 GameOptions options = new GameOptions();
3756 language_option = ListOptionsAccess.Cast(options.GetOptionByType(OptionAccessType.AT_OPTIONS_LANGUAGE));
3757 int idx = -1;
3758 if (language_option)
3759 {
3760 idx = language_option.GetIndex();
3761 }
3762
3763 return idx;
3764 }
3765
3767 {
3768 return m_IsWorldWetTempUpdateEnabled;
3769 }
3770
3772 {
3773 return (GetFoodDecayModifier() != 0);
3774 }
3775
3777 {
3778 #ifdef DIAG_DEVELOPER
3779
3780 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.FOOD_DECAY))
3781 {
3782 return m_FoodDecayModifier * FeatureTimeAccel.GetFeatureTimeAccelValue();
3783 }
3784 #endif
3785 return m_FoodDecayModifier;
3786 }
3787
3789 {
3790 if (!m_ConnectedInputDeviceList)
3791 {
3792 m_ConnectedInputDeviceList = new array<int>;
3793 }
3794 return m_ConnectedInputDeviceList;
3795 }
3796
3798 {
3799 m_CursorDesiredVisibilityScript = visible;
3800
3802 }
3803
3805 {
3806 return m_CursorDesiredVisibilityScript;
3807 }
3808
3811 {
3813#ifdef PLATFORM_CONSOLE
3814 if (GetInput())
3815 {
3816 return GetInput().IsMouseConnected();
3817 }
3818#endif
3819
3821#ifdef PLATFORM_CONSOLE
3822 return false;
3823#else
3824 return true;
3825#endif
3826 }
3827
3829 {
3830#ifndef NO_GUI
3831#ifdef FEATURE_CURSOR
3832 if (!IsAppActive())
3833 {
3834 ShowCursorWidget(true);
3835 }
3836 else
3837#endif
3838 {
3839 bool showCursor = m_CursorDesiredVisibilityScript && CanDisplayMouseCursor();
3840
3841 UIManager ui = GetUIManager();
3842 if (ui)
3843 {
3845 ui.ShowCursor(showCursor);
3846 }
3847 else
3848 {
3850 ShowCursorWidget(showCursor);
3851 }
3852 }
3853#endif
3854 }
3855
3860
3862 //DEPRECATED//
3866};
3867
3868DayZGame g_Game;
3869
3870DayZGame GetDayZGame()
3871{
3872 return g_Game;
3873}
const int ECE_KEEPHEIGHT
const int ECE_DYNAMIC_PERSISTENCY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Backlit effect class.
Definition backlit.c:105
Static data of bleeding chance probabilities; currently used for melee only.
bool IsConnecting()
Definition dayzgame.c:3330
void SetConnecting(bool value)
Returns true when connecting to server.
Definition dayzgame.c:3325
void DisconnectSessionScript(bool displayJoinError=false)
Definition dayzgame.c:2667
override TStringArray ListAvailableCharacters()
Definition dayzgame.c:3390
override void OnUpdate(bool doSim, float timeslice)
Definition dayzgame.c:2891
int m_PrevBlur
Definition dayzgame.c:2115
void UpdateVoiceLevel(int level)
Definition dayzgame.c:3631
override void OnActivateMessage()
Definition dayzgame.c:2046
void AddVisitedServer(string ip, int port)
Definition dayzgame.c:2599
override void OnDeactivateMessage()
Definition dayzgame.c:2052
void UpdateLoginQueue(float timeslice)
Definition dayzgame.c:1826
void CreateTitleScreen()
Definition dayzgame.c:2141
override string CreateRandomPlayer()
Definition dayzgame.c:3384
float GetUserFOV()
Definition dayzgame.c:3672
void OnProjectileStoppedInTerrain(TerrainCollisionInfo info)
Definition dayzgame.c:3475
DayZGameState m_GameState
Definition dayzgame.c:905
void SetPreviousGamepad(int gamepad)
Definition dayzgame.c:2411
float GetFoodDecayModifier()
Definition dayzgame.c:3776
bool IsLoading()
Definition dayzgame.c:3336
void ConnectFromServerBrowserEx(string ip, int port, int steamQueryPort, string password="")
Definition dayzgame.c:2747
void StoreLoginDataPrepare()
Definition dayzgame.c:1955
bool m_AutotestEnabled
Definition dayzgame.c:897
void DelayedMidAirDetonation(float x, float y, float z)
Definition dayzgame.c:3305
override void OnPostUpdate(bool doSim, float timeslice)
Definition dayzgame.c:2980
int m_ConnectPort
Definition dayzgame.c:2120
int GetCurrentDisplayLanguageIdx()
Definition dayzgame.c:3752
void LoadingShow()
Definition dayzgame.c:3348
array< int > GetConnectedInputDeviceList()
Definition dayzgame.c:3788
void TryConnect()
Definition dayzgame.c:2528
void ConnectFromCLI()
Definition dayzgame.c:2761
void InitNotifications()
Definition dayzgame.c:2107
override void OnDeviceReset()
Definition dayzgame.c:2876
override void OnAfterCreate()
Definition dayzgame.c:2040
proto native bool IsMultiplayer()
void SetPlayerGameName(string name)
Definition dayzgame.c:3641
int GetPreviousGamepad()
Definition dayzgame.c:2416
string GetPlayerGameName()
Definition dayzgame.c:3646
bool IsKindOf(string cfg_class_name, string cfg_parent_name)
Returns is class name inherited from parent class name.
Definition game.c:1394
void OnProjectileStopped(ProjectileStoppedInfo info)
Definition dayzgame.c:3454
void ExplosionEffectsEx(Object source, Object directHit, int componentIndex, float energyFactor, float explosionFactor, HitInfo hitInfo)
Definition dayzgame.c:3396
bool OnConnectivityStatChange(EConnectivityStatType type, EConnectivityStatLevel newLevel, EConnectivityStatLevel oldLevel)
Definition dayzgame.c:1749
void SetMouseCursorDesiredVisibility(bool visible)
Definition dayzgame.c:3797
void LoadingHide(bool force=false)
Definition dayzgame.c:3356
bool GetMouseCursorDesiredVisibility()
Definition dayzgame.c:3804
proto native BiosUserManager GetUserManager()
void OnLoginTimeEvent(int loginTime)
Definition dayzgame.c:1860
void ConnectLaunch()
Definition dayzgame.c:2223
override void OnKeyPress(int key)
Definition dayzgame.c:2782
void OnMPConnectionLostEvent(int duration)
Definition dayzgame.c:1977
string m_ConnectAddress
Definition dayzgame.c:2119
void CreateGamepadDisconnectMenu()
bool CanDisplayMouseCursor()
extend as needed, only game focus and M&K setting (consoles only!) are checked natively
Definition dayzgame.c:3810
void SetKeyboardHandle(UIScriptedMenu handler)
Definition dayzgame.c:3342
void OnRespawnEvent(int time)
Definition dayzgame.c:1915
float GetPreviousEVValue()
Definition dayzgame.c:3747
void LoginTimeCountdown()
Definition dayzgame.c:1898
proto native void SetMainMenuWorld(string world)
void AutoTestLaunch(string param)
Definition dayzgame.c:2306
ref BillboardSetHandler m_BillboardSetHandler
Definition dayzgame.c:891
string m_DatabaseID
Definition dayzgame.c:2117
void OnPreloadEvent(vector pos)
Definition dayzgame.c:1943
proto native bool IsServer()
void MainMenuLaunch()
Definition dayzgame.c:2258
void DeleteTitleScreen()
Definition dayzgame.c:2181
void EnterLoginTime(UIMenuPanel parent)
Definition dayzgame.c:1971
void Connect()
Definition dayzgame.c:2645
ref Widget m_IntroMenu
Definition dayzgame.c:2113
void RemoveVoiceNotification(VONStopSpeakingEventParams vonStopParams)
Definition dayzgame.c:1820
const int MISSION_STATE_GAME
Definition dayzgame.c:894
ref TStringArray m_Visited
Definition dayzgame.c:2125
float GetCurrentEVValue()
Definition dayzgame.c:3742
static float GetUserFOVFromConfig()
Definition dayzgame.c:3677
override string CreateDefaultPlayer()
Definition dayzgame.c:3375
void EnterLoginQueue(UIMenuPanel parent)
Definition dayzgame.c:1965
void SetNewCharacter(bool state)
Definition dayzgame.c:3651
void RefreshCurrentServerInfo()
Definition dayzgame.c:2633
override void OnKeyRelease(int key)
Definition dayzgame.c:2821
static bool CheckAmmoCompability(EntityAI weaponInHand, EntityAI ammo)
Definition dayzgame.c:3716
bool ShouldShowControllerDisconnect()
Definition dayzgame.c:2189
void FirearmEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, vector exitPos, vector inSpeed, vector outSpeed, bool isWater, bool deflected, string ammoType)
Definition dayzgame.c:3540
float GetFOVByZoomType(ECameraZoomType type)
Definition dayzgame.c:3688
void OnProjectileStoppedInObject(ObjectCollisionInfo info)
Definition dayzgame.c:3500
proto native owned string GetMainMenuWorld()
void ConnectFromServerBrowser(string ip, int port, string password="")
Definition dayzgame.c:2738
void JoinLaunch()
Definition dayzgame.c:2208
override void OnMouseButtonRelease(int button)
Definition dayzgame.c:2866
void CheckDialogs()
Definition dayzgame.c:3312
bool GetLastVisitedServer(out string ip, out int port)
Definition dayzgame.c:2582
bool IsLeftCtrlDown()
Definition dayzgame.c:2776
override void OnMouseButtonPress(int button)
Definition dayzgame.c:2856
void MissionLaunch()
Definition dayzgame.c:2277
void PartyLaunch()
Definition dayzgame.c:2244
void SetDatabaseID(string id)
Definition dayzgame.c:2132
void InitCharacterMenuDataInfo(int menudata_count)
Definition dayzgame.c:3636
bool IsVisited(string ip, int port)
Definition dayzgame.c:2626
proto native Weather GetWeather()
Returns weather controller object.
void SelectUser(int gamepad=-1)
Definition dayzgame.c:2324
ref NotificationUI m_Notifications
Definition dayzgame.c:907
void SelectGamepad()
Definition dayzgame.c:2463
void RefreshMouseCursorVisibility()
Definition dayzgame.c:3828
DayZLoadState m_LoadState
Definition dayzgame.c:906
proto native bool IsClient()
int m_ConnectSteamQueryPort
Definition dayzgame.c:2121
bool IsFoodDecayEnabled()
Definition dayzgame.c:3771
float GetHUDBrightnessSetting()
Definition dayzgame.c:3710
string GetDatabaseID()
Definition dayzgame.c:2127
native void CreateMission(string path)
Create only enforce script mission, used for mission script reloading.
override bool OnInitialize()
Definition dayzgame.c:2058
proto native float SurfaceGetNoiseMultiplier(Object directHit, vector pos, int componentIndex)
void SetUserFOV(float pFov)
Definition dayzgame.c:3661
void SetEVValue(float value)
Definition dayzgame.c:3735
const float ARROW_PIERCE_DEPTH
Definition dayzgame.c:3472
override void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
Definition dayzgame.c:3012
void GamepadCheck()
Definition dayzgame.c:2421
void CloseCombatEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, bool isWater, string ammoType)
Definition dayzgame.c:3594
proto native void SetLoginTimerFinished()
proto native void SetEVUser(float value)
Sets custom camera camera EV. range: -50.0..50.0? //TODO.
void SetHudBrightness(float value)
Definition dayzgame.c:3704
void DeleteGamepadDisconnectMenu()
proto native void AbortMission()
Returns to main menu, leave world empty for using last mission world.
BillboardSetHandler GetBillboardHandler()
Definition dayzgame.c:3856
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition game.c:1548
void ExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
Definition dayzgame.c:3419
void UpdateInputDeviceDisconnectWarning()
Definition dayzgame.c:2194
void ConnectFromJoin(string ip, int port)
Definition dayzgame.c:2753
ref Widget m_GamepadDisconnectMenu
Definition dayzgame.c:2114
void DisconnectSessionEx(DisconnectSessionFlags flags)
Definition dayzgame.c:2679
string m_ConnectPassword
Definition dayzgame.c:2122
float GetDeltaT()
Definition dayzgame.c:2885
bool IsNewCharacter()
Definition dayzgame.c:3656
void AddVoiceNotification(VONStopSpeakingEventParams vonStartParams)
Definition dayzgame.c:1815
void LoadProgressUpdate(int progressState, float progress, string title)
Definition dayzgame.c:1998
ref LoadingScreen m_loading
Definition dayzgame.c:911
bool IsWorldWetTempUpdateEnabled()
Definition dayzgame.c:3766
Super root of all classes in Enforce script.
Definition enscript.c:11
static void Init()
Definition component.c:37
Definition dbgui.c:60
Definition debug.c:2
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
struct that keeps Time relevant information for future formatting
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition inpututils.c:167
static const float ICON_SCALE_TOOLBAR
Definition inpututils.c:15
LoginQueue position when using -connect since mission is not created yet.
Definition dayzgame.c:195
TextWidget m_txtLabel
Definition dayzgame.c:207
TextWidget m_txtDescription
Definition dayzgame.c:206
bool CanChangeHintPage(float timeAccu)
Definition dayzgame.c:321
ButtonWidget m_btnLeave
Definition dayzgame.c:208
LoginTime when using -connect since mission is not created yet.
Definition dayzgame.c:329
TODO doc.
Definition enscript.c:118
Definition enmath.c:7
Mission class.
Definition gameplay.c:687
static void AddNotificationExtended(float show_time, string title_text, string detail_text="", string icon="")
Send custom notification from to local player.
static void InitInstance()
static void CleanupInstance()
static void AddNotification(NotificationType type, float show_time, string detail_text="")
Send notification from default types to local player.
static void Update(float timeslice)
static void OnGameplayDataHandlerLoad()
static void LoadVoicePrivilege()
static void LeaveGameplaySession()
static void GetSession()
static BiosUser GetBiosUser()
static void GetCurrentServerInfo(string ip, int port)
static void SetBiosUser(BiosUser user)
static void EnterGameplaySession()
static void SetMultiplayState(bool state)
static void LoadMPPrivilege()
static void Init()
static void ClearCurrentServerInfo()
Static component of PPE manager, used to hold the instance.
Definition ppemanager.c:3
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
The class that will be instanced (moddable)
Definition gameplay.c:389
Manager class for managing Effect (EffectParticle, EffectSound)
static void OnUpdate(float timeslice)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Definition tools.c:53
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
Module containing compiled scripts.
Definition enscript.c:131
Serialization general interface. Serializer API works with:
Definition serializer.c:56
Part of main menu hierarchy to create custom menus from script.
override void Update(float timeslice)
Definition dayzgame.c:69
bool m_IsStatic
Definition dayzgame.c:66
bool CanChangeHintPage(float timeAccu)
override bool IsHandlingPlayerDeathEvent()
Definition dayzgame.c:104
bool IsStatic()
Definition dayzgame.c:99
float m_HintTimeAccu
Definition dayzgame.c:67
override bool OnKeyDown(Widget w, int x, int y, int key)
ref UiHintPanelLoading m_HintPanel
Definition dayzgame.c:65
void Leave()
Definition dayzgame.c:87
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
void UpdateWeatherEffects(Weather weather, float timeslice)
Updates local weather effects.
Definition worlddata.c:184
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override void OnEvent(EventType eventTypeId, Param params)
Handles VON-related events.
override void DeferredInit()
DamageType
exposed from C++ (do not change)
class AttachmentSoundLookupTable extends SoundLookupTable m_NoiseParams
class DayZProfilesOptions PARTY_CONTROLLER_SELECT
class DayZProfilesOptions MISSION_USER_SELECT
ImageWidget m_ImageLogoCorner
Definition dayzgame.c:697
void Hide()
Definition dayzgame.c:170
ImageWidget m_ImageLoadingIcon
Definition dayzgame.c:698
ImageWidget m_ImageWidgetBackground
Definition dayzgame.c:692
void Inc()
Definition dayzgame.c:761
enum DisconnectSessionFlags DISCONNECT_SESSION_FLAGS_FORCE
void LoginQueueBase()
Definition dayzgame.c:117
class DayZProfilesOptions PARTY_USER_SELECT
void EndLoading()
Definition dayzgame.c:783
bool IsLoading()
Definition dayzgame.c:791
class DayZProfilesOptions JOIN_START
class DayZProfilesOptions MAIN_MENU_USER_SELECT
Param3< string, int, int > DayZProfilesOptionInt
Definition dayzgame.c:399
class DayZProfilesOptions CONNECT_START
void SetProgress(float val)
Definition dayzgame.c:806
TextWidget m_TextWidgetTitle
Definition dayzgame.c:689
float m_LastProgressUpdate
Definition dayzgame.c:694
class DayZProfilesOptions MISSION_START
const int DISCONNECT_SESSION_FLAGS_ALL
Definition dayzgame.c:15
class DayZProfilesOptions PARTY
class DayZProfilesOptions MAIN_MENU_CONTROLLER_SELECT
void ~LoginQueueBase()
Definition dayzgame.c:122
ref UiHintPanelLoading m_HintPanel
Definition dayzgame.c:706
DayZGame g_Game
Definition dayzgame.c:3868
DisconnectSessionFlags
Definition dayzgame.c:2
@ DISCONNECT_ERROR_ENABLED
Definition dayzgame.c:6
@ JOIN_ERROR_CHECK
Definition dayzgame.c:5
@ IGNORE_WHEN_IN_GAME
Definition dayzgame.c:9
@ JOIN_ERROR_ENABLED
Definition dayzgame.c:4
@ NONE
Definition dayzgame.c:3
@ ALWAYS_FORCE
Definition dayzgame.c:10
@ SELECT_USER
Definition dayzgame.c:7
@ CLOSE_MENUS
Definition dayzgame.c:8
class DayZProfilesOptions UNDEFINED
TextWidget m_ModdedWarning
Definition dayzgame.c:691
void ShowEx(DayZGame game)
Definition dayzgame.c:818
Param3< string, float, float > DayZProfilesOptionFloat
Definition dayzgame.c:400
ProgressBarWidget m_ProgressLoading
Definition dayzgame.c:700
class DayZProfilesOptions JOIN_USER_SELECT
const int DISCONNECT_SESSION_FLAGS_JOIN
Definition dayzgame.c:14
override Widget Init()
Definition dayzgame.c:127
ImageWidget m_ImageLogoMid
Definition dayzgame.c:696
DayZProfilesOption DayZProfilesOptionBool
Definition dayzgame.c:398
class DayZProfilesOptions JOIN_CONTROLLER_SELECT
void SetTitle(string title)
Definition dayzgame.c:796
class DayZProfilesOptions CONNECTING
class DayZProfilesOptions CONNECT_USER_SELECT
class DayZProfilesOptions MAIN_MENU_START
DayZGame GetDayZGame()
Definition dayzgame.c:3870
void LoadingScreen(DayZGame game)
Definition dayzgame.c:707
TextWidget m_TextWidgetStatus
Definition dayzgame.c:690
ButtonWidget m_btnLeave
Definition dayzgame.c:114
void Dec()
Definition dayzgame.c:771
void SetStatus(string status)
Definition dayzgame.c:801
class DayZProfilesOptions PARTY_START
float m_ImageLoadingIconRotation
Definition dayzgame.c:701
ImageWidget m_ImageBackground
Definition dayzgame.c:699
bool CanChangeHintPage(float timeAccu)
Definition dayzgame.c:186
class LoginScreenBase extends UIScriptedMenu m_txtPosition
DayZGame m_DayZGame
Definition dayzgame.c:693
int m_iPosition
Definition dayzgame.c:115
class DayZProfilesOptions m_WidgetRoot
void Show()
Definition dayzgame.c:162
TextWidget m_txtNote
Definition dayzgame.c:113
class DayZProfilesOptions CONNECT
TextWidget m_ProgressText
Definition dayzgame.c:702
ref Timer m_Timer
Definition dayzgame.c:705
class DayZProfilesOptions JOIN
class CrashSoundSets GetIsWater
Param3< string, bool, bool > DayZProfilesOption
Definition dayzgame.c:397
void SetPosition(int position)
Definition dayzgame.c:177
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition dayzgame.c:151
ProjectileStoppedInfo Managed GetSurfNormal()
class DayZProfilesOptions MAIN_MENU
int m_Counter
Definition dayzgame.c:704
class DayZProfilesOptions CONNECT_CONTROLLER_SELECT
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
void SetDispatcher(Dispatcher dispatcher)
Definition dispatcher.c:31
Mission mission
ECameraZoomType
EDayZProfilesOptions
DiagMenuIDs
Definition ediagmenuids.c:2
int GetID()
Get the ID registered in SEffectManager.
Definition effect.c:561
EConnectivityStatType
const int MIN
Definition enconvert.c:28
ERPCs
Definition erpcs.c:2
ErrorCategory
ErrorCategory - To decide what ErrorHandlerModule needs to be called and easily identify where it cam...
const int PROGRESS_UPDATE
Definition gameplay.c:397
Param1< int > RespawnEventParams
RespawnTime.
Definition gameplay.c:431
Param1< int > MPConnectionLostEventParams
Duration.
Definition gameplay.c:457
Param1< int > LoginTimeEventParams
LoginTime.
Definition gameplay.c:429
const EventType MPSessionEndEventTypeID
no params
Definition gameplay.c:477
const EventType ConnectingStartEventTypeID
no params
Definition gameplay.c:567
PlayerIdentity PROGRESS_START
const EventType LoginStatusEventTypeID
params: LoginStatusEventParams
Definition gameplay.c:539
Param1< vector > PreloadEventParams
Position.
Definition gameplay.c:433
Param4< float, float, int, int > ServerFpsStatsUpdatedEventParams
average server fps, highest frame time, skipped physics simulation steps server/client
Definition gameplay.c:439
const EventType WorldCleaupEventTypeID
no params
Definition gameplay.c:471
Param1< string > DLCOwnerShipFailedParams
world name
Definition gameplay.c:453
Param1< int > LogoutEventParams
logoutTime
Definition gameplay.c:443
const EventType SelectedUserChangedEventTypeID
no params
Definition gameplay.c:543
const EventType RespawnEventTypeID
params: RespawnEventParams
Definition gameplay.c:533
const EventType MPSessionFailEventTypeID
no params
Definition gameplay.c:479
const int PROGRESS_PROGRESS
Definition gameplay.c:396
const EventType StartupEventTypeID
no params
Definition gameplay.c:469
const EventType DialogQueuedEventTypeID
no params
Definition gameplay.c:495
Param4< int, string, string, string > ChatMessageEventParams
channel, from, text, color config class
Definition gameplay.c:407
const EventType MPSessionStartEventTypeID
no params
Definition gameplay.c:475
const EventType PreloadEventTypeID
params: PreloadEventParams
Definition gameplay.c:535
const EventType LoginTimeEventTypeID
params: LoginTimeEventParams
Definition gameplay.c:531
Param1< PlayerIdentity > ConnectivityStatsUpdatedEventParams
PlayerIdentity.
Definition gameplay.c:437
const EventType ServerFpsStatsUpdatedEventTypeID
params: ServerFpsStatsUpdatedEventParams
Definition gameplay.c:527
const EventType ConnectivityStatsUpdatedEventTypeID
params: ConnectivityStatsUpdatedEventParams
Definition gameplay.c:525
const EventType MPConnectionLostEventTypeID
params: MPConnectionLostEventParams
Definition gameplay.c:483
const EventType LogoutEventTypeID
params: LogoutEventParams
Definition gameplay.c:537
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition gameplay.c:481
const EventType DLCOwnerShipFailedEventTypeID
params: DLCOwnerShipFailedParams
Definition gameplay.c:563
const int PROGRESS_FINISH
Definition gameplay.c:395
proto native CGame GetGame()
const EventType ProgressEventTypeID
params: ProgressEventParams
Definition gameplay.c:489
OptionAccessType
C++ OptionAccessType.
Definition gameplay.c:1224
const EventType ChatMessageEventTypeID
params: ChatMessageEventParams
Definition gameplay.c:499
const EventType ConnectingAbortEventTypeID
no params
Definition gameplay.c:569
const string GAME_CHAT_MSG
Definition constants.c:590
const string SYSTEM_CHAT_MSG
Definition constants.c:585
const string RADIO_CHAT_MSG
Definition constants.c:589
const string PLAYER_CHAT_MSG
Definition constants.c:592
const string DIRECT_CHAT_MSG
Definition constants.c:587
const string ADMIN_CHAT_MSG
Definition constants.c:591
const int COLOR_RED
Definition constants.c:64
const int COLOR_WHITE
Definition constants.c:63
const int COLOR_YELLOW
Definition constants.c:67
ErrorExSeverity
Definition endebug.c:62
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
const string OPTIONS_SOUND_AMBIENT_SOUND_MODE
Definition constants.c:611
array< string > TStringArray
Definition enscript.c:709
GamepadButton
Definition ensystem.c:341
const string SHOW_QUICKBAR
Definition constants.c:600
const string SHOW_SERVERINFO
Definition constants.c:608
const string SHOW_HUD_VEHICLE
Definition constants.c:602
const string SHOW_HUD
Definition constants.c:601
const string SHOW_CONNECTIVITYINFO
Definition constants.c:605
const string HUD_BRIGHTNESS
Definition constants.c:603
const string ENABLE_BLEEDINGINDICATION
Definition constants.c:604
const string SHOW_CROSSHAIR
Definition constants.c:607
KeyCode
Definition ensystem.c:157
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const int MENU_TITLE_SCREEN
Definition constants.c:196
const int MENU_LOGIN_TIME
Definition constants.c:207
const int MENU_MAIN
Definition constants.c:182
const int MENU_SERVER_BROWSER
Definition constants.c:200
const int MENU_LOGIN_QUEUE
Definition constants.c:199
const int MENU_WARNING_INPUTDEVICE_DISCONNECT
Definition constants.c:212
const int MENU_EARLYACCESS
Definition constants.c:176
const int MENU_INVENTORY
Definition constants.c:180
class JsonUndergroundAreaTriggerData GetPosition
proto bool GetCLIParam(string param, out string val)
Returns command line argument.
bool GetProfileValueBool(string name, bool def=false)
Return value from profile variable, if variable with given name is not present, default value is retu...
Definition tools.c:1021
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
float m_duration
Definition tools.c:223
array< TimerBase > m_timerQueue
Definition tools.c:225
const int CALL_CATEGORY_GUI
Definition tools.c:9
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
void OnTimer()
DEPRECATED.
Definition tools.c:350
const int CALL_CATEGORY_COUNT
Definition tools.c:12
const int IDC_MAIN_QUIT
Definition constants.c:144
TypeID EventType
Definition enwidgets.c:55
Icon x
Icon y
ImpactTypes
void Close()
PlayerBase GetPlayer()
class NoiseSystem NoiseParams()
Definition noise.c:15
NotificationType
DEPRECATED (moved into NotificationSystem)
void SetTime(float time)
DEPRECATED.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
proto native UAInputAPI GetUApi()