DayZ 1.24
Loading...
Searching...
No Matches
DayZIntroScene.c
Go to the documentation of this file.
2{
4 protected Camera m_Camera;
5 protected vector m_CameraTrans[4];
8 protected Weather m_Weather;
9 protected vector m_Target;
10
11 protected ref OptionsMenu m_OptionsMenu;
12
14 {
15 string root_path = "cfgCharacterScenes " + g_Game.GetWorldName();
16
17 int count = g_Game.ConfigGetChildrenCount(root_path);
18 int index = Math.RandomInt(0, count - 1);
19 string childName;
20 g_Game.ConfigGetChildName(root_path, index, childName);
21
22 string scene_path = root_path + " " + childName;
23 m_Target = SwapYZ(g_Game.ConfigGetVector(scene_path + " target"));
24 vector position = SwapYZ(g_Game.ConfigGetVector(scene_path + " position"));
27 g_Game.ConfigGetIntArray(scene_path + " date", date);
28 float fov = g_Game.ConfigGetFloat(scene_path + " fov");
29 float overcast = g_Game.ConfigGetFloat(scene_path + " overcast");
30 float rain = g_Game.ConfigGetFloat(scene_path + " rain");
31 float fog = g_Game.ConfigGetFloat(scene_path + " fog");
32 float windspeed = -1;
33 if (g_Game.ConfigIsExisting(scene_path + " windspeed")) windspeed = g_Game.ConfigGetFloat(scene_path + " windspeed");
34 g_Game.ConfigGetFloatArray(scene_path + " storm", storm);
35
36 World world = g_Game.GetWorld();
37
38 if (world && date.Count() >= 5)
39 world.SetDate(date.Get(0), date.Get(1), date.Get(2), date.Get(3), date.Get(4));
40
41 GetGame().ObjectDelete(m_Camera);
42 Class.CastTo(m_Camera, g_Game.CreateObject("staticcamera", SnapToGround(position), true)); //Vector(position[0] , position[1] + 1, position[2])
43
45
46 if (m_Camera)
47 {
48 //m_Camera.SetPosition(Vector(m_Camera.GetPosition()[0],m_Camera.GetPosition()[1]+0,m_Camera.GetPosition()[2]));
49 m_Camera.LookAt(m_Target);
50 m_Camera.SetFOV(fov);
51 m_Camera.SetFocus(5.0, 0.0); //5.0, 1.0
52
53 m_Camera.SetActive(true);
54
56 m_CameraTrans[3] = m_Camera.GetPosition();
57 m_CharacterPos = Vector(0.685547, -0.988281, 3.68823).Multiply4(m_CameraTrans);
58
59 float pos_x = m_CharacterPos[0];
60 float pos_z = m_CharacterPos[2];
61 float pos_y = GetGame().SurfaceY(pos_x, pos_z);
64
65 vector to_cam_dir = m_Camera.GetPosition() - m_CharacterPos;
67 }
68
69 m_Weather = g_Game.GetWeather();
71 m_Weather.GetRain().SetLimits(rain, rain);
72 m_Weather.GetFog().SetLimits(fog, fog);
73
74 m_Weather.GetOvercast().Set(overcast, 0, 0);
75 m_Weather.GetRain().Set(rain, 0, 0);
76 m_Weather.GetFog().Set(fog, 0, 0);
77
78 if (storm.Count() == 3)
79 m_Weather.SetStorm(storm.Get(0), storm.Get(1), storm.Get(2));
80
81 if (windspeed != -1)
82 {
86 }
87
89 m_Character.LoadCharacterData(m_CharacterPos, m_CharacterRot);
90
91 PPEffects.Init(); //Deprecated, left in for legacy purposes only
92
94 }
95
101
102 //==============================================
103 // GetIntroSceneCharacter
104 //==============================================
109
110 //==============================================
111 // GetIntroCamera
112 //==============================================
114 {
115 return m_Camera;
116 }
117
118 //==============================================
119 // ResetIntroCamera
120 //==============================================
122 {
124 {
125 GetIntroCamera().LookAt(GetIntroCharacter().GetPosition() + Vector(0, 1, 0));
126 //GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater( SceneCharacterSetPos, 250 );
127 }
128 }
129
131 protected void SetInitPostprocesses()
132 {
134 }
135
136 protected void GetSelectedUserName()
137 {
138 string name;
139 BiosUserManager user_manager = GetGame().GetUserManager();
140 if (user_manager)
141 {
142 BiosUser user = user_manager.GetSelectedUser();
143 if (user)
144 {
145 g_Game.SetPlayerGameName(user.GetName());
146 return;
147 }
148 }
150 }
151
152 // ------------------------------------------------------------
154 {
155 vector tmp;
156 tmp[0] = vec[0];
157 tmp[1] = vec[2];
158 tmp[2] = vec[1];
159
160 return tmp;
161 }
162
163 // ------------------------------------------------------------
165 {
166 float pos_x = pos[0];
167 float pos_z = pos[2];
168 float pos_y = GetGame().SurfaceY(pos_x, pos_z);
170 tmp_pos[1] = tmp_pos[1] + pos[1];
171
172 return tmp_pos;
173 }
174};
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Definition DayZGame.c:3528
PPERequesterCategory
Super root of all classes in Enforce script.
Definition EnScript.c:11
void GetSelectedUserName()
vector m_CharacterPos
vector SwapYZ(vector vec)
IntroSceneCharacter GetIntroCharacter()
ref OptionsMenu m_OptionsMenu
void SetInitPostprocesses()
Since this can get created at the same time as DayZGame, non-static postprocesses need to be deffered...
Camera GetIntroCamera()
vector m_CameraTrans[4]
ref IntroSceneCharacter m_Character
vector m_CharacterRot
vector SnapToGround(vector pos)
TODO doc.
Definition EnScript.c:118
PlayerBase GetCharacterObj()
vector GetPosition()
void IntroSceneCharacter()
Definition EnMath.c:7
Static component of PPE manager, used to hold the instance.
Definition PPEManager.c:3
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Definition PPEManager.c:27
Deprecated; 'PPEManager' used instead.
Definition PPEffects.c:3
static void Init()
Definition PPEffects.c:52
proto native Fog GetFog()
Returns a fog phenomenon object.
proto native void SetStorm(float density, float threshold, float timeOut)
Sets the thunderstorm properties.
proto native void SetWindSpeed(float speed)
Sets the actual wind speed in metre per second.
proto native void SetWindFunctionParams(float fnMin, float fnMax, float fnSpeed)
Sets function parameters that controls the wind behaviour (change in time).
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto native void SetWindMaximumSpeed(float maxSpeed)
Sets the maximal wind speed in metre per second.
Definition World.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const string DEFAULT_CHARACTER_NAME
Definition constants.c:838
array< float > TFloatArray
Definition EnScript.c:667
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< int > TIntArray
Definition EnScript.c:668
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition EnMath3D.c:233
static proto void DirectionAndUpMatrix(vector dir, vector up, out vector mat[4])
Creates rotation matrix from direction and up vector.
static proto float Atan2(float y, float x)
Returns angle in radians from tangent.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static const float RAD2DEG
Definition EnMath.c:16
const int CALL_CATEGORY_GUI
Definition tools.c:9