Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv29612/include Modified Files: data.h proto.h sound.h 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: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- data.h 28 Feb 2007 09:35:19 -0000 1.51 +++ data.h 28 Feb 2007 12:21:49 -0000 1.52 @@ -536,7 +536,7 @@ extern int music_toggle; extern char *sounddir; extern W_Window soundWin; - +extern unsigned int sound_flags; #endif #ifdef HOCKEY_LINES @@ -697,10 +697,11 @@ extern int richText; /* temporary variable to enable/disable rich text windows */ extern int newQuit; /* new quit clock */ +extern int soundVolume; /* Starting sound volume (0-128 range) */ extern int soundEffects; /* Use sound effects playback */ extern int soundMusic; /* Use music playback */ extern int soundMusicBkgd; /* Play random background music continuously */ -extern int soundAngles; /* Use 3D sound */ +extern int soundAngles; /* Use 3D sound */ extern int useFullShipInfo; /* Prefer SP_PLAYER packets over SP_S_PLAYER packets */ #endif /* _h_data */ Index: sound.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/sound.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- sound.h 28 Feb 2007 09:35:19 -0000 1.15 +++ sound.h 28 Feb 2007 12:21:49 -0000 1.16 @@ -4,66 +4,26 @@ #ifndef __SOUND_H #define __SOUND_H -#define NO_SOUND 0 -#define FIRE_TORP_SOUND 1 -#define PHASER_SOUND 2 -#define FIRE_PLASMA_SOUND 3 -#define EXPLOSION_SOUND 4 -#define BASE_EXPLOSION_SOUND 5 -#define CLOAK_SOUND 6 -#define UNCLOAK_SOUND 7 -#define SHIELD_DOWN_SOUND 8 -#define SHIELD_UP_SOUND 9 -#define TORP_HIT_SOUND 10 -#define WARNING_SOUND 11 -#define RED_ALERT_SOUND 12 -#define ENGINE_SOUND 13 -#define ENTER_SHIP_SOUND 14 -#define SELF_DESTRUCT_SOUND 15 -#define PLASMA_HIT_SOUND 16 -#define PLASMA_KILL_SOUND 17 -#define ENTER_WARP_SOUND 18 -#define EXIT_WARP_SOUND 19 -#define START_TMODE_SOUND 20 -#define STOP_TMODE_SOUND 21 -#define MESSAGE_SOUND 22 -#define MESSAGE1_SOUND 23 -#define MESSAGE2_SOUND 24 -#define MESSAGE3_SOUND 25 -#define MESSAGE4_SOUND 26 -#define MESSAGE5_SOUND 27 -#define MESSAGE6_SOUND 28 -#define MESSAGE7_SOUND 29 -#define MESSAGE8_SOUND 30 -#define MESSAGE9_SOUND 31 -#define OTHER_SOUND_OFFSET 31 - -/* Other people's sounds; not all of these are currently used */ -#define OTHER_FIRE_TORP_SOUND 32 -#define OTHER_PHASER_SOUND 33 -#define OTHER_FIRE_PLASMA_SOUND 34 -#define OTHER_EXPLOSION_SOUND 35 - - -#define NUM_SOUNDS 35 - -struct Sound -{ - char *name; - int priority; - int flag; -}; - extern void sounddone (void); extern void soundwindow (void); - -extern void Play_Sound (int type); -extern void Play_Sound_Loc (int type, int angle, int distance); +extern void soundaction (W_Event * data); +extern void Play_Sound (int type, u_int flag); +extern void Play_Sound_Loc (int type, u_int flag, int angle, int distance); extern void Play_Music (int type); extern void Play_Music_Bkgd (void); +extern void Group_Sound (int type, int channel); extern void ChangeVolume (int vol); extern void Init_Sound (void); +#define SF_EXPLOSIONS 0x001 +#define SF_WEAPONS 0x002 +#define SF_ALERT 0x004 +#define SF_MESSAGE 0x008 +#define SF_INFO 0x010 +#define SF_CLOAKING 0x020 +#define SF_SHIELD 0x040 +#define SF_OTHER 0x080 + enum { CLOAKED_WAV, ENGINE_WAV, @@ -72,11 +32,8 @@ EXIT_WARP_WAV, EXPLOSION_WAV, BASE_EXPLOSION_WAV, - EXPLOSION_OTHER_WAV, FIRE_PLASMA_WAV, - OTHER_FIRE_PLASMA_WAV, FIRE_TORP_WAV, - OTHER_FIRE_TORP_WAV, INTRO_WAV, MESSAGE_WAV, MESSAGE1_WAV, @@ -87,7 +44,6 @@ MESSAGE6_WAV, MESSAGE7_WAV, PHASER_WAV, - PHASER_OTHER_WAV, PLASMA_HIT_WAV, PLASMA_KILL_WAV, RED_ALERT_WAV, @@ -99,6 +55,10 @@ TORP_HIT_WAV, UNCLOAK_WAV, WARNING_WAV, + EXPLOSION_OTHER_WAV, + FIRE_PLASMA_OTHER_WAV, + FIRE_TORP_OTHER_WAV, + PHASER_OTHER_WAV, NUM_WAVES }; @@ -114,6 +74,7 @@ END4_MUSIC, NUM_MUSIC, }; + #define MUSIC_OFFSET END1_MUSIC /* Offset for end music */ #endif /* __SOUND_H */ Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- proto.h 28 Feb 2007 09:35:19 -0000 1.34 +++ proto.h 28 Feb 2007 12:21:49 -0000 1.35 @@ -1142,25 +1142,6 @@ register char *s2); /******************************************************************************/ -/*** sound.c -/******************************************************************************/ - extern void Exit_Sound (void); - extern void Init_Sound (void); - extern void Play_Sound (int type); - extern void Play_Sound_Loc (int type, int angle, int distance); - extern void Play_Music (int type); - extern void Play_Music_Bkgd (void); - void Group_Sound (int type, int channel); - extern void Abort_Sound (int type); - extern void soundwindow (void); -//static void soundrefresh(int i); -#if defined(SOUND) - void soundaction (W_Event * data); - void sdlsoundaction (W_Event * data); -#endif - extern void sounddone (void); - -/******************************************************************************/ /*** spopt.c /******************************************************************************/ void sprefresh (int i);