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. --- Minecraft.Client/Common/UI/UIScene.cpp | 87 +++++++++++++++++----------------- 1 file changed, 43 insertions(+), 44 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index a714d32e..3f204414 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -11,8 +11,8 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) { m_parentLayer = parentLayer; m_iPad = iPad; - swf = nullptr; - m_pItemRenderer = nullptr; + swf = NULL; + m_pItemRenderer = NULL; bHasFocus = false; m_hasTickedOnce = false; @@ -26,7 +26,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) m_lastOpacity = 1.0f; m_bUpdateOpacity = false; - m_backScene = nullptr; + m_backScene = NULL; m_cacheSlotRenders = false; m_needsCacheRendered = true; @@ -49,14 +49,14 @@ UIScene::~UIScene() ui.UnregisterCallbackId(m_callbackUniqueId); } - if(m_pItemRenderer != nullptr) delete m_pItemRenderer; + if(m_pItemRenderer != NULL) delete m_pItemRenderer; } void UIScene::destroyMovie() { /* Destroy the Iggy player. */ IggyPlayerDestroy( swf ); - swf = nullptr; + swf = NULL; // Clear out the controls collection (doesn't delete the controls, and they get re-setup later) m_controls.clear(); @@ -115,7 +115,7 @@ bool UIScene::needsReloaded() bool UIScene::hasMovie() { - return swf != nullptr; + return swf != NULL; } F64 UIScene::getSafeZoneHalfHeight() @@ -330,7 +330,7 @@ void UIScene::loadMovie() byteArray baFile = ui.getMovieData(moviePath.c_str()); int64_t beforeLoad = ui.iggyAllocCount; - swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, nullptr); + swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL); int64_t afterLoad = ui.iggyAllocCount; IggyPlayerInitializeAndTickRS ( swf ); int64_t afterTick = ui.iggyAllocCount; @@ -365,7 +365,7 @@ void UIScene::loadMovie() int64_t totalStatic = 0; int64_t totalDynamic = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - nullptr , + NULL , 0 , 0 , iteration , @@ -389,22 +389,21 @@ void UIScene::loadMovie() void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo) { - rrbool res; - IggyMemoryUseInfo internalMemoryInfo; - int internalIteration = 0; - while (res = IggyDebugGetMemoryUseInfo(swf, - 0, - memoryInfo.subcategory, - memoryInfo.subcategory_stringlen, - internalIteration, - &internalMemoryInfo)) - { - app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory, - internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count); - ++internalIteration; - if (internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) - getDebugMemoryUseRecursive(moviePath, internalMemoryInfo); - } + rrbool res; + IggyMemoryUseInfo internalMemoryInfo; + int internalIteration = 0; + while(res = IggyDebugGetMemoryUseInfo ( swf , + NULL , + memoryInfo.subcategory , + memoryInfo.subcategory_stringlen , + internalIteration , + &internalMemoryInfo )) + { + app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory, + internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count); + ++internalIteration; + if(internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) getDebugMemoryUseRecursive(moviePath, internalMemoryInfo); + } } void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic) @@ -417,7 +416,7 @@ void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic) int64_t sceneStatic = 0; int64_t sceneDynamic = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - 0 , + NULL , "" , 0 , iteration , @@ -465,7 +464,7 @@ void UIScene::tick() UIControl* UIScene::GetMainPanel() { - return nullptr; + return NULL; } #ifdef _WINDOWS64 @@ -667,19 +666,19 @@ void UIScene::removeControl( UIControl_Base *control, bool centreScene) void UIScene::slideLeft() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideLeft , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideLeft , 0 , NULL ); } void UIScene::slideRight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideRight , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideRight , 0 , NULL ); } void UIScene::doHorizontalResizeCheck() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHorizontalResizeCheck , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHorizontalResizeCheck , 0 , NULL ); } void UIScene::render(S32 width, S32 height, C4JRender::eViewportType viewport) @@ -722,7 +721,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations) { - if (item!= nullptr) + if (item!= NULL) { if(m_cacheSlotRenders) { @@ -850,7 +849,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt if (pop > 0) { glPushMatrix(); - float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); + float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION; float sx = x; float sy = y; float sxoffs = 8 * scaleX; @@ -861,7 +860,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt } PIXBeginNamedEvent(0,"Render and decorate"); - if(m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer(); + if(m_pItemRenderer == NULL) m_pItemRenderer = new ItemRenderer(); RenderManager.StateSetBlendEnable(true); RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); RenderManager.StateSetBlendFactor(0xffffffff); @@ -879,15 +878,15 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt { glPushMatrix(); glScalef(scaleX, scaleY, 1.0f); - int iX= static_cast(0.5f + ((float)x) / scaleX); - int iY= static_cast(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, item, iX, iY, fAlpha); glPopMatrix(); } else { - m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, item, static_cast(x), static_cast(y), fAlpha); + m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, item, (int)x, (int)y, fAlpha); } } @@ -898,9 +897,9 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt // 4J Stu - Not threadsafe //void UIScene::navigateForward(int iPad, EUIScene scene, void *initData) //{ -// if(m_parentLayer == nullptr) +// if(m_parentLayer == NULL) // { -// app.DebugPrintf("A scene is trying to navigate forwards, but it's parent layer is nullptr!\n"); +// app.DebugPrintf("A scene is trying to navigate forwards, but it's parent layer is NULL!\n"); //#ifndef _CONTENT_PACKAGE // __debugbreak(); //#endif @@ -918,9 +917,9 @@ void UIScene::navigateBack() ui.NavigateBack(m_iPad); - if(m_parentLayer == nullptr) + if(m_parentLayer == NULL) { -// app.DebugPrintf("A scene is trying to navigate back, but it's parent layer is nullptr!\n"); +// app.DebugPrintf("A scene is trying to navigate back, but it's parent layer is NULL!\n"); #ifndef _CONTENT_PACKAGE // __debugbreak(); #endif @@ -1043,7 +1042,7 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released IggyEvent keyEvent; // 4J Stu - Keyloc is always standard as we don't care about shift/alt - IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, static_cast(iggyKeyCode), IGGY_KEYLOC_Standard ); + IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, (IggyKeycode)iggyKeyCode, IGGY_KEYLOC_Standard ); IggyEventResult result; IggyPlayerDispatchEventRS ( swf , &keyEvent , &result ); @@ -1332,8 +1331,8 @@ bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) void UIScene::_handleFocusChange(F64 controlId, F64 childId) { - m_iFocusControl = static_cast(controlId); - m_iFocusChild = static_cast(childId); + m_iFocusControl = (int)controlId; + m_iFocusChild = (int)childId; handleFocusChange(controlId, childId); ui.PlayUISFX(eSFX_Focus); @@ -1341,8 +1340,8 @@ void UIScene::_handleFocusChange(F64 controlId, F64 childId) void UIScene::_handleInitFocus(F64 controlId, F64 childId) { - m_iFocusControl = static_cast(controlId); - m_iFocusChild = static_cast(childId); + m_iFocusControl = (int)controlId; + m_iFocusChild = (int)childId; //handleInitFocus(controlId, childId); handleFocusChange(controlId, childId); -- cgit v1.2.3