Changed cmd-line options once again (hopefully for the last time)

- new options are of format --opt=pc/3do
  - availiable options are --menu, --cscan, --font, --music
  - only --music has a 'short' version (-m) -e has been removed


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@543 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2003-01-12 03:44:35 +00:00
parent 0e471c82cd
commit 9d829033c8
10 changed files with 81 additions and 63 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
Changes towards version 0.2: Changes towards version 0.2:
- Added a sane cmd-line naming scheme: --opt=(pc|3do) see --help for more -PBlue
- Added new font effect (PC-lander messages), and set colors for text -PBlue - Added new font effect (PC-lander messages), and set colors for text -PBlue
- Use correct font for 'CAPTAIN', 'FUEL', and 'CREW' is status screen -PBlue - Use correct font for 'CAPTAIN', 'FUEL', and 'CREW' is status screen -PBlue
- Changed PC cmd-line options: now -a font,menu,scan -PhracturedBlue
- Added gradiated font support (for ship name), and PC-font option -PBlue - Added gradiated font support (for ship name), and PC-font option -PBlue
- Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue - Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue
- Updated mingw support with better directions, and easier build -PBlue - Updated mingw support with better directions, and easier build -PBlue
+5 -4
View File
@@ -28,12 +28,13 @@
#include "file.h" #include "file.h"
#include "config.h" #include "config.h"
int optWhichMusic = MUSIC_3DO; int optWhichMusic = OPT_3DO;
int optWhichCoarseScan = OPT_3DO;
int optWhichMenu = OPT_3DO;
int optWhichFonts = OPT_3DO;
char *configDir, *saveDir, *meleeDir; char *configDir, *saveDir, *meleeDir;
BOOLEAN optSubtitles = TRUE; BOOLEAN optSubtitles = TRUE;
BOOLEAN optPCscan = FALSE;
BOOLEAN optPCmenu = FALSE;
BOOLEAN optPCfonts = FALSE;
void void
prepareConfigDir (void) { prepareConfigDir (void) {
+7 -10
View File
@@ -26,20 +26,17 @@
#define UQM_MAJOR_VERSION 0 #define UQM_MAJOR_VERSION 0
#define UQM_MINOR_VERSION 13 #define UQM_MINOR_VERSION 13
enum #define OPT_3DO 0x01
{ #define OPT_PC 0x02
MUSIC_3DO, #define OPT_ALL 0xFF
MUSIC_PC,
};
extern int optWhichMusic; extern int optWhichMusic;
extern int optWhichCoarseScan;
extern int optWhichMenu;
extern int optWhichFonts;
extern BOOLEAN optSubtitles; extern BOOLEAN optSubtitles;
extern BOOLEAN optPCscan;
extern BOOLEAN optPCmenu;
extern BOOLEAN optPCfonts;
extern char *configDir; extern char *configDir;
extern char *meleeDir; extern char *meleeDir;
+1 -1
View File
@@ -128,7 +128,7 @@ FeedbackSetting (BYTE which_setting)
case CYBORG_NORMAL_SETTING: case CYBORG_NORMAL_SETTING:
case CYBORG_DOUBLE_SETTING: case CYBORG_DOUBLE_SETTING:
case CYBORG_SUPER_SETTING: case CYBORG_SUPER_SETTING:
if (optPCmenu && which_setting > CYBORG_NORMAL_SETTING) if (optWhichMenu == OPT_PC && which_setting > CYBORG_NORMAL_SETTING)
{ {
if (which_setting == CYBORG_DOUBLE_SETTING) if (which_setting == CYBORG_DOUBLE_SETTING)
strcpy (tmpstr, "+"); strcpy (tmpstr, "+");
+2 -2
View File
@@ -139,7 +139,7 @@ _GetMusicData (FILE *fp, DWORD length)
switch (optWhichMusic) switch (optWhichMusic)
{ {
default: default:
case MUSIC_3DO: case OPT_3DO:
{ {
char threedoname[1000]; char threedoname[1000];
@@ -151,7 +151,7 @@ _GetMusicData (FILE *fp, DWORD length)
} }
break; break;
} }
case MUSIC_PC: case OPT_PC:
{ {
break; break;
} }
+2 -2
View File
@@ -172,7 +172,7 @@ _GetMusicData (FILE *fp, DWORD length)
switch (optWhichMusic) switch (optWhichMusic)
{ {
default: default:
case MUSIC_3DO: case OPT_3DO:
{ {
char threedoname[1000]; char threedoname[1000];
@@ -184,7 +184,7 @@ _GetMusicData (FILE *fp, DWORD length)
} }
break; break;
} }
case MUSIC_PC: case OPT_PC:
{ {
break; break;
} }
+3 -3
View File
@@ -34,7 +34,7 @@ ClearReportArea ()
STAMP s; STAMP s;
PRIMITIVE prim_row[NUM_CELL_COLS]; PRIMITIVE prim_row[NUM_CELL_COLS];
if (optPCfonts) if (optWhichFonts == OPT_PC)
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 21); s.frame = SetAbsFrameIndex (SpaceJunkFrame, 21);
else else
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18); s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18);
@@ -47,7 +47,7 @@ ClearReportArea ()
s.origin.x += r.extent.width + 1; s.origin.x += r.extent.width + 1;
SetPrimNextLink (&prim_row[i], i + 1); SetPrimNextLink (&prim_row[i], i + 1);
if (optPCfonts) if (optWhichFonts == OPT_PC)
SetPrimType (&prim_row[i], STAMP_PRIM); SetPrimType (&prim_row[i], STAMP_PRIM);
else else
{ {
@@ -234,7 +234,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
FONT OldFont; FONT OldFont;
OldFont = SetContextFont (pSolarSysState->SysInfo.PlanetInfo.LanderFont); OldFont = SetContextFont (pSolarSysState->SysInfo.PlanetInfo.LanderFont);
if (optPCfonts) if (optWhichFonts == OPT_PC)
{ {
SetContextFontEffect (ALTERNATE_EFFECT, SetContextFontEffect (ALTERNATE_EFFECT,
BUILD_COLOR_RGBA (0x00, 0x00, 0xD6, 0xFF), BUILD_COLOR_RGBA (0x00, 0x00, 0xD6, 0xFF),
+2 -2
View File
@@ -784,7 +784,7 @@ PickPlanetSide (INPUT_STATE InputState, PMENU_STATE pMS)
return (FALSE); return (FALSE);
} }
if (optPCscan) if (optWhichCoarseScan == OPT_PC)
PrintCoarseScanPC (); PrintCoarseScanPC ();
else else
PrintCoarseScan3DO (); PrintCoarseScan3DO ();
@@ -1242,7 +1242,7 @@ ScanSystem (void)
DrawMenuStateStrings (PM_MIN_SCAN, MenuState.CurState); DrawMenuStateStrings (PM_MIN_SCAN, MenuState.CurState);
if (optPCscan) if (optWhichCoarseScan == OPT_PC)
PrintCoarseScanPC (); PrintCoarseScanPC ();
else else
PrintCoarseScan3DO (); PrintCoarseScan3DO ();
+6 -6
View File
@@ -378,14 +378,14 @@ DrawFlagshipName (BOOLEAN InStatusArea)
t.baseline.y = r.corner.y + (SHIP_NAME_HEIGHT - InStatusArea); t.baseline.y = r.corner.y + (SHIP_NAME_HEIGHT - InStatusArea);
t.align = ALIGN_CENTER; t.align = ALIGN_CENTER;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
if (optPCfonts) if (optWhichFonts == OPT_PC)
SetContextFontEffect (GRADIENT_EFFECT, SetContextFontEffect (GRADIENT_EFFECT,
BUILD_COLOR_RGBA (0xF7, 0x2C, 0x00, 0xFF), BUILD_COLOR_RGBA (0xF7, 0x2C, 0x00, 0xFF),
BUILD_COLOR_RGBA (0xF7, 0xBA, 0x00, 0xFF)); BUILD_COLOR_RGBA (0xF7, 0xBA, 0x00, 0xFF));
else else
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C)); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C));
DrawText (&t); DrawText (&t);
if (optPCfonts) if (optWhichFonts == OPT_PC)
SetContextFontEffect (0, 0, 0); SetContextFontEffect (0, 0, 0);
SetContextForeGroundColor (OldColor); SetContextForeGroundColor (OldColor);
@@ -579,7 +579,7 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
s.origin.x = s.origin.y = 0; s.origin.x = s.origin.y = 0;
s.frame = flagship_status; s.frame = flagship_status;
DrawStamp (&s); DrawStamp (&s);
if (optPCfonts) if (optWhichFonts == OPT_PC)
DrawPC_SIS(); DrawPC_SIS();
s.origin.x = 1; s.origin.x = 1;
@@ -1091,7 +1091,7 @@ SetFlashRect (PRECT pRect, FRAME f)
else else
{ {
//Don't flash when using the PC menu //Don't flash when using the PC menu
if (optPCmenu) { if (optWhichMenu == OPT_PC) {
if (flash_task) if (flash_task)
{ {
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
@@ -1325,7 +1325,7 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState)
r.extent.width = RADAR_WIDTH + 2; r.extent.width = RADAR_WIDTH + 2;
BatchGraphics (); BatchGraphics ();
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08)); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
if (s.frame && optPCmenu) if (s.frame && optWhichMenu == OPT_PC)
{ {
if (beg_index == PM_CREW) if (beg_index == PM_CREW)
sprintf (menu_string[PM_CREW], "crew(%d)", GLOBAL (CrewCost)); sprintf (menu_string[PM_CREW], "crew(%d)", GLOBAL (CrewCost));
@@ -1367,7 +1367,7 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState)
} }
else else
{ {
if(optPCmenu) if(optWhichMenu == OPT_PC)
{ {
r.corner.x -= 1; r.corner.x -= 1;
r.extent.width += 1; r.extent.width += 1;
+52 -32
View File
@@ -58,6 +58,17 @@ CDToContentDir (char *contentdir)
} }
} }
static int
Check_PC_3DO_opt (char *value, DWORD mask, char *opt)
{
if ((mask & OPT_3DO) && strcmp (value, "3do") == 0)
return OPT_3DO;
if ((mask & OPT_PC) && strcmp (value, "pc") == 0)
return OPT_PC;
fprintf (stderr, "Unknown option '%s %s' found!",opt, value);
return -1;
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
@@ -66,8 +77,16 @@ main (int argc, char *argv[])
int soundflags = TFB_SOUNDFLAGS_MQAUDIO; int soundflags = TFB_SOUNDFLAGS_MQAUDIO;
int width = 640, height = 480, bpp = 16; int width = 640, height = 480, bpp = 16;
int vol; int vol;
int val;
char contentdir[1000]; char contentdir[1000];
enum
{
CSCAN_OPT = 1000,
MENU_OPT,
FONT_OPT
};
int option_index = 0, c; int option_index = 0, c;
static struct option long_options[] = static struct option long_options[] =
{ {
@@ -83,11 +102,13 @@ main (int argc, char *argv[])
{"musicvol", 1, NULL, 'M'}, {"musicvol", 1, NULL, 'M'},
{"sfxvol", 1, NULL, 'S'}, {"sfxvol", 1, NULL, 'S'},
{"speechvol", 1, NULL, 'T'}, {"speechvol", 1, NULL, 'T'},
{"3domusic", 0, NULL, 'e'},
{"pcmusic", 0, NULL, 'm'},
{"audioquality", 1, NULL, 'q'}, {"audioquality", 1, NULL, 'q'},
{"nosubtitles", 0, NULL, 'u'}, {"nosubtitles", 0, NULL, 'u'},
{"pcopt", 1, NULL, 'a'}, {"music", 1, NULL, 'm'},
// options with no short equivalent
{"cscan", 1, NULL, CSCAN_OPT},
{"menu", 1, NULL, MENU_OPT},
{"font", 1, NULL, FONT_OPT},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@@ -159,12 +180,6 @@ main (int argc, char *argv[])
vol = 100; vol = 100;
speechVolumeScale = vol / 100.0f; speechVolumeScale = vol / 100.0f;
break; break;
case 'e':
optWhichMusic = MUSIC_3DO;
break;
case 'm':
optWhichMusic = MUSIC_PC;
break;
case 'q': case 'q':
if (!strcmp (optarg, "high")) if (!strcmp (optarg, "high"))
{ {
@@ -185,22 +200,29 @@ main (int argc, char *argv[])
case 'u': case 'u':
optSubtitles = FALSE; optSubtitles = FALSE;
break; break;
case 'a': case 'm':
{ if ((val = Check_PC_3DO_opt (optarg,
char *thisopt, *optptr = optarg; OPT_PC | OPT_3DO,
while (thisopt = strtok (optptr, ",")) (char *)long_options[option_index].name)) != -1)
{ optWhichMusic = val;
optptr= NULL; break;
if (!strcmp (thisopt, "m") || !strcmp (thisopt, "menu")) case CSCAN_OPT:
optPCmenu = TRUE; if ((val = Check_PC_3DO_opt (optarg,
else if (!strcmp (thisopt, "s") || !strcmp (thisopt, "scan")) OPT_PC | OPT_3DO,
optPCscan = TRUE; (char *)long_options[option_index].name)) != -1)
else if (!strcmp (thisopt, "f") || !strcmp (thisopt, "font")) optWhichCoarseScan = val;
optPCfonts = TRUE; break;
else case MENU_OPT:
printf ("\nUnknown PC option: %s\n", thisopt); if ((val = Check_PC_3DO_opt (optarg,
} OPT_PC | OPT_3DO,
} (char *)long_options[option_index].name)) != -1)
optWhichMenu = val;
break;
case FONT_OPT:
if ((val = Check_PC_3DO_opt (optarg,
OPT_PC | OPT_3DO,
(char *)long_options[option_index].name)) != -1)
optWhichFonts = val;
break; break;
default: default:
printf ("\nOption %s not found!\n", long_options[option_index].name); printf ("\nOption %s not found!\n", long_options[option_index].name);
@@ -218,15 +240,13 @@ main (int argc, char *argv[])
printf(" -M, --musicvol=VOLUME (0-100, default 100)\n"); printf(" -M, --musicvol=VOLUME (0-100, default 100)\n");
printf(" -S, --sfxvol=VOLUME (0-100, default 100)\n"); printf(" -S, --sfxvol=VOLUME (0-100, default 100)\n");
printf(" -T, --speechvol=VOLUME (0-100, default 100)\n"); printf(" -T, --speechvol=VOLUME (0-100, default 100)\n");
printf(" -e, --3domusic (default)\n");
printf(" -m, --pcmusic\n");
printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n"); printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n");
printf(" -u, --nosubtitles\n"); printf(" -u, --nosubtitles\n");
printf(" -a --pcopt=font,menu,scan\n"); printf("The following options can take either '3do' or 'pc' as an option:\n");
printf(" options are comma seperated (no spaces)\n"); printf(" -m, --music : Music version (default 3do)\n");
printf(" font (or 'f') : use PC fonts\n"); printf(" --cscan : coarse-scan display, pc=text, 3do=hieroglyphs (default 3do)\n");
printf(" menu (or 'm') : use text menus\n"); printf(" --menu : menu type, pc=text, 3do=graphical (default 3do)\n");
printf(" scan (or 's') : use text for coarse-scan (not hierogliphics)\n"); printf(" --font : font types and colors (default 3do)\n");
return 0; return 0;
break; break;
} }