本文整理汇总了C++中DArgs::NumArgs方法的典型用法代码示例。如果您正苦于以下问题:C++ DArgs::NumArgs方法的具体用法?C++ DArgs::NumArgs怎么用?C++ DArgs::NumArgs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DArgs
的用法示例。
在下文中一共展示了DArgs::NumArgs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: D_AddCmdParameterFiles
//
// D_AddCmdParameterFiles
// Add the files specified with -file, do this only when it first loads
//
void D_AddCmdParameterFiles(void)
{
modifiedgame = false;
DArgs files = Args.GatherFiles ("-file", ".wad", true);
if (files.NumArgs() > 0)
{
modifiedgame = true;
for (size_t i = 0; i < files.NumArgs(); i++)
{
std::string file = BaseFileSearch (files.GetArg (i), ".WAD");
if (file.length())
wadfiles.push_back(file);
}
}
}
示例2: DoomSpecificInfo
static int DoomSpecificInfo (char *buffer, char *end)
{
const char *arg;
int size = end-buffer;
int i, p;
SDL_Quit();
p = 0;
p += snprintf (buffer+p, size-p, "Skulltag version " DOTVERSIONSTR " (" __DATE__ ")\n");
p += snprintf (buffer+p, size-p, "\nCommand line:");
for (i = 0; i < Args.NumArgs(); ++i)
{
p += snprintf (buffer+p, size-p, " %s", Args.GetArg(i));
}
p += snprintf (buffer+p, size-p, "\n");
for (i = 0; (arg = Wads.GetWadName (i)) != NULL; ++i)
{
p += snprintf (buffer+p, size-p, "\nWad %d: %s", i, arg);
}
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
{
p += snprintf (buffer+p, size-p, "\n\nNot in a level.");
}
else
{
char name[9];
strncpy (name, level.mapname, 8);
name[8] = 0;
p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", name);
if (!viewactive)
{
buffer += snprintf (buffer+p, size-p, "\n\nView not active.");
}
else
{
p += snprintf (buffer+p, size-p, "\n\nviewx = %d", (int)viewx);
p += snprintf (buffer+p, size-p, "\nviewy = %d", (int)viewy);
p += snprintf (buffer+p, size-p, "\nviewz = %d", (int)viewz);
p += snprintf (buffer+p, size-p, "\nviewangle = %x", (unsigned int)viewangle);
}
}
buffer[p++] = '\n';
buffer[p++] = '\0';
return p;
}
示例3: D_DoDefDehackedPatch
//
// D_DoDefDehackedPatch
//
// [Russell] - Change the meaning, this will load multiple patch files if
// specified
void D_DoDefDehackedPatch (const std::vector<std::string> patch_files = std::vector<std::string>())
{
DArgs files;
BOOL noDef = false;
QWORD i;
if (!patch_files.empty())
{
std::string f;
std::string ext;
// we want the extension of the file
for (i = 0; i < patch_files.size(); i++)
{
if (M_ExtractFileExtension(patch_files[i], ext))
{
f = BaseFileSearch (patch_files[i], ext);
if (f.length())
{
if (DoDehPatch (f.c_str(), false))
{
std::string Filename;
M_ExtractFileName(f, Filename);
patchfiles.push_back(Filename);
}
noDef = true;
}
}
}
}
else // [Russell] - Only load if patch_files is empty
{
// try .deh files on command line
files = Args.GatherFiles ("-deh", ".deh", false);
if (files.NumArgs())
{
for (i = 0; i < files.NumArgs(); i++)
{
std::string f = BaseFileSearch (files.GetArg (i), ".DEH");
if (f.length())
{
if (DoDehPatch (f.c_str(), false))
{
std::string Filename;
M_ExtractFileName(f, Filename);
patchfiles.push_back(Filename);
}
}
}
noDef = true;
}
// remove the old arguments
files.FlushArgs();
// try .bex files on command line
files = Args.GatherFiles ("-bex", ".bex", false);
if (files.NumArgs())
{
for (i = 0; i < files.NumArgs(); i++)
{
std::string f = BaseFileSearch (files.GetArg (i), ".BEX");
if (f.length())
{
if (DoDehPatch (f.c_str(), false))
{
std::string Filename;
M_ExtractFileName(f, Filename);
patchfiles.push_back(Filename);
}
}
}
noDef = true;
}
}
// try default patches
if (!noDef)
DoDehPatch (NULL, true); // See if there's a patch in a PWAD
}
示例4: D_DoomMain
void D_DoomMain (void)
{
M_ClearRandom();
gamestate = GS_STARTUP;
if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package.
I_FatalError ("Could not initialize LZO routines");
C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command
I_Init ();
D_CheckNetGame ();
M_LoadDefaults (); // load before initing other systems
M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in
C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line
//D_AddDefWads();
//SV_InitMultipleFiles (wadfiles);
//wadhashes = W_InitMultipleFiles (wadfiles);
// Base systems have been inited; enable cvar callbacks
cvar_t::EnableCallbacks ();
// [RH] Initialize configurable strings.
D_InitStrings ();
// [RH] User-configurable startup strings. Because BOOM does.
if (STARTUP1[0]) Printf (PRINT_HIGH, "%s\n", STARTUP1);
if (STARTUP2[0]) Printf (PRINT_HIGH, "%s\n", STARTUP2);
if (STARTUP3[0]) Printf (PRINT_HIGH, "%s\n", STARTUP3);
if (STARTUP4[0]) Printf (PRINT_HIGH, "%s\n", STARTUP4);
if (STARTUP5[0]) Printf (PRINT_HIGH, "%s\n", STARTUP5);
devparm = Args.CheckParm ("-devparm");
// get skill / episode / map from parms
strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1");
const char *val = Args.CheckValue ("-skill");
if (val)
{
skill.Set (val[0]-'0');
}
unsigned p = Args.CheckParm ("-warp");
if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1)))
{
int ep, map;
if (gameinfo.flags & GI_MAPxx)
{
ep = 1;
map = atoi (Args.GetArg(p+1));
}
else
{
ep = Args.GetArg(p+1)[0]-'0';
map = Args.GetArg(p+2)[0]-'0';
}
strncpy (startmap, CalcMapName (ep, map), 8);
autostart = true;
}
// [RH] Hack to handle +map
p = Args.CheckParm ("+map");
if (p && p < Args.NumArgs()-1)
{
strncpy (startmap, Args.GetArg (p+1), 8);
((char *)Args.GetArg (p))[0] = '-';
autostart = true;
}
if (devparm)
Printf (PRINT_HIGH, "%s", Strings[0].builtin); // D_DEVSTR
const char *v = Args.CheckValue ("-timer");
if (v)
{
double time = atof (v);
Printf (PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : "");
timelimit.Set ((float)time);
}
const char *w = Args.CheckValue ("-avg");
if (w)
{
Printf (PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n");
timelimit.Set (20);
}
// Check for -file in shareware
if (modifiedgame && (gameinfo.flags & GI_SHAREWARE))
I_FatalError ("You cannot -file with the shareware version. Register!");
// [RH] Initialize items. Still only used for the give command. :-(
InitItems ();
//.........这里部分代码省略.........
示例5: D_DoDefDehackedPatch
//
// D_DoDefDehackedPatch
//
// [Russell] - Change the meaning, this will load multiple patch files if
// specified
void D_DoDefDehackedPatch (const std::vector<std::string> patch_files = std::vector<std::string>())
{
DArgs files;
BOOL noDef = false;
BOOL chexLoaded = false;
QWORD i;
if (!patch_files.empty())
{
std::string f;
std::string ext;
// we want the extension of the file
for (i = 0; i < patch_files.size(); i++)
{
if (M_ExtractFileExtension(patch_files[i], ext))
{
f = BaseFileSearch (patch_files[i], ext);
if (f.length())
{
DoDehPatch (f.c_str(), false);
noDef = true;
}
}
}
}
else // [Russell] - Only load if patch_files is empty
{
// try .deh files on command line
files = Args.GatherFiles ("-deh", ".deh", false);
if (files.NumArgs())
{
for (i = 0; i < files.NumArgs(); i++)
{
std::string f = BaseFileSearch (files.GetArg (i), ".DEH");
if (f.length()) {
DoDehPatch (f.c_str(), false);
if (!strncmp(files.GetArg (i),"chex.deh",8))
chexLoaded = true;
}
}
noDef = true;
}
if (gamemode == retail_chex && !multiplayer && !chexLoaded)
Printf(PRINT_HIGH,"Warning: chex.deh not loaded, experience may differ from the original!\n");
// remove the old arguments
files.FlushArgs();
// try .bex files on command line
files = Args.GatherFiles ("-bex", ".bex", false);
if (files.NumArgs())
{
for (i = 0; i < files.NumArgs(); i++)
{
std::string f = BaseFileSearch (files.GetArg (i), ".BEX");
if (f.length())
DoDehPatch (f.c_str(), false);
}
noDef = true;
}
}
// try default patches
if (!noDef)
DoDehPatch (NULL, true); // See if there's a patch in a PWAD
}