1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-28 15:57:42 +00:00

big cleanup

This commit is contained in:
MtH 2021-04-22 04:17:00 +02:00
parent 4b6ba44e07
commit 5ee0ef8f4e
2 changed files with 62 additions and 168 deletions

View file

@ -20,7 +20,7 @@ class FreeplayState extends MusicBeatState
{
var songs:Array<SongMetadata> = [];
var selector:FlxText;
// var selector:FlxText;
var curSelected:Int = 0;
var curDifficulty:Int = 1;
@ -128,9 +128,8 @@ class FreeplayState extends MusicBeatState
scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT);
// scoreText.alignment = RIGHT;
scoreBG = new FlxSprite(scoreText.x - 6, 0).makeGraphic(1, 66, 0xFF000000);
scoreBG = new FlxSprite(scoreText.x - 6, 0).makeGraphic(1, 66, 0x99000000);
scoreBG.antialiasing = false;
scoreBG.alpha = 0.6;
add(scoreBG);
diffText = new FlxText(scoreText.x, scoreText.y + 36, 0, "", 24);
@ -144,10 +143,10 @@ class FreeplayState extends MusicBeatState
// FlxG.sound.playMusic(Paths.music('title'), 0);
// FlxG.sound.music.fadeIn(2, 0, 0.8);
selector = new FlxText();
// selector = new FlxText();
selector.size = 40;
selector.text = ">";
// selector.size = 40;
// selector.text = ">";
// add(selector);
var swag:Alphabet = new Alphabet(1, 0, "swag");
@ -216,13 +215,9 @@ class FreeplayState extends MusicBeatState
var accepted = controls.ACCEPT;
if (upP)
{
changeSelection(-1);
}
if (downP)
{
changeSelection(1);
}
if (FlxG.mouse.wheel != 0)
changeSelection(-Math.round(FlxG.mouse.wheel / 4));

View file

@ -176,14 +176,6 @@ class PlayState extends MusicBeatState
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD, false);
// fake notesplash cache type deal so that it loads in the graphic?
grpNoteSplashes = new FlxTypedGroup<NoteSplash>();
var noteSplash:NoteSplash = new NoteSplash(100, 100, 0);
grpNoteSplashes.add(noteSplash);
noteSplash.alpha = 0.1;
persistentUpdate = true;
persistentDraw = true;
@ -630,9 +622,7 @@ class PlayState extends MusicBeatState
gfVersion = 'gf-car';
case 'mall' | 'mallEvil':
gfVersion = 'gf-christmas';
case 'school':
gfVersion = 'gf-pixel';
case 'schoolEvil':
case 'school' | 'schoolEvil':
gfVersion = 'gf-pixel';
case 'tank':
gfVersion = 'gf-tankmen';
@ -682,7 +672,6 @@ class PlayState extends MusicBeatState
camPos.x += 600;
tweenCamIn();
}
case "spooky":
dad.y += 200;
case "monster":
@ -696,11 +685,7 @@ class PlayState extends MusicBeatState
dad.y += 300;
case 'parents-christmas':
dad.x -= 500;
case 'senpai':
dad.x += 150;
dad.y += 360;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
case 'senpai-angry':
case 'senpai' | 'senpai-angry':
dad.x += 150;
dad.y += 360;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
@ -714,12 +699,6 @@ class PlayState extends MusicBeatState
boyfriend = new Boyfriend(770, 450, SONG.player1);
switch (SONG.player1)
{
case "bf-holding-gf":
// boyfriend.y -= 140;
}
// REPOSITIONING PER STAGE
switch (curStage)
{
@ -729,10 +708,8 @@ class PlayState extends MusicBeatState
resetFastCar();
add(fastCar);
case 'mall':
boyfriend.x += 200;
case 'mallEvil':
boyfriend.x += 320;
dad.y -= 80;
@ -797,21 +774,25 @@ class PlayState extends MusicBeatState
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
if (PreferencesMenu.getPref('downscroll'))
{
strumLine.y = FlxG.height - 150; // 150 just random ass number lol
}
strumLine.scrollFactor.set();
strumLineNotes = new FlxTypedGroup<FlxSprite>();
add(strumLineNotes);
// fake notesplash cache type deal so that it loads in the graphic?
grpNoteSplashes = new FlxTypedGroup<NoteSplash>();
var noteSplash:NoteSplash = new NoteSplash(100, 100, 0);
grpNoteSplashes.add(noteSplash);
noteSplash.alpha = 0.1;
add(grpNoteSplashes);
playerStrums = new FlxTypedGroup<FlxSprite>();
// startCountdown();
generateSong();
// add(strumLine);
@ -916,14 +897,8 @@ class PlayState extends MusicBeatState
});
});
});
case 'senpai':
case 'senpai' | 'roses' | 'thorns':
schoolIntro(doof);
case 'roses':
FlxG.sound.play(Paths.sound('ANGRY'));
schoolIntro(doof);
case 'thorns':
schoolIntro(doof);
case 'ugh':
ughIntro();
case 'stress':
@ -950,7 +925,7 @@ class PlayState extends MusicBeatState
default:
startCountdown();
}
}
}
super.create();
}
@ -1424,6 +1399,9 @@ class PlayState extends MusicBeatState
add(red);
camHUD.visible = false;
}
else
FlxG.sound.play(Paths.sound('ANGRY'));
// moved senpai angry noise in here to clean up cutscene switch case lol
}
new FlxTimer().start(0.3, function(tmr:FlxTimer)
@ -1431,9 +1409,7 @@ class PlayState extends MusicBeatState
black.alpha -= 0.15;
if (black.alpha > 0)
{
tmr.reset(0.3);
}
else
{
if (dialogueBox != null)
@ -1448,9 +1424,7 @@ class PlayState extends MusicBeatState
{
senpaiEvil.alpha += 0.15;
if (senpaiEvil.alpha < 1)
{
swagTimer.reset();
}
else
{
senpaiEvil.animation.play('idle');
@ -1472,9 +1446,7 @@ class PlayState extends MusicBeatState
});
}
else
{
add(dialogueBox);
}
}
else
startCountdown();
@ -1519,91 +1491,59 @@ class PlayState extends MusicBeatState
if (generatedMusic)
notes.sort(sortNotes, FlxSort.DESCENDING);
var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>();
introAssets.set('default', ['ready', "set", "go"]);
introAssets.set('school', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']);
introAssets.set('schoolEvil', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']);
var introAlts:Array<String> = introAssets.get('default');
var introSprPaths:Array<String> = ["ready", "set", "go"];
var altSuffix:String = "";
for (value in introAssets.keys())
if (curStage.startsWith("school"))
{
if (value == curStage)
{
introAlts = introAssets.get(value);
altSuffix = '-pixel';
}
altSuffix = '-pixel';
introSprPaths = ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel'];
}
switch (swagCounter)
var introSndPaths:Array<String> = ["intro3" + altSuffix, "intro2" + altSuffix,
"intro1" + altSuffix, "introGo" + altSuffix];
if (swagCounter > 0)
readySetGo(introSprPaths[swagCounter - 1]);
FlxG.sound.play(Paths.sound(introSndPaths[swagCounter]), 0.6);
/* switch (swagCounter)
{
case 0:
FlxG.sound.play(Paths.sound('intro3' + altSuffix), 0.6);
case 1:
var ready:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[0]));
ready.scrollFactor.set();
ready.updateHitbox();
if (curStage.startsWith('school'))
ready.setGraphicSize(Std.int(ready.width * daPixelZoom));
ready.screenCenter();
add(ready);
FlxTween.tween(ready, {y: ready.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
ready.destroy();
}
});
FlxG.sound.play(Paths.sound('intro2' + altSuffix), 0.6);
case 2:
var set:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[1]));
set.scrollFactor.set();
if (curStage.startsWith('school'))
set.setGraphicSize(Std.int(set.width * daPixelZoom));
set.screenCenter();
add(set);
FlxTween.tween(set, {y: set.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
set.destroy();
}
});
FlxG.sound.play(Paths.sound('intro1' + altSuffix), 0.6);
case 3:
var go:FlxSprite = new FlxSprite().loadGraphic(Paths.image(introAlts[2]));
go.scrollFactor.set();
if (curStage.startsWith('school'))
go.setGraphicSize(Std.int(go.width * daPixelZoom));
go.updateHitbox();
go.screenCenter();
add(go);
FlxTween.tween(go, {y: go.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
go.destroy();
}
});
FlxG.sound.play(Paths.sound('introGo' + altSuffix), 0.6);
}
} */
swagCounter += 1;
// generateSong('fresh');
}, 4);
}
function readySetGo(path:String):Void
{
var spr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(path));
spr.scrollFactor.set();
if (curStage.startsWith('school'))
spr.setGraphicSize(Std.int(spr.width * daPixelZoom));
spr.updateHitbox();
spr.screenCenter();
add(spr);
FlxTween.tween(spr, {y: spr.y += 100, alpha: 0}, Conductor.crochet / 1000, {
ease: FlxEase.cubeInOut,
onComplete: function(twn:FlxTween)
{
spr.destroy();
}
});
}
var previousFrameTime:Int = 0;
var lastReportedPlayheadPosition:Int = 0;
var songTime:Float = 0;
function startSong():Void
@ -1611,7 +1551,6 @@ class PlayState extends MusicBeatState
startingSong = false;
previousFrameTime = FlxG.game.ticks;
lastReportedPlayheadPosition = 0;
if (!paused)
FlxG.sound.playMusic(Paths.inst(SONG.song), 1, false);
@ -1627,8 +1566,6 @@ class PlayState extends MusicBeatState
#end
}
var debugNum:Int = 0;
private function generateSong():Void
{
// FlxG.log.add(ChartParser.parse());
@ -1657,13 +1594,8 @@ class PlayState extends MusicBeatState
// NEW SHIT
noteData = songData.notes;
var playerCounter:Int = 0;
var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped
for (section in noteData)
{
var coolSection:Int = Std.int(section.lengthInSteps / 4);
for (songNotes in section.sectionNotes)
{
var daStrumTime:Float = songNotes[0];
@ -1672,9 +1604,7 @@ class PlayState extends MusicBeatState
var gottaHitNote:Bool = section.mustHitSection;
if (songNotes[1] > 3)
{
gottaHitNote = !section.mustHitSection;
}
var oldNote:Note;
if (unspawnNotes.length > 0)
@ -1703,25 +1633,16 @@ class PlayState extends MusicBeatState
sustainNote.mustPress = gottaHitNote;
if (sustainNote.mustPress)
{
sustainNote.x += FlxG.width / 2; // general offset
}
}
swagNote.mustPress = gottaHitNote;
if (swagNote.mustPress)
{
swagNote.x += FlxG.width / 2; // general offset
}
else {}
}
daBeats += 1;
}
// trace(unspawnNotes.length);
// playerCounter += 1;
unspawnNotes.sort(sortByShit);
generatedMusic = true;
@ -1839,9 +1760,7 @@ class PlayState extends MusicBeatState
babyArrow.ID = i;
if (player == 1)
{
playerStrums.add(babyArrow);
}
babyArrow.animation.play('static');
babyArrow.x += 50;
@ -1878,9 +1797,7 @@ class PlayState extends MusicBeatState
if (paused)
{
if (FlxG.sound.music != null && !startingSong)
{
resyncVocals();
}
if (!startTimer.finished)
startTimer.active = true;
@ -1888,13 +1805,9 @@ class PlayState extends MusicBeatState
#if discord_rpc
if (startTimer.finished)
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
}
else
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
#end
}
@ -1907,13 +1820,9 @@ class PlayState extends MusicBeatState
if (health > 0 && !paused && FlxG.autoPause)
{
if (Conductor.songPosition > 0.0)
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
}
else
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
}
super.onFocus();
@ -1922,9 +1831,7 @@ class PlayState extends MusicBeatState
override public function onFocusLost():Void
{
if (health > 0 && !paused && FlxG.autoPause)
{
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
super.onFocusLost();
}
@ -1959,9 +1866,6 @@ class PlayState extends MusicBeatState
perfectMode = false;
#end
if (FlxG.keys.justPressed.NINE)
iconP1.swapOldIcon();
// do this BEFORE super.update() so songPosition is accurate
if (startingSong)
{
@ -1991,7 +1895,6 @@ class PlayState extends MusicBeatState
// trace('MISSED FRAME');
}
}
// Conductor.lastSongPos = FlxG.sound.music.time;
}
@ -2055,6 +1958,9 @@ class PlayState extends MusicBeatState
#end
}
if (FlxG.keys.justPressed.NINE)
iconP1.swapOldIcon();
// FlxG.watch.addQuick('VOL', vocals.amplitudeLeft);
// FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight);
@ -2520,6 +2426,7 @@ class PlayState extends MusicBeatState
if (!practiceMode)
songScore += score;
// ludum dare rating system
/* if (combo > 60)
daRating = 'sick';
else if (combo > 12)
@ -2677,9 +2584,7 @@ class PlayState extends MusicBeatState
vocals.volume = 1;
if (SONG.song.toLowerCase() == 'tutorial')
{
tweenCamIn();
}
}
if (cameraRightSide && camFollow.x != boyfriend.getMidpoint().x - 100)
@ -2692,18 +2597,13 @@ class PlayState extends MusicBeatState
camFollow.x = boyfriend.getMidpoint().x - 300;
case 'mall':
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'school':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
case 'schoolEvil':
case 'school' | 'schoolEvil':
camFollow.x = boyfriend.getMidpoint().x - 200;
camFollow.y = boyfriend.getMidpoint().y - 200;
}
if (SONG.song.toLowerCase() == 'tutorial')
{
FlxTween.tween(FlxG.camera, {zoom: 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut});
}
}
}
@ -3103,9 +3003,7 @@ class PlayState extends MusicBeatState
iconP2.updateHitbox();
if (curBeat % gfSpeed == 0)
{
gf.dance();
}
if (curBeat % 2 == 0)
{
@ -3136,6 +3034,7 @@ class PlayState extends MusicBeatState
spr.dance();
});
// boppin friends
switch (curStage)
{
case 'school':