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

Modified Files:
	beeplite.c cowmain.c data.c defaults.c dmessage.c input.c 
	local.c makecyg makefile newwin.c playback.c socket.c sound.c 
	warning.c 
Log Message:
Cleanup more unused sound defines in sound.h and proto.h
New netrekrc option soundVolume to control starting volume level.
New sound flags to designate what category a sound falls in.
Pass sound flag to sound playing functions, then check against current
sound flag settings to see whether to play that sound.
Added the sound flag categories to the sound menu for easy toggling.
Fixed bug where soundAngles wasn't being checked before playing
certain sounds angularly.
Fixed bug with volume level, did not know that new channels are
allocated to maxvolume.  Thus, volume needs to be set during every
sound play event.

Index: dmessage.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dmessage.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dmessage.c	28 Feb 2007 09:35:20 -0000	1.7
+++ dmessage.c	28 Feb 2007 12:21:50 -0000	1.8
@@ -217,7 +217,7 @@
 #ifdef SOUND          
             if (why_dead &&
                (instr (message, "[plasma]") || instr (message, "[zapped plasma]")))
-            	Play_Sound(PLASMA_KILL_WAV);
+            	Play_Sound(PLASMA_KILL_WAV, SF_INFO);
 #endif
 
         }
@@ -274,7 +274,7 @@
 #ifdef SOUND          
             if (why_dead &&
                (instr (message, "[plasma]") || instr (message, "[zapped plasma]")))
-                Play_Sound(PLASMA_KILL_WAV);
+                Play_Sound(PLASMA_KILL_WAV, SF_INFO);
 #endif
 
             if (logging)

Index: makecyg
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/makecyg,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- makecyg	24 Feb 2007 10:19:55 -0000	1.2
+++ makecyg	28 Feb 2007 12:21:50 -0000	1.3
@@ -76,12 +76,12 @@
                   rsa_box_3.o rsa_box_4.o
 endif
 
-WIN32_SRCS = winmain.c mswindow.c winsndlib.c
-WIN32_OBJS = winmain.o mswindow.o winsndlib.o
+WIN32_SRCS = winmain.c mswindow.c
+WIN32_OBJS = winmain.o mswindow.o
 
 INCLUDES        = struct.h packets.h defs.h copyright.h bitmaps.h data.h\
                   oldbitmaps.h tngbitmaps.h hullbitmaps.h rabbitbitmaps.h\
-                  sound.h audio.h litebitmaps.h copyright2.h Wlib.h\
+                  sound.h litebitmaps.h copyright2.h Wlib.h\
                   playerlist.h version.h moobitmaps.h\
                   parsemeta.h spopt.h map.h string_util.h wtext.h local.h
 

Index: sound.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- sound.c	28 Feb 2007 09:35:20 -0000	1.30
+++ sound.c	28 Feb 2007 12:21:50 -0000	1.31
@@ -32,10 +32,13 @@
 static Mix_Chunk *sounds[NUM_WAVES];
 static Mix_Music *music[NUM_MUSIC];
 
-static int sound_other = 1;     /* Play other ship's sounds? */
-
 static char sound_prefix[PATH_MAX];
 
+/* For tracking current volume levels, new channels need to be
+   told what volume to use */
+static int mvolume = 0;
+static int volume = 0;
+
 char *DATAFILE(const char* wav) {    
     strcpy(sound_prefix, sounddir);
     strcat(sound_prefix, "/");
@@ -56,11 +59,8 @@
   sounds[EXIT_WARP_WAV] = Mix_LoadWAV(DATAFILE("nt_exit_warp.wav"));
   sounds[EXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion.wav"));
   sounds[BASE_EXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_base_explosion.wav"));
-  sounds[EXPLOSION_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion_other.wav"));
   sounds[FIRE_PLASMA_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_plasma.wav"));
-  sounds[OTHER_FIRE_PLASMA_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_plasma_other.wav"));
   sounds[FIRE_TORP_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp.wav"));
-  sounds[OTHER_FIRE_TORP_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp_other.wav"));
   sounds[INTRO_WAV] = Mix_LoadWAV(DATAFILE("nt_intro.wav"));
   sounds[MESSAGE_WAV] = Mix_LoadWAV(DATAFILE("nt_message.wav"));
   sounds[MESSAGE1_WAV] = Mix_LoadWAV(DATAFILE("nt_message1.wav"));
@@ -71,7 +71,6 @@
   sounds[MESSAGE6_WAV] = Mix_LoadWAV(DATAFILE("nt_message6.wav"));
   sounds[MESSAGE7_WAV] = Mix_LoadWAV(DATAFILE("nt_message7.wav"));
   sounds[PHASER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser.wav"));
-  sounds[PHASER_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser_other.wav"));
   sounds[PLASMA_HIT_WAV] = Mix_LoadWAV(DATAFILE("nt_plasma_hit.wav"));
   sounds[PLASMA_KILL_WAV] = Mix_LoadWAV(DATAFILE("nt_plasma_kill.wav"));
   sounds[RED_ALERT_WAV] = Mix_LoadWAV(DATAFILE("nt_red_alert.wav"));
@@ -83,6 +82,10 @@
   sounds[TORP_HIT_WAV] = Mix_LoadWAV(DATAFILE("nt_torp_hit.wav"));
   sounds[UNCLOAK_WAV] = Mix_LoadWAV(DATAFILE("nt_uncloak.wav"));
   sounds[WARNING_WAV] = Mix_LoadWAV(DATAFILE("nt_warning.wav"));
+  sounds[EXPLOSION_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion_other.wav"));
+  sounds[FIRE_PLASMA_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_plasma_other.wav"));
+  sounds[FIRE_TORP_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp_other.wav"));
+  sounds[PHASER_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser_other.wav"));
 
   for (i=0; i < NUM_WAVES; i++) {
     if (!sounds[i]) {
@@ -176,16 +179,20 @@
             return;
         }
 
-        /* Set sound and music volume to half (128 is MAXVOLUME) */
-        Mix_Volume(-1, 64);
-        Mix_VolumeMusic(64);
+        /* Set sound and music volume */
+        mvolume = volume = soundVolume;
+        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;
 
         /* Toggle on sound, and load sound files */
       	sound_toggle = 1;
       	loadSounds();
 
       	/* Load music files, and play random intro music */
-      	loadMusic();
+        loadMusic();
         i = RANDOM() % MUSIC_OFFSET;
         Play_Music(i);
 
@@ -194,17 +201,17 @@
     }
 }
 
-extern void Play_Sound (int type)
+extern void Play_Sound (int type, u_int flag)
 {
     int channel;
-    	
+
     if (!sound_init || !soundEffects || !sound_toggle)
         return;
 
-    /*  Don't play other ship's sounds if turned off */
-    if (type > OTHER_SOUND_OFFSET && !sound_other)
+    /* Don't play sound types you have turned off */
+    if (flag != (sound_flags & flag))
         return;
-
+ 
     if ((type >= NUM_WAVES) || (type < 0))
     {
         LineToConsole("Invalid sound type %d\n", type);
@@ -219,17 +226,23 @@
 #endif
         return;
     }
-            
+    /* Now that we know the channel, set the volume */
+    Mix_Volume(channel, volume);
+
     Group_Sound(type, channel);
 }
 
-extern void Play_Sound_Loc (int type, int angle, int distance)
+extern void Play_Sound_Loc (int type, u_int flag, int angle, int distance)
 {
     int channel;
     
     if (!sound_init || !soundEffects || !sound_toggle)
         return;
 
+    /* Don't play sound types you have turned off */
+    if (flag != (sound_flags & flag))
+        return;
+
     if ((type >= NUM_WAVES) || (type < 0))
     {
         LineToConsole("Invalid sound type %d\n", type);
@@ -244,6 +257,9 @@
 #endif
         return;
     }
+    /* Now that we know the channel, set the volume */
+    Mix_Volume(channel, volume);
+
     /* Make sure distance in boundary range that function accepts */
     if (distance < 0)
     	distance = 0;
@@ -350,11 +366,9 @@
 
 extern void ChangeVolume (int vol)
 {
-    int mvolume, volume;
-    
     // Get current average sound volume and music volume
-    volume = Mix_Volume(-1, -1);
-    mvolume = Mix_VolumeMusic(-1);
+    //volume = Mix_Volume(-1, -1);
+    //mvolume = Mix_VolumeMusic(-1);
 
     // Change sound volume for all channels, range is 0 to 128
     volume = volume + 10*vol;
@@ -376,8 +390,15 @@
 #define MUSIC_TOGGLE 2
 #define MUSIC_BKGD 3
 #define SOUND_ANGLE 4
-#define SOUND_OTHER 5
-#define SOUND_DONE 6
+#define SOUND_EXPLOSIONS 5
+#define SOUND_WEAPONS 6
+#define SOUND_ALERT 7
+#define SOUND_MESSAGE 8
+#define SOUND_INFO 9
+#define SOUND_CLOAKING 10
+#define SOUND_SHIELD 11
+#define SOUND_OTHER 12
+#define SOUND_DONE 13
 
 extern void soundwindow (void)
 {
@@ -419,10 +440,45 @@
         sprintf (buf, "Angular sound is turned %s",
                  (soundAngles) ? "ON" : "OFF");
     }
+    else if (i == SOUND_EXPLOSIONS)
+    {
+        sprintf (buf, "Explosion sounds are turned %s",
+                 (sound_flags & SF_EXPLOSIONS) ? "ON" : "OFF");
+    }
+    else if (i == SOUND_WEAPONS)
+    {
+        sprintf (buf, "Weapon sounds are turned %s",
+                 (sound_flags & SF_WEAPONS) ? "ON" : "OFF");
+    }
+    else if (i == SOUND_ALERT)
+    {
+        sprintf (buf, "Alert sounds are turned %s",
+                 (sound_flags & SF_ALERT) ? "ON" : "OFF");
+    }
+    else if (i == SOUND_MESSAGE)
+    {
+        sprintf (buf, "Message sounds are turned %s",
+                 (sound_flags & SF_MESSAGE) ? "ON" : "OFF");
+    }
+    else if (i == SOUND_INFO)
+    {
+        sprintf (buf, "Info sounds are turned %s",
+                 (sound_flags & SF_INFO) ? "ON" : "OFF");
+    }
+    else if (i == SOUND_CLOAKING)
+    {
+        sprintf (buf, "Cloaking sounds are turned %s",
+                 (sound_flags & SF_CLOAKING) ? "ON" : "OFF");
+    }
+    else if (i == SOUND_SHIELD)
+    {
+        sprintf (buf, "Shield sounds are turned %s",
+                 (sound_flags & SF_SHIELD) ? "ON" : "OFF");
+    }
     else if (i == SOUND_OTHER)
     {
         sprintf (buf, "Other ship's sound is turned %s",
-                 (sound_other) ? "ON" : "OFF");
+                 (sound_flags & SF_OTHER) ? "ON" : "OFF");
     }
     else if (i == SOUND_DONE)
     {
@@ -485,10 +541,45 @@
     	soundAngles = (soundAngles) ? 0 : 1;
     	soundrefresh (SOUND_ANGLE);
     }
+    else if (i == SOUND_EXPLOSIONS)
+    {
+        sound_flags ^= SF_EXPLOSIONS;
+        soundrefresh (SOUND_EXPLOSIONS);
+    }
+    else if (i == SOUND_WEAPONS)
+    {
+        sound_flags ^= SF_WEAPONS;
+        soundrefresh (SOUND_WEAPONS);
+    }
+    else if (i == SOUND_ALERT)
+    {
+        sound_flags ^= SF_ALERT;
+        soundrefresh (SOUND_ALERT);
+    }
+    else if (i == SOUND_MESSAGE)
+    {
+        sound_flags ^= SF_MESSAGE;
+        soundrefresh (SOUND_MESSAGE);
+    }
+    else if (i == SOUND_INFO)
+    {
+        sound_flags ^= SF_INFO;
+        soundrefresh (SOUND_INFO);
+    }
+    else if (i == SOUND_CLOAKING)
+    {
+        sound_flags ^= SF_CLOAKING;
+        soundrefresh (SOUND_CLOAKING);
+    }
+    else if (i == SOUND_SHIELD)
+    {
+        sound_flags ^= SF_SHIELD;
+        soundrefresh (SOUND_SHIELD);
+    }
     else if (i == SOUND_OTHER)
     {
-    	sound_other = (sound_other) ? 0 : 1;
-    	soundrefresh (SOUND_OTHER);
+        sound_flags ^= SF_OTHER;
+        soundrefresh (SOUND_OTHER);
     }
     else
     {

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- newwin.c	28 Feb 2007 09:35:20 -0000	1.48
+++ newwin.c	28 Feb 2007 12:21:50 -0000	1.49
@@ -929,7 +929,7 @@
 
 #if defined(SOUND)
     soundWin = W_MakeMenu("sound", WINSIDE + 20, -BORDER + 10, 33,
-                        7, NULL, 2);
+                        14, NULL, 2);
     W_SetWindowKeyDownHandler(soundWin, soundaction);
     W_SetWindowButtonHandler(soundWin, soundaction);
     W_DefineArrowCursor(soundWin);

Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- input.c	28 Feb 2007 09:35:20 -0000	1.25
+++ input.c	28 Feb 2007 12:21:50 -0000	1.26
@@ -1518,7 +1518,7 @@
             /* Here we will have to enter message_on () followed by
                smessage to player */
 #ifdef SOUND
-            Play_Sound(MESSAGE_WAV);
+            Play_Sound(MESSAGE_WAV, SF_MESSAGE);
 #endif
             message_on ();
             data->key = players[target->o_num].p_mapchars[1];
@@ -1532,7 +1532,7 @@
             /* Here we will have to enter message_on () followed by
                smessage to player */
 #ifdef SOUND
-            Play_Sound(MESSAGE_WAV);
+            Play_Sound(MESSAGE_WAV, SF_MESSAGE);
 #endif
             message_on ();
             data->key = 'T';
@@ -1546,7 +1546,7 @@
            /* Here we will have to enter message_on () followed by
               smessage to player */
 #ifdef SOUND
-           Play_Sound(MESSAGE_WAV);
+           Play_Sound(MESSAGE_WAV, SF_MESSAGE);
 #endif
            message_on ();
            data->key = 'A';
@@ -2753,7 +2753,7 @@
 {
 
 #ifdef SOUND
-    Play_Sound(SELF_DESTRUCT_WAV);
+    Play_Sound(SELF_DESTRUCT_WAV, SF_INFO);
 #endif
 
     sendQuitReq ();
@@ -3178,7 +3178,7 @@
 {
 
 #ifdef SOUND
-    Play_Sound(MESSAGE_WAV);
+    Play_Sound(MESSAGE_WAV, SF_MESSAGE);
 #endif
 
     message_on ();
@@ -3242,7 +3242,7 @@
 {
 
 #ifdef SOUND
-    Play_Sound(SELF_DESTRUCT_WAV);
+    Play_Sound(SELF_DESTRUCT_WAV, SF_INFO);
 #endif
 
     fastQuit = 1;

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- local.c	28 Feb 2007 09:35:20 -0000	1.64
+++ local.c	28 Feb 2007 12:21:50 -0000	1.65
@@ -675,14 +675,14 @@
             {
             	// Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3)
 	    	Mix_HaltGroup(3);
-	        Play_Sound(ENTER_WARP_WAV);                
+	        Play_Sound(ENTER_WARP_WAV, SF_INFO);                
 	        warpchange = 0;
 	    }
 	    if (warpchange && !(j->p_flags & PFTWARP))
 	    {
 	    	// Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3)
 	    	Mix_HaltGroup(3);
-	    	Play_Sound(EXIT_WARP_WAV);
+	    	Play_Sound(EXIT_WARP_WAV, SF_INFO);
 	        warpchange = 0;
 	    }
 	}
@@ -740,10 +740,10 @@
                         else
                             angle = 0;
                         // At short distances, don't use angular sound
-                        if (distance < SCALE/2)
-                            Play_Sound(CLOAKED_WAV);
+                        if (!soundAngles || distance < SCALE/2)
+                            Play_Sound(CLOAKED_WAV, SF_CLOAKING);
                         else
-                            Play_Sound_Loc(CLOAKED_WAV, angle, distance);
+                            Play_Sound_Loc(CLOAKED_WAV, SF_CLOAKING, angle, distance);
                     }
                 }
 #endif
@@ -779,10 +779,10 @@
                         else
                             angle = 0;
                          // At short distances, don't use angular sound
-                        if (distance < SCALE/2)
-                            Play_Sound(UNCLOAK_WAV);
+                        if (!soundAngles || distance < SCALE/2)
+                            Play_Sound(UNCLOAK_WAV, SF_CLOAKING);
                         else
-                            Play_Sound_Loc(UNCLOAK_WAV, angle, distance);
+                            Play_Sound_Loc(UNCLOAK_WAV, SF_CLOAKING, angle, distance);
                     }
                     else    // Kill any channels with CLOAKED_WAV on them (group 1)
                         Mix_HaltGroup(1);
@@ -1025,13 +1025,13 @@
                 {
                     // Kill any channels with SHIELD_UP/DOWN_WAV on them (group 4)
                     Mix_HaltGroup(4);
-                    Play_Sound(SHIELD_DOWN_WAV);
+                    Play_Sound(SHIELD_DOWN_WAV, SF_SHIELD);
                 }
                 if (!(sound_flags & PFSHIELD) && (j->p_flags & PFSHIELD))
                 {
                     // Kill any channels with SHIELD_UP/DOWN_WAV on them (group 4)
                     Mix_HaltGroup(4);
-                    Play_Sound(SHIELD_UP_WAV);
+                    Play_Sound(SHIELD_UP_WAV, SF_SHIELD);
                 }
             }
 #endif
@@ -1291,9 +1291,9 @@
                 if (myPlayer(j) || isObsLockPlayer(j))
                 {
                  if (j->p_ship.s_type == STARBASE)
-                     Play_Sound(BASE_EXPLOSION_WAV);
+                     Play_Sound(BASE_EXPLOSION_WAV, SF_EXPLOSIONS);
                  else
-                     Play_Sound(EXPLOSION_WAV);
+                     Play_Sound(EXPLOSION_WAV, SF_EXPLOSIONS);
                 }
                 else
                 {
@@ -1316,19 +1316,19 @@
                     else
                         angle = 0;
                     // At short distances, don't use angular sound
-                    if (distance < SCALE/2)
+                    if (!soundAngles || distance < SCALE/2)
                     {
                         if (j->p_ship.s_type == STARBASE)
-                            Play_Sound(BASE_EXPLOSION_WAV);
+                            Play_Sound(BASE_EXPLOSION_WAV, SF_EXPLOSIONS);
                     	else
-                            Play_Sound(EXPLOSION_OTHER_WAV);
+                            Play_Sound(EXPLOSION_OTHER_WAV, SF_OTHER|SF_EXPLOSIONS);
                     }
                     else
                     {
                         if (j->p_ship.s_type == STARBASE)
-                    	    Play_Sound_Loc(BASE_EXPLOSION_WAV, angle, distance);
+                    	    Play_Sound_Loc(BASE_EXPLOSION_WAV, SF_EXPLOSIONS, angle, distance);
                     	else
-                            Play_Sound_Loc(EXPLOSION_OTHER_WAV, angle, distance);
+                            Play_Sound_Loc(EXPLOSION_OTHER_WAV, SF_OTHER|SF_EXPLOSIONS, angle, distance);
                     }
                 }
             }
@@ -1380,7 +1380,7 @@
             if (php->sound_phaser)
             {           
                 if (myPlayer(j) || isObsLockPlayer(j))
-                    Play_Sound(PHASER_WAV);
+                    Play_Sound(PHASER_WAV, SF_WEAPONS);
                 else
                 {
                     int newdx, newdy, distance, angle;
@@ -1402,10 +1402,10 @@
                     else
                         angle = 0;
                     // At short distances, don't use angular sound
-                    if (distance < SCALE/2)
-                        Play_Sound(PHASER_OTHER_WAV);
+                    if (!soundAngles || distance < SCALE/2)
+                        Play_Sound(PHASER_OTHER_WAV, SF_OTHER|SF_WEAPONS);
                     else
-                        Play_Sound_Loc(PHASER_OTHER_WAV, angle, distance);
+                        Play_Sound_Loc(PHASER_OTHER_WAV, SF_OTHER|SF_WEAPONS, angle, distance);
                 }
                 php->sound_phaser = 0;
             }
@@ -1880,10 +1880,10 @@
                     else
                         angle = 0;
                     // At short distances, don't use angular sound
-                    if (distance < SCALE/2)
-                        Play_Sound(TORP_HIT_WAV);
+                    if (!soundAngles || distance < SCALE/2)
+                        Play_Sound(TORP_HIT_WAV, SF_WEAPONS);
                     else
-                        Play_Sound_Loc(TORP_HIT_WAV, angle, distance);
+                        Play_Sound_Loc(TORP_HIT_WAV, SF_WEAPONS, angle, distance);
                 }
 #endif
                 if (colorWeapons)
@@ -2142,10 +2142,10 @@
                 else
                     angle = 0;
                 // At short distances, don't use angular sound
-                if (distance < SCALE/2)
-                    Play_Sound(PLASMA_HIT_WAV);
+                if (!soundAngles || distance < SCALE/2)
+                    Play_Sound(PLASMA_HIT_WAV, SF_WEAPONS);
                 else
-                    Play_Sound_Loc(PLASMA_HIT_WAV, angle, distance);
+                    Play_Sound_Loc(PLASMA_HIT_WAV, SF_WEAPONS, angle, distance);
             }
 #endif
 
@@ -2469,7 +2469,7 @@
 #if defined(SOUND)
             // Kill any channels with RED_ALERT_WAV (group 2)
             Mix_HaltGroup(2);
-            Play_Sound(WARNING_WAV);
+            Play_Sound(WARNING_WAV, SF_ALERT);
 #endif
 
             break;
@@ -2485,7 +2485,7 @@
             W_ChangeBorder (baseWin, rColor);
             
 #if defined(SOUND)
-            Play_Sound(RED_ALERT_WAV);
+            Play_Sound(RED_ALERT_WAV, SF_ALERT);
 #endif
 
             break;
@@ -2510,22 +2510,22 @@
 
 #if defined(SOUND)
     if (sound_torps < me->p_ntorp)
-        Play_Sound(FIRE_TORP_WAV);
+        Play_Sound(FIRE_TORP_WAV, SF_WEAPONS);
     if (sound_other_torps < num_other_torps)
     {
-        if (other_torp_dist < SCALE/2)
-            Play_Sound(OTHER_FIRE_TORP_WAV);
+        if (!soundAngles || other_torp_dist < SCALE/2)
+            Play_Sound(FIRE_TORP_OTHER_WAV, SF_OTHER|SF_WEAPONS);
         else
-            Play_Sound_Loc(OTHER_FIRE_TORP_WAV, other_torp_angle, other_torp_dist);
+            Play_Sound_Loc(FIRE_TORP_OTHER_WAV, SF_OTHER|SF_WEAPONS, other_torp_angle, other_torp_dist);
     }
     if (sound_plasma < me->p_nplasmatorp)
-        Play_Sound(FIRE_PLASMA_WAV);
+        Play_Sound(FIRE_PLASMA_WAV, SF_WEAPONS);
     if (sound_other_plasmas < num_other_plasmas)
     {
-        if (other_plasma_dist < SCALE/2)
-            Play_Sound(OTHER_FIRE_PLASMA_WAV);
+        if (!soundAngles || other_plasma_dist < SCALE/2)
+            Play_Sound(FIRE_PLASMA_OTHER_WAV, SF_OTHER|SF_WEAPONS);
         else
-            Play_Sound_Loc(OTHER_FIRE_PLASMA_WAV, other_plasma_angle, other_plasma_dist);
+            Play_Sound_Loc(FIRE_PLASMA_OTHER_WAV, SF_OTHER|SF_WEAPONS, other_plasma_angle, other_plasma_dist);
     }
     // Reset locations and fuses of other's closest torps and plasmas
     other_torp_dist = CORNER_DIST;

Index: makefile
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/makefile,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- makefile	23 Feb 2007 13:43:56 -0000	1.12
+++ makefile	28 Feb 2007 12:21:50 -0000	1.13
@@ -65,12 +65,12 @@
                   rsa_box_3.obj rsa_box_4.obj
 !endif
 
-WIN32_SRCS = winmain.c mswindow.c winsndlib.c
-WIN32_OBJS = winmain.obj mswindow.obj winsndlib.obj
+WIN32_SRCS = winmain.c mswindow.c
+WIN32_OBJS = winmain.obj mswindow.obj
 
 INCLUDES        = struct.h packets.h defs.h copyright.h bitmaps.h data.h\
                   oldbitmaps.h tngbitmaps.h hullbitmaps.h rabbitbitmaps.h\
-                  sound.h audio.h litebitmaps.h copyright2.h Wlib.h\
+                  sound.h litebitmaps.h copyright2.h Wlib.h\
                   playerlist.h version.h moobitmaps.h\
                   parsemeta.h spopt.h map.h string_util.h wtext.h local.h
 

Index: playback.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- playback.c	28 Feb 2007 09:35:20 -0000	1.17
+++ playback.c	28 Feb 2007 12:21:50 -0000	1.18
@@ -347,7 +347,7 @@
 
 #ifdef SOUND
     Mix_HaltChannel(-1); /* Kill all currently playing sounds when entering game */
-    Play_Sound(ENTER_SHIP_WAV);
+    Play_Sound(ENTER_SHIP_WAV, SF_INFO);
 #endif
 
     while (1)

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- defaults.c	28 Feb 2007 09:35:20 -0000	1.46
+++ defaults.c	28 Feb 2007 12:21:50 -0000	1.47
@@ -674,6 +674,13 @@
             NULL
         }
     },
+    {"soundVolume", &soundVolume, RC_INT,
+        {
+            "Starting sound volume",
+            "0-128 range",
+            NULL
+        }
+    },
     {"soundEffects", &soundEffects, RC_BOOL,
         {
             "Play sound effects",
@@ -1531,6 +1538,7 @@
     doubleBuffering = booleanDefault ("doubleBuffering", doubleBuffering);
     allowWheelActions = booleanDefault ("allowWheelActions", allowWheelActions);
     newQuit = booleanDefault ("newQuit", newQuit);
+    soundVolume= intDefault ("soundVolume", soundVolume);
     soundEffects= booleanDefault ("soundEffects", soundEffects);
     soundMusic = booleanDefault ("soundMusic", soundMusic);
     soundMusicBkgd = booleanDefault ("soundMusicBkgd", soundMusicBkgd);

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- data.c	28 Feb 2007 09:35:20 -0000	1.56
+++ data.c	28 Feb 2007 12:21:50 -0000	1.57
@@ -640,7 +640,7 @@
 int music_toggle = 0;
 char *sounddir = NULL;
 W_Window soundWin = NULL;
-
+unsigned int sound_flags = 0;
 #endif
 
 #ifdef HOCKEY_LINES
@@ -794,6 +794,7 @@
 
 int richText = 0;   		/* temporary variable to select rich text message windows */
 int newQuit = 0;    		/* new quit clock */
+int soundVolume = 64;		/* Starting sound volume (0-128 range) */
 int soundEffects = 1;		/* Use sound effects playback */
 int soundMusic = 1;		/* Use music playback */
 int soundMusicBkgd = 0;		/* Play random background music continuously */

Index: beeplite.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/beeplite.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- beeplite.c	28 Feb 2007 09:35:20 -0000	1.14
+++ beeplite.c	28 Feb 2007 12:21:49 -0000	1.15
@@ -194,7 +194,7 @@
 
 #if defined(SOUND)
                     if (sound_toggle)
-                        Play_Sound(MESSAGE_WAV);
+                        Play_Sound(MESSAGE_WAV, SF_MESSAGE);
                     else
 		        W_Beep();
 #endif
@@ -205,39 +205,39 @@
 #ifdef SOUND
 	    case '1':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE1_WAV);
+	          Play_Sound(MESSAGE1_WAV, SF_MESSAGE);
 	        break;
 	    case '2':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE2_WAV);
+	          Play_Sound(MESSAGE2_WAV, SF_MESSAGE);
 	        break;
 	    case '3':
   	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE3_WAV);
+	          Play_Sound(MESSAGE3_WAV, SF_MESSAGE);
 	        break;
 	    case '4':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE4_WAV);
+	          Play_Sound(MESSAGE4_WAV, SF_MESSAGE);
 	        break;
 	    case '5':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE5_WAV);
+	          Play_Sound(MESSAGE5_WAV, SF_MESSAGE);
 	        break;
 	    case '6':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE6_WAV);
+	          Play_Sound(MESSAGE6_WAV, SF_MESSAGE);
 	        break;
 	    case '7':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE7_WAV);
+	          Play_Sound(MESSAGE7_WAV, SF_MESSAGE);
 	        break;
 	    case '8':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE_WAV);
+	          Play_Sound(MESSAGE_WAV, SF_MESSAGE);
 	        break;
 	    case '9':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-	          Play_Sound(MESSAGE_WAV);
+	          Play_Sound(MESSAGE_WAV, SF_MESSAGE);
 	        break;
 #endif
 

Index: warning.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/warning.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- warning.c	28 Feb 2007 09:35:20 -0000	1.12
+++ warning.c	28 Feb 2007 12:21:50 -0000	1.13
@@ -47,7 +47,7 @@
     if (doRefit)
     {
 #ifdef SOUND
-        Play_Sound(ENTER_SHIP_WAV);
+        Play_Sound(ENTER_SHIP_WAV, SF_INFO);
 #endif
        rdelay = time (0) + REFITTIME;
     }

Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cowmain.c	28 Feb 2007 09:35:20 -0000	1.25
+++ cowmain.c	28 Feb 2007 12:21:50 -0000	1.26
@@ -1075,7 +1075,7 @@
         /* Attempt to start background music once fadeout done */
         Mix_HookMusicFinished(Play_Music_Bkgd);
     }
-    Play_Sound(ENTER_SHIP_WAV);
+    Play_Sound(ENTER_SHIP_WAV, SF_INFO);
 #endif
     promoted = 0;
     ingame = 1;

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- socket.c	28 Feb 2007 09:35:20 -0000	1.20
+++ socket.c	28 Feb 2007 12:21:50 -0000	1.21
@@ -1183,9 +1183,9 @@
       if (!inplayback) {
 #endif
         if (status->tourn)
-            Play_Sound(START_TMODE_WAV);
+            Play_Sound(START_TMODE_WAV, SF_INFO);
         else
-            Play_Sound(STOP_TMODE_WAV);
+            Play_Sound(STOP_TMODE_WAV, SF_INFO);
 #ifdef RECORDGAME
       }
 #endif