Esempio n. 1
0
/*
==================
G_LeaveTeam
==================
*/
void G_LeaveTeam( gentity_t *self )
{
	team_t    team = self->client->pers.teamSelection;
	gentity_t *ent;
	int       i;

	if ( team == TEAM_ALIENS )
	{
		G_RemoveFromSpawnQueue( &level.alienSpawnQueue, self->client->ps.clientNum );
	}
	else if ( team == TEAM_HUMANS )
	{
		G_RemoveFromSpawnQueue( &level.humanSpawnQueue, self->client->ps.clientNum );
	}
	else
	{
		if ( self->client->sess.spectatorState == SPECTATOR_FOLLOW )
		{
			G_StopFollowing( self );
		}

		return;
	}

	// stop any following clients
	G_StopFromFollowing( self );

	G_Vote( self, team, qfalse );
	self->suicideTime = 0;

	for ( i = 0; i < level.num_entities; i++ )
	{
		ent = &g_entities[ i ];

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

		if ( ent->client && ent->client->pers.connected == CON_CONNECTED )
		{
			// cure poison
			if ( ent->client->ps.stats[ STAT_STATE ] & SS_POISONED &&
			     ent->client->lastPoisonClient == self )
			{
				ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
			}
		}
		else if ( ent->s.eType == ET_MISSILE && ent->r.ownerNum == self->s.number )
		{
			G_FreeEntity( ent );
		}
	}

	// cut all relevant zap beams
	G_ClearPlayerZapEffects( self );

	G_namelog_update_score( self->client );
}
Esempio n. 2
0
void TeleportPlayer(gentity_t *player, vec3_t origin, vec3_t angles, float speed)
{
    // unlink to make sure it can't possibly interfere with G_KillBox
    G_UnlinkEntity(player);

    VectorCopy(origin, player->client->ps.origin);
    player->client->ps.groundEntityNum = ENTITYNUM_NONE;
    player->client->ps.stats[STAT_STATE] &= ~SS_GRABBED;

    AngleVectors(angles, player->client->ps.velocity, NULL, NULL);
    VectorScale(player->client->ps.velocity, speed, player->client->ps.velocity);
    player->client->ps.pm_time = 0.4f * fabs(speed);  // duration of loss of control
    if (player->client->ps.pm_time > 160)
        player->client->ps.pm_time = 160;
    if (player->client->ps.pm_time != 0)
        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, true);

    // use the precise origin for linking
    VectorCopy(player->client->ps.origin, player->r.currentOrigin);
    VectorCopy(player->client->ps.viewangles, player->r.currentAngles);

    if (player->client->sess.spectatorState == SPECTATOR_NOT)
    {
        // kill anything at the destination
        G_KillBox(player);

        G_LinkEntity(player);
    }
}
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 )
  {
    player->client->notrackEndTime = level.time + g_teleportSafeTime.integer;
  
    // kill anything at the destination
    G_KillBox( player );

    trap_LinkEntity (player);
  }
}
Esempio n. 4
0
void G_LeaveTeam( gentity_t *self )
{
	team_t    team = (team_t) self->client->pers.team;
	gentity_t *ent;
	int       i;

#ifdef UNREALARENA
	if ( TEAM_Q == team || TEAM_U == team )
#else
	if ( TEAM_ALIENS == team || TEAM_HUMANS == team )
#endif
	{
		G_RemoveFromSpawnQueue( &level.team[ team ].spawnQueue, self->client->ps.clientNum );
	}
	else
	{
		if ( self->client->sess.spectatorState == SPECTATOR_FOLLOW )
		{
			G_StopFollowing( self );
		}

		return;
	}

	// stop any following clients
	G_StopFromFollowing( self );

	G_Vote( self, team, false );
#ifndef UNREALARENA
	self->suicideTime = 0;
#endif

	for ( i = 0; i < level.num_entities; i++ )
	{
		ent = &g_entities[ i ];

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

		if ( ent->client && ent->client->pers.connected == CON_CONNECTED )
		{
#ifndef UNREALARENA
			// cure poison
			if ( ( ent->client->ps.stats[ STAT_STATE ] & SS_POISONED ) &&
			     ent->client->lastPoisonClient == self )
			{
				ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
			}
#endif
		}
		else if ( ent->s.eType == entityType_t::ET_MISSILE && ent->r.ownerNum == self->s.number )
		{
			G_FreeEntity( ent );
		}
	}

	// cut all relevant zap beams
	G_ClearPlayerZapEffects( self );

	Beacon::DeleteTags( self );
	Beacon::RemoveOrphaned( self->s.number );

	G_namelog_update_score( self->client );
}