File size: 10,077 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
class DayZIntroSceneXbox: Managed
{
protected bool m_IsCharFemale;
protected int m_LastPlayedCharacterID;
protected ref TStringArray m_genderList;
protected ref TStringArray m_CharPersonalityMaleList;
protected ref TStringArray m_CharPersonalityFemaleList;
protected ref TStringArray m_CharShirtList;
protected ref TStringArray m_CharPantsList;
protected ref TStringArray m_CharShoesList;
protected ref TStringArray m_AllCharacters;
protected ref IntroSceneCharacter m_Character;
protected Camera m_SceneCamera;
protected Weather m_Weather;
protected Object m_Clutter;
protected vector m_CharacterPos;
protected vector m_CharacterDir;
protected ref TIntArray m_Date = new TIntArray;
protected MenuData m_MenuData;
protected ref MenuCarEngineSmoke m_FXParticleCarSmoke;
protected ref MenuEvaporation m_FXParticleStreamLeft;
protected ref MenuEvaporation m_FXParticleStreamRight;
ref Timer m_TimerUpdate = new Timer( CALL_CATEGORY_GAMEPLAY );
ref Timer m_TimerParticle = new Timer( CALL_CATEGORY_GAMEPLAY );
ref Timer m_TimerDate = new Timer( CALL_CATEGORY_GAMEPLAY );
ref Timer m_TimerClientUpdate = new Timer( CALL_CATEGORY_GAMEPLAY );
//==================================
// DayZIntroSceneXbox
//==================================
void DayZIntroSceneXbox()
{
m_MenuData = g_Game.GetMenuData();
m_LastPlayedCharacterID = m_MenuData.GetLastPlayedCharacter();
m_CharacterPos = "0 0 0";
m_CharacterDir = "0 0 0";
//g_Game.m_PlayerName = "Survivor"; //default
if ( m_MenuData.GetCharactersCount() == 0 )
{
m_LastPlayedCharacterID = -1;
}
if ( m_LastPlayedCharacterID > -1 )
{
m_MenuData.GetCharacterName(m_LastPlayedCharacterID, g_Game.GetPlayerGameName());
}
// Camera Setup
vector camera_position;
camera_position[0] = 1323.0; // X
camera_position[1] = 1.0; // Y
camera_position[2] = 1590.37; // Z
float camera_rotation_h = 100;
float camera_rotation_v = -3;
float camera_fov = 0.85;
float camera_focus_distance = 0.0;
float camera_focus_streght = 0.0;
// Character
float character_distance = 2.25;
// Camera Setup
m_SceneCamera = CameraCreate(camera_position, camera_rotation_h, camera_rotation_v, camera_fov, camera_focus_distance, camera_focus_streght);
m_SceneCamera.SetActive(true);
PPEffects.Init(); //Deprecated, left in for legacy purposes only
// Character Setup
vector cam_dir = m_SceneCamera.GetDirection();
m_CharacterPos = camera_position + ( cam_dir * character_distance );
m_CharacterPos[1] = GetGame().SurfaceY(m_CharacterPos[0], m_CharacterPos[2]);
m_CharacterDir = (camera_position - m_CharacterPos);
float overcast = 0.42;
float rain = 0.0;
float fog = 0.0;
m_Weather = g_Game.GetWeather();
m_Weather.GetOvercast().SetLimits(overcast, overcast);
m_Weather.GetRain().SetLimits(rain, rain);
m_Weather.GetFog().SetLimits(fog, fog);
m_Weather.GetOvercast().Set(overcast, 0, 0);
m_Weather.GetRain().Set(rain, 0, 0);
m_Weather.GetFog().Set(fog, 0, 0);
m_Character = new IntroSceneCharacter();
m_Character.LoadCharacterData(m_CharacterPos, m_CharacterDir);
m_TimerParticle.Run(0.1, this, "SetupParticles", null, false);
//m_TimerDate.Run(2.0, this, "SetupDate", null, false);
m_TimerUpdate.Run(0.5, this, "SetupCharacter", null, true);
vector clut_pos = SnapToGround( m_CharacterPos + "-1 0 0" );
m_Clutter = GetGame().CreateObject( "ClutterCutter2x2", clut_pos, true );
// Xbox check update
CheckXboxClientUpdateLoopStart();
g_Game.SetHudBrightness(g_Game.GetHUDBrightnessSetting());
GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(SetInitPostprocesses);
}
void ~DayZIntroSceneXbox()
{
if ( m_TimerUpdate )
{
m_TimerUpdate.Stop();
delete m_TimerUpdate;
m_TimerUpdate = null;
}
if ( m_TimerParticle )
{
m_TimerParticle.Stop();
delete m_TimerParticle;
m_TimerParticle = null;
}
if ( m_TimerDate )
{
m_TimerDate.Stop();
delete m_TimerDate;
m_TimerDate = null;
}
CheckXboxClientUpdateLoopStop();
GetGame().ObjectDelete( m_SceneCamera );
if ( m_MenuData )
{
m_MenuData.ClearCharacters();
}
SEffectManager.DestroyEffect(m_FXParticleCarSmoke);
SEffectManager.DestroyEffect(m_FXParticleStreamLeft);
SEffectManager.DestroyEffect(m_FXParticleStreamRight);
PPEManagerStatic.GetPPEManager().StopAllEffects(PPERequesterCategory.ALL);
}
protected void SetInitPostprocesses()
{
PPERequester_MenuEffects requester;
Class.CastTo(requester,PPERequesterBank.GetRequester(PPERequester_MenuEffects));
requester.SetVignetteIntensity(0.3);
PPERequesterBank.GetRequester(PPERequester_IntroChromAbb).Start();
}
//==============================================
// GetIntroSceneCharacter
//==============================================
IntroSceneCharacter GetIntroCharacter()
{
return m_Character;
}
//==================================
// SetupCharacter
//==================================
void SetupCharacter()
{
if ( m_Character.GetCharacterObj() )
{
vector v = m_Character.GetCharacterObj().GetOrientation();
v[0] = -75;
m_Character.GetCharacterObj().SetOrientation(v);
}
}
//==================================
// SetupParticles
//==================================
void SetupParticles()
{
m_FXParticleCarSmoke = new MenuCarEngineSmoke();
//SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1330.36 2.11628 1594.31");
//SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1333.88 1.51392 1594.88");
SEffectManager.PlayInWorld(m_FXParticleCarSmoke, "1331.52 2.34052 1593.55");
vector pos = m_SceneCamera.GetPosition() + m_SceneCamera.GetDirection() * 1.5;
vector dir = m_SceneCamera.GetDirection();
float temp = dir[0];
dir[0] = dir[2];
dir[2] = -temp;
vector pos_right = pos + (dir * 1.5);
vector pos_left = pos + (-dir * 1.5);
m_FXParticleStreamLeft = new MenuEvaporation();
SEffectManager.PlayInWorld(m_FXParticleStreamLeft, pos_right);
m_FXParticleStreamRight = new MenuEvaporation();
SEffectManager.PlayInWorld(m_FXParticleStreamRight, pos_left);
}
//==================================
// SetupDate
//==================================
void SetupDate()
{
//g_Game.GetWorld().SetDate(m_Date.Get(0), m_Date.Get(1), m_Date.Get(2), m_Date.Get(3), m_Date.Get(4));
//g_Game.GetWorld().SetDate(2020, 10, 15, 18, 20);
}
//==================================
// CheckXboxClientUpdateLoopStart
//==================================
void CheckXboxClientUpdateLoopStart()
{
if ( CheckXboxClientUpdate() )
{
m_TimerClientUpdate.Run(30, this, "CheckXboxClientUpdate", null, true);
}
}
//==================================
// CheckXboxClientUpdateLoopStop
//==================================
void CheckXboxClientUpdateLoopStop()
{
if ( m_TimerClientUpdate )
{
m_TimerClientUpdate.Stop();
delete m_TimerClientUpdate;
m_TimerClientUpdate = null;
}
}
//==================================
// CheckXboxClientUpdate
//==================================
bool CheckXboxClientUpdate()
{
return OnlineServices.CheckUpdate();
}
//==================================
// CameraCreate
//==================================
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)
{
Camera cam = Camera.Cast( g_Game.CreateObject("staticcamera", SnapToGround(cam_pos), true));
cam.SetOrientation( Vector( cam_rot_h, cam_rot_v, 0) );
cam.SetFOV( cam_fov );
cam.SetFocus(cam_focus_dist, cam_focus_strg);
return cam;
}
//==================================
// GetCamera
//==================================
Camera GetCamera()
{
return m_SceneCamera;
}
//==================================
// ResetIntroCamera
//==================================
void ResetIntroCamera()
{
}
//==================================
// SetCharacterFemale
//==================================
void SetCharacterFemale(bool fem)
{
m_IsCharFemale = fem;
}
//==================================
// IsCharacterFemale
//==================================
bool IsCharacterFemale()
{
return m_IsCharFemale;
}
//==================================
// CreateRandomCharacter
//==================================
void CreateRandomCharacter()
{
string character_name;
string params[2];
m_IsCharFemale = Math.RandomInt(0, 2);
if (m_IsCharFemale)
{
character_name = m_CharPersonalityFemaleList.GetRandomElement();
}
else
{
character_name = m_CharPersonalityMaleList.GetRandomElement();
}
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(UpdateCharacterPos, 250);
}
void UpdateSelectedUserName()
{
string name;
BiosUserManager user_manager = GetGame().GetUserManager();
if( user_manager )
{
BiosUser user = user_manager.GetSelectedUser();
if( user )
{
g_Game.SetPlayerGameName( user.GetName() );
return;
}
}
g_Game.SetPlayerGameName(GameConstants.DEFAULT_CHARACTER_NAME);
}
void UpdateCharacterPos()
{
if (m_Character.GetCharacterObj())
{
m_Character.GetCharacterObj().SetPosition(m_CharacterPos);
m_Character.GetCharacterObj().SetDirection(m_CharacterDir.Normalized() );
}
}
void SaveCharName( string name )
{
GetDayZGame().InitCharacterMenuDataInfo(m_MenuData.GetCharactersCount());
//if (!GetDayZGame().IsNewCharacter() && m_LastPlayedCharacterID > -1)
//{
m_MenuData.SetCharacterName(m_LastPlayedCharacterID, name);
//}
if (m_Character.IsDefaultCharacter())
{
GetGame().GetMenuDefaultCharacterData().SetCharacterName(name);
}
m_MenuData.SaveCharactersLocal();
}
// ------------------------------------------------------------
vector SnapToGround(vector pos)
{
float pos_x = pos[0];
float pos_z = pos[2];
float pos_y = GetGame().SurfaceY(pos_x, pos_z);
vector tmp_pos = Vector(pos_x, pos_y, pos_z);
tmp_pos[1] = tmp_pos[1] + pos[1];
return tmp_pos;
}
};
|