diff --git a/mods/test/data/charts/test-cred.txt b/mods/test/data/charts/test-cred.txt index 991afc2..f1a0378 100644 --- a/mods/test/data/charts/test-cred.txt +++ b/mods/test/data/charts/test-cred.txt @@ -1 +1 @@ -Kawai Sprite & MtH \ No newline at end of file +Kawai Sprite & MtH:funkinHeading:The testiest song on the planet \ No newline at end of file diff --git a/mods/test/images/songCreators/Kawai Sprite & MtH.png b/mods/test/images/songCreators/Kawai Sprite & MtH.png new file mode 100644 index 0000000..f089a07 Binary files /dev/null and b/mods/test/images/songCreators/Kawai Sprite & MtH.png differ diff --git a/mods/test/images/songHeadings/funkinHeading.png b/mods/test/images/songHeadings/funkinHeading.png new file mode 100644 index 0000000..d10a945 Binary files /dev/null and b/mods/test/images/songHeadings/funkinHeading.png differ diff --git a/source/CreditsPopUp.hx b/source/CreditsPopUp.hx index 344e0bb..350dcf6 100644 --- a/source/CreditsPopUp.hx +++ b/source/CreditsPopUp.hx @@ -24,6 +24,7 @@ class CreditsPopUp extends FlxSpriteGroup public var funnyIcon:FlxSprite; var iconOffset:Float; var curHeading:SongHeading; + var custom:Array; public function new(x:Float, y:Float) { @@ -33,6 +34,9 @@ class CreditsPopUp extends FlxSpriteGroup var songCreator:String = ''; var songCreatorIcon:String = ''; var headingPath:SongHeading = null; + if (FreeplayState.isaCustomSong) { + custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-cred.txt'); + } switch (PlayState.SONG.song.toLowerCase()) { @@ -63,7 +67,7 @@ class CreditsPopUp extends FlxSpriteGroup 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 = custom[i].split(':'); @@ -112,7 +116,12 @@ class CreditsPopUp extends FlxSpriteGroup animation: new Animation('expunged', 'Expunged', 24, true, [false, false]), iconOffset: 0}; default: if (FreeplayState.isaCustomSong) - headingPath = {path: 'songHeadings/daveHeading', antiAliasing: false, iconOffset: 0}; + + for (i in 0...custom.length) + { + var data:Array = custom[i].split(':'); + headingPath = {path: 'songHeadings/' + data[1], antiAliasing: false, iconOffset: 0}; + } } switch (PlayState.SONG.song.toLowerCase()) { @@ -122,7 +131,11 @@ class CreditsPopUp extends FlxSpriteGroup headingPath = {path: 'songHeadings/interdimensionalHeading', antiAliasing: false, iconOffset: 0}; default: if (FreeplayState.isaCustomSong) - headingPath = {path: 'songHeadings/daveHeading', antiAliasing: false, iconOffset: 0}; + for (i in 0...custom.length) + { + var data:Array = custom[i].split(':'); + headingPath = {path: 'songHeadings/' + data[1], antiAliasing: false, iconOffset: 0}; + } } if (PlayState.recursedStaticWeek) { @@ -134,7 +147,13 @@ class CreditsPopUp extends FlxSpriteGroup { if (headingPath.animation == null) { + if (FileSystem.exists('assets/shared/images/' + headingPath.path + '.png')) { + trace('yay'); bg.loadGraphic(Paths.image(headingPath.path)); + } else { + trace('nae'); + bg.loadGraphic(Paths.customImage('images/' + headingPath.path)); + } } else { @@ -147,9 +166,16 @@ class CreditsPopUp extends FlxSpriteGroup curHeading = headingPath; } createHeadingText(LanguageManager.getTextString("credits_songby") + ' ' + songCreator); + if (FileSystem.exists('assets/shared/images/songCreators/' + songCreatorIcon + '.png') || FileSystem.exists('assets/shared/images/songCreators/' + songCreator + '.png')) { funnyIcon = new FlxSprite(0, 0, Paths.image('songCreators/${songCreatorIcon != '' ? songCreatorIcon : songCreator}')); rescaleIcon(); add(funnyIcon); + } else { + funnyIcon = new FlxSprite(0, 0, Paths.customImage('images/songCreators/' + songCreator)); + rescaleIcon(); + add(funnyIcon); + } + rescaleBG(); diff --git a/source/PlayState.hx b/source/PlayState.hx index 2b141b6..2b27d17 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -296,6 +296,8 @@ class PlayState extends MusicBeatState var songPosBar:FlxBar; var songPosBG:FlxSprite; + var custom:Array; + var bfNoteCamOffset:Array = new Array(); var dadNoteCamOffset:Array = new Array(); @@ -462,6 +464,10 @@ class PlayState extends MusicBeatState resetShader(); + if (FreeplayState.isaCustomSong) { + custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-cred.txt'); + } + switch (SONG.song.toLowerCase()) { case 'exploitation': @@ -1297,7 +1303,7 @@ class PlayState extends MusicBeatState healthBar.createFilledBar(dad.barColor, boyfriend.barColor); insert(members.indexOf(healthBarBG), healthBar); - var credits:String; + var credits:String = ''; switch (SONG.song.toLowerCase()) { case 'supernovae': @@ -1315,7 +1321,19 @@ class PlayState extends MusicBeatState case 'kabunga': credits = LanguageManager.getTextString('kabunga_credit'); default: + if (FreeplayState.isaCustomSong) { + for (i in 0...custom.length) + { + var data:Array = custom[i].split(':'); + if (data[2] == null) { + credits = ''; + } else { + credits = data[2]; + } + } + } else { credits = ''; + } } var creditsText:Bool = credits != ''; var textYPos:Float = healthBarBG.y + 50;