Skip to content

Commit

Permalink
Merge branch 'main' into mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanSantiagoYT committed Dec 24, 2024
2 parents 879600f + 1919e42 commit a27b9c3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 68 deletions.
6 changes: 3 additions & 3 deletions source/DiscordClient.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class DiscordClient

public static function initialize()
{
var discordHandlers:DiscordEventHandlers = DiscordEventHandlers.create();
final discordHandlers:DiscordEventHandlers = new DiscordEventHandlers();
discordHandlers.ready = Function.fromStaticFunction(onReady);
discordHandlers.disconnected = Function.fromStaticFunction(onDisconnected);
discordHandlers.errored = Function.fromStaticFunction(onError);
Discord.Initialize(clientID, cpp.RawPointer.addressOf(discordHandlers), 1, null);
Discord.Initialize(clientID, cpp.RawPointer.addressOf(discordHandlers), true, null);

if(!isInitialized) trace("Discord Client initialized");

Expand Down Expand Up @@ -171,7 +171,7 @@ final class DiscordPresence

function new()
{
__presence = DiscordRichPresence.create();
__presence = new DiscordRichPresence();
}

public function toString():String
Expand Down
20 changes: 12 additions & 8 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2853,9 +2853,11 @@ class PlayState extends MusicBeatState
case 0:
var boyfriendToGrab:Boyfriend = boyfriendMap.get(charChangeNames[0]);
if (boyfriendToGrab != null && boyfriendToGrab.noteskin.length > 0) bfNoteskin = boyfriendToGrab.noteskin;
else bfNoteskin = '';
case 1:
var dadToGrab:Character = dadMap.get(charChangeNames[0]);
if (dadToGrab != null && dadToGrab.noteskin.length > 0) dadNoteskin = dadToGrab.noteskin;
else dadNoteskin = '';
}
charChangeTimes.shift();
charChangeNames.shift();
Expand Down Expand Up @@ -2932,9 +2934,9 @@ class PlayState extends MusicBeatState

var ratio:Float = Conductor.bpm / currentBPMLol;

final floorSus:Int = Math.floor(swagNote.sustainLength / Conductor.stepCrochet);
if (floorSus > 0) {
for (susNote in 0...floorSus + 1) {
final roundSus:Int = Math.round(swagNote.sustainLength / Conductor.stepCrochet);
if (roundSus > 0) {
for (susNote in 0...roundSus + 1) {

final sustainNote:PreloadedChartNote = cast {
strumTime: daStrumTime + (Conductor.stepCrochet * susNote),
Expand All @@ -2947,7 +2949,7 @@ class PlayState extends MusicBeatState
gfNote: songNotes[3] == 'GF Sing' || (section.gfSection && songNotes[1] < 4),
noAnimation: songNotes[3] == 'No Animation',
isSustainNote: true,
isSustainEnd: susNote == floorSus,
isSustainEnd: susNote == roundSus,
sustainScale: 1 / ratio,
parentST: swagNote.strumTime,
parentSL: swagNote.sustainLength,
Expand Down Expand Up @@ -4471,6 +4473,7 @@ class PlayState extends MusicBeatState
if (ClientPrefs.bfIconStyle == "OS 'Engine'") iconP1.changeIcon('bfos');
}
if (boyfriend.noteskin.length > 0) bfNoteskin = boyfriend.noteskin;
else bfNoteskin = '';
}
setOnLuas('boyfriendName', boyfriend.curCharacter);

Expand Down Expand Up @@ -4499,12 +4502,13 @@ class PlayState extends MusicBeatState

if (scoreTxt != null && !ClientPrefs.hideHud) FlxTween.color(scoreTxt, 1, scoreTxt.color, FlxColor.fromRGB(dad.healthColorArray[0], dad.healthColorArray[1], dad.healthColorArray[2]));
}
if (ClientPrefs.scoreStyle == 'JS Engine' && !ClientPrefs.hideHud) {
if (ClientPrefs.scoreStyle == 'JS Engine' && !ClientPrefs.hideHud)
if (scoreTxt != null) FlxTween.color(scoreTxt, 1, scoreTxt.color, FlxColor.fromRGB(dad.healthColorArray[0], dad.healthColorArray[1], dad.healthColorArray[2]));
}

if (dadAnim != '') dad.playAnim(dadAnim, true);
}
if (dad.noteskin.length > 0) dadNoteskin = dad.noteskin;
else dadNoteskin = '';
setOnLuas('dadName', dad.curCharacter);

case 2:
Expand Down Expand Up @@ -4532,10 +4536,10 @@ class PlayState extends MusicBeatState
if (ClientPrefs.showNotes)
{
for (i in strumLineNotes.members)
if ((i.player == 0 ? dadNoteskin : bfNoteskin).length > 0)
if ((i.player == 0 ? dadNoteskin : bfNoteskin) != null)
{
i.updateNoteSkin(i.player == 0 ? dadNoteskin : bfNoteskin);
i.useRGBShader = false;
i.useRGBShader = (i.player == 0 ? dadNoteskin : bfNoteskin).length < 1;
}
}
if (ClientPrefs.noteColorStyle == 'Char-Based')
Expand Down
3 changes: 2 additions & 1 deletion source/StrumNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ class StrumNote extends FlxSprite
}
public function updateNoteSkin(noteskin:String) {
if (texture == "noteskins/" + noteskin || noteskin == ogNoteskin || texture == noteskin) return; //if the noteskin to change to is the same as before then don't update it
if (noteskin != null && noteskin != '') texture = "noteskins/" + noteskin;
if (noteskin != null && noteskin.length > 0) texture = "noteskins/" + noteskin;
else texture = "noteskins/NOTE_assets" + Note.getNoteSkinPostfix();
}
public function updateRGBColors(?r:FlxColor, ?g:FlxColor, ?b:FlxColor) {
if (rgbShader != null)
Expand Down
56 changes: 24 additions & 32 deletions source/debug/FPSCounter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,14 @@ class FPSCounter extends TextField
{
public var currentFPS(default, null):Float;

/*
inline function gay():Float
{
#if (cpp && windows)
return 0;
#elseif cpp
return cpp.vm.Gc.memInfo64(cpp.vm.Gc.MEM_INFO_USAGE);
#else
return cast(openfl.system.System.totalMemory, UInt);
#end
}
*/

/**
The current memory usage (WARNING: this is NOT your total program memory usage, rather it shows the garbage collector memory)
**/
public var memory(get, never):Float;
public var memory(get, never):Float;
inline function get_memory():Float
return Memory.gay();

var mempeak:Float = 0;
var mempeak:Float = 0;

@:noCompletion private var times:Array<Float>;

Expand All @@ -51,33 +38,34 @@ class FPSCounter extends TextField
times = [];
}

var timeColor:Float = 0.0;
var timeColor:Float = 0.0;

var fpsMultiplier:Float = 1.0;
var deltaTimeout:Float = 0.0;
var deltaTimeout:Float = 0.0;
public var timeoutDelay:Float = 50;
// Event Handlers
override function __enterFrame(deltaTime:Float):Void
{
if (deltaTimeout > 1000) {
deltaTimeout = 0.0;
return;
}

final now:Float = haxe.Timer.stamp() * 1000;
times.push(now);
while (times[0] < now - 1000 / fpsMultiplier) times.shift();
if (deltaTimeout <= timeoutDelay)
{
deltaTimeout += deltaTime;
return;
}

if (Std.isOfType(FlxG.state, PlayState) && !PlayState.instance.trollingMode) {
if (Std.isOfType(FlxG.state, PlayState) && !PlayState.instance.trollingMode)
{
try { fpsMultiplier = PlayState.instance.playbackRate; }
catch (e:Dynamic) { fpsMultiplier = 1.0; }
}
else fpsMultiplier = 1.0;

if (memory > mempeak) mempeak = memory;
if (memory > mempeak) mempeak = memory;

currentFPS = Math.min(FlxG.drawFramerate, times.length) / fpsMultiplier;
updateText();
deltaTimeout += deltaTime;
currentFPS = Math.min(FlxG.drawFramerate, times.length) / fpsMultiplier;
updateText();

if (ClientPrefs.rainbowFPS)
{
Expand All @@ -92,20 +80,24 @@ class FPSCounter extends TextField

if (currentFPS <= ClientPrefs.framerate / 3 && currentFPS >= ClientPrefs.framerate / 4)
textColor = 0xFFFF8000;

if (currentFPS <= ClientPrefs.framerate / 4)
textColor = 0xFFFF0000;
}
deltaTimeout = 0.0;
}

public dynamic function updateText():Void { // so people can override it in hscript
public dynamic function updateText():Void // so people can override it in hscript
{
text = (ClientPrefs.showFPS ? "FPS: " + (ClientPrefs.ffmpegMode ? ClientPrefs.targetFPS : Math.round(currentFPS)) : "");
if (ClientPrefs.ffmpegMode) {
if (ClientPrefs.ffmpegMode)
{
text += " (Rendering Mode)";
}

if (ClientPrefs.showRamUsage) text += "\nRAM: " + FlxStringUtil.formatBytes(memory) + (ClientPrefs.showMaxRamUsage ? " / " + FlxStringUtil.formatBytes(mempeak) : "");
if (ClientPrefs.debugInfo) {
if (ClientPrefs.debugInfo)
{
text += '\nState: ${Type.getClassName(Type.getClass(FlxG.state))}';
if (FlxG.state.subState != null)
text += '\nSubstate: ${Type.getClassName(Type.getClass(FlxG.state.subState))}';
Expand Down
36 changes: 14 additions & 22 deletions source/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2791,12 +2791,6 @@ class ChartingState extends MusicBeatState
{
changeNoteSustain(-Conductor.stepCrochet);
}
if (FlxG.keys.pressed.CONTROL && FlxG.mouse.wheel < 0) {
changeNoteSustain(Conductor.stepCrochet);
}
if (FlxG.keys.pressed.CONTROL && FlxG.mouse.wheel > 0) {
changeNoteSustain(-Conductor.stepCrochet);
}
}


Expand Down Expand Up @@ -3547,6 +3541,9 @@ class ChartingState extends MusicBeatState
if (curSelectedNote[2] != null)
{
curSelectedNote[2] += value;

//actually fixes an issue where step-long sustain lengths would round down instead of up
curSelectedNote[2] = Math.ceil(curSelectedNote[2] * 13) / 13;
curSelectedNote[2] = Math.max(curSelectedNote[2], 0);
}
}
Expand Down Expand Up @@ -4367,7 +4364,7 @@ class ChartingState extends MusicBeatState
cpp.vm.Gc.enable(true);
if (unsavedChanges) unsavedChanges = false;
if (autoSaveTimer != null)
autoSaveTimer.reset(autoSaveLength);
autoSaveTimer.reset(autoSaveLength);
}

function sortByTime(Obj1:Array<Dynamic>, Obj2:Array<Dynamic>):Int
Expand Down Expand Up @@ -4457,22 +4454,17 @@ class ChartingState extends MusicBeatState
}

override public function destroy():Void
{
Paths.noteSkinFramesMap.clear();
Paths.noteSkinAnimsMap.clear();
Paths.splashSkinFramesMap.clear();
Paths.splashSkinAnimsMap.clear();
Paths.splashConfigs.clear();
Paths.splashAnimCountMap.clear();
Note.globalRgbShaders = [];

super.destroy();
}

override function startOutro(onOutroComplete:()->Void):Void
{
Paths.noteSkinFramesMap.clear();
Paths.noteSkinAnimsMap.clear();
Paths.splashSkinFramesMap.clear();
Paths.splashSkinAnimsMap.clear();
Paths.splashConfigs.clear();
Paths.splashAnimCountMap.clear();
Note.globalRgbShaders = [];
FlxG.autoPause = ClientPrefs.autoPause;
onOutroComplete();

super.destroy();
}
}

Expand Down Expand Up @@ -4637,4 +4629,4 @@ class SelectionNote extends FlxSprite
}
}
}
}
}
4 changes: 2 additions & 2 deletions source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ class OptionsState extends MusicBeatState
selectorLeft.y = item.y;
selectorRight.x = item.x + item.width + 15;
selectorRight.y = item.y;
try { camFollow.setPosition(item.getGraphicMidpoint().x, item.getGraphicMidpoint().y - thing); }
catch(e) {camFollow.setPosition(FlxG.width / 2, FlxG.height / 2 - thing);}
}
}
camFollow.setPosition(FlxG.width / 2, 20 + (curSelected * (grpOptions.members.length * 10)));

FlxG.sound.play(Paths.sound('scrollMenu'));
}
function checkKonamiCode():Bool {
Expand Down

0 comments on commit a27b9c3

Please sign in to comment.