mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 03:13:45 +00:00
mer
This commit is contained in:
parent
fbfd8259a6
commit
a7cfae8545
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ shitAudio/
|
|||
node_modules/
|
||||
package.json
|
||||
package-lock.json
|
||||
.aider.*
|
||||
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -1,6 +1,6 @@
|
|||
[submodule "assets"]
|
||||
path = assets
|
||||
url = https://github.com/FunkinCrew/funkin.assets
|
||||
url = https://github.com/FunkinCrew/Funkin-Assets-secret
|
||||
[submodule "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",
|
||||
"dir": null,
|
||||
"ref": "2d83fa863ef0c1eace5f1cf67c3ac315d1a3a8a5",
|
||||
"url": "https://github.com/Aidan63/linc_discord-rpc"
|
||||
"url": "https://github.com/FunkinCrew/linc_discord-rpc"
|
||||
},
|
||||
{
|
||||
"name": "flixel",
|
||||
|
@ -44,7 +44,7 @@
|
|||
"name": "FlxPartialSound",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "f986332ba5ab02abd386ce662578baf04904604a",
|
||||
"ref": "a1eab7b9bf507b87200a3341719054fe427f3b15",
|
||||
"url": "https://github.com/FunkinCrew/FlxPartialSound.git"
|
||||
},
|
||||
{
|
||||
|
@ -75,14 +75,14 @@
|
|||
"name": "haxeui-core",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "0212d8fdfcafeb5f0d5a41e1ddba8ff21d0e183b",
|
||||
"ref": "5dc4c933bdc029f6139a47962e3b8c754060f210",
|
||||
"url": "https://github.com/haxeui/haxeui-core"
|
||||
},
|
||||
{
|
||||
"name": "haxeui-flixel",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "63a906a6148958dbfde8c7b48d90b0693767fd95",
|
||||
"ref": "57c1604d6b5174839d7e0e012a4dd5dcbfc129da",
|
||||
"url": "https://github.com/haxeui/haxeui-flixel"
|
||||
},
|
||||
{
|
||||
|
@ -112,7 +112,7 @@
|
|||
{
|
||||
"name": "hxp",
|
||||
"type": "haxelib",
|
||||
"version": "1.2.2"
|
||||
"version": "1.3.0"
|
||||
},
|
||||
{
|
||||
"name": "json2object",
|
||||
|
@ -174,15 +174,15 @@
|
|||
"name": "thx.core",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "22605ff44f01971d599641790d6bae4869f7d9f4",
|
||||
"url": "https://github.com/FunkinCrew/thx.core"
|
||||
"ref": "6240b6e136f7490d9298edbe8c1891374bd7cdf2",
|
||||
"url": "https://github.com/fponticelli/thx.core"
|
||||
},
|
||||
{
|
||||
"name": "thx.semver",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "cf8d213589a2c7ce4a59b0fdba9e8ff36bc029fa",
|
||||
"url": "https://github.com/FunkinCrew/thx.semver"
|
||||
"ref": "bdb191fe7cf745c02a980749906dbf22719e200b",
|
||||
"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>>();
|
||||
|
||||
// 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);
|
||||
#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 funkin.graphics.framebuffer.FixedBitmapData;
|
||||
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.
|
||||
|
@ -269,6 +273,103 @@ class FunkinSprite extends FlxSprite
|
|||
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
|
||||
{
|
||||
frames = null;
|
||||
|
|
|
@ -31,6 +31,7 @@ class Controls extends FlxActionSet
|
|||
* Uses FlxActions to funnel various inputs to a single action.
|
||||
*/
|
||||
var _ui_up = new FunkinAction(Action.UI_UP);
|
||||
|
||||
var _ui_left = new FunkinAction(Action.UI_LEFT);
|
||||
var _ui_right = new FunkinAction(Action.UI_RIGHT);
|
||||
var _ui_down = new FunkinAction(Action.UI_DOWN);
|
||||
|
@ -325,19 +326,18 @@ class Controls extends FlxActionSet
|
|||
add(_volume_down);
|
||||
add(_volume_mute);
|
||||
|
||||
for (action in digitalActions) {
|
||||
if (Std.isOfType(action, FunkinAction)) {
|
||||
for (action in digitalActions)
|
||||
{
|
||||
if (Std.isOfType(action, FunkinAction))
|
||||
{
|
||||
var funkinAction:FunkinAction = cast action;
|
||||
byName[funkinAction.name] = funkinAction;
|
||||
if (funkinAction.namePressed != null)
|
||||
byName[funkinAction.namePressed] = funkinAction;
|
||||
if (funkinAction.nameReleased != null)
|
||||
byName[funkinAction.nameReleased] = funkinAction;
|
||||
if (funkinAction.namePressed != null) byName[funkinAction.namePressed] = funkinAction;
|
||||
if (funkinAction.nameReleased != null) byName[funkinAction.nameReleased] = funkinAction;
|
||||
}
|
||||
}
|
||||
|
||||
if (scheme == null)
|
||||
scheme = None;
|
||||
if (scheme == null) scheme = None;
|
||||
|
||||
setKeyboardScheme(scheme, false);
|
||||
}
|
||||
|
@ -350,38 +350,38 @@ class Controls extends FlxActionSet
|
|||
public function check(name:Action, trigger:FlxInputState = JUST_PRESSED, gamepadOnly:Bool = false):Bool
|
||||
{
|
||||
#if debug
|
||||
if (!byName.exists(name))
|
||||
throw 'Invalid name: $name';
|
||||
if (!byName.exists(name)) throw 'Invalid name: $name';
|
||||
#end
|
||||
var action = byName[name];
|
||||
if (gamepadOnly)
|
||||
return action.checkFiltered(trigger, GAMEPAD);
|
||||
if (gamepadOnly) return action.checkFiltered(trigger, GAMEPAD);
|
||||
else
|
||||
return action.checkFiltered(trigger);
|
||||
}
|
||||
|
||||
public function getKeysForAction(name:Action):Array<FlxKey> {
|
||||
public function getKeysForAction(name:Action):Array<FlxKey>
|
||||
{
|
||||
#if debug
|
||||
if (!byName.exists(name))
|
||||
throw 'Invalid name: $name';
|
||||
if (!byName.exists(name)) throw 'Invalid name: $name';
|
||||
#end
|
||||
|
||||
// TODO: Revert to `.map().filter()` once HashLink doesn't complain anymore.
|
||||
var result:Array<FlxKey> = [];
|
||||
for (input in byName[name].inputs) {
|
||||
for (input in byName[name].inputs)
|
||||
{
|
||||
if (input.device == KEYBOARD) result.push(input.inputID);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public function getButtonsForAction(name:Action):Array<FlxGamepadInputID> {
|
||||
public function getButtonsForAction(name:Action):Array<FlxGamepadInputID>
|
||||
{
|
||||
#if debug
|
||||
if (!byName.exists(name))
|
||||
throw 'Invalid name: $name';
|
||||
if (!byName.exists(name)) throw 'Invalid name: $name';
|
||||
#end
|
||||
|
||||
var result:Array<FlxGamepadInputID> = [];
|
||||
for (input in byName[name].inputs) {
|
||||
for (input in byName[name].inputs)
|
||||
{
|
||||
if (input.device == GAMEPAD) result.push(input.inputID);
|
||||
}
|
||||
return result;
|
||||
|
@ -405,7 +405,7 @@ class Controls extends FlxActionSet
|
|||
|
||||
function getActionFromControl(control:Control):FlxActionDigital
|
||||
{
|
||||
return switch(control)
|
||||
return switch (control)
|
||||
{
|
||||
case UI_UP: _ui_up;
|
||||
case UI_DOWN: _ui_down;
|
||||
|
@ -448,7 +448,7 @@ class Controls extends FlxActionSet
|
|||
*/
|
||||
function forEachBound(control:Control, func:FlxActionDigital->FlxInputState->Void)
|
||||
{
|
||||
switch(control)
|
||||
switch (control)
|
||||
{
|
||||
case UI_UP:
|
||||
func(_ui_up, PRESSED);
|
||||
|
@ -519,10 +519,9 @@ class Controls extends FlxActionSet
|
|||
|
||||
public function replaceBinding(control:Control, device:Device, toAdd:Int, toRemove:Int)
|
||||
{
|
||||
if (toAdd == toRemove)
|
||||
return;
|
||||
if (toAdd == toRemove) return;
|
||||
|
||||
switch(device)
|
||||
switch (device)
|
||||
{
|
||||
case Keys:
|
||||
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)
|
||||
{
|
||||
if (action.inputs.length == 0) {
|
||||
if (action.inputs.length == 0)
|
||||
{
|
||||
// Add the keybind, don't replace.
|
||||
addKeys(action, [toAdd], state);
|
||||
return;
|
||||
|
@ -548,34 +548,44 @@ class Controls extends FlxActionSet
|
|||
|
||||
if (input.device == KEYBOARD && input.inputID == toRemove)
|
||||
{
|
||||
if (toAdd == FlxKey.NONE) {
|
||||
if (toAdd == FlxKey.NONE)
|
||||
{
|
||||
// Remove the keybind, don't replace.
|
||||
action.inputs.remove(input);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replace the keybind.
|
||||
@:privateAccess
|
||||
action.inputs[i].inputID = toAdd;
|
||||
}
|
||||
hasReplaced = true;
|
||||
} else if (input.device == KEYBOARD && input.inputID == toAdd) {
|
||||
}
|
||||
else if (input.device == KEYBOARD && input.inputID == toAdd)
|
||||
{
|
||||
// This key is already bound!
|
||||
if (hasReplaced) {
|
||||
if (hasReplaced)
|
||||
{
|
||||
// Remove the duplicate keybind, don't replace.
|
||||
action.inputs.remove(input);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
hasReplaced = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasReplaced) {
|
||||
if (!hasReplaced)
|
||||
{
|
||||
addKeys(action, [toAdd], state);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -594,7 +604,8 @@ class Controls extends FlxActionSet
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasReplaced) {
|
||||
if (!hasReplaced)
|
||||
{
|
||||
addButtons(action, [toAdd], state, deviceID);
|
||||
}
|
||||
}
|
||||
|
@ -606,18 +617,16 @@ class Controls extends FlxActionSet
|
|||
var action = controls.byName[name];
|
||||
for (input in action.inputs)
|
||||
{
|
||||
if (device == null || isDevice(input, device))
|
||||
byName[name].add(cast input);
|
||||
if (device == null || isDevice(input, device)) byName[name].add(cast input);
|
||||
}
|
||||
}
|
||||
|
||||
switch(device)
|
||||
switch (device)
|
||||
{
|
||||
case null:
|
||||
// add all
|
||||
for (gamepad in controls.gamepadsAdded)
|
||||
if (gamepadsAdded.indexOf(gamepad) == -1)
|
||||
gamepadsAdded.push(gamepad);
|
||||
if (gamepadsAdded.indexOf(gamepad) == -1) gamepadsAdded.push(gamepad);
|
||||
|
||||
mergeKeyboardScheme(controls.keyboardScheme);
|
||||
|
||||
|
@ -637,7 +646,7 @@ class Controls extends FlxActionSet
|
|||
{
|
||||
if (scheme != None)
|
||||
{
|
||||
switch(keyboardScheme)
|
||||
switch (keyboardScheme)
|
||||
{
|
||||
case None:
|
||||
keyboardScheme = scheme;
|
||||
|
@ -672,7 +681,8 @@ class Controls extends FlxActionSet
|
|||
|
||||
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.
|
||||
action.addKey(key, state);
|
||||
}
|
||||
|
@ -684,15 +694,13 @@ class Controls extends FlxActionSet
|
|||
while (i-- > 0)
|
||||
{
|
||||
var input = action.inputs[i];
|
||||
if (input.device == KEYBOARD && keys.indexOf(cast input.inputID) != -1)
|
||||
action.remove(input);
|
||||
if (input.device == KEYBOARD && keys.indexOf(cast input.inputID) != -1) action.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
public function setKeyboardScheme(scheme:KeyboardScheme, reset = true)
|
||||
{
|
||||
if (reset)
|
||||
removeKeyboard();
|
||||
if (reset) removeKeyboard();
|
||||
|
||||
keyboardScheme = scheme;
|
||||
|
||||
|
@ -724,10 +732,13 @@ class Controls extends FlxActionSet
|
|||
bindMobileLol();
|
||||
}
|
||||
|
||||
function getDefaultKeybinds(scheme:KeyboardScheme, control:Control):Array<FlxKey> {
|
||||
switch (scheme) {
|
||||
function getDefaultKeybinds(scheme:KeyboardScheme, control:Control):Array<FlxKey>
|
||||
{
|
||||
switch (scheme)
|
||||
{
|
||||
case Solo:
|
||||
switch (control) {
|
||||
switch (control)
|
||||
{
|
||||
case Control.UI_UP: return [W, FlxKey.UP];
|
||||
case Control.UI_DOWN: return [S, FlxKey.DOWN];
|
||||
case Control.UI_LEFT: return [A, FlxKey.LEFT];
|
||||
|
@ -754,7 +765,8 @@ class Controls extends FlxActionSet
|
|||
case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO];
|
||||
}
|
||||
case Duo(true):
|
||||
switch (control) {
|
||||
switch (control)
|
||||
{
|
||||
case Control.UI_UP: return [W];
|
||||
case Control.UI_DOWN: return [S];
|
||||
case Control.UI_LEFT: return [A];
|
||||
|
@ -779,10 +791,10 @@ class Controls extends FlxActionSet
|
|||
case Control.VOLUME_UP: return [PLUS];
|
||||
case Control.VOLUME_DOWN: return [MINUS];
|
||||
case Control.VOLUME_MUTE: return [ZERO];
|
||||
|
||||
}
|
||||
case Duo(false):
|
||||
switch (control) {
|
||||
switch (control)
|
||||
{
|
||||
case Control.UI_UP: return [FlxKey.UP];
|
||||
case Control.UI_DOWN: return [FlxKey.DOWN];
|
||||
case Control.UI_LEFT: return [FlxKey.LEFT];
|
||||
|
@ -807,7 +819,6 @@ class Controls extends FlxActionSet
|
|||
case Control.VOLUME_UP: return [NUMPADPLUS];
|
||||
case Control.VOLUME_DOWN: return [NUMPADMINUS];
|
||||
case Control.VOLUME_MUTE: return [NUMPADZERO];
|
||||
|
||||
}
|
||||
default:
|
||||
// Fallthrough.
|
||||
|
@ -834,8 +845,7 @@ class Controls extends FlxActionSet
|
|||
#end
|
||||
|
||||
#if android
|
||||
forEachBound(Control.BACK, function(action, pres)
|
||||
{
|
||||
forEachBound(Control.BACK, function(action, pres) {
|
||||
action.add(new FlxActionInputDigitalAndroid(FlxAndroidKey.BACK, JUST_PRESSED));
|
||||
});
|
||||
#end
|
||||
|
@ -849,8 +859,7 @@ class Controls extends FlxActionSet
|
|||
while (i-- > 0)
|
||||
{
|
||||
var input = action.inputs[i];
|
||||
if (input.device == KEYBOARD)
|
||||
action.remove(input);
|
||||
if (input.device == KEYBOARD) action.remove(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -862,11 +871,13 @@ class Controls extends FlxActionSet
|
|||
fromSaveData(padData, Gamepad(id));
|
||||
}
|
||||
|
||||
public function getGamepadIds():Array<Int> {
|
||||
public function getGamepadIds():Array<Int>
|
||||
{
|
||||
return gamepadsAdded;
|
||||
}
|
||||
|
||||
public function getGamepads():Array<FlxGamepad> {
|
||||
public function getGamepads():Array<FlxGamepad>
|
||||
{
|
||||
return [for (id in gamepadsAdded) FlxG.gamepads.getByID(id)];
|
||||
}
|
||||
|
||||
|
@ -886,8 +897,7 @@ class Controls extends FlxActionSet
|
|||
while (i-- > 0)
|
||||
{
|
||||
var input = action.inputs[i];
|
||||
if (isGamepad(input, deviceID))
|
||||
action.remove(input);
|
||||
if (isGamepad(input, deviceID)) action.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -924,32 +934,58 @@ class Controls extends FlxActionSet
|
|||
]);
|
||||
}
|
||||
|
||||
function getDefaultGamepadBinds(control:Control):Array<FlxGamepadInputID> {
|
||||
switch(control) {
|
||||
case Control.ACCEPT: return [#if switch B #else A #end];
|
||||
case Control.BACK: return [#if switch A #else B #end];
|
||||
case Control.UI_UP: return [DPAD_UP, LEFT_STICK_DIGITAL_UP];
|
||||
case Control.UI_DOWN: return [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN];
|
||||
case Control.UI_LEFT: return [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT];
|
||||
case Control.UI_RIGHT: return [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT];
|
||||
case Control.NOTE_UP: return [DPAD_UP, Y, LEFT_STICK_DIGITAL_UP, RIGHT_STICK_DIGITAL_UP];
|
||||
case Control.NOTE_DOWN: return [DPAD_DOWN, A, LEFT_STICK_DIGITAL_DOWN, RIGHT_STICK_DIGITAL_DOWN];
|
||||
case Control.NOTE_LEFT: return [DPAD_LEFT, X, LEFT_STICK_DIGITAL_LEFT, RIGHT_STICK_DIGITAL_LEFT];
|
||||
case Control.NOTE_RIGHT: return [DPAD_RIGHT, B, LEFT_STICK_DIGITAL_RIGHT, RIGHT_STICK_DIGITAL_RIGHT];
|
||||
case Control.PAUSE: 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: [];
|
||||
function getDefaultGamepadBinds(control:Control):Array<FlxGamepadInputID>
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case Control.ACCEPT:
|
||||
return [#if switch B #else A #end];
|
||||
case Control.BACK:
|
||||
return [#if switch A #else B #end];
|
||||
case Control.UI_UP:
|
||||
return [DPAD_UP, LEFT_STICK_DIGITAL_UP];
|
||||
case Control.UI_DOWN:
|
||||
return [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN];
|
||||
case Control.UI_LEFT:
|
||||
return [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT];
|
||||
case Control.UI_RIGHT:
|
||||
return [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT];
|
||||
case Control.NOTE_UP:
|
||||
return [DPAD_UP, Y, LEFT_STICK_DIGITAL_UP, RIGHT_STICK_DIGITAL_UP];
|
||||
case Control.NOTE_DOWN:
|
||||
return [DPAD_DOWN, A, LEFT_STICK_DIGITAL_DOWN, RIGHT_STICK_DIGITAL_DOWN];
|
||||
case Control.NOTE_LEFT:
|
||||
return [DPAD_LEFT, X, LEFT_STICK_DIGITAL_LEFT, RIGHT_STICK_DIGITAL_LEFT];
|
||||
case Control.NOTE_RIGHT:
|
||||
return [DPAD_RIGHT, B, LEFT_STICK_DIGITAL_RIGHT, RIGHT_STICK_DIGITAL_RIGHT];
|
||||
case Control.PAUSE:
|
||||
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:
|
||||
// Fallthrough.
|
||||
}
|
||||
|
@ -967,8 +1003,7 @@ class Controls extends FlxActionSet
|
|||
|
||||
public function touchShit(control:Control, id)
|
||||
{
|
||||
forEachBound(control, function(action, state)
|
||||
{
|
||||
forEachBound(control, function(action, state) {
|
||||
// action
|
||||
});
|
||||
}
|
||||
|
@ -984,7 +1019,8 @@ class Controls extends FlxActionSet
|
|||
|
||||
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.
|
||||
action.addGamepad(button, state, id);
|
||||
}
|
||||
|
@ -996,29 +1032,25 @@ class Controls extends FlxActionSet
|
|||
while (i-- > 0)
|
||||
{
|
||||
var input = action.inputs[i];
|
||||
if (isGamepad(input, gamepadID) && buttons.indexOf(cast input.inputID) != -1)
|
||||
action.remove(input);
|
||||
if (isGamepad(input, gamepadID) && buttons.indexOf(cast input.inputID) != -1) action.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
public function getInputsFor(control:Control, device:Device, ?list:Array<Int>):Array<Int>
|
||||
{
|
||||
if (list == null)
|
||||
list = [];
|
||||
if (list == null) list = [];
|
||||
|
||||
switch(device)
|
||||
switch (device)
|
||||
{
|
||||
case Keys:
|
||||
for (input in getActionFromControl(control).inputs)
|
||||
{
|
||||
if (input.device == KEYBOARD)
|
||||
list.push(input.inputID);
|
||||
if (input.device == KEYBOARD) list.push(input.inputID);
|
||||
}
|
||||
case Gamepad(id):
|
||||
for (input in getActionFromControl(control).inputs)
|
||||
{
|
||||
if (isGamepad(input, id))
|
||||
list.push(input.inputID);
|
||||
if (isGamepad(input, id)) list.push(input.inputID);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
@ -1026,7 +1058,7 @@ class Controls extends FlxActionSet
|
|||
|
||||
public function removeDevice(device:Device)
|
||||
{
|
||||
switch(device)
|
||||
switch (device)
|
||||
{
|
||||
case Keys:
|
||||
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 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())
|
||||
{
|
||||
var inputs:Array<Int> = Reflect.field(data, control.getName());
|
||||
inputs = inputs.distinct();
|
||||
inputs = inputs?.distinct();
|
||||
if (inputs != null)
|
||||
{
|
||||
if (inputs.length == 0) {
|
||||
if (inputs.length == 0)
|
||||
{
|
||||
trace('Control ${control} is missing bindings, resetting to default.');
|
||||
switch(device)
|
||||
switch (device)
|
||||
{
|
||||
case Keys:
|
||||
bindKeys(control, getDefaultKeybinds(Solo, control));
|
||||
case Gamepad(id):
|
||||
bindButtons(control, id, getDefaultGamepadBinds(control));
|
||||
}
|
||||
} else if (inputs == [FlxKey.NONE]) {
|
||||
}
|
||||
else if (inputs == [FlxKey.NONE])
|
||||
{
|
||||
trace('Control ${control} is unbound, leaving it be.');
|
||||
} else {
|
||||
switch(device)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (device)
|
||||
{
|
||||
case Keys:
|
||||
bindKeys(control, inputs.copy());
|
||||
|
@ -1068,9 +1105,11 @@ class Controls extends FlxActionSet
|
|||
bindButtons(control, id, inputs.copy());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('Control ${control} is missing bindings, resetting to default.');
|
||||
switch(device)
|
||||
switch (device)
|
||||
{
|
||||
case Keys:
|
||||
bindKeys(control, getDefaultKeybinds(Solo, control));
|
||||
|
@ -1095,9 +1134,12 @@ class Controls extends FlxActionSet
|
|||
var inputs = getInputsFor(control, device);
|
||||
isEmpty = isEmpty && inputs.length == 0;
|
||||
|
||||
if (inputs.length == 0) {
|
||||
if (inputs.length == 0)
|
||||
{
|
||||
inputs = [FlxKey.NONE];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
inputs = inputs.distinct();
|
||||
}
|
||||
|
||||
|
@ -1109,7 +1151,7 @@ class Controls extends FlxActionSet
|
|||
|
||||
static function isDevice(input:FlxActionInput, device:Device)
|
||||
{
|
||||
return switch(device)
|
||||
return switch (device)
|
||||
{
|
||||
case Keys: input.device == KEYBOARD;
|
||||
case Gamepad(id): isGamepad(input, id);
|
||||
|
@ -1141,7 +1183,8 @@ typedef Swipes =
|
|||
* - Combining `pressed` and `released` inputs into one action.
|
||||
* - 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 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.
|
||||
*/
|
||||
public override function check():Bool {
|
||||
public override function check():Bool
|
||||
{
|
||||
return checkFiltered(JUST_PRESSED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the input is currently being held.
|
||||
*/
|
||||
public function checkPressed():Bool {
|
||||
public function checkPressed():Bool
|
||||
{
|
||||
return checkFiltered(PRESSED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the input is not currently being held.
|
||||
*/
|
||||
public function checkReleased():Bool {
|
||||
public function checkReleased():Bool
|
||||
{
|
||||
return checkFiltered(RELEASED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the input is currently being held by a gamepad device.
|
||||
*/
|
||||
public function checkPressedGamepad():Bool {
|
||||
public function checkPressedGamepad():Bool
|
||||
{
|
||||
return checkFiltered(PRESSED, GAMEPAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
public function checkMultiFiltered(?filterTriggers:Array<FlxInputState>, ?filterDevices:Array<FlxInputDevice>):Bool {
|
||||
if (filterTriggers == null) {
|
||||
public function checkMultiFiltered(?filterTriggers:Array<FlxInputState>, ?filterDevices:Array<FlxInputDevice>):Bool
|
||||
{
|
||||
if (filterTriggers == null)
|
||||
{
|
||||
filterTriggers = [PRESSED, JUST_PRESSED];
|
||||
}
|
||||
if (filterDevices == null) {
|
||||
if (filterDevices == null)
|
||||
{
|
||||
filterDevices = [];
|
||||
}
|
||||
|
||||
// Perform checkFiltered for each combination.
|
||||
for (i in filterTriggers) {
|
||||
if (filterDevices.length == 0) {
|
||||
if (checkFiltered(i)) {
|
||||
for (i in filterTriggers)
|
||||
{
|
||||
if (filterDevices.length == 0)
|
||||
{
|
||||
if (checkFiltered(i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
for (j in filterDevices) {
|
||||
if (checkFiltered(i, j)) {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j in filterDevices)
|
||||
{
|
||||
if (checkFiltered(i, j))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1249,52 +1311,56 @@ class FunkinAction extends FlxActionDigital {
|
|||
* @param filterTrigger Optionally filter by trigger condition (`JUST_PRESSED`, `PRESSED`, `JUST_RELEASED`, `RELEASED`).
|
||||
* @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
|
||||
|
||||
// Make sure we only update the inputs once per frame.
|
||||
var key = '${filterTrigger}:${filterDevice}';
|
||||
var cacheEntry = cache.get(key);
|
||||
|
||||
if (cacheEntry != null && cacheEntry.timestamp == FlxG.game.ticks) {
|
||||
if (cacheEntry != null && cacheEntry.timestamp == FlxG.game.ticks)
|
||||
{
|
||||
return cacheEntry.value;
|
||||
}
|
||||
// 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.
|
||||
var result = false;
|
||||
var len = inputs != null ? inputs.length : 0;
|
||||
for (i in 0...len)
|
||||
{
|
||||
var j = len - i - 1;
|
||||
var input = inputs[j];
|
||||
var len = inputs != null ? inputs.length : 0;
|
||||
for (i in 0...len)
|
||||
{
|
||||
var j = len - i - 1;
|
||||
var input = inputs[j];
|
||||
|
||||
// Filter out dead inputs.
|
||||
if (input.destroyed)
|
||||
{
|
||||
inputs.splice(j, 1);
|
||||
continue;
|
||||
}
|
||||
if (input.destroyed)
|
||||
{
|
||||
inputs.splice(j, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update the input.
|
||||
input.update();
|
||||
|
||||
// Check whether the input is the right trigger.
|
||||
if (filterTrigger != null && input.trigger != filterTrigger) {
|
||||
if (filterTrigger != null && input.trigger != filterTrigger)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check whether the input is the right device.
|
||||
if (filterDevice != null && input.device != filterDevice) {
|
||||
if (filterDevice != null && input.device != filterDevice)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check whether the input has triggered.
|
||||
if (input.check(this))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if (input.check(this))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
// We need to cache this result.
|
||||
cache.set(key, {timestamp: FlxG.game.ticks, value: result});
|
||||
|
@ -1391,12 +1457,12 @@ class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital
|
|||
{
|
||||
var degAngle = FlxAngle.asDegrees(swp.touchAngle);
|
||||
|
||||
switch(trigger)
|
||||
switch (trigger)
|
||||
{
|
||||
case JUST_PRESSED:
|
||||
if (swp.touchLength >= activateLength)
|
||||
{
|
||||
switch(inputID)
|
||||
switch (inputID)
|
||||
{
|
||||
case FlxDirectionFlags.UP:
|
||||
if (degAngle >= 45 && degAngle <= 90 + 45) return properTouch(swp);
|
||||
|
@ -1440,7 +1506,7 @@ class FlxActionInputDigitalAndroid extends FlxActionInputDigital
|
|||
|
||||
override public function check(Action:FlxAction):Bool
|
||||
{
|
||||
return switch(trigger)
|
||||
return switch (trigger)
|
||||
{
|
||||
#if android
|
||||
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.CountdownScriptEvent;
|
||||
import flixel.util.FlxTimer;
|
||||
import funkin.util.EaseUtil;
|
||||
import funkin.audio.FunkinSound;
|
||||
|
||||
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.
|
||||
*/
|
||||
public static function pauseCountdown()
|
||||
public static function pauseCountdown():Void
|
||||
{
|
||||
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.
|
||||
*/
|
||||
public static function resumeCountdown()
|
||||
public static function resumeCountdown():Void
|
||||
{
|
||||
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.
|
||||
*/
|
||||
public static function stopCountdown()
|
||||
public static function stopCountdown():Void
|
||||
{
|
||||
if (countdownTimer != null)
|
||||
{
|
||||
|
@ -156,7 +157,7 @@ class Countdown
|
|||
/**
|
||||
* Stops the current countdown, then starts the song for you.
|
||||
*/
|
||||
public static function skipCountdown()
|
||||
public static function skipCountdown():Void
|
||||
{
|
||||
stopCountdown();
|
||||
// This will trigger PlayState.startSong()
|
||||
|
@ -185,8 +186,11 @@ class Countdown
|
|||
{
|
||||
var spritePath:String = null;
|
||||
|
||||
var fadeEase = FlxEase.cubeInOut;
|
||||
|
||||
if (isPixelStyle)
|
||||
{
|
||||
fadeEase = EaseUtil.stepped(8);
|
||||
switch (index)
|
||||
{
|
||||
case TWO:
|
||||
|
@ -227,7 +231,7 @@ class Countdown
|
|||
countdownSprite.screenCenter();
|
||||
|
||||
// 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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import funkin.ui.MusicBeatSubState;
|
|||
import funkin.ui.story.StoryMenuState;
|
||||
import funkin.util.MathUtil;
|
||||
import openfl.utils.Assets;
|
||||
import funkin.effects.RetroCameraFade;
|
||||
|
||||
/**
|
||||
* A substate which renders over the PlayState when the player dies.
|
||||
|
@ -144,6 +145,7 @@ class GameOverSubState extends MusicBeatSubState
|
|||
else
|
||||
{
|
||||
boyfriend = PlayState.instance.currentStage.getBoyfriend(true);
|
||||
boyfriend.canPlayOtherAnims = true;
|
||||
boyfriend.isDead = true;
|
||||
add(boyfriend);
|
||||
boyfriend.resetCharacter();
|
||||
|
@ -331,9 +333,12 @@ class GameOverSubState extends MusicBeatSubState
|
|||
// After the animation finishes...
|
||||
new FlxTimer().start(0.7, function(tmr:FlxTimer) {
|
||||
// ...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.
|
||||
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;
|
||||
|
||||
if (PlayState.instance.isMinimalMode || boyfriend == null) {}
|
||||
|
@ -350,7 +355,22 @@ class GameOverSubState extends MusicBeatSubState
|
|||
|
||||
// Close the substate.
|
||||
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;
|
||||
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);
|
||||
// Prevent off-by-one errors.
|
||||
|
||||
|
|
|
@ -305,8 +305,8 @@ class CharacterDataParser
|
|||
icon = "darnell";
|
||||
case "senpai-angry":
|
||||
icon = "senpai";
|
||||
case "tankman" | "tankman-atlas":
|
||||
icon = "tankmen";
|
||||
case "tankman-atlas":
|
||||
icon = "tankman";
|
||||
}
|
||||
|
||||
var path = Paths.image("freeplay/icons/" + icon + "pixel");
|
||||
|
|
|
@ -41,6 +41,8 @@ class MultiSparrowCharacter extends BaseCharacter
|
|||
{
|
||||
this.isPixel = true;
|
||||
this.antialiasing = false;
|
||||
pixelPerfectRender = true;
|
||||
pixelPerfectPosition = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -43,6 +43,8 @@ class PackerCharacter extends BaseCharacter
|
|||
{
|
||||
this.isPixel = true;
|
||||
this.antialiasing = false;
|
||||
pixelPerfectRender = true;
|
||||
pixelPerfectPosition = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -46,6 +46,8 @@ class SparrowCharacter extends BaseCharacter
|
|||
{
|
||||
this.isPixel = true;
|
||||
this.antialiasing = false;
|
||||
pixelPerfectRender = true;
|
||||
pixelPerfectPosition = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -7,8 +7,9 @@ import flixel.util.FlxDirection;
|
|||
import funkin.graphics.FunkinSprite;
|
||||
import funkin.play.PlayState;
|
||||
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];
|
||||
|
||||
|
@ -17,7 +18,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
super();
|
||||
}
|
||||
|
||||
public function displayRating(daRating:String)
|
||||
public function displayRating(daRating:String):Void
|
||||
{
|
||||
var perfStart:Float = TimerUtil.start();
|
||||
|
||||
|
@ -40,10 +41,15 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
|
||||
add(rating);
|
||||
|
||||
var fadeEase = null;
|
||||
|
||||
if (PlayState.instance.currentStageId.startsWith('school'))
|
||||
{
|
||||
rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7));
|
||||
rating.antialiasing = false;
|
||||
rating.pixelPerfectRender = true;
|
||||
rating.pixelPerfectPosition = true;
|
||||
fadeEase = EaseUtil.stepped(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -61,7 +67,8 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
remove(rating, true);
|
||||
rating.destroy();
|
||||
},
|
||||
startDelay: Conductor.instance.beatLengthMs * 0.001
|
||||
startDelay: Conductor.instance.beatLengthMs * 0.001,
|
||||
ease: fadeEase
|
||||
});
|
||||
|
||||
trace('displayRating took: ${TimerUtil.seconds(perfStart)}');
|
||||
|
@ -92,10 +99,15 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
|
||||
// add(comboSpr);
|
||||
|
||||
var fadeEase = null;
|
||||
|
||||
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.pixelPerfectRender = true;
|
||||
comboSpr.pixelPerfectPosition = true;
|
||||
fadeEase = EaseUtil.stepped(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,7 +122,8 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
remove(comboSpr, true);
|
||||
comboSpr.destroy();
|
||||
},
|
||||
startDelay: Conductor.instance.beatLengthMs * 0.001
|
||||
startDelay: Conductor.instance.beatLengthMs * 0.001,
|
||||
ease: fadeEase
|
||||
});
|
||||
|
||||
var seperatedScore:Array<Int> = [];
|
||||
|
@ -133,8 +146,10 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
|
||||
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.pixelPerfectRender = true;
|
||||
numScore.pixelPerfectPosition = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -156,7 +171,8 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
|||
remove(numScore, true);
|
||||
numScore.destroy();
|
||||
},
|
||||
startDelay: Conductor.instance.beatLengthMs * 0.002
|
||||
startDelay: Conductor.instance.beatLengthMs * 0.002,
|
||||
ease: fadeEase
|
||||
});
|
||||
|
||||
daLoop++;
|
||||
|
|
|
@ -200,12 +200,10 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
{
|
||||
if (hasDanced)
|
||||
{
|
||||
trace('DanceRight (alternate)');
|
||||
playAnimation('danceRight$idleSuffix', forceRestart);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('DanceLeft (alternate)');
|
||||
playAnimation('danceLeft$idleSuffix', forceRestart);
|
||||
}
|
||||
hasDanced = !hasDanced;
|
||||
|
|
|
@ -249,6 +249,10 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
|
|||
// If pixel, disable antialiasing.
|
||||
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.y = dataProp.scroll[1];
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ class MenuItem extends FlxSpriteGroup
|
|||
{
|
||||
public var targetY:Float = 0;
|
||||
public var week:FlxSprite;
|
||||
public var flashingInt:Int = 0;
|
||||
|
||||
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 flashTick:Float = 0;
|
||||
final flashFramerate:Float = 20;
|
||||
|
||||
public function startFlashing():Void
|
||||
{
|
||||
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)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = MathUtil.coolLerp(y, (targetY * 120) + 480, 0.17);
|
||||
|
||||
if (isFlashing) flashingInt += 1;
|
||||
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) week.color = 0xFF33ffff;
|
||||
else
|
||||
week.color = FlxColor.WHITE;
|
||||
if (isFlashing)
|
||||
{
|
||||
flashTick += elapsed;
|
||||
if (flashTick >= 1 / flashFramerate)
|
||||
{
|
||||
flashTick %= 1 / flashFramerate;
|
||||
week.color = (week.color == FlxColor.WHITE) ? 0xFF33ffff : FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
super(FlxColor.TRANSPARENT);
|
||||
|
||||
if (stickers != null)
|
||||
if (stickers?.members != null)
|
||||
{
|
||||
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
|
||||
// otherwise it won't be properly attatched to funnyCamera (relavent code should be at the bottom of create())
|
||||
var onDJIntroDone = function() {
|
||||
|
||||
// when boyfriend hits dat shiii
|
||||
|
||||
albumRoll.playIntro();
|
||||
|
@ -693,9 +692,12 @@ class FreeplayState extends MusicBeatSubState
|
|||
}
|
||||
};
|
||||
|
||||
if (dj != null) {
|
||||
if (dj != null)
|
||||
{
|
||||
dj.onIntroDone.add(onDJIntroDone);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
onDJIntroDone();
|
||||
}
|
||||
|
||||
|
@ -1775,7 +1777,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
if (dj != null) dj.confirm();
|
||||
|
||||
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(pinkBack, 0.33, 0xFFFFD0D5, 0xFF171831, {ease: FlxEase.quadOut});
|
||||
|
@ -1947,6 +1949,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
startingVolume: 0.0,
|
||||
overrideExisting: true,
|
||||
restartTrack: false,
|
||||
mapTimeChanges: false, // The music metadata is not alongside the audio file so this won't work.
|
||||
pathsFunction: INST,
|
||||
suffix: instSuffix,
|
||||
partialParams:
|
||||
|
@ -2097,6 +2100,8 @@ class FreeplaySongData
|
|||
|
||||
function set_currentDifficulty(value:String):String
|
||||
{
|
||||
if (currentDifficulty == value) return value;
|
||||
|
||||
currentDifficulty = value;
|
||||
updateValues(displayedVariations);
|
||||
return value;
|
||||
|
@ -2153,7 +2158,7 @@ class FreeplaySongData
|
|||
{
|
||||
this.albumId = songDifficulty.album;
|
||||
}
|
||||
|
||||
|
||||
// TODO: This line of code makes me sad, but you can't really fix it without a breaking migration.
|
||||
// `easy`, `erect`, `normal-pico`, etc.
|
||||
var suffixedDifficulty = (songDifficulty.variation != Constants.DEFAULT_VARIATION
|
||||
|
|
|
@ -213,6 +213,7 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
favIconBlurred.frames = Paths.getSparrowAtlas('freeplay/favHeart');
|
||||
favIconBlurred.animation.addByPrefix('fav', 'favorite heart', 24, false);
|
||||
favIconBlurred.animation.play('fav');
|
||||
|
||||
favIconBlurred.setGraphicSize(50, 50);
|
||||
favIconBlurred.blend = BlendMode.ADD;
|
||||
favIconBlurred.shader = new GaussianBlurShader(1.2);
|
||||
|
@ -516,6 +517,9 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
updateDifficultyRating(songData?.difficultyRating ?? 0);
|
||||
updateScoringRank(songData?.scoringRank);
|
||||
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.
|
||||
updateSelected();
|
||||
|
||||
|
@ -539,8 +543,6 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
charPath += 'monsterpixel';
|
||||
case 'mom-car':
|
||||
charPath += 'mommypixel';
|
||||
case 'dad':
|
||||
charPath += 'daddypixel';
|
||||
case 'darnell-blazin':
|
||||
charPath += 'darnellpixel';
|
||||
case 'senpai-angry':
|
||||
|
@ -555,7 +557,17 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
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;
|
||||
|
||||
switch (char)
|
||||
|
@ -567,6 +579,22 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
}
|
||||
// pixelIcon.origin.x = capsule.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;
|
||||
|
@ -707,6 +735,18 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
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
|
||||
{
|
||||
return (index * ((height * realScaled) + 10)) + 120;
|
||||
|
|
|
@ -156,6 +156,9 @@ class MainMenuState extends MusicBeatState
|
|||
|
||||
resetCamStuff();
|
||||
|
||||
// reset camera when debug menu is closed
|
||||
subStateClosed.add(_ -> resetCamStuff(false));
|
||||
|
||||
subStateOpened.add(sub -> {
|
||||
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.snapToTarget();
|
||||
|
||||
if (snap) FlxG.camera.snapToTarget();
|
||||
}
|
||||
|
||||
function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void
|
||||
|
@ -347,8 +351,6 @@ class MainMenuState extends MusicBeatState
|
|||
persistentUpdate = false;
|
||||
|
||||
FlxG.state.openSubState(new DebugMenuSubState());
|
||||
// reset camera when debug menu is closed
|
||||
subStateClosed.addOnce(_ -> resetCamStuff());
|
||||
}
|
||||
#end
|
||||
|
||||
|
|
|
@ -13,13 +13,10 @@ class LevelTitle extends FlxSpriteGroup
|
|||
public final level:Level;
|
||||
|
||||
public var targetY:Float;
|
||||
public var isFlashing:Bool = false;
|
||||
|
||||
var title:FlxSprite;
|
||||
var lock:FlxSprite;
|
||||
|
||||
var flashingInt:Int = 0;
|
||||
|
||||
public function new(x:Int, y:Int, level:Level)
|
||||
{
|
||||
super(x, y);
|
||||
|
@ -46,20 +43,23 @@ class LevelTitle extends FlxSpriteGroup
|
|||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
public var isFlashing:Bool = false;
|
||||
var flashTick:Float = 0;
|
||||
final flashFramerate:Float = 20;
|
||||
|
||||
public override function update(elapsed:Float):Void
|
||||
{
|
||||
this.y = MathUtil.coolLerp(y, targetY, 0.17);
|
||||
|
||||
if (isFlashing) flashingInt += 1;
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) title.color = 0xFF33ffff;
|
||||
else
|
||||
title.color = FlxColor.WHITE;
|
||||
if (isFlashing)
|
||||
{
|
||||
flashTick += elapsed;
|
||||
if (flashTick >= 1 / flashFramerate)
|
||||
{
|
||||
flashTick %= 1 / flashFramerate;
|
||||
title.color = (title.color == FlxColor.WHITE) ? 0xFF33ffff : FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function showLock():Void
|
||||
|
|
|
@ -113,7 +113,7 @@ class StoryMenuState extends MusicBeatState
|
|||
{
|
||||
super();
|
||||
|
||||
if (stickers != null)
|
||||
if (stickers?.members != null)
|
||||
{
|
||||
stickerSubState = stickers;
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ class LoadingState extends MusicBeatSubState
|
|||
return 'Done precaching ${path}';
|
||||
}, true);
|
||||
|
||||
trace("Queued ${path} for precaching");
|
||||
trace('Queued ${path} for precaching');
|
||||
// FunkinSprite.cacheTexture(path);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class AnsiTrace
|
|||
|
||||
public static function traceBF()
|
||||
{
|
||||
#if sys
|
||||
#if (sys && debug)
|
||||
if (colorSupported)
|
||||
{
|
||||
for (line in ansiBF)
|
||||
|
|
Loading…
Reference in a new issue