1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-07-15 06:35:33 +00:00

Merge branch 'master' of github.com:ninjamuffin99/Funkin-secret

This commit is contained in:
EliteMasterEric 2023-02-02 18:28:11 -05:00
commit 8329196118
4 changed files with 113 additions and 68 deletions

View file

@ -11,15 +11,15 @@
"name": "flixel", "name": "flixel",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "d6100cc8", "ref": "a629f9a5",
"url": "https://github.com/EliteMasterEric/flixel" "url": "https://github.com/MasterEric/flixel"
}, },
{ {
"name": "flixel-addons", "name": "flixel-addons",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "f107166", "ref": "752c3d7",
"url": "https://github.com/EliteMasterEric/flixel-addons" "url": "https://github.com/MasterEric/flixel-addons"
}, },
{ {
"name": "flixel-ui", "name": "flixel-ui",
@ -42,7 +42,7 @@
"name": "haxeui-core", "name": "haxeui-core",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "e5cf78d", "ref": "50247e3",
"url": "https://github.com/haxeui/haxeui-core/" "url": "https://github.com/haxeui/haxeui-core/"
}, },
{ {
@ -81,15 +81,15 @@
}, },
{ {
"name": "lime", "name": "lime",
"type": "git", "type": "haxelib",
"version": null "version": null
}, },
{ {
"name": "openfl", "name": "openfl",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "b2c18513", "ref": "3fd5763c1",
"url": "https://github.com/EliteMasterEric/openfl" "url": "https://github.com/MasterEric/openfl"
}, },
{ {
"name": "polymod", "name": "polymod",

View file

@ -1,7 +1,5 @@
package funkin.play; package funkin.play;
import funkin.play.song.SongData.SongEventData;
import funkin.play.event.SongEvent.SongEventParser;
import flixel.FlxCamera; import flixel.FlxCamera;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSprite; import flixel.FlxSprite;
@ -31,8 +29,10 @@ import funkin.play.Strumline.StrumlineArrow;
import funkin.play.Strumline.StrumlineStyle; import funkin.play.Strumline.StrumlineStyle;
import funkin.play.character.BaseCharacter; import funkin.play.character.BaseCharacter;
import funkin.play.character.CharacterData; import funkin.play.character.CharacterData;
import funkin.play.event.SongEvent.SongEventParser;
import funkin.play.scoring.Scoring; import funkin.play.scoring.Scoring;
import funkin.play.song.Song; import funkin.play.song.Song;
import funkin.play.song.SongData.SongEventData;
import funkin.play.song.SongData.SongNoteData; import funkin.play.song.SongData.SongNoteData;
import funkin.play.song.SongData.SongPlayableChar; import funkin.play.song.SongData.SongPlayableChar;
import funkin.play.song.SongValidator; import funkin.play.song.SongValidator;
@ -85,6 +85,11 @@ class PlayState extends MusicBeatState
*/ */
public static var isInCutscene:Bool = false; public static var isInCutscene:Bool = false;
/**
* Whether the inputs should be disabled for whatever reason... used for the stage edit lol!
*/
public static var disableKeys:Bool = false;
/** /**
* Whether the game is currently in the countdown before the song resumes. * Whether the game is currently in the countdown before the song resumes.
*/ */
@ -928,8 +933,7 @@ class PlayState extends MusicBeatState
// moved senpai angry noise in here to clean up cutscene switch case lol // moved senpai angry noise in here to clean up cutscene switch case lol
} }
new FlxTimer().start(0.3, function(tmr:FlxTimer) new FlxTimer().start(0.3, function(tmr:FlxTimer) {
{
black.alpha -= 0.15; black.alpha -= 0.15;
if (black.alpha > 0) tmr.reset(0.3); if (black.alpha > 0) tmr.reset(0.3);
@ -943,25 +947,21 @@ class PlayState extends MusicBeatState
{ {
add(senpaiEvil); add(senpaiEvil);
senpaiEvil.alpha = 0; senpaiEvil.alpha = 0;
new FlxTimer().start(0.3, function(swagTimer:FlxTimer) new FlxTimer().start(0.3, function(swagTimer:FlxTimer) {
{
senpaiEvil.alpha += 0.15; senpaiEvil.alpha += 0.15;
if (senpaiEvil.alpha < 1) swagTimer.reset(); if (senpaiEvil.alpha < 1) swagTimer.reset();
else else
{ {
senpaiEvil.animation.play('idle'); senpaiEvil.animation.play('idle');
FlxG.sound.play(Paths.sound('Senpai_Dies'), 1, false, null, true, function() FlxG.sound.play(Paths.sound('Senpai_Dies'), 1, false, null, true, function() {
{
remove(senpaiEvil); remove(senpaiEvil);
remove(red); remove(red);
FlxG.camera.fade(FlxColor.WHITE, 0.01, true, function() FlxG.camera.fade(FlxColor.WHITE, 0.01, true, function() {
{
add(dialogueBox); add(dialogueBox);
camHUD.visible = true; camHUD.visible = true;
}, true); }, true);
}); });
new FlxTimer().start(3.2, function(deadTime:FlxTimer) new FlxTimer().start(3.2, function(deadTime:FlxTimer) {
{
FlxG.camera.fade(FlxColor.WHITE, 1.6, false); FlxG.camera.fade(FlxColor.WHITE, 1.6, false);
}); });
} }
@ -1026,8 +1026,7 @@ class PlayState extends MusicBeatState
else else
vocals = VoicesGroup.build(currentSong.song, null); vocals = VoicesGroup.build(currentSong.song, null);
vocals.members[0].onComplete = function() vocals.members[0].onComplete = function() {
{
vocalsFinished = true; vocalsFinished = true;
}; };
@ -1053,8 +1052,7 @@ class PlayState extends MusicBeatState
// TODO: Fix grouped vocals // TODO: Fix grouped vocals
vocals = currentChart.buildVocals(); vocals = currentChart.buildVocals();
vocals.members[0].onComplete = function() vocals.members[0].onComplete = function() {
{
vocalsFinished = true; vocalsFinished = true;
} }
@ -1076,14 +1074,12 @@ class PlayState extends MusicBeatState
// make unspawn notes shit def empty // make unspawn notes shit def empty
inactiveNotes = []; inactiveNotes = [];
activeNotes.forEach(function(nt) activeNotes.forEach(function(nt) {
{
nt.followsTime = false; nt.followsTime = false;
FlxTween.tween(nt, {y: FlxG.height + nt.y}, 0.5, FlxTween.tween(nt, {y: FlxG.height + nt.y}, 0.5,
{ {
ease: FlxEase.expoIn, ease: FlxEase.expoIn,
onComplete: function(twn) onComplete: function(twn) {
{
nt.kill(); nt.kill();
activeNotes.remove(nt, true); activeNotes.remove(nt, true);
nt.destroy(); nt.destroy();
@ -1177,8 +1173,7 @@ class PlayState extends MusicBeatState
} }
} }
inactiveNotes.sort(function(a:Note, b:Note):Int inactiveNotes.sort(function(a:Note, b:Note):Int {
{
return SortUtil.byStrumtime(FlxSort.ASCENDING, a, b); return SortUtil.byStrumtime(FlxSort.ASCENDING, a, b);
}); });
} }
@ -1196,14 +1191,12 @@ class PlayState extends MusicBeatState
inactiveNotes = []; inactiveNotes = [];
// Destroy active notes. // Destroy active notes.
activeNotes.forEach(function(nt) activeNotes.forEach(function(nt) {
{
nt.followsTime = false; nt.followsTime = false;
FlxTween.tween(nt, {y: FlxG.height + nt.y}, 0.5, FlxTween.tween(nt, {y: FlxG.height + nt.y}, 0.5,
{ {
ease: FlxEase.expoIn, ease: FlxEase.expoIn,
onComplete: function(twn) onComplete: function(twn) {
{
nt.kill(); nt.kill();
activeNotes.remove(nt, true); activeNotes.remove(nt, true);
nt.destroy(); nt.destroy();
@ -1369,6 +1362,7 @@ class PlayState extends MusicBeatState
if (FlxG.keys.justPressed.U) if (FlxG.keys.justPressed.U)
{ {
// hack for HaxeUI generation, doesn't work unless persistentUpdate is false at state creation!! // hack for HaxeUI generation, doesn't work unless persistentUpdate is false at state creation!!
disableKeys = true;
persistentUpdate = false; persistentUpdate = false;
openSubState(new StageOffsetSubstate()); openSubState(new StageOffsetSubstate());
} }
@ -1557,7 +1551,7 @@ class PlayState extends MusicBeatState
} }
} }
if (!isInCutscene && !_exiting) if ((!isInCutscene && !disableKeys) && !_exiting)
{ {
// RESET = Quick Game Over Screen // RESET = Quick Game Over Screen
if (controls.RESET) if (controls.RESET)
@ -1623,8 +1617,7 @@ class PlayState extends MusicBeatState
if (generatedMusic && playerStrumline != null) if (generatedMusic && playerStrumline != null)
{ {
activeNotes.forEachAlive(function(daNote:Note) activeNotes.forEachAlive(function(daNote:Note) {
{
if ((PreferencesMenu.getPref('downscroll') && daNote.y < -daNote.height) if ((PreferencesMenu.getPref('downscroll') && daNote.y < -daNote.height)
|| (!PreferencesMenu.getPref('downscroll') && daNote.y > FlxG.height)) || (!PreferencesMenu.getPref('downscroll') && daNote.y > FlxG.height))
{ {
@ -1744,7 +1737,7 @@ class PlayState extends MusicBeatState
} }
} }
if (!isInCutscene) keyShit(true); if (!isInCutscene && !disableKeys) keyShit(true);
} }
function applyClipRect(daNote:Note):Void function applyClipRect(daNote:Note):Void
@ -1883,8 +1876,7 @@ class PlayState extends MusicBeatState
camHUD.visible = false; camHUD.visible = false;
isInCutscene = true; isInCutscene = true;
FlxG.sound.play(Paths.sound('Lights_Shut_off'), function() FlxG.sound.play(Paths.sound('Lights_Shut_off'), function() {
{
// no camFollow so it centers on horror tree // no camFollow so it centers on horror tree
currentSong = SongLoad.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]); currentSong = SongLoad.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]);
LoadingState.loadAndSwitchState(new PlayState()); LoadingState.loadAndSwitchState(new PlayState());
@ -1912,15 +1904,13 @@ class PlayState extends MusicBeatState
FlxTween.tween(camHUD, {alpha: 0}, 0.6); FlxTween.tween(camHUD, {alpha: 0}, 0.6);
new FlxTimer().start(0.8, _ -> new FlxTimer().start(0.8, _ -> {
{
currentStage.getGirlfriend().animation.play("cheer"); currentStage.getGirlfriend().animation.play("cheer");
FlxTween.tween(FlxG.camera, {zoom: 1200}, 1.1, FlxTween.tween(FlxG.camera, {zoom: 1200}, 1.1,
{ {
ease: FlxEase.expoIn, ease: FlxEase.expoIn,
onComplete: _ -> onComplete: _ -> {
{
persistentUpdate = false; persistentUpdate = false;
vocals.stop(); vocals.stop();
camHUD.alpha = 1; camHUD.alpha = 1;
@ -2065,8 +2055,7 @@ class PlayState extends MusicBeatState
// HOLDS, check for sustain notes // HOLDS, check for sustain notes
if (holdArray.contains(true) && PlayState.instance.generatedMusic) if (holdArray.contains(true) && PlayState.instance.generatedMusic)
{ {
PlayState.instance.activeNotes.forEachAlive(function(daNote:Note) PlayState.instance.activeNotes.forEachAlive(function(daNote:Note) {
{
if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.data.noteData]) PlayState.instance.goodNoteHit(daNote); if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.data.noteData]) PlayState.instance.goodNoteHit(daNote);
}); });
} }
@ -2082,8 +2071,7 @@ class PlayState extends MusicBeatState
var directionList:Array<Int> = []; // directions that can be hit var directionList:Array<Int> = []; // directions that can be hit
var dumbNotes:Array<Note> = []; // notes to kill later var dumbNotes:Array<Note> = []; // notes to kill later
PlayState.instance.activeNotes.forEachAlive(function(daNote:Note) PlayState.instance.activeNotes.forEachAlive(function(daNote:Note) {
{
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit) if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
{ {
if (directionList.contains(daNote.data.noteData)) if (directionList.contains(daNote.data.noteData))
@ -2355,8 +2343,7 @@ class PlayState extends MusicBeatState
var frameShit:Float = (1 / 24) * 2; // equals 2 frames in the animation var frameShit:Float = (1 / 24) * 2; // equals 2 frames in the animation
new FlxTimer().start(((Conductor.crochet / 1000) * 1.25) - frameShit, function(tmr) new FlxTimer().start(((Conductor.crochet / 1000) * 1.25) - frameShit, function(tmr) {
{
animShit.forceFinish(); animShit.forceFinish();
}); });
} }

View file

@ -2,6 +2,7 @@ package funkin.ui.haxeui;
import haxe.ui.RuntimeComponentBuilder; import haxe.ui.RuntimeComponentBuilder;
import haxe.ui.core.Component; import haxe.ui.core.Component;
import haxe.ui.events.MouseEvent;
class HaxeUISubState extends MusicBeatSubstate class HaxeUISubState extends MusicBeatSubstate
{ {
@ -83,6 +84,30 @@ class HaxeUISubState extends MusicBeatSubstate
} }
} }
/**
* Add an onClick listener to a HaxeUI menu bar item.
*/
function addUIClickListener(key:String, callback:MouseEvent->Void)
{
var target:Component = findComponent(key);
if (target == null)
{
// Gracefully handle the case where the item can't be located.
trace('WARN: Could not locate menu item: $key');
}
else
{
target.onClick = callback;
}
}
public function findComponent<T:Component>(criteria:String = null, type:Class<T> = null, recursive:Null<Bool> = null, searchType:String = "id"):Null<T>
{
if (component == null) return null;
return component.findComponent(criteria, type, recursive, searchType);
}
override function destroy() override function destroy()
{ {
if (component != null) remove(component); if (component != null) remove(component);

View file

@ -5,16 +5,24 @@ import flixel.input.mouse.FlxMouseEvent;
import flixel.math.FlxPoint; import flixel.math.FlxPoint;
import funkin.play.PlayState; import funkin.play.PlayState;
import funkin.play.stage.StageData; import funkin.play.stage.StageData;
import funkin.ui.haxeui.HaxeUISubState;
import haxe.ui.RuntimeComponentBuilder; import haxe.ui.RuntimeComponentBuilder;
import haxe.ui.core.Component; import haxe.ui.core.Component;
import openfl.events.Event; import openfl.events.Event;
import openfl.events.IOErrorEvent; import openfl.events.IOErrorEvent;
import openfl.net.FileReference; import openfl.net.FileReference;
class StageOffsetSubstate extends MusicBeatSubstate class StageOffsetSubstate extends HaxeUISubState
{ {
var uiStuff:Component; var uiStuff:Component;
static final STAGE_EDITOR_LAYOUT = Paths.ui('stage-editor/stage-editor-view');
public function new()
{
super(STAGE_EDITOR_LAYOUT);
}
override function create() override function create()
{ {
super.create(); super.create();
@ -23,22 +31,24 @@ class StageOffsetSubstate extends MusicBeatSubstate
PlayState.instance.pauseMusic(); PlayState.instance.pauseMusic();
FlxG.camera.target = null; FlxG.camera.target = null;
var str = Paths.xml('ui/stage-editor-view'); setupUIListeners();
uiStuff = RuntimeComponentBuilder.fromAsset(str);
uiStuff.findComponent("lol").onClick = saveCharacterCompile; // var str = Paths.xml('ui/stage-editor-view');
uiStuff.findComponent('saveAs').onClick = saveStageFileRef; // uiStuff = RuntimeComponentBuilder.fromAsset(str);
add(uiStuff); // uiStuff.findComponent("lol").onClick = saveCharacterCompile;
// uiStuff.findComponent('saveAs').onClick = saveStageFileRef;
// add(uiStuff);
PlayState.instance.persistentUpdate = true; PlayState.instance.persistentUpdate = true;
uiStuff.cameras = [PlayState.instance.camHUD]; component.cameras = [PlayState.instance.camHUD];
// uiStuff.cameras = [PlayState.instance.camHUD];
// btn.cameras = [PlayState.instance.camHUD]; // btn.cameras = [PlayState.instance.camHUD];
for (thing in PlayState.instance.currentStage) for (thing in PlayState.instance.currentStage)
{ {
FlxMouseEvent.add(thing, spr -> FlxMouseEvent.add(thing, spr -> {
{
char = cast thing; char = cast thing;
trace("JUST PRESSED!"); trace("JUST PRESSED!");
sprOld.x = thing.x; sprOld.x = thing.x;
@ -46,20 +56,33 @@ class StageOffsetSubstate extends MusicBeatSubstate
mosPosOld.x = FlxG.mouse.x; mosPosOld.x = FlxG.mouse.x;
mosPosOld.y = FlxG.mouse.y; mosPosOld.y = FlxG.mouse.y;
}, null, spr -> }, null, spr -> {
{
// ID tag is to see if currently overlapping hold basically!, a bit more reliable than checking transparency! // ID tag is to see if currently overlapping hold basically!, a bit more reliable than checking transparency!
// used for bug where you can click, and if you click on NO sprite, it snaps the thing to position! unintended! // used for bug where you can click, and if you click on NO sprite, it snaps the thing to position! unintended!
spr.ID = 1;
spr.alpha = 0.5; if (FlxG.keys.pressed.CONTROL)
}, spr -> {
{ spr.ID = 1;
spr.alpha = 0.5;
}
else
{
spr.ID = 0;
spr.alpha = 1;
}
}, spr -> {
spr.ID = 0; spr.ID = 0;
spr.alpha = 1; spr.alpha = 1;
}); });
} }
} }
function setupUIListeners()
{
addUIClickListener('lol', saveCharacterCompile);
addUIClickListener('saveAs', saveStageFileRef);
}
var mosPosOld:FlxPoint = new FlxPoint(); var mosPosOld:FlxPoint = new FlxPoint();
var sprOld:FlxPoint = new FlxPoint(); var sprOld:FlxPoint = new FlxPoint();
@ -76,6 +99,16 @@ class StageOffsetSubstate extends MusicBeatSubstate
char.y = sprOld.y - (mosPosOld.y - FlxG.mouse.y); char.y = sprOld.y - (mosPosOld.y - FlxG.mouse.y);
} }
if (char != null)
{
var zoomShitLol:Float = 2 / FlxG.camera.zoom;
if (FlxG.keys.justPressed.LEFT) char.x -= zoomShitLol;
if (FlxG.keys.justPressed.RIGHT) char.x += zoomShitLol;
if (FlxG.keys.justPressed.UP) char.y -= zoomShitLol;
if (FlxG.keys.justPressed.DOWN) char.y += zoomShitLol;
}
FlxG.mouse.visible = true; FlxG.mouse.visible = true;
CoolUtil.mouseCamDrag(); CoolUtil.mouseCamDrag();
@ -95,10 +128,10 @@ class StageOffsetSubstate extends MusicBeatSubstate
thing.alpha = 1; thing.alpha = 1;
} }
if (uiStuff != null) remove(uiStuff); // if (uiStuff != null) remove(uiStuff);
uiStuff = null;
// uiStuff = null;
PlayState.disableKeys = false;
PlayState.instance.resetCamera(); PlayState.instance.resetCamera();
FlxG.mouse.visible = false; FlxG.mouse.visible = false;
close(); close();