Skip to content

Commit

Permalink
0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Snirozu committed Dec 7, 2024
1 parent e36315e commit 005c3a2
Show file tree
Hide file tree
Showing 14 changed files with 231 additions and 73 deletions.
Binary file modified art/flashFiles/onlineDiscord.fla
Binary file not shown.
Binary file modified art/flashFiles/onlineJudges.fla
Binary file not shown.
Binary file modified assets/preload/images/onlineJudges.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 15 additions & 6 deletions assets/preload/images/onlineJudges.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@
<SubTexture name="loser0006" x="564" y="0" width="282" height="130"/>
<SubTexture name="loser0007" x="564" y="0" width="282" height="130"/>
<SubTexture name="loser0008" x="564" y="0" width="282" height="130"/>
<SubTexture name="weiner0000" x="0" y="130" width="354" height="146"/>
<SubTexture name="weiner0001" x="0" y="130" width="354" height="146"/>
<SubTexture name="weiner0002" x="0" y="130" width="354" height="146"/>
<SubTexture name="weiner0003" x="354" y="130" width="354" height="146"/>
<SubTexture name="weiner0004" x="354" y="130" width="354" height="146"/>
<SubTexture name="weiner0005" x="354" y="130" width="354" height="146"/>
<SubTexture name="tie0000" x="0" y="130" width="252" height="116"/>
<SubTexture name="tie0001" x="0" y="130" width="252" height="116"/>
<SubTexture name="tie0002" x="0" y="130" width="252" height="116"/>
<SubTexture name="tie0003" x="252" y="130" width="252" height="116"/>
<SubTexture name="tie0004" x="252" y="130" width="252" height="116"/>
<SubTexture name="tie0005" x="252" y="130" width="252" height="116"/>
<SubTexture name="tie0006" x="504" y="130" width="252" height="116"/>
<SubTexture name="tie0007" x="504" y="130" width="252" height="116"/>
<SubTexture name="tie0008" x="504" y="130" width="252" height="116"/>
<SubTexture name="weiner0000" x="0" y="246" width="354" height="146"/>
<SubTexture name="weiner0001" x="0" y="246" width="354" height="146"/>
<SubTexture name="weiner0002" x="0" y="246" width="354" height="146"/>
<SubTexture name="weiner0003" x="354" y="246" width="354" height="146"/>
<SubTexture name="weiner0004" x="354" y="246" width="354" height="146"/>
<SubTexture name="weiner0005" x="354" y="246" width="354" height="146"/>
</TextureAtlas>
Binary file added assets/preload/images/online_twitter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions assets/preload/images/online_twitter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="online_twitter.png">
<!-- Created with Adobe Animate version 23.0.2.103 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="active0000" x="0" y="0" width="96" height="82"/>
<SubTexture name="active0001" x="0" y="0" width="96" height="82"/>
<SubTexture name="active0002" x="0" y="83" width="96" height="82"/>
<SubTexture name="active0003" x="0" y="83" width="96" height="82"/>
<SubTexture name="active0004" x="0" y="166" width="96" height="82"/>
<SubTexture name="active0005" x="0" y="166" width="96" height="82"/>
<SubTexture name="idle0000" x="97" y="0" width="88" height="72"/>
<SubTexture name="idle0001" x="97" y="0" width="88" height="72"/>
<SubTexture name="idle0002" x="97" y="73" width="88" height="72"/>
<SubTexture name="idle0003" x="97" y="73" width="88" height="72"/>
<SubTexture name="idle0004" x="97" y="146" width="88" height="72"/>
<SubTexture name="idle0005" x="97" y="146" width="88" height="72"/>
</TextureAtlas>
4 changes: 2 additions & 2 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Main extends Sprite
public static var stage3D:AwayStage;
#end

public static final PSYCH_ONLINE_VERSION:String = "0.9.2";
public static final CLIENT_PROTOCOL:Float = 5;
public static final PSYCH_ONLINE_VERSION:String = "0.9.3";
public static final CLIENT_PROTOCOL:Float = 6;
public static final GIT_COMMIT:String = online.backend.Macros.getGitCommitHash();

// You can pretty much ignore everything from here on - your code should go in your states.
Expand Down
3 changes: 3 additions & 0 deletions source/online/backend/schema/Player.hx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class Player extends Schema {
@:type("number")
public var shits: Dynamic = 0;

@:type("number")
public var songPoints: Dynamic = 0;

@:type("string")
public var name: String = "";

Expand Down
3 changes: 3 additions & 0 deletions source/online/backend/schema/Room.hx
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ class Room extends Schema {

@:type("boolean")
public var hideGF:Bool = false;

@:type("number")
public var winCondition: Dynamic = 0;
}
79 changes: 59 additions & 20 deletions source/online/states/OnlineState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class OnlineState extends MusicBeatState {
var itemDesc:FlxText;
var playersOnline:FlxText;

public static var twitterIsDead:Bool = false;
static var curSelected = 0;

var inputWait = false;
Expand Down Expand Up @@ -58,6 +59,7 @@ class OnlineState extends MusicBeatState {
var discord:FlxSprite;
var github:FlxSprite;
var bsky:FlxSprite;
var twitter:FlxSprite;

function onRoomJoin(err:Dynamic) {
if (err != null) {
Expand Down Expand Up @@ -168,17 +170,33 @@ class OnlineState extends MusicBeatState {
github.alpha = 0.8;
add(github);

bsky = new FlxSprite();
bsky.antialiasing = ClientPrefs.data.antialiasing;
bsky.frames = Paths.getSparrowAtlas('online_bsky');
bsky.animation.addByPrefix('idle', "idle", 24);
bsky.animation.addByPrefix('active', "active", 24);
bsky.animation.play('idle');
bsky.updateHitbox();
bsky.x = github.x + github.width + 20;
bsky.y = FlxG.height - bsky.height - 28;
bsky.alpha = 0.8;
add(bsky);
if (twitterIsDead) {
bsky = new FlxSprite();
bsky.antialiasing = ClientPrefs.data.antialiasing;
bsky.frames = Paths.getSparrowAtlas('online_bsky');
bsky.animation.addByPrefix('idle', "idle", 24);
bsky.animation.addByPrefix('active', "active", 24);
bsky.animation.play('idle');
bsky.updateHitbox();
bsky.x = github.x + github.width + 20;
bsky.y = FlxG.height - bsky.height - 28;
bsky.alpha = 0.8;
add(bsky);
}
else {
twitter = new FlxSprite();
twitter.antialiasing = ClientPrefs.data.antialiasing;
twitter.frames = Paths.getSparrowAtlas('online_twitter');
twitter.animation.addByPrefix('idle', "idle", 24);
twitter.animation.addByPrefix('active', "active", 24);
twitter.animation.play('idle');
twitter.updateHitbox();
twitter.x = github.x + github.width + 20;
twitter.y = FlxG.height - twitter.height - 28;
twitter.alpha = 0.8;
add(twitter);
}


itemDesc = new FlxText(0, FlxG.height - 170);
itemDesc.setFormat("VCR OSD Mono", 25, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
Expand Down Expand Up @@ -377,20 +395,41 @@ class OnlineState extends MusicBeatState {
github.animation.play("idle");
}

if (FlxG.mouse.overlaps(bsky)) {
bsky.alpha = 1;
bsky.animation.play("active");
if (twitterIsDead) {
if (FlxG.mouse.overlaps(bsky)) {
bsky.alpha = 1;
bsky.animation.play("active");

itemDesc.text = "Follow the official Psych Online Bluesky account!";
itemDesc.screenCenter(X);
itemDesc.text = "Follow the official Psych Online Bluesky account!";
itemDesc.screenCenter(X);

if (FlxG.mouse.justPressed) {
RequestSubstate.requestURL("https://bsky.app/profile/funkin.sniro.boo", true);
if (FlxG.mouse.justPressed) {
RequestSubstate.requestURL("https://bsky.app/profile/funkin.sniro.boo", true);
}
}
else {
bsky.alpha = 0.8;
bsky.animation.play("idle");
}
}
else {
bsky.alpha = 0.8;
bsky.animation.play("idle");
if (FlxG.mouse.overlaps(twitter)) {
twitter.alpha = 1;
twitter.animation.play("active");
twitter.offset.set(5, 5);

itemDesc.text = "Follow the official Psych Online Twitter account!";
itemDesc.screenCenter(X);

if (FlxG.mouse.justPressed) {
RequestSubstate.requestURL("https://twitter.com/PsychOnlineFNF", true);
}
}
else {
twitter.alpha = 0.8;
twitter.animation.play("idle");
twitter.offset.set(0, 0);
}
}
}
}
Expand Down
140 changes: 100 additions & 40 deletions source/online/states/ResultsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ResultsState extends MusicBeatState {

var win:FlxSprite;
var lose:FlxSprite;
var tie:FlxSprite;
var back:FlxSprite;

var p1Text:Alphabet;
Expand Down Expand Up @@ -152,6 +153,18 @@ class ResultsState extends MusicBeatState {
lose.alpha = 0;
add(lose);

tie = new FlxSprite();
tie.antialiasing = ClientPrefs.data.antialiasing;
tie.frames = Paths.getSparrowAtlas('onlineJudges');
tie.animation.addByPrefix('idle', "tie", 24);
tie.animation.play('idle');
tie.scale.set(0.6, 0.6);
tie.updateHitbox();
tie.y = win.y + 10;
tie.alpha = 0;
tie.screenCenter(X);
add(tie);

back = new FlxSprite();
back.antialiasing = ClientPrefs.data.antialiasing;
back.frames = Paths.getSparrowAtlas('backspace');
Expand Down Expand Up @@ -184,10 +197,24 @@ class ResultsState extends MusicBeatState {
p1Accuracy = GameClient.getPlayerAccuracyPercent(getPlayer(1));
p2Accuracy = GameClient.getPlayerAccuracyPercent(getPlayer(2));

if (getPlayer(1).score >= getPlayer(2).score)
winner = 0;
else
winner = 1;
switch (GameClient.room.state.winCondition) {
case 0:
winner = (getPlayer(1).score >= getPlayer(2).score ? 0 : 1);
if (getPlayer(1).score == getPlayer(2).score)
winner = -1;
case 1:
winner = (p1Accuracy >= p2Accuracy ? 0 : 1);
if (p1Accuracy == p2Accuracy)
winner = -1;
case 2:
winner = (getPlayer(1).misses <= getPlayer(2).misses ? 0 : 1);
if (getPlayer(1).misses == getPlayer(2).misses)
winner = -1;
case 3:
winner = (getPlayer(1).songPoints >= getPlayer(2).songPoints ? 0 : 1);
if (getPlayer(1).score == getPlayer(2).score)
winner = -1;
}

var winnerPlayer = winner == 0 ? p1 : p2;
var loserPlayer = winner == 0 ? p2 : p1;
Expand All @@ -199,8 +226,8 @@ class ResultsState extends MusicBeatState {
if (p2Name.trim() == "")
p2Name = "(none)";

p1Text.text = '${p1Name}\nAccuracy: ${p1Accuracy}% - ${GameClient.getPlayerRating(getPlayer(1))}\nMisses: ${getPlayer(1).misses}\nScore: ${FlxStringUtil.formatMoney(getPlayer(1).score, false)}';
p2Text.text = '${p2Name}\nAccuracy: ${p2Accuracy}% - ${GameClient.getPlayerRating(getPlayer(2))}\nMisses: ${getPlayer(2).misses}\nScore: ${FlxStringUtil.formatMoney(getPlayer(2).score, false)}';
p1Text.text = '${p1Name}\nAccuracy: ${p1Accuracy}% - ${GameClient.getPlayerRating(getPlayer(1))}\nMisses: ${getPlayer(1).misses}\nScore: ${FlxStringUtil.formatMoney(getPlayer(1).score, false)} - ${getPlayer(1).songPoints}FP';
p2Text.text = '${p2Name}\nAccuracy: ${p2Accuracy}% - ${GameClient.getPlayerRating(getPlayer(2))}\nMisses: ${getPlayer(2).misses}\nScore: ${FlxStringUtil.formatMoney(getPlayer(2).score, false)} - ${getPlayer(2).songPoints}FP';

p1Text.x = 176;
p2Text.x = 702;
Expand Down Expand Up @@ -236,14 +263,14 @@ class ResultsState extends MusicBeatState {
dim.makeGraphic(Std.int(FlxG.width), Std.int(FlxG.height), FlxColor.BLACK);
dim.scrollFactor.set(0, 0);
dim.alpha = 1;
dim.visible = true;
dim.visible = winner > -1;
add(dim);

Paths.setCurrentLevel('week1');
spotlight = new FlxSprite(0, -250).loadGraphic(Paths.image('spotlight'));
spotlight.alpha = 0.375;
spotlight.blend = ADD;
spotlight.visible = false;
spotlight.visible = winner > -1;
spotlight.x = winner == 0 ? 70 : 630;
add(spotlight);

Expand All @@ -259,45 +286,84 @@ class ResultsState extends MusicBeatState {

new FlxTimer().start(2, (t) -> {

if (winnerPlayer.animExists('win')) {
winnerPlayer.playAnim("win");

if (winnerPlayer.animExists('winLoop')) {
winnerPlayer.animation.finishCallback = n -> {
winnerPlayer.animation.finishCallback = null;
winnerPlayer.playAnim("winLoop");
};
if (winner > -1) {
if (winnerPlayer.animExists('win')) {
winnerPlayer.playAnim("win");

if (winnerPlayer.animExists('winLoop')) {
winnerPlayer.animation.finishCallback = n -> {
winnerPlayer.animation.finishCallback = null;
winnerPlayer.playAnim("winLoop");
};
}
}
else {
winnerPlayer.playAnim("hey");
}
}
else {
winnerPlayer.playAnim("hey");
}

if (loserPlayer.animExists('lose')) {
loserPlayer.playAnim("lose");
if (loserPlayer.animExists('lose')) {
loserPlayer.playAnim("lose");

if (loserPlayer.animExists('loseLoop')) {
loserPlayer.animation.finishCallback = n -> {
loserPlayer.animation.finishCallback = null;
loserPlayer.playAnim("loseLoop");
};
if (loserPlayer.animExists('loseLoop')) {
loserPlayer.animation.finishCallback = n -> {
loserPlayer.animation.finishCallback = null;
loserPlayer.playAnim("loseLoop");
};
}
}
else {
loserPlayer.playAnim("hurt");
}
}
else {
loserPlayer.playAnim("hurt");
}
if (p1.animExists('tie')) {
p1.playAnim("tie");

if (p1.animExists('tieLoop')) {
p1.animation.finishCallback = n -> {
p1.animation.finishCallback = null;
p1.playAnim("tieLoop");
};
}
}
else {
p1.playAnim("hurt");
}

winnerPlayer.noAnimationBullshit = true;
loserPlayer.noAnimationBullshit = true;
if (p2.animExists('tie')) {
p2.playAnim("tie");

if (p2.animExists('tieLoop')) {
p2.animation.finishCallback = n -> {
p2.animation.finishCallback = null;
p2.playAnim("tieLoop");
};
}
}
else {
p2.playAnim("hurt");
}
}
p1.noAnimationBullshit = true;
p2.noAnimationBullshit = true;

FlxTween.tween(p1Text, {alpha: 1}, 1, {ease: FlxEase.quartInOut, startDelay: 1});
FlxTween.tween(p2Text, {alpha: 1}, 1, {ease: FlxEase.quartInOut, startDelay: 1});
FlxTween.tween(p1Bg, {alpha: 0.5}, 1, {ease: FlxEase.quartInOut, startDelay: 1});
FlxTween.tween(p2Bg, {alpha: 0.5}, 1, {ease: FlxEase.quartInOut, startDelay: 1});

FlxTween.tween(win, {alpha: 1}, 0.5, {ease: FlxEase.quadInOut});
FlxTween.tween(lose, {alpha: 1, angle: 3}, 0.5, {ease: FlxEase.quadInOut});
FlxTween.tween(lose, {angle: 0}, 0.2, {ease: FlxEase.quadInOut});
if (winner > 0) {
FlxTween.tween(win, {alpha: 1}, 0.5, {ease: FlxEase.quadInOut});
FlxTween.tween(lose, {alpha: 1, angle: 3}, 0.5, {ease: FlxEase.quadInOut});
FlxTween.tween(lose, {angle: 0}, 0.2, {ease: FlxEase.quadInOut});
if (ClientPrefs.data.flashing) {
flickerLoop();
}
spotlight.visible = true;
}
else {
FlxTween.tween(tie, {alpha: 1}, 0.5, {ease: FlxEase.quadInOut});
}

if (gainedPoints > 0) {
gainedText.visible = true;
Expand All @@ -313,12 +379,6 @@ class ResultsState extends MusicBeatState {

gainedPoints = 0;

if (ClientPrefs.data.flashing) {
flickerLoop();
return;
}
spotlight.visible = true;

});

registerMessages();
Expand Down
Loading

0 comments on commit 005c3a2

Please sign in to comment.