Skip to content

Commit

Permalink
make camera filters not null & songPlaybackSpeed fixes
Browse files Browse the repository at this point in the history
initialize camera filters to an empty array basically anywhere you can use a script to you dont have to do a null check

fuck this stupid song playback speed why must you be so weird
  • Loading branch information
ThatRozebudDude committed Jan 30, 2025
1 parent 6433df9 commit 647121c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions source/GameOverSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GameOverSubstate extends MusicBeatSubstate

camGameOver = new FlxCamera();
camGameOver.zoom = camZoom;
camGameOver.filters = [];
FlxG.cameras.add(camGameOver, false);
cameras = [camGameOver];

Expand Down
1 change: 1 addition & 0 deletions source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class PauseSubState extends MusicBeatSubstate

camPause = new FlxCamera();
camPause.bgColor.alpha = 0;
camPause.filters = [];
FlxG.cameras.add(camPause, false);
cameras = [camPause];

Expand Down
31 changes: 16 additions & 15 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,16 @@ class PlayState extends MusicBeatState
canHit = !(Config.ghostTapType > 0);

camGame = new FlxCamera();
camGame.filters = [];

camOverlay = new FlxCamera();
camOverlay.bgColor.alpha = 0;
camOverlay.filters = [];

camHUD = new FlxCamera();
camHUD.bgColor.alpha = 0;
camHUD.filters = [new ShaderFilter(hudShader.shader)];

camOverlay = new FlxCamera();
camOverlay.bgColor.alpha = 0;

FlxG.cameras.reset(camGame);
FlxG.cameras.add(camOverlay, false);
FlxG.cameras.add(camHUD, false);
Expand Down Expand Up @@ -1488,6 +1490,8 @@ class PlayState extends MusicBeatState

if (Binds.justPressed("polymodReload") && !isStoryMode){
FlxG.sound.music.pause();
vocals.pause();
if(vocalType == splitVocalTrack){ vocalsOther.pause(); }
PolymodHandler.reload();
}

Expand Down Expand Up @@ -1553,21 +1557,19 @@ class PlayState extends MusicBeatState
vocals.pitch = songPlaybackSpeed;
if(vocalType == splitVocalTrack){ vocalsOther.pitch = songPlaybackSpeed; }

if (startingSong)
{
if (startedCountdown)
{
if (startingSong){
if (startedCountdown){
Conductor.songPosition += FlxG.elapsed * 1000;
if (Conductor.songPosition >= 0)
if (Conductor.songPosition >= 0){
startSong();
}
}
}
/*else if(inEndingCutscene){
}*/
else{
if(previousReportedSongTime != FlxG.sound.music.time){
Conductor.songPosition = FlxG.sound.music.time;
//Failsafe to make sure that the onComplete actually runs because sometimes it would just not run sometimes when I was doing stuff with the song playback speed.
if(inRange(previousReportedSongTime, FlxG.sound.music.length, 1000) && Conductor.songPosition < FlxG.sound.music.length/2 && !songEnded){ FlxG.sound.music.onComplete(); }
previousReportedSongTime = FlxG.sound.music.time;
}
else{
Expand Down Expand Up @@ -2385,15 +2387,14 @@ class PlayState extends MusicBeatState
}
}

override function stepHit()
{
override function stepHit(){

if((Math.abs(FlxG.sound.music.time - (Conductor.songPosition)) > 20 || (vocalType != noVocalTrack && Math.abs(vocals.time - (Conductor.songPosition)) > 20)) && FlxG.sound.music.playing){
if((Math.abs(FlxG.sound.music.time - (Conductor.songPosition)) > (20 * songPlaybackSpeed) || (vocalType != noVocalTrack && Math.abs(vocals.time - (Conductor.songPosition)) > (20 * songPlaybackSpeed))) && FlxG.sound.music.playing){
resyncVocals();
}

if(vocalType == splitVocalTrack){
if((Math.abs(vocalsOther.time - (Conductor.songPosition)) > 20) && FlxG.sound.music.playing){
if((Math.abs(vocalsOther.time - (Conductor.songPosition)) > (20 * songPlaybackSpeed)) && FlxG.sound.music.playing){
resyncVocals();
}
}
Expand Down
1 change: 1 addition & 0 deletions source/freeplay/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class FreeplayState extends MusicBeatState
}

camMenu = new FlxCamera();
camMenu.filters = [];

camFreeplay = new FlxCamera();
camFreeplay.bgColor.alpha = 0;
Expand Down
5 changes: 5 additions & 0 deletions source/results/ResultsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,25 @@ class ResultsState extends FlxUIStateExt
persistentUpdate = persistentDraw = true;

camBg = new FlxCamera();
camBg.filters = [];

camScroll = new FlxCamera(-50, -50, 1280 + 100, 720 + 100);
camScroll.bgColor = FlxColor.TRANSPARENT;
camScroll.angle = -3.8;
camScroll.filters = [];

camCharacter = new FlxCamera();
camCharacter.bgColor = FlxColor.TRANSPARENT;
camCharacter.filters = [];

camTitle = new FlxCamera(-50, -50, 1280 + 100, 720 + 100);
camTitle.bgColor = FlxColor.TRANSPARENT;
camTitle.angle = -3.8;
camTitle.filters = [];

camUi = new FlxCamera();
camUi.bgColor = FlxColor.TRANSPARENT;
camUi.filters = [];

FlxG.cameras.add(camBg, false);
FlxG.cameras.add(camScroll, false);
Expand Down

0 comments on commit 647121c

Please sign in to comment.