Skip to content

Commit

Permalink
starting to work on player data imports
Browse files Browse the repository at this point in the history
  • Loading branch information
KoloInDaCrib committed Nov 10, 2024
1 parent 701adfb commit 097a507
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion source/funkin/ui/debug/char/CharCreatorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -69,6 +70,8 @@ typedef WizardGenerateParams =
var freeplayFile:WizardFile;
@:optional
var importedCharacter:String;
@:optional
var importedPlayerData:String;
}

typedef WizardFile =
Expand Down
7 changes: 7 additions & 0 deletions source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

3 comments on commit 097a507

@KoloInDaCrib
Copy link
Owner Author

@KoloInDaCrib KoloInDaCrib commented on 097a507 Nov 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious but should we merge anysad's PR in the Funkin Repo for the pixel icon metadata? Since we're doing pixel icon related stuff and all. It could fit nicely as one of the dialogs in the gameplay page

Also during some testing I've noticed that characters whose healthIcon data isnt specified just load the default face icon now which is not something they used to do. Perhaps it's something due to migration? Either way we might have to update character data jsons

@anysad
Copy link

@anysad anysad commented on 097a507 Nov 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must've been the migration process since while working on 0.4.1 version, it worked perfectly fine for me

@KoloInDaCrib
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah dw it's just some small changes lemz made to the CharacterRegistry when making changes to the MultiSparrow characters that have since been fixed in this fork

Please sign in to comment.