MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Clear

Method Clear

Descent3/voice.cpp:289–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289void VoiceQueue::Clear(bool onlypowerups) {
290 int i;
291
292 for (i = 0; i < QUEUE_SIZE; i++) {
293 if ((!onlypowerups) || (flags[i] & VF_POWERUP))
294 inuse[i] = false;
295 }
296 if (onlypowerups) {
297 // we need to adjust all the buffers so what is left (non-powerup voices) are pushed to the
298 // front
299 int realp = 0;
300 for (i = 0; i < QUEUE_SIZE; i++) {
301 if (inuse[i] && (i != realp)) {
302 // we'll need to move this guy
303 inuse[i] = false;
304 inuse[realp] = true;
305 flags[realp] = flags[i];
306 strcpy(filenames[realp], filenames[i]);
307 // adjust pointers so they are pointing to the newly moved pointers
308 if (motherloadat == i)
309 motherloadat = realp;
310 if (currvoice == i)
311 currvoice = realp;
312 if (pos == i)
313 pos = realp;
314 realp++;
315 } // endif
316 } // end for
317 if (realp == QUEUE_SIZE) {
318 // we're still full :(
319 full = true;
320 mprintf(0, "Voice Warning: Buffer still full after clean (All Non-powerups voices in queue?)\n");
321 }
322 } else {
323 motherloadat = -1;
324 full = false;
325 currvoice = pos = 0;
326 }
327}

Callers 2

InitVoicesFunction · 0.45
PlayVoiceFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected