mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Update view target when spectating with chat open
Thanks to ReiTW for reporting and illustrating the bug: https://www.youtube.com/watch?v=LKicYqtqJbQ
This commit is contained in:
parent
7da2cb9357
commit
bcdec941da
|
@ -252,6 +252,11 @@ int CControls::SnapInput(int *pData)
|
|||
|
||||
mem_copy(pData, &m_InputData[g_Config.m_ClDummy], sizeof(m_InputData[0]));
|
||||
|
||||
// set the target anyway though so that we can keep seeing our surroundings,
|
||||
// even if chat or menu are activated
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetX = (int)m_MousePos[g_Config.m_ClDummy].x;
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetY = (int)m_MousePos[g_Config.m_ClDummy].y;
|
||||
|
||||
// send once a second just to be sure
|
||||
if(time_get() > LastSendTime + time_freq())
|
||||
Send = true;
|
||||
|
|
|
@ -427,11 +427,14 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
|||
return; // we must return if kicked, as player struct is already deleted
|
||||
AfkVoteTimer(NewInput);
|
||||
|
||||
if(((!m_pCharacter && m_Team == TEAM_SPECTATORS) || m_Paused) && m_SpectatorID == SPEC_FREEVIEW)
|
||||
m_ViewPos = vec2(NewInput->m_TargetX, NewInput->m_TargetY);
|
||||
|
||||
if(NewInput->m_PlayerFlags&PLAYERFLAG_CHATTING)
|
||||
{
|
||||
// skip the input if chat is active
|
||||
if(m_PlayerFlags&PLAYERFLAG_CHATTING)
|
||||
return;
|
||||
return;
|
||||
|
||||
// reset input
|
||||
if(m_pCharacter)
|
||||
|
@ -454,9 +457,6 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
|||
if(!m_pCharacter && m_Team != TEAM_SPECTATORS && (NewInput->m_Fire&1))
|
||||
m_Spawning = true;
|
||||
|
||||
if(((!m_pCharacter && m_Team == TEAM_SPECTATORS) || m_Paused) && m_SpectatorID == SPEC_FREEVIEW)
|
||||
m_ViewPos = vec2(NewInput->m_TargetX, NewInput->m_TargetY);
|
||||
|
||||
// check for activity
|
||||
if(NewInput->m_Direction || m_LatestActivity.m_TargetX != NewInput->m_TargetX ||
|
||||
m_LatestActivity.m_TargetY != NewInput->m_TargetY || NewInput->m_Jump ||
|
||||
|
|
Loading…
Reference in a new issue