From 953a7bce7edf289dd8d2a1a6c8ecd8105380c8da Mon Sep 17 00:00:00 2001 From: Silc 'Tokage' Renew Date: Fri, 15 Oct 2021 22:25:00 +0900 Subject: reimplement ping-pong --- core/variant/variant_utility.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/variant/variant_utility.cpp') diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp index 666b582e39..e89bdd4faa 100644 --- a/core/variant/variant_utility.cpp +++ b/core/variant/variant_utility.cpp @@ -275,6 +275,10 @@ struct VariantUtilityFunctions { return Math::wrapf(value, min, max); } + static inline double pingpong(double value, double length) { + return Math::pingpong(value, length); + } + static inline Variant max(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 2) { r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; @@ -1226,6 +1230,7 @@ void Variant::_register_variant_utility_functions() { FUNCBINDR(clampf, sarray("value", "min", "max"), Variant::UTILITY_FUNC_TYPE_MATH); FUNCBINDR(nearest_po2, sarray("value"), Variant::UTILITY_FUNC_TYPE_MATH); + FUNCBINDR(pingpong, sarray("value", "length"), Variant::UTILITY_FUNC_TYPE_MATH); // Random -- cgit v1.2.3