Skip to content

Commit

Permalink
maybe a few fixes and whatever
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Oct 19, 2024
1 parent 15a9765 commit dd1cbf4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 45 deletions.
12 changes: 6 additions & 6 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Current To-Dos
* [ ] Chart the songs
* [ ] Chart the songs **[WIP]**
* [ ] Maybe a few more songs
* [ ] Replay System
* [X] Achievements
* [ ] Results
* [ ] RGB Notes + Note Coloring
* [X] Achievements **[WIP]**
* [ ] Results **[WIP]**
* [ ] RGB Notes + Note Coloring **[WIP]**
* [X] Improve controls system
* [X] Simple source code reorganization
* [ ] Hit window options
* [X] Options organization + better options system
* [X] Customizable Main Menu + Scripted States
* [ ] Accuracy + Ranking
* [ ] Better Charting UI
* [ ] Accuracy + Ranking **[WIP]**
* [ ] Better Charting UI **[WIP]**
* [ ] Song Selector Editor
1 change: 0 additions & 1 deletion source/backend/SaveData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package backend;
public var flashing:Bool = true;
public var antiMash:Bool = false;
public var displayMS:Bool = false;
public var smoothScore:Bool = false;
public var notesRGB:Array<Array<Int>> = [[221, 0, 255], [0, 128, 255], [0, 215, 54], [255, 0, 106]];
public var keyboardBinds:Array<FlxKey> = [LEFT, DOWN, UP, RIGHT, ENTER, ESCAPE, SPACE];
public var gamepadBinds:Array<FlxGamepadInputID> = [DPAD_LEFT, DPAD_DOWN, DPAD_UP, DPAD_RIGHT, A, B];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package substates;
package options;

import backend.Localization.Locale;

class LanguageSubState extends ExtendableSubState {
class LanguageState extends ExtendableState {
var langStrings:Array<Locale> = [];
var group:FlxTypedGroup<FlxText>;
var curSelected:Int = 0;

var bg:FlxSprite;
var title:FlxText;
var noticeTxt:FlxText;

public function new() {
super();
override function create() {
super.create();

var initLangString = Paths.getText(Paths.txt('languages/languagesData'));

Expand All @@ -28,15 +24,15 @@ class LanguageSubState extends ExtendableSubState {
langStrings.push(new Locale(data[0], data[1]));
}

bg = new FlxSprite().loadGraphic(Paths.image('menu/backgrounds/options_bg'));
var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menu/backgrounds/options_bg'));
bg.screenCenter();
add(bg);

var grid:FlxBackdrop = new FlxBackdrop(FlxGridOverlay.createGrid(80, 80, 160, 160, true, 0x33FFFFFF, 0x0));
grid.velocity.set(40, 40);
add(grid);

title = new FlxText(0, 0, 0, Localization.get("langSelect", SaveData.settings.lang), 12);
var title:FlxText = new FlxText(0, 0, 0, Localization.get("langSelect", SaveData.settings.lang), 12);
title.setFormat(Paths.font('vcr.ttf'), 70, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
title.screenCenter(X);
add(title);
Expand All @@ -52,7 +48,7 @@ class LanguageSubState extends ExtendableSubState {
group.add(text);
}

noticeTxt = new FlxText(5, FlxG.height - 24, 0, Localization.get("langNotCompletelyAccurate", SaveData.settings.lang), 12);
var noticeTxt:FlxText = new FlxText(5, FlxG.height - 24, 0, Localization.get("langNotCompletelyAccurate", SaveData.settings.lang), 12);
noticeTxt.setFormat(Paths.font('vcr.ttf'), 26, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
noticeTxt.screenCenter(X);
add(noticeTxt);
Expand All @@ -63,23 +59,19 @@ class LanguageSubState extends ExtendableSubState {
override function update(elapsed:Float) {
super.update(elapsed);

bg.screenCenter();
title.screenCenter(X);
noticeTxt.screenCenter(X);

if (Input.justPressed('up') || Input.justPressed('down'))
changeSelection(Input.justPressed('up') ? -1 : 1);

if (Input.justPressed('exit')) {
FlxG.sound.play(Paths.sound("cancel"));
close();
ExtendableState.switchState(new OptionsState());
}

if (Input.justPressed('accept')) {
SaveData.settings.lang = langStrings[curSelected].code;
Localization.switchLanguage(SaveData.settings.lang);
SaveData.saveSettings();
ExtendableState.resetState();
ExtendableState.switchState(new OptionsState());
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class OptionsState extends ExtendableState {
case 1:
Main.toast.create('Menu not finished!', 0xFFFFFF00, 'This menu will be finished soon!');
case 2:
openSubState(new LanguageSubState());
ExtendableState.switchState(new options.LanguageState());
case 3:
ExtendableState.switchState(new options.NoteColorState());
}
Expand Down
4 changes: 0 additions & 4 deletions source/options/OptionsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ class OptionsSubState extends ExtendableSubState {
option.onChange = (value:Dynamic) -> SaveData.settings.displayMS = value;
options.push(option);

var option:Option = new Option("Smooth Score", "If enabled, uses the scoring system in FNF 0.3.X.", OptionType.Toggle, SaveData.settings.smoothScore);
option.onChange = (value:Dynamic) -> SaveData.settings.smoothScore = value;
options.push(option);

var option:Option = new Option("Anti-mash", "If enabled, you will get a miss for pressing keys when no notes are present.", OptionType.Toggle,
SaveData.settings.antiMash);
option.onChange = (value:Dynamic) -> SaveData.settings.antiMash = value;
Expand Down
25 changes: 9 additions & 16 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class PlayState extends ExtendableState {
public var speed:Float = 1;

public var ratingDisplay:Rating;
public var smoothScore:Float = 0;
public var accuracy:Float = 0;
public var score:Int = 0;
public var combo:Int = 0;
Expand Down Expand Up @@ -50,12 +49,12 @@ class PlayState extends ExtendableState {
public var coolBG:FlxSprite;
public var bg:FlxSprite;

public var rank:String = "";
private var totalNotesHit:Int = 0;
private var totalNotes:Int = 0;
private var totalPlayed:Int = 0;

var noteDirs:Array<String> = ['left', 'down', 'up', 'right'];

var rank:String = "";
var canPause:Bool = true;
var startedCountdown:Bool = false;
var isPerfect:Bool = true;
Expand Down Expand Up @@ -138,7 +137,7 @@ class PlayState extends ExtendableState {
}

scoreTxt = new FlxText(0, (FlxG.height * (SaveData.settings.downScroll ? 0.11 : 0.89)) + 20, FlxG.width, "", 20);
scoreTxt.setFormat(Paths.font('vcr.ttf'), 48, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
scoreTxt.setFormat(Paths.font('vcr.ttf'), 35, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
scoreTxt.screenCenter(X);

judgementCounter = new FlxText(20, 0, 0, "", 20);
Expand Down Expand Up @@ -274,9 +273,6 @@ class PlayState extends ExtendableState {
}

override function update(elapsed:Float) {
var scoreMult:Float = FlxMath.lerp(smoothScore, score, 0.108);
smoothScore = scoreMult;

super.update(elapsed);

if (paused)
Expand All @@ -302,12 +298,10 @@ class PlayState extends ExtendableState {
}
}

var scoreThing = (SaveData.settings.smoothScore) ? Utilities.truncateFloat(smoothScore, 0) : score;

judgementCounter.text = 'Perfects: ${perfects}\nNices: ${nices}\nOkays: ${okays}\nNos: ${nos}';
scoreTxt.text = (SaveData.settings.botPlay) ? Localization.get("botplayTxt",
SaveData.settings.lang) : Localization.get("scoreTxt", SaveData.settings.lang)
+ scoreThing
+ score
+ ' // '
+ Localization.get("missTxt", SaveData.settings.lang)
+ misses + ' // Accuracy: ${Utilities.truncateFloat(accuracy, 2)}%' + ' (${generateRank()})';
Expand Down Expand Up @@ -439,6 +433,7 @@ class PlayState extends ExtendableState {
score -= 10;
combo = 0;
misses++;
updateAccuracy();
}
}
}
Expand Down Expand Up @@ -578,6 +573,7 @@ class PlayState extends ExtendableState {
notes.remove(note);
note.kill();
note.destroy();
updateAccuracy();
}
}

Expand All @@ -590,19 +586,16 @@ class PlayState extends ExtendableState {
notes.remove(note);
note.kill();
note.destroy();
updateAccuracy();
}
}
}

updateAccuracy();
}
}

function updateAccuracy() {
totalNotes++;
accuracy = totalNotesHit / totalNotes * 100;
if (accuracy >= 100.00)
accuracy = 100;
totalPlayed++;
accuracy = Math.max(0, totalNotesHit / totalPlayed * 100);
}

function generateRank():String {
Expand Down

0 comments on commit dd1cbf4

Please sign in to comment.