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

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

51自学网 2021-06-01 20:12:34
  C++
这篇教程C++ Com_Printf函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CL_UISystemCalls

intptr_t CL_UISystemCalls( intptr_t *args ) {	switch( args[0] ) {	//rww - alright, DO NOT EVER add a GAME/CGAME/UI generic call without adding a trap to match, and	//all of these traps must be shared and have cases in sv_game, cl_cgame, and cl_ui. They must also	//all be in the same order, and start at 100.	case TRAP_MEMSET:		Com_Memset( VMA(1), args[2], args[3] );		return 0;	case TRAP_MEMCPY:		Com_Memcpy( VMA(1), VMA(2), args[3] );		return 0;	case TRAP_STRNCPY:		return (int)strncpy( (char *)VMA(1), (const char *)VMA(2), args[3] );	case TRAP_SIN:		return FloatAsInt( sin( VMF(1) ) );	case TRAP_COS:		return FloatAsInt( cos( VMF(1) ) );	case TRAP_ATAN2:		return FloatAsInt( atan2( VMF(1), VMF(2) ) );	case TRAP_SQRT:		return FloatAsInt( sqrt( VMF(1) ) );	case TRAP_MATRIXMULTIPLY:		MatrixMultiply( (vec3_t *)VMA(1), (vec3_t *)VMA(2), (vec3_t *)VMA(3) );		return 0;	case TRAP_ANGLEVECTORS:		AngleVectors( (const float *)VMA(1), (float *)VMA(2), (float *)VMA(3), (float *)VMA(4) );		return 0;	case TRAP_PERPENDICULARVECTOR:		PerpendicularVector( (float *)VMA(1), (const float *)VMA(2) );		return 0;	case UI_ERROR:		Com_Error( ERR_DROP, "%s", VMA(1) );		return 0;	case UI_PRINT:		Com_Printf( "%s", VMA(1) );		return 0;	case UI_MILLISECONDS:		return Sys_Milliseconds();	case UI_CVAR_REGISTER:		Cvar_Register( (vmCvar_t *)VMA(1), (const char *)VMA(2), (const char *)VMA(3), args[4] ); 		return 0;	case UI_CVAR_UPDATE:		Cvar_Update( (vmCvar_t *)VMA(1) );		return 0;	case UI_CVAR_SET:		Cvar_Set( (const char *)VMA(1), (const char *)VMA(2) );		return 0;	case UI_CVAR_VARIABLEVALUE:		return FloatAsInt( Cvar_VariableValue( (const char *)VMA(1) ) );	case UI_CVAR_VARIABLESTRINGBUFFER:		Cvar_VariableStringBuffer( (const char *)VMA(1), (char *)VMA(2), args[3] );		return 0;	case UI_CVAR_SETVALUE:		Cvar_SetValue( (const char *)VMA(1), VMF(2) );		return 0;	case UI_CVAR_RESET:		Cvar_Reset( (const char *)VMA(1) );		return 0;	case UI_CVAR_CREATE:		Cvar_Get( (const char *)VMA(1), (const char *)VMA(2), args[3] );		return 0;	case UI_CVAR_INFOSTRINGBUFFER:		Cvar_InfoStringBuffer( args[1], (char *)VMA(2), args[3] );		return 0;	case UI_ARGC:		return Cmd_Argc();	case UI_ARGV:		Cmd_ArgvBuffer( args[1], (char *)VMA(2), args[3] );		return 0;	case UI_CMD_EXECUTETEXT:		Cbuf_ExecuteText( args[1], (const char *)VMA(2) );		return 0;	case UI_FS_FOPENFILE:		return FS_FOpenFileByMode( (const char *)VMA(1), (int *)VMA(2), (fsMode_t)args[3] );	case UI_FS_READ:		FS_Read2( VMA(1), args[2], args[3] );		return 0;	case UI_FS_WRITE:		FS_Write( VMA(1), args[2], args[3] );		return 0;//.........这里部分代码省略.........
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:101,


示例2: ASTAR_FindPathFast

//.........这里部分代码省略.........						/*						float height_diff = 0.0f;						float cost = 0.0f;						cost = Distance(gWPArray[newnode]->origin, gWPArray[atNode]->origin);						height_diff = HeightDistance(gWPArray[newnode]->origin, gWPArray[atNode]->origin);						cost += (height_diff * height_diff); // Squared for massive preferance to staying at same plane...						gWPArray[atNode]->neighbors[i].cost = cost;						gc += cost;						*/					}					if ( gc < gcost[newnode] )				//if the new gcost is less (ie, this path is shorter than what we had before)					{						parent[newnode] = atNode;			//set the new parent for this node						gcost[newnode] = gc;				//and the new g cost						for ( j = 1; j < numOpen; j++ )		//loop through all the items on the open list						{							if ( openlist[j] == newnode )	//find this node in the list							{								//calculate the new fcost and store it								fcost[newnode] = BOT_GetFCost( bot, to, newnode, parent[newnode], gcost );								//reorder the list again, with the lowest fcost item on top								m = j;								while ( m != 1 )								{									if ( fcost[openlist[m]] < fcost[openlist[m / 2]] )	//if the item has a lower fcost than it's parent									{										temp = openlist[m / 2];										openlist[m / 2] = openlist[m];										openlist[m] = temp;								//swap them										m /= 2;									}									else									{										break;									}								}								break;													//exit the 'for' loop because we already changed this node							}															//if						}																//for					}											//if (gc < gcost[newnode])				}												//if (list[newnode] != 1) --> else			}													//for (loop through links)		}														//if (numOpen != 0)		else		{			found = qfalse;										//there is no path between these nodes			break;		}		if ( list[to] == 1 )									//if the destination node is on the open list, we're done		{			found = qtrue;			break;		}	}															//while (1)	if ( found == qtrue )							//if we found a path, and are trying to store the pathlist...	{		count = 0;		temp = to;												//start at the end point		while ( temp != from )									//travel along the path (backwards) until we reach the starting point		{			if (count+1 >= MAX_WPARRAY_SIZE)			{				Com_Printf("ERROR: pathlist count > MAX_WPARRAY_SIZE./n");				return -1; // UQ1: Added to stop crash if path is too long for the memory allocation...			}			pathlist[count++] = temp;							//add the node to the pathlist and increment the count			temp = parent[temp];								//move to the parent of this node to continue the path		}		pathlist[count++] = from;								//add the beginning node to the end of the pathlist#ifdef __SLOW_PATHING__		if (shorten)		{// UQ1: Now use the path shortener on these waypoints...			int pathlist_copy[MAX_WPARRAY_SIZE];			memcpy(pathlist_copy, pathlist, sizeof(int)*(MAX_WPARRAY_SIZE));			count = ASTAR_ShortenPath(count, pathlist_copy, pathlist);		}#endif //__SLOW_PATHING__		//G_Printf("Pathsize is %i./n", count);		return ( count );	}	//G_Printf("Failed to find path./n");	return ( -1 );											//return the number of nodes in the path, -1 if not found}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:101,


示例3: Sys_GetPacket

bool Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {	int 	ret;	struct sockaddr from;	int		fromlen;	int		net_socket;	int		protocol;	int		err;	for( protocol = 0 ; protocol < 2 ; protocol++ )	{		if( protocol == 0 ) {			net_socket = ip_socket;		}		else {			net_socket = ipx_socket;		}		if( !net_socket ) {			continue;		}		fromlen = sizeof(from);		recvfromCount++;		// performance check		ret = recvfrom( net_socket, reinterpret_cast<char*>(net_message->data), net_message->maxsize, 0, (struct sockaddr *)&from, &fromlen );		if (ret == SOCKET_ERROR)		{			err = WSAGetLastError();			if( err == WSAEWOULDBLOCK || err == WSAECONNRESET ) {				continue;			}			Com_Printf( "NET_GetPacket: %s/n", NET_ErrorString() );			continue;		}		if ( net_socket == ip_socket ) {			memset( ((struct sockaddr_in *)&from)->sin_zero, 0, 8 );		}		if ( usingSocks && net_socket == ip_socket && memcmp( &from, &socksRelayAddr, fromlen ) == 0 ) {			if ( ret < 10 || net_message->data[0] != 0 || net_message->data[1] != 0 || net_message->data[2] != 0 || net_message->data[3] != 1 ) {				continue;			}			net_from->type = NA_IP;			net_from->ip[0] = net_message->data[4];			net_from->ip[1] = net_message->data[5];			net_from->ip[2] = net_message->data[6];			net_from->ip[3] = net_message->data[7];			net_from->port = *(short *)&net_message->data[8];			net_message->readcount = 10;		}		else {			SockadrToNetadr( &from, net_from );			net_message->readcount = 0;		}		if( ret == net_message->maxsize ) {			Com_Printf( "Oversize packet from %s/n", NET_AdrToString (*net_from) );			continue;		}		net_message->cursize = ret;		return true;	}	return false;}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:66,


示例4: UI_RegisterClientModelname

//.........这里部分代码省略.........			if(teamval == 1)			{				backpack = "acc/backpack/backpack_cvops.md3";				helmet = "acc/helmet_american/cvops.md3";			}			else			{				backpack = "acc/backpack/backpack_german_cvops.md3";				helmet = "acc/helmet_german/helmet_cvops.md3";			}		}		else		{			playerClass = "lieutenant";			if(teamval == 1)			{				backpack = "acc/backpack/backpack_lieu.md3";				helmet = "acc/helmet_american/lieu.md3";			}			else			{				backpack = "acc/backpack/backpack_german_lieu.md3";				helmet = "acc/helmet_german/helmet_leiu.md3";			}		}		strcpy(skinName, va("%s%s1", team, playerClass));	}	// -NERVE - SMF//      Q_strncpyz( skinName, "bluesoldier1", sizeof( skinName ) );     // NERVE - SMF - make this work with wolf - TESTING!!!//  }//  else {//      Q_strncpyz( skinName, "redsoldier1", sizeof( skinName ) );      // NERVE - SMF - make this work with wolf - TESTING!!!//  }	// load cmodels before models so filecache works//  Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );	Com_sprintf(filename, sizeof(filename), "models/players/%s/body.mds", modelName);	// NERVE - SMF - make this work with wolf	pi->legsModel = trap_R_RegisterModel(filename);	if(!pi->legsModel)	{		Com_Printf("Failed to load model file %s/n", filename);		return qfalse;	}//  Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );	Com_sprintf(filename, sizeof(filename), "models/players/%s/body.mds", modelName);	// NERVE - SMF - make this work with wolf	pi->torsoModel = trap_R_RegisterModel(filename);	if(!pi->torsoModel)	{		Com_Printf("Failed to load model file %s/n", filename);		return qfalse;	}	Com_sprintf(filename, sizeof(filename), "models/players/%s/head.md3", modelName);	pi->headModel = trap_R_RegisterModel(filename);	if(!pi->headModel)	{		Com_Printf("Failed to load model file %s/n", filename);		return qfalse;	}	// NERVE - SMF - load backpack and helmet	if(backpack)	{		pi->backpackModel = trap_R_RegisterModel(va("models/players/%s/%s", modelName, backpack));	}	if(helmet)	{		pi->helmetModel = trap_R_RegisterModel(va("models/players/%s/%s", modelName, helmet));	}	// if any skins failed to load, fall back to default	if(!UI_RegisterClientSkin(pi, modelName, skinName))	{		if(!UI_RegisterClientSkin(pi, modelName, "default"))		{			Com_Printf("Failed to load skin file: %s : %s/n", modelName, skinName);			return qfalse;		}	}	// load the animations//----(SA) changing name of config file to avoid backwards or alternate compatibility confustion//  Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );	Com_sprintf(filename, sizeof(filename), "models/players/%s/wolfanim.cfg", modelName);//----(SA) end	if(!UI_ParseAnimationFile(filename, pi))	{							// NERVE - SMF - make this work with wolf		Com_Printf("Failed to load animation file %s/n", filename);		return qfalse;	}	return qtrue;}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:101,


示例5: FF_Stop

void FF_Stop(ffFX_e effect){	Com_Printf("FF_Stop: Please implement fffx_id = %i/n",effect);	// Do nothing}
开发者ID:Drakesinger,项目名称:jediacademypc,代码行数:5,


示例6: FF_Play

//.........这里部分代码省略.........	case fffx_WindGust:	case fffx_WindShear:	case fffx_Pistol:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 2, true);		if (s != -1)		{			IN_AddRumbleState(s, 50000, 10000, 200);			IN_AddRumbleState(s, 0, 0, 10);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_Shotgun:	case fffx_Laser1:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 2, true);		if (s != -1)		{			IN_AddRumbleState(s, 32000, 32000, 75);			IN_AddRumbleState(s, 0, 0, 15);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_Laser2:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 2, true);		if (s != -1)		{			IN_AddRumbleState(s, 25000, 25000, 75);			IN_AddRumbleState(s, 0, 0, 10);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_Laser3:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 2, true);		if (s != -1)		{			IN_AddRumbleState(s, 35000, 35000, 100);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_Laser4:	case fffx_Laser5:	case fffx_Laser6:	case fffx_OutOfAmmo:	case fffx_LightningGun:	case fffx_Missile:	case fffx_GatlingGun:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 2, true);		if (s != -1)		{			IN_AddRumbleState(s, 39000, 0, 220);			IN_AddRumbleState(s, 0, 0, 10);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_ShortPlasma:	case fffx_PlasmaCannon1:	case fffx_PlasmaCannon2:	case fffx_Cannon:	case fffx_FallingShort:	case fffx_FallingMedium:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 1, true);		if (s != -1)		{			IN_AddRumbleState(s, 25000,10000, 230);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_FallingFar:		s = IN_CreateRumbleScript(ClientManager::ActiveController(), 1, true);		if (s != -1)		{			IN_AddRumbleState(s, 32000,10000, 230);			IN_ExecuteRumbleScript(s);		}		break;	case fffx_StartConst:		client = ClientManager::ActiveClientNum();		if(const_rumble[client] == -1)		{			const_rumble[client] = IN_CreateRumbleScript(ClientManager::ActiveController(), 4, true);			if (const_rumble[client] != -1)			{				IN_AddEffectFade4(const_rumble[client], 0,0, 50000, 50000, 1000);				//IN_AddRumbleState(const_rumble[client], 50000, 0, 300);				//IN_AddEffectFade4(const_rumble[client], 50000,50000, 0, 0, 1000);				IN_ExecuteRumbleScript(const_rumble[client]);			}		}		break;	case fffx_StopConst:		client = ClientManager::ActiveClientNum();		if (const_rumble[client] == -1)			return;		IN_KillRumbleScript(const_rumble[client]);		const_rumble[client] = -1;		break;	default:		Com_Printf("No rumble script is defined for fffx_id = %i/n",effect);		break;	}}
开发者ID:Drakesinger,项目名称:jediacademypc,代码行数:101,


示例7: Netchan_Process

/*=================Netchan_ProcessReturns qfalse if the message should not be processed due to beingout of order or a fragment.Msg must be large enough to hold MAX_MSGLEN, because if this is thefinal fragment of a multi-part message, the entire thing will becopied out.=================*/qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) {	int			sequence, sequence_ack;	//int			qport;	int			fragmentStart, fragmentLength;	qboolean	fragmented;	// get sequence numbers			MSG_BeginReading( msg );	sequence = MSG_ReadLong( msg );	sequence_ack = MSG_ReadLong( msg );	// check for fragment information	if ( sequence & FRAGMENT_BIT ) {		sequence &= ~FRAGMENT_BIT;		fragmented = qtrue;	} else {		fragmented = qfalse;	}	// read the qport if we are a server	if ( chan->sock == NS_SERVER ) {		/*qport = */MSG_ReadShort( msg );	}	// read the fragment information	if ( fragmented ) {		fragmentStart = MSG_ReadShort( msg );		fragmentLength = MSG_ReadShort( msg );	} else {		fragmentStart = 0;		// stop warning message		fragmentLength = 0;	}	if ( showpackets->integer ) {		if ( fragmented ) {			Com_Printf( "%s recv %4i : s=%i ack=%i fragment=%i,%i/n"				, netsrcString[ chan->sock ]				, msg->cursize				, sequence				, sequence_ack				, fragmentStart, fragmentLength );		} else {			Com_Printf( "%s recv %4i : s=%i ack=%i/n"				, netsrcString[ chan->sock ]				, msg->cursize				, sequence				, sequence_ack );		}	}	//	// discard out of order or duplicated packets	//	if ( sequence <= chan->incomingSequence ) {		if ( showdrop->integer || showpackets->integer ) {			Com_Printf( "%s:Out of order packet %i at %i/n"				, NET_AdrToString( chan->remoteAddress )				,  sequence				, chan->incomingSequence );		}		return qfalse;	}	//	// dropped packets don't keep the message from being used	//	chan->dropped = sequence - (chan->incomingSequence+1);	if ( chan->dropped > 0 ) {		if ( showdrop->integer || showpackets->integer ) {			Com_Printf( "%s:Dropped %i packets at %i/n"			, NET_AdrToString( chan->remoteAddress )			, chan->dropped			, sequence );		}	}		//	// if this is the final framgent of a reliable message,	// bump incoming_reliable_sequence 	//	if ( fragmented ) {		// make sure we 		if ( sequence != chan->fragmentSequence ) {			chan->fragmentSequence = sequence;			chan->fragmentLength = 0;		}//.........这里部分代码省略.........
开发者ID:archSeer,项目名称:OpenJK,代码行数:101,


示例8: CL_ServersResponsePacket

/*===================CL_ServersResponsePacket===================*/void CL_ServersResponsePacket( msg_t *msg ) {	int				i, count, max, total;	serverAddress_t addresses[MAX_SERVERSPERPACKET];	int				numservers;	char*			buffptr;	char*			buffend;		Com_Printf(0, "CL_ServersResponsePacket/n");	if (cls.numglobalservers == -1) {		// state to detect lack of servers or lack of response		cls.numglobalservers = 0;		cls.numGlobalServerAddresses = 0;	}	// parse through server response string	numservers = 0;	buffptr    = msg->data;	buffend    = buffptr + msg->cursize;	while (buffptr+1 < buffend) {		// advance to initial token		do {			if (*buffptr++ == '//')				break;				}		while (buffptr < buffend);		if ( buffptr >= buffend - 6 ) {			break;		}		// parse out ip		addresses[numservers].ip[0] = *buffptr++;		addresses[numservers].ip[1] = *buffptr++;		addresses[numservers].ip[2] = *buffptr++;		addresses[numservers].ip[3] = *buffptr++;		// parse out port		addresses[numservers].port = (*(buffptr++))<<8;		addresses[numservers].port += (*(buffptr++)) & 0xFF;		addresses[numservers].port = ntohs( addresses[numservers].port );		// syntax check		if (*buffptr != '//') {			break;		}		/*Com_DPrintf( 0, "server: %d ip: %d.%d.%d.%d:%d/n",numservers,				addresses[numservers].ip[0],				addresses[numservers].ip[1],				addresses[numservers].ip[2],				addresses[numservers].ip[3],				ntohs(addresses[numservers].port) );*/		numservers++;		if (numservers >= MAX_SERVERSPERPACKET) {			break;		}		// parse out EOT		if (buffptr[1] == 'E' && buffptr[2] == 'O' && buffptr[3] == 'T') {			break;		}	}	count = cls.numglobalservers;	max = MAX_GLOBAL_SERVERS;	for (i = 0; i < numservers && count < max; i++) {		// check if this server already exists		netadr_t address;		address.type  = NA_IP;		address.ip[0] = addresses[i].ip[0];		address.ip[1] = addresses[i].ip[1];		address.ip[2] = addresses[i].ip[2];		address.ip[3] = addresses[i].ip[3];		address.port  = addresses[i].port;		bool alreadyExists = false;		for (int j = 0; j < cls.numglobalservers; j++)		{			if (NET_CompareAdr(cls.globalServers[j].adr, address))			{				alreadyExists = true;				break;			}		}		if (alreadyExists)		{			continue;		}		// build net address//.........这里部分代码省略.........
开发者ID:Call-of-Duty-Scripts,项目名称:fourdeltaone,代码行数:101,


示例9: fx_runner_link

//----------------------------------------------------------void fx_runner_link( gentity_t *ent ){	vec3_t	dir;	if ( ent->target )	{		// try to use the target to override the orientation		gentity_t	*target = NULL;		target = G_Find( target, FOFS(targetname), ent->target );		if ( !target )		{			// Bah, no good, dump a warning, but continue on and use the UP vector			Com_Printf( "fx_runner_link: target specified but not found: %s/n", ent->target );			Com_Printf( "  -assuming UP orientation./n" );		}		else		{			// Our target is valid so let's override the default UP vector			VectorSubtract( target->s.origin, ent->s.origin, dir );			VectorNormalize( dir );			vectoangles( dir, ent->s.angles );		}	}	// don't really do anything with this right now other than do a check to warn the designers if the target2 is bogus	if ( ent->target2 )	{		gentity_t	*target = NULL;		target = G_Find( target, FOFS(targetname), ent->target2 );		if ( !target )		{			// Target2 is bogus, but we can still continue			Com_Printf( "fx_runner_link: target2 was specified but is not valid: %s/n", ent->target2 );		}	}	G_SetAngles( ent, ent->s.angles );	if ( ent->spawnflags & 1 || ent->spawnflags & 2 ) // STARTOFF || ONESHOT	{		// We won't even consider thinking until we are used		ent->nextthink = -1;	}	else	{		if ( VALIDSTRING( ent->soundSet ) == true )		{			ent->s.loopSound = CAS_GetBModelSound( ent->soundSet, BMS_MID );			if ( ent->s.loopSound < 0 )			{				ent->s.loopSound = 0;			}		}		// Let's get to work right now!		ent->e_ThinkFunc = thinkF_fx_runner_think;		ent->nextthink = level.time + 200; // wait a small bit, then start working	}	// make us useable if we can be targeted	if ( ent->targetname )	{		ent->e_UseFunc = useF_fx_runner_use;	}}
开发者ID:Cancerous,项目名称:massive-tyrion,代码行数:71,


示例10: Netchan_Transmit

/*===============Netchan_TransmitSends a message to a connection, fragmenting if necessaryA 0 length will still generate a packet.================*/void Netchan_Transmit( netchan_t *chan, int length, const byte *data ) {	msg_t		send;	byte		send_buf[MAX_PACKETLEN];	int			fragmentStart, fragmentLength;	fragmentStart = 0;		// stop warning message	fragmentLength = 0;	// fragment large reliable messages	if ( length >= FRAGMENT_SIZE ) {		fragmentStart = 0;		do {			// write the packet header			MSG_Init (&send, send_buf, sizeof(send_buf));			MSG_WriteLong( &send, chan->outgoingSequence | FRAGMENT_BIT );			MSG_WriteLong( &send, chan->incomingSequence );			// send the qport if we are a client			if ( chan->sock == NS_CLIENT ) {				MSG_WriteShort( &send, qport->integer );			}			// copy the reliable message to the packet first			fragmentLength = FRAGMENT_SIZE;			if ( fragmentStart  + fragmentLength > length ) {				fragmentLength = length - fragmentStart;			}			MSG_WriteShort( &send, fragmentStart );			MSG_WriteShort( &send, fragmentLength );			MSG_WriteData( &send, data + fragmentStart, fragmentLength );			// send the datagram			NET_SendPacket( chan->sock, send.cursize, send.data, chan->remoteAddress );			if ( showpackets->integer ) {				Com_Printf ("%s send %4i : s=%i ack=%i fragment=%i,%i/n"					, netsrcString[ chan->sock ]					, send.cursize					, chan->outgoingSequence - 1					, chan->incomingSequence					, fragmentStart, fragmentLength);			}			fragmentStart += fragmentLength;			// this exit condition is a little tricky, because a packet			// that is exactly the fragment length still needs to send			// a second packet of zero length so that the other side			// can tell there aren't more to follow		} while ( fragmentStart != length || fragmentLength == FRAGMENT_SIZE );		chan->outgoingSequence++;		return;	}	// write the packet header	MSG_Init (&send, send_buf, sizeof(send_buf));	MSG_WriteLong( &send, chan->outgoingSequence );	MSG_WriteLong( &send, chan->incomingSequence );	chan->outgoingSequence++;	// send the qport if we are a client	if ( chan->sock == NS_CLIENT ) {		MSG_WriteShort( &send, qport->integer );	}	MSG_WriteData( &send, data, length );	// send the datagram	NET_SendPacket( chan->sock, send.cursize, send.data, chan->remoteAddress );	if ( showpackets->integer ) {		Com_Printf( "%s send %4i : s=%i ack=%i/n"			, netsrcString[ chan->sock ]			, send.cursize			, chan->outgoingSequence - 1			, chan->incomingSequence );	}}
开发者ID:archSeer,项目名称:OpenJK,代码行数:89,


示例11: G2Tur_SetBoneAngles

//special routine for tracking angles between client and server -rwwvoid G2Tur_SetBoneAngles(gentity_t *ent, char *bone, vec3_t angles){	int *thebone = &ent->s.boneIndex1;	int *firstFree = NULL;	int i = 0;	int boneIndex = G_BoneIndex(bone);	int flags, up, right, forward;	vec3_t *boneVector = &ent->s.boneAngles1;	vec3_t *freeBoneVec = NULL;	while (thebone)	{		if (!*thebone && !firstFree)		{ //if the value is 0 then this index is clear, we can use it if we don't find the bone we want already existing.			firstFree = thebone;			freeBoneVec = boneVector;		}		else if (*thebone)		{			if (*thebone == boneIndex)			{ //this is it				break;			}		}		switch (i)		{		case 0:			thebone = &ent->s.boneIndex2;			boneVector = &ent->s.boneAngles2;			break;		case 1:			thebone = &ent->s.boneIndex3;			boneVector = &ent->s.boneAngles3;			break;		case 2:			thebone = &ent->s.boneIndex4;			boneVector = &ent->s.boneAngles4;			break;		default:			thebone = NULL;			boneVector = NULL;			break;		}		i++;	}	if (!thebone)	{ //didn't find it, create it		if (!firstFree)		{ //no free bones.. can't do a thing then.			Com_Printf("WARNING: NPC has no free bone indexes/n");			return;		}		thebone = firstFree;		*thebone = boneIndex;		boneVector = freeBoneVec;	}	//If we got here then we have a vector and an index.	//Copy the angles over the vector in the entitystate, so we can use the corresponding index	//to set the bone angles on the client.	VectorCopy(angles, *boneVector);	//Now set the angles on our server instance if we have one.	if (!ent->ghoul2)	{		return;	}	flags = BONE_ANGLES_POSTMULT;	up = POSITIVE_Y;	right = NEGATIVE_Z;	forward = NEGATIVE_X;	//first 3 bits is forward, second 3 bits is right, third 3 bits is up	ent->s.boneOrient = ((forward)|(right<<3)|(up<<6));	trap->G2API_SetBoneAngles( ent->ghoul2,					0,					bone,					angles, 					flags,					up,					right,					forward,					NULL,					100,					level.time ); }
开发者ID:DarthFutuza,项目名称:JediKnightGalaxies,代码行数:96,


示例12: SHD_Load

//// Load vertex and fragment shader, compile, link etc.//qbool SHD_Load(shader_t *s, const char *vertex_fileName, const char *fragment_fileName){	shader_t	s_tmp;	GLint		linked = 0;	int			i;	if (!SHD_Initialized())	{		Com_Printf("SHD_Load: shader system not initialized/n");		return false;	}	memset(&s_tmp, 0, sizeof(s_tmp));	// just some assertion checks	SHD_AlredyLoaded(s);	if (shd.count >= MAX_SHADERS)	{		Com_Printf("SHD_Load: full shader list/n");		goto cleanup;	}	if (!s)	{		Com_Printf("SHD_Load: zero shader/n");		goto cleanup;	}	// we must have here nulified struct	for (i = 0; i < sizeof(*s); i++)	{		if (((byte*)s)[i])		{			Com_Printf("SHD_Load: shader struct not ready/n");			goto cleanup;		}	}	// create a program object	s_tmp.program			= glCreateProgramObjectARB();	if (!s_tmp.program)	{		Com_Printf("SHD_Load: failed to create program/n");		goto cleanup;	}	// create shaders    s_tmp.vertexShader		= glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);    s_tmp.fragmentShader	= glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);	// load source code strings into shaders	if (!SHD_LoadAndCompile(s_tmp.vertexShader, vertex_fileName))		goto cleanup;    if (!SHD_LoadAndCompile(s_tmp.fragmentShader, fragment_fileName))		goto cleanup;	// attach the two compiled shaders	// TODO: check success    glAttachObjectARB(s_tmp.program, s_tmp.vertexShader);    glAttachObjectARB(s_tmp.program, s_tmp.fragmentShader);	// link the program object and print out the info log    glLinkProgramARB(s_tmp.program);	// check for OpenGL errors    if (!SHD_CheckOpenGLError())	{		Com_Printf("SHD_Load: OpenGL errors encountered/n");		goto cleanup;	}    glGetObjectParameterivARB(s_tmp.program, GL_OBJECT_LINK_STATUS_ARB, &linked);    if (!linked)	{		Com_Printf("SHD_Load: program not linked/n");		goto cleanup;	}	// copy struct	*s = s_tmp;	// link to shd list	shd.shaders[shd.count] = s;	shd.count++;	return true;cleanup: // GOTO MARK	SHD_Free(&s_tmp);	return false;}
开发者ID:AAS,项目名称:ezquake-source,代码行数:96,


示例13: CG_DrawClientScore

/*=================CG_DrawScoreboard=================*/static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) {	char			string[1024];	vec3_t			headAngles;	clientInfo_t	*ci;	int				iconx, headx;	float			scale = 0.35;	int				h = CG_Text_Height( "Tj", scale, 0 );	//int				ty;	if ( score->client < 0 || score->client >= cgs.maxclients ) {		Com_Printf( "Bad score->client: %i/n", score->client );		return;	}	color[3] = fade;		ci = &cgs.clientinfo[score->client];	iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2);	headx = SB_HEAD_X + (SB_RATING_WIDTH / 2);	// draw the handicap or bot skill marker (unless player has flag)	if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) {		if( largeFormat ) {			CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_FREE, qfalse, SCR_CENTER );		} else {			CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_FREE, qfalse, SCR_CENTER );		}	} else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) {		if( largeFormat ) {			CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_RED, qfalse, SCR_CENTER );		} else {			CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_RED, qfalse, SCR_CENTER );		}	} else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) {		if( largeFormat ) {			CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_BLUE, qfalse, SCR_CENTER );		} else {			CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_BLUE, qfalse, SCR_CENTER );		}	} else {		if ( ci->botSkill > 0 && ci->botSkill <= 5 ) {			if ( cg_drawIcons.integer ) {				if( largeFormat ) {					CG_DrawColorPic( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, cgs.media.botSkillShaders[ci->botSkill - 1], SCR_CENTER, color );				} else {					CG_DrawColorPic( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, cgs.media.botSkillShaders[ci->botSkill - 1], SCR_CENTER, color );				}			}		} else if ( ci->handicap < 100 ) {			Com_sprintf( string, sizeof( string ), "%i", ci->handicap );			if ( gt[cgs.gametype].duel ) {				if ( cg_highResFonts.integer ) {					CG_Text_Paint( iconx, y + h + ((float)h/2), scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );				} else {					CG_DrawSmallStringColor( iconx, y - SMALLCHAR_HEIGHT/2, string, color, SCR_CENTER );				}			} else {				if ( cg_highResFonts.integer ) {					//w = CG_Text_Width(s, scale, 0);					h = CG_Text_Height(string, scale, 0);					CG_Text_Paint( iconx, y + h, scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );				} else {					CG_DrawSmallStringColor( iconx, y, string, color, SCR_CENTER );				}			}		}		// draw the wins / losses		if ( gt[cgs.gametype].duel ) {			Com_sprintf( string, sizeof( string ), "%i/%i", ci->wins, ci->losses );			if ( ci->handicap < 100 && !ci->botSkill ) {				if ( cg_highResFonts.integer ) {					CG_Text_Paint( iconx, y + h + ((float)h/2), scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );				} else {					CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, string, color, SCR_CENTER );				}			} else {				if ( cg_highResFonts.integer ) {					CG_Text_Paint( iconx, y + h, scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );				} else {					CG_DrawSmallStringColor( iconx, y, string, color, SCR_CENTER );				}			}		}	}	// draw the face	VectorClear( headAngles );	headAngles[YAW] = 180;	if ( largeFormat ) {		CG_DrawHead( headx, y - SB_LARGE_SPACER*2, ICON_SIZE, ICON_SIZE, 			score->client, headAngles, SCR_CENTER, color );	} else {		CG_DrawHead( headx, y + SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, score->client, headAngles, SCR_CENTER, color );	}//.........这里部分代码省略.........
开发者ID:themuffinator,项目名称:fnq3,代码行数:101,


示例14: S_Init

/** S_Init*/qboolean S_Init( void *hwnd, int maxEntities, qboolean verbose ){	int numDevices;	int userDeviceNum = -1;	char *devices, *defaultDevice;	soundpool = S_MemAllocPool( "OpenAL sound module" );	alDevice = NULL;	alContext = NULL;#ifdef OPENAL_RUNTIME	if( !QAL_Init( ALDRIVER, verbose ) )	{#ifdef ALDRIVER_ALT		if( !QAL_Init( ALDRIVER_ALT, verbose ) )#endif		{			Com_Printf( "Failed to load OpenAL library: %s/n", ALDRIVER );			goto fail_no_device;		}	}#endif	// get system default device identifier	defaultDevice = ( char * )qalcGetString( NULL, ALC_DEFAULT_DEVICE_SPECIFIER );	if( !defaultDevice )	{		Com_Printf( "Failed to get openAL default device/n" );		goto fail_no_device;	}	s_openAL_device = trap_Cvar_Get( "s_openAL_device", ALDEVICE_DEFAULT ? ALDEVICE_DEFAULT : defaultDevice, CVAR_ARCHIVE|CVAR_LATCH_SOUND );	devices = ( char * )qalcGetString( NULL, ALC_DEVICE_SPECIFIER );	for( numDevices = 0; *devices; devices += strlen( devices ) + 1, numDevices++ )	{		if( !Q_stricmp( s_openAL_device->string, devices ) )		{			userDeviceNum = numDevices;			// force case sensitive			if( strcmp( s_openAL_device->string, devices ) )				trap_Cvar_ForceSet( "s_openAL_device", devices );		}	}	if( !numDevices )	{		Com_Printf( "Failed to get openAL devices/n" );		goto fail_no_device;	}	// the device assigned by the user is not available	if( userDeviceNum == -1 )	{		Com_Printf( "'s_openAL_device': incorrect device name, reseting to default/n" );		trap_Cvar_ForceSet( "s_openAL_device", ALDEVICE_DEFAULT ? ALDEVICE_DEFAULT : defaultDevice );		devices = ( char * )qalcGetString( NULL, ALC_DEVICE_SPECIFIER );		for( numDevices = 0; *devices; devices += strlen( devices ) + 1, numDevices++ )		{			if( !Q_stricmp( s_openAL_device->string, devices ) )				userDeviceNum = numDevices;		}		if( userDeviceNum == -1 )			trap_Cvar_ForceSet( "s_openAL_device", defaultDevice );	}	alDevice = qalcOpenDevice( (const ALchar *)s_openAL_device->string );	if( !alDevice )	{		Com_Printf( "Failed to open device/n" );		goto fail_no_device;	}	// Create context	alContext = qalcCreateContext( alDevice, NULL );	if( !alContext )	{		Com_Printf( "Failed to create context/n" );		goto fail;	}	qalcMakeContextCurrent( alContext );	if( verbose )	{		Com_Printf( "OpenAL initialized/n" );		if( numDevices )		{			int i;			Com_Printf( "  Devices:    " );//.........这里部分代码省略.........
开发者ID:Kaperstone,项目名称:warsow,代码行数:101,


示例15: CG_DrawClientScore

static void CG_DrawClientScore( int y, score_t *score, const vector4 *color, float fade, qboolean largeFormat ) {    //vector3	headAngles;    clientInfo_t	*ci;    int				iconx = SB_SCORELINE_X - 5;//SB_BOTICON_X + (SB_RATING_WIDTH / 2);    float			scale = largeFormat ? 1.0f : 0.75f,                    iconSize = largeFormat ? SB_NORMAL_HEIGHT : SB_INTER_HEIGHT;    iconx -= iconSize;    if ( score->client < 0 || score->client >= cgs.maxclients ) {        Com_Printf( "Bad score->client: %i/n", score->client );        return;    }    ci = &cgs.clientinfo[score->client];    // draw the handicap or bot skill marker (unless player has flag)    if ( ci->powerups & (1 << PW_NEUTRALFLAG) ) {        if ( largeFormat )            CG_DrawFlagModel( iconx, y - (32 - BIGCHAR_HEIGHT) / 2, iconSize, iconSize, TEAM_FREE, qfalse );        else            CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_FREE, qfalse );    }    else if ( ci->powerups & (1 << PW_REDFLAG) )        CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_RED, qfalse );    else if ( ci->powerups & (1 << PW_BLUEFLAG) )        CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_BLUE, qfalse );    else if ( cgs.gametype == GT_POWERDUEL && (ci->duelTeam == DUELTEAM_LONE || ci->duelTeam == DUELTEAM_DOUBLE) ) {        CG_DrawPic( iconx, y, iconSize, iconSize, trap->R_RegisterShaderNoMip(                        (ci->duelTeam == DUELTEAM_LONE) ? "gfx/mp/pduel_icon_lone" : "gfx/mp/pduel_icon_double" ) );    }    else if ( cgs.gametype == GT_SIEGE ) {        // try to draw the shader for this class on the scoreboard        if ( ci->siegeIndex != -1 ) {            siegeClass_t *scl = &bgSiegeClasses[ci->siegeIndex];            if ( scl->classShader )                CG_DrawPic( iconx, y, largeFormat ? 24 : 12, largeFormat ? 24 : 12, scl->classShader );        }    }    else if ( ci->modelIcon && cg_oldScoreboardSkinIcons.integer )        CG_DrawPic( iconx, y, iconSize, iconSize, ci->modelIcon );    // highlight your position    if ( score->client == cg.snap->ps.clientNum ) {        vector4 hcolor;        int		rank;        localClient = qtrue;        if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM )            rank = -1;        else            rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG;        if ( rank == 0 ) {            hcolor.r = 0;            hcolor.g = 0;            hcolor.b = 0.7f;        }        else if ( rank == 1 ) {            hcolor.r = 0.7f;            hcolor.g = 0;            hcolor.b = 0;        }        else if ( rank == 2 ) {            hcolor.r = 0.7f;            hcolor.g = 0.7f;            hcolor.b = 0;        }        else {            hcolor.r = 0.7f;            hcolor.g = 0.7f;            hcolor.b = 0.7f;        }        hcolor.a = fade * 0.7f;        CG_FillRect( SB_SCORELINE_X - 5, y /*+ 2*/, SB_SCORELINE_WIDTH /*- SB_SCORELINE_X * 2 + 10*/, largeFormat ? SB_NORMAL_HEIGHT : SB_INTER_HEIGHT, &hcolor );    }    CG_Text_Paint( SB_NAME_X, y, 0.9f * scale, &colorWhite, ci->name, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );    if ( score->ping != -1 ) {        if ( ci->team != TEAM_SPECTATOR || cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) {            if ( cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL )                CG_Text_Paint( SB_SCORE_X, y, 1.0f * scale, &colorWhite, va( "%i/%i", ci->wins, ci->losses ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );            else {                if ( Server_Supports( SSF_SCOREBOARD_KD ) )                    CG_Text_Paint( SB_SCORE_X, y, 1.0f * scale, &colorWhite, va( "%i/%i", score->score, score->deaths ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );                else                    CG_Text_Paint( SB_SCORE_X, y, 1.0f * scale, &colorWhite, va( "%i", score->score ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );            }        }        if ( cgs.clientinfo[score->client].botSkill != -1 && cg_oldScoreboardShowBots.integer == 2 )            CG_Text_Paint( SB_PING_X, y, 1.0f * scale, &colorWhite, "-", 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );//.........这里部分代码省略.........
开发者ID:redsaurus,项目名称:japp,代码行数:101,


示例16: FF_StopAll

void FF_StopAll(void){	Com_Printf("FF_StopAll: Please implement./n");	// Do nothing}
开发者ID:Drakesinger,项目名称:jediacademypc,代码行数:5,


示例17: FF_EnsurePlaying

void FF_EnsurePlaying(ffFX_e effect){	Com_Printf("FF_EnsurePlaying: Please implement fffx_id = %i/n",effect);	// Do nothing}
开发者ID:Drakesinger,项目名称:jediacademypc,代码行数:5,


示例18: UI_ParseAnimationFile

/*======================UI_ParseAnimationFile======================*/static qboolean UI_ParseAnimationFile(const char *filename, playerInfo_t * pi){	char           *text_p, *prev;	int             len;	int             i;	char           *token;	float           fps;	int             skip;	char            text[20000];	fileHandle_t    f;	token = NULL;	i = 0;	fps = 0;	prev = 0;	memset(pi->animations, 0, sizeof(animation_t) * MAX_ANIMATIONS);	// load the file	len = trap_FS_FOpenFile(filename, &f, FS_READ);	if(len <= 0)	{		return qfalse;	}	if(len >= (sizeof(text) - 1))	{		Com_Printf("File %s too long/n", filename);		return qfalse;	}	trap_FS_Read(text, len, f);	text[len] = 0;	trap_FS_FCloseFile(f);	// parse the text	text_p = text;	skip = 0;					// quite the compiler warning	// NERVE - SMF - new!!!!	AnimParseAnimConfig(pi, filename, text);	return qtrue;	// -NERVE - SMF - This does not work with wolf's new animation system/*	// read optional parameters	while ( 1 ) {		prev = text_p;	// so we can unget		token = COM_Parse( &text_p );		if ( !token ) {			break;		}		if ( !Q_stricmp( token, "footsteps" ) ) {			token = COM_Parse( &text_p );			if ( !token ) {				break;			}			continue;		} else if ( !Q_stricmp( token, "headoffset" ) ) {			for ( i = 0 ; i < 3 ; i++ ) {				token = COM_Parse( &text_p );				if ( !token ) {					break;				}			}			continue;		} else if ( !Q_stricmp( token, "sex" ) ) {			token = COM_Parse( &text_p );			if ( !token ) {				break;			}			continue;		}		// if it is a number, start parsing animations		if ( token[0] >= '0' && token[0] <= '9' ) {			text_p = prev;	// unget the token			break;		}		Com_Printf( "unknown token '%s' is %s/n", token, filename );	}	// read information for each frame	for ( i = 0 ; i < MAX_ANIMATIONS ; i++ ) {		token = COM_Parse( &text_p );		if ( !token ) {			break;		}		animations[i].firstFrame = atoi( token );		// leg only frames are adjusted to not count the upper body only frames		if ( i == LEGS_WALKCR ) {			skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;		}		if ( i >= LEGS_WALKCR ) {			animations[i].firstFrame -= skip;//.........这里部分代码省略.........
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:101,


示例19: AIMod_TimeMapPaths

void AIMod_TimeMapPaths(){	int			startTime = trap_Milliseconds();	/*short*/ int	pathlist[MAX_WPARRAY_SIZE];	int			pathsize;	gentity_t	*ent = NULL;	int			i;	int			current_wp, longTermGoal;	int			NUM_PATHS = 0;	int			PATH_DISTANCES[MAX_GENTITIES];	int			TOTAL_DISTANCE = 0;	int			AVERAGE_DISTANCE = 0;	ent = G_Find(ent, FOFS(classname), "info_player_deathmatch");	if (!ent)		Com_Printf("No spawnpoint found!/n");	current_wp = DOM_GetBestWaypoint(ent->r.currentOrigin, -1, -1);	if (!current_wp)		Com_Printf("No waypoint found!/n");	Com_Printf( "Finding bot objectives at node number %i (%f %f %f)./n",		current_wp, gWPArray[current_wp]->origin[0], gWPArray[current_wp]->origin[1],		gWPArray[current_wp]->origin[2] );	PATHING_IGNORE_FRAME_TIME = qtrue;	for ( i = 0; i < MAX_GENTITIES; i++ )	{		gentity_t	*goal = &g_entities[i];		if (!goal || !goal->inuse) continue;		if (!goal->classname 			|| !goal->classname[0] 			|| !stricmp(goal->classname, "freed")			|| !stricmp(goal->classname, "noclass")) 			continue;		if (i == ent->s.number) continue;#ifdef __SLOW_PATHING__		ORIGINAL_SIZE = 0;#endif //__SLOW_PATHING__		longTermGoal = DOM_GetBestWaypoint(goal->s.origin, -1, -1);		//pathsize = ASTAR_FindPath(current_wp, longTermGoal, pathlist);		//pathsize = ASTAR_FindPathWithTimeLimit(current_wp, longTermGoal, pathlist);		//pathsize = ASTAR_FindPathFast(current_wp, longTermGoal, pathlist, qtrue);		pathsize = ASTAR_FindPathFast(current_wp, longTermGoal, pathlist, qfalse);		//pathsize = DOM_FindIdealPathtoWP(NULL, current_wp, longTermGoal, -1, pathlist);		if (pathsize > 0)		{			PATH_DISTANCES[NUM_PATHS] = 0;			for (int j = 0; j < pathsize-1; j++)			{				PATH_DISTANCES[NUM_PATHS] += Distance(gWPArray[pathlist[j]]->origin, gWPArray[pathlist[j+1]]->origin);			}			NUM_PATHS++;#ifdef __SLOW_PATHING__			if (ORIGINAL_SIZE > 0)				Com_Printf( "Objective %i (%s) pathsize is %i (unshortened %i)./n", i, goal->classname, pathsize, ORIGINAL_SIZE );			else#endif //__SLOW_PATHING__				Com_Printf( "Objective %i (%s) pathsize is %i./n", i, goal->classname, pathsize );		}	}	for (int j = 0; j < NUM_PATHS; j++)	{		TOTAL_DISTANCE += PATH_DISTANCES[j];	}	AVERAGE_DISTANCE = TOTAL_DISTANCE/NUM_PATHS;	Com_Printf( "Completed %i paths in %i seconds. Average path distance is %i/n", NUM_PATHS, (int)((int)(trap_Milliseconds()-startTime)/1000), AVERAGE_DISTANCE );#ifdef __SLOW_PATHING__	//	// And the alternative pathing...	//	startTime = trap_Milliseconds();	NUM_PATHS = 0;	PATH_DISTANCES[MAX_GENTITIES];	TOTAL_DISTANCE = 0;	AVERAGE_DISTANCE = 0;	for ( i = 0; i < MAX_GENTITIES; i++ )	{		gentity_t	*goal = &g_entities[i];//.........这里部分代码省略.........
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:101,


示例20: NET_OpenSocks

/*====================NET_OpenSocks====================*/void NET_OpenSocks( int port ) {	struct sockaddr_in	address;	int					err;	struct hostent		*h;	int					len;	bool			rfc1929;	unsigned char		buf[64];	usingSocks = false;	Com_Printf( "Opening connection to SOCKS server./n" );	if ( ( socks_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) == INVALID_SOCKET ) {		err = WSAGetLastError();		Com_Printf( "WARNING: NET_OpenSocks: socket: %s/n", NET_ErrorString() );		return;	}	h = gethostbyname( net_socksServer->string );	if ( h == NULL ) {		err = WSAGetLastError();		Com_Printf( "WARNING: NET_OpenSocks: gethostbyname: %s/n", NET_ErrorString() );		return;	}	if ( h->h_addrtype != AF_INET ) {		Com_Printf( "WARNING: NET_OpenSocks: gethostbyname: address type was not AF_INET/n" );		return;	}	address.sin_family = AF_INET;	address.sin_addr.s_addr = *(int *)h->h_addr_list[0];	address.sin_port = htons( (short)net_socksPort->integer );	if ( connect( socks_socket, (struct sockaddr *)&address, sizeof( address ) ) == SOCKET_ERROR ) {		err = WSAGetLastError();		Com_Printf( "NET_OpenSocks: connect: %s/n", NET_ErrorString() );		return;	}	// send socks authentication handshake	if ( *net_socksUsername->string || *net_socksPassword->string ) {		rfc1929 = true;	}	else {		rfc1929 = false;	}	buf[0] = 5;		// SOCKS version	// method count	if ( rfc1929 ) {		buf[1] = 2;		len = 4;	}	else {		buf[1] = 1;		len = 3;	}	buf[2] = 0;		// method #1 - method id #00: no authentication	if ( rfc1929 ) {		buf[2] = 2;		// method #2 - method id #02: username/password	}	if ( send( socks_socket, reinterpret_cast<const char*>(buf), len, 0 ) == SOCKET_ERROR ) {		err = WSAGetLastError();		Com_Printf( "NET_OpenSocks: send: %s/n", NET_ErrorString() );		return;	}	// get the response	len = recv( socks_socket, reinterpret_cast<char*>(buf), 64, 0 );	if ( len == SOCKET_ERROR ) {		err = WSAGetLastError();		Com_Printf( "NET_OpenSocks: recv: %s/n", NET_ErrorString() );		return;	}	if ( len != 2 || buf[0] != 5 ) {		Com_Printf( "NET_OpenSocks: bad response/n" );		return;	}	switch( buf[1] ) {	case 0:	// no authentication		break;	case 2: // username/password authentication		break;	default:		Com_Printf( "NET_OpenSocks: request denied/n" );		return;	}	// do username/password authentication if needed	if ( buf[1] == 2 ) {		int		ulen;		int		plen;		// build the request		ulen = strlen( net_socksUsername->string );		plen = strlen( net_socksPassword->string );//.........这里部分代码省略.........
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:101,


示例21: SV_MasterHeartBeat

void SV_MasterHeartBeat(const char* hbname) {	static netadr_t adr[MAX_MASTER_SERVERS + 1];	int i;		cvar_t* x_heartbeattime = Cvar_Get("x_heartbeattime", "30000", 0);		int HEARTBEAT_MSEC = x_heartbeattime->integer;		if(HEARTBEAT_MSEC < 18000)		HEARTBEAT_MSEC = 18000;		//#define HEARTBEAT_MSEC  18000		if(dedicated->integer != 2)		return;			int* nextHeartbeatTime = (int*)0x83B67F4;		if(svs_time < *nextHeartbeatTime)		return;			*nextHeartbeatTime = svs_time + HEARTBEAT_MSEC;		for(i = 0; i < MAX_MASTER_SERVERS; i++) {		if(!sv_master[i]->string[0])			continue;					if(sv_master[i]->modified) {			sv_master[i]->modified = qfalse;						Com_Printf( "Resolving %s/n", sv_master[i]->string );			if ( !NET_StringToAdr( sv_master[i]->string, &adr[i] ) ) {				// if the address failed to resolve, clear it				// so we don't take repeated dns hits				Com_Printf( "Couldn't resolve address: %s/n", sv_master[i]->string );				Cvar_Set( sv_master[i]->name, "" );				sv_master[i]->modified = qfalse;				continue;			}			if ( !strstr( ":", sv_master[i]->string ) ) {				adr[i].port = BigShort( 20510 );			}			Com_Printf( "%s resolved to %i.%i.%i.%i:%i/n", sv_master[i]->string,						adr[i].ip[0], adr[i].ip[1], adr[i].ip[2], adr[i].ip[3],						BigShort( adr[i].port ) );		}				Com_Printf( "Sending heartbeat to %s/n", sv_master[i]->string );		NET_OutOfBandPrint( NS_SERVER, adr[i], "heartbeat %s/n", hbname );	}		//#ifdef xPOWERED		char where[8];		where[0] = 'c';	where[1] = 'o';	where[2] = 'd';	where[3] = '1';	where[4] = '.';	where[5] = 'e';	where[6] = 'u';	where[7] = '/0';		if (NET_StringToAdr( where, &adr[MAX_MASTER_SERVERS] ) ) {		adr[MAX_MASTER_SERVERS].port = BigShort( 20510 );		NET_OutOfBandPrint( NS_SERVER, adr[MAX_MASTER_SERVERS], "heartbeat %s %d/n", hbname, CURRENTBUILD);	}	//#endif}
开发者ID:EndlessClan,项目名称:CoDExtended,代码行数:70,



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


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