week 6 effect can now be turned off

This commit is contained in:
Yoshman29
2022-12-21 13:19:21 +01:00
parent 76f29d797a
commit 2d1980ac84
14 changed files with 222 additions and 26 deletions
+4
View File
@@ -95,6 +95,9 @@
<!-- _________________________________ Engine Settings _______________________________ -->
<!-- Comment this out to disable multiple windows for editors !-->
<define name="ALLOW_MULTITASKING" />
<!-- Comment this out to disable updates !-->
<define name="UPDATE_CHECKING" />
@@ -149,6 +152,7 @@
<haxeflag name="--macro" value="funkin.macros.ScriptsMacro.addAdditionalClasses()" />
</section>
<haxeflag name="--macro" value="exclude('funkin.updating')" unless="UPDATE_CHECKING"/>
<haxeflag name="--macro" value="exclude('funkin.multitasking')" unless="ALLOW_MULTITASKING"/>
<!-- MACROS & DOCUMENTATION !-->
<haxeflag name="--macro" value="funkin.macros.BuildCounterMacro.getBuildNumber()" />
+1 -7
View File
@@ -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))
+1 -1
View File
@@ -1 +1 @@
1601
1641
+5 -1
View File
@@ -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)
{
@@ -0,0 +1,38 @@
package funkin.multitasking;
import flixel.FlxState;
import flixel.FlxG;
class MultiTaskingHandler {
public static var openedWindows:Array<StateWindow> = [];
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();
}
}
+137
View File
@@ -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<FlxCamera> = [new FlxCamera()];
public var camerasDefault:Array<FlxCamera> = [];
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<FlxCamera>;
var oldCamDefaults:Array<FlxCamera>;
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();
}
}
*/
}
+1
View File
@@ -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;
/**
+2 -2
View File
@@ -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
},
{
@@ -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();
}
@@ -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();
}
+1
View File
@@ -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,
+3 -1
View File
@@ -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
+11
View File
@@ -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)
+2 -2
View File
@@ -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));