diff --git a/project.xml b/project.xml
index 26c15e0c..8e87bdcd 100644
--- a/project.xml
+++ b/project.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/source/funkin/backend/system/updating/UpdateAvailableScreen.hx b/source/funkin/backend/system/updating/UpdateAvailableScreen.hx
index 8814dcec..c788cdf9 100644
--- a/source/funkin/backend/system/updating/UpdateAvailableScreen.hx
+++ b/source/funkin/backend/system/updating/UpdateAvailableScreen.hx
@@ -100,7 +100,7 @@ class UpdateAvailableScreen extends MusicBeatState {
public override function update(elapsed:Float) {
super.update(elapsed);
- destY = FlxMath.bound(destY - (FlxG.mouse.wheel * 75), 0, Math.max(0, changeLogText.height - FlxG.height + versionCheckBG.height + 20 + optionsBG.height));
+ destY = CoolUtil.bound(destY - (FlxG.mouse.wheel * 75), 0, Math.max(0, changeLogText.height - FlxG.height + versionCheckBG.height + 20 + optionsBG.height));
FlxG.camera.scroll.y = lerp(FlxG.camera.scroll.y, destY, 1/3);
if (controls.LEFT_P || controls.RIGHT_P) {
diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx
index 1620e53a..4d25ce74 100644
--- a/source/funkin/backend/utils/CoolUtil.hx
+++ b/source/funkin/backend/utils/CoolUtil.hx
@@ -316,7 +316,7 @@ class CoolUtil
* @return FPS-Modified Ratio
*/
@:noUsing public static inline function getFPSRatio(ratio:Float):Float {
- return FlxMath.bound(ratio * 60 * FlxG.elapsed, 0, 1);
+ return CoolUtil.bound(ratio * 60 * FlxG.elapsed, 0.0, 1.0);
}
/**
* Tries to get a color from a `Dynamic` variable.
@@ -461,6 +461,23 @@ class CoolUtil
* @return Array Final array
*/
@:noUsing public static inline function numberArray(max:Int, ?min:Int = 0):Array
+ {
+ /*return [for (i in min...max) i];*/
+ // Reason for change:
+ // Old one uses push instead of creating an array with the wanted size.
+ var len:Int = CoolUtil.maxInt(max - min, 0);
+ #if cpp
+ var arr:Array = untyped __cpp__("::Array_obj< int >::__new({0})", len);
+ #else
+ var arr:Array = [];
+ arr.resize(len);
+ #end
+ for(i in 0...len)
+ arr[i] = i + min;
+ return arr;
+ }
+
+ @:noUsing public static inline function numberArrayOld(max:Int, ?min:Int = 0):Array
{
return [for (i in min...max) i];
}
@@ -565,7 +582,6 @@ class CoolUtil
case Y:
obj.y = (cam.height - obj.height) / 2;
case NONE:
-
}
}
@@ -587,8 +603,16 @@ class CoolUtil
* @param name Name of the attribute
*/
public static inline function getAtt(xml:Access, name:String) {
- if (!xml.has.resolve(name)) return null;
- return xml.att.resolve(name);
+ /*if (!xml.has.resolve(name)) return null;
+ return xml.att.resolve(name);*/
+ // Reason for change:
+ // Old one has error checking 4 times, this one has it once.
+ var xml:Xml = xml.x;
+ if (xml.nodeType != Element) {
+ throw 'Bad node type, expected Element but found ${xml.nodeType}';
+ }
+ @:privateAccess
+ return xml.attributeMap.exists(name) ? xml.attributeMap.get(name) : null;
}
/**
@@ -704,6 +728,8 @@ class CoolUtil
i--;
}
return i;*/
+ // Reason for change:
+ // Old one was made because at the time we didnt know the lastIndexOf function.
return array.lastIndexOf(element);
}
@@ -734,11 +760,7 @@ class CoolUtil
* @param url
*/
@:noUsing public static inline function openURL(url:String) {
- #if linux
- Sys.command('/usr/bin/xdg-open', [url, "&"]);
- #else
FlxG.openURL(url);
- #end
}
/**
@@ -766,6 +788,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.
@@ -835,6 +866,36 @@ class CoolUtil
return array.indexOf(element) != -1;
}
#end
+
+ 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
+ }
}
/**
diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx
index 9bef8da7..05ca5455 100644
--- a/source/funkin/editors/character/CharacterEditor.hx
+++ b/source/funkin/editors/character/CharacterEditor.hx
@@ -653,10 +653,10 @@ class CharacterEditor extends UIState {
var zoom(default, set):Float = 0;
var __camZoom(default, set):Float = 1;
function set_zoom(val:Float) {
- return zoom = FlxMath.bound(val, -3.5, 1.75); // makes zooming not lag behind when continuing scrolling
+ return zoom = CoolUtil.bound(val, -3.5, 1.75); // makes zooming not lag behind when continuing scrolling
}
function set___camZoom(val:Float) {
- return __camZoom = FlxMath.bound(val, 0.1, 3);
+ return __camZoom = CoolUtil.bound(val, 0.1, 3);
}
function _animation_play(_) {
diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx
index a04c3286..2aea7273 100644
--- a/source/funkin/editors/charter/Charter.hx
+++ b/source/funkin/editors/charter/Charter.hx
@@ -772,12 +772,12 @@ class Charter extends UIState {
selection.loop(function (n:CharterNote) {
n.snappedToStrumline = false;
n.setPosition(n.fullID * 40 + (mousePos.x - dragStartPos.x), n.step * 40 + (mousePos.y - dragStartPos.y));
- n.y = FlxMath.bound(n.y, 0, (__endStep*40) - n.height);
- n.x = FlxMath.bound(n.x, 0, ((strumLines.members.length * 4)-1) * 40);
+ n.y = CoolUtil.bound(n.y, 0, (__endStep*40) - n.height);
+ n.x = CoolUtil.bound(n.x, 0, ((strumLines.members.length * 4)-1) * 40);
n.cursor = HAND;
}, function (e:CharterEvent) {
e.y = e.step * 40 + (mousePos.y - dragStartPos.y) - 17;
- e.y = FlxMath.bound(e.y, -17, (__endStep*40)-17);
+ e.y = CoolUtil.bound(e.y, -17, (__endStep*40)-17);
e.cursor = HAND;
});
currentCursor = HAND;
@@ -844,7 +844,7 @@ class Charter extends UIState {
if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) {
var note = new CharterNote();
note.updatePos(
- FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1),
+ CoolUtil.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1),
id % 4, 0, noteType, strumLines.members[Std.int(id/4)]
);
notesGroup.add(note);
@@ -1212,7 +1212,7 @@ class Charter extends UIState {
}
var songLength = FlxG.sound.music.getDefault(vocals).length;
- Conductor.songPosition = FlxMath.bound(Conductor.songPosition + Conductor.songOffset, 0, songLength);
+ Conductor.songPosition = CoolUtil.bound(Conductor.songPosition + Conductor.songOffset, 0, songLength);
if (Conductor.songPosition >= songLength - Conductor.songOffset) {
FlxG.sound.music.pause();
@@ -1262,10 +1262,10 @@ class Charter extends UIState {
var zoom(default, set):Float = 0;
var __camZoom(default, set):Float = 1;
function set_zoom(val:Float) {
- return zoom = FlxMath.bound(val, -3.5, 1.75); // makes zooming not lag behind when continuing scrolling
+ return zoom = CoolUtil.bound(val, -3.5, 1.75); // makes zooming not lag behind when continuing scrolling
}
function set___camZoom(val:Float) {
- return __camZoom = FlxMath.bound(val, 0.1, 3);
+ return __camZoom = CoolUtil.bound(val, 0.1, 3);
}
// TOP MENU OPTIONS
@@ -1389,7 +1389,7 @@ class Charter extends UIState {
switch(c) {
case CNote(step, id, strumLineID, susLength, type):
var note = new CharterNote();
- note.updatePos(minStep + step, id, susLength, type, strumLines.members[Std.int(FlxMath.bound(strumLineID, 0, strumLines.length-1))]);
+ note.updatePos(minStep + step, id, susLength, type, strumLines.members[CoolUtil.boundInt(strumLineID, 0, strumLines.length-1)]);
notesGroup.add(note);
sObjects.push(note);
case CEvent(step, events):
@@ -1675,7 +1675,7 @@ class Charter extends UIState {
inline public function changeNoteType(?newID:Int, checkSelection:Bool = true) {
if(newID != null) noteType = newID;
- noteType = Std.int(FlxMath.bound(noteType, 0, noteTypes.length));
+ noteType = CoolUtil.boundInt(noteType, 0, noteTypes.length);
buildNoteTypesUI();
var changedNotes:{notes:Array, oldTypes:Array, newTypes:Array} = {notes:[], oldTypes:[], newTypes:[]};
diff --git a/source/funkin/editors/charter/CharterBackdropGroup.hx b/source/funkin/editors/charter/CharterBackdropGroup.hx
index bc49ab93..2ceab5be 100644
--- a/source/funkin/editors/charter/CharterBackdropGroup.hx
+++ b/source/funkin/editors/charter/CharterBackdropGroup.hx
@@ -68,7 +68,7 @@ class CharterBackdropGroup extends FlxTypedGroup {
grid.notesGroup.clear();
notesGroup.forEach((n) -> {
- var onStr:Bool = (n.snappedToStrumline ? n.strumLineID : Std.int(FlxMath.bound((n.x+n.width)/(40*4), 0, strumLineGroup.members.length-1))) == i;
+ var onStr:Bool = (n.snappedToStrumline ? n.strumLineID : CoolUtil.boundInt(Std.int((n.x+n.width)/(40*4)), 0, strumLineGroup.members.length-1)) == i;
if(n.exists && n.visible && onStr)
grid.notesGroup.add(n);
});
diff --git a/source/funkin/editors/charter/CharterEvent.hx b/source/funkin/editors/charter/CharterEvent.hx
index 92243689..a1a660f0 100644
--- a/source/funkin/editors/charter/CharterEvent.hx
+++ b/source/funkin/editors/charter/CharterEvent.hx
@@ -90,7 +90,7 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable {
}
public function handleDrag(change:FlxPoint) {
- var newStep:Float = step = FlxMath.bound(step + change.x, 0, Charter.instance.__endStep-1);
+ var newStep:Float = step = CoolUtil.bound(step + change.x, 0, Charter.instance.__endStep-1);
y = ((newStep) * 40) - 17;
}
diff --git a/source/funkin/editors/charter/CharterEventTypeSelection.hx b/source/funkin/editors/charter/CharterEventTypeSelection.hx
index bfa6cfe7..2b8edc1c 100644
--- a/source/funkin/editors/charter/CharterEventTypeSelection.hx
+++ b/source/funkin/editors/charter/CharterEventTypeSelection.hx
@@ -87,7 +87,7 @@ class CharterEventTypeSelection extends UISubstateWindow {
buttonCameras.y = -subCam.scroll.y + Std.int(windowSpr.y+41);
if (buttons.length > 16)
- buttonCameras.scroll.y = FlxMath.bound(buttonCameras.scroll.y - (buttonsBG.hovered ? FlxG.mouse.wheel : 0) * 12, 0,
+ buttonCameras.scroll.y = CoolUtil.bound(buttonCameras.scroll.y - (buttonsBG.hovered ? FlxG.mouse.wheel : 0) * 12, 0,
(buttons[buttons.length-1].y + buttons[buttons.length-1].bHeight) - buttonCameras.height);
upIndicator.setPosition((buttonsBG.bWidth/2) - (upIndicator.fieldWidth/2), 22 + (FlxMath.fastSin(sinner*2) * 4));
diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx
index 8d67adc2..bb7b5a61 100644
--- a/source/funkin/editors/charter/CharterNote.hx
+++ b/source/funkin/editors/charter/CharterNote.hx
@@ -173,8 +173,8 @@ class CharterNote extends UISprite implements ICharterSelectable {
}
public function handleDrag(change:FlxPoint) {
- var newStep = FlxMath.bound(step + change.x, 0, Charter.instance.__endStep-1);
- var newID:Int = Std.int(FlxMath.bound(fullID + Std.int(change.y), 0, (Charter.instance.strumLines.members.length*4)-1));
+ var newStep = CoolUtil.bound(step + change.x, 0, Charter.instance.__endStep-1);
+ var newID:Int = CoolUtil.boundInt(fullID + Std.int(change.y), 0, (Charter.instance.strumLines.members.length*4)-1);
updatePos(newStep, newID % 4, susLength, type, Charter.instance.strumLines.members[Std.int(newID/4)]);
}
diff --git a/source/funkin/editors/charter/CharterNoteHoverer.hx b/source/funkin/editors/charter/CharterNoteHoverer.hx
index e20000a2..ecd37edf 100644
--- a/source/funkin/editors/charter/CharterNoteHoverer.hx
+++ b/source/funkin/editors/charter/CharterNoteHoverer.hx
@@ -18,7 +18,7 @@ class CharterNoteHoverer extends CharterNote {
case NONE:
var inBoundsY:Bool = (__mousePos.y > 0 && __mousePos.y < (Charter.instance.__endStep)*40);
if ((__mousePos.x > 0 && __mousePos.x < Charter.instance.gridBackdrops.strumlinesAmount * 160 && inBoundsY) && showHoverer) {
- step = FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((__mousePos.y-20) / 40) : Charter.instance.quantStep(__mousePos.y/40), 0, Charter.instance.__endStep-1);
+ step = CoolUtil.bound(FlxG.keys.pressed.SHIFT ? ((__mousePos.y-20) / 40) : Charter.instance.quantStep(__mousePos.y/40), 0, Charter.instance.__endStep-1);
id = Math.floor(__mousePos.x / 40); y = step * 40; x = id * 40; visible = true; sustainSpr.visible = typeText.visible = false;
angle = switch(animation.curAnim.curFrame = (id % 4)) {
case 0: -90;
@@ -53,8 +53,8 @@ class CharterNoteHoverer extends CharterNote {
y -= ((draggingNote.step + verticalChange)
- Charter.instance.quantStepRounded(draggingNote.step+verticalChange, verticalChange > 0 ? 0.35 : 0.65));
y *= 40;
- var newID:Int = Std.int(FlxMath.bound(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*4)-1));
- x = (id=newID) * 40; y = FlxMath.bound(y, 0, (Charter.instance.__endStep*40) - height);
+ var newID:Int = CoolUtil.boundInt(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*4)-1);
+ x = (id=newID) * 40; y = CoolUtil.bound(y, 0, (Charter.instance.__endStep*40) - height);
angle = switch(animation.curAnim.curFrame = (draggingNote.id % 4)) {
case 0: -90;
diff --git a/source/funkin/editors/charter/CharterStrumLineGroup.hx b/source/funkin/editors/charter/CharterStrumLineGroup.hx
index 296cffaa..e10e45b3 100644
--- a/source/funkin/editors/charter/CharterStrumLineGroup.hx
+++ b/source/funkin/editors/charter/CharterStrumLineGroup.hx
@@ -40,7 +40,7 @@ class CharterStrumLineGroup extends FlxTypedGroup {
Charter.instance.eventsBackdrop.x = members[0].button.x - Charter.instance.eventsBackdrop.width;
if (Charter.instance.strumlineLockButton != null && members[0] != null)
Charter.instance.strumlineLockButton.x = members[0].x - (40*4);
- if (Charter.instance.strumlineAddButton != null && members[Std.int(Math.max(0, members.length-1))] != null)
+ if (Charter.instance.strumlineAddButton != null && members[CoolUtil.maxInt(0, members.length-1)] != null)
Charter.instance.strumlineAddButton.x = members[members.length-1].x + (40*4);
if ((FlxG.mouse.justReleased || !draggable) && isDragging)
diff --git a/source/funkin/editors/stage/StageEditor.hx b/source/funkin/editors/stage/StageEditor.hx
index 600c31f2..b47b2819 100644
--- a/source/funkin/editors/stage/StageEditor.hx
+++ b/source/funkin/editors/stage/StageEditor.hx
@@ -862,10 +862,10 @@ class StageEditor extends UIState {
var zoom(default, set):Float = 0;
var __camZoom(default, set):Float = 1;
function set_zoom(val:Float) {
- return zoom = FlxMath.bound(val, -3.5, 1.75); // makes zooming not lag behind when continuing scrolling
+ return zoom = CoolUtil.bound(val, -3.5, 1.75); // makes zooming not lag behind when continuing scrolling
}
function set___camZoom(val:Float) {
- return __camZoom = FlxMath.bound(val, 0.1, 3);
+ return __camZoom = CoolUtil.bound(val, 0.1, 3);
}
function _view_zoomin(_) {
@@ -1087,10 +1087,10 @@ class StageEditor extends UIState {
var prevMode = mouseMode;
if(FlxG.mouse.justPressed) {
for (i in StageEditorMouseMode.SKEW_TOP...(StageEditorMouseMode.SKEW_BOTTOM + 1)) {
- var cappedI1 = Math.max(i - StageEditorMouseMode.SKEW_TOP - 1, 0);
- var cappedI2 = Math.min(i - StageEditorMouseMode.SKEW_TOP + 1, 3);
- var point1 = buttonBoxes[Std.int(cappedI1)];
- var point2 = buttonBoxes[Std.int(cappedI2)];
+ var cappedI1 = CoolUtil.maxInt(i - StageEditorMouseMode.SKEW_TOP - 1, 0);
+ var cappedI2 = CoolUtil.minInt(i - StageEditorMouseMode.SKEW_TOP + 1, 3);
+ var point1 = buttonBoxes[cappedI1];
+ var point2 = buttonBoxes[cappedI2];
if (checkLine(point1, point2, point2.x - point1.x, point2.y - point1.y)) {
mousePoint.copyTo(clickPoint);
storedPos.set(sprite.x, sprite.y);
diff --git a/source/funkin/editors/ui/UIButtonList.hx b/source/funkin/editors/ui/UIButtonList.hx
index 3d71997a..6389f1a7 100644
--- a/source/funkin/editors/ui/UIButtonList.hx
+++ b/source/funkin/editors/ui/UIButtonList.hx
@@ -107,7 +107,7 @@ class UIButtonList extends UIWindow {
super.update(elapsed);
- nextscrollY = FlxMath.bound(nextscrollY - (hovered ? FlxG.mouse.wheel : 0) * 12, -buttonSpacing, Math.max((addButton.y + 32 + (buttonSpacing*1.5)) - buttonCameras.height, -buttonSpacing));
+ nextscrollY = CoolUtil.bound(nextscrollY - (hovered ? FlxG.mouse.wheel : 0) * 12, -buttonSpacing, Math.max((addButton.y + 32 + (buttonSpacing*1.5)) - buttonCameras.height, -buttonSpacing));
if (curMoving != null && dragging) {
nextscrollY -= Math.min((bHeight - 100) - FlxG.mouse.getWorldPosition(buttonCameras).y, 0) / 8;
diff --git a/source/funkin/editors/ui/UIColorwheel.hx b/source/funkin/editors/ui/UIColorwheel.hx
index 5739e7f3..80a6041a 100644
--- a/source/funkin/editors/ui/UIColorwheel.hx
+++ b/source/funkin/editors/ui/UIColorwheel.hx
@@ -142,7 +142,7 @@ class UIColorwheel extends UISliceSprite {
if (selectedSprite != null) {
var spritePos:FlxPoint = selectedSprite.getScreenPosition(FlxPoint.get(), __lastDrawCameras[0]);
mousePos -= FlxPoint.weak(spritePos.x, spritePos.y);
- mousePos.set(FlxMath.bound(mousePos.x, 0, selectedSprite.width), FlxMath.bound(mousePos.y, 0, selectedSprite.height));
+ mousePos.set(CoolUtil.bound(mousePos.x, 0, selectedSprite.width), CoolUtil.bound(mousePos.y, 0, selectedSprite.height));
if (selectedSprite == colorSlider) updateColorSliderMouse(mousePos);
if (selectedSprite == colorPicker) updateColorPickerMouse(mousePos);
diff --git a/source/funkin/editors/ui/UINumericStepper.hx b/source/funkin/editors/ui/UINumericStepper.hx
index d871f3c5..ff640414 100644
--- a/source/funkin/editors/ui/UINumericStepper.hx
+++ b/source/funkin/editors/ui/UINumericStepper.hx
@@ -31,7 +31,7 @@ class UINumericStepper extends UITextBox {
private function set_value(v:Float) {
if (min != null && max != null) {
- v = FlxMath.bound(v, min, max);
+ v = CoolUtil.bound(v, min, max);
} else if (min != null) {
v = Math.max(v, min);
} else if (max != null) {
diff --git a/source/funkin/editors/ui/UIScrollBar.hx b/source/funkin/editors/ui/UIScrollBar.hx
index 570a0c56..b1463b99 100644
--- a/source/funkin/editors/ui/UIScrollBar.hx
+++ b/source/funkin/editors/ui/UIScrollBar.hx
@@ -45,7 +45,7 @@ class UIScrollBar extends UISprite {
if ((lastHovered || lastHoveredThumb) && FlxG.mouse.pressed) {
thumb.framesOffset = 18;
var mousePos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get());
- var yPos = FlxMath.bound(FlxMath.remapToRange(mousePos.y, y, y+height, -(size/2), length + size), 0, length);
+ var yPos = CoolUtil.bound(FlxMath.remapToRange(mousePos.y, y, y+height, -(size/2), length + size), 0, length);
if (yPos >= 0 && yPos < length) {
value = yPos;
if (onChange != null)
diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx
index 5869a08b..5a284a7a 100644
--- a/source/funkin/editors/ui/UISlider.hx
+++ b/source/funkin/editors/ui/UISlider.hx
@@ -106,7 +106,7 @@ class UISlider extends UISprite {
if (selectableHitbox.hovered && FlxG.mouse.pressed) {
var mousePos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get());
- __barProgress = FlxMath.bound(mousePos.x-x, 0, barWidth)/barWidth;
+ __barProgress = CoolUtil.bound(mousePos.x-x, 0, barWidth)/barWidth;
mousePos.put();
}
@@ -117,7 +117,7 @@ class UISlider extends UISprite {
visualProgress = FlxMath.lerp(visualProgress, __barProgress, 1/2.25);
progressbar.follow(this, progressCentered ? barWidth/2 : 0, (height-progressbar.height)/2);
- progressbar.scale.x = FlxMath.bound(visualProgress-(progressCentered?0.5:0),-1,1);
+ progressbar.scale.x = CoolUtil.bound(visualProgress-(progressCentered?0.5:0),-1,1);
progressbar.colorTransform.color = FlxColor.interpolate(progressbar.colorTransform.color, selectableHitbox.hovered ? 0xFF7F00BF : 0xFF67009B, 1/14);
selectableBar.follow(this, (visualProgress * barWidth) - (selectableBar.width/2), (height-selectableBar.height)/2); selectableBarHighlight.follow(selectableBar);
diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx
index 21e70a6e..e9c1bb35 100644
--- a/source/funkin/game/Note.hx
+++ b/source/funkin/game/Note.hx
@@ -282,7 +282,7 @@ class Note extends FlxSprite
}
if (!wasGoodHit) return;
- var t = FlxMath.bound((Conductor.songPosition - strumTime) / (height) * len, 0, 1);
+ var t = CoolUtil.bound((Conductor.songPosition - strumTime) / (height) * len, 0, 1);
var swagRect = this.clipRect == null ? new FlxRect() : this.clipRect;
swagRect.x = 0;
swagRect.y = t * frameHeight;
diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx
index 046f45f9..5137bb67 100644
--- a/source/funkin/game/PlayState.hx
+++ b/source/funkin/game/PlayState.hx
@@ -1195,7 +1195,7 @@ class PlayState extends MusicBeatState
iconP1.x = center - iconOffset;
iconP2.x = center - (iconP2.width - iconOffset);
- health = FlxMath.bound(health, 0, maxHealth);
+ health = CoolUtil.bound(health, 0, maxHealth);
iconP1.health = healthBar.percent / 100;
iconP2.health = 1 - (healthBar.percent / 100);
diff --git a/source/funkin/options/keybinds/KeybindsOptions.hx b/source/funkin/options/keybinds/KeybindsOptions.hx
index e4e7d26c..90783215 100644
--- a/source/funkin/options/keybinds/KeybindsOptions.hx
+++ b/source/funkin/options/keybinds/KeybindsOptions.hx
@@ -243,7 +243,7 @@ class KeybindsOptions extends MusicBeatSubstate {
var minH = FlxG.height / 2;
var maxH = alphabets.members[alphabets.length-1].y + alphabets.members[alphabets.length-1].height - (FlxG.height / 2);
if (minH < maxH)
- camFollow.setPosition(FlxG.width / 2, FlxMath.bound(alphabet.y + (alphabet.height / 2) - (35), minH, maxH));
+ camFollow.setPosition(FlxG.width / 2, CoolUtil.bound(alphabet.y + (alphabet.height / 2) - (35), minH, maxH));
else
camFollow.setPosition(FlxG.width / 2, FlxG.height / 2);
}
diff --git a/source/funkin/options/type/ArrayOption.hx b/source/funkin/options/type/ArrayOption.hx
index 40c4942c..573f6dd0 100644
--- a/source/funkin/options/type/ArrayOption.hx
+++ b/source/funkin/options/type/ArrayOption.hx
@@ -31,7 +31,7 @@ class ArrayOption extends OptionType {
var fieldValue = Reflect.field(parent, optionName);
if(fieldValue != null)
- this.currentSelection = Std.int(Math.max(0, options.indexOf(fieldValue)));
+ this.currentSelection = CoolUtil.maxInt(0, options.indexOf(fieldValue));
this.optionName = optionName;