mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 11:22:55 +00:00
Merge pull request #672 from FunkinCrew/bugfix/character-offset-fixes
[PUBLIC PR] Fix some bugs with how character positions are handled.
This commit is contained in:
commit
3c814dacf0
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 005c96f85f4304865acb196e7cc4d6d83f9d76d8
|
||||
Subproject commit aa1231e8cf2990bb902eac3b37815c010fa9919a
|
|
@ -306,7 +306,7 @@ class PauseSubState extends MusicBeatSubState
|
|||
metadataDifficulty.setFormat(Paths.font('vcr.ttf'), 32, FlxColor.WHITE, FlxTextAlign.RIGHT);
|
||||
if (PlayState.instance?.currentDifficulty != null)
|
||||
{
|
||||
metadataDifficulty.text += PlayState.instance.currentDifficulty.toTitleCase();
|
||||
metadataDifficulty.text += PlayState.instance.currentDifficulty.replace('-', ' ').toTitleCase();
|
||||
}
|
||||
metadataDifficulty.scrollFactor.set(0, 0);
|
||||
metadata.add(metadataDifficulty);
|
||||
|
|
|
@ -118,22 +118,6 @@ class BaseCharacter extends Bopper
|
|||
*/
|
||||
public var cameraFocusPoint(default, null):FlxPoint = new FlxPoint(0, 0);
|
||||
|
||||
override function set_animOffsets(value:Array<Float>):Array<Float>
|
||||
{
|
||||
if (animOffsets == null) value = [0, 0];
|
||||
if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value;
|
||||
|
||||
// Make sure animOffets are halved when scale is 0.5.
|
||||
var xDiff = (animOffsets[0] * this.scale.x / (this.isPixel ? 6 : 1)) - value[0];
|
||||
var yDiff = (animOffsets[1] * this.scale.y / (this.isPixel ? 6 : 1)) - value[1];
|
||||
|
||||
// Call the super function so that camera focus point is not affected.
|
||||
super.set_x(this.x + xDiff);
|
||||
super.set_y(this.y + yDiff);
|
||||
|
||||
return animOffsets = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the x position changes, other than via changing the animation offset,
|
||||
* then we need to update the camera focus point.
|
||||
|
|
|
@ -277,7 +277,8 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
|||
// If there are no difficulties in the metadata, there's a problem.
|
||||
if (metadata.playData.difficulties.length == 0)
|
||||
{
|
||||
trace('[WARN] Song $id has no difficulties listed in metadata!');
|
||||
trace('[SONG] Warning: Song $id (variation ${metadata.variation}) has no difficulties listed in metadata!');
|
||||
continue;
|
||||
}
|
||||
|
||||
// There may be more difficulties in the chart file than in the metadata,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package funkin.play.stage;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxCamera;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.util.FlxTimer;
|
||||
import funkin.modding.IScriptedClass.IPlayStateScriptedClass;
|
||||
|
@ -79,11 +80,6 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
if (globalOffsets == null) globalOffsets = [0, 0];
|
||||
if (globalOffsets == value) return value;
|
||||
|
||||
var xDiff = globalOffsets[0] - value[0];
|
||||
var yDiff = globalOffsets[1] - value[1];
|
||||
|
||||
this.x += xDiff;
|
||||
this.y += yDiff;
|
||||
return globalOffsets = value;
|
||||
}
|
||||
|
||||
|
@ -97,12 +93,6 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
if (animOffsets == null) animOffsets = [0, 0];
|
||||
if ((animOffsets[0] == value[0]) && (animOffsets[1] == value[1])) return value;
|
||||
|
||||
var xDiff = animOffsets[0] - value[0];
|
||||
var yDiff = animOffsets[1] - value[1];
|
||||
|
||||
this.x += xDiff;
|
||||
this.y += yDiff;
|
||||
|
||||
return animOffsets = value;
|
||||
}
|
||||
|
||||
|
@ -320,14 +310,7 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
function applyAnimationOffsets(name:String):Void
|
||||
{
|
||||
var offsets = animationOffsets.get(name);
|
||||
if (offsets != null && !(offsets[0] == 0 && offsets[1] == 0))
|
||||
{
|
||||
this.animOffsets = [offsets[0] + globalOffsets[0], offsets[1] + globalOffsets[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
this.animOffsets = globalOffsets;
|
||||
}
|
||||
this.animOffsets = offsets;
|
||||
}
|
||||
|
||||
public function isAnimationFinished():Bool
|
||||
|
@ -351,6 +334,15 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
return this.animation.curAnim.name;
|
||||
}
|
||||
|
||||
// override getScreenPosition (used by FlxSprite's draw method) to account for animation offsets.
|
||||
override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint
|
||||
{
|
||||
var output:FlxPoint = super.getScreenPosition(result, camera);
|
||||
output.x -= (animOffsets[0] - globalOffsets[0]) * this.scale.x;
|
||||
output.y -= (animOffsets[1] - globalOffsets[1]) * this.scale.y;
|
||||
return output;
|
||||
}
|
||||
|
||||
public function onPause(event:PauseScriptEvent) {}
|
||||
|
||||
public function onResume(event:ScriptEvent) {}
|
||||
|
|
Loading…
Reference in a new issue