Merge branch 'main' of https://github.com/YoshiCrafter29/CodenameEngine-Dev
This commit is contained in:
+2
-5
@@ -131,8 +131,8 @@
|
||||
<!-- Comment this out to disable video cutscene support, in case of compilation errors. !-->
|
||||
<define name="VIDEO_CUTSCENES" unless="web || linux || hl || mac" />
|
||||
|
||||
<!-- Comment this out to disable build number on FPS -->
|
||||
<!-- <define name="SHOW_BUILD_ON_FPS" /> -->
|
||||
<!-- Comment this out to disable commit number on FPS -->
|
||||
<define name="SHOW_BUILD_ON_FPS" />
|
||||
|
||||
|
||||
<haxedef name="VIDEO_CUTSCENES" if="VIDEO_CUTSCENES" />
|
||||
@@ -168,9 +168,6 @@
|
||||
<haxeflag name="--macro" value="exclude('funkin.updating')" unless="UPDATE_CHECKING"/>
|
||||
<haxeflag name="--macro" value="exclude('funkin.multitasking')" unless="ALLOW_MULTITASKING"/>
|
||||
|
||||
<!-- MACROS & DOCUMENTATION !-->
|
||||
<haxeflag name="--macro" value="funkin.macros.BuildCounterMacro.getBuildNumber()" />
|
||||
|
||||
<haxedef name="HXCPP_CHECK_POINTER" if="release" />
|
||||
<haxedef name="HXCPP_STACK_LINE" if="release" />
|
||||
<haxedef name="HXCPP_DEBUG_LINK" if="release" />
|
||||
|
||||
@@ -45,7 +45,7 @@ class Charter extends UIState {
|
||||
* ACTUAL CHART DATA
|
||||
*/
|
||||
public var strumLines:Array<ChartStrumLine> = [];
|
||||
public var notesGroup:FlxTypedGroup<CharterNote> = new FlxTypedGroup<CharterNote>();
|
||||
public var notesGroup:CharterNoteGroup = new CharterNoteGroup();
|
||||
|
||||
/**
|
||||
* CAMERAS
|
||||
@@ -308,12 +308,13 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
selectionBoxEnabled = false;
|
||||
} else if (selection.length > 0) {
|
||||
selection = [];
|
||||
} else {
|
||||
// place note
|
||||
var note = new CharterNote();
|
||||
note.updatePos(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Std.int(mousePos.y / 40), Std.int(mousePos.x / 40), 0, 0);
|
||||
notesGroup.add(note);
|
||||
selection = [note];
|
||||
addToUndo(CPlaceNote(note));
|
||||
}
|
||||
}
|
||||
@@ -362,6 +363,7 @@ class Charter extends UIState {
|
||||
for(n in notes) {
|
||||
notesGroup.remove(n, true);
|
||||
n.kill();
|
||||
selection.remove(n);
|
||||
}
|
||||
case CDeleteNotes(notes):
|
||||
for(n in notes) {
|
||||
@@ -372,6 +374,7 @@ class Charter extends UIState {
|
||||
case CPlaceNote(note):
|
||||
notesGroup.remove(note, true);
|
||||
note.kill();
|
||||
selection.remove(note);
|
||||
}
|
||||
if (v != null)
|
||||
redoList.insert(0, v);
|
||||
@@ -460,8 +463,12 @@ class Charter extends UIState {
|
||||
|
||||
Conductor.songPosition = FlxMath.bound(Conductor.songPosition, 0, FlxG.sound.music.length);
|
||||
|
||||
conductorFollowerSpr.y = curStepFloat * 40;
|
||||
charterCamera.scroll.set(conductorFollowerSpr.x + conductorFollowerSpr.scale.x - (FlxG.width / 2), conductorFollowerSpr.y - (FlxG.height * 0.25));
|
||||
if (FlxG.sound.music.playing) {
|
||||
conductorFollowerSpr.y = curStepFloat * 40;
|
||||
} else {
|
||||
conductorFollowerSpr.y = lerp(conductorFollowerSpr.y, curStepFloat * 40, 1/3);
|
||||
}
|
||||
charterCamera.scroll.set(conductorFollowerSpr.x + conductorFollowerSpr.scale.x - (FlxG.width / 2), conductorFollowerSpr.y - (FlxG.height * 0.5));
|
||||
}
|
||||
|
||||
|
||||
@@ -475,16 +482,20 @@ class Charter extends UIState {
|
||||
selection = deleteNotes(selection);
|
||||
}
|
||||
function _playback_back(_) {
|
||||
if (FlxG.sound.music.playing) return;
|
||||
Conductor.songPosition -= Conductor.beatsPerMesure * __crochet;
|
||||
}
|
||||
function _playback_forward(_) {
|
||||
if (FlxG.sound.music.playing) return;
|
||||
Conductor.songPosition += Conductor.beatsPerMesure * __crochet;
|
||||
}
|
||||
function _playback_start(_) {
|
||||
if (FlxG.sound.music.playing) return;
|
||||
Conductor.songPosition = 0;
|
||||
}
|
||||
function _playback_end(_) {
|
||||
Conductor.songPosition = FlxG.sound.music.time;
|
||||
if (FlxG.sound.music.playing) return;
|
||||
Conductor.songPosition = FlxG.sound.music.length;
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ class CharterNote extends UISprite {
|
||||
angle = 45; // green-red inbetween
|
||||
|
||||
cursor = BUTTON;
|
||||
|
||||
moves = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +67,8 @@ class CharterNote extends UISprite {
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
super.update(elapsed);
|
||||
|
||||
colorTransform.redMultiplier = colorTransform.greenMultiplier = colorTransform.blueMultiplier = selected ? 0.75 : 1;
|
||||
colorTransform.redOffset = colorTransform.greenOffset = selected ? 96 : 0;
|
||||
colorTransform.blueOffset = selected ? 168 : 0;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import funkin.system.Conductor;
|
||||
|
||||
class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
var __loopSprite:CharterNote;
|
||||
var i:Int = 0;
|
||||
var max:Float = 0;
|
||||
var __currentlyLooping:Bool = false;
|
||||
|
||||
public override function forEach(noteFunc:CharterNote->Void, recursive:Bool = false) {
|
||||
i = 0;
|
||||
__loopSprite = null;
|
||||
|
||||
max = FlxG.height / 70 / camera.zoom;
|
||||
|
||||
var oldCur = __currentlyLooping;
|
||||
__currentlyLooping = true;
|
||||
|
||||
while(i < length) {
|
||||
__loopSprite = members[i];
|
||||
if (__loopSprite == null || !__loopSprite.exists) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (Math.abs(__loopSprite.step - Conductor.curStepFloat) < max)
|
||||
noteFunc(__loopSprite);
|
||||
i++;
|
||||
}
|
||||
__currentlyLooping = oldCur;
|
||||
}
|
||||
|
||||
public override function draw() {
|
||||
@:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras;
|
||||
@:privateAccess if (cameras != null) FlxCamera._defaultCameras = cameras;
|
||||
|
||||
forEach((n) -> n.draw());
|
||||
|
||||
@:privateAccess FlxCamera._defaultCameras = oldDefaultCameras;
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
@:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras;
|
||||
@:privateAccess if (cameras != null) FlxCamera._defaultCameras = cameras;
|
||||
|
||||
forEach((n) -> n.update(elapsed));
|
||||
|
||||
@:privateAccess FlxCamera._defaultCameras = oldDefaultCameras;
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,8 @@ class Note extends FlxSprite
|
||||
public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0)
|
||||
{
|
||||
super();
|
||||
|
||||
moves = false;
|
||||
|
||||
this.prevNote = strumLine.notes.members.last();
|
||||
this.noteTypeID = noteData.type.getDefault(0);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package funkin.macros;
|
||||
|
||||
#if !macro
|
||||
import haxe.macro.Expr.Field;
|
||||
import haxe.macro.Context;
|
||||
#end
|
||||
#if sys
|
||||
import sys.io.File;
|
||||
#end
|
||||
|
||||
/**
|
||||
* Macro that loads the current build number from `buildnumber.txt`, then make it available as an integer.
|
||||
*
|
||||
* `buildnumber.txt` is automatically incremented when the engine is launched with `lime test windows`.
|
||||
*/
|
||||
class BuildCounterMacro {
|
||||
/**
|
||||
* Returns the obtained build number.
|
||||
*/
|
||||
public static macro function getBuildNumber():haxe.macro.Expr.ExprOf<Int> {
|
||||
#if !display
|
||||
var buildNum:Int = Std.parseInt(File.getContent("buildnumber.txt"));
|
||||
return macro $v{buildNum+1};
|
||||
#else
|
||||
return macro $v{0};
|
||||
#end
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,56 @@
|
||||
package funkin.macros;
|
||||
|
||||
#if macro
|
||||
import sys.io.Process;
|
||||
#end
|
||||
|
||||
class GitCommitMacro {
|
||||
public static macro function getCommitNumber() {
|
||||
/**
|
||||
* Returns the current commit number
|
||||
*/
|
||||
public static var commitNumber(get, null):Int;
|
||||
/**
|
||||
* Returns the current commit hash
|
||||
*/
|
||||
public static var commitHash(get, null):String;
|
||||
|
||||
// GETTERS
|
||||
#if REGION
|
||||
private static inline function get_commitNumber()
|
||||
return __getCommitNumber();
|
||||
|
||||
private static inline function get_commitHash()
|
||||
return __getCommitHash();
|
||||
#end
|
||||
|
||||
// INTERNAL MACROS
|
||||
#if REGION
|
||||
private static macro function __getCommitHash() {
|
||||
#if display
|
||||
return macro $v{"-"};
|
||||
#else
|
||||
try {
|
||||
var proc = new Process('git', ['rev-parse', '--short', 'HEAD'], false);
|
||||
proc.exitCode(true);
|
||||
|
||||
return macro $v{proc.stdout.readLine()};
|
||||
} catch(e) {}
|
||||
return macro $v{"-"}
|
||||
#end
|
||||
}
|
||||
|
||||
private static macro function __getCommitNumber() {
|
||||
#if display
|
||||
return macro $v{0};
|
||||
#else
|
||||
var proc = new Process('git', ['rev-list', 'HEAD', '--count'], false);
|
||||
proc.exitCode(true);
|
||||
try {
|
||||
var proc = new Process('git', ['rev-list', 'HEAD', '--count'], false);
|
||||
proc.exitCode(true);
|
||||
|
||||
var c = Std.parseInt(proc.stdout.readLine());
|
||||
trace(c);
|
||||
return macro $v{c};
|
||||
return macro $v{Std.parseInt(proc.stdout.readLine())};
|
||||
} catch(e) {}
|
||||
return macro $v{0}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -76,7 +76,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')}\nBeta: Build ${funkin.macros.BuildCounterMacro.getBuildNumber()}\n[TAB] Open Mods menu\n');
|
||||
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nBeta: Commit ${funkin.macros.GitCommitMacro.commitNumber} (${funkin.macros.GitCommitMacro.commitHash})\n[TAB] Open Mods menu\n');
|
||||
versionShit.scrollFactor.set();
|
||||
versionShit.y -= versionShit.height;
|
||||
add(versionShit);
|
||||
|
||||
@@ -51,7 +51,8 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
|
||||
// Engine related stuff
|
||||
"engine" => {
|
||||
build: funkin.macros.BuildCounterMacro.getBuildNumber(),
|
||||
commit: funkin.macros.GitCommitMacro.commitNumber,
|
||||
build: 2675, // 2675 being the last build num before it was removed
|
||||
name: "Codename Engine"
|
||||
},
|
||||
"ModState" => funkin.scripting.ModState,
|
||||
@@ -91,7 +92,8 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
return [
|
||||
"CODENAME_ENGINE" => true,
|
||||
"CODENAME_VER" => Application.current.meta.get('version'),
|
||||
"CODENAME_BUILD" => funkin.macros.BuildCounterMacro.getBuildNumber(),
|
||||
"CODENAME_BUILD" => 2675,
|
||||
"CODENAME_COMMIT" => funkin.macros.GitCommitMacro.commitNumber,
|
||||
"desktop" => #if desktop true #else false #end,
|
||||
"windows" => #if windows true #else false #end,
|
||||
"hl" => #if hl true #else false #end,
|
||||
|
||||
@@ -178,10 +178,6 @@ class Main extends Sprite
|
||||
Paths.assetsTree.addLibrary(ModsFolder.loadLibraryFromFolder('assets', './${pathBack}assets/', true));
|
||||
Paths.assetsTree.sourceLibsAmount++;
|
||||
#end
|
||||
|
||||
var buildNum:Int = Std.parseInt(File.getContent('./${pathBack}buildnumber.txt'));
|
||||
buildNum++;
|
||||
File.saveContent('./${pathBack}buildnumber.txt', Std.string(buildNum));
|
||||
} else {
|
||||
#if USE_ADAPTED_ASSETS
|
||||
Paths.assetsTree.addLibrary(ModsFolder.loadLibraryFromFolder('assets', './assets/', true));
|
||||
|
||||
@@ -3,6 +3,7 @@ package funkin.system.framerate;
|
||||
import openfl.text.TextFormat;
|
||||
import openfl.display.Sprite;
|
||||
import openfl.text.TextField;
|
||||
import funkin.macros.GitCommitMacro;
|
||||
|
||||
class CodenameBuildField extends TextField {
|
||||
public function new() {
|
||||
@@ -10,6 +11,6 @@ class CodenameBuildField extends TextField {
|
||||
defaultTextFormat = Framerate.textFormat;
|
||||
autoSize = LEFT;
|
||||
multiline = wordWrap = false;
|
||||
text = 'Codename Engine Beta\nBuild ${funkin.macros.BuildCounterMacro.getBuildNumber()}';
|
||||
text = 'Codename Engine Beta\nCommit ${GitCommitMacro.commitNumber} (${GitCommitMacro.commitHash})';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user