Skip to content

Commit

Permalink
Merge branch 'develop' into chart-id-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cyn0x8 authored Feb 18, 2025
2 parents 80c5c87 + 5054c58 commit 407ae1a
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 26 deletions.
21 changes: 21 additions & 0 deletions source/funkin/Preferences.hx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,25 @@ class Preferences
return value;
}

/**
* If enabled, the game will automatically launch in fullscreen on startup.
* @default `true`
*/
public static var autoFullscreen(get, set):Bool;

static function get_autoFullscreen():Bool
{
return Save?.instance?.options?.autoFullscreen ?? true;
}

static function set_autoFullscreen(value:Bool):Bool
{
var save:Save = Save.instance;
save.options.autoFullscreen = value;
save.flush();
return value;
}

public static var unlockedFramerate(get, set):Bool;

static function get_unlockedFramerate():Bool
Expand Down Expand Up @@ -211,6 +230,8 @@ class Preferences
#if web
toggleFramerateCap(Preferences.unlockedFramerate);
#end
// Apply the autoFullscreen setting (launches the game in fullscreen automatically)
FlxG.fullscreen = Preferences.autoFullscreen;
}

static function toggleFramerateCap(unlocked:Bool):Void
Expand Down
30 changes: 29 additions & 1 deletion source/funkin/data/stage/StageData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ typedef StageDataProp =
* How much the prop scrolls relative to the camera. Used to create a parallax effect.
* Represented as an [x, y] array of two floats.
* [1, 1] means the prop moves 1:1 with the camera.
* [0.5, 0.5] means the prop half as much as the camera.
* [0.5, 0.5] means the prop moves half as much as the camera.
* [0, 0] means the prop is not moved.
* @default [0, 0]
*/
Expand Down Expand Up @@ -261,4 +261,32 @@ typedef StageDataCharacter =
*/
@:optional
var cameraOffsets:Array<Float>;

/**
* How much the character scrolls relative to the camera. Used to create a parallax effect.
* Represented as an [x, y] array of two floats.
* [1, 1] means the character moves 1:1 with the camera.
* [0.5, 0.5] means the character moves half as much as the camera.
* [0, 0] means the character is not moved.
* @default [1, 1]
*/
@:optional
@:default([1, 1])
var scroll:Array<Float>;

/**
* The alpha of the character, as a float.
* @default 1.0
*/
@:optional
@:default(1.0)
var alpha:Float;

/**
* The angle of the character, as a float.
* @default 1.0
*/
@:optional
@:default(0.0)
var angle:Float;
};
38 changes: 38 additions & 0 deletions source/funkin/input/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class Controls extends FlxActionSet
var _freeplay_left = new FunkinAction(Action.FREEPLAY_LEFT);
var _freeplay_right = new FunkinAction(Action.FREEPLAY_RIGHT);
var _freeplay_char_select = new FunkinAction(Action.FREEPLAY_CHAR_SELECT);
var _freeplay_jump_to_top = new FunkinAction(Action.FREEPLAY_JUMP_TO_TOP);
var _freeplay_jump_to_bottom = new FunkinAction(Action.FREEPLAY_JUMP_TO_BOTTOM);
var _cutscene_advance = new FunkinAction(Action.CUTSCENE_ADVANCE);
var _debug_menu = new FunkinAction(Action.DEBUG_MENU);
#if FEATURE_CHART_EDITOR
Expand Down Expand Up @@ -276,6 +278,16 @@ class Controls extends FlxActionSet
inline function get_FREEPLAY_CHAR_SELECT()
return _freeplay_char_select.check();

public var FREEPLAY_JUMP_TO_TOP(get, never):Bool;

inline function get_FREEPLAY_JUMP_TO_TOP()
return _freeplay_jump_to_top.check();

public var FREEPLAY_JUMP_TO_BOTTOM(get, never):Bool;

inline function get_FREEPLAY_JUMP_TO_BOTTOM()
return _freeplay_jump_to_bottom.check();

public var CUTSCENE_ADVANCE(get, never):Bool;

inline function get_CUTSCENE_ADVANCE()
Expand Down Expand Up @@ -337,6 +349,8 @@ class Controls extends FlxActionSet
add(_freeplay_left);
add(_freeplay_right);
add(_freeplay_char_select);
add(_freeplay_jump_to_top);
add(_freeplay_jump_to_bottom);
add(_cutscene_advance);
add(_debug_menu);
#if FEATURE_CHART_EDITOR add(_debug_chart); #end
Expand Down Expand Up @@ -462,6 +476,8 @@ class Controls extends FlxActionSet
case FREEPLAY_LEFT: _freeplay_left;
case FREEPLAY_RIGHT: _freeplay_right;
case FREEPLAY_CHAR_SELECT: _freeplay_char_select;
case FREEPLAY_JUMP_TO_TOP: _freeplay_jump_to_top;
case FREEPLAY_JUMP_TO_BOTTOM: _freeplay_jump_to_bottom;
case CUTSCENE_ADVANCE: _cutscene_advance;
case DEBUG_MENU: _debug_menu;
#if FEATURE_CHART_EDITOR case DEBUG_CHART: _debug_chart; #end
Expand Down Expand Up @@ -542,6 +558,10 @@ class Controls extends FlxActionSet
func(_freeplay_right, JUST_PRESSED);
case FREEPLAY_CHAR_SELECT:
func(_freeplay_char_select, JUST_PRESSED);
case FREEPLAY_JUMP_TO_TOP:
func(_freeplay_jump_to_top, JUST_PRESSED);
case FREEPLAY_JUMP_TO_BOTTOM:
func(_freeplay_jump_to_bottom, JUST_PRESSED);
case CUTSCENE_ADVANCE:
func(_cutscene_advance, JUST_PRESSED);
case DEBUG_MENU:
Expand Down Expand Up @@ -770,6 +790,8 @@ class Controls extends FlxActionSet
bindKeys(Control.FREEPLAY_LEFT, getDefaultKeybinds(scheme, Control.FREEPLAY_LEFT));
bindKeys(Control.FREEPLAY_RIGHT, getDefaultKeybinds(scheme, Control.FREEPLAY_RIGHT));
bindKeys(Control.FREEPLAY_CHAR_SELECT, getDefaultKeybinds(scheme, Control.FREEPLAY_CHAR_SELECT));
bindKeys(Control.FREEPLAY_JUMP_TO_TOP, getDefaultKeybinds(scheme, Control.FREEPLAY_JUMP_TO_TOP));
bindKeys(Control.FREEPLAY_JUMP_TO_BOTTOM, getDefaultKeybinds(scheme, Control.FREEPLAY_JUMP_TO_BOTTOM));
bindKeys(Control.CUTSCENE_ADVANCE, getDefaultKeybinds(scheme, Control.CUTSCENE_ADVANCE));
bindKeys(Control.DEBUG_MENU, getDefaultKeybinds(scheme, Control.DEBUG_MENU));
#if FEATURE_CHART_EDITOR
Expand Down Expand Up @@ -810,6 +832,8 @@ class Controls extends FlxActionSet
case Control.FREEPLAY_LEFT: return [Q]; // Switch tabs on the menu
case Control.FREEPLAY_RIGHT: return [E]; // Switch tabs on the menu
case Control.FREEPLAY_CHAR_SELECT: return [TAB];
case Control.FREEPLAY_JUMP_TO_TOP: return [HOME];
case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END];
case Control.CUTSCENE_ADVANCE: return [Z, ENTER];
case Control.DEBUG_MENU: return [GRAVEACCENT];
#if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end
Expand Down Expand Up @@ -839,6 +863,8 @@ class Controls extends FlxActionSet
case Control.FREEPLAY_LEFT: return [Q]; // Switch tabs on the menu
case Control.FREEPLAY_RIGHT: return [E]; // Switch tabs on the menu
case Control.FREEPLAY_CHAR_SELECT: return [TAB];
case Control.FREEPLAY_JUMP_TO_TOP: return [HOME];
case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END];
case Control.CUTSCENE_ADVANCE: return [G, Z];
case Control.DEBUG_MENU: return [GRAVEACCENT];
#if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end
Expand Down Expand Up @@ -868,6 +894,8 @@ class Controls extends FlxActionSet
case Control.FREEPLAY_LEFT: return [];
case Control.FREEPLAY_RIGHT: return [];
case Control.FREEPLAY_CHAR_SELECT: return [];
case Control.FREEPLAY_JUMP_TO_TOP: return [];
case Control.FREEPLAY_JUMP_TO_BOTTOM: return [];
case Control.CUTSCENE_ADVANCE: return [ENTER];
case Control.DEBUG_MENU: return [];
#if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end
Expand Down Expand Up @@ -984,6 +1012,8 @@ class Controls extends FlxActionSet
Control.FREEPLAY_LEFT => getDefaultGamepadBinds(Control.FREEPLAY_LEFT),
Control.FREEPLAY_RIGHT => getDefaultGamepadBinds(Control.FREEPLAY_RIGHT),
Control.FREEPLAY_CHAR_SELECT => getDefaultGamepadBinds(Control.FREEPLAY_CHAR_SELECT),
Control.FREEPLAY_JUMP_TO_TOP => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_TOP),
Control.FREEPLAY_JUMP_TO_BOTTOM => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_BOTTOM),
Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP),
Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN),
Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE),
Expand Down Expand Up @@ -1041,6 +1071,10 @@ class Controls extends FlxActionSet
return [RIGHT_SHOULDER];
case Control.FREEPLAY_CHAR_SELECT:
return [X];
case Control.FREEPLAY_JUMP_TO_TOP:
return [];
case Control.FREEPLAY_JUMP_TO_BOTTOM:
return [];
case Control.VOLUME_UP:
[];
case Control.VOLUME_DOWN:
Expand Down Expand Up @@ -1620,6 +1654,8 @@ enum Control
FREEPLAY_LEFT;
FREEPLAY_RIGHT;
FREEPLAY_CHAR_SELECT;
FREEPLAY_JUMP_TO_TOP;
FREEPLAY_JUMP_TO_BOTTOM;
// WINDOW
#if FEATURE_SCREENSHOTS WINDOW_SCREENSHOT; #end
WINDOW_FULLSCREEN;
Expand Down Expand Up @@ -1677,6 +1713,8 @@ enum abstract Action(String) to String from String
var FREEPLAY_LEFT = "freeplay_left";
var FREEPLAY_RIGHT = "freeplay_right";
var FREEPLAY_CHAR_SELECT = "freeplay_char_select";
var FREEPLAY_JUMP_TO_TOP = "freeplay_jump_to_top";
var FREEPLAY_JUMP_TO_BOTTOM = "freeplay_jump_to_bottom";
// VOLUME
var VOLUME_UP = "volume_up";
var VOLUME_DOWN = "volume_down";
Expand Down
1 change: 1 addition & 0 deletions source/funkin/modding/PolymodHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ class PolymodHandler
Polymod.blacklistImport('openfl.utils.Assets');
Polymod.blacklistImport('openfl.Lib');
Polymod.blacklistImport('openfl.system.ApplicationDomain');
Polymod.blacklistImport('openfl.net.SharedObject');

// `openfl.desktop.NativeProcess`
// Can load native processes on the host operating system.
Expand Down
3 changes: 1 addition & 2 deletions source/funkin/play/ResultState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ class ResultState extends MusicBeatSubState
songName.shader = maskShaderSongName;
difficulty.shader = maskShaderDifficulty;

// maskShaderSongName.swagMaskX = difficulty.x - 15;
maskShaderDifficulty.swagMaskX = difficulty.x - 15;
maskShaderDifficulty.swagMaskX = difficulty.x - 30;

var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
blackTopBar.y = -blackTopBar.height;
Expand Down
6 changes: 6 additions & 0 deletions source/funkin/play/stage/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
character.cameraFocusPoint.x += stageCharData.cameraOffsets[0];
character.cameraFocusPoint.y += stageCharData.cameraOffsets[1];

character.scrollFactor.x = stageCharData.scroll[0];
character.scrollFactor.y = stageCharData.scroll[1];

character.alpha = stageCharData.alpha;
character.angle = stageCharData.angle;

#if FEATURE_DEBUG_FUNCTIONS
// Draw the debug icon at the character's feet.
if (charType == BF || charType == DAD)
Expand Down
7 changes: 7 additions & 0 deletions source/funkin/save/Save.hx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Save
zoomCamera: true,
debugDisplay: false,
autoPause: true,
autoFullscreen: false,
inputOffset: 0,
audioVisualOffset: 0,
unlockedFramerate: false,
Expand Down Expand Up @@ -1339,6 +1340,12 @@ typedef SaveDataOptions =
*/
var autoPause:Bool;

/**
* If enabled, the game will automatically launch in fullscreen on startup.
* @default `true`
*/
var autoFullscreen:Bool;

/**
* Offset the user's inputs by this many ms.
* @default `0`
Expand Down
5 changes: 4 additions & 1 deletion source/funkin/ui/charSelect/CharSelectSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,10 @@ class CharSelectSubState extends MusicBeatSubState
}
else
{
if (availableChars.exists(i)) nonLocks.push(i);
var playableCharacterId:String = availableChars.get(i);
var player:Null<PlayableCharacter> = PlayerRegistry.instance.fetchEntry(playableCharacterId);
var isPlayerUnlocked:Bool = player?.isUnlocked() ?? false;
if (availableChars.exists(i) && isPlayerUnlocked) nonLocks.push(i);

var temp:Lock = new Lock(0, 0, i);
temp.ID = 1;
Expand Down
5 changes: 5 additions & 0 deletions source/funkin/ui/debug/anim/DebugBoundingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ class DebugBoundingState extends FlxState
onionSkinChar.visible = !onionSkinChar.visible;
}

if (FlxG.keys.justPressed.G)
{
swagChar.flipX = !swagChar.flipX;
}

// Plays the idle animation
if (FlxG.keys.justPressed.SPACE)
{
Expand Down
47 changes: 27 additions & 20 deletions source/funkin/ui/freeplay/CapsuleOptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class CapsuleOptionsMenu extends FlxSpriteGroup

var currentInstrumental:FlxText;

var busy:Bool = false;

public function new(parent:FreeplayState, x:Float = 0, y:Float = 0, instIds:Array<String>):Void
{
super(x, y);
Expand Down Expand Up @@ -66,36 +68,41 @@ class CapsuleOptionsMenu extends FlxSpriteGroup
destroy();
return;
}
@:privateAccess
if (parent.controls.BACK)
{
close();
return;
}

var changedInst = false;
if (parent.getControls().UI_LEFT_P)
{
currentInstrumentalIndex = (currentInstrumentalIndex + 1) % instrumentalIds.length;
changedInst = true;
}
if (parent.getControls().UI_RIGHT_P)

if (!busy)
{
currentInstrumentalIndex = (currentInstrumentalIndex - 1 + instrumentalIds.length) % instrumentalIds.length;
changedInst = true;
@:privateAccess
if (parent.controls.BACK)
{
close();
return;
}

if (parent.getControls().UI_LEFT_P)
{
currentInstrumentalIndex = (currentInstrumentalIndex + 1) % instrumentalIds.length;
changedInst = true;
}
if (parent.getControls().UI_RIGHT_P)
{
currentInstrumentalIndex = (currentInstrumentalIndex - 1 + instrumentalIds.length) % instrumentalIds.length;
changedInst = true;
}
if (parent.getControls().ACCEPT)
{
busy = true;
onConfirm(instrumentalIds[currentInstrumentalIndex] ?? '');
}
}

if (!changedInst && currentInstrumental.text == '') changedInst = true;

if (changedInst)
{
currentInstrumental.text = instrumentalIds[currentInstrumentalIndex].toTitleCase() ?? '';
if (currentInstrumental.text == '') currentInstrumental.text = 'Default';
}

if (parent.getControls().ACCEPT)
{
onConfirm(instrumentalIds[currentInstrumentalIndex] ?? '');
}
}

public function close():Void
Expand Down
10 changes: 10 additions & 0 deletions source/funkin/ui/freeplay/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,16 @@ class FreeplayState extends MusicBeatSubState
}
}

if (controls.FREEPLAY_JUMP_TO_TOP && !busy)
{
changeSelection(-curSelected);
}

if (controls.FREEPLAY_JUMP_TO_BOTTOM && !busy)
{
changeSelection(grpCapsules.countLiving() - curSelected - 1);
}

lerpScore = MathUtil.smoothLerp(lerpScore, intendedScore, elapsed, 0.5);
lerpCompletion = MathUtil.smoothLerp(lerpCompletion, intendedCompletion, elapsed, 0.5);

Expand Down
8 changes: 6 additions & 2 deletions source/funkin/ui/options/ControlsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class ControlsMenu extends funkin.ui.options.OptionsState.Page
var currentDevice:Device = Keys;
var deviceListSelected:Bool = false;

static final CONTROL_BASE_X = 50;
static final CONTROL_MARGIN_X = 700;
static final CONTROL_SPACING_X = 300;

public function new()
{
super();
Expand Down Expand Up @@ -142,10 +146,10 @@ class ControlsMenu extends funkin.ui.options.OptionsState.Page
if (currentHeader != null && name.indexOf(currentHeader) == 0) name = name.substr(currentHeader.length);

var formatName = name.replace('_', ' ');
var label = labels.add(new AtlasText(100, y, formatName, AtlasFont.BOLD));
var label = labels.add(new AtlasText(CONTROL_BASE_X, y, formatName, AtlasFont.BOLD));
label.alpha = 0.6;
for (i in 0...COLUMNS)
createItem(label.x + 550 + i * 400, y, control, i);
createItem(label.x + CONTROL_MARGIN_X + i * CONTROL_SPACING_X, y, control, i);

y += spacer;
}
Expand Down
Loading

0 comments on commit 407ae1a

Please sign in to comment.