Skip to content

Commit

Permalink
0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Snirozu committed Oct 7, 2024
1 parent be417be commit df40cc0
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 40 deletions.
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 source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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
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
8 changes: 6 additions & 2 deletions source/online/DownloadAlert.hx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class DownloadAlerts extends Sprite {
alert.setStatus("Installing...");
else if (downloader.isDownloading)
alert.updateProgress(downloader.gotContent, downloader.contentLength);
else
alert.setStatus(alert.newStatus);

prevAlert = alert;
i++;
Expand All @@ -98,6 +100,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 @@ -139,7 +143,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 @@ -162,7 +166,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
3 changes: 0 additions & 3 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ class FunkinLua {

set('buildTarget', getBuildTarget());

set('os', null);
set('require', null);

for (name => func in customFunctions)
{
if(func != null)
Expand Down
6 changes: 3 additions & 3 deletions source/psychlua/HScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class HScript extends SScript
{
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(funcToRun.toLowerCase().contains(string) || funcToRun == null){
trace("blacklisted keyword detected: " + string);
FunkinLua.luaTrace("Blacklisted keyword detected in: " + funcToRun, false, false, FlxColor.RED);
return null;
}
}
Expand Down Expand Up @@ -253,7 +253,7 @@ class HScript extends SScript
#if HSCRIPT_ALLOWED
for(string in ['cpp', 'lib', 'reflect', 'cffi', 'process', 'lua', 'http']){ //Block some packages
if(funcToRun.toLowerCase().contains(string)){
trace("blacklisted keyword detected: " + string);
FunkinLua.luaTrace("Blacklisted keyword detected in: " + funcToRun, false, false, FlxColor.RED);
return null;
}
}
Expand All @@ -275,7 +275,7 @@ class HScript extends SScript
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)){
trace("blacklisted keyword detected: " + string);
FunkinLua.luaTrace("Blacklisted keyword detected in CL: " + libName + (libPackage != null ? " PKG: " + libPackage : ""), false, false, FlxColor.RED);
return;
}
}
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
15 changes: 13 additions & 2 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,14 @@ class PlayState extends MusicBeatState
public var camLoading:FlxCamera;
public var cameraSpeed:Float = 1;

public var songScore:Int = 0;
var _tempDiff:Float = 0;
public var songScore(default, set):Int = 0;
function set_songScore(v) {
_tempDiff = v - songScore;
_tempDiff *= 1 + (playbackRate - 1) * 0.1;
_tempDiff *= 1 + (songSpeed - PlayState.SONG.speed) * 0.1;
return songScore += Math.floor(_tempDiff);
}
public var songHits:Int = 0;
public var songMisses:Int = 0;
public var songSicks:Int = 0;
Expand Down Expand Up @@ -861,6 +868,7 @@ class PlayState extends MusicBeatState
SustainSplash.frameRate = Math.floor(24 / 100 * SONG.bpm);
var splash:SustainSplash = new SustainSplash();
grpHoldSplashes.add(splash);
splash.visible = true;
splash.alpha = 0.0001;

opponentStrums = new FlxTypedGroup<StrumNote>();
Expand Down Expand Up @@ -3168,7 +3176,7 @@ class PlayState extends MusicBeatState
else
{
var noMissWeek:String = WeekData.getWeekFileName() + '_nomiss';
var achieve:String = checkForAchievement([noMissWeek, 'ur_bad', 'ur_good', 'hype', 'two_keys', 'toastie', 'debugger']);
var achieve:String = checkForAchievement([noMissWeek, 'ur_bad', 'ur_good', 'hype', 'two_keys', 'toastie', 'debugger', '1000combo']);
if(achieve != null) {
startAchievement(achieve);
return false;
Expand Down Expand Up @@ -4684,6 +4692,9 @@ class PlayState extends MusicBeatState

case 'debugger':
unlock = (Paths.formatToSongPath(SONG.song) == 'test' && !usedPractice);

case '1000combo':
unlock = combo > 1000;
}
}

Expand Down

0 comments on commit df40cc0

Please sign in to comment.