This commit is contained in:
NeeEoo
2024-03-16 21:44:28 +01:00
parent 5630bfa4ee
commit 56bba6a822
6 changed files with 40 additions and 30 deletions
+11 -2
View File
@@ -42,9 +42,9 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
public var animDatas:Map<String, AnimData> = []; public var animDatas:Map<String, AnimData> = [];
/** /**
* ODD interval -> asycned; EVEN interval -> synced * ODD interval -> asynced; EVEN interval -> synced
*/ */
public var beatInterval:Int = 2; public var beatInterval(default, set):Int = 2;
public var beatOffset:Int = 0; public var beatOffset:Int = 0;
public var skipNegativeBeats:Bool = false; public var skipNegativeBeats:Bool = false;
@@ -361,4 +361,13 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
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);
} }
#end #end
// Getter / Setters
@:noCompletion private function set_beatInterval(v:Int) {
if (v < 1)
v = 1;
return beatInterval = v;
}
} }
@@ -181,7 +181,7 @@ class CharacterInfoScreen extends UISubstateWindow {
xml.set("antialiasing", antialiasingCheckbox.checked ? "true" : "false"); xml.set("antialiasing", antialiasingCheckbox.checked ? "true" : "false");
xml.set("sprite", spriteTextBox.label.text); xml.set("sprite", spriteTextBox.label.text);
if (iconColorWheel.colorChanged) if (iconColorWheel.colorChanged)
xml.set("color", iconColorWheel.curColor.toHexString(false).replace("0x", "#")); xml.set("color", iconColorWheel.curColor.toWebString());
for (val in customPropertiesButtonList.buttons.members) for (val in customPropertiesButtonList.buttons.members)
xml.set(val.propertyText.label.text, val.valueText.label.text); xml.set(val.propertyText.label.text, val.valueText.label.text);
+1 -1
View File
@@ -108,7 +108,7 @@ class UIColorwheel extends UISliceSprite {
colorPickerSelector.curColor = color = curColor = FlxColor.fromHSB(hue, saturation, brightness); colorSliderSelector.curColor = FlxColor.fromHSB(hue, 1, 1); colorPickerSelector.curColor = color = curColor = FlxColor.fromHSB(hue, saturation, brightness); colorSliderSelector.curColor = FlxColor.fromHSB(hue, 1, 1);
updateColorPickerSelector(); updateColorSliderPickerSelector(); updateColorPickerSelector(); updateColorSliderPickerSelector();
colorHexTextBox.label.text = curColorString = curColor.toHexString(false).replace("0x", "#"); colorHexTextBox.label.text = curColorString = curColor.toWebString();
for (numStepper in rgbNumSteppers) { for (numStepper in rgbNumSteppers) {
numStepper.label.text = Std.string(switch (numStepper.ID) { numStepper.label.text = Std.string(switch (numStepper.ID) {
default: curColor.red; default: curColor.red;
+24 -20
View File
@@ -1,6 +1,5 @@
package funkin.game; package funkin.game;
import haxe.xml.Printer;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import funkin.backend.FunkinSprite; import funkin.backend.FunkinSprite;
import flixel.graphics.frames.FlxFrame; import flixel.graphics.frames.FlxFrame;
@@ -8,8 +7,6 @@ import flixel.math.FlxPoint;
import funkin.backend.system.interfaces.IBeatReceiver; import funkin.backend.system.interfaces.IBeatReceiver;
import funkin.backend.system.interfaces.IOffsetCompatible; import funkin.backend.system.interfaces.IOffsetCompatible;
import funkin.backend.utils.XMLUtil; import funkin.backend.utils.XMLUtil;
import flixel.animation.FlxBaseAnimation;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxRect; import flixel.math.FlxRect;
import haxe.xml.Access; import haxe.xml.Access;
import haxe.Exception; import haxe.Exception;
@@ -35,12 +32,6 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
public var stunned(default, set):Bool = false; public var stunned(default, set):Bool = false;
private function set_stunned(b:Bool)
{
__stunnedTime = 0;
return stunned = b;
}
public var isPlayer:Bool = false; public var isPlayer:Bool = false;
public var isGF:Bool = false; public var isGF:Bool = false;
public var curCharacter:String = 'bf'; public var curCharacter:String = 'bf';
@@ -80,10 +71,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
{ {
var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"]; var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
var event = EventManager.get(DirectionAnimEvent).recycle('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame, Force); var event = EventManager.get(DirectionAnimEvent).recycle(anims[direction] + suffix, direction, suffix, Context, Reversed, Frame, Force);
script.call("onPlaySingAnim", [event]); script.call("onPlaySingAnim", [event]);
if (!event.cancelled) if (!event.cancelled)
playAnim(event.animName, event.force, Context, event.reversed, event.frame); playAnim(event.animName, event.force, event.context, event.reversed, event.frame);
} }
public function new(x:Float, y:Float, ?character:String = "bf", isPlayer:Bool = false, switchAnims:Bool = true) public function new(x:Float, y:Float, ?character:String = "bf", isPlayer:Bool = false, switchAnims:Bool = true)
@@ -250,17 +241,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
*/ */
public var danceOnBeat:Bool = true; public var danceOnBeat:Bool = true;
/**
* Interval at which the character will dance (higher number = slower dance)
*/
public var danceInterval:Int = 1;
public override function beatHit(curBeat:Int) { public override function beatHit(curBeat:Int) {
script.call("beatHit", [curBeat]); script.call("beatHit", [curBeat]);
if (danceInterval < 1)
danceInterval = 1;
if (danceOnBeat && curBeat % danceInterval == 0 && !__lockAnimThisFrame) if (danceOnBeat && (curBeat + beatOffset) % beatInterval == 0 && !__lockAnimThisFrame)
{ {
tryDance(); tryDance();
} }
@@ -448,7 +432,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
xml.set("flipX", Std.string(flipX)); xml.set("flipX", Std.string(flipX));
xml.set("icon", getIcon()); xml.set("icon", getIcon());
if (iconColor != null) if (iconColor != null)
xml.set("color", iconColor.toHexString(false).replace("0x", "#")); xml.set("color", iconColor.toWebString());
xml.set("scale", Std.string(scale.x)); xml.set("scale", Std.string(scale.x));
xml.set("antialiasing", antialiasing == true ? "true" : "false"); xml.set("antialiasing", antialiasing == true ? "true" : "false");
xml.set("sprite", sprite); xml.set("sprite", sprite);
@@ -474,6 +458,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
var offset:FlxPoint = getAnimOffset(anim.name); var offset:FlxPoint = getAnimOffset(anim.name);
animXml.set("x", Std.string(offset.x)); animXml.set("x", Std.string(offset.x));
animXml.set("y", Std.string(offset.y)); animXml.set("y", Std.string(offset.y));
offset.putWeak();
if (anim.indices.length > 0) if (anim.indices.length > 0)
animXml.set("indices", anim.indices.join(",")); animXml.set("indices", anim.indices.join(","));
xml.addChild(animXml); xml.addChild(animXml);
@@ -490,6 +475,25 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
return [for(a in xml.nodes.anim) if(a.has.name) a.att.name]; return [for(a in xml.nodes.anim) if(a.has.name) a.att.name];
} }
// Getters / Setters
@:noCompletion private function set_stunned(b:Bool)
{
__stunnedTime = 0;
return stunned = b;
}
// Backwards Compat
/**
* Interval at which the character will dance (higher number = slower dance)
*/
@:noCompletion public var danceInterval(get, set):Int;
@:noCompletion private function set_danceInterval(v:Int)
return beatInterval = v;
@:noCompletion private function get_danceInterval()
return beatInterval;
// Statics // Statics
public static function getIconFromCharName(?curCharacter:String) { public static function getIconFromCharName(?curCharacter:String) {
+2 -2
View File
@@ -1846,10 +1846,10 @@ class PlayState extends MusicBeatState
private inline function get_playerStrums():StrumLine private inline function get_playerStrums():StrumLine
return strumLines.members[1]; return strumLines.members[1];
private inline function get_gfSpeed():Int private inline function get_gfSpeed():Int
return (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) ? strumLines.members[2].characters[0].danceInterval : 1; return (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) ? strumLines.members[2].characters[0].beatInterval : 1;
private inline function set_gfSpeed(v:Int):Int { private inline function set_gfSpeed(v:Int):Int {
if (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) if (strumLines.members[2] != null && strumLines.members[2].characters[0] != null)
strumLines.members[2].characters[0].danceInterval = v; strumLines.members[2].characters[0].beatInterval = v;
return v; return v;
} }
+1 -4
View File
@@ -53,10 +53,7 @@ class OptionsTree extends FlxTypedGroup<OptionsScreen> {
} }
public function clearLastMenu() { public function clearLastMenu() {
if (lastMenu != null) { lastMenu = FlxDestroyUtil.destroy(lastMenu);
lastMenu.destroy();
lastMenu = null;
}
} }
public override function destroy() { public override function destroy() {