您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ trap_Printf函数代码示例

51自学网 2021-06-03 08:57:57
  C++
这篇教程C++ trap_Printf函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中trap_Printf函数的典型用法代码示例。如果您正苦于以下问题:C++ trap_Printf函数的具体用法?C++ trap_Printf怎么用?C++ trap_Printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了trap_Printf函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Svcmd_BotList_f

/*===============Svcmd_BotList_f===============*/void Svcmd_BotList_f( void ) {	int i;	char name[MAX_TOKEN_CHARS];	char funname[MAX_TOKEN_CHARS];	char model[MAX_TOKEN_CHARS];	char personality[MAX_TOKEN_CHARS];	trap_Printf("^1name             model            personality              funname/n");	for (i = 0; i < g_numBots; i++) {		strcpy(name, Info_ValueForKey( g_botInfos[i], "name" ));		if ( !*name ) {			strcpy(name, "Padawan");		}		strcpy(funname, Info_ValueForKey( g_botInfos[i], "funname" ));		if ( !*funname ) {			strcpy(funname, "");		}		strcpy(model, Info_ValueForKey( g_botInfos[i], "model" ));		if ( !*model ) {			strcpy(model, "kyle/default");		}		strcpy(personality, Info_ValueForKey( g_botInfos[i], "personality"));		if (!*personality ) {			strcpy(personality, "botfiles/kyle.jkb");		}		trap_Printf(va("%-16s %-16s %-20s %-20s/n", name, model, personality, funname));	}}
开发者ID:Mattman1153,项目名称:jedi-academy,代码行数:33,


示例2: G_LoadArenasFromFile

/*===============G_LoadArenasFromFile===============*/static void G_LoadArenasFromFile(char *filename){	int len;	fileHandle_t f;	char buf[MAX_ARENAS_TEXT];	len = trap_FS_FOpenFile(filename, &f, FS_READ);	if (!f) {		trap_Printf(va(S_COLOR_RED "file not found: %s/n", filename));		return;	}	if (len >= MAX_ARENAS_TEXT) {		trap_Printf(va			    (S_COLOR_RED "file too large: %s is %i, max allowed is %i/n", filename, len,			     MAX_ARENAS_TEXT));		trap_FS_FCloseFile(f);		return;	}	trap_FS_Read(buf, len, f);	buf[len] = 0;	trap_FS_FCloseFile(f);	g_numArenas += G_ParseInfos(buf, MAX_ARENAS - g_numArenas, &g_arenaInfos[g_numArenas]);}
开发者ID:titityy,项目名称:reaction,代码行数:30,


示例3: Svcmd_BotList_f

/*===============Svcmd_BotList_f===============*/void Svcmd_BotList_f( void ) {	int i;	char name[MAX_TOKEN_CHARS];	char funname[MAX_TOKEN_CHARS];	char model[MAX_TOKEN_CHARS];	char aifile[MAX_TOKEN_CHARS];	trap_Printf("^1name             model            aifile              funname/n");	for (i = 0; i < g_numBots; i++) {		strcpy(name, Info_ValueForKey( g_botInfos[i], "name" ));		if ( !*name ) {			strcpy(name, "UnnamedPlayer");		}		strcpy(funname, Info_ValueForKey( g_botInfos[i], "funname" ));		if ( !*funname ) {			strcpy(funname, "");		}		strcpy(model, Info_ValueForKey( g_botInfos[i], "model" ));		if ( !*model ) {			strcpy(model, "sarge/default");		}		strcpy(aifile, Info_ValueForKey( g_botInfos[i], "aifile"));		if (!*aifile ) {			strcpy(aifile, "bots/default_c.c");		}		trap_Printf(va("%-16s %-16s %-20s %-20s/n", name, model, aifile, funname));	}}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:33,


示例4: G_LoadLuaScript

/*=================G_LoadLuaScript=================*/void G_LoadLuaScript(gentity_t * ent, const char *filename){	int             len;	fileHandle_t    f;	char            buf[MAX_LUAFILE];		G_Printf("...loading '%s'/n", filename);	len = trap_FS_FOpenFile(filename, &f, FS_READ);	if(!f)	{		trap_Printf(va(S_COLOR_RED "file not found: %s/n", filename));		return;	}	if(len >= MAX_LUAFILE)	{		trap_Printf(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i/n", filename, len, MAX_LUAFILE));		trap_FS_FCloseFile(f);		return;	}	trap_FS_Read(buf, len, f);	buf[len] = 0;	trap_FS_FCloseFile(f);	if(luaL_loadbuffer(g_luaState, buf, strlen(buf), filename))		G_Printf("G_RunLuaScript: cannot load lua file: %s/n", lua_tostring(g_luaState, -1));	if(lua_pcall(g_luaState, 0, 0, 0))		G_Printf("G_RunLuaScript: cannot pcall: %s/n", lua_tostring(g_luaState, -1));}
开发者ID:otty,项目名称:cake3,代码行数:37,


示例5: Svcmd_AddBot_f

/*===============Svcmd_AddBot_f===============*/void Svcmd_AddBot_f( void ) {	int				skill;	int				delay;	char			name[MAX_TOKEN_CHARS];	char			string[MAX_TOKEN_CHARS];	char			team[MAX_TOKEN_CHARS];	// are bots enabled?	if ( !bot_enable.integer ) {		return;	}	// name	trap_Argv( 1, name, sizeof( name ) );	/// read it just so we can check if it's a name (old method)	if ( name[0] && !Q_stricmp( name, "?" ) ) {		trap_Printf( "Usage: Addbot [skill 1-4] [team (RED/BLUE)] [msec delay]/n" );		return;	}	// CHRUKER: b070 - Was 'wolfbot' but this must match in case	Q_strncpyz( name, "Wolfbot", sizeof( name ) );	// RF, hard code the bots for wolf	if ( !name[0] ) {		trap_Printf( "Usage: Addbot [skill 1-4] [team (RED/BLUE)] [msec delay]/n" );		return;	}	// skill	trap_Argv( 1, string, sizeof( string ) );	if ( !string[0] ) {		trap_Cvar_Update( &bot_defaultskill );		skill = bot_defaultskill.integer;	}	else {		skill = atoi( string );	}	// team	trap_Argv( 2, team, sizeof( team ) );	// delay	trap_Argv( 3, string, sizeof( string ) );	if ( !string[0] ) {		delay = 0;	}	else {		delay = atoi( string );	}	G_AddBot( name, skill, team, NULL, 0, 0, -1, NULL, NULL, -1, NULL, qfalse);	// if this was issued during gameplay and we are playing locally,	// go ahead and load the bot's media immediately	if ( level.time - level.startTime > 1000 &&		trap_Cvar_VariableIntegerValue( "cl_running" ) ) {	}}
开发者ID:thewolfteam,项目名称:Reloaded,代码行数:60,


示例6: Svcmd_AddBot_f

/*===============Svcmd_AddBot_f===============*/void Svcmd_AddBot_f(void){	float           skill;	int             delay;	char            name[MAX_TOKEN_CHARS];	char            altname[MAX_TOKEN_CHARS];	char            string[MAX_TOKEN_CHARS];	char            team[MAX_TOKEN_CHARS];	// are bots enabled?	if(!trap_Cvar_VariableIntegerValue("bot_enable"))	{		return;	}	// name	trap_Argv(1, name, sizeof(name));	if(!name[0])	{		trap_Printf("Usage: Addbot <botname> [skill 1-5] [team] [msec delay] [altname]/n");		return;	}	// skill	trap_Argv(2, string, sizeof(string));	if(!string[0])	{		skill = 4;	}	else	{		skill = atof(string);	}	// team	trap_Argv(3, team, sizeof(team));	// delay	trap_Argv(4, string, sizeof(string));	if(!string[0])	{		delay = 0;	}	else	{		delay = atoi(string);	}	// alternative name	trap_Argv(5, altname, sizeof(altname));	G_AddBot(name, skill, team, delay, altname);	// if this was issued during gameplay and we are playing locally,	// go ahead and load the bot's media immediately	if(level.time - level.startTime > 1000 && trap_Cvar_VariableIntegerValue("cl_running"))	{		trap_SendServerCommand(-1, "loaddefered/n");	// FIXME: spelled wrong, but not changing for demo	}}
开发者ID:otty,项目名称:cake3,代码行数:65,


示例7: trap_Printf

/*===============G_GetBotInfoByNumber===============*/char *G_GetBotInfoByNumber( int num ) {	if( num < 0 || num >= g_numBots ) {		trap_Printf( va( S_COLOR_RED "Invalid bot number: %i/n", num ) );		return NULL;	}	return g_botInfos[num];}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:12,


示例8: G_LoadArenas

/*===============G_LoadArenas===============*/static void G_LoadArenas( void ) {	int			numdirs;	vmCvar_t	arenasFile;	char		filename[128];	char		dirlist[1024];	char*		dirptr;	int			i, n;	int			dirlen;	g_numArenas = 0;	trap_Cvar_Register( &arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM );	if( *arenasFile.string ) {		G_LoadArenasFromFile(arenasFile.string);	}	else {		G_LoadArenasFromFile("scripts/arenas.txt");	}	// get all arenas from .arena files	numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 1024 );	dirptr  = dirlist;	for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {		dirlen = strlen(dirptr);		strcpy(filename, "scripts/");		strcat(filename, dirptr);		G_LoadArenasFromFile(filename);	}	trap_Printf( va( "%i arenas parsed/n", g_numArenas ) );		for( n = 0; n < g_numArenas; n++ ) {		Info_SetValueForKey( g_arenaInfos[n], "num", va( "%i", n ) );	}}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:39,


示例9: G_LoadBots

/*===============G_LoadBots===============*/static void G_LoadBots( void ) {	vmCvar_t	botsFile;	int			numdirs;	char		filename[128];	char		dirlist[1024];	char*		dirptr;	int			i;	int			dirlen;	if ( !trap_Cvar_VariableIntegerValue( "bot_enable" ) ) {		return;	}	g_numBots = 0;	trap_Cvar_Register( &botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM );	if( *botsFile.string ) {		G_LoadBotsFromFile(botsFile.string);	}	else {		G_LoadBotsFromFile("scripts/bots.txt");	}	// get all bots from .bot files	numdirs = trap_FS_GetFileList("scripts", ".bot", dirlist, 1024 );	dirptr  = dirlist;	for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {		dirlen = strlen(dirptr);		strcpy(filename, "scripts/");		strcat(filename, dirptr);		G_LoadBotsFromFile(filename);	}	trap_Printf( va( "%i bots parsed/n", g_numBots ) );}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:39,


示例10: LUA_LOG

void QDECL LUA_LOG(const char *fmt, ...){	va_list         argptr;	char            buff[1024], string[1024];	int             min, tens, sec;	va_start(argptr, fmt);	Com_sprintf(buff, sizeof(buff), fmt, argptr);	va_end(argptr);	if(g_dedicated.integer)	{		trap_Printf(buff);	}	if(level.logFile)	{		sec = level.time / 1000;		min = sec / 60;		sec -= min * 60;		tens = sec / 10;		sec -= tens * 10;		Com_sprintf(string, sizeof(string), "%i:%i%i %s", min, tens, sec, buff);		trap_FS_Write(string, strlen(string), level.logFile);	}}
开发者ID:gitter-badger,项目名称:rpgxEF,代码行数:28,


示例11: G_LoadBots

/*===============G_LoadBots===============*/static void G_LoadBots(void){	int          len;	char         *filename;	vmCvar_t     botsFile;	fileHandle_t f;	char         buf[MAX_BOTS_TEXT];	if (!bot_enable.integer)	{		return;	}	trap_Cvar_Register(&botsFile, "g_botsFile", "", CVAR_INIT | CVAR_ROM);	if (*botsFile.string)	{		filename = botsFile.string;	}	else	{		filename = "scripts/bots.txt";	}	len = trap_FS_FOpenFile(filename, &f, FS_READ);	if (!f)	{		trap_Printf(va(S_COLOR_RED "file not found: %s/n", filename));		return;	}	if (len >= MAX_BOTS_TEXT)	{		trap_Printf(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT));		trap_FS_FCloseFile(f);		return;	}	trap_FS_Read(buf, len, f);	buf[len] = 0;	trap_FS_FCloseFile(f);	g_numBots = Com_ParseInfos(buf, MAX_BOTS, g_botInfos);	trap_Printf(va("%i bots parsed/n", g_numBots));	// load bot script	Bot_ScriptLoad();}
开发者ID:morsik,项目名称:war-territory,代码行数:51,


示例12: G_LoadArenas

/*===============G_LoadArenas===============*/static void G_LoadArenas(void){#ifdef QUAKESTUFF	int          len;	char         *filename;	vmCvar_t     arenasFile;	fileHandle_t f;	int          n;	char         buf[MAX_ARENAS_TEXT];	trap_Cvar_Register(&arenasFile, "g_arenasFile", "", CVAR_INIT | CVAR_ROM);	if (*arenasFile.string)	{		filename = arenasFile.string;	}	else	{		filename = "scripts/arenas.txt";	}	len = trap_FS_FOpenFile(filename, &f, FS_READ);	if (!f)	{		trap_Printf(va(S_COLOR_RED "file not found: %s/n", filename));		return;	}	if (len >= MAX_ARENAS_TEXT)	{		trap_Printf(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT));		trap_FS_FCloseFile(f);		return;	}	trap_FS_Read(buf, len, f);	buf[len] = 0;	trap_FS_FCloseFile(f);	g_numArenas = Com_ParseInfos(buf, MAX_ARENAS, g_arenaInfos);	trap_Printf(va("%i arenas parsed/n", g_numArenas));	for (n = 0; n < g_numArenas; n++)	{		Info_SetValueForKey(g_arenaInfos[n], "num", va("%i", n));	}#endif}
开发者ID:morsik,项目名称:war-territory,代码行数:51,


示例13: G_Printf

void QDECL G_Printf( const char *fmt, ... ) {	va_list		argptr;	char		text[1024];	va_start (argptr, fmt);	Q_vsnprintf (text, sizeof(text), fmt, argptr);	va_end (argptr);	trap_Printf( text );}
开发者ID:BrendanCoughran,项目名称:ioquake3,代码行数:10,


示例14: G_refPrintf

void G_refPrintf( gentity_t* ent, const char *fmt, ... ){	va_list		argptr;	char		text[1024];	va_start (argptr, fmt);	Q_vsnprintf (text, sizeof(text), fmt, argptr);	va_end (argptr);	if(ent == NULL) trap_Printf(text);	else CP(va("cpm /"%s/n/"", text));}
开发者ID:GenaSG,项目名称:ET,代码行数:12,


示例15: baseq3_qagame_vmMain

int baseq3_qagame_vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  ) {#elseint vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  ) {#endif // IOS	switch ( command ) {	case GAME_INIT:		G_InitGame( arg0, arg1, arg2 );		return 0;	case GAME_SHUTDOWN:		G_ShutdownGame( arg0 );		return 0;	case GAME_CLIENT_CONNECT:		return (int)ClientConnect( arg0, arg1, arg2 );	case GAME_CLIENT_THINK:		ClientThink( arg0 );		return 0;	case GAME_CLIENT_USERINFO_CHANGED:		ClientUserinfoChanged( arg0 );		return 0;	case GAME_CLIENT_DISCONNECT:		ClientDisconnect( arg0 );		return 0;	case GAME_CLIENT_BEGIN:		ClientBegin( arg0 );		return 0;	case GAME_CLIENT_COMMAND:		ClientCommand( arg0 );		return 0;	case GAME_RUN_FRAME:		G_RunFrame( arg0 );		return 0;	case GAME_CONSOLE_COMMAND:		return ConsoleCommand();	case BOTAI_START_FRAME:		return BotAIStartFrame( arg0 );	}	return -1;}void QDECL G_Printf( const char *fmt, ... ) {	va_list		argptr;	char		text[1024];	va_start (argptr, fmt);	vsprintf (text, fmt, argptr);	va_end (argptr);	trap_Printf( text );}
开发者ID:he110world,项目名称:quake3-ios,代码行数:51,


示例16: Svcmd_RemoveBot_f

/*TDF - Mad Doc===============Svcmd_RemoveBot_f===============*/void Svcmd_RemoveBot_f( void ) {	char			name[MAX_TOKEN_CHARS];	// are bots enabled?	if ( !bot_enable.integer ) {		return;	}	// name	trap_Argv( 1, name, sizeof( name ) );	/// read it just so we can check if it's a name (old method)	if ( !name[0] ) {		trap_Printf( "Usage: Removebot name/n" );		return;	}	G_RemoveNamedBot(name);}
开发者ID:GenaSG,项目名称:ET,代码行数:23,


示例17: G_refPrintf

void G_refPrintf( gentity_t* ent, const char *fmt, ... ){	va_list		argptr;	char		text[1024];	va_start (argptr, fmt);	Q_vsnprintf (text, sizeof(text), fmt, argptr);	va_end (argptr);	// CHRUKER: b046 - Added the linebreak to the string.	if(ent == NULL){		// yada - in server console color codes look stupid		ConsolizeString(text,text);		trap_Printf(va("%s/n",text));	}else{		// CHRUKER: b046 - Was using the cpm command, but this is really just for the console.		CP(va("print /"%s/n/"", text));	}}
开发者ID:thewolfteam,项目名称:Reloaded,代码行数:18,


示例18: LOG

void QDECL LOG(const char *fmt, ...){	va_list         argptr;	char            buff[1024], string[1024];	int             min, tens, sec;	va_start(argptr, fmt);	Q_vsnprintf(buff, sizeof(buff), fmt, argptr);	va_end(argptr);	if(g_dedicated.integer)	{		trap_Printf(buff);	}	if(level.logFile)	{		/* xreal		if ( g_logOptions.integer & LOGOPTS_REALTIME ) {			Com_sprintf(string, sizeof(string), "%s %s", G_GetRealTime(), buff);		} else {		*/			sec = level.time / 1000;			min = sec / 60;			sec -= min * 60;			tens = sec / 10;			sec -= tens * 10;			Com_sprintf(string, sizeof(string), "%i:%i%i %s", min, tens, sec, buff);		/* xreal		}		*/		trap_FS_Write(string, strlen(string), level.logFile);	}}
开发者ID:redrumrobot,项目名称:dretchstorm,代码行数:36,


示例19: G_AddBot

//.........这里部分代码省略.........            if ( color ) {                if ( strrchr( model, '/' ) ) {                    // model is a skin already, append colorname to skin                    // fatpad/fatty _red                    model = va( "%s_%s", model, color );                }                else {                    // model is a "basemodel", append skin                    // fatpad /red                    model = va( "%s/%s", model, color );                }            }        }    }    Info_SetValueForKey( userinfo, key, model );    key = "team_model";    Info_SetValueForKey( userinfo, key, model );    key = "headmodel";    headmodel = Info_ValueForKey( botinfo, key );    if ( !*headmodel ) {        headmodel = model;    }    Info_SetValueForKey( userinfo, key, headmodel );    key = "team_headmodel";    Info_SetValueForKey( userinfo, key, headmodel );    key = "gender";    s = Info_ValueForKey( botinfo, key );    if ( !*s ) {        s = "male";    }    Info_SetValueForKey( userinfo, "sex", s );    key = "color1";    s = Info_ValueForKey( botinfo, key );    if ( !*s ) {        s = "4";    }    Info_SetValueForKey( userinfo, key, s );    key = "color2";    s = Info_ValueForKey( botinfo, key );    if ( !*s ) {        s = "5";    }    Info_SetValueForKey( userinfo, key, s );    s = Info_ValueForKey(botinfo, "aifile");    if (!*s ) {        trap_Printf( S_COLOR_RED "Error: bot has no aifile specified/n" );        return;    }    // have the server allocate a client slot    clientNum = trap_BotAllocateClient();    if ( clientNum == -1 ) {        G_Printf( S_COLOR_RED "Unable to add bot.  All player slots are in use./n" );        G_Printf( S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar)./n" );        return;    }    // initialize the bot settings    if( !team || !*team ) {        if( g_gametype.integer >= GT_TEAM ) {            if( PickTeam(clientNum) == TEAM_RED) {                team = "red";            }            else {                team = "blue";            }        }        else {            team = "red";        }    }    Info_SetValueForKey( userinfo, "characterfile", Info_ValueForKey( botinfo, "aifile" ) );    Info_SetValueForKey( userinfo, "skill", va( "%5.2f", skill ) );    Info_SetValueForKey( userinfo, "team", team );    bot = &g_entities[ clientNum ];    bot->r.svFlags |= SVF_BOT;    bot->inuse = qtrue;    // register the userinfo    trap_SetUserinfo( clientNum, userinfo );    // have it connect to the game as a normal client    if ( ClientConnect( clientNum, qtrue, qtrue ) ) {        return;    }    if( delay == 0 ) {        ClientBegin( clientNum );        return;    }    AddBotToSpawnQueue( clientNum, delay );}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:101,


示例20: G_AddBot

/*===============G_AddBot===============*/static void G_AddBot( const char *name, float skill, const char *team, int delay, char *altname) {	int				clientNum;	char			*botinfo;	gentity_t		*bot;	char			*key;	char			*s;	char			*botname;	char			*model;	char			*headmodel;	char			userinfo[MAX_INFO_STRING];	// get the botinfo from bots.txt	botinfo = G_GetBotInfoByName( name );	if ( !botinfo ) {                G_Printf( S_COLOR_RED "Error: Bot '%s' not defined/n", name );		return;	}	// create the bot's userinfo	userinfo[0] = '/0';	botname = Info_ValueForKey( botinfo, "funname" );	if( !botname[0] ) {		botname = Info_ValueForKey( botinfo, "name" );	}	// check for an alternative name	if (altname && altname[0]) {		botname = altname;	}	Info_SetValueForKey( userinfo, "name", botname );	Info_SetValueForKey( userinfo, "rate", "25000" );	Info_SetValueForKey( userinfo, "snaps", "20" );	Info_SetValueForKey( userinfo, "skill", va("%1.2f", skill) );	if ( skill >= 1 && skill < 2 ) {		Info_SetValueForKey( userinfo, "handicap", "50" );	}	else if ( skill >= 2 && skill < 3 ) {		Info_SetValueForKey( userinfo, "handicap", "70" );	}	else if ( skill >= 3 && skill < 4 ) {		Info_SetValueForKey( userinfo, "handicap", "90" );	}	key = "model";	model = Info_ValueForKey( botinfo, key );	if ( !*model ) {		model = "sarge/default";	}	Info_SetValueForKey( userinfo, key, model );	key = "team_model";	Info_SetValueForKey( userinfo, key, model );	key = "headmodel";	headmodel = Info_ValueForKey( botinfo, key );	if ( !*headmodel ) {		headmodel = model;	}	Info_SetValueForKey( userinfo, key, headmodel );	key = "team_headmodel";	Info_SetValueForKey( userinfo, key, headmodel );	key = "gender";	s = Info_ValueForKey( botinfo, key );	if ( !*s ) {		s = "male";	}	Info_SetValueForKey( userinfo, "sex", s );	key = "color1";	s = Info_ValueForKey( botinfo, key );	if ( !*s ) {		s = "4";	}	Info_SetValueForKey( userinfo, key, s );	key = "color2";	s = Info_ValueForKey( botinfo, key );	if ( !*s ) {		s = "5";	}	Info_SetValueForKey( userinfo, key, s );	s = Info_ValueForKey(botinfo, "aifile");	if (!*s ) {		trap_Printf( S_COLOR_RED "Error: bot has no aifile specified/n" );		return;	}	// have the server allocate a client slot	clientNum = trap_BotAllocateClient();	if ( clientNum == -1 ) {                G_Printf( S_COLOR_RED "Unable to add bot.  All player slots are in use./n" );                G_Printf( S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar)./n" );                return;//.........这里部分代码省略.........
开发者ID:OpenArena,项目名称:leixperimental,代码行数:101,


示例21: G_AddBot

/*===============G_AddBot===============*/static void G_AddBot(const char *name, float skill, const char *team, int delay, char *altname){	int clientNum;	char *botinfo;	gentity_t *bot;	char *s;	char *botname;	char *model;	char *headmodel;	char userinfo[MAX_INFO_STRING];	weapon_t tpWeapon = WP_M4;	holdable_t tpItem = HI_LASER;	// get the botinfo from bots.txt	botinfo = G_GetBotInfoByName(name);	if (!botinfo) {		G_Printf(S_COLOR_RED "Error: Bot '%s' not defined/n", name);		return;	}	// create the bot's userinfo	userinfo[0] = '/0';	botname = Info_ValueForKey(botinfo, "funname");	if (!botname[0]) {		botname = Info_ValueForKey(botinfo, "name");	}	// check for an alternative name	if (altname && altname[0]) {		botname = altname;	}	Info_SetValueForKey(userinfo, "name", botname);	Info_SetValueForKey(userinfo, "rate", "25000");	Info_SetValueForKey(userinfo, "snaps", "20");	Info_SetValueForKey(userinfo, "skill", va("%1.2f", skill));	if (skill >= 1 && skill < 2) {		Info_SetValueForKey(userinfo, "handicap", "50");	} else if (skill >= 2 && skill < 3) {		Info_SetValueForKey(userinfo, "handicap", "70");	} else if (skill >= 3 && skill < 4) {		Info_SetValueForKey(userinfo, "handicap", "90");	}	model = Info_ValueForKey(botinfo, "model");	if (!*model) {		// Elder: changed to our default		model = "reactionmale/default";	}	Info_SetValueForKey(userinfo, "model", model);	Info_SetValueForKey(userinfo, "team_model", model);	headmodel = Info_ValueForKey(botinfo, "headmodel");	if (!*headmodel) {		headmodel = model;	}	Info_SetValueForKey(userinfo, "headmodel", headmodel);	Info_SetValueForKey(userinfo, "team_headmodel", headmodel);	s = Info_ValueForKey(botinfo, "gender");	if (!*s) {		s = "male";	}	Info_SetValueForKey(userinfo, "sex", s);	s = Info_ValueForKey(botinfo, "color1");	if (!*s) {		s = "4";	}	Info_SetValueForKey(userinfo, "color1", s);	s = Info_ValueForKey(botinfo, "color2");	if (!*s) {		s = "5";	}	Info_SetValueForKey(userinfo, "color2", s);	s = Info_ValueForKey(botinfo, "aifile");	if (!*s) {		trap_Printf(S_COLOR_RED "Error: bot has no aifile specified/n");		return;	}	// have the server allocate a client slot	clientNum = trap_BotAllocateClient();	if (clientNum == -1) {		G_Printf(S_COLOR_RED "Unable to add bot.  All player slots are in use./n");		G_Printf(S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar)./n");		return;	}	// initialize the bot settings	if (!team || !*team) {		if (g_gametype.integer >= GT_TEAM) {			if (PickTeam(clientNum) == TEAM_RED) {//.........这里部分代码省略.........
开发者ID:titityy,项目名称:reaction,代码行数:101,


示例22: G_AddBot

static void G_AddBot( const char *name, int skill, const char *team, const char *spawnPoint, int playerClass, int playerWeapon, int characerIndex, const char *respawn, const char *scriptName, int rank, int skills[], qboolean pow ) {#define	MAX_BOTNAMES 1024	int				clientNum;	char			*botinfo;	gentity_t		*bot;	char			*key;	char			*s;	char			*botname;//	char			*model;	char			userinfo[MAX_INFO_STRING];	// get the botinfo from bots.txt	botinfo = G_GetBotInfoByName( "wolfbot" );	if ( !botinfo ) {		G_Printf( S_COLOR_RED "Error: Bot '%s' not defined/n", name );		return;	}	// create the bot's userinfo	userinfo[0] = '/0';	botname = Info_ValueForKey( botinfo, "funname" );	if( !botname[0] ) {		botname = Info_ValueForKey( botinfo, "name" );	}	Info_SetValueForKey( userinfo, "name", botname );	Info_SetValueForKey( userinfo, "rate", "25000" );	Info_SetValueForKey( userinfo, "snaps", "20" );	Info_SetValueForKey( userinfo, "skill", va("%i", skill) );	s = Info_ValueForKey(botinfo, "aifile");	if (!*s ) {		trap_Printf( S_COLOR_RED "Error: bot has no aifile specified/n" );		return;	}	// have the server allocate a client slot	clientNum = trap_BotAllocateClient( 0 );	// Arnout: 0 means no prefered clientslot	if ( clientNum == -1 ) {		G_Printf( S_COLOR_RED "Unable to add bot.  All player slots are in use./n" );		G_Printf( S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar)./n" );		return;	}	// initialize the bot settings	if( !team || !*team ) {		if( PickTeam(clientNum) == TEAM_AXIS) {			team = "red";		} else {			team = "blue";		}	}	Info_SetValueForKey( userinfo, "characterfile", Info_ValueForKey( botinfo, "aifile" ) );	//Info_SetValueForKey( userinfo, "skill", va( "%i", skill ) );	Info_SetValueForKey( userinfo, "team", team );	if( spawnPoint && spawnPoint[0] ) {		Info_SetValueForKey( userinfo, "spawnPoint", spawnPoint );	}	if (scriptName && scriptName[0]) {		Info_SetValueForKey( userinfo, "scriptName", scriptName );	}/*	if (playerClass > 0) {		Info_SetValueForKey( userinfo, "pClass", va("%i", playerClass) );	}	if (playerWeapon) {		Info_SetValueForKey( userinfo, "pWeapon", va("%i", playerWeapon) );	}*/	// END Mad Doc - TDF	key = "wolfbot";	if (!Q_stricmp( (char *)name, key )) {		// read the botnames file, and pick a name that doesnt exist		fileHandle_t f;		int len, i, j, k;		qboolean setname = qfalse;		char botnames[8192], *pbotnames, *listbotnames[MAX_BOTNAMES], *token, *oldpbotnames;		int	lengthbotnames[MAX_BOTNAMES];		len = trap_FS_FOpenFile( "botfiles/botnames.txt", &f, FS_READ );		if (len >= 0) {			if (len > sizeof(botnames)) {				G_Error( "botfiles/botnames.txt is too big (max = %i)", (int)sizeof(botnames) );			}			memset( botnames, 0, sizeof(botnames) );			trap_FS_Read( botnames, len, f );			pbotnames = botnames;			// read them in			i = 0;			oldpbotnames = pbotnames;			while ((token = COM_Parse( &pbotnames ))) {				if (!token[0]) break;				listbotnames[i] = strstr( oldpbotnames, token );				lengthbotnames[i] = strlen(token);				listbotnames[i][lengthbotnames[i]] = 0;				oldpbotnames = pbotnames;//.........这里部分代码省略.........
开发者ID:GenaSG,项目名称:ET,代码行数:101,



注:本文中的trap_Printf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ trap_R_AddLightToScene函数代码示例
C++ trap_Print函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。