Merge pull request #694 from theDetourist/justworkffs

Even more consistent note trails
This commit is contained in:
Kade M 2021-06-04 18:00:52 -07:00 committed by GitHub
commit ae7dcea22b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 887 additions and 853 deletions

View File

@ -1,228 +1,230 @@
package; package;
import flixel.addons.effects.FlxSkewedSprite; import flixel.addons.effects.FlxSkewedSprite;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxMath; import flixel.math.FlxMath;
import flixel.util.FlxColor; import flixel.util.FlxColor;
#if polymod #if polymod
import polymod.format.ParseRules.TargetSignatureElement; import polymod.format.ParseRules.TargetSignatureElement;
#end #end
import PlayState; import PlayState;
using StringTools; using StringTools;
class Note extends FlxSprite class Note extends FlxSprite
{ {
public var strumTime:Float = 0; public var strumTime:Float = 0;
public var mustPress:Bool = false; public var mustPress:Bool = false;
public var noteData:Int = 0; public var noteData:Int = 0;
public var canBeHit:Bool = false; public var canBeHit:Bool = false;
public var tooLate:Bool = false; public var tooLate:Bool = false;
public var wasGoodHit:Bool = false; public var wasGoodHit:Bool = false;
public var prevNote:Note; public var prevNote:Note;
public var modifiedByLua:Bool = false; public var modifiedByLua:Bool = false;
public var sustainLength:Float = 0; public var sustainLength:Float = 0;
public var isSustainNote:Bool = false; public var isSustainNote:Bool = false;
public var noteScore:Float = 1; public var noteScore:Float = 1;
public static var swagWidth:Float = 160 * 0.7; public static var swagWidth:Float = 160 * 0.7;
public static var PURP_NOTE:Int = 0; public static var PURP_NOTE:Int = 0;
public static var GREEN_NOTE:Int = 2; public static var GREEN_NOTE:Int = 2;
public static var BLUE_NOTE:Int = 1; public static var BLUE_NOTE:Int = 1;
public static var RED_NOTE:Int = 3; public static var RED_NOTE:Int = 3;
public var rating:String = "shit"; public var rating:String = "shit";
public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false) public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false)
{ {
super(); super();
if (prevNote == null) if (prevNote == null)
prevNote = this; prevNote = this;
this.prevNote = prevNote; this.prevNote = prevNote;
isSustainNote = sustainNote; isSustainNote = sustainNote;
x += 50; x += 50;
// MAKE SURE ITS DEFINITELY OFF SCREEN? // MAKE SURE ITS DEFINITELY OFF SCREEN?
y -= 2000; y -= 2000;
this.strumTime = strumTime;
// Take half the sprite's height to compensate for the offset down below
if (this.strumTime < 0 ) this.strumTime = strumTime - frameHeight / 2;
this.strumTime = 0;
if (this.strumTime < 0 )
this.noteData = noteData; this.strumTime = 0;
var daStage:String = PlayState.curStage; this.noteData = noteData;
switch (PlayState.SONG.noteStyle) var daStage:String = PlayState.curStage;
{
case 'pixel': switch (PlayState.SONG.noteStyle)
loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels','week6'), true, 17, 17); {
case 'pixel':
animation.add('greenScroll', [6]); loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels','week6'), true, 17, 17);
animation.add('redScroll', [7]);
animation.add('blueScroll', [5]); animation.add('greenScroll', [6]);
animation.add('purpleScroll', [4]); animation.add('redScroll', [7]);
animation.add('blueScroll', [5]);
if (isSustainNote) animation.add('purpleScroll', [4]);
{
loadGraphic(Paths.image('weeb/pixelUI/arrowEnds','week6'), true, 7, 6); if (isSustainNote)
{
animation.add('purpleholdend', [4]); loadGraphic(Paths.image('weeb/pixelUI/arrowEnds','week6'), true, 7, 6);
animation.add('greenholdend', [6]);
animation.add('redholdend', [7]); animation.add('purpleholdend', [4]);
animation.add('blueholdend', [5]); animation.add('greenholdend', [6]);
animation.add('redholdend', [7]);
animation.add('purplehold', [0]); animation.add('blueholdend', [5]);
animation.add('greenhold', [2]);
animation.add('redhold', [3]); animation.add('purplehold', [0]);
animation.add('bluehold', [1]); animation.add('greenhold', [2]);
} animation.add('redhold', [3]);
animation.add('bluehold', [1]);
setGraphicSize(Std.int(width * PlayState.daPixelZoom)); }
updateHitbox();
default: setGraphicSize(Std.int(width * PlayState.daPixelZoom));
frames = Paths.getSparrowAtlas('NOTE_assets'); updateHitbox();
default:
animation.addByPrefix('greenScroll', 'green0'); frames = Paths.getSparrowAtlas('NOTE_assets');
animation.addByPrefix('redScroll', 'red0');
animation.addByPrefix('blueScroll', 'blue0'); animation.addByPrefix('greenScroll', 'green0');
animation.addByPrefix('purpleScroll', 'purple0'); animation.addByPrefix('redScroll', 'red0');
animation.addByPrefix('blueScroll', 'blue0');
animation.addByPrefix('purpleholdend', 'pruple end hold'); animation.addByPrefix('purpleScroll', 'purple0');
animation.addByPrefix('greenholdend', 'green hold end');
animation.addByPrefix('redholdend', 'red hold end'); animation.addByPrefix('purpleholdend', 'pruple end hold');
animation.addByPrefix('blueholdend', 'blue hold end'); animation.addByPrefix('greenholdend', 'green hold end');
animation.addByPrefix('redholdend', 'red hold end');
animation.addByPrefix('purplehold', 'purple hold piece'); animation.addByPrefix('blueholdend', 'blue hold end');
animation.addByPrefix('greenhold', 'green hold piece');
animation.addByPrefix('redhold', 'red hold piece'); animation.addByPrefix('purplehold', 'purple hold piece');
animation.addByPrefix('bluehold', 'blue hold piece'); animation.addByPrefix('greenhold', 'green hold piece');
animation.addByPrefix('redhold', 'red hold piece');
setGraphicSize(Std.int(width * 0.7)); animation.addByPrefix('bluehold', 'blue hold piece');
updateHitbox();
antialiasing = true; setGraphicSize(Std.int(width * 0.7));
} updateHitbox();
antialiasing = true;
switch (noteData) }
{
case 0: switch (noteData)
x += swagWidth * 0; {
animation.play('purpleScroll'); case 0:
case 1: x += swagWidth * 0;
x += swagWidth * 1; animation.play('purpleScroll');
animation.play('blueScroll'); case 1:
case 2: x += swagWidth * 1;
x += swagWidth * 2; animation.play('blueScroll');
animation.play('greenScroll'); case 2:
case 3: x += swagWidth * 2;
x += swagWidth * 3; animation.play('greenScroll');
animation.play('redScroll'); case 3:
} x += swagWidth * 3;
animation.play('redScroll');
// trace(prevNote); }
// we make sure its downscroll and its a SUSTAIN NOTE (aka a trail, not a note) if (isSustainNote && prevNote != null)
// and flip it so it doesn't look weird. {
// THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS noteScore * 0.2;
if (FlxG.save.data.downscroll && sustainNote) alpha = 0.6;
flipY = true;
x += width / 2;
if (isSustainNote && prevNote != null)
{ flipY = true;
noteScore * 0.2;
alpha = 0.6; offset.y = frameHeight;
x += width / 2; switch (noteData)
{
switch (noteData) case 2:
{ animation.play('greenholdend');
case 2: case 3:
animation.play('greenholdend'); animation.play('redholdend');
case 3: case 1:
animation.play('redholdend'); animation.play('blueholdend');
case 1: case 0:
animation.play('blueholdend'); animation.play('purpleholdend');
case 0: }
animation.play('purpleholdend');
} updateHitbox();
updateHitbox(); x -= width / 2;
x -= width / 2; if (PlayState.curStage.startsWith('school'))
x += 30;
if (PlayState.curStage.startsWith('school'))
x += 30; if (prevNote.isSustainNote)
{
if (prevNote.isSustainNote) if(!FlxG.save.data.downscroll) flipY = false;
{
switch (prevNote.noteData) switch (prevNote.noteData)
{ {
case 0: case 0:
prevNote.animation.play('purplehold'); prevNote.animation.play('purplehold');
case 1: case 1:
prevNote.animation.play('bluehold'); prevNote.animation.play('bluehold');
case 2: case 2:
prevNote.animation.play('greenhold'); prevNote.animation.play('greenhold');
case 3: case 3:
prevNote.animation.play('redhold'); prevNote.animation.play('redhold');
} }
if(FlxG.save.data.scrollSpeed != 1) if(FlxG.save.data.scrollSpeed != 1)
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * FlxG.save.data.scrollSpeed; prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * FlxG.save.data.scrollSpeed;
else else
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed;
prevNote.updateHitbox();
// prevNote.setGraphicSize(); prevNote.updateHitbox();
} // prevNote.setGraphicSize();
} }
} }
}
override function update(elapsed:Float)
{ override function update(elapsed:Float)
super.update(elapsed); {
super.update(elapsed);
if (mustPress)
{ if (mustPress)
// ass {
if (isSustainNote) // ass
{ if (isSustainNote)
if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5) {
&& strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) trace('sustain note');
canBeHit = true; if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5)
else && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5))
canBeHit = false; canBeHit = true;
} else
else canBeHit = false;
{ }
if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset else
&& strumTime < Conductor.songPosition + Conductor.safeZoneOffset) {
canBeHit = true; if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset
else && strumTime < Conductor.songPosition + Conductor.safeZoneOffset)
canBeHit = false; canBeHit = true;
} else
canBeHit = false;
if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset * Conductor.timeScale && !wasGoodHit) }
tooLate = true;
} if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset * Conductor.timeScale && !wasGoodHit)
else tooLate = true;
{ }
canBeHit = false; else
{
if (strumTime <= Conductor.songPosition) canBeHit = false;
wasGoodHit = true;
} if (strumTime <= Conductor.songPosition)
wasGoodHit = true;
if (tooLate) }
{
if (alpha > 0.3) if (tooLate)
alpha = 0.3; {
} if (alpha > 0.3)
} alpha = 0.3;
} }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2202,28 +2202,33 @@ class PlayState extends MusicBeatState
daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2)); daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2));
else else
daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2)); daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2));
if(daNote.isSustainNote) if(daNote.isSustainNote)
{ {
// Remember = minus makes notes go up, plus makes them go down daNote.y += daNote.frameHeight / 2;
if(daNote.animation.curAnim.name.endsWith('end') && daNote.prevNote != null)
daNote.y += daNote.prevNote.height; if(daNote.animation.curAnim.name.endsWith('holdend'))
else {
daNote.y += daNote.height / 2; daNote.y = daNote.prevNote.y - daNote.offset.y * 2;
if(SONG.noteStyle == 'pixel')
daNote.y += daNote.offset.y * 2;
}
// If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime // If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime
if(!FlxG.save.data.botplay) if(!FlxG.save.data.botplay)
{ {
if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2)) if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2))
{ {
// Clip to strumline // Clip to strumline
var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2); var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 4);
swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y;
swagRect.y = daNote.frameHeight - swagRect.height; swagRect.y = daNote.frameHeight - swagRect.height;
daNote.clipRect = swagRect; daNote.clipRect = swagRect;
} }
}else { }else {
var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2); var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 4);
swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y;
swagRect.y = daNote.frameHeight - swagRect.height; swagRect.y = daNote.frameHeight - swagRect.height;
@ -2236,10 +2241,27 @@ class PlayState extends MusicBeatState
daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2)); daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2));
else else
daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2)); daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(FlxG.save.data.scrollSpeed == 1 ? SONG.speed : FlxG.save.data.scrollSpeed, 2));
if(daNote.isSustainNote) if(daNote.isSustainNote)
{ {
// Don't look at this goofy ass shit, my hatred for upscroll knows no bounds
daNote.y += daNote.frameHeight + daNote.frameHeight / 2;
daNote.offset.y = daNote.frameHeight;
if(SONG.noteStyle == 'pixel')
daNote.y += daNote.height / 2;
daNote.y -= daNote.height / 2; daNote.y -= daNote.height / 2;
if(daNote.animation.curAnim.name.endsWith('holdend'))
{
daNote.y = daNote.prevNote.y + daNote.prevNote.height / 2 + daNote.frameHeight / 6;
if(SONG.noteStyle == 'pixel')
daNote.y += daNote.offset.y / 2;
}
if(!FlxG.save.data.botplay) if(!FlxG.save.data.botplay)
{ {
if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2))
@ -2261,6 +2283,16 @@ class PlayState extends MusicBeatState
} }
} }
} }
if(daNote.prevNote.wasGoodHit && daNote.animation.curAnim.name.endsWith('holdend'))
{
daNote.active = false;
daNote.visible = false;
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
if (!daNote.mustPress && daNote.wasGoodHit) if (!daNote.mustPress && daNote.wasGoodHit)
{ {