Added support for activating the remix packs from the setup menu.

This should simplify remix installation, as well as allow the remixes to be easily activated when the 3do music is not.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2873 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2007-12-19 00:28:14 +00:00
parent 95365e688f
commit ef5eab442e
8 changed files with 96 additions and 60 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.7:
- Added a Remix option to the setup menu - Michael
- Addon zips can live in content/addons directly - Michael
- 3DO music separated into an addon pack - Michael
- Major change in resource index scheme - Michael
+17 -3
View File
@@ -21,7 +21,7 @@ Font Style
Scan Style
Scroll Style
Subtitles
Music Format
3DO Remixes
Display
Cutscenes
Show FPS
@@ -33,6 +33,7 @@ Slave Shields
Player One
Player Two
Control Set
UQM Remixes
#(CAT_0_OPTS)
320x240
@@ -183,8 +184,8 @@ Do not subtitle alien speech.
Show subtitles for alien speech.
#(CAT_9_OPTS)
PC
3do
Disabled
Enabled
#(CAT_9_OPT_0_DESC)
Uses the music from the Original PC version.
@@ -407,6 +408,19 @@ Select the control template to edit.
Select the control template to edit.
#(CAT_21_OPTS)
Disabled
Enabled
#(CAT_21_OPT_0_DESC)
Do not load the Precursors Remix Pack.
Requires a restart of UQM to take effect.
#(CAT_21_OPT_1_DESC)
Overrides PC or 3do soundtrack with the
modern soundtrack written by The Precursors.
Requires a restart of UQM to take effect.
#(SLIDERS)
Music Volume
SFX Volume
+40 -28
View File
@@ -38,7 +38,6 @@
#include <locale.h>
int optWhichMusic;
int optWhichCoarseScan;
int optWhichMenu;
int optWhichFonts;
@@ -48,6 +47,8 @@ int optSmoothScroll;
int optMeleeScale;
const char **optAddons;
BOOLEAN opt3doMusic;
BOOLEAN optPrecursorsMusic;
BOOLEAN optSubtitles;
BOOLEAN optStereoSFX;
BOOLEAN optKeepAspectRatio;
@@ -401,10 +402,11 @@ mountDirZips (uio_MountHandle *contentHandle, uio_DirHandle *dirHandle, const ch
uio_DirList_free (dirList);
}
void
prepareAddons (const char **addons)
BOOLEAN
loadAddon (const char *addon)
{
uio_DirHandle *addonsDir;
uio_DirHandle *addonsDir, *addonDir;
uio_DirList *indices;
addonsDir = uio_openDirRelative (contentDir, "addons", 0);
if (addonsDir == NULL)
@@ -412,34 +414,44 @@ prepareAddons (const char **addons)
log_add (log_Warning, "Warning: There's no 'addons' "
"directory in the 'content' directory;\n\t'--addon' "
"options are ignored.");
return;
return FALSE;
}
addonDir = uio_openDirRelative (addonsDir, addon, 0);
if (addonDir == NULL)
{
log_add (log_Warning, "Warning: Addon '%s' not found", addon);
uio_closeDir (addonsDir);
return FALSE;
}
indices = uio_getDirList (addonDir, "", ".rmp$",
match_MATCH_REGEX);
if (indices != NULL)
{
int i;
for (i = 0; i < indices->numNames; i++)
{
res_LoadFilename (addonDir, indices->names[i]);
}
}
uio_DirList_free (indices);
uio_closeDir (addonDir);
uio_closeDir (addonsDir);
return TRUE;
}
void
prepareAddons (const char **addons)
{
for (; *addons != NULL; addons++)
{
uio_DirList *indices;
uio_DirHandle *addonDir;
addonDir = uio_openDirRelative (addonsDir, *addons, 0);
if (addonDir == NULL)
if (!loadAddon (*addons))
{
log_add (log_Warning, "Warning: Addon '%s' not found", *addons);
continue;
break;
}
indices = uio_getDirList (addonDir, "", ".rmp$",
match_MATCH_REGEX);
if (indices != NULL)
{
int i;
for (i = 0; i < indices->numNames; i++)
{
res_LoadFilename (addonDir, indices->names[i]);
}
}
uio_DirList_free (indices);
uio_closeDir (addonDir);
}
uio_closeDir (addonsDir);
}
+4 -1
View File
@@ -30,7 +30,6 @@
#define OPT_PC 0x02
#define OPT_ALL 0xFF
extern int optWhichMusic;
extern int optWhichCoarseScan;
extern int optWhichMenu;
extern int optWhichFonts;
@@ -39,6 +38,8 @@ extern int optWhichShield;
extern int optSmoothScroll;
extern int optMeleeScale;
extern BOOLEAN opt3doMusic;
extern BOOLEAN optPrecursorsMusic;
extern BOOLEAN optSubtitles;
extern BOOLEAN optStereoSFX;
extern BOOLEAN optKeepAspectRatio;
@@ -71,5 +72,7 @@ void prepareMeleeDir (void);
void prepareSaveDir (void);
void prepareAddons (const char **addons);
BOOLEAN loadAddon (const char *addon);
#endif
+8 -3
View File
@@ -115,10 +115,15 @@ LoadKernel (int argc, char *argv[])
if (hResIndex == 0)
return FALSE;
/* TODO: This code must die once addons are convenient to use. */
if (optWhichMusic == OPT_3DO)
/* Load addons demanded by the current configuration. */
if (opt3doMusic)
{
res_LoadFilename (contentDir, "addons/3domusic/3domusic.rmp");
loadAddon ("3domusic");
}
if (optPrecursorsMusic)
{
loadAddon ("remix");
}
/* Now load the rest of the addons, in order. */
+12 -7
View File
@@ -71,7 +71,7 @@ static void clear_control (WIDGET_CONTROLENTRY *widget);
#endif
#define MENU_COUNT 8
#define CHOICE_COUNT 21
#define CHOICE_COUNT 22
#define SLIDER_COUNT 3
#define BUTTON_COUNT 10
#define LABEL_COUNT 4
@@ -94,7 +94,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 };
3, 2 };
static HANDLER button_handlers[BUTTON_COUNT] = {
quit_main_menu, quit_sub_menu, do_graphics, do_engine,
@@ -102,7 +102,7 @@ static HANDLER button_handlers[BUTTON_COUNT] = {
do_keyconfig };
static int menu_sizes[MENU_COUNT] = {
7, 5, 6, 9, 2, 5,
7, 5, 7, 9, 2, 5,
#ifdef HAVE_OPENGL
5,
#else
@@ -137,6 +137,7 @@ static WIDGET *audio_widgets[] = {
(WIDGET *)(&sliders[2]),
(WIDGET *)(&choices[14]),
(WIDGET *)(&choices[9]),
(WIDGET *)(&choices[21]),
(WIDGET *)(&buttons[1]) };
static WIDGET *engine_widgets[] = {
@@ -370,7 +371,7 @@ SetDefaults (void)
choices[6].selected = opts.cscan;
choices[7].selected = opts.scroll;
choices[8].selected = opts.subtitles;
choices[9].selected = opts.music;
choices[9].selected = opts.music3do;
choices[10].selected = opts.fullscreen;
choices[11].selected = opts.intro;
choices[12].selected = opts.fps;
@@ -382,6 +383,7 @@ SetDefaults (void)
choices[18].selected = opts.player1;
choices[19].selected = opts.player2;
choices[20].selected = 0;
choices[21].selected = opts.musicremix;
sliders[0].value = opts.musicvol;
sliders[1].value = opts.sfxvol;
@@ -401,7 +403,7 @@ PropagateResults (void)
opts.cscan = choices[6].selected;
opts.scroll = choices[7].selected;
opts.subtitles = choices[8].selected;
opts.music = choices[9].selected;
opts.music3do = choices[9].selected;
opts.fullscreen = choices[10].selected;
opts.intro = choices[11].selected;
opts.fps = choices[12].selected;
@@ -412,6 +414,7 @@ PropagateResults (void)
opts.shield = choices[17].selected;
opts.player1 = choices[18].selected;
opts.player2 = choices[19].selected;
opts.musicremix = choices[21].selected;
opts.musicvol = sliders[0].value;
opts.sfxvol = sliders[1].value;
@@ -1081,7 +1084,8 @@ GetGlobalOptions (GLOBALOPTS *opts)
OPTVAL_PC : OPTVAL_3DO;
opts->stereo = optStereoSFX ? OPTVAL_ENABLED : OPTVAL_DISABLED;
/* These values are read in, but won't change during a run. */
opts->music = (optWhichMusic == OPT_3DO) ? OPTVAL_3DO : OPTVAL_PC;
opts->music3do = opt3doMusic ? OPTVAL_ENABLED : OPTVAL_DISABLED;
opts->musicremix = optPrecursorsMusic ? OPTVAL_ENABLED : OPTVAL_DISABLED;
switch (snddriver) {
case audio_DRIVER_OPENAL:
opts->adriver = OPTVAL_OPENAL;
@@ -1311,7 +1315,8 @@ SetGlobalOptions (GLOBALOPTS *opts)
res_PutBoolean ("config.iconicscan", opts->cscan == OPTVAL_3DO);
res_PutBoolean ("config.smoothscroll", opts->scroll == OPTVAL_3DO);
res_PutBoolean ("config.3domusic", opts->music == OPTVAL_3DO);
res_PutBoolean ("config.3domusic", opts->music3do == OPTVAL_ENABLED);
res_PutBoolean ("config.remixmusic", opts->musicremix == 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 -2
View File
@@ -74,8 +74,8 @@ typedef struct globalopts_struct {
OPT_DRIVERTYPE driver;
OPT_ADRIVERTYPE adriver;
OPT_AQUALITYTYPE aquality;
OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo;
OPT_CONSOLETYPE music, menu, text, cscan, scroll, intro, meleezoom, shield;
OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo, music3do, musicremix;
OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield;
CONTROL_TEMPLATE player1, player2;
int speechvol, musicvol, sfxvol;
} GLOBALOPTS;
+11 -15
View File
@@ -74,7 +74,8 @@ struct options_struct {
int numAddons;
int gammaSet;
float gamma;
int whichMusic;
BOOLEAN use3doMusic;
BOOLEAN usePrecursorsMusic;
int whichCoarseScan;
int whichMenu;
int whichFonts;
@@ -123,7 +124,8 @@ main (int argc, char *argv[])
/* .numAddons = */ 0,
/* .gammaSet = */ 0,
/* .gamma = */ 0.0f,
/* .whichMusic = */ OPT_3DO,
/* .use3doMusic = */ TRUE,
/* .usePrecursorsMusic = */ FALSE,
/* .whichCoarseScan = */ OPT_PC,
/* .whichMenu = */ OPT_PC,
/* .whichFont = */ OPT_PC,
@@ -270,7 +272,11 @@ main (int argc, char *argv[])
}
if (res_HasKey ("config.3domusic"))
{
options.whichMusic = res_GetBoolean ("config.3domusic") ? OPT_3DO : OPT_PC;
options.use3doMusic = res_GetBoolean ("config.3domusic");
}
if (res_HasKey ("config.remixmusic"))
{
options.usePrecursorsMusic = res_GetBoolean ("config.remixmusic");
}
if (res_HasKey ("config.3domovies"))
{
@@ -405,7 +411,8 @@ main (int argc, char *argv[])
soundflags = options.soundFlags;
// Fill in global variables:
optWhichMusic = options.whichMusic;
opt3doMusic = options.use3doMusic;
optPrecursorsMusic = options.usePrecursorsMusic;
optWhichCoarseScan = options.whichCoarseScan;
optWhichMenu = options.whichMenu;
optWhichFonts = options.whichFonts;
@@ -512,7 +519,6 @@ static struct option longOptions[] =
{"speechvol", 1, NULL, 'T'},
{"audioquality", 1, NULL, 'q'},
{"nosubtitles", 0, NULL, 'u'},
{"music", 1, NULL, 'm'},
{"gamma", 1, NULL, 'g'},
{"logfile", 1, NULL, 'l'},
{"intro", 1, NULL, 'i'},
@@ -728,14 +734,6 @@ parseOptions (int argc, char *argv[], struct options_struct *options)
case 'u':
options->subTitles = FALSE;
break;
case 'm':
{
if (Check_PC_3DO_opt (optarg, OPT_PC | OPT_3DO,
optionIndex >= 0 ? longOptions[optionIndex].name : "m",
&options->whichMusic) == -1)
badArg = TRUE;
break;
}
case 'g':
{
int result = parseFloatOption (optarg, &options->gamma,
@@ -1019,8 +1017,6 @@ usage (FILE *out, const struct options_struct *defaultOptions)
#endif
log_add (log_User, "The following options can take either '3do' or 'pc' "
"as an option:");
log_add (log_User, " -m, --music : Music version (default %s)",
PC_3DO_optString (defaultOptions->whichMusic));
log_add (log_User, " -i, --intro : Intro/ending version (default %s)",
PC_3DO_optString (defaultOptions->whichIntro));
log_add (log_User, " --cscan : coarse-scan display, pc=text, "