diff --git a/Minecraft.Client/ClientConstants.cpp b/Minecraft.Client/ClientConstants.cpp index 41c4b125..0b97664b 100644 --- a/Minecraft.Client/ClientConstants.cpp +++ b/Minecraft.Client/ClientConstants.cpp @@ -1,4 +1,4 @@ #include "stdafx.h" #include "ClientConstants.h" -const wstring ClientConstants::VERSION_STRING = wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING; \ No newline at end of file +const wstring ClientConstants::VERSION_STRING = wstring(L"Minecraft (Whisper LCE Fork) ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING; \ No newline at end of file diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 6baa8e61..db808d94 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -4145,6 +4145,35 @@ void CMinecraftApp::loadMediaArchive() if (!mediapath.empty()) { m_mediaArchive = new ArchiveFile( File(mediapath) ); +#ifdef _WINDOWS64 + + { + + vector* fileList = m_mediaArchive->getFileList(); + + for (AUTO_VAR(it, fileList->begin()); it != fileList->end(); ++it) + + { + + const wstring& name = *it; + + if (name.size() >= 7 && (name.substr(0, 7) == L"dlccape" || name.substr(0, 7) == L"defskin")) + + { + + byteArray data = m_mediaArchive->getFile(name); + + AddMemoryTextureFile(name, data.data, data.length); + + } + + } + + delete fileList; + + } + +#endif } #if 0 string path = "Common\\media.arc"; diff --git a/Minecraft.Client/Common/UI/UI.h b/Minecraft.Client/Common/UI/UI.h index 622ccf84..beb13690 100644 --- a/Minecraft.Client/Common/UI/UI.h +++ b/Minecraft.Client/Common/UI/UI.h @@ -84,6 +84,8 @@ #include "UIScene_SettingsGraphicsMenu.h" #include "UIScene_SettingsUIMenu.h" #include "UIScene_SkinSelectMenu.h" +#include "UIScene_CustomizeCharacterMenu.h" +#include "UIScene_CapeSelectMenu.h" #include "UIScene_HowToPlayMenu.h" #include "UIScene_HowToPlay.h" #include "UIScene_ControlsMenu.h" diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index 544b4da1..4c2e617a 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -68,7 +68,7 @@ void UIControl_PlayerSkinPreview::tick() ++m_framesAnimatingRotation; m_yRot = m_fOriginalRotation + m_framesAnimatingRotation * ( (m_fTargetRotation - m_fOriginalRotation) / CHANGING_SKIN_FRAMES ); - //if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false; + if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false; } else { @@ -150,6 +150,28 @@ void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAni m_fTargetRotation = LOOK_RIGHT_EXTENT; m_bRotatingLeft = true; break; + case e_SkinPreviewFacing_Backward: + m_fTargetRotation = (m_yRot < 0) ? -180.0f : 180.0f; + m_bRotatingLeft = (m_fTargetRotation > 0); + break; + case e_SkinPreviewFacing_BackLeft: + { + float diff = 135.0f - (float)m_yRot; + if(diff > 180.0f) diff -= 360.0f; + if(diff < -180.0f) diff += 360.0f; + m_fTargetRotation = (float)m_yRot + diff; + m_bRotatingLeft = (diff > 0); + } + break; + case e_SkinPreviewFacing_BackRight: + { + float diff = -135.0f - (float)m_yRot; + if(diff > 180.0f) diff -= 360.0f; + if(diff < -180.0f) diff += 360.0f; + m_fTargetRotation = (float)m_yRot + diff; + m_bRotatingLeft = (diff > 0); + } + break; } if(!bAnimate) diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h index a7c3126e..547af2e1 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h @@ -59,6 +59,9 @@ public: e_SkinPreviewFacing_Forward, e_SkinPreviewFacing_Left, e_SkinPreviewFacing_Right, + e_SkinPreviewFacing_Backward, + e_SkinPreviewFacing_BackLeft, + e_SkinPreviewFacing_BackRight, }; UIControl_PlayerSkinPreview(); diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index fa3377eb..667322a5 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -2502,6 +2502,7 @@ unsigned int UIController::GetWinUserIndex() void UIController::ShowUIDebugConsole(bool show) { + printf("ShowUIDebugConsole %d\n", show); #ifndef _CONTENT_PACKAGE if(show) diff --git a/Minecraft.Client/Common/UI/UIEnums.h b/Minecraft.Client/Common/UI/UIEnums.h index c68b6740..cf1a1e7d 100644 --- a/Minecraft.Client/Common/UI/UIEnums.h +++ b/Minecraft.Client/Common/UI/UIEnums.h @@ -80,6 +80,8 @@ enum EUIScene eUIComponent_Chat, eUIScene_ReinstallMenu, eUIScene_SkinSelectMenu, + eUIScene_CustomizeCharacterMenu, + eUIScene_CapeSelectMenu, eUIScene_TextEntry, eUIScene_InGameHostOptionsMenu, eUIScene_InGamePlayerOptionsMenu, diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index e6f87f81..b09f4394 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -279,6 +279,12 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) case eUIScene_SkinSelectMenu: newScene = new UIScene_SkinSelectMenu(iPad, initData, this); break; + case eUIScene_CustomizeCharacterMenu: + newScene = new UIScene_CustomizeCharacterMenu(iPad, initData, this); + break; + case eUIScene_CapeSelectMenu: + newScene = new UIScene_CapeSelectMenu(iPad, initData, this); + break; case eUIScene_HowToPlayMenu: newScene = new UIScene_HowToPlayMenu(iPad, initData, this); break; diff --git a/Minecraft.Client/Common/UI/UIScene_CapeSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CapeSelectMenu.cpp new file mode 100644 index 00000000..79a06307 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_CapeSelectMenu.cpp @@ -0,0 +1,619 @@ +#include "stdafx.h" +#include "UI.h" +#include "UIScene_CapeSelectMenu.h" +#include "..\..\Minecraft.h" +#include "..\..\..\Minecraft.World\StringHelpers.h" +#include "..\..\..\Minecraft.World\Definitions.h" + +// Cape names — index 0 = No Cape, 1-52 correspond to dlccape00000001.png ... dlccape00000052.png +const wchar_t *UIScene_CapeSelectMenu::k_capeNames[UIScene_CapeSelectMenu::k_capeCount] = +{ + L"No Cape", + L"15th Anniversary", + L"MCC 15th Year", + L"Minecraft Experience", + L"MINECON 2011", + L"MINECON 2012", + L"MINECON 2013", + L"MINECON 2015", + L"MINECON 2016", + L"Mojang", + L"Mojang Classic", + L"Mojang Studios", + L"Mojang Office", + L"4J Studios", + L"Microsoft Xbox 360", + L"Xbox 1st Birthday", + L"Founder's", + L"Common", + L"The Pan", + L"Migrator", + L"One Vanilla", + L"Purple Heart", + L"Progress Pride", + L"Cherry Blossom", + L"Follower's", + L"Home", + L"Menace", + L"Yearn", + L"Idaho", + L"Copper", + L"Zombie Horse", + L"Prismarine", + L"Turtle", + L"Birthday", + L"Valentine", + L"Oxeye", + L"Cobalt", + L"Snail", + L"Size M", + L"Scrolls Champion", + L"Millionth Customer", + L"Unidentified", + L"Translator", + L"Chinese Translator", + L"Moderator", + L"Mapmaker", + L"Christmas 2010", + L"New Year's 2011", + L"Bacon", + L"DannyBstyle's", + L"JulianClark's", + L"Cheapsh0t's", + L"MrMessiah's", +}; + +// Maps a default skin carousel index to the corresponding built-in TEXTURE_NAME. +// eDefaultSkins enum: ServerSelected=0, Skin0=1, Skin1=2, ..., Skin7=8 +// This must match UIScene_SkinSelectMenu::getTextureId(). +TEXTURE_NAME UIScene_CapeSelectMenu::getDefaultSkinTexture(int defaultSkinIndex) +{ + switch(defaultSkinIndex) + { + case eDefaultSkins_ServerSelected: + case eDefaultSkins_Skin0: return TN_MOB_CHAR; + case eDefaultSkins_Skin1: return TN_MOB_CHAR1; + case eDefaultSkins_Skin2: return TN_MOB_CHAR2; + case eDefaultSkins_Skin3: return TN_MOB_CHAR3; + case eDefaultSkins_Skin4: return TN_MOB_CHAR4; + case eDefaultSkins_Skin5: return TN_MOB_CHAR5; + case eDefaultSkins_Skin6: return TN_MOB_CHAR6; + case eDefaultSkins_Skin7: return TN_MOB_CHAR7; + default: return TN_MOB_CHAR; + } +} + +// Reads the player's current skin and populates m_currentSkinPath / m_currentSkinTexture +void UIScene_CapeSelectMenu::refreshCurrentSkinTexture() +{ + DWORD dwSkin = app.GetPlayerSkinId(m_iPad); + if(GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin) || GET_UGC_SKIN_ID_FROM_BITMASK(dwSkin) != 0) + { + // DLC or UGC skin — path is in MEM_Files + m_currentSkinPath = app.GetPlayerSkinName(m_iPad); + m_currentSkinTexture = TN_MOB_CHAR; + } + else + { + // Default skin (Steve/Alex/etc.) — use built-in engine texture, no file path + m_currentSkinPath = L""; + m_currentSkinTexture = getDefaultSkinTexture(GET_DEFAULT_SKIN_ID_FROM_BITMASK(dwSkin)); + } +} + +// Returns "dlccapeXXXXXXXX.png" for idx >= 1, or "" for idx == 0 (No Cape) +wstring UIScene_CapeSelectMenu::getCapePathForIndex(int idx) +{ + if(idx <= 0) return L""; + wchar_t buf[32]; + swprintf(buf, 32, L"dlccape%08d.png", idx); + return wstring(buf); +} + +int UIScene_CapeSelectMenu::getNextCapeIndex(int idx) +{ + int size = (int)m_tabs[m_tabIndex].capes.size(); + return (idx + 1) % size; +} + +int UIScene_CapeSelectMenu::getPreviousCapeIndex(int idx) +{ + int size = (int)m_tabs[m_tabIndex].capes.size(); + return (idx + size - 1) % size; +} + +int UIScene_CapeSelectMenu::getNextTabIndex(int idx) const +{ + return (idx + 1) % (int)m_tabs.size(); +} + +int UIScene_CapeSelectMenu::getPreviousTabIndex(int idx) const +{ + return (idx + (int)m_tabs.size() - 1) % (int)m_tabs.size(); +} + +// Build m_tabs from the hardcoded cape list (tab 0) and any DLC skin packs that have capes. +// Called once at construction after DLC is mounted. Fully dynamic — no pack names hardcoded. +void UIScene_CapeSelectMenu::buildTabs() +{ + m_tabs.clear(); + + // Tab 0: "Capes" + { + CapeTab mainTab; + mainTab.packName = L"Capes"; + for(int i = 0; i < k_capeCount; ++i) + { + CapeEntry e; + e.name = k_capeNames[i]; + e.path = getCapePathForIndex(i); + mainTab.capes.push_back(e); + } + m_tabs.push_back(mainTab); + } + + // Tabs 1+: one per DLC skin pack that has at least one capped skin + DWORD packCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin); + for(DWORD p = 0; p < packCount; ++p) + { + DLCPack *pack = app.m_dlcManager.getPack(p, DLCManager::e_DLCType_Skin); + if(!pack) continue; + + CapeTab tab; + tab.packName = pack->getName(); + + // "No Cape" is always the first entry in a pack tab + CapeEntry noCape; + noCape.name = L"No Cape"; + noCape.path = L""; + tab.capes.push_back(noCape); + + DWORD skinCount = pack->getSkinCount(); + for(DWORD s = 0; s < skinCount; ++s) + { + DLCSkinFile *skinFile = pack->getSkinFile(s); + if(!skinFile) continue; + wstring capePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); + if(capePath.empty()) continue; + + CapeEntry e; + wstring skinName = skinFile->getParameterAsString(DLCManager::e_DLCParamType_DisplayName); + e.name = skinName + L"'s Cape"; + e.path = capePath; + tab.capes.push_back(e); + } + + // Only add the tab if at least one skin had a cape + if(tab.capes.size() > 1) + { + m_tabs.push_back(tab); + } + } +} + +// Switch to m_tabIndex, reset to cape 0, refresh display +void UIScene_CapeSelectMenu::handleTabIndexChanged() +{ + m_capeIndex = 0; + handleCapeIndexChanged(); + updateTabDisplay(); +} + +// Set left/centre/right labels for the current tab and its neighbours +void UIScene_CapeSelectMenu::updateTabDisplay() +{ + if(m_tabs.size() <= 1) + { + setLeftLabel(L""); + setRightLabel(L""); + return; + } + setLeftLabel(m_tabs[getPreviousTabIndex(m_tabIndex)].packName); + setRightLabel(m_tabs[getNextTabIndex(m_tabIndex)].packName); +} + +UIScene_CapeSelectMenu::UIScene_CapeSelectMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) +{ + initialiseMovie(); + + m_labelSelected.init( app.GetString(IDS_SELECTED) ); + + m_bSlidingSkins = false; + m_bAnimatingMove = false; + m_bCapeIndexChanged = false; + m_currentNavigation = eCapeNavigation_Cape; + + // Trigger DLC skin loading so pack capes are in m_MEM_Files before buildTabs() + app.StartInstallDLCProcess(m_iPad); + + // Build tab list from hardcoded capes + any DLC skin packs that have capes + buildTabs(); + + // Find the tab and entry that match the player's currently saved cape path + wstring savedCapePath = app.GetPlayerCapeName(m_iPad); + m_tabIndex = 0; + m_capeIndex = 0; + for(int t = 0; t < (int)m_tabs.size(); ++t) + { + for(int c = 0; c < (int)m_tabs[t].capes.size(); ++c) + { + if(m_tabs[t].capes[c].path == savedCapePath) + { + m_tabIndex = t; + m_capeIndex = c; + goto found_saved_cape; + } + } + } + found_saved_cape: + + m_confirmedTabIndex = m_tabIndex; + m_confirmedCapeIndex = m_capeIndex; + refreshCurrentSkinTexture(); + + m_labelCapeName.init(L""); + m_labelSkinOrigin.init(L""); + + m_controlTimer.setVisible(false); + + // Character facing — models face backward so the cape is visible + m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Backward); + + m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackLeft); + m_characters[eCharacter_Next2].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackLeft); + m_characters[eCharacter_Next3].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackLeft); + m_characters[eCharacter_Next4].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackLeft); + + m_characters[eCharacter_Previous1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackRight); + m_characters[eCharacter_Previous2].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackRight); + m_characters[eCharacter_Previous3].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackRight); + m_characters[eCharacter_Previous4].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackRight); + + // Populate the initial preview and tab labels + handleCapeIndexChanged(); + updateTabDisplay(); +} + +wstring UIScene_CapeSelectMenu::getMoviePath() +{ + if(app.GetLocalPlayerCount() > 1) + { + return L"SkinSelectMenuSplit"; + } + else + { + return L"SkinSelectMenu"; + } +} + +void UIScene_CapeSelectMenu::tick() +{ + UIScene::tick(); + + if(m_bCapeIndexChanged) + { + m_bCapeIndexChanged = false; + handleCapeIndexChanged(); + } +} + +void UIScene_CapeSelectMenu::updateTooltips() +{ + ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT_SKIN, IDS_TOOLTIPS_CANCEL, -1, -1, -1, -1, -1, -1, IDS_TOOLTIPS_NAVIGATE ); +} + +void UIScene_CapeSelectMenu::updateComponents() +{ + m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false); +} + +void UIScene_CapeSelectMenu::handleAnimationEnd() +{ + if(m_bSlidingSkins) + { + m_bSlidingSkins = false; + + m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Backward, false); + m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackLeft, false); + m_characters[eCharacter_Previous1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackRight, false); + + m_bCapeIndexChanged = true; + m_bAnimatingMove = false; + } +} + +void UIScene_CapeSelectMenu::handleCapeIndexChanged() +{ + const CapeTab &tab = m_tabs[m_tabIndex]; + bool isConfirmed = (m_tabIndex == m_confirmedTabIndex && m_capeIndex == m_confirmedCapeIndex); + + setCharacterSelected(isConfirmed); + setCharacterLocked(false); + + m_controlSkinNamePlate.setVisible(true); + m_characters[eCharacter_Current].setVisible(true); + + m_characters[eCharacter_Current].SetTexture(m_currentSkinPath, m_currentSkinTexture); + m_characters[eCharacter_Current].SetCapeTexture(tab.capes[m_capeIndex].path); + + // Update adjacent preview slots + int nextIdx = m_capeIndex; + int prevIdx = m_capeIndex; + + for(BYTE i = 0; i < sidePreviewControls; ++i) + { + nextIdx = getNextCapeIndex(nextIdx); + m_characters[eCharacter_Next1 + i].setVisible(true); + m_characters[eCharacter_Next1 + i].SetTexture(m_currentSkinPath, m_currentSkinTexture); + m_characters[eCharacter_Next1 + i].SetCapeTexture(tab.capes[nextIdx].path); + } + + for(BYTE i = 0; i < sidePreviewControls; ++i) + { + prevIdx = getPreviousCapeIndex(prevIdx); + m_characters[eCharacter_Previous1 + i].setVisible(true); + m_characters[eCharacter_Previous1 + i].SetTexture(m_currentSkinPath, m_currentSkinTexture); + m_characters[eCharacter_Previous1 + i].SetCapeTexture(tab.capes[prevIdx].path); + } + + // Name label and centre tab label + m_labelCapeName.init(tab.capes[m_capeIndex].name); + setCentreLabel(tab.packName); +} + +void UIScene_CapeSelectMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) +{ + switch(key) + { + case ACTION_MENU_CANCEL: + if(pressed) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + // Restore the cape to what it was when the menu opened + app.SetPlayerCape(iPad, m_tabs[m_confirmedTabIndex].capes[m_confirmedCapeIndex].path); + app.CheckGameSettingsChanged(true, iPad); + navigateBack(); + } + break; + + case ACTION_MENU_OK: +#ifdef __ORBIS__ + case ACTION_MENU_TOUCHPAD_PRESS: +#endif + if(pressed) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + // Confirm the currently highlighted cape + app.SetPlayerCape(iPad, m_tabs[m_tabIndex].capes[m_capeIndex].path); + app.CheckGameSettingsChanged(true, iPad); + m_confirmedTabIndex = m_tabIndex; + m_confirmedCapeIndex = m_capeIndex; + setCharacterSelected(true); + ui.PlayUISFX(eSFX_Press); + } + break; + + case ACTION_MENU_UP: + case ACTION_MENU_DOWN: + if(pressed && !repeat && m_tabs.size() > 1) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + ui.PlayUISFX(eSFX_Scroll); + m_currentNavigation = (m_currentNavigation == eCapeNavigation_Cape) + ? eCapeNavigation_Tab : eCapeNavigation_Cape; + sendInputToMovie(key, repeat, pressed, released); + } + break; + + case ACTION_MENU_LEFT: + if(pressed) + { + if(m_currentNavigation == eCapeNavigation_Tab) + { + if(!m_bAnimatingMove && m_tabs.size() > 1) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + ui.PlayUISFX(eSFX_Scroll); + m_tabIndex = getPreviousTabIndex(m_tabIndex); + handleTabIndexChanged(); + } + } + else + { + if(!m_bAnimatingMove) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + ui.PlayUISFX(eSFX_Scroll); + + m_capeIndex = getPreviousCapeIndex(m_capeIndex); + + m_bSlidingSkins = true; + m_bAnimatingMove = true; + + m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackLeft, true); + m_characters[eCharacter_Previous1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Backward, true); + + sendInputToMovie(ACTION_MENU_RIGHT, repeat, pressed, released); + } + } + } + break; + + case ACTION_MENU_RIGHT: + if(pressed) + { + if(m_currentNavigation == eCapeNavigation_Tab) + { + if(!m_bAnimatingMove && m_tabs.size() > 1) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + ui.PlayUISFX(eSFX_Scroll); + m_tabIndex = getNextTabIndex(m_tabIndex); + handleTabIndexChanged(); + } + } + else + { + if(!m_bAnimatingMove) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + ui.PlayUISFX(eSFX_Scroll); + + m_capeIndex = getNextCapeIndex(m_capeIndex); + + m_bSlidingSkins = true; + m_bAnimatingMove = true; + + m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_BackRight, true); + m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Backward, true); + + sendInputToMovie(ACTION_MENU_LEFT, repeat, pressed, released); + } + } + } + break; + + case ACTION_MENU_OTHER_STICK_PRESS: + if(pressed) + { + ui.PlayUISFX(eSFX_Press); + m_characters[eCharacter_Current].ResetRotation(); + } + break; + + case ACTION_MENU_OTHER_STICK_LEFT: + if(pressed) + m_characters[eCharacter_Current].m_incYRot = true; + else if(released) + m_characters[eCharacter_Current].m_incYRot = false; + break; + + case ACTION_MENU_OTHER_STICK_RIGHT: + if(pressed) + m_characters[eCharacter_Current].m_decYRot = true; + else if(released) + m_characters[eCharacter_Current].m_decYRot = false; + break; + + case ACTION_MENU_OTHER_STICK_UP: + if(pressed) + m_characters[eCharacter_Current].CyclePreviousAnimation(); + break; + + case ACTION_MENU_OTHER_STICK_DOWN: + if(pressed) + m_characters[eCharacter_Current].CycleNextAnimation(); + break; + } +} + +void UIScene_CapeSelectMenu::customDraw(IggyCustomDrawCallbackRegion *region) +{ + int characterId = -1; + swscanf((wchar_t*)region->name, L"Character%d", &characterId); + if(characterId == -1) + { + app.DebugPrintf("Invalid character to render found\n"); + } + else + { + CustomDrawData *customDrawRegion = ui.setupCustomDraw(this, region); + delete customDrawRegion; + +#ifdef __PS3__ + if(region->stencil_func_ref != 0) RenderManager.StateSetStencil(GL_EQUAL, region->stencil_func_ref, region->stencil_func_mask); +#elif __PSVITA__ + if(region->stencil_func_ref != 0) RenderManager.StateSetStencil(SCE_GXM_STENCIL_FUNC_EQUAL, region->stencil_func_mask, region->stencil_write_mask); +#else + if(region->stencil_func_ref != 0) RenderManager.StateSetStencil(GL_EQUAL, region->stencil_func_ref, region->stencil_func_mask, region->stencil_write_mask); +#endif + m_characters[characterId].render(region); + + ui.endCustomDraw(region); + } +} + +void UIScene_CapeSelectMenu::setCharacterSelected(bool selected) +{ + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = selected; + IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetPlayerCharacterSelected, 1, value); +} + +void UIScene_CapeSelectMenu::setCharacterLocked(bool locked) +{ + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = locked; + IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetCharacterLocked, 1, value); +} + +void UIScene_CapeSelectMenu::setLeftLabel(const wstring &label) +{ + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_string_UTF16; + value[0].string16.string = (IggyUTF16 *)label.c_str(); + value[0].string16.length = (unsigned int)label.length(); + IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetLeftLabel, 1, value); +} + +void UIScene_CapeSelectMenu::setRightLabel(const wstring &label) +{ + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_string_UTF16; + value[0].string16.string = (IggyUTF16 *)label.c_str(); + value[0].string16.length = (unsigned int)label.length(); + IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetRightLabel, 1, value); +} + +void UIScene_CapeSelectMenu::setCentreLabel(const wstring &label) +{ + IggyDataValue result; + IggyDataValue value[1]; + + value[0].type = IGGY_DATATYPE_string_UTF16; + value[0].string16.string = (IggyUTF16 *)label.c_str(); + value[0].string16.length = (unsigned int)label.length(); + IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetCentreLabel, 1, value); +} + +void UIScene_CapeSelectMenu::HandleDLCInstalled() +{ + app.StartInstallDLCProcess(m_iPad); +} + +void UIScene_CapeSelectMenu::HandleDLCMountingComplete() +{ + // DLC skin textures are now in m_MEM_Files — rebuild tabs to pick up newly mounted packs + refreshCurrentSkinTexture(); + buildTabs(); + + // Re-locate the saved cape in the updated tab list + wstring savedCapePath = app.GetPlayerCapeName(m_iPad); + m_tabIndex = 0; + m_capeIndex = 0; + for(int t = 0; t < (int)m_tabs.size(); ++t) + { + for(int c = 0; c < (int)m_tabs[t].capes.size(); ++c) + { + if(m_tabs[t].capes[c].path == savedCapePath) + { + m_tabIndex = t; + m_capeIndex = c; + goto dlc_found_cape; + } + } + } + dlc_found_cape: + + m_confirmedTabIndex = m_tabIndex; + m_confirmedCapeIndex = m_capeIndex; + + handleCapeIndexChanged(); + updateTabDisplay(); +} diff --git a/Minecraft.Client/Common/UI/UIScene_CapeSelectMenu.h b/Minecraft.Client/Common/UI/UIScene_CapeSelectMenu.h new file mode 100644 index 00000000..3fe385af --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_CapeSelectMenu.h @@ -0,0 +1,144 @@ +#pragma once +#include "UIScene.h" +#include "UIControl_PlayerSkinPreview.h" +#include + +class UIScene_CapeSelectMenu : public UIScene +{ +private: + static const int k_capeCount = 53; + static const wchar_t *k_capeNames[k_capeCount]; + + static const BYTE sidePreviewControls = 4; + + struct CapeEntry + { + wstring name; + wstring path; + }; + + struct CapeTab + { + wstring packName; + vector capes; + }; + + enum ECapeNavigation + { + eCapeNavigation_Cape, + eCapeNavigation_Tab, + }; + + enum ECharacters + { + eCharacter_Current, + eCharacter_Next1, + eCharacter_Next2, + eCharacter_Next3, + eCharacter_Next4, + eCharacter_Previous1, + eCharacter_Previous2, + eCharacter_Previous3, + eCharacter_Previous4, + + eCharacter_COUNT, + }; + + UIControl_PlayerSkinPreview m_characters[eCharacter_COUNT]; + UIControl_Label m_labelCapeName; + UIControl_Label m_labelSkinOrigin; + UIControl_Label m_labelSelected; + UIControl m_controlSkinNamePlate, m_controlSelectedPanel, m_controlIggyCharacters, m_controlTimer; + + IggyName m_funcSetPlayerCharacterSelected, m_funcSetCharacterLocked; + IggyName m_funcSetLeftLabel, m_funcSetCentreLabel, m_funcSetRightLabel; + + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_MAP_ELEMENT( m_controlSkinNamePlate, "SkinNamePlate") + UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSkinNamePlate ) + UI_MAP_ELEMENT( m_labelCapeName, "SkinTitle1") + UI_MAP_ELEMENT( m_labelSkinOrigin, "SkinTitle2") + UI_END_MAP_CHILD_ELEMENTS() + + UI_MAP_ELEMENT( m_controlSelectedPanel, "SelectedPanel" ) + UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSelectedPanel ) + UI_MAP_ELEMENT( m_labelSelected, "SelectedPanelLabel" ) + UI_END_MAP_CHILD_ELEMENTS() + + UI_MAP_ELEMENT( m_controlTimer, "Timer" ) + + UI_MAP_ELEMENT( m_controlIggyCharacters, "IggyCharacters" ) + UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlIggyCharacters ) + UI_MAP_ELEMENT( m_characters[eCharacter_Current], "iggy_Character0" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Next1], "iggy_Character1" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Next2], "iggy_Character2" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Next3], "iggy_Character3" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Next4], "iggy_Character4" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Previous1], "iggy_Character5" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Previous2], "iggy_Character6" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Previous3], "iggy_Character7" ) + UI_MAP_ELEMENT( m_characters[eCharacter_Previous4], "iggy_Character8" ) + UI_END_MAP_CHILD_ELEMENTS() + + UI_MAP_NAME( m_funcSetPlayerCharacterSelected, L"SetPlayerCharacterSelected" ) + UI_MAP_NAME( m_funcSetCharacterLocked, L"SetCharacterLocked" ) + UI_MAP_NAME( m_funcSetLeftLabel, L"SetLeftLabel" ) + UI_MAP_NAME( m_funcSetCentreLabel, L"SetCenterLabel" ) + UI_MAP_NAME( m_funcSetRightLabel, L"SetRightLabel" ) + UI_END_MAP_ELEMENTS_AND_NAMES() + + vector m_tabs; + int m_tabIndex; + int m_confirmedTabIndex; + int m_capeIndex; + int m_confirmedCapeIndex; + ECapeNavigation m_currentNavigation; + + wstring m_currentSkinPath; + TEXTURE_NAME m_currentSkinTexture; + bool m_bSlidingSkins; + bool m_bAnimatingMove; + bool m_bCapeIndexChanged; + +public: + UIScene_CapeSelectMenu(int iPad, void *initData, UILayer *parentLayer); + + virtual EUIScene getSceneType() { return eUIScene_CapeSelectMenu; } + + virtual void tick(); + virtual void updateTooltips(); + virtual void updateComponents(); + virtual void handleAnimationEnd(); + virtual void HandleDLCInstalled(); + virtual void HandleDLCMountingComplete(); + +protected: + virtual wstring getMoviePath(); + +public: + virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); + virtual void customDraw(IggyCustomDrawCallbackRegion *region); + +private: + void handleCapeIndexChanged(); + int getNextCapeIndex(int idx); + int getPreviousCapeIndex(int idx); + + void setCharacterSelected(bool selected); + void setCharacterLocked(bool locked); + void setCentreLabel(const wstring &label); + + static wstring getCapePathForIndex(int idx); + static TEXTURE_NAME getDefaultSkinTexture(int defaultSkinIndex); + + void refreshCurrentSkinTexture(); + + void buildTabs(); + void handleTabIndexChanged(); + void updateTabDisplay(); + int getNextTabIndex(int idx) const; + int getPreviousTabIndex(int idx) const; + + void setLeftLabel(const wstring &label); + void setRightLabel(const wstring &label); +}; diff --git a/Minecraft.Client/Common/UI/UIScene_CustomizeCharacterMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CustomizeCharacterMenu.cpp new file mode 100644 index 00000000..6186f134 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_CustomizeCharacterMenu.cpp @@ -0,0 +1,128 @@ +#include "stdafx.h" +#include "UI.h" +#include "UIScene_CustomizeCharacterMenu.h" +#include "..\..\Minecraft.h" + +UIScene_CustomizeCharacterMenu::UIScene_CustomizeCharacterMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) +{ + initialiseMovie(); + + m_buttons[BUTTON_CCM_CHANGESKIN].init(L"Change Skin", BUTTON_CCM_CHANGESKIN); + m_buttons[BUTTON_CCM_CHANGECAPE].init(L"Change Cape", BUTTON_CCM_CHANGECAPE); + + m_buttons[BUTTON_CCM_UNUSED2].init(L"", BUTTON_CCM_UNUSED2); + m_buttons[BUTTON_CCM_UNUSED3].init(L"", BUTTON_CCM_UNUSED3); + m_buttons[BUTTON_CCM_UNUSED4].init(L"", BUTTON_CCM_UNUSED4); + m_buttons[BUTTON_CCM_UNUSED5].init(L"", BUTTON_CCM_UNUSED5); + m_buttons[BUTTON_CCM_UNUSED6].init(L"", BUTTON_CCM_UNUSED6); + + removeControl( &m_buttons[BUTTON_CCM_UNUSED2], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED3], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED4], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED5], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED6], false ); + + doHorizontalResizeCheck(); + + if(!ProfileManager.IsFullVersion()) + { + removeControl( &m_buttons[BUTTON_CCM_CHANGESKIN], false ); + removeControl( &m_buttons[BUTTON_CCM_CHANGECAPE], false ); + } +} + +UIScene_CustomizeCharacterMenu::~UIScene_CustomizeCharacterMenu() +{ +} + +void UIScene_CustomizeCharacterMenu::handleReload() +{ + removeControl( &m_buttons[BUTTON_CCM_UNUSED2], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED3], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED4], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED5], false ); + removeControl( &m_buttons[BUTTON_CCM_UNUSED6], false ); + + doHorizontalResizeCheck(); + + if(!ProfileManager.IsFullVersion()) + { + removeControl( &m_buttons[BUTTON_CCM_CHANGESKIN], false ); + removeControl( &m_buttons[BUTTON_CCM_CHANGECAPE], false ); + } +} + +wstring UIScene_CustomizeCharacterMenu::getMoviePath() +{ + if(app.GetLocalPlayerCount() > 1) + { + return L"HelpAndOptionsMenuSplit"; + } + else + { + return L"HelpAndOptionsMenu"; + } +} + +void UIScene_CustomizeCharacterMenu::updateTooltips() +{ + ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK ); +} + +void UIScene_CustomizeCharacterMenu::updateComponents() +{ + bool bNotInGame = (Minecraft::GetInstance()->level == NULL); + if(bNotInGame) + { + m_parentLayer->showComponent(m_iPad, eUIComponent_Panorama, true); + m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, true); + } + else + { + m_parentLayer->showComponent(m_iPad, eUIComponent_Panorama, false); + + if(app.GetLocalPlayerCount() == 1) m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, true); + else m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false); + } +} + +void UIScene_CustomizeCharacterMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) +{ + ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); + + switch(key) + { + case ACTION_MENU_CANCEL: + if(pressed && !repeat) + { + navigateBack(); + } + break; + case ACTION_MENU_OK: +#ifdef __ORBIS__ + case ACTION_MENU_TOUCHPAD_PRESS: +#endif + if(pressed) + { + ui.PlayUISFX(eSFX_Press); + } + + case ACTION_MENU_UP: + case ACTION_MENU_DOWN: + sendInputToMovie(key, repeat, pressed, released); + break; + } +} + +void UIScene_CustomizeCharacterMenu::handlePress(F64 controlId, F64 childId) +{ + switch((int)controlId) + { + case BUTTON_CCM_CHANGESKIN: + ui.NavigateToScene(m_iPad, eUIScene_SkinSelectMenu); + break; + case BUTTON_CCM_CHANGECAPE: + ui.NavigateToScene(m_iPad, eUIScene_CapeSelectMenu); + break; + } +} diff --git a/Minecraft.Client/Common/UI/UIScene_CustomizeCharacterMenu.h b/Minecraft.Client/Common/UI/UIScene_CustomizeCharacterMenu.h new file mode 100644 index 00000000..4b710080 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_CustomizeCharacterMenu.h @@ -0,0 +1,47 @@ +#pragma once + +#include "UIScene.h" + +#define BUTTON_CCM_CHANGESKIN 0 +#define BUTTON_CCM_CHANGECAPE 1 +#define BUTTON_CCM_UNUSED2 2 +#define BUTTON_CCM_UNUSED3 3 +#define BUTTON_CCM_UNUSED4 4 +#define BUTTON_CCM_UNUSED5 5 +#define BUTTON_CCM_UNUSED6 6 +#define BUTTONS_CCM_MAX 7 + +class UIScene_CustomizeCharacterMenu : public UIScene +{ +private: + UIControl_Button m_buttons[BUTTONS_CCM_MAX]; + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_CHANGESKIN], "Button1") + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_CHANGECAPE], "Button2") + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_UNUSED2], "Button3") + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_UNUSED3], "Button4") + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_UNUSED4], "Button5") + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_UNUSED5], "Button6") + UI_MAP_ELEMENT( m_buttons[BUTTON_CCM_UNUSED6], "Button7") + UI_END_MAP_ELEMENTS_AND_NAMES() + +public: + UIScene_CustomizeCharacterMenu(int iPad, void *initData, UILayer *parentLayer); + virtual ~UIScene_CustomizeCharacterMenu(); + + virtual EUIScene getSceneType() { return eUIScene_CustomizeCharacterMenu; } + + virtual void updateTooltips(); + virtual void updateComponents(); + virtual void handleReload(); + +protected: + virtual wstring getMoviePath(); + +public: + // INPUT + virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); + +protected: + void handlePress(F64 controlId, F64 childId); +}; diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index 3fe03325..60266821 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -10,7 +10,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, m_bNotInGame=(Minecraft::GetInstance()->level==NULL); - m_buttons[BUTTON_HAO_CHANGESKIN].init(app.GetString(IDS_CHANGE_SKIN),BUTTON_HAO_CHANGESKIN); + m_buttons[BUTTON_HAO_CHANGESKIN].init(L"Customize Character",BUTTON_HAO_CHANGESKIN); m_buttons[BUTTON_HAO_HOWTOPLAY].init(app.GetString(IDS_HOW_TO_PLAY),BUTTON_HAO_HOWTOPLAY); m_buttons[BUTTON_HAO_CONTROLS].init(app.GetString(IDS_CONTROLS),BUTTON_HAO_CONTROLS); m_buttons[BUTTON_HAO_SETTINGS].init(app.GetString(IDS_SETTINGS),BUTTON_HAO_SETTINGS); @@ -209,7 +209,7 @@ void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) switch((int)controlId) { case BUTTON_HAO_CHANGESKIN: - ui.NavigateToScene(m_iPad, eUIScene_SkinSelectMenu); + ui.NavigateToScene(m_iPad, eUIScene_CustomizeCharacterMenu); break; case BUTTON_HAO_HOWTOPLAY: ui.NavigateToScene(m_iPad, eUIScene_HowToPlayMenu); diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 6910dd65..71c1cda0 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -229,7 +229,6 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr { case SKIN_SELECT_PACK_DEFAULT: app.SetPlayerSkin(iPad, m_skinIndex); - app.SetPlayerCape(iPad, 0); m_currentSkinPath = app.GetPlayerSkinName(iPad); m_originalSkinId = app.GetPlayerSkinId(iPad); setCharacterSelected(true); @@ -242,13 +241,13 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr wchar_t chars[256]; swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(iPad,m_skinIndex)); - DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); + DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) { DLCSkinFile *skinFile = Pack->getSkinFile(chars); app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); + { wstring _cp = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); if(!_cp.empty()) app.SetPlayerCape(iPad, _cp); } setCharacterSelected(true); m_currentSkinPath = app.GetPlayerSkinName(iPad); m_originalSkinId = app.GetPlayerSkinId(iPad); @@ -373,7 +372,7 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr else { app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); + { wstring _cp = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); if(!_cp.empty()) app.SetPlayerCape(iPad, _cp); } setCharacterSelected(true); m_currentSkinPath = app.GetPlayerSkinName(iPad); m_originalSkinId = app.GetPlayerSkinId(iPad); @@ -590,7 +589,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) { DLCSkinFile *skinFile = Pack->getSkinFile(chars); app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); + { wstring _cp = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); if(!_cp.empty()) app.SetPlayerCape(iPad, _cp); } setCharacterSelected(true); m_currentSkinPath = app.GetPlayerSkinName(iPad); m_originalSkinId = app.GetPlayerSkinId(iPad); @@ -682,7 +681,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) else { app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); + { wstring _cp = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); if(!_cp.empty()) app.SetPlayerCape(iPad, _cp); } setCharacterSelected(true); m_currentSkinPath = app.GetPlayerSkinName(iPad); m_originalSkinId = app.GetPlayerSkinId(iPad); @@ -694,7 +693,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) else { app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); + { wstring _cp = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); if(!_cp.empty()) app.SetPlayerCape(iPad, _cp); } setCharacterSelected(true); m_currentSkinPath = app.GetPlayerSkinName(iPad); m_originalSkinId = app.GetPlayerSkinId(iPad); @@ -885,9 +884,10 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() } m_characters[eCharacter_Current].SetTexture(m_selectedSkinPath, backupTexture); - m_characters[eCharacter_Current].SetCapeTexture(m_selectedCapePath); + wstring playerCapePath = app.GetPlayerCapeName(m_iPad); + m_characters[eCharacter_Current].SetCapeTexture(m_selectedCapePath.empty() ? playerCapePath : m_selectedCapePath); - showNext = TRUE; + showNext = TRUE; showPrevious = TRUE; nextIndex = getNextSkinIndex(m_skinIndex); previousIndex = getPreviousSkinIndex(m_skinIndex); @@ -998,7 +998,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } m_characters[eCharacter_Next1 + i].SetTexture(otherSkinPath, backupTexture); - m_characters[eCharacter_Next1 + i].SetCapeTexture(otherCapePath); + m_characters[eCharacter_Next1 + i].SetCapeTexture(otherCapePath.empty() ? playerCapePath : otherCapePath); } nextIndex = getNextSkinIndex(nextIndex); @@ -1069,7 +1069,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } m_characters[eCharacter_Previous1 + i].SetTexture(otherSkinPath, backupTexture); - m_characters[eCharacter_Previous1 + i].SetCapeTexture(otherCapePath); + m_characters[eCharacter_Previous1 + i].SetCapeTexture(otherCapePath.empty() ? playerCapePath : otherCapePath); } previousIndex = getPreviousSkinIndex(previousIndex); diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index fe5b74b1..c3f7b905 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -77,9 +77,9 @@ GameRenderer::GameRenderer(Minecraft *mc) thirdTilt = 0; thirdTiltO = 0; - accumulatedSmoothXO = 0; + accumulatedSmoothXO = 0; accumulatedSmoothYO = 0; - tickSmoothXO = 0; + tickSmoothXO = 0; tickSmoothYO = 0; lastTickA = 0; @@ -260,19 +260,19 @@ void GameRenderer::tick(bool first) // 4J - add bFirst } } - if (mc->options->smoothCamera) + if (mc->options->smoothCamera) { - // update player view in tick() instead of render() to maintain -// camera movement regardless of FPS - float ss = mc->options->sensitivity * 0.6f + 0.2f; - float sens = (ss * ss * ss) * 8; - tickSmoothXO = smoothTurnX.getNewDeltaValue(accumulatedSmoothXO, 0.05f * sens); - tickSmoothYO = smoothTurnY.getNewDeltaValue(accumulatedSmoothYO, 0.05f * sens); - lastTickA = 0; + // update player view in tick() instead of render() to maintain + // camera movement regardless of FPS + float ss = mc->options->sensitivity * 0.6f + 0.2f; + float sens = (ss * ss * ss) * 8; + tickSmoothXO = smoothTurnX.getNewDeltaValue(accumulatedSmoothXO, 0.05f * sens); + tickSmoothYO = smoothTurnY.getNewDeltaValue(accumulatedSmoothYO, 0.05f * sens); + lastTickA = 0; - accumulatedSmoothXO = 0; - accumulatedSmoothYO = 0; - } + accumulatedSmoothXO = 0; + accumulatedSmoothYO = 0; + } if (mc->cameraTargetPlayer == NULL) { @@ -348,18 +348,18 @@ void GameRenderer::pick(float a) dist = mc->hitResult->pos->distanceTo(from); } - Vec3 *b = mc->cameraTargetPlayer->getViewVector(a); - Vec3 *to = from->add(b->x * range, b->y * range, b->z * range); - hovered = nullptr; - float overlap = 1; - vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); - double nearest = dist; + Vec3 *b = mc->cameraTargetPlayer->getViewVector(a); + Vec3 *to = from->add(b->x * range, b->y * range, b->z * range); + hovered = nullptr; + float overlap = 1; + vector > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); + double nearest = dist; AUTO_VAR(itEnd, objects->end()); for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { - shared_ptr e = *it; //objects->at(i); - if (!e->isPickable()) continue; + shared_ptr e = *it; //objects->at(i); + if (!e->isPickable()) continue; float rr = e->getPickRadius(); AABB *bb = e->bb->grow(rr, rr, rr); @@ -410,10 +410,10 @@ void GameRenderer::tickFov() shared_ptrplayer = dynamic_pointer_cast(mc->cameraTargetPlayer); int playerIdx = player ? player->GetXboxPad() : 0; - tFov[playerIdx] = player->getFieldOfViewModifier(); + tFov[playerIdx] = player->getFieldOfViewModifier(); - oFov[playerIdx] = fov[playerIdx]; - fov[playerIdx] += (tFov[playerIdx] - fov[playerIdx]) * 0.5f; + oFov[playerIdx] = fov[playerIdx]; + fov[playerIdx] += (tFov[playerIdx] - fov[playerIdx]) * 0.5f; } float GameRenderer::getFov(float a, bool applyEffects) @@ -423,11 +423,11 @@ float GameRenderer::getFov(float a, bool applyEffects) shared_ptr player = dynamic_pointer_cast(mc->cameraTargetPlayer); int playerIdx = player ? player->GetXboxPad() : 0; float fov = m_fov;//70; - if (applyEffects) + if (applyEffects) { - fov += mc->options->fov * 40; - fov *= this->oFov[playerIdx] + (this->fov[playerIdx] - this->oFov[playerIdx]) * a; - } + fov += mc->options->fov * 40; + fov *= this->oFov[playerIdx] + (this->fov[playerIdx] - this->oFov[playerIdx]) * a; + } if (player->getHealth() <= 0) { float duration = player->deathTime + a; @@ -435,8 +435,8 @@ float GameRenderer::getFov(float a, bool applyEffects) fov /= ((1 - 500 / (duration + 500)) * 2.0f + 1); } - int t = Camera::getBlockAt(mc->level, player, a); - if (t != 0 && Tile::tiles[t]->material == Material::water) fov = fov * 60 / 70; + int t = Camera::getBlockAt(mc->level, player, a); + if (t != 0 && Tile::tiles[t]->material == Material::water) fov = fov * 60 / 70; return fov + fovOffsetO + (fovOffset - fovOffsetO) * a; @@ -546,6 +546,7 @@ void GameRenderer::moveCameraToPlayer(float a) // Reverse y rotation - note that this is only used in doing collision to calculate our view // distance, the actual rotation itself is just below this else {} block yRot += 180.0f; + xRot = -xRot; // negate pitch so collision matches the flipped camera direction } double xd = -Mth::sin(yRot / 180 * PI) * Mth::cos(xRot / 180 * PI) * cameraDist; @@ -574,11 +575,11 @@ void GameRenderer::moveCameraToPlayer(float a) // 4J - removed extra rotations here that aren't needed because our xRot/yRot don't ever // deviate from the player's view direction -// glRotatef(player->xRot - xRot, 1, 0, 0); -// glRotatef(player->yRot - yRot, 0, 1, 0); + // glRotatef(player->xRot - xRot, 1, 0, 0); + // glRotatef(player->yRot - yRot, 0, 1, 0); glTranslatef(0, 0, (float) -cameraDist); -// glRotatef(yRot - player->yRot, 0, 1, 0); -// glRotatef(xRot - player->xRot, 1, 0, 0); + // glRotatef(yRot - player->yRot, 0, 1, 0); + // glRotatef(xRot - player->xRot, 1, 0, 0); } } else @@ -588,15 +589,18 @@ void GameRenderer::moveCameraToPlayer(float a) if (!mc->options->fixedCamera) { - glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0); + float interpXRot = player->xRotO + (player->xRot - player->xRotO) * a; + float interpYRot = player->yRotO + (player->yRot - player->yRotO) * a; + if( localplayer->ThirdPersonView() == 2 ) { - // Third person view is now 0 for disabled, 1 for original, 2 for flipped - glRotatef(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0); + glRotatef(-interpXRot, 1, 0, 0); // negate pitch for flipped view + glRotatef(interpYRot, 0, 1, 0); } else { - glRotatef(player->yRotO + (player->yRot - player->yRotO) * a + 180, 0, 1, 0); + glRotatef(interpXRot, 1, 0, 0); + glRotatef(interpYRot + 180, 0, 1, 0); } } @@ -626,28 +630,28 @@ void GameRenderer::unZoomRegion() // 4J added as we have more complex adjustments to make for fov & aspect on account of viewports void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, bool applyEffects) { - aspect = mc->width_phys / (float) mc->height_phys; - fov = getFov(a, applyEffects); + aspect = mc->width_phys / (float) mc->height_phys; + fov = getFov(a, applyEffects); - if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP ) || - ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM ) ) - { - aspect *= 2.0f; - fov *= 0.7f; - } - else if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT ) || - ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT) ) - { - aspect *= 0.5f; - } - else - { - const float baseAspect = 16.0f / 9.0f; - const float stuff = 0.5f; - float fovRad = fov * (PI / 180.0f); - float fovFull = (180.0f / PI) * 2.0f * atanf(tanf(fovRad * 0.5f) * (aspect / baseAspect)); - fov = fov + (fovFull - fov) * stuff; - } + if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP ) || + ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM ) ) + { + aspect *= 2.0f; + fov *= 0.7f; + } + else if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT ) || + ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT) ) + { + aspect *= 0.5f; + } + else + { + const float baseAspect = 16.0f / 9.0f; + const float stuff = 0.5f; + float fovRad = fov * (PI / 180.0f); + float fovFull = (180.0f / PI) * 2.0f * atanf(tanf(fovRad * 0.5f) * (aspect / baseAspect)); + fov = fov + (fovFull - fov) * stuff; + } } void GameRenderer::setupCamera(float a, int eye) @@ -670,11 +674,11 @@ void GameRenderer::setupCamera(float a, int eye) } gluPerspective(fov, aspect, 0.05f, renderDistance * 2); - if (mc->gameMode->isCutScene()) + if (mc->gameMode->isCutScene()) { - float s = 1 / 1.5f; - glScalef(1, s, 1); - } + float s = 1 / 1.5f; + glScalef(1, s, 1); + } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -684,7 +688,7 @@ void GameRenderer::setupCamera(float a, int eye) // 4J-PB - this is a per-player option //if (mc->options->bobView) bobView(a); - + bool bNoLegAnim =(mc->player->getAnimOverrideBitmask()&(1<player->getAnimOverrideBitmask()&(1<player->oPortalTime + (mc->player->portalTime - mc->player->oPortalTime) * a; if (pt > 0 && !mc->player->inAetherPortalOverlay) { - int multiplier = 20; - if (mc->player->hasEffect(MobEffect::confusion)) + int multiplier = 20; + if (mc->player->hasEffect(MobEffect::confusion)) { - multiplier = 7; - } + multiplier = 7; + } float skew = 5 / (pt * pt + 5) - pt * 0.04f; skew *= skew; @@ -709,15 +713,15 @@ void GameRenderer::setupCamera(float a, int eye) moveCameraToPlayer(a); - if (cameraFlip > 0) + if (cameraFlip > 0) { - int i = cameraFlip - 1; - if (i == 1) glRotatef(90, 0, 1, 0); - if (i == 2) glRotatef(180, 0, 1, 0); - if (i == 3) glRotatef(-90, 0, 1, 0); - if (i == 4) glRotatef(90, 1, 0, 0); - if (i == 5) glRotatef(-90, 1, 0, 0); - } + int i = cameraFlip - 1; + if (i == 1) glRotatef(90, 0, 1, 0); + if (i == 2) glRotatef(180, 0, 1, 0); + if (i == 3) glRotatef(-90, 0, 1, 0); + if (i == 4) glRotatef(90, 1, 0, 0); + if (i == 5) glRotatef(-90, 1, 0, 0); + } } void GameRenderer::renderItemInHand(float a, int eye) @@ -737,30 +741,30 @@ void GameRenderer::renderItemInHand(float a, int eye) glLoadIdentity(); - float stereoScale = 0.07f; - if (mc->options->anaglyph3d) glTranslatef(-(eye * 2 - 1) * stereoScale, 0, 0); + float stereoScale = 0.07f; + if (mc->options->anaglyph3d) glTranslatef(-(eye * 2 - 1) * stereoScale, 0, 0); // 4J - have split out fov & aspect calculation so we can take into account viewports float fov, aspect; getFovAndAspect(fov, aspect, a, false); - if (zoom != 1) + if (zoom != 1) { - glTranslatef((float) zoom_x, (float) -zoom_y, 0); - glScaled(zoom, zoom, 1); - } - gluPerspective(fov, aspect, 0.05f, renderDistance * 2); + glTranslatef((float) zoom_x, (float) -zoom_y, 0); + glScaled(zoom, zoom, 1); + } + gluPerspective(fov, aspect, 0.05f, renderDistance * 2); - if (mc->gameMode->isCutScene()) + if (mc->gameMode->isCutScene()) { - float s = 1 / 1.5f; - glScalef(1, s, 1); - } + float s = 1 / 1.5f; + glScalef(1, s, 1); + } - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glLoadIdentity(); if (mc->options->anaglyph3d) glTranslatef((eye * 2 - 1) * 0.10f, 0, 0); glPushMatrix(); @@ -801,14 +805,14 @@ void GameRenderer::renderItemInHand(float a, int eye) void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO #if 0 - if (SharedConstants::TEXTURE_LIGHTING) + if (SharedConstants::TEXTURE_LIGHTING) { - glClientActiveTexture(GL_TEXTURE1); - glActiveTexture(GL_TEXTURE1); - glDisable(GL_TEXTURE_2D); - glClientActiveTexture(GL_TEXTURE0); - glActiveTexture(GL_TEXTURE0); - } + glClientActiveTexture(GL_TEXTURE1); + glActiveTexture(GL_TEXTURE1); + glDisable(GL_TEXTURE_2D); + glClientActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0); + } #endif RenderManager.TextureBindVertex(-1); } @@ -817,49 +821,49 @@ void GameRenderer::turnOffLightLayer(double alpha) void GameRenderer::turnOnLightLayer(double alpha) { // 4J - TODO #if 0 - if (SharedConstants::TEXTURE_LIGHTING) + if (SharedConstants::TEXTURE_LIGHTING) { - glClientActiveTexture(GL_TEXTURE1); - glActiveTexture(GL_TEXTURE1); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); -// float s = 1 / 16f / 15.0f*16/14.0f; - float s = 1 / 16.0f / 15.0f * 15 / 16; - glScalef(s, s, s); - glTranslatef(8f, 8f, 8f); - glMatrixMode(GL_MODELVIEW); + glClientActiveTexture(GL_TEXTURE1); + glActiveTexture(GL_TEXTURE1); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + // float s = 1 / 16f / 15.0f*16/14.0f; + float s = 1 / 16.0f / 15.0f * 15 / 16; + glScalef(s, s, s); + glTranslatef(8f, 8f, 8f); + glMatrixMode(GL_MODELVIEW); - mc->textures->bind(lightTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + mc->textures->bind(lightTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glColor4f(1, 1, 1, 1); - glEnable(GL_TEXTURE_2D); - glClientActiveTexture(GL_TEXTURE0); - glActiveTexture(GL_TEXTURE0); - } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glColor4f(1, 1, 1, 1); + glEnable(GL_TEXTURE_2D); + glClientActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0); + } #endif RenderManager.TextureBindVertex(getLightTexture(mc->player->GetXboxPad(), mc->level)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } // 4J - change brought forward from 1.8.2 void GameRenderer::tickLightTexture() { - blrt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); - blgt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); - blrt *= 0.9; - blgt *= 0.9; - blr += (blrt - blr) * 1; - blg += (blgt - blg) * 1; - _updateLightTexture = true; + blrt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); + blgt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); + blrt *= 0.9; + blgt *= 0.9; + blr += (blrt - blr) * 1; + blg += (blgt - blg) * 1; + _updateLightTexture = true; } void GameRenderer::updateLightTexture(float a) @@ -873,7 +877,7 @@ void GameRenderer::updateLightTexture(float a) if (player == NULL) continue; Level *level = player->level; // 4J - was mc->level when it was just to update the one light texture - + float skyDarken1 = level->getSkyDarken((float) 1); for (int i = 0; i < 256; i++) { @@ -1182,7 +1186,7 @@ int GameRenderer::runUpdate(LPVOID lpParam) m_updateEvents->Set(eUpdateCanRun); -// PIXBeginNamedEvent(0,"Updating dirty chunks %d",(count++)&7); + // PIXBeginNamedEvent(0,"Updating dirty chunks %d",(count++)&7); // Update chunks atomically until there aren't any very near ones left - they will be deferred for rendering // until the call to CBuffDeferredModeEnd if we have anything near to render here @@ -1197,8 +1201,8 @@ int GameRenderer::runUpdate(LPVOID lpParam) count++; } while ( shouldContinue && count < MAX_DEFERRED_UPDATES ); -// while( minecraft->levelRenderer->updateDirtyChunks() ) -// ; + // while( minecraft->levelRenderer->updateDirtyChunks() ) + // ; RenderManager.CBuffDeferredModeEnd(); // If any renderable tile entities were flagged in this last block of chunk(s) that were udpated, then change their @@ -1228,8 +1232,8 @@ int GameRenderer::runUpdate(LPVOID lpParam) } m_deleteStackSparseDataStorage.clear(); LeaveCriticalSection(&m_csDeleteStack); - -// PIXEndNamedEvent(); + + // PIXEndNamedEvent(); AABB::resetPool(); Vec3::resetPool(); @@ -1244,9 +1248,9 @@ int GameRenderer::runUpdate(LPVOID lpParam) void GameRenderer::EnableUpdateThread() { -// #ifdef __PS3__ // MGH - disable the update on PS3 for now -// return; -// #endif + // #ifdef __PS3__ // MGH - disable the update on PS3 for now + // return; + // #endif #ifdef MULTITHREAD_ENABLE if( updateRunning) return; app.DebugPrintf("------------------EnableUpdateThread--------------------\n"); @@ -1258,9 +1262,9 @@ void GameRenderer::EnableUpdateThread() void GameRenderer::DisableUpdateThread() { -// #ifdef __PS3__ // MGH - disable the update on PS3 for now -// return; -// #endif + // #ifdef __PS3__ // MGH - disable the update on PS3 for now + // return; + // #endif #ifdef MULTITHREAD_ENABLE if( !updateRunning) return; app.DebugPrintf("------------------DisableUpdateThread--------------------\n"); @@ -1272,7 +1276,7 @@ void GameRenderer::DisableUpdateThread() void GameRenderer::renderLevel(float a, __int64 until) { -// if (updateLightTexture) updateLightTexture(); // 4J - TODO - Java 1.0.1 has this line enabled, should check why - don't want to put it in now in case it breaks split-screen + // if (updateLightTexture) updateLightTexture(); // 4J - TODO - Java 1.0.1 has this line enabled, should check why - don't want to put it in now in case it breaks split-screen glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); @@ -1281,7 +1285,7 @@ void GameRenderer::renderLevel(float a, __int64 until) // going to do for the primary player, and the other players can just view whatever they have loaded in - we're sharing render data between players. bool updateChunks = ( mc->player == mc->localplayers[ProfileManager.GetPrimaryPad()] ); -// if (mc->cameraTargetPlayer == NULL) // 4J - removed condition as we want to update this is mc->player changes for different local players + // if (mc->cameraTargetPlayer == NULL) // 4J - removed condition as we want to update this is mc->player changes for different local players { mc->cameraTargetPlayer = mc->player; } @@ -1329,7 +1333,7 @@ void GameRenderer::renderLevel(float a, __int64 until) PIXBeginNamedEvent(0,"Culling"); MemSect(31); -// Culler *frustum = new FrustumCuller(); + // Culler *frustum = new FrustumCuller(); FrustumCuller frustObj; Culler *frustum = &frustObj; MemSect(0); @@ -1367,7 +1371,7 @@ void GameRenderer::renderLevel(float a, __int64 until) MemSect(0); Lighting::turnOff(); PIXBeginNamedEvent(0,"Level render"); - levelRenderer->render(cameraEntity, 0, a, updateChunks); + levelRenderer->render(cameraEntity, 0, a, updateChunks); PIXEndNamedEvent(); GL11::glShadeModel(GL11::GL_FLAT); @@ -1412,8 +1416,8 @@ void GameRenderer::renderLevel(float a, __int64 until) } } - glDisable(GL_BLEND); - glEnable(GL_CULL_FACE); + glDisable(GL_BLEND); + glEnable(GL_CULL_FACE); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthMask(true); setupFog(0, a); @@ -1483,7 +1487,7 @@ void GameRenderer::renderLevel(float a, __int64 until) levelRenderer->renderDestroyAnimation(Tesselator::getInstance(), dynamic_pointer_cast(cameraEntity), a); glDisable(GL_BLEND); - if (mc->options->isCloudsOn()) + if (mc->options->isCloudsOn()) { glPushMatrix(); setupFog(0, a); @@ -1544,15 +1548,15 @@ void GameRenderer::tickRain() double rainPosZ = 0; int rainPosSamples = 0; - int rainCount = (int) (100 * rainLevel * rainLevel); - if (mc->options->particles == 1) + int rainCount = (int) (100 * rainLevel * rainLevel); + if (mc->options->particles == 1) { - rainCount >>= 1; - } else if (mc->options->particles == 2) + rainCount >>= 1; + } else if (mc->options->particles == 2) { - rainCount = 0; - } - for (int i = 0; i < rainCount; i++) + rainCount = 0; + } + for (int i = 0; i < rainCount; i++) { int x = x0 + random->nextInt(r) - random->nextInt(r); int z = z0 + random->nextInt(r) - random->nextInt(r); @@ -1612,23 +1616,23 @@ void GameRenderer::renderSnowAndRain(float a) this->turnOnLightLayer(a); - if (rainXa == NULL) + if (rainXa == NULL) { - rainXa = new float[32 * 32]; - rainZa = new float[32 * 32]; + rainXa = new float[32 * 32]; + rainZa = new float[32 * 32]; - for (int z = 0; z < 32; z++) + for (int z = 0; z < 32; z++) { - for (int x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { - float xa = x - 16; - float za = z - 16; - float d = Mth::sqrt(xa * xa + za * za); - rainXa[z << 5 | x] = -za / d; - rainZa[z << 5 | x] = xa / d; - } - } - } + float xa = x - 16; + float za = z - 16; + float d = Mth::sqrt(xa * xa + za * za); + rainXa[z << 5 | x] = -za / d; + rainZa[z << 5 | x] = xa / d; + } + } + } shared_ptr player = mc->cameraTargetPlayer; Level *level = mc->level; @@ -1659,35 +1663,35 @@ void GameRenderer::renderSnowAndRain(float a) // 4J - was if(mc.options.fancyGraphics) r = 10; switch( mc->levelRenderer->activePlayers() ) { - case 1: - default: - r = 9; - break; - case 2: - r = 7; - break; - case 3: - r = 5; - break; - case 4: - r = 5; - break; + case 1: + default: + r = 9; + break; + case 2: + r = 7; + break; + case 3: + r = 5; + break; + case 4: + r = 5; + break; } // 4J - some changes made here to access biome through new interface that caches results in levelchunk flags, as an optimisation - - int mode = -1; - float time = _tick + a; - glColor4f(1, 1, 1, 1); + int mode = -1; + float time = _tick + a; + + glColor4f(1, 1, 1, 1); for (int x = x0 - r; x <= x0 + r; x++) for (int z = z0 - r; z <= z0 + r; z++) { - int rainSlot = (z - z0 + 16) * 32 + (x - x0 + 16); - float xa = rainXa[rainSlot] * 0.5f; - float za = rainZa[rainSlot] * 0.5f; - + int rainSlot = (z - z0 + 16) * 32 + (x - x0 + 16); + float xa = rainXa[rainSlot] * 0.5f; + float za = rainZa[rainSlot] * 0.5f; + // 4J - changes here brought forward from 1.8.2 Biome *b = level->getBiome(x, z); if (!b->hasRain() && !b->hasSnow()) continue; @@ -1701,8 +1705,8 @@ void GameRenderer::renderSnowAndRain(float a) if (yy1 < floor) yy1 = floor; float s = 1; - int yl = floor; - if (yl < yMin) yl = yMin; + int yl = floor; + if (yl < yMin) yl = yMin; if (yy0 != yy1) { @@ -1712,13 +1716,13 @@ void GameRenderer::renderSnowAndRain(float a) float temp = b->getTemperature(); if (level->getBiomeSource()->scaleTemp(temp, floor) >= 0.15f) { - if (mode != 0) + if (mode != 0) { - if (mode >= 0) t->end(); - mode = 0; - mc->textures->bindTexture(TN_ENVIRONMENT_RAIN); - t->begin(); - } + if (mode >= 0) t->end(); + mode = 0; + mc->textures->bindTexture(TN_ENVIRONMENT_RAIN); + t->begin(); + } float ra = (((_tick + x * x * 3121 + x * 45238971 + z * z * 418711 + z * 13761) & 31) + a) / 32.0f * (3 + random->nextFloat()); @@ -1726,24 +1730,24 @@ void GameRenderer::renderSnowAndRain(float a) double zd = (z + 0.5f) - player->z; float dd = (float) Mth::sqrt(xd * xd + zd * zd) / r; - float br = 1; - t->offset(-xo * 1, -yo * 1, -zo * 1); + float br = 1; + t->offset(-xo * 1, -yo * 1, -zo * 1); #ifdef __PSVITA__ // AP - this will set up the 4 vertices in half the time float Alpha = ((1 - dd * dd) * 0.5f + 0.5f) * rainLevel; int tex2 = (level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4; t->tileRainQuad(x - xa + 0.5, yy0, z - za + 0.5, 0 * s, yy0 * s / 4.0f + ra * s, - x + xa + 0.5, yy0, z + za + 0.5, 1 * s, yy0 * s / 4.0f + ra * s, - x + xa + 0.5, yy1, z + za + 0.5, 1 * s, yy1 * s / 4.0f + ra * s, - x - xa + 0.5, yy1, z - za + 0.5, 0 * s, yy1 * s / 4.0f + ra * s, - br, br, br, Alpha, br, br, br, 0, tex2); + x + xa + 0.5, yy0, z + za + 0.5, 1 * s, yy0 * s / 4.0f + ra * s, + x + xa + 0.5, yy1, z + za + 0.5, 1 * s, yy1 * s / 4.0f + ra * s, + x - xa + 0.5, yy1, z - za + 0.5, 0 * s, yy1 * s / 4.0f + ra * s, + br, br, br, Alpha, br, br, br, 0, tex2); #else - t->tex2(level->getLightColor(x, yl, z, 0)); - t->color(br, br, br, ((1 - dd * dd) * 0.5f + 0.5f) * rainLevel); - t->vertexUV(x - xa + 0.5, yy0, z - za + 0.5, 0 * s, yy0 * s / 4.0f + ra * s); - t->vertexUV(x + xa + 0.5, yy0, z + za + 0.5, 1 * s, yy0 * s / 4.0f + ra * s); + t->tex2(level->getLightColor(x, yl, z, 0)); + t->color(br, br, br, ((1 - dd * dd) * 0.5f + 0.5f) * rainLevel); + t->vertexUV(x - xa + 0.5, yy0, z - za + 0.5, 0 * s, yy0 * s / 4.0f + ra * s); + t->vertexUV(x + xa + 0.5, yy0, z + za + 0.5, 1 * s, yy0 * s / 4.0f + ra * s); t->color(br, br, br, 0.0f); // 4J - added to soften the top visible edge of the rain - t->vertexUV(x + xa + 0.5, yy1, z + za + 0.5, 1 * s, yy1 * s / 4.0f + ra * s); + t->vertexUV(x + xa + 0.5, yy1, z + za + 0.5, 1 * s, yy1 * s / 4.0f + ra * s); t->vertexUV(x - xa + 0.5, yy1, z - za + 0.5, 0 * s, yy1 * s / 4.0f + ra * s); #endif t->offset(0, 0, 0); @@ -1751,66 +1755,66 @@ void GameRenderer::renderSnowAndRain(float a) } else { - if (mode != 1) + if (mode != 1) { - if (mode >= 0) t->end(); - mode = 1; - mc->textures->bindTexture(TN_ENVIRONMENT_SNOW); - t->begin(); - } - float ra = (((_tick) & 511) + a) / 512.0f; - float uo = random->nextFloat() + time * 0.01f * (float) random->nextGaussian(); - float vo = random->nextFloat() + time * (float) random->nextGaussian() * 0.001f; - double xd = (x + 0.5f) - player->x; - double zd = (z + 0.5f) - player->z; - float dd = (float) sqrt(xd * xd + zd * zd) / r; - float br = 1; - t->offset(-xo * 1, -yo * 1, -zo * 1); + if (mode >= 0) t->end(); + mode = 1; + mc->textures->bindTexture(TN_ENVIRONMENT_SNOW); + t->begin(); + } + float ra = (((_tick) & 511) + a) / 512.0f; + float uo = random->nextFloat() + time * 0.01f * (float) random->nextGaussian(); + float vo = random->nextFloat() + time * (float) random->nextGaussian() * 0.001f; + double xd = (x + 0.5f) - player->x; + double zd = (z + 0.5f) - player->z; + float dd = (float) sqrt(xd * xd + zd * zd) / r; + float br = 1; + t->offset(-xo * 1, -yo * 1, -zo * 1); #ifdef __PSVITA__ // AP - this will set up the 4 vertices in half the time float Alpha = ((1 - dd * dd) * 0.3f + 0.5f) * rainLevel; int tex2 = (level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4; t->tileRainQuad(x - xa + 0.5, yy0, z - za + 0.5, 0 * s + uo, yy0 * s / 4.0f + ra * s + vo, - x + xa + 0.5, yy0, z + za + 0.5, 1 * s + uo, yy0 * s / 4.0f + ra * s + vo, - x + xa + 0.5, yy1, z + za + 0.5, 1 * s + uo, yy1 * s / 4.0f + ra * s + vo, - x - xa + 0.5, yy1, z - za + 0.5, 0 * s + uo, yy1 * s / 4.0f + ra * s + vo, - br, br, br, Alpha, br, br, br, Alpha, tex2); + x + xa + 0.5, yy0, z + za + 0.5, 1 * s + uo, yy0 * s / 4.0f + ra * s + vo, + x + xa + 0.5, yy1, z + za + 0.5, 1 * s + uo, yy1 * s / 4.0f + ra * s + vo, + x - xa + 0.5, yy1, z - za + 0.5, 0 * s + uo, yy1 * s / 4.0f + ra * s + vo, + br, br, br, Alpha, br, br, br, Alpha, tex2); #else - t->tex2((level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4); - t->color(br, br, br, ((1 - dd * dd) * 0.3f + 0.5f) * rainLevel); - t->vertexUV(x - xa + 0.5, yy0, z - za + 0.5, 0 * s + uo, yy0 * s / 4.0f + ra * s + vo); - t->vertexUV(x + xa + 0.5, yy0, z + za + 0.5, 1 * s + uo, yy0 * s / 4.0f + ra * s + vo); - t->vertexUV(x + xa + 0.5, yy1, z + za + 0.5, 1 * s + uo, yy1 * s / 4.0f + ra * s + vo); - t->vertexUV(x - xa + 0.5, yy1, z - za + 0.5, 0 * s + uo, yy1 * s / 4.0f + ra * s + vo); + t->tex2((level->getLightColor(x, yl, z, 0) * 3 + 0xf000f0) / 4); + t->color(br, br, br, ((1 - dd * dd) * 0.3f + 0.5f) * rainLevel); + t->vertexUV(x - xa + 0.5, yy0, z - za + 0.5, 0 * s + uo, yy0 * s / 4.0f + ra * s + vo); + t->vertexUV(x + xa + 0.5, yy0, z + za + 0.5, 1 * s + uo, yy0 * s / 4.0f + ra * s + vo); + t->vertexUV(x + xa + 0.5, yy1, z + za + 0.5, 1 * s + uo, yy1 * s / 4.0f + ra * s + vo); + t->vertexUV(x - xa + 0.5, yy1, z - za + 0.5, 0 * s + uo, yy1 * s / 4.0f + ra * s + vo); #endif - t->offset(0, 0, 0); - } + t->offset(0, 0, 0); + } } } - if( mode >= 0 ) t->end(); - glEnable(GL_CULL_FACE); - glDisable(GL_BLEND); - glAlphaFunc(GL_GREATER, 0.1f); - this->turnOffLightLayer(a); + if( mode >= 0 ) t->end(); + glEnable(GL_CULL_FACE); + glDisable(GL_BLEND); + glAlphaFunc(GL_GREATER, 0.1f); + this->turnOffLightLayer(a); - RenderManager.StateSetEnableViewportClipPlanes(false); + RenderManager.StateSetEnableViewportClipPlanes(false); } // 4J - added forceScale parameter void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) { - ScreenSizeCalculator ssc(mc->options, mc->width, mc->height, forceScale); + ScreenSizeCalculator ssc(mc->options, mc->width, mc->height, forceScale); - glViewport(0, 0, mc->width, mc->height); // ADD THIS LINE + glViewport(0, 0, mc->width, mc->height); // ADD THIS LINE - glClear(GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, (float)ssc.rawWidth, (float)ssc.rawHeight, 0, 1000, 3000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -2000); + glClear(GL_DEPTH_BUFFER_BIT); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, (float)ssc.rawWidth, (float)ssc.rawHeight, 0, 1000, 3000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0, 0, -2000); } void GameRenderer::setupClearColor(float a) @@ -1831,23 +1835,23 @@ void GameRenderer::setupClearColor(float a) fg = (float) fogColor->y; fb = (float) fogColor->z; - if (mc->options->viewDistance < 2) + if (mc->options->viewDistance < 2) { Vec3 *sunAngle = Mth::sin(level->getSunAngle(a)) > 0 ? Vec3::newTemp(-1, 0, 0) : Vec3::newTemp(1, 0, 0); - float d = (float) player->getViewVector(a)->dot(sunAngle); - if (d < 0) d = 0; - if (d > 0) + float d = (float) player->getViewVector(a)->dot(sunAngle); + if (d < 0) d = 0; + if (d > 0) { - float *c = level->dimension->getSunriseColor(level->getTimeOfDay(a), a); - if (c != NULL) + float *c = level->dimension->getSunriseColor(level->getTimeOfDay(a), a); + if (c != NULL) { - d *= c[3]; - fr = fr * (1 - d) + c[0] * d; - fg = fg * (1 - d) + c[1] * d; - fb = fb * (1 - d) + c[2] * d; - } - } - } + d *= c[3]; + fr = fr * (1 - d) + c[0] * d; + fg = fg * (1 - d) + c[1] * d; + fb = fb * (1 - d) + c[2] * d; + } + } + } fr += (sr - fr) * whiteness; fg += (sg - fg) * whiteness; @@ -1881,7 +1885,7 @@ void GameRenderer::setupClearColor(float a) } else if (t != 0 && Tile::tiles[t]->material == Material::water) { - + unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Clear_Colour ); byte redComponent = ((colour>>16)&0xFF); byte greenComponent = ((colour>>8)&0xFF); @@ -1893,7 +1897,7 @@ void GameRenderer::setupClearColor(float a) } else if (t != 0 && Tile::tiles[t]->material == Material::lava) { - + unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Clear_Colour ); byte redComponent = ((colour>>16)&0xFF); byte greenComponent = ((colour>>8)&0xFF); @@ -1909,29 +1913,29 @@ void GameRenderer::setupClearColor(float a) fg *= brr; fb *= brr; - double yy = (player->yOld + (player->y - player->yOld) * a) * level->dimension->getClearColorScale(); // 4J - getClearColorScale brought forward from 1.2.3 + double yy = (player->yOld + (player->y - player->yOld) * a) * level->dimension->getClearColorScale(); // 4J - getClearColorScale brought forward from 1.2.3 - if (player->hasEffect(MobEffect::blindness)) + if (player->hasEffect(MobEffect::blindness)) { - int duration = player->getEffect(MobEffect::blindness)->getDuration(); - if (duration < 20) + int duration = player->getEffect(MobEffect::blindness)->getDuration(); + if (duration < 20) { - yy = yy * (1.0f - (float) duration / 20.0f); - } + yy = yy * (1.0f - (float) duration / 20.0f); + } else { - yy = 0; - } - } + yy = 0; + } + } - if (yy < 1) + if (yy < 1) { - if (yy < 0) yy = 0; - yy = yy * yy; - fr *= yy; - fg *= yy; - fb *= yy; - } + if (yy < 0) yy = 0; + yy = yy * yy; + fr *= yy; + fg *= yy; + fb *= yy; + } if (player->hasEffect(MobEffect::nightVision)) { @@ -1976,68 +1980,68 @@ void GameRenderer::setupFog(int i, float alpha) shared_ptr player = mc->cameraTargetPlayer; // 4J - check for creative mode brought forward from 1.2.3 - bool creative = false; - if (dynamic_pointer_cast(player) ) + bool creative = false; + if (dynamic_pointer_cast(player) ) { - creative = (dynamic_pointer_cast(player))->abilities.instabuild; - } + creative = (dynamic_pointer_cast(player))->abilities.instabuild; + } - if (i == 999) + if (i == 999) { __debugbreak(); // 4J TODO /* - glFog(GL_FOG_COLOR, getBuffer(0, 0, 0, 1)); - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_START, 0); - glFogf(GL_FOG_END, 8); + glFog(GL_FOG_COLOR, getBuffer(0, 0, 0, 1)); + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogf(GL_FOG_START, 0); + glFogf(GL_FOG_END, 8); - if (GLContext.getCapabilities().GL_NV_fog_distance) { - glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); - } + if (GLContext.getCapabilities().GL_NV_fog_distance) { + glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); + } - glFogf(GL_FOG_START, 0); + glFogf(GL_FOG_START, 0); */ - return; - } + return; + } glFog(GL_FOG_COLOR, getBuffer(fr, fg, fb, 1)); glNormal3f(0, -1, 0); glColor4f(1, 1, 1, 1); - int t = Camera::getBlockAt(mc->level, player, alpha); + int t = Camera::getBlockAt(mc->level, player, alpha); - if (player->hasEffect(MobEffect::blindness)) + if (player->hasEffect(MobEffect::blindness)) { - float distance = 5.0f; - int duration = player->getEffect(MobEffect::blindness)->getDuration(); - if (duration < 20) + float distance = 5.0f; + int duration = player->getEffect(MobEffect::blindness)->getDuration(); + if (duration < 20) { - distance = 5.0f + (renderDistance - 5.0f) * (1.0f - (float) duration / 20.0f); - } + distance = 5.0f + (renderDistance - 5.0f) * (1.0f - (float) duration / 20.0f); + } - glFogi(GL_FOG_MODE, GL_LINEAR); - if (i < 0) + glFogi(GL_FOG_MODE, GL_LINEAR); + if (i < 0) { - glFogf(GL_FOG_START, 0); - glFogf(GL_FOG_END, distance * 0.8f); - } + glFogf(GL_FOG_START, 0); + glFogf(GL_FOG_END, distance * 0.8f); + } else { - glFogf(GL_FOG_START, distance * 0.25f); - glFogf(GL_FOG_END, distance); - } + glFogf(GL_FOG_START, distance * 0.25f); + glFogf(GL_FOG_END, distance); + } // 4J - TODO investigate implementing this -// if (GLContext.getCapabilities().GL_NV_fog_distance) -// { -// glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); -// } - } + // if (GLContext.getCapabilities().GL_NV_fog_distance) + // { + // glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); + // } + } else if (isInClouds) { glFogi(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06 - + unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_In_Cloud_Fog_Colour ); byte redComponent = ((colour>>16)&0xFF); byte greenComponent = ((colour>>8)&0xFF); @@ -2069,7 +2073,7 @@ void GameRenderer::setupFog(int i, float alpha) { glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06 } - + unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Fog_Colour ); byte redComponent = ((colour>>16)&0xFF); byte greenComponent = ((colour>>8)&0xFF); @@ -2094,7 +2098,7 @@ void GameRenderer::setupFog(int i, float alpha) { glFogi(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, 2.0f); // was 0.06 - + unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Fog_Colour ); byte redComponent = ((colour>>16)&0xFF); byte greenComponent = ((colour>>8)&0xFF); @@ -2117,7 +2121,7 @@ void GameRenderer::setupFog(int i, float alpha) } else { - float distance = renderDistance; + float distance = renderDistance; if (!mc->level->dimension->hasCeiling) { // 4J - test for doing bedrockfog brought forward from 1.2.3 @@ -2142,16 +2146,16 @@ void GameRenderer::setupFog(int i, float alpha) { glFogf(GL_FOG_START, 0); glFogf(GL_FOG_END, distance * 0.8f); - } + } else { glFogf(GL_FOG_START, distance * 0.25f); glFogf(GL_FOG_END, distance); - } + } /* 4J - removed - TODO investigate if (GLContext.getCapabilities().GL_NV_fog_distance) { - glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); + glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); } */ @@ -2185,5 +2189,5 @@ int GameRenderer::getFpsCap(int option) void GameRenderer::updateAllChunks() { -// mc->levelRenderer->updateDirtyChunks(mc->cameraTargetPlayer, true); -} + // mc->levelRenderer->updateDirtyChunks(mc->cameraTargetPlayer, true); +} \ No newline at end of file diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index 444d9c90..7c3bc7d6 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -125,18 +125,42 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight) m_uiAnimOverrideBitmask = 0L; } +void HumanoidModel::_reinit(int newTexWidth, int newTexHeight) +{ + if (newTexWidth == texWidth && newTexHeight == texHeight) + return; + + app.DebugPrintf("HumanoidModel::ReinitIfDifferentSize - Reinitialising from (%d x %d) to (%d x %d)\n", + texWidth, texHeight, newTexWidth, newTexHeight); + + delete cloak; cloak = nullptr; + delete ear; ear = nullptr; + delete head; head = nullptr; + delete hair; hair = nullptr; + delete body; body = nullptr; + delete arm0; arm0 = nullptr; + delete arm1; arm1 = nullptr; + delete leg0; leg0 = nullptr; + delete leg1; leg1 = nullptr; + + _init(0, m_fYOffset, newTexWidth, newTexHeight); +} + HumanoidModel::HumanoidModel() : Model() { + printf("HumanoidModel::HumanoidModel\n"); _init(0, 0, 64, 32); } HumanoidModel::HumanoidModel(float g) : Model() { + printf("HumanoidModel::HumanoidModel float g\n"); _init(g, 0, 64, 32); } HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight) : Model() { + printf("HumanoidModel::HumanoidModel texWidth, texHeight\n"); _init(g,yOffset,texWidth,texHeight); } diff --git a/Minecraft.Client/HumanoidModel.h b/Minecraft.Client/HumanoidModel.h index 0ca10f4b..5a7390c2 100644 --- a/Minecraft.Client/HumanoidModel.h +++ b/Minecraft.Client/HumanoidModel.h @@ -50,6 +50,7 @@ public: void _init(float g, float yOffset, int texWidth, int texHeight); // 4J added + void _reinit(int newTexWidth, int newTexHeight); // fixes 64x64 skins HumanoidModel(); HumanoidModel(float g); HumanoidModel(float g, float yOffset, int texWidth, int texHeight); diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 0f9fcc42..36094339 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -4363,6 +4363,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU + + @@ -21537,6 +21539,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU + + diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters index fb8f26e4..95a3b2ba 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj.filters +++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters @@ -3669,6 +3669,12 @@ Header Files + + Header Files + + + Header Files + @@ -5738,6 +5744,12 @@ Source Files + + Source Files + + + Source Files + diff --git a/Minecraft.Client/Windows64/GameHDD/20260305232235/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260305232235/saveData.ms new file mode 100644 index 00000000..1eb67a9b Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260305232235/saveData.ms differ diff --git a/Minecraft.Client/Windows64/GameHDD/20260305232510/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260305232510/saveData.ms new file mode 100644 index 00000000..16d9c023 Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260305232510/saveData.ms differ diff --git a/Minecraft.Client/Windows64/GameHDD/20260305233720/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260305233720/saveData.ms new file mode 100644 index 00000000..05ea5785 Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260305233720/saveData.ms differ diff --git a/Minecraft.Client/Windows64/GameHDD/20260305233906/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260305233906/saveData.ms new file mode 100644 index 00000000..19cbbb4f Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260305233906/saveData.ms differ