aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI/XUI_Scene_Base.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/XUI/XUI_Scene_Base.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp')
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp225
1 files changed, 112 insertions, 113 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp
index 03782c79..c9a57f21 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp
@@ -22,26 +22,26 @@
#define PRESS_START_TIMER 0
-CXuiSceneBase *CXuiSceneBase::Instance = NULL;
+CXuiSceneBase *CXuiSceneBase::Instance = nullptr;
DWORD CXuiSceneBase::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME;
//----------------------------------------------------------------------------------
// Performs initialization tasks - retrieves controls.
//----------------------------------------------------------------------------------
HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- ASSERT( CXuiSceneBase::Instance == NULL );
+ ASSERT( CXuiSceneBase::Instance == nullptr );
CXuiSceneBase::Instance = this;
m_iWrongTexturePackTickC=20*5; // default 5 seconds before bringing up the upsell for not having the texture pack
MapChildControls();
// Display the tooltips
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
CXuiElement xuiElement = m_hObj;
HXUIOBJ hTemp;
- m_hEmptyQuadrantLogo=NULL;
+ m_hEmptyQuadrantLogo=nullptr;
XuiElementGetChildById(m_hObj,L"EmptyQuadrantLogo",&m_hEmptyQuadrantLogo);
D3DXVECTOR3 lastPos;
@@ -51,8 +51,8 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
m_visible[idx][ i ] = FALSE;
m_iCurrentTooltipTextID[idx][i]=-1;
- hTooltipText[idx][i]=NULL;
- hTooltipTextSmall[idx][i]=NULL;
+ hTooltipText[idx][i]=nullptr;
+ hTooltipTextSmall[idx][i]=nullptr;
// set all tooltips to shown FALSE by default
m_Buttons[idx][i].SetShow( FALSE );
m_ButtonsSmall[idx][i].SetShow( FALSE );
@@ -106,7 +106,7 @@ HRESULT CXuiSceneBase::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
// clear the quadrants
m_iQuadrantsMask=0;
- HXUIOBJ hObj=NULL,hQuadrant;
+ HXUIOBJ hObj=nullptr,hQuadrant;
HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj);
@@ -144,8 +144,8 @@ HRESULT CXuiSceneBase::OnSkinChanged(BOOL& bHandled)
{
for( unsigned int i = 0; i < BUTTONS_TOOLTIP_MAX; ++i )
{
- hTooltipText[idx][i]=NULL;
- hTooltipTextSmall[idx][i]=NULL;
+ hTooltipText[idx][i]=nullptr;
+ hTooltipTextSmall[idx][i]=nullptr;
}
}
@@ -169,7 +169,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
// make sure there's not a mount going on before using the textures
if(bCheckTexturePack && app.DLCInstallProcessCompleted() )
- {
+ {
TexturePack *tPack = pMinecraft->skins->getSelected();
if(tPack->getId()!=app.GetRequiredTexturePackID())
@@ -178,7 +178,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
//Is it available?
TexturePack * pRequiredTPack=pMinecraft->skins->getTexturePackById(app.GetRequiredTexturePackID());
- if(pRequiredTPack!=NULL)
+ if(pRequiredTPack!=nullptr)
{
// we can switch to the required pack
// reset the timer
@@ -186,7 +186,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID());
- // probably had background downloads enabled, so turn them off
+ // probably had background downloads enabled, so turn them off
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
}
else
@@ -206,7 +206,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
}
}
- if (EnderDragonRenderer::bossInstance == NULL)
+ if (EnderDragonRenderer::bossInstance == nullptr)
{
if(m_ticksWithNoBoss<=20)
{
@@ -221,9 +221,9 @@ void CXuiSceneBase::_TickAllBaseScenes()
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{
- if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
+ if(pMinecraft->localplayers[i] != nullptr && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
{
- int iGuiScale;
+ int iGuiScale;
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -234,7 +234,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen);
}
m_BossHealthGroup[i].SetShow(TRUE);
- m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
+ m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -245,7 +245,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(TRUE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -259,7 +259,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(TRUE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -272,7 +272,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(TRUE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -295,7 +295,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(TRUE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -308,7 +308,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(TRUE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -320,7 +320,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(TRUE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -364,7 +364,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
break;
}
}
- }
+ }
m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() );
m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() );
@@ -401,7 +401,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
if(uiOpacityTimer < (SharedConstants::TICKS_PER_SECOND * 1) )
{
float fStep=(80.0f)/10.0f;
- float fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
XuiElementSetOpacity(m_selectedItemA[i],fVal);
XuiElementSetOpacity(m_selectedItemSmallA[i],fVal);
@@ -441,8 +441,8 @@ void CXuiSceneBase::_TickAllBaseScenes()
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -451,7 +451,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
@@ -461,22 +461,22 @@ void CXuiSceneBase::_TickAllBaseScenes()
{
ucAlpha=15;
}
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
XuiElementSetOpacity(app.GetCurrentHUDScene(i),fVal);
XUIMessage xuiMsg;
CustomMessage_TickScene( &xuiMsg );
XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg );
-
+
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0;
- if(bDisplayGui && pMinecraft->localplayers[i] != NULL)
+ if(bDisplayGui && pMinecraft->localplayers[i] != nullptr)
{
- XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
+ XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
}
else
{
- XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
+ XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
}
}
}
@@ -495,29 +495,28 @@ HRESULT CXuiSceneBase::_SetEnableTooltips( unsigned int iPad, BOOL bVal )
HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID )
{
ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX );
-
+
XUIRect xuiRect, xuiRectSmall;
HRESULT hr=S_OK;
- LPCWSTR pString=NULL;
+ LPCWSTR pString=nullptr;
float fWidth,fHeight;
-
+
// Want to be able to show just a button (for RB LB)
if(iTextID>=0)
{
pString=app.GetString(iTextID);
}
-
- if(hTooltipText[iPad][uiTooltip]==NULL)
+ if(hTooltipText[iPad][uiTooltip]==nullptr)
{
- HXUIOBJ hObj=NULL;
+ HXUIOBJ hObj=nullptr;
hr=XuiControlGetVisual(m_Buttons[iPad][uiTooltip].m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]);
hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]);
}
- if(hTooltipTextSmall[iPad][uiTooltip]==NULL)
+ if(hTooltipTextSmall[iPad][uiTooltip]==nullptr)
{
- HXUIOBJ hObj=NULL;
+ HXUIOBJ hObj=nullptr;
hr=XuiControlGetVisual(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipTextSmall[iPad][uiTooltip]);
hr=XuiElementGetPosition(hTooltipTextSmall[iPad][uiTooltip],&m_vPosTextInTooltipSmall[uiTooltip]);
@@ -525,8 +524,8 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
if(iTextID>=0)
{
- hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
-
+ hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
+
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight);
@@ -537,7 +536,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall);
-
+
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight);
@@ -627,8 +626,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -637,7 +636,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
@@ -647,7 +646,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
{
ucAlpha=15;
}
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
m_Buttons[iPad][tooltip].SetOpacity(fVal);
@@ -678,8 +677,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -688,12 +687,12 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
XuiElementSetOpacity(m_hGamerTagA[iPad],fVal);
}
@@ -701,7 +700,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
if(iPad==ProfileManager.GetPrimaryPad())
{
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
- XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha);
+ XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast<float>(ucAlpha));
}
}
}
@@ -749,7 +748,7 @@ HRESULT CXuiSceneBase::_SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB,
m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB );
m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB );
m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS );
-
+
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX );
@@ -858,9 +857,9 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow )
hr=XuiElementGetChildById(hVisual,L"NightGroup",&hNight);
hr=XuiElementGetChildById(hVisual,L"DayGroup",&hDay);
- if(bShow && pMinecraft->level!=NULL)
+ if(bShow && 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)
{
@@ -911,7 +910,7 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
m_PressStart.SetShow(TRUE);
// retrieve the visual for this quadrant
- HXUIOBJ hObj=NULL,hQuadrant;
+ HXUIOBJ hObj=nullptr,hQuadrant;
HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hQuadrant);
memset(&xuiRect, 0, sizeof(xuiRect));
@@ -945,11 +944,11 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
int nStart, nEnd;
// XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart );
// XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd );
-// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
+// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart );
XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd );
- XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
-
+ XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
+
return S_OK;
}
@@ -960,7 +959,7 @@ HRESULT CXuiSceneBase::_HidePressStart()
HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
{
- WCHAR wcAutosaveCountdown[100];
+ WCHAR wcAutosaveCountdown[100];
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
m_TrialTimer.SetText(wcAutosaveCountdown);
return S_OK;
@@ -974,15 +973,15 @@ HRESULT CXuiSceneBase::_ShowAutosaveCountdownTimer(BOOL bVal)
HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
{
- WCHAR wcTime[20];
+ WCHAR wcTime[20];
- DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
+ DWORD dwTimeTicks=static_cast<DWORD>(app.getTrialTimer());
if(dwTimeTicks>m_dwTrialTimerLimitSecs)
{
dwTimeTicks=m_dwTrialTimerLimitSecs;
}
-
+
dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks;
#ifndef _CONTENT_PACKAGE
@@ -1014,7 +1013,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
void CXuiSceneBase::_ReduceTrialTimerValue()
{
- DWORD dwTimeTicks=(int)app.getTrialTimer();
+ DWORD dwTimeTicks=static_cast<int>(app.getTrialTimer());
if(dwTimeTicks>m_dwTrialTimerLimitSecs)
{
@@ -1038,7 +1037,7 @@ bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad)
HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position )
{
// turn off the empty quadrant logo
- if(m_hEmptyQuadrantLogo!=NULL)
+ if(m_hEmptyQuadrantLogo!=nullptr)
{
XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE);
}
@@ -1086,12 +1085,12 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE);
}
- if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
- {
+ if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
+ {
//640x480 ->1280x720
scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f;
XuiElementSetScale(m_hObj, &scale);
-
+
return S_OK;
}
@@ -1127,7 +1126,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
// No position adjustment
case e_BaseScene_Fullscreen:
tooltipsPos.x=SAFEZONE_HALF_WIDTH;
- tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
+ tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
crouchIconPos.x=SAFEZONE_HALF_WIDTH;
crouchIconPos.y=SAFEZONE_HALF_HEIGHT;
fBackWidth=XUI_BASE_SCENE_WIDTH;
@@ -1268,7 +1267,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
// 4J Stu - If we already have some scenes open, then call this to update their positions
// Fix for #10960 - All Lang: UI: Split-screen: Changing split screen mode (vertical/horizontal) make window layout strange
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localplayers[iPad]!=nullptr)
{
// 4J-PB - Can only do this once we know what the player's UI settings are, so we need to have the player game settings read
_UpdateSelectedItemPos(iPad);
@@ -1303,7 +1302,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants
- if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
+ if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
(RenderManager.IsHiDef() || RenderManager.IsWidescreen()) )
{
D3DXVECTOR3 selectedItemPos;
@@ -1328,18 +1327,18 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// The move applies to the whole scene, so we'll need to move tooltips back in some cases
- selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
+ selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f);
// Adjust selectedItemPos based on what gui is displayed
- // 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
+ // 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
float fYOffset=0.0f;
unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2;
-
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
+
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localgameModes[iPad] != nullptr && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{
// SURVIVAL MODE - Move up further because of hearts, shield and xp
switch(ucGuiScale)
@@ -1353,7 +1352,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = -94.0f;
break;
- }
+ }
}
else
{
@@ -1368,7 +1367,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = -58.0f;
break;
- }
+ }
}
@@ -1425,14 +1424,14 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// 4J-PB - If it's in split screen vertical, adjust the position
// Adjust selectedItemPos based on what gui is displayed
if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right))
- {
+ {
float scale=0.5f;
selectedItemPos.y -= (scale * 88.0f);
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localgameModes[iPad] != nullptr && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{
selectedItemPos.y -= (scale * 80.0f);
}
-
+
// 4J-PB - selected the gui scale based on the slider settings
unsigned char ucGuiScale;
float fYOffset=0.0f;
@@ -1455,7 +1454,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = 85.0f;
break;
- }
+ }
selectedItemPos.y+=fYOffset;
}
@@ -1471,7 +1470,7 @@ CXuiSceneBase::EBaseScenePosition CXuiSceneBase::_GetPlayerBasePosition(int iPad
void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos)
{
- if(m_hEmptyQuadrantLogo!=NULL)
+ if(m_hEmptyQuadrantLogo!=nullptr)
{
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{
@@ -1512,7 +1511,7 @@ void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos)
if(ProfileManager.GetLockedProfile()!=-1)
{
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
- XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha);
+ XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast<float>(ucAlpha));
}
XuiElementSetPosition(m_hEmptyQuadrantLogo, &pos );
@@ -1606,8 +1605,8 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
{
// The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
- {
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
+ {
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localplayers[iPad]!= nullptr)
{
wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad));
XuiControlSetText(m_hGamerTagA[iPad],wsGamertag.c_str());
@@ -1621,7 +1620,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
}
// The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
- {
+ {
XuiElementSetShow(m_hGamerTagA[iPad],bDisplay);
// set the opacity of the gamertag
@@ -1638,8 +1637,8 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -1648,12 +1647,12 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
XuiElementSetOpacity(m_hGamerTagA[iPad],0.01f*fVal);
}
@@ -1712,11 +1711,11 @@ void CXuiSceneBase::_HideAllGameUIElements()
m_uiSelectedItemOpacityCountDown[i] = 0;
m_selectedItemA[i].SetShow(FALSE);
m_selectedItemSmallA[i].SetShow(FALSE);
-
+
m_BossHealthGroup[i].SetShow(FALSE);
m_bossHealthVisible[i] = FALSE;
- XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
+ XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
_DisplayGamertag(i,FALSE);
}
@@ -1845,12 +1844,12 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
if( i>0 && lastVisible!=-1 )
{
float width, height;
- XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
+ XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPos.x += width + m_iTooltipSpacingGap;
- XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
+ XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPosSmall.x += width + m_iTooltipSpacingGapSmall;
}
@@ -1864,7 +1863,7 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
void CXuiSceneBase::TickAllBaseScenes()
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
CXuiSceneBase::Instance->_TickAllBaseScenes();
}
@@ -1872,7 +1871,7 @@ void CXuiSceneBase::TickAllBaseScenes()
HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_SetEnableTooltips(iPad, bVal );
}
@@ -1881,7 +1880,7 @@ HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal )
HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_SetTooltipText(iPad, tooltip, iTextID );
}
@@ -1890,7 +1889,7 @@ HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip,
HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad)
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_RefreshTooltips(iPad);
}
@@ -1899,7 +1898,7 @@ HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad)
HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_ShowTooltip(iPad, tooltip, show );
}
@@ -1908,7 +1907,7 @@ HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, boo
HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_ShowSafeArea(bShow );
}
@@ -1917,7 +1916,7 @@ HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow )
HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY , int iLT, int iRT, int iRB, int iLB, int iLS, bool forceUpdate /*= false*/ )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
// Enable all the tooltips. We should disable them in the scenes as required
CXuiSceneBase::Instance->_SetTooltipsEnabled( iPad );
@@ -1948,15 +1947,15 @@ HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, i
}
else
{
- // does the tooltip need to change?
+ // does the tooltip need to change?
if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate)
{
CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] );
- }
+ }
CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true );
}
}
-
+
}
return S_OK;
}
@@ -1978,7 +1977,7 @@ HRESULT CXuiSceneBase::AnimateKeyPress(DWORD userIndex, DWORD dwKeyCode)
HRESULT CXuiSceneBase::ShowSavingMessage( unsigned int iPad, C4JStorage::ESavingMessage eVal )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_ShowSavingMessage(iPad, eVal);
}
@@ -2067,18 +2066,18 @@ HRESULT CXuiSceneBase::SetPlayerBasePositions(EBaseScenePosition pad0, EBaseScen
}
HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
-{
+{
EBaseScenePosition padPositions[XUSER_MAX_COUNT];
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
padPositions[idx] = e_BaseScene_NotSet;
}
-
+
Minecraft *pMinecraft = Minecraft::GetInstance();
// If the game is not started (or is being held paused for a bit) then display all scenes fullscreen
- if( pMinecraft == NULL )
+ if( pMinecraft == nullptr )
{
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
@@ -2105,7 +2104,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
- if(pMinecraft->localplayers[idx] != NULL)
+ if(pMinecraft->localplayers[idx] != nullptr)
{
if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -2134,7 +2133,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
padPositions[idx] = e_BaseScene_Right;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
- padPositions[idx] = e_BaseScene_Top_Left;
+ padPositions[idx] = e_BaseScene_Top_Left;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
padPositions[idx] = e_BaseScene_Top_Right;
@@ -2168,7 +2167,7 @@ void CXuiSceneBase::UpdateSelectedItemPos(int iPad)
CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad);
}
-HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
+HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
{
return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad);
}
@@ -2186,7 +2185,7 @@ void CXuiSceneBase::SetEmptyQuadrantLogo(int iScreenSection)
// find the empty player
for( iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad)
{
- if(pMinecraft->localplayers[iPad] == NULL)
+ if(pMinecraft->localplayers[iPad] == nullptr)
{
switch( iScreenSection)
{
@@ -2238,6 +2237,6 @@ void CXuiSceneBase::CreateBaseSceneInstance()
{
CXuiSceneBase *sceneBase = new CXuiSceneBase();
BOOL handled;
- sceneBase->OnInit(NULL,handled);
+ sceneBase->OnInit(nullptr,handled);
}
#endif \ No newline at end of file