Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17940/src

Modified Files:
	defaults.c sound.c 
Log Message:
Netrekrc option soundExclude to turn certain sound categories off.

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- defaults.c	28 Feb 2007 12:21:50 -0000	1.47
+++ defaults.c	28 Feb 2007 13:01:17 -0000	1.48
@@ -1942,6 +1942,7 @@
     struct dmacro_list *dm;
     unsigned int i;
     unsigned char c;
+    char *adefault;
     char macroKey[3] = "";
 
     if (!saveFile)
@@ -2125,6 +2126,21 @@
         fputs ("\n", fp);
 
 #ifdef SOUND
+    // excluded sound categories
+    if ((adefault = stringDefault ("soundExclude")) != NULL)
+    {
+    	if (saveBig)
+    	{
+    	    fputs ("# Sound categories to turn off\n", fp);
+    	    fputs ("# e=explosions, w=weapons, a=alerts,\n", fp);
+    	    fputs ("# m=messages, i=info, c=cloaking,\n", fp);
+    	    fputs ("# s=shield, o=other ships\n", fp);
+    	}
+        sprintf (str, "soundExclude: %s\n", adefault);
+        fputs (str, fp);
+        if (saveBig)
+            fputs ("\n", fp);
+    }
     // sound directory
     if (sounddir != NULL)
     {
@@ -2203,8 +2219,6 @@
     // Window placements
     if (saveWindow)
     {
-    	char *adefault;
-    	
     	if (saveBig)
     	{
     	    fputs ("# Window placements section\n", fp);

Index: sound.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- sound.c	28 Feb 2007 12:21:50 -0000	1.31
+++ sound.c	28 Feb 2007 13:01:17 -0000	1.32
@@ -28,6 +28,7 @@
 #include "proto.h"
 
 static void soundrefresh (int i);
+static void Init_sound_flags (void);
 
 static Mix_Chunk *sounds[NUM_WAVES];
 static Mix_Music *music[NUM_MUSIC];
@@ -184,8 +185,8 @@
         Mix_Volume(-1, volume);
         Mix_VolumeMusic(mvolume);
 
-        /* Set sound flags to on. TODO: use netrekrc values */
-        sound_flags = SF_EXPLOSIONS|SF_WEAPONS|SF_ALERT|SF_MESSAGE|SF_INFO|SF_CLOAKING|SF_SHIELD|SF_OTHER;
+        /* Set sound flags */
+        Init_sound_flags();
 
         /* Toggle on sound, and load sound files */
       	sound_toggle = 1;
@@ -201,6 +202,57 @@
     }
 }
 
+void Init_sound_flags(void)
+{
+    unsigned int i;
+    char *tmp;
+
+    /* Turn them all on first */
+    sound_flags = SF_EXPLOSIONS|SF_WEAPONS|SF_ALERT|SF_MESSAGE|SF_INFO|SF_CLOAKING|SF_SHIELD|SF_OTHER;
+
+    if ((tmp = stringDefault ("soundExclude")) != NULL)
+    {
+        for (i = 0; i < strlen (tmp); i++)
+        {
+            switch (tmp[i])
+            {
+            case 'E':
+            case 'e':
+                sound_flags &= ~(SF_EXPLOSIONS);
+                break;
+            case 'W':
+            case 'w':
+                sound_flags &= ~(SF_WEAPONS);
+                break;
+            case 'A':
+            case 'a':
+                sound_flags &= ~(SF_ALERT);
+                break;
+            case 'M':
+            case 'm':
+                sound_flags &= ~(SF_MESSAGE);
+                break;
+            case 'I':
+            case 'i':
+                sound_flags &= ~(SF_INFO);
+                break;
+            case 'C':
+            case 'c':
+                sound_flags &= ~(SF_CLOAKING);
+                break;
+            case 'S':
+            case 's':
+                sound_flags &= ~(SF_SHIELD);
+                break;
+            case 'O':
+            case 'o':
+                sound_flags &= ~(SF_OTHER);
+                break;
+            }
+        }
+    }
+}
+
 extern void Play_Sound (int type, u_int flag)
 {
     int channel;