Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 committed Oct 7, 2024
2 parents 92ae45b + ef6815f commit 3148fff
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 48 deletions.
2 changes: 0 additions & 2 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@
<haxeflag name="--macro" value="allowPackage('flash')" />
<haxeflag name="--macro" value="include('my.pack')" />

<haxeflag name="-dce no" />

<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
Expand Down
9 changes: 3 additions & 6 deletions assets/preload/data/introText.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,16 @@ penis--balls even
fnf is not for kids--go outside
little herobrine--im cumming in your mom
what you know about--rolling down in the deep
oh god i'm white--and i'm on twitter
i gotta--bucket of chicken
dream stans--literally scare me
weeg mod--check it out
what da dog--doin
go mango go--go mango go
go pico yeah yeah--*twerks cutely*
forever engine--my beloved
forever engine--well not so forever lol
wash your hands--stay safe bro
wear a mask--even if vaccinated
you dont understand--i hate society as a whole
psych engine port--fatherless behavior
i made a psych port--free clout yay
port engine psych--behavior fatherless
port psych a made i--yay clout free
wanna work on my fnf--fnf mod
gazozoz--sickest bomb recoveries
atvdriver--the rats are coming
Expand Down
Binary file added assets/preload/images/achievements/1000combo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gitVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.2
0.8.3
2 changes: 1 addition & 1 deletion source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Main extends Sprite
public static var stage3D:AwayStage;
#end

public static final PSYCH_ONLINE_VERSION:String = "0.8.2";
public static final PSYCH_ONLINE_VERSION:String = "0.8.3";
public static final CLIENT_PROTOCOL:Float = 4;
public static final GIT_COMMIT:String = online.Macros.getGitCommitHash();

Expand Down
3 changes: 2 additions & 1 deletion source/backend/Achievements.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Achievements {
["Hyperactive", "Finish a Song without going Idle.", 'hype', false],
["Just the Two of Us", "Finish a Song pressing only two keys.", 'two_keys', false],
["Toaster Gamer", "Have you tried to run the game on a toaster?", 'toastie', false],
["Debugger", "Beat the \"Test\" Stage from the Chart Editor.", 'debugger', true]
["Debugger", "Beat the \"Test\" Stage from the Chart Editor.", 'debugger', true],
["It's over 1000!", "Completed a Song with combo higher than 1000.", '1000combo', true]
];
public static var achievementsMap:Map<String, Bool> = new Map<String, Bool>();

Expand Down
1 change: 1 addition & 0 deletions source/backend/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import states.TitleState;
public var splashSkin:String = 'Psych';
public var splashAlpha:Float = 0.6;
public var holdSplashAlpha:Float = 0.6;
public var holdAlpha:Float = 0.6;
public var lowQuality:Bool = false;
public var shaders:Bool = true;
public var cacheOnGPU:Bool = #if !switch false #else true #end; //From Stilic
Expand Down
4 changes: 2 additions & 2 deletions source/objects/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ class Note extends FlxSprite

if (isSustainNote && prevNote != null)
{
alpha = 0.6;
multAlpha = 0.6;
alpha = ClientPrefs.data.holdAlpha;
multAlpha = ClientPrefs.data.holdAlpha;
hitsoundDisabled = true;
if(ClientPrefs.data.downScroll) flipY = true;

Expand Down
8 changes: 6 additions & 2 deletions source/objects/SustainSplash.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class SustainSplash extends FlxSprite {
public function new():Void {
super();

x = -50000;

var skin:String = defaultNoteHoldSplash + getSplashSkinPostfix();
frames = Paths.getSparrowAtlas(skin);
if (frames == null) {
Expand All @@ -28,9 +30,12 @@ class SustainSplash extends FlxSprite {
super.update(elapsed);

if (strumNote != null) {
setPosition(strumNote.x, strumNote.y);
visible = strumNote.visible;
alpha = ClientPrefs.data.holdSplashAlpha - (1 - strumNote.alpha);

if (animation.curAnim.name == "hold" && strumNote.animation.curAnim.name == "static") {
x = -50000;
kill();
}
}
Expand Down Expand Up @@ -60,15 +65,14 @@ class SustainSplash extends FlxSprite {

strumNote = strum;
alpha = ClientPrefs.data.holdSplashAlpha - (1 - strumNote.alpha);
setPosition(strum.x, strum.y);
offset.set(PlayState.isPixelStage ? 112.5 : 106.25, 100);

if (timer != null)
timer.cancel();

if (PlayState.isPlayerNote(tailEnd) && ClientPrefs.data.holdSplashAlpha != 0)
timer = new FlxTimer().start(timeThingy, (idk:FlxTimer) -> {
if (!(daNote.isSustainNote ? daNote.parent.noteSplashData.disabled : daNote.noteSplashData.disabled)) {
if (!(daNote.isSustainNote ? daNote.parent.noteSplashData.disabled : daNote.noteSplashData.disabled)) {
alpha = ClientPrefs.data.holdSplashAlpha - (1 - strumNote.alpha);
animation.play('end', true, false, 0);
animation.curAnim.looped = false;
Expand Down
10 changes: 7 additions & 3 deletions source/online/DownloadAlert.hx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class DownloadAlerts extends Sprite {
alert.setStatus("Installing...");
else if (downloader.isDownloading)
alert.updateProgress(downloader.gotContent, downloader.contentLength);

else
alert.setStatus(alert.newStatus);

if (Controls.instance.mobileC && alert.cancelBg.getBounds(FlxG.stage).contains(FlxG.stage.mouseX, FlxG.stage.mouseY) && FlxG.mouse.justPressed)
downloader.cancel();

Expand All @@ -101,6 +103,8 @@ class DownloadAlert extends Sprite {
public var cancelBg:Bitmap;
public var cancelText:TextField;

public var newStatus:String = 'Initializing the Download...';

public function new(id:String) {
super();

Expand Down Expand Up @@ -142,7 +146,7 @@ class DownloadAlert extends Sprite {
cancelText.defaultTextFormat = new TextFormat(Assets.getFont('assets/fonts/vcr.ttf').fontName, 13, 0xFFFFFFFF);
addChild(cancelText);

setStatus("Initializing the download...");
setStatus(newStatus);
}

public function updateProgress(loaded:Float, total:Float) {
Expand All @@ -165,7 +169,7 @@ class DownloadAlert extends Sprite {
}

public function setStatus(string:String) {
if (text == null)
if (text == null || string == text.text)
return;

bar.visible = false;
Expand Down
14 changes: 9 additions & 5 deletions source/online/Downloader.hx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class Downloader {
while (!cancelRequested) {
tries++;

alert.newStatus = "Connecting to the server..";
try {
socket.connect(new Host(urlFormat.domain), urlFormat.port);

Expand All @@ -146,9 +147,7 @@ class Downloader {
httpStatus = httpStatus.substr(httpStatus.indexOf(" ")).ltrim();

if (httpStatus == null || httpStatus.startsWith("4") || httpStatus.startsWith("5")) {
Waiter.put(() -> {
Alert.alert('Server Error - $httpStatus', 'Retrying ($tries)...');
});
alert.newStatus = 'Server Error: $httpStatus (Retry #$tries)...';
continue;
}

Expand All @@ -157,7 +156,9 @@ class Downloader {
break;
}
catch (exc) {
if (tries >= 30) {
alert.newStatus = 'Failed to connect! (Retry #${tries})\n${exc.message}';

if (tries >= 10) {
trace(id + ': ' + exc + "\n\n" + CallStack.toString(exc.stack));
Waiter.put(() -> {
Alert.alert('Couldn\'t connect to the server after multiple tries!', '${urlFormat.domain + urlFormat.path}' + ': ' + exc + "\n\n" + CallStack.toString(exc.stack));
Expand All @@ -168,7 +169,7 @@ class Downloader {

if (ClientPrefs.isDebug())
Sys.println("DHX: Retrying...");
Sys.sleep(1);
Sys.sleep(5);
}
}

Expand All @@ -177,6 +178,7 @@ class Downloader {
return;
}

alert.newStatus = "Reading server response headers...";
var gotHeaders:Map<String, String> = new Map<String, String>();
while (!cancelRequested) {
var readLine:String = socket.input.readLine();
Expand All @@ -187,6 +189,8 @@ class Downloader {
gotHeaders.set(splitHeader[0].toLowerCase(), splitHeader[1]);
}

alert.newStatus = "Parsing server response headers...";

if (ClientPrefs.isDebug())
Sys.println("DHX: Parsed response headers!");

Expand Down
11 changes: 11 additions & 0 deletions source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ class VisualsUISubState extends BaseOptionsMenu
option.decimals = 1;
addOption(option);

var option:Option = new Option('Trail Note Opacity',
'How much transparent should the Note Trail be.',
'holdAlpha',
'percent');
option.scrollSpeed = 1.3;
option.minValue = 0.5;
option.maxValue = 1;
option.changeValue = 0.1;
option.decimals = 1;
addOption(option);

var option:Option = new Option('Hide HUD',
'If checked, hides most HUD elements.',
'hideHud',
Expand Down
2 changes: 1 addition & 1 deletion source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ class FunkinLua {
return Function_Continue;
}

public function set(variable:String, data:Dynamic) {
public inline function set(variable:String, data:Dynamic) {
#if LUA_ALLOWED
if(lua == null) {
return;
Expand Down
20 changes: 19 additions & 1 deletion source/psychlua/HScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,15 @@ class HScript extends SScript
#end
}


public function executeCode(?funcToRun:String = null, ?funcArgs:Array<Dynamic> = null):TeaCall
{
if (funcToRun == null) return null;
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(funcToRun.toLowerCase().contains(string) || funcToRun == null){
FunkinLua.luaTrace("Blacklisted keyword detected in: " + funcToRun, false, false, FlxColor.RED);
return null;
}
}

if(!exists(funcToRun)) {
#if LUA_ALLOWED
Expand Down Expand Up @@ -245,6 +251,12 @@ class HScript extends SScript

funk.addLocalCallback("runHaxeFunction", function(funcToRun:String, ?funcArgs:Array<Dynamic> = null) {
#if HSCRIPT_ALLOWED
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(funcToRun.toLowerCase().contains(string)){
FunkinLua.luaTrace("Blacklisted keyword detected in: " + funcToRun, false, false, FlxColor.RED);
return null;
}
}
var callValue = funk.hscript.executeFunction(funcToRun, funcArgs);
if (!callValue.succeeded)
{
Expand All @@ -261,6 +273,12 @@ class HScript extends SScript
});
// This function is unnecessary because import already exists in SScript as a native feature
funk.addLocalCallback("addHaxeLibrary", function(libName:String, ?libPackage:String = '') {
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(libName.toLowerCase().contains(string) || libPackage.toLowerCase().contains(string)){
FunkinLua.luaTrace("Blacklisted keyword detected in CL: " + libName + (libPackage != null ? " PKG: " + libPackage : ""), false, false, FlxColor.RED);
return;
}
}
var str:String = '';
if(libPackage.length > 0)
str = libPackage + '.';
Expand Down
12 changes: 12 additions & 0 deletions source/psychlua/ReflectionFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,22 @@ class ReflectionFunctions
});

Lua_helper.add_callback(lua, "callMethod", function(funcToRun:String, ?args:Array<Dynamic> = null) {
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(funcToRun.toLowerCase().contains(string)){
trace("blacklisted keyword detected: " + string);
return null;
}
}
return callMethodFromObject(PlayState.instance, funcToRun, args);

});
Lua_helper.add_callback(lua, "callMethodFromClass", function(className:String, funcToRun:String, ?args:Array<Dynamic> = null) {
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(className.toLowerCase().contains(string) || funcToRun.toLowerCase().contains(string)){
trace("blacklisted keyword detected: " + string);
return null;
}
}
return callMethodFromObject(Deflection.resolveClass(className), funcToRun, args);
});

Expand Down
79 changes: 58 additions & 21 deletions source/states/FreeplayState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package states;

import flixel.tweens.misc.ShakeTween;
import online.replay.ReplayPlayer;
import online.replay.ReplayRecorder.ReplayData;
import json2object.JsonParser;
Expand Down Expand Up @@ -246,32 +247,68 @@ class FreeplayState extends MusicBeatState

setDiffVisibility(true);

gainedText = new FlxText(0, 0, 0, '+ ${gainedPoints}FP');
if (gainedPoints < 0) {
var aasss = '${gainedPoints}'.split('');
aasss.insert(1, ' ');
gainedText.text = aasss.join('') + "FP";
}
gainedText.setFormat(null, 40, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
gainedText.setPosition(FlxG.width - gainedText.width - 50, FlxG.height - gainedText.height - 50);
gainedText.visible = false;
gainedText.scrollFactor.set();
add(gainedText);

gainedText = new FlxText(0, 0, 0, '+ 0FP');
// dead ass forgot about abs lmao
// if (gainedPoints < 0) {
// var aasss = '${gainedPoints}'.split('');
// aasss.insert(1, ' ');
// gainedText.text = aasss.join('') + "FP";
// }
var shakeTimer:ShakeTween = null;
var swagFP = null;
var endFP = gainedPoints;
if (gainedPoints != 0) {
gainedText.visible = true;
if (gainedPoints > 0) {
FlxG.sound.play(Paths.sound('fap'));
if (ClientPrefs.data.flashing)
FlxFlicker.flicker(gainedText, 1, 0.03, true);
}
FlxG.sound.music.fadeOut(0.5, 0.2);

FlxTween.num(0, endFP, 1 + (Math.abs(endFP) * 0.02), {
onComplete: (_) -> {
if (endFP > 0) {
FlxG.sound.play(Paths.sound('fap'));

if (ClientPrefs.data.flashing)
FlxFlicker.flicker(gainedText, 1, 0.03, true);
}

if (shakeTimer != null)
shakeTimer.cancel();

new FlxTimer().start(5, (t) -> {
FlxTween.tween(gainedText, {x: gainedText.x, y: FlxG.height, alpha: 0, angle: swagFP < 0 ? 90 : 0}, 1, {ease: FlxEase.quartOut});
});

FlxG.sound.music.fadeIn(3, 0.2, 1);
},
startDelay: 1,
ease: FlxEase.quadOut
}, (v) -> {
if (swagFP == Math.floor(v))
return;

var prevGained = gainedPoints;
swagFP = Math.floor(v);

if (swagFP < 0) {
gainedText.text = '- ${Math.abs(swagFP)}FP';
var sound = FlxG.sound.play(Paths.sound('scrollMenu'), 0.2);
sound.pitch = 1 - Math.abs(swagFP) * 0.01;
}
else {
gainedText.text = '+ ${swagFP}FP';
var sound = FlxG.sound.play(Paths.sound('scrollMenu'), 0.2);
sound.pitch = 1 + Math.abs(swagFP) * 0.01;
}

new FlxTimer().start(5, (t) -> {
FlxTween.tween(gainedText, {x: gainedText.x, y: FlxG.height, alpha: 0, angle: prevGained < 0 ? 90 : 0}, 1, {ease: FlxEase.quartOut});
if (shakeTimer != null)
shakeTimer.cancel();
shakeTimer = FlxTween.shake(gainedText, FlxMath.bound(swagFP * 0.002, 0, 0.05), 1);

gainedText.setPosition(FlxG.width - gainedText.width - 50, FlxG.height - gainedText.height - 50);
});
}
gainedText.setFormat(null, 40, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
gainedText.setPosition(FlxG.width - gainedText.width - 50, FlxG.height - gainedText.height - 50);
gainedText.visible = gainedPoints != 0;
gainedText.scrollFactor.set();
add(gainedText);

gainedPoints = 0;

Expand Down
Loading

0 comments on commit 3148fff

Please sign in to comment.