MCPcopy Create free account
hub / github.com/JACoders/OpenJK / ScheduleLoopedEffect

Method ScheduleLoopedEffect

code/cgame/FxScheduler.cpp:202–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202int CFxScheduler::ScheduleLoopedEffect( int id, int boltInfo, bool isPortal, int iLoopTime, bool isRelative )
203{
204 int i;
205
206 assert(id);
207 assert(boltInfo!=-1);
208
209 for (i=0;i<MAX_LOOPED_FX;i++) //see if it's already playing so we can just update it
210 {
211 if (mLoopedEffectArray[i].mId == id &&
212 mLoopedEffectArray[i].mBoltInfo == boltInfo &&
213 mLoopedEffectArray[i].mPortalEffect == isPortal
214 )
215 {
216#ifdef _DEBUG
217// theFxHelper.Print( "CFxScheduler::ScheduleLoopedEffect- updating %s\n", mEffectTemplates[id].mEffectName);
218#endif
219 break;
220 }
221 }
222
223 if(i==MAX_LOOPED_FX) //didn't find it existing, so find a free spot
224 {
225 for (i=0;i<MAX_LOOPED_FX;i++)
226 {
227 if (!mLoopedEffectArray[i].mId)
228 {
229 break;
230 }
231 }
232 }
233
234 if(i==MAX_LOOPED_FX)
235 {//bad
236 assert(i!=MAX_LOOPED_FX);
237 theFxHelper.Print( "CFxScheduler::AddLoopedEffect- No Free Slots available for %d\n", mEffectTemplates[id].mEffectName);
238 return -1;
239 }
240 mLoopedEffectArray[i].mId = id;
241 mLoopedEffectArray[i].mBoltInfo = boltInfo;
242 mLoopedEffectArray[i].mPortalEffect = isPortal;
243 mLoopedEffectArray[i].mIsRelative = isRelative;
244 mLoopedEffectArray[i].mNextTime = theFxHelper.mTime + mEffectTemplates[id].mRepeatDelay ;
245 mLoopedEffectArray[i].mLoopStopTime = (iLoopTime==1) ? 0 : theFxHelper.mTime + iLoopTime;
246 return i;
247}
248
249void CFxScheduler::StopEffect( const char *file, int boltInfo, bool isPortal )
250{

Callers

nothing calls this directly

Calls 1

PrintMethod · 0.45

Tested by

no test coverage detected