-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSfx.c
5491 lines (4720 loc) · 156 KB
/
Sfx.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Project X, June 1996
* Copyright (c) 1996 Probe Entertainment Limited
* All Rights Reserved
*
* $Revision: 217 $
*
* $Header: /PcProjectX/Sfx.c 217 11/11/98 16:00 Philipy $
*
* $Log: /PcProjectX/Sfx.c $
*
* 217 11/11/98 16:00 Philipy
* various fixes for warnings / errors when compiling under VC6
*
* 216 21/07/98 3:32p Oliverc
* Put A3D code on USE_A3D build switch (currently disabled)
*
* 215 14/07/98 17:48 Philipy
*
* 214 14/07/98 12:27 Philipy
* no space allocated for sfx names if no sfx enabled
*
* 213 14/07/98 11:28 Philipy
* removed unec. debug msgs
*
* 212 15/06/98 14:39 Philipy
*
* 211 13/06/98 14:35 Philipy
* only 1 bike computer available for win98 demo version
*
* 210 11/06/98 16:57 Philipy
* loads of win98 shareware version stuff
*
* 209 20/04/98 17:12 Philipy
* added localisation stuff
*
* 208 14/04/98 11:51 Philipy
* primary buffer is now stereo again ( doh )
*
* 207 11/04/98 20:14 Philipy
* primary buffer format is now set to 16 bit!!!
*
* 206 10/04/98 12:51 Philipy
* fixed crash when trying to play enemy biker taunt & no speech installed
*
* 205 8/04/98 14:17 Philipy
* modified max sound volume
*
* 204 7/04/98 17:50 Philipy
* removed multiplayer taunts
* AVI thread now allowed to exit nicely rather than being terminated
* fixed inter-level bug
* fixed bug in enemy taunts
*
* 203 7/04/98 11:00 Philipy
* potentially fixed crash when going from AVI to titles
* fixed CD audio looping
* no CD audio in front end unless full install
* bike features sliders now give correct values
*
* 202 5/04/98 17:10 Philipy
* added huntreng back
*
* 201 5/04/98 15:01 Philipy
* started pre AVI CD accesss ( not yet implemented )
* bike engine freq now done on 5 frame average
* prevented CD track from playing in titles if set to off
* NoDynamic SFX does not bike bike computer static anymore
* water detail slider now only has two levels
*
* 200 3/04/98 17:02 Philipy
* cd audio now only retriggered if enabled!
* added generic pickup sound if bike computer speech is zero
*
* 199 3/04/98 16:03 Philipy
* fixed CD audio stuff
*
* 198 3/04/98 13:13 Philipy
* Taunts are now affected by biker volume slider ( taunt volume slider
* removed )
* Enemy bikers now give out death cry
* fixed problem with speech ignoring volume settings
* fixed end game sequences
*
* 197 2/04/98 21:07 Philipy
* Added taunts ( single & multiplayer, plus enemy biker taunts )
* added flygirl to front end.
* sliders for biker, bike computer and taunt speech volume
* added new sfx for title
*
* 196 1/04/98 12:37 Collinsd
*
* 195 30/03/98 20:36 Collinsd
* Done end game stuff, Added more credits and made sfx for capship non
* looping.
*
* 194 30/03/98 17:31 Philipy
* added cd specific path stuff
* added new bike computers
* prevented File_Exists being called every time a dynamic sfx is played
*
* 193 29/03/98 21:31 Collinsd
* Pyrolite SoundfX added
*
* 192 29/03/98 20:00 Philipy
* cd path now verified earlier
* sfx no longer reloaded when changing biker / bike computer
* mouse sensitivity rounding error fixed
*
* 191 28/03/98 17:33 Philipy
* corrected some sfx
* added legal screen
* fixed mission briefing text bug
*
* 190 28/03/98 13:35 Philipy
* added all biker speech
*
* 189 27/03/98 18:04 Philipy
* fixed bug where mapped sfx did not play.
*
* 188 27/03/98 14:15 Philipy
* made one shot underwater noise non looping
*
* 187 27/03/98 12:58 Philipy
* changed cheat mode stuff
* fixed bug that prevented individual variants of variant sfx to be
* mapped
* correct menutv now displayed between levels
*
* 186 26/03/98 19:41 Philipy
* fixed corruption bug & renamed forklift sfx
*
* 185 26/03/98 15:24 Philipy
* re added sfx missing from new batch
*
* 184 25/03/98 21:37 Philipy
* increased max levelspec sfx
*
* 183 25/03/98 12:26 Philipy
* fixed comparing of variant sfx with lookup table
*
* 182 25/03/98 9:26 Collinsd
*
* 181 24/03/98 21:07 Philipy
* fixed quicktext stuff
* sfx do not pause when in multiplayer mode
* rear camera not shown for splash demos
*
* 180 24/03/98 16:20 Philipy
* added new sfx
*
* 179 21/03/98 14:52 Philipy
* only relevent sfx are loaded between levels
*
* 178 19/03/98 15:44 Philipy
* added ForcePlayPannedSfx function
*
* 177 18/03/98 16:25 Philipy
* removed some debug msgs
*
* 176 18/03/98 16:14 Philipy
* messed about with stopping memory from being paged out
* Stopped due to lack of time & information
*
* 175 11/03/98 14:47 Philipy
* fixed invalid frequency bug
*
* 174 11/03/98 11:06 Philipy
* .wav extension ignored if mistakenly given when placing sfx
*
* 173 11/03/98 10:51 Philipy
* all sfx now paused when single player game paused, not just looping sfx
*
* 172 9/03/98 16:54 Philipy
* added 'requested' flag to SfxLookup. ( At present all sfx requested )
*
* 171 6/03/98 17:37 Philipy
* implemented ability to run when launched by lobby
*
* 170 3/03/98 12:08 Philipy
* fixed looping sfx bug
*
* 169 28/02/98 16:18 Philipy
* fixed memory leak
* sfx loader does not now try to load sfx into hw if it knows that there
* are insufficient resources
* added buffer valid check b4 modifying looping sfx
*
* 168 27/02/98 19:11 Philipy
* fixed load game sfx bug
* added pseudo dithering for 8 bit saved game pic
* flygirl now selectable from front end ( no model displayed )
*
* 167 27/02/98 16:00 Philipy
*
* 166 27/02/98 14:53 Philipy
* fixed modify looping sfx function
*
* 165 25/02/98 15:44 Philipy
* more efficient use of hw sound mixing buffers
*
* 164 24/02/98 16:55 Oliverc
* 1st attempt at bounty hunt multiplayer game
*
* 163 23/02/98 13:00 Philipy
* added scan lines for inter-level objects
* added speech for bike selection in front end
*
* 162 21/02/98 16:25 Philipy
* added text messages for capture flag
*
* 161 21/02/98 13:04 Philipy
* added in game load / save for sfx
*
* 160 20/02/98 11:50 Philipy
*
* 159 19/02/98 22:00 Collinsd
* Added flygirl biker.
*
* 158 17/02/98 17:12 Philipy
* check for buffer in hw now fixed
*
* 157 17/02/98 9:17 Philipy
* added frequency update for bike engine loop
*
* 156 12/02/98 16:36 Philipy
*
* 155 12/02/98 15:37 Philipy
*
* 154 12/02/98 11:27 Philipy
* releasing buffer now sets pointer to NULL to try and trap error
*
* 153 12/02/98 9:05 Philipy
*
* 152 11/02/98 19:38 Philipy
* fixed crash bug
*
* 151 11/02/98 15:52 Philipy
* fixed memory leak
*
* 150 11/02/98 12:57 Philipy
* sbufferhand now gives call stack to 2 levels
*
* 149 10/02/98 19:41 Philipy
* added support for 2d looping sfx
*
* 148 10/02/98 10:49 Philipy
*
* 147 9/02/98 12:21 Philipy
* added sound buffer memory managment
* only one piece of bike computer speech can now play at a time
*
* 146 5/02/98 17:12 Oliverc
* Prevented sound fx warning dialogs appearing in EXTERNAL_DEMO versions
*
* 145 3/02/98 15:38 Philipy
* fixed sfx bug
*
* 144 2/02/98 20:08 Philipy
* added configurable quick text message buttons
*
* 143 29/01/98 12:16 Philipy
* added new sfx
* fixed playing of specific level spec variant sfx
*
* 142 29/01/98 11:30 Philipy
* fixed loading bar
*
* 141 29/01/98 10:46 Philipy
* fixed corruption bug
*
* 140 28/01/98 21:55 Philipy
*
* 139 28/01/98 18:38 Philipy
* disabled hw sfx temporarily
*
* 138 28/01/98 17:16 Philipy
* added new sfx
*
* 137 28/01/98 10:18 Philipy
* only one piece of biker speech can play at any one time
* death cry overides any existing speech
*
* 136 23/01/98 16:38 Philipy
* CD audio now on/off toggle, saved to config file
* triggered pickup sfx now 1 in 4 chance
* Trojax sfx now only stopped once
*
* 135 23/01/98 11:31 Philipy
* added new level spec sfx
*
* 134 22/01/98 21:16 Philipy
*
* 133 22/01/98 20:19 Philipy
* put in debug msg
*
* 132 22/01/98 19:49 Philipy
* added sfx batch file stuff for sfx
*
* 131 22/01/98 19:14 Philipy
* fixed re-loading looping sfx while in level
* biker speech now switchable
*
* 130 21/01/98 18:04 Philipy
*
* 129 21/01/98 17:27 Philipy
* added new sfx
*
* 128 21/01/98 16:30 Philipy
* fixed some spotsfx bugs
*
* 127 21/01/98 12:19 Philipy
* Added attract mode for shareware
* fixed looping sfx volume bug
*
* 126 20/01/98 16:58 Philipy
* fixed looping grate sfx
*
* 125 20/01/98 16:33 Philipy
* added new sfx fn: PlaySpotFixedSfx
* -data option now reverts to working dir for sfx if no local sfx dir
* exists
*
* 124 19/01/98 9:50 Philipy
* more changes to critical sections
*
* 123 18/01/98 23:46 Philipy
* added triggered sfx, tidied up critical sections
*
* 122 17/01/98 16:52 Philipy
* put in debug dialogue box to identify crash bug
* made biker speech dynamic again
* took out some unneccesary critical sections ( SfxHolderKey )
*
* 121 1/17/98 1:40p Phillipd
*
* 120 1/17/98 10:39a Phillipd
*
* 119 16/01/98 16:16 Philipy
*
* 118 16/01/98 16:09 Philipy
* All sfx holders now reset on DestroySound()
*
* 117 16/01/98 14:43 Philipy
* added new sfx
*
* 116 16/01/98 8:53 Philipy
*
* 115 16/01/98 8:44 Philipy
* fixed no sound card bug
*
* 114 15/01/98 17:25 Philipy
*
* 113 15/01/98 17:01 Philipy
* added spot sfx stuff.
* PlayPannedSfx and PlaySpotSfx now return unique uint32 - use StopSfx to
* stop sound
*
* 112 13/01/98 12:06 Philipy
* added looping spot sfx support, and changed looping sfx to use static
* list rather than dynamic linked list
*
* 111 12/01/98 16:24 Philipy
* spot sfx stuff
*
* 110 12/01/98 15:10 Philipy
* added check for no file in ReturnSfxIndex
*
* 109 12/01/98 12:45 Philipy
* redid ReturnSfxIndex
*
* 108 12/01/98 11:00 Philipy
* changed level spec sfx operation
* added ReturnSfxIndex fn
*
* 107 12/01/98 0:08 Philipy
* bug fixes
* added inter-level mission briefing
* changed splash screen code, + added splash screen on exit
*
* 106 10/01/98 20:35 Philipy
* fixed no speech option
*
* 105 10/01/98 19:31 Philipy
* bug fixes
*
* 104 10/01/98 13:02 Collinsd
* Fixed sussgun again ( Dont change back ).
*
* 103 9/01/98 17:25 Philipy
* player is now forced to start on level 0
*
* 102 9/01/98 15:57 Philipy
* fixed FileExists bug
*
* 101 9/01/98 14:04 Collinsd
* No Optimisations around certain functions.
*
* 100 9/01/98 11:36 Philipy
* made guts static
*
* 99 9/01/98 11:14 Philipy
* CD nows plays last track
* CD now replays current track from seperate ( low priority ) thread -
* but still causes pause
* loading bar now displayed when loading
*
* 98 7/01/98 12:13 Philipy
* fixed level spec sfx bug
*
* 97 7/01/98 9:34 Philipy
* added title room sfx
* added ability to select bike computer, biker with sfx loaded
*
* 96 5/01/98 10:38 Philipy
* speech sfx implemented - currently defaults to 1 biker & computer only,
* none selectable
*
* 95 30/12/97 14:26 Philipy
* Changed dynamic sfx linked list to static list
*
* 94 24/12/97 9:20 Philipy
* fixed dynamic sound stuff by making X_Malloc, X_Free etc. atomic
*
* 93 12/22/97 2:01p Phillipd
*
* 92 22/12/97 11:44 Collinsd
* Added spotfx sound. and added wesnik weanimator
*
* 91 12/19/97 12:36p Phillipd
*
* 90 12/19/97 11:14a Phillipd
*
* 89 12/19/97 8:53a Phillipd
*
* 88 18/12/97 22:03 Oliverc
* Tried to fix sfx bug ("tried to free unmalloced block in line 2574"
* and/or crash out with access violation in middle of nowhere) by
* initialising SBufferList_Start and _Current to NULL, and moving
* CheckSBufferList() call inside critical section -- but didn't seem to
* make any difference...
*
* 87 12/18/97 5:37p Phillipd
*
* 86 12/18/97 2:47p Phillipd
*
* 85 12/17/97 5:19p Phillipd
*
* 84 12/06/97 2:53p Phillipd
* Fixed Phils Sfx Crash Bug....Doh
*
* 83 5/12/97 21:52 Philipy
* various changes to looping sfx stuff
*
* 82 4/12/97 10:01 Philipy
* DupSWBuffers now initialised properly
*
* 81 3/12/97 18:51 Philipy
* changed some sfx timer stuff
*
* 80 3/12/97 9:16 Philipy
* PlaySfx() now can use static sounds
*
* 79 2/12/97 16:46 Philipy
* compound sfx buffer is now stopped when quitting game
*
* 78 2/12/97 11:52 Philipy
* boot demo stuff
*
* 77 1/12/97 16:15 Philipy
* fixed crash bug when quitting
*
* 76 1/12/97 12:15 Philipy
* fixed trojax bug
*
* 75 1/12/97 10:39 Philipy
* fixed no sound card bug
*
* 74 1/12/97 10:11 Philipy
* fixed no sound bug
*
* 73 1/12/97 9:47 Philipy
* checked in with changes commented out in order to get Xmem update
*
* 72 11/29/97 4:35p Phillipd
* Xmem is now in effect...use it allways....
*
* 71 28/11/97 18:05 Collinsd
*
* 70 28/11/97 17:36 Philipy
* some looping sfx stuff done
*
* 69 27/11/97 15:17 Philipy
* made all speech static for now
*
* 68 27/11/97 14:43 Philipy
* hit speech now static
*
* 67 27/11/97 12:35 Philipy
* fixed sound bug on self play demo
* demo playback speed now given as true percentage
*
* 66 26/11/97 19:02 Philipy
* fixed crash bug when quitting
*
* 65 26/11/97 18:07 Collinsd
* Fixed sound when no sound card. Added bootlogo as -logos2 on command
* line.
*
* 64 26/11/97 15:59 Philipy
* sounds now ignored if no soundcard on machine
*
* 63 26/11/97 11:48 Philipy
* implemented dynamic loading of SFX, dynamic allocation of mixing
* channels.
* 3D sound currently disabled.
*
* 62 27/10/97 15:36 Philipy
* Added sfx vol control
*
* 61 21/10/97 13:11 Philipy
* added sound control options
*
* 60 16/10/97 18:06 Philipy
* lpDirectSound now declared as NULL
*
* 59 15/10/97 16:29 Collinsd
* Added sfx and offsets to batch file
*
* 58 11/08/97 10:12 Collinsd
* Added override data directory option. ( SFX don't work yet! )
*
* 57 6/08/97 19:21 Collinsd
* Changed external/internal forces. Commented out some more A3D Sfx stuff
*
* 56 4/08/97 11:58 Collinsd
* A3D:Sound stuff added
*
* 55 17/07/97 15:38 Collinsd
* BGObjects now use compobjs.
*
* 54 8/07/97 16:30 Collinsd
* Dicked about with include files FUCK!
*
* 53 6/24/97 5:11p Phillipd
*
* 52 6/24/97 11:12a Phillipd
*
* 51 6/12/97 2:53p Phillipd
*
* 50 6/12/97 11:15a Phillipd
*
* 49 6/11/97 5:55p Phillipd
*
* 48 6/11/97 5:42p Phillipd
*
* 47 6/11/97 5:42p Phillipd
*
* 46 6/07/97 2:22p Phillipd
*
* 45 6/07/97 12:04p Phillipd
* New Brenda Sfx added....Not All there
*
* 44 6/02/97 9:09a Phillipd
*
* 43 5/31/97 12:36p Phillipd
*
* 42 5/30/97 8:57a Phillipd
*
* 41 5/28/97 2:54p Phillipd
*
* 40 5/27/97 5:40p Phillipd
*
* 39 5/23/97 5:52p Phillipd
*
* 38 5/23/97 9:18a Phillipd
*
* 37 5/21/97 12:01p Phillipd
*
* 36 5/15/97 11:42a Phillipd
*
* 35 25/04/97 12:52 Collinsd
* Added invul sfx
*
* 34 3/20/97 11:21a Phillipd
*
* 33 20-03-97 10:00a Collinsd
* new sfx
*
* 32 3/07/97 9:51a Phillipd
*
* 31 15-02-97 9:32p Collinsd
* Portals now use variable execute buffers. They also
* allocate/deallocate themselves properly now.
*
* 30 13-01-97 5:03p Collinsd
* Added Temp Door SFX
*
* 29 19-12-96 3:19p Collinsd
* Changed sfx funtion to allow frequency changing.
* Added Trojax Charging SFX.
*
* 28 12/10/96 3:32p Collinsd
* Added new laser sfx.
*
* 27 12/10/96 11:17a Collinsd
* Added drop mine sfx.
*
* 26 12/04/96 11:39a Collinsd
* Ooopppps, fixed launch sfx.
*
* 25 12/04/96 11:22a Collinsd
* Added foetoid and new scaled bikes. Added sussgun richochet and sussgun
* no ammo sfx, new load weapon sfx, and new transpulse/trojax sfx.
*
* 24 12/02/96 1:24p Collinsd
* Added new cloaking/decloaking sfx. Also new sussgun fire.
*
* 23 17/11/96 17:28 Collinsd
* Changed Pulsar & Trojax. Added Trojax Charge sfx to list.
*
* 22 14/11/96 16:40 Collinsd
* Added incoming sound effect and scattered message if no sound card
* present.
*
* 21 14/11/96 15:42 Collinsd
* added targeted sound fx.
*
* 20 14/11/96 12:22 Collinsd
* Added new sfx ( Golden PowerPod, Scattered, Missile Launch )
*
* 19 30/10/96 16:21 Collinsd
* stealth sfx and regeneration
*
* 18 30/10/96 14:34 Collinsd
* Added stealthmode.
*
* 17 29/10/96 16:01 Collinsd
* changed over to panned sfx.
*
* 16 10/29/96 2:49p Phillipd
* panning sfx and new panel....with lights...
*
* 15 22/10/96 12:08 Collinsd
* Added body parts and blood splats.
*
* 14 18/10/96 19:26 Collinsd
* Sfx are now in data directory!
*
* 13 10/18/96 12:44p Phillipd
* number of sfx buffers is now done on a per sfx basis....
*
* 12 9/10/96 10:02 Collinsd
* Old Sfx back, new gravgon trail.
*
* 11 8/10/96 10:40 Collinsd
* Added generic pickup sfx, and changed smoke trail.
*
* 10 8/10/96 9:15 Collinsd
* restricted sfx, added debug lines to pickupmode only.
*
* 9 3/10/96 15:49 Collinsd
* Added new sfx
*
* 8 1/10/96 17:44 Collinsd
* Reduced pulsar to half. Tidied up primary weapons.
* deleted redundant code in 2dpolys/primary weapons.
*
* 7 18/09/96 10:58 Collinsd
* Change sfx to 4 channels and distance limit. Also reduced amount of
* sparks generated by beam laser.
*
* 6 8/08/96 15:53 Collinsd
* Tidied up sfx routines
*
* 5 8/08/96 9:13 Collinsd
* Added Sfx and pickups
*
* 4 7/25/96 10:05a Phillipd
*
* 3 7/24/96 3:08p Phillipd
*
* 2 7/24/96 2:42p Phillipd
*
* 1 7/24/96 2:15p Phillipd
*
*/
#include "typedefs.h"
#include <stdio.h>
#include "sfx.h"
#include "new3d.h"
#include "typedefs.h"
#include <dplay.h>
#include "new3d.h"
#include "quat.h"
#include "CompObjects.h"
#include "bgobjects.h"
#include "Object.h"
#include "mydplay.h"
#include "mload.h"
#include <objbase.h>
#include <cguid.h>
#ifdef USE_A3D
#include "ia3d.h"
#endif
#include "title.h"
#include "cdaudio.h"
#include "text.h"
#include "main.h"
#include "dinput.h"
#include "controls.h"
#include "ships.h"
#include "vfw.h"
#include "config.h"
#include "XMem.h"
#include "SBufferHand.h"
#ifdef DEBUG_ON
#define DSLoadSoundBuffer(A, B, C) DSLoadSoundBuffer(A, B, C, __FILE__, __LINE__)
#define DSLoadCompoundSoundBuffer(A, B, C) DSLoadCompoundSoundBuffer(A, B, C, __FILE__, __LINE__)
#endif
#ifdef OPT_ON
#pragma optimize( "gty", on )
#endif
/****************************************
globals
*****************************************/
ENEMY *EnemyTaunter;
BYTE Taunter = 0xFF;
uint32 TauntID = 0;
BOOL TauntUpdatable = FALSE;
BOOL NoCompoundSfxBuffer = FALSE;
//float TauntDist = 0.0F;
char CurrentTauntVariant;
SFX_HOLDER SfxHolder[ MAX_ANY_SFX ];
BOOL NoSFX = FALSE;
BOOL Sound3D = FALSE;
BOOL A3DCapable = FALSE;
float GlobalSoundAttenuation = 0.8F;
BOOL CompoundSfxAllocated[MAX_SFX];
int NumDupCompoundBuffers;
BOOL bSoundEnabled = FALSE;
BOOL NoDynamicSfx = FALSE;
LPDIRECTSOUND lpDS = NULL;
LPDIRECTSOUND3DLISTENER lpDS3DListener;
LPDIRECTSOUNDBUFFER glpPrimaryBuffer;
DSCAPS DSCaps;
int MaxCompoundSfx;
uint32 CurrentBikerSpeech = 0;
uint32 CurrentBikeCompSpeech = 0;
float LastDistance[MAX_SFX];
int Num_SndObjs;
int CurrentLevel = 16;
SNDOBJ *SndObjs[MAX_SFX];
SBUFFERLIST SBufferList[ MAX_SYNCHRONOUS_DYNAMIC_SFX ];
// buffer linked list pointers...
SBUFFER_LIST *SBufferList_Start = NULL;
SBUFFER_LIST *SBufferList_Current = NULL;
SNDOBJ *SndObjList_Static_Start;
// thread stuff...
DWORD SfxThreadID;
HANDLE SfxThread;
CRITICAL_SECTION SfxKey;
SPOT_SFX_LIST SpotSfxList[ MAX_LOOPING_SFX ];
SFX_THREAD_INFO SfxThreadInfo[MAX_THREADED_SFX];
DWORD CompoundSfxThreadID;
HANDLE CompoundSfxThread;
HANDLE CompoundSfxWaitObject;
int sfxref = 0;
int dupbufref = 0;
char TauntPath[ 128 ];
DWORD CompoundSfxTimeStamp[64];
DWORD CompoundSfxMaxLag = 0;
CRITICAL_SECTION CompoundSfxKey;
CRITICAL_SECTION SfxHolderKey;
BOOL BikerSpeechPlaying = FALSE;
BOOL FreeHWBuffers;
COMPOUND_SFX_INFO CompoundSfxBuffer[MAX_COMPOUND_BUFFERS];
TEMPSFXINFO TempSfxInfo[MAX_COMPOUND_SFX];
SFX_PLAYING SfxPlaying[ MAX_CONCURRENT_SFX ];
SNDLOOKUP SndLookup[ MAX_SFX ];
uint32 SfxUniqueID = 1;
char *CompoundSfxFilename = "sfx\\Compound.wav";
LOOPING_SFX_PIPE LoopingSfxPipe;
typedef struct
{
IDirectSoundBuffer *buffer;
IDirectSound3DBuffer *buffer3d;
} LOOPINGSFXBUFFER;
#define MIN_LOOPING_SFX_BUFFERS 8
LOOPINGSFXBUFFER LoopingSfxBuffer[ MIN_LOOPING_SFX_BUFFERS ];
#define MAX_SFX_VARIANTS 16
char *SfxFullPath[ MAX_SFX ][ MAX_SFX_VARIANTS];
/****************************************
Externals
*****************************************/
extern BOOL CD_OK;
extern ENEMY Enemies[];
extern SLIDER BikeCompSpeechSlider;
extern SLIDER BikerSpeechSlider;
extern int use_data_path;
extern char normdata_path[];
extern char data_path[];
extern USERCONFIG *player_config;
extern int CurrentLoadingStep;
extern VECTOR SlideUp;
extern VECTOR Forward;
extern GLOBALSHIP Ships[MAX_PLAYERS+1];
extern BYTE Current_Camera_View; // which object is currently using the camera view....
extern float SoundInfo[MAXGROUPS][MAXGROUPS];
extern SLIDER SfxSlider;
extern SLIDER CDSlider;
extern CDInfo cd_info;
extern DWORD CompoundSfxDataRate;
extern DWORD CompoundSfxBitDepth;
extern DWORD CompoundSfxFrequency;
extern DWORD CompoundSfxChannels;
extern USERCONFIG *player_config;
extern float framelag;
extern LEVEL_LOOKUP LevelLookup[];
extern char ShortLevelNames[MAXLEVELS][32];
extern LIST BikeList;
extern LIST BikeComputerList;
/****************************************
Fn Prototypes
*****************************************/
BOOL Init_SoundGlobals(void);
void PlayThreadedSfx( int16 Sfx, float Dist );
void DebugPrintf( const char * format, ... );
void FreeSBufferList( void );
void DrawLoadingBox( int current_loading_step, int current_substep, int total_substeps );
void InitSfxHolders( void );
void SetPannedBufferParams( IDirectSoundBuffer *pDSB, IDirectSound3DBuffer *pDSB3D, VECTOR *SfxPos, float Freq, VECTOR *Temp, float Distance, long Volume, uint16 Effects );
int FindFreeBufferSpace( SNDOBJ *SndObj, float Distance );
#ifdef USE_A3D
/****************************************
A3D specific
*****************************************/
LPIA3D gpA3d = NULL; // Allows access to resource-management, HF-absorption, etc.
void A3DCleanup( void ); // Handler for cleanup of global interface pointer to A3D.
int SetRezManMode( DWORD dwRMMode ); // Resource-manager mode-setting.
#endif
SFXNAME Sfx_Filenames[MAX_SFX] =
{
/************************************************
Generic
*************************************************/
{ "airbubb1", 0, 0, -1 }, // bubbles rising in water
{ "bikexpl", 0, 0, -1 }, // bike explodes, as player dies
//{ "bminelay", 0, 0, -1 }, // quantum/pine mine drop
{ "boo", 0, 0, -1 }, // crowd boo, other side scores a goal (in teamplay)
//{ "burnhiss", 0, 0, -1 }, // player bike burn damage on contact with acid or lava
{ "captflag", 0, 0, -1 }, // your side captures flag siren, (in teamplay)
//{ "chaosact", SFX_Looping, 0, -1 }, // chaos shield active loop
{ "cheer", 0, 0, -1 }, // crowd cheer, your side scores a goal (in teamplay)
//{ "collide", 0, 0, -1 }, // bike collides with another vehicle (when shields depleted) #1
{ "compsel", SFX_Title, 0, -1 }, // select click on selection stack ONLY
{ "compwrk", SFX_Looping | SFX_Title | SFX_InGame, 0, -1 }, // screen ambience for green side VDU screen
{ "cryspkup", 0, 0, -1 }, // pickup crystal
//{ "dbhitwat", 0, 0, -1 }, // enemy /hull debris hits water surface
//{ "dive", 0, 0, -1 }, // defeated flying enemy plummets to the ground #1
{ "dripwat", 0, 0, -1 }, // water drip #1
//{ "elecbolt", 0, 0, -1 }, // level related, electrical arcing. Use INSTEAD of Laser2c
{ "elecspk", 0, 0, -1 }, // electric sparking #1
{ "electhrb", SFX_Looping, 0, -1 }, // electrical throbbing - QUANTUM MINE ACTIVE
{ "enemisln", 0, 0, -1 }, // enemy missile launch
{ "enempuls", 0, 0, -1 }, // enemy pulsar fire
{ "enemspwn", 0, 0, -1 }, // enemy respawns/appears
{ "enemsuss", 0, 0, -1 }, // enemy fires suss round
//{ "enemtrnp", 0, 0, -1 }, // enemy fires transpulse
{ "enmspin", 0, 0, -1 }, // non-boss, flying enemy spins out of control #1
{ "exp1", 0, 0, -1 }, // generic impact explosion
{ "exp2", 0, 0, -1 }, // generic detonation type explosion
{ "exp3", 0, 0, -1 }, // another detonation type, good for level-related/boss stuff
{ "exp4", 0, 0, -1 }, // another impact explosion
{ "exp5", 0, 0, -1 }, // non-boss,flying enemy crashes #1
{ "exp6", 0, 0, -1 }, // non-boss,flying enemy crashes #1
//{ "fireimpc", 0, 0, -1 }, // generic fire impact damage from pyrolite hit
{ "firembls", SFX_Looping, 0, -1 }, // continuous fire travel ( NOT FIRE LAUNCH)
//{ "firesh1", 0, 0, -1 }, // light fireball/fire launch
{ "firesh2", 0, 0, -1 }, // heavier fireball/fire launch
{ "fmorfchh", 0, 0, -1 }, // bike collides with fleshmorph / ineffectual impact of weapons on it
{ "fmorfdie", 0, 0, -1 }, // fleshmorph defeated death cry
{ "fmorfhit", 0, 0, -1 }, // fleshmorph hits bike with tentacle
{ "fmorfpai", 0, 0, -1 }, // fleshmorf pain cry - successful hit
//{ "fmorftat", 0, 0, -1 }, // fleshmorph tentacle attack - tentacle shoots out from body
{ "genrammo", 0, 0, -1 }, // pickup general ammo / any secondary weapon
//{ "getdna", 0, 0, -1 }, // pickup DNA
//{ "getkey", 0, 0, -1 }, // pickup any kind of key
{ "goldpkup", 0, 0, -1 }, // pickup gold bars
{ "gravgfld", SFX_Looping, 0, -1 }, // gravgon field effect ambience
//{ "gravghit", 0, 0, -1 }, // gravgon misile impacts/detonates anywhere
//{ "gravgln", 0, 0, -1 }, // gravgon missile launch
{ "guts", 0, 0, -1 }, // guts impact #1
{ "holochng", SFX_Title, 0, -1 }, // biker holograph changes on VDU select screen
{ "hullbump", 0, 0, -1 }, // bike (with shields depleted)bumps wall(only at high velocity)
//{ "hullhit", 0, 0, -1 }, // generic biker/enemy hull damage (shields depleted) #1
//{ "hullscrp", 0, 0, -1 }, // bike scrapes walls/ceiling (shields depleted)
{ "incoming", 0, 0, -1 }, // incoming beep (now shorter - should solve that prob.)
{ "laser2c", 0, 0, -1 }, // laser fire DONT USE FOR LEVEL STUFF -use ELECBOLT
{ "laserbm", SFX_Looping, 0, -1 }, // constant laser beam hum
//{ "lashitwl", 0, 0, -1 }, // laser/transpulse fire impacts wall
//{ "lashitwt", 0, 0, -1 }, // laser/transpulse fire impacts water surface
{ "loseflag", 0, 0, -1 }, // other side gets flag, warning siren (for teamplay)
{ "menuwsh", SFX_Title, 0, -1 }, // woosh from stack to/from side green screens ONLY
{ "message", 0, 0, -1 }, // bleep accompanying a screen text message
{ "mfrln", 0, 0, -1 }, // MRFL single rocket launch
{ "minelay", 0, 0, -1 }, // drop any other mine apart from quantum and pine
//{ "misltrav", SFX_Looping, 0, -1 }, // missile travelling loop. -25% pitch for titan, +25% for MFRL
{ "mnacthum", SFX_Looping, 0, -1 }, // any mine (except quantum) active
{ "movesel", SFX_Title, 0, -1 }, // move cursor on selection stack ONLY
{ "mslaun2", 0, 0, -1 }, // launch mug/solaris missile
{ "mslhitwl", 0, 0, -1 }, // missile (except gravgon and titan) hit wall/environment
{ "mslhitwt", 0, 0, -1 }, // missile (except gravgon and titan) hit water
{ "negative", SFX_Title | SFX_InGame, 0, -1 }, // negative/error/incorrect selection beep (use anywhere)
{ "nitrogo", 0, 0, -1 }, // nitro start
//{ "nitromov", SFX_Looping, 0, -1 }, // nitro in use LOOP
//{ "nitrstop", 0, 0, -1 }, // nitro stop/turn off
{ "orbitpls", 0, 0, -1 }, // orbit pulsar fire
{ "photon2", 0, 0, -1 }, // enemy fires homing photon (slug pulsar?)
{ "pinemove", SFX_Looping, 0, -1 }, // pine mine turning motion
{ "pkupmisc", 0, 0, -1 }, // pickup sound for any items not covered by specific pickups
//{ "pkuppowp", 0, 0, -1 }, // pickup power pod
{ "pkupshld", 0, 0, -1 }, // pickup shield
{ "playergn", 0, 0, -1 }, // player generate
//{ "plshitwl", 0, 0, -1 }, // pulsar/trojax fire impacts wall
{ "pulsfire", 0, 0, -1 }, // pulsar fire
// { "pyroloop", SFX_Looping, 0, -1 }, // pyrolite fire loop
{ "pyroloop", 0, 0, -1 }, // pyrolite fire loop
{ "pyrostop", 0, 0, -1 }, // stop pyrolite
{ "pyrostrt", 0, 0, -1 }, // start pyrolite
{ "quantexp", 0, 0, -1 }, // quantum mine explosion
{ "respawn", 0, 0, -1 }, // collectable items respawn
{ "restartp", 0, 0, -1 }, // restart point reached
//{ "scathit", 0, 0, -1 }, // scatter missile hit
{ "scattln", 0, 0, -1 }, // scatter launch
{ "scrchang", SFX_Title, 0, -1 }, // green VDU screen change
{ "secret", SFX_Title | SFX_InGame, 0, -1 }, // secret area found
{ "select", SFX_Title, 0, -1 }, // positive select beep for green screens
{ "shieldht", 0, 0, -1 }, // shield hit (new one, with more of a punch to it)
{ "shipamb", SFX_Looping | SFX_Title, 0, -1 }, // ambience for menu select room on front end
{ "shldknck", 0, 0, -1 }, // bike knocks against wall with shields on
{ "sonar", SFX_Looping, 0, -1 }, // sonar ping loop for big geek. If you have time, vary pitch according to his depth/distance from you? (maybe I'm asking too much)
{ "stakdown", SFX_Title, 0, -1 }, // selection stack comes down on menu screen
{ "stakmove", SFX_Title, 0, -1 }, // stack movement (now boosted and brightened)
{ "steammcn", SFX_Looping, 0, -1 }, // continuous steam loop - volume varies depending on use
{ "stmantof", 0, 0, -1 }, // stealth mantle off
{ "stmanton", 0, 0, -1 }, // stealth mantle on
{ "submerge", 0, 0, -1 }, // bike enters water
{ "surface", 0, 0, -1 }, // bike exits water
//{ "sushitwt", 0, 0, -1 }, // sussgun fire hits water
{ "sussammo", 0, 0, -1 }, // pickup sussgun ammo belt
//{ "susscas", 0, 0, -1 }, // spent sussgun ammo cases tinkle #1
//{ "sussdry2", 0, 0, -1 }, // sussgun dry fire (is this still applicable?)
{ "sussgnf3", 0, 0, -1 }, // sussgun fire
{ "sussimp", 0, 0, -1 }, // sussgun impacts enemy/bike causing damage #1
{ "sussric", 0, 0, -1 }, // sussgun fire richochet #1
//{ "telepact", SFX_Looping, 0, -1 }, // teleporter active ambience
{ "teleport", 0, 0, -1 }, // teleport sound
{ "tilesel", 0, 0, -1 }, // tile selected on selection stack