Skip to content

Commit f1b58cf

Browse files
committed
Update PlayState.hx
1 parent acb2a86 commit f1b58cf

File tree

1 file changed

+88
-59
lines changed

1 file changed

+88
-59
lines changed

source/states/PlayState.hx

Lines changed: 88 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ class PlayState extends MusicBeatState
291291

292292
public var camHUD:FlxCamera;
293293
public var camGame:FlxCamera;
294+
public var camCredit:FlxCamera;
294295
public var camOther:FlxCamera;
295296
public var cameraSpeed:Float = 1;
296297

@@ -369,6 +370,7 @@ class PlayState extends MusicBeatState
369370
public var maskedSongLength:Float = -1;
370371
public var saveMod:String = ""; // The modifier that allows sperate saves depending how how you want to play the game
371372
public var lyrics:FlxText;
373+
public var rainIntensity:Float = 0;
372374
var lastUpdateTime:Float = 0.0;
373375
var endingTimeLimit:Int = 20;
374376
var metadata:MetadataFile;
@@ -381,6 +383,17 @@ class PlayState extends MusicBeatState
381383
var skipTo:Float;
382384
var blackOverlay:FlxSprite;
383385
var blackUnderlay:FlxSprite;
386+
var raveLight:FlxSprite;
387+
388+
// Song Credits
389+
public var introStageBar:FlxSprite;
390+
public var introStageText:FlxTypedGroup<FlxText>;
391+
public var introStageStuff:FlxTypedGroup<Dynamic>;
392+
var credText:Array<String> = [];
393+
var songTxt:FlxText;
394+
var artistTxt:FlxText;
395+
var charterTxt:FlxText;
396+
var modTxt:FlxText;
384397

385398
// AI things. You wouldn't get it.
386399
var AIMode:Bool = false;
@@ -396,6 +409,7 @@ class PlayState extends MusicBeatState
396409
var strumFocus:Bool = false;
397410
var daStatic:FlxSprite;
398411
var thunderON:Bool = false;
412+
var gfScared:Bool = false;
399413

400414
// Troll Engine
401415
private var AIScore:Int = 0;
@@ -564,10 +578,13 @@ class PlayState extends MusicBeatState
564578
// var gameCam:FlxCamera = FlxG.camera;
565579
camGame = initPsychCamera();
566580
camHUD = new FlxCamera();
581+
camCredit = new FlxCamera();
567582
camOther = new FlxCamera();
568583
camHUD.bgColor.alpha = 0;
584+
camCredit.bgColor.alpha = 0;
569585
camOther.bgColor.alpha = 0;
570586
FlxG.cameras.add(camHUD, false);
587+
FlxG.cameras.add(camCredit, false);
571588
FlxG.cameras.add(camOther, false);
572589

573590
try
@@ -864,7 +881,7 @@ class PlayState extends MusicBeatState
864881
add(uiGroup);
865882
add(noteGroup);
866883

867-
if (ClientPrefs.data.doubleGhosts) {+
884+
if (ClientPrefs.data.doubleGhosts) {
868885
trace("Running Double Ghost");
869886
IntegratedScript.runNamelessHScript("
870887
import psychlua.LuaUtils;
@@ -1291,6 +1308,16 @@ class PlayState extends MusicBeatState
12911308

12921309
add(blackOverlay);
12931310

1311+
raveLight = new FlxSprite(0, 0).makeGraphic(screenWidth, screenHeight, FlxColor.BLACK);
1312+
raveLight.cameras = [camHUD];
1313+
raveLight.antialiasing = true;
1314+
raveLight.scrollFactor.set(0, 0);
1315+
raveLight.updateHitbox();
1316+
raveLight.screenCenter();
1317+
raveLight.active = false;
1318+
raveLight.alpha = 0;
1319+
raveLight.visible = false;
1320+
12941321
daStatic = new FlxSprite(0, 0);
12951322
daStatic.frames = Paths.getSparrowAtlas('effects/static');
12961323
daStatic.animation.addByPrefix('static', 'lestatic', 24, true);
@@ -1321,6 +1348,8 @@ class PlayState extends MusicBeatState
13211348
default:
13221349
pressMissDamage = 0.05;
13231350
}
1351+
1352+
raveLightsColors = [0xFF31A2FD, 0xFF31FD8C, 0xFFFB33F5, 0xFFFD4531, 0xFFFBA633];
13241353
}
13251354

13261355
function doStaticSign(lestatic:Int = 0)
@@ -1355,37 +1384,6 @@ class PlayState extends MusicBeatState
13551384
}
13561385
}
13571386

1358-
function doThunderstorm(stormType:Int = 0)
1359-
{
1360-
switch (stormType)
1361-
{
1362-
case 0:
1363-
FlxTween.num(rainIntensity, 0.04, 2, {ease: FlxEase.expoOut}, function(num)
1364-
{
1365-
rainIntensity = num;
1366-
});
1367-
thunderON = false;
1368-
case 1:
1369-
FlxTween.num(rainIntensity, 0.07, 2, {ease: FlxEase.expoOut}, function(num)
1370-
{
1371-
rainIntensity = num;
1372-
});
1373-
thunderON = false;
1374-
case 2:
1375-
FlxTween.num(rainIntensity, 0.09, 2, {ease: FlxEase.expoOut}, function(num)
1376-
{
1377-
rainIntensity = num;
1378-
});
1379-
thunderON = true;
1380-
case 3:
1381-
FlxTween.num(rainIntensity, 0, 2, {ease: FlxEase.expoOut}, function(num)
1382-
{
1383-
rainIntensity = num;
1384-
});
1385-
thunderON = false;
1386-
}
1387-
}
1388-
13891387
function set_songSpeed(value:Float):Float
13901388
{
13911389
songSpeed = value;
@@ -1834,6 +1832,11 @@ class PlayState extends MusicBeatState
18341832
{
18351833
case 0:
18361834
FlxG.sound.play(Paths.sound('intro3' + introSoundsSuffix), 0.6);
1835+
introStageStuff.visible = true;
1836+
FlxTween.tween(songTxt, {alpha: 1}, 1, {ease: FlxEase.circOut});
1837+
FlxTween.tween(artistTxt, {alpha: 1}, 1, {ease: FlxEase.circOut});
1838+
FlxTween.tween(charterTxt, {alpha: 1}, 1, {ease: FlxEase.circOut});
1839+
FlxTween.tween(modTxt, {alpha: 1}, 1, {ease: FlxEase.circOut});
18371840
tick = THREE;
18381841
case 1:
18391842
countdownReady = createCountdownSprite(introAlts[0], antialias);
@@ -1848,6 +1851,10 @@ class PlayState extends MusicBeatState
18481851
FlxG.sound.play(Paths.sound('introGo' + introSoundsSuffix), 0.6);
18491852
tick = GO;
18501853
case 4:
1854+
new FlxTimer().start(2, function(tmr:FlxTimer)
1855+
{
1856+
FlxTween.tween(camCredit, {alpha: 0, y: 1000}, 1, {ease: FlxEase.circInOut});
1857+
});
18511858
tick = START;
18521859
}
18531860

@@ -3513,6 +3520,25 @@ class PlayState extends MusicBeatState
35133520
}
35143521
}
35153522

3523+
if (FlxG.sound.music != null && !endingSong && !startingSong && !paused)
3524+
FlxG.sound.music.volume = 1 * instVolumeMultiplier;
3525+
3526+
if (FlxG.keys.justPressed.NINE)
3527+
iconP1.swapOldIcon();
3528+
3529+
specialOverlays.forEachAlive(function(sprite:FlxSprite)
3530+
{
3531+
sprite.screenCenter();
3532+
if (sprite.alpha > 0)
3533+
{
3534+
var zoomOut = 1 / defaultCamZoom;
3535+
var screenWidth = Std.int(FlxG.width * zoomOut * 2);
3536+
var screenHeight = Std.int(FlxG.height * zoomOut * 2);
3537+
3538+
sprite.scale.set(screenWidth, screenHeight);
3539+
}
3540+
});
3541+
35163542
super.update(elapsed);
35173543
updateVisualPosition();
35183544
modManager.update(elapsed, curDecBeat, curDecStep);
@@ -4842,42 +4868,18 @@ class PlayState extends MusicBeatState
48424868
case 'Static Fade':
48434869
doStaticSignFade(Std.parseFloat(value1), Std.parseFloat(value2));
48444870

4845-
case 'Thunderstorm Trigger':
4846-
if (value1 == '' || value1 == null)
4847-
{
4848-
doThunderstorm(3);
4849-
}
4850-
else
4851-
{
4852-
doThunderstorm(Std.parseInt(value1));
4853-
}
4854-
48554871
case 'Rave Mode':
48564872
if (ClientPrefs.data.flashing)
48574873
{
4858-
switch (value1)
4874+
switch (value1.toLowerCase())
48594875
{
4860-
case '0':
4876+
case '0' | 'off' | 'false':
48614877
ravemode = false;
4862-
ravemodeV2 = false;
4863-
case '1':
4878+
case '1' | 'on' | 'true':
48644879
ravemode = true;
4865-
ravemodeV2 = false;
4866-
case '2':
4867-
ravemode = false;
4868-
ravemodeV2 = true;
48694880
}
48704881
}
48714882

4872-
if (Std.string(value2) == 'A')
4873-
{
4874-
autoBotsRollOut = true;
4875-
}
4876-
else
4877-
{
4878-
autoBotsRollOut = false;
4879-
}
4880-
48814883
case 'gfScared':
48824884
var newValue:Bool = false;
48834885
if (value1.toLowerCase() == "true")
@@ -6417,6 +6419,11 @@ class PlayState extends MusicBeatState
64176419
return;
64186420
}
64196421

6422+
if (gfScared && curStep % 2 == 0)
6423+
{
6424+
gf.playAnim('scared', true);
6425+
}
6426+
64206427
lastStepHit = curStep;
64216428
setOnScripts('curStep', curStep);
64226429
callOnScripts('onStepHit');
@@ -6455,6 +6462,9 @@ class PlayState extends MusicBeatState
64556462
}
64566463

64576464
var lastBeatHit:Int = -1;
6465+
var raveLightsColors:Array<FlxColor>;
6466+
var curLightEvent:Int = -1;
6467+
var ravemode:Bool = false;
64586468
override function beatHit()
64596469
{
64606470
if(lastBeatHit >= curBeat) {
@@ -6517,6 +6527,25 @@ class PlayState extends MusicBeatState
65176527

65186528
characterBopper(curBeat);
65196529

6530+
if (ravemode && ClientPrefs.data.flashing)
6531+
{
6532+
raveLight.visible = true;
6533+
curLightEvent = FlxG.random.int(0, raveLightsColors.length-1, [curLightEvent]);
6534+
var color:FlxColor = raveLightsColors[curLightEvent];
6535+
raveLight.color = color;
6536+
raveLight.alpha = 0.4;
6537+
FlxTween.tween(raveLight, {alpha: 0}, Conductor.stepCrochet*0.001*4, {});
6538+
if(ClientPrefs.data.camZooms)
6539+
{
6540+
FlxG.camera.zoom += 0.5;
6541+
camHUD.zoom += 0.1;
6542+
}
6543+
}
6544+
else
6545+
{
6546+
raveLight.visible = false;
6547+
}
6548+
65206549
super.beatHit();
65216550
lastBeatHit = curBeat;
65226551

0 commit comments

Comments
 (0)