- Everything on the command line before the first switch with an unrecognized switch is
now added to -file. This was previously restricted to only .wad, .zip, .pk3, and .txt. - You can now pass -file/-deh/-bex more than once on the command line, and they will all have effect. SVN r2184 (trunk)
This commit is contained in:
parent
5da2885d88
commit
dfde55d249
3 changed files with 188 additions and 108 deletions
103
src/d_main.cpp
103
src/d_main.cpp
|
|
@ -129,7 +129,7 @@ void D_CheckNetGame ();
|
|||
void D_ProcessEvents ();
|
||||
void G_BuildTiccmd (ticcmd_t* cmd);
|
||||
void D_DoAdvanceDemo ();
|
||||
void D_AddWildFile (const char *pattern);
|
||||
void D_AddWildFile (TArray<FString> &wadfiles, const char *pattern);
|
||||
|
||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
|
|
@ -1478,27 +1478,22 @@ static const char *BaseFileSearch (const char *file, const char *ext, bool lookf
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool ConsiderPatches (const char *arg, const char *ext)
|
||||
bool ConsiderPatches (const char *arg)
|
||||
{
|
||||
bool noDef = false;
|
||||
DArgs *files = Args->GatherFiles (arg, ext, false);
|
||||
int i, argc;
|
||||
FString *args;
|
||||
const char *f;
|
||||
|
||||
if (files->NumArgs() > 0)
|
||||
argc = Args->CheckParmList(arg, &args);
|
||||
for (i = 0; i < argc; ++i)
|
||||
{
|
||||
int i;
|
||||
const char *f;
|
||||
|
||||
for (i = 0; i < files->NumArgs(); ++i)
|
||||
if ( (f = BaseFileSearch(args[i], ".deh")) ||
|
||||
(f = BaseFileSearch(args[i], ".bex")) )
|
||||
{
|
||||
if ( (f = BaseFileSearch (files->GetArg (i), ".deh")) )
|
||||
D_LoadDehFile(f);
|
||||
else if ( (f = BaseFileSearch (files->GetArg (i), ".bex")) )
|
||||
D_LoadDehFile(f);
|
||||
D_LoadDehFile(f);
|
||||
}
|
||||
noDef = true;
|
||||
}
|
||||
files->Destroy();
|
||||
return noDef;
|
||||
return argc > 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -1591,40 +1586,18 @@ void D_MultiExec (DArgs *list, bool usePullin)
|
|||
|
||||
static void GetCmdLineFiles(TArray<FString> &wadfiles)
|
||||
{
|
||||
DArgs *files = Args->GatherFiles ("-file", ".wad", true);
|
||||
DArgs *files1 = Args->GatherFiles (NULL, ".zip", false);
|
||||
DArgs *files2 = Args->GatherFiles (NULL, ".pk3", false);
|
||||
DArgs *files3 = Args->GatherFiles (NULL, ".txt", false);
|
||||
if (files->NumArgs() > 0 || files1->NumArgs() > 0 || files2->NumArgs() > 0 || files3->NumArgs() > 0)
|
||||
{
|
||||
// Check for -file in shareware
|
||||
if (gameinfo.flags & GI_SHAREWARE)
|
||||
{
|
||||
I_FatalError ("You cannot -file with the shareware version. Register!");
|
||||
}
|
||||
FString *args;
|
||||
int i, argc;
|
||||
|
||||
// the files gathered are wadfile/lump names
|
||||
for (int i = 0; i < files->NumArgs(); i++)
|
||||
{
|
||||
D_AddWildFile (wadfiles, files->GetArg (i));
|
||||
}
|
||||
for (int i = 0; i < files1->NumArgs(); i++)
|
||||
{
|
||||
D_AddWildFile (wadfiles, files1->GetArg (i));
|
||||
}
|
||||
for (int i = 0; i < files2->NumArgs(); i++)
|
||||
{
|
||||
D_AddWildFile (wadfiles, files2->GetArg (i));
|
||||
}
|
||||
for (int i = 0; i < files3->NumArgs(); i++)
|
||||
{
|
||||
D_AddWildFile (wadfiles, files3->GetArg (i));
|
||||
}
|
||||
argc = Args->CheckParmList("-file", &args);
|
||||
if ((gameinfo.flags & GI_SHAREWARE) && argc > 0)
|
||||
{
|
||||
I_FatalError ("You cannot -file with the shareware version. Register!");
|
||||
}
|
||||
for (i = 0; i < argc; ++i)
|
||||
{
|
||||
D_AddWildFile(wadfiles, args[i]);
|
||||
}
|
||||
files->Destroy();
|
||||
files1->Destroy();
|
||||
files2->Destroy();
|
||||
files3->Destroy();
|
||||
}
|
||||
|
||||
static void CopyFiles(TArray<FString> &to, TArray<FString> &from)
|
||||
|
|
@ -1757,6 +1730,8 @@ void D_DoomMain (void)
|
|||
const char *wad;
|
||||
DArgs *execFiles;
|
||||
TArray<FString> pwads;
|
||||
FString *args;
|
||||
int argcount;
|
||||
|
||||
// Set the FPU precision to 53 significant bits. This is the default
|
||||
// for Visual C++, but not for GCC, so some slight math variances
|
||||
|
|
@ -1775,6 +1750,13 @@ void D_DoomMain (void)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// Combine different file parameters with their pre-switch bits.
|
||||
Args->CollectFiles("-deh", ".deh");
|
||||
Args->CollectFiles("-bex", ".bex");
|
||||
Args->CollectFiles("-exec", ".cfg");
|
||||
Args->CollectFiles("-playdemo", ".lmp");
|
||||
Args->CollectFiles("-file", NULL); // anythnig left goes after -file
|
||||
|
||||
PClass::StaticInit ();
|
||||
atterm (C_DeinitConsole);
|
||||
|
||||
|
|
@ -1859,12 +1841,10 @@ void D_DoomMain (void)
|
|||
execFiles = new DArgs;
|
||||
GameConfig->AddAutoexec (execFiles, GameNames[gameinfo.gametype]);
|
||||
D_MultiExec (execFiles, true);
|
||||
execFiles->Destroy();
|
||||
|
||||
// Run .cfg files at the start of the command line.
|
||||
execFiles = Args->GatherFiles (NULL, ".cfg", false);
|
||||
execFiles = Args->GatherFiles ("-exec");
|
||||
D_MultiExec (execFiles, true);
|
||||
execFiles->Destroy();
|
||||
|
||||
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line
|
||||
|
||||
|
|
@ -1999,10 +1979,10 @@ void D_DoomMain (void)
|
|||
#endif
|
||||
|
||||
// turbo option // [RH] (now a cvar)
|
||||
v = Args->CheckValue("-turbo");
|
||||
if (v != NULL)
|
||||
{
|
||||
double amt;
|
||||
const char *value = Args->CheckValue("-turbo");
|
||||
amt = value != NULL ? atof(value) : 100;
|
||||
double amt = atof(v);
|
||||
Printf ("turbo scale: %.0f%%\n", amt);
|
||||
turbo = (float)amt;
|
||||
}
|
||||
|
|
@ -2082,7 +2062,7 @@ void D_DoomMain (void)
|
|||
// If there are none, try adding any in the config file.
|
||||
// Note that the command line overrides defaults from the config.
|
||||
|
||||
if ((ConsiderPatches("-deh", ".deh") | ConsiderPatches("-bex", ".bex")) == 0 &&
|
||||
if ((ConsiderPatches("-deh") | ConsiderPatches("-bex")) == 0 &&
|
||||
gameinfo.gametype == GAME_Doom && GameConfig->SetSection ("Doom.DefaultDehacked"))
|
||||
{
|
||||
const char *key;
|
||||
|
|
@ -2120,10 +2100,10 @@ void D_DoomMain (void)
|
|||
}
|
||||
|
||||
//Added by MC:
|
||||
DArgs *bots = Args->GatherFiles("-bots", "", false);
|
||||
for (p = 0; p < bots->NumArgs(); ++p)
|
||||
argcount = Args->CheckParmList("-bots", &args);
|
||||
for (p = 0; p < argcount; ++p)
|
||||
{
|
||||
bglobal.getspawned.Push(bots->GetArg(p));
|
||||
bglobal.getspawned.Push(args[p]);
|
||||
}
|
||||
bglobal.spawn_tries = 0;
|
||||
bglobal.wanted_botnum = bglobal.getspawned.Size();
|
||||
|
|
@ -2173,14 +2153,13 @@ void D_DoomMain (void)
|
|||
|
||||
V_Init2();
|
||||
|
||||
DArgs *files = Args->GatherFiles ("-playdemo", ".lmp", false);
|
||||
if (files->NumArgs() > 0)
|
||||
v = Args->CheckValue("-playdemo");
|
||||
if (v != NULL)
|
||||
{
|
||||
singledemo = true; // quit after one demo
|
||||
G_DeferedPlayDemo (files->GetArg (0));
|
||||
G_DeferedPlayDemo (v);
|
||||
D_DoomLoop (); // never returns
|
||||
}
|
||||
files->Destroy();
|
||||
|
||||
v = Args->CheckValue ("-timedemo");
|
||||
if (v)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue