fteqw/quakec/menusys/menu.src
Spoike 27a59a0cbc LOTS OF CHANGES. was hoping to get revision 5000 perfect, but really that's never going to happen. this has gone on for too long now.
vulkan, wasapi, quake injector features added.
irc, avplug, cef plugins/drivers reworked/updated/added
openal reverb, doppler effects added.
'dir' console command now attempts to view clicked files.
lots of warning fixes, should now only be deprecation warnings for most targets (depending on compiler version anyway...).
SendEntity finally reworked to use flags properly.
effectinfo improved, other smc-targetted fixes.
mapcluster stuff now has support for linux.
.basebone+.baseframe now exist in ssqc.
qcc: -Fqccx supports qccx syntax, including qccx hacks. don't expect these to work in fteqw nor dp though.
qcc: rewrote function call handling to use refs rather than defs. this makes struct passing more efficient and makes the __out keyword usable with fields etc.
qccgui: can cope a little better with non-unicode files. can now represent most quake chars.
qcc: suppressed warnings from *extensions.qc

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5000 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-07-12 00:40:13 +00:00

142 lines
4.2 KiB
Text

#pragma progs_dat "../menu.dat"
//#pragma target fte
#define MENU //select the module
#includelist
fteextensions.qc //also sets up system defs
menusys/mitems.qc //root item type
menusys/mitems_common.qc //basic types
menusys/mitem_desktop.qc //other sort of root item
menusys/mitem_exmenu.qc //fullscreen/exclusive menus
menusys/mitem_edittext.qc //simple text editor
menusys/mitem_tabs.qc //tabs
menusys/mitem_colours.qc //colour picker
menusys/mitem_checkbox.qc //checkbox (boolean thingies)
menusys/mitem_slider.qc //scrollbars
menusys/mitem_combo.qc //multiple-choice thingies
menusys/mitem_bind.qc //key binding thingie
menusys/mitem_spinnymodel.qc //menu art
#endlist
//might as well put this here.
void(mitem_desktop desktop) M_Pop =
{
mitem it = desktop.item_kactivechild;
if (it)
it.item_remove();
};
//define the commands.
//cmd argments are: Name, Function, Sourcefile(may be empty)
#define concommandslist \
cmd("m_main", M_Main, menu/main.qc) \
cmd("m_pop", M_Pop, ) \
cmd("m_options", M_Options, menu/options.qc) \
cmd("m_keys", M_Options_Keys, menu/options_keys.qc) \
cmd("m_basicopts", M_Options_Basic, menu/options_basic.qc) \
cmd("m_video", M_Options_Video, menu/options_video.qc) \
cmd("m_effects", M_Options_Effects, menu/options_effects.qc) \
cmd("m_audio", M_Options_Audio, menu/options_audio.qc) \
cmd("m_particles", M_Options_Particles, menu/options_particles.qc) \
cmd("m_hud", M_Options_Hud, menu/options_hud.qc) \
cmd("m_load", M_Load, menu/loadsave.qc) \
cmd("m_save", M_Save, ) \
cmd("m_quit", M_Quit, menu/quit.qc) \
cmd("m_newgame", M_NewGame, menu/newgame.qc) \
cmd("m_servers", M_Servers, menu/servers.qc) \
cmd("m_configs", M_Configs, menu/options_configs.qc) \
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
concommandslist
#endlist
#undef cmd
mitem_desktop desktop;
void() m_shutdown = {};
void() m_draw = {items_draw(desktop);};
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);};
void(float mode) m_toggle
{ //mode is stupid. 1=enable,0=disable,-1=actually toggle.
if (mode < 0)
mode = !desktop.item_kactivechild;
if (mode)
M_Main(desktop);
else while(desktop.item_kactivechild)
{
mitem it = desktop.item_kactivechild;
if (it.item_flags & IF_NOKILL)
break;
it.item_remove();
}
items_updategrabs(TRUE);
};
var float autocvar_dp_workarounds_allow = TRUE;
var float autocvar_dp_workarounds_force = FALSE;
void() m_init =
{
desktop = spawn(mitem_desktop);
//register the console commands via the alias command.
#define cmd(n,f) localcmd("alias " n " \"menu_cmd " n " $*\"\n");
concommandslist
#undef cmd
//work around some dp differences/bugs.
//this check identifies one significant bug in DP.
//if anyone actually cares to fix DP, then there is no reason they cannot do so by just removing DP_QC_RENDERSCENE and then fixing anything else that arises.
if (checkextension("DP_QC_RENDER_SCENE") && !checkextension("DP_CON_SET"))
dp_workarounds = autocvar(dp_workarounds_allow, TRUE);
if (autocvar(dp_workarounds_force, FALSE))
dp_workarounds = TRUE;
if (dp_workarounds)
print("^1WORKING AROUND DP BUGS\n");
//for compat with DP, 'none' is the default cursor in menuqc.
//naturally this is not ideal.
if (checkextension("FTE_QC_HARDWARECURSORS"))
setcursormode(TRUE, "");
else
print("No hardware cursors\n");
if (clientstate() == 1) //disconnected==1, supposedly
m_toggle(1);
};
void(string cstr) GameCommand =
{
tokenize(cstr);
string cmd = argv(0);
switch(cmd)
{
//switch on the known commands.
#define cmd(n,f) case n: f(desktop); break;
concommandslist
#undef cmd
default:
print("unknown command ", cmd, "\n");
break;
}
items_updategrabs(TRUE);
};