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();
33 proto native
Object GetHitObj();
34 proto native
vector GetHitObjPos();
35 proto native
vector GetHitObjRot();
36 proto native
int GetComponentIndex();
39 class TerrainCollisionInfo: CollisionInfoBase
48 static void RegisterSoundSet(
string sound_set)
50 m_Mappings.Set(sound_set.Hash(), sound_set);
53 static string GetSoundSetByHash(
int hash)
57 m_Mappings.Find(hash,sound_set);
66 protected bool m_IsStatic;
67 protected float m_HintTimeAccu;
69 override void Update(
float timeslice)
73 m_HintTimeAccu += timeslice;
74 if (CanChangeHintPage(m_HintTimeAccu))
81 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
87 protected void Leave()
89 g_Game.SetGameState(DayZGameState.MAIN_MENU);
90 g_Game.SetLoadState(DayZLoadState.MAIN_MENU_START);
97 protected bool CanChangeHintPage(
float timeAccu);
114 g_Game.SetKeyboardHandle(
this);
119 g_Game.SetKeyboardHandle(NULL);
124 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/dialog_queue_position.layout");
125 m_HintPanel =
new UiHintPanelLoading(layoutRoot.FindAnyWidget(
"hint_frame0"));
128 m_btnLeave = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btnLeave"));
130 layoutRoot.FindAnyWidget(
"notification_root").Show(
false);
132 #ifdef PLATFORM_CONSOLE
133 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(
true);
135 toolbar_b.SetText(
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"", EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
137 #ifdef BUILD_EXPERIMENTAL
138 layoutRoot.FindAnyWidget(
"notification_root").Show(
true);
148 super.OnClick(w,
x,
y, button);
161 layoutRoot.Show(
true);
168 layoutRoot.Show(
false);
183 return timeAccu >=
GameConstants.LOADING_SCREEN_HINT_INTERVAL;
191 void LoginQueueStatic()
205 protected bool m_IsRespawn;
211 g_Game.SetKeyboardHandle(
this);
220 g_Game.SetKeyboardHandle(
null);
226 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/dialog_login_time.layout");
228 m_txtDescription =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"txtDescription"));
229 m_txtLabel =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"txtLabel"));
230 m_btnLeave = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"btnLeave"));
231 m_txtDescription.Show(
true);
232 layoutRoot.FindAnyWidget(
"notification_root").Show(
false);
234 #ifdef PLATFORM_CONSOLE
235 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(
true);
237 toolbar_b.SetText(
InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIBack",
"", EUAINPUT_DEVICE_CONTROLLER,
InputUtils.ICON_SCALE_TOOLBAR));
239 #ifdef BUILD_EXPERIMENTAL
240 layoutRoot.FindAnyWidget(
"notification_root").Show(
true);
250 super.OnClick(w,
x,
y, button);
263 layoutRoot.Show(
true);
264 m_HintPanel =
new UiHintPanelLoading(layoutRoot.FindAnyWidget(
"hint_frame0"));
271 layoutRoot.Show(
false);
278 TimeConversions.ConvertSecondsToFullTime(time, m_FullTime);
280 text =
"#menu_loading_in_";
282 text =
"#dayz_game_spawning_in_";
284 if (m_FullTime.m_Days > 0)
286 else if (m_FullTime.m_Hours > 0)
288 else if (m_FullTime.m_Minutes > 0)
293 text =
Widget.TranslateString(text);
294 text =
string.Format(text, m_FullTime.m_Seconds, m_FullTime.m_Minutes, m_FullTime.m_Hours, m_FullTime.m_Days);
295 m_txtLabel.SetText(text);
297 if (m_IsRespawn && time <= 1)
298 GetGame().SetLoginTimerFinished();
303 m_txtDescription.SetText(status);
306 void SetRespawn(
bool value)
318 return timeAccu >=
GameConstants.LOADING_SCREEN_HINT_INTERVAL && m_FullTime.m_Seconds >=
GameConstants.LOADING_SCREEN_HINT_INTERVAL_MIN;
325 void LoginTimeStatic()
332 void ~LoginTimeStatic()
341 private ref
Widget m_WidgetRoot;
343 private float m_duration;
347 m_WidgetRoot = game.GetWorkspace().CreateWidgets(
"gui/layouts/day_z_connection_lost.layout");
358 if (
g_Game.GetUIManager().IsDialogVisible())
360 g_Game.GetUIManager().HideDialog();
376 void SetText(
string text)
386 void SetDuration(
float duration)
411 void RegisterProfileOption(
EDayZProfilesOptions option,
string profileOptionName,
bool def =
true)
413 if (!m_DayZProfilesOptionsBool.Contains(option))
419 SetProfileOptionBool(option, profileVal);
423 void RegisterProfileOptionBool(
EDayZProfilesOptions option,
string profileOptionName,
bool defaultValue =
true)
425 RegisterProfileOption(option, profileOptionName, defaultValue);
428 void RegisterProfileOptionInt(
EDayZProfilesOptions option,
string profileOptionName,
int defaultValue = 0)
430 if (!m_DayZProfilesOptionsInt.Contains(option))
434 GetGame().GetProfileString(profileOptionName, outValue);
435 int value = outValue.ToInt();
437 m_DayZProfilesOptionsInt.Set(option,
new DayZProfilesOptionInt(profileOptionName, value, defaultValue));
438 SetProfileOptionInt(option, value);
442 void RegisterProfileOptionFloat(
EDayZProfilesOptions option,
string profileOptionName,
float defaultValue = 0.0)
444 if (!m_DayZProfilesOptionsFloat.Contains(option))
448 GetGame().GetProfileString(profileOptionName, outValue);
449 float value = outValue.ToFloat();
452 SetProfileOptionFloat(option, value);
456 void ResetOptionsBool()
458 if (!m_DayZProfilesOptionsBool)
466 SetProfileOptionBool(e_opt, profileVal);
475 void ResetOptionsInt()
477 if (!m_DayZProfilesOptionsInt)
485 GetGame().GetProfileString(r_opt.param1, outValue);
486 int value = outValue.ToInt();
487 SetProfileOptionInt(e_opt, value);
491 void ResetOptionsFloat()
493 if (!m_DayZProfilesOptionsFloat)
501 GetGame().GetProfileString(r_opt.param1, outValue);
502 float value = outValue.ToFloat();
503 SetProfileOptionFloat(e_opt, value);
509 if (m_DayZProfilesOptionsBool && m_DayZProfilesOptionsBool.Contains(option))
514 GetGame().SetProfileString(po.param1, value.ToString());
521 SetProfileOption(option, value);
526 if (m_DayZProfilesOptionsInt && m_DayZProfilesOptionsInt.Contains(option))
531 GetGame().SetProfileString(po.param1, value.ToString());
538 if (m_DayZProfilesOptionsFloat && m_DayZProfilesOptionsFloat.Contains(option))
543 GetGame().SetProfileString(po.param1, value.ToString());
550 if (m_DayZProfilesOptionsBool && m_DayZProfilesOptionsBool.Contains(option))
561 return GetProfileOption(option);
566 if (m_DayZProfilesOptionsInt && m_DayZProfilesOptionsInt.Contains(option))
577 if (m_DayZProfilesOptionsFloat && m_DayZProfilesOptionsFloat.Contains(option))
588 return GetProfileOptionDefaultBool(option);
593 if (m_DayZProfilesOptionsBool && m_DayZProfilesOptionsBool.Contains(option))
605 if (m_DayZProfilesOptionsInt && m_DayZProfilesOptionsInt.Contains(option))
617 if (m_DayZProfilesOptionsFloat && m_DayZProfilesOptionsFloat.Contains(option))
629 if (m_DayZProfilesOptions)
630 return m_DayZProfilesOptions;
668 MISSION_CONTROLLER_SELECT
696 m_WidgetRoot = game.GetLoadingWorkspace().CreateWidgets(
"gui/layouts/loading.layout");
715 m_WidgetRoot.FindAnyWidget(
"notification_root").Show(
false);
717 #ifdef PLATFORM_CONSOLE
719 #ifdef BUILD_EXPERIMENTAL
723 expNotification.Show(
true);
737 game.GetBacklit().LoadingAnim();
824 if (
m_DayZGame.GetUIManager().IsDialogVisible())
829 if (
m_DayZGame.GetMissionState() == DayZGame.MISSION_STATE_MAINMENU)
878 const int MISSION_STATE_MAINMENU = 0;
879 const int MISSION_STATE_GAME = 1;
880 const int MISSION_STATE_FINNISH = 2;
883 private EConnectivityStatLevel m_ConnectivityStatsStates[STATS_COUNT];
885 private int m_MissionState;
888 protected DayZGameState m_GameState;
889 protected DayZLoadState m_LoadState;
891 protected bool m_FirstConnect =
true;
897 private int m_LoginTime;
904 private ref DragQueue m_dragQueue;
906 private bool m_early_access_dialog_accepted;
909 private string m_MissionPath;
910 private string m_MissionFolderPath;
911 private bool m_IsCtrlHolding;
912 private bool m_IsWinHolding;
913 private bool m_IsLeftAltHolding;
914 private bool m_IsRightAltHolding;
916 private bool m_IsWorldWetTempUpdateEnabled =
true;
917 private bool m_IsFoodDecayEnabled =
true;
918 private float m_FoodDecayModifier;
920 static bool m_ReportModded;
921 private bool m_IsStressTest;
922 private bool m_AimLoggingEnabled;
923 int m_OriginalCharactersCount;
924 private string m_PlayerName;
925 private bool m_IsNewCharacter;
926 private bool m_IsConnecting;
927 private bool m_ConnectFromJoin;
928 private bool m_ShouldShowControllerDisconnect;
929 private bool m_CursorDesiredVisibilityScript =
true;
930 private int m_PreviousGamepad;
931 private float m_UserFOV;
933 private float m_DeltaTime;
935 float m_volume_sound;
936 float m_volume_speechEX;
937 float m_volume_music;
939 float m_volume_radio;
941 float m_PreviousEVValue;
944 #ifdef DIAG_DEVELOPER
955 private ref
array<int> m_ConnectedInputDeviceList;
962 private const int MIN_ARTY_SOUND_RANGE = 300;
966 static bool m_IsPreviewSpawn;
968 #ifdef DIAG_DEVELOPER
969 ref CameraToolsMenuServer m_CameraToolsMenuServer;
976 #ifdef PLATFORM_CONSOLE
977 SetMainMenuWorld(
"MainMenuSceneXbox");
979 m_MissionState = MISSION_STATE_GAME;
981 m_keyboard_handler =
null;
984 m_early_access_dialog_accepted =
true;
996 m_dragQueue =
new DragQueue;
1001 if (CommandlineGetParam(
"stresstest", tmp))
1003 m_IsStressTest =
true;
1006 if (CommandlineGetParam(
"doAimLogs", tmp))
1008 m_AimLoggingEnabled =
true;
1013 m_Backlit.OnInit(
this);
1015 m_ReportModded = GetModToBeReported();
1018 if (m_loading ==
null)
1025 m_loading.ShowEx(
this);
1028 RefreshMouseCursorVisibility();
1043 string path =
"cfgVehicles";
1044 string child_name =
"";
1045 int count = ConfigGetChildrenCount(
path);
1047 for (
int p = 0; p < count; ++p)
1049 ConfigGetChildName(
path, p, child_name);
1051 if (ConfigGetInt(
path +
" " + child_name +
" scope") == 2 && IsKindOf(child_name,
"SurvivorBase"))
1052 m_CharClassNames.Insert(child_name);
1055 m_IsConnecting =
false;
1056 m_ConnectFromJoin =
false;
1060 private void ~DayZGame()
1068 Print(
"~DayZGame()");
1077 GetInput().UpdateConnectedInputDeviceList();
1079 m_UserFOV = GetUserFOVFromConfig();
1081 m_volume_sound = GetSoundScene().GetSoundVolume();
1082 m_volume_speechEX = GetSoundScene().GetSpeechExVolume();
1083 m_volume_music = GetSoundScene().GetMusicVolume();
1084 m_volume_VOIP = GetSoundScene().GetVOIPVolume();
1085 m_volume_radio = GetSoundScene().GetRadioVolume();
1088 GetMenuDefaultCharacterData();
1096 m_IsWorldWetTempUpdateEnabled = (
GetCEApi().GetCEGlobalInt(
"WorldWetTempUpdate") == 1);
1098 m_FoodDecayModifier =
GetCEApi().GetCEGlobalFloat(
"FoodDecay");
1101 if (m_FoodDecayModifier ==
float.
MIN)
1103 m_FoodDecayModifier =
GetCEApi().GetCEGlobalInt(
"FoodDecay");
1112 void RegisterProfilesOptions()
1130 void ResetProfileOptions()
1132 m_DayZProfileOptions.ResetOptionsBool();
1133 m_DayZProfileOptions.ResetOptionsInt();
1134 m_DayZProfileOptions.ResetOptionsFloat();
1138 void SetMissionPath(
string path)
1140 m_MissionPath =
path;
1145 while (pos_cur != -1)
1148 pos_cur =
path.IndexOfFrom(pos_cur + 1 ,
"\\");
1151 m_MissionFolderPath =
path.Substring(0, pos_end);
1154 string GetMissionPath()
1156 return m_MissionPath;
1159 string GetMissionFolderPath()
1161 return m_MissionFolderPath;
1166 return m_callQueue[call_category];
1171 return m_updateQueue[call_category];
1174 override ScriptInvoker GetPostUpdateQueue(
int call_category)
1176 return m_postUpdateQueue[call_category];
1179 override TimerQueue GetTimerQueue(
int call_category)
1184 override DragQueue GetDragQueue()
1190 void OnGameplayDataHandlerLoad()
1197 int GetMissionState()
1199 return m_MissionState;
1203 void SetMissionState(
int state)
1205 m_MissionState = state;
1211 return m_DayZProfileOptions.GetProfileOption(option);
1216 return GetProfileOption(option);
1221 return m_DayZProfileOptions.GetProfileOptionInt(option);
1226 return m_DayZProfileOptions.GetProfileOptionFloat(option);
1231 return m_DayZProfileOptions.GetProfileOptionDefaultBool(option);
1236 return GetProfileOptionDefault(option);
1241 return m_DayZProfileOptions.GetProfileOptionDefaultInt(option);
1246 return m_DayZProfileOptions.GetProfileOptionDefaultFloat(option);
1251 m_DayZProfileOptions.SetProfileOptionBool(option, value);
1256 SetProfileOption(option, value);
1261 m_DayZProfileOptions.SetProfileOptionInt(option, value);
1266 m_DayZProfileOptions.SetProfileOptionFloat(option, value);
1271 return m_DayZProfileOptions.GetProfileOptionMap();
1276 return m_IsStressTest;
1279 bool IsAimLogEnabled()
1281 return m_AimLoggingEnabled;
1284 void SetGameState(DayZGameState state)
1286 m_GameState = state;
1289 DayZGameState GetGameState()
1294 void SetLoadState(DayZLoadState state)
1296 m_LoadState = state;
1299 DayZLoadState GetLoadState()
1304 static bool ReportModded()
1306 return m_ReportModded;
1315 override bool IsInventoryOpen()
1329 if (!m_early_access_dialog_accepted)
1332 m_early_access_dialog_accepted =
true;
1344 return mission.CreateScriptedMenu(
id);
1351 void ReloadMission()
1354 Print(
"Reloading mission module!");
1360 void CancelLoginQueue()
1364 if (m_LoginQueue.IsStatic())
1366 m_LoginQueue.Hide();
1367 delete m_LoginQueue;
1371 m_LoginQueue.Close();
1376 void CancelLoginTimeCountdown()
1380 if (m_LoginTimeScreen)
1382 if (m_LoginTimeScreen.IsStatic())
1384 m_LoginTimeScreen.Hide();
1385 delete m_LoginTimeScreen;
1389 m_LoginTimeScreen.Close();
1394 private void ClearConnectivityStates()
1396 for (
int i = 0; i < STATS_COUNT; i++)
1397 m_ConnectivityStatsStates[i] = 0;
1408 switch (eventTypeId)
1421 ClearConnectivityStates();
1423 m_FirstConnect =
true;
1430 CancelLoginTimeCountdown();
1431 SetConnecting(
false);
1432 SetGameState(DayZGameState.MAIN_MENU);
1433 m_FirstConnect =
true;
1434 #ifdef PLATFORM_CONSOLE
1435 if (GetUserManager().GetSelectedUser())
1439 if (GetGameState() == DayZGameState.IN_GAME)
1441 SetLoadState(DayZLoadState.MAIN_MENU_START);
1444 m_Notifications.ClearVoiceNotifications();
1449 discData.m_CharacterId =
g_Game.GetDatabaseID();
1450 discData.m_Reason =
"quit";
1458 SetConnecting(
false);
1461 if (GetGameState() == DayZGameState.CONNECTING)
1463 SetGameState(DayZGameState.MAIN_MENU);
1473 SetGameState(DayZGameState.IN_GAME);
1477 spawnData.m_CharacterId =
g_Game.GetDatabaseID();
1478 spawnData.m_Lifetime = 0;
1479 spawnData.m_Position =
vector.Zero;
1482 spawnData.m_Position =
GetPlayer().GetPosition();
1484 spawnData.m_DaytimeHour = 0;
1485 spawnData.m_Population = 0;
1488 #ifdef PLATFORM_CONSOLE
1489 m_Notifications.ClearVoiceNotifications();
1494 m_FirstConnect =
false;
1495 if (GetHostAddress(address, port))
1497 AddVisitedServer(address, port);
1500 #ifdef PLATFORM_CONSOLE
1501 #ifndef PLATFORM_WINDOWS // if app is not on Windows with -XBOX parameter
1502 if (
null != GetUserManager().GetSelectedUser())
1511 UpdateInputDeviceDisconnectWarning();
1518 if (
Class.CastTo(conLost_params, params))
1520 int duration = conLost_params.param1;
1521 OnMPConnectionLostEvent(duration);
1538 if (
Class.CastTo(chat_params, params))
1547 if (
Class.CastTo(prog_params, params))
1548 LoadProgressUpdate(prog_params.param1, prog_params.param2, prog_params.param3);
1554 if (
Class.CastTo(loginTimeParams, params))
1556 OnLoginTimeEvent(loginTimeParams.param1);
1563 if (
Class.CastTo(respawnParams, params))
1565 OnRespawnEvent(respawnParams.param1);
1572 if (
Class.CastTo(preloadParams, params))
1574 OnPreloadEvent(preloadParams.param1);
1581 if (
Class.CastTo(logoutParams, params))
1583 GetCallQueue(
CALL_CATEGORY_GUI).Call(GetMission().StartLogoutMenu, logoutParams.param1);
1595 Class.CastTo(loginStatusParams, params);
1597 string msg1 = loginStatusParams.param1;
1598 string msg2 = loginStatusParams.param2;
1602 if (m_LoginTimeScreen)
1606 if (msg2.Length() > 0)
1607 finalMsg +=
"\n" + msg2;
1609 m_LoginTimeScreen.SetStatus(finalMsg);
1614 finalMsg = msg1 +
" " + msg2;
1615 m_loading.SetStatus(finalMsg);
1621 g_Game.SetGameState(DayZGameState.CONNECTING);
1622 SetConnecting(
true);
1627 g_Game.SetGameState(DayZGameState.MAIN_MENU);
1628 SetConnecting(
false);
1629 if (m_ConnectFromJoin)
1631 m_ConnectFromJoin =
false;
1639 if (
Class.CastTo(dlcParams, params))
1641 Print(
"### DLC Ownership failed !!! Map: " + dlcParams.param1);
1648 if (
Class.CastTo(connectivityStatsParams, params))
1652 int pingAvg = playerIdentity.GetPingAvg();
1653 if (pingAvg < GetWorld().GetPingWarningThreshold())
1657 else if (pingAvg < GetWorld().GetPingCriticalThreshold())
1671 if (
Class.CastTo(serverFpsStatsParams, params))
1673 #ifdef DIAG_DEVELOPER
1674 m_ServerFpsStatsParams = serverFpsStatsParams;
1676 float fps = serverFpsStatsParams.param1;
1677 if (fps > GetWorld().GetServerFpsWarningThreshold())
1681 else if (fps > GetWorld().GetServerFpsCriticalThreshold())
1694 VONManager.GetInstance().OnEvent(eventTypeId, params);
1699 mission.OnEvent(eventTypeId, params);
1704 emh.OnEvent(eventTypeId, params);
1709 if (level != m_ConnectivityStatsStates[type])
1711 if (OnConnectivityStatChange(type, level, m_ConnectivityStatsStates[type]))
1713 m_ConnectivityStatsStates[type] = level;
1718 protected bool OnConnectivityStatChange(
EConnectivityStatType type, EConnectivityStatLevel newLevel, EConnectivityStatLevel oldLevel)
1726 hud.SetConnectivityStatIcon(type, newLevel);
1730 #ifdef DIAG_DEVELOPER
1731 private void DrawPerformaceStats(
float pingAct,
float pingAvg)
1733 DbgUI.Begin(
"Performance Stats", 10, 520);
1734 DbgUI.Text(
"pingAct:" + pingAct );
1736 if ( pingAvg >= GetWorld().GetPingCriticalThreshold())
1738 else if ( pingAvg >= GetWorld().GetPingWarningThreshold())
1741 DbgUI.ColoredText(color,
"pingAvg:" + pingAvg);
1742 DbgUI.Text(
"Ping Warning Threshold:" + GetWorld().GetPingWarningThreshold());
1743 DbgUI.Text(
"Ping Critical Threshold:" + GetWorld().GetPingCriticalThreshold());
1744 DbgUI.PlotLive(
"pingAvg history:", 300,150, pingAvg, 2000, 100 );
1745 DbgUI.Text(
"Server Fps Warning Threshold:" + GetWorld().GetServerFpsWarningThreshold());
1746 DbgUI.Text(
"Server Fps Critical Threshold:" + GetWorld().GetServerFpsCriticalThreshold());
1747 if (m_ServerFpsStatsParams)
1750 if ( m_ServerFpsStatsParams.param1 <= GetWorld().GetServerFpsCriticalThreshold())
1752 else if ( m_ServerFpsStatsParams.param1 <= GetWorld().GetServerFpsWarningThreshold())
1754 DbgUI.ColoredText(color,
"serverFPS:" + m_ServerFpsStatsParams.param1.ToString() );
1755 DbgUI.PlotLive(
"serverFPS history:", 300,150, m_ServerFpsStatsParams.param1, 6000, 100 );
1763 m_Notifications.AddVoiceNotification(vonStartParams.param2, vonStartParams.param1);
1768 m_Notifications.RemoveVoiceNotification(vonStopParams.param2);
1772 void UpdateLoginQueue(
float timeslice)
1774 int pos = GetUIManager().GetLoginQueuePosition();
1777 if (!m_LoginQueue && pos > 0)
1779 GetUIManager().CloseAll();
1784 EnterLoginQueue(parent);
1788 m_LoginQueue =
new LoginQueueStatic();
1789 GetUIManager().ShowScriptedMenu(m_LoginQueue,
null);
1794 m_LoginQueue.SetPosition(pos);
1797 LoginQueueStatic loginQueue;
1800 loginQueue.Update(timeslice);
1806 void OnLoginTimeEvent(
int loginTime)
1812 GetUserManager().GetUserDatabaseIdAsync();
1814 m_LoginTime = loginTime;
1817 if (m_LoginTime > 0)
1819 if (!m_LoginTimeScreen)
1821 GetUIManager().CloseAll();
1826 EnterLoginTime(parent);
1830 m_LoginTimeScreen =
new LoginTimeStatic();
1831 GetUIManager().ShowScriptedMenu(m_LoginTimeScreen,
null);
1835 m_LoginTimeScreen.SetTime(m_LoginTime);
1836 m_LoginTimeScreen.Show();
1844 void LoginTimeCountdown()
1846 if (m_LoginTime > 0)
1848 if (m_LoginTimeScreen)
1849 m_LoginTimeScreen.SetTime(m_LoginTime);
1856 CancelLoginTimeCountdown();
1861 void OnRespawnEvent(
int time)
1867 if (!m_LoginTimeScreen)
1869 GetUIManager().CloseAll();
1872 EnterLoginTime(parent);
1875 m_LoginTimeScreen.SetRespawn(
true);
1876 m_LoginTimeScreen.SetTime(m_LoginTime);
1877 m_LoginTimeScreen.Show();
1885 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Start(
new Param1<float>(1.0));
1889 void OnPreloadEvent(
vector pos)
1892 if (m_LoginTimeScreen && !m_LoginTimeScreen.IsRespawn())
1893 CancelLoginTimeCountdown();
1896 StoreLoginDataPrepare();
1901 void StoreLoginDataPrepare()
1906 GetMenuDefaultCharacterData().SerializeCharacterData(ctx.GetWriteContext());
1907 StoreLoginData(ctx.GetWriteContext());
1923 void OnMPConnectionLostEvent(
int duration)
1932 if (duration < 0 && GetGameState() == DayZGameState.IN_GAME)
1944 void LoadProgressUpdate(
int progressState,
float progress,
string title)
1947 switch (progressState)
1953 GetUIManager().ScreenFadeOut(0);
1956 m_loading.SetTitle(title);
1957 if (m_loading.m_HintPanel)
1958 m_loading.m_HintPanel.ShowRandomPage();
1971 m_loading.SetProgress(progress);
1978 m_loading.SetProgress(0);
1986 override void OnAfterCreate()
1992 override void OnActivateMessage()
1994 RefreshMouseCursorVisibility();
1998 override void OnDeactivateMessage()
2000 RefreshMouseCursorVisibility();
2004 override bool OnInitialize()
2008 RegisterProfilesOptions();
2009 SetHudBrightness(GetHUDBrightnessSetting());
2011 InitNotifications();
2013 GetProfileStringList(
"SB_Visited", m_Visited);
2015 if (GetLoadState() == DayZLoadState.UNDEFINED)
2022 #ifndef PLATFORM_PS4
2023 CreateTitleScreen();
2049 void InitNotifications()
2055 protected ref
Widget m_IntroMenu;
2056 protected ref
Widget m_GamepadDisconnectMenu;
2057 protected int m_PrevBlur;
2059 protected string m_DatabaseID;
2061 protected string m_ConnectAddress;
2062 protected int m_ConnectPort;
2063 protected string m_ConnectPassword;
2065 protected const int MAX_VISITED = 50;
2068 string GetDatabaseID()
2070 return m_DatabaseID;
2073 void SetDatabaseID(
string id)
2076 if (GetUIManager().GetMenu())
2078 GetUIManager().GetMenu().Refresh();
2082 void CreateTitleScreen()
2084 DeleteTitleScreen();
2085 m_IntroMenu = GetWorkspace().CreateWidgets(
"gui/layouts/xbox/day_z_title_screen.layout");
2087 m_IntroMenu.FindAnyWidget(
"notification_root").Show(
false);
2090 string text =
Widget.TranslateString(
"#console_start_game");
2091 #ifdef PLATFORM_XBOX
2093 if (user_manager && user_manager.GetSelectedUser())
2094 text_widget.SetText(
string.Format(text,
"<image set=\"xbox_buttons\" name=\"A\" />"));
2096 text_widget.SetText(
string.Format(text,
"<image set=\"xbox_buttons\" name=\"A\" />"));
2100 string confirm =
"cross";
2109 text_widget.SetText(
string.Format(text,
"<image set=\"playstation_buttons\" name=\"" + confirm +
"\" />"));
2113 #ifdef PLATFORM_CONSOLE
2114 #ifdef PLATFORM_XBOX
2115 #ifdef BUILD_EXPERIMENTAL
2116 m_IntroMenu.FindAnyWidget(
"notification_root").Show(
true);
2122 void DeleteTitleScreen()
2130 bool ShouldShowControllerDisconnect()
2132 return m_ShouldShowControllerDisconnect;
2135 void UpdateInputDeviceDisconnectWarning()
2137 #ifdef PLATFORM_CONSOLE
2140 m_ShouldShowControllerDisconnect = !
GetInput().AreAllAllowedInputDevicesActive();
2141 if (m_ShouldShowControllerDisconnect)
2151 SetGameState(DayZGameState.JOIN);
2152 SetLoadState(DayZLoadState.JOIN_START);
2154 #ifdef PLATFORM_CONSOLE
2159 user_manager.ParseJoinAsync(join_param);
2164 void ConnectLaunch()
2167 if (user_manager.GetTitleInitiator())
2169 user_manager.SelectUserEx(user_manager.GetTitleInitiator());
2172 SetGameState(DayZGameState.CONNECT);
2173 SetLoadState(DayZLoadState.CONNECT_START);
2175 #ifndef PLATFORM_WINDOWS
2176 #ifdef PLATFORM_CONSOLE
2177 CreateTitleScreen();
2187 SetGameState(DayZGameState.PARTY);
2188 SetLoadState(DayZLoadState.PARTY_START);
2194 user_manager.ParsePartyAsync(param);
2195 StartRandomCutscene(GetMainMenuWorld());
2199 void MainMenuLaunch()
2201 #ifdef PLATFORM_WINDOWS
2205 if (user_manager.GetTitleInitiator())
2207 user_manager.SelectUserEx(user_manager.GetTitleInitiator());
2212 SetGameState(DayZGameState.MAIN_MENU);
2213 SetLoadState(DayZLoadState.MAIN_MENU_START);
2214 StartRandomCutscene(GetMainMenuWorld());
2215 DeleteTitleScreen();
2218 void MissionLaunch()
2223 if (user_manager.GetTitleInitiator())
2225 user_manager.SelectUserEx(user_manager.GetTitleInitiator());
2229 SetGameState(DayZGameState.IN_GAME);
2230 SetLoadState(DayZLoadState.MISSION_START);
2233 #ifndef PLATFORM_WINDOWS
2234 #ifdef PLATFORM_CONSOLE
2236 CreateTitleScreen();
2248 void SelectUser(
int gamepad = -1)
2256 GetInput().GetGamepadUser(gamepad, selected_user);
2261 if (user_manager.SelectUserEx(selected_user))
2264 GetInput().SelectActiveGamepad(gamepad);
2268 selected_user = user_manager.GetSelectedUser();
2272 if (!selected_user.IsOnline())
2274 user_manager.LogOnUserAsync(selected_user);
2289 selected_user = user_manager.GetSelectedUser();
2293 user_manager.PickUserAsync();
2297 user_manager.SelectUserEx(selected_user);
2299 switch (GetLoadState())
2301 case DayZLoadState.JOIN_START:
2303 SetLoadState(DayZLoadState.JOIN_USER_SELECT);
2306 case DayZLoadState.PARTY_START:
2308 SetLoadState(DayZLoadState.PARTY_USER_SELECT);
2311 case DayZLoadState.MAIN_MENU_START:
2313 SetLoadState(DayZLoadState.MAIN_MENU_USER_SELECT);
2316 case DayZLoadState.CONNECT_START:
2318 SetLoadState(DayZLoadState.CONNECT_USER_SELECT);
2321 case DayZLoadState.MISSION_START:
2323 SetLoadState(DayZLoadState.MISSION_USER_SELECT);
2331 g_Game.SetHudBrightness(
g_Game.GetHUDBrightnessSetting());
2335 void SetPreviousGamepad(
int gamepad)
2337 m_PreviousGamepad = gamepad;
2340 int GetPreviousGamepad()
2342 return m_PreviousGamepad;
2348 if (
GetInput().IsActiveGamepadSelected())
2351 DeleteTitleScreen();
2357 #ifdef PLATFORM_CONSOLE
2358 #ifndef PLATFORM_WINDOWS
2360 if (GetUserManager().GetSelectedUser())
2362 int gamepad =
GetInput().GetUserGamepad(GetUserManager().GetSelectedUser());
2365 SelectUser(gamepad);
2370 CreateTitleScreen();
2377 if (!m_IntroMenu && !(GetUIManager().GetMenu() && GetUIManager().GetMenu().
GetID() ==
MENU_TITLE_SCREEN))
2378 CreateTitleScreen();
2387 void SelectGamepad()
2389 ResetProfileOptions();
2394 BiosUser selected_user = user_manager.GetSelectedUser();
2398 SetPlayerName(selected_user.GetName());
2399 SetUserFOV(GetUserFOVFromConfig());
2400 #ifdef PLATFORM_CONSOLE
2401 SetPlayerGameName(selected_user.GetName());
2402 user_manager.GetUserDatabaseIdAsync();
2406 if (GetUIManager().GetMenu())
2408 GetUIManager().GetMenu().Refresh();
2412 switch (GetLoadState())
2414 case DayZLoadState.JOIN_USER_SELECT:
2416 SetLoadState(DayZLoadState.JOIN_CONTROLLER_SELECT);
2420 case DayZLoadState.PARTY_USER_SELECT:
2422 SetLoadState(DayZLoadState.PARTY_CONTROLLER_SELECT);
2423 DeleteTitleScreen();
2427 case DayZLoadState.CONNECT_USER_SELECT:
2429 SetLoadState(DayZLoadState.CONNECT_CONTROLLER_SELECT);
2433 case DayZLoadState.MAIN_MENU_USER_SELECT:
2435 SetLoadState(DayZLoadState.MAIN_MENU_CONTROLLER_SELECT);
2436 DeleteTitleScreen();
2437 GetUIManager().EnterScriptedMenu(
MENU_MAIN, GetUIManager().GetMenu());
2440 case DayZLoadState.MISSION_USER_SELECT:
2442 SetLoadState(DayZLoadState.MISSION_CONTROLLER_SELECT);
2443 DeleteTitleScreen();
2454 if (GetLoadState() == DayZLoadState.JOIN_CONTROLLER_SELECT)
2456 SetGameState(DayZGameState.CONNECTING);
2461 if (GetGameState() != DayZGameState.CONNECTING)
2463 switch (GetLoadState())
2465 case DayZLoadState.CONNECT_CONTROLLER_SELECT:
2467 SetGameState(DayZGameState.CONNECTING);
2471 case DayZLoadState.PARTY_CONTROLLER_SELECT:
2473 SetGameState(DayZGameState.CONNECTING);
2477 case DayZLoadState.MAIN_MENU_CONTROLLER_SELECT:
2479 SetGameState(DayZGameState.CONNECTING);
2489 if (GetHostAddress(address, port))
2491 if (m_ConnectAddress == address && m_ConnectPort == port)
2498 DisconnectSessionForce();
2499 DisconnectSessionScript();
2506 bool GetLastVisitedServer(out
string ip, out
int port)
2510 if (m_Visited.Count() > 0)
2512 string uid = m_Visited.Get(m_Visited.Count() - 1);
2514 uid.Split(
":", output);
2516 port = output[1].ToInt();
2523 void AddVisitedServer(
string ip,
int port)
2525 string uid = ip +
":" + port;
2528 int pos = m_Visited.Find(uid);
2532 if (m_Visited.Count() == MAX_VISITED)
2533 m_Visited.Remove(0);
2534 m_Visited.Insert(uid);
2539 if (pos != (m_Visited.Count() - 1))
2541 m_Visited.Remove(pos);
2542 m_Visited.Insert(uid);
2545 SetProfileStringList(
"SB_Visited", m_Visited);
2550 bool IsVisited(
string ip,
int port)
2552 string uid = ip +
":" + port;
2553 int index = m_Visited.Find(uid);
2554 return (index >= 0);
2557 void RefreshCurrentServerInfo()
2561 if (GetHostAddress(addr, port))
2563 m_ConnectAddress = addr;
2564 m_ConnectPort = port;
2566 OnlineServices.GetCurrentServerInfo(m_ConnectAddress, m_ConnectPort);
2571 SetConnecting(
true);
2573 DeleteTitleScreen();
2576 if (GetHostAddress(addr, port))
2578 if (m_ConnectAddress == addr && m_ConnectPort == port)
2582 if (
Connect(GetUIManager().GetMenu(), m_ConnectAddress, m_ConnectPort, m_ConnectPassword) != 0)
2583 DisconnectSessionScript(
true);
2586 void DisconnectSessionScript(
bool displayJoinError =
false)
2589 if (displayJoinError)
2595 DisconnectSessionEx(flags);
2620 GetGame().GetUIManager().CloseAllSubmenus();
2622 if (
GetGame().GetUIManager().IsDialogVisible() )
2624 GetGame().GetUIManager().CloseDialog();
2630 DisconnectSessionForce();
2635 if (
g_Game.GetGameState() != DayZGameState.MAIN_MENU)
2642 GetGame().GetMission().AbortMission();
2644 SetGameState(DayZGameState.MAIN_MENU);
2645 SetLoadState(DayZLoadState.MAIN_MENU_CONTROLLER_SELECT);
2657 void ConnectFromServerBrowser(
string ip,
int port,
string password =
"")
2659 m_ConnectAddress = ip;
2660 m_ConnectPort = port;
2661 m_ConnectPassword = password;
2662 m_ConnectFromJoin =
false;
2666 void ConnectFromJoin(
string ip,
int port)
2668 m_ConnectAddress = ip;
2669 m_ConnectPort = port;
2670 m_ConnectFromJoin =
true;
2674 void ConnectFromCLI()
2680 m_ConnectPort = port.ToInt();
2684 m_ConnectFromJoin =
false;
2689 bool IsLeftCtrlDown()
2691 return m_IsCtrlHolding;
2695 override void OnKeyPress(
int key)
2698 if (key ==
KeyCode.KC_LCONTROL)
2700 m_IsCtrlHolding =
true;
2705 m_IsLeftAltHolding =
true;
2710 m_IsRightAltHolding =
true;
2713 if (m_keyboard_handler)
2715 m_keyboard_handler.OnKeyDown(NULL, 0, 0, key);
2725 if ((m_IsLeftAltHolding || m_IsLeftAltHolding) && key ==
KeyCode.KC_F4)
2734 override void OnKeyRelease(
int key)
2736 if (key ==
KeyCode.KC_LCONTROL)
2738 m_IsCtrlHolding =
false;
2743 m_IsWinHolding =
false;
2748 m_IsLeftAltHolding =
false;
2753 m_IsRightAltHolding =
false;
2756 if (m_keyboard_handler)
2758 m_keyboard_handler.OnKeyUp(NULL, 0, 0, key);
2769 override void OnMouseButtonPress(
int button)
2774 mission.OnMouseButtonPress(button);
2779 override void OnMouseButtonRelease(
int button)
2784 mission.OnMouseButtonRelease(button);
2789 override void OnDeviceReset()
2791 m_IsCtrlHolding =
false;
2792 m_IsWinHolding =
false;
2793 m_IsLeftAltHolding =
false;
2794 m_IsRightAltHolding =
false;
2804 override void OnUpdate(
bool doSim,
float timeslice)
2806 m_DeltaTime = timeslice;
2809 bool gameIsRunning =
false;
2813 gameIsRunning =
true;
2828 UpdateLoginQueue(timeslice);
2830 if (m_loading && m_loading.IsLoading())
2832 m_loading.OnUpdate(timeslice);
2834 else if (m_LoginTimeScreen && m_LoginTimeScreen.IsStatic())
2836 m_LoginTimeScreen.Update(timeslice);
2843 GetDragQueue().Tick();
2847 if (m_Notifications)
2849 m_Notifications.Update(timeslice);
2853 #ifdef DIAG_DEVELOPER
2860 int pingAct = playerIdentity.GetPingAct();
2861 int pingAvg = playerIdentity.GetPingAvg();
2864 DrawPerformaceStats(pingAct, pingAvg);
2880 override void OnPostUpdate(
bool doSim,
float timeslice)
2883 bool gameIsRunning =
false;
2887 gameIsRunning =
true;
2893 if (m_loading && m_loading.IsLoading())
2896 else if (m_LoginTimeScreen && m_LoginTimeScreen.IsStatic())
2914 super.OnRPC(sender, target, rpc_type, ctx);
2915 Event_OnRPC.Invoke(sender, target, rpc_type, ctx);
2922 target.OnRPC(sender, rpc_type, ctx);
2930 case ERPCs.RPC_CFG_GAMEPLAY_SYNC:
2935 case ERPCs.RPC_UNDERGROUND_SYNC:
2940 case ERPCs.RPC_SEND_NOTIFICATION:
2947 ctx.Read(show_time);
2948 ctx.Read(detail_text);
2953 case ERPCs.RPC_SEND_NOTIFICATION_EXTENDED:
2955 float show_time_ext;
2956 string title_text_ext;
2957 string detail_text_ext;
2960 ctx.Read(show_time_ext);
2961 ctx.Read(title_text_ext);
2962 ctx.Read(detail_text_ext);
2965 NotificationSystem.AddNotificationExtended(show_time_ext, title_text_ext, detail_text_ext, icon_ext);
2970 case ERPCs.RPC_SOUND_HELICRASH:
2978 if (ctx.Read(playCrashSound))
2980 playSound = playCrashSound.param1;
2981 pos = playCrashSound.param2;
2982 sound_set =
CrashSoundSets.GetSoundSetByHash(playCrashSound.param3);
2987 m_CrashSound =
SEffectManager.PlaySound(sound_set, pos, 0.1, 0.1);
2988 m_CrashSound.SetAutodestroy(
true);
2994 case ERPCs.RPC_SOUND_ARTILLERY:
2997 Param1<vector> playArtySound =
new Param1<vector>(
vector.Zero);
2998 if (ctx.Read(playArtySound))
3000 position = playArtySound.param1;
3001 if (position ==
vector.Zero)
3013 m_ArtySound =
SEffectManager.PlaySound(
"Artillery_Distant_Barrage_SoundSet", position, 0.1, 0.1);
3014 m_ArtySound.SetAutodestroy(
true);
3018 case ERPCs.RPC_SOUND_CONTAMINATION:
3022 Param1<vector> playContaminatedSound =
new Param1<vector>(
vector.Zero);
3023 if (ctx.Read(playContaminatedSound))
3025 soundPos = playContaminatedSound.param1;
3026 if (soundPos ==
vector.Zero)
3036 closeArtySound.SetAutodestroy(
true);
3040 if (distance_to_player <=
GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE2)
3042 float strength_factor =
Math.InverseLerp(
GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE, 0,
Math.Sqrt(distance_to_player));
3045 camera.SpawnCameraShake(strength_factor * 4);
3052 case ERPCs.RPC_SOUND_ARTILLERY_SINGLE:
3059 if (ctx.Read(playArtyShotSound))
3061 soundPosition = playArtyShotSound.param1;
3062 delayedSoundPos = playArtyShotSound.param2;
3063 soundDelay = playArtyShotSound.param3;
3064 if (soundPosition ==
vector.Zero)
3073 m_ArtySound =
SEffectManager.PlaySound(
"Artillery_Distant_SoundSet", soundPosition, 0.1, 0.1);
3074 m_ArtySound.SetAutodestroy(
true);
3080 GetCallQueue(
CALL_CATEGORY_GAMEPLAY).CallLater(DelayedMidAirDetonation, soundDelay,
false, delayedSoundPos[0], delayedSoundPos[1], delayedSoundPos[2]);
3083 case ERPCs.RPC_SET_BILLBOARDS:
3085 if (!m_BillboardSetHandler)
3088 Param1<int> indexP =
new Param1<int>(-1);
3089 if (ctx.Read(indexP))
3091 int index = indexP.param1;
3092 m_BillboardSetHandler.OnRPCIndex(index);
3099 case ERPCs.RPC_USER_SYNC_PERMISSIONS:
3102 if (ctx.Read(mute_list))
3104 for (
int i = 0; i < mute_list.Count(); i++)
3106 string uid = mute_list.GetKey(i);
3107 bool mute = mute_list.GetElement(i);
3108 MutePlayer(uid, sender.GetPlainId(), mute);
3126 case ERPCs.DEV_SET_WEATHER:
3128 Param1<DebugWeatherRPCData> p1data =
new Param1<DebugWeatherRPCData>(
null);
3130 if ( ctx.Read(p1data) )
3134 if (data.m_FogValue >= 0)
3135 GetGame().GetWeather().GetFog().Set(data.m_FogValue, data.m_FogInterpolation, data.m_FogDuration);
3137 if (data.m_OvercastValue >= 0)
3138 GetGame().GetWeather().GetOvercast().Set(data.m_OvercastValue, data.m_OvercastInterpolation, data.m_OvercastDuration);
3140 if (data.m_RainValue >= 0)
3141 GetGame().GetWeather().GetRain().Set(data.m_RainValue, data.m_RainInterpolation, data.m_RainDuration);
3146 ErrorEx(
"Failed to read weather debug data");
3153 #ifdef DIAG_DEVELOPER
3155 case ERPCs.DIAG_CAMERATOOLS_CAM_DATA:
3157 if (!m_CameraToolsMenuServer)
3159 m_CameraToolsMenuServer =
new CameraToolsMenuServer;
3161 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3165 case ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE:
3167 if (!m_CameraToolsMenuServer)
3169 m_CameraToolsMenuServer =
new CameraToolsMenuServer;
3171 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3183 void DelayedMidAirDetonation(
float x,
float y,
float z)
3186 artilleryFallSound.SetAutodestroy(
true);
3194 if (
mission && !m_loading.IsLoading() && GetUIManager().IsDialogQueued())
3197 GetUIManager().ShowQueuedDialog();
3203 void SetConnecting(
bool value)
3205 m_IsConnecting = value;
3210 return m_IsConnecting;
3216 return m_loading && m_loading.IsLoading();
3222 m_keyboard_handler = handler;
3229 m_loading.ShowEx(
this);
3234 void LoadingHide(
bool force =
false)
3237 m_loading.Hide(force);
3240 #ifdef PLATFORM_CONSOLE
3243 if (m_LoadState != DayZLoadState.MAIN_MENU_START && m_LoadState != DayZLoadState.MAIN_MENU_USER_SELECT)
3245 UpdateInputDeviceDisconnectWarning();
3253 override string CreateDefaultPlayer()
3255 if (m_CharClassNames.Count() > 0)
3256 return m_CharClassNames[0];
3262 override string CreateRandomPlayer()
3264 return m_CharClassNames.GetRandomElement();
3270 return m_CharClassNames;
3274 void ExplosionEffectsEx(
Object source,
Object directHit,
int componentIndex,
float energyFactor,
float explosionFactor,
HitInfo hitInfo)
3276 vector pos = hitInfo.GetPosition();
3277 string ammoType = hitInfo.GetAmmoType();
3280 ExplosionEffects(source, directHit, componentIndex, hitInfo.GetSurface(), pos, hitInfo.GetSurfaceNormal(), energyFactor, explosionFactor, hitInfo.IsWater(), ammoType);
3286 m_NoiseParams.LoadFromPath(
string.Format(
"cfgAmmo %1 NoiseExplosion", ammoType));
3288 GetNoiseSystem().AddNoiseTarget(pos, 21,
m_NoiseParams, hitInfo.GetSurfaceNoiseMultiplier());
3293 void ExplosionEffects(
Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
3294 float energyFactor,
float explosionFactor,
bool isWater,
string ammoType)
3299 source.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
3301 if (source.ShootsExplosiveAmmo() && ammoType ==
"Explosion_40mm_Ammo")
3305 m_AmmoShakeParams.Load(ammoType);
3307 if (distance_to_player < m_AmmoShakeParams.m_Radius)
3309 float dist01 =
Math.InverseLerp(0, m_AmmoShakeParams.m_Radius, distance_to_player);
3310 float modifier =
Math.Lerp(m_AmmoShakeParams.m_ModifierClose, m_AmmoShakeParams.m_ModifierFar,dist01);
3312 GetGame().GetPlayer().GetCurrentCamera().SpawnCameraShake(modifier * m_AmmoShakeParams.m_Strength);
3323 GetGame().ConfigGetText(
"cfgAmmo " + info.GetAmmoType() +
" simulation", simulation);
3325 if (simulation ==
"shotArrow")
3329 GetGame().ConfigGetText(
"cfgAmmo " + info.GetAmmoType() +
" spawnPileType", pile);
3332 arrow.PlaceOnSurface();
3333 arrow.SetFromProjectile(info);
3337 const float ARROW_PIERCE_DEPTH = 0.05;
3340 void OnProjectileStoppedInTerrain(TerrainCollisionInfo info)
3344 if (info.GetIsWater())
3347 GetGame().ConfigGetText(
"cfgAmmo " + info.GetAmmoType() +
" simulation", simulation);
3348 if (simulation ==
"shotArrow")
3351 GetGame().ConfigGetText(
"cfgAmmo " + info.GetAmmoType() +
" spawnPileType", pile);
3352 vector pos = info.GetPos();
3353 vector dir = -info.GetInVelocity();
3356 pos -= dir * ARROW_PIERCE_DEPTH;
3359 arrow.SetDirection(dir);
3360 arrow.SetFromProjectile(info);
3369 GetGame().ConfigGetText(
"cfgAmmo " + info.GetAmmoType() +
" simulation", simulation);
3370 if (simulation ==
"shotArrow")
3373 GetGame().ConfigGetText(
"cfgAmmo " + info.GetAmmoType() +
" spawnPileType", pile);
3379 EntityAI parent = ent.GetHierarchyParent();
3380 if (parent && parent.IsPlayer())
3383 arrow.PlaceOnSurface();
3384 arrow.SetFromProjectile(info);
3390 vector pos = info.GetPos();
3391 vector dir = -info.GetInVelocity();
3394 pos -= dir * ARROW_PIERCE_DEPTH;
3397 arrow.SetDirection(dir);
3398 arrow.SetFromProjectile(info);
3400 info.GetHitObj().AddArrow(arrow, info.GetComponentIndex(), info.GetHitObjPos(), info.GetHitObjRot());
3405 void FirearmEffects(
Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
3406 vector exitPos,
vector inSpeed,
vector outSpeed,
bool isWater,
bool deflected,
string ammoType)
3409 ImpactEffectsData impactEffectsData =
new ImpactEffectsData();
3410 impactEffectsData.m_DirectHit = directHit;
3411 impactEffectsData.m_ComponentIndex = componentIndex;
3412 impactEffectsData.m_Surface = surface;
3413 impactEffectsData.m_Position = pos;
3414 impactEffectsData.m_ImpactType =
ImpactTypes.UNKNOWN;
3415 impactEffectsData.m_SurfaceNormal = surfNormal;
3416 impactEffectsData.m_ExitPosition = exitPos;
3417 impactEffectsData.m_InSpeed = inSpeed;
3418 impactEffectsData.m_OutSpeed = outSpeed;
3419 impactEffectsData.m_IsDeflected = deflected;
3420 impactEffectsData.m_AmmoType = ammoType;
3421 impactEffectsData.m_IsWater = isWater;
3425 directHit.OnReceivedHit(impactEffectsData);
3434 if (source && source.ShootsExplosiveAmmo() && !deflected && outSpeed ==
vector.Zero)
3436 if (ammoType ==
"Bullet_40mm_ChemGas")
3438 GetGame().CreateObject(
"ContaminatedArea_Local", pos);
3440 else if (ammoType ==
"Bullet_40mm_Explosive")
3442 DamageSystem.ExplosionDamage(
EntityAI.Cast(source),
null,
"Explosion_40mm_Ammo", pos,
DamageType.EXPLOSION);
3447 m_NoiseParams.LoadFromPath(
"cfgAmmo " + ammoType +
" NoiseHit");
3449 float surfaceCoef = SurfaceGetNoiseMultiplier(directHit, pos, componentIndex);
3450 float coefAdjusted = surfaceCoef * inSpeed.Length() / ConfigGetFloat(
"cfgAmmo " + ammoType +
" initSpeed");
3451 GetNoiseSystem().AddNoiseTarget(pos, 10,
m_NoiseParams, coefAdjusted);
3456 void CloseCombatEffects(
Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
3457 bool isWater,
string ammoType)
3460 ImpactEffectsData impactEffectsData =
new ImpactEffectsData();
3461 impactEffectsData.m_DirectHit = directHit;
3462 impactEffectsData.m_ComponentIndex = componentIndex;
3463 impactEffectsData.m_Surface = surface;
3464 impactEffectsData.m_Position = pos;
3465 impactEffectsData.m_ImpactType =
ImpactTypes.MELEE;
3466 impactEffectsData.m_SurfaceNormal =
Vector(
Math.RandomFloat(-1,1),
Math.RandomFloat(-1,1),
Math.RandomFloat(-1,1));
3467 impactEffectsData.m_ExitPosition =
"0 0 0";
3468 impactEffectsData.m_InSpeed =
"0 0 0";
3469 impactEffectsData.m_OutSpeed =
"0 0 0";
3470 impactEffectsData.m_IsDeflected =
false;
3471 impactEffectsData.m_AmmoType = ammoType;
3472 impactEffectsData.m_IsWater = isWater;
3475 directHit.OnReceivedHit(impactEffectsData);
3483 m_NoiseParams.LoadFromPath(
"cfgAmmo " + ammoType +
" NoiseHit");
3485 float surfaceCoef = SurfaceGetNoiseMultiplier(directHit, pos, componentIndex);
3490 void UpdateVoiceLevel(
int level)
3492 GetMission().UpdateVoiceLevelWidgets(level);
3495 void InitCharacterMenuDataInfo(
int menudata_count)
3497 m_OriginalCharactersCount = menudata_count;
3500 void SetPlayerGameName(
string name)
3502 m_PlayerName =
name;
3505 string GetPlayerGameName()
3507 return m_PlayerName;
3510 void SetNewCharacter(
bool state)
3512 m_IsNewCharacter = state;
3515 bool IsNewCharacter()
3517 return m_IsNewCharacter;
3520 void SetUserFOV(
float pFov)
3522 if (pFov < OPTIONS_FIELD_OF_VIEW_MIN)
3523 pFov = OPTIONS_FIELD_OF_VIEW_MIN;
3525 if (pFov > OPTIONS_FIELD_OF_VIEW_MAX)
3526 pFov = OPTIONS_FIELD_OF_VIEW_MAX;
3536 static float GetUserFOVFromConfig()
3539 NumericOptionsAccess noa;
3540 if (gameOptions &&
Class.CastTo(noa,gameOptions.GetOptionByType(
OptionAccessType.AT_OPTIONS_FIELD_OF_VIEW)))
3542 return noa.ReadValue();
3552 return GetUserFOV();
3556 return Math.Min(GetUserFOV(),
GameConstants.DZPLAYER_CAMERA_FOV_EYEZOOM_SHALLOW);
3558 return GetUserFOV();
3560 return GetUserFOV();
3563 void SetHudBrightness(
float value)
3569 float GetHUDBrightnessSetting()
3579 string cfg_path =
"CfgWeapons " + weaponInHand.GetType() +
" chamberableFrom";
3580 GetGame().ConfigGetTextArray(cfg_path, ammo_names);
3582 foreach (
string ammo_name : ammo_names)
3584 if (ammo.GetType() == ammo_name)
3594 void SetEVValue(
float value)
3596 m_PreviousEVValue = m_EVValue;
3601 float GetCurrentEVValue()
3606 float GetPreviousEVValue()
3608 return m_PreviousEVValue;
3611 int GetCurrentDisplayLanguageIdx()
3613 ListOptionsAccess language_option;
3615 language_option = ListOptionsAccess.Cast(options.GetOptionByType(
OptionAccessType.AT_OPTIONS_LANGUAGE));
3617 if (language_option)
3619 idx = language_option.GetIndex();
3625 bool IsWorldWetTempUpdateEnabled()
3627 return m_IsWorldWetTempUpdateEnabled;
3630 bool IsFoodDecayEnabled()
3632 return (GetFoodDecayModifier() != 0);
3635 float GetFoodDecayModifier()
3637 #ifdef DIAG_DEVELOPER
3639 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.FOOD_DECAY))
3641 return m_FoodDecayModifier * FeatureTimeAccel.GetFeatureTimeAccelValue();
3644 return m_FoodDecayModifier;
3649 if (!m_ConnectedInputDeviceList)
3653 return m_ConnectedInputDeviceList;
3656 void SetMouseCursorDesiredVisibility(
bool visible)
3658 m_CursorDesiredVisibilityScript = visible;
3660 RefreshMouseCursorVisibility();
3663 bool GetMouseCursorDesiredVisibility()
3665 return m_CursorDesiredVisibilityScript;
3669 bool CanDisplayMouseCursor()
3672 #ifdef PLATFORM_CONSOLE
3675 return GetInput().IsMouseConnected();
3680 #ifdef PLATFORM_CONSOLE
3687 void RefreshMouseCursorVisibility()
3690 #ifdef FEATURE_CURSOR
3698 bool showCursor = m_CursorDesiredVisibilityScript && CanDisplayMouseCursor();
3704 ui.ShowCursor(showCursor);
3717 return m_BillboardSetHandler;
3723 void CreateGamepadDisconnectMenu();
3724 void DeleteGamepadDisconnectMenu();