BPM map, trim off useless song stuff, adjust MILF cam zoom
This commit is contained in:
parent
a5477c841b
commit
9b0bc41cc5
@ -1,9 +1,19 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
import Song.SwagSong;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ...
|
* ...
|
||||||
* @author
|
* @author
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef BPMChangeEvent =
|
||||||
|
{
|
||||||
|
var stepTime:Int;
|
||||||
|
var songTime:Float;
|
||||||
|
var bpm:Int;
|
||||||
|
}
|
||||||
|
|
||||||
class Conductor
|
class Conductor
|
||||||
{
|
{
|
||||||
public static var bpm:Int = 100;
|
public static var bpm:Int = 100;
|
||||||
@ -16,10 +26,39 @@ class Conductor
|
|||||||
public static var safeFrames:Int = 10;
|
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 safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds
|
||||||
|
|
||||||
|
public static var bpmChangeMap:Array<BPMChangeEvent> = [];
|
||||||
|
|
||||||
public function new()
|
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)
|
public static function changeBPM(newBpm:Int)
|
||||||
{
|
{
|
||||||
bpm = newBpm;
|
bpm = newBpm;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
import Conductor.BPMChangeEvent;
|
||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
import flixel.addons.transition.FlxTransitionableState;
|
import flixel.addons.transition.FlxTransitionableState;
|
||||||
import flixel.addons.ui.FlxUIState;
|
import flixel.addons.ui.FlxUIState;
|
||||||
@ -38,7 +39,7 @@ class MusicBeatState extends FlxUIState
|
|||||||
everyStep();
|
everyStep();
|
||||||
|
|
||||||
updateCurStep();
|
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();
|
updateBeat();
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
@ -46,7 +47,7 @@ class MusicBeatState extends FlxUIState
|
|||||||
|
|
||||||
private function updateBeat():Void
|
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
|
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
|
public function stepHit():Void
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
import Conductor.BPMChangeEvent;
|
||||||
import flixel.FlxG;
|
import flixel.FlxG;
|
||||||
import flixel.FlxSubState;
|
import flixel.FlxSubState;
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ class MusicBeatSubstate extends FlxSubState
|
|||||||
everyStep();
|
everyStep();
|
||||||
|
|
||||||
updateCurStep();
|
updateCurStep();
|
||||||
curBeat = Math.round(curStep / 4);
|
curBeat = Math.floor(curStep / 4);
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
@ -59,7 +60,18 @@ class MusicBeatSubstate extends FlxSubState
|
|||||||
|
|
||||||
private function updateCurStep():Void
|
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
|
public function stepHit():Void
|
||||||
|
@ -140,6 +140,7 @@ class PlayState extends MusicBeatState
|
|||||||
if (SONG == null)
|
if (SONG == null)
|
||||||
SONG = Song.loadFromJson('tutorial');
|
SONG = Song.loadFromJson('tutorial');
|
||||||
|
|
||||||
|
Conductor.mapBPMChanges(SONG);
|
||||||
Conductor.changeBPM(SONG.bpm);
|
Conductor.changeBPM(SONG.bpm);
|
||||||
|
|
||||||
switch (SONG.song.toLowerCase())
|
switch (SONG.song.toLowerCase())
|
||||||
@ -1446,6 +1447,8 @@ class PlayState extends MusicBeatState
|
|||||||
}
|
}
|
||||||
|
|
||||||
FlxG.watch.addQuick("beatShit", totalBeats);
|
FlxG.watch.addQuick("beatShit", totalBeats);
|
||||||
|
FlxG.watch.addQuick("stepShit", totalSteps);
|
||||||
|
|
||||||
|
|
||||||
if (curSong == 'Fresh')
|
if (curSong == 'Fresh')
|
||||||
{
|
{
|
||||||
@ -2283,7 +2286,7 @@ class PlayState extends MusicBeatState
|
|||||||
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
|
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
|
||||||
|
|
||||||
// HARDCODING FOR MILF ZOOMS!
|
// 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;
|
FlxG.camera.zoom += 0.015;
|
||||||
camHUD.zoom += 0.03;
|
camHUD.zoom += 0.03;
|
||||||
|
@ -12,8 +12,6 @@ typedef SwagSong =
|
|||||||
var song:String;
|
var song:String;
|
||||||
var notes:Array<SwagSection>;
|
var notes:Array<SwagSection>;
|
||||||
var bpm:Int;
|
var bpm:Int;
|
||||||
var sections:Int;
|
|
||||||
var sectionLengths:Array<Dynamic>;
|
|
||||||
var needsVoices:Bool;
|
var needsVoices:Bool;
|
||||||
var speed:Float;
|
var speed:Float;
|
||||||
|
|
||||||
@ -27,25 +25,17 @@ class Song
|
|||||||
public var song:String;
|
public var song:String;
|
||||||
public var notes:Array<SwagSection>;
|
public var notes:Array<SwagSection>;
|
||||||
public var bpm:Int;
|
public var bpm:Int;
|
||||||
public var sections:Int;
|
|
||||||
public var sectionLengths:Array<Dynamic> = [];
|
|
||||||
public var needsVoices:Bool = true;
|
public var needsVoices:Bool = true;
|
||||||
public var speed:Float = 1;
|
public var speed:Float = 1;
|
||||||
|
|
||||||
public var player1:String = 'bf';
|
public var player1:String = 'bf';
|
||||||
public var player2:String = 'dad';
|
public var player2:String = 'dad';
|
||||||
|
|
||||||
public function new(song, notes, bpm, sections)
|
public function new(song, notes, bpm)
|
||||||
{
|
{
|
||||||
this.song = song;
|
this.song = song;
|
||||||
this.notes = notes;
|
this.notes = notes;
|
||||||
this.bpm = bpm;
|
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
|
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
|
||||||
@ -72,9 +62,7 @@ class Song
|
|||||||
|
|
||||||
daNotes = songData.notes;
|
daNotes = songData.notes;
|
||||||
daSong = songData.song;
|
daSong = songData.song;
|
||||||
daSections = songData.sections;
|
daBpm = songData.bpm; */
|
||||||
daBpm = songData.bpm;
|
|
||||||
daSectionLengths = songData.sectionLengths; */
|
|
||||||
|
|
||||||
return parseJSONshit(rawJson);
|
return parseJSONshit(rawJson);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user