Skip to content

Commit

Permalink
cleanuop
Browse files Browse the repository at this point in the history
  • Loading branch information
CrusherNotDrip committed Jan 23, 2025
1 parent e1960dd commit 7d2eadc
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/funkin/api/DiscordRPC.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import sys.thread.Thread;
class DiscordRPC
{
/**
* Your application's Client ID.
* Your application's Client ID.
* This determines what people actually see on Discord!
*
*
* You need to run `restart()` first for this to take effect!
*
*
*
*
* Example:
* ```haxe
* "1323401168705163355"
Expand Down Expand Up @@ -246,7 +246,7 @@ class DiscordRPC

/**
* Resets all the values back to either null or 0 (if it's a number type.)
* @param alsoClearConfig Should the config values also be cleared?
* @param alsoClearConfig Should the config values also be cleared?
*/
public static function clearValues(?alsoClearConfig:Bool = false):Void
{
Expand Down
4 changes: 4 additions & 0 deletions src/funkin/states/ui/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class FreeplayState extends FunkinState
}
}

/**
* Changes the current song selection.
* @param index How much to change it by?
*/
public function changeSelection(?index:Int = 0):Void
{
curSelected += index;
Expand Down
8 changes: 5 additions & 3 deletions src/funkin/states/ui/MenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import funkin.substates.FunkinTransition;

class MenuState extends FunkinState
{
public static var curSelected:Int = 0;
static var curSelected:Int = 0;

// Maybe move to config file?
public static var menuItems:Array<MenuItem> = [
// TODO: maybe move to config file?
static final menuItems:Array<MenuItem> = [
{
id: 'storymode',
name: 'Story Mode',
Expand Down Expand Up @@ -146,7 +146,9 @@ class MenuState extends FunkinState
SystemUtil.openURL(menuItems[curSelected].website);

if (menuItems[curSelected].classToSwitch != null)
{
FlxG.switchState(menuItems[curSelected].classToSwitch);
}
else
{
FunkinTransition.skipNextTransitionIn = true;
Expand Down
7 changes: 6 additions & 1 deletion src/funkin/states/ui/StoryState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class StoryState extends FunkinState

grpWeekItems.members[curSelected].startFlashing();

new FlxTimer().start(1, (_) ->
new FlxTimer().start(1, (tmr:FlxTimer) ->
{
// TODO: Change this to PlayState
FlxG.switchState(MenuState.new);
Expand Down Expand Up @@ -149,6 +149,11 @@ class StoryState extends FunkinState

var danced:Bool = false;

/**
* Auto determines the current idle animation that should be played.
* @param spr The sprite to check the animations from.
* @return idle or danceLeft/Right.
*/
public function getIdleAnimationForSprite(spr:FlxSprite):String
{
if (spr.animation.exists('danceLeft') || spr.animation.exists('danceRight'))
Expand Down
1 change: 1 addition & 0 deletions src/funkin/structures/ObjectStructure.hx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef ObjectStructure =
var ?scrollFactor:PointStructure;
}

// TODO: when we make a custom json parser, make it so you can use an array or dis
typedef PointStructure =
{
@:optional
Expand Down
12 changes: 6 additions & 6 deletions src/funkin/structures/SaveStructure.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ typedef ProgressStructure =
typedef HighscoreStructures =
{
/**
* Story Mode Highscores.
*
* Story Mode Highscores.
*
* Week ID => Highscore.
*/
var storyMode:Map<String, Int>;

/**
* Freeplay Highscores.
*
* Freeplay Highscores.
*
* Song ID => Highscore.
*/
var freeplay:Map<String, Int>;
Expand All @@ -69,14 +69,14 @@ typedef HighscoreStructures =
typedef OptionStructure =
{
/**
* Max FPS
* The frames-per-second that the game will run at.
*/
var fps:Int;

/**
* If the FPS Counter is visible.
*/
var fpsCounter:Bool;
var showFps:Bool;

/**
* Should the game be fullscreen?
Expand Down
14 changes: 14 additions & 0 deletions src/funkin/util/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,24 @@ class Controls implements IFlxDestroyable
];
}

/**
* The current mapping for the controls.
*/
public var mappings:ControlMappings;

/**
* The gamepad thats connected to the users system.
*/
public var gamepad:FlxGamepad = null;

/**
* A signal that gets sent once a bind gets pressed.
*/
public var pressed:FlxSignal;

/**
* A signal that gets sent once a bind gets released.
*/
public var released:FlxSignal;

public function new(mappings:ControlMappings, gamepad:FlxGamepad)
Expand Down
12 changes: 12 additions & 0 deletions src/funkin/util/FunkinSpriteUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import funkin.structures.ObjectStructure;

class FunkinSpriteUtil
{
/**
* Creates a new `FunkinSprite` from a `ObjectStructure`.
* @param spriteToUse The `FunkinSprite` object to apply this to.
* @param structure The structure data to use when applying it.
* @return Freshly made `FunkinSprite`.
*/
public static function createFromStructure(?spriteToUse:FunkinSprite = null, structure:ObjectStructure):FunkinSprite
{
if (structure == null)
Expand Down Expand Up @@ -44,6 +50,12 @@ class FunkinSpriteUtil
return sprite;
}

/**
* Adds animations to a `FunkinSprite` from a array with `AnimationArrayStructure`'s.
* @param sprite The `FunkinSprite` to apply this to.
* @param structure The array filled with `AnimationArrayStructure`. to create animations from.
* @return `FunkinSprite` with animations added.
*/
public static function addAnimationsFromStructure(sprite:FunkinSprite, structure:Array<AnimationArrayStructure>):FunkinSprite
{
if (sprite == null || structure == null)
Expand Down

0 comments on commit 7d2eadc

Please sign in to comment.