generated from Aeolus-Light/PFA114514
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayState.hx
5631 lines (4839 loc) · 158 KB
/
PlayState.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package;
import flixel.graphics.FlxGraphic;
#if desktop
import Discord.DiscordClient;
#end
import Section.SwagSection;
import Song.SwagSong;
import WiggleEffect.WiggleEffectType;
import flixel.FlxBasic;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.effects.FlxTrail;
import flixel.addons.effects.FlxTrailArea;
import flixel.addons.effects.chainable.FlxEffectSprite;
import flixel.addons.effects.chainable.FlxWaveEffect;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.atlas.FlxAtlas;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.ui.FlxBar;
import flixel.util.FlxCollision;
import flixel.util.FlxColor;
import flixel.util.FlxSort;
import flixel.util.FlxStringUtil;
import flixel.util.FlxTimer;
import haxe.Json;
import lime.utils.Assets;
import openfl.Lib;
import openfl.display.BlendMode;
import openfl.display.StageQuality;
import openfl.filters.BitmapFilter;
import openfl.utils.Assets as OpenFlAssets;
import editors.ChartingState;
import editors.CharacterEditorState;
import flixel.group.FlxSpriteGroup;
import flixel.input.keyboard.FlxKey;
import Note.EventNote;
import openfl.events.KeyboardEvent;
import flixel.effects.particles.FlxEmitter;
import flixel.effects.particles.FlxParticle;
import flixel.util.FlxSave;
import flixel.animation.FlxAnimationController;
import animateatlas.AtlasFrameMaker;
import Achievements;
import StageData;
import FunkinLua;
import DialogueBoxPsych;
import Conductor.Rating;
import flixel.system.FlxAssets.FlxShader;
#if !flash
import flixel.addons.display.FlxRuntimeShader;
import openfl.filters.ShaderFilter;
#end
#if sys
import sys.FileSystem;
import sys.io.File;
#end
#if VIDEOS_ALLOWED
import VideoHandler as MP4Handler;
#end
using StringTools;
class PlayState extends MusicBeatState
{
public static var STRUM_X = 42;
public static var STRUM_X_MIDDLESCROLL = -278;
public static var ratingStuff:Array<Dynamic> = [
['You Suck!', 0.2], //From 0% to 19%
['Shit', 0.4], //From 20% to 39%
['Bad', 0.5], //From 40% to 49%
['Bruh', 0.6], //From 50% to 59%
['Meh', 0.69], //From 60% to 68%
['Nice', 0.7], //69%
['Good', 0.8], //From 70% to 79%
['Great', 0.9], //From 80% to 89%
['Sick!', 1], //From 90% to 99%
['Perfect!!', 1] //The value on this one isn't used actually, since Perfect is always "1"
];
//event variables
private var isCameraOnForcedPos:Bool = false;
#if (haxe >= "4.0.0")
public var boyfriendMap:Map<String, Boyfriend> = new Map();
public var dadMap:Map<String, Character> = new Map();
public var gfMap:Map<String, Character> = new Map();
public var variables:Map<String, Dynamic> = new Map();
public var modchartTweens:Map<String, FlxTween> = new Map<String, FlxTween>();
public var modchartSprites:Map<String, ModchartSprite> = new Map<String, ModchartSprite>();
public var modchartTimers:Map<String, FlxTimer> = new Map<String, FlxTimer>();
public var modchartSounds:Map<String, FlxSound> = new Map<String, FlxSound>();
public var modchartTexts:Map<String, ModchartText> = new Map<String, ModchartText>();
public var modchartSaves:Map<String, FlxSave> = new Map<String, FlxSave>();
#else
public var boyfriendMap:Map<String, Boyfriend> = new Map<String, Boyfriend>();
public var dadMap:Map<String, Character> = new Map<String, Character>();
public var gfMap:Map<String, Character> = new Map<String, Character>();
public var variables:Map<String, Dynamic> = new Map<String, Dynamic>();
public var modchartTweens:Map<String, FlxTween> = new Map();
public var modchartSprites:Map<String, ModchartSprite> = new Map();
public var modchartTimers:Map<String, FlxTimer> = new Map();
public var modchartSounds:Map<String, FlxSound> = new Map();
public var modchartTexts:Map<String, ModchartText> = new Map();
public var modchartSaves:Map<String, FlxSave> = new Map();
#end
public var BF_X:Float = 770;
public var BF_Y:Float = 100;
public var DAD_X:Float = 100;
public var DAD_Y:Float = 100;
public var GF_X:Float = 400;
public var GF_Y:Float = 130;
public var songSpeedTween:FlxTween;
public var songSpeed(default, set):Float = 1;
public var songSpeedType:String = "multiplicative";
public var noteKillOffset:Float = 350;
public var playbackRate(default, set):Float = 1;
public var boyfriendGroup:FlxSpriteGroup;
public var dadGroup:FlxSpriteGroup;
public var gfGroup:FlxSpriteGroup;
public static var curStage:String = '';
public static var isPixelStage:Bool = false;
public static var SONG:SwagSong = null;
public static var isStoryMode:Bool = false;
public static var storyWeek:Int = 0;
public static var storyPlaylist:Array<String> = [];
public static var storyDifficulty:Int = 1;
public var spawnTime:Float = 2000;
public var vocals:FlxSound;
public var dad:Character = null;
public var gf:Character = null;
public var boyfriend:Boyfriend = null;
public var notes:FlxTypedGroup<Note>;
public var unspawnNotes:Array<Note> = [];
public var eventNotes:Array<EventNote> = [];
private var strumLine:FlxSprite;
//Handles the new epic mega sexy cam code that i've done
public var camFollow:FlxPoint;
public var camFollowPos:FlxObject;
private static var prevCamFollow:FlxPoint;
private static var prevCamFollowPos:FlxObject;
public var strumLineNotes:FlxTypedGroup<StrumNote>;
public var opponentStrums:FlxTypedGroup<StrumNote>;
public var playerStrums:FlxTypedGroup<StrumNote>;
public var grpNoteSplashes:FlxTypedGroup<NoteSplash>;
public var camZooming:Bool = false;
public var camZoomingMult:Float = 1;
public var camZoomingDecay:Float = 1;
private var curSong:String = "";
public var gfSpeed:Int = 1;
public var health:Float = 1;
public var combo:Int = 0;
private var healthBarBG:AttachedSprite;
public var healthBar:FlxBar;
var songPercent:Float = 0;
private var timeBarBG:AttachedSprite;
public var timeBar:FlxBar;
public var ratingsData:Array<Rating> = [];
public var sicks:Int = 0;
public var goods:Int = 0;
public var bads:Int = 0;
public var shits:Int = 0;
private var generatedMusic:Bool = false;
public var endingSong:Bool = false;
public var startingSong:Bool = false;
private var updateTime:Bool = true;
public static var changedDifficulty:Bool = false;
public static var chartingMode:Bool = false;
//Gameplay settings
public var healthGain:Float = 1;
public var healthLoss:Float = 1;
public var instakillOnMiss:Bool = false;
public var cpuControlled:Bool = false;
public var practiceMode:Bool = false;
public var botplaySine:Float = 0;
public var botplayTxt:FlxText;
public var iconP1:HealthIcon;
public var iconP2:HealthIcon;
public var camHUD:FlxCamera;
public var camGame:FlxCamera;
public var camOther:FlxCamera;
public var cameraSpeed:Float = 1;
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var dialogueJson:DialogueFile = null;
var dadbattleBlack:BGSprite;
var dadbattleLight:BGSprite;
var dadbattleSmokes:FlxSpriteGroup;
var halloweenBG:BGSprite;
var halloweenWhite:BGSprite;
var phillyLightsColors:Array<FlxColor>;
var phillyWindow:BGSprite;
var phillyStreet:BGSprite;
var phillyTrain:BGSprite;
var blammedLightsBlack:FlxSprite;
var phillyWindowEvent:BGSprite;
var trainSound:FlxSound;
var phillyGlowGradient:PhillyGlow.PhillyGlowGradient;
var phillyGlowParticles:FlxTypedGroup<PhillyGlow.PhillyGlowParticle>;
var limoKillingState:Int = 0;
var limo:BGSprite;
var limoMetalPole:BGSprite;
var limoLight:BGSprite;
var limoCorpse:BGSprite;
var limoCorpseTwo:BGSprite;
var bgLimo:BGSprite;
var grpLimoParticles:FlxTypedGroup<BGSprite>;
var grpLimoDancers:FlxTypedGroup<BackgroundDancer>;
var fastCar:BGSprite;
var upperBoppers:BGSprite;
var bottomBoppers:BGSprite;
var santa:BGSprite;
var heyTimer:Float;
var bgGirls:BackgroundGirls;
var wiggleShit:WiggleEffect = new WiggleEffect();
var bgGhouls:BGSprite;
var tankWatchtower:BGSprite;
var tankGround:BGSprite;
var tankmanRun:FlxTypedGroup<TankmenBG>;
var foregroundSprites:FlxTypedGroup<BGSprite>;
public var songScore:Int = 0;
public var songHits:Int = 0;
public var songMisses:Int = 0;
public var scoreTxt:FlxText;
var timeTxt:FlxText;
var scoreTxtTween:FlxTween;
public static var campaignScore:Int = 0;
public static var campaignMisses:Int = 0;
public static var seenCutscene:Bool = false;
public static var deathCounter:Int = 0;
public var defaultCamZoom:Float = 1.05;
// how big to stretch the pixel art assets
public static var daPixelZoom:Float = 6;
private var singAnimations:Array<String> = ['singLEFT', 'singDOWN', 'singUP', 'singRIGHT'];
public var inCutscene:Bool = false;
public var skipCountdown:Bool = false;
var songLength:Float = 0;
public var boyfriendCameraOffset:Array<Float> = null;
public var opponentCameraOffset:Array<Float> = null;
public var girlfriendCameraOffset:Array<Float> = null;
#if desktop
// Discord RPC variables
var storyDifficultyText:String = "";
var detailsText:String = "";
var detailsPausedText:String = "";
#end
//Achievement shit
var keysPressed:Array<Bool> = [];
var boyfriendIdleTime:Float = 0.0;
var boyfriendIdled:Bool = false;
// Lua shit
public static var instance:PlayState;
public var luaArray:Array<FunkinLua> = [];
private var luaDebugGroup:FlxTypedGroup<DebugLuaText>;
public var introSoundsSuffix:String = '';
// Debug buttons
private var debugKeysChart:Array<FlxKey>;
private var debugKeysCharacter:Array<FlxKey>;
// Less laggy controls
private var keysArray:Array<Dynamic>;
private var controlArray:Array<String>;
var precacheList:Map<String, String> = new Map<String, String>();
// stores the last judgement object
public static var lastRating:FlxSprite;
// stores the last combo sprite object
public static var lastCombo:FlxSprite;
// stores the last combo score objects in an array
public static var lastScore:Array<FlxSprite> = [];
override public function create()
{
//trace('Playback Rate: ' + playbackRate);
Paths.clearStoredMemory();
// for lua
instance = this;
debugKeysChart = ClientPrefs.copyKey(ClientPrefs.keyBinds.get('debug_1'));
debugKeysCharacter = ClientPrefs.copyKey(ClientPrefs.keyBinds.get('debug_2'));
PauseSubState.songName = null; //Reset to default
playbackRate = ClientPrefs.getGameplaySetting('songspeed', 1);
keysArray = [
ClientPrefs.copyKey(ClientPrefs.keyBinds.get('note_left')),
ClientPrefs.copyKey(ClientPrefs.keyBinds.get('note_down')),
ClientPrefs.copyKey(ClientPrefs.keyBinds.get('note_up')),
ClientPrefs.copyKey(ClientPrefs.keyBinds.get('note_right'))
];
controlArray = [
'NOTE_LEFT',
'NOTE_DOWN',
'NOTE_UP',
'NOTE_RIGHT'
];
//Ratings
ratingsData.push(new Rating('sick')); //default rating
var rating:Rating = new Rating('good');
rating.ratingMod = 0.7;
rating.score = 200;
rating.noteSplash = false;
ratingsData.push(rating);
var rating:Rating = new Rating('bad');
rating.ratingMod = 0.4;
rating.score = 100;
rating.noteSplash = false;
ratingsData.push(rating);
var rating:Rating = new Rating('shit');
rating.ratingMod = 0;
rating.score = 50;
rating.noteSplash = false;
ratingsData.push(rating);
// For the "Just the Two of Us" achievement
for (i in 0...keysArray.length)
{
keysPressed.push(false);
}
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
// Gameplay settings
healthGain = ClientPrefs.getGameplaySetting('healthgain', 1);
healthLoss = ClientPrefs.getGameplaySetting('healthloss', 1);
instakillOnMiss = ClientPrefs.getGameplaySetting('instakill', false);
practiceMode = ClientPrefs.getGameplaySetting('practice', false);
cpuControlled = ClientPrefs.getGameplaySetting('botplay', false);
// var gameCam:FlxCamera = FlxG.camera;
camGame = new FlxCamera();
camHUD = new FlxCamera();
camOther = new FlxCamera();
camHUD.bgColor.alpha = 0;
camOther.bgColor.alpha = 0;
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD, false);
FlxG.cameras.add(camOther, false);
grpNoteSplashes = new FlxTypedGroup<NoteSplash>();
FlxG.cameras.setDefaultDrawTarget(camGame, true);
CustomFadeTransition.nextCamera = camOther;
persistentUpdate = true;
persistentDraw = true;
if (SONG == null)
SONG = Song.loadFromJson('tutorial');
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);
#if desktop
storyDifficultyText = CoolUtil.difficulties[storyDifficulty];
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
if (isStoryMode)
{
detailsText = "Story Mode: " + WeekData.getCurrentWeek().weekName;
}
else
{
detailsText = "Freeplay";
}
// String for when the game is paused
detailsPausedText = "Paused - " + detailsText;
#end
GameOverSubstate.resetVariables();
var songName:String = Paths.formatToSongPath(SONG.song);
curStage = SONG.stage;
//trace('stage is: ' + curStage);
if(SONG.stage == null || SONG.stage.length < 1) {
switch (songName)
{
case 'spookeez' | 'south' | 'monster':
curStage = 'spooky';
case 'pico' | 'blammed' | 'philly' | 'philly-nice':
curStage = 'philly';
case 'milf' | 'satin-panties' | 'high':
curStage = 'limo';
case 'cocoa' | 'eggnog':
curStage = 'mall';
case 'winter-horrorland':
curStage = 'mallEvil';
case 'senpai' | 'roses':
curStage = 'school';
case 'thorns':
curStage = 'schoolEvil';
case 'ugh' | 'guns' | 'stress':
curStage = 'tank';
default:
curStage = 'stage';
}
}
SONG.stage = curStage;
var stageData:StageFile = StageData.getStageFile(curStage);
if(stageData == null) { //Stage couldn't be found, create a dummy stage for preventing a crash
stageData = {
directory: "",
defaultZoom: 0.9,
isPixelStage: false,
boyfriend: [770, 100],
girlfriend: [400, 130],
opponent: [100, 100],
hide_girlfriend: false,
camera_boyfriend: [0, 0],
camera_opponent: [0, 0],
camera_girlfriend: [0, 0],
camera_speed: 1
};
}
defaultCamZoom = stageData.defaultZoom;
isPixelStage = stageData.isPixelStage;
BF_X = stageData.boyfriend[0];
BF_Y = stageData.boyfriend[1];
GF_X = stageData.girlfriend[0];
GF_Y = stageData.girlfriend[1];
DAD_X = stageData.opponent[0];
DAD_Y = stageData.opponent[1];
if(stageData.camera_speed != null)
cameraSpeed = stageData.camera_speed;
boyfriendCameraOffset = stageData.camera_boyfriend;
if(boyfriendCameraOffset == null) //Fucks sake should have done it since the start :rolling_eyes:
boyfriendCameraOffset = [0, 0];
opponentCameraOffset = stageData.camera_opponent;
if(opponentCameraOffset == null)
opponentCameraOffset = [0, 0];
girlfriendCameraOffset = stageData.camera_girlfriend;
if(girlfriendCameraOffset == null)
girlfriendCameraOffset = [0, 0];
boyfriendGroup = new FlxSpriteGroup(BF_X, BF_Y);
dadGroup = new FlxSpriteGroup(DAD_X, DAD_Y);
gfGroup = new FlxSpriteGroup(GF_X, GF_Y);
switch (curStage)
{
case 'stage': //Week 1
var bg:BGSprite = new BGSprite('stageback', -600, -200, 0.9, 0.9);
add(bg);
var stageFront:BGSprite = new BGSprite('stagefront', -650, 600, 0.9, 0.9);
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
add(stageFront);
if(!ClientPrefs.lowQuality) {
var stageLight:BGSprite = new BGSprite('stage_light', -125, -100, 0.9, 0.9);
stageLight.setGraphicSize(Std.int(stageLight.width * 1.1));
stageLight.updateHitbox();
add(stageLight);
var stageLight:BGSprite = new BGSprite('stage_light', 1225, -100, 0.9, 0.9);
stageLight.setGraphicSize(Std.int(stageLight.width * 1.1));
stageLight.updateHitbox();
stageLight.flipX = true;
add(stageLight);
var stageCurtains:BGSprite = new BGSprite('stagecurtains', -500, -300, 1.3, 1.3);
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
add(stageCurtains);
}
dadbattleSmokes = new FlxSpriteGroup(); //troll'd
case 'spooky': //Week 2
if(!ClientPrefs.lowQuality) {
halloweenBG = new BGSprite('halloween_bg', -200, -100, ['halloweem bg0', 'halloweem bg lightning strike']);
} else {
halloweenBG = new BGSprite('halloween_bg_low', -200, -100);
}
add(halloweenBG);
halloweenWhite = new BGSprite(null, -800, -400, 0, 0);
halloweenWhite.makeGraphic(Std.int(FlxG.width * 2), Std.int(FlxG.height * 2), FlxColor.WHITE);
halloweenWhite.alpha = 0;
halloweenWhite.blend = ADD;
//PRECACHE SOUNDS
precacheList.set('thunder_1', 'sound');
precacheList.set('thunder_2', 'sound');
case 'philly': //Week 3
if(!ClientPrefs.lowQuality) {
var bg:BGSprite = new BGSprite('philly/sky', -100, 0, 0.1, 0.1);
add(bg);
}
var city:BGSprite = new BGSprite('philly/city', -10, 0, 0.3, 0.3);
city.setGraphicSize(Std.int(city.width * 0.85));
city.updateHitbox();
add(city);
phillyLightsColors = [0xFF31A2FD, 0xFF31FD8C, 0xFFFB33F5, 0xFFFD4531, 0xFFFBA633];
phillyWindow = new BGSprite('philly/window', city.x, city.y, 0.3, 0.3);
phillyWindow.setGraphicSize(Std.int(phillyWindow.width * 0.85));
phillyWindow.updateHitbox();
add(phillyWindow);
phillyWindow.alpha = 0;
if(!ClientPrefs.lowQuality) {
var streetBehind:BGSprite = new BGSprite('philly/behindTrain', -40, 50);
add(streetBehind);
}
phillyTrain = new BGSprite('philly/train', 2000, 360);
add(phillyTrain);
trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes'));
FlxG.sound.list.add(trainSound);
phillyStreet = new BGSprite('philly/street', -40, 50);
add(phillyStreet);
case 'limo': //Week 4
var skyBG:BGSprite = new BGSprite('limo/limoSunset', -120, -50, 0.1, 0.1);
add(skyBG);
if(!ClientPrefs.lowQuality) {
limoMetalPole = new BGSprite('gore/metalPole', -500, 220, 0.4, 0.4);
add(limoMetalPole);
bgLimo = new BGSprite('limo/bgLimo', -150, 480, 0.4, 0.4, ['background limo pink'], true);
add(bgLimo);
limoCorpse = new BGSprite('gore/noooooo', -500, limoMetalPole.y - 130, 0.4, 0.4, ['Henchmen on rail'], true);
add(limoCorpse);
limoCorpseTwo = new BGSprite('gore/noooooo', -500, limoMetalPole.y, 0.4, 0.4, ['henchmen death'], true);
add(limoCorpseTwo);
grpLimoDancers = new FlxTypedGroup<BackgroundDancer>();
add(grpLimoDancers);
for (i in 0...5)
{
var dancer:BackgroundDancer = new BackgroundDancer((370 * i) + 170, bgLimo.y - 400);
dancer.scrollFactor.set(0.4, 0.4);
grpLimoDancers.add(dancer);
}
limoLight = new BGSprite('gore/coldHeartKiller', limoMetalPole.x - 180, limoMetalPole.y - 80, 0.4, 0.4);
add(limoLight);
grpLimoParticles = new FlxTypedGroup<BGSprite>();
add(grpLimoParticles);
//PRECACHE BLOOD
var particle:BGSprite = new BGSprite('gore/stupidBlood', -400, -400, 0.4, 0.4, ['blood'], false);
particle.alpha = 0.01;
grpLimoParticles.add(particle);
resetLimoKill();
//PRECACHE SOUND
precacheList.set('dancerdeath', 'sound');
}
limo = new BGSprite('limo/limoDrive', -120, 550, 1, 1, ['Limo stage'], true);
fastCar = new BGSprite('limo/fastCarLol', -300, 160);
fastCar.active = true;
limoKillingState = 0;
case 'mall': //Week 5 - Cocoa, Eggnog
var bg:BGSprite = new BGSprite('christmas/bgWalls', -1000, -500, 0.2, 0.2);
bg.setGraphicSize(Std.int(bg.width * 0.8));
bg.updateHitbox();
add(bg);
if(!ClientPrefs.lowQuality) {
upperBoppers = new BGSprite('christmas/upperBop', -240, -90, 0.33, 0.33, ['Upper Crowd Bob']);
upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85));
upperBoppers.updateHitbox();
add(upperBoppers);
var bgEscalator:BGSprite = new BGSprite('christmas/bgEscalator', -1100, -600, 0.3, 0.3);
bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9));
bgEscalator.updateHitbox();
add(bgEscalator);
}
var tree:BGSprite = new BGSprite('christmas/christmasTree', 370, -250, 0.40, 0.40);
add(tree);
bottomBoppers = new BGSprite('christmas/bottomBop', -300, 140, 0.9, 0.9, ['Bottom Level Boppers Idle']);
bottomBoppers.animation.addByPrefix('hey', 'Bottom Level Boppers HEY', 24, false);
bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1));
bottomBoppers.updateHitbox();
add(bottomBoppers);
var fgSnow:BGSprite = new BGSprite('christmas/fgSnow', -600, 700);
add(fgSnow);
santa = new BGSprite('christmas/santa', -840, 150, 1, 1, ['santa idle in fear']);
add(santa);
precacheList.set('Lights_Shut_off', 'sound');
case 'mallEvil': //Week 5 - Winter Horrorland
var bg:BGSprite = new BGSprite('christmas/evilBG', -400, -500, 0.2, 0.2);
bg.setGraphicSize(Std.int(bg.width * 0.8));
bg.updateHitbox();
add(bg);
var evilTree:BGSprite = new BGSprite('christmas/evilTree', 300, -300, 0.2, 0.2);
add(evilTree);
var evilSnow:BGSprite = new BGSprite('christmas/evilSnow', -200, 700);
add(evilSnow);
case 'school': //Week 6 - Senpai, Roses
GameOverSubstate.deathSoundName = 'fnf_loss_sfx-pixel';
GameOverSubstate.loopSoundName = 'gameOver-pixel';
GameOverSubstate.endSoundName = 'gameOverEnd-pixel';
GameOverSubstate.characterName = 'bf-pixel-dead';
var bgSky:BGSprite = new BGSprite('weeb/weebSky', 0, 0, 0.1, 0.1);
add(bgSky);
bgSky.antialiasing = false;
var repositionShit = -200;
var bgSchool:BGSprite = new BGSprite('weeb/weebSchool', repositionShit, 0, 0.6, 0.90);
add(bgSchool);
bgSchool.antialiasing = false;
var bgStreet:BGSprite = new BGSprite('weeb/weebStreet', repositionShit, 0, 0.95, 0.95);
add(bgStreet);
bgStreet.antialiasing = false;
var widShit = Std.int(bgSky.width * 6);
if(!ClientPrefs.lowQuality) {
var fgTrees:BGSprite = new BGSprite('weeb/weebTreesBack', repositionShit + 170, 130, 0.9, 0.9);
fgTrees.setGraphicSize(Std.int(widShit * 0.8));
fgTrees.updateHitbox();
add(fgTrees);
fgTrees.antialiasing = false;
}
var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800);
bgTrees.frames = Paths.getPackerAtlas('weeb/weebTrees');
bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12);
bgTrees.animation.play('treeLoop');
bgTrees.scrollFactor.set(0.85, 0.85);
add(bgTrees);
bgTrees.antialiasing = false;
if(!ClientPrefs.lowQuality) {
var treeLeaves:BGSprite = new BGSprite('weeb/petals', repositionShit, -40, 0.85, 0.85, ['PETALS ALL'], true);
treeLeaves.setGraphicSize(widShit);
treeLeaves.updateHitbox();
add(treeLeaves);
treeLeaves.antialiasing = false;
}
bgSky.setGraphicSize(widShit);
bgSchool.setGraphicSize(widShit);
bgStreet.setGraphicSize(widShit);
bgTrees.setGraphicSize(Std.int(widShit * 1.4));
bgSky.updateHitbox();
bgSchool.updateHitbox();
bgStreet.updateHitbox();
bgTrees.updateHitbox();
if(!ClientPrefs.lowQuality) {
bgGirls = new BackgroundGirls(-100, 190);
bgGirls.scrollFactor.set(0.9, 0.9);
bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom));
bgGirls.updateHitbox();
add(bgGirls);
}
case 'schoolEvil': //Week 6 - Thorns
GameOverSubstate.deathSoundName = 'fnf_loss_sfx-pixel';
GameOverSubstate.loopSoundName = 'gameOver-pixel';
GameOverSubstate.endSoundName = 'gameOverEnd-pixel';
GameOverSubstate.characterName = 'bf-pixel-dead';
/*if(!ClientPrefs.lowQuality) { //Does this even do something?
var waveEffectBG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 3, 2);
var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2);
}*/
var posX = 400;
var posY = 200;
if(!ClientPrefs.lowQuality) {
var bg:BGSprite = new BGSprite('weeb/animatedEvilSchool', posX, posY, 0.8, 0.9, ['background 2'], true);
bg.scale.set(6, 6);
bg.antialiasing = false;
add(bg);
bgGhouls = new BGSprite('weeb/bgGhouls', -100, 190, 0.9, 0.9, ['BG freaks glitch instance'], false);
bgGhouls.setGraphicSize(Std.int(bgGhouls.width * daPixelZoom));
bgGhouls.updateHitbox();
bgGhouls.visible = false;
bgGhouls.antialiasing = false;
add(bgGhouls);
} else {
var bg:BGSprite = new BGSprite('weeb/animatedEvilSchool_low', posX, posY, 0.8, 0.9);
bg.scale.set(6, 6);
bg.antialiasing = false;
add(bg);
}
case 'tank': //Week 7 - Ugh, Guns, Stress
var sky:BGSprite = new BGSprite('tankSky', -400, -400, 0, 0);
add(sky);
if(!ClientPrefs.lowQuality)
{
var clouds:BGSprite = new BGSprite('tankClouds', FlxG.random.int(-700, -100), FlxG.random.int(-20, 20), 0.1, 0.1);
clouds.active = true;
clouds.velocity.x = FlxG.random.float(5, 15);
add(clouds);
var mountains:BGSprite = new BGSprite('tankMountains', -300, -20, 0.2, 0.2);
mountains.setGraphicSize(Std.int(1.2 * mountains.width));
mountains.updateHitbox();
add(mountains);
var buildings:BGSprite = new BGSprite('tankBuildings', -200, 0, 0.3, 0.3);
buildings.setGraphicSize(Std.int(1.1 * buildings.width));
buildings.updateHitbox();
add(buildings);
}
var ruins:BGSprite = new BGSprite('tankRuins',-200,0,.35,.35);
ruins.setGraphicSize(Std.int(1.1 * ruins.width));
ruins.updateHitbox();
add(ruins);
if(!ClientPrefs.lowQuality)
{
var smokeLeft:BGSprite = new BGSprite('smokeLeft', -200, -100, 0.4, 0.4, ['SmokeBlurLeft'], true);
add(smokeLeft);
var smokeRight:BGSprite = new BGSprite('smokeRight', 1100, -100, 0.4, 0.4, ['SmokeRight'], true);
add(smokeRight);
tankWatchtower = new BGSprite('tankWatchtower', 100, 50, 0.5, 0.5, ['watchtower gradient color']);
add(tankWatchtower);
}
tankGround = new BGSprite('tankRolling', 300, 300, 0.5, 0.5,['BG tank w lighting'], true);
add(tankGround);
tankmanRun = new FlxTypedGroup<TankmenBG>();
add(tankmanRun);
var ground:BGSprite = new BGSprite('tankGround', -420, -150);
ground.setGraphicSize(Std.int(1.15 * ground.width));
ground.updateHitbox();
add(ground);
moveTank();
foregroundSprites = new FlxTypedGroup<BGSprite>();
foregroundSprites.add(new BGSprite('tank0', -500, 650, 1.7, 1.5, ['fg']));
if(!ClientPrefs.lowQuality) foregroundSprites.add(new BGSprite('tank1', -300, 750, 2, 0.2, ['fg']));
foregroundSprites.add(new BGSprite('tank2', 450, 940, 1.5, 1.5, ['foreground']));
if(!ClientPrefs.lowQuality) foregroundSprites.add(new BGSprite('tank4', 1300, 900, 1.5, 1.5, ['fg']));
foregroundSprites.add(new BGSprite('tank5', 1620, 700, 1.5, 1.5, ['fg']));
if(!ClientPrefs.lowQuality) foregroundSprites.add(new BGSprite('tank3', 1300, 1200, 3.5, 2.5, ['fg']));
}
switch(Paths.formatToSongPath(SONG.song))
{
case 'stress':
GameOverSubstate.characterName = 'bf-holding-gf-dead';
}
if(isPixelStage) {
introSoundsSuffix = '-pixel';
}
add(gfGroup); //Needed for blammed lights
// Shitty layering but whatev it works LOL
if (curStage == 'limo')
add(limo);
add(dadGroup);
add(boyfriendGroup);
switch(curStage)
{
case 'spooky':
add(halloweenWhite);
case 'tank':
add(foregroundSprites);
}
#if LUA_ALLOWED
luaDebugGroup = new FlxTypedGroup<DebugLuaText>();
luaDebugGroup.cameras = [camOther];
add(luaDebugGroup);
#end
// "GLOBAL" SCRIPTS
#if LUA_ALLOWED
var filesPushed:Array<String> = [];
var foldersToCheck:Array<String> = [SUtil.getPath() + Paths.getPreloadPath('scripts/')];
#if MODS_ALLOWED
foldersToCheck.insert(0, Paths.mods('scripts/'));
if(Paths.currentModDirectory != null && Paths.currentModDirectory.length > 0)
foldersToCheck.insert(0, Paths.mods(Paths.currentModDirectory + '/scripts/'));
for(mod in Paths.getGlobalMods())
foldersToCheck.insert(0, Paths.mods(mod + '/scripts/'));
#end
for (folder in foldersToCheck)
{
if(FileSystem.exists(folder))
{
for (file in FileSystem.readDirectory(folder))
{
if(file.endsWith('.lua') && !filesPushed.contains(file))
{
luaArray.push(new FunkinLua(folder + file));
filesPushed.push(file);
}
}
}
}
#end
// STAGE SCRIPTS
#if (MODS_ALLOWED && LUA_ALLOWED)
startLuasOnFolder('stages/' + curStage + '.lua');
#end
var gfVersion:String = SONG.gfVersion;
if(gfVersion == null || gfVersion.length < 1)
{
switch (curStage)
{
case 'limo':
gfVersion = 'gf-car';
case 'mall' | 'mallEvil':
gfVersion = 'gf-christmas';
case 'school' | 'schoolEvil':
gfVersion = 'gf-pixel';
case 'tank':
gfVersion = 'gf-tankmen';
default:
gfVersion = 'gf';
}
switch(Paths.formatToSongPath(SONG.song))
{
case 'stress':
gfVersion = 'pico-speaker';
}
SONG.gfVersion = gfVersion; //Fix for the Chart Editor
}
if (!stageData.hide_girlfriend)
{
gf = new Character(0, 0, gfVersion);
startCharacterPos(gf);
gf.scrollFactor.set(0.95, 0.95);
gfGroup.add(gf);
startCharacterLua(gf.curCharacter);
if(gfVersion == 'pico-speaker')
{
if(!ClientPrefs.lowQuality)
{
var firstTank:TankmenBG = new TankmenBG(20, 500, true);
firstTank.resetShit(20, 600, true);
firstTank.strumTime = 10;
tankmanRun.add(firstTank);
for (i in 0...TankmenBG.animationNotes.length)
{
if(FlxG.random.bool(16)) {
var tankBih = tankmanRun.recycle(TankmenBG);
tankBih.strumTime = TankmenBG.animationNotes[i][0];
tankBih.resetShit(500, 200 + FlxG.random.int(50, 100), TankmenBG.animationNotes[i][1] < 2);
tankmanRun.add(tankBih);
}
}
}
}
}
dad = new Character(0, 0, SONG.player2);
startCharacterPos(dad, true);
dadGroup.add(dad);
startCharacterLua(dad.curCharacter);
boyfriend = new Boyfriend(0, 0, SONG.player1);
startCharacterPos(boyfriend);
boyfriendGroup.add(boyfriend);
startCharacterLua(boyfriend.curCharacter);
var camPos:FlxPoint = new FlxPoint(girlfriendCameraOffset[0], girlfriendCameraOffset[1]);
if(gf != null)
{
camPos.x += gf.getGraphicMidpoint().x + gf.cameraPosition[0];
camPos.y += gf.getGraphicMidpoint().y + gf.cameraPosition[1];
}
if(dad.curCharacter.startsWith('gf')) {
dad.setPosition(GF_X, GF_Y);
if(gf != null)
gf.visible = false;
}
switch(curStage)
{
case 'limo':
resetFastCar();
addBehindGF(fastCar);
case 'schoolEvil':
var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069); //nice
addBehindDad(evilTrail);
}
var file:String = Paths.json(songName + '/dialogue'); //Checks for json/Psych Engine dialogue
if (OpenFlAssets.exists(file)) {
dialogueJson = DialogueBoxPsych.parseDialogue(SUtil.getPath() + file);
}
var file:String = Paths.txt(songName + '/' + songName + 'Dialogue'); //Checks for vanilla/Senpai dialogue