diff options
author | Vittorio Romeo <vittorio.romeo@outlook.com> | 2022-01-08 15:37:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-08 15:37:54 +0100 |
commit | 47373e23414f55acb7c95b91c8be845663a976aa (patch) | |
tree | 7a1fe0b4f81d2205c1833ba0b646be882612f675 | |
parent | dfc95c3592e2a1c528d8ac145c620bfb0c568f08 (diff) | |
parent | 6434037f203e444125dcd648874618093f58ef5d (diff) |
Merge pull request #367 from vittorioromeo/2.1.4
Open Hexagon v2.1.4
45 files changed, 774 insertions, 401 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ebe926df..c585f4c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,19 @@ 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() + +# +# +# ----------------------------------------------------------------------------- # Android build # ----------------------------------------------------------------------------- @@ -25,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() @@ -50,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") @@ -81,13 +94,13 @@ set(SFML_STATIC_LIBRARIES false) CPMAddPackage( NAME SFML - GITHUB_REPOSITORY SuperV1234/SFML - GIT_TAG c815ee19e42c313edee37f395f75aae88f4a6762 + GITHUB_REPOSITORY vittorioromeo/SFML + GIT_TAG 596955141c9d6550aeeea196297d07f8b9143645 ) 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) @@ -103,8 +116,8 @@ set(LUAJIT_DISABLE_FFI ON CACHE BOOL "" FORCE) CPMAddPackage( NAME luajit - GIT_REPOSITORY https://github.com/SuperV1234/LuaJIT - GIT_TAG 43cbd9b5f40c472eb9602b66b203057d0f08231b + GIT_REPOSITORY https://github.com/vittorioromeo/LuaJIT + GIT_TAG 6979458f60adb6e95a8b781035c7a11913861178 ) set(LUAJIT_DISABLE_FFI true) @@ -144,7 +157,7 @@ if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui GITHUB_REPOSITORY ocornut/imgui - GIT_TAG 19c3773cc09fffdf950c3e88273f0a15adad1176 + GIT_TAG afffcd5810d030e24056c1a61f27a6eb632f50ed DOWNLOAD_ONLY YES ) @@ -169,8 +182,8 @@ endif() if(NOT SSVOH_ANDROID) CPMAddPackage( NAME imgui-sfml - GITHUB_REPOSITORY eliasdaler/imgui-sfml - GIT_TAG 8bc196c5eaadb342712407eb06fc2f53edfde227 + GITHUB_REPOSITORY vittorioromeo/imgui-sfml + GIT_TAG 4129d276d45845581b6ba99ede50db6f761e5089 ) set_target_properties(ImGui-SFML PROPERTIES UNITY_BUILD ON) @@ -187,8 +200,8 @@ set(SODIUM_DISABLE_TESTS ON CACHE BOOL "" FORCE) CPMAddPackage( NAME libsodium-cmake - GITHUB_REPOSITORY SuperV1234/libsodium-cmake - GIT_TAG c33e05c9bcf7fa1ef0291cf4f35ea1a677a5b7f0 + GITHUB_REPOSITORY vittorioromeo/libsodium-cmake + GIT_TAG 6afc5beec300bd28589e2e3cb22732e8123fe30f OPTIONS "SODIUM_DISABLE_TESTS ON" "SODIUM_DISABLE_TESTS ON CACHE BOOL \"\" FORCE" ) @@ -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/_RELEASE/Assets/assets.json b/_RELEASE/Assets/assets.json index 72785956..dd7fedcf 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", @@ -39,6 +40,7 @@ "personalBest.ogg", "restart.ogg", "select.ogg", - "swap.ogg" + "swap.ogg", + "swapBlip.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() diff --git a/_RELEASE/config.json b/_RELEASE/config.json index 1140f0d1..aaf9ef24 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,29 +35,28 @@ "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,
"no_sound" : false,
"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,
- "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,
- "save_local_best_replay_to_file" : true,
"server_control_port" : 50506,
"server_ip" : "139.162.199.162",
"server_level_whitelist" :
@@ -145,22 +144,22 @@ "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_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_swap_blinking_effect" : true,
+ "show_swap_particles" : true,
"show_timer" : true,
"show_tracked_variables" : true,
- "sound_volume" : 85.0,
+ "sound_volume" : 100.0,
"t_down" :
[
- [ "" ],
+ [ "kS" ],
[ "" ],
[ "" ],
[ "" ]
@@ -188,31 +187,19 @@ ],
"t_lua_console" :
[
- [ "kF1" ],
- [ "" ],
- [ "" ],
- [ "" ]
+ [ "kF1" ]
],
"t_next" :
[
- [ "kPageDown" ],
- [ "" ],
- [ "" ],
- [ "" ]
+ [ "kPageDown" ]
],
"t_pause" :
[
- [ "kF2" ],
- [ "" ],
- [ "" ],
- [ "" ]
+ [ "kF2" ]
],
"t_previous" :
[
- [ "kPageUp" ],
- [ "" ],
- [ "" ],
- [ "" ]
+ [ "kPageUp" ]
],
"t_replay" :
[
@@ -223,9 +210,9 @@ ],
"t_restart" :
[
- [ "bMiddle" ],
[ "kSpace" ],
- [ "kReturn" ],
+ [ "kEnter" ],
+ [ "bMiddle" ],
[ "" ]
],
"t_rotate_ccw" :
@@ -258,25 +245,24 @@ ],
"t_swap" :
[
- [ "bMiddle" ],
[ "kSpace" ],
+ [ "bMiddle" ],
[ "" ],
[ "" ]
],
"t_up" :
[
- [ "" ],
+ [ "kW" ],
[ "" ],
[ "" ],
[ "" ]
],
"text_padding" : 8.0,
"text_scaling" : 1.0,
- "timer_static" : true,
"timescale" : 1.0,
"vsync" : false,
"windowed_auto_resolution" : false,
- "windowed_height" : 715,
- "windowed_width" : 1275,
- "zoom_factor" : 1.074125885963440
+ "windowed_height" : 763,
+ "windowed_width" : 1206,
+ "zoom_factor" : 1.006553053855896
}
diff --git a/art/steamart_new/eventcover.png b/art/steamart_new/eventcover.png Binary files differindex bfe6e3d8..12f83b61 100644 --- a/art/steamart_new/eventcover.png +++ b/art/steamart_new/eventcover.png diff --git a/art/steamart_new/eventcover.psd b/art/steamart_new/eventcover.psd Binary files differindex d4b9d470..5e132289 100644 --- a/art/steamart_new/eventcover.psd +++ b/art/steamart_new/eventcover.psd @@ -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/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/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/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/buildrel/copylibs.sh b/buildrel/copylibs.sh index a9255f3c..830bfbbe 100644 --- a/buildrel/copylibs.sh +++ b/buildrel/copylibs.sh @@ -1,57 +1,71 @@ #!/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-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-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-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-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-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/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-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-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-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 /c/msys64/mingw64/bin/libssp-0.dll ../_RELEASE/ -cp /c/msys64/mingw64/bin/libssp-0.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 /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 & +cp ../_RELEASE/sdkencryptedappticket64.dll ./test & + +wait diff --git a/extlibs/SSVStart b/extlibs/SSVStart -Subproject 50b37dd635f200e4319af3fa60177972506a238 +Subproject 76e92ce7570e4a7a921205f2f83ba842baa168b diff --git a/extlibs/SSVUtils b/extlibs/SSVUtils -Subproject 556ea2182ac332b77c760f894754a5a9414bbe3 +Subproject dafa2499bcd350c3bfdbfb84d522e022c3513a9 diff --git a/include/SSVOpenHexagon/Components/CCustomWall.hpp b/include/SSVOpenHexagon/Components/CCustomWall.hpp index ebc71b92..58a5cd4e 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" @@ -48,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 4e008e06..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 <typename Wall> [[nodiscard]] bool checkWallCollisionEscape( @@ -114,14 +114,16 @@ public: void updatePosition(const float radius); + [[nodiscard]] sf::Color getColor(const sf::Color& colorPlayer) const; + [[nodiscard]] sf::Color getColorAdjustedForSwap( 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 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/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/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<Database::ProcessedScore> 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<Database::ProcessedScore> scores; }; + struct EReceivedOwnScore { std::string levelValidator; Database::ProcessedScore score; }; + struct EGameVersionMismatch { }; + struct EProtocolVersionMismatch { }; // clang-format on using Event = std::variant< // 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/include/SSVOpenHexagon/Core/HexagonGame.hpp b/include/SSVOpenHexagon/Core/HexagonGame.hpp index 265acfb4..f015e859 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> preShakeCenters; @@ -165,7 +165,7 @@ private: sf::Text messageText; sf::Text pbText; - ssvs::VertexVector<sf::PrimitiveType::Quads> flashPolygon{4}; + Utils::FastVertexVectorTris flashPolygon; struct Particle { @@ -180,12 +180,28 @@ private: float angle; }; + struct SwapParticle + { + sf::Sprite sprite; + sf::Vector2f velocity; + }; + sf::Texture* txStarParticle; sf::Texture* txSmallCircle; std::vector<Particle> particles; std::vector<TrailParticle> trailParticles; + std::vector<SwapParticle> swapParticles; bool mustSpawnPBParticles{false}; + + struct SwapParticleSpawnInfo + { + bool ready; + sf::Vector2f position; + float angle; + }; + + std::optional<SwapParticleSpawnInfo> 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 @@ -405,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: @@ -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/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/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/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/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/include/SSVOpenHexagon/Global/PCH.hpp b/include/SSVOpenHexagon/Global/PCH.hpp index 98a8404f..a8d7ba1c 100644 --- a/include/SSVOpenHexagon/Global/PCH.hpp +++ b/include/SSVOpenHexagon/Global/PCH.hpp @@ -4,6 +4,20 @@ #pragma once +#ifdef _WIN32 + +#ifndef NOMINMAX +#define NOMINMAX +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include <windows.h> + +#endif + #include <algorithm> #include <array> #include <atomic> diff --git a/include/SSVOpenHexagon/Global/Version.hpp b/include/SSVOpenHexagon/Global/Version.hpp index 508e7b6f..a3e4539f 100644 --- a/include/SSVOpenHexagon/Global/Version.hpp +++ b/include/SSVOpenHexagon/Global/Version.hpp @@ -43,7 +43,7 @@ struct GameVersion } }; -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 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 <SFML/Graphics/Color.hpp> +#include <SFML/Graphics/Glsl.hpp> #include <cmath> 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<sf::Uint8>(value); } +[[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Glsl::Vec3 toGLSLVec3( + const sf::Color& color) noexcept +{ + return {// + static_cast<float>(color.r) / 255.f, + static_cast<float>(color.g) / 255.f, + static_cast<float>(color.b) / 255.f}; +} + +[[nodiscard, gnu::always_inline, gnu::pure]] inline sf::Glsl::Vec4 toGLSLVec4( + const sf::Color& color) noexcept +{ + return {// + static_cast<float>(color.r) / 255.f, + static_cast<float>(color.g) / 255.f, + static_cast<float>(color.b) / 255.f, + static_cast<float>(color.a) / 255.f}; +} + } // namespace hg::Utils diff --git a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp index f53874ef..33545bee 100644 --- a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp +++ b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp @@ -151,13 +151,66 @@ 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<sf::PrimitiveType::Triangles> -{}; +{ +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<sf::PrimitiveType::Quads> -{}; + [[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); + } +}; } // 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/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 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 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 <https://github.com/SuperV1234/SSVOpenHexagon/wiki/Lua-Reference/_edit> and paste them there, after the `<!-- START GENERATED DOCS HERE -->` marker +5. Go to <https://github.com/SuperV1234/SSVOpenHexagon/wiki/Lua-Reference/_edit> and paste them there, after the `<!-- START GENERATED DOCS HERE -->` marker ## Patch Notes diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp index dc112760..efded9fb 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, + const sf::Color& colorPlayer, Utils::FastVertexVectorTris& 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,12 +100,14 @@ 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); } 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}; @@ -119,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}; @@ -146,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 f7bad7b5..f3dc2ef4 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(); @@ -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) { @@ -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,12 +237,17 @@ void HexagonGame::draw() drawTrailParticles(); } + if(Config::getShowSwapParticles()) + { + drawSwapParticles(); + } + render(wallQuads); render(capTris); render(pivotQuads); render(playerTris); - overlayCamera->apply(*window); + window->setView(overlayCamera->apply()); drawParticles(); drawText(); @@ -293,7 +298,7 @@ void HexagonGame::drawImguiLuaConsole() } SSVOH_ASSERT(overlayCamera.has_value()); - overlayCamera->unapply(*window); + window->setView(window->getRenderWindow().getDefaultView()); Imgui::render(*window); } @@ -301,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<sf::Uint8>(r), static_cast<sf::Uint8>(g), static_cast<sf::Uint8>(b), 0}; - flashPolygon.emplace_back(sf::Vector2f{-100.f, -100.f}, color); + const auto width = static_cast<float>(Config::getWidth()); + const auto height = static_cast<float>(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() @@ -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) @@ -509,7 +522,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 +532,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 +599,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 +608,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 +620,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/HGUpdate.cpp b/src/SSVOpenHexagon/Core/HGUpdate.cpp index 66789404..7438c3cc 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 <imgui.h> @@ -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); } @@ -797,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()}; } @@ -833,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) @@ -849,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; } } @@ -944,9 +970,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 +1004,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<float>(color.a), 3.5f * mFT); + + color.a = static_cast<sf::Uint8>(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/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, diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index 8c73dedd..18a022ed 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() @@ -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()); }; @@ -420,14 +419,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(); } @@ -441,7 +440,8 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, Config::loadAllJoystickBinds(); // ------------------------------------------------------------------------ - // key icons + // Key icons + initKeyIcons(); } @@ -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()) diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index a0917902..ae5b2b37 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<int>(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 @@ -1412,6 +1412,10 @@ void MenuGame::initMenus() playervisfx.create<i::Toggle>("trail has swap color", &Config::getPlayerTrailHasSwapColor, &Config::setPlayerTrailHasSwapColor); + playervisfx.create<i::Toggle>("show swap particles", + &Config::getShowSwapParticles, &Config::setShowSwapParticles); + playervisfx.create<i::Toggle>("swap blinking effect", + &Config::getShowSwapBlinkingEffect, &Config::setShowSwapBlinkingEffect); playervisfx.create<i::GoBack>("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<i::Toggle>("play swap ready blip sound", + &Config::getPlaySwapReadySound, &Config::setPlaySwapReadySound); sfx.create<i::GoBack>("back"); @@ -1777,8 +1783,7 @@ void MenuGame::playLocally() MenuGame::pickRandomMainMenuBackgroundStyle() { // If there is no `menubackgrounds.json` abort - if(!ssvufs::Path{"Assets/menubackgrounds.json"} - .exists<ssvufs::Type::File>()) + if(!ssvufs::Path{"Assets/menubackgrounds.json"}.isFile()) { ssvu::lo("MenuGame::$") << "File 'Assets/menubackgrounds.json' does not exist" << std::endl; @@ -3119,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}); @@ -3275,7 +3280,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 +3316,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); } @@ -3498,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( @@ -3514,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<int, int> MenuGame::getScrollbarNotches( @@ -3556,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); @@ -3703,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<bool> mouseOverlaps; mouseOverlaps.resize(size); @@ -3782,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); @@ -3916,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, @@ -4085,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); @@ -4148,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}; @@ -4950,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) @@ -5053,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, @@ -5086,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); @@ -5107,7 +5111,7 @@ void MenuGame::drawLevelSelectionRightSide( { // Quads menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); float temp = quadsIndent - outerFrame + panelOffset; @@ -5161,7 +5165,7 @@ void MenuGame::drawLevelSelectionRightSide( txtSelectionMedium.font.setFillColor(oldC); menuQuads.clear(); - menuQuads.reserve(8); + menuQuads.reserve_quad(2); if(i == drawer.packIdx) { @@ -5181,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}; @@ -5193,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); @@ -5212,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}; @@ -5225,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; @@ -5269,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); @@ -5310,7 +5314,7 @@ void MenuGame::drawLevelSelectionLeftSide( //------------------------------------- // Difficulty - menuQuads.reserve_more(8); + menuQuads.reserve_more_quad(2); // Top line height += lineThickness; @@ -5336,13 +5340,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; @@ -5387,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; @@ -5437,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 @@ -5514,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" @@ -5526,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; @@ -5649,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; @@ -5706,7 +5710,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 +5727,7 @@ void MenuGame::draw() render(menuBackgroundTris); } - overlayCamera.apply(window); + window.setView(overlayCamera.apply()); // Draw the profile name. if(mainOrAbove && state != States::LevelSelection) @@ -5904,7 +5908,7 @@ void MenuGame::draw() if(!dialogBox.empty()) { - overlayCamera.apply(window); + window.setView(overlayCamera.apply()); dialogBox.draw(dialogBoxTextColor, styleData.getColor(0)); } @@ -5936,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(); @@ -6021,7 +6025,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 +6033,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..c0c27008 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<ssvufs::Type::Folder>()) + if(path.isFolder()) { return; } @@ -344,7 +344,10 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& 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/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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::File>()) + if(!ssvufs::Path{packPath + "/pack.json"}.isFile()) { return false; } @@ -298,25 +298,23 @@ HGAssets::~HGAssets() try { - if(ssvufs::Path{packPath + "Music/"}.exists<ssvufs::Type::Folder>() && - !levelsOnly) + if(ssvufs::Path{packPath + "Music/"}.isFolder() && !levelsOnly) { loadPackAssets_loadMusic(packId, packPath); loadPackAssets_loadMusicData(packId, packPath); } - if(ssvufs::Path{packPath + "Styles/"}.exists<ssvufs::Type::Folder>()) + if(ssvufs::Path{packPath + "Styles/"}.isFolder()) { loadPackAssets_loadStyleData(packId, packPath); } - if(ssvufs::Path{packPath + "Levels/"}.exists<ssvufs::Type::Folder>()) + if(ssvufs::Path{packPath + "Levels/"}.isFolder()) { loadPackAssets_loadLevelData(packId, packPath); } - if(!levelsOnly && - ssvufs::Path(packPath + "Sounds/").exists<ssvufs::Type::Folder>()) + 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<ssvufs::Type::File>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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<ssvufs::Type::Folder>()) + 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..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; @@ -147,30 +167,30 @@ using cil = std::initializer_list<cmb>; 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", \ - cil{cmb{{k::Space}}, cmb{{k::Return}}, 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}}}) \ +#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(triggerPause, trig, "t_pause", cil{cmb{{k::F2}}}) #define X_LINKEDVALUES_BINDS \ @@ -246,6 +266,9 @@ using cil = std::initializer_list<cmb>; 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 { @@ -254,7 +277,7 @@ namespace hg::Config { { static ssvuj::Obj res = [] { - if(ssvufs::Path{"config.json"}.exists<ssvufs::Type::File>()) + if(ssvufs::Path{"config.json"}.isFile()) { ssvu::lo("hg::Config::root()") << "User-defined `config.json` file found\n"; @@ -367,7 +390,7 @@ void loadConfig(const std::vector<std::string>& mOverridesIds) { ssvu::lo("::loadConfig") << "loading config\n"; - if(ssvufs::Path{"ConfigOverrides/"}.exists<ssvufs::Type::Folder>()) + if(ssvufs::Path{"ConfigOverrides/"}.isFolder()) { for(const ssvufs::Path& p : ssvufs::getScan<ssvufs::Mode::Single, ssvufs::Type::File, @@ -797,6 +820,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 +1195,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 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 } |