• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GS_TeamBasedGametype函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BOT_DMclass_CheckShot

//==========================================
// BOT_DMclass_CheckShot
// Checks if shot is blocked (doesn't verify it would hit)
//==========================================
static bool BOT_DMclass_CheckShot( edict_t *ent, vec3_t point )
{
	trace_t tr;
	vec3_t start, forward, right, offset;

	if( random() > ent->ai->pers.cha.firerate )
		return false;

	AngleVectors( ent->r.client->ps.viewangles, forward, right, NULL );

	VectorSet( offset, 0, 0, ent->viewheight );
	G_ProjectSource( ent->s.origin, offset, forward, right, start );

	// blocked, don't shoot
	G_Trace( &tr, start, vec3_origin, vec3_origin, point, ent, MASK_AISOLID );
	if( tr.fraction < 0.8f )
	{
		if( tr.ent < 1 || !game.edicts[tr.ent].takedamage || game.edicts[tr.ent].movetype == MOVETYPE_PUSH )
			return false;

		// check if the player we found is at our team
		if( game.edicts[tr.ent].s.team == ent->s.team && GS_TeamBasedGametype() )
			return false;
	}

	return true;
}
开发者ID:ultimatecode7,项目名称:qfusion,代码行数:31,代码来源:ai_class_dmbot.cpp


示例2: G_Match_ScorelimitHit

/*
* G_Match_ScorelimitHit
*/
bool G_Match_ScorelimitHit( void )
{
	edict_t	*e;

	if( GS_MatchState() != MATCH_STATE_PLAYTIME )
		return false;

	if( g_scorelimit->integer )
	{
		if( !GS_TeamBasedGametype() )
		{
			for( e = game.edicts+1; PLAYERNUM( e ) < gs.maxclients; e++ )
			{
				if( !e->r.inuse )
					continue;

				if( e->r.client->level.stats.score >= g_scorelimit->integer )
					return true;
			}
		}
		else
		{
			int team;

			for( team = TEAM_ALPHA; team < GS_MAX_TEAMS; team++ )
			{
				if( teamlist[team].stats.score >= g_scorelimit->integer )
					return true;
			}
		}
	}

	return false;
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:37,代码来源:g_gametypes.cpp


示例3: G_Gametype_GENERIC_SetUpWarmup

void G_Gametype_GENERIC_SetUpWarmup( void )
{
	level.gametype.readyAnnouncementEnabled = true;
	level.gametype.scoreAnnouncementEnabled = false;
	level.gametype.countdownEnabled = false;
	level.gametype.pickableItemsMask = ( level.gametype.spawnableItemsMask|level.gametype.dropableItemsMask );
	if( GS_Instagib() )
		level.gametype.pickableItemsMask &= ~G_INSTAGIB_NEGATE_ITEMMASK;

	if( GS_TeamBasedGametype() )
	{
		bool any = false;
		int team;
		for( team = TEAM_ALPHA; team < GS_MAX_TEAMS; team++ )
		{
			if( G_Teams_TeamIsLocked( team ) )
			{
				G_Teams_UnLockTeam( team );
				any = true;
			}
		}
		if( any )
			G_PrintMsg( NULL, "Teams unlocked.\n" );
	}
	else
	{
		if( G_Teams_TeamIsLocked( TEAM_PLAYERS ) )
		{
			G_Teams_UnLockTeam( TEAM_PLAYERS );
			G_PrintMsg( NULL, "Teams unlocked.\n" );
		}
	}
	G_Teams_RemoveInvites();
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:34,代码来源:g_gametypes.cpp


示例4: G_RunGametype

/*
* G_RunGametype
*/
void G_RunGametype( void )
{
	G_Teams_ExecuteChallengersQueue();
	G_Teams_UpdateMembersList();
	G_Match_CheckStateAbort();

	G_UpdateScoreBoardMessages();

	//check gametype specific rules
	if( game.asEngine != NULL )
		GT_asCallThinkRules();
	else
		G_Gametype_GENERIC_ThinkRules();

	if( G_EachNewSecond() )
	{
		G_CheckNumBots();
		G_TickOutPowerUps();
	}

	if( G_EachNewMinute() )
		G_CheckEvenTeam();

	G_Match_ScoreAnnouncement();
	G_Match_ReadyAnnouncement();

	if( GS_TeamBasedGametype() )
		G_Teams_UpdateTeamInfoMessages();

	G_asGarbageCollect( false );
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:34,代码来源:g_gametypes.cpp


示例5: G_Gametype_GENERIC_SetUpCountdown

void G_Gametype_GENERIC_SetUpCountdown( void )
{
	bool any = false;
	int team;

	G_Match_RemoveAllProjectiles();
	G_Items_RespawnByType( 0, 0, 0 ); // respawn all items

	level.gametype.readyAnnouncementEnabled = false;
	level.gametype.scoreAnnouncementEnabled = false;
	level.gametype.countdownEnabled = true;
	level.gametype.pickableItemsMask = 0; // disallow item pickup

	if( GS_TeamBasedGametype() )
	{
		for( team = TEAM_ALPHA; team < GS_MAX_TEAMS; team++ )
			if( G_Teams_LockTeam( team ) )
				any = true;
	}
	else
	{
		if( G_Teams_LockTeam( TEAM_PLAYERS ) )
			any = true;
	}

	if( any )
		G_PrintMsg( NULL, "Teams locked.\n" );

	G_AnnouncerSound( NULL, trap_SoundIndex( va( S_ANNOUNCER_COUNTDOWN_GET_READY_TO_FIGHT_1_to_2, ( rand()&1 )+1 ) ),
		GS_MAX_TEAMS, true, NULL );
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:31,代码来源:g_gametypes.cpp


示例6: BOT_DMclass_PlayerWeight

float BOT_DMclass_PlayerWeight( edict_t *self, edict_t *enemy )
{
	bool rage_mode = false;

	if( !enemy || enemy == self )
		return 0;

	if( G_ISGHOSTING( enemy ) || enemy->flags & (FL_NOTARGET|FL_BUSY) )
		return 0;

	if( self->r.client->ps.inventory[POWERUP_QUAD] || self->r.client->ps.inventory[POWERUP_SHELL] )
		rage_mode = true;

	// don't fight against powerups.
	if( enemy->r.client && ( enemy->r.client->ps.inventory[POWERUP_QUAD] || enemy->r.client->ps.inventory[POWERUP_SHELL] ) )
		return 0.2;

	//if not team based give some weight to every one
	if( GS_TeamBasedGametype() && ( enemy->s.team == self->s.team ) )
		return 0;

	// if having EF_CARRIER we can assume it's someone important
	if( enemy->s.effects & EF_CARRIER )
		return 2.0f;

	if( enemy == self->ai->last_attacker )
		return rage_mode ? 4.0f : 1.0f;

	return rage_mode ? 4.0f : 0.3f;
}
开发者ID:ultimatecode7,项目名称:qfusion,代码行数:30,代码来源:ai_class_dmbot.cpp


示例7: CG_ForceTeam

//==============
// CG_ForceTeam
//==============
static int CG_ForceTeam( int entNum, int team )
{
	if( !GS_TeamBasedGametype() )
	{
		if( ISVIEWERENTITY( entNum ) )
		{
			if( cg_forceMyTeamAlpha->integer )
				return TEAM_ALPHA;
		}
		else
		{
			if( cg_forceTeamPlayersTeamBeta->integer )
				return TEAM_BETA;
		}

		return team;
	}
	else
	{
		int myteam = cg.predictedPlayerState.stats[STAT_TEAM];

		if( cg_forceMyTeamAlpha->integer && myteam != TEAM_SPECTATOR )
		{
			if( team == myteam )
				return TEAM_ALPHA;
			if( team == TEAM_ALPHA )
				return myteam;
		}

		return team;
	}
}
开发者ID:Racenet,项目名称:racesow,代码行数:35,代码来源:cg_teams.c


示例8: Cmd_ChaseCam_f

/*
* Cmd_ChaseCam_f
*/
void Cmd_ChaseCam_f( edict_t *ent ) {
	bool team_only;
	const char *arg1;

	if( ent->s.team != TEAM_SPECTATOR && !ent->r.client->teamstate.is_coach ) {
		G_Teams_JoinTeam( ent, TEAM_SPECTATOR );
		if( !CheckFlood( ent, false ) ) { // prevent 'joined spectators' spam
			G_PrintMsg( NULL, "%s%s joined the %s%s team.\n", ent->r.client->netname,
						S_COLOR_WHITE, GS_TeamName( ent->s.team ), S_COLOR_WHITE );
		}
	}

	// & 1 = scorelead
	// & 2 = powerups
	// & 4 = objectives
	// & 8 = fragger

	if( ent->r.client->teamstate.is_coach && GS_TeamBasedGametype() ) {
		team_only = true;
	} else {
		team_only = false;
	}

	arg1 = trap_Cmd_Argv( 1 );

	if( trap_Cmd_Argc() < 2 ) {
		G_ChasePlayer( ent, NULL, team_only, 0 );
	} else if( !Q_stricmp( arg1, "auto" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'auto'. It will follow the score leader when no powerup nor flag is carried.\n" );
		G_ChasePlayer( ent, NULL, team_only, 7 );
	} else if( !Q_stricmp( arg1, "carriers" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'carriers'. It will switch to flag or powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 6 );
	} else if( !Q_stricmp( arg1, "powerups" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'powerups'. It will switch to powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 2 );
	} else if( !Q_stricmp( arg1, "objectives" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'objectives'. It will switch to objectives carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 4 );
	} else if( !Q_stricmp( arg1, "score" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'score'. It will always follow the player with the best score.\n" );
		G_ChasePlayer( ent, NULL, team_only, 1 );
	} else if( !Q_stricmp( arg1, "fragger" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'fragger'. The last fragging player will be followed.\n" );
		G_ChasePlayer( ent, NULL, team_only, 8 );
	} else if( !Q_stricmp( arg1, "help" ) ) {
		G_PrintMsg( ent, "Chasecam modes:\n" );
		G_PrintMsg( ent, "- 'auto': Chase the score leader unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'carriers': User has pov control unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'objectives': User has pov control unless there's an objective carrier.\n" );
		G_PrintMsg( ent, "- 'powerups': User has pov control unless there's a flag carrier.\n" );
		G_PrintMsg( ent, "- 'score': Always follow the score leader. User has no pov control.\n" );
		G_PrintMsg( ent, "- 'none': Disable chasecam.\n" );
		return;
	} else {
		G_ChasePlayer( ent, arg1, team_only, 0 );
	}

	G_Teams_LeaveChallengersQueue( ent );
}
开发者ID:Picmip,项目名称:qfusion,代码行数:63,代码来源:g_chase.cpp


示例9: GS_CheckBladeAutoAttack

static qboolean GS_CheckBladeAutoAttack( player_state_t *playerState, int timeDelta )
{
	vec3_t origin, dir, end;
	trace_t trace;
	entity_state_t *targ, *player;
	gs_weapon_definition_t *weapondef = GS_GetWeaponDef( WEAP_GUNBLADE );

	if( playerState->POVnum <= 0 || (int)playerState->POVnum > gs.maxclients )
		return qfalse;

	if( !( playerState->pmove.stats[PM_STAT_FEATURES] & PMFEAT_GUNBLADEAUTOATTACK ) )
		return qfalse;

	VectorCopy( playerState->pmove.origin, origin );
	origin[2] += playerState->viewheight;
	AngleVectors( playerState->viewangles, dir, NULL, NULL );
	VectorMA( origin, weapondef->firedef_weak.timeout, dir, end );

	// check for a player to touch
	module_Trace( &trace, origin, vec3_origin, vec3_origin, end, playerState->POVnum, CONTENTS_BODY, timeDelta );
	if( trace.ent <= 0 || trace.ent > gs.maxclients )
		return qfalse;

	player = module_GetEntityState( playerState->POVnum, 0 );
	targ = module_GetEntityState( trace.ent, 0 );
	if( !( targ->effects & EF_TAKEDAMAGE ) || targ->type != ET_PLAYER )
		return qfalse;

	if( GS_TeamBasedGametype() && ( targ->team == player->team ) )
		return qfalse;

	return qtrue;
}
开发者ID:codetwister,项目名称:qfusion,代码行数:33,代码来源:gs_weapons.c


示例10: G_GameTypes_DenyJoinTeam

/*
* G_GameTypes_DenyJoinTeam
*/
static int G_GameTypes_DenyJoinTeam( edict_t *ent, int team )
{
	if( team < 0 || team >= GS_MAX_TEAMS )
	{
		G_Printf( "WARNING: 'G_GameTypes_CanJoinTeam' parsing a unrecognized team value\n" );
		return ER_TEAM_INVALID;
	}

	if( team == TEAM_SPECTATOR )
		return ER_TEAM_OK;

	if( GS_MatchState() > MATCH_STATE_PLAYTIME )
		return ER_TEAM_MATCHSTATE;

	// waiting for chanllengers queue to be executed
	if( GS_HasChallengers() &&
		game.realtime < level.spawnedTimeStamp + (unsigned)( G_CHALLENGERS_MIN_JOINTEAM_MAPTIME + game.snapFrameTime ) )
		return ER_TEAM_CHALLENGERS;

	// force eveyone to go through queue so things work on map change
	if( GS_HasChallengers() && !ent->r.client->queueTimeStamp )
		return ER_TEAM_CHALLENGERS;

	//see if team is locked
	if( G_Teams_TeamIsLocked( team ) && !G_Teams_PlayerIsInvited( team, ent ) )
		return ER_TEAM_LOCKED;

	if( GS_TeamBasedGametype() )
	{
		if( team >= TEAM_ALPHA && team < GS_MAX_TEAMS )
		{
			// see if team is full
			int count = teamlist[team].numplayers;

			if( ( count + 1 > level.gametype.maxPlayersPerTeam &&
				level.gametype.maxPlayersPerTeam > 0 ) ||
				( count + 1 > g_teams_maxplayers->integer &&
				g_teams_maxplayers->integer > 0 ) )
				return ER_TEAM_FULL;

			if( !g_teams_allow_uneven->integer && !G_Teams_CanKeepEvenTeam( ent->s.team, team ) )
				return ER_TEAM_UNEVEN;

			return ER_TEAM_OK;
		}
		else
		{
			return ER_TEAM_INVALID;
		}
	}
	else if( team == TEAM_PLAYERS )
	{
		return ER_TEAM_OK;
	}

	return ER_TEAM_INVALID;
}
开发者ID:tenght,项目名称:qfusion,代码行数:60,代码来源:g_gameteams.cpp


示例11: InstantiateTeamBrain

AiBaseTeamBrain *AiBaseTeamBrain::InstantiateTeamBrain( int team, const char *gametype ) {
	// Delegate construction to AiSquadBasedTeamBrain
	if( GS_TeamBasedGametype() && !GS_InvidualGameType() ) {
		return AiSquadBasedTeamBrain::InstantiateTeamBrain( team, gametype );
	}

	void *mem = G_Malloc( sizeof( AiBaseTeamBrain ) );
	return new(mem)AiBaseTeamBrain( team );
}
开发者ID:adem4ik,项目名称:qfusion,代码行数:9,代码来源:ai_base_team_brain.cpp


示例12: G_Gametype_CanTeamDamage

/*
* G_Gametype_CanTeamDamage
*/
bool G_Gametype_CanTeamDamage( int damageflags )
{
	if( damageflags & DAMAGE_NO_PROTECTION )
		return true;

	if( !GS_TeamBasedGametype() )
		return true;

	return g_allow_teamdamage->integer ? true : false;
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:13,代码来源:g_gametypes.cpp


示例13: G_Teams_AdvanceChallengersQueue

/*
* G_Teams_AdvanceChallengersQueue
*/
void G_Teams_AdvanceChallengersQueue( void )
{
	int i, team, loserscount, winnerscount, playerscount = 0;
	int maxscore = 999999;
	edict_t *won, *e;
	int START_TEAM = TEAM_PLAYERS, END_TEAM = TEAM_PLAYERS+1;

	if( !GS_HasChallengers() )
		return;

	G_Teams_UpdateMembersList();

	if( GS_TeamBasedGametype() )
	{
		START_TEAM = TEAM_ALPHA;
		END_TEAM = GS_MAX_TEAMS;
	}

	// assign new timestamps to all the players inside teams
	for( team = START_TEAM; team < END_TEAM; team++ )
	{
		playerscount += teamlist[team].numplayers;
	}

	if( !playerscount )
		return;

	loserscount = 0;
	if( playerscount > 1 )
	{
		loserscount = (int)( playerscount / 2 );
	}
	winnerscount = playerscount - loserscount;

	// put everyone who just played out of the challengers queue
	for( team = START_TEAM; team < END_TEAM; team++ )
	{
		for( i = 0; i < teamlist[team].numplayers; i++ )
		{
			e = game.edicts + teamlist[team].playerIndices[i];
			e->r.client->queueTimeStamp = 0;
		}
	}

	// put (back) the best scoring players in first positions of challengers queue
	for( i = 0; i < winnerscount; i++ )
	{
		won = G_Teams_BestScoreBelow( maxscore );
		if( won )
		{
			maxscore = won->r.client->level.stats.score;
			won->r.client->queueTimeStamp = 1 + ( winnerscount-i ); // never have 2 players with the same timestamp
		}
	}
}
开发者ID:tenght,项目名称:qfusion,代码行数:58,代码来源:g_gameteams.cpp


示例14: Cmd_Timeout_f

/*
* Cmd_Timeout_f
*/
static void Cmd_Timeout_f( edict_t *ent )
{
	int num;

	if( ent->s.team == TEAM_SPECTATOR || GS_MatchState() != MATCH_STATE_PLAYTIME )
		return;

	if( GS_TeamBasedGametype() )
		num = ent->s.team;
	else
		num = ENTNUM( ent )-1;

	if( GS_MatchPaused() && ( level.timeout.endtime - level.timeout.time ) >= 2*TIMEIN_TIME )
	{
		G_PrintMsg( ent, "Timeout already in progress\n" );
		return;
	}

	if( g_maxtimeouts->integer != -1 && level.timeout.used[num] >= g_maxtimeouts->integer )
	{
		if( g_maxtimeouts->integer == 0 )
			G_PrintMsg( ent, "Timeouts are not allowed on this server\n" );
		else if( GS_TeamBasedGametype() )
			G_PrintMsg( ent, "Your team doesn't have any timeouts left\n" );
		else
			G_PrintMsg( ent, "You don't have any timeouts left\n" );
		return;
	}

	G_PrintMsg( NULL, "%s%s called a timeout\n", ent->r.client->netname, S_COLOR_WHITE );

	if( !GS_MatchPaused() )
		G_AnnouncerSound( NULL, trap_SoundIndex( va( S_ANNOUNCER_TIMEOUT_TIMEOUT_1_to_2, ( rand()&1 )+1 ) ), GS_MAX_TEAMS, true, NULL );

	level.timeout.used[num]++;
	GS_GamestatSetFlag( GAMESTAT_FLAG_PAUSED, true );
	level.timeout.caller = num;
	level.timeout.endtime = level.timeout.time + TIMEOUT_TIME + FRAMETIME;
}
开发者ID:codetwister,项目名称:qfusion,代码行数:42,代码来源:g_cmds.cpp


示例15: Cmd_Timein_f

/*
* Cmd_Timeout_f
*/
static void Cmd_Timein_f( edict_t *ent )
{
	int num;

	if( ent->s.team == TEAM_SPECTATOR )
		return;

	if( !GS_MatchPaused() )
	{
		G_PrintMsg( ent, "No timeout in progress.\n" );
		return;
	}

	if( level.timeout.endtime - level.timeout.time <= 2 * TIMEIN_TIME )
	{
		G_PrintMsg( ent, "The timeout is about to end already.\n" );
		return;
	}

	if( GS_TeamBasedGametype() )
		num = ent->s.team;
	else
		num = ENTNUM( ent )-1;

	if( level.timeout.caller != num )
	{
		if( GS_TeamBasedGametype() )
			G_PrintMsg( ent, "Your team didn't call this timeout.\n" );
		else
			G_PrintMsg( ent, "You didn't call this timeout.\n" );
		return;
	}

	level.timeout.endtime = level.timeout.time + TIMEIN_TIME + FRAMETIME;

	G_AnnouncerSound( NULL, trap_SoundIndex( va( S_ANNOUNCER_TIMEOUT_TIMEIN_1_to_2, ( rand()&1 )+1 ) ), GS_MAX_TEAMS, true, NULL );

	G_PrintMsg( NULL, "%s%s called a timein\n", ent->r.client->netname, S_COLOR_WHITE );
}
开发者ID:codetwister,项目名称:qfusion,代码行数:42,代码来源:g_cmds.cpp


示例16: UnregisterTeamBrain

void AiBaseTeamBrain::OnGametypeChanged( const char *gametype ) {
	// First, unregister all current brains (if any)
	for( int team = TEAM_PLAYERS; team < GS_MAX_TEAMS; ++team )
		UnregisterTeamBrain( team );

	if( GS_TeamBasedGametype() ) {
		for( int team = TEAM_ALPHA; team < GS_MAX_TEAMS; ++team ) {
			RegisterTeamBrain( team, InstantiateTeamBrain( team, gametype ) );
		}
	} else {
		RegisterTeamBrain( TEAM_PLAYERS, InstantiateTeamBrain( TEAM_PLAYERS, gametype ) );
	}
}
开发者ID:adem4ik,项目名称:qfusion,代码行数:13,代码来源:ai_base_team_brain.cpp


示例17: GS_IsTeamDamage

/*
* GS_IsTeamDamage
*/
qboolean GS_IsTeamDamage( entity_state_t *targ, entity_state_t *attacker )
{
	if( !GS_TeamBasedGametype() )
		return qfalse;

	assert( targ && attacker );

	if( targ->team && attacker->team &&
		targ->team == attacker->team &&
		targ->number != attacker->number )
		return qtrue;

	return qfalse;
}
开发者ID:Kaperstone,项目名称:warsow,代码行数:17,代码来源:gs_gameteams.c


示例18: G_WasLeading

/*
* G_WasLeading
*/
static bool G_WasLeading( edict_t *ent )
{
	int num, i;

	if( GS_TeamBasedGametype() )
		num = ent->s.team;
	else
		num = PLAYERNUM( ent ) + 1;

	for( i = 0; i < MAX_CLIENTS && last_leaders[i] != 0; i++ )
	{
		if( last_leaders[i] == num )
			return true;
	}

	return false;
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:20,代码来源:g_gametypes.cpp


示例19: G_Teams_Coach

void G_Teams_Coach( edict_t *ent )
{
	if( GS_TeamBasedGametype() && !GS_InvidualGameType() && ent->s.team != TEAM_SPECTATOR )
	{
		if( !teamlist[ent->s.team].has_coach )
		{
			if( GS_MatchState() > MATCH_STATE_WARMUP && !GS_MatchPaused() )
			{
				G_PrintMsg( ent, "Can't set coach mode with the match in progress\n" );
			}
			else
			{
				// move to coach mode
				ent->r.client->teamstate.is_coach = true;
				G_GhostClient( ent );
				ent->health = ent->max_health;
				ent->deadflag = DEAD_NO;

				G_ChasePlayer( ent, NULL, true, 0 );

				//clear up his scores
				G_Match_Ready( ent ); // set ready and check readys
				memset( &ent->r.client->level.stats, 0, sizeof( ent->r.client->level.stats ) );

				teamlist[ent->s.team].has_coach = true;
				G_PrintMsg( NULL, "%s%s is now team %s coach \n", ent->r.client->netname,
					S_COLOR_WHITE, GS_TeamName( ent->s.team ) );
			}
		}
		else if( ent->r.client->teamstate.is_coach )
		{                            // if you are this team coach, resign
			ent->r.client->teamstate.is_coach = false;
			G_PrintMsg( NULL, "%s%s is no longer team %s coach \n", ent->r.client->netname,
				S_COLOR_WHITE, GS_TeamName( ent->s.team ) );

			G_Teams_SetTeam( ent, ent->s.team );
		}
		else
			G_PrintMsg( ent, "Your team already has a coach.\n" );
	}
	else
		G_PrintMsg( ent, "Coaching only valid while on a team in Team based Gametypes.\n" );
}
开发者ID:tenght,项目名称:qfusion,代码行数:43,代码来源:g_gameteams.cpp


示例20: SetBotFrameAffinity

void AiBaseTeamBrain::AcquireBotFrameAffinity( int entNum ) {
	// Always specify offset as zero for affinity module that = 1 (any % 1 == 0)
	if( AffinityModulo() == 1 ) {
		SetBotFrameAffinity( entNum, AffinityModulo(), 0 );
		return;
	}

	if( GS_TeamBasedGametype() ) {
		unsigned modulo = AffinityModulo(); // Precompute
		static_assert( MAX_AFFINITY_OFFSET == 4, "Only two teams are supported" );
		switch( modulo ) {
			case 4:
				// If the think cycle consist of 4 frames:
				// the Alpha team brain thinks on frame 0, bots of team Alpha think on frame 1,
				// the Beta team brain thinks on frame 2, bots of team Beta think on frame 3
				SetBotFrameAffinity( entNum, modulo, 2 * ( (unsigned)team - TEAM_ALPHA ) + 1 );
				break;
			case 3:
				// If the think cycle consist of 3 frames:
				// team brains think on frame 0, bots of team Alpha think on frame 1, bots of team Beta think on frame 2
				SetBotFrameAffinity( entNum, modulo, 1 + (unsigned)team - TEAM_ALPHA );
				break;
			case 2:
				// If the think cycle consist of 2 frames:
				// the Alpha team brain and team Alpha bot brains think on frame 0,
				// the Beta team brain an team Beta bot brains think on frame 1
				SetBotFrameAffinity( entNum, modulo, (unsigned)team - TEAM_ALPHA );
				break;
		}
	} else {
		// Select less used offset (thus, less loaded frames)
		unsigned chosenOffset = 0;
		for( unsigned i = 1; i < MAX_AFFINITY_OFFSET; ++i ) {
			if( affinityOffsetsInUse[chosenOffset] > affinityOffsetsInUse[i] ) {
				chosenOffset = i;
			}
		}
		affinityOffsetsInUse[chosenOffset]++;
		SetBotFrameAffinity( entNum, AffinityModulo(), chosenOffset );
	}
}
开发者ID:adem4ik,项目名称:qfusion,代码行数:41,代码来源:ai_base_team_brain.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GStrings函数代码示例发布时间:2022-05-30
下一篇:
C++ GS_MatchState函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap