Skip to content

Commit

Permalink
CNE Chart Generation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuglioIsStupid committed May 15, 2024
1 parent 7233dae commit d350abf
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
73 changes: 73 additions & 0 deletions src/love/modules/deprecated.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,77 @@ function weeks.legacyGenerateNotes(self, chart)
table.sort(enemyNotes[i], function(a, b) return a.y < b.y end)
table.sort(boyfriendNotes[i], function(a, b) return a.y < b.y end)
end
end

-- I gotta rename this file..,..,.
-- This file will just have spare functions,.,.
function weeks.cneGenerateNotes(self, chart, metadata)
local chart = json.decode(love.filesystem.read(chart))
local metadata = json.decode(love.filesystem.read(metadata))

bpm = metadata.bpm or 100
beatHandler.setBPM(bpm)

if settings.customScrollSpeed == 1 then
speed = chart.screenSpeed or 1
else
speed = settings.customScrollSpeed
end

local sprites = {
sprites.leftArrow,
sprites.downArrow,
sprites.upArrow,
sprites.rightArrow
}

for _, strumline in ipairs(chart.strumLines) do
-- strumline.visible, if its nil, set to true
if strumline.visible == nil then strumline.visible = true end
if (strumline.type ~= 0 and strumline.type ~= 1) or not strumline.visible then goto continue end
local enemyNote = strumline.type == 0
local notesTable = enemyNote and enemyNotes or boyfriendNotes
local arrowsTable = enemyNote and enemyArrows or boyfriendArrows

for _, note in ipairs(strumline.notes) do
local time = note.time
local noteType = note.id
local noteVer = note.type == 0 and "normal" or note.type or "normal"
local holdLength = note.sLen or 0

if noteVer == "Hurt Note" or noteType < 0 then goto continue end

local id = noteType % 4 + 1

local noteObject = sprites[id]()
noteObject.col = id
noteObject.y = -400 + time * 0.6 * speed
noteObject.ver = noteVer
noteObject.time = time
noteObject:animate("on")

if settings.downscroll then noteObject.sizeY = -1 end

noteObject.x = arrowsTable[id].x

table.insert(notesTable[id], noteObject)
if holdLength > 0 then
for k = 71 / speed, holdLength, 71 / speed do
local holdNote = sprites[id]()
holdNote.col = id
holdNote.y = -400 + (time + k) * 0.6 * speed
holdNote.ver = noteVer
holdNote.time = time + k
holdNote:animate("hold")

holdNote.x = arrowsTable[id].x
table.insert(notesTable[id], holdNote)
end

notesTable[id][#notesTable[id]]:animate("end")
end
end

::continue::
end
end
2 changes: 0 additions & 2 deletions src/love/weeks/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ return {
song = 1
difficulty = ""

enemyIcon:animate("boyfriend (pixel)", false)

self:load()
end,

Expand Down
2 changes: 0 additions & 2 deletions src/love/weeks/tutorial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ return {
enemy.x, enemy.y = 30, -90
boyfriend.x, boyfriend.y = 260, 100

enemyIcon:animate("girlfriend", false)

self:load()
end,

Expand Down

0 comments on commit d350abf

Please sign in to comment.