From c2d02ad45c901f4658c4fda142a6ddcbc38007c3 Mon Sep 17 00:00:00 2001 From: furo Date: Mon, 20 Nov 2023 12:33:08 +0100 Subject: [PATCH] Account for zoom when teleporting to cursor. --- src/game/server/ddracechat.cpp | 3 ++- src/game/server/ddracecommands.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 49ebdf3e2..9ae5dd6e6 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -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) { diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index d1af8431d..0e5b3aef8 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -409,8 +409,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);