Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -40,7 +40,7 @@ LPCWSTR CXuiCtrlMinecraftSlot::xzpIcons[15]=
//-----------------------------------------------------------------------------
CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() :
//m_hBrush(nullptr),
//m_hBrush(NULL),
m_bDirty(FALSE),
m_iPassThroughDataAssociation(0),
m_iPassThroughIdAssociation(0),
@@ -60,10 +60,10 @@ CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() :
Minecraft *pMinecraft=Minecraft::GetInstance();
if(pMinecraft != nullptr)
if(pMinecraft != NULL)
{
m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
m_fScreenWidth=(float)pMinecraft->width_phys;
m_fScreenHeight=(float)pMinecraft->height_phys;
m_bScreenWidthSetup = true;
}
}
@@ -109,14 +109,14 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData,
pData->szPath = MsgGetSlotItem.szPath;
pData->bDirty = MsgGetSlotItem.bDirty;
if(MsgGetSlotItem.item != nullptr)
if(MsgGetSlotItem.item != NULL)
{
m_item = MsgGetSlotItem.item;
m_iID = m_item->id;
m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_fAlpha = static_cast<float>(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_fScale = static_cast<float>(GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
}
else
{
@@ -128,10 +128,10 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData,
// 4J Stu - Some parent controls may overide this, others will leave it as what we passed in
m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_fAlpha = static_cast<float>(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_iCount = GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_fScale = static_cast<float>(GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
m_popTime = GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_iAuxVal = GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(MsgGetSlotItem.iItemBitField);
@@ -145,7 +145,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData,
pData->szPath = xzpIcons[m_iID-32000];
}
if(m_item != nullptr && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr;
if(m_item != NULL && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr;
}
@@ -184,11 +184,11 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
hr = XuiSendMessage(m_hObj, &Message);
// We cannot have an Item with id 0
if(m_item != nullptr || (m_iID > 0 && m_iID<32000) )
if(m_item != NULL || (m_iID > 0 && m_iID<32000) )
{
HXUIDC hDC = pRenderData->hDC;
CXuiControl xuiControl(m_hObj);
if(m_item == nullptr) m_item = std::make_shared<ItemInstance>(m_iID, m_iCount, m_iAuxVal);
if(m_item == NULL) m_item = shared_ptr<ItemInstance>( new ItemInstance(m_iID, m_iCount, m_iAuxVal) );
// build and render with the game call
@@ -217,18 +217,18 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
// Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it.
// Clear just the region required for this control.
D3DRECT clearRect;
clearRect.x1 = static_cast<int>(matrix._41) - 2;
clearRect.y1 = static_cast<int>(matrix._42) - 2;
clearRect.x2 = static_cast<int>(matrix._41 + (bwidth * matrix._11)) + 2;
clearRect.y2 = static_cast<int>(matrix._42 + (bheight * matrix._22)) + 2;
clearRect.x1 = (int)(matrix._41) - 2;
clearRect.y1 = (int)(matrix._42) - 2;
clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2;
if(!m_bScreenWidthSetup)
{
Minecraft *pMinecraft=Minecraft::GetInstance();
if(pMinecraft != nullptr)
if(pMinecraft != NULL)
{
m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
m_fScreenWidth=(float)pMinecraft->width_phys;
m_fScreenHeight=(float)pMinecraft->height_phys;
m_bScreenWidthSetup = true;
}
}
@@ -261,14 +261,14 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
if (pop > 0)
{
glPushMatrix();
float squeeze = 1 + pop / static_cast<float>(Inventory::POP_TIME_DURATION);
float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION;
float sx = x;
float sy = y;
float sxoffs = 8 * scaleX;
float syoffs = 12 * scaleY;
glTranslatef(static_cast<float>(sx + sxoffs), static_cast<float>(sy + syoffs), 0);
glTranslatef((float)(sx + sxoffs), (float)(sy + syoffs), 0);
glScalef(1 / squeeze, (squeeze + 1) / 2, 1);
glTranslatef(static_cast<float>(-(sx + sxoffs)), static_cast<float>(-(sy + syoffs)), 0);
glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0);
}
m_pItemRenderer->renderAndDecorateItem(pMinecraft->font, pMinecraft->textures, m_item, x, y,scaleX,scaleY,m_fAlpha,m_isFoil,false);
@@ -284,15 +284,15 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
{
glPushMatrix();
glScalef(scaleX, scaleY, 1.0f);
int iX= static_cast<int>(0.5f + ((float)x) / scaleX);
int iY= static_cast<int>(0.5f + ((float)y) / scaleY);
int iX= (int)(0.5f+((float)x)/scaleX);
int iY= (int)(0.5f+((float)y)/scaleY);
m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, iX, iY, m_fAlpha);
glPopMatrix();
}
else
{
m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, static_cast<int>(x), static_cast<int>(y), m_fAlpha);
m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, (int)x, (int)y, m_fAlpha);
}
}
@@ -329,9 +329,9 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCount, i
m_iAuxVal = 0;
m_iCount=iCount;
m_fScale = static_cast<float>(iScale)/10.0f;
m_fScale = (float)(iScale)/10.0f;
//m_uiAlpha=uiAlpha;
m_fAlpha =static_cast<float>(uiAlpha) / 255.0f;
m_fAlpha =((float)(uiAlpha)) / 255.0f;
m_bDecorations = bDecorations;
// mif(bDecorations) m_iDecorations=1;
// else m_iDecorations=0;
@@ -348,8 +348,8 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, shared_ptr<ItemInstance> item, int
m_item = item;
m_isFoil = item->isFoil();
m_iPad = iPad;
m_fScale = static_cast<float>(iScale)/10.0f;
m_fAlpha =static_cast<float>(uiAlpha) / 31;
m_fScale = (float)(iScale)/10.0f;
m_fAlpha =((float)(uiAlpha)) / 31;
m_bDecorations = bDecorations;
m_bDirty = TRUE;
XuiElementSetShow(m_hObj,bShow);