mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-22 15:48:08 -05:00
mer
This commit is contained in:
parent
fbfd8259a6
commit
a7cfae8545
26 changed files with 602 additions and 225 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ shitAudio/
|
||||||
node_modules/
|
node_modules/
|
||||||
package.json
|
package.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
.aider.*
|
||||||
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -1,6 +1,6 @@
|
||||||
[submodule "assets"]
|
[submodule "assets"]
|
||||||
path = assets
|
path = assets
|
||||||
url = https://github.com/FunkinCrew/funkin.assets
|
url = https://github.com/FunkinCrew/Funkin-Assets-secret
|
||||||
[submodule "art"]
|
[submodule "art"]
|
||||||
path = art
|
path = art
|
||||||
url = https://github.com/FunkinCrew/funkin.art
|
url = https://github.com/FunkinCrew/Funkin-Art-secret
|
||||||
|
|
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit 8dd51cde0b9a3730abe9f97d0f50365c396ca784
|
Subproject commit d7ecd602df733f0625763a2d7b6056f52147b9e6
|
18
hmm.json
18
hmm.json
|
@ -5,7 +5,7 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "2d83fa863ef0c1eace5f1cf67c3ac315d1a3a8a5",
|
"ref": "2d83fa863ef0c1eace5f1cf67c3ac315d1a3a8a5",
|
||||||
"url": "https://github.com/Aidan63/linc_discord-rpc"
|
"url": "https://github.com/FunkinCrew/linc_discord-rpc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "flixel",
|
"name": "flixel",
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
"name": "FlxPartialSound",
|
"name": "FlxPartialSound",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "f986332ba5ab02abd386ce662578baf04904604a",
|
"ref": "a1eab7b9bf507b87200a3341719054fe427f3b15",
|
||||||
"url": "https://github.com/FunkinCrew/FlxPartialSound.git"
|
"url": "https://github.com/FunkinCrew/FlxPartialSound.git"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -75,14 +75,14 @@
|
||||||
"name": "haxeui-core",
|
"name": "haxeui-core",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "0212d8fdfcafeb5f0d5a41e1ddba8ff21d0e183b",
|
"ref": "5dc4c933bdc029f6139a47962e3b8c754060f210",
|
||||||
"url": "https://github.com/haxeui/haxeui-core"
|
"url": "https://github.com/haxeui/haxeui-core"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "haxeui-flixel",
|
"name": "haxeui-flixel",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "63a906a6148958dbfde8c7b48d90b0693767fd95",
|
"ref": "57c1604d6b5174839d7e0e012a4dd5dcbfc129da",
|
||||||
"url": "https://github.com/haxeui/haxeui-flixel"
|
"url": "https://github.com/haxeui/haxeui-flixel"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
{
|
{
|
||||||
"name": "hxp",
|
"name": "hxp",
|
||||||
"type": "haxelib",
|
"type": "haxelib",
|
||||||
"version": "1.2.2"
|
"version": "1.3.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "json2object",
|
"name": "json2object",
|
||||||
|
@ -174,15 +174,15 @@
|
||||||
"name": "thx.core",
|
"name": "thx.core",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "22605ff44f01971d599641790d6bae4869f7d9f4",
|
"ref": "6240b6e136f7490d9298edbe8c1891374bd7cdf2",
|
||||||
"url": "https://github.com/FunkinCrew/thx.core"
|
"url": "https://github.com/fponticelli/thx.core"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "thx.semver",
|
"name": "thx.semver",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "cf8d213589a2c7ce4a59b0fdba9e8ff36bc029fa",
|
"ref": "bdb191fe7cf745c02a980749906dbf22719e200b",
|
||||||
"url": "https://github.com/FunkinCrew/thx.semver"
|
"url": "https://github.com/fponticelli/thx.semver"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,8 +491,10 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
var promise:lime.app.Promise<Null<FunkinSound>> = new lime.app.Promise<Null<FunkinSound>>();
|
var promise:lime.app.Promise<Null<FunkinSound>> = new lime.app.Promise<Null<FunkinSound>>();
|
||||||
|
|
||||||
// split the path and get only after first :
|
// split the path and get only after first :
|
||||||
// we are bypassing the openfl/lime asset library fuss
|
// we are bypassing the openfl/lime asset library fuss on web only
|
||||||
|
#if web
|
||||||
path = Paths.stripLibrary(path);
|
path = Paths.stripLibrary(path);
|
||||||
|
#end
|
||||||
|
|
||||||
var soundRequest = FlxPartialSound.partialLoadFromFile(path, start, end);
|
var soundRequest = FlxPartialSound.partialLoadFromFile(path, start, end);
|
||||||
|
|
||||||
|
|
106
source/funkin/effects/RetroCameraFade.hx
Normal file
106
source/funkin/effects/RetroCameraFade.hx
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
package funkin.effects;
|
||||||
|
|
||||||
|
import flixel.util.FlxTimer;
|
||||||
|
import flixel.FlxCamera;
|
||||||
|
import openfl.filters.ColorMatrixFilter;
|
||||||
|
|
||||||
|
class RetroCameraFade
|
||||||
|
{
|
||||||
|
// im lazy, but we only use this for week 6
|
||||||
|
// and also sorta yoinked for djflixel, lol !
|
||||||
|
public static function fadeWhite(camera:FlxCamera, camSteps:Int = 5, time:Float = 1):Void
|
||||||
|
{
|
||||||
|
var steps:Int = 0;
|
||||||
|
var stepsTotal:Int = camSteps;
|
||||||
|
|
||||||
|
new FlxTimer().start(time / stepsTotal, _ -> {
|
||||||
|
var V:Float = (1 / stepsTotal) * steps;
|
||||||
|
if (steps == stepsTotal) V = 1;
|
||||||
|
|
||||||
|
var matrix = [
|
||||||
|
1, 0, 0, 0, V * 255,
|
||||||
|
0, 1, 0, 0, V * 255,
|
||||||
|
0, 0, 1, 0, V * 255,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
];
|
||||||
|
camera.filters = [new ColorMatrixFilter(matrix)];
|
||||||
|
steps++;
|
||||||
|
}, stepsTotal + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fadeFromWhite(camera:FlxCamera, camSteps:Int = 5, time:Float = 1):Void
|
||||||
|
{
|
||||||
|
var steps:Int = camSteps;
|
||||||
|
var stepsTotal:Int = camSteps;
|
||||||
|
|
||||||
|
var matrixDerp = [
|
||||||
|
1, 0, 0, 0, 1.0 * 255,
|
||||||
|
0, 1, 0, 0, 1.0 * 255,
|
||||||
|
0, 0, 1, 0, 1.0 * 255,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
];
|
||||||
|
camera.filters = [new ColorMatrixFilter(matrixDerp)];
|
||||||
|
|
||||||
|
new FlxTimer().start(time / stepsTotal, _ -> {
|
||||||
|
var V:Float = (1 / stepsTotal) * steps;
|
||||||
|
if (steps == stepsTotal) V = 1;
|
||||||
|
|
||||||
|
var matrix = [
|
||||||
|
1, 0, 0, 0, V * 255,
|
||||||
|
0, 1, 0, 0, V * 255,
|
||||||
|
0, 0, 1, 0, V * 255,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
];
|
||||||
|
camera.filters = [new ColorMatrixFilter(matrix)];
|
||||||
|
steps--;
|
||||||
|
}, camSteps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fadeToBlack(camera:FlxCamera, camSteps:Int = 5, time:Float = 1):Void
|
||||||
|
{
|
||||||
|
var steps:Int = 0;
|
||||||
|
var stepsTotal:Int = camSteps;
|
||||||
|
|
||||||
|
new FlxTimer().start(time / stepsTotal, _ -> {
|
||||||
|
var V:Float = (1 / stepsTotal) * steps;
|
||||||
|
if (steps == stepsTotal) V = 1;
|
||||||
|
|
||||||
|
var matrix = [
|
||||||
|
1, 0, 0, 0, -V * 255,
|
||||||
|
0, 1, 0, 0, -V * 255,
|
||||||
|
0, 0, 1, 0, -V * 255,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
];
|
||||||
|
camera.filters = [new ColorMatrixFilter(matrix)];
|
||||||
|
steps++;
|
||||||
|
}, camSteps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fadeBlack(camera:FlxCamera, camSteps:Int = 5, time:Float = 1):Void
|
||||||
|
{
|
||||||
|
var steps:Int = camSteps;
|
||||||
|
var stepsTotal:Int = camSteps;
|
||||||
|
|
||||||
|
var matrixDerp = [
|
||||||
|
1, 0, 0, 0, -1.0 * 255,
|
||||||
|
0, 1, 0, 0, -1.0 * 255,
|
||||||
|
0, 0, 1, 0, -1.0 * 255,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
];
|
||||||
|
camera.filters = [new ColorMatrixFilter(matrixDerp)];
|
||||||
|
|
||||||
|
new FlxTimer().start(time / stepsTotal, _ -> {
|
||||||
|
var V:Float = (1 / stepsTotal) * steps;
|
||||||
|
if (steps == stepsTotal) V = 1;
|
||||||
|
|
||||||
|
var matrix = [
|
||||||
|
1, 0, 0, 0, -V * 255,
|
||||||
|
0, 1, 0, 0, -V * 255,
|
||||||
|
0, 0, 1, 0, -V * 255,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
];
|
||||||
|
camera.filters = [new ColorMatrixFilter(matrix)];
|
||||||
|
steps--;
|
||||||
|
}, camSteps + 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,10 @@ import flixel.tweens.FlxTween;
|
||||||
import openfl.display3D.textures.TextureBase;
|
import openfl.display3D.textures.TextureBase;
|
||||||
import funkin.graphics.framebuffer.FixedBitmapData;
|
import funkin.graphics.framebuffer.FixedBitmapData;
|
||||||
import openfl.display.BitmapData;
|
import openfl.display.BitmapData;
|
||||||
|
import flixel.math.FlxRect;
|
||||||
|
import flixel.math.FlxPoint;
|
||||||
|
import flixel.graphics.frames.FlxFrame;
|
||||||
|
import flixel.FlxCamera;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An FlxSprite with additional functionality.
|
* An FlxSprite with additional functionality.
|
||||||
|
@ -269,6 +273,103 @@ class FunkinSprite extends FlxSprite
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:access(flixel.FlxCamera)
|
||||||
|
override function getBoundingBox(camera:FlxCamera):FlxRect
|
||||||
|
{
|
||||||
|
getScreenPosition(_point, camera);
|
||||||
|
|
||||||
|
_rect.set(_point.x, _point.y, width, height);
|
||||||
|
_rect = camera.transformRect(_rect);
|
||||||
|
|
||||||
|
if (isPixelPerfectRender(camera))
|
||||||
|
{
|
||||||
|
_rect.width = _rect.width / this.scale.x;
|
||||||
|
_rect.height = _rect.height / this.scale.y;
|
||||||
|
_rect.x = _rect.x / this.scale.x;
|
||||||
|
_rect.y = _rect.y / this.scale.y;
|
||||||
|
_rect.floor();
|
||||||
|
_rect.x = _rect.x * this.scale.x;
|
||||||
|
_rect.y = _rect.y * this.scale.y;
|
||||||
|
_rect.width = _rect.width * this.scale.x;
|
||||||
|
_rect.height = _rect.height * this.scale.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the screen position of this object.
|
||||||
|
*
|
||||||
|
* @param result Optional arg for the returning point
|
||||||
|
* @param camera The desired "screen" coordinate space. If `null`, `FlxG.camera` is used.
|
||||||
|
* @return The screen position of this object.
|
||||||
|
*/
|
||||||
|
public override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint
|
||||||
|
{
|
||||||
|
if (result == null) result = FlxPoint.get();
|
||||||
|
|
||||||
|
if (camera == null) camera = FlxG.camera;
|
||||||
|
|
||||||
|
result.set(x, y);
|
||||||
|
if (pixelPerfectPosition)
|
||||||
|
{
|
||||||
|
_rect.width = _rect.width / this.scale.x;
|
||||||
|
_rect.height = _rect.height / this.scale.y;
|
||||||
|
_rect.x = _rect.x / this.scale.x;
|
||||||
|
_rect.y = _rect.y / this.scale.y;
|
||||||
|
_rect.round();
|
||||||
|
_rect.x = _rect.x * this.scale.x;
|
||||||
|
_rect.y = _rect.y * this.scale.y;
|
||||||
|
_rect.width = _rect.width * this.scale.x;
|
||||||
|
_rect.height = _rect.height * this.scale.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.subtract(camera.scroll.x * scrollFactor.x, camera.scroll.y * scrollFactor.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
override function drawSimple(camera:FlxCamera):Void
|
||||||
|
{
|
||||||
|
getScreenPosition(_point, camera).subtractPoint(offset);
|
||||||
|
if (isPixelPerfectRender(camera))
|
||||||
|
{
|
||||||
|
_point.x = _point.x / this.scale.x;
|
||||||
|
_point.y = _point.y / this.scale.y;
|
||||||
|
_point.round();
|
||||||
|
|
||||||
|
_point.x = _point.x * this.scale.x;
|
||||||
|
_point.y = _point.y * this.scale.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
_point.copyToFlash(_flashPoint);
|
||||||
|
camera.copyPixels(_frame, framePixels, _flashRect, _flashPoint, colorTransform, blend, antialiasing);
|
||||||
|
}
|
||||||
|
|
||||||
|
override function drawComplex(camera:FlxCamera):Void
|
||||||
|
{
|
||||||
|
_frame.prepareMatrix(_matrix, FlxFrameAngle.ANGLE_0, checkFlipX(), checkFlipY());
|
||||||
|
_matrix.translate(-origin.x, -origin.y);
|
||||||
|
_matrix.scale(scale.x, scale.y);
|
||||||
|
|
||||||
|
if (bakedRotationAngle <= 0)
|
||||||
|
{
|
||||||
|
updateTrig();
|
||||||
|
|
||||||
|
if (angle != 0) _matrix.rotateWithTrig(_cosAngle, _sinAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
getScreenPosition(_point, camera).subtractPoint(offset);
|
||||||
|
_point.add(origin.x, origin.y);
|
||||||
|
_matrix.translate(_point.x, _point.y);
|
||||||
|
|
||||||
|
if (isPixelPerfectRender(camera))
|
||||||
|
{
|
||||||
|
_matrix.tx = Math.round(_matrix.tx / this.scale.x) * this.scale.x;
|
||||||
|
_matrix.ty = Math.round(_matrix.ty / this.scale.y) * this.scale.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
camera.drawPixels(_frame, framePixels, _matrix, colorTransform, blend, antialiasing, shader);
|
||||||
|
}
|
||||||
|
|
||||||
public override function destroy():Void
|
public override function destroy():Void
|
||||||
{
|
{
|
||||||
frames = null;
|
frames = null;
|
||||||
|
|
|
@ -31,6 +31,7 @@ class Controls extends FlxActionSet
|
||||||
* Uses FlxActions to funnel various inputs to a single action.
|
* Uses FlxActions to funnel various inputs to a single action.
|
||||||
*/
|
*/
|
||||||
var _ui_up = new FunkinAction(Action.UI_UP);
|
var _ui_up = new FunkinAction(Action.UI_UP);
|
||||||
|
|
||||||
var _ui_left = new FunkinAction(Action.UI_LEFT);
|
var _ui_left = new FunkinAction(Action.UI_LEFT);
|
||||||
var _ui_right = new FunkinAction(Action.UI_RIGHT);
|
var _ui_right = new FunkinAction(Action.UI_RIGHT);
|
||||||
var _ui_down = new FunkinAction(Action.UI_DOWN);
|
var _ui_down = new FunkinAction(Action.UI_DOWN);
|
||||||
|
@ -325,19 +326,18 @@ class Controls extends FlxActionSet
|
||||||
add(_volume_down);
|
add(_volume_down);
|
||||||
add(_volume_mute);
|
add(_volume_mute);
|
||||||
|
|
||||||
for (action in digitalActions) {
|
for (action in digitalActions)
|
||||||
if (Std.isOfType(action, FunkinAction)) {
|
{
|
||||||
|
if (Std.isOfType(action, FunkinAction))
|
||||||
|
{
|
||||||
var funkinAction:FunkinAction = cast action;
|
var funkinAction:FunkinAction = cast action;
|
||||||
byName[funkinAction.name] = funkinAction;
|
byName[funkinAction.name] = funkinAction;
|
||||||
if (funkinAction.namePressed != null)
|
if (funkinAction.namePressed != null) byName[funkinAction.namePressed] = funkinAction;
|
||||||
byName[funkinAction.namePressed] = funkinAction;
|
if (funkinAction.nameReleased != null) byName[funkinAction.nameReleased] = funkinAction;
|
||||||
if (funkinAction.nameReleased != null)
|
|
||||||
byName[funkinAction.nameReleased] = funkinAction;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheme == null)
|
if (scheme == null) scheme = None;
|
||||||
scheme = None;
|
|
||||||
|
|
||||||
setKeyboardScheme(scheme, false);
|
setKeyboardScheme(scheme, false);
|
||||||
}
|
}
|
||||||
|
@ -350,38 +350,38 @@ class Controls extends FlxActionSet
|
||||||
public function check(name:Action, trigger:FlxInputState = JUST_PRESSED, gamepadOnly:Bool = false):Bool
|
public function check(name:Action, trigger:FlxInputState = JUST_PRESSED, gamepadOnly:Bool = false):Bool
|
||||||
{
|
{
|
||||||
#if debug
|
#if debug
|
||||||
if (!byName.exists(name))
|
if (!byName.exists(name)) throw 'Invalid name: $name';
|
||||||
throw 'Invalid name: $name';
|
|
||||||
#end
|
#end
|
||||||
var action = byName[name];
|
var action = byName[name];
|
||||||
if (gamepadOnly)
|
if (gamepadOnly) return action.checkFiltered(trigger, GAMEPAD);
|
||||||
return action.checkFiltered(trigger, GAMEPAD);
|
|
||||||
else
|
else
|
||||||
return action.checkFiltered(trigger);
|
return action.checkFiltered(trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getKeysForAction(name:Action):Array<FlxKey> {
|
public function getKeysForAction(name:Action):Array<FlxKey>
|
||||||
|
{
|
||||||
#if debug
|
#if debug
|
||||||
if (!byName.exists(name))
|
if (!byName.exists(name)) throw 'Invalid name: $name';
|
||||||
throw 'Invalid name: $name';
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
// TODO: Revert to `.map().filter()` once HashLink doesn't complain anymore.
|
// TODO: Revert to `.map().filter()` once HashLink doesn't complain anymore.
|
||||||
var result:Array<FlxKey> = [];
|
var result:Array<FlxKey> = [];
|
||||||
for (input in byName[name].inputs) {
|
for (input in byName[name].inputs)
|
||||||
|
{
|
||||||
if (input.device == KEYBOARD) result.push(input.inputID);
|
if (input.device == KEYBOARD) result.push(input.inputID);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getButtonsForAction(name:Action):Array<FlxGamepadInputID> {
|
public function getButtonsForAction(name:Action):Array<FlxGamepadInputID>
|
||||||
|
{
|
||||||
#if debug
|
#if debug
|
||||||
if (!byName.exists(name))
|
if (!byName.exists(name)) throw 'Invalid name: $name';
|
||||||
throw 'Invalid name: $name';
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
var result:Array<FlxGamepadInputID> = [];
|
var result:Array<FlxGamepadInputID> = [];
|
||||||
for (input in byName[name].inputs) {
|
for (input in byName[name].inputs)
|
||||||
|
{
|
||||||
if (input.device == GAMEPAD) result.push(input.inputID);
|
if (input.device == GAMEPAD) result.push(input.inputID);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -405,7 +405,7 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
function getActionFromControl(control:Control):FlxActionDigital
|
function getActionFromControl(control:Control):FlxActionDigital
|
||||||
{
|
{
|
||||||
return switch(control)
|
return switch (control)
|
||||||
{
|
{
|
||||||
case UI_UP: _ui_up;
|
case UI_UP: _ui_up;
|
||||||
case UI_DOWN: _ui_down;
|
case UI_DOWN: _ui_down;
|
||||||
|
@ -448,7 +448,7 @@ class Controls extends FlxActionSet
|
||||||
*/
|
*/
|
||||||
function forEachBound(control:Control, func:FlxActionDigital->FlxInputState->Void)
|
function forEachBound(control:Control, func:FlxActionDigital->FlxInputState->Void)
|
||||||
{
|
{
|
||||||
switch(control)
|
switch (control)
|
||||||
{
|
{
|
||||||
case UI_UP:
|
case UI_UP:
|
||||||
func(_ui_up, PRESSED);
|
func(_ui_up, PRESSED);
|
||||||
|
@ -519,10 +519,9 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
public function replaceBinding(control:Control, device:Device, toAdd:Int, toRemove:Int)
|
public function replaceBinding(control:Control, device:Device, toAdd:Int, toRemove:Int)
|
||||||
{
|
{
|
||||||
if (toAdd == toRemove)
|
if (toAdd == toRemove) return;
|
||||||
return;
|
|
||||||
|
|
||||||
switch(device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
forEachBound(control, function(action, state) replaceKey(action, toAdd, toRemove, state));
|
forEachBound(control, function(action, state) replaceKey(action, toAdd, toRemove, state));
|
||||||
|
@ -534,7 +533,8 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
function replaceKey(action:FlxActionDigital, toAdd:FlxKey, toRemove:FlxKey, state:FlxInputState)
|
function replaceKey(action:FlxActionDigital, toAdd:FlxKey, toRemove:FlxKey, state:FlxInputState)
|
||||||
{
|
{
|
||||||
if (action.inputs.length == 0) {
|
if (action.inputs.length == 0)
|
||||||
|
{
|
||||||
// Add the keybind, don't replace.
|
// Add the keybind, don't replace.
|
||||||
addKeys(action, [toAdd], state);
|
addKeys(action, [toAdd], state);
|
||||||
return;
|
return;
|
||||||
|
@ -548,34 +548,44 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
if (input.device == KEYBOARD && input.inputID == toRemove)
|
if (input.device == KEYBOARD && input.inputID == toRemove)
|
||||||
{
|
{
|
||||||
if (toAdd == FlxKey.NONE) {
|
if (toAdd == FlxKey.NONE)
|
||||||
|
{
|
||||||
// Remove the keybind, don't replace.
|
// Remove the keybind, don't replace.
|
||||||
action.inputs.remove(input);
|
action.inputs.remove(input);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Replace the keybind.
|
// Replace the keybind.
|
||||||
@:privateAccess
|
@:privateAccess
|
||||||
action.inputs[i].inputID = toAdd;
|
action.inputs[i].inputID = toAdd;
|
||||||
}
|
}
|
||||||
hasReplaced = true;
|
hasReplaced = true;
|
||||||
} else if (input.device == KEYBOARD && input.inputID == toAdd) {
|
}
|
||||||
|
else if (input.device == KEYBOARD && input.inputID == toAdd)
|
||||||
|
{
|
||||||
// This key is already bound!
|
// This key is already bound!
|
||||||
if (hasReplaced) {
|
if (hasReplaced)
|
||||||
|
{
|
||||||
// Remove the duplicate keybind, don't replace.
|
// Remove the duplicate keybind, don't replace.
|
||||||
action.inputs.remove(input);
|
action.inputs.remove(input);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
hasReplaced = true;
|
hasReplaced = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasReplaced) {
|
if (!hasReplaced)
|
||||||
|
{
|
||||||
addKeys(action, [toAdd], state);
|
addKeys(action, [toAdd], state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceButton(action:FlxActionDigital, deviceID:Int, toAdd:FlxGamepadInputID, toRemove:FlxGamepadInputID, state:FlxInputState)
|
function replaceButton(action:FlxActionDigital, deviceID:Int, toAdd:FlxGamepadInputID, toRemove:FlxGamepadInputID, state:FlxInputState)
|
||||||
{
|
{
|
||||||
if (action.inputs.length == 0) {
|
if (action.inputs.length == 0)
|
||||||
|
{
|
||||||
addButtons(action, [toAdd], state, deviceID);
|
addButtons(action, [toAdd], state, deviceID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -594,7 +604,8 @@ class Controls extends FlxActionSet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasReplaced) {
|
if (!hasReplaced)
|
||||||
|
{
|
||||||
addButtons(action, [toAdd], state, deviceID);
|
addButtons(action, [toAdd], state, deviceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,18 +617,16 @@ class Controls extends FlxActionSet
|
||||||
var action = controls.byName[name];
|
var action = controls.byName[name];
|
||||||
for (input in action.inputs)
|
for (input in action.inputs)
|
||||||
{
|
{
|
||||||
if (device == null || isDevice(input, device))
|
if (device == null || isDevice(input, device)) byName[name].add(cast input);
|
||||||
byName[name].add(cast input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case null:
|
case null:
|
||||||
// add all
|
// add all
|
||||||
for (gamepad in controls.gamepadsAdded)
|
for (gamepad in controls.gamepadsAdded)
|
||||||
if (gamepadsAdded.indexOf(gamepad) == -1)
|
if (gamepadsAdded.indexOf(gamepad) == -1) gamepadsAdded.push(gamepad);
|
||||||
gamepadsAdded.push(gamepad);
|
|
||||||
|
|
||||||
mergeKeyboardScheme(controls.keyboardScheme);
|
mergeKeyboardScheme(controls.keyboardScheme);
|
||||||
|
|
||||||
|
@ -637,7 +646,7 @@ class Controls extends FlxActionSet
|
||||||
{
|
{
|
||||||
if (scheme != None)
|
if (scheme != None)
|
||||||
{
|
{
|
||||||
switch(keyboardScheme)
|
switch (keyboardScheme)
|
||||||
{
|
{
|
||||||
case None:
|
case None:
|
||||||
keyboardScheme = scheme;
|
keyboardScheme = scheme;
|
||||||
|
@ -672,7 +681,8 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
static function addKeys(action:FlxActionDigital, keys:Array<FlxKey>, state:FlxInputState)
|
static function addKeys(action:FlxActionDigital, keys:Array<FlxKey>, state:FlxInputState)
|
||||||
{
|
{
|
||||||
for (key in keys) {
|
for (key in keys)
|
||||||
|
{
|
||||||
if (key == FlxKey.NONE) continue; // Ignore unbound keys.
|
if (key == FlxKey.NONE) continue; // Ignore unbound keys.
|
||||||
action.addKey(key, state);
|
action.addKey(key, state);
|
||||||
}
|
}
|
||||||
|
@ -684,15 +694,13 @@ class Controls extends FlxActionSet
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
var input = action.inputs[i];
|
var input = action.inputs[i];
|
||||||
if (input.device == KEYBOARD && keys.indexOf(cast input.inputID) != -1)
|
if (input.device == KEYBOARD && keys.indexOf(cast input.inputID) != -1) action.remove(input);
|
||||||
action.remove(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setKeyboardScheme(scheme:KeyboardScheme, reset = true)
|
public function setKeyboardScheme(scheme:KeyboardScheme, reset = true)
|
||||||
{
|
{
|
||||||
if (reset)
|
if (reset) removeKeyboard();
|
||||||
removeKeyboard();
|
|
||||||
|
|
||||||
keyboardScheme = scheme;
|
keyboardScheme = scheme;
|
||||||
|
|
||||||
|
@ -724,10 +732,13 @@ class Controls extends FlxActionSet
|
||||||
bindMobileLol();
|
bindMobileLol();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultKeybinds(scheme:KeyboardScheme, control:Control):Array<FlxKey> {
|
function getDefaultKeybinds(scheme:KeyboardScheme, control:Control):Array<FlxKey>
|
||||||
switch (scheme) {
|
{
|
||||||
|
switch (scheme)
|
||||||
|
{
|
||||||
case Solo:
|
case Solo:
|
||||||
switch (control) {
|
switch (control)
|
||||||
|
{
|
||||||
case Control.UI_UP: return [W, FlxKey.UP];
|
case Control.UI_UP: return [W, FlxKey.UP];
|
||||||
case Control.UI_DOWN: return [S, FlxKey.DOWN];
|
case Control.UI_DOWN: return [S, FlxKey.DOWN];
|
||||||
case Control.UI_LEFT: return [A, FlxKey.LEFT];
|
case Control.UI_LEFT: return [A, FlxKey.LEFT];
|
||||||
|
@ -754,7 +765,8 @@ class Controls extends FlxActionSet
|
||||||
case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO];
|
case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO];
|
||||||
}
|
}
|
||||||
case Duo(true):
|
case Duo(true):
|
||||||
switch (control) {
|
switch (control)
|
||||||
|
{
|
||||||
case Control.UI_UP: return [W];
|
case Control.UI_UP: return [W];
|
||||||
case Control.UI_DOWN: return [S];
|
case Control.UI_DOWN: return [S];
|
||||||
case Control.UI_LEFT: return [A];
|
case Control.UI_LEFT: return [A];
|
||||||
|
@ -779,10 +791,10 @@ class Controls extends FlxActionSet
|
||||||
case Control.VOLUME_UP: return [PLUS];
|
case Control.VOLUME_UP: return [PLUS];
|
||||||
case Control.VOLUME_DOWN: return [MINUS];
|
case Control.VOLUME_DOWN: return [MINUS];
|
||||||
case Control.VOLUME_MUTE: return [ZERO];
|
case Control.VOLUME_MUTE: return [ZERO];
|
||||||
|
|
||||||
}
|
}
|
||||||
case Duo(false):
|
case Duo(false):
|
||||||
switch (control) {
|
switch (control)
|
||||||
|
{
|
||||||
case Control.UI_UP: return [FlxKey.UP];
|
case Control.UI_UP: return [FlxKey.UP];
|
||||||
case Control.UI_DOWN: return [FlxKey.DOWN];
|
case Control.UI_DOWN: return [FlxKey.DOWN];
|
||||||
case Control.UI_LEFT: return [FlxKey.LEFT];
|
case Control.UI_LEFT: return [FlxKey.LEFT];
|
||||||
|
@ -807,7 +819,6 @@ class Controls extends FlxActionSet
|
||||||
case Control.VOLUME_UP: return [NUMPADPLUS];
|
case Control.VOLUME_UP: return [NUMPADPLUS];
|
||||||
case Control.VOLUME_DOWN: return [NUMPADMINUS];
|
case Control.VOLUME_DOWN: return [NUMPADMINUS];
|
||||||
case Control.VOLUME_MUTE: return [NUMPADZERO];
|
case Control.VOLUME_MUTE: return [NUMPADZERO];
|
||||||
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// Fallthrough.
|
// Fallthrough.
|
||||||
|
@ -834,8 +845,7 @@ class Controls extends FlxActionSet
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if android
|
#if android
|
||||||
forEachBound(Control.BACK, function(action, pres)
|
forEachBound(Control.BACK, function(action, pres) {
|
||||||
{
|
|
||||||
action.add(new FlxActionInputDigitalAndroid(FlxAndroidKey.BACK, JUST_PRESSED));
|
action.add(new FlxActionInputDigitalAndroid(FlxAndroidKey.BACK, JUST_PRESSED));
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
|
@ -849,8 +859,7 @@ class Controls extends FlxActionSet
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
var input = action.inputs[i];
|
var input = action.inputs[i];
|
||||||
if (input.device == KEYBOARD)
|
if (input.device == KEYBOARD) action.remove(input);
|
||||||
action.remove(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -862,11 +871,13 @@ class Controls extends FlxActionSet
|
||||||
fromSaveData(padData, Gamepad(id));
|
fromSaveData(padData, Gamepad(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGamepadIds():Array<Int> {
|
public function getGamepadIds():Array<Int>
|
||||||
|
{
|
||||||
return gamepadsAdded;
|
return gamepadsAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGamepads():Array<FlxGamepad> {
|
public function getGamepads():Array<FlxGamepad>
|
||||||
|
{
|
||||||
return [for (id in gamepadsAdded) FlxG.gamepads.getByID(id)];
|
return [for (id in gamepadsAdded) FlxG.gamepads.getByID(id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,8 +897,7 @@ class Controls extends FlxActionSet
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
var input = action.inputs[i];
|
var input = action.inputs[i];
|
||||||
if (isGamepad(input, deviceID))
|
if (isGamepad(input, deviceID)) action.remove(input);
|
||||||
action.remove(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,32 +934,58 @@ class Controls extends FlxActionSet
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultGamepadBinds(control:Control):Array<FlxGamepadInputID> {
|
function getDefaultGamepadBinds(control:Control):Array<FlxGamepadInputID>
|
||||||
switch(control) {
|
{
|
||||||
case Control.ACCEPT: return [#if switch B #else A #end];
|
switch (control)
|
||||||
case Control.BACK: return [#if switch A #else B #end];
|
{
|
||||||
case Control.UI_UP: return [DPAD_UP, LEFT_STICK_DIGITAL_UP];
|
case Control.ACCEPT:
|
||||||
case Control.UI_DOWN: return [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN];
|
return [#if switch B #else A #end];
|
||||||
case Control.UI_LEFT: return [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT];
|
case Control.BACK:
|
||||||
case Control.UI_RIGHT: return [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT];
|
return [#if switch A #else B #end];
|
||||||
case Control.NOTE_UP: return [DPAD_UP, Y, LEFT_STICK_DIGITAL_UP, RIGHT_STICK_DIGITAL_UP];
|
case Control.UI_UP:
|
||||||
case Control.NOTE_DOWN: return [DPAD_DOWN, A, LEFT_STICK_DIGITAL_DOWN, RIGHT_STICK_DIGITAL_DOWN];
|
return [DPAD_UP, LEFT_STICK_DIGITAL_UP];
|
||||||
case Control.NOTE_LEFT: return [DPAD_LEFT, X, LEFT_STICK_DIGITAL_LEFT, RIGHT_STICK_DIGITAL_LEFT];
|
case Control.UI_DOWN:
|
||||||
case Control.NOTE_RIGHT: return [DPAD_RIGHT, B, LEFT_STICK_DIGITAL_RIGHT, RIGHT_STICK_DIGITAL_RIGHT];
|
return [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN];
|
||||||
case Control.PAUSE: return [START];
|
case Control.UI_LEFT:
|
||||||
case Control.RESET: return [FlxGamepadInputID.BACK]; // Back (i.e. Select)
|
return [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT];
|
||||||
case Control.WINDOW_FULLSCREEN: [];
|
case Control.UI_RIGHT:
|
||||||
case Control.WINDOW_SCREENSHOT: [];
|
return [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT];
|
||||||
case Control.CUTSCENE_ADVANCE: return [A];
|
case Control.NOTE_UP:
|
||||||
case Control.FREEPLAY_FAVORITE: [FlxGamepadInputID.BACK]; // Back (i.e. Select)
|
return [DPAD_UP, Y, LEFT_STICK_DIGITAL_UP, RIGHT_STICK_DIGITAL_UP];
|
||||||
case Control.FREEPLAY_LEFT: [LEFT_SHOULDER];
|
case Control.NOTE_DOWN:
|
||||||
case Control.FREEPLAY_RIGHT: [RIGHT_SHOULDER];
|
return [DPAD_DOWN, A, LEFT_STICK_DIGITAL_DOWN, RIGHT_STICK_DIGITAL_DOWN];
|
||||||
case Control.VOLUME_UP: [];
|
case Control.NOTE_LEFT:
|
||||||
case Control.VOLUME_DOWN: [];
|
return [DPAD_LEFT, X, LEFT_STICK_DIGITAL_LEFT, RIGHT_STICK_DIGITAL_LEFT];
|
||||||
case Control.VOLUME_MUTE: [];
|
case Control.NOTE_RIGHT:
|
||||||
case Control.DEBUG_MENU: [];
|
return [DPAD_RIGHT, B, LEFT_STICK_DIGITAL_RIGHT, RIGHT_STICK_DIGITAL_RIGHT];
|
||||||
case Control.DEBUG_CHART: [];
|
case Control.PAUSE:
|
||||||
case Control.DEBUG_STAGE: [];
|
return [START];
|
||||||
|
case Control.RESET:
|
||||||
|
return [FlxGamepadInputID.BACK]; // Back (i.e. Select)
|
||||||
|
case Control.WINDOW_FULLSCREEN:
|
||||||
|
[];
|
||||||
|
case Control.WINDOW_SCREENSHOT:
|
||||||
|
[];
|
||||||
|
case Control.CUTSCENE_ADVANCE:
|
||||||
|
return [A];
|
||||||
|
case Control.FREEPLAY_FAVORITE:
|
||||||
|
[FlxGamepadInputID.BACK]; // Back (i.e. Select)
|
||||||
|
case Control.FREEPLAY_LEFT:
|
||||||
|
[LEFT_SHOULDER];
|
||||||
|
case Control.FREEPLAY_RIGHT:
|
||||||
|
[RIGHT_SHOULDER];
|
||||||
|
case Control.VOLUME_UP:
|
||||||
|
[];
|
||||||
|
case Control.VOLUME_DOWN:
|
||||||
|
[];
|
||||||
|
case Control.VOLUME_MUTE:
|
||||||
|
[];
|
||||||
|
case Control.DEBUG_MENU:
|
||||||
|
[];
|
||||||
|
case Control.DEBUG_CHART:
|
||||||
|
[];
|
||||||
|
case Control.DEBUG_STAGE:
|
||||||
|
[];
|
||||||
default:
|
default:
|
||||||
// Fallthrough.
|
// Fallthrough.
|
||||||
}
|
}
|
||||||
|
@ -967,8 +1003,7 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
public function touchShit(control:Control, id)
|
public function touchShit(control:Control, id)
|
||||||
{
|
{
|
||||||
forEachBound(control, function(action, state)
|
forEachBound(control, function(action, state) {
|
||||||
{
|
|
||||||
// action
|
// action
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -984,7 +1019,8 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
inline static function addButtons(action:FlxActionDigital, buttons:Array<FlxGamepadInputID>, state, id)
|
inline static function addButtons(action:FlxActionDigital, buttons:Array<FlxGamepadInputID>, state, id)
|
||||||
{
|
{
|
||||||
for (button in buttons) {
|
for (button in buttons)
|
||||||
|
{
|
||||||
if (button == FlxGamepadInputID.NONE) continue; // Ignore unbound keys.
|
if (button == FlxGamepadInputID.NONE) continue; // Ignore unbound keys.
|
||||||
action.addGamepad(button, state, id);
|
action.addGamepad(button, state, id);
|
||||||
}
|
}
|
||||||
|
@ -996,29 +1032,25 @@ class Controls extends FlxActionSet
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
var input = action.inputs[i];
|
var input = action.inputs[i];
|
||||||
if (isGamepad(input, gamepadID) && buttons.indexOf(cast input.inputID) != -1)
|
if (isGamepad(input, gamepadID) && buttons.indexOf(cast input.inputID) != -1) action.remove(input);
|
||||||
action.remove(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInputsFor(control:Control, device:Device, ?list:Array<Int>):Array<Int>
|
public function getInputsFor(control:Control, device:Device, ?list:Array<Int>):Array<Int>
|
||||||
{
|
{
|
||||||
if (list == null)
|
if (list == null) list = [];
|
||||||
list = [];
|
|
||||||
|
|
||||||
switch(device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
for (input in getActionFromControl(control).inputs)
|
for (input in getActionFromControl(control).inputs)
|
||||||
{
|
{
|
||||||
if (input.device == KEYBOARD)
|
if (input.device == KEYBOARD) list.push(input.inputID);
|
||||||
list.push(input.inputID);
|
|
||||||
}
|
}
|
||||||
case Gamepad(id):
|
case Gamepad(id):
|
||||||
for (input in getActionFromControl(control).inputs)
|
for (input in getActionFromControl(control).inputs)
|
||||||
{
|
{
|
||||||
if (isGamepad(input, id))
|
if (isGamepad(input, id)) list.push(input.inputID);
|
||||||
list.push(input.inputID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -1026,7 +1058,7 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
public function removeDevice(device:Device)
|
public function removeDevice(device:Device)
|
||||||
{
|
{
|
||||||
switch(device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
setKeyboardScheme(None);
|
setKeyboardScheme(None);
|
||||||
|
@ -1040,27 +1072,32 @@ class Controls extends FlxActionSet
|
||||||
* An EMPTY array means the control is uninitialized and needs to be reset to default.
|
* An EMPTY array means the control is uninitialized and needs to be reset to default.
|
||||||
* An array with a single FlxKey.NONE means the control was intentionally unbound by the user.
|
* An array with a single FlxKey.NONE means the control was intentionally unbound by the user.
|
||||||
*/
|
*/
|
||||||
public function fromSaveData(data:Dynamic, device:Device)
|
public function fromSaveData(data:Dynamic, device:Device):Void
|
||||||
{
|
{
|
||||||
for (control in Control.createAll())
|
for (control in Control.createAll())
|
||||||
{
|
{
|
||||||
var inputs:Array<Int> = Reflect.field(data, control.getName());
|
var inputs:Array<Int> = Reflect.field(data, control.getName());
|
||||||
inputs = inputs.distinct();
|
inputs = inputs?.distinct();
|
||||||
if (inputs != null)
|
if (inputs != null)
|
||||||
{
|
{
|
||||||
if (inputs.length == 0) {
|
if (inputs.length == 0)
|
||||||
|
{
|
||||||
trace('Control ${control} is missing bindings, resetting to default.');
|
trace('Control ${control} is missing bindings, resetting to default.');
|
||||||
switch(device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
bindKeys(control, getDefaultKeybinds(Solo, control));
|
bindKeys(control, getDefaultKeybinds(Solo, control));
|
||||||
case Gamepad(id):
|
case Gamepad(id):
|
||||||
bindButtons(control, id, getDefaultGamepadBinds(control));
|
bindButtons(control, id, getDefaultGamepadBinds(control));
|
||||||
}
|
}
|
||||||
} else if (inputs == [FlxKey.NONE]) {
|
}
|
||||||
|
else if (inputs == [FlxKey.NONE])
|
||||||
|
{
|
||||||
trace('Control ${control} is unbound, leaving it be.');
|
trace('Control ${control} is unbound, leaving it be.');
|
||||||
} else {
|
}
|
||||||
switch(device)
|
else
|
||||||
|
{
|
||||||
|
switch (device)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
bindKeys(control, inputs.copy());
|
bindKeys(control, inputs.copy());
|
||||||
|
@ -1068,9 +1105,11 @@ class Controls extends FlxActionSet
|
||||||
bindButtons(control, id, inputs.copy());
|
bindButtons(control, id, inputs.copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
trace('Control ${control} is missing bindings, resetting to default.');
|
trace('Control ${control} is missing bindings, resetting to default.');
|
||||||
switch(device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case Keys:
|
case Keys:
|
||||||
bindKeys(control, getDefaultKeybinds(Solo, control));
|
bindKeys(control, getDefaultKeybinds(Solo, control));
|
||||||
|
@ -1095,9 +1134,12 @@ class Controls extends FlxActionSet
|
||||||
var inputs = getInputsFor(control, device);
|
var inputs = getInputsFor(control, device);
|
||||||
isEmpty = isEmpty && inputs.length == 0;
|
isEmpty = isEmpty && inputs.length == 0;
|
||||||
|
|
||||||
if (inputs.length == 0) {
|
if (inputs.length == 0)
|
||||||
|
{
|
||||||
inputs = [FlxKey.NONE];
|
inputs = [FlxKey.NONE];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
inputs = inputs.distinct();
|
inputs = inputs.distinct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1109,7 +1151,7 @@ class Controls extends FlxActionSet
|
||||||
|
|
||||||
static function isDevice(input:FlxActionInput, device:Device)
|
static function isDevice(input:FlxActionInput, device:Device)
|
||||||
{
|
{
|
||||||
return switch(device)
|
return switch (device)
|
||||||
{
|
{
|
||||||
case Keys: input.device == KEYBOARD;
|
case Keys: input.device == KEYBOARD;
|
||||||
case Gamepad(id): isGamepad(input, id);
|
case Gamepad(id): isGamepad(input, id);
|
||||||
|
@ -1141,7 +1183,8 @@ typedef Swipes =
|
||||||
* - Combining `pressed` and `released` inputs into one action.
|
* - Combining `pressed` and `released` inputs into one action.
|
||||||
* - Filtering by input method (`KEYBOARD`, `MOUSE`, `GAMEPAD`, etc).
|
* - Filtering by input method (`KEYBOARD`, `MOUSE`, `GAMEPAD`, etc).
|
||||||
*/
|
*/
|
||||||
class FunkinAction extends FlxActionDigital {
|
class FunkinAction extends FlxActionDigital
|
||||||
|
{
|
||||||
public var namePressed(default, null):Null<String>;
|
public var namePressed(default, null):Null<String>;
|
||||||
public var nameReleased(default, null):Null<String>;
|
public var nameReleased(default, null):Null<String>;
|
||||||
|
|
||||||
|
@ -1158,83 +1201,102 @@ class FunkinAction extends FlxActionDigital {
|
||||||
/**
|
/**
|
||||||
* Input checks default to whether the input was just pressed, on any input device.
|
* Input checks default to whether the input was just pressed, on any input device.
|
||||||
*/
|
*/
|
||||||
public override function check():Bool {
|
public override function check():Bool
|
||||||
|
{
|
||||||
return checkFiltered(JUST_PRESSED);
|
return checkFiltered(JUST_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is currently being held.
|
* Check whether the input is currently being held.
|
||||||
*/
|
*/
|
||||||
public function checkPressed():Bool {
|
public function checkPressed():Bool
|
||||||
|
{
|
||||||
return checkFiltered(PRESSED);
|
return checkFiltered(PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is currently being held, and was not held last frame.
|
* Check whether the input is currently being held, and was not held last frame.
|
||||||
*/
|
*/
|
||||||
public function checkJustPressed():Bool {
|
public function checkJustPressed():Bool
|
||||||
|
{
|
||||||
return checkFiltered(JUST_PRESSED);
|
return checkFiltered(JUST_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is not currently being held.
|
* Check whether the input is not currently being held.
|
||||||
*/
|
*/
|
||||||
public function checkReleased():Bool {
|
public function checkReleased():Bool
|
||||||
|
{
|
||||||
return checkFiltered(RELEASED);
|
return checkFiltered(RELEASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is not currently being held, and was held last frame.
|
* Check whether the input is not currently being held, and was held last frame.
|
||||||
*/
|
*/
|
||||||
public function checkJustReleased():Bool {
|
public function checkJustReleased():Bool
|
||||||
|
{
|
||||||
return checkFiltered(JUST_RELEASED);
|
return checkFiltered(JUST_RELEASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is currently being held by a gamepad device.
|
* Check whether the input is currently being held by a gamepad device.
|
||||||
*/
|
*/
|
||||||
public function checkPressedGamepad():Bool {
|
public function checkPressedGamepad():Bool
|
||||||
|
{
|
||||||
return checkFiltered(PRESSED, GAMEPAD);
|
return checkFiltered(PRESSED, GAMEPAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is currently being held by a gamepad device, and was not held last frame.
|
* Check whether the input is currently being held by a gamepad device, and was not held last frame.
|
||||||
*/
|
*/
|
||||||
public function checkJustPressedGamepad():Bool {
|
public function checkJustPressedGamepad():Bool
|
||||||
|
{
|
||||||
return checkFiltered(JUST_PRESSED, GAMEPAD);
|
return checkFiltered(JUST_PRESSED, GAMEPAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is not currently being held by a gamepad device.
|
* Check whether the input is not currently being held by a gamepad device.
|
||||||
*/
|
*/
|
||||||
public function checkReleasedGamepad():Bool {
|
public function checkReleasedGamepad():Bool
|
||||||
|
{
|
||||||
return checkFiltered(RELEASED, GAMEPAD);
|
return checkFiltered(RELEASED, GAMEPAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the input is not currently being held by a gamepad device, and was held last frame.
|
* Check whether the input is not currently being held by a gamepad device, and was held last frame.
|
||||||
*/
|
*/
|
||||||
public function checkJustReleasedGamepad():Bool {
|
public function checkJustReleasedGamepad():Bool
|
||||||
|
{
|
||||||
return checkFiltered(JUST_RELEASED, GAMEPAD);
|
return checkFiltered(JUST_RELEASED, GAMEPAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkMultiFiltered(?filterTriggers:Array<FlxInputState>, ?filterDevices:Array<FlxInputDevice>):Bool {
|
public function checkMultiFiltered(?filterTriggers:Array<FlxInputState>, ?filterDevices:Array<FlxInputDevice>):Bool
|
||||||
if (filterTriggers == null) {
|
{
|
||||||
|
if (filterTriggers == null)
|
||||||
|
{
|
||||||
filterTriggers = [PRESSED, JUST_PRESSED];
|
filterTriggers = [PRESSED, JUST_PRESSED];
|
||||||
}
|
}
|
||||||
if (filterDevices == null) {
|
if (filterDevices == null)
|
||||||
|
{
|
||||||
filterDevices = [];
|
filterDevices = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform checkFiltered for each combination.
|
// Perform checkFiltered for each combination.
|
||||||
for (i in filterTriggers) {
|
for (i in filterTriggers)
|
||||||
if (filterDevices.length == 0) {
|
{
|
||||||
if (checkFiltered(i)) {
|
if (filterDevices.length == 0)
|
||||||
|
{
|
||||||
|
if (checkFiltered(i))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
for (j in filterDevices) {
|
else
|
||||||
if (checkFiltered(i, j)) {
|
{
|
||||||
|
for (j in filterDevices)
|
||||||
|
{
|
||||||
|
if (checkFiltered(i, j))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1249,52 +1311,56 @@ class FunkinAction extends FlxActionDigital {
|
||||||
* @param filterTrigger Optionally filter by trigger condition (`JUST_PRESSED`, `PRESSED`, `JUST_RELEASED`, `RELEASED`).
|
* @param filterTrigger Optionally filter by trigger condition (`JUST_PRESSED`, `PRESSED`, `JUST_RELEASED`, `RELEASED`).
|
||||||
* @param filterDevice Optionally filter by device (`KEYBOARD`, `MOUSE`, `GAMEPAD`, `OTHER`).
|
* @param filterDevice Optionally filter by device (`KEYBOARD`, `MOUSE`, `GAMEPAD`, `OTHER`).
|
||||||
*/
|
*/
|
||||||
public function checkFiltered(?filterTrigger:FlxInputState, ?filterDevice:FlxInputDevice):Bool {
|
public function checkFiltered(?filterTrigger:FlxInputState, ?filterDevice:FlxInputDevice):Bool
|
||||||
|
{
|
||||||
// The normal
|
// The normal
|
||||||
|
|
||||||
// Make sure we only update the inputs once per frame.
|
// Make sure we only update the inputs once per frame.
|
||||||
var key = '${filterTrigger}:${filterDevice}';
|
var key = '${filterTrigger}:${filterDevice}';
|
||||||
var cacheEntry = cache.get(key);
|
var cacheEntry = cache.get(key);
|
||||||
|
|
||||||
if (cacheEntry != null && cacheEntry.timestamp == FlxG.game.ticks) {
|
if (cacheEntry != null && cacheEntry.timestamp == FlxG.game.ticks)
|
||||||
|
{
|
||||||
return cacheEntry.value;
|
return cacheEntry.value;
|
||||||
}
|
}
|
||||||
// Use a for loop instead so we can remove inputs while iterating.
|
// Use a for loop instead so we can remove inputs while iterating.
|
||||||
|
|
||||||
// We don't return early because we need to call check() on ALL inputs.
|
// We don't return early because we need to call check() on ALL inputs.
|
||||||
var result = false;
|
var result = false;
|
||||||
var len = inputs != null ? inputs.length : 0;
|
var len = inputs != null ? inputs.length : 0;
|
||||||
for (i in 0...len)
|
for (i in 0...len)
|
||||||
{
|
{
|
||||||
var j = len - i - 1;
|
var j = len - i - 1;
|
||||||
var input = inputs[j];
|
var input = inputs[j];
|
||||||
|
|
||||||
// Filter out dead inputs.
|
// Filter out dead inputs.
|
||||||
if (input.destroyed)
|
if (input.destroyed)
|
||||||
{
|
{
|
||||||
inputs.splice(j, 1);
|
inputs.splice(j, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the input.
|
// Update the input.
|
||||||
input.update();
|
input.update();
|
||||||
|
|
||||||
// Check whether the input is the right trigger.
|
// Check whether the input is the right trigger.
|
||||||
if (filterTrigger != null && input.trigger != filterTrigger) {
|
if (filterTrigger != null && input.trigger != filterTrigger)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the input is the right device.
|
// Check whether the input is the right device.
|
||||||
if (filterDevice != null && input.device != filterDevice) {
|
if (filterDevice != null && input.device != filterDevice)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the input has triggered.
|
// Check whether the input has triggered.
|
||||||
if (input.check(this))
|
if (input.check(this))
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to cache this result.
|
// We need to cache this result.
|
||||||
cache.set(key, {timestamp: FlxG.game.ticks, value: result});
|
cache.set(key, {timestamp: FlxG.game.ticks, value: result});
|
||||||
|
@ -1391,12 +1457,12 @@ class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital
|
||||||
{
|
{
|
||||||
var degAngle = FlxAngle.asDegrees(swp.touchAngle);
|
var degAngle = FlxAngle.asDegrees(swp.touchAngle);
|
||||||
|
|
||||||
switch(trigger)
|
switch (trigger)
|
||||||
{
|
{
|
||||||
case JUST_PRESSED:
|
case JUST_PRESSED:
|
||||||
if (swp.touchLength >= activateLength)
|
if (swp.touchLength >= activateLength)
|
||||||
{
|
{
|
||||||
switch(inputID)
|
switch (inputID)
|
||||||
{
|
{
|
||||||
case FlxDirectionFlags.UP:
|
case FlxDirectionFlags.UP:
|
||||||
if (degAngle >= 45 && degAngle <= 90 + 45) return properTouch(swp);
|
if (degAngle >= 45 && degAngle <= 90 + 45) return properTouch(swp);
|
||||||
|
@ -1440,7 +1506,7 @@ class FlxActionInputDigitalAndroid extends FlxActionInputDigital
|
||||||
|
|
||||||
override public function check(Action:FlxAction):Bool
|
override public function check(Action:FlxAction):Bool
|
||||||
{
|
{
|
||||||
return switch(trigger)
|
return switch (trigger)
|
||||||
{
|
{
|
||||||
#if android
|
#if android
|
||||||
case PRESSED: FlxG.android.checkStatus(inputID, PRESSED) || FlxG.android.checkStatus(inputID, PRESSED);
|
case PRESSED: FlxG.android.checkStatus(inputID, PRESSED) || FlxG.android.checkStatus(inputID, PRESSED);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import funkin.modding.module.ModuleHandler;
|
||||||
import funkin.modding.events.ScriptEvent;
|
import funkin.modding.events.ScriptEvent;
|
||||||
import funkin.modding.events.ScriptEvent.CountdownScriptEvent;
|
import funkin.modding.events.ScriptEvent.CountdownScriptEvent;
|
||||||
import flixel.util.FlxTimer;
|
import flixel.util.FlxTimer;
|
||||||
|
import funkin.util.EaseUtil;
|
||||||
import funkin.audio.FunkinSound;
|
import funkin.audio.FunkinSound;
|
||||||
|
|
||||||
class Countdown
|
class Countdown
|
||||||
|
@ -117,7 +118,7 @@ class Countdown
|
||||||
*
|
*
|
||||||
* If you want to call this from a module, it's better to use the event system and cancel the onCountdownStep event.
|
* If you want to call this from a module, it's better to use the event system and cancel the onCountdownStep event.
|
||||||
*/
|
*/
|
||||||
public static function pauseCountdown()
|
public static function pauseCountdown():Void
|
||||||
{
|
{
|
||||||
if (countdownTimer != null && !countdownTimer.finished)
|
if (countdownTimer != null && !countdownTimer.finished)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +131,7 @@ class Countdown
|
||||||
*
|
*
|
||||||
* If you want to call this from a module, it's better to use the event system and cancel the onCountdownStep event.
|
* If you want to call this from a module, it's better to use the event system and cancel the onCountdownStep event.
|
||||||
*/
|
*/
|
||||||
public static function resumeCountdown()
|
public static function resumeCountdown():Void
|
||||||
{
|
{
|
||||||
if (countdownTimer != null && !countdownTimer.finished)
|
if (countdownTimer != null && !countdownTimer.finished)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +144,7 @@ class Countdown
|
||||||
*
|
*
|
||||||
* If you want to call this from a module, it's better to use the event system and cancel the onCountdownStart event.
|
* If you want to call this from a module, it's better to use the event system and cancel the onCountdownStart event.
|
||||||
*/
|
*/
|
||||||
public static function stopCountdown()
|
public static function stopCountdown():Void
|
||||||
{
|
{
|
||||||
if (countdownTimer != null)
|
if (countdownTimer != null)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +157,7 @@ class Countdown
|
||||||
/**
|
/**
|
||||||
* Stops the current countdown, then starts the song for you.
|
* Stops the current countdown, then starts the song for you.
|
||||||
*/
|
*/
|
||||||
public static function skipCountdown()
|
public static function skipCountdown():Void
|
||||||
{
|
{
|
||||||
stopCountdown();
|
stopCountdown();
|
||||||
// This will trigger PlayState.startSong()
|
// This will trigger PlayState.startSong()
|
||||||
|
@ -185,8 +186,11 @@ class Countdown
|
||||||
{
|
{
|
||||||
var spritePath:String = null;
|
var spritePath:String = null;
|
||||||
|
|
||||||
|
var fadeEase = FlxEase.cubeInOut;
|
||||||
|
|
||||||
if (isPixelStyle)
|
if (isPixelStyle)
|
||||||
{
|
{
|
||||||
|
fadeEase = EaseUtil.stepped(8);
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case TWO:
|
case TWO:
|
||||||
|
@ -227,7 +231,7 @@ class Countdown
|
||||||
countdownSprite.screenCenter();
|
countdownSprite.screenCenter();
|
||||||
|
|
||||||
// Fade sprite in, then out, then destroy it.
|
// Fade sprite in, then out, then destroy it.
|
||||||
FlxTween.tween(countdownSprite, {y: countdownSprite.y += 100, alpha: 0}, Conductor.instance.beatLengthMs / 1000,
|
FlxTween.tween(countdownSprite, {y: countdownSprite.y += 100}, Conductor.instance.beatLengthMs / 1000,
|
||||||
{
|
{
|
||||||
ease: FlxEase.cubeInOut,
|
ease: FlxEase.cubeInOut,
|
||||||
onComplete: function(twn:FlxTween) {
|
onComplete: function(twn:FlxTween) {
|
||||||
|
@ -235,6 +239,11 @@ class Countdown
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FlxTween.tween(countdownSprite, {alpha: 0}, Conductor.instance.beatLengthMs / 1000,
|
||||||
|
{
|
||||||
|
ease: fadeEase
|
||||||
|
});
|
||||||
|
|
||||||
PlayState.instance.add(countdownSprite);
|
PlayState.instance.add(countdownSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import funkin.ui.MusicBeatSubState;
|
||||||
import funkin.ui.story.StoryMenuState;
|
import funkin.ui.story.StoryMenuState;
|
||||||
import funkin.util.MathUtil;
|
import funkin.util.MathUtil;
|
||||||
import openfl.utils.Assets;
|
import openfl.utils.Assets;
|
||||||
|
import funkin.effects.RetroCameraFade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A substate which renders over the PlayState when the player dies.
|
* A substate which renders over the PlayState when the player dies.
|
||||||
|
@ -144,6 +145,7 @@ class GameOverSubState extends MusicBeatSubState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boyfriend = PlayState.instance.currentStage.getBoyfriend(true);
|
boyfriend = PlayState.instance.currentStage.getBoyfriend(true);
|
||||||
|
boyfriend.canPlayOtherAnims = true;
|
||||||
boyfriend.isDead = true;
|
boyfriend.isDead = true;
|
||||||
add(boyfriend);
|
add(boyfriend);
|
||||||
boyfriend.resetCharacter();
|
boyfriend.resetCharacter();
|
||||||
|
@ -331,9 +333,12 @@ class GameOverSubState extends MusicBeatSubState
|
||||||
// After the animation finishes...
|
// After the animation finishes...
|
||||||
new FlxTimer().start(0.7, function(tmr:FlxTimer) {
|
new FlxTimer().start(0.7, function(tmr:FlxTimer) {
|
||||||
// ...fade out the graphics. Then after that happens...
|
// ...fade out the graphics. Then after that happens...
|
||||||
FlxG.camera.fade(FlxColor.BLACK, 2, false, function() {
|
|
||||||
|
var resetPlaying = function(pixel:Bool = false) {
|
||||||
// ...close the GameOverSubState.
|
// ...close the GameOverSubState.
|
||||||
FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true);
|
if (pixel) RetroCameraFade.fadeBlack(FlxG.camera, 10, 1);
|
||||||
|
else
|
||||||
|
FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true);
|
||||||
PlayState.instance.needsReset = true;
|
PlayState.instance.needsReset = true;
|
||||||
|
|
||||||
if (PlayState.instance.isMinimalMode || boyfriend == null) {}
|
if (PlayState.instance.isMinimalMode || boyfriend == null) {}
|
||||||
|
@ -350,7 +355,22 @@ class GameOverSubState extends MusicBeatSubState
|
||||||
|
|
||||||
// Close the substate.
|
// Close the substate.
|
||||||
close();
|
close();
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (musicSuffix == '-pixel')
|
||||||
|
{
|
||||||
|
RetroCameraFade.fadeToBlack(FlxG.camera, 10, 2);
|
||||||
|
new FlxTimer().start(2, _ -> {
|
||||||
|
FlxG.camera.filters = [];
|
||||||
|
resetPlaying(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FlxG.camera.fade(FlxColor.BLACK, 2, false, function() {
|
||||||
|
resetPlaying();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,7 +464,9 @@ class ResultState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
bgFlash.visible = true;
|
bgFlash.visible = true;
|
||||||
FlxTween.tween(bgFlash, {alpha: 0}, 5 / 24);
|
FlxTween.tween(bgFlash, {alpha: 0}, 5 / 24);
|
||||||
var clearPercentFloat = (params.scoreData.tallies.sick + params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes * 100;
|
// NOTE: Only divide if totalNotes > 0 to prevent divide-by-zero errors.
|
||||||
|
var clearPercentFloat = params.scoreData.tallies.totalNotes == 0 ? 0.0 : (params.scoreData.tallies.sick +
|
||||||
|
params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes * 100;
|
||||||
clearPercentTarget = Math.floor(clearPercentFloat);
|
clearPercentTarget = Math.floor(clearPercentFloat);
|
||||||
// Prevent off-by-one errors.
|
// Prevent off-by-one errors.
|
||||||
|
|
||||||
|
|
|
@ -305,8 +305,8 @@ class CharacterDataParser
|
||||||
icon = "darnell";
|
icon = "darnell";
|
||||||
case "senpai-angry":
|
case "senpai-angry":
|
||||||
icon = "senpai";
|
icon = "senpai";
|
||||||
case "tankman" | "tankman-atlas":
|
case "tankman-atlas":
|
||||||
icon = "tankmen";
|
icon = "tankman";
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = Paths.image("freeplay/icons/" + icon + "pixel");
|
var path = Paths.image("freeplay/icons/" + icon + "pixel");
|
||||||
|
|
|
@ -41,6 +41,8 @@ class MultiSparrowCharacter extends BaseCharacter
|
||||||
{
|
{
|
||||||
this.isPixel = true;
|
this.isPixel = true;
|
||||||
this.antialiasing = false;
|
this.antialiasing = false;
|
||||||
|
pixelPerfectRender = true;
|
||||||
|
pixelPerfectPosition = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,8 @@ class PackerCharacter extends BaseCharacter
|
||||||
{
|
{
|
||||||
this.isPixel = true;
|
this.isPixel = true;
|
||||||
this.antialiasing = false;
|
this.antialiasing = false;
|
||||||
|
pixelPerfectRender = true;
|
||||||
|
pixelPerfectPosition = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,6 +46,8 @@ class SparrowCharacter extends BaseCharacter
|
||||||
{
|
{
|
||||||
this.isPixel = true;
|
this.isPixel = true;
|
||||||
this.antialiasing = false;
|
this.antialiasing = false;
|
||||||
|
pixelPerfectRender = true;
|
||||||
|
pixelPerfectPosition = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,8 +7,9 @@ import flixel.util.FlxDirection;
|
||||||
import funkin.graphics.FunkinSprite;
|
import funkin.graphics.FunkinSprite;
|
||||||
import funkin.play.PlayState;
|
import funkin.play.PlayState;
|
||||||
import funkin.util.TimerUtil;
|
import funkin.util.TimerUtil;
|
||||||
|
import funkin.util.EaseUtil;
|
||||||
|
|
||||||
class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
class PopUpStuff extends FlxTypedGroup<FunkinSprite>
|
||||||
{
|
{
|
||||||
public var offsets:Array<Int> = [0, 0];
|
public var offsets:Array<Int> = [0, 0];
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayRating(daRating:String)
|
public function displayRating(daRating:String):Void
|
||||||
{
|
{
|
||||||
var perfStart:Float = TimerUtil.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
|
|
||||||
|
@ -40,10 +41,15 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
|
|
||||||
add(rating);
|
add(rating);
|
||||||
|
|
||||||
|
var fadeEase = null;
|
||||||
|
|
||||||
if (PlayState.instance.currentStageId.startsWith('school'))
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
||||||
{
|
{
|
||||||
rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7));
|
rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7));
|
||||||
rating.antialiasing = false;
|
rating.antialiasing = false;
|
||||||
|
rating.pixelPerfectRender = true;
|
||||||
|
rating.pixelPerfectPosition = true;
|
||||||
|
fadeEase = EaseUtil.stepped(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -61,7 +67,8 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
remove(rating, true);
|
remove(rating, true);
|
||||||
rating.destroy();
|
rating.destroy();
|
||||||
},
|
},
|
||||||
startDelay: Conductor.instance.beatLengthMs * 0.001
|
startDelay: Conductor.instance.beatLengthMs * 0.001,
|
||||||
|
ease: fadeEase
|
||||||
});
|
});
|
||||||
|
|
||||||
trace('displayRating took: ${TimerUtil.seconds(perfStart)}');
|
trace('displayRating took: ${TimerUtil.seconds(perfStart)}');
|
||||||
|
@ -92,10 +99,15 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
|
|
||||||
// add(comboSpr);
|
// add(comboSpr);
|
||||||
|
|
||||||
|
var fadeEase = null;
|
||||||
|
|
||||||
if (PlayState.instance.currentStageId.startsWith('school'))
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
||||||
{
|
{
|
||||||
comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 0.7));
|
comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 1));
|
||||||
comboSpr.antialiasing = false;
|
comboSpr.antialiasing = false;
|
||||||
|
comboSpr.pixelPerfectRender = true;
|
||||||
|
comboSpr.pixelPerfectPosition = true;
|
||||||
|
fadeEase = EaseUtil.stepped(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -110,7 +122,8 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
remove(comboSpr, true);
|
remove(comboSpr, true);
|
||||||
comboSpr.destroy();
|
comboSpr.destroy();
|
||||||
},
|
},
|
||||||
startDelay: Conductor.instance.beatLengthMs * 0.001
|
startDelay: Conductor.instance.beatLengthMs * 0.001,
|
||||||
|
ease: fadeEase
|
||||||
});
|
});
|
||||||
|
|
||||||
var seperatedScore:Array<Int> = [];
|
var seperatedScore:Array<Int> = [];
|
||||||
|
@ -133,8 +146,10 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
|
|
||||||
if (PlayState.instance.currentStageId.startsWith('school'))
|
if (PlayState.instance.currentStageId.startsWith('school'))
|
||||||
{
|
{
|
||||||
numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7));
|
numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 1));
|
||||||
numScore.antialiasing = false;
|
numScore.antialiasing = false;
|
||||||
|
numScore.pixelPerfectRender = true;
|
||||||
|
numScore.pixelPerfectPosition = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -156,7 +171,8 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
remove(numScore, true);
|
remove(numScore, true);
|
||||||
numScore.destroy();
|
numScore.destroy();
|
||||||
},
|
},
|
||||||
startDelay: Conductor.instance.beatLengthMs * 0.002
|
startDelay: Conductor.instance.beatLengthMs * 0.002,
|
||||||
|
ease: fadeEase
|
||||||
});
|
});
|
||||||
|
|
||||||
daLoop++;
|
daLoop++;
|
||||||
|
|
|
@ -200,12 +200,10 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
||||||
{
|
{
|
||||||
if (hasDanced)
|
if (hasDanced)
|
||||||
{
|
{
|
||||||
trace('DanceRight (alternate)');
|
|
||||||
playAnimation('danceRight$idleSuffix', forceRestart);
|
playAnimation('danceRight$idleSuffix', forceRestart);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trace('DanceLeft (alternate)');
|
|
||||||
playAnimation('danceLeft$idleSuffix', forceRestart);
|
playAnimation('danceLeft$idleSuffix', forceRestart);
|
||||||
}
|
}
|
||||||
hasDanced = !hasDanced;
|
hasDanced = !hasDanced;
|
||||||
|
|
|
@ -249,6 +249,10 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
|
||||||
// If pixel, disable antialiasing.
|
// If pixel, disable antialiasing.
|
||||||
propSprite.antialiasing = !dataProp.isPixel;
|
propSprite.antialiasing = !dataProp.isPixel;
|
||||||
|
|
||||||
|
// If pixel, we render it pixel perfect so there's less "mixels"
|
||||||
|
propSprite.pixelPerfectRender = dataProp.isPixel;
|
||||||
|
propSprite.pixelPerfectPosition = dataProp.isPixel;
|
||||||
|
|
||||||
propSprite.scrollFactor.x = dataProp.scroll[0];
|
propSprite.scrollFactor.x = dataProp.scroll[0];
|
||||||
propSprite.scrollFactor.y = dataProp.scroll[1];
|
propSprite.scrollFactor.y = dataProp.scroll[1];
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ class MenuItem extends FlxSpriteGroup
|
||||||
{
|
{
|
||||||
public var targetY:Float = 0;
|
public var targetY:Float = 0;
|
||||||
public var week:FlxSprite;
|
public var week:FlxSprite;
|
||||||
public var flashingInt:Int = 0;
|
|
||||||
|
|
||||||
public function new(x:Float, y:Float, weekNum:Int = 0, weekType:WeekType)
|
public function new(x:Float, y:Float, weekNum:Int = 0, weekType:WeekType)
|
||||||
{
|
{
|
||||||
|
@ -30,28 +29,28 @@ class MenuItem extends FlxSpriteGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
var isFlashing:Bool = false;
|
var isFlashing:Bool = false;
|
||||||
|
var flashTick:Float = 0;
|
||||||
|
final flashFramerate:Float = 20;
|
||||||
|
|
||||||
public function startFlashing():Void
|
public function startFlashing():Void
|
||||||
{
|
{
|
||||||
isFlashing = true;
|
isFlashing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it runs at 60fps, fake framerate will be 6
|
|
||||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
|
||||||
// so it runs basically every so many seconds, not dependant on framerate??
|
|
||||||
// I'm still learning how math works thanks whoever is reading this lol
|
|
||||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
override function update(elapsed:Float)
|
||||||
{
|
{
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
y = MathUtil.coolLerp(y, (targetY * 120) + 480, 0.17);
|
y = MathUtil.coolLerp(y, (targetY * 120) + 480, 0.17);
|
||||||
|
|
||||||
if (isFlashing) flashingInt += 1;
|
if (isFlashing)
|
||||||
|
{
|
||||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) week.color = 0xFF33ffff;
|
flashTick += elapsed;
|
||||||
else
|
if (flashTick >= 1 / flashFramerate)
|
||||||
week.color = FlxColor.WHITE;
|
{
|
||||||
|
flashTick %= 1 / flashFramerate;
|
||||||
|
week.color = (week.color == FlxColor.WHITE) ? 0xFF33ffff : FlxColor.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
|
|
||||||
super(FlxColor.TRANSPARENT);
|
super(FlxColor.TRANSPARENT);
|
||||||
|
|
||||||
if (stickers != null)
|
if (stickers?.members != null)
|
||||||
{
|
{
|
||||||
stickerSubState = stickers;
|
stickerSubState = stickers;
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,6 @@ class FreeplayState extends MusicBeatSubState
|
||||||
// be careful not to "add()" things in here unless it's to a group that's already added to the state
|
// be careful not to "add()" things in here unless it's to a group that's already added to the state
|
||||||
// otherwise it won't be properly attatched to funnyCamera (relavent code should be at the bottom of create())
|
// otherwise it won't be properly attatched to funnyCamera (relavent code should be at the bottom of create())
|
||||||
var onDJIntroDone = function() {
|
var onDJIntroDone = function() {
|
||||||
|
|
||||||
// when boyfriend hits dat shiii
|
// when boyfriend hits dat shiii
|
||||||
|
|
||||||
albumRoll.playIntro();
|
albumRoll.playIntro();
|
||||||
|
@ -693,9 +692,12 @@ class FreeplayState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dj != null) {
|
if (dj != null)
|
||||||
|
{
|
||||||
dj.onIntroDone.add(onDJIntroDone);
|
dj.onIntroDone.add(onDJIntroDone);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
onDJIntroDone();
|
onDJIntroDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1775,7 +1777,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
if (dj != null) dj.confirm();
|
if (dj != null) dj.confirm();
|
||||||
|
|
||||||
grpCapsules.members[curSelected].forcePosition();
|
grpCapsules.members[curSelected].forcePosition();
|
||||||
grpCapsules.members[curSelected].songText.flickerText();
|
grpCapsules.members[curSelected].confirm();
|
||||||
|
|
||||||
// FlxTween.color(bgDad, 0.33, 0xFFFFFFFF, 0xFF555555, {ease: FlxEase.quadOut});
|
// FlxTween.color(bgDad, 0.33, 0xFFFFFFFF, 0xFF555555, {ease: FlxEase.quadOut});
|
||||||
FlxTween.color(pinkBack, 0.33, 0xFFFFD0D5, 0xFF171831, {ease: FlxEase.quadOut});
|
FlxTween.color(pinkBack, 0.33, 0xFFFFD0D5, 0xFF171831, {ease: FlxEase.quadOut});
|
||||||
|
@ -1947,6 +1949,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
startingVolume: 0.0,
|
startingVolume: 0.0,
|
||||||
overrideExisting: true,
|
overrideExisting: true,
|
||||||
restartTrack: false,
|
restartTrack: false,
|
||||||
|
mapTimeChanges: false, // The music metadata is not alongside the audio file so this won't work.
|
||||||
pathsFunction: INST,
|
pathsFunction: INST,
|
||||||
suffix: instSuffix,
|
suffix: instSuffix,
|
||||||
partialParams:
|
partialParams:
|
||||||
|
@ -2097,6 +2100,8 @@ class FreeplaySongData
|
||||||
|
|
||||||
function set_currentDifficulty(value:String):String
|
function set_currentDifficulty(value:String):String
|
||||||
{
|
{
|
||||||
|
if (currentDifficulty == value) return value;
|
||||||
|
|
||||||
currentDifficulty = value;
|
currentDifficulty = value;
|
||||||
updateValues(displayedVariations);
|
updateValues(displayedVariations);
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -213,6 +213,7 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
favIconBlurred.frames = Paths.getSparrowAtlas('freeplay/favHeart');
|
favIconBlurred.frames = Paths.getSparrowAtlas('freeplay/favHeart');
|
||||||
favIconBlurred.animation.addByPrefix('fav', 'favorite heart', 24, false);
|
favIconBlurred.animation.addByPrefix('fav', 'favorite heart', 24, false);
|
||||||
favIconBlurred.animation.play('fav');
|
favIconBlurred.animation.play('fav');
|
||||||
|
|
||||||
favIconBlurred.setGraphicSize(50, 50);
|
favIconBlurred.setGraphicSize(50, 50);
|
||||||
favIconBlurred.blend = BlendMode.ADD;
|
favIconBlurred.blend = BlendMode.ADD;
|
||||||
favIconBlurred.shader = new GaussianBlurShader(1.2);
|
favIconBlurred.shader = new GaussianBlurShader(1.2);
|
||||||
|
@ -516,6 +517,9 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
updateDifficultyRating(songData?.difficultyRating ?? 0);
|
updateDifficultyRating(songData?.difficultyRating ?? 0);
|
||||||
updateScoringRank(songData?.scoringRank);
|
updateScoringRank(songData?.scoringRank);
|
||||||
newText.visible = songData?.isNew;
|
newText.visible = songData?.isNew;
|
||||||
|
favIcon.animation.curAnim.curFrame = favIcon.animation.curAnim.numFrames - 1;
|
||||||
|
favIconBlurred.animation.curAnim.curFrame = favIconBlurred.animation.curAnim.numFrames - 1;
|
||||||
|
|
||||||
// Update opacity, offsets, etc.
|
// Update opacity, offsets, etc.
|
||||||
updateSelected();
|
updateSelected();
|
||||||
|
|
||||||
|
@ -539,8 +543,6 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
charPath += 'monsterpixel';
|
charPath += 'monsterpixel';
|
||||||
case 'mom-car':
|
case 'mom-car':
|
||||||
charPath += 'mommypixel';
|
charPath += 'mommypixel';
|
||||||
case 'dad':
|
|
||||||
charPath += 'daddypixel';
|
|
||||||
case 'darnell-blazin':
|
case 'darnell-blazin':
|
||||||
charPath += 'darnellpixel';
|
charPath += 'darnellpixel';
|
||||||
case 'senpai-angry':
|
case 'senpai-angry':
|
||||||
|
@ -555,7 +557,17 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixelIcon.loadGraphic(Paths.image(charPath));
|
var isAnimated = openfl.utils.Assets.exists(Paths.file('images/$charPath.xml'));
|
||||||
|
|
||||||
|
if (isAnimated)
|
||||||
|
{
|
||||||
|
pixelIcon.frames = Paths.getSparrowAtlas(charPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pixelIcon.loadGraphic(Paths.image(charPath));
|
||||||
|
}
|
||||||
|
|
||||||
pixelIcon.scale.x = pixelIcon.scale.y = 2;
|
pixelIcon.scale.x = pixelIcon.scale.y = 2;
|
||||||
|
|
||||||
switch (char)
|
switch (char)
|
||||||
|
@ -567,6 +579,22 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
}
|
}
|
||||||
// pixelIcon.origin.x = capsule.origin.x;
|
// pixelIcon.origin.x = capsule.origin.x;
|
||||||
// pixelIcon.offset.x -= pixelIcon.origin.x;
|
// pixelIcon.offset.x -= pixelIcon.origin.x;
|
||||||
|
|
||||||
|
if (isAnimated)
|
||||||
|
{
|
||||||
|
pixelIcon.active = true;
|
||||||
|
|
||||||
|
pixelIcon.animation.addByPrefix('idle', 'idle0', 10, true);
|
||||||
|
pixelIcon.animation.addByPrefix('confirm', 'confirm0', 10, false);
|
||||||
|
pixelIcon.animation.addByPrefix('confirm-hold', 'confirm-hold0', 10, true);
|
||||||
|
|
||||||
|
pixelIcon.animation.finishCallback = function(name:String):Void {
|
||||||
|
trace('Finish pixel animation: ${name}');
|
||||||
|
if (name == 'confirm') pixelIcon.animation.play('confirm-hold');
|
||||||
|
};
|
||||||
|
|
||||||
|
pixelIcon.animation.play('idle');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var frameInTicker:Float = 0;
|
var frameInTicker:Float = 0;
|
||||||
|
@ -707,6 +735,18 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Play any animations associated with selecting this song.
|
||||||
|
*/
|
||||||
|
public function confirm():Void
|
||||||
|
{
|
||||||
|
if (songText != null) songText.flickerText();
|
||||||
|
if (pixelIcon != null)
|
||||||
|
{
|
||||||
|
pixelIcon.animation.play('confirm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function intendedY(index:Int):Float
|
public function intendedY(index:Int):Float
|
||||||
{
|
{
|
||||||
return (index * ((height * realScaled) + 10)) + 120;
|
return (index * ((height * realScaled) + 10)) + 120;
|
||||||
|
|
|
@ -156,6 +156,9 @@ class MainMenuState extends MusicBeatState
|
||||||
|
|
||||||
resetCamStuff();
|
resetCamStuff();
|
||||||
|
|
||||||
|
// reset camera when debug menu is closed
|
||||||
|
subStateClosed.add(_ -> resetCamStuff(false));
|
||||||
|
|
||||||
subStateOpened.add(sub -> {
|
subStateOpened.add(sub -> {
|
||||||
if (Type.getClass(sub) == FreeplayState)
|
if (Type.getClass(sub) == FreeplayState)
|
||||||
{
|
{
|
||||||
|
@ -185,10 +188,11 @@ class MainMenuState extends MusicBeatState
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCamStuff():Void
|
function resetCamStuff(?snap:Bool = true):Void
|
||||||
{
|
{
|
||||||
FlxG.camera.follow(camFollow, null, 0.06);
|
FlxG.camera.follow(camFollow, null, 0.06);
|
||||||
FlxG.camera.snapToTarget();
|
|
||||||
|
if (snap) FlxG.camera.snapToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void
|
function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void
|
||||||
|
@ -347,8 +351,6 @@ class MainMenuState extends MusicBeatState
|
||||||
persistentUpdate = false;
|
persistentUpdate = false;
|
||||||
|
|
||||||
FlxG.state.openSubState(new DebugMenuSubState());
|
FlxG.state.openSubState(new DebugMenuSubState());
|
||||||
// reset camera when debug menu is closed
|
|
||||||
subStateClosed.addOnce(_ -> resetCamStuff());
|
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,10 @@ class LevelTitle extends FlxSpriteGroup
|
||||||
public final level:Level;
|
public final level:Level;
|
||||||
|
|
||||||
public var targetY:Float;
|
public var targetY:Float;
|
||||||
public var isFlashing:Bool = false;
|
|
||||||
|
|
||||||
var title:FlxSprite;
|
var title:FlxSprite;
|
||||||
var lock:FlxSprite;
|
var lock:FlxSprite;
|
||||||
|
|
||||||
var flashingInt:Int = 0;
|
|
||||||
|
|
||||||
public function new(x:Int, y:Int, level:Level)
|
public function new(x:Int, y:Int, level:Level)
|
||||||
{
|
{
|
||||||
super(x, y);
|
super(x, y);
|
||||||
|
@ -46,20 +43,23 @@ class LevelTitle extends FlxSpriteGroup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it runs at 60fps, fake framerate will be 6
|
public var isFlashing:Bool = false;
|
||||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
var flashTick:Float = 0;
|
||||||
// so it runs basically every so many seconds, not dependant on framerate??
|
final flashFramerate:Float = 20;
|
||||||
// I'm still learning how math works thanks whoever is reading this lol
|
|
||||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
|
||||||
|
|
||||||
public override function update(elapsed:Float):Void
|
public override function update(elapsed:Float):Void
|
||||||
{
|
{
|
||||||
this.y = MathUtil.coolLerp(y, targetY, 0.17);
|
this.y = MathUtil.coolLerp(y, targetY, 0.17);
|
||||||
|
|
||||||
if (isFlashing) flashingInt += 1;
|
if (isFlashing)
|
||||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) title.color = 0xFF33ffff;
|
{
|
||||||
else
|
flashTick += elapsed;
|
||||||
title.color = FlxColor.WHITE;
|
if (flashTick >= 1 / flashFramerate)
|
||||||
|
{
|
||||||
|
flashTick %= 1 / flashFramerate;
|
||||||
|
title.color = (title.color == FlxColor.WHITE) ? 0xFF33ffff : FlxColor.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showLock():Void
|
public function showLock():Void
|
||||||
|
|
|
@ -113,7 +113,7 @@ class StoryMenuState extends MusicBeatState
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (stickers != null)
|
if (stickers?.members != null)
|
||||||
{
|
{
|
||||||
stickerSubState = stickers;
|
stickerSubState = stickers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ class LoadingState extends MusicBeatSubState
|
||||||
return 'Done precaching ${path}';
|
return 'Done precaching ${path}';
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
trace("Queued ${path} for precaching");
|
trace('Queued ${path} for precaching');
|
||||||
// FunkinSprite.cacheTexture(path);
|
// FunkinSprite.cacheTexture(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class AnsiTrace
|
||||||
|
|
||||||
public static function traceBF()
|
public static function traceBF()
|
||||||
{
|
{
|
||||||
#if sys
|
#if (sys && debug)
|
||||||
if (colorSupported)
|
if (colorSupported)
|
||||||
{
|
{
|
||||||
for (line in ansiBF)
|
for (line in ansiBF)
|
||||||
|
|
Loading…
Reference in a new issue