Skip to content

Commit

Permalink
scale down long song names in freeplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Sep 10, 2024
1 parent 3934871 commit 31150ba
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 69 deletions.
5 changes: 2 additions & 3 deletions source/game/NoteSplash.hx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ class NoteSplash extends FlxSprite {
if (target != null) {
x = target.x - (target.width / 1.5);
y = target.y - (target.height / 1.5);

color = target.color;

flipX = target.flipX;
flipY = target.flipY;

angle = target.angle;
alpha = target.alpha;
visible = target.visible;
}

super.update(elapsed);
Expand Down
4 changes: 2 additions & 2 deletions source/game/StageGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class StageGroup extends FlxGroup {
bgGirls = new BackgroundGirls(-100, 190);
bgGirls.scrollFactor.set(0.9, 0.9);

bgGirls.setGraphicSize(Std.int(bgGirls.width * PlayState.daPixelZoom));
bgGirls.setGraphicSize(Std.int(bgGirls.width * 6));
bgGirls.updateHitbox();
add(bgGirls);
}
Expand Down Expand Up @@ -207,7 +207,7 @@ class StageGroup extends FlxGroup {

bgGirls.getScared();

bgGirls.setGraphicSize(Std.int(bgGirls.width * PlayState.daPixelZoom));
bgGirls.setGraphicSize(Std.int(bgGirls.width * 6));
bgGirls.updateHitbox();
add(bgGirls);

Expand Down
93 changes: 44 additions & 49 deletions source/game/Tallies.hx
Original file line number Diff line number Diff line change
@@ -1,57 +1,52 @@
package game;


@:forward
abstract Tallies(RawTallies)
{
public function new()
{
this =
{
combo: 0,
missed: 0,
shit: 0,
bad: 0,
good: 0,
sick: 0,
totalNotes: 0,
totalNotesHit: 0,
maxCombo: 0,
score: 0,
isNewHighscore: false
}
}
abstract Tallies(RawTallies) {
public function new() {
this = {
combo: 0,
missed: 0,
shit: 0,
bad: 0,
good: 0,
sick: 0,
totalNotes: 0,
totalNotesHit: 0,
maxCombo: 0,
score: 0,
isNewHighscore: false
}
}
}

/**
* A structure object containing the data for highscore tallies.
*/
typedef RawTallies =
{
var combo:Int;

/**
* How many notes you let scroll by.
*/
var missed:Int;

var shit:Int;
var bad:Int;
var good:Int;
var sick:Int;
var maxCombo:Int;

var score:Int;

var isNewHighscore:Bool;

/**
* How many notes total that you hit. (NOT how many notes total in the song!)
*/
var totalNotesHit:Int;

/**
* How many notes in the current chart
*/
var totalNotes:Int;
}
typedef RawTallies = {
var combo:Int;

/**
* How many notes you let scroll by.
*/
var missed:Int;

var shit:Int;
var bad:Int;
var good:Int;
var sick:Int;
var maxCombo:Int;

var score:Int;

var isNewHighscore:Bool;

/**
* How many notes total that you hit. (NOT how many notes total in the song!)
*/
var totalNotesHit:Int;

/**
* How many notes in the current chart
*/
var totalNotes:Int;
}
7 changes: 7 additions & 0 deletions source/modding/scripts/languages/HScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ class HScript {
interp.variables.set("FlxSpriteGroup", flixel.group.FlxSpriteGroup);
interp.variables.set("FlxAnimate", flxanimate.FlxAnimate);
interp.variables.set("FlxAtlasSprite", game.graphics.FlxAtlasSprite);
interp.variables.set("Map", haxe.ds.StringMap);
interp.variables.set("StringMap", haxe.ds.StringMap);
interp.variables.set("IntMap", haxe.ds.IntMap);
interp.variables.set("EnumValueMap", haxe.ds.EnumValueMap);
interp.variables.set("ObjectMap", haxe.ds.ObjectMap);



// game classes
interp.variables.set("PlayState", states.PlayState);
Expand Down
10 changes: 8 additions & 2 deletions source/states/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ class FreeplayState extends MusicBeatState {
if (!Options.getData("loadAsynchronously") || !Options.getData("healthIcons")) {
#end
for (i in 0...songs.length) {
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false);
var scaleShit = (9 / songs[i].songName.length);
if (songs[i].songName.length <= 9)
scaleShit = 1;
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false, scaleShit);
songText.isMenuItem = true;
songText.targetY = i;
grpSongs.add(songText);
Expand All @@ -235,7 +238,10 @@ class FreeplayState extends MusicBeatState {
var i:Int = 0;

while (!stop_loading_songs && i < songs.length) {
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false);
var scaleShit = (9 / songs[i].songName.length);
if (songs[i].songName.length <= 9)
scaleShit = 1;
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false, scaleShit);
songText.isMenuItem = true;
songText.targetY = i;
grpSongs.add(songText);
Expand Down
16 changes: 8 additions & 8 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class PlayState extends MusicBeatState {

/**
`Array` of all the songs that you are going
to play next in Story Mode as `Strings`.
to play next in Story Mode as `String`.
**/
public static var storyPlaylist:Array<String> = [];

Expand Down Expand Up @@ -368,7 +368,7 @@ class PlayState extends MusicBeatState {
@author ninjamuffin99 probably
**/
public static var daPixelZoom:Float = 6;
@:noCompletion public static var daPixelZoom:Float = 6;

/**
Whether or not you are currently in a cutscene.
Expand Down Expand Up @@ -498,22 +498,22 @@ class PlayState extends MusicBeatState {
public var hitSoundString:String = Options.getData("hitsound");

/**
`Map` of `Strings` to `Boyfriends` for changing `bf`'s character.
`Map` of `String` to `Boyfriend` for changing `bf`'s character.
**/
public var bfMap:Map<String, Boyfriend> = [];

/**
`Map` of `Strings` to `Characters` for changing `gf`'s character.
`Map` of `String` to `Character` for changing `gf`'s character.
**/
public var gfMap:Map<String, Character> = [];

/**
`Map` of `Strings` to `Characters` for changing `dad`'s character.
`Map` of `String` to `Character` for changing `dad`'s character.
**/
public var dadMap:Map<String, Character> = [];

/**
`Map` of `Strings` to `StageGroups` for changing the `stage`.
`Map` of `String` to `StageGroup` for changing the `stage`.
**/
public var stageMap:Map<String, StageGroup> = [];

Expand Down Expand Up @@ -544,7 +544,7 @@ class PlayState extends MusicBeatState {

#if LUA_ALLOWED
/**
`Map` of `Strings` to Lua Modcharts used for custom events.
`Map` of `String` to `ModchartUtilities` used for custom events.
**/
public var event_luas:Map<String, ModchartUtilities> = [];

Expand Down Expand Up @@ -622,7 +622,7 @@ class PlayState extends MusicBeatState {

// if we have a hitsound, preload it nerd
if (hitSoundString != "none")
hitsound = FlxG.sound.load(Paths.sound("hitsounds/" + Std.string(hitSoundString).toLowerCase()));
hitsound = FlxG.sound.load(Paths.sound("hitsounds/" + hitSoundString.toLowerCase()));

// set the character we playing as
switch (Options.getData("playAs")) {
Expand Down
21 changes: 16 additions & 5 deletions source/ui/Alphabet.hx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ class Alphabet extends FlxSpriteGroup {
var isBold:Bool = false;
var isTyped:Bool = false;

public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false) {
public var scaleMult:Float = 1.0;

public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, scale:Float = 1) {
super(x, y);

scaleMult = scale;
forceX = Math.NEGATIVE_INFINITY;

_finalText = text;
Expand Down Expand Up @@ -78,17 +81,19 @@ class Alphabet extends FlxSpriteGroup {
xPos += lastSprite.width;

if (lastWasSpace) {
xPos += 40;
xPos += 40 * scaleMult;
lastWasSpace = false;
}

var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0, scaleMult);

if (isBold)
letter.createBold(character);
else
letter.createLetter(character);

letter.y -= scaleMult / 2;

add(letter);

lastSprite = letter;
Expand Down Expand Up @@ -199,12 +204,18 @@ class AlphaCharacter extends FlxSprite {

public var row:Int = 0;

public function new(x:Float, y:Float) {
public var scaleMult:Float = 1;

public function new(x:Float, y:Float, scaleMult:Float = 1) {
super(x, y);
this.scaleMult = scaleMult;

frames = Paths.getSparrowAtlas('alphabet');

antialiasing = true;
antialiasing = Options.getData("antialiasing");

setGraphicSize(width * scaleMult);
updateHitbox();
}

public function createBold(letter:String) {
Expand Down

0 comments on commit 31150ba

Please sign in to comment.