Skip to content

Commit 0a44f6a

Browse files
committed
allow custom text if there isnt any in the difficulty substate
1 parent f64d3f9 commit 0a44f6a

File tree

8 files changed

+50
-153
lines changed

8 files changed

+50
-153
lines changed

assets/base_game/shared/data/beat-battle-2/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"freeplay": {
1010
"bg":"menuBGBlue",
1111
"album":"NoCover",
12-
"ratings":{}
12+
"ratings":{ "hard": 7 }
1313
}
1414
}

assets/base_game/shared/data/beat-battle/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"freeplay": {
1010
"bg":"menuBGBlue",
1111
"album":"NoCover",
12-
"ratings":{}
12+
"ratings":{ "normal": 5, "reasonable": 7, "unreasonable": 10, "semi-impossible": 15, "impossible": 20}
1313
}
1414
}

assets/base_game/shared/data/small-argument/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"freeplay": {
1010
"bg":"menuBGBlue",
1111
"album":"NoCover",
12-
"ratings":{}
12+
"ratings":{ "hard": 7 }
1313
}
1414
}

assets/fonts/difficulty.ttf

168 KB
Binary file not shown.

source/states/freeplay/OsuFreeplayState.hx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ class OsuFreeplayState extends MusicBeatState
142142
changeSong();
143143

144144
if (APEntryState.apGame != null && APEntryState.apGame.info() != null) {
145-
ticketCounter = new FlxText(FlxG.width - 470, FlxG.height - 630, 0, "0/0", 32);
145+
ticketCounter = new FlxText(0, FlxG.height - 630, 0, "0/0", 32);
146146
ticketCounter.setFormat(Paths.font("fnf1.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
147147
ticketCounter.scrollFactor.set();
148+
ticketCounter.screenCenter(X);
148149
add(ticketCounter);
149150
new FlxTimer().start(1, function(tmr:FlxTimer) {
150151
archipelago.APGameState.haventranyet = false;
@@ -393,7 +394,17 @@ class OsuFreeplayState extends MusicBeatState
393394
WeekData.setDirectoryFromWeek();
394395
Mods.currentModDirectory = FreeplayManager.songList[curSelected].folder;
395396
PlayState.storyWeek = FreeplayManager.songList[curSelected].week;
396-
try {Difficulty.loadFromWeek();} catch(e:Dynamic) {}
397+
try {
398+
switch (FreeplayManager.songList[curSelected].songName)
399+
{
400+
case 'Small Argument' | 'Beat Battle 2':
401+
Difficulty.list = ['Hard'];
402+
case "Beat Battle":
403+
Difficulty.list = ["Normal", "Reasonable", "Unreasonable", "Semi-Impossible", "Impossible"];
404+
default:
405+
Difficulty.loadFromWeek();
406+
}
407+
} catch(e:Dynamic) {}
397408
try {metadata = FreeplayManager.metadata.get(FreeplayManager.songList[curSelected].songName.toLowerCase());}
398409
catch(e) {metadata = null;}
399410

source/states/freeplay/backend/DifficultyStars.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DifficultyStars extends FlxSpriteGroup
3636
prevRandomFpsStart = randomFpsStart;
3737
prevRandomFpsLoop = randomFpsLoop;
3838

39-
var flame = new FlxSprite((starPositionOffset.x * i) + flamePositionOffset.x, (starPositionOffset.y * i) + flamePositionOffset.y);
39+
var flame = new FlxSprite((starPositionOffset.x * i) + flamePositionOffset.x, (starPositionOffset.y) + flamePositionOffset.y);
4040
flame.frames = Paths.getSparrowAtlas("freeplay/freeplayFlame");
4141
flame.animation.addByIndices("start", "fire loop full instance 1", [0, 1], "", randomFpsStart, false);
4242
flame.animation.addByIndices("loop", "fire loop full instance 1", [2, 3, 4, 5, 6, 7, 8, 9], "", randomFpsLoop, true);

source/states/freeplay/backend/FreeplayFlames.hx

Lines changed: 0 additions & 136 deletions
This file was deleted.

source/states/freeplay/osu/DifficultySelectorSubState.hx

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DifficultySelectorSubState extends MusicBeatSubstate
2727

2828
var canDo:Bool = false;
2929
var difficultyStars:DifficultyStars;
30-
30+
var diffTextnecausetherewasnoimage:FlxText;
3131
public function new(song:Dynamic)
3232
{
3333
super();
@@ -48,13 +48,10 @@ class DifficultySelectorSubState extends MusicBeatSubstate
4848
difficultyStars.visible = true;
4949
difficultyStars.scrollFactor.set();
5050
difficultyStars.screenCenter();
51-
difficultyStars.y += 30;
51+
difficultyStars.y += 15;
5252
difficultyStars.x += 25;
5353
add(difficultyStars);
5454

55-
buildDifficultySprite('normal');
56-
buildDifficultySprite();
57-
5855
missingTextBG = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
5956
missingTextBG.alpha = 0.6;
6057
missingTextBG.visible = false;
@@ -66,13 +63,27 @@ class DifficultySelectorSubState extends MusicBeatSubstate
6663
missingText.visible = false;
6764
add(missingText);
6865

66+
diffTextnecausetherewasnoimage = new FlxText(50, 0, FlxG.width - 100, '', 24);
67+
diffTextnecausetherewasnoimage.setFormat(Paths.font("difficulty.ttf"), 80, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
68+
diffTextnecausetherewasnoimage.scrollFactor.set();
69+
diffTextnecausetherewasnoimage.visible = false;
70+
add(diffTextnecausetherewasnoimage);
71+
6972
new FlxTimer().start(0.2, function(tmr:FlxTimer) {
7073
canDo = true;
7174
});
7275

7376
Mods.currentModDirectory = song.folder;
7477
PlayState.storyWeek = song.week;
75-
Difficulty.loadFromWeek();
78+
switch (song.songName)
79+
{
80+
case 'Small Argument' | 'Beat Battle 2':
81+
Difficulty.list = ['Hard'];
82+
case "Beat Battle":
83+
Difficulty.list = ["Normal", "Reasonable", "Unreasonable", "Semi-Impossible", "Impossible"];
84+
default:
85+
Difficulty.loadFromWeek();
86+
}
7687
listLength = Difficulty.list.length;
7788
WeekData.setDirectoryFromWeek();
7889
changeDiff();
@@ -152,7 +163,6 @@ class DifficultySelectorSubState extends MusicBeatSubstate
152163
difficulty = listLength - 1;
153164

154165
buildDifficultySprite(Difficulty.list[difficulty].toLowerCase());
155-
sprite.screenCenter();
156166

157167
// I really don't wanna talk about it
158168
// I hate this so much but it works but I still hate it
@@ -167,18 +177,25 @@ class DifficultySelectorSubState extends MusicBeatSubstate
167177
actualRating.set(thing[0], Std.parseInt(thing[1]));
168178
}
169179

180+
var curDiff:String = Difficulty.list[difficulty].toLowerCase();
170181
if (actualRating != null) {
171-
var curDiff:String = Difficulty.list[difficulty].toLowerCase();
172182
setDifficultyStars(actualRating.get(curDiff));
173-
} else {
174-
difficultyStars.visible = false;
175183
}
176184
} catch(e) {
177185
difficultyStars.visible = false;
178186
trace("No Metadata Found!");
179187
}
180188
}
181189

190+
function setDifficultyText(?diff:String) {
191+
if (diffTextnecausetherewasnoimage != null) {
192+
diffTextnecausetherewasnoimage.text = diff.toUpperCase();
193+
diffTextnecausetherewasnoimage.screenCenter();
194+
diffTextnecausetherewasnoimage.y += 2;
195+
diffTextnecausetherewasnoimage.visible = true;
196+
}
197+
}
198+
182199
var difficultySprites:Map<String, FlxSprite>;
183200
function buildDifficultySprite(?diff:String):Void
184201
{
@@ -201,7 +218,12 @@ class DifficultySelectorSubState extends MusicBeatSubstate
201218
}
202219

203220
difficultySprites.set(diff, sprite);
204-
}
221+
}
222+
223+
if (!Paths.exists(Paths.file('images/menudifficulties/${diff}.png'))) {
224+
sprite.visible = false;
225+
setDifficultyText(diff);
226+
} else if (diffTextnecausetherewasnoimage != null) diffTextnecausetherewasnoimage.visible = false;
205227
sprite.updateHitbox();
206228
sprite.screenCenter();
207229
add(sprite);

0 commit comments

Comments
 (0)