本文整理汇总了C++中CG_Argv函数的典型用法代码示例。如果您正苦于以下问题:C++ CG_Argv函数的具体用法?C++ CG_Argv怎么用?C++ CG_Argv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CG_Argv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cmd_Argc
/*
=================
CG_ServerCommand
The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv()
=================
*/
static void CG_ServerCommand( void )
{
const char *cmd;
consoleCommand_t *command;
cmd = CG_Argv( 0 );
command = bsearch( cmd, svcommands, sizeof( svcommands ) /
sizeof( svcommands[ 0 ]), sizeof( svcommands[ 0 ] ),
cmdcmp );
if( command )
{
command->function( );
return;
}
CG_Printf( "Unknown client game command: %s\n", cmd );
}
示例2: Cmd_Argc
/*
=================
CG_ConsoleCommand
The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv()
=================
*/
qboolean CG_ConsoleCommand( void ) {
const char *cmd;
int i;
cmd = CG_Argv(0);
for ( i = 0 ; i < ARRAY_LEN( commands ) ; i++ ) {
if ( !Q_stricmp( cmd, commands[i].cmd ) ) {
commands[i].function();
return qtrue;
}
}
if(CG_Cutscene2d_CheckCmd(cmd))
return qtrue;
return qfalse;
}
示例3: Cmd_Argc
/*
=================
CG_ServerCommand
The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv()
=================
*/
static void CG_ServerCommand( void ) {
const char *cmd = CG_Argv( 0 );
serverCommand_t *command = NULL;
if ( !cmd[0] ) {
// server claimed the command
return;
}
command = (serverCommand_t *)Q_LinearSearch( cmd, commands, numCommands, sizeof( commands[0] ), svcmdcmp );
if ( command ) {
command->func();
return;
}
trap->Print( "Unknown client game command: %s\n", cmd );
}
示例4: CG_Rocket_InitServers
static void CG_Rocket_InitServers()
{
const char *src = CG_Argv( 1 );
trap_LAN_ResetPings( CG_StringToNetSource( src ) );
trap_LAN_ResetServerStatus();
if ( !Q_stricmp( src, "internet" ) )
{
trap_SendConsoleCommand( "globalservers 0 86 full empty\n" );
}
else if ( !Q_stricmp( src, "local" ) )
{
trap_SendConsoleCommand( "localservers\n" );
}
trap_LAN_UpdateVisiblePings( CG_StringToNetSource( src ) );
}
示例5: CG_WriteCam_f
void CG_WriteCam_f (void)
{
char text[1024];
char *targetname;
static int numCams;
numCams++;
targetname = (char *)CG_Argv(1);
if( !targetname || !targetname[0] )
{
targetname = "nameme!";
}
CG_Printf( "Camera #%d ('%s') written to: ", numCams, targetname );
sprintf( text, "//entity %d\n{\n\"classname\" \"ref_tag\"\n\"targetname\" \"%s\"\n\"origin\" \"%i %i %i\"\n\"angles\" \"%i %i %i\"\n\"fov\" \"%i\"\n}\n", numCams, targetname, (int)cg.refdef.vieworg[0], (int)cg.refdef.vieworg[1], (int)cg.refdef.vieworg[2], (int)cg.refdefViewAngles[0], (int)cg.refdefViewAngles[1], (int)cg.refdefViewAngles[2], cg_fov.integer );
gi.WriteCam( text );
}
示例6: CG_ConsoleCommand
// The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv()
qboolean CG_ConsoleCommand( void ) {
const char *cmd = NULL;
const command_t *command = NULL;
if ( JPLua_Event_ConsoleCommand() )
return qtrue;
cmd = CG_Argv( 0 );
command = (command_t *)bsearch( cmd, commands, numCommands, sizeof(commands[0]), cmdcmp );
if ( !command )
return qfalse;
if ( !command->func )
return qfalse;
command->func();
return qtrue;
}
示例7: demoSeekTwoCommand_f
static void demoSeekTwoCommand_f(void) {
const char *cmd = CG_Argv(1);
if (isdigit( cmd[0] )) {
//teh's parser for time MM:SS.MSEC, thanks *bow*
int i;
char *sec, *min;;
min = (char *)cmd;
for( i=0; min[i]!=':'&& min[i]!=0; i++ );
if(cmd[i]==0)
sec = 0;
else
{
min[i] = 0;
sec = min+i+1;
}
demo.play.time = ( atoi( min ) * 60000 + ( sec ? atof( sec ) : 0 ) * 1000 );
demo.play.fraction = 0;
}
}
示例8: CG_TestVehicle
void CG_TestVehicle (long cat) {
vec3_t angles;
int i;
if( cat != CAT_PLANE && cat != CAT_GROUND ) {
return;
}
cg.testVehicleCat = cat;
for( i = 0; i < BP_MAX_PARTS; ++i ) {
memset( &cg.testVehicleParts[i], 0, sizeof(cg.testVehicleParts[i]) );
}
if ( Cmd_Argc() < 2 ) {
return;
}
Q_strncpyz (cg.testVehicleName, CG_Argv( 1 ), MAX_QPATH );
registerTestVehicle();
/* if ( Cmd_Argc() == 3 ) {
cg.testModelEntity.backlerp = atof( CG_Argv( 2 ) );
cg.testModelEntity.frame = 1;
cg.testModelEntity.oldframe = 0;
}*/
if (! cg.testVehicleParts[0].hModel ) {
CG_Printf( "Can't register model\n" );
return;
}
angles[PITCH] = 0;
angles[YAW] = 180 + cg.refdefViewAngles[1];
angles[ROLL] = 0;
for( i = 0; i < BP_MAX_PARTS; ++i ) {
VectorMA( cg.refdef.vieworg, 100, cg.refdef.viewaxis[0], cg.testVehicleParts[i].origin );
AnglesToAxis( angles, cg.testVehicleParts[i].axis );
}
// cg.testGun = false;
}
示例9: CG_ParseTeamInfo
/*
=================
CG_ParseTeamInfo
=================
*/
static void CG_ParseTeamInfo( void )
{
int i=0, client=0;
//Raz: avoid crash if server sends invalid range
numSortedTeamPlayers = Com_Clampi( 0, TEAM_MAXOVERLAY, atoi( CG_Argv( 1 ) ) );
for ( i=0; i<numSortedTeamPlayers; i++ )
{
client = Com_Clampi( 0, MAX_CLIENTS, atoi( CG_Argv( i * 6 + 2 ) ) );
sortedTeamPlayers[i] = client;
cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 6 + 3 ) );
cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 6 + 4 ) );
cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 6 + 5 ) );
cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 6 + 6 ) );
cgs.clientinfo[ client ].powerups = atoi( CG_Argv( i * 6 + 7 ) );
}
}
示例10: CG_ParseTeamInfo
/*
=================
CG_ParseTeamInfo
=================
*/
static void CG_ParseTeamInfo( void ) {
int i;
int client;
numSortedTeamPlayers = atoi( CG_Argv( 1 ) );
for ( i = 0 ; i < numSortedTeamPlayers ; i++ ) {
client = atoi( CG_Argv( i * 6 + 2 ) );
sortedTeamPlayers[i] = client;
cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 6 + 3 ) );
cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 6 + 4 ) );
cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 6 + 5 ) );
cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 6 + 6 ) );
cgs.clientinfo[ client ].powerups = atoi( CG_Argv( i * 6 + 7 ) );
}
}
示例11: Cmd_Argc
/*
=================
CG_ConsoleCommand
The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv()
=================
*/
qboolean CG_ConsoleCommand( void )
{
consoleCommand_t *cmd;
//ZT hook
if (ZT_Command( ) == qtrue)
{
return qtrue;
}
cmd = bsearch( CG_Argv( 0 ), commands,
sizeof( commands ) / sizeof( commands[ 0 ]), sizeof( commands[ 0 ] ),
cmdcmp );
if( !cmd )
return qfalse;
cmd->function( );
return qtrue;
}
示例12: Cmd_Argc
/*
=================
CG_ConsoleCommand
The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv()
=================
*/
qboolean CG_ConsoleCommand( void ) {
const char *cmd;
int i;
// Arnout - don't allow console commands until a snapshot is present
if ( !cg.snap ) {
return qfalse;
}
cmd = CG_Argv( 0 );
for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) {
if ( !Q_stricmp( cmd, commands[i].cmd ) ) {
commands[i].function();
return qtrue;
}
}
return qfalse;
}
示例13: CG_Rocket_ProcessEvents
void CG_Rocket_ProcessEvents()
{
eventCmd_t *cmd;
std::string cmdText;
// Get the even command
while ( Rocket_GetEvent(cmdText) )
{
Cmd::PushArgs(cmdText);
cmd = (eventCmd_t*) bsearch( CG_Argv( 0 ), eventCmdList, eventCmdListCount, sizeof( eventCmd_t ), eventCmdCmp );
if ( cmd )
{
cmd->exec();
}
Cmd::PopArgs();
Rocket_DeleteEvent();
}
}
示例14: CG_Set_MFD_Page
static void CG_Set_MFD_Page( int num ) {
int page;
if( Cmd_Argc() < 2 ) {
return;
}
page = atoi( CG_Argv(1) );
if( page < 0 ) page = 0;
else if( page >= MFD_MAX ) page = MFD_MAX - 1;
cg.Mode_MFD[num] = page;
if( num == MFD_1 )
Cvar_Set( "mfd1_defaultpage", va("%d", page) );
else if( num == MFD_2 )
Cvar_Set( "mfd2_defaultpage", va("%d", page) );
}
示例15: CG_Play_f
/*
=================
CG_Play_f
=================
*/
void CG_Play_f( void ) {
int i;
int c;
sfxHandle_t h;
c = trap_Argc();
if( c < 2 ) {
Com_Printf ("Usage: play <sound filename> [sound filename] [sound filename] ...\n");
return;
}
for( i = 1; i < c; i++ ) {
h = trap_S_RegisterSound( CG_Argv( i ), qfalse );
if( h ) {
trap_S_StartLocalSound( h, CHAN_LOCAL_SOUND );
}
}
}