DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DayZIntroScene.c
См. документацию.
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 SetScene();
16 }
17
19 {
21 }
22
23 protected void ClearIntroScene()
24 {
27 }
28
29 protected void SetScene()
30 {
31 string root_path = "cfgCharacterScenes " + g_Game.GetWorldName();
32
33 int count = g_Game.ConfigGetChildrenCount(root_path);
34 int index = Math.RandomInt(0, count - 1);
35 string childName;
36 g_Game.ConfigGetChildName(root_path, index, childName);
37
38 string scene_path = root_path + " " + childName;
39 m_Target = SwapYZ(g_Game.ConfigGetVector(scene_path + " target"));
40 vector position = SwapYZ(g_Game.ConfigGetVector(scene_path + " position"));
41 TIntArray date = new TIntArray;
42 TFloatArray storm = new TFloatArray;
43 g_Game.ConfigGetIntArray(scene_path + " date", date);
44 float fov = g_Game.ConfigGetFloat(scene_path + " fov");
45 float overcast = g_Game.ConfigGetFloat(scene_path + " overcast");
46 float rain = g_Game.ConfigGetFloat(scene_path + " rain");
47 float snowfall = g_Game.ConfigGetFloat(scene_path + " snowfall");
48 float fog = g_Game.ConfigGetFloat(scene_path + " fog");
49 float windspeed = -1;
50 if ( g_Game.ConfigIsExisting(scene_path + " windspeed") )
51 windspeed = g_Game.ConfigGetFloat(scene_path + " windspeed");
52 g_Game.ConfigGetFloatArray(scene_path + " storm", storm);
53
54 World world = g_Game.GetWorld();
55
56 if (world && date.Count() >= 5)
57 {
58 world.SetDate(date.Get(0), date.Get(1), date.Get(2), date.Get(3), date.Get(4));
59 }
60
61 g_Game.ObjectDelete( m_Camera );
62 Class.CastTo(m_Camera, g_Game.CreateObject("staticcamera", SnapToGround(position), true)); //Vector(position[0] , position[1] + 1, position[2])
63
65
66 if (m_Camera)
67 {
68 //m_Camera.SetPosition(Vector(m_Camera.GetPosition()[0],m_Camera.GetPosition()[1]+0,m_Camera.GetPosition()[2]));
69 m_Camera.LookAt(m_Target);
70 m_Camera.SetFOV(fov);
71 m_Camera.SetFocus(5.0, 0.0); //5.0, 1.0
72
73 m_Camera.SetActive(true);
74
76 m_CameraTrans[3] = m_Camera.GetPosition();
77 m_CharacterPos = Vector(0.685547, -0.988281, 3.68823).Multiply4(m_CameraTrans);
78
79 float pos_x = m_CharacterPos[0];
80 float pos_z = m_CharacterPos[2];
81 float pos_y = g_Game.SurfaceY(pos_x, pos_z);
82 vector ground_demo_pos = Vector(pos_x, pos_y, pos_z);
83 m_CharacterPos = ground_demo_pos;
84
85 vector to_cam_dir = m_Camera.GetPosition() - m_CharacterPos;
86 m_CharacterRot[0] = Math.Atan2(to_cam_dir[0], to_cam_dir[2]) * Math.RAD2DEG;
87 }
88
89 m_Weather = g_Game.GetWeather();
90 m_Weather.GetOvercast().SetLimits( overcast, overcast );
91 m_Weather.GetRain().SetLimits( rain, rain );
92 m_Weather.GetSnowfall().SetLimits( snowfall, snowfall );
93 m_Weather.GetFog().SetLimits( fog, fog );
94
95 m_Weather.GetOvercast().Set( overcast, 0, 0);
96 m_Weather.GetRain().Set( rain, 0, 0);
97 m_Weather.GetSnowfall().Set( snowfall, 0, 0);
98 m_Weather.GetFog().Set( fog, 0, 0);
99
100 if ( storm.Count() == 3 )
101 {
102 m_Weather.SetStorm(storm.Get(0),storm.Get(1),storm.Get(2));
103 }
104
105 if ( windspeed != -1 )
106 {
107 m_Weather.SetWindSpeed(windspeed);
108 m_Weather.SetWindMaximumSpeed(windspeed);
109 m_Weather.SetWindFunctionParams(1,1,1);
110 }
111
112 if (m_Weather.GetSandstorm().IsActive())
113 m_Weather.GetSandstorm().Stop(0, false);
114
116 m_Character.LoadCharacterData(m_CharacterPos, m_CharacterRot);
117
118 PPEffects.Init(); //Deprecated, left in for legacy purposes only
119
121 }
122
123 //==============================================
124 // GetIntroSceneCharacter
125 //==============================================
130
131 //==============================================
132 // GetIntroCamera
133 //==============================================
135 {
136 return m_Camera;
137 }
138
139 //==============================================
140 // ResetIntroCamera
141 //==============================================
143 {
145 {
146 GetIntroCamera().LookAt( GetIntroCharacter().GetPosition() + Vector( 0, 1, 0 ) );
147 //g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater( SceneCharacterSetPos, 250 );
148 }
149 }
150
152 protected void SetInitPostprocesses()
153 {
154 PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
155 }
156
157 protected void GetSelectedUserName()
158 {
159 string name;
160 BiosUserManager user_manager = g_Game.GetUserManager();
161 if( user_manager )
162 {
163 BiosUser user = user_manager.GetSelectedUser();
164 if( user )
165 {
166 g_Game.SetPlayerGameName( user.GetName() );
167 return;
168 }
169 }
171 }
172
173 // ------------------------------------------------------------
174 protected vector SwapYZ(vector vec)
175 {
176 vector tmp;
177 tmp[0] = vec[0];
178 tmp[1] = vec[2];
179 tmp[2] = vec[1];
180
181 return tmp;
182 }
183
184 // ------------------------------------------------------------
186 {
187 float pos_x = pos[0];
188 float pos_z = pos[2];
189 float pos_y = g_Game.SurfaceY(pos_x, pos_z);
190 vector tmp_pos = Vector(pos_x, pos_y, pos_z);
191 tmp_pos[1] = tmp_pos[1] + pos[1];
192
193 return tmp_pos;
194 }
195};
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
PPERequesterCategory
Определения PPEConstants.c:29
proto native owned string GetName()
Определения BiosUserManager.c:9
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
Определения Camera.c:85
Super root of all classes in Enforce script.
Определения EnScript.c:11
void GetSelectedUserName()
Определения DayZIntroScene.c:157
vector m_CharacterPos
Определения DayZIntroScene.c:6
vector SwapYZ(vector vec)
Определения DayZIntroScene.c:174
void ~DayZIntroScene()
Определения DayZIntroScene.c:18
IntroSceneCharacter GetIntroCharacter()
Определения DayZIntroScene.c:126
ref OptionsMenu m_OptionsMenu
Определения DayZIntroScene.c:11
void SetInitPostprocesses()
Since this can get created at the same time as DayZGame, non-static postprocesses need to be deffered...
Определения DayZIntroScene.c:152
Weather m_Weather
Определения DayZIntroScene.c:8
void SetScene()
Определения DayZIntroScene.c:29
Camera GetIntroCamera()
Определения DayZIntroScene.c:134
void ResetIntroCamera()
Определения DayZIntroScene.c:142
Camera m_Camera
Определения DayZIntroScene.c:4
vector m_CameraTrans[4]
Определения DayZIntroScene.c:5
void ClearIntroScene()
Определения DayZIntroScene.c:23
ref IntroSceneCharacter m_Character
Определения DayZIntroScene.c:3
void DayZIntroScene()
Определения DayZIntroScene.c:13
vector m_CharacterRot
Определения DayZIntroScene.c:7
vector m_Target
Определения DayZIntroScene.c:9
vector SnapToGround(vector pos)
Определения DayZIntroScene.c:185
PlayerBase GetCharacterObj()
Определения IntroSceneCharacter.c:57
vector GetPosition()
Определения IntroSceneCharacter.c:129
void IntroSceneCharacter()
Определения IntroSceneCharacter.c:19
TODO doc.
Определения EnScript.c:118
Определения EnMath3D.c:28
Определения EnMath.c:7
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Определения PPEManager.c:27
Static component of PPE manager, used to hold the instance.
Определения PPEManager.c:3
static void Init()
Определения PPEffects.c:52
Deprecated; 'PPEManager' used instead.
Определения PPEffects.c:3
Определения Weather.c:168
Определения World.c:2
proto vector Multiply4(vector mat[4])
Transforms position.
Определения EnConvert.c:119
const string DEFAULT_CHARACTER_NAME
Определения 3_Game/DayZ/constants.c:1043
array< float > TFloatArray
Определения EnScript.c:732
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< int > TIntArray
Определения EnScript.c:733
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Определения EnMath3D.c:256
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
Определения EnMath.c:16
proto native void SetDate(int year, int month, int day, int hour, int minute)
Sets actual ingame world time.
const int CALL_CATEGORY_GUI
Определения 3_Game/DayZ/tools/tools.c:9