diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d83c5c8e..916f13157 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,13 +89,59 @@ target_link_libraries(MinecraftClient PRIVATE > ) -add_custom_command(TARGET MinecraftClient POST_BUILD - COMMAND "${CMAKE_COMMAND}" - -DPROJECT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" - -DOUTPUT_DIR="$" - -DCONFIGURATION=$ - -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyAssets.cmake" - VERBATIM -) +if(WIN32) + message(STATUS "Starting redist copy...") + execute_process( + COMMAND robocopy.exe + "${CMAKE_CURRENT_SOURCE_DIR}/x64/Release" + "${CMAKE_CURRENT_BINARY_DIR}" + /S /MT /R:0 /W:0 /NP + ) + message(STATUS "Starting asset copy...") + execute_process( + COMMAND robocopy.exe + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client" + "${CMAKE_CURRENT_BINARY_DIR}" + /S /MT /R:0 /W:0 /NP + /XF "*.cpp" "*.c" "*.h" "*.hpp" "*.asm" + "*.xml" "*.lang" "*.vcxproj" "*.vcxproj.*" "*.sln" + "*.docx" "*.xls" + "*.bat" "*.cmd" "*.ps1" "*.py" + "*Test*" + /XD "Durango*" "Orbis*" "PS*" "Xbox" + ) + message(STATUS "Patching Windows64Media...") + execute_process( + COMMAND robocopy.exe + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia" + "${CMAKE_CURRENT_BINARY_DIR}/Windows64Media" + /S /MT /R:0 /W:0 /NP + /XF "*.h" "*.xml" "*.lang" "*.bat" + ) +elseif(UNIX) + message(STATUS "Starting redist copy...") + execute_process( + COMMAND rsync -av "${CMAKE_CURRENT_SOURCE_DIR}/x64/Release/" "${CMAKE_CURRENT_BINARY_DIR}/" + ) + message(STATUS "Starting asset copy...") + execute_process( + COMMAND rsync -av + "--exclude=*.cpp" "--exclude=*.c" "--exclude=*.h" "--exclude=*.hpp" "--exclude=*.asm" + "--exclude=*.xml" "--exclude=*.lang" "--exclude=*.vcxproj" "--exclude=*.vcxproj.*" "--exclude=*.sln" + "--exclude=*.docx" "--exclude=*.xls" + "--exclude=*.bat" "--exclude=*.cmd" "--exclude=*.ps1" "--exclude=*.py" + "--exclude=*Test*" + "--exclude=Durango*" "--exclude=Orbis*" "--exclude=PS*" "--exclude=Xbox" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/" "${CMAKE_CURRENT_BINARY_DIR}/" + ) + message(STATUS "Patching Windows64Media...") + execute_process( + COMMAND rsync -av + "--exclude=*.h" "--exclude=*.xml" "--exclude=*.lang" "--exclude=*.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia/" "${CMAKE_CURRENT_BINARY_DIR}/Windows64Media/" + ) +else() + message(FATAL_ERROR "Redist and asset copying is only supported on Windows (Robocopy) and Unix systems (rsync).") +endif() set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MinecraftClient) diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 8123a2f0b..02a7837db 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -2694,6 +2694,10 @@ void ClientConnection::handleRespawn(shared_ptr packet) int oldDimension = minecraft->localplayers[m_userIndex]->dimension; started = false; + // Stop any streaming music (e.g. jukebox) when changing dimensions + // so it doesn't leak into the new dimension + level->playStreamingMusic(L"", 0, 0, 0); + // Remove client connection from this level level->removeClientConnection(this, false); diff --git a/Minecraft.Client/Common/Media/MediaWindows64.arc b/Minecraft.Client/Common/Media/MediaWindows64.arc index 9498b91d6..4c17b74b4 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64.arc and b/Minecraft.Client/Common/Media/MediaWindows64.arc differ diff --git a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp index 76d21406c..bb13deb89 100644 --- a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp @@ -387,8 +387,10 @@ vector *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSect desc = new vector(); - HtmlString string( app.GetString(MobEffect::effects[effectId]->getDescriptionId()), eHTMLColor_White ); - desc->push_back( string ); + if (effectId < MobEffect::e_MobEffectIcon_COUNT && MobEffect::effects[effectId]) { + HtmlString string( app.GetString(MobEffect::effects[effectId]->getDescriptionId()), eHTMLColor_White ); + desc->push_back( string ); + } } break; } diff --git a/Minecraft.Client/CreeperModel.cpp b/Minecraft.Client/CreeperModel.cpp index dd9ef193f..99d7d4735 100644 --- a/Minecraft.Client/CreeperModel.cpp +++ b/Minecraft.Client/CreeperModel.cpp @@ -6,35 +6,33 @@ // 4J - added void CreeperModel::_init(float g) { - int yo = 4; - head = new ModelPart(this, 0, 0); head->addBox(-4, - 8, -4, 8, 8, 8, g); // Head - head->setPos(0, (float)(yo), 0); + head->setPos(0, 6, 0); hair = new ModelPart(this, 32, 0); hair->addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head - hair->setPos(0, (float)(yo), 0); + hair->setPos(0, 6, 0); body = new ModelPart(this, 16, 16); body->addBox(-4, 0, -2, 8, 12, 4, g); // Body - body->setPos(0, (float)(yo), 0); + body->setPos(0, 6, 0); leg0 = new ModelPart(this, 0, 16); leg0->addBox(-2, 0, -2, 4, 6, 4, g); // Leg0 - leg0->setPos(-2, (float)(12 + yo), 4); + leg0->setPos(-2, 18, 4); leg1 = new ModelPart(this, 0, 16); leg1->addBox(-2, 0, -2, 4, 6, 4, g); // Leg1 - leg1->setPos(2, (float)(12 + yo), 4); + leg1->setPos(2, 18, 4); leg2 = new ModelPart(this, 0, 16); leg2->addBox(-2, 0, -2, 4, 6, 4, g); // Leg2 - leg2->setPos(-2, (float)(12 + yo), -4); + leg2->setPos(-2, 18, -4); leg3 = new ModelPart(this, 0, 16); leg3->addBox(-2, 0, -2, 4, 6, 4, g); // Leg3 - leg3->setPos(2, (float)(12 + yo), -4); + leg3->setPos(2, 18, -4); // 4J added - compile now to avoid random performance hit first time cubes are rendered head->compile(1.0f/16.0f); diff --git a/Minecraft.Client/DurangoMedia/DLC/Candy Texture Pack/Data/x16Data.pck b/Minecraft.Client/DurangoMedia/DLC/Candy Texture Pack/Data/x16Data.pck index db0222c4b..c5043050e 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Candy Texture Pack/Data/x16Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Candy Texture Pack/Data/x16Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Cartoon Texture Pack/Data/x32Data.pck b/Minecraft.Client/DurangoMedia/DLC/Cartoon Texture Pack/Data/x32Data.pck index 3752e75aa..023d98736 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Cartoon Texture Pack/Data/x32Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Cartoon Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/City Texture Pack/Data/x32Data.pck b/Minecraft.Client/DurangoMedia/DLC/City Texture Pack/Data/x32Data.pck index 61161ba4e..7f13bcbfb 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/City Texture Pack/Data/x32Data.pck and b/Minecraft.Client/DurangoMedia/DLC/City Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Fantasy Texture Pack/Data/x32Data.pck b/Minecraft.Client/DurangoMedia/DLC/Fantasy Texture Pack/Data/x32Data.pck index 64618ef7a..707b88a50 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Fantasy Texture Pack/Data/x32Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Fantasy Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Halloween Texture Pack/Data/x16Data.pck b/Minecraft.Client/DurangoMedia/DLC/Halloween Texture Pack/Data/x16Data.pck index 719d0e282..4d8615afb 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Halloween Texture Pack/Data/x16Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Halloween Texture Pack/Data/x16Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Halo/Data/x16Data.pck b/Minecraft.Client/DurangoMedia/DLC/Halo/Data/x16Data.pck index eeea0eaa7..d957bfb73 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Halo/Data/x16Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Halo/Data/x16Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Mass Effect/Data/x16Data.pck b/Minecraft.Client/DurangoMedia/DLC/Mass Effect/Data/x16Data.pck index 1f03ff10c..08f4f3b44 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Mass Effect/Data/x16Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Mass Effect/Data/x16Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Natural Texture Pack/Data/x32Data.pck b/Minecraft.Client/DurangoMedia/DLC/Natural Texture Pack/Data/x32Data.pck index cafb05e09..faa22e80c 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Natural Texture Pack/Data/x32Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Natural Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Plastic Texture Pack/Data/x16Data.pck b/Minecraft.Client/DurangoMedia/DLC/Plastic Texture Pack/Data/x16Data.pck index 979f75c8b..7255afcb5 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Plastic Texture Pack/Data/x16Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Plastic Texture Pack/Data/x16Data.pck differ diff --git a/Minecraft.Client/DurangoMedia/DLC/Skyrim/Data/x16Data.pck b/Minecraft.Client/DurangoMedia/DLC/Skyrim/Data/x16Data.pck index 66a1be365..e78564c9c 100644 Binary files a/Minecraft.Client/DurangoMedia/DLC/Skyrim/Data/x16Data.pck and b/Minecraft.Client/DurangoMedia/DLC/Skyrim/Data/x16Data.pck differ diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index adc230eea..0d7d424c6 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -54,13 +54,13 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) addEntity(e, 16 * 4, 10, true); else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) addEntity(e, 16 * 4, 10, true); else if (e->instanceof(eTYPE_ITEMENTITY)) addEntity(e, 16 * 4, 20, true); - else if (e->instanceof(eTYPE_MINECART)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_BOAT)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 3, true); - else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 3, false); - else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 3, false); - else if (dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 3, true); + else if (e->instanceof(eTYPE_MINECART)) addEntity(e, 16 * 5, 1, true); + else if (e->instanceof(eTYPE_BOAT)) addEntity(e, 16 * 5, 1, true); + else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 1, true); + else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 1, false); + else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 1, false); + else if (dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 1, true); + else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 1, true); else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); else if (e->instanceof(eTYPE_HANGING_ENTITY)) addEntity(e, 16 * 10, INT_MAX, false); @@ -245,4 +245,4 @@ shared_ptr EntityTracker::getTracker(shared_ptr e) return it->second; } return nullptr; -} \ No newline at end of file +} diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index 1e1ca1dde..782537051 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -548,7 +548,7 @@ void ItemInHandRenderer::render(float a) glPushMatrix(); float d = 0.8f; -#if defined __ORBIS__ || defined __PS3__ +#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 diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 19ee79bdb..3cc9ac59c 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1485,7 +1485,7 @@ void Minecraft::run_middle() } // Utility keys always work regardless of KBM active state - if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i)) + if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i) && !ui.GetMenuDisplayed(i)) { localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, x, y, z, oldTile->id + (level->getData(x, y, z) << Tile::TILE_NUM_SHIFT)); - return true; } #endif diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl index e827cd823..df42488c6 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -973,6 +973,9 @@ void gdraw_D3D1X_(SetRendertargetSize)(S32 w, S32 h) void gdraw_D3D1X_(SetTileOrigin)(ID3D1X(RenderTargetView) *main_rt, ID3D1X(DepthStencilView) *main_ds, ID3D1X(ShaderResourceView) *non_msaa_rt, S32 x, S32 y) { + + if (!gdraw) return; // AAR - saftey check because windows calls resize early + D3D1X_(RENDER_TARGET_VIEW_DESC) desc; if (gdraw->frame_done) { diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index 89a028b10..5945b26a5 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -30,6 +30,7 @@ public: static const int KEY_PAUSE = VK_ESCAPE; static const int KEY_THIRD_PERSON = VK_F5; static const int KEY_DEBUG_INFO = VK_F3; + static const int KEY_DEBUG_MENU = VK_F4; void Init(); void Tick(); diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 0f83fae57..d38ad4423 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -88,8 +88,7 @@ BOOL g_bWidescreen = TRUE; int g_iScreenWidth = 1920; int g_iScreenHeight = 1080; -UINT g_ScreenWidth = 1920; -UINT g_ScreenHeight = 1080; +float g_iAspectRatio = static_cast(g_iScreenWidth) / g_iScreenHeight; char g_Win64Username[17] = { 0 }; wchar_t g_Win64UsernameW[17] = { 0 }; @@ -98,6 +97,14 @@ wchar_t g_Win64UsernameW[17] = { 0 }; static bool g_isFullscreen = false; static WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) }; +//-------------------------------------------------------------------------------------- +// Update the Aspect Ratio to support Any Aspect Ratio +//-------------------------------------------------------------------------------------- +void UpdateAspectRatio(int width, int height) +{ + g_iAspectRatio = static_cast(width) / height; +} + struct Win64LaunchOptions { int screenMode; @@ -117,6 +124,50 @@ static void CopyWideArgToAnsi(LPCWSTR source, char* dest, size_t destSize) dest[destSize - 1] = 0; } +// ---------- Persistent options (options.txt next to exe) ---------- +static void GetOptionsFilePath(char *out, size_t outSize) +{ + GetModuleFileNameA(NULL, out, (DWORD)outSize); + char *p = strrchr(out, '\\'); + if (p) *(p + 1) = '\0'; + strncat_s(out, outSize, "options.txt", _TRUNCATE); +} + +static void SaveFullscreenOption(bool fullscreen) +{ + char path[MAX_PATH]; + GetOptionsFilePath(path, sizeof(path)); + FILE *f = nullptr; + if (fopen_s(&f, path, "w") == 0 && f) + { + fprintf(f, "fullscreen=%d\n", fullscreen ? 1 : 0); + fclose(f); + } +} + +static bool LoadFullscreenOption() +{ + char path[MAX_PATH]; + GetOptionsFilePath(path, sizeof(path)); + FILE *f = nullptr; + if (fopen_s(&f, path, "r") == 0 && f) + { + char line[256]; + while (fgets(line, sizeof(line), f)) + { + int val = 0; + if (sscanf_s(line, "fullscreen=%d", &val) == 1) + { + fclose(f); + return val != 0; + } + } + fclose(f); + } + return false; +} +// ------------------------------------------------------------------ + static void ApplyScreenMode(int screenMode) { switch (screenMode) @@ -468,6 +519,7 @@ ID3D11Texture2D* g_pDepthStencilBuffer = NULL; // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return +// WM_SIZE - handle resizing logic to support Any Aspect Ratio // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -585,6 +637,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } } break; + case WM_SIZE: + { + UpdateAspectRatio(LOWORD(lParam), HIWORD(lParam)); + } + break; default: return DefWindowProc(hWnd, message, wParam, lParam); } @@ -651,7 +708,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) return FALSE; } - ShowWindow(g_hWnd, nCmdShow); + ShowWindow(g_hWnd, (nCmdShow != SW_HIDE) ? SW_SHOWMAXIMIZED : nCmdShow); UpdateWindow(g_hWnd); return TRUE; @@ -719,7 +776,7 @@ HRESULT InitDevice() //app.DebugPrintf("width: %d, height: %d\n", width, height); width = g_iScreenWidth; height = g_iScreenHeight; -app.DebugPrintf("width: %d, height: %d\n", width, height); +//app.DebugPrintf("width: %d, height: %d\n", width, height); UINT createDeviceFlags = 0; #ifdef _DEBUG @@ -860,6 +917,7 @@ void ToggleFullscreen() SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); } g_isFullscreen = !g_isFullscreen; + SaveFullscreenOption(g_isFullscreen); if (g_KBMInput.IsWindowFocused()) g_KBMInput.SetWindowFocused(true); @@ -1180,6 +1238,12 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, return 0; } + // Restore fullscreen state from previous session + if (LoadFullscreenOption() && !g_isFullscreen) + { + ToggleFullscreen(); + } + if (launchOptions.serverMode) { int serverResult = RunHeadlessServer(); @@ -1505,19 +1569,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } #ifdef _DEBUG_MENUS_ENABLED - // F4 Open debug overlay - if (g_KBMInput.IsKeyPressed(VK_F4)) - { - if (Minecraft *pMinecraft = Minecraft::GetInstance()) - { - if (pMinecraft->options && - app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL) - { - ui.NavigateToScene(0, eUIScene_DebugOverlay, NULL, eUILayer_Debug); - } - } - } - // F6 Open debug console if (g_KBMInput.IsKeyPressed(VK_F6)) { diff --git a/Minecraft.Client/Windows64Media/DLC/Candy Texture Pack/Data/x16Data.pck b/Minecraft.Client/Windows64Media/DLC/Candy Texture Pack/Data/x16Data.pck index a282f83ab..e563879f0 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Candy Texture Pack/Data/x16Data.pck and b/Minecraft.Client/Windows64Media/DLC/Candy Texture Pack/Data/x16Data.pck differ diff --git a/Minecraft.Client/Windows64Media/DLC/City Texture Pack/Data/x32Data.pck b/Minecraft.Client/Windows64Media/DLC/City Texture Pack/Data/x32Data.pck index 0d9f13c98..63aba9a10 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/City Texture Pack/Data/x32Data.pck and b/Minecraft.Client/Windows64Media/DLC/City Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/Windows64Media/DLC/Fantasy Texture Pack/Data/x32Data.pck b/Minecraft.Client/Windows64Media/DLC/Fantasy Texture Pack/Data/x32Data.pck index 702045319..e42a1ab3f 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Fantasy Texture Pack/Data/x32Data.pck and b/Minecraft.Client/Windows64Media/DLC/Fantasy Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/Windows64Media/DLC/Halloween Texture Pack/Data/x16Data.pck b/Minecraft.Client/Windows64Media/DLC/Halloween Texture Pack/Data/x16Data.pck index 6d1f4da85..afedf110c 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Halloween Texture Pack/Data/x16Data.pck and b/Minecraft.Client/Windows64Media/DLC/Halloween Texture Pack/Data/x16Data.pck differ diff --git a/Minecraft.Client/Windows64Media/DLC/Natural Texture Pack/Data/x32Data.pck b/Minecraft.Client/Windows64Media/DLC/Natural Texture Pack/Data/x32Data.pck index 5bc5b54af..c5f592c42 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Natural Texture Pack/Data/x32Data.pck and b/Minecraft.Client/Windows64Media/DLC/Natural Texture Pack/Data/x32Data.pck differ diff --git a/Minecraft.Client/Windows64Media/DLC/Plastic Texture Pack/Data/x16Data.pck b/Minecraft.Client/Windows64Media/DLC/Plastic Texture Pack/Data/x16Data.pck index 57b913bcf..adf5d39ca 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Plastic Texture Pack/Data/x16Data.pck and b/Minecraft.Client/Windows64Media/DLC/Plastic Texture Pack/Data/x16Data.pck differ diff --git a/Minecraft.Client/Windows64Media/Media/logo-original.png b/Minecraft.Client/Windows64Media/Media/logo-original.png new file mode 100644 index 000000000..3d1637f87 Binary files /dev/null and b/Minecraft.Client/Windows64Media/Media/logo-original.png differ diff --git a/Minecraft.Client/Windows64Media/Media/logo-tempscaled.png b/Minecraft.Client/Windows64Media/Media/logo-tempscaled.png new file mode 100644 index 000000000..ad2839b9b Binary files /dev/null and b/Minecraft.Client/Windows64Media/Media/logo-tempscaled.png differ diff --git a/Minecraft.Client/Windows64Media/Media/skinHDWin.swf b/Minecraft.Client/Windows64Media/Media/skinHDWin.swf index a5cc720a5..6d1a79fa4 100644 Binary files a/Minecraft.Client/Windows64Media/Media/skinHDWin.swf and b/Minecraft.Client/Windows64Media/Media/skinHDWin.swf differ diff --git a/Minecraft.Client/glWrapper.cpp b/Minecraft.Client/glWrapper.cpp index 540271b91..a356e674c 100644 --- a/Minecraft.Client/glWrapper.cpp +++ b/Minecraft.Client/glWrapper.cpp @@ -48,13 +48,11 @@ void glLoadIdentity() RenderManager.MatrixSetIdentity(); } -extern int g_iScreenWidth; -extern int g_iScreenHeight; - +// AAR - Use calculated aspect ratio to support dynamic resizing +extern float g_iAspectRatio; void gluPerspective(float fovy, float aspect, float zNear, float zFar) { - float dynamicAspect = (float)g_iScreenWidth / (float)g_iScreenHeight; - RenderManager.MatrixPerspective(fovy, dynamicAspect, zNear, zFar); + RenderManager.MatrixPerspective(fovy, g_iAspectRatio, zNear, zFar); } void glOrtho(float left,float right,float bottom,float top,float zNear,float zFar) diff --git a/Minecraft.World/ItemDispenseBehaviors.cpp b/Minecraft.World/ItemDispenseBehaviors.cpp index f66afe31b..08c73a0c1 100644 --- a/Minecraft.World/ItemDispenseBehaviors.cpp +++ b/Minecraft.World/ItemDispenseBehaviors.cpp @@ -288,10 +288,10 @@ shared_ptr FilledBucketDispenseBehavior::execute(BlockSource *sour return dispensed; } - return DefaultDispenseItemBehavior::dispense(source, dispensed); + outcome = LEFT_ITEM; + return dispensed; } - /* EmptyBucket */ shared_ptr EmptyBucketDispenseBehavior::execute(BlockSource *source, shared_ptr dispensed, eOUTCOME &outcome) @@ -454,4 +454,4 @@ shared_ptr TntDispenseBehavior::execute(BlockSource *source, share outcome = LEFT_ITEM; } return dispensed; -} \ No newline at end of file +} diff --git a/Minecraft.World/PanicGoal.cpp b/Minecraft.World/PanicGoal.cpp index 564fa59da..cb9fc3f3a 100644 --- a/Minecraft.World/PanicGoal.cpp +++ b/Minecraft.World/PanicGoal.cpp @@ -10,17 +10,24 @@ PanicGoal::PanicGoal(PathfinderMob *mob, double speedModifier) { this->mob = mob; this->speedModifier = speedModifier; - setRequiredControlFlags(Control::MoveControlFlag); + Goal::setRequiredControlFlags(Control::MoveControlFlag); } bool PanicGoal::canUse() { - if (mob->getLastHurtByMob() == NULL && !mob->isOnFire()) return false; - Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 5, 4); - if (pos == NULL) return false; + if (mob->getLastHurtByMob() == nullptr && !mob->isOnFire()) return false; + const int hurtTimeout = mob->getLastHurtByMobTimestamp(); + if (hurtTimeout == 0) return false; + static thread_local std::mt19937 rng(std::random_device{}()); + std::uniform_int_distribution dist(60, 100); + const int panicDuration = dist(rng); + if (mob->tickCount - hurtTimeout > panicDuration) return false; + const Vec3* pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 5, 4); + if (pos == nullptr) return false; posX = pos->x; posY = pos->y; posZ = pos->z; + return true; } @@ -31,5 +38,6 @@ void PanicGoal::start() bool PanicGoal::canContinueToUse() { + if (mob->getLastHurtByMob() == nullptr && !mob->isOnFire()) return false; return !mob->getNavigation()->isDone(); } \ No newline at end of file diff --git a/Minecraft.World/PanicGoal.h b/Minecraft.World/PanicGoal.h index 2db64a75e..65a4e6d83 100644 --- a/Minecraft.World/PanicGoal.h +++ b/Minecraft.World/PanicGoal.h @@ -1,6 +1,7 @@ #pragma once #include "Goal.h" +#include class PathfinderMob; diff --git a/Minecraft.World/SignTileEntity.cpp b/Minecraft.World/SignTileEntity.cpp index 74adc8ccc..dc189102b 100644 --- a/Minecraft.World/SignTileEntity.cpp +++ b/Minecraft.World/SignTileEntity.cpp @@ -166,9 +166,15 @@ void SignTileEntity::setChanged() void SignTileEntity::SetMessage(int iIndex,wstring &wsText) -{ +{ + if (wsText.length() > MAX_LINE_LENGTH) // MAX_LINE_LENGTH == 15 + { + wsText = wsText.substr(0, MAX_LINE_LENGTH); +#ifdef _DEBUG + OutputDebugStringW(L"Sign text truncated to 15 characters\n"); +#endif + } m_wsmessages[iIndex]=wsText; - } // 4J-PB - added for string verification diff --git a/Minecraft.World/WitherBoss.cpp b/Minecraft.World/WitherBoss.cpp index 676f07d94..84cf13825 100644 --- a/Minecraft.World/WitherBoss.cpp +++ b/Minecraft.World/WitherBoss.cpp @@ -535,7 +535,7 @@ void WitherBoss::registerAttributes() getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.6f); // 4J Stu - Don't make it so far! - //getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40); + getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40); } float WitherBoss::getHeadYRot(int i) @@ -581,4 +581,4 @@ MobType WitherBoss::getMobType() void WitherBoss::ride(shared_ptr e) { riding = nullptr; -} \ No newline at end of file +} diff --git a/Minecraft.World/Zombie.cpp b/Minecraft.World/Zombie.cpp index df9d5c6b7..7cdc31809 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -56,7 +56,7 @@ void Zombie::registerAttributes() Monster::registerAttributes(); // 4J Stu - Don't make it so far! - //getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40); + getAttribute(SharedMonsterAttributes::FOLLOW_RANGE)->setBaseValue(40); getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.23f); getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->setBaseValue(3); @@ -490,4 +490,4 @@ Zombie::ZombieGroupData::ZombieGroupData(bool baby, bool villager) { isBaby = baby; isVillager = villager; -} \ No newline at end of file +} diff --git a/cmake/CopyAssets.cmake b/cmake/CopyAssets.cmake deleted file mode 100644 index a0252f730..000000000 --- a/cmake/CopyAssets.cmake +++ /dev/null @@ -1,107 +0,0 @@ -if(NOT DEFINED PROJECT_SOURCE_DIR OR NOT DEFINED OUTPUT_DIR OR NOT DEFINED CONFIGURATION) - message(FATAL_ERROR "CopyAssets.cmake requires PROJECT_SOURCE_DIR, OUTPUT_DIR, and CONFIGURATION.") -endif() - -# Some generators may pass quoted values (e.g. "Debug"); normalize that. -string(REPLACE "\"" "" PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}") -string(REPLACE "\"" "" OUTPUT_DIR "${OUTPUT_DIR}") -string(REPLACE "\"" "" CONFIGURATION "${CONFIGURATION}") - -set(_project_dir "${PROJECT_SOURCE_DIR}/Minecraft.Client") - -function(copy_tree_if_exists src_rel dst_rel) - set(_src "${_project_dir}/${src_rel}") - set(_dst "${OUTPUT_DIR}/${dst_rel}") - - if(EXISTS "${_src}") - file(MAKE_DIRECTORY "${_dst}") - file(GLOB_RECURSE _files RELATIVE "${_src}" "${_src}/*") - - foreach(_file IN LISTS _files) # if not a source file - if(NOT _file MATCHES "\\.(cpp|c|h|hpp|xml|lang)$") - set(_full_src "${_src}/${_file}") - set(_full_dst "${_dst}/${_file}") - - if(IS_DIRECTORY "${_full_src}") - file(MAKE_DIRECTORY "${_full_dst}") - else() - get_filename_component(_dst_dir "${_full_dst}" DIRECTORY) - file(MAKE_DIRECTORY "${_dst_dir}") - execute_process( - COMMAND "${CMAKE_COMMAND}" -E copy_if_different - "${_full_src}" "${_full_dst}" - ) - endif() - endif() - endforeach() - endif() -endfunction() - -function(ensure_dir rel_path) - file(MAKE_DIRECTORY "${OUTPUT_DIR}/${rel_path}") -endfunction() - -function(copy_file_if_exists src_rel dst_rel) - set(_src "${PROJECT_SOURCE_DIR}/${src_rel}") - set(_dst "${OUTPUT_DIR}/${dst_rel}") - - get_filename_component(_dst_dir "${_dst}" DIRECTORY) - file(MAKE_DIRECTORY "${_dst_dir}") - - if(EXISTS "${_src}") - execute_process( - COMMAND "${CMAKE_COMMAND}" -E copy_if_different - "${_src}" "${_dst}" - ) - endif() -endfunction() - -function(copy_first_existing dst_rel) - set(_copied FALSE) - foreach(_candidate IN LISTS ARGN) - if(EXISTS "${PROJECT_SOURCE_DIR}/${_candidate}") - copy_file_if_exists("${_candidate}" "${dst_rel}") - set(_copied TRUE) - break() - endif() - endforeach() - if(NOT _copied) - message(WARNING "Runtime file not found for ${dst_rel}. Checked: ${ARGN}") - endif() -endfunction() - -function(remove_directory_if_exists rel_path) - set(_dir "${OUTPUT_DIR}/${rel_path}") - if(EXISTS "${_dir}") - file(REMOVE_RECURSE "${_dir}") - endif() -endfunction() - -copy_tree_if_exists("Durango/Sound" "Windows64/Sound") -copy_tree_if_exists("music" "music") -copy_tree_if_exists("Windows64/GameHDD" "Windows64/GameHDD") -copy_file_if_exists("Minecraft.Client/Common/Media/MediaWindows64.arc" "Common/Media/MediaWindows64.arc") -copy_tree_if_exists("Common/res" "Common/res") -copy_tree_if_exists("Common/Trial" "Common/Trial") -copy_tree_if_exists("Common/Tutorial" "Common/Tutorial") -copy_tree_if_exists("DurangoMedia" "Windows64Media") -copy_tree_if_exists("Windows64Media" "Windows64Media") - -remove_directory_if_exists("Windows64Media/Layout") - -# Some runtime code asserts if this directory tree is missing. -ensure_dir("Windows64/GameHDD") - -# Keep legacy runtime redistributables in a familiar location. -copy_tree_if_exists("Windows64/Miles/lib/redist64" "redist64") -copy_tree_if_exists("Windows64/Iggy/lib/redist64" "redist64") - -# Runtime DLLs required at launch. -copy_first_existing("iggy_w64.dll" - "Minecraft.Client/Windows64/Iggy/lib/redist64/iggy_w64.dll" - "x64/${CONFIGURATION}/iggy_w64.dll" -) -copy_first_existing("mss64.dll" - "Minecraft.Client/Windows64/Miles/lib/redist64/mss64.dll" - "x64/${CONFIGURATION}/mss64.dll" -)