From 7827dd8d5a2a7db0e449392eaafb2aa8352e1176 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sun, 21 Nov 2021 16:28:42 +0000 Subject: Adapt to newest dependencies --- CMakeLists.txt | 16 +++- buildlx/make_debug_client_linux_clang_2_copy.sh | 6 +- buildrel/copylibs.sh | 97 ++++++++++++++----------- extlibs/SSVUtils | 2 +- include/SSVOpenHexagon/Global/PCH.hpp | 5 ++ include/SSVOpenHexagon/Global/Version.hpp | 1 + include/SSVOpenHexagon/Utils/Color.hpp | 28 ++++++- include/SSVOpenHexagon/Utils/UniquePtr.hpp | 10 +++ src/SSVOpenHexagon/Core/HGGraphics.cpp | 26 +++---- src/SSVOpenHexagon/Core/HexagonGame.cpp | 12 +-- src/SSVOpenHexagon/Core/MenuGame.cpp | 25 +++---- src/SSVOpenHexagon/Core/main.cpp | 2 +- src/SSVOpenHexagon/Global/Assets.cpp | 40 +++++----- src/SSVOpenHexagon/Global/Config.cpp | 4 +- 14 files changed, 166 insertions(+), 108 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebe926df..ed05e4b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,18 @@ cmake_minimum_required(VERSION 3.9) +# +# +# ----------------------------------------------------------------------------- +# Produce Lua Metadata +# ----------------------------------------------------------------------------- + +if(FALSE) + set(SSVOH_PRODUCE_LUA_METADATA TRUE) + add_definitions(-DSSVOH_PRODUCE_LUA_METADATA) +else() + set(SSVOH_PRODUCE_LUA_METADATA FALSE) +endif() + # # # ----------------------------------------------------------------------------- @@ -82,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG c815ee19e42c313edee37f395f75aae88f4a6762 + GIT_TAG 1f30120edea67acf7b4e5c8136cf95f920876db2 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) @@ -264,6 +277,7 @@ message(STATUS "initialized project ${PROJECT_NAME}") # ----------------------------------------------------------------------------- set(CMAKE_UNITY_BUILD ON) +set(CMAKE_UNITY_BUILD_BATCH_SIZE 4) # # diff --git a/buildlx/make_debug_client_linux_clang_2_copy.sh b/buildlx/make_debug_client_linux_clang_2_copy.sh index ea1336ea..736efba4 100755 --- a/buildlx/make_debug_client_linux_clang_2_copy.sh +++ b/buildlx/make_debug_client_linux_clang_2_copy.sh @@ -7,9 +7,9 @@ echo "" echo "--------------------------------------------------------------------" echo "| COPYING ALL EXECUTABLES TO _RELEASE FOLDER |" echo "--------------------------------------------------------------------" -cp ./SSVOpenHexagon.exe ../_RELEASE -cp ./OHWorkshopUploader.exe ../_RELEASE -cp ./OHServerControl.exe ../_RELEASE +cp ./SSVOpenHexagon ../_RELEASE +cp ./OHWorkshopUploader ../_RELEASE +cp ./OHServerControl ../_RELEASE echo "" echo "" diff --git a/buildrel/copylibs.sh b/buildrel/copylibs.sh index a9255f3c..3d3742d3 100644 --- a/buildrel/copylibs.sh +++ b/buildrel/copylibs.sh @@ -1,57 +1,70 @@ #!/bin/bash -cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll ../_RELEASE/ -cp ./_deps/imgui-sfml-build/libImGui-SFML.dll ../_RELEASE/ +cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll ../_RELEASE/ & +cp ./_deps/imgui-sfml-build/libImGui-SFML.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-graphics-d-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/libsfml-system-d-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/libsfml-window-d-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/libsfml-network-d-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/libsfml-audio-d-2.dll ../_RELEASE/ +cp ./_deps/sfml-build/lib/libsfml-graphics-d-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-system-d-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-window-d-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-network-d-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-audio-d-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/sfml-graphics-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/sfml-system-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/sfml-window-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/sfml-network-2.dll ../_RELEASE/ -cp ./_deps/sfml-build/lib/sfml-audio-2.dll ../_RELEASE/ +cp ./_deps/sfml-build/lib/sfml-graphics-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-system-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-window-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-network-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-audio-2.dll ../_RELEASE/ & -cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll ../_RELEASE/ -cp ./_deps/libsodium-cmake-build/libsodium.dll ../_RELEASE/ -cp ./_deps/luajit-build/src/libluajit.dll ../_RELEASE/ -cp ./_deps/zlib-build/libzlib1.dll ../_RELEASE/ +cp ./_deps/sfml-build/lib/libsfml-graphics-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-system-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-window-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-network-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-audio-2.dll ../_RELEASE/ & -cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll ./test/ -cp ./_deps/imgui-sfml-build/libImGui-SFML.dll ./test/ +cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll ../_RELEASE/ & +cp ./_deps/libsodium-cmake-build/libsodium.dll ../_RELEASE/ & +cp ./_deps/luajit-build/src/libluajit.dll ../_RELEASE/ & +cp ./_deps/zlib-build/libzlib1.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-graphics-d-2.dll ./test/ -cp ./_deps/sfml-build/lib/libsfml-system-d-2.dll ./test/ -cp ./_deps/sfml-build/lib/libsfml-window-d-2.dll ./test/ -cp ./_deps/sfml-build/lib/libsfml-network-d-2.dll ./test/ -cp ./_deps/sfml-build/lib/libsfml-audio-d-2.dll ./test/ +cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll ./test/ & +cp ./_deps/imgui-sfml-build/libImGui-SFML.dll ./test/ & -cp ./_deps/sfml-build/lib/sfml-graphics-2.dll ./test/ -cp ./_deps/sfml-build/lib/sfml-system-2.dll ./test/ -cp ./_deps/sfml-build/lib/sfml-window-2.dll ./test/ -cp ./_deps/sfml-build/lib/sfml-network-2.dll ./test/ -cp ./_deps/sfml-build/lib/sfml-audio-2.dll ./test/ +cp ./_deps/sfml-build/lib/libsfml-graphics-d-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-system-d-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-window-d-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-network-d-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-audio-d-2.dll ./test/ & -cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll ./test/ -cp ./_deps/libsodium-cmake-build/libsodium.dll ./test/ -cp ./_deps/luajit-build/src/libluajit.dll ./test/ -cp ./_deps/zlib-build/libzlib1.dll ./test/ +cp ./_deps/sfml-build/lib/sfml-graphics-2.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-system-2.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-window-2.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-network-2.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-audio-2.dll ./test/ & -cp /c/msys64/mingw64/bin/libssp-0.dll ../_RELEASE/ -cp /c/msys64/mingw64/bin/libssp-0.dll ./test/ +cp ./_deps/sfml-build/lib/libsfml-graphics-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-system-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-window-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-network-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-audio-2.dll ./test/ & -cp /c/msys64/mingw64/bin/libstdc++-6.dll ../_RELEASE/ -cp /c/msys64/mingw64/bin/libstdc++-6.dll ./test/ +cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll ./test/ & +cp ./_deps/libsodium-cmake-build/libsodium.dll ./test/ & +cp ./_deps/luajit-build/src/libluajit.dll ./test/ & +cp ./_deps/zlib-build/libzlib1.dll ./test/ & -cp /c/msys64/mingw64/bin/libgcc_s_seh-1.dll ../_RELEASE/ -cp /c/msys64/mingw64/bin/libgcc_s_seh-1.dll ./test/ +cp /c/msys64/mingw64/bin/libssp-0.dll ../_RELEASE/ & +cp /c/msys64/mingw64/bin/libssp-0.dll ./test/ & -cp /c/msys64/mingw64/bin/libwinpthread-1.dll ../_RELEASE/ -cp /c/msys64/mingw64/bin/libwinpthread-1.dll ./test/ +cp /c/msys64/mingw64/bin/libstdc++-6.dll ../_RELEASE/ & +cp /c/msys64/mingw64/bin/libstdc++-6.dll ./test/ & -cp ../_RELEASE/discord_game_sdk.dll ./test -cp ../_RELEASE/steam_api64.dll ./test +cp /c/msys64/mingw64/bin/libgcc_s_seh-1.dll ../_RELEASE/ & +cp /c/msys64/mingw64/bin/libgcc_s_seh-1.dll ./test/ & +cp /c/msys64/mingw64/bin/libwinpthread-1.dll ../_RELEASE/ & +cp /c/msys64/mingw64/bin/libwinpthread-1.dll ./test/ & + +cp ../_RELEASE/discord_game_sdk.dll ./test & +cp ../_RELEASE/steam_api64.dll ./test & + +wait diff --git a/extlibs/SSVUtils b/extlibs/SSVUtils index 556ea218..dafa2499 160000 --- a/extlibs/SSVUtils +++ b/extlibs/SSVUtils @@ -1 +1 @@ -Subproject commit 556ea2182ac332b77c760f894754a5a9414bbe38 +Subproject commit dafa2499bcd350c3bfdbfb84d522e022c3513a93 diff --git a/include/SSVOpenHexagon/Global/PCH.hpp b/include/SSVOpenHexagon/Global/PCH.hpp index 98a8404f..6712143a 100644 --- a/include/SSVOpenHexagon/Global/PCH.hpp +++ b/include/SSVOpenHexagon/Global/PCH.hpp @@ -4,6 +4,11 @@ #pragma once +#ifdef _WIN32 +#define NOMINMAX +#include +#endif + #include #include #include diff --git a/include/SSVOpenHexagon/Global/Version.hpp b/include/SSVOpenHexagon/Global/Version.hpp index 508e7b6f..72d9e4f3 100644 --- a/include/SSVOpenHexagon/Global/Version.hpp +++ b/include/SSVOpenHexagon/Global/Version.hpp @@ -43,6 +43,7 @@ struct GameVersion } }; +// TODO (P0): bump this version inline constexpr GameVersion GAME_VERSION{2, 1, 3}; inline constexpr auto& GAME_VERSION_STR = "2.1.3"; diff --git a/include/SSVOpenHexagon/Utils/Color.hpp b/include/SSVOpenHexagon/Utils/Color.hpp index 96a81e94..4d01fbb9 100644 --- a/include/SSVOpenHexagon/Utils/Color.hpp +++ b/include/SSVOpenHexagon/Utils/Color.hpp @@ -7,13 +7,14 @@ #include "SSVOpenHexagon/Global/Assert.hpp" #include +#include #include namespace hg::Utils { [[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Color getColorDarkened( - sf::Color mColor, const float mMultiplier) + sf::Color mColor, const float mMultiplier) noexcept { SSVOH_ASSERT(mMultiplier != 0.f); @@ -25,7 +26,7 @@ namespace hg::Utils { } [[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Color transformHue( - const sf::Color& in, const float H) + const sf::Color& in, const float H) noexcept { const float u{std::cos(H * 3.14f / 180.f)}; const float w{std::sin(H * 3.14f / 180.f)}; @@ -74,8 +75,8 @@ namespace hg::Utils { return ret(1.f, 0.f, q); } -[[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Uint8 componentClamp( - const float value) +[[nodiscard, gnu::always_inline, gnu::pure]] inline constexpr sf::Uint8 +componentClamp(const float value) noexcept { if(value > 255.f) { @@ -90,4 +91,23 @@ namespace hg::Utils { return static_cast(value); } +[[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Glsl::Vec3 toGLSLVec3( + const sf::Color& color) noexcept +{ + return {// + static_cast(color.r) / 255.f, + static_cast(color.g) / 255.f, + static_cast(color.b) / 255.f}; +} + +[[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Glsl::Vec4 toGLSLVec4( + const sf::Color& color) noexcept +{ + return {// + static_cast(color.r) / 255.f, + static_cast(color.g) / 255.f, + static_cast(color.b) / 255.f, + static_cast(color.a) / 255.f}; +} + } // namespace hg::Utils diff --git a/include/SSVOpenHexagon/Utils/UniquePtr.hpp b/include/SSVOpenHexagon/Utils/UniquePtr.hpp index 7f474134..7262c235 100644 --- a/include/SSVOpenHexagon/Utils/UniquePtr.hpp +++ b/include/SSVOpenHexagon/Utils/UniquePtr.hpp @@ -37,6 +37,16 @@ public: rhs._ptr = nullptr; } + [[nodiscard, gnu::always_inline]] T* get() noexcept + { + return _ptr; + } + + [[nodiscard, gnu::always_inline]] const T* get() const noexcept + { + return _ptr; + } + [[nodiscard, gnu::always_inline]] T& operator*() noexcept { SSVOH_ASSERT(_ptr != nullptr); diff --git a/src/SSVOpenHexagon/Core/HGGraphics.cpp b/src/SSVOpenHexagon/Core/HGGraphics.cpp index f7bad7b5..54bd211e 100644 --- a/src/SSVOpenHexagon/Core/HGGraphics.cpp +++ b/src/SSVOpenHexagon/Core/HGGraphics.cpp @@ -80,7 +80,7 @@ void HexagonGame::draw() if(!Config::getNoBackground()) { - backgroundCamera->apply(*window); + window->setView(backgroundCamera->apply()); backgroundTris.clear(); @@ -93,7 +93,7 @@ void HexagonGame::draw() render(backgroundTris); } - backgroundCamera->apply(*window); + window->setView(backgroundCamera->apply()); wallQuads3D.clear(); pivotQuads3D.clear(); @@ -242,7 +242,7 @@ void HexagonGame::draw() render(pivotQuads); render(playerTris); - overlayCamera->apply(*window); + window->setView(overlayCamera->apply()); drawParticles(); drawText(); @@ -293,7 +293,7 @@ void HexagonGame::drawImguiLuaConsole() } SSVOH_ASSERT(overlayCamera.has_value()); - overlayCamera->unapply(*window); + window->setView(window->getRenderWindow().getDefaultView()); Imgui::render(*window); } @@ -509,7 +509,7 @@ void HexagonGame::updateText(ssvu::FT mFT) // Set information text text.setString(os.str()); text.setCharacterSize(getScaledCharacterSize(20.f)); - text.setOrigin(0, 0); + text.setOrigin({0.f, 0.f}); // Set FPS Text, if option is enabled. if(Config::getShowFPS()) @@ -519,11 +519,11 @@ void HexagonGame::updateText(ssvu::FT mFT) } messageText.setCharacterSize(getScaledCharacterSize(32.f)); - messageText.setOrigin(ssvs::getGlobalWidth(messageText) / 2.f, 0); + messageText.setOrigin({ssvs::getGlobalWidth(messageText) / 2.f, 0}); const float growth = std::sin(pbTextGrowth); pbText.setCharacterSize(getScaledCharacterSize(64.f) + growth * 10.f); - pbText.setOrigin(ssvs::getGlobalWidth(pbText) / 2.f, 0); + pbText.setOrigin({ssvs::getGlobalWidth(pbText) / 2.f, 0}); // ------------------------------------------------------------------------ if(mustShowReplayUI()) @@ -586,7 +586,7 @@ void HexagonGame::drawText_TimeAndStatus(const sf::Color& offsetColor) { timeText.setFillColor(colorText); timeText.setOrigin(ssvs::getLocalNW(timeText)); - timeText.setPosition(sf::Vector2f{padding, padding}); + timeText.setPosition({padding, padding}); render(timeText); } @@ -595,8 +595,7 @@ void HexagonGame::drawText_TimeAndStatus(const sf::Color& offsetColor) { text.setFillColor(colorText); text.setOrigin(ssvs::getLocalNW(text)); - text.setPosition( - sf::Vector2f{padding, ssvs::getGlobalBottom(timeText) + padding}); + text.setPosition({padding, ssvs::getGlobalBottom(timeText) + padding}); render(text); } @@ -608,13 +607,12 @@ void HexagonGame::drawText_TimeAndStatus(const sf::Color& offsetColor) if(Config::getShowLevelInfo() || mustShowReplayUI()) { - fpsText.setPosition(sf::Vector2f{ - padding, ssvs::getGlobalTop(levelInfoRectangle) - padding}); + fpsText.setPosition( + {padding, ssvs::getGlobalTop(levelInfoRectangle) - padding}); } else { - fpsText.setPosition( - sf::Vector2f{padding, Config::getHeight() - padding}); + fpsText.setPosition({padding, Config::getHeight() - padding}); } render(fpsText); diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index 8c73dedd..eb621791 100644 --- a/src/SSVOpenHexagon/Core/HexagonGame.cpp +++ b/src/SSVOpenHexagon/Core/HexagonGame.cpp @@ -119,10 +119,10 @@ void HexagonGame::updateKeyIcons() const float scaling = Config::getKeyIconsScale() / Config::getZoomFactor(); - keyIconLeft.setScale(scaling, scaling); - keyIconRight.setScale(scaling, scaling); - keyIconFocus.setScale(scaling, scaling); - keyIconSwap.setScale(scaling, scaling); + keyIconLeft.setScale({scaling, scaling}); + keyIconRight.setScale({scaling, scaling}); + keyIconFocus.setScale({scaling, scaling}); + keyIconSwap.setScale({scaling, scaling}); const float scaledHalfSize = halfSize * scaling; const float scaledSize = size * scaling; @@ -142,7 +142,7 @@ void HexagonGame::updateKeyIcons() // ------------------------------------------------------------------------ replayIcon.setOrigin({size, size}); - replayIcon.setScale(scaling / 2.f, scaling / 2.f); + replayIcon.setScale({scaling / 2.f, scaling / 2.f}); const sf::Vector2f topRight{Config::getWidth() - padding - scaledHalfSize, padding + scaledHalfSize}; @@ -166,7 +166,7 @@ void HexagonGame::updateLevelInfo() const sf::Vector2f scaledHalfSize{halfSize * scaling}; levelInfoRectangle.setSize(size); - levelInfoRectangle.setScale(scaling, scaling); + levelInfoRectangle.setScale({scaling, scaling}); const sf::Color offsetColor{ Config::getBlackAndWhite() || styleData.getColors().empty() diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index a0917902..aefbe89b 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -1777,8 +1777,7 @@ void MenuGame::playLocally() MenuGame::pickRandomMainMenuBackgroundStyle() { // If there is no `menubackgrounds.json` abort - if(!ssvufs::Path{"Assets/menubackgrounds.json"} - .exists()) + if(!ssvufs::Path{"Assets/menubackgrounds.json"}.isFile()) { ssvu::lo("MenuGame::$") << "File 'Assets/menubackgrounds.json' does not exist" << std::endl; @@ -3275,7 +3274,7 @@ void MenuGame::renderTextCentered( const std::string& mStr, sf::Text& mText, const sf::Vector2f& mPos) { mText.setString(mStr); - mText.setPosition(mPos.x - ssvs::getGlobalHalfWidth(mText), mPos.y); + mText.setPosition({mPos.x - ssvs::getGlobalHalfWidth(mText), mPos.y}); render(mText); } @@ -3311,7 +3310,7 @@ void MenuGame::renderTextCenteredOffset(const std::string& mStr, { mText.setString(mStr); mText.setPosition( - xOffset + mPos.x - ssvs::getGlobalHalfWidth(mText), mPos.y); + {xOffset + mPos.x - ssvs::getGlobalHalfWidth(mText), mPos.y}); render(mText); } @@ -5336,13 +5335,13 @@ void MenuGame::drawLevelSelectionLeftSide( const float difficultyBumpFactor = 1.f + ((difficultyBumpEffect / difficultyBumpEffectMax) * 0.25f); txtSelectionMedium.font.setScale( - difficultyBumpFactor, difficultyBumpFactor); + {difficultyBumpFactor, difficultyBumpFactor}); renderText(tempString, txtSelectionMedium.font, {textXPos + txtSelectionMedium.font.getGlobalBounds().width, difficultyHeight}); - txtSelectionMedium.font.setScale(1.f, 1.f); + txtSelectionMedium.font.setScale({1.f, 1.f}); // Bottom line height += txtSelectionMedium.height + textToQuadBorder + lineThickness; @@ -5706,7 +5705,7 @@ void MenuGame::draw() styleData.computeColors(); window.clear(sf::Color{0, 0, 0, 255}); - backgroundCamera.apply(window); + window.setView(backgroundCamera.apply()); const bool mainOrAbove{state >= States::SMain}; // Only draw the hexagon background past the loading screens. @@ -5723,7 +5722,7 @@ void MenuGame::draw() render(menuBackgroundTris); } - overlayCamera.apply(window); + window.setView(overlayCamera.apply()); // Draw the profile name. if(mainOrAbove && state != States::LevelSelection) @@ -5904,7 +5903,7 @@ void MenuGame::draw() if(!dialogBox.empty()) { - overlayCamera.apply(window); + window.setView(overlayCamera.apply()); dialogBox.draw(dialogBoxTextColor, styleData.getColor(0)); } @@ -6021,7 +6020,7 @@ void MenuGame::drawOnlineStatus() sOnline.setScale(sf::Vector2f{spriteScale, spriteScale}); sOnline.setOrigin(ssvs::getLocalSW(sOnline)); - sOnline.setPosition(0 + padding, getWindowHeight() - padding); + sOnline.setPosition({0 + padding, getWindowHeight() - padding}); rsOnlineStatus.setSize( sf::Vector2f{ssvs::getGlobalWidth(txtOnlineStatus) + padding * 4.f, @@ -6029,12 +6028,12 @@ void MenuGame::drawOnlineStatus() rsOnlineStatus.setFillColor(sf::Color::Black); rsOnlineStatus.setOrigin(ssvs::getLocalSW(rsOnlineStatus)); rsOnlineStatus.setPosition( - ssvs::getGlobalRight(sOnline) + padding, sOnline.getPosition().y); + {ssvs::getGlobalRight(sOnline) + padding, sOnline.getPosition().y}); txtOnlineStatus.setOrigin(ssvs::getLocalCenterW(txtOnlineStatus)); txtOnlineStatus.setPosition( - ssvs::getGlobalLeft(rsOnlineStatus) + padding * 2.f, - ssvs::getGlobalCenter(rsOnlineStatus).y); + {ssvs::getGlobalLeft(rsOnlineStatus) + padding * 2.f, + ssvs::getGlobalCenter(rsOnlineStatus).y}); render(sOnline); render(rsOnlineStatus); diff --git a/src/SSVOpenHexagon/Core/main.cpp b/src/SSVOpenHexagon/Core/main.cpp index b32f677f..7cc42208 100644 --- a/src/SSVOpenHexagon/Core/main.cpp +++ b/src/SSVOpenHexagon/Core/main.cpp @@ -64,7 +64,7 @@ void createFolderIfNonExistant(const std::string& folderName) { const ssvu::FileSystem::Path path{folderName}; - if(path.exists()) + if(path.isFolder()) { return; } diff --git a/src/SSVOpenHexagon/Global/Assets.cpp b/src/SSVOpenHexagon/Global/Assets.cpp index cfb4726c..ec951b68 100644 --- a/src/SSVOpenHexagon/Global/Assets.cpp +++ b/src/SSVOpenHexagon/Global/Assets.cpp @@ -127,7 +127,7 @@ HGAssets::HGAssets( if(!levelsOnly && !mHeadless) { - if(!ssvufs::Path{"Assets/"}.exists()) + if(!ssvufs::Path{"Assets/"}.isFolder()) { ssvu::lo("FATAL ERROR") << "Folder Assets/ does not exist" << std::endl; @@ -209,7 +209,7 @@ HGAssets::~HGAssets() [[nodiscard]] bool HGAssets::loadPackData(const ssvufs::Path& packPath) { - if(!ssvufs::Path{packPath + "/pack.json"}.exists()) + if(!ssvufs::Path{packPath + "/pack.json"}.isFile()) { return false; } @@ -298,25 +298,23 @@ HGAssets::~HGAssets() try { - if(ssvufs::Path{packPath + "Music/"}.exists() && - !levelsOnly) + if(ssvufs::Path{packPath + "Music/"}.isFolder() && !levelsOnly) { loadPackAssets_loadMusic(packId, packPath); loadPackAssets_loadMusicData(packId, packPath); } - if(ssvufs::Path{packPath + "Styles/"}.exists()) + if(ssvufs::Path{packPath + "Styles/"}.isFolder()) { loadPackAssets_loadStyleData(packId, packPath); } - if(ssvufs::Path{packPath + "Levels/"}.exists()) + if(ssvufs::Path{packPath + "Levels/"}.isFolder()) { loadPackAssets_loadLevelData(packId, packPath); } - if(!levelsOnly && - ssvufs::Path(packPath + "Sounds/").exists()) + if(!levelsOnly && ssvufs::Path(packPath + "Sounds/").isFolder()) { loadPackAssets_loadCustomSounds(packId, packPath); } @@ -457,7 +455,7 @@ HGAssets::getSelectablePackInfos() const noexcept [[nodiscard]] bool HGAssets::loadWorkshopPackDatasFromCache() { - if(!ssvufs::Path{"workshopCache.json"}.exists()) + if(!ssvufs::Path{"workshopCache.json"}.isFile()) { ssvu::lo("::loadAssets") << "Workshop cache file does not exist. No " "workshop packs to load\n"; @@ -510,7 +508,7 @@ HGAssets::getSelectablePackInfos() const noexcept [[nodiscard]] bool HGAssets::loadAllPackDatas() { - if(!ssvufs::Path{"Packs/"}.exists()) + if(!ssvufs::Path{"Packs/"}.isFolder()) { ssvu::lo("::loadAssets") << "Folder Packs/ does not exist" << std::endl; return false; @@ -643,7 +641,7 @@ void HGAssets::addLocalProfile(ProfileData&& profileData) [[nodiscard]] bool HGAssets::loadAllLocalProfiles() { - if(!ssvufs::Path{"Profiles/"}.exists()) + if(!ssvufs::Path{"Profiles/"}.isFolder()) { ssvu::lo("::loadAssets") << "Folder Profiles/ does not exist" << std::endl; @@ -849,7 +847,7 @@ void HGAssets::saveAllProfiles() // Levels, if there is not folder cancel everything temp = mPath + "Levels/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { return "invalid level folder path\n"; } @@ -873,7 +871,7 @@ void HGAssets::saveAllProfiles() // Styles temp = mPath + "Styles/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid style folder path\n"; } @@ -891,7 +889,7 @@ void HGAssets::saveAllProfiles() // Music data temp = mPath + "Music/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid music data folder path\n"; } @@ -910,7 +908,7 @@ void HGAssets::saveAllProfiles() // Music temp = mPath + "Music/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid music folder path\n"; } @@ -926,7 +924,7 @@ void HGAssets::saveAllProfiles() // Custom sounds temp = mPath + "Sounds/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid custom sound folder path\n"; } @@ -956,7 +954,7 @@ void HGAssets::saveAllProfiles() //******************************************* // Level temp = mPath + "Levels/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { return "invalid level folder path\n"; } @@ -987,7 +985,7 @@ void HGAssets::saveAllProfiles() //******************************************* // Style temp = mPath + "Styles/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid style folder path\n"; } @@ -1013,7 +1011,7 @@ void HGAssets::saveAllProfiles() //******************************************* // Music data temp = mPath + "Music/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid music folder path\n"; } @@ -1042,7 +1040,7 @@ void HGAssets::saveAllProfiles() // Music files std::string assetId; temp = mPath + "Music/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid music folder path\n"; } @@ -1070,7 +1068,7 @@ void HGAssets::saveAllProfiles() } temp = mPath + "Sounds/"; - if(!ssvufs::Path{temp}.exists()) + if(!ssvufs::Path{temp}.isFolder()) { output += "invalid custom sound folder path\n"; return output; diff --git a/src/SSVOpenHexagon/Global/Config.cpp b/src/SSVOpenHexagon/Global/Config.cpp index f7a1821f..bf08844e 100644 --- a/src/SSVOpenHexagon/Global/Config.cpp +++ b/src/SSVOpenHexagon/Global/Config.cpp @@ -254,7 +254,7 @@ namespace hg::Config { { static ssvuj::Obj res = [] { - if(ssvufs::Path{"config.json"}.exists()) + if(ssvufs::Path{"config.json"}.isFile()) { ssvu::lo("hg::Config::root()") << "User-defined `config.json` file found\n"; @@ -367,7 +367,7 @@ void loadConfig(const std::vector& mOverridesIds) { ssvu::lo("::loadConfig") << "loading config\n"; - if(ssvufs::Path{"ConfigOverrides/"}.exists()) + if(ssvufs::Path{"ConfigOverrides/"}.isFolder()) { for(const ssvufs::Path& p : ssvufs::getScan Date: Sun, 21 Nov 2021 16:35:12 +0000 Subject: Update dependencies --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed05e4b0..fda798b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG 1f30120edea67acf7b4e5c8136cf95f920876db2 + GIT_TAG 47129290bbf6f7ab689de1835146cd40118bb79d ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) @@ -117,7 +117,7 @@ set(LUAJIT_DISABLE_FFI ON CACHE BOOL "" FORCE) CPMAddPackage( NAME luajit GIT_REPOSITORY https://github.com/SuperV1234/LuaJIT - GIT_TAG 43cbd9b5f40c472eb9602b66b203057d0f08231b + GIT_TAG 1fc4827feffea4f687a3f102871a3630a5ca9ee2 ) set(LUAJIT_DISABLE_FFI true) @@ -157,7 +157,7 @@ if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui GITHUB_REPOSITORY ocornut/imgui - GIT_TAG 19c3773cc09fffdf950c3e88273f0a15adad1176 + GIT_TAG 764f9e606d106591072a8e5a79d4e801c4c699fb DOWNLOAD_ONLY YES ) @@ -183,7 +183,7 @@ if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui-sfml GITHUB_REPOSITORY eliasdaler/imgui-sfml - GIT_TAG 8bc196c5eaadb342712407eb06fc2f53edfde227 + GIT_TAG 9cc8c57a4565551087be0d9aeb3ae55490aa1207 ) set_target_properties(ImGui-SFML PROPERTIES UNITY_BUILD ON) @@ -201,7 +201,7 @@ set(SODIUM_DISABLE_TESTS ON CACHE BOOL "" FORCE) CPMAddPackage( NAME libsodium-cmake GITHUB_REPOSITORY SuperV1234/libsodium-cmake - GIT_TAG c33e05c9bcf7fa1ef0291cf4f35ea1a677a5b7f0 + GIT_TAG 6afc5beec300bd28589e2e3cb22732e8123fe30f OPTIONS "SODIUM_DISABLE_TESTS ON" "SODIUM_DISABLE_TESTS ON CACHE BOOL \"\" FORCE" ) -- cgit v1.2.3 From 3c44f367af0f1976b0fca5dbfef7493e8b78bac7 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sun, 21 Nov 2021 16:40:36 +0000 Subject: update submodules --- extlibs/SSVStart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extlibs/SSVStart b/extlibs/SSVStart index 50b37dd6..0f47d697 160000 --- a/extlibs/SSVStart +++ b/extlibs/SSVStart @@ -1 +1 @@ -Subproject commit 50b37dd635f200e4319af3fa60177972506a2388 +Subproject commit 0f47d6974fc29855bdbfa8e6bac566b958e62154 -- cgit v1.2.3 From 78004099c51c41b81ae214b557f26ee4f421be35 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Wed, 24 Nov 2021 23:19:54 +0000 Subject: Bump version to 2.1.4 --- include/SSVOpenHexagon/Global/Version.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/SSVOpenHexagon/Global/Version.hpp b/include/SSVOpenHexagon/Global/Version.hpp index 72d9e4f3..a3e4539f 100644 --- a/include/SSVOpenHexagon/Global/Version.hpp +++ b/include/SSVOpenHexagon/Global/Version.hpp @@ -43,8 +43,7 @@ struct GameVersion } }; -// TODO (P0): bump this version -inline constexpr GameVersion GAME_VERSION{2, 1, 3}; -inline constexpr auto& GAME_VERSION_STR = "2.1.3"; +inline constexpr GameVersion GAME_VERSION{2, 1, 4}; +inline constexpr auto& GAME_VERSION_STR = "2.1.4"; } // namespace hg -- cgit v1.2.3 From fe6cff0cf9623bb3ea8f9fd336df9a7abf0dd3d1 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Wed, 24 Nov 2021 23:20:19 +0000 Subject: Baby steps improvements: avoid text overlap, play "blip" on objective success --- _RELEASE/Assets/assets.json | 1 + .../Packs/tutorial/Scripts/Levels/babysteps.lua | 31 +++++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/_RELEASE/Assets/assets.json b/_RELEASE/Assets/assets.json index 72785956..9a95ad1d 100644 --- a/_RELEASE/Assets/assets.json +++ b/_RELEASE/Assets/assets.json @@ -27,6 +27,7 @@ "soundBuffers": [ "beep.ogg", + "blip.ogg", "death.ogg", "difficultyMultDown.ogg", "difficultyMultUp.ogg", diff --git a/_RELEASE/Packs/tutorial/Scripts/Levels/babysteps.lua b/_RELEASE/Packs/tutorial/Scripts/Levels/babysteps.lua index a7bd3ea7..d2a3e37c 100644 --- a/_RELEASE/Packs/tutorial/Scripts/Levels/babysteps.lua +++ b/_RELEASE/Packs/tutorial/Scripts/Levels/babysteps.lua @@ -91,24 +91,31 @@ end -- onInput is a hardcoded function invoked when the player executes input function onInput(mFrameTime, mMovement, mFocus, mSwap) if not step25 and step1 then - if mMovement == -1 then + if mMovement == -1 and step0_trRotateLeft ~= "yes!" then + a_playSound("blip.ogg") step0_trRotateLeft = "yes!" end - if mMovement == 1 then + if mMovement == 1 and step0_trRotateRight ~= "yes!" then + a_playSound("blip.ogg") step0_trRotateRight = "yes!" end end if step25 then if mFocus then - step1_trFocus = "yes!" + if step1_trFocus ~= "yes!" then + a_playSound("blip.ogg") + step1_trFocus = "yes!" + end - if mMovement == -1 then + if mMovement == -1 and step0_trRotateLeft ~= "yes!" then + a_playSound("blip.ogg") step0_trRotateLeft = "yes!" end - if mMovement == 1 then + if mMovement == 1 and step0_trRotateRight ~= "yes!" then + a_playSound("blip.ogg") step0_trRotateRight = "yes!" end end @@ -140,9 +147,11 @@ function onUpdate(mFrameTime) step2 = true step0_completionTime = l_getLevelTime() + l_clearTracked() + e_messageAddImportant("well done!", 120) e_messageAddImportant("you can slow down by focusing", 160) - e_messageAddImportant("by default, use left shift", 160) + e_messageAddImportant("by default, use left shift", 180) e_messageAddImportant("try it while rotating!", 140) e_stopTimeS(8) end @@ -153,15 +162,17 @@ function onUpdate(mFrameTime) step0_trRotateLeft = "nope" step0_trRotateRight = "nope" - l_addTracked("step1_trFocus", "focused") - l_addTracked("step0_trRotateLeft", "rotated counter-clockwise while focusing") - l_addTracked("step0_trRotateRight", "rotated clockwise while focusing") + l_addTracked("step0_trRotateLeft", "rotated ccw while focusing") + l_addTracked("step0_trRotateRight", "rotated cw while focusing") + l_addTracked("step1_trFocus", "focused (left shift)") end if step25 and not step3 and step0_trRotateLeft == "yes!" and step0_trRotateRight == "yes!" and step1_trFocus == "yes!" then step3 = true step3_completionTime = l_getLevelTime() + l_clearTracked() + e_stopTimeS(7) e_messageAddImportant("great!", 120) e_messageAddImportant("the goal of open hexagon is to survive", 180) @@ -171,7 +182,7 @@ function onUpdate(mFrameTime) if not step35 and step3 and l_getLevelTime() > step3_completionTime + 0.2 then step35 = true - l_clearTracked() + l_addTracked("challengeFailedText", "survived until the end") l_resetTime() -- cgit v1.2.3 From 0e3d4e62ecfb1a23840e023c06dcf1f2ce80fb63 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Wed, 24 Nov 2021 23:24:39 +0000 Subject: Update SFML --- CMakeLists.txt | 2 +- _RELEASE/config.json | 42 +++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fda798b6..f611f82a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG 47129290bbf6f7ab689de1835146cd40118bb79d + GIT_TAG 8d21b3a33cb1c4b8333ca5e4dd2f203b855b8ada ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) diff --git a/_RELEASE/config.json b/_RELEASE/config.json index 1140f0d1..9a22f887 100644 --- a/_RELEASE/config.json +++ b/_RELEASE/config.json @@ -4,22 +4,22 @@ "3D_max_depth" : 100, "3D_multiplier" : 1.0, "angle_tilt_intensity" : 1.0, - "antialiasing_level" : 16, + "antialiasing_level" : 4, "auto_restart" : false, "auto_zoom_factor" : true, "beatpulse_enabled" : true, "black_and_white" : false, - "camera_shake_multiplier" : 1.000002622604370, + "camera_shake_multiplier" : 1.0, "darken_uneven_background_chunk" : true, - "debug" : true, + "debug" : false, "draw_text_outlines" : true, "first_time_playing" : false, "flash_enabled" : true, "fullscreen" : false, - "fullscreen_auto_resolution" : true, + "fullscreen_auto_resolution" : false, "fullscreen_height" : 1080, "fullscreen_width" : 1920, - "invincible" : true, + "invincible" : false, "j_add_favorite" : 8, "j_exit" : 2, "j_favorite_menu" : 9, @@ -35,11 +35,11 @@ "joystick_deadzone" : 5.0, "key_icons_scale" : 0.750, "last_login_username" : "vee", - "limit_fps" : false, + "limit_fps" : true, "max_fps" : 200, "music_speed_dm_sync" : true, "music_speed_mult" : 1.0, - "music_volume" : 55.0, + "music_volume" : 100.0, "no_background" : false, "no_music" : false, "no_rotation" : false, @@ -50,10 +50,10 @@ "player_focus_speed" : 4.6250, "player_size" : 7.300000190734863, "player_speed" : 9.449999809265137, - "player_trail_alpha" : 125, - "player_trail_decay" : 5.50, + "player_trail_alpha" : 35, + "player_trail_decay" : 3.0, "player_trail_has_swap_color" : true, - "player_trail_scale" : 0.8499999642372131, + "player_trail_scale" : 0.8999999761581421, "pulse_enabled" : true, "rotate_to_start" : false, "save_last_login_username" : true, @@ -148,19 +148,19 @@ "server_local" : true, "server_port" : 50505, "server_verbose" : true, - "show_fps" : true, - "show_key_icons" : true, - "show_level_info" : true, + "show_fps" : false, + "show_key_icons" : false, + "show_level_info" : false, "show_login_at_startup" : false, "show_messages" : true, "show_player_trail" : true, "show_status_text" : true, "show_timer" : true, "show_tracked_variables" : true, - "sound_volume" : 85.0, + "sound_volume" : 100.0, "t_down" : [ - [ "" ], + [ "kS" ], [ "" ], [ "" ], [ "" ] @@ -223,9 +223,9 @@ ], "t_restart" : [ - [ "bMiddle" ], [ "kSpace" ], [ "kReturn" ], + [ "bMiddle" ], [ "" ] ], "t_rotate_ccw" : @@ -258,14 +258,14 @@ ], "t_swap" : [ - [ "bMiddle" ], [ "kSpace" ], + [ "bMiddle" ], [ "" ], [ "" ] ], "t_up" : [ - [ "" ], + [ "kW" ], [ "" ], [ "" ], [ "" ] @@ -276,7 +276,7 @@ "timescale" : 1.0, "vsync" : false, "windowed_auto_resolution" : false, - "windowed_height" : 715, - "windowed_width" : 1275, - "zoom_factor" : 1.074125885963440 + "windowed_height" : 768, + "windowed_width" : 1280, + "zoom_factor" : 1.0 } -- cgit v1.2.3 From 5a0703dd14cf74e757b79b79004a0ad3408c52f8 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 25 Nov 2021 02:29:42 +0000 Subject: Update config --- _RELEASE/config.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/_RELEASE/config.json b/_RELEASE/config.json index 9a22f887..f836a462 100644 --- a/_RELEASE/config.json +++ b/_RELEASE/config.json @@ -47,6 +47,7 @@ "official" : true, "online" : true, "pixel_multiplier" : 1, + "play_swap_ready_sound" : true, "player_focus_speed" : 4.6250, "player_size" : 7.300000190734863, "player_speed" : 9.449999809265137, @@ -155,6 +156,8 @@ "show_messages" : true, "show_player_trail" : true, "show_status_text" : true, + "show_swap_blinking_effect" : true, + "show_swap_particles" : true, "show_timer" : true, "show_tracked_variables" : true, "sound_volume" : 100.0, @@ -276,7 +279,7 @@ "timescale" : 1.0, "vsync" : false, "windowed_auto_resolution" : false, - "windowed_height" : 768, + "windowed_height" : 720, "windowed_width" : 1280, - "zoom_factor" : 1.0 + "zoom_factor" : 1.066666722297668 } -- cgit v1.2.3 From 5608fe94cbc2f07d79c8f920e2be597697f473e3 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 25 Nov 2021 02:30:06 +0000 Subject: Add options for "show swap particles", "play swap ready sound" and "show swap blinking effect" --- include/SSVOpenHexagon/Global/Config.hpp | 6 ++++++ src/SSVOpenHexagon/Global/Config.cpp | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/SSVOpenHexagon/Global/Config.hpp b/include/SSVOpenHexagon/Global/Config.hpp index a3916f3f..fc2100c7 100644 --- a/include/SSVOpenHexagon/Global/Config.hpp +++ b/include/SSVOpenHexagon/Global/Config.hpp @@ -89,6 +89,9 @@ void setPlayerTrailAlpha(unsigned int x); void setPlayerTrailScale(float x); void setPlayerTrailDecay(float x); void setPlayerTrailHasSwapColor(bool x); +void setShowSwapParticles(bool x); +void setPlaySwapReadySound(bool x); +void setShowSwapBlinkingEffect(bool x); [[nodiscard]] bool getOfficial(); [[nodiscard]] const std::string& getUneligibilityReason(); @@ -162,6 +165,9 @@ void setPlayerTrailHasSwapColor(bool x); [[nodiscard]] float getPlayerTrailScale(); [[nodiscard]] float getPlayerTrailDecay(); [[nodiscard]] bool getPlayerTrailHasSwapColor(); +[[nodiscard]] bool getShowSwapParticles(); +[[nodiscard]] bool getPlaySwapReadySound(); +[[nodiscard]] bool getShowSwapBlinkingEffect(); // keyboard binds diff --git a/src/SSVOpenHexagon/Global/Config.cpp b/src/SSVOpenHexagon/Global/Config.cpp index bf08844e..8470df37 100644 --- a/src/SSVOpenHexagon/Global/Config.cpp +++ b/src/SSVOpenHexagon/Global/Config.cpp @@ -246,6 +246,9 @@ using cil = std::initializer_list; X(playerTrailScale, float, "player_trail_scale", 0.9f) \ X(playerTrailDecay, float, "player_trail_decay", 3.0f) \ X(playerTrailHasSwapColor, bool, "player_trail_has_swap_color", true) \ + X(showSwapParticles, bool, "show_swap_particles", true) \ + X(playSwapReadySound, bool, "play_swap_ready_sound", true) \ + X(showSwapBlinkingEffect, bool, "show_swap_blinking_effect", true) \ X_LINKEDVALUES_BINDS namespace hg::Config { @@ -797,6 +800,21 @@ void setPlayerTrailHasSwapColor(bool x) playerTrailHasSwapColor() = x; } +void setShowSwapParticles(bool x) +{ + showSwapParticles() = x; +} + +void setPlaySwapReadySound(bool x) +{ + playSwapReadySound() = x; +} + +void setShowSwapBlinkingEffect(bool x) +{ + showSwapBlinkingEffect() = x; +} + [[nodiscard]] bool getOfficial() { return official(); @@ -1157,6 +1175,21 @@ void setPlayerTrailHasSwapColor(bool x) return playerTrailHasSwapColor(); } +[[nodiscard]] bool getShowSwapParticles() +{ + return showSwapParticles(); +} + +[[nodiscard]] bool getPlaySwapReadySound() +{ + return playSwapReadySound(); +} + +[[nodiscard]] bool getShowSwapBlinkingEffect() +{ + return showSwapBlinkingEffect(); +} + //*********************************************************** // // KEYBOARD/MOUSE BINDS -- cgit v1.2.3 From e810d924f3ac6c3c3418e0fbf7f09d1995984f3d Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 25 Nov 2021 02:30:20 +0000 Subject: Add menu options for the new config options --- src/SSVOpenHexagon/Core/MenuGame.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index aefbe89b..2d81b9ab 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -1412,6 +1412,10 @@ void MenuGame::initMenus() playervisfx.create("trail has swap color", &Config::getPlayerTrailHasSwapColor, &Config::setPlayerTrailHasSwapColor); + playervisfx.create("show swap particles", + &Config::getShowSwapParticles, &Config::setShowSwapParticles); + playervisfx.create("swap blinking effect", + &Config::getShowSwapBlinkingEffect, &Config::setShowSwapBlinkingEffect); playervisfx.create("back"); auto& fps(optionsMenu.createCategory("fps settings")); @@ -1509,6 +1513,8 @@ void MenuGame::initMenus() [](float mValue) { Config::setMusicSpeedMult(mValue); }, 0.7f, 1.3f, 0.05f) | whenMusicEnabled; + sfx.create("play swap ready blip sound", + &Config::getPlaySwapReadySound, &Config::setPlaySwapReadySound); sfx.create("back"); -- cgit v1.2.3 From 37a5fbf2d47782d039f38bb34837d4247ba0e16b Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 25 Nov 2021 02:31:44 +0000 Subject: Implement "swap ready sound", "swap particles", and "show swap blinking effect" --- _RELEASE/Assets/assets.json | 3 +- include/SSVOpenHexagon/Components/CPlayer.hpp | 4 +- include/SSVOpenHexagon/Core/HexagonGame.hpp | 22 +++++ src/SSVOpenHexagon/Components/CPlayer.cpp | 15 +++- src/SSVOpenHexagon/Core/HGGraphics.cpp | 17 +++- src/SSVOpenHexagon/Core/HGUpdate.cpp | 117 +++++++++++++++++++++++++- src/SSVOpenHexagon/Core/HexagonGame.cpp | 25 ++++++ 7 files changed, 192 insertions(+), 11 deletions(-) diff --git a/_RELEASE/Assets/assets.json b/_RELEASE/Assets/assets.json index 9a95ad1d..dd7fedcf 100644 --- a/_RELEASE/Assets/assets.json +++ b/_RELEASE/Assets/assets.json @@ -40,6 +40,7 @@ "personalBest.ogg", "restart.ogg", "select.ogg", - "swap.ogg" + "swap.ogg", + "swapBlip.ogg" ] } diff --git a/include/SSVOpenHexagon/Components/CPlayer.hpp b/include/SSVOpenHexagon/Components/CPlayer.hpp index 4e008e06..834d6db5 100644 --- a/include/SSVOpenHexagon/Components/CPlayer.hpp +++ b/include/SSVOpenHexagon/Components/CPlayer.hpp @@ -114,6 +114,8 @@ public: void updatePosition(const float radius); + [[nodiscard]] sf::Color getColor(const sf::Color& colorPlayer) const; + [[nodiscard]] sf::Color getColorAdjustedForSwap( const sf::Color& colorPlayer) const; @@ -121,7 +123,7 @@ public: const sf::Color& colorPlayer, Utils::FastVertexVectorQuads& wallQuads, Utils::FastVertexVectorTris& capTris, Utils::FastVertexVectorTris& playerTris, const sf::Color& capColor, - const float angleTiltIntensity); + const float angleTiltIntensity, const bool swapBlinkingEffect); [[nodiscard]] bool push(const int movementDir, const float radius, const CWall& wall, const sf::Vector2f& mCenterPos, diff --git a/include/SSVOpenHexagon/Core/HexagonGame.hpp b/include/SSVOpenHexagon/Core/HexagonGame.hpp index 265acfb4..9123e98e 100644 --- a/include/SSVOpenHexagon/Core/HexagonGame.hpp +++ b/include/SSVOpenHexagon/Core/HexagonGame.hpp @@ -180,12 +180,28 @@ private: float angle; }; + struct SwapParticle + { + sf::Sprite sprite; + sf::Vector2f velocity; + }; + sf::Texture* txStarParticle; sf::Texture* txSmallCircle; std::vector particles; std::vector trailParticles; + std::vector swapParticles; bool mustSpawnPBParticles{false}; + + struct SwapParticleSpawnInfo + { + bool ready; + sf::Vector2f position; + float angle; + }; + + std::optional swapParticlesSpawnInfo; float nextPBParticleSpawn{0.f}; float pbTextGrowth{0.f}; @@ -238,6 +254,8 @@ private: int inputMovement{0}; bool inputImplCW{false}; bool inputImplCCW{false}; + bool playerNowReadyToSwap{false}; + std::ostringstream os; sf::Text fpsText; @@ -344,6 +362,7 @@ private: void updateLevelInfo(); void updateParticles(ssvu::FT mFT); void updateTrailParticles(ssvu::FT mFT); + void updateSwapParticles(ssvu::FT mFT); // Post update methods void postUpdate(); @@ -365,6 +384,7 @@ private: void drawLevelInfo(); void drawParticles(); void drawTrailParticles(); + void drawSwapParticles(); void drawImguiLuaConsole(); // Data-related methods @@ -502,6 +522,8 @@ public: [[nodiscard]] HGAssets& getAssets(); [[nodiscard]] sf::Color getColorMain() const; [[nodiscard]] sf::Color getColorPlayer() const; + [[nodiscard]] sf::Color getColorPlayerAdjustedForSwap() const; + [[nodiscard]] sf::Color getColorPlayerTrail() const; [[nodiscard]] sf::Color getColorText() const; [[nodiscard]] sf::Color getColorCap() const; [[nodiscard]] sf::Color getColorWall() const; diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp index dc112760..b452d940 100644 --- a/src/SSVOpenHexagon/Components/CPlayer.cpp +++ b/src/SSVOpenHexagon/Components/CPlayer.cpp @@ -59,6 +59,12 @@ CPlayer::CPlayer(const sf::Vector2f& pos, const float swapCooldown, _currTiltedAngle{0} {} +[[nodiscard]] sf::Color CPlayer::getColor(const sf::Color& colorPlayer) const +{ + return !_deadEffectTimer.isRunning() ? colorPlayer + : Utils::getColorFromHue(_hue / 360.f); +} + [[nodiscard]] sf::Color CPlayer::getColorAdjustedForSwap( const sf::Color& colorPlayer) const { @@ -68,15 +74,14 @@ CPlayer::CPlayer(const sf::Vector2f& pos, const float swapCooldown, std::fmod(_swapBlinkTimer.getCurrent() / 12.f, 0.2f)); } - return !_deadEffectTimer.isRunning() ? colorPlayer - : Utils::getColorFromHue(_hue / 360.f); + return getColor(colorPlayer); } void CPlayer::draw(const unsigned int sides, const sf::Color& colorMain, const sf::Color& colorPlayer, Utils::FastVertexVectorQuads& wallQuads, Utils::FastVertexVectorTris& capTris, Utils::FastVertexVectorTris& playerTris, const sf::Color& capColor, - const float angleTiltIntensity) + const float angleTiltIntensity, const bool swapBlinkingEffect) { drawPivot(sides, colorMain, wallQuads, capTris, capColor); @@ -95,7 +100,9 @@ void CPlayer::draw(const unsigned int sides, const sf::Color& colorMain, _pos, tiltedAngle + ssvu::toRad(100.f), _size + _triangleWidth); playerTris.reserve_more(3); - playerTris.batch_unsafe_emplace_back(getColorAdjustedForSwap(colorPlayer), + playerTris.batch_unsafe_emplace_back( + swapBlinkingEffect ? getColorAdjustedForSwap(colorPlayer) + : getColor(colorPlayer), ssvs::getOrbitRad(_pos, tiltedAngle, _size), pLeft, pRight); } diff --git a/src/SSVOpenHexagon/Core/HGGraphics.cpp b/src/SSVOpenHexagon/Core/HGGraphics.cpp index 54bd211e..c53f14b7 100644 --- a/src/SSVOpenHexagon/Core/HGGraphics.cpp +++ b/src/SSVOpenHexagon/Core/HGGraphics.cpp @@ -116,8 +116,8 @@ void HexagonGame::draw() if(status.started) { player.draw(getSides(), getColorMain(), getColorPlayer(), pivotQuads, - capTris, playerTris, getColorCap(), - Config::getAngleTiltIntensity()); + capTris, playerTris, getColorCap(), Config::getAngleTiltIntensity(), + Config::getShowSwapBlinkingEffect()); } if(Config::get3D()) @@ -237,6 +237,11 @@ void HexagonGame::draw() drawTrailParticles(); } + if(Config::getShowSwapParticles()) + { + drawSwapParticles(); + } + render(wallQuads); render(capTris); render(pivotQuads); @@ -373,6 +378,14 @@ void HexagonGame::drawTrailParticles() } } +void HexagonGame::drawSwapParticles() +{ + for(SwapParticle& p : swapParticles) + { + render(p.sprite); + } +} + void HexagonGame::updateText(ssvu::FT mFT) { if(window == nullptr) diff --git a/src/SSVOpenHexagon/Core/HGUpdate.cpp b/src/SSVOpenHexagon/Core/HGUpdate.cpp index 66789404..703e812f 100644 --- a/src/SSVOpenHexagon/Core/HGUpdate.cpp +++ b/src/SSVOpenHexagon/Core/HGUpdate.cpp @@ -24,6 +24,7 @@ #include "SSVOpenHexagon/Core/Joystick.hpp" #include "SSVOpenHexagon/Core/LuaScripting.hpp" #include "SSVOpenHexagon/Core/Steam.hpp" +#include "SSVUtils/Core/Utils/Rnd.hpp" #ifndef SSVOH_ANDROID #include @@ -243,12 +244,35 @@ void HexagonGame::update(ssvu::FT mFT, const float timescale) player.updateInputMovement(getInputMovement(), getPlayerSpeedMult(), getInputFocused(), mFT); + // Play "swap ready blip" sound and create particles + if(!playerNowReadyToSwap && player.isReadyToSwap()) + { + playerNowReadyToSwap = true; + + if(Config::getPlaySwapReadySound()) + { + playSoundOverride("swapBlip.ogg"); + } + + swapParticlesSpawnInfo = + SwapParticleSpawnInfo{.ready{true}, + .position{player.getPosition()}, + .angle{player.getPlayerAngle()}}; + } + + // Create particles after swap if(getLevelStatus().swapEnabled && getInputSwap() && player.isReadyToSwap()) { + swapParticlesSpawnInfo = + SwapParticleSpawnInfo{.ready{false}, + .position{player.getPosition()}, + .angle{player.getPlayerAngle()}}; + performPlayerSwap(true /* mPlaySound */); player.resetSwap(getSwapCooldown()); player.setJustSwapped(true); + playerNowReadyToSwap = false; } else { @@ -344,6 +368,11 @@ void HexagonGame::update(ssvu::FT mFT, const float timescale) updateTrailParticles(mFT); } + if(Config::getShowSwapParticles()) + { + updateSwapParticles(mFT); + } + overlayCamera->update(mFT); backgroundCamera->update(mFT); } @@ -944,9 +973,7 @@ void HexagonGame::updateTrailParticles(ssvu::FT mFT) const float scale = Config::getPlayerTrailScale(); p.sprite.setScale({scale, scale}); - sf::Color c = Config::getPlayerTrailHasSwapColor() - ? player.getColorAdjustedForSwap(getColorPlayer()) - : getColorPlayer(); + sf::Color c = getColorPlayerTrail(); c.a = Config::getPlayerTrailAlpha(); p.sprite.setColor(c); @@ -980,6 +1007,90 @@ void HexagonGame::updateTrailParticles(ssvu::FT mFT) } } +void HexagonGame::updateSwapParticles(ssvu::FT mFT) +{ + SSVOH_ASSERT(window != nullptr); + + const auto isDead = [&](const SwapParticle& p) + { return p.sprite.getColor().a <= 3; }; + + const auto makeSwapParticle = [this](const SwapParticleSpawnInfo& si, + const float expand, const float speedMult, + const float scaleMult, const float alpha) + { + SwapParticle p; + + SSVOH_ASSERT(txSmallCircle != nullptr); + p.sprite.setTexture(*txSmallCircle); + p.sprite.setPosition(si.position); + p.sprite.setOrigin(sf::Vector2f{txSmallCircle->getSize()} / 2.f); + + const float scale = ssvu::getRndR(0.65f, 1.35f) * scaleMult; + p.sprite.setScale({scale, scale}); + + sf::Color c = getColorPlayerTrail(); + + c.a = alpha; + p.sprite.setColor(c); + + p.velocity = + ssvs::getVecFromRad(si.angle + ssvu::getRndR(-expand, expand), + ssvu::getRndR(0.1f, 10.f) * speedMult); + + return p; + }; + + ssvu::eraseRemoveIf(swapParticles, isDead); + + for(SwapParticle& p : swapParticles) + { + sf::Color color = p.sprite.getColor(); + + const float newAlpha = + Utils::getMoveTowardsZero(static_cast(color.a), 3.5f * mFT); + + color.a = static_cast(newAlpha); + p.sprite.setColor(color); + + p.sprite.setScale(p.sprite.getScale() * 0.98f); + p.sprite.setPosition(p.sprite.getPosition() + p.velocity * mFT); + } + + if(swapParticlesSpawnInfo.has_value()) + { + if(swapParticlesSpawnInfo->ready == false) + { + for(int i = 0; i < 20; ++i) + { + swapParticles.emplace_back( + makeSwapParticle(*swapParticlesSpawnInfo, + 0.45f /* expand */, 1.f /* speedMult */, + 1.f /* scaleMult */, 45.f /* alpha */)); + } + + for(int i = 0; i < 10; ++i) + { + swapParticles.emplace_back( + makeSwapParticle(*swapParticlesSpawnInfo, + 3.14f /* expand */, 0.45f /* speedMult */, + 0.75f /* scaleMult */, 35.f /* alpha */)); + } + } + else + { + for(int i = 0; i < 14; ++i) + { + swapParticles.emplace_back( + makeSwapParticle(*swapParticlesSpawnInfo, + 3.14f /* expand */, 1.3f /* speedMult */, + 0.4f /* scaleMult */, 140.f /* alpha */)); + } + } + + swapParticlesSpawnInfo.reset(); + } +} + #ifndef SSVOH_ANDROID static int ilcTextEditCallbackStub(ImGuiInputTextCallbackData* data) { diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index eb621791..37aacf03 100644 --- a/src/SSVOpenHexagon/Core/HexagonGame.cpp +++ b/src/SSVOpenHexagon/Core/HexagonGame.cpp @@ -666,9 +666,11 @@ void HexagonGame::newGame(const std::string& mPackId, const std::string& mId, // Particles cleanup pbTextGrowth = 0.f; mustSpawnPBParticles = false; + swapParticlesSpawnInfo.reset(); nextPBParticleSpawn = 0.f; particles.clear(); trailParticles.clear(); + swapParticles.clear(); // Re-init default flash effect initFlashEffect(255, 255, 255); @@ -694,6 +696,7 @@ void HexagonGame::newGame(const std::string& mPackId, const std::string& mId, // Lua context and game status cleanup inputImplCCW = inputImplCW = false; + playerNowReadyToSwap = false; lua = Lua::LuaContext{}; calledDeprecatedFunctions.clear(); @@ -1397,6 +1400,28 @@ auto HexagonGame::getColorPlayer() const -> sf::Color return styleData.getPlayerColor(); } +auto HexagonGame::getColorPlayerAdjustedForSwap() const -> sf::Color +{ + if(Config::getBlackAndWhite()) + { + return sf::Color(255, 255, 255, styleData.getPlayerColor().a); + } + + if(!Config::getShowSwapBlinkingEffect()) + { + return getColorPlayer(); + } + + return player.getColorAdjustedForSwap(getColorPlayer()); +} + +auto HexagonGame::getColorPlayerTrail() const -> sf::Color +{ + return Config::getPlayerTrailHasSwapColor() + ? getColorPlayerAdjustedForSwap() + : getColorPlayer(); +} + auto HexagonGame::getColorText() const -> sf::Color { if(Config::getBlackAndWhite()) -- cgit v1.2.3 From 3645cac0d93012becc68efa398ccfe9b7c45f963 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 25 Nov 2021 02:50:13 +0000 Subject: Minor refactoring --- include/SSVOpenHexagon/Components/CCustomWall.hpp | 1 + include/SSVOpenHexagon/Components/SpeedData.hpp | 2 +- include/SSVOpenHexagon/Core/HexagonClient.hpp | 30 +++++++++++------------ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/include/SSVOpenHexagon/Components/CCustomWall.hpp b/include/SSVOpenHexagon/Components/CCustomWall.hpp index ebc71b92..1f0c67fa 100644 --- a/include/SSVOpenHexagon/Components/CCustomWall.hpp +++ b/include/SSVOpenHexagon/Components/CCustomWall.hpp @@ -5,6 +5,7 @@ #pragma once #include "SSVOpenHexagon/Components/CCustomWallHandle.hpp" + #include "SSVOpenHexagon/Utils/PointInPolygon.hpp" #include "SSVOpenHexagon/Utils/FastVertexVector.hpp" diff --git a/include/SSVOpenHexagon/Components/SpeedData.hpp b/include/SSVOpenHexagon/Components/SpeedData.hpp index 3c49c60e..9a47aeec 100644 --- a/include/SSVOpenHexagon/Components/SpeedData.hpp +++ b/include/SSVOpenHexagon/Components/SpeedData.hpp @@ -27,7 +27,7 @@ struct SpeedData void update(const ssvu::FT ft) noexcept { - if(_accel == 0) + if(_accel == 0.f) { return; } diff --git a/include/SSVOpenHexagon/Core/HexagonClient.hpp b/include/SSVOpenHexagon/Core/HexagonClient.hpp index 4acd5839..56a63fe1 100644 --- a/include/SSVOpenHexagon/Core/HexagonClient.hpp +++ b/include/SSVOpenHexagon/Core/HexagonClient.hpp @@ -47,21 +47,21 @@ public: }; // clang-format off - struct EConnectionSuccess { }; - struct EConnectionFailure { std::string error; }; - struct EKicked { }; - struct ERegistrationSuccess { }; - struct ERegistrationFailure { std::string error;}; - struct ELoginSuccess { }; - struct ELoginFailure { std::string error; }; - struct ELogoutSuccess { }; - struct ELogoutFailure { }; - struct EDeleteAccountSuccess { }; - struct EDeleteAccountFailure { std::string error; }; - struct EReceivedTopScores { std::string levelValidator; std::vector scores; }; - struct EReceivedOwnScore { std::string levelValidator; Database::ProcessedScore score; }; - struct EGameVersionMismatch { }; - struct EProtocolVersionMismatch { }; + struct EConnectionSuccess { }; + struct EConnectionFailure { std::string error; }; + struct EKicked { }; + struct ERegistrationSuccess { }; + struct ERegistrationFailure { std::string error;}; + struct ELoginSuccess { }; + struct ELoginFailure { std::string error; }; + struct ELogoutSuccess { }; + struct ELogoutFailure { }; + struct EDeleteAccountSuccess { }; + struct EDeleteAccountFailure { std::string error; }; + struct EReceivedTopScores { std::string levelValidator; std::vector scores; }; + struct EReceivedOwnScore { std::string levelValidator; Database::ProcessedScore score; }; + struct EGameVersionMismatch { }; + struct EProtocolVersionMismatch { }; // clang-format on using Event = std::variant< // -- cgit v1.2.3 From 2afea9f553644df54e63ca1d6b1aca4fd796e6cc Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Tue, 7 Dec 2021 18:42:35 +0000 Subject: Fix music playing after unpause even with music disabled --- src/SSVOpenHexagon/Core/HexagonGame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index 37aacf03..f74748e6 100644 --- a/src/SSVOpenHexagon/Core/HexagonGame.cpp +++ b/src/SSVOpenHexagon/Core/HexagonGame.cpp @@ -420,14 +420,14 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, if(debugPause) { - if(audio != nullptr) + if(shouldPlayMusic()) { audio->pauseMusic(); } } else if(!status.hasDied) { - if(audio != nullptr) + if(shouldPlayMusic()) { audio->resumeMusic(); } -- cgit v1.2.3 From d96f8d4a844deb0c5acb7953d054dd5eb9733ea2 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Tue, 7 Dec 2021 18:47:48 +0000 Subject: Update to SFML 3.x --- CMakeLists.txt | 2 +- build.sh | 26 ++++++++++---------- buildrel/copylibs.sh | 68 ++++++++++++++++++++++++++-------------------------- prepare_release.sh | 10 ++++---- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f611f82a..a2ca60ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG 8d21b3a33cb1c4b8333ca5e4dd2f203b855b8ada + GIT_TAG ab41e083f6de91c3440bd04341b73f89d69f7975 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) diff --git a/build.sh b/build.sh index 04f66f39..ca3e9786 100755 --- a/build.sh +++ b/build.sh @@ -47,7 +47,7 @@ while [[ $# -gt 0 ]]; do VALGRIND=1 shift ;; - + -g|--regenerate-cmake) REGENERATE_CMAKE=1 shift @@ -95,11 +95,11 @@ case $OSTYPE in # MinGW / Windows... "msys") # Removes existing library artifacts - rm -f "$RELEASE_DIR/sfml-audio-2.dll" - rm -f "$RELEASE_DIR/sfml-graphics-2.dll" - rm -f "$RELEASE_DIR/sfml-network-2.dll" - rm -f "$RELEASE_DIR/sfml-system-2.dll" - rm -f "$RELEASE_DIR/sfml-window-2.dll" + rm -f "$RELEASE_DIR/sfml-audio-3.dll" + rm -f "$RELEASE_DIR/sfml-graphics-3.dll" + rm -f "$RELEASE_DIR/sfml-network-3.dll" + rm -f "$RELEASE_DIR/sfml-system-3.dll" + rm -f "$RELEASE_DIR/sfml-window-3.dll" rm -f "$RELEASE_DIR/openal32.dll" rm -f "$RELEASE_DIR/libzlib1.dll" rm -f "$RELEASE_DIR/OHWorkshopUploader.exe" @@ -120,19 +120,19 @@ case $OSTYPE in echo "Building for MinGW/Windows..." make $THREAD_MAKE_COUNT - + # Moves artifacts to release folder - mv ./_deps/sfml-build/lib/sfml-audio-2.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-graphics-2.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-network-2.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-system-2.dll $RELEASE_DIR - mv ./_deps/sfml-build/lib/sfml-window-2.dll $RELEASE_DIR + mv ./_deps/sfml-build/lib/sfml-audio-3.dll $RELEASE_DIR + mv ./_deps/sfml-build/lib/sfml-graphics-3.dll $RELEASE_DIR + mv ./_deps/sfml-build/lib/sfml-network-3.dll $RELEASE_DIR + mv ./_deps/sfml-build/lib/sfml-system-3.dll $RELEASE_DIR + mv ./_deps/sfml-build/lib/sfml-window-3.dll $RELEASE_DIR cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll $RELEASE_DIR mv ./_deps/zlib-build/libzlib1.dll $RELEASE_DIR mv ./OHWorkshopUploader.exe $RELEASE_DIR mv ./SSVOpenHexagon.exe $RELEASE_DIR ;; - + # Linux... "linux-gnu") # Removes existing executables diff --git a/buildrel/copylibs.sh b/buildrel/copylibs.sh index 3d3742d3..0c60afa8 100644 --- a/buildrel/copylibs.sh +++ b/buildrel/copylibs.sh @@ -3,23 +3,23 @@ cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll ../_RELEASE/ & cp ./_deps/imgui-sfml-build/libImGui-SFML.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-graphics-d-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-system-d-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-window-d-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-network-d-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-audio-d-2.dll ../_RELEASE/ & - -cp ./_deps/sfml-build/lib/sfml-graphics-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/sfml-system-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/sfml-window-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/sfml-network-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/sfml-audio-2.dll ../_RELEASE/ & - -cp ./_deps/sfml-build/lib/libsfml-graphics-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-system-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-window-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-network-2.dll ../_RELEASE/ & -cp ./_deps/sfml-build/lib/libsfml-audio-2.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-graphics-d-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-system-d-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-window-d-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-network-d-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-audio-d-3.dll ../_RELEASE/ & + +cp ./_deps/sfml-build/lib/sfml-graphics-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-system-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-window-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-network-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/sfml-audio-3.dll ../_RELEASE/ & + +cp ./_deps/sfml-build/lib/libsfml-graphics-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-system-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-window-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-network-3.dll ../_RELEASE/ & +cp ./_deps/sfml-build/lib/libsfml-audio-3.dll ../_RELEASE/ & cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll ../_RELEASE/ & cp ./_deps/libsodium-cmake-build/libsodium.dll ../_RELEASE/ & @@ -29,23 +29,23 @@ cp ./_deps/zlib-build/libzlib1.dll ../_RELEASE/ & cp ./_deps/imgui-sfml-build/libImGui-SFML_d.dll ./test/ & cp ./_deps/imgui-sfml-build/libImGui-SFML.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-graphics-d-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-system-d-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-window-d-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-network-d-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-audio-d-2.dll ./test/ & - -cp ./_deps/sfml-build/lib/sfml-graphics-2.dll ./test/ & -cp ./_deps/sfml-build/lib/sfml-system-2.dll ./test/ & -cp ./_deps/sfml-build/lib/sfml-window-2.dll ./test/ & -cp ./_deps/sfml-build/lib/sfml-network-2.dll ./test/ & -cp ./_deps/sfml-build/lib/sfml-audio-2.dll ./test/ & - -cp ./_deps/sfml-build/lib/libsfml-graphics-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-system-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-window-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-network-2.dll ./test/ & -cp ./_deps/sfml-build/lib/libsfml-audio-2.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-graphics-d-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-system-d-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-window-d-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-network-d-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-audio-d-3.dll ./test/ & + +cp ./_deps/sfml-build/lib/sfml-graphics-3.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-system-3.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-window-3.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-network-3.dll ./test/ & +cp ./_deps/sfml-build/lib/sfml-audio-3.dll ./test/ & + +cp ./_deps/sfml-build/lib/libsfml-graphics-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-system-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-window-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-network-3.dll ./test/ & +cp ./_deps/sfml-build/lib/libsfml-audio-3.dll ./test/ & cp ./_deps/sfml-src/extlibs/bin/x64/openal32.dll ./test/ & cp ./_deps/libsodium-cmake-build/libsodium.dll ./test/ & diff --git a/prepare_release.sh b/prepare_release.sh index 731c3bb2..76d11032 100644 --- a/prepare_release.sh +++ b/prepare_release.sh @@ -21,11 +21,11 @@ cp ./_RELEASE/SSVOpenHexagon-Console.exe ./_PREPARED_RELEASE cp ./_RELEASE/libzlib1.dll ./_PREPARED_RELEASE cp ./_RELEASE/openal32.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-audio-2.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-graphics-2.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-network-2.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-system-2.dll ./_PREPARED_RELEASE -cp ./_RELEASE/sfml-window-2.dll ./_PREPARED_RELEASE +cp ./_RELEASE/sfml-audio-3.dll ./_PREPARED_RELEASE +cp ./_RELEASE/sfml-graphics-3.dll ./_PREPARED_RELEASE +cp ./_RELEASE/sfml-network-3.dll ./_PREPARED_RELEASE +cp ./_RELEASE/sfml-system-3.dll ./_PREPARED_RELEASE +cp ./_RELEASE/sfml-window-3.dll ./_PREPARED_RELEASE cp ./_RELEASE/libImGui-SFML.dll ./_PREPARED_RELEASE cp ./_RELEASE/libluajit.dll ./_PREPARED_RELEASE cp ./_RELEASE/steam_api64.dll ./_PREPARED_RELEASE -- cgit v1.2.3 From 20877505bc0cd9cf77c0b11b0884bf4a322a11ce Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Wed, 8 Dec 2021 21:08:56 +0000 Subject: Update libs --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2ca60ac..b50328fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG ab41e083f6de91c3440bd04341b73f89d69f7975 + GIT_TAG 7ebfaad3ad793a139ca63d904eb4d9d523389ea6 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) @@ -157,7 +157,7 @@ if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui GITHUB_REPOSITORY ocornut/imgui - GIT_TAG 764f9e606d106591072a8e5a79d4e801c4c699fb + GIT_TAG 270d4d0855ea3b2f66833ab1124ec475abe9df9c DOWNLOAD_ONLY YES ) @@ -183,7 +183,7 @@ if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui-sfml GITHUB_REPOSITORY eliasdaler/imgui-sfml - GIT_TAG 9cc8c57a4565551087be0d9aeb3ae55490aa1207 + GIT_TAG 4cb798bb20f41acca5872dd94a3a11f2ec0fbdb0 ) set_target_properties(ImGui-SFML PROPERTIES UNITY_BUILD ON) -- cgit v1.2.3 From cde964199443dfb92036d3ff9041142bc846e50f Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Wed, 8 Dec 2021 21:09:19 +0000 Subject: Fix death camera offset wrong --- include/SSVOpenHexagon/Core/HexagonGame.hpp | 4 ++-- src/SSVOpenHexagon/Core/HGUpdate.cpp | 31 +++++++++++++---------------- src/SSVOpenHexagon/Core/HexagonGame.cpp | 4 ++-- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/include/SSVOpenHexagon/Core/HexagonGame.hpp b/include/SSVOpenHexagon/Core/HexagonGame.hpp index 9123e98e..4944d9c9 100644 --- a/include/SSVOpenHexagon/Core/HexagonGame.hpp +++ b/include/SSVOpenHexagon/Core/HexagonGame.hpp @@ -133,8 +133,8 @@ private: struct PreShakeCenters { - sf::Vector2f backgroundCameraPreShakeCenter; - sf::Vector2f overlayCameraPreShakeCenter; + sf::Vector2f background; + sf::Vector2f overlay; }; std::optional preShakeCenters; diff --git a/src/SSVOpenHexagon/Core/HGUpdate.cpp b/src/SSVOpenHexagon/Core/HGUpdate.cpp index 703e812f..83c9c713 100644 --- a/src/SSVOpenHexagon/Core/HGUpdate.cpp +++ b/src/SSVOpenHexagon/Core/HGUpdate.cpp @@ -826,28 +826,28 @@ void HexagonGame::updateRotation(ssvu::FT mFT) void HexagonGame::updateCameraShake(ssvu::FT mFT) { - if(!backgroundCamera.has_value() || !overlayCamera.has_value() || - status.cameraShake <= 0) + if(!backgroundCamera.has_value() || !overlayCamera.has_value()) { return; } - status.cameraShake -= mFT; - - if(!preShakeCenters.has_value()) + if(status.cameraShake <= 0.f) { - if(status.cameraShake <= 0) + if(preShakeCenters.has_value()) { - backgroundCamera->setCenter( - preShakeCenters->backgroundCameraPreShakeCenter); - - overlayCamera->setCenter( - preShakeCenters->overlayCameraPreShakeCenter); + backgroundCamera->setCenter(preShakeCenters->background); + overlayCamera->setCenter(preShakeCenters->overlay); preShakeCenters.reset(); - return; } + return; + } + + status.cameraShake -= mFT; + + if(!preShakeCenters.has_value()) + { preShakeCenters = PreShakeCenters{ backgroundCamera->getCenter(), overlayCamera->getCenter()}; } @@ -862,11 +862,8 @@ void HexagonGame::updateCameraShake(ssvu::FT mFT) return sf::Vector2f(rng.get_real(-i, i), rng.get_real(-i, i)); }; - backgroundCamera->setCenter( - preShakeCenters->backgroundCameraPreShakeCenter + makeShakeVec()); - - overlayCamera->setCenter( - preShakeCenters->overlayCameraPreShakeCenter + makeShakeVec()); + backgroundCamera->setCenter(preShakeCenters->background + makeShakeVec()); + overlayCamera->setCenter(preShakeCenters->overlay + makeShakeVec()); } void HexagonGame::updateFlash(ssvu::FT mFT) diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index f74748e6..18a022ed 100644 --- a/src/SSVOpenHexagon/Core/HexagonGame.cpp +++ b/src/SSVOpenHexagon/Core/HexagonGame.cpp @@ -317,7 +317,6 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, txSmallCircle = &assets.getTextureOrNullTexture("smallCircle.png"); } - game.onUpdate += [this](ssvu::FT mFT) { update(mFT, Config::getTimescale()); }; @@ -441,7 +440,8 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, Config::loadAllJoystickBinds(); // ------------------------------------------------------------------------ - // key icons + // Key icons + initKeyIcons(); } -- cgit v1.2.3 From 2a1c4518a123fe2d4190928d5bbc484a009238e5 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 01:08:45 +0000 Subject: Do not use deprecated SFML APIs --- CMakeLists.txt | 12 ++++++------ _RELEASE/config.json | 2 +- src/SSVOpenHexagon/Core/MenuGame.cpp | 14 +++++++------- src/SSVOpenHexagon/Global/Config.cpp | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b50328fc..8cab2d3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,8 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML - GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG 7ebfaad3ad793a139ca63d904eb4d9d523389ea6 + GITHUB_REPOSITORY vittorioromeo/SFML + GIT_TAG c52377ba89e9214353f270cf2af7767078a1b9d1 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) @@ -116,7 +116,7 @@ set(LUAJIT_DISABLE_FFI ON CACHE BOOL "" FORCE) CPMAddPackage( NAME luajit - GIT_REPOSITORY https://github.com/SuperV1234/LuaJIT + GIT_REPOSITORY https://github.com/vittorioromeo/LuaJIT GIT_TAG 1fc4827feffea4f687a3f102871a3630a5ca9ee2 ) @@ -182,8 +182,8 @@ endif() if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui-sfml - GITHUB_REPOSITORY eliasdaler/imgui-sfml - GIT_TAG 4cb798bb20f41acca5872dd94a3a11f2ec0fbdb0 + GITHUB_REPOSITORY vittorioromeo/imgui-sfml + GIT_TAG cd6cc99f228da931cb2849d19957e3cce0a1d3c8 ) set_target_properties(ImGui-SFML PROPERTIES UNITY_BUILD ON) @@ -200,7 +200,7 @@ set(SODIUM_DISABLE_TESTS ON CACHE BOOL "" FORCE) CPMAddPackage( NAME libsodium-cmake - GITHUB_REPOSITORY SuperV1234/libsodium-cmake + GITHUB_REPOSITORY vittorioromeo/libsodium-cmake GIT_TAG 6afc5beec300bd28589e2e3cb22732e8123fe30f OPTIONS "SODIUM_DISABLE_TESTS ON" "SODIUM_DISABLE_TESTS ON CACHE BOOL \"\" FORCE" ) diff --git a/_RELEASE/config.json b/_RELEASE/config.json index f836a462..1c1f1b16 100644 --- a/_RELEASE/config.json +++ b/_RELEASE/config.json @@ -227,8 +227,8 @@ "t_restart" : [ [ "kSpace" ], - [ "kReturn" ], [ "bMiddle" ], + [ "" ], [ "" ] ], "t_rotate_ccw" : diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index 2d81b9ab..84e5f702 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -291,7 +291,7 @@ MenuGame::MenuGame(Steam::steam_manager& mSteamManager, } }; - game.onEvent(sf::Event::EventType::MouseWheelMoved) += + game.onEvent(sf::Event::EventType::MouseWheelScrolled) += [this](const sf::Event& mEvent) { if(window.hasFocus()) @@ -314,11 +314,11 @@ MenuGame::MenuGame(Steam::steam_manager& mSteamManager, { if(focusHeld) { - changePackQuick(mEvent.mouseWheel.delta > 0 ? -1 : 1); + changePackQuick(mEvent.mouseWheelScroll.delta > 0 ? -1 : 1); } else if(lvlDrawer != nullptr) { - lvlDrawer->YScrollTo += mEvent.mouseWheel.delta * 48.f; + lvlDrawer->YScrollTo += mEvent.mouseWheelScroll.delta * 48.f; if(lvlDrawer->YScrollTo > 0) { @@ -336,7 +336,7 @@ MenuGame::MenuGame(Steam::steam_manager& mSteamManager, return; } - wheelProgress += mEvent.mouseWheel.delta; + wheelProgress += mEvent.mouseWheelScroll.delta; if(wheelProgress > 1.f) { wheelProgress = 0.f; @@ -952,7 +952,7 @@ void MenuGame::initInput() static_cast(Tid::Focus)); game.addInput( // hardcoded - {{k::Return}}, [this](ssvu::FT /*unused*/) { okAction(); }, t::Once); + {{k::Enter}}, [this](ssvu::FT /*unused*/) { okAction(); }, t::Once); game.addInput( // hardcoded {{k::Escape}}, @@ -982,7 +982,7 @@ void MenuGame::initInput() [this](ssvu::FT /*unused*/) { mustTakeScreenshot = true; }); game.addInput( - {{k::LAlt, k::Return}}, + {{k::LAlt, k::Enter}}, [this](ssvu::FT /*unused*/) { Config::setFullscreen(window, !window.getFullscreen()); @@ -992,7 +992,7 @@ void MenuGame::initInput() .setPriorityUser(-1000); game.addInput( // hardcoded - {{k::BackSpace}}, [this](ssvu::FT /*unused*/) { eraseAction(); }, + {{k::Backspace}}, [this](ssvu::FT /*unused*/) { eraseAction(); }, t::Once); game.addInput( // hardcoded diff --git a/src/SSVOpenHexagon/Global/Config.cpp b/src/SSVOpenHexagon/Global/Config.cpp index 8470df37..8eea1ea6 100644 --- a/src/SSVOpenHexagon/Global/Config.cpp +++ b/src/SSVOpenHexagon/Global/Config.cpp @@ -161,7 +161,7 @@ using cil = std::initializer_list; X(triggerForceRestart, trig, "t_force_restart", \ cil{cmb{{k::Up}}, cmb{{k::R}}}) \ X(triggerRestart, trig, "t_restart", \ - cil{cmb{{k::Space}}, cmb{{k::Return}}, cmb{kil{}, mil{m::Middle}}}) \ + cil{cmb{{k::Space}}, cmb{{k::Enter}}, cmb{kil{}, mil{m::Middle}}}) \ X(triggerReplay, trig, "t_replay", cil{cmb{{k::Y}}}) \ X(triggerScreenshot, trig, "t_screenshot", cil{cmb{{k::F12}}}) \ X(triggerSwap, trig, "t_swap", \ -- cgit v1.2.3 From 613a3a0a2c0cfc2d9babcbb9d4ae76ea0c4b23a5 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 01:44:52 +0000 Subject: Draw flash polygon with triangles instead of quads --- include/SSVOpenHexagon/Core/HexagonGame.hpp | 2 +- include/SSVOpenHexagon/Utils/FastVertexVector.hpp | 48 ++++++++++++++++++++++- src/SSVOpenHexagon/Core/HGGraphics.cpp | 18 ++++----- src/SSVOpenHexagon/Core/HGUpdate.cpp | 4 +- 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/include/SSVOpenHexagon/Core/HexagonGame.hpp b/include/SSVOpenHexagon/Core/HexagonGame.hpp index 4944d9c9..b149e695 100644 --- a/include/SSVOpenHexagon/Core/HexagonGame.hpp +++ b/include/SSVOpenHexagon/Core/HexagonGame.hpp @@ -165,7 +165,7 @@ private: sf::Text messageText; sf::Text pbText; - ssvs::VertexVector flashPolygon{4}; + Utils::FastVertexVectorTris flashPolygon; struct Particle { diff --git a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp index f53874ef..a2359640 100644 --- a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp +++ b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp @@ -151,11 +151,57 @@ public: return _data[i]._v; } + + [[nodiscard, gnu::always_inline]] sf::Vertex* begin() noexcept + { + SSVOH_ASSERT(_data != nullptr); + return &(_data[0]._v); + } + + [[nodiscard, gnu::always_inline]] const sf::Vertex* begin() const noexcept + { + SSVOH_ASSERT(_data != nullptr); + return &(_data[0]._v); + } + + [[nodiscard, gnu::always_inline]] sf::Vertex* end() noexcept + { + return begin() + _size; + } + + [[nodiscard, gnu::always_inline]] const sf::Vertex* end() const noexcept + { + return begin() + _size; + } }; class FastVertexVectorTris : public FastVertexVector -{}; +{ +public: + [[gnu::always_inline]] void batch_unsafe_emplace_back_quad( + const sf::Color& color, const sf::Vector2f& nw, const sf::Vector2f& sw, + const sf::Vector2f& se, const sf::Vector2f& ne) + { + batch_unsafe_emplace_back(color, // + nw, sw, se, // + nw, se, ne); + } + + [[gnu::always_inline]] void unsafe_emplace_back_quad( // + const sf::Vector2f& nw, const sf::Color& colorNW, // + const sf::Vector2f& sw, const sf::Color& colorSW, // + const sf::Vector2f& se, const sf::Color& colorSE, // + const sf::Vector2f& ne, const sf::Color& colorNE) + { + unsafe_emplace_back(nw, colorNW); + unsafe_emplace_back(sw, colorSW); + unsafe_emplace_back(se, colorSE); + unsafe_emplace_back(nw, colorNW); + unsafe_emplace_back(se, colorSE); + unsafe_emplace_back(ne, colorNE); + } +}; class FastVertexVectorQuads : public FastVertexVector {}; diff --git a/src/SSVOpenHexagon/Core/HGGraphics.cpp b/src/SSVOpenHexagon/Core/HGGraphics.cpp index c53f14b7..a1f6be71 100644 --- a/src/SSVOpenHexagon/Core/HGGraphics.cpp +++ b/src/SSVOpenHexagon/Core/HGGraphics.cpp @@ -306,21 +306,21 @@ void HexagonGame::drawImguiLuaConsole() void HexagonGame::initFlashEffect(int r, int g, int b) { flashPolygon.clear(); + flashPolygon.reserve(6); const sf::Color color{static_cast(r), static_cast(g), static_cast(b), 0}; - flashPolygon.emplace_back(sf::Vector2f{-100.f, -100.f}, color); + const auto width = static_cast(Config::getWidth()); + const auto height = static_cast(Config::getHeight()); + const float offset = 100.f; - flashPolygon.emplace_back( - sf::Vector2f{Config::getWidth() + 100.f, -100.f}, color); + const sf::Vector2f nw{-offset, -offset}; + const sf::Vector2f sw{-offset, height + offset}; + const sf::Vector2f se{width + offset, height + offset}; + const sf::Vector2f ne{width + offset, -offset}; - flashPolygon.emplace_back( - sf::Vector2f{Config::getWidth() + 100.f, Config::getHeight() + 100.f}, - color); - - flashPolygon.emplace_back( - sf::Vector2f{-100.f, Config::getHeight() + 100.f}, color); + flashPolygon.batch_unsafe_emplace_back_quad(color, nw, sw, se, ne); } void HexagonGame::drawKeyIcons() diff --git a/src/SSVOpenHexagon/Core/HGUpdate.cpp b/src/SSVOpenHexagon/Core/HGUpdate.cpp index 83c9c713..7438c3cc 100644 --- a/src/SSVOpenHexagon/Core/HGUpdate.cpp +++ b/src/SSVOpenHexagon/Core/HGUpdate.cpp @@ -875,9 +875,9 @@ void HexagonGame::updateFlash(ssvu::FT mFT) status.flashEffect = ssvu::getClamped(status.flashEffect, 0.f, 255.f); - for(auto i(0u); i < 4; ++i) + for(sf::Vertex& vertex : flashPolygon) { - flashPolygon[i].color.a = status.flashEffect; + vertex.color.a = status.flashEffect; } } -- cgit v1.2.3 From 5b69bce1c2bf920676ba694ed8eff9327b15a28d Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 19:14:39 +0000 Subject: Use triangles to draw menu --- extlibs/SSVStart | 2 +- include/SSVOpenHexagon/Core/MenuGame.hpp | 2 +- include/SSVOpenHexagon/Utils/FastVertexVector.hpp | 10 +++ src/SSVOpenHexagon/Core/MenuGame.cpp | 91 +++++++++++------------ 4 files changed, 57 insertions(+), 48 deletions(-) diff --git a/extlibs/SSVStart b/extlibs/SSVStart index 0f47d697..76e92ce7 160000 --- a/extlibs/SSVStart +++ b/extlibs/SSVStart @@ -1 +1 @@ -Subproject commit 0f47d6974fc29855bdbfa8e6bac566b958e62154 +Subproject commit 76e92ce7570e4a7a921205f2f83ba842baa168b6 diff --git a/include/SSVOpenHexagon/Core/MenuGame.hpp b/include/SSVOpenHexagon/Core/MenuGame.hpp index 2143f0ce..5fd90998 100644 --- a/include/SSVOpenHexagon/Core/MenuGame.hpp +++ b/include/SSVOpenHexagon/Core/MenuGame.hpp @@ -257,7 +257,7 @@ private: sf::Color menuSelectionColor; sf::Color dialogBoxTextColor; Utils::FastVertexVectorTris menuBackgroundTris; - Utils::FastVertexVectorQuads menuQuads; + Utils::FastVertexVectorTris menuQuads; // Mouse control HRTimePoint lastMouseClick{}; diff --git a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp index a2359640..450c6012 100644 --- a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp +++ b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp @@ -201,6 +201,16 @@ public: unsafe_emplace_back(se, colorSE); unsafe_emplace_back(ne, colorNE); } + + [[gnu::always_inline]] void reserve_more_quad(const std::size_t n) + { + reserve_more(n * 6); + } + + [[gnu::always_inline]] void reserve_quad(const std::size_t n) + { + reserve(n * 6); + } }; class FastVertexVectorQuads : public FastVertexVector diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index 84e5f702..7e5aadee 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -3503,10 +3503,8 @@ void MenuGame::calcMenuItemOffset(float& offset, bool selected) void MenuGame::createQuad(const sf::Color& color, const float x1, const float x2, const float y1, const float y2) { - sf::Vector2f topLeft{x1, y1}, topRight{x2, y1}, bottomRight{x2, y2}, - bottomLeft{x1, y2}; - menuQuads.batch_unsafe_emplace_back( - color, topLeft, topRight, bottomRight, bottomLeft); + sf::Vector2f nw{x1, y1}, ne{x2, y1}, se{x2, y2}, sw{x1, y2}; + menuQuads.batch_unsafe_emplace_back_quad(color, nw, sw, se, ne); } void MenuGame::createQuad( @@ -3519,23 +3517,24 @@ void MenuGame::createQuadTrapezoid(const sf::Color& color, const float x1, const float x2, const float x3, const float y1, const float y2, const bool left) { - sf::Vector2f topLeft, topRight, bottomRight, bottomLeft; + sf::Vector2f nw, ne, se, sw; + if(left) { - topLeft = {x1, y1}; - topRight = {x2, y1}; - bottomRight = {x3, y2}; - bottomLeft = {x1, y2}; + nw = {x1, y1}; + ne = {x2, y1}; + se = {x3, y2}; + sw = {x1, y2}; } else { - topLeft = {x1, y1}; - topRight = {x2, y1}; - bottomRight = {x2, y2}; - bottomLeft = {x3, y2}; + nw = {x1, y1}; + ne = {x2, y1}; + se = {x2, y2}; + sw = {x3, y2}; } - menuQuads.batch_unsafe_emplace_back( - color, topLeft, topRight, bottomRight, bottomLeft); + + menuQuads.batch_unsafe_emplace_back_quad(color, nw, sw, se, ne); } [[nodiscard]] std::pair MenuGame::getScrollbarNotches( @@ -3561,7 +3560,7 @@ void MenuGame::drawScrollbar(const float totalHeight, const int size, startHeight{y + notchHeight * scrollbarOffset}; menuQuads.clear(); - menuQuads.reserve(4); + menuQuads.reserve_quad(1); createQuad( color, x, x + textToQuadBorder, startHeight, startHeight + barHeight); render(menuQuads); @@ -3708,7 +3707,7 @@ void MenuGame::drawMainMenu( // Draw the quads that surround the text menuQuads.clear(); - menuQuads.reserve(4 * size); + menuQuads.reserve_quad(size); static std::vector mouseOverlaps; mouseOverlaps.resize(size); @@ -3787,7 +3786,7 @@ void MenuGame::drawOptionsSubmenus( // Draw the quads that surround the text menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); createQuad(menuTextColor, 0, indent + doubleBorder, quadHeight, quadHeight + totalHeight); @@ -3921,7 +3920,7 @@ void MenuGame::drawProfileSelection( // Draw the quads that surround the text and the scroll bar if needed menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); createQuad(menuTextColor, indent - doubleBorder, indent + doubleBorder + textWidth, quadHeight, @@ -4090,7 +4089,7 @@ void MenuGame::drawEnteringText(const float xOffset, const bool revertOffset) // Draw the quads that surround the text menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); createQuad(menuTextColor, indent - doubleFrame, indent + doubleFrame + textWidth, quadHeight, quadHeight + totalHeight); @@ -4153,28 +4152,28 @@ void MenuGame::drawLoadResults() menuQuads.clear(); int i; - menuQuads.reserve(4 * 6); + menuQuads.reserve_quad(6); for(i = 0; i < 6; ++i) { const float sAngle{div * 2.f * (i + hexagonRotation)}; - const sf::Vector2f topLeft{ + const sf::Vector2f nw{ ssvs::getOrbitRad(centerPos, sAngle - div, hexagonRadius)}; - const sf::Vector2f topRight{ + const sf::Vector2f ne{ ssvs::getOrbitRad(centerPos, sAngle + div, hexagonRadius)}; - const sf::Vector2f bottomRight{ + const sf::Vector2f se{ ssvs::getOrbitRad(centerPos, sAngle + div, hexagonRadius + 10.f)}; - const sf::Vector2f bottomLeft{ + const sf::Vector2f sw{ ssvs::getOrbitRad(centerPos, sAngle - div, hexagonRadius + 10.f)}; - menuQuads.batch_unsafe_emplace_back( - sf::Color::White, topLeft, topRight, bottomRight, bottomLeft); + menuQuads.batch_unsafe_emplace_back_quad( + sf::Color::White, nw, sw, se, ne); } //-------------------------------------- // Vertical separators - menuQuads.reserve_more(4 * 3); + menuQuads.reserve_more_quad(3); const float xOffset{w / 4.f}; float topHeight{h / 2.f - h / 15.f}, bottomHeight{h / 2.f + h / 15.f}; @@ -4955,7 +4954,7 @@ void MenuGame::drawLevelSelectionRightSide( //------------------------------------- // Quads menuQuads.clear(); - menuQuads.reserve(12); + menuQuads.reserve_quad(3); // If the list is folding give all level labels the same alignment if(packChangeState != PackChange::Rest) @@ -5058,7 +5057,7 @@ void MenuGame::drawLevelSelectionRightSide( const float width = 50.f; menuQuads.clear(); - menuQuads.reserve(4); + menuQuads.reserve_quad(1); createQuad(menuQuadColor, w - width - padding, w, height - textToQuadBorder, @@ -5091,7 +5090,7 @@ void MenuGame::drawLevelSelectionRightSide( // Bottom frame for the last element menuQuads.clear(); - menuQuads.reserve(4); + menuQuads.reserve_quad(1); createQuad( menuQuadColor, prevLevelIndent, w, height, height + slctFrameSize); render(menuQuads); @@ -5112,7 +5111,7 @@ void MenuGame::drawLevelSelectionRightSide( { // Quads menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); float temp = quadsIndent - outerFrame + panelOffset; @@ -5166,7 +5165,7 @@ void MenuGame::drawLevelSelectionRightSide( txtSelectionMedium.font.setFillColor(oldC); menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); if(i == drawer.packIdx) { @@ -5186,7 +5185,7 @@ void MenuGame::drawLevelSelectionRightSide( topRight = {temp, height}; bottomRight = {temp, height + 2.f * slctFrameSize}; - menuQuads.batch_unsafe_emplace_back( + menuQuads.batch_unsafe_emplace_back_quad( menuTextColor, topLeft, bottomLeft, bottomRight, topRight); topLeft = {temp, height}; @@ -5198,7 +5197,7 @@ void MenuGame::drawLevelSelectionRightSide( topRight = {temp, height}; bottomRight = {temp, height + 2.f * slctFrameSize}; - menuQuads.batch_unsafe_emplace_back( + menuQuads.batch_unsafe_emplace_back_quad( menuTextColor, topLeft, bottomLeft, bottomRight, topRight); render(menuQuads); @@ -5217,8 +5216,8 @@ void MenuGame::drawLevelSelectionRightSide( bottomLeft = {temp, height}; bottomRight = {temp + 2.f * slctFrameSize, height}; - menuQuads.batch_unsafe_emplace_back( - menuTextColor, topLeft, topRight, bottomRight, bottomLeft); + menuQuads.batch_unsafe_emplace_back_quad( + menuTextColor, topLeft, bottomLeft, bottomRight, topRight); topLeft = {temp, height}; topRight = {temp + 2.f * slctFrameSize, height}; @@ -5230,8 +5229,8 @@ void MenuGame::drawLevelSelectionRightSide( bottomRight = { temp + 2.f * slctFrameSize, height - textToQuadBorder}; - menuQuads.batch_unsafe_emplace_back( - menuTextColor, topLeft, topRight, bottomRight, bottomLeft); + menuQuads.batch_unsafe_emplace_back_quad( + menuTextColor, topLeft, bottomLeft, bottomRight, topRight); render(menuQuads); height -= slctFrameSize / 2.f; @@ -5274,7 +5273,7 @@ void MenuGame::drawLevelSelectionLeftSide( // Backdrop - Right border menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); createQuad({menuTextColor.r, menuTextColor.g, menuTextColor.b, 150}, 0, width, 0, h); createQuad(menuQuadColor, width, width + lineThickness, 0, h); @@ -5315,7 +5314,7 @@ void MenuGame::drawLevelSelectionLeftSide( //------------------------------------- // Difficulty - menuQuads.reserve_more(8); + menuQuads.reserve_more_quad(2); // Top line height += lineThickness; @@ -5392,7 +5391,7 @@ void MenuGame::drawLevelSelectionLeftSide( {textXPos, height - txtSelectionSmall.height * fontHeightOffset}); // Bottom line - menuQuads.reserve_more(4); + menuQuads.reserve_more_quad(1); height += txtSelectionSmall.height + txtSelectionMedium.height / 2.f + lineThickness; @@ -5442,7 +5441,7 @@ void MenuGame::drawLevelSelectionLeftSide( //------------------------------------- // Favorite "button" - menuQuads.reserve_more(8 * 5); + menuQuads.reserve_more_quad(10); const float favoriteButtonBottom{height + 3.f * txtSelectionMedium.height}; // Frame @@ -5519,7 +5518,7 @@ void MenuGame::drawLevelSelectionLeftSide( // Line height += txtSelectionSmall.height + textToQuadBorder + lineThickness; - menuQuads.reserve(4); + menuQuads.reserve_quad(1); createQuad(menuQuadColor, 0, width, height, height - lineThickness); // "LEADERBOARD" @@ -5531,7 +5530,7 @@ void MenuGame::drawLevelSelectionLeftSide( // Line height += txtSelectionScore.height + txtSelectionBig.height / 2.f + 3.f; - menuQuads.reserve_more(4); + menuQuads.reserve_more_quad(1); createQuad(menuQuadColor, 0, width, height, height + lineThickness); height += lineThickness; @@ -5654,7 +5653,7 @@ void MenuGame::drawLevelSelectionLeftSide( // Line height += txtSelectionScore.height + txtSelectionBig.height / 2.f; - menuQuads.reserve_more(4); + menuQuads.reserve_more_quad(1); createQuad(menuQuadColor, 0, width, height, height + lineThickness); height += lineThickness; -- cgit v1.2.3 From c7265b1b69878a196971bfac20156ff267ca024c Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 19:16:35 +0000 Subject: Use triangles to draw dialog box --- include/SSVOpenHexagon/Core/HexagonDialogBox.hpp | 4 ++-- src/SSVOpenHexagon/Core/HexagonDialogBox.cpp | 29 ++++++++++++------------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/SSVOpenHexagon/Core/HexagonDialogBox.hpp b/include/SSVOpenHexagon/Core/HexagonDialogBox.hpp index 5cbd0224..ff43cfbe 100644 --- a/include/SSVOpenHexagon/Core/HexagonDialogBox.hpp +++ b/include/SSVOpenHexagon/Core/HexagonDialogBox.hpp @@ -17,7 +17,7 @@ class GameWindow; } namespace hg::Utils { -class FastVertexVectorQuads; +class FastVertexVectorTris; } // namespace hg::Utils namespace hg { @@ -58,7 +58,7 @@ private: void drawText( const sf::Color& txtColor, const float xOffset, const float yOffset); - void drawBox(Utils::FastVertexVectorQuads& quads, + void drawBox(Utils::FastVertexVectorTris& quads, const sf::Color& frameColor, const float x1, const float x2, const float y1, const float y2); void drawCenter(const sf::Color& txtColor, const sf::Color& backdropColor); diff --git a/src/SSVOpenHexagon/Core/HexagonDialogBox.cpp b/src/SSVOpenHexagon/Core/HexagonDialogBox.cpp index 851d3609..53fc5231 100644 --- a/src/SSVOpenHexagon/Core/HexagonDialogBox.cpp +++ b/src/SSVOpenHexagon/Core/HexagonDialogBox.cpp @@ -15,9 +15,9 @@ namespace hg { -[[nodiscard]] static Utils::FastVertexVectorQuads& getDialogFrame() +[[nodiscard]] static Utils::FastVertexVectorTris& getDialogFrame() { - thread_local Utils::FastVertexVectorQuads result; + thread_local Utils::FastVertexVectorTris result; return result; } @@ -107,17 +107,16 @@ void HexagonDialogBox::draw( } } -void HexagonDialogBox::drawBox(Utils::FastVertexVectorQuads& quads, +void HexagonDialogBox::drawBox(Utils::FastVertexVectorTris& quads, const sf::Color& frameColor, const float x1, const float x2, const float y1, const float y2) { - const sf::Vector2f topLeft{x1, y1}; - const sf::Vector2f topRight{x2, y1}; - const sf::Vector2f bottomRight{x2, y2}; - const sf::Vector2f bottomLeft{x1, y2}; + const sf::Vector2f nw{x1, y1}; + const sf::Vector2f sw{x1, y2}; + const sf::Vector2f se{x2, y2}; + const sf::Vector2f ne{x2, y1}; - quads.batch_unsafe_emplace_back( - frameColor, topLeft, topRight, bottomRight, bottomLeft); + quads.batch_unsafe_emplace_back_quad(frameColor, nw, sw, se, ne); } void HexagonDialogBox::drawText( @@ -165,9 +164,9 @@ inline constexpr float fontHeightDifferential = 0.9f; void HexagonDialogBox::drawTopLeft( const sf::Color& txtColor, const sf::Color& backdropColor) { - Utils::FastVertexVectorQuads& dialogFrame = getDialogFrame(); + Utils::FastVertexVectorTris& dialogFrame = getDialogFrame(); dialogFrame.clear(); - dialogFrame.reserve(8); + dialogFrame.reserve_quad(2); // outer frame drawBox(dialogFrame, txtColor, xPos, @@ -211,9 +210,9 @@ void HexagonDialogBox::drawCenter( rightBorder = (w + dialogWidth) / 2.f + xPos, halfHeight = totalHeight / 2.f; - Utils::FastVertexVectorQuads& dialogFrame = getDialogFrame(); + Utils::FastVertexVectorTris& dialogFrame = getDialogFrame(); dialogFrame.clear(); - dialogFrame.reserve(8); + dialogFrame.reserve_quad(2); // outer frame drawBox(dialogFrame, txtColor, leftBorder - doubleFrameSize, @@ -240,9 +239,9 @@ void HexagonDialogBox::drawCenterUpperHalf( const float leftBorder = (w - dialogWidth) / 2.f + xPos, rightBorder = (w + dialogWidth) / 2.f + xPos; - Utils::FastVertexVectorQuads& dialogFrame = getDialogFrame(); + Utils::FastVertexVectorTris& dialogFrame = getDialogFrame(); dialogFrame.clear(); - dialogFrame.reserve(8); + dialogFrame.reserve_quad(2); // outer frame drawBox(dialogFrame, txtColor, leftBorder - doubleFrameSize, -- cgit v1.2.3 From ad46e412f34a341554c8441c65684203dc1cfb62 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 19:25:22 +0000 Subject: Draw walls with triangles instead of quads --- include/SSVOpenHexagon/Components/CCustomWall.hpp | 11 ++++++----- include/SSVOpenHexagon/Components/CCustomWallManager.hpp | 2 +- include/SSVOpenHexagon/Components/CPlayer.hpp | 6 +++--- include/SSVOpenHexagon/Components/CWall.hpp | 2 +- include/SSVOpenHexagon/Core/HexagonGame.hpp | 8 ++++---- include/SSVOpenHexagon/Data/StyleData.hpp | 2 +- include/SSVOpenHexagon/Utils/FastVertexVector.hpp | 3 --- src/SSVOpenHexagon/Components/CPlayer.cpp | 14 +++++++------- src/SSVOpenHexagon/Components/CWall.cpp | 4 ++-- src/SSVOpenHexagon/Core/CCustomWallManager.cpp | 2 +- src/SSVOpenHexagon/Core/HGGraphics.cpp | 2 +- 11 files changed, 27 insertions(+), 29 deletions(-) diff --git a/include/SSVOpenHexagon/Components/CCustomWall.hpp b/include/SSVOpenHexagon/Components/CCustomWall.hpp index 1f0c67fa..58a5cd4e 100644 --- a/include/SSVOpenHexagon/Components/CCustomWall.hpp +++ b/include/SSVOpenHexagon/Components/CCustomWall.hpp @@ -49,12 +49,13 @@ public: _flags.reset(); } - [[gnu::always_inline]] void draw(Utils::FastVertexVectorQuads& wallQuads) + [[gnu::always_inline]] void draw(Utils::FastVertexVectorTris& wallQuads) { - wallQuads.unsafe_emplace_back(_vertexPositions[0], _vertexColors[0]); - wallQuads.unsafe_emplace_back(_vertexPositions[1], _vertexColors[1]); - wallQuads.unsafe_emplace_back(_vertexPositions[2], _vertexColors[2]); - wallQuads.unsafe_emplace_back(_vertexPositions[3], _vertexColors[3]); + wallQuads.unsafe_emplace_back_quad( // + _vertexPositions[0], _vertexColors[0], // + _vertexPositions[1], _vertexColors[1], // + _vertexPositions[2], _vertexColors[2], // + _vertexPositions[3], _vertexColors[3]); } [[nodiscard, gnu::always_inline]] bool isOverlapping( diff --git a/include/SSVOpenHexagon/Components/CCustomWallManager.hpp b/include/SSVOpenHexagon/Components/CCustomWallManager.hpp index c9e66665..310bf189 100644 --- a/include/SSVOpenHexagon/Components/CCustomWallManager.hpp +++ b/include/SSVOpenHexagon/Components/CCustomWallManager.hpp @@ -90,7 +90,7 @@ public: [[nodiscard]] std::uint8_t getKillingSide(const CCustomWallHandle cwHandle); void clear(); - void draw(Utils::FastVertexVectorQuads& wallQuads); + void draw(Utils::FastVertexVectorTris& wallQuads); [[nodiscard]] bool handleCollision( const int movement, const float radius, CPlayer& mPlayer, ssvu::FT mFT); diff --git a/include/SSVOpenHexagon/Components/CPlayer.hpp b/include/SSVOpenHexagon/Components/CPlayer.hpp index 834d6db5..61c14c9e 100644 --- a/include/SSVOpenHexagon/Components/CPlayer.hpp +++ b/include/SSVOpenHexagon/Components/CPlayer.hpp @@ -67,10 +67,10 @@ private: float _currTiltedAngle; void drawPivot(const unsigned int sides, const sf::Color& colorMain, - Utils::FastVertexVectorQuads& wallQuads, + Utils::FastVertexVectorTris& wallQuads, Utils::FastVertexVectorTris& capTris, const sf::Color& capColor); - void drawDeathEffect(Utils::FastVertexVectorQuads& wallQuads); + void drawDeathEffect(Utils::FastVertexVectorTris& wallQuads); template [[nodiscard]] bool checkWallCollisionEscape( @@ -120,7 +120,7 @@ public: const sf::Color& colorPlayer) const; void draw(const unsigned int sides, const sf::Color& colorMain, - const sf::Color& colorPlayer, Utils::FastVertexVectorQuads& wallQuads, + const sf::Color& colorPlayer, Utils::FastVertexVectorTris& wallQuads, Utils::FastVertexVectorTris& capTris, Utils::FastVertexVectorTris& playerTris, const sf::Color& capColor, const float angleTiltIntensity, const bool swapBlinkingEffect); diff --git a/include/SSVOpenHexagon/Components/CWall.hpp b/include/SSVOpenHexagon/Components/CWall.hpp index c4113443..34b410a7 100644 --- a/include/SSVOpenHexagon/Components/CWall.hpp +++ b/include/SSVOpenHexagon/Components/CWall.hpp @@ -48,7 +48,7 @@ public: ssvs::rotateRadAround(vertex, centerPos, _curve._speed / 60.f * ft); } - void draw(sf::Color color, Utils::FastVertexVectorQuads& wallQuads); + void draw(sf::Color color, Utils::FastVertexVectorTris& wallQuads); void setHueMod(float hueMod) noexcept; diff --git a/include/SSVOpenHexagon/Core/HexagonGame.hpp b/include/SSVOpenHexagon/Core/HexagonGame.hpp index b149e695..f015e859 100644 --- a/include/SSVOpenHexagon/Core/HexagonGame.hpp +++ b/include/SSVOpenHexagon/Core/HexagonGame.hpp @@ -425,12 +425,12 @@ private: void performPlayerKill(); Utils::FastVertexVectorTris backgroundTris; - Utils::FastVertexVectorQuads wallQuads; - Utils::FastVertexVectorQuads pivotQuads; + Utils::FastVertexVectorTris wallQuads; + Utils::FastVertexVectorTris pivotQuads; Utils::FastVertexVectorTris playerTris; Utils::FastVertexVectorTris capTris; - Utils::FastVertexVectorQuads wallQuads3D; - Utils::FastVertexVectorQuads pivotQuads3D; + Utils::FastVertexVectorTris wallQuads3D; + Utils::FastVertexVectorTris pivotQuads3D; Utils::FastVertexVectorTris playerTris3D; public: diff --git a/include/SSVOpenHexagon/Data/StyleData.hpp b/include/SSVOpenHexagon/Data/StyleData.hpp index 52d0040a..646d9aa6 100644 --- a/include/SSVOpenHexagon/Data/StyleData.hpp +++ b/include/SSVOpenHexagon/Data/StyleData.hpp @@ -30,7 +30,7 @@ using Obj = Json::Value; namespace hg::Utils { class FastVertexVectorTris; -class FastVertexVectorQuads; +class FastVertexVectorTris; } // namespace hg::Utils diff --git a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp index 450c6012..33545bee 100644 --- a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp +++ b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp @@ -213,7 +213,4 @@ public: } }; -class FastVertexVectorQuads : public FastVertexVector -{}; - } // namespace hg::Utils diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp index b452d940..efded9fb 100644 --- a/src/SSVOpenHexagon/Components/CPlayer.cpp +++ b/src/SSVOpenHexagon/Components/CPlayer.cpp @@ -78,7 +78,7 @@ CPlayer::CPlayer(const sf::Vector2f& pos, const float swapCooldown, } void CPlayer::draw(const unsigned int sides, const sf::Color& colorMain, - const sf::Color& colorPlayer, Utils::FastVertexVectorQuads& wallQuads, + const sf::Color& colorPlayer, Utils::FastVertexVectorTris& wallQuads, Utils::FastVertexVectorTris& capTris, Utils::FastVertexVectorTris& playerTris, const sf::Color& capColor, const float angleTiltIntensity, const bool swapBlinkingEffect) @@ -107,7 +107,7 @@ void CPlayer::draw(const unsigned int sides, const sf::Color& colorMain, } void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, - Utils::FastVertexVectorQuads& wallQuads, + Utils::FastVertexVectorTris& wallQuads, Utils::FastVertexVectorTris& capTris, const sf::Color& capColor) { const float div{ssvu::tau / sides * 0.5f}; @@ -126,15 +126,15 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, const sf::Vector2f p4{ssvs::getOrbitRad( _startPos, sAngle - div, pRadius + baseThickness)}; - wallQuads.reserve_more(4); - wallQuads.batch_unsafe_emplace_back(colorMain, p1, p2, p3, p4); + wallQuads.reserve_more_quad(1); + wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4); capTris.reserve_more(3); capTris.batch_unsafe_emplace_back(capColor, p1, p2, _startPos); } } -void CPlayer::drawDeathEffect(Utils::FastVertexVectorQuads& wallQuads) +void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads) { const float div{ssvu::tau / 6 * 0.5f}; const float dRadius{_hue / 8.f}; @@ -153,8 +153,8 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorQuads& wallQuads) const sf::Vector2f p4{ ssvs::getOrbitRad(_pos, sAngle - div, dRadius + thickness)}; - wallQuads.reserve_more(4); - wallQuads.batch_unsafe_emplace_back(colorMain, p1, p2, p3, p4); + wallQuads.reserve_more_quad(1); + wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4); } } diff --git a/src/SSVOpenHexagon/Components/CWall.cpp b/src/SSVOpenHexagon/Components/CWall.cpp index b6decdbb..88b5bd08 100644 --- a/src/SSVOpenHexagon/Components/CWall.cpp +++ b/src/SSVOpenHexagon/Components/CWall.cpp @@ -25,14 +25,14 @@ CWall::CWall(const unsigned int sides, const float wallAngleLeft, angle - div + wallAngleRight, distance + thickness + wallSkewRight); } -void CWall::draw(sf::Color color, Utils::FastVertexVectorQuads& wallQuads) +void CWall::draw(sf::Color color, Utils::FastVertexVectorTris& wallQuads) { if(_hueMod != 0) { color = Utils::transformHue(color, _hueMod); } - wallQuads.batch_unsafe_emplace_back(color, _vertexPositions[0], + wallQuads.batch_unsafe_emplace_back_quad(color, _vertexPositions[0], _vertexPositions[1], _vertexPositions[2], _vertexPositions[3]); } diff --git a/src/SSVOpenHexagon/Core/CCustomWallManager.cpp b/src/SSVOpenHexagon/Core/CCustomWallManager.cpp index 4a1b39ed..a3c38792 100644 --- a/src/SSVOpenHexagon/Core/CCustomWallManager.cpp +++ b/src/SSVOpenHexagon/Core/CCustomWallManager.cpp @@ -317,7 +317,7 @@ void CCustomWallManager::clear() _count = 0; } -void CCustomWallManager::draw(Utils::FastVertexVectorQuads& wallQuads) +void CCustomWallManager::draw(Utils::FastVertexVectorTris& wallQuads) { for(CCustomWallHandle h = 0; h < (int)_customWalls.size(); ++h) { diff --git a/src/SSVOpenHexagon/Core/HGGraphics.cpp b/src/SSVOpenHexagon/Core/HGGraphics.cpp index a1f6be71..f3dc2ef4 100644 --- a/src/SSVOpenHexagon/Core/HGGraphics.cpp +++ b/src/SSVOpenHexagon/Core/HGGraphics.cpp @@ -104,7 +104,7 @@ void HexagonGame::draw() capTris.clear(); // Reserve right amount of memory for all walls and custom walls - wallQuads.reserve_more(4 * walls.size() + 4 * cwManager.count()); + wallQuads.reserve_more_quad(walls.size() + cwManager.count()); for(CWall& w : walls) { -- cgit v1.2.3 From a85ebab820f9ba4c2f4edb850dc8b18fc127eb90 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 19:38:55 +0000 Subject: update sfml version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cab2d3d..7f0d07fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG c52377ba89e9214353f270cf2af7767078a1b9d1 + GIT_TAG 5ee213b93df7d5cf71a59919831dc617c88f1152 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) -- cgit v1.2.3 From eb1a5c456385ff8f7a5b9670aac0f3e54af4ee6e Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Fri, 10 Dec 2021 13:33:41 +0000 Subject: PCH fixes --- include/SSVOpenHexagon/Global/PCH.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/SSVOpenHexagon/Global/PCH.hpp b/include/SSVOpenHexagon/Global/PCH.hpp index 6712143a..a8d7ba1c 100644 --- a/include/SSVOpenHexagon/Global/PCH.hpp +++ b/include/SSVOpenHexagon/Global/PCH.hpp @@ -5,8 +5,17 @@ #pragma once #ifdef _WIN32 + +#ifndef NOMINMAX #define NOMINMAX +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + #include + #endif #include -- cgit v1.2.3 From dbe27ae3a49f8f8134fad9402b82109be36ce3d2 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Fri, 10 Dec 2021 13:44:18 +0000 Subject: update sfml --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f0d07fe..81f2e12d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 5ee213b93df7d5cf71a59919831dc617c88f1152 + GIT_TAG 9794d442cacc612cfbb5bdb11ca01b27d6650d7e ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) -- cgit v1.2.3 From 42591fc21eeb4aa594617dbf69c07d542c1616d7 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Tue, 21 Dec 2021 18:12:53 +0100 Subject: Update SFML --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81f2e12d..e9ced014 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 9794d442cacc612cfbb5bdb11ca01b27d6650d7e + GIT_TAG 214ac439d7bf21e940d701146da325fb7e557881 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) -- cgit v1.2.3 From b80134833fc55fd7006bd34bd41c6be3ae6a1dd8 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 23 Dec 2021 17:50:05 +0100 Subject: Update SFML and imgui-sfml --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9ced014..60f60ccf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 214ac439d7bf21e940d701146da325fb7e557881 + GIT_TAG 01ff472bfbaaf7aef6334ced78755a5e98236649 Date: Thu, 23 Dec 2021 17:51:00 +0100 Subject: Update SFML and imgui-sfml2 --- include/SSVOpenHexagon/Global/Imgui.hpp | 2 +- src/SSVOpenHexagon/Core/main.cpp | 5 +++- src/SSVOpenHexagon/Global/Config.cpp | 46 ++++++++++++++++----------------- src/SSVOpenHexagon/Global/Imgui.cpp | 4 +-- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/include/SSVOpenHexagon/Global/Imgui.hpp b/include/SSVOpenHexagon/Global/Imgui.hpp index b7c4394e..0dc9289b 100644 --- a/include/SSVOpenHexagon/Global/Imgui.hpp +++ b/include/SSVOpenHexagon/Global/Imgui.hpp @@ -12,7 +12,7 @@ class RenderWindow; namespace hg::Imgui { -void initialize(sf::RenderWindow&); +[[nodiscard]] bool initialize(sf::RenderWindow&); void shutdown(); [[nodiscard]] bool wantCaptureKeyboard(); [[nodiscard]] bool wantCaptureMouse(); diff --git a/src/SSVOpenHexagon/Core/main.cpp b/src/SSVOpenHexagon/Core/main.cpp index 7cc42208..c0c27008 100644 --- a/src/SSVOpenHexagon/Core/main.cpp +++ b/src/SSVOpenHexagon/Core/main.cpp @@ -344,7 +344,10 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector& args) if(!headless) { SSVOH_ASSERT(window.has_value()); - hg::Imgui::initialize(*window); + if(!hg::Imgui::initialize(*window)) + { + ssvu::lo("::main") << "Failed to initialize ImGui...\n"; + } } HG_SCOPE_GUARD({ diff --git a/src/SSVOpenHexagon/Global/Config.cpp b/src/SSVOpenHexagon/Global/Config.cpp index 8eea1ea6..7c0bcff4 100644 --- a/src/SSVOpenHexagon/Global/Config.cpp +++ b/src/SSVOpenHexagon/Global/Config.cpp @@ -147,30 +147,30 @@ using cil = std::initializer_list; X(joystickAddToFavorites, uint, "j_add_favorite", 8) \ X(joystickFavoritesMenu, uint, "j_favorite_menu", 9) -#define X_LINKEDVALUES_BINDS_TRIGGERS \ - X(triggerRotateCCW, trig, "t_rotate_ccw", \ - cil{cmb{{k::A}}, cmb{{k::Left}}, cmb{kil{}, mil{m::Left}}}) \ - X(triggerRotateCW, trig, "t_rotate_cw", \ - cil{cmb{{k::D}}, cmb{{k::Right}}, cmb{kil{}, mil{m::Right}}}) \ - X(triggerFocus, trig, "t_focus", \ - cil{cmb{{k::LShift}}, cmb{kil{}, mil{m::XButton1}}}) \ - X(triggerSelect, trig, "t_select", \ - cil{cmb{{k::Space}}, cmb{kil{}, mil{m::Middle}}}) \ - X(triggerExit, trig, "t_exit", \ - cil{cmb{{k::T}}, cmb{kil{}, mil{m::XButton2}}}) \ - X(triggerForceRestart, trig, "t_force_restart", \ - cil{cmb{{k::Up}}, cmb{{k::R}}}) \ - X(triggerRestart, trig, "t_restart", \ +#define X_LINKEDVALUES_BINDS_TRIGGERS \ + X(triggerRotateCCW, trig, "t_rotate_ccw", \ + cil{cmb{{k::A}}, cmb{{k::Left}}, cmb{kil{}, mil{m::Left}}}) \ + X(triggerRotateCW, trig, "t_rotate_cw", \ + cil{cmb{{k::D}}, cmb{{k::Right}}, cmb{kil{}, mil{m::Right}}}) \ + X(triggerFocus, trig, "t_focus", \ + cil{cmb{{k::LShift}}, cmb{kil{}, mil{m::XButton1}}}) \ + X(triggerSelect, trig, "t_select", \ + cil{cmb{{k::Space}}, cmb{kil{}, mil{m::Middle}}}) \ + X(triggerExit, trig, "t_exit", \ + cil{cmb{{k::T}}, cmb{kil{}, mil{m::XButton2}}}) \ + X(triggerForceRestart, trig, "t_force_restart", \ + cil{cmb{{k::Up}}, cmb{{k::R}}}) \ + X(triggerRestart, trig, "t_restart", \ cil{cmb{{k::Space}}, cmb{{k::Enter}}, cmb{kil{}, mil{m::Middle}}}) \ - X(triggerReplay, trig, "t_replay", cil{cmb{{k::Y}}}) \ - X(triggerScreenshot, trig, "t_screenshot", cil{cmb{{k::F12}}}) \ - X(triggerSwap, trig, "t_swap", \ - cil{cmb{{k::Space}}, cmb{kil{}, mil{m::Middle}}}) \ - X(triggerUp, trig, "t_up", cil{cmb{{k::W}}}) \ - X(triggerDown, trig, "t_down", cil{cmb{{k::S}}}) \ - X(triggerNextPack, trig, "t_next", cil{cmb{{k::PageDown}}}) \ - X(triggerPreviousPack, trig, "t_previous", cil{cmb{{k::PageUp}}}) \ - X(triggerLuaConsole, trig, "t_lua_console", cil{cmb{{k::F1}}}) \ + X(triggerReplay, trig, "t_replay", cil{cmb{{k::Y}}}) \ + X(triggerScreenshot, trig, "t_screenshot", cil{cmb{{k::F12}}}) \ + X(triggerSwap, trig, "t_swap", \ + cil{cmb{{k::Space}}, cmb{kil{}, mil{m::Middle}}}) \ + X(triggerUp, trig, "t_up", cil{cmb{{k::W}}}) \ + X(triggerDown, trig, "t_down", cil{cmb{{k::S}}}) \ + X(triggerNextPack, trig, "t_next", cil{cmb{{k::PageDown}}}) \ + X(triggerPreviousPack, trig, "t_previous", cil{cmb{{k::PageUp}}}) \ + X(triggerLuaConsole, trig, "t_lua_console", cil{cmb{{k::F1}}}) \ X(triggerPause, trig, "t_pause", cil{cmb{{k::F2}}}) #define X_LINKEDVALUES_BINDS \ diff --git a/src/SSVOpenHexagon/Global/Imgui.cpp b/src/SSVOpenHexagon/Global/Imgui.cpp index 639e16f7..3dbe2ddc 100644 --- a/src/SSVOpenHexagon/Global/Imgui.cpp +++ b/src/SSVOpenHexagon/Global/Imgui.cpp @@ -15,10 +15,10 @@ namespace hg::Imgui { -void initialize([[maybe_unused]] sf::RenderWindow& window) +[[nodiscard]] bool initialize([[maybe_unused]] sf::RenderWindow& window) { #ifndef SSVOH_ANDROID - ImGui::SFML::Init(window); + return ImGui::SFML::Init(window); #endif } -- cgit v1.2.3 From 0209d63d4c5a2246c814f932b484b5d8337433a1 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 23 Dec 2021 17:52:15 +0100 Subject: Fix SFML tag --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60f60ccf..f23970c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 01ff472bfbaaf7aef6334ced78755a5e98236649 Date: Thu, 23 Dec 2021 18:55:32 +0100 Subject: Add new path for laptop VM --- buildlx/make_release_server_vbox_2_copy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/buildlx/make_release_server_vbox_2_copy.sh b/buildlx/make_release_server_vbox_2_copy.sh index 75e70259..491bd58b 100755 --- a/buildlx/make_release_server_vbox_2_copy.sh +++ b/buildlx/make_release_server_vbox_2_copy.sh @@ -10,6 +10,7 @@ echo "--------------------------------------------------------------------" echo "" cp ./SSVOpenHexagon /media/sf_C_DRIVE/OHWorkspace/SSVOpenHexagon/_RELEASE/SSVOpenHexagonVbox +cp ./SSVOpenHexagon /media/ohw/SSVOpenHexagon/SSVOpenHexagon/_RELEASE/SSVOpenHexagonVbox echo "" echo "" -- cgit v1.2.3 From b01f6a8de7d4892230b6cd17296d1c271ed5bd54 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sun, 26 Dec 2021 17:41:37 +0100 Subject: Update SFMLW --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f23970c5..310fc97c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,12 +95,12 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 01ff472bfbaaf7aef6334ced78755a5e98236649 + GIT_TAG a1bc5113e0fb669ae3bfa4c3d9d813bdd30dc2af ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) -set_target_properties(sfml-window PROPERTIES UNITY_BUILD OFF) -set_target_properties(sfml-graphics PROPERTIES UNITY_BUILD OFF) +set_target_properties(sfml-window PROPERTIES UNITY_BUILD ON) +set_target_properties(sfml-graphics PROPERTIES UNITY_BUILD ON) set_target_properties(sfml-audio PROPERTIES UNITY_BUILD ON) set_target_properties(sfml-network PROPERTIES UNITY_BUILD ON) -- cgit v1.2.3 From 7c801d2ddcdf8ce58693e683ab65ea49b7a6ca4f Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Tue, 28 Dec 2021 17:33:22 +0100 Subject: Update SFML --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 310fc97c..cf48d739 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG a1bc5113e0fb669ae3bfa4c3d9d813bdd30dc2af + GIT_TAG 77d72ceb93be89d08b9691fbb177b8372600216d ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) -- cgit v1.2.3 From 2a6e7879bdce84595513c59c6ae6eb7e9d3830c9 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Fri, 7 Jan 2022 22:55:05 +0100 Subject: Update to latest SFML --- CMakeLists.txt | 6 +++--- src/SSVOpenHexagon/Core/MenuGame.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf48d739..0eb944ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,9 @@ endif() option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE) if(${FORCE_COLORED_OUTPUT}) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (CMAKE_CXX_COMPILER MATCHES "g\\+\\+")) add_compile_options("-fdiagnostics-color=always") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR (CMAKE_CXX_COMPILER MATCHES "clang\\+\\+")) add_compile_options("-fcolor-diagnostics") endif() endif() @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 77d72ceb93be89d08b9691fbb177b8372600216d + GIT_TAG 8d88c9dc9c506760a37af0b1bd1f924ecdbd587f ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index 7e5aadee..ae5b2b37 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -3124,7 +3124,7 @@ void MenuGame::refreshCamera() {ssvs::zeroVec2f, {Config::getSizeX() * Config::getZoomFactor(), Config::getSizeY() * Config::getZoomFactor()}}); - overlayCamera.setView(sf::View{sf::FloatRect(0, 0, w, h)}); + overlayCamera.setView(sf::View{sf::FloatRect({0, 0}, {w, h})}); titleBar.setOrigin(ssvs::zeroVec2f); titleBar.setScale({0.5f, 0.5f}); @@ -5940,7 +5940,7 @@ void MenuGame::drawGraphics() void MenuGame::drawOnlineStatus() { window.getRenderWindow().setView( - sf::View{{0.f, 0.f, getWindowWidth(), getWindowHeight()}}); + sf::View{{{0.f, 0.f}, {getWindowWidth(), getWindowHeight()}}}); const float onlineStatusScaling = 1.5f; const float scaling = onlineStatusScaling / Config::getZoomFactor(); -- cgit v1.2.3 From 32484802abb462d07f434b9f79335532a7c651f9 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 8 Jan 2022 14:00:40 +0100 Subject: update libs --- CMakeLists.txt | 8 ++++---- _RELEASE/config.json | 2 +- build/copylibs.sh | 1 + buildrel/copylibs.sh | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0eb944ab..c585f4c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ endif() # CPM # ----------------------------------------------------------------------------- -set(CPM_DOWNLOAD_VERSION 0.32.0) +set(CPM_DOWNLOAD_VERSION 0.34.0) if(CPM_SOURCE_CACHE) set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") @@ -95,7 +95,7 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 8d88c9dc9c506760a37af0b1bd1f924ecdbd587f + GIT_TAG 596955141c9d6550aeeea196297d07f8b9143645 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) @@ -117,7 +117,7 @@ set(LUAJIT_DISABLE_FFI ON CACHE BOOL "" FORCE) CPMAddPackage( NAME luajit GIT_REPOSITORY https://github.com/vittorioromeo/LuaJIT - GIT_TAG 1fc4827feffea4f687a3f102871a3630a5ca9ee2 + GIT_TAG 6979458f60adb6e95a8b781035c7a11913861178 ) set(LUAJIT_DISABLE_FFI true) @@ -157,7 +157,7 @@ if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui GITHUB_REPOSITORY ocornut/imgui - GIT_TAG 270d4d0855ea3b2f66833ab1124ec475abe9df9c + GIT_TAG afffcd5810d030e24056c1a61f27a6eb632f50ed DOWNLOAD_ONLY YES ) diff --git a/_RELEASE/config.json b/_RELEASE/config.json index 1c1f1b16..20403c13 100644 --- a/_RELEASE/config.json +++ b/_RELEASE/config.json @@ -149,7 +149,7 @@ "server_local" : true, "server_port" : 50505, "server_verbose" : true, - "show_fps" : false, + "show_fps" : true, "show_key_icons" : false, "show_level_info" : false, "show_login_at_startup" : false, diff --git a/build/copylibs.sh b/build/copylibs.sh index c396395e..c1024a47 100644 --- a/build/copylibs.sh +++ b/build/copylibs.sh @@ -54,3 +54,4 @@ cp /c/msys64/mingw64/bin/libwinpthread-1.dll ./test/ cp ../_RELEASE/discord_game_sdk.dll ./test cp ../_RELEASE/steam_api64.dll ./test +cp ../_RELEASE/sdkencryptedappticket64.dll ./test diff --git a/buildrel/copylibs.sh b/buildrel/copylibs.sh index 0c60afa8..830bfbbe 100644 --- a/buildrel/copylibs.sh +++ b/buildrel/copylibs.sh @@ -66,5 +66,6 @@ cp /c/msys64/mingw64/bin/libwinpthread-1.dll ./test/ & cp ../_RELEASE/discord_game_sdk.dll ./test & cp ../_RELEASE/steam_api64.dll ./test & +cp ../_RELEASE/sdkencryptedappticket64.dll ./test & wait -- cgit v1.2.3 From 6c851c07289838c7e222bd80ce08a0ce75fd65b6 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 8 Jan 2022 14:29:47 +0100 Subject: New ranked levels: Dragon Mayhem, Sky Fasion, Ti84, Super Plausible Level --- _RELEASE/config.json | 35 +++++++++-------------------------- src/SSVOpenHexagon/Global/Config.cpp | 22 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/_RELEASE/config.json b/_RELEASE/config.json index 20403c13..aaf9ef24 100644 --- a/_RELEASE/config.json +++ b/_RELEASE/config.json @@ -45,7 +45,6 @@ "no_rotation" : false, "no_sound" : false, "official" : true, - "online" : true, "pixel_multiplier" : 1, "play_swap_ready_sound" : true, "player_focus_speed" : 4.6250, @@ -58,7 +57,6 @@ "pulse_enabled" : true, "rotate_to_start" : false, "save_last_login_username" : true, - "save_local_best_replay_to_file" : true, "server_control_port" : 50506, "server_ip" : "139.162.199.162", "server_level_whitelist" : @@ -146,10 +144,8 @@ "vanitylevels_Vipre_Vanity_10006_troglodyte_m_1.001", "vanitylevels_Vipre_Vanity_10006_troglodyte_m_1.002" ], - "server_local" : true, "server_port" : 50505, - "server_verbose" : true, - "show_fps" : true, + "show_fps" : false, "show_key_icons" : false, "show_level_info" : false, "show_login_at_startup" : false, @@ -191,31 +187,19 @@ ], "t_lua_console" : [ - [ "kF1" ], - [ "" ], - [ "" ], - [ "" ] + [ "kF1" ] ], "t_next" : [ - [ "kPageDown" ], - [ "" ], - [ "" ], - [ "" ] + [ "kPageDown" ] ], "t_pause" : [ - [ "kF2" ], - [ "" ], - [ "" ], - [ "" ] + [ "kF2" ] ], "t_previous" : [ - [ "kPageUp" ], - [ "" ], - [ "" ], - [ "" ] + [ "kPageUp" ] ], "t_replay" : [ @@ -227,8 +211,8 @@ "t_restart" : [ [ "kSpace" ], + [ "kEnter" ], [ "bMiddle" ], - [ "" ], [ "" ] ], "t_rotate_ccw" : @@ -275,11 +259,10 @@ ], "text_padding" : 8.0, "text_scaling" : 1.0, - "timer_static" : true, "timescale" : 1.0, "vsync" : false, "windowed_auto_resolution" : false, - "windowed_height" : 720, - "windowed_width" : 1280, - "zoom_factor" : 1.066666722297668 + "windowed_height" : 763, + "windowed_width" : 1206, + "zoom_factor" : 1.006553053855896 } diff --git a/src/SSVOpenHexagon/Global/Config.cpp b/src/SSVOpenHexagon/Global/Config.cpp index 7c0bcff4..1b5ddc90 100644 --- a/src/SSVOpenHexagon/Global/Config.cpp +++ b/src/SSVOpenHexagon/Global/Config.cpp @@ -114,7 +114,27 @@ defaultServerLevelWhitelist() "vanitylevels_Vipre_Vanity_10006_technology_m_1.001", "vanitylevels_Vipre_Vanity_10006_troglodyte_m_1", "vanitylevels_Vipre_Vanity_10006_troglodyte_m_1.001", - "vanitylevels_Vipre_Vanity_10006_troglodyte_m_1.002" // + "vanitylevels_Vipre_Vanity_10006_troglodyte_m_1.002", + + // clang-format off + // Morxemplum - Rotationality Remastered [Steam Workshop] + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_dragonMayhem_m_1", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_dragonMayhem_m_2", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_dragonMayhem_m_3", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_dragonMayhem_m_5", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_dragonMayhem_m_6.66", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_skyFasion_m_1", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_skyFasion_m_2", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_skyFasion_m_3", + "rotationality_SkyMidnight_Rotationality_(Remastered)_2_skyFasion_m_5", + // clang-format on + + // Syyrion - Travel [Steam Workshop] + "1D2B-E31E-EC19_Syyrion_Travel_13103_ti84_m_0.8", + "1D2B-E31E-EC19_Syyrion_Travel_13103_ti84_m_1", + "1D2B-E31E-EC19_Syyrion_Travel_13103_ti84_m_1.2", + "1D2B-E31E-EC19_Syyrion_Travel_13103_ti84_m_1.4", + "1D2B-E31E-EC19_Syyrion_Travel_13103_spl_m_1" // }; return result; -- cgit v1.2.3 From 31d351b719de3d4565733738c8bf7ec317fbe7a0 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 8 Jan 2022 14:44:56 +0100 Subject: scripts --- buildlx/make_release_server_vbox_2_copy.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/buildlx/make_release_server_vbox_2_copy.sh b/buildlx/make_release_server_vbox_2_copy.sh index 491bd58b..75e70259 100755 --- a/buildlx/make_release_server_vbox_2_copy.sh +++ b/buildlx/make_release_server_vbox_2_copy.sh @@ -10,7 +10,6 @@ echo "--------------------------------------------------------------------" echo "" cp ./SSVOpenHexagon /media/sf_C_DRIVE/OHWorkspace/SSVOpenHexagon/_RELEASE/SSVOpenHexagonVbox -cp ./SSVOpenHexagon /media/ohw/SSVOpenHexagon/SSVOpenHexagon/_RELEASE/SSVOpenHexagonVbox echo "" echo "" -- cgit v1.2.3 From 87d03c333027b4ca02af993323b59cb5539631ad Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 8 Jan 2022 15:15:31 +0100 Subject: scripts --- buildlx/make_release_client_vbox_2_copy.sh | 10 +++++----- release_checklist.md | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/buildlx/make_release_client_vbox_2_copy.sh b/buildlx/make_release_client_vbox_2_copy.sh index 2c5afcd9..576fd446 100755 --- a/buildlx/make_release_client_vbox_2_copy.sh +++ b/buildlx/make_release_client_vbox_2_copy.sh @@ -29,15 +29,15 @@ echo "| COPYING DEPS TO VBOX DRIVE |" echo "--------------------------------------------------------------------" echo "" -cp ./_deps/sfml-build/lib/libsfml-audio.so.2.5 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-network.so.2.5 ../_RELEASE +cp ./_deps/sfml-build/lib/libsfml-audio.so.3.0 ../_RELEASE +cp ./_deps/sfml-build/lib/libsfml-network.so.3.0 ../_RELEASE cp ./_deps/luajit-build/src/libluajit.so ../_RELEASE cp ./_deps/zlib-build/libz.so.1 ../_RELEASE cp ./_deps/libsodium-cmake-build/libsodium.so ../_RELEASE cp ./_deps/imgui-sfml-build/libImGui-SFML.so ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-graphics.so.2.5 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-window.so.2.5 ../_RELEASE -cp ./_deps/sfml-build/lib/libsfml-system.so.2.5 ../_RELEASE +cp ./_deps/sfml-build/lib/libsfml-graphics.so.3.0 ../_RELEASE +cp ./_deps/sfml-build/lib/libsfml-window.so.3.0 ../_RELEASE +cp ./_deps/sfml-build/lib/libsfml-system.so.3.0 ../_RELEASE echo "" echo "" diff --git a/release_checklist.md b/release_checklist.md index 58a14737..6edaa2d3 100644 --- a/release_checklist.md +++ b/release_checklist.md @@ -12,7 +12,13 @@ 5. Run `./vbox/build_and_upload_server.sh` -5. Verify that the server is working with `ssh vittorioromeo@139.162.199.162`, `sudo journalctl -u openhexagon-server -f` +6. Copy libs with: + + ```bash + for d in $(find _deps | grep "\.so"); do scp $d vittorioromeo@139.162.199.162:/home/vittorioromeo/OHWorkspace/SSVOpenHexagon/buildlx; done + ``` + +7. Verify that the server is working with `ssh vittorioromeo@139.162.199.162`, `sudo journalctl -u openhexagon-server -f` ## Linux Client @@ -52,13 +58,15 @@ ## Lua Reference -1. Go to `SSVOpenHexagon/_RELEASE` +1. Temporarily change `CMakeLists.txt` to enable Lua Reference code + +2. Go to `SSVOpenHexagon/_RELEASE` -2. Run `./SSVOpenHexagon.exe -printLuaDocs > temp.md` +3. Run `./SSVOpenHexagon.exe -printLuaDocs > temp.md` -3. Open `temp.md` with an editor, find `## Utility Function` as the starting point and copy the Lua docs +4. Open `temp.md` with an editor, find `## Utility Function` as the starting point and copy the Lua docs -4. Go to and paste them there, after the `` marker +5. Go to and paste them there, after the `` marker ## Patch Notes -- cgit v1.2.3 From 8313cea2c284cf8115229459f470d4d0960956c3 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 8 Jan 2022 15:16:34 +0100 Subject: scripts --- prepare_release_linux.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prepare_release_linux.sh b/prepare_release_linux.sh index 092a0d35..1e854b25 100755 --- a/prepare_release_linux.sh +++ b/prepare_release_linux.sh @@ -23,11 +23,11 @@ cp ./_RELEASE/libImGui-SFML.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libdiscord_game_sdk.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libluajit.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libsdkencryptedappticket.so ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-audio.so.2.5 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-graphics.so.2.5 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-network.so.2.5 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-system.so.2.5 ./_PREPARED_RELEASE_LINUX -cp ./_RELEASE/libsfml-window.so.2.5 ./_PREPARED_RELEASE_LINUX +cp ./_RELEASE/libsfml-audio.so.3.0 ./_PREPARED_RELEASE_LINUX +cp ./_RELEASE/libsfml-graphics.so.3.0 ./_PREPARED_RELEASE_LINUX +cp ./_RELEASE/libsfml-network.so.3.0 ./_PREPARED_RELEASE_LINUX +cp ./_RELEASE/libsfml-system.so.3.0 ./_PREPARED_RELEASE_LINUX +cp ./_RELEASE/libsfml-window.so.3.0 ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libsodium.so ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libstdc++.so.6 ./_PREPARED_RELEASE_LINUX cp ./_RELEASE/libsteam_api.so ./_PREPARED_RELEASE_LINUX -- cgit v1.2.3 From 6434037f203e444125dcd648874618093f58ef5d Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 8 Jan 2022 15:37:12 +0100 Subject: art --- art/steamart_new/eventcover.png | Bin 157784 -> 172022 bytes art/steamart_new/eventcover.psd | Bin 856108 -> 1041919 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/art/steamart_new/eventcover.png b/art/steamart_new/eventcover.png index bfe6e3d8..12f83b61 100644 Binary files a/art/steamart_new/eventcover.png and b/art/steamart_new/eventcover.png differ diff --git a/art/steamart_new/eventcover.psd b/art/steamart_new/eventcover.psd index d4b9d470..5e132289 100644 Binary files a/art/steamart_new/eventcover.psd and b/art/steamart_new/eventcover.psd differ -- cgit v1.2.3