Added 'speech' config value which controls loading of 3dovoice addon; decoupled user option from actual presence of speech

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3637 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2011-07-09 02:29:10 +00:00
parent 812d98449d
commit a2be245a09
15 changed files with 66 additions and 46 deletions
+2
View File
@@ -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:
+15
View File
@@ -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
+5 -8
View File
@@ -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
+2 -1
View File
@@ -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);
+1
View File
@@ -54,6 +54,7 @@ const char **optAddons;
BOOLEAN opt3doMusic;
BOOLEAN optRemixMusic;
BOOLEAN optSpeech;
BOOLEAN optSubtitles;
BOOLEAN optStereoSFX;
BOOLEAN optKeepAspectRatio;
+1
View File
@@ -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;
+7 -18
View File
@@ -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;
+1 -2
View File
@@ -46,8 +46,7 @@
#include <ctype.h>
#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
+6 -7
View File
@@ -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);
+2 -2
View File
@@ -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);
+2 -1
View File
@@ -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;
+7 -3
View File
@@ -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)
{
+4
View File
@@ -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);
+9 -3
View File
@@ -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);
+2 -1
View File
@@ -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;