Skip to content

Commit

Permalink
Hello!
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Feb 2, 2025
1 parent 20e1aba commit 29cac8f
Show file tree
Hide file tree
Showing 29 changed files with 359 additions and 290 deletions.
3 changes: 3 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
<!-- Enables Lua Support -->
<define name="LUA_ALLOWED" if="desktop" />

<!-- Enables Threading support -->
<define name="THREADING_ALLOWED" />

<!-- Enables Hscript Iris Debug Stuff -->
<define name="IRIS_DEBUG"/>

Expand Down
File renamed without changes
File renamed without changes.
Binary file removed assets/exclude/images/cry_about_it.png
Binary file not shown.
File renamed without changes
File renamed without changes.
Binary file removed assets/exclude/images/hahadumb.png
Binary file not shown.
Binary file added assets/fonts/Minecraft.ttf
Binary file not shown.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions source/funkin/backend/Mods.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Mods
for (folder in FileSystem.readDirectory(modsFolder))
{
var path = haxe.io.Path.join([modsFolder, folder]);
if (FileSystem.isDirectory(path) && !ignoreModFolders.contains(folder.toLowerCase()) && !list.contains(folder))
if (FileUtil.isDir(path) && !ignoreModFolders.contains(folder.toLowerCase()) && !list.contains(folder))
list.push(folder);
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ class Mods
{
var dat:Array<String> = mod.split("|");
var folder:String = dat[0];
if(folder.trim().length > 0 && FileSystem.exists(Paths.mods(folder)) && FileSystem.isDirectory(Paths.mods(folder)) && !added.contains(folder))
if(folder.trim().length > 0 && FileSystem.exists(Paths.mods(folder)) && FileUtil.isDir(Paths.mods(folder)) && !added.contains(folder))
{
added.push(folder);
list.push([folder, (dat[1] == "1")]);
Expand All @@ -198,7 +198,7 @@ class Mods
// Scan for folders that aren't on modsList.txt yet
for (folder in getModDirectories())
{
if(folder.trim().length > 0 && FileSystem.exists(Paths.mods(folder)) && FileSystem.isDirectory(Paths.mods(folder)) &&
if(folder.trim().length > 0 && FileSystem.exists(Paths.mods(folder)) && FileUtil.isDir(Paths.mods(folder)) &&
!ignoreModFolders.contains(folder.toLowerCase()) && !added.contains(folder))
{
added.push(folder);
Expand Down
6 changes: 2 additions & 4 deletions source/funkin/backend/client/Discord.hx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package funkin.backend.client;

import Sys.sleep;

#if WATERMARK
import funkin.game.Init;
#end
import funkin.game.Config;

import funkin.backend.data.EngineData;
Expand Down Expand Up @@ -52,13 +52,11 @@ class DiscordClient

@:isVar
public static var clientName(default, set):String = null;

@:noCompletion private static inline function set_clientName(owo:String)
return clientName = owo;

@:isVar
public static var clientDiscrim(default, set):String = null;

@:noCompletion private static inline function set_clientDiscrim(owo:String)
return clientDiscrim = owo;

Expand Down
4 changes: 2 additions & 2 deletions source/funkin/backend/data/WeekData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class WeekData
{
var path = haxe.io.Path.join([Paths.mods(), splitName[0]]);
// trace('trying to push: ' + splitName[0]);
if (sys.FileSystem.isDirectory(path)
if (FileUtil.isDir(path)
&& !Mods.ignoreModFolders.contains(splitName[0])
&& !disabledMods.contains(splitName[0])
&& !directories.contains(path + '/'))
Expand Down Expand Up @@ -192,7 +192,7 @@ class WeekData
for (file in FileSystem.readDirectory(directory))
{
var path = haxe.io.Path.join([directory, file]);
if (!sys.FileSystem.isDirectory(path) && file.endsWith('.json'))
if (!FileUtil.isDir(path) && file.endsWith('.json'))
{
addWeek(file.substr(0, file.length - 5), path, directories[i], i, originalLength);
}
Expand Down
12 changes: 1 addition & 11 deletions source/funkin/backend/funkinLua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1490,17 +1490,8 @@ class FunkinLua
});
Lua_helper.add_callback(lua, "startDialogue", function(dialogueFile:String, music:String = null)
{
var path:String;
var songPath:String = Paths.formatToSongPath(Song.loadedSongName);
#if TRANSLATIONS_ALLOWED
path = Paths.getPath('data/$songPath/${dialogueFile}_${ClientPrefs.data.language}.json', TEXT);
#if MODS_ALLOWED
if (!FileSystem.exists(path))
#else
if (!Assets.exists(path, TEXT))
#end
#end
path = Paths.getPath('data/$songPath/$dialogueFile.json', TEXT);
var path:String = Paths.getPath('data/$songPath/$dialogueFile.json', TEXT);

luaTrace('startDialogue: Trying to load dialogue: ' + path);

Expand Down Expand Up @@ -1824,7 +1815,6 @@ class FunkinLua

#if DISCORD_ALLOWED DiscordClient.addLuaCallbacks(lua); #end
#if ACHIEVEMENTS_ALLOWED Achievements.addLuaCallbacks(lua); #end
#if TRANSLATIONS_ALLOWED Language.addLuaCallbacks(lua); #end
#if HSCRIPT_ALLOWED HScript.implement(this); #end
#if flxanimate FlxAnimateFunctions.implement(this); #end
#if SHADERS_ALLOWED ShaderFunctions.implement(this); #end
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/backend/handlers/CrashHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class CrashHandler
+ EngineData.engineData.repository
+ "\n\n---------------------------------------------------------\n> Crash Handler written by: sqirra-rng";

if (!FileSystem.exists("./crash/"))
FileSystem.createDirectory("./crash/");
if(!FileUtil.validDirectory("./crash/"))
FileUtil.createDirectory("./crash/");

File.saveContent(path, errMsg + "\n");

Expand Down
218 changes: 112 additions & 106 deletions source/funkin/backend/system/MusicBeatSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,120 +11,126 @@ import flixel.FlxSprite;
class MusicBeatSubstate extends FlxSubState
{
public function new()
{
super();
}

private var curSection:Int = 0;
private var stepsToDo:Int = 0;

private var lastBeat:Float = 0;
private var lastStep:Float = 0;

private var curStep:Int = 0;
private var curBeat:Int = 0;

private var curDecStep:Float = 0;
private var curDecBeat:Float = 0;
private var controls(get, never):Controls;

inline function get_controls():Controls
return Controls.instance;

override function update(elapsed:Float)
{
// everyStep();
if (!persistentUpdate)
MusicBeatState.timePassedOnState += elapsed;
var oldStep:Int = curStep;

updateCurStep();
updateBeat();

if (oldStep != curStep)
{
super();
}

private var curSection:Int = 0;
private var stepsToDo:Int = 0;

private var lastBeat:Float = 0;
private var lastStep:Float = 0;

private var curStep:Int = 0;
private var curBeat:Int = 0;

private var curDecStep:Float = 0;
private var curDecBeat:Float = 0;
private var controls(get, never):Controls;

inline function get_controls():Controls
return Controls.instance;

override function update(elapsed:Float)
{
//everyStep();
if(!persistentUpdate) MusicBeatState.timePassedOnState += elapsed;
var oldStep:Int = curStep;

updateCurStep();
updateBeat();

if (oldStep != curStep)
if (curStep > 0)
stepHit();

if (PlayState.SONG != null)
{
if(curStep > 0)
stepHit();

if(PlayState.SONG != null)
{
if (oldStep < curStep)
updateSection();
else
rollbackSection();
}
if (oldStep < curStep)
updateSection();
else
rollbackSection();
}

super.update(elapsed);
}

private function updateSection():Void

super.update(elapsed);
}

private function updateSection():Void
{
if (stepsToDo < 1)
stepsToDo = Math.round(getBeatsOnSection() * 4);
while (curStep >= stepsToDo)
{
if(stepsToDo < 1) stepsToDo = Math.round(getBeatsOnSection() * 4);
while(curStep >= stepsToDo)
{
curSection++;
var beats:Float = getBeatsOnSection();
stepsToDo += Math.round(beats * 4);
sectionHit();
}
curSection++;
var beats:Float = getBeatsOnSection();
stepsToDo += Math.round(beats * 4);
sectionHit();
}

private function rollbackSection():Void
}

private function rollbackSection():Void
{
if (curStep < 0)
return;

var lastSection:Int = curSection;
curSection = 0;
stepsToDo = 0;
for (i in 0...PlayState.SONG.notes.length)
{
if(curStep < 0) return;

var lastSection:Int = curSection;
curSection = 0;
stepsToDo = 0;
for (i in 0...PlayState.SONG.notes.length)
if (PlayState.SONG.notes[i] != null)
{
if (PlayState.SONG.notes[i] != null)
{
stepsToDo += Math.round(getBeatsOnSection() * 4);
if(stepsToDo > curStep) break;

curSection++;
}
stepsToDo += Math.round(getBeatsOnSection() * 4);
if (stepsToDo > curStep)
break;

curSection++;
}

if(curSection > lastSection) sectionHit();
}

private function updateBeat():Void
{
curBeat = Math.floor(curStep / 4);
curDecBeat = curDecStep/4;
}

private function updateCurStep():Void
{
var lastChange = Conductor.getBPMFromSeconds(Conductor.songPosition);

var shit = ((Conductor.songPosition - ClientPrefs.data.noteOffset) - lastChange.songTime) / lastChange.stepCrochet;
curDecStep = lastChange.stepTime + shit;
curStep = lastChange.stepTime + Math.floor(shit);
}

public function stepHit():Void
{
if (curStep % 4 == 0)
beatHit();
}

public function beatHit():Void
{
//do literally nothing dumbass
}

public function sectionHit():Void
{
//yep, you guessed it, nothing again, dumbass
}

function getBeatsOnSection()
{
var val:Null<Float> = 4;
if(PlayState.SONG != null && PlayState.SONG.notes[curSection] != null) val = PlayState.SONG.notes[curSection].sectionBeats;
return val == null ? 4 : val;
}

if (curSection > lastSection)
sectionHit();
}

private function updateBeat():Void
{
curBeat = Math.floor(curStep / 4);
curDecBeat = curDecStep / 4;
}

private function updateCurStep():Void
{
var lastChange = Conductor.getBPMFromSeconds(Conductor.songPosition);

var shit = ((Conductor.songPosition - ClientPrefs.data.noteOffset) - lastChange.songTime) / lastChange.stepCrochet;
curDecStep = lastChange.stepTime + shit;
curStep = lastChange.stepTime + Math.floor(shit);
}

public function stepHit():Void
{
if (curStep % 4 == 0)
beatHit();
}

public function beatHit():Void
{
// do literally nothing dumbass
}

public function sectionHit():Void
{
// yep, you guessed it, nothing again, dumbass
}

function getBeatsOnSection()
{
var val:Null<Float> = 4;
if (PlayState.SONG != null && PlayState.SONG.notes[curSection] != null)
val = PlayState.SONG.notes[curSection].sectionBeats;
return val == null ? 4 : val;
}
}
Loading

0 comments on commit 29cac8f

Please sign in to comment.