From 4cbab4f53165dbaa57f50bcef97c88d9b0f7efd0 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 29 Oct 2020 20:06:52 -0700 Subject: [PATCH] BPM BULLSHIT --- Project.xml | 2 +- source/AnimationDebug.hx | 5 ++- source/Character.hx | 17 ++++++++++ source/ChartingState.hx | 70 +++++++++++++++++++++++++++++++--------- source/FreeplayState.hx | 2 +- source/PlayState.hx | 19 +++++++++-- source/Section.hx | 2 ++ 7 files changed, 95 insertions(+), 22 deletions(-) diff --git a/Project.xml b/Project.xml index a4437fa7d..3eb374045 100644 --- a/Project.xml +++ b/Project.xml @@ -92,5 +92,5 @@ - + diff --git a/source/AnimationDebug.hx b/source/AnimationDebug.hx index 1cf4021a3..e74b45c56 100644 --- a/source/AnimationDebug.hx +++ b/source/AnimationDebug.hx @@ -21,7 +21,7 @@ class AnimationDebug extends FlxState var dumbTexts:FlxTypedGroup; var animList:Array = []; var curAnim:Int = 0; - var isDad:Bool = false; + var isDad:Bool = true; var daAnim:String = 'spooky'; var camFollow:FlxObject; @@ -39,6 +39,9 @@ class AnimationDebug extends FlxState gridBG.scrollFactor.set(0.5, 0.5); add(gridBG); + if (daAnim == 'bf') + isDad = false; + if (isDad) { dad = new Character(0, 0, daAnim); diff --git a/source/Character.hx b/source/Character.hx index aa9cfe4da..af441f023 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -85,6 +85,21 @@ class Character extends FlxSprite addOffset("singDOWN", -50, -130); playAnim('danceRight'); + case 'monster': + tex = FlxAtlasFrames.fromSparrow(AssetPaths.Monster_Assets__png, AssetPaths.Monster_Assets__xml); + frames = tex; + animation.addByPrefix('idle', 'monster idle', 24); + animation.addByPrefix('singUP', 'monster up note', 24, false); + animation.addByPrefix('singDOWN', 'monster down', 24, false); + animation.addByPrefix('singLEFT', 'Monster left note', 24, false); + animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false); + + addOffset('idle'); + addOffset("singUP", -20, 50); + addOffset("singRIGHT", -51); + addOffset("singLEFT", -30); + addOffset("singDOWN", -30, -40); + playAnim('idle'); } } @@ -113,6 +128,8 @@ class Character extends FlxSprite playAnim('danceLeft'); case 'dad': playAnim('idle'); + case 'monster': + playAnim('idle'); } } diff --git a/source/ChartingState.hx b/source/ChartingState.hx index a2740dd16..c0ce793e5 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -1,5 +1,6 @@ package; +import Section.SwagSection; import Song.SwagSong; import flixel.FlxG; import flixel.FlxSprite; @@ -68,6 +69,8 @@ class ChartingState extends MusicBeatState **/ var curSelectedNote:Array; + var tempBpm:Int = 0; + override function create() { gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); @@ -93,6 +96,8 @@ class ChartingState extends MusicBeatState }; } + tempBpm = _song.bpm; + addSection(); // sections = _song.notes; @@ -172,7 +177,7 @@ class ChartingState extends MusicBeatState stepperBPM.value = Conductor.bpm; stepperBPM.name = 'song_bpm'; - var characters:Array = ["bf", 'dad', 'gf', 'spooky']; + var characters:Array = ["bf", 'dad', 'gf', 'spooky', 'monster']; var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) { @@ -208,6 +213,8 @@ class ChartingState extends MusicBeatState var stepperLength:FlxUINumericStepper; var check_mustHitSection:FlxUICheckBox; + var check_changeBPM:FlxUICheckBox; + var stepperSectionBPM:FlxUINumericStepper; function addSectionUI():Void { @@ -218,6 +225,10 @@ class ChartingState extends MusicBeatState stepperLength.value = _song.notes[curSection].lengthInSteps; stepperLength.name = "section_length"; + 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, 30, 1, 1, -999, 999, 0); var copyButton:FlxButton = new FlxButton(110, 8, "Copy last section", function() @@ -229,15 +240,15 @@ class ChartingState extends MusicBeatState check_mustHitSection.name = 'check_mustHit'; check_mustHitSection.checked = true; // _song.needsVoices = check_mustHit.checked; - check_mustHitSection.callback = function() - { - // _song.needsVoices = check_mustHit.checked; - trace('CHECKED!'); - }; + + 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(stepperSectionBPM); tab_group_section.add(stepperCopy); tab_group_section.add(check_mustHitSection); + tab_group_section.add(check_changeBPM); tab_group_section.add(copyButton); UI_box.addGroup(tab_group_section); @@ -305,6 +316,8 @@ class ChartingState extends MusicBeatState { case 'Must hit section': _song.notes[curSection].mustHitSection = check.checked; + case 'Change BPM': + _song.notes[curSection].changeBPM = check.checked; } } else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper)) @@ -323,6 +336,7 @@ class ChartingState extends MusicBeatState } else if (wname == 'song_bpm') { + tempBpm = Std.int(nums.value); Conductor.changeBPM(Std.int(nums.value)); } else if (wname == 'note_susLength') @@ -330,6 +344,11 @@ class ChartingState extends MusicBeatState curSelectedNote[2] = nums.value; updateGrid(); } + else if (wname == 'section_bpm') + { + _song.notes[curSection].bpm = Std.int(nums.value); + updateGrid(); + } } // FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params); @@ -448,12 +467,12 @@ class ChartingState extends MusicBeatState } } - _song.bpm = Conductor.bpm; + _song.bpm = tempBpm; - if (FlxG.keys.justPressed.UP) - Conductor.changeBPM(Conductor.bpm + 1); - if (FlxG.keys.justPressed.DOWN) - Conductor.changeBPM(Conductor.bpm - 1); + /* if (FlxG.keys.justPressed.UP) + Conductor.changeBPM(Conductor.bpm + 1); + if (FlxG.keys.justPressed.DOWN) + Conductor.changeBPM(Conductor.bpm - 1); */ if (FlxG.keys.justPressed.RIGHT) changeSection(curSection + 1); @@ -471,7 +490,6 @@ class ChartingState extends MusicBeatState if (_song.notes[sec] != null) { curSection = sec; - updateGrid(); if (updateMusic) { @@ -489,6 +507,7 @@ class ChartingState extends MusicBeatState updateCurStep(); } + updateGrid(); updateSectionUI(); } } @@ -514,6 +533,8 @@ class ChartingState extends MusicBeatState stepperLength.value = sec.lengthInSteps; check_mustHitSection.checked = sec.mustHitSection; + check_changeBPM.checked = sec.changeBPM; + stepperSectionBPM.value = sec.bpm; } function updateNoteUI():Void @@ -535,6 +556,15 @@ class ChartingState extends MusicBeatState var sectionInfo:Array = _song.notes[curSection].sectionNotes; + if (_song.notes[curSection].changeBPM && _song.notes[curSection].bpm > 0) + { + Conductor.changeBPM(_song.notes[curSection].bpm); + } + else + { + Conductor.changeBPM(tempBpm); + } + /* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE for (sec in 0..._song.notes.length) { @@ -567,8 +597,7 @@ class ChartingState extends MusicBeatState if (daSus > 0) { var sustainVis:FlxSprite = new FlxSprite(note.x + (GRID_SIZE / 2), - note.y + getYfromStrum(note.strumTime + Conductor.stepCrochet)).makeGraphic(8, - Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * 16, 0, gridBG.height))); + note.y + GRID_SIZE).makeGraphic(8, Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * 16, 0, gridBG.height))); curRenderedSustains.add(sustainVis); } } @@ -576,7 +605,16 @@ class ChartingState extends MusicBeatState private function addSection(lengthInSteps:Int = 16):Void { - _song.notes.push(new Section(lengthInSteps)); + var sec:SwagSection = { + lengthInSteps: lengthInSteps, + bpm: _song.bpm, + changeBPM: false, + mustHitSection: true, + sectionNotes: [], + typeOfSection: 0 + }; + + _song.notes.push(sec); } function selectNote(note:Note):Void @@ -648,7 +686,7 @@ class ChartingState extends MusicBeatState return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height); } - function calculateSectionLengths(?sec:Section):Int + function calculateSectionLengths(?sec:SwagSection):Int { var daLength:Int = 0; diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 4df7ff260..56c435a8e 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -7,7 +7,7 @@ import flixel.text.FlxText; class FreeplayState extends MusicBeatState { - var songs:Array = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial", "Spookeez", "South"]; + var songs:Array = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial", "Spookeez", "South", "Monster"]; var selector:FlxText; var curSelected:Int = 0; diff --git a/source/PlayState.hx b/source/PlayState.hx index ac496ee69..9b0cffc78 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -125,6 +125,8 @@ class PlayState extends MusicBeatState gf.visible = false; case "spooky": dad.y += 200; + case "monster": + dad.y += 100; } boyfriend = new Boyfriend(770, 450); @@ -188,8 +190,8 @@ class PlayState extends MusicBeatState healthBarBG.cameras = [camHUD]; healthHeads.cameras = [camHUD]; - if (SONG.song == 'South') - FlxG.camera.alpha = 0.7; + // if (SONG.song == 'South') + // FlxG.camera.alpha = 0.7; // UI_camera.zoom = 1; // cameras = [FlxG.cameras.list[1]]; @@ -542,7 +544,7 @@ class PlayState extends MusicBeatState /* if (FlxG.keys.justPressed.NINE) FlxG.switchState(new Charting()); */ if (FlxG.keys.justPressed.EIGHT) - FlxG.switchState(new AnimationDebug(SONG.player1)); + FlxG.switchState(new AnimationDebug(SONG.player2)); if (startingSong) { @@ -700,6 +702,9 @@ class PlayState extends MusicBeatState dad.playAnim('singLEFT'); } + if (SONG.needsVoices) + vocals.volume = 1; + daNote.kill(); notes.remove(daNote, true); daNote.destroy(); @@ -1145,6 +1150,14 @@ class PlayState extends MusicBeatState if (generatedMusic) { notes.sort(FlxSort.byY, FlxSort.DESCENDING); + + if (SONG.notes[curSection].changeBPM != null) + { + if (SONG.notes[curSection].changeBPM) + { + Conductor.changeBPM(SONG.notes[curSection].bpm); + } + } } if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0) diff --git a/source/Section.hx b/source/Section.hx index c811e306d..19770b6ea 100644 --- a/source/Section.hx +++ b/source/Section.hx @@ -6,6 +6,8 @@ typedef SwagSection = var lengthInSteps:Int; var typeOfSection:Int; var mustHitSection:Bool; + var bpm:Int; + var changeBPM:Bool; } class Section