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