Skip to content

Time Signature Change Functionality #397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8da7faa
time Signature functionality wip
SenDoesStuff Oct 6, 2024
4269a64
Remove the code for the backwards compat
NeeEoo Oct 7, 2024
638030e
Small optimizations + cleanup
NeeEoo Oct 9, 2024
85c38b2
Made the time signature event icon dynamic
NeeEoo Oct 12, 2024
f115a6c
Small change
NeeEoo Oct 12, 2024
ea493cd
Merge branch 'main' into pr/397
NeeEoo Oct 15, 2024
cc83f26
chart parsing fix maybe? Changing stepsPerBeat to an Int
SenDoesStuff Oct 17, 2024
2cde5bf
Compiling fixes
NeeEoo Oct 17, 2024
3d99cd1
Continuous Tempo Change
Raltyro Oct 23, 2024
56076db
Fix Conductor
Raltyro Oct 23, 2024
daf3179
Conductor Final Continuous Tempo & Time Sigs
Raltyro Oct 25, 2024
b1e1ab1
Make Conductor relies on steps instead
Raltyro Oct 25, 2024
79dae9e
Added Event UI Scripts
NeeEoo Nov 19, 2024
2236a15
Merge branch 'main' into pr/397
NeeEoo Nov 22, 2024
2d97bc5
Merge pull request #1 from Raltyro/Continuous-Tempo-Change
SenDoesStuff Dec 25, 2024
dca41cf
Merge pull request #1 from Raltyro/Continuous-Tempo-Change
Raltyro Dec 25, 2024
7322871
Merge branch 'Time-Signature-Changes' of https://github.com/NyxieFemb…
SenDoesStuff Jan 10, 2025
0e47728
Merge branch 'main' into pr/397
NeeEoo Jan 10, 2025
2f6207b
fixing beat and measure lines with time sig changes (#2)
TheZoroForce240 Jan 11, 2025
3e13bf5
Continuous bpm change event, lots of other reworks and fixes
TheZoroForce240 Feb 1, 2025
cb4a956
Negative and decimal support for event numbers (and some other changes)
TheZoroForce240 Feb 2, 2025
0f0d116
more event icon stuff
TheZoroForce240 Feb 2, 2025
3250cdb
I think this should be everything?
SenDoesStuff Feb 18, 2025
8e88a15
fixed chart parsing
SenDoesStuff Feb 19, 2025
2227231
Merge branch 'main' into pr/397
NexIsDumb Feb 25, 2025
c81aaf1
Optimize images
NeeEoo Mar 1, 2025
098f747
working on fixing camera beat timing, only issue is time sig changes …
SenDoesStuff Mar 4, 2025
68f3a64
Allow setting the positions for events
NeeEoo Mar 8, 2025
d43c043
bandaid fix for beat 0 i guess
SenDoesStuff Mar 8, 2025
26ac15e
added a comment
SenDoesStuff Mar 8, 2025
62d57df
i might be stupoid
SenDoesStuff Mar 9, 2025
733428e
i hope i put this in the right place
SenDoesStuff Mar 10, 2025
04fcedf
Revert "i hope i put this in the right place"
SenDoesStuff Mar 10, 2025
20efd35
MathUtil
SenDoesStuff Mar 13, 2025
4d7288b
variable name change
SenDoesStuff May 5, 2025
a741578
Merge branch 'main' into pr/397
NeeEoo May 5, 2025
2b087dc
floating point fixes (hopefully)
TheZoroForce240 May 5, 2025
a6fcb3d
Merge branch 'main' into pr/397
NeeEoo Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ latest/windows/haxe/
pages/
docs/doc.xml
mods/*
!mods/readme.txt
!mods/readme.txt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/editors/charter/event-icons/BPM Change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="arrow-down.png">
<SubTexture name="tail" x="0" y="0" width="8" height="3"/>
<SubTexture name="segment" x="0" y="3" width="8" height="1"/>
<SubTexture name="arrow" x="0" y="6" width="8" height="6"/>
</TextureAtlas>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion source/funkin/backend/chart/ChartData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef ChartMetaData = {
public var ?bpm:Float;
public var ?displayName:String;
public var ?beatsPerMeasure:Float;
public var ?stepsPerBeat:Float;
public var ?stepsPerBeat:Int;
public var ?needsVoices:Bool;
public var ?icon:String;
public var ?color:Dynamic;
Expand Down
27 changes: 20 additions & 7 deletions source/funkin/backend/chart/EventsData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import funkin.backend.assets.Paths;
using StringTools;

class EventsData {
public static var defaultEventsList:Array<String> = ["HScript Call", "Camera Movement", "Add Camera Zoom", "Camera Modulo Change", "Camera Flash", "BPM Change", "Scroll Speed Change", "Alt Animation Toggle", "Play Animation"];
public static var defaultEventsList:Array<String> = ["HScript Call", "Camera Movement", "Add Camera Zoom", "Camera Modulo Change", "Camera Flash", "BPM Change", "Continuous BPM Change", "Time Signature Change", "Scroll Speed Change", "Alt Animation Toggle", "Play Animation"];
public static var defaultEventsParams:Map<String, Array<EventParamInfo>> = [
"HScript Call" => [
{name: "Function Name", type: TString, defValue: "myFunc"},
Expand All @@ -31,7 +31,9 @@ class EventsData {
{name: "Time (Steps)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4},
{name: "Camera", type: TDropDown(['camGame', 'camHUD']), defValue: "camHUD"}
],
"BPM Change" => [{name: "Target BPM", type: TFloat(1.00, null, 0.001, 3), defValue: 100}],
"BPM Change" => [{name: "Target BPM", type: TFloat(1.00, 9999, 0.001, 3), defValue: 100}],
"Continuous BPM Change" => [{name: "Target BPM", type: TFloat(1.00, 9999, 0.001, 3), defValue: 100}, {name: "Time (steps)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4}],
"Time Signature Change" => [{name: "Target Beat Count", type: TFloat(1), defValue: 4}, {name: "Target Step Count", type: TFloat(1), defValue: 4}],
"Scroll Speed Change" => [
{name: "Tween Speed?", type: TBool, defValue: true},
{name: "New Speed", type: TFloat(0.01, 99, 0.01, 2), defValue: 1.},
Expand All @@ -48,7 +50,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"}, {name: "Is forced?", type: TBool, defValue: true}],
"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();
Expand All @@ -75,11 +77,12 @@ class EventsData {
hscriptParser.allowJSON = hscriptParser.allowMetadata = false;

for (file in Paths.getFolderContent('data/events/', true, BOTH)) {
if (Path.extension(file) != "json" && Path.extension(file) != "pack") continue;
var eventName:String = Path.withoutExtension(Path.withoutDirectory(file));
var ext = Path.extension(file);
if (ext != "json" && ext != "pack") continue;
var eventName:String = CoolUtil.getFilename(file);
var fileTxt:String = Assets.getText(file);

if (Path.extension(file) == "pack") {
if (ext == "pack") {
var arr = fileTxt.split("________PACKSEP________");
eventName = Path.withoutExtension(arr[0]);
fileTxt = arr[2];
Expand All @@ -97,7 +100,14 @@ class EventsData {
var finalParams:Array<EventParamInfo> = [];
for (paramData in cast(data.params, Array<Dynamic>)) {
try {
finalParams.push({name: paramData.name, type: hscriptInterp.expr(hscriptParser.parseString(paramData.type)), defValue: paramData.defaultValue});
finalParams.push({
name: paramData.name,
type: hscriptInterp.expr(hscriptParser.parseString(paramData.type)),
defValue: paramData.defaultValue,

x: paramData.x,
y: paramData.y
});
} catch (e) {trace('Error parsing event param ${paramData.name} - ${eventName}: $e'); finalParams.push(null);}
}
eventsParams.set(eventName, finalParams);
Expand All @@ -117,6 +127,9 @@ typedef EventParamInfo = {
var name:String;
var type:EventParamType;
var defValue:Dynamic;

@:optional var x:Float;
@:optional var y:Float;
}

enum EventParamType {
Expand Down
17 changes: 16 additions & 1 deletion source/funkin/backend/chart/FNFLegacyParser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ class FNFLegacyParser {
continue; // Yoshi Engine charts crash fix
}

var newBeatsPerMeasure:Float = section.sectionBeats != null ? section.sectionBeats : data.beatsPerMeasure.getDefault(4); // Default to 4 if sectionBeats is null or undefined (oops :3)

if (newBeatsPerMeasure != beatsPerMeasure) {
beatsPerMeasure = newBeatsPerMeasure;

result.events.push({
time: curTime,
name: "Time Signature Change",
params: [newBeatsPerMeasure, 4]
});
}

if (camFocusedBF != (camFocusedBF = section.mustHitSection)) {
result.events.push({
time: curTime,
Expand Down Expand Up @@ -174,7 +186,8 @@ class FNFLegacyParser {
mustHitSection: notes[section-1] != null ? notes[section-1].mustHitSection : false,
bpm: notes[section-1] != null ? notes[section-1].bpm : chart.meta.bpm,
changeBPM: false,
altAnim: notes[section-1] != null ? notes[section-1].altAnim : false
altAnim: notes[section-1] != null ? notes[section-1].altAnim : false,
sectionBeats: notes[section-1] != null ? notes[section-1].sectionBeats : chart.meta.beatsPerMeasure.getDefault(4)
};

var sectionEndTime:Float = Conductor.getTimeForStep(Conductor.getMeasureLength() * (section+1));
Expand All @@ -188,6 +201,8 @@ class FNFLegacyParser {
case "BPM Change":
baseSection.changeBPM = true;
baseSection.bpm = event.params[0];
case "Time Signature Change":
baseSection.sectionBeats = event.params[0];
}
}
notes[section] = baseSection;
Expand Down
Loading