Merge remote-tracking branch 'upstream/master' into patch-3

This commit is contained in:
Lucky56
2021-06-20 08:54:32 +02:00
23 changed files with 906 additions and 176 deletions

View File

@ -76,6 +76,7 @@ class PlayState extends MusicBeatState
public static var storyPlaylist:Array<String> = [];
public static var storyDifficulty:Int = 1;
public static var weekSong:Int = 0;
public static var weekScore:Int = 0;
public static var shits:Int = 0;
public static var bads:Int = 0;
public static var goods:Int = 0;
@ -104,6 +105,8 @@ class PlayState extends MusicBeatState
private var vocals:FlxSound;
public var originalX:Float;
public static var dad:Character;
public static var gf:Character;
public static var boyfriend:Boyfriend;
@ -129,7 +132,8 @@ class PlayState extends MusicBeatState
public var health:Float = 1; //making public because sethealth doesnt work without it
private var combo:Int = 0;
public static var misses:Int = 0;
private var accuracy:Float = 0.00;
public static var campaignMisses:Int = 0;
public var accuracy:Float = 0.00;
private var accuracyDefault:Float = 0.00;
private var totalNotesHit:Float = 0;
private var totalNotesHitDefault:Float = 0;
@ -177,7 +181,7 @@ class PlayState extends MusicBeatState
var wiggleShit:WiggleEffect = new WiggleEffect();
var talking:Bool = true;
var songScore:Int = 0;
public var songScore:Int = 0;
var songScoreDef:Int = 0;
var scoreTxt:FlxText;
var replayTxt:FlxText;
@ -207,7 +211,9 @@ class PlayState extends MusicBeatState
// BotPlay text
private var botPlayState:FlxText;
// Replay shit
private var saveNotes:Array<Float> = [];
private var saveNotes:Array<Dynamic> = [];
public static var highestCombo:Int = 0;
private var executeModchart = false;
@ -227,16 +233,25 @@ class PlayState extends MusicBeatState
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
sicks = 0;
bads = 0;
shits = 0;
goods = 0;
if (!isStoryMode)
{
sicks = 0;
bads = 0;
shits = 0;
goods = 0;
}
misses = 0;
repPresses = 0;
repReleases = 0;
PlayStateChangeables.useDownscroll = FlxG.save.data.downscroll;
PlayStateChangeables.safeFrames = FlxG.save.data.frames;
PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed;
PlayStateChangeables.botPlay = FlxG.save.data.botplay;
// pre lowercasing the song name (create)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
switch (songLowercase) {
@ -244,6 +259,8 @@ class PlayState extends MusicBeatState
case 'philly-nice': songLowercase = 'philly';
}
removedVideo = false;
#if windows
executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart"));
#end
@ -255,15 +272,7 @@ class PlayState extends MusicBeatState
#if windows
// Making difficulty text for Discord Rich Presence.
switch (storyDifficulty)
{
case 0:
storyDifficultyText = "Easy";
case 1:
storyDifficultyText = "Normal";
case 2:
storyDifficultyText = "Hard";
}
storyDifficultyText = CoolUtil.difficultyFromInt(storyDifficulty);
iconRPC = SONG.player2;
@ -315,7 +324,7 @@ class PlayState extends MusicBeatState
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + Conductor.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + FlxG.save.data.botplay);
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay);
//dialogue shit
switch (songLowercase)
@ -865,13 +874,17 @@ class PlayState extends MusicBeatState
{
FlxG.watch.addQuick('rep rpesses',repPresses);
FlxG.watch.addQuick('rep releases',repReleases);
FlxG.save.data.botplay = true;
FlxG.save.data.scrollSpeed = rep.replay.noteSpeed;
FlxG.save.data.downscroll = rep.replay.isDownscroll;
// FlxG.watch.addQuick('Queued',inputsQueued);
PlayStateChangeables.useDownscroll = rep.replay.isDownscroll;
PlayStateChangeables.safeFrames = rep.replay.sf;
PlayStateChangeables.botPlay = true;
}
trace('uh ' + PlayStateChangeables.safeFrames);
trace("SF CALC: " + Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
var doof:DialogueBox = new DialogueBox(false, dialogue);
// doof.x += 70;
// doof.y = FlxG.height * 0.5;
@ -883,7 +896,7 @@ class PlayState extends MusicBeatState
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
strumLine.scrollFactor.set();
if (FlxG.save.data.downscroll)
if (PlayStateChangeables.useDownscroll)
strumLine.y = FlxG.height - 165;
strumLineNotes = new FlxTypedGroup<FlxSprite>();
@ -929,7 +942,7 @@ class PlayState extends MusicBeatState
if (FlxG.save.data.songPosition) // I dont wanna talk about this code :(
{
songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll)
if (PlayStateChangeables.useDownscroll)
songPosBG.y = FlxG.height * 0.9 + 45;
songPosBG.screenCenter(X);
songPosBG.scrollFactor.set();
@ -941,8 +954,8 @@ class PlayState extends MusicBeatState
songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME);
add(songPosBar);
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16);
if (FlxG.save.data.downscroll)
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - (SONG.song.length * 5),songPosBG.y,0,SONG.song, 16);
if (PlayStateChangeables.useDownscroll)
songName.y -= 3;
songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
songName.scrollFactor.set();
@ -951,7 +964,7 @@ class PlayState extends MusicBeatState
}
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll)
if (PlayStateChangeables.useDownscroll)
healthBarBG.y = 50;
healthBarBG.screenCenter(X);
healthBarBG.scrollFactor.set();
@ -965,37 +978,43 @@ class PlayState extends MusicBeatState
add(healthBar);
// Add Kade Engine watermark
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " " + (storyDifficulty == 2 ? "Hard" : storyDifficulty == 1 ? "Normal" : "Easy") + (Main.watermarks ? " - KE " + MainMenuState.kadeEngineVer : ""), 16);
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " " + CoolUtil.difficultyFromInt(storyDifficulty) + (Main.watermarks ? " - KE " + MainMenuState.kadeEngineVer : ""), 16);
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
kadeEngineWatermark.scrollFactor.set();
add(kadeEngineWatermark);
if (FlxG.save.data.downscroll)
if (PlayStateChangeables.useDownscroll)
kadeEngineWatermark.y = FlxG.height * 0.9 + 45;
scoreTxt = new FlxText(FlxG.width / 2 - 235, healthBarBG.y + 50, 0, "", 20);
if (!FlxG.save.data.accuracyDisplay)
scoreTxt.x = healthBarBG.x + healthBarBG.width / 2;
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
scoreTxt.screenCenter(X);
originalX = scoreTxt.x;
scoreTxt.scrollFactor.set();
if (offsetTesting)
scoreTxt.x += 300;
if(FlxG.save.data.botplay) scoreTxt.x = FlxG.width / 2 - 20;
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
add(scoreTxt);
replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "REPLAY", 20);
replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "REPLAY", 20);
replayTxt.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
replayTxt.borderSize = 4;
replayTxt.borderQuality = 2;
replayTxt.scrollFactor.set();
if (loadRep)
{
add(replayTxt);
}
// Literally copy-paste of the above, fu
botPlayState = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "BOTPLAY", 20);
botPlayState = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "BOTPLAY", 20);
botPlayState.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
botPlayState.scrollFactor.set();
if(FlxG.save.data.botplay && !loadRep) add(botPlayState);
botPlayState.borderSize = 4;
botPlayState.borderQuality = 2;
if(PlayStateChangeables.botPlay && !loadRep) add(botPlayState);
iconP1 = new HealthIcon(SONG.player1, true);
iconP1.y = healthBar.y - (iconP1.height / 2);
@ -1341,7 +1360,7 @@ class PlayState extends MusicBeatState
remove(songName);
songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll)
if (PlayStateChangeables.useDownscroll)
songPosBG.y = FlxG.height * 0.9 + 45;
songPosBG.screenCenter(X);
songPosBG.scrollFactor.set();
@ -1354,8 +1373,8 @@ class PlayState extends MusicBeatState
songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME);
add(songPosBar);
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16);
if (FlxG.save.data.downscroll)
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - (SONG.song.length * 5),songPosBG.y,0,SONG.song, 16);
if (PlayStateChangeables.useDownscroll)
songName.y -= 3;
songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
songName.scrollFactor.set();
@ -1754,7 +1773,7 @@ class PlayState extends MusicBeatState
perfectMode = false;
#end
if (FlxG.save.data.botplay && FlxG.keys.justPressed.ONE)
if (PlayStateChangeables.botPlay && FlxG.keys.justPressed.ONE)
camHUD.visible = !camHUD.visible;
@ -1763,6 +1782,8 @@ class PlayState extends MusicBeatState
if (GlobalVideo.get().ended && !removedVideo)
{
remove(videoSprite);
FlxG.stage.window.onFocusOut.remove(focusOut);
FlxG.stage.window.onFocusIn.remove(focusIn);
removedVideo = true;
}
}
@ -1872,6 +1893,10 @@ class PlayState extends MusicBeatState
scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,accuracy);
var lengthInPx = scoreTxt.textField.length * scoreTxt.frameHeight; // bad way but does more or less a better job
scoreTxt.x = (originalX - (lengthInPx / 2)) + 335;
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
{
persistentUpdate = false;
@ -1894,6 +1919,8 @@ class PlayState extends MusicBeatState
{
GlobalVideo.get().stop();
remove(videoSprite);
FlxG.stage.window.onFocusOut.remove(focusOut);
FlxG.stage.window.onFocusIn.remove(focusIn);
removedVideo = true;
}
#if windows
@ -1945,6 +1972,8 @@ class PlayState extends MusicBeatState
{
GlobalVideo.get().stop();
remove(videoSprite);
FlxG.stage.window.onFocusOut.remove(focusOut);
FlxG.stage.window.onFocusIn.remove(focusIn);
removedVideo = true;
}
@ -2295,12 +2324,12 @@ class PlayState extends MusicBeatState
if (!daNote.modifiedByLua)
{
if (FlxG.save.data.downscroll)
if (PlayStateChangeables.useDownscroll)
{
if (daNote.mustPress)
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(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2));
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(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2));
if(daNote.isSustainNote)
{
// Remember = minus makes notes go up, plus makes them go down
@ -2310,7 +2339,7 @@ class PlayState extends MusicBeatState
daNote.y += daNote.height / 2;
// If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime
if(!FlxG.save.data.botplay)
if(!PlayStateChangeables.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))
{
@ -2332,14 +2361,14 @@ class PlayState extends MusicBeatState
}else
{
if (daNote.mustPress)
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(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2));
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(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2));
if(daNote.isSustainNote)
{
daNote.y -= daNote.height / 2;
if(!FlxG.save.data.botplay)
if(!PlayStateChangeables.botPlay)
{
if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2))
{
@ -2451,7 +2480,7 @@ class PlayState extends MusicBeatState
// WIP interpolation shit? Need to fix the pause issue
// daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed));
if ((daNote.mustPress && daNote.tooLate && !FlxG.save.data.downscroll || daNote.mustPress && daNote.tooLate && FlxG.save.data.downscroll) && daNote.mustPress)
if ((daNote.mustPress && daNote.tooLate && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate && PlayStateChangeables.useDownscroll) && daNote.mustPress)
{
if (daNote.isSustainNote && daNote.wasGoodHit)
{
@ -2460,10 +2489,26 @@ class PlayState extends MusicBeatState
}
else
{
health -= 0.075;
vocals.volume = 0;
if (theFunne)
noteMiss(daNote.noteData, daNote);
if (loadRep && daNote.isSustainNote)
{
// im tired and lazy this sucks I know i'm dumb
if (findByTime(daNote.strumTime) != null)
totalNotesHit += 1;
else
{
health -= 0.075;
vocals.volume = 0;
if (theFunne)
noteMiss(daNote.noteData, daNote);
}
}
else
{
health -= 0.075;
vocals.volume = 0;
if (theFunne)
noteMiss(daNote.noteData, daNote);
}
}
daNote.visible = false;
@ -2501,16 +2546,21 @@ class PlayState extends MusicBeatState
if (useVideo)
{
GlobalVideo.get().stop();
FlxG.stage.window.onFocusOut.remove(focusOut);
FlxG.stage.window.onFocusIn.remove(focusIn);
PlayState.instance.remove(PlayState.instance.videoSprite);
}
if (isStoryMode)
campaignMisses = misses;
if (!loadRep)
rep.SaveReplay(saveNotes);
else
{
FlxG.save.data.botplay = false;
FlxG.save.data.scrollSpeed = 1;
FlxG.save.data.downscroll = false;
PlayStateChangeables.botPlay = false;
PlayStateChangeables.scrollSpeed = 1;
PlayStateChangeables.useDownscroll = false;
}
if (FlxG.save.data.fpsCap > 290)
@ -2527,6 +2577,8 @@ class PlayState extends MusicBeatState
canPause = false;
FlxG.sound.music.volume = 0;
vocals.volume = 0;
FlxG.sound.music.pause();
vocals.pause();
if (SONG.validScore)
{
// adjusting the highscore song name to be compatible
@ -2560,12 +2612,20 @@ class PlayState extends MusicBeatState
if (storyPlaylist.length <= 0)
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
FlxG.switchState(new StoryMenuState());
paused = true;
FlxG.sound.music.stop();
vocals.stop();
if (FlxG.save.data.scoreScreen)
openSubState(new ResultsScreen());
else
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
FlxG.switchState(new MainMenuState());
}
#if windows
if (luaModchart != null)
@ -2623,7 +2683,17 @@ class PlayState extends MusicBeatState
else
{
trace('WENT BACK TO FREEPLAY??');
FlxG.switchState(new FreeplayState());
paused = true;
FlxG.sound.music.stop();
vocals.stop();
if (FlxG.save.data.scoreScreen)
openSubState(new ResultsScreen());
else
FlxG.switchState(new PlayState());
}
}
}
@ -2639,11 +2709,10 @@ class PlayState extends MusicBeatState
private function popUpScore(daNote:Note):Void
{
var noteDiff:Float = Math.abs(Conductor.songPosition - daNote.strumTime);
var wife:Float = EtternaFunctions.wife3(noteDiff, Conductor.timeScale);
var noteDiff:Float = -(daNote.strumTime - Conductor.songPosition);
var wife:Float = EtternaFunctions.wife3(-noteDiff, Conductor.timeScale);
// boyfriend.playAnim('hey');
vocals.volume = 1;
var placement:String = Std.string(combo);
var coolText:FlxText = new FlxText(0, 0, 0, placement, 32);
@ -2738,7 +2807,10 @@ class PlayState extends MusicBeatState
rating.velocity.x -= FlxG.random.int(0, 10);
var msTiming = HelperFunctions.truncateFloat(noteDiff, 3);
if(FlxG.save.data.botplay) msTiming = 0;
if(PlayStateChangeables.botPlay && !loadRep) msTiming = 0;
if (loadRep)
msTiming = HelperFunctions.truncateFloat(findByTime(daNote.strumTime)[3], 3);
if (currentTimingShown != null)
remove(currentTimingShown);
@ -2784,7 +2856,7 @@ class PlayState extends MusicBeatState
if (currentTimingShown.alpha != 1)
currentTimingShown.alpha = 1;
if(!FlxG.save.data.botplay) add(currentTimingShown);
if(!PlayStateChangeables.botPlay || loadRep) add(currentTimingShown);
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
comboSpr.screenCenter();
@ -2801,7 +2873,7 @@ class PlayState extends MusicBeatState
comboSpr.velocity.x += FlxG.random.int(1, 10);
currentTimingShown.velocity.x += comboSpr.velocity.x;
if(!FlxG.save.data.botplay) add(rating);
if(!PlayStateChangeables.botPlay || loadRep) add(rating);
if (!curStage.startsWith('school'))
{
@ -2828,6 +2900,9 @@ class PlayState extends MusicBeatState
var comboSplit:Array<String> = (combo + "").split('');
if (combo > highestCombo)
highestCombo = combo;
// make sure we have 3 digits to display (looks weird otherwise lol)
if (comboSplit.length == 1)
{
@ -2952,7 +3027,7 @@ class PlayState extends MusicBeatState
#end
// Prevent player input if botplay is on
if(FlxG.save.data.botplay)
if(PlayStateChangeables.botPlay)
{
holdArray = [false, false, false, false];
pressArray = [false, false, false, false];
@ -3012,8 +3087,6 @@ class PlayState extends MusicBeatState
}
});
trace('\nCURRENT LINE:\n' + directionsAccounted);
for (note in dumbNotes)
{
FlxG.log.add("killing dumb ass note at " + note.strumTime);
@ -3062,7 +3135,7 @@ class PlayState extends MusicBeatState
noteMiss(shit, null);
}
if(dontCheck && possibleNotes.length > 0 && FlxG.save.data.ghost && !FlxG.save.data.botplay)
if(dontCheck && possibleNotes.length > 0 && FlxG.save.data.ghost && !PlayStateChangeables.botPlay)
{
if (mashViolations > 8)
{
@ -3078,17 +3151,19 @@ class PlayState extends MusicBeatState
notes.forEachAlive(function(daNote:Note)
{
if(FlxG.save.data.downscroll && daNote.y > strumLine.y ||
!FlxG.save.data.downscroll && daNote.y < strumLine.y)
if(PlayStateChangeables.useDownscroll && daNote.y > strumLine.y ||
!PlayStateChangeables.useDownscroll && daNote.y < strumLine.y)
{
// Force good note hit regardless if it's too late to hit it or not as a fail safe
if(FlxG.save.data.botplay && daNote.canBeHit && daNote.mustPress ||
FlxG.save.data.botplay && daNote.tooLate && daNote.mustPress)
if(PlayStateChangeables.botPlay && daNote.canBeHit && daNote.mustPress ||
PlayStateChangeables.botPlay && daNote.tooLate && daNote.mustPress)
{
if(loadRep)
{
//trace('ReplayNote ' + tmpRepNote.strumtime + ' | ' + tmpRepNote.direction);
if(rep.replay.songNotes.contains(HelperFunctions.truncateFloat(daNote.strumTime, 2)))
var n = findByTime(daNote.strumTime);
trace(n);
if(n != null)
{
goodNoteHit(daNote);
boyfriend.holdTimer = daNote.sustainLength;
@ -3101,7 +3176,7 @@ class PlayState extends MusicBeatState
}
});
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && (!holdArray.contains(true) || FlxG.save.data.botplay))
if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && (!holdArray.contains(true) || PlayStateChangeables.botPlay))
{
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
boyfriend.playAnim('idle');
@ -3125,6 +3200,17 @@ class PlayState extends MusicBeatState
});
}
public function findByTime(time:Float):Array<Dynamic>
{
for (i in rep.replay.songNotes)
{
//trace('checking ' + Math.round(i[0]) + ' against ' + Math.round(time));
if (i[0] == time)
return i;
}
return null;
}
public var fuckingVolume:Float = 1;
public var useVideo = false;
@ -3134,10 +3220,34 @@ class PlayState extends MusicBeatState
public var videoSprite:FlxSprite;
public function focusOut() {
if (paused)
return;
persistentUpdate = false;
persistentDraw = true;
paused = true;
if (FlxG.sound.music != null)
{
FlxG.sound.music.pause();
vocals.pause();
}
openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
}
public function focusIn()
{
// nada
}
public function backgroundVideo(source:String) // for background videos
{
useVideo = true;
FlxG.stage.window.onFocusOut.add(focusOut);
FlxG.stage.window.onFocusIn.add(focusIn);
var ourSource:String = "assets/videos/daWeirdVid/dontDelete.webm";
WebmPlayer.SKIP_STEP_LIMIT = 90;
var str1:String = "WEBM SHIT";
@ -3173,7 +3283,7 @@ class PlayState extends MusicBeatState
remove(boyfriend);
remove(dad);
add(videoSprite);
add(gf);
add(gf);
add(boyfriend);
add(dad);
@ -3197,6 +3307,15 @@ class PlayState extends MusicBeatState
combo = 0;
misses++;
if (daNote != null)
{
if (!loadRep)
saveNotes.push([daNote.strumTime,0,direction,166 * Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166]);
}
else
if (!loadRep)
saveNotes.push([Conductor.songPosition,0,direction,166 * Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166]);
//var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition);
//var wife:Float = EtternaFunctions.wife3(noteDiff, FlxG.save.data.etternaMode ? 1 : 1.7);
@ -3283,9 +3402,9 @@ class PlayState extends MusicBeatState
function noteCheck(controlArray:Array<Bool>, note:Note):Void // sorry lol
{
var noteDiff:Float = Math.abs(note.strumTime - Conductor.songPosition);
var noteDiff:Float = -(note.strumTime - Conductor.songPosition);
note.rating = Ratings.CalculateRating(noteDiff);
note.rating = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
/* if (loadRep)
{
@ -3334,10 +3453,16 @@ class PlayState extends MusicBeatState
if (mashing != 0)
mashing = 0;
var noteDiff:Float = Math.abs(note.strumTime - Conductor.songPosition);
var noteDiff:Float = -(note.strumTime - Conductor.songPosition);
if(loadRep)
noteDiff = findByTime(note.strumTime)[3];
note.rating = Ratings.CalculateRating(noteDiff);
if (note.rating == "miss")
return;
// add newest note to front of notesHitArray
// the oldest notes are at the end and are removed first
if (!note.isSustainNote)
@ -3379,7 +3504,13 @@ class PlayState extends MusicBeatState
if(!loadRep && note.mustPress)
saveNotes.push(HelperFunctions.truncateFloat(note.strumTime, 2));
{
var array = [note.strumTime,note.sustainLength,note.noteData,noteDiff];
if (note.isSustainNote)
array[1] = -1;
trace('pushing ' + array[0]);
saveNotes.push(array);
}
playerStrums.forEach(function(spr:FlxSprite)
{
@ -3518,8 +3649,6 @@ class PlayState extends MusicBeatState
}
#end
// yes this updates every step.
// yes this is bad
// but i'm doing it to update misses and accuracy
@ -3542,7 +3671,7 @@ class PlayState extends MusicBeatState
if (generatedMusic)
{
notes.sort(FlxSort.byY, (FlxG.save.data.downscroll ? FlxSort.ASCENDING : FlxSort.DESCENDING));
notes.sort(FlxSort.byY, (PlayStateChangeables.useDownscroll ? FlxSort.ASCENDING : FlxSort.DESCENDING));
}
#if windows
@ -3592,13 +3721,14 @@ class PlayState extends MusicBeatState
camHUD.zoom += 0.03;
}
iconP1.setGraphicSize(Std.int(iconP1.width + 30));
iconP2.setGraphicSize(Std.int(iconP2.width + 30));
iconP1.updateHitbox();
iconP2.updateHitbox();
}
iconP1.setGraphicSize(Std.int(iconP1.width + 30));
iconP2.setGraphicSize(Std.int(iconP2.width + 30));
iconP1.updateHitbox();
iconP2.updateHitbox();
if (curBeat % gfSpeed == 0)
{
gf.dance();