diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 2f6039fb7..e516a2445 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -519,14 +519,6 @@ void CHud::RenderWarmupTimer() } } -void CHud::MapscreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup) -{ - float Points[4]; - RenderTools()->MapscreenToWorld(CenterX, CenterY, pGroup->m_ParallaxX, pGroup->m_ParallaxY, - pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), 1.0f, Points); - Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]); -} - void CHud::RenderTextInfo() { if(g_Config.m_ClShowfps) @@ -660,7 +652,7 @@ void CHud::RenderCursor() if(!m_pClient->m_Snap.m_pLocalCharacter || Client()->State() == IClient::STATE_DEMOPLAYBACK) return; - MapscreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup()); + RenderTools()->MapScreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup()); // render cursor int CurWeapon = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS; diff --git a/src/game/client/components/hud.h b/src/game/client/components/hud.h index 8c1622e14..6752539f3 100644 --- a/src/game/client/components/hud.h +++ b/src/game/client/components/hud.h @@ -65,10 +65,7 @@ class CHud : public CComponent void RenderWarmupTimer(); void RenderLocalTime(float x); - void MapscreenToGroup(float CenterX, float CenterY, struct CMapItemGroup *PGroup); - static constexpr float MOVEMENT_INFORMATION_LINE_HEIGHT = 8.0f; - public: CHud(); virtual int Sizeof() const override { return sizeof(*this); } diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 9ddde2efc..b4ccee3df 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -55,14 +55,6 @@ void CMapLayers::EnvelopeUpdate() } } -void CMapLayers::MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup, float Zoom) -{ - float Points[4]; - RenderTools()->MapscreenToWorld(CenterX, CenterY, pGroup->m_ParallaxX, pGroup->m_ParallaxY, - pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), Zoom, Points); - Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]); -} - void CMapLayers::EnvelopeEval(int TimeOffsetMillis, int Env, float *pChannels, void *pUser) { CMapLayers *pThis = (CMapLayers *)pUser; @@ -1567,7 +1559,7 @@ void CMapLayers::OnRender() { // set clipping float Points[4]; - MapScreenToGroup(Center.x, Center.y, m_pLayers->GameGroup(), GetCurCamera()->m_Zoom); + RenderTools()->MapScreenToGroup(Center.x, Center.y, m_pLayers->GameGroup(), GetCurCamera()->m_Zoom); Graphics()->GetScreen(&Points[0], &Points[1], &Points[2], &Points[3]); float x0 = (pGroup->m_ClipX - Points[0]) / (Points[2] - Points[0]); float y0 = (pGroup->m_ClipY - Points[1]) / (Points[3] - Points[1]); @@ -1587,10 +1579,10 @@ void CMapLayers::OnRender() if((!g_Config.m_ClZoomBackgroundLayers || m_Type == TYPE_FULL_DESIGN) && !pGroup->m_ParallaxX && !pGroup->m_ParallaxY) { - MapScreenToGroup(Center.x, Center.y, pGroup, 1.0f); + RenderTools()->MapScreenToGroup(Center.x, Center.y, pGroup, 1.0f); } else - MapScreenToGroup(Center.x, Center.y, pGroup, GetCurCamera()->m_Zoom); + RenderTools()->MapScreenToGroup(Center.x, Center.y, pGroup, GetCurCamera()->m_Zoom); for(int l = 0; l < pGroup->m_NumLayers; l++) { diff --git a/src/game/client/components/maplayers.h b/src/game/client/components/maplayers.h index 6dd781106..02721bf22 100644 --- a/src/game/client/components/maplayers.h +++ b/src/game/client/components/maplayers.h @@ -35,8 +35,6 @@ class CMapLayers : public CComponent bool m_OnlineOnly; - void MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup, float Zoom = 1.0f); - struct STileLayerVisuals { STileLayerVisuals() : diff --git a/src/game/client/components/nameplates.cpp b/src/game/client/components/nameplates.cpp index bb29bcfc3..7888d0689 100644 --- a/src/game/client/components/nameplates.cpp +++ b/src/game/client/components/nameplates.cpp @@ -14,13 +14,6 @@ #include "players.h" -void CNamePlates::MapscreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup) -{ - float Points[4]; - RenderTools()->MapscreenToWorld(CenterX, CenterY, pGroup->m_ParallaxX, pGroup->m_ParallaxY, pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), 1.0f, Points); - Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]); -} - void CNamePlates::RenderNameplate( const CNetObj_Character *pPrevChar, const CNetObj_Character *pPlayerChar, @@ -109,7 +102,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP // create nameplates at standard zoom float ScreenX0, ScreenY0, ScreenX1, ScreenY1; Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1); - MapscreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup()); + RenderTools()->MapScreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup()); m_aNamePlates[ClientID].m_NameTextWidth = TextRender()->TextWidth(0, FontSize, pName, -1, -1.0f); @@ -135,7 +128,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP // create nameplates at standard zoom float ScreenX0, ScreenY0, ScreenX1, ScreenY1; Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1); - MapscreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup()); + RenderTools()->MapScreenToGroup(m_pClient->m_Camera.m_Center.x, m_pClient->m_Camera.m_Center.y, Layers()->GameGroup()); m_aNamePlates[ClientID].m_ClanNameTextWidth = TextRender()->TextWidth(0, FontSizeClan, pClan, -1, -1.0f); diff --git a/src/game/client/components/nameplates.h b/src/game/client/components/nameplates.h index 5710eb0bc..5f6fd3421 100644 --- a/src/game/client/components/nameplates.h +++ b/src/game/client/components/nameplates.h @@ -37,8 +37,6 @@ struct SPlayerNamePlate class CNamePlates : public CComponent { - void MapscreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup); - void RenderNameplate( const CNetObj_Character *pPrevChar, const CNetObj_Character *pPlayerChar, diff --git a/src/game/client/render.cpp b/src/game/client/render.cpp index 26bf9a0f4..38dd44893 100644 --- a/src/game/client/render.cpp +++ b/src/game/client/render.cpp @@ -752,7 +752,7 @@ void CRenderTools::CalcScreenParams(float Aspect, float Zoom, float *w, float *h *h *= Zoom; } -void CRenderTools::MapscreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY, +void CRenderTools::MapScreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY, float OffsetX, float OffsetY, float Aspect, float Zoom, float *pPoints) { float Width, Height; @@ -764,3 +764,11 @@ void CRenderTools::MapscreenToWorld(float CenterX, float CenterY, float Parallax pPoints[2] = pPoints[0] + Width; pPoints[3] = pPoints[1] + Height; } + +void CRenderTools::MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup, float Zoom) +{ + float Points[4]; + MapScreenToWorld(CenterX, CenterY, pGroup->m_ParallaxX, pGroup->m_ParallaxY, + pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), Zoom, Points); + Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]); +} diff --git a/src/game/client/render.h b/src/game/client/render.h index e61cecafc..df34b5b52 100644 --- a/src/game/client/render.h +++ b/src/game/client/render.h @@ -119,8 +119,9 @@ public: // helpers void CalcScreenParams(float Aspect, float Zoom, float *w, float *h); - void MapscreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY, + void MapScreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY, float OffsetX, float OffsetY, float Aspect, float Zoom, float *pPoints); + void MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup, float Zoom = 1.0f); // DDRace diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 5b6c78d27..4cbc9f773 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -128,7 +128,7 @@ void CLayerGroup::Convert(CUIRect *pRect) void CLayerGroup::Mapping(float *pPoints) { - m_pMap->m_pEditor->RenderTools()->MapscreenToWorld( + m_pMap->m_pEditor->RenderTools()->MapScreenToWorld( m_pMap->m_pEditor->m_WorldOffsetX, m_pMap->m_pEditor->m_WorldOffsetY, m_ParallaxX, m_ParallaxY, m_OffsetX, m_OffsetY, m_pMap->m_pEditor->Graphics()->ScreenAspect(), m_pMap->m_pEditor->m_WorldZoom, pPoints); @@ -2864,7 +2864,7 @@ void CEditor::DoMapEditor(CUIRect View) float aPoints[4]; float Aspect = Start + (End - Start) * (i / (float)NumSteps); - RenderTools()->MapscreenToWorld( + RenderTools()->MapScreenToWorld( m_WorldOffsetX, m_WorldOffsetY, 100.0f, 100.0f, 0.0f, 0.0f, Aspect, 1.0f, aPoints); @@ -2906,7 +2906,7 @@ void CEditor::DoMapEditor(CUIRect View) float aAspects[] = {4.0f / 3.0f, 16.0f / 10.0f, 5.0f / 4.0f, 16.0f / 9.0f}; float Aspect = aAspects[i]; - RenderTools()->MapscreenToWorld( + RenderTools()->MapScreenToWorld( m_WorldOffsetX, m_WorldOffsetY, 100.0f, 100.0f, 0.0f, 0.0f, Aspect, 1.0f, aPoints); @@ -6156,7 +6156,7 @@ void CEditor::ZoomMouseTarget(float ZoomFactor) // zoom to the current mouse position // get absolute mouse position float aPoints[4]; - RenderTools()->MapscreenToWorld( + RenderTools()->MapScreenToWorld( m_WorldOffsetX, m_WorldOffsetY, 100.0f, 100.0f, 0.0f, 0.0f, Graphics()->ScreenAspect(), m_WorldZoom, aPoints);