Merge pull request #7511 from furo321/telecursor-fixes

Account for zoom when teleporting to cursor.
This commit is contained in:
Dennis Felsing 2023-11-20 12:25:54 +00:00 committed by GitHub
commit 375dd7da8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -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)
{

View file

@ -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);