merge conflict thingy

This commit is contained in:
daniel11420 2021-06-24 08:39:11 +02:00
commit 746fa0afba
21 changed files with 378 additions and 20 deletions

View File

@ -31,6 +31,8 @@ install:
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib run lime rebuild extension-webm linux
- haxelib install linc_luajit
- haxelib install actuate
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib list
- cd /home/appveyor/projects/kade-engine-linux

View File

@ -31,6 +31,8 @@ install:
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib run lime rebuild extension-webm macos
- haxelib install linc_luajit
- haxelib install actuate
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib list
- cd /Users/appveyor/projects/kade-engine-macos

View File

@ -18,6 +18,7 @@ install:
- haxelib setup "%HAXELIB_ROOT%"
# Install project dependencies
- haxelib install lime 7.9.0
- RefreshEnv
- haxelib install openfl
- haxelib install flixel
- haxelib run lime setup flixel
@ -35,6 +36,9 @@ install:
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib run lime rebuild extension-webm windows
- haxelib install linc_luajit
- haxelib install actuate
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- lime rebuild extension-webm windows
- haxelib list
# No tests idk lol

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -237,7 +237,7 @@ class HitGraph extends Sprite
/*if (i == 0)
gfx.moveTo(graphX, _axis.y + pointY);*/
gfx.drawRect(graphX + fitX(history[i][2]), pointY,4,4);
gfx.drawRect(fitX(history[i][2]), pointY,4,4);
gfx.endFill();
}

View File

@ -90,6 +90,9 @@ class KadeEngineData
if (FlxG.save.data.inputShow == null)
FlxG.save.data.inputShow = false;
if (FlxG.save.data.optimize == null)
FlxG.save.data.optimize = false;
Conductor.recalculateTimings();
PlayerSettings.player1.controls.loadKeyBinds();
KeyBinds.keyCheck();

View File

@ -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

View File

@ -504,6 +504,27 @@ class RainbowFPSOption extends Option
}
}
class Optimization extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.optimize = !FlxG.save.data.optimize;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Optimization " + (FlxG.save.data.optimize ? "ON" : "OFF");
}
}
class NPSDisplayOption extends Option
{
public function new(desc:String)

View File

@ -57,9 +57,10 @@ class OptionsMenu extends MusicBeatState
#end
new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."),
new WatermarkOption("Enable and disable all watermarks from the engine."),
new BotPlay("Showcase your charts and mods with autoplay."),
new ScoreScreen("Show the score screen after the end of a song"),
new ShowInput("Display every single input in the score screen.")
new ShowInput("Display every single input in the score screen."),
new Optimization("No backgrounds, no characters, centered notes, no player 2."),
new BotPlay("Showcase your charts and mods with autoplay."),
])
];

View File

@ -1,8 +1,14 @@
package;
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;
@ -254,7 +260,7 @@ class PlayState extends MusicBeatState
PlayStateChangeables.safeFrames = FlxG.save.data.frames;
PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed;
PlayStateChangeables.botPlay = FlxG.save.data.botplay;
PlayStateChangeables.Optimize = FlxG.save.data.optimize;
// pre lowercasing the song name (create)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
@ -267,6 +273,8 @@ class PlayState extends MusicBeatState
#if windows
executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart"));
if (executeModchart)
PlayStateChangeables.Optimize = false;
#end
#if !cpp
executeModchart = false; // FORCE disable for non cpp targets
@ -373,6 +381,9 @@ class PlayState extends MusicBeatState
}
} else {stageCheck = SONG.stage;}
if (!PlayStateChangeables.Optimize)
{
switch(stageCheck)
{
case 'halloween':
@ -752,7 +763,7 @@ class PlayState extends MusicBeatState
add(stageCurtains);
}
}
}
//defaults if no gf was found in chart
var gfCheck:String = 'gf';
@ -777,7 +788,7 @@ class PlayState extends MusicBeatState
default:
curGf = 'gf';
}
gf = new Character(400, 130, curGf);
gf.scrollFactor.set(0.95, 0.95);
@ -866,14 +877,19 @@ class PlayState extends MusicBeatState
gf.y += 300;
}
add(gf);
if (!PlayStateChangeables.Optimize)
{
add(gf);
// Shitty layering but whatev it works LOL
if (curStage == 'limo')
add(limo);
add(dad);
add(boyfriend);
}
// Shitty layering but whatev it works LOL
if (curStage == 'limo')
add(limo);
add(dad);
add(boyfriend);
if (loadRep)
{
FlxG.watch.addQuick('rep rpesses',repPresses);
@ -982,7 +998,11 @@ class PlayState extends MusicBeatState
add(healthBar);
// Add Kade Engine watermark
<<<<<<< HEAD
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);
>>>>>>> origin/master
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
kadeEngineWatermark.scrollFactor.set();
add(kadeEngineWatermark);
@ -1109,6 +1129,8 @@ class PlayState extends MusicBeatState
if (!loadRep)
rep = new Replay("na");
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN,handleInput);
super.create();
}
@ -1337,6 +1359,79 @@ 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;
}
private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs
if (PlayStateChangeables.botPlay || loadRep || paused)
return;
// 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) // binds
{
if (binds[i].toLowerCase() == key.toLowerCase())
data = i;
}
if (data == -1)
return;
var ana = new Ana(Conductor.songPosition, null, false, "miss", data);
var dataNotes = [];
notes.forEachAlive(function(daNote:Note)
{
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit && daNote.noteData == data)
dataNotes.push(daNote);
}); // Collect notes that can be hit
dataNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); // sort by the earliest note
if (dataNotes.length != 0)
{
var coolNote = dataNotes[0];
goodNoteHit(coolNote);
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
ana.hit = true;
ana.hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
ana.nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
}
}
var songStarted = false;
function startSong():Void
@ -1489,6 +1584,10 @@ class PlayState extends MusicBeatState
oldNote = null;
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
if (!gottaHitNote && PlayStateChangeables.Optimize)
continue;
swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0);
@ -1549,6 +1648,9 @@ class PlayState extends MusicBeatState
//defaults if no noteStyle was found in chart
var noteTypeCheck:String = 'normal';
if (PlayStateChangeables.Optimize && player == 0)
continue;
if (SONG.noteStyle == null) {
switch(storyWeek) {case 6: noteTypeCheck = 'pixel';}
} else {noteTypeCheck = SONG.noteStyle;}
@ -1683,6 +1785,9 @@ class PlayState extends MusicBeatState
babyArrow.x += 50;
babyArrow.x += ((FlxG.width / 2) * player);
if (PlayStateChangeables.Optimize)
babyArrow.x -= 275;
cpuStrums.forEach(function(spr:FlxSprite)
{
spr.centerOffsets(); //CPU arrows start out slightly off-center
@ -1880,7 +1985,7 @@ class PlayState extends MusicBeatState
switch (curStage)
{
case 'philly':
if (trainMoving)
if (trainMoving && !PlayStateChangeables.Optimize)
{
trainFrameTiming += elapsed;
@ -1931,6 +2036,7 @@ class PlayState extends MusicBeatState
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
FlxG.switchState(new ChartingState());
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
#if windows
if (luaModchart != null)
{
@ -1982,6 +2088,7 @@ class PlayState extends MusicBeatState
}
FlxG.switchState(new AnimationDebug(SONG.player2));
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
#if windows
if (luaModchart != null)
{
@ -1994,6 +2101,7 @@ class PlayState extends MusicBeatState
if (FlxG.keys.justPressed.ZERO)
{
FlxG.switchState(new AnimationDebug(SONG.player1));
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
#if windows
if (luaModchart != null)
{
@ -2547,6 +2655,7 @@ class PlayState extends MusicBeatState
function endSong():Void
{
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput);
if (useVideo)
{
GlobalVideo.get().stop();
@ -2748,7 +2857,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;
@ -3009,6 +3118,8 @@ class PlayState extends MusicBeatState
var rightHold:Bool = false;
var leftHold:Bool = false;
// THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY
private function keyShit():Void // I've invested in emma stocks
{
// control arrays, order L D R U
@ -3033,7 +3144,10 @@ class PlayState extends MusicBeatState
if (controls.RIGHT_P){luaModchart.executeState('keyPressed',["right"]);};
};
#end
<<<<<<< HEAD
=======
>>>>>>> origin/master
// Prevent player input if botplay is on
if(PlayStateChangeables.botPlay)
@ -3045,9 +3159,15 @@ class PlayState extends MusicBeatState
var anas:Array<Ana> = [null,null,null,null];
<<<<<<< HEAD
for (i in 0...pressArray.length)
if (pressArray[i])
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);
=======
/*for (i in 0...pressArray.length)
if (pressArray[i])
anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i);*/
>>>>>>> origin/master
// HOLDS, check for sustain notes
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
@ -3060,7 +3180,7 @@ class PlayState extends MusicBeatState
}
// PRESSES, check for note hits
if (pressArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
/*if (pressArray.contains(true) && generatedMusic)
{
boyfriend.holdTimer = 0;
@ -3075,13 +3195,42 @@ class PlayState extends MusicBeatState
{
if (!directionsAccounted[daNote.noteData])
{
<<<<<<< HEAD
directionsAccounted[daNote.noteData] = true;
possibleNotes.push(daNote);
directionList.push(daNote.noteData);
=======
if (directionList.contains(daNote.noteData))
{
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);
}
>>>>>>> origin/master
}
}
});
trace('notes that can be hit: ' + possibleNotes.length);
for (note in dumbNotes)
{
FlxG.log.add("killing dumb ass note at " + note.strumTime);
@ -3126,12 +3275,21 @@ class PlayState extends MusicBeatState
noteMiss(shit, null);
}
<<<<<<< HEAD
}
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*/
>>>>>>> origin/master
notes.forEachAlive(function(daNote:Note)
{
@ -3238,6 +3396,7 @@ class PlayState extends MusicBeatState
public function backgroundVideo(source:String) // for background videos
{
#if cpp
useVideo = true;
FlxG.stage.window.onFocusOut.add(focusOut);
@ -3288,6 +3447,7 @@ class PlayState extends MusicBeatState
webmHandler.pause();
else
webmHandler.resume();
#end
}
function noteMiss(direction:Int = 1, daNote:Note):Void
@ -3512,7 +3672,6 @@ class PlayState extends MusicBeatState
var array = [note.strumTime,note.sustainLength,note.noteData,noteDiff];
if (note.isSustainNote)
array[1] = -1;
trace('pushing ' + array[0]);
saveNotes.push(array);
saveJudge.push(note.rating);
}

View File

@ -4,4 +4,5 @@ class PlayStateChangeables
public static var safeFrames:Int;
public static var scrollSpeed:Float;
public static var botPlay:Bool;
public static var Optimize:Bool;
}

View File

@ -179,6 +179,17 @@ class ResultsScreen extends FlxSubState
PlayState.loadRep = false;
PlayState.rep = null;
var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
Highscore.saveScore(songHighscore, Math.round(PlayState.instance.songScore), PlayState.storyDifficulty);
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(PlayState.instance.accuracy),PlayState.storyDifficulty);
#end
if (PlayState.isStoryMode)
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
@ -210,6 +221,17 @@ class ResultsScreen extends FlxSubState
case 'philly-nice': songFormat = 'Philly';
}
var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
Highscore.saveScore(songHighscore, Math.round(PlayState.instance.songScore), PlayState.storyDifficulty);
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(PlayState.instance.accuracy),PlayState.storyDifficulty);
#end
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
music.fadeOut(0.3);
@ -227,6 +249,17 @@ class ResultsScreen extends FlxSubState
PlayState.loadRep = false;
var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
Highscore.saveScore(songHighscore, Math.round(PlayState.instance.songScore), PlayState.storyDifficulty);
Highscore.saveCombo(songHighscore, Ratings.GenerateLetterRank(PlayState.instance.accuracy),PlayState.storyDifficulty);
#end
var songFormat = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';

View File

@ -1,5 +1,8 @@
package;
#if sys
import smTools.SMFile;
#end
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
@ -92,6 +95,9 @@ class TitleState extends MusicBeatState
KadeEngineData.initSave();
// var file:SMFile = SMFile.loadFile("file.sm");
// this was testing things
Highscore.load();
if (FlxG.save.data.weekUnlocked != null)

61
source/smTools/SMFile.hx Normal file
View 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

View 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

View 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
View File

@ -0,0 +1,10 @@
#if sys
package smTools;
class SMNote
{
public var time:Float;
public var data:Int;
public var length:Float;
}
#end