Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/fonts/vcr-bmp.fnt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><font><info face="vcr-bmp" size="20" bold="0" italic="0" charset="" unicode="1" stretchH="100" smooth="1" aa="1" padding="1,1,1,1" spacing="1,1" outline="0"/><common lineHeight="20" base="18" scaleW="140" scaleH="140" pages="1" packed="0" alphaChnl="0" redChnl="4" greenChnl="4" blueChnl="4"/><pages><page id="0" file="vcr-bmp.png"/></pages><chars count="90"><!-- --><char id="32" x="0" y="0" width="0" height="0" xoffset="0" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- ! --><char id="33" x="15" y="47" width="5" height="16" xoffset="2" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- " --><char id="34" x="107" y="126" width="11" height="6" xoffset="0" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- # --><char id="35" x="79" y="85" width="13" height="15" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- $ --><char id="36" x="79" y="68" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- % --><char id="37" x="79" y="17" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- & --><char id="38" x="0" y="23" width="13" height="18" xoffset="-1" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- ' --><char id="39" x="15" y="40" width="6" height="6" xoffset="2" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- ( --><char id="40" x="131" y="53" width="8" height="18" xoffset="1" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- ) --><char id="41" x="131" y="72" width="8" height="18" xoffset="2" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- * --><char id="42" x="107" y="114" width="11" height="11" xoffset="0" yoffset="1" xadvance="12" page="0" chnl="15"/><!-- + --><char id="43" x="107" y="84" width="13" height="12" xoffset="-1" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- , --><char id="44" x="15" y="33" width="7" height="6" xoffset="1" yoffset="12" xadvance="12" page="0" chnl="15"/><!-- - --><char id="45" x="107" y="133" width="10" height="5" xoffset="1" yoffset="8" xadvance="12" page="0" chnl="15"/><!-- . --><char id="46" x="15" y="113" width="4" height="4" xoffset="3" yoffset="14" xadvance="12" page="0" chnl="15"/><!-- / --><char id="47" x="79" y="51" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 0 --><char id="48" x="0" y="42" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 1 --><char id="49" x="131" y="19" width="9" height="16" xoffset="1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 2 --><char id="50" x="0" y="59" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 3 --><char id="51" x="0" y="76" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 4 --><char id="52" x="0" y="93" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 5 --><char id="53" x="0" y="110" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 6 --><char id="54" x="23" y="0" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 7 --><char id="55" x="23" y="17" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 8 --><char id="56" x="23" y="34" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- 9 --><char id="57" x="23" y="51" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- : --><char id="58" x="15" y="64" width="5" height="12" xoffset="2" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- ; --><char id="59" x="15" y="18" width="7" height="14" xoffset="0" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- = --><char id="61" x="79" y="131" width="13" height="8" xoffset="-1" yoffset="6" xadvance="12" page="0" chnl="15"/><!-- ? --><char id="63" x="79" y="34" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- @ --><char id="64" x="93" y="45" width="13" height="14" xoffset="-1" yoffset="3" xadvance="12" page="0" chnl="15"/><!-- A --><char id="65" x="37" y="0" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- B --><char id="66" x="37" y="17" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- C --><char id="67" x="37" y="34" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- D --><char id="68" x="37" y="51" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- E --><char id="69" x="37" y="68" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- F --><char id="70" x="37" y="85" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- G --><char id="71" x="37" y="102" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- H --><char id="72" x="37" y="119" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- I --><char id="73" x="131" y="36" width="9" height="16" xoffset="1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- J --><char id="74" x="51" y="0" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- K --><char id="75" x="51" y="17" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- L --><char id="76" x="51" y="34" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- M --><char id="77" x="51" y="51" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- N --><char id="78" x="51" y="68" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- O --><char id="79" x="51" y="85" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- P --><char id="80" x="51" y="102" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- Q --><char id="81" x="51" y="119" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- R --><char id="82" x="65" y="0" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- S --><char id="83" x="65" y="17" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- T --><char id="84" x="65" y="34" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- U --><char id="85" x="65" y="51" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- V --><char id="86" x="65" y="68" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- W --><char id="87" x="65" y="85" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- X --><char id="88" x="65" y="102" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- Y --><char id="89" x="65" y="119" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- Z --><char id="90" x="79" y="0" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- [ --><char id="91" x="131" y="0" width="9" height="18" xoffset="2" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- ^ --><char id="94" x="93" y="130" width="13" height="7" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- _ --><char id="95" x="0" y="18" width="14" height="4" xoffset="-1" yoffset="15" xadvance="12" page="0" chnl="15"/><!-- a --><char id="97" x="79" y="101" width="13" height="14" xoffset="-1" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- b --><char id="98" x="23" y="68" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- c --><char id="99" x="0" y="127" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- d --><char id="100" x="23" y="85" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- e --><char id="101" x="93" y="60" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- f --><char id="102" x="107" y="97" width="11" height="16" xoffset="0" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- g --><char id="103" x="79" y="116" width="13" height="14" xoffset="-1" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- h --><char id="104" x="23" y="102" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- i --><char id="105" x="121" y="73" width="9" height="15" xoffset="1" yoffset="3" xadvance="12" page="0" chnl="15"/><!-- j --><char id="106" x="121" y="38" width="9" height="17" xoffset="1" yoffset="1" xadvance="12" page="0" chnl="15"/><!-- k --><char id="107" x="23" y="119" width="13" height="16" xoffset="-1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- l --><char id="108" x="15" y="96" width="4" height="16" xoffset="4" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- m --><char id="109" x="93" y="74" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- n --><char id="110" x="93" y="88" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- o --><char id="111" x="93" y="102" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- p --><char id="112" x="93" y="0" width="13" height="14" xoffset="-1" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- q --><char id="113" x="93" y="15" width="13" height="14" xoffset="-1" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- r --><char id="114" x="93" y="116" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- s --><char id="115" x="107" y="0" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- t --><char id="116" x="121" y="56" width="9" height="16" xoffset="1" yoffset="2" xadvance="12" page="0" chnl="15"/><!-- u --><char id="117" x="107" y="14" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- v --><char id="118" x="107" y="28" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- w --><char id="119" x="107" y="42" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- x --><char id="120" x="107" y="56" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- y --><char id="121" x="93" y="30" width="13" height="14" xoffset="-1" yoffset="4" xadvance="12" page="0" chnl="15"/><!-- z --><char id="122" x="107" y="70" width="13" height="13" xoffset="-1" yoffset="5" xadvance="12" page="0" chnl="15"/><!-- { --><char id="123" x="121" y="0" width="9" height="18" xoffset="1" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- | --><char id="124" x="15" y="77" width="4" height="18" xoffset="4" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- } --><char id="125" x="121" y="19" width="9" height="18" xoffset="1" yoffset="0" xadvance="12" page="0" chnl="15"/><!-- № --><char id="8470" x="0" y="0" width="22" height="17" xoffset="0" yoffset="0" xadvance="22" page="0" chnl="15"/></chars></font>
Binary file added assets/fonts/vcr-bmp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion source/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class ClientPrefs { //default settings if it can't find a save file containing y
public static var rainbowTime:Float = 5.0;
public static var autosaveCharts:Bool = true;
public static var autosaveTime:Int = 240;
public static var useBitmapScore:Bool = false; // compatibility

//Gameplay Modifiers
public static var gameplaySettings:Map<String, Dynamic> = [
Expand Down Expand Up @@ -249,7 +250,7 @@ class ClientPrefs { //default settings if it can't find a save file containing y
// i suck at naming things sorry
private static var importantMap:Map<String, Array<String>> = [
"saveBlackList" => ["keyBinds", "defaultKeys", "defaultArrowRGB", "defaultPixelRGB", "defaultQuantRGB"],
"flixelSound" => ["volume", "sound"],
"flixelSound" => ["volume", "sound"],
"loadBlackList" => ["keyBinds", "defaultKeys", "defaultArrowRGB", "defaultPixelRGB", "defaultQuantRGB"],
];

Expand Down
77 changes: 67 additions & 10 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import objects.*;
import openfl.events.KeyboardEvent;
import openfl.system.System;
import play.objects.*;
import flixel.text.FlxBitmapFont;
import flixel.text.FlxBitmapText;
#if SHADERS_ALLOWED
import openfl.filters.ShaderFilter;
import shaders.ErrorHandledShader;
Expand Down Expand Up @@ -304,7 +306,7 @@ class PlayState extends MusicBeatState
public var songScore:Float = 0;
public var songHits:Int = 0;
public var songMisses:Float = 0;
public var scoreTxt:FlxText;
public var scoreTxt:FlxSprite = null;
var timeTxt:FlxText;

var hitTxt:FlxText;
Expand Down Expand Up @@ -384,6 +386,8 @@ class PlayState extends MusicBeatState

var startingTime:Float = haxe.Timer.stamp();
var endingTime:Float = haxe.Timer.stamp();

static var vcrBitmapFont:FlxBitmapFont;

// FFMpeg values :)
var ffmpegMode = ClientPrefs.ffmpegMode;
Expand Down Expand Up @@ -1215,18 +1219,50 @@ class PlayState extends MusicBeatState
}

// TODO: cleanup playstate, by moving most of this and other duplicate functions like healthbop, etc
scoreTxt = new FlxText(0, healthBarBG.y + 50, FlxG.width, "", 20);
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, OUTLINE,FlxColor.BLACK);
scoreTxt.scrollFactor.set();
scoreTxt.borderSize = 1;
if (ClientPrefs.useBitmapScore){
final bmp:FlxBitmapText = new FlxBitmapText(
0, healthBarBG.y + 50, "",
FlxBitmapFont.fromAngelCode(
Paths.font("vcr-bmp.png"),
Paths.font("vcr-bmp.fnt")
)
);

bmp.alignment = CENTER;
bmp.borderStyle = OUTLINE;
bmp.borderColor = FlxColor.BLACK;
bmp.letterSpacing = -1;
bmp.scrollFactor.set();
bmp.borderSize = 2;
bmp.scale.set(bmp.scale.x * 1.1, bmp.scale.y * 1.1);

scoreTxt = bmp;
scoreTxt.screenCenter(X);
}
else
{
final txt:FlxText = new FlxText(
0, healthBarBG.y + 50,
FlxG.width, "", 20
);

txt.setFormat(Paths.font("vcr.ttf"), 16,
FlxColor.WHITE, CENTER, OUTLINE, FlxColor.BLACK);

txt.scrollFactor.set();
txt.borderSize = 1;

scoreTxt = txt;
scoreTxt.screenCenter(X);
}
scoreTxt.visible = !ClientPrefs.hideHud;
add(scoreTxt);

var style:String = ClientPrefs.scoreStyle;
var dadColors:Array<Int> = CoolUtil.getHealthColors(dad);
final dadColors:Array<Int> = CoolUtil.getHealthColors(dad);

// Configuration for each style
var styleSettings = { // profiency using typedefs
final styleSettings = { // profiency using typedefs
'JS Engine': {
font: "vcr.ttf", size: 18, color: FlxColor.fromRGB(dadColors[0], dadColors[1], dadColors[2]),
yOffset: null, borderSize: 2, xOverride: null
Expand Down Expand Up @@ -1266,8 +1302,18 @@ class PlayState extends MusicBeatState
final s = Reflect.getProperty(styleSettings, style);
if (s.yOffset != null) scoreTxt.y = healthBarBG.y + s.yOffset;
if (s.xOverride != null) scoreTxt.x = s.xOverride;
scoreTxt.setFormat(Paths.font(s.font), s.size, s.color, CENTER, OUTLINE, FlxColor.BLACK);
scoreTxt.borderSize = s.borderSize;
if (!ClientPrefs.useBitmapScore)
{
cast(scoreTxt, FlxText).setFormat(
Paths.font(s.font),
s.size,
s.color,
CENTER,
OUTLINE,
FlxColor.BLACK
);
}
(scoreTxt : Dynamic).borderSize = s.borderSize;
if (style == 'Forever Engine' || style == 'Vanilla') updateScore();
}

Expand Down Expand Up @@ -2177,6 +2223,17 @@ class PlayState extends MusicBeatState
var comboInfo = ClientPrefs.showComboInfo;
var showNPS = ClientPrefs.showNPS;
var missString:String = '';

function setScoreText(value:String)
{
if (Std.isOfType(scoreTxt, FlxText))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could've done if (scoreTxt is FlxText)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could've done if (scoreTxt is FlxText)

that method is deprecated, this is the newer method

cast(scoreTxt, FlxText).text = value;
else
cast(scoreTxt, FlxBitmapText).text = value;

scoreTxt.screenCenter(X);
}

public dynamic function updateScore(miss:Bool = false)
{
scoreTxtUpdateFrame++;
Expand Down Expand Up @@ -2236,7 +2293,7 @@ class PlayState extends MusicBeatState
tempScore = 'Score: ' + formattedScore;
}

scoreTxt.text = '${tempScore}\n';
setScoreText('${tempScore}\n');

callOnLuas('onUpdateScore', [miss]);
}
Expand Down
8 changes: 8 additions & 0 deletions source/options/OptimizationSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ class OptimizationSubState extends BaseOptionsMenu
'bool',
false);
addOption(option);

var option:Option = new Option('Use Bitmap ScoreTxt WIP',
"If checked, Uses FlxBitmapText for the score display to reduce garbage collection spikes and improve performance when the score updates frequently.
May cause compatibility issues with Lua mods that change text size or font dynamically.",
'useBitmapScore',
'bool',
false);
addOption(option);

var option:Option = new Option('Disable onSpawnNote Lua Calls',
"If checked, the game will not call onSpawnNote when a note is spawned.\nIf you have a script that uses that, maybe leave it on.",
Expand Down