mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-09 16:24:42 +00:00
BPM map, trim off useless song stuff, adjust MILF cam zoom
This commit is contained in:
parent
ad233110f7
commit
41efd4f3db
|
@ -1,9 +1,19 @@
|
|||
package;
|
||||
|
||||
import Song.SwagSong;
|
||||
|
||||
/**
|
||||
* ...
|
||||
* @author
|
||||
*/
|
||||
|
||||
typedef BPMChangeEvent =
|
||||
{
|
||||
var stepTime:Int;
|
||||
var songTime:Float;
|
||||
var bpm:Int;
|
||||
}
|
||||
|
||||
class Conductor
|
||||
{
|
||||
public static var bpm:Int = 100;
|
||||
|
@ -16,10 +26,39 @@ class Conductor
|
|||
public static var safeFrames:Int = 10;
|
||||
public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds
|
||||
|
||||
public static var bpmChangeMap:Array<BPMChangeEvent> = [];
|
||||
|
||||
public function new()
|
||||
{
|
||||
}
|
||||
|
||||
public static function mapBPMChanges(song:SwagSong)
|
||||
{
|
||||
bpmChangeMap = [];
|
||||
|
||||
var curBPM:Int = song.bpm;
|
||||
var totalSteps:Int = 0;
|
||||
var totalPos:Float = 0;
|
||||
for (i in 0...song.notes.length)
|
||||
{
|
||||
if(song.notes[i].changeBPM && song.notes[i].bpm != curBPM)
|
||||
{
|
||||
curBPM = song.notes[i].bpm;
|
||||
var event:BPMChangeEvent = {
|
||||
stepTime: totalSteps,
|
||||
songTime: totalPos,
|
||||
bpm: curBPM
|
||||
};
|
||||
bpmChangeMap.push(event);
|
||||
}
|
||||
|
||||
var deltaSteps:Int = song.notes[i].lengthInSteps;
|
||||
totalSteps += deltaSteps;
|
||||
totalPos += ((60 / curBPM) * 1000 / 4) * deltaSteps;
|
||||
}
|
||||
trace("new BPM map BUDDY " + bpmChangeMap);
|
||||
}
|
||||
|
||||
public static function changeBPM(newBpm:Int)
|
||||
{
|
||||
bpm = newBpm;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
import Conductor.BPMChangeEvent;
|
||||
import flixel.FlxG;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.addons.ui.FlxUIState;
|
||||
|
@ -38,7 +39,7 @@ class MusicBeatState extends FlxUIState
|
|||
everyStep();
|
||||
|
||||
updateCurStep();
|
||||
// Needs to be ROUNED, rather than ceil or floor
|
||||
// Needs to be FLOOR idk why it was rounded but that dont make sense
|
||||
updateBeat();
|
||||
|
||||
super.update(elapsed);
|
||||
|
@ -46,7 +47,7 @@ class MusicBeatState extends FlxUIState
|
|||
|
||||
private function updateBeat():Void
|
||||
{
|
||||
curBeat = Math.round(curStep / 4);
|
||||
curBeat = Math.floor(curStep / 4);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +67,18 @@ class MusicBeatState extends FlxUIState
|
|||
|
||||
private function updateCurStep():Void
|
||||
{
|
||||
curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
|
||||
var lastChange:BPMChangeEvent = {
|
||||
stepTime: 0,
|
||||
songTime: 0,
|
||||
bpm: 0
|
||||
}
|
||||
for (i in 0...Conductor.bpmChangeMap.length)
|
||||
{
|
||||
if (Conductor.songPosition >= Conductor.bpmChangeMap[i].songTime)
|
||||
lastChange = Conductor.bpmChangeMap[i];
|
||||
}
|
||||
|
||||
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
|
||||
}
|
||||
|
||||
public function stepHit():Void
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
import Conductor.BPMChangeEvent;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSubState;
|
||||
|
||||
|
@ -37,7 +38,7 @@ class MusicBeatSubstate extends FlxSubState
|
|||
everyStep();
|
||||
|
||||
updateCurStep();
|
||||
curBeat = Math.round(curStep / 4);
|
||||
curBeat = Math.floor(curStep / 4);
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
@ -59,7 +60,18 @@ class MusicBeatSubstate extends FlxSubState
|
|||
|
||||
private function updateCurStep():Void
|
||||
{
|
||||
curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
|
||||
var lastChange:BPMChangeEvent = {
|
||||
stepTime: 0,
|
||||
songTime: 0,
|
||||
bpm: 0
|
||||
}
|
||||
for (i in 0...Conductor.bpmChangeMap.length)
|
||||
{
|
||||
if (Conductor.songPosition > Conductor.bpmChangeMap[i].songTime)
|
||||
lastChange = Conductor.bpmChangeMap[i];
|
||||
}
|
||||
|
||||
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
|
||||
}
|
||||
|
||||
public function stepHit():Void
|
||||
|
|
|
@ -140,6 +140,7 @@ class PlayState extends MusicBeatState
|
|||
if (SONG == null)
|
||||
SONG = Song.loadFromJson('tutorial');
|
||||
|
||||
Conductor.mapBPMChanges(SONG);
|
||||
Conductor.changeBPM(SONG.bpm);
|
||||
|
||||
switch (SONG.song.toLowerCase())
|
||||
|
@ -1446,6 +1447,8 @@ class PlayState extends MusicBeatState
|
|||
}
|
||||
|
||||
FlxG.watch.addQuick("beatShit", totalBeats);
|
||||
FlxG.watch.addQuick("stepShit", totalSteps);
|
||||
|
||||
|
||||
if (curSong == 'Fresh')
|
||||
{
|
||||
|
@ -2283,7 +2286,7 @@ class PlayState extends MusicBeatState
|
|||
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
|
||||
|
||||
// HARDCODING FOR MILF ZOOMS!
|
||||
if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat <= 200 && camZooming && FlxG.camera.zoom < 1.35)
|
||||
if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35)
|
||||
{
|
||||
FlxG.camera.zoom += 0.015;
|
||||
camHUD.zoom += 0.03;
|
||||
|
|
|
@ -12,8 +12,6 @@ typedef SwagSong =
|
|||
var song:String;
|
||||
var notes:Array<SwagSection>;
|
||||
var bpm:Int;
|
||||
var sections:Int;
|
||||
var sectionLengths:Array<Dynamic>;
|
||||
var needsVoices:Bool;
|
||||
var speed:Float;
|
||||
|
||||
|
@ -27,25 +25,17 @@ class Song
|
|||
public var song:String;
|
||||
public var notes:Array<SwagSection>;
|
||||
public var bpm:Int;
|
||||
public var sections:Int;
|
||||
public var sectionLengths:Array<Dynamic> = [];
|
||||
public var needsVoices:Bool = true;
|
||||
public var speed:Float = 1;
|
||||
|
||||
public var player1:String = 'bf';
|
||||
public var player2:String = 'dad';
|
||||
|
||||
public function new(song, notes, bpm, sections)
|
||||
public function new(song, notes, bpm)
|
||||
{
|
||||
this.song = song;
|
||||
this.notes = notes;
|
||||
this.bpm = bpm;
|
||||
this.sections = sections;
|
||||
|
||||
for (i in 0...notes.length)
|
||||
{
|
||||
this.sectionLengths.push(notes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
|
||||
|
@ -72,9 +62,7 @@ class Song
|
|||
|
||||
daNotes = songData.notes;
|
||||
daSong = songData.song;
|
||||
daSections = songData.sections;
|
||||
daBpm = songData.bpm;
|
||||
daSectionLengths = songData.sectionLengths; */
|
||||
daBpm = songData.bpm; */
|
||||
|
||||
return parseJSONshit(rawJson);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue