mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-21 19:41:14 +00:00
Clean up menusys. Fix up some incompatibilities with QSS.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5719 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
856cad09cc
commit
dc81386ee6
16 changed files with 120 additions and 155 deletions
|
@ -107,7 +107,7 @@ void(float width, float height, float do2d) CSQC_UpdateView =
|
|||
{
|
||||
if (!thedesktop)
|
||||
thedesktop = spawn(mydesktop);
|
||||
items_draw(thedesktop);
|
||||
items_draw(thedesktop, [width, height]);
|
||||
};
|
||||
//void(float width, float height, float do2d) CSQC_UpdateView_Loading = CSQC_UpdateView;
|
||||
|
||||
|
||||
|
|
|
@ -57,14 +57,6 @@ void(mitem_desktop desktop) M_Pop =
|
|||
cmd("m_reset", M_Reset, ) \
|
||||
cmd("m_preset", M_Preset, menu/presets.qc)
|
||||
|
||||
|
||||
#if 0
|
||||
#append concommandslist cmd("m_servers", M_Servers, menu/servers.qc)
|
||||
#define serverbrowser "m_servers"
|
||||
#else
|
||||
#define serverbrowser "menu_servers"
|
||||
#endif
|
||||
|
||||
//make sure all the right files are included
|
||||
#define cmd(n,fnc,inc) inc
|
||||
#includelist
|
||||
|
@ -78,7 +70,7 @@ void(vector screensize) m_draw =
|
|||
{
|
||||
if (dp_workarounds)
|
||||
cltime = gettime(0);
|
||||
items_draw(desktop);
|
||||
items_draw(desktop, screensize);
|
||||
};
|
||||
void(float scan, float chr) m_keydown = {items_keypress(desktop, scan, chr, TRUE);};
|
||||
void(float scan, float chr) m_keyup = {items_keypress(desktop, scan, chr, FALSE);};
|
||||
|
|
|
@ -213,7 +213,12 @@ class cvarsmenu : mitem_exmenu
|
|||
virtual void(string key, string newval) set =
|
||||
{
|
||||
if (key == "*filter")
|
||||
filter = newval;
|
||||
{
|
||||
string old = filter;
|
||||
filter = strzone(newval);
|
||||
if (old)
|
||||
strunzone(old);
|
||||
}
|
||||
else if (key == "*modified")
|
||||
modifiedonly = stof(newval);
|
||||
else
|
||||
|
|
|
@ -25,27 +25,34 @@ nonstatic void(mitem_frame m) addmenuback =
|
|||
helper functions to avoid blowing up in older clients.
|
||||
|
||||
*/
|
||||
#define dp(dpc,qwc) (cvar_type(dpc)?dpc:qwc)
|
||||
float(string cmd) assumetruecheckcommand =
|
||||
#define cv2(dpc,qwc) (cvar_type(dpc)?dpc:qwc)
|
||||
#define cv3(dpc,qs,qwc) (cvar_type(dpc)?dpc:(cvar_type(qs)?qs:qwc))
|
||||
#ifdef CSQC
|
||||
#define ISMENUQC FALSE
|
||||
#else
|
||||
#define ISMENUQC TRUE
|
||||
#endif
|
||||
float(string cmd, float assumption) checkcommand2 =
|
||||
{
|
||||
if (!checkextension("FTE_QC_CHECKCOMMAND"))
|
||||
return TRUE;
|
||||
return assumption;
|
||||
return checkcommand(cmd);
|
||||
};
|
||||
float(string cmd) assumefalsecheckcommand =
|
||||
{
|
||||
if (!checkextension("FTE_QC_CHECKCOMMAND"))
|
||||
return FALSE;
|
||||
return checkcommand(cmd);
|
||||
};
|
||||
|
||||
float(__variant cmd, float assumption) checkbuiltin2 =
|
||||
{
|
||||
if (!checkbuiltin(checkbuiltin)) //teehee
|
||||
if (!checkbuiltin(checkbuiltin)) //teehee. if the #0 stuff isn't working (DP) then it ends up calling an OP_DONE(0) instruction giving a return false.
|
||||
return assumption;
|
||||
return checkbuiltin(cmd);
|
||||
};
|
||||
|
||||
#ifdef CSQC
|
||||
float() clientstate =
|
||||
{
|
||||
if (serverkey("constate") != "disconnected")
|
||||
return 2;
|
||||
return 1;
|
||||
};
|
||||
#endif
|
||||
|
||||
nonstatic void(mitem_desktop desktop) M_Main =
|
||||
{
|
||||
|
@ -79,37 +86,26 @@ nonstatic void(mitem_desktop desktop) M_Main =
|
|||
//a macro, in a desperate attempt at readability
|
||||
#define menuitemtext_cladd16(m,t,c,y) m.addm(spawn(mitem_text, item_text:t, item_command:c, item_scale:16, item_flags:IF_CENTERALIGN), [0, y], [160, y+16])
|
||||
|
||||
#ifdef CSQC
|
||||
if (serverkey("constate") != "disconnected") {menuitemtext_cladd16(m, _("Return To Game"), "m_pop", y); y += 16;}
|
||||
if (serverkey("constate") != "disconnected") {menuitemtext_cladd16(m, isserver?_("End Game"):_("Disconnect"),"m_pop;disconnect", y); y += 16;} else
|
||||
#endif
|
||||
#ifdef CSQC
|
||||
if (checkextension("FTE_CSQC_SERVERBROWSER"))
|
||||
#endif
|
||||
{menuitemtext_cladd16(m, _("Join Server"), "m_pop;m_servers", y); y += 16;}
|
||||
if (assumetruecheckcommand("map")) {menuitemtext_cladd16(m, _("New Game"), "m_pop;m_newgame", y); y += 16;}
|
||||
if (assumefalsecheckcommand("menu_demo")) {menuitemtext_cladd16(m, _("Demos"), "m_pop;menu_demo", y); y += 16;}
|
||||
if (assumetruecheckcommand("save") && (isserver()||dp_workarounds)) {menuitemtext_cladd16(m, _("Save"), "m_pop;m_save", y); y += 16;}
|
||||
if (assumetruecheckcommand("load")) {menuitemtext_cladd16(m, _("Load"), "m_pop;m_load", y); y += 16;}
|
||||
if (assumefalsecheckcommand("cef")) {menuitemtext_cladd16(m, _("Browser"), "m_pop;cef google.com", y); y += 16;}
|
||||
if (assumefalsecheckcommand("xmpp")) {menuitemtext_cladd16(m, _("Social"), "m_pop;xmpp", y); y += 16;}
|
||||
if (assumefalsecheckcommand("irc")) {menuitemtext_cladd16(m, _("IRC"), "m_pop;irc /info", y); y += 16;}
|
||||
if (clientstate() == 2) {menuitemtext_cladd16(m, _("Return To Game"), "m_pop", y); y += 16;}
|
||||
if (clientstate() == 2) {menuitemtext_cladd16(m, isserver?_("End Game"):_("Disconnect"),"m_pop;disconnect", y); y += 16;}
|
||||
if (isserver() != 1 && checkbuiltin2(gethostcacheindexforkey,ISMENUQC)) {menuitemtext_cladd16(m, _("Join Server"), "m_pop;m_servers", y); y += 16;}
|
||||
if (checkcommand2("map", TRUE)) {menuitemtext_cladd16(m, _("New Game"), "m_pop;m_newgame", y); y += 16;}
|
||||
if (checkcommand2("menu_demo", FALSE)) {menuitemtext_cladd16(m, _("Demos"), "m_pop;menu_demo", y); y += 16;}
|
||||
if (checkcommand2("save", TRUE) && (isserver()||dp_workarounds)) {menuitemtext_cladd16(m, _("Save"), "m_pop;m_save", y); y += 16;}
|
||||
if (checkcommand2("load", TRUE)) {menuitemtext_cladd16(m, _("Load"), "m_pop;m_load", y); y += 16;}
|
||||
if (checkcommand2("cef", FALSE)) {menuitemtext_cladd16(m, _("Browser"), "m_pop;cef google.com", y); y += 16;}
|
||||
if (checkcommand2("xmpp", FALSE)) {menuitemtext_cladd16(m, _("Social"), "m_pop;xmpp", y); y += 16;}
|
||||
if (checkcommand2("irc", FALSE)) {menuitemtext_cladd16(m, _("IRC"), "m_pop;irc /info", y); y += 16;}
|
||||
/*if (checkbuiltin2(getpackagemanagerinfo,FALSE)) {menuitemtext_cladd16(m, _("Updates+Packages"), "m_pop;m_updates", y); y += 16;}
|
||||
else*/ if (assumefalsecheckcommand("menu_download")) {menuitemtext_cladd16(m, _("Updates+Packages"), "m_pop;menu_download", y); y += 16;}
|
||||
if (assumefalsecheckcommand("qi")) {menuitemtext_cladd16(m, _("Quake Injector"), "m_pop;qi", y); y += 16;}
|
||||
else*/ if (checkcommand2("menu_download", FALSE)) {menuitemtext_cladd16(m, _("Updates+Packages"), "m_pop;menu_download", y); y += 16;}
|
||||
if (checkcommand2("qi", FALSE)) {menuitemtext_cladd16(m, _("Quake Injector"), "m_pop;qi", y); y += 16;}
|
||||
if (checkbuiltin2(getgamedirinfo,TRUE)) {menuitemtext_cladd16(m, _("Mods"), "m_pop;m_mods", y); y += 16;}
|
||||
{menuitemtext_cladd16(m, _("Options"), "m_pop;m_options", y); y += 16;}
|
||||
{menuitemtext_cladd16(m, _("Quit"), "m_pop;m_quit", y); y += 16;}
|
||||
|
||||
#if 1//def CSQC
|
||||
//spinny quad/pent, for the luls
|
||||
local string it = (random()<0.9)?"progs/quaddama.mdl":"progs/invulner.mdl";
|
||||
m.add(spawn (mitem_spinnymodel, item_text: it), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [-160, 12*-16/2], [0, 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);
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//FIXME: maxclients is a QW thing. NQ engines use maxplayers (which requires a disconnect to apply)
|
||||
static string newgameinfo;
|
||||
class mitem_newgame : mitem_exmenu
|
||||
{
|
||||
|
@ -23,7 +24,7 @@ nonstatic void(mitem_desktop desktop) M_NewGame =
|
|||
if (gametype == "sp")
|
||||
{
|
||||
//single player has no options. the start map itself gives skill+episode options.
|
||||
localcmd("\ndeathmatch 0; coop 0; maxplayers 0; timelimit 0; fraglimit 0; teamplay 0; samelevel 0; startmap_sp\n");
|
||||
localcmd("\ndisconnect; deathmatch 0; coop 0; maxplayers 0; timelimit 0; fraglimit 0; teamplay 0; samelevel 0; startmap_sp\n");
|
||||
return;
|
||||
}
|
||||
if (gametype == "begin")
|
||||
|
@ -77,11 +78,7 @@ nonstatic void(mitem_desktop desktop) M_NewGame =
|
|||
m.addm(spawn(mitem_text, item_text:"Deathmatch", item_command:"m_pop;m_newgame dm", item_scale:16, item_flags:IF_CENTERALIGN), [0, pos], [160, pos+16]); pos += 16;
|
||||
m.addm(spawn(mitem_text, item_text:"Team Deathmatch", item_command:"m_pop;m_newgame tdm", item_scale:16, item_flags:IF_CENTERALIGN), [0, pos], [160, pos+16]); pos += 16;
|
||||
|
||||
#if 1//def CSQC
|
||||
m.add(spawn (mitem_spinnymodel, item_text: "progs/soldier.mdl",firstframe:73, framecount:8, shootframe:81, shootframes:9), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [-160, 12*-16/2], [0, 12*16/2]);
|
||||
#else
|
||||
//need some art for menuqc
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -220,24 +217,11 @@ nonstatic void(mitem_desktop desktop) M_NewGame =
|
|||
|
||||
m.addm(spawn(mitem_text, item_text:"BEGIN!", item_command:"m_pop;m_newgame begin", item_scale:16, item_flags:IF_CENTERALIGN), [-160, pos], [160, pos+16]);
|
||||
|
||||
//random art for style
|
||||
if (gametype == "coop")
|
||||
{
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.add(spawn (mitem_spinnymodel, item_text: "progs/soldier.mdl", firstframe:73, framecount:8, shootframe:81, shootframes:9), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [-160, -240/2], [0, 240/2]);
|
||||
#else
|
||||
//need some art for menuqc
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.add(spawn (mitem_spinnymodel, item_text: "progs/player.mdl", firstframe:0, framecount:6, shootframe:119, shootframes:6), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [-160, 12*-16/2], [0, 12*16/2]);
|
||||
#else
|
||||
//need some art for menuqc
|
||||
#endif
|
||||
}
|
||||
|
||||
addmenuback(m);
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ nonstatic void(mitem_desktop desktop) M_Options =
|
|||
|
||||
|
||||
//and show the options.
|
||||
if (assumefalsecheckcommand("fps_preset"))
|
||||
if (checkcommand2("fps_preset", FALSE))
|
||||
{fr.add(spawn(mitem_text, item_text:"Graphical Presets", item_command:"m_pop;m_preset", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;}
|
||||
fr.add(spawn(mitem_text, item_text:"Game Configs", item_command:"m_pop;m_configs", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;
|
||||
fr.add(spawn(mitem_text, item_text:"Basic Setup", item_command:"m_pop;m_basicopts", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;
|
||||
|
@ -42,25 +42,19 @@ nonstatic void(mitem_desktop desktop) M_Options =
|
|||
fr.add(spawn(mitem_text, item_text:"Audio", item_command:"m_pop;m_audio", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;
|
||||
fr.add(spawn(mitem_text, item_text:"Video", item_command:"m_pop;m_video", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;
|
||||
fr.add(spawn(mitem_text, item_text:"Effects", item_command:"m_pop;m_effects", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;
|
||||
if (assumefalsecheckcommand("r_particledesc"))
|
||||
if (checkcommand2("r_particledesc", FALSE))
|
||||
{fr.add(spawn(mitem_text, item_text:"Particles", item_command:"m_pop;m_particles", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;}
|
||||
if (assumefalsecheckcommand("ezhud_nquake"))
|
||||
if (checkcommand2("ezhud_nquake", FALSE))
|
||||
{fr.add(spawn(mitem_text, item_text:"Hud", item_command:"m_pop;m_hud", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;}
|
||||
if (checkbuiltin2(buf_cvarlist, TRUE))
|
||||
{fr.add(spawn(mitem_text, item_text:"Advanced Guru Settings", item_command:"m_pop;m_cvars", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;}
|
||||
if (assumefalsecheckcommand("cvarreset"))
|
||||
if (checkcommand2("cvarreset", FALSE))
|
||||
{fr.add(spawn(mitem_text, item_text:"Reset to Defaults", item_command:"m_reset", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;}
|
||||
if (assumefalsecheckcommand("cfg_save"))
|
||||
if (checkcommand2("cfg_save", FALSE))
|
||||
{fr.add(spawn(mitem_text, item_text:"Save Settings", item_command:"cfg_save", item_scale:16, item_flags:IF_CENTERALIGN), fl, [0, pos], [0, 16]); pos += 16;}
|
||||
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.addm(spawn (mitem_spinnymodel, item_text: "progs/suit.mdl"), [0, 12*-16/2], [160, 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);
|
||||
};
|
||||
|
||||
|
@ -89,13 +83,7 @@ static void(mitem_desktop desktop, string question, string affirmitive, string a
|
|||
m.add(spawn(mitem_text, item_text:negative, item_command:negativeaction, item_scale:16, item_flags:IF_CENTERALIGN), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [-160, pos], [0, pos+16]); pos += 16;
|
||||
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.add(spawn (mitem_spinnymodel, item_text: "progs/suit.mdl"), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [0, 12*-16/2], [160, 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);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
class mitem_playerpreview : mitem_spinnymodel
|
||||
{
|
||||
#if 1//defined(FTE_QC_CUSTOMSKINS)
|
||||
virtual void(vector pos) item_draw =
|
||||
{
|
||||
//if you wanted to get more advanced, you could use q3 skins here.
|
||||
if (cvar("noskins"))
|
||||
setcustomskin(self, "", sprintf("q1upper \"%s\"\nq1lower \"%s\"\n\n", cvar_string("topcolor"), cvar_string("bottomcolor")));
|
||||
else if (cvar_string("cl_teamskin") != "")
|
||||
setcustomskin(self, "", sprintf("q1upper \"%s\"\nq1lower \"%s\"\nqwskin \"%s\"\n", cvar_string("topcolor"), cvar_string("bottomcolor"), cvar_string("cl_teamskin")));
|
||||
else
|
||||
setcustomskin(self, "", sprintf("q1upper \"%s\"\nq1lower \"%s\"\nqwskin \"%s\"\n", cvar_string("topcolor"), cvar_string("bottomcolor"), cvar_string("skin")));
|
||||
if (checkbuiltin2(setcustomskin, FALSE))
|
||||
{
|
||||
//if you wanted to get more advanced, you could use q3 skins here.
|
||||
if (cvar("noskins"))
|
||||
setcustomskin(self, "", sprintf("q1upper \"%s\"\nq1lower \"%s\"\n\n", cvar_string("topcolor"), cvar_string("bottomcolor")));
|
||||
else if (cvar_string("cl_teamskin") != "")
|
||||
setcustomskin(self, "", sprintf("q1upper \"%s\"\nq1lower \"%s\"\nqwskin \"%s\"\n", cvar_string("topcolor"), cvar_string("bottomcolor"), cvar_string("cl_teamskin")));
|
||||
else
|
||||
setcustomskin(self, "", sprintf("q1upper \"%s\"\nq1lower \"%s\"\nqwskin \"%s\"\n", cvar_string("topcolor"), cvar_string("bottomcolor"), cvar_string("skin")));
|
||||
}
|
||||
|
||||
super::item_draw(pos);
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
static string() skinopts =
|
||||
|
@ -106,7 +107,7 @@ nonstatic void(mitem_desktop desktop) M_Options_Basic =
|
|||
float pos = 0;
|
||||
|
||||
|
||||
fr.add(menuitemeditt_spawn(_("Player Name"), dp("_cl_name", "name"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemeditt_spawn(_("Player Name"), cv2("_cl_name", "name"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemeditt_spawn(_("Player Team"), "team", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Player Skin"), "skin", '280 8', skinopts()), fl, [0, pos], [0, 8]); pos += 8;
|
||||
|
||||
|
@ -119,9 +120,9 @@ nonstatic void(mitem_desktop desktop) M_Options_Basic =
|
|||
fr.add(menuitemslider_spawn(_("Sensitivity"), "sensitivity", '3 20 1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Fov"), "fov", '80 130 5', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Viewmodel Fov"), "r_viewmodel_fov", '80 130 5', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Gamma"), dp("v_gamma", "gamma"), '0.4 1.3 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Contrast"), dp("v_contrast", "contrast"), '0.8 1.8 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Brightness"), dp("v_brightness", "brightness"),'0.0 0.5 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Gamma"), cv2("v_gamma", "gamma"), '0.4 1.3 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Contrast"), cv2("v_contrast", "contrast"), '0.8 1.8 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Brightness"), cv2("v_brightness", "brightness"),'0.0 0.5 0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Crosshair"), "crosshair", '0.0 19 1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
|
||||
m.add(spawn (mitem_playerpreview, item_text: "progs/player.mdl", firstframe:0, framecount:6, shootframe:119, shootframes:6), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [-200, 12*-16/2], [-40, 12*16/2]);
|
||||
|
|
|
@ -44,13 +44,7 @@ nonstatic void(mitem_desktop desktop) M_Configs =
|
|||
fr.add(spawn(mitem_text, item_text:"No configs found", 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], '100 16');
|
||||
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.addm(spawn (mitem_spinnymodel, item_text: "progs/g_rock2.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);
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ nonstatic void(mitem_desktop desktop) M_Options_Effects =
|
|||
float fl = RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_OWN_MIN;
|
||||
float pos = 0;
|
||||
|
||||
fr.add(menuitemcheck_spawn(_("Show Framerate"), dp("showfps", "show_fps"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("Show Framerate"), cv3("showfps", "scr_showfps", "show_fps"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("Bloom"), "r_bloom", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("Simple Textures"), "r_drawflat", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("Paletted Rendering"), "r_softwarebanding", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
|
|
|
@ -56,13 +56,7 @@ nonstatic void(mitem_desktop desktop) M_Options_Hud =
|
|||
|
||||
|
||||
//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);
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ class options_video : mitem_exmenu
|
|||
string videomode;
|
||||
void() options_video =
|
||||
{
|
||||
videomode = strcat(super::get("vid_width"), "x", super::get("vid_height"));
|
||||
videomode = strzone(strcat(super::get("vid_width"), "x", super::get("vid_height")));
|
||||
};
|
||||
|
||||
virtual float(string key) isvalid =
|
||||
|
@ -36,10 +36,13 @@ class options_video : mitem_exmenu
|
|||
{
|
||||
if (key == "vid_mode")
|
||||
{
|
||||
videomode = newval;
|
||||
string old = videomode;
|
||||
videomode = strzone(newval);
|
||||
tokenizebyseparator(newval, "x");
|
||||
super::set("vid_width", argv(0));
|
||||
super::set("vid_height", argv(1));
|
||||
if (old)
|
||||
strunzone(old);
|
||||
}
|
||||
else
|
||||
super::set(key, newval);
|
||||
|
@ -83,33 +86,42 @@ nonstatic void(mitem_desktop desktop) M_Options_Video =
|
|||
{
|
||||
fr.add(menuitemcheck_spawn(_("Fullscreen"), "vid_fullscreen", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
}
|
||||
if (cvar_type("vid_resizable")) fr.add(menuitemcheck_spawn(_("Resizable"), "vid_resizable", '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Anti-Aliasing"), dp("vid_samples", "vid_multisample"), '280 8',
|
||||
if (cvar_type("vid_resizable")) fr.add(menuitemcheck_spawn(_("Resizable"), "vid_resizable", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Anti-Aliasing"), cv2("vid_samples", "vid_multisample"), '280 8',
|
||||
"0 \"Off\" "
|
||||
"2 \"2x\" "
|
||||
"4 \"4x\" "
|
||||
), fl, [0, pos], [0, 8]); pos += 8;
|
||||
|
||||
fr.add(menuitemcombo_spawn(_("Video Mode"), "vid_mode", '280 8', PrepareVideoModes()), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Video Zoom"), "vid_conautoscale", '280 8', _(
|
||||
"0 \"Default\" "
|
||||
"1.5 \"x1.5\" "
|
||||
"2 \"x2\" "
|
||||
"4 \"x4\" "
|
||||
)), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Colour Depth"), dp("vid_bitsperpixel", "vid_bpp"), '280 8', _(
|
||||
|
||||
static const string scaleoptions = _(
|
||||
"0 \"Default\" "
|
||||
"1.5 \"x1.5\" "
|
||||
"2 \"x2\" "
|
||||
"4 \"x4\" ");
|
||||
|
||||
if (cvar_type("vid_conautoscale"))
|
||||
fr.add(menuitemcombo_spawn(_("Video Zoom"), "vid_conautoscale", '280 8', scaleoptions), fl, [0, pos], [0, 8]), pos += 8;
|
||||
if (cvar_type("scr_conscale"))
|
||||
fr.add(menuitemcombo_spawn(_("Console Zoom"), "scr_conscale", '280 8', scaleoptions), fl, [0, pos], [0, 8]), pos += 8;
|
||||
if (cvar_type("scr_sbarscale"))
|
||||
fr.add(menuitemcombo_spawn(_("Sbar Zoom"), "scr_sbarscale", '280 8', scaleoptions), fl, [0, pos], [0, 8]), pos += 8;
|
||||
if (cvar_type("scr_menuscale"))
|
||||
fr.add(menuitemcombo_spawn(_("Menu Zoom"), "scr_menuscale", '280 8', scaleoptions), fl, [0, pos], [0, 8]), pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Colour Depth"), cv2("vid_bitsperpixel", "vid_bpp"), '280 8', _(
|
||||
"16 \"16bit\" " //r5g6b5, or so. unsupported on win10.
|
||||
"24 \"24bit\" " //rgba8 - we don't count the alpha.
|
||||
"30 \"30bit\" " //rgb10a2 - we don't count the alpha. unsupported on nvidia.
|
||||
"48 \"48bit\" " //half-floats - we don't count the alpha. unsupported on nvidia.
|
||||
)), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcombo_spawn(_("Refresh Rate"), "vid_displayfrequency", '280 8', _(
|
||||
fr.add(menuitemcombo_spawn(_("Refresh Rate"), cv2("vid_refreshrate"/*qs*/, "vid_displayfrequency"), '280 8', _(
|
||||
"0 \"Default\" "
|
||||
// "60 \"60\" "
|
||||
// "75 \"75\" "
|
||||
)), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("VSync"), dp("vid_vsync", "vid_wait"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("Show Framerate"), dp("showfps", "show_fps"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("VSync"), cv2("vid_vsync", "vid_wait"), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemcheck_spawn(_("Show Framerate"), cv3("showfps"/*dp*/, "scr_showfps"/*qs*/, "show_fps"/*id/qw*/), '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("View Size"), "viewsize", '50 120 10', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Field Of View"), "fov", '50 140 5', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
fr.add(menuitemslider_spawn(_("Gamma"), "gamma", '1.3 0.5 -0.1', '280 8'), fl, [0, pos], [0, 8]); pos += 8;
|
||||
|
|
|
@ -90,13 +90,7 @@ nonstatic void(mitem_desktop desktop) M_Preset =
|
|||
}
|
||||
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.addm(spawn (mitem_spinnymodel, item_text: "progs/suit.mdl"), [-160, 12*-16/2], [0, 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);
|
||||
};
|
||||
|
|
|
@ -35,12 +35,6 @@ nonstatic void(mitem_desktop desktop) M_Quit =
|
|||
}
|
||||
|
||||
//random art for style
|
||||
#if 1//def CSQC
|
||||
m.add(spawn (mitem_spinnymodel, item_text: "progs/suit.mdl"), RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [0, 12*-16/2], [160, 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);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -112,7 +112,7 @@ class mitem_servers : mitem
|
|||
|
||||
float sort = gethostcachevalue(SLIST_SORTFIELD);
|
||||
string colkey = __NULL__;
|
||||
#define COLUMN(width, sortname, title, draw) if (autocvar_sb_show##sortname) {if (ui.mousepos[0] > pos_x && ui.mousepos[1] < pos_y+8) colkey = #sortname; pos_x += width+8;}
|
||||
#define COLUMN(width, sortname, title, draw) if (field_##sortname<0) autocvar_sb_show##sortname = FALSE; if (autocvar_sb_show##sortname) {if (ui.mousepos[0] > pos_x && ui.mousepos[1] < pos_y+8) colkey = #sortname; pos_x += width+8;}
|
||||
COLUMNS
|
||||
#undef COLUMN
|
||||
|
||||
|
@ -358,7 +358,7 @@ nonstatic void(mitem_desktop desktop) M_Servers =
|
|||
{
|
||||
mitem_menu o;
|
||||
|
||||
if (assumefalsecheckcommand("menu_servers") && argv(1) != "force")
|
||||
if (checkcommand2("menu_servers", FALSE) && argv(1) != "force")
|
||||
{
|
||||
localcmd("menu_servers\n");
|
||||
return;
|
||||
|
@ -399,13 +399,23 @@ nonstatic void(mitem_desktop desktop) M_Servers =
|
|||
m.add(spawn(mitem_servers_players, listing:ls), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MAX|RS_Y_MAX_PARENT_MAX, [8*20, -8*8], [0, -8*0]);
|
||||
m.add(sl, RS_X_MIN_PARENT_MAX|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_PARENT_MAX, [-16, 8], [0, -68]);
|
||||
|
||||
m.add(menuitemcheck_spawn(_("Ping"), "sb_showping", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*8], [8*20, -8*7]);
|
||||
m.add(menuitemcheck_spawn(_("Address"), "sb_showaddress", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*7], [8*20, -8*6]);
|
||||
m.add(menuitemcheck_spawn(_("Map"), "sb_showmap", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*6], [8*20, -8*5]);
|
||||
m.add(menuitemcheck_spawn(_("Gamedir"), "sb_showgamedir", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*5], [8*20, -8*4]);
|
||||
m.add(menuitemcheck_spawn(_("NumPlayers"), "sb_shownumplayers", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*4], [8*20, -8*3]);
|
||||
m.add(menuitemcheck_spawn(_("MaxPlayers"), "sb_showmaxplayers", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*3], [8*20, -8*2]);
|
||||
m.add(menuitemcheck_spawn(_("Fraglimit"), "sb_showfraglimit", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*2], [8*20, -8*1]);
|
||||
m.add(menuitemcheck_spawn(_("Timelimit"), "sb_showtimelimit", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*1], [8*20, -8*0]);
|
||||
//only add checkboxes for field names accepted by this engine.
|
||||
if (gethostcacheindexforkey("ping") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("Ping"), "sb_showping", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*8], [8*20, -8*7]);
|
||||
if (gethostcacheindexforkey("cname") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("Address"), "sb_showaddress", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*7], [8*20, -8*6]);
|
||||
if (gethostcacheindexforkey("map") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("Map"), "sb_showmap", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*6], [8*20, -8*5]);
|
||||
if (gethostcacheindexforkey("gamedir") >= 0 || gethostcacheindexforkey("mod") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("Gamedir"), "sb_showgamedir", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*5], [8*20, -8*4]);
|
||||
if (gethostcacheindexforkey("numplayers") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("NumPlayers"), "sb_shownumplayers", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*4], [8*20, -8*3]);
|
||||
if (gethostcacheindexforkey("maxplayers") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("MaxPlayers"), "sb_showmaxplayers", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*3], [8*20, -8*2]);
|
||||
if (gethostcacheindexforkey("fraglimit") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("Fraglimit"), "sb_showfraglimit", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*2], [8*20, -8*1]);
|
||||
if (gethostcacheindexforkey("timelimit") >= 0)
|
||||
m.add(menuitemcheck_spawn(_("Timelimit"), "sb_showtimelimit", [8*8, 8]), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MAX | RS_X_MAX_PARENT_MIN|RS_Y_MAX_PARENT_MAX, [0, -8*1], [8*20, -8*0]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ void(float force) items_updategrabs =
|
|||
}
|
||||
};
|
||||
|
||||
void(mitem_desktop desktop) items_draw =
|
||||
void(mitem_desktop desktop, vector screensize) items_draw =
|
||||
{
|
||||
queryscreensize();
|
||||
|
||||
|
@ -346,8 +346,10 @@ csqconly float(mitem_desktop desktop, float evtype, float scanx, float chary, fl
|
|||
{
|
||||
case IE_KEYDOWN:
|
||||
case IE_KEYUP:
|
||||
if (scanx == K_SHIFT)
|
||||
ui.shiftheld = evtype==IE_KEYDOWN;
|
||||
if (scanx == K_LSHIFT)
|
||||
ui.shiftheld = ((evtype==IE_KEYDOWN)?ui.shiftheld|1:ui.shiftheld&~1);
|
||||
if (scanx == K_RSHIFT)
|
||||
ui.shiftheld = ((evtype==IE_KEYDOWN)?ui.shiftheld|2:ui.shiftheld&~2);
|
||||
#ifdef HEIRACHYDEBUG
|
||||
if (scanx == K_F1 && evtype == IE_KEYDOWN)
|
||||
{
|
||||
|
|
|
@ -156,7 +156,7 @@ void(vector pos) mitem_grid::item_draw =
|
|||
|
||||
clientpos = pos;
|
||||
clientsize = this.item_size;
|
||||
/*
|
||||
|
||||
if (vslider)
|
||||
{
|
||||
//scroll+shrink the client area to fit the slider on it.
|
||||
|
@ -186,11 +186,10 @@ void(vector pos) mitem_grid::item_draw =
|
|||
if (pos_x+clientsize_x < ui.drawrectmax[0])
|
||||
ui.drawrectmax[0] = pos_x+clientsize_x;
|
||||
if (pos_y+clientsize_y < ui.drawrectmax[1])
|
||||
ui.drawrectmax[1] = pos_y+clientsize[1];*/
|
||||
// if (ui.drawrectmax[0] > ui.drawrectmin[0] && ui.drawrectmax[1] > ui.drawrectmin[1])
|
||||
ui.drawrectmax[1] = pos_y+clientsize[1];
|
||||
if (ui.drawrectmax[0] > ui.drawrectmin[0] && ui.drawrectmax[1] > ui.drawrectmin[1])
|
||||
{
|
||||
ui.setcliparea(ui.drawrectmin[0], ui.drawrectmin[1], ui.drawrectmax[0] - ui.drawrectmin[0], ui.drawrectmax[1] - ui.drawrectmin[1]);
|
||||
//ui.setcliparea(0, 0, 0, 0);
|
||||
|
||||
float c = max(0,floor((ui.drawrectmin[1]-clientpos_y)/item_scale)); //calculate how many we can skip
|
||||
for (clientpos_y += item_scale * c; c < grid_numchildren; c++, clientpos_y += item_scale)
|
||||
|
@ -207,7 +206,7 @@ void(vector pos) mitem_grid::item_draw =
|
|||
vslider.item_draw(pos + [clientsize[0], 0]);
|
||||
}
|
||||
}
|
||||
// ui.drawrectmin = omin;
|
||||
// ui.drawrectmax = omax;
|
||||
ui.drawrectmin = omin;
|
||||
ui.drawrectmax = omax;
|
||||
};
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue