コード例 #1
0
ファイル: FP_Absorb.cpp プロジェクト: mehmehsomeone/OpenRP
void ForceAbsorb( gentity_t *self )
{
	if ( self->health <= 0 )
		return;


	if (self->client->ps.forceAllowDeactivateTime < level.time &&
		(self->client->ps.fd.forcePowersActive & (1 << FP_ABSORB)) )
	{
		WP_ForcePowerStop( self, FP_ABSORB );
		return;
	}

	if ( !WP_ForcePowerUsable( self, FP_ABSORB ) )
		return;


	/*
	// Make sure to turn off Force Rage and Force Protection.
	if (self->client->ps.fd.forcePowersActive & (1 << FP_RAGE) )
		WP_ForcePowerStop( self, FP_RAGE );
	if (self->client->ps.fd.forcePowersActive & (1 << FP_MANIPULATE) )
		WP_ForcePowerStop( self, FP_MANIPULATE );
	*/

	self->client->ps.forceAllowDeactivateTime = level.time + 1500;

	WP_ForcePowerStart( self, FP_ABSORB, 0 );
	G_PreDefSound(self->client->ps.origin, PDSOUND_ABSORB);
	G_Sound( self, TRACK_CHANNEL_3, absorbLoopSound );
}
コード例 #2
0
void CGCam_Enable( void )
{
	client_camera.bar_alpha = 0.0f;
	client_camera.bar_time = cg.time;

	client_camera.bar_alpha_source = 0.0f;
	client_camera.bar_alpha_dest = 1.0f;
	
	client_camera.bar_height_source = 0.0f;
//	client_camera.bar_height_dest = 480/10;
	client_camera.bar_height_dest = 480/LETTERBOX_BAR_HEIGHT_DIVISOR;
	client_camera.bar_height = 0.0f;

	client_camera.info_state |= CAMERA_BAR_FADING;

	client_camera.FOV	= CAMERA_DEFAULT_FOV;
	client_camera.FOV2	= CAMERA_DEFAULT_FOV;

	in_camera = true;

	client_camera.next_roff_time = 0;

	if ( &g_entities[0] && g_entities[0].client )
	{
		//Player zero not allowed to do anything
		VectorClear( g_entities[0].client->ps.velocity );
		g_entities[0].contents = 0;

		if ( cg.zoomMode )
		{
			// need to shut off some form of zooming
			cg.zoomMode = 0;
		}

		if ( g_entities[0].client->ps.saberInFlight && g_entities[0].client->ps.saber[0].Active() )
		{//saber is out
			gentity_t *saberent = &g_entities[g_entities[0].client->ps.saberEntityNum];
			if ( saberent )
			{
				WP_SaberCatch( &g_entities[0], saberent, qfalse );
			}
		}

		for ( int i = 0; i < NUM_FORCE_POWERS; i++ )
		{//deactivate any active force powers
			g_entities[0].client->ps.forcePowerDuration[i] = 0;
extern void WP_ForcePowerStop( gentity_t *self, forcePowers_t forcePower );
			if ( g_entities[0].client->ps.forcePowerDuration[i] || (g_entities[0].client->ps.forcePowersActive&( 1 << i )) )
			{
				WP_ForcePowerStop( &g_entities[0], (forcePowers_t)i );
			}
		}
	}

#ifdef _XBOX
	extern char entityVisList[2024 + 256];
	memset(entityVisList, -1, sizeof(entityVisList));
#endif
}
コード例 #3
0
ファイル: g_camera.c プロジェクト: jwginge/ojpa
void EnablePlayerCameraPos(gentity_t *player)
{//set this player it be in camera mode
	int x;

	if(!player || !player->client || !player->inuse)
	{//bad player entity
		return;
	}

	//turn off zoomMode
	player->client->ps.zoomMode = 0;

	//holster sabers
	player->client->ps.saberHolstered = 2;

	if ( player->client->ps.saberInFlight && player->client->ps.saberEntityNum )
	{//saber is out
		gentity_t *saberent = &g_entities[player->client->ps.saberEntityNum];
		if ( saberent )
		{//force the weapon back to our hand.
			saberent->genericValue5 = 0;
			saberent->think = SaberUpdateSelf;
			saberent->nextthink = level.time;
			WP_SaberRemoveG2Model( saberent );
			
			player->client->ps.saberInFlight = qfalse;
			player->client->ps.saberEntityState = 0;
			player->client->ps.saberThrowDelay = level.time + 500;
			player->client->ps.saberCanThrow = qfalse;
		}
	}

	for ( x = 0; x < NUM_FORCE_POWERS; x++ )
	{//deactivate any active force powers
		player->client->ps.fd.forcePowerDuration[x] = 0;
		if ( player->client->ps.fd.forcePowerDuration[x] || (player->client->ps.fd.forcePowersActive&( 1 << x )) )
		{
			WP_ForcePowerStop( player, (forcePowers_t)x );
		}
	}

	VectorClear( player->client->ps.velocity );
	
	//make invisible
	player->s.eFlags |= EF_NODRAW;
	player->client->ps.eFlags |= EF_NODRAW;

	//go noclip
	player->client->noclip = qtrue;

	//save our current position to the array
	VectorCopy(player->client->ps.origin, playerCamPos[player->s.number].origin);
	VectorCopy(player->client->ps.viewangles, playerCamPos[player->s.number].viewangles);
	playerCamPos[player->s.number].inuse = qtrue;
}
コード例 #4
0
ファイル: FP_Rage.cpp プロジェクト: mehmehsomeone/OpenRP
void ForceRage( gentity_t *self )
{
    if ( self->health <= 0 )
        return;


    if (self->client->ps.forceAllowDeactivateTime < level.time &&
            (self->client->ps.fd.forcePowersActive & (1 << FP_RAGE)) )
    {
        WP_ForcePowerStop( self, FP_RAGE );
        return;
    }

    if ( !WP_ForcePowerUsable( self, FP_RAGE ) )
        return;


    if (self->client->ps.fd.forceRageRecoveryTime >= level.time)
        return;


    if (self->health < 10)
        return;


    // Make sure to turn off Force Protection and Force Absorb.
    //[OpenRP - This isn't protection anymore, it's manipulate]
    /*if (self->client->ps.fd.forcePowersActive & (1 << FP_MANIPULATE) )
    	WP_ForcePowerStop( self, FP_MANIPULATE );*/
    //[/OpenRP - This isn't protection anymore, it's manipulate]

    if (self->client->ps.fd.forcePowersActive & (1 << FP_ABSORB) )
        WP_ForcePowerStop( self, FP_ABSORB );

    self->client->ps.forceAllowDeactivateTime = level.time + 1500;

    WP_ForcePowerStart( self, FP_RAGE, 0 );

    G_Sound( self, TRACK_CHANNEL_4, G_SoundIndex("sound/weapons/force/rage.wav") );
    G_Sound( self, TRACK_CHANNEL_3, rageLoopSound );
}
コード例 #5
0
ファイル: FP_Grip.cpp プロジェクト: mehmehsomeone/OpenRP
void DoGripAction(gentity_t *self, forcePowers_t forcePower)
{//racc - have someone in our grip, deal with them.
	gentity_t *gripEnt;
	int gripLevel = 0;
	trace_t tr;
	vec3_t a;

	self->client->dangerTime = level.time;
	self->client->ps.eFlags &= ~EF_INVULNERABLE;
	self->client->invulnerableTimer = 0;

	gripEnt = &g_entities[self->client->ps.fd.forceGripEntityNum];

	if (!ValidGripEnt(self,gripEnt))
	{
		WP_ForcePowerStop(self,FP_GRIP);
		self->client->ps.fd.forceGripEntityNum = ENTITYNUM_NONE;

		if (gripEnt && gripEnt->client && gripEnt->inuse)
		{
			gripEnt->client->ps.forceGripChangeMovetype = PM_NORMAL;
		}
		return;
	}

	if(gripEnt->client)
		VectorSubtract(gripEnt->client->ps.origin, self->client->ps.origin, a);
	else
		VectorSubtract(gripEnt->s.pos.trBase,self->client->ps.origin,a);

	if(gripEnt->client)
		trap_Trace(&tr, self->client->ps.origin, NULL, NULL, gripEnt->client->ps.origin, self->s.number, MASK_PLAYERSOLID);
	else
		trap_Trace(&tr, self->client->ps.origin, NULL, NULL, gripEnt->s.pos.trBase, self->s.number, MASK_PLAYERSOLID);

	//[ForceSys]
	gripLevel = self->client->ps.fd.forcePowerLevel[FP_GRIP];

	if (VectorLength(a) > MAX_GRIP_DISTANCE)
	{
		WP_ForcePowerStop(self, forcePower);
		return;
	}

	if(gripEnt->client)
	{
		if ( !InFront( gripEnt->client->ps.origin, self->client->ps.origin, self->client->ps.viewangles, 0.9f ) &&
			gripLevel < FORCE_LEVEL_3)
		{
			WP_ForcePowerStop(self, forcePower);
			return;
		}
	}
	else
	{
		if ( !InFront( gripEnt->s.pos.trBase, self->client->ps.origin, self->client->ps.viewangles, 0.9f ) &&
			gripLevel < FORCE_LEVEL_3)
		{
			WP_ForcePowerStop(self, forcePower);
			return;
		}
	}

	if (self->client->ps.fd.forcePowerDebounce[FP_GRIP] < level.time)
	{ //2 damage per second while choking, resulting in 10 damage total (not including The Squeeze<tm>)
		self->client->ps.fd.forcePowerDebounce[FP_GRIP] = level.time + 1000;
		G_Damage(gripEnt, self, self, NULL, NULL, 2, DAMAGE_NO_ARMOR, MOD_FORCE_DARK);
	}

	Jetpack_Off(gripEnt); //make sure the guy being gripped has his jetpack off.

	if (gripLevel == FORCE_LEVEL_1)
	{
		if(gripEnt->client)
			gripEnt->client->ps.fd.forceGripBeingGripped = level.time + 1000;
		
		if(gripEnt->client)
			if ((level.time - gripEnt->client->ps.fd.forceGripStarted) > 5000)
			{
				WP_ForcePowerStop(self, forcePower);
				return;
			}
	}

	if (gripLevel == FORCE_LEVEL_2||gripLevel==FORCE_LEVEL_3)
	{
		gripEnt->client->ps.fd.forceGripBeingGripped = level.time + 1000;

		if (gripEnt->client->ps.forceGripMoveInterval < level.time)
		{
			if(gripLevel == FORCE_LEVEL_2)
				gripEnt->client->ps.velocity[2] = 15;
			else
				gripEnt->client->ps.velocity[2] = 30;

			gripEnt->client->ps.forceGripMoveInterval = level.time + 300; //only update velocity every 300ms, so as to avoid heavy bandwidth usage
		}
		gripEnt->client->ps.otherKiller = self->s.number;
		gripEnt->client->ps.otherKillerTime = level.time + 5000;
		gripEnt->client->ps.otherKillerDebounceTime = level.time + 100;
		//[Asteroids]
		gripEnt->client->otherKillerMOD = MOD_UNKNOWN;
		gripEnt->client->otherKillerVehWeapon = 0;
		gripEnt->client->otherKillerWeaponType = WP_NONE;
		//[/Asteroids]

		gripEnt->client->ps.forceGripChangeMovetype = PM_FLOAT;

		if(gripEnt->client)
		{
			if ((level.time - gripEnt->client->ps.fd.forceGripStarted) > 3000 && !self->client->ps.fd.forceGripDamageDebounceTime)
			{ //if we managed to lift him into the air for 2 seconds, give him a crack
				self->client->ps.fd.forceGripDamageDebounceTime = 1;
				if(gripLevel == FORCE_LEVEL_2)
					G_Damage(gripEnt, self, self, NULL, NULL, 20, DAMAGE_NO_ARMOR, MOD_FORCE_DARK);
				else
					G_Damage(gripEnt, self, self, NULL, NULL, 75, DAMAGE_NO_ARMOR, MOD_FORCE_DARK);
				//Must play custom sounds on the actual entity. Don't use G_Sound (it creates a temp entity for the sound)
				G_EntitySound( gripEnt, CHAN_VOICE, G_SoundIndex(va( "*choke%d.wav", Q_irand( 1, 3 ) )) );

				gripEnt->client->ps.forceHandExtend = HANDEXTEND_CHOKE;
				gripEnt->client->ps.forceHandExtendTime = level.time + 2000;

				if (gripEnt->client->ps.fd.forcePowersActive & (1 << FP_GRIP))
				{ //choking, so don't let him keep gripping himself
					WP_ForcePowerStop(gripEnt, FP_GRIP);
					return;
				}
			}
			else if ((level.time - gripEnt->client->ps.fd.forceGripStarted) > 4000)
			{
				WP_ForcePowerStop(self, forcePower);
				return;
			}
		}
	}
}
コード例 #6
0
ファイル: FP_Manipulate.c プロジェクト: jwginge/ojpa
void DoManipulateAction(gentity_t*self)
{
	vec3_t fwd, fwd_o, start_o, nvel, a, otherLoc;
	gentity_t*gripEnt; 
	trace_t tr;
	gripEnt = &g_entities[self->client->ps.fd.forceGripEntityNum];

	if(gripEnt->client)
		VectorCopy(gripEnt->client->ps.origin, otherLoc);
	else
		VectorCopy(gripEnt->s.origin, otherLoc);

	self->client->dangerTime = level.time;
	self->client->ps.eFlags &= ~EF_INVULNERABLE;
	self->client->invulnerableTimer = 0;

	if(!(self->client->pers.cmd.buttons & BUTTON_FORCEPOWER) && !(self->client->pers.cmd.generic_cmd & GENCMD_FORCE_MANIPULATE))
	{
		WP_ForcePowerStop(self,FP_MANIPULATE);
		return;
	}

	if (!ValidManipulateEnt(self,gripEnt))
	{
		WP_ForcePowerStop(self,FP_MANIPULATE);
		self->client->ps.fd.forceGripEntityNum = ENTITYNUM_NONE;

		if (gripEnt && gripEnt->client && gripEnt->inuse)
		{
			gripEnt->client->ps.forceGripChangeMovetype = PM_NORMAL;
		}
		return;
	}

	VectorSubtract(otherLoc, self->client->ps.origin, a);

	trap_Trace(&tr, self->client->ps.origin, NULL, NULL, otherLoc, self->s.number, MASK_PLAYERSOLID);

	//[ForceSys]

	if (VectorLength(a) > MAX_GRIP_DISTANCE)
	{
		WP_ForcePowerStop(self, FP_MANIPULATE);
		return;
	}

	self->client->ps.fd.forcePowerDuration[FP_MANIPULATE] = level.time + 500;

	if (self->client->ps.fd.forcePowerDebounce[FP_MANIPULATE] < level.time)
	{ //2 damage per second while choking, resulting in 10 damage total (not including The Squeeze<tm>)
		self->client->ps.fd.forcePowerDebounce[FP_MANIPULATE] = level.time + 1000;
		G_Damage(gripEnt, self, self, NULL, NULL, 2, DAMAGE_NO_ARMOR, MOD_FORCE_DARK);
	}

	Jetpack_Off(gripEnt); //make sure the guy being gripped has his jetpack off.

	if(gripEnt->client)
	{
		gripEnt->client->ps.fd.forceGripBeingGripped = level.time + 1000;
		if(gripEnt->client->otherKillerVehWeapon!=-1)
		{
			
			gripEnt->r.currentAngles[0]=Q_irand(0,100);
			gripEnt->r.currentAngles[1]=Q_irand(0,100);
			gripEnt->client->otherKillerVehWeapon = -1;//yea....
		}
		gripEnt->client->ps.otherKiller = self->s.number;
		gripEnt->client->ps.otherKillerTime = level.time + 5000;
		gripEnt->client->ps.otherKillerDebounceTime = level.time + 100;
		//[Asteroids]
		gripEnt->client->otherKillerMOD = MOD_UNKNOWN;
		
		gripEnt->client->otherKillerWeaponType = WP_NONE;
		//[/Asteroids]

		gripEnt->client->ps.forceGripChangeMovetype = PM_FLOAT;
	}
	if(gripEnt->client)
	{
		if (gripEnt->client->ps.forceGripMoveInterval < level.time)
		{
			float nvLen = 0;

			VectorCopy(gripEnt->client->ps.origin, start_o);
			AngleVectors(self->client->ps.viewangles, fwd, NULL, NULL);
			fwd_o[0] = self->client->ps.origin[0] + fwd[0]*128;
			fwd_o[1] = self->client->ps.origin[1] + fwd[1]*128;
			fwd_o[2] = self->client->ps.origin[2] + fwd[2]*128;
			fwd_o[2] += 16;
			VectorSubtract(fwd_o, start_o, nvel);

			nvLen = VectorLength(nvel);

			if (nvLen < 16)
			{ //within x units of desired spot
				VectorNormalize(nvel);
				gripEnt->client->ps.velocity[0] = nvel[0]*8;
				gripEnt->client->ps.velocity[1] = nvel[1]*8;
				gripEnt->client->ps.velocity[2] = nvel[2]*8;
			}
			else if (nvLen < 64)
			{
				VectorNormalize(nvel);
				gripEnt->client->ps.velocity[0] = nvel[0]*128;
				gripEnt->client->ps.velocity[1] = nvel[1]*128;
				gripEnt->client->ps.velocity[2] = nvel[2]*128;
			}
			else if (nvLen < 128)
			{
				VectorNormalize(nvel);
				gripEnt->client->ps.velocity[0] = nvel[0]*256;
				gripEnt->client->ps.velocity[1] = nvel[1]*256;
				gripEnt->client->ps.velocity[2] = nvel[2]*256;
			}
			else if (nvLen < 200)
			{
				VectorNormalize(nvel);
				gripEnt->client->ps.velocity[0] = nvel[0]*512;
				gripEnt->client->ps.velocity[1] = nvel[1]*512;
				gripEnt->client->ps.velocity[2] = nvel[2]*512;
			}
			else
			{
				VectorNormalize(nvel);
				gripEnt->client->ps.velocity[0] = nvel[0]*700;
				gripEnt->client->ps.velocity[1] = nvel[1]*700;
				gripEnt->client->ps.velocity[2] = nvel[2]*700;
			}

			gripEnt->client->ps.forceGripMoveInterval = level.time + 3; //only update velocity every 300ms, so as to avoid heavy bandwidth usage
		}

		if ((level.time - gripEnt->client->ps.fd.forceGripStarted) > 3000 && !self->client->ps.fd.forceGripDamageDebounceTime)
		{ //if we managed to lift him into the air for 2 seconds, give him a crack

			if (gripEnt->client->ps.fd.forcePowersActive & (1 << FP_MANIPULATE))
			{ //choking, so don't let him keep gripping himself
				WP_ForcePowerStop(gripEnt, FP_MANIPULATE);
				return;
			}
		}
		else if ((level.time - gripEnt->client->ps.fd.forceGripStarted) > 4000)
		{
			WP_ForcePowerStop(self, FP_MANIPULATE);
			return;
		}
	}//end FORCE_LEVEL_3
	else //If not a client
	{
		float nvLen = 0;

		VectorCopy(gripEnt->s.origin, start_o);
		AngleVectors(self->client->ps.viewangles, fwd, NULL, NULL);
		fwd_o[0] = self->client->ps.origin[0] + fwd[0]*128;
		fwd_o[1] = self->client->ps.origin[1] + fwd[1]*128;
		fwd_o[2] = self->client->ps.origin[2] + fwd[2]*128;
		fwd_o[2] += 16;
		VectorSubtract(fwd_o, start_o, nvel);

		nvLen = VectorLength(nvel);

		if (nvLen < 16)
		{ //within x units of desired spot
			VectorNormalize(nvel);
			gripEnt->s.pos.trDelta[0] = nvel[0]*8;
			gripEnt->s.pos.trDelta[1] = nvel[1]*8;
			gripEnt->s.pos.trDelta[2] = nvel[2]*8;
		}
		else if (nvLen < 64)
		{
			VectorNormalize(nvel);
			gripEnt->s.pos.trDelta[0] = nvel[0]*128;
			gripEnt->s.pos.trDelta[1] = nvel[1]*128;
			gripEnt->s.pos.trDelta[2] = nvel[2]*128;
		}
		else if (nvLen < 128)
		{
			VectorNormalize(nvel);
			gripEnt->s.pos.trDelta[0] = nvel[0]*256;
			gripEnt->s.pos.trDelta[1] = nvel[1]*256;
			gripEnt->s.pos.trDelta[2] = nvel[2]*256;
		}
		else if (nvLen < 200)
		{
			VectorNormalize(nvel);
			gripEnt->s.pos.trDelta[0] = nvel[0]*512;
			gripEnt->s.pos.trDelta[1] = nvel[1]*512;
			gripEnt->s.pos.trDelta[2] = nvel[2]*512;
		}
		else
		{
			VectorNormalize(nvel);
			gripEnt->s.pos.trDelta[0] = nvel[0]*700;
			gripEnt->s.pos.trDelta[1] = nvel[1]*700;
			gripEnt->s.pos.trDelta[2] = nvel[2]*700;
		}

		//gripEnt->client->ps.forceGripMoveInterval = level.time + 300; //only update velocity every 300ms, so as to avoid heavy bandwidth usage
	}
}
コード例 #7
0
ファイル: g_client.c プロジェクト: Boothand/SaberShenanigans
/*
===========
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;
	}

	i = 0;

	while (i < NUM_FORCE_POWERS)
	{
		if (ent->client->ps.fd.forcePowersActive & (1 << i))
		{
			WP_ForcePowerStop(ent, i);
		}
		i++;
	}

	i = TRACK_CHANNEL_1;

	while (i < NUM_TRACK_CHANNELS)
	{
		if (ent->client->ps.fd.killSoundEntIndex[i-50] && ent->client->ps.fd.killSoundEntIndex[i-50] < MAX_GENTITIES && ent->client->ps.fd.killSoundEntIndex[i-50] > 0)
		{
			G_MuteSound(ent->client->ps.fd.killSoundEntIndex[i-50], CHAN_VOICE);
		}
		i++;
	}
	i = 0;

	// 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 ) {
		tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_OUT );
		tent->s.clientNum = ent->s.clientNum;

		// They don't get to take powerups with them!
		// Especially important for stuff like CTF flags
		TossClientItems( ent );
	}

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

	// if we are playing in tourney mode and losing, give a win to the other player
	if ( (g_gametype.integer == GT_TOURNAMENT )
		&& !level.intermissiontime
		&& !level.warmupTime && level.sortedClients[1] == clientNum ) {
		level.clients[ level.sortedClients[0] ].sess.wins++;
		ClientUserinfoChanged( level.sortedClients[0] );
	}

	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();

	if ( ent->r.svFlags & SVF_BOT ) {
		BotAIShutdownClient( clientNum, qfalse );
	}

	G_ClearClientLog(clientNum);
}
コード例 #8
0
ファイル: g_client.c プロジェクト: Boothand/SaberShenanigans
/*
===========
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, qboolean allowTeamReset ) {
	gentity_t	*ent;
	gclient_t	*client;
	gentity_t	*tent;
	int			flags, i;
	char		userinfo[MAX_INFO_VALUE], *modelname;

	ent = g_entities + clientNum;

	if ((ent->r.svFlags & SVF_BOT) && g_gametype.integer >= GT_TEAM)
	{
		if (allowTeamReset)
		{
			const char *team = "Red";
			int preSess;

			//SetTeam(ent, "");
			ent->client->sess.sessionTeam = PickTeam(-1);
			trap_GetUserinfo(clientNum, userinfo, MAX_INFO_STRING);

			if (ent->client->sess.sessionTeam == TEAM_SPECTATOR)
			{
				ent->client->sess.sessionTeam = TEAM_RED;
			}

			if (ent->client->sess.sessionTeam == TEAM_RED)
			{
				team = "Red";
			}
			else
			{
				team = "Blue";
			}

			Info_SetValueForKey( userinfo, "team", team );

			trap_SetUserinfo( clientNum, userinfo );

			ent->client->ps.persistant[ PERS_TEAM ] = ent->client->sess.sessionTeam;

			preSess = ent->client->sess.sessionTeam;
			G_ReadSessionData( ent->client );
			ent->client->sess.sessionTeam = preSess;
			G_WriteClientSessionData(ent->client);
			ClientUserinfoChanged( clientNum );
			ClientBegin(clientNum, qfalse);
			return;
		}
	}

	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;

	i = 0;

	while (i < NUM_FORCE_POWERS)
	{
		if (ent->client->ps.fd.forcePowersActive & (1 << i))
		{
			WP_ForcePowerStop(ent, i);
		}
		i++;
	}

	i = TRACK_CHANNEL_1;

	while (i < NUM_TRACK_CHANNELS)
	{
		if (ent->client->ps.fd.killSoundEntIndex[i-50] && ent->client->ps.fd.killSoundEntIndex[i-50] < MAX_GENTITIES && ent->client->ps.fd.killSoundEntIndex[i-50] > 0)
		{
			G_MuteSound(ent->client->ps.fd.killSoundEntIndex[i-50], CHAN_VOICE);
		}
		i++;
	}
	i = 0;

	memset( &client->ps, 0, sizeof( client->ps ) );
	client->ps.eFlags = flags;

	client->ps.hasDetPackPlanted = qfalse;

	//first-time force power initialization
	WP_InitForcePowers( ent );

	//init saber ent
	WP_SaberInitBladeData( ent );

	// First time model setup for that player.
	trap_GetUserinfo( clientNum, userinfo, sizeof(userinfo) );
	modelname = Info_ValueForKey (userinfo, "model");
	SetupGameGhoul2Model(client, modelname);

	if (ent->client->ghoul2)
	{
		ent->bolt_Head = trap_G2API_AddBolt(ent->client->ghoul2, 0, "cranium");
		ent->bolt_Waist = trap_G2API_AddBolt(ent->client->ghoul2, 0, "thoracic");
		ent->bolt_LArm = trap_G2API_AddBolt(ent->client->ghoul2, 0, "lradius");
		ent->bolt_RArm = trap_G2API_AddBolt(ent->client->ghoul2, 0, "rradius");
		ent->bolt_LLeg = trap_G2API_AddBolt(ent->client->ghoul2, 0, "ltibia");
		ent->bolt_RLeg = trap_G2API_AddBolt(ent->client->ghoul2, 0, "rtibia");
		ent->bolt_Motion = trap_G2API_AddBolt(ent->client->ghoul2, 0, "Motion");
	}

	// 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 " %s\n\"", client->pers.netname, G_GetStripEdString("SVINGAME", "PLENTER")) );
		}
	}
	G_LogPrintf( "ClientBegin: %i\n", clientNum );

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

	G_ClearClientLog(clientNum);
}
コード例 #9
0
ファイル: g_emote.cpp プロジェクト: mehmehsomeone/OpenRP
/*
==================

TheEmote

MJN/ClanMod

==================
*/
void TheEmote(int anim, gentity_t *ent, qboolean freeze )
{
	extern void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText );
	char *msg = ConcatArgs(1);
	int i = 0;

	if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW || ent->client->sess.spectatorState == SPECTATOR_FREE )
		return;
	if (ent->client->ps.groundEntityNum == ENTITYNUM_NONE)
		return;
	if ( ent->client->ps.saberHolstered < 2 )
		ent->client->ps.saberHolstered = 2;
	if ( BG_SaberInAttack(ent->client->ps.saberMove) || BG_SaberInSpecialAttack(ent->client->ps.saberMove) || ent->client->ps.saberLockTime )
		return;

	//[OpenRP - Endlessly floating up bug]
	if(ent && ent->client && ent->client->forceLifting != -1)
	{
		g_entities[ent->client->forceLifting].client->ps.forceGripMoveInterval = 0;
		g_entities[ent->client->forceLifting].client->ps.forceGripChangeMovetype = PM_NORMAL;
		g_entities[ent->client->forceLifting].client->ps.pm_type = PM_NORMAL;
		g_entities[ent->client->forceLifting].client->underForceLift=qfalse;
		ent->client->forceLifting = -1;
	}
	//[/OpenRP - Endlessly floating up bug]

	ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT;
	ent->client->ps.forceDodgeAnim = anim;
	// MJN - Entry for emotes
	//if (InSpecialEmote( anim ) )
	if ( freeze )
	{
		// MJN - Stop running Forcepowers
		while ( i < NUM_FORCE_POWERS )
		{
			if ( ( ent->client->ps.fd.forcePowersActive & (1 << i) ) && i != FP_LEVITATION )
				WP_ForcePowerStop(ent, i);
            i++;
		}
		ent->client->ps.forceHandExtendTime = level.time + 9999999;
		ent->client->saberKnockedTime = level.time + 9999999;
		ent->client->ps.weaponTime = 99999999;
	}
	else
	{// basejk
		ent->client->ps.forceHandExtendTime = level.time + BG_AnimLength(ent->localAnimIndex, (animNumber_t)anim);
	}

	if ( trap_Argc() >= 2 )
		G_Say( ent, NULL, SAY_ME, msg );

	return;

	/*
	if (freeze == qtrue)
	{
		if (ent->client->ps.forceDodgeAnim == anim)
		{
			StandardSetBodyAnim(ent, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
			ent->client->emote_freeze = qfalse;
			ent->client->ps.saberCanThrow = qtrue;
			ent->client->ps.forceDodgeAnim = 0;
			ent->client->ps.forceHandExtendTime = 0;
			ent->client->ps.saberMove = LS_NONE;
			ent->client->saberKnockedTime = level.time; // Enable Saber
			ent->client->ps.weaponTime = 0; // Enable Weapons
		}
		else
		{
			M_HolsterThoseSabers(ent);
			ent->client->emote_freeze = qtrue; // MJN 1
			ent->client->ps.saberMove = LS_NONE;
			ent->client->ps.saberBlocked = 0;
			ent->client->ps.saberBlocking = 0;
			ent->client->saberKnockedTime = level.time + 9999999; // Disable Saber
			ent->client->ps.weaponTime = 99999999; // Disable Weapons
			ent->client->ps.saberCanThrow = qfalse;
			ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT;
			ent->client->ps.forceDodgeAnim = anim;
			ent->client->ps.forceHandExtendTime = level.time + Q3_INFINITE;
			StandardSetBodyAnim(ent, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
		}
	}
	else
	{
		StandardSetBodyAnim(ent, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
	}
	*/
}