Skip to content

Commit 7900d00

Browse files
committed
make charSelect chars support render types, scripts and json anims
1 parent 81f81f2 commit 7900d00

File tree

6 files changed

+407
-336
lines changed

6 files changed

+407
-336
lines changed

source/funkin/data/freeplay/player/PlayerData.hx

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package funkin.data.freeplay.player;
22

33
import funkin.data.animation.AnimationData;
4+
import funkin.graphics.FunkinSprite;
45

56
@:nullSafety
67
class PlayerData
@@ -297,12 +298,83 @@ class PlayerCharSelectData
297298
*/
298299
@:optional
299300
public var gf:PlayerCharSelectGFData;
301+
302+
/**
303+
* The optional data for the character bopping in the character select menu.
304+
*/
305+
@:optional
306+
public var characterData:PlayerCharSelectCharacterData;
307+
308+
/**
309+
* Return the array of default animations for the player character. Used for backwards compatibility with older versions.
310+
*/
311+
public function getDefaultAnimations(gf:Bool = false):Array<AnimationData>
312+
{
313+
if (gf)
314+
{
315+
return [
316+
{
317+
name: "idle",
318+
prefix: "idle",
319+
looped: true
320+
},
321+
{
322+
name: "confirm",
323+
prefix: "confirm",
324+
looped: true
325+
},
326+
{
327+
name: "cancel",
328+
prefix: "deselect"
329+
}
330+
];
331+
}
332+
333+
return [
334+
{
335+
name: "idle",
336+
prefix: "idle",
337+
looped: true
338+
},
339+
{
340+
name: "unlock",
341+
prefix: "unlock"
342+
},
343+
{
344+
name: "slideOut-unlock",
345+
prefix: "death"
346+
},
347+
{
348+
name: "confirm",
349+
prefix: "select"
350+
},
351+
{
352+
name: "cancel",
353+
prefix: "deselect"
354+
},
355+
{
356+
name: "cancel-hold",
357+
prefix: "deselect loop start"
358+
},
359+
{
360+
name: "locked",
361+
prefix: "cannot select"
362+
},
363+
{
364+
name: "slideOut",
365+
prefix: "slideout"
366+
},
367+
{
368+
name: "slideIn",
369+
prefix: "slidein"
370+
}
371+
];
372+
}
300373
}
301374

302375
typedef PlayerCharSelectGFData =
303376
{
304-
@:optional
305-
public var assetPath:String;
377+
> PlayerCharSelectCharacterData,
306378

307379
@:optional
308380
public var animInfoPath:String;
@@ -312,6 +384,34 @@ typedef PlayerCharSelectGFData =
312384
public var visualizer:Bool;
313385
}
314386

387+
typedef PlayerCharSelectCharacterData =
388+
{
389+
/**
390+
* Optional asset path for the character.
391+
*/
392+
@:optional
393+
var assetPath:String;
394+
395+
/**
396+
* Optional render type for the character. Defaults to using texture atlases.
397+
*/
398+
@:optional
399+
@:default("animateatlas")
400+
var renderType:String;
401+
402+
/**
403+
* Optional script class to use for the character, allowing for custom behavior.
404+
*/
405+
@:optional
406+
var scriptClass:String;
407+
408+
/**
409+
* Optional list of animations for the character.
410+
*/
411+
@:optional
412+
var animations:Array<AnimationData>;
413+
}
414+
315415
typedef PlayerResultsData =
316416
{
317417
var music:PlayerResultsMusicData;

source/funkin/ui/charSelect/CharSelectGF.hx

Lines changed: 0 additions & 137 deletions
This file was deleted.

source/funkin/ui/charSelect/CharSelectPlayer.hx

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)