From 5189226d1e8df1e56240d51a32d0db82924320d7 Mon Sep 17 00:00:00 2001 From: Michael Levin Date: Sat, 3 Oct 2009 11:25:01 +0000 Subject: * Spawn queue displays ordinals ("You are 2nd in the spawn queue") * Server does not communicate the number of eggs and telenodes to all clients anymore -- the correct number of spawns is passed to the client when they are in the spawn queue only (puts PERS_UNUSED to use) Sticky and dead spectate (holy fuck that was hard for something so simple sounding): * Big thanks to Lakitu7 for passing along the patch (with contributions from TJW, Undeference, and R1CH) * UI has a new option to enable/disable sticky spectate * Spectators get to see the full dying animation * Dead players can spectate their teammates whether they are in the spawn queue or not I corrected several nasty bugs and recoded a LOT of the patch. Potentially the "spawn without a weapon" thing may have been fixed but maybe not. There are possibly other new bugs so keep an eye out for them. --- src/game/g_client.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/game/g_client.c') diff --git a/src/game/g_client.c b/src/game/g_client.c index 6c9ea759..1a2714cb 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -739,11 +739,30 @@ respawn */ void respawn( gentity_t *ent ) { + int i; + SpawnCorpse( ent ); // Clients can't respawn - they must go through the class cmd ent->client->pers.classSelection = PCL_NONE; ClientSpawn( ent, NULL, NULL, NULL ); + + // stop any following clients that don't have sticky spec on + 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 == ent - g_entities ) + { + if( !( level.clients[ i ].pers.stickySpec ) ) + { + if( !G_FollowNewClient( &g_entities[ i ], 1 ) ) + G_StopFollowing( &g_entities[ i ] ); + } + else + G_FollowLockView( &g_entities[ i ] ); + } + } } /* @@ -954,6 +973,10 @@ void ClientUserinfoChanged( int clientNum ) if( !strcmp( s, "localhost" ) ) client->pers.localClient = qtrue; + // stickyspec toggle + s = Info_ValueForKey( userinfo, "cg_stickySpec" ); + client->pers.stickySpec = atoi( s ) != 0; + // set name Q_strncpyz( oldname, client->pers.netname, sizeof( oldname ) ); s = Info_ValueForKey( userinfo, "name" ); @@ -1319,6 +1342,13 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles teamLocal = client->pers.teamSelection; + //if client is dead and following teammate, stop following before spawning + if( client->sess.spectatorClient != -1 ) + { + client->sess.spectatorClient = -1; + client->sess.spectatorState = SPECTATOR_FREE; + } + // only start client if chosen a class and joined a team if( client->pers.classSelection == PCL_NONE && teamLocal == PTE_NONE ) { @@ -1330,7 +1360,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles client->sess.sessionTeam = TEAM_SPECTATOR; client->sess.spectatorState = SPECTATOR_LOCKED; } - + if( origin != NULL ) VectorCopy( origin, spawn_origin ); -- cgit