Helper functions for handling sound, music and dialogue
bool _Sound_Global_EntryAffected(int alIdx, eSoundEntryType aAffectedTypes)
void Sound_SetGlobalSpeed(float afFreq, eSoundEntryType aAffectedTypes=eSoundEntryType_WorldAll)
Sets the relative frequency of all sounds.
void Sound_FadeGlobalSpeed(float afFreq, float afTime, eSoundEntryType aAffectedTypes=eSoundEntryType_WorldAll)
Fade the relative frequency of all sounds.
void Sound_SetGlobalVolume(float afVolume, eSoundEntryType aAffectedTypes=eSoundEntryType_WorldAll)
Set the relative volume of all sounds.
void Sound_FadeGlobalVolume(float afVolume, float afTime, eSoundEntryType aAffectedTypes=eSoundEntryType_WorldAll)
Fade the relative volume of all sounds.
void Sound_CreateAIEventAtEntity(const tString &in asEntity, float afRadius, int alPrio)
Creates an event that is heard by any entity with the Listener component
void Sound_CreateAtEntity(const tString &in asSoundName, const tString &in asSoundFile, const tString &in asEntity, float afFadeTime=0.0f, bool abSaveSound=false, float afTargetVolume=1.0f)
Create and play a sound (.snt) file at the position of an entity or player.
void Sound_CreateAtEntity_UsePrefix(const tString &in asSoundName, const tString &in asSoundFile, const tString &in asEntity, float afFadeTime, bool abSaveSound, float afTargetVolume=1.0f)
Create and play a sound (.snt) file at the position of an entity or player. If a Soundscape area SoundPrefix is set, then that will be used as a parent folder for the sound.
void Sound_Play(const tString &in asSoundName, float afFadeTime, bool abResetVolMul=false)
Play a sound that exists in the level editor, attached to an entity, or previously created that has been stopped and now should be played again.
void Sound_Stop(const tString &in asSoundName, float afFadeTime)
Stop a sound that is currently playing. Can be sound entities or Gui sounds.
void Sound_Fade(const tString &in asSoundName, float afVolumeDest, float afFadeTime)
Fade/Change the volume of a sound entity.
void Sound_PlayGui(const tString &in asSoundFile, float afVolume, eSoundEntryType aEntryType=eSoundEntryType_Gui)
Play a sound without any world position, either .snt files or any of the supported formats (.wav, .ogg etc) without the need of a .snt file.
void Sound_FadeInGui(const tString &in asSoundFile, float afVolume, float afFadeTime)
Fades in a GUI sound. This is can called directly after Sound_PlayGui or in case the sound doesn't exist, start it.
void Sound_StopGui(const tString &in asSoundFile, float afFadeTime, bool abPlayEnd=true)
Stops a GUI sounds
void Sound_FadeGuiVolume(const tString &in asSoundFile, float afVolumeDest, float afFadeTime)
Fades a GUI sound volume to another
void Sound_FadeGuiSpeed(const tString &in asSoundFile, float afSpeedDest, float afFadeTime)
Fades a GUI sound speed to another
void Sound_SetGuiParam(const tString &in asSoundFile, const tString &in asParam, float afValue)
Sets the param of a gui sound
bool Sound_GuiIsPlaying(const tString &in asSoundFile)
Checks if a gui sound is playing.
void Sound_PreloadGroup(const tString &in asInternalPath, bool abSubGroups)
Preloads a group of sounds and its subgroups if selected Preloading removes lag spikes that can occur when loading a sound from the hdd
void Sound_PreloadProject(const tString &in asName)
Preloads a whole sound project and all sounds within it Preloading removes lag spikes that can occur when loading a sound from the hdd
void Sound_PreloadCoreSounds()
Preloads all the basic sounds
void Sound_PreloadCoreUWSounds()
void Sound_PreloadCoreInteractions()
void Sound_PreloadCoreUWInteractions()
bool Sound_Exists(const tString &in asSoundName)
Returns true or false if a given sound entity exists
void Music_PlayExt(const tString &in asFile, bool abLoop, float afVolume, float afFreq, float afVolumeFadeTime, float afFreqFadeTime, eMusicPrio alPrio, bool abResume)
Play music with extended options.
void Music_Play(const tString &in asFile, float afVolume, bool abLoop, eMusicPrio alPrio)
Play music at standard frequency with a default fade time of 0.3 seconds.
void Music_PlayOverlay(const tString &in asFile, float afVolume)
Plays a piece of music over the currently running music TODO: Needs to have proper code!
void Music_Stop(float afFadeTime, eMusicPrio alPrio)
Stop a music track for a certain priority from playing.
void Music_StopAll(float afFadeTime)
Stop a music tracks for all priorities
void Music_AddDynamicTrack(tID a_idEntity, int alTrackPrio, eMusicPrio alMusicPrio, const tString &in asFile, float afVolume, float afFadeInTime, float afFadeOutTime)
This adds music that is meant to only be played during a certain occurance, eg when an creature is hunting the player.
void Music_RemoveDynamicTrack(tID a_idEntity)
This removes the dynamic track for certain entity and, if playing, fades out the music associated with it.
void Music_FadeVolumeMul(float afMul, float afTime)
Fades the volume multiplier for music.
bool Voice_Play(const tString &in asSubject, int alSpecificLineIdx=-1, const tString &in asCallback="", int alPrio=0)
Starts playing a voice
void Voice_PlayWhenPossible(const tString &in asSubject, const tString &in asConditionCallback="", float afMaxCheckTime=30.0f, float afMinQuietTime=5.0f, const tString &in asVoiceCallback="", int alPrio=0)
Starts playing a voice, but if another one is already playing it queues it until no other sound is playing and some custom conditions are met.
void _Voice_PlayWhenPossible_CheckTimer(const tString &in asTimer)
void Voice_AbortIfQueued(const tString &in asSubject)
If a subject is queued (still not played) after started with Voice_PlayWhenPossible, use this to remove it and make sure it never plays
void Voice_ClearQueued()
Clears all queued subjects.
bool Voice_IsQueued(const tString &in asSubject)
If a subject is queued with Voice_PlayWhenPossible, return true
bool Voice_SubjectExists(const tString &in asSubject)
Checks if the specified subject exists.
int Voice_GetSubjectLineNumber(const tString &in asSubject)
Gets the number of subject lines in a subject. Returns 0 if the subject does not exist.
tString Voice_GetSubjectSceneName(const tString &in asSubject)
Gets the name of the scene that the specified subject belongs to.
Returns: tString , The scene the subject belongs to.
void Voice_SetSource(const tString &in asCharacter, const tString &in asEntityName, float afMinDistance, float afMaxDistance, bool abUse3D, float afMaxPlayerListeningRange=-1, float afMinFreq=22000, float afMaxFreq=22000, eLuxVoiceSourceFreqencyFlag aFrequencyFlags=eLuxVoiceSourceFreqencyFlag_None)
Sets the source of voice. Note that this can be a moving entity.
void Voice_StopAll()
Stops all voices playing
void Voice_Stop(const tString &in asScene)
Stops all voices in a scene.
void Voice_SkipCurrentLine(const tString &in asScene)
Skips the current line (same as stop but response triggers are used)
void Voice_SkipCurrentSound(const tString &in asScene)
Skips the current sound and jumps to next (if any)
void Voice_AdvanceFromCurrentSound(const tString &in asScene)
Like SkipCurrentSound, but if there is subtitle it makes sure it is displayed first.
void Voice_SetPaused(const tString &in asScene, bool abX)
Stops all voices in a scene.
void Voice_SetPausedAll(bool abX)
Stops all active voice scenes
void Voice_SetFocusScene(const tString &in asScene)
Sets the focus for a scene even if a scene with higher focusprio is playing. This makes the voices in the scene show subtitles and voices from other scenes lower. This will stay in effect until another scene is set. Note that a new subject in a scene with higher focus prio will override this.
void Voice_FadeSceneVolumeTo(const tString &in asScene, float afVolume, float afTime)
Fades the volume of the voices from a specfic scene
bool Voice_CharacterIsSpeaking(const tString &in asCharacter)
If a character is currently speaking (i.e their voice is played).
bool Voice_SceneIsActive(const tString &in asScene)
If the specified scene is currently active.
Returns: bool, true if scene is currently active.
bool Voice_SubjectIsPlaying(const tString &in asSubject)
If the specified subject is currently being played.
Returns: bool, true if subject is currently active.
bool Voice_AnySceneIsActive()
If any scene is currently active.
Returns: bool, true if any scene is currently active.
bool Voice_SceneInvolvingCharacterIsActive(const tString &in asCharacter)
True if a scene involving this character is currently active.
Returns: bool, true if any scene involving the character is currently active.
void Voice_SetCharacterSpeakingCallback(const tString &in asCharacter, const tString &in asCallback)
Sets a callback that is called when a character starts and stops speaking. If character callback exists, the callback func is replaced with the latest one.
void Voice_RemoveCharacterSpeakingCallback(const tString &in asCharacter)
Removes a callback that is called when a character starts and stops speaking
void Dialog_Begin(const tString &in asName="")
Begins the declaration of a dialog. Must be called before any other dialog creation is done.
void Dialog_End(const tString &in asStartBranch="")
Ends the declaration of a dialog and starts the dialog. After this no more dialog creation funcs can be called without calling Dialog_Begin again.
void Dialog_SetCallbackFunc(const tString &in asFunc)
Sets a callback function for the dialog. NOTE: Currently not used!
void Dialog_AddBranch(const tString &in asName, const tString &in asNextBranch="")
Adds a branch (a list of subjects) to the dialog. Dialog_Begin must be called before this is used!
void Dialog_AddBranchAndSubject(const tString &in asSubjectAndBranchName, const tString &in asNextBranch="", const tString &in asCallback="")
Adds a branch with a single subject to the dialog. The branch gets the same name as the subject. Dialog_Begin must be called before this is used!
void Dialog_AddSubject(const tString &in asSubject, const tString &in asCallback="")
Adds a subject to the latest added branch. The subjects will be played in order they are added. Dialog_AddBranch must be called before this is used!
void Dialog_AddPause(float afTime, const tString &in asCallback="")
Adds a pause to the latest added branch. This pause will come after Dialog_AddBranch must be called before this is used!
void Dialog_SetResponseTimeLimit(float afTime)
Set the response time for the response options. This is how long the player has to pick. Dialog_AddSubject must be called before this is used!
void Dialog_AddResponseOption(const tString &in asEntry, const tString &in asBranch, int alOptionId=-1, const tString &in asCallback="")
Adds a response option that is shown after the subject is over. Max number is 4, +1 default (this actually depends on the game implementation, but this the default max). Important: The defauly subject must be added last! Dialog_AddSubject must be called before this is used!
void Dialog_AddResponseCondition_VarIsSet(const tString &in asVar)
Adds a condition that must be true for the option reponse option to be added. This checks if var is greater than 0. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponseCondition_VarNotSet(const tString &in asVar)
Adds a condition that must be true for the option reponse option to be added. This checks if var is less than 1 Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponseCondition_VarEqual(const tString &in asVar, int alVal)
Adds a condition that must be true for the option reponse option to be added. This checks if var is equal to a value. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponseCondition_VarLesser(const tString &in asVar, int alVal)
Adds a condition that must be true for the option reponse option to be added. This checks if var is lesser than a value. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponseCondition_VarGreater(const tString &in asVar, int alVal)
Adds a condition that must be true for the option reponse option to be added. This checks if var is greater than a value. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponseEvent_SetVar(const tString &in asVar, int alVal=1)
Event that happens after option is picked. This sets the value of a variable. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponseEvent_IncVar(const tString &in asVar, int alVal=1)
Event that happens after option is picked. This increments the value of a variable. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddResponse_OneTimeCheck(const tString &in asVar)
This makes sure that the option is only shown once. Dialog_AddResponseOption must be called before this is used!
void Dialog_AddEndEvent_SetVar(const tString &in asVar, int alValue=1)
Sets the value of an internal Dialog variableafter a subject is over. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_IncVar(const tString &in asVar, int alValue=1)
Increments the value of an internal Dialog variable after a subject is over. If var was not set priorly, it will start with 0. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_VarIsSet(const tString &in asVar, const tString &in asNewBranch)
Checks if a variable as a value greater than 0 and exists. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_VarEquals(const tString &in asVar, int alValue, const tString &in asNewBranch)
Checks if a variable is equal to a value. If a variable does not exist it will assume to have value 0. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_VarGreater(const tString &in asVar, int alValue, const tString &in asNewBranch)
Checks if a variable is greater than a value. If a variable does not exist it will assume to have value 0. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_VarLesser(const tString &in asVar, int alValue, const tString &in asNewBranch)
Checks if a variable is lesser than a value. If a variable does not exist it will assume to have value 0. Dialog_AddSubject must be called before this is used!
void Dialog_AddLineEvent_OutOfRange(const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of every line. This event checks if player is out of range from all characters in the dialog, and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_OutOfRange(const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of the subject. This event checks if player is out of range from all characters in the dialog, and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddLineEvent_PlayerNotLooking(const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of every line. This event checks if is not looking at any character in the dialog, and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_PlayerNotLooking(const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of the subject. This event checks if is not looking at any character in the dialog, and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddLineEvent_PlayerNotLookingOrOutOfRange(const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of every line. This event checks if is not looking at any character any character or is out of range, and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_PlayerNotLookingOrOutOfRange(const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of subject. This event checks if is not looking at any character any character or is out of range, and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddLineEvent_Callback(const tString &in asCallbackFunc, const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of every line. This event checks if a custom callback returns true and if so branches. Dialog_AddSubject must be called before this is used!
void Dialog_AddEndEvent_Callback(const tString &in asCallbackFunc, const tString &in asNewBranch)
Adds a branching event to the latest added subject. Checked at end of the subject. This event checks if a custom callback returns true and if so branches. Dialog_AddSubject must be called before this is used!
bool Dialog_CharacterIsActive(const tString &in asName)
Checks if a character is currently taking part in a dialog.
void Dialog_Stop(const tString &in asName)
Stops a dialog
void Dialog_StopAll()
Stops all dialog
void Dialog_StartConversation_CharMover(const tString &in asVoiceCharacter, const tString &in asFocusEntityName, int alHeadBoneIndex, cLuxCharMover @apCharMover, float afMinTurnAngle, float afMaxMoveDist=0.5f)
Starts a dialog with an entity that has a CharMover. Should only be used internally by entities.
void Dialog_StartConversation_PosBased(const tString &in asVoiceCharacter, const tString &in asFocusEntity, const tString &in asPositionArea, const tString &in asHeadBone="", float afMaxMoveDist=0.5f, cVector3f avFocusOffset=cVector3f_Zero)
Starts a dialog with an entity, moving the player to a position to have the conversation.
void Dialog_StartConversation(const tString &in asVoiceCharacter, const tString &in asFocusEntityName, float afMaxMoveDist=0.5f, cVector3f avFocusOffset=cVector3f_Zero)
Starts a dialog with an entity.
tString Dialog_GetCharacterScene(const tString &in asCharacter)
Gets the scene the character is currently in.
void Dialog_SetVar(const tString &in asVar, int alValue=1)
Sets the value of an internal Dialog variable
void Dialog_IncVar(const tString &in asVar, int alValue=1)
Incremements the value of an internal Dialog variable. If var was not set priorly, it will start with 0.
int Dialog_GetVar(const tString &in asVar)
Gets the value of an internal Dialog variable. If it does not exist, 0 is returned.
void Dialog_GetCharactersInSubject(const tString &in asSubject, array< tString > &out avOutCharacters)
Returns a list of the characters who speak in a particular dialog subject.