diff --git a/Minecraft.Client/Chunk.cpp b/Minecraft.Client/Chunk.cpp index 4d0d3c1f..bda5b4cf 100644 --- a/Minecraft.Client/Chunk.cpp +++ b/Minecraft.Client/Chunk.cpp @@ -211,7 +211,7 @@ void Chunk::rebuild() int r = 1; - int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 2; + int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 3; lists += levelRenderer->chunkLists; PIXEndNamedEvent(); @@ -235,7 +235,7 @@ void Chunk::rebuild() if( sourceChunk == nullptr ) { // Level chunk not loaded yet - treat as empty - for (int currentLayer = 0; currentLayer < 2; currentLayer++) + for (int currentLayer = 0; currentLayer < 3; currentLayer++) { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); RenderManager.CBuffClear(lists + currentLayer); @@ -339,7 +339,7 @@ void Chunk::rebuild() if( empty ) { // 4J - added - clear any renderer data associated with this - for (int currentLayer = 0; currentLayer < 2; currentLayer++) + for (int currentLayer = 0; currentLayer < 3; currentLayer++) { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); RenderManager.CBuffClear(lists + currentLayer); @@ -381,7 +381,7 @@ void Chunk::rebuild() bounds.boundingBox[4] = SIZE+g; bounds.boundingBox[5] = XZSIZE+g; } - for (int currentLayer = 0; currentLayer < 2; currentLayer++) + for (int currentLayer = 0; currentLayer < 3; currentLayer++) { bool renderNextLayer = false; bool rendered = false; @@ -498,10 +498,15 @@ void Chunk::rebuild() } if((currentLayer==0)&&(!renderNextLayer)) { - levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1); - RenderManager.CBuffClear(lists + 1); + levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1 | LevelRenderer::CHUNK_FLAG_NOTSKYLIT); + RenderManager.CBuffClear(lists + 2); break; } + if((currentLayer==2)&&(!renderNextLayer)) + { + levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_NOTSKYLIT); + RenderManager.CBuffClear(lists + 2); + } } // 4J MGH - added this to take the bound from the value calc'd in the tesselator @@ -627,15 +632,6 @@ void Chunk::rebuild() #endif // 4J - These removed items are now also removed from globalRenderableTileEntities - - if( LevelChunk::touchedSky ) - { - levelRenderer->clearGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_NOTSKYLIT); - } - else - { - levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_NOTSKYLIT); - } levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_COMPILED); PIXEndNamedEvent(); return; @@ -724,7 +720,7 @@ void Chunk::rebuild_SPU() bounds.boundingBox[5] = SIZE+g; } - for (int currentLayer = 0; currentLayer < 2; currentLayer++) + for (int currentLayer = 0; currentLayer < 3; currentLayer++) { bool rendered = false; @@ -990,11 +986,11 @@ void Chunk::reset() // printf("\t\t [dec] refcount %d at %d, %d, %d\n",refCount,x,y,z); if( refCount == 0 ) { - int lists = levelRenderer->getGlobalIndexForChunk(x, y, z, level) * 2; + int lists = levelRenderer->getGlobalIndexForChunk(x, y, z, level) * 3; if(lists >= 0) { lists += levelRenderer->chunkLists; - for (int i = 0; i < 2; i++) + for (int i = 0; i < 3; i++) { // 4J - added - clear any renderer data associated with this unused list RenderManager.CBuffClear(lists + i); @@ -1018,7 +1014,7 @@ int Chunk::getList(int layer) { if (!clipChunk->visible) return -1; - int lists = levelRenderer->getGlobalIndexForChunk(x, y, z,level) * 2; + int lists = levelRenderer->getGlobalIndexForChunk(x, y, z,level) * 3; lists += levelRenderer->chunkLists; bool empty = levelRenderer->getGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, layer); diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 325e949b..a80af5d2 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -4036,6 +4036,8 @@ void ClientConnection::handleSetPlayerTeamPacket(shared_ptr void ClientConnection::handleParticleEvent(shared_ptr packet) { + ePARTICLE_TYPE particleId = (ePARTICLE_TYPE)Integer::parseInt(packet->getName()); + for (int i = 0; i < packet->getCount(); i++) { double xVarience = random->nextGaussian() * packet->getXDist(); @@ -4045,10 +4047,6 @@ void ClientConnection::handleParticleEvent(shared_ptr pack double ya = random->nextGaussian() * packet->getMaxSpeed(); double za = random->nextGaussian() * packet->getMaxSpeed(); - // TODO: determine particle ID from name - assert(0); - ePARTICLE_TYPE particleId = eParticleType_heart; - level->addParticle(particleId, packet->getX() + xVarience, packet->getY() + yVarience, packet->getZ() + zVarience, xa, ya, za); } } diff --git a/Minecraft.Client/Common/App_Defines.h b/Minecraft.Client/Common/App_Defines.h index 7e96896c..fac503ec 100644 --- a/Minecraft.Client/Common/App_Defines.h +++ b/Minecraft.Client/Common/App_Defines.h @@ -104,6 +104,7 @@ enum EGameHostOptionWorldSize #define GAMESETTING_ANIMATEDCHARACTER 0x00008000 #define GAMESETTING_PS3EULAREAD 0x00010000 #define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 +#define GAMESETTING_OLDSWINGANIMATION 0x04000000 // defines for languages diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index 15a17978..c330a135 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -145,6 +145,8 @@ enum eGameSetting eGameSetting_ControlSouthPaw, eGameSetting_SplitScreenVertical, eGameSetting_GamertagsVisible, + eGameSetting_OldSwingAnimation, + eGameSetting_GraphicsMode, // Interim TU 1.6.6 eGameSetting_Autosave, eGameSetting_DisplaySplitscreenGamertags, diff --git a/Minecraft.Client/Common/App_structs.h b/Minecraft.Client/Common/App_structs.h index 6a6e0354..74a4e825 100644 --- a/Minecraft.Client/Common/App_structs.h +++ b/Minecraft.Client/Common/App_structs.h @@ -33,7 +33,7 @@ typedef struct unsigned char ucSoundFXVolume; unsigned char ucSensitivity; unsigned char ucGamma; - unsigned char ucPad01; // 1 byte of padding inserted here + unsigned char ucGraphicsMode; unsigned short usBitmaskValues; // bit 0,1 - difficulty // bit 2 - view bob // bit 3 - player visible in a map diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index 0b515fe2..b138b1a6 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -701,6 +701,9 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) float finalVolume = volume * m_MasterEffectsVolume; if (finalVolume > 1.0f) finalVolume = 1.0f; + + finalVolume *= 0.75f; + printf("UI Sound volume set to %f\nEffects volume: %f\n", finalVolume, m_MasterEffectsVolume); ma_sound_set_volume(&s->sound, finalVolume); diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 62ed019a..198a090f 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -931,6 +931,10 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con // PS3DEC13 SetGameSettings(iPad,eGameSetting_PS3_EULA_Read,0); // EULA not read + // New + SetGameSettings(iPad,eGameSetting_GraphicsMode,2); + SetGameSettings(iPad,eGameSetting_OldSwingAnimation,0); + // PS3 1.05 - added Greek // 4J-JEV: We cannot change these in-game, as they could affect localised strings and font. @@ -1075,6 +1079,7 @@ int CMinecraftApp::OldProfileVersionCallback(LPVOID pParam,unsigned char *pucDat pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on + pGameSettings->uiBitmaskValues|=GAMESETTING_OLDSWINGANIMATION; //eGameSetting_OldSwingAnimation - off // TU12 // favorite skins added, but only set in TU12 - set to FFs for(int i=0;iucGraphicsMode; + + if (graphicsLevel == 0) + { + pMinecraft->options->set(Options::Option::GRAPHICS, false); + pMinecraft->options->set(Options::Option::AMBIENT_OCCLUSION, false); + pMinecraft->options->set(Options::Option::PARTICLES, 2); + } + else if (graphicsLevel == 1) + { + pMinecraft->options->set(Options::Option::GRAPHICS, false); + pMinecraft->options->set(Options::Option::AMBIENT_OCCLUSION, true); + pMinecraft->options->set(Options::Option::PARTICLES, 1); + } + else + { + pMinecraft->options->set(Options::Option::GRAPHICS, true); + pMinecraft->options->set(Options::Option::AMBIENT_OCCLUSION, true); + pMinecraft->options->set(Options::Option::PARTICLES, 0); + } + + if (pMinecraft && pMinecraft->levelRenderer && pMinecraft->level) + { + pMinecraft->levelRenderer->allChanged(); + } + } + break; } } @@ -2113,7 +2153,6 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV } break; - case eGameSetting_Online: if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_ONLINE)!=(ucVal&0x01)<<1) { @@ -2328,6 +2367,33 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV } break; + case eGameSetting_OldSwingAnimation: + if(((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_OLDSWINGANIMATION) != 0) != ((ucVal & 0x01) != 0)) + { + if(ucVal==1) + { + GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_OLDSWINGANIMATION; + } + else + { + GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_OLDSWINGANIMATION; + } + ActionGameSettings(iPad,eVal); + GameSettingsA[iPad]->bSettingsChanged=true; + } + + break; + case eGameSetting_GraphicsMode: + if(GameSettingsA[iPad]->ucGraphicsMode != ucVal) + { + GameSettingsA[iPad]->ucGraphicsMode = ucVal; + if(iPad == ProfileManager.GetPrimaryPad()) + { + ActionGameSettings(iPad, eVal); + } + GameSettingsA[iPad]->bSettingsChanged = true; + } + break; } } @@ -2462,7 +2528,12 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal) case eGameSetting_PSVita_NetworkModeAdhoc: return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17; - + case eGameSetting_OldSwingAnimation: + return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_OLDSWINGANIMATION) >> 26; + break; + case eGameSetting_GraphicsMode: + return GameSettingsA[iPad]->ucGraphicsMode; + break; } return 0; } diff --git a/Minecraft.Client/Common/Media/SettingsGraphicsMenu1080.swf b/Minecraft.Client/Common/Media/SettingsGraphicsMenu1080.swf index 2495b434..9465a9cf 100644 Binary files a/Minecraft.Client/Common/Media/SettingsGraphicsMenu1080.swf and b/Minecraft.Client/Common/Media/SettingsGraphicsMenu1080.swf differ diff --git a/Minecraft.Client/Common/Media/SettingsGraphicsMenu480.swf b/Minecraft.Client/Common/Media/SettingsGraphicsMenu480.swf index aae01e78..0f52da86 100644 Binary files a/Minecraft.Client/Common/Media/SettingsGraphicsMenu480.swf and b/Minecraft.Client/Common/Media/SettingsGraphicsMenu480.swf differ diff --git a/Minecraft.Client/Common/Media/SettingsGraphicsMenu720.swf b/Minecraft.Client/Common/Media/SettingsGraphicsMenu720.swf index 4e860fb1..dc66d8d3 100644 Binary files a/Minecraft.Client/Common/Media/SettingsGraphicsMenu720.swf and b/Minecraft.Client/Common/Media/SettingsGraphicsMenu720.swf differ diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index b858553c..871a261e 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -9,6 +9,7 @@ #include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h" #include "..\..\MultiplayerLocalPlayer.h" #include "..\..\Minecraft.h" +#include "..\..\Options.h" #ifdef __ORBIS__ #include @@ -17,7 +18,6 @@ #ifdef _WINDOWS64 #include "..\..\Windows64\KeyboardMouseInput.h" -SavedInventoryCursorPos g_savedInventoryCursorPos = { 0.0f, 0.0f, false }; #endif IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() @@ -1376,13 +1376,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b else { if (IsSectionSlotList(m_eCurrSection)) { - int currentIndex = getCurrentIndex(m_eCurrSection) - getSectionStartOffset(m_eCurrSection); - - bool bcanPlaySound = !isSlotEmpty(m_eCurrSection, currentIndex); - if (bcanPlaySound) - ui.PlayUISFX(eSFX_Press); + ui.PlayUISFX(eSFX_Press); } - // } } break; @@ -1394,7 +1389,10 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b // Standard right click buttonNum = 1; quickKeyHeld = FALSE; - ui.PlayUISFX(eSFX_Press); + if( IsSectionSlotList( m_eCurrSection ) ) + { + ui.PlayUISFX(eSFX_Press); + } } break; @@ -1669,7 +1667,14 @@ vector *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slo { if(slot == nullptr) return nullptr; - vector *lines = slot->getItem()->getHoverText(nullptr, false); + bool advanced = false; + if (const Minecraft* pMinecraft = Minecraft::GetInstance()) + { + if (pMinecraft->options) + advanced = pMinecraft->options->advancedTooltips; + } + + vector *lines = slot->getItem()->getHoverText(nullptr, advanced); // Add rarity to first line if (lines->size() > 0) diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h index 718a2d44..6710e18f 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h @@ -1,15 +1,5 @@ #pragma once -#ifdef _WINDOWS64 -struct SavedInventoryCursorPos -{ - float x; - float y; - bool hasSavedPos; -}; -extern SavedInventoryCursorPos g_savedInventoryCursorPos; -#endif - // Uncomment to enable tap input detection to jump 1 slot. Doesn't work particularly well yet, and I feel the system does not need it. // Would probably be required if we decide to slow down the pointer movement. // 4J Stu - There was a request to be able to navigate the scenes with the dpad, so I have used much of the TAP_DETECTION diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index a0c0ebdd..2623679f 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -210,6 +210,8 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Tile::woolCarpet_Id,13) // Green ITEM_AUX(Tile::woolCarpet_Id,12) // Brown + // TODO: Add in TU25 update +/* ITEM_AUX(Tile::stained_glass_Id,14) // Red ITEM_AUX(Tile::stained_glass_Id,1) // Orange ITEM_AUX(Tile::stained_glass_Id,4) // Yellow @@ -228,21 +230,22 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Tile::stained_glass_Id,12) // Brown ITEM_AUX(Tile::stained_glass_pane_Id,14) // Red - ITEM_AUX(Tile::stained_glass_pane_Id,1) // Orange - ITEM_AUX(Tile::stained_glass_pane_Id,4) // Yellow - ITEM_AUX(Tile::stained_glass_pane_Id,5) // Lime - ITEM_AUX(Tile::stained_glass_pane_Id,3) // Light Blue - ITEM_AUX(Tile::stained_glass_pane_Id,9) // Cyan + ITEM_AUX(Tile::stained_glass_pane_Id,1) // Orange + ITEM_AUX(Tile::stained_glass_pane_Id,4) // Yellow + ITEM_AUX(Tile::stained_glass_pane_Id,5) // Lime + ITEM_AUX(Tile::stained_glass_pane_Id,3) // Light Blue + ITEM_AUX(Tile::stained_glass_pane_Id,9) // Cyan ITEM_AUX(Tile::stained_glass_pane_Id,11) // Blue ITEM_AUX(Tile::stained_glass_pane_Id,10) // Purple - ITEM_AUX(Tile::stained_glass_pane_Id,2) // Magenta - ITEM_AUX(Tile::stained_glass_pane_Id,6) // Pink - ITEM_AUX(Tile::stained_glass_pane_Id,0) // White - ITEM_AUX(Tile::stained_glass_pane_Id,8) // Light Gray - ITEM_AUX(Tile::stained_glass_pane_Id,7) // Gray + ITEM_AUX(Tile::stained_glass_pane_Id,2) // Magenta + ITEM_AUX(Tile::stained_glass_pane_Id,6) // Pink + ITEM_AUX(Tile::stained_glass_pane_Id,0) // White + ITEM_AUX(Tile::stained_glass_pane_Id,8) // Light Gray + ITEM_AUX(Tile::stained_glass_pane_Id,7) // Gray ITEM_AUX(Tile::stained_glass_pane_Id,15) // Black ITEM_AUX(Tile::stained_glass_pane_Id,13) // Green ITEM_AUX(Tile::stained_glass_pane_Id,12) // Brown +*/ #ifndef _CONTENT_PACKAGE DEF(eCreativeInventory_ArtToolsDecorations) diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp index 0b1e0df2..899c3784 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp @@ -4,6 +4,7 @@ #include "..\..\..\Minecraft.World\net.minecraft.world.item.h" #include "..\..\..\Minecraft.World\net.minecraft.network.packet.h" #include "..\..\Minecraft.h" +#include "..\..\Options.h" #include "..\..\MultiPlayerLocalPlayer.h" #include "..\..\ClientConnection.h" #include "IUIScene_TradingMenu.h" @@ -368,7 +369,14 @@ void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr item vector *IUIScene_TradingMenu::GetItemDescription(shared_ptr item) { - vector *lines = item->getHoverText(nullptr, false); + bool advanced = false; + if (const Minecraft* pMinecraft = Minecraft::GetInstance()) + { + if (pMinecraft->options) + advanced = pMinecraft->options->advancedTooltips; + } + + vector *lines = item->getHoverText(nullptr, advanced); // Add rarity to first line if (lines->size() > 0) diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index 0c3b6096..c5dc0554 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -41,10 +41,6 @@ void UIScene_AbstractContainerMenu::handleDestroy() app.DebugPrintf("UIScene_AbstractContainerMenu::handleDestroy\n"); #ifdef _WINDOWS64 - g_savedInventoryCursorPos.x = m_pointerPos.x; - g_savedInventoryCursorPos.y = m_pointerPos.y; - g_savedInventoryCursorPos.hasSavedPos = true; - g_KBMInput.SetScreenCursorHidden(false); g_KBMInput.SetCursorHiddenForUI(false); #endif @@ -173,16 +169,16 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) m_pointerPos = vPointerPos; #ifdef _WINDOWS64 - if (g_savedInventoryCursorPos.hasSavedPos) + if ((iPad == 0) && g_KBMInput.IsKBMActive()) { - m_pointerPos.x = g_savedInventoryCursorPos.x; - m_pointerPos.y = g_savedInventoryCursorPos.y; - - if (m_pointerPos.x < m_fPointerMinX) m_pointerPos.x = m_fPointerMinX; - if (m_pointerPos.x > m_fPointerMaxX) m_pointerPos.x = m_fPointerMaxX; - if (m_pointerPos.y < m_fPointerMinY) m_pointerPos.y = m_fPointerMinY; - if (m_pointerPos.y > m_fPointerMaxY) m_pointerPos.y = m_fPointerMaxY; + m_pointerPos.x = ((m_fPanelMinX + m_fPanelMaxX) * 0.5f) - m_fPointerImageOffsetX; + m_pointerPos.y = ((m_fPanelMinY + m_fPanelMaxY) * 0.5f) - m_fPointerImageOffsetY; } + + if (m_pointerPos.x < m_fPointerMinX) m_pointerPos.x = m_fPointerMinX; + if (m_pointerPos.x > m_fPointerMaxX) m_pointerPos.x = m_fPointerMaxX; + if (m_pointerPos.y < m_fPointerMinY) m_pointerPos.y = m_fPointerMinY; + if (m_pointerPos.y > m_fPointerMaxY) m_pointerPos.y = m_fPointerMaxY; #endif IggyEvent mouseEvent; diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index b2981ebf..1832e40c 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -557,8 +557,8 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); - pClass->m_editSeed.setLabel((wchar_t *)pchText); - pClass->m_params->seed = (wchar_t *)pchText; + pClass->m_editSeed.setLabel(reinterpret_cast(pchText)); + pClass->m_params->seed = static_cast(reinterpret_cast(pchText)); #else #ifdef __PSVITA__ uint16_t pchText[2048]; @@ -584,7 +584,7 @@ void UIScene_LaunchMoreOptionsMenu::getDirectEditInputs(vectorseed = input->getEditBuffer(); + m_params->seed = static_cast(input->getEditBuffer()); } #endif diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index e9884fa1..c3291950 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -66,9 +66,6 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD WCHAR TempString[256]; - swprintf(TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); - m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,4,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance))); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma)); @@ -80,6 +77,19 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); m_sliderInterfaceOpacity.init(TempString,eControl_InterfaceOpacity,0,100,app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); + swprintf(TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); + m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,4,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance))); + + int currentGraphics = app.GetGameSettings(m_iPad, eGameSetting_GraphicsMode); + + const wchar_t* graphicsText = L""; + if (currentGraphics == 0) graphicsText = L"Graphics: Potato"; + else if (currentGraphics == 1) graphicsText = L"Graphics: Fast"; + else graphicsText = L"Graphics: Fancy"; + + swprintf(TempString, 256, L"%ls", graphicsText); + m_sliderGraphicsMode.init(TempString, eControl_GraphicsMode, 0, 2, currentGraphics); + doHorizontalResizeCheck(); const bool bInGame=(Minecraft::GetInstance()->level!=nullptr); @@ -191,21 +201,6 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal const int value = static_cast(currentValue); switch(static_cast(sliderId)) { - case eControl_RenderDistance: - { - m_sliderRenderDistance.handleSliderMove(value); - - const int dist = LevelToDistance(value); - - app.SetGameSettings(m_iPad,eGameSetting_RenderDistance,dist); - - const Minecraft* mc = Minecraft::GetInstance(); - mc->options->viewDistance = 3 - value; - swprintf(TempString,256,L"Render Distance: %d",dist); - m_sliderRenderDistance.setLabel(TempString); - } - break; - case eControl_Gamma: m_sliderGamma.handleSliderMove(value); @@ -235,5 +230,36 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderInterfaceOpacity.setLabel(TempString); break; + + case eControl_RenderDistance: + { + m_sliderRenderDistance.handleSliderMove(value); + + const int dist = LevelToDistance(value); + + app.SetGameSettings(m_iPad,eGameSetting_RenderDistance,dist); + + const Minecraft* mc = Minecraft::GetInstance(); + mc->options->viewDistance = 3 - value; + swprintf(TempString,256,L"Render Distance: %d",dist); + m_sliderRenderDistance.setLabel(TempString); + } + break; + + case eControl_GraphicsMode: + { + m_sliderGraphicsMode.handleSliderMove(value); + + app.SetGameSettings(m_iPad, eGameSetting_GraphicsMode, value); + + const wchar_t* modeName = L"Potato"; + if (value == 1) modeName = L"Fast"; + else if (value == 2) modeName = L"Fancy"; + + swprintf(TempString, 256, L"Graphics: %ls", modeName); + + m_sliderGraphicsMode.setLabel(TempString); + } + break; } } diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h index 99022c83..fbf97ce4 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h @@ -12,14 +12,15 @@ private: eControl_Clouds, eControl_BedrockFog, eControl_CustomSkinAnim, - eControl_RenderDistance, eControl_Gamma, eControl_FOV, - eControl_InterfaceOpacity + eControl_InterfaceOpacity, + eControl_RenderDistance, + eControl_GraphicsMode }; UIControl_CheckBox m_checkboxClouds, m_checkboxBedrockFog, m_checkboxCustomSkinAnim; // Checkboxes - UIControl_Slider m_sliderRenderDistance, m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity; // Sliders + UIControl_Slider m_sliderRenderDistance, m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity, m_sliderGraphicsMode; // Sliders UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_checkboxClouds, "Clouds") UI_MAP_ELEMENT( m_checkboxBedrockFog, "BedrockFog") @@ -28,6 +29,7 @@ private: UI_MAP_ELEMENT( m_sliderGamma, "Gamma") UI_MAP_ELEMENT(m_sliderFOV, "FOV") UI_MAP_ELEMENT( m_sliderInterfaceOpacity, "InterfaceOpacity") + UI_MAP_ELEMENT( m_sliderGraphicsMode, "GraphicsMode") UI_END_MAP_ELEMENTS_AND_NAMES() bool m_bNotInGame; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp index 7b4d3d9d..ec0aa2ba 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -35,6 +35,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat m_checkboxShowHints.init(IDS_HINTS,eControl_ShowHints,(app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0)); m_checkboxShowTooltips.init(IDS_IN_GAME_TOOLTIPS,eControl_ShowTooltips,(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)!=0)); m_checkboxInGameGamertags.init(IDS_IN_GAME_GAMERTAGS,eControl_InGameGamertags,(app.GetGameSettings(m_iPad,eGameSetting_GamertagsVisible)!=0)); + m_checkboxOldSwingAnimation.init(L"Old Swing Animation ", eControl_OldSwingAnimation,(app.GetGameSettings(m_iPad,eGameSetting_OldSwingAnimation)!=0)); // check if we should display the mash-up option if(m_bNotInGame && app.GetMashupPackWorlds(m_iPad)!=0xFFFFFFFF) @@ -415,6 +416,7 @@ void UIScene_SettingsOptionsMenu::setGameSettings() app.SetGameSettings(m_iPad,eGameSetting_GamertagsVisible,m_checkboxInGameGamertags.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_Hints,m_checkboxShowHints.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_Tooltips,m_checkboxShowTooltips.IsChecked()?1:0); + app.SetGameSettings(m_iPad,eGameSetting_OldSwingAnimation,m_checkboxOldSwingAnimation.IsChecked()?1:0); // the mashup option will only be shown if some worlds have been previously hidden if(m_bMashUpWorldsUnhideOption && m_checkboxMashupWorlds.IsChecked()) diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h index e9abb0a9..74b5fc02 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h @@ -11,6 +11,7 @@ private: eControl_ShowHints, eControl_ShowTooltips, eControl_InGameGamertags, + eControl_OldSwingAnimation, eControl_ShowMashUpWorlds, eControl_Autosave, eControl_Languages, @@ -21,7 +22,7 @@ protected: static int m_iDifficultyTitleSettingA[4]; private: - UIControl_CheckBox m_checkboxViewBob, m_checkboxShowHints, m_checkboxShowTooltips, m_checkboxInGameGamertags, m_checkboxMashupWorlds; // Checkboxes + UIControl_CheckBox m_checkboxViewBob, m_checkboxShowHints, m_checkboxShowTooltips, m_checkboxInGameGamertags, m_checkboxOldSwingAnimation, m_checkboxMashupWorlds; // Checkboxes UIControl_Slider m_sliderAutosave, m_sliderDifficulty; // Sliders UIControl_Label m_labelDifficultyText; //Text UIControl_Button m_buttonLanguageSelect; @@ -31,6 +32,7 @@ private: UI_MAP_ELEMENT( m_checkboxShowHints, "ShowHints") UI_MAP_ELEMENT( m_checkboxShowTooltips, "ShowTooltips") UI_MAP_ELEMENT( m_checkboxInGameGamertags, "InGameGamertags") + UI_MAP_ELEMENT( m_checkboxOldSwingAnimation, "OldSwingAnimation") UI_MAP_ELEMENT( m_checkboxMashupWorlds, "ShowMashUpWorlds") UI_MAP_ELEMENT( m_sliderAutosave, "Autosave") UI_MAP_ELEMENT( m_sliderDifficulty, "Difficulty") diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 0147896c..cb33fdc1 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -590,6 +590,7 @@ void C_4JProfile::Initialise(DWORD dwTitleID, pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE & 0x00000800); // uisize 2 pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000); // splitscreen ui size 3 pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on + pGameSettings->uiBitmaskValues |= GAMESETTING_OLDSWINGANIMATION; //eGameSetting_OldSwingAnimation - off // TU12 // favorite skins added, but only set in TU12 - set to FFs diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index 958510b4..06611296 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -1530,31 +1530,28 @@ void GameRenderer::renderLevel(float a, int64_t until) // 4J - have changed this fancy rendering option to work with our command buffers. The original used to use frame buffer flags to disable // writing to colour when doing the z-only pass, but that value gets obliterated by our command buffers. Using alpha blend function instead // to achieve the same effect. - if (true) // (mc->options->fancyGraphics) + if (mc->options->fancyGraphics) { if (mc->options->ambientOcclusion) { GL11::glShadeModel(GL11::GL_SMOOTH); } - glBlendFunc(GL_ZERO, GL_ONE); PIXBeginNamedEvent(0,"Fancy second pass - writing z"); - int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); - PIXEndNamedEvent(); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if (visibleWaterChunks > 0) - { - PIXBeginNamedEvent(0,"Fancy second pass - actual rendering"); - levelRenderer->render(cameraEntity, 1, a, updateChunks); // 4J - chanaged, used to be renderSameAsLast but we don't support that anymore - PIXEndNamedEvent(); - } + glBlendFunc(GL_ZERO, GL_ONE); + glEnable(GL_CULL_FACE); + + levelRenderer->render(cameraEntity, 2, a, updateChunks); + PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "Fancy second pass - actual render"); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + levelRenderer->render(cameraEntity, 2, a, updateChunks); // 4J - chanaged, used to be renderSameAsLast but we don't support that anymore + PIXEndNamedEvent(); GL11::glShadeModel(GL11::GL_FLAT); - } - else - { - PIXBeginNamedEvent(0,"Second pass level render"); + + PIXBeginNamedEvent(0, "Second pass level render"); levelRenderer->render(cameraEntity, 1, a, updateChunks); PIXEndNamedEvent(); } diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index 16513d6c..82cfc797 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -247,8 +247,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) shared_ptr headGear = minecraft->player->inventory->getArmor(3); // 4J-PB - changing this to be per player - //if (!minecraft->options->thirdPersonView && headGear != NULL && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); - if ((minecraft->player->ThirdPersonView()==0) && headGear != NULL && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); + //if (!minecraft->options->thirdPersonView && headGear != nullptr && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); + if ((minecraft->player->ThirdPersonView()==0) && headGear != nullptr && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); if (!minecraft->player->hasEffect(MobEffect::confusion)) { float pt = minecraft->player->oPortalTime + (minecraft->player->portalTime - minecraft->player->oPortalTime) * a; @@ -533,7 +533,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) std::shared_ptr riding = minecraft->localplayers[iPad].get()->riding; std::shared_ptr living = dynamic_pointer_cast(riding); - if (riding == NULL) + if (riding == nullptr) { // render food for (int i = 0; i < FoodConstants::MAX_FOOD / 2; i++) @@ -893,7 +893,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) unsigned int max = 10; bool isChatting = false; - if (dynamic_cast(minecraft->screen) != NULL) + if (dynamic_cast(minecraft->screen) != nullptr) { max = 20; isChatting = true; @@ -1064,117 +1064,112 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) vector lines; - // Only show version/branch for player 0 to avoid cluttering each splitscreen viewport - if (iPad == 0) - { - //lines.push_back(ClientConstants::VERSION_STRING); - //lines.push_back(ClientConstants::BRANCH_STRING); - } if (minecraft->options->renderDebug && minecraft->player != nullptr && minecraft->level != nullptr) { - lines.push_back(minecraft->fpsString); - lines.push_back(L"E: " + std::to_wstring(minecraft->level->getAllEntities().size())); - int renderDistance = app.GetGameSettings(iPad, eGameSetting_RenderDistance); - lines.push_back(L"C: " + std::to_wstring(16 * (2 * renderDistance + 1) * (2 * renderDistance + 1)) + L" D: " + std::to_wstring(renderDistance)); - lines.push_back(minecraft->gatherStats4()); + int renderDistance = app.GetGameSettings(iPad, eGameSetting_RenderDistance); - wstring dimension = L"unknown"; - switch (minecraft->player->dimension) - { - case -1: dimension = L"minecraft:the_nether"; break; - case 0: dimension = L"minecraft:overworld"; break; - case 1: dimension = L"minecraft:the_end"; break; - } - lines.push_back(dimension); - lines.push_back(L""); + lines.push_back(L"Minecraft LCE TU24 " + minecraft->fpsString); + lines.push_back(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed())); + lines.push_back(minecraft->gatherStats1()); // Time to autosave + lines.push_back(L"Render Distance: " + std::to_wstring(renderDistance)); + lines.push_back(L""); // Spacer + + // Players block pos int xBlockPos = Mth::floor(minecraft->player->x); int yBlockPos = Mth::floor(minecraft->player->y); int zBlockPos = Mth::floor(minecraft->player->z); + // Chunk player is in int xChunkPos = xBlockPos >> 4; int yChunkPos = yBlockPos >> 4; int zChunkPos = zBlockPos >> 4; + // Players offset within the chunk int xChunkOffset = xBlockPos & 15; int yChunkOffset = yBlockPos & 15; int zChunkOffset = zBlockPos & 15; - WCHAR posString[44]; - swprintf(posString, 44, L"%.3f / %.5f / %.3f", minecraft->player->x, minecraft->player->y, minecraft->player->z); + lines.push_back(L"XYZ: " + std::to_wstring(xBlockPos) + L", " + std::to_wstring(yBlockPos) + L", " + std::to_wstring(zBlockPos)); + lines.push_back(L"Chunk: " + std::to_wstring(xChunkPos) + L", " + std::to_wstring(yChunkPos) + L", " + std::to_wstring(zChunkPos)); - lines.push_back(L"XYZ: " + std::wstring(posString)); - lines.push_back(L"Block: " + std::to_wstring(xBlockPos) + L" " + std::to_wstring(yBlockPos) + L" " + std::to_wstring(zBlockPos)); - lines.push_back(L"Chunk: " + std::to_wstring(xChunkOffset) + L" " + std::to_wstring(yChunkOffset) + L" " + std::to_wstring(zChunkOffset) + L" in " + std::to_wstring(xChunkPos) + L" " + std::to_wstring(yChunkPos) + L" " + std::to_wstring(zChunkPos)); - - float yRotDisplay = fmod(minecraft->player->yRot, 360.0f); - if (yRotDisplay > 180.0f) yRotDisplay -= 360.0f; - if (yRotDisplay < -180.0f) yRotDisplay += 360.0f; - WCHAR angleString[16]; - swprintf(angleString, 16, L"%.1f / %.1f", yRotDisplay, minecraft->player->xRot); - - int direction = Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3; - const wchar_t* cardinals[] = { L"south", L"west", L"north", L"east" }; - lines.push_back(L"Facing: " + std::wstring(cardinals[direction]) + L" (" + angleString + L")"); - - if (minecraft->level != NULL && minecraft->level->hasChunkAt(xBlockPos, fmod(yBlockPos, 256), zBlockPos)) + if (minecraft->level != nullptr && minecraft->level->hasChunkAt(xBlockPos, fmod(yBlockPos, 256), zBlockPos)) { LevelChunk *chunkAt = minecraft->level->getChunkAt(xBlockPos, zBlockPos); - if (chunkAt != NULL) + if (chunkAt != nullptr) { - int skyLight = chunkAt->getBrightness(LightLayer::Sky, xChunkOffset, yChunkOffset, zChunkOffset); - int blockLight = chunkAt->getBrightness(LightLayer::Block, xChunkOffset, yChunkOffset, zChunkOffset); - int maxLight = fmax(skyLight, blockLight); - lines.push_back(L"Light: " + std::to_wstring(maxLight) + L" (" + std::to_wstring(skyLight) + L" sky, " + std::to_wstring(blockLight) + L" block)"); - lines.push_back(L"CH S: " + std::to_wstring(chunkAt->getHeightmap(xChunkOffset, zChunkOffset))); Biome *biome = chunkAt->getBiome(xChunkOffset, zChunkOffset, minecraft->level->getBiomeSource()); + lines.push_back(L"Biome: " + biome->m_name + L" (" + std::to_wstring(biome->id) + L")"); - lines.push_back(L"Difficulty: " + std::to_wstring(minecraft->level->difficulty) + L" (Day " + std::to_wstring(minecraft->level->getGameTime() / Level::TICKS_PER_DAY) + L")"); } } - lines.push_back(L""); - lines.push_back(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed())); - lines.push_back(minecraft->gatherStats1()); - lines.push_back(minecraft->gatherStats2()); - lines.push_back(minecraft->gatherStats3()); - } + lines.push_back(L"Difficulty: " + std::to_wstring(minecraft->level->difficulty) + L" (Day " + std::to_wstring(minecraft->level->getGameTime() / Level::TICKS_PER_DAY) + L")"); -#ifdef _DEBUG - if (minecraft->options->renderDebug && minecraft->player != nullptr && minecraft->level != nullptr && minecraft->level->dimension->id == 0) - { - wstring wfeature[eTerrainFeature_Count]; - wfeature[eTerrainFeature_Stronghold] = L"Stronghold: "; - wfeature[eTerrainFeature_Mineshaft] = L"Mineshaft: "; - wfeature[eTerrainFeature_Village] = L"Village: "; - wfeature[eTerrainFeature_Ravine] = L"Ravine: "; +#ifdef _DEBUG // Only show terrain features in debug builds not release + lines.push_back(L""); // Spacer - // maxW in font units: physical width divided by font scale - float maxW = (static_cast(g_rScreenWidth) - debugLeft - 8) / fontScale; - float maxWForContent = maxW - static_cast(font->width(L"...")); - bool truncated[eTerrainFeature_Count] = {}; + lines.push_back(L"Entitys: " + std::to_wstring(minecraft->level->getAllEntities().size())); - for (size_t i = 0; i < app.m_vTerrainFeatures.size(); i++) + // We have to limit y to 256 as we don't get any information past that + if (minecraft->level != nullptr && minecraft->level->hasChunkAt(xBlockPos, fmod(yBlockPos, 256), zBlockPos)) { - FEATURE_DATA *pFeatureData = app.m_vTerrainFeatures[i]; - int type = pFeatureData->eTerrainFeature; - if (type < eTerrainFeature_Stronghold || type > eTerrainFeature_Ravine) continue; - if (truncated[type]) continue; - wstring itemInfo = L"[" + std::to_wstring(pFeatureData->x * 16) + L", " + std::to_wstring(pFeatureData->z * 16) + L"] "; - if (font->width(wfeature[type] + itemInfo) <= maxWForContent) - wfeature[type] += itemInfo; - else - { - wfeature[type] += L"..."; - truncated[type] = true; - } - } + LevelChunk *chunkAt = minecraft->level->getChunkAt(xBlockPos, zBlockPos); + if (chunkAt != nullptr) + { + int skyLight = chunkAt->getBrightness(LightLayer::Sky, xChunkOffset, yChunkOffset, zChunkOffset); + int blockLight = chunkAt->getBrightness(LightLayer::Block, xChunkOffset, yChunkOffset, zChunkOffset); + int maxLight = fmax(skyLight, blockLight); - lines.push_back(L""); - for (int i = eTerrainFeature_Stronghold; i <= static_cast(eTerrainFeature_Ravine); i++) - lines.push_back(wfeature[i]); - lines.push_back(L""); - } + lines.push_back(L"Light: " + std::to_wstring(maxLight) + L" (" + std::to_wstring(skyLight) + L" sky, " + std::to_wstring(blockLight) + L" block)"); + lines.push_back(L"CH S: " + std::to_wstring(chunkAt->getHeightmap(xChunkOffset, zChunkOffset))); + } + } + + lines.push_back(minecraft->gatherStats2()); // Empty currently - CPlatformNetworkManagerStub::GatherStats() + lines.push_back(minecraft->gatherStats3()); // RTT + lines.push_back(minecraft->gatherStats4()); // Multiplayer Chunk Cache + + if (minecraft->options->renderDebug && minecraft->player != nullptr && minecraft->level != nullptr && minecraft->level->dimension->id == 0) + { + wstring wfeature[eTerrainFeature_Count]; + wfeature[eTerrainFeature_Stronghold] = L"Stronghold: "; + wfeature[eTerrainFeature_Mineshaft] = L"Mineshaft: "; + wfeature[eTerrainFeature_Village] = L"Village: "; + wfeature[eTerrainFeature_Ravine] = L"Ravine: "; + + // maxW in font units: physical width divided by font scale + float maxW = (static_cast(g_rScreenWidth) - debugLeft - 8) / fontScale; + float maxWForContent = maxW - static_cast(font->width(L"...")); + bool truncated[eTerrainFeature_Count] = {}; + + for (size_t i = 0; i < app.m_vTerrainFeatures.size(); i++) + { + FEATURE_DATA *pFeatureData = app.m_vTerrainFeatures[i]; + int type = pFeatureData->eTerrainFeature; + if (type < eTerrainFeature_Stronghold || type > eTerrainFeature_Ravine) continue; + if (truncated[type]) continue; + wstring itemInfo = L"[" + std::to_wstring(pFeatureData->x * 16) + L", " + std::to_wstring(pFeatureData->z * 16) + L"] "; + if (font->width(wfeature[type] + itemInfo) <= maxWForContent) + wfeature[type] += itemInfo; + else + { + wfeature[type] += L"..."; + truncated[type] = true; + } + } + + lines.push_back(L""); // Spacer + for (int i = eTerrainFeature_Stronghold; i <= static_cast(eTerrainFeature_Ravine); i++) + { + lines.push_back(wfeature[i]); + } + } #endif + } + // Disable the depth test so the text shows on top of the paperdoll + glDisable(GL_DEPTH_TEST); + + // Loop through the lines and draw them all on screen int yPos = debugTop; for (const auto &line : lines) { @@ -1182,6 +1177,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) yPos += 10; } + // Restore the depth test + glEnable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); @@ -1199,10 +1196,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // Moved to the xui base scene // void Gui::renderBossHealth(void) // { -// if (EnderDragonRenderer::bossInstance == NULL) return; +// if (EnderDragonRenderer::bossInstance == nullptr) return; // // shared_ptr boss = EnderDragonRenderer::bossInstance; -// EnderDragonRenderer::bossInstance = NULL; +// EnderDragonRenderer::bossInstance = nullptr; // // Minecraft *pMinecraft=Minecraft::GetInstance(); // @@ -1323,7 +1320,7 @@ void Gui::renderTp(float br, int w, int h) void Gui::renderSlot(int slot, int x, int y, float a) { shared_ptr item = minecraft->player->inventory->items[slot]; - if (item == NULL) return; + if (item == nullptr) return; float pop = item->popTime - a; if (pop > 0) @@ -1569,7 +1566,7 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc int height = minecraft->height; // This causes us to cover xScale*dataLength pixels in the horizontal int xScale = 1; - if(dataA != NULL && dataB != NULL) xScale = 2; + if(dataA != nullptr && dataB != nullptr) xScale = 2; glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); @@ -1592,7 +1589,7 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc int cc2 = cc * cc / 255; cc2 = cc2 * cc2 / 255; - if( dataA != NULL ) + if( dataA != nullptr ) { if (dataA[i] > dataAWarning) { @@ -1609,7 +1606,7 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), static_cast(0)); } - if( dataB != NULL ) + if( dataB != nullptr ) { if (dataB[i]>dataBWarning) { diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index 13d4fc20..a5006609 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -553,12 +553,9 @@ void ItemInHandRenderer::render(float a) glPushMatrix(); float d = 0.8f; -#if defined __ORBIS__ || defined __PS3__ || defined _WINDOWS64 - static const float swingPowFactor = 1.0f; -#else - static const float swingPowFactor = 4.0f; // 4J added, to slow the swing down when nearest the player for avoiding luminance flash issues -#endif - if (player->getUseItemDuration() > 0) + float swingPowFactor = app.GetGameSettings(0, eGameSetting_OldSwingAnimation)? 4.0f : 1.0f; //4.0 is the old, 1.0 is the new + + if (player->getUseItemDuration() > 0) { UseAnim anim = item->getUseAnimation(); if ( (anim == UseAnim_eat) || (anim == UseAnim_drink) ) diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index 5e4c704c..16b0c5ba 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -826,7 +826,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) if( ( globalChunkFlags[pClipChunk->globalIdx] & emptyFlag ) == emptyFlag ) continue; // Check that this particular layer isn't empty // List can be calculated directly from the chunk's global idex - int list = pClipChunk->globalIdx * 2 + layer; + int list = pClipChunk->globalIdx * 3 + layer; list += chunkLists; if(RenderManager.CBuffCall(list, first)) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 56f84d98..4d5fe33d 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -747,7 +747,7 @@ void Minecraft::run() while (System::currentTimeMillis() >= lastTime + 1000) { - fpsString = std::to_wstring(frames) + L" fps (" + std::to_wstring(Chunk::updates) + L" chunk updates)"; + fpsString = L"(" + std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates)"; Chunk::updates = 0; lastTime += 1000; frames = 0; @@ -2084,8 +2084,8 @@ void Minecraft::run_middle() while (System::nanoTime() >= lastTime + 1000000000) { MemSect(31); - fpsString = std::to_wstring(frames) + L" fps (" + std::to_wstring(Chunk::updates) + L" chunk updates)"; - MemSect(0); + fpsString = L"(" + std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates)"; + MemSect(0); Chunk::updates = 0; lastTime += 1000000000; frames = 0; diff --git a/Minecraft.Client/Options.cpp b/Minecraft.Client/Options.cpp index ebe1295a..5b98d441 100644 --- a/Minecraft.Client/Options.cpp +++ b/Minecraft.Client/Options.cpp @@ -170,6 +170,7 @@ void Options::init() particles = 0; fov = 0; gamma = 0; + advancedTooltips = false; } Options::Options(Minecraft *minecraft, File workingDirectory) @@ -242,6 +243,14 @@ void Options::set(const Options::Option *item, float fVal) { viewDistance = fVal; } + if (item == Option::GRAPHICS) + { + fancyGraphics = fVal; + } + if (item == Option::AMBIENT_OCCLUSION) + { + ambientOcclusion = fVal; + } } void Options::toggle(const Options::Option *option, int dir) @@ -297,6 +306,8 @@ float Options::getProgressValue(const Options::Option *item) if (item == Option::SOUND) return sound; if (item == Option::SENSITIVITY) return sensitivity; if (item == Option::RENDER_DISTANCE) return viewDistance; + if (item == Option::GRAPHICS) return fancyGraphics; + if (item == Option::AMBIENT_OCCLUSION) return ambientOcclusion; return 0; } @@ -451,6 +462,7 @@ void Options::load() if (cmds[0] == L"fancyGraphics") fancyGraphics = cmds[1]==L"true"; if (cmds[0] == L"ao") ambientOcclusion = cmds[1]==L"true"; if (cmds[0] == L"clouds") renderClouds = cmds[1]==L"true"; + if (cmds[0] == L"advancedTooltips") advancedTooltips = cmds[1]==L"false"; if (cmds[0] == L"skin") skin = cmds[1]; if (cmds[0] == L"lastServer") lastMpIp = cmds[1]; @@ -508,6 +520,7 @@ void Options::save() dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false")); dos.writeChars(ambientOcclusion ? L"ao:true" : L"ao:false"); dos.writeChars(renderClouds ? L"clouds:true" : L"clouds:false"); + dos.writeChars(advancedTooltips ? L"advancedTooltips:true" : L"advancedTooltips:false"); dos.writeChars(L"skin:" + skin); dos.writeChars(L"lastServer:" + lastMpIp); diff --git a/Minecraft.Client/Options.h b/Minecraft.Client/Options.h index 8be61ac6..29cd83ac 100644 --- a/Minecraft.Client/Options.h +++ b/Minecraft.Client/Options.h @@ -110,6 +110,7 @@ public: int particles; // 0 is all, 1 is decreased and 2 is minimal float fov; float gamma; + bool advancedTooltips; void init(); // 4J added Options(Minecraft *minecraft, File workingDirectory); diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index ab978328..d66b4c91 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -4896,7 +4896,7 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z ) b = cb; } - if ( Tile::lightEmission[tt->id] == 0 )//4J - TODO/remove (Minecraft::useAmbientOcclusion()) + if ( Tile::lightEmission[tt->id] == 0 && Minecraft::useAmbientOcclusion()) { return tesselateBlockInWorldWithAmbienceOcclusionTexLighting(tt, x, y, z, r, g, b, 0, smoothShapeLighting); } @@ -4925,7 +4925,7 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, int fac b = cb; } - if ( Tile::lightEmission[tt->id] == 0 )//4J - TODO/remove (Minecraft::useAmbientOcclusion()) + if ( Tile::lightEmission[tt->id] == 0 && Minecraft::useAmbientOcclusion()) { return tesselateBlockInWorldWithAmbienceOcclusionTexLighting( tt, x, y, z, r, g, b, faceFlags, smoothShapeLighting ); } diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index 3aa33248..a936b27a 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -653,11 +653,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() PlayerUID xuid = INVALID_XUID; PlayerUID OnlineXuid = INVALID_XUID; - if( player != nullptr ) - { - xuid = player->getXuid(); - OnlineXuid = player->getOnlineXuid(); - } + // 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: When one of the Players is idle for a few minutes his head turns 180 degrees. return std::make_shared(player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp); } diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index 54191ebc..be6efe90 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -234,6 +234,13 @@ bool KeyboardMouseInput::IsKeyReleased(int vkCode) const return false; } +int KeyboardMouseInput::GetPressedKey() const +{ + for (int i = 0; i < MAX_KEYS; ++i) + if (m_keyPressed[i]) return i; + return 0; +} + bool KeyboardMouseInput::IsMouseButtonDown(int button) const { if (button >= 0 && button < MAX_MOUSE_BUTTONS) diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index 5c406983..e8b5f588 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -56,6 +56,8 @@ public: bool IsKeyPressed(int vkCode) const; bool IsKeyReleased(int vkCode) const; + int GetPressedKey() const; + bool IsMouseButtonDown(int button) const; bool IsMouseButtonPressed(int button) const; bool IsMouseButtonReleased(int button) const; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index c1489dd2..75794e98 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -36,6 +36,7 @@ //#include "NetworkManager.h" #include "..\..\Minecraft.Client\Tesselator.h" #include "..\..\Minecraft.Client\Options.h" +#include "..\Gui.h" #include "Sentient\SentientManager.h" #include "..\..\Minecraft.World\IntCache.h" #include "..\Textures.h" @@ -114,6 +115,7 @@ int g_iScreenHeight = 1080; // always matches the current window, even after a resize. int g_rScreenWidth = 1920; int g_rScreenHeight = 1080; +static bool f3ComboUsed = false; float g_iAspectRatio = static_cast(g_iScreenWidth) / g_iScreenHeight; static bool g_bResizeReady = false; @@ -1781,14 +1783,43 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } // F3 toggles onscreen debug info - if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO)) + if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO)) { - if (const Minecraft* pMinecraft = Minecraft::GetInstance()) + f3ComboUsed = false; + } + + // f3 combo + if (g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_DEBUG_INFO)) + { + switch (g_KBMInput.GetPressedKey()) { - if (pMinecraft->options) - { - pMinecraft->options->renderDebug = !pMinecraft->options->renderDebug; - } + // advanced tooltips + case 'H': + if (pMinecraft->options && app.GetGameStarted()) + { + pMinecraft->options->advancedTooltips = !pMinecraft->options->advancedTooltips; + pMinecraft->options->save(); + + const wstring msg = wstring(L"Advanced tooltips: ") + (pMinecraft->options->advancedTooltips ? L"shown" : L"hidden"); + const int primaryPad = ProfileManager.GetPrimaryPad(); + + if (pMinecraft->gui) + { + pMinecraft->gui->addMessage(msg, primaryPad); + } + + f3ComboUsed = true; + } + break; + } + } + + // no combo + if (g_KBMInput.IsKeyReleased(KeyboardMouseInput::KEY_DEBUG_INFO) && !f3ComboUsed) + { + if (pMinecraft->options) + { + pMinecraft->options->renderDebug = !pMinecraft->options->renderDebug; } } diff --git a/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/travel.ogg b/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/travel.ogg index 340c40cb..7714256b 100644 Binary files a/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/travel.ogg and b/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/travel.ogg differ diff --git a/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/trigger.ogg b/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/trigger.ogg index fcfac629..dfbf6f21 100644 Binary files a/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/trigger.ogg and b/Minecraft.Client/Windows64Media/Sound/Minecraft/portal/trigger.ogg differ diff --git a/Minecraft.World/HalfTransparentTile.cpp b/Minecraft.World/HalfTransparentTile.cpp index 6fa63d71..b007e915 100644 --- a/Minecraft.World/HalfTransparentTile.cpp +++ b/Minecraft.World/HalfTransparentTile.cpp @@ -2,6 +2,7 @@ #include "net.minecraft.world.level.h" #include "net.minecraft.world.h" #include "HalfTransparentTile.h" +#include "Facing.h" HalfTransparentTile::HalfTransparentTile(int id, const wstring &tex, Material *material, bool allowSame) : Tile(id,material,isSolidRender()) { @@ -17,7 +18,24 @@ bool HalfTransparentTile::isSolidRender(bool isServerLevel) bool HalfTransparentTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) { int id = level->getTile(x, y, z); - if (!allowSame && id == this->id) return false; + + if (this->id == Tile::stained_glass_Id) + { + bool isBlocking = level->isTopSolidBlocking(x, y, z); + if (face == Facing::DOWN && level->isSolidBlockingTile(x, y + 1, z) != isBlocking) return true; + else if (face == Facing::UP && level->isTopSolidBlocking(x, y - 1, z) != isBlocking) return true; + else if (face == Facing::NORTH && level->isSolidBlockingTile(x, y, z + 1) != isBlocking) return true; + else if (face == Facing::SOUTH && level->isSolidBlockingTile(x, y, z - 1) != isBlocking) return true; + else if (face == Facing::WEST && level->isSolidBlockingTile(x + 1, y, z) != isBlocking) return true; + else if (face == Facing::EAST && level->isSolidBlockingTile(x - 1, y, z) != isBlocking) return true; + //else if (face == 6 && level->isSolidBlockingTile(x, y, z) != isBlocking) return true; // not really a direction? is this supposed to be here? + } + + if (!allowSame && id == this->id) + { + return false; + } + return Tile::shouldRenderFace(level, x, y, z, face); } diff --git a/Minecraft.World/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index cfa5af0f..9b64c041 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -562,34 +562,27 @@ vector *ItemInstance::getHoverText(shared_ptr player, bool a title.italics = true; } - // 4J: This is for showing aux values, not useful in console version - /* if (advanced) { wstring suffix = L""; - if (title.length() > 0) + if (title.text.length() > 0) { - title += L" ("; + title.text += L" ("; suffix = L")"; } + wchar_t buf[64]; if (isStackedByData()) - { - title += String.format("#%04d/%d%s", id, auxValue, suffix); - } + swprintf_s(buf, 64, L"#%04d/%d%s", id, auxValue, suffix.c_str()); else - { - title += String.format("#%04d%s", id, suffix); - } + swprintf_s(buf, 64, L"#%04d%s", id, suffix.c_str()); + title.text += buf; } else if (!hasCustomHoverName() && id == Item::map_Id) - */ - - /*if (!hasCustomHoverName() && id == Item::map_Id) { title.text += L" #" + std::to_wstring(auxValue); - }*/ + } lines->push_back(title); @@ -674,7 +667,7 @@ vector *ItemInstance::getHoverText(shared_ptr player, bool a { if (isDamaged()) { - wstring damageStr = L"Durability: LOCALISE " + std::to_wstring((getMaxDamage()) - getDamageValue()) + L" / " + std::to_wstring(getMaxDamage()); + wstring damageStr = L"Durability: " + std::to_wstring((getMaxDamage()) - getDamageValue()) + L" / " + std::to_wstring(getMaxDamage()); lines->push_back(HtmlString(damageStr)); } } diff --git a/Minecraft.World/LiquidTile.cpp b/Minecraft.World/LiquidTile.cpp index be6c582d..3134c239 100644 --- a/Minecraft.World/LiquidTile.cpp +++ b/Minecraft.World/LiquidTile.cpp @@ -253,7 +253,7 @@ float LiquidTile::getBrightness(LevelSource *level, int x, int y, int z) int LiquidTile::getRenderLayer() { - return material == Material::water ? 1 : 0; + return material == Material::water ? 2 : 0; } void LiquidTile::animateTick(Level *level, int x, int y, int z, Random *random)