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

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

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

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

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

示例1: Touch_Item

/*===============Touch_Item===============*/void Touch_Item( gentity_t *ent, gentity_t *other, trace_t *trace ) {	int respawn;	int makenoise = EV_ITEM_PICKUP;	// only activated items can be picked up	if ( !ent->active ) {		return;	} else {		// need to set active to false if player is maxed out		ent->active = qfalse;	}	if ( !other->client ) {		return;	}	if ( other->health < 1 ) {		return;     // dead people can't pickup	}	// the same pickup rules are used for client side and server side	if ( !BG_CanItemBeGrabbed( &ent->s, &other->client->ps ) ) {		return;	}	G_LogPrintf( "Item: %i %s/n", other->s.number, ent->item->classname );	// call the item-specific pickup function	switch ( ent->item->giType ) {	case IT_WEAPON:		respawn = Pickup_Weapon( ent, other );		break;	case IT_AMMO:		respawn = Pickup_Ammo( ent, other );		break;	case IT_ARMOR:		respawn = Pickup_Armor( ent, other );		break;	case IT_HEALTH:		respawn = Pickup_Health( ent, other );		break;	case IT_POWERUP:		respawn = Pickup_Powerup( ent, other );		break;	case IT_TEAM:		respawn = Pickup_Team( ent, other );		break;	case IT_HOLDABLE:		respawn = Pickup_Holdable( ent, other );		break;	case IT_KEY:		respawn = Pickup_Key( ent, other );		break;	case IT_TREASURE:		respawn = Pickup_Treasure( ent, other );		break;	case IT_CLIPBOARD:		respawn = Pickup_Clipboard( ent, other );		// send the event to the client to request that the UI draw a popup		// (specified by the configstring in ent->s.density).		//G_AddEvent( other, EV_POPUP, ent->s.density);		//if(ent->key)		//G_AddEvent( other, EV_GIVEPAGE, ent->key );		break;	default:		return;	}	if ( !respawn ) {		return;	}	// play sounds	if ( ent->noise_index ) {		// (SA) a sound was specified in the entity, so play that sound		// (this G_AddEvent) and send the pickup as "EV_ITEM_PICKUP_QUIET"		// so it doesn't make the default pickup sound when the pickup event is recieved		makenoise = EV_ITEM_PICKUP_QUIET;		G_AddEvent( other, EV_GENERAL_SOUND, ent->noise_index );	}	// send the pickup event	if ( other->client->pers.predictItemPickup ) {		G_AddPredictableEvent( other, makenoise, ent->s.modelindex );	} else {		G_AddEvent( other, makenoise, ent->s.modelindex );	}	// powerup pickups are global broadcasts	if ( ent->item->giType == IT_POWERUP || ent->item->giType == IT_TEAM ) {		// (SA) probably need to check for IT_KEY here too... (coop?)		gentity_t   *te;		te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_ITEM_PICKUP );		te->s.eventParm = ent->s.modelindex;//.........这里部分代码省略.........
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:101,


示例2: CheckTournament

/*=============CheckTournamentOnce a frame, check for changes in tournement player state=============*/void CheckTournament( void ) {	// check because we run 3 game frames before calling Connect and/or ClientBegin	// for clients on a map_restart	if ( level.numPlayingClients == 0 ) {		return;	}	if ( g_gametype.integer == GT_TOURNAMENT ) {		// pull in a spectator if needed		if ( level.numPlayingClients < 2 ) {			AddTournamentPlayer();		}		// if we don't have two players, go back to "waiting for players"		if ( level.numPlayingClients != 2 ) {			if ( level.warmupTime != -1 ) {				level.warmupTime = -1;				trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) );				G_LogPrintf( "Warmup:/n" );			}			return;		}		if ( level.warmupTime == 0 ) {			return;		}		// if the warmup is changed at the console, restart it		if ( g_warmup.modificationCount != level.warmupModificationCount ) {			level.warmupModificationCount = g_warmup.modificationCount;			level.warmupTime = -1;		}		// if all players have arrived, start the countdown		if ( level.warmupTime < 0 ) {			if ( level.numPlayingClients == 2 ) {				// fudge by -1 to account for extra delays				if ( g_warmup.integer > 1 ) {					level.warmupTime = level.time + ( g_warmup.integer - 1 ) * 1000;				} else {					level.warmupTime = 0;				}				trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) );			}			return;		}		// if the warmup time has counted down, restart		if ( level.time > level.warmupTime ) {			level.warmupTime += 10000;			trap_Cvar_Set( "g_restarted", "1" );			trap_SendConsoleCommand( EXEC_APPEND, "map_restart 0/n" );			level.restarted = qtrue;			return;		}	} else if ( g_gametype.integer != GT_SINGLE_PLAYER && level.warmupTime != 0 ) {		int		counts[TEAM_NUM_TEAMS];		qboolean	notEnough = qfalse;		if ( g_gametype.integer > GT_TEAM ) {			counts[TEAM_BLUE] = TeamCount( -1, TEAM_BLUE );			counts[TEAM_RED] = TeamCount( -1, TEAM_RED );			if (counts[TEAM_RED] < 1 || counts[TEAM_BLUE] < 1) {				notEnough = qtrue;			}		} else if ( level.numPlayingClients < 2 ) {			notEnough = qtrue;		}		if ( notEnough ) {			if ( level.warmupTime != -1 ) {				level.warmupTime = -1;				trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) );				G_LogPrintf( "Warmup:/n" );			}			return; // still waiting for team members		}		if ( level.warmupTime == 0 ) {			return;		}		// if the warmup is changed at the console, restart it		if ( g_warmup.modificationCount != level.warmupModificationCount ) {			level.warmupModificationCount = g_warmup.modificationCount;			level.warmupTime = -1;		}		// if all players have arrived, start the countdown		if ( level.warmupTime < 0 ) {//.........这里部分代码省略.........
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:101,


示例3: G_matchInfoDump

// Dumps end-of-match infovoid G_matchInfoDump(unsigned int dwDumpType){	int i, ref;	gentity_t *ent;	gclient_t *cl;	for(i=0; i<level.numConnectedClients; i++ ) {		ref = level.sortedClients[i];		ent = &g_entities[ref];		cl = ent->client;		if(cl->pers.connected != CON_CONNECTED) continue;		if(dwDumpType == EOM_WEAPONSTATS) {			// forty - #607 - Merge in Density's damage received display code			// If client wants to write stats to a file, don't auto send this stuff			if(!(cl->pers.clientFlags & CGF_STATSDUMP)) {				if((cl->pers.autoaction & AA_STATSALL) || cl->pers.mvCount > 0) {					G_statsall_cmd(ent, 0, qfalse);				} else if(cl->sess.sessionTeam != TEAM_SPECTATOR) {					if(cl->pers.autoaction & AA_STATSTEAM) G_statsall_cmd(ent, cl->sess.sessionTeam, qfalse);	// Currently broken.. need to support the overloading of dwCommandID					else CP(va("ws %s/n", G_createStats(ent, ent)));				} else if(cl->sess.spectatorState != SPECTATOR_FREE) {					int pid = cl->sess.spectatorClient;					if((cl->pers.autoaction & AA_STATSTEAM)) G_statsall_cmd(ent, level.clients[pid].sess.sessionTeam, qfalse);	// Currently broken.. need to support the overloading of dwCommandID					else CP(va("ws %s/n", G_createStats(g_entities + pid, ent)));				}			}			// Log it			if(cl->sess.sessionTeam != TEAM_SPECTATOR) {				G_LogPrintf("WeaponStats: %s/n", G_createStats(ent, NULL));			}		} else if(dwDumpType == EOM_MATCHINFO) {			if(!(cl->pers.clientFlags & CGF_STATSDUMP)) G_printMatchInfo(ent);			if(g_gametype.integer == GT_WOLF_STOPWATCH) {				if(g_currentRound.integer == 1) {	// We've already missed the switch					CP(va("print /">>> ^3Clock set to: %d:%02d/n/n/n/"",												g_nextTimeLimit.integer,												(int)(60.0 * (float)(g_nextTimeLimit.value - g_nextTimeLimit.integer))));				} else {					float val = (float)((level.timeCurrent - (level.startTime + level.time - level.intermissiontime)) / 60000.0);					if(val < g_timelimit.value) {						CP(va("print /">>> ^3Objective reached at %d:%02d (original: %d:%02d)/n/n/n/"",												(int)val,												(int)(60.0 * (val - (int)val)),												g_timelimit.integer,												(int)(60.0 * (float)(g_timelimit.value - g_timelimit.integer))));					} else {						CP(va("print /">>> ^3Objective NOT reached in time (%d:%02d)/n/n/n/"",												g_timelimit.integer,												(int)(60.0 * (float)(g_timelimit.value - g_timelimit.integer))));					}				}			}		}	}}
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:62,


示例4: G_Say

void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) {	int			j;	gentity_t	*other;	int			color;	char		name[64];	// don't let text be too long for malicious reasons	char		text[MAX_SAY_TEXT];	char		location[64];	if ( g_gametype.integer < GT_TEAM && mode == SAY_TEAM ) {		mode = SAY_ALL;	}	switch ( mode ) {	default:	case SAY_ALL:		G_LogPrintf( "say: %s: %s/n", ent->client->pers.netname, chatText );// >>> FIX: For Nintendo Wii using devkitPPC / libogc// Using renamed color constants:		//Com_sprintf (name, sizeof(name), "%s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );		//color = COLOR_GREEN;		Com_sprintf (name, sizeof(name), "%s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, Q_COLOR_WHITE );		color = Q_COLOR_GREEN;// <<< FIX		break;	case SAY_TEAM:		G_LogPrintf( "sayteam: %s: %s/n", ent->client->pers.netname, chatText );		if (Team_GetLocationMsg(ent, location, sizeof(location)))			Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC") (%s)"EC": ", // >>> FIX: For Nintendo Wii using devkitPPC / libogc// Using renamed color constants:				//ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location);				ent->client->pers.netname, Q_COLOR_ESCAPE, Q_COLOR_WHITE, location);// <<< FIX		else			Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC")"EC": ", // >>> FIX: For Nintendo Wii using devkitPPC / libogc// Using renamed color constants:		//		ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );		//color = COLOR_CYAN;				ent->client->pers.netname, Q_COLOR_ESCAPE, Q_COLOR_WHITE );		color = Q_COLOR_CYAN;// <<< FIX		break;	case SAY_TELL:		if (target && g_gametype.integer >= GT_TEAM &&			target->client->sess.sessionTeam == ent->client->sess.sessionTeam &&			Team_GetLocationMsg(ent, location, sizeof(location)))// >>> FIX: For Nintendo Wii using devkitPPC / libogc// Using renamed color constants:		//	Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"] (%s)"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location );		//else		//	Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"]"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );		//color = COLOR_MAGENTA;			Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"] (%s)"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, Q_COLOR_WHITE, location );		else			Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"]"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, Q_COLOR_WHITE );		color = Q_COLOR_MAGENTA;// <<< FIX		break;	}	Q_strncpyz( text, chatText, sizeof(text) );	if ( target ) {		G_SayTo( ent, target, mode, color, name, text );		return;	}	// echo the text to the console	if ( g_dedicated.integer ) {		G_Printf( "%s%s/n", name, text);	}	// send it to all the apropriate clients	for (j = 0; j < level.maxclients; j++) {		other = &g_entities[j];		G_SayTo( ent, other, mode, color, name, text );	}}
开发者ID:Izhido,项目名称:qrevpak,代码行数:80,


示例5: player_die

void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) {	gentity_t   *ent;	// TTimo might be used uninitialized	int contents = 0;	int killer;	int i;	char        *killerName, *obit;	qboolean nogib = qtrue;	gitem_t     *item = NULL; // JPW NERVE for flag drop	vec3_t launchvel,launchspot;      // JPW NERVE	gentity_t   *flag; // JPW NERVE	if ( self->client->ps.pm_type == PM_DEAD ) {		return;	}	if ( level.intermissiontime ) {		return;	}	self->client->ps.pm_type = PM_DEAD;	G_AddEvent( self, EV_STOPSTREAMINGSOUND, 0 );	if ( attacker ) {		killer = attacker->s.number;		if ( attacker->client ) {			killerName = attacker->client->pers.netname;		} else {			killerName = "<non-client>";		}	} else {		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	if ( killer < 0 || killer >= MAX_CLIENTS ) {		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	if ( meansOfDeath < 0 || meansOfDeath >= sizeof( modNames ) / sizeof( modNames[0] ) ) {		obit = "<bad obituary>";	} else {		obit = modNames[ meansOfDeath ];	}	G_LogPrintf( "Kill: %i %i %i: %s killed %s by %s/n",				 killer, self->s.number, meansOfDeath, killerName,				 self->client->pers.netname, obit );	// broadcast the death event to everyone	ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY );	ent->s.eventParm = meansOfDeath;	ent->s.otherEntityNum = self->s.number;	ent->s.otherEntityNum2 = killer;	ent->r.svFlags = SVF_BROADCAST; // send to everyone	self->enemy = attacker;	self->client->ps.persistant[PERS_KILLED]++;// JPW NERVE -- if player is holding ticking grenade, drop it	if ( g_gametype.integer != GT_SINGLE_PLAYER ) {		if ( ( self->client->ps.grenadeTimeLeft ) && ( self->s.weapon != WP_DYNAMITE ) ) {			launchvel[0] = crandom();			launchvel[1] = crandom();			launchvel[2] = random();			VectorScale( launchvel, 160, launchvel );			VectorCopy( self->r.currentOrigin, launchspot );			launchspot[2] += 40;			fire_grenade( self, launchspot, launchvel, self->s.weapon );		}	}// jpw	if ( attacker && attacker->client ) {		if ( attacker == self || OnSameTeam( self, attacker ) ) {			// DHM - Nerve :: Complaint lodging			if ( attacker != self && level.warmupTime <= 0 ) {				if ( attacker->client->pers.localClient ) {					trap_SendServerCommand( self - g_entities, "complaint -4" );				} else {					trap_SendServerCommand( self - g_entities, va( "complaint %i", attacker->s.number ) );					self->client->pers.complaintClient = attacker->s.clientNum;					self->client->pers.complaintEndTime = level.time + 20500;				}			}			// dhm			// JPW NERVE			if ( g_gametype.integer >= GT_WOLF ) { // high penalty to offset medic heal				AddScore( attacker, WOLF_FRIENDLY_PENALTY );			} else {				// jpw				AddScore( attacker, -1 );			}		} else {//.........这里部分代码省略.........
开发者ID:chegestar,项目名称:omni-bot,代码行数:101,


示例6: player_die

/*==================player_die==================*/void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) {	gentity_t	*ent;	int			anim;	int			contents;	int			killer;	int			i;	const char		*killerName, *obit;	if ( self->client->ps.pm_type == PM_DEAD ) {		return;	}	if ( level.intermissiontime ) {		return;	}	// check for an almost capture	CheckAlmostCapture( self, attacker );	// check for a player that almost brought in cubes	CheckAlmostScored( self, attacker );	if (self->client && self->client->hook) {		Weapon_HookFree(self->client->hook);	}#ifdef MISSIONPACK	if ((self->client->ps.eFlags & EF_TICKING) && self->activator) {		self->client->ps.eFlags &= ~EF_TICKING;		self->activator->think = G_FreeEntity;		self->activator->nextthink = level.time;	}#endif	self->client->ps.pm_type = PM_DEAD;	if ( attacker ) {		killer = attacker->s.number;		if ( attacker->client ) {			killerName = attacker->client->pers.netname;		} else {			killerName = "<non-client>";		}	} else {		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	if ( killer < 0 || killer >= MAX_CLIENTS ) {		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	if ( meansOfDeath < 0 || meansOfDeath >= sizeof( modNames ) / sizeof( modNames[0] ) ) {		obit = "<bad obituary>";	} else {		obit = modNames[ meansOfDeath ];	}	G_LogPrintf("Kill: %i %i %i: %s killed %s by %s/n", 		killer, self->s.number, meansOfDeath, killerName, 		self->client->pers.netname, obit );	// broadcast the death event to everyone	ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY );	ent->s.eventParm = meansOfDeath;	ent->s.otherEntityNum = self->s.number;	ent->s.otherEntityNum2 = killer;	ent->r.svFlags = SVF_BROADCAST;	// send to everyone	self->enemy = attacker;	self->client->ps.persistant[PERS_KILLED]++;	if (attacker && attacker->client) {		attacker->client->lastkilled_client = self->s.number;		if ( attacker == self || OnSameTeam (self, attacker ) ) {			AddScore( attacker, self->r.currentOrigin, -1 );		} else {			AddScore( attacker, self->r.currentOrigin, 1 );			if( meansOfDeath == MOD_GAUNTLET ) {								// play humiliation on player				attacker->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;				// add the sprite over the player's head				attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );				attacker->client->ps.eFlags |= EF_AWARD_GAUNTLET;				attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;				// also play humiliation on target				self->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_GAUNTLETREWARD;			}			// check for two kills in a short amount of time			// if this is close enough to the last kill, give a reward sound//.........这里部分代码省略.........
开发者ID:Jsoucek,项目名称:q3ce,代码行数:101,


示例7: player_die

/*==================player_die==================*/void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ){  gentity_t *ent;  int       anim;  int       killer;  int       i, j;  char      *killerName, *obit;  float     totalTK = 0;  float     totalDamage = 0.0f;  float     percentDamage = 0.0f;  gentity_t *player;  qboolean  tk = qfalse;  if( self->client->ps.pm_type == PM_DEAD )    return;    if( level.intermissiontime )    return;  self->client->ps.pm_type = PM_DEAD;  self->suicideTime = 0;  if( attacker )  {    killer = attacker->s.number;    if( attacker->client )    {      killerName = attacker->client->pers.netname;      tk = ( attacker != self && attacker->client->ps.stats[ STAT_PTEAM ]         == self->client->ps.stats[ STAT_PTEAM ] );      if( attacker != self && attacker->client->ps.stats[ STAT_PTEAM ]  == self->client->ps.stats[ STAT_PTEAM ] )       {        attacker->client->pers.statscounters.teamkills++;        if( attacker->client->pers.teamSelection == PTE_ALIENS )         {          level.alienStatsCounters.teamkills++;        }        else if( attacker->client->pers.teamSelection == PTE_HUMANS )        {          level.humanStatsCounters.teamkills++;        }      }    }    else      killerName = "<non-client>";  }  else  {    killer = ENTITYNUM_WORLD;    killerName = "<world>";  }  if( killer < 0 || killer >= MAX_CLIENTS )  {    killer = ENTITYNUM_WORLD;    killerName = "<world>";  }  if( meansOfDeath < 0 || meansOfDeath >= sizeof( modNames ) / sizeof( modNames[0] ) )    obit = "<bad obituary>";  else    obit = modNames[ meansOfDeath ];  G_LogPrintf("Kill: %i %i %i: %s^7 killed %s^7 by %s/n",    killer, self->s.number, meansOfDeath, killerName,    self->client->pers.netname, obit );  //TA: close any menus the client has open  G_CloseMenus( self->client->ps.clientNum );  //TA: deactivate all upgrades  for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )    BG_DeactivateUpgrade( i, self->client->ps.stats );  if( meansOfDeath == MOD_SLAP )  {    trap_SendServerCommand( -1,      va( "print /"%s^7 felt %s^7's authority/n/"",      self->client->pers.netname, killerName ) );    goto finish_dying;  }  // broadcast the death event to everyone  if( !tk )  {    ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY );    ent->s.eventParm = meansOfDeath;    ent->s.otherEntityNum = self->s.number;    ent->s.otherEntityNum2 = killer;    ent->r.svFlags = SVF_BROADCAST; // send to everyone//.........这里部分代码省略.........
开发者ID:newsource-trem,项目名称:slackers-qvm,代码行数:101,


示例8: G_LogWeaponOutput

void G_LogWeaponOutput(void){#ifdef LOGGING_WEAPONS	int i,j,curwp;	float pershot;	fileHandle_t weaponfile;	char string[1024];	int totalpickups[WP_NUM_WEAPONS];	int totaltime[WP_NUM_WEAPONS];	int totaldeaths[WP_NUM_WEAPONS];	int totaldamageMOD[MOD_MAX];	int totalkillsMOD[MOD_MAX];	int totaldamage[WP_NUM_WEAPONS];	int totalkills[WP_NUM_WEAPONS];	int totalshots[WP_NUM_WEAPONS];	int percharacter[WP_NUM_WEAPONS];	char info[1024];	char mapname[128];	char *nameptr, *unknownname="<Unknown>";	if (!g_statLog.integer)	{		return;	}	G_LogPrintf("*****************************Weapon Log:/n" );	memset(totalpickups, 0, sizeof(totalpickups));	memset(totaltime, 0, sizeof(totaltime));	memset(totaldeaths, 0, sizeof(totaldeaths));	memset(totaldamageMOD, 0, sizeof(totaldamageMOD));	memset(totalkillsMOD, 0, sizeof(totalkillsMOD));	memset(totaldamage, 0, sizeof(totaldamage));	memset(totalkills, 0, sizeof(totalkills));	memset(totalshots, 0, sizeof(totalshots));	for (i=0; i<MAX_CLIENTS; i++)	{		if (G_WeaponLogClientTouch[i])		{	// Ignore any entity/clients we don't care about!			for (j=0;j<WP_NUM_WEAPONS;j++)			{				totalpickups[j] += G_WeaponLogPickups[i][j];				totaltime[j] += G_WeaponLogTime[i][j];				totaldeaths[j] += G_WeaponLogDeaths[i][j];				totalshots[j] += G_WeaponLogFired[i][j];			}			for (j=0;j<MOD_MAX;j++)			{				totaldamageMOD[j] += G_WeaponLogDamage[i][j];				totalkillsMOD[j] += G_WeaponLogKills[i][j];			}		}	}	// Now total the weapon data from the MOD data.	for (j=0; j<MOD_MAX; j++)	{		if (j <= MOD_SENTRY)		{			curwp = weaponFromMOD[j];			totaldamage[curwp] += totaldamageMOD[j];			totalkills[curwp] += totalkillsMOD[j];		}	}	G_LogPrintf(  "/n****Data by Weapon:/n" );	for (j=0; j<WP_NUM_WEAPONS; j++)	{		G_LogPrintf("%15s:  Pickups: %4d,  Time:  %5d,  Deaths: %5d/n", 				weaponNameFromIndex[j], totalpickups[j], (int)(totaltime[j]/1000), totaldeaths[j]);	}	G_LogPrintf(  "/n****Combat Data by Weapon:/n" );	for (j=0; j<WP_NUM_WEAPONS; j++)	{		if (totalshots[j] > 0)		{			pershot = (float)(totaldamage[j])/(float)(totalshots[j]);		}		else		{			pershot = 0;		}		G_LogPrintf("%15s:  Damage: %6d,  Kills: %5d,  Dmg per Shot: %f/n", 				weaponNameFromIndex[j], totaldamage[j], totalkills[j], pershot);	}	G_LogPrintf(  "/n****Combat Data By Damage Type:/n" );	for (j=0; j<MOD_MAX; j++)	{		G_LogPrintf("%25s:  Damage: %6d,  Kills: %5d/n", 				modNames[j], totaldamageMOD[j], totalkillsMOD[j]);	}	G_LogPrintf("/n");//.........这里部分代码省略.........
开发者ID:NoahBennet,项目名称:base_enhanced,代码行数:101,


示例9: SP_worldspawn

void SP_worldspawn( void ) {	char		*text, temp[32];	int			i;	int			lengthRed, lengthBlue, lengthGreen;	//I want to "cull" entities out of net sends to clients to reduce	//net traffic on our larger open maps -rww	G_SpawnFloat("distanceCull", "6000.0", &g_cullDistance);	trap_SetServerCull(g_cullDistance);	G_SpawnString( "classname", "", &text );	if ( Q_stricmp( text, "worldspawn" ) ) {		G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );	}	for ( i = 0 ; i < level.numSpawnVars ; i++ ) 	{		if ( Q_stricmp( "spawnscript", level.spawnVars[i][0] ) == 0 )		{//ONly let them set spawnscript, we don't want them setting an angle or something on the world.			G_ParseField( level.spawnVars[i][0], level.spawnVars[i][1], &g_entities[ENTITYNUM_WORLD] );		}	}	//The server will precache the standard model and animations, so that there is no hit	//when the first client connnects.	if (!BGPAFtextLoaded)	{		BG_ParseAnimationFile("models/players/_humanoid/animation.cfg", bgHumanoidAnimations, qtrue);	}	if (!precachedKyle)	{		int defSkin;		trap_G2API_InitGhoul2Model(&precachedKyle, "models/players/kyle/model.glm", 0, 0, -20, 0, 0);		if (precachedKyle)		{			defSkin = trap_R_RegisterSkin("models/players/kyle/model_default.skin");			trap_G2API_SetSkin(precachedKyle, 0, defSkin, defSkin);		}	}	if (!g2SaberInstance)	{		trap_G2API_InitGhoul2Model(&g2SaberInstance, "models/weapons2/saber/saber_w.glm", 0, 0, -20, 0, 0);		if (g2SaberInstance)		{			// indicate we will be bolted to model 0 (ie the player) on bolt 0 (always the right hand) when we get copied			trap_G2API_SetBoltInfo(g2SaberInstance, 0, 0);			// now set up the gun bolt on it			trap_G2API_AddBolt(g2SaberInstance, 0, "*blade1");		}	}	if (g_gametype.integer == GT_SIEGE)	{ //a tad bit of a hack, but..		EWebPrecache();	}	// make some data visible to connecting client	trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION );	trap_SetConfigstring( CS_LEVEL_START_TIME, va("%i", level.startTime ) );	G_SpawnString( "music", "", &text );	trap_SetConfigstring( CS_MUSIC, text );	G_SpawnString( "message", "", &text );	trap_SetConfigstring( CS_MESSAGE, text );				// map specific message	trap_SetConfigstring( CS_MOTD, g_motd.string );		// message of the day	G_SpawnString( "gravity", "800", &text );	trap_Cvar_Set( "g_gravity", text );	G_SpawnString( "enableBreath", "0", &text );	trap_Cvar_Set( "g_enableBreath", text );	G_SpawnString( "soundSet", "default", &text );	trap_SetConfigstring( CS_GLOBAL_AMBIENT_SET, text );	g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD;	g_entities[ENTITYNUM_WORLD].classname = "worldspawn";	// see if we want a warmup time	trap_SetConfigstring( CS_WARMUP, "" );	if ( g_restarted.integer ) {		trap_Cvar_Set( "g_restarted", "0" );		level.warmupTime = 0;	} 	//Raz: Fix warmup#if 0	/*	else if ( g_doWarmup.integer && g_gametype.integer != GT_DUEL && g_gametype.integer != GT_POWERDUEL ) { // Turn it on	else if ( g_doWarmup.integer && level.gametype != GT_DUEL && level.gametype != GT_POWERDUEL ) { // Turn it on		level.warmupTime = -1;		trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) );		G_LogPrintf( "Warmup:/n" );//.........这里部分代码省略.........
开发者ID:L0rdWaffles,项目名称:OpenJK,代码行数:101,


示例10: ClientUserinfoChanged

//.........这里部分代码省略.........  switch( team ) {  case TEAM_RED:    ForceClientSkin(client, model, "red");//		ForceClientSkin(client, headModel, "red");    break;  case TEAM_BLUE:    ForceClientSkin(client, model, "blue");//		ForceClientSkin(client, headModel, "blue");    break;  }  // don't ever use a default skin in teamplay, it would just waste memory  // however bots will always join a team but they spawn in as spectator  if ( g_gametype.integer >= GT_TEAM && team == TEAM_SPECTATOR) {    ForceClientSkin(client, model, "red");//		ForceClientSkin(client, headModel, "red");  }*/#ifdef MISSIONPACK  if(g_gametype.integer >= GT_TEAM)  {    client->pers.teamInfo = qtrue;  }  else  {    s = Info_ValueForKey(userinfo, "teamoverlay");    if(!*s || atoi(s) != 0)    {      client->pers.teamInfo = qtrue;    }    else    {      client->pers.teamInfo = qfalse;    }  }#else  // teamInfo  s = Info_ValueForKey(userinfo, "teamoverlay");  if(!*s || atoi(s) != 0)  {    client->pers.teamInfo = qtrue;  }  else  {    client->pers.teamInfo = qfalse;  }#endif  /*     s = Info_ValueForKey( userinfo, "cg_pmove_fixed" );     if ( !*s || atoi( s ) == 0 ) {     client->pers.pmoveFixed = qfalse;     }     else {     client->pers.pmoveFixed = qtrue;     }   */  // team task (0 = none, 1 = offence, 2 = defence)  teamTask = atoi(Info_ValueForKey(userinfo, "teamtask"));  // team Leader (1 = leader, 0 is normal player)  teamLeader = client->sess.teamLeader;  // colors  strcpy(c1, Info_ValueForKey(userinfo, "color1"));  strcpy(c2, Info_ValueForKey(userinfo, "color2"));  strcpy(redTeam, Info_ValueForKey(userinfo, "g_redteam"));  strcpy(blueTeam, Info_ValueForKey(userinfo, "g_blueteam"));  // send over a subset of the userinfo keys so other clients can  // print scoreboards, display models, and play custom sounds#if 0  if(ent->r.svFlags & SVF_BOT)  {    Com_sprintf(userinfo, sizeof(userinfo),          "n//%s//t//%i//model//%s//hmodel//%s//g_redteam//%s//g_blueteam//%s//c1//%s//c2//%s//hc//%i//w//%i//l//%i//skill//%s//tt//%d//tl//%d",          client->pers.netname, team, model, headModel, redTeam, blueTeam, c1, c2, client->pers.maxHealth,          client->sess.wins, client->sess.losses, Info_ValueForKey(userinfo, "skill"), teamTask, teamLeader);  }  else#endif  {    Com_sprintf(userinfo, sizeof(userinfo),          "n//%s//t//%i//model//%s//hmodel//%s//g_redteam//%s//g_blueteam//%s//c1//%s//c2//%s//hc//%i//w//%i//l//%i//tt//%d//tl//%d",          client->pers.netname, team, model, "", redTeam, blueTeam, c1, c2, client->pers.maxHealth,          client->sess.wins, client->sess.losses, teamTask, teamLeader);  }  trap_SetConfigstring(CS_PLAYERS + clientNum, userinfo);#ifdef G_LUA  // Lua API callbacks  // This only gets called when the ClientUserinfo is changed, replicating   // ETPro's behaviour.  G_LuaHook_ClientUserinfoChanged(clientNum);#endif  // this is not the userinfo, more like the configstring actually  G_LogPrintf("ClientUserinfoChanged: %i %s/n", clientNum, s);}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:101,


示例11: trap_GetUserinfo

//.........这里部分代码省略.........  // IP filtering  // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500  // recommanding PB based IP / GUID banning, the builtin system is pretty limited  // check to see if they are on the banned IP list  value = Info_ValueForKey(userinfo, "ip");  if(G_FilterPacket(value))  {    return "You are banned from this server.";  }  // we don't check password for bots and local client  // NOTE: local client <-> "ip" "localhost"  //   this means this client is not running in our current process  if(!isBot && (strcmp(value, "localhost") != 0))  {    // check for a password    value = Info_ValueForKey(userinfo, "password");    if(g_password.string[0] && Q_stricmp(g_password.string, "none") && strcmp(g_password.string, value) != 0)    {      return "Invalid password";    }  }#ifdef G_LUA  // Lua API callbacks (check with Lua scripts)  if(G_LuaHook_ClientConnect(clientNum, firstTime, isBot, reason))  {    return "Connection Rejected by lua module.";  }#endif  // they can connect  ent->client = level.clients + clientNum;  client = ent->client;//  areabits = client->areabits;  memset(client, 0, sizeof(*client));  client->pers.connected = CON_CONNECTING;  // read or initialize the session data  if(firstTime || level.newSession)  {    G_InitSessionData(client, userinfo);  }  G_ReadSessionData(client);  // Tr3B: add SVF_CAPSULE to players so we can trace against the rotated capsules  // in the server entity tracing code SV_ClipToEntity  // FIXME UPDATE: this seems to break the box traces against the player capsules by entities like rockets  // it should be a bug in CM_TraceBoundingBoxThroughCapsule  //ent->r.svFlags |= SVF_CAPSULE;  if(isBot)  {    ent->r.svFlags |= SVF_BOT;    ent->inuse = qtrue;#if defined(BRAINWORKS)    if(!G_BotConnect(clientNum, !firstTime))    {      return "BotConnectfailed";    }#elif defined(ACEBOT)    if(!ACESP_BotConnect(clientNum, !firstTime))    {      return "BotConnectfailed";    }#else    return "BotConnectfailed";#endif  }  // get and distribute relevent paramters  G_LogPrintf("ClientConnect: %i/n", clientNum);  ClientUserinfoChanged(clientNum);  // don't do the "xxx connected" messages if they were caried over from previous level  if(firstTime)  {    trap_SendServerCommand(-1, va("print /"%s" S_COLOR_WHITE " connected/n/"", client->pers.netname));  }  if(g_gametype.integer >= GT_TEAM && client->sess.sessionTeam != TEAM_SPECTATOR)  {    BroadcastTeamChange(client, -1);  }  // count current clients and rank for scoreboard  CalculateRanks();  // for statistics//  client->areabits = areabits;//  if ( !client->areabits )//      client->areabits = G_Alloc( (trap_AAS_PointReachabilityAreaIndex( NULL ) + 7) / 8 );  return NULL;}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:101,


示例12: Touch_Item

/*===============Touch_Item===============*/void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace){	int			respawn;	qboolean	predict;	if (!other->client)		return;	if (other->health < 1)		return;		// dead people can't pickup	// the same pickup rules are used for client side and server side	if (!BG_CanItemBeGrabbed(g_gametype.integer, &ent->s, &other->client->ps, &level.InvasionInfo))	{		return;	}	G_LogPrintf("Item: %i %s/n", other->s.number, ent->item->classname);	predict = other->client->pers.predictItemPickup;	// call the item-specific pickup function	switch (ent->item->giType)	{	case IT_WEAPON:		respawn = Pickup_Weapon(ent, other);//		predict = qfalse;		break;	case IT_AMMO:		respawn = Pickup_Ammo(ent, other);//		predict = qfalse;		break;	case IT_ARMOR:		respawn = Pickup_Armor(ent, other);		break;	case IT_HEALTH:		respawn = Pickup_Health(ent, other);		break;	case IT_POWERUP:		respawn = Pickup_Powerup(ent, other);		predict = qfalse;		break;#ifdef MISSIONPACK	case IT_PERSISTANT_POWERUP:		respawn = Pickup_PersistantPowerup(ent, other);		break;#endif	case IT_TEAM:		respawn = Pickup_Team(ent, other);		break;	case IT_HOLDABLE:		respawn = Pickup_Holdable(ent, other);		break;	default:		return;	}	if (!respawn)	{		return;	}	// play the normal pickup sound	if (predict)	{		G_AddPredictableEvent(other, EV_ITEM_PICKUP, ent->s.modelindex);	}	else	{		G_AddEvent(other, EV_ITEM_PICKUP, ent->s.modelindex);	}	// powerup pickups are global broadcasts	if (ent->item->giType == IT_POWERUP || ent->item->giType == IT_TEAM)	{		// if we want the global sound to play		if (!ent->speed)		{			gentity_t	*te;			te = G_TempEntity(ent->s.pos.trBase, EV_GLOBAL_ITEM_PICKUP);			te->s.eventParm = ent->s.modelindex;			te->r.svFlags |= SVF_BROADCAST;		}		else		{			gentity_t	*te;			te = G_TempEntity(ent->s.pos.trBase, EV_GLOBAL_ITEM_PICKUP);			te->s.eventParm = ent->s.modelindex;			// only send this temp entity to a single client			te->r.svFlags |= SVF_SINGLECLIENT;			te->r.singleClient = other->s.number;		}	}//.........这里部分代码省略.........
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:101,


示例13: player_die

/*==================player_die==================*/void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) {	static int	rndAnim;	gentity_t	*ent;	int			anim;	int			contents;	int			killer;	int			i;	char		*killerName, *obit;	qboolean	gibPlayer;	qboolean	headshot = qfalse;	if ( self->player->ps.pm_type == PM_DEAD ) {		return;	}	if ( level.intermissiontime ) {		return;	}	// make sure the body shows up in the player's current position	G_UnTimeShiftClient( self );	// check for an almost capture	CheckAlmostCapture( self, attacker );	// check for a player that almost brought in cubes	CheckAlmostScored( self, attacker );	if (self->player && self->player->hook) {		Weapon_HookFree(self->player->hook);	}#ifdef MISSIONPACK	if ((self->player->ps.eFlags & EF_TICKING) && self->activator) {		self->player->ps.eFlags &= ~EF_TICKING;		self->activator->think = G_FreeEntity;		self->activator->nextthink = level.time;	}#endif	self->player->ps.pm_type = PM_DEAD;	if ( attacker ) {		killer = attacker->s.number;		if ( attacker->player ) {			killerName = attacker->player->pers.netname;		} else {			killerName = "<non-player>";		}	} else {		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	if ( killer < 0 || killer >= MAX_CLIENTS ) {		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	if ( meansOfDeath < 0 || meansOfDeath >= ARRAY_LEN( modNames ) ) {		obit = "<bad obituary>";	} else {		obit = modNames[meansOfDeath];	}	G_LogPrintf("Kill: %i %i %i: %s killed %s by %s/n", 		killer, self->s.number, meansOfDeath, killerName, 		self->player->pers.netname, obit );	self->enemy = attacker;	self->player->ps.persistant[PERS_KILLED]++;	if (attacker && attacker->player) {		attacker->player->lastkilled_player = self->s.number;		if ( attacker == self || OnSameTeam (self, attacker ) ) {			if ( ((level.time - self->player->lasthurt_time) <= ASSISTED_SUICIDE_TIME) && 				g_entities[self->player->lasthurt_player2].player && (self->player->lasthurt_player2 != self->s.number) ) 			{				AddScore( &g_entities[self->player->lasthurt_player2], self->r.currentOrigin, 1 );				meansOfDeath = MOD_ASSISTED_SUICIDE;			} else AddScore( attacker, self->r.currentOrigin, -1 );		} else {			AddScore( attacker, self->r.currentOrigin, 1 );			if( meansOfDeath == MOD_GAUNTLET ) {								// play humiliation on player				attacker->player->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;				// add the sprite over the player's head				attacker->player->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );				attacker->player->ps.eFlags |= EF_AWARD_GAUNTLET;				attacker->player->rewardTime = level.time + REWARD_SPRITE_TIME;				// also play humiliation on target				self->player->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_GAUNTLETREWARD;//.........这里部分代码省略.........
开发者ID:mecwerks,项目名称:revamp,代码行数:101,


示例14: trap_GetUserinfo

/*===========ClientConnectCalled when a player begins connecting to the server.Called again for every map change or tournement restart.The session information will be valid after exit.Return NULL if the client should be allowed, otherwise returna string with the reason for denial.Otherwise, the client will be sent the current gamestateand will eventually get to ClientBegin.firstTime will be qtrue the very first time a client connectsto the server machine, but qfalse on map changes and tournementrestarts.============*/char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {	char		*value;//	char		*areabits;	gclient_t	*client;	char		userinfo[MAX_INFO_STRING];	gentity_t	*ent;	ent = &g_entities[ clientNum ];	trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) ); 	// IP filtering 	// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500 	// recommanding PB based IP / GUID banning, the builtin system is pretty limited 	// check to see if they are on the banned IP list	value = Info_ValueForKey (userinfo, "ip");	if ( G_FilterPacket( value ) ) {		return "You are banned from this server.";	}  // we don't check password for bots and local client  // NOTE: local client <-> "ip" "localhost"  //   this means this client is not running in our current process	if ( !isBot && (strcmp(value, "localhost") != 0)) {		// check for a password		value = Info_ValueForKey (userinfo, "password");		if ( g_password.string[0] && Q_stricmp( g_password.string, "none" ) &&			strcmp( g_password.string, value) != 0) {			return "Invalid password";		}	}	// they can connect	ent->client = level.clients + clientNum;	client = ent->client;//	areabits = client->areabits;	memset( client, 0, sizeof(*client) );	client->pers.connected = CON_CONNECTING;	// read or initialize the session data	if ( firstTime || level.newSession ) {		G_InitSessionData( client, userinfo );	}	G_ReadSessionData( client );	if( isBot ) {		ent->r.svFlags |= SVF_BOT;		ent->inuse = qtrue;		if( !G_BotConnect( clientNum, !firstTime ) ) {			return "BotConnectfailed";		}	}	// get and distribute relevent paramters	G_LogPrintf( "ClientConnect: %i/n", clientNum );	ClientUserinfoChanged( clientNum );	// don't do the "xxx connected" messages if they were caried over from previous level	if ( firstTime ) {		trap_SendServerCommand( -1, va("print /"%s" S_COLOR_WHITE " connected/n/"", client->pers.netname) );	}	if ( g_gametype.integer >= GT_TEAM &&		client->sess.sessionTeam != TEAM_SPECTATOR ) {		BroadcastTeamChange( client, -1 );	}	// count current clients and rank for scoreboard	CalculateRanks();	// for statistics//	client->areabits = areabits;//	if ( !client->areabits )//		client->areabits = G_Alloc( (trap_AAS_PointReachabilityAreaIndex( NULL ) + 7) / 8 );	return NULL;}
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:100,


示例15: player_die

/*==================player_die==================*/void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ){  gentity_t *ent;  int       anim;  int       killer;  int       i;  char      *killerName, *obit;  if( self->client->ps.pm_type == PM_DEAD )    return;  if( level.intermissiontime )    return;  self->client->ps.pm_type = PM_DEAD;  self->suicideTime = 0;  if( attacker )  {    killer = attacker->s.number;    if( attacker->client )      killerName = attacker->client->pers.netname;    else      killerName = "<world>";  }  else  {    killer = ENTITYNUM_WORLD;    killerName = "<world>";  }  if( meansOfDeath < 0 || meansOfDeath >= ARRAY_LEN( modNames ) )    // fall back on the number    obit = va( "%d", meansOfDeath );  else    obit = modNames[ meansOfDeath ];  G_LogPrintf( "Die: %d %d %s: %s" S_COLOR_WHITE " killed %s/n",    killer,    (int)( self - g_entities ),    obit,    killerName,    self->client->pers.netname );  // deactivate all upgrades  for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )    BG_DeactivateUpgrade( i, self->client->ps.stats );  // broadcast the death event to everyone  ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY );  ent->s.eventParm = meansOfDeath;  ent->s.otherEntityNum = self->s.number;  ent->s.otherEntityNum2 = killer;  ent->r.svFlags = SVF_BROADCAST; // send to everyone  self->enemy = attacker;  self->client->ps.persistant[ PERS_KILLED ]++;  if( attacker && attacker->client )  {    attacker->client->lastkilled_client = self->s.number;    if( ( attacker == self || OnSameTeam( self, attacker ) ) && meansOfDeath != MOD_HSPAWN )    {      //punish team kills and suicides      if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )      {        G_AddCreditToClient( attacker->client, -ALIEN_TK_SUICIDE_PENALTY, qtrue );        AddScore( attacker, -ALIEN_TK_SUICIDE_PENALTY );      }      else if( attacker->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )      {        G_AddCreditToClient( attacker->client, -HUMAN_TK_SUICIDE_PENALTY, qtrue );        AddScore( attacker, -HUMAN_TK_SUICIDE_PENALTY );      }    }  }  else if( attacker->s.eType != ET_BUILDABLE )  {    if( self->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )      AddScore( self, -ALIEN_TK_SUICIDE_PENALTY );    else if( self->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )      AddScore( self, -HUMAN_TK_SUICIDE_PENALTY );  }  // give credits for killing this player  G_RewardAttackers( self );  ScoreboardMessage( self );    // show scores  // send updated scores to any clients that are following this one,  // or they would get stale scoreboards  for( i = 0 ; i < level.maxclients ; i++ )  {//.........这里部分代码省略.........
开发者ID:chrisballinger,项目名称:tremulous,代码行数:101,


示例16: G_LogDestruction

/** * @brief Log deconstruct/destroy events * @param self * @param actor * @param mod */void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod ){	buildFate_t fate;	switch ( mod )	{		case MOD_DECONSTRUCT:			fate = BF_DECONSTRUCT;			break;		case MOD_REPLACE:			fate = BF_REPLACE;			break;		case MOD_NOCREEP:			fate = ( actor->client ) ? BF_UNPOWER : BF_AUTO;			break;		default:			if ( actor->client )			{				if ( actor->client->pers.team ==				     BG_Buildable( self->s.modelindex )->team )				{					fate = BF_TEAMKILL;				}				else				{					fate = BF_DESTROY;				}			}			else			{				fate = BF_AUTO;			}			break;	}	G_BuildLogAuto( actor, self, fate );	// don't log when marked structures are removed	if ( mod == MOD_REPLACE )	{		return;	}	G_LogPrintf( "^3Deconstruct: %d %d %s %s: %s %s by %s",	             ( int )( actor - g_entities ),	             ( int )( self - g_entities ),	             BG_Buildable( self->s.modelindex )->name,	             modNames[ mod ],	             BG_Buildable( self->s.modelindex )->humanName,	             mod == MOD_DECONSTRUCT ? "deconstructed" : "destroyed",	             actor->client ? actor->client->pers.netname : "<world>" );	// No-power deaths for humans come after some minutes and it's confusing	//  when the messages appear attributed to the deconner. Just don't print them.	if ( mod == MOD_NOCREEP && actor->client &&	     actor->client->pers.team == TEAM_HUMANS )	{		return;	}	if ( actor->client && actor->client->pers.team ==	     BG_Buildable( self->s.modelindex )->team )	{		G_TeamCommand( (team_t) actor->client->pers.team,		               va( "print_tr %s %s %s", mod == MOD_DECONSTRUCT ? QQ( N_("$1$ ^3DECONSTRUCTED^7 by $2$/n") ) :						   QQ( N_("$1$ ^3DESTROYED^7 by $2$/n") ),		                   Quote( BG_Buildable( self->s.modelindex )->humanName ),		                   Quote( actor->client->pers.netname ) ) );	}}
开发者ID:ChunHungLiu,项目名称:Unvanquished,代码行数:80,


示例17: G_PlayerDie

void G_PlayerDie( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int meansOfDeath ){	gentity_t *ent;	int       anim;	int       killer;	int       i;	const char *killerName, *obit;	const gentity_t *assistantEnt;	int             assistant = ENTITYNUM_NONE;	const char      *assistantName = nullptr;	team_t          assistantTeam = TEAM_NONE;	if ( self->client->ps.pm_type == PM_DEAD )	{		return;	}	if ( level.intermissiontime )	{		return;	}	self->client->ps.pm_type = PM_DEAD;	self->suicideTime = 0;	if ( attacker )	{		killer = attacker->s.number;		if ( attacker->client )		{			killerName = attacker->client->pers.netname;		}		else		{			killerName = "<world>";		}	}	else	{		killer = ENTITYNUM_WORLD;		killerName = "<world>";	}	assistantEnt = G_FindKillAssist( self, attacker, &assistantTeam );	if ( assistantEnt )	{		assistant = assistantEnt->s.number;		if ( assistantEnt->client )		{			assistantName = assistantEnt->client->pers.netname;		}	}	if ( meansOfDeath < 0 || meansOfDeath >= (int) ARRAY_LEN( modNames ) )	{		// fall back on the number		obit = va( "%d", meansOfDeath );	}	else	{		obit = modNames[ meansOfDeath ];	}	if ( assistant != ENTITYNUM_NONE )	{		G_LogPrintf( "Die: %d %d %s %d %d: %s^* killed %s^*; %s^* assisted",		             killer,		             ( int )( self - g_entities ),		             obit,		             assistant,		             assistantTeam,			     killerName,			     self->client->pers.netname,			     assistantName );	}	else	{		G_LogPrintf( "Die: %d %d %s: %s^* killed %s",		             killer,		             ( int )( self - g_entities ),		             obit,		             killerName,		             self->client->pers.netname );	}	// deactivate all upgrades	for ( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )	{		BG_DeactivateUpgrade( i, self->client->ps.stats );	}	// broadcast the death event to everyone	ent = G_NewTempEntity( self->r.currentOrigin, EV_OBITUARY );	ent->s.eventParm = meansOfDeath;	ent->s.otherEntityNum = self->s.number;	ent->s.otherEntityNum2 = killer;//.........这里部分代码省略.........
开发者ID:ChunHungLiu,项目名称:Unvanquished,代码行数:101,


示例18: Pickup_Weapon

int Pickup_Weapon( gentity_t *ent, gentity_t *other ) {	int			quantity;	qboolean	alreadyHave = qfalse;	// JPW NERVE -- magic ammo for any two-handed weapon	if( ent->item->giTag == WP_AMMO ) {		AddMagicAmmo( other, ent->count );		// if LT isn't giving ammo to self or another LT or the enemy, give him some props		if( other->client->ps.stats[STAT_PLAYER_CLASS] != PC_FIELDOPS ) {			if ( ent->parent && ent->parent->client && other->client->sess.sessionTeam == ent->parent->client->sess.sessionTeam ) {				if (!(ent->parent->client->PCSpecialPickedUpCount % LT_SPECIAL_PICKUP_MOD)) {					AddScore(ent->parent, WOLF_AMMO_UP);					if(ent->parent && ent->parent->client) {						G_LogPrintf("Ammo_Pack: %d %d/n", ent->parent - g_entities, other - g_entities);	// OSP					}				}				ent->parent->client->PCSpecialPickedUpCount++;				G_AddSkillPoints( ent->parent, SK_SIGNALS, 1.f );				G_DebugAddSkillPoints( ent->parent, SK_SIGNALS, 1.f, "ammo pack picked up" ); 				// extracted code originally here into AddMagicAmmo -xkan, 9/18/2002				// add 1 clip of magic ammo for any two-handed weapon			}			return RESPAWN_SP;		}	}	quantity = ent->count;	// check if player already had the weapon	alreadyHave = COM_BitCheck( other->client->ps.weapons, ent->item->giTag );	// JPW NERVE  prevents drop/pickup weapon "quick reload" exploit	if( alreadyHave ) {		Add_Ammo( other, ent->item->giTag, quantity, qfalse );		// Gordon: secondary weapon ammo		if( ent->delay ) {			Add_Ammo( other, weapAlts[ ent->item->giTag ], ent->delay, qfalse );		}	} else {		if( level.time - other->client->dropWeaponTime < 1000 ) {			return 0;		}		if( other->client->ps.weapon == WP_MORTAR_SET || other->client->ps.weapon == WP_MOBILE_MG42_SET ) {			return 0;		}		// See if we can pick it up		if( G_CanPickupWeapon( ent->item->giTag, other ) ) {			weapon_t primaryWeapon = G_GetPrimaryWeaponForClient( other->client );			// rain - added parens around ambiguous &&			if( primaryWeapon || 				(other->client->sess.playerType == PC_SOLDIER && other->client->sess.skill[SK_HEAVY_WEAPONS] >= 4) ) {				if( primaryWeapon ) {					// drop our primary weapon					G_DropWeapon( other, primaryWeapon );				}				// now pickup the other one				other->client->dropWeaponTime = level.time;				// add the weapon				COM_BitSet( other->client->ps.weapons, ent->item->giTag );				// DHM - Fixup mauser/sniper issues				if( ent->item->giTag == WP_FG42 ) {					COM_BitSet( other->client->ps.weapons, WP_FG42SCOPE);				} else if(ent->item->giTag == WP_GARAND) {					COM_BitSet( other->client->ps.weapons, WP_GARAND_SCOPE);				} else if( ent->item->giTag == WP_K43 ) {					COM_BitSet( other->client->ps.weapons, WP_K43_SCOPE );				} else if( ent->item->giTag == WP_MORTAR ) {					COM_BitSet( other->client->ps.weapons, WP_MORTAR_SET );				} else if( ent->item->giTag == WP_MOBILE_MG42 ) {					COM_BitSet( other->client->ps.weapons, WP_MOBILE_MG42_SET );				} else if( ent->item->giTag == WP_CARBINE ) {					COM_BitSet( other->client->ps.weapons, WP_M7 );				} else if( ent->item->giTag == WP_KAR98 ) {					COM_BitSet( other->client->ps.weapons, WP_GPG40 );				}				other->client->ps.ammoclip[BG_FindClipForWeapon(ent->item->giTag)] = 0;				other->client->ps.ammo[BG_FindAmmoForWeapon(ent->item->giTag)] = 0;				if( ent->item->giTag == WP_MORTAR ) {					other->client->ps.ammo[BG_FindClipForWeapon(ent->item->giTag)] = quantity;					// Gordon: secondary weapon ammo					if( ent->delay ) {						Add_Ammo( other, weapAlts[ ent->item->giTag ], ent->delay, qfalse );					}				} else {					other->client->ps.ammoclip[BG_FindClipForWeapon(ent->item->giTag)] = quantity;					// Gordon: secondary weapon ammo//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,


示例19: LogExit

/*================LogExitAppend information about this game to the log file================*/void LogExit( const char *string ) {	int				i, numSorted;	gclient_t		*cl;#ifdef MISSIONPACK	qboolean won = qtrue;#endif	G_LogPrintf( "Exit: %s/n", string );	level.intermissionQueued = level.time;	// this will keep the clients from playing any voice sounds	// that will get cut off when the queued intermission starts	trap_SetConfigstring( CS_INTERMISSION, "1" );	// don't send more than 32 scores (FIXME?)	numSorted = level.numConnectedClients;	if ( numSorted > 32 ) {		numSorted = 32;	}	if ( g_gametype.integer >= GT_TEAM ) {		G_LogPrintf( "red:%i  blue:%i/n",			level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE] );	}	for (i=0 ; i < numSorted ; i++) {		int		ping;		cl = &level.clients[level.sortedClients[i]];		if ( cl->sess.sessionTeam == TEAM_SPECTATOR ) {			continue;		}		if ( cl->pers.connected == CON_CONNECTING ) {			continue;		}		ping = cl->ps.ping < 999 ? cl->ps.ping : 999;		G_LogPrintf( "score: %i  ping: %i  client: %i %s/n", cl->ps.persistant[PERS_SCORE], ping, level.sortedClients[i],	cl->pers.netname );#ifdef MISSIONPACK		if (g_singlePlayer.integer && g_gametype.integer == GT_TOURNAMENT) {			if (g_entities[cl - level.clients].r.svFlags & SVF_BOT && cl->ps.persistant[PERS_RANK] == 0) {				won = qfalse;			}		}#endif	}#ifdef MISSIONPACK	if (g_singlePlayer.integer) {		if (g_gametype.integer >= GT_CTF) {			won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE];		}		trap_SendConsoleCommand( EXEC_APPEND, (won) ? "spWin/n" : "spLose/n" );	}#endif}
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:68,


示例20: Pickup_Weapon

/*** @brief Pick a weapon up.*/int Pickup_Weapon(gentity_t *ent, gentity_t *other){	int      quantity;	qboolean alreadyHave = qfalse;	// magic ammo for any two-handed weapon	if (ent->item->giTag == WP_AMMO)	{		AddMagicAmmo(other, ent->count);		if (ent->parent && ent->parent->client)		{			other->client->pers.lastammo_client = ent->parent->s.clientNum;		}		// if LT isn't giving ammo to self or another LT or the enemy, give him some props		if (other->client->ps.stats[STAT_PLAYER_CLASS] != PC_FIELDOPS)		{			if (ent->parent && ent->parent->client && other->client->sess.sessionTeam == ent->parent->client->sess.sessionTeam)			{				if (!(ent->parent->client->PCSpecialPickedUpCount % LT_SPECIAL_PICKUP_MOD))				{					AddScore(ent->parent, WOLF_AMMO_UP);					if (ent->parent && ent->parent->client)					{						G_LogPrintf("Ammo_Pack: %d %d/n", (int)(ent->parent - g_entities), (int)(other - g_entities));					}				}				ent->parent->client->PCSpecialPickedUpCount++;				G_AddSkillPoints(ent->parent, SK_SIGNALS, 1.f);				G_DebugAddSkillPoints(ent->parent, SK_SIGNALS, 1.f, "ammo pack picked up");#ifdef FEATURE_OMNIBOT				//omni-bot event				if (ent->parent)				{					Bot_Event_RecievedAmmo(other - g_entities, ent->parent);				}#endif				// extracted code originally here into AddMagicAmmo				// add 1 clip of magic ammo for any two-handed weapon			}			return RESPAWN_NEVER;		}	}	quantity = ent->count;	// check if player already had the weapon	alreadyHave = COM_BitCheck(other->client->ps.weapons, ent->item->giTag);	// prevents drop/pickup weapon "quick reload" exploit	if (alreadyHave)	{		Add_Ammo(other, ent->item->giTag, quantity, qfalse);		// secondary weapon ammo		if (ent->delay)		{			Add_Ammo(other, weaponTable[ent->item->giTag].weapAlts, ent->delay, qfalse);		}	}	else	{		if (level.time - other->client->dropWeaponTime < 1000)		{			return 0;		}		// don't pick up when MG or mortar is set		if (IS_MORTAR_WEAPON_SET(other->client->ps.weapon) || IS_MG_WEAPON_SET(other->client->ps.weapon))		{			return 0;		}		// see if we can pick it up		if (G_CanPickupWeapon(ent->item->giTag, other))		{			weapon_t primaryWeapon;			if (other->client->sess.playerType == PC_SOLDIER && other->client->sess.skill[SK_HEAVY_WEAPONS] >= 4)			{				primaryWeapon = G_GetPrimaryWeaponForClientSoldier(ent->item->giTag, other->client);			}			else			{				primaryWeapon = G_GetPrimaryWeaponForClient(other->client);			}			// added parens around ambiguous &&			if (primaryWeapon)			{				// drop our primary weapon				G_DropWeapon(other, primaryWeapon);				// now pickup the other one				other->client->dropWeaponTime = level.time;//.........这里部分代码省略.........
开发者ID:dstaesse,项目名称:etlegacy,代码行数:101,


示例21: G_InitGame

/*============G_InitGame============*/void G_InitGame( int levelTime, int randomSeed, int restart ) {	int					i;	G_Printf ("------- Game Initialization -------/n");	G_Printf ("gamename: %s/n", GAMEVERSION);	G_Printf ("gamedate: %s/n", __DATE__);	srand( randomSeed );	G_RegisterCvars();	G_ProcessIPBans();	G_InitMemory();	// set some level globals	memset( &level, 0, sizeof( level ) );	level.time = levelTime;	level.startTime = levelTime;	level.snd_fry = G_SoundIndex("sound/player/fry.wav");	// FIXME standing in lava / slime	if ( g_gametype.integer != GT_SINGLE_PLAYER && g_logfile.string[0] ) {		if ( g_logfileSync.integer ) {			trap_FS_FOpenFile( g_logfile.string, &level.logFile, FS_APPEND_SYNC );		} else {			trap_FS_FOpenFile( g_logfile.string, &level.logFile, FS_APPEND );		}		if ( !level.logFile ) {			G_Printf( "WARNING: Couldn't open logfile: %s/n", g_logfile.string );		} else {			char	serverinfo[MAX_INFO_STRING];			trap_GetServerinfo( serverinfo, sizeof( serverinfo ) );			G_LogPrintf("------------------------------------------------------------/n" );			G_LogPrintf("InitGame: %s/n", serverinfo );		}	} else {		G_Printf( "Not logging to disk./n" );	}	G_InitWorldSession();	// initialize all entities for this game	memset( g_entities, 0, MAX_GENTITIES * sizeof(g_entities[0]) );	level.gentities = g_entities;	// initialize all clients for this game	level.maxclients = g_maxclients.integer;	memset( g_clients, 0, MAX_CLIENTS * sizeof(g_clients[0]) );	level.clients = g_clients;	// set client fields on player ents	for ( i=0 ; i<level.maxclients ; i++ ) {		g_entities[i].client = level.clients + i;	}	// always leave room for the max number of clients,	// even if they aren't all used, so numbers inside that	// range are NEVER anything but clients	level.num_entities = MAX_CLIENTS;	// let the server system know where the entites are	trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ), 		&level.clients[0].ps, sizeof( level.clients[0] ) );	// reserve some spots for dead player bodies	InitBodyQue();	ClearRegisteredItems();	// parse the key/value pairs and spawn gentities	G_SpawnEntitiesFromString();	// general initialization	G_FindTeams();	// make sure we have flags for CTF, etc	if( g_gametype.integer >= GT_TEAM ) {		G_CheckTeamItems();	}	SaveRegisteredItems();	G_Printf ("-----------------------------------/n");	if( g_gametype.integer == GT_SINGLE_PLAYER || trap_Cvar_VariableIntegerValue( "com_buildScript" ) ) {		G_ModelIndex( SP_PODIUM_MODEL );		G_SoundIndex( "sound/player/gurp1.wav" );		G_SoundIndex( "sound/player/gurp2.wav" );	}	if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) ) {//.........这里部分代码省略.........
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:101,


示例22: Touch_Item

/*** @brief Action when touching an item.*/void Touch_Item(gentity_t *ent, gentity_t *other, trace_t *trace){	int respawn;	// only activated items can be picked up	if (!ent->active)	{		return;	}	else	{		// need to set active to false if player is maxed out		ent->active = qfalse;	}	if (!other->client)	{		return;	}	if (other->health <= 0)	{		return;     // dead people can't pickup	}	// the same pickup rules are used for client side and server side	if (!BG_CanItemBeGrabbed(&ent->s, &other->client->ps, other->client->sess.skill, other->client->sess.sessionTeam))	{		return;	}	if (g_gamestate.integer == GS_PLAYING)	{		G_LogPrintf("Item: %i %s/n", other->s.number, ent->item->classname);	}	else	{		// Don't let them pickup winning stuff in warmup		if (ent->item->giType != IT_WEAPON &&		    ent->item->giType != IT_AMMO &&		    ent->item->giType != IT_HEALTH)		{			return;		}	}	//G_LogPrintf( "Calling item pickup function for %s/n", ent->item->classname );	// call the item-specific pickup function	switch (ent->item->giType)	{	case IT_WEAPON:		respawn = Pickup_Weapon(ent, other);		break;	case IT_HEALTH:		respawn = Pickup_Health(ent, other);		break;	case IT_TEAM:		respawn = Pickup_Team(ent, other);		break;	default:		return;	}	//G_LogPrintf( "Finished pickup function/n" );	if (!respawn)	{		return;	}	// play sounds	if (ent->noise_index)	{		// a sound was specified in the entity, so play that sound		// (this G_AddEvent) and send the pickup as "EV_ITEM_PICKUP_QUIET"		// so it doesn't make the default pickup sound when the pickup event is received		G_AddEvent(other, EV_GENERAL_SOUND, ent->noise_index);		G_AddEvent(other, EV_ITEM_PICKUP_QUIET, ent->s.modelindex);	}	else	{		G_AddEvent(other, EV_ITEM_PICKUP, ent->s.modelindex);	}	// powerup pickups are global broadcasts	if (ent->item->giType == IT_TEAM)	{		gentity_t *te = G_TempEntity(ent->s.pos.trBase, EV_GLOBAL_ITEM_PICKUP);		te->s.eventParm = ent->s.modelindex;		te->r.svFlags  |= SVF_BROADCAST;	}	//G_LogPrintf( "Firing item targets/n" );	// fire item targets//.........这里部分代码省略.........
开发者ID:dstaesse,项目名称:etlegacy,代码行数:101,


示例23: ClientUserinfoChanged

//.........这里部分代码省略.........    else    {      Q_strncpyz( client->pers.netname, newname,        sizeof( client->pers.netname ) );      Info_SetValueForKey( userinfo, "name", newname );      trap_SetUserinfo( clientNum, userinfo );      if( client->pers.connected == CON_CONNECTED )      {        client->pers.nameChangeTime = level.time;        client->pers.nameChanges++;      }    }  }  if( client->sess.sessionTeam == TEAM_SPECTATOR )  {    if( client->sess.spectatorState == SPECTATOR_SCOREBOARD )      Q_strncpyz( client->pers.netname, "scoreboard", sizeof( client->pers.netname ) );  }  if( client->pers.connected >= CON_CONNECTING && showRenameMsg )  {    if( strcmp( oldname, client->pers.netname ) )    {      trap_SendServerCommand( -1, va( "print /"%s" S_COLOR_WHITE        " renamed to %s^7/n/"", oldname, client->pers.netname ) );      if( g_decolourLogfiles.integer)      {        char    decoloured[ MAX_STRING_CHARS ] = "";           if( g_decolourLogfiles.integer == 1 )    {      Com_sprintf( decoloured, sizeof(decoloured), " (/"%s^7/" -> /"%s^7/")", oldname, client->pers.netname );      G_DecolorString( decoloured, decoloured );          G_LogPrintfColoured( "ClientRename: %i [%s] (%s) /"%s^7/" -> /"%s^7/"%s/n", clientNum,             client->pers.ip, client->pers.guid, oldname, client->pers.netname, decoloured );    }    else    {          G_LogPrintf( "ClientRename: %i [%s] (%s) /"%s^7/" -> /"%s^7/"%s/n", clientNum,             client->pers.ip, client->pers.guid, oldname, client->pers.netname, decoloured );    }      }      else      {      G_LogPrintf( "ClientRename: %i [%s] (%s) /"%s^7/" -> /"%s^7/"/n", clientNum,         client->pers.ip, client->pers.guid, oldname, client->pers.netname );      }      G_admin_namelog_update( client, qfalse );    }  }  // set max health  health = atoi( Info_ValueForKey( userinfo, "handicap" ) );  client->pers.maxHealth = health;  if( client->pers.maxHealth < 1 || client->pers.maxHealth > 100 )    client->pers.maxHealth = 100;  //hack to force a client update if the config string does not change between spawning  if( client->pers.classSelection == PCL_NONE )    client->pers.maxHealth = 0;  // set model  if( client->ps.stats[ STAT_PCLASS ] == PCL_HUMAN && BG_InventoryContainsUpgrade( UP_BATTLESUIT, client->ps.stats ) )  {
开发者ID:asker,项目名称:OmgHaxQVM,代码行数:67,


示例24: ClientUserinfoChanged

/*===========ClientUserInfoChangedCalled from ClientConnect when the player first connects anddirectly by the server system when the player updates a userinfo variable.The game can override any of the settings and call trap_SetUserinfoif desired.============*/void ClientUserinfoChanged(int clientNum) {	gentity_t *ent;	char      *s;	char      oldname[MAX_STRING_CHARS];	char      userinfo[MAX_INFO_STRING];	gclient_t *client;	char      *ip   = NULL; // Nico, used to store client ip	char      *rate   = NULL; // Nico, used to store client rate	char      *snaps   = NULL; // Nico, used to store client snaps	char      *name = NULL; // Nico, used to store client name	char      oldAuthToken[MAX_QPATH]; // Nico, used to see if auth token was changed	ent    = g_entities + clientNum;	client = ent->client;	client->ps.clientNum = clientNum;	// Nico, flood protection	if (ClientIsFlooding(ent)) {		G_LogPrintf("Dropping client %d: flooded userinfo/n", clientNum);		trap_DropClient(clientNum, "^1You were kicked because of flooded userinfo", 0);		return;	}	trap_GetUserinfo(clientNum, userinfo, sizeof (userinfo));	// Nico, perform security checks on userinfo string	if (!checkUserinfoString(clientNum, userinfo)) {		return;	}	if (g_developer.integer || *g_log.string || g_dedicated.integer) {		G_Printf("Userinfo: %s/n", userinfo);	}	// check for local client	ip = Info_ValueForKey(userinfo, "ip");	Q_strncpyz(client->pers.ip, ip, IP_MAX_LENGTH);	if (ip && !strcmp(ip, "localhost")) {		client->pers.localClient = qtrue;		level.fLocalHost         = qtrue;		client->sess.referee     = RL_REFEREE;	}	// Nico, store rate and snaps	rate = Info_ValueForKey(userinfo, "rate");	client->pers.rate = atoi(rate);	snaps = Info_ValueForKey(userinfo, "snaps");	client->pers.snaps = atoi(snaps);	// Nico, backup old auth token	Q_strncpyz(oldAuthToken, client->pers.authToken, sizeof (oldAuthToken));	s = Info_ValueForKey(userinfo, "cg_uinfo");	sscanf(s, "%i %i %i %i %s %i %i %i %i %i %i %i %i %i",	       &client->pers.clientFlags,	       &client->pers.clientTimeNudge,	       &client->pers.clientMaxPackets,	       // Nico, max FPS	       &client->pers.maxFPS,	       // Nico, auth Token	       (char *)&client->pers.authToken,	       // Nico, load view angles on load	       &client->pers.loadViewAngles,		   // Nico, load weapon on load	       &client->pers.loadWeapon,	       // Nico, load position when player dies	       &client->pers.autoLoad,	       // Nico, cgaz	       &client->pers.cgaz,	       // Nico, hideme	       &client->pers.hideme,	       // Nico, client auto demo record setting	       &client->pers.autoDemo,	       // Nico, automatically load checkpoints	       &client->pers.autoLoadCheckpoints,	       // Nico, persistant specLock	       (int *)&client->sess.specLocked,//.........这里部分代码省略.........
开发者ID:Exosum,项目名称:ETrun,代码行数:101,



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


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