diff --git a/sc2/ChangeLog b/sc2/ChangeLog index c68679bb0..77d5d9c68 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.8: +- Added speech option which controls loading of 3dovoice addon (no need + to set speech volume to 0 anymore) - Alex - Added the MetaChron story to the no-voice Melnorme script (bug #43) - Alex 0.7.0: diff --git a/sc2/content/base/ui/setupmenu.txt b/sc2/content/base/ui/setupmenu.txt index 65f4a503e..80cbb090c 100644 --- a/sc2/content/base/ui/setupmenu.txt +++ b/sc2/content/base/ui/setupmenu.txt @@ -34,6 +34,7 @@ Player One Player Two Control Set UQM Remixes +Speech #(CAT_0_OPTS) 320x240 @@ -421,6 +422,20 @@ Overrides PC or 3do soundtrack with the modern soundtrack written by The Precursors. Requires a restart of UQM to take effect. +#(CAT_22_OPTS) +Disabled +Enabled + +#(CAT_22_OPT_0_DESC) +Do not load the 3DO Speech Pack. +Uses script closer to PC version. +Requires a restart of UQM to take effect. + +#(CAT_22_OPT_1_DESC) +Use 3DO speech. The script is closer to 3DO +version where there are differences. +Requires a restart of UQM to take effect. + #(SLIDERS) Music Volume SFX Volume diff --git a/sc2/src/libs/sound/stream.c b/sc2/src/libs/sound/stream.c index c9f7e800a..e247e5a47 100644 --- a/sc2/src/libs/sound/stream.c +++ b/sc2/src/libs/sound/stream.c @@ -593,7 +593,8 @@ readSoundSample (void *ptr, int sample_size) // We use AGC because different pieces of music and speech can easily be // at very different gain levels, because the game is moddable. int -GraphForegroundStream (uint8 *data, sint32 width, sint32 height) +GraphForegroundStream (uint8 *data, sint32 width, sint32 height, + bool wantSpeech) { int source_num; TFB_SoundSource *source; @@ -634,7 +635,7 @@ GraphForegroundStream (uint8 *data, sint32 width, sint32 height) source_num = SPEECH_SOURCE; source = &soundSource[source_num]; LockMutex (source->stream_mutex); - if (speechVolumeScale != 0.0f && (!source->sample || + if (wantSpeech && (!source->sample || !source->sample->decoder || !source->sample->decoder->is_null)) { // Use speech waveform, since it's available // Step is picked experimentally. Using step of 1 sample at 11025Hz, @@ -642,9 +643,10 @@ GraphForegroundStream (uint8 *data, sint32 width, sint32 height) // better this way. step = 1; } - else if (musicVolumeScale != 0.0f) + else { // We do not have speech -- use music waveform UnlockMutex (source->stream_mutex); + source_num = MUSIC_SOURCE; source = &soundSource[source_num]; LockMutex (source->stream_mutex); @@ -653,11 +655,6 @@ GraphForegroundStream (uint8 *data, sint32 width, sint32 height) // It looks better this way. step = 4; } - else - { // We do not have anything usable - UnlockMutex (source->stream_mutex); - return 0; - } if (!PlayingStream (source_num) || !source->sample || !source->sample->decoder || !source->sbuffer diff --git a/sc2/src/libs/sound/stream.h b/sc2/src/libs/sound/stream.h index e71ae4b97..57661325a 100644 --- a/sc2/src/libs/sound/stream.h +++ b/sc2/src/libs/sound/stream.h @@ -28,7 +28,8 @@ void ResumeStream (uint32 source); void SeekStream (uint32 source, uint32 pos); BOOLEAN PlayingStream (uint32 source); -int GraphForegroundStream (uint8 *data, sint32 width, sint32 height); +int GraphForegroundStream (uint8 *data, sint32 width, sint32 height, + bool wantSpeech); // returns TRUE if the fade was accepted by stream decoder bool SetMusicStreamFade (sint32 howLong, int endVolume); diff --git a/sc2/src/options.c b/sc2/src/options.c index d8306dfa1..5b8389c36 100644 --- a/sc2/src/options.c +++ b/sc2/src/options.c @@ -54,6 +54,7 @@ const char **optAddons; BOOLEAN opt3doMusic; BOOLEAN optRemixMusic; +BOOLEAN optSpeech; BOOLEAN optSubtitles; BOOLEAN optStereoSFX; BOOLEAN optKeepAspectRatio; diff --git a/sc2/src/options.h b/sc2/src/options.h index c675aec02..23c6f4c73 100644 --- a/sc2/src/options.h +++ b/sc2/src/options.h @@ -40,6 +40,7 @@ extern int optMeleeScale; extern BOOLEAN opt3doMusic; extern BOOLEAN optRemixMusic; +extern BOOLEAN optSpeech; extern BOOLEAN optSubtitles; extern BOOLEAN optStereoSFX; extern BOOLEAN optKeepAspectRatio; diff --git a/sc2/src/uqm.c b/sc2/src/uqm.c index c3597a486..a94e233ed 100644 --- a/sc2/src/uqm.c +++ b/sc2/src/uqm.c @@ -114,6 +114,7 @@ struct options_struct DECL_CONFIG_OPTION(int, soundQuality); DECL_CONFIG_OPTION(bool, use3doMusic); DECL_CONFIG_OPTION(bool, useRemixMusic); + DECL_CONFIG_OPTION(bool, useSpeech); DECL_CONFIG_OPTION(int, whichCoarseScan); DECL_CONFIG_OPTION(int, whichMenu); DECL_CONFIG_OPTION(int, whichFonts); @@ -247,6 +248,7 @@ main (int argc, char *argv[]) INIT_CONFIG_OPTION( soundQuality, audio_QUALITY_MEDIUM ), INIT_CONFIG_OPTION( use3doMusic, true ), INIT_CONFIG_OPTION( useRemixMusic, false ), + INIT_CONFIG_OPTION( useSpeech, true ), INIT_CONFIG_OPTION( whichCoarseScan, OPT_PC ), INIT_CONFIG_OPTION( whichMenu, OPT_PC ), INIT_CONFIG_OPTION( whichFonts, OPT_PC ), @@ -368,6 +370,7 @@ main (int argc, char *argv[]) // Fill in global variables: opt3doMusic = options.use3doMusic.value; optRemixMusic = options.useRemixMusic.value; + optSpeech = options.useSpeech.value; optWhichCoarseScan = options.whichCoarseScan.value; optWhichMenu = options.whichMenu.value; optWhichFonts = options.whichFonts.value; @@ -620,19 +623,13 @@ getUserConfigOptions (struct options_struct *options) getBoolConfigValue (&options->use3doMusic, "config.3domusic"); getBoolConfigValue (&options->useRemixMusic, "config.remixmusic"); + getBoolConfigValue (&options->useSpeech, "config.speech"); getBoolConfigValueXlat (&options->meleeScale, "config.smoothmelee", TFB_SCALE_TRILINEAR, TFB_SCALE_STEP); - if (getListConfigValue (&options->soundDriver, "config.audiodriver", - audioDriverList)) - { - // XXX: I don't know if we should turn speech off in this case. - // This affects which version of the alien script will be used. - if (options->soundDriver.value == audio_DRIVER_NOSOUND) - options->speechVolumeScale.value = 0.0f; - } - + getListConfigValue (&options->soundDriver, "config.audiodriver", + audioDriverList); getListConfigValue (&options->soundQuality, "config.audioquality", audioQualityList); getBoolConfigValue (&options->stereoSFX, "config.positionalsfx"); @@ -971,16 +968,8 @@ parseOptions (int argc, char *argv[], struct options_struct *options) } break; case SOUND_OPT: - if (setListOption (&options->soundDriver, optarg, + if (!setListOption (&options->soundDriver, optarg, audioDriverList)) - { - // XXX: I don't know if we should turn speech off in - // this case. This affects which version of the alien - // script will be used. - if (options->soundDriver.value == audio_DRIVER_NOSOUND) - options->speechVolumeScale.value = 0.0f; - } - else { InvalidArgument (optarg, "--sound"); badArg = true; diff --git a/sc2/src/uqm/comm.c b/sc2/src/uqm/comm.c index 13a5a7e1b..6dadf28c0 100644 --- a/sc2/src/uqm/comm.c +++ b/sc2/src/uqm/comm.c @@ -46,8 +46,7 @@ #include #define MAX_RESPONSES 8 -#define BACKGROUND_VOL \ - (speechVolumeScale == 0.0f ? NORMAL_VOLUME : (NORMAL_VOLUME >> 1)) +#define BACKGROUND_VOL (usingSpeech ? (NORMAL_VOLUME / 2) : NORMAL_VOLUME) #define FOREGROUND_VOL NORMAL_VOLUME // Oscilloscope frame rate diff --git a/sc2/src/uqm/comm/starbas/starbas.c b/sc2/src/uqm/comm/starbas/starbas.c index 860896cc2..18bd4cfb9 100644 --- a/sc2/src/uqm/comm/starbas/starbas.c +++ b/sc2/src/uqm/comm/starbas/starbas.c @@ -28,7 +28,6 @@ #include "libs/graphics/gfx_common.h" #include "libs/mathlib.h" #include "libs/inplib.h" -#include "libs/sound/sound.h" static void TellMission (RESPONSE_REF R); @@ -214,7 +213,7 @@ ByeBye (RESPONSE_REF R) } NPCPhrase (pStr0); - if (speechVolumeScale == 0.0f) + if (!usingSpeech) { NPCPhrase (SPACE); NPCPhrase (GLOBAL_PLAYER_NAME); @@ -900,7 +899,7 @@ TellStarBase (RESPONSE_REF R) else if (PLAYER_SAID (R, tell_me_about_crew)) { NPCPhrase (ABOUT_CREW0); - if (speechVolumeScale > 0.0f) + if (usingSpeech) NPCPhrase (YOUR_FLAGSHIP_3DO2); else { NPCPhrase (YOUR_FLAGSHIP_PC); @@ -1646,14 +1645,14 @@ NormalStarbase (RESPONSE_REF R) if (GET_GAME_STATE (MOONBASE_ON_SHIP)) { NPCPhrase (STARBASE_IS_READY_A); - if (speechVolumeScale > 0.0f) + if (usingSpeech) NPCPhrase (YOUR_FLAGSHIP_3DO1); else { NPCPhrase (YOUR_FLAGSHIP_PC); NPCPhrase (GLOBAL_SHIP_NAME); } NPCPhrase (STARBASE_IS_READY_B); - if (speechVolumeScale > 0.0f) + if (usingSpeech) NPCPhrase (YOUR_FLAGSHIP_3DO0); else NPCPhrase (GLOBAL_SHIP_NAME); @@ -1711,7 +1710,7 @@ NormalStarbase (RESPONSE_REF R) break; } NPCPhrase (pStr0); - if (speechVolumeScale == 0.0f) + if (!usingSpeech) { NPCPhrase (SPACE); NPCPhrase (GLOBAL_PLAYER_NAME); @@ -1914,7 +1913,7 @@ SellMinerals (RESPONSE_REF R) } NPCPhrase (pStr1); - if (speechVolumeScale == 0.0f) + if (!usingSpeech) { NPCPhrase (SPACE); NPCPhrase (GLOBAL_PLAYER_NAME); diff --git a/sc2/src/uqm/comm/syreen/syreenc.c b/sc2/src/uqm/comm/syreen/syreenc.c index 5224eca3c..c8d090ba7 100644 --- a/sc2/src/uqm/comm/syreen/syreenc.c +++ b/sc2/src/uqm/comm/syreen/syreenc.c @@ -20,8 +20,8 @@ #include "resinst.h" #include "strings.h" -#include "libs/sound/sound.h" #include "uqm/build.h" +#include "uqm/setup.h" static LOCDATA syreen_desc = @@ -652,7 +652,7 @@ InitialSyreen (RESPONSE_REF R) else if (PLAYER_SAID (R, we_are_vindicator0)) { NPCPhrase (WELCOME_VINDICATOR0); - if (speechVolumeScale == 0.0f) + if (!usingSpeech) { NPCPhrase (GLOBAL_PLAYER_NAME); NPCPhrase (WELCOME_VINDICATOR1); diff --git a/sc2/src/uqm/oscill.c b/sc2/src/uqm/oscill.c index 72736db43..61ac98368 100644 --- a/sc2/src/uqm/oscill.c +++ b/sc2/src/uqm/oscill.c @@ -79,7 +79,8 @@ DrawOscilloscope (void) assert ((size_t)scopeSize.width <= sizeof scope_data); assert (scopeSize.height < 256); - if (GraphForegroundStream (scope_data, scopeSize.width, scopeSize.height)) + if (GraphForegroundStream (scope_data, scopeSize.width, scopeSize.height, + usingSpeech)) { int i; CONTEXT oldContext; diff --git a/sc2/src/uqm/setup.c b/sc2/src/uqm/setup.c index 00984b304..01552422c 100644 --- a/sc2/src/uqm/setup.c +++ b/sc2/src/uqm/setup.c @@ -72,6 +72,8 @@ QUEUE disp_q; uio_Repository *repository; uio_DirHandle *rootDir; +BOOLEAN usingSpeech; + static void InitPlayerInput (void) @@ -119,9 +121,11 @@ LoadKernel (int argc, char *argv[]) loadAddon ("3domusic"); } - /* Always try to use voice data */ - if (!loadAddon ("3dovoice")) - speechVolumeScale = 0.0f; // XXX: need better no-speech indicator + usingSpeech = optSpeech; + if (optSpeech && !loadAddon ("3dovoice")) + { + usingSpeech = FALSE; + } if (optRemixMusic) { diff --git a/sc2/src/uqm/setup.h b/sc2/src/uqm/setup.h index ccf6fa9a0..0f8e151d0 100644 --- a/sc2/src/uqm/setup.h +++ b/sc2/src/uqm/setup.h @@ -58,6 +58,10 @@ extern ACTIVITY LastActivity; extern BYTE PlayerControl[]; +extern BOOLEAN usingSpeech; + // Actual speech presence indicator which decouples reality from + // the user option, thus the user option remains as pure intent + BOOLEAN InitContexts (void); void UninitPlayerInput (void); BOOLEAN InitGameKernel (void); diff --git a/sc2/src/uqm/setupmenu.c b/sc2/src/uqm/setupmenu.c index 3ea8c0225..dc7a52dfe 100644 --- a/sc2/src/uqm/setupmenu.c +++ b/sc2/src/uqm/setupmenu.c @@ -73,7 +73,7 @@ static void clear_control (WIDGET_CONTROLENTRY *widget); #endif #define MENU_COUNT 8 -#define CHOICE_COUNT 22 +#define CHOICE_COUNT 23 #define SLIDER_COUNT 3 #define BUTTON_COUNT 10 #define LABEL_COUNT 4 @@ -96,7 +96,7 @@ typedef int (*HANDLER)(WIDGET *, int); static int choice_widths[CHOICE_COUNT] = { 3, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 3, 2, 3, 3, - 3, 2 }; + 3, 2, 2 }; static HANDLER button_handlers[BUTTON_COUNT] = { quit_main_menu, quit_sub_menu, do_graphics, do_engine, @@ -104,7 +104,7 @@ static HANDLER button_handlers[BUTTON_COUNT] = { do_keyconfig }; static int menu_sizes[MENU_COUNT] = { - 7, 5, 7, 9, 2, 5, + 7, 5, 8, 9, 2, 5, #ifdef HAVE_OPENGL 5, #else @@ -140,6 +140,7 @@ static WIDGET *audio_widgets[] = { (WIDGET *)(&choices[14]), (WIDGET *)(&choices[9]), (WIDGET *)(&choices[21]), + (WIDGET *)(&choices[22]), (WIDGET *)(&buttons[1]) }; static WIDGET *engine_widgets[] = { @@ -387,6 +388,7 @@ SetDefaults (void) choices[19].selected = opts.player2; choices[20].selected = 0; choices[21].selected = opts.musicremix; + choices[22].selected = opts.speech; sliders[0].value = opts.musicvol; sliders[1].value = opts.sfxvol; @@ -418,6 +420,7 @@ PropagateResults (void) opts.player1 = choices[18].selected; opts.player2 = choices[19].selected; opts.musicremix = choices[21].selected; + opts.speech = choices[22].selected; opts.musicvol = sliders[0].value; opts.sfxvol = sliders[1].value; @@ -1093,6 +1096,7 @@ GetGlobalOptions (GLOBALOPTS *opts) /* These values are read in, but won't change during a run. */ opts->music3do = opt3doMusic ? OPTVAL_ENABLED : OPTVAL_DISABLED; opts->musicremix = optRemixMusic ? OPTVAL_ENABLED : OPTVAL_DISABLED; + opts->speech = optSpeech ? OPTVAL_ENABLED : OPTVAL_DISABLED; switch (snddriver) { case audio_DRIVER_OPENAL: opts->adriver = OPTVAL_OPENAL; @@ -1312,6 +1316,7 @@ SetGlobalOptions (GLOBALOPTS *opts) optSmoothScroll = (opts->scroll == OPTVAL_3DO) ? OPT_3DO : OPT_PC; optWhichShield = (opts->shield == OPTVAL_3DO) ? OPT_3DO : OPT_PC; optMeleeScale = (opts->meleezoom == OPTVAL_3DO) ? TFB_SCALE_TRILINEAR : TFB_SCALE_STEP; + optSpeech = (opts->speech == OPTVAL_ENABLED); optWhichIntro = (opts->intro == OPTVAL_3DO) ? OPT_3DO : OPT_PC; PlayerControls[0] = opts->player1; PlayerControls[1] = opts->player2; @@ -1324,6 +1329,7 @@ SetGlobalOptions (GLOBALOPTS *opts) res_PutBoolean ("config.3domusic", opts->music3do == OPTVAL_ENABLED); res_PutBoolean ("config.remixmusic", opts->musicremix == OPTVAL_ENABLED); + res_PutBoolean ("config.speech", opts->speech == OPTVAL_ENABLED); res_PutBoolean ("config.3domovies", opts->intro == OPTVAL_3DO); res_PutBoolean ("config.showfps", opts->fps == OPTVAL_ENABLED); res_PutBoolean ("config.smoothmelee", opts->meleezoom == OPTVAL_3DO); diff --git a/sc2/src/uqm/setupmenu.h b/sc2/src/uqm/setupmenu.h index 257b74508..7127ce615 100644 --- a/sc2/src/uqm/setupmenu.h +++ b/sc2/src/uqm/setupmenu.h @@ -74,7 +74,8 @@ typedef struct globalopts_struct { OPT_DRIVERTYPE driver; OPT_ADRIVERTYPE adriver; OPT_AQUALITYTYPE aquality; - OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo, music3do, musicremix; + OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo; + OPT_ENABLABLE music3do, musicremix, speech; OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield; CONTROL_TEMPLATE player1, player2; int speechvol, musicvol, sfxvol;