mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Mapster32/Lunatic: add descriptions to [;]+[F] menu entries shown in upper left.
BUILD_LUNATIC. git-svn-id: https://svn.eduke32.com/eduke32@4423 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b1e38e080d
commit
966fa90f7a
3 changed files with 295 additions and 26 deletions
|
@ -12959,6 +12959,12 @@ static void GenericSpriteSearch(void)
|
||||||
#define MENU_BG_COLOR editorcolors[0]
|
#define MENU_BG_COLOR editorcolors[0]
|
||||||
#define MENU_BG_COLOR_SEL editorcolors[1]
|
#define MENU_BG_COLOR_SEL editorcolors[1]
|
||||||
|
|
||||||
|
#ifdef LUNATIC
|
||||||
|
# define MENU_HAVE_DESCRIPTION 1
|
||||||
|
#else
|
||||||
|
# define MENU_HAVE_DESCRIPTION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct StatusBarMenu_ {
|
typedef struct StatusBarMenu_ {
|
||||||
const char *const menuname;
|
const char *const menuname;
|
||||||
const int32_t custom_start_index;
|
const int32_t custom_start_index;
|
||||||
|
@ -12967,23 +12973,44 @@ typedef struct StatusBarMenu_ {
|
||||||
void (*process_func)(const struct StatusBarMenu_ *m, int32_t col, int32_t row);
|
void (*process_func)(const struct StatusBarMenu_ *m, int32_t col, int32_t row);
|
||||||
|
|
||||||
intptr_t auxdata[MENU_MAX_ENTRIES];
|
intptr_t auxdata[MENU_MAX_ENTRIES];
|
||||||
|
char *description[MENU_MAX_ENTRIES]; // strdup'd description string, NULL if non
|
||||||
char name[MENU_MAX_ENTRIES][MENU_ENTRY_SIZE];
|
char name[MENU_MAX_ENTRIES][MENU_ENTRY_SIZE];
|
||||||
} StatusBarMenu;
|
} StatusBarMenu;
|
||||||
|
|
||||||
#define MENU_INITIALIZER_EMPTY(MenuName, ProcessFunc) \
|
#define MENU_INITIALIZER_EMPTY(MenuName, ProcessFunc) \
|
||||||
{ MenuName, 0, 0, ProcessFunc, {}, {} }
|
{ MenuName, 0, 0, ProcessFunc, {}, {}, {} }
|
||||||
#define MENU_INITIALIZER(MenuName, CustomStartIndex, ProcessFunc, ...) \
|
#define MENU_INITIALIZER(MenuName, CustomStartIndex, ProcessFunc, ...) \
|
||||||
{ MenuName, CustomStartIndex, CustomStartIndex, ProcessFunc, {}, ## __VA_ARGS__ }
|
{ MenuName, CustomStartIndex, CustomStartIndex, ProcessFunc, {}, {}, ## __VA_ARGS__ }
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
static void M_Clear(StatusBarMenu *m)
|
static void M_Clear(StatusBarMenu *m)
|
||||||
{
|
{
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
m->numentries = 0;
|
m->numentries = 0;
|
||||||
Bmemset(m->auxdata, 0, sizeof(m->auxdata));
|
Bmemset(m->auxdata, 0, sizeof(m->auxdata));
|
||||||
Bmemset(m->name, 0, sizeof(m->name));
|
Bmemset(m->name, 0, sizeof(m->name));
|
||||||
|
|
||||||
|
for (i=0; i<MENU_MAX_ENTRIES; i++)
|
||||||
|
{
|
||||||
|
Bfree(m->description[i]);
|
||||||
|
m->description[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t M_HaveDescription(StatusBarMenu *m)
|
||||||
|
{
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
for (i=0; i<MENU_MAX_ENTRIES; i++)
|
||||||
|
if (m->description[i] != NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// NOTE: Does not handle description strings! (Only the Lua menu uses them.)
|
||||||
static void M_UnregisterFunction(StatusBarMenu *m, intptr_t auxdata)
|
static void M_UnregisterFunction(StatusBarMenu *m, intptr_t auxdata)
|
||||||
{
|
{
|
||||||
int32_t i, j;
|
int32_t i, j;
|
||||||
|
@ -13006,7 +13033,7 @@ static void M_UnregisterFunction(StatusBarMenu *m, intptr_t auxdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_RegisterFunction(StatusBarMenu *m, const char *name, intptr_t auxdata)
|
static void M_RegisterFunction(StatusBarMenu *m, const char *name, intptr_t auxdata, const char *description)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
|
@ -13032,6 +13059,14 @@ static void M_RegisterFunction(StatusBarMenu *m, const char *name, intptr_t auxd
|
||||||
Bstrncpyz(m->name[m->numentries], name, MENU_ENTRY_SIZE);
|
Bstrncpyz(m->name[m->numentries], name, MENU_ENTRY_SIZE);
|
||||||
m->auxdata[m->numentries] = auxdata;
|
m->auxdata[m->numentries] = auxdata;
|
||||||
|
|
||||||
|
#if MENU_HAVE_DESCRIPTION
|
||||||
|
// NOTE: description only handled here (not above).
|
||||||
|
if (description)
|
||||||
|
m->description[m->numentries] = Bstrdup(description);
|
||||||
|
#else
|
||||||
|
UNREFERENCED_PARAMETER(description);
|
||||||
|
#endif
|
||||||
|
|
||||||
m->numentries++;
|
m->numentries++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13138,6 +13173,19 @@ static void M_EnterMainLoop(StatusBarMenu *m)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MENU_HAVE_DESCRIPTION
|
||||||
|
if (M_HaveDescription(m))
|
||||||
|
{
|
||||||
|
const int32_t maxrows = 20;
|
||||||
|
int32_t r;
|
||||||
|
|
||||||
|
for (r=0; r<maxrows+1; r++)
|
||||||
|
printext16(16-4, 16-4 + r*8, 0, MENU_BG_COLOR, // 71 blanks:
|
||||||
|
" ", 0);
|
||||||
|
if (m->description[col*8 + row] != NULL)
|
||||||
|
printext16(16, 16, MENU_FG_COLOR, MENU_BG_COLOR, m->description[col*8 + row], 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
printext16(xpos, ypos+row*MENU_Y_SPACING, MENU_FG_COLOR, MENU_BG_COLOR_SEL, disptext, 0);
|
printext16(xpos, ypos+row*MENU_Y_SPACING, MENU_FG_COLOR, MENU_BG_COLOR_SEL, disptext, 0);
|
||||||
showframe(1);
|
showframe(1);
|
||||||
}
|
}
|
||||||
|
@ -13177,7 +13225,7 @@ static void FuncMenu(void)
|
||||||
void registerMenuFunction(const char *funcname, int32_t stateidx)
|
void registerMenuFunction(const char *funcname, int32_t stateidx)
|
||||||
{
|
{
|
||||||
if (funcname)
|
if (funcname)
|
||||||
M_RegisterFunction(&g_specialFuncMenu, funcname, stateidx);
|
M_RegisterFunction(&g_specialFuncMenu, funcname, stateidx, NULL);
|
||||||
else
|
else
|
||||||
M_UnregisterFunction(&g_specialFuncMenu, stateidx);
|
M_UnregisterFunction(&g_specialFuncMenu, stateidx);
|
||||||
}
|
}
|
||||||
|
@ -13442,13 +13490,13 @@ static void LuaFuncMenu(void)
|
||||||
M_EnterMainLoop(&g_LuaFuncMenu);
|
M_EnterMainLoop(&g_LuaFuncMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
LUNATIC_EXTERN void LM_Register(const char *name, luamenufunc_t funcptr)
|
LUNATIC_EXTERN void LM_Register(const char *name, luamenufunc_t funcptr, const char *description)
|
||||||
{
|
{
|
||||||
if (name == NULL || g_numLuaFuncs == MENU_MAX_ENTRIES)
|
if (name == NULL || g_numLuaFuncs == MENU_MAX_ENTRIES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_LuaFuncPtrs[g_numLuaFuncs] = funcptr;
|
g_LuaFuncPtrs[g_numLuaFuncs] = funcptr;
|
||||||
M_RegisterFunction(&g_LuaFuncMenu, name, g_numLuaFuncs);
|
M_RegisterFunction(&g_LuaFuncMenu, name, g_numLuaFuncs, description);
|
||||||
g_numLuaFuncs++;
|
g_numLuaFuncs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char
|
||||||
const char *getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen, int32_t completion);
|
const char *getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen, int32_t completion);
|
||||||
|
|
||||||
typedef const char *(*luamenufunc_t)(void);
|
typedef const char *(*luamenufunc_t)(void);
|
||||||
void LM_Register(const char *name, luamenufunc_t funcptr);
|
void LM_Register(const char *name, luamenufunc_t funcptr, const char *description);
|
||||||
void LM_Clear(void);
|
void LM_Clear(void);
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
@ -440,13 +440,16 @@ if (ismapster32) then
|
||||||
C.LM_Clear()
|
C.LM_Clear()
|
||||||
end
|
end
|
||||||
|
|
||||||
function engine.registerMenuFunc(name, func)
|
function engine.registerMenuFunc(name, func, description)
|
||||||
if (type(name) ~= "string") then
|
if (type(name) ~= "string") then
|
||||||
error("invalid argument #1: must be a string", 2)
|
error("invalid argument #1: must be a string", 2)
|
||||||
end
|
end
|
||||||
if (type(func) ~= "function") then
|
if (type(func) ~= "function") then
|
||||||
error("invalid argument #2: must be a function", 2)
|
error("invalid argument #2: must be a function", 2)
|
||||||
end
|
end
|
||||||
|
if (description~=nil and type(description)~="string") then
|
||||||
|
error("invalid argument #3: must be nil or a string", 2)
|
||||||
|
end
|
||||||
|
|
||||||
local safefunc = function()
|
local safefunc = function()
|
||||||
local ok, errmsg = pcall(func)
|
local ok, errmsg = pcall(func)
|
||||||
|
@ -455,7 +458,7 @@ if (ismapster32) then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
C.LM_Register(name, safefunc)
|
C.LM_Register(name, safefunc, description)
|
||||||
end
|
end
|
||||||
|
|
||||||
engine.GETNUMFLAG = {
|
engine.GETNUMFLAG = {
|
||||||
|
|
|
@ -11,11 +11,13 @@ local assert = assert
|
||||||
local error = error
|
local error = error
|
||||||
local print = print
|
local print = print
|
||||||
local printf = printf
|
local printf = printf
|
||||||
|
local tonumber = tonumber
|
||||||
local type = type
|
local type = type
|
||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
|
|
||||||
local bit = require("bit")
|
local bit = require("bit")
|
||||||
local math = require("math")
|
local math = require("math")
|
||||||
|
local string = require("string")
|
||||||
local min, max = math.min, math.max
|
local min, max = math.min, math.max
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ function shadexfog.test_nearcolor()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Change the .pal member of all sector ceilings/floors, walls and sprites to
|
-- Change the .pal member of all sector ceilings/floors, walls and sprites to
|
||||||
-- <pal>.
|
-- <palnum>.
|
||||||
function shadexfog.challpal(palnum)
|
function shadexfog.challpal(palnum)
|
||||||
for i=0,gv.numsectors-1 do
|
for i=0,gv.numsectors-1 do
|
||||||
sector[i].ceilingpal = palnum
|
sector[i].ceilingpal = palnum
|
||||||
|
@ -410,7 +412,8 @@ function shadexfog.create_additive_trans(startblendidx, numtables, fullbrightsOK
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Mapster32 Lua menu hooks
|
--========== Mapster32 Lua menu hooks ==========--
|
||||||
|
|
||||||
local getnumber16 = engine.getnumber16
|
local getnumber16 = engine.getnumber16
|
||||||
local GNF = engine.GETNUMFLAG
|
local GNF = engine.GETNUMFLAG
|
||||||
local GNF_BOOL = GNF.NEXTFREE
|
local GNF_BOOL = GNF.NEXTFREE
|
||||||
|
@ -422,7 +425,7 @@ local MAXUSERPALOOKUP = 256-1-8 -- KEEPINSYNC engine.lua:check_palidx()
|
||||||
-- wrapped_func = CreateMenuFunction(argdesc)
|
-- wrapped_func = CreateMenuFunction(argdesc)
|
||||||
--
|
--
|
||||||
-- <argdesc>: table with [0]=<func> and then, entries { name, init, max [, noret] }
|
-- <argdesc>: table with [0]=<func> and then, entries { name, init, max [, noret] }
|
||||||
function CreateMenuFunction(argdesc)
|
local function CreateMenuFunction(argdesc)
|
||||||
return function()
|
return function()
|
||||||
local func = argdesc[0]
|
local func = argdesc[0]
|
||||||
assert(type(func) == "function")
|
assert(type(func) == "function")
|
||||||
|
@ -446,6 +449,20 @@ function CreateMenuFunction(argdesc)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Replace chevrons (angle brackets!) with printext16 markup.
|
||||||
|
local function replchev(matchstr) return "^15"..matchstr:sub(2,-2).."^O" end
|
||||||
|
-- Replace ASCII code escapes like \XXX. We can't use these escapes in Lua [[ ... ]] strings.
|
||||||
|
local function replascii(matchstr) return string.char(tonumber(matchstr)) end
|
||||||
|
-- Format a whole string for the menu system:
|
||||||
|
local function formatHelp(str)
|
||||||
|
return str:gsub(
|
||||||
|
"(%b<>)", replchev):gsub(
|
||||||
|
"%*(.-)%*", "^014%1^O"):gsub(
|
||||||
|
"%\\(%d+)", replascii)
|
||||||
|
end
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
engine.clearMenu()
|
engine.clearMenu()
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -456,7 +473,19 @@ engine.registerMenuFunc(
|
||||||
{ "Red fog color [0-63]", 0, 63 },
|
{ "Red fog color [0-63]", 0, 63 },
|
||||||
{ "Green fog color [0-63]", 0, 63 },
|
{ "Green fog color [0-63]", 0, 63 },
|
||||||
{ "Blue fog color [0-63]", 0, 63 },
|
{ "Blue fog color [0-63]", 0, 63 },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.create(startpalnum, fogr, fogg, fogb)>
|
||||||
|
<_______________________________________________>
|
||||||
|
|
||||||
|
Creates 32 shade tables corresponding to different *shade levels*
|
||||||
|
of a fog palookup, together called a *shade-x-fog* palookup set.
|
||||||
|
|
||||||
|
Pals <startpalnum> to <startpalnum>+31 will be taken.
|
||||||
|
<fogr>, <fogg>, <fogb>: intensities of the fog color, [0 .. 63]
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -466,7 +495,26 @@ engine.registerMenuFunc(
|
||||||
{ "Starting palnum", 100, MAXUSERPALOOKUP-31 },
|
{ "Starting palnum", 100, MAXUSERPALOOKUP-31 },
|
||||||
{ "Fog intensity [0-31]", 0, 31 },
|
{ "Fog intensity [0-31]", 0, 31 },
|
||||||
{ "Change all sectors' visibility to (Esc: don't)", 0, 255, GNF.NEG_ALLOWED },
|
{ "Change all sectors' visibility to (Esc: don't)", 0, 255, GNF.NEG_ALLOWED },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.translate(startpalnum, fogintensity [, vis])>
|
||||||
|
<______________________________________________________>
|
||||||
|
|
||||||
|
Translates the whole map for use with a shade-x-fog palookup set.
|
||||||
|
|
||||||
|
.pal becomes the <startpalnum> + former .shade
|
||||||
|
.shade becomes the <fogintensity> [0 .. 31]
|
||||||
|
|
||||||
|
If <vis> is passed and >= 0, set all sector's visibility to that
|
||||||
|
value.
|
||||||
|
|
||||||
|
*Notes:*
|
||||||
|
- auto-detects when the translation has been applied with the *same*
|
||||||
|
<startpalnum> (if a different one is desired, must reload map).
|
||||||
|
- if shades > 31 or < 0 present, there is loss of information
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -474,7 +522,16 @@ engine.registerMenuFunc(
|
||||||
CreateMenuFunction{
|
CreateMenuFunction{
|
||||||
[0] = shadexfog.challpal,
|
[0] = shadexfog.challpal,
|
||||||
{ "Pal to change to", 0, MAXUSERPALOOKUP },
|
{ "Pal to change to", 0, MAXUSERPALOOKUP },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.challpal(palnum)>
|
||||||
|
<__________________________>
|
||||||
|
|
||||||
|
Changes the .pal member of all sector ceilings/floors, walls and
|
||||||
|
sprites to <palnum>.
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -484,7 +541,23 @@ engine.registerMenuFunc(
|
||||||
{ "Starting blendnum", 1, 255 },
|
{ "Starting blendnum", 1, 255 },
|
||||||
{ "Number of blending tables", 32, 255 },
|
{ "Number of blending tables", 32, 255 },
|
||||||
{ "Fullbright result colors OK?", 0, 1, GNF_BOOL },
|
{ "Fullbright result colors OK?", 0, 1, GNF_BOOL },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[=[
|
||||||
|
<shadexfog.create_alpha_trans(startblend [, numtables [, fullbriOK]])>
|
||||||
|
<____________________________________________________________________>
|
||||||
|
|
||||||
|
Creates <numtables> blending tables of smooth alpha translucency,
|
||||||
|
starting with the blending number <startblend>, with fractions
|
||||||
|
|
||||||
|
1/(2\255<numtables>), 2/(2\255<numtables>) ... <numtables>/(2\255<numtables>).
|
||||||
|
|
||||||
|
<numtables> must be a power of two in [1 .. 128].
|
||||||
|
|
||||||
|
<fullbriOK>: should fullbright color indices (>= 240) be permitted as
|
||||||
|
the blending result of two color indices?
|
||||||
|
]=]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -494,7 +567,23 @@ engine.registerMenuFunc(
|
||||||
{ "Starting blendnum", 1, 255 },
|
{ "Starting blendnum", 1, 255 },
|
||||||
{ "Number of blending tables", 32, 255 },
|
{ "Number of blending tables", 32, 255 },
|
||||||
{ "Fullbright result colors OK?", 0, 1, GNF_BOOL },
|
{ "Fullbright result colors OK?", 0, 1, GNF_BOOL },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[=[
|
||||||
|
<shadexfog.create_additive_trans(startbl [, numtables [, fullbriOK]])>
|
||||||
|
<____________________________________________________________________>
|
||||||
|
|
||||||
|
Creates <numtables> blending tables of smooth additive translucency,
|
||||||
|
starting with the blending number <startbl>, with fractions
|
||||||
|
|
||||||
|
1/(2\255<numtables>), 2/(2\255<numtables>) ... <numtables>/(2\255<numtables>).
|
||||||
|
|
||||||
|
<numtables> must be a power of two in [1 .. 128].
|
||||||
|
|
||||||
|
<fullbriOK>: should fullbright color indices (>= 240) be permitted as
|
||||||
|
the blending result of two color indices?
|
||||||
|
]=]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -503,7 +592,20 @@ engine.registerMenuFunc(
|
||||||
[0] = shadexfog.create0,
|
[0] = shadexfog.create0,
|
||||||
{ "Pal number", 100, MAXUSERPALOOKUP },
|
{ "Pal number", 100, MAXUSERPALOOKUP },
|
||||||
{ "Second attempt?", 1, 1, GNF_BOOL },
|
{ "Second attempt?", 1, 1, GNF_BOOL },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.create0(palnum, secver)>
|
||||||
|
<_________________________________>
|
||||||
|
|
||||||
|
Creates our version of the base shade table at set it to palookup
|
||||||
|
number <palnum>.
|
||||||
|
|
||||||
|
<secver>: use second attempt instead of the first? This one is more
|
||||||
|
similar to the base shade table shipped with Duke3D, but still
|
||||||
|
shows significant differences.
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -511,7 +613,19 @@ engine.registerMenuFunc(
|
||||||
CreateMenuFunction{
|
CreateMenuFunction{
|
||||||
[0] = shadexfog.create_depth_shtab,
|
[0] = shadexfog.create_depth_shtab,
|
||||||
{ "Pal number", 100, MAXUSERPALOOKUP },
|
{ "Pal number", 100, MAXUSERPALOOKUP },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.create_depth_shtab(palnum)>
|
||||||
|
<____________________________________>
|
||||||
|
|
||||||
|
Creates a shade table for debugging purposes at pal <palnum>.
|
||||||
|
|
||||||
|
For every color index, the shade table maps shade index <i> to
|
||||||
|
color index <i> (of the first ramp of gray colors, assuming Build
|
||||||
|
has loaded a base shade table with 32 shade levels).
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -519,7 +633,20 @@ engine.registerMenuFunc(
|
||||||
CreateMenuFunction{
|
CreateMenuFunction{
|
||||||
[0] = shadexfog.create_vismarker_shtab,
|
[0] = shadexfog.create_vismarker_shtab,
|
||||||
{ "Pal number", 100, MAXUSERPALOOKUP },
|
{ "Pal number", 100, MAXUSERPALOOKUP },
|
||||||
}
|
},
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.create_vismarker_shtab(palnum)>
|
||||||
|
<________________________________________>
|
||||||
|
|
||||||
|
Creates a shade table for debugging purposes at pal <palnum>.
|
||||||
|
|
||||||
|
For every color index, the shade table maps shade index 1 to
|
||||||
|
a ^14bright yellow^O color and shade index 30 to a ^13purple^O color.
|
||||||
|
Thus, it can be useful in visualizing the limits of the
|
||||||
|
fog/visibility attenuation.
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -543,7 +670,31 @@ engine.registerMenuFunc(
|
||||||
end
|
end
|
||||||
|
|
||||||
shadexfog.createremap(palnum, remaptab)
|
shadexfog.createremap(palnum, remaptab)
|
||||||
end
|
end,
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.createremap(palnum, remaptab)>
|
||||||
|
<_______________________________________>
|
||||||
|
|
||||||
|
Creates a color index remapping expressed as mappings of sexdecatuples
|
||||||
|
(16-tuples) of the base palette at pal <palnum>.
|
||||||
|
|
||||||
|
Duke3D's default base palette can be considered to consist of six
|
||||||
|
ramps of 32 colors each, three ramps of 16 colors each and a
|
||||||
|
remaining fullbright color set. The sexdecatuples are as follows:
|
||||||
|
|
||||||
|
< 0, 1>: gray ramp
|
||||||
|
< 2, 3>: skin color ramp
|
||||||
|
< 5, 4>: blue ramp (note that the 16-tuples are in reverse order)
|
||||||
|
< 6, 7>: nightvision yellow/green
|
||||||
|
< 8, 13>: red ramp
|
||||||
|
< 10, 11>: almost gray ramp, but with a slight red hue
|
||||||
|
|
||||||
|
< 9>: yellow (slightly more red than green)
|
||||||
|
< 12>: "dirty" orange
|
||||||
|
< 14>: blue-purple-red
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -580,7 +731,20 @@ engine.registerMenuFunc(
|
||||||
end
|
end
|
||||||
|
|
||||||
shadexfog.save(filename, palnum, blendnum, moreblends)
|
shadexfog.save(filename, palnum, blendnum, moreblends)
|
||||||
end
|
end,
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.save(filename, palnum, blendnum, moreblends)>
|
||||||
|
<______________________________________________________>
|
||||||
|
|
||||||
|
Writes out a full PALETTE.DAT-formatted file named <filename> with the
|
||||||
|
base shade table numbered <palnum> and the base translucency table
|
||||||
|
numbered <blendnum>.
|
||||||
|
|
||||||
|
Finally, you are asked to specify additional blending tables that can
|
||||||
|
be stored in EDuke32's extended PALETTE.DAT format.
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc(
|
engine.registerMenuFunc(
|
||||||
|
@ -590,12 +754,66 @@ engine.registerMenuFunc(
|
||||||
if (filename ~= nil and filename ~= "") then
|
if (filename ~= nil and filename ~= "") then
|
||||||
shadexfog.saveLookupDat(filename)
|
shadexfog.saveLookupDat(filename)
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
|
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<shadexfog.saveLookupDat(filename)>
|
||||||
|
<_________________________________>
|
||||||
|
|
||||||
|
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
|
||||||
|
LOOKUP.DAT.
|
||||||
|
|
||||||
|
<filename>: the name of the LOOKUP.DAT-formatted file to create
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
engine.registerMenuFunc("_________DEBUG_________", function() end)
|
engine.registerMenuFunc("_________DEBUG_________", function() end
|
||||||
engine.registerMenuFunc("Setup dbg. water basepal", engine.setupDebugBasePal)
|
--[[
|
||||||
engine.registerMenuFunc("Linearize default basep.", engine.linearizeBasePal)
|
,
|
||||||
|
" \01\02\03\04\05\06\07\08\09\10\11\12\13\14\15\
|
||||||
|
\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31\
|
||||||
|
\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143\
|
||||||
|
\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159\
|
||||||
|
\160\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175\
|
||||||
|
\176\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191\
|
||||||
|
\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207\
|
||||||
|
\208\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223\
|
||||||
|
\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239\
|
||||||
|
\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255"
|
||||||
|
--]]
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.registerMenuFunc("Setup dbg. water basepal", engine.setupDebugBasePal,
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<engine.setupDebugBasePal()>
|
||||||
|
<__________________________>
|
||||||
|
|
||||||
|
Overwrites the water base palette with one where each 16-tuple
|
||||||
|
(except the fullbrights) consists of a single representative
|
||||||
|
color.
|
||||||
|
|
||||||
|
This can be used to get a quick glimpse about what ramps are present
|
||||||
|
in particular tiles. With this information, custom lookups can be
|
||||||
|
created more directedly with the <Create c.index remapping> menu
|
||||||
|
entry.
|
||||||
|
]]
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.registerMenuFunc("Linearize default basep.", engine.linearizeBasePal,
|
||||||
|
formatHelp
|
||||||
|
[[
|
||||||
|
<engine.linearizeBasePal()>
|
||||||
|
<_________________________>
|
||||||
|
|
||||||
|
Overwrites the default base palette with one where certain ramps have
|
||||||
|
their attenuation linearized. This is mainly useful for debugging
|
||||||
|
purposes as it excludes the effect of this nonlinearity for
|
||||||
|
comparison of fog/visibility between classic and OpenGL modes.
|
||||||
|
]]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in a new issue