Пример #1
0
/*
=======================================================================================================================================
Team_GetLocationMsg

Report a location for the player. Uses placed nearby target_location entities.
=======================================================================================================================================
*/
qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen) {
	gentity_t *best;

	best = Team_GetLocation(ent);

	if (!best) {
		return qfalse;
	}

	if (best->count) {
		if (best->count < 0) {
			best->count = 0;
		}

		if (best->count > 7) {
			best->count = 7;
		}

		Com_sprintf(loc, loclen, "%c%c%s" S_COLOR_WHITE, Q_COLOR_ESCAPE, best->count + '0', best->message);
	} else {
		Com_sprintf(loc, loclen, "%s", best->message);
	}

	return qtrue;
}
Пример #2
0
void CheckTeamStatus( void ) {
	int i;
	gentity_t *loc, *ent;

	if ( level.time - level.lastTeamLocationTime > TEAM_LOCATION_UPDATE_TIME ) {

		level.lastTeamLocationTime = level.time;

		for ( i = 0; i < g_maxclients.integer; i++ ) {
			ent = g_entities + i;
			if ( ent->inuse &&
				 ( ent->client->sess.sessionTeam == TEAM_RED ||
				   ent->client->sess.sessionTeam == TEAM_BLUE ) ) {
				loc = Team_GetLocation( ent );
				if ( loc ) {
					ent->client->pers.teamState.location = loc->health;
				} else {
					ent->client->pers.teamState.location = 0;
				}
			}
		}

		for ( i = 0; i < g_maxclients.integer; i++ ) {
			ent = g_entities + i;
			if ( ent->inuse &&
				 ( ent->client->sess.sessionTeam == TEAM_RED ||
				   ent->client->sess.sessionTeam == TEAM_BLUE ) ) {
				TeamplayInfoMessage( ent );
			}
		}
	}
}
Пример #3
0
/*
===========
Team_GetLocationMsg
============
*/
bool Team_GetLocationMsg ( gentity_t *ent, char *loc, int loclen )
{
	gentity_t *best;

	best = Team_GetLocation( ent );
	
	if (!best)
	{
		return false;
	}

	sprintf_s(loc, loclen, "%s", best->message);

	return true;
}
Пример #4
0
void CheckTeamStatus(void) {
	int i;
	locationData_t *loc;
	gentity_t *ent;

	if (level.time - level.lastTeamLocationTime > TEAM_LOCATION_UPDATE_TIME) {

		level.lastTeamLocationTime = level.time;

		for (i = 0; i < sv_maxclients.integer; i++) {
			ent = g_entities + i;

			if ( !ent->client )
			{
				continue;
			}

			if ( ent->client->pers.connected != CON_CONNECTED ) {
				continue;
			}

			if (ent->inuse && (ent->client->sess.sessionTeam == TEAM_RED ||	ent->client->sess.sessionTeam == TEAM_BLUE)) {
				loc = Team_GetLocation( ent );
				if (loc)
					ent->client->pers.teamState.location = loc->cs_index;
				else
					ent->client->pers.teamState.location = 0;
			}
		}

		for (i = 0; i < sv_maxclients.integer; i++) {
			ent = g_entities + i;

			if ( !ent->client ) // uhm
				continue;

			if ( ent->client->pers.connected != CON_CONNECTED ) {
				continue;
			}

			if (ent->inuse) {
				TeamplayInfoMessage( ent );
			}
		}
	}
}
Пример #5
0
/*
 * Team_GetLocation
 *
 * Report a location for the player. Uses placed nearby target_location entities
 */
qbool
Team_GetLocationMsg(Gentity *ent, char *loc, int loclen)
{
	Gentity *best;

	best = Team_GetLocation(ent);

	if(!best)
		return qfalse;

	if(best->count){
		if(best->count < 0)
			best->count = 0;
		if(best->count > 7)
			best->count = 7;
		Q_sprintf(loc, loclen, "%c%c%s" S_COLOR_WHITE, Q_COLOR_ESCAPE,
			best->count + '0',
			best->message);
	}else
		Q_sprintf(loc, loclen, "%s", best->message);

	return qtrue;
}
Пример #6
0
void CheckTeamStatus( void )
{
	int       i;
	gentity_t *loc, *ent;

	if ( level.time - level.lastTeamLocationTime > TEAM_LOCATION_UPDATE_TIME )
	{
		level.lastTeamLocationTime = level.time;

		for ( i = 0; i < g_maxclients.integer; i++ )
		{
			ent = g_entities + i;

			if ( ent->client->pers.connected != CON_CONNECTED )
			{
				continue;
			}

			if ( ent->inuse && ( ent->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ||
			                     ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) )
			{
				loc = Team_GetLocation( ent );

				if ( loc )
				{
					ent->client->pers.location = loc->s.generic1;
				}
				else
				{
					ent->client->pers.location = 0;
				}
			}
		}

		for ( i = 0; i < g_maxclients.integer; i++ )
		{
			ent = g_entities + i;

			if ( ent->client->pers.connected != CON_CONNECTED )
			{
				continue;
			}

			if ( ent->inuse )
			{
				TeamplayInfoMessage( ent );
			}
		}
	}

	// Warn on imbalanced teams
	if ( g_teamImbalanceWarnings.integer && !level.intermissiontime &&
	     ( level.time - level.lastTeamImbalancedTime >
	       ( g_teamImbalanceWarnings.integer * 1000 ) ) &&
	     level.numTeamImbalanceWarnings < 3 && !level.restarted )
	{
		level.lastTeamImbalancedTime = level.time;

		if ( level.numAlienSpawns > 0 &&
		     level.numHumanClients - level.numAlienClients > 2 )
		{
			trap_SendServerCommand( -1, "print_tr \"" N_("Teams are imbalanced. "
			                        "Humans have more players.\n") "\"" );
			level.numTeamImbalanceWarnings++;
		}
		else if ( level.numHumanSpawns > 0 &&
		          level.numAlienClients - level.numHumanClients > 2 )
		{
			trap_SendServerCommand( -1, "print_tr \"" N_("Teams are imbalanced. "
			                        "Aliens have more players.\n") "\"" );
			level.numTeamImbalanceWarnings++;
		}
		else
		{
			level.numTeamImbalanceWarnings = 0;
		}
	}
}