Merge pull request #1267 from cuckydev/master

Various fixes and improvements
This commit is contained in:
Kade M 2021-07-11 15:38:50 -07:00 committed by GitHub
commit 200f36995a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 184 additions and 153 deletions

View File

@ -10,8 +10,10 @@ import flixel.ui.FlxBar;
import haxe.Exception; import haxe.Exception;
import flixel.tweens.FlxEase; import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
#if cpp
import sys.FileSystem; import sys.FileSystem;
import sys.io.File; import sys.io.File;
#end
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
@ -67,25 +69,7 @@ class Caching extends MusicBeatState
kadeLogo.alpha = 0; kadeLogo.alpha = 0;
PlayerSettings.init(); #if cpp
#if windows
DiscordClient.initialize();
Application.current.onExit.add (function (exitCode) {
DiscordClient.shutdown();
});
#end
Highscore.load();
FlxG.save.bind('funkin', 'ninjamuffin99');
KadeEngineData.initSave();
if (FlxG.save.data.cacheImages) if (FlxG.save.data.cacheImages)
{ {
trace("caching images..."); trace("caching images...");
@ -104,7 +88,7 @@ class Caching extends MusicBeatState
{ {
music.push(i); music.push(i);
} }
#end
toBeDone = Lambda.count(images) + Lambda.count(music); toBeDone = Lambda.count(images) + Lambda.count(music);
@ -118,6 +102,7 @@ class Caching extends MusicBeatState
trace('starting caching..'); trace('starting caching..');
#if cpp
// update thread // update thread
sys.thread.Thread.create(() -> { sys.thread.Thread.create(() -> {
@ -139,6 +124,7 @@ class Caching extends MusicBeatState
sys.thread.Thread.create(() -> { sys.thread.Thread.create(() -> {
cache(); cache();
}); });
#end
super.create(); super.create();
} }
@ -153,7 +139,6 @@ class Caching extends MusicBeatState
function cache() function cache()
{ {
trace("LOADING: " + toBeDone + " OBJECTS."); trace("LOADING: " + toBeDone + " OBJECTS.");
for (i in images) for (i in images)

View File

@ -89,6 +89,24 @@ class Main extends Sprite
toggleFPS(FlxG.save.data.fps); toggleFPS(FlxG.save.data.fps);
#end #end
PlayerSettings.init();
#if windows
DiscordClient.initialize();
Application.current.onExit.add (function (exitCode) {
DiscordClient.shutdown();
});
#end
Highscore.load();
FlxG.save.bind('funkin', 'ninjamuffin99');
KadeEngineData.initSave();
} }
var game:FlxGame; var game:FlxGame;

View File

@ -51,13 +51,17 @@ class MusicBeatState extends FlxUIState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
//everyStep(); //everyStep();
var oldStep:Int = curStep; var nextStep:Int = updateCurStep();
updateCurStep(); if (nextStep > curStep && curStep >= 0)
{
for (i in curStep...nextStep)
{
curStep++;
updateBeat(); updateBeat();
if (oldStep != curStep && curStep > 0)
stepHit(); stepHit();
}
}
if (FlxG.save.data.fpsRain && skippedFrames >= 6) if (FlxG.save.data.fpsRain && skippedFrames >= 6)
{ {
@ -78,13 +82,13 @@ class MusicBeatState extends FlxUIState
private function updateBeat():Void private function updateBeat():Void
{ {
lastBeat = curStep; lastBeat = curBeat;
curBeat = Math.floor(curStep / 4); curBeat = Math.floor(curStep / 4);
} }
public static var currentColor = 0; public static var currentColor = 0;
private function updateCurStep():Void private function updateCurStep():Int
{ {
var lastChange:BPMChangeEvent = { var lastChange:BPMChangeEvent = {
stepTime: 0, stepTime: 0,
@ -97,12 +101,11 @@ class MusicBeatState extends FlxUIState
lastChange = Conductor.bpmChangeMap[i]; lastChange = Conductor.bpmChangeMap[i];
} }
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet); return lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
} }
public function stepHit():Void public function stepHit():Void
{ {
if (curStep % 4 == 0) if (curStep % 4 == 0)
beatHit(); beatHit();
} }

View File

@ -24,19 +24,28 @@ class MusicBeatSubstate extends FlxSubState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
//everyStep(); //everyStep();
var oldStep:Int = curStep; var nextStep = updateCurStep();
updateCurStep(); if (nextStep > curStep && curStep >= 0)
curBeat = Math.floor(curStep / 4); {
for (i in curStep...nextStep)
if (oldStep != curStep && curStep > 0) {
curStep++;
updateBeat();
stepHit(); stepHit();
}
}
super.update(elapsed); super.update(elapsed);
} }
private function updateCurStep():Void private function updateBeat():Void
{
lastBeat = curBeat;
curBeat = Math.floor(curStep / 4);
}
private function updateCurStep():Int
{ {
var lastChange:BPMChangeEvent = { var lastChange:BPMChangeEvent = {
stepTime: 0, stepTime: 0,
@ -49,7 +58,7 @@ class MusicBeatSubstate extends FlxSubState
lastChange = Conductor.bpmChangeMap[i]; lastChange = Conductor.bpmChangeMap[i];
} }
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet); return lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
} }
public function stepHit():Void public function stepHit():Void

View File

@ -92,7 +92,8 @@ class Note extends FlxSprite
//defaults if no noteStyle was found in chart //defaults if no noteStyle was found in chart
var noteTypeCheck:String = 'normal'; var noteTypeCheck:String = 'normal';
if (PlayState.curStage.startsWith('school'))
noteTypeCheck = 'pixel';
if (inCharter) if (inCharter)
{ {

View File

@ -997,6 +997,9 @@ class PlayState extends MusicBeatState
playerStrums = new FlxTypedGroup<FlxSprite>(); playerStrums = new FlxTypedGroup<FlxSprite>();
cpuStrums = new FlxTypedGroup<FlxSprite>(); cpuStrums = new FlxTypedGroup<FlxSprite>();
generateStaticArrows(0);
generateStaticArrows(1);
// startCountdown(); // startCountdown();
if (SONG.song == null) if (SONG.song == null)
@ -1308,8 +1311,9 @@ class PlayState extends MusicBeatState
{ {
inCutscene = false; inCutscene = false;
generateStaticArrows(0); appearStaticArrows();
generateStaticArrows(1); //generateStaticArrows(0);
//generateStaticArrows(1);
#if windows #if windows
// pre lowercasing the song name (startCountdown) // pre lowercasing the song name (startCountdown)
@ -1796,9 +1800,6 @@ class PlayState extends MusicBeatState
{ {
swagNote.x += FlxG.width / 2; // general offset swagNote.x += FlxG.width / 2; // general offset
} }
else
{
}
} }
daBeats += 1; daBeats += 1;
} }
@ -1901,10 +1902,11 @@ class PlayState extends MusicBeatState
babyArrow.updateHitbox(); babyArrow.updateHitbox();
babyArrow.scrollFactor.set(); babyArrow.scrollFactor.set();
babyArrow.alpha = 0;
if (!isStoryMode) if (!isStoryMode)
{ {
babyArrow.y -= 10; babyArrow.y -= 10;
babyArrow.alpha = 0; //babyArrow.alpha = 0;
FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)}); FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)});
} }
@ -1934,6 +1936,15 @@ class PlayState extends MusicBeatState
} }
} }
private function appearStaticArrows():Void
{
strumLineNotes.forEach(function(babyArrow:FlxSprite)
{
if (isStoryMode)
babyArrow.alpha = 1;
});
}
function tweenCamIn():Void function tweenCamIn():Void
{ {
FlxTween.tween(FlxG.camera, {zoom: 1.3}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut}); FlxTween.tween(FlxG.camera, {zoom: 1.3}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
@ -2800,7 +2811,11 @@ class PlayState extends MusicBeatState
} }
if (daNote.isSustainNote) if (daNote.isSustainNote)
{
daNote.x += daNote.width / 2 + 17; daNote.x += daNote.width / 2 + 17;
if (PlayState.curStage.startsWith('school'))
daNote.x -= 8;
}
// trace(daNote.y); // trace(daNote.y);
// WIP interpolation shit? Need to fix the pause issue // WIP interpolation shit? Need to fix the pause issue