mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-23 12:22:42 +00:00
c08a0aa139
try to appease msvc6, just because. update the downloads menu. now even betterer!... fix proquake server angle snapping precision issue. also accept _glow textures as an alternative to the more standard _luma. compat for dp_water shader terms. tcgen stuff is still fscked up. menu tooltip code can now properly deal with variable width etc stuff. add missing te_flamejet builtin. r_dynamic -1 can now cope with q3bsp for a small speedup. added -watch commandline arg, to make it easier to figure out where cvar changes are coming from. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5015 fc73d0e0-1445-4013-8a0c-d673dee63da5
68 lines
3 KiB
C++
68 lines
3 KiB
C++
nonstatic void(mitem_desktop desktop) M_Options_Hud =
|
|
{
|
|
local float i;
|
|
local float h;
|
|
mitem_exmenu m;
|
|
m = spawn(mitem_exmenu, item_text:_("Hud Configurations"), item_flags:IF_SELECTABLE, item_command:"m_options");
|
|
desktop.add(m, RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_PARENT_MAX, '0 0', '0 0');
|
|
desktop.item_focuschange(m, IF_KFOCUSED);
|
|
m.totop();
|
|
|
|
h = 200;
|
|
h *= 0.5; //and halve it
|
|
|
|
//draw title art above the options
|
|
mitem_pic banner = spawn(mitem_pic, item_text:"gfx/p_option.lmp", item_size_y:24, item_flags:IF_CENTERALIGN);
|
|
m.add(banner, RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [banner.item_size_x*-0.5, -h-32], [banner.item_size_x*0.5, -h-8]);
|
|
|
|
//spawn a container frame for the actual options. this provides a scrollbar if we have too many items.
|
|
mitem_frame fr = spawn(mitem_frame, item_flags: IF_SELECTABLE, frame_hasscroll:TRUE);
|
|
m.add(fr, RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MAX|RS_Y_MAX_OWN_MIN, [0, -h], [0, h*2]);
|
|
|
|
float fs = search_begin("huds/*.cfg", TRUE, TRUE);
|
|
float fc = search_getsize(fs);
|
|
|
|
float y = 0;
|
|
string fname = "huds/hud_default.cfg";
|
|
string iname = "Default";
|
|
string dname = iname;
|
|
if ((int)whichpack(fname))
|
|
{
|
|
dname = GetFirstLineComment(fname, iname);
|
|
fr.add(spawn(mitem_text, item_text:dname, item_command:sprintf("set plug_sbar 3; cvarreset hud_*; exec \"%s\"; hud_recalculate", fname), item_scale:16, item_flags:IF_CENTERALIGN), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_OWN_MIN, [0, y], [0, 16]);
|
|
}
|
|
else
|
|
fr.add(spawn(mitem_text, item_text:dname, item_command:"cvarreset hud_*; set plug_sbar 0", item_scale:16, item_flags:IF_CENTERALIGN), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_OWN_MIN, [0, y], [0, 16]);
|
|
y += 16;
|
|
|
|
//add the options
|
|
for (i = 0; i < fc; i++)
|
|
{
|
|
fname = search_getfilename(fs, i);
|
|
iname = substring(fname, 5, -5);
|
|
if (iname == "hud_default")
|
|
continue;
|
|
if (substring(fname, 0, 4) == "hud_")
|
|
iname = substring(fname, 4, -1);
|
|
dname = GetFirstLineComment(fname, iname);
|
|
// print(sprintf("\"%s\" \"%s\" - \"%s\"\n", fname, iname, dname));
|
|
if (dname)
|
|
{
|
|
fr.add(spawn(mitem_text, item_text:dname, item_command:sprintf("set plug_sbar 3; cvarreset hud_*; exec \"%s\"; hud_recalculate", fname), item_scale:16, item_flags:IF_CENTERALIGN), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_OWN_MIN, [0, y], [0, 16]);
|
|
y += 16;
|
|
}
|
|
}
|
|
search_end(fs);
|
|
|
|
|
|
//random art for style
|
|
#if 1//def CSQC
|
|
m.addm(spawn (mitem_spinnymodel, item_text: "progs/g_nail2.mdl", zbias:-16), [-160-60, 12*-16/2], [-60, 12*16/2]);
|
|
#else
|
|
//menuqc doesn't support entities. shove some random crappy static image there instead.
|
|
local mitem_pic plaque = spawn (mitem_pic, item_text:"gfx/qplaque.lmp", item_alpha:1);
|
|
m.addm(plaque, [(-160-plaque.item_size_x)*0.5, 12*-16/2], [(-160+plaque.item_size_x)*0.5, 12*16/2]);
|
|
#endif
|
|
|
|
addmenuback(m);
|
|
};
|