Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SoundCinematicTrack.c
Go to the documentation of this file.
1[CinematicTrackAttribute(name:"Sound Track", description:"Track used for triggering sound")]
3{
4 [Attribute("")]
5 protected string m_sResourceName;
6
7 [Attribute("")]
8 protected string m_sSoundEvent;
9
10 [Attribute("")]
11 protected string m_sEntityName;
12
13 [Attribute("")]
14 protected string m_sBoneName;
15
16 [Attribute("")]
17 protected vector m_vOffset;
18
19 [Attribute("")]
20 protected string m_sSignalName1;
21
22 [Attribute("")]
23 protected float m_fSignalValue1;
24
25 [Attribute("")]
26 protected string m_sSignalName2;
27
28 [Attribute("")]
29 protected float m_fSignalValue2;
30
31 [Attribute("")]
32 protected string m_sSignalName3;
33
34 [Attribute("")]
35 protected float m_fSignalValue3;
36
37 [Attribute("")]
38 protected string m_sSignalName4;
39
40 [Attribute("")]
41 protected float m_fSignalValue4;
42
43 [Attribute()]
44 protected bool m_bUpdatePosition;
45
46 [Attribute(desc:"Passes GRoomSize variable to RoomSize signal")]
47 protected bool m_bSetRoomSize;
48
49 [Attribute(desc:"Passes GInterior variable to Interior signal")]
50 protected bool m_bSetInterior;
51
53
54 override void OnApply(float time)
55 {
56 if (m_AudioHandle == AudioHandle.Invalid)
57 {
58 return;
59 }
60
61 if (AudioSystem.IsSoundPlayed(m_AudioHandle))
62 {
63 m_AudioHandle = AudioHandle.Invalid;
64 }
65
67 {
68 vector mat[4];
70
71 AudioSystem.SetSoundTransformation(m_AudioHandle, mat);
72 }
73 }
74
76 void PlayEvent()
77 {
78 if (m_sResourceName.IsEmpty() || m_sSoundEvent.IsEmpty())
79 {
80 return;
81 }
82
83 array<string> signalNames = {};
84 array<float> signalValues = {};
85
86
87 // Handle signals
88 if (!m_sSignalName1.IsEmpty())
89 {
90 signalNames.Insert(m_sSignalName1);
91 signalValues.Insert(m_fSignalValue1);
92 }
93
94 if (!m_sSignalName2.IsEmpty())
95 {
96 signalNames.Insert(m_sSignalName2);
97 signalValues.Insert(m_fSignalValue2);
98 }
99
100 if (!m_sSignalName3.IsEmpty())
101 {
102 signalNames.Insert(m_sSignalName3);
103 signalValues.Insert(m_fSignalValue3);
104 }
105
106 if (!m_sSignalName4.IsEmpty())
107 {
108 signalNames.Insert(m_sSignalName4);
109 signalValues.Insert(m_fSignalValue4);
110 }
111
112 if (m_bSetRoomSize)
113 {
114 const float gRoomSize = AudioSystem.GetVariableValue("GRoomSize", "{A60F08955792B575}Sounds/_SharedData/Variables/GlobalVariables.conf");
115 signalNames.Insert("RoomSize");
116 signalValues.Insert(gRoomSize);
117 }
118
119 if (m_bSetInterior)
120 {
121 const float gInterior = AudioSystem.GetVariableValue("GInterior", "{A60F08955792B575}Sounds/_SharedData/Variables/GlobalVariables.conf");
122 signalNames.Insert("Interior");
123 signalValues.Insert(gInterior);
124 }
125
126 // Handle offset
127 vector mat[4];
129
130 // Play sound
131 m_AudioHandle = AudioSystem.PlayEvent(m_sResourceName, m_sSoundEvent, mat, signalNames, signalValues);
132 }
133
136 {
137 AudioSystem.TerminateSound(m_AudioHandle);
138 }
139
140 void GetTransformation(out vector mat[4])
141 {
142 IEntity owner;
143
144 if (m_sEntityName.IsEmpty())
145 {
146 Math3D.MatrixIdentity4(mat);
147 mat[3] = m_vOffset;
148 }
149 else
150 {
151 owner = FindOwner(m_sEntityName);
152 if (owner)
153 {
154 if (!m_sBoneName.IsEmpty())
155 {
156 Animation animation = owner.GetAnimation();
157 if (!animation)
158 {
159 owner.GetTransform(mat);
160 return;
161 }
162
163 TNodeId boneIndex = animation.GetBoneIndex(m_sBoneName);
164 animation.GetBoneMatrix(boneIndex, mat);
165 mat[3] = owner.CoordToParent(mat[3]);
166 }
167 else
168 {
169 owner.GetTransform(mat);
170
171 if (m_vOffset != vector.Zero)
172 {
173 mat[3] = owner.CoordToParent(m_vOffset);
174 }
175 }
176 }
177 else
178 {
179 Math3D.MatrixIdentity4(mat);
180 mat[3] = m_vOffset;
181 }
182 }
183 }
184}
void CinematicEventAttribute(string name="")
Definition attributes.c:18
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Animation GetAnimation()
proto external void GetTransform(out vector mat[])
proto external vector CoordToParent(vector coord)
override void OnApply(float time)
void GetTransformation(out vector mat[4])
SCR_FieldOfViewSettings Attribute
int TNodeId
Node global id is a hash of name of the node.
Definition EnEntity.c:18