From 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b Mon Sep 17 00:00:00 2001 From: void_17 <61356189+void2012@users.noreply.github.com> Date: Fri, 6 Mar 2026 02:11:18 +0700 Subject: Remove AUTO_VAR macro and _toString function (#592) --- Minecraft.Client/Common/UI/UIController.cpp | 100 +++++++++++++--------------- 1 file changed, 46 insertions(+), 54 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIController.cpp') diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 01ab49ba..5375b784 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -182,7 +182,7 @@ UIController::UIController() { m_uiDebugConsole = NULL; m_reloadSkinThread = NULL; - + m_navigateToHomeOnReload = false; m_bCleanupOnReload = false; @@ -302,7 +302,7 @@ void UIController::postInit() IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this ); SetupFont(); - // + // loadSkins(); for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) @@ -383,7 +383,7 @@ void UIController::SetupFont() app.m_dlcManager.LanguageChanged(); app.loadStringTable(); // Switch to use new string table, - + if (m_eTargetFont == m_eCurrentFont) { // 4J-JEV: If we're ingame, reload the font to update all the text. @@ -458,12 +458,12 @@ bool UIController::UsingBitmapFont() void UIController::tick() { SetupFont(); // If necessary, change font. - + if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() ) { ui.CleanUpSkinReload(); - - if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) + + if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) { ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu); } @@ -500,8 +500,8 @@ void UIController::tick() // Clear out the cached movie file data __int64 currentTime = System::currentTimeMillis(); - for(AUTO_VAR(it, m_cachedMovieData.begin()); it != m_cachedMovieData.end();) - { + for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();) + { if(it->second.m_expiry < currentTime) { delete [] it->second.m_ba.data; @@ -730,7 +730,7 @@ void UIController::CleanUpSkinReload() { if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) { -#ifdef _DURANGO +#ifdef _DURANGO DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); #else DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); @@ -738,9 +738,8 @@ void UIController::CleanUpSkinReload() } } - for(AUTO_VAR(it,m_queuedMessageBoxData.begin()); it != m_queuedMessageBoxData.end(); ++it) + for(auto queuedData : m_queuedMessageBoxData) { - QueuedMessageBoxData *queuedData = *it; ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen); delete queuedData->info.uiOptionA; delete queuedData; @@ -752,8 +751,8 @@ byteArray UIController::getMovieData(const wstring &filename) { // Cache everything we load in the current tick __int64 targetTime = System::currentTimeMillis() + (1000LL * 60); - AUTO_VAR(it,m_cachedMovieData.find(filename)); - if(it == m_cachedMovieData.end() ) + auto it = m_cachedMovieData.find(filename); + if(it == m_cachedMovieData.end() ) { byteArray baFile = app.getArchiveFile(filename); CachedMovieData cmd; @@ -959,7 +958,7 @@ void UIController::handleInput() { #ifdef _DURANGO // 4J-JEV: Added exception for primary play who migh've uttered speech commands. - if(iPad != ProfileManager.GetPrimaryPad() + if(iPad != ProfileManager.GetPrimaryPad() && (!InputManager.IsPadConnected(iPad) || !InputManager.IsPadLocked(iPad)) ) continue; #endif for(unsigned int key = 0; key <= ACTION_MAX_MENU; ++key) @@ -1035,7 +1034,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { // no active touch? clear active and highlighted touch UI elements m_ActiveUIElement = NULL; - m_HighlightedUIElement = NULL; + m_HighlightedUIElement = NULL; // fullscreen first UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene(); @@ -1085,7 +1084,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) } } } - } + } else if(m_bTouchscreenPressed && pTouchData->reportNum==1) { // fullscreen first @@ -1337,8 +1336,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) app.DebugPrintf(app.USER_SR, "Total static: %d , Total dynamic: %d\n", totalStatic, totalDynamic); app.DebugPrintf(app.USER_SR, "\n\nEND TOTAL SWF MEMORY USAGE\n"); app.DebugPrintf(app.USER_SR, "********************************\n\n"); - } - else + } + else #endif #endif #endif @@ -1535,7 +1534,7 @@ void UIController::setupCustomDrawGameState() glLoadIdentity(); glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); - glEnable(GL_ALPHA_TEST); + glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); @@ -1635,22 +1634,22 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl //Description //Callback to create a user-defined texture to replace SWF-defined textures. //Parameters -//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. -//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. -//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). -//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. +//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. +//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. +//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). +//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. // //Discussion // //If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway). GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data ) { - UIController *uiController = (UIController *)user_callback_data; - AUTO_VAR(it,uiController->m_substitutionTextures.find((wchar_t *)texture_name)); + UIController *uiController = static_cast(user_callback_data); + auto it = uiController->m_substitutionTextures.find(texture_name); - if(it != uiController->m_substitutionTextures.end()) + if(it != uiController->m_substitutionTextures.end()) { - app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", (wchar_t *)texture_name,it->second.length); + app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length); BufferedImage image(it->second.data, it->second.length); if( image.getData() != NULL ) @@ -1711,9 +1710,9 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData) { - AUTO_VAR(it,m_substitutionTextures.find(textureName)); + auto it = m_substitutionTextures.find(textureName); - if(it != m_substitutionTextures.end()) + if(it != m_substitutionTextures.end()) { if(deleteData) delete [] it->second.data; m_substitutionTextures.erase(it); @@ -1854,7 +1853,7 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI void UIController::NavigateToHomeMenu() { ui.CloseAllPlayersScenes(); - + // Alert the app the we no longer want to be informed of ethernet connections app.SetLiveLinkRequired( false ); @@ -1953,8 +1952,8 @@ size_t UIController::RegisterForCallbackId(UIScene *scene) void UIController::UnregisterCallbackId(size_t id) { EnterCriticalSection(&m_registeredCallbackScenesCS); - AUTO_VAR(it, m_registeredCallbackScenes.find(id) ); - if(it != m_registeredCallbackScenes.end() ) + auto it = m_registeredCallbackScenes.find(id); + if(it != m_registeredCallbackScenes.end() ) { m_registeredCallbackScenes.erase(it); } @@ -1964,8 +1963,8 @@ void UIController::UnregisterCallbackId(size_t id) UIScene *UIController::GetSceneFromCallbackId(size_t id) { UIScene *scene = NULL; - AUTO_VAR(it, m_registeredCallbackScenes.find(id) ); - if(it != m_registeredCallbackScenes.end() ) + auto it = m_registeredCallbackScenes.find(id); + if(it != m_registeredCallbackScenes.end() ) { scene = it->second; } @@ -2017,7 +2016,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) m_groups[(int)group]->closeAllScenes(); m_groups[(int)group]->getTooltips()->SetTooltips(-1); - + // This should cause the popup to dissappear TutorialPopupInfo popupInfo; if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo); @@ -2168,7 +2167,7 @@ void UIController::SetMenuDisplayed(int iPad,bool bVal) #ifdef _DURANGO // 4J-JEV: When in-game, allow player to toggle the 'Pause' and 'IngameInfo' menus via Kinnect. - if (Minecraft::GetInstance()->running) + if (Minecraft::GetInstance()->running) InputManager.SetEnabledGtcButtons(_360_GTC_MENU | _360_GTC_PAUSE | _360_GTC_VIEW); #endif } @@ -2341,7 +2340,7 @@ void UIController::PlayUISFX(ESoundEffect eSound) // Don't play multiple SFX on the same tick // (prevents horrible sounds when programmatically setting multiple checkboxes) if (time - m_lastUiSfx < 10) { return; } - m_lastUiSfx = time; + m_lastUiSfx = time; Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f); } @@ -2588,7 +2587,7 @@ void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds) void UIController::UpdateTrialTimer(unsigned int iPad) { - WCHAR wcTime[20]; + WCHAR wcTime[20]; DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); @@ -2650,7 +2649,7 @@ void UIController::ShowAutosaveCountdownTimer(bool show) void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { #if !(defined(_XBOX_ONE) || defined(__ORBIS__)) - WCHAR wcAutosaveCountdown[100]; + WCHAR wcAutosaveCountdown[100]; swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif @@ -2820,7 +2819,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 #ifdef __ORBIS__ // Show the vague UGC system message in addition to our message ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); - return C4JStorage::EMessage_ResultAccept; + return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad ); UINT uiIDA[1]; @@ -2857,7 +2856,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT #ifdef __ORBIS__ // Show the vague UGC system message in addition to our message ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); - return C4JStorage::EMessage_ResultAccept; + return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad ); return C4JStorage::EMessage_ResultAccept; @@ -2897,7 +2896,7 @@ void UIController::setFontCachingCalculationBuffer(int length) } } -// Returns the first scene of given type if it exists, NULL otherwise +// Returns the first scene of given type if it exists, NULL otherwise UIScene *UIController::FindScene(EUIScene sceneType) { UIScene *pScene = NULL; @@ -3002,11 +3001,8 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene) ui.TouchBoxesClear(pUIScene); // rebuild boxes - AUTO_VAR(itEnd, pUIScene->GetControls()->end()); - for (AUTO_VAR(it, pUIScene->GetControls()->begin()); it != itEnd; it++) + for ( UIControl *control : *pUIScene->GetControls() ) { - UIControl *control=(UIControl *)*it; - if(control->getControlType() == UIControl::eButton || control->getControlType() == UIControl::eSlider || control->getControlType() == UIControl::eCheckBox || @@ -3035,11 +3031,9 @@ void UIController::TouchBoxesClear(UIScene *pUIScene) EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer; EUIScene eUIscene=pUIScene->getSceneType(); - AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end()); - for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++) + for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] ) { - UIELEMENT *element=(UIELEMENT *)*it; - delete element; + delete element; } m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear(); } @@ -3056,10 +3050,8 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0) { - AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end()); - for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++) + for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] ) { - UIELEMENT *element=(UIELEMENT *)*it; if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls { if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2)) @@ -3075,7 +3067,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) return true; } } - } + } } //app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y); -- cgit v1.2.3