Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21311/src Modified Files: beeplite.c cowmain.c data.c defaults.c findslot.c input.c local.c newwin.c playback.c sound.c Log Message: Instead of a #define SDL, changed it to always load in as I couldn't imagine ever wanting to distribute the client without this option enabled. Instead, I'm using a netrekrc option, newSound, to let user choose whether to use the new SDL sound system or the old way. Index: findslot.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/findslot.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- findslot.c 24 Apr 2006 14:13:25 -0000 1.3 +++ findslot.c 24 Apr 2006 15:30:38 -0000 1.4 @@ -112,8 +112,9 @@ if (isServerDead ()) { -#if defined(SOUND) && !defined(HAVE_SDL) - Exit_Sound(); +#if defined(SOUND) + if (!newSound) + Exit_Sound(); #endif LineToConsole ("Shit! Ghostbusted!\n"); @@ -158,8 +159,9 @@ if (isServerDead ()) { -#if defined(SOUND) && !defined(HAVE_SDL) - Exit_Sound(); +#if defined(SOUND) + if (!newSound) + Exit_Sound(); #endif LineToConsole ("Damn, We've been ghostbusted!\n"); @@ -217,8 +219,9 @@ else if (event.Window == qwin) { -#if defined(SOUND) && !defined(HAVE_SDL) - Exit_Sound(); +#if defined(SOUND) + if (!newSound) + Exit_Sound(); #endif LineToConsole ("OK, bye!\n"); Index: sound.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sound.c 24 Apr 2006 14:13:25 -0000 1.3 +++ sound.c 24 Apr 2006 15:30:38 -0000 1.4 @@ -10,10 +10,8 @@ #include "config.h" #ifdef SOUND -#if defined(HAVE_SDL) #include "SDL.h" #include "SDL_mixer.h" -#endif #include "copyright.h" @@ -30,11 +28,7 @@ #include "audio.h" #include "proto.h" -#if defined(HAVE_SDL) -/* This is probably unix specific path */ -Mix_Chunk *sounds[NUM_WAVES]; - -#else +Mix_Chunk *newsounds[NUM_WAVES]; /* Each sound has a priority which controls what can override what Currently these are set as follows: @@ -81,15 +75,9 @@ static int current_sound = NO_SOUND; static int sound_other = 1; /* Play other ship's sounds? */ -#endif // Not SDL sound static char sound_prefix[PATH_MAX]; -#if defined(HAVE_SDL) - -/* - * Build the patch to the sound files - */ char *DATAFILE(const char* wav) { strcpy(sound_prefix, sounddir); strcat(sound_prefix, "/"); @@ -103,39 +91,37 @@ int loadSounds(void) { int i; - sounds[CLOAKED_WAV] = Mix_LoadWAV(DATAFILE("nt_cloaked.wav")); - sounds[ENGINE_WAV] = Mix_LoadWAV(DATAFILE("nt_engine.wav")); - sounds[ENTER_SHIP_WAV] = Mix_LoadWAV(DATAFILE("nt_enter_ship.wav")); - sounds[EXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_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[FIRE_TORP_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp.wav")); - sounds[FIRE_TORP_OTHER_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[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[RED_ALERT_WAV] = Mix_LoadWAV(DATAFILE("nt_red_alert.wav")); - sounds[SELF_DESTRUCT_WAV] = Mix_LoadWAV(DATAFILE("nt_self_destruct.wav")); - sounds[SHIELD_DOWN_WAV] = Mix_LoadWAV(DATAFILE("nt_shield_down.wav")); - sounds[SHIELD_UP_WAV] = Mix_LoadWAV(DATAFILE("nt_shield_up.wav")); - 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")); + newsounds[CLOAKED_WAV] = Mix_LoadWAV(DATAFILE("nt_cloaked.wav")); + newsounds[ENGINE_WAV] = Mix_LoadWAV(DATAFILE("nt_engine.wav")); + newsounds[ENTER_SHIP_WAV] = Mix_LoadWAV(DATAFILE("nt_enter_ship.wav")); + newsounds[EXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion.wav")); + newsounds[EXPLOSION_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion_other.wav")); + newsounds[FIRE_PLASMA_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_plasma.wav")); + newsounds[FIRE_TORP_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp.wav")); + newsounds[FIRE_TORP_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp_other.wav")); + newsounds[INTRO_WAV] = Mix_LoadWAV(DATAFILE("nt_intro.wav")); + newsounds[MESSAGE_WAV] = Mix_LoadWAV(DATAFILE("nt_message.wav")); + newsounds[PHASER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser.wav")); + newsounds[PHASER_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser_other.wav")); + newsounds[PLASMA_HIT_WAV] = Mix_LoadWAV(DATAFILE("nt_plasma_hit.wav")); + newsounds[RED_ALERT_WAV] = Mix_LoadWAV(DATAFILE("nt_red_alert.wav")); + newsounds[SELF_DESTRUCT_WAV] = Mix_LoadWAV(DATAFILE("nt_self_destruct.wav")); + newsounds[SHIELD_DOWN_WAV] = Mix_LoadWAV(DATAFILE("nt_shield_down.wav")); + newsounds[SHIELD_UP_WAV] = Mix_LoadWAV(DATAFILE("nt_shield_up.wav")); + newsounds[TORP_HIT_WAV] = Mix_LoadWAV(DATAFILE("nt_torp_hit.wav")); + newsounds[UNCLOAK_WAV] = Mix_LoadWAV(DATAFILE("nt_uncloak.wav")); + newsounds[WARNING_WAV] = Mix_LoadWAV(DATAFILE("nt_warning.wav")); for (i=0; i < NUM_WAVES; i++) { - if (!sounds[i]) { - LineToConsole("Mix_LoadWAV sound[%d] could not be loaded. Check soundDir in your .netrekrc: %s\n", i, Mix_GetError()); + if (!newsounds[i]) { + LineToConsole("Mix_LoadWAV newsound[%d] could not be loaded. Check soundDir in your .netrekrc: %s\n", i, Mix_GetError()); return(-1); } } return(1); } -#endif -#if !defined(HAVE_SDL) extern void Exit_Sound (void) { if (sound_init) @@ -143,7 +129,7 @@ sound_init = 0; sound_toggle = 0; } -#endif + extern void Init_Sound (void) { @@ -164,99 +150,101 @@ sounddir = "./sounds"; } -#if defined(HAVE_SDL) + if (newSound) + { #ifdef DEBUG - LineToConsole ("Init_Sound using SDL\n"); + LineToConsole ("Init_Sound using SDL\n"); #endif - /* Initialize the SDL library */ - if (SDL_Init(SDL_INIT_AUDIO) < 0) + /* Initialize the SDL library */ + if (SDL_Init(SDL_INIT_AUDIO) < 0) LineToConsole("Couldn't initialize SDL: %s\n",SDL_GetError()); - atexit(SDL_Quit); + atexit(SDL_Quit); - /* Open the audio device at 22050 Hz 8 bit Microsoft PCM with stereo */ - if (Mix_OpenAudio(22050, AUDIO_U8, 2, 1024) < 0) + /* Open the audio device at 22050 Hz 8 bit Microsoft PCM with stereo */ + if (Mix_OpenAudio(22050, AUDIO_U8, 2, 1024) < 0) LineToConsole("Mix_OpenAudio: %s\n", Mix_GetError()); - /* If we successfully loaded the wav files, so shut-off sound_init and play - * the introduction - */ - if (loadSounds()) - { - if (Mix_PlayChannel(-1, sounds[INTRO_WAV], 0) < 0) - LineToConsole("Mix_PlayChannel: %s\n", Mix_GetError()); - } - /* Default of 8 channels not enough */ - Mix_AllocateChannels(16); -#else - if (InitSound () == -1) - { - sound_toggle = 0; - sound_init = 0; + /* If we successfully loaded the wav files, so shut-off sound_init and play + * the introduction + */ + if (loadSounds()) + { + if (Mix_PlayChannel(-1, newsounds[INTRO_WAV], 0) < 0) + LineToConsole("Mix_PlayChannel: %s\n", Mix_GetError()); + } + /* Default of 8 channels not enough */ + Mix_AllocateChannels(16); } else { - sound_init = 1; - sound_toggle = 1; - } + if (InitSound () == -1) + { + sound_toggle = 0; + sound_init = 0; + } + else + { + sound_init = 1; + sound_toggle = 1; + } - strcpy (sound_prefix, sounddir); - strcat (sound_prefix, "/"); + strcpy (sound_prefix, sounddir); + strcat (sound_prefix, "/"); - if (sound_toggle) - { - strcpy (buf, sounddir); - strcat (buf, "/nt_intro"); - StartSound (buf); + if (sound_toggle) + { + strcpy (buf, sounddir); + strcat (buf, "/nt_intro"); + StartSound (buf); + } } -#endif } } extern void Play_Sound (int type) { -#if defined(HAVE_SDL) - - if (!sound_init) - return; - - if ((type >= NUM_WAVES) || (type < 0)) - LineToConsole("Invalid sound type %d\n", type); - - if (Mix_PlayChannel(-1, sounds[type], 0) < 0) - LineToConsole("Mix_PlayChannel: %s\n", Mix_GetError()); + if (newSound) + { + if (!sound_init) + return; + if ((type >= NUM_WAVES) || (type < 0)) + LineToConsole("Invalid sound type %d\n", type); -#else - char buf[PATH_MAX]; + if (Mix_PlayChannel(-1, newsounds[type], 0) < 0) + LineToConsole("Mix_PlayChannel: %s\n", Mix_GetError()); + } + else + { + char buf[PATH_MAX]; - /* Don't play other ship's sounds if turned off */ - if (type > OTHER_SOUND_OFFSET && !sound_other) - return; + /* Don't play other ship's sounds if turned off */ + if (type > OTHER_SOUND_OFFSET && !sound_other) + return; - if (sound_toggle && sounds[type].flag && + if (sound_toggle && sounds[type].flag && ((sounds[type].priority >= sounds[current_sound].priority) || !SoundPlaying ())) - { - STRNCPY (buf, sound_prefix, PATH_MAX); - strcat (buf, sounds[type].name); - StartSound (buf); - current_sound = type; - } + { + STRNCPY (buf, sound_prefix, PATH_MAX); + strcat (buf, sounds[type].name); + StartSound (buf); + current_sound = type; + } - if (!(sound_toggle)) - current_sound = NO_SOUND; -#endif + if (!(sound_toggle)) + current_sound = NO_SOUND; + } } -#if !defined(HAVE_SDL) extern void Abort_Sound (int type) { if ((current_sound != NO_SOUND) && (type == current_sound)) StopSound (); } -#endif + /* Sound options window stuff */ @@ -269,21 +257,22 @@ extern void soundwindow (void) { -#if defined(HAVE_SDL) - char *buf="All or nothing with SDL sound. Sorry"; - W_WriteText(soundWin, 0, 0, textColor, buf, strlen(buf), 0); -#else - int i; - - for (i = 0; i <= SOUND_DONE; i++) - soundrefresh (i); -#endif + if (newSound) + { + char *buf="All or nothing with SDL sound. Sorry"; + W_WriteText(soundWin, 0, 0, textColor, buf, strlen(buf), 0); + } + else + { + int i; + for (i = 0; i <= SOUND_DONE; i++) + soundrefresh (i); + } /* Map window */ W_MapWindow (soundWin); } -#if !defined(HAVE_SDL) static void soundrefresh (int i) { char buf[BUFSIZ], *flag; @@ -371,11 +360,11 @@ W_WriteText (soundWin, 0, i, textColor, buf, strlen (buf), 0); } -#endif /* HAVE_SDL */ void soundaction (W_Event * data) { -#if !defined(HAVE_SDL) + if (!newSound) + { int i, j; i = data->y; @@ -429,7 +418,7 @@ { sounddone (); } -#endif /* HAVE_SDL */ + } } extern void sounddone (void) Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- newwin.c 24 Apr 2006 14:13:25 -0000 1.10 +++ newwin.c 24 Apr 2006 15:30:38 -0000 1.11 @@ -578,18 +578,6 @@ W_SetWindowButtonHandler (spWin, spaction); #endif -#ifdef SOUND -#if defined(HAVE_SDL) - soundWin = W_MakeMenu("sound", WINSIDE + 20, -BORDER + 10, 40, 1, NULL, 2); -#else - soundWin = W_MakeMenu("sound", WINSIDE + 20, -BORDER + 10, 30, - MESSAGE_SOUND + 4, NULL, 2); - W_SetWindowKeyDownHandler(soundWin, soundaction); - W_SetWindowButtonHandler(soundWin, soundaction); - W_DefineArrowCursor(soundWin); -#endif -#endif - #ifdef TOOLS toolsWin = W_MakeScrollingWindow ("tools", WINSIDE + BORDER, BORDER, 80, TOOLSWINLEN, NULL, BORDER); @@ -666,6 +654,23 @@ getResources (progname); } +/******************************************************************************/ +/*** newsoundwin() - Need to map it after reset_defaults, so pulled out of newwin +/******************************************************************************/ +newsoundwin (char *hostmon, + char *progname) +{ + if (newSound) + soundWin = W_MakeMenu("sound", WINSIDE + 20, -BORDER + 10, 40, 1, NULL, 2); + else + { + soundWin = W_MakeMenu("sound", WINSIDE + 20, -BORDER + 10, 30, + MESSAGE_SOUND + 4, NULL, 2); + W_SetWindowKeyDownHandler(soundWin, soundaction); + W_SetWindowButtonHandler(soundWin, soundaction); + W_DefineArrowCursor(soundWin); + } +} /******************************************************************************/ /*** mapAll() Index: input.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- input.c 24 Apr 2006 14:13:25 -0000 1.5 +++ input.c 24 Apr 2006 15:30:38 -0000 1.6 @@ -1510,11 +1510,10 @@ /* Here we will have to enter message_on () followed by smessage to player */ #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(MESSAGE_WAV); -#else - Play_Sound(MESSAGE_SOUND); -#endif + if (newSound) + Play_Sound(MESSAGE_WAV); + else + Play_Sound(MESSAGE_SOUND); #endif message_on (); data->key = players[target->o_num].p_mapchars[1]; @@ -1528,11 +1527,10 @@ /* Here we will have to enter message_on () followed by smessage to player */ #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(MESSAGE_WAV); -#else - Play_Sound(MESSAGE_SOUND); -#endif + if (newSound) + Play_Sound(MESSAGE_WAV); + else + Play_Sound(MESSAGE_SOUND); #endif message_on (); data->key = 'T'; @@ -1546,11 +1544,10 @@ /* Here we will have to enter message_on () followed by smessage to player */ #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(MESSAGE_WAV); -#else - Play_Sound(MESSAGE_SOUND); -#endif + if (newSound) + Play_Sound(MESSAGE_WAV); + else + Play_Sound(MESSAGE_SOUND); #endif message_on (); data->key = 'A'; @@ -2725,11 +2722,10 @@ { #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(SELF_DESTRUCT_WAV); -#else - Play_Sound(SELF_DESTRUCT_SOUND); -#endif + if (newSound) + Play_Sound(SELF_DESTRUCT_WAV); + else + Play_Sound(SELF_DESTRUCT_SOUND); #endif sendQuitReq (); @@ -3149,11 +3145,10 @@ { #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(MESSAGE_WAV); -#else - Play_Sound(MESSAGE_SOUND); -#endif + if (newSound) + Play_Sound(MESSAGE_WAV); + else + Play_Sound(MESSAGE_SOUND); #endif message_on (); @@ -3217,11 +3212,10 @@ { #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(SELF_DESTRUCT_WAV); -#else - Play_Sound(SELF_DESTRUCT_SOUND); -#endif + if (newSound) + Play_Sound(SELF_DESTRUCT_WAV); + else + Play_Sound(SELF_DESTRUCT_SOUND); #endif fastQuit = 1; Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- local.c 24 Apr 2006 14:13:25 -0000 1.7 +++ local.c 24 Apr 2006 15:30:38 -0000 1.8 @@ -480,11 +480,12 @@ #ifdef SOUND if (myPlayer(j) && (j->p_cloakphase == 0)) -#if defined(HAVE_SDL) - Play_Sound(CLOAKED_WAV); -#else - Play_Sound(CLOAK_SOUND); -#endif + { + if (newSound) + Play_Sound(CLOAKED_WAV); + else + Play_Sound(CLOAK_SOUND); + } #endif j->p_cloakphase++; @@ -498,13 +499,17 @@ #ifdef SOUND if (myPlayer(j)) if (j->p_cloakphase == CLOAK_PHASES - 1) -#if defined(HAVE_SDL) - Play_Sound(UNCLOAK_WAV); -#else - Play_Sound(UNCLOAK_SOUND); + { + if (newSound) + Play_Sound(UNCLOAK_WAV); + else + Play_Sound(UNCLOAK_SOUND); + } else - Abort_Sound(CLOAK_SOUND); -#endif + { + if (!newSound) + Abort_Sound(CLOAK_SOUND); + } #endif j->p_cloakphase--; @@ -712,17 +717,19 @@ if (j->p_no == me->p_no) { if ((sound_flags & PFSHIELD) && !(j->p_flags & PFSHIELD)) -#if defined(HAVE_SDL) - Play_Sound(SHIELD_DOWN_WAV); -#else - Play_Sound(SHIELD_DOWN_SOUND); -#endif + { + if (newSound) + Play_Sound(SHIELD_DOWN_WAV); + else + Play_Sound(SHIELD_DOWN_SOUND); + } if (!(sound_flags & PFSHIELD) && (j->p_flags & PFSHIELD)) -#if defined(HAVE_SDL) - Play_Sound(SHIELD_UP_WAV); -#else - Play_Sound(SHIELD_UP_SOUND); -#endif + { + if (newSound) + Play_Sound(SHIELD_UP_WAV); + else + Play_Sound(SHIELD_UP_SOUND); + } } #endif @@ -872,11 +879,12 @@ #ifdef SOUND if (i == 1) -#if defined(HAVE_SDL) - Play_Sound(j == me ? EXPLOSION_WAV : EXPLOSION_OTHER_WAV); -#else - Play_Sound(j == me ? EXPLOSION_SOUND : OTHER_EXPLOSION_SOUND); -#endif + { + if (newSound) + Play_Sound(j == me ? EXPLOSION_WAV : EXPLOSION_OTHER_WAV); + else + Play_Sound(j == me ? EXPLOSION_SOUND : OTHER_EXPLOSION_SOUND); + } #endif if (i < BMP_SHIPEXPL_FRAMES || @@ -923,11 +931,10 @@ #ifdef SOUND if (!sound_phaser) { -#if defined(HAVE_SDL) - Play_Sound(j == me ? PHASER_WAV : PHASER_OTHER_WAV); -#else - Play_Sound(j == me ? PHASER_SOUND : OTHER_PHASER_SOUND); -#endif + if (newSound) + Play_Sound(j == me ? PHASER_WAV : PHASER_OTHER_WAV); + else + Play_Sound(j == me ? PHASER_SOUND : OTHER_PHASER_SOUND); sound_phaser++; } #endif @@ -1367,11 +1374,12 @@ #ifdef SOUND if (k->t_fuse == BMP_TORPDET_FRAMES - 1) -#if defined(HAVE_SDL) - Play_Sound(TORP_HIT_WAV); -#else - Play_Sound(TORP_HIT_SOUND); -#endif + { + if (newSound) + Play_Sound(TORP_HIT_WAV); + else + Play_Sound(TORP_HIT_SOUND); + } #endif #ifdef COLORIZEWEAPON @@ -1549,11 +1557,12 @@ #ifdef SOUND if (pt->pt_fuse == BMP_TORPDET_FRAMES - 1) -#if defined(HAVE_SDL) - Play_Sound(PLASMA_HIT_WAV); -#else - Play_Sound(PLASMA_HIT_SOUND); -#endif + { + if (newSound) + Play_Sound(PLASMA_HIT_WAV); + else + Play_Sound(PLASMA_HIT_SOUND); + } #endif #ifdef COLORIZEWEAPON @@ -1855,8 +1864,9 @@ } W_ChangeBorder (baseWin, gColor); -#if defined(SOUND) && !defined(HAVE_SDL) - Abort_Sound(WARNING_SOUND); +#if defined(SOUND) + if (!newSound) + Abort_Sound(WARNING_SOUND); #endif break; @@ -1870,8 +1880,9 @@ } W_ChangeBorder (baseWin, yColor); -#if defined(SOUND) && !defined(HAVE_SDL) - Abort_Sound(WARNING_SOUND); +#if defined(SOUND) + if (!newSound) + Abort_Sound(WARNING_SOUND); #endif break; @@ -1886,11 +1897,10 @@ W_ChangeBorder (baseWin, rColor); #ifdef SOUND -#if defined(HAVE_SDL) - Play_Sound(WARNING_WAV); -#else - Play_Sound(WARNING_SOUND); -#endif + if (newSound) + Play_Sound(WARNING_WAV); + else + Play_Sound(WARNING_SOUND); #endif break; @@ -1898,21 +1908,24 @@ } #ifdef SOUND -#if defined(HAVE_SDL) - if (sound_torps < me->p_ntorp) - Play_Sound(FIRE_TORP_WAV); - if (sound_other_torps < num_other_torps) - Play_Sound(FIRE_TORP_OTHER_WAV); - if (sound_plasma < me->p_nplasmatorp) - Play_Sound(FIRE_PLASMA_WAV); -#else - if (sound_torps < me->p_ntorp) - Play_Sound(FIRE_TORP_SOUND); - if (sound_other_torps < num_other_torps) - Play_Sound(OTHER_FIRE_TORP_SOUND); - if (sound_plasma < me->p_nplasmatorp) - Play_Sound(FIRE_PLASMA_SOUND); -#endif + if (newSound) + { + if (sound_torps < me->p_ntorp) + Play_Sound(FIRE_TORP_WAV); + if (sound_other_torps < num_other_torps) + Play_Sound(FIRE_TORP_OTHER_WAV); + if (sound_plasma < me->p_nplasmatorp) + Play_Sound(FIRE_PLASMA_WAV); + } + else + { + if (sound_torps < me->p_ntorp) + Play_Sound(FIRE_TORP_SOUND); + if (sound_other_torps < num_other_torps) + Play_Sound(OTHER_FIRE_TORP_SOUND); + if (sound_plasma < me->p_nplasmatorp) + Play_Sound(FIRE_PLASMA_SOUND); + } sound_flags = me->p_flags; sound_torps = me->p_ntorp; Index: playback.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- playback.c 24 Apr 2006 14:13:25 -0000 1.9 +++ playback.c 24 Apr 2006 15:30:38 -0000 1.10 @@ -269,6 +269,7 @@ #endif #ifdef SOUND + newsoundwin (display_host, name); Init_Sound (); #endif @@ -282,8 +283,9 @@ if (i >= RETURNBASE) return (i - RETURNBASE); /* Terminate with retcode */ -#if defined(SOUND) && !defined(HAVE_SDL) - Abort_Sound(ENGINE_SOUND); +#if defined(SOUND) + if (!newSound) + Abort_Sound(ENGINE_SOUND); #endif //#ifdef nodef @@ -326,13 +328,16 @@ redrawPStats (); #ifdef SOUND -#if defined(HAVE_SDL) - Mix_HaltChannel(-1); /* Kill all currently playing sounds when entering game */ - Play_Sound(ENTER_SHIP_WAV); -#else - Play_Sound(ENTER_SHIP_SOUND); - Play_Sound(ENGINE_SOUND); -#endif + if (newSound) + { + Mix_HaltChannel(-1); /* Kill all currently playing sounds when entering game */ + Play_Sound(ENTER_SHIP_WAV); + } + else + { + Play_Sound(ENTER_SHIP_SOUND); + Play_Sound(ENGINE_SOUND); + } #endif while (1) Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- defaults.c 22 Apr 2006 14:11:47 -0000 1.8 +++ defaults.c 24 Apr 2006 15:30:38 -0000 1.9 @@ -278,6 +278,12 @@ NULL } }, + {"newSound", &newSound, RC_BOOL, + { + "Use new layered, stereo sound", + NULL + } + }, {"omitTeamLetter", &omitTeamLetter, RC_BOOL, { "Omit team letter on galaxy", @@ -1348,7 +1354,7 @@ timerType = T_SHIP; allowWheelActions = booleanDefault ("allowWheelActions", allowWheelActions); - + newSound = booleanDefault ("newSound", newSound); tpDotDist = intDefault ("tpDotDist", tpDotDist); omitTeamLetter = booleanDefault ("omitTeamLetter", omitTeamLetter); beepOnPrivateMessage = booleanDefault ("beepOnPrivateMessage", beepOnPrivateMessage); Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- data.c 22 Apr 2006 14:11:47 -0000 1.10 +++ data.c 24 Apr 2006 15:30:38 -0000 1.11 @@ -720,4 +720,6 @@ WNDPROC lpfnDefRichEditWndProc; /* default window proc */ -int richText = 0; /* temporary variable to select rich text message windows */ \ No newline at end of file +int richText = 0; /* temporary variable to select rich text message windows */ + +int newSound = 1; /* use new SDL sound */ \ No newline at end of file Index: beeplite.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/beeplite.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- beeplite.c 24 Apr 2006 14:13:25 -0000 1.4 +++ beeplite.c 24 Apr 2006 15:30:38 -0000 1.5 @@ -1,36 +1,5 @@ /* beeplite.c * - * $Log$ - * Revision 1.4 2006/04/24 14:13:25 modemhero - * Initial SDL patch for multilayered sounds. - * - * Revision 1.3 2006/04/19 15:18:27 modemhero - * Tidied up the save_options function, fixing some spacing errors, and puttting the - * keymap/buttonmap on the top of the list due to its importance. Also added the - * sounddir option. The eventual goal is to make save_options generate a file that contains - * everything from your netrekrc file, so the options menus act as an in-game netrekrc editor. - * Once everything is in place, save_options could write over your current netrekrc (the default - * will be to write to a separate file, but there will be a menu option to save over your netrekrc). - * Currently it writes to a separate file (netrek.sav) because it still doesn't save everything that is needed. - * Default windows placements need to be saved, uselite options need to be saved, review window mapping - * needs to be saved, option server/servernick/servertype needs to be saved, and lastly, the save - * keymap routine is broken. - * - * Fixed mainResizeable loading from rc/saving. Also made default setting = on. - * - * Revision 1.2 2006/04/19 13:02:33 modemhero - * Rewrote TTS centering/refresh code so that text is properly centered and clears properly when the message expires. - * The old code used an average text width that was not so good, resulting in poor centering for long messages. The new code measures the length of the message directly. - * Also, the W_ClearArea function was not catching the 3 left-most pixels for whatever reason, so the call to this function slightly extends the area to clear. - * Updated COW manual to reflect change of tts_pos variable to tts_ypos. - * This patch could be applied to other windows clients as well. - * - * Revision 1.1 2006/04/18 13:47:24 modemhero - * First attempt at reimport of beeplite into NetrekXP. Unresolved issue: improper text clearing on TTS beeplite messages. Still to add: saving of beeplite settings in save_options. - * - * Revision 1.1.1.1 1998/11/01 17:24:08 siegl - * COW 3.0 initial revision - * */ #include "config.h" @@ -221,14 +190,15 @@ { #if defined(SOUND) -#if defined(HAVE_SDL) - Play_Sound(MESSAGE_WAV); -#else - if (sound_toggle) - Play_Sound(MESSAGE_SOUND); + if (newSound) + Play_Sound(MESSAGE_WAV); else - W_Beep(); -#endif + { + if (sound_toggle) + Play_Sound(MESSAGE_SOUND); + else + W_Beep(); + } #endif } break; @@ -237,7 +207,8 @@ are not loaded into SDL library currently - can change at a later time. */ #ifdef SOUND -#if !defined(HAVE_SDL) + if (!newSound) + { case '1': if (F_beeplite_flags & LITE_SOUNDS) Play_Sound(MESSAGE1_SOUND); @@ -274,7 +245,7 @@ if (F_beeplite_flags & LITE_SOUNDS) Play_Sound(MESSAGE9_SOUND); break; -#endif + } #endif /* Text between: /| | will be displayed with TTS */ Index: cowmain.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- cowmain.c 24 Apr 2006 14:13:25 -0000 1.8 +++ cowmain.c 24 Apr 2006 15:30:38 -0000 1.9 @@ -769,8 +769,10 @@ resetdefaults (); savebitmaps (); -#if defined(SOUND) && defined(HAVE_SDL) - Init_Sound(); +#if defined(SOUND) + newsoundwin (display_host, name); + if (newSound) + Init_Sound(); #endif /* open memory...? */ @@ -898,8 +900,9 @@ /* Moved SDL sound initialization to right after readdefaults() so * the intro can start playing ASAP */ -#if defined(SOUND) && !defined(HAVE_SDL) - Init_Sound(); +#if defined(SOUND) + if (!newSound) + Init_Sound(); #endif @@ -909,8 +912,9 @@ if (i >= RETURNBASE) return (i - RETURNBASE); /* Terminate with retcode */ -#if defined(SOUND) && !defined(HAVE_SDL) - Abort_Sound(ENGINE_SOUND); +#if defined(SOUND) + if (!newSound) + Abort_Sound(ENGINE_SOUND); #endif /* give the player the motd and find out which team he wants */ @@ -957,8 +961,9 @@ sendByeReq (); -#if defined(SOUND) && !defined(HAVE_SDL) - Exit_Sound(); +#if defined(SOUND) + if (!newSound) + Exit_Sound(); #endif sleep (1); @@ -1041,13 +1046,16 @@ #ifdef SOUND -#if defined(HAVE_SDL) - Mix_HaltChannel(-1); /* Kill all currently playing sounds when entering game */ - Play_Sound(ENTER_SHIP_WAV); -#else - Play_Sound(ENTER_SHIP_SOUND); - Play_Sound(ENGINE_SOUND); -#endif /* HAVE_SDL */ + if (newSound) + { + Mix_HaltChannel(-1); /* Kill all currently playing sounds when entering game */ + Play_Sound(ENTER_SHIP_WAV); + } + else + { + Play_Sound(ENTER_SHIP_SOUND); + Play_Sound(ENGINE_SOUND); + } #endif /* Get input until the player quits or dies */