1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-26 15:07:14 +00:00

Merge remote-tracking branch 'origin/master' into feature/scripted-modules

This commit is contained in:
Eric Myllyoja 2022-04-18 19:46:39 -04:00
commit 0b17f74f48
6 changed files with 77 additions and 16 deletions

View file

@ -1,8 +1,5 @@
package funkin;
import funkin.modding.module.ModuleHandler;
import funkin.play.stage.StageData;
import funkin.charting.ChartingState;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
@ -10,12 +7,18 @@ import flixel.graphics.FlxGraphic;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.util.FlxColor;
import openfl.display.BitmapData;
import funkin.charting.ChartingState;
import funkin.charting.ChartingState;
import funkin.modding.module.ModuleHandler;
import funkin.play.PicoFight;
import funkin.play.PlayState;
import funkin.play.stage.StageData;
import funkin.play.stage.StageData;
import funkin.ui.PreferencesMenu;
import funkin.ui.animDebugShit.DebugBoundingState;
import funkin.ui.stageBuildShit.StageBuilderState;
import funkin.util.macro.MacroUtil;
import funkin.play.PlayState;
import openfl.display.BitmapData;
using StringTools;
@ -176,7 +179,7 @@ class InitState extends FlxTransitionableState
#elseif FIGHT
FlxG.switchState(new PicoFight());
#elseif ANIMDEBUG
FlxG.switchState(new ui.animDebugShit.DebugBoundingState());
FlxG.switchState(new DebugBoundingState());
#elseif NETTEST
FlxG.switchState(new netTest.NetTest());
#else

View file

@ -80,8 +80,8 @@ class Note extends FlxSprite
public static var RED_NOTE:Int = 3;
// SCORING STUFF
public static var safeFrames:Int = 10;
public static var HIT_WINDOW:Float = (safeFrames / 60) * 1000; // 166.67 ms hit window
public static var HIT_WINDOW:Float = (10 / 60) * 1000; // 166.67 ms hit window (10 frames at 60fps)
// thresholds are fractions of HIT_WINDOW ^^
// anything above bad threshold is shit
public static var BAD_THRESHOLD:Float = 0.8; // 125ms , 8 frames
public static var GOOD_THRESHOLD:Float = 0.55; // 91.67ms , 5.5 frames

View file

@ -22,6 +22,8 @@ class NoteSplash extends FlxSprite
setupNoteSplash(x, y, noteData);
antialiasing = true;
// alpha = 0.75;
}

View file

@ -43,6 +43,9 @@ class PauseSubState extends MusicBeatSubstate
menuItems = pauseOG;
if (PlayState.storyWeek == 6) // consistent with logic that decides asset lib!!
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast-pixel'), true, true);
else
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
pauseMusic.volume = 0;
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));

View file

@ -38,6 +38,31 @@ class VoicesGroup extends FlxTypedGroup<FlxSound>
}
}
/**
* Finds the largest deviation from the desired time inside this VoicesGroup.
*
* @param targetTime The time to check against.
* If none is provided, it checks the time of all members against the first member of this VoicesGroup.
* @return The largest deviation from the target time found.
*/
public function checkSyncError(?targetTime:Float):Float
{
var error:Float = 0;
forEachAlive(function(snd)
{
if (targetTime == null)
targetTime = snd.time;
else
{
var diff:Float = snd.time - targetTime;
if (Math.abs(diff) > Math.abs(error))
error = diff;
}
});
return error;
}
// prob a better / cleaner way to do all these forEach stuff?
public function pause()
{

View file

@ -5,7 +5,6 @@ import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.addons.effects.FlxTrail;
import flixel.addons.transition.FlxTransitionableState;
import flixel.group.FlxGroup;
import flixel.math.FlxMath;
@ -541,11 +540,6 @@ class PlayState extends MusicBeatState implements IHook
// REPOSITIONING PER STAGE
switch (currentStageId)
{
case 'schoolEvil':
var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069);
// Go behind Spirit.
evilTrail.zIndex = 190;
add(evilTrail);
case "tank":
gf.y += 10;
gf.x -= 30;
@ -825,7 +819,7 @@ class PlayState extends MusicBeatState implements IHook
var gottaHitNote:Bool = section.mustHitSection;
if (songNotes.highStakes)
if (songNotes.highStakes) // noteData > 3
gottaHitNote = !section.mustHitSection;
var oldNote:Note;
@ -838,6 +832,10 @@ class PlayState extends MusicBeatState implements IHook
// swagNote.data = songNotes;
swagNote.data.sustainLength = songNotes.sustainLength;
swagNote.data.altNote = songNotes.altNote;
<<<<<<< HEAD
=======
>>>>>>> origin/master
swagNote.scrollFactor.set(0, 0);
var susLength:Float = swagNote.data.sustainLength;
@ -939,10 +937,15 @@ class PlayState extends MusicBeatState implements IHook
vocals.pause();
FlxG.sound.music.time = 0;
regenNoteData(); // loads the note data from start
health = 1;
songScore = 0;
<<<<<<< HEAD
Countdown.performCountdown(currentStageId.startsWith('school'));
=======
restartCountdownTimer();
>>>>>>> origin/master
needsReset = false;
}
@ -1258,9 +1261,19 @@ class PlayState extends MusicBeatState implements IHook
// TODO: Why the hell is the noteMiss logic in two different places?
if (daNote.tooLate)
{
<<<<<<< HEAD
var event:NoteScriptEvent = new NoteScriptEvent(ScriptEvent.NOTE_MISS, daNote, true);
dispatchEvent(event);
health -= 0.0775;
=======
if (curStage != null)
{
curStage.onNoteMiss(daNote);
}
// lose less health on sustain notes!
health -= 0.0775 * (daNote.isSustainNote ? 0.2 : 1); // if it's sustain, multiply it by 0.2 (not checked for balence yet), else keep it same (multiply by 1)
>>>>>>> origin/master
vocals.volume = 0;
killCombo();
}
@ -1528,9 +1541,15 @@ class PlayState extends MusicBeatState implements IHook
switch (currentStageId)
{
case 'limo':
<<<<<<< HEAD
cameraFollowPoint.x = currentStage.getBoyfriend().getMidpoint().x - 300;
case 'mall':
cameraFollowPoint.y = currentStage.getBoyfriend().getMidpoint().y - 200;
=======
camFollow.x = boyfriend.getMidpoint().x - 300;
case 'mallXmas':
camFollow.y = boyfriend.getMidpoint().y - 200;
>>>>>>> origin/master
case 'school' | 'schoolEvil':
cameraFollowPoint.x = currentStage.getBoyfriend().getMidpoint().x - 200;
cameraFollowPoint.y = currentStage.getBoyfriend().getMidpoint().y - 200;
@ -1723,8 +1742,17 @@ class PlayState extends MusicBeatState implements IHook
if (!super.stepHit())
return false;
<<<<<<< HEAD
if (Math.abs(FlxG.sound.music.time - (Conductor.songPosition - Conductor.offset)) > 20
|| (currentSong.needsVoices && Math.abs(vocals.time - (Conductor.songPosition - Conductor.offset)) > 20))
=======
override function stepHit()
{
super.stepHit();
if (Math.abs(FlxG.sound.music.time - (Conductor.songPosition - Conductor.offset)) > 20
|| Math.abs(vocals.checkSyncError(Conductor.songPosition - Conductor.offset)) > 20)
>>>>>>> origin/master
{
resyncVocals();
}