aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/Common/UI/UIComponent_Panorama.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/UI/UIComponent_Panorama.cpp')
-rw-r--r--Minecraft.Client/Common/UI/UIComponent_Panorama.cpp65
1 files changed, 37 insertions, 28 deletions
diff --git a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp
index cb6443a1..3da8174c 100644
--- a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp
+++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp
@@ -45,9 +45,9 @@ void UIComponent_Panorama::tick()
Minecraft *pMinecraft = Minecraft::GetInstance();
EnterCriticalSection(&pMinecraft->m_setLevelCS);
- if(pMinecraft->level!=NULL)
+ if(pMinecraft->level!=nullptr)
{
- __int64 i64TimeOfDay =0;
+ int64_t i64TimeOfDay =0;
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0)
{
@@ -85,46 +85,55 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
switch( viewport )
{
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
- yPos = (S32)(ui.getScreenHeight() / 2);
+ yPos = static_cast<S32>(ui.getScreenHeight() / 2);
break;
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
- xPos = (S32)(ui.getScreenWidth() / 2);
+ xPos = static_cast<S32>(ui.getScreenWidth() / 2);
break;
}
ui.setupRenderPosition(xPos, yPos);
- if((viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) || (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT))
+ S32 tileXStart = 0;
+ S32 tileYStart = 0;
+ S32 tileWidth = width;
+ S32 tileHeight = height;
+
+ if((viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) || (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT))
{
- // Need to render at full height, but only the left side of the scene
- S32 tileXStart = 0;
- S32 tileYStart = 0;
- S32 tileWidth = width;
- S32 tileHeight = (S32)(ui.getScreenHeight());
-
- IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
-
- IggyPlayerDrawTilesStart ( getMovie() );
-
- m_renderWidth = tileWidth;
- m_renderHeight = tileHeight;
- IggyPlayerDrawTile ( getMovie() ,
- tileXStart ,
- tileYStart ,
- tileXStart + tileWidth ,
- tileYStart + tileHeight ,
- 0 );
- IggyPlayerDrawTilesEnd ( getMovie() );
+ tileHeight = static_cast<S32>(ui.getScreenHeight());
}
else
{
- // Need to render at full height, and full width. But compressed into the viewport
- IggyPlayerSetDisplaySize( getMovie(), ui.getScreenWidth(), ui.getScreenHeight()/2 );
- IggyPlayerDraw( getMovie() );
+ tileWidth = static_cast<S32>(ui.getScreenWidth());
+ tileYStart = static_cast<S32>(ui.getScreenHeight() / 2);
}
+
+ F32 scaleW = static_cast<F32>(tileXStart + tileWidth) / static_cast<F32>(m_movieWidth);
+ F32 scaleH = static_cast<F32>(tileYStart + tileHeight) / static_cast<F32>(m_movieHeight);
+ F32 scale = (scaleW > scaleH) ? scaleW : scaleH;
+ if(scale < 1.0f) scale = 1.0f;
+
+ IggyPlayerSetDisplaySize( getMovie(), static_cast<S32>(m_movieWidth * scale), static_cast<S32>(m_movieHeight * scale) );
+
+ IggyPlayerDrawTilesStart ( getMovie() );
+
+ m_renderWidth = tileWidth;
+ m_renderHeight = tileHeight;
+ IggyPlayerDrawTile ( getMovie() ,
+ tileXStart ,
+ tileYStart ,
+ tileXStart + tileWidth ,
+ tileYStart + tileHeight ,
+ 0 );
+ IggyPlayerDrawTilesEnd ( getMovie() );
}
else
{
- UIScene::render(width, height, viewport);
+ if(m_bIsReloading) return;
+ if(!m_hasTickedOnce || !getMovie()) return;
+ ui.setupRenderPosition(0, 0);
+ IggyPlayerSetDisplaySize( getMovie(), static_cast<S32>(ui.getScreenWidth()), static_cast<S32>(ui.getScreenHeight()) );
+ IggyPlayerDraw( getMovie() );
}
}