Made menu states save the selection, added module.processNote, added module.noteHit
This commit is contained in:
parent
b4334d8653
commit
da1fa7dc08
@ -1,3 +1,5 @@
|
||||
local curIndex = 1
|
||||
|
||||
return function()
|
||||
local state = {}
|
||||
|
||||
@ -53,7 +55,6 @@ return function()
|
||||
local start = false
|
||||
|
||||
local curSong = songs[1]
|
||||
local curIndex = 1
|
||||
local evilCurIndex = 1
|
||||
local curDiffList = songs[1].difficulties
|
||||
|
||||
|
@ -11,6 +11,9 @@ local defaultSettings = { -- The way its in the JSON
|
||||
},
|
||||
Offset = 0
|
||||
}
|
||||
|
||||
local currentOption = 1
|
||||
|
||||
return function()
|
||||
---@class StateClass
|
||||
local state = {}
|
||||
@ -27,7 +30,6 @@ return function()
|
||||
options = "optionsstate",
|
||||
credits = "creditsstate"
|
||||
}
|
||||
local currentOption = 1
|
||||
local evilCurrentOption = 1
|
||||
local optionSprites = {}
|
||||
local moving = false
|
||||
|
@ -43,13 +43,13 @@ for index, category in next, categoryList do
|
||||
end
|
||||
end
|
||||
|
||||
local currentSetting = 1
|
||||
|
||||
return function()
|
||||
---@class StateClass
|
||||
local state = {}
|
||||
|
||||
local getting
|
||||
|
||||
local currentSetting = 1
|
||||
local evilCurrentSetting = 1
|
||||
|
||||
local settings = json.parse(files.read_file(data.."/Settings.json"))
|
||||
|
@ -1,16 +1,66 @@
|
||||
-- I NEED THEM IMPORTS
|
||||
local conductor = require("modules.conductor")
|
||||
local json = require("modules.json")
|
||||
local files = require("modules.files")
|
||||
local socket = require("socket")
|
||||
local logging = require("modules.logging")
|
||||
-- I NEED THEM IMPORTS
|
||||
|
||||
local rankWindows = {
|
||||
{
|
||||
rating = "sick",
|
||||
hitWindow = 45,
|
||||
spawnSplash = true,
|
||||
score = 300
|
||||
},
|
||||
{
|
||||
rating = "good",
|
||||
hitWindow = 90,
|
||||
spawnSplash = false,
|
||||
score = 200
|
||||
},
|
||||
{
|
||||
rating = "bad",
|
||||
hitWindow = 135,
|
||||
spawnSplash = false,
|
||||
score = 100
|
||||
},
|
||||
{
|
||||
rating = "shit",
|
||||
hitWindow = 300,
|
||||
spawnSplash = false,
|
||||
score = 50
|
||||
}
|
||||
}
|
||||
|
||||
local receptorOffsets = {
|
||||
arrow = Vector2(0, 0),
|
||||
press = Vector2(-5, -5),
|
||||
confirm = Vector2(35, 35)
|
||||
}
|
||||
local receptorAnims = {
|
||||
"arrow",
|
||||
"arrow",
|
||||
"arrow",
|
||||
"arrow"
|
||||
}
|
||||
|
||||
local directions = {
|
||||
"LEFT",
|
||||
"DOWN",
|
||||
"UP",
|
||||
"RIGHT"
|
||||
}
|
||||
local colors = {
|
||||
"purple",
|
||||
"blue",
|
||||
"green",
|
||||
"red"
|
||||
}
|
||||
|
||||
local function state(songName, songDifficulty, show)
|
||||
local state = {} -- Returns needed functions for the state to work after loading it properly
|
||||
|
||||
-- I NEED THEM IMPORTS
|
||||
|
||||
|
||||
local conductor = require("modules.conductor")
|
||||
local json = require("modules.json")
|
||||
local files = require("modules.files")
|
||||
local socket = require("socket")
|
||||
local logging = require("modules.logging")
|
||||
-- I NEED THEM IMPORTS
|
||||
|
||||
local startTime = 0
|
||||
|
||||
local chartString
|
||||
@ -96,58 +146,6 @@ local function state(songName, songDifficulty, show)
|
||||
local totalScore = 0 -- If you hit ALL sicks
|
||||
local accuracy = 100
|
||||
|
||||
local rankWindows = {
|
||||
{
|
||||
rating = "sick",
|
||||
hitWindow = 45,
|
||||
spawnSplash = true,
|
||||
score = 300
|
||||
},
|
||||
{
|
||||
rating = "good",
|
||||
hitWindow = 90,
|
||||
spawnSplash = false,
|
||||
score = 200
|
||||
},
|
||||
{
|
||||
rating = "bad",
|
||||
hitWindow = 135,
|
||||
spawnSplash = false,
|
||||
score = 100
|
||||
},
|
||||
{
|
||||
rating = "shit",
|
||||
hitWindow = 300,
|
||||
spawnSplash = false,
|
||||
score = 50
|
||||
}
|
||||
}
|
||||
|
||||
local receptorOffsets = {
|
||||
arrow = Vector2(0, 0),
|
||||
press = Vector2(-5, -5),
|
||||
confirm = Vector2(35, 35)
|
||||
}
|
||||
local receptorAnims = {
|
||||
"arrow",
|
||||
"arrow",
|
||||
"arrow",
|
||||
"arrow"
|
||||
}
|
||||
|
||||
local directions = {
|
||||
"LEFT",
|
||||
"DOWN",
|
||||
"UP",
|
||||
"RIGHT"
|
||||
}
|
||||
local colors = {
|
||||
"purple",
|
||||
"blue",
|
||||
"green",
|
||||
"red"
|
||||
}
|
||||
|
||||
local font = love.graphics.newFont("fonts/Phantomuff.ttf", 15)
|
||||
local biggerFont = love.graphics.newFont("fonts/Phantomuff.ttf", 30)
|
||||
local evenBiggerFont = love.graphics.newFont("fonts/FridayNightFunkin-Regular.ttf", 50)
|
||||
@ -367,6 +365,12 @@ local function state(songName, songDifficulty, show)
|
||||
end
|
||||
end
|
||||
if closestNote then
|
||||
for index, module in next, modules do
|
||||
if module.noteHit then
|
||||
module.noteHit(closestNote)
|
||||
end
|
||||
end
|
||||
|
||||
local rating = conductor:judgeNote(rankWindows, math.abs(closestNote.position - elapsed))
|
||||
|
||||
if rating.spawnSplash then
|
||||
@ -464,7 +468,7 @@ local function state(songName, songDifficulty, show)
|
||||
|
||||
elapsed = 0
|
||||
|
||||
playing = true --countdown now
|
||||
playing = true --We can truly play now
|
||||
|
||||
startTime = socket.gettime()
|
||||
cdLength = 0
|
||||
@ -902,6 +906,11 @@ local function state(songName, songDifficulty, show)
|
||||
if note[2] >= 0 then
|
||||
local newNote = Note(note, section.mustHitSection)
|
||||
unspawnedNotes[#unspawnedNotes+1] = newNote
|
||||
for index, module in next, modules do
|
||||
if module.processNote then
|
||||
module.processNote(newNote)
|
||||
end
|
||||
end
|
||||
|
||||
if note[3] > 0 then
|
||||
local length = math.floor(note[3] / conductor.stepCrochet)
|
||||
@ -910,6 +919,11 @@ local function state(songName, songDifficulty, show)
|
||||
local newHold = Note({note[1] + i * conductor.stepCrochet, note[2], note[3], note[4]}, section.mustHitSection, true)
|
||||
|
||||
unspawnedHoldNotes[#unspawnedHoldNotes+1] = newHold
|
||||
for index, module in next, modules do
|
||||
if module.processNote then
|
||||
module.processNote(newHold)
|
||||
end
|
||||
end
|
||||
end
|
||||
local newHold = Note({note[1] + length * conductor.stepCrochet, note[2], note[3], note[4]}, section.mustHitSection, true, true)
|
||||
unspawnedHoldNotes[#unspawnedHoldNotes+1] = newHold
|
||||
@ -918,6 +932,11 @@ local function state(songName, songDifficulty, show)
|
||||
newHold.flipY = true
|
||||
end
|
||||
newHold.speed = speed
|
||||
for index, module in next, modules do
|
||||
if module.processNote then
|
||||
module.processNote(newHold)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local newEvent = {
|
||||
|
@ -72,6 +72,9 @@ return function()
|
||||
end
|
||||
|
||||
function state.update(dt)
|
||||
for index, shader in next, weekShaders do
|
||||
shader:send("cur", orderIndex)
|
||||
end
|
||||
render.updateSprites(dt)
|
||||
|
||||
evilorderIndex = Lerp(evilorderIndex, orderIndex, .05)
|
||||
|
Loading…
x
Reference in New Issue
Block a user