This commit is contained in:
parent
19f0cc152b
commit
fe90f0e2aa
|
@ -17,6 +17,10 @@ local cursorGlowTopImages = {
|
||||||
gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_top_left.png", 0),
|
gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_top_left.png", 0),
|
||||||
gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_top_right.png", 0),
|
gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_top_right.png", 0),
|
||||||
}
|
}
|
||||||
|
local cursorTailImages = {
|
||||||
|
gfx.CreateSkinImage("gameplay/crit_line/cursor_tail_l.png", 0),
|
||||||
|
gfx.CreateSkinImage("gameplay/crit_line/cursor_tail_r.png", 0),
|
||||||
|
}
|
||||||
|
|
||||||
local CRITBAR_W = 1080
|
local CRITBAR_W = 1080
|
||||||
local CRITBAR_H = 251
|
local CRITBAR_H = 251
|
||||||
|
@ -24,10 +28,15 @@ local CRITBAR_H = 251
|
||||||
local scale = 1;
|
local scale = 1;
|
||||||
local isLandscape = false;
|
local isLandscape = false;
|
||||||
|
|
||||||
local drawCursors = function (centerX, centerY,cursors)
|
local drawCursors = function (centerX, centerY,cursors, laserActive)
|
||||||
local cursorW = 598 * 0.165;
|
local cursorW = 598 * 0.165;
|
||||||
local cursorH = 673 * 0.14;
|
local cursorH = 673 * 0.14;
|
||||||
|
|
||||||
|
local tailW = cursorW * 9
|
||||||
|
local tailH = cursorH * 9
|
||||||
|
|
||||||
for i = 0, 1, 1 do
|
for i = 0, 1, 1 do
|
||||||
|
local luaIndex = i + 1
|
||||||
local cursor = cursors[i];
|
local cursor = cursors[i];
|
||||||
|
|
||||||
gfx.Save();
|
gfx.Save();
|
||||||
|
@ -39,6 +48,18 @@ local drawCursors = function (centerX, centerY,cursors)
|
||||||
local cursorX = cursor.pos * (1 / scale) - cursorW / 2;
|
local cursorX = cursor.pos * (1 / scale) - cursorW / 2;
|
||||||
local cursorY = -cursorH / 2;
|
local cursorY = -cursorH / 2;
|
||||||
|
|
||||||
|
if laserActive[luaIndex] then
|
||||||
|
gfx.ImageRect(
|
||||||
|
cursor.pos - tailW / 2,
|
||||||
|
- tailH / 2,
|
||||||
|
tailW,
|
||||||
|
tailH,
|
||||||
|
cursorTailImages[luaIndex],
|
||||||
|
cursor.alpha / 2,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
gfx.ImageRect(
|
gfx.ImageRect(
|
||||||
cursorX,
|
cursorX,
|
||||||
cursorY,
|
cursorY,
|
||||||
|
@ -54,7 +75,7 @@ local drawCursors = function (centerX, centerY,cursors)
|
||||||
cursorY,
|
cursorY,
|
||||||
cursorW,
|
cursorW,
|
||||||
cursorH,
|
cursorH,
|
||||||
cursorGlowBottomImages[i+1],
|
cursorGlowBottomImages[luaIndex],
|
||||||
cursor.alpha,
|
cursor.alpha,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
@ -74,7 +95,7 @@ local drawCursors = function (centerX, centerY,cursors)
|
||||||
cursorY,
|
cursorY,
|
||||||
cursorW,
|
cursorW,
|
||||||
cursorH,
|
cursorH,
|
||||||
cursorGlowTopImages[i+1],
|
cursorGlowTopImages[luaIndex],
|
||||||
cursor.alpha,
|
cursor.alpha,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
@ -83,7 +104,7 @@ local drawCursors = function (centerX, centerY,cursors)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local renderBase = function (deltaTime, centerX, centerY, rotation, cursors)
|
local renderBase = function (deltaTime, centerX, centerY, rotation)
|
||||||
scale, isLandscape = Dimensions.setUpTransforms(centerX, centerY, rotation)
|
scale, isLandscape = Dimensions.setUpTransforms(centerX, centerY, rotation)
|
||||||
|
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
|
@ -99,13 +120,15 @@ local renderBase = function (deltaTime, centerX, centerY, rotation, cursors)
|
||||||
gfx.ImageRect(-CRITBAR_W/2, -CRITBAR_H/2, CRITBAR_W, CRITBAR_H, baseImage, 1, 0);
|
gfx.ImageRect(-CRITBAR_W/2, -CRITBAR_H/2, CRITBAR_W, CRITBAR_H, baseImage, 1, 0);
|
||||||
end
|
end
|
||||||
|
|
||||||
drawCursors(centerX, centerY, cursors)
|
|
||||||
|
|
||||||
gfx.ResetTransform()
|
gfx.ResetTransform()
|
||||||
end
|
end
|
||||||
|
|
||||||
local renderOverlay = function (deltaTime)
|
local renderOverlay = function (deltaTime, centerX, centerY, rotation, cursors, laserActive)
|
||||||
|
scale, isLandscape = Dimensions.setUpTransforms(centerX, centerY, rotation)
|
||||||
|
|
||||||
|
drawCursors(centerX, centerY, cursors, laserActive)
|
||||||
|
|
||||||
|
gfx.ResetTransform()
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,30 +1,109 @@
|
||||||
|
local Dimensions = require "common.dimensions"
|
||||||
|
|
||||||
local desw = 1080;
|
-- Used for comparing button_hit()'s delta parameter with the
|
||||||
local desh = 1920;
|
-- gameplay_earlyLateFor/gameplay_msDisplay skin settings values.
|
||||||
|
-- If the number is <= delta then the EarlyLate/ms should be shown
|
||||||
local transitionExistScale = 0;
|
local compare = {
|
||||||
|
["ALL"] = 2,
|
||||||
local tickTransitions = function (deltaTime)
|
["CRITICAL (or worse)"] = 2,
|
||||||
|
["NEAR (or worse)"] = 1,
|
||||||
if transitionExistScale < 1 then
|
["NONE"] = -1,
|
||||||
transitionExistScale = transitionExistScale + deltaTime / 2 -- transition should last for that time in seconds
|
["OFF"] = -1
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local render = function (deltaTime, comboState, combo, critLineCenterX, critLineCenterY)
|
|
||||||
tickTransitions(deltaTime)
|
|
||||||
|
|
||||||
if (transitionExistScale >= 1) then
|
|
||||||
return;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local trigger = function ()
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
render=render
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local portraitHeightFractions = {
|
||||||
|
["UPPER+"] = 2.4,
|
||||||
|
["UPPER"] = 3,
|
||||||
|
["STANDARD"] = 4.2,
|
||||||
|
["LOWER"] = 5.3,
|
||||||
|
}
|
||||||
|
|
||||||
|
local landscapeHeightFractions = {
|
||||||
|
["UPPER+"] = 1.5,
|
||||||
|
["UPPER"] = 2.7,
|
||||||
|
["STANDARD"] = 4.1,
|
||||||
|
["LOWER"] = 6.7,
|
||||||
|
}
|
||||||
|
|
||||||
|
local earlyLateFor = compare[game.GetSkinSetting("gameplay_earlyLateFor")]
|
||||||
|
local msFor = compare[game.GetSkinSetting("gameplay_msFor")]
|
||||||
|
local earlyLatePosition = game.GetSkinSetting("gameplay_earlyLatePosition")
|
||||||
|
|
||||||
|
local EarlyLate = {
|
||||||
|
timer = 0,
|
||||||
|
color = {},
|
||||||
|
earlyLateText = "",
|
||||||
|
millisecText = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function EarlyLate.render(deltaTime)
|
||||||
|
if EarlyLate.timer <= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
EarlyLate.timer = EarlyLate.timer - deltaTime * 100
|
||||||
|
|
||||||
|
local screenW, screenH = Dimensions.screen.width, Dimensions.screen.height
|
||||||
|
local screenCenterX = screenW / 2
|
||||||
|
|
||||||
|
local desh, fractionTable
|
||||||
|
|
||||||
|
if screenH > screenW then
|
||||||
|
desh = 1600
|
||||||
|
fractionTable = portraitHeightFractions
|
||||||
|
else
|
||||||
|
desh = 1080
|
||||||
|
fractionTable = landscapeHeightFractions
|
||||||
|
end
|
||||||
|
|
||||||
|
local scale = screenH / desh
|
||||||
|
local y = screenH / 8 * fractionTable[earlyLatePosition]
|
||||||
|
|
||||||
|
gfx.BeginPath()
|
||||||
|
gfx.LoadSkinFont("Digital-Serial-ExtraBold.ttf")
|
||||||
|
gfx.FontSize(20 * scale)
|
||||||
|
|
||||||
|
local color = EarlyLate.color
|
||||||
|
gfx.FillColor(color[1], color[2], color[3])
|
||||||
|
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BASELINE)
|
||||||
|
|
||||||
|
gfx.FastText(EarlyLate.earlyLateText, screenCenterX - 100 * scale, y)
|
||||||
|
gfx.FastText(EarlyLate.millisecText, screenCenterX + 100 * scale, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EarlyLate.TriggerAnimation(rating, millisec)
|
||||||
|
local showEarlyLate = rating <= earlyLateFor
|
||||||
|
local showMillisec = rating <= msFor
|
||||||
|
local isEarly = millisec < 0
|
||||||
|
|
||||||
|
if millisec == 0 then return end
|
||||||
|
if not showEarlyLate and not showMillisec then return end
|
||||||
|
|
||||||
|
if showEarlyLate then
|
||||||
|
EarlyLate.earlyLateText = isEarly and "EARLY" or "LATE"
|
||||||
|
else
|
||||||
|
EarlyLate.earlyLateText = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if showMillisec then
|
||||||
|
local millisecText = string.format("%dms", millisec)
|
||||||
|
|
||||||
|
-- prepend + sign for lates
|
||||||
|
millisecText = isEarly and millisecText or "+"..millisecText
|
||||||
|
|
||||||
|
EarlyLate.millisecText = millisecText
|
||||||
|
else
|
||||||
|
EarlyLate.millisecText = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if isEarly then
|
||||||
|
EarlyLate.color = {206, 94, 135}
|
||||||
|
else
|
||||||
|
EarlyLate.color = {53, 102, 197}
|
||||||
|
end
|
||||||
|
|
||||||
|
EarlyLate.timer = 120
|
||||||
|
end
|
||||||
|
|
||||||
|
return EarlyLate
|
Loading…
Reference in New Issue