| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/voice.cpp $ |
| 21 | * $Revision: 11 $ |
| 22 | * $Date: 5/13/99 3:42p $ |
| 23 | * $Author: Ardussi $ |
| 24 | * |
| 25 | * implementation file for voice system |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/voice.cpp $ |
| 28 | * |
| 29 | * 11 5/13/99 3:42p Ardussi |
| 30 | * changes for compiling on the Mac |
| 31 | * |
| 32 | * 10 2/10/99 4:45p Jeff |
| 33 | * table file parser stuff |
| 34 | * |
| 35 | * 9 9/28/98 4:36p Jeff |
| 36 | * shortcircuit the voices for the demo |
| 37 | * |
| 38 | * 8 7/24/98 5:19p Samir |
| 39 | * took out old stream code. |
| 40 | * |
| 41 | * 7 7/13/98 6:07p Jeff |
| 42 | * handled not removing non-powerup voices on a queue clean up |
| 43 | * |
| 44 | * 6 7/09/98 8:35p Samir |
| 45 | * Changed StreamStop. |
| 46 | * |
| 47 | * 5 6/19/98 6:04p Jeff |
| 48 | * added voice queue |
| 49 | * |
| 50 | * 4 6/18/98 5:18p Jeff |
| 51 | * Use new streamaudio system |
| 52 | * |
| 53 | * 3 6/17/98 8:08p Jeff |
| 54 | * removed DoVoiceFrame |
| 55 | * |
| 56 | * 2 6/08/98 3:55p Jeff |
| 57 | * rough initial creation |
| 58 | * |
| 59 | * $NoKeywords: $ |
| 60 | */ |
| 61 | #include "voice.h"cxx . . $ `<file>/Descent3/voice.h`/ |
| 62 | #include "streamaudio.h"cxx . . $ `<file>/stream_audio/streamaudio.h`/ |
| 63 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 64 | #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/ |
| 65 | #include <stdlib.h> |
| 66 | #include <string.h> |
| 67 | |
| 68 | #define MOTHERLOAD_STRINGcxx . . $ `Descent3/voice.cpp:68:9`! "Cheater!" |
| 69 | #define MOTHERLOAD_FLAGScxx . . $ `Descent3/voice.cpp:69:9`! VF_POWERUPcxx . . $ `Descent3/voice.h:56:9`! | VF_PLAYTABLEcxx . . $ `Descent3/voice.h:58:9`! |
| 70 | |
| 71 | struct tVoicecxx . . $ tVoice# { |
| 72 | int handlecxx . . $ tVoice#handle.; |
| 73 | int flagscxx . . $ tVoice#flags.; |
| 74 | int chandlecxx . . $ tVoice#chandle.; |
| 75 | bool inusecxx . . $ tVoice#inuse.; |
| 76 | }; |
| 77 | |
| 78 | bool PlayPowerupVoicecxx . . $ PlayPowerupVoice.; |
| 79 | bool PlayVoicescxx . . $ PlayVoices.; |
| 80 | |
| 81 | #define QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`! 3 |
| 82 | |
| 83 | class VoiceQueuecxx . . $ VoiceQueue# { |
| 84 | public: |
| 85 | VoiceQueuecxx . . $ VoiceQueue#VoiceQueue(49f6e7a06ebc5aa8).(); |
| 86 | ~cxx . . $ VoiceQueue#`~VoiceQueue`(ced63f7c635d850d).VoiceQueuecxx . . $ VoiceQueue#(); |
| 87 | void AddVoicecxx . . $ VoiceQueue#AddVoice(a07d8cccb7673f5a).(char *fn, int flg); |
| 88 | bool GetNextVoicecxx . . $ VoiceQueue#GetNextVoice(9114e84560875b2b).(char *fn, int *flg); |
| 89 | void Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(bool onlypowerups = false); |
| 90 | |
| 91 | private: |
| 92 | char filenamescxx . . $ VoiceQueue#filenames.[QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!][_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 93 | int flagscxx . . $ VoiceQueue#flags.[QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!]; |
| 94 | uint8_tcxx . . $ uint8_t# currvoicecxx . . $ VoiceQueue#currvoice.; |
| 95 | uint8_tcxx . . $ uint8_t# poscxx . . $ VoiceQueue#pos.; |
| 96 | char motherloadatcxx . . $ VoiceQueue#motherloadat.; |
| 97 | bool inusecxx . . $ VoiceQueue#inuse.[QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!]; |
| 98 | bool fullcxx . . $ VoiceQueue#full.; |
| 99 | }; |
| 100 | |
| 101 | tVoicecxx . . $ tVoice# CurrentVoiceHandlecxx . . $ CurrentVoiceHandle.; |
| 102 | VoiceQueuecxx . . $ VoiceQueue# vqcxx . . $ vq.; |
| 103 | |
| 104 | void StartVoicecxx . . $ StartVoice(a07d8cccb7673f5a).(char *filename, int flags); |
| 105 | |
| 106 | bool InitVoicescxx . . $ InitVoices(c9857a73d68e59ba).(void) { |
| 107 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Voice System: Init\n"); |
| 108 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle. = -1; |
| 109 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..flagscxx . . $ tVoice#flags. = 0; |
| 110 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle. = -1; |
| 111 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse. = false; |
| 112 | vqcxx . . $ vq..Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(); |
| 113 | |
| 114 | atexit(CloseVoicescxx . . $ CloseVoices(49f6e7a06ebc5aa8).); |
| 115 | return true; |
| 116 | } |
| 117 | |
| 118 | void CloseVoicescxx . . $ CloseVoices(49f6e7a06ebc5aa8).(void) { |
| 119 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Voice System: Shutdown\n"); |
| 120 | StopVoicecxx . . $ StopVoice(49f6e7a06ebc5aa8).(); |
| 121 | } |
| 122 | |
| 123 | void PlayVoicecxx . . $ PlayVoice(a07d8cccb7673f5a).(char *filename, int flags) { |
| 124 | #ifdef DEMO |
| 125 | return; |
| 126 | #endif |
| 127 | if ((!PlayPowerupVoicecxx . . $ PlayPowerupVoice.) && (flags & VF_POWERUPcxx . . $ `Descent3/voice.h:56:9`!) && (!(flags & VF_FORCEcxx . . $ `Descent3/voice.h:57:9`!))) |
| 128 | return; |
| 129 | if ((CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse.) && (flags & VF_INTERUPTcxx . . $ `Descent3/voice.h:55:9`!)) { |
| 130 | StopVoicecxx . . $ StopVoice(49f6e7a06ebc5aa8).(); |
| 131 | vqcxx . . $ vq..Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(); |
| 132 | } |
| 133 | vqcxx . . $ vq..AddVoicecxx . . $ VoiceQueue#AddVoice(a07d8cccb7673f5a).(filename, flags); |
| 134 | } |
| 135 | |
| 136 | void StartVoicecxx . . $ StartVoice(a07d8cccb7673f5a).(char *filename, int flags) { |
| 137 | #ifdef DEMO |
| 138 | return; |
| 139 | #endif |
| 140 | if ((!PlayVoicescxx . . $ PlayVoices.) && (!(flags & VF_FORCEcxx . . $ `Descent3/voice.h:57:9`!))) |
| 141 | return; |
| 142 | |
| 143 | if (flags & VF_PLAYTABLEcxx . . $ `Descent3/voice.h:58:9`!) { |
| 144 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..flagscxx . . $ tVoice#flags. = flags; |
| 145 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse. = true; |
| 146 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle. = -1; |
| 147 | int index = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(filename)); |
| 148 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle. = Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(index); |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | bool compressed = (flags & VF_COMPRESSEDcxx . . $ `Descent3/voice.h:51:9`!) ? true : false; |
| 153 | bool bit8 = (flags & VF_8BITcxx . . $ `Descent3/voice.h:54:9`!) ? true : false; |
| 154 | bool stereo = (flags & VF_STEREOcxx . . $ `Descent3/voice.h:52:9`!) ? true : false; |
| 155 | |
| 156 | int vf = 0; |
| 157 | |
| 158 | // if(bit8){ |
| 159 | // if(stereo) |
| 160 | // vf = SAF_8BIT_S; |
| 161 | // else |
| 162 | // vf = SAF_8BIT_M; |
| 163 | // }else{ |
| 164 | // if(stereo) |
| 165 | // vf = SAF_16BIT_S; |
| 166 | // else |
| 167 | // vf = SAF_16BIT_M; |
| 168 | // } |
| 169 | // if(compressed) |
| 170 | // vf |= SAF_COMPRESSED; |
| 171 | |
| 172 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle. = StreamPlaycxx . . $ StreamPlay(d157d8952ffc14b5).(filename, (MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2.0), vf); |
| 173 | if (CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle. != -1) |
| 174 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle. = StreamGetSoundHandlecxx . . $ StreamGetSoundHandle(7864480464b09eea).(CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle.); |
| 175 | |
| 176 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..flagscxx . . $ tVoice#flags. = flags; |
| 177 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse. = true; |
| 178 | } |
| 179 | |
| 180 | void StopVoicecxx . . $ StopVoice(49f6e7a06ebc5aa8).(void) { |
| 181 | if (CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse.) { |
| 182 | if (CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..flagscxx . . $ tVoice#flags. & VF_PLAYTABLEcxx . . $ `Descent3/voice.h:58:9`!) { |
| 183 | if (CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle. != -1) |
| 184 | Sound_systemcxx . . $ Sound_system..StopSoundImmediatecxx . . $ hlsSystem#StopSoundImmediate(d4f767463ce0a6b3).(CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle.); |
| 185 | } else { |
| 186 | if (CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle. != -1) |
| 187 | StreamStopcxx . . $ StreamStop(d4f767463ce0a6b3).(CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle.); |
| 188 | } |
| 189 | } |
| 190 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle. = -1; |
| 191 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..flagscxx . . $ tVoice#flags. = 0; |
| 192 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..chandlecxx . . $ tVoice#chandle. = -1; |
| 193 | CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse. = false; |
| 194 | } |
| 195 | |
| 196 | void UpdateVoicescxx . . $ UpdateVoices(49f6e7a06ebc5aa8).(void) { |
| 197 | char filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 198 | int flags; |
| 199 | |
| 200 | if (!CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..inusecxx . . $ tVoice#inuse.) { |
| 201 | // see if we have something waiting |
| 202 | if (vqcxx . . $ vq..GetNextVoicecxx . . $ VoiceQueue#GetNextVoice(9114e84560875b2b).(filename, &flags)) { |
| 203 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Playing queued voice %s\n", filename); |
| 204 | StartVoicecxx . . $ StartVoice(a07d8cccb7673f5a).(filename, flags); |
| 205 | return; |
| 206 | } |
| 207 | return; |
| 208 | } |
| 209 | |
| 210 | // according to the handle, the current voice is inuse, lets make sure |
| 211 | if (Sound_systemcxx . . $ Sound_system..IsSoundPlayingcxx . . $ hlsSystem#IsSoundPlaying(83c267b20bac841a).(CurrentVoiceHandlecxx . . $ CurrentVoiceHandle..handlecxx . . $ tVoice#handle.)) |
| 212 | return; // it is |
| 213 | |
| 214 | // it isn't, so stop it and play the next voice in the queue if any |
| 215 | StopVoicecxx . . $ StopVoice(49f6e7a06ebc5aa8).(); |
| 216 | if (vqcxx . . $ vq..GetNextVoicecxx . . $ VoiceQueue#GetNextVoice(9114e84560875b2b).(filename, &flags)) { |
| 217 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Playing queued voice %s\n", filename); |
| 218 | StartVoicecxx . . $ StartVoice(a07d8cccb7673f5a).(filename, flags); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | ////////////////////// |
| 223 | // Voice Queue Implementation |
| 224 | |
| 225 | VoiceQueuecxx . . $ VoiceQueue#::VoiceQueuecxx . . $ VoiceQueue#VoiceQueue(49f6e7a06ebc5aa8).() { |
| 226 | currvoicecxx . . $ VoiceQueue#currvoice. = poscxx . . $ VoiceQueue#pos. = 0; |
| 227 | motherloadatcxx . . $ VoiceQueue#motherloadat. = -1; |
| 228 | fullcxx . . $ VoiceQueue#full. = false; |
| 229 | for (int i = 0; i < QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!; i++) |
| 230 | inusecxx . . $ VoiceQueue#inuse.[i] = false; |
| 231 | } |
| 232 | |
| 233 | VoiceQueuecxx . . $ VoiceQueue#::~cxx . . $ VoiceQueue#`~VoiceQueue`(ced63f7c635d850d).VoiceQueuecxx . . $ VoiceQueue#() { Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(); } |
| 234 | |
| 235 | void VoiceQueuecxx . . $ VoiceQueue#::AddVoicecxx . . $ VoiceQueue#AddVoice(a07d8cccb7673f5a).(char *fn, int flg) { |
| 236 | if (motherloadatcxx . . $ VoiceQueue#motherloadat. != -1) |
| 237 | return; |
| 238 | if (fullcxx . . $ VoiceQueue#full.) { |
| 239 | // since the queue is full, remove everything and add just the "mother load" voice |
| 240 | Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(true); |
| 241 | strcpy(filenamescxx . . $ VoiceQueue#filenames.[poscxx . . $ VoiceQueue#pos.], MOTHERLOAD_STRINGcxx . . $ `Descent3/voice.cpp:68:9`!); |
| 242 | flagscxx . . $ VoiceQueue#flags.[poscxx . . $ VoiceQueue#pos.] = MOTHERLOAD_FLAGScxx . . $ `Descent3/voice.cpp:69:9`!; |
| 243 | motherloadatcxx . . $ VoiceQueue#motherloadat. = poscxx . . $ VoiceQueue#pos.; |
| 244 | inusecxx . . $ VoiceQueue#inuse.[poscxx . . $ VoiceQueue#pos.] = true; |
| 245 | return; |
| 246 | } |
| 247 | |
| 248 | // the queue isn't full yet, so add it in |
| 249 | int nextpos = (poscxx . . $ VoiceQueue#pos. + 1) % QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!; |
| 250 | if ((nextpos == currvoicecxx . . $ VoiceQueue#currvoice. + 1) && (inusecxx . . $ VoiceQueue#inuse.[nextpos])) { |
| 251 | // this really shouldn't be since it was reported that the queue isn't full |
| 252 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Voice Queue full, missed full bool (this shouldn't happen)\n"); |
| 253 | // since the queue is full, remove everything and add just the "mother load" voice |
| 254 | Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(); |
| 255 | poscxx . . $ VoiceQueue#pos. = 1; |
| 256 | strcpy(filenamescxx . . $ VoiceQueue#filenames.[poscxx . . $ VoiceQueue#pos.], MOTHERLOAD_STRINGcxx . . $ `Descent3/voice.cpp:68:9`!); |
| 257 | flagscxx . . $ VoiceQueue#flags.[poscxx . . $ VoiceQueue#pos.] = MOTHERLOAD_FLAGScxx . . $ `Descent3/voice.cpp:69:9`!; |
| 258 | motherloadatcxx . . $ VoiceQueue#motherloadat. = poscxx . . $ VoiceQueue#pos.; |
| 259 | inusecxx . . $ VoiceQueue#inuse.[poscxx . . $ VoiceQueue#pos.] = true; |
| 260 | return; |
| 261 | } |
| 262 | poscxx . . $ VoiceQueue#pos. = nextpos; |
| 263 | strcpy(filenamescxx . . $ VoiceQueue#filenames.[poscxx . . $ VoiceQueue#pos.], fn); |
| 264 | flagscxx . . $ VoiceQueue#flags.[poscxx . . $ VoiceQueue#pos.] = flg; |
| 265 | inusecxx . . $ VoiceQueue#inuse.[poscxx . . $ VoiceQueue#pos.] = true; |
| 266 | for (int i = 0; i < QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!; i++) { |
| 267 | // check to see if the queue is full now |
| 268 | if (inusecxx . . $ VoiceQueue#inuse.[i] == false) |
| 269 | return; |
| 270 | } |
| 271 | // queue is full |
| 272 | fullcxx . . $ VoiceQueue#full. = true; |
| 273 | } |
| 274 | |
| 275 | bool VoiceQueuecxx . . $ VoiceQueue#::GetNextVoicecxx . . $ VoiceQueue#GetNextVoice(9114e84560875b2b).(char *fn, int *flg) { |
| 276 | int p = (++currvoicecxx . . $ VoiceQueue#currvoice.) % QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!; |
| 277 | if (!inusecxx . . $ VoiceQueue#inuse.[p]) |
| 278 | return false; |
| 279 | inusecxx . . $ VoiceQueue#inuse.[p] = false; |
| 280 | strcpy(fn, filenamescxx . . $ VoiceQueue#filenames.[p]); |
| 281 | *flg = flagscxx . . $ VoiceQueue#flags.[p]; |
| 282 | currvoicecxx . . $ VoiceQueue#currvoice. = p; |
| 283 | if (currvoicecxx . . $ VoiceQueue#currvoice. == motherloadatcxx . . $ VoiceQueue#motherloadat.) |
| 284 | motherloadatcxx . . $ VoiceQueue#motherloadat. = -1; |
| 285 | fullcxx . . $ VoiceQueue#full. = false; |
| 286 | return true; |
| 287 | } |
| 288 | |
| 289 | void VoiceQueuecxx . . $ VoiceQueue#::Clearcxx . . $ VoiceQueue#Clear(b45ddcbc8423892c).(bool onlypowerups) { |
| 290 | int i; |
| 291 | |
| 292 | for (i = 0; i < QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!; i++) { |
| 293 | if ((!onlypowerups) || (flagscxx . . $ VoiceQueue#flags.[i] & VF_POWERUPcxx . . $ `Descent3/voice.h:56:9`!)) |
| 294 | inusecxx . . $ VoiceQueue#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_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!; i++) { |
| 301 | if (inusecxx . . $ VoiceQueue#inuse.[i] && (i != realp)) { |
| 302 | // we'll need to move this guy |
| 303 | inusecxx . . $ VoiceQueue#inuse.[i] = false; |
| 304 | inusecxx . . $ VoiceQueue#inuse.[realp] = true; |
| 305 | flagscxx . . $ VoiceQueue#flags.[realp] = flagscxx . . $ VoiceQueue#flags.[i]; |
| 306 | strcpy(filenamescxx . . $ VoiceQueue#filenames.[realp], filenamescxx . . $ VoiceQueue#filenames.[i]); |
| 307 | // adjust pointers so they are pointing to the newly moved pointers |
| 308 | if (motherloadatcxx . . $ VoiceQueue#motherloadat. == i) |
| 309 | motherloadatcxx . . $ VoiceQueue#motherloadat. = realp; |
| 310 | if (currvoicecxx . . $ VoiceQueue#currvoice. == i) |
| 311 | currvoicecxx . . $ VoiceQueue#currvoice. = realp; |
| 312 | if (poscxx . . $ VoiceQueue#pos. == i) |
| 313 | poscxx . . $ VoiceQueue#pos. = realp; |
| 314 | realp++; |
| 315 | } // endif |
| 316 | } // end for |
| 317 | if (realp == QUEUE_SIZEcxx . . $ `Descent3/voice.cpp:81:9`!) { |
| 318 | // we're still full :( |
| 319 | fullcxx . . $ VoiceQueue#full. = true; |
| 320 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Voice Warning: Buffer still full after clean (All Non-powerups voices in queue?)\n"); |
| 321 | } |
| 322 | } else { |
| 323 | motherloadatcxx . . $ VoiceQueue#motherloadat. = -1; |
| 324 | fullcxx . . $ VoiceQueue#full. = false; |
| 325 | currvoicecxx . . $ VoiceQueue#currvoice. = poscxx . . $ VoiceQueue#pos. = 0; |
| 326 | } |
| 327 | } |