big cleanup

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

View File

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

View File

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