Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Ne_Eo
2024-12-16 03:13:23 +01:00
12 changed files with 111 additions and 35 deletions
+3 -3
View File
@@ -41,9 +41,9 @@
- Reworked Lagless Credits Codename Engine's Contributors Menu
- New Credit Method for GitHub accounts (also lagless) in Mod Credits (First gets the data normally, if fails uses the ratelimited api)
- MANY OG GAME WEEK STUFF!! (still wip and softcoded and also many reworks by nex!)
- Senpai Cutscene got reworked! (https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/3b3f32fc-78d1-40fa-8398-776554cab1d6)
- Thorns got reworked with a cool chromatic aberration effect! (https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/73d9f7c5-1c9c-407e-baf0-e8e2c381ecbb)
- Winter Horrorland got reworked with a bloody vignette effect! (https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/1e10c3e2-32dc-4de2-b31a-d9d577d516da - https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/cad852c3-1ee2-409e-a70e-b3571ab5cf7b)
- Senpai Cutscene got reworked! (https://github.com/CodenameCrew/CodenameEngine/assets/87421482/3b3f32fc-78d1-40fa-8398-776554cab1d6)
- Thorns got reworked with a cool chromatic aberration effect! (https://github.com/CodenameCrew/CodenameEngine/assets/87421482/73d9f7c5-1c9c-407e-baf0-e8e2c381ecbb)
- Winter Horrorland got reworked with a bloody vignette effect! (https://github.com/CodenameCrew/CodenameEngine/assets/87421482/1e10c3e2-32dc-4de2-b31a-d9d577d516da - https://github.com/CodenameCrew/CodenameEngine/assets/87421482/cad852c3-1ee2-409e-a70e-b3571ab5cf7b)
- SMALLER BUT STILL COOL
- Ability to set Controls.hx variables (Being able to block inputs or even trigger them (needs to be in an if statement))
- You can now easily check if a cutscene was played (by default is disabled and makes it auto play or not; Check startCutscene() code for more details in PlayState)
+4 -4
View File
@@ -11,8 +11,8 @@ Also, the command `.\cne test` uses the source assets folder instead of the expo
## Codename Engine
Codename Engine is a new Friday Night Funkin' Engine aimed at simplifying modding, along with extensibility and ease of use.<br>
### Before making issues or need help with something, check our website [HERE](https://fnf-cne-devs.github.io/) (it contains a wiki of how to mod with EXAMPLES, an api, lists of mods made with Codename Engine and more)!!!
Codename Engine is a new Friday Night Funkin' Engine aimed at simplifying modding, along with extensiblity and ease of use.<br>
### Before making issues or need help with something, check our website [HERE](https://codename-engine.com/) (it contains a wiki of how to mod with EXAMPLES, an api, lists of mods made with Codename Engine and more)!!!
#### The Engine includes many new features, as seen [here](FEATURES.md)<br>
#### Wanna see the new features added in the most recent update? Click [here](PATCHNOTES.md)<br>
@@ -69,8 +69,8 @@ If you don't have a github account please go onto https://fnf-cne-devs.github.io
- Download and play the engine with its mods and modpacks
- Mod and fork the engine (without using it for illicit purposes)
- Contribute to the engine (for example through *Pull Requests*, *Issues*, etc)
- Create a sub engine with Codename Engine as **TEMPLATE** with **CREDITS** (for example leaving the *credits menu submenu with the GitHub contributors* and putting the *[main devs](https://github.com/FNF-CNE-Devs)* in a *README* specifying that it's a *sub engine from Codename Engine*)
- Release executable mods that use Codename Engine as source (Specifying that uses Codename Engine by for example the same way written above this)
- Create a sub engine with Codename Engine as **TEMPLATE** with **CREDITS** (for example leaving the *credits menu submenu with the GitHub contributors* and putting the *[main devs](https://github.com/CodenameCrew)* in a *README* specifying that it's a *sub engine from Codename Engine*)
- Release excutable mods that use Codename Engine as source (Specifing that uses Codename Engine by for example the same way written above this)
- Release modpacks
### You can't:
+1 -1
View File
@@ -5,4 +5,4 @@ lime build windows --haxeflag="--macro include('scripting')" --haxeflag="-xml do
echo art
echo Generated the api xml file at docs/doc.xml
echo Please put this in FNF-CNE-Devs.github.io/api-generator/api/doc.xml
echo Please put this in codename-website/api-generator/api/doc.xml
+55 -14
View File
@@ -2,14 +2,23 @@ package funkin.backend;
import flixel.FlxState;
import flixel.tweens.FlxTween;
import funkin.backend.scripting.Script;
import funkin.backend.scripting.events.CancellableEvent;
import funkin.backend.scripting.events.TransitionCreationEvent;
import funkin.backend.utils.FunkinParentDisabler;
class MusicBeatTransition extends MusicBeatSubstate {
public static var script:String = "";
public var transitionScript:Script;
var nextFrameSkip:Bool = false;
public var transitionTween:FlxTween = null;
public var transitionCamera:FlxCamera;
public var newState:FlxState;
public var transOut:Bool = false;
public var allowSkip:Bool = true;
public var blackSpr:FlxSprite;
public var transitionSprite:FunkinSprite;
@@ -20,16 +29,30 @@ class MusicBeatTransition extends MusicBeatSubstate {
public override function create() {
if (newState != null)
add(new FunkinParentDisabler(true));
add(new FunkinParentDisabler(true, false));
transitionCamera = new FlxCamera();
transitionCamera.bgColor = 0;
FlxG.cameras.add(transitionCamera, false);
cameras = [transitionCamera];
var out = newState != null;
blackSpr = new FlxSprite(0, out ? -transitionCamera.height : transitionCamera.height).makeGraphic(1, 1, -1);
transitionScript = Script.create(Paths.script(script));
transitionScript.setParent(this);
transitionScript.load();
var event = EventManager.get(TransitionCreationEvent).recycle(newState != null, newState);
transitionScript.call('create', [event]);
transOut = event.transOut;
newState = event.newState;
if (event.cancelled) {
super.create();
return;
}
blackSpr = new FlxSprite(0, transOut ? -transitionCamera.height : transitionCamera.height).makeGraphic(1, 1, -1);
blackSpr.scale.set(transitionCamera.width, transitionCamera.height);
blackSpr.color = 0xFF000000;
blackSpr.updateHitbox();
@@ -43,7 +66,7 @@ class MusicBeatTransition extends MusicBeatSubstate {
} else {
transitionSprite.screenCenter();
}
transitionCamera.flipY = !out;
transitionCamera.flipY = !transOut;
add(transitionSprite);
transitionCamera.scroll.y = transitionCamera.height;
@@ -55,41 +78,59 @@ class MusicBeatTransition extends MusicBeatSubstate {
});
super.create();
transitionScript.call('postCreate', [event]);
}
public override function update(elapsed:Float) {
transitionScript.call('update', [elapsed]);
super.update(elapsed);
if (nextFrameSkip) {
finish();
return;
var event = new CancellableEvent();
transitionScript.call('onSkip', [event]);
if (!event.cancelled) {
finish();
return;
}
}
if (!parent.persistentUpdate && FlxG.keys.pressed.SHIFT) {
if (allowSkip && !parent.persistentUpdate && FlxG.keys.pressed.SHIFT) {
// skip
if (newState != null) {
nextFrameSkip = true;
parent.persistentDraw = false;
} else {
finish();
var event = new CancellableEvent();
transitionScript.call('onSkip', [event]);
if (!event.cancelled) {
finish();
}
}
}
transitionScript.call('postUpdate', [elapsed]);
}
public function finish() {
var event = new CancellableEvent();
transitionScript.call('onFinish', [event]);
if (event.cancelled) return;
if (newState != null)
FlxG.switchState(newState);
close();
transitionScript.call('onPostFinish');
}
public override function destroy() {
if (transitionTween != null)
transitionTween.cancel();
transitionScript.call('destroy');
if (transitionTween != null) transitionTween.cancel();
transitionTween = FlxDestroyUtil.destroy(transitionTween);
if (newState == null && FlxG.cameras.list.contains(transitionCamera))
FlxG.cameras.remove(transitionCamera);
else
transitionCamera.bgColor = 0xFF000000;
if (newState == null && FlxG.cameras.list.contains(transitionCamera)) FlxG.cameras.remove(transitionCamera);
else transitionCamera.bgColor = 0xFF000000;
transitionScript.destroy();
super.destroy();
}
}
@@ -0,0 +1,18 @@
package funkin.backend.scripting.events;
import flixel.FlxState;
/**
* CANCEL this event to prevent default behaviour!
*/
final class TransitionCreationEvent extends CancellableEvent {
/**
* If the transition is going out into another state
*/
public var transOut:Bool;
/**
* The state that is about to be loaded (only on trans out)
*/
public var newState:FlxState;
}
+1 -1
View File
@@ -21,7 +21,7 @@ class Flags {
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v${Application.current.meta.get('version')}';
public static var REPO_NAME:String = "CodenameEngine";
public static var REPO_OWNER:String = "FNF-CNE-Devs";
public static var REPO_OWNER:String = "CodenameCrew";
public static var REPO_URL:String = 'https://github.com/$REPO_OWNER/$REPO_NAME';
// make this empty once you guys are done with the project.
@@ -58,6 +58,7 @@ class MainState extends FlxState {
Flags.load();
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx
MusicBeatTransition.script = "";
Main.refreshAssets();
DiscordUtil.init();
EventsData.reloadEvents();
+1 -1
View File
@@ -4,7 +4,7 @@ import flixel.sound.FlxSound;
import lime.media.AudioBuffer;
// Thank you yosh :DDD -lunar
// (https://github.com/FNF-CNE-Devs/YoshiCrafterEngine/blob/main/source/WaveformSprite.hx)
// (https://github.com/CodenameCrew/YoshiCrafterEngine/blob/main/source/WaveformSprite.hx)
class AudioAnalyzer {
public var buffer:AudioBuffer;
var __peakByte:Float = 0;
@@ -19,9 +19,11 @@ class FunkinParentDisabler extends FlxBasic {
var __timers:Array<FlxTimer>;
var __sounds:Array<FlxSound>;
var __replaceUponDestroy:Bool;
public function new(replaceUponDestroy:Bool = false) {
var __restoreUponDestroy:Bool;
public function new(replaceUponDestroy:Bool = false, restoreUponDestroy:Bool = true) {
super();
__replaceUponDestroy = replaceUponDestroy;
__restoreUponDestroy = restoreUponDestroy;
@:privateAccess {
// tweens
__tweens = FlxTween.globalManager._tweens.copy();
@@ -53,6 +55,11 @@ class FunkinParentDisabler extends FlxBasic {
public override function destroy() {
super.destroy();
@:privateAccess {
if (!__restoreUponDestroy) {
for(t in __tweens) { t.cancel(); t.destroy(); };
for(t in __timers) { t.cancel(); t.destroy(); };
return;
}
if (__replaceUponDestroy) {
FlxTween.globalManager._tweens = __tweens;
FlxTimer.globalManager._timers = __timers;
+3 -3
View File
@@ -147,8 +147,8 @@ class XMLUtil {
var graphicSizey:Null<Int> = Std.parseInt(node.att.graphicSizey);
if (graphicSizey.isNotNull()) spr.setGraphicSize(0, graphicSizey);
}
if (node.has.flipX && node.att.flipX == "true") spr.flipX = true;
if (node.has.flipX) spr.flipX = node.att.flipX == "true";
if (node.has.flipY) spr.flipY = node.att.flipY == "true";
if (node.has.updateHitbox && node.att.updateHitbox == "true") spr.updateHitbox();
if (node.has.zoomfactor)
@@ -400,4 +400,4 @@ typedef BeatAnim = {
interface IXMLEvents {
public function onPropertySet(property:String, value:Dynamic):Void;
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
public function updatePos(step:Float, id:Int, susLength:Float = 0, ?type:Int = 0, ?strumLine:CharterStrumline = null) {
this.step = step;
this.id = id;
this.susLength = susLength;
this.susLength = Math.max(susLength, 0);
this.type = type;
if (strumLine != null) this.strumLine = strumLine;
+15 -6
View File
@@ -119,12 +119,21 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
case END:
position = label.text.length;
case V:
if (modifier == KeyModifier.LEFT_CTRL || modifier == KeyModifier.RIGHT_CTRL) {
// paste
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
if (data != null)
onTextInput(data);
}
// Hey lj here, fixed copying because before we checked if the modifier was left or right ctrl
// but somehow it gave a int outside of the KeyModifier's range :sob:
// apparently there is a boolean that just checks for you. yw :D
// if we are not holding ctrl, ignore
if (!modifier.ctrlKey) return;
// we pasting
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
if (data != null) onTextInput(data);
case C:
// if we are not holding ctrl, ignore
if (!modifier.ctrlKey) return;
// copying
Clipboard.generalClipboard.setData(TEXT_FORMAT, label.text);
default:
// nothing
}