Skip to content

Commit

Permalink
use characterrendertype
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 3, 2024
1 parent 3ad47ad commit 13eef9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class CharCreatorGameplayPage extends CharCreatorDefaultPage

switch (prop.animType)
{
case 'packer':
case CharacterRenderType.Packer:
for (anim in prop.animations)
{
spr.animation.add(anim.name, anim.frameIndices, anim.frameRate, anim.looped, anim.flipX, anim.flipY);
Expand Down
13 changes: 7 additions & 6 deletions source/funkin/ui/debug/char/util/GhostUtil.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package funkin.ui.debug.char.util;

import funkin.data.character.CharacterData;
import funkin.data.character.CharacterData.CharacterRenderType;
import funkin.ui.debug.char.animate.CharSelectAtlasSprite;
import funkin.ui.debug.char.pages.CharCreatorGameplayPage;
import flixel.graphics.frames.FlxAtlasFrames;
Expand All @@ -19,7 +20,7 @@ class GhostUtil

switch (player.renderType)
{
case "sparrow" | "multisparrow":
case CharacterRenderType.Sparrow | CharacterRenderType.MultiSparrow:
if (ghost.generatedParams.files.length < 2) return; // img and data

var combinedFrames = null;
Expand All @@ -34,14 +35,14 @@ class GhostUtil
}
ghost.frames = combinedFrames;

case "packer":
case CharacterRenderType.Packer:
if (ghost.generatedParams.files.length != 2) return; // img and data

var img = BitmapData.fromBytes(ghost.generatedParams.files[0].bytes);
var data = ghost.generatedParams.files[1].bytes.toString();
ghost.frames = FlxAtlasFrames.fromSpriteSheetPacker(img, data);

case "atlas": // todo
case CharacterRenderType.AnimateAtlas: // todo
if (ghost.generatedParams.files.length != 1) return; // zip file with all the data
ghost.atlasCharacter = new CharSelectAtlasSprite(0, 0, ghost.generatedParams.files[0].bytes);

Expand Down Expand Up @@ -77,7 +78,7 @@ class GhostUtil

switch (data.renderType)
{
case "sparrow" | "multisparrow":
case CharacterRenderType.Sparrow | CharacterRenderType.MultiSparrow:
var combinedFrames = null;
for (i => assetPath in data.assetPaths)
{
Expand All @@ -87,10 +88,10 @@ class GhostUtil
}
ghost.frames = combinedFrames;

case "packer":
case CharacterRenderType.Packer:
ghost.frames = Paths.getPackerAtlas(data.assetPaths[0]);

case "animateatlas": // TODO, gonna think of smth
case CharacterRenderType.AnimateAtlas: // TODO, gonna think of smth

default: // nuthin
}
Expand Down

0 comments on commit 13eef9c

Please sign in to comment.