From 7c88032551490b79675830e0b71d054cae1afbf2 Mon Sep 17 00:00:00 2001
From: Eric Myllyoja <ericmyllyoja@gmail.com>
Date: Sat, 3 Sep 2022 22:21:54 -0400
Subject: [PATCH] More code for Blazin, additional shaders

---
 source/funkin/play/PlayState.hx       | 34 +++++++++--
 source/funkin/play/Strumline.hx       |  3 +-
 source/funkin/play/stage/Bopper.hx    | 83 +++++++++++++++++++--------
 source/funkin/play/stage/Stage.hx     | 69 +++++++++++++++++-----
 source/funkin/play/stage/StageData.hx |  1 +
 5 files changed, 144 insertions(+), 46 deletions(-)

diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx
index bb997f4b5..25569f24b 100644
--- a/source/funkin/play/PlayState.hx
+++ b/source/funkin/play/PlayState.hx
@@ -477,8 +477,11 @@ class PlayState extends MusicBeatState
 			case 'senpai' | 'roses':
 				currentStageId = 'school';
 			case "darnell" | "lit-up" | "2hot":
-				// currentStageId = 'phillyStreets';
-				currentStageId = 'pyro';
+				currentStageId = 'phillyStreets';
+			// currentStageId = 'pyro';
+			case "blazin":
+				currentStageId = 'phillyBlazin';
+			// currentStageId = 'pyro';
 			case 'pyro':
 				currentStageId = 'pyro';
 			case 'thorns':
@@ -516,6 +519,8 @@ class PlayState extends MusicBeatState
 		{
 			case 'pyro' | 'phillyStreets':
 				gfVersion = 'nene';
+			case 'blazin':
+				gfVersion = '';
 			case 'limoRide':
 				gfVersion = 'gf-car';
 			case 'mallXmas' | 'mallEvil':
@@ -524,9 +529,6 @@ class PlayState extends MusicBeatState
 				gfVersion = 'gf-pixel';
 			case 'tankmanBattlefield':
 				gfVersion = 'gf-tankmen';
-			case 'breakout':
-				// SERIOUSLY PUT THIS SHIT IN THE CHART
-				gfVersion = '';
 		}
 
 		if (currentSong.player1 == "pico")
@@ -918,7 +920,27 @@ class PlayState extends MusicBeatState
 				swagNote.mustPress = gottaHitNote;
 
 				if (swagNote.mustPress)
-					swagNote.x += FlxG.width / 2; // general offset
+				{
+					if (playerStrumline != null)
+					{
+						swagNote.x = playerStrumline.getArrow(swagNote.data.noteData).x;
+					}
+					else
+					{
+						swagNote.x += FlxG.width / 2; // general offset
+					}
+				}
+				else
+				{
+					if (enemyStrumline != null)
+					{
+						swagNote.x = enemyStrumline.getArrow(swagNote.data.noteData).x;
+					}
+					else
+					{
+						swagNote.x += FlxG.width / 2; // general offset
+					}
+				}
 			}
 		}
 
diff --git a/source/funkin/play/Strumline.hx b/source/funkin/play/Strumline.hx
index 1bdbde374..00c67b796 100644
--- a/source/funkin/play/Strumline.hx
+++ b/source/funkin/play/Strumline.hx
@@ -1,8 +1,7 @@
 package funkin.play;
 
-import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
 import flixel.FlxSprite;
-import flixel.math.FlxPoint;
+import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
 import flixel.tweens.FlxEase;
 import flixel.tweens.FlxTween;
 import funkin.Note.NoteColor;
diff --git a/source/funkin/play/stage/Bopper.hx b/source/funkin/play/stage/Bopper.hx
index 4e65525f8..2fe42bffb 100644
--- a/source/funkin/play/stage/Bopper.hx
+++ b/source/funkin/play/stage/Bopper.hx
@@ -44,8 +44,6 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
 	 */
 	public var shouldBop:Bool = true;
 
-	private var finishCallbackMap:Map<String, Void->Void> = new Map<String, Void->Void>();
-
 	function set_idleSuffix(value:String):String
 	{
 		this.idleSuffix = value;
@@ -113,8 +111,10 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
 	 * Called when an animation finishes.
 	 * @param name The name of the animation that just finished.
 	 */
-	function onAnimationFinished(name:String) {
-		if (!canPlayOtherAnims) {
+	function onAnimationFinished(name:String)
+	{
+		if (!canPlayOtherAnims)
+		{
 			canPlayOtherAnims = true;
 		}
 	}
@@ -128,7 +128,8 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
 	 * For example, if an animation was defined as having the indexes [3, 0, 1, 2],
 	 * then the first callback would have frameNumber = 0 and frameIndex = 3.
 	 */
-	function onAnimationFrame(name:String = "", frameNumber:Int = -1, frameIndex:Int = -1) {
+	function onAnimationFrame(name:String = "", frameNumber:Int = -1, frameIndex:Int = -1)
+	{
 		// Do nothing by default.
 		// This can be overridden by, for example, scripted characters.
 		// Try not to do anything expensive here, it runs many times a second.
@@ -328,39 +329,75 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
 		return this.animation.curAnim.name;
 	}
 
-	public function onScriptEvent(event:ScriptEvent) {}
+	public function onScriptEvent(event:ScriptEvent)
+	{
+	}
 
-	public function onCreate(event:ScriptEvent) {}
+	public function onCreate(event:ScriptEvent)
+	{
+	}
 
-	public function onDestroy(event:ScriptEvent) {}
+	public function onDestroy(event:ScriptEvent)
+	{
+	}
 
-	public function onUpdate(event:UpdateScriptEvent) {}
+	public function onUpdate(event:UpdateScriptEvent)
+	{
+	}
 
-	public function onPause(event:PauseScriptEvent) {}
+	public function onPause(event:PauseScriptEvent)
+	{
+	}
 
-	public function onResume(event:ScriptEvent) {}
+	public function onResume(event:ScriptEvent)
+	{
+	}
 
-	public function onSongStart(event:ScriptEvent) {}
+	public function onSongStart(event:ScriptEvent)
+	{
+	}
 
-	public function onSongEnd(event:ScriptEvent) {}
+	public function onSongEnd(event:ScriptEvent)
+	{
+	}
 
-	public function onGameOver(event:ScriptEvent) {}
+	public function onGameOver(event:ScriptEvent)
+	{
+	}
 
-	public function onNoteHit(event:NoteScriptEvent) {}
+	public function onNoteHit(event:NoteScriptEvent)
+	{
+	}
 
-	public function onNoteMiss(event:NoteScriptEvent) {}
+	public function onNoteMiss(event:NoteScriptEvent)
+	{
+	}
 
-	public function onNoteGhostMiss(event:GhostMissNoteScriptEvent) {}
+	public function onNoteGhostMiss(event:GhostMissNoteScriptEvent)
+	{
+	}
 
-	public function onStepHit(event:SongTimeScriptEvent) {}
+	public function onStepHit(event:SongTimeScriptEvent)
+	{
+	}
 
-	public function onCountdownStart(event:CountdownScriptEvent) {}
+	public function onCountdownStart(event:CountdownScriptEvent)
+	{
+	}
 
-	public function onCountdownStep(event:CountdownScriptEvent) {}
+	public function onCountdownStep(event:CountdownScriptEvent)
+	{
+	}
 
-	public function onCountdownEnd(event:CountdownScriptEvent) {}
+	public function onCountdownEnd(event:CountdownScriptEvent)
+	{
+	}
 
-	public function onSongLoaded(event:SongLoadScriptEvent) {}
+	public function onSongLoaded(event:SongLoadScriptEvent)
+	{
+	}
 
-	public function onSongRetry(event:ScriptEvent) {}
+	public function onSongRetry(event:ScriptEvent)
+	{
+	}
 }
diff --git a/source/funkin/play/stage/Stage.hx b/source/funkin/play/stage/Stage.hx
index de7b167a0..915009691 100644
--- a/source/funkin/play/stage/Stage.hx
+++ b/source/funkin/play/stage/Stage.hx
@@ -3,6 +3,7 @@ package funkin.play.stage;
 import flixel.FlxSprite;
 import flixel.group.FlxSpriteGroup;
 import flixel.math.FlxPoint;
+import flixel.system.FlxAssets.FlxShader;
 import flixel.util.FlxSort;
 import funkin.modding.IScriptedClass;
 import funkin.modding.events.ScriptEvent;
@@ -266,6 +267,14 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass
 		sort(SortUtil.byZIndex, FlxSort.ASCENDING);
 	}
 
+	public function setShader(shader:FlxShader)
+	{
+		forEachAlive(function(prop:FlxSprite)
+		{
+			prop.shader = shader;
+		});
+	}
+
 	/**
 	 * Adjusts the position and other properties of the soon-to-be child of this sprite group.
 	 * Private helper to avoid duplicate code in `add()` and `insert()`.
@@ -544,7 +553,9 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass
 	 * A function that gets called once per step in the song.
 	 * @param curStep The current step number.
 	 */
-	public function onStepHit(event:SongTimeScriptEvent):Void {}
+	public function onStepHit(event:SongTimeScriptEvent):Void
+	{
+	}
 
 	/**
 	 * A function that gets called once per beat in the song (once every four steps).
@@ -569,31 +580,59 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass
 		}
 	}
 
-	public function onScriptEvent(event:ScriptEvent) {}
+	public function onScriptEvent(event:ScriptEvent)
+	{
+	}
 
-	public function onPause(event:PauseScriptEvent) {}
+	public function onPause(event:PauseScriptEvent)
+	{
+	}
 
-	public function onResume(event:ScriptEvent) {}
+	public function onResume(event:ScriptEvent)
+	{
+	}
 
-	public function onSongStart(event:ScriptEvent) {}
+	public function onSongStart(event:ScriptEvent)
+	{
+	}
 
-	public function onSongEnd(event:ScriptEvent) {}
+	public function onSongEnd(event:ScriptEvent)
+	{
+	}
 
-	public function onGameOver(event:ScriptEvent) {}
+	public function onGameOver(event:ScriptEvent)
+	{
+	}
 
-	public function onCountdownStart(event:CountdownScriptEvent) {}
+	public function onCountdownStart(event:CountdownScriptEvent)
+	{
+	}
 
-	public function onCountdownStep(event:CountdownScriptEvent) {}
+	public function onCountdownStep(event:CountdownScriptEvent)
+	{
+	}
 
-	public function onCountdownEnd(event:CountdownScriptEvent) {}
+	public function onCountdownEnd(event:CountdownScriptEvent)
+	{
+	}
 
-	public function onNoteHit(event:NoteScriptEvent) {}
+	public function onNoteHit(event:NoteScriptEvent)
+	{
+	}
 
-	public function onNoteMiss(event:NoteScriptEvent) {}
+	public function onNoteMiss(event:NoteScriptEvent)
+	{
+	}
 
-	public function onNoteGhostMiss(event:GhostMissNoteScriptEvent) {}
+	public function onNoteGhostMiss(event:GhostMissNoteScriptEvent)
+	{
+	}
 
-	public function onSongLoaded(event:SongLoadScriptEvent) {}
+	public function onSongLoaded(event:SongLoadScriptEvent)
+	{
+	}
 
-	public function onSongRetry(event:ScriptEvent) {}
+	public function onSongRetry(event:ScriptEvent)
+	{
+	}
 }
diff --git a/source/funkin/play/stage/StageData.hx b/source/funkin/play/stage/StageData.hx
index 5694ac3a1..5af337f63 100644
--- a/source/funkin/play/stage/StageData.hx
+++ b/source/funkin/play/stage/StageData.hx
@@ -89,6 +89,7 @@ class StageDataParser
 			}
 			catch (e)
 			{
+				trace('    An error occurred while loading stage data: ${stageId}');
 				// Assume error was already logged.
 				continue;
 			}