Improvements for dedicated camera followers (team follow1/2)

Switching to dedicated camera follower with no possible players to
follow would spawn at the intermission point and display "connection
interrupted" HUD message. Pmove() was not run for the client so
ps.commandTime was too far behind. I made it so that dedicated camera
followers and scoreboard run Pmove() but cannot move (PM_FREEZE).

When all players possible to follow leave, the dedicated camera follower
would continue to display the old player state of the player they were
following (along with "connection interrupted" HUD message). Unlike the
regular case of a spectator following a specific player, dedicated
camera followers did not reset their player state to the intermission
point after the followed player was no longer valid.

Now a client can be set as 'team follow1' to automatically switch
between displaying the intermission point and following a player when
possible.
This commit is contained in:
Zack Middleton 2018-04-29 14:28:28 -05:00
parent f3f29e9670
commit 51743bbb01

View file

@ -320,12 +320,16 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) {
client = ent->client;
if ( client->sess.spectatorState != SPECTATOR_FOLLOW ) {
if ( client->sess.spectatorState != SPECTATOR_FOLLOW || !( client->ps.pm_flags & PMF_FOLLOW ) ) {
if ( client->sess.spectatorState == SPECTATOR_FREE ) {
if ( client->noclip ) {
client->ps.pm_type = PM_NOCLIP;
} else {
client->ps.pm_type = PM_SPECTATOR;
}
} else {
client->ps.pm_type = PM_FREEZE;
}
client->ps.speed = 400; // faster than normal
@ -1074,15 +1078,18 @@ void SpectatorClientEndFrame( gentity_t *ent ) {
ent->client->ps.pm_flags |= PMF_FOLLOW;
ent->client->ps.eFlags = flags;
return;
} else {
}
}
if ( ent->client->ps.pm_flags & PMF_FOLLOW ) {
// drop them to free spectators unless they are dedicated camera followers
if ( ent->client->sess.spectatorClient >= 0 ) {
ent->client->sess.spectatorState = SPECTATOR_FREE;
}
ClientBegin( ent->client - level.clients );
}
}
}
}
if ( ent->client->sess.spectatorState == SPECTATOR_SCOREBOARD ) {
ent->client->ps.pm_flags |= PMF_SCOREBOARD;