Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
135 changes: 126 additions & 9 deletions parts/eventsets/classic_e.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ local function GetGravity(lvl)
lvl<29 and 2 or
1
end
local function getHzColor(hz)
if not hz or hz<10 then return{1,1,1}
elseif hz<15 then return{1,1,0}
elseif hz<18 then return{1,.75,0}
elseif hz<25 then return{1,.5,0}
elseif hz<40 then return{1,0,0}
elseif hz<1e99 then return{.5,0,1}
else return{1,0,1}end
end
local function getMistimeColor(t)
if not t then return {1,1,1}
elseif t<1 then return{0,1,1}
else return {COLOR.hsv(math.max(.4-1/9*math.log(t,8),0),1,1)}end
end
local function onMove(P,dir)
local D=P.modeData

if not D.firstMoveTimestamp then
D.firstMoveTimestamp=P.stat.time
end

D.lastMoveTimestamp=P.stat.time

D.displacement=math.abs(P.curX+dir-D.spawnX)
end
local function createMoveHandler(dir)
return function(P) onMove(P,dir) end
end
return {
das=16,arr=6,
sddas=6,sdarr=6,
Expand All @@ -38,25 +66,105 @@ return {
noTele=true,
keyCancel={5,6},
mesDisp=function(P)
local D=P.modeData

setFont(75)
GC.mStr(GetLevelStr(P.modeData.lvl),63,210)
GC.mStr(GetLevelStr(D.lvl),63,210)
mText(TEXTOBJ.speedLV,63,290)
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
if P.modeData.drought>7 then
if P.modeData.drought<=14 then
GC.setColor(1,1,1,P.modeData.drought/7-1)
PLY.draw.drawProgress(P.stat.row,D.target)
if D.drought>7 then
if D.drought<=14 then
GC.setColor(1,1,1,D.drought/7-1)
else
local gb=P.modeData.drought<=21 and 2-P.modeData.drought/14 or .5
local gb=D.drought<=21 and 2-D.drought/14 or .5
GC.setColor(1,gb,gb)
end
setFont(50)
GC.mStr(P.modeData.drought,63,130)
GC.mStr(D.drought,63,130)
mDraw(MODES.drought_l.icon,63,200,nil,.5)
end

-- Draw Hz counters
local spawnHz=(
D.firstMoveTimestamp and
D.displacement/(D.lastMoveTimestamp-D.spawnTimestamp)
or nil
)
local moveHz=(
D.firstMoveTimestamp and
D.displacement/(D.lastMoveTimestamp-D.firstMoveTimestamp)
or nil
)
local mistime=(
D.firstMoveTimestamp and
1000*(D.firstMoveTimestamp-D.spawnTimestamp)
or nil
)

local spawnHzStr="---"
if spawnHz then
if spawnHz<10 then
spawnHzStr=string.format("%.2f",spawnHz)
elseif spawnHz<100 then
spawnHzStr=string.format("%.1f",spawnHz)
elseif spawnHz<1e99 then
spawnHzStr=string.format("%.0f",spawnHz)
else
spawnHzStr="∞"
end
end

local moveHzStr="---"
if moveHz then
if moveHz<10 then
moveHzStr=string.format("%.2f",moveHz)
elseif moveHz<100 then
moveHzStr=string.format("%.1f",moveHz)
elseif spawnHz<1e99 then
moveHzStr=string.format("%.0f",moveHz)
else
moveHzStr="∞"
end
end

local mistimeStr="---"
if mistime then
if mistime<10 then
mistimeStr=string.format("%.2f",mistime)
elseif mistime<100 then
mistimeStr=string.format("%.1f",mistime)
else
mistimeStr=string.format("%.0f",mistime)
end
end

GC.setColor(getHzColor(spawnHz))
setFont(50)
GC.mStr(spawnHzStr,30,40)

GC.setColor(1,1,1)
setFont(24)
GC.mStr("Hz",110,65)

setFont(20)
GC.mStr(
{
"(",getHzColor(moveHz),moveHzStr,{1,1,1}," Hz - ",
getMistimeColor(mistime),mistimeStr,{1,1,1}," ms)"
},
40,100
)
end,
task=function(P)
P.modeData.lvl=9
P.modeData.target=10
local D=P.modeData
D.lvl=9
D.target=10

D.spawnX=0
D.spawnTimestamp=P.stat.time
D.firstMoveTimestamp=false
D.lastMoveTimestamp=false
D.displacement=0
end,
hook_drop=function(P)
local D=P.modeData
Expand All @@ -77,4 +185,13 @@ return {
D.target=D.target+10
end
end,
hook_spawn=function(P)
local D=P.modeData
D.spawnX=P.curX
D.spawnTimestamp=P.stat.time
D.firstMoveTimestamp=false
D.lastMoveTimestamp=false
end,
hook_left=createMoveHandler(-1),
hook_right=createMoveHandler(1),
}
136 changes: 127 additions & 9 deletions parts/eventsets/classic_h.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ local function GetGravity(lvl)
lvl<29 and 2 or
1
end
local function getHzColor(hz)
if not hz or hz<10 then return{1,1,1}
elseif hz<15 then return{1,1,0}
elseif hz<18 then return{1,.75,0}
elseif hz<25 then return{1,.5,0}
elseif hz<40 then return{1,0,0}
elseif hz<1e99 then return{.5,0,1}
else return{1,0,1}end
end
local function getMistimeColor(t)
if not t then return {1,1,1}
elseif t<1 then return{0,1,1}
else return {COLOR.hsv(math.max(.4-1/9*math.log(t,8),0),1,1)}end
end
local function onMove(P,dir)
local D=P.modeData

if not D.firstMoveTimestamp then
D.firstMoveTimestamp=P.stat.time
end

D.lastMoveTimestamp=P.stat.time

D.displacement=math.abs(P.curX+dir-D.spawnX)
end
local function createMoveHandler(dir)
return function(P) onMove(P,dir) end
end
return {
das=16,arr=6,
sddas=3,sdarr=3,
Expand All @@ -38,25 +66,106 @@ return {
noTele=true,
keyCancel={5,6},
mesDisp=function(P)
local D=P.modeData

setFont(75)
GC.mStr(GetLevelStr(P.modeData.lvl),63,210)
GC.mStr(GetLevelStr(D.lvl),63,210)
mText(TEXTOBJ.speedLV,63,290)
PLY.draw.drawProgress(P.stat.row,P.modeData.target)
if P.modeData.drought>7 then
if P.modeData.drought<=14 then
GC.setColor(1,1,1,P.modeData.drought/7-1)
PLY.draw.drawProgress(P.stat.row,D.target)
if D.drought>7 then
if D.drought<=14 then
GC.setColor(1,1,1,D.drought/7-1)
else
local gb=P.modeData.drought<=21 and 2-P.modeData.drought/14 or .5
local gb=D.drought<=21 and 2-D.drought/14 or .5
GC.setColor(1,gb,gb)
end
setFont(50)
GC.mStr(P.modeData.drought,63,130)
GC.mStr(D.drought,63,130)
mDraw(MODES.drought_l.icon,63,200,nil,.5)
end

-- Draw Hz counters
local spawnHz=(
D.firstMoveTimestamp and
D.displacement/(D.lastMoveTimestamp-D.spawnTimestamp)
or nil
)
local moveHz=(
D.firstMoveTimestamp and
D.displacement/(D.lastMoveTimestamp-D.firstMoveTimestamp)
or nil
)
local mistime=(
D.firstMoveTimestamp and
1000*(D.firstMoveTimestamp-D.spawnTimestamp)
or nil
)

local spawnHzStr="---"
if spawnHz then
if spawnHz<10 then
spawnHzStr=string.format("%.2f",spawnHz)
elseif spawnHz<100 then
spawnHzStr=string.format("%.1f",spawnHz)
elseif spawnHz<1e99 then
spawnHzStr=string.format("%.0f",spawnHz)
else
spawnHzStr="∞"
end
end

local moveHzStr="---"
if moveHz then
if moveHz<10 then
moveHzStr=string.format("%.2f",moveHz)
elseif moveHz<100 then
moveHzStr=string.format("%.1f",moveHz)
elseif spawnHz<1e99 then
moveHzStr=string.format("%.0f",moveHz)
else
moveHzStr="∞"
end
end

local mistimeStr="---"
if mistime then
if mistime<10 then
mistimeStr=string.format("%.2f",mistime)
elseif mistime<100 then
mistimeStr=string.format("%.1f",mistime)
else
mistimeStr=string.format("%.0f",mistime)
end
end

GC.setColor(getHzColor(spawnHz))
setFont(50)
GC.mStr(spawnHzStr,30,40)

GC.setColor(1,1,1)
setFont(24)
GC.mStr("Hz",110,65)

setFont(20)
GC.mStr(
{
"(",getHzColor(moveHz),moveHzStr,{1,1,1}," Hz - ",
getMistimeColor(mistime),mistimeStr,{1,1,1}," ms)"
},
40,100
)
end,
task=function(P)
P.modeData.lvl=18
P.modeData.target=10
local D=P.modeData

D.lvl=18
D.target=10

D.spawnX=0
D.spawnTimestamp=P.stat.time
D.firstMoveTimestamp=false
D.lastMoveTimestamp=false
D.displacement=0
end,
hook_drop=function(P)
local D=P.modeData
Expand All @@ -77,4 +186,13 @@ return {
D.target=D.target+10
end
end,
hook_spawn=function(P)
local D=P.modeData
D.spawnX=P.curX
D.spawnTimestamp=P.stat.time
D.firstMoveTimestamp=false
D.lastMoveTimestamp=false
end,
hook_left=createMoveHandler(-1),
hook_right=createMoveHandler(1),
}
Loading
Loading