more tests done, more functions, more progress

This commit is contained in:
jill 2020-12-31 01:48:36 +03:00
parent 316d667c93
commit 006e506901
Signed by: oat
GPG key ID: DD83A9617A252385

View file

@ -4,6 +4,7 @@
+ - tested, implemented, works fine
/ - implemented, but not tested
- - not implemented, not tested
? - needs more testing
-- c2l
@ -42,42 +43,45 @@
- beatobj:reverse([perc], mod)
-beatobk:velocitymap([perc], mod) -- kick(), but without aligning the ease at 0
-beatobj:temp([perc], mod) -- does a createTemp() version of the mod
/beatobj:addm([perc], mod) -- adds a mod value every beat, useful for offsets
+beatobj:addm([perc], mod) -- adds a mod value every beat, useful for offsets
-- perc: mod percentage, defaults to 100
-- mod: mod name
/beatobj:f(function(beat, i, off, len) end) -- for custom mods, runs a function for each beat
+beatobj:f(function(beat, i, off, len) end) -- for custom mods, runs a function for each beat
-- beat: guess
-- i: index of beat
-- off: offset, is equal to i%2*2-1
-- len: length until next beat
/beatobj:ease(ease) -- sets an ease function for trailing functions to use
+beatobj:ease(ease) -- sets an ease function for trailing functions to use
-- ease: ease function
/beatobj:align(a) -- aligns all ease functions with the snapping/fastest point at a
+beatobj:align(a) -- aligns all ease functions with the snapping/fastest point at a
-- a: snapping point
/beatobj:mixease(ease1, ease2, a) -- does :ease(mixEase(ease1, ease2, a)) and :align(a)
+beatobj:mixease(ease1, ease2, a) -- does :ease(mixEase(ease1, ease2, a)) and :align(a)
-- ease1: in easing function
-- ease2: out easing function
-- a: snapping point
/beatobj:setl(a) -- sets a to the length of each ease
+beatobj:setl(a) -- sets a to the length of each ease
-- a: length
+beatobj:add(beatobj) -- merges another beatobj table
-- beatobj: the merged beatobj
/beatobj:clone(beat) -- clones the beat timings from the first beat onward to the beat
+beatobj:clone(beat) -- clones the beat timings from the first beat onward to the beat
-- beat: the beat to copy the rhythm to
/beatobj:forclone(start, ending, add) -- clone(), but as a for loop
+beatobj:forclone(start, ending, add) -- clone(), but as a for loop
-- start, ending and add act like arguments to a for loop
/beatobj:filter(filterfunc) -- filters the beatobj with a filter function, return true to keep the element and false to discard it
+beatobj:filter(filterfunc) -- filters the beatobj with a filter function, return true to keep the element and false to discard it
-- filterfunc(value, index): the filter function
/beatobj:filtermines() -- remove all mines from the c2l
+beatobj:filtermines() -- remove all mines from the c2l
?beatobj:merge() -- merge beats that are on the same beat and column
+beatobj:aggressivemerge() -- merge beats that are on the same beat
]]
local function copyTable(datatable)
@ -123,6 +127,7 @@
mixease = function(self, e1, e2, a)
self._ease = mixEase(e1, e2, a)
self._align = a
return self
end,
-- meta / manipulators
@ -136,7 +141,7 @@
return self
end,
filtermines = function(self)
self = self:filter(function(v) v[3] ~= 'M' end)
self = self:filter(function(v) return v[3] ~= 'M' end)
return self
end,
f = function(self, forfunc)
@ -148,10 +153,11 @@
return self
end,
clone = function(self, beat)
local newbeats = self._beats
local newbeats = copyTable(self._beats)
for i,v in ipairs(self._beats) do
local newv = {}
newv[1] = v[1] - self._beats[1][1] + beat
print(newv[1])
table.insert(newbeats, newv)
end
@ -163,11 +169,47 @@
local oldself = copyTable(self)
for i = start, ending, add do
self = oldself:clone(i)
self = self:add(oldself:clone(i))
end
return self
end,
merge = function(self)
local seen = {}
local merged = {}
for _,v in ipairs(self._beats) do
local doMerge = true
for _,s in ipairs(seen) do
if v[1] == s[1] and ((v[2] == nil or s[2] == nil) or v[2] == s[2]) then
doMerge = false
end
end
if doMerge then table.insert(merged, v) end
table.insert(seen, {v[1], v[2]})
end
self._beats = merged
return self
end,
aggressivemerge = function(self)
local seen = {}
local merged = {}
for _,v in ipairs(self._beats) do
local doMerge = true
for _,s in ipairs(seen) do
if v[1] == s[1] then
doMerge = false
end
end
if doMerge then table.insert(merged, v) end
table.insert(seen, {v[1], v[2]})
end
self._beats = merged
return self
end,
-- mods
wiggle = function(self, perc, mod)
@ -192,7 +234,6 @@
return self
end,
wiggle0 = beatobjTemplate.onoff,
addm = function(self, perc, mod)
if mod == nil then mod = perc; perc = 100 end
@ -203,7 +244,7 @@
end
return self
end
end,
bounce = function(self, perc, mod)
if mod == nil then mod = perc; perc = 100 end
@ -226,6 +267,9 @@
end
}
-- aliases
beatobjTemplate.wiggle0 = beatobjTemplate.onoff
function c2l(start, ending, trunc)
local self = copyTable(beatobjTemplate)
self._beats = P1:GetNoteData(start, ending)