mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Merge pull request #7511 from furo321/telecursor-fixes
Account for zoom when teleporting to cursor.
This commit is contained in:
commit
375dd7da8b
|
@ -1524,7 +1524,8 @@ void CGameContext::ConTele(IConsole::IResult *pResult, void *pUserData)
|
|||
vec2 Pos = pPlayer->m_ViewPos;
|
||||
if(pResult->NumArguments() == 0 && !pPlayer->IsPaused())
|
||||
{
|
||||
Pos = Pos + vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY);
|
||||
vec2 ZoomScale = vec2(pPlayer->m_ShowDistance.x / 1400.0f, pPlayer->m_ShowDistance.y / 800.0f);
|
||||
Pos = Pos + (vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY) * ZoomScale);
|
||||
}
|
||||
else if(pResult->NumArguments() > 0)
|
||||
{
|
||||
|
|
|
@ -407,8 +407,10 @@ void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
|
|||
{
|
||||
vec2 Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
|
||||
if(!pPlayer->IsPaused() && !pResult->NumArguments())
|
||||
Pos = Pos + vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY);
|
||||
|
||||
{
|
||||
vec2 ZoomScale = vec2(pPlayer->m_ShowDistance.x / 1400.0f, pPlayer->m_ShowDistance.y / 800.0f);
|
||||
Pos = Pos + (vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY) * ZoomScale);
|
||||
}
|
||||
pSelf->Teleport(pChr, Pos);
|
||||
pChr->UnFreeze();
|
||||
pChr->Core()->m_Vel = vec2(0, 0);
|
||||
|
|
Loading…
Reference in a new issue