| 4839 | } |
| 4840 | |
| 4841 | void CGameClient::HandleMultiView() |
| 4842 | { |
| 4843 | bool IsTeamZero = IsMultiViewIdSet(); |
| 4844 | bool Init = false; |
| 4845 | vec2 MinPos, MaxPos; |
| 4846 | float SumVel = 0.0f; |
| 4847 | int AmountPlayers = 0; |
| 4848 | |
| 4849 | for(int ClientId = 0; ClientId < MAX_CLIENTS; ClientId++) |
| 4850 | { |
| 4851 | // look at players who are vanished |
| 4852 | if(m_MultiView.m_aVanish[ClientId]) |
| 4853 | { |
| 4854 | // not in freeze anymore and the delay is over |
| 4855 | if(m_MultiView.m_aLastFreeze[ClientId] + 6.0f <= Client()->LocalTime() && m_aClients[ClientId].m_FreezeEnd == 0) |
| 4856 | { |
| 4857 | m_MultiView.m_aVanish[ClientId] = false; |
| 4858 | m_MultiView.m_aLastFreeze[ClientId] = 0.0f; |
| 4859 | } |
| 4860 | } |
| 4861 | |
| 4862 | // we look at team 0 and the player is not in the spec list |
| 4863 | if(IsTeamZero && !m_aMultiViewId[ClientId]) |
| 4864 | continue; |
| 4865 | |
| 4866 | // player is vanished |
| 4867 | if(m_MultiView.m_aVanish[ClientId]) |
| 4868 | continue; |
| 4869 | |
| 4870 | // the player is not in the team we are spectating |
| 4871 | if(m_Teams.Team(ClientId) != m_MultiViewTeam) |
| 4872 | continue; |
| 4873 | |
| 4874 | vec2 PlayerPos; |
| 4875 | if(m_Snap.m_aCharacters[ClientId].m_Active) |
| 4876 | PlayerPos = m_aClients[ClientId].m_RenderPos; |
| 4877 | else if(m_aClients[ClientId].m_Spec) // tee is in spec |
| 4878 | PlayerPos = m_aClients[ClientId].m_SpecChar; |
| 4879 | else |
| 4880 | continue; |
| 4881 | |
| 4882 | // player is far away and frozen |
| 4883 | if(distance(m_MultiView.m_OldPos, PlayerPos) > 1100 && m_aClients[ClientId].m_FreezeEnd != 0) |
| 4884 | { |
| 4885 | // check if the player is frozen for more than 3 seconds, if so vanish them |
| 4886 | if(m_MultiView.m_aLastFreeze[ClientId] == 0.0f) |
| 4887 | { |
| 4888 | m_MultiView.m_aLastFreeze[ClientId] = Client()->LocalTime(); |
| 4889 | } |
| 4890 | else if(m_MultiView.m_aLastFreeze[ClientId] + 3.0f <= Client()->LocalTime()) |
| 4891 | { |
| 4892 | m_MultiView.m_aVanish[ClientId] = true; |
| 4893 | // player we want to be vanished is our "main" tee, so lets switch the tee |
| 4894 | if(ClientId == m_Snap.m_SpecInfo.m_SpectatorId) |
| 4895 | m_Spectator.Spectate(FindFirstMultiViewId()); |
| 4896 | } |
| 4897 | } |
| 4898 | else if(m_MultiView.m_aLastFreeze[ClientId] != 0) |