diff --git a/polymer/eduke32/source/lunatic/engine.lua b/polymer/eduke32/source/lunatic/engine.lua index baf9b4f63..c09c26bf8 100644 --- a/polymer/eduke32/source/lunatic/engine.lua +++ b/polymer/eduke32/source/lunatic/engine.lua @@ -202,8 +202,8 @@ end local function check_colcomp(a) - if (type(a) ~= "number" or not (a >= 0 and a <= 63)) then - error("color component must be in the range [0 .. 63]", 3) + if (type(a) ~= "number" or not (a >= 0 and a < 64)) then + error("color component must be in the range [0 .. 64)", 3) end end diff --git a/polymer/eduke32/source/lunatic/test/shadexfog.lua b/polymer/eduke32/source/lunatic/test/shadexfog.lua index 26dfe410d..15aae6709 100644 --- a/polymer/eduke32/source/lunatic/test/shadexfog.lua +++ b/polymer/eduke32/source/lunatic/test/shadexfog.lua @@ -340,7 +340,9 @@ end -- shadexfog.create_trans(startblendidx, func [, numtables [, fullbrightsOK]]) -- -- : must be --- rr, gg, bb = f(r, g, b, R, G, B, level, numtables) +-- rr, gg, bb = f(r,g,b, R,G,B, level, numtables) +-- If reverse translucency bit clear, (r,g,b) is background and (R,G,B) is +-- foreground (incoming). -- ('level' is the table index, from 1 to ) -- : number of tables to create, from on. Default: 1 function shadexfog.create_trans(startblendidx, func, numtables, fullbrightsOK) @@ -411,6 +413,22 @@ function shadexfog.create_additive_trans(startblendidx, numtables, fullbrightsOK ) end +-- shadexfog.create_brightpass_trans(startblendidx [, numtables [, fullbrightsOK]]) +function shadexfog.create_brightpass_trans(startblendidx, numtables, fullbrightsOK) + shadexfog.create_trans( + startblendidx, + + function(r,g,b, R,G,B, alpha, numtabs) + local a = alpha/numtabs + local F = 1 - min(a, (R+G+B) / (3*63)) + local f = 1 - F + return f*r+F*R, f*g+F*G, f*b+F*B + end, + + numtables, fullbrightsOK + ) +end + if (not ismapster32) then return shadexfog end @@ -589,6 +607,30 @@ starting with the blending number , with fractions ]=] ) +engine.registerMenuFunc( + "Create bri.pass tr. tabs", + CreateMenuFunction{ + [0] = shadexfog.create_brightpass_trans, + { "Starting blendnum", 1, 255 }, + { "Number of blending tables", 32, 255 }, + { "Fullbright result colors OK?", 0, 1, GNF_BOOL }, + }, + +formatHelp +[=[ + +<____________________________________________________________________> + +Creates blending tables of "brightpass" translucency, +starting with the blending number , with fractions + + 1/, 2/ ... /. + + : should fullbright color indices (>= 240) be permitted as + the blending result of two color indices? +]=] +) + engine.registerMenuFunc( "Create base shade table", CreateMenuFunction{