Merge pull request #640 from VoltrexMaster/patch-1

feat(performance): Use switch statement
This commit is contained in:
Cameron Taylor 2021-03-29 13:45:54 -07:00 committed by GitHub
commit 23e6f9b972
1 changed files with 278 additions and 275 deletions

View File

@ -227,9 +227,11 @@ class PlayState extends MusicBeatState
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south')
switch (SONG.song.toLowerCase())
{
curStage = "spooky";
case 'spookeez' | 'monster' | 'south':
{
curStage = 'spooky';
halloweenLevel = true;
var hallowTex = Paths.getSparrowAtlas('halloween_bg');
@ -244,7 +246,7 @@ class PlayState extends MusicBeatState
isHalloween = true;
}
else if (SONG.song.toLowerCase() == 'pico' || SONG.song.toLowerCase() == 'blammed' || SONG.song.toLowerCase() == 'philly')
case 'pico' | 'blammed' | 'philly':
{
curStage = 'philly';
@ -286,7 +288,7 @@ class PlayState extends MusicBeatState
var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street'));
add(street);
}
else if (SONG.song.toLowerCase() == 'milf' || SONG.song.toLowerCase() == 'satin-panties' || SONG.song.toLowerCase() == 'high')
case 'milf' | 'satin-panties' | 'high':
{
curStage = 'limo';
defaultCamZoom = 0.90;
@ -333,7 +335,7 @@ class PlayState extends MusicBeatState
fastCar = new FlxSprite(-300, 160).loadGraphic(Paths.image('limo/fastCarLol'));
// add(limo);
}
else if (SONG.song.toLowerCase() == 'cocoa' || SONG.song.toLowerCase() == 'eggnog')
case 'cocoa' | 'eggnog':
{
curStage = 'mall';
@ -389,7 +391,7 @@ class PlayState extends MusicBeatState
santa.antialiasing = true;
add(santa);
}
else if (SONG.song.toLowerCase() == 'winter-horrorland')
case 'winter-horrorland':
{
curStage = 'mallEvil';
var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic(Paths.image('christmas/evilBG'));
@ -409,7 +411,7 @@ class PlayState extends MusicBeatState
evilSnow.antialiasing = true;
add(evilSnow);
}
else if (SONG.song.toLowerCase() == 'senpai' || SONG.song.toLowerCase() == 'roses')
case 'senpai' | 'roses':
{
curStage = 'school';
@ -476,7 +478,7 @@ class PlayState extends MusicBeatState
bgGirls.updateHitbox();
add(bgGirls);
}
else if (SONG.song.toLowerCase() == 'thorns')
case 'thorns':
{
curStage = 'schoolEvil';
@ -538,7 +540,7 @@ class PlayState extends MusicBeatState
add(waveSpriteFG);
*/
}
else
default:
{
defaultCamZoom = 0.9;
curStage = 'stage';
@ -565,6 +567,7 @@ class PlayState extends MusicBeatState
add(stageCurtains);
}
}
var gfVersion:String = 'gf';