fteqw/quakec/menusys/menu/newgame.qc

228 lines
9.8 KiB
C++
Raw Normal View History

//FIXME: maxclients is a QW thing. NQ engines use maxplayers (which requires a disconnect to apply)
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
static string newgameinfo;
class mitem_newgame : mitem_exmenu
{
virtual string(string key) get =
{
return infoget(newgameinfo, key);
};
virtual void(string key, string newval) set =
{
string old = newgameinfo;
newgameinfo = strzone(infoadd(newgameinfo, key, newval));
if (old)
strunzone(old);
};
};
nonstatic void(mitem_desktop desktop) M_NewGame =
{
mitem_pic banner;
string gametype = argv(1);
local float pos;
mitem_exmenu m;
if (gametype == "sp")
{
//single player has no options. the start map itself gives skill+episode options.
localcmd("\ndisconnect; deathmatch 0; coop 0; maxplayers 0; timelimit 0; fraglimit 0; teamplay 0; samelevel 0; startmap_sp\n");
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
return;
}
if (gametype == "begin")
{
cvar_set("hostname", infoget(newgameinfo, "hostname"));
cvar_set("deathmatch", infoget(newgameinfo, "deathmatch"));
cvar_set("coop", infoget(newgameinfo, "coop"));
cvar_set("teamplay", infoget(newgameinfo, "teamplay"));
cvar_set("sv_public", infoget(newgameinfo, "sv_public"));
cvar_set("maxclients", infoget(newgameinfo, "maxclients"));
cvar_set("timelimit", infoget(newgameinfo, "timelimit"));
cvar_set("fraglimit", infoget(newgameinfo, "fraglimit"));
string map = infoget(newgameinfo, "map");
if (map == "")
map = sprintf("dm%g", floor(random(1, 6)));
localcmd(sprintf("\nmap \"%s\"\n", map));
return;
}
if (newgameinfo)
strunzone(newgameinfo);
newgameinfo = "";
newgameinfo = infoadd(newgameinfo, "hostname", cvar_string("hostname"));
newgameinfo = infoadd(newgameinfo, "deathmatch", cvar_string("deathmatch"));
newgameinfo = infoadd(newgameinfo, "teamplay", cvar_string("teamplay"));
newgameinfo = infoadd(newgameinfo, "sv_public", cvar_string("sv_public"));
newgameinfo = infoadd(newgameinfo, "maxclients", cvar_string("maxclients"));
newgameinfo = infoadd(newgameinfo, "timelimit", cvar_string("timelimit"));
newgameinfo = infoadd(newgameinfo, "fraglimit", cvar_string("fraglimit"));
newgameinfo = strzone(newgameinfo);
m = spawn(mitem_newgame, item_text:_("New Game"), item_flags:IF_SELECTABLE, item_command:"m_main");
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();
switch(gametype)
{
case "tdm":
case "dm":
case "coop":
case "sp":
break;
default:
//show game type selection
pos = (16/-2)*(4);
banner = spawn(mitem_pic, item_text:"gfx/p_option.lmp", item_size_y:24, item_flags:IF_CENTERALIGN);
m.addm(banner, [(160-banner.item_size_x)*0.5, pos-32], [(160+banner.item_size_x)*0.5, pos-8]);
m.addm(spawn(mitem_text, item_text:"Single Player", item_command:"m_pop;m_newgame sp", item_scale:16, item_flags:IF_CENTERALIGN), [0, pos], [160, pos+16]); pos += 16;
m.addm(spawn(mitem_text, item_text:"Cooperative", item_command:"m_pop;m_newgame coop", item_scale:16, item_flags:IF_CENTERALIGN), [0, pos], [160, pos+16]); pos += 16;
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;
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]);
return;
}
pos = (16/-2)*(4);
banner = spawn(mitem_pic, item_text:"gfx/p_multi.lmp", item_size_y:24, item_flags:IF_CENTERALIGN);
m.addm(banner, [(160-banner.item_size_x)*0.5, pos-32], [(160+banner.item_size_x)*0.5, pos-8]);
m.addm(menuitemeditt_spawn(_("Hostname"), "hostname", '280 8'), [-160, pos], [160, pos+8]); pos += 8;
fixed eztv md4 incompatibility. reimplemented qtvreverse command. fixed some stuffcmds being handled by the wrong splitscreen seats (was noticable in TF). rework smartjump to try to be more predictable... rework relighting to try to be more robust (and more self-contained). allow the csqc to actually use VF_PROJECTIONOFFSET. jump now moves upwards instead of trying to lock on to a nearby player when spectating. assume 32 fullbright pixels when running with a palette.lmp yet no colormap.lmp (happens with some total conversions). tweaked scoreboard for fainter backgrounds. rearranged autoid, to be smaller etc. hacked around dodgy conchars.lmp - don't treat 128*128 qpics as qpics to work around workarounds for buggy wad tools (with a warning). fixed missing fullbrights on h2holey models. avoided warning about mod_h2holey_bugged on dedicated servers. added net_ice_exchangeprivateips, for people worried about exposing lan IPs when using ICE. sv_public 2: implemented client support for our webrtc broker in order to use our own ICE implementation without needing to faff around with irc accounts or plugins etc. TODO: ensure at least one ephemerial udp port when using ice or come up with some better sv_port handling fixed multiple tls bugs (one could cause server problems). change net_enable_tls to disabled by default anyway (reenable for the server to be able to respond to https/wss/tls schemes again). don't colourmap when there appears to be a highres diffusemap on q1 models. imgtool now understands exporting from qpics in wads, as well as just mips. implemented speed-o-meter in ezhud. added removeinstant builtin to avoid the half-second rule. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5614 fc73d0e0-1445-4013-8a0c-d673dee63da5
2020-02-11 18:06:10 +00:00
m.addm(menuitemcombo_spawn(_("Public"), "sv_public", '280 8', _(
"-1 \"Reject All (Splitscreen)\" "
"0 \"Private (Manual IP Sharing)\" "
"1 \"Public (Manual Config)\" "
"2 \"Public (Holepunch)\" "
)), [-160, pos], [160, pos+8]); pos += 8;
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
m.addm(menuitemcombo_spawn(_("Max Clients"), "maxclients", '280 8', _(
"2 \"Two\" "
"3 \"Three\" "
"4 \"Four\" "
"8 \"Eight\" "
"16 \"Sixteen\" "
"32 \"Thirty Two\" "
)), [-160, pos], [160, pos+8]); pos += 8;
if (gametype == "dm" || gametype == "tdm")
{
if (m.get("deathmatch") == "0")
{
m.set("deathmatch", "1");
m.set("coop", "0");
}
m.addm(menuitemcombo_spawn(_("Deathmatch Mode"), "deathmatch", '280 8', _(
"1 \"Weapons Respawn\" "
"2 \"Weapons Stay\" "
"3 \"Powerups Respawn\" "
"4 \"Start With Weapons\" "
)), [-160, pos], [160, pos+8]); pos += 8;
}
else
{
if (m.get("coop") == "0")
{
m.set("deathmatch", "0");
m.set("coop", "1");
}
}
if (gametype == "tdm")
{
if (m.get("teamplay") == "0")
m.set("teamplay", "1");
}
if (gametype == "dm")
{
if (m.get("teamplay") != "0")
m.set("teamplay", "0");
}
if (gametype == "coop")
m.addm(menuitemcheck_spawn(_("No Friendly Fire"), "teamplay", '280 8'), [-160, pos], [160, pos+8]); pos += 8;
// if (gametype == "dm" || gametype == "tdm")
if (gametype == "coop")
m.set("map", "start");
else
{
m.addm(menuitemcombo_spawn(_("Time Limit"), "timelimit", '280 8', _(
"0 \"No Limit\" "
"5 \"5 minutes\" "
"10 \"10 minutes\" "
"15 \"15 minutes\" "
"20 \"20 minutes\" "
"25 \"25 minutes\" "
"30 \"30 minutes\" "
"35 \"35 minutes\" "
"40 \"40 minutes\" "
"45 \"45 minutes\" "
"50 \"50 minutes\" "
"55 \"55 minutes\" "
"60 \"1 hour\" "
)), [-160, pos], [160, pos+8]); pos += 8;
m.addm(menuitemcombo_spawn(_("Frag Limit"), "fraglimit", '280 8', _(
"0 \"No Limit\" "
"10 \"10 frags\" "
"20 \"20 frags\" "
"30 \"30 frags\" "
"40 \"40 frags\" "
"50 \"50 frags\" "
"60 \"60 frags\" "
"70 \"70 frags\" "
"80 \"80 frags\" "
"90 \"90 frags\" "
"100 \"100 frags\" "
)), [-160, pos], [160, pos+8]); pos += 8;
m.set("map", "");
m.addm(menuitemcombo_spawn(_("Initial Map"), "map", '280 8', _(
"dm1 \"DM1 (dm1)\" "
"dm2 \"DM2 (dm2)\" "
"dm3 \"DM3 (dm3)\" "
"dm4 \"DM4 (dm4)\" "
"dm5 \"DM5 (dm5)\" "
"dm6 \"DM6 (dm6)\" "
"start \"Start (Introduction)\" "
"e1m1 \"E1M1 (The Slipgate Complex)\" "
"e1m2 \"E1M2 (Castle Of The Damned)\" "
"e1m3 \"E1M3 (The Necropolis)\" "
"e1m4 \"E1M4 (The Grisly Grotto)\" "
"e1m5 \"E1M5 (Gloom Keep)\" "
"e1m6 \"E1M6 (The Door To Chthon)\" "
"e1m7 \"E1M7 (The House Of Chthon)\" "
"e1m8 \"E1M8 (Ziggarat Vertigo)\" "
"e2m1 \"E2M1 (The Installation)\" "
"e2m2 \"E2M2 (The Ogre Citadel)\" "
"e2m3 \"E2M3 (The Crypt Of Decay)\" "
"e2m4 \"E2M4 (The Ebon Fortress)\" "
"e2m5 \"E2M5 (The Wizard's Manse)\" "
"e2m6 \"E2M6 (The Dismal Oubliette\" "
"e2m7 \"E2M7 (The Underearth)\" "
"e3m1 \"E3M1 (Termination Central)\" "
"e3m2 \"E3M2 (The Vaults Of Zin)\" "
"e3m3 \"E3M3 (The Tomb Of Terror)\" "
"e3m4 \"E3M4 (Satan's Dark Delight)\" "
"e3m5 \"E3M5 (The Wind Tunnels)\" "
"e3m6 \"E3M6 (Chambers Of Torment)\" "
"e3m7 \"E3M7 (Tha Haunted Halls)\" "
"e4m1 \"E4M1 (The Sewage System)\" "
"e4m2 \"E4M2 (The Tower Of Despair)\" "
"e4m3 \"E4M3 (The Elder God Shrine)\" "
"e4m4 \"E4M4 (The Palace Of Hate)\" "
"e4m5 \"E4M5 (Hell's Atrium)\" "
"e4m6 \"E4M6 (The Pain Maze)\" "
"e4m7 \"E4M7 (Azure Agony)\" "
"e4m8 \"E4M8 (The Nameless City)\" "
"end \"End (Shub-Niggurath's Pit)\" "
)), [-160, pos], [160, pos+8]); pos += 8;
}
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
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
if (gametype == "coop")
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
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]);
addmenuback(m);
};