mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-09-05 05:07:39 +00:00
Compare commits
No commits in common. "f7daadb5c570572c1a6747cda40e8181a9cf9bf0" and "ba201f4b66e6867f0b9ae71e098f021002eca3c9" have entirely different histories.
f7daadb5c5
...
ba201f4b66
|
@ -103,10 +103,6 @@ class PlayerFreeplayDJData
|
||||||
var assetPath:String;
|
var assetPath:String;
|
||||||
var animations:Array<AnimationData>;
|
var animations:Array<AnimationData>;
|
||||||
|
|
||||||
@:optional
|
|
||||||
@:default(false)
|
|
||||||
var legacyBoundsPosition:Bool;
|
|
||||||
|
|
||||||
@:optional
|
@:optional
|
||||||
@:default("BOYFRIEND")
|
@:default("BOYFRIEND")
|
||||||
var text1:String;
|
var text1:String;
|
||||||
|
@ -158,11 +154,6 @@ class PlayerFreeplayDJData
|
||||||
return assetPath;
|
return assetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function useLegacyBoundsPosition():Bool
|
|
||||||
{
|
|
||||||
return legacyBoundsPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFreeplayDJText(index:Int):String
|
public function getFreeplayDJText(index:Int):String
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
|
@ -343,10 +334,6 @@ typedef PlayerResultsAnimationData =
|
||||||
*/
|
*/
|
||||||
var renderType:String;
|
var renderType:String;
|
||||||
|
|
||||||
@:optional
|
|
||||||
@:default(false)
|
|
||||||
var legacyBoundsPosition:Bool;
|
|
||||||
|
|
||||||
@:optional
|
@:optional
|
||||||
var assetPath:Null<String>;
|
var assetPath:Null<String>;
|
||||||
|
|
||||||
|
|
|
@ -86,12 +86,6 @@ typedef AtlasSpriteSettings =
|
||||||
*/
|
*/
|
||||||
@:optional
|
@:optional
|
||||||
var applyStageMatrix:Bool;
|
var applyStageMatrix:Bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether to use legacy bounds positioning.
|
|
||||||
*/
|
|
||||||
@:optional
|
|
||||||
var legacyBoundsPosition:Bool;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,25 +96,6 @@ typedef AtlasSpriteSettings =
|
||||||
@:nullSafety
|
@:nullSafety
|
||||||
class FunkinSprite extends FlxAnimate
|
class FunkinSprite extends FlxAnimate
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* NOTE: This will only work on texture atlases.
|
|
||||||
*
|
|
||||||
* If enabled, the sprite will be offset using the bounds origin.
|
|
||||||
* This imitates the behavior of the legacy bounds FlxAnimate had.
|
|
||||||
* Turning this on is not recommended, only use this if you know what you're doing.
|
|
||||||
* It's also worth noting that not all atlases will react correctly, some may need position tweaks.
|
|
||||||
*/
|
|
||||||
public var legacyBoundsPosition(default, set):Bool = false;
|
|
||||||
|
|
||||||
public function set_legacyBoundsPosition(value:Bool):Bool
|
|
||||||
{
|
|
||||||
if (!this.isAnimate) return false;
|
|
||||||
|
|
||||||
this.legacyBoundsPosition = value;
|
|
||||||
this.applyStageMatrix = value;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param x Starting X position
|
* @param x Starting X position
|
||||||
* @param y Starting Y position
|
* @param y Starting Y position
|
||||||
|
@ -133,7 +108,7 @@ class FunkinSprite extends FlxAnimate
|
||||||
override function initVars():Void
|
override function initVars():Void
|
||||||
{
|
{
|
||||||
super.initVars();
|
super.initVars();
|
||||||
|
// TODO: Make `animation` a stub that redirects calls to `mainSprite`?
|
||||||
var newController:FunkinAnimationController = new FunkinAnimationController(this);
|
var newController:FunkinAnimationController = new FunkinAnimationController(this);
|
||||||
|
|
||||||
animation = newController;
|
animation = newController;
|
||||||
|
@ -307,8 +282,7 @@ class FunkinSprite extends FlxAnimate
|
||||||
cacheKey: settings?.cacheKey ?? null,
|
cacheKey: settings?.cacheKey ?? null,
|
||||||
uniqueInCache: settings?.uniqueInCache ?? false,
|
uniqueInCache: settings?.uniqueInCache ?? false,
|
||||||
onSymbolCreate: settings?.onSymbolCreate ?? null,
|
onSymbolCreate: settings?.onSymbolCreate ?? null,
|
||||||
legacyBoundsPosition: settings?.legacyBoundsPosition ?? false,
|
applyStageMatrix: settings?.applyStageMatrix ?? false
|
||||||
applyStageMatrix: (settings?.applyStageMatrix ?? false || settings?.legacyBoundsPosition ?? false)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var assetLibrary:String = assetLibrary ?? "";
|
var assetLibrary:String = assetLibrary ?? "";
|
||||||
|
@ -330,7 +304,6 @@ class FunkinSprite extends FlxAnimate
|
||||||
}
|
}
|
||||||
|
|
||||||
this.applyStageMatrix = validatedSettings.applyStageMatrix ?? false;
|
this.applyStageMatrix = validatedSettings.applyStageMatrix ?? false;
|
||||||
this.legacyBoundsPosition = validatedSettings.legacyBoundsPosition ?? false;
|
|
||||||
|
|
||||||
frames = FlxAnimateFrames.fromAnimate(funkin.Assets.getPath(graphicKey), validatedSettings.spritemaps, validatedSettings.metadataJson,
|
frames = FlxAnimateFrames.fromAnimate(funkin.Assets.getPath(graphicKey), validatedSettings.spritemaps, validatedSettings.metadataJson,
|
||||||
validatedSettings.cacheKey, validatedSettings.uniqueInCache, {
|
validatedSettings.cacheKey, validatedSettings.uniqueInCache, {
|
||||||
|
@ -643,12 +616,6 @@ class FunkinSprite extends FlxAnimate
|
||||||
_rect.height = _rect.height * this.scale.y;
|
_rect.height = _rect.height * this.scale.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (legacyBoundsPosition && this.isAnimate)
|
|
||||||
{
|
|
||||||
result.x += this.timeline.getBoundsOrigin().x;
|
|
||||||
result.y += this.timeline.getBoundsOrigin().y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.subtract(camera.scroll.x * scrollFactor.x, camera.scroll.y * scrollFactor.y);
|
return result.subtract(camera.scroll.x * scrollFactor.x, camera.scroll.y * scrollFactor.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,11 +231,6 @@ class ResultState extends MusicBeatSubState
|
||||||
|
|
||||||
if (animation == null) continue;
|
if (animation == null) continue;
|
||||||
|
|
||||||
if (animData?.legacyBoundsPosition ?? false)
|
|
||||||
{
|
|
||||||
animation.legacyBoundsPosition = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
animation.zIndex = animData.zIndex ?? 500;
|
animation.zIndex = animData.zIndex ?? 500;
|
||||||
|
|
||||||
animation.scale.set(animData.scale ?? 1.0, animData.scale ?? 1.0);
|
animation.scale.set(animData.scale ?? 1.0, animData.scale ?? 1.0);
|
||||||
|
|
|
@ -108,10 +108,7 @@ class CharSelectGF extends FunkinSprite implements IBPMSyncedScriptedClass
|
||||||
else if (previousGFPath != currentGFPath)
|
else if (previousGFPath != currentGFPath)
|
||||||
{
|
{
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
frames = CharSelectAtlasHandler.loadAtlas(currentGFPath,
|
frames = CharSelectAtlasHandler.loadAtlas(currentGFPath);
|
||||||
{
|
|
||||||
swfMode: true
|
|
||||||
});
|
|
||||||
|
|
||||||
enableVisualizer = gfData?.visualizer ?? false;
|
enableVisualizer = gfData?.visualizer ?? false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,7 @@ class CharSelectPlayer extends FunkinSprite implements IBPMSyncedScriptedClass
|
||||||
|
|
||||||
loadTextureAtlas("charSelect/bfChill",
|
loadTextureAtlas("charSelect/bfChill",
|
||||||
{
|
{
|
||||||
applyStageMatrix: true,
|
applyStageMatrix: true
|
||||||
swfMode: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
anim.onFinish.add(function(animLabel:String) {
|
anim.onFinish.add(function(animLabel:String) {
|
||||||
|
|
|
@ -52,11 +52,6 @@ class FreeplayDJ extends FunkinSprite
|
||||||
filterQuality: HIGH
|
filterQuality: HIGH
|
||||||
});
|
});
|
||||||
|
|
||||||
if (playableCharData?.useLegacyBoundsPosition() ?? false)
|
|
||||||
{
|
|
||||||
this.legacyBoundsPosition = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
anim.onFrameChange.add(function(name, number, index) {
|
anim.onFrameChange.add(function(name, number, index) {
|
||||||
if (name == playableCharData?.getAnimationPrefix('cartoon'))
|
if (name == playableCharData?.getAnimationPrefix('cartoon'))
|
||||||
{
|
{
|
||||||
|
@ -467,37 +462,25 @@ class FreeplayDJ extends FunkinSprite
|
||||||
{
|
{
|
||||||
this.anim.play(id, Force, Reverse, Frame);
|
this.anim.play(id, Force, Reverse, Frame);
|
||||||
this.anim.curAnim.looped = Loop;
|
this.anim.curAnim.looped = Loop;
|
||||||
applyAnimationOffset();
|
applyAnimOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyAnimationOffset():Void
|
function applyAnimOffset()
|
||||||
{
|
{
|
||||||
var animationName:String = getCurrentAnimation();
|
var AnimName = getCurrentAnimation();
|
||||||
var animationOffsets:Null<Array<Float>> = playableCharData?.getAnimationOffsetsByPrefix(animationName);
|
var daOffset = playableCharData?.getAnimationOffsetsByPrefix(AnimName);
|
||||||
var globalOffsets:Array<Float> = [this.x, this.y];
|
var daGlobalOffset = [this.x, this.y];
|
||||||
|
if (daOffset != null)
|
||||||
if (animationOffsets != null)
|
|
||||||
{
|
{
|
||||||
var finalOffsetX:Float = 0;
|
var xValue = daGlobalOffset[0] - daOffset[0] - (FreeplayState.CUTOUT_WIDTH * FreeplayState.DJ_POS_MULTI);
|
||||||
var finalOffsetY:Float = 0;
|
var yValue = daGlobalOffset[1] - daOffset[1];
|
||||||
|
|
||||||
if (this.legacyBoundsPosition)
|
trace('Successfully applied offset ($AnimName): ' + daOffset[0] + ', ' + daOffset[1]);
|
||||||
{
|
offset.set(xValue, yValue);
|
||||||
finalOffsetX = animationOffsets[0];
|
|
||||||
finalOffsetY = animationOffsets[1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
finalOffsetX = globalOffsets[0] - animationOffsets[0] - (FreeplayState.CUTOUT_WIDTH * FreeplayState.DJ_POS_MULTI);
|
|
||||||
finalOffsetY = globalOffsets[1] - animationOffsets[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
trace('Successfully applied offset ($animationName): ' + animationOffsets[0] + ', ' + animationOffsets[1]);
|
|
||||||
offset.set(finalOffsetX, finalOffsetY);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trace('No offset found ($animationName), defaulting to: 0, 0');
|
trace('No offset found ($AnimName), defaulting to: 0, 0');
|
||||||
offset.set(0, 0);
|
offset.set(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue