From 5dac29d3c4c9f2d6523aaae56b36ded5cb28cd90 Mon Sep 17 00:00:00 2001 From: /nick haya <74699483+The-SGPT@users.noreply.github.com> Date: Sat, 8 May 2021 15:09:29 +0800 Subject: [PATCH 1/4] fix shit --- source/PlayState.hx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index cca4e0b..6b44356 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -3269,12 +3269,13 @@ class PlayState extends MusicBeatState // Commented out until a reason to bring this back arises in the future /* if (SONG.notes[Math.floor(curStep / 16)].mustHitSection) dad.dance(); */ - + /* no because this is kinda dumb if(dad.animation.curAnim.name.startsWith('sing')) if(dad.animation.finished) dad.dance(); else dad.dance(); + */ } // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); wiggleShit.update(Conductor.crochet); @@ -3307,6 +3308,11 @@ class PlayState extends MusicBeatState { boyfriend.playAnim('idle'); } + + if (!dad.animation.curAnim.name.startsWith("sing")) + { + dad.dance(); + } if (curBeat % 8 == 7 && curSong == 'Bopeebo') { @@ -3381,4 +3387,4 @@ class PlayState extends MusicBeatState } var curLight:Int = 0; -} \ No newline at end of file +} From 03711f143bfdc8ba57d333c1e1400a433bbf9523 Mon Sep 17 00:00:00 2001 From: David Short <52360990+SomeoneSom@users.noreply.github.com> Date: Sat, 8 May 2021 10:07:42 -0700 Subject: [PATCH 2/4] fix typo its downscroll now instead of donwscroll --- ModCharts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ModCharts.md b/ModCharts.md index a49b69f..4f9f40e 100644 --- a/ModCharts.md +++ b/ModCharts.md @@ -16,7 +16,7 @@ Full Example ```lua function start (song) - print("Song: " .. song .. " @ " .. bpm .. " donwscroll: " .. downscroll) + print("Song: " .. song .. " @ " .. bpm .. " downscroll: " .. downscroll) end From 8a34832d45dea52f3fe3321964608f45db6a6c24 Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Sat, 8 May 2021 20:27:56 -0300 Subject: [PATCH 3/4] snap n clap --- assets/shared/sounds/CLAP.ogg | Bin 0 -> 7072 bytes assets/shared/sounds/SNAP.ogg | Bin 0 -> 7210 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/shared/sounds/CLAP.ogg create mode 100644 assets/shared/sounds/SNAP.ogg diff --git a/assets/shared/sounds/CLAP.ogg b/assets/shared/sounds/CLAP.ogg new file mode 100644 index 0000000000000000000000000000000000000000..4fe8979487196cc5c1c77a4cb5e355ffde4f24c6 GIT binary patch literal 7072 zcmbU^30PBC)-Pd85MzLV!A6>d00{=0uoV!TkOfH$2q7S=LlQtXTUm=*X99#65{wW7 z6A&Cgf&@hYfg;rzkX1yAqCmB^3JPxBwVh69{{A;XZD;=PoB6)~=H|Y0?mhRsd$xPd z+qHLZGz5oUHHXAC;AdU32<8kcdOuH`nQxqev(G}%FQ7qR!A;Kr*e>JFH_f;c2C&Kx zzB`Rp7%6{kxn^sOs9-%VbAQIxU3q))Iho>E6MH-t??t2g(&#i_JbCGa>`kXw0(x8U z=R~k}u{na^P(D7opfEM_edB_VE97&6jnEEGgn$!l1)vatkQ*%wMgWktD?FSN@fwa0 zhOmUeFpITwY+u3R*YdK zmGtq~1Kuaq0fNjSDH*9gwZhGs3D}EuSLZbaWJdU(##RymXVi*VfyX{oV}4 z6|p|v0;mvTgb~Uy0^=Z75ad`e9Kq#H5>7YdS$niMm0EjE;>-A6Pg;*h1U_j$r4D>b z?ww_>^X$FJd- zOlU_nhTDy~){VP)czhvNsz6Bo;q ze=HYa<*)kR4uA2Zv71E4!=NUYfZAnB3vpA+Qb3EDOnw#)r5aU&M{0-^%_(kMde*tj z6a5)y`uAPypLk^kIEO#T7{AvC7fW=Rp=RU(sGq<}598NsqydlMi~G(W`G&(?o`Jpfhz zsL6miF*jTxJmG%PpgUo*V9t!wGO#6Os&1^QZni#uhHF!=UxN$?5MbNBKsmT89+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$D!msX5Drr;ojqg~5#rtL~i_Br%c*RUPUq@ zc}GnE)}|@b_(m*q2TMy&^$P6~)nb-0IrnjPaPC7~#VxNz*8>upU-O1y4oRx<<6zmj zPkp!j559g@<*;v)P2?8|wx{3vuGuQx{N0OBl7`)uftM4xk?*WYIemKFqnYjR_6BA@ zC4Ic`rhqxHbRweS-eo6grskQX*f*CNs(ZK&$Cx(`Fvd>ozIVrUwCuK; Date: Sat, 8 May 2021 20:38:07 -0300 Subject: [PATCH 4/4] where the magic happens --- source/ChartingState.hx | 2740 ++++++++++++++++++++------------------- 1 file changed, 1391 insertions(+), 1349 deletions(-) diff --git a/source/ChartingState.hx b/source/ChartingState.hx index dd3a9f9..7d11cd2 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -1,1351 +1,1393 @@ -package; - -import flixel.addons.ui.FlxUIText; -import haxe.zip.Writer; -import Conductor.BPMChangeEvent; -import Section.SwagSection; -import Song.SwagSong; -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.addons.display.FlxGridOverlay; -import flixel.addons.ui.FlxInputText; -import flixel.addons.ui.FlxUI9SliceSprite; -import flixel.addons.ui.FlxUI; -import flixel.addons.ui.FlxUICheckBox; -import flixel.addons.ui.FlxUIDropDownMenu; -import flixel.addons.ui.FlxUIInputText; -import flixel.addons.ui.FlxUINumericStepper; -import flixel.addons.ui.FlxUITabMenu; -import flixel.addons.ui.FlxUITooltip.FlxUITooltipStyle; -import flixel.group.FlxGroup.FlxTypedGroup; -import flixel.group.FlxGroup; -import flixel.math.FlxMath; -import flixel.math.FlxPoint; -import flixel.system.FlxSound; -import flixel.text.FlxText; -import flixel.ui.FlxButton; -import flixel.ui.FlxSpriteButton; -import flixel.util.FlxColor; -import haxe.Json; -import lime.utils.Assets; -import openfl.events.Event; -import openfl.events.IOErrorEvent; -import openfl.events.IOErrorEvent; -import openfl.events.IOErrorEvent; -import openfl.media.Sound; -import openfl.net.FileReference; -import openfl.utils.ByteArray; - -using StringTools; - -class ChartingState extends MusicBeatState -{ - var _file:FileReference; - - var UI_box:FlxUITabMenu; - - /** - * Array of notes showing when each section STARTS in STEPS - * Usually rounded up?? - */ - var curSection:Int = 0; - - public static var lastSection:Int = 0; - - var bpmTxt:FlxText; - - var strumLine:FlxSprite; - var curSong:String = 'Dadbattle'; - var amountSteps:Int = 0; - var bullshitUI:FlxGroup; - var writingNotesText:FlxText; - var highlight:FlxSprite; - - var GRID_SIZE:Int = 40; - - var dummyArrow:FlxSprite; - - var curRenderedNotes:FlxTypedGroup; - var curRenderedSustains:FlxTypedGroup; - - var gridBG:FlxSprite; - - var _song:SwagSong; - - var typingShit:FlxInputText; - /* - * WILL BE THE CURRENT / LAST PLACED NOTE - **/ - var curSelectedNote:Array; - - var tempBpm:Int = 0; - var gridBlackLine:FlxSprite; - var vocals:FlxSound; - - var player2:Character = new Character(0,0, "dad"); - var player1:Boyfriend = new Boyfriend(0,0, "bf"); - - var leftIcon:HealthIcon; - var rightIcon:HealthIcon; - - private var lastNote:Note; - - override function create() - { - curSection = lastSection; - - if (PlayState.SONG != null) - _song = PlayState.SONG; - else - { - _song = { - song: 'Test', - notes: [], - bpm: 150, - needsVoices: true, - player1: 'bf', - player2: 'dad', - gfVersion: 'gf', - noteStyle: 'normal', - stage: 'stage', - speed: 1, - validScore: false - }; - } - - gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); - add(gridBG); - - gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); - add(gridBlackLine); - - curRenderedNotes = new FlxTypedGroup(); - curRenderedSustains = new FlxTypedGroup(); - - FlxG.mouse.visible = true; - FlxG.save.bind('funkin', 'ninjamuffin99'); - - tempBpm = _song.bpm; - - addSection(); - - // sections = _song.notes; - - updateGrid(); - - loadSong(_song.song); - Conductor.changeBPM(_song.bpm); - Conductor.mapBPMChanges(_song); - - leftIcon = new HealthIcon(_song.player1); - rightIcon = new HealthIcon(_song.player2); - leftIcon.scrollFactor.set(1, 1); - rightIcon.scrollFactor.set(1, 1); - - leftIcon.setGraphicSize(0, 45); - rightIcon.setGraphicSize(0, 45); - - add(leftIcon); - add(rightIcon); - - leftIcon.setPosition(0, -100); - rightIcon.setPosition(gridBG.width / 2, -100); - - bpmTxt = new FlxText(1000, 50, 0, "", 16); - bpmTxt.scrollFactor.set(); - add(bpmTxt); - - strumLine = new FlxSprite(0, 50).makeGraphic(Std.int(FlxG.width / 2), 4); - add(strumLine); - - dummyArrow = new FlxSprite().makeGraphic(GRID_SIZE, GRID_SIZE); - add(dummyArrow); - - var tabs = [ - {name: "Song", label: 'Song Data'}, - {name: "Section", label: 'Section Data'}, - {name: "Note", label: 'Note Data'}, - {name: "Assets", label: 'Assets'} - ]; - - UI_box = new FlxUITabMenu(null, tabs, true); - - UI_box.resize(300, 400); - UI_box.x = FlxG.width / 2; - UI_box.y = 20; - add(UI_box); - - addSongUI(); - addSectionUI(); - addNoteUI(); - - add(curRenderedNotes); - add(curRenderedSustains); - - super.create(); - } - - function addSongUI():Void - { - var UI_songTitle = new FlxUIInputText(10, 10, 70, _song.song, 8); - typingShit = UI_songTitle; - - var check_voices = new FlxUICheckBox(10, 25, null, null, "Has voice track", 100); - check_voices.checked = _song.needsVoices; - // _song.needsVoices = check_voices.checked; - check_voices.callback = function() - { - _song.needsVoices = check_voices.checked; - trace('CHECKED!'); - }; - - var check_mute_inst = new FlxUICheckBox(10, 200, null, null, "Mute Instrumental (in editor)", 100); - check_mute_inst.checked = false; - check_mute_inst.callback = function() - { - var vol:Float = 1; - - if (check_mute_inst.checked) - vol = 0; - - FlxG.sound.music.volume = vol; - }; - - var saveButton:FlxButton = new FlxButton(110, 8, "Save", function() - { - saveLevel(); - }); - - var reloadSong:FlxButton = new FlxButton(saveButton.x + saveButton.width + 10, saveButton.y, "Reload Audio", function() - { - loadSong(_song.song); - }); - - var reloadSongJson:FlxButton = new FlxButton(reloadSong.x, saveButton.y + 30, "Reload JSON", function() - { - loadJson(_song.song.toLowerCase()); - }); - - - var restart = new FlxButton(10,140,"Reset Chart", function() - { - for (ii in 0..._song.notes.length) - { - for (i in 0..._song.notes[ii].sectionNotes.length) - { - _song.notes[ii].sectionNotes = []; - } - } - resetSection(true); - }); - - var loadAutosaveBtn:FlxButton = new FlxButton(reloadSongJson.x, reloadSongJson.y + 30, 'load autosave', loadAutosave); - - var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 1); - stepperSpeed.value = _song.speed; - stepperSpeed.name = 'song_speed'; - - var stepperSpeedLabel = new FlxText(74,80,'Scroll Speed'); - - var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 0.1, 1, 1.0, 5000.0, 1); - stepperBPM.value = Conductor.bpm; - stepperBPM.name = 'song_bpm'; - - var stepperBPMLabel = new FlxText(74,65,'BPM'); - - var characters:Array = CoolUtil.coolTextFile(Paths.txt('characterList')); - var gfVersions:Array = CoolUtil.coolTextFile(Paths.txt('gfVersionList')); - var stages:Array = CoolUtil.coolTextFile(Paths.txt('stageList')); - var noteStyles:Array = CoolUtil.coolTextFile(Paths.txt('noteStyleList')); - - var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) - { - _song.player1 = characters[Std.parseInt(character)]; - }); - player1DropDown.selectedLabel = _song.player1; - - var player1Label = new FlxText(10,80,64,'Player 1'); - - var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) - { - _song.player2 = characters[Std.parseInt(character)]; - }); - player2DropDown.selectedLabel = _song.player2; - - var player2Label = new FlxText(140,80,64,'Player 2'); - - var gfVersionDropDown = new FlxUIDropDownMenu(10, 200, FlxUIDropDownMenu.makeStrIdLabelArray(gfVersions, true), function(gfVersion:String) - { - _song.gfVersion = gfVersions[Std.parseInt(gfVersion)]; - }); - gfVersionDropDown.selectedLabel = _song.gfVersion; - - var gfVersionLabel = new FlxText(10,180,64,'Girlfriend'); - - var stageDropDown = new FlxUIDropDownMenu(140, 200, FlxUIDropDownMenu.makeStrIdLabelArray(stages, true), function(stage:String) - { - _song.stage = stages[Std.parseInt(stage)]; - }); - stageDropDown.selectedLabel = _song.stage; - - var stageLabel = new FlxText(140,180,64,'Stage'); - - var noteStyleDropDown = new FlxUIDropDownMenu(10, 300, FlxUIDropDownMenu.makeStrIdLabelArray(noteStyles, true), function(noteStyle:String) - { - _song.noteStyle = noteStyles[Std.parseInt(noteStyle)]; - }); - noteStyleDropDown.selectedLabel = _song.noteStyle; - - var noteStyleLabel = new FlxText(10,280,64,'Note Skin'); - - var tab_group_song = new FlxUI(null, UI_box); - tab_group_song.name = "Song"; - tab_group_song.add(UI_songTitle); - tab_group_song.add(restart); - tab_group_song.add(check_voices); - tab_group_song.add(check_mute_inst); - tab_group_song.add(saveButton); - tab_group_song.add(reloadSong); - tab_group_song.add(reloadSongJson); - tab_group_song.add(loadAutosaveBtn); - tab_group_song.add(stepperBPM); - tab_group_song.add(stepperBPMLabel); - tab_group_song.add(stepperSpeed); - tab_group_song.add(stepperSpeedLabel); - - var tab_group_assets = new FlxUI(null, UI_box); - tab_group_assets.name = "Assets"; - tab_group_assets.add(noteStyleDropDown); - tab_group_assets.add(noteStyleLabel); - tab_group_assets.add(gfVersionDropDown); - tab_group_assets.add(gfVersionLabel); - tab_group_assets.add(stageDropDown); - tab_group_assets.add(stageLabel); - tab_group_assets.add(player1DropDown); - tab_group_assets.add(player2DropDown); - tab_group_assets.add(player1Label); - tab_group_assets.add(player2Label); - - UI_box.addGroup(tab_group_song); - UI_box.addGroup(tab_group_assets); - UI_box.scrollFactor.set(); - - FlxG.camera.follow(strumLine); - } - - var stepperLength:FlxUINumericStepper; - var check_mustHitSection:FlxUICheckBox; - var check_changeBPM:FlxUICheckBox; - var stepperSectionBPM:FlxUINumericStepper; - var check_altAnim:FlxUICheckBox; - - function addSectionUI():Void - { - var tab_group_section = new FlxUI(null, UI_box); - tab_group_section.name = 'Section'; - - stepperLength = new FlxUINumericStepper(10, 10, 4, 0, 0, 999, 0); - stepperLength.value = _song.notes[curSection].lengthInSteps; - stepperLength.name = "section_length"; - - var stepperLengthLabel = new FlxText(74,10,'Section Length (in steps)'); - - stepperSectionBPM = new FlxUINumericStepper(10, 80, 1, Conductor.bpm, 0, 999, 0); - stepperSectionBPM.value = Conductor.bpm; - stepperSectionBPM.name = 'section_bpm'; - - var stepperCopy:FlxUINumericStepper = new FlxUINumericStepper(110, 132, 1, 1, -999, 999, 0); - var stepperCopyLabel = new FlxText(174,132,'sections back'); - - var copyButton:FlxButton = new FlxButton(10, 130, "Copy last section", function() - { - copySection(Std.int(stepperCopy.value)); - }); - - var clearSectionButton:FlxButton = new FlxButton(10, 150, "Clear Section", clearSection); - - var swapSection:FlxButton = new FlxButton(10, 170, "Swap Section", function() - { - for (i in 0..._song.notes[curSection].sectionNotes.length) - { - var note = _song.notes[curSection].sectionNotes[i]; - note[1] = (note[1] + 4) % 8; - _song.notes[curSection].sectionNotes[i] = note; - updateGrid(); +package; + +import flixel.addons.ui.FlxUIText; +import haxe.zip.Writer; +import Conductor.BPMChangeEvent; +import Section.SwagSection; +import Song.SwagSong; +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.addons.display.FlxGridOverlay; +import flixel.addons.ui.FlxInputText; +import flixel.addons.ui.FlxUI9SliceSprite; +import flixel.addons.ui.FlxUI; +import flixel.addons.ui.FlxUICheckBox; +import flixel.addons.ui.FlxUIDropDownMenu; +import flixel.addons.ui.FlxUIInputText; +import flixel.addons.ui.FlxUINumericStepper; +import flixel.addons.ui.FlxUITabMenu; +import flixel.addons.ui.FlxUITooltip.FlxUITooltipStyle; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; +import flixel.math.FlxMath; +import flixel.math.FlxPoint; +import flixel.system.FlxSound; +import flixel.text.FlxText; +import flixel.ui.FlxButton; +import flixel.ui.FlxSpriteButton; +import flixel.util.FlxColor; +import haxe.Json; +import lime.utils.Assets; +import openfl.events.Event; +import openfl.events.IOErrorEvent; +import openfl.events.IOErrorEvent; +import openfl.events.IOErrorEvent; +import openfl.media.Sound; +import openfl.net.FileReference; +import openfl.utils.ByteArray; + +using StringTools; + +class ChartingState extends MusicBeatState +{ + var _file:FileReference; + + var UI_box:FlxUITabMenu; + + /** + * Array of notes showing when each section STARTS in STEPS + * Usually rounded up?? + */ + var curSection:Int = 0; + + public static var lastSection:Int = 0; + + var bpmTxt:FlxText; + + var strumLine:FlxSprite; + var curSong:String = 'Dadbattle'; + var amountSteps:Int = 0; + var bullshitUI:FlxGroup; + var writingNotesText:FlxText; + var highlight:FlxSprite; + + var GRID_SIZE:Int = 40; + + var dummyArrow:FlxSprite; + + var curRenderedNotes:FlxTypedGroup; + var curRenderedSustains:FlxTypedGroup; + + var gridBG:FlxSprite; + + var _song:SwagSong; + + var typingShit:FlxInputText; + /* + * WILL BE THE CURRENT / LAST PLACED NOTE + **/ + var curSelectedNote:Array; + + var tempBpm:Int = 0; + var gridBlackLine:FlxSprite; + var vocals:FlxSound; + + var player2:Character = new Character(0,0, "dad"); + var player1:Boyfriend = new Boyfriend(0,0, "bf"); + + var leftIcon:HealthIcon; + var rightIcon:HealthIcon; + + private var lastNote:Note; + var claps:Array = []; + + override function create() + { + curSection = lastSection; + + if (PlayState.SONG != null) + _song = PlayState.SONG; + else + { + _song = { + song: 'Test', + notes: [], + bpm: 150, + needsVoices: true, + player1: 'bf', + player2: 'dad', + gfVersion: 'gf', + noteStyle: 'normal', + stage: 'stage', + speed: 1, + validScore: false + }; + } + + gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); + add(gridBG); + + gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); + add(gridBlackLine); + + curRenderedNotes = new FlxTypedGroup(); + curRenderedSustains = new FlxTypedGroup(); + + FlxG.mouse.visible = true; + FlxG.save.bind('funkin', 'ninjamuffin99'); + + tempBpm = _song.bpm; + + addSection(); + + // sections = _song.notes; + + updateGrid(); + + loadSong(_song.song); + Conductor.changeBPM(_song.bpm); + Conductor.mapBPMChanges(_song); + + leftIcon = new HealthIcon(_song.player1); + rightIcon = new HealthIcon(_song.player2); + leftIcon.scrollFactor.set(1, 1); + rightIcon.scrollFactor.set(1, 1); + + leftIcon.setGraphicSize(0, 45); + rightIcon.setGraphicSize(0, 45); + + add(leftIcon); + add(rightIcon); + + leftIcon.setPosition(0, -100); + rightIcon.setPosition(gridBG.width / 2, -100); + + bpmTxt = new FlxText(1000, 50, 0, "", 16); + bpmTxt.scrollFactor.set(); + add(bpmTxt); + + strumLine = new FlxSprite(0, 50).makeGraphic(Std.int(FlxG.width / 2), 4); + add(strumLine); + + dummyArrow = new FlxSprite().makeGraphic(GRID_SIZE, GRID_SIZE); + add(dummyArrow); + + var tabs = [ + {name: "Song", label: 'Song Data'}, + {name: "Section", label: 'Section Data'}, + {name: "Note", label: 'Note Data'}, + {name: "Assets", label: 'Assets'} + ]; + + UI_box = new FlxUITabMenu(null, tabs, true); + + UI_box.resize(300, 400); + UI_box.x = FlxG.width / 2; + UI_box.y = 20; + add(UI_box); + + addSongUI(); + addSectionUI(); + addNoteUI(); + + add(curRenderedNotes); + add(curRenderedSustains); + + super.create(); + } + + function addSongUI():Void + { + var UI_songTitle = new FlxUIInputText(10, 10, 70, _song.song, 8); + typingShit = UI_songTitle; + + var check_voices = new FlxUICheckBox(10, 25, null, null, "Has voice track", 100); + check_voices.checked = _song.needsVoices; + // _song.needsVoices = check_voices.checked; + check_voices.callback = function() + { + _song.needsVoices = check_voices.checked; + trace('CHECKED!'); + }; + + var check_mute_inst = new FlxUICheckBox(10, 200, null, null, "Mute Instrumental (in editor)", 100); + check_mute_inst.checked = false; + check_mute_inst.callback = function() + { + var vol:Float = 1; + + if (check_mute_inst.checked) + vol = 0; + + FlxG.sound.music.volume = vol; + }; + + var saveButton:FlxButton = new FlxButton(110, 8, "Save", function() + { + saveLevel(); + }); + + var reloadSong:FlxButton = new FlxButton(saveButton.x + saveButton.width + 10, saveButton.y, "Reload Audio", function() + { + loadSong(_song.song); + }); + + var reloadSongJson:FlxButton = new FlxButton(reloadSong.x, saveButton.y + 30, "Reload JSON", function() + { + loadJson(_song.song.toLowerCase()); + }); + + + var restart = new FlxButton(10,140,"Reset Chart", function() + { + for (ii in 0..._song.notes.length) + { + for (i in 0..._song.notes[ii].sectionNotes.length) + { + _song.notes[ii].sectionNotes = []; + } + } + resetSection(true); + }); + + var loadAutosaveBtn:FlxButton = new FlxButton(reloadSongJson.x, reloadSongJson.y + 30, 'load autosave', loadAutosave); + var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 0.1, 1, 1.0, 5000.0, 1); + stepperBPM.value = Conductor.bpm; + stepperBPM.name = 'song_bpm'; + + var stepperBPMLabel = new FlxText(74,65,'BPM'); + + var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 1); + stepperSpeed.value = _song.speed; + stepperSpeed.name = 'song_speed'; + + var stepperSpeedLabel = new FlxText(74,80,'Scroll Speed'); + + var stepperVocalVol:FlxUINumericStepper = new FlxUINumericStepper(10, 95, 0.1, 1, 0.1, 10, 1); + stepperVocalVol.value = vocals.volume; + stepperVocalVol.name = 'song_vocalvol'; + + var stepperVocalVolLabel = new FlxText(74, 95, 'Vocal Volume'); + + var stepperSongVol:FlxUINumericStepper = new FlxUINumericStepper(10, 110, 0.1, 1, 0.1, 10, 1); + stepperSongVol.value = FlxG.sound.music.volume; + stepperSongVol.name = 'song_instvol'; + + var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume'); + + var characters:Array = CoolUtil.coolTextFile(Paths.txt('characterList')); + var gfVersions:Array = CoolUtil.coolTextFile(Paths.txt('gfVersionList')); + var stages:Array = CoolUtil.coolTextFile(Paths.txt('stageList')); + var noteStyles:Array = CoolUtil.coolTextFile(Paths.txt('noteStyleList')); + + var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) + { + _song.player1 = characters[Std.parseInt(character)]; + }); + player1DropDown.selectedLabel = _song.player1; + + var player1Label = new FlxText(10,80,64,'Player 1'); + + var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) + { + _song.player2 = characters[Std.parseInt(character)]; + }); + player2DropDown.selectedLabel = _song.player2; + + var player2Label = new FlxText(140,80,64,'Player 2'); + + var gfVersionDropDown = new FlxUIDropDownMenu(10, 200, FlxUIDropDownMenu.makeStrIdLabelArray(gfVersions, true), function(gfVersion:String) + { + _song.gfVersion = gfVersions[Std.parseInt(gfVersion)]; + }); + gfVersionDropDown.selectedLabel = _song.gfVersion; + + var gfVersionLabel = new FlxText(10,180,64,'Girlfriend'); + + var stageDropDown = new FlxUIDropDownMenu(140, 200, FlxUIDropDownMenu.makeStrIdLabelArray(stages, true), function(stage:String) + { + _song.stage = stages[Std.parseInt(stage)]; + }); + stageDropDown.selectedLabel = _song.stage; + + var stageLabel = new FlxText(140,180,64,'Stage'); + + var noteStyleDropDown = new FlxUIDropDownMenu(10, 300, FlxUIDropDownMenu.makeStrIdLabelArray(noteStyles, true), function(noteStyle:String) + { + _song.noteStyle = noteStyles[Std.parseInt(noteStyle)]; + }); + noteStyleDropDown.selectedLabel = _song.noteStyle; + + var noteStyleLabel = new FlxText(10,280,64,'Note Skin'); + + var tab_group_song = new FlxUI(null, UI_box); + tab_group_song.name = "Song"; + tab_group_song.add(UI_songTitle); + tab_group_song.add(restart); + tab_group_song.add(check_voices); + tab_group_song.add(check_mute_inst); + tab_group_song.add(saveButton); + tab_group_song.add(reloadSong); + tab_group_song.add(reloadSongJson); + tab_group_song.add(loadAutosaveBtn); + tab_group_song.add(stepperBPM); + tab_group_song.add(stepperBPMLabel); + tab_group_song.add(stepperSpeed); + tab_group_song.add(stepperSpeedLabel); + tab_group_song.add(stepperVocalVol); + tab_group_song.add(stepperVocalVolLabel); + tab_group_song.add(stepperSongVol); + tab_group_song.add(stepperSongVolLabel); + + var tab_group_assets = new FlxUI(null, UI_box); + tab_group_assets.name = "Assets"; + tab_group_assets.add(noteStyleDropDown); + tab_group_assets.add(noteStyleLabel); + tab_group_assets.add(gfVersionDropDown); + tab_group_assets.add(gfVersionLabel); + tab_group_assets.add(stageDropDown); + tab_group_assets.add(stageLabel); + tab_group_assets.add(player1DropDown); + tab_group_assets.add(player2DropDown); + tab_group_assets.add(player1Label); + tab_group_assets.add(player2Label); + + UI_box.addGroup(tab_group_song); + UI_box.addGroup(tab_group_assets); + UI_box.scrollFactor.set(); + + FlxG.camera.follow(strumLine); + } + + var stepperLength:FlxUINumericStepper; + var check_mustHitSection:FlxUICheckBox; + var check_changeBPM:FlxUICheckBox; + var stepperSectionBPM:FlxUINumericStepper; + var check_altAnim:FlxUICheckBox; + + function addSectionUI():Void + { + var tab_group_section = new FlxUI(null, UI_box); + tab_group_section.name = 'Section'; + + stepperLength = new FlxUINumericStepper(10, 10, 4, 0, 0, 999, 0); + stepperLength.value = _song.notes[curSection].lengthInSteps; + stepperLength.name = "section_length"; + + var stepperLengthLabel = new FlxText(74,10,'Section Length (in steps)'); + + stepperSectionBPM = new FlxUINumericStepper(10, 80, 1, Conductor.bpm, 0, 999, 0); + stepperSectionBPM.value = Conductor.bpm; + stepperSectionBPM.name = 'section_bpm'; + + var stepperCopy:FlxUINumericStepper = new FlxUINumericStepper(110, 132, 1, 1, -999, 999, 0); + var stepperCopyLabel = new FlxText(174,132,'sections back'); + + var copyButton:FlxButton = new FlxButton(10, 130, "Copy last section", function() + { + copySection(Std.int(stepperCopy.value)); + }); + + var clearSectionButton:FlxButton = new FlxButton(10, 150, "Clear Section", clearSection); + + var swapSection:FlxButton = new FlxButton(10, 170, "Swap Section", function() + { + for (i in 0..._song.notes[curSection].sectionNotes.length) + { + var note = _song.notes[curSection].sectionNotes[i]; + note[1] = (note[1] + 4) % 8; + _song.notes[curSection].sectionNotes[i] = note; + updateGrid(); + } + }); + check_mustHitSection = new FlxUICheckBox(10, 30, null, null, "Camera Points to P1?", 100); + check_mustHitSection.name = 'check_mustHit'; + check_mustHitSection.checked = true; + // _song.needsVoices = check_mustHit.checked; + + check_altAnim = new FlxUICheckBox(10, 400, null, null, "Alternate Animation", 100); + check_altAnim.name = 'check_altAnim'; + + check_changeBPM = new FlxUICheckBox(10, 60, null, null, 'Change BPM', 100); + check_changeBPM.name = 'check_changeBPM'; + + tab_group_section.add(stepperLength); + tab_group_section.add(stepperLengthLabel); + tab_group_section.add(stepperSectionBPM); + 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(check_changeBPM); + tab_group_section.add(copyButton); + tab_group_section.add(clearSectionButton); + tab_group_section.add(swapSection); + + UI_box.addGroup(tab_group_section); + } + + var stepperSusLength:FlxUINumericStepper; + + var tab_group_note:FlxUI; + + function addNoteUI():Void + { + tab_group_note = new FlxUI(null, UI_box); + tab_group_note.name = 'Note'; + + writingNotesText = new FlxUIText(20,100, 0, ""); + writingNotesText.setFormat("Arial",20,FlxColor.WHITE,FlxTextAlign.LEFT,FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + + stepperSusLength = new FlxUINumericStepper(10, 10, Conductor.stepCrochet / 2, 0, 0, Conductor.stepCrochet * _song.notes[curSection].lengthInSteps * 4); + stepperSusLength.value = 0; + stepperSusLength.name = 'note_susLength'; + + var stepperSusLengthLabel = new FlxText(74,10,'Note Sustain Length'); + + var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data'); + + tab_group_note.add(writingNotesText); + tab_group_note.add(stepperSusLength); + tab_group_note.add(stepperSusLengthLabel); + tab_group_note.add(applyLength); + + UI_box.addGroup(tab_group_note); + + /*player2 = new Character(0,gridBG.y, _song.player2); + player1 = new Boyfriend(player2.width * 0.2,gridBG.y + player2.height, _song.player1); + + player1.y = player1.y - player1.height; + + player2.setGraphicSize(Std.int(player2.width * 0.2)); + player1.setGraphicSize(Std.int(player1.width * 0.2)); + + UI_box.add(player1); + UI_box.add(player2);*/ + + } + + function loadSong(daSong:String):Void + { + if (FlxG.sound.music != null) + { + FlxG.sound.music.stop(); + // vocals.stop(); + } + + FlxG.sound.playMusic(Paths.inst(daSong), 0.6); + + // WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER + vocals = new FlxSound().loadEmbedded(Paths.voices(daSong)); + FlxG.sound.list.add(vocals); + + FlxG.sound.music.pause(); + vocals.pause(); + + FlxG.sound.music.onComplete = function() + { + vocals.pause(); + vocals.time = 0; + FlxG.sound.music.pause(); + FlxG.sound.music.time = 0; + changeSection(); + }; + } + + function generateUI():Void + { + while (bullshitUI.members.length > 0) + { + bullshitUI.remove(bullshitUI.members[0], true); + } + + // general shit + var title:FlxText = new FlxText(UI_box.x + 20, UI_box.y + 20, 0); + bullshitUI.add(title); + /* + var loopCheck = new FlxUICheckBox(UI_box.x + 10, UI_box.y + 50, null, null, "Loops", 100, ['loop check']); + loopCheck.checked = curNoteSelected.doesLoop; + tooltips.add(loopCheck, {title: 'Section looping', body: "Whether or not it's a simon says style section", style: tooltipType}); + bullshitUI.add(loopCheck); + + */ + } + + override function getEvent(id:String, sender:Dynamic, data:Dynamic, ?params:Array) + { + if (id == FlxUICheckBox.CLICK_EVENT) + { + var check:FlxUICheckBox = cast sender; + var label = check.getLabel().text; + switch (label) + { + case 'Camera Points to P1?': + _song.notes[curSection].mustHitSection = check.checked; + case 'Change BPM': + _song.notes[curSection].changeBPM = check.checked; + FlxG.log.add('changed bpm shit'); + case "Alt Animation": + _song.notes[curSection].altAnim = check.checked; + } + } + else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper)) + { + var nums:FlxUINumericStepper = cast sender; + var wname = nums.name; + FlxG.log.add(wname); + if (wname == 'section_length') + { + if (nums.value <= 4) + nums.value = 4; + _song.notes[curSection].lengthInSteps = Std.int(nums.value); + updateGrid(); + } + else if (wname == 'song_speed') + { + if (nums.value <= 0) + nums.value = 0; + _song.speed = nums.value; + } + else if (wname == 'song_bpm') + { + if (nums.value <= 0) + nums.value = 1; + tempBpm = Std.int(nums.value); + Conductor.mapBPMChanges(_song); + Conductor.changeBPM(Std.int(nums.value)); + } + else if (wname == 'note_susLength') + { + if (curSelectedNote == null) + return; + + if (nums.value <= 0) + nums.value = 0; + curSelectedNote[2] = nums.value; + updateGrid(); + } + else if (wname == 'section_bpm') + { + if (nums.value <= 0.1) + nums.value = 0.1; + _song.notes[curSection].bpm = Std.int(nums.value); + updateGrid(); + }else if (wname == 'song_vocalvol') + { + if (nums.value <= 0.1) + nums.value = 0.1; + vocals.volume = nums.value; + }else if (wname == 'song_instvol') + { + if (nums.value <= 0.1) + nums.value = 0.1; + FlxG.sound.music.volume = nums.value; + } + } + + // FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params); + } + + var updatedSection:Bool = false; + + /* this function got owned LOL + function lengthBpmBullshit():Float + { + if (_song.notes[curSection].changeBPM) + return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); + else + return _song.notes[curSection].lengthInSteps; + }*/ + function sectionStartTime():Float + { + var daBPM:Int = _song.bpm; + var daPos:Float = 0; + for (i in 0...curSection) + { + if (_song.notes[i].changeBPM) + { + daBPM = _song.notes[i].bpm; + } + daPos += 4 * (1000 * 60 / daBPM); + } + return daPos; + } + + var writingNotes:Bool = false; + + override function update(elapsed:Float) + { + updateHeads(); + + curStep = recalculateSteps(); + + if (FlxG.keys.justPressed.ALT && UI_box.selected_tab == 0) + { + writingNotes = !writingNotes; + } + + if (writingNotes) + writingNotesText.text = "WRITING NOTES"; + else + writingNotesText.text = ""; + + Conductor.songPosition = FlxG.sound.music.time; + _song.song = typingShit.text; + + var upP = controls.UP_P; + var rightP = controls.RIGHT_P; + var downP = controls.DOWN_P; + var leftP = controls.LEFT_P; + + var controlArray:Array = [leftP, downP, upP, rightP]; + + if ((upP || rightP || downP || leftP) && writingNotes) + { + for(i in 0...controlArray.length) + { + if (controlArray[i]) + { + for (n in 0..._song.notes[curSection].sectionNotes.length) + { + var note = _song.notes[curSection].sectionNotes[n]; + if (note == null) + continue; + if (note[0] == Conductor.songPosition && note[1] % 4 == i) + { + trace('GAMING'); + _song.notes[curSection].sectionNotes.remove(note); + } + } + trace('adding note'); + _song.notes[curSection].sectionNotes.push([Conductor.songPosition, i, 0]); + updateGrid(); + } + } + + } + + strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps)); + + curRenderedNotes.forEach(function(note:Note) + { + if (FlxG.sound.music.playing) + { + FlxG.overlap(strumLine, note, function(_, _) + { + if(!claps.contains(note)) + { + claps.push(note); + if(_song.notes[curSection].mustHitSection) FlxG.sound.play(Paths.sound('CLAP')); + else FlxG.sound.play(Paths.sound('SNAP')); + } + }); } }); - check_mustHitSection = new FlxUICheckBox(10, 30, null, null, "Camera Points to P1?", 100); - check_mustHitSection.name = 'check_mustHit'; - check_mustHitSection.checked = true; - // _song.needsVoices = check_mustHit.checked; - - check_altAnim = new FlxUICheckBox(10, 400, null, null, "Alternate Animation", 100); - check_altAnim.name = 'check_altAnim'; - - check_changeBPM = new FlxUICheckBox(10, 60, null, null, 'Change BPM', 100); - check_changeBPM.name = 'check_changeBPM'; - - tab_group_section.add(stepperLength); - tab_group_section.add(stepperLengthLabel); - tab_group_section.add(stepperSectionBPM); - 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(check_changeBPM); - tab_group_section.add(copyButton); - tab_group_section.add(clearSectionButton); - tab_group_section.add(swapSection); - - UI_box.addGroup(tab_group_section); - } - - var stepperSusLength:FlxUINumericStepper; - - var tab_group_note:FlxUI; - - function addNoteUI():Void - { - tab_group_note = new FlxUI(null, UI_box); - tab_group_note.name = 'Note'; - - writingNotesText = new FlxUIText(20,100, 0, ""); - writingNotesText.setFormat("Arial",20,FlxColor.WHITE,FlxTextAlign.LEFT,FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); - - stepperSusLength = new FlxUINumericStepper(10, 10, Conductor.stepCrochet / 2, 0, 0, Conductor.stepCrochet * _song.notes[curSection].lengthInSteps * 4); - stepperSusLength.value = 0; - stepperSusLength.name = 'note_susLength'; - - var stepperSusLengthLabel = new FlxText(74,10,'Note Sustain Length'); - - var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data'); - - tab_group_note.add(writingNotesText); - tab_group_note.add(stepperSusLength); - tab_group_note.add(stepperSusLengthLabel); - tab_group_note.add(applyLength); - - UI_box.addGroup(tab_group_note); - - /*player2 = new Character(0,gridBG.y, _song.player2); - player1 = new Boyfriend(player2.width * 0.2,gridBG.y + player2.height, _song.player1); - - player1.y = player1.y - player1.height; - - player2.setGraphicSize(Std.int(player2.width * 0.2)); - player1.setGraphicSize(Std.int(player1.width * 0.2)); - - UI_box.add(player1); - UI_box.add(player2);*/ - - } - - function loadSong(daSong:String):Void - { - if (FlxG.sound.music != null) - { - FlxG.sound.music.stop(); - // vocals.stop(); - } - - FlxG.sound.playMusic(Paths.inst(daSong), 0.6); - - // WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER - vocals = new FlxSound().loadEmbedded(Paths.voices(daSong)); - FlxG.sound.list.add(vocals); - - FlxG.sound.music.pause(); - vocals.pause(); - - FlxG.sound.music.onComplete = function() - { - vocals.pause(); - vocals.time = 0; - FlxG.sound.music.pause(); - FlxG.sound.music.time = 0; - changeSection(); - }; - } - - function generateUI():Void - { - while (bullshitUI.members.length > 0) - { - bullshitUI.remove(bullshitUI.members[0], true); - } - - // general shit - var title:FlxText = new FlxText(UI_box.x + 20, UI_box.y + 20, 0); - bullshitUI.add(title); - /* - var loopCheck = new FlxUICheckBox(UI_box.x + 10, UI_box.y + 50, null, null, "Loops", 100, ['loop check']); - loopCheck.checked = curNoteSelected.doesLoop; - tooltips.add(loopCheck, {title: 'Section looping', body: "Whether or not it's a simon says style section", style: tooltipType}); - bullshitUI.add(loopCheck); - - */ - } - - override function getEvent(id:String, sender:Dynamic, data:Dynamic, ?params:Array) - { - if (id == FlxUICheckBox.CLICK_EVENT) - { - var check:FlxUICheckBox = cast sender; - var label = check.getLabel().text; - switch (label) - { - case 'Camera Points to P1?': - _song.notes[curSection].mustHitSection = check.checked; - case 'Change BPM': - _song.notes[curSection].changeBPM = check.checked; - FlxG.log.add('changed bpm shit'); - case "Alt Animation": - _song.notes[curSection].altAnim = check.checked; - } - } - else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper)) - { - var nums:FlxUINumericStepper = cast sender; - var wname = nums.name; - FlxG.log.add(wname); - if (wname == 'section_length') - { - if (nums.value <= 4) - nums.value = 4; - _song.notes[curSection].lengthInSteps = Std.int(nums.value); - updateGrid(); - } - else if (wname == 'song_speed') - { - if (nums.value <= 0) - nums.value = 0; - _song.speed = nums.value; - } - else if (wname == 'song_bpm') - { - if (nums.value <= 0) - nums.value = 1; - tempBpm = Std.int(nums.value); - Conductor.mapBPMChanges(_song); - Conductor.changeBPM(Std.int(nums.value)); - } - else if (wname == 'note_susLength') - { - if (curSelectedNote == null) - return; - - if (nums.value <= 0) - nums.value = 0; - curSelectedNote[2] = nums.value; - updateGrid(); - } - else if (wname == 'section_bpm') - { - if (nums.value <= 0.1) - nums.value = 0.1; - _song.notes[curSection].bpm = Std.int(nums.value); - updateGrid(); - } - } - - // FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params); - } - - var updatedSection:Bool = false; - - /* this function got owned LOL - function lengthBpmBullshit():Float - { - if (_song.notes[curSection].changeBPM) - return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); - else - return _song.notes[curSection].lengthInSteps; - }*/ - function sectionStartTime():Float - { - var daBPM:Int = _song.bpm; - var daPos:Float = 0; - for (i in 0...curSection) - { - if (_song.notes[i].changeBPM) - { - daBPM = _song.notes[i].bpm; - } - daPos += 4 * (1000 * 60 / daBPM); - } - return daPos; - } - - var writingNotes:Bool = false; - - override function update(elapsed:Float) - { - updateHeads(); - - curStep = recalculateSteps(); - - if (FlxG.keys.justPressed.ALT && UI_box.selected_tab == 0) - { - writingNotes = !writingNotes; - } - - if (writingNotes) - writingNotesText.text = "WRITING NOTES"; - else - writingNotesText.text = ""; - - Conductor.songPosition = FlxG.sound.music.time; - _song.song = typingShit.text; - - var upP = controls.UP_P; - var rightP = controls.RIGHT_P; - var downP = controls.DOWN_P; - var leftP = controls.LEFT_P; - - var controlArray:Array = [leftP, downP, upP, rightP]; - - if ((upP || rightP || downP || leftP) && writingNotes) - { - for(i in 0...controlArray.length) - { - if (controlArray[i]) - { - for (n in 0..._song.notes[curSection].sectionNotes.length) - { - var note = _song.notes[curSection].sectionNotes[n]; - if (note == null) - continue; - if (note[0] == Conductor.songPosition && note[1] % 4 == i) - { - trace('GAMING'); - _song.notes[curSection].sectionNotes.remove(note); - } - } - trace('adding note'); - _song.notes[curSection].sectionNotes.push([Conductor.songPosition, i, 0]); - updateGrid(); - } - } - - } - - strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps)); - - - /*curRenderedNotes.forEach(function(note:Note) { - if (strumLine.overlaps(note) && strumLine.y == note.y) // yandere dev type shit - { - if (_song.notes[curSection].mustHitSection) - { - trace('must hit ' + Math.abs(note.noteData)); - if (note.noteData < 4) - { - switch (Math.abs(note.noteData)) - { - case 2: - player1.playAnim('singUP', true); - case 3: - player1.playAnim('singRIGHT', true); - case 1: - player1.playAnim('singDOWN', true); - case 0: - player1.playAnim('singLEFT', true); - } - } - if (note.noteData >= 4) - { - switch (note.noteData) - { - case 6: - player2.playAnim('singUP', true); - case 7: - player2.playAnim('singRIGHT', true); - case 5: - player2.playAnim('singDOWN', true); - case 4: - player2.playAnim('singLEFT', true); - } - } - } - else - { - trace('hit ' + Math.abs(note.noteData)); - if (note.noteData < 4) - { - switch (Math.abs(note.noteData)) - { - case 2: - player2.playAnim('singUP', true); - case 3: - player2.playAnim('singRIGHT', true); - case 1: - player2.playAnim('singDOWN', true); - case 0: - player2.playAnim('singLEFT', true); - } - } - if (note.noteData >= 4) - { - switch (note.noteData) - { - case 6: - player1.playAnim('singUP', true); - case 7: - player1.playAnim('singRIGHT', true); - case 5: - player1.playAnim('singDOWN', true); - case 4: - player1.playAnim('singLEFT', true); - } - } - } - } - });*/ - - if (curBeat % 4 == 0 && curStep >= 16 * (curSection + 1)) - { - trace(curStep); - trace((_song.notes[curSection].lengthInSteps) * (curSection + 1)); - trace('DUMBSHIT'); - - if (_song.notes[curSection + 1] == null) - { - addSection(); - } - - changeSection(curSection + 1, false); - } - - FlxG.watch.addQuick('daBeat', curBeat); - FlxG.watch.addQuick('daStep', curStep); - - if (FlxG.mouse.justPressed) - { - if (FlxG.mouse.overlaps(curRenderedNotes)) - { - curRenderedNotes.forEach(function(note:Note) - { - if (FlxG.mouse.overlaps(note)) - { - if (FlxG.keys.pressed.CONTROL) - { - selectNote(note); - } - else - { - deleteNote(note); - } - } - }); - } - else - { - if (FlxG.mouse.x > gridBG.x - && FlxG.mouse.x < gridBG.x + gridBG.width - && FlxG.mouse.y > gridBG.y - && FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps)) - { - FlxG.log.add('added note'); - addNote(); - } - } - } - - if (FlxG.mouse.x > gridBG.x - && FlxG.mouse.x < gridBG.x + gridBG.width - && FlxG.mouse.y > gridBG.y - && FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps)) - { - dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE; - if (FlxG.keys.pressed.SHIFT) - dummyArrow.y = FlxG.mouse.y; - else - dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE; - } - - if (FlxG.keys.justPressed.ENTER) - { - lastSection = curSection; - - PlayState.SONG = _song; - FlxG.sound.music.stop(); - vocals.stop(); - LoadingState.loadAndSwitchState(new PlayState()); - } - - if (FlxG.keys.justPressed.E) - { - changeNoteSustain(Conductor.stepCrochet); - } - if (FlxG.keys.justPressed.Q) - { - changeNoteSustain(-Conductor.stepCrochet); - } - - if (FlxG.keys.justPressed.TAB) - { - if (FlxG.keys.pressed.SHIFT) - { - UI_box.selected_tab -= 1; - if (UI_box.selected_tab < 0) - UI_box.selected_tab = 2; - } - else - { - UI_box.selected_tab += 1; - if (UI_box.selected_tab >= 3) - UI_box.selected_tab = 0; - } - } - - 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) - shiftThing = 4; - if (!writingNotes) - { - if (FlxG.keys.justPressed.RIGHT || FlxG.keys.justPressed.D) - changeSection(curSection + shiftThing); - if (FlxG.keys.justPressed.LEFT || FlxG.keys.justPressed.A) - changeSection(curSection - shiftThing); - } - if (FlxG.keys.justPressed.SPACE) - { - if (FlxG.sound.music.playing) - { - FlxG.sound.music.pause(); - vocals.pause(); - } - else - { - vocals.play(); - FlxG.sound.music.play(); - } - } - - if (FlxG.keys.justPressed.R) - { - if (FlxG.keys.pressed.SHIFT) - resetSection(true); - else - resetSection(); - } - - if (FlxG.mouse.wheel != 0) - { - FlxG.sound.music.pause(); - vocals.pause(); - - FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4); - vocals.time = FlxG.sound.music.time; - } - - if (!FlxG.keys.pressed.SHIFT) - { - if (FlxG.keys.pressed.W || FlxG.keys.pressed.S) - { - FlxG.sound.music.pause(); - vocals.pause(); - - var daTime:Float = 700 * FlxG.elapsed; - - if (FlxG.keys.pressed.W) - { - FlxG.sound.music.time -= daTime; - } - else - FlxG.sound.music.time += daTime; - - vocals.time = FlxG.sound.music.time; - } - } - else - { - if (FlxG.keys.justPressed.W || FlxG.keys.justPressed.S) - { - FlxG.sound.music.pause(); - vocals.pause(); - - var daTime:Float = Conductor.stepCrochet * 2; - - if (FlxG.keys.justPressed.W) - { - FlxG.sound.music.time -= daTime; - } - else - FlxG.sound.music.time += daTime; - - vocals.time = FlxG.sound.music.time; - } - } - } - - _song.bpm = tempBpm; - - /* if (FlxG.keys.justPressed.UP) - Conductor.changeBPM(Conductor.bpm + 1); - if (FlxG.keys.justPressed.DOWN) - Conductor.changeBPM(Conductor.bpm - 1); */ - - bpmTxt.text = bpmTxt.text = Std.string(FlxMath.roundDecimal(Conductor.songPosition / 1000, 2)) - + " / " - + Std.string(FlxMath.roundDecimal(FlxG.sound.music.length / 1000, 2)) - + "\nSection: " - + curSection - + "\nCurStep: " - + curStep; - super.update(elapsed); - } - - function changeNoteSustain(value:Float):Void - { - if (curSelectedNote != null) - { - if (curSelectedNote[2] != null) - { - curSelectedNote[2] += value; - curSelectedNote[2] = Math.max(curSelectedNote[2], 0); - } - } - - updateNoteUI(); - updateGrid(); - } - - override function beatHit() - { - trace('beat'); - - super.beatHit(); - if (!player2.animation.curAnim.name.startsWith("sing")) - { - player2.playAnim('idle'); - } - player1.dance(); - } - - function recalculateSteps():Int - { - var lastChange:BPMChangeEvent = { - stepTime: 0, - songTime: 0, - bpm: 0 - } - for (i in 0...Conductor.bpmChangeMap.length) - { - if (FlxG.sound.music.time > Conductor.bpmChangeMap[i].songTime) - lastChange = Conductor.bpmChangeMap[i]; - } - - curStep = lastChange.stepTime + Math.floor((FlxG.sound.music.time - lastChange.songTime) / Conductor.stepCrochet); - updateBeat(); - - return curStep; - } - - function resetSection(songBeginning:Bool = false):Void - { - updateGrid(); - - FlxG.sound.music.pause(); - vocals.pause(); - - // Basically old shit from changeSection??? - FlxG.sound.music.time = sectionStartTime(); - - if (songBeginning) - { - FlxG.sound.music.time = 0; - curSection = 0; - } - - vocals.time = FlxG.sound.music.time; - updateCurStep(); - - updateGrid(); - updateSectionUI(); - } - - function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void - { - trace('changing section' + sec); - - if (_song.notes[sec] != null) - { - trace('naw im not null'); - curSection = sec; - - updateGrid(); - - if (updateMusic) - { - FlxG.sound.music.pause(); - vocals.pause(); - - /*var daNum:Int = 0; - var daLength:Float = 0; - while (daNum <= sec) - { - daLength += lengthBpmBullshit(); - daNum++; - }*/ - - FlxG.sound.music.time = sectionStartTime(); - vocals.time = FlxG.sound.music.time; - updateCurStep(); - } - - updateGrid(); - updateSectionUI(); - } - else - trace('bro wtf I AM NULL'); - } - - function copySection(?sectionNum:Int = 1) - { - var daSec = FlxMath.maxInt(curSection, sectionNum); - - for (note in _song.notes[daSec - sectionNum].sectionNotes) - { - var strum = note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum); - - var copiedNote:Array = [strum, note[1], note[2]]; - _song.notes[daSec].sectionNotes.push(copiedNote); - } - - updateGrid(); - } - - function updateSectionUI():Void - { - var sec = _song.notes[curSection]; - - stepperLength.value = sec.lengthInSteps; - check_mustHitSection.checked = sec.mustHitSection; - check_altAnim.checked = sec.altAnim; - check_changeBPM.checked = sec.changeBPM; - stepperSectionBPM.value = sec.bpm; - } - - function updateHeads():Void - { - if (check_mustHitSection.checked) - { - leftIcon.animation.play(_song.player1); - rightIcon.animation.play(_song.player2); - } - else - { - leftIcon.animation.play(_song.player2); - rightIcon.animation.play(_song.player1); - } - } - - function updateNoteUI():Void - { - if (curSelectedNote != null) - stepperSusLength.value = curSelectedNote[2]; - } - - function updateGrid():Void - { - remove(gridBG); - gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * _song.notes[curSection].lengthInSteps); - add(gridBG); - - remove(gridBlackLine); - gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); - add(gridBlackLine); - - while (curRenderedNotes.members.length > 0) - { - curRenderedNotes.remove(curRenderedNotes.members[0], true); - } - - while (curRenderedSustains.members.length > 0) - { - curRenderedSustains.remove(curRenderedSustains.members[0], true); - } - - var sectionInfo:Array = _song.notes[curSection].sectionNotes; - - if (_song.notes[curSection].changeBPM && _song.notes[curSection].bpm > 0) - { - Conductor.changeBPM(_song.notes[curSection].bpm); - FlxG.log.add('CHANGED BPM!'); - } - else - { - // get last bpm - var daBPM:Int = _song.bpm; - for (i in 0...curSection) - if (_song.notes[i].changeBPM) - daBPM = _song.notes[i].bpm; - Conductor.changeBPM(daBPM); - } - - /* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE - for (sec in 0..._song.notes.length) - { - for (notesse in 0..._song.notes[sec].sectionNotes.length) - { - if (_song.notes[sec].sectionNotes[notesse][2] == null) - { - trace('SUS NULL'); - _song.notes[sec].sectionNotes[notesse][2] = 0; - } - } - } - */ - - for (i in sectionInfo) - { - var daNoteInfo = i[1]; - var daStrumTime = i[0]; - var daSus = i[2]; - - var note:Note = new Note(daStrumTime, daNoteInfo % 4); - note.sustainLength = daSus; - note.setGraphicSize(GRID_SIZE, GRID_SIZE); - note.updateHitbox(); - note.x = Math.floor(daNoteInfo * GRID_SIZE); - note.y = Math.floor(getYfromStrum((daStrumTime - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps))); - - if (curSelectedNote != null) - if (curSelectedNote[0] == note.strumTime) - lastNote = note; - - curRenderedNotes.add(note); - - if (daSus > 0) - { - var sustainVis:FlxSprite = new FlxSprite(note.x + (GRID_SIZE / 2), - note.y + GRID_SIZE).makeGraphic(8, Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * _song.notes[curSection].lengthInSteps, 0, gridBG.height))); - curRenderedSustains.add(sustainVis); - } - } - } - - private function addSection(lengthInSteps:Int = 16):Void - { - var sec:SwagSection = { - lengthInSteps: lengthInSteps, - bpm: _song.bpm, - changeBPM: false, - mustHitSection: true, - sectionNotes: [], - typeOfSection: 0, - altAnim: false - }; - - _song.notes.push(sec); - } - - function selectNote(note:Note):Void - { - var swagNum:Int = 0; - - for (i in _song.notes[curSection].sectionNotes) - { - if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData) - { - curSelectedNote = _song.notes[curSection].sectionNotes[swagNum]; - } - - swagNum += 1; - } - - updateGrid(); - updateNoteUI(); - } - - - function deleteNote(note:Note):Void - { - lastNote = note; - for (i in _song.notes[curSection].sectionNotes) - { - if (i[0] == note.strumTime && i[1] % 4 == note.noteData) - { - _song.notes[curSection].sectionNotes.remove(i); - } - } - - updateGrid(); - } - - function clearSection():Void - { - _song.notes[curSection].sectionNotes = []; - - updateGrid(); - } - - function clearSong():Void - { - for (daSection in 0..._song.notes.length) - { - _song.notes[daSection].sectionNotes = []; - } - - updateGrid(); - } - - private function addNote(?n:Note):Void - { - var noteStrum = getStrumTime(dummyArrow.y) + sectionStartTime(); - var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE); - var noteSus = 0; - - if (n != null) - _song.notes[curSection].sectionNotes.push([n.strumTime, n.noteData, n.sustainLength]); - else - _song.notes[curSection].sectionNotes.push([noteStrum, noteData, noteSus]); - - var thingy = _song.notes[curSection].sectionNotes[_song.notes[curSection].sectionNotes.length - 1]; - - curSelectedNote = thingy; - - updateGrid(); - updateNoteUI(); - - autosaveSong(); - } - - function getStrumTime(yPos:Float):Float - { - return FlxMath.remapToRange(yPos, gridBG.y, gridBG.y + gridBG.height, 0, 16 * Conductor.stepCrochet); - } - - function getYfromStrum(strumTime:Float):Float - { - return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height); - } - - /* - function calculateSectionLengths(?sec:SwagSection):Int - { - var daLength:Int = 0; - - for (i in _song.notes) - { - var swagLength = i.lengthInSteps; - - if (i.typeOfSection == Section.COPYCAT) - swagLength * 2; - - daLength += swagLength; - - if (sec != null && sec == i) - { - trace('swag loop??'); - break; - } - } - - return daLength; - }*/ - private var daSpacing:Float = 0.3; - - function loadLevel():Void - { - trace(_song.notes); - } - - function getNotes():Array - { - var noteData:Array = []; - - for (i in _song.notes) - { - noteData.push(i.sectionNotes); - } - - return noteData; - } - - function loadJson(song:String):Void - { - PlayState.SONG = Song.loadFromJson(song.toLowerCase(), song.toLowerCase()); - LoadingState.loadAndSwitchState(new ChartingState()); - } - - function loadAutosave():Void - { - PlayState.SONG = Song.parseJSONshit(FlxG.save.data.autosave); - LoadingState.loadAndSwitchState(new ChartingState()); - } - - function autosaveSong():Void - { - FlxG.save.data.autosave = Json.stringify({ - "song": _song - }); - FlxG.save.flush(); - } - - private function saveLevel() - { - var json = { - "song": _song - }; - - var data:String = Json.stringify(json); - - if ((data != null) && (data.length > 0)) - { - _file = new FileReference(); - _file.addEventListener(Event.COMPLETE, onSaveComplete); - _file.addEventListener(Event.CANCEL, onSaveCancel); - _file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError); - _file.save(data.trim(), _song.song.toLowerCase() + ".json"); - } - } - - function onSaveComplete(_):Void - { - _file.removeEventListener(Event.COMPLETE, onSaveComplete); - _file.removeEventListener(Event.CANCEL, onSaveCancel); - _file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError); - _file = null; - FlxG.log.notice("Successfully saved LEVEL DATA."); - } - - /** - * Called when the save file dialog is cancelled. - */ - function onSaveCancel(_):Void - { - _file.removeEventListener(Event.COMPLETE, onSaveComplete); - _file.removeEventListener(Event.CANCEL, onSaveCancel); - _file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError); - _file = null; - } - - /** - * Called if there is an error while saving the gameplay recording. - */ - function onSaveError(_):Void - { - _file.removeEventListener(Event.COMPLETE, onSaveComplete); - _file.removeEventListener(Event.CANCEL, onSaveCancel); - _file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError); - _file = null; - FlxG.log.error("Problem saving Level data"); - } -} + + /*curRenderedNotes.forEach(function(note:Note) { + if (strumLine.overlaps(note) && strumLine.y == note.y) // yandere dev type shit + { + if (_song.notes[curSection].mustHitSection) + { + trace('must hit ' + Math.abs(note.noteData)); + if (note.noteData < 4) + { + switch (Math.abs(note.noteData)) + { + case 2: + player1.playAnim('singUP', true); + case 3: + player1.playAnim('singRIGHT', true); + case 1: + player1.playAnim('singDOWN', true); + case 0: + player1.playAnim('singLEFT', true); + } + } + if (note.noteData >= 4) + { + switch (note.noteData) + { + case 6: + player2.playAnim('singUP', true); + case 7: + player2.playAnim('singRIGHT', true); + case 5: + player2.playAnim('singDOWN', true); + case 4: + player2.playAnim('singLEFT', true); + } + } + } + else + { + trace('hit ' + Math.abs(note.noteData)); + if (note.noteData < 4) + { + switch (Math.abs(note.noteData)) + { + case 2: + player2.playAnim('singUP', true); + case 3: + player2.playAnim('singRIGHT', true); + case 1: + player2.playAnim('singDOWN', true); + case 0: + player2.playAnim('singLEFT', true); + } + } + if (note.noteData >= 4) + { + switch (note.noteData) + { + case 6: + player1.playAnim('singUP', true); + case 7: + player1.playAnim('singRIGHT', true); + case 5: + player1.playAnim('singDOWN', true); + case 4: + player1.playAnim('singLEFT', true); + } + } + } + } + });*/ + + if (curBeat % 4 == 0 && curStep >= 16 * (curSection + 1)) + { + trace(curStep); + trace((_song.notes[curSection].lengthInSteps) * (curSection + 1)); + trace('DUMBSHIT'); + + if (_song.notes[curSection + 1] == null) + { + addSection(); + } + + changeSection(curSection + 1, false); + } + + FlxG.watch.addQuick('daBeat', curBeat); + FlxG.watch.addQuick('daStep', curStep); + + if (FlxG.mouse.justPressed) + { + if (FlxG.mouse.overlaps(curRenderedNotes)) + { + curRenderedNotes.forEach(function(note:Note) + { + if (FlxG.mouse.overlaps(note)) + { + if (FlxG.keys.pressed.CONTROL) + { + selectNote(note); + } + else + { + deleteNote(note); + } + } + }); + } + else + { + if (FlxG.mouse.x > gridBG.x + && FlxG.mouse.x < gridBG.x + gridBG.width + && FlxG.mouse.y > gridBG.y + && FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps)) + { + FlxG.log.add('added note'); + addNote(); + } + } + } + + if (FlxG.mouse.x > gridBG.x + && FlxG.mouse.x < gridBG.x + gridBG.width + && FlxG.mouse.y > gridBG.y + && FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps)) + { + dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE; + if (FlxG.keys.pressed.SHIFT) + dummyArrow.y = FlxG.mouse.y; + else + dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE; + } + + if (FlxG.keys.justPressed.ENTER) + { + lastSection = curSection; + + PlayState.SONG = _song; + FlxG.sound.music.stop(); + vocals.stop(); + LoadingState.loadAndSwitchState(new PlayState()); + } + + if (FlxG.keys.justPressed.E) + { + changeNoteSustain(Conductor.stepCrochet); + } + if (FlxG.keys.justPressed.Q) + { + changeNoteSustain(-Conductor.stepCrochet); + } + + if (FlxG.keys.justPressed.TAB) + { + if (FlxG.keys.pressed.SHIFT) + { + UI_box.selected_tab -= 1; + if (UI_box.selected_tab < 0) + UI_box.selected_tab = 2; + } + else + { + UI_box.selected_tab += 1; + if (UI_box.selected_tab >= 3) + UI_box.selected_tab = 0; + } + } + + 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) + shiftThing = 4; + if (!writingNotes) + { + if (FlxG.keys.justPressed.RIGHT || FlxG.keys.justPressed.D) + changeSection(curSection + shiftThing); + if (FlxG.keys.justPressed.LEFT || FlxG.keys.justPressed.A) + changeSection(curSection - shiftThing); + } + if (FlxG.keys.justPressed.SPACE) + { + if (FlxG.sound.music.playing) + { + FlxG.sound.music.pause(); + vocals.pause(); + claps.splice(0, claps.length); + } + else + { + vocals.play(); + FlxG.sound.music.play(); + } + } + + if (FlxG.keys.justPressed.R) + { + if (FlxG.keys.pressed.SHIFT) + resetSection(true); + else + resetSection(); + } + + if (FlxG.mouse.wheel != 0) + { + FlxG.sound.music.pause(); + vocals.pause(); + + FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4); + vocals.time = FlxG.sound.music.time; + } + + if (!FlxG.keys.pressed.SHIFT) + { + if (FlxG.keys.pressed.W || FlxG.keys.pressed.S) + { + FlxG.sound.music.pause(); + vocals.pause(); + + var daTime:Float = 700 * FlxG.elapsed; + + if (FlxG.keys.pressed.W) + { + FlxG.sound.music.time -= daTime; + } + else + FlxG.sound.music.time += daTime; + + vocals.time = FlxG.sound.music.time; + } + } + else + { + if (FlxG.keys.justPressed.W || FlxG.keys.justPressed.S) + { + FlxG.sound.music.pause(); + vocals.pause(); + + var daTime:Float = Conductor.stepCrochet * 2; + + if (FlxG.keys.justPressed.W) + { + FlxG.sound.music.time -= daTime; + } + else + FlxG.sound.music.time += daTime; + + vocals.time = FlxG.sound.music.time; + } + } + } + + _song.bpm = tempBpm; + + /* if (FlxG.keys.justPressed.UP) + Conductor.changeBPM(Conductor.bpm + 1); + if (FlxG.keys.justPressed.DOWN) + Conductor.changeBPM(Conductor.bpm - 1); */ + + bpmTxt.text = bpmTxt.text = Std.string(FlxMath.roundDecimal(Conductor.songPosition / 1000, 2)) + + " / " + + Std.string(FlxMath.roundDecimal(FlxG.sound.music.length / 1000, 2)) + + "\nSection: " + + curSection + + "\nCurStep: " + + curStep; + super.update(elapsed); + } + + function changeNoteSustain(value:Float):Void + { + if (curSelectedNote != null) + { + if (curSelectedNote[2] != null) + { + curSelectedNote[2] += value; + curSelectedNote[2] = Math.max(curSelectedNote[2], 0); + } + } + + updateNoteUI(); + updateGrid(); + } + + override function beatHit() + { + trace('beat'); + + super.beatHit(); + if (!player2.animation.curAnim.name.startsWith("sing")) + { + player2.playAnim('idle'); + } + player1.dance(); + } + + function recalculateSteps():Int + { + var lastChange:BPMChangeEvent = { + stepTime: 0, + songTime: 0, + bpm: 0 + } + for (i in 0...Conductor.bpmChangeMap.length) + { + if (FlxG.sound.music.time > Conductor.bpmChangeMap[i].songTime) + lastChange = Conductor.bpmChangeMap[i]; + } + + curStep = lastChange.stepTime + Math.floor((FlxG.sound.music.time - lastChange.songTime) / Conductor.stepCrochet); + updateBeat(); + + return curStep; + } + + function resetSection(songBeginning:Bool = false):Void + { + updateGrid(); + + FlxG.sound.music.pause(); + vocals.pause(); + + // Basically old shit from changeSection??? + FlxG.sound.music.time = sectionStartTime(); + + if (songBeginning) + { + FlxG.sound.music.time = 0; + curSection = 0; + } + + vocals.time = FlxG.sound.music.time; + updateCurStep(); + + updateGrid(); + updateSectionUI(); + } + + function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void + { + trace('changing section' + sec); + + if (_song.notes[sec] != null) + { + trace('naw im not null'); + curSection = sec; + + updateGrid(); + + if (updateMusic) + { + FlxG.sound.music.pause(); + vocals.pause(); + + /*var daNum:Int = 0; + var daLength:Float = 0; + while (daNum <= sec) + { + daLength += lengthBpmBullshit(); + daNum++; + }*/ + + FlxG.sound.music.time = sectionStartTime(); + vocals.time = FlxG.sound.music.time; + updateCurStep(); + } + + updateGrid(); + updateSectionUI(); + } + else + trace('bro wtf I AM NULL'); + } + + function copySection(?sectionNum:Int = 1) + { + var daSec = FlxMath.maxInt(curSection, sectionNum); + + for (note in _song.notes[daSec - sectionNum].sectionNotes) + { + var strum = note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum); + + var copiedNote:Array = [strum, note[1], note[2]]; + _song.notes[daSec].sectionNotes.push(copiedNote); + } + + updateGrid(); + } + + function updateSectionUI():Void + { + var sec = _song.notes[curSection]; + + stepperLength.value = sec.lengthInSteps; + check_mustHitSection.checked = sec.mustHitSection; + check_altAnim.checked = sec.altAnim; + check_changeBPM.checked = sec.changeBPM; + stepperSectionBPM.value = sec.bpm; + } + + function updateHeads():Void + { + if (check_mustHitSection.checked) + { + leftIcon.animation.play(_song.player1); + rightIcon.animation.play(_song.player2); + } + else + { + leftIcon.animation.play(_song.player2); + rightIcon.animation.play(_song.player1); + } + } + + function updateNoteUI():Void + { + if (curSelectedNote != null) + stepperSusLength.value = curSelectedNote[2]; + } + + function updateGrid():Void + { + remove(gridBG); + gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * _song.notes[curSection].lengthInSteps); + add(gridBG); + + remove(gridBlackLine); + gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); + add(gridBlackLine); + + while (curRenderedNotes.members.length > 0) + { + curRenderedNotes.remove(curRenderedNotes.members[0], true); + } + + while (curRenderedSustains.members.length > 0) + { + curRenderedSustains.remove(curRenderedSustains.members[0], true); + } + + var sectionInfo:Array = _song.notes[curSection].sectionNotes; + + if (_song.notes[curSection].changeBPM && _song.notes[curSection].bpm > 0) + { + Conductor.changeBPM(_song.notes[curSection].bpm); + FlxG.log.add('CHANGED BPM!'); + } + else + { + // get last bpm + var daBPM:Int = _song.bpm; + for (i in 0...curSection) + if (_song.notes[i].changeBPM) + daBPM = _song.notes[i].bpm; + Conductor.changeBPM(daBPM); + } + + /* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE + for (sec in 0..._song.notes.length) + { + for (notesse in 0..._song.notes[sec].sectionNotes.length) + { + if (_song.notes[sec].sectionNotes[notesse][2] == null) + { + trace('SUS NULL'); + _song.notes[sec].sectionNotes[notesse][2] = 0; + } + } + } + */ + + for (i in sectionInfo) + { + var daNoteInfo = i[1]; + var daStrumTime = i[0]; + var daSus = i[2]; + + var note:Note = new Note(daStrumTime, daNoteInfo % 4); + note.sustainLength = daSus; + note.setGraphicSize(GRID_SIZE, GRID_SIZE); + note.updateHitbox(); + note.x = Math.floor(daNoteInfo * GRID_SIZE); + note.y = Math.floor(getYfromStrum((daStrumTime - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps))); + + if (curSelectedNote != null) + if (curSelectedNote[0] == note.strumTime) + lastNote = note; + + curRenderedNotes.add(note); + + if (daSus > 0) + { + var sustainVis:FlxSprite = new FlxSprite(note.x + (GRID_SIZE / 2), + note.y + GRID_SIZE).makeGraphic(8, Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * _song.notes[curSection].lengthInSteps, 0, gridBG.height))); + curRenderedSustains.add(sustainVis); + } + } + } + + private function addSection(lengthInSteps:Int = 16):Void + { + var sec:SwagSection = { + lengthInSteps: lengthInSteps, + bpm: _song.bpm, + changeBPM: false, + mustHitSection: true, + sectionNotes: [], + typeOfSection: 0, + altAnim: false + }; + + _song.notes.push(sec); + } + + function selectNote(note:Note):Void + { + var swagNum:Int = 0; + + for (i in _song.notes[curSection].sectionNotes) + { + if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData) + { + curSelectedNote = _song.notes[curSection].sectionNotes[swagNum]; + } + + swagNum += 1; + } + + updateGrid(); + updateNoteUI(); + } + + + function deleteNote(note:Note):Void + { + lastNote = note; + for (i in _song.notes[curSection].sectionNotes) + { + if (i[0] == note.strumTime && i[1] % 4 == note.noteData) + { + _song.notes[curSection].sectionNotes.remove(i); + } + } + + updateGrid(); + } + + function clearSection():Void + { + _song.notes[curSection].sectionNotes = []; + + updateGrid(); + } + + function clearSong():Void + { + for (daSection in 0..._song.notes.length) + { + _song.notes[daSection].sectionNotes = []; + } + + updateGrid(); + } + + private function addNote(?n:Note):Void + { + var noteStrum = getStrumTime(dummyArrow.y) + sectionStartTime(); + var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE); + var noteSus = 0; + + if (n != null) + _song.notes[curSection].sectionNotes.push([n.strumTime, n.noteData, n.sustainLength]); + else + _song.notes[curSection].sectionNotes.push([noteStrum, noteData, noteSus]); + + var thingy = _song.notes[curSection].sectionNotes[_song.notes[curSection].sectionNotes.length - 1]; + + curSelectedNote = thingy; + + updateGrid(); + updateNoteUI(); + + autosaveSong(); + } + + function getStrumTime(yPos:Float):Float + { + return FlxMath.remapToRange(yPos, gridBG.y, gridBG.y + gridBG.height, 0, 16 * Conductor.stepCrochet); + } + + function getYfromStrum(strumTime:Float):Float + { + return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height); + } + + /* + function calculateSectionLengths(?sec:SwagSection):Int + { + var daLength:Int = 0; + + for (i in _song.notes) + { + var swagLength = i.lengthInSteps; + + if (i.typeOfSection == Section.COPYCAT) + swagLength * 2; + + daLength += swagLength; + + if (sec != null && sec == i) + { + trace('swag loop??'); + break; + } + } + + return daLength; + }*/ + private var daSpacing:Float = 0.3; + + function loadLevel():Void + { + trace(_song.notes); + } + + function getNotes():Array + { + var noteData:Array = []; + + for (i in _song.notes) + { + noteData.push(i.sectionNotes); + } + + return noteData; + } + + function loadJson(song:String):Void + { + PlayState.SONG = Song.loadFromJson(song.toLowerCase(), song.toLowerCase()); + LoadingState.loadAndSwitchState(new ChartingState()); + } + + function loadAutosave():Void + { + PlayState.SONG = Song.parseJSONshit(FlxG.save.data.autosave); + LoadingState.loadAndSwitchState(new ChartingState()); + } + + function autosaveSong():Void + { + FlxG.save.data.autosave = Json.stringify({ + "song": _song + }); + FlxG.save.flush(); + } + + private function saveLevel() + { + var json = { + "song": _song + }; + + var data:String = Json.stringify(json); + + if ((data != null) && (data.length > 0)) + { + _file = new FileReference(); + _file.addEventListener(Event.COMPLETE, onSaveComplete); + _file.addEventListener(Event.CANCEL, onSaveCancel); + _file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError); + _file.save(data.trim(), _song.song.toLowerCase() + ".json"); + } + } + + function onSaveComplete(_):Void + { + _file.removeEventListener(Event.COMPLETE, onSaveComplete); + _file.removeEventListener(Event.CANCEL, onSaveCancel); + _file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError); + _file = null; + FlxG.log.notice("Successfully saved LEVEL DATA."); + } + + /** + * Called when the save file dialog is cancelled. + */ + function onSaveCancel(_):Void + { + _file.removeEventListener(Event.COMPLETE, onSaveComplete); + _file.removeEventListener(Event.CANCEL, onSaveCancel); + _file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError); + _file = null; + } + + /** + * Called if there is an error while saving the gameplay recording. + */ + function onSaveError(_):Void + { + _file.removeEventListener(Event.COMPLETE, onSaveComplete); + _file.removeEventListener(Event.CANCEL, onSaveCancel); + _file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError); + _file = null; + FlxG.log.error("Problem saving Level data"); + } +} \ No newline at end of file