X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Futil.qh;h=8abd36ece058ad5aab4e9a8499141a462722833b;hp=050bb2b4f85a8cc7757b1f7ce987bfa84ee07393;hb=cfdec7de4f6fff90a2142be820eaeb43a5f7f572;hpb=385f53e7ad57423222659adc7d8e5e30489f8880 diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 050bb2b4f8..8abd36ece0 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -322,6 +322,18 @@ void queue_to_execute_next_frame(string s); // for marking written-to values as unused where it's a good idea to do this noref float unused_float; +// a function f with: +// f(0) = 0 +// f(1) = 1 +// f'(0) = startspeedfactor +// f'(1) = endspeedfactor +float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x); + +// checks whether f'(x) = 0 anywhere from 0 to 1 +// because if this is the case, the function is not usable for platforms +// as it may exceed 0..1 bounds, or go in reverse +float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor); + #ifndef MENUQC vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle) #endif