mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-03-01 01:54:01 -05:00
entirely phase out totalBeats/totalSteps in favor of the more reliable curStep/curBeat
This commit is contained in:
parent
f3462c2c99
commit
a8a3c96e7b
3 changed files with 17 additions and 40 deletions
|
@ -12,9 +12,6 @@ class MusicBeatState extends FlxUIState
|
||||||
private var lastBeat:Float = 0;
|
private var lastBeat:Float = 0;
|
||||||
private var lastStep:Float = 0;
|
private var lastStep:Float = 0;
|
||||||
|
|
||||||
private var totalBeats:Int = 0;
|
|
||||||
private var totalSteps:Int = 0;
|
|
||||||
|
|
||||||
private var curStep:Int = 0;
|
private var curStep:Int = 0;
|
||||||
private var curBeat:Int = 0;
|
private var curBeat:Int = 0;
|
||||||
private var controls(get, never):Controls;
|
private var controls(get, never):Controls;
|
||||||
|
@ -40,12 +37,11 @@ class MusicBeatState extends FlxUIState
|
||||||
var oldStep:Int = curStep;
|
var oldStep:Int = curStep;
|
||||||
|
|
||||||
updateCurStep();
|
updateCurStep();
|
||||||
|
updateBeat();
|
||||||
|
|
||||||
if (oldStep != curStep && curStep > 0)
|
if (oldStep != curStep && curStep > 0)
|
||||||
stepHit();
|
stepHit();
|
||||||
|
|
||||||
updateBeat();
|
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,23 +68,12 @@ class MusicBeatState extends FlxUIState
|
||||||
|
|
||||||
public function stepHit():Void
|
public function stepHit():Void
|
||||||
{
|
{
|
||||||
totalSteps += 1;
|
if (curStep % 4 == 0)
|
||||||
lastStep += Conductor.stepCrochet;
|
|
||||||
|
|
||||||
// If the song is at least 3 steps behind
|
|
||||||
if (Conductor.songPosition > lastStep + (Conductor.stepCrochet * 3))
|
|
||||||
{
|
|
||||||
lastStep = Conductor.songPosition;
|
|
||||||
totalSteps = Math.ceil(lastStep / Conductor.stepCrochet);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (totalSteps % 4 == 0)
|
|
||||||
beatHit();
|
beatHit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beatHit():Void
|
public function beatHit():Void
|
||||||
{
|
{
|
||||||
lastBeat += Conductor.crochet;
|
//do literally nothing dumbass
|
||||||
totalBeats += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,6 @@ class MusicBeatSubstate extends FlxSubState
|
||||||
private var lastBeat:Float = 0;
|
private var lastBeat:Float = 0;
|
||||||
private var lastStep:Float = 0;
|
private var lastStep:Float = 0;
|
||||||
|
|
||||||
private var totalBeats:Int = 0;
|
|
||||||
private var totalSteps:Int = 0;
|
|
||||||
|
|
||||||
private var curStep:Int = 0;
|
private var curStep:Int = 0;
|
||||||
private var curBeat:Int = 0;
|
private var curBeat:Int = 0;
|
||||||
private var controls(get, never):Controls;
|
private var controls(get, never):Controls;
|
||||||
|
@ -39,11 +36,11 @@ class MusicBeatSubstate extends FlxSubState
|
||||||
var oldStep:Int = curStep;
|
var oldStep:Int = curStep;
|
||||||
|
|
||||||
updateCurStep();
|
updateCurStep();
|
||||||
|
curBeat = Math.floor(curStep / 4);
|
||||||
|
|
||||||
if (oldStep != curStep && curStep > 0)
|
if (oldStep != curStep && curStep > 0)
|
||||||
stepHit();
|
stepHit();
|
||||||
|
|
||||||
curBeat = Math.floor(curStep / 4);
|
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
|
@ -66,16 +63,12 @@ class MusicBeatSubstate extends FlxSubState
|
||||||
|
|
||||||
public function stepHit():Void
|
public function stepHit():Void
|
||||||
{
|
{
|
||||||
totalSteps += 1;
|
if (curStep % 4 == 0)
|
||||||
lastStep += Conductor.stepCrochet;
|
|
||||||
|
|
||||||
if (totalSteps % 4 == 0)
|
|
||||||
beatHit();
|
beatHit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beatHit():Void
|
public function beatHit():Void
|
||||||
{
|
{
|
||||||
lastBeat += Conductor.crochet;
|
//do literally nothing dumbass
|
||||||
totalBeats += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1446,13 +1446,13 @@ class PlayState extends MusicBeatState
|
||||||
camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95);
|
camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95);
|
||||||
}
|
}
|
||||||
|
|
||||||
FlxG.watch.addQuick("beatShit", totalBeats);
|
FlxG.watch.addQuick("beatShit", curBeat);
|
||||||
FlxG.watch.addQuick("stepShit", totalSteps);
|
FlxG.watch.addQuick("stepShit", curStep);
|
||||||
|
|
||||||
|
|
||||||
if (curSong == 'Fresh')
|
if (curSong == 'Fresh')
|
||||||
{
|
{
|
||||||
switch (totalBeats)
|
switch (curBeat)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
camZooming = true;
|
camZooming = true;
|
||||||
|
@ -1471,7 +1471,7 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
if (curSong == 'Bopeebo')
|
if (curSong == 'Bopeebo')
|
||||||
{
|
{
|
||||||
switch (totalBeats)
|
switch (curBeat)
|
||||||
{
|
{
|
||||||
case 128, 129, 130:
|
case 128, 129, 130:
|
||||||
vocals.volume = 0;
|
vocals.volume = 0;
|
||||||
|
@ -2240,6 +2240,7 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
override function stepHit()
|
override function stepHit()
|
||||||
{
|
{
|
||||||
|
super.stepHit();
|
||||||
if (SONG.needsVoices)
|
if (SONG.needsVoices)
|
||||||
{
|
{
|
||||||
if (vocals.time > Conductor.songPosition + 20 || vocals.time < Conductor.songPosition - 20)
|
if (vocals.time > Conductor.songPosition + 20 || vocals.time < Conductor.songPosition - 20)
|
||||||
|
@ -2248,12 +2249,10 @@ class PlayState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dad.curCharacter == 'spooky' && totalSteps % 4 == 2)
|
if (dad.curCharacter == 'spooky' && curStep % 4 == 2)
|
||||||
{
|
{
|
||||||
// dad.dance();
|
// dad.dance();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.stepHit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var lightningStrikeBeat:Int = 0;
|
var lightningStrikeBeat:Int = 0;
|
||||||
|
@ -2292,7 +2291,7 @@ class PlayState extends MusicBeatState
|
||||||
camHUD.zoom += 0.03;
|
camHUD.zoom += 0.03;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0)
|
if (camZooming && FlxG.camera.zoom < 1.35 && curBeat % 4 == 0)
|
||||||
{
|
{
|
||||||
FlxG.camera.zoom += 0.015;
|
FlxG.camera.zoom += 0.015;
|
||||||
camHUD.zoom += 0.03;
|
camHUD.zoom += 0.03;
|
||||||
|
@ -2304,7 +2303,7 @@ class PlayState extends MusicBeatState
|
||||||
iconP1.updateHitbox();
|
iconP1.updateHitbox();
|
||||||
iconP2.updateHitbox();
|
iconP2.updateHitbox();
|
||||||
|
|
||||||
if (totalBeats % gfSpeed == 0)
|
if (curBeat % gfSpeed == 0)
|
||||||
{
|
{
|
||||||
gf.dance();
|
gf.dance();
|
||||||
}
|
}
|
||||||
|
@ -2314,7 +2313,7 @@ class PlayState extends MusicBeatState
|
||||||
boyfriend.playAnim('idle');
|
boyfriend.playAnim('idle');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalBeats % 8 == 7 && curSong == 'Bopeebo')
|
if (curBeat % 8 == 7 && curSong == 'Bopeebo')
|
||||||
{
|
{
|
||||||
boyfriend.playAnim('hey', true);
|
boyfriend.playAnim('hey', true);
|
||||||
|
|
||||||
|
@ -2346,7 +2345,7 @@ class PlayState extends MusicBeatState
|
||||||
if (!trainMoving)
|
if (!trainMoving)
|
||||||
trainCooldown += 1;
|
trainCooldown += 1;
|
||||||
|
|
||||||
if (totalBeats % 4 == 0)
|
if (curBeat % 4 == 0)
|
||||||
{
|
{
|
||||||
phillyCityLights.forEach(function(light:FlxSprite)
|
phillyCityLights.forEach(function(light:FlxSprite)
|
||||||
{
|
{
|
||||||
|
@ -2359,7 +2358,7 @@ class PlayState extends MusicBeatState
|
||||||
// phillyCityLights.members[curLight].alpha = 1;
|
// phillyCityLights.members[curLight].alpha = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalBeats % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
|
if (curBeat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
|
||||||
{
|
{
|
||||||
trainCooldown = FlxG.random.int(-4, 0);
|
trainCooldown = FlxG.random.int(-4, 0);
|
||||||
trainStart();
|
trainStart();
|
||||||
|
|
Loading…
Reference in a new issue