| 166 | } |
| 167 | |
| 168 | bool CSpectator::OnInput(const IInput::CEvent &Event) |
| 169 | { |
| 170 | if(IsActive() && Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key == KEY_ESCAPE) |
| 171 | { |
| 172 | OnRelease(); |
| 173 | return true; |
| 174 | } |
| 175 | |
| 176 | if(g_Config.m_ClSpectatorMouseclicks) |
| 177 | { |
| 178 | if(GameClient()->m_Snap.m_SpecInfo.m_Active && !IsActive() && !GameClient()->m_MultiViewActivated && |
| 179 | !Ui()->IsPopupOpen() && !GameClient()->m_GameConsole.IsActive() && !GameClient()->m_Menus.IsActive()) |
| 180 | { |
| 181 | if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key == KEY_MOUSE_1) |
| 182 | { |
| 183 | if(GameClient()->m_Snap.m_SpecInfo.m_SpectatorId != SPEC_FREEVIEW) |
| 184 | Spectate(SPEC_FREEVIEW); |
| 185 | else |
| 186 | SpectateClosest(); |
| 187 | return true; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | if(GameClient()->m_Camera.SpectatingPlayer() && GameClient()->m_Camera.CanUseAutoSpecCamera()) |
| 193 | { |
| 194 | if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key == KEY_MOUSE_2) |
| 195 | { |
| 196 | GameClient()->m_Camera.ResetAutoSpecCamera(); |
| 197 | return true; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | return false; |
| 202 | } |
| 203 | |
| 204 | void CSpectator::OnRelease() |
| 205 | { |
nothing calls this directly
no test coverage detected