Skip to content

Commit

Permalink
Fix some Density Graph errors
Browse files Browse the repository at this point in the history
  • Loading branch information
teejusb committed Mar 24, 2022
1 parent 9c74e86 commit 19535f4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ local af = Def.ActorFrame{
LifeMeter = SCREENMAN:GetTopScreen():GetChild("Life"..pn)
end,
UpdateCommand=function(self)
self:sleep(UpdateRate):queuecommand("Update")
if UpdateRate ~= nil then
self:sleep(UpdateRate):queuecommand("Update")
else
self:sleep(LifeBaseSampleRate):queuecommand("Update")
end
end
}

Expand Down
30 changes: 19 additions & 11 deletions Scripts/SL-Histogram.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,26 @@ function Scrolling_NPS_Histogram(player, width, height, desaturation)
end
end

visible_verts = {unpack(verts, left_idx, right_idx)}

if left_idx > 1 then
local prev1, prev2, cur1, cur2 = unpack(verts, left_idx-2, left_idx+1)
table.insert(visible_verts, 1, interpolate_vert(prev1, cur1, left_offset))
table.insert(visible_verts, 2, interpolate_vert(prev2, cur2, left_offset))
end
if left_idx == 1 and right_idx == #verts then
-- All vertices are visible.
-- This saves memory as the assignment here isn't a copy unlike unpack().
-- This is necessary for songs like "Blue (Da Ba Dee)" from Crapyard Scent.
visible_verts = verts
else
-- Pick ther vertices to display.
visible_verts = {unpack(verts, left_idx, right_idx)}

if left_idx > 1 then
local prev1, prev2, cur1, cur2 = unpack(verts, left_idx-2, left_idx+1)
table.insert(visible_verts, 1, interpolate_vert(prev1, cur1, left_offset))
table.insert(visible_verts, 2, interpolate_vert(prev2, cur2, left_offset))
end

if right_idx < #verts then
local cur1, cur2, next1, next2 = unpack(verts, right_idx-1, right_idx+2)
table.insert(visible_verts, interpolate_vert(cur1, next1, right_offset))
table.insert(visible_verts, interpolate_vert(cur2, next2, right_offset))
if right_idx < #verts then
local cur1, cur2, next1, next2 = unpack(verts, right_idx-1, right_idx+2)
table.insert(visible_verts, interpolate_vert(cur1, next1, right_offset))
table.insert(visible_verts, interpolate_vert(cur2, next2, right_offset))
end
end
end
}
Expand Down

0 comments on commit 19535f4

Please sign in to comment.