diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index bff0bfd14..74a765d74 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -140,7 +140,7 @@ void CLayerGroup::Mapping(float *pPoints) m_pMap->m_pEditor->RenderTools()->MapScreenToWorld( m_pMap->m_pEditor->MapView()->GetWorldOffset().x, m_pMap->m_pEditor->MapView()->GetWorldOffset().y, m_ParallaxX, m_ParallaxY, ParallaxZoom, m_OffsetX, m_OffsetY, - m_pMap->m_pEditor->Graphics()->ScreenAspect(), m_pMap->m_pEditor->MapView()->WorldZoom(), pPoints); + m_pMap->m_pEditor->Graphics()->ScreenAspect(), m_pMap->m_pEditor->MapView()->GetWorldZoom(), pPoints); pPoints[0] += m_pMap->m_pEditor->MapView()->GetEditorOffset().x; pPoints[1] += m_pMap->m_pEditor->MapView()->GetEditorOffset().y; diff --git a/src/game/editor/map_grid.cpp b/src/game/editor/map_grid.cpp index 7bcfb075e..f1babeb9c 100644 --- a/src/game/editor/map_grid.cpp +++ b/src/game/editor/map_grid.cpp @@ -23,8 +23,7 @@ void CMapGrid::OnRender(CUIRect View) float aGroupPoints[4]; pGroup->Mapping(aGroupPoints); - float w = UI()->Screen()->w; - float h = UI()->Screen()->h; + const CUIRect *pScreen = UI()->Screen(); int LineDistance = GridLineDistance(); @@ -36,14 +35,14 @@ void CMapGrid::OnRender(CUIRect View) Graphics()->TextureClear(); Graphics()->LinesBegin(); - for(int i = 0; i < (int)w; i++) + for(int i = 0; i < (int)pScreen->w; i++) { if((i + YGridOffset) % m_GridFactor == 0) Graphics()->SetColor(1.0f, 0.3f, 0.3f, 0.3f); else Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.15f); - IGraphics::CLineItem Line = IGraphics::CLineItem(LineDistance * XOffset, LineDistance * i + LineDistance * YOffset, w + aGroupPoints[2], LineDistance * i + LineDistance * YOffset); + IGraphics::CLineItem Line = IGraphics::CLineItem(LineDistance * XOffset, LineDistance * i + LineDistance * YOffset, pScreen->w + aGroupPoints[2], LineDistance * i + LineDistance * YOffset); Graphics()->LinesDraw(&Line, 1); if((i + XGridOffset) % m_GridFactor == 0) @@ -51,7 +50,7 @@ void CMapGrid::OnRender(CUIRect View) else Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.15f); - Line = IGraphics::CLineItem(LineDistance * i + LineDistance * XOffset, LineDistance * YOffset, LineDistance * i + LineDistance * XOffset, h + aGroupPoints[3]); + Line = IGraphics::CLineItem(LineDistance * i + LineDistance * XOffset, LineDistance * YOffset, LineDistance * i + LineDistance * XOffset, pScreen->h + aGroupPoints[3]); Graphics()->LinesDraw(&Line, 1); } Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/src/game/editor/map_view.cpp b/src/game/editor/map_view.cpp index 1c08c05e9..35bdd8c03 100644 --- a/src/game/editor/map_view.cpp +++ b/src/game/editor/map_view.cpp @@ -66,14 +66,14 @@ void CMapView::RenderGroupBorder() float w, h; pLayer->GetSize(&w, &h); - IGraphics::CLineItem Array[4] = { + IGraphics::CLineItem aArray[4] = { IGraphics::CLineItem(0, 0, w, 0), IGraphics::CLineItem(w, 0, w, h), IGraphics::CLineItem(w, h, 0, h), IGraphics::CLineItem(0, h, 0, 0)}; Graphics()->TextureClear(); Graphics()->LinesBegin(); - Graphics()->LinesDraw(Array, 4); + Graphics()->LinesDraw(aArray, std::size(aArray)); Graphics()->LinesEnd(); } } @@ -121,11 +121,11 @@ void CMapView::RenderMap() } } - std::shared_ptr pT = std::static_pointer_cast(Editor()->GetSelectedLayerType(0, LAYERTYPE_TILES)); - if(Editor()->m_ShowTileInfo != CEditor::SHOW_TILE_OFF && pT && pT->m_Visible && m_Zoom.GetValue() <= 300.0f) + std::shared_ptr pSelectedTilesLayer = std::static_pointer_cast(Editor()->GetSelectedLayerType(0, LAYERTYPE_TILES)); + if(Editor()->m_ShowTileInfo != CEditor::SHOW_TILE_OFF && pSelectedTilesLayer && pSelectedTilesLayer->m_Visible && m_Zoom.GetValue() <= 300.0f) { Editor()->GetSelectedGroup()->MapScreen(); - pT->ShowInfo(); + pSelectedTilesLayer->ShowInfo(); } } @@ -230,7 +230,7 @@ vec2 CMapView::GetEditorOffset() const return m_EditorOffset; } -float CMapView::WorldZoom() const +float CMapView::GetWorldZoom() const { return m_WorldZoom; } diff --git a/src/game/editor/map_view.h b/src/game/editor/map_view.h index 65a5d5118..5da4db236 100644 --- a/src/game/editor/map_view.h +++ b/src/game/editor/map_view.h @@ -38,7 +38,7 @@ public: bool m_ShowPicker; // TODO: make private - float WorldZoom() const; + float GetWorldZoom() const; void OffsetWorld(vec2 Offset); void OffsetEditor(vec2 Offset); diff --git a/src/game/editor/proof_mode.cpp b/src/game/editor/proof_mode.cpp index 5f957a499..779668835 100644 --- a/src/game/editor/proof_mode.cpp +++ b/src/game/editor/proof_mode.cpp @@ -119,28 +119,28 @@ void CProofMode::RenderScreenSizes() if(i == 0) { - IGraphics::CLineItem Array[2] = { + IGraphics::CLineItem aArray[2] = { IGraphics::CLineItem(aPoints[0], aPoints[1], aPoints[2], aPoints[1]), IGraphics::CLineItem(aPoints[0], aPoints[3], aPoints[2], aPoints[3])}; - Graphics()->LinesDraw(Array, 2); + Graphics()->LinesDraw(aArray, std::size(aArray)); } if(i != 0) { - IGraphics::CLineItem Array[4] = { + IGraphics::CLineItem aArray[4] = { IGraphics::CLineItem(aPoints[0], aPoints[1], aLastPoints[0], aLastPoints[1]), IGraphics::CLineItem(aPoints[2], aPoints[1], aLastPoints[2], aLastPoints[1]), IGraphics::CLineItem(aPoints[0], aPoints[3], aLastPoints[0], aLastPoints[3]), IGraphics::CLineItem(aPoints[2], aPoints[3], aLastPoints[2], aLastPoints[3])}; - Graphics()->LinesDraw(Array, 4); + Graphics()->LinesDraw(aArray, std::size(aArray)); } if(i == NumSteps) { - IGraphics::CLineItem Array[2] = { + IGraphics::CLineItem aArray[2] = { IGraphics::CLineItem(aPoints[0], aPoints[1], aPoints[0], aPoints[3]), IGraphics::CLineItem(aPoints[2], aPoints[1], aPoints[2], aPoints[3])}; - Graphics()->LinesDraw(Array, 2); + Graphics()->LinesDraw(aArray, std::size(aArray)); } mem_copy(aLastPoints, aPoints, sizeof(aPoints)); @@ -166,12 +166,12 @@ void CProofMode::RenderScreenSizes() r.w = aPoints[2] - aPoints[0]; r.h = aPoints[3] - aPoints[1]; - IGraphics::CLineItem Array[4] = { + IGraphics::CLineItem aArray[4] = { IGraphics::CLineItem(r.x, r.y, r.x + r.w, r.y), IGraphics::CLineItem(r.x + r.w, r.y, r.x + r.w, r.y + r.h), IGraphics::CLineItem(r.x + r.w, r.y + r.h, r.x, r.y + r.h), IGraphics::CLineItem(r.x, r.y + r.h, r.x, r.y)}; - Graphics()->LinesDraw(Array, 4); + Graphics()->LinesDraw(aArray, std::size(aArray)); Graphics()->SetColor(0, 1, 0, 1); } } @@ -188,16 +188,16 @@ void CProofMode::RenderScreenSizes() { Graphics()->SetColor(0, 1, 0, 0.3f); - std::set indices; + std::set Indices; for(int i = 0; i < (int)m_vMenuBackgroundPositions.size(); i++) - indices.insert(i); + Indices.insert(i); - while(!indices.empty()) + while(!Indices.empty()) { - int i = *indices.begin(); - indices.erase(i); + int i = *Indices.begin(); + Indices.erase(i); for(int k : m_vMenuBackgroundCollisions.at(i)) - indices.erase(k); + Indices.erase(k); vec2 Pos = m_vMenuBackgroundPositions[i]; Pos += WorldOffset - m_vMenuBackgroundPositions[m_CurrentMenuProofIndex];