Merge remote-tracking branch 'upstream/master' into patch-3
This commit is contained in:
@ -83,6 +83,7 @@ class Caching extends MusicBeatState
|
||||
|
||||
var images = [];
|
||||
var music = [];
|
||||
var charts = [];
|
||||
|
||||
trace("caching images...");
|
||||
|
||||
@ -99,6 +100,7 @@ class Caching extends MusicBeatState
|
||||
{
|
||||
music.push(i);
|
||||
}
|
||||
|
||||
|
||||
toBeDone = Lambda.count(images) + Lambda.count(music);
|
||||
|
||||
@ -120,6 +122,7 @@ class Caching extends MusicBeatState
|
||||
done++;
|
||||
}
|
||||
|
||||
|
||||
trace("Finished caching...");
|
||||
|
||||
FlxG.switchState(new TitleState());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flixel.FlxG;
|
||||
import flixel.input.FlxInput;
|
||||
import flixel.input.actions.FlxAction;
|
||||
@ -571,8 +572,22 @@ class Controls extends FlxActionSet
|
||||
//trace(FlxKey.fromString(FlxG.save.data.upBind));
|
||||
|
||||
removeKeyboard();
|
||||
if (gamepadsAdded.length != 0)
|
||||
removeGamepad();
|
||||
KeyBinds.keyCheck();
|
||||
|
||||
|
||||
var buttons = new Map<Control,Array<FlxGamepadInputID>>();
|
||||
|
||||
buttons.set(Control.UP,[FlxGamepadInputID.fromString(FlxG.save.data.gpupBind)]);
|
||||
buttons.set(Control.LEFT,[FlxGamepadInputID.fromString(FlxG.save.data.gpleftBind)]);
|
||||
buttons.set(Control.DOWN,[FlxGamepadInputID.fromString(FlxG.save.data.gpdownBind)]);
|
||||
buttons.set(Control.RIGHT,[FlxGamepadInputID.fromString(FlxG.save.data.gprightBind)]);
|
||||
buttons.set(Control.ACCEPT,[FlxGamepadInputID.A]);
|
||||
buttons.set(Control.BACK,[FlxGamepadInputID.B]);
|
||||
buttons.set(Control.PAUSE,[FlxGamepadInputID.START]);
|
||||
|
||||
addGamepad(0,buttons);
|
||||
|
||||
inline bindKeys(Control.UP, [FlxKey.fromString(FlxG.save.data.upBind), FlxKey.UP]);
|
||||
inline bindKeys(Control.DOWN, [FlxKey.fromString(FlxG.save.data.downBind), FlxKey.DOWN]);
|
||||
inline bindKeys(Control.LEFT, [FlxKey.fromString(FlxG.save.data.leftBind), FlxKey.LEFT]);
|
||||
@ -599,6 +614,9 @@ class Controls extends FlxActionSet
|
||||
|
||||
public function addGamepad(id:Int, ?buttonMap:Map<Control, Array<FlxGamepadInputID>>):Void
|
||||
{
|
||||
if (gamepadsAdded.contains(id))
|
||||
gamepadsAdded.remove(id);
|
||||
|
||||
gamepadsAdded.push(id);
|
||||
|
||||
#if (haxe >= "4.0.0")
|
||||
|
@ -177,7 +177,7 @@ class DialogueBox extends FlxSpriteGroup
|
||||
dialogueStarted = true;
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.ANY && dialogueStarted == true)
|
||||
if (PlayerSettings.player1.controls.ACCEPT && dialogueStarted == true)
|
||||
{
|
||||
remove(dialogue);
|
||||
|
||||
|
92
source/DiffCalc.hx
Normal file
92
source/DiffCalc.hx
Normal file
@ -0,0 +1,92 @@
|
||||
import Song.SwagSong;
|
||||
|
||||
class SmallNote // basically Note.hx but small as fuck
|
||||
{
|
||||
public var strumTime:Float;
|
||||
public var noteData:Int;
|
||||
|
||||
public function new(strum,data)
|
||||
{
|
||||
strumTime = strum;
|
||||
noteData = data;
|
||||
}
|
||||
}
|
||||
|
||||
class DiffCalc
|
||||
{
|
||||
public static function CalculateDiff(song:SwagSong)
|
||||
{
|
||||
// cleaned notes
|
||||
var cleanedNotes:Array<SmallNote> = [];
|
||||
|
||||
// find all of the notes
|
||||
for(i in song.notes) // sections
|
||||
{
|
||||
for (ii in i.sectionNotes) // notes
|
||||
{
|
||||
if (ii[2] != 0) // skip helds
|
||||
continue;
|
||||
var gottaHitNote:Bool = i.mustHitSection;
|
||||
|
||||
if (ii[1] > 3)
|
||||
gottaHitNote = !i.mustHitSection;
|
||||
|
||||
if (gottaHitNote)
|
||||
cleanedNotes.push(new SmallNote(ii[0],ii[1]));
|
||||
}
|
||||
}
|
||||
|
||||
cleanedNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
|
||||
var firstNoteTime = cleanedNotes[0].strumTime;
|
||||
|
||||
// normalize the notes
|
||||
for(i in cleanedNotes)
|
||||
{
|
||||
i.strumTime = (i.strumTime - firstNoteTime) * 2;
|
||||
}
|
||||
|
||||
// length in segments of the song
|
||||
var length = ((cleanedNotes[cleanedNotes.length - 1].strumTime / 1000) / 0.5);
|
||||
|
||||
// hackey way of creating a array with a length
|
||||
var segments:Array<Int> = new_Array(1,Std.int(length));
|
||||
|
||||
// algo loop
|
||||
for(i in cleanedNotes)
|
||||
{
|
||||
var index = Std.int(((i.strumTime / 1000)));
|
||||
if (index + 1 > segments.length)
|
||||
continue;
|
||||
segments[index] = segments[index] + 1;
|
||||
}
|
||||
|
||||
// get the average of all of the segments
|
||||
var sum:Float = 0;
|
||||
|
||||
var newLength = segments.length;
|
||||
|
||||
for (i in segments)
|
||||
{
|
||||
if (i == 0) // remove empty/breaks
|
||||
{
|
||||
newLength--;
|
||||
continue;
|
||||
}
|
||||
//trace(i);
|
||||
sum += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid
|
||||
}
|
||||
return HelperFunctions.truncateFloat(sum / newLength,2);
|
||||
}
|
||||
|
||||
static public function new_Array<T>( ArrayType:T, Length:Int ):Array<T> {
|
||||
var empty:Null<T> = null;
|
||||
var newArray:Array<T> = new Array<T>();
|
||||
|
||||
for ( i in 0...Length ) {
|
||||
newArray.push( empty );
|
||||
}
|
||||
|
||||
return newArray;
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package;
|
||||
|
||||
import Song.SwagSong;
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flash.text.TextField;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
@ -28,6 +30,7 @@ class FreeplayState extends MusicBeatState
|
||||
var scoreText:FlxText;
|
||||
var comboText:FlxText;
|
||||
var diffText:FlxText;
|
||||
var diffCalcText:FlxText;
|
||||
var lerpScore:Int = 0;
|
||||
var intendedScore:Int = 0;
|
||||
var combo:String = '';
|
||||
@ -37,6 +40,20 @@ class FreeplayState extends MusicBeatState
|
||||
|
||||
private var iconArray:Array<HealthIcon> = [];
|
||||
|
||||
public static var songData:Map<String,Array<SwagSong>> = [];
|
||||
|
||||
public static function loadDiff(diff:Int, format:String, name:String, array:Array<SwagSong>)
|
||||
{
|
||||
try
|
||||
{
|
||||
array.push(Song.loadFromJson(Highscore.formatSong(format, diff), name));
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// do nada
|
||||
}
|
||||
}
|
||||
|
||||
override function create()
|
||||
{
|
||||
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
|
||||
@ -44,8 +61,23 @@ class FreeplayState extends MusicBeatState
|
||||
for (i in 0...initSonglist.length)
|
||||
{
|
||||
var data:Array<String> = initSonglist[i].split(':');
|
||||
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
||||
if(Std.parseInt(data[2]) <= FlxG.save.data.weekUnlocked - 1)
|
||||
songs.push(new SongMetadata(data[0], Std.parseInt(data[2]), data[1]));
|
||||
songs.push(meta);
|
||||
var format = StringTools.replace(meta.songName, " ", "-");
|
||||
switch (format) {
|
||||
case 'Dad-Battle': format = 'Dadbattle';
|
||||
case 'Philly-Nice': format = 'Philly';
|
||||
}
|
||||
|
||||
var diffs = [];
|
||||
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||
FreeplayState.songData.set(meta.songName,diffs);
|
||||
trace('loaded diffs for ' + meta.songName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -101,7 +133,7 @@ class FreeplayState extends MusicBeatState
|
||||
scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT);
|
||||
// scoreText.alignment = RIGHT;
|
||||
|
||||
var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 66, 0xFF000000);
|
||||
var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 105, 0xFF000000);
|
||||
scoreBG.alpha = 0.6;
|
||||
add(scoreBG);
|
||||
|
||||
@ -109,6 +141,10 @@ class FreeplayState extends MusicBeatState
|
||||
diffText.font = scoreText.font;
|
||||
add(diffText);
|
||||
|
||||
diffCalcText = new FlxText(scoreText.x, scoreText.y + 66, 0, "", 24);
|
||||
diffCalcText.font = scoreText.font;
|
||||
add(diffCalcText);
|
||||
|
||||
comboText = new FlxText(diffText.x + 100, diffText.y, 0, "", 24);
|
||||
comboText.font = diffText.font;
|
||||
add(comboText);
|
||||
@ -185,10 +221,32 @@ class FreeplayState extends MusicBeatState
|
||||
scoreText.text = "PERSONAL BEST:" + lerpScore;
|
||||
comboText.text = combo + '\n';
|
||||
|
||||
var upP = controls.UP_P;
|
||||
var downP = controls.DOWN_P;
|
||||
var upP = FlxG.keys.justPressed.UP;
|
||||
var downP = FlxG.keys.justPressed.DOWN;
|
||||
var accepted = controls.ACCEPT;
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.DPAD_UP)
|
||||
{
|
||||
changeSelection(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_DOWN)
|
||||
{
|
||||
changeSelection(1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_LEFT)
|
||||
{
|
||||
changeDiff(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_RIGHT)
|
||||
{
|
||||
changeDiff(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (upP)
|
||||
{
|
||||
changeSelection(-1);
|
||||
@ -198,9 +256,9 @@ class FreeplayState extends MusicBeatState
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
if (controls.LEFT_P)
|
||||
if (FlxG.keys.justPressed.LEFT)
|
||||
changeDiff(-1);
|
||||
if (controls.RIGHT_P)
|
||||
if (FlxG.keys.justPressed.RIGHT)
|
||||
changeDiff(1);
|
||||
|
||||
if (controls.BACK)
|
||||
@ -216,14 +274,20 @@ class FreeplayState extends MusicBeatState
|
||||
case 'Dad-Battle': songFormat = 'Dadbattle';
|
||||
case 'Philly-Nice': songFormat = 'Philly';
|
||||
}
|
||||
|
||||
trace(songs[curSelected].songName);
|
||||
var hmm;
|
||||
try
|
||||
{
|
||||
hmm = songData.get(songs[curSelected].songName)[curDifficulty];
|
||||
if (hmm == null)
|
||||
return;
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var poop:String = Highscore.formatSong(songFormat, curDifficulty);
|
||||
|
||||
trace(poop);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName);
|
||||
PlayState.SONG = hmm;
|
||||
PlayState.isStoryMode = false;
|
||||
PlayState.storyDifficulty = curDifficulty;
|
||||
PlayState.storyWeek = songs[curSelected].week;
|
||||
@ -252,7 +316,7 @@ class FreeplayState extends MusicBeatState
|
||||
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
|
||||
combo = Highscore.getCombo(songHighscore, curDifficulty);
|
||||
#end
|
||||
|
||||
diffCalcText.text = 'RATING: ${DiffCalc.CalculateDiff(songData.get(songs[curSelected].songName)[curDifficulty])}';
|
||||
diffText.text = CoolUtil.difficultyFromInt(curDifficulty).toUpperCase();
|
||||
}
|
||||
|
||||
@ -288,6 +352,8 @@ class FreeplayState extends MusicBeatState
|
||||
// lerpScore = 0;
|
||||
#end
|
||||
|
||||
diffCalcText.text = 'RATING: ${DiffCalc.CalculateDiff(songData.get(songs[curSelected].songName)[curDifficulty])}';
|
||||
|
||||
#if PRELOAD_ALL
|
||||
FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
|
||||
#end
|
||||
|
@ -1,3 +1,4 @@
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import openfl.Lib;
|
||||
import flixel.FlxG;
|
||||
|
||||
@ -95,6 +96,10 @@ class KadeEngineData
|
||||
|
||||
if (FlxG.save.data.optimize == null)
|
||||
FlxG.save.data.optimize = false;
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
KeyBinds.gamepad = gamepad != null;
|
||||
|
||||
Conductor.recalculateTimings();
|
||||
PlayerSettings.player1.controls.loadKeyBinds();
|
||||
|
@ -3,6 +3,7 @@ package;
|
||||
/// Code created by Rozebud for FPS Plus (thanks rozebud)
|
||||
// modified by KadeDev for use in Kade Engine/Tricky
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flixel.util.FlxAxes;
|
||||
import flixel.FlxSubState;
|
||||
import Options.Option;
|
||||
@ -36,15 +37,19 @@ class KeyBindMenu extends FlxSubState
|
||||
var warningTween:FlxTween;
|
||||
var keyText:Array<String> = ["LEFT", "DOWN", "UP", "RIGHT"];
|
||||
var defaultKeys:Array<String> = ["A", "S", "W", "D", "R"];
|
||||
var defaultGpKeys:Array<String> = ["DPAD_LEFT", "DPAD_DOWN", "DPAD_UP", "DPAD_RIGHT"];
|
||||
var curSelected:Int = 0;
|
||||
|
||||
var keys:Array<String> = [FlxG.save.data.leftBind,
|
||||
FlxG.save.data.downBind,
|
||||
FlxG.save.data.upBind,
|
||||
FlxG.save.data.rightBind];
|
||||
|
||||
var gpKeys:Array<String> = [FlxG.save.data.gpleftBind,
|
||||
FlxG.save.data.gpdownBind,
|
||||
FlxG.save.data.gpupBind,
|
||||
FlxG.save.data.gprightBind];
|
||||
var tempKey:String = "";
|
||||
var blacklist:Array<String> = ["ESCAPE", "ENTER", "BACKSPACE", "SPACE"];
|
||||
var blacklist:Array<String> = ["ESCAPE", "ENTER", "BACKSPACE", "SPACE", "TAB"];
|
||||
|
||||
var blackBox:FlxSprite;
|
||||
var infoText:FlxText;
|
||||
@ -60,10 +65,17 @@ class KeyBindMenu extends FlxSubState
|
||||
if (k == null)
|
||||
keys[i] = defaultKeys[i];
|
||||
}
|
||||
|
||||
for (i in 0...gpKeys.length)
|
||||
{
|
||||
var k = gpKeys[i];
|
||||
if (k == null)
|
||||
gpKeys[i] = defaultGpKeys[i];
|
||||
}
|
||||
|
||||
//FlxG.sound.playMusic('assets/music/configurator' + TitleState.soundExt);
|
||||
|
||||
persistentUpdate = persistentDraw = true;
|
||||
persistentUpdate = true;
|
||||
|
||||
keyTextDisplay = new FlxText(-10, 0, 1280, "", 72);
|
||||
keyTextDisplay.scrollFactor.set(0, 0);
|
||||
@ -74,7 +86,7 @@ class KeyBindMenu extends FlxSubState
|
||||
blackBox = new FlxSprite(0,0).makeGraphic(FlxG.width,FlxG.height,FlxColor.BLACK);
|
||||
add(blackBox);
|
||||
|
||||
infoText = new FlxText(-10, 580, 1280, "(Escape to save, backspace to leave without saving)", 72);
|
||||
infoText = new FlxText(-10, 580, 1280, 'Current Mode: ${KeyBinds.gamepad ? 'GAMEPAD' : 'KEYBOARD'}. Press TAB to switch\n(${KeyBinds.gamepad ? 'RIGHT Trigger' : 'Escape'} to save, ${KeyBinds.gamepad ? 'LEFT Trigger' : 'Backspace'} to leave without saving. ${KeyBinds.gamepad ? 'START To change a keybind' : ''})', 72);
|
||||
infoText.scrollFactor.set(0, 0);
|
||||
infoText.setFormat("VCR OSD Mono", 24, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
infoText.borderSize = 2;
|
||||
@ -98,23 +110,36 @@ class KeyBindMenu extends FlxSubState
|
||||
super.create();
|
||||
}
|
||||
|
||||
var frames = 0;
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (frames <= 10)
|
||||
frames++;
|
||||
|
||||
switch(state){
|
||||
|
||||
case "select":
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(-1);
|
||||
}
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(-1);
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(1);
|
||||
}
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(1);
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.TAB)
|
||||
{
|
||||
KeyBinds.gamepad = !KeyBinds.gamepad;
|
||||
infoText.text = 'Current Mode: ${KeyBinds.gamepad ? 'GAMEPAD' : 'KEYBOARD'}. Press TAB to switch\n(${KeyBinds.gamepad ? 'RIGHT Trigger' : 'Escape'} to save, ${KeyBinds.gamepad ? 'LEFT Trigger' : 'Backspace'} to leave without saving. ${KeyBinds.gamepad ? 'START To change a keybind' : ''})';
|
||||
textUpdate();
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER){
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
@ -123,31 +148,87 @@ class KeyBindMenu extends FlxSubState
|
||||
else if(FlxG.keys.justPressed.ESCAPE){
|
||||
quit();
|
||||
}
|
||||
else if (FlxG.keys.justPressed.BACKSPACE){
|
||||
else if (FlxG.keys.justPressed.BACKSPACE){
|
||||
reset();
|
||||
}
|
||||
if (gamepad != null) // GP Logic
|
||||
{
|
||||
if (gamepad.justPressed.DPAD_UP)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(-1);
|
||||
textUpdate();
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_DOWN)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(1);
|
||||
textUpdate();
|
||||
}
|
||||
|
||||
if (gamepad.justPressed.START && frames > 10){
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
state = "input";
|
||||
}
|
||||
else if(gamepad.justPressed.LEFT_TRIGGER){
|
||||
quit();
|
||||
}
|
||||
else if (gamepad.justPressed.RIGHT_TRIGGER){
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
case "input":
|
||||
tempKey = keys[curSelected];
|
||||
keys[curSelected] = "?";
|
||||
if (KeyBinds.gamepad)
|
||||
gpKeys[curSelected] = "?";
|
||||
textUpdate();
|
||||
state = "waiting";
|
||||
|
||||
case "waiting":
|
||||
if(FlxG.keys.justPressed.ESCAPE){
|
||||
keys[curSelected] = tempKey;
|
||||
state = "select";
|
||||
FlxG.sound.play(Paths.sound('confirmMenu'));
|
||||
if (gamepad != null && KeyBinds.gamepad) // GP Logic
|
||||
{
|
||||
if(FlxG.keys.justPressed.ESCAPE){ // just in case you get stuck
|
||||
gpKeys[curSelected] = tempKey;
|
||||
state = "select";
|
||||
FlxG.sound.play(Paths.sound('confirmMenu'));
|
||||
}
|
||||
|
||||
if (gamepad.justPressed.START)
|
||||
{
|
||||
addKeyGamepad(defaultKeys[curSelected]);
|
||||
save();
|
||||
state = "select";
|
||||
}
|
||||
|
||||
if (gamepad.justPressed.ANY)
|
||||
{
|
||||
trace(gamepad.firstJustPressedID());
|
||||
addKeyGamepad(gamepad.firstJustPressedID());
|
||||
save();
|
||||
state = "select";
|
||||
textUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
else if(FlxG.keys.justPressed.ENTER){
|
||||
addKey(defaultKeys[curSelected]);
|
||||
save();
|
||||
state = "select";
|
||||
}
|
||||
else if(FlxG.keys.justPressed.ANY){
|
||||
addKey(FlxG.keys.getIsDown()[0].ID.toString());
|
||||
save();
|
||||
state = "select";
|
||||
else
|
||||
{
|
||||
if(FlxG.keys.justPressed.ESCAPE){
|
||||
keys[curSelected] = tempKey;
|
||||
state = "select";
|
||||
FlxG.sound.play(Paths.sound('confirmMenu'));
|
||||
}
|
||||
else if(FlxG.keys.justPressed.ENTER){
|
||||
addKey(defaultKeys[curSelected]);
|
||||
save();
|
||||
state = "select";
|
||||
}
|
||||
else if(FlxG.keys.justPressed.ANY){
|
||||
addKey(FlxG.keys.getIsDown()[0].ID.toString());
|
||||
save();
|
||||
state = "select";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -170,11 +251,24 @@ class KeyBindMenu extends FlxSubState
|
||||
|
||||
keyTextDisplay.text = "\n\n";
|
||||
|
||||
for(i in 0...4){
|
||||
if (KeyBinds.gamepad)
|
||||
{
|
||||
for(i in 0...4){
|
||||
|
||||
var textStart = (i == curSelected) ? "> " : " ";
|
||||
keyTextDisplay.text += textStart + keyText[i] + ": " + ((keys[i] != keyText[i]) ? (keys[i] + " / ") : "" ) + keyText[i] + " ARROW\n";
|
||||
var textStart = (i == curSelected) ? "> " : " ";
|
||||
trace(gpKeys[i]);
|
||||
keyTextDisplay.text += textStart + keyText[i] + ": " + gpKeys[i] + "\n";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i in 0...4){
|
||||
|
||||
var textStart = (i == curSelected) ? "> " : " ";
|
||||
keyTextDisplay.text += textStart + keyText[i] + ": " + ((keys[i] != keyText[i]) ? (keys[i] + " / ") : "" ) + keyText[i] + " ARROW\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
keyTextDisplay.screenCenter();
|
||||
@ -187,6 +281,11 @@ class KeyBindMenu extends FlxSubState
|
||||
FlxG.save.data.downBind = keys[1];
|
||||
FlxG.save.data.leftBind = keys[0];
|
||||
FlxG.save.data.rightBind = keys[3];
|
||||
|
||||
FlxG.save.data.gpupBind = gpKeys[2];
|
||||
FlxG.save.data.gpdownBind = gpKeys[1];
|
||||
FlxG.save.data.gpleftBind = gpKeys[0];
|
||||
FlxG.save.data.gprightBind = gpKeys[3];
|
||||
|
||||
FlxG.save.flush();
|
||||
|
||||
@ -217,6 +316,38 @@ class KeyBindMenu extends FlxSubState
|
||||
}
|
||||
|
||||
|
||||
function addKeyGamepad(r:String){
|
||||
|
||||
var shouldReturn:Bool = true;
|
||||
|
||||
var notAllowed:Array<String> = ["START", "RIGHT_TRIGGER", "LEFT_TRIGGER"];
|
||||
|
||||
for(x in 0...gpKeys.length)
|
||||
{
|
||||
var oK = gpKeys[x];
|
||||
if(oK == r)
|
||||
gpKeys[x] = null;
|
||||
if (notAllowed.contains(oK))
|
||||
{
|
||||
gpKeys[x] = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(shouldReturn){
|
||||
gpKeys[curSelected] = r;
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
}
|
||||
else{
|
||||
gpKeys[curSelected] = tempKey;
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
keyWarning.alpha = 1;
|
||||
warningTween.cancel();
|
||||
warningTween = FlxTween.tween(keyWarning, {alpha: 0}, 0.5, {ease: FlxEase.circOut, startDelay: 2});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function addKey(r:String){
|
||||
|
||||
var shouldReturn:Bool = true;
|
||||
@ -233,9 +364,18 @@ class KeyBindMenu extends FlxSubState
|
||||
if(oK == r)
|
||||
keys[x] = null;
|
||||
if (notAllowed.contains(oK))
|
||||
{
|
||||
keys[x] = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (r.contains("NUMPAD"))
|
||||
{
|
||||
keys[curSelected] = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if(shouldReturn){
|
||||
keys[curSelected] = r;
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
|
@ -12,6 +12,8 @@ import flixel.input.keyboard.FlxKey;
|
||||
class KeyBinds
|
||||
{
|
||||
|
||||
public static var gamepad:Bool = false;
|
||||
|
||||
public static function resetBinds():Void{
|
||||
|
||||
FlxG.save.data.upBind = "W";
|
||||
@ -19,6 +21,10 @@ class KeyBinds
|
||||
FlxG.save.data.leftBind = "A";
|
||||
FlxG.save.data.rightBind = "D";
|
||||
FlxG.save.data.killBind = "R";
|
||||
FlxG.save.data.gpupBind = "DPAD_UP";
|
||||
FlxG.save.data.gpdownBind = "DPAD_DOWN";
|
||||
FlxG.save.data.gpleftBind = "DPAD_LEFT";
|
||||
FlxG.save.data.gprightBind = "DPAD_RIGHT";
|
||||
PlayerSettings.player1.controls.loadKeyBinds();
|
||||
|
||||
}
|
||||
@ -29,22 +35,49 @@ class KeyBinds
|
||||
FlxG.save.data.upBind = "W";
|
||||
trace("No UP");
|
||||
}
|
||||
if (StringTools.contains(FlxG.save.data.upBind,"NUMPAD"))
|
||||
FlxG.save.data.upBind = "W";
|
||||
if(FlxG.save.data.downBind == null){
|
||||
FlxG.save.data.downBind = "S";
|
||||
trace("No DOWN");
|
||||
}
|
||||
if (StringTools.contains(FlxG.save.data.downBind,"NUMPAD"))
|
||||
FlxG.save.data.downBind = "S";
|
||||
if(FlxG.save.data.leftBind == null){
|
||||
FlxG.save.data.leftBind = "A";
|
||||
trace("No LEFT");
|
||||
}
|
||||
if (StringTools.contains(FlxG.save.data.leftBind,"NUMPAD"))
|
||||
FlxG.save.data.leftBind = "A";
|
||||
if(FlxG.save.data.rightBind == null){
|
||||
FlxG.save.data.rightBind = "D";
|
||||
trace("No RIGHT");
|
||||
}
|
||||
if(FlxG.save.data.killBind == null){
|
||||
if (StringTools.contains(FlxG.save.data.rightBind,"NUMPAD"))
|
||||
FlxG.save.data.rightBind = "D";
|
||||
|
||||
if(FlxG.save.data.gpupBind == null){
|
||||
FlxG.save.data.gpupBind = "DPAD_UP";
|
||||
trace("No GUP");
|
||||
}
|
||||
if(FlxG.save.data.gpdownBind == null){
|
||||
FlxG.save.data.gpdownBind = "DPAD_DOWN";
|
||||
trace("No GDOWN");
|
||||
}
|
||||
if(FlxG.save.data.gpleftBind == null){
|
||||
FlxG.save.data.gpleftBind = "DPAD_LEFT";
|
||||
trace("No GLEFT");
|
||||
}
|
||||
if(FlxG.save.data.gprightBind == null){
|
||||
FlxG.save.data.gprightBind = "DPAD_RIGHT";
|
||||
trace("No GRIGHT");
|
||||
}
|
||||
if(FlxG.save.data.killBind == null){
|
||||
FlxG.save.data.killBind = "R";
|
||||
trace("No KILL");
|
||||
}
|
||||
|
||||
trace('${FlxG.save.data.leftBind}-${FlxG.save.data.downBind}-${FlxG.save.data.upBind}-${FlxG.save.data.rightBind}');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package;
|
||||
|
||||
|
||||
import webm.WebmPlayer;
|
||||
import openfl.display.BlendMode;
|
||||
import openfl.text.TextFormat;
|
||||
import openfl.display.Application;
|
||||
@ -77,10 +75,12 @@ class Main extends Sprite
|
||||
gameHeight = Math.ceil(stageHeight / zoom);
|
||||
}
|
||||
|
||||
#if cpp
|
||||
initialState = Caching;
|
||||
|
||||
game = new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen);
|
||||
|
||||
#else
|
||||
game = new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen);
|
||||
#end
|
||||
addChild(game);
|
||||
|
||||
#if !mobile
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import Controls.KeyboardScheme;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxObject;
|
||||
@ -39,7 +40,7 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
public static var nightly:String = "";
|
||||
|
||||
public static var kadeEngineVer:String = "1.5.3" + nightly;
|
||||
public static var kadeEngineVer:String = "1.5.4" + nightly;
|
||||
public static var gameVer:String = "0.2.7.1";
|
||||
|
||||
var magenta:FlxSprite;
|
||||
@ -144,13 +145,29 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
if (!selectedSomethin)
|
||||
{
|
||||
if (controls.UP_P)
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.DPAD_UP)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_DOWN)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(-1);
|
||||
}
|
||||
|
||||
if (controls.DOWN_P)
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeItem(1);
|
||||
|
@ -99,20 +99,20 @@ class Note extends FlxSprite
|
||||
default:
|
||||
frames = Paths.getSparrowAtlas('NOTE_assets');
|
||||
|
||||
animation.addByPrefix('greenScroll', 'green0');
|
||||
animation.addByPrefix('redScroll', 'red0');
|
||||
animation.addByPrefix('blueScroll', 'blue0');
|
||||
animation.addByPrefix('purpleScroll', 'purple0');
|
||||
animation.addByPrefix('greenScroll', 'green instance 1');
|
||||
animation.addByPrefix('redScroll', 'red instance 1');
|
||||
animation.addByPrefix('blueScroll', 'blue instance 1');
|
||||
animation.addByPrefix('purpleScroll', 'purple instance 1');
|
||||
|
||||
animation.addByPrefix('purpleholdend', 'pruple end hold');
|
||||
animation.addByPrefix('greenholdend', 'green hold end');
|
||||
animation.addByPrefix('redholdend', 'red hold end');
|
||||
animation.addByPrefix('blueholdend', 'blue hold end');
|
||||
animation.addByPrefix('purpleholdend', 'pruple end hold instance 1');
|
||||
animation.addByPrefix('greenholdend', 'green hold end instance 1');
|
||||
animation.addByPrefix('redholdend', 'red hold end instance 1');
|
||||
animation.addByPrefix('blueholdend', 'blue hold end instance 1');
|
||||
|
||||
animation.addByPrefix('purplehold', 'purple hold piece');
|
||||
animation.addByPrefix('greenhold', 'green hold piece');
|
||||
animation.addByPrefix('redhold', 'red hold piece');
|
||||
animation.addByPrefix('bluehold', 'blue hold piece');
|
||||
animation.addByPrefix('purplehold', 'purple hold piece instance 1');
|
||||
animation.addByPrefix('greenhold', 'green hold piece instance 1');
|
||||
animation.addByPrefix('redhold', 'red hold piece instance 1');
|
||||
animation.addByPrefix('bluehold', 'blue hold piece instance 1');
|
||||
|
||||
setGraphicSize(Std.int(width * 0.7));
|
||||
updateHitbox();
|
||||
@ -235,4 +235,4 @@ class Note extends FlxSprite
|
||||
alpha = 0.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,10 +317,10 @@ class Judgement extends Option
|
||||
|
||||
override function getValue():String {
|
||||
return "Safe Frames: " + Conductor.safeFrames +
|
||||
" - SIK: " + HelperFunctions.truncateFloat(22 * Conductor.timeScale, 0) +
|
||||
"ms GD: " + HelperFunctions.truncateFloat(45 * Conductor.timeScale, 0) +
|
||||
" - SIK: " + HelperFunctions.truncateFloat(45 * Conductor.timeScale, 0) +
|
||||
"ms GD: " + HelperFunctions.truncateFloat(90 * Conductor.timeScale, 0) +
|
||||
"ms BD: " + HelperFunctions.truncateFloat(135 * Conductor.timeScale, 0) +
|
||||
"ms SHT: " + HelperFunctions.truncateFloat(155 * Conductor.timeScale, 0) +
|
||||
"ms SHT: " + HelperFunctions.truncateFloat(166 * Conductor.timeScale, 0) +
|
||||
"ms TOTAL: " + HelperFunctions.truncateFloat(Conductor.safeZoneOffset,0) + "ms";
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
import openfl.Lib;
|
||||
@ -150,9 +151,26 @@ class OptionsMenu extends MusicBeatState
|
||||
|
||||
changeSelection(curSelected);
|
||||
}
|
||||
if (controls.UP_P)
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.DPAD_UP)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeSelection(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_DOWN)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'));
|
||||
changeSelection(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
changeSelection(-1);
|
||||
if (controls.DOWN_P)
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
changeSelection(1);
|
||||
|
||||
if (isCat)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import openfl.Lib;
|
||||
#if windows
|
||||
import llua.Lua;
|
||||
@ -108,13 +109,22 @@ class PauseSubState extends MusicBeatSubstate
|
||||
if (PlayState.instance.useVideo)
|
||||
menuItems.remove('Resume');
|
||||
|
||||
var upP = controls.UP_P;
|
||||
var downP = controls.DOWN_P;
|
||||
var leftP = controls.LEFT_P;
|
||||
var rightP = controls.RIGHT_P;
|
||||
var accepted = controls.ACCEPT;
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
var upPcontroller:Bool = false;
|
||||
var downPcontroller:Bool = false;
|
||||
var leftPcontroller:Bool = false;
|
||||
var rightPcontroller:Bool = false;
|
||||
var oldOffset:Float = 0;
|
||||
|
||||
if (gamepad != null && KeyBinds.gamepad)
|
||||
{
|
||||
upPcontroller = gamepad.justPressed.DPAD_UP;
|
||||
downPcontroller = gamepad.justPressed.DPAD_DOWN;
|
||||
leftPcontroller = gamepad.justPressed.DPAD_LEFT;
|
||||
rightPcontroller = gamepad.justPressed.DPAD_RIGHT;
|
||||
}
|
||||
|
||||
// pre lowercasing the song name (update)
|
||||
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
|
||||
switch (songLowercase) {
|
||||
@ -123,17 +133,18 @@ class PauseSubState extends MusicBeatSubstate
|
||||
}
|
||||
var songPath = 'assets/data/' + songLowercase + '/';
|
||||
|
||||
if (upP)
|
||||
if (controls.UP_P || upPcontroller)
|
||||
{
|
||||
changeSelection(-1);
|
||||
|
||||
}else if (downP)
|
||||
}
|
||||
else if (controls.DOWN_P || downPcontroller)
|
||||
{
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
#if cpp
|
||||
else if (leftP)
|
||||
else if (controls.LEFT_P || leftPcontroller)
|
||||
{
|
||||
oldOffset = PlayState.songOffset;
|
||||
PlayState.songOffset -= 1;
|
||||
@ -160,7 +171,8 @@ class PauseSubState extends MusicBeatSubstate
|
||||
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
|
||||
offsetChanged = true;
|
||||
}
|
||||
}else if (rightP)
|
||||
}
|
||||
else if (controls.RIGHT_P || rightPcontroller)
|
||||
{
|
||||
oldOffset = PlayState.songOffset;
|
||||
PlayState.songOffset += 1;
|
||||
@ -188,7 +200,7 @@ class PauseSubState extends MusicBeatSubstate
|
||||
}
|
||||
#end
|
||||
|
||||
if (accepted)
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
var daSelected:String = menuItems[curSelected];
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
package;
|
||||
|
||||
import openfl.ui.KeyLocation;
|
||||
import openfl.events.Event;
|
||||
import haxe.EnumTools;
|
||||
import openfl.ui.Keyboard;
|
||||
import openfl.events.KeyboardEvent;
|
||||
import Replay.Ana;
|
||||
import Replay.Analysis;
|
||||
#if cpp
|
||||
import webm.WebmPlayer;
|
||||
#end
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
import haxe.Exception;
|
||||
import openfl.geom.Matrix;
|
||||
@ -250,6 +253,8 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
misses = 0;
|
||||
|
||||
|
||||
highestCombo = 0;
|
||||
repPresses = 0;
|
||||
repReleases = 0;
|
||||
|
||||
@ -996,7 +1001,7 @@ class PlayState extends MusicBeatState
|
||||
add(healthBar);
|
||||
|
||||
// Add Kade Engine watermark
|
||||
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " " + CoolUtil.difficultyFromInt(storyDifficulty) + (Main.watermarks ? " - KE " + MainMenuState.kadeEngineVer : ""), 16);
|
||||
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " - " + CoolUtil.difficultyFromInt(storyDifficulty) + (Main.watermarks ? " | KE " + MainMenuState.kadeEngineVer : ""), 16);
|
||||
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
|
||||
kadeEngineWatermark.scrollFactor.set();
|
||||
add(kadeEngineWatermark);
|
||||
@ -1124,6 +1129,7 @@ class PlayState extends MusicBeatState
|
||||
rep = new Replay("na");
|
||||
|
||||
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.addEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
|
||||
super.create();
|
||||
}
|
||||
@ -1353,24 +1359,94 @@ class PlayState extends MusicBeatState
|
||||
var songTime:Float = 0;
|
||||
|
||||
|
||||
private function getKey(charCode:Int):String
|
||||
{
|
||||
for (key => value in FlxKey.fromStringMap)
|
||||
{
|
||||
if (charCode == value)
|
||||
return key;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var keys = [false,false,false,false];
|
||||
|
||||
private function releaseInput(evt:KeyboardEvent):Void // handles releases
|
||||
{
|
||||
@:privateAccess
|
||||
var key = FlxKey.toStringMap.get(Keyboard.__convertKeyCode(evt.keyCode));
|
||||
|
||||
var binds:Array<String> = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind];
|
||||
|
||||
var data = -1;
|
||||
|
||||
switch(evt.keyCode) // arrow keys
|
||||
{
|
||||
case 37:
|
||||
data = 0;
|
||||
case 40:
|
||||
data = 1;
|
||||
case 38:
|
||||
data = 2;
|
||||
case 39:
|
||||
data = 3;
|
||||
}
|
||||
|
||||
for (i in 0...binds.length) // binds
|
||||
{
|
||||
if (binds[i].toLowerCase() == key.toLowerCase())
|
||||
data = i;
|
||||
}
|
||||
|
||||
if (data == -1)
|
||||
return;
|
||||
|
||||
keys[data] = false;
|
||||
}
|
||||
|
||||
private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs
|
||||
|
||||
if (PlayStateChangeables.botPlay || loadRep || paused)
|
||||
return;
|
||||
|
||||
var key = String.fromCharCode(evt.charCode);
|
||||
// first convert it from openfl to a flixel key code
|
||||
// then use FlxKey to get the key's name based off of the FlxKey dictionary
|
||||
// this makes it work for special characters
|
||||
|
||||
@:privateAccess
|
||||
var key = FlxKey.toStringMap.get(Keyboard.__convertKeyCode(evt.keyCode));
|
||||
|
||||
var binds:Array<String> = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind];
|
||||
|
||||
var data = -1;
|
||||
|
||||
switch(evt.keyCode) // arrow keys
|
||||
{
|
||||
case 37:
|
||||
data = 0;
|
||||
case 40:
|
||||
data = 1;
|
||||
case 38:
|
||||
data = 2;
|
||||
case 39:
|
||||
data = 3;
|
||||
}
|
||||
|
||||
for (i in 0...binds.length)
|
||||
if (binds[i].toLowerCase() == key)
|
||||
for (i in 0...binds.length) // binds
|
||||
{
|
||||
if (binds[i].toLowerCase() == key.toLowerCase())
|
||||
data = i;
|
||||
|
||||
}
|
||||
if (data == -1)
|
||||
return;
|
||||
|
||||
if (keys[data])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
keys[data] = true;
|
||||
|
||||
var ana = new Ana(Conductor.songPosition, null, false, "miss", data);
|
||||
|
||||
var dataNotes = [];
|
||||
@ -1382,7 +1458,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
|
||||
dataNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); // sort by the earliest note
|
||||
|
||||
|
||||
if (dataNotes.length != 0)
|
||||
{
|
||||
var coolNote = dataNotes[0];
|
||||
@ -1555,6 +1631,18 @@ class PlayState extends MusicBeatState
|
||||
swagNote.sustainLength = songNotes[2];
|
||||
swagNote.scrollFactor.set(0, 0);
|
||||
|
||||
var addNote = false;
|
||||
|
||||
for (i in unspawnNotes)
|
||||
if (i.strumTime == daStrumTime && i.noteData == daNoteData)
|
||||
addNote = true;
|
||||
|
||||
if (addNote)
|
||||
{
|
||||
trace('stacked note, thats cringe');
|
||||
continue;
|
||||
}
|
||||
|
||||
var susLength:Float = swagNote.sustainLength;
|
||||
|
||||
susLength = susLength / Conductor.stepCrochet;
|
||||
@ -1656,73 +1744,73 @@ class PlayState extends MusicBeatState
|
||||
babyArrow.animation.add('confirm', [12, 16], 24, false);
|
||||
}
|
||||
|
||||
case 'normal':
|
||||
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets');
|
||||
babyArrow.animation.addByPrefix('green', 'arrowUP');
|
||||
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
|
||||
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
|
||||
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
|
||||
|
||||
babyArrow.antialiasing = true;
|
||||
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
|
||||
|
||||
switch (Math.abs(i))
|
||||
{
|
||||
case 0:
|
||||
babyArrow.x += Note.swagWidth * 0;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
|
||||
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
|
||||
case 1:
|
||||
babyArrow.x += Note.swagWidth * 1;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
|
||||
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
|
||||
case 2:
|
||||
babyArrow.x += Note.swagWidth * 2;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowUP');
|
||||
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
|
||||
case 3:
|
||||
babyArrow.x += Note.swagWidth * 3;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
|
||||
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
|
||||
}
|
||||
case 'normal':
|
||||
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets');
|
||||
babyArrow.animation.addByPrefix('green', 'arrow static instance 1');
|
||||
babyArrow.animation.addByPrefix('blue', 'arrow static instance 2');
|
||||
babyArrow.animation.addByPrefix('purple', 'arrow static instance 3');
|
||||
babyArrow.animation.addByPrefix('red', 'arrow static instance 4');
|
||||
|
||||
default:
|
||||
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets');
|
||||
babyArrow.animation.addByPrefix('green', 'arrowUP');
|
||||
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
|
||||
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
|
||||
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
|
||||
babyArrow.antialiasing = true;
|
||||
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
|
||||
|
||||
babyArrow.antialiasing = true;
|
||||
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
|
||||
|
||||
switch (Math.abs(i))
|
||||
{
|
||||
case 0:
|
||||
babyArrow.x += Note.swagWidth * 0;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
|
||||
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
|
||||
case 1:
|
||||
babyArrow.x += Note.swagWidth * 1;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
|
||||
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
|
||||
case 2:
|
||||
babyArrow.x += Note.swagWidth * 2;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowUP');
|
||||
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
|
||||
case 3:
|
||||
babyArrow.x += Note.swagWidth * 3;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
|
||||
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
|
||||
switch (Math.abs(i))
|
||||
{
|
||||
case 0:
|
||||
babyArrow.x += Note.swagWidth * 0;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 1');
|
||||
babyArrow.animation.addByPrefix('pressed', 'left press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'left confirm instance 1', 24, false);
|
||||
case 1:
|
||||
babyArrow.x += Note.swagWidth * 1;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 2');
|
||||
babyArrow.animation.addByPrefix('pressed', 'down press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'down confirm instance 1', 24, false);
|
||||
case 2:
|
||||
babyArrow.x += Note.swagWidth * 2;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 4');
|
||||
babyArrow.animation.addByPrefix('pressed', 'up press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'up confirm instance 1', 24, false);
|
||||
case 3:
|
||||
babyArrow.x += Note.swagWidth * 3;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 3');
|
||||
babyArrow.animation.addByPrefix('pressed', 'right press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'right confirm instance 1', 24, false);
|
||||
}
|
||||
|
||||
default:
|
||||
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets');
|
||||
babyArrow.animation.addByPrefix('green', 'arrow static instance 1');
|
||||
babyArrow.animation.addByPrefix('blue', 'arrow static instance 2');
|
||||
babyArrow.animation.addByPrefix('purple', 'arrow static instance 3');
|
||||
babyArrow.animation.addByPrefix('red', 'arrow static instance 4');
|
||||
|
||||
babyArrow.antialiasing = true;
|
||||
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
|
||||
|
||||
switch (Math.abs(i))
|
||||
{
|
||||
case 0:
|
||||
babyArrow.x += Note.swagWidth * 0;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 1');
|
||||
babyArrow.animation.addByPrefix('pressed', 'left press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'left confirm instance 1', 24, false);
|
||||
case 1:
|
||||
babyArrow.x += Note.swagWidth * 1;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 2');
|
||||
babyArrow.animation.addByPrefix('pressed', 'down press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'down confirm instance 1', 24, false);
|
||||
case 2:
|
||||
babyArrow.x += Note.swagWidth * 2;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 4');
|
||||
babyArrow.animation.addByPrefix('pressed', 'up press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'up confirm instance 1', 24, false);
|
||||
case 3:
|
||||
babyArrow.x += Note.swagWidth * 3;
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 3');
|
||||
babyArrow.animation.addByPrefix('pressed', 'right press instance 1', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'right confirm instance 1', 24, false);
|
||||
}
|
||||
}
|
||||
|
||||
babyArrow.updateHitbox();
|
||||
@ -1970,7 +2058,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
scoreTxt.x = (originalX - (lengthInPx / 2)) + 335;
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
|
||||
if (controls.PAUSE && startedCountdown && canPause)
|
||||
{
|
||||
persistentUpdate = false;
|
||||
persistentDraw = true;
|
||||
@ -1986,6 +2074,7 @@ class PlayState extends MusicBeatState
|
||||
openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
|
||||
}
|
||||
|
||||
|
||||
if (FlxG.keys.justPressed.SEVEN)
|
||||
{
|
||||
if (useVideo)
|
||||
@ -2001,6 +2090,7 @@ class PlayState extends MusicBeatState
|
||||
#end
|
||||
FlxG.switchState(new ChartingState());
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
#if windows
|
||||
if (luaModchart != null)
|
||||
{
|
||||
@ -2053,6 +2143,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
FlxG.switchState(new AnimationDebug(SONG.player2));
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
#if windows
|
||||
if (luaModchart != null)
|
||||
{
|
||||
@ -2066,6 +2157,7 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
FlxG.switchState(new AnimationDebug(SONG.player1));
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
#if windows
|
||||
if (luaModchart != null)
|
||||
{
|
||||
@ -2620,6 +2712,7 @@ class PlayState extends MusicBeatState
|
||||
function endSong():Void
|
||||
{
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
|
||||
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput);
|
||||
if (useVideo)
|
||||
{
|
||||
GlobalVideo.get().stop();
|
||||
@ -2817,7 +2910,7 @@ class PlayState extends MusicBeatState
|
||||
ss = false;
|
||||
shits++;
|
||||
if (FlxG.save.data.accuracyMod == 0)
|
||||
totalNotesHit += 0.25;
|
||||
totalNotesHit -= 1;
|
||||
case 'bad':
|
||||
daRating = 'bad';
|
||||
score = 0;
|
||||
@ -3078,7 +3171,7 @@ class PlayState extends MusicBeatState
|
||||
var rightHold:Bool = false;
|
||||
var leftHold:Bool = false;
|
||||
|
||||
// THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY
|
||||
// THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY (also gamepad shit)
|
||||
|
||||
private function keyShit():Void // I've invested in emma stocks
|
||||
{
|
||||
@ -3104,6 +3197,9 @@ class PlayState extends MusicBeatState
|
||||
if (controls.RIGHT_P){luaModchart.executeState('keyPressed',["right"]);};
|
||||
};
|
||||
#end
|
||||
|
||||
var nonCpp = false;
|
||||
|
||||
|
||||
// Prevent player input if botplay is on
|
||||
if(PlayStateChangeables.botPlay)
|
||||
@ -3113,11 +3209,15 @@ class PlayState extends MusicBeatState
|
||||
releaseArray = [false, false, false, false];
|
||||
}
|
||||
|
||||
#if !cpp
|
||||
nonCpp = true;
|
||||
#end
|
||||
|
||||
var anas:Array<Ana> = [null,null,null,null];
|
||||
|
||||
/*for (i in 0...pressArray.length)
|
||||
for (i in 0...pressArray.length)
|
||||
if (pressArray[i])
|
||||
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);*/
|
||||
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);
|
||||
|
||||
// HOLDS, check for sustain notes
|
||||
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
|
||||
@ -3129,103 +3229,98 @@ class PlayState extends MusicBeatState
|
||||
});
|
||||
}
|
||||
|
||||
// PRESSES, check for note hits
|
||||
/*if (pressArray.contains(true) && generatedMusic)
|
||||
if ((KeyBinds.gamepad && !FlxG.keys.justPressed.ANY) || nonCpp)
|
||||
{
|
||||
boyfriend.holdTimer = 0;
|
||||
|
||||
var possibleNotes:Array<Note> = []; // notes that can be hit
|
||||
var directionList:Array<Int> = []; // directions that can be hit
|
||||
var dumbNotes:Array<Note> = []; // notes to kill later
|
||||
var directionsAccounted:Array<Bool> = [false,false,false,false]; // we don't want to do judgments for more than one presses
|
||||
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
// PRESSES, check for note hits
|
||||
if (pressArray.contains(true) && generatedMusic)
|
||||
{
|
||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
|
||||
{
|
||||
if (!directionsAccounted[daNote.noteData])
|
||||
boyfriend.holdTimer = 0;
|
||||
|
||||
var possibleNotes:Array<Note> = []; // notes that can be hit
|
||||
var directionList:Array<Int> = []; // directions that can be hit
|
||||
var dumbNotes:Array<Note> = []; // notes to kill later
|
||||
var directionsAccounted:Array<Bool> = [false,false,false,false]; // we don't want to do judgments for more than one presses
|
||||
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
if (directionList.contains(daNote.noteData))
|
||||
{
|
||||
directionsAccounted[daNote.noteData] = true;
|
||||
for (coolNote in possibleNotes)
|
||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit && !directionsAccounted[daNote.noteData])
|
||||
{
|
||||
if (directionList.contains(daNote.noteData))
|
||||
{
|
||||
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
|
||||
{ // if it's the same note twice at < 10ms distance, just delete it
|
||||
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
|
||||
dumbNotes.push(daNote);
|
||||
break;
|
||||
}
|
||||
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
|
||||
{ // if daNote is earlier than existing note (coolNote), replace
|
||||
possibleNotes.remove(coolNote);
|
||||
possibleNotes.push(daNote);
|
||||
break;
|
||||
directionsAccounted[daNote.noteData] = true;
|
||||
for (coolNote in possibleNotes)
|
||||
{
|
||||
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
|
||||
{ // if it's the same note twice at < 10ms distance, just delete it
|
||||
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
|
||||
dumbNotes.push(daNote);
|
||||
break;
|
||||
}
|
||||
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
|
||||
{ // if daNote is earlier than existing note (coolNote), replace
|
||||
possibleNotes.remove(coolNote);
|
||||
possibleNotes.push(daNote);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
possibleNotes.push(daNote);
|
||||
directionList.push(daNote.noteData);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
trace('notes that can be hit: ' + possibleNotes.length);
|
||||
|
||||
for (note in dumbNotes)
|
||||
{
|
||||
FlxG.log.add("killing dumb ass note at " + note.strumTime);
|
||||
note.kill();
|
||||
notes.remove(note, true);
|
||||
note.destroy();
|
||||
}
|
||||
|
||||
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
|
||||
if (perfectMode)
|
||||
goodNoteHit(possibleNotes[0]);
|
||||
else if (possibleNotes.length > 0)
|
||||
{
|
||||
if (!FlxG.save.data.ghost)
|
||||
{
|
||||
for (shit in 0...pressArray.length)
|
||||
{ // if a direction is hit that shouldn't be
|
||||
if (pressArray[shit] && !directionList.contains(shit))
|
||||
noteMiss(shit, null);
|
||||
else
|
||||
{
|
||||
possibleNotes.push(daNote);
|
||||
directionList.push(daNote.noteData);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (coolNote in possibleNotes)
|
||||
});
|
||||
|
||||
for (note in dumbNotes)
|
||||
{
|
||||
if (pressArray[coolNote.noteData])
|
||||
FlxG.log.add("killing dumb ass note at " + note.strumTime);
|
||||
note.kill();
|
||||
notes.remove(note, true);
|
||||
note.destroy();
|
||||
}
|
||||
|
||||
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
if (perfectMode)
|
||||
goodNoteHit(possibleNotes[0]);
|
||||
else if (possibleNotes.length > 0)
|
||||
{
|
||||
if (!FlxG.save.data.ghost)
|
||||
{
|
||||
if (mashViolations != 0)
|
||||
mashViolations--;
|
||||
scoreTxt.color = FlxColor.WHITE;
|
||||
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
|
||||
anas[coolNote.noteData].hit = true;
|
||||
anas[coolNote.noteData].hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
|
||||
anas[coolNote.noteData].nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
|
||||
goodNoteHit(coolNote);
|
||||
for (shit in 0...pressArray.length)
|
||||
{ // if a direction is hit that shouldn't be
|
||||
if (pressArray[shit] && !directionList.contains(shit))
|
||||
noteMiss(shit, null);
|
||||
}
|
||||
}
|
||||
for (coolNote in possibleNotes)
|
||||
{
|
||||
if (pressArray[coolNote.noteData])
|
||||
{
|
||||
if (mashViolations != 0)
|
||||
mashViolations--;
|
||||
scoreTxt.color = FlxColor.WHITE;
|
||||
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
|
||||
anas[coolNote.noteData].hit = true;
|
||||
anas[coolNote.noteData].hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
|
||||
anas[coolNote.noteData].nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
|
||||
goodNoteHit(coolNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!FlxG.save.data.ghost)
|
||||
{
|
||||
for (shit in 0...pressArray.length)
|
||||
if (pressArray[shit])
|
||||
noteMiss(shit, null);
|
||||
}
|
||||
}
|
||||
else if (!FlxG.save.data.ghost)
|
||||
{
|
||||
for (shit in 0...pressArray.length)
|
||||
if (pressArray[shit])
|
||||
noteMiss(shit, null);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
/*if (!loadRep)
|
||||
for (i in anas)
|
||||
if (i != null)
|
||||
replayAna.anaArray.push(i); // put em all there*/
|
||||
|
||||
if (!loadRep)
|
||||
for (i in anas)
|
||||
if (i != null)
|
||||
replayAna.anaArray.push(i); // put em all there
|
||||
}
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
if(PlayStateChangeables.useDownscroll && daNote.y > strumLine.y ||
|
||||
@ -3331,6 +3426,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
public function backgroundVideo(source:String) // for background videos
|
||||
{
|
||||
#if cpp
|
||||
useVideo = true;
|
||||
|
||||
FlxG.stage.window.onFocusOut.add(focusOut);
|
||||
@ -3381,6 +3477,7 @@ class PlayState extends MusicBeatState
|
||||
webmHandler.pause();
|
||||
else
|
||||
webmHandler.resume();
|
||||
#end
|
||||
}
|
||||
|
||||
function noteMiss(direction:Int = 1, daNote:Note):Void
|
||||
|
@ -82,7 +82,7 @@ class ResultsScreen extends FlxSubState
|
||||
comboText.scrollFactor.set();
|
||||
add(comboText);
|
||||
|
||||
contText = new FlxText(FlxG.width - 475,FlxG.height + 50,0,'Press ENTER to continue.');
|
||||
contText = new FlxText(FlxG.width - 475,FlxG.height + 50,0,'Press ${KeyBinds.gamepad ? 'A' : 'ENTER'} to continue.');
|
||||
contText.size = 28;
|
||||
contText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
|
||||
contText.color = FlxColor.WHITE;
|
||||
@ -172,7 +172,7 @@ class ResultsScreen extends FlxSubState
|
||||
|
||||
// keybinds
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER)
|
||||
if (PlayerSettings.player1.controls.ACCEPT)
|
||||
{
|
||||
music.fadeOut(0.3);
|
||||
|
||||
@ -199,12 +199,6 @@ class ResultsScreen extends FlxSubState
|
||||
FlxG.switchState(new FreeplayState());
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.EIGHT)
|
||||
{
|
||||
graph.showInput = !graph.showInput;
|
||||
graph.update();
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.F1)
|
||||
{
|
||||
trace(PlayState.rep.path);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
@ -239,12 +240,44 @@ class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
if (!selectedWeek)
|
||||
{
|
||||
if (controls.UP_P)
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.DPAD_UP)
|
||||
{
|
||||
changeWeek(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_DOWN)
|
||||
{
|
||||
changeWeek(1);
|
||||
}
|
||||
|
||||
if (gamepad.pressed.DPAD_RIGHT)
|
||||
rightArrow.animation.play('press')
|
||||
else
|
||||
rightArrow.animation.play('idle');
|
||||
if (gamepad.pressed.DPAD_LEFT)
|
||||
leftArrow.animation.play('press');
|
||||
else
|
||||
leftArrow.animation.play('idle');
|
||||
|
||||
if (gamepad.justPressed.DPAD_RIGHT)
|
||||
{
|
||||
changeDifficulty(1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_LEFT)
|
||||
{
|
||||
changeDifficulty(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
{
|
||||
changeWeek(-1);
|
||||
}
|
||||
|
||||
if (controls.DOWN_P)
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
{
|
||||
changeWeek(1);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package;
|
||||
|
||||
#if sys
|
||||
import smTools.SMFile;
|
||||
#end
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
@ -77,6 +80,8 @@ class TitleState extends MusicBeatState
|
||||
|
||||
curWacky = FlxG.random.getObject(getIntroTextShit());
|
||||
|
||||
trace('hello');
|
||||
|
||||
// DEBUG BULLSHIT
|
||||
|
||||
super.create();
|
||||
@ -92,6 +97,9 @@ class TitleState extends MusicBeatState
|
||||
|
||||
KadeEngineData.initSave();
|
||||
|
||||
// var file:SMFile = SMFile.loadFile("file.sm");
|
||||
// this was testing things
|
||||
|
||||
Highscore.load();
|
||||
|
||||
#if FREEPLAY
|
||||
@ -257,7 +265,7 @@ class TitleState extends MusicBeatState
|
||||
FlxG.fullscreen = !FlxG.fullscreen;
|
||||
}
|
||||
|
||||
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
|
||||
var pressedEnter:Bool = controls.ACCEPT;
|
||||
|
||||
#if mobile
|
||||
for (touch in FlxG.touches.list)
|
||||
@ -269,19 +277,6 @@ class TitleState extends MusicBeatState
|
||||
}
|
||||
#end
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.START)
|
||||
pressedEnter = true;
|
||||
|
||||
#if switch
|
||||
if (gamepad.justPressed.B)
|
||||
pressedEnter = true;
|
||||
#end
|
||||
}
|
||||
|
||||
if (pressedEnter && !transitioning && skippedIntro)
|
||||
{
|
||||
#if !switch
|
||||
|
61
source/smTools/SMFile.hx
Normal file
61
source/smTools/SMFile.hx
Normal file
@ -0,0 +1,61 @@
|
||||
#if sys
|
||||
package smTools;
|
||||
|
||||
import sys.io.File;
|
||||
|
||||
class SMFile
|
||||
{
|
||||
public static function loadFile(path):SMFile
|
||||
{
|
||||
return new SMFile(File.getContent(path).split('\n'));
|
||||
}
|
||||
|
||||
private var _fileData:Array<String>;
|
||||
|
||||
public var _readTime:Float = 0;
|
||||
|
||||
public var header:SMHeader;
|
||||
public var measures:Array<SMMeasure>;
|
||||
|
||||
public function new(data:Array<String>)
|
||||
{
|
||||
_fileData = data;
|
||||
|
||||
// Gather header data
|
||||
var headerData = "";
|
||||
var inc = 0;
|
||||
while(!StringTools.contains(data[inc + 1],"//"))
|
||||
{
|
||||
headerData += data[inc] + "\n";
|
||||
inc++;
|
||||
// trace(data[inc]);
|
||||
}
|
||||
|
||||
header = new SMHeader(headerData.split('\n'));
|
||||
|
||||
// check if this is a valid file, it should be a dance double file.
|
||||
inc += 3; // skip three lines down
|
||||
if (!StringTools.contains(data[inc],"dance-double:"))
|
||||
return;
|
||||
trace('this is dance double');
|
||||
|
||||
inc += 4; // skip 5 down to where da notes @
|
||||
trace(data[inc]);
|
||||
|
||||
measures = [];
|
||||
|
||||
while(data[inc + 1] != ";")
|
||||
{
|
||||
var measure = "";
|
||||
while(data[inc + 1] != ",")
|
||||
{
|
||||
inc++;
|
||||
var line = data[inc];
|
||||
measure += line + "\n";
|
||||
}
|
||||
measures.push(new SMMeasure(measure.split('\n')));
|
||||
}
|
||||
trace(measures.length + " Measures");
|
||||
}
|
||||
}
|
||||
#end
|
39
source/smTools/SMHeader.hx
Normal file
39
source/smTools/SMHeader.hx
Normal file
@ -0,0 +1,39 @@
|
||||
#if sys
|
||||
package smTools;
|
||||
|
||||
class SMHeader
|
||||
{
|
||||
private var _header:Array<String>;
|
||||
|
||||
public var TITLE = "";
|
||||
public var SUBTITLE = "";
|
||||
public var ARTIST = "";
|
||||
public var GENRE = "";
|
||||
public var CREDIT = "";
|
||||
public var MUSIC = "";
|
||||
public var BANNER = "";
|
||||
public var BACKGROUND = "";
|
||||
public var CDTITLE = "";
|
||||
public var OFFSET = "";
|
||||
public var BPMS = "";
|
||||
|
||||
public function new(headerData:Array<String>)
|
||||
{
|
||||
_header = headerData;
|
||||
for (i in headerData)
|
||||
readHeaderLine(i);
|
||||
}
|
||||
|
||||
function readHeaderLine(line:String)
|
||||
{
|
||||
var propName = line.split('#')[1].split(':')[0];
|
||||
var value = line.split(':')[1].split(';')[0];
|
||||
var prop = Reflect.getProperty(this,propName);
|
||||
|
||||
if (prop != null)
|
||||
{
|
||||
Reflect.setProperty(this,propName,value);
|
||||
}
|
||||
}
|
||||
}
|
||||
#end
|
16
source/smTools/SMMeasure.hx
Normal file
16
source/smTools/SMMeasure.hx
Normal file
@ -0,0 +1,16 @@
|
||||
#if sys
|
||||
package smTools;
|
||||
|
||||
class SMMeasure
|
||||
{
|
||||
public var notes:Array<SMNote>;
|
||||
|
||||
private var _measure:Array<String>;
|
||||
|
||||
public function new(measureData:Array<String>)
|
||||
{
|
||||
_measure = measureData;
|
||||
notes = [];
|
||||
}
|
||||
}
|
||||
#end
|
10
source/smTools/SMNote.hx
Normal file
10
source/smTools/SMNote.hx
Normal file
@ -0,0 +1,10 @@
|
||||
#if sys
|
||||
package smTools;
|
||||
|
||||
class SMNote
|
||||
{
|
||||
public var time:Float;
|
||||
public var data:Int;
|
||||
public var length:Float;
|
||||
}
|
||||
#end
|
Reference in New Issue
Block a user