mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-02 20:01:23 +00:00
shadexfog.lua: in "Save lookups DAT file" entry, allow to save additional lookups.
BUILD_LUNATIC. git-svn-id: https://svn.eduke32.com/eduke32@4438 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9de8ec9ed8
commit
e9f7b5d09a
2 changed files with 61 additions and 36 deletions
|
@ -357,7 +357,7 @@ if (ismapster32) then
|
||||||
return true, nil, (blendnumtab ~= nil) and #blendnumtab or 0
|
return true, nil, (blendnumtab ~= nil) and #blendnumtab or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ok, errmsg = engine.saveLookupDat(filename, lookups)
|
-- ok, errmsg, numlookups = engine.saveLookupDat(filename, lookups)
|
||||||
function engine.saveLookupDat(filename, lookups)
|
function engine.saveLookupDat(filename, lookups)
|
||||||
if (lookups == nil) then
|
if (lookups == nil) then
|
||||||
-- set to an invalid value, validate_more_blendtabs will error
|
-- set to an invalid value, validate_more_blendtabs will error
|
||||||
|
@ -392,7 +392,7 @@ if (ismapster32) then
|
||||||
|
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
return true
|
return true, nil, #lookupnumtab
|
||||||
end
|
end
|
||||||
|
|
||||||
local hexmap = {
|
local hexmap = {
|
||||||
|
|
|
@ -283,16 +283,13 @@ if (gv.LUNATIC_CLIENT == gv.LUNATIC_CLIENT_MAPSTER32) then
|
||||||
end
|
end
|
||||||
|
|
||||||
function shadexfog.saveLookupDat(filename, lookups)
|
function shadexfog.saveLookupDat(filename, lookups)
|
||||||
if (lookups == nil) then
|
local ok, errmsg, numlookups = engine.saveLookupDat(filename, lookups)
|
||||||
lookups = {
|
if (not ok) then
|
||||||
-- Duke3D 1.5 LOOKUP.DAT order
|
error(errmsg)
|
||||||
1,2,6,7,8, 3,4,5,9,10,
|
|
||||||
12,13,15,16,18, 19,11,14,17,20,
|
|
||||||
21,22,23,24,25
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
assert(engine.saveLookupDat(filename, lookups))
|
|
||||||
printf('Wrote lookup tables and 5 base palettes to "%s".', filename)
|
printf('Wrote %d lookup tables and 5 base palettes to "%s".',
|
||||||
|
numlookups, filename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -698,22 +695,13 @@ tuples (16-tuples) of the base palette at pal <palnum>.
|
||||||
]]
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
local function getNumberRange(what, whating)
|
||||||
"Save pal+sh+trans DAT f.",
|
local str = engine.getstring("Additional "..what.." numbers (e.g. '64,100-131,255'): ")
|
||||||
function()
|
if (str == nil) then return end
|
||||||
local filename = engine.getstring("File name: ")
|
if (str == "") then return {} end
|
||||||
if (filename == nil) then return end
|
|
||||||
|
|
||||||
local palnum = getnumber16("Pal number of base shade table: ", 0, MAXUSERPALOOKUP)
|
|
||||||
if (palnum < 0) then return end
|
|
||||||
local blendnum = getnumber16("Blendnum of base transluc. table: ", 0, 255)
|
|
||||||
if (blendnum < 0) then return end
|
|
||||||
|
|
||||||
local str = engine.getstring("Additional blend numbers (e.g. '64,100-131,255'): ")
|
|
||||||
if (str == nil or str=="") then return end
|
|
||||||
|
|
||||||
if (not str:find("^[%d,%-]+$")) then
|
if (not str:find("^[%d,%-]+$")) then
|
||||||
error("Additional blending numbers string must contain only digits or ',' or '-'", 2)
|
error("Additional "..whating.." numbers string must contain only digits or ',' or '-'", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local moreblends = {}
|
local moreblends = {}
|
||||||
|
@ -731,6 +719,23 @@ engine.registerMenuFunc(
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return moreblends
|
||||||
|
end
|
||||||
|
|
||||||
|
engine.registerMenuFunc(
|
||||||
|
"Save pal+sh+trans DAT f.",
|
||||||
|
function()
|
||||||
|
local filename = engine.getstring("File name: ")
|
||||||
|
if (filename == nil) then return end
|
||||||
|
|
||||||
|
local palnum = getnumber16("Pal number of base shade table: ", 0, MAXUSERPALOOKUP)
|
||||||
|
if (palnum < 0) then return end
|
||||||
|
local blendnum = getnumber16("Blendnum of base transluc. table: ", 0, 255)
|
||||||
|
if (blendnum < 0) then return end
|
||||||
|
|
||||||
|
local moreblends = getNumberRange("blend", "blending")
|
||||||
|
if (moreblends == nil) then return end
|
||||||
|
|
||||||
local lognumalphatabs
|
local lognumalphatabs
|
||||||
if (#moreblends > 0) then
|
if (#moreblends > 0) then
|
||||||
lognumalphatabs = getnumber16("log2 of last alpha blending table index (1-7, 0: none): ", 0, 7)
|
lognumalphatabs = getnumber16("log2 of last alpha blending table index (1-7, 0: none): ", 0, 7)
|
||||||
|
@ -764,18 +769,38 @@ engine.registerMenuFunc(
|
||||||
function()
|
function()
|
||||||
local filename = engine.getstring("File name: ")
|
local filename = engine.getstring("File name: ")
|
||||||
if (filename ~= nil and filename ~= "") then
|
if (filename ~= nil and filename ~= "") then
|
||||||
shadexfog.saveLookupDat(filename)
|
local lookups = {
|
||||||
|
-- Duke3D 1.5 LOOKUP.DAT order
|
||||||
|
1,2,6,7,8, 3,4,5,9,10,
|
||||||
|
12,13,15,16,18, 19,11,14,17,20,
|
||||||
|
21,22,23,24,25
|
||||||
|
}
|
||||||
|
|
||||||
|
local morelookups = getNumberRange("lookup", "lookup")
|
||||||
|
if (morelookups == nil) then return end
|
||||||
|
|
||||||
|
if (#morelookups > 0) then
|
||||||
|
for i=1,#morelookups do
|
||||||
|
lookups[#lookups+1] = morelookups[i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
shadexfog.saveLookupDat(filename, lookups)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
formatHelp
|
formatHelp
|
||||||
[[
|
[[
|
||||||
<shadexfog.saveLookupDat(filename)>
|
<shadexfog.saveLookupDat(filename, lookups)>
|
||||||
<_________________________________>
|
<__________________________________________>
|
||||||
|
|
||||||
Saves the color index lookups (i.e. first 256 values of each shade
|
Saves the color index lookups (i.e. first 256 values of each shade
|
||||||
table) of the pal numbers which have lookups in Duke3D's unaltered
|
table) of the pal numbers which have lookups in Duke3D's unaltered
|
||||||
LOOKUP.DAT.
|
LOOKUP.DAT, plus optional ones provided by the user.
|
||||||
|
|
||||||
|
The default ones are, in this order:
|
||||||
|
1,2,6,7,8, 3,4,5,9,10, 12,13,15,16,18, 19,11,14,17,20, 21,22,23,24,25.
|
||||||
|
(All pal numbers from 1 to 25 are present.)
|
||||||
|
|
||||||
<filename>: the name of the LOOKUP.DAT-formatted file to create
|
<filename>: the name of the LOOKUP.DAT-formatted file to create
|
||||||
]]
|
]]
|
||||||
|
|
Loading…
Reference in a new issue