From 8bf331ae68eeacacb101a469f76e004fdfa505a2 Mon Sep 17 00:00:00 2001
From: "Miss Circle (Moxie)" <124418090+moxie-coder@users.noreply.github.com>
Date: Fri, 8 Nov 2024 07:03:24 -0500
Subject: [PATCH] somehow this got broken, plus other crap
closes #724 and #728
I didn't test the autosave shit btw, I don't have time rn
---
Project.xml | 20 +++---
source/PlayState.hx | 100 +++++++++++++++-------------
source/Section.hx | 5 --
source/editors/ChartingState.hx | 28 +++++++-
source/options/VisualsUISubState.hx | 2 +-
5 files changed, 89 insertions(+), 66 deletions(-)
diff --git a/Project.xml b/Project.xml
index 823e03808a0..52ecda4f820 100644
--- a/Project.xml
+++ b/Project.xml
@@ -19,9 +19,6 @@
-
-
-
@@ -31,20 +28,19 @@
-
-
+
+
-
+
-
+
-
+
-
@@ -59,7 +55,7 @@
-
+
@@ -93,7 +89,7 @@
-
+
diff --git a/source/PlayState.hx b/source/PlayState.hx
index 95c34a394a9..8a9b2e3c938 100644
--- a/source/PlayState.hx
+++ b/source/PlayState.hx
@@ -1382,6 +1382,7 @@ class PlayState extends MusicBeatState
add(chromaScreen);
}
+ // TODO: cleanup playstate, by moving most of this and other duplicate functions like healthbop, etc
if (ClientPrefs.scoreStyle == 'Kade Engine')
{
scoreTxt = new FlxText(0, healthBarBG.y + 50, FlxG.width, "", 20);
@@ -1464,6 +1465,15 @@ class PlayState extends MusicBeatState
scoreTxt.scrollFactor.set();
add(scoreTxt);
}
+ if (ClientPrefs.scoreStyle == 'Vanilla')
+ {
+ scoreTxt = new FlxText(300, healthBarBG.y + 50, FlxG.width, "", 18);
+ scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, OUTLINE, FlxColor.BLACK);
+ scoreTxt.borderSize = 1.25;
+ updateScore();
+ scoreTxt.scrollFactor.set();
+ add(scoreTxt);
+ }
if (ClientPrefs.showcaseMode) {
scoreTxt.visible = false;
healthBarBG.visible = false;
@@ -1473,7 +1483,7 @@ class PlayState extends MusicBeatState
if (ClientPrefs.hideHud) {
scoreTxt.visible = false;
final daArray:Array = [botplayTxt, healthBarBG, healthBar, iconP2, iconP1, timeBarBG, timeBar, timeTxt];
- for (i in daArray){
+ for (i in daArray){
if (i != null)
i.visible = false;
}
@@ -2178,6 +2188,11 @@ class PlayState extends MusicBeatState
function schoolIntro(?dialogueBox:DialogueBox):Void
{
+ if (dialogueBox == null){
+ startCountdown();
+ return;
+ } // don't load any of this, since there's not even any dialog
+
inCutscene = true;
var black:FlxSprite = new FlxSprite(-100, -100).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK);
black.scrollFactor.set();
@@ -2217,47 +2232,41 @@ class PlayState extends MusicBeatState
}
else
{
- if (dialogueBox != null)
+ if (Paths.formatToSongPath(SONG.song) == 'thorns')
{
- if (Paths.formatToSongPath(SONG.song) == 'thorns')
+ add(senpaiEvil);
+ senpaiEvil.alpha = 0;
+ new FlxTimer().start(0.3, function(swagTimer:FlxTimer)
{
- add(senpaiEvil);
- senpaiEvil.alpha = 0;
- new FlxTimer().start(0.3, function(swagTimer:FlxTimer)
+ senpaiEvil.alpha += 0.15;
+ if (senpaiEvil.alpha < 1)
{
- senpaiEvil.alpha += 0.15;
- if (senpaiEvil.alpha < 1)
- {
- swagTimer.reset();
- }
- else
+ swagTimer.reset();
+ }
+ else
+ {
+ senpaiEvil.animation.play('idle');
+ FlxG.sound.play(Paths.sound('Senpai_Dies'), 1, false, null, true, function()
{
- senpaiEvil.animation.play('idle');
- FlxG.sound.play(Paths.sound('Senpai_Dies'), 1, false, null, true, function()
+ remove(senpaiEvil);
+ remove(red);
+ FlxG.camera.fade(FlxColor.WHITE, 0.01, true, function()
{
- remove(senpaiEvil);
- remove(red);
- FlxG.camera.fade(FlxColor.WHITE, 0.01, true, function()
- {
- add(dialogueBox);
- camHUD.visible = true;
- }, true);
- });
- new FlxTimer().start(3.2, function(deadTime:FlxTimer)
- {
- FlxG.camera.fade(FlxColor.WHITE, 1.6, false);
- });
- }
- });
- }
- else
- {
- add(dialogueBox);
- }
+ add(dialogueBox);
+ camHUD.visible = true;
+ }, true);
+ });
+ new FlxTimer().start(3.2, function(deadTime:FlxTimer)
+ {
+ FlxG.camera.fade(FlxColor.WHITE, 1.6, false);
+ });
+ }
+ });
}
else
- startCountdown();
-
+ {
+ add(dialogueBox);
+ }
remove(black);
}
});
@@ -2642,6 +2651,9 @@ class PlayState extends MusicBeatState
case 'VS Impostor':
tempScore = 'Score: ' + formattedScore + ' $divider Combo Breaks: ' + formattedSongMisses + (ClientPrefs.showComboInfo ? ' $divider Combo: ' + formattedCombo : '') + npsString + ' $divider Accuracy: ' + Highscore.floorDecimal(ratingPercent * 100, 2) + '% [' + fcString + ']';
+
+ case 'Vanilla':
+ tempScore = 'Score: ' + formattedScore;
}
scoreTxt.text = '${tempScore}\n';
@@ -2689,16 +2701,12 @@ class PlayState extends MusicBeatState
callOnLuas('onSkipDialogue', [dialogueCount]);
}
- var previousFrameTime:Int = 0;
- var lastReportedPlayheadPosition:Int = 0;
var songTime:Float = 0;
function startSong():Void
{
startingSong = false;
- previousFrameTime = FlxG.game.ticks;
- lastReportedPlayheadPosition = 0;
if (ClientPrefs.songLoading)
{
var diff:String = (SONG.specialAudioName.length > 1 ? SONG.specialAudioName : CoolUtil.difficultyString()).toLowerCase();
@@ -3208,7 +3216,7 @@ class PlayState extends MusicBeatState
public var skipArrowStartTween:Bool = false; //for lua
private function generateStaticArrows(player:Int):Void
{
- var strumLine:FlxPoint = FlxPoint.get(middleScroll ? STRUM_X_MIDDLESCROLL : STRUM_X, (ClientPrefs.downScroll) ? FlxG.height - 150 : 50);
+ final strumLine:FlxPoint = FlxPoint.get(middleScroll ? STRUM_X_MIDDLESCROLL : STRUM_X, (ClientPrefs.downScroll) ? FlxG.height - 150 : 50);
for (i in 0...4)
{
var targetAlpha:Float = 1;
@@ -3218,7 +3226,7 @@ class PlayState extends MusicBeatState
else if(middleScroll) targetAlpha = ClientPrefs.oppNoteAlpha;
}
- var noteSkinExists:Bool = FileSystem.exists("assets/shared/images/noteskins/" + (player == 0 ? dadNoteskin : bfNoteskin)) || FileSystem.exists(Paths.modsImages("noteskins/" + (player == 0 ? dadNoteskin : bfNoteskin)));
+ final noteSkinExists:Bool = FileSystem.exists("assets/shared/images/noteskins/" + (player == 0 ? dadNoteskin : bfNoteskin)) || FileSystem.exists(Paths.modsImages("noteskins/" + (player == 0 ? dadNoteskin : bfNoteskin)));
var babyArrow:StrumNote = new StrumNote(middleScroll ? STRUM_X_MIDDLESCROLL : STRUM_X, strumLine.y, i, player);
babyArrow.downScroll = ClientPrefs.downScroll;
@@ -5247,11 +5255,11 @@ class PlayState extends MusicBeatState
rating.updateHitbox();
FlxTween.tween(rating, {alpha: 0}, 0.2 / playbackRate, {
- startDelay: 0.7 / playbackRate,
+ startDelay: Conductor.crochet * 0.001 / playbackRate,
onComplete: function(tween:FlxTween)
{
- rating.kill();
- }
+ rating.destroy();
+ },
});
}
@@ -5313,9 +5321,9 @@ class PlayState extends MusicBeatState
FlxTween.tween(numScore, {alpha: 0}, 0.2 / playbackRate, {
onComplete: function(tween:FlxTween)
{
- numScore.kill();
+ numScore.destroy();
},
- startDelay: 1.4 / playbackRate
+ startDelay: Conductor.crochet * 0.002 / playbackRate
});
}
}
diff --git a/source/Section.hx b/source/Section.hx
index 67c25681c02..d5167974c38 100644
--- a/source/Section.hx
+++ b/source/Section.hx
@@ -21,11 +21,6 @@ class Section
public var typeOfSection:Int = 0;
public var mustHitSection:Bool = true;
- /**
- * Copies the first section into the second section!
- */
- public static var COPYCAT:Int = 0;
-
public function new(sectionBeats:Float = 4)
{
this.sectionBeats = sectionBeats;
diff --git a/source/editors/ChartingState.hx b/source/editors/ChartingState.hx
index 23c6df536fb..dbd690c8156 100644
--- a/source/editors/ChartingState.hx
+++ b/source/editors/ChartingState.hx
@@ -1,6 +1,6 @@
package editors;
-import flash.geom.Rectangle;
+import openfl.geom.Rectangle;
import haxe.Json;
import haxe.format.JsonParser;
import haxe.io.Bytes;
@@ -49,7 +49,7 @@ import openfl.utils.ByteArray;
import openfl.events.UncaughtErrorEvent;
using StringTools;
#if sys
-import flash.media.Sound;
+import openfl.media.Sound;
import sys.FileSystem;
import sys.io.File;
#end
@@ -251,6 +251,9 @@ class ChartingState extends MusicBeatState
public static var vortex:Bool = false;
public var mouseQuant:Bool = false;
public var hitsoundVol:Float = 1;
+
+ var autoSaveTimer:FlxTimer;
+ public var autoSaveLength:Float = 90; // 2 minutes
override function create()
{
idleMusic = new EditingMusic();
@@ -498,6 +501,24 @@ class ChartingState extends MusicBeatState
autosaveIndicator.scrollFactor.set();
autosaveIndicator.antialiasing = ClientPrefs.globalAntialiasing;
add(autosaveIndicator);
+ if(autoSaveTimer != null) {
+ autoSaveTimer.cancel();
+ autoSaveTimer = null;
+ autosaveIndicator.alpha = 0;
+ }
+ // TODO: expand this more & maybe port the 1.0 system to here
+ autoSaveTimer = new FlxTimer().start(autoSaveLength, function(tmr:FlxTimer) {
+ FlxTween.tween(autosaveIndicator, {alpha: 1}, 1, {
+ ease: FlxEase.quadInOut,
+ onComplete: function (twn:FlxTween) {
+ FlxTween.tween(autosaveIndicator, {alpha: 0}, 1, {
+ startDelay: 0.1,
+ ease: FlxEase.quadInOut
+ });
+ }
+ });
+ autosaveSong();
+ }, 0);
addSongUI();
addSectionUI();
@@ -659,6 +680,9 @@ class ChartingState extends MusicBeatState
});
var autosaveButton:FlxButton = new FlxButton(saveEvents.x, reloadSongJson.y + 60, "Save to Autosave", function()
{
+ if (autoSaveTimer != null)
+ autoSaveTimer.reset(autoSaveLength);
+
autosaveSong();
});
diff --git a/source/options/VisualsUISubState.hx b/source/options/VisualsUISubState.hx
index 35ef4cfb327..4396df55690 100644
--- a/source/options/VisualsUISubState.hx
+++ b/source/options/VisualsUISubState.hx
@@ -282,7 +282,7 @@ class VisualsUISubState extends BaseOptionsMenu
'scoreStyle',
'string',
'Psych Engine',
- ['Psych Engine', 'VS Impostor', 'Kade Engine', 'Forever Engine', 'TGT V4', 'Dave Engine', 'Doki Doki+', 'Leather Engine', 'JS Engine']);
+ ['Psych Engine', 'VS Impostor', 'Kade Engine', 'Forever Engine', 'TGT V4', 'Dave Engine', 'Doki Doki+', 'Leather Engine', 'JS Engine', 'Vanilla']);
addOption(option);
var option:Option = new Option('Time Bar Style:',