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

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

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

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

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

示例1: TeleportPlayer

void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ){	// unlink to make sure it can't possibly interfere with G_KillBox	trap_UnlinkEntity( player );	VectorCopy( origin, player->client->ps.origin );	player->client->ps.origin[ 2 ] += 1;	// spit the player out	AngleVectors( angles, player->client->ps.velocity, NULL, NULL );	VectorScale( player->client->ps.velocity, 400, player->client->ps.velocity );	player->client->ps.pm_time = 160; // hold time	player->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	// toggle the teleport bit so the client knows to not lerp	player->client->ps.eFlags ^= EF_TELEPORT_BIT;	G_UnlaggedClear( player );	// cut all relevant zap beams	G_ClearPlayerZapEffects( player );	// set angles	G_SetClientViewAngle( player, angles );	// save results of pmove	BG_PlayerStateToEntityState( &player->client->ps, &player->s, qtrue );	// use the precise origin for linking	VectorCopy( player->client->ps.origin, player->r.currentOrigin );	if ( player->client->sess.spectatorState == SPECTATOR_NOT )	{		// kill anything at the destination		G_KillBox( player );		trap_LinkEntity( player );	}}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:38,


示例2: TeleportPlayer

void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ) {	gentity_t	*tent;	// use temp events at source and destination to prevent the effect	// from getting dropped by a second player event#ifndef SMOKINGUNS	if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {#else	if ( player->client->sess.sessionTeam < TEAM_SPECTATOR ) {#endif		tent = G_TempEntity( player->client->ps.origin, EV_PLAYER_TELEPORT_OUT );		tent->s.clientNum = player->s.clientNum;		tent = G_TempEntity( origin, EV_PLAYER_TELEPORT_IN );		tent->s.clientNum = player->s.clientNum;	}	// unlink to make sure it can't possibly interfere with G_KillBox	trap_UnlinkEntity (player);	VectorCopy ( origin, player->client->ps.origin );	player->client->ps.origin[2] += 1;	// spit the player out	AngleVectors( angles, player->client->ps.velocity, NULL, NULL );	VectorScale( player->client->ps.velocity, 400, player->client->ps.velocity );	player->client->ps.pm_time = 160;		// hold time	player->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	// toggle the teleport bit so the client knows to not lerp	player->client->ps.eFlags ^= EF_TELEPORT_BIT;#ifdef SMOKINGUNS//unlagged - backward reconciliation #3	// we don't want players being backward-reconciled back through teleporters	G_ResetHistory( player );//unlagged - backward reconciliation #3#endif	// set angles	SetClientViewAngle( player, angles );	// kill anything at the destination#ifndef SMOKINGUNS	if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {#else	if ( player->client->sess.sessionTeam < TEAM_SPECTATOR ) {#endif		G_KillBox (player);#ifdef SMOKINGUNS		// Tequila comment: G_KillBox will set dontTelefrag as needed		if (player->client->dontTelefrag) {#ifdef DEBUG_TELEFRAG_CASE			G_Printf(S_COLOR_MAGENTA "TeleportPlayer: Telefrag case delayed at respawn for %s.../n",player->client->pers.netname);#endif			trap_SendServerCommand( player->s.clientNum, va("print /"Go away %s/n/"",player->client->pers.netname) );			// So we will link the player entity later with normal content			player->r.contents = 0;		}#endif	}	// save results of pmove	BG_PlayerStateToEntityState( &player->client->ps, &player->s, qtrue );	// use the precise origin for linking	VectorCopy( player->client->ps.origin, player->r.currentOrigin );#ifndef SMOKINGUNS	if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {#else	if ( player->client->sess.sessionTeam < TEAM_SPECTATOR ) {#endif		trap_LinkEntity (player);	}}/*QUAKED misc_teleporter_dest (1 0 0) (-32 -32 -24) (32 32 -16)Point teleporters at these.Now that we don't have teleport destination pads, this is justan info_notnull*/void SP_misc_teleporter_dest( gentity_t *ent ) {}#ifdef SMOKINGUNS// Imported from WoP OpenSource project//===========================================================/*QUAKED misc_externalmodel (1 0 0) (-16 -16 -16) (16 16 16)"model"		arbitrary .md3 file to display"wait"		time in seconds before the animation begins*/#define ANIMATION_THINKTIME	50static void Think_AnimationExternalmodel( gentity_t *ent ) {	if(ent->animationEnd>ent->animationStart) {//.........这里部分代码省略.........
开发者ID:OADoctor,项目名称:SmokinGuns,代码行数:101,


示例3: CG_TransitionSnapshot

/*===================CG_TransitionSnapshotThe transition point from snap to nextSnap has passed===================*/static void CG_TransitionSnapshot( void ) {	centity_t			*cent;	snapshot_t			*oldFrame;	int					i, id;	if ( !cg.snap ) {		CG_Error( "CG_TransitionSnapshot: NULL cg.snap" );	}	if ( !cg.nextSnap ) {		CG_Error( "CG_TransitionSnapshot: NULL cg.nextSnap" );	}	// execute any server string commands before transitioning entities	CG_ExecuteNewServerCommands( cg.nextSnap->serverCommandSequence );	// if we had a map_restart, set everthing with initial		if ( !(cg.snap) || !(cg.nextSnap) ) {		return;	}	// rain - I hate doing things like this for enums.  Oh well.	memset(&oldValid, 0, sizeof(oldValid));	// clear the currentValid flag for all entities in the existing snapshot	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {		cent = &cg_entities[ cg.snap->entities[ i ].number ];		cent->currentValid = qfalse;		oldValid[cg.snap->entities[i].number] = qtrue;	}	// OSP -- check for MV updates from new snapshot info#ifdef MV_SUPPORT	if(cg.snap->ps.powerups[PW_MVCLIENTLIST] != cg.mvClientList) {		CG_mvProcessClientList();	}#endif	// move nextSnap to snap and do the transitions	oldFrame = cg.snap;	cg.snap = cg.nextSnap;	if( cg.snap->ps.clientNum == cg.clientNum ) {		if( cg.xp < cg.snap->ps.stats[STAT_XP] ) {			cg.xpChangeTime = cg.time;		}		cg.xp = cg.snap->ps.stats[STAT_XP];	}	BG_PlayerStateToEntityState( &cg.snap->ps, &cg_entities[ cg.snap->ps.clientNum ].currentState, qfalse );	cg_entities[ cg.snap->ps.clientNum ].interpolate = qfalse;	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {		id = cg.snap->entities[ i ].number;		CG_TransitionEntity( &cg_entities[ id ] );		// rain - #374 - ent doesn't exist in this frame, reset it.		// this is to fix the silent landmines bug, which is caused		// by a stale miscTime in the cent		if (cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue) {			CG_ResetEntity(&cg_entities[id]);		}		if(cg.mvTotalClients > 0 && CG_mvMergedClientLocate(id)) {			CG_mvUpdateClientInfo(id);		}	}	if(cg.mvTotalClients > 0) {		CG_mvTransitionPlayerState(&cg.snap->ps);	}	cg.nextSnap = NULL;	// check for playerstate transition events	if ( oldFrame ) {		playerState_t	*ops, *ps;		ops = &oldFrame->ps;		ps = &cg.snap->ps;		// teleporting checks are irrespective of prediction		if ( ( ps->eFlags ^ ops->eFlags ) & EF_TELEPORT_BIT ) {			cg.thisFrameTeleport = qtrue;	// will be cleared by prediction code		}		// if we are not doing client side movement prediction for any		// reason, then the client events and view changes will be issued now		if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW)			|| cg_nopredict.integer #ifdef ALLOW_GSYNC			|| cg_synchronousClients.integer #endif // ALLOW_GSYNC		) {//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,


示例4: jp_portal_touch

void jp_portal_touch( gentity_t *self, gentity_t *other, trace_t *trace ) {	//Remove the touch function for a while to avoid flooding	self->genericValue1 = level.time;	self->touch = NULL;	if ( self->s.health != -1 ) {		vector3 tpPos;		vector3 sourceVelocity, destVelocity;		vector3 sourceNormal, destNormal;		//Fetch normals		VectorCopy( &self->s.boneAngles1, &sourceNormal );		VectorCopy( &g_entities[self->s.health].s.boneAngles1, &destNormal );		//Set position to teleport to		VectorCopy( &g_entities[self->s.health].s.origin, &tpPos );		VectorMA( &tpPos, 32.0f, &destNormal, &tpPos );		//BEGIN position		if ( other->client ) {			qboolean isNPC = (other->s.eType == ET_NPC);			uint32_t eFlags = other->client->ps.eFlags ^ EF_TELEPORT_BIT;			VectorCopy( &tpPos, &other->client->ps.origin );			other->client->ps.origin.z += 1.0f;			SetClientViewAngle( other, &other->client->ps.viewangles );			other->client->ps.eFlags ^= EF_TELEPORT_BIT;			BG_PlayerStateToEntityState( &other->client->ps, &other->s, qtrue );			if ( isNPC )				other->s.eType = ET_NPC;			other->s.eFlags = eFlags;			VectorCopy( &other->client->ps.origin, &other->r.currentOrigin );		}		else {			VectorCopy( &tpPos, &other->s.pos.trBase );		}		//END position		//BEGIN velocity		if ( other->client ) {//Players and NPCs			float	reflectFactor;			vector3	exitVector;			vector3	velNormal;			float	length;			vector3	debugLine;			VectorNormalize2( &other->client->ps.velocity, &velNormal );			reflectFactor = 2 * DotProduct( &sourceNormal, &velNormal );			VectorCopy( &other->client->ps.velocity, &sourceVelocity );			length = VectorLength( &sourceVelocity );			exitVector.x = velNormal.x - reflectFactor * sourceNormal.x;			exitVector.y = velNormal.y - reflectFactor * sourceNormal.y;			exitVector.z = velNormal.z - reflectFactor * sourceNormal.z;			VectorMA( &self->s.origin, -128.0f, &velNormal, &debugLine );			G_TestLine( &debugLine, &self->s.origin, 0xF0, 7500 );			MatrixMultiply3f( self->portal_matrix, &exitVector, &destVelocity );			VectorMA( &g_entities[self->s.health].s.origin, 128.0f, &destVelocity, &debugLine );			G_TestLine( &g_entities[self->s.health].s.origin, &debugLine, 0x0F, 7500 );			VectorScale( &destVelocity, length, &destVelocity );		}		else {//Projectiles			byteAlias_t ba;			float velocity;			ba.i = other->genericValue1; // stored during missile creation			velocity = ba.f;			//	VectorScale( destNormal, velocity, other->s.pos.trDelta );			VectorMA( &other->s.pos.trBase, velocity, &destNormal, &other->s.pos.trDelta );			other->s.pos.trTime = level.time;			other->nextthink = level.time + other->genericValue2;		}		//VectorSet( destVelocity, destNormal.x*speed, destNormal.y*speed, destNormal.z*speed );		if ( other->client ) {//Players and NPCs			VectorCopy( &destVelocity, &other->client->ps.velocity );			other->client->ps.pm_flags |= PMF_DUCKED;			other->s.solid = 0;		}		else {//Projectiles			VectorCopy( &destVelocity, &other->s.pos.trDelta );			VectorCopy( &tpPos, &other->r.currentOrigin );		}		//END velocity		g_entities[self->s.health].genericValue1 = level.time;		g_entities[self->s.health].touch = NULL;	}	return;}
开发者ID:Blackwolf1337,项目名称:japp,代码行数:93,


示例5: ClientEndFrame

/*==============ClientEndFrameCalled at the end of each server frame for each connected clientA fast client will have multiple ClientThink for each ClientEndFrame,while a slow client may have multiple ClientEndFrame between ClientThink.==============*/void ClientEndFrame(gentity_t *ent) {	int i;	// Nico, flood protection	if (level.time >= (ent->client->sess.nextReliableTime + 1000) &&	    ent->client->sess.numReliableCmds) {		ent->client->sess.numReliableCmds--;		// Reset the threshold because they were good for a bit		if (!ent->client->sess.numReliableCmds) {			ent->client->sess.thresholdTime = 0;		}	}	// Nico, update best speeds	if (ent->client->sess.timerunActive) {		float currentSpeed;		currentSpeed = sqrt(ent->client->ps.velocity[0] * ent->client->ps.velocity[0] + ent->client->ps.velocity[1] * ent->client->ps.velocity[1]);		// Nico, update overall max speed		if (currentSpeed > ent->client->sess.overallMaxSpeed) {			ent->client->sess.overallMaxSpeed = currentSpeed;		}		// Nico, update max speed of the current run		if (currentSpeed > ent->client->sess.maxSpeed) {			ent->client->sess.maxSpeed = currentSpeed;		}	}	// used for informing of speclocked teams.	// Zero out here and set only for certain specs	ent->client->ps.powerups[PW_BLACKOUT] = 0;	if ((ent->client->sess.sessionTeam == TEAM_SPECTATOR) || (ent->client->ps.pm_flags & PMF_LIMBO)) {       // JPW NERVE		SpectatorClientEndFrame(ent);		return;	}	// turn off any expired powerups	// OSP -- range changed for MV	for (i = 0 ; i < PW_NUM_POWERUPS ; ++i) {		if (i == PW_FIRE ||                 // these aren't dependant on level.time		    i == PW_ELECTRIC ||		    i == PW_BREATHER ||		    ent->client->ps.powerups[i] == 0            // OSP		    || i == PW_OPS_CLASS_1		    || i == PW_OPS_CLASS_2		    || i == PW_OPS_CLASS_3		    ) {			continue;		}		// OSP -- If we're paused, update powerup timers accordingly.		// Make sure we dont let stuff like CTF flags expire.		if (ent->client->ps.powerups[i] < level.time) {			ent->client->ps.powerups[i] = 0;		}	}	//	// If the end of unit layout is displayed, don't give	// the player any normal movement attributes	//	// burn from lava, etc	P_WorldEffects(ent);	// apply all the damage taken this frame	P_DamageFeedback(ent);	// add the EF_CONNECTION flag if we haven't gotten commands recently	if (level.time - ent->client->lastCmdTime > 1000) {		ent->s.eFlags |= EF_CONNECTION;	} else {		ent->s.eFlags &= ~EF_CONNECTION;	}	ent->client->ps.stats[STAT_HEALTH] = ent->health;   // FIXME: get rid of ent->health...	                                                    // Gordon: WHY? other ents use it.	G_SetClientSound(ent);	// set the latest infor	// Ridah, fixes jittery zombie movement	if (g_smoothClients.integer) {		BG_PlayerStateToEntityStateExtraPolate(&ent->client->ps, &ent->s, level.time, qfalse);//.........这里部分代码省略.........
开发者ID:ETrun,项目名称:ETrun,代码行数:101,


示例6: ClientEndFrame

/*==============ClientEndFrameCalled at the end of each server frame for each connected clientA fast client will have multiple ClientThink for each ClientEdFrame,while a slow client may have multiple ClientEndFrame between ClientThink.==============*/void ClientEndFrame(gentity_t * ent){	int i, frames;//	clientPersistant_t *pers;	if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {		SpectatorClientEndFrame(ent);		return;	}//	pers = &ent->client->pers;	// turn off any expired powerups	for (i = 0; i < MAX_POWERUPS; i++) {		if (ent->client->ps.powerups[i] < level.time) {			ent->client->ps.powerups[i] = 0;		}	}	// save network bandwidth#if 0	if (!g_synchronousClients->integer && ent->client->ps.pm_type == PM_NORMAL) {		// FIXME: this must change eventually for non-sync demo recording		VectorClear(ent->client->ps.viewangles);	}#endif	//	// If the end of unit layout is displayed, don't give	// the player any normal movement attributes	//	if (level.intermissiontime) {		return;	}	if (ent->client->bleeding)		CheckBleeding(ent);	// perform once-a-second actions	// burn from lava, etc	P_WorldEffects(ent);	// apply all the damage taken this frame	P_DamageFeedback(ent);	// Update the clips Amount in weapon for the client	ent->client->ps.stats[STAT_CLIPS] = ent->client->numClips[ent->client->ps.weapon];	ent->client->ps.stats[STAT_HEALTH] = ent->health;	// FIXME: get rid of ent->health...	//Elder: bleeding notification	if (ent->client->bleeding || (ent->client->ps.stats[STAT_RQ3] & RQ3_LEGDAMAGE) == RQ3_LEGDAMAGE) {		ent->client->ps.stats[STAT_RQ3] |= RQ3_BANDAGE_NEED;	} else {		ent->client->ps.stats[STAT_RQ3] &= ~RQ3_BANDAGE_NEED;	}	//Moved to pmove.c	//Elder: M4 ride-up/kick -- condition for non-burst and ammo only	if (ent->client->consecutiveShots &&	    (ent->client->ps.ammo[WP_M4] <= 0 || ent->client->ps.weaponstate != WEAPON_FIRING)) {		//Restore view after shots if not firing		ent->client->ps.delta_angles[0] =		    ANGLE2SHORT(SHORT2ANGLE(ent->client->ps.delta_angles[0]) - ent->client->consecutiveShots * -0.8);//-0.7f);		ent->client->consecutiveShots = 0;	}	// Check to reset our openDoor boolean	if (ent->client->openDoorTime && level.time - ent->client->openDoorTime > MAXDOORTIME) {		ent->client->openDoor = qfalse;		ent->client->openDoorTime = 0;	}	// JBravo: multiple items	if (ent->client->ps.stats[STAT_HOLDABLE_ITEM] & (1 << HI_LASER)) {		//Try to turn the laser on if it's off		if (ent->client->lasersight == NULL)			Laser_Gen(ent, qtrue);	}	//Slicer	if (ent->client->weapon_attempts > 0)		Cmd_Weapon(ent);	G_SetClientSound(ent);	BG_PlayerStateToEntityState(&ent->client->ps, &ent->s, qtrue);	SendPendingPredictableEvents(&ent->client->ps);	// JBravo: unlagged	ent->client->ps.eFlags &= ~EF_CONNECTION;	frames = level.framenum - ent->client->lastUpdateFrame - 1;	if (frames > 2) {		frames = 2;		ent->client->ps.eFlags |= EF_CONNECTION;//.........这里部分代码省略.........
开发者ID:Zekom,项目名称:reaction,代码行数:101,


示例7: ClientSpawn

//.........这里部分代码省略.........			}			G_AddPredictableEvent( ent, EV_PLAYER_RESPAWN, 0 );		}	}	else if ( client->sess.spectatorState == SPECTATOR_NOT &&	          client->pers.team == TEAM_HUMANS )	{		spawn_angles[ YAW ] += 180.0f;		AngleNormalize360( spawn_angles[ YAW ] );	}	// the respawned flag will be cleared after the attack and jump keys come up	client->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );	G_SetClientViewAngle( ent, spawn_angles );	if ( client->sess.spectatorState == SPECTATOR_NOT )	{		trap_LinkEntity( ent );		// force the base weapon up		if ( client->pers.team == TEAM_HUMANS )		{			G_ForceWeaponChange( ent, weapon );		}		client->ps.weaponstate = WEAPON_READY;	}	// don't allow full run speed for a bit	client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	client->ps.pm_time = 100;	client->respawnTime = level.time;	ent->nextRegenTime = level.time;	client->inactivityTime = level.time + g_inactivity.integer * 1000;	usercmdClearButtons( client->latched_buttons );	// set default animations	client->ps.torsoAnim = TORSO_STAND;	client->ps.legsAnim = LEGS_IDLE;	if ( level.intermissiontime )	{		MoveClientToIntermission( ent );	}	else	{		// fire the targets of the spawn point		if ( !spawn && spawnPoint )		{			G_EventFireEntity( spawnPoint, ent, ON_SPAWN );		}		// select the highest weapon number available, after any		// spawn given items have fired		client->ps.weapon = 1;		for ( i = WP_NUM_WEAPONS - 1; i > 0; i-- )		{			if ( BG_InventoryContainsWeapon( i, client->ps.stats ) )			{				client->ps.weapon = i;				break;			}		}	}	// run a client frame to drop exactly to the floor,	// initialize animations and other things	client->ps.commandTime = level.time - 100;	ent->client->pers.cmd.serverTime = level.time;	ClientThink( ent - g_entities );	// positively link the client, even if the command times are weird	if ( client->sess.spectatorState == SPECTATOR_NOT )	{		BG_PlayerStateToEntityState( &client->ps, &ent->s, true );		VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );		trap_LinkEntity( ent );	}	// must do this here so the number of active clients is calculated	CalculateRanks();	// run the presend to set anything else	ClientEndFrame( ent );	// clear entity state values	BG_PlayerStateToEntityState( &client->ps, &ent->s, true );	client->pers.infoChangeTime = level.time;	// (re)tag the client for its team	Beacon::DeleteTags( ent );	Beacon::Tag( ent, (team_t)ent->client->ps.persistant[ PERS_TEAM ], true );}
开发者ID:t4im,项目名称:Unvanquished,代码行数:101,


示例8: CG_SetInitialSnapshot

/*==================CG_SetInitialSnapshotThis will only happen on the very first snapshot, oron tourney restarts.  All other times will useCG_TransitionSnapshot instead.FIXME: Also called by map_restart?==================*/void CG_SetInitialSnapshot(snapshot_t *snap){	int           i;	centity_t     *cent;	entityState_t *state;	char          buff[16];	cg.snap = snap;	//  trap_S_ClearSounds( qtrue );	BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, cg.time, qfalse);	// sort out solid entities	CG_BuildSolidList();	CG_ExecuteNewServerCommands(snap->serverCommandSequence);	// set our local weapon selection pointer to	// what the server has indicated the current weapon is	CG_Respawn(qfalse);	for (i = 0 ; i < cg.snap->numEntities ; i++)	{		state = &cg.snap->entities[i];		cent  = &cg_entities[state->number];		memcpy(&cent->currentState, state, sizeof(entityState_t));		//cent->currentState = *state;		cent->interpolate  = qfalse;		cent->currentValid = qtrue;		CG_ResetEntity(cent);		// check for events		CG_CheckEvents(cent);	}	trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof(buff));	if (atoi(buff))	{		// confirmation screen		trap_UI_Popup(UIMENU_INGAME);	}	else if (cg.demoPlayback)	{		ccInitial = qtrue;	}	else	{		static char prevmap[64] = { 0 };		char        curmap[64];		trap_Cvar_VariableStringBuffer("mapname", curmap, 64);		if (Q_stricmp(curmap, prevmap))		{			strcpy(prevmap, curmap);			if (cgs.campaignInfoLoaded)			{				if (!cg.showGameView)				{					CG_LimboMenu_f();				}				/*          } else {				                ccInitial = qtrue;				                // Start the Initial Camera if specified				                CG_StartInitialCamera(); */			}		}	}	// remove motd window	if (cg.motdWindow != NULL)	{		CG_windowFree(cg.motdWindow);		cg.motdWindow = NULL;	}	// Activate alternate input handler during demo playback	if (cg.demoPlayback)	{		CG_keyOn_f();		if (demo_infoWindow.integer > 0)		{			CG_ShowHelp_On(&cg.demohelpWindow);		}	}//.........这里部分代码省略.........
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:101,


示例9: ClientThink_real

//.........这里部分代码省略.........		{			ItemUse_Binoculars(ent);			if (ent->client->ps.zoomMode == 0)			{				G_AddEvent(ent, EV_USE_ITEM0+HI_BINOCULARS, 1);			}			else			{				G_AddEvent(ent, EV_USE_ITEM0+HI_BINOCULARS, 2);			}		}		break;	case GENCMD_USE_SENTRY:		if ( (ent->client->ps.stats[STAT_HOLDABLE_ITEMS] & (1 << HI_SENTRY_GUN)) &&			G_ItemUsable(&ent->client->ps, HI_SENTRY_GUN) )		{			ItemUse_Sentry(ent);			G_AddEvent(ent, EV_USE_ITEM0+HI_SENTRY_GUN, 0);			ent->client->ps.stats[STAT_HOLDABLE_ITEMS] &= ~(1 << HI_SENTRY_GUN);		}		break;	case GENCMD_SABERATTACKCYCLE:		Cmd_SaberAttackCycle_f(ent);		break;	default:		break;	}	// save results of pmove	if ( ent->client->ps.eventSequence != oldEventSequence ) {		ent->eventTime = level.time;	}	if (g_smoothClients.integer) {		BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue );	}	else {		BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );	}	SendPendingPredictableEvents( &ent->client->ps );	if ( !( ent->client->ps.eFlags & EF_FIRING ) ) {		client->fireHeld = qfalse;		// for grapple	}	// use the snapped origin for linking so it matches client predicted versions	VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );	VectorCopy (pm.mins, ent->r.mins);	VectorCopy (pm.maxs, ent->r.maxs);	ent->waterlevel = pm.waterlevel;	ent->watertype = pm.watertype;	// execute client events	ClientEvents( ent, oldEventSequence );	if ( pm.useEvent )	{		//TODO: Use//		TryUse( ent );	}	// link entity now, after any personal teleporters have been used	trap_LinkEntity (ent);	if ( !ent->client->noclip ) {		G_TouchTriggers( ent );
开发者ID:Boothand,项目名称:jk2mp,代码行数:67,


示例10: ClientEndFrame

/*==============ClientEndFrameCalled at the end of each server frame for each connected clientA fast client will have multiple ClientThink for each ClientEdFrame,while a slow client may have multiple ClientEndFrame between ClientThink.==============*/void ClientEndFrame( gentity_t *ent ) {	int			i;	clientPersistant_t	*pers;	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {		SpectatorClientEndFrame( ent );		return;	}	pers = &ent->client->pers;	// turn off any expired powerups	for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {		if ( ent->client->ps.powerups[ i ] < level.time ) {			ent->client->ps.powerups[ i ] = 0;		}	}	// save network bandwidth#if 0	if ( !g_synchronousClients->integer && (ent->client->ps.pm_type == PM_NORMAL || ent->client->ps.pm_type == PM_FLOAT) ) {		// FIXME: this must change eventually for non-sync demo recording		VectorClear( ent->client->ps.viewangles );	}#endif	//	// If the end of unit layout is displayed, don't give	// the player any normal movement attributes	//	if ( level.intermissiontime ) {		return;	}	// burn from lava, etc	P_WorldEffects (ent);	// apply all the damage taken this frame	P_DamageFeedback (ent);	// add the EF_CONNECTION flag if we haven't gotten commands recently	if ( level.time - ent->client->lastCmdTime > 1000 ) {		ent->s.eFlags |= EF_CONNECTION;	} else {		ent->s.eFlags &= ~EF_CONNECTION;	}	ent->client->ps.stats[STAT_HEALTH] = ent->health;	// FIXME: get rid of ent->health...	G_SetClientSound (ent);	// set the latest infor	if (g_smoothClients.integer) {		BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue );	}	else {		BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );	}	SendPendingPredictableEvents( &ent->client->ps );	// set the bit for the reachability area the client is currently in//	i = trap_AAS_PointReachabilityAreaIndex( ent->client->ps.origin );//	ent->client->areabits[i >> 3] |= 1 << (i & 7);}
开发者ID:Boothand,项目名称:jk2mp,代码行数:73,


示例11: ClientThink_real

//.........这里部分代码省略.........  pm.cmd = *ucmd;  if( pm.ps->pm_type == PM_DEAD )    pm.tracemask = MASK_PLAYERSOLID; // & ~CONTENTS_BODY;  if( pm.ps->stats[ STAT_STATE ] & SS_INFESTING ||      pm.ps->stats[ STAT_STATE ] & SS_HOVELING )    pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY;  else    pm.tracemask = MASK_PLAYERSOLID;  pm.trace = trap_Trace;  pm.pointcontents = trap_PointContents;  pm.debugLevel = g_debugMove.integer;  pm.noFootsteps = (qboolean)0;  pm.pmove_fixed = pmove_fixed.integer | client->pers.pmoveFixed;  pm.pmove_msec = pmove_msec.integer;  VectorCopy( client->ps.origin, client->oldOrigin );  // moved from after Pmove -- potentially the cause of  // future triggering bugs  if( !ent->client->noclip )    G_TouchTriggers( ent );  Pmove( &pm );  // save results of pmove  if( ent->client->ps.eventSequence != oldEventSequence )    ent->eventTime = level.time;  if( g_smoothClients.integer )    BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue );  else    BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );  SendPendingPredictableEvents( &ent->client->ps );  if( !( ent->client->ps.eFlags & EF_FIRING ) )    client->fireHeld = qfalse;    // for grapple  if( !( ent->client->ps.eFlags & EF_FIRING2 ) )    client->fire2Held = qfalse;  // use the snapped origin for linking so it matches client predicted versions  VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );  VectorCopy( pm.mins, ent->r.mins );  VectorCopy( pm.maxs, ent->r.maxs );  ent->waterlevel = pm.waterlevel;  ent->watertype = pm.watertype;  // execute client events  ClientEvents( ent, oldEventSequence );  // link entity now, after any personal teleporters have been used  trap_LinkEntity( ent );  // NOTE: now copy the exact origin over otherwise clients can be snapped into solid  VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );  VectorCopy( ent->client->ps.origin, ent->s.origin );  // touch other objects  ClientImpacts( ent, &pm );
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:66,


示例12: CG_DemosDrawActiveFrame

//.........这里部分代码省略.........		cg.rewardStack = 0;		cg.rewardTime = 0;		trap_S_ClearLoopingSounds(qtrue);				for (i = 0; i < MAX_CHATBOX_ITEMS; i++)			cg.chatItems[i].time = 0;	} else if (cg.frametime > 100) {		hadSkip = qtrue;	} else {		hadSkip = qfalse;	}	/* Make sure the random seed is the same each time we hit this frame */	srand( (cg.time % 10000000) + cg.timeFraction * 1000);	/* Prepare to render the screen */			trap_S_ClearLoopingSounds(qfalse);	trap_R_ClearScene();	/* Update demo related information */	trap_SetUserCmdValue( cg.weaponSelect, 1 );	demoProcessSnapShots( hadSkip );	if ( !cg.snap ) {		CG_DrawInformation();		return;	}	CG_PreparePacketEntities( );	CG_DemosUpdatePlayer( );	chaseUpdate( demo.play.time, demo.play.fraction );	cameraUpdate( demo.play.time, demo.play.fraction );	dofUpdate( demo.play.time, demo.play.fraction );	demoEffectUpdate( demo.play.time, demo.play.fraction );	cg.clientFrame++;	// update cg.predictedPlayerState	CG_InterpolatePlayerState( qfalse );	BG_PlayerStateToEntityState( &cg.predictedPlayerState, &cg.predictedPlayerEntity.currentState, qfalse );	if ( cg.cpma.detected ) {		if ( cg.predictedPlayerState.pm_type >= 4 )			cg.predictedPlayerEntity.currentState.eType = ET_INVISIBLE;	}	cg.predictedPlayerEntity.currentValid = qtrue;	VectorCopy( cg.predictedPlayerEntity.currentState.pos.trBase, cg.predictedPlayerEntity.lerpOrigin );	VectorCopy( cg.predictedPlayerEntity.currentState.apos.trBase, cg.predictedPlayerEntity.lerpAngles );	inwater = demoSetupView();	CG_TileClear();	trap_FX_Begin( cg.time, cg.timeFraction );	scriptRun( hadSkip );	CG_AddPacketEntities();	CG_AddMarks();	CG_AddParticles ();	CG_AddLocalEntities();		if ( cg.playerCent == &cg.predictedPlayerEntity ) {		// warning sounds when powerup is wearing off		CG_PowerupTimerSounds();		CG_AddViewWeapon( &cg.predictedPlayerState  );	} else if ( cg.playerCent && cg.playerCent->currentState.number < MAX_CLIENTS )  {		CG_AddViewWeaponDirect( cg.playerCent );	}	trap_S_UpdateEntityPosition(ENTITYNUM_NONE, cg.refdef.vieworg);	CG_PlayBufferedSounds();	CG_PlayBufferedVoiceChats();			cg.refdef.time = cg.time;	memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) );
开发者ID:entdark,项目名称:q3mme,代码行数:67,


示例13: demoProcessSnapShots

void demoProcessSnapShots( qboolean hadSkip ) {	int i;	snapshot_t		*snap;	// see what the latest snapshot the client system has is	trap_GetCurrentSnapshotNumber( &cg.latestSnapshotNum, &cg.latestSnapshotTime );	if (hadSkip || !cg.snap) {		cgs.processedSnapshotNum = max(cg.latestSnapshotNum - 3, -1);		if (cg.nextSnap)			cgs.serverCommandSequence = cg.nextSnap->serverCommandSequence;		else if (cg.snap)			cgs.serverCommandSequence = cg.snap->serverCommandSequence;		cg.snap = 0;		cg.nextSnap = 0;		cg.nextNextSnap = 0;		for (i=-1;i<MAX_GENTITIES;i++) {			centity_t *cent = i < 0 ? &cg.predictedPlayerEntity : &cg_entities[i];			cent->trailTime = cg.time;			cent->snapShotTime = cg.time;			cent->currentValid = qfalse;			cent->interpolate = qfalse;			cent->muzzleFlashTime = cg.time - MUZZLE_FLASH_TIME - 1;			cent->previousEvent = 0;			if (cent->currentState.eType == ET_PLAYER) {				memset( &cent->pe, 0, sizeof( cent->pe ) );				cent->pe.legs.yawAngle = cent->lerpAngles[YAW];				cent->pe.torso.yawAngle = cent->lerpAngles[YAW];				cent->pe.torso.pitchAngle = cent->lerpAngles[PITCH];			}		}	}	/* Check if we have some transition between snapsnots */	if (!cg.snap) {		entityState_t pes;		snap = CG_ReadNextSnapshot();		if (!snap)			return;		cg.snap = snap;		BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse );		CG_BuildSolidList();		CG_ExecuteNewServerCommands( snap->serverCommandSequence );		CG_UpdateTps( snap, qtrue );		BG_PlayerStateToEntityStateExtraPolate( &snap->ps, &pes, snap->ps.commandTime, qfalse );		CG_AddToHistory( snap->serverTime, &pes, &cg_entities[snap->ps.clientNum] );		for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {			entityState_t *state = &cg.snap->entities[ i ];			centity_t *cent = &cg_entities[ state->number ];			memcpy(&cent->currentState, state, sizeof(entityState_t));			cent->interpolate = qfalse;			cent->currentValid = qtrue;			CG_AddToHistory( snap->serverTime, state, cent );			if (cent->currentState.eType > ET_EVENTS)				cent->previousEvent = 1;			else 				cent->previousEvent = cent->currentState.event;		}	}	do {		if (!cg.nextSnap) {			snap = CG_ReadNextSnapshot();			if (!snap)				break;			CG_SetNextSnap( snap );		}		if ( !cg.nextNextSnap ) {			snap = CG_ReadNextSnapshot();			if ( !snap )				break;			CG_SetNextNextSnap( snap );		}		if ( cg.timeFraction >= cg.snap->serverTime - cg.time && cg.timeFraction < cg.nextSnap->serverTime - cg.time )			break;		//Todo our own transition checking if we wanna hear certain sounds		CG_TransitionSnapshot();	} while (1);}
开发者ID:entdark,项目名称:q3mme,代码行数:78,


示例14: ClientSpawn

//.........这里部分代码省略.........	//rww - Set here to initialize the circling seeker drone to off.	//A quick note about this so I don't forget how it works again:	//ps.genericEnemyIndex is kept in sync between the server and client.	//When it gets set then an entitystate value of the same name gets	//set along with an entitystate flag in the shared bg code. Which	//is why a value needs to be both on the player state and entity state.	//(it doesn't seem to just carry over the entitystate value automatically	//because entity state value is derived from player state data or some	//such)	client->ps.genericEnemyIndex = -1;	client->ps.isJediMaster = qfalse;	client->ps.fallingToDeath = 0;	//Do per-spawn force power initialization	WP_SpawnInitForcePowers( ent );	// health will count down towards max_health	ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH];// * 1.25;		Boot - no extra 25 hp on start.	// Start with a small amount of armor as well.	client->ps.stats[STAT_ARMOR] = client->ps.stats[STAT_MAX_HEALTH] * 0.25;	G_SetOrigin( ent, spawn_origin );	VectorCopy( spawn_origin, client->ps.origin );	// the respawned flag will be cleared after the attack and jump keys come up	client->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );	SetClientViewAngle( ent, spawn_angles );	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {	} else {		G_KillBox( ent );		trap_LinkEntity (ent);		// force the base weapon up		client->ps.weapon = WP_BRYAR_PISTOL;		client->ps.weaponstate = FIRST_WEAPON;	}	// don't allow full run speed for a bit	client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	client->ps.pm_time = 100;	client->respawnTime = level.time;	client->inactivityTime = level.time + g_inactivity.integer * 1000;	client->latched_buttons = 0;	// set default animations	client->ps.torsoAnim = WeaponReadyAnim[client->ps.weapon];	client->ps.legsAnim = WeaponReadyAnim[client->ps.weapon];	if ( level.intermissiontime ) {		MoveClientToIntermission( ent );	} else {		// fire the targets of the spawn point		G_UseTargets( spawnPoint, ent );		// select the highest weapon number available, after any		// spawn given items have fired		client->ps.weapon = 1;		for ( i = WP_NUM_WEAPONS - 1 ; i > 0 ; i-- ) {			if ( client->ps.stats[STAT_WEAPONS] & ( 1 << i ) ) {				client->ps.weapon = i;				break;			}		}	}	// run a client frame to drop exactly to the floor,	// initialize animations and other things	client->ps.commandTime = level.time - 100;	ent->client->pers.cmd.serverTime = level.time;	ClientThink( ent-g_entities );	// positively link the client, even if the command times are weird	if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {		BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );		VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );		trap_LinkEntity( ent );	}	if (g_spawnInvulnerability.integer)	{		ent->client->ps.eFlags |= EF_INVULNERABLE;		ent->client->invulnerableTimer = level.time + g_spawnInvulnerability.integer;	}	// run the presend to set anything else	ClientEndFrame( ent );	// clear entity state values	BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );}
开发者ID:Boothand,项目名称:SaberShenanigans,代码行数:101,


示例15: ClientSpawn

//.........这里部分代码省略.........	client->ps.stats[STAT_INFOCLIENT] = -1;	client->pers = saved;	client->sess = savedSess;	client->ps.ping = savedPing;//	client->areabits = savedAreaBits;	client->accuracy_hits = accuracy_hits;	client->accuracy_shots = accuracy_shots;	client->lastkilled_client = -1;	client->airOutTime = level.time + 12000;	trap_GetUserinfo( index, userinfo, sizeof(userinfo) );	// set max health	client->pers.maxHealth = atoi( Info_ValueForKey( userinfo, "handicap" ) );	if ( client->pers.maxHealth < 1 || client->pers.maxHealth > 100 ) {		client->pers.maxHealth = 100;	}	// clear entity values	client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;	ent->s.eFlags = flags;	ent->s.groundEntityNum = ENTITYNUM_NONE;	ent->client = &level.clients[index];	ent->takedamage = qtrue;	ent->inuse = qtrue;	ent->classname = "player";	ent->r.contents = CONTENTS_BODY;	ent->clipmask = MASK_PLAYERSOLID;	ent->die = player_die;	ent->waterlevel = 0;	ent->watertype = 0;	ent->flags = 0;		VectorCopy (playerMins, ent->r.mins);	VectorCopy (playerMaxs, ent->r.maxs);	client->ps.clientNum = index;	// health will count down towards max_health	ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH] + 25;	G_SetOrigin( ent, spawn_origin );	VectorCopy( spawn_origin, client->ps.origin );	// the respawned flag will be cleared after the attack and jump keys come up	client->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );	SetClientViewAngle( ent, spawn_angles );	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {	} else {		G_KillBox( ent );		trap_LinkEntity (ent);		}	// don't allow full run speed for a bit	client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	client->ps.pm_time = 100;	client->respawnTime = level.time;	client->inactivityTime = level.time + g_inactivity.integer * 1000;	client->latched_buttons = 0;	if ( level.intermissiontime ) {		MoveClientToIntermission( ent );	} else {		// fire the targets of the spawn point		G_UseTargets( spawnPoint, ent );	}	// run a client frame to drop exactly to the floor,	// initialize animations and other things	client->ps.commandTime = level.time - 100;	ent->client->pers.cmd.serverTime = level.time;	ClientThink( ent-g_entities );	// positively link the client, even if the command times are weird	if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {		BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );		VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );		trap_LinkEntity( ent );	}	// run the presend to set anything else	ClientEndFrame( ent );	// clear entity state values	BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );	ent->s.modelindex = G_ModelIndex("models/human/coxswain.tik");}
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:101,


示例16: CG_SetInitialSnapshot

/*==================CG_SetInitialSnapshotThis will only happen on the very first snapshot, oron tourney restarts.  All other times will useCG_TransitionSnapshot instead.==================*/void CG_SetInitialSnapshot(snapshot_t *snap) {	int       i;	centity_t *cent;	char      buff[16];	cg.snap = snap;	BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse);	// sort out solid entities	CG_BuildSolidList();	CG_ExecuteNewServerCommands(snap->serverCommandSequence);	// set our local weapon selection pointer to	// what the server has indicated the current weapon is	CG_Respawn();	for (i = 0 ; i < cg.snap->numEntities ; ++i) {		entityState_t *state = &cg.snap->entities[i];		cent = &cg_entities[state->number];		memcpy(&cent->currentState, state, sizeof (entityState_t));		cent->interpolate  = qfalse;		cent->currentValid = qtrue;		CG_ResetEntity(cent);		// check for events		CG_CheckEvents(cent);	}	cg_fxflags = 0;	trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof (buff));	if (atoi(buff)) {		// Arnout: confirmation screen		trap_UI_Popup(UIMENU_INGAME);	} else if (!cg.demoPlayback) {		static char prevmap[64] = { 0 };		char        curmap[64];		trap_Cvar_VariableStringBuffer("mapname", curmap, 64);		if (Q_stricmp(curmap, prevmap)) {			strcpy(prevmap, curmap);			if (cgs.campaignInfoLoaded) {				if (!cg.showGameView) {					CG_LimboMenu_f();				}			}		}	}	// OSP - remove motd window	if (cg.motdWindow != NULL) {		CG_windowFree(cg.motdWindow);		cg.motdWindow = NULL;	}	// Activate alternate input handler during demo playback	if (cg.demoPlayback) {		CG_keyOn_f();		if (demo_infoWindow.integer > 0) {			CG_ShowHelp_On(&cg.demohelpWindow);		}	}}
开发者ID:boutetnico,项目名称:ETrun,代码行数:77,


示例17: CG_TransitionSnapshot

/*===================CG_TransitionSnapshotThe transition point from snap to nextSnap has passed===================*/static void CG_TransitionSnapshot(void) {	snapshot_t *oldFrame;	int        i;	if (!cg.snap) {		CG_Error("CG_TransitionSnapshot: NULL cg.snap");	}	if (!cg.nextSnap) {		CG_Error("CG_TransitionSnapshot: NULL cg.nextSnap");	}	// execute any server string commands before transitioning entities	CG_ExecuteNewServerCommands(cg.nextSnap->serverCommandSequence);	// if we had a map_restart, set everthing with initial	if (!cg.snap || !cg.nextSnap) {		return;	}	// rain - I hate doing things like this for enums.  Oh well.	memset(&oldValid, 0, sizeof (oldValid));	// clear the currentValid flag for all entities in the existing snapshot	for (i = 0 ; i < cg.snap->numEntities ; ++i) {		centity_t *cent = &cg_entities[cg.snap->entities[i].number];		cent->currentValid                    = qfalse;		oldValid[cg.snap->entities[i].number] = qtrue;	}	// move nextSnap to snap and do the transitions	oldFrame = cg.snap;	cg.snap  = cg.nextSnap;	BG_PlayerStateToEntityState(&cg.snap->ps, &cg_entities[cg.snap->ps.clientNum].currentState, qfalse);	cg_entities[cg.snap->ps.clientNum].interpolate = qfalse;	for (i = 0 ; i < cg.snap->numEntities ; ++i) {		int id = cg.snap->entities[i].number;		CG_TransitionEntity(&cg_entities[id]);		// rain - #374 - ent doesn't exist in this frame, reset it.		// this is to fix the silent landmines bug, which is caused		// by a stale miscTime in the cent		if (cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue) {			CG_ResetEntity(&cg_entities[id]);		}	}	cg.nextSnap = NULL;	// check for playerstate transition events	if (oldFrame) {		playerState_t *ops, *ps;		ops = &oldFrame->ps;		ps  = &cg.snap->ps;		// teleporting checks are irrespective of prediction		if ((ps->eFlags ^ ops->eFlags) & EF_TELEPORT_BIT) {			cg.thisFrameTeleport = qtrue;   // will be cleared by prediction code		}		// if we are not doing client side movement prediction for any		// reason, then the client events and view changes will be issued now		if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW)		    || cg_nopredict.integer) {			CG_TransitionPlayerState(ps, ops);		}	}}
开发者ID:boutetnico,项目名称:ETrun,代码行数:77,


示例18: PlayerSpawn

//.........这里部分代码省略.........	ent->clipmask = MASK_PLAYERSOLID;	ent->die = player_die;	ent->waterlevel = 0;	ent->watertype = 0;	ent->flags = 0;	ent->player->headless = qfalse;		VectorCopy (playerMins, player->ps.mins);	VectorCopy (playerMaxs, player->ps.maxs);	player->ps.playerNum = index;	if ( g_instaGib.integer == 1 ) {		startWeapon = WP_RAILGUN;		startAmmo = 50;	} else if ( g_instaGib.integer == 2 ) {		startWeapon = WP_ROCKET_LAUNCHER;		startAmmo = 50;	} else {		startWeapon = WP_MACHINEGUN;		startAmmo = 100;	}	player->ps.stats[STAT_WEAPONS] = ( 1 << startWeapon );	player->ps.ammo[startWeapon] = startAmmo;	player->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET );	player->ps.ammo[WP_GAUNTLET] = -1;	player->ps.ammo[WP_GRAPPLING_HOOK] = -1;	// health will count down towards max_health	ent->health = player->ps.stats[STAT_HEALTH] = player->ps.stats[STAT_MAX_HEALTH] = MAX_HEALTH;	G_SetOrigin( ent, spawn_origin );	VectorCopy( spawn_origin, player->ps.origin );	// the respawned flag will be cleared after the attack and jump keys come up	player->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( player - level.players, &ent->player->pers.cmd );	SetPlayerViewAngle( ent, spawn_angles );	// don't allow full run speed for a bit	player->ps.pm_flags |= PMF_TIME_KNOCKBACK;	player->ps.pm_time = 100;	player->respawnTime = level.time;	player->inactivityTime = level.time + g_inactivity.integer * 1000;	player->latched_buttons = 0;	// set default animations	player->ps.torsoAnim = TORSO_STAND;	player->ps.legsAnim = LEGS_IDLE;	if (!level.intermissiontime) {		if (ent->player->sess.sessionTeam != TEAM_SPECTATOR) {			G_KillBox(ent);			// force the base weapon up			player->ps.weapon = startWeapon;			player->ps.weaponstate = WEAPON_READY;			// fire the targets of the spawn point			G_UseTargets(spawnPoint, ent);			// select the highest weapon number available, after any spawn given items have fired			player->ps.weapon = 1;			for (i = WP_NUM_WEAPONS - 1 ; i > 0 ; i--) {				if (player->ps.stats[STAT_WEAPONS] & (1 << i)) {					player->ps.weapon = i;					break;				}			}			// positively link the player, even if the command times are weird			VectorCopy(ent->player->ps.origin, ent->r.currentOrigin);			tent = G_TempEntity(ent->player->ps.origin, EV_PLAYER_TELEPORT_IN);			tent->s.playerNum = ent->s.playerNum;			trap_LinkEntity (ent);		}	} else {		// move players to intermission		MovePlayerToIntermission(ent);	}	// run a player frame to drop exactly to the floor,	// initialize animations and other things	player->ps.commandTime = level.time - 100;	ent->player->pers.cmd.serverTime = level.time;	PlayerThink( ent-g_entities );	// run the presend to set anything else, follow spectators wait	// until all players have been reconnected after map_restart	if ( ent->player->sess.spectatorState != SPECTATOR_FOLLOW ) {		PlayerEndFrame( ent );	}	// clear entity state values	BG_PlayerStateToEntityState( &player->ps, &ent->s, qtrue );	// we don't want players being backward-reconciled to the place they died	G_ResetHistory( ent );}
开发者ID:mecwerks,项目名称:revamp,代码行数:101,


示例19: ClientSpawn

//.........这里部分代码省略.........	ent->classname = "player";	ent->r.contents = CONTENTS_BODY;	ent->clipmask = MASK_PLAYERSOLID;	ent->die = player_die;	ent->waterlevel = 0;	ent->watertype = 0;	ent->flags = 0;		VectorCopy (playerMins, ent->r.mins);	VectorCopy (playerMaxs, ent->r.maxs);	client->ps.clientNum = index;	if (IsBot(client->ps.clientNum)) {		weapon = WP_LIGHTNING;		client->ps.stats[STAT_WEAPONS] = ( 1 << weapon );		client->ps.ammo[weapon] = -1;	} else {		weapon = WP_MACHINEGUN;		client->ps.stats[STAT_WEAPONS] = ( 1 << weapon );		client->ps.ammo[weapon] = 100;		client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET );		client->ps.ammo[WP_GAUNTLET] = -1;		client->ps.ammo[WP_GRAPPLING_HOOK] = -1;	}	// health will count down towards max_health	ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH] + 25;	G_SetOrigin( ent, spawn_origin );	VectorCopy( spawn_origin, client->ps.origin );	// the respawned flag will be cleared after the attack and jump keys come up	client->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );	SetClientViewAngle( ent, spawn_angles );	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {	} else {		G_KillBox( ent );		trap_LinkEntity (ent);		// force the base weapon up		client->ps.weapon = weapon;		client->ps.weaponstate = WEAPON_READY;	}	// don't allow full run speed for a bit	client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	client->ps.pm_time = 100;	client->respawnTime = level.time;	client->inactivityTime = level.time + g_inactivity.integer * 1000;	client->latched_buttons = 0;	// set default animations	client->ps.torsoAnim = TORSO_STAND;	client->ps.legsAnim = LEGS_IDLE;	if ( level.intermissiontime ) {		MoveClientToIntermission( ent );	} else {		// fire the targets of the spawn point		G_UseTargets( spawnPoint, ent );		// select the highest weapon number available, after any		// spawn given items have fired		client->ps.weapon = weapon;		for ( i = WP_NUM_WEAPONS - 1 ; i > 0 ; i-- ) {			if ( client->ps.stats[STAT_WEAPONS] & ( 1 << i ) ) {				client->ps.weapon = i;				break;			}		}	}	// run a client frame to drop exactly to the floor,	// initialize animations and other things	client->ps.commandTime = level.time - 100;	ent->client->pers.cmd.serverTime = level.time;	ClientThink( ent-g_entities );	// positively link the client, even if the command times are weird	if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {		BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );		VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );		trap_LinkEntity( ent );	}	// run the presend to set anything else	ClientEndFrame( ent );	// clear entity state values	BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );}
开发者ID:zturtleman,项目名称:swarmedq3,代码行数:101,


示例20: ClientThink_real

//.........这里部分代码省略.........	pm.trace = trap_Trace;	pm.pointcontents = trap_PointContents;	pm.debugLevel = g_debugMove.integer;	pm.noFootsteps = ( g_dmflags.integer & DF_NO_FOOTSTEPS ) > 0;	pm.pmove_fixed = (bool)pmove_fixed.integer | client->pers.pmoveFixed;	pm.pmove_msec = pmove_msec.integer;	pm.animations = NULL;	VectorCopy( client->ps.origin, client->oldOrigin );	Pmove (&pm);	G_UpdatePlayerStateScores ( ent );	// save results of pmove	if ( ent->client->ps.eventSequence != oldEventSequence ) 	{		ent->eventTime = level.time;	}		// See if the invulnerable flag should be removed for this client	if ( ent->client->ps.eFlags & EF_INVULNERABLE )	{		if ( level.time - ent->client->invulnerableTime >= g_respawnInvulnerability.integer * 1000 )		{			ent->client->ps.eFlags &= ~EF_INVULNERABLE;		}	}	if (g_smoothClients.integer)	{		BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, true );	}	else 	{		BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, true );	}	SendPendingPredictableEvents( &ent->client->ps );	if ( !( ent->client->ps.eFlags & EF_FIRING ) ) 	{		client->fireHeld = false;		// for grapple	}	// use the snapped origin for linking so it matches client predicted versions	VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );	VectorCopy (pm.mins, ent->r.mins);	VectorCopy (pm.maxs, ent->r.maxs);	ent->waterlevel = pm.waterlevel;	ent->watertype = pm.watertype;	// Need to cache off the firemodes to the persitant data segment so they	// are maintained across spectating and respawning	memcpy ( ent->client->pers.firemode, ent->client->ps.firemode, sizeof(ent->client->ps.firemode ) );	// execute client events	ClientEvents( ent, oldEventSequence );	// Update the client animation info	G_UpdateClientAnimations ( ent );
开发者ID:Jordi1990,项目名称:Sof2MPSDK,代码行数:66,


示例21: ClientThink_real

//.........这里部分代码省略.........		pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY;	}	pm.trace = trap_Trace;	pm.pointcontents = trap_PointContents;	pm.debugLevel = g_debugMove.integer;	pm.noFootsteps = (g_dmflags.integer & DF_NO_FOOTSTEPS) > 0;	pm.pmove_fixed = pmove_fixed.integer | client->pers.pmoveFixed;	pm.pmove_msec = pmove_msec.integer;	VectorCopy(client->ps.origin, client->oldOrigin);// JBravo: setting lca in pm if appropriate	if (g_RQ3_lca.integer == 1)		pm.lca = qtrue;	else		pm.lca = qfalse;	pm.predict = qtrue;	Pmove(&pm);	if ((pm.cmd.upmove > 10) &&	    (pm.waterlevel == 0) &&	    ent->s.groundEntityNum != ENTITYNUM_NONE && pm.ps->groundEntityNum == ENTITYNUM_NONE)		bJumping = 1;	// save results of pmove	if (ent->client->ps.eventSequence != oldEventSequence) {		ent->eventTime = level.time;	}	BG_PlayerStateToEntityState(&ent->client->ps, &ent->s, qtrue);	SendPendingPredictableEvents(&ent->client->ps);	if (!(ent->client->ps.eFlags & EF_FIRING)) {		client->fireHeld = qfalse;	// for grapple	}	// use the snapped origin for linking so it matches client predicted versions	VectorCopy(ent->s.pos.trBase, ent->r.currentOrigin);	VectorCopy(pm.mins, ent->r.mins);	VectorCopy(pm.maxs, ent->r.maxs);	ent->waterlevel = pm.waterlevel;	ent->watertype = pm.watertype;	// execute client events	ClientEvents(ent, oldEventSequence);	// link entity now, after any personal teleporters have been used	// JBravo: this call reactivates gibbed players.	if (!ent->client->gibbed)		trap_LinkEntity(ent);	if (!ent->client->noclip) {		G_TouchTriggers(ent);	}	// NOTE: now copy the exact origin over otherwise clients can be snapped into solid	VectorCopy(ent->client->ps.origin, ent->r.currentOrigin);	//test for solid areas in the AAS file	BotTestAAS(ent->r.currentOrigin);	// touch other objects	ClientImpacts(ent, &pm);
开发者ID:Zekom,项目名称:reaction,代码行数:67,


示例22: CG_SetInitialSnapshot

/*==================CG_SetInitialSnapshotThis will only happen on the very first snapshot, oron tourney restarts.  All other times will useCG_TransitionSnapshot instead.FIXME: Also called by map_restart?==================*/void CG_SetInitialSnapshot( snapshot_t *snap ) {	char buf[64];	int i;	centity_t       *cent;	entityState_t   *state;	cg.snap = snap;	BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse );	// sort out solid entities	CG_BuildSolidList();	CG_ExecuteNewServerCommands( snap->serverCommandSequence );	trap_SendClientCommand( "fogswitch 0" );   // clear it out so the set below will take	trap_Cvar_VariableStringBuffer( "r_savegameFogColor", buf, sizeof( buf ) );	trap_Cvar_Set( "r_savegameFogColor", "0" );	if ( strlen( buf ) > 1 ) {		if ( !Q_stricmp( buf, "none" ) ) {			trap_SendClientCommand( "fogswitch 0" );   // 'off'		} else {			trap_SendClientCommand( va( "fogswitch %s", buf ) );		}	} else {		trap_Cvar_VariableStringBuffer( "r_mapFogColor", buf, sizeof( buf ) );		trap_SendClientCommand( va( "fogswitch %s", buf ) );	}	// set our local weapon selection pointer to	// what the server has indicated the current weapon is	CG_Respawn();	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {		state = &cg.snap->entities[ i ];		cent = &cg_entities[ state->number ];		memcpy( &cent->currentState, state, sizeof( entityState_t ) );		//cent->currentState = *state;		cent->interpolate = qfalse;		cent->currentValid = qtrue;		CG_ResetEntity( cent );		// check for events		CG_CheckEvents( cent );	}	// DHM - Nerve :: Set cg.clientNum so that it may be used elsewhere	cg.clientNum = snap->ps.clientNum;	// NERVE - SMF	{		static char prevmap[64] = { 0 };		char curmap[64];		trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 );		if ( cgs.gametype == GT_WOLF && Q_stricmp( curmap, prevmap ) ) {			strcpy( prevmap, curmap );			trap_SendConsoleCommand( "openLimboMenu/n" );		}	}	// -NERVE - SMF}
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:77,


示例23: ClientSpawn

//.........这里部分代码省略.........    {        if( ent == spawn )        {            //evolution particle system            G_AddPredictableEvent( ent, EV_ALIEN_EVOLVE, DirToByte( up ) );        }        else        {            spawn_angles[ YAW ] += 180.0f;            AngleNormalize360( spawn_angles[ YAW ] );            if( spawnPoint->s.origin2[ 2 ] > 0.0f )            {                vec3_t  forward, dir;                AngleVectors( spawn_angles, forward, NULL, NULL );                VectorScale( forward, F_VEL, forward );                VectorAdd( spawnPoint->s.origin2, forward, dir );                VectorNormalize( dir );                VectorScale( dir, UP_VEL, client->ps.velocity );            }            G_AddPredictableEvent( ent, EV_PLAYER_RESPAWN, 0 );        }    }    else if( client->sess.spectatorState == SPECTATOR_NOT &&             client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )    {        spawn_angles[ YAW ] += 180.0f;        AngleNormalize360( spawn_angles[ YAW ] );    }    // the respawned flag will be cleared after the attack and jump keys come up    client->ps.pm_flags |= PMF_RESPAWNED;    trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );    G_SetClientViewAngle( ent, spawn_angles );    if( client->sess.spectatorState == SPECTATOR_NOT )    {        trap_LinkEntity( ent );        // force the base weapon up        if( client->pers.teamSelection == TEAM_HUMANS )            G_ForceWeaponChange( ent, weapon );        client->ps.weaponstate = WEAPON_READY;    }    // don't allow full run speed for a bit    client->ps.pm_flags |= PMF_TIME_KNOCKBACK;    client->ps.pm_time = 100;    client->respawnTime = level.time;    ent->nextRegenTime = level.time;    client->inactivityTime = level.time + g_inactivity.integer * 1000;    client->latched_buttons = 0;    // set default animations    client->ps.torsoAnim = TORSO_STAND;    client->ps.legsAnim = LEGS_IDLE;    if( level.intermissiontime )        MoveClientToIntermission( ent );    else    {        // fire the targets of the spawn point        if( !spawn )            G_UseTargets( spawnPoint, ent );        client->ps.weapon = client->ps.stats[ STAT_WEAPON ];    }    // run a client frame to drop exactly to the floor,    // initialize animations and other things    client->ps.commandTime = level.time - 100;    ent->client->pers.cmd.serverTime = level.time;    ClientThink( ent-g_entities );    // positively link the client, even if the command times are weird    if( client->sess.spectatorState == SPECTATOR_NOT )    {        BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );        VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );        trap_LinkEntity( ent );    }    // must do this here so the number of active clients is calculated    CalculateRanks( );    // run the presend to set anything else    ClientEndFrame( ent );    // clear entity state values    BG_PlayerStateToEntityState( &client->ps, &ent->s, qtrue );    client->pers.infoChangeTime = level.time;}
开发者ID:GrangerHub,项目名称:tremulous,代码行数:101,


示例24: CG_TransitionSnapshot

/*===================CG_TransitionSnapshotThe transition point from snap to nextSnap has passed===================*/static void CG_TransitionSnapshot(){	centity_t  *cent;	snapshot_t *oldFrame;	int        oldWeapon;	if ( !cg.snap )	{		Sys::Drop( "CG_TransitionSnapshot: NULL cg.snap" );	}	if ( !cg.nextSnap )	{		Sys::Drop( "CG_TransitionSnapshot: NULL cg.nextSnap" );	}	// execute any server string commands before transitioning entities	CG_ExecuteServerCommands( cg.nextSnap );	// clear the currentValid flag for all entities in the existing snapshot	for ( unsigned i = 0; i < cg.snap->entities.size(); i++ )	{		cent = &cg_entities[ cg.snap->entities[ i ].number ];		cent->currentValid = false;	}	// move nextSnap to snap and do the transitions	oldFrame = cg.snap;	cg.snap = cg.nextSnap;	// Need to store the previous weapon because BG_PlayerStateToEntityState might change it	// so the CG_OnPlayerWeaponChange callback is never called	oldWeapon = oldFrame->ps.weapon;	BG_PlayerStateToEntityState( &cg.snap->ps, &cg_entities[ cg.snap->ps.clientNum ].currentState, false );	cg_entities[ cg.snap->ps.clientNum ].interpolate = false;	for ( unsigned i = 0; i < cg.snap->entities.size(); i++ )	{		cent = &cg_entities[ cg.snap->entities[ i ].number ];		CG_TransitionEntity( cent );		// remember time of snapshot this entity was last updated in		cent->snapShotTime = cg.snap->serverTime;	}	cg.nextSnap = nullptr;	// check for playerstate transition events	playerState_t *ops = &oldFrame->ps, *ps = &cg.snap->ps;	// teleporting checks are irrespective of prediction	if ((ps->eFlags ^ ops->eFlags) & EF_TELEPORT_BIT) {		cg.thisFrameTeleport = true; // will be cleared by prediction code	}	// if we are not doing client side movement prediction for any	// reason, then the client events and view changes will be issued now	if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) ||			cg_nopredict.integer || cg.pmoveParams.synchronous) {		CG_TransitionPlayerState(ps, ops);	}	// Callbacks for changes in playerState like weapon/class/team	if (oldWeapon != ps->weapon) {		CG_OnPlayerWeaponChange();	}	if (ops->stats[STAT_ITEMS] != ps->stats[STAT_ITEMS]) {		CG_OnPlayerUpgradeChange();	}}
开发者ID:Unvanquished,项目名称:Unvanquished,代码行数:79,


示例25: ClientThink_real

//.........这里部分代码省略.........		pm.cmd.weapon = client->ps.weapon;	}	Pmove(&pm);	// Gordon: thx to bani for this	// ikkyo - fix leaning players bug	VectorCopy(client->ps.velocity, ent->s.pos.trDelta);	SnapVector(ent->s.pos.trDelta);	// end	// server cursor hints	if (ent->lastHintCheckTime < level.time) {		G_CheckForCursorHints(ent);		ent->lastHintCheckTime = level.time + FRAMETIME;	}	// DHM - Nerve :: Set animMovetype to 1 if ducking	if (ent->client->ps.pm_flags & PMF_DUCKED) {		ent->s.animMovetype = 1;	} else {		ent->s.animMovetype = 0;	}	// save results of pmove	if (ent->client->ps.eventSequence != oldEventSequence) {		ent->eventTime   = level.time;		ent->r.eventTime = level.time;	}	// Ridah, fixes jittery zombie movement	if (g_smoothClients.integer) {		BG_PlayerStateToEntityStateExtraPolate(&ent->client->ps, &ent->s, level.time, qfalse);	} else {		BG_PlayerStateToEntityState(&ent->client->ps, &ent->s, qfalse);	}	if (!(ent->client->ps.eFlags & EF_FIRING)) {		client->fireHeld = qfalse;      // for grapple	}//	// use the snapped origin for linking so it matches client predicted versions	VectorCopy(ent->s.pos.trBase, ent->r.currentOrigin);	VectorCopy(pm.mins, ent->r.mins);	VectorCopy(pm.maxs, ent->r.maxs);	ent->waterlevel = pm.waterlevel;	ent->watertype  = pm.watertype;	// execute client events	ClientEvents(ent, oldEventSequence);	// link entity now, after any personal teleporters have been used	trap_LinkEntity(ent);	if (!ent->client->noclip) {		G_TouchTriggers(ent);	}	// NOTE: now copy the exact origin over otherwise clients can be snapped into solid	VectorCopy(ent->client->ps.origin, ent->r.currentOrigin);	// touch other objects	ClientImpacts(ent, &pm);
开发者ID:ETrun,项目名称:ETrun,代码行数:66,


示例26: G_xpsave_load

qboolean G_xpsave_load(gentity_t *ent){	int i, j;	qboolean found = qfalse, XPSMuted = qfalse;	int clientNum;	g_xpsave_t *x = g_xpsaves[0];	time_t t;	char agestr[MAX_STRING_CHARS];	//char desc[64];	// josh: Increased this	// josh: TODO: tjw? What is this desc thing for?	char desc[115];	int age;	int eff_XPSaveMaxAge_xp = G_getXPSaveMaxAge_xp();	int eff_XPSaveMaxAge = G_getXPSaveMaxAge();	float startxptotal = 0.0f;	if(!ent || !ent->client)		return qfalse;	if(!(g_XPSave.integer & XPSF_ENABLE))		return qfalse;		if(!time(&t))		return qfalse;	desc[0] = '/0';	clientNum = ent - g_entities;		for(i=0; g_xpsaves[i]; i++) {		if(!Q_stricmp(g_xpsaves[i]->guid, 			ent->client->sess.guid)) {			found = qtrue;			x = g_xpsaves[i];			break;		}	}	if(!found)		return qfalse;	age = t - x->time;	if(age > eff_XPSaveMaxAge) {		return qfalse;	}	if(age <= eff_XPSaveMaxAge_xp) {		for(i=0; i<SK_NUM_SKILLS; i++) {			ent->client->sess.skillpoints[i] = x->skill[i];			// pheno: fix for session startxptotal value			startxptotal += x->skill[i];		}		ent->client->sess.startxptotal = startxptotal;		ent->client->ps.stats[STAT_XP] = 			(int)ent->client->sess.startxptotal;		Q_strcat(desc, sizeof(desc), "XP/");		if((g_XPDecay.integer & XPDF_ENABLE) &&			!(g_XPDecay.integer & XPDF_NO_DISCONNECT_DECAY)) {			G_XPDecay(ent, age, qtrue);		}	}	ent->client->sess.overall_killrating = x->kill_rating;	ent->client->sess.overall_killvariance = x->kill_variance;	//ent->client->sess.playerrating = x->playerrating;	ent->client->sess.rating = x->rating;	ent->client->sess.rating_variance = x->rating_variance;	for(i=0; i<SK_NUM_SKILLS; i++) {		for(j=0; j<NUM_SKILL_LEVELS; j++) {			ent->client->sess.pr_skill_updates[i][j] =				x->pr_skill_updates[i][j];			ent->client->sess.pr_skill[i][j] =				x->pr_skill[i][j];		}	}	Q_strcat(desc, sizeof(desc), "ratings/");		if(x->mutetime != 0) {		if(x->mutetime < 0){			ent->client->sess.auto_unmute_time = -1;			XPSMuted = qtrue;		}else if(x->mutetime > t){			ent->client->sess.auto_unmute_time = (level.time + 1000*(x->mutetime - t));			XPSMuted = qtrue;;		}		if(XPSMuted == qtrue){			CP("print /"^5You've been muted by XPSave/n/"" );			Q_strcat(desc, sizeof(desc), "mute/");		}	}	ent->client->sess.hits = x->hits;	ent->client->sess.team_hits = x->team_hits;	G_CalcRank(ent->client);	BG_PlayerStateToEntityState(&ent->client->ps,			&ent->s,			level.time,			qtrue);	// tjw: trim last / from desc	if(strlen(desc))//.........这里部分代码省略.........
开发者ID:BulldogDrummond,项目名称:etpub,代码行数:101,


示例27: CG_SetInitialSnapshot

/*==================CG_SetInitialSnapshotThis will only happen on the very first snapshot, oron tourney restarts.  All other times will use CG_TransitionSnapshot instead.FIXME: Also called by map_restart?==================*/void CG_SetInitialSnapshot( snapshot_t *snap ) {	int				i;	centity_t		*cent;	entityState_t	*state;	char			buff[16];	cg.snap = snap;//	trap_S_ClearSounds( qtrue );	BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse );	// sort out solid entities	CG_BuildSolidList();	CG_ExecuteNewServerCommands( snap->serverCommandSequence );	// set our local weapon selection pointer to	// what the server has indicated the current weapon is	CG_Respawn( qfalse );	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {		state = &cg.snap->entities[ i ];		cent = &cg_entities[ state->number ];		memcpy(&cent->currentState, state, sizeof(entityState_t));		//cent->currentState = *state;		cent->interpolate = qfalse;		cent->currentValid = qtrue;		CG_ResetEntity( cent );		// check for events		CG_CheckEvents( cent );	}	cg_fxflags = 0;	trap_Cvar_VariableStringBuffer( "r_oldMode", buff, sizeof(buff) );	if( atoi(buff) ) {		// Arnout: confirmation screen		trap_UI_Popup( UIMENU_INGAME );	} else if(cg.demoPlayback) {		ccInitial = qtrue;	} else {		static char prevmap[64] = { 0 };		char curmap[64];		trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 );		if ( Q_stricmp( curmap, prevmap ) ) {			strcpy( prevmap, curmap );			if(cgs.campaignInfoLoaded) {				if( !cg.showGameView ) {					CG_LimboMenu_f();				}/*			} else {				ccInitial = qtrue;				// Start the Initial Camera if specified				CG_StartInitialCamera(); */			}		}	}	// OSP - remove motd window	if(cg.motdWindow != NULL) {		CG_windowFree(cg.motdWindow);		cg.motdWindow = NULL;	}	// Activate alternate input handler during demo playback	if(cg.demoPlayback) {		CG_keyOn_f();		if(demo_infoWindow.integer > 0) {			CG_ShowHelp_On(&cg.demohelpWindow);		}	}	// OSP#if __MACOS__#ifdef GAMERANGER	// LBO 12/13/04. Add support for GameRanger team voice IDs	GRSetMyTeamID(cg.snap->ps.persistant[PERS_TEAM]);#endif#endif}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:99,


示例28: ClientEndFrame

/*==============ClientEndFrameCalled at the end of each server frame for each connected clientA fast client will have multiple ClientThink for each ClientEndFrame,while a slow client may have multiple ClientEndFrame between ClientThink.==============*/void ClientEndFrame( gentity_t *ent ) {	int i;	if ( ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) || ( ent->client->ps.pm_flags & PMF_LIMBO ) ) { // JPW NERVE		SpectatorClientEndFrame( ent );		return;	}	if ( !ent->aiCharacter ) {		// turn off any expired powerups		for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {			if ( i == PW_FIRE ||             // these aren't dependant on level.time				 i == PW_ELECTRIC ||				 i == PW_BREATHER ||				 i == PW_NOFATIGUE ) {				continue;			}			if ( ent->client->ps.powerups[ i ] < level.time ) {				ent->client->ps.powerups[ i ] = 0;			}		}	}	// save network bandwidth#if 0	if ( !g_synchronousClients->integer && ent->client->ps.pm_type == PM_NORMAL ) {		// FIXME: this must change eventually for non-sync demo recording		VectorClear( ent->client->ps.viewangles );	}#endif	//	// If the end of unit layout is displayed, don't give	// the player any normal movement attributes	//	if ( level.intermissiontime ) {		return;	}	// burn from lava, etc	P_WorldEffects( ent );	// apply all the damage taken this frame	P_DamageFeedback( ent );	// add the EF_CONNECTION flag if we haven't gotten commands recently	if ( level.time - ent->client->lastCmdTime > 1000 ) {		ent->s.eFlags |= EF_CONNECTION;	} else {		ent->s.eFlags &= ~EF_CONNECTION;	}	ent->client->ps.stats[STAT_HEALTH] = ent->health;   // FIXME: get rid of ent->health...	G_SetClientSound( ent );	// set the latest infor	// Ridah, fixes jittery zombie movement	if ( g_smoothClients.integer ) {		BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, ( ( ent->r.svFlags & SVF_CASTAI ) == 0 ) );	} else {		BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, ( ( ent->r.svFlags & SVF_CASTAI ) == 0 ) );	}	//SendPendingPredictableEvents( &ent->client->ps );	// DHM - Nerve :: If it's been a couple frames since being revived, and props_frame_state	//					wasn't reset, go ahead and reset it	if ( ent->props_frame_state >= 0 && ( ( level.time - ent->s.effect3Time ) > 100 ) ) {		ent->props_frame_state = -1;	}	if ( ent->health > 0 && StuckInClient( ent ) ) {		G_DPrintf( "%s is stuck in a client./n", ent->client->pers.netname );		ent->r.contents = CONTENTS_CORPSE;	}	if ( g_gametype.integer >= GT_WOLF && ent->health > 0 && ent->r.contents == CONTENTS_CORPSE ) {		WolfReviveBbox( ent );	}	// DHM - Nerve :: Reset 'count2' for flamethrower	if ( !( ent->client->buttons & BUTTON_ATTACK ) ) {		ent->count2 = 0;	}	// dhm}
开发者ID:chegestar,项目名称:omni-bot,代码行数:100,


示例29: CG_TransitionSnapshot

/*===================CG_TransitionSnapshotThe transition point from snap to nextSnap has passed===================*/static void CG_TransitionSnapshot( void ){	centity_t  *cent;	snapshot_t *oldFrame;	int        i;	if ( !cg.snap )	{		CG_Error( "CG_TransitionSnapshot: NULL cg.snap" );	}	if ( !cg.nextSnap )	{		CG_Error( "CG_TransitionSnapshot: NULL cg.nextSnap" );	}	// execute any server string commands before transitioning entities	CG_ExecuteNewServerCommands( cg.nextSnap->serverCommandSequence );	// clear the currentValid flag for all entities in the existing snapshot	for ( i = 0; i < cg.snap->numEntities; i++ )	{		cent = &cg_entities[ cg.snap->entities[ i ].number ];		cent->currentValid = qfalse;	}	// move nextSnap to snap and do the transitions	oldFrame = cg.snap;	cg.snap = cg.nextSnap;	BG_PlayerStateToEntityState( &cg.snap->ps, &cg_entities[ cg.snap->ps.clientNum ].currentState, qfalse );	cg_entities[ cg.snap->ps.clientNum ].interpolate = qfalse;	for ( i = 0; i < cg.snap->numEntities; i++ )	{		cent = &cg_entities[ cg.snap->entities[ i ].number ];		CG_TransitionEntity( cent );		// remember time of snapshot this entity was last updated in		cent->snapShotTime = cg.snap->serverTime;	}	cg.nextSnap = NULL;	// check for playerstate transition events	if ( oldFrame )	{		playerState_t *ops, *ps;		ops = &oldFrame->ps;		ps = &cg.snap->ps;		// teleporting checks are irrespective of prediction		if ( ( ps->eFlags ^ ops->eFlags ) & EF_TELEPORT_BIT )		{			cg.thisFrameTeleport = qtrue; // will be cleared by prediction code		}		// if we are not doing client side movement prediction for any		// reason, then the client events and view changes will be issued now		if ( cg.demoPlayback || ( cg.snap->ps.pm_flags & PMF_FOLLOW ) ||		     cg_nopredict.integer || cg_synchronousClients.integer )		{			CG_TransitionPlayerState( ps, ops );		}	}}
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:74,


示例30: ClientThink_real

//.........这里部分代码省略.........			angle = 0;		}		// W		else if ( monsterslick & SURF_MONSLICK_W ) {			angle = 180;		} else		{			bogus = qtrue;		}	}	// server cursor hints	if ( ent->lastHintCheckTime < level.time ) {		G_CheckForCursorHints( ent );		ent->lastHintCheckTime = level.time + FRAMETIME;	}	// DHM - Nerve :: Set animMovetype to 1 if ducking	if ( ent->client->ps.pm_flags & PMF_DUCKED ) {		ent->s.animMovetype = 1;	} else {		ent->s.animMovetype = 0;	}	// save results of pmove	if ( ent->client->ps.eventSequence != oldEventSequence ) {		ent->eventTime = level.time;		ent->r.eventTime = level.time;	}	// Ridah, fixes jittery zombie movement	if ( g_smoothClients.integer ) {		BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue );	} else {		BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );	}	if ( !( ent->client->ps.eFlags & EF_FIRING ) ) {		client->fireHeld = qfalse;      // for grapple	}////	// use the precise origin for linking//	VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );////	// use the snapped origin for linking so it matches client predicted versions	VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );	VectorCopy( pm.mins, ent->r.mins );	VectorCopy( pm.maxs, ent->r.maxs );	ent->waterlevel = pm.waterlevel;	ent->watertype = pm.watertype;	// execute client events	ClientEvents( ent, oldEventSequence );	// link entity now, after any personal teleporters have been used	trap_LinkEntity( ent );	if ( !ent->client->noclip ) {		G_TouchTriggers( ent );	}	// NOTE: now copy the exact origin over otherwise clients can be snapped into solid	VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );
开发者ID:chegestar,项目名称:omni-bot,代码行数:67,



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


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