Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
dayzintroscenexbox.c
Go to the documentation of this file.
2{
3 protected bool m_IsCharFemale;
5
13
16 protected Weather m_Weather;
17 protected Object m_Clutter;
20 protected ref TIntArray m_Date = new TIntArray;
21
23
27
32
33 //==================================
34 // DayZIntroSceneXbox
35 //==================================
37 {
38 m_MenuData = g_Game.GetMenuData();
39
40 m_LastPlayedCharacterID = m_MenuData.GetLastPlayedCharacter();
41 m_CharacterPos = "0 0 0";
42 m_CharacterDir = "0 0 0";
43
44 //g_Game.m_PlayerName = "Survivor"; //default
45 if ( m_MenuData.GetCharactersCount() == 0 )
46 {
48 }
49
50 if ( m_LastPlayedCharacterID > -1 )
51 {
52 m_MenuData.GetCharacterName(m_LastPlayedCharacterID, g_Game.GetPlayerGameName());
53 }
54
55 // Camera Setup
56 vector camera_position;
57 camera_position[0] = 1323.0; // X
58 camera_position[1] = 1.0; // Y
59 camera_position[2] = 1590.37; // Z
60 float camera_rotation_h = 100;
61 float camera_rotation_v = -3;
62 float camera_fov = 0.85;
63 float camera_focus_distance = 0.0;
64 float camera_focus_streght = 0.0;
65
66 // Character
67 float character_distance = 2.25;
68
69 // Camera Setup
70 m_SceneCamera = CameraCreate(camera_position, camera_rotation_h, camera_rotation_v, camera_fov, camera_focus_distance, camera_focus_streght);
71 m_SceneCamera.SetActive(true);
72
73 PPEffects.Init(); //Deprecated, left in for legacy purposes only
74
75 // Character Setup
76 vector cam_dir = m_SceneCamera.GetDirection();
77 m_CharacterPos = camera_position + ( cam_dir * character_distance );
79 m_CharacterDir = (camera_position - m_CharacterPos);
80
81 float overcast = 0.42;
82 float rain = 0.0;
83 float snowfall = 0.0;
84 float fog = 0.0;
85
86
87 m_Weather = g_Game.GetWeather();
88 m_Weather.GetOvercast().SetLimits(overcast, overcast);
89 m_Weather.GetRain().SetLimits(rain, rain);
90 m_Weather.GetSnowfall().SetLimits(snowfall, snowfall);
91 m_Weather.GetFog().SetLimits(fog, fog);
92
93 m_Weather.GetOvercast().Set(overcast, 0, 0);
94 m_Weather.GetRain().Set(rain, 0, 0);
95 m_Weather.GetSnowfall().Set(snowfall, 0, 0);
96 m_Weather.GetFog().Set(fog, 0, 0);
97
99 m_Character.LoadCharacterData(m_CharacterPos, m_CharacterDir);
100
101 m_TimerParticle.Run(0.1, this, "SetupParticles", null, false);
102 //m_TimerDate.Run(2.0, this, "SetupDate", null, false);
103 m_TimerUpdate.Run(0.5, this, "SetupCharacter", null, true);
104
105 vector clut_pos = SnapToGround( m_CharacterPos + "-1 0 0" );
106 m_Clutter = GetGame().CreateObject( "ClutterCutter2x2", clut_pos, true );
107
108 // Xbox check update
110
111 g_Game.SetHudBrightness(g_Game.GetHUDBrightnessSetting());
112
113 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(SetInitPostprocesses);
114 }
115
117 {
118 if ( m_TimerUpdate )
119 {
120 m_TimerUpdate.Stop();
121 delete m_TimerUpdate;
122 m_TimerUpdate = null;
123 }
124
125 if ( m_TimerParticle )
126 {
127 m_TimerParticle.Stop();
128 delete m_TimerParticle;
129 m_TimerParticle = null;
130 }
131
132
133 if ( m_TimerDate )
134 {
135 m_TimerDate.Stop();
136 delete m_TimerDate;
137 m_TimerDate = null;
138 }
139
141
142 GetGame().ObjectDelete( m_SceneCamera );
143
144 if ( m_MenuData )
145 {
146 m_MenuData.ClearCharacters();
147 }
148
152
153 PPEManagerStatic.GetPPEManager().StopAllEffects(PPERequesterCategory.ALL);
154 }
155
156 protected void SetInitPostprocesses()
157 {
158 PPERequester_MenuEffects requester;
159 Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
160
161 requester.SetVignetteIntensity(0.3);
162 PPERequesterBank.GetRequester(PPERequester_IntroChromAbb).Start();
163 }
164
165 //==============================================
166 // GetIntroSceneCharacter
167 //==============================================
172
173 //==================================
174 // SetupCharacter
175 //==================================
177 {
178 if ( m_Character.GetCharacterObj() )
179 {
180 vector v = m_Character.GetCharacterObj().GetOrientation();
181 v[0] = -75;
182 m_Character.GetCharacterObj().SetOrientation(v);
183 }
184 }
185
186 //==================================
187 // SetupParticles
188 //==================================
190 {
192 //SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1330.36 2.11628 1594.31");
193 //SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1333.88 1.51392 1594.88");
194 SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1331.52 2.34052 1593.55");
195
196 vector pos = m_SceneCamera.GetPosition() + m_SceneCamera.GetDirection() * 1.5;
197 vector dir = m_SceneCamera.GetDirection();
198 float temp = dir[0];
199 dir[0] = dir[2];
200 dir[2] = -temp;
201
202 vector pos_right = pos + (dir * 1.5);
203 vector pos_left = pos + (-dir * 1.5);
204
207
210 }
211
212 //==================================
213 // SetupDate
214 //==================================
216 {
217 //g_Game.GetWorld().SetDate(m_Date.Get(0), m_Date.Get(1), m_Date.Get(2), m_Date.Get(3), m_Date.Get(4));
218 //g_Game.GetWorld().SetDate(2020, 10, 15, 18, 20);
219 }
220
221 //==================================
222 // CheckXboxClientUpdateLoopStart
223 //==================================
225 {
226 if ( CheckXboxClientUpdate() )
227 {
228 m_TimerClientUpdate.Run(30, this, "CheckXboxClientUpdate", null, true);
229 }
230 }
231
232 //==================================
233 // CheckXboxClientUpdateLoopStop
234 //==================================
236 {
238 {
239 m_TimerClientUpdate.Stop();
240 delete m_TimerClientUpdate;
241 m_TimerClientUpdate = null;
242 }
243 }
244
245 //==================================
246 // CheckXboxClientUpdate
247 //==================================
249 {
251 }
252
253 //==================================
254 // CameraCreate
255 //==================================
256 protected Camera CameraCreate(vector cam_pos, float cam_rot_h, float cam_rot_v, float cam_fov, float cam_focus_dist, float cam_focus_strg)
257 {
258 Camera cam = Camera.Cast( g_Game.CreateObject("staticcamera", SnapToGround(cam_pos), true));
259 cam.SetOrientation( Vector( cam_rot_h, cam_rot_v, 0) );
260 cam.SetFOV( cam_fov );
261 cam.SetFocus(cam_focus_dist, cam_focus_strg);
262
263 return cam;
264 }
265
266 //==================================
267 // GetCamera
268 //==================================
270 {
271 return m_SceneCamera;
272 }
273
274 //==================================
275 // ResetIntroCamera
276 //==================================
278 {
279
280 }
281
282 //==================================
283 // SetCharacterFemale
284 //==================================
285 void SetCharacterFemale(bool fem)
286 {
287 m_IsCharFemale = fem;
288 }
289
290 //==================================
291 // IsCharacterFemale
292 //==================================
294 {
295 return m_IsCharFemale;
296 }
297
298 //==================================
299 // CreateRandomCharacter
300 //==================================
302 {
303 string character_name;
304 string params[2];
305
306 m_IsCharFemale = Math.RandomInt(0, 2);
307
308 if (m_IsCharFemale)
309 {
310 character_name = m_CharPersonalityFemaleList.GetRandomElement();
311 }
312 else
313 {
314 character_name = m_CharPersonalityMaleList.GetRandomElement();
315 }
316
317 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(UpdateCharacterPos, 250);
318 }
319
321 {
322 string name;
323 BiosUserManager user_manager = GetGame().GetUserManager();
324 if( user_manager )
325 {
326 BiosUser user = user_manager.GetSelectedUser();
327 if( user )
328 {
329 g_Game.SetPlayerGameName( user.GetName() );
330 return;
331 }
332 }
333 g_Game.SetPlayerGameName(GameConstants.DEFAULT_CHARACTER_NAME);
334 }
335
337 {
338 if (m_Character.GetCharacterObj())
339 {
340 m_Character.GetCharacterObj().SetPosition(m_CharacterPos);
341 m_Character.GetCharacterObj().SetDirection(m_CharacterDir.Normalized() );
342 }
343 }
344
345 void SaveCharName( string name )
346 {
347 GetDayZGame().InitCharacterMenuDataInfo(m_MenuData.GetCharactersCount());
348
349 //if (!GetDayZGame().IsNewCharacter() && m_LastPlayedCharacterID > -1)
350 //{
351 m_MenuData.SetCharacterName(m_LastPlayedCharacterID, name);
352 //}
353 if (m_Character.IsDefaultCharacter())
354 {
355 GetGame().GetMenuDefaultCharacterData().SetCharacterName(name);
356 }
357 m_MenuData.SaveCharactersLocal();
358 }
359
360 // ------------------------------------------------------------
362 {
363 float pos_x = pos[0];
364 float pos_z = pos[2];
365 float pos_y = GetGame().SurfaceY(pos_x, pos_z);
366 vector tmp_pos = Vector(pos_x, pos_y, pos_z);
367 tmp_pos[1] = tmp_pos[1] + pos[1];
368
369 return tmp_pos;
370 }
371};
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
proto native float SurfaceY(float x, float z)
proto native BiosUserManager GetUserManager()
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition game.c:1548
Super root of all classes in Enforce script.
Definition enscript.c:11
vector SnapToGround(vector pos)
ref TStringArray m_CharShirtList
Camera CameraCreate(vector cam_pos, float cam_rot_h, float cam_rot_v, float cam_fov, float cam_focus_dist, float cam_focus_strg)
ref TStringArray m_CharPersonalityFemaleList
ref TStringArray m_CharShoesList
ref MenuEvaporation m_FXParticleStreamLeft
ref TStringArray m_CharPantsList
ref TStringArray m_genderList
ref MenuEvaporation m_FXParticleStreamRight
ref IntroSceneCharacter m_Character
void SaveCharName(string name)
ref TStringArray m_CharPersonalityMaleList
IntroSceneCharacter GetIntroCharacter()
ref TStringArray m_AllCharacters
void SetCharacterFemale(bool fem)
ref MenuCarEngineSmoke m_FXParticleCarSmoke
TODO doc.
Definition enscript.c:118
void IntroSceneCharacter()
Definition enmath.c:7
static bool CheckUpdate()
Static component of PPE manager, used to hold the instance.
Definition ppemanager.c:3
Deprecated; 'PPEManager' used instead.
Definition ppeffects.c:3
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
DayZGame GetDayZGame()
Definition dayzgame.c:3870
proto native CGame GetGame()
array< int > TIntArray
Definition enscript.c:711
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_GUI
Definition tools.c:9
PPERequesterCategory