Early/Late display with ms + settings
This commit is contained in:
parent
1dafc383bb
commit
5b34b1313b
|
@ -69,6 +69,27 @@
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"gameplay_earlyLateFor": {
|
||||||
|
"label": "Show Early/Late display for",
|
||||||
|
"type": "selection",
|
||||||
|
"default": "NEAR (or worse)",
|
||||||
|
"values": ["CRITICAL (or worse)", "NEAR (or worse)", "OFF"]
|
||||||
|
},
|
||||||
|
|
||||||
|
"gameplay_earlyLatePosition": {
|
||||||
|
"label": "Early/Late display position",
|
||||||
|
"type": "selection",
|
||||||
|
"default": "STANDARD",
|
||||||
|
"values": ["UPPER+", "UPPER", "STANDARD", "LOWER"]
|
||||||
|
},
|
||||||
|
|
||||||
|
"gameplay_msFor": {
|
||||||
|
"label": "Show millisecond display for",
|
||||||
|
"type": "selection",
|
||||||
|
"default": "NEAR (or worse)",
|
||||||
|
"values": ["ALL", "CRITICAL (or worse)", "NEAR (or worse)", "NONE"]
|
||||||
|
},
|
||||||
|
|
||||||
"separator_f": {},
|
"separator_f": {},
|
||||||
"Debug": { "type": "label" },
|
"Debug": { "type": "label" },
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ local Chain = require('gameplay.chain')
|
||||||
local LaserAlert = require('gameplay.laser_alert')
|
local LaserAlert = require('gameplay.laser_alert')
|
||||||
|
|
||||||
local HitFX = require 'gameplay.hitfx'
|
local HitFX = require 'gameplay.hitfx'
|
||||||
|
local EarlyLate = require 'gameplay.earlylate'
|
||||||
|
|
||||||
local TrackEnd = require('gameplay.track_end')
|
local TrackEnd = require('gameplay.track_end')
|
||||||
|
|
||||||
|
@ -59,6 +60,8 @@ function render(deltaTime)
|
||||||
Chain.render(deltaTime, gameplay.comboState, chain, gameplay.critLine.x, gameplay.critLine.y);
|
Chain.render(deltaTime, gameplay.comboState, chain, gameplay.critLine.x, gameplay.critLine.y);
|
||||||
|
|
||||||
LaserAlert.render(deltaTime);
|
LaserAlert.render(deltaTime);
|
||||||
|
|
||||||
|
EarlyLate.render(deltaTime)
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_crit_base(deltaTime)
|
function render_crit_base(deltaTime)
|
||||||
|
@ -113,6 +116,10 @@ function button_hit(button, rating, delta)
|
||||||
HitFX.TriggerAnimation("Crit", button + 1)
|
HitFX.TriggerAnimation("Crit", button + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if 0 < rating and rating < 3 then
|
||||||
|
EarlyLate.TriggerAnimation(rating, delta)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function laser_slam_hit(slamLength, startPos, endPost, index)
|
function laser_slam_hit(slamLength, startPos, endPost, index)
|
||||||
|
|
|
@ -1,30 +1,94 @@
|
||||||
|
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 heightFractions = {
|
||||||
|
["UPPER+"] = 2,
|
||||||
|
["UPPER"] = 3,
|
||||||
|
["STANDARD"] = 3.5,
|
||||||
|
["LOWER"] = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
local earlyLateFor = compare[game.GetSkinSetting("gameplay_earlyLateFor")]
|
||||||
|
local msFor = compare[game.GetSkinSetting("gameplay_msFor")]
|
||||||
|
local heightFraction = heightFractions[game.GetSkinSetting("gameplay_earlyLatePosition")]
|
||||||
|
|
||||||
|
local EarlyLate = {
|
||||||
|
timer = 0,
|
||||||
|
lastMillisec = 0,
|
||||||
|
showEarlyLate = false,
|
||||||
|
showMillisec = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if screenH > screenW then
|
||||||
|
desh = 1920
|
||||||
|
else
|
||||||
|
desh = 1080
|
||||||
|
end
|
||||||
|
|
||||||
|
local scale = desh / screenH
|
||||||
|
local y = screenH / 8 * heightFraction
|
||||||
|
|
||||||
|
gfx.BeginPath()
|
||||||
|
gfx.LoadSkinFont("dfmarugoth.ttf")
|
||||||
|
gfx.FontSize(12 * scale)
|
||||||
|
|
||||||
|
if EarlyLate.showEarlyLate then
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BASELINE)
|
||||||
|
|
||||||
|
if EarlyLate.lastMillisec < 0 then
|
||||||
|
gfx.FillColor(224, 153, 179)
|
||||||
|
gfx.FastText("EARLY", screenCenterX - 100 * scale, y)
|
||||||
|
else
|
||||||
|
gfx.FillColor(90, 131, 211)
|
||||||
|
gfx.FastText("LATE", screenCenterX - 100 * scale, y)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if EarlyLate.showMillisec then
|
||||||
|
local msString = string.format("%dms", EarlyLate.lastMillisec)
|
||||||
|
|
||||||
|
if EarlyLate.lastMillisec >= 0 then
|
||||||
|
msString = "+"..msString -- prepend + sign for lates
|
||||||
|
end
|
||||||
|
|
||||||
|
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_BASELINE)
|
||||||
|
|
||||||
|
gfx.FastText(msString, screenCenterX + 100 * scale, y)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EarlyLate.TriggerAnimation(rating, millisec)
|
||||||
|
local showEarlyLate = rating <= earlyLateFor
|
||||||
|
local showMillisec = rating <= msFor
|
||||||
|
|
||||||
|
if showEarlyLate or showMillisec then
|
||||||
|
EarlyLate.timer = 120
|
||||||
|
EarlyLate.lastMillisec = millisec
|
||||||
|
EarlyLate.showEarlyLate = showEarlyLate
|
||||||
|
EarlyLate.showMillisec = showMillisec
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return EarlyLate
|
Loading…
Reference in New Issue