diff --git a/source/funkin/ui/debug/char/CharCreatorState.hx b/source/funkin/ui/debug/char/CharCreatorState.hx index ab6ec5d07f..03286710ab 100644 --- a/source/funkin/ui/debug/char/CharCreatorState.hx +++ b/source/funkin/ui/debug/char/CharCreatorState.hx @@ -147,7 +147,7 @@ class CharCreatorState extends UIState function switchToPage(page:CharCreatorPage):Void { - if (selectedPage == pages[page]) return; + if (selectedPage == pages[page] || pages[page] == null) return; for (box in [bottomBarLeftBox, bottomBarMiddleBox, bottomBarRightBox, menubarMenuSettings]) { diff --git a/source/funkin/ui/debug/char/components/wizard/ImportDataDialog.hx b/source/funkin/ui/debug/char/components/wizard/ImportDataDialog.hx index b3cced9826..c59692e85a 100644 --- a/source/funkin/ui/debug/char/components/wizard/ImportDataDialog.hx +++ b/source/funkin/ui/debug/char/components/wizard/ImportDataDialog.hx @@ -85,7 +85,9 @@ class ImportDataDialog extends DefaultWizardDialog if (params.importedCharacter != null) params.renderType = CharacterRegistry.parseCharacterData(params.importedCharacter)?.renderType ?? Sparrow; - // same shit for the player, though it's currently not my priority + if (params.generatePlayerData && importPlayerCheck.selected) params.importedPlayerData = selectedPlayer; + else + params.importedPlayerData = null; return true; } diff --git a/source/funkin/ui/debug/char/handlers/CharCreatorStartupWizard.hx b/source/funkin/ui/debug/char/handlers/CharCreatorStartupWizard.hx index f7669142af..a4f759403c 100644 --- a/source/funkin/ui/debug/char/handlers/CharCreatorStartupWizard.hx +++ b/source/funkin/ui/debug/char/handlers/CharCreatorStartupWizard.hx @@ -23,7 +23,8 @@ class CharCreatorStartupWizard files: [], charSelectFile: null, freeplayFile: null, - importedCharacter: null + importedCharacter: null, + importedPlayerData: null } public static function startWizard(state:CharCreatorState, onComplete:WizardGenerateParams->Void = null, onQuit:Void->Void = null) @@ -69,6 +70,8 @@ typedef WizardGenerateParams = var freeplayFile:WizardFile; @:optional var importedCharacter:String; + @:optional + var importedPlayerData:String; } typedef WizardFile = diff --git a/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx b/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx index e77ac0f434..020ff44db6 100644 --- a/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx +++ b/source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx @@ -43,6 +43,13 @@ class CharCreatorSelectPage extends CharCreatorDefaultPage loadAvailableCharacters(); this.data = data; + if (data.importedPlayerData != null) + { + var playuh = PlayerRegistry.instance.fetchEntry(data.importedPlayerData); + if (playuh == null) return; + + selectedIndexData = playuh.getCharSelectData()?.position ?? 0; + } // copied sum code LOL initBackground(); diff --git a/source/funkin/ui/debug/char/pages/subpages/CharSelectIndexSubPage.hx b/source/funkin/ui/debug/char/pages/subpages/CharSelectIndexSubPage.hx index b95b812791..a3c103fb51 100644 --- a/source/funkin/ui/debug/char/pages/subpages/CharSelectIndexSubPage.hx +++ b/source/funkin/ui/debug/char/pages/subpages/CharSelectIndexSubPage.hx @@ -183,26 +183,23 @@ class CharSelectIndexSubPage extends FlxSpriteGroup // less visible or something like that for (i in 0...9) { + var temp:PixelatedIcon = new PixelatedIcon(0, 0); + temp.setCharacter("bf"); + temp.shader = new funkin.graphics.shaders.Grayscale(); + temp.ID = 1; + if (parentPage.availableChars.exists(i)) { - var path:String = parentPage.availableChars.get(i); - var temp:PixelatedIcon = new PixelatedIcon(0, 0); - temp.setCharacter(path); - temp.setGraphicSize(128, 128); - temp.updateHitbox(); - temp.ID = 0; - grpIcons.add(temp); - } - else - { - var temp:PixelatedIcon = new PixelatedIcon(0, 0); - temp.setCharacter("bf"); - temp.setGraphicSize(128, 128); - temp.updateHitbox(); - temp.shader = new funkin.graphics.shaders.Grayscale(); - temp.ID = 1; - grpIcons.add(temp); + temp.setCharacter(parentPage.availableChars.get(i)); + temp.shader = null; + + if (parentPage.data.importedPlayerData != parentPage.availableChars[i]) temp.ID = 0; } + + temp.setGraphicSize(128, 128); + temp.updateHitbox(); + + grpIcons.add(temp); } updateIconPositions();