Merge branch 'master' into patch-3

This commit is contained in:
Lucky56 2021-06-22 13:12:54 +02:00 committed by GitHub
commit 6b4062c3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 210 additions and 32 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -44,8 +44,14 @@ class Alphabet extends FlxSpriteGroup
var isBold:Bool = false; var isBold:Bool = false;
var pastX:Float = 0;
var pastY:Float = 0;
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false) public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false)
{ {
pastX = x;
pastY = y;
super(x, y); super(x, y);
_finalText = text; _finalText = text;
@ -66,6 +72,24 @@ class Alphabet extends FlxSpriteGroup
} }
} }
public function reType(text)
{
for (i in listOAlphabets)
remove(i);
_finalText = text;
this.text = text;
lastSprite = null;
updateHitbox();
listOAlphabets.clear();
x = pastX;
y = pastY;
addText();
}
public function addText() public function addText()
{ {
doSplitWords(); doSplitWords();

View File

@ -237,7 +237,7 @@ class HitGraph extends Sprite
/*if (i == 0) /*if (i == 0)
gfx.moveTo(graphX, _axis.y + pointY);*/ gfx.moveTo(graphX, _axis.y + pointY);*/
gfx.drawRect(graphX + fitX(history[i][2]), pointY,4,4); gfx.drawRect(fitX(history[i][2]), pointY,4,4);
gfx.endFill(); gfx.endFill();
} }

View File

@ -93,6 +93,9 @@ class KadeEngineData
if (FlxG.save.data.inputShow == null) if (FlxG.save.data.inputShow == null)
FlxG.save.data.inputShow = false; FlxG.save.data.inputShow = false;
if (FlxG.save.data.optimize == null)
FlxG.save.data.optimize = false;
Conductor.recalculateTimings(); Conductor.recalculateTimings();
PlayerSettings.player1.controls.loadKeyBinds(); PlayerSettings.player1.controls.loadKeyBinds();
KeyBinds.keyCheck(); KeyBinds.keyCheck();

View File

@ -312,7 +312,7 @@ class Judgement extends Option
FlxG.save.data.frames = Conductor.safeFrames; FlxG.save.data.frames = Conductor.safeFrames;
Conductor.recalculateTimings(); Conductor.recalculateTimings();
return true; return false;
} }
override function getValue():String { override function getValue():String {
@ -370,6 +370,7 @@ class ScoreScreen extends Option
public override function press():Bool public override function press():Bool
{ {
FlxG.save.data.scoreScreen = !FlxG.save.data.scoreScreen; FlxG.save.data.scoreScreen = !FlxG.save.data.scoreScreen;
display = updateDisplay();
return true; return true;
} }
@ -503,6 +504,27 @@ class RainbowFPSOption extends Option
} }
} }
class Optimization extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.optimize = !FlxG.save.data.optimize;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Optimization " + (FlxG.save.data.optimize ? "ON" : "OFF");
}
}
class NPSDisplayOption extends Option class NPSDisplayOption extends Option
{ {
public function new(desc:String) public function new(desc:String)

View File

@ -57,9 +57,10 @@ class OptionsMenu extends MusicBeatState
#end #end
new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."), new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."),
new WatermarkOption("Enable and disable all watermarks from the engine."), new WatermarkOption("Enable and disable all watermarks from the engine."),
new BotPlay("Showcase your charts and mods with autoplay."),
new ScoreScreen("Show the score screen after the end of a song"), new ScoreScreen("Show the score screen after the end of a song"),
new ShowInput("Display every single input in the score screen.") new ShowInput("Display every single input in the score screen."),
new Optimization("No backgrounds, no characters, centered notes, no player 2."),
new BotPlay("Showcase your charts and mods with autoplay.")
]), ]),
new OptionCategory("Manage Save Data", [ new OptionCategory("Manage Save Data", [
@ -220,10 +221,8 @@ class OptionsMenu extends MusicBeatState
if (isCat) if (isCat)
{ {
if (currentSelectedCat.getOptions()[curSelected].press()) { if (currentSelectedCat.getOptions()[curSelected].press()) {
grpControls.remove(grpControls.members[curSelected]); grpControls.members[curSelected].reType(currentSelectedCat.getOptions()[curSelected].getDisplay());
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, currentSelectedCat.getOptions()[curSelected].getDisplay(), true, false); trace(currentSelectedCat.getOptions()[curSelected].getDisplay());
ctrl.isMenuItem = true;
grpControls.add(ctrl);
} }
} }
else else
@ -242,7 +241,7 @@ class OptionsMenu extends MusicBeatState
curSelected = 0; curSelected = 0;
} }
changeSelection(curSelected); changeSelection();
} }
} }
FlxG.save.flush(); FlxG.save.flush();

View File

@ -1,5 +1,9 @@
package; package;
import openfl.events.Event;
import haxe.EnumTools;
import openfl.ui.Keyboard;
import openfl.events.KeyboardEvent;
import Replay.Ana; import Replay.Ana;
import Replay.Analysis; import Replay.Analysis;
import webm.WebmPlayer; import webm.WebmPlayer;
@ -254,7 +258,7 @@ class PlayState extends MusicBeatState
PlayStateChangeables.safeFrames = FlxG.save.data.frames; PlayStateChangeables.safeFrames = FlxG.save.data.frames;
PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed; PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed;
PlayStateChangeables.botPlay = FlxG.save.data.botplay; PlayStateChangeables.botPlay = FlxG.save.data.botplay;
PlayStateChangeables.Optimize = FlxG.save.data.optimize;
// pre lowercasing the song name (create) // pre lowercasing the song name (create)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
@ -267,6 +271,8 @@ class PlayState extends MusicBeatState
#if windows #if windows
executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart"));
if (executeModchart)
PlayStateChangeables.Optimize = false;
#end #end
#if !cpp #if !cpp
executeModchart = false; // FORCE disable for non cpp targets executeModchart = false; // FORCE disable for non cpp targets
@ -373,6 +379,9 @@ class PlayState extends MusicBeatState
} }
} else {stageCheck = SONG.stage;} } else {stageCheck = SONG.stage;}
if (!PlayStateChangeables.Optimize)
{
switch(stageCheck) switch(stageCheck)
{ {
case 'halloween': case 'halloween':
@ -752,7 +761,7 @@ class PlayState extends MusicBeatState
add(stageCurtains); add(stageCurtains);
} }
} }
}
//defaults if no gf was found in chart //defaults if no gf was found in chart
var gfCheck:String = 'gf'; var gfCheck:String = 'gf';
@ -866,6 +875,8 @@ class PlayState extends MusicBeatState
gf.y += 300; gf.y += 300;
} }
if (!PlayStateChangeables.Optimize)
{
add(gf); add(gf);
// Shitty layering but whatev it works LOL // Shitty layering but whatev it works LOL
@ -874,6 +885,9 @@ class PlayState extends MusicBeatState
add(dad); add(dad);
add(boyfriend); add(boyfriend);
}
if (loadRep) if (loadRep)
{ {
FlxG.watch.addQuick('rep rpesses',repPresses); FlxG.watch.addQuick('rep rpesses',repPresses);
@ -1109,6 +1123,8 @@ class PlayState extends MusicBeatState
if (!loadRep) if (!loadRep)
rep = new Replay("na"); rep = new Replay("na");
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN,handleInput);
super.create(); super.create();
} }
@ -1337,6 +1353,49 @@ class PlayState extends MusicBeatState
var songTime:Float = 0; var songTime:Float = 0;
private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs
if (PlayStateChangeables.botPlay || loadRep || paused)
return;
var key = String.fromCharCode(evt.charCode);
var binds:Array<String> = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind];
var data = -1;
for (i in 0...binds.length)
if (binds[i].toLowerCase() == key)
data = i;
if (data == -1)
return;
var ana = new Ana(Conductor.songPosition, null, false, "miss", data);
var dataNotes = [];
notes.forEachAlive(function(daNote:Note)
{
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit && daNote.noteData == data)
dataNotes.push(daNote);
}); // Collect notes that can be hit
dataNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); // sort by the earliest note
if (dataNotes.length != 0)
{
var coolNote = dataNotes[0];
goodNoteHit(coolNote);
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
ana.hit = true;
ana.hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
ana.nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
}
}
var songStarted = false; var songStarted = false;
function startSong():Void function startSong():Void
@ -1489,6 +1548,10 @@ class PlayState extends MusicBeatState
oldNote = null; oldNote = null;
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote); var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
if (!gottaHitNote && PlayStateChangeables.Optimize)
continue;
swagNote.sustainLength = songNotes[2]; swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0); swagNote.scrollFactor.set(0, 0);
@ -1549,6 +1612,9 @@ class PlayState extends MusicBeatState
//defaults if no noteStyle was found in chart //defaults if no noteStyle was found in chart
var noteTypeCheck:String = 'normal'; var noteTypeCheck:String = 'normal';
if (PlayStateChangeables.Optimize && player == 0)
continue;
if (SONG.noteStyle == null) { if (SONG.noteStyle == null) {
switch(storyWeek) {case 6: noteTypeCheck = 'pixel';} switch(storyWeek) {case 6: noteTypeCheck = 'pixel';}
} else {noteTypeCheck = SONG.noteStyle;} } else {noteTypeCheck = SONG.noteStyle;}
@ -1683,6 +1749,9 @@ class PlayState extends MusicBeatState
babyArrow.x += 50; babyArrow.x += 50;
babyArrow.x += ((FlxG.width / 2) * player); babyArrow.x += ((FlxG.width / 2) * player);
if (PlayStateChangeables.Optimize)
babyArrow.x -= 275;
cpuStrums.forEach(function(spr:FlxSprite) cpuStrums.forEach(function(spr:FlxSprite)
{ {
spr.centerOffsets(); //CPU arrows start out slightly off-center spr.centerOffsets(); //CPU arrows start out slightly off-center
@ -1880,7 +1949,7 @@ class PlayState extends MusicBeatState
switch (curStage) switch (curStage)
{ {
case 'philly': case 'philly':
if (trainMoving) if (trainMoving && !PlayStateChangeables.Optimize)
{ {
trainFrameTiming += elapsed; trainFrameTiming += elapsed;
@ -1931,6 +2000,7 @@ class PlayState extends MusicBeatState
DiscordClient.changePresence("Chart Editor", null, null, true); DiscordClient.changePresence("Chart Editor", null, null, true);
#end #end
FlxG.switchState(new ChartingState()); FlxG.switchState(new ChartingState());
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
#if windows #if windows
if (luaModchart != null) if (luaModchart != null)
{ {
@ -1982,6 +2052,7 @@ class PlayState extends MusicBeatState
} }
FlxG.switchState(new AnimationDebug(SONG.player2)); FlxG.switchState(new AnimationDebug(SONG.player2));
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
#if windows #if windows
if (luaModchart != null) if (luaModchart != null)
{ {
@ -1994,6 +2065,7 @@ class PlayState extends MusicBeatState
if (FlxG.keys.justPressed.ZERO) if (FlxG.keys.justPressed.ZERO)
{ {
FlxG.switchState(new AnimationDebug(SONG.player1)); FlxG.switchState(new AnimationDebug(SONG.player1));
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
#if windows #if windows
if (luaModchart != null) if (luaModchart != null)
{ {
@ -2547,6 +2619,7 @@ class PlayState extends MusicBeatState
function endSong():Void function endSong():Void
{ {
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
if (useVideo) if (useVideo)
{ {
GlobalVideo.get().stop(); GlobalVideo.get().stop();
@ -3005,6 +3078,8 @@ class PlayState extends MusicBeatState
var rightHold:Bool = false; var rightHold:Bool = false;
var leftHold:Bool = false; var leftHold:Bool = false;
// THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY
private function keyShit():Void // I've invested in emma stocks private function keyShit():Void // I've invested in emma stocks
{ {
// control arrays, order L D R U // control arrays, order L D R U
@ -3030,7 +3105,6 @@ class PlayState extends MusicBeatState
}; };
#end #end
// Prevent player input if botplay is on // Prevent player input if botplay is on
if(PlayStateChangeables.botPlay) if(PlayStateChangeables.botPlay)
{ {
@ -3041,9 +3115,9 @@ class PlayState extends MusicBeatState
var anas:Array<Ana> = [null,null,null,null]; var anas:Array<Ana> = [null,null,null,null];
for (i in 0...pressArray.length) /*for (i in 0...pressArray.length)
if (pressArray[i]) if (pressArray[i])
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i); anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);*/
// HOLDS, check for sustain notes // HOLDS, check for sustain notes
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic) if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
@ -3056,7 +3130,7 @@ class PlayState extends MusicBeatState
} }
// PRESSES, check for note hits // PRESSES, check for note hits
if (pressArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic) /*if (pressArray.contains(true) && generatedMusic)
{ {
boyfriend.holdTimer = 0; boyfriend.holdTimer = 0;
@ -3070,14 +3144,37 @@ class PlayState extends MusicBeatState
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit) if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
{ {
if (!directionsAccounted[daNote.noteData]) if (!directionsAccounted[daNote.noteData])
{
if (directionList.contains(daNote.noteData))
{ {
directionsAccounted[daNote.noteData] = true; directionsAccounted[daNote.noteData] = true;
for (coolNote in possibleNotes)
{
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
{ // if it's the same note twice at < 10ms distance, just delete it
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
dumbNotes.push(daNote);
break;
}
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
{ // if daNote is earlier than existing note (coolNote), replace
possibleNotes.remove(coolNote);
possibleNotes.push(daNote);
break;
}
}
}
else
{
possibleNotes.push(daNote); possibleNotes.push(daNote);
directionList.push(daNote.noteData); directionList.push(daNote.noteData);
} }
} }
}
}); });
trace('notes that can be hit: ' + possibleNotes.length);
for (note in dumbNotes) for (note in dumbNotes)
{ {
FlxG.log.add("killing dumb ass note at " + note.strumTime); FlxG.log.add("killing dumb ass note at " + note.strumTime);
@ -3122,12 +3219,12 @@ class PlayState extends MusicBeatState
noteMiss(shit, null); noteMiss(shit, null);
} }
} }*/
if (!loadRep) /*if (!loadRep)
for (i in anas) for (i in anas)
if (i != null) if (i != null)
replayAna.anaArray.push(i); // put em all there replayAna.anaArray.push(i); // put em all there*/
notes.forEachAlive(function(daNote:Note) notes.forEachAlive(function(daNote:Note)
{ {
@ -3508,7 +3605,6 @@ class PlayState extends MusicBeatState
var array = [note.strumTime,note.sustainLength,note.noteData,noteDiff]; var array = [note.strumTime,note.sustainLength,note.noteData,noteDiff];
if (note.isSustainNote) if (note.isSustainNote)
array[1] = -1; array[1] = -1;
trace('pushing ' + array[0]);
saveNotes.push(array); saveNotes.push(array);
saveJudge.push(note.rating); saveJudge.push(note.rating);
} }

View File

@ -4,4 +4,5 @@ class PlayStateChangeables
public static var safeFrames:Int; public static var safeFrames:Int;
public static var scrollSpeed:Float; public static var scrollSpeed:Float;
public static var botPlay:Bool; public static var botPlay:Bool;
public static var Optimize:Bool;
} }

View File

@ -74,7 +74,7 @@ class ResultsScreen extends FlxSubState
text.text = "Week Cleared!"; text.text = "Week Cleared!";
} }
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses) + PlayState.shits}\nHighest Combo: ${PlayState.highestCombo + 1}\n\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\n\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song
'); ');
comboText.size = 28; comboText.size = 28;
comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1); comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
@ -179,6 +179,17 @@ class ResultsScreen extends FlxSubState
PlayState.loadRep = false; PlayState.loadRep = false;
PlayState.rep = null; PlayState.rep = null;
var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
Highscore.saveScore(songHighscore, Math.round(PlayState.instance.songScore), PlayState.storyDifficulty);
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(PlayState.instance.accuracy),PlayState.storyDifficulty);
#end
if (PlayState.isStoryMode) if (PlayState.isStoryMode)
{ {
FlxG.sound.playMusic(Paths.music('freakyMenu')); FlxG.sound.playMusic(Paths.music('freakyMenu'));
@ -210,6 +221,17 @@ class ResultsScreen extends FlxSubState
case 'philly-nice': songFormat = 'Philly'; case 'philly-nice': songFormat = 'Philly';
} }
var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
Highscore.saveScore(songHighscore, Math.round(PlayState.instance.songScore), PlayState.storyDifficulty);
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(PlayState.instance.accuracy),PlayState.storyDifficulty);
#end
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff); var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
music.fadeOut(0.3); music.fadeOut(0.3);
@ -227,6 +249,17 @@ class ResultsScreen extends FlxSubState
PlayState.loadRep = false; PlayState.loadRep = false;
var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
Highscore.saveScore(songHighscore, Math.round(PlayState.instance.songScore), PlayState.storyDifficulty);
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(PlayState.instance.accuracy),PlayState.storyDifficulty);
#end
var songFormat = StringTools.replace(PlayState.SONG.song, " ", "-"); var songFormat = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songFormat) { switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle'; case 'Dad-Battle': songFormat = 'Dadbattle';