Skip to content

Commit

Permalink
Lots of Stuff Credit for Custom songs, Custom Images and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed May 18, 2024
1 parent 4b1a61d commit 19432de
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 9 deletions.
Binary file removed assets/preload/images/packs/mod.png
Binary file not shown.
Binary file added mods/test/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mods/test/data/charts/test-cred.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Kawai Sprite & MtH
15 changes: 15 additions & 0 deletions source/CreditsPopUp.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ class CreditsPopUp extends FlxSpriteGroup
songCreator = 'TH3R34LD34L';
case 'roofs':
songCreator = 'sibottle';
default:
if (FreeplayState.isaCustomSong) {
var custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-cred.txt');
for (i in 0...custom.length)
{
var data:Array<String> = custom[i].split(':');
songCreator = data[0];
}
}
}
switch (PlayState.storyWeek)
{
Expand Down Expand Up @@ -101,13 +110,19 @@ class CreditsPopUp extends FlxSpriteGroup
case 16:
headingPath = {path: 'songHeadings/expungedHeading', antiAliasing: true,
animation: new Animation('expunged', 'Expunged', 24, true, [false, false]), iconOffset: 0};
default:
if (FreeplayState.isaCustomSong)
headingPath = {path: 'songHeadings/daveHeading', antiAliasing: false, iconOffset: 0};
}
switch (PlayState.SONG.song.toLowerCase())
{
case 'polygonized':
headingPath = {path: 'songHeadings/3D-daveHeading', antiAliasing: false, iconOffset: 0};
case 'interdimensional':
headingPath = {path: 'songHeadings/interdimensionalHeading', antiAliasing: false, iconOffset: 0};
default:
if (FreeplayState.isaCustomSong)
headingPath = {path: 'songHeadings/daveHeading', antiAliasing: false, iconOffset: 0};
}
if (PlayState.recursedStaticWeek)
{
Expand Down
25 changes: 23 additions & 2 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import flixel.FlxObject;
import flixel.addons.util.FlxAsyncLoop;
#if sys import sys.FileSystem; #end
#if desktop import Discord.DiscordClient; #end
import flixel.graphics.FlxGraphic;
import openfl.display.BitmapData;
import openfl.utils.Assets as OpenFlAssets;


using StringTools;

Expand Down Expand Up @@ -49,7 +53,7 @@ class FreeplayState extends MusicBeatState
var customSongs = CoolUtil.coolTextFile(TitleState.modFolder + '/data/CustomSongs.txt'); // idk should work

private var Catagories:Array<String> = ['dave', 'joke', 'extras', 'mod'];
var translatedCatagory:Array<String> = [LanguageManager.getTextString('freeplay_dave'), LanguageManager.getTextString('freeplay_joke'), LanguageManager.getTextString('freeplay_extra')];
var translatedCatagory:Array<String> = [LanguageManager.getTextString('freeplay_dave'), LanguageManager.getTextString('freeplay_joke'), LanguageManager.getTextString('freeplay_extra'), TitleState.currentMod];

private var CurrentPack:Int = 0;
private var NameAlpha:Alphabet;
Expand Down Expand Up @@ -170,7 +174,8 @@ class FreeplayState extends MusicBeatState
for (i in 0...Catagories.length)
{
Highscore.load();

if (FileSystem.exists(Paths.image('packs/' + (Catagories[i].toLowerCase())))) {
trace('yay');
var CurrentSongIcon:FlxSprite = new FlxSprite(0,0).loadGraphic(Paths.image('packs/' + (Catagories[i].toLowerCase()), "preload"));
CurrentSongIcon.centerOffsets(false);
CurrentSongIcon.x = (1000 * i + 1) + (512 - CurrentSongIcon.width);
Expand All @@ -184,6 +189,22 @@ class FreeplayState extends MusicBeatState
icons.push(CurrentSongIcon);
add(NameAlpha);
titles.push(NameAlpha);
} else {
trace('nae');
var CurrentSongIcon:FlxSprite = new FlxSprite(0,0).loadGraphic(Paths.customImage('Icon'));
CurrentSongIcon.centerOffsets(false);
CurrentSongIcon.x = (1000 * i + 1) + (512 - CurrentSongIcon.width);
CurrentSongIcon.y = (FlxG.height / 2) - 256;
CurrentSongIcon.antialiasing = true;

var NameAlpha:Alphabet = new Alphabet(40, (FlxG.height / 2) - 282, translatedCatagory[i], true, false);
NameAlpha.x = CurrentSongIcon.x;

add(CurrentSongIcon);
icons.push(CurrentSongIcon);
add(NameAlpha);
titles.push(NameAlpha);
}
}


Expand Down
5 changes: 4 additions & 1 deletion source/HealthIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package;

import flixel.FlxSprite;
import flixel.math.FlxMath;
import flixel.graphics.FlxGraphic;
import openfl.display.BitmapData;


class HealthIcon extends FlxSprite
{
Expand Down Expand Up @@ -34,7 +37,7 @@ class HealthIcon extends FlxSprite
if (this.char != char)
{
if (char != "none")
loadGraphic(Paths.image('ui/iconGrid/' + char, 'preload'), true, 150, 150);
loadGraphic(FlxGraphic.fromBitmapData(BitmapData.fromFile(Paths.image('ui/iconGrid/' + char, 'preload'))), true, 150, 150);
else
loadGraphic(Paths.image('blank', 'shared'));

Expand Down
4 changes: 0 additions & 4 deletions source/OptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ class OptionsMenu extends MusicBeatState
+ "\n" + (FlxG.save.data.disableFps ? LanguageManager.getTextString('option_enable_fps') : LanguageManager.getTextString('option_disable_fps'))
+ "\n" + (CompatTool.save.data.compatMode ? LanguageManager.getTextString('option_enable_compat') : LanguageManager.getTextString('option_disable_compat'))
+ "\n" + (FlxG.save.data.modchart ? 'Mod Chart OFF' : 'Mod Chart ON')
#if debug
+ "\n" + (FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF')
#end
);

grpControls = new FlxTypedGroup<Alphabet>();
Expand Down Expand Up @@ -205,11 +203,9 @@ class OptionsMenu extends MusicBeatState
case 12:
if (!awaitingExploitation) FlxG.save.data.modchart = !FlxG.save.data.modchart;
updateGroupControls(FlxG.save.data.modchart ? 'Mod Chart OFF' : 'Mod Chart ON', 12, 'Vertical');
#if debug
case 13:
FlxG.save.data.botplay = !FlxG.save.data.botplay;
updateGroupControls(FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF', 13, 'Vertical');
#end
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions source/Paths.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package;

import flixel.graphics.FlxGraphic;
import openfl.display.BitmapData;
import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames;
import openfl.utils.AssetType;
Expand Down Expand Up @@ -154,6 +156,10 @@ class Paths
return TitleState.modFolder + '/data/charts/$key.json';
}

inline static public function customImage(key:String)
{
return (FlxGraphic.fromBitmapData(BitmapData.fromFile(TitleState.modFolder + '/${key}.png')));
}
inline static public function music(key:String, ?library:String)
{
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
Expand Down
4 changes: 2 additions & 2 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,9 @@ class PlayState extends MusicBeatState
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
eyesoreson = FlxG.save.data.eyesores;
#if debug

botPlay = FlxG.save.data.botplay;
#end

modchartoption = !FlxG.save.data.modchart;

sicks = 0;
Expand Down

0 comments on commit 19432de

Please sign in to comment.