Skip to content

Commit

Permalink
Credit Systen is now FULLY WORKING YAYYYYY
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed May 18, 2024
1 parent 19432de commit 9d557fe
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mods/test/data/charts/test-cred.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Kawai Sprite & MtH
Kawai Sprite & MtH:funkinHeading:The testiest song on the planet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mods/test/images/songHeadings/funkinHeading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 29 additions & 3 deletions source/CreditsPopUp.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CreditsPopUp extends FlxSpriteGroup
public var funnyIcon:FlxSprite;
var iconOffset:Float;
var curHeading:SongHeading;
var custom:Array<String>;

public function new(x:Float, y:Float)
{
Expand All @@ -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())
{
Expand Down Expand Up @@ -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<String> = custom[i].split(':');
Expand Down Expand Up @@ -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<String> = custom[i].split(':');
headingPath = {path: 'songHeadings/' + data[1], antiAliasing: false, iconOffset: 0};
}
}
switch (PlayState.SONG.song.toLowerCase())
{
Expand All @@ -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<String> = custom[i].split(':');
headingPath = {path: 'songHeadings/' + data[1], antiAliasing: false, iconOffset: 0};
}
}
if (PlayState.recursedStaticWeek)
{
Expand All @@ -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
{
Expand All @@ -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();

Expand Down
20 changes: 19 additions & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class PlayState extends MusicBeatState
var songPosBar:FlxBar;
var songPosBG:FlxSprite;

var custom:Array<String>;

var bfNoteCamOffset:Array<Float> = new Array<Float>();
var dadNoteCamOffset:Array<Float> = new Array<Float>();

Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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':
Expand All @@ -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<String> = custom[i].split(':');
if (data[2] == null) {
credits = '';
} else {
credits = data[2];
}
}
} else {
credits = '';
}
}
var creditsText:Bool = credits != '';
var textYPos:Float = healthBarBG.y + 50;
Expand Down

0 comments on commit 9d557fe

Please sign in to comment.