DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл DynamicMusicPlayer.c

См. исходные тексты.

Структуры данных

class  DynamicMusicLocationTypes
 
class  DynamicMusicPlayerSettings
 
class  DynamicMusicPlayerTrackHistoryLookupType
 
class  DynamicMusicPlayerTimeOfDay
 for backward compatibility Подробнее...
 

Функции

static array< vectorGetRectangularCoordsFromSize (vector origin, float size)
 
void InsertLocation (vector min, vector max)
 
void DynamicMusicPlayer (DynamicMusicPlayerRegistry configuration)
 
void OnUpdate (float timeslice)
 
void SetCategory (EDynamicMusicPlayerCategory category, bool forced)
 
void RegisterDynamicLocation (notnull Entity caller, int locationType, float locationSize)
 
void UnregisterDynamicLocation (notnull Entity caller)
 
void OnGameEvent (EventType eventTypeId, Param params)
 
bool IsPriotitizedCategorySelected ()
 
void DetermineTrackByCategory (EDynamicMusicPlayerCategory category)
 
bool IsPlaybackActive ()
 
void OnProfileOptionChanged (EDayZProfilesOptions option, int value)
 
void OnCategorySet (EDynamicMusicPlayerCategory category, bool forced)
 
void OnTrackEnded ()
 
void OnTrackStopped ()
 
void OnNextTrackSelected (DynamicMusicTrackData track, float waitTime)
 
void OnLocationMatched (EDynamicMusicPlayerCategory category, bool isPriorityLocation)
 
void OnFadeoutFinished (EDynamicMusicPlayerCategory category)
 
void PlayTrack (DynamicMusicTrackData track)
 
void StopTrack ()
 
void ResetWaitingQueue ()
 
void FadeoutTrack (float fadeoutSeconds)
 
void ProcessFadeOut ()
 
bool PlayerInsideOfLocationFilter (ref array< ref DynamicMusicTrackData > locations)
 
bool PlayerInsideOfLocationFilter (ref map< int, ref DynamicMusicLocationDynamicData > locations)
 
bool SetSelectedTrackFromCategory (EDynamicMusicPlayerCategory category, notnull ref array< ref DynamicMusicTrackData > tracklist, int historyLookupType=DynamicMusicPlayerTrackHistoryLookupType.ANY)
 
int SelectRandomTrackIndexFromCategoryPriorityFlagFirst (EDynamicMusicPlayerCategory category, notnull array< ref DynamicMusicTrackData > tracks)
 
int SelectRandomTrackIndexFromCategory (EDynamicMusicPlayerCategory category, int lookupType, notnull array< ref DynamicMusicTrackData > tracks)
 
void SetTimeOfDate ()
 
float GetWaitTimeForCategory (EDynamicMusicPlayerCategory category)
 
float GetMinWaitTimePerCategory (EDynamicMusicPlayerCategory category)
 
float GetMaxWaitTimePerCategory (EDynamicMusicPlayerCategory category)
 
float GetPreviousTrackFadeoutSeconds (EDynamicMusicPlayerCategory category)
 
void RefreshTracksCache ()
 

Переменные

class DynamicMusicLocationTypes m_Type = DynamicMusicLocationTypes.NONE
 
vector m_Min = vector.Zero
 rectangle coords (2d only)
 
vector m_Max = vector.Zero
 
class DynamicMusicPlayerSettings m_HasPriority = false
 
int m_TimeOfDay = -1
 
int m_LocationType = DynamicMusicLocationTypes.NONE
 
string m_SoundSet
 
EDynamicMusicPlayerCategory m_Category
 
ref array< ref array< vector > > locationBoundaries = new ref array<ref array<vector>>()
 
class DynamicMusicPlayerTrackHistoryLookupType TICK_TIME_OF_DATE_UPDATE_SECONDS = 300.0
 
const float TICK_LOCATION_CACHE_UPDATE_SECONDS = 120.0
 
const float TICK_LOCATION_UPDATE_SECONDS = 120.0
 
const float TICK_PRIORITY_LOCATION_UPDATE_SECONDS = 30.0
 
const float TICK_FADEOUT_PROCESSOR_SECONDS = 0.2
 
const int TRACKS_BUFFER_HISTORY_SIZE = 2
 
const float LOCATION_DISTANCE_MAX = 500
 
float m_TickTimeOfDateElapsed
 
float m_TickLocationCacheUpdateElapsed
 
float m_TickLocationUpdateElapsed
 
float m_TickPriorityLocationUpdateElapsed
 
float m_TickFadeOutProcessingElapsed
 
EDynamicMusicPlayerCategory m_CategorySelected
 
DynamicMusicTrackData m_CurrentTrack
 
ref DynamicMusicPlayerRegistry m_DynamicMusicPlayerRegistry
 
ref array< ref DynamicMusicTrackDatam_TracksLocationStaticCached
 map of dynamically registered locations during runtime
 
ref array< ref DynamicMusicTrackDatam_TracksLocationStaticPrioritizedCached
 static + filtered by the distance between player and center of zone
 
ref array< ref DynamicMusicTrackDatam_TracksLocationMatchedPlayerInside
 static prio + filtered by the distance between player and center of zone
 
AbstractWave m_SoundPlaying
 
bool m_WaitingForPlayback
 
ref map< EDynamicMusicPlayerCategory, ref SimpleCircularBuffer< int > > m_LastPlayedTrackBufferPerCategory
 gets the playback mode as set in sounds menu; 0 - all; 1 - menu only
 
vector m_PlayerPosition
 
float m_FadeoutTimeElapsed
 
float m_FadeoutTimeRequested
 
bool m_FadeoutInProgress
 
bool m_Created
 

Функции

◆ DetermineTrackByCategory()

void DetermineTrackByCategory ( EDynamicMusicPlayerCategory category)
protected
285 {
287 return;
288
289 if (IsPlaybackActive())
290 return;
291
292 switch (category)
293 {
296 break;
297
298 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DetermineTrackByCategory, 5000, false, category);
299 break;
300
303 break;
304
305 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DetermineTrackByCategory, 5000, false, category);
306 break;
307 case EDynamicMusicPlayerCategory.LOCATION_STATIC:
309 break;
310
311 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DetermineTrackByCategory, 5000, false, category);
312 break;
313 case EDynamicMusicPlayerCategory.LOCATION_STATIC_PRIORITY:
315 break;
316
317 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DetermineTrackByCategory, 5000, false, category);
318 break;
319 case EDynamicMusicPlayerCategory.LOCATION_DYNAMIC:
321 break;
322
323 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DetermineTrackByCategory, 5000, false, category);
324
325 break;
326 }
327 }
DayZGame g_Game
Definition DayZGame.c:3815
EDynamicMusicPlayerCategory m_CategorySelected
Definition DynamicMusicPlayer.c:85
ref DynamicMusicPlayerRegistry m_DynamicMusicPlayerRegistry
Definition DynamicMusicPlayer.c:87
bool SetSelectedTrackFromCategory(EDynamicMusicPlayerCategory category, notnull ref array< ref DynamicMusicTrackData > tracklist, int historyLookupType=DynamicMusicPlayerTrackHistoryLookupType.ANY)
Definition DynamicMusicPlayer.c:558
void DetermineTrackByCategory(EDynamicMusicPlayerCategory category)
Definition DynamicMusicPlayer.c:284
bool IsPlaybackActive()
Definition DynamicMusicPlayer.c:329
ref array< ref DynamicMusicTrackData > m_TracksLocationMatchedPlayerInside
static prio + filtered by the distance between player and center of zone
Definition DynamicMusicPlayer.c:94
EDynamicMusicPlayerCategory
Definition EDynamicMusicPlayerCategory.c:2
Definition DynamicMusicPlayer.c:54
const int BUFFER
Definition DynamicMusicPlayer.c:56
Definition EntityAI.c:95
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

Перекрестные ссылки DynamicMusicPlayerTrackHistoryLookupType::BUFFER, CALL_CATEGORY_SYSTEM, DetermineTrackByCategory(), g_Game, IsPlaybackActive(), m_CategorySelected, m_DynamicMusicPlayerRegistry, m_TracksLocationMatchedPlayerInside и SetSelectedTrackFromCategory().

Используется в DetermineTrackByCategory(), OnCategorySet() и OnUpdate().

◆ DynamicMusicPlayer()

void DynamicMusicPlayer ( DynamicMusicPlayerRegistry configuration)
private

fadeout settings

111 {
113 m_RequestedPlaybackMode = g_Game.GetProfileOptionInt(EDayZProfilesOptions.AMBIENT_MUSIC_MODE);
114
117
119
122
126
130
132
134
138
139 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(RefreshTracksCache, 5000);
140
142
143 m_Created = true;
144 }
const int TRACKS_BUFFER_HISTORY_SIZE
Definition DynamicMusicPlayer.c:75
float m_FadeoutTimeRequested
Definition DynamicMusicPlayer.c:105
bool m_Created
Definition DynamicMusicPlayer.c:108
void SetTimeOfDate()
Definition DynamicMusicPlayer.c:641
ref map< EDynamicMusicPlayerCategory, ref SimpleCircularBuffer< int > > m_LastPlayedTrackBufferPerCategory
gets the playback mode as set in sounds menu; 0 - all; 1 - menu only
Definition DynamicMusicPlayer.c:100
void OnProfileOptionChanged(EDayZProfilesOptions option, int value)
Definition DynamicMusicPlayer.c:337
float m_FadeoutTimeElapsed
Definition DynamicMusicPlayer.c:104
void RefreshTracksCache()
Definition DynamicMusicPlayer.c:690
ref array< ref DynamicMusicTrackData > m_TracksLocationStaticPrioritizedCached
static + filtered by the distance between player and center of zone
Definition DynamicMusicPlayer.c:92
ref array< ref DynamicMusicTrackData > m_TracksLocationStaticCached
map of dynamically registered locations during runtime
Definition DynamicMusicPlayer.c:91
EDayZProfilesOptions
Definition EDayZProfilesOptions.c:2
Definition DayZGame.c:398
static ref ScriptInvoker m_OnIntOptionChanged
Definition DayZGame.c:403
for backward compatibility
Definition DynamicMusicPlayer.c:901
static int ANY
Definition WorldData.c:407

Перекрестные ссылки WorldDataDaytime::ANY, CALL_CATEGORY_SYSTEM, g_Game, m_CategorySelected, m_Created, m_DynamicMusicPlayerRegistry, m_FadeoutTimeElapsed, m_FadeoutTimeRequested, m_LastPlayedTrackBufferPerCategory, DayZProfilesOptions::m_OnIntOptionChanged, m_TracksLocationMatchedPlayerInside, m_TracksLocationStaticCached, m_TracksLocationStaticPrioritizedCached, OnProfileOptionChanged(), RefreshTracksCache(), SetTimeOfDate() и TRACKS_BUFFER_HISTORY_SIZE.

Используется в MissionBaseWorld::MissionBase().

◆ FadeoutTrack()

void FadeoutTrack ( float fadeoutSeconds)
private
489 {
491 return;
492
494 {
495 #ifdef DIAG_DEVELOPER
496 DMPDebugPrint(string.Format("Stopping currently played track %1", m_CurrentTrack.m_SoundSet));
497 DMPDebugPrint(string.Format("-- Setting fadeout to %1", fadeoutSeconds));
498 #endif
499 m_FadeoutInProgress = true;
501 }
502 }
AbstractWave m_SoundPlaying
Definition DynamicMusicPlayer.c:96
bool m_FadeoutInProgress
Definition DynamicMusicPlayer.c:106
DynamicMusicTrackData m_CurrentTrack
Definition DynamicMusicPlayer.c:86

Перекрестные ссылки m_CurrentTrack, m_FadeoutInProgress, m_FadeoutTimeRequested и m_SoundPlaying.

Используется в OnLocationMatched().

◆ GetMaxWaitTimePerCategory()

float GetMaxWaitTimePerCategory ( EDynamicMusicPlayerCategory category)
private
672 {
673 float waitTime = m_DynamicMusicPlayerRegistry.m_SettingsByCategory[category].m_MaxWaitTimeSeconds;
674 #ifdef DIAG_DEVELOPER
675 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.DYNAMIC_MUSIC_PLAYER))
676 {
677 float timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
678 if (timeAccel > 0)
679 return waitTime / FeatureTimeAccel.GetFeatureTimeAccelValue();
680 }
681 #endif
682 return waitTime;
683 }

Перекрестные ссылки m_DynamicMusicPlayerRegistry.

Используется в GetWaitTimeForCategory().

◆ GetMinWaitTimePerCategory()

float GetMinWaitTimePerCategory ( EDynamicMusicPlayerCategory category)
private
658 {
659 float waitTime = m_DynamicMusicPlayerRegistry.m_SettingsByCategory[category].m_MinWaitTimeSeconds;
660 #ifdef DIAG_DEVELOPER
661 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.DYNAMIC_MUSIC_PLAYER))
662 {
663 float timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
664 if (timeAccel > 0)
665 return waitTime / FeatureTimeAccel.GetFeatureTimeAccelValue();
666 }
667 #endif
668 return waitTime;
669 }

Перекрестные ссылки m_DynamicMusicPlayerRegistry.

Используется в GetWaitTimeForCategory().

◆ GetPreviousTrackFadeoutSeconds()

float GetPreviousTrackFadeoutSeconds ( EDynamicMusicPlayerCategory category)
private
686 {
687 return m_DynamicMusicPlayerRegistry.m_SettingsByCategory[category].m_PreviousTrackFadeoutSeconds;
688 }

Перекрестные ссылки m_DynamicMusicPlayerRegistry.

Используется в OnLocationMatched().

◆ GetRectangularCoordsFromSize()

static array< vector > GetRectangularCoordsFromSize ( vector origin,
float size )
static
20 {
21 vector min = Vector(origin[0] - size, origin[1], origin[2] - size);
22 vector max = Vector(origin[0] + size, origin[1], origin[2] + size);
23
24 return {min, max};
25 }
Definition EnConvert.c:106
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки Vector().

◆ GetWaitTimeForCategory()

float GetWaitTimeForCategory ( EDynamicMusicPlayerCategory category)
protected
653 {
655 }
float GetMinWaitTimePerCategory(EDynamicMusicPlayerCategory category)
Definition DynamicMusicPlayer.c:657
float GetMaxWaitTimePerCategory(EDynamicMusicPlayerCategory category)
Definition DynamicMusicPlayer.c:671
Definition EnMath.c:7
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106

Перекрестные ссылки GetMaxWaitTimePerCategory(), GetMinWaitTimePerCategory() и Math::RandomFloatInclusive().

Используется в SetSelectedTrackFromCategory().

◆ InsertLocation()

void InsertLocation ( vector min,
vector max )
48 {
49 locationBoundaries.Insert({min, max});
50 }
ref array< ref array< vector > > locationBoundaries
Definition DynamicMusicPlayer.c:45

Перекрестные ссылки locationBoundaries.

◆ IsPlaybackActive()

bool IsPlaybackActive ( )
protected
330 {
332 }
bool m_WaitingForPlayback
Definition DynamicMusicPlayer.c:97

Перекрестные ссылки m_SoundPlaying и m_WaitingForPlayback.

Используется в DetermineTrackByCategory() и OnUpdate().

◆ IsPriotitizedCategorySelected()

bool IsPriotitizedCategorySelected ( )
protected
280 {
281 return m_CategorySelected == EDynamicMusicPlayerCategory.LOCATION_STATIC_PRIORITY || m_CategorySelected == EDynamicMusicPlayerCategory.LOCATION_DYNAMIC;
282 }

Перекрестные ссылки m_CategorySelected.

Используется в OnFadeoutFinished(), OnLocationMatched() и OnUpdate().

◆ OnCategorySet()

void OnCategorySet ( EDynamicMusicPlayerCategory category,
bool forced )
protected
352 {
353 #ifdef DIAG_DEVELOPER
354 DMPDebugPrint(string.Format(
355 "OnCategorySet() - category: %1, forced: %2",
357 forced),
358 );
359 #endif
360
362 }
Definition EnConvert.c:590
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
Definition EnConvert.c:601

Перекрестные ссылки DetermineTrackByCategory() и EnumTools::EnumToString().

Используется в SetCategory().

◆ OnFadeoutFinished()

void OnFadeoutFinished ( EDynamicMusicPlayerCategory category)
protected
433 {
434 if (m_SoundPlaying)
435 m_SoundPlaying.GetEvents().Event_OnSoundWaveEnded.Remove(OnTrackEnded);
436
437 StopTrack();
439 }
bool IsPriotitizedCategorySelected()
Definition DynamicMusicPlayer.c:279
void StopTrack()
Definition DynamicMusicPlayer.c:472
void SetCategory(EDynamicMusicPlayerCategory category, bool forced)
Definition DynamicMusicPlayer.c:241
void OnTrackEnded()
Definition DynamicMusicPlayer.c:364
AbstractWaveEvents GetEvents()
Definition Sound.c:164

Перекрестные ссылки AbstractWave::GetEvents(), IsPriotitizedCategorySelected(), m_SoundPlaying, OnTrackEnded(), SetCategory() и StopTrack().

Используется в OnUpdate().

◆ OnGameEvent()

void OnGameEvent ( EventType eventTypeId,
Param params )
private
271 {
273 {
276 }
277 }
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition gameplay.c:478

Перекрестные ссылки MPSessionPlayerReadyEventTypeID, SetCategory() и SetTimeOfDate().

◆ OnLocationMatched()

void OnLocationMatched ( EDynamicMusicPlayerCategory category,
bool isPriorityLocation )
protected

play prio location track (no fadeout)

play location track (no fadeout)

410 {
411 #ifdef DIAG_DEVELOPER
412 string messagePriority;
414 messagePriority = "(with priority)";
415 DMPDebugPrint(string.Format("Location matched %1", messagePriority));
416 #endif
417
419 {
421 {
424 }
425 else
426 SetCategory(category, true);
427 }
428 else
429 SetCategory(category, false);
430 }
float GetPreviousTrackFadeoutSeconds(EDynamicMusicPlayerCategory category)
Definition DynamicMusicPlayer.c:685
void FadeoutTrack(float fadeoutSeconds)
Definition DynamicMusicPlayer.c:488

Перекрестные ссылки FadeoutTrack(), GetPreviousTrackFadeoutSeconds(), IsPriotitizedCategorySelected(), m_CategorySelected и SetCategory().

Используется в OnUpdate().

◆ OnNextTrackSelected()

void OnNextTrackSelected ( DynamicMusicTrackData track,
float waitTime )
protected
390 {
393
394 if (m_Created)
395 m_Created = false;
396
397 #ifdef DIAG_DEVELOPER
398 DMPDebugPrint(string.Format(
399 "WaitTime set to %1s, deferring playback of \"%2\"",
400 (int)waitTime,
401 track.m_SoundSet),
402 );
404 #endif
405
406 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(PlayTrack, (int)waitTime * 1000, false, track);
407 }
void PlayTrack(DynamicMusicTrackData track)
Definition DynamicMusicPlayer.c:442

Перекрестные ссылки CALL_CATEGORY_SYSTEM, g_Game, m_Created, m_CurrentTrack, m_WaitingForPlayback и PlayTrack().

Используется в SetSelectedTrackFromCategory().

◆ OnProfileOptionChanged()

void OnProfileOptionChanged ( EDayZProfilesOptions option,
int value )
protected

Events

338 {
339 if (option == EDayZProfilesOptions.AMBIENT_MUSIC_MODE)
340 {
342
344 {
345 StopTrack();
347 }
348 }
349 }
void ResetWaitingQueue()
Definition DynamicMusicPlayer.c:478

Перекрестные ссылки m_CategorySelected, ResetWaitingQueue() и StopTrack().

Используется в DynamicMusicPlayer().

◆ OnTrackEnded()

void OnTrackEnded ( )
protected
365 {
366 #ifdef DIAG_DEVELOPER
367 if (m_CurrentTrack)
368 DMPDebugPrint(string.Format("Track END - %1", m_CurrentTrack.m_SoundSet));
369 #endif
370
373 m_WaitingForPlayback = false;
374 }

Перекрестные ссылки m_CurrentTrack, m_SoundPlaying и m_WaitingForPlayback.

Используется в OnFadeoutFinished() и PlayTrack().

◆ OnTrackStopped()

void OnTrackStopped ( )
protected

stopped only by fadeouts

377 {
379 #ifdef DIAG_DEVELOPER
380 if (m_CurrentTrack)
381 DMPDebugPrint(string.Format("Track STOP - %1", m_CurrentTrack.m_SoundSet));
382 #endif
383
386 m_WaitingForPlayback = false;
387 }

Перекрестные ссылки m_CurrentTrack, m_SoundPlaying и m_WaitingForPlayback.

Используется в PlayTrack().

◆ OnUpdate()

void OnUpdate ( float timeslice)
private

handle fadeouts

caching of locations based on distance from player (<= LOCATION_DISTANCE_MAX)

no playback at all OR playback of non-prioritized category

works as default category selector

menu only

147 {
149 return;
150
156
159 {
163 {
166 m_FadeoutInProgress = false;
168 }
169 else
171 }
172 else
173 {
175 {
178 {
181 }
182
184 {
185 if (g_Game.GetPlayer())
186 {
187 m_PlayerPosition = g_Game.GetPlayer().GetPosition();
188 m_PlayerPosition[1] = 0.0;
189 }
190
192
195 {
197 OnLocationMatched(EDynamicMusicPlayerCategory.LOCATION_DYNAMIC, true);
199 OnLocationMatched(EDynamicMusicPlayerCategory.LOCATION_STATIC_PRIORITY, true);
200 }
201 }
202
204 {
206
207 if (!IsPlaybackActive())
208 {
210 OnLocationMatched(EDynamicMusicPlayerCategory.LOCATION_STATIC, false);
211 }
212 }
213
215 {
218
222 }
223 }
224 else
225 {
226 if (!IsPlaybackActive())
228 }
229
230 }
231
232 #ifdef DIAG_DEVELOPER
233 if (DiagMenu.GetBool(DiagMenuIDs.SOUNDS_DYNAMIC_MUSIC_PLAYER_STATS))
234 {
235 DisplayDebugStats(true);
237 }
238 #endif
239 }
const float TICK_PRIORITY_LOCATION_UPDATE_SECONDS
Definition DynamicMusicPlayer.c:70
float m_TickLocationCacheUpdateElapsed
Definition DynamicMusicPlayer.c:79
const float TICK_FADEOUT_PROCESSOR_SECONDS
Definition DynamicMusicPlayer.c:73
float m_TickTimeOfDateElapsed
Definition DynamicMusicPlayer.c:78
float m_TickFadeOutProcessingElapsed
Definition DynamicMusicPlayer.c:82
void OnLocationMatched(EDynamicMusicPlayerCategory category, bool isPriorityLocation)
Definition DynamicMusicPlayer.c:409
const float TICK_LOCATION_CACHE_UPDATE_SECONDS
Definition DynamicMusicPlayer.c:68
const float TICK_LOCATION_UPDATE_SECONDS
Definition DynamicMusicPlayer.c:69
void ProcessFadeOut()
Definition DynamicMusicPlayer.c:504
class DynamicMusicPlayerTrackHistoryLookupType TICK_TIME_OF_DATE_UPDATE_SECONDS
bool PlayerInsideOfLocationFilter(ref array< ref DynamicMusicTrackData > locations)
Definition DynamicMusicPlayer.c:513
float m_TickPriorityLocationUpdateElapsed
Definition DynamicMusicPlayer.c:81
void OnFadeoutFinished(EDynamicMusicPlayerCategory category)
Definition DynamicMusicPlayer.c:432
float m_TickLocationUpdateElapsed
Definition DynamicMusicPlayer.c:80
vector m_PlayerPosition
Definition DynamicMusicPlayer.c:102
DiagMenuIDs
Definition EDiagMenuIDs.c:2
Definition EnDebug.c:233
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.

Перекрестные ссылки DetermineTrackByCategory(), g_Game, DiagMenu::GetBool(), IsPlaybackActive(), IsPriotitizedCategorySelected(), m_CategorySelected, m_DynamicMusicPlayerRegistry, m_FadeoutInProgress, m_FadeoutTimeElapsed, m_FadeoutTimeRequested, m_PlayerPosition, m_TickFadeOutProcessingElapsed, m_TickLocationCacheUpdateElapsed, m_TickLocationUpdateElapsed, m_TickPriorityLocationUpdateElapsed, m_TickTimeOfDateElapsed, m_TracksLocationStaticCached, m_TracksLocationStaticPrioritizedCached, OnFadeoutFinished(), OnLocationMatched(), PlayerInsideOfLocationFilter(), ProcessFadeOut(), RefreshTracksCache(), SetCategory(), SetTimeOfDate(), TICK_FADEOUT_PROCESSOR_SECONDS, TICK_LOCATION_CACHE_UPDATE_SECONDS, TICK_LOCATION_UPDATE_SECONDS, TICK_PRIORITY_LOCATION_UPDATE_SECONDS и TICK_TIME_OF_DATE_UPDATE_SECONDS.

◆ PlayerInsideOfLocationFilter() [1/2]

bool PlayerInsideOfLocationFilter ( ref array< ref DynamicMusicTrackData > locations)
private
514 {
516
517 if (locations.Count() > 0)
518 {
520 {
522 {
524 {
527
528 #ifdef DIAG_DEVELOPER
529 DMPDebugPrint(string.Format("Player inside location <%1, %2>", bounds[0], bounds[1]));
530 #endif
531 }
532 }
533 }
534 }
535
536 return m_TracksLocationMatchedPlayerInside.Count() > 0;
537 }
const int INDEX_NOT_FOUND
Definition gameplay.c:13
static proto bool IsPointInRectangle(vector mi, vector ma, vector p)
Returns if point is inside rectangle.

Перекрестные ссылки INDEX_NOT_FOUND, Math::IsPointInRectangle(), m_PlayerPosition и m_TracksLocationMatchedPlayerInside.

Используется в OnUpdate().

◆ PlayerInsideOfLocationFilter() [2/2]

bool PlayerInsideOfLocationFilter ( ref map< int, ref DynamicMusicLocationDynamicData > locations)
private
540 {
541 if (locations.Count() > 0)
542 {
544 {
546 {
547 #ifdef DIAG_DEVELOPER
548 DMPDebugPrint(string.Format("Player inside location <%1, %2>", location.m_Min, location.m_Max));
549 #endif
550 return true;
551 }
552 }
553 }
554
555 return false;
556 }

Перекрестные ссылки Math::IsPointInRectangle() и m_PlayerPosition.

◆ PlayTrack()

void PlayTrack ( DynamicMusicTrackData track)
private

register callbacks

invalid sound set is used

443 {
444 SoundParams soundParams = new SoundParams(track.m_SoundSet);
445 if (soundParams.IsValid())
446 {
448 SoundObject soundObject = soundBuilder.BuildSoundObject();
449 soundObject.SetKind(WaveKind.WAVEMUSIC);
450
451 m_SoundPlaying = GetGame().GetSoundScene().Play2D(soundObject, soundBuilder);
452 if (m_SoundPlaying)
453 {
454 m_SoundPlaying.Loop(false);
456
458 m_SoundPlaying.GetEvents().Event_OnSoundWaveEnded.Insert(OnTrackEnded);
459 m_SoundPlaying.GetEvents().Event_OnSoundWaveStopped.Insert(OnTrackStopped);
460
461 m_WaitingForPlayback = false;
462 }
463 }
464 else
465 {
466 m_WaitingForPlayback = false;
468 }
469
470 }
void OnTrackStopped()
Definition DynamicMusicPlayer.c:376
WaveKind
Definition Sound.c:2
class SoundObjectBuilder SoundObject(SoundParams soundParams)
void SoundObjectBuilder(SoundParams soundParams)
proto void Play()
proto void Loop(bool setLoop)
Definition Sound.c:46
Definition Sound.c:101
proto native CGame GetGame()

Перекрестные ссылки AbstractWave::GetEvents(), GetGame(), AbstractWave::Loop(), m_CurrentTrack, m_SoundPlaying, m_WaitingForPlayback, OnTrackEnded(), OnTrackStopped(), AbstractWave::Play(), SoundObject() и SoundObjectBuilder().

Используется в OnNextTrackSelected() и ResetWaitingQueue().

◆ ProcessFadeOut()

void ProcessFadeOut ( )
private
505 {
506 if (m_SoundPlaying)
507 {
510 }
511 }
proto void SetFadeOutFactor(float volume)

Перекрестные ссылки m_FadeoutTimeElapsed, m_FadeoutTimeRequested, m_SoundPlaying и AbstractWave::SetFadeOutFactor().

Используется в OnUpdate().

◆ RefreshTracksCache()

void RefreshTracksCache ( )
private
691 {
693 {
695 foreach (DynamicMusicTrackData track : m_DynamicMusicPlayerRegistry.m_TracksLocationStatic)
696 {
698 {
700 continue;
701 }
702
704 }
705
707 foreach (DynamicMusicTrackData trackPrio : m_DynamicMusicPlayerRegistry.m_TracksLocationStaticPrioritized)
708 {
710 {
712 continue;
713 }
714
716 }
717 }
718 }
const float LOCATION_DISTANCE_MAX
Definition DynamicMusicPlayer.c:76
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static vector CenterOfRectangle(vector min, vector max)
Definition EnMath.c:730

Перекрестные ссылки Math::CenterOfRectangle(), vector::Distance(), LOCATION_DISTANCE_MAX, m_DynamicMusicPlayerRegistry, m_PlayerPosition, m_TracksLocationStaticCached и m_TracksLocationStaticPrioritizedCached.

Используется в DynamicMusicPlayer() и OnUpdate().

◆ RegisterDynamicLocation()

void RegisterDynamicLocation ( notnull Entity caller,
int locationType,
float locationSize )
private
252 {
253 int id = caller.GetID();
254 if (!m_LocationsDynamic.Contains(id))
255 {
256 array<vector> minMax = DynamicMusicLocationDynamicData.GetRectangularCoordsFromSize(caller.GetPosition(), locationSize);
258 location.m_Type = locationType;
259 location.m_Min = minMax[0];
260 location.m_Max = minMax[1];
261 m_LocationsDynamic.Insert(id, location);
262 }
263 }

◆ ResetWaitingQueue()

void ResetWaitingQueue ( )
private
479 {
481 {
482 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(PlayTrack);
483 m_WaitingForPlayback = false;
485 }
486 }

Перекрестные ссылки CALL_CATEGORY_SYSTEM, g_Game, m_CurrentTrack, m_WaitingForPlayback и PlayTrack().

Используется в OnProfileOptionChanged().

◆ SelectRandomTrackIndexFromCategory()

int SelectRandomTrackIndexFromCategory ( EDynamicMusicPlayerCategory category,
int lookupType,
notnull array< ref DynamicMusicTrackData > tracks )
private
615 {
616 int count = tracks.Count();
617 if (count > 0)
618 {
619 int index = Math.RandomInt(0, count);
620
621 switch (lookupType)
622 {
624 return index;
625
627 // fallback - num of track is smaller than actual history size;
629 return index;
630
632 return index;
633
634 return INDEX_NOT_FOUND;
635 }
636 }
637
638 return INDEX_NOT_FOUND;
639 }
const int ANY
Definition DynamicMusicPlayer.c:55
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки DynamicMusicPlayerTrackHistoryLookupType::ANY, DynamicMusicPlayerTrackHistoryLookupType::BUFFER, INDEX_NOT_FOUND, m_LastPlayedTrackBufferPerCategory, Math::RandomInt() и TRACKS_BUFFER_HISTORY_SIZE.

Используется в SetSelectedTrackFromCategory().

◆ SelectRandomTrackIndexFromCategoryPriorityFlagFirst()

int SelectRandomTrackIndexFromCategoryPriorityFlagFirst ( EDynamicMusicPlayerCategory category,
notnull array< ref DynamicMusicTrackData > tracks )
private

main menu priority tracks first

fallback in case there is no priority track

589 {
592 {
594
595 foreach (int i, DynamicMusicTrackData track : tracks)
596 {
597
598 if (!track.m_HasPriority)
599 continue;
600
601 priorityFlagIndices.Insert(i);
602 }
603
604 if (priorityFlagIndices.Count() > 0)
605 return priorityFlagIndices[priorityFlagIndices.GetRandomIndex()];
606
608 return tracks.GetRandomIndex();
609 }
610
611 return INDEX_NOT_FOUND;
612 }

Перекрестные ссылки INDEX_NOT_FOUND.

Используется в SetSelectedTrackFromCategory().

◆ SetCategory()

void SetCategory ( EDynamicMusicPlayerCategory category,
bool forced )
private

◆ SetSelectedTrackFromCategory()

bool SetSelectedTrackFromCategory ( EDynamicMusicPlayerCategory category,
notnull ref array< ref DynamicMusicTrackData > tracklist,
int historyLookupType = DynamicMusicPlayerTrackHistoryLookupType.ANY )
private

currently prioritize main menu track on DMP start

559 {
560 if (tracklist.Count() == 0)
561 return true;
562
565 {
568 }
569
570 float trackIndex;
574 else
576
578 {
581
582 return true;
583 }
584
585 return false;
586 }
float GetWaitTimeForCategory(EDynamicMusicPlayerCategory category)
Definition DynamicMusicPlayer.c:652
int SelectRandomTrackIndexFromCategory(EDynamicMusicPlayerCategory category, int lookupType, notnull array< ref DynamicMusicTrackData > tracks)
Definition DynamicMusicPlayer.c:614
void OnNextTrackSelected(DynamicMusicTrackData track, float waitTime)
Definition DynamicMusicPlayer.c:389
int SelectRandomTrackIndexFromCategoryPriorityFlagFirst(EDynamicMusicPlayerCategory category, notnull array< ref DynamicMusicTrackData > tracks)
Definition DynamicMusicPlayer.c:588

Перекрестные ссылки WorldDataDaytime::ANY, GetWaitTimeForCategory(), INDEX_NOT_FOUND, m_Created, m_LastPlayedTrackBufferPerCategory, OnNextTrackSelected(), SelectRandomTrackIndexFromCategory() и SelectRandomTrackIndexFromCategoryPriorityFlagFirst().

Используется в DetermineTrackByCategory().

◆ SetTimeOfDate()

void SetTimeOfDate ( )
private
642 {
643 if (g_Game.GetMission())
644 {
645 m_ActualTimeOfDay = g_Game.GetMission().GetWorldData().GetDaytime();
646 return;
647 }
648
650 }
static int DAY
Definition WorldData.c:409

Перекрестные ссылки WorldDataDaytime::DAY и g_Game.

Используется в DynamicMusicPlayer(), OnGameEvent() и OnUpdate().

◆ StopTrack()

void StopTrack ( )
private
473 {
474 if (m_SoundPlaying)
476 }
proto void Stop()

Перекрестные ссылки m_SoundPlaying и AbstractWave::Stop().

Используется в OnFadeoutFinished() и OnProfileOptionChanged().

◆ UnregisterDynamicLocation()

void UnregisterDynamicLocation ( notnull Entity caller)
private
266 {
267 m_LocationsDynamic.Remove(caller.GetID());
268 }

Переменные

◆ LOCATION_DISTANCE_MAX

const float LOCATION_DISTANCE_MAX = 500
protected

Используется в RefreshTracksCache().

◆ locationBoundaries

◆ m_Category

◆ m_CategorySelected

◆ m_Created

bool m_Created
private

◆ m_CurrentTrack

◆ m_DynamicMusicPlayerRegistry

◆ m_FadeoutInProgress

bool m_FadeoutInProgress
private

Используется в FadeoutTrack() и OnUpdate().

◆ m_FadeoutTimeElapsed

float m_FadeoutTimeElapsed
private

Используется в DynamicMusicPlayer(), OnUpdate() и ProcessFadeOut().

◆ m_FadeoutTimeRequested

float m_FadeoutTimeRequested
private

◆ m_HasPriority

◆ m_LastPlayedTrackBufferPerCategory

ref map<EDynamicMusicPlayerCategory, ref SimpleCircularBuffer<int> > m_LastPlayedTrackBufferPerCategory
private

gets the playback mode as set in sounds menu; 0 - all; 1 - menu only

Используется в DynamicMusicPlayer(), SelectRandomTrackIndexFromCategory() и SetSelectedTrackFromCategory().

◆ m_LocationType

◆ m_Max

◆ m_Min

rectangle coords (2d only)

◆ m_PlayerPosition

vector m_PlayerPosition
private

◆ m_SoundPlaying

◆ m_SoundSet

string m_SoundSet

◆ m_TickFadeOutProcessingElapsed

float m_TickFadeOutProcessingElapsed
protected

Используется в OnUpdate().

◆ m_TickLocationCacheUpdateElapsed

float m_TickLocationCacheUpdateElapsed
protected

Используется в OnUpdate().

◆ m_TickLocationUpdateElapsed

float m_TickLocationUpdateElapsed
protected

Используется в OnUpdate().

◆ m_TickPriorityLocationUpdateElapsed

float m_TickPriorityLocationUpdateElapsed
protected

Используется в OnUpdate().

◆ m_TickTimeOfDateElapsed

float m_TickTimeOfDateElapsed
protected

Используется в OnUpdate().

◆ m_TimeOfDay

int m_TimeOfDay = -1

◆ m_TracksLocationMatchedPlayerInside

ref array<ref DynamicMusicTrackData> m_TracksLocationMatchedPlayerInside
protected

static prio + filtered by the distance between player and center of zone

Используется в DetermineTrackByCategory(), DynamicMusicPlayer() и PlayerInsideOfLocationFilter().

◆ m_TracksLocationStaticCached

ref array<ref DynamicMusicTrackData> m_TracksLocationStaticCached
private

map of dynamically registered locations during runtime

Используется в DynamicMusicPlayer(), OnUpdate() и RefreshTracksCache().

◆ m_TracksLocationStaticPrioritizedCached

ref array<ref DynamicMusicTrackData> m_TracksLocationStaticPrioritizedCached
private

static + filtered by the distance between player and center of zone

Используется в DynamicMusicPlayer(), OnUpdate() и RefreshTracksCache().

◆ m_Type

Используется в MindStateSoundEventBase::AlertedMoveSoundEvent(), DisplayElementBadge::BadgeBleeding(), DisplayElementBadge::BadgeFracture(), DisplayElementBadge::BadgeHeartbeat(), DisplayElementBadge::BadgeLegs(), DisplayElementBadge::BadgePills(), DisplayElementBadge::BadgePoisoned(), DisplayElementBadge::BadgeSick(), DisplayElementBadge::BadgeStuffed(), DisplayElementBadge::BadgeWet(), BotStateBase::Bot_TestSpawnOpen(), BotStateBase::BotSpawnEntityInHands(), MindStateSoundEventBase::CalmMoveSoundEvent(), CalmMoveSoundEvent(), CanPlay(), MindStateSoundEventBase::ChaseMoveSoundEvent(), ChaseMoveSoundEvent(), PlayerSoundEventBase::DamageSoundEvents(), PlayerSoundEventBase::DrowningEvents(), ContaminatedArea_Dynamic::EEInit(), DisplayElementBase::ElementStance(), HoldBreathSoundEventBase::ExhaustedBreathSoundEvent(), ExhaustedBreathSoundEvent(), PlayerSoundEventBase::ForceConsumeSoundEvent(), Managed::GameplayEffectsData(), GetType(), MessageReceiverBase::GetType(), Managed::GetWidgetSetType(), HasPriorityOverCurrent(), PlayerSoundEventBase::HeatComfortEventsBase(), HoldBreathSoundEventBase(), InfectedSoundEventBase(), AgentBase::Init(), Managed::Init(), Init(), Init(), UndergroundBunkerTrigger::Init(), PlayerSoundEventBase::InjurySoundEvents(), PlayerSoundEventBase::MeleeAttackSoundEvents(), BotStateBase::OnEntry(), OnRPC(), OnUpdateServer(), PlayerSoundEventBase::PickupHeavySoundEvent(), PickupHeavySoundEvent(), PlayerSoundEventBase(), HandEventBase::ReadFromContext(), SetType(), StaminaModifier(), StaminaSoundEventBase::StaminaNormalDummy(), PlayerSoundEventBase::StaminaSoundEventBase(), PlayerSoundEventBase::SymptomSoundEventBase(), DisplayElementTendency::TendencyBacteria(), DisplayElementTendency::TendencyBlood(), DisplayElementTendency::TendencyHealth(), DisplayElementTendency::TendencyHunger(), DisplayElementTendency::TendencyTemperature(), DisplayElementTendency::TendencyThirst() и HandEventBase::WriteToContext().

◆ m_WaitingForPlayback

bool m_WaitingForPlayback
private

◆ TICK_FADEOUT_PROCESSOR_SECONDS

const float TICK_FADEOUT_PROCESSOR_SECONDS = 0.2
protected

Используется в OnUpdate().

◆ TICK_LOCATION_CACHE_UPDATE_SECONDS

const float TICK_LOCATION_CACHE_UPDATE_SECONDS = 120.0
protected

Используется в OnUpdate().

◆ TICK_LOCATION_UPDATE_SECONDS

const float TICK_LOCATION_UPDATE_SECONDS = 120.0
protected

Используется в OnUpdate().

◆ TICK_PRIORITY_LOCATION_UPDATE_SECONDS

const float TICK_PRIORITY_LOCATION_UPDATE_SECONDS = 30.0
protected

Используется в OnUpdate().

◆ TICK_TIME_OF_DATE_UPDATE_SECONDS

class DynamicMusicPlayerTrackHistoryLookupType TICK_TIME_OF_DATE_UPDATE_SECONDS = 300.0

Используется в OnUpdate().

◆ TRACKS_BUFFER_HISTORY_SIZE

const int TRACKS_BUFFER_HISTORY_SIZE = 2
protected