mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 18:09:33 +00:00
DECIMAL BPM support for da charters out there,
also changes to HealthIcon to better work in ChartingState
This commit is contained in:
parent
80cac358c2
commit
daef9e0759
|
@ -76,7 +76,7 @@ class ChartingState extends MusicBeatState
|
||||||
**/
|
**/
|
||||||
var curSelectedNote:Array<Dynamic>;
|
var curSelectedNote:Array<Dynamic>;
|
||||||
|
|
||||||
var tempBpm:Int = 0;
|
var tempBpm:Float = 0;
|
||||||
|
|
||||||
var vocals:FlxSound;
|
var vocals:FlxSound;
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ class ChartingState extends MusicBeatState
|
||||||
add(curRenderedNotes);
|
add(curRenderedNotes);
|
||||||
add(curRenderedSustains);
|
add(curRenderedSustains);
|
||||||
|
|
||||||
|
changeSection();
|
||||||
super.create();
|
super.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,11 +218,11 @@ class ChartingState extends MusicBeatState
|
||||||
|
|
||||||
var loadAutosaveBtn:FlxButton = new FlxButton(reloadSongJson.x, reloadSongJson.y + 30, 'load autosave', loadAutosave);
|
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);
|
var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 2);
|
||||||
stepperSpeed.value = _song.speed;
|
stepperSpeed.value = _song.speed;
|
||||||
stepperSpeed.name = 'song_speed';
|
stepperSpeed.name = 'song_speed';
|
||||||
|
|
||||||
var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 1, 1, 1, 339, 0);
|
var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 1, 100, 1, 999, 3);
|
||||||
stepperBPM.value = Conductor.bpm;
|
stepperBPM.value = Conductor.bpm;
|
||||||
stepperBPM.name = 'song_bpm';
|
stepperBPM.name = 'song_bpm';
|
||||||
|
|
||||||
|
@ -230,14 +231,15 @@ class ChartingState extends MusicBeatState
|
||||||
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
|
var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
|
||||||
{
|
{
|
||||||
_song.player1 = characters[Std.parseInt(character)];
|
_song.player1 = characters[Std.parseInt(character)];
|
||||||
|
updateHeads();
|
||||||
});
|
});
|
||||||
player1DropDown.selectedLabel = _song.player1;
|
player1DropDown.selectedLabel = _song.player1;
|
||||||
|
|
||||||
var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
|
var player2DropDown = new FlxUIDropDownMenu(140, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
|
||||||
{
|
{
|
||||||
_song.player2 = characters[Std.parseInt(character)];
|
_song.player2 = characters[Std.parseInt(character)];
|
||||||
|
updateHeads();
|
||||||
});
|
});
|
||||||
|
|
||||||
player2DropDown.selectedLabel = _song.player2;
|
player2DropDown.selectedLabel = _song.player2;
|
||||||
|
|
||||||
var tab_group_song = new FlxUI(null, UI_box);
|
var tab_group_song = new FlxUI(null, UI_box);
|
||||||
|
@ -276,7 +278,7 @@ class ChartingState extends MusicBeatState
|
||||||
stepperLength.value = _song.notes[curSection].lengthInSteps;
|
stepperLength.value = _song.notes[curSection].lengthInSteps;
|
||||||
stepperLength.name = "section_length";
|
stepperLength.name = "section_length";
|
||||||
|
|
||||||
stepperSectionBPM = new FlxUINumericStepper(10, 80, 1, Conductor.bpm, 0, 999, 0);
|
stepperSectionBPM = new FlxUINumericStepper(10, 80, 1, Conductor.bpm, 1, 999, 3);
|
||||||
stepperSectionBPM.value = Conductor.bpm;
|
stepperSectionBPM.value = Conductor.bpm;
|
||||||
stepperSectionBPM.name = 'section_bpm';
|
stepperSectionBPM.name = 'section_bpm';
|
||||||
|
|
||||||
|
@ -425,9 +427,9 @@ class ChartingState extends MusicBeatState
|
||||||
}
|
}
|
||||||
else if (wname == 'song_bpm')
|
else if (wname == 'song_bpm')
|
||||||
{
|
{
|
||||||
tempBpm = Std.int(nums.value);
|
tempBpm = nums.value;
|
||||||
Conductor.mapBPMChanges(_song);
|
Conductor.mapBPMChanges(_song);
|
||||||
Conductor.changeBPM(Std.int(nums.value));
|
Conductor.changeBPM(nums.value);
|
||||||
}
|
}
|
||||||
else if (wname == 'note_susLength')
|
else if (wname == 'note_susLength')
|
||||||
{
|
{
|
||||||
|
@ -436,7 +438,7 @@ class ChartingState extends MusicBeatState
|
||||||
}
|
}
|
||||||
else if (wname == 'section_bpm')
|
else if (wname == 'section_bpm')
|
||||||
{
|
{
|
||||||
_song.notes[curSection].bpm = Std.int(nums.value);
|
_song.notes[curSection].bpm = nums.value;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,7 +458,7 @@ class ChartingState extends MusicBeatState
|
||||||
}*/
|
}*/
|
||||||
function sectionStartTime():Float
|
function sectionStartTime():Float
|
||||||
{
|
{
|
||||||
var daBPM:Int = _song.bpm;
|
var daBPM:Float = _song.bpm;
|
||||||
var daPos:Float = 0;
|
var daPos:Float = 0;
|
||||||
for (i in 0...curSection)
|
for (i in 0...curSection)
|
||||||
{
|
{
|
||||||
|
@ -793,13 +795,13 @@ class ChartingState extends MusicBeatState
|
||||||
{
|
{
|
||||||
if (check_mustHitSection.checked)
|
if (check_mustHitSection.checked)
|
||||||
{
|
{
|
||||||
leftIcon.animation.play('bf');
|
leftIcon.changeIcon(_song.player1);
|
||||||
rightIcon.animation.play('dad');
|
rightIcon.changeIcon(_song.player2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leftIcon.animation.play('dad');
|
leftIcon.changeIcon(_song.player2);
|
||||||
rightIcon.animation.play('bf');
|
rightIcon.changeIcon(_song.player1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,7 +833,7 @@ class ChartingState extends MusicBeatState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get last bpm
|
// get last bpm
|
||||||
var daBPM:Int = _song.bpm;
|
var daBPM:Float = _song.bpm;
|
||||||
for (i in 0...curSection)
|
for (i in 0...curSection)
|
||||||
if (_song.notes[i].changeBPM)
|
if (_song.notes[i].changeBPM)
|
||||||
daBPM = _song.notes[i].bpm;
|
daBPM = _song.notes[i].bpm;
|
||||||
|
|
|
@ -11,12 +11,12 @@ typedef BPMChangeEvent =
|
||||||
{
|
{
|
||||||
var stepTime:Int;
|
var stepTime:Int;
|
||||||
var songTime:Float;
|
var songTime:Float;
|
||||||
var bpm:Int;
|
var bpm:Float;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Conductor
|
class Conductor
|
||||||
{
|
{
|
||||||
public static var bpm:Int = 100;
|
public static var bpm:Float = 100;
|
||||||
public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds
|
public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds
|
||||||
public static var stepCrochet:Float = crochet / 4; // steps in milliseconds
|
public static var stepCrochet:Float = crochet / 4; // steps in milliseconds
|
||||||
public static var songPosition:Float;
|
public static var songPosition:Float;
|
||||||
|
@ -36,7 +36,7 @@ class Conductor
|
||||||
{
|
{
|
||||||
bpmChangeMap = [];
|
bpmChangeMap = [];
|
||||||
|
|
||||||
var curBPM:Int = song.bpm;
|
var curBPM:Float = song.bpm;
|
||||||
var totalSteps:Int = 0;
|
var totalSteps:Int = 0;
|
||||||
var totalPos:Float = 0;
|
var totalPos:Float = 0;
|
||||||
for (i in 0...song.notes.length)
|
for (i in 0...song.notes.length)
|
||||||
|
@ -59,7 +59,7 @@ class Conductor
|
||||||
trace("new BPM map BUDDY " + bpmChangeMap);
|
trace("new BPM map BUDDY " + bpmChangeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function changeBPM(newBpm:Int)
|
public static function changeBPM(newBpm:Float)
|
||||||
{
|
{
|
||||||
bpm = newBpm;
|
bpm = newBpm;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class HealthIcon extends FlxSprite
|
||||||
*/
|
*/
|
||||||
public var sprTracker:FlxSprite;
|
public var sprTracker:FlxSprite;
|
||||||
|
|
||||||
var char:String = 'bf';
|
var char:String = '';
|
||||||
var isPlayer:Bool = false;
|
var isPlayer:Bool = false;
|
||||||
|
|
||||||
public function new(char:String = 'bf', isPlayer:Bool = false)
|
public function new(char:String = 'bf', isPlayer:Bool = false)
|
||||||
|
@ -19,9 +19,8 @@ class HealthIcon extends FlxSprite
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.isPlayer = isPlayer;
|
this.isPlayer = isPlayer;
|
||||||
this.char = char;
|
|
||||||
|
|
||||||
loadIcon(char);
|
changeIcon(char);
|
||||||
antialiasing = true;
|
antialiasing = true;
|
||||||
scrollFactor.set();
|
scrollFactor.set();
|
||||||
}
|
}
|
||||||
|
@ -33,29 +32,26 @@ class HealthIcon extends FlxSprite
|
||||||
isOldIcon = !isOldIcon;
|
isOldIcon = !isOldIcon;
|
||||||
|
|
||||||
if (isOldIcon)
|
if (isOldIcon)
|
||||||
{
|
changeIcon('bf-old');
|
||||||
loadGraphic(Paths.image('icons/icon-bf-old'), true, 150, 150);
|
|
||||||
animation.add('bf-old', [0, 1], 0, false, isPlayer);
|
|
||||||
animation.play('bf-old');
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
loadIcon(char);
|
changeIcon('bf');
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadIcon(char:String):Void
|
public function changeIcon(newChar:String):Void
|
||||||
{
|
{
|
||||||
var realChar:String = "";
|
if (newChar != 'bf-pixel' && newChar != 'bf-old')
|
||||||
switch (char)
|
newChar = newChar.split('-')[0].trim();
|
||||||
{
|
|
||||||
case 'bf-pixel':
|
|
||||||
realChar = char;
|
|
||||||
default:
|
|
||||||
realChar = char.split('-')[0].trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
loadGraphic(Paths.image('icons/icon-' + realChar), true, 150, 150);
|
if (newChar != char)
|
||||||
animation.add(realChar, [0, 1], 0, false, isPlayer);
|
{
|
||||||
animation.play(realChar);
|
if (animation.getByName(newChar) == null)
|
||||||
|
{
|
||||||
|
loadGraphic(Paths.image('icons/icon-' + newChar), true, 150, 150);
|
||||||
|
animation.add(newChar, [0, 1], 0, false, isPlayer);
|
||||||
|
}
|
||||||
|
animation.play(newChar);
|
||||||
|
char = newChar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
override function update(elapsed:Float)
|
||||||
|
|
|
@ -6,7 +6,7 @@ typedef SwagSection =
|
||||||
var lengthInSteps:Int;
|
var lengthInSteps:Int;
|
||||||
var typeOfSection:Int;
|
var typeOfSection:Int;
|
||||||
var mustHitSection:Bool;
|
var mustHitSection:Bool;
|
||||||
var bpm:Int;
|
var bpm:Float;
|
||||||
var changeBPM:Bool;
|
var changeBPM:Bool;
|
||||||
var altAnim:Bool;
|
var altAnim:Bool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ typedef SwagSong =
|
||||||
{
|
{
|
||||||
var song:String;
|
var song:String;
|
||||||
var notes:Array<SwagSection>;
|
var notes:Array<SwagSection>;
|
||||||
var bpm:Int;
|
var bpm:Float;
|
||||||
var needsVoices:Bool;
|
var needsVoices:Bool;
|
||||||
var speed:Float;
|
var speed:Float;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ 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:Float;
|
||||||
public var needsVoices:Bool = true;
|
public var needsVoices:Bool = true;
|
||||||
public var speed:Float = 1;
|
public var speed:Float = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue