Merge branch 'Time-Signature-Changes' into new-conductor
# Conflicts: # .gitignore # source/funkin/backend/FunkinSprite.hx # source/funkin/backend/chart/ChartData.hx # source/funkin/backend/chart/EventsData.hx # source/funkin/backend/system/Conductor.hx # source/funkin/backend/utils/CoolUtil.hx # source/funkin/editors/charter/Charter.hx # source/funkin/editors/charter/CharterEvent.hx # source/funkin/editors/charter/CharterEventScreen.hx # source/funkin/editors/charter/CharterMetaDataScreen.hx # source/funkin/editors/charter/SongCreationScreen.hx # source/funkin/game/PlayState.hx
This commit is contained in:
@@ -443,7 +443,7 @@ class CoolUtil
|
||||
}
|
||||
|
||||
var bpm:Null<Float> = Std.parseFloat(musicInfo["BPM"]).getDefault(DefaultBPM);
|
||||
Conductor.changeBPM(bpm, beatsPerMeasure, stepsPerBeat);
|
||||
Conductor.changeBPM(bpm, beatsPerMeasure, floorInt(stepsPerBeat));
|
||||
} else
|
||||
Conductor.changeBPM(DefaultBPM);
|
||||
}
|
||||
@@ -781,6 +781,15 @@ class CoolUtil
|
||||
@:noUsing public static inline function maxInt(p1:Int, p2:Int)
|
||||
return p1 < p2 ? p2 : p1;
|
||||
|
||||
/**
|
||||
* Equivalent of `Math.min`, except doesn't require a Int -> Float -> Int conversion.
|
||||
* @param p1
|
||||
* @param p2
|
||||
* @return return p1 > p2 ? p2 : p1
|
||||
*/
|
||||
@:noUsing public static inline function minInt(p1:Int, p2:Int)
|
||||
return p1 > p2 ? p2 : p1;
|
||||
|
||||
/**
|
||||
* Equivalent of `Math.floor`, except doesn't require a Int -> Float -> Int conversion.
|
||||
* @param e Value to get the floor of.
|
||||
@@ -880,6 +889,36 @@ class CoolUtil
|
||||
return file.file;
|
||||
}
|
||||
|
||||
public static inline function bound(Value:Float, Min:Float, Max:Float):Float {
|
||||
#if cpp
|
||||
var _hx_tmp1:Float = Value;
|
||||
var _hx_tmp2:Float = Min;
|
||||
var _hx_tmp3:Float = Max;
|
||||
return untyped __cpp__("((({0}) < ({1})) ? ({1}) : (({0}) > ({2})) ? ({2}) : ({0}))", _hx_tmp1, _hx_tmp2, _hx_tmp3);
|
||||
#else
|
||||
return (Value < Min) ? Min : (Value > Max) ? Max : Value;
|
||||
#end
|
||||
}
|
||||
|
||||
public static inline function boundInt(Value:Int, Min:Int, Max:Int):Int {
|
||||
#if cpp
|
||||
var _hx_tmp1:Int = Value;
|
||||
var _hx_tmp2:Int = Min;
|
||||
var _hx_tmp3:Int = Max;
|
||||
return untyped __cpp__("((({0}) < ({1})) ? ({1}) : (({0}) > ({2})) ? ({2}) : ({0}))", _hx_tmp1, _hx_tmp2, _hx_tmp3);
|
||||
#else
|
||||
return (Value < Min) ? Min : (Value > Max) ? Max : Value;
|
||||
#end
|
||||
}
|
||||
|
||||
public static inline function boolToInt(b:Bool):Int {
|
||||
#if cpp
|
||||
return untyped __cpp__("(({0}) ? 1 : 0)", b);
|
||||
#else
|
||||
return b ? 1 : 0;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string of "1..3,5,7..9,8..5" into an array of numbers like [1,2,3,5,7,8,9,8,7,6,5]
|
||||
* @param input String to parse
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package funkin.backend.utils;
|
||||
|
||||
final class MathUtil {
|
||||
//Remind me to add the descriptions for the Wiki later - sen
|
||||
public static inline function lessThan(aVal:Float, bVal:Float, diff:Float = FlxMath.EPSILON):Bool {
|
||||
return aVal < bVal - diff;
|
||||
}
|
||||
|
||||
public static inline function lessThanEqual(aVal:Float, bVal:Float, diff:Float = FlxMath.EPSILON):Bool {
|
||||
return aVal <= bVal + diff;
|
||||
}
|
||||
|
||||
public static inline function greaterThan(aVal:Float, bVal:Float, diff:Float = FlxMath.EPSILON):Bool {
|
||||
return aVal > bVal + diff;
|
||||
}
|
||||
|
||||
public static inline function greaterThanEqual(aVal:Float, bVal:Float, diff:Float = FlxMath.EPSILON):Bool {
|
||||
return aVal >= bVal - diff;
|
||||
}
|
||||
|
||||
public static inline function equal(aVal:Float, bVal:Float, diff:Float = FlxMath.EPSILON):Bool {
|
||||
return Math.abs(aVal - bVal) <= diff;
|
||||
}
|
||||
|
||||
public static inline function notEqual(aVal:Float, bVal:Float, diff:Float = FlxMath.EPSILON):Bool {
|
||||
return Math.abs(aVal - bVal) > diff;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user