Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Snirozu committed Apr 12, 2024
1 parent 50d4034 commit badf7c9
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 32 deletions.
4 changes: 3 additions & 1 deletion source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Main extends Sprite

public static var fpsVar:FPS;

public static final GIT_COMMIT:String = online.Macros.getGitCommitHash();

// You can pretty much ignore everything from here on - your code should go in your states.

public static function main():Void
Expand Down Expand Up @@ -235,7 +237,7 @@ class Main extends Sprite
#if (windows && cpp)
alertMsg += "\nDo you wish to report this error on GitHub?";
WinAPI.alert("Uncaught Exception!", alertMsg, () -> {
daError += '\nVersion: ${MainMenuState.psychOnlineVersion} (${online.Macros.getGitCommitHash()})';
daError += '\nVersion: ${MainMenuState.psychOnlineVersion} ($GIT_COMMIT)';
FlxG.openURL('https://github.com/Snirozu/Funkin-Psych-Online/issues/new?title=${StringTools.urlEncode('Exception: ${e.error}')}&body=${StringTools.urlEncode(daError)}');
});
#else
Expand Down
2 changes: 1 addition & 1 deletion source/backend/Song.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class Song
#end

if (rawJson == null) {
throw "Missing file: " + Paths.json(formattedFolder + '/' + formattedSong);
throw new haxe.Exception("Missing file: " + Paths.json(formattedFolder + '/' + formattedSong));
}

rawJson = rawJson.trim();
Expand Down
4 changes: 4 additions & 0 deletions source/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ class Character extends FlxSprite
AnimName = "hey";
}

if (AnimName == "hey" && curCharacter.startsWith("tankman") && animation._animations.get(AnimName) == null) {
AnimName = "singUP-alt";
}

if (animation._animations.get(AnimName) == null) {
if (AnimName == "hey") {
specialAnim = false;
Expand Down
35 changes: 27 additions & 8 deletions source/objects/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Note extends FlxSprite
public var offsetX:Float = 0;
public var offsetY:Float = 0;
public var offsetAngle:Float = 0;
public var multAlpha:Float = 1;
public var multAlpha(default, set):Float = 1;
public var multSpeed(default, set):Float = 1;

public var copyX:Bool = true;
Expand Down Expand Up @@ -427,8 +427,8 @@ class Note extends FlxSprite

if (tooLate && !inEditor)
{
if (alpha > 0.3)
alpha = 0.3;
if (noteAlpha > 0.3)
noteAlpha = 0.3;
}
}

Expand Down Expand Up @@ -457,21 +457,21 @@ class Note extends FlxSprite
angle = strumDirection - 90 + strumAngle + offsetAngle;

if(copyAlpha)
alpha = strumAlpha * multAlpha;
noteAlpha = strumAlpha * multAlpha;

if(copyX)
set_x(strumX + offsetX + Math.cos(angleDir) * distance);
followX = strumX + offsetX + Math.cos(angleDir) * distance;

if(copyY)
{
set_y(strumY + offsetY + correctionOffset + Math.sin(angleDir) * distance);
followY = strumY + offsetY + correctionOffset + Math.sin(angleDir) * distance;
if(myStrum.downScroll && isSustainNote)
{
if(PlayState.isPixelStage)
{
set_y(y - PlayState.daPixelZoom * 9.5);
followY = y - PlayState.daPixelZoom * 9.5;
}
set_y(y - (frameHeight * scale.y) - (Note.swagWidth / 2));
followY = y - (frameHeight * scale.y) - (Note.swagWidth / 2);
}
}

Expand Down Expand Up @@ -532,4 +532,23 @@ class Note extends FlxSprite
}
return super.set_y(value);
}

function set_multAlpha(value:Float):Float {
if (following != null && ClientPrefs.data.disableStrumMovement) {
return multAlpha;
}
return multAlpha = value;
}

@:unreflective public var followX(get, set):Float;
@:unreflective function get_followX():Float { return x; }
@:unreflective function set_followX(value:Float):Float { return super.set_x(value); }

@:unreflective public var followY(get, set):Float;
@:unreflective function get_followY():Float { return y; }
@:unreflective function set_followY(value:Float):Float { return super.set_y(value); }

@:unreflective public var noteAlpha(get, set):Float;
@:unreflective function get_noteAlpha():Float { return alpha; }
@:unreflective function set_noteAlpha(value:Float):Float { return super.set_alpha(value); }
}
18 changes: 14 additions & 4 deletions source/online/Downloader.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package online;

import haxe.io.Eof;
import haxe.io.Error;
import haxe.CallStack;
import haxe.io.Path;
import online.states.RequestState;
Expand Down Expand Up @@ -246,10 +248,18 @@ class Downloader {
var _bytesWritten:Int = 0;
isDownloading = true;
while (gotContent < contentLength && !cancelRequested) {
socket.waitForRead();
_bytesWritten = socket.input.readBytes(buffer, 0, buffer.length);
file.writeBytes(buffer, 0, _bytesWritten);
gotContent += _bytesWritten;
try {
socket.waitForRead();
_bytesWritten = socket.input.readBytes(buffer, 0, buffer.length);
file.writeBytes(buffer, 0, _bytesWritten);
gotContent += _bytesWritten;
}
catch (e:Dynamic) {
if (e != Eof && e != Error.Blocked) {
throw e;
}
// Eof and Blocked will be ignored
}
}
isDownloading = false;
isConnected = false;
Expand Down
1 change: 1 addition & 0 deletions source/online/GameBanana.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ typedef GBMod = {

typedef GBSub = {
var _idRow:Float;
var _sModelName:String;
var _sName:String;
var _sProfileUrl:String;
var _aPreviewMedia:GBPrevMedia;
Expand Down
21 changes: 13 additions & 8 deletions source/online/states/BananaDownload.hx
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,13 @@ class BananaDownload extends MusicBeatState {

var i:Int = 0;
for (mod in mods) {
if (mod._aGame != null && mod._aGame._idRow != 8694) {
if (mod._sModelName != "Mod" || (mod._aGame != null && mod._aGame._idRow != 8694)) {
continue;
}

var thumbnailsLength = mod._aPreviewMedia._aImages.length;
var firstThumb = mod._aPreviewMedia._aImages.shift();

var thumbnails:Array<Thumbnail> = [];

var firstThumb = mod._aPreviewMedia._aImages.shift();
for (image in mod._aPreviewMedia._aImages) {
thumbnails.push({
url: image._sBaseUrl + "/" + image._sFile,
Expand All @@ -399,6 +398,14 @@ class BananaDownload extends MusicBeatState {
});
}

if (mod._idRow == 505754) {
thumbnails.push({
url: 'https://i.pinimg.com/474x/1d/81/e0/1d81e065de302045e5d8709bef235ac4.jpg',
width: 220,
height: 125
});
}

var item = new ModItem({
url: mod._sProfileUrl,
id: mod._idRow,
Expand All @@ -411,8 +418,7 @@ class BananaDownload extends MusicBeatState {
width: firstThumb._wFile220,
height: firstThumb._hFile220
},
thumbnails: thumbnails,
thumbnailsLength: thumbnailsLength
thumbnails: thumbnails
});

item.y = Math.floor(i / 5) * 190;
Expand Down Expand Up @@ -613,7 +619,7 @@ class ModItem extends FlxSpriteGroup {
}

function loadScreenshot(index:Int) {
if (index >= mod.thumbnailsLength) {
if (index >= mod.thumbnails.length + 1 /* with first thumbnail */) {
index = 0;
}

Expand Down Expand Up @@ -702,7 +708,6 @@ typedef ModInfo = {
var categoryIconURL:String;
var thumbnail:Thumbnail;
var thumbnails:Array<Thumbnail>;
var thumbnailsLength:Float;
}

typedef Thumbnail = {
Expand Down
2 changes: 1 addition & 1 deletion source/states/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import options.OptionsState;

class MainMenuState extends MusicBeatState
{
public static var psychOnlineVersion:String = "0.6.2";
public static var psychOnlineVersion:String = "0.6.3";
public static var psychEngineVersion:String = '0.7.1h'; //This is also used for Discord RPC
public static var curSelected:Int = 0;

Expand Down
18 changes: 9 additions & 9 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1469,9 +1469,9 @@ class PlayState extends MusicBeatState
if(ClientPrefs.data.opponentStrums || isPlayerNote(note))
{
note.copyAlpha = false;
note.alpha = note.multAlpha;
note.noteAlpha = note.multAlpha;
if (ClientPrefs.data.middleScroll && !isPlayerNote(note))
note.alpha *= 0.35;
note.noteAlpha *= 0.35;
}
});

Expand Down Expand Up @@ -1827,28 +1827,28 @@ class PlayState extends MusicBeatState
oldNote.updateHitbox();
}

if (sustainNote.mustPress) sustainNote.x += FlxG.width / 2; // general offset
if (sustainNote.mustPress) sustainNote.followX += FlxG.width / 2; // general offset
else if(ClientPrefs.data.middleScroll)
{
sustainNote.x += 310;
sustainNote.followX += 310;
if(daNoteData > 1) //Up and Right
{
sustainNote.x += FlxG.width / 2 + 25;
sustainNote.followX += FlxG.width / 2 + 25;
}
}
}
}

if (swagNote.mustPress)
{
swagNote.x += FlxG.width / 2; // general offset
swagNote.followX += FlxG.width / 2; // general offset
}
else if(ClientPrefs.data.middleScroll)
{
swagNote.x += 310;
swagNote.followX += 310;
if(daNoteData > 1) //Up and Right
{
swagNote.x += FlxG.width / 2 + 25;
swagNote.followX += FlxG.width / 2 + 25;
}
}

Expand Down Expand Up @@ -2324,7 +2324,7 @@ class PlayState extends MusicBeatState
if (!playsAsBF()) {
forceShowOpStrums = true;
daNote.visible = true;
daNote.alpha = 1;
daNote.noteAlpha = 1;
}

daNote.followStrumNote(strum, fakeCrochet, songSpeed / playbackRate);
Expand Down

0 comments on commit badf7c9

Please sign in to comment.