Skip to content

Commit 74a7de5

Browse files
committed
Prevent [GF] lagging pico songs fix
1 parent 39d4b3f commit 74a7de5

File tree

2 files changed

+47
-45
lines changed

2 files changed

+47
-45
lines changed

preload/scripts/stages/phillyTrain.hxc

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class PhillyTrainStage extends Stage
2727
var lightShader:FlxRuntimeShader;
2828
var trainSound:FunkinSound;
2929

30+
var gfHasHairBlowAnim:Bool;
31+
3032
var trainEnabled:Bool = true;
3133

3234
function buildStage()
@@ -84,13 +86,13 @@ class PhillyTrainStage extends Stage
8486
// Update train cooldown
8587
if (!trainMoving) trainCooldown += 1;
8688

87-
// Start train
88-
if (event.beat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
89-
{
90-
trainCooldown = FlxG.random.int(-4, 0);
91-
trainStart();
92-
}
93-
}
89+
// Start train
90+
if (event.beat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
91+
{
92+
trainCooldown = FlxG.random.int(-4, 0);
93+
if(gfHasHairBlowAnim == null) gfHasHairBlowAnim = getGirlfriend().hasAnimation('hairBlow');
94+
trainStart();
95+
}
9496

9597
// Update lights
9698
if (event.beat % 4 == 0)
@@ -133,13 +135,13 @@ class PhillyTrainStage extends Stage
133135

134136
var startedMoving:Bool = false;
135137

136-
function updateTrainPos():Void
137-
{
138-
if (trainSound.time >= 4700)
139-
{
140-
startedMoving = true;
141-
getGirlfriend().playAnimation('hairBlow');
142-
}
138+
function updateTrainPos():Void
139+
{
140+
if (trainSound.time >= 4700)
141+
{
142+
startedMoving = true;
143+
if(gfHasHairBlowAnim) getGirlfriend().playAnimation('hairBlow');
144+
}
143145

144146
if (startedMoving)
145147
{
@@ -158,10 +160,10 @@ class PhillyTrainStage extends Stage
158160
}
159161
}
160162

161-
function trainReset():Void
162-
{
163-
getGirlfriend().playAnimation('hairFall');
164-
getNamedProp('train').x = FlxG.width + 200;
163+
function trainReset():Void
164+
{
165+
if(gfHasHairBlowAnim) getGirlfriend().playAnimation('hairFall');
166+
getNamedProp('train').x = FlxG.width + 200;
165167

166168
trainMoving = false;
167169
trainCars = 8;

preload/scripts/stages/phillyTrainErect.hxc

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class PhillyTrainErectStage extends Stage
4646

4747
var isMobilePauseButtonPressed:Bool = false;
4848

49+
var gfHasHairBlowAnim:Bool;
50+
4951
/**
5052
* Replay the cutscene after leaving the song.
5153
*/
@@ -475,13 +477,13 @@ class PhillyTrainErectStage extends Stage
475477
// Update train cooldown
476478
if (!trainMoving) trainCooldown += 1;
477479

478-
// Start train
479-
if (event.beat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
480-
{
481-
trainCooldown = FlxG.random.int(-4, 0);
482-
trainStart();
483-
}
484-
}
480+
// Start train
481+
if (event.beat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
482+
{
483+
trainCooldown = FlxG.random.int(-4, 0);
484+
if(gfHasHairBlowAnim == null) gfHasHairBlowAnim = getGirlfriend().hasAnimation('hairBlow');
485+
trainStart();
486+
}
485487

486488
// Update lights
487489
if (event.beat % 4 == 0)
@@ -511,19 +513,18 @@ class PhillyTrainErectStage extends Stage
511513

512514
var startedMoving:Bool = false;
513515

514-
function updateTrainPos():Void
515-
{
516-
if (trainSound.time >= 4700)
517-
{
518-
startedMoving = true;
519-
switch (getGirlfriend().characterId)
520-
{
521-
case 'nene':
522-
getGirlfriend().scriptSet('trainPassing', true);
523-
default:
524-
getGirlfriend().playAnimation('hairBlow');
525-
}
526-
}
516+
function updateTrainPos():Void
517+
{
518+
if (trainSound.time >= 4700)
519+
{
520+
startedMoving = true;
521+
switch(getGirlfriend().characterId){
522+
case 'nene':
523+
getGirlfriend().scriptSet('trainPassing', true);
524+
default:
525+
if(gfHasHairBlowAnim) getGirlfriend().playAnimation('hairBlow');
526+
}
527+
}
527528

528529
if (startedMoving)
529530
{
@@ -546,13 +547,12 @@ class PhillyTrainErectStage extends Stage
546547
{
547548
getNamedProp('train').x = FlxG.width + 200;
548549

549-
switch (getGirlfriend().characterId)
550-
{
551-
case 'nene':
552-
getGirlfriend().scriptSet('trainPassing', false);
553-
default:
554-
getGirlfriend().playAnimation('hairFall');
555-
}
550+
switch(getGirlfriend().characterId){
551+
case 'nene':
552+
getGirlfriend().scriptSet('trainPassing', false);
553+
default:
554+
if(gfHasHairBlowAnim) getGirlfriend().playAnimation('hairFall');
555+
}
556556

557557
trainMoving = false;
558558
trainCars = 8;

0 commit comments

Comments
 (0)