[mugenizer] set default color in subs with a single color
This commit is contained in:
parent
bf568cc3de
commit
f5b9ba0f6a
|
@ -71,6 +71,9 @@ end
|
|||
|
||||
function mugenizer(subs)
|
||||
local first = nil
|
||||
local styles_different = false
|
||||
local styles = 0
|
||||
local i_styles = {}
|
||||
|
||||
for i, line in ipairs(subs) do
|
||||
if line.class == "info" then
|
||||
|
@ -82,6 +85,11 @@ function mugenizer(subs)
|
|||
if line.class == "style" then
|
||||
line.fontname = "Arial"
|
||||
line.fontsize = "24"
|
||||
i_styles[styles] = i
|
||||
if styles > 0 then
|
||||
styles_different = styles_different or line.color1 ~= subs[i_styles[styles-1]].color1 or line.color2 ~= subs[i_styles[styles-1]].color2 or line.color3 ~= subs[i_styles[styles-1]].color3 or line.color4 ~= subs[i_styles[styles-1]].color4
|
||||
end
|
||||
styles = styles + 1
|
||||
end
|
||||
|
||||
if line.class == "dialogue" then
|
||||
|
@ -98,6 +106,17 @@ function mugenizer(subs)
|
|||
subs[i] = line
|
||||
end
|
||||
|
||||
if not styles_different then
|
||||
for i = 0, styles-1, 1 do
|
||||
line = subs[i_styles[i]]
|
||||
line.color1 = "&H008AFF"
|
||||
line.color2 = "&HFFFFFF"
|
||||
line.color3 = "&H000000"
|
||||
line.color4 = "&H000000"
|
||||
subs[i_styles[i]] = line
|
||||
end
|
||||
end
|
||||
|
||||
-- add mugen's magic line
|
||||
line = subs[first]
|
||||
line.comment = true
|
||||
|
|
Loading…
Reference in a new issue