summaryrefslogtreecommitdiff
path: root/games/xdoom/patches/patch-at
blob: 88e9321c173c32fad9a37e3f36d3ce1b71b7e02d (plain)
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
$NetBSD: patch-at,v 1.3 2010/02/22 21:58:47 wiz Exp $

--- linuxdoom-1.10/s_sound.c.orig	Thu Feb  3 13:28:09 2000
+++ linuxdoom-1.10/s_sound.c	Thu Feb  3 13:37:06 2000
@@ -115,6 +115,7 @@
 // Maximum volume of music. Useless so far.
 int 		snd_MusicVolume = 15; 
 
+static int	no_sound = 0;
 
 
 // whether songs are mus_paused
@@ -164,6 +165,8 @@
 {  
   int		i;
 
+  if (no_sound)
+    return;
   fprintf( stderr, "S_Init: default sfx volume %d\n", sfxVolume);
 
   // Whatever these did with DMX, these are rather dummies now.
@@ -204,6 +207,8 @@
   int cnum;
   int mnum;
 
+  if (no_sound)
+    return;
   // kill all playing sounds at start of level
   //  (trust me - a good idea)
   for (cnum=0 ; cnum<numChannels ; cnum++)
@@ -268,6 +273,8 @@
   mobj_t*	origin = (mobj_t *) origin_p;
   
   
+  if (no_sound)
+    return;
   // Debug.
   /*fprintf( stderr,
   	   "S_StartSoundAtVolume: playing sound %d (%s)\n",
@@ -403,6 +410,9 @@
     // if (sfx_id == sfx_sawful)
     // sfx_id = sfx_itemup;
 #endif
+
+    if (no_sound)
+      return;
   
     S_StartSoundAtVolume(origin, sfx_id, snd_SfxVolume);
 
@@ -473,6 +483,9 @@
 
     int cnum;
 
+    if (no_sound)
+	return;
+
     for (cnum=0 ; cnum<numChannels ; cnum++)
     {
 	if (channels[cnum].sfxinfo && channels[cnum].origin == origin)
@@ -496,6 +509,8 @@
 //
 void S_PauseSound(void)
 {
+    if (no_sound)
+      return;
     if (mus_playing && !mus_paused)
     {
 	I_PauseSong(mus_playing->handle);
@@ -505,6 +520,8 @@
 
 void S_ResumeSound(void)
 {
+    if (no_sound)
+      return;
     if (mus_playing && mus_paused)
     {
 	I_ResumeSong(mus_playing->handle);
@@ -529,6 +546,8 @@
     mobj_t*	listener = (mobj_t*)listener_p;
 
 
+    if (no_sound)
+      return;
     
     // Clean up unused data.
     // This is currently not done for 16bit (sounds cached static).
@@ -636,6 +655,8 @@
 
     snd_SfxVolume = volume;
 
+    if (volume == 0)
+      no_sound = ! volume;
 }
 
 //
@@ -711,6 +732,8 @@
     int		i;
     channel_t*	c = &channels[cnum];
 
+    if (no_sound)
+      return;
     if (c->sfxinfo)
     {
 	// stop the sound playing
@@ -762,6 +785,9 @@
     fixed_t	ady;
     angle_t	angle;
 
+    if (no_sound)
+      return(1);
+
     // calculate the distance to sound origin
     //  and clip it if necessary
     adx = abs(listener->x - source->x);
@@ -834,6 +860,8 @@
     
     channel_t*	c;
 
+    if (no_sound)
+      return(-1);
     // Find an open channel
     for (cnum=0 ; cnum<numChannels ; cnum++)
     {