if you're being spectated by someone who is trying to join a team using the /team command, the "x has too many players" popup is 'redirected' to you instead of the person attempting to join the bigger team.
i'm assuming this is already half-fixed with the cg_disableWarningDialogs patch, but this would be a pretty big nuisance to those who have popups enabled for whatever reason.
Created attachment 1063[details]
Fix for now
OK, I've found the origin of this bug and it looks like LOTS of trouble. The cause is in game/g_active.c:SpectatorClientEndFrame() on line 1457 (1.1.0) or on line 1412 (SVN 818), where the entire client->ps of the followed player overwrites client->ps of the following spectator. That invalidates ent->client->ps.clientNum for the spectator and redirects some stuff to the followed player.
Question for TJW and Timbo: Is it safe to keep client->ps.clientNum valid or would it break spectator follow code?
(In reply to comment #1)
> OK, I've found the origin of this bug and it looks like LOTS of trouble. The
> cause is in game/g_active.c:SpectatorClientEndFrame() on line 1457 (1.1.0) or
> on line 1412 (SVN 818), where the entire client->ps of the followed player
> overwrites client->ps of the following spectator. That invalidates
> ent->client->ps.clientNum for the spectator and redirects some stuff to the
> followed player.
>
> Question for TJW and Timbo: Is it safe to keep client->ps.clientNum valid or
> would it break spectator follow code?
>
Good catch.
This is the way follow mode is handled in all quake3 games. client->ps for
the spectator and the player they are following is pointing at the same
memory address, so it wouldn't be possible to change values.
In addition to this bug, there's also another one that allows a player to vote
while in follow mode. I'll attach the patch for that so you can see what I'm
talking about.
I've applied your patch and the other fix as SVN rev 819.
Created attachment 1084[details]
Specvote fix
Cmd_CallTeamVote_f(), Cmd_Vote_f() and Cmd_TeamVote_f() still allow spectators in follow mode to use them. Here's the patch.
Since this bug is fixed, I start getting the "Select Team"-Dialog from specs following me. I tried to reproduce this, but i wasn't able to. The guys told me, they just pressed mouse button 1 while following me.
About the voting:
Isn't ent->client->sess.sessionTeam == TEAM_SPECTATOR also true, when someone is dead but in a team? Wouldn't this prevent people waiting for new spawns from voting too?
Maybe check ent->client->pers.teamSelection == PTE_NONE instead?
Spectators in follow mode can't toggle team selection menu. When they enter follow mode, attack button stops working until they leave it. If you get this error again, contact the server admin because he runs some unofficial mod that breaks this.
(In reply to comment #6)
> Spectators in follow mode can't toggle team selection menu. When they enter
> follow mode, attack button stops working until they leave it. If you get this
> error again, contact the server admin because he runs some unofficial mod that
> breaks this.
You were right, r1ch's sticky_spec (as i call it) had an off-by-one error. fixed.
(In reply to comment #5)
> About the voting:
> ...
>
> Maybe check ent->client->pers.teamSelection == PTE_NONE instead?
I'd like to suggest the following attachment to fix this spectators-can-vote bug.
>Isn't ent->client->sess.sessionTeam == TEAM_SPECTATOR also true, when someone
>is dead but in a team? Wouldn't this prevent people waiting for new spawns from
>voting too?
yes :( in current KOCOUR_CZ build I cant start the vote/vote when Im dead
Created attachment 1116[details]
Teamvote kick fix
Sorry for another reopen but I've noticed that teamvote kick might target spectators following the player you want to kick. This should fix it. BTW, is it really necessary to have that loop there? AFAIK checking only level.clients[ clientNum ] is just enough.
Created attachment 1123[details]
svn831 vote clientkick
removes the loop and also properly checks if clientNum > level.maxclients in both teamvote and vote functions
Created attachment 1063 [details] Fix for now OK, I've found the origin of this bug and it looks like LOTS of trouble. The cause is in game/g_active.c:SpectatorClientEndFrame() on line 1457 (1.1.0) or on line 1412 (SVN 818), where the entire client->ps of the followed player overwrites client->ps of the following spectator. That invalidates ent->client->ps.clientNum for the spectator and redirects some stuff to the followed player. Question for TJW and Timbo: Is it safe to keep client->ps.clientNum valid or would it break spectator follow code?
Created attachment 1065 [details] specs in follow mode should not be able to vote
Created attachment 1084 [details] Specvote fix Cmd_CallTeamVote_f(), Cmd_Vote_f() and Cmd_TeamVote_f() still allow spectators in follow mode to use them. Here's the patch.
Created attachment 1098 [details] specvote fix fix check pers.teamSelection instead of sess.sessionTeam
>Isn't ent->client->sess.sessionTeam == TEAM_SPECTATOR also true, when someone >is dead but in a team? Wouldn't this prevent people waiting for new spawns from >voting too? yes :( in current KOCOUR_CZ build I cant start the vote/vote when Im dead
Created attachment 1116 [details] Teamvote kick fix Sorry for another reopen but I've noticed that teamvote kick might target spectators following the player you want to kick. This should fix it. BTW, is it really necessary to have that loop there? AFAIK checking only level.clients[ clientNum ] is just enough.
Created attachment 1123 [details] svn831 vote clientkick removes the loop and also properly checks if clientNum > level.maxclients in both teamvote and vote functions