Skip to content

Commit

Permalink
hot fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Snirozu committed Mar 22, 2024
1 parent c0d3911 commit f8a3700
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 37 deletions.
12 changes: 6 additions & 6 deletions source/backend/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ class Paths
return file;
}

inline static public function voices(song:String):Any
{
#if html5
return 'songs:assets/songs/${formatToSongPath(song)}/Voices.$SOUND_EXT';
#else
inline static public function voices(song:String, postfix:String = null):Any {
var songKey:String = '${formatToSongPath(song)}/Voices';
if (postfix != null)
songKey += '-' + postfix;
var voices = returnSound('songs', songKey);
@:privateAccess
if (voices.__buffer == null)
return null;
return voices;
#end
}

inline static public function inst(song:String):Any
Expand Down
4 changes: 4 additions & 0 deletions source/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef CharacterFile = {
var flip_x:Bool;
var no_antialiasing:Bool;
var healthbar_colors:Array<Int>;
@:optional var vocals_file:String;
}

typedef AnimArray = {
Expand Down Expand Up @@ -58,6 +59,7 @@ class Character extends FlxSprite
public var idleSuffix:String = '';
public var danceIdle:Bool = false; //Character use "danceLeft" and "danceRight" instead of "idle"
public var skipDance:Bool = false;
public var vocalsFile:String = '';

public var healthIcon:String = 'face';
public var animationsArray:Array<AnimArray> = [];
Expand Down Expand Up @@ -147,6 +149,8 @@ class Character extends FlxSprite
if(json.healthbar_colors != null && json.healthbar_colors.length > 2)
healthColorArray = json.healthbar_colors;

vocalsFile = json.vocals_file != null ? json.vocals_file : '';

// antialiasing
noAntialiasing = (json.no_antialiasing == true);
antialiasing = ClientPrefs.data.antialiasing ? !noAntialiasing : false;
Expand Down
14 changes: 14 additions & 0 deletions source/objects/StrumNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ class StrumNote extends FlxSprite
if(useRGBShader) rgbShader.enabled = (animation.curAnim != null && animation.curAnim.name != 'static');
}

override function set_visible(value:Bool):Bool {
if (initialized && ClientPrefs.data.disableStrumMovement) {
return visible;
}
return super.set_visible(value);
}

override function set_alpha(value:Float):Float {
if (initialized && ClientPrefs.data.disableStrumMovement) {
return super.set_alpha(FlxMath.bound(value, 0.75, 1));
}
return super.set_alpha(value);
}

override function set_x(value:Float):Float {
if (initialized && ClientPrefs.data.disableStrumMovement) {
return x;
Expand Down
29 changes: 26 additions & 3 deletions source/online/ChatBox.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ChatBox extends FlxTypedSpriteGroup<FlxSprite> {
var typeText:InputText;
var typeTextHint:FlxText; // i can call it a hint or tip whatever i want
var targetAlpha:Float;
var chatHeight:Float;
var onCommand:(String, Array<String>) -> Bool;

static var lastMessages:Array<String> = [];
Expand All @@ -45,7 +46,7 @@ class ChatBox extends FlxTypedSpriteGroup<FlxSprite> {
return;
}

instance.targetAlpha = 3;
instance.targetAlpha = 5;

var chat = new ChatMessage(instance.bg.width, message);
instance.chatGroup.insert(0, chat);
Expand Down Expand Up @@ -75,10 +76,14 @@ class ChatBox extends FlxTypedSpriteGroup<FlxSprite> {
public function new(?camera:FlxCamera, ?onCommand:(command:String, args:Array<String>) -> Bool, ?chatHeight:Int = 400) {
super();

this.chatHeight = chatHeight;

instance = this;

bg = new FlxSprite();
bg.makeGraphic(600, chatHeight, FlxColor.BLACK);
bg.makeGraphic(600, 1, FlxColor.BLACK);
bg.scale.y = chatHeight;
bg.updateHitbox();
bg.alpha = 0.6;
add(bg);

Expand Down Expand Up @@ -180,6 +185,10 @@ class ChatBox extends FlxTypedSpriteGroup<FlxSprite> {
RequestState.requestURL(msg.link);
}
}
if (!focused) {
msg.alpha = i == 0 ? 1 : 0;
}

if (msg.alpha > targetAlpha) {
msg.alpha = targetAlpha;
}
Expand All @@ -190,6 +199,21 @@ class ChatBox extends FlxTypedSpriteGroup<FlxSprite> {
newClipRect.y = bg.y - msg.y;
msg.clipRect = newClipRect;
}

if (!focused) {
bg.y = typeBg.y - bg.height;
bg.scale.y = chatGroup.members[0].height;
bg.updateHitbox();
typeBg.alpha = 0.7;
if (typeBg.alpha > targetAlpha) {
typeBg.alpha = targetAlpha;
}
}
else {
bg.y = y;
bg.scale.y = chatHeight;
bg.updateHitbox();
}
}

if (bg.alpha > 0.6)
Expand All @@ -210,7 +234,6 @@ class ChatBox extends FlxTypedSpriteGroup<FlxSprite> {

alpha = targetAlpha;

bg.visible = focused;
typeText.hasFocus = focused;
}

Expand Down
8 changes: 6 additions & 2 deletions source/online/LeavePie.hx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ class LeavePie extends FlxTypedSpriteGroup<FlxSprite> {
pieDial.amount += elapsed * 2;
pieDial.visible = true;
if (pieDial.amount >= 1.0) {
if (FlxG.state is PlayState && GameClient.hasPerms())
GameClient.send("requestEndSong");
if (FlxG.state is PlayState)
if (FlxG.keys.pressed.F1)
GameClient.leaveRoom();
else
GameClient.send("requestEndSong");
else
GameClient.leaveRoom();
pieDial.amount = 0;
}
}
else {
Expand Down
23 changes: 19 additions & 4 deletions source/online/OnlineMods.hx
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,31 @@ class OnlineMods {

if (!ignoreRest) {
var pathSplit = entry.fileName.split("/");
if (Mods.ignoreModFolders.contains(pathSplit[pathSplit.length - 2])) {

var suppModPath = pathSplit[pathSplit.length - 3] ?? "";
var suppModFolder = pathSplit[pathSplit.length - 2] ?? "";

var removeCount =
suppModFolder.length == 0 ? 0 : 1 +
entry.fileName.length == 0 ? 0 : 1
;

if (Mods.ignoreModFolders.contains(suppModFolder)) {
beginFolder =
entry.fileName // something/mod_name/characters/ or something/mod_name/assets/characters/ (because assets always go first)
.substring(0, entry.fileName.length - (
pathSplit[pathSplit.length - 3] == "assets" ?
pathSplit[pathSplit.length - 2].length + pathSplit[pathSplit.length - 3].length + 3
suppModPath == "assets" ?
suppModFolder.length + suppModPath.length + removeCount + (suppModPath.length == 0 ? 0 : 1)
:
pathSplit[pathSplit.length - 2].length + 2
suppModFolder.length + removeCount
)
)
;

if (beginFolder == "assets/" || beginFolder == "mods/") {
beginFolder = "";
}

var splat = beginFolder.split("/");
if (splat[splat.length - 1] == "bin" || splat[splat.length - 1] == "mods" || splat[splat.length - 1].trim() == "")
parentFolder += (gbMod != null ? gbMod._id : swagFileName);
Expand Down Expand Up @@ -180,6 +193,8 @@ class OnlineMods {
return;
}

//Sys.println('found data in archive: "${beginFolder}", to: "${parentFolder}"');

var modName = FileUtils.formatFile(parentFolder.substring(Paths.mods().length, parentFolder.length - 1));

if (FileSystem.exists(Paths.mods(modName))) {
Expand Down
8 changes: 4 additions & 4 deletions source/online/states/ResultsScreen.hx
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class ResultsScreen extends MusicBeatState {
p1Text.text = '${p1Name}\nAccuracy: ${p1Accuracy}% - ${getCoolRating(GameClient.room.state.player1)}\nMisses: ${GameClient.room.state.player1.misses}\nScore: ${GameClient.room.state.player1.score}';
p2Text.text = '${p2Name}\nAccuracy: ${p2Accuracy}% - ${getCoolRating(GameClient.room.state.player2)}\nMisses: ${GameClient.room.state.player2.misses}\nScore: ${GameClient.room.state.player2.score}';

p1Text.x = p1.getMidpoint().x - p1Text.width / 2;
p2Text.x = p2.getMidpoint().x - p2Text.width / 2;
p1Text.x = 176;
p2Text.x = 702;
p1Text.y = 120;
p2Text.y = 120;

Expand All @@ -180,8 +180,8 @@ class ResultsScreen extends MusicBeatState {
p1Bg.setPosition(p1Text.x - 25, p1Text.y + 15);
p2Bg.setPosition(p2Text.x - 25, p2Text.y + 15);

win.x = winnerPlayer.getMidpoint().x - win.width / 2;
lose.x = loserPlayer.getMidpoint().x - lose.width / 2;
win.x = (winner == 0 ? p1Bg : p2Bg).getMidpoint().x - win.width / 2;
lose.x = (winner == 0 ? p2Bg : p1Bg).getMidpoint().x - lose.width / 2;

for (letter in p1Text.letters) {
if (letter != null) {
Expand Down
6 changes: 5 additions & 1 deletion source/online/states/Room.hx
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ class Room extends MusicBeatState {
}
}
}
else if (FlxG.mouse.justPressedRight) {
if (curSelected == 5)
MusicBeatState.switchState(new BananaDownload());
}

if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.C) {
Clipboard.text = GameClient.getRoomSecret(true);
Expand Down Expand Up @@ -828,7 +832,7 @@ class Room extends MusicBeatState {
case 4:
itemTip.text = " - SELECT SONG - \nSelects the song.\n\n(Players with host permissions\ncan only do that)";
case 5:
itemTip.text = " - VERIFY MOD - \nDownloads the currently selected mod\nif it isn't installed.\n\nAfter you install it\npress this button again!";
itemTip.text = " - MOD - \nDownloads the currently selected mod\nif it isn't installed.\n\nAfter you install it\npress this button again!\n\nRIGHT CLICK - Open Mod Downloader";
default:
itemTip.text = " - LOBBY - \nPress UI keybinds\nor use your mouse\nto select an option!";
}
Expand Down
4 changes: 2 additions & 2 deletions source/options/GameplaySettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ class GameplaySettingsSubState extends BaseOptionsMenu
option.changeValue = 0.1;
addOption(option);

var option:Option = new Option('Disable Note Movement',
'If checked, strum notes will no longer move.',
var option:Option = new Option('Disable Note Modchart',
'If checked, strum notes will no longer move or change their opacity to invisible.',
'disableStrumMovement',
'bool');
addOption(option);
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.0";
public static var psychOnlineVersion:String = "0.6.1";
public static var psychEngineVersion:String = '0.7.1h'; //This is also used for Discord RPC
public static var curSelected:Int = 0;

Expand Down
Loading

0 comments on commit f8a3700

Please sign in to comment.