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

C++ CalculateRanks函数代码示例

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

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



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

示例1: wopSP_calcWon

static qboolean wopSP_calcWon(void) {
    int			i;
    gentity_t		*player;
    int			playerClientNum;

    // find the real player
    player = NULL;
    for (i = 0; i < level.maxclients; i++ ) {
        player = &g_entities[i];
        if ( !player->inuse ) {
            continue;
        }
        if ( !( player->r.svFlags & SVF_BOT ) ) {
            break;
        }
    }
    if ( !player || i == level.maxclients ) {
        return qfalse;
    }
    playerClientNum = i;

    if ( g_gametype.integer >= GT_TEAM ) {
        if((player->client->sess.sessionTeam == TEAM_RED && level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE])
                || (player->client->sess.sessionTeam == TEAM_BLUE && level.teamScores[TEAM_RED] < level.teamScores[TEAM_BLUE]))
            return qtrue;
        else
            return qfalse;
    }
    else {
        CalculateRanks();

        return (player->client->ps.persistant[PERS_RANK] == 0);
    }
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:34,代码来源:wopg_sphandling.c


示例2: ObeliskDie

/*
=======================================================================================================================================
ObeliskDie
=======================================================================================================================================
*/
static void ObeliskDie(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) {
	int otherTeam;

	otherTeam = OtherTeam(self->spawnflags);

	self->takedamage = qfalse;
	self->think = ObeliskRespawn;
	self->nextthink = level.time + g_obeliskRespawnDelay.integer * 1000;
	self->activator->s.modelindex2 = 0xff;
	self->activator->s.frame = 2;

	G_AddEvent(self->activator, EV_OBELISKEXPLODE, 0);

	if (self->spawnflags == attacker->client->sess.sessionTeam) {
		AddScore(attacker, self->r.currentOrigin, -CTF_CAPTURE_BONUS);
	} else {
		AddScore(attacker, self->r.currentOrigin, CTF_CAPTURE_BONUS);

		attacker->client->rewardTime = level.time + REWARD_TIME;
		attacker->client->ps.persistant[PERS_CAPTURES]++;
	}

	AddTeamScore(self->s.pos.trBase, otherTeam, 1);
	CalculateRanks();
	Team_CaptureFlagSound(self, self->spawnflags);
	Team_ForceGesture(otherTeam);

	teamgame.redObeliskAttackedTime = 0;
	teamgame.blueObeliskAttackedTime = 0;

	trap_SendServerCommand(-1, va("cp \"%s" S_COLOR_WHITE "\ndestroyed the %s obelisk!\n\"", attacker->client->pers.netname, TeamName(self->spawnflags)));
}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:37,代码来源:g_team.c


示例3: ObeliskTouch

static void ObeliskTouch( gentity_t *self, gentity_t *other, trace_t *trace ) {
	int			tokens;

	if ( !other->client ) {
		return;
	}

	if ( OtherTeam(other->client->sess.sessionTeam) != self->spawnflags ) {
		return;
	}

	tokens = other->client->ps.generic1;
	if( tokens <= 0 ) {
		return;
	}

	PrintMsg(NULL, "%s" S_COLOR_WHITE " brought in %i skull%s.\n",
					other->client->pers.netname, tokens, tokens ? "s" : "" );

	AddTeamScore(self->s.pos.trBase, other->client->sess.sessionTeam, tokens);
	Team_ForceGesture(other->client->sess.sessionTeam);

	AddScore(other, self->r.currentOrigin, CTF_CAPTURE_BONUS*tokens);

	// add the sprite over the player's head
	other->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
	other->client->ps.eFlags |= EF_AWARD_CAP;
	other->client->rewardTime = level.time + REWARD_SPRITE_TIME;
	other->client->ps.persistant[PERS_CAPTURES] += tokens;
	
	other->client->ps.generic1 = 0;
	CalculateRanks();

	Team_CaptureFlagSound( self, self->spawnflags );
}
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:35,代码来源:g_team.c


示例4: AddScore

/*
============
AddScore

Adds score to both the client and his team
============
*/
void AddScore(gentity_t * ent, vec3_t origin, int score)
{
	if(!ent->client)
	{
		return;
	}
	// no scoring during pre-match warmup
	if(level.warmupTime)
	{
		return;
	}

	// Tr3B: don't draw zero skills scores
	if(score == 0)
	{
		return;
	}

	// show score plum
	ScorePlum(ent, origin, score);

	//
	ent->client->ps.persistant[PERS_SCORE] += score;
	if(g_gametype.integer == GT_TEAM)
		level.teamScores[ent->client->ps.persistant[PERS_TEAM]] += score;
	CalculateRanks();
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:34,代码来源:g_combat.c


示例5: ObeliskTouch

/*
=======================================================================================================================================
ObeliskTouch
=======================================================================================================================================
*/
static void ObeliskTouch(gentity_t *self, gentity_t *other, trace_t *trace) {
	int tokens;
	team_t otherTeam;

	if (!other->client) {
		return;
	}

	otherTeam = OtherTeam(other->client->sess.sessionTeam);

	if (otherTeam != self->spawnflags) {
		return;
	}

	tokens = other->client->ps.tokens;

	if (tokens <= 0) {
		return;
	}

	trap_SendServerCommand(-1, va("cp \"%s" S_COLOR_WHITE "\nbrought in %i %s %s!\n\"", other->client->pers.netname, tokens, TeamName(otherTeam), (tokens == 1) ? "skull" : "skulls"));

	other->client->rewardTime = level.time + REWARD_TIME;
	other->client->ps.persistant[PERS_CAPTURES] += tokens;
	other->client->ps.tokens = 0;

	AddScore(other, self->r.currentOrigin, CTF_CAPTURE_BONUS * tokens);
	AddTeamScore(self->s.pos.trBase, other->client->sess.sessionTeam, tokens);
	CalculateRanks();
	Team_CaptureFlagSound(self, self->spawnflags);
	Team_ForceGesture(other->client->sess.sessionTeam);
}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:37,代码来源:g_team.c


示例6: ObeliskDie

static void
ObeliskDie(Gentity *self, Gentity *inflictor, Gentity *attacker,
	   int damage,
	   int mod)
{
	int otherTeam;

	otherTeam = OtherTeam(self->spawnflags);
	AddTeamScore(self->s.pos.base, otherTeam, 1);
	Team_ForceGesture(otherTeam);

	CalculateRanks();

	self->takedamage = qfalse;
	self->think = ObeliskRespawn;
	self->nextthink = level.time + g_obeliskRespawnDelay.integer * 1000;

	self->activator->s.modelindex2 = 0xff;
	self->activator->s.frame = 2;

	G_AddEvent(self->activator, EV_OBELISKEXPLODE, 0);

	AddScore(attacker, self->r.currentOrigin, CTF_CAPTURE_BONUS);

	/* add the sprite over the player's head */
	attacker->client->ps.eFlags &=
		~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET |
		  EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP);
	attacker->client->ps.eFlags |= EF_AWARD_CAP;
	attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
	attacker->client->ps.persistant[PERS_CAPTURES]++;

	teamgame.redObeliskAttackedTime = 0;
	teamgame.blueObeliskAttackedTime = 0;
}
开发者ID:icanhas,项目名称:yantar,代码行数:35,代码来源:team.c


示例7: ClientBegin

/*
===========
ClientBegin

called when a client has finished connecting, and is ready
to be placed into the level.  This will happen every level load,
and on transition between teams, but doesn't happen on respawns
============
*/
void ClientBegin( int clientNum )
{
  gentity_t *ent;
  gclient_t *client;
  int       flags;

  ent = g_entities + clientNum;

  client = level.clients + clientNum;

  if( ent->r.linked )
    trap_UnlinkEntity( ent );

  G_InitGentity( ent );
  ent->touch = 0;
  ent->pain = 0;
  ent->client = client;

  client->pers.connected = CON_CONNECTED;
  client->pers.enterTime = level.time;
  client->pers.teamState.state = TEAM_BEGIN;
  client->pers.classSelection = PCL_NONE;

  // save eflags around this, because changing teams will
  // cause this to happen with a valid entity, and we
  // want to make sure the teleport bit is set right
  // so the viewpoint doesn't interpolate through the
  // world to the new position
  flags = client->ps.eFlags;
  memset( &client->ps, 0, sizeof( client->ps ) );
  memset( &client->pmext, 0, sizeof( client->pmext ) );
  client->ps.eFlags = flags;

  // locate ent at a spawn point

  ClientSpawn( ent, NULL, NULL, NULL );

  trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) );

  // name can change between ClientConnect() and ClientBegin()
  G_admin_namelog_update( client, qfalse );

  // request the clients PTR code
  trap_SendServerCommand( ent - g_entities, "ptrcrequest" );

  G_LogPrintf( "ClientBegin: %i\n", clientNum );

  if( g_clientUpgradeNotice.integer )
  {
    if( !Q_stricmp( ent->client->pers.guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) )
    {
      trap_SendServerCommand( client->ps.clientNum, va( "print \"^1Your client is out of date. Updating your client will allow you to "
        "become an admin on servers and download maps much more quickly. Please replace your client executable with the one "
        "at ^2http://trem.tjw.org/backport/^1 and reconnect. \n\"" ) );
    }
  }

  // count current clients and rank for scoreboard
  CalculateRanks( );
}
开发者ID:asker,项目名称:OmgHaxQVM,代码行数:69,代码来源:g_client.c


示例8: PlayerBegin

/*
===========
PlayerBegin

called when a player has finished connecting, and is ready
to be placed into the level.  This will happen every level load,
and on transition between teams, but doesn't happen on respawns
============
*/
void PlayerBegin( int playerNum ) {
	gentity_t	*ent;
	gplayer_t	*player;
	int			flags;
	int			i;

	ent = g_entities + playerNum;

	player = level.players + playerNum;

	if ( ent->r.linked ) {
		trap_UnlinkEntity( ent );
	}
	G_InitGentity( ent );
	ent->touch = 0;
	ent->pain = 0;
	ent->player = player;

	player->pers.connected = CON_CONNECTED;
	player->pers.enterTime = level.time;
	player->pers.teamState.state = TEAM_BEGIN;

	// save eflags around this, because changing teams will
	// cause this to happen with a valid entity, and we
	// want to make sure the teleport bit is set right
	// so the viewpoint doesn't interpolate through the
	// world to the new position
	flags = player->ps.eFlags;
	memset( &player->ps, 0, sizeof( player->ps ) );
	player->ps.eFlags = flags;

	// locate ent at a spawn point
	PlayerSpawn( ent );

	if ( player->pers.initialSpawn && g_gametype.integer != GT_TOURNAMENT ) {
		// This is only sent to bots because for humans the "joining the battle" etc
		// make it clear that the player is now finished connecting. Bots on the other
		// hand have "entered the game" hard coded in botfiles/match.c so continue to
		// send it to them.
		for ( i = 0; i < level.maxplayers; i++ ) {
			if ( level.players[i].pers.connected == CON_DISCONNECTED ) {
				continue;
			}
			if ( !(g_entities[i].r.svFlags & SVF_BOT) ) {
				continue;
			}

			trap_SendServerCommand( i, va("print \"%s" S_COLOR_WHITE " entered the game\n\"", player->pers.netname) );
		}

		if ( !g_singlePlayer.integer ) {
			BroadcastTeamChange( player, -1 );
		}
	}
	player->pers.initialSpawn = qfalse;
	G_LogPrintf( "PlayerBegin: %i\n", playerNum );

	// count current players and rank for scoreboard
	CalculateRanks();
}
开发者ID:coltongit,项目名称:3wctf,代码行数:69,代码来源:g_client.c


示例9: AddScore

/*
============
AddScore

Adds score to both the client and his team
============
*/
void AddScore( gentity_t *ent, int score )
{
  if( !ent->client )
    return;

  ent->client->ps.persistant[ PERS_SCORE ] += score;
  CalculateRanks( );
}
开发者ID:aminehaddad,项目名称:tremulous-tremball,代码行数:15,代码来源:g_combat.c


示例10: trap_DropClient

/*
===========
ClientDisconnect

Called when a player drops from the server.
Will not be called between levels.

This should NOT be called directly by any game logic,
call trap_DropClient(), which will call this and do
server system housekeeping.
============
*/
void ClientDisconnect( int clientNum ) {
	gentity_t	*ent;
	gentity_t	*tent;
	int			i;

	// cleanup if we are kicking a bot that
	// hasn't spawned yet
	G_RemoveQueuedBotBegin( clientNum );

	ent = g_entities + clientNum;
	if ( !ent->client ) {
		return;
	}

	// stop any following clients
	for ( i = 0 ; i < level.maxclients ; i++ ) {
		if ( level.clients[i].sess.sessionTeam == TEAM_SPECTATOR
			&& level.clients[i].sess.spectatorState == SPECTATOR_FOLLOW
			&& level.clients[i].sess.spectatorClient == clientNum ) {
			StopFollowing( &g_entities[i] );
		}
	}

	// send effect if they were completely connected
	if ( ent->client->pers.connected == CON_CONNECTED 
		&& ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {

		// They don't get to take powerups with them!
		// Especially important for stuff like CTF flags
		TossClientItems( ent );
#ifdef MISSIONPACK
		TossClientPersistantPowerups( ent );
		if( g_gametype.integer == GT_HARVESTER ) {
			TossClientCubes( ent );
		}
#endif

	}

	G_LogPrintf( "ClientDisconnect: %i\n", clientNum );


	trap_UnlinkEntity (ent);
	ent->s.modelindex = 0;
	ent->inuse = qfalse;
	ent->classname = "disconnected";
	ent->client->pers.connected = CON_DISCONNECTED;
	ent->client->ps.stats[STAT_TEAM] = TEAM_FREE;
	ent->client->sess.sessionTeam = TEAM_FREE;

	trap_SetConfigstring( CS_PLAYERS + clientNum, "");

	CalculateRanks();

	if ( ent->r.svFlags & SVF_BOT ) {
		BotAIShutdownClient( clientNum, qfalse );
	}
}
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:70,代码来源:g_client.c


示例11: UpdateTournamentInfo

/*
==================
UpdateTournamentInfo
==================
*/
void UpdateTournamentInfo( void )
{
    int             n, accuracy, perfect;
    char            buf[32], msg[MAX_STRING_CHARS];
    unsigned int    playerClientNum, i, buflen, msglen;
    gentity_t       *player;

    // find the real player
    player = NULL;
    for (i = 0; i < level.maxclients; i++ )
    {
        player = &g_entities[i];
        if ( !player->inuse )
            continue;
        if ( !( player->r.svFlags & SVF_BOT ) )
            break;
    }

    // this should never happen!
    if ( !player || i == level.maxclients )
        return;

    playerClientNum = i;

    CalculateRanks();

    if ( level.clients[playerClientNum].sess.sessionTeam == TEAM_SPECTATOR )
    {
        Com_sprintf( msg, sizeof(msg), "postgame %i %i 0 0 0 0 0 0", level.numNonSpectatorClients, playerClientNum );
    }
    else
    {
        if( player->client->accuracy_shots )
            accuracy = player->client->accuracy_hits * 100 / player->client->accuracy_shots;
        else
            accuracy = 0;

        perfect = ( level.clients[playerClientNum].ps.persistant[PERS_RANK] == 0 && player->client->ps.persistant[PERS_KILLED] == 0 ) ? 1 : 0;
        Com_sprintf( msg, sizeof(msg), "postgame %i %i %i %i %i %i %i %i", level.numNonSpectatorClients, playerClientNum, accuracy,
                     player->client->ps.persistant[PERS_IMPRESSIVE_COUNT], player->client->ps.persistant[PERS_EXCELLENT_COUNT],
                     player->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT], player->client->ps.persistant[PERS_SCORE],
                     perfect );
    }

    msglen = strlen( msg );
    for( i = 0; i < level.numNonSpectatorClients; i++ )
    {
        n = level.sortedClients[i];
        Com_sprintf( buf, sizeof(buf), " %i %i %i", n, level.clients[n].ps.persistant[PERS_RANK], level.clients[n].ps.persistant[PERS_SCORE] );
        buflen = strlen( buf );
        if( msglen + buflen + 1 >= sizeof(msg) )
        {
            break;
        }
        strcat( msg, buf );
    }
    Cbuf_ExecuteText(EXEC_APPEND, msg );
}
开发者ID:zturtleman,项目名称:recoil,代码行数:63,代码来源:g_arenas.c


示例12: trap_DropClient

/*
===========
ClientDisconnect

Called when a player drops from the server.
Will not be called between levels.

This should NOT be called directly by any game logic,
call trap_DropClient(), which will call this and do
server system housekeeping.
============
*/
void ClientDisconnect( int clientNum )
{
  gentity_t *ent;
  gentity_t *tent;
  int       i;
  buildHistory_t *ptr;

  ent = g_entities + clientNum;

  if( !ent->client )
    return;

  // look through the bhist and readjust it if the referenced ent has left
  for( ptr = level.buildHistory; ptr; ptr = ptr->next )
  {
    if( ptr->ent == ent )
    {
      ptr->ent = NULL;
      Q_strncpyz( ptr->name, ent->client->pers.netname, MAX_NETNAME );
    }
  }

  G_admin_namelog_update( ent->client, qtrue );
  G_LeaveTeam( ent );

  // stop any following clients
  for( i = 0; i < level.maxclients; i++ )
  {
    // remove any /ignore settings for this clientNum
    BG_ClientListRemove( &level.clients[ i ].sess.ignoreList, clientNum );
  }

  // send effect if they were completely connected
  if( ent->client->pers.connected == CON_CONNECTED &&
      ent->client->sess.sessionTeam != TEAM_SPECTATOR )
  {
    tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_OUT );
    tent->s.clientNum = ent->s.clientNum;
  }

  if( ent->client->pers.connection )
    ent->client->pers.connection->clientNum = -1;

  G_LogPrintf( "ClientDisconnect: %i [%s] (%s) \"%s\"\n", clientNum,
   ent->client->pers.ip, ent->client->pers.guid, ent->client->pers.netname );

  trap_UnlinkEntity( ent );
  ent->s.modelindex = 0;
  ent->inuse = qfalse;
  ent->classname = "disconnected";
  ent->client->pers.connected = CON_DISCONNECTED;
  ent->client->ps.persistant[ PERS_TEAM ] = TEAM_FREE;
  ent->client->sess.sessionTeam = TEAM_FREE;

  trap_SetConfigstring( CS_PLAYERS + clientNum, "");

  CalculateRanks( );
}
开发者ID:asker,项目名称:OmgHaxQVM,代码行数:70,代码来源:g_client.c


示例13: ClientBegin

/*
===========
ClientBegin

called when a client has finished connecting, and is ready
to be placed into the level.  This will happen every level load,
and on transition between teams, but doesn't happen on respawns
============
*/
void ClientBegin(int clientNum)
{
  gentity_t      *ent;
  gclient_t      *client;
  gentity_t      *tent;
  int             flags;

  ent = g_entities + clientNum;

  client = level.clients + clientNum;

  if(ent->r.linked)
  {
    trap_UnlinkEntity(ent);
  }
  G_InitGentity(ent);
  ent->touch = 0;
  ent->pain = 0;
  ent->client = client;

  client->pers.connected = CON_CONNECTED;
  client->pers.enterTime = level.time;
  client->pers.teamState.state = TEAM_BEGIN;

  // save eflags around this, because changing teams will
  // cause this to happen with a valid entity, and we
  // want to make sure the teleport bit is set right
  // so the viewpoint doesn't interpolate through the
  // world to the new position
  flags = client->ps.eFlags;
  memset(&client->ps, 0, sizeof(client->ps));
  client->ps.eFlags = flags;

  // locate ent at a spawn point
  ClientSpawn(ent);

  if(client->sess.sessionTeam != TEAM_SPECTATOR)
  {
    // send event
    tent = G_TempEntity(ent->client->ps.origin, EV_PLAYER_TELEPORT_IN);
    tent->s.clientNum = ent->s.clientNum;

    if(g_gametype.integer != GT_TOURNAMENT)
    {
      trap_SendServerCommand(-1, va("print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname));
    }
  }
  G_LogPrintf("ClientBegin: %i\n", clientNum);

  // count current clients and rank for scoreboard
  CalculateRanks();

#ifdef G_LUA
  // Lua API callbacks
  G_LuaHook_ClientBegin(clientNum);
#endif
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:66,代码来源:g_client.c


示例14: AddTeamScore

// TODO: Draw a ScorePlum() as well? Needs cgame fixes to draw plum regardless of "owner"
void AddTeamScore( vec3_t origin, int team, int score, char *reason ) {
	gentity_t	*te;

	te = G_TempEntity(origin, EV_GLOBAL_TEAM_SOUND );
	te->r.svFlags |= SVF_BROADCAST;

	if ( team == TEAM_RED ) {
		if ( level.teamScores[ TEAM_RED ] + score == level.teamScores[ TEAM_BLUE ] ) {
			//teams are tied sound
			te->s.eventParm = GTS_TEAMS_ARE_TIED;
		}
		else if ( level.teamScores[ TEAM_RED ] <= level.teamScores[ TEAM_BLUE ] &&
					level.teamScores[ TEAM_RED ] + score > level.teamScores[ TEAM_BLUE ]) {
			// red took the lead sound
			te->s.eventParm = GTS_REDTEAM_TOOK_LEAD;
		}
		else {
			// red scored sound
			te->s.eventParm = GTS_REDTEAM_SCORED;

			// Hackity! In BB teams score continously, which makes for annoying
			// sound spam. Thus disable sound.
			// Better solution would be to either only do this sound on captures/destroys
			// or continously at fixed time offsets.
			// Also note that there already is a "blue/red balloon" sound in cgame CG_UpdateBalloonStates
			if ( g_gametype.integer == GT_BALLOON ) {
				G_FreeEntity( te );
			}
		}
	}
	else {
		if ( level.teamScores[ TEAM_BLUE ] + score == level.teamScores[ TEAM_RED ] ) {
			//teams are tied sound
			te->s.eventParm = GTS_TEAMS_ARE_TIED;
		}
		else if ( level.teamScores[ TEAM_BLUE ] <= level.teamScores[ TEAM_RED ] &&
					level.teamScores[ TEAM_BLUE ] + score > level.teamScores[ TEAM_RED ]) {
			// blue took the lead sound
			te->s.eventParm = GTS_BLUETEAM_TOOK_LEAD;
		}
		else {
			// blue scored sound
			te->s.eventParm = GTS_BLUETEAM_SCORED;

			// See note above
			if ( g_gametype.integer == GT_BALLOON ) {
				G_FreeEntity( te );
			}
		}
	}
	level.teamScores[ team ] += score;

	CalculateRanks();

	G_LogPrintf( "AddTeamScore: %s %i %s\n", TeamName( team ), score, reason );
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:57,代码来源:g_team.c


示例15: ClientBegin

/*
===========
ClientBegin

called when a client has finished connecting, and is ready
to be placed into the level.  This will happen every level load,
and on transition between teams, but doesn't happen on respawns
============
*/
void ClientBegin( int clientNum )
{
  gentity_t *ent;
  gclient_t *client;
  int       flags;

  ent = g_entities + clientNum;

  client = level.clients + clientNum;

  // ignore if client already entered the game
  if( client->pers.connected != CON_CONNECTING )
    return;

  if( ent->r.linked )
    trap_UnlinkEntity( ent );

  G_InitGentity( ent );
  ent->touch = 0;
  ent->pain = 0;
  ent->client = client;

  client->pers.connected = CON_CONNECTED;
  client->pers.enterTime = level.time;

  // save eflags around this, because changing teams will
  // cause this to happen with a valid entity, and we
  // want to make sure the teleport bit is set right
  // so the viewpoint doesn't interpolate through the
  // world to the new position
  flags = client->ps.eFlags;
  memset( &client->ps, 0, sizeof( client->ps ) );
  memset( &client->pmext, 0, sizeof( client->pmext ) );
  client->ps.eFlags = flags;

  // locate ent at a spawn point
  ClientSpawn( ent, NULL, NULL, NULL );

  trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) );

  G_namelog_restore( client );

  G_LogPrintf( "ClientBegin: %i\n", clientNum );

  // count current clients and rank for scoreboard
  CalculateRanks( );

  // send the client a list of commands that can be used
  G_ListCommands( ent );
  
  // reset cuboidSelection
  client->cuboidSelection[ 0 ] =
  client->cuboidSelection[ 1 ] =
  client->cuboidSelection[ 2 ] = 32;
}
开发者ID:DolceTriade,项目名称:cuboid,代码行数:64,代码来源:g_client.c


示例16: AddScoreHelper

/*
============
AddScoreHelper

Helper function for G_AddCreditsToScore and G_AddConfidenceToScore.
============
*/
static void AddScoreHelper( gentity_t *self, float score )
{
	if ( !self->client || self->client->pers.connected != CON_CONNECTED )
	{
		return;
	}

	self->client->ps.persistant[ PERS_SCORE ] += ( int )( score + 0.5f );

	CalculateRanks();
}
开发者ID:luislezcair,项目名称:Unvanquished,代码行数:18,代码来源:g_combat.c


示例17: G_AddKillSkillPointsForDestruction

/**
 * @brief G_AddKillSkillPointsForDestruction
 * @param[in] attacker
 * @param[in] mod
 * @param[in] constructibleStats
 */
void G_AddKillSkillPointsForDestruction(gentity_t *attacker, meansOfDeath_t mod, g_constructible_stats_t *constructibleStats)
{
	if (GetMODTableData(mod)->skillType < SK_NUM_SKILLS)
	{
		G_AddSkillPoints(attacker, GetMODTableData(mod)->skillType, constructibleStats->destructxpbonus);
		G_DebugAddSkillPoints(attacker, GetMODTableData(mod)->skillType, constructibleStats->destructxpbonus, "destroying a constructible/explosive");
	}

	// prepare scoreboard
	CalculateRanks();
}
开发者ID:zturtleman,项目名称:etlegacy,代码行数:17,代码来源:g_stats.c


示例18: trap_DropClient

/*
===========
ClientDisconnect

Called when a player drops from the server.
Will not be called between levels.

This should NOT be called directly by any game logic,
call trap_DropClient(), which will call this and do
server system housekeeping.
============
*/
void ClientDisconnect( int clientNum )
{
  gclient_t *client;
  gentity_t *ent;
  gentity_t *tent;
  int       i;

  ent = g_entities + clientNum;

  if( !ent->client || ent->client->pers.connected == CON_DISCONNECTED )
    return;

  G_LeaveTeam( ent );
  G_namelog_disconnect( ent->client );
  G_Vote( ent, TEAM_NONE, qfalse );

  // stop any following clients
  for( i = 0; i < level.maxclients; i++ )
  {
    client = &level.clients[ i ];
    
    // remove any /ignore settings for this clientNum
    Com_ClientListRemove( &client->sess.ignoreList, clientNum );
    
    // clear impregnatedBy for everyone impregnated by this player
    if( client->isImpregnated && client->impregnatedBy == clientNum )
      client->impregnatedBy = -2;   
  }

  // send effect if they were completely connected
  if( ent->client->pers.connected == CON_CONNECTED &&
      ent->client->sess.spectatorState == SPECTATOR_NOT )
  {
    tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_OUT );
    tent->s.clientNum = ent->s.clientNum;
  }

  G_LogPrintf( "ClientDisconnect: %i [%s] (%s) \"%s^7\"\n", clientNum,
   ent->client->pers.ip.str, ent->client->pers.guid, ent->client->pers.netname );

  trap_UnlinkEntity( ent );
  ent->s.modelindex = 0;
  ent->inuse = qfalse;
  ent->classname = "disconnected";
  ent->client->pers.connected = CON_DISCONNECTED;
  ent->client->sess.spectatorState =
      ent->client->ps.persistant[ PERS_SPECSTATE ] = SPECTATOR_NOT;

  trap_SetConfigstring( CS_PLAYERS + clientNum, "");

  CalculateRanks( );
}
开发者ID:DolceTriade,项目名称:cuboid,代码行数:64,代码来源:g_client.c


示例19: G_AddKillSkillPoints

/**
 * @brief G_AddKillSkillPoints
 * @param[in] attacker
 * @param[in] mod
 * @param[in] hr
 * @param[in] splash
 */
void G_AddKillSkillPoints(gentity_t *attacker, meansOfDeath_t mod, hitRegion_t hr, qboolean splash)
{
	float       points;
	skillType_t skillType;
	const char  *reason;

	if (!attacker->client)
	{
		return;
	}

	if (GetMODTableData(mod)->hasHitRegion)
	{
		points = GetMODTableData(mod)->hitRegionKillPoints[hr];

		switch (hr)
		{
		case HR_HEAD: reason = va("%s headshot kill", GetMODTableData(mod)->debugReasonMsg); break;
		case HR_ARMS: reason = va("%s armshot kill", GetMODTableData(mod)->debugReasonMsg); break;
		case HR_BODY: reason = va("%s bodyshot kill", GetMODTableData(mod)->debugReasonMsg); break;
		case HR_LEGS: reason = va("%s legshot kill", GetMODTableData(mod)->debugReasonMsg); break;
		default:      reason = va("%s kill", GetMODTableData(mod)->debugReasonMsg); break; // for weapons that don't have localized damage, should not happen
		}
	}
	else if (splash)
	{
		points = GetMODTableData(mod)->splashKillPoints;

		reason = va("%s splash damage kill", GetMODTableData(mod)->debugReasonMsg);
	}
	else
	{
		points = GetMODTableData(mod)->defaultKillPoints;

		if (GetMODTableData(mod)->isExplosive)
		{
			reason = va("%s direct damage kill", GetMODTableData(mod)->debugReasonMsg);
		}
		else
		{
			reason = va("%s kill", GetMODTableData(mod)->debugReasonMsg);
		}
	}

	skillType = GetMODTableData(mod)->skillType;

	G_AddSkillPoints(attacker, skillType, points);
	G_DebugAddSkillPoints(attacker, skillType, points, reason);

	// prepare scoreboard
	CalculateRanks();
}
开发者ID:zturtleman,项目名称:etlegacy,代码行数:59,代码来源:g_stats.c


示例20: AddKillScore

/*
============
AddKillScore

Adds score to both the client and his team, only used for playerkills, for lms
============
*/
void AddKillScore( gentity_t *ent, int score ) {
	if ( !ent || !ent->client ) {
		return;
	}

	// someone already won
	if( level.lmsWinningTeam )
		return;

	ent->client->sess.game_points += score;

	CalculateRanks();
}
开发者ID:leakcim1324,项目名称:ETrun,代码行数:20,代码来源:g_combat.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CalendarEventType函数代码示例发布时间:2022-05-30
下一篇:
C++ CalculatePctN函数代码示例发布时间: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