Skip to content

Commit

Permalink
add backwards compat with old num ratings
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Sep 30, 2024
1 parent 03b0a39 commit 91eeda9
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 208 deletions.
Binary file removed art/ffmpeg.exe
Binary file not shown.
4 changes: 0 additions & 4 deletions project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@

<!--If you want the discord rcp to be used-->
<define name="DISCORD_ALLOWED" if="desktop"/>

<!--If you want to have ffmpeg used for osu and quaver pack zip support-->
<define name="ZIPS_ALLOWED" if="desktop"/>

<!--If to check on startup for newer versions of the game-->
<define name="CHECK_UPDATES" if="desktop"/>
Expand Down Expand Up @@ -72,7 +69,6 @@
<assets path='example_mods' rename='mods' embed='false' if="MODS_ALLOWED"/>
<assets path='art/readme.txt' rename='do NOT readme.txt' if="desktop" />
<assets path='art/preloaderArt.png' rename='assets/images/preloaderArt.png' if="desktop"/>
<assets path='art/ffmpeg.exe' rename='assets/data/ffmpeg.exe' if="ZIPS_ALLOWED"/>

<!-- _______________________________ Libraries ______________________________ -->

Expand Down
2 changes: 1 addition & 1 deletion source/funkin/objects/NotesGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class NotesGroup extends Group
instance = this;
game = isPlayState ? PlayState.instance : null;
this.isPlayState = isPlayState;
//SONG = Song.checkSong(song, null, false); //Double check null values
SONG = song;
curSong = SONG.song;

Expand Down
40 changes: 29 additions & 11 deletions source/funkin/objects/RatingGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ class RatingGroup extends TypedSpriteGroup<RemoveRating>
}
}

class JudgeRating extends RemoveRating {
public static var judgeRatings:Array<String> = ['shit', 'bad', 'good', 'sick'];
class JudgeRating extends RemoveRating
{
var animated:Bool = true;

public function new() {
super();

var judgeRatings:Array<String> = ['shit', 'bad', 'good', 'sick'];

judgeRatings.fastForEach((i, _) -> {
var oldJudge = Paths.png('skins/${SkinUtil.curSkin}/ratings/$i');
if (Paths.exists(oldJudge, IMAGE)) {
animated = false; // Backwards compatibility ???
animated = false; // Backwards compatibility
break;
}
});
Expand Down Expand Up @@ -123,25 +127,39 @@ class ComboRating extends RemoveRating {
}
}

class NumRating extends RemoveRating {
class NumRating extends RemoveRating
{
public var initScale:Float = 1;
var animated:Bool = true;

public function new() {
super();
final path:String = 'skins/${SkinUtil.curSkin}/ratings/nums';
loadImage(path, false, null, null, lodLevel);

loadGraphic(graphic, true, Std.int(width * 0.1 / lodScale), Std.int(height / lodScale));
for (i in 0...10)
animation.add(Std.string(i), [i], 1);
{
var oldNum = Paths.png('skins/${SkinUtil.curSkin}/ratings/num$i');
if (Paths.exists(oldNum, IMAGE)) {
animated = false; // Backwards compatibility
break;
}
}

setScale(scale.x);
initScale = scale.x;
if (animated) {
final path:String = 'skins/${SkinUtil.curSkin}/ratings/nums';
loadImage(path, false, null, null, lodLevel);

loadGraphic(graphic, true, Std.int(width * 0.1 / lodScale), Std.int(height / lodScale));
for (i in 0...10)
animation.add(Std.string(i), [i], 1);

setScale(scale.x);
initScale = scale.x;
}
}

public function init(num:String, id:Int = 0) {
setPosition(0, 100);
animation.play(num, true);
animated ? animation.play(num, true) : loadImage('skins/${SkinUtil.curSkin}/ratings/num$num', false, null, null, lodLevel);
updateHitbox();
start(Conductor.crochetMills * 2, Conductor.stepCrochet * 0.025);
jump(0.8);
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ class PlayState extends MusicBeatState
FlxG.cameras.setDefaultDrawTarget(camGame, true);
persistentUpdate = persistentDraw = true;

//SONG = Song.checkSong(SONG, null, false);

#if discord_rpc
detailsText = isStoryMode ? 'Story Mode: ${storyWeek.toUpperCase()}' : 'Freeplay';
detailsPausedText = 'Paused - $detailsText';
Expand Down
21 changes: 0 additions & 21 deletions source/funkin/states/options/ModFoldersState.hx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package funkin.states.options;
import funkin.states.options.items.ModItem;
import funkin.states.options.items.SpriteButton;
#if ZIPS_ALLOWED
import haxe.io.Path;
import funkin.util.backend.SongZip;
#end

class ModFoldersState extends MusicBeatState
{
Expand Down Expand Up @@ -50,23 +46,6 @@ class ModFoldersState extends MusicBeatState
}

super.create();

#if ZIPS_ALLOWED
FlxG.stage.window.onDropFile.removeAll();
FlxG.stage.window.onDropFile.add(function (file:String) {
var extension = Path.extension(file).toLowerCase();
if (SongZip.zipMap.exists(extension))
{
var newPath = "./mods/" + Path.withoutDirectory(file);
sys.io.File.copy(file, newPath);
reloadFolders();
}
else
{ // Invalid mod zip format
CoolUtil.playSound("rejectMenu");
}
});
#end
}

function reloadFolders():Void {
Expand Down
3 changes: 1 addition & 2 deletions source/funkin/substates/NotesSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class NotesSubstate extends MusicBeatSubstate
{
super(true, 0x98000000);
this.position = position;

//SONG = Song.checkSong(song);

SONG = song;
notesGroup = new NotesGroup(SONG, false);
notesGroup.skipStrumIntro = true;
Expand Down
3 changes: 0 additions & 3 deletions source/funkin/util/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class CoolUtil {
public static var debugMode:Bool = false;

inline public static function init():Void {
#if ZIPS_ALLOWED
FunkThread.run(funkin.util.backend.SongZip.init);
#end
#if desktop
ModdingUtil.reloadMods();
#end
Expand Down
164 changes: 0 additions & 164 deletions source/funkin/util/backend/SongZip.hx

This file was deleted.

0 comments on commit 91eeda9

Please sign in to comment.