| 558 | } |
| 559 | |
| 560 | void CPlayer::OnDirectInput(const CNetObj_PlayerInput *pNewInput) |
| 561 | { |
| 562 | Server()->SetClientFlags(m_ClientId, pNewInput->m_PlayerFlags); |
| 563 | |
| 564 | AfkTimer(); |
| 565 | |
| 566 | if(((pNewInput->m_PlayerFlags & PLAYERFLAG_SPEC_CAM) || GetClientVersion() < VERSION_DDNET_PLAYERFLAG_SPEC_CAM) && ((!m_pCharacter && m_Team == TEAM_SPECTATORS) || m_Paused) && m_SpectatorId == SPEC_FREEVIEW) |
| 567 | m_ViewPos = vec2(pNewInput->m_TargetX, pNewInput->m_TargetY); |
| 568 | |
| 569 | // check for activity |
| 570 | // if a player is killed, their scoreboard opens automatically, so ignore that flag |
| 571 | CNetObj_PlayerInput NewWithoutScoreboard = *pNewInput; |
| 572 | CNetObj_PlayerInput LastWithoutScoreboard = *m_pLastTarget; |
| 573 | NewWithoutScoreboard.m_PlayerFlags &= ~PLAYERFLAG_SCOREBOARD; |
| 574 | LastWithoutScoreboard.m_PlayerFlags &= ~PLAYERFLAG_SCOREBOARD; |
| 575 | if(mem_comp(&NewWithoutScoreboard, &LastWithoutScoreboard, sizeof(CNetObj_PlayerInput))) |
| 576 | { |
| 577 | mem_copy(m_pLastTarget, pNewInput, sizeof(CNetObj_PlayerInput)); |
| 578 | // Ignore the first direct input and keep the player afk as it is sent automatically |
| 579 | if(m_LastTargetInit) |
| 580 | UpdatePlaytime(); |
| 581 | m_LastActionTick = Server()->Tick(); |
| 582 | m_LastTargetInit = true; |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | void CPlayer::OnPredictedEarlyInput(const CNetObj_PlayerInput *pNewInput) |
| 587 | { |
no test coverage detected