diff --git a/Project.xml b/Project.xml index 86cd7c8..3504b38 100644 --- a/Project.xml +++ b/Project.xml @@ -127,7 +127,7 @@ - + diff --git a/art/flashFiles/Dad_assets.fla b/art/flashFiles/Dad_assets.fla index bfc25c3..c963a2c 100644 Binary files a/art/flashFiles/Dad_assets.fla and b/art/flashFiles/Dad_assets.fla differ diff --git a/assets/preload/data/roses/rosesDialogue.txt b/assets/preload/data/roses/dialogue.txt similarity index 98% rename from assets/preload/data/roses/rosesDialogue.txt rename to assets/preload/data/roses/dialogue.txt index c519763..63a60f8 100644 --- a/assets/preload/data/roses/rosesDialogue.txt +++ b/assets/preload/data/roses/dialogue.txt @@ -1,3 +1,3 @@ -:dad:Not bad for an ugly worm. -:dad:But this time I'll rip your nuts off right after your girlfriend finishes gargling mine. +:dad:Not bad for an ugly worm. +:dad:But this time I'll rip your nuts off right after your girlfriend finishes gargling mine. :bf:Bop beep be be skdoo bep \ No newline at end of file diff --git a/assets/preload/data/senpai/senpaiDialogue.txt b/assets/preload/data/senpai/dialogue.txt similarity index 98% rename from assets/preload/data/senpai/senpaiDialogue.txt rename to assets/preload/data/senpai/dialogue.txt index aa30163..af03e37 100644 --- a/assets/preload/data/senpai/senpaiDialogue.txt +++ b/assets/preload/data/senpai/dialogue.txt @@ -1,3 +1,3 @@ -:dad:Ah, a new fair maiden has come in search of true love! -:dad:A serenade between gentlemen shall decide where her beautiful heart shall reside. +:dad:Ah, a new fair maiden has come in search of true love! +:dad:A serenade between gentlemen shall decide where her beautiful heart shall reside. :bf:Beep bo bop \ No newline at end of file diff --git a/assets/preload/data/thorns/thornsDialogue.txt b/assets/preload/data/thorns/dialogue.txt similarity index 98% rename from assets/preload/data/thorns/thornsDialogue.txt rename to assets/preload/data/thorns/dialogue.txt index 82a7ae9..b430202 100644 --- a/assets/preload/data/thorns/thornsDialogue.txt +++ b/assets/preload/data/thorns/dialogue.txt @@ -1,5 +1,5 @@ -:dad:Direct contact with real humans, after being trapped in here for so long... -:dad:and HER of all people. -:dad:I'll make her father pay for what he's done to me and all the others,,,, -:dad:I'll beat you and make you take my place. +:dad:Direct contact with real humans, after being trapped in here for so long... +:dad:and HER of all people. +:dad:I'll make her father pay for what he's done to me and all the others,,,, +:dad:I'll beat you and make you take my place. :dad:You don't mind your bodies being borrowed right? It's only fair... \ No newline at end of file diff --git a/assets/shared/images/characters/DADDY_DEAREST.png b/assets/shared/images/characters/DADDY_DEAREST.png index 6acb600..35741dc 100644 Binary files a/assets/shared/images/characters/DADDY_DEAREST.png and b/assets/shared/images/characters/DADDY_DEAREST.png differ diff --git a/assets/shared/images/characters/DADDY_DEAREST.xml b/assets/shared/images/characters/DADDY_DEAREST.xml index eaa7594..87f4fd9 100644 --- a/assets/shared/images/characters/DADDY_DEAREST.xml +++ b/assets/shared/images/characters/DADDY_DEAREST.xml @@ -1,50 +1,129 @@  - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/building.md b/docs/building.md index 5b0b6b1..806c8f3 100644 --- a/docs/building.md +++ b/docs/building.md @@ -24,7 +24,7 @@ - `haxelib install flixel-ui` - `haxelib install hscript` - `haxelib install newgrounds` - - `haxelib install linc_luajit` + - `haxelib git linc_luajit https://github.com/AndreiRudenko/linc_luajit.git` - `haxelib git faxe https://github.com/uhrobots/faxe` - `haxelib git polymod https://github.com/larsiusprime/polymod.git` - `haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc` diff --git a/docs/changelogs/changelog-1.6.2.md b/docs/changelogs/changelog-1.6.2.md new file mode 100644 index 0000000..7c520f6 --- /dev/null +++ b/docs/changelogs/changelog-1.6.2.md @@ -0,0 +1,29 @@ +# Latest (master) changelog/Changelog + +Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`. + +### Additions +- Added a Instant Respawn Option +- 💖 Added the ability to select and modify notes in the editor +- Added the ability for note specific alternative animation toggles +- 💖 Added copy and paste (with ctrl z support) while selecting notes +- Added 12th and 24th snaps + +### Changes +- Play Here option changed for the better +- Changed left or right in the charter to skip forward or backward a section +- 💖 Optimized gameplay (less lag??) +- 💖 Optimized the chart editor (less lag on longer songs, and faster load times) +- Gameplay Customization now allows for you to change the zoom of the play field +- SM Files now give you more details on why they can't be loaded. + +### Bugfixes +- 💖 Fixed stutter at the start of a song +- Fixed a bunch of week 6 crashing related issues +- Fixed tutorial crashing on story mode +- Fixed notes in an SM file desyncing with sections +- 💖 Fixed scroll speed changes so they work when more then one of them exist +- Fixed steps reseting to 0 on a bpm change IN gameplay +- Fixed claps so they're based on time instead of the note's y position +- Swap Section no longer breaks with duets +- 💖 Modcharts now work on Linux! \ No newline at end of file diff --git a/docs/changelogs/index.md b/docs/changelogs/index.md index a34c60e..b85d9e0 100644 --- a/docs/changelogs/index.md +++ b/docs/changelogs/index.md @@ -1,6 +1,7 @@ # Changelogs - [Latest](latest) (Contains changes that are not in a release yet) +- [1.6.2](changelog-1.6.2) - [1.6.1](changelog-1.6.1) - [1.6](changelog-1.6) - [1.5.4](changelog-1.5.4) diff --git a/source/Alphabet.hx b/source/Alphabet.hx index eec323d..b1f75cd 100644 --- a/source/Alphabet.hx +++ b/source/Alphabet.hx @@ -1,5 +1,6 @@ package; +import flixel.math.FlxPoint; import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.FlxG; @@ -47,11 +48,20 @@ class Alphabet extends FlxSpriteGroup 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) + // ThatGuy: Variables here to be used later + var xScale:Float; + var yScale:Float; + + // ThatGuy: Added 2 more variables, xScale and yScale for resizing text + public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false, xScale:Float = 1, yScale:Float = 1) { pastX = x; pastY = y; + // ThatGuy: Have to assign these variables + this.xScale = xScale; + this.yScale = yScale; + super(x, y); _finalText = text; @@ -72,7 +82,7 @@ class Alphabet extends FlxSpriteGroup } } - public function reType(text) + public function reType(text, xScale:Float = 1, yScale:Float = 1) { for (i in listOAlphabets) remove(i); @@ -86,6 +96,9 @@ class Alphabet extends FlxSpriteGroup listOAlphabets.clear(); x = pastX; y = pastY; + + this.xScale = xScale; + this.yScale = yScale; addText(); } @@ -111,17 +124,24 @@ class Alphabet extends FlxSpriteGroup { if (lastSprite != null) { - xPos = lastSprite.x + lastSprite.width; + // ThatGuy: This is the line that fixes the spacing error when the x position of this class's objects was anything other than 0 + xPos = lastSprite.x - pastX + lastSprite.width; } if (lastWasSpace) { - xPos += 40; + // ThatGuy: Also this line + xPos += 40 * xScale; lastWasSpace = false; } // var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0); var letter:AlphaCharacter = new AlphaCharacter(xPos, 0); + + // ThatGuy: These are the lines that change the individual scaling of each character + letter.scale.set(xScale, yScale); + letter.updateHitbox(); + listOAlphabets.add(letter); if (isBold) @@ -147,6 +167,7 @@ class Alphabet extends FlxSpriteGroup public var personTalking:String = 'gf'; + // ThatGuy: THIS FUNCTION ISNT CHANGED! Because i dont use it lol public function startTypedText():Void { _finalText = text; @@ -261,6 +282,36 @@ class Alphabet extends FlxSpriteGroup super.update(elapsed); } + + // ThatGuy: Ooga booga function for resizing text, with the option of wanting it to have the same midPoint + // Side note: Do not, EVER, do updateHitbox() unless you are retyping the whole thing. Don't know why, but the position gets retarded if you do that + public function resizeText(xScale:Float, yScale:Float, xStaysCentered:Bool = true, yStaysCentered:Bool = false):Void { + var oldMidpoint:FlxPoint = this.getMidpoint(); + reType(text, xScale, yScale); + if(!(xStaysCentered && yStaysCentered)){ + if(xStaysCentered) { + //I can just use this juicy new function i made + moveTextToMidpoint(new FlxPoint(oldMidpoint.x, getMidpoint().y)); + } + if(yStaysCentered) { + moveTextToMidpoint(new FlxPoint(getMidpoint().x, oldMidpoint.y)); + } + } else { + moveTextToMidpoint(new FlxPoint(oldMidpoint.x, oldMidpoint.y)); + } + + } + + // ThatGuy: Function used to keep text centered on one point instead of manually having to come up with offsets for each sentence + public function moveTextToMidpoint(midpoint:FlxPoint):Void { + /* + e.g. You want your midpoint at (100, 100) + and your text is 200 wide, 50 tall + then, x = 100 - 200/2, y = 100 - 50/2 + */ + this.x = midpoint.x - this.width / 2; + this.y = midpoint.y - this.height / 2; + } } class AlphaCharacter extends FlxSprite diff --git a/source/BackgroundDancer.hx b/source/BackgroundDancer.hx index 07ef6da..99a83df 100644 --- a/source/BackgroundDancer.hx +++ b/source/BackgroundDancer.hx @@ -14,10 +14,7 @@ class BackgroundDancer extends FlxSprite animation.addByIndices('danceLeft', 'bg dancer sketch PINK', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); animation.addByIndices('danceRight', 'bg dancer sketch PINK', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); animation.play('danceLeft'); - if(FlxG.save.data.antialiasing) - { - antialiasing = true; - } + antialiasing = FlxG.save.data.antialiasing; } var danceDir:Bool = false; diff --git a/source/Caching.hx b/source/Caching.hx index 568c921..9160f8e 100644 --- a/source/Caching.hx +++ b/source/Caching.hx @@ -73,10 +73,15 @@ class Caching extends MusicBeatState text.y -= kadeLogo.height / 2 - 125; text.x -= 170; kadeLogo.setGraphicSize(Std.int(kadeLogo.width * 0.6)); - kadeLogo.antialiasing = true; + if(FlxG.save.data.antialiasing != null) + kadeLogo.antialiasing = FlxG.save.data.antialiasing; + else + kadeLogo.antialiasing = true; kadeLogo.alpha = 0; + FlxGraphic.defaultPersist = FlxG.save.data.cacheImages; + #if cpp if (FlxG.save.data.cacheImages) { diff --git a/source/Character.hx b/source/Character.hx index da801e1..542b8688 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -26,10 +26,7 @@ class Character extends FlxSprite this.isPlayer = isPlayer; var tex:FlxAtlasFrames; - if(FlxG.save.data.antialiasing) - { - antialiasing = true; - } + antialiasing = FlxG.save.data.antialiasing; switch (curCharacter) { @@ -103,11 +100,11 @@ class Character extends FlxSprite // DAD ANIMATION LOADING CODE tex = Paths.getSparrowAtlas('DADDY_DEAREST','shared',true); frames = tex; - animation.addByPrefix('idle', 'Dad idle dance', 24); - animation.addByPrefix('singUP', 'Dad Sing Note UP', 24); - animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24); - animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24); - animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24); + animation.addByPrefix('idle', 'Dad idle dance', 24, false); + animation.addByPrefix('singUP', 'Dad Sing Note UP', 24, false); + animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24, false); + animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24, false); + animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24, false); loadOffsetFile(curCharacter); @@ -181,7 +178,7 @@ class Character extends FlxSprite case 'pico': tex = Paths.getSparrowAtlas('Pico_FNF_assetss','shared',true); frames = tex; - animation.addByPrefix('idle', "Pico Idle Dance", 24); + animation.addByPrefix('idle', "Pico Idle Dance", 24, false); animation.addByPrefix('singUP', 'pico Up note0', 24, false); animation.addByPrefix('singDOWN', 'Pico Down Note0', 24, false); if (isPlayer) @@ -348,7 +345,7 @@ class Character extends FlxSprite antialiasing = false; case 'spirit': - frames = Paths.getPackerAtlas('spirit','shared',false); + frames = Paths.getPackerAtlas('spirit','shared',true); animation.addByPrefix('idle', "idle spirit_", 24, false); animation.addByPrefix('singUP', "up_", 24, false); animation.addByPrefix('singRIGHT', "right_", 24, false); @@ -455,7 +452,7 @@ class Character extends FlxSprite /** * FOR GF DANCING SHIT */ - public function dance(forced:Bool = false) + public function dance(forced:Bool = false, altAnim:Bool = false) { if (!debugMode) { @@ -479,13 +476,25 @@ class Character extends FlxSprite else playAnim('danceLeft'); default: - playAnim('idle', forced); + if (altAnim && animation.getByName('idle-alt') != null) + playAnim('idle-alt', forced); + else + playAnim('idle', forced); } } } public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void { + + if (AnimName.endsWith('alt') && animation.getByName(AnimName) == null) + { + #if debug + FlxG.log.warn(['Such alt animation doesnt exist: ' + AnimName]); + #end + AnimName = AnimName.split('-')[0]; + } + animation.play(AnimName, Force, Reversed, Frame); var daOffset = animOffsets.get(AnimName); diff --git a/source/ChartingBox.hx b/source/ChartingBox.hx new file mode 100644 index 0000000..e9d933b --- /dev/null +++ b/source/ChartingBox.hx @@ -0,0 +1,17 @@ +import flixel.util.FlxColor; +import flixel.FlxSprite; + +class ChartingBox extends FlxSprite +{ + public var connectedNote:Note; + public var connectedNoteData:Array; + + public function new(x,y, originalNote:Note) + { + super(x,y); + connectedNote = originalNote; + + makeGraphic(40,40,FlxColor.fromRGB(173, 216, 230)); + alpha = 0.4; + } +} \ No newline at end of file diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 6357545..39c5c01 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -66,7 +66,7 @@ class ChartingState extends MusicBeatState public static var lengthInBeats:Float = 0; public var beatsShown:Float = 1; // for the zoom factor - public var zoomFactor:Float = 1; + public var zoomFactor:Float = 0.4; /** * Array of notes showing when each section STARTS in STEPS @@ -131,6 +131,8 @@ class ChartingState extends MusicBeatState var camFollow:FlxObject; + //public var waveform:Waveform; + public static var latestChartVersion = "2"; override function create() @@ -145,10 +147,13 @@ class ChartingState extends MusicBeatState deezNuts.set(4,1); deezNuts.set(8,2); + deezNuts.set(12,3); deezNuts.set(16,4); + deezNuts.set(24,6); deezNuts.set(32,8); deezNuts.set(64,16); + sectionRenderes = new FlxTypedGroup(); lines = new FlxTypedGroup(); texts = new FlxTypedGroup(); @@ -196,7 +201,6 @@ class ChartingState extends MusicBeatState curRenderedSustains = new FlxTypedGroup(); FlxG.mouse.visible = true; - FlxG.save.bind('funkin', 'ninjamuffin99'); tempBpm = _song.bpm; @@ -261,7 +265,9 @@ class ChartingState extends MusicBeatState lastSeg = seg; } + recalculateAllSectionTimes(); + trace("Song length in MS: " + FlxG.sound.music.length); @@ -294,7 +300,7 @@ class ChartingState extends MusicBeatState { var renderer = new SectionRender(0,640 * awfgaw,GRID_SIZE); if (_song.notes[awfgaw] == null) - _song.notes.push(newSection(16,true,false)); + _song.notes.push(newSection(16,true,false,false)); renderer.section = _song.notes[awfgaw]; sectionRenderes.add(renderer); @@ -383,8 +389,26 @@ class ChartingState extends MusicBeatState trace("bruh"); + add(sectionRenderes); + + // fuckin stupid ass bitch ass fucking waveform + /*if (PlayState.isSM) + { + waveform = new Waveform(0,0,PlayState.pathToSm + "/" + PlayState.sm.header.MUSIC,height); + } + else + { + if (_song.needsVoices) + waveform = new Waveform(0,0,Paths.voices(_song.song),height); + else + waveform = new Waveform(0,0,Paths.inst(_song.song),height); + } + + waveform.drawWaveform(); + add(waveform); + */ add(dummyArrow); add(strumLine); add(lines); @@ -392,6 +416,9 @@ class ChartingState extends MusicBeatState add(gridBlackLine); add(curRenderedNotes); add(curRenderedSustains); + selectedBoxes = new FlxTypedGroup(); + + add(selectedBoxes); trace("bruh"); @@ -916,14 +943,14 @@ class ChartingState extends MusicBeatState tab_events.add(listLabel); tab_events.add(typeLabel); tab_events.add(eventName); - tab_events.add(eventType); - tab_events.add(listOfEvents); tab_events.add(eventValue); tab_events.add(eventSave); tab_events.add(eventAdd); tab_events.add(eventRemove); tab_events.add(eventPos); tab_events.add(updatePos); + tab_events.add(eventType); + tab_events.add(listOfEvents); UI_options.addGroup(tab_events); } @@ -1155,7 +1182,8 @@ class ChartingState extends MusicBeatState var check_mustHitSection:FlxUICheckBox; var check_changeBPM:FlxUICheckBox; var stepperSectionBPM:FlxUINumericStepper; - var check_altAnim:FlxUICheckBox; + var check_p1AltAnim:FlxUICheckBox; + var check_p2AltAnim:FlxUICheckBox; function addSectionUI():Void { @@ -1176,21 +1204,37 @@ class ChartingState extends MusicBeatState var swapSection:FlxButton = new FlxButton(10, 170, "Swap Section", function() { - var sect = lastUpdatedSection; + var secit = _song.notes[curSection]; - if (sect == null) - return; + if (secit != null) + { + var newSwaps:Array> = []; + trace(_song.notes[curSection]); + for (i in 0...secit.sectionNotes.length) + { + var note = secit.sectionNotes[i]; + if (note[1] < 4) + note[1] += 4; + else + note[1] -= 4; + newSwaps.push(note); + } - for (i in 0...sect.sectionNotes.length) - { - var note = sect.sectionNotes[i]; - if (note[1] < 4) - note[1] += 4; - else - note[1] -= 4; - sect.sectionNotes[i] = note; - updateGrid(); - } + secit.sectionNotes = newSwaps; + + for (i in shownNotes) + { + for(ii in newSwaps) + if (i.strumTime == ii[0] && i.noteData == ii[1] % 4) + { + i.x = Math.floor(ii[1] * GRID_SIZE); + + i.y = Math.floor(getYfromStrum(ii[0]) * zoomFactor); + if (i.sustainLength > 0 && i.noteCharterObject != null) + i.noteCharterObject.x = i.x + (GRID_SIZE / 2); + } + } + } }); check_mustHitSection = new FlxUICheckBox(10, 30, null, null, "Camera Points to P1?", 100,null,function() { var sect = lastUpdatedSection; @@ -1223,8 +1267,11 @@ class ChartingState extends MusicBeatState check_mustHitSection.checked = true; // _song.needsVoices = check_mustHit.checked; - check_altAnim = new FlxUICheckBox(10, 340, null, null, "Alternate Animation", 100); - check_altAnim.name = 'check_altAnim'; + check_p1AltAnim = new FlxUICheckBox(10, 340, null, null, "P1 Alternate Animation", 100); + check_p1AltAnim.name = 'check_p1AltAnim'; + + check_p2AltAnim = new FlxUICheckBox(200, 340, null, null, "P2 Alternate Animation", 100); + check_p2AltAnim.name = 'check_p2AltAnim'; var refresh = new FlxButton(10, 60, 'Refresh Section', function() { var section = getSectionByTime(Conductor.songPosition); @@ -1233,15 +1280,27 @@ class ChartingState extends MusicBeatState return; check_mustHitSection.checked = section.mustHitSection; - check_altAnim.checked = section.altAnim; + check_p1AltAnim.checked = section.p1AltAnim; + check_p2AltAnim.checked = section.p2AltAnim; + }); + + var startSection:FlxButton = new FlxButton(10, 85, "Play Here", function() { + PlayState.SONG = _song; + FlxG.sound.music.stop(); + if (!PlayState.isSM) + vocals.stop(); + PlayState.startTime = _song.notes[curSection].startTime; + LoadingState.loadAndSwitchState(new PlayState()); }); tab_group_section.add(refresh); - tab_group_section.add(stepperCopy); - tab_group_section.add(stepperCopyLabel); + tab_group_section.add(startSection); + //tab_group_section.add(stepperCopy); + //tab_group_section.add(stepperCopyLabel); tab_group_section.add(check_mustHitSection); - tab_group_section.add(check_altAnim); - tab_group_section.add(copyButton); + tab_group_section.add(check_p1AltAnim); + tab_group_section.add(check_p2AltAnim); + //tab_group_section.add(copyButton); tab_group_section.add(clearSectionButton); tab_group_section.add(swapSection); @@ -1251,7 +1310,29 @@ class ChartingState extends MusicBeatState var stepperSusLength:FlxUINumericStepper; var tab_group_note:FlxUI; + + function goToSection(section:Int) + { + var beat = section * 4; + var data = TimingStruct.getTimingAtBeat(beat); + + if (data == null) + return; + + FlxG.sound.music.time = (data.startTime + ((beat - data.startBeat) / (data.bpm / 60))) * 1000; + if (!PlayState.isSM) + vocals.time = FlxG.sound.music.time; + curSection = section; + trace("Going too " + FlxG.sound.music.time + " | " + section + " | Which is at " + beat); + + if (FlxG.sound.music.time < 0) + FlxG.sound.music.time = 0; + else if (FlxG.sound.music.time > FlxG.sound.music.length) + FlxG.sound.music.time = FlxG.sound.music.length; + } + public var check_naltAnim:FlxUICheckBox; + function addNoteUI():Void { tab_group_note = new FlxUI(null, UI_box); @@ -1264,6 +1345,25 @@ class ChartingState extends MusicBeatState stepperSusLength.value = 0; stepperSusLength.name = 'note_susLength'; + check_naltAnim = new FlxUICheckBox(10, 150, null, null, "Toggle Alternative Animation", 100); + check_naltAnim.callback = function() + { + if (curSelectedNote != null) + { + for(i in selectedBoxes) + { + i.connectedNoteData[3] = check_naltAnim.checked; + + for(ii in _song.notes) + { + for(n in ii.sectionNotes) + if (n[0] == i.connectedNoteData[0] && n[1] == i.connectedNoteData[1]) + n[3] = i.connectedNoteData[3]; + } + } + } + } + var stepperSusLengthLabel = new FlxText(74,10,'Note Sustain Length'); var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data'); @@ -1271,6 +1371,7 @@ class ChartingState extends MusicBeatState tab_group_note.add(stepperSusLength); tab_group_note.add(stepperSusLengthLabel); tab_group_note.add(applyLength); + tab_group_note.add(check_naltAnim); UI_box.addGroup(tab_group_note); @@ -1288,7 +1389,61 @@ class ChartingState extends MusicBeatState } + function pasteNotesFromArray(array:Array>,fromStrum:Bool = true) + { + for(i in array) + { + var strum:Float = i[0]; + if (fromStrum) + strum += Conductor.songPosition; + var section = 0; + for(ii in _song.notes) + { + if (ii.startTime <= strum && ii.endTime > strum) + { + trace("new strum " + strum + " - at section " + section); + // alright we're in this section lets paste the note here. + var newData = [strum,i[1],i[2]]; + ii.sectionNotes.push(newData); + var thing = ii.sectionNotes[ii.sectionNotes.length - 1]; + + var note:Note = new Note(strum, Math.floor(i[1] % 4),null,false,true); + note.rawNoteData = i[1]; + note.sustainLength = i[2]; + note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE)); + note.updateHitbox(); + note.x = Math.floor(i[1] * GRID_SIZE); + + note.charterSelected = true; + + + note.y = Math.floor(getYfromStrum(strum) * zoomFactor); + + var box = new ChartingBox(note.x,note.y,note); + box.connectedNoteData = thing; + selectedBoxes.add(box); + + curRenderedNotes.add(note); + + pastedNotes.push(note); + + if (note.sustainLength > 0) + { + var sustainVis:FlxSprite = new FlxSprite(note.x + (GRID_SIZE / 2), + note.y + GRID_SIZE).makeGraphic(8, Math.floor((getYfromStrum(note.strumTime + note.sustainLength) * zoomFactor) - note.y)); + + note.noteCharterObject = sustainVis; + + curRenderedSustains.add(sustainVis); + } + trace("section new length: " + ii.sectionNotes.length); + continue; + } + section++; + } + } + } function loadSong(daSong:String):Void { if (FlxG.sound.music != null) @@ -1361,8 +1516,10 @@ class ChartingState extends MusicBeatState var label = check.getLabel().text; switch (label) { - case "Alternate Animation": - getSectionByTime(Conductor.songPosition).altAnim = check.checked; + case "P1 Alternate Animation": + getSectionByTime(Conductor.songPosition).p1AltAnim = check.checked; + case "P2 Alternate Animation": + getSectionByTime(Conductor.songPosition).p2AltAnim = check.checked; } } else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper)) @@ -1387,10 +1544,12 @@ class ChartingState extends MusicBeatState case 'song_bpm': if (nums.value <= 0) nums.value = 1; - tempBpm = Std.int(nums.value); - Conductor.mapBPMChanges(_song); - Conductor.changeBPM(Std.int(nums.value)); + _song.bpm = nums.value; + if (_song.eventObjects[0].type != "BPM Change") + Application.current.window.alert("i'm crying, first event isn't a bpm change. fuck you"); + else + _song.eventObjects[0].value = nums.value; case 'note_susLength': if (curSelectedNote == null) return; @@ -1472,21 +1631,27 @@ class ChartingState extends MusicBeatState public function resizeEverything() { - curRenderedNotes.forEach(function(note) { - var seg = TimingStruct.getTimingAtTimestamp(note.strumTime); - note.y = getYfromStrum(note.strumTime) * zoomFactor; - var stepCrochet = (((60 / seg.bpm) * 1000) / 4); - if (note.sustainLength >= 2) - { - note.noteCharterObject.y = note.y + GRID_SIZE; - note.noteCharterObject.makeGraphic(8,Math.floor((getYfromStrum(note.strumTime + note.sustainLength) * zoomFactor) - note.y),FlxColor.WHITE); - } - }); regenerateLines(); } - + public var shownNotes:Array = []; + + public var snapSelection = 3; + + public var selectedBoxes:FlxTypedGroup; + + public var waitingForRelease:Bool = false; + public var selectBox:FlxSprite; + + public var copiedNotes:Array> = []; + public var pastedNotes:Array = []; + public var deletedNotes:Array> = []; + + public var selectInitialX:Float = 0; + public var selectInitialY:Float = 0; + + public var lastAction:String = ""; override function update(elapsed:Float) { @@ -1507,21 +1672,40 @@ class ChartingState extends MusicBeatState } } - for(i in curRenderedNotes) + shownNotes = []; + + for(note in curRenderedNotes) { - var diff = i.y - strumLine.y; - if (diff < 4000 && diff >= -4000) + var diff = note.strumTime - Conductor.songPosition; + if (diff < 8000 && diff >= -8000) { - i.active = true; - i.visible = true; + shownNotes.push(note); + note.y = getYfromStrum(note.strumTime) * zoomFactor; + if (note.sustainLength > 0) + { + if (note.noteCharterObject != null) + if (note.noteCharterObject.y != note.y + GRID_SIZE) + { + note.noteCharterObject.y = note.y + GRID_SIZE; + note.noteCharterObject.makeGraphic(8,Math.floor((getYfromStrum(note.strumTime + note.sustainLength) * zoomFactor) - note.y),FlxColor.WHITE); + } + } + note.active = true; + note.visible = true; } else { - i.active = false; - i.visible = false; + note.active = false; + note.visible = false; } } + for(ii in selectedBoxes.members) + { + ii.x = ii.connectedNote.x; + ii.y = ii.connectedNote.y; + } + var doInput = true; for (i in Typeables) @@ -1541,7 +1725,7 @@ class ChartingState extends MusicBeatState claps.splice(0, claps.length); - if (FlxG.keys.pressed.CONTROL) + if (FlxG.keys.pressed.CONTROL && !waitingForRelease) { var amount = FlxG.mouse.wheel; @@ -1600,14 +1784,179 @@ class ChartingState extends MusicBeatState if (data != null) { - + FlxG.sound.music.time = (data.startTime + ((beats - data.startBeat) / (bpm/60)) ) * 1000; } } + else + FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4); + + if (FlxG.sound.music.time > FlxG.sound.music.length) + FlxG.sound.music.time = FlxG.sound.music.length; + if (!PlayState.isSM) vocals.time = FlxG.sound.music.time; } } + + if (FlxG.keys.justPressed.RIGHT && !FlxG.keys.pressed.CONTROL) + goToSection(curSection + 1); + else if (FlxG.keys.justPressed.LEFT && !FlxG.keys.pressed.CONTROL) + goToSection(curSection - 1); + + if (FlxG.mouse.pressed && FlxG.keys.pressed.CONTROL) + { + if (!waitingForRelease) + { + trace("creating select box"); + waitingForRelease = true; + selectBox = new FlxSprite(FlxG.mouse.x,FlxG.mouse.y); + selectBox.makeGraphic(0,0,FlxColor.fromRGB(173, 216, 230)); + selectBox.alpha = 0.4; + + selectInitialX = selectBox.x; + selectInitialY = selectBox.y; + + add(selectBox); + } + else + { + if (waitingForRelease) + { + trace(selectBox.width + " | " + selectBox.height); + selectBox.x = Math.min(FlxG.mouse.x,selectInitialX); + selectBox.y = Math.min(FlxG.mouse.y,selectInitialY); + + selectBox.makeGraphic(Math.floor(Math.abs(FlxG.mouse.x - selectInitialX)),Math.floor(Math.abs(FlxG.mouse.y - selectInitialY)),FlxColor.fromRGB(173, 216, 230)); + } + } + } + if (FlxG.mouse.justReleased && waitingForRelease) + { + trace("released!"); + waitingForRelease = false; + + while(selectedBoxes.members.length != 0 && selectBox.width > 10 && selectBox.height > 10) + { + selectedBoxes.members[0].connectedNote.charterSelected = false; + selectedBoxes.members[0].destroy(); + selectedBoxes.members.remove(selectedBoxes.members[0]); + } + + for(i in curRenderedNotes) + { + if (i.overlaps(selectBox) && !i.charterSelected) + { + trace("seleting " + i.strumTime); + selectNote(i, false); + } + } + selectBox.destroy(); + remove(selectBox); + } + + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.D) + { + lastAction = "delete"; + var notesToBeDeleted = []; + deletedNotes = []; + for(i in 0...selectedBoxes.members.length) + { + deletedNotes.push([selectedBoxes.members[i].connectedNote.strumTime,selectedBoxes.members[i].connectedNote.rawNoteData,selectedBoxes.members[i].connectedNote.sustainLength]); + notesToBeDeleted.push(selectedBoxes.members[i].connectedNote); + } + + for(i in notesToBeDeleted) + { + deleteNote(i); + } + } + + if (FlxG.keys.justPressed.DELETE) + { + lastAction = "delete"; + var notesToBeDeleted = []; + deletedNotes = []; + for(i in 0...selectedBoxes.members.length) + { + deletedNotes.push([selectedBoxes.members[i].connectedNote.strumTime,selectedBoxes.members[i].connectedNote.rawNoteData,selectedBoxes.members[i].connectedNote.sustainLength]); + notesToBeDeleted.push(selectedBoxes.members[i].connectedNote); + } + + for(i in notesToBeDeleted) + { + deleteNote(i); + } + } + + + + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.C) + { + if (selectedBoxes.members.length != 0) + { + copiedNotes = []; + for(i in selectedBoxes.members) + copiedNotes.push([i.connectedNote.strumTime,i.connectedNote.rawNoteData,i.connectedNote.sustainLength,i.connectedNote.isAlt]); + + var firstNote = copiedNotes[0][0]; + + for(i in copiedNotes) // normalize the notes + { + i[0] = i[0] - firstNote; + trace("Normalized time: " + i[0] + " | " + i[1]); + } + + trace(copiedNotes.length); + } + } + + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.V) + { + if (copiedNotes.length != 0) + { + while(selectedBoxes.members.length != 0) + { + selectedBoxes.members[0].connectedNote.charterSelected = false; + selectedBoxes.members[0].destroy(); + selectedBoxes.members.remove(selectedBoxes.members[0]); + } + + trace("Pasting " + copiedNotes.length); + + pasteNotesFromArray(copiedNotes); + + lastAction = "paste"; + + } + } + + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.Z) + { + switch(lastAction) + { + case "paste": + trace("undo paste"); + if (pastedNotes.length != 0) + { + for(i in pastedNotes) + { + if (curRenderedNotes.members.contains(i)) + deleteNote(i); + } + + pastedNotes = []; + } + case "delete": + trace("undoing delete"); + if (deletedNotes.length != 0) + { + trace("undoing delete"); + pasteNotesFromArray(deletedNotes,false); + deletedNotes = []; + } + } + } } if (updateFrame == 4) @@ -1647,21 +1996,51 @@ class ChartingState extends MusicBeatState else if (updateFrame != 5) updateFrame++; - snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable, Left or Right to increase/decrease" : "Snap Disabled, Shift to renable.") + ")\nAdd Notes: 1-8 (or click)\nZoom: " + zoomFactor; + snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable, CTRL Left or Right to increase/decrease" : "Snap Disabled, Shift to renable.") + ")\nAdd Notes: 1-8 (or click)\nZoom: " + zoomFactor; - if (FlxG.keys.justPressed.RIGHT) - snap = snap * 2; - if (FlxG.keys.justPressed.LEFT) - snap = Math.round(snap / 2); - if (snap >= 64) - snap = 64; - if (snap <= 4) - snap = 4; - /* + if (FlxG.keys.justPressed.RIGHT && FlxG.keys.pressed.CONTROL) + { + snapSelection++; + var index = 6; + if (snapSelection > 6) + snapSelection = 6; + if (snapSelection < 0) + snapSelection = 0; + for (v in deezNuts.keys()){ + trace(v); + if (index == snapSelection) + { + trace("found " + v + " at " + index); + snap = v; + } + index--; + } + trace("new snap " + snap + " | " + snapSelection); + } + if (FlxG.keys.justPressed.LEFT && FlxG.keys.pressed.CONTROL) + { + snapSelection--; + if (snapSelection > 6) + snapSelection = 6; + if (snapSelection < 0) + snapSelection = 0; + var index = 6; + for (v in deezNuts.keys()){ + trace(v); + if (index == snapSelection) + { + trace("found " + v + " at " + index); + snap = v; + } + index--; + } + trace("new snap " + snap + " | " + snapSelection); + } + if (FlxG.keys.justPressed.SHIFT) doSnapShit = !doSnapShit; - */ + doSnapShit = defaultSnap; if (FlxG.keys.pressed.SHIFT) @@ -1707,7 +2086,8 @@ class ChartingState extends MusicBeatState { lastUpdatedSection = weird; check_mustHitSection.checked = weird.mustHitSection; - check_altAnim.checked = weird.altAnim; + check_p1AltAnim.checked = weird.p1AltAnim; + check_p2AltAnim.checked = weird.p2AltAnim; } } @@ -1728,7 +2108,7 @@ class ChartingState extends MusicBeatState + "\nCurStep: " + curStep + "\nZoom: " - + zoomFactor; + + HelperFunctions.truncateFloat(zoomFactor,2); var left = FlxG.keys.justPressed.ONE; @@ -1761,24 +2141,20 @@ class ChartingState extends MusicBeatState addNote(new Note(Conductor.songPosition,p)); } } + + } if (playClaps) { - curRenderedNotes.forEach(function(note:Note) + for(note in shownNotes) { - if (FlxG.sound.music.playing) + if (note.strumTime <= Conductor.songPosition && !claps.contains(note) && FlxG.sound.music.playing) { - if (strumLine.overlaps(note)) - { - if(!claps.contains(note)) - { - claps.push(note); - FlxG.sound.play(Paths.sound('SNAP')); - } - } + claps.push(note); + FlxG.sound.play(Paths.sound('SNAP')); } - }); + } } /*curRenderedNotes.forEach(function(note:Note) { if (strumLine.overlaps(note) && strumLine.y == note.y) // yandere dev type shit @@ -1854,7 +2230,7 @@ class ChartingState extends MusicBeatState FlxG.watch.addQuick('daBeat', curDecimalBeat); - if (FlxG.mouse.justPressed) + if (FlxG.mouse.justPressed && !waitingForRelease) { if (FlxG.mouse.overlaps(curRenderedNotes)) { @@ -1864,7 +2240,7 @@ class ChartingState extends MusicBeatState { if (FlxG.keys.pressed.CONTROL) { - selectNote(note); + selectNote(note, false); } else { @@ -1924,6 +2300,61 @@ class ChartingState extends MusicBeatState changeNoteSustain(-(((60 / (timingSeg != null ? timingSeg.bpm : _song.bpm)) * 1000) / 4)); } + if (FlxG.keys.justPressed.C && !FlxG.keys.pressed.CONTROL) + { + var sect = _song.notes[curSection]; + sect.mustHitSection = !sect.mustHitSection; + var i = sectionRenderes.members[curSection]; + var cachedY = i.icon.y; + remove(i.icon); + var sectionicon = sect.mustHitSection ? new HealthIcon(_song.player1).clone() : new HealthIcon(_song.player2).clone(); + sectionicon.x = -95; + sectionicon.y = cachedY; + sectionicon.setGraphicSize(0, 45); + + i.icon = sectionicon; + i.lastUpdated = sect.mustHitSection; + + add(sectionicon); + trace("must hit " + sect.mustHitSection); + + } + if (FlxG.keys.justPressed.V && !FlxG.keys.pressed.CONTROL) + { + trace("swap"); + var secit = _song.notes[curSection]; + + if (secit != null) + { + var newSwaps:Array> = []; + trace(_song.notes[curSection]); + for (i in 0...secit.sectionNotes.length) + { + var note = secit.sectionNotes[i]; + if (note[1] < 4) + note[1] += 4; + else + note[1] -= 4; + newSwaps.push(note); + } + + secit.sectionNotes = newSwaps; + + for (i in shownNotes) + { + for(ii in newSwaps) + if (i.strumTime == ii[0] && i.noteData == ii[1] % 4) + { + i.x = Math.floor(ii[1] * GRID_SIZE); + + i.y = Math.floor(getYfromStrum(ii[0]) * zoomFactor); + if (i.sustainLength > 0 && i.noteCharterObject != null) + i.noteCharterObject.x = i.x + (GRID_SIZE / 2); + } + } + } + } + if (FlxG.keys.justPressed.TAB) { if (FlxG.keys.pressed.SHIFT) @@ -1943,17 +2374,6 @@ class ChartingState extends MusicBeatState if (!typingShit.hasFocus) { - if (FlxG.keys.pressed.CONTROL) - { - if (FlxG.keys.justPressed.Z && lastNote != null) - { - trace(curRenderedNotes.members.contains(lastNote) ? "delete note" : "add note"); - if (curRenderedNotes.members.contains(lastNote)) - deleteNote(lastNote); - else - addNote(lastNote); - } - } var shiftThing:Int = 1; if (FlxG.keys.pressed.SHIFT) @@ -2041,11 +2461,23 @@ class ChartingState extends MusicBeatState { curSelectedNote[2] += value; curSelectedNote[2] = Math.max(curSelectedNote[2], 0); + + if (curSelectedNoteObject.noteCharterObject != null) + curRenderedSustains.remove(curSelectedNoteObject.noteCharterObject); + + var sustainVis:FlxSprite = new FlxSprite(curSelectedNoteObject.x + (GRID_SIZE / 2), + curSelectedNoteObject.y + GRID_SIZE).makeGraphic(8, Math.floor((getYfromStrum(curSelectedNoteObject.strumTime + curSelectedNote[2]) * zoomFactor) - curSelectedNoteObject.y)); + curSelectedNoteObject.sustainLength = curSelectedNote[2]; + trace("new sustain " + curSelectedNoteObject.sustainLength); + curSelectedNoteObject.noteCharterObject = sustainVis; + + curRenderedSustains.add(sustainVis); } } updateNoteUI(); - updateGrid(); + + } function resetSection(songBeginning:Bool = false):Void @@ -2115,7 +2547,7 @@ class ChartingState extends MusicBeatState { var strum = note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum); - var copiedNote:Array = [strum, note[1], note[2]]; + var copiedNote:Array = [strum, note[1], note[2],note[3]]; sect.sectionNotes.push(copiedNote); } @@ -2129,13 +2561,14 @@ class ChartingState extends MusicBeatState if (sec == null) { check_mustHitSection.checked = true; - check_altAnim.checked = false; + check_p1AltAnim.checked = false; + check_p2AltAnim.checked = false; } else { check_mustHitSection.checked = sec.mustHitSection; - check_altAnim.checked = sec.altAnim; - check_changeBPM.checked = sec.changeBPM; + check_p1AltAnim.checked = sec.p1AltAnim; + check_p2AltAnim.checked = sec.p2AltAnim; } } @@ -2156,7 +2589,16 @@ class ChartingState extends MusicBeatState function updateNoteUI():Void { if (curSelectedNote != null) + { stepperSusLength.value = curSelectedNote[2]; + if (curSelectedNote[3] != null) + check_naltAnim.checked = curSelectedNote[3]; + else + { + curSelectedNote[3] = false; + check_naltAnim.checked = false; + } + } } function updateGrid():Void @@ -2196,7 +2638,7 @@ class ChartingState extends MusicBeatState var daStrumTime = i[0]; var daSus = i[2]; - var note:Note = new Note(daStrumTime, daNoteInfo % 4,null,false,true); + var note:Note = new Note(daStrumTime, daNoteInfo % 4,null,false,true,i[3]); note.rawNoteData = daNoteInfo; note.sustainLength = daSus; note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE)); @@ -2254,27 +2696,54 @@ class ChartingState extends MusicBeatState mustHitSection: true, sectionNotes: [], typeOfSection: 0, - altAnim: false + altAnim: false, + p1AltAnim: false, + p2AltAnim: false }; _song.notes.push(sec); } - function selectNote(note:Note):Void + function selectNote(note:Note, ?deleteAllBoxes:Bool = true):Void { var swagNum:Int = 0; - for (i in getSectionByTime(note.strumTime).sectionNotes) - { - if (i[0] == note.strumTime && i[1] == note.rawNoteData) + + if (deleteAllBoxes) + while(selectedBoxes.members.length != 0) { - curSelectedNote = getSectionByTime(note.strumTime).sectionNotes[swagNum]; + selectedBoxes.members[0].connectedNote.charterSelected = false; + selectedBoxes.members[0].destroy(); + selectedBoxes.members.remove(selectedBoxes.members[0]); } - swagNum += 1; + for(sec in _song.notes) + { + swagNum = 0; + for(i in sec.sectionNotes) + { + if (i[0] == note.strumTime && i[1] == note.rawNoteData) + { + curSelectedNote = sec.sectionNotes[swagNum]; + if (curSelectedNoteObject != null) + curSelectedNoteObject.charterSelected = false; + + curSelectedNoteObject = note; + if (!note.charterSelected) + { + var box = new ChartingBox(note.x,note.y,note); + box.connectedNoteData = i; + selectedBoxes.add(box); + note.charterSelected = true; + curSelectedNoteObject.charterSelected = true; + } + + + } + swagNum += 1; + } } - updateGrid(); updateNoteUI(); } @@ -2285,8 +2754,6 @@ class ChartingState extends MusicBeatState var section = getSectionByTime(note.strumTime); - trace(section); - var found = false; for (i in section.sectionNotes) @@ -2307,10 +2774,22 @@ class ChartingState extends MusicBeatState i.sectionNotes.remove(n); } } - - trace("DELETED!"); - updateGrid(); + curRenderedNotes.remove(note); + + if (note.sustainLength > 0) + curRenderedSustains.remove(note.noteCharterObject); + + for(i in 0...selectedBoxes.members.length) + { + var box = selectedBoxes.members[i]; + if (box.connectedNote == note) + { + selectedBoxes.members.remove(box); + box.destroy(); + return; + } + } } function clearSection():Void @@ -2330,7 +2809,7 @@ class ChartingState extends MusicBeatState updateGrid(); } - private function newSection(lengthInSteps:Int = 16,mustHitSection:Bool = false,altAnim:Bool = true):SwagSection + private function newSection(lengthInSteps:Int = 16,mustHitSection:Bool = false,p1AltAnim:Bool = true, p2AltAnim:Bool = true):SwagSection { var daPos:Float = 0; @@ -2358,7 +2837,9 @@ class ChartingState extends MusicBeatState mustHitSection: mustHitSection, sectionNotes: [], typeOfSection: 0, - altAnim: altAnim + altAnim: false, + p1AltAnim: p1AltAnim, + p2AltAnim: p2AltAnim }; @@ -2432,7 +2913,7 @@ class ChartingState extends MusicBeatState } for (daSection1 in 0..._song.notes.length) { - newSong.push(newSection(16,_song.notes[daSection1].mustHitSection,_song.notes[daSection1].altAnim)); + newSong.push(newSection(16,_song.notes[daSection1].mustHitSection,_song.notes[daSection1].p1AltAnim,_song.notes[daSection1].p2AltAnim)); } for (daSection in 0...(_song.notes.length)) @@ -2440,7 +2921,8 @@ class ChartingState extends MusicBeatState var aimtosetsection = daSection+Std.int((totaladdsection)); if(aimtosetsection<0) aimtosetsection = 0; newSong[aimtosetsection].mustHitSection = _song.notes[daSection].mustHitSection; - newSong[aimtosetsection].altAnim = _song.notes[daSection].altAnim; + newSong[aimtosetsection].p1AltAnim = _song.notes[daSection].p1AltAnim; + newSong[aimtosetsection].p2AltAnim = _song.notes[daSection].p2AltAnim; //trace("section "+daSection); for(daNote in 0...(_song.notes[daSection].sectionNotes.length)) { @@ -2497,6 +2979,7 @@ class ChartingState extends MusicBeatState return null; } + public var curSelectedNoteObject:Note = null; private function addNote(?n:Note):Void { @@ -2516,15 +2999,77 @@ class ChartingState extends MusicBeatState var noteSus = 0; if (n != null) - section.sectionNotes.push([n.strumTime, n.noteData, n.sustainLength]); + section.sectionNotes.push([n.strumTime, n.noteData, n.sustainLength, false]); else - section.sectionNotes.push([noteStrum, noteData, noteSus]); + section.sectionNotes.push([noteStrum, noteData, noteSus, false]); var thingy = section.sectionNotes[section.sectionNotes.length - 1]; curSelectedNote = thingy; - updateGrid(); + var seg = TimingStruct.getTimingAtTimestamp(noteStrum); + + if (n == null) + { + var note:Note = new Note(noteStrum, noteData % 4,null,false,true); + note.rawNoteData = noteData; + note.sustainLength = noteSus; + note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE)); + note.updateHitbox(); + note.x = Math.floor(noteData * GRID_SIZE); + + if (curSelectedNoteObject != null) + curSelectedNoteObject.charterSelected = false; + curSelectedNoteObject = note; + + while(selectedBoxes.members.length != 0) + { + selectedBoxes.members[0].connectedNote.charterSelected = false; + selectedBoxes.members[0].destroy(); + selectedBoxes.members.remove(selectedBoxes.members[0]); + } + + curSelectedNoteObject.charterSelected = true; + + note.y = Math.floor(getYfromStrum(noteStrum) * zoomFactor); + + var box = new ChartingBox(note.x,note.y,note); + box.connectedNoteData = thingy; + selectedBoxes.add(box); + + curRenderedNotes.add(note); + } + else + { + var note:Note = new Note(n.strumTime, n.noteData % 4,null,false,true, n.isAlt); + note.rawNoteData = n.noteData; + note.sustainLength = noteSus; + note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE)); + note.updateHitbox(); + note.x = Math.floor(n.noteData * GRID_SIZE); + + if (curSelectedNoteObject != null) + curSelectedNoteObject.charterSelected = false; + curSelectedNoteObject = note; + + while(selectedBoxes.members.length != 0) + { + selectedBoxes.members[0].connectedNote.charterSelected = false; + selectedBoxes.members[0].destroy(); + selectedBoxes.members.remove(selectedBoxes.members[0]); + } + + var box = new ChartingBox(note.x,note.y,note); + box.connectedNoteData = thingy; + selectedBoxes.add(box); + + curSelectedNoteObject.charterSelected = true; + + note.y = Math.floor(getYfromStrum(n.strumTime) * zoomFactor); + + curRenderedNotes.add(note); + } + updateNoteUI(); autosaveSong(); @@ -2584,12 +3129,13 @@ class ChartingState extends MusicBeatState function loadJson(song:String):Void { + var difficultyArray:Array = ["-easy", "", "-hard"]; var format = StringTools.replace(PlayState.SONG.song.toLowerCase(), " ", "-"); switch (format) { case 'Dad-Battle': format = 'Dadbattle'; case 'Philly-Nice': format = 'Philly'; } - PlayState.SONG = Song.loadFromJson(format, format); + PlayState.SONG = Song.loadFromJson(format + difficultyArray[PlayState.storyDifficulty], format); LoadingState.loadAndSwitchState(new ChartingState()); } @@ -2609,6 +3155,7 @@ class ChartingState extends MusicBeatState private function saveLevel() { + var difficultyArray:Array = ["-easy", "", "-hard"]; var json = { "song": _song }; @@ -2621,7 +3168,7 @@ class ChartingState extends MusicBeatState _file.addEventListener(Event.COMPLETE, onSaveComplete); _file.addEventListener(Event.CANCEL, onSaveCancel); _file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError); - _file.save(data.trim(), _song.song.toLowerCase() + ".json"); + _file.save(data.trim(), _song.song.toLowerCase() + difficultyArray[PlayState.storyDifficulty] + ".json"); } } diff --git a/source/DiffOverview.hx b/source/DiffOverview.hx index 4f27fcc..2a11393 100644 --- a/source/DiffOverview.hx +++ b/source/DiffOverview.hx @@ -89,10 +89,7 @@ class DiffOverview extends FlxSubState babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); - if(FlxG.save.data.antialiasing) - { - babyArrow.antialiasing = true; - } + babyArrow.antialiasing = FlxG.save.data.antialiasing; babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); switch (Math.abs(i)) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 96d0c30..d4372e0 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -67,6 +67,7 @@ class FreeplayState extends MusicBeatState override function create() { + clean(); var initSonglist = CoolUtil.coolTextFile(Paths.txt('data/freeplaySonglist')); //var diffList = ""; @@ -179,10 +180,7 @@ class FreeplayState extends MusicBeatState // LOAD CHARACTERS var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuBGBlue')); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; add(bg); grpSongs = new FlxTypedGroup(); @@ -382,7 +380,8 @@ class FreeplayState extends MusicBeatState } - PlayState.SONG = hmm; + + PlayState.SONG = Song.conversionChecks(hmm); PlayState.isStoryMode = false; PlayState.storyDifficulty = curDifficulty; PlayState.storyWeek = songs[curSelected].week; @@ -400,6 +399,7 @@ class FreeplayState extends MusicBeatState PlayState.isSM = false; #end LoadingState.loadAndSwitchState(new PlayState()); + clean(); } } @@ -479,6 +479,7 @@ class FreeplayState extends MusicBeatState #end diffCalcText.text = 'RATING: ${DiffCalc.CalculateDiff(songData.get(songs[curSelected].songName)[curDifficulty])}'; + diffText.text = CoolUtil.difficultyFromInt(curDifficulty).toUpperCase(); #if PRELOAD_ALL if (songs[curSelected].songCharacter == "sm") diff --git a/source/GameOverState.hx b/source/GameOverState.hx index 250095e..373fc5c 100644 --- a/source/GameOverState.hx +++ b/source/GameOverState.hx @@ -23,12 +23,13 @@ class GameOverState extends FlxTransitionableState override function create() { - var loser:FlxSprite = new FlxSprite(100, 100); - var loseTex = Paths.getSparrowAtlas('lose'); - loser.frames = loseTex; - loser.animation.addByPrefix('lose', 'lose', 24, false); - loser.animation.play('lose'); - add(loser); + var loser:FlxSprite = new FlxSprite(100, 100); + var loseTex = Paths.getSparrowAtlas('lose'); + loser.frames = loseTex; + loser.animation.addByPrefix('lose', 'lose', 24, false); + loser.animation.play('lose'); + loser.antialiasing = FlxG.save.data.antialiasing; + add(loser); var bf:Boyfriend = new Boyfriend(bfX, bfY); // bf.scrollFactor.set(); @@ -37,15 +38,12 @@ class GameOverState extends FlxTransitionableState FlxG.camera.follow(bf, LOCKON, 0.001); - var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(Paths.image('restart')); - restart.setGraphicSize(Std.int(restart.width * 0.6)); - restart.updateHitbox(); - restart.alpha = 0; - if(FlxG.save.data.antialiasing) - { - restart.antialiasing = true; - } - add(restart); + var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(Paths.image('restart')); + restart.setGraphicSize(Std.int(restart.width * 0.6)); + restart.updateHitbox(); + restart.alpha = 0; + restart.antialiasing = FlxG.save.data.antialiasing; + add(restart); FlxG.sound.music.fadeOut(2, FlxG.sound.music.volume * 0.6); @@ -63,6 +61,16 @@ class GameOverState extends FlxTransitionableState var gamepad:FlxGamepad = FlxG.gamepads.lastActive; + if(FlxG.save.data.InstantRespawn) + { + fading = true; + FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween) + { + FlxG.sound.music.stop(); + LoadingState.loadAndSwitchState(new PlayState()); + }); + } + if (gamepad != null) { if (gamepad.justPressed.ANY) diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index 5cef652..182ce8c 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -59,6 +59,11 @@ class GameOverSubstate extends MusicBeatSubstate endBullshit(); } + if(FlxG.save.data.InstantRespawn) + { + LoadingState.loadAndSwitchState(new PlayState()); + } + if (controls.BACK) { FlxG.sound.music.stop(); diff --git a/source/GameplayCustomizeState.hx b/source/GameplayCustomizeState.hx index 26e29e6..15ffa63 100644 --- a/source/GameplayCustomizeState.hx +++ b/source/GameplayCustomizeState.hx @@ -47,10 +47,14 @@ class GameplayCustomizeState extends MusicBeatState #end sick = new FlxSprite().loadGraphic(Paths.image('sick','shared')); + sick.antialiasing = FlxG.save.data.antialiasing; sick.scrollFactor.set(); - background = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback','shared')); + background = new FlxSprite(-1000, -200).loadGraphic(Paths.image('stageback','shared')); curt = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains','shared')); front = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront','shared')); + background.antialiasing = FlxG.save.data.antialiasing; + curt.antialiasing = FlxG.save.data.antialiasing; + front.antialiasing = FlxG.save.data.antialiasing; //Conductor.changeBPM(102); persistentUpdate = true; @@ -61,6 +65,8 @@ class GameplayCustomizeState extends MusicBeatState camHUD.bgColor.alpha = 0; FlxG.cameras.add(camHUD); + camHUD.zoom = FlxG.save.data.zoom; + background.scrollFactor.set(0.9,0.9); curt.scrollFactor.set(0.9,0.9); front.scrollFactor.set(0.9,0.9); @@ -116,13 +122,19 @@ class GameplayCustomizeState extends MusicBeatState generateStaticArrows(0); generateStaticArrows(1); - text = new FlxText(5, FlxG.height + 40, 0, "Click and drag around gameplay elements to customize their positions.\nPress R to reset.\nPress Escape to go back.", 12); + text = new FlxText(5, FlxG.height + 40, 0, "Click and drag around gameplay elements to customize their positions. Press R to reset. Q/E to change zoom. Press Escape to go back.", 12); text.scrollFactor.set(); text.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); blackBorder = new FlxSprite(-30,FlxG.height + 40).makeGraphic((Std.int(text.width + 900)),Std.int(text.height + 600),FlxColor.BLACK); blackBorder.alpha = 0.5; + background.cameras = [camHUD]; + text.cameras = [camHUD]; + + text.scrollFactor.set(); + background.scrollFactor.set(); + add(blackBorder); add(text); @@ -150,13 +162,19 @@ class GameplayCustomizeState extends MusicBeatState super.update(elapsed); + if (FlxG.save.data.zoom < 0.8) + FlxG.save.data.zoom = 0.8; + + if (FlxG.save.data.zoom > 1.2) + FlxG.save.data.zoom = 1.2; + FlxG.camera.zoom = FlxMath.lerp(0.9, FlxG.camera.zoom, 0.95); - camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95); + camHUD.zoom = FlxMath.lerp(FlxG.save.data.zoom, camHUD.zoom, 0.95); if (FlxG.mouse.overlaps(sick) && FlxG.mouse.pressed) { - sick.x = FlxG.mouse.x - sick.width / 2; - sick.y = FlxG.mouse.y - sick.height; + sick.x = (FlxG.mouse.x - sick.width / 2) - 60; + sick.y = (FlxG.mouse.y - sick.height) - 60; } for (i in playerStrums) @@ -164,6 +182,19 @@ class GameplayCustomizeState extends MusicBeatState for (i in strumLineNotes) i.y = strumLine.y; + if (FlxG.keys.justPressed.Q) + { + FlxG.save.data.zoom += 0.02; + camHUD.zoom = FlxG.save.data.zoom; + } + + if (FlxG.keys.justPressed.E) + { + FlxG.save.data.zoom -= 0.02; + camHUD.zoom = FlxG.save.data.zoom; + } + + if (FlxG.mouse.overlaps(sick) && FlxG.mouse.justReleased) { FlxG.save.data.changedHitX = sick.x; @@ -175,6 +206,8 @@ class GameplayCustomizeState extends MusicBeatState { sick.x = defaultX; sick.y = defaultY; + FlxG.save.data.zoom = 1; + camHUD.zoom = FlxG.save.data.zoom; FlxG.save.data.changedHitX = sick.x; FlxG.save.data.changedHitY = sick.y; FlxG.save.data.changedHit = false; @@ -218,7 +251,7 @@ class GameplayCustomizeState extends MusicBeatState babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); - babyArrow.antialiasing = true; + babyArrow.antialiasing = FlxG.save.data.antialiasing; babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); switch (Math.abs(i)) { diff --git a/source/GitarooPause.hx b/source/GitarooPause.hx index a8c5f99..1e35766 100644 --- a/source/GitarooPause.hx +++ b/source/GitarooPause.hx @@ -22,20 +22,14 @@ class GitarooPause extends MusicBeatState FlxG.sound.music.stop(); var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('pauseAlt/pauseBG')); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; add(bg); var bf:FlxSprite = new FlxSprite(0, 30); bf.frames = Paths.getSparrowAtlas('pauseAlt/bfLol'); bf.animation.addByPrefix('lol', "funnyThing", 13); bf.animation.play('lol'); - if(FlxG.save.data.antialiasing) - { - bf.antialiasing = true; - } + bf.antialiasing = FlxG.save.data.antialiasing; add(bf); bf.screenCenter(X); @@ -44,10 +38,7 @@ class GitarooPause extends MusicBeatState replayButton.animation.addByPrefix('selected', 'bluereplay', 0, false); replayButton.animation.appendByPrefix('selected', 'yellowreplay'); replayButton.animation.play('selected'); - if(FlxG.save.data.antialiasing) - { - replayButton.antialiasing = true; - } + replayButton.antialiasing = FlxG.save.data.antialiasing; add(replayButton); cancelButton = new FlxSprite(FlxG.width * 0.58, replayButton.y); @@ -55,10 +46,7 @@ class GitarooPause extends MusicBeatState cancelButton.animation.addByPrefix('selected', 'bluecancel', 0, false); cancelButton.animation.appendByPrefix('selected', 'cancelyellow'); cancelButton.animation.play('selected'); - if(FlxG.save.data.antialiasing) - { - cancelButton.antialiasing = true; - } + cancelButton.antialiasing = FlxG.save.data.antialiasing; add(cancelButton); changeThing(); diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index 8104468..cd380d2 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -25,16 +25,7 @@ class HealthIcon extends FlxSprite isPlayer = isOldIcon = false; - if (FlxG.save.data.antialiasing) - { - switch(char) - { - case 'bf-pixel' | 'senpai' | 'senpai-angry' | 'spirit' | 'gf-pixel': - antialiasing = false; - default: - antialiasing = true; - } - } + antialiasing = FlxG.save.data.antialiasing; changeIcon(char); scrollFactor.set(); @@ -51,6 +42,10 @@ class HealthIcon extends FlxSprite char = char.split("-")[0]; loadGraphic(Paths.image('icons/icon-' + char), true, 150, 150); + if(char.endsWith('-pixel') || char.startsWith('senpai') || char.startsWith('spirit')) + antialiasing = false + else + antialiasing = FlxG.save.data.antialiasing; animation.add(char, [0, 1], 0, false, isPlayer); animation.play(char); } diff --git a/source/HelperFunctions.hx b/source/HelperFunctions.hx index 4b704c1..e6dc6a9 100644 --- a/source/HelperFunctions.hx +++ b/source/HelperFunctions.hx @@ -1,3 +1,4 @@ +import flixel.FlxG; import flixel.math.FlxMath; class HelperFunctions diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index eb0b876..9556ed3 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -81,6 +81,9 @@ class KadeEngineData if (FlxG.save.data.resetButton == null) FlxG.save.data.resetButton = false; + + if (FlxG.save.data.InstantRespawn == null) + FlxG.save.data.InstantRespawn = false; if (FlxG.save.data.botplay == null) FlxG.save.data.botplay = false; @@ -109,8 +112,11 @@ class KadeEngineData if (FlxG.save.data.cacheImages == null) FlxG.save.data.cacheImages = false; - if (FlxG.save.data.editor == null) - FlxG.save.data.editor = true; + if (FlxG.save.data.editorBG == null) + FlxG.save.data.editor = false; + + if (FlxG.save.data.zoom == null) + FlxG.save.data.zoom = 1; var gamepad:FlxGamepad = FlxG.gamepads.lastActive; diff --git a/source/LoadReplayState.hx b/source/LoadReplayState.hx index 3688a6b..b4df680 100644 --- a/source/LoadReplayState.hx +++ b/source/LoadReplayState.hx @@ -71,10 +71,7 @@ class LoadReplayState extends MusicBeatState menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); menuBG.updateHitbox(); menuBG.screenCenter(); - if(FlxG.save.data.antialiasing) - { - menuBG.antialiasing = true; - } + menuBG.antialiasing = FlxG.save.data.antialiasing; add(menuBG); grpControls = new FlxTypedGroup(); diff --git a/source/LoadingState.hx b/source/LoadingState.hx index 6609fa4..6ef20fa 100644 --- a/source/LoadingState.hx +++ b/source/LoadingState.hx @@ -38,10 +38,7 @@ class LoadingState extends MusicBeatState { logo = new FlxSprite(-150, -100); logo.frames = Paths.getSparrowAtlas('logoBumpin'); - if(FlxG.save.data.antialiasing) - { - logo.antialiasing = true; - } + logo.antialiasing = FlxG.save.data.antialiasing; logo.animation.addByPrefix('bump', 'logo bumpin', 24); logo.animation.play('bump'); logo.updateHitbox(); @@ -52,10 +49,7 @@ class LoadingState extends MusicBeatState gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - if(FlxG.save.data.antialiasing) - { - gfDance.antialiasing = true; - } + gfDance.antialiasing = FlxG.save.data.antialiasing; add(gfDance); add(logo); diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 543421b..a1f39f8 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -40,7 +40,7 @@ class MainMenuState extends MusicBeatState public static var nightly:String = ""; - public static var kadeEngineVer:String = "1.6.1" + nightly; + public static var kadeEngineVer:String = "1.6.2" + nightly; public static var gameVer:String = "0.2.7.1"; var magenta:FlxSprite; @@ -49,6 +49,7 @@ class MainMenuState extends MusicBeatState override function create() { + clean(); #if windows // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); @@ -67,10 +68,7 @@ class MainMenuState extends MusicBeatState bg.setGraphicSize(Std.int(bg.width * 1.1)); bg.updateHitbox(); bg.screenCenter(); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; add(bg); camFollow = new FlxObject(0, 0, 1, 1); @@ -83,10 +81,7 @@ class MainMenuState extends MusicBeatState magenta.updateHitbox(); magenta.screenCenter(); magenta.visible = false; - if(FlxG.save.data.antialiasing) - { - magenta.antialiasing = true; - } + magenta.antialiasing = FlxG.save.data.antialiasing; magenta.color = 0xFFfd719b; add(magenta); // magenta.scrollFactor.set(); @@ -107,10 +102,7 @@ class MainMenuState extends MusicBeatState menuItem.screenCenter(X); menuItems.add(menuItem); menuItem.scrollFactor.set(); - if(FlxG.save.data.antialiasing) - { - menuItem.antialiasing = true; - } + menuItem.antialiasing = FlxG.save.data.antialiasing; if (firstStart) FlxTween.tween(menuItem,{y: 60 + (i * 160)},1 + (i * 0.25) ,{ease: FlxEase.expoInOut, onComplete: function(flxTween:FlxTween) { diff --git a/source/MenuCharacter.hx b/source/MenuCharacter.hx index c35e25a..567b5c6 100644 --- a/source/MenuCharacter.hx +++ b/source/MenuCharacter.hx @@ -44,10 +44,7 @@ class MenuCharacter extends FlxSprite super(x, y); this.flipped = flipped; - if(FlxG.save.data.antialiasing) - { - antialiasing = true; - } + antialiasing = FlxG.save.data.antialiasing; frames = Paths.getSparrowAtlas('campaign_menu_UI_characters'); diff --git a/source/ModchartState.hx b/source/ModchartState.hx index 311ae08..5821560 100644 --- a/source/ModchartState.hx +++ b/source/ModchartState.hx @@ -4,7 +4,7 @@ import openfl.display3D.textures.VideoTexture; import flixel.graphics.FlxGraphic; import flixel.graphics.frames.FlxAtlasFrames; -#if windows +#if cpp import flixel.tweens.FlxEase; import openfl.filters.ShaderFilter; import flixel.tweens.FlxTween; diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index dec5264..5575771 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -1,5 +1,6 @@ package; +import flixel.FlxBasic; #if windows import Discord.DiscordClient; #end @@ -22,6 +23,26 @@ class MusicBeatState extends FlxUIState inline function get_controls():Controls return PlayerSettings.player1.controls; + private var assets:Array = []; + + override function add(Object:flixel.FlxBasic):flixel.FlxBasic + { + if (FlxG.save.data.optimize) + assets.push(Object); + return super.add(Object); + } + + public function clean() + { + if (FlxG.save.data.optimize) + { + for(i in assets) + { + remove(i); + } + } + } + override function create() { TimingStruct.clearTimings(); @@ -86,9 +107,6 @@ class MusicBeatState extends FlxUIState var step = ((60 / data.bpm) * 1000) / 4; var startInMS = (data.startTime * 1000); - - var percent = (Conductor.songPosition - startInMS) / (data.length * 1000); - curDecimalBeat = data.startBeat + (((Conductor.songPosition/1000) - data.startTime) * (data.bpm / 60)); var ste:Int = Math.floor(data.startStep + ((Conductor.songPosition - startInMS) / step)); if (ste >= 0) @@ -104,6 +122,7 @@ class MusicBeatState extends FlxUIState } else if (ste < curStep) { + trace("reset steps for some reason?? at " + Conductor.songPosition); //Song reset? curStep = ste; updateBeat(); @@ -129,6 +148,7 @@ class MusicBeatState extends FlxUIState else if (nextStep < curStep) { //Song reset? + trace("(no bpm change) reset steps for some reason?? at " + Conductor.songPosition); curStep = nextStep; updateBeat(); stepHit(); diff --git a/source/Note.hx b/source/Note.hx index 700c14e..e42b218 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -18,6 +18,8 @@ class Note extends FlxSprite public var strumTime:Float = 0; public var baseStrum:Float = 0; + public var charterSelected:Bool = false; + public var rStrumTime:Float = 0; public var mustPress:Bool = false; @@ -33,6 +35,8 @@ class Note extends FlxSprite public var originColor:Int = 0; // The sustain note's original note's color public var noteSection:Int = 0; + public var isAlt:Bool = false; + public var noteCharterObject:FlxSprite; public var noteScore:Float = 1; @@ -61,13 +65,15 @@ class Note extends FlxSprite public var children:Array = []; - public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false) + public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false, ?isAlt:Bool = false) { super(); if (prevNote == null) prevNote = this; + this.isAlt = isAlt; + this.prevNote = prevNote; isSustainNote = sustainNote; @@ -83,12 +89,15 @@ class Note extends FlxSprite else { this.strumTime = strumTime; - rStrumTime = strumTime - (FlxG.save.data.offset + PlayState.songOffset); #if sys if (PlayState.isSM) { - rStrumTime = Math.round(rStrumTime + Std.parseFloat(PlayState.sm.header.OFFSET)); + rStrumTime = strumTime; } + else + rStrumTime = (strumTime - FlxG.save.data.offset + PlayState.songOffset); + #else + rStrumTime = (strumTime - FlxG.save.data.offset + PlayState.songOffset); #end } @@ -116,10 +125,7 @@ class Note extends FlxSprite setGraphicSize(Std.int(width * 0.7)); updateHitbox(); - if(FlxG.save.data.antialiasing) - { - antialiasing = true; - } + antialiasing = FlxG.save.data.antialiasing; } else { @@ -141,7 +147,9 @@ class Note extends FlxSprite animation.add(dataColor[i] + 'holdend', [i + 4]); // Tails } - setGraphicSize(Std.int(width * PlayState.daPixelZoom)); + var widthSize = Std.int(PlayState.curStage.startsWith('school') ? (width * PlayState.daPixelZoom) : (isSustainNote ? (width * (PlayState.daPixelZoom - 1.5)) : (width * PlayState.daPixelZoom))); + + setGraphicSize(widthSize); updateHitbox(); default: frames = Paths.getSparrowAtlas('NOTE_assets'); @@ -156,10 +164,7 @@ class Note extends FlxSprite setGraphicSize(Std.int(width * 0.7)); updateHitbox(); - if(FlxG.save.data.antialiasing) - { - antialiasing = true; - } + antialiasing = FlxG.save.data.antialiasing; } } @@ -190,6 +195,7 @@ class Note extends FlxSprite // and flip it so it doesn't look weird. // THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS // then what is this lol + // BRO IT LITERALLY SAYS IT FLIPS IF ITS A TRAIL AND ITS DOWNSCROLL if (FlxG.save.data.downscroll && sustainNote) flipY = true; @@ -245,25 +251,23 @@ class Note extends FlxSprite if (mustPress) { - // ass if (isSustainNote) { - if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5) - && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) + if (strumTime - Conductor.songPosition <= ((166 * Conductor.timeScale) * 0.5) + && strumTime - Conductor.songPosition >= (-166 * Conductor.timeScale)) canBeHit = true; else canBeHit = false; } else { - if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset - && strumTime < Conductor.songPosition + Conductor.safeZoneOffset) + if (strumTime - Conductor.songPosition <= (166 * Conductor.timeScale) + && strumTime - Conductor.songPosition >= (-166 * Conductor.timeScale)) canBeHit = true; else canBeHit = false; } - - if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset * Conductor.timeScale && !wasGoodHit) + if (strumTime - Conductor.songPosition < -166 && !wasGoodHit) tooLate = true; } else @@ -274,7 +278,7 @@ class Note extends FlxSprite wasGoodHit = true; } - if (tooLate) + if (tooLate && !wasGoodHit) { if (alpha > 0.3) alpha = 0.3; diff --git a/source/Options.hx b/source/Options.hx index 0a7f8ef..0248a8d 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -152,7 +152,7 @@ class EditorRes extends Option public override function press():Bool { - FlxG.save.data.editor = !FlxG.save.data.editor; + FlxG.save.data.editorBG = !FlxG.save.data.editorBG; display = updateDisplay(); return true; @@ -160,7 +160,7 @@ class EditorRes extends Option private override function updateDisplay():String { - return FlxG.save.data.editor ? "Show Editor Grid" : "Do not Show Editor Grid"; + return FlxG.save.data.editorBG ? "Show Editor Grid" : "Do not Show Editor Grid"; } } @@ -307,6 +307,27 @@ class ResetButtonOption extends Option } } +class InstantRespawn extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.InstantRespawn = !FlxG.save.data.InstantRespawn; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return "Instant Respawn " + (!FlxG.save.data.InstantRespawn ? "off" : "on"); + } +} + class FlashingLightsOption extends Option { public function new(desc:String) diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 87a6b56..440df09 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -36,6 +36,7 @@ class OptionsMenu extends MusicBeatState new ScrollSpeedOption("Change your scroll speed. (1 = Chart dependent)"), new AccuracyDOption("Change how accuracy is calculated. (Accurate = Simple, Complex = Milisecond Based)"), new ResetButtonOption("Toggle pressing R to gameover."), + new InstantRespawn("Toggle if you instantly respawn after dying."), // new OffsetMenu("Get a note offset based off of your inputs!"), new CustomizeGameplay("Drag and drop gameplay modules to your prefered positions!") ]), @@ -85,6 +86,7 @@ class OptionsMenu extends MusicBeatState var blackBorder:FlxSprite; override function create() { + clean(); instance = this; var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image("menuDesat")); @@ -92,10 +94,7 @@ class OptionsMenu extends MusicBeatState menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); menuBG.updateHitbox(); menuBG.screenCenter(); - if(FlxG.save.data.antialiasing) - { - menuBG.antialiasing = true; - } + menuBG.antialiasing = FlxG.save.data.antialiasing; add(menuBG); grpControls = new FlxTypedGroup(); @@ -141,7 +140,9 @@ class OptionsMenu extends MusicBeatState if (acceptInput) { if (controls.BACK && !isCat) + { FlxG.switchState(new MainMenuState()); + } else if (controls.BACK) { isCat = false; diff --git a/source/OutdatedSubState.hx b/source/OutdatedSubState.hx index c825c50..899c2fd 100644 --- a/source/OutdatedSubState.hx +++ b/source/OutdatedSubState.hx @@ -32,10 +32,7 @@ class OutdatedSubState extends MusicBeatState bg.scale.x *= 1.55; bg.scale.y *= 1.55; bg.screenCenter(); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; add(bg); var kadeLogo:FlxSprite = new FlxSprite(FlxG.width, 0).loadGraphic(Paths.image('KadeEngineLogo')); @@ -44,10 +41,7 @@ class OutdatedSubState extends MusicBeatState kadeLogo.x -= kadeLogo.frameHeight; kadeLogo.y -= 180; kadeLogo.alpha = 0.8; - if(FlxG.save.data.antialiasing) - { - kadeLogo.antialiasing = true; - } + kadeLogo.antialiasing = FlxG.save.data.antialiasing; add(kadeLogo); var txt:FlxText = new FlxText(0, 0, FlxG.width, diff --git a/source/Paths.hx b/source/Paths.hx index 8c8f184..8f3faa0 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -1,8 +1,6 @@ package; -import openfl.utils.Assets; import flixel.graphics.FlxGraphic; -import flixel.system.FlxAssets.FlxGraphicAsset; import flixel.FlxG; import flixel.graphics.frames.FlxAtlasFrames; import openfl.utils.AssetType; diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 747c7cb..8f22367 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -209,6 +209,7 @@ class PauseSubState extends MusicBeatSubstate { var daSelected:String = menuItems[curSelected]; + switch (daSelected) { case "Resume": @@ -221,6 +222,7 @@ class PauseSubState extends MusicBeatSubstate PlayState.instance.remove(PlayState.instance.videoSprite); PlayState.instance.removedVideo = true; } + PlayState.instance.clean(); FlxG.resetState(); case "Exit to menu": PlayState.startTime = 0; @@ -247,6 +249,8 @@ class PauseSubState extends MusicBeatSubstate if (FlxG.save.data.fpsCap > 290) (cast (Lib.current.getChildAt(0), Main)).setFPSCap(290); + PlayState.instance.clean(); + if (PlayState.isStoryMode) FlxG.switchState(new StoryMenuState()); else diff --git a/source/PlayState.hx b/source/PlayState.hx index e14b145..8c7e71b 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -69,10 +69,10 @@ import lime.utils.Assets; import openfl.display.BlendMode; import openfl.display.StageQuality; import openfl.filters.ShaderFilter; -#if windows +#if cpp import Discord.DiscordClient; #end -#if windows +#if cpp import Sys; import sys.FileSystem; #end @@ -97,6 +97,9 @@ class PlayState extends MusicBeatState public static var sicks:Int = 0; public static var songPosBG:FlxSprite; + + public var visibleCombos:Array = []; + public static var songPosBar:FlxBar; public static var rep:Replay; @@ -110,7 +113,7 @@ class PlayState extends MusicBeatState var songLength:Float = 0; var kadeEngineWatermark:FlxText; - #if windows + #if cpp // Discord RPC variables var storyDifficultyText:String = ""; var iconRPC:String = ""; @@ -159,7 +162,10 @@ class PlayState extends MusicBeatState public static var misses:Int = 0; public static var campaignMisses:Int = 0; - + public static var campaignSicks:Int = 0; + public static var campaignGoods:Int = 0; + public static var campaignBads:Int = 0; + public static var campaignShits:Int = 0; public var accuracy:Float = 0.00; @@ -192,7 +198,7 @@ class PlayState extends MusicBeatState var notesHitArray:Array = []; var currentFrames:Int = 0; var idleToBeat:Bool = true; // change if bf and dad would idle to the beat of the song - var idleBeat:Int = 4; // how frequently bf and dad would play their idle animation(1 - every beat, 2 - every 2 beats and so on) + var idleBeat:Int = 2; // how frequently bf and dad would play their idle animation(1 - every beat, 2 - every 2 beats and so on) public var dialogue:Array = ['dad:blah blah blah', 'bf:coolswag']; @@ -292,13 +298,11 @@ class PlayState extends MusicBeatState if (FlxG.sound.music != null) FlxG.sound.music.stop(); - if (!isStoryMode) - { - sicks = 0; - bads = 0; - shits = 0; - goods = 0; - } + sicks = 0; + bads = 0; + shits = 0; + goods = 0; + misses = 0; highestCombo = 0; @@ -311,6 +315,7 @@ class PlayState extends MusicBeatState PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed; PlayStateChangeables.botPlay = FlxG.save.data.botplay; PlayStateChangeables.Optimize = FlxG.save.data.optimize; + PlayStateChangeables.zoom = FlxG.save.data.zoom; // pre lowercasing the song name (create) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); @@ -324,7 +329,7 @@ class PlayState extends MusicBeatState removedVideo = false; - #if windows + #if cpp executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); if (isSM) executeModchart = FileSystem.exists(pathToSm + "/modchart.lua"); @@ -367,6 +372,8 @@ class PlayState extends MusicBeatState // String for when the game is paused detailsPausedText = "Paused - " + detailsText; + curStage = ""; + // Updating Discord Rich Presence. DiscordClient.changePresence(detailsText + " " @@ -397,6 +404,8 @@ class PlayState extends MusicBeatState FlxG.cameras.add(camSustains); FlxG.cameras.add(camNotes); + camHUD.zoom = PlayStateChangeables.zoom; + FlxCamera.defaultCameras = [camGame]; persistentUpdate = true; @@ -416,23 +425,16 @@ class PlayState extends MusicBeatState TimingStruct.clearTimings(); - var convertedStuff:Array = []; - var currentIndex = 0; for (i in SONG.eventObjects) { - var name = Reflect.field(i,"name"); - var type = Reflect.field(i,"type"); - var pos = Reflect.field(i,"position"); - var value = Reflect.field(i,"value"); - - if (type == "BPM Change") + if (i.type == "BPM Change") { - var beat:Float = pos; + var beat:Float = i.position; var endBeat:Float = Math.POSITIVE_INFINITY; - TimingStruct.addTiming(beat,value,endBeat, 0); // offset in this case = start time since we don't have a offset + TimingStruct.addTiming(beat,i.value,endBeat, 0); // offset in this case = start time since we don't have a offset if (currentIndex != 0) { @@ -444,40 +446,18 @@ class PlayState extends MusicBeatState currentIndex++; } - convertedStuff.push(new Song.Event(name,pos,value,type)); } - SONG.eventObjects = convertedStuff; + trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay); - // dialogue shit - switch (songLowercase) + switch(songLowercase) { - case 'tutorial': - dialogue = ["Hey you're pretty cute.", 'Use the arrow keys to keep up \nwith me singing.']; - case 'bopeebo': - dialogue = [ - 'HEY!', - "You think you can just sing\nwith my daughter like that?", - "If you want to date her...", - "You're going to have to go \nthrough ME first!" - ]; - case 'fresh': - dialogue = ["Not too shabby boy.", ""]; - case 'dadbattle': - dialogue = [ - "gah you think you're hot stuff?", - "If you can beat me here...", - "Only then I will even CONSIDER letting you\ndate my daughter!" - ]; - case 'senpai': - dialogue = CoolUtil.coolTextFile(Paths.txt('data/senpai/senpaiDialogue')); - case 'roses': - dialogue = CoolUtil.coolTextFile(Paths.txt('data/roses/rosesDialogue')); - case 'thorns': - dialogue = CoolUtil.coolTextFile(Paths.txt('data/thorns/thornsDialogue')); + //if the song has dialogue, so we don't accidentally try to load a nonexistant file and crash the game + case 'senpai' | 'roses' | 'thorns': + dialogue = CoolUtil.coolTextFile(Paths.txt('data/' + songLowercase + '/dialogue')); } // defaults if no stage was found in chart @@ -535,10 +515,7 @@ class PlayState extends MusicBeatState halloweenBG.animation.addByPrefix('idle', 'halloweem bg0'); halloweenBG.animation.addByPrefix('lightning', 'halloweem bg lightning strike', 24, false); halloweenBG.animation.play('idle'); - if(FlxG.save.data.antialiasing) - { - halloweenBG.antialiasing = true; - } + halloweenBG.antialiasing = FlxG.save.data.antialiasing; add(halloweenBG); isHalloween = true; @@ -570,10 +547,7 @@ class PlayState extends MusicBeatState light.visible = false; light.setGraphicSize(Std.int(light.width * 0.85)); light.updateHitbox(); - if(FlxG.save.data.antialiasing) - { - light.antialiasing = true; - } + light.antialiasing = FlxG.save.data.antialiasing; phillyCityLights.add(light); } @@ -601,6 +575,7 @@ class PlayState extends MusicBeatState var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic(Paths.image('limo/limoSunset', 'week4')); skyBG.scrollFactor.set(0.1, 0.1); + skyBG.antialiasing = FlxG.save.data.antialiasing; add(skyBG); var bgLimo:FlxSprite = new FlxSprite(-200, 480); @@ -608,6 +583,7 @@ class PlayState extends MusicBeatState bgLimo.animation.addByPrefix('drive', "background limo pink", 24); bgLimo.animation.play('drive'); bgLimo.scrollFactor.set(0.4, 0.4); + bgLimo.antialiasing = FlxG.save.data.antialiasing; add(bgLimo); if (FlxG.save.data.distractions) { @@ -638,12 +614,10 @@ class PlayState extends MusicBeatState limo.frames = limoTex; limo.animation.addByPrefix('drive', "Limo stage", 24); limo.animation.play('drive'); - if(FlxG.save.data.antialiasing) - { - limo.antialiasing = true; - } + limo.antialiasing = FlxG.save.data.antialiasing; fastCar = new FlxSprite(-300, 160).loadGraphic(Paths.image('limo/fastCarLol', 'week4')); + fastCar.antialiasing = FlxG.save.data.antialiasing; // add(limo); } case 'mall': @@ -653,10 +627,7 @@ class PlayState extends MusicBeatState defaultCamZoom = 0.80; var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic(Paths.image('christmas/bgWalls', 'week5')); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; bg.scrollFactor.set(0.2, 0.2); bg.active = false; bg.setGraphicSize(Std.int(bg.width * 0.8)); @@ -666,10 +637,7 @@ class PlayState extends MusicBeatState upperBoppers = new FlxSprite(-240, -90); upperBoppers.frames = Paths.getSparrowAtlas('christmas/upperBop', 'week5'); upperBoppers.animation.addByPrefix('bop', "Upper Crowd Bob", 24, false); - if(FlxG.save.data.antialiasing) - { - upperBoppers.antialiasing = true; - } + upperBoppers.antialiasing = FlxG.save.data.antialiasing; upperBoppers.scrollFactor.set(0.33, 0.33); upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85)); upperBoppers.updateHitbox(); @@ -679,10 +647,7 @@ class PlayState extends MusicBeatState } var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic(Paths.image('christmas/bgEscalator', 'week5')); - if(FlxG.save.data.antialiasing) - { - bgEscalator.antialiasing = true; - } + bgEscalator.antialiasing = FlxG.save.data.antialiasing; bgEscalator.scrollFactor.set(0.3, 0.3); bgEscalator.active = false; bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9)); @@ -690,20 +655,14 @@ class PlayState extends MusicBeatState add(bgEscalator); var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic(Paths.image('christmas/christmasTree', 'week5')); - if(FlxG.save.data.antialiasing) - { - tree.antialiasing = true; - } + tree.antialiasing = FlxG.save.data.antialiasing; tree.scrollFactor.set(0.40, 0.40); add(tree); bottomBoppers = new FlxSprite(-300, 140); bottomBoppers.frames = Paths.getSparrowAtlas('christmas/bottomBop', 'week5'); bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false); - if(FlxG.save.data.antialiasing) - { - bottomBoppers.antialiasing = true; - } + bottomBoppers.antialiasing = FlxG.save.data.antialiasing; bottomBoppers.scrollFactor.set(0.9, 0.9); bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1)); bottomBoppers.updateHitbox(); @@ -714,19 +673,13 @@ class PlayState extends MusicBeatState var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic(Paths.image('christmas/fgSnow', 'week5')); fgSnow.active = false; - if(FlxG.save.data.antialiasing) - { - fgSnow.antialiasing = true; - } + fgSnow.antialiasing = FlxG.save.data.antialiasing; add(fgSnow); santa = new FlxSprite(-840, 150); santa.frames = Paths.getSparrowAtlas('christmas/santa', 'week5'); santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false); - if(FlxG.save.data.antialiasing) - { - santa.antialiasing = true; - } + santa.antialiasing = FlxG.save.data.antialiasing; if (FlxG.save.data.distractions) { add(santa); @@ -736,10 +689,7 @@ class PlayState extends MusicBeatState { curStage = 'mallEvil'; var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic(Paths.image('christmas/evilBG', 'week5')); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; bg.scrollFactor.set(0.2, 0.2); bg.active = false; bg.setGraphicSize(Std.int(bg.width * 0.8)); @@ -747,18 +697,12 @@ class PlayState extends MusicBeatState add(bg); var evilTree:FlxSprite = new FlxSprite(300, -300).loadGraphic(Paths.image('christmas/evilTree', 'week5')); - if(FlxG.save.data.antialiasing) - { - evilTree.antialiasing = true; - } + evilTree.antialiasing = FlxG.save.data.antialiasing; evilTree.scrollFactor.set(0.2, 0.2); add(evilTree); var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic(Paths.image("christmas/evilSnow", 'week5')); - if(FlxG.save.data.antialiasing) - { - evilSnow.antialiasing = true; - } + evilSnow.antialiasing = FlxG.save.data.antialiasing; add(evilSnow); } case 'school': @@ -898,10 +842,7 @@ class PlayState extends MusicBeatState defaultCamZoom = 0.9; curStage = 'stage'; var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback')); - if(FlxG.save.data.antialiasing) - { - bg.antialiasing = true; - } + bg.antialiasing = FlxG.save.data.antialiasing; bg.scrollFactor.set(0.9, 0.9); bg.active = false; add(bg); @@ -909,10 +850,7 @@ class PlayState extends MusicBeatState var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront')); stageFront.setGraphicSize(Std.int(stageFront.width * 1.1)); stageFront.updateHitbox(); - if(FlxG.save.data.antialiasing) - { - stageFront.antialiasing = true; - } + stageFront.antialiasing = FlxG.save.data.antialiasing; stageFront.scrollFactor.set(0.9, 0.9); stageFront.active = false; add(stageFront); @@ -920,10 +858,7 @@ class PlayState extends MusicBeatState var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains')); stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9)); stageCurtains.updateHitbox(); - if(FlxG.save.data.antialiasing) - { - stageCurtains.antialiasing = true; - } + stageCurtains.antialiasing = FlxG.save.data.antialiasing; stageCurtains.scrollFactor.set(1.3, 1.3); stageCurtains.active = false; @@ -1113,6 +1048,63 @@ class PlayState extends MusicBeatState generateSong(SONG.song); + for(i in unspawnNotes) + { + var dunceNote:Note = i; + notes.add(dunceNote); + if (executeModchart) + { + if (!dunceNote.isSustainNote) + dunceNote.cameras = [camNotes]; + else + dunceNote.cameras = [camSustains]; + } + else + { + dunceNote.cameras = [camHUD]; + } + } + + if (startTime != 0) + { + var toBeRemoved = []; + for(i in 0...notes.members.length) + { + var dunceNote:Note = notes.members[i]; + + if (dunceNote.strumTime - startTime <= 0) + toBeRemoved.push(dunceNote); + else + { + if (PlayStateChangeables.useDownscroll) + { + if (dunceNote.mustPress) + dunceNote.y = (playerStrums.members[Math.floor(Math.abs(dunceNote.noteData))].y + + 0.45 * (startTime - dunceNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)) - dunceNote.noteYOff; + else + dunceNote.y = (strumLineNotes.members[Math.floor(Math.abs(dunceNote.noteData))].y + + 0.45 * (startTime - dunceNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)) - dunceNote.noteYOff; + } + else + { + if (dunceNote.mustPress) + dunceNote.y = (playerStrums.members[Math.floor(Math.abs(dunceNote.noteData))].y + - 0.45 * (startTime - dunceNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)) + dunceNote.noteYOff; + else + dunceNote.y = (strumLineNotes.members[Math.floor(Math.abs(dunceNote.noteData))].y + - 0.45 * (startTime - dunceNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)) + dunceNote.noteYOff; + } + } + } + + for(i in toBeRemoved) + notes.members.remove(i); + } + trace('generated'); // add(strumLine); @@ -1148,7 +1140,7 @@ class PlayState extends MusicBeatState add(songPosBG); songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, - 'songPositionBar', 0, 90000); + 'songPositionBar', 0, songLength); songPosBar.scrollFactor.set(); songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); add(songPosBar); @@ -1402,7 +1394,7 @@ class PlayState extends MusicBeatState var luaWiggles:Array = []; - #if windows + #if cpp public static var luaModchart:ModchartState = null; #end @@ -1414,36 +1406,9 @@ class PlayState extends MusicBeatState //generateStaticArrows(0); //generateStaticArrows(1); - if (startTime != 0) - { - var toBeRemoved = []; - for(i in 0...unspawnNotes.length) - { - var dunceNote:Note = unspawnNotes[i]; - if (dunceNote.strumTime - startTime <= 0) - toBeRemoved.push(dunceNote); - else if (dunceNote.strumTime - startTime < 3500) - { - notes.add(dunceNote); - if (dunceNote.mustPress) - dunceNote.y = (playerStrums.members[Math.floor(Math.abs(dunceNote.noteData))].y - + 0.45 * (startTime - dunceNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, - 2)) - dunceNote.noteYOff; - else - dunceNote.y = (strumLineNotes.members[Math.floor(Math.abs(dunceNote.noteData))].y - + 0.45 * (startTime - dunceNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, - 2)) - dunceNote.noteYOff; - toBeRemoved.push(dunceNote); - } - } - - for(i in toBeRemoved) - unspawnNotes.remove(i); - } - - #if windows + #if cpp // pre lowercasing the song name (startCountdown) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); switch (songLowercase) @@ -1475,21 +1440,17 @@ class PlayState extends MusicBeatState var introAssets:Map> = new Map>(); introAssets.set('default', ['ready', "set", "go"]); - introAssets.set('school', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']); - introAssets.set('schoolEvil', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']); + introAssets.set('pixel', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']); var introAlts:Array = introAssets.get('default'); var altSuffix:String = ""; + var week6Bullshit:String = null; - for (value in introAssets.keys()) + if (SONG.noteStyle == 'pixel') { - if (value == curStage) - { - trace(value + " - " + curStage); - introAlts = introAssets.get(value); - if (curStage.contains('school')) - altSuffix = '-pixel'; - } + introAlts = introAssets.get('pixel'); + altSuffix = '-pixel'; + week6Bullshit = 'week6'; } switch (swagCounter) @@ -1498,11 +1459,11 @@ class PlayState extends MusicBeatState case 0: FlxG.sound.play(Paths.sound('intro3' + altSuffix), 0.6); case 1: - var ready:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[0])); + var ready:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[0], week6Bullshit)); ready.scrollFactor.set(); ready.updateHitbox(); - if (curStage.startsWith('school')) + if (SONG.noteStyle == 'pixel') ready.setGraphicSize(Std.int(ready.width * daPixelZoom)); ready.screenCenter(); @@ -1516,10 +1477,10 @@ class PlayState extends MusicBeatState }); FlxG.sound.play(Paths.sound('intro2' + altSuffix), 0.6); case 2: - var set:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[1])); + var set:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[1], week6Bullshit)); set.scrollFactor.set(); - if (curStage.startsWith('school')) + if (SONG.noteStyle == 'pixel') set.setGraphicSize(Std.int(set.width * daPixelZoom)); set.screenCenter(); @@ -1533,10 +1494,10 @@ class PlayState extends MusicBeatState }); FlxG.sound.play(Paths.sound('intro1' + altSuffix), 0.6); case 3: - var go:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[2])); + var go:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[2], week6Bullshit)); go.scrollFactor.set(); - if (curStage.startsWith('school')) + if (SONG.noteStyle == 'pixel') go.setGraphicSize(Std.int(go.width * daPixelZoom)); go.updateHitbox(); @@ -1613,6 +1574,9 @@ class PlayState extends MusicBeatState keys[data] = false; } + public var closestNotes:Array = []; + + private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs @@ -1668,13 +1632,9 @@ class PlayState extends MusicBeatState 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 + for(i in closestNotes) + if (i.noteData == data) + dataNotes.push(i); if (dataNotes.length != 0) { @@ -1724,7 +1684,7 @@ class PlayState extends MusicBeatState ana.hit = false; ana.hitJudge = "shit"; ana.nearestNote = []; - health -= 0.10; + health -= 0.20; } } @@ -1737,65 +1697,9 @@ class PlayState extends MusicBeatState previousFrameTime = FlxG.game.ticks; lastReportedPlayheadPosition = 0; - if (!paused) - { - #if sys - if (!isStoryMode && isSM) - { - trace("Loading " + pathToSm + "/" + sm.header.MUSIC); - var bytes = File.getBytes(pathToSm + "/" + sm.header.MUSIC); - var sound = new Sound(); - sound.loadCompressedDataFromByteArray(bytes.getData(), bytes.length); - FlxG.sound.playMusic(sound); - } - else - FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false); - #else - FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false); - #end - } - - FlxG.sound.music.onComplete = endSong; + FlxG.sound.music.play(); vocals.play(); - // Song duration in a float, useful for the time left feature - songLength = FlxG.sound.music.length; - - if (FlxG.save.data.songPosition) - { - remove(songPosBG); - remove(songPosBar); - remove(songName); - - songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); - if (PlayStateChangeables.useDownscroll) - songPosBG.y = FlxG.height * 0.9 + 45; - songPosBG.screenCenter(X); - songPosBG.scrollFactor.set(); - add(songPosBG); - - songPosBar = new FlxBar(songPosBG.x - + 4, songPosBG.y - + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, - 'songPositionBar', 0, songLength - - 1000); - songPosBar.numDivisions = 1000; - songPosBar.scrollFactor.set(); - songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); - add(songPosBar); - - 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(); - add(songName); - - songPosBG.cameras = [camHUD]; - songPosBar.cameras = [camHUD]; - songName.cameras = [camHUD]; - } - // Song check real quick switch (curSong) { @@ -1862,6 +1766,66 @@ class PlayState extends MusicBeatState FlxG.sound.list.add(vocals); + if (!paused) + { + #if sys + if (!isStoryMode && isSM) + { + trace("Loading " + pathToSm + "/" + sm.header.MUSIC); + var bytes = File.getBytes(pathToSm + "/" + sm.header.MUSIC); + var sound = new Sound(); + sound.loadCompressedDataFromByteArray(bytes.getData(), bytes.length); + FlxG.sound.playMusic(sound); + } + else + FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false); + #else + FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false); + #end + } + + FlxG.sound.music.onComplete = endSong; + FlxG.sound.music.pause(); + + // Song duration in a float, useful for the time left feature + songLength = FlxG.sound.music.length; + + if (FlxG.save.data.songPosition) + { + remove(songPosBG); + remove(songPosBar); + remove(songName); + + songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); + if (PlayStateChangeables.useDownscroll) + songPosBG.y = FlxG.height * 0.9 + 45; + songPosBG.screenCenter(X); + songPosBG.scrollFactor.set(); + add(songPosBG); + + songPosBar = new FlxBar(songPosBG.x + + 4, songPosBG.y + + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, + 'songPositionBar', 0, songLength + - 1000); + songPosBar.numDivisions = 1000; + songPosBar.scrollFactor.set(); + songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); + add(songPosBar); + + 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(); + add(songName); + + songPosBG.cameras = [camHUD]; + songPosBar.cameras = [camHUD]; + songName.cameras = [camHUD]; + } + + notes = new FlxTypedGroup(); add(notes); @@ -1873,7 +1837,7 @@ class PlayState extends MusicBeatState var playerCounter:Int = 0; // Per song offset check - #if windows + #if cpp // pre lowercasing the song name (generateSong) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); switch (songLowercase) @@ -1950,6 +1914,8 @@ class PlayState extends MusicBeatState susLength = susLength / Conductor.stepCrochet; unspawnNotes.push(swagNote); + swagNote.isAlt = songNotes[3]; + if (susLength > 0) swagNote.isParent = true; @@ -1962,6 +1928,7 @@ class PlayState extends MusicBeatState var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true); sustainNote.scrollFactor.set(); unspawnNotes.push(sustainNote); + sustainNote.isAlt = songNotes[3]; sustainNote.mustPress = gottaHitNote; @@ -2028,7 +1995,7 @@ class PlayState extends MusicBeatState switch (noteTypeCheck) { case 'pixel': - babyArrow.loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17); + babyArrow.loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels', 'week6'), true, 17, 17); babyArrow.animation.add('green', [6]); babyArrow.animation.add('red', [7]); babyArrow.animation.add('blue', [5]); @@ -2077,10 +2044,7 @@ class PlayState extends MusicBeatState babyArrow.x += Note.swagWidth * i; - if(FlxG.save.data.antialiasing) - { - babyArrow.antialiasing = true; - } + babyArrow.antialiasing = FlxG.save.data.antialiasing; babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); } @@ -2145,7 +2109,7 @@ class PlayState extends MusicBeatState vocals.pause(); } - #if windows + #if cpp DiscordClient.changePresence("PAUSED on " + SONG.song + " (" @@ -2179,7 +2143,7 @@ class PlayState extends MusicBeatState startTimer.active = true; paused = false; - #if windows + #if cpp if (startTimer.finished) { DiscordClient.changePresence(detailsText @@ -2217,7 +2181,7 @@ class PlayState extends MusicBeatState vocals.time = Conductor.songPosition; vocals.play(); - #if windows + #if cpp DiscordClient.changePresence(detailsText + " " + SONG.song @@ -2249,43 +2213,33 @@ class PlayState extends MusicBeatState public var updateFrame = 0; + public var pastScrollChanges:Array = []; + override public function update(elapsed:Float) { #if !debug perfectMode = false; #end - if (updateFrame == 4) + if (generatedMusic) { - TimingStruct.clearTimings(); - - var currentIndex = 0; - for (i in SONG.eventObjects) + for(i in notes) + { + var diff = i.strumTime - Conductor.songPosition; + if (diff < 2650 && diff >= -2650) { - if (i.type == "BPM Change") - { - var beat:Float = i.position; - - var endBeat:Float = Math.POSITIVE_INFINITY; - - TimingStruct.addTiming(beat,i.value,endBeat, 0); // offset in this case = start time since we don't have a offset - - if (currentIndex != 0) - { - var data = TimingStruct.AllTimings[currentIndex - 1]; - data.endBeat = beat; - data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); - TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; - } - - currentIndex++; - } + i.active = true; + i.visible = true; } - updateFrame++; + else + { + i.active = false; + i.visible = false; + } + } } - else if (updateFrame != 5) - updateFrame++; - + + var timingSeg = TimingStruct.getTimingAtTimestamp(Conductor.songPosition); @@ -2309,8 +2263,12 @@ class PlayState extends MusicBeatState switch(i.type) { case "Scroll Speed Change": - if (i.position < curDecimalBeat) + if (i.position <= curDecimalBeat && !pastScrollChanges.contains(i)) + { + pastScrollChanges.push(i); + trace("SCROLL SPEED CHANGE to " + i.value); newScroll = i.value; + } } } @@ -2330,7 +2288,7 @@ class PlayState extends MusicBeatState } } - #if windows + #if cpp if (executeModchart && luaModchart != null && songStarted) { luaModchart.setVar('songPos', Conductor.songPosition); @@ -2383,6 +2341,15 @@ class PlayState extends MusicBeatState if (i <= playerStrums.length) playerStrums.members[i].visible = p2; } + + camNotes.zoom = camHUD.zoom; + camNotes.x = camHUD.x; + camNotes.y = camHUD.y; + camNotes.angle = camHUD.angle; + camSustains.zoom = camHUD.zoom; + camSustains.x = camHUD.x; + camSustains.y = camHUD.y; + camSustains.angle = camHUD.angle; } #end @@ -2443,12 +2410,13 @@ class PlayState extends MusicBeatState { trace('GITAROO MAN EASTER EGG'); FlxG.switchState(new GitarooPause()); + clean(); } else openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } - if (FlxG.keys.justPressed.SEVEN) + if (FlxG.keys.justPressed.SEVEN && songStarted) { if (useVideo) { @@ -2461,13 +2429,15 @@ class PlayState extends MusicBeatState removedVideo = true; } cannotDie = true; - #if windows + #if cpp DiscordClient.changePresence("Chart Editor", null, null, true); #end + FlxG.switchState(new ChartingState()); + clean(); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); - #if windows + #if cpp if (luaModchart != null) { luaModchart.die(); @@ -2518,9 +2488,10 @@ class PlayState extends MusicBeatState } FlxG.switchState(new AnimationDebug(SONG.player2)); + clean(); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); - #if windows + #if cpp if (luaModchart != null) { luaModchart.die(); @@ -2532,9 +2503,10 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.ZERO) { FlxG.switchState(new AnimationDebug(SONG.player1)); + clean(); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); - #if windows + #if cpp if (luaModchart != null) { luaModchart.die(); @@ -2562,13 +2534,6 @@ class PlayState extends MusicBeatState daNote.destroy(); } }); - for (i in 0...unspawnNotes.length) { - var daNote:Note = unspawnNotes[0]; - if(daNote.strumTime - 500 >= Conductor.songPosition) { - break; - } - unspawnNotes.splice(unspawnNotes.indexOf(daNote), 1); - } FlxG.sound.music.time = Conductor.songPosition; FlxG.sound.music.play(); @@ -2622,6 +2587,20 @@ class PlayState extends MusicBeatState if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) { + + closestNotes = []; + + notes.forEachAlive(function(daNote:Note) + { + if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit) + closestNotes.push(daNote); + }); // Collect notes that can be hit + + closestNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); + + if (closestNotes.length != 0) + FlxG.watch.addQuick("Current Note",closestNotes[0].strumTime - Conductor.songPosition); + // Make sure Girlfriend cheers only for certain songs if (allowedToHeadbang) { @@ -2730,7 +2709,7 @@ class PlayState extends MusicBeatState } } - #if windows + #if cpp if (luaModchart != null) luaModchart.setVar("mustHit", PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); #end @@ -2739,7 +2718,7 @@ class PlayState extends MusicBeatState { var offsetX = 0; var offsetY = 0; - #if windows + #if cpp if (luaModchart != null) { offsetX = luaModchart.getVar("followXOffset", "float"); @@ -2747,7 +2726,7 @@ class PlayState extends MusicBeatState } #end camFollow.setPosition(dad.getMidpoint().x + 150 + offsetX, dad.getMidpoint().y - 100 + offsetY); - #if windows + #if cpp if (luaModchart != null) luaModchart.executeState('playerTwoTurn', []); #end @@ -2767,7 +2746,7 @@ class PlayState extends MusicBeatState { var offsetX = 0; var offsetY = 0; - #if windows + #if cpp if (luaModchart != null) { offsetX = luaModchart.getVar("followXOffset", "float"); @@ -2776,7 +2755,7 @@ class PlayState extends MusicBeatState #end camFollow.setPosition(boyfriend.getMidpoint().x - 100 + offsetX, boyfriend.getMidpoint().y - 100 + offsetY); - #if windows + #if cpp if (luaModchart != null) luaModchart.executeState('playerOneTurn', []); #end @@ -2799,8 +2778,28 @@ class PlayState extends MusicBeatState if (camZooming) { - FlxG.camera.zoom = FlxMath.lerp(defaultCamZoom, FlxG.camera.zoom, 0.95); - camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95); + if (FlxG.save.data.zoom < 0.8) + FlxG.save.data.zoom = 0.8; + + if (FlxG.save.data.zoom > 1.2) + FlxG.save.data.zoom = 1.2; + + if (!executeModchart) + { + FlxG.camera.zoom = FlxMath.lerp(defaultCamZoom, FlxG.camera.zoom, 0.95); + camHUD.zoom = FlxMath.lerp(FlxG.save.data.zoom, camHUD.zoom, 0.95); + + camNotes.zoom = camHUD.zoom; + camSustains.zoom = camHUD.zoom; + } + else + { + FlxG.camera.zoom = FlxMath.lerp(defaultCamZoom, FlxG.camera.zoom, 0.95); + camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95); + + camNotes.zoom = camHUD.zoom; + camSustains.zoom = camHUD.zoom; + } } FlxG.watch.addQuick("curBPM", Conductor.bpm); @@ -2854,7 +2853,7 @@ class PlayState extends MusicBeatState openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if windows + #if cpp // Game Over doesn't get his own variable because it's only used here DiscordClient.changePresence("GAME OVER -- " + SONG.song @@ -2890,7 +2889,7 @@ class PlayState extends MusicBeatState openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if windows + #if cpp // Game Over doesn't get his own variable because it's only used here DiscordClient.changePresence("GAME OVER -- " + SONG.song @@ -2910,21 +2909,6 @@ class PlayState extends MusicBeatState } } - if (unspawnNotes[0] != null) - { - if (unspawnNotes[0].strumTime - Conductor.songPosition < 3500) - { - var dunceNote:Note = unspawnNotes[0]; - notes.add(dunceNote); - if (!dunceNote.isSustainNote) - dunceNote.cameras = [camNotes]; - else - dunceNote.cameras = [camSustains]; - - var index:Int = unspawnNotes.indexOf(dunceNote); - unspawnNotes.splice(index, 1); - } - } if (generatedMusic) { @@ -2968,7 +2952,7 @@ class PlayState extends MusicBeatState // If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime if (!PlayStateChangeables.botPlay) { - if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit || holdArray[Math.floor(Math.abs(daNote.noteData))] && !daNote.tooLate) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2)) { // Clip to strumline @@ -3009,7 +2993,7 @@ class PlayState extends MusicBeatState if (!PlayStateChangeables.botPlay) { - if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit || holdArray[Math.floor(Math.abs(daNote.noteData))] && !daNote.tooLate) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) { // Clip to strumline @@ -3045,43 +3029,88 @@ class PlayState extends MusicBeatState if (SONG.notes[Math.floor(curStep / 16)] != null) { - if (SONG.notes[Math.floor(curStep / 16)].altAnim) + if (SONG.notes[Math.floor(curStep / 16)].p1AltAnim) altAnim = '-alt'; } - // Accessing the animation name directly to play it - var singData:Int = Std.int(Math.abs(daNote.noteData)); - dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); - - if (FlxG.save.data.cpuStrums) + if (daNote.isAlt) { - cpuStrums.forEach(function(spr:FlxSprite) - { - if (Math.abs(daNote.noteData) == spr.ID) - { - spr.animation.play('confirm', true); - } - if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) - { - spr.centerOffsets(); - spr.offset.x -= 13; - spr.offset.y -= 13; - } - else - spr.centerOffsets(); - }); + altAnim = '-alt'; + trace("YOO WTF THIS IS AN ALT NOTE????"); } - #if windows - if (luaModchart != null) - luaModchart.executeState('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]); - #end + // Accessing the animation name directly to play it + if (!daNote.isParent && daNote.parent != null) + { + if (daNote.spotInLine != daNote.parent.children.length - 1) + { + var singData:Int = Std.int(Math.abs(daNote.noteData)); + dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); - dad.holdTimer = 0; + if (FlxG.save.data.cpuStrums) + { + cpuStrums.forEach(function(spr:FlxSprite) + { + if (Math.abs(daNote.noteData) == spr.ID) + { + spr.animation.play('confirm', true); + } + if (spr.animation.curAnim.name == 'confirm' && SONG.noteStyle != 'pixel') + { + spr.centerOffsets(); + spr.offset.x -= 13; + spr.offset.y -= 13; + } + else + spr.centerOffsets(); + }); + } - if (SONG.needsVoices) - vocals.volume = 1; + #if cpp + if (luaModchart != null) + luaModchart.executeState('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]); + #end + dad.holdTimer = 0; + + if (SONG.needsVoices) + vocals.volume = 1; + } + } + else + { + var singData:Int = Std.int(Math.abs(daNote.noteData)); + dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); + + if (FlxG.save.data.cpuStrums) + { + cpuStrums.forEach(function(spr:FlxSprite) + { + if (Math.abs(daNote.noteData) == spr.ID) + { + spr.animation.play('confirm', true); + } + if (spr.animation.curAnim.name == 'confirm' && SONG.noteStyle != 'pixel') + { + spr.centerOffsets(); + spr.offset.x -= 13; + spr.offset.y -= 13; + } + else + spr.centerOffsets(); + }); + } + + #if cpp + if (luaModchart != null) + luaModchart.executeState('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]); + #end + + dad.holdTimer = 0; + + if (SONG.needsVoices) + vocals.volume = 1; + } daNote.active = false; daNote.kill(); @@ -3096,7 +3125,10 @@ class PlayState extends MusicBeatState if (!daNote.isSustainNote) daNote.modAngle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; if (daNote.sustainActive) - daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; + { + if (executeModchart) + daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; + } daNote.modAngle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; } else if (!daNote.wasGoodHit && !daNote.modifiedByLua) @@ -3106,14 +3138,17 @@ class PlayState extends MusicBeatState if (!daNote.isSustainNote) daNote.modAngle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle; if (daNote.sustainActive) - daNote.alpha = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].alpha; + { + if (executeModchart) + daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; + } daNote.modAngle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle; } if (daNote.isSustainNote) { daNote.x += daNote.width / 2 + 20; - if (PlayState.curStage.startsWith('school')) + if (SONG.noteStyle == 'pixel') daNote.x -= 11; } @@ -3121,7 +3156,13 @@ 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 && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate + if (daNote.isSustainNote && daNote.wasGoodHit && Conductor.songPosition >= daNote.strumTime) + { + daNote.kill(); + notes.remove(daNote, true); + daNote.destroy(); + } + else if ((daNote.mustPress && daNote.tooLate && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate && PlayStateChangeables.useDownscroll) && daNote.mustPress) { @@ -3139,14 +3180,14 @@ class PlayState extends MusicBeatState totalNotesHit += 1; else { - if (!daNote.isSustainNote) - health -= 0.10; vocals.volume = 0; if (theFunne && !daNote.isSustainNote) + { noteMiss(daNote.noteData, daNote); + } if (daNote.isParent) { - health -= 0.20; // give a health punishment for failing a LN + health -= 0.15; // give a health punishment for failing a LN trace("hold fell over at the start"); for (i in daNote.children) { @@ -3161,7 +3202,7 @@ class PlayState extends MusicBeatState && daNote.sustainActive && daNote.spotInLine != daNote.parent.children.length) { - health -= 0.20; // give a health punishment for failing a LN + health -= 0.2; // give a health punishment for failing a LN trace("hold fell over at " + daNote.spotInLine); for (i in daNote.parent.children) { @@ -3172,20 +3213,30 @@ class PlayState extends MusicBeatState misses++; updateAccuracy(); } + else + { + health -= 0.15; + } } } } else { - if (!daNote.isSustainNote) - health -= 0.10; vocals.volume = 0; if (theFunne && !daNote.isSustainNote) - noteMiss(daNote.noteData, daNote); + { + if (PlayStateChangeables.botPlay) + { + daNote.rating = "bad"; + goodNoteHit(daNote); + } + else + noteMiss(daNote.noteData, daNote); + } if (daNote.isParent) { - health -= 0.20; // give a health punishment for failing a LN + health -= 0.15; // give a health punishment for failing a LN trace("hold fell over at the start"); for (i in daNote.children) { @@ -3201,7 +3252,7 @@ class PlayState extends MusicBeatState && daNote.sustainActive && daNote.spotInLine != daNote.parent.children.length) { - health -= 0.20; // give a health punishment for failing a LN + health -= 0.25; // give a health punishment for failing a LN trace("hold fell over at " + daNote.spotInLine); for (i in daNote.parent.children) { @@ -3213,6 +3264,10 @@ class PlayState extends MusicBeatState misses++; updateAccuracy(); } + else + { + health -= 0.15; + } } } } @@ -3234,6 +3289,17 @@ class PlayState extends MusicBeatState spr.centerOffsets(); } }); + if (PlayStateChangeables.botPlay) + { + playerStrums.forEach(function(spr:FlxSprite) + { + if (spr.animation.finished) + { + spr.animation.play('static'); + spr.centerOffsets(); + } + }); + } } if (!inCutscene && songStarted) @@ -3247,6 +3313,7 @@ class PlayState extends MusicBeatState function endSong():Void { + endingSong = true; FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); if (useVideo) @@ -3257,8 +3324,6 @@ class PlayState extends MusicBeatState PlayState.instance.remove(PlayState.instance.videoSprite); } - if (isStoryMode) - campaignMisses = misses; if (!loadRep) rep.SaveReplay(saveNotes, saveJudge, replayAna); @@ -3272,7 +3337,7 @@ class PlayState extends MusicBeatState if (FlxG.save.data.fpsCap > 290) (cast(Lib.current.getChildAt(0), Main)).setFPSCap(290); - #if windows + #if cpp if (luaModchart != null) { luaModchart.die(); @@ -3309,6 +3374,7 @@ class PlayState extends MusicBeatState FlxG.sound.playMusic(Paths.music('freakyMenu')); offsetTesting = false; LoadingState.loadAndSwitchState(new OptionsMenu()); + clean(); FlxG.save.data.offset = offsetTest; } else @@ -3316,6 +3382,11 @@ class PlayState extends MusicBeatState if (isStoryMode) { campaignScore += Math.round(songScore); + campaignMisses += misses; + campaignSicks += sicks; + campaignGoods += goods; + campaignBads += bads; + campaignShits += shits; storyPlaylist.remove(storyPlaylist[0]); @@ -3341,9 +3412,10 @@ class PlayState extends MusicBeatState FlxG.sound.playMusic(Paths.music('freakyMenu')); Conductor.changeBPM(102); FlxG.switchState(new StoryMenuState()); + clean(); } - #if windows + #if cpp if (luaModchart != null) { luaModchart.die(); @@ -3395,6 +3467,7 @@ class PlayState extends MusicBeatState FlxG.sound.music.stop(); LoadingState.loadAndSwitchState(new PlayState()); + clean(); } } else @@ -3415,7 +3488,10 @@ class PlayState extends MusicBeatState }); } else + { FlxG.switchState(new FreeplayState()); + clean(); + } } } } @@ -3457,7 +3533,7 @@ class PlayState extends MusicBeatState score = -300; combo = 0; misses++; - health -= 0.06; + health -= 0.1; ss = false; shits++; if (FlxG.save.data.accuracyMod == 0) @@ -3465,7 +3541,7 @@ class PlayState extends MusicBeatState case 'bad': daRating = 'bad'; score = 0; - health -= 0.03; + health -= 0.06; ss = false; bads++; if (FlxG.save.data.accuracyMod == 0) @@ -3503,14 +3579,16 @@ class PlayState extends MusicBeatState var pixelShitPart1:String = ""; var pixelShitPart2:String = ''; + var pixelShitPart3:String = null; - if (curStage.startsWith('school')) + if (SONG.noteStyle == 'pixel') { pixelShitPart1 = 'weeb/pixelUI/'; pixelShitPart2 = '-pixel'; + pixelShitPart3 = 'week6'; } - rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2)); + rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2, pixelShitPart3)); rating.screenCenter(); rating.y -= 50; rating.x = coolText.x - 125; @@ -3576,7 +3654,7 @@ class PlayState extends MusicBeatState if (!PlayStateChangeables.botPlay || loadRep) add(currentTimingShown); - var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); + var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2, pixelShitPart3)); comboSpr.screenCenter(); comboSpr.x = rating.x; comboSpr.y = rating.y + 100; @@ -3594,18 +3672,12 @@ class PlayState extends MusicBeatState if (!PlayStateChangeables.botPlay || loadRep) add(rating); - if (!curStage.startsWith('school')) + if (SONG.noteStyle != 'pixel') { rating.setGraphicSize(Std.int(rating.width * 0.7)); - if(FlxG.save.data.antialiasing) - { - rating.antialiasing = true; - } + rating.antialiasing = FlxG.save.data.antialiasing; comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7)); - if(FlxG.save.data.antialiasing) - { - comboSpr.antialiasing = true; - } + comboSpr.antialiasing = FlxG.save.data.antialiasing; } else { @@ -3646,18 +3718,15 @@ class PlayState extends MusicBeatState var daLoop:Int = 0; for (i in seperatedScore) { - var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2)); + var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2, pixelShitPart3)); numScore.screenCenter(); numScore.x = rating.x + (43 * daLoop) - 50; numScore.y = rating.y + 100; numScore.cameras = [camHUD]; - if (!curStage.startsWith('school')) + if (SONG.noteStyle != 'pixel') { - if(FlxG.save.data.antialiasing) - { - numScore.antialiasing = true; - } + numScore.antialiasing = FlxG.save.data.antialiasing; numScore.setGraphicSize(Std.int(numScore.width * 0.5)); } else @@ -3672,14 +3741,33 @@ class PlayState extends MusicBeatState add(numScore); + visibleCombos.push(numScore); + FlxTween.tween(numScore, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { + visibleCombos.remove(numScore); numScore.destroy(); }, + onUpdate: function (tween:FlxTween) + { + if (!visibleCombos.contains(numScore)) + { + tween.cancel(); + numScore.destroy(); + } + }, startDelay: Conductor.crochet * 0.002 }); + if (visibleCombos.length > seperatedScore.length + 20) + { + for(i in 0...seperatedScore.length - 1) + { + visibleCombos.remove(visibleCombos[visibleCombos.length - 1]); + } + } + daLoop++; } /* @@ -3738,7 +3826,7 @@ class PlayState extends MusicBeatState var pressArray:Array = [controls.LEFT_P, controls.DOWN_P, controls.UP_P, controls.RIGHT_P]; var releaseArray:Array = [controls.LEFT_R, controls.DOWN_R, controls.UP_R, controls.RIGHT_R]; var keynameArray:Array = ['left', 'down', 'up', 'right']; - #if windows + #if cpp if (luaModchart != null) { for (i in 0...pressArray.length) { @@ -3870,7 +3958,7 @@ class PlayState extends MusicBeatState 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.animation.curAnim.curFrame >= 10) + if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss') && (boyfriend.animation.curAnim.curFrame >= 10 || boyfriend.animation.curAnim.finished)) boyfriend.playAnim('idle'); } else if (!FlxG.save.data.ghost) @@ -3886,13 +3974,15 @@ class PlayState extends MusicBeatState if (i != null) replayAna.anaArray.push(i); // put em all there } + if (PlayStateChangeables.botPlay) notes.forEachAlive(function(daNote:Note) { - if (PlayStateChangeables.useDownscroll && daNote.y > strumLine.y || !PlayStateChangeables.useDownscroll && daNote.y < strumLine.y) + var diff = -(daNote.strumTime - Conductor.songPosition); + + daNote.rating = Ratings.CalculateRating(diff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); + if (daNote.mustPress && daNote.rating == "sick" || (diff > 0 && daNote.mustPress)) { // Force good note hit regardless if it's too late to hit it or not as a fail safe - if (PlayStateChangeables.botPlay && daNote.canBeHit && daNote.mustPress || PlayStateChangeables.botPlay && daNote.tooLate && daNote.mustPress) - { if (loadRep) { // trace('ReplayNote ' + tmpRepNote.strumtime + ' | ' + tmpRepNote.direction); @@ -3908,33 +3998,53 @@ class PlayState extends MusicBeatState { goodNoteHit(daNote); boyfriend.holdTimer = daNote.sustainLength; + if (FlxG.save.data.cpuStrums) + { + playerStrums.forEach(function(spr:FlxSprite) + { + if (Math.abs(daNote.noteData) == spr.ID) + { + spr.animation.play('confirm', true); + } + if (spr.animation.curAnim.name == 'confirm' && SONG.noteStyle != 'pixel') + { + spr.centerOffsets(); + spr.offset.x -= 13; + spr.offset.y -= 13; + } + else + spr.centerOffsets(); + }); + } } - } } }); 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.animation.curAnim.curFrame >= 10) + if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss') && (boyfriend.animation.curAnim.curFrame >= 10 || boyfriend.animation.curAnim.finished)) boyfriend.playAnim('idle'); } - playerStrums.forEach(function(spr:FlxSprite) + if (!PlayStateChangeables.botPlay) { - if (keys[spr.ID] && spr.animation.curAnim.name != 'confirm') - spr.animation.play('pressed', false); - if (!keys[spr.ID]) - spr.animation.play('static', false); - - if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) + playerStrums.forEach(function(spr:FlxSprite) { - spr.centerOffsets(); - spr.offset.x -= 13; - spr.offset.y -= 13; - } - else - spr.centerOffsets(); - }); + if (keys[spr.ID] && spr.animation.curAnim.name != 'confirm' && spr.animation.curAnim.name != 'pressed') + spr.animation.play('pressed', false); + if (!keys[spr.ID]) + spr.animation.play('static', false); + + if (spr.animation.curAnim.name == 'confirm' && SONG.noteStyle != 'pixel') + { + spr.centerOffsets(); + spr.offset.x -= 13; + spr.offset.y -= 13; + } + else + spr.centerOffsets(); + }); + } } public function findByTime(time:Float):Array @@ -4108,7 +4218,7 @@ class PlayState extends MusicBeatState // Hole switch statement replaced with a single line :) boyfriend.playAnim('sing' + dataSuffix[direction] + 'miss', true); - #if windows + #if cpp if (luaModchart != null) luaModchart.executeState('playerOneMiss', [direction, Conductor.songPosition]); #end @@ -4251,19 +4361,16 @@ class PlayState extends MusicBeatState else totalNotesHit += 1; - switch (note.noteData) - { - case 2: - boyfriend.playAnim('singUP', true); - case 3: - boyfriend.playAnim('singRIGHT', true); - case 1: - boyfriend.playAnim('singDOWN', true); - case 0: - boyfriend.playAnim('singLEFT', true); - } + var altAnim:String = ""; + if (note.isAlt) + { + altAnim = '-alt'; + trace("Alt note on BF"); + } - #if windows + boyfriend.playAnim('sing' + dataSuffix[note.noteData] + altAnim, true); + + #if cpp if (luaModchart != null) luaModchart.executeState('playerOneSing', [note.noteData, Conductor.songPosition]); #end @@ -4277,17 +4384,27 @@ class PlayState extends MusicBeatState saveJudge.push(note.rating); } - playerStrums.forEach(function(spr:FlxSprite) + if (!PlayStateChangeables.botPlay) { - if (Math.abs(note.noteData) == spr.ID) + playerStrums.forEach(function(spr:FlxSprite) { - spr.animation.play('confirm', true); - } - }); + if (Math.abs(note.noteData) == spr.ID) + { + spr.animation.play('confirm', true); + } + }); + } - note.kill(); - notes.remove(note, true); - note.destroy(); + if (!note.isSustainNote) + { + note.kill(); + notes.remove(note, true); + note.destroy(); + } + else + { + note.wasGoodHit = true; + } updateAccuracy(); } @@ -4406,7 +4523,7 @@ class PlayState extends MusicBeatState resyncVocals(); } - #if windows + #if cpp if (executeModchart && luaModchart != null) { luaModchart.setVar('curStep', curStep); @@ -4452,14 +4569,14 @@ class PlayState extends MusicBeatState notes.sort(FlxSort.byY, (PlayStateChangeables.useDownscroll ? FlxSort.ASCENDING : FlxSort.DESCENDING)); } - #if windows + #if cpp if (executeModchart && luaModchart != null) { luaModchart.executeState('beatHit', [curBeat]); } #end - if (curSong == 'Tutorial' && dad.curCharacter == 'gf') + if (curSong == 'Tutorial' && dad.curCharacter == 'gf' && SONG.notes[Math.floor(curStep / 16)] != null) { if (SONG.notes[Math.floor(curStep / 16)].mustHitSection) dad.dance(); @@ -4478,9 +4595,9 @@ class PlayState extends MusicBeatState // Conductor.changeBPM(SONG.bpm); // Dad doesnt interupt his own notes - if ((SONG.notes[Math.floor(curStep / 16)].mustHitSection || !dad.animation.curAnim.name.startsWith("sing")) && dad.curCharacter != 'gf') + if ((!dad.animation.curAnim.name.startsWith("sing")) && dad.curCharacter != 'gf') if ((curBeat % idleBeat == 0 || !idleToBeat) || dad.curCharacter == "spooky") - dad.dance(idleToBeat); + dad.dance(idleToBeat, SONG.notes[Math.floor(curStep / 16)].p1AltAnim); } // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); wiggleShit.update(Conductor.crochet); @@ -4514,7 +4631,7 @@ class PlayState extends MusicBeatState if (!boyfriend.animation.curAnim.name.startsWith("sing") && (curBeat % idleBeat == 0 || !idleToBeat)) { - boyfriend.playAnim('idle', idleToBeat); + boyfriend.playAnim('idle' + ((SONG.notes[Math.floor(curStep / 16)].p2AltAnim && boyfriend.animation.getByName('idle-alt') != null) ? '-alt' : ''), idleToBeat); } /*if (!dad.animation.curAnim.name.startsWith("sing")) diff --git a/source/PlayStateChangeables.hx b/source/PlayStateChangeables.hx index 17a430a..2e42501 100644 --- a/source/PlayStateChangeables.hx +++ b/source/PlayStateChangeables.hx @@ -5,4 +5,5 @@ class PlayStateChangeables public static var scrollSpeed:Float; public static var botPlay:Bool; public static var Optimize:Bool; + public static var zoom:Float; } \ No newline at end of file diff --git a/source/Ratings.hx b/source/Ratings.hx index 758f8bf..495efb9 100644 --- a/source/Ratings.hx +++ b/source/Ratings.hx @@ -106,11 +106,7 @@ class Ratings // IF LEMON SEES THIS I'M SORRY :( // trace('Hit Info\nDifference: ' + noteDiff + '\nZone: ' + Conductor.safeZoneOffset * 1.5 + "\nTS: " + customTimeScale + "\nLate: " + 155 * customTimeScale); - - if (FlxG.save.data.botplay && !PlayState.loadRep) - return "sick"; // FUNNY - var rating = checkRating(noteDiff,customTimeScale); @@ -119,7 +115,7 @@ class Ratings public static function checkRating(ms:Float, ts:Float) { - var rating = "sick"; + var rating = "shit"; if (ms <= 166 * ts && ms >= 135 * ts) rating = "shit"; if (ms < 135 * ts && ms >= 90 * ts) diff --git a/source/ResultsScreen.hx b/source/ResultsScreen.hx index be8371e..66b5569 100644 --- a/source/ResultsScreen.hx +++ b/source/ResultsScreen.hx @@ -83,7 +83,12 @@ class ResultsScreen extends FlxSubState 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)}\nHighest Combo: ${PlayState.highestCombo + 1}\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\n${!PlayState.loadRep ? "F1 - View replay\nF2 - Replay song" : ""} + var sicks = PlayState.isStoryMode ? PlayState.campaignSicks : PlayState.sicks; + var goods = PlayState.isStoryMode ? PlayState.campaignGoods : PlayState.goods; + var bads = PlayState.isStoryMode ? PlayState.campaignBads : PlayState.bads; + var shits = PlayState.isStoryMode ? PlayState.campaignShits : PlayState.shits; + + comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${sicks}\nGoods - ${goods}\nBads - ${bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\n${!PlayState.loadRep ? "F1 - View replay\nF2 - Replay song" : ""} '); comboText.size = 28; comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1); @@ -145,6 +150,11 @@ class ResultsScreen extends FlxSubState graph.addToHistory(diff, judge, obj3); } + if (sicks == Math.POSITIVE_INFINITY || sicks == Math.NaN) + sicks = 0; + if (goods == Math.POSITIVE_INFINITY || goods == Math.NaN) + goods = 0; + graph.update(); mean = HelperFunctions.truncateFloat(mean / PlayState.rep.replay.songNotes.length,2); @@ -208,6 +218,7 @@ class ResultsScreen extends FlxSubState } else FlxG.switchState(new FreeplayState()); + PlayState.instance.clean(); } if (FlxG.keys.justPressed.F1 && !PlayState.loadRep) @@ -272,12 +283,13 @@ class ResultsScreen extends FlxSubState music.fadeOut(0.3); if (PlayState.isSM) - PlayState.SONG = Song.loadFromJsonRAW(poop); + PlayState.SONG = Song.conversionChecks(Song.loadFromJsonRAW(poop)); else - PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName); + PlayState.SONG = Song.conversionChecks(Song.loadFromJson(poop, PlayState.rep.replay.songName)); PlayState.isStoryMode = false; PlayState.storyDifficulty = PlayState.rep.replay.songDiff; LoadingState.loadAndSwitchState(new PlayState()); + PlayState.instance.clean(); } if (FlxG.keys.justPressed.F2 && !PlayState.loadRep) @@ -314,6 +326,7 @@ class ResultsScreen extends FlxSubState PlayState.isStoryMode = false; PlayState.storyDifficulty = PlayState.storyDifficulty; LoadingState.loadAndSwitchState(new PlayState()); + PlayState.instance.clean(); } super.update(elapsed); diff --git a/source/Section.hx b/source/Section.hx index fcb574a..cd17e25 100644 --- a/source/Section.hx +++ b/source/Section.hx @@ -11,6 +11,8 @@ typedef SwagSection = var bpm:Float; var changeBPM:Bool; var altAnim:Bool; + var p1AltAnim:Bool; + var p2AltAnim:Bool; } class Section @@ -18,6 +20,8 @@ class Section public var startTime:Float = 0; public var endTime:Float = 0; public var sectionNotes:Array> = []; + public var changeBPM:Bool = false; + public var bpm:Float = 0; public var lengthInSteps:Int = 16; public var typeOfSection:Int = 0; diff --git a/source/SectionRender.hx b/source/SectionRender.hx index 67cafa8..de97b95 100644 --- a/source/SectionRender.hx +++ b/source/SectionRender.hx @@ -21,7 +21,7 @@ class SectionRender extends FlxSprite if (Math.floor(h) != h) h = GRID_SIZE; - if (FlxG.save.data.editor) + if (FlxG.save.data.editorBG) FlxGridOverlay.overlay(this,GRID_SIZE, Std.int(h), GRID_SIZE * 8,GRID_SIZE * Height); } diff --git a/source/Song.hx b/source/Song.hx index e3e3055..a0cbecb 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -113,10 +113,74 @@ class Song return parseJSONshit(rawJson); } + public static function conversionChecks(song:SwagSong):SwagSong + { + var ba = song.bpm; + + var index = 0; + trace("conversion stuff " + song.song + " " + song.notes.length); + var convertedStuff:Array = []; + + + if (song.eventObjects == null) + song.eventObjects = [new Song.Event("Init BPM",0,song.bpm,"BPM Change")]; + + for(i in song.eventObjects) + { + var name = Reflect.field(i,"name"); + var type = Reflect.field(i,"type"); + var pos = Reflect.field(i,"position"); + var value = Reflect.field(i,"value"); + + convertedStuff.push(new Song.Event(name,pos,value,type)); + } + + song.eventObjects = convertedStuff; + + for(i in song.notes) + { + var currentBeat = 4 * index; + + var currentSeg = TimingStruct.getTimingAtBeat(currentBeat); + + if (currentSeg == null) + continue; + + var beat:Float = currentSeg.startBeat + (currentBeat - currentSeg.startBeat); + + if (i.changeBPM && i.bpm != ba) + { + trace("converting changebpm for section " + index); + ba = i.bpm; + song.eventObjects.push(new Song.Event("FNF BPM Change " + index,beat,i.bpm,"BPM Change")); + } + + for(ii in i.sectionNotes) + { + if (ii[3] == null) + ii[3] = false; + } + + index++; + } + + return song; + + } + public static function parseJSONshit(rawJson:String):SwagSong { var swagShit:SwagSong = cast Json.parse(rawJson).song; swagShit.validScore = true; + + + // conversion stuff + for (section in swagShit.notes) + { + if (section.altAnim) + section.p1AltAnim = section.altAnim; + } + return swagShit; } } diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index ce2d49d..e046ed6 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -146,10 +146,7 @@ class StoryMenuState extends MusicBeatState grpWeekText.add(weekThing); weekThing.screenCenter(X); - if(FlxG.save.data.antialiasing) - { - weekThing.antialiasing = true; - } + weekThing.antialiasing = FlxG.save.data.antialiasing; // weekThing.updateHitbox(); // Needs an offset thingie @@ -161,10 +158,7 @@ class StoryMenuState extends MusicBeatState lock.animation.addByPrefix('lock', 'lock'); lock.animation.play('lock'); lock.ID = i; - if(FlxG.save.data.antialiasing) - { - lock.antialiasing = true; - } + lock.antialiasing = FlxG.save.data.antialiasing; grpLocks.add(lock); } } @@ -375,7 +369,7 @@ class StoryMenuState extends MusicBeatState PlayState.shits = 0; PlayState.goods = 0; PlayState.campaignMisses = 0; - PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]); + PlayState.SONG = Song.conversionChecks(Song.loadFromJson(poop, PlayState.storyPlaylist[0])); PlayState.storyWeek = curWeek; PlayState.campaignScore = 0; new FlxTimer().start(1, function(tmr:FlxTimer) diff --git a/source/TitleState.hx b/source/TitleState.hx index 1a42555..3c63121 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -77,6 +77,7 @@ class TitleState extends MusicBeatState #end + Highscore.load(); @@ -98,8 +99,10 @@ class TitleState extends MusicBeatState #if FREEPLAY FlxG.switchState(new FreeplayState()); + clean(); #elseif CHARTING FlxG.switchState(new ChartingState()); + clean(); #else #if !cpp new FlxTimer().start(1, function(tmr:FlxTimer) @@ -122,7 +125,7 @@ class TitleState extends MusicBeatState persistentUpdate = true; var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); - // bg.antialiasing = true; + // bg.antialiasing = FlxG.save.data.antialiasing; // bg.setGraphicSize(Std.int(bg.width * 0.6)); // bg.updateHitbox(); add(bg); @@ -134,10 +137,7 @@ class TitleState extends MusicBeatState logoBl = new FlxSprite(-150, -100); logoBl.frames = Paths.getSparrowAtlas('logoBumpin'); } - if(FlxG.save.data.antialiasing) - { - logoBl.antialiasing = true; - } + logoBl.antialiasing = FlxG.save.data.antialiasing; logoBl.animation.addByPrefix('bump', 'logo bumpin', 24, false); logoBl.updateHitbox(); // logoBl.screenCenter(); @@ -147,10 +147,7 @@ class TitleState extends MusicBeatState gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - if(FlxG.save.data.antialiasing) - { - gfDance.antialiasing = true; - } + gfDance.antialiasing = FlxG.save.data.antialiasing; add(gfDance); add(logoBl); @@ -158,10 +155,7 @@ class TitleState extends MusicBeatState titleText.frames = Paths.getSparrowAtlas('titleEnter'); titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24); titleText.animation.addByPrefix('press', "ENTER PRESSED", 24); - if(FlxG.save.data.antialiasing) - { - titleText.antialiasing = true; - } + titleText.antialiasing = FlxG.save.data.antialiasing; titleText.animation.play('idle'); titleText.updateHitbox(); // titleText.screenCenter(X); @@ -169,10 +163,7 @@ class TitleState extends MusicBeatState var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo')); logo.screenCenter(); - if(FlxG.save.data.antialiasing) - { - logo.antialiasing = true; - } + logo.antialiasing = FlxG.save.data.antialiasing; // add(logo); // FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG}); @@ -198,10 +189,7 @@ class TitleState extends MusicBeatState ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8)); ngSpr.updateHitbox(); ngSpr.screenCenter(X); - if(FlxG.save.data.antialiasing) - { - ngSpr.antialiasing = true; - } + ngSpr.antialiasing = FlxG.save.data.antialiasing; FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG}); @@ -319,16 +307,19 @@ class TitleState extends MusicBeatState OutdatedSubState.needVer = returnedData[0]; OutdatedSubState.currChanges = returnedData[1]; FlxG.switchState(new OutdatedSubState()); + clean(); } else { FlxG.switchState(new MainMenuState()); + clean(); } } http.onError = function (error) { trace('error: $error'); FlxG.switchState(new MainMenuState()); // fail but we go anyway + clean(); } http.request(); diff --git a/source/Waveform.hx b/source/Waveform.hx new file mode 100644 index 0000000..4a282bf --- /dev/null +++ b/source/Waveform.hx @@ -0,0 +1,88 @@ +import flixel.util.FlxColor; +import flixel.FlxG; +import openfl.geom.Rectangle; +import haxe.io.Bytes; +import lime.media.AudioBuffer; +import flixel.FlxSprite; + +class Waveform extends FlxSprite +{ + + /// referenced from https://github.com/gedehari/HaxeFlixel-Waveform-Rendering/blob/master/source/PlayState.hx + /// by gedehari + + public var buffer:AudioBuffer; + public var data:Bytes; + + public function new(x:Int,y:Int, audioPath:String, height:Int) + { + super(x,y); + + var path = StringTools.replace(audioPath, "songs:",""); + + trace("loading " + path); + + buffer = AudioBuffer.fromFile(path); + + trace("BPS: " + buffer.bitsPerSample + " - Channels: " + buffer.channels); + + makeGraphic(height,350,FlxColor.TRANSPARENT); + + angle = 90; + + data = buffer.data.toBytes(); + } + + public function drawWaveform() + { + var index:Int = 0; + var drawIndex:Int = 0; + var samplesPerCollumn:Int = 600; + + var min:Float = 0; + var max:Float = 0; + + while ((index * 4) < (data.length - 1)) + { + var byte:Int = data.getUInt16(index * 4); + + if (byte > 65535 / 2) + byte -= 65535; + + var sample:Float = (byte / 65535); + + if (sample > 0) + { + if (sample > max) + max = sample; + } + else if (sample < 0) + { + if (sample < min) + min = sample; + } + + if ((index % samplesPerCollumn) == 0) + { + // trace("min: " + min + ", max: " + max); + + if (drawIndex > 350) + { + drawIndex = 0; + } + + var pixelsMin:Float = Math.abs(min * 300); + var pixelsMax:Float = max * 300; + + pixels.fillRect(new Rectangle(drawIndex, x, 1, height), 0xFF000000); + pixels.fillRect(new Rectangle(drawIndex, y - pixelsMin, 1, pixelsMin + pixelsMax), FlxColor.WHITE); + drawIndex += 1; + + min = 0; + max = 0; + } + + index += 1; + } + } +} \ No newline at end of file diff --git a/source/smTools/SMFile.hx b/source/smTools/SMFile.hx index bb9ab6b..145ccb0 100644 --- a/source/smTools/SMFile.hx +++ b/source/smTools/SMFile.hx @@ -3,6 +3,7 @@ package smTools; import sys.io.File; import haxe.Exception; import lime.app.Application; +import Section.SwagSection; import haxe.Json; class SMFile @@ -29,6 +30,8 @@ class SMFile { _fileData = data; + + // Gather header data var headerData = ""; var inc = 0; @@ -41,9 +44,16 @@ class SMFile header = new SMHeader(headerData.split(';')); - if (!StringTools.contains(header.MUSIC,"ogg")) + if (_fileData.toString().split("#NOTES").length > 2) { - Application.current.window.alert("The music MUST be an OGG File.","SM File loading (" + header.TITLE + ")"); + Application.current.window.alert("The chart must only have 1 difficulty, this one has " + (_fileData.toString().split("#NOTES").length - 1),"SM File loading (" + header.TITLE + ")"); + isValid = false; + return; + } + + if (!StringTools.contains(header.MUSIC.toLowerCase(),"ogg")) + { + Application.current.window.alert("The music MUST be an OGG File, make sure the sm file has the right music property.","SM File loading (" + header.TITLE + ")"); isValid = false; return; } @@ -65,6 +75,8 @@ class SMFile measures = []; + + var measure = ""; trace(data[inc - 1]); @@ -168,6 +180,7 @@ class SMFile if (!isDouble) section.mustHitSection = true; + @:privateAccess for(i in 0...measure._measure.length - 1) @@ -184,6 +197,25 @@ class SMFile currentBeat = noteRow / 48; + if (currentBeat % 4 == 0) + { + // ok new section time + song.notes.push(section); + section = { + sectionNotes: [], + lengthInSteps: 16, + typeOfSection: 0, + startTime: 0.0, + endTime: 0.0, + mustHitSection: false, + bpm: header.getBPM(0), + changeBPM: false, + altAnim: false + }; + if (!isDouble) + section.mustHitSection = true; + } + var seg = TimingStruct.getTimingAtBeat(currentBeat); var timeInSec:Float = (seg.startTime + ((currentBeat - seg.startBeat) / (seg.bpm/60))); @@ -263,6 +295,35 @@ class SMFile { song.eventObjects = header.changeEvents; } + /*var newSections = []; + + for(s in 0...song.notes.length) // lets go ahead and make sure each note is actually in their own section haha + { + var sec:SwagSection = { + startTime: song.notes[s].startTime, + endTime: song.notes[s].endTime, + lengthInSteps: 16, + bpm: song.bpm, + changeBPM: false, + mustHitSection: song.notes[s].mustHitSection, + sectionNotes: [], + typeOfSection: 0, + altAnim: song.notes[s].altAnim + }; + for(i in song.notes) + { + for(ii in i.sectionNotes) + { + if (ii[0] >= sec.startTime && ii[0] < sec.endTime) + sec.sectionNotes.push(ii); + } + } + newSections.push(sec); + }*/ + // WE ALREADY DO THIS + + + //song.notes = newSections; // save da song diff --git a/source/smTools/SMHeader.hx b/source/smTools/SMHeader.hx index 950da4f..5f0db7b 100644 --- a/source/smTools/SMHeader.hx +++ b/source/smTools/SMHeader.hx @@ -108,4 +108,4 @@ class SMHeader } } } -#end +#end \ No newline at end of file diff --git a/version.downloadMe b/version.downloadMe index d49b667..93bbd4b 100644 --- a/version.downloadMe +++ b/version.downloadMe @@ -1,5 +1,8 @@ -1.6.1; -- Wiggle Shader for Lua Modcharts -- Optimized the editor -- Fixed HTML5 Delta Timings -- Steps actually exist now \ No newline at end of file +1.6.2; +- Added the ability to select and modify notes in the editor +- Added copy and paste (with ctrl z support) while selecting notes +- Optimized gameplay +- Optimized the chart editor (less lag on longer songs, and faster load times) +- Fixed stutter at the start of a song +- Fixed scroll speed changes so they work when more then one of them exist +- Modcharts now work on Linux! \ No newline at end of file