-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathPlayState.hx
4568 lines (3752 loc) · 122 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 openfl.ui.KeyLocation;
import openfl.events.Event;
import haxe.EnumTools;
import openfl.ui.Keyboard;
import openfl.events.KeyboardEvent;
import Replay.Ana;
import Replay.Analysis;
#if cpp
import webm.WebmPlayer;
#end
import flixel.input.keyboard.FlxKey;
import haxe.Exception;
import openfl.geom.Matrix;
import openfl.display.BitmapData;
import openfl.utils.AssetType;
import lime.graphics.Image;
import flixel.graphics.FlxGraphic;
import openfl.utils.AssetManifest;
import openfl.utils.AssetLibrary;
import flixel.system.FlxAssets;
import lime.app.Application;
import lime.media.AudioContext;
import lime.media.AudioManager;
import openfl.Lib;
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.display.BlendMode;
import openfl.display.StageQuality;
import openfl.filters.ShaderFilter;
#if windows
import Discord.DiscordClient;
#end
#if windows
import Sys;
import sys.FileSystem;
#end
using StringTools;
class PlayState extends MusicBeatState
{
public static var instance:PlayState = null;
public static var curStage:String = '';
public static var SONG:SwagSong;
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 static var weekSong:Int = 0;
public static var weekScore:Int = 0;
public static var shits:Int = 0;
public static var bads:Int = 0;
public static var goods:Int = 0;
public static var sicks:Int = 0;
var spinArray:Array<Int>;
public static var songPosBG:FlxSprite;
public static var songPosBar:FlxBar;
public static var rep:Replay;
public static var loadRep:Bool = false;
public static var noteBools:Array<Bool> = [false, false, false, false];
var halloweenLevel:Bool = false;
var songLength:Float = 0;
var kadeEngineWatermark:FlxText;
#if windows
// Discord RPC variables
var storyDifficultyText:String = "";
var iconRPC:String = "";
var detailsText:String = "";
var detailsPausedText:String = "";
#end
private var vocals:FlxSound;
//sorry kade!! i stole yo code looolll!!!!!!
public var originalX:Float;
public static var dad:Character;
public static var gf:Character;
public static var boyfriend:Boyfriend;
public var notes:FlxTypedGroup<Note>;
private var unspawnNotes:Array<Note> = [];
public var strumLine:FlxSprite;
private var curSection:Int = 0;
var camLocked:Bool = true;
private var camFollow:FlxObject;
private static var prevCamFollow:FlxObject;
public static var strumLineNotes:FlxTypedGroup<FlxSprite> = null;
public static var playerStrums:FlxTypedGroup<FlxSprite> = null;
public static var cpuStrums:FlxTypedGroup<FlxSprite> = null;
private var camZooming:Bool = false;
private var curSong:String = "";
private var gfSpeed:Int = 1;
public var health:Float = 1; //making public because sethealth doesnt work without it
private var combo:Int = 0;
public static var misses:Int = 0;
public static var campaignMisses:Int = 0;
public var accuracy:Float = 0.00;
private var accuracyDefault:Float = 0.00;
private var totalNotesHit:Float = 0;
private var totalNotesHitDefault:Float = 0;
private var totalPlayed:Int = 0;
private var ss:Bool = false;
private var healthBarBG:FlxSprite;
private var healthBar:FlxBar;
private var songPositionBar:Float = 0;
private var generatedMusic:Bool = false;
private var shakeCam:Bool = false;
private var shakeCam2:Bool = false;
private var startingSong:Bool = false;
public var iconP1:HealthIcon; //making these public again because i may be stupid
public var iconP2:HealthIcon; //what could go wrong?
public var camHUD:FlxCamera;
private var camGame:FlxCamera;
public static var offsetTesting:Bool = false;
var notesHitArray:Array<Date> = [];
var currentFrames:Int = 0;
var daSection:Int = 1;
var daJumpscare:FlxSprite = new FlxSprite(0, 0);
public var dialogue:Array<String> = ['dad:blah blah blah', 'bf:coolswag'];
var halloweenBG:FlxSprite;
var isHalloween:Bool = false;
var phillyCityLights:FlxTypedGroup<FlxSprite>;
var phillyTrain:FlxSprite;
var trainSound:FlxSound;
var limo:FlxSprite;
var grpLimoDancers:FlxTypedGroup<BackgroundDancer>;
var fastCar:FlxSprite;
var songName:FlxText;
var upperBoppers:FlxSprite;
var bottomBoppers:FlxSprite;
var santa:FlxSprite;
var funpillarts1ANIM:FlxSprite;
var hands:FlxSprite;
var tree:FlxSprite;
var eyeflower:FlxSprite;
var blackFuck:FlxSprite;
var startCircle:FlxSprite;
var startText:FlxSprite;
var fc:Bool = true;
var bgGirls:BackgroundGirls;
var wiggleShit:WiggleEffect = new WiggleEffect();
var talking:Bool = true;
public var songScore:Int = 0;
var songScoreDef:Int = 0;
var scoreTxt:FlxText;
var replayTxt:FlxText;
public static var campaignScore:Int = 0;
var defaultCamZoom:Float = 1.05;
public static var daPixelZoom:Float = 6;
public static var theFunne:Bool = true;
var funneEffect:FlxSprite;
var inCutscene:Bool = false;
public static var repPresses:Int = 0;
public static var repReleases:Int = 0;
public static var timeCurrently:Float = 0;
public static var timeCurrentlyR:Float = 0;
// Will fire once to prevent debug spam messages and broken animations
private var triggeredAlready:Bool = false;
// Will decide if she's even allowed to headbang at all depending on the song
private var allowedToHeadbang:Bool = false;
// Per song additive offset
public static var songOffset:Float = 0;
// BotPlay text
private var botPlayState:FlxText;
// Replay shit
private var saveNotes:Array<Dynamic> = [];
private var saveJudge:Array<String> = [];
private var replayAna:Analysis = new Analysis(); // replay analysis
public static var highestCombo:Int = 0;
private var executeModchart = false;
// API stuff
public function addObject(object:FlxBasic) { add(object); }
public function removeObject(object:FlxBasic) { remove(object); }
override public function create()
{
SONG.noteStyle = ChartingState.defaultnoteStyle;
blackFuck = new FlxSprite().makeGraphic(1280,720, FlxColor.BLACK);
startCircle = new FlxSprite();
startText = new FlxSprite();
spinArray = [272, 276, 336, 340, 400, 404, 464, 468, 528, 532, 592, 596, 656, 660, 720, 724, 789, 793, 863, 867, 937, 941, 1012, 1016, 1086, 1090, 1160, 1164, 1531, 1535, 1607, 1611, 1681, 1685, 1754, 1758];
instance = this;
if (FlxG.save.data.fpsCap > 290)
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(800);
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
if (!isStoryMode)
{
sicks = 0;
bads = 0;
shits = 0;
goods = 0;
}
misses = 0;
repPresses = 0;
repReleases = 0;
PlayStateChangeables.useDownscroll = FlxG.save.data.downscroll;
PlayStateChangeables.safeFrames = FlxG.save.data.frames;
PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed;
PlayStateChangeables.botPlay = FlxG.save.data.botplay;
PlayStateChangeables.Optimize = FlxG.save.data.optimize;
// pre lowercasing the song name (create)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
removedVideo = false;
#if windows
executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart"));
if (executeModchart)
PlayStateChangeables.Optimize = false;
#end
#if !cpp
executeModchart = false; // FORCE disable for non cpp targets
#end
trace('Mod chart: ' + executeModchart + " - " + Paths.lua(songLowercase + "/modchart"));
#if windows
// Making difficulty text for Discord Rich Presence.
storyDifficultyText = CoolUtil.difficultyFromInt(storyDifficulty);
iconRPC = SONG.player2;
// To avoid having duplicate images in Discord assets
switch (iconRPC)
{
case 'senpai-angry':
iconRPC = 'senpai';
case 'monster-christmas':
iconRPC = 'monster';
case 'mom-car':
iconRPC = 'mom';
}
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
if (isStoryMode)
{
detailsText = "Story Mode: Week " + storyWeek;
}
else
{
detailsText = "Freeplay";
}
// String for when the game is paused
detailsPausedText = "Paused - " + detailsText;
// Updating Discord Rich Presence.
DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC);
#end
// var gameCam:FlxCamera = FlxG.camera;
camGame = new FlxCamera();
camHUD = new FlxCamera();
camHUD.bgColor.alpha = 0;
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD);
FlxCamera.defaultCameras = [camGame];
persistentUpdate = true;
persistentDraw = true;
if (SONG == null)
SONG = Song.loadFromJson('tutorial', 'tutorial');
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay);
//dialogue shit
switch (songLowercase)
{
case 'tutorial':
dialogue = ["Hey you're pretty cute.", 'Use the arrow keys to keep up \nwith me singing.'];
case 'bopeebo':
dialogue = [
'HEY!',
"You think you can just sing\nwith my daughter like that?",
"If you want to date her...",
"You're going to have to go \nthrough ME first!"
];
case 'fresh':
dialogue = ["Not too shabby boy.", ""];
case 'dadbattle':
dialogue = [
"gah you think you're hot stuff?",
"If you can beat me here...",
"Only then I will even CONSIDER letting you\ndate my daughter!"
];
case 'senpai':
dialogue = CoolUtil.coolTextFile(Paths.txt('senpai/senpaiDialogue'));
case 'roses':
dialogue = CoolUtil.coolTextFile(Paths.txt('roses/rosesDialogue'));
case 'thorns':
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
}
//defaults if no stage was found in chart
var stageCheck:String = 'stage';
if (SONG.stage == null) {
switch(storyWeek)
{
case 2: stageCheck = 'halloween';
case 3: stageCheck = 'philly';
case 4: stageCheck = 'limo';
case 5: if (songLowercase == 'winter-horrorland') {stageCheck = 'mallEvil';} else {stageCheck = 'mall';}
case 6: if (songLowercase == 'thorns') {stageCheck = 'schoolEvil';} else {stageCheck = 'school';}
//i should check if its stage (but this is when none is found in chart anyway)
}
} else {stageCheck = SONG.stage;}
if (!PlayStateChangeables.Optimize)
{
switch(stageCheck)
{
//SONG 1 STAGE
case 'sonicStage':
{
defaultCamZoom = 1.0;
curStage = 'SONICstage';
var sSKY:FlxSprite = new FlxSprite(-300, 0).loadGraphic(Paths.image('SonicStages/sky'));
sSKY.antialiasing = true;
sSKY.scrollFactor.set(0.85, 0.85);
sSKY.active = false;
add(sSKY);
var bg2:FlxSprite = new FlxSprite(-300, -125).loadGraphic(Paths.image('SonicStages/floor2'));
bg2.updateHitbox();
bg2.antialiasing = true;
bg2.scrollFactor.set(0.9, 0.9);
bg2.active = false;
add(bg2);
var bg:FlxSprite = new FlxSprite(-300, -100).loadGraphic(Paths.image('SonicStages/floor1'));
bg.antialiasing = true;
bg.scrollFactor.set(0.95, 0.95);
bg.active = false;
add(bg);
var eggman:FlxSprite = new FlxSprite(-260, -120).loadGraphic(Paths.image('SonicStages/eggman'));
eggman.setGraphicSize(Std.int(eggman.width * 0.9));
eggman.updateHitbox();
eggman.antialiasing = true;
eggman.scrollFactor.set(.95, .95);
eggman.active = false;
add(eggman);
var tail:FlxSprite = new FlxSprite(-280, -100).loadGraphic(Paths.image('SonicStages/tail'));
tail.setGraphicSize(Std.int(tail.width * 0.9));
tail.updateHitbox();
tail.antialiasing = true;
tail.scrollFactor.set(.99, .99);
tail.active = false;
add(tail);
var knuckle:FlxSprite = new FlxSprite(315, 0).loadGraphic(Paths.image('SonicStages/knuckle'));
knuckle.setGraphicSize(Std.int(knuckle.width * 0.9));
knuckle.updateHitbox();
knuckle.antialiasing = true;
knuckle.scrollFactor.set(.99, .99);
knuckle.active = false;
add(knuckle);
var sticklol:FlxSprite = new FlxSprite(-300, -50).loadGraphic(Paths.image('SonicStages/sticklol'));
sticklol.setGraphicSize(Std.int(sticklol.width * 0.9));
sticklol.updateHitbox();
sticklol.antialiasing = true;
sticklol.scrollFactor.set(1, 1);
sticklol.active = false;
add(sticklol);
}
case 'LordXStage': //epic
{
defaultCamZoom = .73;
curStage = 'LordXStage';
var sky:FlxSprite = new FlxSprite(-1900, -1006).loadGraphic(Paths.image('LordXStage/sky'));
sky.setGraphicSize(Std.int(sky.width * .5));
sky.antialiasing = true;
sky.scrollFactor.set(.95, 1);
sky.active = false;
add(sky);
var hills1:FlxSprite = new FlxSprite(-1900, -1006).loadGraphic(Paths.image('LordXStage/hills1'));
hills1.setGraphicSize(Std.int(hills1.width * .5));
hills1.antialiasing = true;
hills1.scrollFactor.set(.95, 1);
hills1.active = false;
add(hills1);
var hills2:FlxSprite = new FlxSprite(-1900, -1006).loadGraphic(Paths.image('LordXStage/hills2'));
hills2.setGraphicSize(Std.int(hills2.width * .5));
hills2.antialiasing = true;
hills2.scrollFactor.set(.97, 1);
hills2.active = false;
add(hills2);
var floor:FlxSprite = new FlxSprite(-1900, -996).loadGraphic(Paths.image('LordXStage/floor'));
floor.setGraphicSize(Std.int(floor.width * .5));
floor.antialiasing = true;
floor.scrollFactor.set(1, 1);
floor.active = false;
add(floor);
eyeflower = new FlxSprite(-200,300);
eyeflower.frames = Paths.getSparrowAtlas('LordXStage/ANIMATEDeye', 'exe');
eyeflower.animation.addByPrefix('animatedeye', 'EyeAnimated', 24);
eyeflower.setGraphicSize(Std.int(eyeflower.width * 2));
eyeflower.antialiasing = true;
eyeflower.scrollFactor.set(1, 1);
add(eyeflower);
hands = new FlxSprite(-200, -600);
hands.frames = Paths.getSparrowAtlas('LordXStage/SonicXHandsAnimated', 'exe');
hands.animation.addByPrefix('handss', 'HandsAnimated', 24);
hands.setGraphicSize(Std.int(hands.width * .5));
hands.antialiasing = true;
hands.scrollFactor.set(1, 1);
add(hands);
var smallflower:FlxSprite = new FlxSprite(-1900, -1006).loadGraphic(Paths.image('LordXStage/smallflower'));
smallflower.setGraphicSize(Std.int(smallflower.width * .5));
smallflower.antialiasing = true;
smallflower.scrollFactor.set(1.005, 1.005);
smallflower.active = false;
add(smallflower);
var smallflower:FlxSprite = new FlxSprite(-1900, -1006).loadGraphic(Paths.image('LordXStage/smallflower'));
smallflower.setGraphicSize(Std.int(smallflower.width * .5));
smallflower.antialiasing = true;
smallflower.scrollFactor.set(1.005, 1.005);
smallflower.active = false;
add(smallflower);
var smallflowe2:FlxSprite = new FlxSprite(-1900, -1006).loadGraphic(Paths.image('LordXStage/smallflowe2'));
smallflowe2.setGraphicSize(Std.int(smallflower.width * .5));
smallflowe2.antialiasing = true;
smallflowe2.scrollFactor.set(1.005, 1.005);
smallflowe2.active = false;
add(smallflowe2);
tree = new FlxSprite(1250, -50);
tree.frames = Paths.getSparrowAtlas('LordXStage/TreeAnimatedMoment', 'exe');
tree.animation.addByPrefix('treeanimation', 'TreeAnimated', 24);
tree.setGraphicSize(Std.int(tree.width * 2));
tree.antialiasing = true;
tree.scrollFactor.set(1, 1);
add(tree);
}
//SECRET SONG STAGE!!! Really razen... you really had to say it here?
case 'sonicfunStage':
{
defaultCamZoom = 0.9;
curStage = 'sonicFUNSTAGE';
var funsky:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('FunInfiniteStage/sonicFUNsky'));
funsky.setGraphicSize(Std.int(funsky.width * 0.9));
funsky.antialiasing = true;
funsky.scrollFactor.set(0.3, 0.3);
funsky.active = false;
add(funsky);
var funfloor:FlxSprite = new FlxSprite(-600, -400).loadGraphic(Paths.image('FunInfiniteStage/sonicFUNfloor'));
funfloor.setGraphicSize(Std.int(funfloor.width * 0.9), Std.int(funfloor.height * 1.2));
funfloor.antialiasing = true;
funfloor.scrollFactor.set(0.5, 0.5);
funfloor.active = false;
add(funfloor);
var funpillars3:FlxSprite = new FlxSprite(-600, -0).loadGraphic(Paths.image('FunInfiniteStage/sonicFUNpillars3'));
funpillars3.setGraphicSize(Std.int(funpillars3.width * 0.7));
funpillars3.antialiasing = true;
funpillars3.scrollFactor.set(0.6, 0.7);
funpillars3.active = false;
add(funpillars3);
var funpillars2:FlxSprite = new FlxSprite(-600, -0).loadGraphic(Paths.image('FunInfiniteStage/sonicFUNpillars2'));
funpillars2.setGraphicSize(Std.int(funpillars2.width * 0.7));
funpillars2.antialiasing = true;
funpillars2.scrollFactor.set(0.7, 0.7);
funpillars2.active = false;
add(funpillars2);
funpillarts1ANIM = new FlxSprite(-400, 0);
funpillarts1ANIM.frames = Paths.getSparrowAtlas('FunInfiniteStage/FII_BG', 'exe');
funpillarts1ANIM.animation.addByPrefix('bumpypillar', 'sonicboppers', 24);
funpillarts1ANIM.setGraphicSize(Std.int(funpillarts1ANIM.width * 0.7));
funpillarts1ANIM.antialiasing = true;
funpillarts1ANIM.scrollFactor.set(0.82, 0.82);
add(funpillarts1ANIM);
}
case 'stage':
{
defaultCamZoom = 0.9;
curStage = 'stage';
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback'));
bg.antialiasing = true;
bg.scrollFactor.set(0.9, 0.9);
bg.active = false;
add(bg);
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront'));
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
stageFront.antialiasing = true;
stageFront.scrollFactor.set(0.9, 0.9);
stageFront.active = false;
add(stageFront);
var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains'));
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
stageCurtains.antialiasing = true;
stageCurtains.scrollFactor.set(1.3, 1.3);
stageCurtains.active = false;
add(stageCurtains);
}
default:
{
defaultCamZoom = 0.9;
curStage = 'stage';
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback'));
bg.antialiasing = true;
bg.scrollFactor.set(0.9, 0.9);
bg.active = false;
add(bg);
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront'));
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
stageFront.antialiasing = true;
stageFront.scrollFactor.set(0.9, 0.9);
stageFront.active = false;
add(stageFront);
var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains'));
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
stageCurtains.antialiasing = true;
stageCurtains.scrollFactor.set(1.3, 1.3);
stageCurtains.active = false;
add(stageCurtains);
}
}
}
//defaults if no gf was found in chart
var gfCheck:String = 'gf';
if (SONG.gfVersion == null) {
switch(storyWeek)
{
case 4: gfCheck = 'gf-car';
case 5: gfCheck = 'gf-christmas';
case 6: gfCheck = 'gf-pixel';
}
} else {gfCheck = SONG.gfVersion;}
var curGf:String = '';
switch (gfCheck)
{
case 'gf-car':
curGf = 'gf-car';
case 'gf-christmas':
curGf = 'gf-christmas';
case 'gf-pixel':
curGf = 'gf-pixel';
default:
curGf = 'gf';
}
gf = new Character(400, 130, curGf);
gf.scrollFactor.set(0.95, 0.95);
dad = new Character(100, 100, SONG.player2);
var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x, dad.getGraphicMidpoint().y );
switch (SONG.player2)
{
case 'gf':
dad.setPosition(gf.x, gf.y);
gf.visible = false;
if (isStoryMode)
{
camPos.x += 600;
tweenCamIn();
}
case "spooky":
dad.y += 200;
case "monster":
dad.y += 100;
case 'monster-christmas':
dad.y += 130;
case 'dad':
camPos.x += 400;
case 'pico':
camPos.x += 600;
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':
dad.x += 150;
dad.y += 360;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
case 'spirit':
dad.x -= 150;
dad.y += 100;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
case 'sonic':
dad.x -= 130;
dad.y += -50;
}
boyfriend = new Boyfriend(770, 450, SONG.player1);
// REPOSITIONING PER STAGE
switch (curStage)
{
case 'limo':
boyfriend.y -= 220;
boyfriend.x += 260;
if(FlxG.save.data.distractions){
resetFastCar();
add(fastCar);
}
case 'mall':
boyfriend.x += 200;
case 'SONICstage':
boyfriend.y += 25;
dad.y += 200;
dad.x += 200;
dad.scale.x = 1.1;
dad.scale.y = 1.1;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y - 100);
case 'sonicFUNSTAGE':
boyfriend.y += 340;
boyfriend.x += 80;
dad.y += 450;
gf.y += 300;
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y - 200);
case 'LordXStage':
dad.scale.x = 1.4;
dad.scale.y = 1.4;
dad.y += 50;
boyfriend.y += 40;
camPos.set(dad.getGraphicMidpoint().x + 200, dad.getGraphicMidpoint().y);
case 'mallEvil':
boyfriend.x += 320;
dad.y -= 80;
case 'school':
boyfriend.x += 200;
boyfriend.y += 220;
gf.x += 180;
gf.y += 300;
case 'schoolEvil':
if(FlxG.save.data.distractions){
// trailArea.scrollFactor.set();
var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069);
// evilTrail.changeValuesEnabled(false, false, false, false);
// evilTrail.changeGraphic()
add(evilTrail);
// evilTrail.scrollFactor.set(1.1, 1.1);
}
boyfriend.x += 200;
boyfriend.y += 220;
gf.x += 180;
gf.y += 300;
}
if (!PlayStateChangeables.Optimize)
{
if (curStage != 'sonicFUNSTAGE' && curStage != 'LordXStage') add(gf);
// Shitty layering but whatev it works LOL
if (curStage == 'limo')
add(limo);
add(dad);
add(boyfriend);
}
if (loadRep)
{
FlxG.watch.addQuick('rep rpesses',repPresses);
FlxG.watch.addQuick('rep releases',repReleases);
// FlxG.watch.addQuick('Queued',inputsQueued);
PlayStateChangeables.useDownscroll = rep.replay.isDownscroll;
PlayStateChangeables.safeFrames = rep.replay.sf;
PlayStateChangeables.botPlay = true;
}
trace('uh ' + PlayStateChangeables.safeFrames);
trace("SF CALC: " + Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
var doof:DialogueBox = new DialogueBox(false, dialogue);
// doof.x += 70;
// doof.y = FlxG.height * 0.5;
doof.scrollFactor.set();
doof.finishThing = startCountdown;
Conductor.songPosition = -5000;
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
strumLine.scrollFactor.set();
if (PlayStateChangeables.useDownscroll)
strumLine.y = FlxG.height - 165;
strumLineNotes = new FlxTypedGroup<FlxSprite>();
add(strumLineNotes);
playerStrums = new FlxTypedGroup<FlxSprite>();
cpuStrums = new FlxTypedGroup<FlxSprite>();
// startCountdown();
if (SONG.song == null)
trace('song is null???');
else
trace('song looks gucci');
generateSong(SONG.song);
trace('generated');
// add(strumLine);
camFollow = new FlxObject(0, 0, 1, 1);
camFollow.setPosition(camPos.x , camPos.y);
if (prevCamFollow != null)
{
camFollow = prevCamFollow;
prevCamFollow = null;
}
add(camFollow);
if (curSong.toLowerCase() == 'too-slow')
{
FlxG.camera.follow(camFollow, LOCKON, 0.05 * (30 / (cast (Lib.current.getChildAt(0), Main)).getFPS()));
}
else if (curSong.toLowerCase() == 'endless')
{
FlxG.camera.follow(camFollow, LOCKON, 0.04 * (30 / (cast (Lib.current.getChildAt(0), Main)).getFPS()));
}
else if (curSong.toLowerCase() == 'execution')
{
FlxG.camera.follow(camFollow, LOCKON, 0.08 * (30 / (cast (Lib.current.getChildAt(0), Main)).getFPS()));
}
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
FlxG.camera.zoom = defaultCamZoom;
FlxG.camera.focusOn(camFollow.getPosition());
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
FlxG.fixedTimestep = false;
if (FlxG.save.data.songPosition) // I dont wanna talk about this code :(
{
songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar'));
if (PlayStateChangeables.useDownscroll)
songPosBG.y = FlxG.height * 0.9 + 45;
songPosBG.screenCenter(X);
songPosBG.scrollFactor.set();
add(songPosBG);
songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this,
'songPositionBar', 0, 90000);
songPosBar.scrollFactor.set();
songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME);
add(songPosBar);
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - (SONG.song.length * 5),songPosBG.y,0,SONG.song, 16);
if (PlayStateChangeables.useDownscroll)
songName.y -= 3;
songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
songName.scrollFactor.set();
add(songName);
songName.cameras = [camHUD];
}
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar'));
if (PlayStateChangeables.useDownscroll)
healthBarBG.y = 50;
healthBarBG.screenCenter(X);
healthBarBG.scrollFactor.set();
add(healthBarBG);
healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this,
'health', 0, 2);
healthBar.scrollFactor.set();
switch (curStage)
{
case 'SONICstage':
healthBar.createFilledBar(FlxColor.fromRGB(0, 49, 173), 0xFF66FF33); //FlxColor.fromRGB(0, 49, 173)
case 'sonicFUNSTAGE':
healthBar.createFilledBar(FlxColor.fromRGB(60, 0, 138), 0xFF66FF33);//FlxColor.fromRGB(60, 0, 138)
default:
healthBar.createFilledBar(0xFFFF0000, 0xFF66FF33);
}
// healthBar
add(healthBar);
// Add Kade Engine watermark
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " - " + CoolUtil.difficultyFromInt(storyDifficulty) + (Main.watermarks ? " | KE " + MainMenuState.kadeEngineVer : ""), 16);
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
kadeEngineWatermark.scrollFactor.set();
add(kadeEngineWatermark);
if (PlayStateChangeables.useDownscroll)
kadeEngineWatermark.y = FlxG.height * 0.9 + 45;
scoreTxt = new FlxText(FlxG.width / 2 - 235, healthBarBG.y + 50, 0, "", 20);
scoreTxt.screenCenter(X);
originalX = scoreTxt.x;
scoreTxt.scrollFactor.set();
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
add(scoreTxt);
replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "REPLAY", 20);
replayTxt.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
replayTxt.borderSize = 4;
replayTxt.borderQuality = 2;
replayTxt.scrollFactor.set();
if (loadRep)
{
add(replayTxt);
}
// Literally copy-paste of the above, fu
botPlayState = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "BOTPLAY", 20);
botPlayState.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
botPlayState.scrollFactor.set();
botPlayState.borderSize = 4;
botPlayState.borderQuality = 2;