Merge remote-tracking branch 'master/main'

This commit is contained in:
⍚~Nex
2024-06-01 00:44:14 +02:00
13 changed files with 48 additions and 19 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ jobs:
build:
name: Mac OS Build
permissions: write-all
runs-on: macos-latest
runs-on: macos-13
steps:
- name: Pulling the new commit
uses: actions/checkout@v2
+4
View File
@@ -11,4 +11,8 @@
<anim name="singDOWNmiss" anim="BF NOTE DOWN MISS" fps="24" loop="false" x="-11" y="-19"/>
<anim name="hey" anim="BF HEY" fps="24" loop="false" x="7" y="4"/>
<anim name="scared" anim="BF idle shaking" fps="24" loop="true" x="-4" y="0"/>
<anim name="hit" anim="BF hit" fps="24" loop="false" x="13" y="19"/>
<anim name="pre-attack" anim="bf pre attack" fps="24" loop="false" x="-47" y="-36"/>
<anim name="attack" anim="boyfriend attack" fps="24" loop="false" x="289" y="270"/>
<anim name="dodge" anim="boyfriend dodge" fps="24" loop="false" x="-7" y="-15"/>
</character>
+1
View File
@@ -1 +1,2 @@
function onNoteHit(event) if (event.noteType == "Alt Anim Note") event.animSuffix = "-alt";
function onPlayerMiss(event) if (event.noteType == "Alt Anim Note") event.animSuffix = "-alt";
+1
View File
@@ -1 +1,2 @@
function onNoteHit(event) if (event.noteType == "No Anim Note") event.animCancelled = true;
function onPlayerMiss(event) if (event.noteType == "No Anim Note") event.animCancelled = true;
+1 -1
View File
@@ -48,7 +48,7 @@ class EventsData {
}
],
"Alt Animation Toggle" => [{name: "Enable On Sing Poses", type: TBool, defValue: true}, {name: "Enable On Idle", type: TBool, defValue: true}, {name: "Strumline", type: TStrumLine, defValue: 0}],
"Play Animation" => [{name: "Character", type: TStrumLine, defValue: 0}, {name: "Animation", type: TString, defValue: "animation"}],
"Play Animation" => [{name: "Character", type: TStrumLine, defValue: 0}, {name: "Animation", type: TString, defValue: "animation"}, {name: "Is forced?", type: TBool, defValue: true}],
];
public static var eventsList:Array<String> = defaultEventsList.copy();
+7 -2
View File
@@ -428,13 +428,18 @@ class Controls extends FlxActionSet
return byName[name].check();
}
public function getKeyName(control:Control):String
{
return getDialogueName(getActionFromControl(control));
}
public function getDialogueName(action:FlxActionDigital):String
{
var input = action.inputs[0];
return switch input.device
{
case KEYBOARD: return '[${(input.inputID : FlxKey)}]';
case GAMEPAD: return '(${(input.inputID : FlxGamepadInputID)})';
case KEYBOARD: return '${(input.inputID : FlxKey)}';
case GAMEPAD: return '${(input.inputID : FlxGamepadInputID)}';
case device: throw 'unhandled device: $device';
}
}
@@ -41,7 +41,9 @@ class FunkinParentDisabler extends FlxBasic {
}
}
public override function update(elapsed:Float) {}
public override function update(elapsed:Float) {
@:privateAccess for(c in __cameras) c.updateFlashSpritePosition();
}
public override function draw() {}
public function reset() {
+19 -3
View File
@@ -56,6 +56,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
public var shadowFrame:CharacterShadowFrame;
public var idleSuffix:String = "";
public var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"]; // Not making these inline so theyre editable through scripts! - Nex
public inline function getCameraPosition()
{
var midpoint = getMidpoint();
@@ -68,12 +70,26 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
return new FlxPoint(event.x, event.y);
}
var singAnims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
public inline function getSingAnim(direction:Int, suffix:String = ""):String
{
return anims[direction % anims.length] + suffix;
}
/**
* Like `playSingAnimUnsafe` but checks if the character has the animation with the suffix part, otherwhise tries to play the animation without the suffix part.
*/
public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0)
{
var event = EventManager.get(DirectionAnimEvent).recycle(singAnims[direction % singAnims.length] + suffix, direction, suffix, Context, Reversed, Frame, Force);
var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force);
script.call("onPlaySingAnim", [event]);
if (!event.cancelled)
playSingAnimUnsafe(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame);
}
public function playSingAnimUnsafe(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0)
{
var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force);
script.call("onPlaySingAnimUnsafe", [event]);
if (!event.cancelled)
playAnim(event.animName, event.force, event.context, event.reversed, event.frame);
}
@@ -161,7 +177,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
// [ true ][ false ][ true ]
// [ false ][ true ][ true ]
// [ true ][ true ][ false ]
// bros provided evedince :skull:
// bros provided evidence :skull:
if (isPlayer != playerOffsets && switchAnims)
{
// character is flipped
+1 -1
View File
@@ -108,7 +108,7 @@ class GameOverSubstate extends MusicBeatSubstate
if (controls.BACK)
{
if (PlayState.chartingMode && Charter.undos.unsaved)
PlayState.instance.saveWarn(false);
game.saveWarn(false);
else {
PlayState.resetSongInfos();
if (Charter.instance != null) Charter.instance.__clearStatics();
+2 -2
View File
@@ -29,9 +29,9 @@ class StrumLine extends FlxTypedGroup<Strum> {
*/
public var onNoteUpdate:FlxTypedSignal<NoteUpdateEvent->Void> = new FlxTypedSignal<NoteUpdateEvent->Void>();
/**
* Signal that triggers whenever a note is being updated. Similar to onNoteUpdate, except strumline specific.
* Signal that triggers whenever a note is being deleted. Similar to onNoteDelete, except strumline specific.
* To add a listener, do
* `strumLine.onNoteUpdate.add(function(e:NoteUpdateEvent) {});`
* `strumLine.onNoteDelete.add(function(e:SimpleNoteEvent) {});`
*/
public var onNoteDelete:FlxTypedSignal<SimpleNoteEvent->Void> = new FlxTypedSignal<SimpleNoteEvent->Void>();
/**
+1 -1
View File
@@ -70,7 +70,7 @@ class MainMenuState extends MusicBeatState
FlxG.camera.follow(camFollow, null, 0.06);
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[TAB] Open Mods menu\n');
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n');
versionShit.y -= versionShit.height;
versionShit.scrollFactor.set();
add(versionShit);
+3 -3
View File
@@ -106,7 +106,7 @@ class PauseSubState extends MusicBeatSubstate
pauseScript.call("postCreate");
PlayState.instance.updateDiscordPresence();
game.updateDiscordPresence();
}
override function update(elapsed:Float)
@@ -146,7 +146,7 @@ class PauseSubState extends MusicBeatSubstate
close();
case "Restart Song":
parentDisabler.reset();
PlayState.instance.registerSmoothTransition();
game.registerSmoothTransition();
FlxG.resetState();
case "Change Controls":
persistentDraw = false;
@@ -157,7 +157,7 @@ class PauseSubState extends MusicBeatSubstate
FlxG.switchState(new funkin.editors.charter.Charter(PlayState.SONG.meta.name, PlayState.difficulty, false));
case "Exit to menu":
if (PlayState.chartingMode && Charter.undos.unsaved)
PlayState.instance.saveWarn(false);
game.saveWarn(false);
else {
PlayState.resetSongInfos();
if (Charter.instance != null) Charter.instance.__clearStatics();
+1 -1
View File
@@ -91,7 +91,7 @@ class Assets
@usage var bitmap = new Bitmap (Assets.getBitmapData ("image.png"));
@param id The ID or asset path for the bitmap
@param useCache (Optional) Whether to allow use of the asset cache (Default: true)
@param useCache Whenever the image should be immediately pushed to GPU.
@param pushToGPU Whenever the image should be immediately pushed to GPU.
@return A new BitmapData object
**/
public static function getBitmapData(id:String, useCache:Bool = true, pushToGPU:Bool = true):BitmapData