TaggedEngine/chartconverter.lua
entar c5320c46de ACTUAL proper XML support (pushing the missing modules)
All the remaining stuff from silly billy is now removed
Changed the camera tween time
2025-08-11 08:14:10 +07:00

80 lines
2.1 KiB
Lua

local js = require("modules.json")
local files = require("modules.files")
local conductor = require("modules.conductor")
local chartstr = files.read_file("black2blue.json")
local chart = js.parse(chartstr).song
local crochet = conductor:calculateCrochet(chart.bpm) / 4
local vchart = {
scrollSpeed = {hard = chart.speed},
notes = {
hard = {
}
},
events = {
{ t = 0, e = "FocusCamera", v = { char = 0 } },
}
}
local musthit = false
for index, section in next, chart.notes do
if section.mustHitSection ~= musthit then
musthit = section.mustHitSection
vchart.events[#vchart.events+1] = {
t = crochet * (index * 16),
e = "FocusCamera",
v = {
char = musthit and 0 or 1
}
}
end
for index, note in next, section.sectionNotes do
if not musthit then -- In v-slice musthit is always on so we just swap back the directions
if note[2] <= 3 then
note[2] = note[2] + 4
else
note[2] = note[2] - 4
end
-- print(note[2])
end
local direction = note[2]
vchart.notes.hard[#vchart.notes.hard+1] = {
t = note[1],
d = direction,
l = note[3]
}
end
end
for index, event in next, chart.events do
for index, actualevent in next, event[2] do
if actualevent[1] == "Play Animation" then
local newEvent = {
e = "PlayAnimation",
t = event[1],
v = {
char = actualevent[3],
anim = actualevent[2]
}
}
elseif actualevent[1] == "Set Default Zoom" then
local newEvent = {
e = "ZoomCamera",
t = event[1],
v = {
zoom = actualevent[2],
duration = actualevent[3]
}
}
end
end
end
files.write_file("output-chart.json", js.stringify(vchart))