1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: sounds.h 1417 2019-01-29 08:00:14Z wesleyjohnson $
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 // Portions Copyright (C) 1998-2000 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 //
20 // $Log: sounds.h,v $
21 // Revision 1.6  2001/04/17 22:26:07  calumr
22 // Initial Mac add
23 //
24 // Revision 1.5  2001/02/24 13:35:21  bpereira
25 //
26 // Revision 1.4  2001/01/25 22:15:44  bpereira
27 // added heretic support
28 //
29 // Revision 1.3  2000/11/02 17:50:10  stroggonmeth
30 // Big 3Dfloors & FraggleScript commit!!
31 //
32 // Revision 1.2  2000/02/27 00:42:11  hurdler
33 // Revision 1.1.1.1  2000/02/22 20:32:32  hurdler
34 // Initial import into CVS (v1.29 pr3)
35 //
36 //
37 // DESCRIPTION:
38 //      Created by the sound utility written by Dave Taylor.
39 //      Kept as a sample, DOOM2  sounds. Frozen.
40 //
41 //-----------------------------------------------------------------------------
42 
43 #ifndef SOUNDS_H
44 #define SOUNDS_H
45 
46 #include "doomtype.h"
47   // sfxid_t, stdint
48 
49 // 10 customisable sounds for Skins
50 typedef enum {
51     SKSPLPAIN,
52     SKSSLOP,
53     SKSOOF,
54     SKSPLDETH,
55     SKSPDIEHI,
56     SKSNOWAY,
57     SKSPUNCH,
58     SKSRADIO,
59     SKSJUMP,
60     SKSOUCH,
61     NUMSKINSOUNDS
62 } skinsound_e;
63 
64 
65 // free sfx for S_AddSoundFx()
66 // MAXSKINS
67 #define NUMSFXFREESLOTS    ((32*NUMSKINSOUNDS)+10)
68 #define NUMMUSICFREESLOTS  64
69 
70 // [WDJ] Convert singularity, multiplicity, and Saw tests to flags.
71 // Modified similar to Hexen, and Edge.
72 // uint32_t
73 typedef enum {
74    SFX_num = 0x03,   // Number allowed mask (Hexen)
75    SFX_single = 0x01,  // Sfx has only one source (play only one at a time)
76    SFX_two    = 0x02,  // Allows two playing sound copies  (TODO)
77  // flags on num, single
78    SFX_id_fin = 0x04,  // finish existing sound of same sfxid (Edge)
79  // kill sound
80    SFX_player = 0x10,  // Player sound, (PrBoom pickup)
81    SFX_saw    = 0x20,  // Saw sound
82    SFX_org_kill = 0x1000,  // can kill existing sound when same origin
83    SFX_boss   = 0x2000,  // Special treatment for bosses (Edge)
84 } sfxflag_e;
85 
86 //
87 // SoundFX struct.
88 //
89 typedef struct sfxinfo_struct   sfxinfo_t;
90 
91 struct sfxinfo_struct
92 {
93 // fields loaded by sounds init
94     // up to 6-character name
95     char * name;
96       // Assigned const strings for built-in names.
97       // Allocated strings for loaded names and deh.
98       // If name is const char *, then cannot remove loadable sounds.
99 
100     // Sfx priority, 1 is highest, 64 is avg.
101     uint16_t    priority;
102 
103     // referenced sound if a link
104     sfxinfo_t*  link;
105     byte        link_mod;  // index to param modifiers (only chgun actually)
106 
107     byte        limit_channels;  // number of channels allowed
108 
109     // sound that can be remapped for a skin, indexes skins[].skinsounds
110     // 0 up to (NUMSKINSOUNDS-1), -1 = not skin specifc
111     int16_t     skinsound;
112 
113     uint32_t    flags;
114 
115 // end of fields loaded by sounds init
116 
117 #ifdef CLEANUP
118     // this is checked every second to see if sound
119     // can be thrown out (if 0, then decrement, if -1,
120     // then throw out, if > 0, then it is in use)
121 #endif
122     int16_t     usefulness;  // lowest is removed
123 
124     // lump number of sfx
125     lumpnum_t   lumpnum;
126 
127     void*       data;      // sound data
128 
129     int32_t     length;  // length of sound data
130 };
131 
132 typedef struct {
133     int16_t     pitch;
134     int16_t     mod_volume;
135 } link_mod_t;
136 
137 
138 
139 //
140 // MusicInfo struct.
141 //
142 typedef struct
143 {
144     // up to 6-character name
145     char * name;
146       // Assigned const strings for built-in names.
147       // Allocated strings for loaded names and deh.
148 
149     // lump number of music
150     lumpnum_t   lumpnum;
151 
152     // music data
153     void*       data;
154 
155     // music handle once registered
156     int handle;
157 
158 } musicinfo_t;
159 
160 
161 
162 
163 // the complete set of sound effects
164 extern sfxinfo_t        S_sfx[];
165 extern link_mod_t       link_mods[];
166 
167 // the complete set of music
168 extern musicinfo_t      S_music[];
169 
170 //
171 // Identifiers for all music in game.
172 //
173 
174 typedef enum
175 {
176     mus_None,
177     mus_e1m1,
178     mus_e1m2,
179     mus_e1m3,
180     mus_e1m4,
181     mus_e1m5,
182     mus_e1m6,
183     mus_e1m7,
184     mus_e1m8,
185     mus_e1m9,
186     mus_e2m1,
187     mus_e2m2,
188     mus_e2m3,
189     mus_e2m4,
190     mus_e2m5,
191     mus_e2m6,
192     mus_e2m7,
193     mus_e2m8,
194     mus_e2m9,
195     mus_e3m1,
196     mus_e3m2,
197     mus_e3m3,
198     mus_e3m4,
199     mus_e3m5,
200     mus_e3m6,
201     mus_e3m7,
202     mus_e3m8,
203     mus_e3m9,
204     mus_inter,
205     mus_intro,
206     mus_bunny,
207     mus_victor,
208     mus_introa,
209     mus_runnin,
210     mus_stalks,
211     mus_countd,
212     mus_betwee,
213     mus_doom,
214     mus_the_da,
215     mus_shawn,
216     mus_ddtblu,
217     mus_in_cit,
218     mus_dead,
219     mus_stlks2,
220     mus_theda2,
221     mus_doom2,
222     mus_ddtbl2,
223     mus_runni2,
224     mus_dead2,
225     mus_stlks3,
226     mus_romero,
227     mus_shawn2,
228     mus_messag,
229     mus_count2,
230     mus_ddtbl3,
231     mus_ampie,
232     mus_theda3,
233     mus_adrian,
234     mus_messg2,
235     mus_romer2,
236     mus_tense,
237     mus_shawn3,
238     mus_openin,
239     mus_evil,
240     mus_ultima,
241     mus_read_m,
242     mus_dm2ttl,
243     mus_dm2int,
244 
245 // heretic stuff
246         mus_he1m1,
247         mus_he1m2,
248         mus_he1m3,
249         mus_he1m4,
250         mus_he1m5,
251         mus_he1m6,
252         mus_he1m7,
253         mus_he1m8,
254         mus_he1m9,
255 
256         mus_he2m1,
257         mus_he2m2,
258         mus_he2m3,
259         mus_he2m4,
260         mus_he2m5,
261         mus_he2m6,
262         mus_he2m7,
263         mus_he2m8,
264         mus_he2m9,
265 
266         mus_he3m1,
267         mus_he3m2,
268         mus_he3m3,
269         mus_he3m4,
270         mus_he3m5,
271         mus_he3m6,
272         mus_he3m7,
273         mus_he3m8,
274         mus_he3m9,
275 
276         mus_he4m1,
277         mus_he4m2,
278         mus_he4m3,
279         mus_he4m4,
280         mus_he4m5,
281         mus_he4m6,
282         mus_he4m7,
283         mus_he4m8,
284         mus_he4m9,
285 
286         mus_he5m1,
287         mus_he5m2,
288         mus_he5m3,
289         mus_he5m4,
290         mus_he5m5,
291         mus_he5m6,
292         mus_he5m7,
293         mus_he5m8,
294         mus_he5m9,
295 
296         mus_he6m1,
297         mus_he6m2,
298         mus_he6m3,
299 
300         mus_htitl,
301         mus_hcptd,
302 
303 
304     mus_firstfreeslot,
305     // 64 free slots here
306     mus_lastfreeslot = mus_firstfreeslot + NUMMUSICFREESLOTS - 1,
307     NUMMUSIC
308 } musicenum_e;
309 
310 
311 //
312 // Identifiers for all sfx in game.
313 //
314 
315 typedef enum
316 {
317     sfx_None,
318     sfx_pistol,
319     sfx_shotgn,
320     sfx_sgcock,
321     sfx_dshtgn,
322     sfx_dbopn,
323     sfx_dbcls,
324     sfx_dbload,
325     sfx_plasma,
326     sfx_bfg,
327     sfx_sawup,
328     sfx_sawidl,
329     sfx_sawful,
330     sfx_sawhit,
331     sfx_rlaunc,
332     sfx_rxplod,
333     sfx_firsht,
334     sfx_firxpl,
335     sfx_pstart,
336     sfx_pstop,
337     sfx_doropn,
338     sfx_dorcls,
339     sfx_stnmov,
340     sfx_swtchn,
341     sfx_swtchx,
342     sfx_plpain,
343     sfx_dmpain,
344     sfx_popain,
345     sfx_vipain,
346     sfx_mnpain,
347     sfx_pepain,
348     sfx_slop,
349     sfx_itemup,
350     sfx_wpnup,
351     sfx_oof,
352     sfx_telept,
353     sfx_posit1,
354     sfx_posit2,
355     sfx_posit3,
356     sfx_bgsit1,
357     sfx_bgsit2,
358     sfx_sgtsit,
359     sfx_cacsit,
360     sfx_brssit,
361     sfx_cybsit,
362     sfx_spisit,
363     sfx_bspsit,
364     sfx_kntsit,
365     sfx_vilsit,
366     sfx_mansit,
367     sfx_pesit,
368     sfx_sklatk,
369     sfx_sgtatk,
370     sfx_skepch,
371     sfx_vilatk,
372     sfx_claw,
373     sfx_skeswg,
374     sfx_pldeth,
375     sfx_pdiehi,
376     sfx_podth1,
377     sfx_podth2,
378     sfx_podth3,
379     sfx_bgdth1,
380     sfx_bgdth2,
381     sfx_sgtdth,
382     sfx_cacdth,
383     sfx_skldth,
384     sfx_brsdth,
385     sfx_cybdth,
386     sfx_spidth,
387     sfx_bspdth,
388     sfx_vildth,
389     sfx_kntdth,
390     sfx_pedth,
391     sfx_skedth,
392     sfx_posact,
393     sfx_bgact,
394     sfx_dmact,
395     sfx_bspact,
396     sfx_bspwlk,
397     sfx_vilact,
398     sfx_noway,
399     sfx_barexp,
400     sfx_punch,
401     sfx_hoof,
402     sfx_metal,
403     sfx_chgun,
404     sfx_tink,
405     sfx_bdopn,
406     sfx_bdcls,
407     sfx_itmbk,
408     sfx_flame,
409     sfx_flamst,
410     sfx_getpow,
411     sfx_bospit,
412     sfx_boscub,
413     sfx_bossit,
414     sfx_bospn,
415     sfx_bosdth,
416     sfx_manatk,
417     sfx_mandth,
418     sfx_sssit,
419     sfx_ssdth,
420     sfx_keenpn,
421     sfx_keendt,
422     sfx_skeact,
423     sfx_skesit,
424     sfx_skeatk,
425     sfx_radio,
426 #ifdef DOGS
427     // killough 11/98: dog sounds
428     sfx_dgsit,
429     sfx_dgatk,
430     sfx_dgact,
431     sfx_dgdth,
432     sfx_dgpain,
433 #endif
434     //added:22-02-98: player avatar jumps
435     sfx_jump,
436     //added:22-02-98: player hits something hard and says 'ouch!'
437     sfx_ouch,
438     //test water
439     sfx_gloop,
440     sfx_splash,
441     sfx_floush,
442 // heretic stuff
443         sfx_gldhit,
444         sfx_gntful,
445         sfx_gnthit,
446         sfx_gntpow,
447 //      sfx_gntact,
448         sfx_gntuse,
449         sfx_phosht,
450         sfx_phohit,
451         sfx_phopow,
452         sfx_lobsht,
453         sfx_lobhit,
454         sfx_lobpow,
455         sfx_hrnsht,
456         sfx_hrnhit,
457         sfx_hrnpow,
458         sfx_ramphit,
459         sfx_ramrain,
460         sfx_bowsht,
461         sfx_stfhit,
462         sfx_stfpow,
463         sfx_stfcrk,
464         sfx_impsit,
465         sfx_impat1,
466         sfx_impat2,
467         sfx_impdth,
468         sfx_impact,
469         sfx_imppai,
470         sfx_mumsit,
471         sfx_mumat1,
472         sfx_mumat2,
473         sfx_mumdth,
474         sfx_mumact,
475         sfx_mumpai,
476         sfx_mumhed,
477         sfx_bstsit,
478         sfx_bstatk,
479         sfx_bstdth,
480         sfx_bstact,
481         sfx_bstpai,
482         sfx_clksit,
483         sfx_clkatk,
484         sfx_clkdth,
485         sfx_clkact,
486         sfx_clkpai,
487         sfx_snksit,
488         sfx_snkatk,
489         sfx_snkdth,
490         sfx_snkact,
491         sfx_snkpai,
492         sfx_kgtsit,
493         sfx_kgtatk,
494         sfx_kgtat2,
495         sfx_kgtdth,
496         sfx_kgtact,
497         sfx_kgtpai,
498         sfx_wizsit,
499         sfx_wizatk,
500         sfx_wizdth,
501         sfx_wizact,
502         sfx_wizpai,
503         sfx_minsit,
504         sfx_minat1,
505         sfx_minat2,
506         sfx_minat3,
507         sfx_mindth,
508         sfx_minact,
509         sfx_minpai,
510         sfx_hedsit,
511         sfx_hedat1,
512         sfx_hedat2,
513         sfx_hedat3,
514         sfx_heddth,
515         sfx_hedact,
516         sfx_hedpai,
517         sfx_sorzap,
518         sfx_sorrise,
519         sfx_sorsit,
520         sfx_soratk,
521         sfx_soract,
522         sfx_sorpai,
523         sfx_sordsph,
524         sfx_sordexp,
525         sfx_sordbon,
526         sfx_sbtsit,
527         sfx_sbtatk,
528         sfx_sbtdth,
529         sfx_sbtact,
530         sfx_sbtpai,
531 //      sfx_plroof,
532         sfx_plrpai,
533         sfx_plrdth,             // Normal
534         sfx_gibdth,             // Extreme
535         sfx_plrwdth,    // Wimpy
536         sfx_plrcdth,    // Crazy
537         sfx_hitemup,
538         sfx_hwpnup,
539 //      sfx_htelept,
540         sfx_hdoropn,
541         sfx_hdorcls,
542         sfx_dormov,
543         sfx_artiup,
544 //      sfx_switch,
545         sfx_hpstart,
546         sfx_hpstop,
547         sfx_hstnmov,
548         sfx_chicpai,
549         sfx_chicatk,
550         sfx_chicdth,
551         sfx_chicact,
552         sfx_chicpk1,
553         sfx_chicpk2,
554         sfx_chicpk3,
555         sfx_keyup,
556         sfx_ripslop,
557         sfx_newpod,
558         sfx_podexp,
559         sfx_bounce,
560         sfx_volsht,
561         sfx_volhit,
562         sfx_burn,
563         sfx_hsplash,
564         sfx_hgloop,
565 //      sfx_respawn,
566         sfx_blssht,
567         sfx_blshit,
568 //      sfx_chat,
569         sfx_artiuse,
570         sfx_gfrag,
571         sfx_waterfl,
572 
573         // Monophonic sounds
574 
575         sfx_wind,
576         sfx_amb1,
577         sfx_amb2,
578         sfx_amb3,
579         sfx_amb4,
580         sfx_amb5,
581         sfx_amb6,
582         sfx_amb7,
583         sfx_amb8,
584         sfx_amb9,
585         sfx_amb10,
586         sfx_amb11,
587 
588     sfx_menuud,  // menu up down
589     sfx_menuva,  // menu value change
590     sfx_menuen,  // menu enter
591     sfx_menuop,  // menu open
592     sfx_menuac,  // menu action
593 
594     // free slots for S_AddSoundFx() at run-time --------------------
595     sfx_freeslot0,
596     //
597     // ... 60 free sounds here ...
598     //
599     sfx_lastfreeslot=(sfx_freeslot0+NUMSFXFREESLOTS-1),
600     // end of freeslots ---------------------------------------------
601 
602     NUMSFX
603 } sfxenum_e;
604 
605 // typedef uint16_t   sfxid_t;  // defined in doomtype.h
606 
607 
608 void   S_InitRuntimeSounds (void);
609 // Add a new sound fx into a free sfx slot.
610 // Return sfx id.
611 sfxid_t  S_AddSoundFx (const char *name, uint32_t flags);
612 // Only can remove from sfx slots, the loadable sfx sounds.
613 void   S_RemoveSoundFx (sfxid_t sfxid);
614 
615 
616 int    S_AddMusic  (const char *name);
617 int    S_FindMusic (const char *name);
618 #endif
619