Skip to content

Commit

Permalink
matching with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 committed Nov 22, 2024
1 parent 00be383 commit 37aca4c
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 1,077 deletions.
7 changes: 1 addition & 6 deletions project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<icon path="art/iconOG.png" size='512' />
<icon path="art/iconOG.png" size='768' />
<icon path="art/iconOG.png" size='1024' />
<icon path="art/iconOG.png" />
<icon path="art/iconOG.png" if="mobile" />

<!-- _________________________________ Engine Settings _______________________________ -->

Expand Down Expand Up @@ -184,8 +184,6 @@

<haxelib name="extension-androidtools" if="android" />

<haxedef name="no-deprecation-warnings"/>

<!-- _________________________________ Additional stuff _______________________________ -->

<section if="COMPILE_ALL_CLASSES">
Expand All @@ -195,9 +193,6 @@

<haxeflag name="--macro" value="funkin.backend.system.macros.Macros.initMacros()" />

<!-- Fix flash package issues -->
<haxeflag name="--macro" value="allowPackage('flash')" />

<!-- Fix compiling issues -->
<setenv name="HAXEPATH" value="./"/>

Expand Down
72 changes: 11 additions & 61 deletions source/funkin/backend/assets/AssetsLibraryList.hx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package funkin.backend.assets;

import sys.FileSystem;
import funkin.backend.assets.IModsAssetLibrary;
import lime.utils.AssetLibrary;
import lime.utils.AssetType;

using StringTools;

class AssetsLibraryList extends AssetLibrary {
public var libraries:Array<AssetLibrary> = [];
Expand Down Expand Up @@ -62,30 +58,14 @@ class AssetsLibraryList extends AssetLibrary {
l = cast(l, openfl.utils.AssetLibrary).__proxy;
}

// TODO: do base folder scanning
#if MOD_SUPPORT
if (source == MODS || source == BOTH) {
if (l is IModsAssetLibrary) {
var lib = cast(l, IModsAssetLibrary);
for (e in lib.getFiles(folder))
content.push(e);
}
}
#else
#if sys
if (source == SOURCE || source == BOTH) {
var fileStuffs = FileSystem.readDirectory(folder);
if (fileStuffs != null && fileStuffs.length > 0) {
for (e in fileStuffs) {
if (!FileSystem.isDirectory(folder + e.toString())) {
content.push(e);
}
}
} else {
Logs.trace('No files/folders found in the requested directory \'${folder}\'', WARNING, YELLOW);
}
if (l is IModsAssetLibrary) {
var lib = cast(l, IModsAssetLibrary);
for(e in lib.getFiles(folder))
content.push(e);
}
#end
#end
}
return content;
}
Expand All @@ -102,30 +82,14 @@ class AssetsLibraryList extends AssetLibrary {
l = cast(l, openfl.utils.AssetLibrary).__proxy;
}

// TODO: do base folder scanning
#if MOD_SUPPORT
if (source == MODS || source == BOTH) {
if (l is IModsAssetLibrary) {
var lib = cast(l, IModsAssetLibrary);
for (e in lib.getFolders(folder))
content.push(e);
}
}
#else
#if sys
if (source == SOURCE || source == BOTH) {
var fileStuffs = FileSystem.readDirectory(folder);
if (fileStuffs != null && fileStuffs.length > 0) {
for (e in fileStuffs) {
if (FileSystem.isDirectory(folder + e.toString())) {
content.push(e);
}
}
} else {
Logs.trace('No files/folders found in the requested directory \'${folder}\'', WARNING, YELLOW);
}
if (l is IModsAssetLibrary) {
var lib = cast(l, IModsAssetLibrary);
for(e in lib.getFolders(folder))
content.push(e);
}
#end
#end
}
return content;
}
Expand Down Expand Up @@ -198,24 +162,10 @@ class AssetsLibraryList extends AssetLibrary {
libraries.insert(0, lib);
return lib;
}

override public function list(type:String):Array<String> {
var items = [];

for(library in libraries) {
var libraryItems = library.list(type);

if (libraryItems != null) {
items = items.concat(libraryItems);
}
}

return items;
}
}

enum abstract AssetSource(Null<Bool>) from Bool from Null<Bool> to Null<Bool> {
var SOURCE = true;
var MODS = false;
var BOTH = null;
}
}
7 changes: 4 additions & 3 deletions source/funkin/backend/system/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ class Main extends Sprite

CrashHandler.init();

#if !html5 framerateSprite = new funkin.backend.system.framerate.Framerate(); #end
#if !web framerateSprite = new funkin.backend.system.framerate.Framerate(); #end

addChild(game = new FunkinGame(gameWidth, gameHeight, MainState, Options.framerate, Options.framerate, skipSplash, startFullscreen));

#if android FlxG.android.preventDefaultKeys = [BACK]; #end

#if !html5
#if !web
addChild(framerateSprite);
#if mobile
FlxG.stage.window.onResize.add((w:Int, h:Int) -> framerateSprite.setScale());
#end
SystemInfo.init();
#end
}
Expand Down Expand Up @@ -163,7 +165,6 @@ class Main extends Sprite
Conductor.init();
AudioSwitchFix.init();
EventManager.init();

FlxG.signals.preStateSwitch.add(onStateSwitch);
FlxG.signals.postStateSwitch.add(onStateSwitchPost);

Expand Down
2 changes: 2 additions & 0 deletions source/funkin/backend/system/MainState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class MainState extends FlxState {
public static var betaWarningShown:Bool = false;
public override function create() {
super.create();
#if mobile
funkin.backend.system.Main.framerateSprite.setScale();
#end
if (!initiated)
{
Main.loadGameSettings();
Expand Down
10 changes: 8 additions & 2 deletions source/funkin/backend/system/framerate/Framerate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ class Framerate extends Sprite {
#elseif ios
for(camera in FlxG.cameras.list) {
var pos = FlxG.mouse.getScreenPosition(camera);
if(pos.x >= 0 && pos.x <= 80 && pos.y >= 0 && pos.y <= 60) {
if (pos.x >= FlxG.game.x + 10 + offset.x &&
pos.x <= FlxG.game.x + offset.x + 80 &&
pos.y >= FlxG.game.y + 2 + offset.y &&
pos.y <= FlxG.game.y + 2 + offset.y + 60)
{
if(FlxG.mouse.justPressed)
sillyTimer.start(0.4, (tmr:FlxTimer) -> debugMode = (debugMode + 1) % 3);

Expand Down Expand Up @@ -163,9 +167,11 @@ class Framerate extends Sprite {
}
}

#if mobile
public inline function setScale(?scale:Float){
if(scale == null)
scale = Math.min(FlxG.stage.window.width / FlxG.width, FlxG.stage.window.height / FlxG.height);
scaleX = scaleY = #if android (scale > 1 ? scale : 1) #else (scale < 1 ? scale : 1) #end;
}
}
#end
}
15 changes: 7 additions & 8 deletions source/funkin/menus/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ class FreeplayState extends MusicBeatState
public function select() {
updateCoopModes();

if (songs[curSelected].difficulties.length <= 0)
return;
if (songs[curSelected].difficulties.length <= 0) return;

var event = event("onSelect", EventManager.get(FreeplaySongSelectEvent).recycle(songs[curSelected].name, songs[curSelected].difficulties[curDifficulty], __opponentMode, __coopMode));

Expand Down Expand Up @@ -352,12 +351,12 @@ class FreeplayState extends MusicBeatState
/**
* Array containing all labels for Co-Op / Opponent modes.
*/
public var coopLabels:Array<String> = controls.touchC ? ['[X] Solo', '[X] Opponent Mode'] :
public var coopLabels:Array<String> = controls.touchC ? ["[X] Solo", "[X] Opponent Mode"] :
[
'[TAB] Solo',
'[TAB] Opponent Mode',
'[TAB] Co-Op Mode',
'[TAB] Co-Op Mode (Switched)'
"[TAB] Solo",
"[TAB] Opponent Mode",
"[TAB] Co-Op Mode",
"[TAB] Co-Op Mode (Switched)"
];

/**
Expand Down Expand Up @@ -468,4 +467,4 @@ class FreeplaySonglist {

return songList;
}
}
}
2 changes: 1 addition & 1 deletion source/funkin/menus/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class PauseSubState extends MusicBeatSubstate
game.registerSmoothTransition();
FlxG.resetState();
case "Change Controls":
persistentUpdate = false;
persistentDraw = false;
removeVirtualPad();
openSubState(new KeybindsOptions());
case "Change Options":
Expand Down
7 changes: 3 additions & 4 deletions source/funkin/menus/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ class TitleState extends MusicBeatState
{
if (FlxG.keys.justPressed.F) FlxG.fullscreen = !FlxG.fullscreen;

var pressedEnter:Bool = controls.ACCEPT;
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;

if (controls.touchC) {
if (controls.touchC)
for (touch in FlxG.touches.list)
if (touch.justPressed)
pressedEnter = true;
}

var gamepad:FlxGamepad = FlxG.gamepads.lastActive;

Expand Down Expand Up @@ -383,4 +382,4 @@ typedef TitleStateImage = {
@:optional var scale:Null<Float>;
@:optional var flipX:Null<Bool>;
@:optional var flipY:Null<Bool>;
}
}
4 changes: 3 additions & 1 deletion source/funkin/options/Options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class Options

public static var lastLoadedMod:String = null;

// mobile options
/**
* MOBILE SETTINGS
*/
#if mobile
public static var screenTimeOut:Bool = false;
#end
Expand Down
6 changes: 3 additions & 3 deletions source/funkin/options/OptionsScreen.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class OptionsScreen extends FlxTypedSpriteGroup<OptionType> {
super.update(elapsed);

var controls = PlayerSettings.solo.controls;
var wheel = FlxG.mouse.wheel;
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - wheel);

changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel);
x = id * FlxG.width;
for(k=>option in members) {
if(option == null) continue;
Expand Down Expand Up @@ -93,4 +93,4 @@ class OptionsScreen extends FlxTypedSpriteGroup<OptionType> {
}

public dynamic function onClose(o:OptionsScreen) {}
}
}
2 changes: 0 additions & 2 deletions source/funkin/options/categories/MiscOptions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package funkin.options.categories;

class MiscOptions extends OptionsScreen {
public override function new() {
dpadMode = 'NONE';
actionMode = 'A_B';
super("Miscellaneous", "Use this menu to reset save data or engine settings.", null, #if UPDATE_CHECKING 'UP_DOWN' #else 'NONE' #end, 'A_B');
#if UPDATE_CHECKING
add(new Checkbox(
Expand Down
Loading

0 comments on commit 37aca4c

Please sign in to comment.