diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc18894..185408d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,14 +97,14 @@ set(SFML_ENABLE_PCH true) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 7b50ac7b7a38b9fd005393887b07d53ed6f04036 + GIT_TAG eed43ab7b8339c0c64ec55c509d825b9a8442346 ) -set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) -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) +# set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON) +# 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) # # diff --git a/_RELEASE/luadocs.md b/_RELEASE/luadocs.md index 706a2f42..0078fa05 100644 --- a/_RELEASE/luadocs.md +++ b/_RELEASE/luadocs.md @@ -1,239 +1,3 @@ -[Steam] Initializing Steam API -[Steam] Steam API successfully initialized -[Steam] Workshop subscribed item id: 2181996935 -[Steam] Workshop subscribed item id: 2182389461 -[Steam] Workshop subscribed item id: 2157745755 -[Steam] Workshop subscribed item id: 2173700108 -[Steam] Workshop subscribed item id: 2174131954 -[Steam] Workshop subscribed item id: 2183820502 -[Steam] Workshop subscribed item id: 2328692179 -[Steam] Workshop subscribed item id: 2415854217 -[Steam] Workshop subscribed item id: 2179916080 -[Steam] Workshop subscribed item id: 2323122608 -[Steam] Workshop subscribed item id: 2360749526 -[Steam] Successfully requested stats and achievements -[Discord] Successfully initialized core -[Discord] Successfully registered command -[Discord] Successfully registered Steam app -[::loadConfig] loading config -[hg::Config::root()] User-defined `config.json` file found -[ssvs::AssetManager::load] forcedsquare.ttf resource loading -[ssvs::AssetManager::load] bottomBar.png resource loading -[ssvs::AssetManager::load] creditsBar1.png resource loading -[ssvs::AssetManager::load] creditsBar2.png resource loading -[ssvs::AssetManager::load] creditsBar2b.png resource loading -[ssvs::AssetManager::load] creditsBar2c.png resource loading -[ssvs::AssetManager::load] creditsBar2d.png resource loading -[ssvs::AssetManager::load] titleBar.png resource loading -[ssvs::AssetManager::load] epilepsyWarning.png resource loading -[ssvs::AssetManager::load] keyArrow.png resource loading -[ssvs::AssetManager::load] keyFocus.png resource loading -[ssvs::AssetManager::load] keySwap.png resource loading -[ssvs::AssetManager::load] replayIcon.png resource loading -[ssvs::AssetManager::load] starParticle.png resource loading -[ssvs::AssetManager::load] beep.ogg resource loading -[ssvs::AssetManager::load] death.ogg resource loading -[ssvs::AssetManager::load] difficultyMultDown.ogg resource loading -[ssvs::AssetManager::load] difficultyMultUp.ogg resource loading -[ssvs::AssetManager::load] error.ogg resource loading -[ssvs::AssetManager::load] gameOver.ogg resource loading -[ssvs::AssetManager::load] go.ogg resource loading -[ssvs::AssetManager::load] increment.ogg resource loading -[ssvs::AssetManager::load] levelUp.ogg resource loading -[ssvs::AssetManager::load] openHexagon.ogg resource loading -[ssvs::AssetManager::load] personalBest.ogg resource loading -[ssvs::AssetManager::load] restart.ogg resource loading -[ssvs::AssetManager::load] select.ogg resource loading -[ssvs::AssetManager::load] swap.ogg resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_tutorial_1 music -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_tutorial_1_drFinkelfracken resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_tutorial_1 music data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_tutorial_1 style data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_tutorial_1 level data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_tutorial_1 custom sounds -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_tutorial_1_failure.ogg resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_tutorial_1_fanfare.ogg resource loading -[::loadAssets] loading ohvrworkshopexample_vittorio_romeo_example_1 music -[ssvs::AssetManager::load] ohvrworkshopexample_vittorio_romeo_example_1_jackRussel resource loading -[::loadAssets] loading ohvrworkshopexample_vittorio_romeo_example_1 music data -[::loadAssets] loading ohvrworkshopexample_vittorio_romeo_example_1 style data -[::loadAssets] loading ohvrworkshopexample_vittorio_romeo_example_1 level data -[::loadAssets] loading _unknown_author_omegasphere_0 music -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_5amest resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_Stage5_1 resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_Stage5_3 resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_airbrushed resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_akira resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_aurora(MeetMeInTheStars) resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_blackoutCity resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_bosozokuGF resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_butterfly resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_canalParadise resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_dangerMountain resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_dawnMetropolis resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_everythingExplodes resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_farbrorMelkerFixarFiskdamm resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_gmoomh resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_hajikedama resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_helixNebula resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_inTheBasement resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_jetpackBluesSunsetHues resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_johnHughes resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_massacrev2 resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_megalovania resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_meltedthree resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_mess resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_metropolis resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_minimal resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_musicPlantClassic resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_mySkateboardWillGoOn resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_overarrow resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_pastelFlags resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_penpal resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_planet resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_playingWithPower resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_polarBear resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_savetheworld resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_silence resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_soBored resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_starfish resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_sunshower resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_swan resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_takingANapInTheJungle resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_theStorm resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_videoChallenge resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_virusBusting resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_we'reTheRobots resource loading -[::loadAssets] loading _unknown_author_omegasphere_0 music data -[::loadAssets] loading _unknown_author_omegasphere_0 style data -[::loadAssets] loading _unknown_author_omegasphere_0 level data -[::loadAssets] loading _unknown_author_omegasphere_0 custom sounds -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_b1.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_b2.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_b3.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_beat.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_bom.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_cffail.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_cfwin.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_end.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_fall.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_flashrefill.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_flcharging.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_fldead.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_hit.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_hue.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_invuln1.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_invuln2.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_invuln3.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_mecha1.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_mecha2.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_mecha3.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_metal28.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_metal38.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_metal48.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_nonmaxvel.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_nonmaxvelrev.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note1.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note2.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note3.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note4.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note5.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note6.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note7.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_note8.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_star1.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_star2.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_star3.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_star4.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_star5.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_switch.ogg resource loading -[ssvs::AssetManager::load] _unknown_author_omegasphere_0_warning.ogg resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_orthoplex_1 music -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_orthoplex_1_arcadia resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_orthoplex_1_ultima2 resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_orthoplex_1 music data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_orthoplex_1 style data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_orthoplex_1 level data -[::loadAssets] loading QuartzKawaiiKayden_KawaiiKayden_Quartz_1 music -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_HAPPYMAKER-PLight resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_TRIGGERHAPPY_HommarjuRMX_Plight resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_anthemMakeAcid resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_beachEpisodeAika resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_bookOfLawSrezcat resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_bubbleSoapCurryrice resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_bubbleWrapWaveRacer resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_bubblegumBlissFunken resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_candyWaveJh-Anu resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_crystalRoadOcular resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_crystalTokyoFantomenKandMeganeko resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_genjiThemeScraton resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_glitchyDolphinJayElder resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_lemonLimeSodaKindOfDayCeejDaDeej resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_marionetteM2U resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_moonsShibuya resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_nightscapeM2U resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_oneiricSuken resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_perfumeEuphonia resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_placesNasko resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_rabbitOnesieShindig resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_rainbowDoctorNoSense resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_readyStessie resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_springCarouselBiosphere resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_starsideMVDNXGHT resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_sugarCircuitSystile resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_sugarPunkAika resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_sweetPLEEG resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_theBestDayEverTEOMAWIKI resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_worldRecordWaveRacer resource loading -[::loadAssets] loading QuartzKawaiiKayden_KawaiiKayden_Quartz_1 music data -[::loadAssets] loading QuartzKawaiiKayden_KawaiiKayden_Quartz_1 style data -[::loadAssets] loading QuartzKawaiiKayden_KawaiiKayden_Quartz_1 level data -[::loadAssets] loading QuartzKawaiiKayden_KawaiiKayden_Quartz_1 custom sounds -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_Sounds.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_cffail.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_quartzIncrementEnergetic.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_quartzIncrementHyperburst.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_quartzIncrementTransform.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_quartzIncrementTransformation.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_quartzPlayerMove.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_quartzSwap.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_slotsTimerAdd1.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_slotsTimerAdd2.ogg resource loading -[ssvs::AssetManager::load] QuartzKawaiiKayden_KawaiiKayden_Quartz_1_slotsTimerLose.ogg resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_cube_1 music -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_callMeKatla resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_captainCool resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_commandoSteve resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_jackRussel resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_mazeOfMayonnaise resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_milkyWays resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_starshipShowdown resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_cube_1_steampunkWarlord resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_cube_1 music data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_cube_1 style data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_cube_1 level data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_cube_1 custom sounds -[::loadAssets] loading ohvrvanilla_vittorio_romeo_experimental_1 music -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_experimental_1_jackRussel resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_experimental_1 music data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_experimental_1 style data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_experimental_1 level data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_hypercube_1 music -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_cpumood resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_dischipo resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_flirtFlirt resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_gmoomh resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_johnnyDerp resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_massacrev2 resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_minimal resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_mrGawne resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_pep resource loading -[ssvs::AssetManager::load] ohvrvanilla_vittorio_romeo_hypercube_1_tengil resource loading -[::loadAssets] loading ohvrvanilla_vittorio_romeo_hypercube_1 music data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_hypercube_1 style data -[::loadAssets] loading ohvrvanilla_vittorio_romeo_hypercube_1 level data -[::loadAssets] loading local profiles - ## Utility Functions (u_) Below are the utility functions, which can be identified with the "u_" prefix. These are overall functions that either help utilize the game engine, be incredibly beneficial to pack developers, or help simplify complex calculations. @@ -725,7 +489,7 @@ Below are the basic wall functions, which can be identified with the "w_" prefix ## Custom Wall Functions (cw_) -Below are the custom wall functions, which can be identified with the "cw_" prefix. These are 2.0 exclusive functions with foundations of [Object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) to allow pack developers to customize individual walls and their properties and make the most out of them. +Below are the custom wall functions, which can be identified with the "cw_" prefix. These are 2.0 exclusive functions with foundations of [Object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) to allow pack developers to customize individual walls and their properties and make the most out of them. * **`int cw_create()`**: Create a new custom wall and return a integer handle to it. @@ -781,7 +545,3 @@ Below are the miscellaneous functions, which can have a variable prefix or no pr * **`void m_messageAddImportantSilent(string message, double duration)`**: *Add to the event timeline*: print a message with text `message` for `duration` seconds. The message will only be printed during every run of the level, and will not produce any sound. **This function is deprecated and will be removed in a future version. Please use e_messageAddImportantSilent instead!** * **`void m_clearMessages()`**: Remove all previously scheduled messages. **This function is deprecated and will be removed in a future version. Please use e_clearMessages instead!** - -[::saveConfig] saving config -[Steam] Shutting down Steam API -[Steam] Shut down Steam API diff --git a/build/make_debug_client_win10_msys_0_cmake.sh b/build/make_debug_client_win10_msys_0_cmake.sh index 16a055d1..ae966d73 100644 --- a/build/make_debug_client_win10_msys_0_cmake.sh +++ b/build/make_debug_client_win10_msys_0_cmake.sh @@ -19,9 +19,10 @@ cmake .. -G"Ninja" \ -fuse-ld=lld \ -Og -g3 -fno-omit-frame-pointer \ -Wall -Wextra -Wpedantic -Wno-braced-scalar-init \ - -Wno-pragmas -Wno-missing-field-initializers \ + -Wno-pragmas -Wno-missing-field-initializers -Wno-array-bounds -Wno-restrict \ -Wno-stringop-overflow \ -D_GLIBCXX_ASSERTIONS=1 -D_FORTIFY_SOURCE=3 \ -fstack-protector -Wno-pragmas \ -frounding-math -fsignaling-nans -ffloat-store -ffp-contract=off \ - -DSFML_ENABLE_LIFETIME_TRACKING=1" + -DSFML_ENABLE_LIFETIME_TRACKING=1" \ + -DCMAKE_C_FLAGS="-Wno-attributes" diff --git a/build/make_debug_client_win10_msys_clang_0_cmake.sh b/build/make_debug_client_win10_msys_clang_0_cmake.sh index d16cf253..aae241f6 100644 --- a/build/make_debug_client_win10_msys_clang_0_cmake.sh +++ b/build/make_debug_client_win10_msys_clang_0_cmake.sh @@ -17,12 +17,15 @@ cmake .. -G"Ninja" \ -DCMAKE_CXX_COMPILER="clang++" \ -DCMAKE_CXX_FLAGS="\ -fuse-ld=lld \ + -ftime-trace \ -Og -g3 -fno-omit-frame-pointer \ -Wall -Wextra -Wpedantic -Wno-braced-scalar-init \ - -Wno-pragmas -Wno-missing-field-initializers -Wno-array-bounds -Wno-restrict \ - -Wno-stringop-overflow \ + -Wno-pragmas -Wno-missing-field-initializers -Wno-array-bounds \ -D_GLIBCXX_ASSERTIONS=1 -D_FORTIFY_SOURCE=3 \ -fstack-protector -Wno-pragmas \ - -frounding-math -fsignaling-nans -ffloat-store -ffp-contract=off \ + -frounding-math -ffp-contract=off \ + -Wno-unknown-warning-option \ + -Wno-deprecated-non-prototype -Wno-unknown-attributes -Wno-maybe-uninitialized \ + -Wno-unused-command-line-argument \ -DSFML_ENABLE_LIFETIME_TRACKING=1" \ - -DCMAKE_C_FLAGS="-Wno-attributes" + -DCMAKE_C_FLAGS="-Wno-deprecated-non-prototype -Wno-unknown-attributes" diff --git a/buildrel/make_release_client_win10_msys_0_cmake.sh b/buildrel/make_release_client_win10_msys_0_cmake.sh index 4dc4cbe0..3d106b4c 100644 --- a/buildrel/make_release_client_win10_msys_0_cmake.sh +++ b/buildrel/make_release_client_win10_msys_0_cmake.sh @@ -23,4 +23,5 @@ cmake .. -G"Ninja" \ -Wno-stringop-overflow \ -O3 -DNDEBUG -g3 \ -frounding-math -fsignaling-nans -ffloat-store -ffp-contract=off \ - -ffold-simple-inlines -fimplicit-constexpr" + -ffold-simple-inlines -fimplicit-constexpr" \ + -DCMAKE_C_FLAGS="-Wno-attributes" diff --git a/include/SSVOpenHexagon/Components/CCustomWall.hpp b/include/SSVOpenHexagon/Components/CCustomWall.hpp index b77858d4..76c0b299 100644 --- a/include/SSVOpenHexagon/Components/CCustomWall.hpp +++ b/include/SSVOpenHexagon/Components/CCustomWall.hpp @@ -4,13 +4,9 @@ #pragma once -#include "SSVOpenHexagon/Components/CCustomWallHandle.hpp" - #include "SSVOpenHexagon/Utils/PointInPolygon.hpp" #include "SSVOpenHexagon/Utils/FastVertexVector.hpp" -#include - #include #include diff --git a/include/SSVOpenHexagon/Components/CCustomWallManager.hpp b/include/SSVOpenHexagon/Components/CCustomWallManager.hpp index 310bf189..c09e538e 100644 --- a/include/SSVOpenHexagon/Components/CCustomWallManager.hpp +++ b/include/SSVOpenHexagon/Components/CCustomWallManager.hpp @@ -93,7 +93,7 @@ class CCustomWallManager void draw(Utils::FastVertexVectorTris& wallQuads); [[nodiscard]] bool handleCollision( - const int movement, const float radius, CPlayer& mPlayer, ssvu::FT mFT); + const int movement, const float radius, CPlayer& mPlayer, float mFT); [[nodiscard]] std::size_t count() const noexcept { diff --git a/include/SSVOpenHexagon/Components/CPlayer.hpp b/include/SSVOpenHexagon/Components/CPlayer.hpp index 61c14c9e..ae87338b 100644 --- a/include/SSVOpenHexagon/Components/CPlayer.hpp +++ b/include/SSVOpenHexagon/Components/CPlayer.hpp @@ -7,9 +7,6 @@ #include "SSVOpenHexagon/Utils/Ticker.hpp" #include "SSVOpenHexagon/Utils/FastVertexVector.hpp" -#include -#include - #include #include @@ -76,7 +73,7 @@ class CPlayer [[nodiscard]] bool checkWallCollisionEscape( const Wall& wall, sf::Vector2f& pos, const float radiusSquared); - void updateTriangleWidthTransition(const bool focused, const ssvu::FT ft); + void updateTriangleWidthTransition(const bool focused, const float ft); public: explicit CPlayer(const sf::Vector2f& pos, const float swapCooldown, @@ -103,10 +100,10 @@ class CPlayer void kill(const bool fatal); - void update(const bool focused, const bool swapEnabled, const ssvu::FT ft); + void update(const bool focused, const bool swapEnabled, const float ft); void updateInputMovement(const float movementDir, - const float playerSpeedMult, const bool focused, const ssvu::FT ft); + const float playerSpeedMult, const bool focused, const float ft); void resetSwap(const float swapCooldown); @@ -127,10 +124,10 @@ class CPlayer [[nodiscard]] bool push(const int movementDir, const float radius, const CWall& wall, const sf::Vector2f& mCenterPos, - const float radiusSquared, ssvu::FT ft); + const float radiusSquared, float ft); [[nodiscard]] bool push(const int movementDir, const float radius, - const hg::CCustomWall& wall, const float radiusSquared, ssvu::FT ft); + const hg::CCustomWall& wall, const float radiusSquared, float ft); [[nodiscard]] bool getJustSwapped() const noexcept; diff --git a/include/SSVOpenHexagon/Components/CWall.hpp b/include/SSVOpenHexagon/Components/CWall.hpp index 21ad8c27..6c12a197 100644 --- a/include/SSVOpenHexagon/Components/CWall.hpp +++ b/include/SSVOpenHexagon/Components/CWall.hpp @@ -27,9 +27,9 @@ class CWall bool _killed; void moveTowardsCenter(const float wallSpawnDist, const float radius, - const sf::Vector2f& centerPos, const ssvu::FT ft); + const sf::Vector2f& centerPos, const float ft); - void moveCurve(const sf::Vector2f& centerPos, const ssvu::FT ft); + void moveCurve(const sf::Vector2f& centerPos, const float ft); public: explicit CWall(const unsigned int sides, const float wallAngleLeft, @@ -39,7 +39,7 @@ class CWall const SpeedData& speed, const SpeedData& curve, const float hueMod); void update(const float wallSpawnDist, const float radius, - const sf::Vector2f& centerPos, const ssvu::FT ft); + const sf::Vector2f& centerPos, const float ft); [[gnu::always_inline]] void moveVertexAlongCurveImpl(sf::Vector2f& vertex, const sf::Vector2f& centerPos, const float xSin, @@ -52,14 +52,14 @@ class CWall } [[gnu::always_inline]] float getCurveRadians( - const ssvu::FT ft) const noexcept + const float ft) const noexcept { constexpr float divBy60 = 1.f / 60.f; return _curve._speed * divBy60 * ft; } [[gnu::always_inline]] void moveVertexAlongCurve(sf::Vector2f& vertex, - const sf::Vector2f& centerPos, const ssvu::FT ft) const noexcept + const sf::Vector2f& centerPos, const float ft) const noexcept { const float rad = getCurveRadians(ft); diff --git a/include/SSVOpenHexagon/Components/SpeedData.hpp b/include/SSVOpenHexagon/Components/SpeedData.hpp index d021e3e6..39a7d66c 100644 --- a/include/SSVOpenHexagon/Components/SpeedData.hpp +++ b/include/SSVOpenHexagon/Components/SpeedData.hpp @@ -4,8 +4,6 @@ #pragma once -#include - namespace hg { struct SpeedData @@ -25,7 +23,7 @@ struct SpeedData _pingPong{pingPong ? -1.f : 1.f} {} - void update(const ssvu::FT ft) noexcept + void update(const float ft) noexcept { if (_accel == 0.f) { diff --git a/include/SSVOpenHexagon/Core/CustomTimelineManager.hpp b/include/SSVOpenHexagon/Core/CustomTimelineManager.hpp index 99eb4a60..c60285df 100644 --- a/include/SSVOpenHexagon/Core/CustomTimelineManager.hpp +++ b/include/SSVOpenHexagon/Core/CustomTimelineManager.hpp @@ -8,7 +8,6 @@ #include "SSVOpenHexagon/Utils/Clock.hpp" -#include #include namespace hg { diff --git a/include/SSVOpenHexagon/Core/HGStatus.hpp b/include/SSVOpenHexagon/Core/HGStatus.hpp index 4bd1d803..8e4275a8 100644 --- a/include/SSVOpenHexagon/Core/HGStatus.hpp +++ b/include/SSVOpenHexagon/Core/HGStatus.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/include/SSVOpenHexagon/Core/HexagonClient.hpp b/include/SSVOpenHexagon/Core/HexagonClient.hpp index 3a690577..fb71cd12 100644 --- a/include/SSVOpenHexagon/Core/HexagonClient.hpp +++ b/include/SSVOpenHexagon/Core/HexagonClient.hpp @@ -13,9 +13,7 @@ #include #include -#include #include -#include #include #include #include diff --git a/include/SSVOpenHexagon/Core/HexagonGame.hpp b/include/SSVOpenHexagon/Core/HexagonGame.hpp index a1cc0efb..9af7f7c0 100644 --- a/include/SSVOpenHexagon/Core/HexagonGame.hpp +++ b/include/SSVOpenHexagon/Core/HexagonGame.hpp @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -356,32 +355,32 @@ class HexagonGame void advanceByTicks(const int nTicks); // Update methods - void update(ssvu::FT mFT, const float timescale); + void update(float mFT, const float timescale); void updateInput(); void updateInput_UpdateJoystickControls(); void updateInput_UpdateTouchControls(); void updateInput_ResolveInputImplToInputMovement(); void updateInput_RecordCurrentInputToLastReplayData(); - void updateWalls(ssvu::FT mFT); + void updateWalls(float mFT); void updateIncrement(); - void updateEvents(ssvu::FT mFT); - void updateLevel(ssvu::FT mFT); + void updateEvents(float mFT); + void updateLevel(float mFT); void updateCustomTimelines(); - void updateCustomWalls(ssvu::FT mFT); - void updatePulse(ssvu::FT mFT); + void updateCustomWalls(float mFT); + void updatePulse(float mFT); void refreshPulse(); - void updateBeatPulse(ssvu::FT mFT); + void updateBeatPulse(float mFT); void refreshBeatPulse(); - void updateRotation(ssvu::FT mFT); - void updateCameraShake(ssvu::FT mFT); - void updateFlash(ssvu::FT mFT); - void updatePulse3D(ssvu::FT mFT); - void updateText(ssvu::FT mFT); + void updateRotation(float mFT); + void updateCameraShake(float mFT); + void updateFlash(float mFT); + void updatePulse3D(float mFT); + void updateText(float mFT); void updateKeyIcons(); void updateLevelInfo(); - void updateParticles(ssvu::FT mFT); - void updateTrailParticles(ssvu::FT mFT); - void updateSwapParticles(ssvu::FT mFT); + void updateParticles(float mFT); + void updateTrailParticles(float mFT); + void updateSwapParticles(float mFT); // Post update methods void postUpdate(); diff --git a/include/SSVOpenHexagon/Core/HexagonServer.hpp b/include/SSVOpenHexagon/Core/HexagonServer.hpp index ef06bcd6..52577996 100644 --- a/include/SSVOpenHexagon/Core/HexagonServer.hpp +++ b/include/SSVOpenHexagon/Core/HexagonServer.hpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/include/SSVOpenHexagon/Core/LeaderboardCache.hpp b/include/SSVOpenHexagon/Core/LeaderboardCache.hpp index 9d2a66f9..4c6cec41 100644 --- a/include/SSVOpenHexagon/Core/LeaderboardCache.hpp +++ b/include/SSVOpenHexagon/Core/LeaderboardCache.hpp @@ -9,9 +9,7 @@ #include "SSVOpenHexagon/Utils/Clock.hpp" #include -#include #include -#include #include #include diff --git a/include/SSVOpenHexagon/Core/MenuGame.hpp b/include/SSVOpenHexagon/Core/MenuGame.hpp index 0d1f6b06..345349e2 100644 --- a/include/SSVOpenHexagon/Core/MenuGame.hpp +++ b/include/SSVOpenHexagon/Core/MenuGame.hpp @@ -19,8 +19,6 @@ #include -#include - #include #include #include @@ -31,7 +29,6 @@ #include #include -#include #include #include #include @@ -208,7 +205,7 @@ class MenuGame LevelStatus levelStatus; int ignoreInputs; - void update(ssvu::FT mFT); + void update(float mFT); void setIndex(int mIdx); void refreshCamera(); void reloadAssets(const bool reloadEntirePack); @@ -455,7 +452,7 @@ class MenuGame void calcPackChangeScrollFold(const float mLevelListHeight); void calcPackChangeScrollStretch(const float mLevelListHeight); void quickPackFoldStretch(); - void scrollLevelListToTargetY(ssvu::FT mFT); + void scrollLevelListToTargetY(float mFT); void checkWindowTopScroll( const float scroll, std::function action); diff --git a/include/SSVOpenHexagon/Data/LevelData.hpp b/include/SSVOpenHexagon/Data/LevelData.hpp index 4fcfe86d..22be21d2 100644 --- a/include/SSVOpenHexagon/Data/LevelData.hpp +++ b/include/SSVOpenHexagon/Data/LevelData.hpp @@ -4,7 +4,6 @@ #pragma once -#include #include #include #include diff --git a/include/SSVOpenHexagon/Data/StyleData.hpp b/include/SSVOpenHexagon/Data/StyleData.hpp index 646d9aa6..c49e2e06 100644 --- a/include/SSVOpenHexagon/Data/StyleData.hpp +++ b/include/SSVOpenHexagon/Data/StyleData.hpp @@ -7,8 +7,6 @@ #include "SSVOpenHexagon/Data/ColorData.hpp" #include "SSVOpenHexagon/Data/CapColor.hpp" -#include - #include #include @@ -106,7 +104,7 @@ class StyleData explicit StyleData(); explicit StyleData(const ssvuj::Obj& mRoot); - void update(ssvu::FT mFT, float mMult = 1.f); + void update(float mFT, float mMult = 1.f); void computeColors(); diff --git a/include/SSVOpenHexagon/Global/Assets.hpp b/include/SSVOpenHexagon/Global/Assets.hpp index 207f7222..284de79d 100644 --- a/include/SSVOpenHexagon/Global/Assets.hpp +++ b/include/SSVOpenHexagon/Global/Assets.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace sf { @@ -23,8 +24,6 @@ namespace ssvu::FileSystem { class Path; } -namespace ssvufs = ssvu::FileSystem; - namespace hg { namespace Steam { diff --git a/include/SSVOpenHexagon/Global/Config.hpp b/include/SSVOpenHexagon/Global/Config.hpp index 2690ccfa..7d772545 100644 --- a/include/SSVOpenHexagon/Global/Config.hpp +++ b/include/SSVOpenHexagon/Global/Config.hpp @@ -8,6 +8,9 @@ #include "SSVOpenHexagon/Core/Joystick.hpp" #include "SSVOpenHexagon/Utils/Casts.hpp" +#include +#include + #include #include #include diff --git a/include/SSVOpenHexagon/Global/Imgui.hpp b/include/SSVOpenHexagon/Global/Imgui.hpp index 1b7da8f6..8be4c7eb 100644 --- a/include/SSVOpenHexagon/Global/Imgui.hpp +++ b/include/SSVOpenHexagon/Global/Imgui.hpp @@ -8,6 +8,7 @@ namespace sf { class Event; class RenderTarget; class RenderWindow; +class Window; } // namespace sf namespace hg::Imgui { diff --git a/include/SSVOpenHexagon/Global/PCH.hpp b/include/SSVOpenHexagon/Global/PCH.hpp index fbd52a4c..464a4f95 100644 --- a/include/SSVOpenHexagon/Global/PCH.hpp +++ b/include/SSVOpenHexagon/Global/PCH.hpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -153,7 +152,6 @@ #include #include -#include #include #include #include @@ -174,7 +172,6 @@ #include #include #include -#include // // @@ -187,7 +184,7 @@ // // // ---------------------------------------------------------------------------- -// SSVOpenHExagon +// SSVOpenHexagon // ---------------------------------------------------------------------------- #include "SSVOpenHexagon/Global/Assert.hpp" diff --git a/include/SSVOpenHexagon/Online/Shared.hpp b/include/SSVOpenHexagon/Online/Shared.hpp index bc6024bf..604b6488 100644 --- a/include/SSVOpenHexagon/Online/Shared.hpp +++ b/include/SSVOpenHexagon/Online/Shared.hpp @@ -19,12 +19,10 @@ #include #include #include -#include #include #include #include -#include #include namespace sf { diff --git a/include/SSVOpenHexagon/Online/Sodium.hpp b/include/SSVOpenHexagon/Online/Sodium.hpp index fefe2d4e..3d9819b8 100644 --- a/include/SSVOpenHexagon/Online/Sodium.hpp +++ b/include/SSVOpenHexagon/Online/Sodium.hpp @@ -8,9 +8,11 @@ #include #include -#include #include +#include +#include + namespace hg { inline constexpr std::size_t sodiumPublicKeyBytes = crypto_kx_PUBLICKEYBYTES; diff --git a/include/SSVOpenHexagon/Utils/Color.hpp b/include/SSVOpenHexagon/Utils/Color.hpp index 44b4e3fd..c0407178 100644 --- a/include/SSVOpenHexagon/Utils/Color.hpp +++ b/include/SSVOpenHexagon/Utils/Color.hpp @@ -4,8 +4,6 @@ #pragma once -#include "SSVOpenHexagon/Global/Assert.hpp" - #include #include diff --git a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp index 7bd9b2bb..b93807a8 100644 --- a/include/SSVOpenHexagon/Utils/FastVertexVector.hpp +++ b/include/SSVOpenHexagon/Utils/FastVertexVector.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/include/SSVOpenHexagon/Utils/FixedFunction.hpp b/include/SSVOpenHexagon/Utils/FixedFunction.hpp index e8c664ef..bebdb544 100644 --- a/include/SSVOpenHexagon/Utils/FixedFunction.hpp +++ b/include/SSVOpenHexagon/Utils/FixedFunction.hpp @@ -7,28 +7,34 @@ #include "SSVOpenHexagon/Global/Assert.hpp" #include "SSVOpenHexagon/Global/Macros.hpp" -#include -#include -#include - namespace hg::Utils { -template +using SizeT = decltype(sizeof(int)); + +struct MaxAlignT +{ + alignas(alignof(long long)) long long a; + alignas(alignof(long double)) long double b; +}; + +using Byte = unsigned char; + +template class FixedFunction; -template +template class FixedFunction { private: using ret_type = TReturn; using fn_ptr_type = ret_type (*)(Ts...); - using method_type = ret_type (*)(std::byte*, fn_ptr_type, Ts...); - using alloc_type = void (*)(std::byte*, void* object_ptr); + using method_type = ret_type (*)(Byte*, fn_ptr_type, Ts...); + using alloc_type = void (*)(Byte*, void* object_ptr); union { - alignas(std::max_align_t) std::byte _storage[TStorageSize]; + alignas(MaxAlignT) Byte _storage[TStorageSize]; fn_ptr_type _function_ptr; }; @@ -76,19 +82,18 @@ class FixedFunction template FixedFunction(TFFwd&& f) noexcept : FixedFunction() { - using unref_type = std::remove_reference_t; + using unref_type = typename hg::Impl::RemoveRef::type; static_assert(sizeof(unref_type) < TStorageSize); - static_assert(std::is_move_constructible_v); - _method_ptr = [](std::byte* s, fn_ptr_type, Ts... xs) + _method_ptr = [](Byte* s, fn_ptr_type, Ts... xs) { return reinterpret_cast(s)->operator()(xs...); }; - _alloc_ptr = [](std::byte* s, void* o) + _alloc_ptr = [](Byte* s, void* o) { if (o) { - new (s) unref_type(std::move(*static_cast(o))); + new (s) unref_type(SSVOH_MOVE(*static_cast(o))); } else { @@ -103,7 +108,7 @@ class FixedFunction FixedFunction(TFReturn (*f)(TFs...)) noexcept : FixedFunction() { _function_ptr = f; - _method_ptr = [](std::byte*, fn_ptr_type xf, Ts... xs) + _method_ptr = [](Byte*, fn_ptr_type xf, Ts... xs) { return static_cast(xf)(xs...); }; } diff --git a/include/SSVOpenHexagon/Utils/FontHeight.hpp b/include/SSVOpenHexagon/Utils/FontHeight.hpp index d59e579e..c1f47b2e 100644 --- a/include/SSVOpenHexagon/Utils/FontHeight.hpp +++ b/include/SSVOpenHexagon/Utils/FontHeight.hpp @@ -5,9 +5,7 @@ #pragma once namespace sf { - class Text; - } namespace hg::Utils { diff --git a/include/SSVOpenHexagon/Utils/LoadFromJson.hpp b/include/SSVOpenHexagon/Utils/LoadFromJson.hpp index 94f2e602..12a82bf8 100644 --- a/include/SSVOpenHexagon/Utils/LoadFromJson.hpp +++ b/include/SSVOpenHexagon/Utils/LoadFromJson.hpp @@ -5,15 +5,11 @@ #pragma once namespace Json { - class Value; - } namespace ssvuj { - using Obj = Json::Value; - } namespace hg { diff --git a/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp b/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp index 1d2ee0e8..34f01551 100644 --- a/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp +++ b/include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp @@ -12,10 +12,7 @@ #include #include -#include -#include #include -#include namespace hg::Utils { diff --git a/include/SSVOpenHexagon/Utils/LuaWrapper.hpp b/include/SSVOpenHexagon/Utils/LuaWrapper.hpp index 921133b6..9b2f4472 100644 --- a/include/SSVOpenHexagon/Utils/LuaWrapper.hpp +++ b/include/SSVOpenHexagon/Utils/LuaWrapper.hpp @@ -42,7 +42,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include #include #include #include @@ -745,19 +744,12 @@ class LuaContext return 1; } + static void* callbackCallImpl(lua_State* lua); + template static auto callbackCall(lua_State* lua) { - // this function is called when the lua script tries to call our - // custom data type - // what we do is we simply call the function - SSVOH_ASSERT(lua_gettop(lua) >= 1); - SSVOH_ASSERT(lua_isuserdata(lua, 1)); - - auto function = (FunctionPushType*)lua_touserdata(lua, 1); - - SSVOH_ASSERT(function); - return (*function)(lua); + return (*(static_cast(callbackCallImpl(lua))))(lua); } template diff --git a/include/SSVOpenHexagon/Utils/Match.hpp b/include/SSVOpenHexagon/Utils/Match.hpp index 7e56d560..7654eefa 100644 --- a/include/SSVOpenHexagon/Utils/Match.hpp +++ b/include/SSVOpenHexagon/Utils/Match.hpp @@ -8,7 +8,6 @@ #include #include -#include namespace hg::Utils { diff --git a/include/SSVOpenHexagon/Utils/Math.hpp b/include/SSVOpenHexagon/Utils/Math.hpp new file mode 100644 index 00000000..6295a44a --- /dev/null +++ b/include/SSVOpenHexagon/Utils/Math.hpp @@ -0,0 +1,25 @@ +// Copyright (c) 2013-2020 Vittorio Romeo +// License: Academic Free License ("AFL") v. 3.0 +// AFL License page: https://opensource.org/licenses/AFL-3.0 + +#pragma once + +namespace hg::Utils { + +inline constexpr float pi{3.14159265359f}; +inline constexpr float tau{6.28318530718f}; +inline constexpr float radDegRatio{0.01745329251f}; + +template +[[gnu::always_inline]] inline constexpr T toRad(const T& mX) noexcept +{ + return mX * radDegRatio; +} + +template +[[gnu::always_inline]] inline constexpr T getSign(const T& mX) noexcept +{ + return (T(0) < mX) - (mX < T(0)); +} + +} // namespace hg::Utils diff --git a/include/SSVOpenHexagon/Utils/MoveTowards.hpp b/include/SSVOpenHexagon/Utils/MoveTowards.hpp index 9776b446..d73be13a 100644 --- a/include/SSVOpenHexagon/Utils/MoveTowards.hpp +++ b/include/SSVOpenHexagon/Utils/MoveTowards.hpp @@ -6,7 +6,6 @@ #include "SSVOpenHexagon/Global/Assert.hpp" -#include #include namespace hg::Utils { diff --git a/include/SSVOpenHexagon/Utils/Ticker.hpp b/include/SSVOpenHexagon/Utils/Ticker.hpp index d793f7cd..0a6b06d9 100644 --- a/include/SSVOpenHexagon/Utils/Ticker.hpp +++ b/include/SSVOpenHexagon/Utils/Ticker.hpp @@ -4,8 +4,6 @@ #pragma once -#include - #include namespace hg { @@ -13,24 +11,24 @@ namespace hg { class Ticker { private: - ssvu::FT target; - ssvu::FT current{0.f}; - ssvu::FT total{0.f}; + float target; + float current{0.f}; + float total{0.f}; bool running{true}; bool loop{true}; std::size_t ticks{0}; public: - Ticker(ssvu::FT mTarget, bool mRunning = true) noexcept; + Ticker(float mTarget, bool mRunning = true) noexcept; - bool update(ssvu::FT) noexcept; - bool update(ssvu::FT mFT, ssvu::FT mTarget) noexcept; + bool update(float) noexcept; + bool update(float mFT, float mTarget) noexcept; void pause() noexcept; void resume() noexcept; void stop() noexcept; void restart() noexcept; - void restart(ssvu::FT mTarget) noexcept; + void restart(float mTarget) noexcept; void resetCurrent() noexcept; void resetTicks() noexcept; @@ -41,21 +39,21 @@ class Ticker [[nodiscard]] bool getLoop() const noexcept; [[nodiscard]] bool isRunning() const noexcept; - [[nodiscard]] ssvu::FT getTarget() const noexcept; - [[nodiscard]] ssvu::FT getCurrent() const noexcept; - [[nodiscard]] ssvu::FT getTotal() const noexcept; + [[nodiscard]] float getTarget() const noexcept; + [[nodiscard]] float getCurrent() const noexcept; + [[nodiscard]] float getTotal() const noexcept; [[nodiscard]] std::size_t getTicks() const noexcept; - template + template [[nodiscard]] T getTotalSecs() const noexcept { - return static_cast(ssvu::getFTToSeconds(total)); + return static_cast(total / 60.f); } - template + template [[nodiscard]] T getCurrentSecs() const noexcept { - return static_cast(ssvu::getFTToSeconds(current)); + return static_cast(current / 60.f); } }; diff --git a/include/SSVOpenHexagon/Utils/Timeline2.hpp b/include/SSVOpenHexagon/Utils/Timeline2.hpp index 89a77ca3..85289c31 100644 --- a/include/SSVOpenHexagon/Utils/Timeline2.hpp +++ b/include/SSVOpenHexagon/Utils/Timeline2.hpp @@ -4,11 +4,10 @@ #pragma once -#include -#include -#include +#include "SSVOpenHexagon/Utils/FixedFunction.hpp" +#include "SSVOpenHexagon/Utils/TinyVariant.hpp" + #include -#include #include #include #include @@ -24,7 +23,7 @@ class timeline2 struct action_do { - std::function _func; + Utils::FixedFunction _func; }; struct action_wait_for @@ -39,15 +38,11 @@ class timeline2 struct action_wait_until_fn { - std::function _time_point_fn; + Utils::FixedFunction _time_point_fn; }; - struct action - { - std::variant - _inner; - }; + using action = vittorioromeo::tinyvariant; private: std::vector _actions; @@ -55,12 +50,26 @@ class timeline2 public: void clear(); - void append_do(const std::function& func); + template + void append_do(F&& func) + { + _actions.emplace_back( + vittorioromeo::impl::tinyvariant_inplace_type_t{}, + SSVOH_FWD(func)); + } + void append_wait_for(const duration d); void append_wait_for_seconds(const double s); void append_wait_for_sixths(const double s); void append_wait_until(const time_point tp); - void append_wait_until_fn(const std::function& tp_fn); + + template + void append_wait_until_fn(F&& tp_fn) + { + _actions.emplace_back(vittorioromeo::impl::tinyvariant_inplace_type_t< + action_wait_until_fn>{}, + SSVOH_FWD(tp_fn)); + } [[nodiscard]] std::size_t size() const noexcept; [[nodiscard]] action& action_at(const std::size_t i) noexcept; diff --git a/include/SSVOpenHexagon/Utils/TinyVariant.hpp b/include/SSVOpenHexagon/Utils/TinyVariant.hpp index 5195913c..53eee36b 100644 --- a/include/SSVOpenHexagon/Utils/TinyVariant.hpp +++ b/include/SSVOpenHexagon/Utils/TinyVariant.hpp @@ -650,8 +650,8 @@ class [[nodiscard]] tinyvariant return static_cast&&>(as>()); } - template ()( - impl::declval>()))> + template ()( + impl::declval&>()))> [[nodiscard, gnu::always_inline]] R recursive_visit(Visitor&& visitor) & { if constexpr (sizeof...(Alternatives) >= 10) @@ -670,8 +670,8 @@ class [[nodiscard]] tinyvariant } } - template ()( - impl::declval>()))> + template ()( + impl::declval&>()))> [[nodiscard, gnu::always_inline]] R recursive_visit( Visitor&& visitor) const& { @@ -707,8 +707,8 @@ class [[nodiscard]] tinyvariant return recursive_visit(impl::overload_set{static_cast(fs)...}); } - template ()( - impl::declval>()))> + template ()( + impl::declval&>()))> [[nodiscard, gnu::always_inline]] R linear_visit(Visitor&& visitor) & { if constexpr (impl::is_reference) @@ -734,8 +734,8 @@ class [[nodiscard]] tinyvariant } - template ()( - impl::declval>()))> + template ()( + impl::declval&>()))> [[nodiscard, gnu::always_inline]] R linear_visit(Visitor&& visitor) const& { if constexpr (impl::is_reference) diff --git a/include/SSVOpenHexagon/Utils/Utils.hpp b/include/SSVOpenHexagon/Utils/Utils.hpp index b235acf4..60e54088 100644 --- a/include/SSVOpenHexagon/Utils/Utils.hpp +++ b/include/SSVOpenHexagon/Utils/Utils.hpp @@ -4,15 +4,15 @@ #pragma once -#include "SSVOpenHexagon/Utils/LuaWrapper.hpp" - #include -#include -#include #include #include #include +namespace Lua { +class LuaContext; +} + namespace ssvu { class TimelineManager; @@ -46,36 +46,33 @@ struct Nothing {}; template -using VoidToNothing = std::conditional_t, Nothing, T>; +struct VoidToNothingImpl +{ + using type = T; +}; + +template <> +struct VoidToNothingImpl +{ + using type = Nothing; +}; + +template +using VoidToNothing = typename VoidToNothingImpl::type; + +template +inline constexpr bool isSameType = false; + +template +inline constexpr bool isSameType = true; template T runLuaFunction( - Lua::LuaContext& mLua, std::string_view mName, const TArgs&... mArgs) -{ - return mLua.callLuaFunction(mName, std::make_tuple(mArgs...)); -} + Lua::LuaContext& mLua, std::string_view mName, const TArgs&... mArgs); template -auto runLuaFunctionIfExists( - Lua::LuaContext& mLua, std::string_view mName, const TArgs&... mArgs) -{ - using Ret = std::optional>; - - if (!mLua.doesVariableExist(mName)) - { - return Ret{}; - } - - if constexpr (std::is_same_v) - { - runLuaFunction(mLua, mName, mArgs...); - return Ret{Nothing{}}; - } - else - { - return Ret{runLuaFunction(mLua, mName, mArgs...)}; - } -} +std::optional> runLuaFunctionIfExists( + Lua::LuaContext& mLua, std::string_view mName, const TArgs&... mArgs); const PackData& findDependencyPackDataOrThrow(const HGAssets& assets, const PackData& currentPack, const std::string& mPackDisambiguator, diff --git a/public/discord/types.h b/public/discord/types.h index 76c43117..36be1119 100644 --- a/public/discord/types.h +++ b/public/discord/types.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "ffi.h" #include "event.h" #ifdef _WIN32 diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp index fb9ff68a..eace649b 100644 --- a/src/SSVOpenHexagon/Components/CPlayer.cpp +++ b/src/SSVOpenHexagon/Components/CPlayer.cpp @@ -10,19 +10,16 @@ #include "SSVOpenHexagon/Utils/Color.hpp" #include "SSVOpenHexagon/Utils/Easing.hpp" #include "SSVOpenHexagon/Utils/Geometry.hpp" +#include "SSVOpenHexagon/Utils/Math.hpp" #include "SSVOpenHexagon/Utils/MoveTowards.hpp" #include "SSVOpenHexagon/Utils/PointInPolygon.hpp" #include "SSVOpenHexagon/Utils/Ticker.hpp" -#include - -#include -#include +#include #include #include -#include #include namespace hg { @@ -91,26 +88,26 @@ void CPlayer::draw(const unsigned int sides, const sf::Color& colorMain, } const float tiltedAngle = - _angle + (_currTiltedAngle * ssvu::toRad(24.f) * angleTiltIntensity); + _angle + (_currTiltedAngle * Utils::toRad(24.f) * angleTiltIntensity); - const sf::Vector2f pLeft = ssvs::getOrbitRad( - _pos, tiltedAngle - ssvu::toRad(100.f), _size + _triangleWidth); + const sf::Vector2f pLeft = _pos.movedAndRotatedBy( + _size + _triangleWidth, sf::radians(tiltedAngle - Utils::toRad(100.f))); - const sf::Vector2f pRight = ssvs::getOrbitRad( - _pos, tiltedAngle + ssvu::toRad(100.f), _size + _triangleWidth); + const sf::Vector2f pRight = _pos.movedAndRotatedBy( + _size + _triangleWidth, sf::radians(tiltedAngle + Utils::toRad(100.f))); playerTris.reserve_more(3); playerTris.batch_unsafe_emplace_back( swapBlinkingEffect ? getColorAdjustedForSwap(colorPlayer) : getColor(colorPlayer), - ssvs::getOrbitRad(_pos, tiltedAngle, _size), pLeft, pRight); + _pos.movedAndRotatedBy(_size, sf::radians(tiltedAngle)), pLeft, pRight); } void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, Utils::FastVertexVectorTris& wallQuads, Utils::FastVertexVectorTris& capTris, const sf::Color& capColor) { - const float div{ssvu::tau / sides * 0.5f}; + const float div{Utils::tau / sides * 0.5f}; const float pRadius{_radius * 0.75f}; wallQuads.reserve_more_quad(sides * 1); @@ -121,13 +118,13 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, const float sAngle{div * 2.f * i}; const sf::Vector2f p1{ - ssvs::getOrbitRad(_startPos, sAngle - div, pRadius)}; + _startPos.movedAndRotatedBy(pRadius, sf::radians(sAngle - div))}; const sf::Vector2f p2{ - ssvs::getOrbitRad(_startPos, sAngle + div, pRadius)}; - const sf::Vector2f p3{ssvs::getOrbitRad( - _startPos, sAngle + div, pRadius + baseThickness)}; - const sf::Vector2f p4{ssvs::getOrbitRad( - _startPos, sAngle - div, pRadius + baseThickness)}; + _startPos.movedAndRotatedBy(pRadius, sf::radians(sAngle + div))}; + const sf::Vector2f p3{_startPos.movedAndRotatedBy( + pRadius + baseThickness, sf::radians(sAngle + div))}; + const sf::Vector2f p4{_startPos.movedAndRotatedBy( + pRadius + baseThickness, sf::radians(sAngle - div))}; wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4); capTris.batch_unsafe_emplace_back(capColor, p1, p2, _startPos); @@ -136,7 +133,7 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads) { - const float div{ssvu::tau / 6 * 0.5f}; + const float div{Utils::tau / 6 * 0.5f}; const float dRadius{_hue / 8.f}; const float thickness{_hue / 20.f}; @@ -148,12 +145,14 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads) { const float sAngle{div * 2.f * i}; - const sf::Vector2f p1{ssvs::getOrbitRad(_pos, sAngle - div, dRadius)}; - const sf::Vector2f p2{ssvs::getOrbitRad(_pos, sAngle + div, dRadius)}; - const sf::Vector2f p3{ - ssvs::getOrbitRad(_pos, sAngle + div, dRadius + thickness)}; - const sf::Vector2f p4{ - ssvs::getOrbitRad(_pos, sAngle - div, dRadius + thickness)}; + const sf::Vector2f p1{ + _pos.movedAndRotatedBy(dRadius, sf::radians(sAngle - div))}; + const sf::Vector2f p2{ + _pos.movedAndRotatedBy(dRadius, sf::radians(sAngle + div))}; + const sf::Vector2f p3{_pos.movedAndRotatedBy( + dRadius + thickness, sf::radians(sAngle + div))}; + const sf::Vector2f p4{_pos.movedAndRotatedBy( + dRadius + thickness, sf::radians(sAngle - div))}; wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4); } @@ -161,7 +160,7 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads) void CPlayer::playerSwap() { - _angle += ssvu::pi; + _angle += Utils::pi; } void CPlayer::kill(const bool fatal) @@ -174,11 +173,11 @@ void CPlayer::kill(const bool fatal) // Avoid moving back position if the player had just swapped or the // player was forcibly moved by a lot via Lua scripting. - if (!_justSwapped && ssvs::getDistEuclidean(_pos, _lastPos) < 24.f) + if (!_justSwapped && (_lastPos - _pos).length() < 24.f) { // Move back position to graphically show the tip of the triangle // hitting the wall rather than the center of the triangle. - _pos = ssvs::getOrbitRad(_lastPos, _angle, -_size); + _pos = _lastPos.movedAndRotatedBy(-_size, sf::radians(_angle)); } } } @@ -207,7 +206,7 @@ template const auto assignResult = [&]() { - tempDistance = ssvs::getMagSquared(vec1 - pos); + tempDistance = (vec1 - pos).lengthSq(); if (tempDistance < safeDistance) { pos = vec1; @@ -234,8 +233,7 @@ template case 2u: { - if (ssvs::getMagSquared(vec1 - pos) > - ssvs::getMagSquared(vec2 - pos)) + if ((vec1 - pos).lengthSq() > (vec2 - pos).lengthSq()) { vec1 = vec2; } @@ -256,7 +254,7 @@ template [[nodiscard]] bool CPlayer::push(const int movementDir, const float radius, const CWall& wall, const sf::Vector2f& centerPos, const float radiusSquared, - const ssvu::FT ft) + const float ft) { if (_dead) { @@ -273,7 +271,7 @@ template // at saving player. const SpeedData& curveData{wall.getCurve()}; if (curveData._speed != 0.f && - ssvu::getSign(curveData._speed) != movementDir) + Utils::getSign(curveData._speed) != movementDir) { wall.moveVertexAlongCurve(testPos, centerPos, ft); pushVel = testPos - _pos; @@ -282,9 +280,12 @@ template // If player is not moving calculate now... if (!movementDir && !_forcedMove) { - _pos = testPos + ssvs::getNormalized(testPos - _prePushPos) * - (2.f * collisionPadding); - _angle = ssvs::getRad(_pos); + const sf::Vector2f posDiff = testPos - _prePushPos; + const sf::Vector2f posDiffNormalized = + posDiff == sf::Vector2f::Zero ? posDiff : posDiff.normalized(); + + _pos = testPos + posDiffNormalized * (2.f * collisionPadding); + _angle = _pos.angle().asRadians(); updatePosition(radius); return wall.isOverlapping(_pos); } @@ -314,15 +315,14 @@ template // If player survived assign it the saving testPos, but displace it further // out the wall border, otherwise player would be lying right on top of the // border. - _pos = - testPos + ssvs::getNormalized(testPos - _prePushPos) * collisionPadding; - _angle = ssvs::getRad(_pos); + _pos = testPos + (testPos - _prePushPos).normalized() * collisionPadding; + _angle = _pos.angle().asRadians(); updatePosition(radius); return false; } [[nodiscard]] bool CPlayer::push(const int movementDir, const float radius, - const CCustomWall& wall, const float radiusSquared, const ssvu::FT ft) + const CCustomWall& wall, const float radiusSquared, const float ft) { (void)ft; // Currently unused. @@ -365,8 +365,8 @@ template i2, _lastPos, wVertexes[i], wVertexes[j], radiusSquared)) { pushVel = i2 - i1; - if (std::abs(ssvs::getDotProduct(ssvs::getNormalized(pushVel), - ssvs::getNormalized(_lastPos))) > pushDotThreshold) + if (std::abs(pushVel.normalized().dot(_lastPos.normalized())) > + pushDotThreshold) { pushVel = {0.f, 0.f}; } @@ -379,9 +379,8 @@ template if (!movementDir && !_forcedMove) { _pos += pushVel; - _pos += - ssvs::getNormalized(_pos - _prePushPos) * (2.f * collisionPadding); - _angle = ssvs::getRad(_pos); + _pos += (_pos - _prePushPos).normalized() * (2.f * collisionPadding); + _angle = _pos.angle().asRadians(); updatePosition(radius); return wall.isOverlapping(_pos); } @@ -397,16 +396,14 @@ template // If player survived assign it the saving testPos, but displace it further // out the wall border, otherwise player would be lying right on top of the // border. - _pos = - testPos + ssvs::getNormalized(testPos - _prePushPos) * collisionPadding; - _angle = ssvs::getRad(_pos); + _pos = testPos + (testPos - _prePushPos).normalized() * collisionPadding; + _angle = _pos.angle().asRadians(); updatePosition(radius); return false; } -void CPlayer::updateTriangleWidthTransition( - const bool focused, const ssvu::FT ft) +void CPlayer::updateTriangleWidthTransition(const bool focused, const float ft) { if (focused && _triangleWidthTransitionTime < 1.f) { @@ -422,8 +419,7 @@ void CPlayer::updateTriangleWidthTransition( (1.f - Utils::getSmoothStep(0.f, 1.f, _triangleWidthTransitionTime)); } -void CPlayer::update( - const bool focused, const bool swapEnabled, const ssvu::FT ft) +void CPlayer::update(const bool focused, const bool swapEnabled, const float ft) { updateTriangleWidthTransition(focused, ft); @@ -462,10 +458,10 @@ void CPlayer::update( } void CPlayer::updateInputMovement(const float movementDir, - const float playerSpeedMult, const bool focused, const ssvu::FT ft) + const float playerSpeedMult, const bool focused, const float ft) { _currentSpeed = playerSpeedMult * (focused ? _focusSpeed : _speed) * ft; - _angle += ssvu::toRad(_currentSpeed * movementDir); + _angle += Utils::toRad(_currentSpeed * movementDir); const float inc = ft / 10.f; @@ -490,13 +486,14 @@ void CPlayer::updatePosition(const float radius) { _radius = radius; - _prePushPos = _pos = ssvs::getOrbitRad(_startPos, _angle, _radius); - _lastPos = ssvs::getOrbitRad(_startPos, _lastAngle, _radius); + _prePushPos = _pos = + _startPos.movedAndRotatedBy(_radius, sf::radians(_angle)); + _lastPos = _startPos.movedAndRotatedBy(_radius, sf::radians(_lastAngle)); _maxSafeDistance = - ssvs::getMagSquared( - _lastPos - ssvs::getOrbitRad(_startPos, - _lastAngle + ssvu::toRad(_currentSpeed), _radius)) + + (_lastPos - _startPos.movedAndRotatedBy(_radius, + sf::radians(_lastAngle + Utils::toRad(_currentSpeed)))) + .lengthSq() + 32.f; } diff --git a/src/SSVOpenHexagon/Components/CWall.cpp b/src/SSVOpenHexagon/Components/CWall.cpp index 4db065e2..687f1736 100644 --- a/src/SSVOpenHexagon/Components/CWall.cpp +++ b/src/SSVOpenHexagon/Components/CWall.cpp @@ -3,6 +3,8 @@ // AFL License page: https://opensource.org/licenses/AFL-3.0 #include "SSVOpenHexagon/Components/CWall.hpp" + +#include "SSVOpenHexagon/Utils/Math.hpp" #include "SSVOpenHexagon/Utils/Color.hpp" #include @@ -16,24 +18,25 @@ CWall::CWall(const unsigned int sides, const float wallAngleLeft, const SpeedData& curve, const float hueMod) : _speed{speed}, _curve{curve}, _hueMod{hueMod}, _killed{false} { - const float div{ssvu::tau / static_cast(sides) * 0.5f}; + const float div{Utils::tau / static_cast(sides) * 0.5f}; const float angle{div * 2.f * static_cast(side)}; const float angleN = angle - div; const float angleP = angle + div; - const auto vecFromRad = [](const float rad, const float dist) - { return sf::Vector2f{dist * std::cos(rad), dist * std::sin(rad)}; }; - - _vertexPositions[0] = centerPos + vecFromRad(angleN, distance); + _vertexPositions[0] = + centerPos.movedAndRotatedBy(distance, sf::radians(angleN)); - _vertexPositions[1] = centerPos + vecFromRad(angleP, distance); + _vertexPositions[1] = + centerPos.movedAndRotatedBy(distance, sf::radians(angleP)); - _vertexPositions[2] = centerPos + vecFromRad(angleP + wallAngleLeft, - distance + thickness + wallSkewLeft); + _vertexPositions[2] = + centerPos.movedAndRotatedBy(distance + thickness + wallSkewLeft, + sf::radians(angleP + wallAngleLeft)); - _vertexPositions[3] = centerPos + vecFromRad(angleN + wallAngleRight, - distance + thickness + wallSkewRight); + _vertexPositions[3] = + centerPos.movedAndRotatedBy(distance + thickness + wallSkewRight, + sf::radians(angleN + wallAngleRight)); } void CWall::draw(sf::Color color, Utils::FastVertexVectorTris& wallQuads) @@ -48,7 +51,7 @@ void CWall::draw(sf::Color color, Utils::FastVertexVectorTris& wallQuads) } void CWall::update(const float wallSpawnDist, const float radius, - const sf::Vector2f& centerPos, const ssvu::FT ft) + const sf::Vector2f& centerPos, const float ft) { _speed.update(ft); _curve.update(ft); @@ -61,7 +64,7 @@ void CWall::update(const float wallSpawnDist, const float radius, } void CWall::moveTowardsCenter(const float wallSpawnDist, const float radius, - const sf::Vector2f& centerPos, const ssvu::FT ft) + const sf::Vector2f& centerPos, const float ft) { const float halfRadius{radius * 0.5f}; const float outerBounds{wallSpawnDist * 1.1f}; @@ -94,7 +97,7 @@ void CWall::moveTowardsCenter(const float wallSpawnDist, const float radius, } } -void CWall::moveCurve(const sf::Vector2f& centerPos, const ssvu::FT ft) +void CWall::moveCurve(const sf::Vector2f& centerPos, const float ft) { const float rad = getCurveRadians(ft); const float radSin = std::sin(rad); diff --git a/src/SSVOpenHexagon/Core/CCustomWallManager.cpp b/src/SSVOpenHexagon/Core/CCustomWallManager.cpp index e70edd97..eb6d0afc 100644 --- a/src/SSVOpenHexagon/Core/CCustomWallManager.cpp +++ b/src/SSVOpenHexagon/Core/CCustomWallManager.cpp @@ -200,14 +200,14 @@ void CCustomWallManager::setKillingSide( { if (!checkValidVertexIdxAndHandle(cwHandle, vertexIdx, "get vertex pos")) { - return ssvs::zeroVec2f; + return sf::Vector2f::Zero; } return _customWalls[cwHandle].getVertexPos(vertexIdx); } -static const std::array zeroArr{ - ssvs::zeroVec2f, ssvs::zeroVec2f, ssvs::zeroVec2f, ssvs::zeroVec2f}; +static const std::array zeroArr{sf::Vector2f::Zero, + sf::Vector2f::Zero, sf::Vector2f::Zero, sf::Vector2f::Zero}; [[nodiscard]] const std::array& CCustomWallManager::getVertexPos4(const CCustomWallHandle cwHandle) @@ -333,7 +333,7 @@ void CCustomWallManager::draw(Utils::FastVertexVectorTris& wallQuads) } [[nodiscard]] bool CCustomWallManager::handleCollision( - const int movement, const float radius, CPlayer& mPlayer, ssvu::FT mFT) + const int movement, const float radius, CPlayer& mPlayer, float mFT) { // ------------------------------------------------------------------------ // Get all alive walls diff --git a/src/SSVOpenHexagon/Core/HGGraphics.cpp b/src/SSVOpenHexagon/Core/HGGraphics.cpp index 15102db3..903ed1e0 100644 --- a/src/SSVOpenHexagon/Core/HGGraphics.cpp +++ b/src/SSVOpenHexagon/Core/HGGraphics.cpp @@ -12,12 +12,12 @@ #include "SSVOpenHexagon/Global/Imgui.hpp" #include "SSVOpenHexagon/Utils/Color.hpp" +#include "SSVOpenHexagon/Utils/Math.hpp" #include "SSVOpenHexagon/Utils/String.hpp" #include "SSVStart/Utils/SFML.hpp" #include -#include #include #include @@ -98,7 +98,7 @@ void HexagonGame::draw() } else { - backgroundCamera->setCenter(ssvs::zeroVec2f); + backgroundCamera->setCenter(sf::Vector2f::Zero); overlayCamera->setCenter(sf::Vector2f{ Config::getWidth() / 2.f, Config::getHeight() / 2.f}); } @@ -110,7 +110,7 @@ void HexagonGame::draw() backgroundTris.clear(); - styleData.drawBackground(backgroundTris, ssvs::zeroVec2f, + styleData.drawBackground(backgroundTris, sf::Vector2f::Zero, levelStatus.sides, Config::getDarkenUnevenBackgroundChunk() && levelStatus.darkenUnevenBackgroundChunk, @@ -165,7 +165,7 @@ void HexagonGame::draw() backgroundCamera->setSkew(skew); const float radRot( - ssvu::toRad(backgroundCamera->getRotation()) + (ssvu::pi / 2.f)); + Utils::toRad(backgroundCamera->getRotation()) + (Utils::pi / 2.f)); const float sinRot(std::sin(radRot)); const float cosRot(std::cos(radRot)); @@ -422,7 +422,7 @@ void HexagonGame::drawSwapParticles() } } -void HexagonGame::updateText(ssvu::FT mFT) +void HexagonGame::updateText(float mFT) { if (window == nullptr || !textUI.has_value()) { @@ -432,7 +432,7 @@ void HexagonGame::updateText(ssvu::FT mFT) // ------------------------------------------------------------------------ // Update "personal best" text animation. pbTextGrowth += 0.08f * mFT; - if (pbTextGrowth > ssvu::pi * 2.f) + if (pbTextGrowth > Utils::pi * 2.f) { pbTextGrowth = 0; } diff --git a/src/SSVOpenHexagon/Core/HGScripting.cpp b/src/SSVOpenHexagon/Core/HGScripting.cpp index 6af670cf..a686c58e 100644 --- a/src/SSVOpenHexagon/Core/HGScripting.cpp +++ b/src/SSVOpenHexagon/Core/HGScripting.cpp @@ -312,8 +312,11 @@ static void waitUntilSImpl(const double mDuration, void HexagonGame::initLua_MainTimeline() { - addLuaFn(lua, "t_eval", [this](const std::string& mCode) - { timeline.append_do([=, this] { Utils::runLuaCode(lua, mCode); }); }) + addLuaFn(lua, "t_eval", + [this](const std::string& mCode) { + timeline.append_do( + [this, mCode] { Utils::runLuaCode(lua, mCode); }); + }) .arg("code") .doc( "*Add to the main timeline*: evaluate the Lua code specified in " @@ -367,7 +370,7 @@ void HexagonGame::initLua_EventTimeline() addLuaFn(lua, "e_stopTime", // [this](double mDuration) { - eventTimeline.append_do([=, this] + eventTimeline.append_do([this, mDuration] { status.pauseTime(ssvu::getFTToSeconds(mDuration)); }); }) .arg("duration") @@ -376,8 +379,10 @@ void HexagonGame::initLua_EventTimeline() "(under the assumption of a 60 FPS frame rate)."); addLuaFn(lua, "e_stopTimeS", // - [this](double mDuration) { - eventTimeline.append_do([=, this] { status.pauseTime(mDuration); }); + [this](double mDuration) + { + eventTimeline.append_do( + [this, mDuration] { status.pauseTime(mDuration); }); }) .arg("duration") .doc( @@ -409,7 +414,7 @@ void HexagonGame::initLua_EventTimeline() [this](const std::string& mMsg, double mDuration) { eventTimeline.append_do( - [=, this] + [this, mMsg, mDuration] { if (firstPlay) { @@ -427,7 +432,7 @@ void HexagonGame::initLua_EventTimeline() addLuaFn(lua, "e_messageAddImportant", // [this](const std::string& mMsg, double mDuration) { - eventTimeline.append_do([=, this] + eventTimeline.append_do([this, mMsg, mDuration] { addMessage(mMsg, mDuration, /* mSoundToggle */ true); }); }) .arg("message") @@ -440,7 +445,7 @@ void HexagonGame::initLua_EventTimeline() addLuaFn(lua, "e_messageAddImportantSilent", [this](const std::string& mMsg, double mDuration) { - eventTimeline.append_do([=, this] + eventTimeline.append_do([this, mMsg, mDuration] { addMessage(mMsg, mDuration, /* mSoundToggle */ false); }); }) .arg("message") @@ -488,7 +493,7 @@ void HexagonGame::initLua_CustomTimelines() } _customTimelineManager.get(cth)._timeline.append_do( - [=, this] { Utils::runLuaCode(lua, mCode); }); + [this, mCode] { Utils::runLuaCode(lua, mCode); }); }) .arg("handle") .arg("code") @@ -518,7 +523,8 @@ void HexagonGame::initLua_CustomTimelines() return; } - _customTimelineManager.get(cth)._timeline.append_do([=, this] + _customTimelineManager.get(cth)._timeline.append_do( + [this, mDuration] { status.pauseTime(ssvu::getFTToSeconds(mDuration)); }); }) .arg("handle") @@ -537,7 +543,7 @@ void HexagonGame::initLua_CustomTimelines() } _customTimelineManager.get(cth)._timeline.append_do( - [=, this] { status.pauseTime(mDuration); }); + [this, mDuration] { status.pauseTime(mDuration); }); }) .arg("handle") .arg("duration") @@ -705,7 +711,7 @@ void HexagonGame::initLua_WallCreation() [this](int mSide, float mThickness) { timeline.append_do( - [=, this] + [this, mSide, mThickness] { createWall(mSide, mThickness, SpeedData{getSpeedMultDM()}, SpeedData{} /* curve */, 0.f /* hueMod */); @@ -722,7 +728,7 @@ void HexagonGame::initLua_WallCreation() [this](int mSide, float mThickness, float mSpeedAdj) { timeline.append_do( - [=, this] + [this, mSide, mThickness, mSpeedAdj] { createWall(mSide, mThickness, SpeedData{mSpeedAdj * getSpeedMultDM()}, @@ -743,7 +749,8 @@ void HexagonGame::initLua_WallCreation() float mAcceleration, float mMinSpeed, float mMaxSpeed) { timeline.append_do( - [=, this] + [this, mSide, mThickness, mSpeedAdj, mAcceleration, mMinSpeed, + mMaxSpeed] { createWall(mSide, mThickness, SpeedData{mSpeedAdj * getSpeedMultDM(), @@ -772,7 +779,8 @@ void HexagonGame::initLua_WallCreation() float mSAcc, float mSMin, float mSMax, bool mSPingPong) { timeline.append_do( - [=, this] + [this, mHMod, mSide, mThickness, mSAdj, mSAcc, mSMin, mSMax, + mSPingPong] { createWall(mSide, mThickness, SpeedData{mSAdj * getSpeedMultDM(), mSAcc, mSMin, mSMax, @@ -804,7 +812,8 @@ void HexagonGame::initLua_WallCreation() float mCAcc, float mCMin, float mCMax, bool mCPingPong) { timeline.append_do( - [=, this] + [this, mHMod, mSide, mThickness, mCAdj, mCAcc, mCMin, mCMax, + mCPingPong] { createWall(mSide, mThickness, SpeedData{getSpeedMultDM()}, SpeedData{mCAdj, mCAcc, mCMin, mCMax, mCPingPong}, @@ -923,7 +932,7 @@ void HexagonGame::initLua_Deprecated() "This function will be removed in a future version of Open " "Hexagon. Please replace all occurrences of this function with " "\"e_stopTime\" in your level files."); - eventTimeline.append_do([=, this] + eventTimeline.append_do([this, mDuration] { status.pauseTime(ssvu::getFTToSeconds(mDuration)); }); }) .arg("duration") @@ -940,7 +949,8 @@ void HexagonGame::initLua_Deprecated() "This function will be removed in a future version of Open " "Hexagon. Please replace all occurrences of this function with " "\"e_stopTimeS\" in your level files."); - eventTimeline.append_do([=, this] { status.pauseTime(mDuration); }); + eventTimeline.append_do( + [this, mDuration] { status.pauseTime(mDuration); }); }) .arg("duration") .doc( @@ -1010,7 +1020,7 @@ void HexagonGame::initLua_Deprecated() "Hexagon. Please replace all occurrences of this function with " "\"e_messageAdd\" in your level files and common.lua."); eventTimeline.append_do( - [=, this] + [this, mMsg, mDuration] { if (firstPlay) { @@ -1035,7 +1045,7 @@ void HexagonGame::initLua_Deprecated() "Hexagon. Please replace all occurrences of this function with " "\"e_messageAddImportant\" in your level files and " "common.lua."); - eventTimeline.append_do([=, this] + eventTimeline.append_do([this, mMsg, mDuration] { addMessage(mMsg, mDuration, /* mSoundToggle */ true); }); }) .arg("message") @@ -1054,7 +1064,7 @@ void HexagonGame::initLua_Deprecated() "This function will be removed in a future version of Open " "Hexagon. Please replace all occurrences of this function with " "\"e_messageAddImportantSilent\" in your level files."); - eventTimeline.append_do([=, this] + eventTimeline.append_do([this, mMsg, mDuration] { addMessage(mMsg, mDuration, /* mSoundToggle */ false); }); }) .arg("message") diff --git a/src/SSVOpenHexagon/Core/HGUpdate.cpp b/src/SSVOpenHexagon/Core/HGUpdate.cpp index f08b41b5..b8a21b54 100644 --- a/src/SSVOpenHexagon/Core/HGUpdate.cpp +++ b/src/SSVOpenHexagon/Core/HGUpdate.cpp @@ -17,6 +17,7 @@ #include "SSVOpenHexagon/Utils/Concat.hpp" #include "SSVOpenHexagon/Utils/Easing.hpp" #include "SSVOpenHexagon/Utils/LevelValidator.hpp" +#include "SSVOpenHexagon/Utils/Math.hpp" #include "SSVOpenHexagon/Utils/MoveTowards.hpp" #include "SSVOpenHexagon/Utils/Split.hpp" #include "SSVOpenHexagon/Utils/String.hpp" @@ -34,9 +35,6 @@ #include #endif -#include - -#include #include #include @@ -78,7 +76,7 @@ void HexagonGame::advanceByTicks(const int nTicks) } } -void HexagonGame::update(ssvu::FT mFT, const float timescale) +void HexagonGame::update(float mFT, const float timescale) { // ------------------------------------------------------------------------ // Fast-forwarding for level testing @@ -424,7 +422,7 @@ void HexagonGame::update(ssvu::FT mFT, const float timescale) } } -void HexagonGame::updateWalls(ssvu::FT mFT) +void HexagonGame::updateWalls(float mFT) { bool collided{false}; const float radiusSquared{status.radius * status.radius + 8.f}; @@ -485,7 +483,7 @@ void HexagonGame::updateWalls(ssvu::FT mFT) } } -void HexagonGame::updateCustomWalls(ssvu::FT mFT) +void HexagonGame::updateCustomWalls(float mFT) { if (cwManager.handleCollision(getInputMovement(), getRadius(), player, mFT)) { @@ -691,7 +689,7 @@ void HexagonGame::updateInput() updateInput_RecordCurrentInputToLastReplayData(); } -void HexagonGame::updateEvents(ssvu::FT) +void HexagonGame::updateEvents(float) { if (const auto o = eventTimelineRunner.update(eventTimeline, status.getTimeTP()); @@ -733,7 +731,7 @@ void HexagonGame::updateIncrement() mustChangeSides = true; } -void HexagonGame::updateLevel(ssvu::FT mFT) +void HexagonGame::updateLevel(float mFT) { if (status.isTimePaused()) { @@ -752,7 +750,7 @@ void HexagonGame::updateLevel(ssvu::FT mFT) } } -void HexagonGame::updatePulse(ssvu::FT mFT) +void HexagonGame::updatePulse(float mFT) { if (!levelStatus.manualPulseControl) { @@ -796,7 +794,7 @@ void HexagonGame::refreshPulse() Config::getNoPulse() ? 1.f : (status.pulse / levelStatus.pulseMin)}; const float rotation{backgroundCamera->getRotation()}; - backgroundCamera->setView(sf::View{ssvs::zeroVec2f, + backgroundCamera->setView(sf::View{sf::Vector2f::Zero, {(Config::getWidth() * Config::getZoomFactor()) * p, (Config::getHeight() * Config::getZoomFactor()) * p}}); @@ -804,7 +802,7 @@ void HexagonGame::refreshPulse() } } -void HexagonGame::updateBeatPulse(ssvu::FT mFT) +void HexagonGame::updateBeatPulse(float mFT) { if (!levelStatus.manualBeatPulseControl) { @@ -834,7 +832,7 @@ void HexagonGame::refreshBeatPulse() radiusMin * (status.pulse / levelStatus.pulseMin) + status.beatPulse; } -void HexagonGame::updateRotation(ssvu::FT mFT) +void HexagonGame::updateRotation(float mFT) { auto nextRotation(getRotationSpeed() * 10.f); if (status.fastSpin > 0) @@ -843,7 +841,7 @@ void HexagonGame::updateRotation(ssvu::FT mFT) levelStatus.fastSpin, status.fastSpin) / 3.5f) * 17.f) * - ssvu::getSign(nextRotation); + Utils::getSign(nextRotation); status.fastSpin -= mFT; } @@ -855,7 +853,7 @@ void HexagonGame::updateRotation(ssvu::FT mFT) } } -void HexagonGame::updateCameraShake(ssvu::FT mFT) +void HexagonGame::updateCameraShake(float mFT) { if (!backgroundCamera.has_value() || !overlayCamera.has_value()) { @@ -897,7 +895,7 @@ void HexagonGame::updateCameraShake(ssvu::FT mFT) overlayCamera->setCenter(preShakeCenters->overlay + makeShakeVec()); } -void HexagonGame::updateFlash(ssvu::FT mFT) +void HexagonGame::updateFlash(float mFT) { if (status.flashEffect > 0) { @@ -912,7 +910,7 @@ void HexagonGame::updateFlash(ssvu::FT mFT) } } -void HexagonGame::updatePulse3D(ssvu::FT mFT) +void HexagonGame::updatePulse3D(float mFT) { status.pulse3D += styleData._3dPulseSpeed * status.pulse3DDirection * mFT; if (status.pulse3D > styleData._3dPulseMax) @@ -925,7 +923,7 @@ void HexagonGame::updatePulse3D(ssvu::FT mFT) } } -void HexagonGame::updateParticles(ssvu::FT mFT) +void HexagonGame::updateParticles(float mFT) { SSVOH_ASSERT(window != nullptr); @@ -981,7 +979,7 @@ void HexagonGame::updateParticles(ssvu::FT mFT) } } -void HexagonGame::updateTrailParticles(ssvu::FT mFT) +void HexagonGame::updateTrailParticles(float mFT) { SSVOH_ASSERT(window != nullptr); @@ -1024,7 +1022,7 @@ void HexagonGame::updateTrailParticles(ssvu::FT mFT) p.sprite.setScale(p.sprite.getScale() * 0.98f); p.sprite.setPosition( - ssvs::getVecFromRad(p.angle, status.radius + 2.4f)); + sf::Vector2f(status.radius + 2.4f, sf::radians(p.angle))); } if (player.hasChangedAngle()) @@ -1033,7 +1031,7 @@ void HexagonGame::updateTrailParticles(ssvu::FT mFT) } } -void HexagonGame::updateSwapParticles(ssvu::FT mFT) +void HexagonGame::updateSwapParticles(float mFT) { SSVOH_ASSERT(window != nullptr); @@ -1058,9 +1056,8 @@ void HexagonGame::updateSwapParticles(ssvu::FT mFT) c.a = alpha; p.sprite.setColor(c); - p.velocity = - ssvs::getVecFromRad(si.angle + ssvu::getRndR(-expand, expand), - ssvu::getRndR(0.1f, 10.f) * speedMult); + p.velocity = sf::Vector2f(ssvu::getRndR(0.1f, 10.f) * speedMult, + sf::radians(si.angle + ssvu::getRndR(-expand, expand))); return p; }; diff --git a/src/SSVOpenHexagon/Core/HexagonGame.cpp b/src/SSVOpenHexagon/Core/HexagonGame.cpp index d436945b..d48823a8 100644 --- a/src/SSVOpenHexagon/Core/HexagonGame.cpp +++ b/src/SSVOpenHexagon/Core/HexagonGame.cpp @@ -9,7 +9,6 @@ #include "SSVOpenHexagon/Data/LevelData.hpp" #include "SSVOpenHexagon/Data/StyleData.hpp" #include "SSVOpenHexagon/Data/PackData.hpp" -#include "SSVOpenHexagon/Data/PackInfo.hpp" #include "SSVOpenHexagon/Data/ProfileData.hpp" #include "SSVOpenHexagon/Global/Assert.hpp" @@ -31,17 +30,14 @@ #include "SSVOpenHexagon/Utils/Utils.hpp" #include -#include #include #include -#include #include #include #include -#include namespace hg { @@ -315,7 +311,7 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, audio(mAudio), window(mGameWindow), hexagonClient{mHexagonClient}, - player{ssvs::zeroVec2f, getSwapCooldown(), Config::getPlayerSize(), + player{sf::Vector2f::Zero, getSwapCooldown(), Config::getPlayerSize(), Config::getPlayerSpeed(), Config::getPlayerFocusSpeed()}, levelStatus{Config::getMusicSpeedDMSync(), Config::getSpawnDistance()}, txStarParticle{nullptr}, @@ -343,7 +339,7 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, const float height = Config::getHeight(); const float zoomFactor = Config::getZoomFactor(); - backgroundCamera.emplace(sf::View{ssvs::zeroVec2f, + backgroundCamera.emplace(sf::View{sf::Vector2f::Zero, sf::Vector2f{width * zoomFactor, height * zoomFactor}}); overlayCamera.emplace(sf::View{sf::Vector2f{width / 2.f, height / 2.f}, @@ -365,8 +361,7 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, replayIcon.setTextureRect(txReplayIcon->getRect()); } - game.onUpdate += - [this](ssvu::FT mFT) { update(mFT, Config::getTimescale()); }; + game.onUpdate += [this](float mFT) { update(mFT, Config::getTimescale()); }; game.onPostUpdate += [this] { postUpdate(); }; @@ -407,7 +402,7 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, const auto notInConsole = [this](auto&& f) { - return [this, f](ssvu::FT /*unused*/) + return [this, f](float /*unused*/) { if (!imguiLuaConsoleHasInput()) { @@ -451,7 +446,7 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, notInConsole([this] { mustTakeScreenshot = true; })); addTidInput(Tid::LuaConsole, ssvs::Input::Type::Once, - [this](ssvu::FT /*unused*/) + [this](float /*unused*/) { if (Config::getDebug()) { @@ -460,7 +455,7 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager, }); addTidInput(Tid::Pause, ssvs::Input::Type::Once, - [this](ssvu::FT /*unused*/) + [this](float /*unused*/) { if (Config::getDebug()) { @@ -723,7 +718,7 @@ void HexagonGame::newGame(const std::string& mPackId, const std::string& mId, walls.clear(); cwManager.clear(); player = - CPlayer{ssvs::zeroVec2f, getSwapCooldown(), Config::getPlayerSize(), + CPlayer{sf::Vector2f::Zero, getSwapCooldown(), Config::getPlayerSize(), Config::getPlayerSpeed(), Config::getPlayerFocusSpeed()}; // Timeline cleanup @@ -756,7 +751,7 @@ void HexagonGame::newGame(const std::string& mPackId, const std::string& mId, sf::View{{Config::getWidth() / 2.f, Config::getHeight() / 2.f}, sf::Vector2f(Config::getWidth(), Config::getHeight())}); - backgroundCamera->setView(sf::View{ssvs::zeroVec2f, + backgroundCamera->setView(sf::View{sf::Vector2f::Zero, {Config::getWidth() * Config::getZoomFactor(), Config::getHeight() * Config::getZoomFactor()}}); @@ -877,7 +872,7 @@ void HexagonGame::death_shakeCamera() sf::View{{Config::getWidth() / 2.f, Config::getHeight() / 2.f}, sf::Vector2f(Config::getWidth(), Config::getHeight())}); - backgroundCamera->setCenter(ssvs::zeroVec2f); + backgroundCamera->setCenter(sf::Vector2f::Zero); status.cameraShake = 45.f * Config::getCameraShakeMultiplier(); } diff --git a/src/SSVOpenHexagon/Core/MenuGame.cpp b/src/SSVOpenHexagon/Core/MenuGame.cpp index 2b840c37..c2405bc0 100644 --- a/src/SSVOpenHexagon/Core/MenuGame.cpp +++ b/src/SSVOpenHexagon/Core/MenuGame.cpp @@ -37,9 +37,9 @@ #include "SSVOpenHexagon/Utils/Concat.hpp" #include "SSVOpenHexagon/Utils/FontHeight.hpp" #include "SSVOpenHexagon/Utils/Geometry.hpp" -#include "SSVOpenHexagon/Utils/LevelValidator.hpp" #include "SSVOpenHexagon/Utils/LuaWrapper.hpp" #include "SSVOpenHexagon/Utils/Match.hpp" +#include "SSVOpenHexagon/Utils/Math.hpp" #include "SSVOpenHexagon/Utils/ScopeGuard.hpp" #include "SSVOpenHexagon/Utils/String.hpp" #include "SSVOpenHexagon/Utils/Timestamp.hpp" @@ -49,15 +49,13 @@ #include #include #include -#include #include #include -#include - #include +#include #include #include #include @@ -179,9 +177,9 @@ MenuGame::MenuGame(Steam::steam_manager& mSteamManager, rsOnlineStatus{sf::Vector2f{128.f, 32.f}}, txtOnlineStatus{openSquare, "", 24}, enteredChars{}, - backgroundCamera{ - {ssvs::zeroVec2f, {Config::getSizeX() * Config::getZoomFactor(), - Config::getSizeY() * Config::getZoomFactor()}}}, + backgroundCamera{{sf::Vector2f::Zero, + {Config::getSizeX() * Config::getZoomFactor(), + Config::getSizeY() * Config::getZoomFactor()}}}, overlayCamera{{{Config::getWidth() / 2.f, Config::getHeight() * Config::getZoomFactor() / 2.f}, {Config::getWidth() * Config::getZoomFactor(), @@ -259,7 +257,7 @@ MenuGame::MenuGame(Steam::steam_manager& mSteamManager, initOnlineIcons(); refreshCamera(); - game.onUpdate += [this](ssvu::FT mFT) { update(mFT); }; + game.onUpdate += [this](float mFT) { update(mFT); }; game.onDraw += [this] { draw(); }; @@ -918,7 +916,7 @@ void MenuGame::initInput() }; addTidInput(Tid::RotateCCW, t::Once, - [this](ssvu::FT) + [this](float) { if (!mouseHovering) { @@ -927,7 +925,7 @@ void MenuGame::initInput() }); addTidInput(Tid::RotateCW, t::Once, - [this](ssvu::FT) + [this](float) { if (!mouseHovering) { @@ -936,43 +934,43 @@ void MenuGame::initInput() }); game.addInput( // hardcoded - {{k::Up}}, [this](ssvu::FT) { upAction(); }, t::Once); + {{k::Up}}, [this](float) { upAction(); }, t::Once); - addTidInput(Tid::Up, t::Once, [this](ssvu::FT) { upAction(); }); + addTidInput(Tid::Up, t::Once, [this](float) { upAction(); }); game.addInput( // hardcoded - {{k::Down}}, [this](ssvu::FT) { downAction(); }, t::Once); + {{k::Down}}, [this](float) { downAction(); }, t::Once); - addTidInput(Tid::Down, t::Once, [this](ssvu::FT) { downAction(); }); + addTidInput(Tid::Down, t::Once, [this](float) { downAction(); }); addTidInput( - Tid::NextPack, t::Once, [this](ssvu::FT) { changePackAction(1); }); + Tid::NextPack, t::Once, [this](float) { changePackAction(1); }); addTidInput( - Tid::PreviousPack, t::Once, [this](ssvu::FT) { changePackAction(-1); }); + Tid::PreviousPack, t::Once, [this](float) { changePackAction(-1); }); add2StateInput(game, Config::getTrigger(Tid::Focus), focusHeld, static_cast(Tid::Focus)); game.addInput( // hardcoded - {{k::Enter}}, [this](ssvu::FT /*unused*/) { okAction(); }, t::Once); + {{k::Enter}}, [this](float /*unused*/) { okAction(); }, t::Once); game.addInput( // hardcoded {{k::Escape}}, - [this](ssvu::FT mFT) + [this](float mFT) { if (state != States::MOpts) { exitTimer += mFT; } }, - [this](ssvu::FT /*unused*/) { exitTimer = 0; }, t::Always); + [this](float /*unused*/) { exitTimer = 0; }, t::Always); game.addInput( // hardcoded - {{k::Escape}}, [this](ssvu::FT /*unused*/) { exitAction(); }, t::Once); + {{k::Escape}}, [this](float /*unused*/) { exitAction(); }, t::Once); addTidInput(Tid::Exit, t::Once, - [this](ssvu::FT /*unused*/) + [this](float /*unused*/) { if (isEnteringText()) { @@ -982,11 +980,11 @@ void MenuGame::initInput() }); // editable addTidInput(Tid::Screenshot, t::Once, - [this](ssvu::FT /*unused*/) { mustTakeScreenshot = true; }); + [this](float /*unused*/) { mustTakeScreenshot = true; }); game.addInput( {{k::LAlt, k::Enter}}, - [this](ssvu::FT /*unused*/) + [this](float /*unused*/) { Config::setFullscreen(window, !window.getFullscreen()); game.ignoreNextInputs(); @@ -995,24 +993,21 @@ void MenuGame::initInput() .setPriorityUser(-1000); game.addInput( // hardcoded - {{k::Backspace}}, [this](ssvu::FT /*unused*/) { eraseAction(); }, - t::Once); + {{k::Backspace}}, [this](float /*unused*/) { eraseAction(); }, t::Once); game.addInput( // hardcoded - {{k::F1}}, [this](ssvu::FT /*unused*/) { addRemoveFavoriteLevel(); }, + {{k::F1}}, [this](float /*unused*/) { addRemoveFavoriteLevel(); }, t::Once); game.addInput( // hardcoded - {{k::F2}}, - [this](ssvu::FT /*unused*/) { switchToFromFavoriteLevels(); }, t::Once); + {{k::F2}}, [this](float /*unused*/) { switchToFromFavoriteLevels(); }, + t::Once); game.addInput( // hardcoded - {{k::F3}}, [this](ssvu::FT /*unused*/) { reloadAssets(false); }, - t::Once); + {{k::F3}}, [this](float /*unused*/) { reloadAssets(false); }, t::Once); game.addInput( // hardcoded - {{k::F4}}, [this](ssvu::FT /*unused*/) { reloadAssets(true); }, - t::Once); + {{k::F4}}, [this](float /*unused*/) { reloadAssets(true); }, t::Once); } void MenuGame::runLuaFile(const std::string& mFileName) @@ -2504,7 +2499,7 @@ void MenuGame::exitAction() // //***************************************************** -void MenuGame::update(ssvu::FT mFT) +void MenuGame::update(float mFT) { hexagonClient.update(); @@ -3133,13 +3128,13 @@ void MenuGame::refreshCamera() w = getWindowWidth() * fmax; h = getWindowHeight() * fmax; - backgroundCamera.setView( - {ssvs::zeroVec2f, {Config::getSizeX() * Config::getZoomFactor(), - Config::getSizeY() * Config::getZoomFactor()}}); + backgroundCamera.setView({sf::Vector2f::Zero, + {Config::getSizeX() * Config::getZoomFactor(), + Config::getSizeY() * Config::getZoomFactor()}}); overlayCamera.setView(sf::View{sf::FloatRect({0, 0}, {w, h})}); - titleBar.setOrigin(ssvs::zeroVec2f); + titleBar.setOrigin(sf::Vector2f::Zero); titleBar.setScale({0.5f, 0.5f}); titleBar.setPosition({20.f, 20.f}); @@ -4169,7 +4164,7 @@ void MenuGame::drawLoadResults() { //-------------------------------------- // Hexagon - const float div{ssvu::tau / 6 * 0.5f}, hexagonRadius{100.f}; + const float div{Utils::tau / 6 * 0.5f}, hexagonRadius{100.f}; const sf::Vector2f centerPos = {w / 2.f, h / 5.f}; menuQuads.clear(); @@ -4179,14 +4174,14 @@ void MenuGame::drawLoadResults() { const float sAngle{div * 2.f * (i + hexagonRotation)}; - const sf::Vector2f nw{ - ssvs::getOrbitRad(centerPos, sAngle - div, hexagonRadius)}; - const sf::Vector2f ne{ - ssvs::getOrbitRad(centerPos, sAngle + div, hexagonRadius)}; - const sf::Vector2f se{ - ssvs::getOrbitRad(centerPos, sAngle + div, hexagonRadius + 10.f)}; - const sf::Vector2f sw{ - ssvs::getOrbitRad(centerPos, sAngle - div, hexagonRadius + 10.f)}; + const sf::Vector2f nw{centerPos.movedAndRotatedBy( + hexagonRadius, sf::radians(sAngle - div))}; + const sf::Vector2f ne{centerPos.movedAndRotatedBy( + hexagonRadius, sf::radians(sAngle + div))}; + const sf::Vector2f se{centerPos.movedAndRotatedBy( + hexagonRadius + 10.f, sf::radians(sAngle + div))}; + const sf::Vector2f sw{centerPos.movedAndRotatedBy( + hexagonRadius + 10.f, sf::radians(sAngle - div))}; menuQuads.batch_unsafe_emplace_back_quad( sf::Color::White, nw, sw, se, ne); @@ -4573,7 +4568,7 @@ void MenuGame::quickPackFoldStretch() adjustLevelsOffset(); } -void MenuGame::scrollLevelListToTargetY(ssvu::FT mFT) +void MenuGame::scrollLevelListToTargetY(float mFT) { if (std::abs(lvlDrawer->YOffset - lvlDrawer->YScrollTo) <= Utils::epsilon) { @@ -5775,7 +5770,7 @@ void MenuGame::draw() { menuBackgroundTris.clear(); - styleData.drawBackgroundMenu(menuBackgroundTris, ssvs::zeroVec2f, + styleData.drawBackgroundMenu(menuBackgroundTris, sf::Vector2f::Zero, levelStatus.sides, Config::getDarkenUnevenBackgroundChunk() && levelStatus.darkenUnevenBackgroundChunk, diff --git a/src/SSVOpenHexagon/Core/main.cpp b/src/SSVOpenHexagon/Core/main.cpp index e1cfd536..09db5015 100644 --- a/src/SSVOpenHexagon/Core/main.cpp +++ b/src/SSVOpenHexagon/Core/main.cpp @@ -36,10 +36,7 @@ #include #include #include -#include #include -#include -#include #include // diff --git a/src/SSVOpenHexagon/Data/LevelData.cpp b/src/SSVOpenHexagon/Data/LevelData.cpp index 8e5b7aca..ef33c265 100644 --- a/src/SSVOpenHexagon/Data/LevelData.cpp +++ b/src/SSVOpenHexagon/Data/LevelData.cpp @@ -8,9 +8,9 @@ #include "SSVOpenHexagon/Utils/LevelValidator.hpp" #include "SSVOpenHexagon/Utils/Concat.hpp" +#include #include #include -#include namespace hg { diff --git a/src/SSVOpenHexagon/Data/StyleData.cpp b/src/SSVOpenHexagon/Data/StyleData.cpp index f52c7057..8e4fb080 100644 --- a/src/SSVOpenHexagon/Data/StyleData.cpp +++ b/src/SSVOpenHexagon/Data/StyleData.cpp @@ -6,14 +6,13 @@ #include "SSVOpenHexagon/Global/Assert.hpp" #include "SSVOpenHexagon/Utils/FastVertexVector.hpp" -#include "SSVOpenHexagon/Utils/Match.hpp" +#include "SSVOpenHexagon/Utils/Math.hpp" #include "SSVOpenHexagon/Utils/Color.hpp" #include "SSVOpenHexagon/SSVUtilsJson/SSVUtilsJson.hpp" #include "SSVOpenHexagon/Global/UtilsJson.hpp" #include -#include #include namespace hg { @@ -120,7 +119,7 @@ sf::Color StyleData::calculateColor(const float mCurrentHue, Utils::componentClamp(color.a + mColorData.pulse.a * mPulseFactor)); } -void StyleData::update(ssvu::FT mFT, float mMult) +void StyleData::update(float mFT, float mMult) { currentSwapTime += mFT * mMult; if (currentSwapTime > maxSwapTime) @@ -200,7 +199,7 @@ void StyleData::drawBackgroundImpl(Utils::FastVertexVectorTris& vertices, const sf::Vector2f& mCenterPos, const unsigned int sides, const bool darkenUnevenBackgroundChunk, const bool blackAndWhite) const { - const float div{ssvu::tau / sides * 1.0001f}; + const float div{Utils::tau / sides * 1.0001f}; const float halfDiv{div / 2.f}; const float distance{bgTileRadius}; @@ -212,7 +211,7 @@ void StyleData::drawBackgroundImpl(Utils::FastVertexVectorTris& vertices, for (auto i(0u); i < sides; ++i) { - const float angle{ssvu::toRad(BGRotOff) + div * i}; + const float angle{Utils::toRad(BGRotOff) + div * i}; sf::Color currentColor{ssvu::getByModIdx(colors, i)}; const bool mustDarkenUnevenBackgroundChunk = @@ -228,8 +227,10 @@ void StyleData::drawBackgroundImpl(Utils::FastVertexVectorTris& vertices, } vertices.batch_unsafe_emplace_back(currentColor, mCenterPos, - ssvs::getOrbitRad(mCenterPos, angle + halfDiv, distance), - ssvs::getOrbitRad(mCenterPos, angle - halfDiv, distance)); + mCenterPos.movedAndRotatedBy( + distance, sf::radians(angle + halfDiv)), + mCenterPos.movedAndRotatedBy( + distance, sf::radians(angle - halfDiv))); } } @@ -238,7 +239,7 @@ void StyleData::drawBackgroundMenuHexagonImpl( const unsigned int sides, const bool fourByThree, const bool blackAndWhite) const { - const float div{ssvu::tau / sides * 1.0001f}; + const float div{Utils::tau / sides * 1.0001f}; const float halfDiv{div / 2.f}; const float hexagonRadius{fourByThree ? 75.f : 100.f}; @@ -249,17 +250,19 @@ void StyleData::drawBackgroundMenuHexagonImpl( for (auto i(0u); i < sides; ++i) { - const float angle{ssvu::toRad(BGRotOff) + div * i}; + const float angle{Utils::toRad(BGRotOff) + div * i}; vertices.batch_unsafe_emplace_back(colorMain, mCenterPos, - ssvs::getOrbitRad( - mCenterPos, angle + halfDiv, hexagonRadius + 10.f), - ssvs::getOrbitRad( - mCenterPos, angle - halfDiv, hexagonRadius + 10.f)); + mCenterPos.movedAndRotatedBy( + hexagonRadius + 10.f, sf::radians(angle + halfDiv)), + mCenterPos.movedAndRotatedBy( + hexagonRadius + 10.f, sf::radians(angle - halfDiv))); vertices.batch_unsafe_emplace_back(colorCap, mCenterPos, - ssvs::getOrbitRad(mCenterPos, angle + halfDiv, hexagonRadius), - ssvs::getOrbitRad(mCenterPos, angle - halfDiv, hexagonRadius)); + mCenterPos.movedAndRotatedBy( + hexagonRadius, sf::radians(angle + halfDiv)), + mCenterPos.movedAndRotatedBy( + hexagonRadius, sf::radians(angle - halfDiv))); } } diff --git a/src/SSVOpenHexagon/Global/AssetStorage.cpp b/src/SSVOpenHexagon/Global/AssetStorage.cpp index 47c7359d..4043bc36 100644 --- a/src/SSVOpenHexagon/Global/AssetStorage.cpp +++ b/src/SSVOpenHexagon/Global/AssetStorage.cpp @@ -51,7 +51,7 @@ class AssetStorage::AssetStorageImpl [[nodiscard]] bool loadFont(const std::string& id, const std::string& path) { - std::optional font = sf::Font::loadFromFile(path); + std::optional font = sf::Font::openFromFile(path); if (!font.has_value()) { diff --git a/src/SSVOpenHexagon/Global/Assets.cpp b/src/SSVOpenHexagon/Global/Assets.cpp index a71c6af1..88b3fb1a 100644 --- a/src/SSVOpenHexagon/Global/Assets.cpp +++ b/src/SSVOpenHexagon/Global/Assets.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include diff --git a/src/SSVOpenHexagon/Global/Instantiations.cpp b/src/SSVOpenHexagon/Global/Instantiations.cpp index 7a210583..ce3d0cc6 100644 --- a/src/SSVOpenHexagon/Global/Instantiations.cpp +++ b/src/SSVOpenHexagon/Global/Instantiations.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/src/SSVOpenHexagon/Utils/Geometry.cpp b/src/SSVOpenHexagon/Utils/Geometry.cpp index 4489493c..a755c7ef 100644 --- a/src/SSVOpenHexagon/Utils/Geometry.cpp +++ b/src/SSVOpenHexagon/Utils/Geometry.cpp @@ -4,8 +4,6 @@ #include "SSVOpenHexagon/Utils/Geometry.hpp" -#include - #include #include @@ -60,7 +58,7 @@ namespace hg::Utils { case 1u: mIntersection = v1; return true; case 2u: - if (ssvs::getMagSquared(v1 - mPos) > ssvs::getMagSquared(v2 - mPos)) + if ((v1 - mPos).lengthSq() > (v2 - mPos).lengthSq()) { mIntersection = v2; } diff --git a/src/SSVOpenHexagon/Utils/LuaWrapper.cpp b/src/SSVOpenHexagon/Utils/LuaWrapper.cpp index 683a66b8..0085b013 100644 --- a/src/SSVOpenHexagon/Utils/LuaWrapper.cpp +++ b/src/SSVOpenHexagon/Utils/LuaWrapper.cpp @@ -219,6 +219,20 @@ catch (...) throw; } +void* LuaContext::callbackCallImpl(lua_State* lua) +{ + // this function is called when the lua script tries to call our + // custom data type + // what we do is we simply call the function + SSVOH_ASSERT(lua_gettop(lua) >= 1); + SSVOH_ASSERT(lua_isuserdata(lua, 1)); + + auto function = lua_touserdata(lua, 1); + + SSVOH_ASSERT(function); + return function; +} + void LuaContext::_load(std::istream& code) { diff --git a/src/SSVOpenHexagon/Utils/Ticker.cpp b/src/SSVOpenHexagon/Utils/Ticker.cpp index 91f0b2e1..3c8c7036 100644 --- a/src/SSVOpenHexagon/Utils/Ticker.cpp +++ b/src/SSVOpenHexagon/Utils/Ticker.cpp @@ -6,11 +6,11 @@ namespace hg { -Ticker::Ticker(ssvu::FT mTarget, bool mRunning) noexcept +Ticker::Ticker(float mTarget, bool mRunning) noexcept : target{mTarget}, running{mRunning} {} -bool Ticker::update(ssvu::FT mFT) noexcept +bool Ticker::update(float mFT) noexcept { const float increment = mFT * static_cast(running); @@ -28,7 +28,7 @@ bool Ticker::update(ssvu::FT mFT) noexcept return true; } -bool Ticker::update(ssvu::FT mFT, ssvu::FT mTarget) noexcept +bool Ticker::update(float mFT, float mTarget) noexcept { target = mTarget; return update(mFT); @@ -56,7 +56,7 @@ void Ticker::restart() noexcept resume(); } -void Ticker::restart(ssvu::FT mTarget) noexcept +void Ticker::restart(float mTarget) noexcept { target = mTarget; restart(); @@ -99,17 +99,17 @@ void Ticker::setLoop(bool mX) noexcept return running; } -[[nodiscard]] ssvu::FT Ticker::getTarget() const noexcept +[[nodiscard]] float Ticker::getTarget() const noexcept { return target; } -[[nodiscard]] ssvu::FT Ticker::getCurrent() const noexcept +[[nodiscard]] float Ticker::getCurrent() const noexcept { return current; } -[[nodiscard]] ssvu::FT Ticker::getTotal() const noexcept +[[nodiscard]] float Ticker::getTotal() const noexcept { return total; } diff --git a/src/SSVOpenHexagon/Utils/Timeline2.cpp b/src/SSVOpenHexagon/Utils/Timeline2.cpp index a967d714..74f89bab 100644 --- a/src/SSVOpenHexagon/Utils/Timeline2.cpp +++ b/src/SSVOpenHexagon/Utils/Timeline2.cpp @@ -4,15 +4,11 @@ #include "SSVOpenHexagon/Utils/Timeline2.hpp" -#include "SSVOpenHexagon/Utils/Match.hpp" #include "SSVOpenHexagon/Global/Assert.hpp" +#include "SSVOpenHexagon/Utils/TinyVariant.hpp" -#include -#include -#include #include #include -#include namespace hg::Utils { @@ -21,14 +17,11 @@ void timeline2::clear() _actions.clear(); } -void timeline2::append_do(const std::function& func) -{ - _actions.emplace_back(action_do{func}); -} void timeline2::append_wait_for(const duration d) { - _actions.emplace_back(action_wait_for{d}); + _actions.emplace_back( + vittorioromeo::impl::tinyvariant_inplace_type_t{}, d); } void timeline2::append_wait_for_seconds(const double s) @@ -43,12 +36,9 @@ void timeline2::append_wait_for_sixths(const double s) void timeline2::append_wait_until(const time_point tp) { - _actions.emplace_back(action_wait_until{tp}); -} - -void timeline2::append_wait_until_fn(const std::function& tp_fn) -{ - _actions.emplace_back(action_wait_until_fn{tp_fn}); + _actions.emplace_back( + vittorioromeo::impl::tinyvariant_inplace_type_t{}, + tp); } [[nodiscard]] std::size_t timeline2::size() const noexcept @@ -76,14 +66,13 @@ timeline2_runner::outcome timeline2_runner::update( { timeline2::action& a = timeline.action_at(_current_idx); - const outcome o = match( - a._inner, // - [&](const timeline2::action_do& x) + const outcome o = a.linear_match( + [&](timeline2::action_do& x) { x._func(); return outcome::proceed; }, - [&](const timeline2::action_wait_for& x) + [&](timeline2::action_wait_for& x) { if (!_wait_start_tp.has_value()) { @@ -102,7 +91,7 @@ timeline2_runner::outcome timeline2_runner::update( _wait_start_tp.reset(); return outcome::proceed; }, - [&](const timeline2::action_wait_until& x) + [&](timeline2::action_wait_until& x) { if (tp < x._time_point) { @@ -113,7 +102,7 @@ timeline2_runner::outcome timeline2_runner::update( // Finished waiting. return outcome::proceed; }, // - [&](const timeline2::action_wait_until_fn& x) + [&](timeline2::action_wait_until_fn& x) { if (tp < x._time_point_fn()) { diff --git a/src/SSVOpenHexagon/Utils/Utils.cpp b/src/SSVOpenHexagon/Utils/Utils.cpp index 439cb222..c2503c1d 100644 --- a/src/SSVOpenHexagon/Utils/Utils.cpp +++ b/src/SSVOpenHexagon/Utils/Utils.cpp @@ -3,6 +3,7 @@ // AFL License page: https://opensource.org/licenses/AFL-3.0 #include "SSVOpenHexagon/Utils/Utils.hpp" +#include "SSVOpenHexagon/Utils/LuaWrapper.hpp" #include "SSVOpenHexagon/Global/Assets.hpp" #include "SSVOpenHexagon/Utils/ScopeGuard.hpp" @@ -20,6 +21,7 @@ #include #include #include +#include namespace hg::Utils { @@ -244,4 +246,50 @@ void withDependencyShaderFilename( "Shaders", execScriptPackPathContext, currentPackPath, mShaderName); } +template +T runLuaFunction( + Lua::LuaContext& mLua, std::string_view mName, const TArgs&... mArgs) +{ + return mLua.callLuaFunction(mName, std::make_tuple(mArgs...)); +} + +template +std::optional> runLuaFunctionIfExists( + Lua::LuaContext& mLua, std::string_view mName, const TArgs&... mArgs) +{ + using Ret = std::optional>; + + if (!mLua.doesVariableExist(mName)) + { + return Ret{}; + } + + if constexpr (isSameType) + { + runLuaFunction(mLua, mName, mArgs...); + return Ret{Nothing{}}; + } + else + { + return Ret{runLuaFunction(mLua, mName, mArgs...)}; + } +} + +template void runLuaFunction(Lua::LuaContext&, std::string_view); + +template std::optional> runLuaFunctionIfExists( + Lua::LuaContext&, std::string_view); + +template std::optional> +runLuaFunctionIfExists( + Lua::LuaContext&, std::string_view, const float&); + +template std::optional> +runLuaFunctionIfExists( + Lua::LuaContext&, std::string_view, const float&, const float&); + +template std::optional> +runLuaFunctionIfExists(Lua::LuaContext&, + std::string_view, const float&, const int&, const bool&, const bool&); + } // namespace hg::Utils