diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
Project modernization (#630)
* Fixed boats falling and a TP glitch #266
* Replaced every C-style cast with C++ ones
* Replaced every C-style cast with C++ ones
* Fixed boats falling and a TP glitch #266
* Updated NULL to nullptr and fixing some type issues
* Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
* Fixing more conflicts
* Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp')
| -rw-r--r-- | Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp index ee706610..b92159c0 100644 --- a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp @@ -26,9 +26,9 @@ WCHAR *CScene_SkinSelect::wchDefaultNamesA[]= //---------------------------------------------------------------------------------- HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast<int *>(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); m_bIgnoreInput=false; // 4J Stu - Added this so that we have skins loaded @@ -46,7 +46,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_skinIndex = 0; m_currentSkinPath = app.GetPlayerSkinName(m_iPad); m_originalSkinId = app.GetPlayerSkinId(m_iPad); - m_currentPack = NULL; + m_currentPack = nullptr; m_bSlidingSkins = false; m_bAnimatingMove = false; currentPackCount = 0; @@ -86,7 +86,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // Change to display the favorites if there are any. The current skin will be in there (probably) - need to check for it m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); bool bFound; - if(m_currentPack != NULL) + if(m_currentPack != nullptr) { m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; } @@ -232,7 +232,7 @@ HRESULT CScene_SkinSelect::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle } break; default: - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { DLCSkinFile *skinFile = m_currentPack->getSkinFile(m_skinIndex); @@ -266,7 +266,7 @@ HRESULT CScene_SkinSelect::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_currentPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -626,8 +626,8 @@ void CScene_SkinSelect::handleSkinIndexChanged() wstring skinOrigin = L""; bool bSkinIsFree=false; bool bLicensed=false; - DLCSkinFile *skinFile=NULL; - DLCPack *Pack=NULL; + DLCSkinFile *skinFile=nullptr; + DLCPack *Pack=nullptr; BYTE sidePreviewControlsL,sidePreviewControlsR; bool bNoSkinsToShow=false; @@ -635,7 +635,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() m_selectedGroup.SetShow( FALSE ); m_skinDetails.SetShow( FALSE ); - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { skinFile = m_currentPack->getSkinFile(m_skinIndex); m_selectedSkinPath = skinFile->getPath(); @@ -665,7 +665,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() { m_selectedSkinPath = L""; m_selectedCapePath = L""; - m_vAdditionalSkinBoxes = NULL; + m_vAdditionalSkinBoxes = nullptr; switch(m_packIndex) { @@ -753,13 +753,13 @@ void CScene_SkinSelect::handleSkinIndexChanged() { // add the boxes to the humanoid model, but only if we've not done this already vector<ModelPart *> *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==NULL) + if(pAdditionalModelParts==nullptr) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes); } } - if(skinFile!=NULL) + if(skinFile!=nullptr) { app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } @@ -774,7 +774,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() wstring otherSkinPath = L""; wstring otherCapePath = L""; - vector<SKIN_BOX *> *othervAdditionalSkinBoxes=NULL; + vector<SKIN_BOX *> *othervAdditionalSkinBoxes=nullptr; wchar_t chars[256]; // turn off all displays @@ -820,10 +820,10 @@ void CScene_SkinSelect::handleSkinIndexChanged() { if(showNext) { - skinFile=NULL; + skinFile=nullptr; m_previewNextControls[i]->SetShow(TRUE); - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { skinFile = m_currentPack->getSkinFile(nextIndex); otherSkinPath = skinFile->getPath(); @@ -835,7 +835,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=NULL; + othervAdditionalSkinBoxes=nullptr; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -867,13 +867,13 @@ void CScene_SkinSelect::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector<ModelPart *> *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==NULL) + if(pAdditionalModelParts==nullptr) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } } // 4J-PB - anim override needs set before SetTexture - if(skinFile!=NULL) + if(skinFile!=nullptr) { app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } @@ -892,10 +892,10 @@ void CScene_SkinSelect::handleSkinIndexChanged() { if(showPrevious) { - skinFile=NULL; + skinFile=nullptr; m_previewPreviousControls[i]->SetShow(TRUE); - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { skinFile = m_currentPack->getSkinFile(previousIndex); otherSkinPath = skinFile->getPath(); @@ -907,7 +907,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=NULL; + othervAdditionalSkinBoxes=nullptr; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -939,7 +939,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector<ModelPart *> *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==NULL) + if(pAdditionalModelParts==nullptr) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } @@ -957,7 +957,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() } // update the tooltips - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNoSkinsToShow) { @@ -1001,10 +1001,10 @@ void CScene_SkinSelect::handlePackIndexChanged() } else { - m_currentPack = NULL; + m_currentPack = nullptr; } m_skinIndex = 0; - if(m_currentPack != NULL) + if(m_currentPack != nullptr) { bool found; DWORD currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); @@ -1021,7 +1021,7 @@ void CScene_SkinSelect::handlePackIndexChanged() DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); if( ugcSkinIndex == 0 ) { - m_skinIndex = (EDefaultSkins) defaultSkinIndex; + m_skinIndex = static_cast<EDefaultSkins>(defaultSkinIndex); } } break; @@ -1199,7 +1199,7 @@ int CScene_SkinSelect::getNextSkinIndex(DWORD sourceIndex) { nextSkin = eDefaultSkins_ServerSelected; } - else if(m_currentPack != NULL && nextSkin>=m_currentPack->getSkinCount()) + else if(m_currentPack != nullptr && nextSkin>=m_currentPack->getSkinCount()) { nextSkin = 0; } @@ -1233,7 +1233,7 @@ int CScene_SkinSelect::getPreviousSkinIndex(DWORD sourceIndex) { previousSkin = eDefaultSkins_Count - 1; } - else if(m_currentPack != NULL) + else if(m_currentPack != nullptr) { previousSkin = m_currentPack->getSkinCount()-1; } @@ -1311,7 +1311,7 @@ void CScene_SkinSelect::updateClipping() int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_SkinSelect* pScene = (CScene_SkinSelect*)pParam; + CScene_SkinSelect* pScene = static_cast<CScene_SkinSelect *>(pParam); #ifdef _XBOX if(result==C4JStorage::EMessage_ResultAccept) { @@ -1320,7 +1320,7 @@ int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMes ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_currentPack->getPurchaseOfferId()); - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -1330,13 +1330,13 @@ int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMes } // If we're in-game, then we need to enable DLC downloads. They'll be set back to Auto on leaving the pause menu - if(Minecraft::GetInstance()->level!=NULL) + if(Minecraft::GetInstance()->level!=nullptr) { // need to allow downloads here, or the player would need to quit the game to let the download of a skin pack happen. This might affect the network traffic, since the download could take all the bandwidth... XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); } - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -1380,7 +1380,7 @@ HRESULT CScene_SkinSelect::OnCustomMessage_DLCMountingComplete() if(app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin)>0) { m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); - if(m_currentPack != NULL) + if(m_currentPack != nullptr) { bool bFound = false; m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; @@ -1400,7 +1400,7 @@ HRESULT CScene_SkinSelect::OnCustomMessage_DLCMountingComplete() updateCurrentFocus(); m_bIgnoreInput=false; app.m_dlcManager.checkForCorruptDLCAndAlert(); - bool bInGame=(Minecraft::GetInstance()->level!=NULL); + bool bInGame=(Minecraft::GetInstance()->level!=nullptr); if(bInGame) XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); |
