From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: 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 a9be52c41a02d207233199e98898fe7483d7e817. --- .../Common/UI/UIScene_CraftingMenu.cpp | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp index 16b63c4c..2d1b4302 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -22,7 +22,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p #endif m_bIgnoreKeyPresses = false; - CraftingPanelScreenInput* initData = static_cast(_initData); + CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData; m_iContainerType=initData->iContainerType; m_pPlayer=initData->player; m_bSplitscreen=initData->bSplitscreen; @@ -117,9 +117,9 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p // Update the tutorial state Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); if(m_iContainerType==RECIPE_TYPE_2x2) { @@ -198,14 +198,14 @@ void UIScene_CraftingMenu::handleDestroy() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr && Minecraft::GetInstance()->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL && Minecraft::GetInstance()->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); } @@ -525,14 +525,14 @@ void UIScene_CraftingMenu::handleReload() void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; shared_ptr item = nullptr; int slotId = -1; float alpha = 1.0f; bool decorations = true; bool inventoryItem = false; - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -560,7 +560,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_vSlotsInfo[iIndex].show) { item = m_vSlotsInfo[iIndex].item; - alpha = static_cast(m_vSlotsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_vSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_H_SLOT_START && slotId < (CRAFTING_H_SLOT_START + m_iCraftablesMaxHSlotC) ) @@ -596,7 +596,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_hSlotsInfo[iIndex].show) { item = m_hSlotsInfo[iIndex].item; - alpha = static_cast(m_hSlotsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_hSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_INGREDIENTS_LAYOUT_START && slotId < (CRAFTING_INGREDIENTS_LAYOUT_START + m_iIngredientsMaxSlotC) ) @@ -605,7 +605,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_ingredientsSlotsInfo[iIndex].show) { item = m_ingredientsSlotsInfo[iIndex].item; - alpha = static_cast(m_ingredientsSlotsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_ingredientsSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_INGREDIENTS_DESCRIPTION_START && slotId < (CRAFTING_INGREDIENTS_DESCRIPTION_START + 4) ) @@ -614,7 +614,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_ingredientsInfo[iIndex].show) { item = m_ingredientsInfo[iIndex].item; - alpha = static_cast(m_ingredientsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_ingredientsInfo[iIndex].alpha)/31.0f; } } else if(slotId == CRAFTING_OUTPUT_SLOT_START ) @@ -622,11 +622,11 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_craftingOutputSlotInfo.show) { item = m_craftingOutputSlotInfo.item; - alpha = static_cast(m_craftingOutputSlotInfo.alpha)/31.0f; + alpha = ((float)m_craftingOutputSlotInfo.alpha)/31.0f; } } - if(item != nullptr) + if(item != NULL) { if(!inventoryItem) { @@ -742,7 +742,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptr