Skip to content

Commit

Permalink
fuck, the notes are broken
Browse files Browse the repository at this point in the history
removed some other project code :trollface:
clean the scroll code a little more
fix optimize bugs
run formatter
  • Loading branch information
TheRealJake12 committed Nov 27, 2023
1 parent db3f5e9 commit 76ea17b
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 214 deletions.
208 changes: 98 additions & 110 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -105,72 +105,68 @@ class Character extends FlxSprite

var data:CharacterData = cast jsonData;

if (!FlxG.save.data.optimize)
{
var tex:FlxFramesCollection;

if (data.AtlasType == 'PackerAtlas')
tex = Paths.getPackerAtlas(data.asset, 'shared');
else if (data.AtlasType == 'TextureAtlas')
tex = Paths.getTextureAtlas(data.asset, 'shared');
else if (data.AtlasType == 'JsonAtlas')
tex = Paths.getJSONAtlas(data.asset, 'shared');
else
tex = Paths.getSparrowAtlas(data.asset, 'shared');
var tex:FlxFramesCollection;

if (data.AtlasType == 'PackerAtlas')
tex = Paths.getPackerAtlas(data.asset, 'shared');
else if (data.AtlasType == 'TextureAtlas')
tex = Paths.getTextureAtlas(data.asset, 'shared');
else if (data.AtlasType == 'JsonAtlas')
tex = Paths.getJSONAtlas(data.asset, 'shared');
else
tex = Paths.getSparrowAtlas(data.asset, 'shared');

frames = tex;
if (frames != null)
for (anim in data.animations)
{
var frameRate = anim.frameRate == null ? 24 : anim.frameRate;
var looped = anim.looped == null ? false : anim.looped;
var flipX = anim.flipX == null ? false : anim.flipX;
var flipY = anim.flipY == null ? false : anim.flipY;
frames = tex;
if (frames != null)
for (anim in data.animations)
{
var frameRate = anim.frameRate == null ? 24 : anim.frameRate;
var looped = anim.looped == null ? false : anim.looped;
var flipX = anim.flipX == null ? false : anim.flipX;
var flipY = anim.flipY == null ? false : anim.flipY;

if (anim.frameIndices != null)
{
animation.addByIndices(anim.name, anim.prefix, anim.frameIndices, "", Std.int(frameRate * PlayState.songMultiplier), looped, flipX,
flipY);
}
else
{
animation.addByPrefix(anim.name, anim.prefix, Std.int(frameRate * PlayState.songMultiplier), looped, flipX, flipY);
}
if (anim.frameIndices != null)
{
animation.addByIndices(anim.name, anim.prefix, anim.frameIndices, "", Std.int(frameRate * PlayState.songMultiplier), looped, flipX, flipY);
}
else
{
animation.addByPrefix(anim.name, anim.prefix, Std.int(frameRate * PlayState.songMultiplier), looped, flipX, flipY);
}

animOffsets[anim.name] = anim.offsets == null ? [0, 0] : anim.offsets;
animInterrupt[anim.name] = anim.interrupt == null ? true : anim.interrupt;
animOffsets[anim.name] = anim.offsets == null ? [0, 0] : anim.offsets;
animInterrupt[anim.name] = anim.interrupt == null ? true : anim.interrupt;

if (data.isDancing && anim.isDanced != null)
animDanced[anim.name] = anim.isDanced;
if (data.isDancing && anim.isDanced != null)
animDanced[anim.name] = anim.isDanced;

if (anim.nextAnim != null)
animNext[anim.name] = anim.nextAnim;
}
if (anim.nextAnim != null)
animNext[anim.name] = anim.nextAnim;
}

this.replacesGF = data.replacesGF == null ? false : data.replacesGF;
this.hasTrail = data.hasTrail == null ? false : data.hasTrail;
this.isDancing = data.isDancing == null ? false : data.isDancing;
this.charPos = data.charPos == null ? [0, 0] : data.charPos;
this.camPos = data.camPos == null ? [0, 0] : data.camPos;
this.camFollow = data.camFollow == null ? [0, 0] : data.camFollow;
this.holdLength = data.holdLength == null ? 4 : data.holdLength;
this.healthIcon = data.healthicon == null ? curCharacter : data.healthicon;
this.iconAnimated = data.iconAnimated == null ? false : data.iconAnimated;
this.replacesGF = data.replacesGF == null ? false : data.replacesGF;
this.hasTrail = data.hasTrail == null ? false : data.hasTrail;
this.isDancing = data.isDancing == null ? false : data.isDancing;
this.charPos = data.charPos == null ? [0, 0] : data.charPos;
this.camPos = data.camPos == null ? [0, 0] : data.camPos;
this.camFollow = data.camFollow == null ? [0, 0] : data.camFollow;
this.holdLength = data.holdLength == null ? 4 : data.holdLength;
this.healthIcon = data.healthicon == null ? curCharacter : data.healthicon;
this.iconAnimated = data.iconAnimated == null ? false : data.iconAnimated;

this.rgbColorArray = data.rgbArray == null ? [255, 0, 0] : data.rgbArray;
this.rgbColorArray = data.rgbArray == null ? [255, 0, 0] : data.rgbArray;

flipX = data.flipX == null ? false : data.flipX;
flipX = data.flipX == null ? false : data.flipX;

if (data.scale != null)
{
setGraphicSize(Std.int(width * data.scale));
updateHitbox();
}
if (data.scale != null)
{
setGraphicSize(Std.int(width * data.scale));
updateHitbox();
}

antialiasing = data.antialiasing == null ? FlxG.save.data.antialiasing : data.antialiasing;
antialiasing = data.antialiasing == null ? FlxG.save.data.antialiasing : data.antialiasing;

playAnim(data.startingAnim);
}
playAnim(data.startingAnim);

if (data.barType == 'rgb')
barColor = FlxColor.fromRGB(data.rgbArray[0], data.rgbArray[1], data.rgbArray[2]);
Expand Down Expand Up @@ -254,45 +250,40 @@ class Character extends FlxSprite
{
if (!debugMode)
{
if (!FlxG.save.data.optimize)
if (curCharacter != 'pico-speaker')
{
if (curCharacter != 'pico-speaker')
if (animation.curAnim != null)
{
if (animation.curAnim != null)
{
var canInterrupt = animInterrupt.get(animation.curAnim.name);
var canInterrupt = animInterrupt.get(animation.curAnim.name);

if (canInterrupt)
if (canInterrupt)
{
if (isDancing)
{
if (isDancing)
danced = !danced;

if (altAnim && animation.getByName('danceRight-alt') != null && animation.getByName('danceLeft-alt') != null)
{
danced = !danced;

if (altAnim
&& animation.getByName('danceRight-alt') != null
&& animation.getByName('danceLeft-alt') != null)
{
if (danced)
playAnim('danceRight-alt');
else
playAnim('danceLeft-alt');
}
if (danced)
playAnim('danceRight-alt');
else
{
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
playAnim('danceLeft-alt');
}
else
{
if (altAnim && animation.getByName('idle-alt') != null)
playAnim('idle-alt', forced);
if (danced)
playAnim('danceRight');
else
playAnim('idle', forced);
playAnim('danceLeft');
}
}
else
{
if (altAnim && animation.getByName('idle-alt') != null)
playAnim('idle-alt', forced);
else
playAnim('idle', forced);
}
}
}
}
Expand All @@ -301,41 +292,38 @@ class Character extends FlxSprite

public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
{
if (!FlxG.save.data.optimize)
if (AnimName.endsWith('alt') && animation.getByName(AnimName) == null)
{
if (AnimName.endsWith('alt') && animation.getByName(AnimName) == null)
{
#if debug
FlxG.log.warn(['Such alt animation doesnt exist: ' + AnimName]);
#end
AnimName = AnimName.split('-')[0];
}
#if debug
FlxG.log.warn(['Such alt animation doesnt exist: ' + AnimName]);
#end
AnimName = AnimName.split('-')[0];
}

animation.play(AnimName, Force, Reversed, Frame);

animation.play(AnimName, Force, Reversed, Frame);
var daOffset = animOffsets.get(AnimName);
if (animOffsets.exists(AnimName))
{
offset.set(daOffset[0], daOffset[1]);
}
else
offset.set(0, 0);

var daOffset = animOffsets.get(AnimName);
if (animOffsets.exists(AnimName))
if (curCharacter == 'gf')
{
if (AnimName == 'singLEFT')
{
offset.set(daOffset[0], daOffset[1]);
danced = true;
}
else
offset.set(0, 0);

if (curCharacter == 'gf')
else if (AnimName == 'singRIGHT')
{
if (AnimName == 'singLEFT')
{
danced = true;
}
else if (AnimName == 'singRIGHT')
{
danced = false;
}
danced = false;
}

if (AnimName == 'singUP' || AnimName == 'singDOWN')
{
danced = !danced;
}
if (AnimName == 'singUP' || AnimName == 'singDOWN')
{
danced = !danced;
}
}
}
Expand Down
24 changes: 11 additions & 13 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -428,18 +428,6 @@ class Note extends FlxSprite
}
if (strumTime - Conductor.songPosition < -Ratings.timingWindows[0] && !wasGoodHit)
tooLate = true;
case 'fuck':
if (strumTime - Conductor.songPosition <= ((Ratings.timingWindows[0]) * 3.4)
&& strumTime - Conductor.songPosition >= (-Ratings.timingWindows[0]) * 3.6)
{
canBeHit = true;
}
else
{
canBeHit = false;
}
if (strumTime - Conductor.songPosition < -Ratings.timingWindows[0] && !wasGoodHit)
tooLate = true;
default:
if (strumTime - Conductor.songPosition <= (((Ratings.timingWindows[0]) * lateHitMult))
&& strumTime - Conductor.songPosition >= (((-Ratings.timingWindows[0]) * earlyHitMult)))
Expand All @@ -454,7 +442,8 @@ class Note extends FlxSprite
if (isSustainNote)
{
isSustainEnd = spotInLine == parent.children.length - 1;
alpha = modAlpha * FlxG.save.data.alpha; // This is the correct way
alpha = !sustainActive
&& (parent.tooLate || parent.wasGoodHit) ? (modAlpha * FlxG.save.data.alpha) / 2 : modAlpha * FlxG.save.data.alpha; // This is the correct way
}
else if (tooLate && !wasGoodHit)
{
Expand Down Expand Up @@ -486,6 +475,15 @@ class Note extends FlxSprite
_lastValidChecked = '';
}

@:noCompletion
override function set_y(value:Float):Float
{
if (isSustainNote)
if (PlayStateChangeables.useDownscroll)
value -= height - swagWidth;
return super.set_y(value);
}

@:noCompletion
override function set_clipRect(rect:FlxRect):FlxRect
{
Expand Down
Loading

0 comments on commit 76ea17b

Please sign in to comment.