Merge branch 'main' into pr/397

This commit is contained in:
Ne_Eo
2024-10-15 23:44:28 +02:00
7 changed files with 48 additions and 17 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
function postHide() {
if(curTween != null) {
if(animation.curAnim?.name == 'angry-show') curTween.cancel();
if(getAnimName() == 'angry-show') curTween.cancel();
else curTween.percent = 1;
}
}
+14 -1
View File
@@ -1,5 +1,7 @@
package funkin.backend;
import flixel.animation.FlxAnimation;
import flxanimate.animate.FlxAnim.FlxSymbolAnimation;
import funkin.backend.utils.XMLUtil.BeatAnim;
import funkin.backend.utils.XMLUtil.AnimData;
import funkin.backend.utils.XMLUtil.IXMLEvents;
@@ -11,6 +13,7 @@ import funkin.backend.system.interfaces.IOffsetCompatible;
import flixel.math.FlxMatrix;
import flixel.math.FlxRect;
import flixel.math.FlxPoint;
import flixel.util.typeLimit.OneOfTwo;
import funkin.backend.system.interfaces.IBeatReceiver;
enum abstract XMLAnimType(Int)
@@ -325,6 +328,12 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
lastAnimContext = Context;
}
public function getAnim(name:String):OneOfTwo<FlxAnimation, FlxSymbolAnimation> {
if(animateAtlas != null)
return animateAtlas.anim.getByName(name);
return animation.getByName(name);
}
public inline function getAnimOffset(name:String)
{
if (animOffsets.exists(name))
@@ -378,7 +387,11 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
public inline function isAnimFinished()
{
return animateAtlas != null ? (animateAtlas.anim.finished) : (animation.curAnim != null ? animation.curAnim.finished : true);
return animateAtlas != null ? animateAtlas.anim.finished : (animation.curAnim != null ? animation.curAnim.finished : true);
}
public inline function isAnimAtEnd() {
return animateAtlas != null ? animateAtlas.anim.isAtEnd : (animation.curAnim != null ? animation.curAnim.isAtEnd : false);
}
#end
+13 -2
View File
@@ -116,17 +116,28 @@ class Paths
return scriptPath;
}
static public function chart(song:String, ?difficulty:String = "normal"):String {
static public function chart(song:String, ?difficulty:String = "normal"):String
{
difficulty = difficulty.toLowerCase();
song = song.toLowerCase();
return getPath('songs/$song/charts/$difficulty.json', null);
}
static public function character(character:String):String {
inline static public function character(character:String):String
{
return getPath('data/characters/$character.xml', null);
}
/**
* Gets the name of a registered font.
* @param font The font's path (if it's already passed as a font name, the same name will be returned)
*/
inline static public function getFontName(font:String)
{
return OpenFlAssets.exists(font, FONT) ? OpenFlAssets.getFont(font).fontName : font;
}
inline static public function font(key:String)
{
return getPath('fonts/$key');
+1 -1
View File
@@ -582,7 +582,7 @@ class CoolUtil
var fmt = new FlxTextFormat();
fmt.format.color = Reflect.hasField(fmtt, "color") ? FlxColor.fromString(fmtt.color) : text.color;
fmt.format.font = Reflect.hasField(fmtt, "font") ? Paths.font(fmtt.font) : text.font;
fmt.format.font = Reflect.hasField(fmtt, "font") ? Paths.getFontName(Paths.font(fmtt.font)) : text.font;
fmt.format.size = Reflect.hasField(fmtt, "size") ? Std.parseInt(fmtt.size) : text.size;
fmt.format.italic = Reflect.hasField(fmtt, "italic") ? fmtt.italic == "true" : text.italic;
fmt.format.bold = Reflect.hasField(fmtt, "bold") ? fmtt.bold == "true" : text.bold;
+5 -5
View File
@@ -865,12 +865,12 @@ class PlayState extends MusicBeatState
Conductor.songPosition = 0;
Conductor.songPosition -= Conductor.crochet * introLength - Conductor.songOffset;
if(introLength > 0) {
var swagCounter:Int = 0;
startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
{
startTimer = new FlxTimer().start(Conductor.crochet / 1000, (tmr:FlxTimer) -> {
countdown(swagCounter++);
}, introLength);
}
scripts.call("onPostStartCountdown");
}
@@ -1047,7 +1047,7 @@ class PlayState extends MusicBeatState
vocals.pause();
}
if (!startTimer.finished)
if (startTimer != null && !startTimer.finished)
startTimer.active = false;
}
@@ -1067,7 +1067,7 @@ class PlayState extends MusicBeatState
resyncVocals();
}
if (!startTimer.finished)
if (startTimer != null && !startTimer.finished)
startTimer.active = true;
paused = false;
+1 -1
View File
@@ -309,7 +309,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
babyArrow.scrollSpeed = data.scrollSpeed;
var event = EventManager.get(StrumCreationEvent).recycle(babyArrow, PlayState.instance.strumLines.members.indexOf(this), i, animPrefix);
event.__doAnimation = !MusicBeatState.skipTransIn;
event.__doAnimation = !MusicBeatState.skipTransIn && (PlayState.instance != null ? PlayState.instance.introLength > 0 : true);
event = PlayState.instance.scripts.event("onStrumCreation", event);
if (!event.cancelled) {
@@ -11,9 +11,11 @@ using StringTools;
class CreditsCodename extends funkin.options.OptionsScreen {
public var error:Bool = false;
public var author:String = "FNF-CNE-Devs";
public var totalContributions:Int = 0;
public var mainDevCol:FlxColor = 0xFF9C35D5;
public var minContrCol:FlxColor = 0xFFB4A7DA;
public var totalContributions:Int = 0;
public var contribFormats:Array<FlxTextFormatMarkerPair> = [];
public override function new()
{
@@ -58,12 +60,17 @@ class CreditsCodename extends funkin.options.OptionsScreen {
if(parent == null || parent.treeParent == null) return;
var text:String = parent.treeParent.pathDesc.text;
parent.treeParent.pathDesc.text = "";
parent.treeParent.pathDesc.applyMarkup(text, [
parent.treeParent.pathDesc.applyMarkup(text, contribFormats = [
new FlxTextFormatMarkerPair(new FlxTextFormat(mainDevCol), '*'),
new FlxTextFormatMarkerPair(new FlxTextFormat(FlxColor.interpolate(minContrCol, mainDevCol, Options.contributors[curSelected].contributions / totalContributions)), '~')
]);
}
override function close() {
super.close();
for (frmt in contribFormats) parent.treeParent.pathDesc.removeFormat(frmt.format);
}
public function checkUpdate():Bool {
var curTime:Float = Date.now().getTime();
if(Options.lastUpdated != null && curTime < Options.lastUpdated + 120000) return false; // Fuck you Github rate limits - Nex