DayZ 1.24
Loading...
Searching...
No Matches
PMTPlayback Class Reference
Inheritance diagram for PMTPlayback:
[legend]
Collaboration diagram for PMTPlayback:
[legend]

Private Member Functions

void PMTPlayback ()
 
TFResult TestOnePlaying ()
 
TFResult TestOnePlayingStandAloneAutoDestroy ()
 
TFResult TestOnePlayingStandAlone ()
 
TFResult TestWiggleStress ()
 
TFResult TestStopping ()
 
TFResult CheckOnePlaying ()
 
TFResult CheckOnePlayingSAAD ()
 
TFResult CheckOnePlayingSA ()
 
TFResult CheckStop (float dt)
 
void PassOnePlaying (ParticleSource p)
 
void OnePlayingSAADEnded (ParticleSource p)
 
void OnePlayingSAEnded (ParticleSource p)
 
void StopEnded (ParticleSource p)
 
- Private Member Functions inherited from PMTF
void PrintPMStats (notnull ParticleManager pm)
 
void PrintActiveStats ()
 
ParticleManager CreatePMFixedBlocking (int size)
 

Private Attributes

ref array< ParticleSourcem_ParticleSources = new array<ParticleSource>()
 
int m_OnePlayingManagerID
 
bool m_bOnePlayingTestSuccess = false
 
int m_OnePlayingSAADPSID
 
bool m_bOnePlayingSAADEnded = false
 
int m_OnePlayingSAPSID
 
bool m_bOnePlayingSAEnded = false
 
int m_StopPSID
 
float m_StopAccumulatedTime
 
bool m_bStopWasStopped = false
 
bool m_bStopWasResumed = false
 
bool m_bStopEnded = false
 

Static Private Attributes

static const float STOP_ACCUMULATED_TIME_STOP_CUTOFF = 2
 
static const float STOP_ACCUMULATED_TIME_PLAY_CUTOFF = 3
 

Detailed Description

Definition at line 1 of file PMTPlayback.c.

Constructor & Destructor Documentation

◆ PMTPlayback()

void PMTPlayback::PMTPlayback ( )
inlineprivate

Definition at line 29 of file PMTPlayback.c.

30 {
31 //AddInitTest("TestOnePlaying");
32 //AddInitTest("TestOnePlayingStandAloneAutoDestroy");
33 //AddInitTest("TestOnePlayingStandAlone");
34 //AddInitTest("TestWiggleStress");
35 AddInitTest("TestStopping");
36 }
void AddInitTest(string test)

References AddInitTest().

Member Function Documentation

◆ CheckOnePlaying()

TFResult PMTPlayback::CheckOnePlaying ( )
inlineprivate

Definition at line 123 of file PMTPlayback.c.

124 {
127 {
128 if (pm)
129 {
130 ParticleSource p = pm.GetParticle(0);
131 if (p.IsParticlePlaying())
132 return NTFR(TFR.PENDING);
133 else
135 }
136 else
137 return BTFR(Assert(false));
138 }
139 else
140 return BTFR(Assert(false));
141 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
TFResult NTFR(TFR result)
bool Assert(bool condition)
TFR
TFResult BTFR(bool result)
bool GetManager(int id, out ParticleManager pm)
Definition PMTF.c:17
bool m_bOnePlayingTestSuccess
Definition PMTPlayback.c:7
int m_OnePlayingManagerID
Definition PMTPlayback.c:6
Entity which has the particle instance as an ObjectComponent.

References Assert(), BTFR(), PMTF::GetManager(), m_bOnePlayingTestSuccess, m_OnePlayingManagerID, NTFR(), and ParticleManager().

◆ CheckOnePlayingSA()

TFResult PMTPlayback::CheckOnePlayingSA ( )
inlineprivate

Definition at line 178 of file PMTPlayback.c.

179 {
180 if (m_ParticleSources.IsValidIndex(m_OnePlayingSAPSID))
181 {
183 if (p)
184 {
185 if (p.IsParticlePlaying())
186 return NTFR(TFR.PENDING);
187 else
188 {
189 // Clean up the Particle, no leaking from tests!
190 GetGame().ObjectDelete(p);
191 // Make sure the particle ended, if it did, then success!
193 }
194 }
195 else
196 {
197 // It should not be gone, no autodestroy
198 return BTFR(Assert(false));
199 }
200 }
201 else
202 return BTFR(Assert(false));
203 }
ref array< ParticleSource > m_ParticleSources
Definition PMTPlayback.c:3
int m_OnePlayingSAPSID
Definition PMTPlayback.c:14
bool m_bOnePlayingSAEnded
Definition PMTPlayback.c:15
proto native CGame GetGame()

References Assert(), BTFR(), GetGame(), m_bOnePlayingSAEnded, m_OnePlayingSAPSID, m_ParticleSources, and NTFR().

◆ CheckOnePlayingSAAD()

TFResult PMTPlayback::CheckOnePlayingSAAD ( )
inlineprivate

Definition at line 144 of file PMTPlayback.c.

145 {
146 if (m_ParticleSources.IsValidIndex(m_OnePlayingSAADPSID))
147 {
149 if (p)
150 {
151 if (p.IsParticlePlaying())
152 return NTFR(TFR.PENDING);
153 else
154 {
156 {
157 // There might be one frame where it is still alive before getting cleaned up
158 return NTFR(TFR.PENDING);
159 }
160 else
161 {
162 // Should be gone when no longer playing
163 return BTFR(Assert(false));
164 }
165 }
166 }
167 else
168 {
169 // Make sure the particle ended, if it did, then success!
171 }
172 }
173 else
174 return BTFR(Assert(false));
175 }
bool m_bOnePlayingSAADEnded
Definition PMTPlayback.c:11
int m_OnePlayingSAADPSID
Definition PMTPlayback.c:10

References Assert(), BTFR(), m_bOnePlayingSAADEnded, m_OnePlayingSAADPSID, m_ParticleSources, and NTFR().

◆ CheckStop()

TFResult PMTPlayback::CheckStop ( float dt)
inlineprivate

Definition at line 206 of file PMTPlayback.c.

207 {
209
210 if (m_ParticleSources.IsValidIndex(m_StopPSID))
211 {
213 if (p)
214 {
215 if (p.IsParticlePlaying())
216 {
218 {
219 p.StopParticle();
221 m_bStopWasStopped = true;
222 }
223
224 return NTFR(TFR.PENDING);
225 }
226 else
227 {
228 // Means it was stopped before it was supposed to
229 // Possibly because particle length is shorter than STOP_ACCUMULATED_TIME_CUTOFF
231 return BTFR(false);
233 {
234 p.PlayParticle();
235 m_bStopWasResumed = true;
236 }
237 else if (m_bStopEnded)
238 {
239 // Clean up the Particle, no leaking from tests!
240 GetGame().ObjectDelete(p);
241 return BTFR(true);
242 }
243
244 return NTFR(TFR.PENDING);
245 }
246 }
247 else
248 {
249 // It should not be gone, no autodestroy
250 return BTFR(Assert(false));
251 }
252 }
253 else
254 return BTFR(Assert(false));
255 }
bool m_bStopEnded
Definition PMTPlayback.c:24
static const float STOP_ACCUMULATED_TIME_STOP_CUTOFF
Definition PMTPlayback.c:20
float m_StopAccumulatedTime
Definition PMTPlayback.c:19
bool m_bStopWasResumed
Definition PMTPlayback.c:23
static const float STOP_ACCUMULATED_TIME_PLAY_CUTOFF
Definition PMTPlayback.c:21
bool m_bStopWasStopped
Definition PMTPlayback.c:22

References Assert(), BTFR(), GetGame(), m_bStopEnded, m_bStopWasResumed, m_bStopWasStopped, m_ParticleSources, m_StopAccumulatedTime, m_StopPSID, NTFR(), STOP_ACCUMULATED_TIME_PLAY_CUTOFF, and STOP_ACCUMULATED_TIME_STOP_CUTOFF.

◆ OnePlayingSAADEnded()

void PMTPlayback::OnePlayingSAADEnded ( ParticleSource p)
inlineprivate

Definition at line 268 of file PMTPlayback.c.

269 {
271 }

References m_bOnePlayingSAADEnded.

Referenced by TestOnePlayingStandAloneAutoDestroy().

◆ OnePlayingSAEnded()

void PMTPlayback::OnePlayingSAEnded ( ParticleSource p)
inlineprivate

Definition at line 274 of file PMTPlayback.c.

275 {
277 }

References m_bOnePlayingSAEnded.

Referenced by TestOnePlayingStandAlone().

◆ PassOnePlaying()

void PMTPlayback::PassOnePlaying ( ParticleSource p)
inlineprivate

Definition at line 260 of file PMTPlayback.c.

261 {
263 }

References m_bOnePlayingTestSuccess.

Referenced by TestOnePlaying().

◆ StopEnded()

void PMTPlayback::StopEnded ( ParticleSource p)
inlineprivate

Definition at line 280 of file PMTPlayback.c.

281 {
282 m_bStopEnded = true;
283 }

References m_bStopEnded.

Referenced by TestStopping().

◆ TestOnePlaying()

TFResult PMTPlayback::TestOnePlaying ( )
inlineprivate

Definition at line 42 of file PMTPlayback.c.

43 {
46
47 DayZPlayer player = GetGame().GetPlayer();
48
49 ParticleSource p = pm.CreateParticleById(ParticleList.EXPLOSION_LANDMINE, new ParticleProperties(player.GetPosition() + player.GetDirection() * 3, true));
50 p.GetEvents().Event_OnParticleEnd.Insert(PassOnePlaying);
51
52 AddFrameTest("CheckOnePlaying");
53
54 return BTFR(p.IsParticlePlaying());
55 }
void AddFrameTest(string test)
int InsertManager(ParticleManager pm)
Definition PMTF.c:9
ParticleManager CreatePMFixedBlocking(int size)
Definition PMTF.c:42
void PassOnePlaying(ParticleSource p)
static const int EXPLOSION_LANDMINE

References AddFrameTest(), BTFR(), PMTF::CreatePMFixedBlocking(), ParticleList::EXPLOSION_LANDMINE, GetGame(), PMTF::InsertManager(), m_OnePlayingManagerID, ParticleManager(), and PassOnePlaying().

◆ TestOnePlayingStandAlone()

TFResult PMTPlayback::TestOnePlayingStandAlone ( )
inlineprivate

Definition at line 75 of file PMTPlayback.c.

76 {
77 DayZPlayer player = GetGame().GetPlayer();
78
79 ParticleSource p = ParticleSource.CreateParticle(ParticleList.EXPLOSION_LANDMINE, player.GetPosition() + player.GetDirection() * 3 - player.GetDirectionAside() * 3, true);
80 p.GetEvents().Event_OnParticleEnd.Insert(OnePlayingSAEnded);
81 p.DisableAutoDestroy();
82
84
85 AddFrameTest("CheckOnePlayingSA");
86
87 return BTFR(p.IsParticlePlaying());
88 }
void OnePlayingSAEnded(ParticleSource p)
static ParticleSource CreateParticle(int id, vector pos, bool playOnCreation=false, Object parent=null, vector ori=vector.Zero, bool forceWorldRotation=false, Class owner=null)
Create function.

References AddFrameTest(), BTFR(), ParticleSource::CreateParticle(), ParticleList::EXPLOSION_LANDMINE, GetGame(), m_OnePlayingSAPSID, m_ParticleSources, and OnePlayingSAEnded().

◆ TestOnePlayingStandAloneAutoDestroy()

TFResult PMTPlayback::TestOnePlayingStandAloneAutoDestroy ( )
inlineprivate

Definition at line 59 of file PMTPlayback.c.

60 {
61 DayZPlayer player = GetGame().GetPlayer();
62
63 ParticleSource p = ParticleSource.CreateParticle(ParticleList.EXPLOSION_LANDMINE, player.GetPosition() + player.GetDirection() * 3 + player.GetDirectionAside() * 3, true);
64 p.GetEvents().Event_OnParticleEnd.Insert(OnePlayingSAADEnded);
65
67
68 AddFrameTest("CheckOnePlayingSAAD");
69
70 return BTFR(p.IsParticlePlaying());
71 }
void OnePlayingSAADEnded(ParticleSource p)

References AddFrameTest(), BTFR(), ParticleSource::CreateParticle(), ParticleList::EXPLOSION_LANDMINE, GetGame(), m_OnePlayingSAADPSID, m_ParticleSources, and OnePlayingSAADEnded().

◆ TestStopping()

TFResult PMTPlayback::TestStopping ( )
inlineprivate

Definition at line 104 of file PMTPlayback.c.

105 {
106 DayZPlayer player = GetGame().GetPlayer();
107
108 //ParticleSource p = ParticleSource.CreateParticle(ParticleList.EXPLOSION_LANDMINE, player.GetPosition() + player.GetDirection() * 4, true);
110 p.GetEvents().Event_OnParticleEnd.Insert(StopEnded);
111 p.DisableAutoDestroy();
112
114
115 AddFrameTest("CheckStop");
116
117 return BTFR(p.IsParticlePlaying());
118 }
void StopEnded(ParticleSource p)
static const vector Zero
Definition EnConvert.c:110

References AddFrameTest(), BTFR(), ParticleSource::CreateParticle(), ParticleList::EXPLOSION_LANDMINE, GetGame(), m_ParticleSources, m_StopPSID, StopEnded(), and vector::Zero.

◆ TestWiggleStress()

TFResult PMTPlayback::TestWiggleStress ( )
inlineprivate

Definition at line 92 of file PMTPlayback.c.

93 {
94 DayZPlayer player = GetGame().GetPlayer();
95
97 p.SetWiggle(90, 0.1);
98
99 return BTFR(p.IsParticlePlaying());
100 }
static const int ROADFLARE_BURNING_MAIN

References BTFR(), ParticleSource::CreateParticle(), GetGame(), and ParticleList::ROADFLARE_BURNING_MAIN.

Member Data Documentation

◆ m_bOnePlayingSAADEnded

bool PMTPlayback::m_bOnePlayingSAADEnded = false
private

Definition at line 11 of file PMTPlayback.c.

Referenced by CheckOnePlayingSAAD(), and OnePlayingSAADEnded().

◆ m_bOnePlayingSAEnded

bool PMTPlayback::m_bOnePlayingSAEnded = false
private

Definition at line 15 of file PMTPlayback.c.

Referenced by CheckOnePlayingSA(), and OnePlayingSAEnded().

◆ m_bOnePlayingTestSuccess

bool PMTPlayback::m_bOnePlayingTestSuccess = false
private

Definition at line 7 of file PMTPlayback.c.

Referenced by CheckOnePlaying(), and PassOnePlaying().

◆ m_bStopEnded

bool PMTPlayback::m_bStopEnded = false
private

Definition at line 24 of file PMTPlayback.c.

Referenced by CheckStop(), and StopEnded().

◆ m_bStopWasResumed

bool PMTPlayback::m_bStopWasResumed = false
private

Definition at line 23 of file PMTPlayback.c.

Referenced by CheckStop().

◆ m_bStopWasStopped

bool PMTPlayback::m_bStopWasStopped = false
private

Definition at line 22 of file PMTPlayback.c.

Referenced by CheckStop().

◆ m_OnePlayingManagerID

int PMTPlayback::m_OnePlayingManagerID
private

Definition at line 6 of file PMTPlayback.c.

Referenced by CheckOnePlaying(), and TestOnePlaying().

◆ m_OnePlayingSAADPSID

int PMTPlayback::m_OnePlayingSAADPSID
private

Definition at line 10 of file PMTPlayback.c.

Referenced by CheckOnePlayingSAAD(), and TestOnePlayingStandAloneAutoDestroy().

◆ m_OnePlayingSAPSID

int PMTPlayback::m_OnePlayingSAPSID
private

Definition at line 14 of file PMTPlayback.c.

Referenced by CheckOnePlayingSA(), and TestOnePlayingStandAlone().

◆ m_ParticleSources

◆ m_StopAccumulatedTime

float PMTPlayback::m_StopAccumulatedTime
private

Definition at line 19 of file PMTPlayback.c.

Referenced by CheckStop().

◆ m_StopPSID

int PMTPlayback::m_StopPSID
private

Definition at line 18 of file PMTPlayback.c.

Referenced by CheckStop(), and TestStopping().

◆ STOP_ACCUMULATED_TIME_PLAY_CUTOFF

const float PMTPlayback::STOP_ACCUMULATED_TIME_PLAY_CUTOFF = 3
staticprivate

Definition at line 21 of file PMTPlayback.c.

Referenced by CheckStop().

◆ STOP_ACCUMULATED_TIME_STOP_CUTOFF

const float PMTPlayback::STOP_ACCUMULATED_TIME_STOP_CUTOFF = 2
staticprivate

Definition at line 20 of file PMTPlayback.c.

Referenced by CheckStop().


The documentation for this class was generated from the following file: