diff --git a/Project.xml b/Project.xml
index 186a87f3..b333df08 100644
--- a/Project.xml
+++ b/Project.xml
@@ -95,6 +95,9 @@
+
+
+
@@ -149,6 +152,7 @@
+
diff --git a/assets/data/scripts/pixel.hx b/assets/data/scripts/pixel.hx
index 3d4addf2..e829b49e 100644
--- a/assets/data/scripts/pixel.hx
+++ b/assets/data/scripts/pixel.hx
@@ -5,7 +5,7 @@ public var pixelNotesForBF = true;
public var pixelNotesForDad = true;
public var enablePixelUI = true;
public var enablePixelGameOver = true;
-public var enableCameraHacks = true;
+public var enableCameraHacks = Options.week6PixelPerfect;
public var enablePauseMenu = true;
public var isSpooky = false;
@@ -147,12 +147,6 @@ function pixelCam(cam) {
var pixellyCameras = [];
var pixellyShaders = [];
-// function stepHit() {
-// notes.forEach(function(n) {
-// if (n.isSustainNote)
-// n.offset.x -= 1;
-// });
-// }
function postUpdate(elapsed) {
for(e in pixellyCameras) {
if (Std.isOfType(e, HudCamera))
diff --git a/buildnumber.txt b/buildnumber.txt
index 54d8728c..dfac53b0 100644
--- a/buildnumber.txt
+++ b/buildnumber.txt
@@ -1 +1 @@
-1601
\ No newline at end of file
+1641
\ No newline at end of file
diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx
index cfedbfca..6c9166d0 100644
--- a/source/funkin/menus/MainMenuState.hx
+++ b/source/funkin/menus/MainMenuState.hx
@@ -118,8 +118,12 @@ class MainMenuState extends MusicBeatState
if (!selectedSomethin)
{
- if (FlxG.keys.justPressed.SEVEN)
+ if (FlxG.keys.justPressed.SEVEN) {
FlxG.switchState(new funkin.desktop.DesktopMain());
+ }
+ if (FlxG.keys.justPressed.F1) {
+ funkin.multitasking.MultiTaskingHandler.openWindow("FreeplayState", new FreeplayState());
+ }
if (controls.UP_P)
{
diff --git a/source/funkin/multitasking/MultiTaskingHandler.hx b/source/funkin/multitasking/MultiTaskingHandler.hx
new file mode 100644
index 00000000..33331ff3
--- /dev/null
+++ b/source/funkin/multitasking/MultiTaskingHandler.hx
@@ -0,0 +1,38 @@
+package funkin.multitasking;
+
+import flixel.FlxState;
+import flixel.FlxG;
+
+class MultiTaskingHandler {
+ public static var openedWindows:Array = [];
+
+ public static function init() {
+ FlxG.signals.postUpdate.add(update);
+ // FlxG.signals.preDraw.add(draw);
+ }
+
+ public static function openWindow(name:String, state:MusicBeatState) {
+ var window = new StateWindow(name, state);
+ openedWindows.push(window);
+ }
+
+ public static function update() {
+ for(window in openedWindows) {
+ window.update(FlxG.elapsed);
+ }
+ }
+
+ public static function draw() {
+ for(window in openedWindows) {
+ window.draw();
+ }
+ }
+
+ public static function closeWindow(window:StateWindow) {
+ openedWindows.remove(window);
+
+ window.window.close();
+ window.state.destroy();
+
+ }
+}
\ No newline at end of file
diff --git a/source/funkin/multitasking/StateWindow.hx b/source/funkin/multitasking/StateWindow.hx
new file mode 100644
index 00000000..3e0eb17a
--- /dev/null
+++ b/source/funkin/multitasking/StateWindow.hx
@@ -0,0 +1,137 @@
+package funkin.multitasking;
+
+import openfl.Lib;
+import openfl.display.Sprite;
+import flash.events.Event;
+import flixel.math.FlxPoint;
+import lime.ui.WindowAttributes;
+import lime.app.Application;
+import lime.ui.Window;
+import flixel.FlxState;
+import flixel.FlxCamera;
+import flixel.FlxG;
+
+class StateWindow extends Sprite {
+ public var window:Window;
+ public var state:MusicBeatState;
+ public var cameras:Array = [new FlxCamera()];
+ public var camerasDefault:Array = [];
+
+ public function new(windowName:String, state:MusicBeatState) {
+ super();
+
+ var windowAttributes:WindowAttributes = {
+ width: FlxG.width,
+ height: FlxG.height,
+ resizable: true
+ };
+ window = Application.current.createWindow(windowAttributes);
+ window.title = windowName;
+ window.stage.color = 0x000000;
+ window.stage.scaleMode = NO_SCALE;
+ window.stage.align = TOP_LEFT;
+ window.onClose.add(function() {
+ MultiTaskingHandler.closeWindow(this);
+ });
+
+ window.stage.addChild(this);
+
+ state.parentWindow = this;
+ this.state = state;
+
+ beforeStateShit();
+ state.create();
+ state.createPost();
+ afterStateShit();
+
+
+ }
+
+ var oldSize = FlxPoint.get(FlxG.width, FlxG.height);
+ var oldCamList:Array;
+ var oldCamDefaults:Array;
+ var oldCam:FlxCamera;
+ var oldState:FlxState;
+
+ public function beforeStateShit() {
+ oldSize.set(FlxG.width, FlxG.height);
+
+ @:privateAccess {
+ FlxG.width = 1280;
+ FlxG.height = 720;
+
+ oldCamDefaults = FlxG.cameras.defaults;
+ oldCamList = FlxG.cameras.list;
+ oldCam = FlxG.camera;
+
+ FlxCamera._defaultCameras = FlxG.cameras.defaults = camerasDefault;
+ FlxG.cameras.list = cameras;
+ FlxG.camera = cameras[0];
+
+ oldState = FlxG.game._state;
+ FlxG.game._state = state;
+ }
+ }
+
+ public function afterStateShit() {
+ @:privateAccess {
+ FlxG.width = Std.int(oldSize.x);
+ FlxG.height = Std.int(oldSize.y);
+
+ cameras = FlxG.cameras.list;
+ camerasDefault = FlxG.cameras.defaults;
+
+ FlxCamera._defaultCameras = FlxG.cameras.defaults = oldCamDefaults;
+ FlxG.cameras.list = oldCamList;
+ FlxG.camera = oldCam;
+
+ oldCamList = null;
+ oldCam = null;
+
+ FlxG.game._state = oldState;
+ }
+
+ }
+
+ public function update(elapsed:Float) {
+ beforeStateShit();
+ @:privateAccess
+ FlxG.cameras.update(FlxG.elapsed);
+ state.tryUpdate(elapsed);
+ afterStateShit();
+ }
+
+ public function draw() {
+ @:privateAccess {
+ beforeStateShit();
+
+ // for(c in cameras) {
+ // addChild(c.flashSprite);
+ // c.color = 0xFF0000;
+ // }
+ FlxG.cameras.lock();
+ state.draw();
+ FlxG.cameras.unlock();
+
+ afterStateShit();
+ }
+ }
+ /*
+ public override function __enterFrame(t:Float) {
+ super.__enterFrame(Std.int(t));
+ @:privateAccess {
+ beforeStateShit();
+ for(c in cameras) {
+ trace(c.x);
+ trace(c.y);
+ // c.bgColor = 0xFFFFFFFF;
+ }
+ stage.color = 0xFF0000;
+ FlxG.cameras.lock();
+ state.draw();
+ FlxG.cameras.unlock();
+ afterStateShit();
+ }
+ }
+ */
+}
\ No newline at end of file
diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx
index 393197e6..2b0089fc 100644
--- a/source/funkin/options/Options.hx
+++ b/source/funkin/options/Options.hx
@@ -22,6 +22,7 @@ class Options
public static var autoPause:Bool = true;
public static var antialiasing:Bool = true;
public static var volume:Float = 1;
+ public static var week6PixelPerfect:Bool = true;
public static var betaUpdates:Bool = false;
/**
diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx
index 8191e37c..5ff6b85d 100644
--- a/source/funkin/options/OptionsMenu.hx
+++ b/source/funkin/options/OptionsMenu.hx
@@ -28,12 +28,12 @@ class OptionsMenu extends MusicBeatState {
},
{
name: 'Gameplay',
- desc: 'Change Gameplay options such as Downscroll, Scroll Speed...',
+ desc: 'Change Gameplay options such as Downscroll, Scroll Speed, Naughtyness...',
state: GameplayOptions
},
{
name: 'Behaviour',
- desc: 'Change Behaviour options such as Naughtyness, Flashing lights...',
+ desc: 'Change Behaviour options such as Flashing menus...',
state: BehaviourOptions
},
{
diff --git a/source/funkin/options/categories/BehaviourOptions.hx b/source/funkin/options/categories/BehaviourOptions.hx
index 2a673f76..a28fa36c 100644
--- a/source/funkin/options/categories/BehaviourOptions.hx
+++ b/source/funkin/options/categories/BehaviourOptions.hx
@@ -4,17 +4,21 @@ class BehaviourOptions extends OptionsScreen {
public override function create() {
options = [
new Checkbox(
- "Naughtyness",
- "If unchecked, will censor Week 7 cutscenes",
- "naughtyness"),
+ "Antialiasing",
+ "If unchecked, will disable antialiasing on every sprite. Can boost performances at the cost of sharper, more pixely sprites",
+ "antialiasing"),
+ new Checkbox(
+ "Pixel Perfect Effect",
+ "If checked, Week 6 will have a pixel perfect effect to it enabled, aligning every pixel on the screen.",
+ "week6PixelPerfect"),
new Checkbox(
"Flashing Menu",
"If unchecked, will disable menu flashing when you select an option in the Main Menu, and other flashs will be slower",
"flashingMenu"),
new Checkbox(
- "Camera Zoom on Beat",
- "If unchecked, will disable camera zooming every 4 beats",
- "camZoomOnBeat"),
+ "Auto Pause",
+ "If checked, switching windows will pause the game",
+ "autoPause"),
];
super.create();
}
diff --git a/source/funkin/options/categories/GameplayOptions.hx b/source/funkin/options/categories/GameplayOptions.hx
index 5cd6b56f..73a060de 100644
--- a/source/funkin/options/categories/GameplayOptions.hx
+++ b/source/funkin/options/categories/GameplayOptions.hx
@@ -8,13 +8,13 @@ class GameplayOptions extends OptionsScreen {
"If checked, notes will go from up to down instead of down to up, like if they were falling",
"downscroll"),
new Checkbox(
- "Auto Pause",
- "If checked, switching windows will pause the game",
- "autoPause"),
+ "Naughtyness",
+ "If unchecked, will censor Week 7 cutscenes",
+ "naughtyness"),
new Checkbox(
- "Antialiasing",
- "If unchecked, will disable antialiasing on every sprite. Can boost performances at the cost of sharper, more pixely sprites",
- "antialiasing"),
+ "Camera Zoom on Beat",
+ "If unchecked, will disable camera zooming every 4 beats",
+ "camZoomOnBeat"),
];
super.create();
}
diff --git a/source/funkin/scripting/Script.hx b/source/funkin/scripting/Script.hx
index 2e9fef9e..78855951 100644
--- a/source/funkin/scripting/Script.hx
+++ b/source/funkin/scripting/Script.hx
@@ -69,6 +69,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
"PauseSubState" => funkin.menus.PauseSubState,
"StoryMenuState" => funkin.menus.StoryMenuState,
"TitleState" => funkin.menus.TitleState,
+ "Options" => funkin.options.Options,
"Paths" => funkin.system.Paths,
"Conductor" => funkin.system.Conductor,
"CoolUtil" => funkin.system.CoolUtil,
diff --git a/source/funkin/system/Main.hx b/source/funkin/system/Main.hx
index dbaf70f4..b0731c0f 100644
--- a/source/funkin/system/Main.hx
+++ b/source/funkin/system/Main.hx
@@ -142,7 +142,9 @@ class Main extends Sprite
#if MOD_SUPPORT
ModsFolder.switchMod("introMod");
#end
-
+ #if ALLOW_MULTITASKING
+ funkin.multitasking.MultiTaskingHandler.init();
+ #end
#if GLOBAL_SCRIPT
funkin.scripting.GlobalScript.init();
#end
diff --git a/source/funkin/system/MusicBeatState.hx b/source/funkin/system/MusicBeatState.hx
index e0bc875e..cc92a4a7 100644
--- a/source/funkin/system/MusicBeatState.hx
+++ b/source/funkin/system/MusicBeatState.hx
@@ -14,6 +14,9 @@ import funkin.options.PlayerSettings;
class MusicBeatState extends FlxUIState implements IBeatReceiver
{
+ #if ALLOW_MULTITASKING
+ public var parentWindow:funkin.multitasking.StateWindow;
+ #end
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
@@ -192,6 +195,14 @@ class MusicBeatState extends FlxUIState implements IBeatReceiver
stateScript.destroy();
}
+ public override function draw() {
+ super.draw();
+ #if ALLOW_MULTITASKING
+ if (parentWindow == null)
+ funkin.multitasking.MultiTaskingHandler.draw();
+ #end
+ }
+
public override function switchTo(nextState:FlxState) {
var e = event("onStateSwitch", new StateEvent(nextState));
if (e.cancelled)
diff --git a/source/funkin/updating/UpdateScreen.hx b/source/funkin/updating/UpdateScreen.hx
index 3fabe4b4..97355850 100644
--- a/source/funkin/updating/UpdateScreen.hx
+++ b/source/funkin/updating/UpdateScreen.hx
@@ -71,11 +71,11 @@ class UpdateScreen extends MusicBeatState {
super.update(elapsed);
elapsedTime += elapsed;
- rainbowShader.hset("elapsed", elapsedTime / 5);
+ rainbowShader.hset("elapsed", elapsedTime / 3);
if (elapsedTime >= 3)
rainbowShader.hset("strength", 1);
else
- rainbowShader.hset("strength", elapsedTime / 5);
+ rainbowShader.hset("strength", Math.sqrt(elapsedTime / 3));
progressBar.y = FlxG.height - (60 + (Math.sin(elapsedTime * Math.PI / 2) * 15));